From 41e7e32cf5505d5707aa8a1a22b4929f1cf92ea8 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 29 Sep 2017 15:54:55 -0500 Subject: [PATCH 001/144] adds fallbacks to the aiTurret's scannode to operate similar to the aimNode, letting folks skip out on adding either and just using pitch (or failing that, heading) --- Engine/source/T3D/turret/aiTurretShape.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/Engine/source/T3D/turret/aiTurretShape.cpp b/Engine/source/T3D/turret/aiTurretShape.cpp index b0c903950..d4bbd70eb 100644 --- a/Engine/source/T3D/turret/aiTurretShape.cpp +++ b/Engine/source/T3D/turret/aiTurretShape.cpp @@ -249,14 +249,11 @@ bool AITurretShapeData::preload(bool server, String &errorStr) // We have mShape at this point. Resolve nodes. scanNode = mShape->findNode("scanPoint"); aimNode = mShape->findNode("aimPoint"); - if (aimNode == -1) - { - aimNode = pitchNode; - } - if (aimNode == -1) - { - aimNode = headingNode; - } + + if (scanNode == -1) scanNode = pitchNode; + if (scanNode == -1) scanNode = headingNode; + if (aimNode == -1) aimNode = pitchNode; + if (aimNode == -1) aimNode = headingNode; // Resolve state sequence names & emitter nodes isAnimated = false; From 4310ab3b27ec49be478eb0768721f9ed146f6bb2 Mon Sep 17 00:00:00 2001 From: OTHGMars Date: Wed, 18 Oct 2017 03:25:05 -0400 Subject: [PATCH 002/144] Sets scale for collision primitives created in the shape editor. --- Engine/source/ts/tsCollision.cpp | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/Engine/source/ts/tsCollision.cpp b/Engine/source/ts/tsCollision.cpp index 1d04b409e..6fe935bbe 100644 --- a/Engine/source/ts/tsCollision.cpp +++ b/Engine/source/ts/tsCollision.cpp @@ -1044,6 +1044,9 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & // We need the default mesh transform. MatrixF localXfm; getNodeWorldTransform( object.nodeIndex, &localXfm ); + Point3F t = localXfm.getPosition(); + t.convolve(scale); + localXfm.setPosition(t); // We have some sort of collision shape... so allocate it. if ( !colShape ) @@ -1053,12 +1056,14 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & if ( dStrStartsWith( meshName, "Colbox" ) ) { // The bounds define the box extents directly. - Point3F halfWidth = mesh->getBounds().getExtents() * 0.5f; + Point3F halfWidth = mesh->getBounds().getExtents() * scale * 0.5f; // Add the offset to the center of the bounds // into the local space transform. MatrixF centerXfm( true ); - centerXfm.setPosition( mesh->getBounds().getCenter() ); + Point3F t = mesh->getBounds().getCenter(); + t.convolve(scale); + centerXfm.setPosition(t); localXfm.mul( centerXfm ); colShape->addBox( halfWidth, localXfm ); @@ -1066,12 +1071,15 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & else if ( dStrStartsWith( meshName, "Colsphere" ) ) { // Get a sphere inscribed to the bounds. - F32 radius = mesh->getBounds().len_min() * 0.5f; + Point3F extents = mesh->getBounds().getExtents() * scale; + F32 radius = extents.least() * 0.5f; - // Add the offset to the center of the bounds + // Add the offset to the center of the bounds // into the local space transform. MatrixF primXfm( true ); - primXfm.setPosition( mesh->getBounds().getCenter() ); + Point3F t = mesh->getBounds().getCenter(); + t.convolve(scale); + primXfm.setPosition(t); localXfm.mul( primXfm ); colShape->addSphere( radius, localXfm ); @@ -1079,12 +1087,14 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & else if ( dStrStartsWith( meshName, "Colcapsule" ) ) { // Use the smallest extent as the radius for the capsule. - Point3F extents = mesh->getBounds().getExtents(); + Point3F extents = mesh->getBounds().getExtents() * scale; F32 radius = extents.least() * 0.5f; // We need to center the capsule and align it to the Y axis. MatrixF primXfm( true ); - primXfm.setPosition( mesh->getBounds().getCenter() ); + Point3F t = mesh->getBounds().getCenter(); + t.convolve(scale); + primXfm.setPosition(t); // Use the longest axis as the capsule height. F32 height = -radius * 2.0f; @@ -1139,10 +1149,6 @@ PhysicsCollision* TSShape::_buildColShapes( bool useVisibleMesh, const Point3F & VertexPolyList polyList; MatrixF meshMat( localXfm ); - Point3F t = meshMat.getPosition(); - t.convolve( scale ); - meshMat.setPosition( t ); - polyList.setTransform( &MatrixF::Identity, scale ); mesh->buildPolyList( 0, &polyList, surfaceKey, NULL ); colShape->addConvex( polyList.getVertexList().address(), From 9e435a3f34d5e9d5a34d86a189fa92d3fcc379cb Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 24 Oct 2017 19:15:54 -0500 Subject: [PATCH 003/144] allows arbitrary material name string replacement, rather than forcing folks to start with base. ie: an entry of skin = "blue; area=fire"; would replace base_area_grid with blue_fire_grid as the used material --- Engine/source/ts/tsShapeInstance.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Engine/source/ts/tsShapeInstance.cpp b/Engine/source/ts/tsShapeInstance.cpp index 98d6b39ea..7010371bc 100644 --- a/Engine/source/ts/tsShapeInstance.cpp +++ b/Engine/source/ts/tsShapeInstance.cpp @@ -307,12 +307,9 @@ void TSShapeInstance::reSkin( String newBaseName, String oldBaseName ) { // Try changing base const String &pName = materialNames[i]; - if ( pName.compare( oldBaseName, oldBaseNameLength, String::NoCase ) == 0 ) - { - String newName( pName ); - newName.replace( 0, oldBaseNameLength, newBaseName ); - pMatList->renameMaterial( i, newName ); - } + String newName( pName ); + newName.replace( oldBaseName, newBaseName ); + pMatList->renameMaterial( i, newName ); } // Initialize the material instances From f9bf4fca4bd014336e989c2f696db6c6d2353e06 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Sun, 12 Nov 2017 23:58:34 -0600 Subject: [PATCH 004/144] new method: TSShapeInstance::resetMaterialList(). Sets all object-instance mapto values back to initial state. reskin now does so to avoid having to track origional values independently. (so say, if you've already got skin1 plugged in to one, and nothing in to another, no need to set skin1=skin2 on the first and skin2 or base=skin2 on the second to swap both on over to skin2). also by request, went ahead and killed case sensitivity for mapto string replacement when reskinning. --- Engine/source/T3D/player.cpp | 1 + Engine/source/T3D/shapeBase.cpp | 1 + Engine/source/T3D/tsStatic.cpp | 1 + Engine/source/ts/tsShapeInstance.cpp | 10 ++++++++-- Engine/source/ts/tsShapeInstance.h | 2 +- 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index 15b57046a..7f537d65d 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -1953,6 +1953,7 @@ void Player::reSkin() { if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() ) { + mShapeInstance->resetMaterialList(); Vector skins; String(mSkinNameHandle.getString()).split( ";", skins ); diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 5f71a7eb9..19ada8ce2 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -3689,6 +3689,7 @@ void ShapeBase::reSkin() { if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() ) { + mShapeInstance->resetMaterialList(); Vector skins; String(mSkinNameHandle.getString()).split( ";", skins ); diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index b2f33f44a..67e210f34 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -534,6 +534,7 @@ void TSStatic::reSkin() { if ( isGhost() && mShapeInstance && mSkinNameHandle.isValidString() ) { + mShapeInstance->resetMaterialList(); Vector skins; String(mSkinNameHandle.getString()).split( ";", skins ); diff --git a/Engine/source/ts/tsShapeInstance.cpp b/Engine/source/ts/tsShapeInstance.cpp index 7010371bc..53167f1cf 100644 --- a/Engine/source/ts/tsShapeInstance.cpp +++ b/Engine/source/ts/tsShapeInstance.cpp @@ -307,8 +307,8 @@ void TSShapeInstance::reSkin( String newBaseName, String oldBaseName ) { // Try changing base const String &pName = materialNames[i]; - String newName( pName ); - newName.replace( oldBaseName, newBaseName ); + String newName( String::ToLower(pName) ); + newName.replace( String::ToLower(oldBaseName), String::ToLower(newBaseName) ); pMatList->renameMaterial( i, newName ); } @@ -316,6 +316,12 @@ void TSShapeInstance::reSkin( String newBaseName, String oldBaseName ) initMaterialList(); } +void TSShapeInstance::resetMaterialList() +{ + TSMaterialList* oMatlist = mShape->materialList; + setMaterialList(oMatlist); +} + //------------------------------------------------------------------------------------- // Render & detail selection //------------------------------------------------------------------------------------- diff --git a/Engine/source/ts/tsShapeInstance.h b/Engine/source/ts/tsShapeInstance.h index c483c8792..627eb63ce 100644 --- a/Engine/source/ts/tsShapeInstance.h +++ b/Engine/source/ts/tsShapeInstance.h @@ -377,7 +377,7 @@ protected: } void reSkin( String newBaseName, String oldBaseName = String::EmptyString ); - + void resetMaterialList(); enum { MaskNodeRotation = 0x01, From 8de2bf807fe26de44fc4403b10f6e9ee0ba5fd50 Mon Sep 17 00:00:00 2001 From: Johxz Date: Sun, 4 Feb 2018 21:49:50 -0600 Subject: [PATCH 005/144] update to bullet 2.87 --- Engine/lib/bullet/AUTHORS.txt | 9 +- Engine/lib/bullet/CMakeLists.txt | 182 ++- Engine/lib/bullet/README.md | 34 +- Engine/lib/bullet/VERSION | 2 +- .../BroadphaseCollision/btAxisSweep3.h | 1001 +------------- .../btAxisSweep3Internal.h | 1022 +++++++++++++++ .../btBroadphaseInterface.h | 6 +- .../BroadphaseCollision/btBroadphaseProxy.cpp | 1 + .../BroadphaseCollision/btBroadphaseProxy.h | 13 +- .../BroadphaseCollision/btDbvt.cpp | 110 +- .../BroadphaseCollision/btDbvt.h | 11 + .../BroadphaseCollision/btDbvtBroadphase.cpp | 9 +- .../BroadphaseCollision/btDbvtBroadphase.h | 4 +- .../btOverlappingPairCache.h | 14 +- .../btOverlappingPairCallback.h | 3 + .../BroadphaseCollision/btQuantizedBvh.cpp | 2 + .../BroadphaseCollision/btQuantizedBvh.h | 2 +- .../btSimpleBroadphase.cpp | 4 +- .../BroadphaseCollision/btSimpleBroadphase.h | 6 +- .../bullet/src/BulletCollision/CMakeLists.txt | 8 +- .../SphereTriangleDetector.cpp | 77 +- .../btActivatingCollisionAlgorithm.h | 3 +- .../btCollisionDispatcher.cpp | 3 - .../btCollisionDispatcherMt.cpp | 164 +++ .../btCollisionDispatcherMt.h | 39 + .../CollisionDispatch/btCollisionObject.cpp | 12 +- .../CollisionDispatch/btCollisionObject.h | 2 + .../CollisionDispatch/btCollisionWorld.cpp | 11 +- .../CollisionDispatch/btCollisionWorld.h | 14 +- .../btCollisionWorldImporter.cpp | 4 +- .../btCollisionWorldImporter.h | 1 - .../btCompoundCompoundCollisionAlgorithm.cpp | 11 + .../btCompoundCompoundCollisionAlgorithm.h | 2 - .../btConvexConcaveCollisionAlgorithm.cpp | 4 +- .../btConvexConvexAlgorithm.cpp | 50 +- .../btHashedSimplePairCache.h | 6 +- .../CollisionDispatch/btManifoldResult.cpp | 13 +- .../CollisionShapes/btBox2dShape.h | 3 +- .../CollisionShapes/btBoxShape.cpp | 4 +- .../btBvhTriangleMeshShape.cpp | 3 + .../CollisionShapes/btCapsuleShape.cpp | 26 +- .../CollisionShapes/btCapsuleShape.h | 34 +- .../CollisionShapes/btCollisionShape.cpp | 5 +- .../CollisionShapes/btConeShape.h | 12 +- .../CollisionShapes/btConvexHullShape.cpp | 5 +- .../CollisionShapes/btConvexInternalShape.h | 3 + .../CollisionShapes/btConvexShape.cpp | 10 +- .../CollisionShapes/btCylinderShape.cpp | 5 +- .../CollisionShapes/btCylinderShape.h | 10 +- .../CollisionShapes/btMinkowskiSumShape.cpp | 21 +- .../CollisionShapes/btMultiSphereShape.cpp | 5 +- .../CollisionShapes/btPolyhedralConvexShape.h | 4 +- .../CollisionShapes/btSphereShape.h | 3 + .../CollisionShapes/btStaticPlaneShape.h | 8 +- .../btStridingMeshInterface.cpp | 7 + .../CollisionShapes/btTriangleInfoMap.h | 7 + .../Gimpact/btCompoundFromGimpact.h | 20 +- .../Gimpact/btContactProcessing.h | 82 +- .../Gimpact/btContactProcessingStructs.h | 109 ++ .../BulletCollision/Gimpact/btGImpactBvh.h | 80 +- .../Gimpact/btGImpactBvhStructs.h | 105 ++ .../Gimpact/btGImpactQuantizedBvh.h | 69 +- .../Gimpact/btGImpactQuantizedBvhStructs.h | 91 ++ .../src/BulletCollision/Gimpact/gim_array.h | 2 +- .../Gimpact/gim_basic_geometry_operations.h | 7 +- .../Gimpact/gim_box_collision.h | 9 +- .../src/BulletCollision/Gimpact/gim_contact.h | 8 + .../Gimpact/gim_tri_collision.h | 3 +- .../btDiscreteCollisionDetectorInterface.h | 4 +- .../NarrowPhaseCollision/btManifoldPoint.h | 1 + .../btPersistentManifold.cpp | 3 + .../btPersistentManifold.h | 77 +- .../bullet/src/BulletDynamics/CMakeLists.txt | 2 + .../btKinematicCharacterController.cpp | 13 +- .../btConeTwistConstraint.cpp | 4 +- .../ConstraintSolver/btConeTwistConstraint.h | 2 +- .../ConstraintSolver/btContactConstraint.h | 4 +- .../ConstraintSolver/btContactSolverInfo.h | 15 +- .../ConstraintSolver/btGearConstraint.h | 8 + .../btGeneric6DofConstraint.cpp | 4 +- .../btGeneric6DofSpring2Constraint.cpp | 63 +- .../btGeneric6DofSpring2Constraint.h | 5 + .../ConstraintSolver/btHingeConstraint.cpp | 20 +- .../ConstraintSolver/btHingeConstraint.h | 10 +- .../btNNCGConstraintSolver.cpp | 115 +- .../btSequentialImpulseConstraintSolver.cpp | 416 +++--- .../btSequentialImpulseConstraintSolver.h | 26 +- .../ConstraintSolver/btSliderConstraint.cpp | 21 +- .../ConstraintSolver/btTypedConstraint.cpp | 2 +- .../Dynamics/btDiscreteDynamicsWorld.cpp | 14 +- .../Dynamics/btDiscreteDynamicsWorld.h | 4 +- .../Dynamics/btDiscreteDynamicsWorldMt.cpp | 171 ++- .../Dynamics/btDiscreteDynamicsWorldMt.h | 96 +- .../BulletDynamics/Dynamics/btDynamicsWorld.h | 7 +- .../BulletDynamics/Dynamics/btRigidBody.cpp | 5 + .../Dynamics/btSimpleDynamicsWorld.cpp | 2 +- .../Dynamics/btSimpleDynamicsWorld.h | 2 +- .../Dynamics/btSimulationIslandManagerMt.cpp | 41 +- .../Dynamics/btSimulationIslandManagerMt.h | 3 +- .../Featherstone/btMultiBody.cpp | 70 +- .../BulletDynamics/Featherstone/btMultiBody.h | 27 +- .../Featherstone/btMultiBodyConstraint.h | 14 +- .../btMultiBodyConstraintSolver.cpp | 181 ++- .../Featherstone/btMultiBodyDynamicsWorld.cpp | 16 +- .../Featherstone/btMultiBodyDynamicsWorld.h | 7 +- .../Featherstone/btMultiBodyFixedConstraint.h | 4 +- .../btMultiBodyGearConstraint.cpp | 184 +++ .../Featherstone/btMultiBodyGearConstraint.h | 117 ++ .../btMultiBodyJointLimitConstraint.cpp | 10 +- .../Featherstone/btMultiBodyJointMotor.cpp | 3 + .../Featherstone/btMultiBodyLink.h | 30 +- .../Featherstone/btMultiBodyLinkCollider.h | 47 +- .../Featherstone/btMultiBodyPoint2Point.h | 7 +- .../btMultiBodySliderConstraint.h | 4 +- .../BulletDynamics/Vehicle/btRaycastVehicle.h | 2 +- .../src/BulletDynamics/Vehicle/btWheelInfo.h | 2 + .../src/BulletInverseDynamics/IDConfig.hpp | 33 +- .../BulletInverseDynamics/IDErrorMessages.hpp | 7 +- .../src/BulletInverseDynamics/IDMath.cpp | 64 +- .../src/BulletInverseDynamics/IDMath.hpp | 3 +- .../BulletInverseDynamics/MultiBodyTree.cpp | 8 +- .../details/MultiBodyTreeImpl.cpp | 2 +- .../btDefaultSoftBodySolver.cpp | 12 +- .../bullet/src/BulletSoftBody/btSoftBody.cpp | 17 +- .../bullet/src/BulletSoftBody/btSoftBody.h | 9 +- .../src/BulletSoftBody/btSoftBodyHelpers.cpp | 4 +- .../src/BulletSoftBody/btSoftBodyInternals.h | 39 +- .../btSoftMultiBodyDynamicsWorld.cpp | 2 +- .../btSoftMultiBodyDynamicsWorld.h | 4 +- .../btSoftRigidCollisionAlgorithm.h | 4 +- .../btSoftRigidDynamicsWorld.cpp | 2 +- .../BulletSoftBody/btSoftRigidDynamicsWorld.h | 2 +- .../btSoftSoftCollisionAlgorithm.h | 4 +- .../bullet/src/BulletSoftBody/btSparseSDF.h | 2 +- Engine/lib/bullet/src/CMakeLists.txt | 6 +- .../lib/bullet/src/LinearMath/CMakeLists.txt | 1 + .../src/LinearMath/btAlignedObjectArray.h | 33 +- .../src/LinearMath/btConvexHullComputer.cpp | 15 +- Engine/lib/bullet/src/LinearMath/btHashMap.h | 43 +- .../lib/bullet/src/LinearMath/btIDebugDraw.h | 4 + .../lib/bullet/src/LinearMath/btMatrix3x3.h | 117 +- .../lib/bullet/src/LinearMath/btQuaternion.h | 40 +- .../lib/bullet/src/LinearMath/btQuickprof.cpp | 360 +++-- .../lib/bullet/src/LinearMath/btQuickprof.h | 68 +- Engine/lib/bullet/src/LinearMath/btScalar.h | 1027 ++++++++------- .../bullet/src/LinearMath/btSerializer.cpp | 1160 ++++------------- .../lib/bullet/src/LinearMath/btSerializer.h | 4 +- .../bullet/src/LinearMath/btSerializer64.cpp | 599 +++++++++ .../lib/bullet/src/LinearMath/btThreads.cpp | 522 +++++++- Engine/lib/bullet/src/LinearMath/btThreads.h | 109 +- .../bullet/src/LinearMath/btTransformUtil.h | 21 +- Engine/lib/bullet/src/LinearMath/btVector3.h | 15 +- .../lib/bullet/src/btBulletCollisionCommon.h | 1 - 153 files changed, 6111 insertions(+), 3756 deletions(-) create mode 100644 Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3Internal.h create mode 100644 Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.cpp create mode 100644 Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.h create mode 100644 Engine/lib/bullet/src/BulletCollision/Gimpact/btContactProcessingStructs.h create mode 100644 Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactBvhStructs.h create mode 100644 Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactQuantizedBvhStructs.h create mode 100644 Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyGearConstraint.cpp create mode 100644 Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyGearConstraint.h create mode 100644 Engine/lib/bullet/src/LinearMath/btSerializer64.cpp diff --git a/Engine/lib/bullet/AUTHORS.txt b/Engine/lib/bullet/AUTHORS.txt index 556e6f641..1bff63207 100644 --- a/Engine/lib/bullet/AUTHORS.txt +++ b/Engine/lib/bullet/AUTHORS.txt @@ -2,17 +2,21 @@ Bullet Physics is created by Erwin Coumans with contributions from the following AMD Apple +Yunfei Bai Steve Baker Gino van den Bergen +Jeff Bingham Nicola Candussi Erin Catto Lawrence Chai Erwin Coumans -Christer Ericson Disney Animation +Benjamin Ellenberger +Christer Ericson Google Dirk Gregorius Marcus Hennix +Jasmine Hsu MBSim Development Team Takahiro Harada Simon Hobbs @@ -20,6 +24,7 @@ John Hsu Ole Kniemeyer Jay Lee Francisco Leon +lunkhound Vsevolod Klementjev Phil Knight John McCutchan @@ -32,9 +37,9 @@ Russel Smith Sony Jakub Stephien Marten Svanfeldt +Jie Tan Pierre Terdiman Steven Thompson Tamas Umenhoffer -Yunfei Bai If your name is missing, please send an email to erwin.coumans@gmail.com or file an issue at http://github.com/bulletphysics/bullet3 diff --git a/Engine/lib/bullet/CMakeLists.txt b/Engine/lib/bullet/CMakeLists.txt index 26e662c97..f0e62d396 100644 --- a/Engine/lib/bullet/CMakeLists.txt +++ b/Engine/lib/bullet/CMakeLists.txt @@ -1,11 +1,11 @@ cmake_minimum_required(VERSION 2.4.3) set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true) - +cmake_policy(SET CMP0017 NEW) #this line has to appear before 'PROJECT' in order to be able to disable incremental linking SET(MSVC_INCREMENTAL_DEFAULT ON) PROJECT(BULLET_PHYSICS) -SET(BULLET_VERSION 2.85) +FILE (STRINGS "VERSION" BULLET_VERSION) IF(COMMAND cmake_policy) cmake_policy(SET CMP0003 NEW) @@ -15,7 +15,6 @@ IF(COMMAND cmake_policy) endif(POLICY CMP0042) ENDIF(COMMAND cmake_policy) - IF (NOT CMAKE_BUILD_TYPE) # SET(CMAKE_BUILD_TYPE "Debug") SET(CMAKE_BUILD_TYPE "Release") @@ -27,8 +26,33 @@ SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") OPTION(USE_DOUBLE_PRECISION "Use double precision" OFF) OPTION(USE_GRAPHICAL_BENCHMARK "Use Graphical Benchmark" ON) OPTION(BUILD_SHARED_LIBS "Use shared libraries" OFF) -OPTION(USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD "Use btSoftMultiBodyDynamicsWorld" OFF) -OPTION(BULLET2_USE_THREAD_LOCKS "Build Bullet 2 libraries with mutex locking around certain operations" OFF) +OPTION(USE_SOFT_BODY_MULTI_BODY_DYNAMICS_WORLD "Use btSoftMultiBodyDynamicsWorld" OFF) + +OPTION(BULLET2_USE_THREAD_LOCKS "Build Bullet 2 libraries with mutex locking around certain operations (required for multi-threading)" OFF) +IF (BULLET2_USE_THREAD_LOCKS) + OPTION(BULLET2_USE_OPEN_MP_MULTITHREADING "Build Bullet 2 with support for multi-threading with OpenMP (requires a compiler with OpenMP support)" OFF) + OPTION(BULLET2_USE_TBB_MULTITHREADING "Build Bullet 2 with support for multi-threading with Intel Threading Building Blocks (requires the TBB library to be already installed)" OFF) + IF (MSVC) + OPTION(BULLET2_USE_PPL_MULTITHREADING "Build Bullet 2 with support for multi-threading with Microsoft Parallel Patterns Library (requires MSVC compiler)" OFF) + ENDIF (MSVC) +ENDIF (BULLET2_USE_THREAD_LOCKS) + + +IF(NOT WIN32) + SET(DL ${CMAKE_DL_LIBS}) + IF(CMAKE_SYSTEM_NAME MATCHES "Linux") + MESSAGE("Linux") + SET(OSDEF -D_LINUX) + ELSE(CMAKE_SYSTEM_NAME MATCHES "Linux") + IF(APPLE) + MESSAGE("Apple") + SET(OSDEF -D_DARWIN) + ELSE(APPLE) + MESSAGE("BSD?") + SET(OSDEF -D_BSD) + ENDIF(APPLE) + ENDIF(CMAKE_SYSTEM_NAME MATCHES "Linux") +ENDIF(NOT WIN32) OPTION(USE_MSVC_INCREMENTAL_LINKING "Use MSVC Incremental Linking" OFF) OPTION(USE_CUSTOM_VECTOR_MATH "Use custom vectormath library" OFF) @@ -85,15 +109,60 @@ IF(MSVC) ADD_DEFINITIONS(-D_WIN64) ELSE() OPTION(USE_MSVC_SSE "Use MSVC /arch:sse option" ON) + option(USE_MSVC_SSE2 "Compile your program with SSE2 instructions" ON) + IF (USE_MSVC_SSE) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE") ENDIF() + IF (USE_MSVC_SSE2) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2") + ENDIF() + ENDIF() + + option(USE_MSVC_AVX "Compile your program with AVX instructions" OFF) + + IF(USE_MSVC_AVX) + add_definitions(/arch:AVX) + ENDIF() + OPTION(USE_MSVC_FAST_FLOATINGPOINT "Use MSVC /fp:fast option" ON) IF (USE_MSVC_FAST_FLOATINGPOINT) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /fp:fast") ENDIF() + OPTION(USE_MSVC_STRING_POOLING "Use MSVC /GF string pooling option" ON) + IF (USE_MSVC_STRING_POOLING) + SET(CMAKE_C_FLAGS "/GF ${CMAKE_C_FLAGS}") + SET(CMAKE_CXX_FLAGS "/GF ${CMAKE_CXX_FLAGS}") + ENDIF() + + OPTION(USE_MSVC_FUNCTION_LEVEL_LINKING "Use MSVC /Gy function level linking option" ON) + IF(USE_MSVC_FUNCTION_LEVEL_LINKING) + SET(CMAKE_C_FLAGS "/Gy ${CMAKE_C_FLAGS}") + SET(CMAKE_CXX_FLAGS "/Gy ${CMAKE_CXX_FLAGS}") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:REF") + ENDIF(USE_MSVC_FUNCTION_LEVEL_LINKING) + + OPTION(USE_MSVC_EXEPTIONS "Use MSVC C++ exceptions option" OFF) + + + + OPTION(USE_MSVC_COMDAT_FOLDING "Use MSVC /OPT:ICF COMDAT folding option" ON) + + IF(USE_MSVC_COMDAT_FOLDING) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:ICF") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:ICF") + ENDIF() + + OPTION(USE_MSVC_DISABLE_RTTI "Use MSVC /GR- disabled RTTI flags option" ON) + IF(USE_MSVC_DISABLE_RTTI) + STRING(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable RTTI + SET(CMAKE_C_FLAGS "/GR- ${CMAKE_C_FLAGS}") + SET(CMAKE_CXX_FLAGS "/GR- ${CMAKE_CXX_FLAGS}") + ENDIF(USE_MSVC_DISABLE_RTTI) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4244 /wd4267") ENDIF(MSVC) @@ -163,6 +232,30 @@ IF(BULLET2_USE_THREAD_LOCKS) ENDIF (NOT MSVC) ENDIF (BULLET2_USE_THREAD_LOCKS) +IF (BULLET2_USE_OPEN_MP_MULTITHREADING) + ADD_DEFINITIONS("-DBT_USE_OPENMP=1") + IF (MSVC) + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /openmp") + ELSE (MSVC) + # GCC, Clang + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp") + ENDIF (MSVC) +ENDIF (BULLET2_USE_OPEN_MP_MULTITHREADING) + +IF (BULLET2_USE_TBB_MULTITHREADING) + SET (BULLET2_TBB_INCLUDE_DIR "not found" CACHE PATH "Directory for Intel TBB includes.") + SET (BULLET2_TBB_LIB_DIR "not found" CACHE PATH "Directory for Intel TBB libraries.") + find_library(TBB_LIBRARY tbb PATHS ${BULLET2_TBB_LIB_DIR}) + find_library(TBBMALLOC_LIBRARY tbbmalloc PATHS ${BULLET2_TBB_LIB_DIR}) + ADD_DEFINITIONS("-DBT_USE_TBB=1") + INCLUDE_DIRECTORIES( ${BULLET2_TBB_INCLUDE_DIR} ) + LINK_LIBRARIES( ${TBB_LIBRARY} ${TBBMALLOC_LIBRARY} ) +ENDIF (BULLET2_USE_TBB_MULTITHREADING) + +IF (BULLET2_USE_PPL_MULTITHREADING) + ADD_DEFINITIONS("-DBT_USE_PPL=1") +ENDIF (BULLET2_USE_PPL_MULTITHREADING) + IF (WIN32) OPTION(USE_GLUT "Use Glut" ON) ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS ) @@ -208,19 +301,40 @@ IF (APPLE) ENDIF() OPTION(BUILD_BULLET3 "Set when you want to build Bullet 3" ON) +# Optional Python configuration +# builds pybullet automatically if all the requirements are met +SET(PYTHON_VERSION_PYBULLET "" CACHE STRING "Python version pybullet will use.") +SET(Python_ADDITIONAL_VERSIONS 3 3.6 3.5 3.4 3.3 3.2 3.1 3.0 2.7 2.7.12 2.7.10 2.7.3 ) +SET_PROPERTY(CACHE PYTHON_VERSION_PYBULLET PROPERTY STRINGS ${Python_ADDITIONAL_VERSIONS}) +SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build3/cmake ${CMAKE_MODULE_PATH}) +OPTION(EXACT_PYTHON_VERSION "Require Python and match PYTHON_VERSION_PYBULLET exactly, e.g. 2.7.12" OFF) +IF(EXACT_PYTHON_VERSION) + set(EXACT_PYTHON_VERSION_FLAG EXACT REQUIRED) +ENDIF(EXACT_PYTHON_VERSION) +# first find the python interpreter +FIND_PACKAGE(PythonInterp ${PYTHON_VERSION_PYBULLET} ${EXACT_PYTHON_VERSION_FLAG}) +# python library should exactly match that of the interpreter +FIND_PACKAGE(PythonLibs ${PYTHON_VERSION_STRING} EXACT) +SET(DEFAULT_BUILD_PYBULLET OFF) +IF(PYTHONLIBS_FOUND) + SET(DEFAULT_BUILD_PYBULLET ON) +ENDIF(PYTHONLIBS_FOUND) +OPTION(BUILD_PYBULLET "Set when you want to build pybullet (Python bindings for Bullet)" ${DEFAULT_BUILD_PYBULLET}) -OPTION(BUILD_PYBULLET "Set when you want to build pybullet (experimental Python bindings for Bullet)" OFF) +OPTION(BUILD_ENET "Set when you want to build apps with enet UDP networking support" ON) +OPTION(BUILD_CLSOCKET "Set when you want to build apps with enet TCP networking support" ON) IF(BUILD_PYBULLET) - FIND_PACKAGE(PythonLibs) OPTION(BUILD_PYBULLET_NUMPY "Set when you want to build pybullet with NumPy support" OFF) OPTION(BUILD_PYBULLET_ENET "Set when you want to build pybullet with enet UDP networking support" ON) - - IF(BUILD_PYBULLET_NUMPY) - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_LIST_DIR}/build3/cmake) + OPTION(BUILD_PYBULLET_CLSOCKET "Set when you want to build pybullet with enet TCP networking support" ON) + + OPTION(BUILD_PYBULLET_MAC_USE_PYTHON_FRAMEWORK "Set when you want to use the Python Framework on Mac" OFF) + + IF(BUILD_PYBULLET_NUMPY) #include(FindNumPy) FIND_PACKAGE(NumPy) if (PYTHON_NUMPY_FOUND) @@ -230,13 +344,25 @@ IF(BUILD_PYBULLET) message("NumPy not found") endif() ENDIF() - OPTION(BUILD_PYBULLET "Set when you want to build pybullet (experimental Python bindings for Bullet)" OFF) IF(WIN32) SET(BUILD_SHARED_LIBS OFF CACHE BOOL "Shared Libs" FORCE) ELSE(WIN32) SET(BUILD_SHARED_LIBS ON CACHE BOOL "Shared Libs" FORCE) ENDIF(WIN32) + + IF(APPLE) + OPTION(BUILD_PYBULLET_MAC_USE_PYTHON_FRAMEWORK "Set when you want to use the Python Framework on Mac" ON) + IF(NOT BUILD_PYBULLET_MAC_USE_PYTHON_FRAMEWORK) + add_definitions(-DB3_NO_PYTHON_FRAMEWORK) + ENDIF(NOT BUILD_PYBULLET_MAC_USE_PYTHON_FRAMEWORK) + OPTION(BUILD_PYBULLET_SHOW_PY_VERSION "Set when you want to show the PY_MAJOR_VERSION and PY_MAJOR_VERSION using #pragme message." OFF) + IF(BUILD_PYBULLET_SHOW_PY_VERSION) + add_definitions(-DB3_DUMP_PYTHON_VERSION) + ENDIF() + + ENDIF(APPLE) + ENDIF(BUILD_PYBULLET) IF(BUILD_BULLET3) @@ -272,14 +398,6 @@ IF(BUILD_BULLET2_DEMOS) SUBDIRS(examples) ENDIF() - IF (BULLET2_USE_THREAD_LOCKS) - OPTION(BULLET2_MULTITHREADED_OPEN_MP_DEMO "Build Bullet 2 MultithreadedDemo using OpenMP (requires a compiler with OpenMP support)" OFF) - OPTION(BULLET2_MULTITHREADED_TBB_DEMO "Build Bullet 2 MultithreadedDemo using Intel Threading Building Blocks (requires the TBB library to be already installed)" OFF) - IF (MSVC) - OPTION(BULLET2_MULTITHREADED_PPL_DEMO "Build Bullet 2 MultithreadedDemo using Microsoft Parallel Patterns Library (requires MSVC compiler)" OFF) - ENDIF (MSVC) - ENDIF (BULLET2_USE_THREAD_LOCKS) - ENDIF(BUILD_BULLET2_DEMOS) @@ -290,7 +408,6 @@ IF(BUILD_EXTRAS) ENDIF(BUILD_EXTRAS) -#Maya Dynamica plugin is moved to http://dynamica.googlecode.com SUBDIRS(src) @@ -305,7 +422,15 @@ ELSE() ENDIF() ENDIF() + IF(INSTALL_LIBS) + #INSTALL of other files requires CMake 2.6 + IF(BUILD_EXTRAS) + IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5) + OPTION(INSTALL_EXTRA_LIBS "Set when you want extra libraries installed" ON) + ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5) + ENDIF(BUILD_EXTRAS) + SET (LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" ) SET (LIB_DESTINATION "lib${LIB_SUFFIX}" CACHE STRING "Library directory name") ## the following are directories where stuff will be installed to @@ -319,12 +444,8 @@ IF(INSTALL_LIBS) DESTINATION ${PKGCONFIG_INSTALL_PREFIX}) ENDIF(NOT MSVC) -ENDIF(INSTALL_LIBS) +ENDIF() -#INSTALL of other files requires CMake 2.6 -IF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5) - OPTION(INSTALL_EXTRA_LIBS "Set when you want extra libraries installed" OFF) -ENDIF (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.5) OPTION(BUILD_UNIT_TESTS "Build Unit Tests" ON) @@ -335,9 +456,8 @@ ENDIF() set (BULLET_CONFIG_CMAKE_PATH lib${LIB_SUFFIX}/cmake/bullet ) list (APPEND BULLET_LIBRARIES LinearMath) -IF(BUILD_BULLET3) - list (APPEND BULLET_LIBRARIES BulletInverseDynamics) -ENDIF(BUILD_BULLET3) +list (APPEND BULLET_LIBRARIES Bullet3Common) +list (APPEND BULLET_LIBRARIES BulletInverseDynamics) list (APPEND BULLET_LIBRARIES BulletCollision) list (APPEND BULLET_LIBRARIES BulletDynamics) list (APPEND BULLET_LIBRARIES BulletSoftBody) @@ -346,7 +466,11 @@ configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/BulletConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/BulletConfig.cmake @ONLY ESCAPE_QUOTES ) -install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/UseBullet.cmake +OPTION(INSTALL_CMAKE_FILES "Install generated CMake files" ON) + +IF (INSTALL_CMAKE_FILES) + install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/UseBullet.cmake ${CMAKE_CURRENT_BINARY_DIR}/BulletConfig.cmake DESTINATION ${BULLET_CONFIG_CMAKE_PATH} ) +ENDIF (INSTALL_CMAKE_FILES) diff --git a/Engine/lib/bullet/README.md b/Engine/lib/bullet/README.md index 28821e4e3..6224da8b5 100644 --- a/Engine/lib/bullet/README.md +++ b/Engine/lib/bullet/README.md @@ -49,36 +49,48 @@ All source code files are licensed under the permissive zlib license **Windows** -Click on build_visual_studio.bat and open build3/vs2010/0MySolution.sln +Click on build_visual_studio_vr_pybullet_double.bat and open build3/vs2010/0MySolution.sln +When asked, convert the projects to a newer version of Visual Studio. +If you installed Python in the C:\ root directory, the batch file should find it automatically. +Otherwise, edit this batch file to choose where Python include/lib directories are located. **Windows Virtual Reality sandbox for HTC Vive and Oculus Rift** -Click on build_visual_studio_vr_pybullet_double.bat and open build3/vs2010/0MySolution.sln -Edit this batch file to choose where Python include/lib directories are located. Build and run the App_SharedMemoryPhysics_VR project, preferably in Release/optimized build. You can connect from Python pybullet to the sandbox using: ``` import pybullet as p -p.connect(p.SHARED_MEMORY) +p.connect(p.SHARED_MEMORY) #or (p.TCP, "localhost", 6667) or (p.UDP, "192.168.86.10",1234) ``` **Linux and Mac OSX gnu make** +Make sure cmake is installed (sudo apt-get install cmake, brew install cmake, or https://cmake.org) + In a terminal type: - cd build3 + ./build_cmake_pybullet_double.sh +This script will invoke cmake and build in the build_cmake directory. You can find pybullet in Bullet/examples/pybullet. +The BulletExampleBrowser binary will be in Bullet/examples/ExampleBrowser. + +You can also build Bullet using premake. There are premake executables in the build3 folder. Depending on your system (Linux 32bit, 64bit or Mac OSX) use one of the following lines - - ./premake4_linux gmake - ./premake4_linux64 gmake - ./premake4_osx gmake - +Using premake: +``` + cd build3 + ./premake4_linux gmake --double + ./premake4_linux64 gmake --double + ./premake4_osx gmake --double --enable_pybullet +``` Then - +``` cd gmake make +``` + +Note that on Linux, you need to use cmake to build pybullet, since the compiler has issues of mixing shared and static libraries. **Mac OSX Xcode** diff --git a/Engine/lib/bullet/VERSION b/Engine/lib/bullet/VERSION index 7cf322cf9..3274853c8 100644 --- a/Engine/lib/bullet/VERSION +++ b/Engine/lib/bullet/VERSION @@ -1 +1 @@ -2.85 +2.87 diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h index cd6e1a892..a3648df1a 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3.h @@ -25,1005 +25,7 @@ #include "btBroadphaseProxy.h" #include "btOverlappingPairCallback.h" #include "btDbvtBroadphase.h" - -//#define DEBUG_BROADPHASE 1 -#define USE_OVERLAP_TEST_ON_REMOVES 1 - -/// The internal templace class btAxisSweep3Internal implements the sweep and prune broadphase. -/// It uses quantized integers to represent the begin and end points for each of the 3 axis. -/// Dont use this class directly, use btAxisSweep3 or bt32BitAxisSweep3 instead. -template -class btAxisSweep3Internal : public btBroadphaseInterface -{ -protected: - - BP_FP_INT_TYPE m_bpHandleMask; - BP_FP_INT_TYPE m_handleSentinel; - -public: - - BT_DECLARE_ALIGNED_ALLOCATOR(); - - class Edge - { - public: - BP_FP_INT_TYPE m_pos; // low bit is min/max - BP_FP_INT_TYPE m_handle; - - BP_FP_INT_TYPE IsMax() const {return static_cast(m_pos & 1);} - }; - -public: - class Handle : public btBroadphaseProxy - { - public: - BT_DECLARE_ALIGNED_ALLOCATOR(); - - // indexes into the edge arrays - BP_FP_INT_TYPE m_minEdges[3], m_maxEdges[3]; // 6 * 2 = 12 -// BP_FP_INT_TYPE m_uniqueId; - btBroadphaseProxy* m_dbvtProxy;//for faster raycast - //void* m_pOwner; this is now in btBroadphaseProxy.m_clientObject - - SIMD_FORCE_INLINE void SetNextFree(BP_FP_INT_TYPE next) {m_minEdges[0] = next;} - SIMD_FORCE_INLINE BP_FP_INT_TYPE GetNextFree() const {return m_minEdges[0];} - }; // 24 bytes + 24 for Edge structures = 44 bytes total per entry - - -protected: - btVector3 m_worldAabbMin; // overall system bounds - btVector3 m_worldAabbMax; // overall system bounds - - btVector3 m_quantize; // scaling factor for quantization - - BP_FP_INT_TYPE m_numHandles; // number of active handles - BP_FP_INT_TYPE m_maxHandles; // max number of handles - Handle* m_pHandles; // handles pool - - BP_FP_INT_TYPE m_firstFreeHandle; // free handles list - - Edge* m_pEdges[3]; // edge arrays for the 3 axes (each array has m_maxHandles * 2 + 2 sentinel entries) - void* m_pEdgesRawPtr[3]; - - btOverlappingPairCache* m_pairCache; - - ///btOverlappingPairCallback is an additional optional user callback for adding/removing overlapping pairs, similar interface to btOverlappingPairCache. - btOverlappingPairCallback* m_userPairCallback; - - bool m_ownsPairCache; - - int m_invalidPair; - - ///additional dynamic aabb structure, used to accelerate ray cast queries. - ///can be disabled using a optional argument in the constructor - btDbvtBroadphase* m_raycastAccelerator; - btOverlappingPairCache* m_nullPairCache; - - - // allocation/deallocation - BP_FP_INT_TYPE allocHandle(); - void freeHandle(BP_FP_INT_TYPE handle); - - - bool testOverlap2D(const Handle* pHandleA, const Handle* pHandleB,int axis0,int axis1); - -#ifdef DEBUG_BROADPHASE - void debugPrintAxis(int axis,bool checkCardinality=true); -#endif //DEBUG_BROADPHASE - - //Overlap* AddOverlap(BP_FP_INT_TYPE handleA, BP_FP_INT_TYPE handleB); - //void RemoveOverlap(BP_FP_INT_TYPE handleA, BP_FP_INT_TYPE handleB); - - - - void sortMinDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps ); - void sortMinUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps ); - void sortMaxDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps ); - void sortMaxUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps ); - -public: - - btAxisSweep3Internal(const btVector3& worldAabbMin,const btVector3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel, BP_FP_INT_TYPE maxHandles = 16384, btOverlappingPairCache* pairCache=0,bool disableRaycastAccelerator = false); - - virtual ~btAxisSweep3Internal(); - - BP_FP_INT_TYPE getNumHandles() const - { - return m_numHandles; - } - - virtual void calculateOverlappingPairs(btDispatcher* dispatcher); - - BP_FP_INT_TYPE addHandle(const btVector3& aabbMin,const btVector3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy); - void removeHandle(BP_FP_INT_TYPE handle,btDispatcher* dispatcher); - void updateHandle(BP_FP_INT_TYPE handle, const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher); - SIMD_FORCE_INLINE Handle* getHandle(BP_FP_INT_TYPE index) const {return m_pHandles + index;} - - virtual void resetPool(btDispatcher* dispatcher); - - void processAllOverlappingPairs(btOverlapCallback* callback); - - //Broadphase Interface - virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy); - virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher); - virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher); - virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const; - - virtual void rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVector3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0)); - virtual void aabbTest(const btVector3& aabbMin, const btVector3& aabbMax, btBroadphaseAabbCallback& callback); - - - void quantize(BP_FP_INT_TYPE* out, const btVector3& point, int isMax) const; - ///unQuantize should be conservative: aabbMin/aabbMax should be larger then 'getAabb' result - void unQuantize(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const; - - bool testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1); - - btOverlappingPairCache* getOverlappingPairCache() - { - return m_pairCache; - } - const btOverlappingPairCache* getOverlappingPairCache() const - { - return m_pairCache; - } - - void setOverlappingPairUserCallback(btOverlappingPairCallback* pairCallback) - { - m_userPairCallback = pairCallback; - } - const btOverlappingPairCallback* getOverlappingPairUserCallback() const - { - return m_userPairCallback; - } - - ///getAabb returns the axis aligned bounding box in the 'global' coordinate frame - ///will add some transform later - virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const - { - aabbMin = m_worldAabbMin; - aabbMax = m_worldAabbMax; - } - - virtual void printStats() - { -/* printf("btAxisSweep3.h\n"); - printf("numHandles = %d, maxHandles = %d\n",m_numHandles,m_maxHandles); - printf("aabbMin=%f,%f,%f,aabbMax=%f,%f,%f\n",m_worldAabbMin.getX(),m_worldAabbMin.getY(),m_worldAabbMin.getZ(), - m_worldAabbMax.getX(),m_worldAabbMax.getY(),m_worldAabbMax.getZ()); - */ - - } - -}; - -//////////////////////////////////////////////////////////////////// - - - - -#ifdef DEBUG_BROADPHASE -#include - -template -void btAxisSweep3::debugPrintAxis(int axis, bool checkCardinality) -{ - int numEdges = m_pHandles[0].m_maxEdges[axis]; - printf("SAP Axis %d, numEdges=%d\n",axis,numEdges); - - int i; - for (i=0;im_handle); - int handleIndex = pEdge->IsMax()? pHandlePrev->m_maxEdges[axis] : pHandlePrev->m_minEdges[axis]; - char beginOrEnd; - beginOrEnd=pEdge->IsMax()?'E':'B'; - printf(" [%c,h=%d,p=%x,i=%d]\n",beginOrEnd,pEdge->m_handle,pEdge->m_pos,handleIndex); - } - - if (checkCardinality) - btAssert(numEdges == m_numHandles*2+1); -} -#endif //DEBUG_BROADPHASE - -template -btBroadphaseProxy* btAxisSweep3Internal::createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy) -{ - (void)shapeType; - BP_FP_INT_TYPE handleId = addHandle(aabbMin,aabbMax, userPtr,collisionFilterGroup,collisionFilterMask,dispatcher,multiSapProxy); - - Handle* handle = getHandle(handleId); - - if (m_raycastAccelerator) - { - btBroadphaseProxy* rayProxy = m_raycastAccelerator->createProxy(aabbMin,aabbMax,shapeType,userPtr,collisionFilterGroup,collisionFilterMask,dispatcher,0); - handle->m_dbvtProxy = rayProxy; - } - return handle; -} - - - -template -void btAxisSweep3Internal::destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher) -{ - Handle* handle = static_cast(proxy); - if (m_raycastAccelerator) - m_raycastAccelerator->destroyProxy(handle->m_dbvtProxy,dispatcher); - removeHandle(static_cast(handle->m_uniqueId), dispatcher); -} - -template -void btAxisSweep3Internal::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher) -{ - Handle* handle = static_cast(proxy); - handle->m_aabbMin = aabbMin; - handle->m_aabbMax = aabbMax; - updateHandle(static_cast(handle->m_uniqueId), aabbMin, aabbMax,dispatcher); - if (m_raycastAccelerator) - m_raycastAccelerator->setAabb(handle->m_dbvtProxy,aabbMin,aabbMax,dispatcher); - -} - -template -void btAxisSweep3Internal::rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback,const btVector3& aabbMin,const btVector3& aabbMax) -{ - if (m_raycastAccelerator) - { - m_raycastAccelerator->rayTest(rayFrom,rayTo,rayCallback,aabbMin,aabbMax); - } else - { - //choose axis? - BP_FP_INT_TYPE axis = 0; - //for each proxy - for (BP_FP_INT_TYPE i=1;i -void btAxisSweep3Internal::aabbTest(const btVector3& aabbMin, const btVector3& aabbMax, btBroadphaseAabbCallback& callback) -{ - if (m_raycastAccelerator) - { - m_raycastAccelerator->aabbTest(aabbMin,aabbMax,callback); - } else - { - //choose axis? - BP_FP_INT_TYPE axis = 0; - //for each proxy - for (BP_FP_INT_TYPE i=1;im_aabbMin,handle->m_aabbMax)) - { - callback.process(handle); - } - } - } - } -} - - - -template -void btAxisSweep3Internal::getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const -{ - Handle* pHandle = static_cast(proxy); - aabbMin = pHandle->m_aabbMin; - aabbMax = pHandle->m_aabbMax; -} - - -template -void btAxisSweep3Internal::unQuantize(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const -{ - Handle* pHandle = static_cast(proxy); - - unsigned short vecInMin[3]; - unsigned short vecInMax[3]; - - vecInMin[0] = m_pEdges[0][pHandle->m_minEdges[0]].m_pos ; - vecInMax[0] = m_pEdges[0][pHandle->m_maxEdges[0]].m_pos +1 ; - vecInMin[1] = m_pEdges[1][pHandle->m_minEdges[1]].m_pos ; - vecInMax[1] = m_pEdges[1][pHandle->m_maxEdges[1]].m_pos +1 ; - vecInMin[2] = m_pEdges[2][pHandle->m_minEdges[2]].m_pos ; - vecInMax[2] = m_pEdges[2][pHandle->m_maxEdges[2]].m_pos +1 ; - - aabbMin.setValue((btScalar)(vecInMin[0]) / (m_quantize.getX()),(btScalar)(vecInMin[1]) / (m_quantize.getY()),(btScalar)(vecInMin[2]) / (m_quantize.getZ())); - aabbMin += m_worldAabbMin; - - aabbMax.setValue((btScalar)(vecInMax[0]) / (m_quantize.getX()),(btScalar)(vecInMax[1]) / (m_quantize.getY()),(btScalar)(vecInMax[2]) / (m_quantize.getZ())); - aabbMax += m_worldAabbMin; -} - - - - -template -btAxisSweep3Internal::btAxisSweep3Internal(const btVector3& worldAabbMin,const btVector3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel,BP_FP_INT_TYPE userMaxHandles, btOverlappingPairCache* pairCache , bool disableRaycastAccelerator) -:m_bpHandleMask(handleMask), -m_handleSentinel(handleSentinel), -m_pairCache(pairCache), -m_userPairCallback(0), -m_ownsPairCache(false), -m_invalidPair(0), -m_raycastAccelerator(0) -{ - BP_FP_INT_TYPE maxHandles = static_cast(userMaxHandles+1);//need to add one sentinel handle - - if (!m_pairCache) - { - void* ptr = btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16); - m_pairCache = new(ptr) btHashedOverlappingPairCache(); - m_ownsPairCache = true; - } - - if (!disableRaycastAccelerator) - { - m_nullPairCache = new (btAlignedAlloc(sizeof(btNullPairCache),16)) btNullPairCache(); - m_raycastAccelerator = new (btAlignedAlloc(sizeof(btDbvtBroadphase),16)) btDbvtBroadphase(m_nullPairCache);//m_pairCache); - m_raycastAccelerator->m_deferedcollide = true;//don't add/remove pairs - } - - //btAssert(bounds.HasVolume()); - - // init bounds - m_worldAabbMin = worldAabbMin; - m_worldAabbMax = worldAabbMax; - - btVector3 aabbSize = m_worldAabbMax - m_worldAabbMin; - - BP_FP_INT_TYPE maxInt = m_handleSentinel; - - m_quantize = btVector3(btScalar(maxInt),btScalar(maxInt),btScalar(maxInt)) / aabbSize; - - // allocate handles buffer, using btAlignedAlloc, and put all handles on free list - m_pHandles = new Handle[maxHandles]; - - m_maxHandles = maxHandles; - m_numHandles = 0; - - // handle 0 is reserved as the null index, and is also used as the sentinel - m_firstFreeHandle = 1; - { - for (BP_FP_INT_TYPE i = m_firstFreeHandle; i < maxHandles; i++) - m_pHandles[i].SetNextFree(static_cast(i + 1)); - m_pHandles[maxHandles - 1].SetNextFree(0); - } - - { - // allocate edge buffers - for (int i = 0; i < 3; i++) - { - m_pEdgesRawPtr[i] = btAlignedAlloc(sizeof(Edge)*maxHandles*2,16); - m_pEdges[i] = new(m_pEdgesRawPtr[i]) Edge[maxHandles * 2]; - } - } - //removed overlap management - - // make boundary sentinels - - m_pHandles[0].m_clientObject = 0; - - for (int axis = 0; axis < 3; axis++) - { - m_pHandles[0].m_minEdges[axis] = 0; - m_pHandles[0].m_maxEdges[axis] = 1; - - m_pEdges[axis][0].m_pos = 0; - m_pEdges[axis][0].m_handle = 0; - m_pEdges[axis][1].m_pos = m_handleSentinel; - m_pEdges[axis][1].m_handle = 0; -#ifdef DEBUG_BROADPHASE - debugPrintAxis(axis); -#endif //DEBUG_BROADPHASE - - } - -} - -template -btAxisSweep3Internal::~btAxisSweep3Internal() -{ - if (m_raycastAccelerator) - { - m_nullPairCache->~btOverlappingPairCache(); - btAlignedFree(m_nullPairCache); - m_raycastAccelerator->~btDbvtBroadphase(); - btAlignedFree (m_raycastAccelerator); - } - - for (int i = 2; i >= 0; i--) - { - btAlignedFree(m_pEdgesRawPtr[i]); - } - delete [] m_pHandles; - - if (m_ownsPairCache) - { - m_pairCache->~btOverlappingPairCache(); - btAlignedFree(m_pairCache); - } -} - -template -void btAxisSweep3Internal::quantize(BP_FP_INT_TYPE* out, const btVector3& point, int isMax) const -{ -#ifdef OLD_CLAMPING_METHOD - ///problem with this clamping method is that the floating point during quantization might still go outside the range [(0|isMax) .. (m_handleSentinel&m_bpHandleMask]|isMax] - ///see http://code.google.com/p/bullet/issues/detail?id=87 - btVector3 clampedPoint(point); - clampedPoint.setMax(m_worldAabbMin); - clampedPoint.setMin(m_worldAabbMax); - btVector3 v = (clampedPoint - m_worldAabbMin) * m_quantize; - out[0] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getX() & m_bpHandleMask) | isMax); - out[1] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getY() & m_bpHandleMask) | isMax); - out[2] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getZ() & m_bpHandleMask) | isMax); -#else - btVector3 v = (point - m_worldAabbMin) * m_quantize; - out[0]=(v[0]<=0)?(BP_FP_INT_TYPE)isMax:(v[0]>=m_handleSentinel)?(BP_FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[0]&m_bpHandleMask)|isMax); - out[1]=(v[1]<=0)?(BP_FP_INT_TYPE)isMax:(v[1]>=m_handleSentinel)?(BP_FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[1]&m_bpHandleMask)|isMax); - out[2]=(v[2]<=0)?(BP_FP_INT_TYPE)isMax:(v[2]>=m_handleSentinel)?(BP_FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[2]&m_bpHandleMask)|isMax); -#endif //OLD_CLAMPING_METHOD -} - - -template -BP_FP_INT_TYPE btAxisSweep3Internal::allocHandle() -{ - btAssert(m_firstFreeHandle); - - BP_FP_INT_TYPE handle = m_firstFreeHandle; - m_firstFreeHandle = getHandle(handle)->GetNextFree(); - m_numHandles++; - - return handle; -} - -template -void btAxisSweep3Internal::freeHandle(BP_FP_INT_TYPE handle) -{ - btAssert(handle > 0 && handle < m_maxHandles); - - getHandle(handle)->SetNextFree(m_firstFreeHandle); - m_firstFreeHandle = handle; - - m_numHandles--; -} - - -template -BP_FP_INT_TYPE btAxisSweep3Internal::addHandle(const btVector3& aabbMin,const btVector3& aabbMax, void* pOwner,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy) -{ - // quantize the bounds - BP_FP_INT_TYPE min[3], max[3]; - quantize(min, aabbMin, 0); - quantize(max, aabbMax, 1); - - // allocate a handle - BP_FP_INT_TYPE handle = allocHandle(); - - - Handle* pHandle = getHandle(handle); - - pHandle->m_uniqueId = static_cast(handle); - //pHandle->m_pOverlaps = 0; - pHandle->m_clientObject = pOwner; - pHandle->m_collisionFilterGroup = collisionFilterGroup; - pHandle->m_collisionFilterMask = collisionFilterMask; - pHandle->m_multiSapParentProxy = multiSapProxy; - - // compute current limit of edge arrays - BP_FP_INT_TYPE limit = static_cast(m_numHandles * 2); - - - // insert new edges just inside the max boundary edge - for (BP_FP_INT_TYPE axis = 0; axis < 3; axis++) - { - - m_pHandles[0].m_maxEdges[axis] += 2; - - m_pEdges[axis][limit + 1] = m_pEdges[axis][limit - 1]; - - m_pEdges[axis][limit - 1].m_pos = min[axis]; - m_pEdges[axis][limit - 1].m_handle = handle; - - m_pEdges[axis][limit].m_pos = max[axis]; - m_pEdges[axis][limit].m_handle = handle; - - pHandle->m_minEdges[axis] = static_cast(limit - 1); - pHandle->m_maxEdges[axis] = limit; - } - - // now sort the new edges to their correct position - sortMinDown(0, pHandle->m_minEdges[0], dispatcher,false); - sortMaxDown(0, pHandle->m_maxEdges[0], dispatcher,false); - sortMinDown(1, pHandle->m_minEdges[1], dispatcher,false); - sortMaxDown(1, pHandle->m_maxEdges[1], dispatcher,false); - sortMinDown(2, pHandle->m_minEdges[2], dispatcher,true); - sortMaxDown(2, pHandle->m_maxEdges[2], dispatcher,true); - - - return handle; -} - - -template -void btAxisSweep3Internal::removeHandle(BP_FP_INT_TYPE handle,btDispatcher* dispatcher) -{ - - Handle* pHandle = getHandle(handle); - - //explicitly remove the pairs containing the proxy - //we could do it also in the sortMinUp (passing true) - ///@todo: compare performance - if (!m_pairCache->hasDeferredRemoval()) - { - m_pairCache->removeOverlappingPairsContainingProxy(pHandle,dispatcher); - } - - // compute current limit of edge arrays - int limit = static_cast(m_numHandles * 2); - - int axis; - - for (axis = 0;axis<3;axis++) - { - m_pHandles[0].m_maxEdges[axis] -= 2; - } - - // remove the edges by sorting them up to the end of the list - for ( axis = 0; axis < 3; axis++) - { - Edge* pEdges = m_pEdges[axis]; - BP_FP_INT_TYPE max = pHandle->m_maxEdges[axis]; - pEdges[max].m_pos = m_handleSentinel; - - sortMaxUp(axis,max,dispatcher,false); - - - BP_FP_INT_TYPE i = pHandle->m_minEdges[axis]; - pEdges[i].m_pos = m_handleSentinel; - - - sortMinUp(axis,i,dispatcher,false); - - pEdges[limit-1].m_handle = 0; - pEdges[limit-1].m_pos = m_handleSentinel; - -#ifdef DEBUG_BROADPHASE - debugPrintAxis(axis,false); -#endif //DEBUG_BROADPHASE - - - } - - - // free the handle - freeHandle(handle); - - -} - -template -void btAxisSweep3Internal::resetPool(btDispatcher* /*dispatcher*/) -{ - if (m_numHandles == 0) - { - m_firstFreeHandle = 1; - { - for (BP_FP_INT_TYPE i = m_firstFreeHandle; i < m_maxHandles; i++) - m_pHandles[i].SetNextFree(static_cast(i + 1)); - m_pHandles[m_maxHandles - 1].SetNextFree(0); - } - } -} - - -extern int gOverlappingPairs; -//#include - -template -void btAxisSweep3Internal::calculateOverlappingPairs(btDispatcher* dispatcher) -{ - - if (m_pairCache->hasDeferredRemoval()) - { - - btBroadphasePairArray& overlappingPairArray = m_pairCache->getOverlappingPairArray(); - - //perform a sort, to find duplicates and to sort 'invalid' pairs to the end - overlappingPairArray.quickSort(btBroadphasePairSortPredicate()); - - overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair); - m_invalidPair = 0; - - - int i; - - btBroadphasePair previousPair; - previousPair.m_pProxy0 = 0; - previousPair.m_pProxy1 = 0; - previousPair.m_algorithm = 0; - - - for (i=0;iprocessOverlap(pair); - } else - { - needsRemoval = true; - } - } else - { - //remove duplicate - needsRemoval = true; - //should have no algorithm - btAssert(!pair.m_algorithm); - } - - if (needsRemoval) - { - m_pairCache->cleanOverlappingPair(pair,dispatcher); - - // m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1); - // m_overlappingPairArray.pop_back(); - pair.m_pProxy0 = 0; - pair.m_pProxy1 = 0; - m_invalidPair++; - gOverlappingPairs--; - } - - } - - ///if you don't like to skip the invalid pairs in the array, execute following code: - #define CLEAN_INVALID_PAIRS 1 - #ifdef CLEAN_INVALID_PAIRS - - //perform a sort, to sort 'invalid' pairs to the end - overlappingPairArray.quickSort(btBroadphasePairSortPredicate()); - - overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair); - m_invalidPair = 0; - #endif//CLEAN_INVALID_PAIRS - - //printf("overlappingPairArray.size()=%d\n",overlappingPairArray.size()); - } - -} - - -template -bool btAxisSweep3Internal::testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) -{ - const Handle* pHandleA = static_cast(proxy0); - const Handle* pHandleB = static_cast(proxy1); - - //optimization 1: check the array index (memory address), instead of the m_pos - - for (int axis = 0; axis < 3; axis++) - { - if (pHandleA->m_maxEdges[axis] < pHandleB->m_minEdges[axis] || - pHandleB->m_maxEdges[axis] < pHandleA->m_minEdges[axis]) - { - return false; - } - } - return true; -} - -template -bool btAxisSweep3Internal::testOverlap2D(const Handle* pHandleA, const Handle* pHandleB,int axis0,int axis1) -{ - //optimization 1: check the array index (memory address), instead of the m_pos - - if (pHandleA->m_maxEdges[axis0] < pHandleB->m_minEdges[axis0] || - pHandleB->m_maxEdges[axis0] < pHandleA->m_minEdges[axis0] || - pHandleA->m_maxEdges[axis1] < pHandleB->m_minEdges[axis1] || - pHandleB->m_maxEdges[axis1] < pHandleA->m_minEdges[axis1]) - { - return false; - } - return true; -} - -template -void btAxisSweep3Internal::updateHandle(BP_FP_INT_TYPE handle, const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher) -{ -// btAssert(bounds.IsFinite()); - //btAssert(bounds.HasVolume()); - - Handle* pHandle = getHandle(handle); - - // quantize the new bounds - BP_FP_INT_TYPE min[3], max[3]; - quantize(min, aabbMin, 0); - quantize(max, aabbMax, 1); - - // update changed edges - for (int axis = 0; axis < 3; axis++) - { - BP_FP_INT_TYPE emin = pHandle->m_minEdges[axis]; - BP_FP_INT_TYPE emax = pHandle->m_maxEdges[axis]; - - int dmin = (int)min[axis] - (int)m_pEdges[axis][emin].m_pos; - int dmax = (int)max[axis] - (int)m_pEdges[axis][emax].m_pos; - - m_pEdges[axis][emin].m_pos = min[axis]; - m_pEdges[axis][emax].m_pos = max[axis]; - - // expand (only adds overlaps) - if (dmin < 0) - sortMinDown(axis, emin,dispatcher,true); - - if (dmax > 0) - sortMaxUp(axis, emax,dispatcher,true); - - // shrink (only removes overlaps) - if (dmin > 0) - sortMinUp(axis, emin,dispatcher,true); - - if (dmax < 0) - sortMaxDown(axis, emax,dispatcher,true); - -#ifdef DEBUG_BROADPHASE - debugPrintAxis(axis); -#endif //DEBUG_BROADPHASE - } - - -} - - - - -// sorting a min edge downwards can only ever *add* overlaps -template -void btAxisSweep3Internal::sortMinDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* /* dispatcher */, bool updateOverlaps) -{ - - Edge* pEdge = m_pEdges[axis] + edge; - Edge* pPrev = pEdge - 1; - Handle* pHandleEdge = getHandle(pEdge->m_handle); - - while (pEdge->m_pos < pPrev->m_pos) - { - Handle* pHandlePrev = getHandle(pPrev->m_handle); - - if (pPrev->IsMax()) - { - // if previous edge is a maximum check the bounds and add an overlap if necessary - const int axis1 = (1 << axis) & 3; - const int axis2 = (1 << axis1) & 3; - if (updateOverlaps && testOverlap2D(pHandleEdge, pHandlePrev,axis1,axis2)) - { - m_pairCache->addOverlappingPair(pHandleEdge,pHandlePrev); - if (m_userPairCallback) - m_userPairCallback->addOverlappingPair(pHandleEdge,pHandlePrev); - - //AddOverlap(pEdge->m_handle, pPrev->m_handle); - - } - - // update edge reference in other handle - pHandlePrev->m_maxEdges[axis]++; - } - else - pHandlePrev->m_minEdges[axis]++; - - pHandleEdge->m_minEdges[axis]--; - - // swap the edges - Edge swap = *pEdge; - *pEdge = *pPrev; - *pPrev = swap; - - // decrement - pEdge--; - pPrev--; - } - -#ifdef DEBUG_BROADPHASE - debugPrintAxis(axis); -#endif //DEBUG_BROADPHASE - -} - -// sorting a min edge upwards can only ever *remove* overlaps -template -void btAxisSweep3Internal::sortMinUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps) -{ - Edge* pEdge = m_pEdges[axis] + edge; - Edge* pNext = pEdge + 1; - Handle* pHandleEdge = getHandle(pEdge->m_handle); - - while (pNext->m_handle && (pEdge->m_pos >= pNext->m_pos)) - { - Handle* pHandleNext = getHandle(pNext->m_handle); - - if (pNext->IsMax()) - { - Handle* handle0 = getHandle(pEdge->m_handle); - Handle* handle1 = getHandle(pNext->m_handle); - const int axis1 = (1 << axis) & 3; - const int axis2 = (1 << axis1) & 3; - - // if next edge is maximum remove any overlap between the two handles - if (updateOverlaps -#ifdef USE_OVERLAP_TEST_ON_REMOVES - && testOverlap2D(handle0,handle1,axis1,axis2) -#endif //USE_OVERLAP_TEST_ON_REMOVES - ) - { - - - m_pairCache->removeOverlappingPair(handle0,handle1,dispatcher); - if (m_userPairCallback) - m_userPairCallback->removeOverlappingPair(handle0,handle1,dispatcher); - - } - - - // update edge reference in other handle - pHandleNext->m_maxEdges[axis]--; - } - else - pHandleNext->m_minEdges[axis]--; - - pHandleEdge->m_minEdges[axis]++; - - // swap the edges - Edge swap = *pEdge; - *pEdge = *pNext; - *pNext = swap; - - // increment - pEdge++; - pNext++; - } - - -} - -// sorting a max edge downwards can only ever *remove* overlaps -template -void btAxisSweep3Internal::sortMaxDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps) -{ - - Edge* pEdge = m_pEdges[axis] + edge; - Edge* pPrev = pEdge - 1; - Handle* pHandleEdge = getHandle(pEdge->m_handle); - - while (pEdge->m_pos < pPrev->m_pos) - { - Handle* pHandlePrev = getHandle(pPrev->m_handle); - - if (!pPrev->IsMax()) - { - // if previous edge was a minimum remove any overlap between the two handles - Handle* handle0 = getHandle(pEdge->m_handle); - Handle* handle1 = getHandle(pPrev->m_handle); - const int axis1 = (1 << axis) & 3; - const int axis2 = (1 << axis1) & 3; - - if (updateOverlaps -#ifdef USE_OVERLAP_TEST_ON_REMOVES - && testOverlap2D(handle0,handle1,axis1,axis2) -#endif //USE_OVERLAP_TEST_ON_REMOVES - ) - { - //this is done during the overlappingpairarray iteration/narrowphase collision - - - m_pairCache->removeOverlappingPair(handle0,handle1,dispatcher); - if (m_userPairCallback) - m_userPairCallback->removeOverlappingPair(handle0,handle1,dispatcher); - - - - } - - // update edge reference in other handle - pHandlePrev->m_minEdges[axis]++;; - } - else - pHandlePrev->m_maxEdges[axis]++; - - pHandleEdge->m_maxEdges[axis]--; - - // swap the edges - Edge swap = *pEdge; - *pEdge = *pPrev; - *pPrev = swap; - - // decrement - pEdge--; - pPrev--; - } - - -#ifdef DEBUG_BROADPHASE - debugPrintAxis(axis); -#endif //DEBUG_BROADPHASE - -} - -// sorting a max edge upwards can only ever *add* overlaps -template -void btAxisSweep3Internal::sortMaxUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* /* dispatcher */, bool updateOverlaps) -{ - Edge* pEdge = m_pEdges[axis] + edge; - Edge* pNext = pEdge + 1; - Handle* pHandleEdge = getHandle(pEdge->m_handle); - - while (pNext->m_handle && (pEdge->m_pos >= pNext->m_pos)) - { - Handle* pHandleNext = getHandle(pNext->m_handle); - - const int axis1 = (1 << axis) & 3; - const int axis2 = (1 << axis1) & 3; - - if (!pNext->IsMax()) - { - // if next edge is a minimum check the bounds and add an overlap if necessary - if (updateOverlaps && testOverlap2D(pHandleEdge, pHandleNext,axis1,axis2)) - { - Handle* handle0 = getHandle(pEdge->m_handle); - Handle* handle1 = getHandle(pNext->m_handle); - m_pairCache->addOverlappingPair(handle0,handle1); - if (m_userPairCallback) - m_userPairCallback->addOverlappingPair(handle0,handle1); - } - - // update edge reference in other handle - pHandleNext->m_minEdges[axis]--; - } - else - pHandleNext->m_maxEdges[axis]--; - - pHandleEdge->m_maxEdges[axis]++; - - // swap the edges - Edge swap = *pEdge; - *pEdge = *pNext; - *pNext = swap; - - // increment - pEdge++; - pNext++; - } - -} - - - -//////////////////////////////////////////////////////////////////// - +#include "btAxisSweep3Internal.h" /// The btAxisSweep3 is an efficient implementation of the 3d axis sweep and prune broadphase. /// It uses arrays rather then lists for storage of the 3 axis. Also it operates using 16 bit integer coordinates instead of floats. @@ -1048,4 +50,3 @@ public: }; #endif - diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3Internal.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3Internal.h new file mode 100644 index 000000000..2c4d41bc0 --- /dev/null +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btAxisSweep3Internal.h @@ -0,0 +1,1022 @@ +//Bullet Continuous Collision Detection and Physics Library +//Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ + +// +// btAxisSweep3.h +// +// Copyright (c) 2006 Simon Hobbs +// +// This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. +// +// Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: +// +// 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +// +// 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +// +// 3. This notice may not be removed or altered from any source distribution. + +#ifndef BT_AXIS_SWEEP_3_INTERNAL_H +#define BT_AXIS_SWEEP_3_INTERNAL_H + +#include "LinearMath/btVector3.h" +#include "btOverlappingPairCache.h" +#include "btBroadphaseInterface.h" +#include "btBroadphaseProxy.h" +#include "btOverlappingPairCallback.h" +#include "btDbvtBroadphase.h" + +//#define DEBUG_BROADPHASE 1 +#define USE_OVERLAP_TEST_ON_REMOVES 1 + +/// The internal templace class btAxisSweep3Internal implements the sweep and prune broadphase. +/// It uses quantized integers to represent the begin and end points for each of the 3 axis. +/// Dont use this class directly, use btAxisSweep3 or bt32BitAxisSweep3 instead. +template +class btAxisSweep3Internal : public btBroadphaseInterface +{ +protected: + + BP_FP_INT_TYPE m_bpHandleMask; + BP_FP_INT_TYPE m_handleSentinel; + +public: + + BT_DECLARE_ALIGNED_ALLOCATOR(); + + class Edge + { + public: + BP_FP_INT_TYPE m_pos; // low bit is min/max + BP_FP_INT_TYPE m_handle; + + BP_FP_INT_TYPE IsMax() const {return static_cast(m_pos & 1);} + }; + +public: + class Handle : public btBroadphaseProxy + { + public: + BT_DECLARE_ALIGNED_ALLOCATOR(); + + // indexes into the edge arrays + BP_FP_INT_TYPE m_minEdges[3], m_maxEdges[3]; // 6 * 2 = 12 +// BP_FP_INT_TYPE m_uniqueId; + btBroadphaseProxy* m_dbvtProxy;//for faster raycast + //void* m_pOwner; this is now in btBroadphaseProxy.m_clientObject + + SIMD_FORCE_INLINE void SetNextFree(BP_FP_INT_TYPE next) {m_minEdges[0] = next;} + SIMD_FORCE_INLINE BP_FP_INT_TYPE GetNextFree() const {return m_minEdges[0];} + }; // 24 bytes + 24 for Edge structures = 44 bytes total per entry + + +protected: + btVector3 m_worldAabbMin; // overall system bounds + btVector3 m_worldAabbMax; // overall system bounds + + btVector3 m_quantize; // scaling factor for quantization + + BP_FP_INT_TYPE m_numHandles; // number of active handles + BP_FP_INT_TYPE m_maxHandles; // max number of handles + Handle* m_pHandles; // handles pool + + BP_FP_INT_TYPE m_firstFreeHandle; // free handles list + + Edge* m_pEdges[3]; // edge arrays for the 3 axes (each array has m_maxHandles * 2 + 2 sentinel entries) + void* m_pEdgesRawPtr[3]; + + btOverlappingPairCache* m_pairCache; + + ///btOverlappingPairCallback is an additional optional user callback for adding/removing overlapping pairs, similar interface to btOverlappingPairCache. + btOverlappingPairCallback* m_userPairCallback; + + bool m_ownsPairCache; + + int m_invalidPair; + + ///additional dynamic aabb structure, used to accelerate ray cast queries. + ///can be disabled using a optional argument in the constructor + btDbvtBroadphase* m_raycastAccelerator; + btOverlappingPairCache* m_nullPairCache; + + + // allocation/deallocation + BP_FP_INT_TYPE allocHandle(); + void freeHandle(BP_FP_INT_TYPE handle); + + + bool testOverlap2D(const Handle* pHandleA, const Handle* pHandleB,int axis0,int axis1); + +#ifdef DEBUG_BROADPHASE + void debugPrintAxis(int axis,bool checkCardinality=true); +#endif //DEBUG_BROADPHASE + + //Overlap* AddOverlap(BP_FP_INT_TYPE handleA, BP_FP_INT_TYPE handleB); + //void RemoveOverlap(BP_FP_INT_TYPE handleA, BP_FP_INT_TYPE handleB); + + + + void sortMinDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps ); + void sortMinUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps ); + void sortMaxDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps ); + void sortMaxUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps ); + +public: + + btAxisSweep3Internal(const btVector3& worldAabbMin,const btVector3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel, BP_FP_INT_TYPE maxHandles = 16384, btOverlappingPairCache* pairCache=0,bool disableRaycastAccelerator = false); + + virtual ~btAxisSweep3Internal(); + + BP_FP_INT_TYPE getNumHandles() const + { + return m_numHandles; + } + + virtual void calculateOverlappingPairs(btDispatcher* dispatcher); + + BP_FP_INT_TYPE addHandle(const btVector3& aabbMin,const btVector3& aabbMax, void* pOwner, int collisionFilterGroup, int collisionFilterMask,btDispatcher* dispatcher); + void removeHandle(BP_FP_INT_TYPE handle,btDispatcher* dispatcher); + void updateHandle(BP_FP_INT_TYPE handle, const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher); + SIMD_FORCE_INLINE Handle* getHandle(BP_FP_INT_TYPE index) const {return m_pHandles + index;} + + virtual void resetPool(btDispatcher* dispatcher); + + void processAllOverlappingPairs(btOverlapCallback* callback); + + //Broadphase Interface + virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr , int collisionFilterGroup, int collisionFilterMask,btDispatcher* dispatcher); + virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher); + virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher); + virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const; + + virtual void rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVector3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0)); + virtual void aabbTest(const btVector3& aabbMin, const btVector3& aabbMax, btBroadphaseAabbCallback& callback); + + + void quantize(BP_FP_INT_TYPE* out, const btVector3& point, int isMax) const; + ///unQuantize should be conservative: aabbMin/aabbMax should be larger then 'getAabb' result + void unQuantize(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const; + + bool testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1); + + btOverlappingPairCache* getOverlappingPairCache() + { + return m_pairCache; + } + const btOverlappingPairCache* getOverlappingPairCache() const + { + return m_pairCache; + } + + void setOverlappingPairUserCallback(btOverlappingPairCallback* pairCallback) + { + m_userPairCallback = pairCallback; + } + const btOverlappingPairCallback* getOverlappingPairUserCallback() const + { + return m_userPairCallback; + } + + ///getAabb returns the axis aligned bounding box in the 'global' coordinate frame + ///will add some transform later + virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const + { + aabbMin = m_worldAabbMin; + aabbMax = m_worldAabbMax; + } + + virtual void printStats() + { +/* printf("btAxisSweep3.h\n"); + printf("numHandles = %d, maxHandles = %d\n",m_numHandles,m_maxHandles); + printf("aabbMin=%f,%f,%f,aabbMax=%f,%f,%f\n",m_worldAabbMin.getX(),m_worldAabbMin.getY(),m_worldAabbMin.getZ(), + m_worldAabbMax.getX(),m_worldAabbMax.getY(),m_worldAabbMax.getZ()); + */ + + } + +}; + +//////////////////////////////////////////////////////////////////// + + + + +#ifdef DEBUG_BROADPHASE +#include + +template +void btAxisSweep3::debugPrintAxis(int axis, bool checkCardinality) +{ + int numEdges = m_pHandles[0].m_maxEdges[axis]; + printf("SAP Axis %d, numEdges=%d\n",axis,numEdges); + + int i; + for (i=0;im_handle); + int handleIndex = pEdge->IsMax()? pHandlePrev->m_maxEdges[axis] : pHandlePrev->m_minEdges[axis]; + char beginOrEnd; + beginOrEnd=pEdge->IsMax()?'E':'B'; + printf(" [%c,h=%d,p=%x,i=%d]\n",beginOrEnd,pEdge->m_handle,pEdge->m_pos,handleIndex); + } + + if (checkCardinality) + btAssert(numEdges == m_numHandles*2+1); +} +#endif //DEBUG_BROADPHASE + +template +btBroadphaseProxy* btAxisSweep3Internal::createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, int collisionFilterGroup, int collisionFilterMask,btDispatcher* dispatcher) +{ + (void)shapeType; + BP_FP_INT_TYPE handleId = addHandle(aabbMin,aabbMax, userPtr,collisionFilterGroup,collisionFilterMask,dispatcher); + + Handle* handle = getHandle(handleId); + + if (m_raycastAccelerator) + { + btBroadphaseProxy* rayProxy = m_raycastAccelerator->createProxy(aabbMin,aabbMax,shapeType,userPtr,collisionFilterGroup,collisionFilterMask,dispatcher); + handle->m_dbvtProxy = rayProxy; + } + return handle; +} + + + +template +void btAxisSweep3Internal::destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher) +{ + Handle* handle = static_cast(proxy); + if (m_raycastAccelerator) + m_raycastAccelerator->destroyProxy(handle->m_dbvtProxy,dispatcher); + removeHandle(static_cast(handle->m_uniqueId), dispatcher); +} + +template +void btAxisSweep3Internal::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher) +{ + Handle* handle = static_cast(proxy); + handle->m_aabbMin = aabbMin; + handle->m_aabbMax = aabbMax; + updateHandle(static_cast(handle->m_uniqueId), aabbMin, aabbMax,dispatcher); + if (m_raycastAccelerator) + m_raycastAccelerator->setAabb(handle->m_dbvtProxy,aabbMin,aabbMax,dispatcher); + +} + +template +void btAxisSweep3Internal::rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback,const btVector3& aabbMin,const btVector3& aabbMax) +{ + if (m_raycastAccelerator) + { + m_raycastAccelerator->rayTest(rayFrom,rayTo,rayCallback,aabbMin,aabbMax); + } else + { + //choose axis? + BP_FP_INT_TYPE axis = 0; + //for each proxy + for (BP_FP_INT_TYPE i=1;i +void btAxisSweep3Internal::aabbTest(const btVector3& aabbMin, const btVector3& aabbMax, btBroadphaseAabbCallback& callback) +{ + if (m_raycastAccelerator) + { + m_raycastAccelerator->aabbTest(aabbMin,aabbMax,callback); + } else + { + //choose axis? + BP_FP_INT_TYPE axis = 0; + //for each proxy + for (BP_FP_INT_TYPE i=1;im_aabbMin,handle->m_aabbMax)) + { + callback.process(handle); + } + } + } + } +} + + + +template +void btAxisSweep3Internal::getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const +{ + Handle* pHandle = static_cast(proxy); + aabbMin = pHandle->m_aabbMin; + aabbMax = pHandle->m_aabbMax; +} + + +template +void btAxisSweep3Internal::unQuantize(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const +{ + Handle* pHandle = static_cast(proxy); + + unsigned short vecInMin[3]; + unsigned short vecInMax[3]; + + vecInMin[0] = m_pEdges[0][pHandle->m_minEdges[0]].m_pos ; + vecInMax[0] = m_pEdges[0][pHandle->m_maxEdges[0]].m_pos +1 ; + vecInMin[1] = m_pEdges[1][pHandle->m_minEdges[1]].m_pos ; + vecInMax[1] = m_pEdges[1][pHandle->m_maxEdges[1]].m_pos +1 ; + vecInMin[2] = m_pEdges[2][pHandle->m_minEdges[2]].m_pos ; + vecInMax[2] = m_pEdges[2][pHandle->m_maxEdges[2]].m_pos +1 ; + + aabbMin.setValue((btScalar)(vecInMin[0]) / (m_quantize.getX()),(btScalar)(vecInMin[1]) / (m_quantize.getY()),(btScalar)(vecInMin[2]) / (m_quantize.getZ())); + aabbMin += m_worldAabbMin; + + aabbMax.setValue((btScalar)(vecInMax[0]) / (m_quantize.getX()),(btScalar)(vecInMax[1]) / (m_quantize.getY()),(btScalar)(vecInMax[2]) / (m_quantize.getZ())); + aabbMax += m_worldAabbMin; +} + + + + +template +btAxisSweep3Internal::btAxisSweep3Internal(const btVector3& worldAabbMin,const btVector3& worldAabbMax, BP_FP_INT_TYPE handleMask, BP_FP_INT_TYPE handleSentinel,BP_FP_INT_TYPE userMaxHandles, btOverlappingPairCache* pairCache , bool disableRaycastAccelerator) +:m_bpHandleMask(handleMask), +m_handleSentinel(handleSentinel), +m_pairCache(pairCache), +m_userPairCallback(0), +m_ownsPairCache(false), +m_invalidPair(0), +m_raycastAccelerator(0) +{ + BP_FP_INT_TYPE maxHandles = static_cast(userMaxHandles+1);//need to add one sentinel handle + + if (!m_pairCache) + { + void* ptr = btAlignedAlloc(sizeof(btHashedOverlappingPairCache),16); + m_pairCache = new(ptr) btHashedOverlappingPairCache(); + m_ownsPairCache = true; + } + + if (!disableRaycastAccelerator) + { + m_nullPairCache = new (btAlignedAlloc(sizeof(btNullPairCache),16)) btNullPairCache(); + m_raycastAccelerator = new (btAlignedAlloc(sizeof(btDbvtBroadphase),16)) btDbvtBroadphase(m_nullPairCache);//m_pairCache); + m_raycastAccelerator->m_deferedcollide = true;//don't add/remove pairs + } + + //btAssert(bounds.HasVolume()); + + // init bounds + m_worldAabbMin = worldAabbMin; + m_worldAabbMax = worldAabbMax; + + btVector3 aabbSize = m_worldAabbMax - m_worldAabbMin; + + BP_FP_INT_TYPE maxInt = m_handleSentinel; + + m_quantize = btVector3(btScalar(maxInt),btScalar(maxInt),btScalar(maxInt)) / aabbSize; + + // allocate handles buffer, using btAlignedAlloc, and put all handles on free list + m_pHandles = new Handle[maxHandles]; + + m_maxHandles = maxHandles; + m_numHandles = 0; + + // handle 0 is reserved as the null index, and is also used as the sentinel + m_firstFreeHandle = 1; + { + for (BP_FP_INT_TYPE i = m_firstFreeHandle; i < maxHandles; i++) + m_pHandles[i].SetNextFree(static_cast(i + 1)); + m_pHandles[maxHandles - 1].SetNextFree(0); + } + + { + // allocate edge buffers + for (int i = 0; i < 3; i++) + { + m_pEdgesRawPtr[i] = btAlignedAlloc(sizeof(Edge)*maxHandles*2,16); + m_pEdges[i] = new(m_pEdgesRawPtr[i]) Edge[maxHandles * 2]; + } + } + //removed overlap management + + // make boundary sentinels + + m_pHandles[0].m_clientObject = 0; + + for (int axis = 0; axis < 3; axis++) + { + m_pHandles[0].m_minEdges[axis] = 0; + m_pHandles[0].m_maxEdges[axis] = 1; + + m_pEdges[axis][0].m_pos = 0; + m_pEdges[axis][0].m_handle = 0; + m_pEdges[axis][1].m_pos = m_handleSentinel; + m_pEdges[axis][1].m_handle = 0; +#ifdef DEBUG_BROADPHASE + debugPrintAxis(axis); +#endif //DEBUG_BROADPHASE + + } + +} + +template +btAxisSweep3Internal::~btAxisSweep3Internal() +{ + if (m_raycastAccelerator) + { + m_nullPairCache->~btOverlappingPairCache(); + btAlignedFree(m_nullPairCache); + m_raycastAccelerator->~btDbvtBroadphase(); + btAlignedFree (m_raycastAccelerator); + } + + for (int i = 2; i >= 0; i--) + { + btAlignedFree(m_pEdgesRawPtr[i]); + } + delete [] m_pHandles; + + if (m_ownsPairCache) + { + m_pairCache->~btOverlappingPairCache(); + btAlignedFree(m_pairCache); + } +} + +template +void btAxisSweep3Internal::quantize(BP_FP_INT_TYPE* out, const btVector3& point, int isMax) const +{ +#ifdef OLD_CLAMPING_METHOD + ///problem with this clamping method is that the floating point during quantization might still go outside the range [(0|isMax) .. (m_handleSentinel&m_bpHandleMask]|isMax] + ///see http://code.google.com/p/bullet/issues/detail?id=87 + btVector3 clampedPoint(point); + clampedPoint.setMax(m_worldAabbMin); + clampedPoint.setMin(m_worldAabbMax); + btVector3 v = (clampedPoint - m_worldAabbMin) * m_quantize; + out[0] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getX() & m_bpHandleMask) | isMax); + out[1] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getY() & m_bpHandleMask) | isMax); + out[2] = (BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v.getZ() & m_bpHandleMask) | isMax); +#else + btVector3 v = (point - m_worldAabbMin) * m_quantize; + out[0]=(v[0]<=0)?(BP_FP_INT_TYPE)isMax:(v[0]>=m_handleSentinel)?(BP_FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[0]&m_bpHandleMask)|isMax); + out[1]=(v[1]<=0)?(BP_FP_INT_TYPE)isMax:(v[1]>=m_handleSentinel)?(BP_FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[1]&m_bpHandleMask)|isMax); + out[2]=(v[2]<=0)?(BP_FP_INT_TYPE)isMax:(v[2]>=m_handleSentinel)?(BP_FP_INT_TYPE)((m_handleSentinel&m_bpHandleMask)|isMax):(BP_FP_INT_TYPE)(((BP_FP_INT_TYPE)v[2]&m_bpHandleMask)|isMax); +#endif //OLD_CLAMPING_METHOD +} + + +template +BP_FP_INT_TYPE btAxisSweep3Internal::allocHandle() +{ + btAssert(m_firstFreeHandle); + + BP_FP_INT_TYPE handle = m_firstFreeHandle; + m_firstFreeHandle = getHandle(handle)->GetNextFree(); + m_numHandles++; + + return handle; +} + +template +void btAxisSweep3Internal::freeHandle(BP_FP_INT_TYPE handle) +{ + btAssert(handle > 0 && handle < m_maxHandles); + + getHandle(handle)->SetNextFree(m_firstFreeHandle); + m_firstFreeHandle = handle; + + m_numHandles--; +} + + +template +BP_FP_INT_TYPE btAxisSweep3Internal::addHandle(const btVector3& aabbMin,const btVector3& aabbMax, void* pOwner, int collisionFilterGroup, int collisionFilterMask,btDispatcher* dispatcher) +{ + // quantize the bounds + BP_FP_INT_TYPE min[3], max[3]; + quantize(min, aabbMin, 0); + quantize(max, aabbMax, 1); + + // allocate a handle + BP_FP_INT_TYPE handle = allocHandle(); + + + Handle* pHandle = getHandle(handle); + + pHandle->m_uniqueId = static_cast(handle); + //pHandle->m_pOverlaps = 0; + pHandle->m_clientObject = pOwner; + pHandle->m_collisionFilterGroup = collisionFilterGroup; + pHandle->m_collisionFilterMask = collisionFilterMask; + + // compute current limit of edge arrays + BP_FP_INT_TYPE limit = static_cast(m_numHandles * 2); + + + // insert new edges just inside the max boundary edge + for (BP_FP_INT_TYPE axis = 0; axis < 3; axis++) + { + + m_pHandles[0].m_maxEdges[axis] += 2; + + m_pEdges[axis][limit + 1] = m_pEdges[axis][limit - 1]; + + m_pEdges[axis][limit - 1].m_pos = min[axis]; + m_pEdges[axis][limit - 1].m_handle = handle; + + m_pEdges[axis][limit].m_pos = max[axis]; + m_pEdges[axis][limit].m_handle = handle; + + pHandle->m_minEdges[axis] = static_cast(limit - 1); + pHandle->m_maxEdges[axis] = limit; + } + + // now sort the new edges to their correct position + sortMinDown(0, pHandle->m_minEdges[0], dispatcher,false); + sortMaxDown(0, pHandle->m_maxEdges[0], dispatcher,false); + sortMinDown(1, pHandle->m_minEdges[1], dispatcher,false); + sortMaxDown(1, pHandle->m_maxEdges[1], dispatcher,false); + sortMinDown(2, pHandle->m_minEdges[2], dispatcher,true); + sortMaxDown(2, pHandle->m_maxEdges[2], dispatcher,true); + + + return handle; +} + + +template +void btAxisSweep3Internal::removeHandle(BP_FP_INT_TYPE handle,btDispatcher* dispatcher) +{ + + Handle* pHandle = getHandle(handle); + + //explicitly remove the pairs containing the proxy + //we could do it also in the sortMinUp (passing true) + ///@todo: compare performance + if (!m_pairCache->hasDeferredRemoval()) + { + m_pairCache->removeOverlappingPairsContainingProxy(pHandle,dispatcher); + } + + // compute current limit of edge arrays + int limit = static_cast(m_numHandles * 2); + + int axis; + + for (axis = 0;axis<3;axis++) + { + m_pHandles[0].m_maxEdges[axis] -= 2; + } + + // remove the edges by sorting them up to the end of the list + for ( axis = 0; axis < 3; axis++) + { + Edge* pEdges = m_pEdges[axis]; + BP_FP_INT_TYPE max = pHandle->m_maxEdges[axis]; + pEdges[max].m_pos = m_handleSentinel; + + sortMaxUp(axis,max,dispatcher,false); + + + BP_FP_INT_TYPE i = pHandle->m_minEdges[axis]; + pEdges[i].m_pos = m_handleSentinel; + + + sortMinUp(axis,i,dispatcher,false); + + pEdges[limit-1].m_handle = 0; + pEdges[limit-1].m_pos = m_handleSentinel; + +#ifdef DEBUG_BROADPHASE + debugPrintAxis(axis,false); +#endif //DEBUG_BROADPHASE + + + } + + + // free the handle + freeHandle(handle); + + +} + +template +void btAxisSweep3Internal::resetPool(btDispatcher* /*dispatcher*/) +{ + if (m_numHandles == 0) + { + m_firstFreeHandle = 1; + { + for (BP_FP_INT_TYPE i = m_firstFreeHandle; i < m_maxHandles; i++) + m_pHandles[i].SetNextFree(static_cast(i + 1)); + m_pHandles[m_maxHandles - 1].SetNextFree(0); + } + } +} + + +extern int gOverlappingPairs; +//#include + +template +void btAxisSweep3Internal::calculateOverlappingPairs(btDispatcher* dispatcher) +{ + + if (m_pairCache->hasDeferredRemoval()) + { + + btBroadphasePairArray& overlappingPairArray = m_pairCache->getOverlappingPairArray(); + + //perform a sort, to find duplicates and to sort 'invalid' pairs to the end + overlappingPairArray.quickSort(btBroadphasePairSortPredicate()); + + overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair); + m_invalidPair = 0; + + + int i; + + btBroadphasePair previousPair; + previousPair.m_pProxy0 = 0; + previousPair.m_pProxy1 = 0; + previousPair.m_algorithm = 0; + + + for (i=0;iprocessOverlap(pair); + } else + { + needsRemoval = true; + } + } else + { + //remove duplicate + needsRemoval = true; + //should have no algorithm + btAssert(!pair.m_algorithm); + } + + if (needsRemoval) + { + m_pairCache->cleanOverlappingPair(pair,dispatcher); + + // m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1); + // m_overlappingPairArray.pop_back(); + pair.m_pProxy0 = 0; + pair.m_pProxy1 = 0; + m_invalidPair++; + gOverlappingPairs--; + } + + } + + ///if you don't like to skip the invalid pairs in the array, execute following code: + #define CLEAN_INVALID_PAIRS 1 + #ifdef CLEAN_INVALID_PAIRS + + //perform a sort, to sort 'invalid' pairs to the end + overlappingPairArray.quickSort(btBroadphasePairSortPredicate()); + + overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair); + m_invalidPair = 0; + #endif//CLEAN_INVALID_PAIRS + + //printf("overlappingPairArray.size()=%d\n",overlappingPairArray.size()); + } + +} + + +template +bool btAxisSweep3Internal::testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) +{ + const Handle* pHandleA = static_cast(proxy0); + const Handle* pHandleB = static_cast(proxy1); + + //optimization 1: check the array index (memory address), instead of the m_pos + + for (int axis = 0; axis < 3; axis++) + { + if (pHandleA->m_maxEdges[axis] < pHandleB->m_minEdges[axis] || + pHandleB->m_maxEdges[axis] < pHandleA->m_minEdges[axis]) + { + return false; + } + } + return true; +} + +template +bool btAxisSweep3Internal::testOverlap2D(const Handle* pHandleA, const Handle* pHandleB,int axis0,int axis1) +{ + //optimization 1: check the array index (memory address), instead of the m_pos + + if (pHandleA->m_maxEdges[axis0] < pHandleB->m_minEdges[axis0] || + pHandleB->m_maxEdges[axis0] < pHandleA->m_minEdges[axis0] || + pHandleA->m_maxEdges[axis1] < pHandleB->m_minEdges[axis1] || + pHandleB->m_maxEdges[axis1] < pHandleA->m_minEdges[axis1]) + { + return false; + } + return true; +} + +template +void btAxisSweep3Internal::updateHandle(BP_FP_INT_TYPE handle, const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher) +{ +// btAssert(bounds.IsFinite()); + //btAssert(bounds.HasVolume()); + + Handle* pHandle = getHandle(handle); + + // quantize the new bounds + BP_FP_INT_TYPE min[3], max[3]; + quantize(min, aabbMin, 0); + quantize(max, aabbMax, 1); + + // update changed edges + for (int axis = 0; axis < 3; axis++) + { + BP_FP_INT_TYPE emin = pHandle->m_minEdges[axis]; + BP_FP_INT_TYPE emax = pHandle->m_maxEdges[axis]; + + int dmin = (int)min[axis] - (int)m_pEdges[axis][emin].m_pos; + int dmax = (int)max[axis] - (int)m_pEdges[axis][emax].m_pos; + + m_pEdges[axis][emin].m_pos = min[axis]; + m_pEdges[axis][emax].m_pos = max[axis]; + + // expand (only adds overlaps) + if (dmin < 0) + sortMinDown(axis, emin,dispatcher,true); + + if (dmax > 0) + sortMaxUp(axis, emax,dispatcher,true); + + // shrink (only removes overlaps) + if (dmin > 0) + sortMinUp(axis, emin,dispatcher,true); + + if (dmax < 0) + sortMaxDown(axis, emax,dispatcher,true); + +#ifdef DEBUG_BROADPHASE + debugPrintAxis(axis); +#endif //DEBUG_BROADPHASE + } + + +} + + + + +// sorting a min edge downwards can only ever *add* overlaps +template +void btAxisSweep3Internal::sortMinDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* /* dispatcher */, bool updateOverlaps) +{ + + Edge* pEdge = m_pEdges[axis] + edge; + Edge* pPrev = pEdge - 1; + Handle* pHandleEdge = getHandle(pEdge->m_handle); + + while (pEdge->m_pos < pPrev->m_pos) + { + Handle* pHandlePrev = getHandle(pPrev->m_handle); + + if (pPrev->IsMax()) + { + // if previous edge is a maximum check the bounds and add an overlap if necessary + const int axis1 = (1 << axis) & 3; + const int axis2 = (1 << axis1) & 3; + if (updateOverlaps && testOverlap2D(pHandleEdge, pHandlePrev,axis1,axis2)) + { + m_pairCache->addOverlappingPair(pHandleEdge,pHandlePrev); + if (m_userPairCallback) + m_userPairCallback->addOverlappingPair(pHandleEdge,pHandlePrev); + + //AddOverlap(pEdge->m_handle, pPrev->m_handle); + + } + + // update edge reference in other handle + pHandlePrev->m_maxEdges[axis]++; + } + else + pHandlePrev->m_minEdges[axis]++; + + pHandleEdge->m_minEdges[axis]--; + + // swap the edges + Edge swap = *pEdge; + *pEdge = *pPrev; + *pPrev = swap; + + // decrement + pEdge--; + pPrev--; + } + +#ifdef DEBUG_BROADPHASE + debugPrintAxis(axis); +#endif //DEBUG_BROADPHASE + +} + +// sorting a min edge upwards can only ever *remove* overlaps +template +void btAxisSweep3Internal::sortMinUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps) +{ + Edge* pEdge = m_pEdges[axis] + edge; + Edge* pNext = pEdge + 1; + Handle* pHandleEdge = getHandle(pEdge->m_handle); + + while (pNext->m_handle && (pEdge->m_pos >= pNext->m_pos)) + { + Handle* pHandleNext = getHandle(pNext->m_handle); + + if (pNext->IsMax()) + { + Handle* handle0 = getHandle(pEdge->m_handle); + Handle* handle1 = getHandle(pNext->m_handle); + const int axis1 = (1 << axis) & 3; + const int axis2 = (1 << axis1) & 3; + + // if next edge is maximum remove any overlap between the two handles + if (updateOverlaps +#ifdef USE_OVERLAP_TEST_ON_REMOVES + && testOverlap2D(handle0,handle1,axis1,axis2) +#endif //USE_OVERLAP_TEST_ON_REMOVES + ) + { + + + m_pairCache->removeOverlappingPair(handle0,handle1,dispatcher); + if (m_userPairCallback) + m_userPairCallback->removeOverlappingPair(handle0,handle1,dispatcher); + + } + + + // update edge reference in other handle + pHandleNext->m_maxEdges[axis]--; + } + else + pHandleNext->m_minEdges[axis]--; + + pHandleEdge->m_minEdges[axis]++; + + // swap the edges + Edge swap = *pEdge; + *pEdge = *pNext; + *pNext = swap; + + // increment + pEdge++; + pNext++; + } + + +} + +// sorting a max edge downwards can only ever *remove* overlaps +template +void btAxisSweep3Internal::sortMaxDown(int axis, BP_FP_INT_TYPE edge, btDispatcher* dispatcher, bool updateOverlaps) +{ + + Edge* pEdge = m_pEdges[axis] + edge; + Edge* pPrev = pEdge - 1; + Handle* pHandleEdge = getHandle(pEdge->m_handle); + + while (pEdge->m_pos < pPrev->m_pos) + { + Handle* pHandlePrev = getHandle(pPrev->m_handle); + + if (!pPrev->IsMax()) + { + // if previous edge was a minimum remove any overlap between the two handles + Handle* handle0 = getHandle(pEdge->m_handle); + Handle* handle1 = getHandle(pPrev->m_handle); + const int axis1 = (1 << axis) & 3; + const int axis2 = (1 << axis1) & 3; + + if (updateOverlaps +#ifdef USE_OVERLAP_TEST_ON_REMOVES + && testOverlap2D(handle0,handle1,axis1,axis2) +#endif //USE_OVERLAP_TEST_ON_REMOVES + ) + { + //this is done during the overlappingpairarray iteration/narrowphase collision + + + m_pairCache->removeOverlappingPair(handle0,handle1,dispatcher); + if (m_userPairCallback) + m_userPairCallback->removeOverlappingPair(handle0,handle1,dispatcher); + + + + } + + // update edge reference in other handle + pHandlePrev->m_minEdges[axis]++;; + } + else + pHandlePrev->m_maxEdges[axis]++; + + pHandleEdge->m_maxEdges[axis]--; + + // swap the edges + Edge swap = *pEdge; + *pEdge = *pPrev; + *pPrev = swap; + + // decrement + pEdge--; + pPrev--; + } + + +#ifdef DEBUG_BROADPHASE + debugPrintAxis(axis); +#endif //DEBUG_BROADPHASE + +} + +// sorting a max edge upwards can only ever *add* overlaps +template +void btAxisSweep3Internal::sortMaxUp(int axis, BP_FP_INT_TYPE edge, btDispatcher* /* dispatcher */, bool updateOverlaps) +{ + Edge* pEdge = m_pEdges[axis] + edge; + Edge* pNext = pEdge + 1; + Handle* pHandleEdge = getHandle(pEdge->m_handle); + + while (pNext->m_handle && (pEdge->m_pos >= pNext->m_pos)) + { + Handle* pHandleNext = getHandle(pNext->m_handle); + + const int axis1 = (1 << axis) & 3; + const int axis2 = (1 << axis1) & 3; + + if (!pNext->IsMax()) + { + // if next edge is a minimum check the bounds and add an overlap if necessary + if (updateOverlaps && testOverlap2D(pHandleEdge, pHandleNext,axis1,axis2)) + { + Handle* handle0 = getHandle(pEdge->m_handle); + Handle* handle1 = getHandle(pNext->m_handle); + m_pairCache->addOverlappingPair(handle0,handle1); + if (m_userPairCallback) + m_userPairCallback->addOverlappingPair(handle0,handle1); + } + + // update edge reference in other handle + pHandleNext->m_minEdges[axis]--; + } + else + pHandleNext->m_maxEdges[axis]--; + + pHandleEdge->m_maxEdges[axis]++; + + // swap the edges + Edge swap = *pEdge; + *pEdge = *pNext; + *pNext = swap; + + // increment + pEdge++; + pNext++; + } + +} + +#endif diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h index f1bf00594..fb68e0024 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseInterface.h @@ -41,6 +41,10 @@ struct btBroadphaseRayCallback : public btBroadphaseAabbCallback btScalar m_lambda_max; virtual ~btBroadphaseRayCallback() {} + +protected: + + btBroadphaseRayCallback() {} }; #include "LinearMath/btVector3.h" @@ -53,7 +57,7 @@ class btBroadphaseInterface public: virtual ~btBroadphaseInterface() {} - virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* multiSapProxy) =0; + virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, int collisionFilterGroup, int collisionFilterMask, btDispatcher* dispatcher) =0; virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher)=0; virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* dispatcher)=0; virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const =0; diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp index f4d7341f8..0fd4ef46b 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp @@ -15,3 +15,4 @@ subject to the following restrictions: #include "btBroadphaseProxy.h" +BT_NOT_EMPTY_FILE // fix warning LNK4221: This object file does not define any previously undefined public symbols, so it will not be used by any link operation that consumes this library diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h index bb58b8289..adaf083a2 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btBroadphaseProxy.h @@ -101,10 +101,10 @@ BT_DECLARE_ALIGNED_ALLOCATOR(); //Usually the client btCollisionObject or Rigidbody class void* m_clientObject; - short int m_collisionFilterGroup; - short int m_collisionFilterMask; - void* m_multiSapParentProxy; - int m_uniqueId;//m_uniqueId is introduced for paircache. could get rid of this, by calculating the address offset etc. + int m_collisionFilterGroup; + int m_collisionFilterMask; + + int m_uniqueId;//m_uniqueId is introduced for paircache. could get rid of this, by calculating the address offset etc. btVector3 m_aabbMin; btVector3 m_aabbMax; @@ -115,18 +115,17 @@ BT_DECLARE_ALIGNED_ALLOCATOR(); } //used for memory pools - btBroadphaseProxy() :m_clientObject(0),m_multiSapParentProxy(0) + btBroadphaseProxy() :m_clientObject(0) { } - btBroadphaseProxy(const btVector3& aabbMin,const btVector3& aabbMax,void* userPtr,short int collisionFilterGroup, short int collisionFilterMask,void* multiSapParentProxy=0) + btBroadphaseProxy(const btVector3& aabbMin,const btVector3& aabbMax,void* userPtr, int collisionFilterGroup, int collisionFilterMask) :m_clientObject(userPtr), m_collisionFilterGroup(collisionFilterGroup), m_collisionFilterMask(collisionFilterMask), m_aabbMin(aabbMin), m_aabbMax(aabbMax) { - m_multiSapParentProxy = multiSapParentProxy; } diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.cpp b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.cpp index 2ca20cdd8..d791d0741 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.cpp +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.cpp @@ -229,25 +229,60 @@ static void fetchleaves(btDbvt* pdbvt, } // -static void split( const tNodeArray& leaves, - tNodeArray& left, - tNodeArray& right, +static bool leftOfAxis( const btDbvtNode* node, + const btVector3& org, + const btVector3& axis) +{ + return btDot(axis, node->volume.Center() - org) <= 0; +} + + +// Partitions leaves such that leaves[0, n) are on the +// left of axis, and leaves[n, count) are on the right +// of axis. returns N. +static int split( btDbvtNode** leaves, + int count, const btVector3& org, const btVector3& axis) { - left.resize(0); - right.resize(0); - for(int i=0,ni=leaves.size();ivolume.Center()-org)<0) - left.push_back(leaves[i]); - else - right.push_back(leaves[i]); + while(begin!=end && leftOfAxis(leaves[begin],org,axis)) + { + ++begin; + } + + if(begin==end) + { + break; + } + + while(begin!=end && !leftOfAxis(leaves[end-1],org,axis)) + { + --end; + } + + if(begin==end) + { + break; + } + + // swap out of place nodes + --end; + btDbvtNode* temp=leaves[begin]; + leaves[begin]=leaves[end]; + leaves[end]=temp; + ++begin; } + + return begin; } // -static btDbvtVolume bounds( const tNodeArray& leaves) +static btDbvtVolume bounds( btDbvtNode** leaves, + int count) { #if DBVT_MERGE_IMPL==DBVT_IMPL_SSE ATTRIBUTE_ALIGNED16(char locals[sizeof(btDbvtVolume)]); @@ -257,7 +292,7 @@ static btDbvtVolume bounds( const tNodeArray& leaves) #else btDbvtVolume volume=leaves[0]->volume; #endif - for(int i=1,ni=leaves.size();ivolume,volume); } @@ -266,15 +301,16 @@ static btDbvtVolume bounds( const tNodeArray& leaves) // static void bottomup( btDbvt* pdbvt, - tNodeArray& leaves) + btDbvtNode** leaves, + int count) { - while(leaves.size()>1) + while(count>1) { btScalar minsize=SIMD_INFINITY; int minidx[2]={-1,-1}; - for(int i=0;ivolume,leaves[j]->volume)); if(szparent = p; n[1]->parent = p; leaves[minidx[0]] = p; - leaves.swap(minidx[1],leaves.size()-1); - leaves.pop_back(); + leaves[minidx[1]] = leaves[count-1]; + --count; } } // static btDbvtNode* topdown(btDbvt* pdbvt, - tNodeArray& leaves, + btDbvtNode** leaves, + int count, int bu_treshold) { static const btVector3 axis[]={btVector3(1,0,0), btVector3(0,1,0), btVector3(0,0,1)}; - if(leaves.size()>1) + btAssert(bu_treshold>2); + if(count>1) { - if(leaves.size()>bu_treshold) + if(count>bu_treshold) { - const btDbvtVolume vol=bounds(leaves); + const btDbvtVolume vol=bounds(leaves,count); const btVector3 org=vol.Center(); - tNodeArray sets[2]; + int partition; int bestaxis=-1; - int bestmidp=leaves.size(); + int bestmidp=count; int splitcount[3][2]={{0,0},{0,0},{0,0}}; int i; - for( i=0;ivolume.Center()-org; for(int j=0;j<3;++j) @@ -338,29 +376,23 @@ static btDbvtNode* topdown(btDbvt* pdbvt, } if(bestaxis>=0) { - sets[0].reserve(splitcount[bestaxis][0]); - sets[1].reserve(splitcount[bestaxis][1]); - split(leaves,sets[0],sets[1],org,axis[bestaxis]); + partition=split(leaves,count,org,axis[bestaxis]); + btAssert(partition!=0 && partition!=count); } else { - sets[0].reserve(leaves.size()/2+1); - sets[1].reserve(leaves.size()/2); - for(int i=0,ni=leaves.size();ichilds[0]=topdown(pdbvt,sets[0],bu_treshold); - node->childs[1]=topdown(pdbvt,sets[1],bu_treshold); + node->childs[0]=topdown(pdbvt,&leaves[0],partition,bu_treshold); + node->childs[1]=topdown(pdbvt,&leaves[partition],count-partition,bu_treshold); node->childs[0]->parent=node; node->childs[1]->parent=node; return(node); } else { - bottomup(pdbvt,leaves); + bottomup(pdbvt,leaves,count); return(leaves[0]); } } @@ -444,7 +476,7 @@ void btDbvt::optimizeBottomUp() tNodeArray leaves; leaves.reserve(m_leaves); fetchleaves(this,m_root,leaves); - bottomup(this,leaves); + bottomup(this,&leaves[0],leaves.size()); m_root=leaves[0]; } } @@ -457,7 +489,7 @@ void btDbvt::optimizeTopDown(int bu_treshold) tNodeArray leaves; leaves.reserve(m_leaves); fetchleaves(this,m_root,leaves); - m_root=topdown(this,leaves,bu_treshold); + m_root=topdown(this,&leaves[0],leaves.size(),bu_treshold); } } diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.h index 1ca175723..b5a001458 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.h +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvt.h @@ -942,7 +942,13 @@ inline void btDbvt::collideTV( const btDbvtNode* root, ATTRIBUTE_ALIGNED16(btDbvtVolume) volume(vol); btAlignedObjectArray stack; stack.resize(0); +#ifndef BT_DISABLE_STACK_TEMP_MEMORY + char tempmemory[SIMPLE_STACKSIZE*sizeof(const btDbvtNode*)]; + stack.initializeFromBuffer(tempmemory, 0, SIMPLE_STACKSIZE); +#else stack.reserve(SIMPLE_STACKSIZE); +#endif //BT_DISABLE_STACK_TEMP_MEMORY + stack.push_back(root); do { const btDbvtNode* n=stack[stack.size()-1]; @@ -1078,7 +1084,12 @@ inline void btDbvt::rayTest( const btDbvtNode* root, int depth=1; int treshold=DOUBLE_STACKSIZE-2; + char tempmemory[DOUBLE_STACKSIZE * sizeof(const btDbvtNode*)]; +#ifndef BT_DISABLE_STACK_TEMP_MEMORY + stack.initializeFromBuffer(tempmemory, DOUBLE_STACKSIZE, DOUBLE_STACKSIZE); +#else//BT_DISABLE_STACK_TEMP_MEMORY stack.resize(DOUBLE_STACKSIZE); +#endif //BT_DISABLE_STACK_TEMP_MEMORY stack[0]=root; btVector3 bounds[2]; do { diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp index 4f33db500..4d12b1c9c 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp @@ -168,10 +168,9 @@ btBroadphaseProxy* btDbvtBroadphase::createProxy( const btVector3& aabbMin, const btVector3& aabbMax, int /*shapeType*/, void* userPtr, - short int collisionFilterGroup, - short int collisionFilterMask, - btDispatcher* /*dispatcher*/, - void* /*multiSapProxy*/) + int collisionFilterGroup, + int collisionFilterMask, + btDispatcher* /*dispatcher*/) { btDbvtProxy* proxy=new(btAlignedAlloc(sizeof(btDbvtProxy),16)) btDbvtProxy( aabbMin,aabbMax,userPtr, collisionFilterGroup, @@ -545,7 +544,9 @@ void btDbvtBroadphase::collide(btDispatcher* dispatcher) btDbvtProxy* current=m_stageRoots[m_stageCurrent]; if(current) { +#if DBVT_BP_ACCURATESLEEPING btDbvtTreeCollider collider(this); +#endif do { btDbvtProxy* next=current->links[1]; listremove(current,m_stageRoots[current->stage]); diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h index a61f00df0..8feb95d51 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btDbvtBroadphase.h @@ -47,7 +47,7 @@ struct btDbvtProxy : btBroadphaseProxy btDbvtProxy* links[2]; int stage; /* ctor */ - btDbvtProxy(const btVector3& aabbMin,const btVector3& aabbMax,void* userPtr,short int collisionFilterGroup, short int collisionFilterMask) : + btDbvtProxy(const btVector3& aabbMin,const btVector3& aabbMax,void* userPtr, int collisionFilterGroup, int collisionFilterMask) : btBroadphaseProxy(aabbMin,aabbMax,userPtr,collisionFilterGroup,collisionFilterMask) { links[0]=links[1]=0; @@ -105,7 +105,7 @@ struct btDbvtBroadphase : btBroadphaseInterface void optimize(); /* btBroadphaseInterface Implementation */ - btBroadphaseProxy* createProxy(const btVector3& aabbMin,const btVector3& aabbMax,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask,btDispatcher* dispatcher,void* multiSapProxy); + btBroadphaseProxy* createProxy(const btVector3& aabbMin,const btVector3& aabbMax,int shapeType,void* userPtr, int collisionFilterGroup, int collisionFilterMask,btDispatcher* dispatcher); virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher); virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax,btDispatcher* dispatcher); virtual void rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin=btVector3(0,0,0), const btVector3& aabbMax = btVector3(0,0,0)); diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h index 146142704..f7be7d45b 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCache.h @@ -90,7 +90,8 @@ public: }; /// Hash-space based Pair Cache, thanks to Erin Catto, Box2D, http://www.box2d.org, and Pierre Terdiman, Codercorner, http://codercorner.com -class btHashedOverlappingPairCache : public btOverlappingPairCache + +ATTRIBUTE_ALIGNED16(class) btHashedOverlappingPairCache : public btOverlappingPairCache { btBroadphasePairArray m_overlappingPairArray; btOverlapFilterCallback* m_overlapFilterCallback; @@ -103,6 +104,8 @@ protected: public: + BT_DECLARE_ALIGNED_ALLOCATOR(); + btHashedOverlappingPairCache(); virtual ~btHashedOverlappingPairCache(); @@ -212,10 +215,9 @@ private: */ - - SIMD_FORCE_INLINE unsigned int getHash(unsigned int proxyId1, unsigned int proxyId2) + SIMD_FORCE_INLINE unsigned int getHash(unsigned int proxyId1, unsigned int proxyId2) { - int key = static_cast(((unsigned int)proxyId1) | (((unsigned int)proxyId2) <<16)); + unsigned int key = proxyId1 | (proxyId2 << 16); // Thomas Wang's hash key += ~(key << 15); @@ -224,13 +226,11 @@ private: key ^= (key >> 6); key += ~(key << 11); key ^= (key >> 16); - return static_cast(key); + return key; } - - SIMD_FORCE_INLINE btBroadphasePair* internalFindPair(btBroadphaseProxy* proxy0, btBroadphaseProxy* proxy1, int hash) { int proxyId1 = proxy0->getUid(); diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCallback.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCallback.h index 9c7b6f813..3e069fa5e 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCallback.h +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btOverlappingPairCallback.h @@ -23,6 +23,9 @@ struct btBroadphasePair; ///The btOverlappingPairCallback class is an additional optional broadphase user callback for adding/removing overlapping pairs, similar interface to btOverlappingPairCache. class btOverlappingPairCallback { +protected: + btOverlappingPairCallback() {} + public: virtual ~btOverlappingPairCallback() { diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp index 93de49998..875d89c53 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp @@ -1336,6 +1336,8 @@ const char* btQuantizedBvh::serialize(void* dataBuffer, btSerializer* serializer memPtr->m_escapeIndex = m_contiguousNodes[i].m_escapeIndex; memPtr->m_subPart = m_contiguousNodes[i].m_subPart; memPtr->m_triangleIndex = m_contiguousNodes[i].m_triangleIndex; + // Fill padding with zeros to appease msan. + memset(memPtr->m_pad, 0, sizeof(memPtr->m_pad)); } serializer->finalizeChunk(chunk,"btOptimizedBvhNodeData",BT_ARRAY_CODE,(void*)&m_contiguousNodes[0]); } diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h index 78382da79..3dd5ac9bb 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btQuantizedBvh.h @@ -169,7 +169,7 @@ typedef btAlignedObjectArray BvhSubtreeInfoArray; ///The btQuantizedBvh class stores an AABB tree that can be quickly traversed on CPU and Cell SPU. -///It is used by the btBvhTriangleMeshShape as midphase, and by the btMultiSapBroadphase. +///It is used by the btBvhTriangleMeshShape as midphase. ///It is recommended to use quantization for better performance and lower memory requirements. ATTRIBUTE_ALIGNED16(class) btQuantizedBvh { diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp index 752fcd0fe..f1d5f5476 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp @@ -84,7 +84,7 @@ btSimpleBroadphase::~btSimpleBroadphase() } -btBroadphaseProxy* btSimpleBroadphase::createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* /*dispatcher*/,void* multiSapProxy) +btBroadphaseProxy* btSimpleBroadphase::createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr , int collisionFilterGroup, int collisionFilterMask, btDispatcher* /*dispatcher*/) { if (m_numHandles >= m_maxHandles) { @@ -94,7 +94,7 @@ btBroadphaseProxy* btSimpleBroadphase::createProxy( const btVector3& aabbMin, btAssert(aabbMin[0]<= aabbMax[0] && aabbMin[1]<= aabbMax[1] && aabbMin[2]<= aabbMax[2]); int newHandleIndex = allocHandle(); - btSimpleBroadphaseProxy* proxy = new (&m_pHandles[newHandleIndex])btSimpleBroadphaseProxy(aabbMin,aabbMax,shapeType,userPtr,collisionFilterGroup,collisionFilterMask,multiSapProxy); + btSimpleBroadphaseProxy* proxy = new (&m_pHandles[newHandleIndex])btSimpleBroadphaseProxy(aabbMin,aabbMax,shapeType,userPtr,collisionFilterGroup,collisionFilterMask); return proxy; } diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h index 7cb3c40a0..d7a18e400 100644 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h +++ b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btSimpleBroadphase.h @@ -29,8 +29,8 @@ struct btSimpleBroadphaseProxy : public btBroadphaseProxy btSimpleBroadphaseProxy() {}; - btSimpleBroadphaseProxy(const btVector3& minpt,const btVector3& maxpt,int shapeType,void* userPtr,short int collisionFilterGroup,short int collisionFilterMask,void* multiSapProxy) - :btBroadphaseProxy(minpt,maxpt,userPtr,collisionFilterGroup,collisionFilterMask,multiSapProxy) + btSimpleBroadphaseProxy(const btVector3& minpt,const btVector3& maxpt,int shapeType,void* userPtr, int collisionFilterGroup, int collisionFilterMask) + :btBroadphaseProxy(minpt,maxpt,userPtr,collisionFilterGroup,collisionFilterMask) { (void)shapeType; } @@ -127,7 +127,7 @@ public: static bool aabbOverlap(btSimpleBroadphaseProxy* proxy0,btSimpleBroadphaseProxy* proxy1); - virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr ,short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* multiSapProxy); + virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr , int collisionFilterGroup, int collisionFilterMask, btDispatcher* dispatcher); virtual void calculateOverlappingPairs(btDispatcher* dispatcher); diff --git a/Engine/lib/bullet/src/BulletCollision/CMakeLists.txt b/Engine/lib/bullet/src/BulletCollision/CMakeLists.txt index 90741a126..85c5fc8b6 100644 --- a/Engine/lib/bullet/src/BulletCollision/CMakeLists.txt +++ b/Engine/lib/bullet/src/BulletCollision/CMakeLists.txt @@ -7,7 +7,6 @@ SET(BulletCollision_SRCS BroadphaseCollision/btDbvt.cpp BroadphaseCollision/btDbvtBroadphase.cpp BroadphaseCollision/btDispatcher.cpp - BroadphaseCollision/btMultiSapBroadphase.cpp BroadphaseCollision/btOverlappingPairCache.cpp BroadphaseCollision/btQuantizedBvh.cpp BroadphaseCollision/btSimpleBroadphase.cpp @@ -16,6 +15,7 @@ SET(BulletCollision_SRCS CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp CollisionDispatch/btBoxBoxDetector.cpp CollisionDispatch/btCollisionDispatcher.cpp + CollisionDispatch/btCollisionDispatcherMt.cpp CollisionDispatch/btCollisionObject.cpp CollisionDispatch/btCollisionWorld.cpp CollisionDispatch/btCollisionWorldImporter.cpp @@ -103,6 +103,7 @@ SET(Root_HDRS ../btBulletCollisionCommon.h ) SET(BroadphaseCollision_HDRS + BroadphaseCollision/btAxisSweep3Internal.h BroadphaseCollision/btAxisSweep3.h BroadphaseCollision/btBroadphaseInterface.h BroadphaseCollision/btBroadphaseProxy.h @@ -110,7 +111,6 @@ SET(BroadphaseCollision_HDRS BroadphaseCollision/btDbvt.h BroadphaseCollision/btDbvtBroadphase.h BroadphaseCollision/btDispatcher.h - BroadphaseCollision/btMultiSapBroadphase.h BroadphaseCollision/btOverlappingPairCache.h BroadphaseCollision/btOverlappingPairCallback.h BroadphaseCollision/btQuantizedBvh.h @@ -124,6 +124,7 @@ SET(CollisionDispatch_HDRS CollisionDispatch/btCollisionConfiguration.h CollisionDispatch/btCollisionCreateFunc.h CollisionDispatch/btCollisionDispatcher.h + CollisionDispatch/btCollisionDispatcherMt.h CollisionDispatch/btCollisionObject.h CollisionDispatch/btCollisionObjectWrapper.h CollisionDispatch/btCollisionWorld.h @@ -191,12 +192,15 @@ SET(CollisionShapes_HDRS SET(Gimpact_HDRS Gimpact/btBoxCollision.h Gimpact/btClipPolygon.h + Gimpact/btContactProcessingStructs.h Gimpact/btContactProcessing.h Gimpact/btGenericPoolAllocator.h Gimpact/btGeometryOperations.h + Gimpact/btGImpactBvhStructs.h Gimpact/btGImpactBvh.h Gimpact/btGImpactCollisionAlgorithm.h Gimpact/btGImpactMassUtil.h + Gimpact/btGImpactQuantizedBvhStructs.h Gimpact/btGImpactQuantizedBvh.h Gimpact/btGImpactShape.h Gimpact/btQuantization.h diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp index 006cc65a2..c81af9567 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp @@ -100,45 +100,54 @@ bool SphereTriangleDetector::collide(const btVector3& sphereCenter,btVector3 &po btScalar radiusWithThreshold = radius + contactBreakingThreshold; btVector3 normal = (vertices[1]-vertices[0]).cross(vertices[2]-vertices[0]); - normal.safeNormalize(); - btVector3 p1ToCentre = sphereCenter - vertices[0]; - btScalar distanceFromPlane = p1ToCentre.dot(normal); - if (distanceFromPlane < btScalar(0.)) - { - //triangle facing the other way - distanceFromPlane *= btScalar(-1.); - normal *= btScalar(-1.); - } - - bool isInsideContactPlane = distanceFromPlane < radiusWithThreshold; - - // Check for contact / intersection + btScalar l2 = normal.length2(); bool hasContact = false; btVector3 contactPoint; - if (isInsideContactPlane) { - if (facecontains(sphereCenter,vertices,normal)) { - // Inside the contact wedge - touches a point on the shell plane - hasContact = true; - contactPoint = sphereCenter - normal*distanceFromPlane; - } else { - // Could be inside one of the contact capsules - btScalar contactCapsuleRadiusSqr = radiusWithThreshold*radiusWithThreshold; - btVector3 nearestOnEdge; - for (int i = 0; i < m_triangle->getNumEdges(); i++) { - - btVector3 pa; - btVector3 pb; - - m_triangle->getEdge(i,pa,pb); - btScalar distanceSqr = SegmentSqrDistance(pa,pb,sphereCenter, nearestOnEdge); - if (distanceSqr < contactCapsuleRadiusSqr) { - // Yep, we're inside a capsule - hasContact = true; - contactPoint = nearestOnEdge; + if (l2 >= SIMD_EPSILON*SIMD_EPSILON) + { + normal /= btSqrt(l2); + + btVector3 p1ToCentre = sphereCenter - vertices[0]; + btScalar distanceFromPlane = p1ToCentre.dot(normal); + + if (distanceFromPlane < btScalar(0.)) + { + //triangle facing the other way + distanceFromPlane *= btScalar(-1.); + normal *= btScalar(-1.); + } + + bool isInsideContactPlane = distanceFromPlane < radiusWithThreshold; + + // Check for contact / intersection + + if (isInsideContactPlane) { + if (facecontains(sphereCenter, vertices, normal)) { + // Inside the contact wedge - touches a point on the shell plane + hasContact = true; + contactPoint = sphereCenter - normal*distanceFromPlane; + } + else { + // Could be inside one of the contact capsules + btScalar contactCapsuleRadiusSqr = radiusWithThreshold*radiusWithThreshold; + btVector3 nearestOnEdge; + for (int i = 0; i < m_triangle->getNumEdges(); i++) { + + btVector3 pa; + btVector3 pb; + + m_triangle->getEdge(i, pa, pb); + + btScalar distanceSqr = SegmentSqrDistance(pa, pb, sphereCenter, nearestOnEdge); + if (distanceSqr < contactCapsuleRadiusSqr) { + // Yep, we're inside a capsule + hasContact = true; + contactPoint = nearestOnEdge; + } + } - } } } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h index 489812b96..0e19f1ea3 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.h @@ -24,12 +24,13 @@ class btActivatingCollisionAlgorithm : public btCollisionAlgorithm // btCollisionObject* m_colObj0; // btCollisionObject* m_colObj1; -public: +protected: btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci); btActivatingCollisionAlgorithm (const btCollisionAlgorithmConstructionInfo& ci, const btCollisionObjectWrapper* body0Wrap,const btCollisionObjectWrapper* body1Wrap); +public: virtual ~btActivatingCollisionAlgorithm(); }; diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp index 737067ef9..5739a1ef0 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp @@ -239,10 +239,7 @@ public: virtual bool processOverlap(btBroadphasePair& pair) { - BT_PROFILE("btCollisionDispatcher::processOverlap"); - (*m_dispatcher->getNearCallback())(pair,*m_dispatcher,m_dispatchInfo); - return false; } }; diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.cpp new file mode 100644 index 000000000..075860c50 --- /dev/null +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.cpp @@ -0,0 +1,164 @@ +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +*/ + + + +#include "btCollisionDispatcherMt.h" +#include "LinearMath/btQuickprof.h" + +#include "BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h" + +#include "BulletCollision/CollisionShapes/btCollisionShape.h" +#include "BulletCollision/CollisionDispatch/btCollisionObject.h" +#include "BulletCollision/BroadphaseCollision/btOverlappingPairCache.h" +#include "LinearMath/btPoolAllocator.h" +#include "BulletCollision/CollisionDispatch/btCollisionConfiguration.h" +#include "BulletCollision/CollisionDispatch/btCollisionObjectWrapper.h" + + +btCollisionDispatcherMt::btCollisionDispatcherMt( btCollisionConfiguration* config, int grainSize ) + : btCollisionDispatcher( config ) +{ + m_batchUpdating = false; + m_grainSize = grainSize; // iterations per task +} + + +btPersistentManifold* btCollisionDispatcherMt::getNewManifold( const btCollisionObject* body0, const btCollisionObject* body1 ) +{ + //optional relative contact breaking threshold, turned on by default (use setDispatcherFlags to switch off feature for improved performance) + + btScalar contactBreakingThreshold = ( m_dispatcherFlags & btCollisionDispatcher::CD_USE_RELATIVE_CONTACT_BREAKING_THRESHOLD ) ? + btMin( body0->getCollisionShape()->getContactBreakingThreshold( gContactBreakingThreshold ), body1->getCollisionShape()->getContactBreakingThreshold( gContactBreakingThreshold ) ) + : gContactBreakingThreshold; + + btScalar contactProcessingThreshold = btMin( body0->getContactProcessingThreshold(), body1->getContactProcessingThreshold() ); + + void* mem = m_persistentManifoldPoolAllocator->allocate( sizeof( btPersistentManifold ) ); + if ( NULL == mem ) + { + //we got a pool memory overflow, by default we fallback to dynamically allocate memory. If we require a contiguous contact pool then assert. + if ( ( m_dispatcherFlags&CD_DISABLE_CONTACTPOOL_DYNAMIC_ALLOCATION ) == 0 ) + { + mem = btAlignedAlloc( sizeof( btPersistentManifold ), 16 ); + } + else + { + btAssert( 0 ); + //make sure to increase the m_defaultMaxPersistentManifoldPoolSize in the btDefaultCollisionConstructionInfo/btDefaultCollisionConfiguration + return 0; + } + } + btPersistentManifold* manifold = new( mem ) btPersistentManifold( body0, body1, 0, contactBreakingThreshold, contactProcessingThreshold ); + if ( !m_batchUpdating ) + { + // batch updater will update manifold pointers array after finishing, so + // only need to update array when not batch-updating + //btAssert( !btThreadsAreRunning() ); + manifold->m_index1a = m_manifoldsPtr.size(); + m_manifoldsPtr.push_back( manifold ); + } + + return manifold; +} + +void btCollisionDispatcherMt::releaseManifold( btPersistentManifold* manifold ) +{ + clearManifold( manifold ); + //btAssert( !btThreadsAreRunning() ); + if ( !m_batchUpdating ) + { + // batch updater will update manifold pointers array after finishing, so + // only need to update array when not batch-updating + int findIndex = manifold->m_index1a; + btAssert( findIndex < m_manifoldsPtr.size() ); + m_manifoldsPtr.swap( findIndex, m_manifoldsPtr.size() - 1 ); + m_manifoldsPtr[ findIndex ]->m_index1a = findIndex; + m_manifoldsPtr.pop_back(); + } + + manifold->~btPersistentManifold(); + if ( m_persistentManifoldPoolAllocator->validPtr( manifold ) ) + { + m_persistentManifoldPoolAllocator->freeMemory( manifold ); + } + else + { + btAlignedFree( manifold ); + } +} + +struct CollisionDispatcherUpdater : public btIParallelForBody +{ + btBroadphasePair* mPairArray; + btNearCallback mCallback; + btCollisionDispatcher* mDispatcher; + const btDispatcherInfo* mInfo; + + CollisionDispatcherUpdater() + { + mPairArray = NULL; + mCallback = NULL; + mDispatcher = NULL; + mInfo = NULL; + } + void forLoop( int iBegin, int iEnd ) const + { + for ( int i = iBegin; i < iEnd; ++i ) + { + btBroadphasePair* pair = &mPairArray[ i ]; + mCallback( *pair, *mDispatcher, *mInfo ); + } + } +}; + + +void btCollisionDispatcherMt::dispatchAllCollisionPairs( btOverlappingPairCache* pairCache, const btDispatcherInfo& info, btDispatcher* dispatcher ) +{ + int pairCount = pairCache->getNumOverlappingPairs(); + if ( pairCount == 0 ) + { + return; + } + CollisionDispatcherUpdater updater; + updater.mCallback = getNearCallback(); + updater.mPairArray = pairCache->getOverlappingPairArrayPtr(); + updater.mDispatcher = this; + updater.mInfo = &info; + + m_batchUpdating = true; + btParallelFor( 0, pairCount, m_grainSize, updater ); + m_batchUpdating = false; + + // reconstruct the manifolds array to ensure determinism + m_manifoldsPtr.resizeNoInitialize( 0 ); + + btBroadphasePair* pairs = pairCache->getOverlappingPairArrayPtr(); + for ( int i = 0; i < pairCount; ++i ) + { + if (btCollisionAlgorithm* algo = pairs[ i ].m_algorithm) + { + algo->getAllContactManifolds( m_manifoldsPtr ); + } + } + + // update the indices (used when releasing manifolds) + for ( int i = 0; i < m_manifoldsPtr.size(); ++i ) + { + m_manifoldsPtr[ i ]->m_index1a = i; + } +} + + diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.h b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.h new file mode 100644 index 000000000..f1d7eafdc --- /dev/null +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionDispatcherMt.h @@ -0,0 +1,39 @@ +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef BT_COLLISION_DISPATCHER_MT_H +#define BT_COLLISION_DISPATCHER_MT_H + +#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" +#include "LinearMath/btThreads.h" + + +class btCollisionDispatcherMt : public btCollisionDispatcher +{ +public: + btCollisionDispatcherMt( btCollisionConfiguration* config, int grainSize = 40 ); + + virtual btPersistentManifold* getNewManifold( const btCollisionObject* body0, const btCollisionObject* body1 ) BT_OVERRIDE; + virtual void releaseManifold( btPersistentManifold* manifold ) BT_OVERRIDE; + + virtual void dispatchAllCollisionPairs( btOverlappingPairCache* pairCache, const btDispatcherInfo& info, btDispatcher* dispatcher ) BT_OVERRIDE; + +protected: + bool m_batchUpdating; + int m_grainSize; +}; + +#endif //BT_COLLISION_DISPATCHER_MT_H + diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionObject.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionObject.cpp index fdecac162..b595c56bc 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionObject.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionObject.cpp @@ -18,9 +18,11 @@ subject to the following restrictions: #include "LinearMath/btSerializer.h" btCollisionObject::btCollisionObject() - : m_anisotropicFriction(1.f,1.f,1.f), - m_hasAnisotropicFriction(false), - m_contactProcessingThreshold(BT_LARGE_FLOAT), + : m_interpolationLinearVelocity(0.f, 0.f, 0.f), + m_interpolationAngularVelocity(0.f, 0.f, 0.f), + m_anisotropicFriction(1.f,1.f,1.f), + m_hasAnisotropicFriction(false), + m_contactProcessingThreshold(BT_LARGE_FLOAT), m_broadphaseHandle(0), m_collisionShape(0), m_extensionPointer(0), @@ -48,6 +50,7 @@ btCollisionObject::btCollisionObject() m_updateRevision(0) { m_worldTransform.setIdentity(); + m_interpolationWorldTransform.setIdentity(); } btCollisionObject::~btCollisionObject() @@ -112,6 +115,9 @@ const char* btCollisionObject::serialize(void* dataBuffer, btSerializer* seriali dataOut->m_ccdMotionThreshold = m_ccdMotionThreshold; dataOut->m_checkCollideWith = m_checkCollideWith; + // Fill padding with zeros to appease msan. + memset(dataOut->m_padding, 0, sizeof(dataOut->m_padding)); + return btCollisionObjectDataName; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionObject.h b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionObject.h index 0cae21000..fec831bff 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionObject.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionObject.h @@ -139,6 +139,8 @@ public: CF_DISABLE_SPU_COLLISION_PROCESSING = 64,//disable parallel/SPU processing CF_HAS_CONTACT_STIFFNESS_DAMPING = 128, CF_HAS_CUSTOM_DEBUG_RENDERING_COLOR = 256, + CF_HAS_FRICTION_ANCHOR = 512, + CF_HAS_COLLISION_SOUND_TRIGGER = 1024 }; enum CollisionObjectTypes diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp index 3bbf7586e..c893b60d3 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp @@ -108,7 +108,7 @@ btCollisionWorld::~btCollisionWorld() -void btCollisionWorld::addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup,short int collisionFilterMask) +void btCollisionWorld::addCollisionObject(btCollisionObject* collisionObject, int collisionFilterGroup, int collisionFilterMask) { btAssert(collisionObject); @@ -135,8 +135,7 @@ void btCollisionWorld::addCollisionObject(btCollisionObject* collisionObject,sho collisionObject, collisionFilterGroup, collisionFilterMask, - m_dispatcher1,0 - )) ; + m_dispatcher1)) ; @@ -257,7 +256,7 @@ void btCollisionWorld::removeCollisionObject(btCollisionObject* collisionObject) int iObj = collisionObject->getWorldArrayIndex(); - btAssert(iObj >= 0 && iObj < m_collisionObjects.size()); // trying to remove an object that was never added or already removed previously? +// btAssert(iObj >= 0 && iObj < m_collisionObjects.size()); // trying to remove an object that was never added or already removed previously? if (iObj >= 0 && iObj < m_collisionObjects.size()) { btAssert(collisionObject == m_collisionObjects[iObj]); @@ -1334,7 +1333,7 @@ void btCollisionWorld::debugDrawObject(const btTransform& worldTransform, const // Draw a small simplex at the center of the object if (getDebugDrawer() && getDebugDrawer()->getDebugMode() & btIDebugDraw::DBG_DrawFrames) { - getDebugDrawer()->drawTransform(worldTransform,1); + getDebugDrawer()->drawTransform(worldTransform,.1); } if (shape->getShapeType() == COMPOUND_SHAPE_PROXYTYPE) @@ -1515,6 +1514,8 @@ void btCollisionWorld::debugDrawWorld() { if (getDebugDrawer()) { + getDebugDrawer()->clearLines(); + btIDebugDraw::DefaultColors defaultColors = getDebugDrawer()->getDefaultColors(); if ( getDebugDrawer()->getDebugMode() & btIDebugDraw::DBG_DrawContactPoints) diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.h b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.h index 29d371116..eede2b28c 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorld.h @@ -205,8 +205,8 @@ public: { btScalar m_closestHitFraction; const btCollisionObject* m_collisionObject; - short int m_collisionFilterGroup; - short int m_collisionFilterMask; + int m_collisionFilterGroup; + int m_collisionFilterMask; //@BP Mod - Custom flags, currently used to enable backface culling on tri-meshes, see btRaycastCallback.h. Apply any of the EFlags defined there on m_flags here to invoke. unsigned int m_flags; @@ -340,8 +340,8 @@ public: struct ConvexResultCallback { btScalar m_closestHitFraction; - short int m_collisionFilterGroup; - short int m_collisionFilterMask; + int m_collisionFilterGroup; + int m_collisionFilterMask; ConvexResultCallback() :m_closestHitFraction(btScalar(1.)), @@ -410,8 +410,8 @@ public: ///ContactResultCallback is used to report contact points struct ContactResultCallback { - short int m_collisionFilterGroup; - short int m_collisionFilterMask; + int m_collisionFilterGroup; + int m_collisionFilterMask; btScalar m_closestDistanceThreshold; ContactResultCallback() @@ -483,7 +483,7 @@ public: const btCollisionObjectWrapper* colObjWrap, ConvexResultCallback& resultCallback, btScalar allowedPenetration); - virtual void addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup=btBroadphaseProxy::DefaultFilter,short int collisionFilterMask=btBroadphaseProxy::AllFilter); + virtual void addCollisionObject(btCollisionObject* collisionObject, int collisionFilterGroup=btBroadphaseProxy::DefaultFilter, int collisionFilterMask=btBroadphaseProxy::AllFilter); btCollisionObjectArray& getCollisionObjectArray() { diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp index 36dd04350..f2b083780 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.cpp @@ -579,13 +579,13 @@ btCollisionShape* btCollisionWorldImporter::convertCollisionShape( btCollisionS btCompoundShapeData* compoundData = (btCompoundShapeData*)shapeData; btCompoundShape* compoundShape = createCompoundShape(); - btCompoundShapeChildData* childShapeDataArray = &compoundData->m_childShapePtr[0]; + //btCompoundShapeChildData* childShapeDataArray = &compoundData->m_childShapePtr[0]; btAlignedObjectArray childShapes; for (int i=0;im_numChildShapes;i++) { - btCompoundShapeChildData* ptr = &compoundData->m_childShapePtr[i]; + //btCompoundShapeChildData* ptr = &compoundData->m_childShapePtr[i]; btCollisionShapeData* cd = compoundData->m_childShapePtr[i].m_childShape; diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.h b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.h index 9a6d16fbe..81c614272 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCollisionWorldImporter.h @@ -124,7 +124,6 @@ public: btCollisionShape* getCollisionShapeByIndex(int index); int getNumRigidBodies() const; btCollisionObject* getRigidBodyByIndex(int index) const; - int getNumConstraints() const; int getNumBvhs() const; btOptimizedBvh* getBvhByIndex(int index) const; diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp index 8dd7e4403..d4a1aa78e 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp @@ -24,6 +24,8 @@ subject to the following restrictions: #include "BulletCollision/CollisionDispatch/btManifoldResult.h" #include "BulletCollision/CollisionDispatch/btCollisionObjectWrapper.h" +//USE_LOCAL_STACK will avoid most (often all) dynamic memory allocations due to resizing in processCollision and MycollideTT +#define USE_LOCAL_STACK 1 btShapePairCallback gCompoundCompoundChildShapePairCallback = 0; @@ -251,7 +253,12 @@ static inline void MycollideTT( const btDbvtNode* root0, int depth=1; int treshold=btDbvt::DOUBLE_STACKSIZE-4; btAlignedObjectArray stkStack; +#ifdef USE_LOCAL_STACK + ATTRIBUTE_ALIGNED16(btDbvt::sStkNN localStack[btDbvt::DOUBLE_STACKSIZE]); + stkStack.initializeFromBuffer(&localStack,btDbvt::DOUBLE_STACKSIZE,btDbvt::DOUBLE_STACKSIZE); +#else stkStack.resize(btDbvt::DOUBLE_STACKSIZE); +#endif stkStack[0]=btDbvt::sStkNN(root0,root1); do { btDbvt::sStkNN p=stkStack[--depth]; @@ -329,6 +336,10 @@ void btCompoundCompoundCollisionAlgorithm::processCollision (const btCollisionOb { int i; btManifoldArray manifoldArray; +#ifdef USE_LOCAL_STACK + btPersistentManifold localManifolds[4]; + manifoldArray.initializeFromBuffer(&localManifolds,0,4); +#endif btSimplePairArray& pairs = m_childCollisionAlgorithmCache->getOverlappingPairArray(); for (i=0;igetShapeType() == CAPSULE_SHAPE_PROXYTYPE) && (min1->getShapeType() == CAPSULE_SHAPE_PROXYTYPE)) { + //m_manifoldPtr->clearManifold(); + btCapsuleShape* capsuleA = (btCapsuleShape*) min0; btCapsuleShape* capsuleB = (btCapsuleShape*) min1; - // btVector3 localScalingA = capsuleA->getLocalScaling(); - // btVector3 localScalingB = capsuleB->getLocalScaling(); btScalar threshold = m_manifoldPtr->getContactBreakingThreshold(); @@ -329,6 +329,50 @@ void btConvexConvexAlgorithm ::processCollision (const btCollisionObjectWrapper* resultOut->refreshContactPoints(); return; } + + if ((min0->getShapeType() == CAPSULE_SHAPE_PROXYTYPE) && (min1->getShapeType() == SPHERE_SHAPE_PROXYTYPE)) + { + //m_manifoldPtr->clearManifold(); + + btCapsuleShape* capsuleA = (btCapsuleShape*) min0; + btSphereShape* capsuleB = (btSphereShape*) min1; + + btScalar threshold = m_manifoldPtr->getContactBreakingThreshold(); + + btScalar dist = capsuleCapsuleDistance(normalOnB, pointOnBWorld,capsuleA->getHalfHeight(),capsuleA->getRadius(), + 0.,capsuleB->getRadius(),capsuleA->getUpAxis(),1, + body0Wrap->getWorldTransform(),body1Wrap->getWorldTransform(),threshold); + + if (dist=(SIMD_EPSILON*SIMD_EPSILON)); + resultOut->addContactPoint(normalOnB,pointOnBWorld,dist); + } + resultOut->refreshContactPoints(); + return; + } + + if ((min0->getShapeType() == SPHERE_SHAPE_PROXYTYPE) && (min1->getShapeType() == CAPSULE_SHAPE_PROXYTYPE)) + { + //m_manifoldPtr->clearManifold(); + + btSphereShape* capsuleA = (btSphereShape*) min0; + btCapsuleShape* capsuleB = (btCapsuleShape*) min1; + + btScalar threshold = m_manifoldPtr->getContactBreakingThreshold(); + + btScalar dist = capsuleCapsuleDistance(normalOnB, pointOnBWorld,0.,capsuleA->getRadius(), + capsuleB->getHalfHeight(),capsuleB->getRadius(),1,capsuleB->getUpAxis(), + body0Wrap->getWorldTransform(),body1Wrap->getWorldTransform(),threshold); + + if (dist=(SIMD_EPSILON*SIMD_EPSILON)); + resultOut->addContactPoint(normalOnB,pointOnBWorld,dist); + } + resultOut->refreshContactPoints(); + return; + } #endif //BT_DISABLE_CAPSULE_CAPSULE_COLLIDER diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btHashedSimplePairCache.h b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btHashedSimplePairCache.h index 186964d72..2aaf6201f 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btHashedSimplePairCache.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btHashedSimplePairCache.h @@ -123,9 +123,9 @@ private: - SIMD_FORCE_INLINE unsigned int getHash(unsigned int indexA, unsigned int indexB) + SIMD_FORCE_INLINE unsigned int getHash(unsigned int indexA, unsigned int indexB) { - int key = static_cast(((unsigned int)indexA) | (((unsigned int)indexB) <<16)); + unsigned int key = indexA | (indexB << 16); // Thomas Wang's hash key += ~(key << 15); @@ -134,7 +134,7 @@ private: key ^= (key >> 6); key += ~(key << 11); key ^= (key >> 16); - return static_cast(key); + return key; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp index be8e51d52..aa3d159f8 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionDispatch/btManifoldResult.cpp @@ -111,6 +111,7 @@ void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const b return; bool isSwapped = m_manifoldPtr->getBody0() != m_body0Wrap->getCollisionObject(); + bool isNewCollision = m_manifoldPtr->getNumContacts() == 0; btVector3 pointA = pointInWorld + normalOnBInWorld * depth; @@ -145,7 +146,13 @@ void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const b newPt.m_combinedContactStiffness1 = calculateCombinedContactStiffness(m_body0Wrap->getCollisionObject(),m_body1Wrap->getCollisionObject()); newPt.m_contactPointFlags |= BT_CONTACT_FLAG_CONTACT_STIFFNESS_DAMPING; } - + + if ( (m_body0Wrap->getCollisionObject()->getCollisionFlags()& btCollisionObject::CF_HAS_FRICTION_ANCHOR) || + (m_body1Wrap->getCollisionObject()->getCollisionFlags()& btCollisionObject::CF_HAS_FRICTION_ANCHOR)) + { + newPt.m_contactPointFlags |= BT_CONTACT_FLAG_FRICTION_ANCHOR; + } + btPlaneSpace1(newPt.m_normalWorldOnB,newPt.m_lateralFrictionDir1,newPt.m_lateralFrictionDir2); @@ -187,5 +194,9 @@ void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const b (*gContactAddedCallback)(m_manifoldPtr->getContactPoint(insertIndex),obj0Wrap,newPt.m_partId0,newPt.m_index0,obj1Wrap,newPt.m_partId1,newPt.m_index1); } + if (gContactStartedCallback && isNewCollision) + { + gContactStartedCallback(m_manifoldPtr); + } } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBox2dShape.h b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBox2dShape.h index ce333783e..22bee4f2c 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBox2dShape.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBox2dShape.h @@ -103,11 +103,12 @@ public: btScalar minDimension = boxHalfExtents.getX(); if (minDimension>boxHalfExtents.getY()) minDimension = boxHalfExtents.getY(); - setSafeMargin(minDimension); m_shapeType = BOX_2D_SHAPE_PROXYTYPE; btVector3 margin(getMargin(),getMargin(),getMargin()); m_implicitShapeDimensions = (boxHalfExtents * m_localScaling) - margin; + + setSafeMargin(minDimension); }; virtual void setMargin(btScalar collisionMargin) diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBoxShape.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBoxShape.cpp index 3859138f1..72eeb3891 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBoxShape.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBoxShape.cpp @@ -19,10 +19,10 @@ btBoxShape::btBoxShape( const btVector3& boxHalfExtents) { m_shapeType = BOX_SHAPE_PROXYTYPE; - setSafeMargin(boxHalfExtents); - btVector3 margin(getMargin(),getMargin(),getMargin()); m_implicitShapeDimensions = (boxHalfExtents * m_localScaling) - margin; + + setSafeMargin(boxHalfExtents); }; diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp index 0940da1a4..61f465cb7 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp @@ -437,6 +437,9 @@ const char* btBvhTriangleMeshShape::serialize(void* dataBuffer, btSerializer* se trimeshData->m_triangleInfoMap = 0; } + // Fill padding with zeros to appease msan. + memset(trimeshData->m_pad3, 0, sizeof(trimeshData->m_pad3)); + return "btTriangleMeshShapeData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCapsuleShape.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCapsuleShape.cpp index 864df26e9..0345501ce 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCapsuleShape.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCapsuleShape.cpp @@ -16,11 +16,11 @@ subject to the following restrictions: #include "btCapsuleShape.h" -#include "BulletCollision/CollisionShapes/btCollisionMargin.h" #include "LinearMath/btQuaternion.h" btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInternalShape () { + m_collisionMargin = radius; m_shapeType = CAPSULE_SHAPE_PROXYTYPE; m_upAxis = 1; m_implicitShapeDimensions.setValue(radius,0.5f*height,radius); @@ -48,14 +48,13 @@ btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInter btVector3 vtx; btScalar newDot; - btScalar radius = getRadius(); - + { btVector3 pos(0,0,0); pos[getUpAxis()] = getHalfHeight(); - vtx = pos +vec*(radius) - vec * getMargin(); + vtx = pos; newDot = vec.dot(vtx); if (newDot > maxDot) { @@ -67,7 +66,7 @@ btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInter btVector3 pos(0,0,0); pos[getUpAxis()] = -getHalfHeight(); - vtx = pos +vec*(radius) - vec * getMargin(); + vtx = pos; newDot = vec.dot(vtx); if (newDot > maxDot) { @@ -84,8 +83,7 @@ btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInter { - btScalar radius = getRadius(); - + for (int j=0;j maxDot) { @@ -107,7 +105,7 @@ btCapsuleShape::btCapsuleShape(btScalar radius, btScalar height) : btConvexInter { btVector3 pos(0,0,0); pos[getUpAxis()] = -getHalfHeight(); - vtx = pos +vec*(radius) - vec * getMargin(); + vtx = pos; newDot = vec.dot(vtx); if (newDot > maxDot) { @@ -133,11 +131,9 @@ void btCapsuleShape::calculateLocalInertia(btScalar mass,btVector3& inertia) con btVector3 halfExtents(radius,radius,radius); halfExtents[getUpAxis()]+=getHalfHeight(); - btScalar margin = CONVEX_DISTANCE_MARGIN; - - btScalar lx=btScalar(2.)*(halfExtents[0]+margin); - btScalar ly=btScalar(2.)*(halfExtents[1]+margin); - btScalar lz=btScalar(2.)*(halfExtents[2]+margin); + btScalar lx=btScalar(2.)*(halfExtents[0]); + btScalar ly=btScalar(2.)*(halfExtents[1]); + btScalar lz=btScalar(2.)*(halfExtents[2]); const btScalar x2 = lx*lx; const btScalar y2 = ly*ly; const btScalar z2 = lz*lz; @@ -151,6 +147,7 @@ void btCapsuleShape::calculateLocalInertia(btScalar mass,btVector3& inertia) con btCapsuleShapeX::btCapsuleShapeX(btScalar radius,btScalar height) { + m_collisionMargin = radius; m_upAxis = 0; m_implicitShapeDimensions.setValue(0.5f*height, radius,radius); } @@ -162,6 +159,7 @@ btCapsuleShapeX::btCapsuleShapeX(btScalar radius,btScalar height) btCapsuleShapeZ::btCapsuleShapeZ(btScalar radius,btScalar height) { + m_collisionMargin = radius; m_upAxis = 2; m_implicitShapeDimensions.setValue(radius,radius,0.5f*height); } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCapsuleShape.h b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCapsuleShape.h index f8c55ace4..7d64b46ab 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCapsuleShape.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCapsuleShape.h @@ -48,21 +48,13 @@ public: virtual void setMargin(btScalar collisionMargin) { - //correct the m_implicitShapeDimensions for the margin - btVector3 oldMargin(getMargin(),getMargin(),getMargin()); - btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin; - - btConvexInternalShape::setMargin(collisionMargin); - btVector3 newMargin(getMargin(),getMargin(),getMargin()); - m_implicitShapeDimensions = implicitShapeDimensionsWithMargin - newMargin; - + //don't override the margin for capsules, their entire radius == margin } virtual void getAabb (const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const { btVector3 halfExtents(getRadius(),getRadius(),getRadius()); halfExtents[m_upAxis] = getRadius() + getHalfHeight(); - halfExtents += btVector3(getMargin(),getMargin(),getMargin()); btMatrix3x3 abs_b = t.getBasis().absolute(); btVector3 center = t.getOrigin(); btVector3 extent = halfExtents.dot3(abs_b[0], abs_b[1], abs_b[2]); @@ -94,14 +86,12 @@ public: virtual void setLocalScaling(const btVector3& scaling) { - btVector3 oldMargin(getMargin(),getMargin(),getMargin()); - btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin; - btVector3 unScaledImplicitShapeDimensionsWithMargin = implicitShapeDimensionsWithMargin / m_localScaling; - - btConvexInternalShape::setLocalScaling(scaling); - - m_implicitShapeDimensions = (unScaledImplicitShapeDimensionsWithMargin * m_localScaling) - oldMargin; - + btVector3 unScaledImplicitShapeDimensions = m_implicitShapeDimensions / m_localScaling; + btConvexInternalShape::setLocalScaling(scaling); + m_implicitShapeDimensions = (unScaledImplicitShapeDimensions * scaling); + //update m_collisionMargin, since entire radius==margin + int radiusAxis = (m_upAxis+2)%3; + m_collisionMargin = m_implicitShapeDimensions[radiusAxis]; } virtual btVector3 getAnisotropicRollingFrictionDirection() const @@ -174,11 +164,17 @@ SIMD_FORCE_INLINE int btCapsuleShape::calculateSerializeBufferSize() const SIMD_FORCE_INLINE const char* btCapsuleShape::serialize(void* dataBuffer, btSerializer* serializer) const { btCapsuleShapeData* shapeData = (btCapsuleShapeData*) dataBuffer; - + btConvexInternalShape::serialize(&shapeData->m_convexInternalShapeData,serializer); shapeData->m_upAxis = m_upAxis; - + + // Fill padding with zeros to appease msan. + shapeData->m_padding[0] = 0; + shapeData->m_padding[1] = 0; + shapeData->m_padding[2] = 0; + shapeData->m_padding[3] = 0; + return "btCapsuleShapeData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCollisionShape.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCollisionShape.cpp index 39ee21cad..823e2788f 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCollisionShape.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCollisionShape.cpp @@ -106,7 +106,10 @@ const char* btCollisionShape::serialize(void* dataBuffer, btSerializer* serializ serializer->serializeName(name); } shapeData->m_shapeType = m_shapeType; - //shapeData->m_padding//?? + + // Fill padding with zeros to appease msan. + memset(shapeData->m_padding, 0, sizeof(shapeData->m_padding)); + return "btCollisionShapeData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConeShape.h b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConeShape.h index 46d78d148..3b44e3f27 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConeShape.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConeShape.h @@ -168,11 +168,17 @@ SIMD_FORCE_INLINE int btConeShape::calculateSerializeBufferSize() const SIMD_FORCE_INLINE const char* btConeShape::serialize(void* dataBuffer, btSerializer* serializer) const { btConeShapeData* shapeData = (btConeShapeData*) dataBuffer; - + btConvexInternalShape::serialize(&shapeData->m_convexInternalShapeData,serializer); - + shapeData->m_upIndex = m_coneIndices[1]; - + + // Fill padding with zeros to appease msan. + shapeData->m_padding[0] = 0; + shapeData->m_padding[1] = 0; + shapeData->m_padding[2] = 0; + shapeData->m_padding[3] = 0; + return "btConeShapeData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp index c1aa6ca46..a7a959840 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexHullShape.cpp @@ -211,7 +211,10 @@ const char* btConvexHullShape::serialize(void* dataBuffer, btSerializer* seriali } serializer->finalizeChunk(chunk,btVector3DataName,BT_ARRAY_CODE,(void*)&m_unscaledPoints[0]); } - + + // Fill padding with zeros to appease msan. + memset(shapeData->m_padding3, 0, sizeof(shapeData->m_padding3)); + return "btConvexHullShapeData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexInternalShape.h b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexInternalShape.h index 37e04f5fc..1213b82fb 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexInternalShape.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexInternalShape.h @@ -172,6 +172,9 @@ SIMD_FORCE_INLINE const char* btConvexInternalShape::serialize(void* dataBuffer, m_localScaling.serializeFloat(shapeData->m_localScaling); shapeData->m_collisionMargin = float(m_collisionMargin); + // Fill padding with zeros to appease msan. + shapeData->m_padding = 0; + return "btConvexInternalShapeData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexShape.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexShape.cpp index b56d72917..8d7fb054d 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexShape.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btConvexShape.cpp @@ -230,14 +230,13 @@ btVector3 btConvexShape::localGetSupportVertexWithoutMarginNonVirtual (const btV btScalar halfHeight = capsuleShape->getHalfHeight(); int capsuleUpAxis = capsuleShape->getUpAxis(); - btScalar radius = capsuleShape->getRadius(); btVector3 supVec(0,0,0); btScalar maxDot(btScalar(-BT_LARGE_FLOAT)); btVector3 vec = vec0; btScalar lenSqr = vec.length2(); - if (lenSqr < btScalar(0.0001)) + if (lenSqr < SIMD_EPSILON*SIMD_EPSILON) { vec.setValue(1,0,0); } else @@ -251,8 +250,7 @@ btVector3 btConvexShape::localGetSupportVertexWithoutMarginNonVirtual (const btV btVector3 pos(0,0,0); pos[capsuleUpAxis] = halfHeight; - //vtx = pos +vec*(radius); - vtx = pos +vec*(radius) - vec * capsuleShape->getMarginNV(); + vtx = pos; newDot = vec.dot(vtx); @@ -266,8 +264,7 @@ btVector3 btConvexShape::localGetSupportVertexWithoutMarginNonVirtual (const btV btVector3 pos(0,0,0); pos[capsuleUpAxis] = -halfHeight; - //vtx = pos +vec*(radius); - vtx = pos +vec*(radius) - vec * capsuleShape->getMarginNV(); + vtx = pos; newDot = vec.dot(vtx); if (newDot > maxDot) { @@ -427,7 +424,6 @@ void btConvexShape::getAabbNonVirtual (const btTransform& t, btVector3& aabbMin, btVector3 halfExtents(capsuleShape->getRadius(),capsuleShape->getRadius(),capsuleShape->getRadius()); int m_upAxis = capsuleShape->getUpAxis(); halfExtents[m_upAxis] = capsuleShape->getRadius() + capsuleShape->getHalfHeight(); - halfExtents += btVector3(capsuleShape->getMarginNonVirtual(),capsuleShape->getMarginNonVirtual(),capsuleShape->getMarginNonVirtual()); btMatrix3x3 abs_b = t.getBasis().absolute(); btVector3 center = t.getOrigin(); btVector3 extent = halfExtents.dot3(abs_b[0], abs_b[1], abs_b[2]); diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCylinderShape.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCylinderShape.cpp index 6cfe43be4..604b3fc77 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCylinderShape.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCylinderShape.cpp @@ -19,10 +19,11 @@ btCylinderShape::btCylinderShape (const btVector3& halfExtents) :btConvexInternalShape(), m_upAxis(1) { - setSafeMargin(halfExtents); - btVector3 margin(getMargin(),getMargin(),getMargin()); m_implicitShapeDimensions = (halfExtents * m_localScaling) - margin; + + setSafeMargin(halfExtents); + m_shapeType = CYLINDER_SHAPE_PROXYTYPE; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCylinderShape.h b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCylinderShape.h index 6f796950e..a214a827c 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCylinderShape.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btCylinderShape.h @@ -199,11 +199,17 @@ SIMD_FORCE_INLINE int btCylinderShape::calculateSerializeBufferSize() const SIMD_FORCE_INLINE const char* btCylinderShape::serialize(void* dataBuffer, btSerializer* serializer) const { btCylinderShapeData* shapeData = (btCylinderShapeData*) dataBuffer; - + btConvexInternalShape::serialize(&shapeData->m_convexInternalShapeData,serializer); shapeData->m_upAxis = m_upAxis; - + + // Fill padding with zeros to appease msan. + shapeData->m_padding[0] = 0; + shapeData->m_padding[1] = 0; + shapeData->m_padding[2] = 0; + shapeData->m_padding[3] = 0; + return "btCylinderShapeData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp index 06707e24e..899ef5005 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp @@ -55,6 +55,23 @@ btScalar btMinkowskiSumShape::getMargin() const void btMinkowskiSumShape::calculateLocalInertia(btScalar mass,btVector3& inertia) const { (void)mass; - btAssert(0); - inertia.setValue(0,0,0); + //inertia of the AABB of the Minkowski sum + btTransform identity; + identity.setIdentity(); + btVector3 aabbMin,aabbMax; + getAabb(identity,aabbMin,aabbMax); + + btVector3 halfExtents = (aabbMax-aabbMin)*btScalar(0.5); + + btScalar margin = getMargin(); + + btScalar lx=btScalar(2.)*(halfExtents.x()+margin); + btScalar ly=btScalar(2.)*(halfExtents.y()+margin); + btScalar lz=btScalar(2.)*(halfExtents.z()+margin); + const btScalar x2 = lx*lx; + const btScalar y2 = ly*ly; + const btScalar z2 = lz*lz; + const btScalar scaledmass = mass * btScalar(0.08333333); + + inertia = scaledmass * (btVector3(y2+z2,x2+z2,x2+y2)); } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp index 88f6c4dcb..4195fa313 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btMultiSphereShape.cpp @@ -175,7 +175,10 @@ const char* btMultiSphereShape::serialize(void* dataBuffer, btSerializer* serial } serializer->finalizeChunk(chunk,"btPositionAndRadius",BT_ARRAY_CODE,(void*)&m_localPositionArray[0]); } - + + // Fill padding with zeros to appease msan. + memset(shapeData->m_padding, 0, sizeof(shapeData->m_padding)); + return "btMultiSphereShapeData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h index 961d001a9..7bf8e01c1 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h @@ -93,10 +93,12 @@ protected: aabbMax = m_localAabbMax; } -public: +protected: btPolyhedralConvexAabbCachingShape(); +public: + inline void getNonvirtualAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax, btScalar margin) const { diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btSphereShape.h b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btSphereShape.h index b192efeeb..50561f7f5 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btSphereShape.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btSphereShape.h @@ -29,8 +29,11 @@ public: btSphereShape (btScalar radius) : btConvexInternalShape () { m_shapeType = SPHERE_SHAPE_PROXYTYPE; + m_localScaling.setValue(1.0, 1.0, 1.0); + m_implicitShapeDimensions.setZero(); m_implicitShapeDimensions.setX(radius); m_collisionMargin = radius; + m_padding = 0; } virtual btVector3 localGetSupportingVertex(const btVector3& vec)const; diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btStaticPlaneShape.h b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btStaticPlaneShape.h index e6e328839..5e9eccc77 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btStaticPlaneShape.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btStaticPlaneShape.h @@ -94,7 +94,13 @@ SIMD_FORCE_INLINE const char* btStaticPlaneShape::serialize(void* dataBuffer, bt m_localScaling.serializeFloat(planeData->m_localScaling); m_planeNormal.serializeFloat(planeData->m_planeNormal); planeData->m_planeConstant = float(m_planeConstant); - + + // Fill padding with zeros to appease msan. + planeData->m_pad[0] = 0; + planeData->m_pad[1] = 0; + planeData->m_pad[2] = 0; + planeData->m_pad[3] = 0; + return "btStaticPlaneShapeData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp index b3d449676..78ddeb370 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btStridingMeshInterface.cpp @@ -293,6 +293,9 @@ const char* btStridingMeshInterface::serialize(void* dataBuffer, btSerializer* s tmpIndices[gfxindex].m_values[0] = tri_indices[0]; tmpIndices[gfxindex].m_values[1] = tri_indices[1]; tmpIndices[gfxindex].m_values[2] = tri_indices[2]; + // Fill padding with zeros to appease msan. + tmpIndices[gfxindex].m_pad[0] = 0; + tmpIndices[gfxindex].m_pad[1] = 0; } serializer->finalizeChunk(chunk,"btShortIntIndexTripletData",BT_ARRAY_CODE,(void*)chunk->m_oldPtr); } @@ -311,6 +314,8 @@ const char* btStridingMeshInterface::serialize(void* dataBuffer, btSerializer* s tmpIndices[gfxindex].m_values[0] = tri_indices[0]; tmpIndices[gfxindex].m_values[1] = tri_indices[1]; tmpIndices[gfxindex].m_values[2] = tri_indices[2]; + // Fill padding with zeros to appease msan. + tmpIndices[gfxindex].m_pad = 0; } serializer->finalizeChunk(chunk,"btCharIndexTripletData",BT_ARRAY_CODE,(void*)chunk->m_oldPtr); } @@ -375,6 +380,8 @@ const char* btStridingMeshInterface::serialize(void* dataBuffer, btSerializer* s serializer->finalizeChunk(chunk,"btMeshPartData",BT_ARRAY_CODE,chunk->m_oldPtr); } + // Fill padding with zeros to appease msan. + memset(trimeshData->m_padding, 0, sizeof(trimeshData->m_padding)); m_scaling.serializeFloat(trimeshData->m_scaling); return "btStridingMeshInterfaceData"; diff --git a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btTriangleInfoMap.h b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btTriangleInfoMap.h index 17deef89d..642758959 100644 --- a/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btTriangleInfoMap.h +++ b/Engine/lib/bullet/src/BulletCollision/CollisionShapes/btTriangleInfoMap.h @@ -195,6 +195,13 @@ SIMD_FORCE_INLINE const char* btTriangleInfoMap::serialize(void* dataBuffer, btS serializer->finalizeChunk(chunk,"int",BT_ARRAY_CODE,(void*) &m_keyArray[0]); } + + // Fill padding with zeros to appease msan. + tmapData->m_padding[0] = 0; + tmapData->m_padding[1] = 0; + tmapData->m_padding[2] = 0; + tmapData->m_padding[3] = 0; + return "btTriangleInfoMapData"; } diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/btCompoundFromGimpact.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/btCompoundFromGimpact.h index 02f8b678a..19f7ecddd 100644 --- a/Engine/lib/bullet/src/BulletCollision/Gimpact/btCompoundFromGimpact.h +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/btCompoundFromGimpact.h @@ -5,6 +5,22 @@ #include "btGImpactShape.h" #include "BulletCollision/NarrowPhaseCollision/btRaycastCallback.h" +ATTRIBUTE_ALIGNED16(class) btCompoundFromGimpactShape : public btCompoundShape +{ +public: + BT_DECLARE_ALIGNED_ALLOCATOR(); + + virtual ~btCompoundFromGimpactShape() + { + /*delete all the btBU_Simplex1to4 ChildShapes*/ + for (int i = 0; i < m_children.size(); i++) + { + delete m_children[i].m_childShape; + } + } + +}; + struct MyCallback : public btTriangleRaycastCallback { int m_ignorePart; @@ -77,7 +93,7 @@ struct MyCallback : public btTriangleRaycastCallback btCompoundShape* btCreateCompoundFromGimpactShape(const btGImpactMeshShape* gimpactMesh, btScalar depth) { - btCompoundShape* colShape = new btCompoundShape(); + btCompoundShape* colShape = new btCompoundFromGimpactShape(); btTransform tr; tr.setIdentity(); @@ -90,4 +106,4 @@ btCompoundShape* btCreateCompoundFromGimpactShape(const btGImpactMeshShape* gimp return colShape; } -#endif //BT_COMPOUND_FROM_GIMPACT \ No newline at end of file +#endif //BT_COMPOUND_FROM_GIMPACT diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/btContactProcessing.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/btContactProcessing.h index 0c66f8e10..d1027dbe6 100644 --- a/Engine/lib/bullet/src/BulletCollision/Gimpact/btContactProcessing.h +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/btContactProcessing.h @@ -27,86 +27,7 @@ subject to the following restrictions: #include "LinearMath/btTransform.h" #include "LinearMath/btAlignedObjectArray.h" #include "btTriangleShapeEx.h" - - - -/** -Configuration var for applying interpolation of contact normals -*/ -#define NORMAL_CONTACT_AVERAGE 1 - -#define CONTACT_DIFF_EPSILON 0.00001f - -///The GIM_CONTACT is an internal GIMPACT structure, similar to btManifoldPoint. -///@todo: remove and replace GIM_CONTACT by btManifoldPoint. -class GIM_CONTACT -{ -public: - btVector3 m_point; - btVector3 m_normal; - btScalar m_depth;//Positive value indicates interpenetration - btScalar m_distance;//Padding not for use - int m_feature1;//Face number - int m_feature2;//Face number -public: - GIM_CONTACT() - { - } - - GIM_CONTACT(const GIM_CONTACT & contact): - m_point(contact.m_point), - m_normal(contact.m_normal), - m_depth(contact.m_depth), - m_feature1(contact.m_feature1), - m_feature2(contact.m_feature2) - { - } - - GIM_CONTACT(const btVector3 &point,const btVector3 & normal, - btScalar depth, int feature1, int feature2): - m_point(point), - m_normal(normal), - m_depth(depth), - m_feature1(feature1), - m_feature2(feature2) - { - } - - //! Calcs key for coord classification - SIMD_FORCE_INLINE unsigned int calc_key_contact() const - { - int _coords[] = { - (int)(m_point[0]*1000.0f+1.0f), - (int)(m_point[1]*1333.0f), - (int)(m_point[2]*2133.0f+3.0f)}; - unsigned int _hash=0; - unsigned int *_uitmp = (unsigned int *)(&_coords[0]); - _hash = *_uitmp; - _uitmp++; - _hash += (*_uitmp)<<4; - _uitmp++; - _hash += (*_uitmp)<<8; - return _hash; - } - - SIMD_FORCE_INLINE void interpolate_normals( btVector3 * normals,int normal_count) - { - btVector3 vec_sum(m_normal); - for(int i=0;i { @@ -141,5 +62,4 @@ public: void merge_contacts_unique(const btContactArray & contacts); }; - #endif // GIM_CONTACT_H_INCLUDED diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/btContactProcessingStructs.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/btContactProcessingStructs.h new file mode 100644 index 000000000..efbc4a567 --- /dev/null +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/btContactProcessingStructs.h @@ -0,0 +1,109 @@ +#ifndef BT_CONTACT_H_STRUCTS_INCLUDED +#define BT_CONTACT_H_STRUCTS_INCLUDED + +/*! \file gim_contact.h +\author Francisco Leon Najera +*/ +/* +This source file is part of GIMPACT Library. + +For the latest info, see http://gimpact.sourceforge.net/ + +Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371. +email: projectileman@yahoo.com + + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +*/ + +#include "LinearMath/btTransform.h" +#include "LinearMath/btAlignedObjectArray.h" +#include "btTriangleShapeEx.h" + + +/** +Configuration var for applying interpolation of contact normals +*/ +#define NORMAL_CONTACT_AVERAGE 1 + +#define CONTACT_DIFF_EPSILON 0.00001f + +///The GIM_CONTACT is an internal GIMPACT structure, similar to btManifoldPoint. +///@todo: remove and replace GIM_CONTACT by btManifoldPoint. +class GIM_CONTACT +{ +public: + btVector3 m_point; + btVector3 m_normal; + btScalar m_depth;//Positive value indicates interpenetration + btScalar m_distance;//Padding not for use + int m_feature1;//Face number + int m_feature2;//Face number +public: + GIM_CONTACT() + { + } + + GIM_CONTACT(const GIM_CONTACT & contact): + m_point(contact.m_point), + m_normal(contact.m_normal), + m_depth(contact.m_depth), + m_feature1(contact.m_feature1), + m_feature2(contact.m_feature2) + { + } + + GIM_CONTACT(const btVector3 &point,const btVector3 & normal, + btScalar depth, int feature1, int feature2): + m_point(point), + m_normal(normal), + m_depth(depth), + m_feature1(feature1), + m_feature2(feature2) + { + } + + //! Calcs key for coord classification + SIMD_FORCE_INLINE unsigned int calc_key_contact() const + { + int _coords[] = { + (int)(m_point[0]*1000.0f+1.0f), + (int)(m_point[1]*1333.0f), + (int)(m_point[2]*2133.0f+3.0f)}; + unsigned int _hash=0; + unsigned int *_uitmp = (unsigned int *)(&_coords[0]); + _hash = *_uitmp; + _uitmp++; + _hash += (*_uitmp)<<4; + _uitmp++; + _hash += (*_uitmp)<<8; + return _hash; + } + + SIMD_FORCE_INLINE void interpolate_normals( btVector3 * normals,int normal_count) + { + btVector3 vec_sum(m_normal); + for(int i=0;i @@ -74,59 +50,6 @@ public: } }; - -///GIM_BVH_DATA is an internal GIMPACT collision structure to contain axis aligned bounding box -struct GIM_BVH_DATA -{ - btAABB m_bound; - int m_data; -}; - -//! Node Structure for trees -class GIM_BVH_TREE_NODE -{ -public: - btAABB m_bound; -protected: - int m_escapeIndexOrDataIndex; -public: - GIM_BVH_TREE_NODE() - { - m_escapeIndexOrDataIndex = 0; - } - - SIMD_FORCE_INLINE bool isLeafNode() const - { - //skipindex is negative (internal node), triangleindex >=0 (leafnode) - return (m_escapeIndexOrDataIndex>=0); - } - - SIMD_FORCE_INLINE int getEscapeIndex() const - { - //btAssert(m_escapeIndexOrDataIndex < 0); - return -m_escapeIndexOrDataIndex; - } - - SIMD_FORCE_INLINE void setEscapeIndex(int index) - { - m_escapeIndexOrDataIndex = -index; - } - - SIMD_FORCE_INLINE int getDataIndex() const - { - //btAssert(m_escapeIndexOrDataIndex >= 0); - - return m_escapeIndexOrDataIndex; - } - - SIMD_FORCE_INLINE void setDataIndex(int index) - { - m_escapeIndexOrDataIndex = index; - } - -}; - - class GIM_BVH_DATA_ARRAY:public btAlignedObjectArray { }; @@ -392,5 +315,4 @@ public: btPairSet & collision_pairs); }; - #endif // GIM_BOXPRUNING_H_INCLUDED diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactBvhStructs.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactBvhStructs.h new file mode 100644 index 000000000..9342a572d --- /dev/null +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactBvhStructs.h @@ -0,0 +1,105 @@ +#ifndef GIM_BOX_SET_STRUCT_H_INCLUDED +#define GIM_BOX_SET_STRUCT_H_INCLUDED + +/*! \file gim_box_set.h +\author Francisco Leon Najera +*/ +/* +This source file is part of GIMPACT Library. + +For the latest info, see http://gimpact.sourceforge.net/ + +Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371. +email: projectileman@yahoo.com + + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +*/ + + +#include "LinearMath/btAlignedObjectArray.h" + +#include "btBoxCollision.h" +#include "btTriangleShapeEx.h" + +//! Overlapping pair +struct GIM_PAIR +{ + int m_index1; + int m_index2; + GIM_PAIR() + {} + + GIM_PAIR(const GIM_PAIR & p) + { + m_index1 = p.m_index1; + m_index2 = p.m_index2; + } + + GIM_PAIR(int index1, int index2) + { + m_index1 = index1; + m_index2 = index2; + } +}; + +///GIM_BVH_DATA is an internal GIMPACT collision structure to contain axis aligned bounding box +struct GIM_BVH_DATA +{ + btAABB m_bound; + int m_data; +}; + +//! Node Structure for trees +class GIM_BVH_TREE_NODE +{ +public: + btAABB m_bound; +protected: + int m_escapeIndexOrDataIndex; +public: + GIM_BVH_TREE_NODE() + { + m_escapeIndexOrDataIndex = 0; + } + + SIMD_FORCE_INLINE bool isLeafNode() const + { + //skipindex is negative (internal node), triangleindex >=0 (leafnode) + return (m_escapeIndexOrDataIndex>=0); + } + + SIMD_FORCE_INLINE int getEscapeIndex() const + { + //btAssert(m_escapeIndexOrDataIndex < 0); + return -m_escapeIndexOrDataIndex; + } + + SIMD_FORCE_INLINE void setEscapeIndex(int index) + { + m_escapeIndexOrDataIndex = -index; + } + + SIMD_FORCE_INLINE int getDataIndex() const + { + //btAssert(m_escapeIndexOrDataIndex >= 0); + + return m_escapeIndexOrDataIndex; + } + + SIMD_FORCE_INLINE void setDataIndex(int index) + { + m_escapeIndexOrDataIndex = index; + } + +}; + +#endif // GIM_BOXPRUNING_H_INCLUDED diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactQuantizedBvh.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactQuantizedBvh.h index e6e52fff4..42e5520fc 100644 --- a/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactQuantizedBvh.h +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactQuantizedBvh.h @@ -26,73 +26,7 @@ subject to the following restrictions: #include "btGImpactBvh.h" #include "btQuantization.h" - - - - - -///btQuantizedBvhNode is a compressed aabb node, 16 bytes. -///Node can be used for leafnode or internal node. Leafnodes can point to 32-bit triangle index (non-negative range). -ATTRIBUTE_ALIGNED16 (struct) BT_QUANTIZED_BVH_NODE -{ - //12 bytes - unsigned short int m_quantizedAabbMin[3]; - unsigned short int m_quantizedAabbMax[3]; - //4 bytes - int m_escapeIndexOrDataIndex; - - BT_QUANTIZED_BVH_NODE() - { - m_escapeIndexOrDataIndex = 0; - } - - SIMD_FORCE_INLINE bool isLeafNode() const - { - //skipindex is negative (internal node), triangleindex >=0 (leafnode) - return (m_escapeIndexOrDataIndex>=0); - } - - SIMD_FORCE_INLINE int getEscapeIndex() const - { - //btAssert(m_escapeIndexOrDataIndex < 0); - return -m_escapeIndexOrDataIndex; - } - - SIMD_FORCE_INLINE void setEscapeIndex(int index) - { - m_escapeIndexOrDataIndex = -index; - } - - SIMD_FORCE_INLINE int getDataIndex() const - { - //btAssert(m_escapeIndexOrDataIndex >= 0); - - return m_escapeIndexOrDataIndex; - } - - SIMD_FORCE_INLINE void setDataIndex(int index) - { - m_escapeIndexOrDataIndex = index; - } - - SIMD_FORCE_INLINE bool testQuantizedBoxOverlapp( - unsigned short * quantizedMin,unsigned short * quantizedMax) const - { - if(m_quantizedAabbMin[0] > quantizedMax[0] || - m_quantizedAabbMax[0] < quantizedMin[0] || - m_quantizedAabbMin[1] > quantizedMax[1] || - m_quantizedAabbMax[1] < quantizedMin[1] || - m_quantizedAabbMin[2] > quantizedMax[2] || - m_quantizedAabbMax[2] < quantizedMin[2]) - { - return false; - } - return true; - } - -}; - - +#include "btGImpactQuantizedBvhStructs.h" class GIM_QUANTIZED_BVH_NODE_ARRAY:public btAlignedObjectArray { @@ -368,5 +302,4 @@ public: btPairSet & collision_pairs); }; - #endif // GIM_BOXPRUNING_H_INCLUDED diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactQuantizedBvhStructs.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactQuantizedBvhStructs.h new file mode 100644 index 000000000..7dd5a1b9d --- /dev/null +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/btGImpactQuantizedBvhStructs.h @@ -0,0 +1,91 @@ +#ifndef GIM_QUANTIZED_SET_STRUCTS_H_INCLUDED +#define GIM_QUANTIZED_SET_STRUCTS_H_INCLUDED + +/*! \file btGImpactQuantizedBvh.h +\author Francisco Leon Najera +*/ +/* +This source file is part of GIMPACT Library. + +For the latest info, see http://gimpact.sourceforge.net/ + +Copyright (c) 2007 Francisco Leon Najera. C.C. 80087371. +email: projectileman@yahoo.com + + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +*/ + +#include "btGImpactBvh.h" +#include "btQuantization.h" + +///btQuantizedBvhNode is a compressed aabb node, 16 bytes. +///Node can be used for leafnode or internal node. Leafnodes can point to 32-bit triangle index (non-negative range). +ATTRIBUTE_ALIGNED16 (struct) BT_QUANTIZED_BVH_NODE +{ + //12 bytes + unsigned short int m_quantizedAabbMin[3]; + unsigned short int m_quantizedAabbMax[3]; + //4 bytes + int m_escapeIndexOrDataIndex; + + BT_QUANTIZED_BVH_NODE() + { + m_escapeIndexOrDataIndex = 0; + } + + SIMD_FORCE_INLINE bool isLeafNode() const + { + //skipindex is negative (internal node), triangleindex >=0 (leafnode) + return (m_escapeIndexOrDataIndex>=0); + } + + SIMD_FORCE_INLINE int getEscapeIndex() const + { + //btAssert(m_escapeIndexOrDataIndex < 0); + return -m_escapeIndexOrDataIndex; + } + + SIMD_FORCE_INLINE void setEscapeIndex(int index) + { + m_escapeIndexOrDataIndex = -index; + } + + SIMD_FORCE_INLINE int getDataIndex() const + { + //btAssert(m_escapeIndexOrDataIndex >= 0); + + return m_escapeIndexOrDataIndex; + } + + SIMD_FORCE_INLINE void setDataIndex(int index) + { + m_escapeIndexOrDataIndex = index; + } + + SIMD_FORCE_INLINE bool testQuantizedBoxOverlapp( + unsigned short * quantizedMin,unsigned short * quantizedMax) const + { + if(m_quantizedAabbMin[0] > quantizedMax[0] || + m_quantizedAabbMax[0] < quantizedMin[0] || + m_quantizedAabbMin[1] > quantizedMax[1] || + m_quantizedAabbMax[1] < quantizedMin[1] || + m_quantizedAabbMin[2] > quantizedMax[2] || + m_quantizedAabbMax[2] < quantizedMin[2]) + { + return false; + } + return true; + } + +}; + +#endif // GIM_QUANTIZED_SET_STRUCTS_H_INCLUDED diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_array.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_array.h index 27e6f32fc..cda51a5fc 100644 --- a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_array.h +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_array.h @@ -228,7 +228,7 @@ public: inline void push_back_memcpy(const T & obj) { this->growingCheck(); - irr_simd_memcpy(&m_data[m_size],&obj,sizeof(T)); + gim_simd_memcpy(&m_data[m_size],&obj,sizeof(T)); m_size++; } diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_basic_geometry_operations.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_basic_geometry_operations.h index d98051da3..0c48cb60f 100644 --- a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_basic_geometry_operations.h +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_basic_geometry_operations.h @@ -41,10 +41,13 @@ email: projectileman@yahoo.com - +#ifndef PLANEDIREPSILON #define PLANEDIREPSILON 0.0000001f -#define PARALELENORMALS 0.000001f +#endif +#ifndef PARALELENORMALS +#define PARALELENORMALS 0.000001f +#endif #define TRIANGLE_NORMAL(v1,v2,v3,n)\ {\ diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_box_collision.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_box_collision.h index 9c572638a..a051b4fdb 100644 --- a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_box_collision.h +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_box_collision.h @@ -97,6 +97,8 @@ email: projectileman@yahoo.com // return test_cross_edge_box(edge,absolute_edge,pointa,pointb,extend,1,0,0,1); //} +#ifndef TEST_CROSS_EDGE_BOX_MCR + #define TEST_CROSS_EDGE_BOX_MCR(edge,absolute_edge,pointa,pointb,_extend,i_dir_0,i_dir_1,i_comp_0,i_comp_1)\ {\ const btScalar dir0 = -edge[i_dir_0];\ @@ -113,6 +115,7 @@ email: projectileman@yahoo.com if(pmin>rad || -rad>pmax) return false;\ }\ +#endif #define TEST_CROSS_EDGE_BOX_X_AXIS_MCR(edge,absolute_edge,pointa,pointb,_extend)\ {\ @@ -190,8 +193,9 @@ public: } }; - +#ifndef BOX_PLANE_EPSILON #define BOX_PLANE_EPSILON 0.000001f +#endif //! Axis aligned box class GIM_AABB @@ -571,7 +575,7 @@ public: } }; - +#ifndef BT_BOX_COLLISION_H_INCLUDED //! Compairison of transformation objects SIMD_FORCE_INLINE bool btCompareTransformsEqual(const btTransform & t1,const btTransform & t2) { @@ -582,6 +586,7 @@ SIMD_FORCE_INLINE bool btCompareTransformsEqual(const btTransform & t1,const btT if(!(t1.getBasis().getRow(2) == t2.getBasis().getRow(2)) ) return false; return true; } +#endif diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_contact.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_contact.h index 5d9f8ef81..b41c714b5 100644 --- a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_contact.h +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_contact.h @@ -40,8 +40,15 @@ email: projectileman@yahoo.com /** Configuration var for applying interpolation of contact normals */ +#ifndef NORMAL_CONTACT_AVERAGE #define NORMAL_CONTACT_AVERAGE 1 +#endif + +#ifndef CONTACT_DIFF_EPSILON #define CONTACT_DIFF_EPSILON 0.00001f +#endif + +#ifndef BT_CONTACT_H_STRUCTS_INCLUDED /// Structure for collision results ///Functions for managing and sorting contacts resulting from a collision query. @@ -121,6 +128,7 @@ public: }; +#endif class gim_contact_array:public gim_array { diff --git a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_tri_collision.h b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_tri_collision.h index 5b552a1ed..267f806e7 100644 --- a/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_tri_collision.h +++ b/Engine/lib/bullet/src/BulletCollision/Gimpact/gim_tri_collision.h @@ -38,8 +38,9 @@ email: projectileman@yahoo.com - +#ifndef MAX_TRI_CLIPPING #define MAX_TRI_CLIPPING 16 +#endif //! Structure for collision struct GIM_TRIANGLE_CONTACT_DATA diff --git a/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h b/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h index 46ce1ab75..0ea7b483c 100644 --- a/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h +++ b/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h @@ -67,10 +67,12 @@ struct btStorageResult : public btDiscreteCollisionDetectorInterface::Result btVector3 m_closestPointInB; btScalar m_distance; //negative means penetration ! + protected: btStorageResult() : m_distance(btScalar(BT_LARGE_FLOAT)) { - } + + public: virtual ~btStorageResult() {}; virtual void addContactPoint(const btVector3& normalOnBInWorld,const btVector3& pointInWorld,btScalar depth) diff --git a/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h b/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h index 04ab54ed9..571ad2c5f 100644 --- a/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h +++ b/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btManifoldPoint.h @@ -41,6 +41,7 @@ enum btContactPointFlags BT_CONTACT_FLAG_HAS_CONTACT_CFM=2, BT_CONTACT_FLAG_HAS_CONTACT_ERP=4, BT_CONTACT_FLAG_CONTACT_STIFFNESS_DAMPING = 8, + BT_CONTACT_FLAG_FRICTION_ANCHOR = 16, }; /// ManifoldContactPoint collects and maintains persistent contactpoints. diff --git a/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp b/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp index 4d92e853d..23aaece22 100644 --- a/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp +++ b/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp @@ -21,6 +21,8 @@ subject to the following restrictions: btScalar gContactBreakingThreshold = btScalar(0.02); ContactDestroyedCallback gContactDestroyedCallback = 0; ContactProcessedCallback gContactProcessedCallback = 0; +ContactStartedCallback gContactStartedCallback = 0; +ContactEndedCallback gContactEndedCallback = 0; ///gContactCalcArea3Points will approximate the convex hull area using 3 points ///when setting it to false, it will use 4 points to compute the area: it is more accurate but slower bool gContactCalcArea3Points = true; @@ -279,6 +281,7 @@ void btPersistentManifold::refreshContactPoints(const btTransform& trA,const btT removeContactPoint(i); } else { + //todo: friction anchor may require the contact to be around a bit longer //contact also becomes invalid when relative movement orthogonal to normal exceeds margin projectedPoint = manifoldPoint.m_positionWorldOnA - manifoldPoint.m_normalWorldOnB * manifoldPoint.m_distance1; projectedDifference = manifoldPoint.m_positionWorldOnB - projectedPoint; diff --git a/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h b/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h index d220f2993..f872c8e1c 100644 --- a/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h +++ b/Engine/lib/bullet/src/BulletCollision/NarrowPhaseCollision/btPersistentManifold.h @@ -28,10 +28,18 @@ struct btCollisionResult; ///maximum contact breaking and merging threshold extern btScalar gContactBreakingThreshold; +#ifndef SWIG +class btPersistentManifold; + typedef bool (*ContactDestroyedCallback)(void* userPersistentData); typedef bool (*ContactProcessedCallback)(btManifoldPoint& cp,void* body0,void* body1); +typedef void (*ContactStartedCallback)(btPersistentManifold* const &manifold); +typedef void (*ContactEndedCallback)(btPersistentManifold* const &manifold); extern ContactDestroyedCallback gContactDestroyedCallback; extern ContactProcessedCallback gContactProcessedCallback; +extern ContactStartedCallback gContactStartedCallback; +extern ContactEndedCallback gContactEndedCallback; +#endif //SWIG //the enum starts at 1024 to avoid type conflicts with btTypedConstraint enum btContactManifoldTypes @@ -51,8 +59,8 @@ enum btContactManifoldTypes ///note that some pairs of objects might have more then one contact manifold. -ATTRIBUTE_ALIGNED128( class) btPersistentManifold : public btTypedObject -//ATTRIBUTE_ALIGNED16( class) btPersistentManifold : public btTypedObject +//ATTRIBUTE_ALIGNED128( class) btPersistentManifold : public btTypedObject +ATTRIBUTE_ALIGNED16( class) btPersistentManifold : public btTypedObject { btManifoldPoint m_pointCache[MANIFOLD_CACHE_SIZE]; @@ -171,40 +179,60 @@ public: btAssert(m_pointCache[lastUsedIndex].m_userPersistentData==0); m_cachedPoints--; + + if (gContactEndedCallback && m_cachedPoints == 0) + { + gContactEndedCallback(this); + } } - void replaceContactPoint(const btManifoldPoint& newPoint,int insertIndex) + void replaceContactPoint(const btManifoldPoint& newPoint, int insertIndex) { btAssert(validContactDistance(newPoint)); #define MAINTAIN_PERSISTENCY 1 #ifdef MAINTAIN_PERSISTENCY - int lifeTime = m_pointCache[insertIndex].getLifeTime(); - btScalar appliedImpulse = m_pointCache[insertIndex].m_appliedImpulse; - btScalar appliedLateralImpulse1 = m_pointCache[insertIndex].m_appliedImpulseLateral1; - btScalar appliedLateralImpulse2 = m_pointCache[insertIndex].m_appliedImpulseLateral2; -// bool isLateralFrictionInitialized = m_pointCache[insertIndex].m_lateralFrictionInitialized; - - - - btAssert(lifeTime>=0); - void* cache = m_pointCache[insertIndex].m_userPersistentData; - - m_pointCache[insertIndex] = newPoint; - m_pointCache[insertIndex].m_userPersistentData = cache; - m_pointCache[insertIndex].m_appliedImpulse = appliedImpulse; - m_pointCache[insertIndex].m_appliedImpulseLateral1 = appliedLateralImpulse1; - m_pointCache[insertIndex].m_appliedImpulseLateral2 = appliedLateralImpulse2; - + int lifeTime = m_pointCache[insertIndex].getLifeTime(); + btScalar appliedImpulse = m_pointCache[insertIndex].m_appliedImpulse; + btScalar appliedLateralImpulse1 = m_pointCache[insertIndex].m_appliedImpulseLateral1; + btScalar appliedLateralImpulse2 = m_pointCache[insertIndex].m_appliedImpulseLateral2; + + bool replacePoint = true; + ///we keep existing contact points for friction anchors + ///if the friction force is within the Coulomb friction cone + if (newPoint.m_contactPointFlags & BT_CONTACT_FLAG_FRICTION_ANCHOR) + { + // printf("appliedImpulse=%f\n", appliedImpulse); + // printf("appliedLateralImpulse1=%f\n", appliedLateralImpulse1); + // printf("appliedLateralImpulse2=%f\n", appliedLateralImpulse2); + // printf("mu = %f\n", m_pointCache[insertIndex].m_combinedFriction); + btScalar mu = m_pointCache[insertIndex].m_combinedFriction; + btScalar eps = 0; //we could allow to enlarge or shrink the tolerance to check against the friction cone a bit, say 1e-7 + btScalar a = appliedLateralImpulse1 * appliedLateralImpulse1 + appliedLateralImpulse2 * appliedLateralImpulse2; + btScalar b = eps + mu * appliedImpulse; + b = b * b; + replacePoint = (a) > (b); + } + + if (replacePoint) + { + btAssert(lifeTime >= 0); + void* cache = m_pointCache[insertIndex].m_userPersistentData; + + m_pointCache[insertIndex] = newPoint; + m_pointCache[insertIndex].m_userPersistentData = cache; + m_pointCache[insertIndex].m_appliedImpulse = appliedImpulse; + m_pointCache[insertIndex].m_appliedImpulseLateral1 = appliedLateralImpulse1; + m_pointCache[insertIndex].m_appliedImpulseLateral2 = appliedLateralImpulse2; + } m_pointCache[insertIndex].m_lifeTime = lifeTime; #else clearUserCache(m_pointCache[insertIndex]); m_pointCache[insertIndex] = newPoint; - + #endif } - bool validContactDistance(const btManifoldPoint& pt) const { return pt.m_distance1 <= getContactBreakingThreshold(); @@ -220,6 +248,11 @@ public: { clearUserCache(m_pointCache[i]); } + + if (gContactEndedCallback && m_cachedPoints) + { + gContactEndedCallback(this); + } m_cachedPoints = 0; } diff --git a/Engine/lib/bullet/src/BulletDynamics/CMakeLists.txt b/Engine/lib/bullet/src/BulletDynamics/CMakeLists.txt index 4023d721e..f8a6f34ba 100644 --- a/Engine/lib/bullet/src/BulletDynamics/CMakeLists.txt +++ b/Engine/lib/bullet/src/BulletDynamics/CMakeLists.txt @@ -37,6 +37,7 @@ SET(BulletDynamics_SRCS Featherstone/btMultiBodyFixedConstraint.cpp Featherstone/btMultiBodySliderConstraint.cpp Featherstone/btMultiBodyJointMotor.cpp + Featherstone/btMultiBodyGearConstraint.cpp MLCPSolvers/btDantzigLCP.cpp MLCPSolvers/btMLCPSolver.cpp MLCPSolvers/btLemkeAlgorithm.cpp @@ -98,6 +99,7 @@ SET(Featherstone_HDRS Featherstone/btMultiBodyFixedConstraint.h Featherstone/btMultiBodySliderConstraint.h Featherstone/btMultiBodyJointMotor.h + Featherstone/btMultiBodyGearConstraint.h ) SET(MLCPSolvers_HDRS diff --git a/Engine/lib/bullet/src/BulletDynamics/Character/btKinematicCharacterController.cpp b/Engine/lib/bullet/src/BulletDynamics/Character/btKinematicCharacterController.cpp index 68fa5206c..cb1aa71a1 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Character/btKinematicCharacterController.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Character/btKinematicCharacterController.cpp @@ -137,8 +137,6 @@ btKinematicCharacterController::btKinematicCharacterController (btPairCachingGho m_ghostObject = ghostObject; m_up.setValue(0.0f, 0.0f, 1.0f); m_jumpAxis.setValue(0.0f, 0.0f, 1.0f); - setUp(up); - setStepHeight(stepHeight); m_addedMargin = 0.02; m_walkDirection.setValue(0.0,0.0,0.0); m_AngVel.setValue(0.0, 0.0, 0.0); @@ -156,13 +154,16 @@ btKinematicCharacterController::btKinematicCharacterController (btPairCachingGho m_wasOnGround = false; m_wasJumping = false; m_interpolateUp = true; - setMaxSlope(btRadians(45.0)); m_currentStepOffset = 0.0; m_maxPenetrationDepth = 0.2; full_drop = false; bounce_fix = false; m_linearDamping = btScalar(0.0); m_angularDamping = btScalar(0.0); + + setUp(up); + setStepHeight(stepHeight); + setMaxSlope(btRadians(45.0)); } btKinematicCharacterController::~btKinematicCharacterController () @@ -559,7 +560,7 @@ void btKinematicCharacterController::stepDown ( btCollisionWorld* collisionWorld break; } - if (m_ghostObject->hasContactResponse() && (callback.hasHit() && needsCollision(m_ghostObject, callback.m_hitCollisionObject)) || runonce == true) + if ((m_ghostObject->hasContactResponse() && (callback.hasHit() && needsCollision(m_ghostObject, callback.m_hitCollisionObject))) || runonce == true) { // we dropped a fraction of the height -> hit floor btScalar fraction = (m_currentPosition.getY() - callback.m_hitPointWorld.getY()) / 2; @@ -657,7 +658,7 @@ void btKinematicCharacterController::setLinearVelocity(const btVector3& velocity if (c != 0) { //there is a component in walkdirection for vertical velocity - btVector3 upComponent = m_up * (sinf(SIMD_HALF_PI - acosf(c)) * m_walkDirection.length()); + btVector3 upComponent = m_up * (btSin(SIMD_HALF_PI - btAcos(c)) * m_walkDirection.length()); m_walkDirection -= upComponent; m_verticalVelocity = (c < 0.0f ? -1 : 1) * upComponent.length(); @@ -751,7 +752,7 @@ void btKinematicCharacterController::playerStep ( btCollisionWorld* collisionWo m_wasOnGround = onGround(); //btVector3 lvel = m_walkDirection; - btScalar c = 0.0f; + //btScalar c = 0.0f; if (m_walkDirection.length2() > 0) { diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp index 09b7388b6..0572256f7 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp @@ -642,7 +642,7 @@ void btConeTwistConstraint::calcAngleInfo2(const btTransform& transA, const btTr btTransform trDeltaAB = trB * trPose * trA.inverse(); btQuaternion qDeltaAB = trDeltaAB.getRotation(); btVector3 swingAxis = btVector3(qDeltaAB.x(), qDeltaAB.y(), qDeltaAB.z()); - float swingAxisLen2 = swingAxis.length2(); + btScalar swingAxisLen2 = swingAxis.length2(); if(btFuzzyZero(swingAxisLen2)) { return; @@ -903,7 +903,7 @@ btVector3 btConeTwistConstraint::GetPointForAngle(btScalar fAngleInRadians, btSc // a^2 b^2 // Do the math and it should be clear. - float swingLimit = m_swingSpan1; // if xEllipse == 0, just use axis b (1) + btScalar swingLimit = m_swingSpan1; // if xEllipse == 0, just use axis b (1) if (fabs(xEllipse) > SIMD_EPSILON) { btScalar surfaceSlope2 = (yEllipse*yEllipse)/(xEllipse*xEllipse); diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h index b7636180c..7a33d01d1 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btConeTwistConstraint.h @@ -260,7 +260,7 @@ public: inline int getSolveSwingLimit() { - return m_solveTwistLimit; + return m_solveSwingLimit; } inline btScalar getTwistLimitSign() diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btContactConstraint.h b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btContactConstraint.h index 477c79d17..adb226835 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btContactConstraint.h +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btContactConstraint.h @@ -28,11 +28,13 @@ protected: btPersistentManifold m_contactManifold; -public: +protected: btContactConstraint(btPersistentManifold* contactManifold,btRigidBody& rbA,btRigidBody& rbB); +public: + void setContactManifold(btPersistentManifold* contactManifold); btPersistentManifold* getContactManifold() diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btContactSolverInfo.h b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btContactSolverInfo.h index 739b066fe..28d0c1dd4 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btContactSolverInfo.h +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btContactSolverInfo.h @@ -43,10 +43,13 @@ struct btContactSolverInfoData btScalar m_restitution; int m_numIterations; btScalar m_maxErrorReduction; - btScalar m_sor; - btScalar m_erp;//used as Baumgarte factor - btScalar m_erp2;//used in Split Impulse - btScalar m_globalCfm;//constraint force mixing + btScalar m_sor;//successive over-relaxation term + btScalar m_erp;//error reduction for non-contact constraints + btScalar m_erp2;//error reduction for contact constraints + btScalar m_globalCfm;//constraint force mixing for contacts and non-contacts + btScalar m_frictionERP;//error reduction for friction constraints + btScalar m_frictionCFM;//constraint force mixing for friction constraints + int m_splitImpulse; btScalar m_splitImpulsePenetrationThreshold; btScalar m_splitImpulseTurnErp; @@ -59,6 +62,7 @@ struct btContactSolverInfoData btScalar m_maxGyroscopicForce; btScalar m_singleAxisRollingFrictionThreshold; btScalar m_leastSquaresResidualThreshold; + btScalar m_restitutionVelocityThreshold; }; @@ -79,6 +83,8 @@ struct btContactSolverInfo : public btContactSolverInfoData m_erp = btScalar(0.2); m_erp2 = btScalar(0.2); m_globalCfm = btScalar(0.); + m_frictionERP = btScalar(0.2);//positional friction 'anchors' are disabled by default + m_frictionCFM = btScalar(0.); m_sor = btScalar(1.); m_splitImpulse = true; m_splitImpulsePenetrationThreshold = -.04f; @@ -92,6 +98,7 @@ struct btContactSolverInfo : public btContactSolverInfoData m_maxGyroscopicForce = 100.f; ///it is only used for 'explicit' version of gyroscopic force m_singleAxisRollingFrictionThreshold = 1e30f;///if the velocity is above this threshold, it will use a single constraint row (axis), otherwise 3 rows. m_leastSquaresResidualThreshold = 0.f; + m_restitutionVelocityThreshold = 0.2f;//if the relative velocity is below this threshold, there is zero restitution } }; diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGearConstraint.h b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGearConstraint.h index f9afcb912..e4613455a 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGearConstraint.h +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGearConstraint.h @@ -141,6 +141,14 @@ SIMD_FORCE_INLINE const char* btGearConstraint::serialize(void* dataBuffer, btSe gear->m_ratio = m_ratio; + // Fill padding with zeros to appease msan. +#ifndef BT_USE_DOUBLE_PRECISION + gear->m_padding[0] = 0; + gear->m_padding[1] = 0; + gear->m_padding[2] = 0; + gear->m_padding[3] = 0; +#endif + return btGearConstraintDataName; } diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp index bc2b5a85d..fa17254ec 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp @@ -776,7 +776,7 @@ int btGeneric6DofConstraint::get_limit_motor_info2( btConstraintInfo2 *info, int row, btVector3& ax1, int rotational,int rotAllowed) { int srow = row * info->rowskip; - int powered = limot->m_enableMotor; + bool powered = limot->m_enableMotor; int limit = limot->m_currentLimit; if (powered || limit) { // if the joint is powered, or has joint limits, add in the extra row @@ -840,7 +840,7 @@ int btGeneric6DofConstraint::get_limit_motor_info2( } // if we're limited low and high simultaneously, the joint motor is // ineffective - if (limit && (limot->m_loLimit == limot->m_hiLimit)) powered = 0; + if (limit && (limot->m_loLimit == limot->m_hiLimit)) powered = false; info->m_constraintError[srow] = btScalar(0.f); if (powered) { diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.cpp b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.cpp index 49ff78c26..f0976ee49 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.cpp @@ -729,6 +729,21 @@ int btGeneric6DofSpring2Constraint::get_limit_motor_info2( if (limot->m_enableMotor && limot->m_servoMotor) { btScalar error = limot->m_currentPosition - limot->m_servoTarget; + btScalar curServoTarget = limot->m_servoTarget; + if (rotational) + { + if (error > SIMD_PI) + { + error -= SIMD_2_PI; + curServoTarget +=SIMD_2_PI; + } + if (error < -SIMD_PI) + { + error += SIMD_2_PI; + curServoTarget -=SIMD_2_PI; + } + } + calculateJacobi(limot,transA,transB,info,srow,ax1,rotational,rotAllowed); btScalar targetvelocity = error<0 ? -limot->m_targetVelocity : limot->m_targetVelocity; btScalar tag_vel = -targetvelocity; @@ -739,13 +754,13 @@ int btGeneric6DofSpring2Constraint::get_limit_motor_info2( btScalar hiLimit; if(limot->m_loLimit > limot->m_hiLimit) { - lowLimit = error > 0 ? limot->m_servoTarget : -SIMD_INFINITY; - hiLimit = error < 0 ? limot->m_servoTarget : SIMD_INFINITY; + lowLimit = error > 0 ? curServoTarget : -SIMD_INFINITY; + hiLimit = error < 0 ? curServoTarget : SIMD_INFINITY; } else { - lowLimit = error > 0 && limot->m_servoTarget>limot->m_loLimit ? limot->m_servoTarget : limot->m_loLimit; - hiLimit = error < 0 && limot->m_servoTargetm_hiLimit ? limot->m_servoTarget : limot->m_hiLimit; + lowLimit = error > 0 && curServoTarget>limot->m_loLimit ? curServoTarget : limot->m_loLimit; + hiLimit = error < 0 && curServoTargetm_hiLimit ? curServoTarget : limot->m_hiLimit; } mot_fact = getMotorFactor(limot->m_currentPosition, lowLimit, hiLimit, tag_vel, info->fps * limot->m_motorERP); } @@ -998,13 +1013,49 @@ void btGeneric6DofSpring2Constraint::setTargetVelocity(int index, btScalar veloc m_angularLimits[index - 3].m_targetVelocity = velocity; } -void btGeneric6DofSpring2Constraint::setServoTarget(int index, btScalar target) + + +void btGeneric6DofSpring2Constraint::setServoTarget(int index, btScalar targetOrg) { btAssert((index >= 0) && (index < 6)); if (index<3) - m_linearLimits.m_servoTarget[index] = target; + { + m_linearLimits.m_servoTarget[index] = targetOrg; + } else + { + //wrap between -PI and PI, see also + //https://stackoverflow.com/questions/4633177/c-how-to-wrap-a-float-to-the-interval-pi-pi + + btScalar target = targetOrg+SIMD_PI; + if (1) + { + btScalar m = target - SIMD_2_PI * floor(target/SIMD_2_PI); + // handle boundary cases resulted from floating-point cut off: + { + if (m>=SIMD_2_PI) + { + target = 0; + } else + { + if (m<0 ) + { + if (SIMD_2_PI+m == SIMD_2_PI) + target = 0; + else + target = SIMD_2_PI+m; + } + else + { + target = m; + } + } + } + target -= SIMD_PI; + } + m_angularLimits[index - 3].m_servoTarget = target; + } } void btGeneric6DofSpring2Constraint::setMaxMotorForce(int index, btScalar force) diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h index 193e51e3b..66d176958 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btGeneric6DofSpring2Constraint.h @@ -664,6 +664,11 @@ SIMD_FORCE_INLINE const char* btGeneric6DofSpring2Constraint::serialize(void* da dof->m_rotateOrder = m_rotateOrder; + dof->m_padding1[0] = 0; + dof->m_padding1[1] = 0; + dof->m_padding1[2] = 0; + dof->m_padding1[3] = 0; + return btGeneric6DofSpring2ConstraintDataName; } diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp index 76a150947..7e5e6f9e5 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.cpp @@ -556,12 +556,8 @@ void btHingeConstraint::getInfo2Internal(btConstraintInfo2* info, const btTransf } // if the hinge has joint limits or motor, add in the extra row - int powered = 0; - if(getEnableAngularMotor()) - { - powered = 1; - } - if(limit || powered) + bool powered = getEnableAngularMotor(); + if(limit || powered) { nrow++; srow = nrow * info->rowskip; @@ -577,7 +573,7 @@ void btHingeConstraint::getInfo2Internal(btConstraintInfo2* info, const btTransf btScalar histop = getUpperLimit(); if(limit && (lostop == histop)) { // the joint motor is ineffective - powered = 0; + powered = false; } info->m_constraintError[srow] = btScalar(0.0f); btScalar currERP = (m_flags & BT_HINGE_FLAGS_ERP_STOP) ? m_stopERP : normalErp; @@ -951,12 +947,8 @@ void btHingeConstraint::getInfo2InternalUsingFrameOffset(btConstraintInfo2* info } // if the hinge has joint limits or motor, add in the extra row - int powered = 0; - if(getEnableAngularMotor()) - { - powered = 1; - } - if(limit || powered) + bool powered = getEnableAngularMotor(); + if(limit || powered) { nrow++; srow = nrow * info->rowskip; @@ -972,7 +964,7 @@ void btHingeConstraint::getInfo2InternalUsingFrameOffset(btConstraintInfo2* info btScalar histop = getUpperLimit(); if(limit && (lostop == histop)) { // the joint motor is ineffective - powered = 0; + powered = false; } info->m_constraintError[srow] = btScalar(0.0f); btScalar currERP = (m_flags & BT_HINGE_FLAGS_ERP_STOP) ? m_stopERP : normalErp; diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h index f26e72105..3c3df24db 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btHingeConstraint.h @@ -314,7 +314,7 @@ public: { return m_enableAngularMotor; } - inline btScalar getMotorTargetVelosity() + inline btScalar getMotorTargetVelocity() { return m_motorTargetVelocity; } @@ -489,6 +489,14 @@ SIMD_FORCE_INLINE const char* btHingeConstraint::serialize(void* dataBuffer, btS hingeData->m_relaxationFactor = float(m_relaxationFactor); #endif + // Fill padding with zeros to appease msan. +#ifdef BT_USE_DOUBLE_PRECISION + hingeData->m_padding1[0] = 0; + hingeData->m_padding1[1] = 0; + hingeData->m_padding1[2] = 0; + hingeData->m_padding1[3] = 0; +#endif + return btHingeConstraintDataName; } diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btNNCGConstraintSolver.cpp b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btNNCGConstraintSolver.cpp index f110cd480..f3979be35 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btNNCGConstraintSolver.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btNNCGConstraintSolver.cpp @@ -78,20 +78,6 @@ btScalar btNNCGConstraintSolver::solveSingleIteration(int iteration, btCollision btScalar deltaflengthsqr = 0; - - if (infoGlobal.m_solverMode & SOLVER_SIMD) - { - for (int j=0;jisEnabled()) - { - int bodyAid = getOrInitSolverBody(constraints[j]->getRigidBodyA(),infoGlobal.m_timeStep); - int bodyBid = getOrInitSolverBody(constraints[j]->getRigidBodyB(),infoGlobal.m_timeStep); - btSolverBody& bodyA = m_tmpSolverBodyPool[bodyAid]; - btSolverBody& bodyB = m_tmpSolverBodyPool[bodyBid]; - constraints[j]->solveConstraintObsolete(bodyA,bodyB,infoGlobal.m_timeStep); - } - } - ///solve all contact constraints - int numPoolConstraints = m_tmpSolverContactConstraintPool.size(); - for (int j=0;jbtScalar(0)) - { - solveManifold.m_lowerLimit = -(solveManifold.m_friction*totalImpulse); - solveManifold.m_upperLimit = solveManifold.m_friction*totalImpulse; - - btScalar deltaf = resolveSingleConstraintRowGeneric(m_tmpSolverBodyPool[solveManifold.m_solverBodyIdA],m_tmpSolverBodyPool[solveManifold.m_solverBodyIdB],solveManifold); - m_deltafCF[j] = deltaf; - deltaflengthsqr += deltaf*deltaf; - } else { - m_deltafCF[j] = 0; - } - } - - int numRollingFrictionPoolConstraints = m_tmpSolverContactRollingFrictionConstraintPool.size(); - for (int j=0;jbtScalar(0)) - { - btScalar rollingFrictionMagnitude = rollingFrictionConstraint.m_friction*totalImpulse; - if (rollingFrictionMagnitude>rollingFrictionConstraint.m_friction) - rollingFrictionMagnitude = rollingFrictionConstraint.m_friction; - - rollingFrictionConstraint.m_lowerLimit = -rollingFrictionMagnitude; - rollingFrictionConstraint.m_upperLimit = rollingFrictionMagnitude; - - btScalar deltaf = resolveSingleConstraintRowGeneric(m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdA],m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdB],rollingFrictionConstraint); - m_deltafCRF[j] = deltaf; - deltaflengthsqr += deltaf*deltaf; - } else { - m_deltafCRF[j] = 0; - } - } - } } @@ -362,10 +278,7 @@ btScalar btNNCGConstraintSolver::solveSingleIteration(int iteration, btCollision for (int j=0;jgetWorldTransform().getOrigin(); rel_pos2 = pos2 - colObj1->getWorldTransform().getOrigin(); - btVector3 vel1;// = rb0 ? rb0->getVelocityInLocalPoint(rel_pos1) : btVector3(0,0,0); - btVector3 vel2;// = rb1 ? rb1->getVelocityInLocalPoint(rel_pos2) : btVector3(0,0,0); - + btVector3 vel1; + btVector3 vel2; + solverBodyA->getVelocityInLocalPointNoDelta(rel_pos1,vel1); solverBodyB->getVelocityInLocalPointNoDelta(rel_pos2,vel2 ); @@ -1126,8 +1140,6 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m -// const btVector3& pos1 = cp.getPositionWorldOnA(); -// const btVector3& pos2 = cp.getPositionWorldOnB(); /////setup the friction constraints @@ -1172,6 +1184,7 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m ///In that case, you can set the target relative motion in each friction direction (cp.m_contactMotion1 and cp.m_contactMotion2) ///this will give a conveyor belt effect /// + if (!(infoGlobal.m_solverMode & SOLVER_ENABLE_FRICTION_DIRECTION_CACHING) || !(cp.m_contactPointFlags&BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED)) { cp.m_lateralFrictionDir1 = vel - cp.m_normalWorldOnB * rel_vel; @@ -1181,7 +1194,7 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m cp.m_lateralFrictionDir1 *= 1.f/btSqrt(lat_rel_vel); applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1,btCollisionObject::CF_ANISOTROPIC_FRICTION); applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1,btCollisionObject::CF_ANISOTROPIC_FRICTION); - addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation); + addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation,infoGlobal); if((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS)) { @@ -1189,7 +1202,7 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m cp.m_lateralFrictionDir2.normalize();//?? applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir2,btCollisionObject::CF_ANISOTROPIC_FRICTION); applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir2,btCollisionObject::CF_ANISOTROPIC_FRICTION); - addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation); + addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation, infoGlobal); } } else @@ -1198,13 +1211,13 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1,btCollisionObject::CF_ANISOTROPIC_FRICTION); applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1,btCollisionObject::CF_ANISOTROPIC_FRICTION); - addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation); + addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation, infoGlobal); if ((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS)) { applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir2,btCollisionObject::CF_ANISOTROPIC_FRICTION); applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir2,btCollisionObject::CF_ANISOTROPIC_FRICTION); - addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation); + addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation, infoGlobal); } @@ -1216,10 +1229,10 @@ void btSequentialImpulseConstraintSolver::convertContact(btPersistentManifold* m } else { - addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation,cp.m_contactMotion1, cp.m_frictionCFM); + addFrictionConstraint(cp.m_lateralFrictionDir1,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation, infoGlobal, cp.m_contactMotion1, cp.m_frictionCFM); if ((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS)) - addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation, cp.m_contactMotion2, cp.m_frictionCFM); + addFrictionConstraint(cp.m_lateralFrictionDir2,solverBodyIdA,solverBodyIdB,frictionIndex,cp,rel_pos1,rel_pos2,colObj0,colObj1, relaxation, infoGlobal, cp.m_contactMotion2, cp.m_frictionCFM); } setFrictionConstraintImpulse( solverConstraint, solverBodyIdA, solverBodyIdB, cp, infoGlobal); @@ -1251,6 +1264,14 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCol BT_PROFILE("solveGroupCacheFriendlySetup"); (void)debugDrawer; + // if solver mode has changed, + if ( infoGlobal.m_solverMode != m_cachedSolverMode ) + { + // update solver functions to use SIMD or non-SIMD + bool useSimd = !!( infoGlobal.m_solverMode & SOLVER_SIMD ); + setupSolverFunctions( useSimd ); + m_cachedSolverMode = infoGlobal.m_solverMode; + } m_maxOverrideNumSolverIterations = 0; #ifdef BT_ADDITIONAL_DEBUG @@ -1530,7 +1551,8 @@ btScalar btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySetup(btCol sum += iMJaB.dot(solverConstraint.m_relpos2CrossNormal); btScalar fsum = btFabs(sum); btAssert(fsum > SIMD_EPSILON); - solverConstraint.m_jacDiagABInv = fsum>SIMD_EPSILON?btScalar(1.)/sum : 0.f; + btScalar sorRelaxation = 1.f;//todo: get from globalInfo? + solverConstraint.m_jacDiagABInv = fsum>SIMD_EPSILON?sorRelaxation/sum : 0.f; } @@ -1646,145 +1668,6 @@ btScalar btSequentialImpulseConstraintSolver::solveSingleIteration(int iteration } } - if (infoGlobal.m_solverMode & SOLVER_SIMD) - { - ///solve all joint constraints, using SIMD, if available - for (int j=0;jisEnabled()) - { - int bodyAid = getOrInitSolverBody(constraints[j]->getRigidBodyA(),infoGlobal.m_timeStep); - int bodyBid = getOrInitSolverBody(constraints[j]->getRigidBodyB(),infoGlobal.m_timeStep); - btSolverBody& bodyA = m_tmpSolverBodyPool[bodyAid]; - btSolverBody& bodyB = m_tmpSolverBodyPool[bodyBid]; - constraints[j]->solveConstraintObsolete(bodyA,bodyB,infoGlobal.m_timeStep); - } - } - - ///solve all contact constraints using SIMD, if available - if (infoGlobal.m_solverMode & SOLVER_INTERLEAVE_CONTACT_AND_FRICTION_CONSTRAINTS) - { - int numPoolConstraints = m_tmpSolverContactConstraintPool.size(); - int multiplier = (infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS)? 2 : 1; - - for (int c=0;cbtScalar(0)) - { - solveManifold.m_lowerLimit = -(solveManifold.m_friction*totalImpulse); - solveManifold.m_upperLimit = solveManifold.m_friction*totalImpulse; - - btScalar residual = resolveSingleConstraintRowGenericSIMD(m_tmpSolverBodyPool[solveManifold.m_solverBodyIdA],m_tmpSolverBodyPool[solveManifold.m_solverBodyIdB],solveManifold); - leastSquaresResidual += residual*residual; - } - } - - if (infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS) - { - - btSolverConstraint& solveManifold = m_tmpSolverContactFrictionConstraintPool[m_orderFrictionConstraintPool[c*multiplier+1]]; - - if (totalImpulse>btScalar(0)) - { - solveManifold.m_lowerLimit = -(solveManifold.m_friction*totalImpulse); - solveManifold.m_upperLimit = solveManifold.m_friction*totalImpulse; - - btScalar residual = resolveSingleConstraintRowGenericSIMD(m_tmpSolverBodyPool[solveManifold.m_solverBodyIdA],m_tmpSolverBodyPool[solveManifold.m_solverBodyIdB],solveManifold); - leastSquaresResidual += residual*residual; - } - } - } - } - - } - else//SOLVER_INTERLEAVE_CONTACT_AND_FRICTION_CONSTRAINTS - { - //solve the friction constraints after all contact constraints, don't interleave them - int numPoolConstraints = m_tmpSolverContactConstraintPool.size(); - int j; - - for (j=0;jbtScalar(0)) - { - solveManifold.m_lowerLimit = -(solveManifold.m_friction*totalImpulse); - solveManifold.m_upperLimit = solveManifold.m_friction*totalImpulse; - - btScalar residual = resolveSingleConstraintRowGenericSIMD(m_tmpSolverBodyPool[solveManifold.m_solverBodyIdA],m_tmpSolverBodyPool[solveManifold.m_solverBodyIdB],solveManifold); - leastSquaresResidual += residual*residual; - } - } - - - int numRollingFrictionPoolConstraints = m_tmpSolverContactRollingFrictionConstraintPool.size(); - for (j=0;jbtScalar(0)) - { - btScalar rollingFrictionMagnitude = rollingFrictionConstraint.m_friction*totalImpulse; - if (rollingFrictionMagnitude>rollingFrictionConstraint.m_friction) - rollingFrictionMagnitude = rollingFrictionConstraint.m_friction; - - rollingFrictionConstraint.m_lowerLimit = -rollingFrictionMagnitude; - rollingFrictionConstraint.m_upperLimit = rollingFrictionMagnitude; - - btScalar residual = resolveSingleConstraintRowGenericSIMD(m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdA],m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdB],rollingFrictionConstraint); - leastSquaresResidual += residual*residual; - } - } - - - } - } - } else - { - //non-SIMD version ///solve all joint constraints for (int j=0;jsolveConstraintObsolete(bodyA,bodyB,infoGlobal.m_timeStep); } } + ///solve all contact constraints - int numPoolConstraints = m_tmpSolverContactConstraintPool.size(); - for (int j=0;jbtScalar(0)) + for (int c=0;cbtScalar(0)) + { + solveManifold.m_lowerLimit = -(solveManifold.m_friction*totalImpulse); + solveManifold.m_upperLimit = solveManifold.m_friction*totalImpulse; + + btScalar residual = resolveSingleConstraintRowGeneric(m_tmpSolverBodyPool[solveManifold.m_solverBodyIdA],m_tmpSolverBodyPool[solveManifold.m_solverBodyIdB],solveManifold); + leastSquaresResidual += residual*residual; + } + } + + if (infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS) + { + + btSolverConstraint& solveManifold = m_tmpSolverContactFrictionConstraintPool[m_orderFrictionConstraintPool[c*multiplier+1]]; + + if (totalImpulse>btScalar(0)) + { + solveManifold.m_lowerLimit = -(solveManifold.m_friction*totalImpulse); + solveManifold.m_upperLimit = solveManifold.m_friction*totalImpulse; + + btScalar residual = resolveSingleConstraintRowGeneric(m_tmpSolverBodyPool[solveManifold.m_solverBodyIdA],m_tmpSolverBodyPool[solveManifold.m_solverBodyIdB],solveManifold); + leastSquaresResidual += residual*residual; + } + } + } + } + + } + else//SOLVER_INTERLEAVE_CONTACT_AND_FRICTION_CONSTRAINTS + { + //solve the friction constraints after all contact constraints, don't interleave them + int numPoolConstraints = m_tmpSolverContactConstraintPool.size(); + int j; + + for (j=0;jbtScalar(0)) + { + solveManifold.m_lowerLimit = -(solveManifold.m_friction*totalImpulse); + solveManifold.m_upperLimit = solveManifold.m_friction*totalImpulse; + + btScalar residual = resolveSingleConstraintRowGeneric(m_tmpSolverBodyPool[solveManifold.m_solverBodyIdA],m_tmpSolverBodyPool[solveManifold.m_solverBodyIdB],solveManifold); + leastSquaresResidual += residual*residual; + } + } } - int numRollingFrictionPoolConstraints = m_tmpSolverContactRollingFrictionConstraintPool.size(); - for (int j=0;jbtScalar(0)) + + int numRollingFrictionPoolConstraints = m_tmpSolverContactRollingFrictionConstraintPool.size(); + for (int j=0;jrollingFrictionConstraint.m_friction) - rollingFrictionMagnitude = rollingFrictionConstraint.m_friction; - rollingFrictionConstraint.m_lowerLimit = -rollingFrictionMagnitude; - rollingFrictionConstraint.m_upperLimit = rollingFrictionMagnitude; + btSolverConstraint& rollingFrictionConstraint = m_tmpSolverContactRollingFrictionConstraintPool[j]; + btScalar totalImpulse = m_tmpSolverContactConstraintPool[rollingFrictionConstraint.m_frictionIndex].m_appliedImpulse; + if (totalImpulse>btScalar(0)) + { + btScalar rollingFrictionMagnitude = rollingFrictionConstraint.m_friction*totalImpulse; + if (rollingFrictionMagnitude>rollingFrictionConstraint.m_friction) + rollingFrictionMagnitude = rollingFrictionConstraint.m_friction; - btScalar residual = resolveSingleConstraintRowGeneric(m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdA],m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdB],rollingFrictionConstraint); - leastSquaresResidual += residual*residual; + rollingFrictionConstraint.m_lowerLimit = -rollingFrictionMagnitude; + rollingFrictionConstraint.m_upperLimit = rollingFrictionMagnitude; + + btScalar residual = resolveSingleConstraintRowGeneric(m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdA],m_tmpSolverBodyPool[rollingFrictionConstraint.m_solverBodyIdB],rollingFrictionConstraint); + leastSquaresResidual += residual*residual; + } } - } + + } - } return leastSquaresResidual; } @@ -1863,7 +1811,6 @@ void btSequentialImpulseConstraintSolver::solveGroupCacheFriendlySplitImpulseIte int iteration; if (infoGlobal.m_splitImpulse) { - if (infoGlobal.m_solverMode & SOLVER_SIMD) { for ( iteration = 0;iteration=(infoGlobal.m_numIterations-1)) - { -#ifdef VERBOSE_RESIDUAL_PRINTF - printf("residual = %f at iteration #%d\n",leastSquaresResidual,iteration); -#endif - break; - } - } - } - } + } } } diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h index 0dd31d142..16c7eb74c 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h @@ -56,12 +56,16 @@ protected: btSingleConstraintRowSolver m_resolveSingleConstraintRowGeneric; btSingleConstraintRowSolver m_resolveSingleConstraintRowLowerLimit; + btSingleConstraintRowSolver m_resolveSplitPenetrationImpulse; + int m_cachedSolverMode; // used to check if SOLVER_SIMD flag has been changed + void setupSolverFunctions( bool useSimd ); btScalar m_leastSquaresResidual; void setupFrictionConstraint( btSolverConstraint& solverConstraint, const btVector3& normalAxis,int solverBodyIdA,int solverBodyIdB, btManifoldPoint& cp,const btVector3& rel_pos1,const btVector3& rel_pos2, btCollisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation, + const btContactSolverInfo& infoGlobal, btScalar desiredVelocity=0., btScalar cfmSlip=0.); void setupTorsionalFrictionConstraint( btSolverConstraint& solverConstraint, const btVector3& normalAxis,int solverBodyIdA,int solverBodyIdB, @@ -69,7 +73,7 @@ protected: btCollisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation, btScalar desiredVelocity=0., btScalar cfmSlip=0.); - btSolverConstraint& addFrictionConstraint(const btVector3& normalAxis,int solverBodyIdA,int solverBodyIdB,int frictionIndex,btManifoldPoint& cp,const btVector3& rel_pos1,const btVector3& rel_pos2,btCollisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation, btScalar desiredVelocity=0., btScalar cfmSlip=0.); + btSolverConstraint& addFrictionConstraint(const btVector3& normalAxis,int solverBodyIdA,int solverBodyIdB,int frictionIndex,btManifoldPoint& cp,const btVector3& rel_pos1,const btVector3& rel_pos2,btCollisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation, const btContactSolverInfo& infoGlobal, btScalar desiredVelocity=0., btScalar cfmSlip=0.); btSolverConstraint& addTorsionalFrictionConstraint(const btVector3& normalAxis,int solverBodyIdA,int solverBodyIdB,int frictionIndex,btManifoldPoint& cp,btScalar torsionalFriction, const btVector3& rel_pos1,const btVector3& rel_pos2,btCollisionObject* colObj0,btCollisionObject* colObj1, btScalar relaxation, btScalar desiredVelocity=0, btScalar cfmSlip=0.f); @@ -85,20 +89,22 @@ protected: unsigned long m_btSeed2; - btScalar restitutionCurve(btScalar rel_vel, btScalar restitution); + btScalar restitutionCurve(btScalar rel_vel, btScalar restitution, btScalar velocityThreshold); virtual void convertContacts(btPersistentManifold** manifoldPtr, int numManifolds, const btContactSolverInfo& infoGlobal); void convertContact(btPersistentManifold* manifold,const btContactSolverInfo& infoGlobal); - btSimdScalar resolveSplitPenetrationSIMD( - btSolverBody& bodyA,btSolverBody& bodyB, - const btSolverConstraint& contactConstraint); + btSimdScalar resolveSplitPenetrationSIMD(btSolverBody& bodyA,btSolverBody& bodyB, const btSolverConstraint& contactConstraint) + { + return m_resolveSplitPenetrationImpulse( bodyA, bodyB, contactConstraint ); + } - btScalar resolveSplitPenetrationImpulseCacheFriendly( - btSolverBody& bodyA,btSolverBody& bodyB, - const btSolverConstraint& contactConstraint); + btSimdScalar resolveSplitPenetrationImpulseCacheFriendly(btSolverBody& bodyA,btSolverBody& bodyB, const btSolverConstraint& contactConstraint) + { + return m_resolveSplitPenetrationImpulse( bodyA, bodyB, contactConstraint ); + } //internal method int getOrInitSolverBody(btCollisionObject& body,btScalar timeStep); @@ -108,6 +114,10 @@ protected: btSimdScalar resolveSingleConstraintRowGenericSIMD(btSolverBody& bodyA,btSolverBody& bodyB,const btSolverConstraint& contactConstraint); btSimdScalar resolveSingleConstraintRowLowerLimit(btSolverBody& bodyA,btSolverBody& bodyB,const btSolverConstraint& contactConstraint); btSimdScalar resolveSingleConstraintRowLowerLimitSIMD(btSolverBody& bodyA,btSolverBody& bodyB,const btSolverConstraint& contactConstraint); + btSimdScalar resolveSplitPenetrationImpulse(btSolverBody& bodyA,btSolverBody& bodyB, const btSolverConstraint& contactConstraint) + { + return m_resolveSplitPenetrationImpulse( bodyA, bodyB, contactConstraint ); + } protected: diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp index f8f81bfe6..d63cef031 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btSliderConstraint.cpp @@ -364,7 +364,6 @@ void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTra int srow; btScalar limit_err; int limit; - int powered; // next two rows. // we want: velA + wA x relA == velB + wB x relB ... but this would @@ -470,13 +469,9 @@ void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTra limit_err = getLinDepth() * signFact; limit = (limit_err > btScalar(0.0)) ? 2 : 1; } - powered = 0; - if(getPoweredLinMotor()) - { - powered = 1; - } + bool powered = getPoweredLinMotor(); // if the slider has joint limits or motor, add in the extra row - if (limit || powered) + if (limit || powered) { nrow++; srow = nrow * info->rowskip; @@ -524,7 +519,7 @@ void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTra btScalar histop = getUpperLinLimit(); if(limit && (lostop == histop)) { // the joint motor is ineffective - powered = 0; + powered = false; } info->m_constraintError[srow] = 0.; info->m_lowerLimit[srow] = 0.; @@ -609,12 +604,8 @@ void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTra limit = (limit_err > btScalar(0.0)) ? 1 : 2; } // if the slider has joint limits, add in the extra row - powered = 0; - if(getPoweredAngMotor()) - { - powered = 1; - } - if(limit || powered) + powered = getPoweredAngMotor(); + if(limit || powered) { nrow++; srow = nrow * info->rowskip; @@ -630,7 +621,7 @@ void btSliderConstraint::getInfo2NonVirtual(btConstraintInfo2* info, const btTra btScalar histop = getUpperAngLimit(); if(limit && (lostop == histop)) { // the joint motor is ineffective - powered = 0; + powered = false; } currERP = (m_flags & BT_SLIDER_FLAGS_ERP_LIMANG) ? m_softnessLimAng : info->erp; if(powered) diff --git a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btTypedConstraint.cpp b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btTypedConstraint.cpp index 736a64a1c..9f04f2805 100644 --- a/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btTypedConstraint.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/ConstraintSolver/btTypedConstraint.cpp @@ -19,7 +19,7 @@ subject to the following restrictions: #include "LinearMath/btSerializer.h" -#define DEFAULT_DEBUGDRAW_SIZE btScalar(0.3f) +#define DEFAULT_DEBUGDRAW_SIZE btScalar(0.05f) btTypedConstraint::btTypedConstraint(btTypedConstraintType type, btRigidBody& rbA) :btTypedObject(type), diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp index 808f2720c..fc85b4f86 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp @@ -374,7 +374,7 @@ void btDiscreteDynamicsWorld::synchronizeSingleMotionState(btRigidBody* body) void btDiscreteDynamicsWorld::synchronizeMotionStates() { - BT_PROFILE("synchronizeMotionStates"); +// BT_PROFILE("synchronizeMotionStates"); if (m_synchronizeAllMotionStates) { //iterate over all collision objects @@ -402,7 +402,6 @@ int btDiscreteDynamicsWorld::stepSimulation( btScalar timeStep,int maxSubSteps, { startProfiling(timeStep); - BT_PROFILE("stepSimulation"); int numSimulationSubSteps = 0; @@ -539,7 +538,7 @@ btVector3 btDiscreteDynamicsWorld::getGravity () const return m_gravity; } -void btDiscreteDynamicsWorld::addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup,short int collisionFilterMask) +void btDiscreteDynamicsWorld::addCollisionObject(btCollisionObject* collisionObject, int collisionFilterGroup, int collisionFilterMask) { btCollisionWorld::addCollisionObject(collisionObject,collisionFilterGroup,collisionFilterMask); } @@ -578,14 +577,14 @@ void btDiscreteDynamicsWorld::addRigidBody(btRigidBody* body) } bool isDynamic = !(body->isStaticObject() || body->isKinematicObject()); - short collisionFilterGroup = isDynamic? short(btBroadphaseProxy::DefaultFilter) : short(btBroadphaseProxy::StaticFilter); - short collisionFilterMask = isDynamic? short(btBroadphaseProxy::AllFilter) : short(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); + int collisionFilterGroup = isDynamic? int(btBroadphaseProxy::DefaultFilter) : int(btBroadphaseProxy::StaticFilter); + int collisionFilterMask = isDynamic? int(btBroadphaseProxy::AllFilter) : int(btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); addCollisionObject(body,collisionFilterGroup,collisionFilterMask); } } -void btDiscreteDynamicsWorld::addRigidBody(btRigidBody* body, short group, short mask) +void btDiscreteDynamicsWorld::addRigidBody(btRigidBody* body, int group, int mask) { if (!body->isStaticOrKinematicObject() && !(body->getFlags() &BT_DISABLE_WORLD_GRAVITY)) { @@ -1512,6 +1511,9 @@ void btDiscreteDynamicsWorld::serializeDynamicsWorldInfo(btSerializer* serialize worldInfo->m_solverInfo.m_splitImpulse = getSolverInfo().m_splitImpulse; + // Fill padding with zeros to appease msan. + memset(worldInfo->m_solverInfo.m_padding, 0, sizeof(worldInfo->m_solverInfo.m_padding)); + #ifdef BT_USE_DOUBLE_PRECISION const char* structType = "btDynamicsWorldDoubleData"; #else//BT_USE_DOUBLE_PRECISION diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h index d2789cc6b..b0d19f48a 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h @@ -144,11 +144,11 @@ public: virtual btVector3 getGravity () const; - virtual void addCollisionObject(btCollisionObject* collisionObject,short int collisionFilterGroup=btBroadphaseProxy::StaticFilter,short int collisionFilterMask=btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); + virtual void addCollisionObject(btCollisionObject* collisionObject, int collisionFilterGroup=btBroadphaseProxy::StaticFilter, int collisionFilterMask=btBroadphaseProxy::AllFilter ^ btBroadphaseProxy::StaticFilter); virtual void addRigidBody(btRigidBody* body); - virtual void addRigidBody(btRigidBody* body, short group, short mask); + virtual void addRigidBody(btRigidBody* body, int group, int mask); virtual void removeRigidBody(btRigidBody* body); diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.cpp b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.cpp index 5e51a994c..1d10bad92 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.cpp @@ -108,8 +108,108 @@ struct InplaceSolverIslandCallbackMt : public btSimulationIslandManagerMt::Islan }; +/// +/// btConstraintSolverPoolMt +/// -btDiscreteDynamicsWorldMt::btDiscreteDynamicsWorldMt(btDispatcher* dispatcher,btBroadphaseInterface* pairCache,btConstraintSolver* constraintSolver, btCollisionConfiguration* collisionConfiguration) +btConstraintSolverPoolMt::ThreadSolver* btConstraintSolverPoolMt::getAndLockThreadSolver() +{ + int i = 0; +#if BT_THREADSAFE + i = btGetCurrentThreadIndex() % m_solvers.size(); +#endif // #if BT_THREADSAFE + while ( true ) + { + ThreadSolver& solver = m_solvers[ i ]; + if ( solver.mutex.tryLock() ) + { + return &solver; + } + // failed, try the next one + i = ( i + 1 ) % m_solvers.size(); + } + return NULL; +} + +void btConstraintSolverPoolMt::init( btConstraintSolver** solvers, int numSolvers ) +{ + m_solverType = BT_SEQUENTIAL_IMPULSE_SOLVER; + m_solvers.resize( numSolvers ); + for ( int i = 0; i < numSolvers; ++i ) + { + m_solvers[ i ].solver = solvers[ i ]; + } + if ( numSolvers > 0 ) + { + m_solverType = solvers[ 0 ]->getSolverType(); + } +} + +// create the solvers for me +btConstraintSolverPoolMt::btConstraintSolverPoolMt( int numSolvers ) +{ + btAlignedObjectArray solvers; + solvers.reserve( numSolvers ); + for ( int i = 0; i < numSolvers; ++i ) + { + btConstraintSolver* solver = new btSequentialImpulseConstraintSolver(); + solvers.push_back( solver ); + } + init( &solvers[ 0 ], numSolvers ); +} + +// pass in fully constructed solvers (destructor will delete them) +btConstraintSolverPoolMt::btConstraintSolverPoolMt( btConstraintSolver** solvers, int numSolvers ) +{ + init( solvers, numSolvers ); +} + +btConstraintSolverPoolMt::~btConstraintSolverPoolMt() +{ + // delete all solvers + for ( int i = 0; i < m_solvers.size(); ++i ) + { + ThreadSolver& solver = m_solvers[ i ]; + delete solver.solver; + solver.solver = NULL; + } +} + +///solve a group of constraints +btScalar btConstraintSolverPoolMt::solveGroup( btCollisionObject** bodies, + int numBodies, + btPersistentManifold** manifolds, + int numManifolds, + btTypedConstraint** constraints, + int numConstraints, + const btContactSolverInfo& info, + btIDebugDraw* debugDrawer, + btDispatcher* dispatcher +) +{ + ThreadSolver* ts = getAndLockThreadSolver(); + ts->solver->solveGroup( bodies, numBodies, manifolds, numManifolds, constraints, numConstraints, info, debugDrawer, dispatcher ); + ts->mutex.unlock(); + return 0.0f; +} + +void btConstraintSolverPoolMt::reset() +{ + for ( int i = 0; i < m_solvers.size(); ++i ) + { + ThreadSolver& solver = m_solvers[ i ]; + solver.mutex.lock(); + solver.solver->reset(); + solver.mutex.unlock(); + } +} + + +/// +/// btDiscreteDynamicsWorldMt +/// + +btDiscreteDynamicsWorldMt::btDiscreteDynamicsWorldMt(btDispatcher* dispatcher, btBroadphaseInterface* pairCache, btConstraintSolverPoolMt* constraintSolver, btCollisionConfiguration* collisionConfiguration) : btDiscreteDynamicsWorld(dispatcher,pairCache,constraintSolver,collisionConfiguration) { if (m_ownsIslandManager) @@ -124,8 +224,8 @@ btDiscreteDynamicsWorldMt::btDiscreteDynamicsWorldMt(btDispatcher* dispatcher,bt { void* mem = btAlignedAlloc(sizeof(btSimulationIslandManagerMt),16); btSimulationIslandManagerMt* im = new (mem) btSimulationIslandManagerMt(); - m_islandManager = im; im->setMinimumSolverBatchSize( m_solverInfo.m_minimumSolverBatchSize ); + m_islandManager = im; } } @@ -145,7 +245,7 @@ btDiscreteDynamicsWorldMt::~btDiscreteDynamicsWorldMt() } -void btDiscreteDynamicsWorldMt::solveConstraints(btContactSolverInfo& solverInfo) +void btDiscreteDynamicsWorldMt::solveConstraints(btContactSolverInfo& solverInfo) { BT_PROFILE("solveConstraints"); @@ -160,3 +260,68 @@ void btDiscreteDynamicsWorldMt::solveConstraints(btContactSolverInfo& solverInfo } +struct UpdaterUnconstrainedMotion : public btIParallelForBody +{ + btScalar timeStep; + btRigidBody** rigidBodies; + + void forLoop( int iBegin, int iEnd ) const BT_OVERRIDE + { + for ( int i = iBegin; i < iEnd; ++i ) + { + btRigidBody* body = rigidBodies[ i ]; + if ( !body->isStaticOrKinematicObject() ) + { + //don't integrate/update velocities here, it happens in the constraint solver + body->applyDamping( timeStep ); + body->predictIntegratedTransform( timeStep, body->getInterpolationWorldTransform() ); + } + } + } +}; + + +void btDiscreteDynamicsWorldMt::predictUnconstraintMotion( btScalar timeStep ) +{ + BT_PROFILE( "predictUnconstraintMotion" ); + if ( m_nonStaticRigidBodies.size() > 0 ) + { + UpdaterUnconstrainedMotion update; + update.timeStep = timeStep; + update.rigidBodies = &m_nonStaticRigidBodies[ 0 ]; + int grainSize = 50; // num of iterations per task for task scheduler + btParallelFor( 0, m_nonStaticRigidBodies.size(), grainSize, update ); + } +} + + +void btDiscreteDynamicsWorldMt::createPredictiveContacts( btScalar timeStep ) +{ + BT_PROFILE( "createPredictiveContacts" ); + releasePredictiveContacts(); + if ( m_nonStaticRigidBodies.size() > 0 ) + { + UpdaterCreatePredictiveContacts update; + update.world = this; + update.timeStep = timeStep; + update.rigidBodies = &m_nonStaticRigidBodies[ 0 ]; + int grainSize = 50; // num of iterations per task for task scheduler + btParallelFor( 0, m_nonStaticRigidBodies.size(), grainSize, update ); + } +} + + +void btDiscreteDynamicsWorldMt::integrateTransforms( btScalar timeStep ) +{ + BT_PROFILE( "integrateTransforms" ); + if ( m_nonStaticRigidBodies.size() > 0 ) + { + UpdaterIntegrateTransforms update; + update.world = this; + update.timeStep = timeStep; + update.rigidBodies = &m_nonStaticRigidBodies[ 0 ]; + int grainSize = 50; // num of iterations per task for task scheduler + btParallelFor( 0, m_nonStaticRigidBodies.size(), grainSize, update ); + } +} + diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.h b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.h index b28371b51..2f144cdda 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.h +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDiscreteDynamicsWorldMt.h @@ -18,24 +18,116 @@ subject to the following restrictions: #define BT_DISCRETE_DYNAMICS_WORLD_MT_H #include "btDiscreteDynamicsWorld.h" +#include "btSimulationIslandManagerMt.h" +#include "BulletDynamics/ConstraintSolver/btConstraintSolver.h" struct InplaceSolverIslandCallbackMt; +/// +/// btConstraintSolverPoolMt - masquerades as a constraint solver, but really it is a threadsafe pool of them. +/// +/// Each solver in the pool is protected by a mutex. When solveGroup is called from a thread, +/// the pool looks for a solver that isn't being used by another thread, locks it, and dispatches the +/// call to the solver. +/// So long as there are at least as many solvers as there are hardware threads, it should never need to +/// spin wait. +/// +class btConstraintSolverPoolMt : public btConstraintSolver +{ +public: + // create the solvers for me + explicit btConstraintSolverPoolMt( int numSolvers ); + + // pass in fully constructed solvers (destructor will delete them) + btConstraintSolverPoolMt( btConstraintSolver** solvers, int numSolvers ); + + virtual ~btConstraintSolverPoolMt(); + + ///solve a group of constraints + virtual btScalar solveGroup( btCollisionObject** bodies, + int numBodies, + btPersistentManifold** manifolds, + int numManifolds, + btTypedConstraint** constraints, + int numConstraints, + const btContactSolverInfo& info, + btIDebugDraw* debugDrawer, + btDispatcher* dispatcher + ) BT_OVERRIDE; + + virtual void reset() BT_OVERRIDE; + virtual btConstraintSolverType getSolverType() const BT_OVERRIDE { return m_solverType; } + +private: + const static size_t kCacheLineSize = 128; + struct ThreadSolver + { + btConstraintSolver* solver; + btSpinMutex mutex; + char _cachelinePadding[ kCacheLineSize - sizeof( btSpinMutex ) - sizeof( void* ) ]; // keep mutexes from sharing a cache line + }; + btAlignedObjectArray m_solvers; + btConstraintSolverType m_solverType; + + ThreadSolver* getAndLockThreadSolver(); + void init( btConstraintSolver** solvers, int numSolvers ); +}; + + + /// /// btDiscreteDynamicsWorldMt -- a version of DiscreteDynamicsWorld with some minor changes to support /// solving simulation islands on multiple threads. /// +/// Should function exactly like btDiscreteDynamicsWorld. +/// Also 3 methods that iterate over all of the rigidbodies can run in parallel: +/// - predictUnconstraintMotion +/// - integrateTransforms +/// - createPredictiveContacts +/// ATTRIBUTE_ALIGNED16(class) btDiscreteDynamicsWorldMt : public btDiscreteDynamicsWorld { protected: InplaceSolverIslandCallbackMt* m_solverIslandCallbackMt; - virtual void solveConstraints(btContactSolverInfo& solverInfo); + virtual void solveConstraints(btContactSolverInfo& solverInfo) BT_OVERRIDE; + + virtual void predictUnconstraintMotion( btScalar timeStep ) BT_OVERRIDE; + + struct UpdaterCreatePredictiveContacts : public btIParallelForBody + { + btScalar timeStep; + btRigidBody** rigidBodies; + btDiscreteDynamicsWorldMt* world; + + void forLoop( int iBegin, int iEnd ) const BT_OVERRIDE + { + world->createPredictiveContactsInternal( &rigidBodies[ iBegin ], iEnd - iBegin, timeStep ); + } + }; + virtual void createPredictiveContacts( btScalar timeStep ) BT_OVERRIDE; + + struct UpdaterIntegrateTransforms : public btIParallelForBody + { + btScalar timeStep; + btRigidBody** rigidBodies; + btDiscreteDynamicsWorldMt* world; + + void forLoop( int iBegin, int iEnd ) const BT_OVERRIDE + { + world->integrateTransformsInternal( &rigidBodies[ iBegin ], iEnd - iBegin, timeStep ); + } + }; + virtual void integrateTransforms( btScalar timeStep ) BT_OVERRIDE; public: BT_DECLARE_ALIGNED_ALLOCATOR(); - btDiscreteDynamicsWorldMt(btDispatcher* dispatcher,btBroadphaseInterface* pairCache,btConstraintSolver* constraintSolver,btCollisionConfiguration* collisionConfiguration); + btDiscreteDynamicsWorldMt(btDispatcher* dispatcher, + btBroadphaseInterface* pairCache, + btConstraintSolverPoolMt* constraintSolver, // Note this should be a solver-pool for multi-threading + btCollisionConfiguration* collisionConfiguration + ); virtual ~btDiscreteDynamicsWorldMt(); }; diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDynamicsWorld.h b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDynamicsWorld.h index 4d65f5489..42d8fc0de 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDynamicsWorld.h +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btDynamicsWorld.h @@ -89,7 +89,7 @@ public: virtual void addRigidBody(btRigidBody* body) = 0; - virtual void addRigidBody(btRigidBody* body, short group, short mask) = 0; + virtual void addRigidBody(btRigidBody* body, int group, int mask) = 0; virtual void removeRigidBody(btRigidBody* body) = 0; @@ -135,6 +135,11 @@ public: return m_solverInfo; } + const btContactSolverInfo& getSolverInfo() const + { + return m_solverInfo; + } + ///obsolete, use addAction instead. virtual void addVehicle(btActionInterface* vehicle) {(void)vehicle;} diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btRigidBody.cpp b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btRigidBody.cpp index 9402a658c..ca0714fcf 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btRigidBody.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btRigidBody.cpp @@ -507,6 +507,11 @@ const char* btRigidBody::serialize(void* dataBuffer, class btSerializer* seriali rbd->m_linearSleepingThreshold=m_linearSleepingThreshold; rbd->m_angularSleepingThreshold = m_angularSleepingThreshold; + // Fill padding with zeros to appease msan. +#ifdef BT_USE_DOUBLE_PRECISION + memset(rbd->m_padding, 0, sizeof(rbd->m_padding)); +#endif + return btRigidBodyDataName; } diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp index 35dd38840..6f63b87c8 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp @@ -155,7 +155,7 @@ void btSimpleDynamicsWorld::addRigidBody(btRigidBody* body) } } -void btSimpleDynamicsWorld::addRigidBody(btRigidBody* body, short group, short mask) +void btSimpleDynamicsWorld::addRigidBody(btRigidBody* body, int group, int mask) { body->setGravity(m_gravity); diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.h b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.h index d48d2e39c..44b7e7fb3 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.h +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimpleDynamicsWorld.h @@ -56,7 +56,7 @@ public: virtual void addRigidBody(btRigidBody* body); - virtual void addRigidBody(btRigidBody* body, short group, short mask); + virtual void addRigidBody(btRigidBody* body, int group, int mask); virtual void removeRigidBody(btRigidBody* body); diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.cpp b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.cpp index ad63b6ee0..99b34353c 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.cpp @@ -15,6 +15,7 @@ subject to the following restrictions: #include "LinearMath/btScalar.h" +#include "LinearMath/btThreads.h" #include "btSimulationIslandManagerMt.h" #include "BulletCollision/BroadphaseCollision/btDispatcher.h" #include "BulletCollision/NarrowPhaseCollision/btPersistentManifold.h" @@ -44,7 +45,7 @@ btSimulationIslandManagerMt::btSimulationIslandManagerMt() { m_minimumSolverBatchSize = calcBatchCost(0, 128, 0); m_batchIslandMinBodyCount = 32; - m_islandDispatch = defaultIslandDispatch; + m_islandDispatch = parallelIslandDispatch; m_batchIsland = NULL; } @@ -545,8 +546,9 @@ void btSimulationIslandManagerMt::mergeIslands() } -void btSimulationIslandManagerMt::defaultIslandDispatch( btAlignedObjectArray* islandsPtr, IslandCallback* callback ) +void btSimulationIslandManagerMt::serialIslandDispatch( btAlignedObjectArray* islandsPtr, IslandCallback* callback ) { + BT_PROFILE( "serialIslandDispatch" ); // serial dispatch btAlignedObjectArray& islands = *islandsPtr; for ( int i = 0; i < islands.size(); ++i ) @@ -565,6 +567,41 @@ void btSimulationIslandManagerMt::defaultIslandDispatch( btAlignedObjectArray* islandsPtr; + btSimulationIslandManagerMt::IslandCallback* callback; + + void forLoop( int iBegin, int iEnd ) const BT_OVERRIDE + { + for ( int i = iBegin; i < iEnd; ++i ) + { + btSimulationIslandManagerMt::Island* island = ( *islandsPtr )[ i ]; + btPersistentManifold** manifolds = island->manifoldArray.size() ? &island->manifoldArray[ 0 ] : NULL; + btTypedConstraint** constraintsPtr = island->constraintArray.size() ? &island->constraintArray[ 0 ] : NULL; + callback->processIsland( &island->bodyArray[ 0 ], + island->bodyArray.size(), + manifolds, + island->manifoldArray.size(), + constraintsPtr, + island->constraintArray.size(), + island->id + ); + } + } +}; + +void btSimulationIslandManagerMt::parallelIslandDispatch( btAlignedObjectArray* islandsPtr, IslandCallback* callback ) +{ + BT_PROFILE( "parallelIslandDispatch" ); + int grainSize = 1; // iterations per task + UpdateIslandDispatcher dispatcher; + dispatcher.islandsPtr = islandsPtr; + dispatcher.callback = callback; + btParallelFor( 0, islandsPtr->size(), grainSize, dispatcher ); +} + + ///@todo: this is random access, it can be walked 'cache friendly'! void btSimulationIslandManagerMt::buildAndProcessIslands( btDispatcher* dispatcher, btCollisionWorld* collisionWorld, diff --git a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.h b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.h index 117061623..9a781aaef 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.h +++ b/Engine/lib/bullet/src/BulletDynamics/Dynamics/btSimulationIslandManagerMt.h @@ -59,7 +59,8 @@ public: ) = 0; }; typedef void( *IslandDispatchFunc ) ( btAlignedObjectArray* islands, IslandCallback* callback ); - static void defaultIslandDispatch( btAlignedObjectArray* islands, IslandCallback* callback ); + static void serialIslandDispatch( btAlignedObjectArray* islandsPtr, IslandCallback* callback ); + static void parallelIslandDispatch( btAlignedObjectArray* islandsPtr, IslandCallback* callback ); protected: btAlignedObjectArray m_allocatedIslands; // owner of all Islands btAlignedObjectArray m_activeIslands; // islands actively in use diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBody.cpp b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBody.cpp index fbc2bbec4..8c7e499d8 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBody.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBody.cpp @@ -52,6 +52,7 @@ namespace { bottom_out = -displacement.cross(top_out) + rotation_matrix * bottom_in; } +#if 0 void InverseSpatialTransform(const btMatrix3x3 &rotation_matrix, const btVector3 &displacement, const btVector3 &top_in, @@ -81,6 +82,8 @@ namespace { top_out = a_top.cross(b_top); bottom_out = a_bottom.cross(b_top) + a_top.cross(b_bottom); } +#endif + } @@ -151,6 +154,8 @@ void btMultiBody::setupFixed(int i, m_links[i].m_mass = mass; m_links[i].m_inertiaLocal = inertia; m_links[i].m_parent = parent; + m_links[i].setAxisTop(0, 0., 0., 0.); + m_links[i].setAxisBottom(0, btVector3(0,0,0)); m_links[i].m_zeroRotParentToThis = rotParentToThis; m_links[i].m_dVector = thisPivotToThisComOffset; m_links[i].m_eVector = parentComToThisPivotOffset; @@ -427,6 +432,13 @@ const btQuaternion & btMultiBody::getParentToLocalRot(int i) const btVector3 btMultiBody::localPosToWorld(int i, const btVector3 &local_pos) const { + btAssert(i>=-1); + btAssert(i=m_links.size())) + { + return btVector3(SIMD_INFINITY,SIMD_INFINITY,SIMD_INFINITY); + } + btVector3 result = local_pos; while (i != -1) { // 'result' is in frame i. transform it to frame parent(i) @@ -444,6 +456,13 @@ btVector3 btMultiBody::localPosToWorld(int i, const btVector3 &local_pos) const btVector3 btMultiBody::worldPosToLocal(int i, const btVector3 &world_pos) const { + btAssert(i>=-1); + btAssert(i=m_links.size())) + { + return btVector3(SIMD_INFINITY,SIMD_INFINITY,SIMD_INFINITY); + } + if (i == -1) { // world to base return quatRotate(getWorldToBaseRot(),(world_pos - getBasePos())); @@ -455,6 +474,14 @@ btVector3 btMultiBody::worldPosToLocal(int i, const btVector3 &world_pos) const btVector3 btMultiBody::localDirToWorld(int i, const btVector3 &local_dir) const { + btAssert(i>=-1); + btAssert(i=m_links.size())) + { + return btVector3(SIMD_INFINITY,SIMD_INFINITY,SIMD_INFINITY); + } + + btVector3 result = local_dir; while (i != -1) { result = quatRotate(getParentToLocalRot(i).inverse() , result); @@ -466,6 +493,13 @@ btVector3 btMultiBody::localDirToWorld(int i, const btVector3 &local_dir) const btVector3 btMultiBody::worldDirToLocal(int i, const btVector3 &world_dir) const { + btAssert(i>=-1); + btAssert(i=m_links.size())) + { + return btVector3(SIMD_INFINITY,SIMD_INFINITY,SIMD_INFINITY); + } + if (i == -1) { return quatRotate(getWorldToBaseRot(), world_dir); } else { @@ -490,7 +524,8 @@ void btMultiBody::compTreeLinkVelocities(btVector3 *omega, btVector3 *vel) const omega[0] = quatRotate(m_baseQuat ,getBaseOmega()); vel[0] = quatRotate(m_baseQuat ,getBaseVel()); - for (int i = 0; i < num_links; ++i) { + for (int i = 0; i < num_links; ++i) + { const int parent = m_links[i].m_parent; // transform parent vel into this frame, store in omega[i+1], vel[i+1] @@ -499,9 +534,24 @@ void btMultiBody::compTreeLinkVelocities(btVector3 *omega, btVector3 *vel) const omega[i+1], vel[i+1]); // now add qidot * shat_i - omega[i+1] += getJointVel(i) * m_links[i].getAxisTop(0); - vel[i+1] += getJointVel(i) * m_links[i].getAxisBottom(0); - } + //only supported for revolute/prismatic joints, todo: spherical and planar joints + switch(m_links[i].m_jointType) + { + case btMultibodyLink::ePrismatic: + case btMultibodyLink::eRevolute: + { + btVector3 axisTop = m_links[i].getAxisTop(0); + btVector3 axisBottom = m_links[i].getAxisBottom(0); + btScalar jointVel = getJointVel(i); + omega[i+1] += jointVel * axisTop; + vel[i+1] += jointVel * axisBottom; + break; + } + default: + { + } + } + } } btScalar btMultiBody::getKineticEnergy() const @@ -1206,7 +1256,7 @@ void btMultiBody::computeAccelerationsArticulatedBodyAlgorithmMultiDof(btScalar -void btMultiBody::solveImatrix(const btVector3& rhs_top, const btVector3& rhs_bot, float result[6]) const +void btMultiBody::solveImatrix(const btVector3& rhs_top, const btVector3& rhs_bot, btScalar result[6]) const { int num_links = getNumLinks(); ///solve I * x = rhs, so the result = invI * rhs @@ -1765,7 +1815,6 @@ void btMultiBody::goToSleep() void btMultiBody::checkMotionAndSleepIfRequired(btScalar timestep) { - int num_links = getNumLinks(); extern bool gDisableDeactivation; if (!m_canSleep || gDisableDeactivation) { @@ -1934,6 +1983,10 @@ const char* btMultiBody::serialize(void* dataBuffer, class btSerializer* seriali memPtr->m_parentIndex = getLink(i).m_parent; memPtr->m_jointDamping = getLink(i).m_jointDamping; memPtr->m_jointFriction = getLink(i).m_jointFriction; + memPtr->m_jointLowerLimit = getLink(i).m_jointLowerLimit; + memPtr->m_jointUpperLimit = getLink(i).m_jointUpperLimit; + memPtr->m_jointMaxForce = getLink(i).m_jointMaxForce; + memPtr->m_jointMaxVelocity = getLink(i).m_jointMaxVelocity; getLink(i).m_eVector.serialize(memPtr->m_parentComToThisComOffset); getLink(i).m_dVector.serialize(memPtr->m_thisPivotToThisComOffset); @@ -1978,5 +2031,10 @@ const char* btMultiBody::serialize(void* dataBuffer, class btSerializer* seriali } mbd->m_links = mbd->m_numLinks? (btMultiBodyLinkData*) serializer->getUniquePointer((void*)&m_links[0]):0; + // Fill padding with zeros to appease msan. +#ifdef BT_USE_DOUBLE_PRECISION + memset(mbd->m_padding, 0, sizeof(mbd->m_padding)); +#endif + return btMultiBodyDataName; } diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBody.h b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBody.h index 43aacbc44..655165ac1 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBody.h +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBody.h @@ -140,6 +140,15 @@ public: return m_baseCollider; } + btMultiBodyLinkCollider* getLinkCollider(int index) + { + if (index >= 0 && index < getNumLinks()) + { + return getLink(index).m_collider; + } + return 0; + } + // // get parent // input: link num from 0 to num_links-1 @@ -560,6 +569,8 @@ void addJointTorque(int i, btScalar Q); } void forwardKinematics(btAlignedObjectArray& scratch_q,btAlignedObjectArray& scratch_m); + void compTreeLinkVelocities(btVector3 *omega, btVector3 *vel) const; + void updateCollisionObjectWorldTransforms(btAlignedObjectArray& scratch_q,btAlignedObjectArray& scratch_m); virtual int calculateSerializeBufferSize() const; @@ -613,9 +624,8 @@ private: btMultiBody(const btMultiBody &); // not implemented void operator=(const btMultiBody &); // not implemented - void compTreeLinkVelocities(btVector3 *omega, btVector3 *vel) const; - void solveImatrix(const btVector3& rhs_top, const btVector3& rhs_bot, float result[6]) const; + void solveImatrix(const btVector3& rhs_top, const btVector3& rhs_bot, btScalar result[6]) const; void solveImatrix(const btSpatialForceVector &rhs, btSpatialMotionVector &result) const; void updateLinksDofOffsets() @@ -649,7 +659,6 @@ private: btVector3 m_baseConstraintTorque; // external torque applied to base. World frame. btAlignedObjectArray m_links; // array of m_links, excluding the base. index from 0 to num_links-1. - btAlignedObjectArray m_colliders; // @@ -727,7 +736,11 @@ struct btMultiBodyLinkDoubleData double m_jointDamping; double m_jointFriction; - + double m_jointLowerLimit; + double m_jointUpperLimit; + double m_jointMaxForce; + double m_jointMaxVelocity; + char *m_linkName; char *m_jointName; btCollisionObjectDoubleData *m_linkCollider; @@ -756,7 +769,11 @@ struct btMultiBodyLinkFloatData int m_posVarCount; float m_jointDamping; float m_jointFriction; - + float m_jointLowerLimit; + float m_jointUpperLimit; + float m_jointMaxForce; + float m_jointMaxVelocity; + char *m_linkName; char *m_jointName; btCollisionObjectFloatData *m_linkCollider; diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyConstraint.h b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyConstraint.h index 74c6f5a81..83521b950 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyConstraint.h +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyConstraint.h @@ -39,7 +39,7 @@ struct btMultiBodyJacobianData }; -class btMultiBodyConstraint +ATTRIBUTE_ALIGNED16(class) btMultiBodyConstraint { protected: @@ -84,12 +84,18 @@ protected: public: + BT_DECLARE_ALIGNED_ALLOCATOR(); + btMultiBodyConstraint(btMultiBody* bodyA,btMultiBody* bodyB,int linkA, int linkB, int numRows, bool isUnilateral); virtual ~btMultiBodyConstraint(); void updateJacobianSizes(); void allocateJacobiansMultiDof(); + //many constraints have setFrameInB/setPivotInB. Will use 'getConstraintType' later. + virtual void setFrameInB(const btMatrix3x3& frameInB) {} + virtual void setPivotInB(const btVector3& pivotInB){} + virtual void finalizeMultiDof()=0; virtual int getIslandIdA() const =0; @@ -177,6 +183,12 @@ public: virtual void debugDraw(class btIDebugDraw* drawer)=0; + virtual void setGearRatio(btScalar ratio) {} + virtual void setGearAuxLink(int gearAuxLink) {} + virtual void setRelativePositionTarget(btScalar relPosTarget){} + virtual void setErp(btScalar erp){} + + }; #endif //BT_MULTIBODY_CONSTRAINT_H diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp index 70e6c9922..1e2d07409 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp @@ -48,9 +48,11 @@ btScalar btMultiBodyConstraintSolver::solveSingleIteration(int iteration, btColl } //solve featherstone normal contact - for (int j=0;jm_multiBodyFrictionContactConstraints.size();j++) + for (int j1=0;j1m_multiBodyFrictionContactConstraints.size();j1++) { if (iteration < infoGlobal.m_numIterations) { - btMultiBodySolverConstraint& frictionConstraint = m_multiBodyFrictionContactConstraints[j]; + int index = j1;//iteration&1? j1 : m_multiBodyFrictionContactConstraints.size()-1-j1; + + btMultiBodySolverConstraint& frictionConstraint = m_multiBodyFrictionContactConstraints[index]; btScalar totalImpulse = m_multiBodyNormalContactConstraints[frictionConstraint.m_frictionIndex].m_appliedImpulse; //adjust friction limits here if (totalImpulse>btScalar(0)) @@ -240,32 +244,39 @@ void btMultiBodyConstraintSolver::setupMultiBodyContactConstraint(btMultiBodySol //cfm = 1 / ( dt * kp + kd ) //erp = dt * kp / ( dt * kp + kd ) - btScalar cfm = infoGlobal.m_globalCfm; - btScalar erp = infoGlobal.m_erp2; - - if ((cp.m_contactPointFlags&BT_CONTACT_FLAG_HAS_CONTACT_CFM) || (cp.m_contactPointFlags&BT_CONTACT_FLAG_HAS_CONTACT_ERP)) - { - if (cp.m_contactPointFlags&BT_CONTACT_FLAG_HAS_CONTACT_CFM) - cfm = cp.m_contactCFM; - if (cp.m_contactPointFlags&BT_CONTACT_FLAG_HAS_CONTACT_ERP) - erp = cp.m_contactERP; - } else - { - if (cp.m_contactPointFlags & BT_CONTACT_FLAG_CONTACT_STIFFNESS_DAMPING) - { - btScalar denom = ( infoGlobal.m_timeStep * cp.m_combinedContactStiffness1 + cp.m_combinedContactDamping1 ); - if (denom < SIMD_EPSILON) - { - denom = SIMD_EPSILON; - } - cfm = btScalar(1) / denom; - erp = (infoGlobal.m_timeStep * cp.m_combinedContactStiffness1) / denom; - } - } - - cfm *= invTimeStep; + btScalar cfm; + btScalar erp; + if (isFriction) + { + cfm = infoGlobal.m_frictionCFM; + erp = infoGlobal.m_frictionERP; + } else + { + cfm = infoGlobal.m_globalCfm; + erp = infoGlobal.m_erp2; + if ((cp.m_contactPointFlags&BT_CONTACT_FLAG_HAS_CONTACT_CFM) || (cp.m_contactPointFlags&BT_CONTACT_FLAG_HAS_CONTACT_ERP)) + { + if (cp.m_contactPointFlags&BT_CONTACT_FLAG_HAS_CONTACT_CFM) + cfm = cp.m_contactCFM; + if (cp.m_contactPointFlags&BT_CONTACT_FLAG_HAS_CONTACT_ERP) + erp = cp.m_contactERP; + } else + { + if (cp.m_contactPointFlags & BT_CONTACT_FLAG_CONTACT_STIFFNESS_DAMPING) + { + btScalar denom = ( infoGlobal.m_timeStep * cp.m_combinedContactStiffness1 + cp.m_combinedContactDamping1 ); + if (denom < SIMD_EPSILON) + { + denom = SIMD_EPSILON; + } + cfm = btScalar(1) / denom; + erp = (infoGlobal.m_timeStep * cp.m_combinedContactStiffness1) / denom; + } + } + } + cfm *= invTimeStep; if (multiBodyA) { @@ -425,8 +436,19 @@ void btMultiBodyConstraintSolver::setupMultiBodyContactConstraint(btMultiBodySol btScalar restitution = 0.f; - btScalar penetration = isFriction? 0 : cp.getDistance()+infoGlobal.m_linearSlop; - + btScalar distance = 0; + if (!isFriction) + { + distance = cp.getDistance()+infoGlobal.m_linearSlop; + } else + { + if (cp.m_contactPointFlags & BT_CONTACT_FLAG_FRICTION_ANCHOR) + { + distance = (cp.getPositionWorldOnA() - cp.getPositionWorldOnB()).dot(contactNormal); + } + } + + btScalar rel_vel = 0.f; int ndofA = 0; int ndofB = 0; @@ -469,7 +491,7 @@ void btMultiBodyConstraintSolver::setupMultiBodyContactConstraint(btMultiBodySol if(!isFriction) { - restitution = restitutionCurve(rel_vel, cp.m_combinedRestitution); + restitution = restitutionCurve(rel_vel, cp.m_combinedRestitution, infoGlobal.m_restitutionVelocityThreshold); if (restitution <= btScalar(0.)) { restitution = 0.f; @@ -521,15 +543,20 @@ void btMultiBodyConstraintSolver::setupMultiBodyContactConstraint(btMultiBodySol btScalar positionalError = 0.f; btScalar velocityError = restitution - rel_vel;// * damping; //note for friction restitution is always set to 0 (check above) so it is acutally velocityError = -rel_vel for friction - - if (penetration>0) + if (isFriction) { - positionalError = 0; - velocityError -= penetration / infoGlobal.m_timeStep; - + positionalError = -distance * erp/infoGlobal.m_timeStep; } else { - positionalError = -penetration * erp/infoGlobal.m_timeStep; + if (distance>0) + { + positionalError = 0; + velocityError -= distance / infoGlobal.m_timeStep; + + } else + { + positionalError = -distance * erp/infoGlobal.m_timeStep; + } } btScalar penetrationImpulse = positionalError*solverConstraint.m_jacDiagABInv; @@ -556,7 +583,7 @@ void btMultiBodyConstraintSolver::setupMultiBodyContactConstraint(btMultiBodySol } else { - solverConstraint.m_rhs = velocityImpulse; + solverConstraint.m_rhs = penetrationImpulse+velocityImpulse; solverConstraint.m_rhsPenetration = 0.f; solverConstraint.m_lowerLimit = -solverConstraint.m_friction; solverConstraint.m_upperLimit = solverConstraint.m_friction; @@ -602,7 +629,7 @@ void btMultiBodyConstraintSolver::setupMultiBodyTorsionalFrictionConstraint(btMu relaxation = infoGlobal.m_sor; - btScalar invTimeStep = btScalar(1)/infoGlobal.m_timeStep; + // btScalar invTimeStep = btScalar(1)/infoGlobal.m_timeStep; if (multiBodyA) @@ -638,12 +665,12 @@ void btMultiBodyConstraintSolver::setupMultiBodyTorsionalFrictionConstraint(btMu btScalar* delta = &m_data.m_deltaVelocitiesUnitImpulse[solverConstraint.m_jacAindex]; multiBodyA->calcAccelerationDeltasMultiDof(&m_data.m_jacobians[solverConstraint.m_jacAindex],delta,m_data.scratch_r, m_data.scratch_v); - btVector3 torqueAxis0 = constraintNormal; + btVector3 torqueAxis0 = -constraintNormal; solverConstraint.m_relpos1CrossNormal = torqueAxis0; solverConstraint.m_contactNormal1 = btVector3(0,0,0); } else { - btVector3 torqueAxis0 = constraintNormal; + btVector3 torqueAxis0 = -constraintNormal; solverConstraint.m_relpos1CrossNormal = torqueAxis0; solverConstraint.m_contactNormal1 = btVector3(0,0,0); solverConstraint.m_angularComponentA = rb0 ? rb0->getInvInertiaTensorWorld()*torqueAxis0*rb0->getAngularFactor() : btVector3(0,0,0); @@ -681,21 +708,20 @@ void btMultiBodyConstraintSolver::setupMultiBodyTorsionalFrictionConstraint(btMu multiBodyB->calcAccelerationDeltasMultiDof(&m_data.m_jacobians[solverConstraint.m_jacBindex],&m_data.m_deltaVelocitiesUnitImpulse[solverConstraint.m_jacBindex],m_data.scratch_r, m_data.scratch_v); btVector3 torqueAxis1 = constraintNormal; - solverConstraint.m_relpos2CrossNormal = -torqueAxis1; + solverConstraint.m_relpos2CrossNormal = torqueAxis1; solverConstraint.m_contactNormal2 = -btVector3(0,0,0); } else { btVector3 torqueAxis1 = constraintNormal; - solverConstraint.m_relpos2CrossNormal = -torqueAxis1; + solverConstraint.m_relpos2CrossNormal = torqueAxis1; solverConstraint.m_contactNormal2 = -btVector3(0,0,0); - solverConstraint.m_angularComponentB = rb1 ? rb1->getInvInertiaTensorWorld()*-torqueAxis1*rb1->getAngularFactor() : btVector3(0,0,0); + solverConstraint.m_angularComponentB = rb1 ? rb1->getInvInertiaTensorWorld()*torqueAxis1*rb1->getAngularFactor() : btVector3(0,0,0); } { - btVector3 vec; btScalar denom0 = 0.f; btScalar denom1 = 0.f; btScalar* jacB = 0; @@ -718,8 +744,8 @@ void btMultiBodyConstraintSolver::setupMultiBodyTorsionalFrictionConstraint(btMu { if (rb0) { - vec = ( solverConstraint.m_angularComponentA).cross(rel_pos1); - denom0 = rb0->getInvMass() + constraintNormal.dot(vec); + btVector3 iMJaA = rb0?rb0->getInvInertiaTensorWorld()*solverConstraint.m_relpos1CrossNormal:btVector3(0,0,0); + denom0 = iMJaA.dot(solverConstraint.m_relpos1CrossNormal); } } if (multiBodyB) @@ -738,8 +764,8 @@ void btMultiBodyConstraintSolver::setupMultiBodyTorsionalFrictionConstraint(btMu { if (rb1) { - vec = ( -solverConstraint.m_angularComponentB).cross(rel_pos2); - denom1 = rb1->getInvMass() + constraintNormal.dot(vec); + btVector3 iMJaB = rb1?rb1->getInvInertiaTensorWorld()*solverConstraint.m_relpos2CrossNormal:btVector3(0,0,0); + denom1 = iMJaB.dot(solverConstraint.m_relpos2CrossNormal); } } @@ -781,7 +807,10 @@ void btMultiBodyConstraintSolver::setupMultiBodyTorsionalFrictionConstraint(btMu { if (rb0) { - rel_vel += rb0->getVelocityInLocalPoint(rel_pos1).dot(solverConstraint.m_contactNormal1); + btSolverBody* solverBodyA = &m_tmpSolverBodyPool[solverConstraint.m_solverBodyIdA]; + rel_vel += solverConstraint.m_contactNormal1.dot(rb0?solverBodyA->m_linearVelocity+solverBodyA->m_externalForceImpulse:btVector3(0,0,0)) + + solverConstraint.m_relpos1CrossNormal.dot(rb0?solverBodyA->m_angularVelocity:btVector3(0,0,0)); + } } if (multiBodyB) @@ -795,7 +824,10 @@ void btMultiBodyConstraintSolver::setupMultiBodyTorsionalFrictionConstraint(btMu { if (rb1) { - rel_vel += rb1->getVelocityInLocalPoint(rel_pos2).dot(solverConstraint.m_contactNormal2); + btSolverBody* solverBodyB = &m_tmpSolverBodyPool[solverConstraint.m_solverBodyIdB]; + rel_vel += solverConstraint.m_contactNormal2.dot(rb1?solverBodyB->m_linearVelocity+solverBodyB->m_externalForceImpulse:btVector3(0,0,0)) + + solverConstraint.m_relpos2CrossNormal.dot(rb1?solverBodyB->m_angularVelocity:btVector3(0,0,0)); + } } @@ -803,7 +835,7 @@ void btMultiBodyConstraintSolver::setupMultiBodyTorsionalFrictionConstraint(btMu if(!isFriction) { - restitution = restitutionCurve(rel_vel, cp.m_combinedRestitution); + restitution = restitutionCurve(rel_vel, cp.m_combinedRestitution, infoGlobal.m_restitutionVelocityThreshold); if (restitution <= btScalar(0.)) { restitution = 0.f; @@ -817,13 +849,9 @@ void btMultiBodyConstraintSolver::setupMultiBodyTorsionalFrictionConstraint(btMu { - btScalar positionalError = 0.f; - btScalar velocityError = restitution - rel_vel;// * damping; //note for friction restitution is always set to 0 (check above) so it is acutally velocityError = -rel_vel for friction + btScalar velocityError = 0 - rel_vel;// * damping; //note for friction restitution is always set to 0 (check above) so it is acutally velocityError = -rel_vel for friction - if (penetration>0) - { - velocityError -= penetration / infoGlobal.m_timeStep; - } + btScalar velocityImpulse = velocityError*solverConstraint.m_jacDiagABInv; @@ -995,6 +1023,33 @@ void btMultiBodyConstraintSolver::convertMultiBodyContact(btPersistentManifold* ///In that case, you can set the target relative motion in each friction direction (cp.m_contactMotion1 and cp.m_contactMotion2) ///this will give a conveyor belt effect /// + + btPlaneSpace1(cp.m_normalWorldOnB,cp.m_lateralFrictionDir1,cp.m_lateralFrictionDir2); + cp.m_lateralFrictionDir1.normalize(); + cp.m_lateralFrictionDir2.normalize(); + + if (rollingFriction > 0 ) + { + if (cp.m_combinedSpinningFriction>0) + { + addMultiBodyTorsionalFrictionConstraint(cp.m_normalWorldOnB,manifold,frictionIndex,cp,cp.m_combinedSpinningFriction, colObj0,colObj1, relaxation,infoGlobal); + } + if (cp.m_combinedRollingFriction>0) + { + + applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1,btCollisionObject::CF_ANISOTROPIC_ROLLING_FRICTION); + applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1,btCollisionObject::CF_ANISOTROPIC_ROLLING_FRICTION); + applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir2,btCollisionObject::CF_ANISOTROPIC_ROLLING_FRICTION); + applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir2,btCollisionObject::CF_ANISOTROPIC_ROLLING_FRICTION); + + if (cp.m_lateralFrictionDir1.length()>0.001) + addMultiBodyTorsionalFrictionConstraint(cp.m_lateralFrictionDir1,manifold,frictionIndex,cp,cp.m_combinedRollingFriction, colObj0,colObj1, relaxation,infoGlobal); + + if (cp.m_lateralFrictionDir2.length()>0.001) + addMultiBodyTorsionalFrictionConstraint(cp.m_lateralFrictionDir2,manifold,frictionIndex,cp,cp.m_combinedRollingFriction, colObj0,colObj1, relaxation,infoGlobal); + } + rollingFriction--; + } if (!(infoGlobal.m_solverMode & SOLVER_ENABLE_FRICTION_DIRECTION_CACHING) || !(cp.m_contactPointFlags&BT_CONTACT_FLAG_LATERAL_FRICTION_INITIALIZED)) {/* cp.m_lateralFrictionDir1 = vel - cp.m_normalWorldOnB * rel_vel; @@ -1019,20 +1074,12 @@ void btMultiBodyConstraintSolver::convertMultiBodyContact(btPersistentManifold* } else */ { - btPlaneSpace1(cp.m_normalWorldOnB,cp.m_lateralFrictionDir1,cp.m_lateralFrictionDir2); + applyAnisotropicFriction(colObj0,cp.m_lateralFrictionDir1,btCollisionObject::CF_ANISOTROPIC_FRICTION); applyAnisotropicFriction(colObj1,cp.m_lateralFrictionDir1,btCollisionObject::CF_ANISOTROPIC_FRICTION); addMultiBodyFrictionConstraint(cp.m_lateralFrictionDir1,manifold,frictionIndex,cp,colObj0,colObj1, relaxation,infoGlobal); - if (rollingFriction > 0) - { - addMultiBodyTorsionalFrictionConstraint(cp.m_normalWorldOnB,manifold,frictionIndex,cp,cp.m_combinedSpinningFriction, colObj0,colObj1, relaxation,infoGlobal); - addMultiBodyTorsionalFrictionConstraint(cp.m_lateralFrictionDir1,manifold,frictionIndex,cp,cp.m_combinedRollingFriction, colObj0,colObj1, relaxation,infoGlobal); - addMultiBodyTorsionalFrictionConstraint(cp.m_lateralFrictionDir2,manifold,frictionIndex,cp,cp.m_combinedRollingFriction, colObj0,colObj1, relaxation,infoGlobal); - - rollingFriction--; - } if ((infoGlobal.m_solverMode & SOLVER_USE_2_FRICTION_DIRECTIONS)) { diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.cpp b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.cpp index 4b33cf69d..9eacc2264 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.cpp @@ -24,7 +24,7 @@ subject to the following restrictions: #include "LinearMath/btSerializer.h" -void btMultiBodyDynamicsWorld::addMultiBody(btMultiBody* body, short group, short mask) +void btMultiBodyDynamicsWorld::addMultiBody(btMultiBody* body, int group, int mask) { m_multiBodies.push_back(body); @@ -332,10 +332,10 @@ struct MultiBodyInplaceSolverIslandCallback : public btSimulationIslandManager:: } } - if (m_solverInfo->m_minimumSolverBatchSize<=1) - { - m_solver->solveGroup( bodies,numBodies,manifolds, numManifolds,startConstraint,numCurConstraints,*m_solverInfo,m_debugDrawer,m_dispatcher); - } else + //if (m_solverInfo->m_minimumSolverBatchSize<=1) + //{ + // m_solver->solveGroup( bodies,numBodies,manifolds, numManifolds,startConstraint,numCurConstraints,*m_solverInfo,m_debugDrawer,m_dispatcher); + //} else { for (i=0;im_multiBodies.size();i++) { btMultiBody* bod = m_multiBodies[i]; diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.h b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.h index 2c912da5c..c0c132bbb 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.h +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.h @@ -58,7 +58,7 @@ public: virtual ~btMultiBodyDynamicsWorld (); - virtual void addMultiBody(btMultiBody* body, short group= btBroadphaseProxy::DefaultFilter, short mask=btBroadphaseProxy::AllFilter); + virtual void addMultiBody(btMultiBody* body, int group= btBroadphaseProxy::DefaultFilter, int mask=btBroadphaseProxy::AllFilter); virtual void removeMultiBody(btMultiBody* body); @@ -72,6 +72,11 @@ public: return m_multiBodies[mbIndex]; } + const btMultiBody* getMultiBody(int mbIndex) const + { + return m_multiBodies[mbIndex]; + } + virtual void addMultiBodyConstraint( btMultiBodyConstraint* constraint); virtual int getNumMultiBodyConstraints() const diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyFixedConstraint.h b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyFixedConstraint.h index 26e28a74e..036025136 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyFixedConstraint.h +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyFixedConstraint.h @@ -62,7 +62,7 @@ public: return m_pivotInB; } - void setPivotInB(const btVector3& pivotInB) + virtual void setPivotInB(const btVector3& pivotInB) { m_pivotInB = pivotInB; } @@ -82,7 +82,7 @@ public: return m_frameInB; } - void setFrameInB(const btMatrix3x3& frameInB) + virtual void setFrameInB(const btMatrix3x3& frameInB) { m_frameInB = frameInB; } diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyGearConstraint.cpp b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyGearConstraint.cpp new file mode 100644 index 000000000..5fdb7007d --- /dev/null +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyGearConstraint.cpp @@ -0,0 +1,184 @@ +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2013 Erwin Coumans http://bulletphysics.org + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +*/ + +///This file was written by Erwin Coumans + +#include "btMultiBodyGearConstraint.h" +#include "btMultiBody.h" +#include "btMultiBodyLinkCollider.h" +#include "BulletCollision/CollisionDispatch/btCollisionObject.h" + +btMultiBodyGearConstraint::btMultiBodyGearConstraint(btMultiBody* bodyA, int linkA, btMultiBody* bodyB, int linkB, const btVector3& pivotInA, const btVector3& pivotInB, const btMatrix3x3& frameInA, const btMatrix3x3& frameInB) + :btMultiBodyConstraint(bodyA,bodyB,linkA,linkB,1,false), + m_gearRatio(1), + m_gearAuxLink(-1), + m_erp(0), + m_relativePositionTarget(0) +{ + +} + +void btMultiBodyGearConstraint::finalizeMultiDof() +{ + + allocateJacobiansMultiDof(); + + m_numDofsFinalized = m_jacSizeBoth; +} + +btMultiBodyGearConstraint::~btMultiBodyGearConstraint() +{ +} + + +int btMultiBodyGearConstraint::getIslandIdA() const +{ + + if (m_bodyA) + { + btMultiBodyLinkCollider* col = m_bodyA->getBaseCollider(); + if (col) + return col->getIslandTag(); + for (int i=0;igetNumLinks();i++) + { + if (m_bodyA->getLink(i).m_collider) + return m_bodyA->getLink(i).m_collider->getIslandTag(); + } + } + return -1; +} + +int btMultiBodyGearConstraint::getIslandIdB() const +{ + if (m_bodyB) + { + btMultiBodyLinkCollider* col = m_bodyB->getBaseCollider(); + if (col) + return col->getIslandTag(); + + for (int i=0;igetNumLinks();i++) + { + col = m_bodyB->getLink(i).m_collider; + if (col) + return col->getIslandTag(); + } + } + return -1; +} + + +void btMultiBodyGearConstraint::createConstraintRows(btMultiBodyConstraintArray& constraintRows, + btMultiBodyJacobianData& data, + const btContactSolverInfo& infoGlobal) +{ + // only positions need to be updated -- data.m_jacobians and force + // directions were set in the ctor and never change. + + if (m_numDofsFinalized != m_jacSizeBoth) + { + finalizeMultiDof(); + } + + //don't crash + if (m_numDofsFinalized != m_jacSizeBoth) + return; + + + if (m_maxAppliedImpulse==0.f) + return; + + // note: we rely on the fact that data.m_jacobians are + // always initialized to zero by the Constraint ctor + int linkDoF = 0; + unsigned int offsetA = 6 + (m_bodyA->getLink(m_linkA).m_dofOffset + linkDoF); + unsigned int offsetB = 6 + (m_bodyB->getLink(m_linkB).m_dofOffset + linkDoF); + + // row 0: the lower bound + jacobianA(0)[offsetA] = 1; + jacobianB(0)[offsetB] = m_gearRatio; + + btScalar posError = 0; + const btVector3 dummy(0, 0, 0); + + btScalar kp = 1; + btScalar kd = 1; + int numRows = getNumRows(); + + for (int row=0;rowgetJointPosMultiDof(m_linkA)[dof]; + btScalar currentVelocity = m_bodyA->getJointVelMultiDof(m_linkA)[dof]; + btScalar auxVel = 0; + + if (m_gearAuxLink>=0) + { + auxVel = m_bodyA->getJointVelMultiDof(m_gearAuxLink)[dof]; + } + currentVelocity += auxVel; + if (m_erp!=0) + { + btScalar currentPositionA = m_bodyA->getJointPosMultiDof(m_linkA)[dof]; + btScalar currentPositionB = m_gearRatio*m_bodyA->getJointPosMultiDof(m_linkB)[dof]; + btScalar diff = currentPositionB+currentPositionA; + btScalar desiredPositionDiff = this->m_relativePositionTarget; + posError = -m_erp*(desiredPositionDiff - diff); + } + + btScalar desiredRelativeVelocity = auxVel; + + fillMultiBodyConstraint(constraintRow,data,jacobianA(row),jacobianB(row),dummy,dummy,dummy,dummy,posError,infoGlobal,-m_maxAppliedImpulse,m_maxAppliedImpulse,false,1,false,desiredRelativeVelocity); + + constraintRow.m_orgConstraint = this; + constraintRow.m_orgDofIndex = row; + { + //expect either prismatic or revolute joint type for now + btAssert((m_bodyA->getLink(m_linkA).m_jointType == btMultibodyLink::eRevolute)||(m_bodyA->getLink(m_linkA).m_jointType == btMultibodyLink::ePrismatic)); + switch (m_bodyA->getLink(m_linkA).m_jointType) + { + case btMultibodyLink::eRevolute: + { + constraintRow.m_contactNormal1.setZero(); + constraintRow.m_contactNormal2.setZero(); + btVector3 revoluteAxisInWorld = quatRotate(m_bodyA->getLink(m_linkA).m_cachedWorldTransform.getRotation(),m_bodyA->getLink(m_linkA).m_axes[0].m_topVec); + constraintRow.m_relpos1CrossNormal=revoluteAxisInWorld; + constraintRow.m_relpos2CrossNormal=-revoluteAxisInWorld; + + break; + } + case btMultibodyLink::ePrismatic: + { + btVector3 prismaticAxisInWorld = quatRotate(m_bodyA->getLink(m_linkA).m_cachedWorldTransform.getRotation(),m_bodyA->getLink(m_linkA).m_axes[0].m_bottomVec); + constraintRow.m_contactNormal1=prismaticAxisInWorld; + constraintRow.m_contactNormal2=-prismaticAxisInWorld; + constraintRow.m_relpos1CrossNormal.setZero(); + constraintRow.m_relpos2CrossNormal.setZero(); + break; + } + default: + { + btAssert(0); + } + }; + + } + + } + +} + diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyGearConstraint.h b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyGearConstraint.h new file mode 100644 index 000000000..0115de624 --- /dev/null +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyGearConstraint.h @@ -0,0 +1,117 @@ +/* +Bullet Continuous Collision Detection and Physics Library +Copyright (c) 2013 Erwin Coumans http://bulletphysics.org + +This software is provided 'as-is', without any express or implied warranty. +In no event will the authors be held liable for any damages arising from the use of this software. +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, +subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. +2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. +3. This notice may not be removed or altered from any source distribution. +*/ + +///This file was written by Erwin Coumans + +#ifndef BT_MULTIBODY_GEAR_CONSTRAINT_H +#define BT_MULTIBODY_GEAR_CONSTRAINT_H + +#include "btMultiBodyConstraint.h" + +class btMultiBodyGearConstraint : public btMultiBodyConstraint +{ +protected: + + btRigidBody* m_rigidBodyA; + btRigidBody* m_rigidBodyB; + btVector3 m_pivotInA; + btVector3 m_pivotInB; + btMatrix3x3 m_frameInA; + btMatrix3x3 m_frameInB; + btScalar m_gearRatio; + int m_gearAuxLink; + btScalar m_erp; + btScalar m_relativePositionTarget; + +public: + + //btMultiBodyGearConstraint(btMultiBody* body, int link, btRigidBody* bodyB, const btVector3& pivotInA, const btVector3& pivotInB, const btMatrix3x3& frameInA, const btMatrix3x3& frameInB); + btMultiBodyGearConstraint(btMultiBody* bodyA, int linkA, btMultiBody* bodyB, int linkB, const btVector3& pivotInA, const btVector3& pivotInB, const btMatrix3x3& frameInA, const btMatrix3x3& frameInB); + + virtual ~btMultiBodyGearConstraint(); + + virtual void finalizeMultiDof(); + + virtual int getIslandIdA() const; + virtual int getIslandIdB() const; + + virtual void createConstraintRows(btMultiBodyConstraintArray& constraintRows, + btMultiBodyJacobianData& data, + const btContactSolverInfo& infoGlobal); + + const btVector3& getPivotInA() const + { + return m_pivotInA; + } + + void setPivotInA(const btVector3& pivotInA) + { + m_pivotInA = pivotInA; + } + + const btVector3& getPivotInB() const + { + return m_pivotInB; + } + + virtual void setPivotInB(const btVector3& pivotInB) + { + m_pivotInB = pivotInB; + } + + const btMatrix3x3& getFrameInA() const + { + return m_frameInA; + } + + void setFrameInA(const btMatrix3x3& frameInA) + { + m_frameInA = frameInA; + } + + const btMatrix3x3& getFrameInB() const + { + return m_frameInB; + } + + virtual void setFrameInB(const btMatrix3x3& frameInB) + { + m_frameInB = frameInB; + } + + virtual void debugDraw(class btIDebugDraw* drawer) + { + //todo(erwincoumans) + } + + virtual void setGearRatio(btScalar gearRatio) + { + m_gearRatio = gearRatio; + } + virtual void setGearAuxLink(int gearAuxLink) + { + m_gearAuxLink = gearAuxLink; + } + virtual void setRelativePositionTarget(btScalar relPosTarget) + { + m_relativePositionTarget = relPosTarget; + } + virtual void setErp(btScalar erp) + { + m_erp = erp; + } +}; + +#endif //BT_MULTIBODY_GEAR_CONSTRAINT_H diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyJointLimitConstraint.cpp b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyJointLimitConstraint.cpp index 707817673..6d173b66a 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyJointLimitConstraint.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyJointLimitConstraint.cpp @@ -110,7 +110,13 @@ void btMultiBodyJointLimitConstraint::createConstraintRows(btMultiBodyConstraint for (int row=0;row0) + { + continue; + } btScalar direction = row? -1 : 1; btMultiBodySolverConstraint& constraintRow = constraintRows.expandNonInitializing(); @@ -158,7 +164,7 @@ void btMultiBodyJointLimitConstraint::createConstraintRows(btMultiBodyConstraint } { - btScalar penetration = getPosition(row); + btScalar positionalError = 0.f; btScalar velocityError = - rel_vel;// * damping; btScalar erp = infoGlobal.m_erp2; diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyJointMotor.cpp b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyJointMotor.cpp index 2a88d806e..e0921178e 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyJointMotor.cpp +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyJointMotor.cpp @@ -117,6 +117,9 @@ void btMultiBodyJointMotor::createConstraintRows(btMultiBodyConstraintArray& con if (m_numDofsFinalized != m_jacSizeBoth) return; + if (m_maxAppliedImpulse==0.f) + return; + const btScalar posError = 0; const btVector3 dummy(0, 0, 0); diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyLink.h b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyLink.h index a25961116..01828e584 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyLink.h +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyLink.h @@ -22,7 +22,8 @@ subject to the following restrictions: enum btMultiBodyLinkFlags { - BT_MULTIBODYLINKFLAGS_DISABLE_PARENT_COLLISION = 1 + BT_MULTIBODYLINKFLAGS_DISABLE_PARENT_COLLISION = 1, + BT_MULTIBODYLINKFLAGS_DISABLE_ALL_PARENT_COLLISION = 2, }; //both defines are now permanently enabled @@ -95,9 +96,18 @@ struct btMultibodyLink // m_axesBottom[1][2] = unit vectors along the translational axes on that plane btSpatialMotionVector m_axes[6]; void setAxisTop(int dof, const btVector3 &axis) { m_axes[dof].m_topVec = axis; } - void setAxisBottom(int dof, const btVector3 &axis) { m_axes[dof].m_bottomVec = axis; } - void setAxisTop(int dof, const btScalar &x, const btScalar &y, const btScalar &z) { m_axes[dof].m_topVec.setValue(x, y, z); } - void setAxisBottom(int dof, const btScalar &x, const btScalar &y, const btScalar &z) { m_axes[dof].m_bottomVec.setValue(x, y, z); } + void setAxisBottom(int dof, const btVector3 &axis) + { + m_axes[dof].m_bottomVec = axis; + } + void setAxisTop(int dof, const btScalar &x, const btScalar &y, const btScalar &z) + { + m_axes[dof].m_topVec.setValue(x, y, z); + } + void setAxisBottom(int dof, const btScalar &x, const btScalar &y, const btScalar &z) + { + m_axes[dof].m_bottomVec.setValue(x, y, z); + } const btVector3 & getAxisTop(int dof) const { return m_axes[dof].m_topVec; } const btVector3 & getAxisBottom(int dof) const { return m_axes[dof].m_bottomVec; } @@ -136,7 +146,11 @@ btVector3 m_appliedConstraintForce; // In WORLD frame btScalar m_jointDamping; //todo: implement this internally. It is unused for now, it is set by a URDF loader. User can apply manual damping. btScalar m_jointFriction; //todo: implement this internally. It is unused for now, it is set by a URDF loader. User can apply manual friction using a velocity motor. - + btScalar m_jointLowerLimit; //todo: implement this internally. It is unused for now, it is set by a URDF loader. + btScalar m_jointUpperLimit; //todo: implement this internally. It is unused for now, it is set by a URDF loader. + btScalar m_jointMaxForce; //todo: implement this internally. It is unused for now, it is set by a URDF loader. + btScalar m_jointMaxVelocity;//todo: implement this internally. It is unused for now, it is set by a URDF loader. + // ctor: set some sensible defaults btMultibodyLink() : m_mass(1), @@ -153,7 +167,11 @@ btVector3 m_appliedConstraintForce; // In WORLD frame m_jointName(0), m_userPtr(0), m_jointDamping(0), - m_jointFriction(0) + m_jointFriction(0), + m_jointLowerLimit(0), + m_jointUpperLimit(0), + m_jointMaxForce(0), + m_jointMaxVelocity(0) { m_inertiaLocal.setValue(1, 1, 1); diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyLinkCollider.h b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyLinkCollider.h index 5080ea874..671e15d31 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyLinkCollider.h +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyLinkCollider.h @@ -4,8 +4,8 @@ Copyright (c) 2013 Erwin Coumans http://bulletphysics.org This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. @@ -74,15 +74,48 @@ public: if (m_link>=0) { const btMultibodyLink& link = m_multiBody->getLink(this->m_link); - if ((link.m_flags&BT_MULTIBODYLINKFLAGS_DISABLE_PARENT_COLLISION) && link.m_parent == other->m_link) - return false; + if (link.m_flags&BT_MULTIBODYLINKFLAGS_DISABLE_ALL_PARENT_COLLISION) + { + int parent_of_this = m_link; + while (1) + { + if (parent_of_this==-1) + break; + parent_of_this = m_multiBody->getLink(parent_of_this).m_parent; + if (parent_of_this==other->m_link) + { + return false; + } + } + } + else if (link.m_flags&BT_MULTIBODYLINKFLAGS_DISABLE_PARENT_COLLISION) + { + if ( link.m_parent == other->m_link) + return false; + } + } - + if (other->m_link>=0) { const btMultibodyLink& otherLink = other->m_multiBody->getLink(other->m_link); - if ((otherLink.m_flags& BT_MULTIBODYLINKFLAGS_DISABLE_PARENT_COLLISION) && otherLink.m_parent == this->m_link) - return false; + if (otherLink.m_flags& BT_MULTIBODYLINKFLAGS_DISABLE_ALL_PARENT_COLLISION) + { + int parent_of_other = other->m_link; + while (1) + { + if (parent_of_other==-1) + break; + parent_of_other = m_multiBody->getLink(parent_of_other).m_parent; + if (parent_of_other==this->m_link) + return false; + } + } + else if (otherLink.m_flags& BT_MULTIBODYLINKFLAGS_DISABLE_PARENT_COLLISION) + { + if (otherLink.m_parent == this->m_link) + return false; + } } return true; } diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyPoint2Point.h b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyPoint2Point.h index b2e219ac1..bf39acc5b 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyPoint2Point.h +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodyPoint2Point.h @@ -22,7 +22,7 @@ subject to the following restrictions: //#define BTMBP2PCONSTRAINT_BLOCK_ANGULAR_MOTION_TEST -class btMultiBodyPoint2Point : public btMultiBodyConstraint +ATTRIBUTE_ALIGNED16(class) btMultiBodyPoint2Point : public btMultiBodyConstraint { protected: @@ -34,6 +34,8 @@ protected: public: + BT_DECLARE_ALIGNED_ALLOCATOR(); + btMultiBodyPoint2Point(btMultiBody* body, int link, btRigidBody* bodyB, const btVector3& pivotInA, const btVector3& pivotInB); btMultiBodyPoint2Point(btMultiBody* bodyA, int linkA, btMultiBody* bodyB, int linkB, const btVector3& pivotInA, const btVector3& pivotInB); @@ -53,11 +55,12 @@ public: return m_pivotInB; } - void setPivotInB(const btVector3& pivotInB) + virtual void setPivotInB(const btVector3& pivotInB) { m_pivotInB = pivotInB; } + virtual void debugDraw(class btIDebugDraw* drawer); }; diff --git a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodySliderConstraint.h b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodySliderConstraint.h index 571dcd53b..0a6cf3df1 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodySliderConstraint.h +++ b/Engine/lib/bullet/src/BulletDynamics/Featherstone/btMultiBodySliderConstraint.h @@ -63,7 +63,7 @@ public: return m_pivotInB; } - void setPivotInB(const btVector3& pivotInB) + virtual void setPivotInB(const btVector3& pivotInB) { m_pivotInB = pivotInB; } @@ -83,7 +83,7 @@ public: return m_frameInB; } - void setFrameInB(const btMatrix3x3& frameInB) + virtual void setFrameInB(const btMatrix3x3& frameInB) { m_frameInB = frameInB; } diff --git a/Engine/lib/bullet/src/BulletDynamics/Vehicle/btRaycastVehicle.h b/Engine/lib/bullet/src/BulletDynamics/Vehicle/btRaycastVehicle.h index 82d44c73e..04656b912 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Vehicle/btRaycastVehicle.h +++ b/Engine/lib/bullet/src/BulletDynamics/Vehicle/btRaycastVehicle.h @@ -19,7 +19,7 @@ class btDynamicsWorld; #include "btWheelInfo.h" #include "BulletDynamics/Dynamics/btActionInterface.h" -class btVehicleTuning; +//class btVehicleTuning; ///rayCast vehicle, very special constraint that turn a rigidbody into a vehicle. class btRaycastVehicle : public btActionInterface diff --git a/Engine/lib/bullet/src/BulletDynamics/Vehicle/btWheelInfo.h b/Engine/lib/bullet/src/BulletDynamics/Vehicle/btWheelInfo.h index f916053ec..f991a57b6 100644 --- a/Engine/lib/bullet/src/BulletDynamics/Vehicle/btWheelInfo.h +++ b/Engine/lib/bullet/src/BulletDynamics/Vehicle/btWheelInfo.h @@ -79,6 +79,8 @@ struct btWheelInfo void* m_clientInfo;//can be used to store pointer to sync transforms... + btWheelInfo() {} + btWheelInfo(btWheelInfoConstructionInfo& ci) { diff --git a/Engine/lib/bullet/src/BulletInverseDynamics/IDConfig.hpp b/Engine/lib/bullet/src/BulletInverseDynamics/IDConfig.hpp index c34f98941..ebb10e7a1 100644 --- a/Engine/lib/bullet/src/BulletInverseDynamics/IDConfig.hpp +++ b/Engine/lib/bullet/src/BulletInverseDynamics/IDConfig.hpp @@ -14,12 +14,22 @@ #ifdef BT_CUSTOM_INVERSE_DYNAMICS_CONFIG_H #include #define BT_ID_WO_BULLET -#define BT_ID_POW(a,b) std::pow(a,b) +#define BT_ID_SQRT(x) std::sqrt(x) +#define BT_ID_FABS(x) std::fabs(x) +#define BT_ID_COS(x) std::cos(x) +#define BT_ID_SIN(x) std::sin(x) +#define BT_ID_ATAN2(x, y) std::atan2(x, y) +#define BT_ID_POW(x, y) std::pow(x, y) #define BT_ID_SNPRINTF snprintf #define BT_ID_PI M_PI #define BT_ID_USE_DOUBLE_PRECISION #else -#define BT_ID_POW(a,b) btPow(a,b) +#define BT_ID_SQRT(x) btSqrt(x) +#define BT_ID_FABS(x) btFabs(x) +#define BT_ID_COS(x) btCos(x) +#define BT_ID_SIN(x) btSin(x) +#define BT_ID_ATAN2(x, y) btAtan2(x, y) +#define BT_ID_POW(x, y) btPow(x, y) #define BT_ID_PI SIMD_PI #ifdef _WIN32 #define BT_ID_SNPRINTF _snprintf @@ -58,6 +68,10 @@ typedef btScalar idScalar; #ifdef BT_USE_DOUBLE_PRECISION #define BT_ID_USE_DOUBLE_PRECISION #endif + +#ifndef BT_USE_INVERSE_DYNAMICS_WITH_BULLET2 + + // use bullet types for arrays and array indices #include "Bullet3Common/b3AlignedObjectArray.h" // this is to make it work with C++2003, otherwise we could do this: @@ -68,7 +82,20 @@ struct idArray { typedef b3AlignedObjectArray type; }; typedef int idArrayIdx; -#define ID_DECLARE_ALIGNED_ALLOCATOR B3_DECLARE_ALIGNED_ALLOCATOR +#define ID_DECLARE_ALIGNED_ALLOCATOR() B3_DECLARE_ALIGNED_ALLOCATOR() + +#else // BT_USE_INVERSE_DYNAMICS_WITH_BULLET2 + +#include "LinearMath/btAlignedObjectArray.h" +template +struct idArray { + typedef btAlignedObjectArray type; +}; +typedef int idArrayIdx; +#define ID_DECLARE_ALIGNED_ALLOCATOR() BT_DECLARE_ALIGNED_ALLOCATOR() + +#endif // BT_USE_INVERSE_DYNAMICS_WITH_BULLET2 + // use bullet's allocator functions #define idMalloc btAllocFunc diff --git a/Engine/lib/bullet/src/BulletInverseDynamics/IDErrorMessages.hpp b/Engine/lib/bullet/src/BulletInverseDynamics/IDErrorMessages.hpp index a3866edc5..1dc22f860 100644 --- a/Engine/lib/bullet/src/BulletInverseDynamics/IDErrorMessages.hpp +++ b/Engine/lib/bullet/src/BulletInverseDynamics/IDErrorMessages.hpp @@ -5,7 +5,7 @@ /// name of file being compiled, without leading path components #define __INVDYN_FILE_WO_DIR__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__) -#ifndef BT_ID_WO_BULLET +#if !defined(BT_ID_WO_BULLET) && !defined(BT_USE_INVERSE_DYNAMICS_WITH_BULLET2) #include "Bullet3Common/b3Logging.h" #define error_message(...) b3Error(__VA_ARGS__) #define warning_message(...) b3Warning(__VA_ARGS__) @@ -24,11 +24,6 @@ fprintf(stderr, "[Warning:%s:%d] ", __INVDYN_FILE_WO_DIR__, __LINE__); \ fprintf(stderr, __VA_ARGS__); \ } while (0) -#define warning_message(...) \ - do { \ - fprintf(stderr, "[Warning:%s:%d] ", __INVDYN_FILE_WO_DIR__, __LINE__); \ - fprintf(stderr, __VA_ARGS__); \ - } while (0) #define id_printf(...) printf(__VA_ARGS__) #endif // BT_ID_WO_BULLET #endif diff --git a/Engine/lib/bullet/src/BulletInverseDynamics/IDMath.cpp b/Engine/lib/bullet/src/BulletInverseDynamics/IDMath.cpp index 03452ca0c..99fe20e49 100644 --- a/Engine/lib/bullet/src/BulletInverseDynamics/IDMath.cpp +++ b/Engine/lib/bullet/src/BulletInverseDynamics/IDMath.cpp @@ -33,10 +33,22 @@ void setZero(mat33 &m) { m(2, 2) = 0; } +void skew(vec3& v, mat33* result) { + (*result)(0, 0) = 0.0; + (*result)(0, 1) = -v(2); + (*result)(0, 2) = v(1); + (*result)(1, 0) = v(2); + (*result)(1, 1) = 0.0; + (*result)(1, 2) = -v(0); + (*result)(2, 0) = -v(1); + (*result)(2, 1) = v(0); + (*result)(2, 2) = 0.0; +} + idScalar maxAbs(const vecx &v) { idScalar result = 0.0; for (int i = 0; i < v.size(); i++) { - const idScalar tmp = std::fabs(v(i)); + const idScalar tmp = BT_ID_FABS(v(i)); if (tmp > result) { result = tmp; } @@ -47,7 +59,7 @@ idScalar maxAbs(const vecx &v) { idScalar maxAbs(const vec3 &v) { idScalar result = 0.0; for (int i = 0; i < 3; i++) { - const idScalar tmp = std::fabs(v(i)); + const idScalar tmp = BT_ID_FABS(v(i)); if (tmp > result) { result = tmp; } @@ -69,7 +81,7 @@ idScalar maxAbsMat3x(const mat3x &m) { void mul(const mat33 &a, const mat3x &b, mat3x *result) { if (b.cols() != result->cols()) { - error_message("size missmatch. a.cols()= %d, b.cols()= %d\n", + error_message("size missmatch. b.cols()= %d, result->cols()= %d\n", static_cast(b.cols()), static_cast(result->cols())); abort(); } @@ -111,8 +123,8 @@ void sub(const mat3x &a, const mat3x &b, mat3x *result) { mat33 transformX(const idScalar &alpha) { mat33 T; - const idScalar cos_alpha = std::cos(alpha); - const idScalar sin_alpha = std::sin(alpha); + const idScalar cos_alpha = BT_ID_COS(alpha); + const idScalar sin_alpha = BT_ID_SIN(alpha); // [1 0 0] // [0 c s] // [0 -s c] @@ -133,8 +145,8 @@ mat33 transformX(const idScalar &alpha) { mat33 transformY(const idScalar &beta) { mat33 T; - const idScalar cos_beta = std::cos(beta); - const idScalar sin_beta = std::sin(beta); + const idScalar cos_beta = BT_ID_COS(beta); + const idScalar sin_beta = BT_ID_SIN(beta); // [c 0 -s] // [0 1 0] // [s 0 c] @@ -155,8 +167,8 @@ mat33 transformY(const idScalar &beta) { mat33 transformZ(const idScalar &gamma) { mat33 T; - const idScalar cos_gamma = std::cos(gamma); - const idScalar sin_gamma = std::sin(gamma); + const idScalar cos_gamma = BT_ID_COS(gamma); + const idScalar sin_gamma = BT_ID_SIN(gamma); // [ c s 0] // [-s c 0] // [ 0 0 1] @@ -190,10 +202,10 @@ mat33 tildeOperator(const vec3 &v) { } void getVecMatFromDH(idScalar theta, idScalar d, idScalar a, idScalar alpha, vec3 *r, mat33 *T) { - const idScalar sa = std::sin(alpha); - const idScalar ca = std::cos(alpha); - const idScalar st = std::sin(theta); - const idScalar ct = std::cos(theta); + const idScalar sa = BT_ID_SIN(alpha); + const idScalar ca = BT_ID_COS(alpha); + const idScalar st = BT_ID_SIN(theta); + const idScalar ct = BT_ID_COS(theta); (*r)(0) = a; (*r)(1) = -sa * d; @@ -213,8 +225,8 @@ void getVecMatFromDH(idScalar theta, idScalar d, idScalar a, idScalar alpha, vec } void bodyTParentFromAxisAngle(const vec3 &axis, const idScalar &angle, mat33 *T) { - const idScalar c = cos(angle); - const idScalar s = -sin(angle); + const idScalar c = BT_ID_COS(angle); + const idScalar s = -BT_ID_SIN(angle); const idScalar one_m_c = 1.0 - c; const idScalar &x = axis(0); @@ -347,19 +359,19 @@ bool isValidInertiaMatrix(const mat33 &I, const int index, bool has_fixed_joint) } } // check symmetry - if (std::fabs(I(1, 0) - I(0, 1)) > kIsZero) { + if (BT_ID_FABS(I(1, 0) - I(0, 1)) > kIsZero) { error_message("invalid inertia tensor for body %d I(1,0)!=I(0,1). I(1,0)-I(0,1)= " "%e\n", index, I(1, 0) - I(0, 1)); return false; } - if (std::fabs(I(2, 0) - I(0, 2)) > kIsZero) { + if (BT_ID_FABS(I(2, 0) - I(0, 2)) > kIsZero) { error_message("invalid inertia tensor for body %d I(2,0)!=I(0,2). I(2,0)-I(0,2)= " "%e\n", index, I(2, 0) - I(0, 2)); return false; } - if (std::fabs(I(1, 2) - I(2, 1)) > kIsZero) { + if (BT_ID_FABS(I(1, 2) - I(2, 1)) > kIsZero) { error_message("invalid inertia tensor body %d I(1,2)!=I(2,1). I(1,2)-I(2,1)= %e\n", index, I(1, 2) - I(2, 1)); return false; @@ -375,7 +387,7 @@ bool isValidTransformMatrix(const mat33 &m) { // check for unit length column vectors for (int i = 0; i < 3; i++) { const idScalar length_minus_1 = - std::fabs(m(0, i) * m(0, i) + m(1, i) * m(1, i) + m(2, i) * m(2, i) - 1.0); + BT_ID_FABS(m(0, i) * m(0, i) + m(1, i) * m(1, i) + m(2, i) * m(2, i) - 1.0); if (length_minus_1 > kAxisLengthEpsilon) { error_message("Not a valid rotation matrix (column %d not unit length)\n" "column = [%.18e %.18e %.18e]\n" @@ -386,17 +398,17 @@ bool isValidTransformMatrix(const mat33 &m) { } } // check for orthogonal column vectors - if (std::fabs(m(0, 0) * m(0, 1) + m(1, 0) * m(1, 1) + m(2, 0) * m(2, 1)) > kAxisLengthEpsilon) { + if (BT_ID_FABS(m(0, 0) * m(0, 1) + m(1, 0) * m(1, 1) + m(2, 0) * m(2, 1)) > kAxisLengthEpsilon) { error_message("Not a valid rotation matrix (columns 0 and 1 not orthogonal)\n"); print_mat(m); return false; } - if (std::fabs(m(0, 0) * m(0, 2) + m(1, 0) * m(1, 2) + m(2, 0) * m(2, 2)) > kAxisLengthEpsilon) { + if (BT_ID_FABS(m(0, 0) * m(0, 2) + m(1, 0) * m(1, 2) + m(2, 0) * m(2, 2)) > kAxisLengthEpsilon) { error_message("Not a valid rotation matrix (columns 0 and 2 not orthogonal)\n"); print_mat(m); return false; } - if (std::fabs(m(0, 1) * m(0, 2) + m(1, 1) * m(1, 2) + m(2, 1) * m(2, 2)) > kAxisLengthEpsilon) { + if (BT_ID_FABS(m(0, 1) * m(0, 2) + m(1, 1) * m(1, 2) + m(2, 1) * m(2, 2)) > kAxisLengthEpsilon) { error_message("Not a valid rotation matrix (columns 0 and 2 not orthogonal)\n"); print_mat(m); return false; @@ -411,15 +423,15 @@ bool isValidTransformMatrix(const mat33 &m) { } bool isUnitVector(const vec3 &vector) { - return std::fabs(vector(0) * vector(0) + vector(1) * vector(1) + vector(2) * vector(2) - 1.0) < + return BT_ID_FABS(vector(0) * vector(0) + vector(1) * vector(1) + vector(2) * vector(2) - 1.0) < kIsZero; } vec3 rpyFromMatrix(const mat33 &rot) { vec3 rpy; - rpy(2) = std::atan2(-rot(1, 0), rot(0, 0)); - rpy(1) = std::atan2(rot(2, 0), std::cos(rpy(2)) * rot(0, 0) - std::sin(rpy(0)) * rot(1, 0)); - rpy(0) = std::atan2(-rot(2, 0), rot(2, 2)); + rpy(2) = BT_ID_ATAN2(-rot(1, 0), rot(0, 0)); + rpy(1) = BT_ID_ATAN2(rot(2, 0), BT_ID_COS(rpy(2)) * rot(0, 0) - BT_ID_SIN(rpy(0)) * rot(1, 0)); + rpy(0) = BT_ID_ATAN2(-rot(2, 0), rot(2, 2)); return rpy; } } diff --git a/Engine/lib/bullet/src/BulletInverseDynamics/IDMath.hpp b/Engine/lib/bullet/src/BulletInverseDynamics/IDMath.hpp index 63699712a..b355474d4 100644 --- a/Engine/lib/bullet/src/BulletInverseDynamics/IDMath.hpp +++ b/Engine/lib/bullet/src/BulletInverseDynamics/IDMath.hpp @@ -12,7 +12,8 @@ void setZero(vec3& v); void setZero(vecx& v); /// set all elements to zero void setZero(mat33& m); - +/// create a skew symmetric matrix from a vector (useful for cross product abstraction, e.g. v x a = V * a) +void skew(vec3& v, mat33* result); /// return maximum absolute value idScalar maxAbs(const vecx& v); #ifndef ID_LINEAR_MATH_USE_EIGEN diff --git a/Engine/lib/bullet/src/BulletInverseDynamics/MultiBodyTree.cpp b/Engine/lib/bullet/src/BulletInverseDynamics/MultiBodyTree.cpp index 4235f138d..c67588d49 100644 --- a/Engine/lib/bullet/src/BulletInverseDynamics/MultiBodyTree.cpp +++ b/Engine/lib/bullet/src/BulletInverseDynamics/MultiBodyTree.cpp @@ -226,10 +226,10 @@ int MultiBodyTree::addBody(int body_index, int parent_index, JointType joint_typ warning_message( "axis of motion not a unit axis ([%f %f %f]), will use normalized vector\n", body_axis_of_motion(0), body_axis_of_motion(1), body_axis_of_motion(2)); - idScalar length = std::sqrt(std::pow(body_axis_of_motion(0), 2) + - std::pow(body_axis_of_motion(1), 2) + - std::pow(body_axis_of_motion(2), 2)); - if (length < std::sqrt(std::numeric_limits::min())) { + idScalar length = BT_ID_SQRT(BT_ID_POW(body_axis_of_motion(0), 2) + + BT_ID_POW(body_axis_of_motion(1), 2) + + BT_ID_POW(body_axis_of_motion(2), 2)); + if (length < BT_ID_SQRT(std::numeric_limits::min())) { error_message("axis of motion vector too short (%e)\n", length); return -1; } diff --git a/Engine/lib/bullet/src/BulletInverseDynamics/details/MultiBodyTreeImpl.cpp b/Engine/lib/bullet/src/BulletInverseDynamics/details/MultiBodyTreeImpl.cpp index 847e5c6c7..b35c55df6 100644 --- a/Engine/lib/bullet/src/BulletInverseDynamics/details/MultiBodyTreeImpl.cpp +++ b/Engine/lib/bullet/src/BulletInverseDynamics/details/MultiBodyTreeImpl.cpp @@ -1013,7 +1013,7 @@ int MultiBodyTree::MultiBodyImpl::getBodyDotJacobianRotU(const int body_index, int MultiBodyTree::MultiBodyImpl::getBodyJacobianTrans(const int body_index, mat3x* world_jac_trans) const{ CHECK_IF_BODY_INDEX_IS_VALID(body_index); const RigidBody &body = m_body_list[body_index]; - mul(body.m_body_T_world.transpose(), body.m_body_Jac_T,world_jac_trans); + mul(body.m_body_T_world.transpose(), body.m_body_Jac_T, world_jac_trans); return 0; } diff --git a/Engine/lib/bullet/src/BulletSoftBody/btDefaultSoftBodySolver.cpp b/Engine/lib/bullet/src/BulletSoftBody/btDefaultSoftBodySolver.cpp index e90d24e6e..9c2040307 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btDefaultSoftBodySolver.cpp +++ b/Engine/lib/bullet/src/BulletSoftBody/btDefaultSoftBodySolver.cpp @@ -100,9 +100,9 @@ void btDefaultSoftBodySolver::copySoftBodyToVertexBuffer( const btSoftBody *cons for( int vertexIndex = 0; vertexIndex < numVertices; ++vertexIndex ) { btVector3 position = clothVertices[vertexIndex].m_x; - *(vertexPointer + 0) = position.getX(); - *(vertexPointer + 1) = position.getY(); - *(vertexPointer + 2) = position.getZ(); + *(vertexPointer + 0) = (float)position.getX(); + *(vertexPointer + 1) = (float)position.getY(); + *(vertexPointer + 2) = (float)position.getZ(); vertexPointer += vertexStride; } } @@ -115,9 +115,9 @@ void btDefaultSoftBodySolver::copySoftBodyToVertexBuffer( const btSoftBody *cons for( int vertexIndex = 0; vertexIndex < numVertices; ++vertexIndex ) { btVector3 normal = clothVertices[vertexIndex].m_n; - *(normalPointer + 0) = normal.getX(); - *(normalPointer + 1) = normal.getY(); - *(normalPointer + 2) = normal.getZ(); + *(normalPointer + 0) = (float)normal.getX(); + *(normalPointer + 1) = (float)normal.getY(); + *(normalPointer + 2) = (float)normal.getZ(); normalPointer += normalStride; } } diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftBody.cpp b/Engine/lib/bullet/src/BulletSoftBody/btSoftBody.cpp index d5de7c1b4..48efb0d8d 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftBody.cpp +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftBody.cpp @@ -524,7 +524,7 @@ void btSoftBody::addAeroForceToNode(const btVector3& windVelocity,int nodeInde } else if (m_cfg.aeromodel == btSoftBody::eAeroModel::V_Point || m_cfg.aeromodel == btSoftBody::eAeroModel::V_OneSided || m_cfg.aeromodel == btSoftBody::eAeroModel::V_TwoSided) { - if (btSoftBody::eAeroModel::V_TwoSided) + if (m_cfg.aeromodel == btSoftBody::eAeroModel::V_TwoSided) nrm *= (btScalar)( (btDot(nrm,rel_v) < 0) ? -1 : +1); const btScalar dvn = btDot(rel_v,nrm); @@ -619,7 +619,7 @@ void btSoftBody::addAeroForceToFace(const btVector3& windVelocity,int faceInde } else if (m_cfg.aeromodel == btSoftBody::eAeroModel::F_OneSided || m_cfg.aeromodel == btSoftBody::eAeroModel::F_TwoSided) { - if (btSoftBody::eAeroModel::F_TwoSided) + if (m_cfg.aeromodel == btSoftBody::eAeroModel::F_TwoSided) nrm *= (btScalar)( (btDot(nrm,rel_v) < 0) ? -1 : +1); const btScalar dvn=btDot(rel_v,nrm); @@ -3003,6 +3003,7 @@ void btSoftBody::applyForces() // void btSoftBody::PSolve_Anchors(btSoftBody* psb,btScalar kst,btScalar ti) { + BT_PROFILE("PSolve_Anchors"); const btScalar kAHR=psb->m_cfg.kAHR*kst; const btScalar dt=psb->m_sst.sdt; for(int i=0,ni=psb->m_anchors.size();im_sst.sdt; const btScalar mrg = psb->getCollisionShape()->getMargin(); + btMultiBodyJacobianData jacobianData; for(int i=0,ni=psb->m_rcontacts.size();im_rcontacts[i]; @@ -3033,10 +3036,10 @@ void btSoftBody::PSolve_RContacts(btSoftBody* psb, btScalar kst, btScalar ti) if (cti.m_colObj->hasContactResponse()) { btVector3 va(0,0,0); - btRigidBody* rigidCol; - btMultiBodyLinkCollider* multibodyLinkCol; + btRigidBody* rigidCol=0; + btMultiBodyLinkCollider* multibodyLinkCol=0; btScalar* deltaV; - btMultiBodyJacobianData jacobianData; + if (cti.m_colObj->getInternalType() == btCollisionObject::CO_RIGID_BODY) { rigidCol = (btRigidBody*)btRigidBody::upcast(cti.m_colObj); @@ -3096,6 +3099,8 @@ void btSoftBody::PSolve_RContacts(btSoftBody* psb, btScalar kst, btScalar ti) // void btSoftBody::PSolve_SContacts(btSoftBody* psb,btScalar,btScalar ti) { + BT_PROFILE("PSolve_SContacts"); + for(int i=0,ni=psb->m_scontacts.size();im_scontacts[i]; @@ -3129,6 +3134,7 @@ void btSoftBody::PSolve_SContacts(btSoftBody* psb,btScalar,btScalar ti) // void btSoftBody::PSolve_Links(btSoftBody* psb,btScalar kst,btScalar ti) { +BT_PROFILE("PSolve_Links"); for(int i=0,ni=psb->m_links.size();im_links[i]; @@ -3151,6 +3157,7 @@ void btSoftBody::PSolve_Links(btSoftBody* psb,btScalar kst,btScalar ti) // void btSoftBody::VSolve_Links(btSoftBody* psb,btScalar kst) { + BT_PROFILE("VSolve_Links"); for(int i=0,ni=psb->m_links.size();im_links[i]; diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftBody.h b/Engine/lib/bullet/src/BulletSoftBody/btSoftBody.h index bd5846bfb..ada0dfd1a 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftBody.h +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftBody.h @@ -232,15 +232,18 @@ public: int m_battach:1; // Attached }; /* Link */ - struct Link : Feature + ATTRIBUTE_ALIGNED16(struct) Link : Feature { + btVector3 m_c3; // gradient Node* m_n[2]; // Node pointers btScalar m_rl; // Rest length int m_bbending:1; // Bending link btScalar m_c0; // (ima+imb)*kLST btScalar m_c1; // rl^2 btScalar m_c2; // |gradient|^2/c0 - btVector3 m_c3; // gradient + + BT_DECLARE_ALIGNED_ALLOCATOR(); + }; /* Face */ struct Face : Feature @@ -614,7 +617,7 @@ public: RayFromToCaster(const btVector3& rayFrom,const btVector3& rayTo,btScalar mxt); void Process(const btDbvtNode* leaf); - static inline btScalar rayFromToTriangle(const btVector3& rayFrom, + static /*inline*/ btScalar rayFromToTriangle(const btVector3& rayFrom, const btVector3& rayTo, const btVector3& rayNormalizedDirection, const btVector3& a, diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftBodyHelpers.cpp b/Engine/lib/bullet/src/BulletSoftBody/btSoftBodyHelpers.cpp index 293a393e5..51fcd16da 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftBodyHelpers.cpp +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftBodyHelpers.cpp @@ -123,8 +123,9 @@ static inline T average(const btAlignedObjectArray& items) return(sum(items)/n); } +#if 0 // -static inline btScalar tetravolume(const btVector3& x0, + inline static btScalar tetravolume(const btVector3& x0, const btVector3& x1, const btVector3& x2, const btVector3& x3) @@ -134,6 +135,7 @@ static inline btScalar tetravolume(const btVector3& x0, const btVector3 c=x3-x0; return(btDot(a,btCross(b,c))); } +#endif // #if 0 diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftBodyInternals.h b/Engine/lib/bullet/src/BulletSoftBody/btSoftBodyInternals.h index 759509a1d..1ad82616e 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftBodyInternals.h +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftBodyInternals.h @@ -422,7 +422,7 @@ static inline btVector3 BaryCoord( const btVector3& a, } // -static btScalar ImplicitSolve( btSoftBody::ImplicitFn* fn, +inline static btScalar ImplicitSolve( btSoftBody::ImplicitFn* fn, const btVector3& a, const btVector3& b, const btScalar accuracy, @@ -451,6 +451,25 @@ static btScalar ImplicitSolve( btSoftBody::ImplicitFn* fn, return(-1); } +inline static void EvaluateMedium( const btSoftBodyWorldInfo* wfi, + const btVector3& x, + btSoftBody::sMedium& medium) +{ + medium.m_velocity = btVector3(0,0,0); + medium.m_pressure = 0; + medium.m_density = wfi->air_density; + if(wfi->water_density>0) + { + const btScalar depth=-(btDot(x,wfi->water_normal)+wfi->water_offset); + if(depth>0) + { + medium.m_density = wfi->water_density; + medium.m_pressure = depth*wfi->water_density*wfi->m_gravity.length(); + } + } +} + + // static inline btVector3 NormalizeAny(const btVector3& v) { @@ -504,23 +523,7 @@ static inline btScalar VolumeOf( const btVector3& x0, } // -static void EvaluateMedium( const btSoftBodyWorldInfo* wfi, - const btVector3& x, - btSoftBody::sMedium& medium) -{ - medium.m_velocity = btVector3(0,0,0); - medium.m_pressure = 0; - medium.m_density = wfi->air_density; - if(wfi->water_density>0) - { - const btScalar depth=-(btDot(x,wfi->water_normal)+wfi->water_offset); - if(depth>0) - { - medium.m_density = wfi->water_density; - medium.m_pressure = depth*wfi->water_density*wfi->m_gravity.length(); - } - } -} + // static inline void ApplyClampedForce( btSoftBody::Node& n, diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftMultiBodyDynamicsWorld.cpp b/Engine/lib/bullet/src/BulletSoftBody/btSoftMultiBodyDynamicsWorld.cpp index ffa243ebf..4e76dca9d 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftMultiBodyDynamicsWorld.cpp +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftMultiBodyDynamicsWorld.cpp @@ -125,7 +125,7 @@ void btSoftMultiBodyDynamicsWorld::solveSoftBodiesConstraints( btScalar timeStep } -void btSoftMultiBodyDynamicsWorld::addSoftBody(btSoftBody* body,short int collisionFilterGroup,short int collisionFilterMask) +void btSoftMultiBodyDynamicsWorld::addSoftBody(btSoftBody* body, int collisionFilterGroup, int collisionFilterMask) { m_softBodies.push_back(body); diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftMultiBodyDynamicsWorld.h b/Engine/lib/bullet/src/BulletSoftBody/btSoftMultiBodyDynamicsWorld.h index 2d0423a44..6d46a21db 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftMultiBodyDynamicsWorld.h +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftMultiBodyDynamicsWorld.h @@ -20,7 +20,9 @@ subject to the following restrictions: #include "BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.h" #include "BulletSoftBody/btSoftBody.h" +#ifndef BT_SOFT_RIGID_DYNAMICS_WORLD_H typedef btAlignedObjectArray btSoftBodyArray; +#endif class btSoftBodySolver; @@ -55,7 +57,7 @@ public: virtual void debugDrawWorld(); - void addSoftBody(btSoftBody* body,short int collisionFilterGroup=btBroadphaseProxy::DefaultFilter,short int collisionFilterMask=btBroadphaseProxy::AllFilter); + void addSoftBody(btSoftBody* body, int collisionFilterGroup=btBroadphaseProxy::DefaultFilter, int collisionFilterMask=btBroadphaseProxy::AllFilter); void removeSoftBody(btSoftBody* body); diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidCollisionAlgorithm.h b/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidCollisionAlgorithm.h index a9b513e36..93fcc6065 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidCollisionAlgorithm.h +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidCollisionAlgorithm.h @@ -31,8 +31,8 @@ class btSoftRigidCollisionAlgorithm : public btCollisionAlgorithm // bool m_ownManifold; // btPersistentManifold* m_manifoldPtr; - btSoftBody* m_softBody; - btCollisionObject* m_rigidCollisionObject; + //btSoftBody* m_softBody; + //btCollisionObject* m_rigidCollisionObject; ///for rigid versus soft (instead of soft versus rigid), we use this swapped boolean bool m_isSwapped; diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidDynamicsWorld.cpp b/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidDynamicsWorld.cpp index 653d5a06b..204b4f576 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidDynamicsWorld.cpp +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidDynamicsWorld.cpp @@ -125,7 +125,7 @@ void btSoftRigidDynamicsWorld::solveSoftBodiesConstraints( btScalar timeStep ) } -void btSoftRigidDynamicsWorld::addSoftBody(btSoftBody* body,short int collisionFilterGroup,short int collisionFilterMask) +void btSoftRigidDynamicsWorld::addSoftBody(btSoftBody* body, int collisionFilterGroup, int collisionFilterMask) { m_softBodies.push_back(body); diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidDynamicsWorld.h b/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidDynamicsWorld.h index 3e0efafd6..d921a6488 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidDynamicsWorld.h +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftRigidDynamicsWorld.h @@ -54,7 +54,7 @@ public: virtual void debugDrawWorld(); - void addSoftBody(btSoftBody* body,short int collisionFilterGroup=btBroadphaseProxy::DefaultFilter,short int collisionFilterMask=btBroadphaseProxy::AllFilter); + void addSoftBody(btSoftBody* body, int collisionFilterGroup=btBroadphaseProxy::DefaultFilter, int collisionFilterMask=btBroadphaseProxy::AllFilter); void removeSoftBody(btSoftBody* body); diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSoftSoftCollisionAlgorithm.h b/Engine/lib/bullet/src/BulletSoftBody/btSoftSoftCollisionAlgorithm.h index 43b1439cc..4eab7aea2 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSoftSoftCollisionAlgorithm.h +++ b/Engine/lib/bullet/src/BulletSoftBody/btSoftSoftCollisionAlgorithm.h @@ -30,8 +30,8 @@ class btSoftSoftCollisionAlgorithm : public btCollisionAlgorithm bool m_ownManifold; btPersistentManifold* m_manifoldPtr; - btSoftBody* m_softBody0; - btSoftBody* m_softBody1; +// btSoftBody* m_softBody0; +// btSoftBody* m_softBody1; public: diff --git a/Engine/lib/bullet/src/BulletSoftBody/btSparseSDF.h b/Engine/lib/bullet/src/BulletSoftBody/btSparseSDF.h index bcf0c7982..ba437c28e 100644 --- a/Engine/lib/bullet/src/BulletSoftBody/btSparseSDF.h +++ b/Engine/lib/bullet/src/BulletSoftBody/btSparseSDF.h @@ -185,7 +185,7 @@ struct btSparseSdf { ++nprobes; ++ncells; - int sz = sizeof(Cell); + //int sz = sizeof(Cell); if (ncells>m_clampCells) { static int numResets=0; diff --git a/Engine/lib/bullet/src/CMakeLists.txt b/Engine/lib/bullet/src/CMakeLists.txt index bbeabafbb..c30125c53 100644 --- a/Engine/lib/bullet/src/CMakeLists.txt +++ b/Engine/lib/bullet/src/CMakeLists.txt @@ -1,10 +1,10 @@ IF(BUILD_BULLET3) - SUBDIRS( Bullet3OpenCL Bullet3Serialize/Bullet2FileLoader Bullet3Dynamics Bullet3Collision Bullet3Geometry Bullet3Common ) - SUBDIRS( BulletInverseDynamics ) + SUBDIRS( Bullet3OpenCL Bullet3Serialize/Bullet2FileLoader Bullet3Dynamics Bullet3Collision Bullet3Geometry ) ENDIF(BUILD_BULLET3) -SUBDIRS( BulletSoftBody BulletCollision BulletDynamics LinearMath ) + +SUBDIRS( BulletInverseDynamics BulletSoftBody BulletCollision BulletDynamics LinearMath Bullet3Common) IF(INSTALL_LIBS) diff --git a/Engine/lib/bullet/src/LinearMath/CMakeLists.txt b/Engine/lib/bullet/src/LinearMath/CMakeLists.txt index 9c1980442..ede21d9a7 100644 --- a/Engine/lib/bullet/src/LinearMath/CMakeLists.txt +++ b/Engine/lib/bullet/src/LinearMath/CMakeLists.txt @@ -11,6 +11,7 @@ SET(LinearMath_SRCS btPolarDecomposition.cpp btQuickprof.cpp btSerializer.cpp + btSerializer64.cpp btThreads.cpp btVector3.cpp ) diff --git a/Engine/lib/bullet/src/LinearMath/btAlignedObjectArray.h b/Engine/lib/bullet/src/LinearMath/btAlignedObjectArray.h index 146ae72e8..f0b646529 100644 --- a/Engine/lib/bullet/src/LinearMath/btAlignedObjectArray.h +++ b/Engine/lib/bullet/src/LinearMath/btAlignedObjectArray.h @@ -475,16 +475,37 @@ protected: } return index; } + + // If the key is not in the array, return -1 instead of 0, + // since 0 also means the first element in the array. + int findLinearSearch2(const T& key) const + { + int index=-1; + int i; + + for (i=0;iedges = NULL; + v->next = v; + v->prev = v; + + result.minXy = v; + result.maxXy = v; + result.minYx = v; + result.maxYx = v; + } + + return; } - // lint -fallthrough + case 1: { Vertex* v = originalVertices[start]; diff --git a/Engine/lib/bullet/src/LinearMath/btHashMap.h b/Engine/lib/bullet/src/LinearMath/btHashMap.h index ca6f326b4..5e9cdb605 100644 --- a/Engine/lib/bullet/src/LinearMath/btHashMap.h +++ b/Engine/lib/bullet/src/LinearMath/btHashMap.h @@ -52,7 +52,7 @@ struct btHashString { int ret = 0 ; - while( ! (ret = *(unsigned char *)src - *(unsigned char *)dst) && *dst) + while( ! (ret = *(const unsigned char *)src - *(const unsigned char *)dst) && *dst) ++src, ++dst; if ( ret < 0 ) @@ -79,6 +79,11 @@ class btHashInt { int m_uid; public: + + btHashInt() + { + } + btHashInt(int uid) :m_uid(uid) { } @@ -100,9 +105,10 @@ public: //to our success SIMD_FORCE_INLINE unsigned int getHash()const { - int key = m_uid; + unsigned int key = m_uid; // Thomas Wang's hash key += ~(key << 15); key ^= (key >> 10); key += (key << 3); key ^= (key >> 6); key += ~(key << 11); key ^= (key >> 16); + return key; } }; @@ -115,7 +121,7 @@ class btHashPtr union { const void* m_pointer; - int m_hashValues[2]; + unsigned int m_hashValues[2]; }; public: @@ -140,8 +146,7 @@ public: { const bool VOID_IS_8 = ((sizeof(void*)==8)); - int key = VOID_IS_8? m_hashValues[0]+m_hashValues[1] : m_hashValues[0]; - + unsigned int key = VOID_IS_8? m_hashValues[0]+m_hashValues[1] : m_hashValues[0]; // Thomas Wang's hash key += ~(key << 15); key ^= (key >> 10); key += (key << 3); key ^= (key >> 6); key += ~(key << 11); key ^= (key >> 16); return key; @@ -174,7 +179,7 @@ public: //to our success SIMD_FORCE_INLINE unsigned int getHash()const { - int key = m_uid; + unsigned int key = m_uid; // Thomas Wang's hash key += ~(key << 15); key ^= (key >> 10); key += (key << 3); key ^= (key >> 6); key += ~(key << 11); key ^= (key >> 16); return key; @@ -206,7 +211,7 @@ public: //to our success SIMD_FORCE_INLINE unsigned int getHash()const { - int key = m_uid; + unsigned int key = m_uid; // Thomas Wang's hash key += ~(key << 15); key ^= (key >> 10); key += (key << 3); key ^= (key >> 6); key += ~(key << 11); key ^= (key >> 16); return key; @@ -384,28 +389,38 @@ protected: const Value* getAtIndex(int index) const { btAssert(index < m_valueArray.size()); - - return &m_valueArray[index]; + btAssert(index>=0); + if (index>=0 && index < m_valueArray.size()) + { + return &m_valueArray[index]; + } + return 0; } Value* getAtIndex(int index) { btAssert(index < m_valueArray.size()); - - return &m_valueArray[index]; + btAssert(index>=0); + if (index>=0 && index < m_valueArray.size()) + { + return &m_valueArray[index]; + } + return 0; } Key getKeyAtIndex(int index) { btAssert(index < m_keyArray.size()); - return m_keyArray[index]; + btAssert(index>=0); + return m_keyArray[index]; } const Key getKeyAtIndex(int index) const { btAssert(index < m_keyArray.size()); - return m_keyArray[index]; - } + btAssert(index>=0); + return m_keyArray[index]; + } Value* operator[](const Key& key) { diff --git a/Engine/lib/bullet/src/LinearMath/btIDebugDraw.h b/Engine/lib/bullet/src/LinearMath/btIDebugDraw.h index a020c3f4e..936aaa896 100644 --- a/Engine/lib/bullet/src/LinearMath/btIDebugDraw.h +++ b/Engine/lib/bullet/src/LinearMath/btIDebugDraw.h @@ -469,6 +469,10 @@ class btIDebugDraw drawLine(transform*pt2,transform*pt3,color); } + virtual void clearLines() + { + } + virtual void flushLines() { } diff --git a/Engine/lib/bullet/src/LinearMath/btMatrix3x3.h b/Engine/lib/bullet/src/LinearMath/btMatrix3x3.h index 40cd1e086..9f642a177 100644 --- a/Engine/lib/bullet/src/LinearMath/btMatrix3x3.h +++ b/Engine/lib/bullet/src/LinearMath/btMatrix3x3.h @@ -647,92 +647,49 @@ public: return m_el[0].z() * v.x() + m_el[1].z() * v.y() + m_el[2].z() * v.z(); } + ///extractRotation is from "A robust method to extract the rotational part of deformations" + ///See http://dl.acm.org/citation.cfm?doid=2994258.2994269 + SIMD_FORCE_INLINE void extractRotation(btQuaternion &q,btScalar tolerance = 1.0e-9, int maxIter=100) + { + int iter =0; + btScalar w; + const btMatrix3x3& A=*this; + for(iter = 0; iter < maxIter; iter++) + { + btMatrix3x3 R(q); + btVector3 omega = (R.getColumn(0).cross(A.getColumn(0)) + R.getColumn(1).cross(A.getColumn(1)) + + R.getColumn(2).cross(A.getColumn(2)) + ) * (btScalar(1.0) / btFabs(R.getColumn(0).dot(A.getColumn(0)) + R.getColumn + (1).dot(A.getColumn(1)) + R.getColumn(2).dot(A.getColumn(2))) + + tolerance); + w = omega.norm(); + if(w < tolerance) + break; + q = btQuaternion(btVector3((btScalar(1.0) / w) * omega),w) * + q; + q.normalize(); + } + } - /**@brief diagonalizes this matrix by the Jacobi method. + + + /**@brief diagonalizes this matrix * @param rot stores the rotation from the coordinate system in which the matrix is diagonal to the original * coordinate system, i.e., old_this = rot * new_this * rot^T. * @param threshold See iteration - * @param iteration The iteration stops when all off-diagonal elements are less than the threshold multiplied - * by the sum of the absolute values of the diagonal, or when maxSteps have been executed. - * - * Note that this matrix is assumed to be symmetric. + * @param maxIter The iteration stops when we hit the given tolerance or when maxIter have been executed. */ - void diagonalize(btMatrix3x3& rot, btScalar threshold, int maxSteps) + void diagonalize(btMatrix3x3& rot, btScalar tolerance = 1.0e-9, int maxIter=100) { - rot.setIdentity(); - for (int step = maxSteps; step > 0; step--) - { - // find off-diagonal element [p][q] with largest magnitude - int p = 0; - int q = 1; - int r = 2; - btScalar max = btFabs(m_el[0][1]); - btScalar v = btFabs(m_el[0][2]); - if (v > max) - { - q = 2; - r = 1; - max = v; - } - v = btFabs(m_el[1][2]); - if (v > max) - { - p = 1; - q = 2; - r = 0; - max = v; - } - - btScalar t = threshold * (btFabs(m_el[0][0]) + btFabs(m_el[1][1]) + btFabs(m_el[2][2])); - if (max <= t) - { - if (max <= SIMD_EPSILON * t) - { - return; - } - step = 1; - } - - // compute Jacobi rotation J which leads to a zero for element [p][q] - btScalar mpq = m_el[p][q]; - btScalar theta = (m_el[q][q] - m_el[p][p]) / (2 * mpq); - btScalar theta2 = theta * theta; - btScalar cos; - btScalar sin; - if (theta2 * theta2 < btScalar(10 / SIMD_EPSILON)) - { - t = (theta >= 0) ? 1 / (theta + btSqrt(1 + theta2)) - : 1 / (theta - btSqrt(1 + theta2)); - cos = 1 / btSqrt(1 + t * t); - sin = cos * t; - } - else - { - // approximation for large theta-value, i.e., a nearly diagonal matrix - t = 1 / (theta * (2 + btScalar(0.5) / theta2)); - cos = 1 - btScalar(0.5) * t * t; - sin = cos * t; - } - - // apply rotation to matrix (this = J^T * this * J) - m_el[p][q] = m_el[q][p] = 0; - m_el[p][p] -= t * mpq; - m_el[q][q] += t * mpq; - btScalar mrp = m_el[r][p]; - btScalar mrq = m_el[r][q]; - m_el[r][p] = m_el[p][r] = cos * mrp - sin * mrq; - m_el[r][q] = m_el[q][r] = cos * mrq + sin * mrp; - - // apply rotation to rot (rot = rot * J) - for (int i = 0; i < 3; i++) - { - btVector3& row = rot[i]; - mrp = row[p]; - mrq = row[q]; - row[p] = cos * mrp - sin * mrq; - row[q] = cos * mrq + sin * mrp; - } - } + btQuaternion r; + r = btQuaternion::getIdentity(); + extractRotation(r,tolerance,maxIter); + rot.setRotation(r); + btMatrix3x3 rotInv = btMatrix3x3(r.inverse()); + btMatrix3x3 old = *this; + setValue(old.tdotx( rotInv[0]), old.tdoty( rotInv[0]), old.tdotz( rotInv[0]), + old.tdotx( rotInv[1]), old.tdoty( rotInv[1]), old.tdotz( rotInv[1]), + old.tdotx( rotInv[2]), old.tdoty( rotInv[2]), old.tdotz( rotInv[2])); } diff --git a/Engine/lib/bullet/src/LinearMath/btQuaternion.h b/Engine/lib/bullet/src/LinearMath/btQuaternion.h index 32f0f85d2..7bd39e6a3 100644 --- a/Engine/lib/bullet/src/LinearMath/btQuaternion.h +++ b/Engine/lib/bullet/src/LinearMath/btQuaternion.h @@ -141,11 +141,11 @@ public: * @param yaw Angle around Z * @param pitch Angle around Y * @param roll Angle around X */ - void setEulerZYX(const btScalar& yaw, const btScalar& pitch, const btScalar& roll) + void setEulerZYX(const btScalar& yawZ, const btScalar& pitchY, const btScalar& rollX) { - btScalar halfYaw = btScalar(yaw) * btScalar(0.5); - btScalar halfPitch = btScalar(pitch) * btScalar(0.5); - btScalar halfRoll = btScalar(roll) * btScalar(0.5); + btScalar halfYaw = btScalar(yawZ) * btScalar(0.5); + btScalar halfPitch = btScalar(pitchY) * btScalar(0.5); + btScalar halfRoll = btScalar(rollX) * btScalar(0.5); btScalar cosYaw = btCos(halfYaw); btScalar sinYaw = btSin(halfYaw); btScalar cosPitch = btCos(halfPitch); @@ -157,6 +157,28 @@ public: cosRoll * cosPitch * sinYaw - sinRoll * sinPitch * cosYaw, //z cosRoll * cosPitch * cosYaw + sinRoll * sinPitch * sinYaw); //formerly yzx } + + /**@brief Get the euler angles from this quaternion + * @param yaw Angle around Z + * @param pitch Angle around Y + * @param roll Angle around X */ + void getEulerZYX(btScalar& yawZ, btScalar& pitchY, btScalar& rollX) const + { + btScalar squ; + btScalar sqx; + btScalar sqy; + btScalar sqz; + btScalar sarg; + sqx = m_floats[0] * m_floats[0]; + sqy = m_floats[1] * m_floats[1]; + sqz = m_floats[2] * m_floats[2]; + squ = m_floats[3] * m_floats[3]; + rollX = btAtan2(2 * (m_floats[1] * m_floats[2] + m_floats[3] * m_floats[0]), squ - sqx - sqy + sqz); + sarg = btScalar(-2.) * (m_floats[0] * m_floats[2] - m_floats[3] * m_floats[1]); + pitchY = sarg <= btScalar(-1.0) ? btScalar(-0.5) * SIMD_PI: (sarg >= btScalar(1.0) ? btScalar(0.5) * SIMD_PI : btAsin(sarg)); + yawZ = btAtan2(2 * (m_floats[0] * m_floats[1] + m_floats[3] * m_floats[2]), squ + sqx - sqy - sqz); + } + /**@brief Add two quaternions * @param q The quaternion to add to this one */ SIMD_FORCE_INLINE btQuaternion& operator+=(const btQuaternion& q) @@ -333,7 +355,15 @@ public: { return btSqrt(length2()); } - + btQuaternion& safeNormalize() + { + btScalar l2 = length2(); + if (l2>SIMD_EPSILON) + { + normalize(); + } + return *this; + } /**@brief Normalize the quaternion * Such that x^2 + y^2 + z^2 +w^2 = 1 */ btQuaternion& normalize() diff --git a/Engine/lib/bullet/src/LinearMath/btQuickprof.cpp b/Engine/lib/bullet/src/LinearMath/btQuickprof.cpp index f587770e8..aed3104a6 100644 --- a/Engine/lib/bullet/src/LinearMath/btQuickprof.cpp +++ b/Engine/lib/bullet/src/LinearMath/btQuickprof.cpp @@ -14,11 +14,9 @@ // Ogre (www.ogre3d.org). #include "btQuickprof.h" - - -#if BT_THREADSAFE #include "btThreads.h" -#endif //#if BT_THREADSAFE + + #ifdef __CELLOS_LV2__ @@ -30,6 +28,10 @@ #if defined (SUNOS) || defined (__SUNOS__) #include #endif +#ifdef __APPLE__ +#include +#include +#endif #if defined(WIN32) || defined(_WIN32) @@ -55,6 +57,12 @@ #else //_WIN32 #include + +#ifdef BT_LINUX_REALTIME +//required linking against rt (librt) +#include +#endif //BT_LINUX_REALTIME + #endif //_WIN32 #define mymin(a,b) (a > b ? a : b) @@ -65,12 +73,14 @@ struct btClockData #ifdef BT_USE_WINDOWS_TIMERS LARGE_INTEGER mClockFrequency; LONGLONG mStartTick; - LONGLONG mPrevElapsedTime; LARGE_INTEGER mStartTime; #else #ifdef __CELLOS_LV2__ uint64_t mStartTime; #else +#ifdef __APPLE__ + uint64_t mStartTimeNano; +#endif struct timeval mStartTime; #endif #endif //__CELLOS_LV2__ @@ -111,7 +121,6 @@ void btClock::reset() #ifdef BT_USE_WINDOWS_TIMERS QueryPerformanceCounter(&m_data->mStartTime); m_data->mStartTick = GetTickCount64(); - m_data->mPrevElapsedTime = 0; #else #ifdef __CELLOS_LV2__ @@ -121,6 +130,9 @@ void btClock::reset() SYS_TIMEBASE_GET( newTime ); m_data->mStartTime = newTime; #else +#ifdef __APPLE__ + m_data->mStartTimeNano = mach_absolute_time(); +#endif gettimeofday(&m_data->mStartTime, 0); #endif #endif @@ -128,7 +140,7 @@ void btClock::reset() /// Returns the time in ms since the last call to reset or since /// the btClock was created. -unsigned long int btClock::getTimeMilliseconds() +unsigned long long int btClock::getTimeMilliseconds() { #ifdef BT_USE_WINDOWS_TIMERS LARGE_INTEGER currentTime; @@ -138,27 +150,6 @@ unsigned long int btClock::getTimeMilliseconds() // Compute the number of millisecond ticks elapsed. unsigned long msecTicks = (unsigned long)(1000 * elapsedTime / m_data->mClockFrequency.QuadPart); - // Check for unexpected leaps in the Win32 performance counter. - // (This is caused by unexpected data across the PCI to ISA - // bridge, aka south bridge. See Microsoft KB274323.) - unsigned long elapsedTicks = (unsigned long)(GetTickCount64() - m_data->mStartTick); - signed long msecOff = (signed long)(msecTicks - elapsedTicks); - if (msecOff < -100 || msecOff > 100) - { - // Adjust the starting time forwards. - LONGLONG msecAdjustment = mymin(msecOff * - m_data->mClockFrequency.QuadPart / 1000, elapsedTime - - m_data->mPrevElapsedTime); - m_data->mStartTime.QuadPart += msecAdjustment; - elapsedTime -= msecAdjustment; - - // Recompute the number of millisecond ticks elapsed. - msecTicks = (unsigned long)(1000 * elapsedTime / - m_data->mClockFrequency.QuadPart); - } - - // Store the current elapsed time for adjustments next time. - m_data->mPrevElapsedTime = elapsedTime; return msecTicks; #else @@ -184,41 +175,19 @@ unsigned long int btClock::getTimeMilliseconds() /// Returns the time in us since the last call to reset or since /// the Clock was created. -unsigned long int btClock::getTimeMicroseconds() +unsigned long long int btClock::getTimeMicroseconds() { #ifdef BT_USE_WINDOWS_TIMERS - LARGE_INTEGER currentTime; + //see https://msdn.microsoft.com/en-us/library/windows/desktop/dn553408(v=vs.85).aspx + LARGE_INTEGER currentTime, elapsedTime; + QueryPerformanceCounter(¤tTime); - LONGLONG elapsedTime = currentTime.QuadPart - + elapsedTime.QuadPart = currentTime.QuadPart - m_data->mStartTime.QuadPart; + elapsedTime.QuadPart *= 1000000; + elapsedTime.QuadPart /= m_data->mClockFrequency.QuadPart; - // Compute the number of millisecond ticks elapsed. - unsigned long msecTicks = (unsigned long)(1000 * elapsedTime / - m_data->mClockFrequency.QuadPart); - - // Check for unexpected leaps in the Win32 performance counter. - // (This is caused by unexpected data across the PCI to ISA - // bridge, aka south bridge. See Microsoft KB274323.) - unsigned long elapsedTicks = (unsigned long)(GetTickCount64() - m_data->mStartTick); - signed long msecOff = (signed long)(msecTicks - elapsedTicks); - if (msecOff < -100 || msecOff > 100) - { - // Adjust the starting time forwards. - LONGLONG msecAdjustment = mymin(msecOff * - m_data->mClockFrequency.QuadPart / 1000, elapsedTime - - m_data->mPrevElapsedTime); - m_data->mStartTime.QuadPart += msecAdjustment; - elapsedTime -= msecAdjustment; - } - - // Store the current elapsed time for adjustments next time. - m_data->mPrevElapsedTime = elapsedTime; - - // Convert to microseconds. - unsigned long usecTicks = (unsigned long)(1000000 * elapsedTime / - m_data->mClockFrequency.QuadPart); - - return usecTicks; + return (unsigned long long) elapsedTime.QuadPart; #else #ifdef __CELLOS_LV2__ @@ -240,6 +209,66 @@ unsigned long int btClock::getTimeMicroseconds() #endif } +unsigned long long int btClock::getTimeNanoseconds() +{ +#ifdef BT_USE_WINDOWS_TIMERS + //see https://msdn.microsoft.com/en-us/library/windows/desktop/dn553408(v=vs.85).aspx + LARGE_INTEGER currentTime, elapsedTime; + + QueryPerformanceCounter(¤tTime); + elapsedTime.QuadPart = currentTime.QuadPart - + m_data->mStartTime.QuadPart; + elapsedTime.QuadPart *= 1000000000; + elapsedTime.QuadPart /= m_data->mClockFrequency.QuadPart; + + return (unsigned long long) elapsedTime.QuadPart; +#else + +#ifdef __CELLOS_LV2__ + uint64_t freq=sys_time_get_timebase_frequency(); + double dFreq=((double) freq)/ 1e9; + typedef uint64_t ClockSize; + ClockSize newTime; + //__asm __volatile__( "mftb %0" : "=r" (newTime) : : "memory"); + SYS_TIMEBASE_GET( newTime ); + + return (unsigned long int)((double(newTime-m_data->mStartTime)) / dFreq); +#else +#ifdef __APPLE__ + uint64_t ticks = mach_absolute_time() - m_data->mStartTimeNano; + static long double conversion = 0.0L; + if( 0.0L == conversion ) + { + // attempt to get conversion to nanoseconds + mach_timebase_info_data_t info; + int err = mach_timebase_info( &info ); + if( err ) + { + btAssert(0); + conversion = 1.; + } + conversion = info.numer / info.denom; + } + return (ticks * conversion); + + +#else//__APPLE__ + +#ifdef BT_LINUX_REALTIME + timespec ts; + clock_gettime(CLOCK_REALTIME,&ts); + return 1000000000*ts.tv_sec + ts.tv_nsec; +#else + struct timeval currentTime; + gettimeofday(¤tTime, 0); + return (currentTime.tv_sec - m_data->mStartTime.tv_sec) * 1e9 + + (currentTime.tv_usec - m_data->mStartTime.tv_usec)*1000; +#endif //BT_LINUX_REALTIME + +#endif//__APPLE__ +#endif//__CELLOS_LV2__ +#endif +} /// Returns the time in s since the last call to reset or since @@ -258,7 +287,7 @@ static btClock gProfileClock; inline void Profile_Get_Ticks(unsigned long int * ticks) { - *ticks = gProfileClock.getTimeMicroseconds(); + *ticks = (unsigned long int)gProfileClock.getTimeMicroseconds(); } inline float Profile_Get_Tick_Rate(void) @@ -370,6 +399,7 @@ bool CProfileNode::Return( void ) if ( --RecursionCounter == 0 && TotalCalls != 0 ) { unsigned long int time; Profile_Get_Ticks(&time); + time-=StartTime; TotalTime += (float)time / Profile_Get_Tick_Rate(); } @@ -437,11 +467,71 @@ void CProfileIterator::Enter_Parent( void ) ** ***************************************************************************************************/ -CProfileNode CProfileManager::Root( "Root", NULL ); -CProfileNode * CProfileManager::CurrentNode = &CProfileManager::Root; + + + +CProfileNode gRoots[BT_QUICKPROF_MAX_THREAD_COUNT]={ + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL), + CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL),CProfileNode("Root",NULL) +}; + + +CProfileNode* gCurrentNodes[BT_QUICKPROF_MAX_THREAD_COUNT]= +{ + &gRoots[ 0], &gRoots[ 1], &gRoots[ 2], &gRoots[ 3], + &gRoots[ 4], &gRoots[ 5], &gRoots[ 6], &gRoots[ 7], + &gRoots[ 8], &gRoots[ 9], &gRoots[10], &gRoots[11], + &gRoots[12], &gRoots[13], &gRoots[14], &gRoots[15], + &gRoots[16], &gRoots[17], &gRoots[18], &gRoots[19], + &gRoots[20], &gRoots[21], &gRoots[22], &gRoots[23], + &gRoots[24], &gRoots[25], &gRoots[26], &gRoots[27], + &gRoots[28], &gRoots[29], &gRoots[30], &gRoots[31], + &gRoots[32], &gRoots[33], &gRoots[34], &gRoots[35], + &gRoots[36], &gRoots[37], &gRoots[38], &gRoots[39], + &gRoots[40], &gRoots[41], &gRoots[42], &gRoots[43], + &gRoots[44], &gRoots[45], &gRoots[46], &gRoots[47], + &gRoots[48], &gRoots[49], &gRoots[50], &gRoots[51], + &gRoots[52], &gRoots[53], &gRoots[54], &gRoots[55], + &gRoots[56], &gRoots[57], &gRoots[58], &gRoots[59], + &gRoots[60], &gRoots[61], &gRoots[62], &gRoots[63], +}; + + int CProfileManager::FrameCounter = 0; unsigned long int CProfileManager::ResetTime = 0; +CProfileIterator * CProfileManager::Get_Iterator( void ) +{ + + int threadIndex = btQuickprofGetCurrentThreadIndex2(); + if ((threadIndex<0) || threadIndex >= BT_QUICKPROF_MAX_THREAD_COUNT) + return 0; + + return new CProfileIterator( &gRoots[threadIndex]); +} + +void CProfileManager::CleanupMemory(void) +{ + for (int i=0;iGet_Name()) { - CurrentNode = CurrentNode->Get_Sub_Node( name ); + int threadIndex = btQuickprofGetCurrentThreadIndex2(); + if ((threadIndex<0) || threadIndex >= BT_QUICKPROF_MAX_THREAD_COUNT) + return; + + if (name != gCurrentNodes[threadIndex]->Get_Name()) { + gCurrentNodes[threadIndex] = gCurrentNodes[threadIndex]->Get_Sub_Node( name ); } - CurrentNode->Call(); + gCurrentNodes[threadIndex]->Call(); } @@ -479,22 +565,22 @@ void CProfileManager::Start_Profile( const char * name ) *=============================================================================================*/ void CProfileManager::Stop_Profile( void ) { -#if BT_THREADSAFE - // profile system is not designed for profiling multiple threads - // disable collection on all but the main thread - if ( !btIsMainThread() ) - { - return; - } -#endif //#if BT_THREADSAFE + int threadIndex = btQuickprofGetCurrentThreadIndex2(); + if ((threadIndex<0) || threadIndex >= BT_QUICKPROF_MAX_THREAD_COUNT) + return; + // Return will indicate whether we should back up to our parent (we may // be profiling a recursive function) - if (CurrentNode->Return()) { - CurrentNode = CurrentNode->Get_Parent(); + if (gCurrentNodes[threadIndex]->Return()) { + gCurrentNodes[threadIndex] = gCurrentNodes[threadIndex]->Get_Parent(); } } + + + + /*********************************************************************************************** * CProfileManager::Reset -- Reset the contents of the profiling system * * * @@ -503,8 +589,11 @@ void CProfileManager::Stop_Profile( void ) void CProfileManager::Reset( void ) { gProfileClock.reset(); - Root.Reset(); - Root.Call(); + int threadIndex = btQuickprofGetCurrentThreadIndex2(); + if ((threadIndex<0) || threadIndex >= BT_QUICKPROF_MAX_THREAD_COUNT) + return; + gRoots[threadIndex].Reset(); + gRoots[threadIndex].Call(); FrameCounter = 0; Profile_Get_Ticks(&ResetTime); } @@ -594,4 +683,107 @@ void CProfileManager::dumpAll() +unsigned int btQuickprofGetCurrentThreadIndex2() +{ +#if BT_THREADSAFE + return btGetCurrentThreadIndex(); +#else // #if BT_THREADSAFE + const unsigned int kNullIndex = ~0U; +#ifdef _WIN32 + #if defined(__MINGW32__) || defined(__MINGW64__) + static __thread unsigned int sThreadIndex = kNullIndex; + #else + __declspec( thread ) static unsigned int sThreadIndex = kNullIndex; + #endif +#else +#ifdef __APPLE__ + #if TARGET_OS_IPHONE + unsigned int sThreadIndex = 0; + return -1; + #else + static __thread unsigned int sThreadIndex = kNullIndex; + #endif +#else//__APPLE__ +#if __linux__ + static __thread unsigned int sThreadIndex = kNullIndex; +#else + unsigned int sThreadIndex = 0; + return -1; +#endif +#endif//__APPLE__ + +#endif + static int gThreadCounter=0; + + if ( sThreadIndex == kNullIndex ) + { + sThreadIndex = gThreadCounter++; + } + return sThreadIndex; +#endif // #else // #if BT_THREADSAFE +} + +void btEnterProfileZoneDefault(const char* name) +{ + CProfileManager::Start_Profile( name ); +} +void btLeaveProfileZoneDefault() +{ + CProfileManager::Stop_Profile(); +} + + +#else +void btEnterProfileZoneDefault(const char* name) +{ +} +void btLeaveProfileZoneDefault() +{ +} #endif //BT_NO_PROFILE + + + + + +static btEnterProfileZoneFunc* bts_enterFunc = btEnterProfileZoneDefault; +static btLeaveProfileZoneFunc* bts_leaveFunc = btLeaveProfileZoneDefault; + +void btEnterProfileZone(const char* name) +{ + (bts_enterFunc)(name); +} +void btLeaveProfileZone() +{ + (bts_leaveFunc)(); +} + +btEnterProfileZoneFunc* btGetCurrentEnterProfileZoneFunc() +{ + return bts_enterFunc ; +} +btLeaveProfileZoneFunc* btGetCurrentLeaveProfileZoneFunc() +{ + return bts_leaveFunc; +} + + +void btSetCustomEnterProfileZoneFunc(btEnterProfileZoneFunc* enterFunc) +{ + bts_enterFunc = enterFunc; +} +void btSetCustomLeaveProfileZoneFunc(btLeaveProfileZoneFunc* leaveFunc) +{ + bts_leaveFunc = leaveFunc; +} + +CProfileSample::CProfileSample( const char * name ) +{ + btEnterProfileZone(name); +} + +CProfileSample::~CProfileSample( void ) +{ + btLeaveProfileZone(); +} + diff --git a/Engine/lib/bullet/src/LinearMath/btQuickprof.h b/Engine/lib/bullet/src/LinearMath/btQuickprof.h index 49545713b..7b38d71b9 100644 --- a/Engine/lib/bullet/src/LinearMath/btQuickprof.h +++ b/Engine/lib/bullet/src/LinearMath/btQuickprof.h @@ -36,12 +36,14 @@ public: /// Returns the time in ms since the last call to reset or since /// the btClock was created. - unsigned long int getTimeMilliseconds(); + unsigned long long int getTimeMilliseconds(); /// Returns the time in us since the last call to reset or since /// the Clock was created. - unsigned long int getTimeMicroseconds(); + unsigned long long int getTimeMicroseconds(); + unsigned long long int getTimeNanoseconds(); + /// Returns the time in s since the last call to reset or since /// the Clock was created. btScalar getTimeSeconds(); @@ -52,10 +54,28 @@ private: #endif //USE_BT_CLOCK +typedef void (btEnterProfileZoneFunc)(const char* msg); +typedef void (btLeaveProfileZoneFunc)(); +btEnterProfileZoneFunc* btGetCurrentEnterProfileZoneFunc(); +btLeaveProfileZoneFunc* btGetCurrentLeaveProfileZoneFunc(); + + + +void btSetCustomEnterProfileZoneFunc(btEnterProfileZoneFunc* enterFunc); +void btSetCustomLeaveProfileZoneFunc(btLeaveProfileZoneFunc* leaveFunc); + +#ifndef BT_NO_PROFILE // FIX redefinition //To disable built-in profiling, please comment out next line -#define BT_NO_PROFILE 1 +//#define BT_NO_PROFILE 1 +#endif //BT_NO_PROFILE + #ifndef BT_NO_PROFILE +//btQuickprofGetCurrentThreadIndex will return -1 if thread index cannot be determined, +//otherwise returns thread index in range [0..maxThreads] +unsigned int btQuickprofGetCurrentThreadIndex2(); +const unsigned int BT_QUICKPROF_MAX_THREAD_COUNT = 64; + #include //@todo remove this, backwards compatibility #include "btAlignedAllocator.h" @@ -151,21 +171,21 @@ public: static void Start_Profile( const char * name ); static void Stop_Profile( void ); - static void CleanupMemory(void) - { - Root.CleanupMemory(); - } + static void CleanupMemory(void); +// { +// Root.CleanupMemory(); +// } static void Reset( void ); static void Increment_Frame_Counter( void ); static int Get_Frame_Count_Since_Reset( void ) { return FrameCounter; } static float Get_Time_Since_Reset( void ); - static CProfileIterator * Get_Iterator( void ) - { - - return new CProfileIterator( &Root ); - } + static CProfileIterator * Get_Iterator( void ); +// { +// +// return new CProfileIterator( &Root ); +// } static void Release_Iterator( CProfileIterator * iterator ) { delete ( iterator); } static void dumpRecursive(CProfileIterator* profileIterator, int spacing); @@ -173,37 +193,27 @@ public: static void dumpAll(); private: - static CProfileNode Root; - static CProfileNode * CurrentNode; + static int FrameCounter; static unsigned long int ResetTime; }; + + +#endif //#ifndef BT_NO_PROFILE + ///ProfileSampleClass is a simple way to profile a function's scope ///Use the BT_PROFILE macro at the start of scope to time class CProfileSample { public: - CProfileSample( const char * name ) - { - CProfileManager::Start_Profile( name ); - } + CProfileSample( const char * name ); - ~CProfileSample( void ) - { - CProfileManager::Stop_Profile(); - } + ~CProfileSample( void ); }; - #define BT_PROFILE( name ) CProfileSample __profile( name ) -#else - -#define BT_PROFILE( name ) - -#endif //#ifndef BT_NO_PROFILE - #endif //BT_QUICK_PROF_H diff --git a/Engine/lib/bullet/src/LinearMath/btScalar.h b/Engine/lib/bullet/src/LinearMath/btScalar.h index df907e128..bffb2ce27 100644 --- a/Engine/lib/bullet/src/LinearMath/btScalar.h +++ b/Engine/lib/bullet/src/LinearMath/btScalar.h @@ -12,59 +12,76 @@ subject to the following restrictions: 3. This notice may not be removed or altered from any source distribution. */ - - #ifndef BT_SCALAR_H #define BT_SCALAR_H - #ifdef BT_MANAGED_CODE //Aligned data types not supported in managed code #pragma unmanaged #endif - #include -#include //size_t for MSVC 6.0 +#include //size_t for MSVC 6.0 #include /* SVN $Revision$ on $Date$ from http://bullet.googlecode.com*/ -#define BT_BULLET_VERSION 285 +#define BT_BULLET_VERSION 287 -inline int btGetVersion() +inline int btGetVersion() { return BT_BULLET_VERSION; } -#if defined(DEBUG) || defined (_DEBUG) -#define BT_DEBUG + +// The following macro "BT_NOT_EMPTY_FILE" can be put into a file +// in order suppress the MS Visual C++ Linker warning 4221 +// +// warning LNK4221: no public symbols found; archive member will be inaccessible +// +// This warning occurs on PC and XBOX when a file compiles out completely +// has no externally visible symbols which may be dependant on configuration +// #defines and options. +// +// see more https://stackoverflow.com/questions/1822887/what-is-the-best-way-to-eliminate-ms-visual-c-linker-warning-warning-lnk422 + +#if defined (_MSC_VER) + #define BT_NOT_EMPTY_FILE_CAT_II(p, res) res + #define BT_NOT_EMPTY_FILE_CAT_I(a, b) BT_NOT_EMPTY_FILE_CAT_II(~, a ## b) + #define BT_NOT_EMPTY_FILE_CAT(a, b) BT_NOT_EMPTY_FILE_CAT_I(a, b) + #define BT_NOT_EMPTY_FILE namespace { char BT_NOT_EMPTY_FILE_CAT(NoEmptyFileDummy, __COUNTER__); } +#else + #define BT_NOT_EMPTY_FILE #endif +// clang and most formatting tools don't support indentation of preprocessor guards, so turn it off +// clang-format off +#if defined(DEBUG) || defined (_DEBUG) + #define BT_DEBUG +#endif + #ifdef _WIN32 - - #if defined(__MINGW32__) || defined(__CYGWIN__) || (defined (_MSC_VER) && _MSC_VER < 1300) - - #define SIMD_FORCE_INLINE inline - #define ATTRIBUTE_ALIGNED16(a) a - #define ATTRIBUTE_ALIGNED64(a) a - #define ATTRIBUTE_ALIGNED128(a) a - #elif (_M_ARM) - #define SIMD_FORCE_INLINE __forceinline - #define ATTRIBUTE_ALIGNED16(a) __declspec() a - #define ATTRIBUTE_ALIGNED64(a) __declspec() a - #define ATTRIBUTE_ALIGNED128(a) __declspec () a - #else - //#define BT_HAS_ALIGNED_ALLOCATOR - #pragma warning(disable : 4324) // disable padding warning + #if defined(__MINGW32__) || defined(__CYGWIN__) || (defined (_MSC_VER) && _MSC_VER < 1300) + #define SIMD_FORCE_INLINE inline + #define ATTRIBUTE_ALIGNED16(a) a + #define ATTRIBUTE_ALIGNED64(a) a + #define ATTRIBUTE_ALIGNED128(a) a + #elif defined(_M_ARM) + #define SIMD_FORCE_INLINE __forceinline + #define ATTRIBUTE_ALIGNED16(a) __declspec() a + #define ATTRIBUTE_ALIGNED64(a) __declspec() a + #define ATTRIBUTE_ALIGNED128(a) __declspec () a + #else//__MINGW32__ + //#define BT_HAS_ALIGNED_ALLOCATOR + #pragma warning(disable : 4324) // disable padding warning // #pragma warning(disable:4530) // Disable the exception disable but used in MSCV Stl warning. - #pragma warning(disable:4996) //Turn off warnings about deprecated C routines + #pragma warning(disable:4996) //Turn off warnings about deprecated C routines // #pragma warning(disable:4786) // Disable the "debug name too long" warning - #define SIMD_FORCE_INLINE __forceinline - #define ATTRIBUTE_ALIGNED16(a) __declspec(align(16)) a - #define ATTRIBUTE_ALIGNED64(a) __declspec(align(64)) a - #define ATTRIBUTE_ALIGNED128(a) __declspec (align(128)) a + #define SIMD_FORCE_INLINE __forceinline + #define ATTRIBUTE_ALIGNED16(a) __declspec(align(16)) a + #define ATTRIBUTE_ALIGNED64(a) __declspec(align(64)) a + #define ATTRIBUTE_ALIGNED128(a) __declspec (align(128)) a #ifdef _XBOX #define BT_USE_VMX128 @@ -100,28 +117,28 @@ inline int btGetVersion() #endif//_XBOX - #endif //__MINGW32__ + #endif //__MINGW32__ -#ifdef BT_DEBUG - #ifdef _MSC_VER - #include - #define btAssert(x) { if(!(x)){printf("Assert "__FILE__ ":%u (%s)\n", __LINE__, #x);__debugbreak(); }} - #else//_MSC_VER - #include - #define btAssert assert - #endif//_MSC_VER -#else + #ifdef BT_DEBUG + #ifdef _MSC_VER + #include + #define btAssert(x) { if(!(x)){printf("Assert "__FILE__ ":%u (%s)\n", __LINE__, #x);__debugbreak(); }} + #else//_MSC_VER + #include + #define btAssert assert + #endif//_MSC_VER + #else #define btAssert(x) -#endif + #endif //btFullAssert is optional, slows down a lot #define btFullAssert(x) #define btLikely(_c) _c #define btUnlikely(_c) _c -#else +#else//_WIN32 -#if defined (__CELLOS_LV2__) + #if defined (__CELLOS_LV2__) #define SIMD_FORCE_INLINE inline __attribute__((always_inline)) #define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) #define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64))) @@ -129,217 +146,249 @@ inline int btGetVersion() #ifndef assert #include #endif -#ifdef BT_DEBUG -#ifdef __SPU__ -#include -#define printf spu_printf - #define btAssert(x) {if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n", __LINE__);spu_hcmpeq(0,0);}} -#else - #define btAssert assert -#endif + #ifdef BT_DEBUG + #ifdef __SPU__ + #include + #define printf spu_printf + #define btAssert(x) {if(!(x)){printf("Assert "__FILE__ ":%u ("#x")\n", __LINE__);spu_hcmpeq(0,0);}} + #else + #define btAssert assert + #endif -#else - #define btAssert(x) -#endif + #else//BT_DEBUG + #define btAssert(x) + #endif//BT_DEBUG //btFullAssert is optional, slows down a lot #define btFullAssert(x) #define btLikely(_c) _c #define btUnlikely(_c) _c -#else + #else//defined (__CELLOS_LV2__) -#ifdef USE_LIBSPE2 + #ifdef USE_LIBSPE2 - #define SIMD_FORCE_INLINE __inline - #define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) - #define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64))) - #define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128))) - #ifndef assert - #include - #endif -#ifdef BT_DEBUG - #define btAssert assert -#else - #define btAssert(x) -#endif - //btFullAssert is optional, slows down a lot - #define btFullAssert(x) + #define SIMD_FORCE_INLINE __inline + #define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) + #define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64))) + #define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128))) + #ifndef assert + #include + #endif + #ifdef BT_DEBUG + #define btAssert assert + #else + #define btAssert(x) + #endif + //btFullAssert is optional, slows down a lot + #define btFullAssert(x) - #define btLikely(_c) __builtin_expect((_c), 1) - #define btUnlikely(_c) __builtin_expect((_c), 0) + #define btLikely(_c) __builtin_expect((_c), 1) + #define btUnlikely(_c) __builtin_expect((_c), 0) -#else + #else//USE_LIBSPE2 //non-windows systems -#if (defined (__APPLE__) && (!defined (BT_USE_DOUBLE_PRECISION))) - #if defined (__i386__) || defined (__x86_64__) - #define BT_USE_SIMD_VECTOR3 - #define BT_USE_SSE - //BT_USE_SSE_IN_API is enabled on Mac OSX by default, because memory is automatically aligned on 16-byte boundaries - //if apps run into issues, we will disable the next line - #define BT_USE_SSE_IN_API - #ifdef BT_USE_SSE - // include appropriate SSE level - #if defined (__SSE4_1__) - #include - #elif defined (__SSSE3__) - #include - #elif defined (__SSE3__) - #include - #else - #include - #endif - #endif //BT_USE_SSE - #elif defined( __ARM_NEON__ ) - #ifdef __clang__ - #define BT_USE_NEON 1 - #define BT_USE_SIMD_VECTOR3 + #if (defined (__APPLE__) && (!defined (BT_USE_DOUBLE_PRECISION))) + #if defined (__i386__) || defined (__x86_64__) + #define BT_USE_SIMD_VECTOR3 + #define BT_USE_SSE + //BT_USE_SSE_IN_API is enabled on Mac OSX by default, because memory is automatically aligned on 16-byte boundaries + //if apps run into issues, we will disable the next line + #define BT_USE_SSE_IN_API + #ifdef BT_USE_SSE + // include appropriate SSE level + #if defined (__SSE4_1__) + #include + #elif defined (__SSSE3__) + #include + #elif defined (__SSE3__) + #include + #else + #include + #endif + #endif //BT_USE_SSE + #elif defined( __ARM_NEON__ ) + #ifdef __clang__ + #define BT_USE_NEON 1 + #define BT_USE_SIMD_VECTOR3 - #if defined BT_USE_NEON && defined (__clang__) - #include - #endif//BT_USE_NEON - #endif //__clang__ - #endif//__arm__ + #if defined BT_USE_NEON && defined (__clang__) + #include + #endif//BT_USE_NEON + #endif //__clang__ + #endif//__arm__ - #define SIMD_FORCE_INLINE inline __attribute__ ((always_inline)) -///@todo: check out alignment methods for other platforms/compilers - #define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) - #define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64))) - #define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128))) - #ifndef assert - #include - #endif + #define SIMD_FORCE_INLINE inline __attribute__ ((always_inline)) + ///@todo: check out alignment methods for other platforms/compilers + #define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) + #define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64))) + #define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128))) + #ifndef assert + #include + #endif - #if defined(DEBUG) || defined (_DEBUG) - #if defined (__i386__) || defined (__x86_64__) - #include - #define btAssert(x)\ - {\ - if(!(x))\ - {\ - printf("Assert %s in line %d, file %s\n",#x, __LINE__, __FILE__);\ - asm volatile ("int3");\ - }\ - } - #else//defined (__i386__) || defined (__x86_64__) - #define btAssert assert - #endif//defined (__i386__) || defined (__x86_64__) - #else//defined(DEBUG) || defined (_DEBUG) - #define btAssert(x) - #endif//defined(DEBUG) || defined (_DEBUG) + #if defined(DEBUG) || defined (_DEBUG) + #if defined (__i386__) || defined (__x86_64__) + #include + #define btAssert(x)\ + {\ + if(!(x))\ + {\ + printf("Assert %s in line %d, file %s\n",#x, __LINE__, __FILE__);\ + asm volatile ("int3");\ + }\ + } + #else//defined (__i386__) || defined (__x86_64__) + #define btAssert assert + #endif//defined (__i386__) || defined (__x86_64__) + #else//defined(DEBUG) || defined (_DEBUG) + #define btAssert(x) + #endif//defined(DEBUG) || defined (_DEBUG) - //btFullAssert is optional, slows down a lot - #define btFullAssert(x) - #define btLikely(_c) _c - #define btUnlikely(_c) _c + //btFullAssert is optional, slows down a lot + #define btFullAssert(x) + #define btLikely(_c) _c + #define btUnlikely(_c) _c -#else + #else//__APPLE__ - #define SIMD_FORCE_INLINE inline - ///@todo: check out alignment methods for other platforms/compilers - ///#define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) - ///#define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64))) - ///#define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128))) - #define ATTRIBUTE_ALIGNED16(a) a - #define ATTRIBUTE_ALIGNED64(a) a - #define ATTRIBUTE_ALIGNED128(a) a - #ifndef assert - #include - #endif + #define SIMD_FORCE_INLINE inline + ///@todo: check out alignment methods for other platforms/compilers + ///#define ATTRIBUTE_ALIGNED16(a) a __attribute__ ((aligned (16))) + ///#define ATTRIBUTE_ALIGNED64(a) a __attribute__ ((aligned (64))) + ///#define ATTRIBUTE_ALIGNED128(a) a __attribute__ ((aligned (128))) + #define ATTRIBUTE_ALIGNED16(a) a + #define ATTRIBUTE_ALIGNED64(a) a + #define ATTRIBUTE_ALIGNED128(a) a + #ifndef assert + #include + #endif -#if defined(DEBUG) || defined (_DEBUG) - #define btAssert assert -#else - #define btAssert(x) -#endif + #if defined(DEBUG) || defined (_DEBUG) + #define btAssert assert + #else + #define btAssert(x) + #endif - //btFullAssert is optional, slows down a lot - #define btFullAssert(x) - #define btLikely(_c) _c - #define btUnlikely(_c) _c -#endif //__APPLE__ - -#endif // LIBSPE2 - -#endif //__CELLOS_LV2__ -#endif + //btFullAssert is optional, slows down a lot + #define btFullAssert(x) + #define btLikely(_c) _c + #define btUnlikely(_c) _c + #endif //__APPLE__ + #endif // LIBSPE2 + #endif //__CELLOS_LV2__ +#endif//_WIN32 ///The btScalar type abstracts floating point numbers, to easily switch between double and single floating point precision. #if defined(BT_USE_DOUBLE_PRECISION) - -typedef double btScalar; -//this number could be bigger in double precision -#define BT_LARGE_FLOAT 1e30 + typedef double btScalar; + //this number could be bigger in double precision + #define BT_LARGE_FLOAT 1e30 #else - -typedef float btScalar; -//keep BT_LARGE_FLOAT*BT_LARGE_FLOAT < FLT_MAX -#define BT_LARGE_FLOAT 1e18f + typedef float btScalar; + //keep BT_LARGE_FLOAT*BT_LARGE_FLOAT < FLT_MAX + #define BT_LARGE_FLOAT 1e18f #endif #ifdef BT_USE_SSE -typedef __m128 btSimdFloat4; -#endif//BT_USE_SSE + typedef __m128 btSimdFloat4; +#endif //BT_USE_SSE -#if defined (BT_USE_SSE) -//#if defined BT_USE_SSE_IN_API && defined (BT_USE_SSE) -#ifdef _WIN32 +#if defined(BT_USE_SSE) + //#if defined BT_USE_SSE_IN_API && defined (BT_USE_SSE) + #ifdef _WIN32 -#ifndef BT_NAN -static int btNanMask = 0x7F800001; -#define BT_NAN (*(float*)&btNanMask) -#endif + #ifndef BT_NAN + static int btNanMask = 0x7F800001; + #define BT_NAN (*(float *)&btNanMask) + #endif -#ifndef BT_INFINITY -static int btInfinityMask = 0x7F800000; -#define BT_INFINITY (*(float*)&btInfinityMask) -inline int btGetInfinityMask()//suppress stupid compiler warning -{ - return btInfinityMask; -} -#endif + #ifndef BT_INFINITY + static int btInfinityMask = 0x7F800000; + #define BT_INFINITY (*(float *)&btInfinityMask) + inline int btGetInfinityMask() //suppress stupid compiler warning + { + return btInfinityMask; + } + #endif -//use this, in case there are clashes (such as xnamath.h) -#ifndef BT_NO_SIMD_OPERATOR_OVERLOADS -inline __m128 operator + (const __m128 A, const __m128 B) -{ - return _mm_add_ps(A, B); -} -inline __m128 operator - (const __m128 A, const __m128 B) -{ - return _mm_sub_ps(A, B); -} -inline __m128 operator * (const __m128 A, const __m128 B) -{ - return _mm_mul_ps(A, B); -} -#endif //BT_NO_SIMD_OPERATOR_OVERLOADS + //use this, in case there are clashes (such as xnamath.h) + #ifndef BT_NO_SIMD_OPERATOR_OVERLOADS + inline __m128 operator+(const __m128 A, const __m128 B) + { + return _mm_add_ps(A, B); + } -#define btCastfTo128i(a) (_mm_castps_si128(a)) -#define btCastfTo128d(a) (_mm_castps_pd(a)) -#define btCastiTo128f(a) (_mm_castsi128_ps(a)) -#define btCastdTo128f(a) (_mm_castpd_ps(a)) -#define btCastdTo128i(a) (_mm_castpd_si128(a)) -#define btAssign128(r0,r1,r2,r3) _mm_setr_ps(r0,r1,r2,r3) + inline __m128 operator-(const __m128 A, const __m128 B) + { + return _mm_sub_ps(A, B); + } -#else//_WIN32 + inline __m128 operator*(const __m128 A, const __m128 B) + { + return _mm_mul_ps(A, B); + } + #endif //BT_NO_SIMD_OPERATOR_OVERLOADS -#define btCastfTo128i(a) ((__m128i)(a)) -#define btCastfTo128d(a) ((__m128d)(a)) -#define btCastiTo128f(a) ((__m128) (a)) -#define btCastdTo128f(a) ((__m128) (a)) -#define btCastdTo128i(a) ((__m128i)(a)) -#define btAssign128(r0,r1,r2,r3) (__m128){r0,r1,r2,r3} -#define BT_INFINITY INFINITY -#define BT_NAN NAN -#endif//_WIN32 -#else + #define btCastfTo128i(a) (_mm_castps_si128(a)) + #define btCastfTo128d(a) (_mm_castps_pd(a)) + #define btCastiTo128f(a) (_mm_castsi128_ps(a)) + #define btCastdTo128f(a) (_mm_castpd_ps(a)) + #define btCastdTo128i(a) (_mm_castpd_si128(a)) + #define btAssign128(r0, r1, r2, r3) _mm_setr_ps(r0, r1, r2, r3) + + #else //_WIN32 + + #define btCastfTo128i(a) ((__m128i)(a)) + #define btCastfTo128d(a) ((__m128d)(a)) + #define btCastiTo128f(a) ((__m128)(a)) + #define btCastdTo128f(a) ((__m128)(a)) + #define btCastdTo128i(a) ((__m128i)(a)) + #define btAssign128(r0, r1, r2, r3) \ + (__m128) { r0, r1, r2, r3 } + #define BT_INFINITY INFINITY + #define BT_NAN NAN + #endif //_WIN32 +#else//BT_USE_SSE + + #ifdef BT_USE_NEON + #include + + typedef float32x4_t btSimdFloat4; + #define BT_INFINITY INFINITY + #define BT_NAN NAN + #define btAssign128(r0, r1, r2, r3) \ + (float32x4_t) { r0, r1, r2, r3 } + #else //BT_USE_NEON + + #ifndef BT_INFINITY + struct btInfMaskConverter + { + union { + float mask; + int intmask; + }; + btInfMaskConverter(int _mask = 0x7F800000) + : intmask(_mask) + { + } + }; + static btInfMaskConverter btInfinityMask = 0x7F800000; + #define BT_INFINITY (btInfinityMask.mask) + inline int btGetInfinityMask() //suppress stupid compiler warning + { + return btInfinityMask.intmask; + } + #endif + #endif //BT_USE_NEON + +#endif //BT_USE_SSE #ifdef BT_USE_NEON #include @@ -347,193 +396,181 @@ inline __m128 operator * (const __m128 A, const __m128 B) typedef float32x4_t btSimdFloat4; #define BT_INFINITY INFINITY #define BT_NAN NAN - #define btAssign128(r0,r1,r2,r3) (float32x4_t){r0,r1,r2,r3} -#else//BT_USE_NEON - - #ifndef BT_INFINITY - struct btInfMaskConverter - { - union { - float mask; - int intmask; - }; - btInfMaskConverter(int mask=0x7F800000) - :intmask(mask) - { - } - }; - static btInfMaskConverter btInfinityMask = 0x7F800000; - #define BT_INFINITY (btInfinityMask.mask) - inline int btGetInfinityMask()//suppress stupid compiler warning - { - return btInfinityMask.intmask; - } - #endif + #define btAssign128(r0, r1, r2, r3) \ + (float32x4_t) { r0, r1, r2, r3 } #endif//BT_USE_NEON -#endif //BT_USE_SSE - -#ifdef BT_USE_NEON -#include - -typedef float32x4_t btSimdFloat4; -#define BT_INFINITY INFINITY -#define BT_NAN NAN -#define btAssign128(r0,r1,r2,r3) (float32x4_t){r0,r1,r2,r3} -#endif - - - - - -#define BT_DECLARE_ALIGNED_ALLOCATOR() \ - SIMD_FORCE_INLINE void* operator new(size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes,16); } \ - SIMD_FORCE_INLINE void operator delete(void* ptr) { btAlignedFree(ptr); } \ - SIMD_FORCE_INLINE void* operator new(size_t, void* ptr) { return ptr; } \ - SIMD_FORCE_INLINE void operator delete(void*, void*) { } \ - SIMD_FORCE_INLINE void* operator new[](size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes,16); } \ - SIMD_FORCE_INLINE void operator delete[](void* ptr) { btAlignedFree(ptr); } \ - SIMD_FORCE_INLINE void* operator new[](size_t, void* ptr) { return ptr; } \ - SIMD_FORCE_INLINE void operator delete[](void*, void*) { } \ - - +#define BT_DECLARE_ALIGNED_ALLOCATOR() \ + SIMD_FORCE_INLINE void *operator new(size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes, 16); } \ + SIMD_FORCE_INLINE void operator delete(void *ptr) { btAlignedFree(ptr); } \ + SIMD_FORCE_INLINE void *operator new(size_t, void *ptr) { return ptr; } \ + SIMD_FORCE_INLINE void operator delete(void *, void *) {} \ + SIMD_FORCE_INLINE void *operator new[](size_t sizeInBytes) { return btAlignedAlloc(sizeInBytes, 16); } \ + SIMD_FORCE_INLINE void operator delete[](void *ptr) { btAlignedFree(ptr); } \ + SIMD_FORCE_INLINE void *operator new[](size_t, void *ptr) { return ptr; } \ + SIMD_FORCE_INLINE void operator delete[](void *, void *) {} #if defined(BT_USE_DOUBLE_PRECISION) || defined(BT_FORCE_DOUBLE_FUNCTIONS) - -SIMD_FORCE_INLINE btScalar btSqrt(btScalar x) { return sqrt(x); } -SIMD_FORCE_INLINE btScalar btFabs(btScalar x) { return fabs(x); } -SIMD_FORCE_INLINE btScalar btCos(btScalar x) { return cos(x); } -SIMD_FORCE_INLINE btScalar btSin(btScalar x) { return sin(x); } -SIMD_FORCE_INLINE btScalar btTan(btScalar x) { return tan(x); } -SIMD_FORCE_INLINE btScalar btAcos(btScalar x) { if (xbtScalar(1)) x=btScalar(1); return acos(x); } -SIMD_FORCE_INLINE btScalar btAsin(btScalar x) { if (xbtScalar(1)) x=btScalar(1); return asin(x); } -SIMD_FORCE_INLINE btScalar btAtan(btScalar x) { return atan(x); } -SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y) { return atan2(x, y); } -SIMD_FORCE_INLINE btScalar btExp(btScalar x) { return exp(x); } -SIMD_FORCE_INLINE btScalar btLog(btScalar x) { return log(x); } -SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return pow(x,y); } -SIMD_FORCE_INLINE btScalar btFmod(btScalar x,btScalar y) { return fmod(x,y); } -#else - -SIMD_FORCE_INLINE btScalar btSqrt(btScalar y) -{ -#ifdef USE_APPROXIMATION -#ifdef __LP64__ - float xhalf = 0.5f*y; - int i = *(int*)&y; - i = 0x5f375a86 - (i>>1); - y = *(float*)&i; - y = y*(1.5f - xhalf*y*y); - y = y*(1.5f - xhalf*y*y); - y = y*(1.5f - xhalf*y*y); - y=1/y; - return y; -#else - double x, z, tempf; - unsigned long *tfptr = ((unsigned long *)&tempf) + 1; - tempf = y; - *tfptr = (0xbfcdd90a - *tfptr)>>1; /* estimate of 1/sqrt(y) */ - x = tempf; - z = y*btScalar(0.5); - x = (btScalar(1.5)*x)-(x*x)*(x*z); /* iteration formula */ - x = (btScalar(1.5)*x)-(x*x)*(x*z); - x = (btScalar(1.5)*x)-(x*x)*(x*z); - x = (btScalar(1.5)*x)-(x*x)*(x*z); - x = (btScalar(1.5)*x)-(x*x)*(x*z); - return x*y; -#endif -#else - return sqrtf(y); -#endif -} -SIMD_FORCE_INLINE btScalar btFabs(btScalar x) { return fabsf(x); } -SIMD_FORCE_INLINE btScalar btCos(btScalar x) { return cosf(x); } -SIMD_FORCE_INLINE btScalar btSin(btScalar x) { return sinf(x); } -SIMD_FORCE_INLINE btScalar btTan(btScalar x) { return tanf(x); } -SIMD_FORCE_INLINE btScalar btAcos(btScalar x) { - if (xbtScalar(1)) - x=btScalar(1); - return acosf(x); -} -SIMD_FORCE_INLINE btScalar btAsin(btScalar x) { - if (xbtScalar(1)) - x=btScalar(1); - return asinf(x); -} -SIMD_FORCE_INLINE btScalar btAtan(btScalar x) { return atanf(x); } -SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y) { return atan2f(x, y); } -SIMD_FORCE_INLINE btScalar btExp(btScalar x) { return expf(x); } -SIMD_FORCE_INLINE btScalar btLog(btScalar x) { return logf(x); } -SIMD_FORCE_INLINE btScalar btPow(btScalar x,btScalar y) { return powf(x,y); } -SIMD_FORCE_INLINE btScalar btFmod(btScalar x,btScalar y) { return fmodf(x,y); } - -#endif + SIMD_FORCE_INLINE btScalar btSqrt(btScalar x) + { + return sqrt(x); + } + SIMD_FORCE_INLINE btScalar btFabs(btScalar x) { return fabs(x); } + SIMD_FORCE_INLINE btScalar btCos(btScalar x) { return cos(x); } + SIMD_FORCE_INLINE btScalar btSin(btScalar x) { return sin(x); } + SIMD_FORCE_INLINE btScalar btTan(btScalar x) { return tan(x); } + SIMD_FORCE_INLINE btScalar btAcos(btScalar x) + { + if (x < btScalar(-1)) x = btScalar(-1); + if (x > btScalar(1)) x = btScalar(1); + return acos(x); + } + SIMD_FORCE_INLINE btScalar btAsin(btScalar x) + { + if (x < btScalar(-1)) x = btScalar(-1); + if (x > btScalar(1)) x = btScalar(1); + return asin(x); + } + SIMD_FORCE_INLINE btScalar btAtan(btScalar x) { return atan(x); } + SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y) { return atan2(x, y); } + SIMD_FORCE_INLINE btScalar btExp(btScalar x) { return exp(x); } + SIMD_FORCE_INLINE btScalar btLog(btScalar x) { return log(x); } + SIMD_FORCE_INLINE btScalar btPow(btScalar x, btScalar y) { return pow(x, y); } + SIMD_FORCE_INLINE btScalar btFmod(btScalar x, btScalar y) { return fmod(x, y); } -#define SIMD_PI btScalar(3.1415926535897932384626433832795029) -#define SIMD_2_PI (btScalar(2.0) * SIMD_PI) -#define SIMD_HALF_PI (SIMD_PI * btScalar(0.5)) +#else//BT_USE_DOUBLE_PRECISION + + SIMD_FORCE_INLINE btScalar btSqrt(btScalar y) + { + #ifdef USE_APPROXIMATION + #ifdef __LP64__ + float xhalf = 0.5f * y; + int i = *(int *)&y; + i = 0x5f375a86 - (i >> 1); + y = *(float *)&i; + y = y * (1.5f - xhalf * y * y); + y = y * (1.5f - xhalf * y * y); + y = y * (1.5f - xhalf * y * y); + y = 1 / y; + return y; + #else + double x, z, tempf; + unsigned long *tfptr = ((unsigned long *)&tempf) + 1; + tempf = y; + *tfptr = (0xbfcdd90a - *tfptr) >> 1; /* estimate of 1/sqrt(y) */ + x = tempf; + z = y * btScalar(0.5); + x = (btScalar(1.5) * x) - (x * x) * (x * z); /* iteration formula */ + x = (btScalar(1.5) * x) - (x * x) * (x * z); + x = (btScalar(1.5) * x) - (x * x) * (x * z); + x = (btScalar(1.5) * x) - (x * x) * (x * z); + x = (btScalar(1.5) * x) - (x * x) * (x * z); + return x * y; + #endif + #else + return sqrtf(y); + #endif + } + SIMD_FORCE_INLINE btScalar btFabs(btScalar x) { return fabsf(x); } + SIMD_FORCE_INLINE btScalar btCos(btScalar x) { return cosf(x); } + SIMD_FORCE_INLINE btScalar btSin(btScalar x) { return sinf(x); } + SIMD_FORCE_INLINE btScalar btTan(btScalar x) { return tanf(x); } + SIMD_FORCE_INLINE btScalar btAcos(btScalar x) + { + if (x < btScalar(-1)) + x = btScalar(-1); + if (x > btScalar(1)) + x = btScalar(1); + return acosf(x); + } + SIMD_FORCE_INLINE btScalar btAsin(btScalar x) + { + if (x < btScalar(-1)) + x = btScalar(-1); + if (x > btScalar(1)) + x = btScalar(1); + return asinf(x); + } + SIMD_FORCE_INLINE btScalar btAtan(btScalar x) { return atanf(x); } + SIMD_FORCE_INLINE btScalar btAtan2(btScalar x, btScalar y) { return atan2f(x, y); } + SIMD_FORCE_INLINE btScalar btExp(btScalar x) { return expf(x); } + SIMD_FORCE_INLINE btScalar btLog(btScalar x) { return logf(x); } + SIMD_FORCE_INLINE btScalar btPow(btScalar x, btScalar y) { return powf(x, y); } + SIMD_FORCE_INLINE btScalar btFmod(btScalar x, btScalar y) { return fmodf(x, y); } + +#endif//BT_USE_DOUBLE_PRECISION + +#define SIMD_PI btScalar(3.1415926535897932384626433832795029) +#define SIMD_2_PI (btScalar(2.0) * SIMD_PI) +#define SIMD_HALF_PI (SIMD_PI * btScalar(0.5)) #define SIMD_RADS_PER_DEG (SIMD_2_PI / btScalar(360.0)) -#define SIMD_DEGS_PER_RAD (btScalar(360.0) / SIMD_2_PI) +#define SIMD_DEGS_PER_RAD (btScalar(360.0) / SIMD_2_PI) #define SIMDSQRT12 btScalar(0.7071067811865475244008443621048490) - -#define btRecipSqrt(x) ((btScalar)(btScalar(1.0)/btSqrt(btScalar(x)))) /* reciprocal square root */ -#define btRecip(x) (btScalar(1.0)/btScalar(x)) +#define btRecipSqrt(x) ((btScalar)(btScalar(1.0) / btSqrt(btScalar(x)))) /* reciprocal square root */ +#define btRecip(x) (btScalar(1.0) / btScalar(x)) #ifdef BT_USE_DOUBLE_PRECISION -#define SIMD_EPSILON DBL_EPSILON -#define SIMD_INFINITY DBL_MAX -#define BT_ONE 1.0 -#define BT_ZERO 0.0 -#define BT_TWO 2.0 -#define BT_HALF 0.5 + #define SIMD_EPSILON DBL_EPSILON + #define SIMD_INFINITY DBL_MAX + #define BT_ONE 1.0 + #define BT_ZERO 0.0 + #define BT_TWO 2.0 + #define BT_HALF 0.5 #else -#define SIMD_EPSILON FLT_EPSILON -#define SIMD_INFINITY FLT_MAX -#define BT_ONE 1.0f -#define BT_ZERO 0.0f -#define BT_TWO 2.0f -#define BT_HALF 0.5f + #define SIMD_EPSILON FLT_EPSILON + #define SIMD_INFINITY FLT_MAX + #define BT_ONE 1.0f + #define BT_ZERO 0.0f + #define BT_TWO 2.0f + #define BT_HALF 0.5f #endif -SIMD_FORCE_INLINE btScalar btAtan2Fast(btScalar y, btScalar x) +// clang-format on + +SIMD_FORCE_INLINE btScalar btAtan2Fast(btScalar y, btScalar x) { btScalar coeff_1 = SIMD_PI / 4.0f; btScalar coeff_2 = 3.0f * coeff_1; btScalar abs_y = btFabs(y); btScalar angle; - if (x >= 0.0f) { + if (x >= 0.0f) + { btScalar r = (x - abs_y) / (x + abs_y); angle = coeff_1 - coeff_1 * r; - } else { + } + else + { btScalar r = (x + abs_y) / (abs_y - x); angle = coeff_2 - coeff_1 * r; } return (y < 0.0f) ? -angle : angle; } -SIMD_FORCE_INLINE bool btFuzzyZero(btScalar x) { return btFabs(x) < SIMD_EPSILON; } +SIMD_FORCE_INLINE bool btFuzzyZero(btScalar x) { return btFabs(x) < SIMD_EPSILON; } -SIMD_FORCE_INLINE bool btEqual(btScalar a, btScalar eps) { +SIMD_FORCE_INLINE bool btEqual(btScalar a, btScalar eps) +{ return (((a) <= eps) && !((a) < -eps)); } -SIMD_FORCE_INLINE bool btGreaterEqual (btScalar a, btScalar eps) { +SIMD_FORCE_INLINE bool btGreaterEqual(btScalar a, btScalar eps) +{ return (!((a) <= eps)); } - -SIMD_FORCE_INLINE int btIsNegative(btScalar x) { - return x < btScalar(0.0) ? 1 : 0; +SIMD_FORCE_INLINE int btIsNegative(btScalar x) +{ + return x < btScalar(0.0) ? 1 : 0; } SIMD_FORCE_INLINE btScalar btRadians(btScalar x) { return x * SIMD_RADS_PER_DEG; } SIMD_FORCE_INLINE btScalar btDegrees(btScalar x) { return x * SIMD_DEGS_PER_RAD; } -#define BT_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name +#define BT_DECLARE_HANDLE(name) \ + typedef struct name##__ \ + { \ + int unused; \ + } * name #ifndef btFsel SIMD_FORCE_INLINE btScalar btFsel(btScalar a, btScalar b, btScalar c) @@ -541,60 +578,57 @@ SIMD_FORCE_INLINE btScalar btFsel(btScalar a, btScalar b, btScalar c) return a >= 0 ? b : c; } #endif -#define btFsels(a,b,c) (btScalar)btFsel(a,b,c) - +#define btFsels(a, b, c) (btScalar) btFsel(a, b, c) SIMD_FORCE_INLINE bool btMachineIsLittleEndian() { - long int i = 1; - const char *p = (const char *) &i; - if (p[0] == 1) // Lowest address contains the least significant byte - return true; - else - return false; + long int i = 1; + const char *p = (const char *)&i; + if (p[0] == 1) // Lowest address contains the least significant byte + return true; + else + return false; } - - ///btSelect avoids branches, which makes performance much better for consoles like Playstation 3 and XBox 360 ///Thanks Phil Knight. See also http://www.cellperformance.com/articles/2006/04/more_techniques_for_eliminatin_1.html -SIMD_FORCE_INLINE unsigned btSelect(unsigned condition, unsigned valueIfConditionNonZero, unsigned valueIfConditionZero) +SIMD_FORCE_INLINE unsigned btSelect(unsigned condition, unsigned valueIfConditionNonZero, unsigned valueIfConditionZero) { - // Set testNz to 0xFFFFFFFF if condition is nonzero, 0x00000000 if condition is zero - // Rely on positive value or'ed with its negative having sign bit on - // and zero value or'ed with its negative (which is still zero) having sign bit off - // Use arithmetic shift right, shifting the sign bit through all 32 bits - unsigned testNz = (unsigned)(((int)condition | -(int)condition) >> 31); - unsigned testEqz = ~testNz; - return ((valueIfConditionNonZero & testNz) | (valueIfConditionZero & testEqz)); + // Set testNz to 0xFFFFFFFF if condition is nonzero, 0x00000000 if condition is zero + // Rely on positive value or'ed with its negative having sign bit on + // and zero value or'ed with its negative (which is still zero) having sign bit off + // Use arithmetic shift right, shifting the sign bit through all 32 bits + unsigned testNz = (unsigned)(((int)condition | -(int)condition) >> 31); + unsigned testEqz = ~testNz; + return ((valueIfConditionNonZero & testNz) | (valueIfConditionZero & testEqz)); } SIMD_FORCE_INLINE int btSelect(unsigned condition, int valueIfConditionNonZero, int valueIfConditionZero) { - unsigned testNz = (unsigned)(((int)condition | -(int)condition) >> 31); - unsigned testEqz = ~testNz; - return static_cast((valueIfConditionNonZero & testNz) | (valueIfConditionZero & testEqz)); + unsigned testNz = (unsigned)(((int)condition | -(int)condition) >> 31); + unsigned testEqz = ~testNz; + return static_cast((valueIfConditionNonZero & testNz) | (valueIfConditionZero & testEqz)); } SIMD_FORCE_INLINE float btSelect(unsigned condition, float valueIfConditionNonZero, float valueIfConditionZero) { #ifdef BT_HAVE_NATIVE_FSEL - return (float)btFsel((btScalar)condition - btScalar(1.0f), valueIfConditionNonZero, valueIfConditionZero); + return (float)btFsel((btScalar)condition - btScalar(1.0f), valueIfConditionNonZero, valueIfConditionZero); #else - return (condition != 0) ? valueIfConditionNonZero : valueIfConditionZero; + return (condition != 0) ? valueIfConditionNonZero : valueIfConditionZero; #endif } -template SIMD_FORCE_INLINE void btSwap(T& a, T& b) +template +SIMD_FORCE_INLINE void btSwap(T &a, T &b) { T tmp = a; a = b; b = tmp; } - //PCK: endian swapping functions SIMD_FORCE_INLINE unsigned btSwapEndian(unsigned val) { - return (((val & 0xff000000) >> 24) | ((val & 0x00ff0000) >> 8) | ((val & 0x0000ff00) << 8) | ((val & 0x000000ff) << 24)); + return (((val & 0xff000000) >> 24) | ((val & 0x00ff0000) >> 8) | ((val & 0x0000ff00) << 8) | ((val & 0x000000ff) << 24)); } SIMD_FORCE_INLINE unsigned short btSwapEndian(unsigned short val) @@ -609,127 +643,127 @@ SIMD_FORCE_INLINE unsigned btSwapEndian(int val) SIMD_FORCE_INLINE unsigned short btSwapEndian(short val) { - return btSwapEndian((unsigned short) val); + return btSwapEndian((unsigned short)val); } ///btSwapFloat uses using char pointers to swap the endianness ////btSwapFloat/btSwapDouble will NOT return a float, because the machine might 'correct' invalid floating point values -///Not all values of sign/exponent/mantissa are valid floating point numbers according to IEEE 754. -///When a floating point unit is faced with an invalid value, it may actually change the value, or worse, throw an exception. -///In most systems, running user mode code, you wouldn't get an exception, but instead the hardware/os/runtime will 'fix' the number for you. +///Not all values of sign/exponent/mantissa are valid floating point numbers according to IEEE 754. +///When a floating point unit is faced with an invalid value, it may actually change the value, or worse, throw an exception. +///In most systems, running user mode code, you wouldn't get an exception, but instead the hardware/os/runtime will 'fix' the number for you. ///so instead of returning a float/double, we return integer/long long integer -SIMD_FORCE_INLINE unsigned int btSwapEndianFloat(float d) +SIMD_FORCE_INLINE unsigned int btSwapEndianFloat(float d) { - unsigned int a = 0; - unsigned char *dst = (unsigned char *)&a; - unsigned char *src = (unsigned char *)&d; + unsigned int a = 0; + unsigned char *dst = (unsigned char *)&a; + unsigned char *src = (unsigned char *)&d; - dst[0] = src[3]; - dst[1] = src[2]; - dst[2] = src[1]; - dst[3] = src[0]; - return a; + dst[0] = src[3]; + dst[1] = src[2]; + dst[2] = src[1]; + dst[3] = src[0]; + return a; } // unswap using char pointers -SIMD_FORCE_INLINE float btUnswapEndianFloat(unsigned int a) +SIMD_FORCE_INLINE float btUnswapEndianFloat(unsigned int a) { - float d = 0.0f; - unsigned char *src = (unsigned char *)&a; - unsigned char *dst = (unsigned char *)&d; + float d = 0.0f; + unsigned char *src = (unsigned char *)&a; + unsigned char *dst = (unsigned char *)&d; - dst[0] = src[3]; - dst[1] = src[2]; - dst[2] = src[1]; - dst[3] = src[0]; - - return d; -} - - -// swap using char pointers -SIMD_FORCE_INLINE void btSwapEndianDouble(double d, unsigned char* dst) -{ - unsigned char *src = (unsigned char *)&d; - - dst[0] = src[7]; - dst[1] = src[6]; - dst[2] = src[5]; - dst[3] = src[4]; - dst[4] = src[3]; - dst[5] = src[2]; - dst[6] = src[1]; - dst[7] = src[0]; - -} - -// unswap using char pointers -SIMD_FORCE_INLINE double btUnswapEndianDouble(const unsigned char *src) -{ - double d = 0.0; - unsigned char *dst = (unsigned char *)&d; - - dst[0] = src[7]; - dst[1] = src[6]; - dst[2] = src[5]; - dst[3] = src[4]; - dst[4] = src[3]; - dst[5] = src[2]; - dst[6] = src[1]; - dst[7] = src[0]; + dst[0] = src[3]; + dst[1] = src[2]; + dst[2] = src[1]; + dst[3] = src[0]; return d; } -template -SIMD_FORCE_INLINE void btSetZero(T* a, int n) +// swap using char pointers +SIMD_FORCE_INLINE void btSwapEndianDouble(double d, unsigned char *dst) { - T* acurr = a; - size_t ncurr = n; - while (ncurr > 0) - { - *(acurr++) = 0; - --ncurr; - } + unsigned char *src = (unsigned char *)&d; + + dst[0] = src[7]; + dst[1] = src[6]; + dst[2] = src[5]; + dst[3] = src[4]; + dst[4] = src[3]; + dst[5] = src[2]; + dst[6] = src[1]; + dst[7] = src[0]; } +// unswap using char pointers +SIMD_FORCE_INLINE double btUnswapEndianDouble(const unsigned char *src) +{ + double d = 0.0; + unsigned char *dst = (unsigned char *)&d; + + dst[0] = src[7]; + dst[1] = src[6]; + dst[2] = src[5]; + dst[3] = src[4]; + dst[4] = src[3]; + dst[5] = src[2]; + dst[6] = src[1]; + dst[7] = src[0]; + + return d; +} + +template +SIMD_FORCE_INLINE void btSetZero(T *a, int n) +{ + T *acurr = a; + size_t ncurr = n; + while (ncurr > 0) + { + *(acurr++) = 0; + --ncurr; + } +} SIMD_FORCE_INLINE btScalar btLargeDot(const btScalar *a, const btScalar *b, int n) -{ - btScalar p0,q0,m0,p1,q1,m1,sum; - sum = 0; - n -= 2; - while (n >= 0) { - p0 = a[0]; q0 = b[0]; - m0 = p0 * q0; - p1 = a[1]; q1 = b[1]; - m1 = p1 * q1; - sum += m0; - sum += m1; - a += 2; - b += 2; - n -= 2; - } - n += 2; - while (n > 0) { - sum += (*a) * (*b); - a++; - b++; - n--; - } - return sum; +{ + btScalar p0, q0, m0, p1, q1, m1, sum; + sum = 0; + n -= 2; + while (n >= 0) + { + p0 = a[0]; + q0 = b[0]; + m0 = p0 * q0; + p1 = a[1]; + q1 = b[1]; + m1 = p1 * q1; + sum += m0; + sum += m1; + a += 2; + b += 2; + n -= 2; + } + n += 2; + while (n > 0) + { + sum += (*a) * (*b); + a++; + b++; + n--; + } + return sum; } - // returns normalized value in range [-SIMD_PI, SIMD_PI] -SIMD_FORCE_INLINE btScalar btNormalizeAngle(btScalar angleInRadians) +SIMD_FORCE_INLINE btScalar btNormalizeAngle(btScalar angleInRadians) { angleInRadians = btFmod(angleInRadians, SIMD_2_PI); - if(angleInRadians < -SIMD_PI) + if (angleInRadians < -SIMD_PI) { return angleInRadians + SIMD_2_PI; } - else if(angleInRadians > SIMD_PI) + else if (angleInRadians > SIMD_PI) { return angleInRadians - SIMD_2_PI; } @@ -739,45 +773,38 @@ SIMD_FORCE_INLINE btScalar btNormalizeAngle(btScalar angleInRadians) } } - - ///rudimentary class to provide type info struct btTypedObject { btTypedObject(int objectType) - :m_objectType(objectType) + : m_objectType(objectType) { } - int m_objectType; + int m_objectType; inline int getObjectType() const { return m_objectType; } }; - - ///align a pointer to the provided alignment, upwards -template T* btAlignPointer(T* unalignedPtr, size_t alignment) +template +T *btAlignPointer(T *unalignedPtr, size_t alignment) { - struct btConvertPointerSizeT { - union - { - T* ptr; - size_t integer; + union { + T *ptr; + size_t integer; }; }; - btConvertPointerSizeT converter; - - + btConvertPointerSizeT converter; + const size_t bit_mask = ~(alignment - 1); - converter.ptr = unalignedPtr; - converter.integer += alignment-1; + converter.ptr = unalignedPtr; + converter.integer += alignment - 1; converter.integer &= bit_mask; return converter.ptr; } - -#endif //BT_SCALAR_H +#endif //BT_SCALAR_H diff --git a/Engine/lib/bullet/src/LinearMath/btSerializer.cpp b/Engine/lib/bullet/src/LinearMath/btSerializer.cpp index 2b5740b40..fcd2255ad 100644 --- a/Engine/lib/bullet/src/LinearMath/btSerializer.cpp +++ b/Engine/lib/bullet/src/LinearMath/btSerializer.cpp @@ -1,5 +1,5 @@ char sBulletDNAstr[]= { -char(83),char(68),char(78),char(65),char(78),char(65),char(77),char(69),char(-128),char(1),char(0),char(0),char(109),char(95),char(115),char(105),char(122),char(101),char(0),char(109), +char(83),char(68),char(78),char(65),char(78),char(65),char(77),char(69),char(-124),char(1),char(0),char(0),char(109),char(95),char(115),char(105),char(122),char(101),char(0),char(109), char(95),char(99),char(97),char(112),char(97),char(99),char(105),char(116),char(121),char(0),char(42),char(109),char(95),char(100),char(97),char(116),char(97),char(0),char(109),char(95), char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(115),char(0),char(109),char(95),char(99),char(111), char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99),char(116),char(115),char(0),char(109),char(95),char(99),char(111),char(110), @@ -306,884 +306,294 @@ char(117),char(110),char(116),char(0),char(109),char(95),char(106),char(111),cha char(106),char(111),char(105),char(110),char(116),char(86),char(101),char(108),char(91),char(54),char(93),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(84), char(111),char(114),char(113),char(117),char(101),char(91),char(54),char(93),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(68),char(97),char(109),char(112), char(105),char(110),char(103),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0), -char(42),char(109),char(95),char(108),char(105),char(110),char(107),char(78),char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(106),char(111),char(105),char(110),char(116), -char(78),char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(108),char(105),char(110),char(107),char(67),char(111),char(108),char(108),char(105),char(100),char(101),char(114), -char(0),char(42),char(109),char(95),char(112),char(97),char(100),char(100),char(105),char(110),char(103),char(80),char(116),char(114),char(0),char(109),char(95),char(98),char(97),char(115), -char(101),char(87),char(111),char(114),char(108),char(100),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(98),char(97), -char(115),char(101),char(73),char(110),char(101),char(114),char(116),char(105),char(97),char(0),char(109),char(95),char(98),char(97),char(115),char(101),char(77),char(97),char(115),char(115), -char(0),char(42),char(109),char(95),char(98),char(97),char(115),char(101),char(78),char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(98),char(97),char(115),char(101), -char(67),char(111),char(108),char(108),char(105),char(100),char(101),char(114),char(0),char(0),char(0),char(0),char(84),char(89),char(80),char(69),char(95),char(0),char(0),char(0), -char(99),char(104),char(97),char(114),char(0),char(117),char(99),char(104),char(97),char(114),char(0),char(115),char(104),char(111),char(114),char(116),char(0),char(117),char(115),char(104), -char(111),char(114),char(116),char(0),char(105),char(110),char(116),char(0),char(108),char(111),char(110),char(103),char(0),char(117),char(108),char(111),char(110),char(103),char(0),char(102), -char(108),char(111),char(97),char(116),char(0),char(100),char(111),char(117),char(98),char(108),char(101),char(0),char(118),char(111),char(105),char(100),char(0),char(80),char(111),char(105), -char(110),char(116),char(101),char(114),char(65),char(114),char(114),char(97),char(121),char(0),char(98),char(116),char(80),char(104),char(121),char(115),char(105),char(99),char(115),char(83), -char(121),char(115),char(116),char(101),char(109),char(0),char(76),char(105),char(115),char(116),char(66),char(97),char(115),char(101),char(0),char(98),char(116),char(86),char(101),char(99), -char(116),char(111),char(114),char(51),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(86),char(101),char(99),char(116), -char(111),char(114),char(51),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(116), -char(101),char(114),char(110),char(105),char(111),char(110),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117), -char(97),char(116),char(101),char(114),char(110),char(105),char(111),char(110),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98), -char(116),char(77),char(97),char(116),char(114),char(105),char(120),char(51),char(120),char(51),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0), -char(98),char(116),char(77),char(97),char(116),char(114),char(105),char(120),char(51),char(120),char(51),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116), -char(97),char(0),char(98),char(116),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114),char(109),char(70),char(108),char(111),char(97),char(116),char(68),char(97), -char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114),char(109),char(68),char(111),char(117),char(98),char(108),char(101), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(66),char(118),char(104),char(83),char(117),char(98),char(116),char(114),char(101),char(101),char(73),char(110),char(102), -char(111),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(79),char(112),char(116),char(105),char(109),char(105),char(122),char(101),char(100),char(66),char(118),char(104), -char(78),char(111),char(100),char(101),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(79),char(112),char(116),char(105), -char(109),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100),char(101),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97), -char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100), -char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(66),char(118),char(104), -char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101), -char(100),char(66),char(118),char(104),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(108), -char(108),char(105),char(115),char(105),char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(116), -char(97),char(116),char(105),char(99),char(80),char(108),char(97),char(110),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98), -char(116),char(67),char(111),char(110),char(118),char(101),char(120),char(73),char(110),char(116),char(101),char(114),char(110),char(97),char(108),char(83),char(104),char(97),char(112),char(101), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(65),char(110),char(100),char(82),char(97), -char(100),char(105),char(117),char(115),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(83),char(112),char(104),char(101),char(114),char(101),char(83),char(104), -char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(73),char(110),char(116),char(73),char(110),char(100),char(101),char(120),char(68),char(97), -char(116),char(97),char(0),char(98),char(116),char(83),char(104),char(111),char(114),char(116),char(73),char(110),char(116),char(73),char(110),char(100),char(101),char(120),char(68),char(97), -char(116),char(97),char(0),char(98),char(116),char(83),char(104),char(111),char(114),char(116),char(73),char(110),char(116),char(73),char(110),char(100),char(101),char(120),char(84),char(114), -char(105),char(112),char(108),char(101),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(104),char(97),char(114),char(73),char(110),char(100),char(101), -char(120),char(84),char(114),char(105),char(112),char(108),char(101),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(101),char(115),char(104),char(80), -char(97),char(114),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(116),char(114),char(105),char(100),char(105),char(110),char(103),char(77),char(101), -char(115),char(104),char(73),char(110),char(116),char(101),char(114),char(102),char(97),char(99),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114), +char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(76),char(111),char(119),char(101),char(114),char(76),char(105),char(109),char(105),char(116),char(0),char(109),char(95), +char(106),char(111),char(105),char(110),char(116),char(85),char(112),char(112),char(101),char(114),char(76),char(105),char(109),char(105),char(116),char(0),char(109),char(95),char(106),char(111), +char(105),char(110),char(116),char(77),char(97),char(120),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(77), +char(97),char(120),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(42),char(109),char(95),char(108),char(105),char(110),char(107),char(78),char(97), +char(109),char(101),char(0),char(42),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(78),char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(108), +char(105),char(110),char(107),char(67),char(111),char(108),char(108),char(105),char(100),char(101),char(114),char(0),char(42),char(109),char(95),char(112),char(97),char(100),char(100),char(105), +char(110),char(103),char(80),char(116),char(114),char(0),char(109),char(95),char(98),char(97),char(115),char(101),char(87),char(111),char(114),char(108),char(100),char(84),char(114),char(97), +char(110),char(115),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(98),char(97),char(115),char(101),char(73),char(110),char(101),char(114),char(116),char(105),char(97), +char(0),char(109),char(95),char(98),char(97),char(115),char(101),char(77),char(97),char(115),char(115),char(0),char(42),char(109),char(95),char(98),char(97),char(115),char(101),char(78), +char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(98),char(97),char(115),char(101),char(67),char(111),char(108),char(108),char(105),char(100),char(101),char(114),char(0), +char(84),char(89),char(80),char(69),char(95),char(0),char(0),char(0),char(99),char(104),char(97),char(114),char(0),char(117),char(99),char(104),char(97),char(114),char(0),char(115), +char(104),char(111),char(114),char(116),char(0),char(117),char(115),char(104),char(111),char(114),char(116),char(0),char(105),char(110),char(116),char(0),char(108),char(111),char(110),char(103), +char(0),char(117),char(108),char(111),char(110),char(103),char(0),char(102),char(108),char(111),char(97),char(116),char(0),char(100),char(111),char(117),char(98),char(108),char(101),char(0), +char(118),char(111),char(105),char(100),char(0),char(80),char(111),char(105),char(110),char(116),char(101),char(114),char(65),char(114),char(114),char(97),char(121),char(0),char(98),char(116), +char(80),char(104),char(121),char(115),char(105),char(99),char(115),char(83),char(121),char(115),char(116),char(101),char(109),char(0),char(76),char(105),char(115),char(116),char(66),char(97), +char(115),char(101),char(0),char(98),char(116),char(86),char(101),char(99),char(116),char(111),char(114),char(51),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116), +char(97),char(0),char(98),char(116),char(86),char(101),char(99),char(116),char(111),char(114),char(51),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116), +char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(116),char(101),char(114),char(110),char(105),char(111),char(110),char(70),char(108),char(111),char(97),char(116),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(116),char(101),char(114),char(110),char(105),char(111),char(110),char(68),char(111),char(117),char(98), +char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(97),char(116),char(114),char(105),char(120),char(51),char(120),char(51),char(70),char(108), +char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(97),char(116),char(114),char(105),char(120),char(51),char(120),char(51),char(68), +char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114), +char(109),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(97),char(110),char(115),char(102),char(111), +char(114),char(109),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(66),char(118),char(104),char(83),char(117), +char(98),char(116),char(114),char(101),char(101),char(73),char(110),char(102),char(111),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(79),char(112),char(116),char(105), +char(109),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100),char(101),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116), +char(97),char(0),char(98),char(116),char(79),char(112),char(116),char(105),char(109),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100),char(101), +char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110),char(116),char(105),char(122), +char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110), +char(116),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116), +char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97), +char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(116),char(97),char(116),char(105),char(99),char(80),char(108),char(97),char(110),char(101),char(83),char(104),char(97), +char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(118),char(101),char(120),char(73),char(110),char(116),char(101),char(114), +char(110),char(97),char(108),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(115),char(105),char(116), +char(105),char(111),char(110),char(65),char(110),char(100),char(82),char(97),char(100),char(105),char(117),char(115),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105), +char(83),char(112),char(104),char(101),char(114),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(73),char(110), +char(116),char(73),char(110),char(100),char(101),char(120),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(104),char(111),char(114),char(116),char(73),char(110), +char(116),char(73),char(110),char(100),char(101),char(120),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(104),char(111),char(114),char(116),char(73),char(110), +char(116),char(73),char(110),char(100),char(101),char(120),char(84),char(114),char(105),char(112),char(108),char(101),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116), +char(67),char(104),char(97),char(114),char(73),char(110),char(100),char(101),char(120),char(84),char(114),char(105),char(112),char(108),char(101),char(116),char(68),char(97),char(116),char(97), +char(0),char(98),char(116),char(77),char(101),char(115),char(104),char(80),char(97),char(114),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(116), +char(114),char(105),char(100),char(105),char(110),char(103),char(77),char(101),char(115),char(104),char(73),char(110),char(116),char(101),char(114),char(102),char(97),char(99),char(101),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(77),char(101),char(115),char(104),char(83),char(104), +char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110), +char(102),char(111),char(77),char(97),char(112),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(99),char(97),char(108),char(101),char(100),char(84),char(114), char(105),char(97),char(110),char(103),char(108),char(101),char(77),char(101),char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0), -char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(102),char(111),char(77),char(97),char(112),char(68),char(97),char(116), -char(97),char(0),char(98),char(116),char(83),char(99),char(97),char(108),char(101),char(100),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(77),char(101), -char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(109),char(112),char(111),char(117), -char(110),char(100),char(83),char(104),char(97),char(112),char(101),char(67),char(104),char(105),char(108),char(100),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67), -char(111),char(109),char(112),char(111),char(117),char(110),char(100),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67), -char(121),char(108),char(105),char(110),char(100),char(101),char(114),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67), -char(111),char(110),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(97),char(112),char(115),char(117), -char(108),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103), -char(108),char(101),char(73),char(110),char(102),char(111),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(73),char(109),char(112),char(97),char(99),char(116), -char(77),char(101),char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(118), -char(101),char(120),char(72),char(117),char(108),char(108),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111), -char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68), +char(98),char(116),char(67),char(111),char(109),char(112),char(111),char(117),char(110),char(100),char(83),char(104),char(97),char(112),char(101),char(67),char(104),char(105),char(108),char(100), +char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(109),char(112),char(111),char(117),char(110),char(100),char(83),char(104),char(97),char(112),char(101), +char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(121),char(108),char(105),char(110),char(100),char(101),char(114),char(83),char(104),char(97),char(112),char(101), +char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97), +char(0),char(98),char(116),char(67),char(97),char(112),char(115),char(117),char(108),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0), +char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(102),char(111),char(68),char(97),char(116),char(97),char(0),char(98), +char(116),char(71),char(73),char(109),char(112),char(97),char(99),char(116),char(77),char(101),char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116), +char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(118),char(101),char(120),char(72),char(117),char(108),char(108),char(83),char(104),char(97),char(112),char(101),char(68), char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99), -char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116), -char(83),char(111),char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97), -char(0),char(98),char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(83),char(111),char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111), -char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(68),char(121),char(110),char(97),char(109),char(105),char(99),char(115), -char(87),char(111),char(114),char(108),char(100),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(68),char(121), -char(110),char(97),char(109),char(105),char(99),char(115),char(87),char(111),char(114),char(108),char(100),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97), -char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116), -char(97),char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121),char(68),char(111),char(117),char(98),char(108),char(101),char(68), -char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(73),char(110),char(102),char(111), -char(49),char(0),char(98),char(116),char(84),char(121),char(112),char(101),char(100),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70), -char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(121),char(112),char(101),char(100),char(67),char(111),char(110),char(115), -char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111), -char(100),char(121),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(121),char(112),char(101),char(100),char(67),char(111),char(110),char(115),char(116),char(114), -char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(105), -char(110),char(116),char(50),char(80),char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108), -char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(105),char(110),char(116),char(50),char(80),char(111),char(105),char(110), -char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116), -char(97),char(50),char(0),char(98),char(116),char(80),char(111),char(105),char(110),char(116),char(50),char(80),char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115), -char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(72), -char(105),char(110),char(103),char(101),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101), +char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(108),char(108),char(105),char(115), +char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98), +char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(83),char(111),char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111),char(68),char(111), +char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(83),char(111), +char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116), +char(68),char(121),char(110),char(97),char(109),char(105),char(99),char(115),char(87),char(111),char(114),char(108),char(100),char(68),char(111),char(117),char(98),char(108),char(101),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(68),char(121),char(110),char(97),char(109),char(105),char(99),char(115),char(87),char(111),char(114),char(108),char(100),char(70), +char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121), +char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100), +char(121),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(115),char(116),char(114), +char(97),char(105),char(110),char(116),char(73),char(110),char(102),char(111),char(49),char(0),char(98),char(116),char(84),char(121),char(112),char(101),char(100),char(67),char(111),char(110), +char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84), +char(121),char(112),char(101),char(100),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98), +char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(121),char(112), +char(101),char(100),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97), +char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(105),char(110),char(116),char(50),char(80),char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115), +char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111), +char(105),char(110),char(116),char(50),char(80),char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68), +char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(80),char(111),char(105),char(110),char(116),char(50),char(80), +char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101), char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(72),char(105),char(110),char(103),char(101),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(72),char(105),char(110),char(103),char(101),char(67), -char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50), -char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(84),char(119),char(105),char(115),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(84), -char(119),char(105),char(115),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98), -char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102), +char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(72),char(105),char(110),char(103),char(101), +char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0), +char(98),char(116),char(72),char(105),char(110),char(103),char(101),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117), +char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(84),char(119),char(105),char(115),char(116), char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97), -char(50),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110), -char(103),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101), -char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(67),char(111),char(110),char(115),char(116), -char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(71), -char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(50),char(67),char(111),char(110), -char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105), -char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(50),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(83),char(108),char(105),char(100), -char(101),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83), -char(108),char(105),char(100),char(101),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108), -char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(97),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(97),char(114),char(67),char(111), -char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(83), -char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(77),char(97),char(116),char(101),char(114),char(105),char(97),char(108),char(68),char(97),char(116),char(97),char(0), -char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(78),char(111),char(100),char(101),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102), -char(116),char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111), -char(100),char(121),char(70),char(97),char(99),char(101),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(84), -char(101),char(116),char(114),char(97),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(82),char(105),char(103),char(105),char(100),char(65),char(110), -char(99),char(104),char(111),char(114),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(67),char(111),char(110), -char(102),char(105),char(103),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(80),char(111),char(115),char(101), -char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(67),char(108),char(117),char(115),char(116),char(101),char(114), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(74),char(111),char(105),char(110),char(116), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(70),char(108),char(111),char(97),char(116), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107), -char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111), -char(100),char(121),char(76),char(105),char(110),char(107),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117), -char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116), -char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(0), -char(84),char(76),char(69),char(78),char(1),char(0),char(1),char(0),char(2),char(0),char(2),char(0),char(4),char(0),char(4),char(0),char(4),char(0),char(4),char(0), -char(8),char(0),char(0),char(0),char(12),char(0),char(36),char(0),char(8),char(0),char(16),char(0),char(32),char(0),char(16),char(0),char(32),char(0),char(48),char(0), -char(96),char(0),char(64),char(0),char(-128),char(0),char(20),char(0),char(48),char(0),char(80),char(0),char(16),char(0),char(84),char(0),char(-124),char(0),char(12),char(0), -char(52),char(0),char(52),char(0),char(20),char(0),char(64),char(0),char(4),char(0),char(4),char(0),char(8),char(0),char(4),char(0),char(32),char(0),char(28),char(0), -char(60),char(0),char(56),char(0),char(76),char(0),char(76),char(0),char(24),char(0),char(60),char(0),char(60),char(0),char(60),char(0),char(16),char(0),char(64),char(0), -char(68),char(0),char(-32),char(1),char(8),char(1),char(-104),char(0),char(88),char(0),char(-72),char(0),char(104),char(0),char(-16),char(1),char(-80),char(3),char(8),char(0), -char(52),char(0),char(52),char(0),char(0),char(0),char(68),char(0),char(84),char(0),char(-124),char(0),char(116),char(0),char(92),char(1),char(-36),char(0),char(-116),char(1), -char(124),char(1),char(-44),char(0),char(-4),char(0),char(-52),char(1),char(92),char(1),char(116),char(2),char(-124),char(2),char(-76),char(4),char(-52),char(0),char(108),char(1), -char(92),char(0),char(-116),char(0),char(16),char(0),char(100),char(0),char(20),char(0),char(36),char(0),char(100),char(0),char(92),char(0),char(104),char(0),char(-64),char(0), -char(92),char(1),char(104),char(0),char(-76),char(1),char(-48),char(2),char(120),char(1),char(-64),char(0),char(100),char(0),char(0),char(0),char(83),char(84),char(82),char(67), -char(84),char(0),char(0),char(0),char(10),char(0),char(3),char(0),char(4),char(0),char(0),char(0),char(4),char(0),char(1),char(0),char(9),char(0),char(2),char(0), -char(11),char(0),char(3),char(0),char(10),char(0),char(3),char(0),char(10),char(0),char(4),char(0),char(10),char(0),char(5),char(0),char(12),char(0),char(2),char(0), -char(9),char(0),char(6),char(0),char(9),char(0),char(7),char(0),char(13),char(0),char(1),char(0),char(7),char(0),char(8),char(0),char(14),char(0),char(1),char(0), -char(8),char(0),char(8),char(0),char(15),char(0),char(1),char(0),char(7),char(0),char(8),char(0),char(16),char(0),char(1),char(0),char(8),char(0),char(8),char(0), -char(17),char(0),char(1),char(0),char(13),char(0),char(9),char(0),char(18),char(0),char(1),char(0),char(14),char(0),char(9),char(0),char(19),char(0),char(2),char(0), -char(17),char(0),char(10),char(0),char(13),char(0),char(11),char(0),char(20),char(0),char(2),char(0),char(18),char(0),char(10),char(0),char(14),char(0),char(11),char(0), -char(21),char(0),char(4),char(0),char(4),char(0),char(12),char(0),char(4),char(0),char(13),char(0),char(2),char(0),char(14),char(0),char(2),char(0),char(15),char(0), -char(22),char(0),char(6),char(0),char(13),char(0),char(16),char(0),char(13),char(0),char(17),char(0),char(4),char(0),char(18),char(0),char(4),char(0),char(19),char(0), -char(4),char(0),char(20),char(0),char(0),char(0),char(21),char(0),char(23),char(0),char(6),char(0),char(14),char(0),char(16),char(0),char(14),char(0),char(17),char(0), -char(4),char(0),char(18),char(0),char(4),char(0),char(19),char(0),char(4),char(0),char(20),char(0),char(0),char(0),char(21),char(0),char(24),char(0),char(3),char(0), -char(2),char(0),char(14),char(0),char(2),char(0),char(15),char(0),char(4),char(0),char(22),char(0),char(25),char(0),char(12),char(0),char(13),char(0),char(23),char(0), -char(13),char(0),char(24),char(0),char(13),char(0),char(25),char(0),char(4),char(0),char(26),char(0),char(4),char(0),char(27),char(0),char(4),char(0),char(28),char(0), -char(4),char(0),char(29),char(0),char(22),char(0),char(30),char(0),char(24),char(0),char(31),char(0),char(21),char(0),char(32),char(0),char(4),char(0),char(33),char(0), -char(4),char(0),char(34),char(0),char(26),char(0),char(12),char(0),char(14),char(0),char(23),char(0),char(14),char(0),char(24),char(0),char(14),char(0),char(25),char(0), -char(4),char(0),char(26),char(0),char(4),char(0),char(27),char(0),char(4),char(0),char(28),char(0),char(4),char(0),char(29),char(0),char(23),char(0),char(30),char(0), -char(24),char(0),char(31),char(0),char(4),char(0),char(33),char(0),char(4),char(0),char(34),char(0),char(21),char(0),char(32),char(0),char(27),char(0),char(3),char(0), -char(0),char(0),char(35),char(0),char(4),char(0),char(36),char(0),char(0),char(0),char(37),char(0),char(28),char(0),char(5),char(0),char(27),char(0),char(38),char(0), -char(13),char(0),char(39),char(0),char(13),char(0),char(40),char(0),char(7),char(0),char(41),char(0),char(0),char(0),char(21),char(0),char(29),char(0),char(5),char(0), -char(27),char(0),char(38),char(0),char(13),char(0),char(39),char(0),char(13),char(0),char(42),char(0),char(7),char(0),char(43),char(0),char(4),char(0),char(44),char(0), -char(30),char(0),char(2),char(0),char(13),char(0),char(45),char(0),char(7),char(0),char(46),char(0),char(31),char(0),char(4),char(0),char(29),char(0),char(47),char(0), -char(30),char(0),char(48),char(0),char(4),char(0),char(49),char(0),char(0),char(0),char(37),char(0),char(32),char(0),char(1),char(0),char(4),char(0),char(50),char(0), -char(33),char(0),char(2),char(0),char(2),char(0),char(50),char(0),char(0),char(0),char(51),char(0),char(34),char(0),char(2),char(0),char(2),char(0),char(52),char(0), -char(0),char(0),char(51),char(0),char(35),char(0),char(2),char(0),char(0),char(0),char(52),char(0),char(0),char(0),char(53),char(0),char(36),char(0),char(8),char(0), -char(13),char(0),char(54),char(0),char(14),char(0),char(55),char(0),char(32),char(0),char(56),char(0),char(34),char(0),char(57),char(0),char(35),char(0),char(58),char(0), -char(33),char(0),char(59),char(0),char(4),char(0),char(60),char(0),char(4),char(0),char(61),char(0),char(37),char(0),char(4),char(0),char(36),char(0),char(62),char(0), -char(13),char(0),char(63),char(0),char(4),char(0),char(64),char(0),char(0),char(0),char(37),char(0),char(38),char(0),char(7),char(0),char(27),char(0),char(38),char(0), -char(37),char(0),char(65),char(0),char(25),char(0),char(66),char(0),char(26),char(0),char(67),char(0),char(39),char(0),char(68),char(0),char(7),char(0),char(43),char(0), -char(0),char(0),char(69),char(0),char(40),char(0),char(2),char(0),char(38),char(0),char(70),char(0),char(13),char(0),char(39),char(0),char(41),char(0),char(4),char(0), -char(19),char(0),char(71),char(0),char(27),char(0),char(72),char(0),char(4),char(0),char(73),char(0),char(7),char(0),char(74),char(0),char(42),char(0),char(4),char(0), -char(27),char(0),char(38),char(0),char(41),char(0),char(75),char(0),char(4),char(0),char(76),char(0),char(7),char(0),char(43),char(0),char(43),char(0),char(3),char(0), -char(29),char(0),char(47),char(0),char(4),char(0),char(77),char(0),char(0),char(0),char(37),char(0),char(44),char(0),char(3),char(0),char(29),char(0),char(47),char(0), -char(4),char(0),char(78),char(0),char(0),char(0),char(37),char(0),char(45),char(0),char(3),char(0),char(29),char(0),char(47),char(0),char(4),char(0),char(77),char(0), -char(0),char(0),char(37),char(0),char(46),char(0),char(4),char(0),char(4),char(0),char(79),char(0),char(7),char(0),char(80),char(0),char(7),char(0),char(81),char(0), -char(7),char(0),char(82),char(0),char(39),char(0),char(14),char(0),char(4),char(0),char(83),char(0),char(4),char(0),char(84),char(0),char(46),char(0),char(85),char(0), -char(4),char(0),char(86),char(0),char(7),char(0),char(87),char(0),char(7),char(0),char(88),char(0),char(7),char(0),char(89),char(0),char(7),char(0),char(90),char(0), -char(7),char(0),char(91),char(0),char(4),char(0),char(92),char(0),char(4),char(0),char(93),char(0),char(4),char(0),char(94),char(0),char(4),char(0),char(95),char(0), -char(0),char(0),char(37),char(0),char(47),char(0),char(5),char(0),char(27),char(0),char(38),char(0),char(37),char(0),char(65),char(0),char(13),char(0),char(39),char(0), -char(7),char(0),char(43),char(0),char(4),char(0),char(96),char(0),char(48),char(0),char(5),char(0),char(29),char(0),char(47),char(0),char(13),char(0),char(97),char(0), -char(14),char(0),char(98),char(0),char(4),char(0),char(99),char(0),char(0),char(0),char(100),char(0),char(49),char(0),char(27),char(0),char(9),char(0),char(101),char(0), -char(9),char(0),char(102),char(0),char(27),char(0),char(103),char(0),char(0),char(0),char(35),char(0),char(20),char(0),char(104),char(0),char(20),char(0),char(105),char(0), -char(14),char(0),char(106),char(0),char(14),char(0),char(107),char(0),char(14),char(0),char(108),char(0),char(8),char(0),char(109),char(0),char(8),char(0),char(110),char(0), -char(8),char(0),char(111),char(0),char(8),char(0),char(112),char(0),char(8),char(0),char(113),char(0),char(8),char(0),char(114),char(0),char(8),char(0),char(115),char(0), -char(8),char(0),char(116),char(0),char(8),char(0),char(117),char(0),char(8),char(0),char(118),char(0),char(4),char(0),char(119),char(0),char(4),char(0),char(120),char(0), +char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(84),char(119),char(105),char(115),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), +char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102), +char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110), +char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111), +char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54), +char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114), +char(105),char(110),char(103),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68), +char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112), +char(114),char(105),char(110),char(103),char(50),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0), +char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(50), +char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97), +char(50),char(0),char(98),char(116),char(83),char(108),char(105),char(100),char(101),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116), +char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(108),char(105),char(100),char(101),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97), +char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(97),char(114), +char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0), +char(98),char(116),char(71),char(101),char(97),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98), +char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(77),char(97),char(116),char(101),char(114), +char(105),char(97),char(108),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(78),char(111),char(100),char(101), +char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107),char(68),char(97),char(116), +char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(70),char(97),char(99),char(101),char(68),char(97),char(116),char(97),char(0),char(83), +char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(84),char(101),char(116),char(114),char(97),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102), +char(116),char(82),char(105),char(103),char(105),char(100),char(65),char(110),char(99),char(104),char(111),char(114),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102), +char(116),char(66),char(111),char(100),char(121),char(67),char(111),char(110),char(102),char(105),char(103),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116), +char(66),char(111),char(100),char(121),char(80),char(111),char(115),char(101),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100), +char(121),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(111),char(102),char(116),char(66), +char(111),char(100),char(121),char(74),char(111),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(111),char(102),char(116),char(66), +char(111),char(100),char(121),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105), +char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98), +char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107),char(70),char(108),char(111),char(97),char(116),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(68),char(111),char(117),char(98),char(108), +char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(70),char(108),char(111), +char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(0),char(84),char(76),char(69),char(78),char(1),char(0),char(1),char(0),char(2),char(0),char(2),char(0), +char(4),char(0),char(4),char(0),char(4),char(0),char(4),char(0),char(8),char(0),char(0),char(0),char(12),char(0),char(36),char(0),char(8),char(0),char(16),char(0), +char(32),char(0),char(16),char(0),char(32),char(0),char(48),char(0),char(96),char(0),char(64),char(0),char(-128),char(0),char(20),char(0),char(48),char(0),char(80),char(0), +char(16),char(0),char(84),char(0),char(-124),char(0),char(12),char(0),char(52),char(0),char(52),char(0),char(20),char(0),char(64),char(0),char(4),char(0),char(4),char(0), +char(8),char(0),char(4),char(0),char(32),char(0),char(28),char(0),char(60),char(0),char(56),char(0),char(76),char(0),char(76),char(0),char(24),char(0),char(60),char(0), +char(60),char(0),char(60),char(0),char(16),char(0),char(64),char(0),char(68),char(0),char(-32),char(1),char(8),char(1),char(-104),char(0),char(88),char(0),char(-72),char(0), +char(104),char(0),char(-16),char(1),char(-80),char(3),char(8),char(0),char(52),char(0),char(52),char(0),char(0),char(0),char(68),char(0),char(84),char(0),char(-124),char(0), +char(116),char(0),char(92),char(1),char(-36),char(0),char(-116),char(1),char(124),char(1),char(-44),char(0),char(-4),char(0),char(-52),char(1),char(92),char(1),char(116),char(2), +char(-124),char(2),char(-76),char(4),char(-52),char(0),char(108),char(1),char(92),char(0),char(-116),char(0),char(16),char(0),char(100),char(0),char(20),char(0),char(36),char(0), +char(100),char(0),char(92),char(0),char(104),char(0),char(-64),char(0),char(92),char(1),char(104),char(0),char(-76),char(1),char(-16),char(2),char(-120),char(1),char(-64),char(0), +char(100),char(0),char(0),char(0),char(83),char(84),char(82),char(67),char(84),char(0),char(0),char(0),char(10),char(0),char(3),char(0),char(4),char(0),char(0),char(0), +char(4),char(0),char(1),char(0),char(9),char(0),char(2),char(0),char(11),char(0),char(3),char(0),char(10),char(0),char(3),char(0),char(10),char(0),char(4),char(0), +char(10),char(0),char(5),char(0),char(12),char(0),char(2),char(0),char(9),char(0),char(6),char(0),char(9),char(0),char(7),char(0),char(13),char(0),char(1),char(0), +char(7),char(0),char(8),char(0),char(14),char(0),char(1),char(0),char(8),char(0),char(8),char(0),char(15),char(0),char(1),char(0),char(7),char(0),char(8),char(0), +char(16),char(0),char(1),char(0),char(8),char(0),char(8),char(0),char(17),char(0),char(1),char(0),char(13),char(0),char(9),char(0),char(18),char(0),char(1),char(0), +char(14),char(0),char(9),char(0),char(19),char(0),char(2),char(0),char(17),char(0),char(10),char(0),char(13),char(0),char(11),char(0),char(20),char(0),char(2),char(0), +char(18),char(0),char(10),char(0),char(14),char(0),char(11),char(0),char(21),char(0),char(4),char(0),char(4),char(0),char(12),char(0),char(4),char(0),char(13),char(0), +char(2),char(0),char(14),char(0),char(2),char(0),char(15),char(0),char(22),char(0),char(6),char(0),char(13),char(0),char(16),char(0),char(13),char(0),char(17),char(0), +char(4),char(0),char(18),char(0),char(4),char(0),char(19),char(0),char(4),char(0),char(20),char(0),char(0),char(0),char(21),char(0),char(23),char(0),char(6),char(0), +char(14),char(0),char(16),char(0),char(14),char(0),char(17),char(0),char(4),char(0),char(18),char(0),char(4),char(0),char(19),char(0),char(4),char(0),char(20),char(0), +char(0),char(0),char(21),char(0),char(24),char(0),char(3),char(0),char(2),char(0),char(14),char(0),char(2),char(0),char(15),char(0),char(4),char(0),char(22),char(0), +char(25),char(0),char(12),char(0),char(13),char(0),char(23),char(0),char(13),char(0),char(24),char(0),char(13),char(0),char(25),char(0),char(4),char(0),char(26),char(0), +char(4),char(0),char(27),char(0),char(4),char(0),char(28),char(0),char(4),char(0),char(29),char(0),char(22),char(0),char(30),char(0),char(24),char(0),char(31),char(0), +char(21),char(0),char(32),char(0),char(4),char(0),char(33),char(0),char(4),char(0),char(34),char(0),char(26),char(0),char(12),char(0),char(14),char(0),char(23),char(0), +char(14),char(0),char(24),char(0),char(14),char(0),char(25),char(0),char(4),char(0),char(26),char(0),char(4),char(0),char(27),char(0),char(4),char(0),char(28),char(0), +char(4),char(0),char(29),char(0),char(23),char(0),char(30),char(0),char(24),char(0),char(31),char(0),char(4),char(0),char(33),char(0),char(4),char(0),char(34),char(0), +char(21),char(0),char(32),char(0),char(27),char(0),char(3),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(36),char(0),char(0),char(0),char(37),char(0), +char(28),char(0),char(5),char(0),char(27),char(0),char(38),char(0),char(13),char(0),char(39),char(0),char(13),char(0),char(40),char(0),char(7),char(0),char(41),char(0), +char(0),char(0),char(21),char(0),char(29),char(0),char(5),char(0),char(27),char(0),char(38),char(0),char(13),char(0),char(39),char(0),char(13),char(0),char(42),char(0), +char(7),char(0),char(43),char(0),char(4),char(0),char(44),char(0),char(30),char(0),char(2),char(0),char(13),char(0),char(45),char(0),char(7),char(0),char(46),char(0), +char(31),char(0),char(4),char(0),char(29),char(0),char(47),char(0),char(30),char(0),char(48),char(0),char(4),char(0),char(49),char(0),char(0),char(0),char(37),char(0), +char(32),char(0),char(1),char(0),char(4),char(0),char(50),char(0),char(33),char(0),char(2),char(0),char(2),char(0),char(50),char(0),char(0),char(0),char(51),char(0), +char(34),char(0),char(2),char(0),char(2),char(0),char(52),char(0),char(0),char(0),char(51),char(0),char(35),char(0),char(2),char(0),char(0),char(0),char(52),char(0), +char(0),char(0),char(53),char(0),char(36),char(0),char(8),char(0),char(13),char(0),char(54),char(0),char(14),char(0),char(55),char(0),char(32),char(0),char(56),char(0), +char(34),char(0),char(57),char(0),char(35),char(0),char(58),char(0),char(33),char(0),char(59),char(0),char(4),char(0),char(60),char(0),char(4),char(0),char(61),char(0), +char(37),char(0),char(4),char(0),char(36),char(0),char(62),char(0),char(13),char(0),char(63),char(0),char(4),char(0),char(64),char(0),char(0),char(0),char(37),char(0), +char(38),char(0),char(7),char(0),char(27),char(0),char(38),char(0),char(37),char(0),char(65),char(0),char(25),char(0),char(66),char(0),char(26),char(0),char(67),char(0), +char(39),char(0),char(68),char(0),char(7),char(0),char(43),char(0),char(0),char(0),char(69),char(0),char(40),char(0),char(2),char(0),char(38),char(0),char(70),char(0), +char(13),char(0),char(39),char(0),char(41),char(0),char(4),char(0),char(19),char(0),char(71),char(0),char(27),char(0),char(72),char(0),char(4),char(0),char(73),char(0), +char(7),char(0),char(74),char(0),char(42),char(0),char(4),char(0),char(27),char(0),char(38),char(0),char(41),char(0),char(75),char(0),char(4),char(0),char(76),char(0), +char(7),char(0),char(43),char(0),char(43),char(0),char(3),char(0),char(29),char(0),char(47),char(0),char(4),char(0),char(77),char(0),char(0),char(0),char(37),char(0), +char(44),char(0),char(3),char(0),char(29),char(0),char(47),char(0),char(4),char(0),char(78),char(0),char(0),char(0),char(37),char(0),char(45),char(0),char(3),char(0), +char(29),char(0),char(47),char(0),char(4),char(0),char(77),char(0),char(0),char(0),char(37),char(0),char(46),char(0),char(4),char(0),char(4),char(0),char(79),char(0), +char(7),char(0),char(80),char(0),char(7),char(0),char(81),char(0),char(7),char(0),char(82),char(0),char(39),char(0),char(14),char(0),char(4),char(0),char(83),char(0), +char(4),char(0),char(84),char(0),char(46),char(0),char(85),char(0),char(4),char(0),char(86),char(0),char(7),char(0),char(87),char(0),char(7),char(0),char(88),char(0), +char(7),char(0),char(89),char(0),char(7),char(0),char(90),char(0),char(7),char(0),char(91),char(0),char(4),char(0),char(92),char(0),char(4),char(0),char(93),char(0), +char(4),char(0),char(94),char(0),char(4),char(0),char(95),char(0),char(0),char(0),char(37),char(0),char(47),char(0),char(5),char(0),char(27),char(0),char(38),char(0), +char(37),char(0),char(65),char(0),char(13),char(0),char(39),char(0),char(7),char(0),char(43),char(0),char(4),char(0),char(96),char(0),char(48),char(0),char(5),char(0), +char(29),char(0),char(47),char(0),char(13),char(0),char(97),char(0),char(14),char(0),char(98),char(0),char(4),char(0),char(99),char(0),char(0),char(0),char(100),char(0), +char(49),char(0),char(27),char(0),char(9),char(0),char(101),char(0),char(9),char(0),char(102),char(0),char(27),char(0),char(103),char(0),char(0),char(0),char(35),char(0), +char(20),char(0),char(104),char(0),char(20),char(0),char(105),char(0),char(14),char(0),char(106),char(0),char(14),char(0),char(107),char(0),char(14),char(0),char(108),char(0), +char(8),char(0),char(109),char(0),char(8),char(0),char(110),char(0),char(8),char(0),char(111),char(0),char(8),char(0),char(112),char(0),char(8),char(0),char(113),char(0), +char(8),char(0),char(114),char(0),char(8),char(0),char(115),char(0),char(8),char(0),char(116),char(0),char(8),char(0),char(117),char(0),char(8),char(0),char(118),char(0), +char(4),char(0),char(119),char(0),char(4),char(0),char(120),char(0),char(4),char(0),char(121),char(0),char(4),char(0),char(122),char(0),char(4),char(0),char(123),char(0), +char(4),char(0),char(124),char(0),char(4),char(0),char(125),char(0),char(0),char(0),char(37),char(0),char(50),char(0),char(27),char(0),char(9),char(0),char(101),char(0), +char(9),char(0),char(102),char(0),char(27),char(0),char(103),char(0),char(0),char(0),char(35),char(0),char(19),char(0),char(104),char(0),char(19),char(0),char(105),char(0), +char(13),char(0),char(106),char(0),char(13),char(0),char(107),char(0),char(13),char(0),char(108),char(0),char(7),char(0),char(109),char(0),char(7),char(0),char(110),char(0), +char(7),char(0),char(111),char(0),char(7),char(0),char(112),char(0),char(7),char(0),char(113),char(0),char(7),char(0),char(114),char(0),char(7),char(0),char(115),char(0), +char(7),char(0),char(116),char(0),char(7),char(0),char(117),char(0),char(7),char(0),char(118),char(0),char(4),char(0),char(119),char(0),char(4),char(0),char(120),char(0), char(4),char(0),char(121),char(0),char(4),char(0),char(122),char(0),char(4),char(0),char(123),char(0),char(4),char(0),char(124),char(0),char(4),char(0),char(125),char(0), -char(0),char(0),char(37),char(0),char(50),char(0),char(27),char(0),char(9),char(0),char(101),char(0),char(9),char(0),char(102),char(0),char(27),char(0),char(103),char(0), -char(0),char(0),char(35),char(0),char(19),char(0),char(104),char(0),char(19),char(0),char(105),char(0),char(13),char(0),char(106),char(0),char(13),char(0),char(107),char(0), -char(13),char(0),char(108),char(0),char(7),char(0),char(109),char(0),char(7),char(0),char(110),char(0),char(7),char(0),char(111),char(0),char(7),char(0),char(112),char(0), -char(7),char(0),char(113),char(0),char(7),char(0),char(114),char(0),char(7),char(0),char(115),char(0),char(7),char(0),char(116),char(0),char(7),char(0),char(117),char(0), -char(7),char(0),char(118),char(0),char(4),char(0),char(119),char(0),char(4),char(0),char(120),char(0),char(4),char(0),char(121),char(0),char(4),char(0),char(122),char(0), -char(4),char(0),char(123),char(0),char(4),char(0),char(124),char(0),char(4),char(0),char(125),char(0),char(0),char(0),char(37),char(0),char(51),char(0),char(22),char(0), -char(8),char(0),char(126),char(0),char(8),char(0),char(127),char(0),char(8),char(0),char(111),char(0),char(8),char(0),char(-128),char(0),char(8),char(0),char(115),char(0), -char(8),char(0),char(-127),char(0),char(8),char(0),char(-126),char(0),char(8),char(0),char(-125),char(0),char(8),char(0),char(-124),char(0),char(8),char(0),char(-123),char(0), -char(8),char(0),char(-122),char(0),char(8),char(0),char(-121),char(0),char(8),char(0),char(-120),char(0),char(8),char(0),char(-119),char(0),char(8),char(0),char(-118),char(0), -char(8),char(0),char(-117),char(0),char(4),char(0),char(-116),char(0),char(4),char(0),char(-115),char(0),char(4),char(0),char(-114),char(0),char(4),char(0),char(-113),char(0), -char(4),char(0),char(-112),char(0),char(0),char(0),char(37),char(0),char(52),char(0),char(22),char(0),char(7),char(0),char(126),char(0),char(7),char(0),char(127),char(0), -char(7),char(0),char(111),char(0),char(7),char(0),char(-128),char(0),char(7),char(0),char(115),char(0),char(7),char(0),char(-127),char(0),char(7),char(0),char(-126),char(0), -char(7),char(0),char(-125),char(0),char(7),char(0),char(-124),char(0),char(7),char(0),char(-123),char(0),char(7),char(0),char(-122),char(0),char(7),char(0),char(-121),char(0), -char(7),char(0),char(-120),char(0),char(7),char(0),char(-119),char(0),char(7),char(0),char(-118),char(0),char(7),char(0),char(-117),char(0),char(4),char(0),char(-116),char(0), -char(4),char(0),char(-115),char(0),char(4),char(0),char(-114),char(0),char(4),char(0),char(-113),char(0),char(4),char(0),char(-112),char(0),char(0),char(0),char(37),char(0), -char(53),char(0),char(2),char(0),char(51),char(0),char(-111),char(0),char(14),char(0),char(-110),char(0),char(54),char(0),char(2),char(0),char(52),char(0),char(-111),char(0), -char(13),char(0),char(-110),char(0),char(55),char(0),char(21),char(0),char(50),char(0),char(-109),char(0),char(17),char(0),char(-108),char(0),char(13),char(0),char(-107),char(0), -char(13),char(0),char(-106),char(0),char(13),char(0),char(-105),char(0),char(13),char(0),char(-104),char(0),char(13),char(0),char(-110),char(0),char(13),char(0),char(-103),char(0), -char(13),char(0),char(-102),char(0),char(13),char(0),char(-101),char(0),char(13),char(0),char(-100),char(0),char(7),char(0),char(-99),char(0),char(7),char(0),char(-98),char(0), -char(7),char(0),char(-97),char(0),char(7),char(0),char(-96),char(0),char(7),char(0),char(-95),char(0),char(7),char(0),char(-94),char(0),char(7),char(0),char(-93),char(0), -char(7),char(0),char(-92),char(0),char(7),char(0),char(-91),char(0),char(4),char(0),char(-90),char(0),char(56),char(0),char(22),char(0),char(49),char(0),char(-109),char(0), -char(18),char(0),char(-108),char(0),char(14),char(0),char(-107),char(0),char(14),char(0),char(-106),char(0),char(14),char(0),char(-105),char(0),char(14),char(0),char(-104),char(0), -char(14),char(0),char(-110),char(0),char(14),char(0),char(-103),char(0),char(14),char(0),char(-102),char(0),char(14),char(0),char(-101),char(0),char(14),char(0),char(-100),char(0), -char(8),char(0),char(-99),char(0),char(8),char(0),char(-98),char(0),char(8),char(0),char(-97),char(0),char(8),char(0),char(-96),char(0),char(8),char(0),char(-95),char(0), -char(8),char(0),char(-94),char(0),char(8),char(0),char(-93),char(0),char(8),char(0),char(-92),char(0),char(8),char(0),char(-91),char(0),char(4),char(0),char(-90),char(0), -char(0),char(0),char(37),char(0),char(57),char(0),char(2),char(0),char(4),char(0),char(-89),char(0),char(4),char(0),char(-88),char(0),char(58),char(0),char(13),char(0), -char(55),char(0),char(-87),char(0),char(55),char(0),char(-86),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0), -char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0),char(7),char(0),char(-81),char(0),char(7),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0), -char(4),char(0),char(-78),char(0),char(7),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0),char(59),char(0),char(13),char(0),char(60),char(0),char(-87),char(0), -char(60),char(0),char(-86),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0),char(4),char(0),char(-83),char(0), -char(4),char(0),char(-82),char(0),char(7),char(0),char(-81),char(0),char(7),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0),char(4),char(0),char(-78),char(0), -char(7),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0),char(61),char(0),char(14),char(0),char(56),char(0),char(-87),char(0),char(56),char(0),char(-86),char(0), -char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0),char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0), -char(8),char(0),char(-81),char(0),char(8),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0),char(4),char(0),char(-78),char(0),char(8),char(0),char(-77),char(0), -char(4),char(0),char(-76),char(0),char(0),char(0),char(-75),char(0),char(62),char(0),char(3),char(0),char(59),char(0),char(-74),char(0),char(13),char(0),char(-73),char(0), -char(13),char(0),char(-72),char(0),char(63),char(0),char(3),char(0),char(61),char(0),char(-74),char(0),char(14),char(0),char(-73),char(0),char(14),char(0),char(-72),char(0), -char(64),char(0),char(3),char(0),char(59),char(0),char(-74),char(0),char(14),char(0),char(-73),char(0),char(14),char(0),char(-72),char(0),char(65),char(0),char(13),char(0), -char(59),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0), -char(4),char(0),char(-67),char(0),char(7),char(0),char(-66),char(0),char(7),char(0),char(-65),char(0),char(7),char(0),char(-64),char(0),char(7),char(0),char(-63),char(0), -char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0),char(66),char(0),char(13),char(0),char(59),char(0),char(-74),char(0), -char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0),char(4),char(0),char(-67),char(0), -char(7),char(0),char(-66),char(0),char(7),char(0),char(-65),char(0),char(7),char(0),char(-64),char(0),char(7),char(0),char(-63),char(0),char(7),char(0),char(-62),char(0), -char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0),char(67),char(0),char(14),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0), -char(20),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0),char(4),char(0),char(-67),char(0),char(8),char(0),char(-66),char(0), -char(8),char(0),char(-65),char(0),char(8),char(0),char(-64),char(0),char(8),char(0),char(-63),char(0),char(8),char(0),char(-62),char(0),char(8),char(0),char(-61),char(0), -char(8),char(0),char(-60),char(0),char(0),char(0),char(-59),char(0),char(68),char(0),char(10),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0), -char(20),char(0),char(-70),char(0),char(8),char(0),char(-58),char(0),char(8),char(0),char(-57),char(0),char(8),char(0),char(-56),char(0),char(8),char(0),char(-62),char(0), -char(8),char(0),char(-61),char(0),char(8),char(0),char(-60),char(0),char(8),char(0),char(127),char(0),char(69),char(0),char(11),char(0),char(59),char(0),char(-74),char(0), -char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(7),char(0),char(-58),char(0),char(7),char(0),char(-57),char(0),char(7),char(0),char(-56),char(0), -char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0),char(7),char(0),char(127),char(0),char(0),char(0),char(21),char(0), -char(70),char(0),char(9),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(13),char(0),char(-55),char(0), -char(13),char(0),char(-54),char(0),char(13),char(0),char(-53),char(0),char(13),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0), -char(71),char(0),char(9),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(14),char(0),char(-55),char(0), -char(14),char(0),char(-54),char(0),char(14),char(0),char(-53),char(0),char(14),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0), -char(72),char(0),char(5),char(0),char(70),char(0),char(-49),char(0),char(4),char(0),char(-48),char(0),char(7),char(0),char(-47),char(0),char(7),char(0),char(-46),char(0), -char(7),char(0),char(-45),char(0),char(73),char(0),char(5),char(0),char(71),char(0),char(-49),char(0),char(4),char(0),char(-48),char(0),char(8),char(0),char(-47),char(0), -char(8),char(0),char(-46),char(0),char(8),char(0),char(-45),char(0),char(74),char(0),char(41),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0), -char(19),char(0),char(-70),char(0),char(13),char(0),char(-55),char(0),char(13),char(0),char(-54),char(0),char(13),char(0),char(-44),char(0),char(13),char(0),char(-43),char(0), -char(13),char(0),char(-42),char(0),char(13),char(0),char(-41),char(0),char(13),char(0),char(-40),char(0),char(13),char(0),char(-39),char(0),char(13),char(0),char(-38),char(0), -char(13),char(0),char(-37),char(0),char(13),char(0),char(-36),char(0),char(13),char(0),char(-35),char(0),char(13),char(0),char(-34),char(0),char(0),char(0),char(-33),char(0), -char(0),char(0),char(-32),char(0),char(0),char(0),char(-31),char(0),char(0),char(0),char(-30),char(0),char(0),char(0),char(-29),char(0),char(0),char(0),char(-59),char(0), -char(13),char(0),char(-53),char(0),char(13),char(0),char(-52),char(0),char(13),char(0),char(-28),char(0),char(13),char(0),char(-27),char(0),char(13),char(0),char(-26),char(0), -char(13),char(0),char(-25),char(0),char(13),char(0),char(-24),char(0),char(13),char(0),char(-23),char(0),char(13),char(0),char(-22),char(0),char(13),char(0),char(-21),char(0), -char(13),char(0),char(-20),char(0),char(13),char(0),char(-19),char(0),char(13),char(0),char(-18),char(0),char(0),char(0),char(-17),char(0),char(0),char(0),char(-16),char(0), -char(0),char(0),char(-15),char(0),char(0),char(0),char(-14),char(0),char(0),char(0),char(-13),char(0),char(4),char(0),char(-12),char(0),char(75),char(0),char(41),char(0), -char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(14),char(0),char(-55),char(0),char(14),char(0),char(-54),char(0), -char(14),char(0),char(-44),char(0),char(14),char(0),char(-43),char(0),char(14),char(0),char(-42),char(0),char(14),char(0),char(-41),char(0),char(14),char(0),char(-40),char(0), -char(14),char(0),char(-39),char(0),char(14),char(0),char(-38),char(0),char(14),char(0),char(-37),char(0),char(14),char(0),char(-36),char(0),char(14),char(0),char(-35),char(0), -char(14),char(0),char(-34),char(0),char(0),char(0),char(-33),char(0),char(0),char(0),char(-32),char(0),char(0),char(0),char(-31),char(0),char(0),char(0),char(-30),char(0), -char(0),char(0),char(-29),char(0),char(0),char(0),char(-59),char(0),char(14),char(0),char(-53),char(0),char(14),char(0),char(-52),char(0),char(14),char(0),char(-28),char(0), -char(14),char(0),char(-27),char(0),char(14),char(0),char(-26),char(0),char(14),char(0),char(-25),char(0),char(14),char(0),char(-24),char(0),char(14),char(0),char(-23),char(0), -char(14),char(0),char(-22),char(0),char(14),char(0),char(-21),char(0),char(14),char(0),char(-20),char(0),char(14),char(0),char(-19),char(0),char(14),char(0),char(-18),char(0), +char(0),char(0),char(37),char(0),char(51),char(0),char(22),char(0),char(8),char(0),char(126),char(0),char(8),char(0),char(127),char(0),char(8),char(0),char(111),char(0), +char(8),char(0),char(-128),char(0),char(8),char(0),char(115),char(0),char(8),char(0),char(-127),char(0),char(8),char(0),char(-126),char(0),char(8),char(0),char(-125),char(0), +char(8),char(0),char(-124),char(0),char(8),char(0),char(-123),char(0),char(8),char(0),char(-122),char(0),char(8),char(0),char(-121),char(0),char(8),char(0),char(-120),char(0), +char(8),char(0),char(-119),char(0),char(8),char(0),char(-118),char(0),char(8),char(0),char(-117),char(0),char(4),char(0),char(-116),char(0),char(4),char(0),char(-115),char(0), +char(4),char(0),char(-114),char(0),char(4),char(0),char(-113),char(0),char(4),char(0),char(-112),char(0),char(0),char(0),char(37),char(0),char(52),char(0),char(22),char(0), +char(7),char(0),char(126),char(0),char(7),char(0),char(127),char(0),char(7),char(0),char(111),char(0),char(7),char(0),char(-128),char(0),char(7),char(0),char(115),char(0), +char(7),char(0),char(-127),char(0),char(7),char(0),char(-126),char(0),char(7),char(0),char(-125),char(0),char(7),char(0),char(-124),char(0),char(7),char(0),char(-123),char(0), +char(7),char(0),char(-122),char(0),char(7),char(0),char(-121),char(0),char(7),char(0),char(-120),char(0),char(7),char(0),char(-119),char(0),char(7),char(0),char(-118),char(0), +char(7),char(0),char(-117),char(0),char(4),char(0),char(-116),char(0),char(4),char(0),char(-115),char(0),char(4),char(0),char(-114),char(0),char(4),char(0),char(-113),char(0), +char(4),char(0),char(-112),char(0),char(0),char(0),char(37),char(0),char(53),char(0),char(2),char(0),char(51),char(0),char(-111),char(0),char(14),char(0),char(-110),char(0), +char(54),char(0),char(2),char(0),char(52),char(0),char(-111),char(0),char(13),char(0),char(-110),char(0),char(55),char(0),char(21),char(0),char(50),char(0),char(-109),char(0), +char(17),char(0),char(-108),char(0),char(13),char(0),char(-107),char(0),char(13),char(0),char(-106),char(0),char(13),char(0),char(-105),char(0),char(13),char(0),char(-104),char(0), +char(13),char(0),char(-110),char(0),char(13),char(0),char(-103),char(0),char(13),char(0),char(-102),char(0),char(13),char(0),char(-101),char(0),char(13),char(0),char(-100),char(0), +char(7),char(0),char(-99),char(0),char(7),char(0),char(-98),char(0),char(7),char(0),char(-97),char(0),char(7),char(0),char(-96),char(0),char(7),char(0),char(-95),char(0), +char(7),char(0),char(-94),char(0),char(7),char(0),char(-93),char(0),char(7),char(0),char(-92),char(0),char(7),char(0),char(-91),char(0),char(4),char(0),char(-90),char(0), +char(56),char(0),char(22),char(0),char(49),char(0),char(-109),char(0),char(18),char(0),char(-108),char(0),char(14),char(0),char(-107),char(0),char(14),char(0),char(-106),char(0), +char(14),char(0),char(-105),char(0),char(14),char(0),char(-104),char(0),char(14),char(0),char(-110),char(0),char(14),char(0),char(-103),char(0),char(14),char(0),char(-102),char(0), +char(14),char(0),char(-101),char(0),char(14),char(0),char(-100),char(0),char(8),char(0),char(-99),char(0),char(8),char(0),char(-98),char(0),char(8),char(0),char(-97),char(0), +char(8),char(0),char(-96),char(0),char(8),char(0),char(-95),char(0),char(8),char(0),char(-94),char(0),char(8),char(0),char(-93),char(0),char(8),char(0),char(-92),char(0), +char(8),char(0),char(-91),char(0),char(4),char(0),char(-90),char(0),char(0),char(0),char(37),char(0),char(57),char(0),char(2),char(0),char(4),char(0),char(-89),char(0), +char(4),char(0),char(-88),char(0),char(58),char(0),char(13),char(0),char(55),char(0),char(-87),char(0),char(55),char(0),char(-86),char(0),char(0),char(0),char(35),char(0), +char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0),char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0),char(7),char(0),char(-81),char(0), +char(7),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0),char(4),char(0),char(-78),char(0),char(7),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0), +char(59),char(0),char(13),char(0),char(60),char(0),char(-87),char(0),char(60),char(0),char(-86),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0), +char(4),char(0),char(-84),char(0),char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0),char(7),char(0),char(-81),char(0),char(7),char(0),char(-80),char(0), +char(4),char(0),char(-79),char(0),char(4),char(0),char(-78),char(0),char(7),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0),char(61),char(0),char(14),char(0), +char(56),char(0),char(-87),char(0),char(56),char(0),char(-86),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0), +char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0),char(8),char(0),char(-81),char(0),char(8),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0), +char(4),char(0),char(-78),char(0),char(8),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0),char(0),char(0),char(-75),char(0),char(62),char(0),char(3),char(0), +char(59),char(0),char(-74),char(0),char(13),char(0),char(-73),char(0),char(13),char(0),char(-72),char(0),char(63),char(0),char(3),char(0),char(61),char(0),char(-74),char(0), +char(14),char(0),char(-73),char(0),char(14),char(0),char(-72),char(0),char(64),char(0),char(3),char(0),char(59),char(0),char(-74),char(0),char(14),char(0),char(-73),char(0), +char(14),char(0),char(-72),char(0),char(65),char(0),char(13),char(0),char(59),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0), +char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0),char(4),char(0),char(-67),char(0),char(7),char(0),char(-66),char(0),char(7),char(0),char(-65),char(0), +char(7),char(0),char(-64),char(0),char(7),char(0),char(-63),char(0),char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0), +char(66),char(0),char(13),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0), +char(4),char(0),char(-68),char(0),char(4),char(0),char(-67),char(0),char(7),char(0),char(-66),char(0),char(7),char(0),char(-65),char(0),char(7),char(0),char(-64),char(0), +char(7),char(0),char(-63),char(0),char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0),char(67),char(0),char(14),char(0), +char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0), +char(4),char(0),char(-67),char(0),char(8),char(0),char(-66),char(0),char(8),char(0),char(-65),char(0),char(8),char(0),char(-64),char(0),char(8),char(0),char(-63),char(0), +char(8),char(0),char(-62),char(0),char(8),char(0),char(-61),char(0),char(8),char(0),char(-60),char(0),char(0),char(0),char(-59),char(0),char(68),char(0),char(10),char(0), +char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(8),char(0),char(-58),char(0),char(8),char(0),char(-57),char(0), +char(8),char(0),char(-56),char(0),char(8),char(0),char(-62),char(0),char(8),char(0),char(-61),char(0),char(8),char(0),char(-60),char(0),char(8),char(0),char(127),char(0), +char(69),char(0),char(11),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(7),char(0),char(-58),char(0), +char(7),char(0),char(-57),char(0),char(7),char(0),char(-56),char(0),char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0), +char(7),char(0),char(127),char(0),char(0),char(0),char(21),char(0),char(70),char(0),char(9),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0), +char(19),char(0),char(-70),char(0),char(13),char(0),char(-55),char(0),char(13),char(0),char(-54),char(0),char(13),char(0),char(-53),char(0),char(13),char(0),char(-52),char(0), +char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0),char(71),char(0),char(9),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0), +char(20),char(0),char(-70),char(0),char(14),char(0),char(-55),char(0),char(14),char(0),char(-54),char(0),char(14),char(0),char(-53),char(0),char(14),char(0),char(-52),char(0), +char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0),char(72),char(0),char(5),char(0),char(70),char(0),char(-49),char(0),char(4),char(0),char(-48),char(0), +char(7),char(0),char(-47),char(0),char(7),char(0),char(-46),char(0),char(7),char(0),char(-45),char(0),char(73),char(0),char(5),char(0),char(71),char(0),char(-49),char(0), +char(4),char(0),char(-48),char(0),char(8),char(0),char(-47),char(0),char(8),char(0),char(-46),char(0),char(8),char(0),char(-45),char(0),char(74),char(0),char(41),char(0), +char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(13),char(0),char(-55),char(0),char(13),char(0),char(-54),char(0), +char(13),char(0),char(-44),char(0),char(13),char(0),char(-43),char(0),char(13),char(0),char(-42),char(0),char(13),char(0),char(-41),char(0),char(13),char(0),char(-40),char(0), +char(13),char(0),char(-39),char(0),char(13),char(0),char(-38),char(0),char(13),char(0),char(-37),char(0),char(13),char(0),char(-36),char(0),char(13),char(0),char(-35),char(0), +char(13),char(0),char(-34),char(0),char(0),char(0),char(-33),char(0),char(0),char(0),char(-32),char(0),char(0),char(0),char(-31),char(0),char(0),char(0),char(-30),char(0), +char(0),char(0),char(-29),char(0),char(0),char(0),char(-59),char(0),char(13),char(0),char(-53),char(0),char(13),char(0),char(-52),char(0),char(13),char(0),char(-28),char(0), +char(13),char(0),char(-27),char(0),char(13),char(0),char(-26),char(0),char(13),char(0),char(-25),char(0),char(13),char(0),char(-24),char(0),char(13),char(0),char(-23),char(0), +char(13),char(0),char(-22),char(0),char(13),char(0),char(-21),char(0),char(13),char(0),char(-20),char(0),char(13),char(0),char(-19),char(0),char(13),char(0),char(-18),char(0), char(0),char(0),char(-17),char(0),char(0),char(0),char(-16),char(0),char(0),char(0),char(-15),char(0),char(0),char(0),char(-14),char(0),char(0),char(0),char(-13),char(0), -char(4),char(0),char(-12),char(0),char(76),char(0),char(9),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0), -char(7),char(0),char(-55),char(0),char(7),char(0),char(-54),char(0),char(7),char(0),char(-53),char(0),char(7),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0), -char(4),char(0),char(-50),char(0),char(77),char(0),char(9),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0), -char(8),char(0),char(-55),char(0),char(8),char(0),char(-54),char(0),char(8),char(0),char(-53),char(0),char(8),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0), -char(4),char(0),char(-50),char(0),char(78),char(0),char(5),char(0),char(58),char(0),char(-74),char(0),char(13),char(0),char(-11),char(0),char(13),char(0),char(-10),char(0), -char(7),char(0),char(-9),char(0),char(0),char(0),char(37),char(0),char(79),char(0),char(4),char(0),char(61),char(0),char(-74),char(0),char(14),char(0),char(-11),char(0), -char(14),char(0),char(-10),char(0),char(8),char(0),char(-9),char(0),char(80),char(0),char(4),char(0),char(7),char(0),char(-8),char(0),char(7),char(0),char(-7),char(0), -char(7),char(0),char(-6),char(0),char(4),char(0),char(79),char(0),char(81),char(0),char(10),char(0),char(80),char(0),char(-5),char(0),char(13),char(0),char(-4),char(0), -char(13),char(0),char(-3),char(0),char(13),char(0),char(-2),char(0),char(13),char(0),char(-1),char(0),char(13),char(0),char(0),char(1),char(7),char(0),char(-99),char(0), -char(7),char(0),char(1),char(1),char(4),char(0),char(2),char(1),char(4),char(0),char(53),char(0),char(82),char(0),char(4),char(0),char(80),char(0),char(-5),char(0), -char(4),char(0),char(3),char(1),char(7),char(0),char(4),char(1),char(4),char(0),char(5),char(1),char(83),char(0),char(4),char(0),char(13),char(0),char(0),char(1), -char(80),char(0),char(-5),char(0),char(4),char(0),char(6),char(1),char(7),char(0),char(7),char(1),char(84),char(0),char(7),char(0),char(13),char(0),char(8),char(1), -char(80),char(0),char(-5),char(0),char(4),char(0),char(9),char(1),char(7),char(0),char(10),char(1),char(7),char(0),char(11),char(1),char(7),char(0),char(12),char(1), -char(4),char(0),char(53),char(0),char(85),char(0),char(6),char(0),char(17),char(0),char(13),char(1),char(13),char(0),char(11),char(1),char(13),char(0),char(14),char(1), -char(60),char(0),char(15),char(1),char(4),char(0),char(16),char(1),char(7),char(0),char(12),char(1),char(86),char(0),char(26),char(0),char(4),char(0),char(17),char(1), -char(7),char(0),char(18),char(1),char(7),char(0),char(127),char(0),char(7),char(0),char(19),char(1),char(7),char(0),char(20),char(1),char(7),char(0),char(21),char(1), -char(7),char(0),char(22),char(1),char(7),char(0),char(23),char(1),char(7),char(0),char(24),char(1),char(7),char(0),char(25),char(1),char(7),char(0),char(26),char(1), -char(7),char(0),char(27),char(1),char(7),char(0),char(28),char(1),char(7),char(0),char(29),char(1),char(7),char(0),char(30),char(1),char(7),char(0),char(31),char(1), -char(7),char(0),char(32),char(1),char(7),char(0),char(33),char(1),char(7),char(0),char(34),char(1),char(7),char(0),char(35),char(1),char(7),char(0),char(36),char(1), -char(4),char(0),char(37),char(1),char(4),char(0),char(38),char(1),char(4),char(0),char(39),char(1),char(4),char(0),char(40),char(1),char(4),char(0),char(120),char(0), -char(87),char(0),char(12),char(0),char(17),char(0),char(41),char(1),char(17),char(0),char(42),char(1),char(17),char(0),char(43),char(1),char(13),char(0),char(44),char(1), -char(13),char(0),char(45),char(1),char(7),char(0),char(46),char(1),char(4),char(0),char(47),char(1),char(4),char(0),char(48),char(1),char(4),char(0),char(49),char(1), -char(4),char(0),char(50),char(1),char(7),char(0),char(10),char(1),char(4),char(0),char(53),char(0),char(88),char(0),char(27),char(0),char(19),char(0),char(51),char(1), -char(17),char(0),char(52),char(1),char(17),char(0),char(53),char(1),char(13),char(0),char(44),char(1),char(13),char(0),char(54),char(1),char(13),char(0),char(55),char(1), -char(13),char(0),char(56),char(1),char(13),char(0),char(57),char(1),char(13),char(0),char(58),char(1),char(4),char(0),char(59),char(1),char(7),char(0),char(60),char(1), -char(4),char(0),char(61),char(1),char(4),char(0),char(62),char(1),char(4),char(0),char(63),char(1),char(7),char(0),char(64),char(1),char(7),char(0),char(65),char(1), -char(4),char(0),char(66),char(1),char(4),char(0),char(67),char(1),char(7),char(0),char(68),char(1),char(7),char(0),char(69),char(1),char(7),char(0),char(70),char(1), -char(7),char(0),char(71),char(1),char(7),char(0),char(72),char(1),char(7),char(0),char(73),char(1),char(4),char(0),char(74),char(1),char(4),char(0),char(75),char(1), -char(4),char(0),char(76),char(1),char(89),char(0),char(12),char(0),char(9),char(0),char(77),char(1),char(9),char(0),char(78),char(1),char(13),char(0),char(79),char(1), -char(7),char(0),char(80),char(1),char(7),char(0),char(-125),char(0),char(7),char(0),char(81),char(1),char(4),char(0),char(82),char(1),char(13),char(0),char(83),char(1), -char(4),char(0),char(84),char(1),char(4),char(0),char(85),char(1),char(4),char(0),char(86),char(1),char(4),char(0),char(53),char(0),char(90),char(0),char(19),char(0), -char(50),char(0),char(-109),char(0),char(87),char(0),char(87),char(1),char(80),char(0),char(88),char(1),char(81),char(0),char(89),char(1),char(82),char(0),char(90),char(1), -char(83),char(0),char(91),char(1),char(84),char(0),char(92),char(1),char(85),char(0),char(93),char(1),char(88),char(0),char(94),char(1),char(89),char(0),char(95),char(1), -char(4),char(0),char(96),char(1),char(4),char(0),char(62),char(1),char(4),char(0),char(97),char(1),char(4),char(0),char(98),char(1),char(4),char(0),char(99),char(1), -char(4),char(0),char(100),char(1),char(4),char(0),char(101),char(1),char(4),char(0),char(102),char(1),char(86),char(0),char(103),char(1),char(91),char(0),char(20),char(0), -char(16),char(0),char(104),char(1),char(14),char(0),char(105),char(1),char(14),char(0),char(106),char(1),char(14),char(0),char(107),char(1),char(14),char(0),char(108),char(1), -char(14),char(0),char(109),char(1),char(8),char(0),char(110),char(1),char(4),char(0),char(111),char(1),char(4),char(0),char(86),char(1),char(4),char(0),char(112),char(1), -char(4),char(0),char(113),char(1),char(8),char(0),char(114),char(1),char(8),char(0),char(115),char(1),char(8),char(0),char(116),char(1),char(8),char(0),char(117),char(1), -char(8),char(0),char(118),char(1),char(0),char(0),char(119),char(1),char(0),char(0),char(120),char(1),char(49),char(0),char(121),char(1),char(0),char(0),char(122),char(1), -char(92),char(0),char(20),char(0),char(15),char(0),char(104),char(1),char(13),char(0),char(105),char(1),char(13),char(0),char(106),char(1),char(13),char(0),char(107),char(1), -char(13),char(0),char(108),char(1),char(13),char(0),char(109),char(1),char(4),char(0),char(112),char(1),char(7),char(0),char(110),char(1),char(4),char(0),char(111),char(1), -char(4),char(0),char(86),char(1),char(7),char(0),char(114),char(1),char(7),char(0),char(115),char(1),char(7),char(0),char(116),char(1),char(4),char(0),char(113),char(1), -char(7),char(0),char(117),char(1),char(7),char(0),char(118),char(1),char(0),char(0),char(119),char(1),char(0),char(0),char(120),char(1),char(50),char(0),char(121),char(1), -char(0),char(0),char(122),char(1),char(93),char(0),char(9),char(0),char(20),char(0),char(123),char(1),char(14),char(0),char(124),char(1),char(8),char(0),char(125),char(1), -char(0),char(0),char(126),char(1),char(91),char(0),char(90),char(1),char(49),char(0),char(127),char(1),char(0),char(0),char(122),char(1),char(4),char(0),char(97),char(1), -char(0),char(0),char(37),char(0),char(94),char(0),char(7),char(0),char(0),char(0),char(126),char(1),char(92),char(0),char(90),char(1),char(50),char(0),char(127),char(1), -char(19),char(0),char(123),char(1),char(13),char(0),char(124),char(1),char(7),char(0),char(125),char(1),char(4),char(0),char(97),char(1),}; +char(4),char(0),char(-12),char(0),char(75),char(0),char(41),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0), +char(14),char(0),char(-55),char(0),char(14),char(0),char(-54),char(0),char(14),char(0),char(-44),char(0),char(14),char(0),char(-43),char(0),char(14),char(0),char(-42),char(0), +char(14),char(0),char(-41),char(0),char(14),char(0),char(-40),char(0),char(14),char(0),char(-39),char(0),char(14),char(0),char(-38),char(0),char(14),char(0),char(-37),char(0), +char(14),char(0),char(-36),char(0),char(14),char(0),char(-35),char(0),char(14),char(0),char(-34),char(0),char(0),char(0),char(-33),char(0),char(0),char(0),char(-32),char(0), +char(0),char(0),char(-31),char(0),char(0),char(0),char(-30),char(0),char(0),char(0),char(-29),char(0),char(0),char(0),char(-59),char(0),char(14),char(0),char(-53),char(0), +char(14),char(0),char(-52),char(0),char(14),char(0),char(-28),char(0),char(14),char(0),char(-27),char(0),char(14),char(0),char(-26),char(0),char(14),char(0),char(-25),char(0), +char(14),char(0),char(-24),char(0),char(14),char(0),char(-23),char(0),char(14),char(0),char(-22),char(0),char(14),char(0),char(-21),char(0),char(14),char(0),char(-20),char(0), +char(14),char(0),char(-19),char(0),char(14),char(0),char(-18),char(0),char(0),char(0),char(-17),char(0),char(0),char(0),char(-16),char(0),char(0),char(0),char(-15),char(0), +char(0),char(0),char(-14),char(0),char(0),char(0),char(-13),char(0),char(4),char(0),char(-12),char(0),char(76),char(0),char(9),char(0),char(59),char(0),char(-74),char(0), +char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(7),char(0),char(-55),char(0),char(7),char(0),char(-54),char(0),char(7),char(0),char(-53),char(0), +char(7),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0),char(77),char(0),char(9),char(0),char(61),char(0),char(-74),char(0), +char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(8),char(0),char(-55),char(0),char(8),char(0),char(-54),char(0),char(8),char(0),char(-53),char(0), +char(8),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0),char(78),char(0),char(5),char(0),char(58),char(0),char(-74),char(0), +char(13),char(0),char(-11),char(0),char(13),char(0),char(-10),char(0),char(7),char(0),char(-9),char(0),char(0),char(0),char(37),char(0),char(79),char(0),char(4),char(0), +char(61),char(0),char(-74),char(0),char(14),char(0),char(-11),char(0),char(14),char(0),char(-10),char(0),char(8),char(0),char(-9),char(0),char(80),char(0),char(4),char(0), +char(7),char(0),char(-8),char(0),char(7),char(0),char(-7),char(0),char(7),char(0),char(-6),char(0),char(4),char(0),char(79),char(0),char(81),char(0),char(10),char(0), +char(80),char(0),char(-5),char(0),char(13),char(0),char(-4),char(0),char(13),char(0),char(-3),char(0),char(13),char(0),char(-2),char(0),char(13),char(0),char(-1),char(0), +char(13),char(0),char(0),char(1),char(7),char(0),char(-99),char(0),char(7),char(0),char(1),char(1),char(4),char(0),char(2),char(1),char(4),char(0),char(53),char(0), +char(82),char(0),char(4),char(0),char(80),char(0),char(-5),char(0),char(4),char(0),char(3),char(1),char(7),char(0),char(4),char(1),char(4),char(0),char(5),char(1), +char(83),char(0),char(4),char(0),char(13),char(0),char(0),char(1),char(80),char(0),char(-5),char(0),char(4),char(0),char(6),char(1),char(7),char(0),char(7),char(1), +char(84),char(0),char(7),char(0),char(13),char(0),char(8),char(1),char(80),char(0),char(-5),char(0),char(4),char(0),char(9),char(1),char(7),char(0),char(10),char(1), +char(7),char(0),char(11),char(1),char(7),char(0),char(12),char(1),char(4),char(0),char(53),char(0),char(85),char(0),char(6),char(0),char(17),char(0),char(13),char(1), +char(13),char(0),char(11),char(1),char(13),char(0),char(14),char(1),char(60),char(0),char(15),char(1),char(4),char(0),char(16),char(1),char(7),char(0),char(12),char(1), +char(86),char(0),char(26),char(0),char(4),char(0),char(17),char(1),char(7),char(0),char(18),char(1),char(7),char(0),char(127),char(0),char(7),char(0),char(19),char(1), +char(7),char(0),char(20),char(1),char(7),char(0),char(21),char(1),char(7),char(0),char(22),char(1),char(7),char(0),char(23),char(1),char(7),char(0),char(24),char(1), +char(7),char(0),char(25),char(1),char(7),char(0),char(26),char(1),char(7),char(0),char(27),char(1),char(7),char(0),char(28),char(1),char(7),char(0),char(29),char(1), +char(7),char(0),char(30),char(1),char(7),char(0),char(31),char(1),char(7),char(0),char(32),char(1),char(7),char(0),char(33),char(1),char(7),char(0),char(34),char(1), +char(7),char(0),char(35),char(1),char(7),char(0),char(36),char(1),char(4),char(0),char(37),char(1),char(4),char(0),char(38),char(1),char(4),char(0),char(39),char(1), +char(4),char(0),char(40),char(1),char(4),char(0),char(120),char(0),char(87),char(0),char(12),char(0),char(17),char(0),char(41),char(1),char(17),char(0),char(42),char(1), +char(17),char(0),char(43),char(1),char(13),char(0),char(44),char(1),char(13),char(0),char(45),char(1),char(7),char(0),char(46),char(1),char(4),char(0),char(47),char(1), +char(4),char(0),char(48),char(1),char(4),char(0),char(49),char(1),char(4),char(0),char(50),char(1),char(7),char(0),char(10),char(1),char(4),char(0),char(53),char(0), +char(88),char(0),char(27),char(0),char(19),char(0),char(51),char(1),char(17),char(0),char(52),char(1),char(17),char(0),char(53),char(1),char(13),char(0),char(44),char(1), +char(13),char(0),char(54),char(1),char(13),char(0),char(55),char(1),char(13),char(0),char(56),char(1),char(13),char(0),char(57),char(1),char(13),char(0),char(58),char(1), +char(4),char(0),char(59),char(1),char(7),char(0),char(60),char(1),char(4),char(0),char(61),char(1),char(4),char(0),char(62),char(1),char(4),char(0),char(63),char(1), +char(7),char(0),char(64),char(1),char(7),char(0),char(65),char(1),char(4),char(0),char(66),char(1),char(4),char(0),char(67),char(1),char(7),char(0),char(68),char(1), +char(7),char(0),char(69),char(1),char(7),char(0),char(70),char(1),char(7),char(0),char(71),char(1),char(7),char(0),char(72),char(1),char(7),char(0),char(73),char(1), +char(4),char(0),char(74),char(1),char(4),char(0),char(75),char(1),char(4),char(0),char(76),char(1),char(89),char(0),char(12),char(0),char(9),char(0),char(77),char(1), +char(9),char(0),char(78),char(1),char(13),char(0),char(79),char(1),char(7),char(0),char(80),char(1),char(7),char(0),char(-125),char(0),char(7),char(0),char(81),char(1), +char(4),char(0),char(82),char(1),char(13),char(0),char(83),char(1),char(4),char(0),char(84),char(1),char(4),char(0),char(85),char(1),char(4),char(0),char(86),char(1), +char(4),char(0),char(53),char(0),char(90),char(0),char(19),char(0),char(50),char(0),char(-109),char(0),char(87),char(0),char(87),char(1),char(80),char(0),char(88),char(1), +char(81),char(0),char(89),char(1),char(82),char(0),char(90),char(1),char(83),char(0),char(91),char(1),char(84),char(0),char(92),char(1),char(85),char(0),char(93),char(1), +char(88),char(0),char(94),char(1),char(89),char(0),char(95),char(1),char(4),char(0),char(96),char(1),char(4),char(0),char(62),char(1),char(4),char(0),char(97),char(1), +char(4),char(0),char(98),char(1),char(4),char(0),char(99),char(1),char(4),char(0),char(100),char(1),char(4),char(0),char(101),char(1),char(4),char(0),char(102),char(1), +char(86),char(0),char(103),char(1),char(91),char(0),char(24),char(0),char(16),char(0),char(104),char(1),char(14),char(0),char(105),char(1),char(14),char(0),char(106),char(1), +char(14),char(0),char(107),char(1),char(14),char(0),char(108),char(1),char(14),char(0),char(109),char(1),char(8),char(0),char(110),char(1),char(4),char(0),char(111),char(1), +char(4),char(0),char(86),char(1),char(4),char(0),char(112),char(1),char(4),char(0),char(113),char(1),char(8),char(0),char(114),char(1),char(8),char(0),char(115),char(1), +char(8),char(0),char(116),char(1),char(8),char(0),char(117),char(1),char(8),char(0),char(118),char(1),char(8),char(0),char(119),char(1),char(8),char(0),char(120),char(1), +char(8),char(0),char(121),char(1),char(8),char(0),char(122),char(1),char(0),char(0),char(123),char(1),char(0),char(0),char(124),char(1),char(49),char(0),char(125),char(1), +char(0),char(0),char(126),char(1),char(92),char(0),char(24),char(0),char(15),char(0),char(104),char(1),char(13),char(0),char(105),char(1),char(13),char(0),char(106),char(1), +char(13),char(0),char(107),char(1),char(13),char(0),char(108),char(1),char(13),char(0),char(109),char(1),char(4),char(0),char(112),char(1),char(7),char(0),char(110),char(1), +char(4),char(0),char(111),char(1),char(4),char(0),char(86),char(1),char(7),char(0),char(114),char(1),char(7),char(0),char(115),char(1),char(7),char(0),char(116),char(1), +char(4),char(0),char(113),char(1),char(7),char(0),char(117),char(1),char(7),char(0),char(118),char(1),char(7),char(0),char(119),char(1),char(7),char(0),char(120),char(1), +char(7),char(0),char(121),char(1),char(7),char(0),char(122),char(1),char(0),char(0),char(123),char(1),char(0),char(0),char(124),char(1),char(50),char(0),char(125),char(1), +char(0),char(0),char(126),char(1),char(93),char(0),char(9),char(0),char(20),char(0),char(127),char(1),char(14),char(0),char(-128),char(1),char(8),char(0),char(-127),char(1), +char(0),char(0),char(-126),char(1),char(91),char(0),char(90),char(1),char(49),char(0),char(-125),char(1),char(0),char(0),char(126),char(1),char(4),char(0),char(97),char(1), +char(0),char(0),char(37),char(0),char(94),char(0),char(7),char(0),char(0),char(0),char(-126),char(1),char(92),char(0),char(90),char(1),char(50),char(0),char(-125),char(1), +char(19),char(0),char(127),char(1),char(13),char(0),char(-128),char(1),char(7),char(0),char(-127),char(1),char(4),char(0),char(97),char(1),}; int sBulletDNAlen= sizeof(sBulletDNAstr); - -char sBulletDNAstr64[]= { -char(83),char(68),char(78),char(65),char(78),char(65),char(77),char(69),char(-128),char(1),char(0),char(0),char(109),char(95),char(115),char(105),char(122),char(101),char(0),char(109), -char(95),char(99),char(97),char(112),char(97),char(99),char(105),char(116),char(121),char(0),char(42),char(109),char(95),char(100),char(97),char(116),char(97),char(0),char(109),char(95), -char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(115),char(0),char(109),char(95),char(99),char(111), -char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99),char(116),char(115),char(0),char(109),char(95),char(99),char(111),char(110), -char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(115),char(0),char(42),char(102),char(105),char(114),char(115),char(116),char(0),char(42),char(108),char(97),char(115), -char(116),char(0),char(109),char(95),char(102),char(108),char(111),char(97),char(116),char(115),char(91),char(52),char(93),char(0),char(109),char(95),char(101),char(108),char(91),char(51), -char(93),char(0),char(109),char(95),char(98),char(97),char(115),char(105),char(115),char(0),char(109),char(95),char(111),char(114),char(105),char(103),char(105),char(110),char(0),char(109), -char(95),char(114),char(111),char(111),char(116),char(78),char(111),char(100),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109),char(95),char(115),char(117),char(98), -char(116),char(114),char(101),char(101),char(83),char(105),char(122),char(101),char(0),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100), -char(65),char(97),char(98),char(98),char(77),char(105),char(110),char(91),char(51),char(93),char(0),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105),char(122), -char(101),char(100),char(65),char(97),char(98),char(98),char(77),char(97),char(120),char(91),char(51),char(93),char(0),char(109),char(95),char(97),char(97),char(98),char(98),char(77), -char(105),char(110),char(79),char(114),char(103),char(0),char(109),char(95),char(97),char(97),char(98),char(98),char(77),char(97),char(120),char(79),char(114),char(103),char(0),char(109), -char(95),char(101),char(115),char(99),char(97),char(112),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109),char(95),char(115),char(117),char(98),char(80),char(97), -char(114),char(116),char(0),char(109),char(95),char(116),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109), -char(95),char(112),char(97),char(100),char(91),char(52),char(93),char(0),char(109),char(95),char(101),char(115),char(99),char(97),char(112),char(101),char(73),char(110),char(100),char(101), -char(120),char(79),char(114),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109),char(95),char(98), -char(118),char(104),char(65),char(97),char(98),char(98),char(77),char(105),char(110),char(0),char(109),char(95),char(98),char(118),char(104),char(65),char(97),char(98),char(98),char(77), -char(97),char(120),char(0),char(109),char(95),char(98),char(118),char(104),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(97),char(116),char(105),char(111),char(110), -char(0),char(109),char(95),char(99),char(117),char(114),char(78),char(111),char(100),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109),char(95),char(117),char(115), -char(101),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(97),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(110),char(117),char(109),char(67), -char(111),char(110),char(116),char(105),char(103),char(117),char(111),char(117),char(115),char(76),char(101),char(97),char(102),char(78),char(111),char(100),char(101),char(115),char(0),char(109), -char(95),char(110),char(117),char(109),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(67),char(111),char(110),char(116),char(105),char(103),char(117), -char(111),char(117),char(115),char(78),char(111),char(100),char(101),char(115),char(0),char(42),char(109),char(95),char(99),char(111),char(110),char(116),char(105),char(103),char(117),char(111), -char(117),char(115),char(78),char(111),char(100),char(101),char(115),char(80),char(116),char(114),char(0),char(42),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105), -char(122),char(101),char(100),char(67),char(111),char(110),char(116),char(105),char(103),char(117),char(111),char(117),char(115),char(78),char(111),char(100),char(101),char(115),char(80),char(116), -char(114),char(0),char(42),char(109),char(95),char(115),char(117),char(98),char(84),char(114),char(101),char(101),char(73),char(110),char(102),char(111),char(80),char(116),char(114),char(0), -char(109),char(95),char(116),char(114),char(97),char(118),char(101),char(114),char(115),char(97),char(108),char(77),char(111),char(100),char(101),char(0),char(109),char(95),char(110),char(117), -char(109),char(83),char(117),char(98),char(116),char(114),char(101),char(101),char(72),char(101),char(97),char(100),char(101),char(114),char(115),char(0),char(42),char(109),char(95),char(110), -char(97),char(109),char(101),char(0),char(109),char(95),char(115),char(104),char(97),char(112),char(101),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(112),char(97), -char(100),char(100),char(105),char(110),char(103),char(91),char(52),char(93),char(0),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110), -char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(108),char(111),char(99),char(97),char(108),char(83),char(99),char(97), -char(108),char(105),char(110),char(103),char(0),char(109),char(95),char(112),char(108),char(97),char(110),char(101),char(78),char(111),char(114),char(109),char(97),char(108),char(0),char(109), -char(95),char(112),char(108),char(97),char(110),char(101),char(67),char(111),char(110),char(115),char(116),char(97),char(110),char(116),char(0),char(109),char(95),char(105),char(109),char(112), -char(108),char(105),char(99),char(105),char(116),char(83),char(104),char(97),char(112),char(101),char(68),char(105),char(109),char(101),char(110),char(115),char(105),char(111),char(110),char(115), -char(0),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(77),char(97),char(114),char(103),char(105),char(110),char(0),char(109), -char(95),char(112),char(97),char(100),char(100),char(105),char(110),char(103),char(0),char(109),char(95),char(112),char(111),char(115),char(0),char(109),char(95),char(114),char(97),char(100), -char(105),char(117),char(115),char(0),char(109),char(95),char(99),char(111),char(110),char(118),char(101),char(120),char(73),char(110),char(116),char(101),char(114),char(110),char(97),char(108), -char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(42),char(109),char(95),char(108),char(111),char(99),char(97),char(108),char(80),char(111), -char(115),char(105),char(116),char(105),char(111),char(110),char(65),char(114),char(114),char(97),char(121),char(80),char(116),char(114),char(0),char(109),char(95),char(108),char(111),char(99), -char(97),char(108),char(80),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(65),char(114),char(114),char(97),char(121),char(83),char(105),char(122),char(101),char(0), -char(109),char(95),char(118),char(97),char(108),char(117),char(101),char(0),char(109),char(95),char(112),char(97),char(100),char(91),char(50),char(93),char(0),char(109),char(95),char(118), -char(97),char(108),char(117),char(101),char(115),char(91),char(51),char(93),char(0),char(109),char(95),char(112),char(97),char(100),char(0),char(42),char(109),char(95),char(118),char(101), -char(114),char(116),char(105),char(99),char(101),char(115),char(51),char(102),char(0),char(42),char(109),char(95),char(118),char(101),char(114),char(116),char(105),char(99),char(101),char(115), -char(51),char(100),char(0),char(42),char(109),char(95),char(105),char(110),char(100),char(105),char(99),char(101),char(115),char(51),char(50),char(0),char(42),char(109),char(95),char(51), -char(105),char(110),char(100),char(105),char(99),char(101),char(115),char(49),char(54),char(0),char(42),char(109),char(95),char(51),char(105),char(110),char(100),char(105),char(99),char(101), -char(115),char(56),char(0),char(42),char(109),char(95),char(105),char(110),char(100),char(105),char(99),char(101),char(115),char(49),char(54),char(0),char(109),char(95),char(110),char(117), -char(109),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(86),char(101),char(114),char(116), -char(105),char(99),char(101),char(115),char(0),char(42),char(109),char(95),char(109),char(101),char(115),char(104),char(80),char(97),char(114),char(116),char(115),char(80),char(116),char(114), -char(0),char(109),char(95),char(115),char(99),char(97),char(108),char(105),char(110),char(103),char(0),char(109),char(95),char(110),char(117),char(109),char(77),char(101),char(115),char(104), -char(80),char(97),char(114),char(116),char(115),char(0),char(109),char(95),char(109),char(101),char(115),char(104),char(73),char(110),char(116),char(101),char(114),char(102),char(97),char(99), -char(101),char(0),char(42),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(70),char(108),char(111),char(97),char(116),char(66), -char(118),char(104),char(0),char(42),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(68),char(111),char(117),char(98),char(108), -char(101),char(66),char(118),char(104),char(0),char(42),char(109),char(95),char(116),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(102),char(111), -char(77),char(97),char(112),char(0),char(109),char(95),char(112),char(97),char(100),char(51),char(91),char(52),char(93),char(0),char(109),char(95),char(116),char(114),char(105),char(109), -char(101),char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(116),char(114),char(97),char(110),char(115), -char(102),char(111),char(114),char(109),char(0),char(42),char(109),char(95),char(99),char(104),char(105),char(108),char(100),char(83),char(104),char(97),char(112),char(101),char(0),char(109), -char(95),char(99),char(104),char(105),char(108),char(100),char(83),char(104),char(97),char(112),char(101),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(99),char(104), -char(105),char(108),char(100),char(77),char(97),char(114),char(103),char(105),char(110),char(0),char(42),char(109),char(95),char(99),char(104),char(105),char(108),char(100),char(83),char(104), -char(97),char(112),char(101),char(80),char(116),char(114),char(0),char(109),char(95),char(110),char(117),char(109),char(67),char(104),char(105),char(108),char(100),char(83),char(104),char(97), -char(112),char(101),char(115),char(0),char(109),char(95),char(117),char(112),char(65),char(120),char(105),char(115),char(0),char(109),char(95),char(117),char(112),char(73),char(110),char(100), -char(101),char(120),char(0),char(109),char(95),char(102),char(108),char(97),char(103),char(115),char(0),char(109),char(95),char(101),char(100),char(103),char(101),char(86),char(48),char(86), -char(49),char(65),char(110),char(103),char(108),char(101),char(0),char(109),char(95),char(101),char(100),char(103),char(101),char(86),char(49),char(86),char(50),char(65),char(110),char(103), -char(108),char(101),char(0),char(109),char(95),char(101),char(100),char(103),char(101),char(86),char(50),char(86),char(48),char(65),char(110),char(103),char(108),char(101),char(0),char(42), -char(109),char(95),char(104),char(97),char(115),char(104),char(84),char(97),char(98),char(108),char(101),char(80),char(116),char(114),char(0),char(42),char(109),char(95),char(110),char(101), -char(120),char(116),char(80),char(116),char(114),char(0),char(42),char(109),char(95),char(118),char(97),char(108),char(117),char(101),char(65),char(114),char(114),char(97),char(121),char(80), -char(116),char(114),char(0),char(42),char(109),char(95),char(107),char(101),char(121),char(65),char(114),char(114),char(97),char(121),char(80),char(116),char(114),char(0),char(109),char(95), -char(99),char(111),char(110),char(118),char(101),char(120),char(69),char(112),char(115),char(105),char(108),char(111),char(110),char(0),char(109),char(95),char(112),char(108),char(97),char(110), -char(97),char(114),char(69),char(112),char(115),char(105),char(108),char(111),char(110),char(0),char(109),char(95),char(101),char(113),char(117),char(97),char(108),char(86),char(101),char(114), -char(116),char(101),char(120),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(101),char(100),char(103),char(101),char(68), -char(105),char(115),char(116),char(97),char(110),char(99),char(101),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(122), -char(101),char(114),char(111),char(65),char(114),char(101),char(97),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(110), -char(101),char(120),char(116),char(83),char(105),char(122),char(101),char(0),char(109),char(95),char(104),char(97),char(115),char(104),char(84),char(97),char(98),char(108),char(101),char(83), -char(105),char(122),char(101),char(0),char(109),char(95),char(110),char(117),char(109),char(86),char(97),char(108),char(117),char(101),char(115),char(0),char(109),char(95),char(110),char(117), -char(109),char(75),char(101),char(121),char(115),char(0),char(109),char(95),char(103),char(105),char(109),char(112),char(97),char(99),char(116),char(83),char(117),char(98),char(84),char(121), -char(112),char(101),char(0),char(42),char(109),char(95),char(117),char(110),char(115),char(99),char(97),char(108),char(101),char(100),char(80),char(111),char(105),char(110),char(116),char(115), -char(70),char(108),char(111),char(97),char(116),char(80),char(116),char(114),char(0),char(42),char(109),char(95),char(117),char(110),char(115),char(99),char(97),char(108),char(101),char(100), -char(80),char(111),char(105),char(110),char(116),char(115),char(68),char(111),char(117),char(98),char(108),char(101),char(80),char(116),char(114),char(0),char(109),char(95),char(110),char(117), -char(109),char(85),char(110),char(115),char(99),char(97),char(108),char(101),char(100),char(80),char(111),char(105),char(110),char(116),char(115),char(0),char(109),char(95),char(112),char(97), -char(100),char(100),char(105),char(110),char(103),char(51),char(91),char(52),char(93),char(0),char(42),char(109),char(95),char(98),char(114),char(111),char(97),char(100),char(112),char(104), -char(97),char(115),char(101),char(72),char(97),char(110),char(100),char(108),char(101),char(0),char(42),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105), -char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(0),char(42),char(109),char(95),char(114),char(111),char(111),char(116),char(67),char(111),char(108),char(108),char(105), -char(115),char(105),char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(0),char(109),char(95),char(119),char(111),char(114),char(108),char(100),char(84),char(114),char(97), -char(110),char(115),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(105),char(110),char(116),char(101),char(114),char(112),char(111),char(108),char(97),char(116),char(105), -char(111),char(110),char(87),char(111),char(114),char(108),char(100),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(105), -char(110),char(116),char(101),char(114),char(112),char(111),char(108),char(97),char(116),char(105),char(111),char(110),char(76),char(105),char(110),char(101),char(97),char(114),char(86),char(101), -char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95),char(105),char(110),char(116),char(101),char(114),char(112),char(111),char(108),char(97),char(116),char(105), -char(111),char(110),char(65),char(110),char(103),char(117),char(108),char(97),char(114),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95), -char(97),char(110),char(105),char(115),char(111),char(116),char(114),char(111),char(112),char(105),char(99),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0), -char(109),char(95),char(99),char(111),char(110),char(116),char(97),char(99),char(116),char(80),char(114),char(111),char(99),char(101),char(115),char(115),char(105),char(110),char(103),char(84), -char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(100),char(101),char(97),char(99),char(116),char(105),char(118),char(97),char(116), -char(105),char(111),char(110),char(84),char(105),char(109),char(101),char(0),char(109),char(95),char(102),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0),char(109), -char(95),char(114),char(111),char(108),char(108),char(105),char(110),char(103),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(99), -char(111),char(110),char(116),char(97),char(99),char(116),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(99),char(111),char(110),char(116), -char(97),char(99),char(116),char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(114),char(101),char(115),char(116),char(105), -char(116),char(117),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(104),char(105),char(116),char(70),char(114),char(97),char(99),char(116),char(105),char(111),char(110), -char(0),char(109),char(95),char(99),char(99),char(100),char(83),char(119),char(101),char(112),char(116),char(83),char(112),char(104),char(101),char(114),char(101),char(82),char(97),char(100), -char(105),char(117),char(115),char(0),char(109),char(95),char(99),char(99),char(100),char(77),char(111),char(116),char(105),char(111),char(110),char(84),char(104),char(114),char(101),char(115), -char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(104),char(97),char(115),char(65),char(110),char(105),char(115),char(111),char(116),char(114),char(111),char(112),char(105), -char(99),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111), -char(110),char(70),char(108),char(97),char(103),char(115),char(0),char(109),char(95),char(105),char(115),char(108),char(97),char(110),char(100),char(84),char(97),char(103),char(49),char(0), -char(109),char(95),char(99),char(111),char(109),char(112),char(97),char(110),char(105),char(111),char(110),char(73),char(100),char(0),char(109),char(95),char(97),char(99),char(116),char(105), -char(118),char(97),char(116),char(105),char(111),char(110),char(83),char(116),char(97),char(116),char(101),char(49),char(0),char(109),char(95),char(105),char(110),char(116),char(101),char(114), -char(110),char(97),char(108),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(99),char(104),char(101),char(99),char(107),char(67),char(111),char(108),char(108),char(105), -char(100),char(101),char(87),char(105),char(116),char(104),char(0),char(109),char(95),char(116),char(97),char(117),char(0),char(109),char(95),char(100),char(97),char(109),char(112),char(105), -char(110),char(103),char(0),char(109),char(95),char(116),char(105),char(109),char(101),char(83),char(116),char(101),char(112),char(0),char(109),char(95),char(109),char(97),char(120),char(69), -char(114),char(114),char(111),char(114),char(82),char(101),char(100),char(117),char(99),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(115),char(111),char(114),char(0), -char(109),char(95),char(101),char(114),char(112),char(0),char(109),char(95),char(101),char(114),char(112),char(50),char(0),char(109),char(95),char(103),char(108),char(111),char(98),char(97), -char(108),char(67),char(102),char(109),char(0),char(109),char(95),char(115),char(112),char(108),char(105),char(116),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(80), -char(101),char(110),char(101),char(116),char(114),char(97),char(116),char(105),char(111),char(110),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0), -char(109),char(95),char(115),char(112),char(108),char(105),char(116),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(84),char(117),char(114),char(110),char(69),char(114), -char(112),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(108),char(111),char(112),char(0),char(109),char(95),char(119),char(97),char(114), -char(109),char(115),char(116),char(97),char(114),char(116),char(105),char(110),char(103),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(109),char(97), -char(120),char(71),char(121),char(114),char(111),char(115),char(99),char(111),char(112),char(105),char(99),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(115), -char(105),char(110),char(103),char(108),char(101),char(65),char(120),char(105),char(115),char(82),char(111),char(108),char(108),char(105),char(110),char(103),char(70),char(114),char(105),char(99), -char(116),char(105),char(111),char(110),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(110),char(117),char(109),char(73), -char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115),char(0),char(109),char(95),char(115),char(111),char(108),char(118),char(101),char(114),char(77),char(111), -char(100),char(101),char(0),char(109),char(95),char(114),char(101),char(115),char(116),char(105),char(110),char(103),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(82), -char(101),char(115),char(116),char(105),char(116),char(117),char(116),char(105),char(111),char(110),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0), -char(109),char(95),char(109),char(105),char(110),char(105),char(109),char(117),char(109),char(83),char(111),char(108),char(118),char(101),char(114),char(66),char(97),char(116),char(99),char(104), -char(83),char(105),char(122),char(101),char(0),char(109),char(95),char(115),char(112),char(108),char(105),char(116),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(0), -char(109),char(95),char(115),char(111),char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111),char(0),char(109),char(95),char(103),char(114),char(97),char(118),char(105), -char(116),char(121),char(0),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99),char(116), -char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(105),char(110),char(118),char(73),char(110),char(101),char(114),char(116),char(105),char(97),char(84),char(101),char(110), -char(115),char(111),char(114),char(87),char(111),char(114),char(108),char(100),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(86),char(101),char(108), -char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(86),char(101),char(108),char(111),char(99), -char(105),char(116),char(121),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(70),char(97),char(99),char(116),char(111),char(114),char(0), -char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(103),char(114),char(97), -char(118),char(105),char(116),char(121),char(95),char(97),char(99),char(99),char(101),char(108),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(0),char(109),char(95), -char(105),char(110),char(118),char(73),char(110),char(101),char(114),char(116),char(105),char(97),char(76),char(111),char(99),char(97),char(108),char(0),char(109),char(95),char(116),char(111), -char(116),char(97),char(108),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(116),char(111),char(116),char(97),char(108),char(84),char(111),char(114),char(113), -char(117),char(101),char(0),char(109),char(95),char(105),char(110),char(118),char(101),char(114),char(115),char(101),char(77),char(97),char(115),char(115),char(0),char(109),char(95),char(108), -char(105),char(110),char(101),char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108), -char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(97),char(100),char(100),char(105),char(116),char(105),char(111),char(110), -char(97),char(108),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(97),char(100), -char(100),char(105),char(116),char(105),char(111),char(110),char(97),char(108),char(76),char(105),char(110),char(101),char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110), -char(103),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(83),char(113),char(114),char(0),char(109),char(95),char(97),char(100),char(100),char(105), -char(116),char(105),char(111),char(110),char(97),char(108),char(65),char(110),char(103),char(117),char(108),char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110),char(103), -char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(83),char(113),char(114),char(0),char(109),char(95),char(97),char(100),char(100),char(105),char(116), -char(105),char(111),char(110),char(97),char(108),char(65),char(110),char(103),char(117),char(108),char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(70), -char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(108),char(101),char(101),char(112),char(105), -char(110),char(103),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97), -char(114),char(83),char(108),char(101),char(101),char(112),char(105),char(110),char(103),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109), -char(95),char(97),char(100),char(100),char(105),char(116),char(105),char(111),char(110),char(97),char(108),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109), -char(95),char(110),char(117),char(109),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(82),char(111),char(119),char(115),char(0),char(110), -char(117),char(98),char(0),char(42),char(109),char(95),char(114),char(98),char(65),char(0),char(42),char(109),char(95),char(114),char(98),char(66),char(0),char(109),char(95),char(111), -char(98),char(106),char(101),char(99),char(116),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(117),char(115),char(101),char(114),char(67),char(111),char(110),char(115), -char(116),char(114),char(97),char(105),char(110),char(116),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(117),char(115),char(101),char(114),char(67),char(111),char(110), -char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(73),char(100),char(0),char(109),char(95),char(110),char(101),char(101),char(100),char(115),char(70),char(101),char(101), -char(100),char(98),char(97),char(99),char(107),char(0),char(109),char(95),char(97),char(112),char(112),char(108),char(105),char(101),char(100),char(73),char(109),char(112),char(117),char(108), -char(115),char(101),char(0),char(109),char(95),char(100),char(98),char(103),char(68),char(114),char(97),char(119),char(83),char(105),char(122),char(101),char(0),char(109),char(95),char(100), -char(105),char(115),char(97),char(98),char(108),char(101),char(67),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(115),char(66),char(101),char(116),char(119), -char(101),char(101),char(110),char(76),char(105),char(110),char(107),char(101),char(100),char(66),char(111),char(100),char(105),char(101),char(115),char(0),char(109),char(95),char(111),char(118), -char(101),char(114),char(114),char(105),char(100),char(101),char(78),char(117),char(109),char(83),char(111),char(108),char(118),char(101),char(114),char(73),char(116),char(101),char(114),char(97), -char(116),char(105),char(111),char(110),char(115),char(0),char(109),char(95),char(98),char(114),char(101),char(97),char(107),char(105),char(110),char(103),char(73),char(109),char(112),char(117), -char(108),char(115),char(101),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(105),char(115),char(69),char(110),char(97), -char(98),char(108),char(101),char(100),char(0),char(112),char(97),char(100),char(100),char(105),char(110),char(103),char(91),char(52),char(93),char(0),char(109),char(95),char(116),char(121), -char(112),char(101),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(112), -char(105),char(118),char(111),char(116),char(73),char(110),char(65),char(0),char(109),char(95),char(112),char(105),char(118),char(111),char(116),char(73),char(110),char(66),char(0),char(109), -char(95),char(114),char(98),char(65),char(70),char(114),char(97),char(109),char(101),char(0),char(109),char(95),char(114),char(98),char(66),char(70),char(114),char(97),char(109),char(101), -char(0),char(109),char(95),char(117),char(115),char(101),char(82),char(101),char(102),char(101),char(114),char(101),char(110),char(99),char(101),char(70),char(114),char(97),char(109),char(101), -char(65),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(79),char(110),char(108),char(121),char(0),char(109),char(95),char(101),char(110), -char(97),char(98),char(108),char(101),char(65),char(110),char(103),char(117),char(108),char(97),char(114),char(77),char(111),char(116),char(111),char(114),char(0),char(109),char(95),char(109), -char(111),char(116),char(111),char(114),char(84),char(97),char(114),char(103),char(101),char(116),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109), -char(95),char(109),char(97),char(120),char(77),char(111),char(116),char(111),char(114),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(0),char(109),char(95),char(108), -char(111),char(119),char(101),char(114),char(76),char(105),char(109),char(105),char(116),char(0),char(109),char(95),char(117),char(112),char(112),char(101),char(114),char(76),char(105),char(109), -char(105),char(116),char(0),char(109),char(95),char(108),char(105),char(109),char(105),char(116),char(83),char(111),char(102),char(116),char(110),char(101),char(115),char(115),char(0),char(109), -char(95),char(98),char(105),char(97),char(115),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(114),char(101),char(108),char(97),char(120),char(97), -char(116),char(105),char(111),char(110),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(112),char(97),char(100),char(100),char(105),char(110),char(103), -char(49),char(91),char(52),char(93),char(0),char(109),char(95),char(115),char(119),char(105),char(110),char(103),char(83),char(112),char(97),char(110),char(49),char(0),char(109),char(95), -char(115),char(119),char(105),char(110),char(103),char(83),char(112),char(97),char(110),char(50),char(0),char(109),char(95),char(116),char(119),char(105),char(115),char(116),char(83),char(112), -char(97),char(110),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(85),char(112),char(112),char(101),char(114),char(76),char(105),char(109),char(105), -char(116),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(76),char(111),char(119),char(101),char(114),char(76),char(105),char(109),char(105),char(116), -char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(85),char(112),char(112),char(101),char(114),char(76),char(105),char(109),char(105),char(116), -char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(76),char(111),char(119),char(101),char(114),char(76),char(105),char(109),char(105),char(116), -char(0),char(109),char(95),char(117),char(115),char(101),char(76),char(105),char(110),char(101),char(97),char(114),char(82),char(101),char(102),char(101),char(114),char(101),char(110),char(99), -char(101),char(70),char(114),char(97),char(109),char(101),char(65),char(0),char(109),char(95),char(117),char(115),char(101),char(79),char(102),char(102),char(115),char(101),char(116),char(70), -char(111),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(114),char(97),char(109),char(101),char(0),char(109),char(95), -char(54),char(100),char(111),char(102),char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(115),char(112),char(114),char(105),char(110),char(103),char(69),char(110),char(97), -char(98),char(108),char(101),char(100),char(91),char(54),char(93),char(0),char(109),char(95),char(101),char(113),char(117),char(105),char(108),char(105),char(98),char(114),char(105),char(117), -char(109),char(80),char(111),char(105),char(110),char(116),char(91),char(54),char(93),char(0),char(109),char(95),char(115),char(112),char(114),char(105),char(110),char(103),char(83),char(116), -char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(91),char(54),char(93),char(0),char(109),char(95),char(115),char(112),char(114),char(105),char(110),char(103),char(68), -char(97),char(109),char(112),char(105),char(110),char(103),char(91),char(54),char(93),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(66),char(111), -char(117),char(110),char(99),char(101),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(116),char(111),char(112),char(69),char(82),char(80), -char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(116),char(111),char(112),char(67),char(70),char(77),char(0),char(109),char(95),char(108), -char(105),char(110),char(101),char(97),char(114),char(77),char(111),char(116),char(111),char(114),char(69),char(82),char(80),char(0),char(109),char(95),char(108),char(105),char(110),char(101), -char(97),char(114),char(77),char(111),char(116),char(111),char(114),char(67),char(70),char(77),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(84), -char(97),char(114),char(103),char(101),char(116),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95),char(108),char(105),char(110),char(101), -char(97),char(114),char(77),char(97),char(120),char(77),char(111),char(116),char(111),char(114),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(108),char(105), -char(110),char(101),char(97),char(114),char(83),char(101),char(114),char(118),char(111),char(84),char(97),char(114),char(103),char(101),char(116),char(0),char(109),char(95),char(108),char(105), -char(110),char(101),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(0), -char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(68),char(97),char(109),char(112),char(105),char(110), -char(103),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(69),char(113),char(117),char(105),char(108),char(105),char(98),char(114),char(105),char(117), -char(109),char(80),char(111),char(105),char(110),char(116),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(69),char(110),char(97),char(98),char(108), -char(101),char(77),char(111),char(116),char(111),char(114),char(91),char(52),char(93),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(101), -char(114),char(118),char(111),char(77),char(111),char(116),char(111),char(114),char(91),char(52),char(93),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114), -char(69),char(110),char(97),char(98),char(108),char(101),char(83),char(112),char(114),char(105),char(110),char(103),char(91),char(52),char(93),char(0),char(109),char(95),char(108),char(105), -char(110),char(101),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(76), -char(105),char(109),char(105),char(116),char(101),char(100),char(91),char(52),char(93),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(112), -char(114),char(105),char(110),char(103),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(76),char(105),char(109),char(105),char(116),char(101),char(100),char(91),char(52), -char(93),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(66),char(111),char(117),char(110),char(99),char(101),char(0),char(109),char(95), -char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(83),char(116),char(111),char(112),char(69),char(82),char(80),char(0),char(109),char(95),char(97),char(110),char(103), -char(117),char(108),char(97),char(114),char(83),char(116),char(111),char(112),char(67),char(70),char(77),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97), -char(114),char(77),char(111),char(116),char(111),char(114),char(69),char(82),char(80),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(77), -char(111),char(116),char(111),char(114),char(67),char(70),char(77),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(84),char(97),char(114), -char(103),char(101),char(116),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97), -char(114),char(77),char(97),char(120),char(77),char(111),char(116),char(111),char(114),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(97),char(110),char(103), -char(117),char(108),char(97),char(114),char(83),char(101),char(114),char(118),char(111),char(84),char(97),char(114),char(103),char(101),char(116),char(0),char(109),char(95),char(97),char(110), -char(103),char(117),char(108),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115), -char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(68),char(97),char(109),char(112), -char(105),char(110),char(103),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(69),char(113),char(117),char(105),char(108),char(105),char(98), -char(114),char(105),char(117),char(109),char(80),char(111),char(105),char(110),char(116),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(69), -char(110),char(97),char(98),char(108),char(101),char(77),char(111),char(116),char(111),char(114),char(91),char(52),char(93),char(0),char(109),char(95),char(97),char(110),char(103),char(117), -char(108),char(97),char(114),char(83),char(101),char(114),char(118),char(111),char(77),char(111),char(116),char(111),char(114),char(91),char(52),char(93),char(0),char(109),char(95),char(97), -char(110),char(103),char(117),char(108),char(97),char(114),char(69),char(110),char(97),char(98),char(108),char(101),char(83),char(112),char(114),char(105),char(110),char(103),char(91),char(52), -char(93),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(83),char(116),char(105), -char(102),char(102),char(110),char(101),char(115),char(115),char(76),char(105),char(109),char(105),char(116),char(101),char(100),char(91),char(52),char(93),char(0),char(109),char(95),char(97), -char(110),char(103),char(117),char(108),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(76), -char(105),char(109),char(105),char(116),char(101),char(100),char(91),char(52),char(93),char(0),char(109),char(95),char(114),char(111),char(116),char(97),char(116),char(101),char(79),char(114), -char(100),char(101),char(114),char(0),char(109),char(95),char(97),char(120),char(105),char(115),char(73),char(110),char(65),char(0),char(109),char(95),char(97),char(120),char(105),char(115), -char(73),char(110),char(66),char(0),char(109),char(95),char(114),char(97),char(116),char(105),char(111),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114), -char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(83), -char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(118),char(111),char(108),char(117),char(109),char(101),char(83),char(116),char(105), -char(102),char(102),char(110),char(101),char(115),char(115),char(0),char(42),char(109),char(95),char(109),char(97),char(116),char(101),char(114),char(105),char(97),char(108),char(0),char(109), -char(95),char(112),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(112),char(114),char(101),char(118),char(105),char(111),char(117),char(115), -char(80),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(118),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0), -char(109),char(95),char(97),char(99),char(99),char(117),char(109),char(117),char(108),char(97),char(116),char(101),char(100),char(70),char(111),char(114),char(99),char(101),char(0),char(109), -char(95),char(110),char(111),char(114),char(109),char(97),char(108),char(0),char(109),char(95),char(97),char(114),char(101),char(97),char(0),char(109),char(95),char(97),char(116),char(116), -char(97),char(99),char(104),char(0),char(109),char(95),char(110),char(111),char(100),char(101),char(73),char(110),char(100),char(105),char(99),char(101),char(115),char(91),char(50),char(93), -char(0),char(109),char(95),char(114),char(101),char(115),char(116),char(76),char(101),char(110),char(103),char(116),char(104),char(0),char(109),char(95),char(98),char(98),char(101),char(110), -char(100),char(105),char(110),char(103),char(0),char(109),char(95),char(110),char(111),char(100),char(101),char(73),char(110),char(100),char(105),char(99),char(101),char(115),char(91),char(51), -char(93),char(0),char(109),char(95),char(114),char(101),char(115),char(116),char(65),char(114),char(101),char(97),char(0),char(109),char(95),char(99),char(48),char(91),char(52),char(93), -char(0),char(109),char(95),char(110),char(111),char(100),char(101),char(73),char(110),char(100),char(105),char(99),char(101),char(115),char(91),char(52),char(93),char(0),char(109),char(95), -char(114),char(101),char(115),char(116),char(86),char(111),char(108),char(117),char(109),char(101),char(0),char(109),char(95),char(99),char(49),char(0),char(109),char(95),char(99),char(50), -char(0),char(109),char(95),char(99),char(48),char(0),char(109),char(95),char(108),char(111),char(99),char(97),char(108),char(70),char(114),char(97),char(109),char(101),char(0),char(42), -char(109),char(95),char(114),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121),char(0),char(109),char(95),char(110),char(111),char(100),char(101),char(73),char(110), -char(100),char(101),char(120),char(0),char(109),char(95),char(97),char(101),char(114),char(111),char(77),char(111),char(100),char(101),char(108),char(0),char(109),char(95),char(98),char(97), -char(117),char(109),char(103),char(97),char(114),char(116),char(101),char(0),char(109),char(95),char(100),char(114),char(97),char(103),char(0),char(109),char(95),char(108),char(105),char(102), -char(116),char(0),char(109),char(95),char(112),char(114),char(101),char(115),char(115),char(117),char(114),char(101),char(0),char(109),char(95),char(118),char(111),char(108),char(117),char(109), -char(101),char(0),char(109),char(95),char(100),char(121),char(110),char(97),char(109),char(105),char(99),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0), -char(109),char(95),char(112),char(111),char(115),char(101),char(77),char(97),char(116),char(99),char(104),char(0),char(109),char(95),char(114),char(105),char(103),char(105),char(100),char(67), -char(111),char(110),char(116),char(97),char(99),char(116),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(107),char(105),char(110), -char(101),char(116),char(105),char(99),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115),char(0), -char(109),char(95),char(115),char(111),char(102),char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(72),char(97),char(114),char(100),char(110),char(101),char(115), -char(115),char(0),char(109),char(95),char(97),char(110),char(99),char(104),char(111),char(114),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115),char(0),char(109), -char(95),char(115),char(111),char(102),char(116),char(82),char(105),char(103),char(105),char(100),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(72),char(97),char(114), -char(100),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(115),char(111),char(102),char(116),char(75),char(105),char(110),char(101),char(116),char(105),char(99),char(67), -char(108),char(117),char(115),char(116),char(101),char(114),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(115),char(111),char(102), -char(116),char(83),char(111),char(102),char(116),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115), -char(0),char(109),char(95),char(115),char(111),char(102),char(116),char(82),char(105),char(103),char(105),char(100),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(73), -char(109),char(112),char(117),char(108),char(115),char(101),char(83),char(112),char(108),char(105),char(116),char(0),char(109),char(95),char(115),char(111),char(102),char(116),char(75),char(105), -char(110),char(101),char(116),char(105),char(99),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(83), -char(112),char(108),char(105),char(116),char(0),char(109),char(95),char(115),char(111),char(102),char(116),char(83),char(111),char(102),char(116),char(67),char(108),char(117),char(115),char(116), -char(101),char(114),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(83),char(112),char(108),char(105),char(116),char(0),char(109),char(95),char(109),char(97),char(120), -char(86),char(111),char(108),char(117),char(109),char(101),char(0),char(109),char(95),char(116),char(105),char(109),char(101),char(83),char(99),char(97),char(108),char(101),char(0),char(109), -char(95),char(118),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(73),char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115),char(0), -char(109),char(95),char(112),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(73),char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115), -char(0),char(109),char(95),char(100),char(114),char(105),char(102),char(116),char(73),char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115),char(0),char(109), -char(95),char(99),char(108),char(117),char(115),char(116),char(101),char(114),char(73),char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115),char(0),char(109), -char(95),char(114),char(111),char(116),char(0),char(109),char(95),char(115),char(99),char(97),char(108),char(101),char(0),char(109),char(95),char(97),char(113),char(113),char(0),char(109), -char(95),char(99),char(111),char(109),char(0),char(42),char(109),char(95),char(112),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(115),char(0),char(42),char(109), -char(95),char(119),char(101),char(105),char(103),char(104),char(116),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(80),char(111),char(115),char(105),char(116),char(105), -char(111),char(110),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(87),char(101),char(105),char(103),char(116),char(115),char(0),char(109),char(95),char(98),char(118), -char(111),char(108),char(117),char(109),char(101),char(0),char(109),char(95),char(98),char(102),char(114),char(97),char(109),char(101),char(0),char(109),char(95),char(102),char(114),char(97), -char(109),char(101),char(120),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(108),char(111),char(99),char(105),char(105),char(0),char(109),char(95),char(105),char(110), -char(118),char(119),char(105),char(0),char(109),char(95),char(118),char(105),char(109),char(112),char(117),char(108),char(115),char(101),char(115),char(91),char(50),char(93),char(0),char(109), -char(95),char(100),char(105),char(109),char(112),char(117),char(108),char(115),char(101),char(115),char(91),char(50),char(93),char(0),char(109),char(95),char(108),char(118),char(0),char(109), -char(95),char(97),char(118),char(0),char(42),char(109),char(95),char(102),char(114),char(97),char(109),char(101),char(114),char(101),char(102),char(115),char(0),char(42),char(109),char(95), -char(110),char(111),char(100),char(101),char(73),char(110),char(100),char(105),char(99),char(101),char(115),char(0),char(42),char(109),char(95),char(109),char(97),char(115),char(115),char(101), -char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(70),char(114),char(97),char(109),char(101),char(82),char(101),char(102),char(115),char(0),char(109),char(95),char(110), -char(117),char(109),char(78),char(111),char(100),char(101),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(77),char(97),char(115),char(115),char(101),char(115),char(0), -char(109),char(95),char(105),char(100),char(109),char(97),char(115),char(115),char(0),char(109),char(95),char(105),char(109),char(97),char(115),char(115),char(0),char(109),char(95),char(110), -char(118),char(105),char(109),char(112),char(117),char(108),char(115),char(101),char(115),char(0),char(109),char(95),char(110),char(100),char(105),char(109),char(112),char(117),char(108),char(115), -char(101),char(115),char(0),char(109),char(95),char(110),char(100),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(108),char(100),char(97),char(109), -char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(97),char(100),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(109),char(97), -char(116),char(99),char(104),char(105),char(110),char(103),char(0),char(109),char(95),char(109),char(97),char(120),char(83),char(101),char(108),char(102),char(67),char(111),char(108),char(108), -char(105),char(115),char(105),char(111),char(110),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(0),char(109),char(95),char(115),char(101),char(108),char(102),char(67), -char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(70),char(97),char(99),char(116),char(111), -char(114),char(0),char(109),char(95),char(99),char(111),char(110),char(116),char(97),char(105),char(110),char(115),char(65),char(110),char(99),char(104),char(111),char(114),char(0),char(109), -char(95),char(99),char(111),char(108),char(108),char(105),char(100),char(101),char(0),char(109),char(95),char(99),char(108),char(117),char(115),char(116),char(101),char(114),char(73),char(110), -char(100),char(101),char(120),char(0),char(42),char(109),char(95),char(98),char(111),char(100),char(121),char(65),char(0),char(42),char(109),char(95),char(98),char(111),char(100),char(121), -char(66),char(0),char(109),char(95),char(114),char(101),char(102),char(115),char(91),char(50),char(93),char(0),char(109),char(95),char(99),char(102),char(109),char(0),char(109),char(95), -char(115),char(112),char(108),char(105),char(116),char(0),char(109),char(95),char(100),char(101),char(108),char(101),char(116),char(101),char(0),char(109),char(95),char(114),char(101),char(108), -char(80),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(91),char(50),char(93),char(0),char(109),char(95),char(98),char(111),char(100),char(121),char(65),char(116), -char(121),char(112),char(101),char(0),char(109),char(95),char(98),char(111),char(100),char(121),char(66),char(116),char(121),char(112),char(101),char(0),char(109),char(95),char(106),char(111), -char(105),char(110),char(116),char(84),char(121),char(112),char(101),char(0),char(42),char(109),char(95),char(112),char(111),char(115),char(101),char(0),char(42),char(42),char(109),char(95), -char(109),char(97),char(116),char(101),char(114),char(105),char(97),char(108),char(115),char(0),char(42),char(109),char(95),char(110),char(111),char(100),char(101),char(115),char(0),char(42), -char(109),char(95),char(108),char(105),char(110),char(107),char(115),char(0),char(42),char(109),char(95),char(102),char(97),char(99),char(101),char(115),char(0),char(42),char(109),char(95), -char(116),char(101),char(116),char(114),char(97),char(104),char(101),char(100),char(114),char(97),char(0),char(42),char(109),char(95),char(97),char(110),char(99),char(104),char(111),char(114), -char(115),char(0),char(42),char(109),char(95),char(99),char(108),char(117),char(115),char(116),char(101),char(114),char(115),char(0),char(42),char(109),char(95),char(106),char(111),char(105), -char(110),char(116),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(77),char(97),char(116),char(101),char(114),char(105),char(97),char(108),char(115),char(0),char(109), -char(95),char(110),char(117),char(109),char(76),char(105),char(110),char(107),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(70),char(97),char(99),char(101),char(115), -char(0),char(109),char(95),char(110),char(117),char(109),char(84),char(101),char(116),char(114),char(97),char(104),char(101),char(100),char(114),char(97),char(0),char(109),char(95),char(110), -char(117),char(109),char(65),char(110),char(99),char(104),char(111),char(114),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(67),char(108),char(117),char(115),char(116), -char(101),char(114),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(74),char(111),char(105),char(110),char(116),char(115),char(0),char(109),char(95),char(99),char(111), -char(110),char(102),char(105),char(103),char(0),char(109),char(95),char(122),char(101),char(114),char(111),char(82),char(111),char(116),char(80),char(97),char(114),char(101),char(110),char(116), -char(84),char(111),char(84),char(104),char(105),char(115),char(0),char(109),char(95),char(112),char(97),char(114),char(101),char(110),char(116),char(67),char(111),char(109),char(84),char(111), -char(84),char(104),char(105),char(115),char(67),char(111),char(109),char(79),char(102),char(102),char(115),char(101),char(116),char(0),char(109),char(95),char(116),char(104),char(105),char(115), -char(80),char(105),char(118),char(111),char(116),char(84),char(111),char(84),char(104),char(105),char(115),char(67),char(111),char(109),char(79),char(102),char(102),char(115),char(101),char(116), -char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(65),char(120),char(105),char(115),char(84),char(111),char(112),char(91),char(54),char(93),char(0),char(109), -char(95),char(106),char(111),char(105),char(110),char(116),char(65),char(120),char(105),char(115),char(66),char(111),char(116),char(116),char(111),char(109),char(91),char(54),char(93),char(0), -char(109),char(95),char(108),char(105),char(110),char(107),char(73),char(110),char(101),char(114),char(116),char(105),char(97),char(0),char(109),char(95),char(108),char(105),char(110),char(107), -char(77),char(97),char(115),char(115),char(0),char(109),char(95),char(112),char(97),char(114),char(101),char(110),char(116),char(73),char(110),char(100),char(101),char(120),char(0),char(109), -char(95),char(100),char(111),char(102),char(67),char(111),char(117),char(110),char(116),char(0),char(109),char(95),char(112),char(111),char(115),char(86),char(97),char(114),char(67),char(111), -char(117),char(110),char(116),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(80),char(111),char(115),char(91),char(55),char(93),char(0),char(109),char(95), -char(106),char(111),char(105),char(110),char(116),char(86),char(101),char(108),char(91),char(54),char(93),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(84), -char(111),char(114),char(113),char(117),char(101),char(91),char(54),char(93),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(68),char(97),char(109),char(112), -char(105),char(110),char(103),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0), -char(42),char(109),char(95),char(108),char(105),char(110),char(107),char(78),char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(106),char(111),char(105),char(110),char(116), -char(78),char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(108),char(105),char(110),char(107),char(67),char(111),char(108),char(108),char(105),char(100),char(101),char(114), -char(0),char(42),char(109),char(95),char(112),char(97),char(100),char(100),char(105),char(110),char(103),char(80),char(116),char(114),char(0),char(109),char(95),char(98),char(97),char(115), -char(101),char(87),char(111),char(114),char(108),char(100),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(98),char(97), -char(115),char(101),char(73),char(110),char(101),char(114),char(116),char(105),char(97),char(0),char(109),char(95),char(98),char(97),char(115),char(101),char(77),char(97),char(115),char(115), -char(0),char(42),char(109),char(95),char(98),char(97),char(115),char(101),char(78),char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(98),char(97),char(115),char(101), -char(67),char(111),char(108),char(108),char(105),char(100),char(101),char(114),char(0),char(0),char(0),char(0),char(84),char(89),char(80),char(69),char(95),char(0),char(0),char(0), -char(99),char(104),char(97),char(114),char(0),char(117),char(99),char(104),char(97),char(114),char(0),char(115),char(104),char(111),char(114),char(116),char(0),char(117),char(115),char(104), -char(111),char(114),char(116),char(0),char(105),char(110),char(116),char(0),char(108),char(111),char(110),char(103),char(0),char(117),char(108),char(111),char(110),char(103),char(0),char(102), -char(108),char(111),char(97),char(116),char(0),char(100),char(111),char(117),char(98),char(108),char(101),char(0),char(118),char(111),char(105),char(100),char(0),char(80),char(111),char(105), -char(110),char(116),char(101),char(114),char(65),char(114),char(114),char(97),char(121),char(0),char(98),char(116),char(80),char(104),char(121),char(115),char(105),char(99),char(115),char(83), -char(121),char(115),char(116),char(101),char(109),char(0),char(76),char(105),char(115),char(116),char(66),char(97),char(115),char(101),char(0),char(98),char(116),char(86),char(101),char(99), -char(116),char(111),char(114),char(51),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(86),char(101),char(99),char(116), -char(111),char(114),char(51),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(116), -char(101),char(114),char(110),char(105),char(111),char(110),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117), -char(97),char(116),char(101),char(114),char(110),char(105),char(111),char(110),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98), -char(116),char(77),char(97),char(116),char(114),char(105),char(120),char(51),char(120),char(51),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0), -char(98),char(116),char(77),char(97),char(116),char(114),char(105),char(120),char(51),char(120),char(51),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116), -char(97),char(0),char(98),char(116),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114),char(109),char(70),char(108),char(111),char(97),char(116),char(68),char(97), -char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114),char(109),char(68),char(111),char(117),char(98),char(108),char(101), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(66),char(118),char(104),char(83),char(117),char(98),char(116),char(114),char(101),char(101),char(73),char(110),char(102), -char(111),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(79),char(112),char(116),char(105),char(109),char(105),char(122),char(101),char(100),char(66),char(118),char(104), -char(78),char(111),char(100),char(101),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(79),char(112),char(116),char(105), -char(109),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100),char(101),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97), -char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100), -char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(66),char(118),char(104), -char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101), -char(100),char(66),char(118),char(104),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(108), -char(108),char(105),char(115),char(105),char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(116), -char(97),char(116),char(105),char(99),char(80),char(108),char(97),char(110),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98), -char(116),char(67),char(111),char(110),char(118),char(101),char(120),char(73),char(110),char(116),char(101),char(114),char(110),char(97),char(108),char(83),char(104),char(97),char(112),char(101), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(65),char(110),char(100),char(82),char(97), -char(100),char(105),char(117),char(115),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(83),char(112),char(104),char(101),char(114),char(101),char(83),char(104), -char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(73),char(110),char(116),char(73),char(110),char(100),char(101),char(120),char(68),char(97), -char(116),char(97),char(0),char(98),char(116),char(83),char(104),char(111),char(114),char(116),char(73),char(110),char(116),char(73),char(110),char(100),char(101),char(120),char(68),char(97), -char(116),char(97),char(0),char(98),char(116),char(83),char(104),char(111),char(114),char(116),char(73),char(110),char(116),char(73),char(110),char(100),char(101),char(120),char(84),char(114), -char(105),char(112),char(108),char(101),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(104),char(97),char(114),char(73),char(110),char(100),char(101), -char(120),char(84),char(114),char(105),char(112),char(108),char(101),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(101),char(115),char(104),char(80), -char(97),char(114),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(116),char(114),char(105),char(100),char(105),char(110),char(103),char(77),char(101), -char(115),char(104),char(73),char(110),char(116),char(101),char(114),char(102),char(97),char(99),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114), -char(105),char(97),char(110),char(103),char(108),char(101),char(77),char(101),char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0), -char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(102),char(111),char(77),char(97),char(112),char(68),char(97),char(116), -char(97),char(0),char(98),char(116),char(83),char(99),char(97),char(108),char(101),char(100),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(77),char(101), -char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(109),char(112),char(111),char(117), -char(110),char(100),char(83),char(104),char(97),char(112),char(101),char(67),char(104),char(105),char(108),char(100),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67), -char(111),char(109),char(112),char(111),char(117),char(110),char(100),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67), -char(121),char(108),char(105),char(110),char(100),char(101),char(114),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67), -char(111),char(110),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(97),char(112),char(115),char(117), -char(108),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103), -char(108),char(101),char(73),char(110),char(102),char(111),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(73),char(109),char(112),char(97),char(99),char(116), -char(77),char(101),char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(118), -char(101),char(120),char(72),char(117),char(108),char(108),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111), -char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68), -char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99), -char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116), -char(83),char(111),char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97), -char(0),char(98),char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(83),char(111),char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111), -char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(68),char(121),char(110),char(97),char(109),char(105),char(99),char(115), -char(87),char(111),char(114),char(108),char(100),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(68),char(121), -char(110),char(97),char(109),char(105),char(99),char(115),char(87),char(111),char(114),char(108),char(100),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97), -char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116), -char(97),char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121),char(68),char(111),char(117),char(98),char(108),char(101),char(68), -char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(73),char(110),char(102),char(111), -char(49),char(0),char(98),char(116),char(84),char(121),char(112),char(101),char(100),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70), -char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(121),char(112),char(101),char(100),char(67),char(111),char(110),char(115), -char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111), -char(100),char(121),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(121),char(112),char(101),char(100),char(67),char(111),char(110),char(115),char(116),char(114), -char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(105), -char(110),char(116),char(50),char(80),char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108), -char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(105),char(110),char(116),char(50),char(80),char(111),char(105),char(110), -char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116), -char(97),char(50),char(0),char(98),char(116),char(80),char(111),char(105),char(110),char(116),char(50),char(80),char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115), -char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(72), -char(105),char(110),char(103),char(101),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(72),char(105),char(110),char(103),char(101),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(72),char(105),char(110),char(103),char(101),char(67), -char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50), -char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(84),char(119),char(105),char(115),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(84), -char(119),char(105),char(115),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98), -char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102), -char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97), -char(50),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110), -char(103),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101), -char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(67),char(111),char(110),char(115),char(116), -char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(71), -char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(50),char(67),char(111),char(110), -char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105), -char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(50),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(83),char(108),char(105),char(100), -char(101),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83), -char(108),char(105),char(100),char(101),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108), -char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(97),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), -char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(97),char(114),char(67),char(111), -char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(83), -char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(77),char(97),char(116),char(101),char(114),char(105),char(97),char(108),char(68),char(97),char(116),char(97),char(0), -char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(78),char(111),char(100),char(101),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102), -char(116),char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111), -char(100),char(121),char(70),char(97),char(99),char(101),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(84), -char(101),char(116),char(114),char(97),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(82),char(105),char(103),char(105),char(100),char(65),char(110), -char(99),char(104),char(111),char(114),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(67),char(111),char(110), -char(102),char(105),char(103),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(80),char(111),char(115),char(101), -char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(67),char(108),char(117),char(115),char(116),char(101),char(114), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(74),char(111),char(105),char(110),char(116), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(70),char(108),char(111),char(97),char(116), -char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107), -char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111), -char(100),char(121),char(76),char(105),char(110),char(107),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117), -char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116), -char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(0), -char(84),char(76),char(69),char(78),char(1),char(0),char(1),char(0),char(2),char(0),char(2),char(0),char(4),char(0),char(4),char(0),char(4),char(0),char(4),char(0), -char(8),char(0),char(0),char(0),char(16),char(0),char(48),char(0),char(16),char(0),char(16),char(0),char(32),char(0),char(16),char(0),char(32),char(0),char(48),char(0), -char(96),char(0),char(64),char(0),char(-128),char(0),char(20),char(0),char(48),char(0),char(80),char(0),char(16),char(0),char(96),char(0),char(-112),char(0),char(16),char(0), -char(56),char(0),char(56),char(0),char(20),char(0),char(72),char(0),char(4),char(0),char(4),char(0),char(8),char(0),char(4),char(0),char(56),char(0),char(32),char(0), -char(80),char(0),char(72),char(0),char(96),char(0),char(80),char(0),char(32),char(0),char(64),char(0),char(64),char(0),char(64),char(0),char(16),char(0),char(72),char(0), -char(80),char(0),char(-16),char(1),char(24),char(1),char(-104),char(0),char(88),char(0),char(-72),char(0),char(104),char(0),char(0),char(2),char(-64),char(3),char(8),char(0), -char(64),char(0),char(64),char(0),char(0),char(0),char(80),char(0),char(96),char(0),char(-112),char(0),char(-128),char(0),char(104),char(1),char(-24),char(0),char(-104),char(1), -char(-120),char(1),char(-32),char(0),char(8),char(1),char(-40),char(1),char(104),char(1),char(-128),char(2),char(-112),char(2),char(-64),char(4),char(-40),char(0),char(120),char(1), -char(104),char(0),char(-104),char(0),char(16),char(0),char(104),char(0),char(24),char(0),char(40),char(0),char(104),char(0),char(96),char(0),char(104),char(0),char(-56),char(0), -char(104),char(1),char(112),char(0),char(-24),char(1),char(-32),char(2),char(-120),char(1),char(-48),char(0),char(112),char(0),char(0),char(0),char(83),char(84),char(82),char(67), -char(84),char(0),char(0),char(0),char(10),char(0),char(3),char(0),char(4),char(0),char(0),char(0),char(4),char(0),char(1),char(0),char(9),char(0),char(2),char(0), -char(11),char(0),char(3),char(0),char(10),char(0),char(3),char(0),char(10),char(0),char(4),char(0),char(10),char(0),char(5),char(0),char(12),char(0),char(2),char(0), -char(9),char(0),char(6),char(0),char(9),char(0),char(7),char(0),char(13),char(0),char(1),char(0),char(7),char(0),char(8),char(0),char(14),char(0),char(1),char(0), -char(8),char(0),char(8),char(0),char(15),char(0),char(1),char(0),char(7),char(0),char(8),char(0),char(16),char(0),char(1),char(0),char(8),char(0),char(8),char(0), -char(17),char(0),char(1),char(0),char(13),char(0),char(9),char(0),char(18),char(0),char(1),char(0),char(14),char(0),char(9),char(0),char(19),char(0),char(2),char(0), -char(17),char(0),char(10),char(0),char(13),char(0),char(11),char(0),char(20),char(0),char(2),char(0),char(18),char(0),char(10),char(0),char(14),char(0),char(11),char(0), -char(21),char(0),char(4),char(0),char(4),char(0),char(12),char(0),char(4),char(0),char(13),char(0),char(2),char(0),char(14),char(0),char(2),char(0),char(15),char(0), -char(22),char(0),char(6),char(0),char(13),char(0),char(16),char(0),char(13),char(0),char(17),char(0),char(4),char(0),char(18),char(0),char(4),char(0),char(19),char(0), -char(4),char(0),char(20),char(0),char(0),char(0),char(21),char(0),char(23),char(0),char(6),char(0),char(14),char(0),char(16),char(0),char(14),char(0),char(17),char(0), -char(4),char(0),char(18),char(0),char(4),char(0),char(19),char(0),char(4),char(0),char(20),char(0),char(0),char(0),char(21),char(0),char(24),char(0),char(3),char(0), -char(2),char(0),char(14),char(0),char(2),char(0),char(15),char(0),char(4),char(0),char(22),char(0),char(25),char(0),char(12),char(0),char(13),char(0),char(23),char(0), -char(13),char(0),char(24),char(0),char(13),char(0),char(25),char(0),char(4),char(0),char(26),char(0),char(4),char(0),char(27),char(0),char(4),char(0),char(28),char(0), -char(4),char(0),char(29),char(0),char(22),char(0),char(30),char(0),char(24),char(0),char(31),char(0),char(21),char(0),char(32),char(0),char(4),char(0),char(33),char(0), -char(4),char(0),char(34),char(0),char(26),char(0),char(12),char(0),char(14),char(0),char(23),char(0),char(14),char(0),char(24),char(0),char(14),char(0),char(25),char(0), -char(4),char(0),char(26),char(0),char(4),char(0),char(27),char(0),char(4),char(0),char(28),char(0),char(4),char(0),char(29),char(0),char(23),char(0),char(30),char(0), -char(24),char(0),char(31),char(0),char(4),char(0),char(33),char(0),char(4),char(0),char(34),char(0),char(21),char(0),char(32),char(0),char(27),char(0),char(3),char(0), -char(0),char(0),char(35),char(0),char(4),char(0),char(36),char(0),char(0),char(0),char(37),char(0),char(28),char(0),char(5),char(0),char(27),char(0),char(38),char(0), -char(13),char(0),char(39),char(0),char(13),char(0),char(40),char(0),char(7),char(0),char(41),char(0),char(0),char(0),char(21),char(0),char(29),char(0),char(5),char(0), -char(27),char(0),char(38),char(0),char(13),char(0),char(39),char(0),char(13),char(0),char(42),char(0),char(7),char(0),char(43),char(0),char(4),char(0),char(44),char(0), -char(30),char(0),char(2),char(0),char(13),char(0),char(45),char(0),char(7),char(0),char(46),char(0),char(31),char(0),char(4),char(0),char(29),char(0),char(47),char(0), -char(30),char(0),char(48),char(0),char(4),char(0),char(49),char(0),char(0),char(0),char(37),char(0),char(32),char(0),char(1),char(0),char(4),char(0),char(50),char(0), -char(33),char(0),char(2),char(0),char(2),char(0),char(50),char(0),char(0),char(0),char(51),char(0),char(34),char(0),char(2),char(0),char(2),char(0),char(52),char(0), -char(0),char(0),char(51),char(0),char(35),char(0),char(2),char(0),char(0),char(0),char(52),char(0),char(0),char(0),char(53),char(0),char(36),char(0),char(8),char(0), -char(13),char(0),char(54),char(0),char(14),char(0),char(55),char(0),char(32),char(0),char(56),char(0),char(34),char(0),char(57),char(0),char(35),char(0),char(58),char(0), -char(33),char(0),char(59),char(0),char(4),char(0),char(60),char(0),char(4),char(0),char(61),char(0),char(37),char(0),char(4),char(0),char(36),char(0),char(62),char(0), -char(13),char(0),char(63),char(0),char(4),char(0),char(64),char(0),char(0),char(0),char(37),char(0),char(38),char(0),char(7),char(0),char(27),char(0),char(38),char(0), -char(37),char(0),char(65),char(0),char(25),char(0),char(66),char(0),char(26),char(0),char(67),char(0),char(39),char(0),char(68),char(0),char(7),char(0),char(43),char(0), -char(0),char(0),char(69),char(0),char(40),char(0),char(2),char(0),char(38),char(0),char(70),char(0),char(13),char(0),char(39),char(0),char(41),char(0),char(4),char(0), -char(19),char(0),char(71),char(0),char(27),char(0),char(72),char(0),char(4),char(0),char(73),char(0),char(7),char(0),char(74),char(0),char(42),char(0),char(4),char(0), -char(27),char(0),char(38),char(0),char(41),char(0),char(75),char(0),char(4),char(0),char(76),char(0),char(7),char(0),char(43),char(0),char(43),char(0),char(3),char(0), -char(29),char(0),char(47),char(0),char(4),char(0),char(77),char(0),char(0),char(0),char(37),char(0),char(44),char(0),char(3),char(0),char(29),char(0),char(47),char(0), -char(4),char(0),char(78),char(0),char(0),char(0),char(37),char(0),char(45),char(0),char(3),char(0),char(29),char(0),char(47),char(0),char(4),char(0),char(77),char(0), -char(0),char(0),char(37),char(0),char(46),char(0),char(4),char(0),char(4),char(0),char(79),char(0),char(7),char(0),char(80),char(0),char(7),char(0),char(81),char(0), -char(7),char(0),char(82),char(0),char(39),char(0),char(14),char(0),char(4),char(0),char(83),char(0),char(4),char(0),char(84),char(0),char(46),char(0),char(85),char(0), -char(4),char(0),char(86),char(0),char(7),char(0),char(87),char(0),char(7),char(0),char(88),char(0),char(7),char(0),char(89),char(0),char(7),char(0),char(90),char(0), -char(7),char(0),char(91),char(0),char(4),char(0),char(92),char(0),char(4),char(0),char(93),char(0),char(4),char(0),char(94),char(0),char(4),char(0),char(95),char(0), -char(0),char(0),char(37),char(0),char(47),char(0),char(5),char(0),char(27),char(0),char(38),char(0),char(37),char(0),char(65),char(0),char(13),char(0),char(39),char(0), -char(7),char(0),char(43),char(0),char(4),char(0),char(96),char(0),char(48),char(0),char(5),char(0),char(29),char(0),char(47),char(0),char(13),char(0),char(97),char(0), -char(14),char(0),char(98),char(0),char(4),char(0),char(99),char(0),char(0),char(0),char(100),char(0),char(49),char(0),char(27),char(0),char(9),char(0),char(101),char(0), -char(9),char(0),char(102),char(0),char(27),char(0),char(103),char(0),char(0),char(0),char(35),char(0),char(20),char(0),char(104),char(0),char(20),char(0),char(105),char(0), -char(14),char(0),char(106),char(0),char(14),char(0),char(107),char(0),char(14),char(0),char(108),char(0),char(8),char(0),char(109),char(0),char(8),char(0),char(110),char(0), -char(8),char(0),char(111),char(0),char(8),char(0),char(112),char(0),char(8),char(0),char(113),char(0),char(8),char(0),char(114),char(0),char(8),char(0),char(115),char(0), -char(8),char(0),char(116),char(0),char(8),char(0),char(117),char(0),char(8),char(0),char(118),char(0),char(4),char(0),char(119),char(0),char(4),char(0),char(120),char(0), -char(4),char(0),char(121),char(0),char(4),char(0),char(122),char(0),char(4),char(0),char(123),char(0),char(4),char(0),char(124),char(0),char(4),char(0),char(125),char(0), -char(0),char(0),char(37),char(0),char(50),char(0),char(27),char(0),char(9),char(0),char(101),char(0),char(9),char(0),char(102),char(0),char(27),char(0),char(103),char(0), -char(0),char(0),char(35),char(0),char(19),char(0),char(104),char(0),char(19),char(0),char(105),char(0),char(13),char(0),char(106),char(0),char(13),char(0),char(107),char(0), -char(13),char(0),char(108),char(0),char(7),char(0),char(109),char(0),char(7),char(0),char(110),char(0),char(7),char(0),char(111),char(0),char(7),char(0),char(112),char(0), -char(7),char(0),char(113),char(0),char(7),char(0),char(114),char(0),char(7),char(0),char(115),char(0),char(7),char(0),char(116),char(0),char(7),char(0),char(117),char(0), -char(7),char(0),char(118),char(0),char(4),char(0),char(119),char(0),char(4),char(0),char(120),char(0),char(4),char(0),char(121),char(0),char(4),char(0),char(122),char(0), -char(4),char(0),char(123),char(0),char(4),char(0),char(124),char(0),char(4),char(0),char(125),char(0),char(0),char(0),char(37),char(0),char(51),char(0),char(22),char(0), -char(8),char(0),char(126),char(0),char(8),char(0),char(127),char(0),char(8),char(0),char(111),char(0),char(8),char(0),char(-128),char(0),char(8),char(0),char(115),char(0), -char(8),char(0),char(-127),char(0),char(8),char(0),char(-126),char(0),char(8),char(0),char(-125),char(0),char(8),char(0),char(-124),char(0),char(8),char(0),char(-123),char(0), -char(8),char(0),char(-122),char(0),char(8),char(0),char(-121),char(0),char(8),char(0),char(-120),char(0),char(8),char(0),char(-119),char(0),char(8),char(0),char(-118),char(0), -char(8),char(0),char(-117),char(0),char(4),char(0),char(-116),char(0),char(4),char(0),char(-115),char(0),char(4),char(0),char(-114),char(0),char(4),char(0),char(-113),char(0), -char(4),char(0),char(-112),char(0),char(0),char(0),char(37),char(0),char(52),char(0),char(22),char(0),char(7),char(0),char(126),char(0),char(7),char(0),char(127),char(0), -char(7),char(0),char(111),char(0),char(7),char(0),char(-128),char(0),char(7),char(0),char(115),char(0),char(7),char(0),char(-127),char(0),char(7),char(0),char(-126),char(0), -char(7),char(0),char(-125),char(0),char(7),char(0),char(-124),char(0),char(7),char(0),char(-123),char(0),char(7),char(0),char(-122),char(0),char(7),char(0),char(-121),char(0), -char(7),char(0),char(-120),char(0),char(7),char(0),char(-119),char(0),char(7),char(0),char(-118),char(0),char(7),char(0),char(-117),char(0),char(4),char(0),char(-116),char(0), -char(4),char(0),char(-115),char(0),char(4),char(0),char(-114),char(0),char(4),char(0),char(-113),char(0),char(4),char(0),char(-112),char(0),char(0),char(0),char(37),char(0), -char(53),char(0),char(2),char(0),char(51),char(0),char(-111),char(0),char(14),char(0),char(-110),char(0),char(54),char(0),char(2),char(0),char(52),char(0),char(-111),char(0), -char(13),char(0),char(-110),char(0),char(55),char(0),char(21),char(0),char(50),char(0),char(-109),char(0),char(17),char(0),char(-108),char(0),char(13),char(0),char(-107),char(0), -char(13),char(0),char(-106),char(0),char(13),char(0),char(-105),char(0),char(13),char(0),char(-104),char(0),char(13),char(0),char(-110),char(0),char(13),char(0),char(-103),char(0), -char(13),char(0),char(-102),char(0),char(13),char(0),char(-101),char(0),char(13),char(0),char(-100),char(0),char(7),char(0),char(-99),char(0),char(7),char(0),char(-98),char(0), -char(7),char(0),char(-97),char(0),char(7),char(0),char(-96),char(0),char(7),char(0),char(-95),char(0),char(7),char(0),char(-94),char(0),char(7),char(0),char(-93),char(0), -char(7),char(0),char(-92),char(0),char(7),char(0),char(-91),char(0),char(4),char(0),char(-90),char(0),char(56),char(0),char(22),char(0),char(49),char(0),char(-109),char(0), -char(18),char(0),char(-108),char(0),char(14),char(0),char(-107),char(0),char(14),char(0),char(-106),char(0),char(14),char(0),char(-105),char(0),char(14),char(0),char(-104),char(0), -char(14),char(0),char(-110),char(0),char(14),char(0),char(-103),char(0),char(14),char(0),char(-102),char(0),char(14),char(0),char(-101),char(0),char(14),char(0),char(-100),char(0), -char(8),char(0),char(-99),char(0),char(8),char(0),char(-98),char(0),char(8),char(0),char(-97),char(0),char(8),char(0),char(-96),char(0),char(8),char(0),char(-95),char(0), -char(8),char(0),char(-94),char(0),char(8),char(0),char(-93),char(0),char(8),char(0),char(-92),char(0),char(8),char(0),char(-91),char(0),char(4),char(0),char(-90),char(0), -char(0),char(0),char(37),char(0),char(57),char(0),char(2),char(0),char(4),char(0),char(-89),char(0),char(4),char(0),char(-88),char(0),char(58),char(0),char(13),char(0), -char(55),char(0),char(-87),char(0),char(55),char(0),char(-86),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0), -char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0),char(7),char(0),char(-81),char(0),char(7),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0), -char(4),char(0),char(-78),char(0),char(7),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0),char(59),char(0),char(13),char(0),char(60),char(0),char(-87),char(0), -char(60),char(0),char(-86),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0),char(4),char(0),char(-83),char(0), -char(4),char(0),char(-82),char(0),char(7),char(0),char(-81),char(0),char(7),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0),char(4),char(0),char(-78),char(0), -char(7),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0),char(61),char(0),char(14),char(0),char(56),char(0),char(-87),char(0),char(56),char(0),char(-86),char(0), -char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0),char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0), -char(8),char(0),char(-81),char(0),char(8),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0),char(4),char(0),char(-78),char(0),char(8),char(0),char(-77),char(0), -char(4),char(0),char(-76),char(0),char(0),char(0),char(-75),char(0),char(62),char(0),char(3),char(0),char(59),char(0),char(-74),char(0),char(13),char(0),char(-73),char(0), -char(13),char(0),char(-72),char(0),char(63),char(0),char(3),char(0),char(61),char(0),char(-74),char(0),char(14),char(0),char(-73),char(0),char(14),char(0),char(-72),char(0), -char(64),char(0),char(3),char(0),char(59),char(0),char(-74),char(0),char(14),char(0),char(-73),char(0),char(14),char(0),char(-72),char(0),char(65),char(0),char(13),char(0), -char(59),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0), -char(4),char(0),char(-67),char(0),char(7),char(0),char(-66),char(0),char(7),char(0),char(-65),char(0),char(7),char(0),char(-64),char(0),char(7),char(0),char(-63),char(0), -char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0),char(66),char(0),char(13),char(0),char(59),char(0),char(-74),char(0), -char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0),char(4),char(0),char(-67),char(0), -char(7),char(0),char(-66),char(0),char(7),char(0),char(-65),char(0),char(7),char(0),char(-64),char(0),char(7),char(0),char(-63),char(0),char(7),char(0),char(-62),char(0), -char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0),char(67),char(0),char(14),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0), -char(20),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0),char(4),char(0),char(-67),char(0),char(8),char(0),char(-66),char(0), -char(8),char(0),char(-65),char(0),char(8),char(0),char(-64),char(0),char(8),char(0),char(-63),char(0),char(8),char(0),char(-62),char(0),char(8),char(0),char(-61),char(0), -char(8),char(0),char(-60),char(0),char(0),char(0),char(-59),char(0),char(68),char(0),char(10),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0), -char(20),char(0),char(-70),char(0),char(8),char(0),char(-58),char(0),char(8),char(0),char(-57),char(0),char(8),char(0),char(-56),char(0),char(8),char(0),char(-62),char(0), -char(8),char(0),char(-61),char(0),char(8),char(0),char(-60),char(0),char(8),char(0),char(127),char(0),char(69),char(0),char(11),char(0),char(59),char(0),char(-74),char(0), -char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(7),char(0),char(-58),char(0),char(7),char(0),char(-57),char(0),char(7),char(0),char(-56),char(0), -char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0),char(7),char(0),char(127),char(0),char(0),char(0),char(21),char(0), -char(70),char(0),char(9),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(13),char(0),char(-55),char(0), -char(13),char(0),char(-54),char(0),char(13),char(0),char(-53),char(0),char(13),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0), -char(71),char(0),char(9),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(14),char(0),char(-55),char(0), -char(14),char(0),char(-54),char(0),char(14),char(0),char(-53),char(0),char(14),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0), -char(72),char(0),char(5),char(0),char(70),char(0),char(-49),char(0),char(4),char(0),char(-48),char(0),char(7),char(0),char(-47),char(0),char(7),char(0),char(-46),char(0), -char(7),char(0),char(-45),char(0),char(73),char(0),char(5),char(0),char(71),char(0),char(-49),char(0),char(4),char(0),char(-48),char(0),char(8),char(0),char(-47),char(0), -char(8),char(0),char(-46),char(0),char(8),char(0),char(-45),char(0),char(74),char(0),char(41),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0), -char(19),char(0),char(-70),char(0),char(13),char(0),char(-55),char(0),char(13),char(0),char(-54),char(0),char(13),char(0),char(-44),char(0),char(13),char(0),char(-43),char(0), -char(13),char(0),char(-42),char(0),char(13),char(0),char(-41),char(0),char(13),char(0),char(-40),char(0),char(13),char(0),char(-39),char(0),char(13),char(0),char(-38),char(0), -char(13),char(0),char(-37),char(0),char(13),char(0),char(-36),char(0),char(13),char(0),char(-35),char(0),char(13),char(0),char(-34),char(0),char(0),char(0),char(-33),char(0), -char(0),char(0),char(-32),char(0),char(0),char(0),char(-31),char(0),char(0),char(0),char(-30),char(0),char(0),char(0),char(-29),char(0),char(0),char(0),char(-59),char(0), -char(13),char(0),char(-53),char(0),char(13),char(0),char(-52),char(0),char(13),char(0),char(-28),char(0),char(13),char(0),char(-27),char(0),char(13),char(0),char(-26),char(0), -char(13),char(0),char(-25),char(0),char(13),char(0),char(-24),char(0),char(13),char(0),char(-23),char(0),char(13),char(0),char(-22),char(0),char(13),char(0),char(-21),char(0), -char(13),char(0),char(-20),char(0),char(13),char(0),char(-19),char(0),char(13),char(0),char(-18),char(0),char(0),char(0),char(-17),char(0),char(0),char(0),char(-16),char(0), -char(0),char(0),char(-15),char(0),char(0),char(0),char(-14),char(0),char(0),char(0),char(-13),char(0),char(4),char(0),char(-12),char(0),char(75),char(0),char(41),char(0), -char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(14),char(0),char(-55),char(0),char(14),char(0),char(-54),char(0), -char(14),char(0),char(-44),char(0),char(14),char(0),char(-43),char(0),char(14),char(0),char(-42),char(0),char(14),char(0),char(-41),char(0),char(14),char(0),char(-40),char(0), -char(14),char(0),char(-39),char(0),char(14),char(0),char(-38),char(0),char(14),char(0),char(-37),char(0),char(14),char(0),char(-36),char(0),char(14),char(0),char(-35),char(0), -char(14),char(0),char(-34),char(0),char(0),char(0),char(-33),char(0),char(0),char(0),char(-32),char(0),char(0),char(0),char(-31),char(0),char(0),char(0),char(-30),char(0), -char(0),char(0),char(-29),char(0),char(0),char(0),char(-59),char(0),char(14),char(0),char(-53),char(0),char(14),char(0),char(-52),char(0),char(14),char(0),char(-28),char(0), -char(14),char(0),char(-27),char(0),char(14),char(0),char(-26),char(0),char(14),char(0),char(-25),char(0),char(14),char(0),char(-24),char(0),char(14),char(0),char(-23),char(0), -char(14),char(0),char(-22),char(0),char(14),char(0),char(-21),char(0),char(14),char(0),char(-20),char(0),char(14),char(0),char(-19),char(0),char(14),char(0),char(-18),char(0), -char(0),char(0),char(-17),char(0),char(0),char(0),char(-16),char(0),char(0),char(0),char(-15),char(0),char(0),char(0),char(-14),char(0),char(0),char(0),char(-13),char(0), -char(4),char(0),char(-12),char(0),char(76),char(0),char(9),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0), -char(7),char(0),char(-55),char(0),char(7),char(0),char(-54),char(0),char(7),char(0),char(-53),char(0),char(7),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0), -char(4),char(0),char(-50),char(0),char(77),char(0),char(9),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0), -char(8),char(0),char(-55),char(0),char(8),char(0),char(-54),char(0),char(8),char(0),char(-53),char(0),char(8),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0), -char(4),char(0),char(-50),char(0),char(78),char(0),char(5),char(0),char(58),char(0),char(-74),char(0),char(13),char(0),char(-11),char(0),char(13),char(0),char(-10),char(0), -char(7),char(0),char(-9),char(0),char(0),char(0),char(37),char(0),char(79),char(0),char(4),char(0),char(61),char(0),char(-74),char(0),char(14),char(0),char(-11),char(0), -char(14),char(0),char(-10),char(0),char(8),char(0),char(-9),char(0),char(80),char(0),char(4),char(0),char(7),char(0),char(-8),char(0),char(7),char(0),char(-7),char(0), -char(7),char(0),char(-6),char(0),char(4),char(0),char(79),char(0),char(81),char(0),char(10),char(0),char(80),char(0),char(-5),char(0),char(13),char(0),char(-4),char(0), -char(13),char(0),char(-3),char(0),char(13),char(0),char(-2),char(0),char(13),char(0),char(-1),char(0),char(13),char(0),char(0),char(1),char(7),char(0),char(-99),char(0), -char(7),char(0),char(1),char(1),char(4),char(0),char(2),char(1),char(4),char(0),char(53),char(0),char(82),char(0),char(4),char(0),char(80),char(0),char(-5),char(0), -char(4),char(0),char(3),char(1),char(7),char(0),char(4),char(1),char(4),char(0),char(5),char(1),char(83),char(0),char(4),char(0),char(13),char(0),char(0),char(1), -char(80),char(0),char(-5),char(0),char(4),char(0),char(6),char(1),char(7),char(0),char(7),char(1),char(84),char(0),char(7),char(0),char(13),char(0),char(8),char(1), -char(80),char(0),char(-5),char(0),char(4),char(0),char(9),char(1),char(7),char(0),char(10),char(1),char(7),char(0),char(11),char(1),char(7),char(0),char(12),char(1), -char(4),char(0),char(53),char(0),char(85),char(0),char(6),char(0),char(17),char(0),char(13),char(1),char(13),char(0),char(11),char(1),char(13),char(0),char(14),char(1), -char(60),char(0),char(15),char(1),char(4),char(0),char(16),char(1),char(7),char(0),char(12),char(1),char(86),char(0),char(26),char(0),char(4),char(0),char(17),char(1), -char(7),char(0),char(18),char(1),char(7),char(0),char(127),char(0),char(7),char(0),char(19),char(1),char(7),char(0),char(20),char(1),char(7),char(0),char(21),char(1), -char(7),char(0),char(22),char(1),char(7),char(0),char(23),char(1),char(7),char(0),char(24),char(1),char(7),char(0),char(25),char(1),char(7),char(0),char(26),char(1), -char(7),char(0),char(27),char(1),char(7),char(0),char(28),char(1),char(7),char(0),char(29),char(1),char(7),char(0),char(30),char(1),char(7),char(0),char(31),char(1), -char(7),char(0),char(32),char(1),char(7),char(0),char(33),char(1),char(7),char(0),char(34),char(1),char(7),char(0),char(35),char(1),char(7),char(0),char(36),char(1), -char(4),char(0),char(37),char(1),char(4),char(0),char(38),char(1),char(4),char(0),char(39),char(1),char(4),char(0),char(40),char(1),char(4),char(0),char(120),char(0), -char(87),char(0),char(12),char(0),char(17),char(0),char(41),char(1),char(17),char(0),char(42),char(1),char(17),char(0),char(43),char(1),char(13),char(0),char(44),char(1), -char(13),char(0),char(45),char(1),char(7),char(0),char(46),char(1),char(4),char(0),char(47),char(1),char(4),char(0),char(48),char(1),char(4),char(0),char(49),char(1), -char(4),char(0),char(50),char(1),char(7),char(0),char(10),char(1),char(4),char(0),char(53),char(0),char(88),char(0),char(27),char(0),char(19),char(0),char(51),char(1), -char(17),char(0),char(52),char(1),char(17),char(0),char(53),char(1),char(13),char(0),char(44),char(1),char(13),char(0),char(54),char(1),char(13),char(0),char(55),char(1), -char(13),char(0),char(56),char(1),char(13),char(0),char(57),char(1),char(13),char(0),char(58),char(1),char(4),char(0),char(59),char(1),char(7),char(0),char(60),char(1), -char(4),char(0),char(61),char(1),char(4),char(0),char(62),char(1),char(4),char(0),char(63),char(1),char(7),char(0),char(64),char(1),char(7),char(0),char(65),char(1), -char(4),char(0),char(66),char(1),char(4),char(0),char(67),char(1),char(7),char(0),char(68),char(1),char(7),char(0),char(69),char(1),char(7),char(0),char(70),char(1), -char(7),char(0),char(71),char(1),char(7),char(0),char(72),char(1),char(7),char(0),char(73),char(1),char(4),char(0),char(74),char(1),char(4),char(0),char(75),char(1), -char(4),char(0),char(76),char(1),char(89),char(0),char(12),char(0),char(9),char(0),char(77),char(1),char(9),char(0),char(78),char(1),char(13),char(0),char(79),char(1), -char(7),char(0),char(80),char(1),char(7),char(0),char(-125),char(0),char(7),char(0),char(81),char(1),char(4),char(0),char(82),char(1),char(13),char(0),char(83),char(1), -char(4),char(0),char(84),char(1),char(4),char(0),char(85),char(1),char(4),char(0),char(86),char(1),char(4),char(0),char(53),char(0),char(90),char(0),char(19),char(0), -char(50),char(0),char(-109),char(0),char(87),char(0),char(87),char(1),char(80),char(0),char(88),char(1),char(81),char(0),char(89),char(1),char(82),char(0),char(90),char(1), -char(83),char(0),char(91),char(1),char(84),char(0),char(92),char(1),char(85),char(0),char(93),char(1),char(88),char(0),char(94),char(1),char(89),char(0),char(95),char(1), -char(4),char(0),char(96),char(1),char(4),char(0),char(62),char(1),char(4),char(0),char(97),char(1),char(4),char(0),char(98),char(1),char(4),char(0),char(99),char(1), -char(4),char(0),char(100),char(1),char(4),char(0),char(101),char(1),char(4),char(0),char(102),char(1),char(86),char(0),char(103),char(1),char(91),char(0),char(20),char(0), -char(16),char(0),char(104),char(1),char(14),char(0),char(105),char(1),char(14),char(0),char(106),char(1),char(14),char(0),char(107),char(1),char(14),char(0),char(108),char(1), -char(14),char(0),char(109),char(1),char(8),char(0),char(110),char(1),char(4),char(0),char(111),char(1),char(4),char(0),char(86),char(1),char(4),char(0),char(112),char(1), -char(4),char(0),char(113),char(1),char(8),char(0),char(114),char(1),char(8),char(0),char(115),char(1),char(8),char(0),char(116),char(1),char(8),char(0),char(117),char(1), -char(8),char(0),char(118),char(1),char(0),char(0),char(119),char(1),char(0),char(0),char(120),char(1),char(49),char(0),char(121),char(1),char(0),char(0),char(122),char(1), -char(92),char(0),char(20),char(0),char(15),char(0),char(104),char(1),char(13),char(0),char(105),char(1),char(13),char(0),char(106),char(1),char(13),char(0),char(107),char(1), -char(13),char(0),char(108),char(1),char(13),char(0),char(109),char(1),char(4),char(0),char(112),char(1),char(7),char(0),char(110),char(1),char(4),char(0),char(111),char(1), -char(4),char(0),char(86),char(1),char(7),char(0),char(114),char(1),char(7),char(0),char(115),char(1),char(7),char(0),char(116),char(1),char(4),char(0),char(113),char(1), -char(7),char(0),char(117),char(1),char(7),char(0),char(118),char(1),char(0),char(0),char(119),char(1),char(0),char(0),char(120),char(1),char(50),char(0),char(121),char(1), -char(0),char(0),char(122),char(1),char(93),char(0),char(9),char(0),char(20),char(0),char(123),char(1),char(14),char(0),char(124),char(1),char(8),char(0),char(125),char(1), -char(0),char(0),char(126),char(1),char(91),char(0),char(90),char(1),char(49),char(0),char(127),char(1),char(0),char(0),char(122),char(1),char(4),char(0),char(97),char(1), -char(0),char(0),char(37),char(0),char(94),char(0),char(7),char(0),char(0),char(0),char(126),char(1),char(92),char(0),char(90),char(1),char(50),char(0),char(127),char(1), -char(19),char(0),char(123),char(1),char(13),char(0),char(124),char(1),char(7),char(0),char(125),char(1),char(4),char(0),char(97),char(1),}; -int sBulletDNAlen64= sizeof(sBulletDNAstr64); diff --git a/Engine/lib/bullet/src/LinearMath/btSerializer.h b/Engine/lib/bullet/src/LinearMath/btSerializer.h index 6f03df158..89b4d7468 100644 --- a/Engine/lib/bullet/src/LinearMath/btSerializer.h +++ b/Engine/lib/bullet/src/LinearMath/btSerializer.h @@ -26,7 +26,7 @@ subject to the following restrictions: -///only the 32bit versions for now + extern char sBulletDNAstr[]; extern int sBulletDNAlen; extern char sBulletDNAstr64[]; @@ -505,7 +505,7 @@ public: buffer[9] = '2'; buffer[10] = '8'; - buffer[11] = '5'; + buffer[11] = '7'; } diff --git a/Engine/lib/bullet/src/LinearMath/btSerializer64.cpp b/Engine/lib/bullet/src/LinearMath/btSerializer64.cpp new file mode 100644 index 000000000..05f59202d --- /dev/null +++ b/Engine/lib/bullet/src/LinearMath/btSerializer64.cpp @@ -0,0 +1,599 @@ +char sBulletDNAstr64[]= { +char(83),char(68),char(78),char(65),char(78),char(65),char(77),char(69),char(-124),char(1),char(0),char(0),char(109),char(95),char(115),char(105),char(122),char(101),char(0),char(109), +char(95),char(99),char(97),char(112),char(97),char(99),char(105),char(116),char(121),char(0),char(42),char(109),char(95),char(100),char(97),char(116),char(97),char(0),char(109),char(95), +char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(115),char(0),char(109),char(95),char(99),char(111), +char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99),char(116),char(115),char(0),char(109),char(95),char(99),char(111),char(110), +char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(115),char(0),char(42),char(102),char(105),char(114),char(115),char(116),char(0),char(42),char(108),char(97),char(115), +char(116),char(0),char(109),char(95),char(102),char(108),char(111),char(97),char(116),char(115),char(91),char(52),char(93),char(0),char(109),char(95),char(101),char(108),char(91),char(51), +char(93),char(0),char(109),char(95),char(98),char(97),char(115),char(105),char(115),char(0),char(109),char(95),char(111),char(114),char(105),char(103),char(105),char(110),char(0),char(109), +char(95),char(114),char(111),char(111),char(116),char(78),char(111),char(100),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109),char(95),char(115),char(117),char(98), +char(116),char(114),char(101),char(101),char(83),char(105),char(122),char(101),char(0),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100), +char(65),char(97),char(98),char(98),char(77),char(105),char(110),char(91),char(51),char(93),char(0),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105),char(122), +char(101),char(100),char(65),char(97),char(98),char(98),char(77),char(97),char(120),char(91),char(51),char(93),char(0),char(109),char(95),char(97),char(97),char(98),char(98),char(77), +char(105),char(110),char(79),char(114),char(103),char(0),char(109),char(95),char(97),char(97),char(98),char(98),char(77),char(97),char(120),char(79),char(114),char(103),char(0),char(109), +char(95),char(101),char(115),char(99),char(97),char(112),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109),char(95),char(115),char(117),char(98),char(80),char(97), +char(114),char(116),char(0),char(109),char(95),char(116),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109), +char(95),char(112),char(97),char(100),char(91),char(52),char(93),char(0),char(109),char(95),char(101),char(115),char(99),char(97),char(112),char(101),char(73),char(110),char(100),char(101), +char(120),char(79),char(114),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109),char(95),char(98), +char(118),char(104),char(65),char(97),char(98),char(98),char(77),char(105),char(110),char(0),char(109),char(95),char(98),char(118),char(104),char(65),char(97),char(98),char(98),char(77), +char(97),char(120),char(0),char(109),char(95),char(98),char(118),char(104),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(97),char(116),char(105),char(111),char(110), +char(0),char(109),char(95),char(99),char(117),char(114),char(78),char(111),char(100),char(101),char(73),char(110),char(100),char(101),char(120),char(0),char(109),char(95),char(117),char(115), +char(101),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(97),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(110),char(117),char(109),char(67), +char(111),char(110),char(116),char(105),char(103),char(117),char(111),char(117),char(115),char(76),char(101),char(97),char(102),char(78),char(111),char(100),char(101),char(115),char(0),char(109), +char(95),char(110),char(117),char(109),char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(67),char(111),char(110),char(116),char(105),char(103),char(117), +char(111),char(117),char(115),char(78),char(111),char(100),char(101),char(115),char(0),char(42),char(109),char(95),char(99),char(111),char(110),char(116),char(105),char(103),char(117),char(111), +char(117),char(115),char(78),char(111),char(100),char(101),char(115),char(80),char(116),char(114),char(0),char(42),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105), +char(122),char(101),char(100),char(67),char(111),char(110),char(116),char(105),char(103),char(117),char(111),char(117),char(115),char(78),char(111),char(100),char(101),char(115),char(80),char(116), +char(114),char(0),char(42),char(109),char(95),char(115),char(117),char(98),char(84),char(114),char(101),char(101),char(73),char(110),char(102),char(111),char(80),char(116),char(114),char(0), +char(109),char(95),char(116),char(114),char(97),char(118),char(101),char(114),char(115),char(97),char(108),char(77),char(111),char(100),char(101),char(0),char(109),char(95),char(110),char(117), +char(109),char(83),char(117),char(98),char(116),char(114),char(101),char(101),char(72),char(101),char(97),char(100),char(101),char(114),char(115),char(0),char(42),char(109),char(95),char(110), +char(97),char(109),char(101),char(0),char(109),char(95),char(115),char(104),char(97),char(112),char(101),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(112),char(97), +char(100),char(100),char(105),char(110),char(103),char(91),char(52),char(93),char(0),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110), +char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(108),char(111),char(99),char(97),char(108),char(83),char(99),char(97), +char(108),char(105),char(110),char(103),char(0),char(109),char(95),char(112),char(108),char(97),char(110),char(101),char(78),char(111),char(114),char(109),char(97),char(108),char(0),char(109), +char(95),char(112),char(108),char(97),char(110),char(101),char(67),char(111),char(110),char(115),char(116),char(97),char(110),char(116),char(0),char(109),char(95),char(105),char(109),char(112), +char(108),char(105),char(99),char(105),char(116),char(83),char(104),char(97),char(112),char(101),char(68),char(105),char(109),char(101),char(110),char(115),char(105),char(111),char(110),char(115), +char(0),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(77),char(97),char(114),char(103),char(105),char(110),char(0),char(109), +char(95),char(112),char(97),char(100),char(100),char(105),char(110),char(103),char(0),char(109),char(95),char(112),char(111),char(115),char(0),char(109),char(95),char(114),char(97),char(100), +char(105),char(117),char(115),char(0),char(109),char(95),char(99),char(111),char(110),char(118),char(101),char(120),char(73),char(110),char(116),char(101),char(114),char(110),char(97),char(108), +char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(42),char(109),char(95),char(108),char(111),char(99),char(97),char(108),char(80),char(111), +char(115),char(105),char(116),char(105),char(111),char(110),char(65),char(114),char(114),char(97),char(121),char(80),char(116),char(114),char(0),char(109),char(95),char(108),char(111),char(99), +char(97),char(108),char(80),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(65),char(114),char(114),char(97),char(121),char(83),char(105),char(122),char(101),char(0), +char(109),char(95),char(118),char(97),char(108),char(117),char(101),char(0),char(109),char(95),char(112),char(97),char(100),char(91),char(50),char(93),char(0),char(109),char(95),char(118), +char(97),char(108),char(117),char(101),char(115),char(91),char(51),char(93),char(0),char(109),char(95),char(112),char(97),char(100),char(0),char(42),char(109),char(95),char(118),char(101), +char(114),char(116),char(105),char(99),char(101),char(115),char(51),char(102),char(0),char(42),char(109),char(95),char(118),char(101),char(114),char(116),char(105),char(99),char(101),char(115), +char(51),char(100),char(0),char(42),char(109),char(95),char(105),char(110),char(100),char(105),char(99),char(101),char(115),char(51),char(50),char(0),char(42),char(109),char(95),char(51), +char(105),char(110),char(100),char(105),char(99),char(101),char(115),char(49),char(54),char(0),char(42),char(109),char(95),char(51),char(105),char(110),char(100),char(105),char(99),char(101), +char(115),char(56),char(0),char(42),char(109),char(95),char(105),char(110),char(100),char(105),char(99),char(101),char(115),char(49),char(54),char(0),char(109),char(95),char(110),char(117), +char(109),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(86),char(101),char(114),char(116), +char(105),char(99),char(101),char(115),char(0),char(42),char(109),char(95),char(109),char(101),char(115),char(104),char(80),char(97),char(114),char(116),char(115),char(80),char(116),char(114), +char(0),char(109),char(95),char(115),char(99),char(97),char(108),char(105),char(110),char(103),char(0),char(109),char(95),char(110),char(117),char(109),char(77),char(101),char(115),char(104), +char(80),char(97),char(114),char(116),char(115),char(0),char(109),char(95),char(109),char(101),char(115),char(104),char(73),char(110),char(116),char(101),char(114),char(102),char(97),char(99), +char(101),char(0),char(42),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(70),char(108),char(111),char(97),char(116),char(66), +char(118),char(104),char(0),char(42),char(109),char(95),char(113),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(68),char(111),char(117),char(98),char(108), +char(101),char(66),char(118),char(104),char(0),char(42),char(109),char(95),char(116),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(102),char(111), +char(77),char(97),char(112),char(0),char(109),char(95),char(112),char(97),char(100),char(51),char(91),char(52),char(93),char(0),char(109),char(95),char(116),char(114),char(105),char(109), +char(101),char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(116),char(114),char(97),char(110),char(115), +char(102),char(111),char(114),char(109),char(0),char(42),char(109),char(95),char(99),char(104),char(105),char(108),char(100),char(83),char(104),char(97),char(112),char(101),char(0),char(109), +char(95),char(99),char(104),char(105),char(108),char(100),char(83),char(104),char(97),char(112),char(101),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(99),char(104), +char(105),char(108),char(100),char(77),char(97),char(114),char(103),char(105),char(110),char(0),char(42),char(109),char(95),char(99),char(104),char(105),char(108),char(100),char(83),char(104), +char(97),char(112),char(101),char(80),char(116),char(114),char(0),char(109),char(95),char(110),char(117),char(109),char(67),char(104),char(105),char(108),char(100),char(83),char(104),char(97), +char(112),char(101),char(115),char(0),char(109),char(95),char(117),char(112),char(65),char(120),char(105),char(115),char(0),char(109),char(95),char(117),char(112),char(73),char(110),char(100), +char(101),char(120),char(0),char(109),char(95),char(102),char(108),char(97),char(103),char(115),char(0),char(109),char(95),char(101),char(100),char(103),char(101),char(86),char(48),char(86), +char(49),char(65),char(110),char(103),char(108),char(101),char(0),char(109),char(95),char(101),char(100),char(103),char(101),char(86),char(49),char(86),char(50),char(65),char(110),char(103), +char(108),char(101),char(0),char(109),char(95),char(101),char(100),char(103),char(101),char(86),char(50),char(86),char(48),char(65),char(110),char(103),char(108),char(101),char(0),char(42), +char(109),char(95),char(104),char(97),char(115),char(104),char(84),char(97),char(98),char(108),char(101),char(80),char(116),char(114),char(0),char(42),char(109),char(95),char(110),char(101), +char(120),char(116),char(80),char(116),char(114),char(0),char(42),char(109),char(95),char(118),char(97),char(108),char(117),char(101),char(65),char(114),char(114),char(97),char(121),char(80), +char(116),char(114),char(0),char(42),char(109),char(95),char(107),char(101),char(121),char(65),char(114),char(114),char(97),char(121),char(80),char(116),char(114),char(0),char(109),char(95), +char(99),char(111),char(110),char(118),char(101),char(120),char(69),char(112),char(115),char(105),char(108),char(111),char(110),char(0),char(109),char(95),char(112),char(108),char(97),char(110), +char(97),char(114),char(69),char(112),char(115),char(105),char(108),char(111),char(110),char(0),char(109),char(95),char(101),char(113),char(117),char(97),char(108),char(86),char(101),char(114), +char(116),char(101),char(120),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(101),char(100),char(103),char(101),char(68), +char(105),char(115),char(116),char(97),char(110),char(99),char(101),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(122), +char(101),char(114),char(111),char(65),char(114),char(101),char(97),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(110), +char(101),char(120),char(116),char(83),char(105),char(122),char(101),char(0),char(109),char(95),char(104),char(97),char(115),char(104),char(84),char(97),char(98),char(108),char(101),char(83), +char(105),char(122),char(101),char(0),char(109),char(95),char(110),char(117),char(109),char(86),char(97),char(108),char(117),char(101),char(115),char(0),char(109),char(95),char(110),char(117), +char(109),char(75),char(101),char(121),char(115),char(0),char(109),char(95),char(103),char(105),char(109),char(112),char(97),char(99),char(116),char(83),char(117),char(98),char(84),char(121), +char(112),char(101),char(0),char(42),char(109),char(95),char(117),char(110),char(115),char(99),char(97),char(108),char(101),char(100),char(80),char(111),char(105),char(110),char(116),char(115), +char(70),char(108),char(111),char(97),char(116),char(80),char(116),char(114),char(0),char(42),char(109),char(95),char(117),char(110),char(115),char(99),char(97),char(108),char(101),char(100), +char(80),char(111),char(105),char(110),char(116),char(115),char(68),char(111),char(117),char(98),char(108),char(101),char(80),char(116),char(114),char(0),char(109),char(95),char(110),char(117), +char(109),char(85),char(110),char(115),char(99),char(97),char(108),char(101),char(100),char(80),char(111),char(105),char(110),char(116),char(115),char(0),char(109),char(95),char(112),char(97), +char(100),char(100),char(105),char(110),char(103),char(51),char(91),char(52),char(93),char(0),char(42),char(109),char(95),char(98),char(114),char(111),char(97),char(100),char(112),char(104), +char(97),char(115),char(101),char(72),char(97),char(110),char(100),char(108),char(101),char(0),char(42),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105), +char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(0),char(42),char(109),char(95),char(114),char(111),char(111),char(116),char(67),char(111),char(108),char(108),char(105), +char(115),char(105),char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(0),char(109),char(95),char(119),char(111),char(114),char(108),char(100),char(84),char(114),char(97), +char(110),char(115),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(105),char(110),char(116),char(101),char(114),char(112),char(111),char(108),char(97),char(116),char(105), +char(111),char(110),char(87),char(111),char(114),char(108),char(100),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(105), +char(110),char(116),char(101),char(114),char(112),char(111),char(108),char(97),char(116),char(105),char(111),char(110),char(76),char(105),char(110),char(101),char(97),char(114),char(86),char(101), +char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95),char(105),char(110),char(116),char(101),char(114),char(112),char(111),char(108),char(97),char(116),char(105), +char(111),char(110),char(65),char(110),char(103),char(117),char(108),char(97),char(114),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95), +char(97),char(110),char(105),char(115),char(111),char(116),char(114),char(111),char(112),char(105),char(99),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0), +char(109),char(95),char(99),char(111),char(110),char(116),char(97),char(99),char(116),char(80),char(114),char(111),char(99),char(101),char(115),char(115),char(105),char(110),char(103),char(84), +char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(100),char(101),char(97),char(99),char(116),char(105),char(118),char(97),char(116), +char(105),char(111),char(110),char(84),char(105),char(109),char(101),char(0),char(109),char(95),char(102),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0),char(109), +char(95),char(114),char(111),char(108),char(108),char(105),char(110),char(103),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(99), +char(111),char(110),char(116),char(97),char(99),char(116),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(99),char(111),char(110),char(116), +char(97),char(99),char(116),char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(114),char(101),char(115),char(116),char(105), +char(116),char(117),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(104),char(105),char(116),char(70),char(114),char(97),char(99),char(116),char(105),char(111),char(110), +char(0),char(109),char(95),char(99),char(99),char(100),char(83),char(119),char(101),char(112),char(116),char(83),char(112),char(104),char(101),char(114),char(101),char(82),char(97),char(100), +char(105),char(117),char(115),char(0),char(109),char(95),char(99),char(99),char(100),char(77),char(111),char(116),char(105),char(111),char(110),char(84),char(104),char(114),char(101),char(115), +char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(104),char(97),char(115),char(65),char(110),char(105),char(115),char(111),char(116),char(114),char(111),char(112),char(105), +char(99),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111), +char(110),char(70),char(108),char(97),char(103),char(115),char(0),char(109),char(95),char(105),char(115),char(108),char(97),char(110),char(100),char(84),char(97),char(103),char(49),char(0), +char(109),char(95),char(99),char(111),char(109),char(112),char(97),char(110),char(105),char(111),char(110),char(73),char(100),char(0),char(109),char(95),char(97),char(99),char(116),char(105), +char(118),char(97),char(116),char(105),char(111),char(110),char(83),char(116),char(97),char(116),char(101),char(49),char(0),char(109),char(95),char(105),char(110),char(116),char(101),char(114), +char(110),char(97),char(108),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(99),char(104),char(101),char(99),char(107),char(67),char(111),char(108),char(108),char(105), +char(100),char(101),char(87),char(105),char(116),char(104),char(0),char(109),char(95),char(116),char(97),char(117),char(0),char(109),char(95),char(100),char(97),char(109),char(112),char(105), +char(110),char(103),char(0),char(109),char(95),char(116),char(105),char(109),char(101),char(83),char(116),char(101),char(112),char(0),char(109),char(95),char(109),char(97),char(120),char(69), +char(114),char(114),char(111),char(114),char(82),char(101),char(100),char(117),char(99),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(115),char(111),char(114),char(0), +char(109),char(95),char(101),char(114),char(112),char(0),char(109),char(95),char(101),char(114),char(112),char(50),char(0),char(109),char(95),char(103),char(108),char(111),char(98),char(97), +char(108),char(67),char(102),char(109),char(0),char(109),char(95),char(115),char(112),char(108),char(105),char(116),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(80), +char(101),char(110),char(101),char(116),char(114),char(97),char(116),char(105),char(111),char(110),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0), +char(109),char(95),char(115),char(112),char(108),char(105),char(116),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(84),char(117),char(114),char(110),char(69),char(114), +char(112),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(108),char(111),char(112),char(0),char(109),char(95),char(119),char(97),char(114), +char(109),char(115),char(116),char(97),char(114),char(116),char(105),char(110),char(103),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(109),char(97), +char(120),char(71),char(121),char(114),char(111),char(115),char(99),char(111),char(112),char(105),char(99),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(115), +char(105),char(110),char(103),char(108),char(101),char(65),char(120),char(105),char(115),char(82),char(111),char(108),char(108),char(105),char(110),char(103),char(70),char(114),char(105),char(99), +char(116),char(105),char(111),char(110),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(110),char(117),char(109),char(73), +char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115),char(0),char(109),char(95),char(115),char(111),char(108),char(118),char(101),char(114),char(77),char(111), +char(100),char(101),char(0),char(109),char(95),char(114),char(101),char(115),char(116),char(105),char(110),char(103),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(82), +char(101),char(115),char(116),char(105),char(116),char(117),char(116),char(105),char(111),char(110),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0), +char(109),char(95),char(109),char(105),char(110),char(105),char(109),char(117),char(109),char(83),char(111),char(108),char(118),char(101),char(114),char(66),char(97),char(116),char(99),char(104), +char(83),char(105),char(122),char(101),char(0),char(109),char(95),char(115),char(112),char(108),char(105),char(116),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(0), +char(109),char(95),char(115),char(111),char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111),char(0),char(109),char(95),char(103),char(114),char(97),char(118),char(105), +char(116),char(121),char(0),char(109),char(95),char(99),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99),char(116), +char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(105),char(110),char(118),char(73),char(110),char(101),char(114),char(116),char(105),char(97),char(84),char(101),char(110), +char(115),char(111),char(114),char(87),char(111),char(114),char(108),char(100),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(86),char(101),char(108), +char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(86),char(101),char(108),char(111),char(99), +char(105),char(116),char(121),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(70),char(97),char(99),char(116),char(111),char(114),char(0), +char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(103),char(114),char(97), +char(118),char(105),char(116),char(121),char(95),char(97),char(99),char(99),char(101),char(108),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(0),char(109),char(95), +char(105),char(110),char(118),char(73),char(110),char(101),char(114),char(116),char(105),char(97),char(76),char(111),char(99),char(97),char(108),char(0),char(109),char(95),char(116),char(111), +char(116),char(97),char(108),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(116),char(111),char(116),char(97),char(108),char(84),char(111),char(114),char(113), +char(117),char(101),char(0),char(109),char(95),char(105),char(110),char(118),char(101),char(114),char(115),char(101),char(77),char(97),char(115),char(115),char(0),char(109),char(95),char(108), +char(105),char(110),char(101),char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108), +char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(97),char(100),char(100),char(105),char(116),char(105),char(111),char(110), +char(97),char(108),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(97),char(100), +char(100),char(105),char(116),char(105),char(111),char(110),char(97),char(108),char(76),char(105),char(110),char(101),char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110), +char(103),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(83),char(113),char(114),char(0),char(109),char(95),char(97),char(100),char(100),char(105), +char(116),char(105),char(111),char(110),char(97),char(108),char(65),char(110),char(103),char(117),char(108),char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110),char(103), +char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(83),char(113),char(114),char(0),char(109),char(95),char(97),char(100),char(100),char(105),char(116), +char(105),char(111),char(110),char(97),char(108),char(65),char(110),char(103),char(117),char(108),char(97),char(114),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(70), +char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(108),char(101),char(101),char(112),char(105), +char(110),char(103),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97), +char(114),char(83),char(108),char(101),char(101),char(112),char(105),char(110),char(103),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109), +char(95),char(97),char(100),char(100),char(105),char(116),char(105),char(111),char(110),char(97),char(108),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109), +char(95),char(110),char(117),char(109),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(82),char(111),char(119),char(115),char(0),char(110), +char(117),char(98),char(0),char(42),char(109),char(95),char(114),char(98),char(65),char(0),char(42),char(109),char(95),char(114),char(98),char(66),char(0),char(109),char(95),char(111), +char(98),char(106),char(101),char(99),char(116),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(117),char(115),char(101),char(114),char(67),char(111),char(110),char(115), +char(116),char(114),char(97),char(105),char(110),char(116),char(84),char(121),char(112),char(101),char(0),char(109),char(95),char(117),char(115),char(101),char(114),char(67),char(111),char(110), +char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(73),char(100),char(0),char(109),char(95),char(110),char(101),char(101),char(100),char(115),char(70),char(101),char(101), +char(100),char(98),char(97),char(99),char(107),char(0),char(109),char(95),char(97),char(112),char(112),char(108),char(105),char(101),char(100),char(73),char(109),char(112),char(117),char(108), +char(115),char(101),char(0),char(109),char(95),char(100),char(98),char(103),char(68),char(114),char(97),char(119),char(83),char(105),char(122),char(101),char(0),char(109),char(95),char(100), +char(105),char(115),char(97),char(98),char(108),char(101),char(67),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(115),char(66),char(101),char(116),char(119), +char(101),char(101),char(110),char(76),char(105),char(110),char(107),char(101),char(100),char(66),char(111),char(100),char(105),char(101),char(115),char(0),char(109),char(95),char(111),char(118), +char(101),char(114),char(114),char(105),char(100),char(101),char(78),char(117),char(109),char(83),char(111),char(108),char(118),char(101),char(114),char(73),char(116),char(101),char(114),char(97), +char(116),char(105),char(111),char(110),char(115),char(0),char(109),char(95),char(98),char(114),char(101),char(97),char(107),char(105),char(110),char(103),char(73),char(109),char(112),char(117), +char(108),char(115),char(101),char(84),char(104),char(114),char(101),char(115),char(104),char(111),char(108),char(100),char(0),char(109),char(95),char(105),char(115),char(69),char(110),char(97), +char(98),char(108),char(101),char(100),char(0),char(112),char(97),char(100),char(100),char(105),char(110),char(103),char(91),char(52),char(93),char(0),char(109),char(95),char(116),char(121), +char(112),char(101),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(112), +char(105),char(118),char(111),char(116),char(73),char(110),char(65),char(0),char(109),char(95),char(112),char(105),char(118),char(111),char(116),char(73),char(110),char(66),char(0),char(109), +char(95),char(114),char(98),char(65),char(70),char(114),char(97),char(109),char(101),char(0),char(109),char(95),char(114),char(98),char(66),char(70),char(114),char(97),char(109),char(101), +char(0),char(109),char(95),char(117),char(115),char(101),char(82),char(101),char(102),char(101),char(114),char(101),char(110),char(99),char(101),char(70),char(114),char(97),char(109),char(101), +char(65),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(79),char(110),char(108),char(121),char(0),char(109),char(95),char(101),char(110), +char(97),char(98),char(108),char(101),char(65),char(110),char(103),char(117),char(108),char(97),char(114),char(77),char(111),char(116),char(111),char(114),char(0),char(109),char(95),char(109), +char(111),char(116),char(111),char(114),char(84),char(97),char(114),char(103),char(101),char(116),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109), +char(95),char(109),char(97),char(120),char(77),char(111),char(116),char(111),char(114),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(0),char(109),char(95),char(108), +char(111),char(119),char(101),char(114),char(76),char(105),char(109),char(105),char(116),char(0),char(109),char(95),char(117),char(112),char(112),char(101),char(114),char(76),char(105),char(109), +char(105),char(116),char(0),char(109),char(95),char(108),char(105),char(109),char(105),char(116),char(83),char(111),char(102),char(116),char(110),char(101),char(115),char(115),char(0),char(109), +char(95),char(98),char(105),char(97),char(115),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(114),char(101),char(108),char(97),char(120),char(97), +char(116),char(105),char(111),char(110),char(70),char(97),char(99),char(116),char(111),char(114),char(0),char(109),char(95),char(112),char(97),char(100),char(100),char(105),char(110),char(103), +char(49),char(91),char(52),char(93),char(0),char(109),char(95),char(115),char(119),char(105),char(110),char(103),char(83),char(112),char(97),char(110),char(49),char(0),char(109),char(95), +char(115),char(119),char(105),char(110),char(103),char(83),char(112),char(97),char(110),char(50),char(0),char(109),char(95),char(116),char(119),char(105),char(115),char(116),char(83),char(112), +char(97),char(110),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(85),char(112),char(112),char(101),char(114),char(76),char(105),char(109),char(105), +char(116),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(76),char(111),char(119),char(101),char(114),char(76),char(105),char(109),char(105),char(116), +char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(85),char(112),char(112),char(101),char(114),char(76),char(105),char(109),char(105),char(116), +char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(76),char(111),char(119),char(101),char(114),char(76),char(105),char(109),char(105),char(116), +char(0),char(109),char(95),char(117),char(115),char(101),char(76),char(105),char(110),char(101),char(97),char(114),char(82),char(101),char(102),char(101),char(114),char(101),char(110),char(99), +char(101),char(70),char(114),char(97),char(109),char(101),char(65),char(0),char(109),char(95),char(117),char(115),char(101),char(79),char(102),char(102),char(115),char(101),char(116),char(70), +char(111),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(114),char(97),char(109),char(101),char(0),char(109),char(95), +char(54),char(100),char(111),char(102),char(68),char(97),char(116),char(97),char(0),char(109),char(95),char(115),char(112),char(114),char(105),char(110),char(103),char(69),char(110),char(97), +char(98),char(108),char(101),char(100),char(91),char(54),char(93),char(0),char(109),char(95),char(101),char(113),char(117),char(105),char(108),char(105),char(98),char(114),char(105),char(117), +char(109),char(80),char(111),char(105),char(110),char(116),char(91),char(54),char(93),char(0),char(109),char(95),char(115),char(112),char(114),char(105),char(110),char(103),char(83),char(116), +char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(91),char(54),char(93),char(0),char(109),char(95),char(115),char(112),char(114),char(105),char(110),char(103),char(68), +char(97),char(109),char(112),char(105),char(110),char(103),char(91),char(54),char(93),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(66),char(111), +char(117),char(110),char(99),char(101),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(116),char(111),char(112),char(69),char(82),char(80), +char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(116),char(111),char(112),char(67),char(70),char(77),char(0),char(109),char(95),char(108), +char(105),char(110),char(101),char(97),char(114),char(77),char(111),char(116),char(111),char(114),char(69),char(82),char(80),char(0),char(109),char(95),char(108),char(105),char(110),char(101), +char(97),char(114),char(77),char(111),char(116),char(111),char(114),char(67),char(70),char(77),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(84), +char(97),char(114),char(103),char(101),char(116),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95),char(108),char(105),char(110),char(101), +char(97),char(114),char(77),char(97),char(120),char(77),char(111),char(116),char(111),char(114),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(108),char(105), +char(110),char(101),char(97),char(114),char(83),char(101),char(114),char(118),char(111),char(84),char(97),char(114),char(103),char(101),char(116),char(0),char(109),char(95),char(108),char(105), +char(110),char(101),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(0), +char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(68),char(97),char(109),char(112),char(105),char(110), +char(103),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(69),char(113),char(117),char(105),char(108),char(105),char(98),char(114),char(105),char(117), +char(109),char(80),char(111),char(105),char(110),char(116),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(69),char(110),char(97),char(98),char(108), +char(101),char(77),char(111),char(116),char(111),char(114),char(91),char(52),char(93),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(101), +char(114),char(118),char(111),char(77),char(111),char(116),char(111),char(114),char(91),char(52),char(93),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114), +char(69),char(110),char(97),char(98),char(108),char(101),char(83),char(112),char(114),char(105),char(110),char(103),char(91),char(52),char(93),char(0),char(109),char(95),char(108),char(105), +char(110),char(101),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(76), +char(105),char(109),char(105),char(116),char(101),char(100),char(91),char(52),char(93),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114),char(83),char(112), +char(114),char(105),char(110),char(103),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(76),char(105),char(109),char(105),char(116),char(101),char(100),char(91),char(52), +char(93),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(66),char(111),char(117),char(110),char(99),char(101),char(0),char(109),char(95), +char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(83),char(116),char(111),char(112),char(69),char(82),char(80),char(0),char(109),char(95),char(97),char(110),char(103), +char(117),char(108),char(97),char(114),char(83),char(116),char(111),char(112),char(67),char(70),char(77),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97), +char(114),char(77),char(111),char(116),char(111),char(114),char(69),char(82),char(80),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(77), +char(111),char(116),char(111),char(114),char(67),char(70),char(77),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(84),char(97),char(114), +char(103),char(101),char(116),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97), +char(114),char(77),char(97),char(120),char(77),char(111),char(116),char(111),char(114),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(97),char(110),char(103), +char(117),char(108),char(97),char(114),char(83),char(101),char(114),char(118),char(111),char(84),char(97),char(114),char(103),char(101),char(116),char(0),char(109),char(95),char(97),char(110), +char(103),char(117),char(108),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115), +char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(68),char(97),char(109),char(112), +char(105),char(110),char(103),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(69),char(113),char(117),char(105),char(108),char(105),char(98), +char(114),char(105),char(117),char(109),char(80),char(111),char(105),char(110),char(116),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(69), +char(110),char(97),char(98),char(108),char(101),char(77),char(111),char(116),char(111),char(114),char(91),char(52),char(93),char(0),char(109),char(95),char(97),char(110),char(103),char(117), +char(108),char(97),char(114),char(83),char(101),char(114),char(118),char(111),char(77),char(111),char(116),char(111),char(114),char(91),char(52),char(93),char(0),char(109),char(95),char(97), +char(110),char(103),char(117),char(108),char(97),char(114),char(69),char(110),char(97),char(98),char(108),char(101),char(83),char(112),char(114),char(105),char(110),char(103),char(91),char(52), +char(93),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(83),char(116),char(105), +char(102),char(102),char(110),char(101),char(115),char(115),char(76),char(105),char(109),char(105),char(116),char(101),char(100),char(91),char(52),char(93),char(0),char(109),char(95),char(97), +char(110),char(103),char(117),char(108),char(97),char(114),char(83),char(112),char(114),char(105),char(110),char(103),char(68),char(97),char(109),char(112),char(105),char(110),char(103),char(76), +char(105),char(109),char(105),char(116),char(101),char(100),char(91),char(52),char(93),char(0),char(109),char(95),char(114),char(111),char(116),char(97),char(116),char(101),char(79),char(114), +char(100),char(101),char(114),char(0),char(109),char(95),char(97),char(120),char(105),char(115),char(73),char(110),char(65),char(0),char(109),char(95),char(97),char(120),char(105),char(115), +char(73),char(110),char(66),char(0),char(109),char(95),char(114),char(97),char(116),char(105),char(111),char(0),char(109),char(95),char(108),char(105),char(110),char(101),char(97),char(114), +char(83),char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(97),char(110),char(103),char(117),char(108),char(97),char(114),char(83), +char(116),char(105),char(102),char(102),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(118),char(111),char(108),char(117),char(109),char(101),char(83),char(116),char(105), +char(102),char(102),char(110),char(101),char(115),char(115),char(0),char(42),char(109),char(95),char(109),char(97),char(116),char(101),char(114),char(105),char(97),char(108),char(0),char(109), +char(95),char(112),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(112),char(114),char(101),char(118),char(105),char(111),char(117),char(115), +char(80),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(0),char(109),char(95),char(118),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0), +char(109),char(95),char(97),char(99),char(99),char(117),char(109),char(117),char(108),char(97),char(116),char(101),char(100),char(70),char(111),char(114),char(99),char(101),char(0),char(109), +char(95),char(110),char(111),char(114),char(109),char(97),char(108),char(0),char(109),char(95),char(97),char(114),char(101),char(97),char(0),char(109),char(95),char(97),char(116),char(116), +char(97),char(99),char(104),char(0),char(109),char(95),char(110),char(111),char(100),char(101),char(73),char(110),char(100),char(105),char(99),char(101),char(115),char(91),char(50),char(93), +char(0),char(109),char(95),char(114),char(101),char(115),char(116),char(76),char(101),char(110),char(103),char(116),char(104),char(0),char(109),char(95),char(98),char(98),char(101),char(110), +char(100),char(105),char(110),char(103),char(0),char(109),char(95),char(110),char(111),char(100),char(101),char(73),char(110),char(100),char(105),char(99),char(101),char(115),char(91),char(51), +char(93),char(0),char(109),char(95),char(114),char(101),char(115),char(116),char(65),char(114),char(101),char(97),char(0),char(109),char(95),char(99),char(48),char(91),char(52),char(93), +char(0),char(109),char(95),char(110),char(111),char(100),char(101),char(73),char(110),char(100),char(105),char(99),char(101),char(115),char(91),char(52),char(93),char(0),char(109),char(95), +char(114),char(101),char(115),char(116),char(86),char(111),char(108),char(117),char(109),char(101),char(0),char(109),char(95),char(99),char(49),char(0),char(109),char(95),char(99),char(50), +char(0),char(109),char(95),char(99),char(48),char(0),char(109),char(95),char(108),char(111),char(99),char(97),char(108),char(70),char(114),char(97),char(109),char(101),char(0),char(42), +char(109),char(95),char(114),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121),char(0),char(109),char(95),char(110),char(111),char(100),char(101),char(73),char(110), +char(100),char(101),char(120),char(0),char(109),char(95),char(97),char(101),char(114),char(111),char(77),char(111),char(100),char(101),char(108),char(0),char(109),char(95),char(98),char(97), +char(117),char(109),char(103),char(97),char(114),char(116),char(101),char(0),char(109),char(95),char(100),char(114),char(97),char(103),char(0),char(109),char(95),char(108),char(105),char(102), +char(116),char(0),char(109),char(95),char(112),char(114),char(101),char(115),char(115),char(117),char(114),char(101),char(0),char(109),char(95),char(118),char(111),char(108),char(117),char(109), +char(101),char(0),char(109),char(95),char(100),char(121),char(110),char(97),char(109),char(105),char(99),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0), +char(109),char(95),char(112),char(111),char(115),char(101),char(77),char(97),char(116),char(99),char(104),char(0),char(109),char(95),char(114),char(105),char(103),char(105),char(100),char(67), +char(111),char(110),char(116),char(97),char(99),char(116),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(107),char(105),char(110), +char(101),char(116),char(105),char(99),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115),char(0), +char(109),char(95),char(115),char(111),char(102),char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(72),char(97),char(114),char(100),char(110),char(101),char(115), +char(115),char(0),char(109),char(95),char(97),char(110),char(99),char(104),char(111),char(114),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115),char(0),char(109), +char(95),char(115),char(111),char(102),char(116),char(82),char(105),char(103),char(105),char(100),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(72),char(97),char(114), +char(100),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(115),char(111),char(102),char(116),char(75),char(105),char(110),char(101),char(116),char(105),char(99),char(67), +char(108),char(117),char(115),char(116),char(101),char(114),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115),char(0),char(109),char(95),char(115),char(111),char(102), +char(116),char(83),char(111),char(102),char(116),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(72),char(97),char(114),char(100),char(110),char(101),char(115),char(115), +char(0),char(109),char(95),char(115),char(111),char(102),char(116),char(82),char(105),char(103),char(105),char(100),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(73), +char(109),char(112),char(117),char(108),char(115),char(101),char(83),char(112),char(108),char(105),char(116),char(0),char(109),char(95),char(115),char(111),char(102),char(116),char(75),char(105), +char(110),char(101),char(116),char(105),char(99),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(83), +char(112),char(108),char(105),char(116),char(0),char(109),char(95),char(115),char(111),char(102),char(116),char(83),char(111),char(102),char(116),char(67),char(108),char(117),char(115),char(116), +char(101),char(114),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(83),char(112),char(108),char(105),char(116),char(0),char(109),char(95),char(109),char(97),char(120), +char(86),char(111),char(108),char(117),char(109),char(101),char(0),char(109),char(95),char(116),char(105),char(109),char(101),char(83),char(99),char(97),char(108),char(101),char(0),char(109), +char(95),char(118),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(73),char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115),char(0), +char(109),char(95),char(112),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(73),char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115), +char(0),char(109),char(95),char(100),char(114),char(105),char(102),char(116),char(73),char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115),char(0),char(109), +char(95),char(99),char(108),char(117),char(115),char(116),char(101),char(114),char(73),char(116),char(101),char(114),char(97),char(116),char(105),char(111),char(110),char(115),char(0),char(109), +char(95),char(114),char(111),char(116),char(0),char(109),char(95),char(115),char(99),char(97),char(108),char(101),char(0),char(109),char(95),char(97),char(113),char(113),char(0),char(109), +char(95),char(99),char(111),char(109),char(0),char(42),char(109),char(95),char(112),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(115),char(0),char(42),char(109), +char(95),char(119),char(101),char(105),char(103),char(104),char(116),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(80),char(111),char(115),char(105),char(116),char(105), +char(111),char(110),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(87),char(101),char(105),char(103),char(116),char(115),char(0),char(109),char(95),char(98),char(118), +char(111),char(108),char(117),char(109),char(101),char(0),char(109),char(95),char(98),char(102),char(114),char(97),char(109),char(101),char(0),char(109),char(95),char(102),char(114),char(97), +char(109),char(101),char(120),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(108),char(111),char(99),char(105),char(105),char(0),char(109),char(95),char(105),char(110), +char(118),char(119),char(105),char(0),char(109),char(95),char(118),char(105),char(109),char(112),char(117),char(108),char(115),char(101),char(115),char(91),char(50),char(93),char(0),char(109), +char(95),char(100),char(105),char(109),char(112),char(117),char(108),char(115),char(101),char(115),char(91),char(50),char(93),char(0),char(109),char(95),char(108),char(118),char(0),char(109), +char(95),char(97),char(118),char(0),char(42),char(109),char(95),char(102),char(114),char(97),char(109),char(101),char(114),char(101),char(102),char(115),char(0),char(42),char(109),char(95), +char(110),char(111),char(100),char(101),char(73),char(110),char(100),char(105),char(99),char(101),char(115),char(0),char(42),char(109),char(95),char(109),char(97),char(115),char(115),char(101), +char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(70),char(114),char(97),char(109),char(101),char(82),char(101),char(102),char(115),char(0),char(109),char(95),char(110), +char(117),char(109),char(78),char(111),char(100),char(101),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(77),char(97),char(115),char(115),char(101),char(115),char(0), +char(109),char(95),char(105),char(100),char(109),char(97),char(115),char(115),char(0),char(109),char(95),char(105),char(109),char(97),char(115),char(115),char(0),char(109),char(95),char(110), +char(118),char(105),char(109),char(112),char(117),char(108),char(115),char(101),char(115),char(0),char(109),char(95),char(110),char(100),char(105),char(109),char(112),char(117),char(108),char(115), +char(101),char(115),char(0),char(109),char(95),char(110),char(100),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(108),char(100),char(97),char(109), +char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(97),char(100),char(97),char(109),char(112),char(105),char(110),char(103),char(0),char(109),char(95),char(109),char(97), +char(116),char(99),char(104),char(105),char(110),char(103),char(0),char(109),char(95),char(109),char(97),char(120),char(83),char(101),char(108),char(102),char(67),char(111),char(108),char(108), +char(105),char(115),char(105),char(111),char(110),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(0),char(109),char(95),char(115),char(101),char(108),char(102),char(67), +char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(73),char(109),char(112),char(117),char(108),char(115),char(101),char(70),char(97),char(99),char(116),char(111), +char(114),char(0),char(109),char(95),char(99),char(111),char(110),char(116),char(97),char(105),char(110),char(115),char(65),char(110),char(99),char(104),char(111),char(114),char(0),char(109), +char(95),char(99),char(111),char(108),char(108),char(105),char(100),char(101),char(0),char(109),char(95),char(99),char(108),char(117),char(115),char(116),char(101),char(114),char(73),char(110), +char(100),char(101),char(120),char(0),char(42),char(109),char(95),char(98),char(111),char(100),char(121),char(65),char(0),char(42),char(109),char(95),char(98),char(111),char(100),char(121), +char(66),char(0),char(109),char(95),char(114),char(101),char(102),char(115),char(91),char(50),char(93),char(0),char(109),char(95),char(99),char(102),char(109),char(0),char(109),char(95), +char(115),char(112),char(108),char(105),char(116),char(0),char(109),char(95),char(100),char(101),char(108),char(101),char(116),char(101),char(0),char(109),char(95),char(114),char(101),char(108), +char(80),char(111),char(115),char(105),char(116),char(105),char(111),char(110),char(91),char(50),char(93),char(0),char(109),char(95),char(98),char(111),char(100),char(121),char(65),char(116), +char(121),char(112),char(101),char(0),char(109),char(95),char(98),char(111),char(100),char(121),char(66),char(116),char(121),char(112),char(101),char(0),char(109),char(95),char(106),char(111), +char(105),char(110),char(116),char(84),char(121),char(112),char(101),char(0),char(42),char(109),char(95),char(112),char(111),char(115),char(101),char(0),char(42),char(42),char(109),char(95), +char(109),char(97),char(116),char(101),char(114),char(105),char(97),char(108),char(115),char(0),char(42),char(109),char(95),char(110),char(111),char(100),char(101),char(115),char(0),char(42), +char(109),char(95),char(108),char(105),char(110),char(107),char(115),char(0),char(42),char(109),char(95),char(102),char(97),char(99),char(101),char(115),char(0),char(42),char(109),char(95), +char(116),char(101),char(116),char(114),char(97),char(104),char(101),char(100),char(114),char(97),char(0),char(42),char(109),char(95),char(97),char(110),char(99),char(104),char(111),char(114), +char(115),char(0),char(42),char(109),char(95),char(99),char(108),char(117),char(115),char(116),char(101),char(114),char(115),char(0),char(42),char(109),char(95),char(106),char(111),char(105), +char(110),char(116),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(77),char(97),char(116),char(101),char(114),char(105),char(97),char(108),char(115),char(0),char(109), +char(95),char(110),char(117),char(109),char(76),char(105),char(110),char(107),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(70),char(97),char(99),char(101),char(115), +char(0),char(109),char(95),char(110),char(117),char(109),char(84),char(101),char(116),char(114),char(97),char(104),char(101),char(100),char(114),char(97),char(0),char(109),char(95),char(110), +char(117),char(109),char(65),char(110),char(99),char(104),char(111),char(114),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(67),char(108),char(117),char(115),char(116), +char(101),char(114),char(115),char(0),char(109),char(95),char(110),char(117),char(109),char(74),char(111),char(105),char(110),char(116),char(115),char(0),char(109),char(95),char(99),char(111), +char(110),char(102),char(105),char(103),char(0),char(109),char(95),char(122),char(101),char(114),char(111),char(82),char(111),char(116),char(80),char(97),char(114),char(101),char(110),char(116), +char(84),char(111),char(84),char(104),char(105),char(115),char(0),char(109),char(95),char(112),char(97),char(114),char(101),char(110),char(116),char(67),char(111),char(109),char(84),char(111), +char(84),char(104),char(105),char(115),char(67),char(111),char(109),char(79),char(102),char(102),char(115),char(101),char(116),char(0),char(109),char(95),char(116),char(104),char(105),char(115), +char(80),char(105),char(118),char(111),char(116),char(84),char(111),char(84),char(104),char(105),char(115),char(67),char(111),char(109),char(79),char(102),char(102),char(115),char(101),char(116), +char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(65),char(120),char(105),char(115),char(84),char(111),char(112),char(91),char(54),char(93),char(0),char(109), +char(95),char(106),char(111),char(105),char(110),char(116),char(65),char(120),char(105),char(115),char(66),char(111),char(116),char(116),char(111),char(109),char(91),char(54),char(93),char(0), +char(109),char(95),char(108),char(105),char(110),char(107),char(73),char(110),char(101),char(114),char(116),char(105),char(97),char(0),char(109),char(95),char(108),char(105),char(110),char(107), +char(77),char(97),char(115),char(115),char(0),char(109),char(95),char(112),char(97),char(114),char(101),char(110),char(116),char(73),char(110),char(100),char(101),char(120),char(0),char(109), +char(95),char(100),char(111),char(102),char(67),char(111),char(117),char(110),char(116),char(0),char(109),char(95),char(112),char(111),char(115),char(86),char(97),char(114),char(67),char(111), +char(117),char(110),char(116),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(80),char(111),char(115),char(91),char(55),char(93),char(0),char(109),char(95), +char(106),char(111),char(105),char(110),char(116),char(86),char(101),char(108),char(91),char(54),char(93),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(84), +char(111),char(114),char(113),char(117),char(101),char(91),char(54),char(93),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(68),char(97),char(109),char(112), +char(105),char(110),char(103),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(70),char(114),char(105),char(99),char(116),char(105),char(111),char(110),char(0), +char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(76),char(111),char(119),char(101),char(114),char(76),char(105),char(109),char(105),char(116),char(0),char(109),char(95), +char(106),char(111),char(105),char(110),char(116),char(85),char(112),char(112),char(101),char(114),char(76),char(105),char(109),char(105),char(116),char(0),char(109),char(95),char(106),char(111), +char(105),char(110),char(116),char(77),char(97),char(120),char(70),char(111),char(114),char(99),char(101),char(0),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(77), +char(97),char(120),char(86),char(101),char(108),char(111),char(99),char(105),char(116),char(121),char(0),char(42),char(109),char(95),char(108),char(105),char(110),char(107),char(78),char(97), +char(109),char(101),char(0),char(42),char(109),char(95),char(106),char(111),char(105),char(110),char(116),char(78),char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(108), +char(105),char(110),char(107),char(67),char(111),char(108),char(108),char(105),char(100),char(101),char(114),char(0),char(42),char(109),char(95),char(112),char(97),char(100),char(100),char(105), +char(110),char(103),char(80),char(116),char(114),char(0),char(109),char(95),char(98),char(97),char(115),char(101),char(87),char(111),char(114),char(108),char(100),char(84),char(114),char(97), +char(110),char(115),char(102),char(111),char(114),char(109),char(0),char(109),char(95),char(98),char(97),char(115),char(101),char(73),char(110),char(101),char(114),char(116),char(105),char(97), +char(0),char(109),char(95),char(98),char(97),char(115),char(101),char(77),char(97),char(115),char(115),char(0),char(42),char(109),char(95),char(98),char(97),char(115),char(101),char(78), +char(97),char(109),char(101),char(0),char(42),char(109),char(95),char(98),char(97),char(115),char(101),char(67),char(111),char(108),char(108),char(105),char(100),char(101),char(114),char(0), +char(84),char(89),char(80),char(69),char(95),char(0),char(0),char(0),char(99),char(104),char(97),char(114),char(0),char(117),char(99),char(104),char(97),char(114),char(0),char(115), +char(104),char(111),char(114),char(116),char(0),char(117),char(115),char(104),char(111),char(114),char(116),char(0),char(105),char(110),char(116),char(0),char(108),char(111),char(110),char(103), +char(0),char(117),char(108),char(111),char(110),char(103),char(0),char(102),char(108),char(111),char(97),char(116),char(0),char(100),char(111),char(117),char(98),char(108),char(101),char(0), +char(118),char(111),char(105),char(100),char(0),char(80),char(111),char(105),char(110),char(116),char(101),char(114),char(65),char(114),char(114),char(97),char(121),char(0),char(98),char(116), +char(80),char(104),char(121),char(115),char(105),char(99),char(115),char(83),char(121),char(115),char(116),char(101),char(109),char(0),char(76),char(105),char(115),char(116),char(66),char(97), +char(115),char(101),char(0),char(98),char(116),char(86),char(101),char(99),char(116),char(111),char(114),char(51),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116), +char(97),char(0),char(98),char(116),char(86),char(101),char(99),char(116),char(111),char(114),char(51),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116), +char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(116),char(101),char(114),char(110),char(105),char(111),char(110),char(70),char(108),char(111),char(97),char(116),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(116),char(101),char(114),char(110),char(105),char(111),char(110),char(68),char(111),char(117),char(98), +char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(97),char(116),char(114),char(105),char(120),char(51),char(120),char(51),char(70),char(108), +char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(97),char(116),char(114),char(105),char(120),char(51),char(120),char(51),char(68), +char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(97),char(110),char(115),char(102),char(111),char(114), +char(109),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(97),char(110),char(115),char(102),char(111), +char(114),char(109),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(66),char(118),char(104),char(83),char(117), +char(98),char(116),char(114),char(101),char(101),char(73),char(110),char(102),char(111),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(79),char(112),char(116),char(105), +char(109),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100),char(101),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116), +char(97),char(0),char(98),char(116),char(79),char(112),char(116),char(105),char(109),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100),char(101), +char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110),char(116),char(105),char(122), +char(101),char(100),char(66),char(118),char(104),char(78),char(111),char(100),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(81),char(117),char(97),char(110), +char(116),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116), +char(81),char(117),char(97),char(110),char(116),char(105),char(122),char(101),char(100),char(66),char(118),char(104),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97), +char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(83),char(104),char(97),char(112),char(101),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(116),char(97),char(116),char(105),char(99),char(80),char(108),char(97),char(110),char(101),char(83),char(104),char(97), +char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(118),char(101),char(120),char(73),char(110),char(116),char(101),char(114), +char(110),char(97),char(108),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(115),char(105),char(116), +char(105),char(111),char(110),char(65),char(110),char(100),char(82),char(97),char(100),char(105),char(117),char(115),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105), +char(83),char(112),char(104),char(101),char(114),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(73),char(110), +char(116),char(73),char(110),char(100),char(101),char(120),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(104),char(111),char(114),char(116),char(73),char(110), +char(116),char(73),char(110),char(100),char(101),char(120),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(104),char(111),char(114),char(116),char(73),char(110), +char(116),char(73),char(110),char(100),char(101),char(120),char(84),char(114),char(105),char(112),char(108),char(101),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116), +char(67),char(104),char(97),char(114),char(73),char(110),char(100),char(101),char(120),char(84),char(114),char(105),char(112),char(108),char(101),char(116),char(68),char(97),char(116),char(97), +char(0),char(98),char(116),char(77),char(101),char(115),char(104),char(80),char(97),char(114),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(116), +char(114),char(105),char(100),char(105),char(110),char(103),char(77),char(101),char(115),char(104),char(73),char(110),char(116),char(101),char(114),char(102),char(97),char(99),char(101),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(77),char(101),char(115),char(104),char(83),char(104), +char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110), +char(102),char(111),char(77),char(97),char(112),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(99),char(97),char(108),char(101),char(100),char(84),char(114), +char(105),char(97),char(110),char(103),char(108),char(101),char(77),char(101),char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0), +char(98),char(116),char(67),char(111),char(109),char(112),char(111),char(117),char(110),char(100),char(83),char(104),char(97),char(112),char(101),char(67),char(104),char(105),char(108),char(100), +char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(109),char(112),char(111),char(117),char(110),char(100),char(83),char(104),char(97),char(112),char(101), +char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(121),char(108),char(105),char(110),char(100),char(101),char(114),char(83),char(104),char(97),char(112),char(101), +char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97), +char(0),char(98),char(116),char(67),char(97),char(112),char(115),char(117),char(108),char(101),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116),char(97),char(0), +char(98),char(116),char(84),char(114),char(105),char(97),char(110),char(103),char(108),char(101),char(73),char(110),char(102),char(111),char(68),char(97),char(116),char(97),char(0),char(98), +char(116),char(71),char(73),char(109),char(112),char(97),char(99),char(116),char(77),char(101),char(115),char(104),char(83),char(104),char(97),char(112),char(101),char(68),char(97),char(116), +char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(118),char(101),char(120),char(72),char(117),char(108),char(108),char(83),char(104),char(97),char(112),char(101),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(108),char(108),char(105),char(115),char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99), +char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(108),char(108),char(105),char(115), +char(105),char(111),char(110),char(79),char(98),char(106),char(101),char(99),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98), +char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(83),char(111),char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111),char(68),char(111), +char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(116),char(97),char(99),char(116),char(83),char(111), +char(108),char(118),char(101),char(114),char(73),char(110),char(102),char(111),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116), +char(68),char(121),char(110),char(97),char(109),char(105),char(99),char(115),char(87),char(111),char(114),char(108),char(100),char(68),char(111),char(117),char(98),char(108),char(101),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(68),char(121),char(110),char(97),char(109),char(105),char(99),char(115),char(87),char(111),char(114),char(108),char(100),char(70), +char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121), +char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100), +char(121),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(67),char(111),char(110),char(115),char(116),char(114), +char(97),char(105),char(110),char(116),char(73),char(110),char(102),char(111),char(49),char(0),char(98),char(116),char(84),char(121),char(112),char(101),char(100),char(67),char(111),char(110), +char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84), +char(121),char(112),char(101),char(100),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98), +char(116),char(82),char(105),char(103),char(105),char(100),char(66),char(111),char(100),char(121),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(84),char(121),char(112), +char(101),char(100),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97), +char(116),char(97),char(0),char(98),char(116),char(80),char(111),char(105),char(110),char(116),char(50),char(80),char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115), +char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(80),char(111), +char(105),char(110),char(116),char(50),char(80),char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68), +char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(80),char(111),char(105),char(110),char(116),char(50),char(80), +char(111),char(105),char(110),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101), +char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(72),char(105),char(110),char(103),char(101),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), +char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(72),char(105),char(110),char(103),char(101), +char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0), +char(98),char(116),char(72),char(105),char(110),char(103),char(101),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117), +char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(84),char(119),char(105),char(115),char(116), +char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97), +char(0),char(98),char(116),char(67),char(111),char(110),char(101),char(84),char(119),char(105),char(115),char(116),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105), +char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102), +char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110), +char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111), +char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54), +char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114), +char(105),char(110),char(103),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68), +char(97),char(116),char(97),char(50),char(0),char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112), +char(114),char(105),char(110),char(103),char(50),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0), +char(98),char(116),char(71),char(101),char(110),char(101),char(114),char(105),char(99),char(54),char(68),char(111),char(102),char(83),char(112),char(114),char(105),char(110),char(103),char(50), +char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97), +char(50),char(0),char(98),char(116),char(83),char(108),char(105),char(100),char(101),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116), +char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(108),char(105),char(100),char(101),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97), +char(105),char(110),char(116),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(71),char(101),char(97),char(114), +char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0), +char(98),char(116),char(71),char(101),char(97),char(114),char(67),char(111),char(110),char(115),char(116),char(114),char(97),char(105),char(110),char(116),char(68),char(111),char(117),char(98), +char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(77),char(97),char(116),char(101),char(114), +char(105),char(97),char(108),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(78),char(111),char(100),char(101), +char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107),char(68),char(97),char(116), +char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(70),char(97),char(99),char(101),char(68),char(97),char(116),char(97),char(0),char(83), +char(111),char(102),char(116),char(66),char(111),char(100),char(121),char(84),char(101),char(116),char(114),char(97),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102), +char(116),char(82),char(105),char(103),char(105),char(100),char(65),char(110),char(99),char(104),char(111),char(114),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102), +char(116),char(66),char(111),char(100),char(121),char(67),char(111),char(110),char(102),char(105),char(103),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116), +char(66),char(111),char(100),char(121),char(80),char(111),char(115),char(101),char(68),char(97),char(116),char(97),char(0),char(83),char(111),char(102),char(116),char(66),char(111),char(100), +char(121),char(67),char(108),char(117),char(115),char(116),char(101),char(114),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(111),char(102),char(116),char(66), +char(111),char(100),char(121),char(74),char(111),char(105),char(110),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(83),char(111),char(102),char(116),char(66), +char(111),char(100),char(121),char(70),char(108),char(111),char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105), +char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107),char(68),char(111),char(117),char(98),char(108),char(101),char(68),char(97),char(116),char(97),char(0),char(98), +char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(76),char(105),char(110),char(107),char(70),char(108),char(111),char(97),char(116),char(68), +char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(68),char(111),char(117),char(98),char(108), +char(101),char(68),char(97),char(116),char(97),char(0),char(98),char(116),char(77),char(117),char(108),char(116),char(105),char(66),char(111),char(100),char(121),char(70),char(108),char(111), +char(97),char(116),char(68),char(97),char(116),char(97),char(0),char(0),char(84),char(76),char(69),char(78),char(1),char(0),char(1),char(0),char(2),char(0),char(2),char(0), +char(4),char(0),char(4),char(0),char(4),char(0),char(4),char(0),char(8),char(0),char(0),char(0),char(16),char(0),char(48),char(0),char(16),char(0),char(16),char(0), +char(32),char(0),char(16),char(0),char(32),char(0),char(48),char(0),char(96),char(0),char(64),char(0),char(-128),char(0),char(20),char(0),char(48),char(0),char(80),char(0), +char(16),char(0),char(96),char(0),char(-112),char(0),char(16),char(0),char(56),char(0),char(56),char(0),char(20),char(0),char(72),char(0),char(4),char(0),char(4),char(0), +char(8),char(0),char(4),char(0),char(56),char(0),char(32),char(0),char(80),char(0),char(72),char(0),char(96),char(0),char(80),char(0),char(32),char(0),char(64),char(0), +char(64),char(0),char(64),char(0),char(16),char(0),char(72),char(0),char(80),char(0),char(-16),char(1),char(24),char(1),char(-104),char(0),char(88),char(0),char(-72),char(0), +char(104),char(0),char(0),char(2),char(-64),char(3),char(8),char(0),char(64),char(0),char(64),char(0),char(0),char(0),char(80),char(0),char(96),char(0),char(-112),char(0), +char(-128),char(0),char(104),char(1),char(-24),char(0),char(-104),char(1),char(-120),char(1),char(-32),char(0),char(8),char(1),char(-40),char(1),char(104),char(1),char(-128),char(2), +char(-112),char(2),char(-64),char(4),char(-40),char(0),char(120),char(1),char(104),char(0),char(-104),char(0),char(16),char(0),char(104),char(0),char(24),char(0),char(40),char(0), +char(104),char(0),char(96),char(0),char(104),char(0),char(-56),char(0),char(104),char(1),char(112),char(0),char(-24),char(1),char(0),char(3),char(-104),char(1),char(-48),char(0), +char(112),char(0),char(0),char(0),char(83),char(84),char(82),char(67),char(84),char(0),char(0),char(0),char(10),char(0),char(3),char(0),char(4),char(0),char(0),char(0), +char(4),char(0),char(1),char(0),char(9),char(0),char(2),char(0),char(11),char(0),char(3),char(0),char(10),char(0),char(3),char(0),char(10),char(0),char(4),char(0), +char(10),char(0),char(5),char(0),char(12),char(0),char(2),char(0),char(9),char(0),char(6),char(0),char(9),char(0),char(7),char(0),char(13),char(0),char(1),char(0), +char(7),char(0),char(8),char(0),char(14),char(0),char(1),char(0),char(8),char(0),char(8),char(0),char(15),char(0),char(1),char(0),char(7),char(0),char(8),char(0), +char(16),char(0),char(1),char(0),char(8),char(0),char(8),char(0),char(17),char(0),char(1),char(0),char(13),char(0),char(9),char(0),char(18),char(0),char(1),char(0), +char(14),char(0),char(9),char(0),char(19),char(0),char(2),char(0),char(17),char(0),char(10),char(0),char(13),char(0),char(11),char(0),char(20),char(0),char(2),char(0), +char(18),char(0),char(10),char(0),char(14),char(0),char(11),char(0),char(21),char(0),char(4),char(0),char(4),char(0),char(12),char(0),char(4),char(0),char(13),char(0), +char(2),char(0),char(14),char(0),char(2),char(0),char(15),char(0),char(22),char(0),char(6),char(0),char(13),char(0),char(16),char(0),char(13),char(0),char(17),char(0), +char(4),char(0),char(18),char(0),char(4),char(0),char(19),char(0),char(4),char(0),char(20),char(0),char(0),char(0),char(21),char(0),char(23),char(0),char(6),char(0), +char(14),char(0),char(16),char(0),char(14),char(0),char(17),char(0),char(4),char(0),char(18),char(0),char(4),char(0),char(19),char(0),char(4),char(0),char(20),char(0), +char(0),char(0),char(21),char(0),char(24),char(0),char(3),char(0),char(2),char(0),char(14),char(0),char(2),char(0),char(15),char(0),char(4),char(0),char(22),char(0), +char(25),char(0),char(12),char(0),char(13),char(0),char(23),char(0),char(13),char(0),char(24),char(0),char(13),char(0),char(25),char(0),char(4),char(0),char(26),char(0), +char(4),char(0),char(27),char(0),char(4),char(0),char(28),char(0),char(4),char(0),char(29),char(0),char(22),char(0),char(30),char(0),char(24),char(0),char(31),char(0), +char(21),char(0),char(32),char(0),char(4),char(0),char(33),char(0),char(4),char(0),char(34),char(0),char(26),char(0),char(12),char(0),char(14),char(0),char(23),char(0), +char(14),char(0),char(24),char(0),char(14),char(0),char(25),char(0),char(4),char(0),char(26),char(0),char(4),char(0),char(27),char(0),char(4),char(0),char(28),char(0), +char(4),char(0),char(29),char(0),char(23),char(0),char(30),char(0),char(24),char(0),char(31),char(0),char(4),char(0),char(33),char(0),char(4),char(0),char(34),char(0), +char(21),char(0),char(32),char(0),char(27),char(0),char(3),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(36),char(0),char(0),char(0),char(37),char(0), +char(28),char(0),char(5),char(0),char(27),char(0),char(38),char(0),char(13),char(0),char(39),char(0),char(13),char(0),char(40),char(0),char(7),char(0),char(41),char(0), +char(0),char(0),char(21),char(0),char(29),char(0),char(5),char(0),char(27),char(0),char(38),char(0),char(13),char(0),char(39),char(0),char(13),char(0),char(42),char(0), +char(7),char(0),char(43),char(0),char(4),char(0),char(44),char(0),char(30),char(0),char(2),char(0),char(13),char(0),char(45),char(0),char(7),char(0),char(46),char(0), +char(31),char(0),char(4),char(0),char(29),char(0),char(47),char(0),char(30),char(0),char(48),char(0),char(4),char(0),char(49),char(0),char(0),char(0),char(37),char(0), +char(32),char(0),char(1),char(0),char(4),char(0),char(50),char(0),char(33),char(0),char(2),char(0),char(2),char(0),char(50),char(0),char(0),char(0),char(51),char(0), +char(34),char(0),char(2),char(0),char(2),char(0),char(52),char(0),char(0),char(0),char(51),char(0),char(35),char(0),char(2),char(0),char(0),char(0),char(52),char(0), +char(0),char(0),char(53),char(0),char(36),char(0),char(8),char(0),char(13),char(0),char(54),char(0),char(14),char(0),char(55),char(0),char(32),char(0),char(56),char(0), +char(34),char(0),char(57),char(0),char(35),char(0),char(58),char(0),char(33),char(0),char(59),char(0),char(4),char(0),char(60),char(0),char(4),char(0),char(61),char(0), +char(37),char(0),char(4),char(0),char(36),char(0),char(62),char(0),char(13),char(0),char(63),char(0),char(4),char(0),char(64),char(0),char(0),char(0),char(37),char(0), +char(38),char(0),char(7),char(0),char(27),char(0),char(38),char(0),char(37),char(0),char(65),char(0),char(25),char(0),char(66),char(0),char(26),char(0),char(67),char(0), +char(39),char(0),char(68),char(0),char(7),char(0),char(43),char(0),char(0),char(0),char(69),char(0),char(40),char(0),char(2),char(0),char(38),char(0),char(70),char(0), +char(13),char(0),char(39),char(0),char(41),char(0),char(4),char(0),char(19),char(0),char(71),char(0),char(27),char(0),char(72),char(0),char(4),char(0),char(73),char(0), +char(7),char(0),char(74),char(0),char(42),char(0),char(4),char(0),char(27),char(0),char(38),char(0),char(41),char(0),char(75),char(0),char(4),char(0),char(76),char(0), +char(7),char(0),char(43),char(0),char(43),char(0),char(3),char(0),char(29),char(0),char(47),char(0),char(4),char(0),char(77),char(0),char(0),char(0),char(37),char(0), +char(44),char(0),char(3),char(0),char(29),char(0),char(47),char(0),char(4),char(0),char(78),char(0),char(0),char(0),char(37),char(0),char(45),char(0),char(3),char(0), +char(29),char(0),char(47),char(0),char(4),char(0),char(77),char(0),char(0),char(0),char(37),char(0),char(46),char(0),char(4),char(0),char(4),char(0),char(79),char(0), +char(7),char(0),char(80),char(0),char(7),char(0),char(81),char(0),char(7),char(0),char(82),char(0),char(39),char(0),char(14),char(0),char(4),char(0),char(83),char(0), +char(4),char(0),char(84),char(0),char(46),char(0),char(85),char(0),char(4),char(0),char(86),char(0),char(7),char(0),char(87),char(0),char(7),char(0),char(88),char(0), +char(7),char(0),char(89),char(0),char(7),char(0),char(90),char(0),char(7),char(0),char(91),char(0),char(4),char(0),char(92),char(0),char(4),char(0),char(93),char(0), +char(4),char(0),char(94),char(0),char(4),char(0),char(95),char(0),char(0),char(0),char(37),char(0),char(47),char(0),char(5),char(0),char(27),char(0),char(38),char(0), +char(37),char(0),char(65),char(0),char(13),char(0),char(39),char(0),char(7),char(0),char(43),char(0),char(4),char(0),char(96),char(0),char(48),char(0),char(5),char(0), +char(29),char(0),char(47),char(0),char(13),char(0),char(97),char(0),char(14),char(0),char(98),char(0),char(4),char(0),char(99),char(0),char(0),char(0),char(100),char(0), +char(49),char(0),char(27),char(0),char(9),char(0),char(101),char(0),char(9),char(0),char(102),char(0),char(27),char(0),char(103),char(0),char(0),char(0),char(35),char(0), +char(20),char(0),char(104),char(0),char(20),char(0),char(105),char(0),char(14),char(0),char(106),char(0),char(14),char(0),char(107),char(0),char(14),char(0),char(108),char(0), +char(8),char(0),char(109),char(0),char(8),char(0),char(110),char(0),char(8),char(0),char(111),char(0),char(8),char(0),char(112),char(0),char(8),char(0),char(113),char(0), +char(8),char(0),char(114),char(0),char(8),char(0),char(115),char(0),char(8),char(0),char(116),char(0),char(8),char(0),char(117),char(0),char(8),char(0),char(118),char(0), +char(4),char(0),char(119),char(0),char(4),char(0),char(120),char(0),char(4),char(0),char(121),char(0),char(4),char(0),char(122),char(0),char(4),char(0),char(123),char(0), +char(4),char(0),char(124),char(0),char(4),char(0),char(125),char(0),char(0),char(0),char(37),char(0),char(50),char(0),char(27),char(0),char(9),char(0),char(101),char(0), +char(9),char(0),char(102),char(0),char(27),char(0),char(103),char(0),char(0),char(0),char(35),char(0),char(19),char(0),char(104),char(0),char(19),char(0),char(105),char(0), +char(13),char(0),char(106),char(0),char(13),char(0),char(107),char(0),char(13),char(0),char(108),char(0),char(7),char(0),char(109),char(0),char(7),char(0),char(110),char(0), +char(7),char(0),char(111),char(0),char(7),char(0),char(112),char(0),char(7),char(0),char(113),char(0),char(7),char(0),char(114),char(0),char(7),char(0),char(115),char(0), +char(7),char(0),char(116),char(0),char(7),char(0),char(117),char(0),char(7),char(0),char(118),char(0),char(4),char(0),char(119),char(0),char(4),char(0),char(120),char(0), +char(4),char(0),char(121),char(0),char(4),char(0),char(122),char(0),char(4),char(0),char(123),char(0),char(4),char(0),char(124),char(0),char(4),char(0),char(125),char(0), +char(0),char(0),char(37),char(0),char(51),char(0),char(22),char(0),char(8),char(0),char(126),char(0),char(8),char(0),char(127),char(0),char(8),char(0),char(111),char(0), +char(8),char(0),char(-128),char(0),char(8),char(0),char(115),char(0),char(8),char(0),char(-127),char(0),char(8),char(0),char(-126),char(0),char(8),char(0),char(-125),char(0), +char(8),char(0),char(-124),char(0),char(8),char(0),char(-123),char(0),char(8),char(0),char(-122),char(0),char(8),char(0),char(-121),char(0),char(8),char(0),char(-120),char(0), +char(8),char(0),char(-119),char(0),char(8),char(0),char(-118),char(0),char(8),char(0),char(-117),char(0),char(4),char(0),char(-116),char(0),char(4),char(0),char(-115),char(0), +char(4),char(0),char(-114),char(0),char(4),char(0),char(-113),char(0),char(4),char(0),char(-112),char(0),char(0),char(0),char(37),char(0),char(52),char(0),char(22),char(0), +char(7),char(0),char(126),char(0),char(7),char(0),char(127),char(0),char(7),char(0),char(111),char(0),char(7),char(0),char(-128),char(0),char(7),char(0),char(115),char(0), +char(7),char(0),char(-127),char(0),char(7),char(0),char(-126),char(0),char(7),char(0),char(-125),char(0),char(7),char(0),char(-124),char(0),char(7),char(0),char(-123),char(0), +char(7),char(0),char(-122),char(0),char(7),char(0),char(-121),char(0),char(7),char(0),char(-120),char(0),char(7),char(0),char(-119),char(0),char(7),char(0),char(-118),char(0), +char(7),char(0),char(-117),char(0),char(4),char(0),char(-116),char(0),char(4),char(0),char(-115),char(0),char(4),char(0),char(-114),char(0),char(4),char(0),char(-113),char(0), +char(4),char(0),char(-112),char(0),char(0),char(0),char(37),char(0),char(53),char(0),char(2),char(0),char(51),char(0),char(-111),char(0),char(14),char(0),char(-110),char(0), +char(54),char(0),char(2),char(0),char(52),char(0),char(-111),char(0),char(13),char(0),char(-110),char(0),char(55),char(0),char(21),char(0),char(50),char(0),char(-109),char(0), +char(17),char(0),char(-108),char(0),char(13),char(0),char(-107),char(0),char(13),char(0),char(-106),char(0),char(13),char(0),char(-105),char(0),char(13),char(0),char(-104),char(0), +char(13),char(0),char(-110),char(0),char(13),char(0),char(-103),char(0),char(13),char(0),char(-102),char(0),char(13),char(0),char(-101),char(0),char(13),char(0),char(-100),char(0), +char(7),char(0),char(-99),char(0),char(7),char(0),char(-98),char(0),char(7),char(0),char(-97),char(0),char(7),char(0),char(-96),char(0),char(7),char(0),char(-95),char(0), +char(7),char(0),char(-94),char(0),char(7),char(0),char(-93),char(0),char(7),char(0),char(-92),char(0),char(7),char(0),char(-91),char(0),char(4),char(0),char(-90),char(0), +char(56),char(0),char(22),char(0),char(49),char(0),char(-109),char(0),char(18),char(0),char(-108),char(0),char(14),char(0),char(-107),char(0),char(14),char(0),char(-106),char(0), +char(14),char(0),char(-105),char(0),char(14),char(0),char(-104),char(0),char(14),char(0),char(-110),char(0),char(14),char(0),char(-103),char(0),char(14),char(0),char(-102),char(0), +char(14),char(0),char(-101),char(0),char(14),char(0),char(-100),char(0),char(8),char(0),char(-99),char(0),char(8),char(0),char(-98),char(0),char(8),char(0),char(-97),char(0), +char(8),char(0),char(-96),char(0),char(8),char(0),char(-95),char(0),char(8),char(0),char(-94),char(0),char(8),char(0),char(-93),char(0),char(8),char(0),char(-92),char(0), +char(8),char(0),char(-91),char(0),char(4),char(0),char(-90),char(0),char(0),char(0),char(37),char(0),char(57),char(0),char(2),char(0),char(4),char(0),char(-89),char(0), +char(4),char(0),char(-88),char(0),char(58),char(0),char(13),char(0),char(55),char(0),char(-87),char(0),char(55),char(0),char(-86),char(0),char(0),char(0),char(35),char(0), +char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0),char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0),char(7),char(0),char(-81),char(0), +char(7),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0),char(4),char(0),char(-78),char(0),char(7),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0), +char(59),char(0),char(13),char(0),char(60),char(0),char(-87),char(0),char(60),char(0),char(-86),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0), +char(4),char(0),char(-84),char(0),char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0),char(7),char(0),char(-81),char(0),char(7),char(0),char(-80),char(0), +char(4),char(0),char(-79),char(0),char(4),char(0),char(-78),char(0),char(7),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0),char(61),char(0),char(14),char(0), +char(56),char(0),char(-87),char(0),char(56),char(0),char(-86),char(0),char(0),char(0),char(35),char(0),char(4),char(0),char(-85),char(0),char(4),char(0),char(-84),char(0), +char(4),char(0),char(-83),char(0),char(4),char(0),char(-82),char(0),char(8),char(0),char(-81),char(0),char(8),char(0),char(-80),char(0),char(4),char(0),char(-79),char(0), +char(4),char(0),char(-78),char(0),char(8),char(0),char(-77),char(0),char(4),char(0),char(-76),char(0),char(0),char(0),char(-75),char(0),char(62),char(0),char(3),char(0), +char(59),char(0),char(-74),char(0),char(13),char(0),char(-73),char(0),char(13),char(0),char(-72),char(0),char(63),char(0),char(3),char(0),char(61),char(0),char(-74),char(0), +char(14),char(0),char(-73),char(0),char(14),char(0),char(-72),char(0),char(64),char(0),char(3),char(0),char(59),char(0),char(-74),char(0),char(14),char(0),char(-73),char(0), +char(14),char(0),char(-72),char(0),char(65),char(0),char(13),char(0),char(59),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0), +char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0),char(4),char(0),char(-67),char(0),char(7),char(0),char(-66),char(0),char(7),char(0),char(-65),char(0), +char(7),char(0),char(-64),char(0),char(7),char(0),char(-63),char(0),char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0), +char(66),char(0),char(13),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0), +char(4),char(0),char(-68),char(0),char(4),char(0),char(-67),char(0),char(7),char(0),char(-66),char(0),char(7),char(0),char(-65),char(0),char(7),char(0),char(-64),char(0), +char(7),char(0),char(-63),char(0),char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0),char(67),char(0),char(14),char(0), +char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(4),char(0),char(-69),char(0),char(4),char(0),char(-68),char(0), +char(4),char(0),char(-67),char(0),char(8),char(0),char(-66),char(0),char(8),char(0),char(-65),char(0),char(8),char(0),char(-64),char(0),char(8),char(0),char(-63),char(0), +char(8),char(0),char(-62),char(0),char(8),char(0),char(-61),char(0),char(8),char(0),char(-60),char(0),char(0),char(0),char(-59),char(0),char(68),char(0),char(10),char(0), +char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(8),char(0),char(-58),char(0),char(8),char(0),char(-57),char(0), +char(8),char(0),char(-56),char(0),char(8),char(0),char(-62),char(0),char(8),char(0),char(-61),char(0),char(8),char(0),char(-60),char(0),char(8),char(0),char(127),char(0), +char(69),char(0),char(11),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(7),char(0),char(-58),char(0), +char(7),char(0),char(-57),char(0),char(7),char(0),char(-56),char(0),char(7),char(0),char(-62),char(0),char(7),char(0),char(-61),char(0),char(7),char(0),char(-60),char(0), +char(7),char(0),char(127),char(0),char(0),char(0),char(21),char(0),char(70),char(0),char(9),char(0),char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0), +char(19),char(0),char(-70),char(0),char(13),char(0),char(-55),char(0),char(13),char(0),char(-54),char(0),char(13),char(0),char(-53),char(0),char(13),char(0),char(-52),char(0), +char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0),char(71),char(0),char(9),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0), +char(20),char(0),char(-70),char(0),char(14),char(0),char(-55),char(0),char(14),char(0),char(-54),char(0),char(14),char(0),char(-53),char(0),char(14),char(0),char(-52),char(0), +char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0),char(72),char(0),char(5),char(0),char(70),char(0),char(-49),char(0),char(4),char(0),char(-48),char(0), +char(7),char(0),char(-47),char(0),char(7),char(0),char(-46),char(0),char(7),char(0),char(-45),char(0),char(73),char(0),char(5),char(0),char(71),char(0),char(-49),char(0), +char(4),char(0),char(-48),char(0),char(8),char(0),char(-47),char(0),char(8),char(0),char(-46),char(0),char(8),char(0),char(-45),char(0),char(74),char(0),char(41),char(0), +char(59),char(0),char(-74),char(0),char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(13),char(0),char(-55),char(0),char(13),char(0),char(-54),char(0), +char(13),char(0),char(-44),char(0),char(13),char(0),char(-43),char(0),char(13),char(0),char(-42),char(0),char(13),char(0),char(-41),char(0),char(13),char(0),char(-40),char(0), +char(13),char(0),char(-39),char(0),char(13),char(0),char(-38),char(0),char(13),char(0),char(-37),char(0),char(13),char(0),char(-36),char(0),char(13),char(0),char(-35),char(0), +char(13),char(0),char(-34),char(0),char(0),char(0),char(-33),char(0),char(0),char(0),char(-32),char(0),char(0),char(0),char(-31),char(0),char(0),char(0),char(-30),char(0), +char(0),char(0),char(-29),char(0),char(0),char(0),char(-59),char(0),char(13),char(0),char(-53),char(0),char(13),char(0),char(-52),char(0),char(13),char(0),char(-28),char(0), +char(13),char(0),char(-27),char(0),char(13),char(0),char(-26),char(0),char(13),char(0),char(-25),char(0),char(13),char(0),char(-24),char(0),char(13),char(0),char(-23),char(0), +char(13),char(0),char(-22),char(0),char(13),char(0),char(-21),char(0),char(13),char(0),char(-20),char(0),char(13),char(0),char(-19),char(0),char(13),char(0),char(-18),char(0), +char(0),char(0),char(-17),char(0),char(0),char(0),char(-16),char(0),char(0),char(0),char(-15),char(0),char(0),char(0),char(-14),char(0),char(0),char(0),char(-13),char(0), +char(4),char(0),char(-12),char(0),char(75),char(0),char(41),char(0),char(61),char(0),char(-74),char(0),char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0), +char(14),char(0),char(-55),char(0),char(14),char(0),char(-54),char(0),char(14),char(0),char(-44),char(0),char(14),char(0),char(-43),char(0),char(14),char(0),char(-42),char(0), +char(14),char(0),char(-41),char(0),char(14),char(0),char(-40),char(0),char(14),char(0),char(-39),char(0),char(14),char(0),char(-38),char(0),char(14),char(0),char(-37),char(0), +char(14),char(0),char(-36),char(0),char(14),char(0),char(-35),char(0),char(14),char(0),char(-34),char(0),char(0),char(0),char(-33),char(0),char(0),char(0),char(-32),char(0), +char(0),char(0),char(-31),char(0),char(0),char(0),char(-30),char(0),char(0),char(0),char(-29),char(0),char(0),char(0),char(-59),char(0),char(14),char(0),char(-53),char(0), +char(14),char(0),char(-52),char(0),char(14),char(0),char(-28),char(0),char(14),char(0),char(-27),char(0),char(14),char(0),char(-26),char(0),char(14),char(0),char(-25),char(0), +char(14),char(0),char(-24),char(0),char(14),char(0),char(-23),char(0),char(14),char(0),char(-22),char(0),char(14),char(0),char(-21),char(0),char(14),char(0),char(-20),char(0), +char(14),char(0),char(-19),char(0),char(14),char(0),char(-18),char(0),char(0),char(0),char(-17),char(0),char(0),char(0),char(-16),char(0),char(0),char(0),char(-15),char(0), +char(0),char(0),char(-14),char(0),char(0),char(0),char(-13),char(0),char(4),char(0),char(-12),char(0),char(76),char(0),char(9),char(0),char(59),char(0),char(-74),char(0), +char(19),char(0),char(-71),char(0),char(19),char(0),char(-70),char(0),char(7),char(0),char(-55),char(0),char(7),char(0),char(-54),char(0),char(7),char(0),char(-53),char(0), +char(7),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0),char(77),char(0),char(9),char(0),char(61),char(0),char(-74),char(0), +char(20),char(0),char(-71),char(0),char(20),char(0),char(-70),char(0),char(8),char(0),char(-55),char(0),char(8),char(0),char(-54),char(0),char(8),char(0),char(-53),char(0), +char(8),char(0),char(-52),char(0),char(4),char(0),char(-51),char(0),char(4),char(0),char(-50),char(0),char(78),char(0),char(5),char(0),char(58),char(0),char(-74),char(0), +char(13),char(0),char(-11),char(0),char(13),char(0),char(-10),char(0),char(7),char(0),char(-9),char(0),char(0),char(0),char(37),char(0),char(79),char(0),char(4),char(0), +char(61),char(0),char(-74),char(0),char(14),char(0),char(-11),char(0),char(14),char(0),char(-10),char(0),char(8),char(0),char(-9),char(0),char(80),char(0),char(4),char(0), +char(7),char(0),char(-8),char(0),char(7),char(0),char(-7),char(0),char(7),char(0),char(-6),char(0),char(4),char(0),char(79),char(0),char(81),char(0),char(10),char(0), +char(80),char(0),char(-5),char(0),char(13),char(0),char(-4),char(0),char(13),char(0),char(-3),char(0),char(13),char(0),char(-2),char(0),char(13),char(0),char(-1),char(0), +char(13),char(0),char(0),char(1),char(7),char(0),char(-99),char(0),char(7),char(0),char(1),char(1),char(4),char(0),char(2),char(1),char(4),char(0),char(53),char(0), +char(82),char(0),char(4),char(0),char(80),char(0),char(-5),char(0),char(4),char(0),char(3),char(1),char(7),char(0),char(4),char(1),char(4),char(0),char(5),char(1), +char(83),char(0),char(4),char(0),char(13),char(0),char(0),char(1),char(80),char(0),char(-5),char(0),char(4),char(0),char(6),char(1),char(7),char(0),char(7),char(1), +char(84),char(0),char(7),char(0),char(13),char(0),char(8),char(1),char(80),char(0),char(-5),char(0),char(4),char(0),char(9),char(1),char(7),char(0),char(10),char(1), +char(7),char(0),char(11),char(1),char(7),char(0),char(12),char(1),char(4),char(0),char(53),char(0),char(85),char(0),char(6),char(0),char(17),char(0),char(13),char(1), +char(13),char(0),char(11),char(1),char(13),char(0),char(14),char(1),char(60),char(0),char(15),char(1),char(4),char(0),char(16),char(1),char(7),char(0),char(12),char(1), +char(86),char(0),char(26),char(0),char(4),char(0),char(17),char(1),char(7),char(0),char(18),char(1),char(7),char(0),char(127),char(0),char(7),char(0),char(19),char(1), +char(7),char(0),char(20),char(1),char(7),char(0),char(21),char(1),char(7),char(0),char(22),char(1),char(7),char(0),char(23),char(1),char(7),char(0),char(24),char(1), +char(7),char(0),char(25),char(1),char(7),char(0),char(26),char(1),char(7),char(0),char(27),char(1),char(7),char(0),char(28),char(1),char(7),char(0),char(29),char(1), +char(7),char(0),char(30),char(1),char(7),char(0),char(31),char(1),char(7),char(0),char(32),char(1),char(7),char(0),char(33),char(1),char(7),char(0),char(34),char(1), +char(7),char(0),char(35),char(1),char(7),char(0),char(36),char(1),char(4),char(0),char(37),char(1),char(4),char(0),char(38),char(1),char(4),char(0),char(39),char(1), +char(4),char(0),char(40),char(1),char(4),char(0),char(120),char(0),char(87),char(0),char(12),char(0),char(17),char(0),char(41),char(1),char(17),char(0),char(42),char(1), +char(17),char(0),char(43),char(1),char(13),char(0),char(44),char(1),char(13),char(0),char(45),char(1),char(7),char(0),char(46),char(1),char(4),char(0),char(47),char(1), +char(4),char(0),char(48),char(1),char(4),char(0),char(49),char(1),char(4),char(0),char(50),char(1),char(7),char(0),char(10),char(1),char(4),char(0),char(53),char(0), +char(88),char(0),char(27),char(0),char(19),char(0),char(51),char(1),char(17),char(0),char(52),char(1),char(17),char(0),char(53),char(1),char(13),char(0),char(44),char(1), +char(13),char(0),char(54),char(1),char(13),char(0),char(55),char(1),char(13),char(0),char(56),char(1),char(13),char(0),char(57),char(1),char(13),char(0),char(58),char(1), +char(4),char(0),char(59),char(1),char(7),char(0),char(60),char(1),char(4),char(0),char(61),char(1),char(4),char(0),char(62),char(1),char(4),char(0),char(63),char(1), +char(7),char(0),char(64),char(1),char(7),char(0),char(65),char(1),char(4),char(0),char(66),char(1),char(4),char(0),char(67),char(1),char(7),char(0),char(68),char(1), +char(7),char(0),char(69),char(1),char(7),char(0),char(70),char(1),char(7),char(0),char(71),char(1),char(7),char(0),char(72),char(1),char(7),char(0),char(73),char(1), +char(4),char(0),char(74),char(1),char(4),char(0),char(75),char(1),char(4),char(0),char(76),char(1),char(89),char(0),char(12),char(0),char(9),char(0),char(77),char(1), +char(9),char(0),char(78),char(1),char(13),char(0),char(79),char(1),char(7),char(0),char(80),char(1),char(7),char(0),char(-125),char(0),char(7),char(0),char(81),char(1), +char(4),char(0),char(82),char(1),char(13),char(0),char(83),char(1),char(4),char(0),char(84),char(1),char(4),char(0),char(85),char(1),char(4),char(0),char(86),char(1), +char(4),char(0),char(53),char(0),char(90),char(0),char(19),char(0),char(50),char(0),char(-109),char(0),char(87),char(0),char(87),char(1),char(80),char(0),char(88),char(1), +char(81),char(0),char(89),char(1),char(82),char(0),char(90),char(1),char(83),char(0),char(91),char(1),char(84),char(0),char(92),char(1),char(85),char(0),char(93),char(1), +char(88),char(0),char(94),char(1),char(89),char(0),char(95),char(1),char(4),char(0),char(96),char(1),char(4),char(0),char(62),char(1),char(4),char(0),char(97),char(1), +char(4),char(0),char(98),char(1),char(4),char(0),char(99),char(1),char(4),char(0),char(100),char(1),char(4),char(0),char(101),char(1),char(4),char(0),char(102),char(1), +char(86),char(0),char(103),char(1),char(91),char(0),char(24),char(0),char(16),char(0),char(104),char(1),char(14),char(0),char(105),char(1),char(14),char(0),char(106),char(1), +char(14),char(0),char(107),char(1),char(14),char(0),char(108),char(1),char(14),char(0),char(109),char(1),char(8),char(0),char(110),char(1),char(4),char(0),char(111),char(1), +char(4),char(0),char(86),char(1),char(4),char(0),char(112),char(1),char(4),char(0),char(113),char(1),char(8),char(0),char(114),char(1),char(8),char(0),char(115),char(1), +char(8),char(0),char(116),char(1),char(8),char(0),char(117),char(1),char(8),char(0),char(118),char(1),char(8),char(0),char(119),char(1),char(8),char(0),char(120),char(1), +char(8),char(0),char(121),char(1),char(8),char(0),char(122),char(1),char(0),char(0),char(123),char(1),char(0),char(0),char(124),char(1),char(49),char(0),char(125),char(1), +char(0),char(0),char(126),char(1),char(92),char(0),char(24),char(0),char(15),char(0),char(104),char(1),char(13),char(0),char(105),char(1),char(13),char(0),char(106),char(1), +char(13),char(0),char(107),char(1),char(13),char(0),char(108),char(1),char(13),char(0),char(109),char(1),char(4),char(0),char(112),char(1),char(7),char(0),char(110),char(1), +char(4),char(0),char(111),char(1),char(4),char(0),char(86),char(1),char(7),char(0),char(114),char(1),char(7),char(0),char(115),char(1),char(7),char(0),char(116),char(1), +char(4),char(0),char(113),char(1),char(7),char(0),char(117),char(1),char(7),char(0),char(118),char(1),char(7),char(0),char(119),char(1),char(7),char(0),char(120),char(1), +char(7),char(0),char(121),char(1),char(7),char(0),char(122),char(1),char(0),char(0),char(123),char(1),char(0),char(0),char(124),char(1),char(50),char(0),char(125),char(1), +char(0),char(0),char(126),char(1),char(93),char(0),char(9),char(0),char(20),char(0),char(127),char(1),char(14),char(0),char(-128),char(1),char(8),char(0),char(-127),char(1), +char(0),char(0),char(-126),char(1),char(91),char(0),char(90),char(1),char(49),char(0),char(-125),char(1),char(0),char(0),char(126),char(1),char(4),char(0),char(97),char(1), +char(0),char(0),char(37),char(0),char(94),char(0),char(7),char(0),char(0),char(0),char(-126),char(1),char(92),char(0),char(90),char(1),char(50),char(0),char(-125),char(1), +char(19),char(0),char(127),char(1),char(13),char(0),char(-128),char(1),char(7),char(0),char(-127),char(1),char(4),char(0),char(97),char(1),}; +int sBulletDNAlen64= sizeof(sBulletDNAstr64); diff --git a/Engine/lib/bullet/src/LinearMath/btThreads.cpp b/Engine/lib/bullet/src/LinearMath/btThreads.cpp index 4bef499f7..59a7ea36e 100644 --- a/Engine/lib/bullet/src/LinearMath/btThreads.cpp +++ b/Engine/lib/bullet/src/LinearMath/btThreads.cpp @@ -14,7 +14,40 @@ subject to the following restrictions: #include "btThreads.h" +#include "btQuickprof.h" +#include // for min and max + +#if BT_USE_OPENMP && BT_THREADSAFE + +#include + +#endif // #if BT_USE_OPENMP && BT_THREADSAFE + + +#if BT_USE_PPL && BT_THREADSAFE + +// use Microsoft Parallel Patterns Library (installed with Visual Studio 2010 and later) +#include // if you get a compile error here, check whether your version of Visual Studio includes PPL +// Visual Studio 2010 and later should come with it +#include // for GetProcessorCount() + +#endif // #if BT_USE_PPL && BT_THREADSAFE + + +#if BT_USE_TBB && BT_THREADSAFE + +// use Intel Threading Building Blocks for thread management +#define __TBB_NO_IMPLICIT_LINKAGE 1 +#include +#include +#include +#include + +#endif // #if BT_USE_TBB && BT_THREADSAFE + + +#if BT_THREADSAFE // // Lightweight spin-mutex based on atomics // Using ordinary system-provided mutexes like Windows critical sections was noticeably slower @@ -22,8 +55,6 @@ subject to the following restrictions: // context switching. // -#if BT_THREADSAFE - #if __cplusplus >= 201103L // for anything claiming full C++11 compliance, use C++11 atomics @@ -169,28 +200,107 @@ void btSpinMutex::unlock() #endif //#else //#elif USE_MSVC_INTRINSICS +#else //#if BT_THREADSAFE + +// These should not be called ever +void btSpinMutex::lock() +{ + btAssert( !"unimplemented btSpinMutex::lock() called" ); +} + +void btSpinMutex::unlock() +{ + btAssert( !"unimplemented btSpinMutex::unlock() called" ); +} + +bool btSpinMutex::tryLock() +{ + btAssert( !"unimplemented btSpinMutex::tryLock() called" ); + return true; +} + +#define THREAD_LOCAL_STATIC static + +#endif // #else //#if BT_THREADSAFE + struct ThreadsafeCounter { unsigned int mCounter; btSpinMutex mMutex; - ThreadsafeCounter() {mCounter=0;} + ThreadsafeCounter() + { + mCounter = 0; + --mCounter; // first count should come back 0 + } unsigned int getNext() { // no need to optimize this with atomics, it is only called ONCE per thread! mMutex.lock(); - unsigned int val = mCounter++; + mCounter++; + if ( mCounter >= BT_MAX_THREAD_COUNT ) + { + btAssert( !"thread counter exceeded" ); + // wrap back to the first worker index + mCounter = 1; + } + unsigned int val = mCounter; mMutex.unlock(); return val; } }; + +static btITaskScheduler* gBtTaskScheduler; +static int gThreadsRunningCounter = 0; // useful for detecting if we are trying to do nested parallel-for calls +static btSpinMutex gThreadsRunningCounterMutex; static ThreadsafeCounter gThreadCounter; -// return a unique index per thread, starting with 0 and counting up +// +// BT_DETECT_BAD_THREAD_INDEX tries to detect when there are multiple threads assigned the same thread index. +// +// BT_DETECT_BAD_THREAD_INDEX is a developer option to test if +// certain assumptions about how the task scheduler manages its threads +// holds true. +// The main assumption is: +// - when the threadpool is resized, the task scheduler either +// 1. destroys all worker threads and creates all new ones in the correct number, OR +// 2. never destroys a worker thread +// +// We make that assumption because we can't easily enumerate the worker threads of a task scheduler +// to assign nice sequential thread-indexes. We also do not get notified if a worker thread is destroyed, +// so we can't tell when a thread-index is no longer being used. +// We allocate thread-indexes as needed with a sequential global thread counter. +// +// Our simple thread-counting scheme falls apart if the task scheduler destroys some threads but +// continues to re-use other threads and the application repeatedly resizes the thread pool of the +// task scheduler. +// In order to prevent the thread-counter from exceeding the global max (BT_MAX_THREAD_COUNT), we +// wrap the thread counter back to 1. This should only happen if the worker threads have all been +// destroyed and re-created. +// +// BT_DETECT_BAD_THREAD_INDEX only works for Win32 right now, +// but could be adapted to work with pthreads +#define BT_DETECT_BAD_THREAD_INDEX 0 + +#if BT_DETECT_BAD_THREAD_INDEX + +typedef DWORD ThreadId_t; +const static ThreadId_t kInvalidThreadId = 0; +ThreadId_t gDebugThreadIds[ BT_MAX_THREAD_COUNT ]; + +static ThreadId_t getDebugThreadId() +{ + return GetCurrentThreadId(); +} + +#endif // #if BT_DETECT_BAD_THREAD_INDEX + + +// return a unique index per thread, main thread is 0, worker threads are in [1, BT_MAX_THREAD_COUNT) unsigned int btGetCurrentThreadIndex() { const unsigned int kNullIndex = ~0U; @@ -198,7 +308,30 @@ unsigned int btGetCurrentThreadIndex() if ( sThreadIndex == kNullIndex ) { sThreadIndex = gThreadCounter.getNext(); + btAssert( sThreadIndex < BT_MAX_THREAD_COUNT ); } +#if BT_DETECT_BAD_THREAD_INDEX + if ( gBtTaskScheduler && sThreadIndex > 0 ) + { + ThreadId_t tid = getDebugThreadId(); + // if not set + if ( gDebugThreadIds[ sThreadIndex ] == kInvalidThreadId ) + { + // set it + gDebugThreadIds[ sThreadIndex ] = tid; + } + else + { + if ( gDebugThreadIds[ sThreadIndex ] != tid ) + { + // this could indicate the task scheduler is breaking our assumptions about + // how threads are managed when threadpool is resized + btAssert( !"there are 2 or more threads with the same thread-index!" ); + __debugbreak(); + } + } + } +#endif // #if BT_DETECT_BAD_THREAD_INDEX return sThreadIndex; } @@ -207,24 +340,383 @@ bool btIsMainThread() return btGetCurrentThreadIndex() == 0; } +void btResetThreadIndexCounter() +{ + // for when all current worker threads are destroyed + btAssert( btIsMainThread() ); + gThreadCounter.mCounter = 0; +} + +btITaskScheduler::btITaskScheduler( const char* name ) +{ + m_name = name; + m_savedThreadCounter = 0; + m_isActive = false; +} + +void btITaskScheduler::activate() +{ + // gThreadCounter is used to assign a thread-index to each worker thread in a task scheduler. + // The main thread is always thread-index 0, and worker threads are numbered from 1 to 63 (BT_MAX_THREAD_COUNT-1) + // The thread-indexes need to be unique amongst the threads that can be running simultaneously. + // Since only one task scheduler can be used at a time, it is OK for a pair of threads that belong to different + // task schedulers to share the same thread index because they can't be running at the same time. + // So each task scheduler needs to keep its own thread counter value + if ( !m_isActive ) + { + gThreadCounter.mCounter = m_savedThreadCounter; // restore saved thread counter + m_isActive = true; + } +} + +void btITaskScheduler::deactivate() +{ + if ( m_isActive ) + { + m_savedThreadCounter = gThreadCounter.mCounter; // save thread counter + m_isActive = false; + } +} + +void btPushThreadsAreRunning() +{ + gThreadsRunningCounterMutex.lock(); + gThreadsRunningCounter++; + gThreadsRunningCounterMutex.unlock(); +} + +void btPopThreadsAreRunning() +{ + gThreadsRunningCounterMutex.lock(); + gThreadsRunningCounter--; + gThreadsRunningCounterMutex.unlock(); +} + +bool btThreadsAreRunning() +{ + return gThreadsRunningCounter != 0; +} + + +void btSetTaskScheduler( btITaskScheduler* ts ) +{ + int threadId = btGetCurrentThreadIndex(); // make sure we call this on main thread at least once before any workers run + if ( threadId != 0 ) + { + btAssert( !"btSetTaskScheduler must be called from the main thread!" ); + return; + } + if ( gBtTaskScheduler ) + { + // deactivate old task scheduler + gBtTaskScheduler->deactivate(); + } + gBtTaskScheduler = ts; + if ( ts ) + { + // activate new task scheduler + ts->activate(); + } +} + + +btITaskScheduler* btGetTaskScheduler() +{ + return gBtTaskScheduler; +} + + +void btParallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) +{ +#if BT_THREADSAFE + +#if BT_DETECT_BAD_THREAD_INDEX + if ( !btThreadsAreRunning() ) + { + // clear out thread ids + for ( int i = 0; i < BT_MAX_THREAD_COUNT; ++i ) + { + gDebugThreadIds[ i ] = kInvalidThreadId; + } + } +#endif // #if BT_DETECT_BAD_THREAD_INDEX + + btAssert( gBtTaskScheduler != NULL ); // call btSetTaskScheduler() with a valid task scheduler first! + gBtTaskScheduler->parallelFor( iBegin, iEnd, grainSize, body ); + #else // #if BT_THREADSAFE -// These should not be called ever -void btSpinMutex::lock() -{ - btAssert(!"unimplemented btSpinMutex::lock() called"); + // non-parallel version of btParallelFor + btAssert( !"called btParallelFor in non-threadsafe build. enable BT_THREADSAFE" ); + body.forLoop( iBegin, iEnd ); + +#endif// #if BT_THREADSAFE } -void btSpinMutex::unlock() + +/// +/// btTaskSchedulerSequential -- non-threaded implementation of task scheduler +/// (really just useful for testing performance of single threaded vs multi) +/// +class btTaskSchedulerSequential : public btITaskScheduler { - btAssert(!"unimplemented btSpinMutex::unlock() called"); +public: + btTaskSchedulerSequential() : btITaskScheduler( "Sequential" ) {} + virtual int getMaxNumThreads() const BT_OVERRIDE { return 1; } + virtual int getNumThreads() const BT_OVERRIDE { return 1; } + virtual void setNumThreads( int numThreads ) BT_OVERRIDE {} + virtual void parallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) BT_OVERRIDE + { + BT_PROFILE( "parallelFor_sequential" ); + body.forLoop( iBegin, iEnd ); + } +}; + + +#if BT_USE_OPENMP && BT_THREADSAFE +/// +/// btTaskSchedulerOpenMP -- wrapper around OpenMP task scheduler +/// +class btTaskSchedulerOpenMP : public btITaskScheduler +{ + int m_numThreads; +public: + btTaskSchedulerOpenMP() : btITaskScheduler( "OpenMP" ) + { + m_numThreads = 0; + } + virtual int getMaxNumThreads() const BT_OVERRIDE + { + return omp_get_max_threads(); + } + virtual int getNumThreads() const BT_OVERRIDE + { + return m_numThreads; + } + virtual void setNumThreads( int numThreads ) BT_OVERRIDE + { + // With OpenMP, because it is a standard with various implementations, we can't + // know for sure if every implementation has the same behavior of destroying all + // previous threads when resizing the threadpool + m_numThreads = ( std::max )( 1, ( std::min )( int( BT_MAX_THREAD_COUNT ), numThreads ) ); + omp_set_num_threads( 1 ); // hopefully, all previous threads get destroyed here + omp_set_num_threads( m_numThreads ); + m_savedThreadCounter = 0; + if ( m_isActive ) + { + btResetThreadIndexCounter(); + } + } + virtual void parallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) BT_OVERRIDE + { + BT_PROFILE( "parallelFor_OpenMP" ); + btPushThreadsAreRunning(); +#pragma omp parallel for schedule( static, 1 ) + for ( int i = iBegin; i < iEnd; i += grainSize ) + { + BT_PROFILE( "OpenMP_job" ); + body.forLoop( i, ( std::min )( i + grainSize, iEnd ) ); + } + btPopThreadsAreRunning(); + } +}; +#endif // #if BT_USE_OPENMP && BT_THREADSAFE + + +#if BT_USE_TBB && BT_THREADSAFE +/// +/// btTaskSchedulerTBB -- wrapper around Intel Threaded Building Blocks task scheduler +/// +class btTaskSchedulerTBB : public btITaskScheduler +{ + int m_numThreads; + tbb::task_scheduler_init* m_tbbSchedulerInit; + +public: + btTaskSchedulerTBB() : btITaskScheduler( "IntelTBB" ) + { + m_numThreads = 0; + m_tbbSchedulerInit = NULL; + } + ~btTaskSchedulerTBB() + { + if ( m_tbbSchedulerInit ) + { + delete m_tbbSchedulerInit; + m_tbbSchedulerInit = NULL; + } + } + + virtual int getMaxNumThreads() const BT_OVERRIDE + { + return tbb::task_scheduler_init::default_num_threads(); + } + virtual int getNumThreads() const BT_OVERRIDE + { + return m_numThreads; + } + virtual void setNumThreads( int numThreads ) BT_OVERRIDE + { + m_numThreads = ( std::max )( 1, ( std::min )( int(BT_MAX_THREAD_COUNT), numThreads ) ); + if ( m_tbbSchedulerInit ) + { + // destroys all previous threads + delete m_tbbSchedulerInit; + m_tbbSchedulerInit = NULL; + } + m_tbbSchedulerInit = new tbb::task_scheduler_init( m_numThreads ); + m_savedThreadCounter = 0; + if ( m_isActive ) + { + btResetThreadIndexCounter(); + } + } + struct BodyAdapter + { + const btIParallelForBody* mBody; + + void operator()( const tbb::blocked_range& range ) const + { + BT_PROFILE( "TBB_job" ); + mBody->forLoop( range.begin(), range.end() ); + } + }; + virtual void parallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) BT_OVERRIDE + { + BT_PROFILE( "parallelFor_TBB" ); + // TBB dispatch + BodyAdapter tbbBody; + tbbBody.mBody = &body; + btPushThreadsAreRunning(); + tbb::parallel_for( tbb::blocked_range( iBegin, iEnd, grainSize ), + tbbBody, + tbb::simple_partitioner() + ); + btPopThreadsAreRunning(); + } +}; +#endif // #if BT_USE_TBB && BT_THREADSAFE + + +#if BT_USE_PPL && BT_THREADSAFE +/// +/// btTaskSchedulerPPL -- wrapper around Microsoft Parallel Patterns Lib task scheduler +/// +class btTaskSchedulerPPL : public btITaskScheduler +{ + int m_numThreads; +public: + btTaskSchedulerPPL() : btITaskScheduler( "PPL" ) + { + m_numThreads = 0; + } + virtual int getMaxNumThreads() const BT_OVERRIDE + { + return concurrency::GetProcessorCount(); + } + virtual int getNumThreads() const BT_OVERRIDE + { + return m_numThreads; + } + virtual void setNumThreads( int numThreads ) BT_OVERRIDE + { + // capping the thread count for PPL due to a thread-index issue + const int maxThreadCount = (std::min)(int(BT_MAX_THREAD_COUNT), 31); + m_numThreads = ( std::max )( 1, ( std::min )( maxThreadCount, numThreads ) ); + using namespace concurrency; + if ( CurrentScheduler::Id() != -1 ) + { + CurrentScheduler::Detach(); + } + SchedulerPolicy policy; + { + // PPL seems to destroy threads when threadpool is shrunk, but keeps reusing old threads + // force it to destroy old threads + policy.SetConcurrencyLimits( 1, 1 ); + CurrentScheduler::Create( policy ); + CurrentScheduler::Detach(); + } + policy.SetConcurrencyLimits( m_numThreads, m_numThreads ); + CurrentScheduler::Create( policy ); + m_savedThreadCounter = 0; + if ( m_isActive ) + { + btResetThreadIndexCounter(); + } + } + struct BodyAdapter + { + const btIParallelForBody* mBody; + int mGrainSize; + int mIndexEnd; + + void operator()( int i ) const + { + BT_PROFILE( "PPL_job" ); + mBody->forLoop( i, ( std::min )( i + mGrainSize, mIndexEnd ) ); + } + }; + virtual void parallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) BT_OVERRIDE + { + BT_PROFILE( "parallelFor_PPL" ); + // PPL dispatch + BodyAdapter pplBody; + pplBody.mBody = &body; + pplBody.mGrainSize = grainSize; + pplBody.mIndexEnd = iEnd; + btPushThreadsAreRunning(); + // note: MSVC 2010 doesn't support partitioner args, so avoid them + concurrency::parallel_for( iBegin, + iEnd, + grainSize, + pplBody + ); + btPopThreadsAreRunning(); + } +}; +#endif // #if BT_USE_PPL && BT_THREADSAFE + + +// create a non-threaded task scheduler (always available) +btITaskScheduler* btGetSequentialTaskScheduler() +{ + static btTaskSchedulerSequential sTaskScheduler; + return &sTaskScheduler; } -bool btSpinMutex::tryLock() + +// create an OpenMP task scheduler (if available, otherwise returns null) +btITaskScheduler* btGetOpenMPTaskScheduler() { - btAssert(!"unimplemented btSpinMutex::tryLock() called"); - return true; +#if BT_USE_OPENMP && BT_THREADSAFE + static btTaskSchedulerOpenMP sTaskScheduler; + return &sTaskScheduler; +#else + return NULL; +#endif } -#endif // #else // #if BT_THREADSAFE + +// create an Intel TBB task scheduler (if available, otherwise returns null) +btITaskScheduler* btGetTBBTaskScheduler() +{ +#if BT_USE_TBB && BT_THREADSAFE + static btTaskSchedulerTBB sTaskScheduler; + return &sTaskScheduler; +#else + return NULL; +#endif +} + + +// create a PPL task scheduler (if available, otherwise returns null) +btITaskScheduler* btGetPPLTaskScheduler() +{ +#if BT_USE_PPL && BT_THREADSAFE + static btTaskSchedulerPPL sTaskScheduler; + return &sTaskScheduler; +#else + return NULL; +#endif +} diff --git a/Engine/lib/bullet/src/LinearMath/btThreads.h b/Engine/lib/bullet/src/LinearMath/btThreads.h index db710979f..05fd15ec8 100644 --- a/Engine/lib/bullet/src/LinearMath/btThreads.h +++ b/Engine/lib/bullet/src/LinearMath/btThreads.h @@ -19,6 +19,23 @@ subject to the following restrictions: #include "btScalar.h" // has definitions like SIMD_FORCE_INLINE +#if defined (_MSC_VER) && _MSC_VER >= 1600 +// give us a compile error if any signatures of overriden methods is changed +#define BT_OVERRIDE override +#endif + +#ifndef BT_OVERRIDE +#define BT_OVERRIDE +#endif + +const unsigned int BT_MAX_THREAD_COUNT = 64; // only if BT_THREADSAFE is 1 + +// for internal use only +bool btIsMainThread(); +bool btThreadsAreRunning(); +unsigned int btGetCurrentThreadIndex(); +void btResetThreadIndexCounter(); // notify that all worker threads have been destroyed + /// /// btSpinMutex -- lightweight spin-mutex implemented with atomic ops, never puts /// a thread to sleep because it is designed to be used with a task scheduler @@ -39,38 +56,100 @@ public: bool tryLock(); }; -#if BT_THREADSAFE -// for internal Bullet use only +// +// NOTE: btMutex* is for internal Bullet use only +// +// If BT_THREADSAFE is undefined or 0, should optimize away to nothing. +// This is good because for the single-threaded build of Bullet, any calls +// to these functions will be optimized out. +// +// However, for users of the multi-threaded build of Bullet this is kind +// of bad because if you call any of these functions from external code +// (where BT_THREADSAFE is undefined) you will get unexpected race conditions. +// SIMD_FORCE_INLINE void btMutexLock( btSpinMutex* mutex ) { +#if BT_THREADSAFE mutex->lock(); +#endif // #if BT_THREADSAFE } SIMD_FORCE_INLINE void btMutexUnlock( btSpinMutex* mutex ) { +#if BT_THREADSAFE mutex->unlock(); +#endif // #if BT_THREADSAFE } SIMD_FORCE_INLINE bool btMutexTryLock( btSpinMutex* mutex ) { +#if BT_THREADSAFE return mutex->tryLock(); +#else + return true; +#endif // #if BT_THREADSAFE } -// for internal use only -bool btIsMainThread(); -unsigned int btGetCurrentThreadIndex(); -const unsigned int BT_MAX_THREAD_COUNT = 64; -#else +// +// btIParallelForBody -- subclass this to express work that can be done in parallel +// +class btIParallelForBody +{ +public: + virtual ~btIParallelForBody() {} + virtual void forLoop( int iBegin, int iEnd ) const = 0; +}; + +// +// btITaskScheduler -- subclass this to implement a task scheduler that can dispatch work to +// worker threads +// +class btITaskScheduler +{ +public: + btITaskScheduler( const char* name ); + virtual ~btITaskScheduler() {} + const char* getName() const { return m_name; } + + virtual int getMaxNumThreads() const = 0; + virtual int getNumThreads() const = 0; + virtual void setNumThreads( int numThreads ) = 0; + virtual void parallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ) = 0; + + // internal use only + virtual void activate(); + virtual void deactivate(); + +protected: + const char* m_name; + unsigned int m_savedThreadCounter; + bool m_isActive; +}; + +// set the task scheduler to use for all calls to btParallelFor() +// NOTE: you must set this prior to using any of the multi-threaded "Mt" classes +void btSetTaskScheduler( btITaskScheduler* ts ); + +// get the current task scheduler +btITaskScheduler* btGetTaskScheduler(); + +// get non-threaded task scheduler (always available) +btITaskScheduler* btGetSequentialTaskScheduler(); + +// get OpenMP task scheduler (if available, otherwise returns null) +btITaskScheduler* btGetOpenMPTaskScheduler(); + +// get Intel TBB task scheduler (if available, otherwise returns null) +btITaskScheduler* btGetTBBTaskScheduler(); + +// get PPL task scheduler (if available, otherwise returns null) +btITaskScheduler* btGetPPLTaskScheduler(); + +// btParallelFor -- call this to dispatch work like a for-loop +// (iterations may be done out of order, so no dependencies are allowed) +void btParallelFor( int iBegin, int iEnd, int grainSize, const btIParallelForBody& body ); -// for internal Bullet use only -// if BT_THREADSAFE is undefined or 0, should optimize away to nothing -SIMD_FORCE_INLINE void btMutexLock( btSpinMutex* ) {} -SIMD_FORCE_INLINE void btMutexUnlock( btSpinMutex* ) {} -SIMD_FORCE_INLINE bool btMutexTryLock( btSpinMutex* ) {return true;} #endif - - -#endif //BT_THREADS_H diff --git a/Engine/lib/bullet/src/LinearMath/btTransformUtil.h b/Engine/lib/bullet/src/LinearMath/btTransformUtil.h index 2303c2742..182cc43fa 100644 --- a/Engine/lib/bullet/src/LinearMath/btTransformUtil.h +++ b/Engine/lib/bullet/src/LinearMath/btTransformUtil.h @@ -47,13 +47,19 @@ public: #ifdef QUATERNION_DERIVATIVE btQuaternion predictedOrn = curTrans.getRotation(); predictedOrn += (angvel * predictedOrn) * (timeStep * btScalar(0.5)); - predictedOrn.normalize(); + predictedOrn.safeNormalize(); #else //Exponential map //google for "Practical Parameterization of Rotations Using the Exponential Map", F. Sebastian Grassia btVector3 axis; - btScalar fAngle = angvel.length(); + btScalar fAngle2 = angvel.length2(); + btScalar fAngle = 0; + if (fAngle2>SIMD_EPSILON) + { + fAngle = btSqrt(fAngle2); + } + //limit the angular motion if (fAngle*timeStep > ANGULAR_MOTION_THRESHOLD) { @@ -74,9 +80,16 @@ public: btQuaternion orn0 = curTrans.getRotation(); btQuaternion predictedOrn = dorn * orn0; - predictedOrn.normalize(); + predictedOrn.safeNormalize(); #endif - predictedTransform.setRotation(predictedOrn); + if (predictedOrn.length2()>SIMD_EPSILON) + { + predictedTransform.setRotation(predictedOrn); + } + else + { + predictedTransform.setBasis(curTrans.getBasis()); + } } static void calculateVelocityQuaternion(const btVector3& pos0,const btVector3& pos1,const btQuaternion& orn0,const btQuaternion& orn1,btScalar timeStep,btVector3& linVel,btVector3& angVel) diff --git a/Engine/lib/bullet/src/LinearMath/btVector3.h b/Engine/lib/bullet/src/LinearMath/btVector3.h index 487670009..fdf3fd796 100644 --- a/Engine/lib/bullet/src/LinearMath/btVector3.h +++ b/Engine/lib/bullet/src/LinearMath/btVector3.h @@ -291,14 +291,16 @@ public: SIMD_FORCE_INLINE btVector3& safeNormalize() { - btVector3 absVec = this->absolute(); - int maxIndex = absVec.maxAxis(); - if (absVec[maxIndex]>0) + btScalar l2 = length2(); + //triNormal.normalize(); + if (l2 >= SIMD_EPSILON*SIMD_EPSILON) { - *this /= absVec[maxIndex]; - return *this /= length(); + (*this) /= btSqrt(l2); + } + else + { + setValue(1, 0, 0); } - setValue(1,0,0); return *this; } @@ -1157,7 +1159,6 @@ public: if (m_floats[3] > maxVal) { maxIndex = 3; - maxVal = m_floats[3]; } return maxIndex; diff --git a/Engine/lib/bullet/src/btBulletCollisionCommon.h b/Engine/lib/bullet/src/btBulletCollisionCommon.h index af981b5d3..948e02eb4 100644 --- a/Engine/lib/bullet/src/btBulletCollisionCommon.h +++ b/Engine/lib/bullet/src/btBulletCollisionCommon.h @@ -52,7 +52,6 @@ subject to the following restrictions: #include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h" #include "BulletCollision/BroadphaseCollision/btSimpleBroadphase.h" #include "BulletCollision/BroadphaseCollision/btAxisSweep3.h" -#include "BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h" #include "BulletCollision/BroadphaseCollision/btDbvtBroadphase.h" ///Math library & Utils From c7579f76fca5bf77187d5f16ef48c0353e050242 Mon Sep 17 00:00:00 2001 From: Johxz Date: Sun, 4 Feb 2018 22:26:02 -0600 Subject: [PATCH 006/144] update to libogg v133 --- Engine/lib/libogg/CHANGES | 6 +++++ Engine/lib/libogg/include/ogg/ogg.h | 2 +- Engine/lib/libogg/include/ogg/os_types.h | 33 ++++++++++++------------ Engine/lib/libogg/src/bitwise.c | 2 +- Engine/lib/libogg/src/framing.c | 33 ++++++++++++++++++++++-- 5 files changed, 56 insertions(+), 20 deletions(-) diff --git a/Engine/lib/libogg/CHANGES b/Engine/lib/libogg/CHANGES index 3f2e0fb26..6814e31be 100644 --- a/Engine/lib/libogg/CHANGES +++ b/Engine/lib/libogg/CHANGES @@ -1,3 +1,9 @@ +Version 1.3.3 (2017 November 7) + + * Fix and issue with corrupt continued packet handling. + * Update Windows projects and build settings. + * Remove Mac OS 9 build support. + Version 1.3.2 (2014 May 27) * Fix an bug in oggpack_writecopy(). diff --git a/Engine/lib/libogg/include/ogg/ogg.h b/Engine/lib/libogg/include/ogg/ogg.h index cea4ebed7..7609fc24d 100644 --- a/Engine/lib/libogg/include/ogg/ogg.h +++ b/Engine/lib/libogg/include/ogg/ogg.h @@ -11,7 +11,7 @@ ******************************************************************** function: toplevel libogg include - last mod: $Id: ogg.h 18044 2011-08-01 17:55:20Z gmaxwell $ + last mod: $Id$ ********************************************************************/ #ifndef _OGG_H diff --git a/Engine/lib/libogg/include/ogg/os_types.h b/Engine/lib/libogg/include/ogg/os_types.h index 8bf82107e..b8f56308b 100644 --- a/Engine/lib/libogg/include/ogg/os_types.h +++ b/Engine/lib/libogg/include/ogg/os_types.h @@ -11,7 +11,7 @@ ******************************************************************** function: #ifdef jail to whip a few platforms into the UNIX ideal. - last mod: $Id: os_types.h 19098 2014-02-26 19:06:45Z giles $ + last mod: $Id$ ********************************************************************/ #ifndef _OS_TYPES_H @@ -49,23 +49,24 @@ typedef short ogg_int16_t; typedef unsigned short ogg_uint16_t; # else - /* MSVC/Borland */ - typedef __int64 ogg_int64_t; - typedef __int32 ogg_int32_t; - typedef unsigned __int32 ogg_uint32_t; - typedef __int16 ogg_int16_t; - typedef unsigned __int16 ogg_uint16_t; +# if defined(_MSC_VER) && (_MSC_VER >= 1800) /* MSVC 2013 and newer */ +# include + typedef int16_t ogg_int16_t; + typedef uint16_t ogg_uint16_t; + typedef int32_t ogg_int32_t; + typedef uint32_t ogg_uint32_t; + typedef int64_t ogg_int64_t; + typedef uint64_t ogg_uint64_t; +# else + /* MSVC/Borland */ + typedef __int64 ogg_int64_t; + typedef __int32 ogg_int32_t; + typedef unsigned __int32 ogg_uint32_t; + typedef __int16 ogg_int16_t; + typedef unsigned __int16 ogg_uint16_t; +# endif # endif -#elif defined(__MACOS__) - -# include - typedef SInt16 ogg_int16_t; - typedef UInt16 ogg_uint16_t; - typedef SInt32 ogg_int32_t; - typedef UInt32 ogg_uint32_t; - typedef SInt64 ogg_int64_t; - #elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */ # include diff --git a/Engine/lib/libogg/src/bitwise.c b/Engine/lib/libogg/src/bitwise.c index 145901d18..fa2b57202 100644 --- a/Engine/lib/libogg/src/bitwise.c +++ b/Engine/lib/libogg/src/bitwise.c @@ -11,7 +11,7 @@ ******************************************************************** function: packing variable sized words into an octet stream - last mod: $Id: bitwise.c 19149 2014-05-27 16:26:23Z giles $ + last mod: $Id$ ********************************************************************/ diff --git a/Engine/lib/libogg/src/framing.c b/Engine/lib/libogg/src/framing.c index 3a2f0a605..79fc715c8 100644 --- a/Engine/lib/libogg/src/framing.c +++ b/Engine/lib/libogg/src/framing.c @@ -12,7 +12,7 @@ function: code raw packets into framed OggSquish stream and decode Ogg streams back into raw packets - last mod: $Id: framing.c 18758 2013-01-08 16:29:56Z tterribe $ + last mod: $Id$ note: The CRC code is directly derived from public domain code by Ross Williams (ross@guest.adelaide.edu.au). See docs/framing.html @@ -875,6 +875,7 @@ int ogg_stream_pagein(ogg_stream_state *os, ogg_page *og){ some segments */ if(continued){ if(os->lacing_fill<1 || + (os->lacing_vals[os->lacing_fill-1]&0xff)<255 || os->lacing_vals[os->lacing_fill-1]==0x400){ bos=0; for(;segptrpacket!=op2->packet){ + fprintf(stderr,"op1->packet != op2->packet\n"); + return(1); + } + if(op1->bytes!=op2->bytes){ + fprintf(stderr,"op1->bytes != op2->bytes\n"); + return(1); + } + if(op1->b_o_s!=op2->b_o_s){ + fprintf(stderr,"op1->b_o_s != op2->b_o_s\n"); + return(1); + } + if(op1->e_o_s!=op2->e_o_s){ + fprintf(stderr,"op1->e_o_s != op2->e_o_s\n"); + return(1); + } + if(op1->granulepos!=op2->granulepos){ + fprintf(stderr,"op1->granulepos != op2->granulepos\n"); + return(1); + } + if(op1->packetno!=op2->packetno){ + fprintf(stderr,"op1->packetno != op2->packetno\n"); + return(1); + } + return(0); +} + void test_pack(const int *pl, const int **headers, int byteskip, int pageskip, int packetskip){ unsigned char *data=_ogg_malloc(1024*1024); /* for scripted test cases only */ @@ -1600,7 +1629,7 @@ void test_pack(const int *pl, const int **headers, int byteskip, ogg_stream_packetout(&os_de,&op_de); /* just catching them all */ /* verify peek and out match */ - if(memcmp(&op_de,&op_de2,sizeof(op_de))){ + if(compare_packet(&op_de,&op_de2)){ fprintf(stderr,"packetout != packetpeek! pos=%ld\n", depacket); exit(1); From c662e4ec2e5d4e3a08204d4732282bd9132cd0c2 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Feb 2018 11:48:13 -0600 Subject: [PATCH 007/144] don't try to physically interact with a prefab with invalid entries --- Engine/source/T3D/prefab.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Engine/source/T3D/prefab.cpp b/Engine/source/T3D/prefab.cpp index 6d357565f..6d32e2fd6 100644 --- a/Engine/source/T3D/prefab.cpp +++ b/Engine/source/T3D/prefab.cpp @@ -528,6 +528,11 @@ bool Prefab::isValidChild( SimObject *simobj, bool logWarnings ) bool Prefab::buildPolyList(PolyListContext context, AbstractPolyList* polyList, const Box3F &box, const SphereF& sphere) { Vector foundObjects; + if (mChildGroup.isNull() || mChildGroup->empty()) + { + Con::warnf("Bad Prefab Config! %s has no valid entries!", getName()); + return false; + } mChildGroup->findObjectByType(foundObjects); for (S32 i = 0; i < foundObjects.size(); i++) From 5daa5ade2d21bd1ecad52aabbb474e11750fc069 Mon Sep 17 00:00:00 2001 From: Johxz Date: Wed, 28 Feb 2018 13:01:06 -0600 Subject: [PATCH 008/144] delete old files --- .../btMultiSapBroadphase.cpp | 489 ------------------ .../btMultiSapBroadphase.h | 151 ------ 2 files changed, 640 deletions(-) delete mode 100644 Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp delete mode 100644 Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp deleted file mode 100644 index 81369fe9b..000000000 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp +++ /dev/null @@ -1,489 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ - -#include "btMultiSapBroadphase.h" - -#include "btSimpleBroadphase.h" -#include "LinearMath/btAabbUtil2.h" -#include "btQuantizedBvh.h" - -/// btSapBroadphaseArray m_sapBroadphases; - -/// btOverlappingPairCache* m_overlappingPairs; -extern int gOverlappingPairs; - -/* -class btMultiSapSortedOverlappingPairCache : public btSortedOverlappingPairCache -{ -public: - - virtual btBroadphasePair* addOverlappingPair(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1) - { - return btSortedOverlappingPairCache::addOverlappingPair((btBroadphaseProxy*)proxy0->m_multiSapParentProxy,(btBroadphaseProxy*)proxy1->m_multiSapParentProxy); - } -}; - -*/ - -btMultiSapBroadphase::btMultiSapBroadphase(int /*maxProxies*/,btOverlappingPairCache* pairCache) -:m_overlappingPairs(pairCache), -m_optimizedAabbTree(0), -m_ownsPairCache(false), -m_invalidPair(0) -{ - if (!m_overlappingPairs) - { - m_ownsPairCache = true; - void* mem = btAlignedAlloc(sizeof(btSortedOverlappingPairCache),16); - m_overlappingPairs = new (mem)btSortedOverlappingPairCache(); - } - - struct btMultiSapOverlapFilterCallback : public btOverlapFilterCallback - { - virtual ~btMultiSapOverlapFilterCallback() - {} - // return true when pairs need collision - virtual bool needBroadphaseCollision(btBroadphaseProxy* childProxy0,btBroadphaseProxy* childProxy1) const - { - btBroadphaseProxy* multiProxy0 = (btBroadphaseProxy*)childProxy0->m_multiSapParentProxy; - btBroadphaseProxy* multiProxy1 = (btBroadphaseProxy*)childProxy1->m_multiSapParentProxy; - - bool collides = (multiProxy0->m_collisionFilterGroup & multiProxy1->m_collisionFilterMask) != 0; - collides = collides && (multiProxy1->m_collisionFilterGroup & multiProxy0->m_collisionFilterMask); - - return collides; - } - }; - - void* mem = btAlignedAlloc(sizeof(btMultiSapOverlapFilterCallback),16); - m_filterCallback = new (mem)btMultiSapOverlapFilterCallback(); - - m_overlappingPairs->setOverlapFilterCallback(m_filterCallback); -// mem = btAlignedAlloc(sizeof(btSimpleBroadphase),16); -// m_simpleBroadphase = new (mem) btSimpleBroadphase(maxProxies,m_overlappingPairs); -} - -btMultiSapBroadphase::~btMultiSapBroadphase() -{ - if (m_ownsPairCache) - { - m_overlappingPairs->~btOverlappingPairCache(); - btAlignedFree(m_overlappingPairs); - } -} - - -void btMultiSapBroadphase::buildTree(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax) -{ - m_optimizedAabbTree = new btQuantizedBvh(); - m_optimizedAabbTree->setQuantizationValues(bvhAabbMin,bvhAabbMax); - QuantizedNodeArray& nodes = m_optimizedAabbTree->getLeafNodeArray(); - for (int i=0;igetBroadphaseAabb(aabbMin,aabbMax); - m_optimizedAabbTree->quantize(&node.m_quantizedAabbMin[0],aabbMin,0); - m_optimizedAabbTree->quantize(&node.m_quantizedAabbMax[0],aabbMax,1); - int partId = 0; - node.m_escapeIndexOrTriangleIndex = (partId<<(31-MAX_NUM_PARTS_IN_BITS)) | i; - nodes.push_back(node); - } - m_optimizedAabbTree->buildInternal(); -} - -btBroadphaseProxy* btMultiSapBroadphase::createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* /*ignoreMe*/) -{ - //void* ignoreMe -> we could think of recursive multi-sap, if someone is interested - - void* mem = btAlignedAlloc(sizeof(btMultiSapProxy),16); - btMultiSapProxy* proxy = new (mem)btMultiSapProxy(aabbMin, aabbMax,shapeType,userPtr, collisionFilterGroup,collisionFilterMask); - m_multiSapProxies.push_back(proxy); - - ///this should deal with inserting/removal into child broadphases - setAabb(proxy,aabbMin,aabbMax,dispatcher); - return proxy; -} - -void btMultiSapBroadphase::destroyProxy(btBroadphaseProxy* /*proxy*/,btDispatcher* /*dispatcher*/) -{ - ///not yet - btAssert(0); - -} - - -void btMultiSapBroadphase::addToChildBroadphase(btMultiSapProxy* parentMultiSapProxy, btBroadphaseProxy* childProxy, btBroadphaseInterface* childBroadphase) -{ - void* mem = btAlignedAlloc(sizeof(btBridgeProxy),16); - btBridgeProxy* bridgeProxyRef = new(mem) btBridgeProxy; - bridgeProxyRef->m_childProxy = childProxy; - bridgeProxyRef->m_childBroadphase = childBroadphase; - parentMultiSapProxy->m_bridgeProxies.push_back(bridgeProxyRef); -} - - -bool boxIsContainedWithinBox(const btVector3& amin,const btVector3& amax,const btVector3& bmin,const btVector3& bmax); -bool boxIsContainedWithinBox(const btVector3& amin,const btVector3& amax,const btVector3& bmin,const btVector3& bmax) -{ -return -amin.getX() >= bmin.getX() && amax.getX() <= bmax.getX() && -amin.getY() >= bmin.getY() && amax.getY() <= bmax.getY() && -amin.getZ() >= bmin.getZ() && amax.getZ() <= bmax.getZ(); -} - - - - - - -void btMultiSapBroadphase::getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const -{ - btMultiSapProxy* multiProxy = static_cast(proxy); - aabbMin = multiProxy->m_aabbMin; - aabbMax = multiProxy->m_aabbMax; -} - -void btMultiSapBroadphase::rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback, const btVector3& aabbMin,const btVector3& aabbMax) -{ - for (int i=0;i - -void btMultiSapBroadphase::setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* dispatcher) -{ - btMultiSapProxy* multiProxy = static_cast(proxy); - multiProxy->m_aabbMin = aabbMin; - multiProxy->m_aabbMax = aabbMax; - - -// bool fullyContained = false; -// bool alreadyInSimple = false; - - - - - struct MyNodeOverlapCallback : public btNodeOverlapCallback - { - btMultiSapBroadphase* m_multiSap; - btMultiSapProxy* m_multiProxy; - btDispatcher* m_dispatcher; - - MyNodeOverlapCallback(btMultiSapBroadphase* multiSap,btMultiSapProxy* multiProxy,btDispatcher* dispatcher) - :m_multiSap(multiSap), - m_multiProxy(multiProxy), - m_dispatcher(dispatcher) - { - - } - - virtual void processNode(int /*nodeSubPart*/, int broadphaseIndex) - { - btBroadphaseInterface* childBroadphase = m_multiSap->getBroadphaseArray()[broadphaseIndex]; - - int containingBroadphaseIndex = -1; - //already found? - for (int i=0;im_bridgeProxies.size();i++) - { - - if (m_multiProxy->m_bridgeProxies[i]->m_childBroadphase == childBroadphase) - { - containingBroadphaseIndex = i; - break; - } - } - if (containingBroadphaseIndex<0) - { - //add it - btBroadphaseProxy* childProxy = childBroadphase->createProxy(m_multiProxy->m_aabbMin,m_multiProxy->m_aabbMax,m_multiProxy->m_shapeType,m_multiProxy->m_clientObject,m_multiProxy->m_collisionFilterGroup,m_multiProxy->m_collisionFilterMask, m_dispatcher,m_multiProxy); - m_multiSap->addToChildBroadphase(m_multiProxy,childProxy,childBroadphase); - - } - } - }; - - MyNodeOverlapCallback myNodeCallback(this,multiProxy,dispatcher); - - - - - if (m_optimizedAabbTree) - m_optimizedAabbTree->reportAabbOverlappingNodex(&myNodeCallback,aabbMin,aabbMax); - - int i; - - for ( i=0;im_bridgeProxies.size();i++) - { - btVector3 worldAabbMin,worldAabbMax; - multiProxy->m_bridgeProxies[i]->m_childBroadphase->getBroadphaseAabb(worldAabbMin,worldAabbMax); - bool overlapsBroadphase = TestAabbAgainstAabb2(worldAabbMin,worldAabbMax,multiProxy->m_aabbMin,multiProxy->m_aabbMax); - if (!overlapsBroadphase) - { - //remove it now - btBridgeProxy* bridgeProxy = multiProxy->m_bridgeProxies[i]; - - btBroadphaseProxy* childProxy = bridgeProxy->m_childProxy; - bridgeProxy->m_childBroadphase->destroyProxy(childProxy,dispatcher); - - multiProxy->m_bridgeProxies.swap( i,multiProxy->m_bridgeProxies.size()-1); - multiProxy->m_bridgeProxies.pop_back(); - - } - } - - - /* - - if (1) - { - - //find broadphase that contain this multiProxy - int numChildBroadphases = getBroadphaseArray().size(); - for (int i=0;igetBroadphaseAabb(worldAabbMin,worldAabbMax); - bool overlapsBroadphase = TestAabbAgainstAabb2(worldAabbMin,worldAabbMax,multiProxy->m_aabbMin,multiProxy->m_aabbMax); - - // fullyContained = fullyContained || boxIsContainedWithinBox(worldAabbMin,worldAabbMax,multiProxy->m_aabbMin,multiProxy->m_aabbMax); - int containingBroadphaseIndex = -1; - - //if already contains this - - for (int i=0;im_bridgeProxies.size();i++) - { - if (multiProxy->m_bridgeProxies[i]->m_childBroadphase == childBroadphase) - { - containingBroadphaseIndex = i; - } - alreadyInSimple = alreadyInSimple || (multiProxy->m_bridgeProxies[i]->m_childBroadphase == m_simpleBroadphase); - } - - if (overlapsBroadphase) - { - if (containingBroadphaseIndex<0) - { - btBroadphaseProxy* childProxy = childBroadphase->createProxy(aabbMin,aabbMax,multiProxy->m_shapeType,multiProxy->m_clientObject,multiProxy->m_collisionFilterGroup,multiProxy->m_collisionFilterMask, dispatcher); - childProxy->m_multiSapParentProxy = multiProxy; - addToChildBroadphase(multiProxy,childProxy,childBroadphase); - } - } else - { - if (containingBroadphaseIndex>=0) - { - //remove - btBridgeProxy* bridgeProxy = multiProxy->m_bridgeProxies[containingBroadphaseIndex]; - - btBroadphaseProxy* childProxy = bridgeProxy->m_childProxy; - bridgeProxy->m_childBroadphase->destroyProxy(childProxy,dispatcher); - - multiProxy->m_bridgeProxies.swap( containingBroadphaseIndex,multiProxy->m_bridgeProxies.size()-1); - multiProxy->m_bridgeProxies.pop_back(); - } - } - } - - - ///If we are in no other child broadphase, stick the proxy in the global 'simple' broadphase (brute force) - ///hopefully we don't end up with many entries here (can assert/provide feedback on stats) - if (0)//!multiProxy->m_bridgeProxies.size()) - { - ///we don't pass the userPtr but our multisap proxy. We need to patch this, before processing an actual collision - ///this is needed to be able to calculate the aabb overlap - btBroadphaseProxy* childProxy = m_simpleBroadphase->createProxy(aabbMin,aabbMax,multiProxy->m_shapeType,multiProxy->m_clientObject,multiProxy->m_collisionFilterGroup,multiProxy->m_collisionFilterMask, dispatcher); - childProxy->m_multiSapParentProxy = multiProxy; - addToChildBroadphase(multiProxy,childProxy,m_simpleBroadphase); - } - } - - if (!multiProxy->m_bridgeProxies.size()) - { - ///we don't pass the userPtr but our multisap proxy. We need to patch this, before processing an actual collision - ///this is needed to be able to calculate the aabb overlap - btBroadphaseProxy* childProxy = m_simpleBroadphase->createProxy(aabbMin,aabbMax,multiProxy->m_shapeType,multiProxy->m_clientObject,multiProxy->m_collisionFilterGroup,multiProxy->m_collisionFilterMask, dispatcher); - childProxy->m_multiSapParentProxy = multiProxy; - addToChildBroadphase(multiProxy,childProxy,m_simpleBroadphase); - } -*/ - - - //update - for ( i=0;im_bridgeProxies.size();i++) - { - btBridgeProxy* bridgeProxyRef = multiProxy->m_bridgeProxies[i]; - bridgeProxyRef->m_childBroadphase->setAabb(bridgeProxyRef->m_childProxy,aabbMin,aabbMax,dispatcher); - } - -} -bool stopUpdating=false; - - - -class btMultiSapBroadphasePairSortPredicate -{ - public: - - bool operator() ( const btBroadphasePair& a1, const btBroadphasePair& b1 ) const - { - btMultiSapBroadphase::btMultiSapProxy* aProxy0 = a1.m_pProxy0 ? (btMultiSapBroadphase::btMultiSapProxy*)a1.m_pProxy0->m_multiSapParentProxy : 0; - btMultiSapBroadphase::btMultiSapProxy* aProxy1 = a1.m_pProxy1 ? (btMultiSapBroadphase::btMultiSapProxy*)a1.m_pProxy1->m_multiSapParentProxy : 0; - btMultiSapBroadphase::btMultiSapProxy* bProxy0 = b1.m_pProxy0 ? (btMultiSapBroadphase::btMultiSapProxy*)b1.m_pProxy0->m_multiSapParentProxy : 0; - btMultiSapBroadphase::btMultiSapProxy* bProxy1 = b1.m_pProxy1 ? (btMultiSapBroadphase::btMultiSapProxy*)b1.m_pProxy1->m_multiSapParentProxy : 0; - - return aProxy0 > bProxy0 || - (aProxy0 == bProxy0 && aProxy1 > bProxy1) || - (aProxy0 == bProxy0 && aProxy1 == bProxy1 && a1.m_algorithm > b1.m_algorithm); - } -}; - - - ///calculateOverlappingPairs is optional: incremental algorithms (sweep and prune) might do it during the set aabb -void btMultiSapBroadphase::calculateOverlappingPairs(btDispatcher* dispatcher) -{ - -// m_simpleBroadphase->calculateOverlappingPairs(dispatcher); - - if (!stopUpdating && getOverlappingPairCache()->hasDeferredRemoval()) - { - - btBroadphasePairArray& overlappingPairArray = getOverlappingPairCache()->getOverlappingPairArray(); - - // quicksort(overlappingPairArray,0,overlappingPairArray.size()); - - overlappingPairArray.quickSort(btMultiSapBroadphasePairSortPredicate()); - - //perform a sort, to find duplicates and to sort 'invalid' pairs to the end - // overlappingPairArray.heapSort(btMultiSapBroadphasePairSortPredicate()); - - overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair); - m_invalidPair = 0; - - - int i; - - btBroadphasePair previousPair; - previousPair.m_pProxy0 = 0; - previousPair.m_pProxy1 = 0; - previousPair.m_algorithm = 0; - - - for (i=0;im_multiSapParentProxy : 0; - btMultiSapProxy* aProxy1 = pair.m_pProxy1 ? (btMultiSapProxy*)pair.m_pProxy1->m_multiSapParentProxy : 0; - btMultiSapProxy* bProxy0 = previousPair.m_pProxy0 ? (btMultiSapProxy*)previousPair.m_pProxy0->m_multiSapParentProxy : 0; - btMultiSapProxy* bProxy1 = previousPair.m_pProxy1 ? (btMultiSapProxy*)previousPair.m_pProxy1->m_multiSapParentProxy : 0; - - bool isDuplicate = (aProxy0 == bProxy0) && (aProxy1 == bProxy1); - - previousPair = pair; - - bool needsRemoval = false; - - if (!isDuplicate) - { - bool hasOverlap = testAabbOverlap(pair.m_pProxy0,pair.m_pProxy1); - - if (hasOverlap) - { - needsRemoval = false;//callback->processOverlap(pair); - } else - { - needsRemoval = true; - } - } else - { - //remove duplicate - needsRemoval = true; - //should have no algorithm - btAssert(!pair.m_algorithm); - } - - if (needsRemoval) - { - getOverlappingPairCache()->cleanOverlappingPair(pair,dispatcher); - - // m_overlappingPairArray.swap(i,m_overlappingPairArray.size()-1); - // m_overlappingPairArray.pop_back(); - pair.m_pProxy0 = 0; - pair.m_pProxy1 = 0; - m_invalidPair++; - gOverlappingPairs--; - } - - } - - ///if you don't like to skip the invalid pairs in the array, execute following code: - #define CLEAN_INVALID_PAIRS 1 - #ifdef CLEAN_INVALID_PAIRS - - //perform a sort, to sort 'invalid' pairs to the end - //overlappingPairArray.heapSort(btMultiSapBroadphasePairSortPredicate()); - overlappingPairArray.quickSort(btMultiSapBroadphasePairSortPredicate()); - - overlappingPairArray.resize(overlappingPairArray.size() - m_invalidPair); - m_invalidPair = 0; - #endif//CLEAN_INVALID_PAIRS - - //printf("overlappingPairArray.size()=%d\n",overlappingPairArray.size()); - } - - -} - - -bool btMultiSapBroadphase::testAabbOverlap(btBroadphaseProxy* childProxy0,btBroadphaseProxy* childProxy1) -{ - btMultiSapProxy* multiSapProxy0 = (btMultiSapProxy*)childProxy0->m_multiSapParentProxy; - btMultiSapProxy* multiSapProxy1 = (btMultiSapProxy*)childProxy1->m_multiSapParentProxy; - - return TestAabbAgainstAabb2(multiSapProxy0->m_aabbMin,multiSapProxy0->m_aabbMax, - multiSapProxy1->m_aabbMin,multiSapProxy1->m_aabbMax); - -} - - -void btMultiSapBroadphase::printStats() -{ -/* printf("---------------------------------\n"); - - printf("btMultiSapBroadphase.h\n"); - printf("numHandles = %d\n",m_multiSapProxies.size()); - //find broadphase that contain this multiProxy - int numChildBroadphases = getBroadphaseArray().size(); - for (int i=0;iprintStats(); - - } - */ - -} - -void btMultiSapBroadphase::resetPool(btDispatcher* dispatcher) -{ - // not yet -} diff --git a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h b/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h deleted file mode 100644 index 7bcfe6b13..000000000 --- a/Engine/lib/bullet/src/BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h +++ /dev/null @@ -1,151 +0,0 @@ -/* -Bullet Continuous Collision Detection and Physics Library -Copyright (c) 2003-2006 Erwin Coumans http://continuousphysics.com/Bullet/ - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the use of this software. -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it freely, -subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. -*/ -#ifndef BT_MULTI_SAP_BROADPHASE -#define BT_MULTI_SAP_BROADPHASE - -#include "btBroadphaseInterface.h" -#include "LinearMath/btAlignedObjectArray.h" -#include "btOverlappingPairCache.h" - - -class btBroadphaseInterface; -class btSimpleBroadphase; - - -typedef btAlignedObjectArray btSapBroadphaseArray; - -///The btMultiSapBroadphase is a research project, not recommended to use in production. Use btAxisSweep3 or btDbvtBroadphase instead. -///The btMultiSapBroadphase is a broadphase that contains multiple SAP broadphases. -///The user can add SAP broadphases that cover the world. A btBroadphaseProxy can be in multiple child broadphases at the same time. -///A btQuantizedBvh acceleration structures finds overlapping SAPs for each btBroadphaseProxy. -///See http://www.continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=328 -///and http://www.continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=1329 -class btMultiSapBroadphase :public btBroadphaseInterface -{ - btSapBroadphaseArray m_sapBroadphases; - - btSimpleBroadphase* m_simpleBroadphase; - - btOverlappingPairCache* m_overlappingPairs; - - class btQuantizedBvh* m_optimizedAabbTree; - - - bool m_ownsPairCache; - - btOverlapFilterCallback* m_filterCallback; - - int m_invalidPair; - - struct btBridgeProxy - { - btBroadphaseProxy* m_childProxy; - btBroadphaseInterface* m_childBroadphase; - }; - - -public: - - struct btMultiSapProxy : public btBroadphaseProxy - { - - ///array with all the entries that this proxy belongs to - btAlignedObjectArray m_bridgeProxies; - btVector3 m_aabbMin; - btVector3 m_aabbMax; - - int m_shapeType; - -/* void* m_userPtr; - short int m_collisionFilterGroup; - short int m_collisionFilterMask; -*/ - btMultiSapProxy(const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask) - :btBroadphaseProxy(aabbMin,aabbMax,userPtr,collisionFilterGroup,collisionFilterMask), - m_aabbMin(aabbMin), - m_aabbMax(aabbMax), - m_shapeType(shapeType) - { - m_multiSapParentProxy =this; - } - - - }; - -protected: - - - btAlignedObjectArray m_multiSapProxies; - -public: - - btMultiSapBroadphase(int maxProxies = 16384,btOverlappingPairCache* pairCache=0); - - - btSapBroadphaseArray& getBroadphaseArray() - { - return m_sapBroadphases; - } - - const btSapBroadphaseArray& getBroadphaseArray() const - { - return m_sapBroadphases; - } - - virtual ~btMultiSapBroadphase(); - - virtual btBroadphaseProxy* createProxy( const btVector3& aabbMin, const btVector3& aabbMax,int shapeType,void* userPtr, short int collisionFilterGroup,short int collisionFilterMask, btDispatcher* dispatcher,void* multiSapProxy); - virtual void destroyProxy(btBroadphaseProxy* proxy,btDispatcher* dispatcher); - virtual void setAabb(btBroadphaseProxy* proxy,const btVector3& aabbMin,const btVector3& aabbMax, btDispatcher* dispatcher); - virtual void getAabb(btBroadphaseProxy* proxy,btVector3& aabbMin, btVector3& aabbMax ) const; - - virtual void rayTest(const btVector3& rayFrom,const btVector3& rayTo, btBroadphaseRayCallback& rayCallback,const btVector3& aabbMin=btVector3(0,0,0),const btVector3& aabbMax=btVector3(0,0,0)); - - void addToChildBroadphase(btMultiSapProxy* parentMultiSapProxy, btBroadphaseProxy* childProxy, btBroadphaseInterface* childBroadphase); - - ///calculateOverlappingPairs is optional: incremental algorithms (sweep and prune) might do it during the set aabb - virtual void calculateOverlappingPairs(btDispatcher* dispatcher); - - bool testAabbOverlap(btBroadphaseProxy* proxy0,btBroadphaseProxy* proxy1); - - virtual btOverlappingPairCache* getOverlappingPairCache() - { - return m_overlappingPairs; - } - virtual const btOverlappingPairCache* getOverlappingPairCache() const - { - return m_overlappingPairs; - } - - ///getAabb returns the axis aligned bounding box in the 'global' coordinate frame - ///will add some transform later - virtual void getBroadphaseAabb(btVector3& aabbMin,btVector3& aabbMax) const - { - aabbMin.setValue(-BT_LARGE_FLOAT,-BT_LARGE_FLOAT,-BT_LARGE_FLOAT); - aabbMax.setValue(BT_LARGE_FLOAT,BT_LARGE_FLOAT,BT_LARGE_FLOAT); - } - - void buildTree(const btVector3& bvhAabbMin,const btVector3& bvhAabbMax); - - virtual void printStats(); - - void quicksort (btBroadphasePairArray& a, int lo, int hi); - - ///reset broadphase internal structures, to ensure determinism/reproducability - virtual void resetPool(btDispatcher* dispatcher); - -}; - -#endif //BT_MULTI_SAP_BROADPHASE From 594866f24ceeeaff7246ef3492911bd72857b36f Mon Sep 17 00:00:00 2001 From: Johxz Date: Wed, 28 Feb 2018 22:15:31 -0600 Subject: [PATCH 009/144] update recast --- .../lib/recast/DebugUtils/Include/DebugDraw.h | 3 + .../recast/DebugUtils/Source/DebugDraw.cpp | 15 +- .../DebugUtils/Source/DetourDebugDraw.cpp | 31 +- .../DebugUtils/Source/RecastDebugDraw.cpp | 18 +- .../lib/recast/Detour/Include/DetourAssert.h | 25 +- .../lib/recast/Detour/Include/DetourCommon.h | 18 + .../lib/recast/Detour/Include/DetourNavMesh.h | 2 +- .../Detour/Include/DetourNavMeshBuilder.h | 3 +- .../Detour/Include/DetourNavMeshQuery.h | 53 +- .../lib/recast/Detour/Source/DetourAssert.cpp | 35 ++ .../lib/recast/Detour/Source/DetourCommon.cpp | 4 +- .../recast/Detour/Source/DetourNavMesh.cpp | 61 +- .../Detour/Source/DetourNavMeshBuilder.cpp | 127 +++-- .../Detour/Source/DetourNavMeshQuery.cpp | 519 +++++++++++------- .../recast/DetourCrowd/Include/DetourCrowd.h | 13 +- .../recast/DetourCrowd/Source/DetourCrowd.cpp | 9 +- .../Source/DetourObstacleAvoidance.cpp | 3 + .../DetourCrowd/Source/DetourPathCorridor.cpp | 4 +- .../Source/DetourProximityGrid.cpp | 1 + .../DetourTileCache/Include/DetourTileCache.h | 52 +- .../Include/DetourTileCacheBuilder.h | 6 + .../Source/DetourTileCache.cpp | 150 ++++- .../Source/DetourTileCacheBuilder.cpp | 102 +++- Engine/lib/recast/README.md | 89 +++ Engine/lib/recast/Recast/Include/Recast.h | 10 +- .../lib/recast/Recast/Include/RecastAlloc.h | 1 - .../lib/recast/Recast/Include/RecastAssert.h | 27 +- Engine/lib/recast/Recast/Source/Recast.cpp | 45 +- .../lib/recast/Recast/Source/RecastAlloc.cpp | 2 + .../lib/recast/Recast/Source/RecastAssert.cpp | 35 ++ .../lib/recast/Recast/Source/RecastLayers.cpp | 65 ++- .../lib/recast/Recast/Source/RecastMesh.cpp | 2 +- .../recast/Recast/Source/RecastMeshDetail.cpp | 5 +- .../lib/recast/Recast/Source/RecastRegion.cpp | 10 +- 34 files changed, 1138 insertions(+), 407 deletions(-) create mode 100644 Engine/lib/recast/Detour/Source/DetourAssert.cpp create mode 100644 Engine/lib/recast/README.md create mode 100644 Engine/lib/recast/Recast/Source/RecastAssert.cpp diff --git a/Engine/lib/recast/DebugUtils/Include/DebugDraw.h b/Engine/lib/recast/DebugUtils/Include/DebugDraw.h index 0b8c59352..00b544d1c 100644 --- a/Engine/lib/recast/DebugUtils/Include/DebugDraw.h +++ b/Engine/lib/recast/DebugUtils/Include/DebugDraw.h @@ -66,6 +66,9 @@ struct duDebugDraw /// End drawing primitives. virtual void end() = 0; + + /// Compute a color for given area. + virtual unsigned int areaToCol(unsigned int area); }; inline unsigned int duRGBA(int r, int g, int b, int a) diff --git a/Engine/lib/recast/DebugUtils/Source/DebugDraw.cpp b/Engine/lib/recast/DebugUtils/Source/DebugDraw.cpp index a009def36..d0179bca2 100644 --- a/Engine/lib/recast/DebugUtils/Source/DebugDraw.cpp +++ b/Engine/lib/recast/DebugUtils/Source/DebugDraw.cpp @@ -20,13 +20,26 @@ #include #include "DebugDraw.h" #include "DetourMath.h" +#include "DetourNavMesh.h" duDebugDraw::~duDebugDraw() { // Empty } - + +unsigned int duDebugDraw::areaToCol(unsigned int area) +{ + if (area == 0) + { + // Treat zero area type as default. + return duRGBA(0, 192, 255, 255); + } + else + { + return duIntToCol(area, 255); + } +} inline int bit(int a, int b) { diff --git a/Engine/lib/recast/DebugUtils/Source/DetourDebugDraw.cpp b/Engine/lib/recast/DebugUtils/Source/DetourDebugDraw.cpp index e2db1078f..dd4bad3fd 100644 --- a/Engine/lib/recast/DebugUtils/Source/DetourDebugDraw.cpp +++ b/Engine/lib/recast/DebugUtils/Source/DetourDebugDraw.cpp @@ -121,6 +121,7 @@ static void drawMeshTile(duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMesh dtPolyRef base = mesh.getPolyRefBase(tile); int tileNum = mesh.decodePolyIdTile(base); + const unsigned int tileColor = duIntToCol(tileNum, 128); dd->depthMask(false); @@ -139,16 +140,9 @@ static void drawMeshTile(duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMesh else { if (flags & DU_DRAWNAVMESH_COLOR_TILES) - { - col = duIntToCol(tileNum, 128); - } + col = tileColor; else - { - if (p->getArea() == 0) // Treat zero area type as default. - col = duRGBA(0,192,255,64); - else - col = duIntToCol(p->getArea(), 64); - } + col = duTransCol(dd->areaToCol(p->getArea()), 64); } for (int j = 0; j < pd->triCount; ++j) @@ -184,8 +178,8 @@ static void drawMeshTile(duDebugDraw* dd, const dtNavMesh& mesh, const dtNavMesh if (query && query->isInClosedList(base | (dtPolyRef)i)) col = duRGBA(255,196,0,220); else - col = duDarkenCol(duIntToCol(p->getArea(), 220)); - + col = duDarkenCol(duTransCol(dd->areaToCol(p->getArea()), 220)); + const dtOffMeshConnection* con = &tile->offMeshCons[i - tile->header->offMeshBase]; const float* va = &tile->verts[p->verts[0]*3]; const float* vb = &tile->verts[p->verts[1]*3]; @@ -451,7 +445,7 @@ void duDebugDrawNavMeshPoly(duDebugDraw* dd, const dtNavMesh& mesh, dtPolyRef re dd->depthMask(false); - const unsigned int c = (col & 0x00ffffff) | (64 << 24); + const unsigned int c = duTransCol(col, 64); const unsigned int ip = (unsigned int)(poly - tile->polys); if (poly->getType() == DT_POLYTYPE_OFFMESH_CONNECTION) @@ -462,7 +456,7 @@ void duDebugDrawNavMeshPoly(duDebugDraw* dd, const dtNavMesh& mesh, dtPolyRef re // Connection arc. duAppendArc(dd, con->pos[0],con->pos[1],con->pos[2], con->pos[3],con->pos[4],con->pos[5], 0.25f, - (con->flags & 1) ? 0.6f : 0, 0.6f, c); + (con->flags & 1) ? 0.6f : 0.0f, 0.6f, c); dd->end(); } @@ -559,15 +553,15 @@ void duDebugDrawTileCacheLayerAreas(struct duDebugDraw* dd, const dtTileCacheLay const int lidx = x+y*w; const int lh = (int)layer.heights[lidx]; if (lh == 0xff) continue; + const unsigned char area = layer.areas[lidx]; - unsigned int col; if (area == 63) col = duLerpCol(color, duRGBA(0,192,255,64), 32); else if (area == 0) col = duLerpCol(color, duRGBA(0,0,0,64), 32); else - col = duLerpCol(color, duIntToCol(area, 255), 32); + col = duLerpCol(color, dd->areaToCol(area), 32); const float fx = bmin[0] + x*cs; const float fy = bmin[1] + (lh+1)*ch; @@ -743,14 +737,15 @@ void duDebugDrawTileCachePolyMesh(duDebugDraw* dd, const struct dtTileCachePolyM for (int i = 0; i < lmesh.npolys; ++i) { const unsigned short* p = &lmesh.polys[i*nvp*2]; + const unsigned char area = lmesh.areas[i]; unsigned int color; - if (lmesh.areas[i] == DT_TILECACHE_WALKABLE_AREA) + if (area == DT_TILECACHE_WALKABLE_AREA) color = duRGBA(0,192,255,64); - else if (lmesh.areas[i] == DT_TILECACHE_NULL_AREA) + else if (area == DT_TILECACHE_NULL_AREA) color = duRGBA(0,0,0,64); else - color = duIntToCol(lmesh.areas[i], 255); + color = dd->areaToCol(area); unsigned short vi[3]; for (int j = 2; j < nvp; ++j) diff --git a/Engine/lib/recast/DebugUtils/Source/RecastDebugDraw.cpp b/Engine/lib/recast/DebugUtils/Source/RecastDebugDraw.cpp index 82050bde0..c1a73a168 100644 --- a/Engine/lib/recast/DebugUtils/Source/RecastDebugDraw.cpp +++ b/Engine/lib/recast/DebugUtils/Source/RecastDebugDraw.cpp @@ -198,7 +198,7 @@ void duDebugDrawHeightfieldWalkable(duDebugDraw* dd, const rcHeightfield& hf) else if (s->area == RC_NULL_AREA) fcol[0] = duRGBA(64,64,64,255); else - fcol[0] = duMultCol(duIntToCol(s->area, 255), 200); + fcol[0] = duMultCol(dd->areaToCol(s->area), 200); duAppendBox(dd, fx, orig[1]+s->smin*ch, fz, fx+cs, orig[1] + s->smax*ch, fz+cs, fcol); s = s->next; @@ -230,13 +230,14 @@ void duDebugDrawCompactHeightfieldSolid(duDebugDraw* dd, const rcCompactHeightfi { const rcCompactSpan& s = chf.spans[i]; + const unsigned char area = chf.areas[i]; unsigned int color; - if (chf.areas[i] == RC_WALKABLE_AREA) + if (area == RC_WALKABLE_AREA) color = duRGBA(0,192,255,64); - else if (chf.areas[i] == RC_NULL_AREA) + else if (area == RC_NULL_AREA) color = duRGBA(0,0,0,64); else - color = duIntToCol(chf.areas[i], 255); + color = dd->areaToCol(area); const float fy = chf.bmin[1] + (s.y+1)*ch; dd->vertex(fx, fy, fz, color); @@ -403,7 +404,7 @@ void duDebugDrawHeightfieldLayer(duDebugDraw* dd, const struct rcHeightfieldLaye else if (area == RC_NULL_AREA) col = duLerpCol(color, duRGBA(0,0,0,64), 32); else - col = duLerpCol(color, duIntToCol(area, 255), 32); + col = duLerpCol(color, dd->areaToCol(area), 32); const float fx = layer.bmin[0] + x*cs; const float fy = layer.bmin[1] + (lh+1)*ch; @@ -866,14 +867,15 @@ void duDebugDrawPolyMesh(duDebugDraw* dd, const struct rcPolyMesh& mesh) for (int i = 0; i < mesh.npolys; ++i) { const unsigned short* p = &mesh.polys[i*nvp*2]; + const unsigned char area = mesh.areas[i]; unsigned int color; - if (mesh.areas[i] == RC_WALKABLE_AREA) + if (area == RC_WALKABLE_AREA) color = duRGBA(0,192,255,64); - else if (mesh.areas[i] == RC_NULL_AREA) + else if (area == RC_NULL_AREA) color = duRGBA(0,0,0,64); else - color = duIntToCol(mesh.areas[i], 255); + color = dd->areaToCol(area); unsigned short vi[3]; for (int j = 2; j < nvp; ++j) diff --git a/Engine/lib/recast/Detour/Include/DetourAssert.h b/Engine/lib/recast/Detour/Include/DetourAssert.h index 3cf652288..e05fd66fa 100644 --- a/Engine/lib/recast/Detour/Include/DetourAssert.h +++ b/Engine/lib/recast/Detour/Include/DetourAssert.h @@ -23,11 +23,34 @@ // Feel free to change the file and include your own implementation instead. #ifdef NDEBUG + // From http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/ # define dtAssert(x) do { (void)sizeof(x); } while((void)(__LINE__==-1),false) + #else + +/// An assertion failure function. +// @param[in] expression asserted expression. +// @param[in] file Filename of the failed assertion. +// @param[in] line Line number of the failed assertion. +/// @see dtAssertFailSetCustom +typedef void (dtAssertFailFunc)(const char* expression, const char* file, int line); + +/// Sets the base custom assertion failure function to be used by Detour. +/// @param[in] assertFailFunc The function to be invoked in case of failure of #dtAssert +void dtAssertFailSetCustom(dtAssertFailFunc *assertFailFunc); + +/// Gets the base custom assertion failure function to be used by Detour. +dtAssertFailFunc* dtAssertFailGetCustom(); + # include -# define dtAssert assert +# define dtAssert(expression) \ + { \ + dtAssertFailFunc* failFunc = dtAssertFailGetCustom(); \ + if(failFunc == NULL) { assert(expression); } \ + else if(!(expression)) { (*failFunc)(#expression, __FILE__, __LINE__); } \ + } + #endif #endif // DETOURASSERT_H diff --git a/Engine/lib/recast/Detour/Include/DetourCommon.h b/Engine/lib/recast/Detour/Include/DetourCommon.h index 2afba0d78..739858cd9 100644 --- a/Engine/lib/recast/Detour/Include/DetourCommon.h +++ b/Engine/lib/recast/Detour/Include/DetourCommon.h @@ -20,6 +20,7 @@ #define DETOURCOMMON_H #include "DetourMath.h" +#include /** @defgroup detour Detour @@ -482,6 +483,23 @@ inline void dtSwapEndian(float* v) void dtRandomPointInConvexPoly(const float* pts, const int npts, float* areas, const float s, const float t, float* out); +template +TypeToRetrieveAs* dtGetThenAdvanceBufferPointer(const unsigned char*& buffer, const size_t distanceToAdvance) +{ + TypeToRetrieveAs* returnPointer = reinterpret_cast(buffer); + buffer += distanceToAdvance; + return returnPointer; +} + +template +TypeToRetrieveAs* dtGetThenAdvanceBufferPointer(unsigned char*& buffer, const size_t distanceToAdvance) +{ + TypeToRetrieveAs* returnPointer = reinterpret_cast(buffer); + buffer += distanceToAdvance; + return returnPointer; +} + + /// @} #endif // DETOURCOMMON_H diff --git a/Engine/lib/recast/Detour/Include/DetourNavMesh.h b/Engine/lib/recast/Detour/Include/DetourNavMesh.h index 8ecd57e46..02ee5e78c 100644 --- a/Engine/lib/recast/Detour/Include/DetourNavMesh.h +++ b/Engine/lib/recast/Detour/Include/DetourNavMesh.h @@ -635,7 +635,7 @@ private: dtPolyRef* polys, const int maxPolys) const; /// Find nearest polygon within a tile. dtPolyRef findNearestPolyInTile(const dtMeshTile* tile, const float* center, - const float* extents, float* nearestPt) const; + const float* halfExtents, float* nearestPt) const; /// Returns closest point on polygon. void closestPointOnPoly(dtPolyRef ref, const float* pos, float* closest, bool* posOverPoly) const; diff --git a/Engine/lib/recast/Detour/Include/DetourNavMeshBuilder.h b/Engine/lib/recast/Detour/Include/DetourNavMeshBuilder.h index c80d17176..9425a7a78 100644 --- a/Engine/lib/recast/Detour/Include/DetourNavMeshBuilder.h +++ b/Engine/lib/recast/Detour/Include/DetourNavMeshBuilder.h @@ -145,4 +145,5 @@ function. @see dtCreateNavMeshData -*/ \ No newline at end of file +*/ + diff --git a/Engine/lib/recast/Detour/Include/DetourNavMeshQuery.h b/Engine/lib/recast/Detour/Include/DetourNavMeshQuery.h index ad425fb0c..1c23e4857 100644 --- a/Engine/lib/recast/Detour/Include/DetourNavMeshQuery.h +++ b/Engine/lib/recast/Detour/Include/DetourNavMeshQuery.h @@ -148,7 +148,18 @@ struct dtRaycastHit float pathCost; }; +/// Provides custom polygon query behavior. +/// Used by dtNavMeshQuery::queryPolygons. +/// @ingroup detour +class dtPolyQuery +{ +public: + virtual ~dtPolyQuery() { } + /// Called for each batch of unique polygons touched by the search area in dtNavMeshQuery::queryPolygons. + /// This can be called multiple times for a single query. + virtual void process(const dtMeshTile* tile, dtPoly** polys, dtPolyRef* refs, int count) = 0; +}; /// Provides the ability to perform pathfinding related queries against /// a navigation mesh. @@ -182,7 +193,7 @@ public: const float* startPos, const float* endPos, const dtQueryFilter* filter, dtPolyRef* path, int* pathCount, const int maxPath) const; - + /// Finds the straight path from the start to the end position within the polygon corridor. /// @param[in] startPos Path start position. [(x, y, z)] /// @param[in] endPos Path end position. [(x, y, z)] @@ -285,33 +296,55 @@ public: dtPolyRef* resultRef, dtPolyRef* resultParent, float* resultCost, int* resultCount, const int maxResult) const; + /// Gets a path from the explored nodes in the previous search. + /// @param[in] endRef The reference id of the end polygon. + /// @param[out] path An ordered list of polygon references representing the path. (Start to end.) + /// [(polyRef) * @p pathCount] + /// @param[out] pathCount The number of polygons returned in the @p path array. + /// @param[in] maxPath The maximum number of polygons the @p path array can hold. [Limit: >= 0] + /// @returns The status flags. Returns DT_FAILURE | DT_INVALID_PARAM if any parameter is wrong, or if + /// @p endRef was not explored in the previous search. Returns DT_SUCCESS | DT_BUFFER_TOO_SMALL + /// if @p path cannot contain the entire path. In this case it is filled to capacity with a partial path. + /// Otherwise returns DT_SUCCESS. + /// @remarks The result of this function depends on the state of the query object. For that reason it should only + /// be used immediately after one of the two Dijkstra searches, findPolysAroundCircle or findPolysAroundShape. + dtStatus getPathFromDijkstraSearch(dtPolyRef endRef, dtPolyRef* path, int* pathCount, int maxPath) const; + /// @} /// @name Local Query Functions ///@{ /// Finds the polygon nearest to the specified center point. /// @param[in] center The center of the search box. [(x, y, z)] - /// @param[in] extents The search distance along each axis. [(x, y, z)] + /// @param[in] halfExtents The search distance along each axis. [(x, y, z)] /// @param[in] filter The polygon filter to apply to the query. /// @param[out] nearestRef The reference id of the nearest polygon. /// @param[out] nearestPt The nearest point on the polygon. [opt] [(x, y, z)] /// @returns The status flags for the query. - dtStatus findNearestPoly(const float* center, const float* extents, + dtStatus findNearestPoly(const float* center, const float* halfExtents, const dtQueryFilter* filter, dtPolyRef* nearestRef, float* nearestPt) const; /// Finds polygons that overlap the search box. /// @param[in] center The center of the search box. [(x, y, z)] - /// @param[in] extents The search distance along each axis. [(x, y, z)] + /// @param[in] halfExtents The search distance along each axis. [(x, y, z)] /// @param[in] filter The polygon filter to apply to the query. /// @param[out] polys The reference ids of the polygons that overlap the query box. /// @param[out] polyCount The number of polygons in the search result. /// @param[in] maxPolys The maximum number of polygons the search result can hold. /// @returns The status flags for the query. - dtStatus queryPolygons(const float* center, const float* extents, + dtStatus queryPolygons(const float* center, const float* halfExtents, const dtQueryFilter* filter, dtPolyRef* polys, int* polyCount, const int maxPolys) const; + /// Finds polygons that overlap the search box. + /// @param[in] center The center of the search box. [(x, y, z)] + /// @param[in] halfExtents The search distance along each axis. [(x, y, z)] + /// @param[in] filter The polygon filter to apply to the query. + /// @param[in] query The query. Polygons found will be batched together and passed to this query. + dtStatus queryPolygons(const float* center, const float* halfExtents, + const dtQueryFilter* filter, dtPolyQuery* query) const; + /// Finds the non-overlapping navigation polygons in the local neighbourhood around the center position. /// @param[in] startRef The reference id of the polygon where the search starts. /// @param[in] centerPos The center of the query circle. [(x, y, z)] @@ -479,12 +512,9 @@ private: dtNavMeshQuery(const dtNavMeshQuery&); dtNavMeshQuery& operator=(const dtNavMeshQuery&); - /// Returns neighbour tile based on side. - dtMeshTile* getNeighbourTileAt(int x, int y, int side) const; - /// Queries polygons within a tile. - int queryPolygonsInTile(const dtMeshTile* tile, const float* qmin, const float* qmax, const dtQueryFilter* filter, - dtPolyRef* polys, const int maxPolys) const; + void queryPolygonsInTile(const dtMeshTile* tile, const float* qmin, const float* qmax, + const dtQueryFilter* filter, dtPolyQuery* query) const; /// Returns portal points between two polygons. dtStatus getPortalPoints(dtPolyRef from, dtPolyRef to, float* left, float* right, @@ -508,6 +538,9 @@ private: dtStatus appendPortals(const int startIdx, const int endIdx, const float* endPos, const dtPolyRef* path, float* straightPath, unsigned char* straightPathFlags, dtPolyRef* straightPathRefs, int* straightPathCount, const int maxStraightPath, const int options) const; + + // Gets the path leading to the specified end node. + dtStatus getPathToNode(struct dtNode* endNode, dtPolyRef* path, int* pathCount, int maxPath) const; const dtNavMesh* m_nav; ///< Pointer to navmesh data. diff --git a/Engine/lib/recast/Detour/Source/DetourAssert.cpp b/Engine/lib/recast/Detour/Source/DetourAssert.cpp new file mode 100644 index 000000000..5e019e0cf --- /dev/null +++ b/Engine/lib/recast/Detour/Source/DetourAssert.cpp @@ -0,0 +1,35 @@ +// +// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. +// + +#include "DetourAssert.h" + +#ifndef NDEBUG + +static dtAssertFailFunc* sAssertFailFunc = 0; + +void dtAssertFailSetCustom(dtAssertFailFunc *assertFailFunc) +{ + sAssertFailFunc = assertFailFunc; +} + +dtAssertFailFunc* dtAssertFailGetCustom() +{ + return sAssertFailFunc; +} + +#endif diff --git a/Engine/lib/recast/Detour/Source/DetourCommon.cpp b/Engine/lib/recast/Detour/Source/DetourCommon.cpp index 26fe65c17..41d0d7bd3 100644 --- a/Engine/lib/recast/Detour/Source/DetourCommon.cpp +++ b/Engine/lib/recast/Detour/Source/DetourCommon.cpp @@ -342,8 +342,8 @@ void dtRandomPointInConvexPoly(const float* pts, const int npts, float* areas, // Find sub triangle weighted by area. const float thr = s*areasum; float acc = 0.0f; - float u = 0.0f; - int tri = 0; + float u = 1.0f; + int tri = npts - 1; for (int i = 2; i < npts; i++) { const float dacc = areas[i]; if (thr >= acc && thr < (acc+dacc)) diff --git a/Engine/lib/recast/Detour/Source/DetourNavMesh.cpp b/Engine/lib/recast/Detour/Source/DetourNavMesh.cpp index bb6c9e4b7..b81a2567b 100644 --- a/Engine/lib/recast/Detour/Source/DetourNavMesh.cpp +++ b/Engine/lib/recast/Detour/Source/DetourNavMesh.cpp @@ -304,7 +304,7 @@ int dtNavMesh::findConnectingPolys(const float* va, const float* vb, if (!tile) return 0; float amin[2], amax[2]; - calcSlabEndPoints(va,vb, amin,amax, side); + calcSlabEndPoints(va, vb, amin, amax, side); const float apos = getSlabCoord(va, side); // Remove links pointing to 'side' and compact the links array. @@ -470,12 +470,12 @@ void dtNavMesh::connectExtOffMeshLinks(dtMeshTile* tile, dtMeshTile* target, int if (targetPoly->firstLink == DT_NULL_LINK) continue; - const float ext[3] = { targetCon->rad, target->header->walkableClimb, targetCon->rad }; + const float halfExtents[3] = { targetCon->rad, target->header->walkableClimb, targetCon->rad }; // Find polygon to connect to. const float* p = &targetCon->pos[3]; float nearestPt[3]; - dtPolyRef ref = findNearestPolyInTile(tile, p, ext, nearestPt); + dtPolyRef ref = findNearestPolyInTile(tile, p, halfExtents, nearestPt); if (!ref) continue; // findNearestPoly may return too optimistic results, further check to make sure. @@ -570,12 +570,12 @@ void dtNavMesh::baseOffMeshLinks(dtMeshTile* tile) dtOffMeshConnection* con = &tile->offMeshCons[i]; dtPoly* poly = &tile->polys[con->poly]; - const float ext[3] = { con->rad, tile->header->walkableClimb, con->rad }; + const float halfExtents[3] = { con->rad, tile->header->walkableClimb, con->rad }; // Find polygon to connect to. const float* p = &con->pos[0]; // First vertex float nearestPt[3]; - dtPolyRef ref = findNearestPolyInTile(tile, p, ext, nearestPt); + dtPolyRef ref = findNearestPolyInTile(tile, p, halfExtents, nearestPt); if (!ref) continue; // findNearestPoly may return too optimistic results, further check to make sure. if (dtSqr(nearestPt[0]-p[0])+dtSqr(nearestPt[2]-p[2]) > dtSqr(con->rad)) @@ -651,9 +651,9 @@ void dtNavMesh::closestPointOnPoly(dtPolyRef ref, const float* pos, float* close if (!dtDistancePtPolyEdgesSqr(pos, verts, nv, edged, edget)) { // Point is outside the polygon, dtClamp to nearest edge. - float dmin = FLT_MAX; - int imin = -1; - for (int i = 0; i < nv; ++i) + float dmin = edged[0]; + int imin = 0; + for (int i = 1; i < nv; ++i) { if (edged[i] < dmin) { @@ -687,7 +687,7 @@ void dtNavMesh::closestPointOnPoly(dtPolyRef ref, const float* pos, float* close v[k] = &tile->detailVerts[(pd->vertBase+(t[k]-poly->vertCount))*3]; } float h; - if (dtClosestHeightPointTriangle(pos, v[0], v[1], v[2], h)) + if (dtClosestHeightPointTriangle(closest, v[0], v[1], v[2], h)) { closest[1] = h; break; @@ -696,12 +696,12 @@ void dtNavMesh::closestPointOnPoly(dtPolyRef ref, const float* pos, float* close } dtPolyRef dtNavMesh::findNearestPolyInTile(const dtMeshTile* tile, - const float* center, const float* extents, + const float* center, const float* halfExtents, float* nearestPt) const { float bmin[3], bmax[3]; - dtVsub(bmin, center, extents); - dtVadd(bmax, center, extents); + dtVsub(bmin, center, halfExtents); + dtVadd(bmax, center, halfExtents); // Get nearby polygons from proximity grid. dtPolyRef polys[128]; @@ -917,14 +917,14 @@ dtStatus dtNavMesh::addTile(unsigned char* data, int dataSize, int flags, const int offMeshLinksSize = dtAlign4(sizeof(dtOffMeshConnection)*header->offMeshConCount); unsigned char* d = data + headerSize; - tile->verts = (float*)d; d += vertsSize; - tile->polys = (dtPoly*)d; d += polysSize; - tile->links = (dtLink*)d; d += linksSize; - tile->detailMeshes = (dtPolyDetail*)d; d += detailMeshesSize; - tile->detailVerts = (float*)d; d += detailVertsSize; - tile->detailTris = (unsigned char*)d; d += detailTrisSize; - tile->bvTree = (dtBVNode*)d; d += bvtreeSize; - tile->offMeshCons = (dtOffMeshConnection*)d; d += offMeshLinksSize; + tile->verts = dtGetThenAdvanceBufferPointer(d, vertsSize); + tile->polys = dtGetThenAdvanceBufferPointer(d, polysSize); + tile->links = dtGetThenAdvanceBufferPointer(d, linksSize); + tile->detailMeshes = dtGetThenAdvanceBufferPointer(d, detailMeshesSize); + tile->detailVerts = dtGetThenAdvanceBufferPointer(d, detailVertsSize); + tile->detailTris = dtGetThenAdvanceBufferPointer(d, detailTrisSize); + tile->bvTree = dtGetThenAdvanceBufferPointer(d, bvtreeSize); + tile->offMeshCons = dtGetThenAdvanceBufferPointer(d, offMeshLinksSize); // If there are no items in the bvtree, reset the tree pointer. if (!bvtreeSize) @@ -943,7 +943,10 @@ dtStatus dtNavMesh::addTile(unsigned char* data, int dataSize, int flags, tile->flags = flags; connectIntLinks(tile); + + // Base off-mesh connections to their starting polygons and connect connections inside the tile. baseOffMeshLinks(tile); + connectExtOffMeshLinks(tile, tile, -1); // Create connections with neighbour tiles. static const int MAX_NEIS = 32; @@ -954,11 +957,11 @@ dtStatus dtNavMesh::addTile(unsigned char* data, int dataSize, int flags, nneis = getTilesAt(header->x, header->y, neis, MAX_NEIS); for (int j = 0; j < nneis; ++j) { - if (neis[j] != tile) - { - connectExtLinks(tile, neis[j], -1); - connectExtLinks(neis[j], tile, -1); - } + if (neis[j] == tile) + continue; + + connectExtLinks(tile, neis[j], -1); + connectExtLinks(neis[j], tile, -1); connectExtOffMeshLinks(tile, neis[j], -1); connectExtOffMeshLinks(neis[j], tile, -1); } @@ -1322,8 +1325,8 @@ dtStatus dtNavMesh::storeTileState(const dtMeshTile* tile, unsigned char* data, if (maxDataSize < sizeReq) return DT_FAILURE | DT_BUFFER_TOO_SMALL; - dtTileState* tileState = (dtTileState*)data; data += dtAlign4(sizeof(dtTileState)); - dtPolyState* polyStates = (dtPolyState*)data; data += dtAlign4(sizeof(dtPolyState) * tile->header->polyCount); + dtTileState* tileState = dtGetThenAdvanceBufferPointer(data, dtAlign4(sizeof(dtTileState))); + dtPolyState* polyStates = dtGetThenAdvanceBufferPointer(data, dtAlign4(sizeof(dtPolyState) * tile->header->polyCount)); // Store tile state. tileState->magic = DT_NAVMESH_STATE_MAGIC; @@ -1354,8 +1357,8 @@ dtStatus dtNavMesh::restoreTileState(dtMeshTile* tile, const unsigned char* data if (maxDataSize < sizeReq) return DT_FAILURE | DT_INVALID_PARAM; - const dtTileState* tileState = (const dtTileState*)data; data += dtAlign4(sizeof(dtTileState)); - const dtPolyState* polyStates = (const dtPolyState*)data; data += dtAlign4(sizeof(dtPolyState) * tile->header->polyCount); + const dtTileState* tileState = dtGetThenAdvanceBufferPointer(data, dtAlign4(sizeof(dtTileState))); + const dtPolyState* polyStates = dtGetThenAdvanceBufferPointer(data, dtAlign4(sizeof(dtPolyState) * tile->header->polyCount)); // Check that the restore is possible. if (tileState->magic != DT_NAVMESH_STATE_MAGIC) diff --git a/Engine/lib/recast/Detour/Source/DetourNavMeshBuilder.cpp b/Engine/lib/recast/Detour/Source/DetourNavMeshBuilder.cpp index 1bf271bed..e93a97629 100644 --- a/Engine/lib/recast/Detour/Source/DetourNavMeshBuilder.cpp +++ b/Engine/lib/recast/Detour/Source/DetourNavMeshBuilder.cpp @@ -106,7 +106,6 @@ inline int longestAxis(unsigned short x, unsigned short y, unsigned short z) if (z > maxVal) { axis = 2; - maxVal = z; } return axis; } @@ -169,45 +168,72 @@ static void subdivide(BVItem* items, int nitems, int imin, int imax, int& curNod } } -static int createBVTree(const unsigned short* verts, const int /*nverts*/, - const unsigned short* polys, const int npolys, const int nvp, - const float cs, const float ch, - const int /*nnodes*/, dtBVNode* nodes) +static int createBVTree(dtNavMeshCreateParams* params, dtBVNode* nodes, int /*nnodes*/) { // Build tree - BVItem* items = (BVItem*)dtAlloc(sizeof(BVItem)*npolys, DT_ALLOC_TEMP); - for (int i = 0; i < npolys; i++) + float quantFactor = 1 / params->cs; + BVItem* items = (BVItem*)dtAlloc(sizeof(BVItem)*params->polyCount, DT_ALLOC_TEMP); + for (int i = 0; i < params->polyCount; i++) { BVItem& it = items[i]; it.i = i; - // Calc polygon bounds. - const unsigned short* p = &polys[i*nvp*2]; - it.bmin[0] = it.bmax[0] = verts[p[0]*3+0]; - it.bmin[1] = it.bmax[1] = verts[p[0]*3+1]; - it.bmin[2] = it.bmax[2] = verts[p[0]*3+2]; - - for (int j = 1; j < nvp; ++j) + // Calc polygon bounds. Use detail meshes if available. + if (params->detailMeshes) { - if (p[j] == MESH_NULL_IDX) break; - unsigned short x = verts[p[j]*3+0]; - unsigned short y = verts[p[j]*3+1]; - unsigned short z = verts[p[j]*3+2]; - - if (x < it.bmin[0]) it.bmin[0] = x; - if (y < it.bmin[1]) it.bmin[1] = y; - if (z < it.bmin[2]) it.bmin[2] = z; - - if (x > it.bmax[0]) it.bmax[0] = x; - if (y > it.bmax[1]) it.bmax[1] = y; - if (z > it.bmax[2]) it.bmax[2] = z; + int vb = (int)params->detailMeshes[i*4+0]; + int ndv = (int)params->detailMeshes[i*4+1]; + float bmin[3]; + float bmax[3]; + + const float* dv = ¶ms->detailVerts[vb*3]; + dtVcopy(bmin, dv); + dtVcopy(bmax, dv); + + for (int j = 1; j < ndv; j++) + { + dtVmin(bmin, &dv[j * 3]); + dtVmax(bmax, &dv[j * 3]); + } + + // BV-tree uses cs for all dimensions + it.bmin[0] = (unsigned short)dtClamp((int)((bmin[0] - params->bmin[0])*quantFactor), 0, 0xffff); + it.bmin[1] = (unsigned short)dtClamp((int)((bmin[1] - params->bmin[1])*quantFactor), 0, 0xffff); + it.bmin[2] = (unsigned short)dtClamp((int)((bmin[2] - params->bmin[2])*quantFactor), 0, 0xffff); + + it.bmax[0] = (unsigned short)dtClamp((int)((bmax[0] - params->bmin[0])*quantFactor), 0, 0xffff); + it.bmax[1] = (unsigned short)dtClamp((int)((bmax[1] - params->bmin[1])*quantFactor), 0, 0xffff); + it.bmax[2] = (unsigned short)dtClamp((int)((bmax[2] - params->bmin[2])*quantFactor), 0, 0xffff); + } + else + { + const unsigned short* p = ¶ms->polys[i*params->nvp * 2]; + it.bmin[0] = it.bmax[0] = params->verts[p[0] * 3 + 0]; + it.bmin[1] = it.bmax[1] = params->verts[p[0] * 3 + 1]; + it.bmin[2] = it.bmax[2] = params->verts[p[0] * 3 + 2]; + + for (int j = 1; j < params->nvp; ++j) + { + if (p[j] == MESH_NULL_IDX) break; + unsigned short x = params->verts[p[j] * 3 + 0]; + unsigned short y = params->verts[p[j] * 3 + 1]; + unsigned short z = params->verts[p[j] * 3 + 2]; + + if (x < it.bmin[0]) it.bmin[0] = x; + if (y < it.bmin[1]) it.bmin[1] = y; + if (z < it.bmin[2]) it.bmin[2] = z; + + if (x > it.bmax[0]) it.bmax[0] = x; + if (y > it.bmax[1]) it.bmax[1] = y; + if (z > it.bmax[2]) it.bmax[2] = z; + } + // Remap y + it.bmin[1] = (unsigned short)dtMathFloorf((float)it.bmin[1] * params->ch / params->cs); + it.bmax[1] = (unsigned short)dtMathCeilf((float)it.bmax[1] * params->ch / params->cs); } - // Remap y - it.bmin[1] = (unsigned short)dtMathFloorf((float)it.bmin[1]*ch/cs); - it.bmax[1] = (unsigned short)dtMathCeilf((float)it.bmax[1]*ch/cs); } int curNode = 0; - subdivide(items, npolys, 0, npolys, curNode, nodes); + subdivide(items, params->polyCount, 0, params->polyCount, curNode, nodes); dtFree(items); @@ -421,15 +447,16 @@ bool dtCreateNavMeshData(dtNavMeshCreateParams* params, unsigned char** outData, memset(data, 0, dataSize); unsigned char* d = data; - dtMeshHeader* header = (dtMeshHeader*)d; d += headerSize; - float* navVerts = (float*)d; d += vertsSize; - dtPoly* navPolys = (dtPoly*)d; d += polysSize; - d += linksSize; - dtPolyDetail* navDMeshes = (dtPolyDetail*)d; d += detailMeshesSize; - float* navDVerts = (float*)d; d += detailVertsSize; - unsigned char* navDTris = (unsigned char*)d; d += detailTrisSize; - dtBVNode* navBvtree = (dtBVNode*)d; d += bvTreeSize; - dtOffMeshConnection* offMeshCons = (dtOffMeshConnection*)d; d += offMeshConsSize; + + dtMeshHeader* header = dtGetThenAdvanceBufferPointer(d, headerSize); + float* navVerts = dtGetThenAdvanceBufferPointer(d, vertsSize); + dtPoly* navPolys = dtGetThenAdvanceBufferPointer(d, polysSize); + d += linksSize; // Ignore links; just leave enough space for them. They'll be created on load. + dtPolyDetail* navDMeshes = dtGetThenAdvanceBufferPointer(d, detailMeshesSize); + float* navDVerts = dtGetThenAdvanceBufferPointer(d, detailVertsSize); + unsigned char* navDTris = dtGetThenAdvanceBufferPointer(d, detailTrisSize); + dtBVNode* navBvtree = dtGetThenAdvanceBufferPointer(d, bvTreeSize); + dtOffMeshConnection* offMeshCons = dtGetThenAdvanceBufferPointer(d, offMeshConsSize); // Store header @@ -595,11 +622,9 @@ bool dtCreateNavMeshData(dtNavMeshCreateParams* params, unsigned char** outData, } // Store and create BVtree. - // TODO: take detail mesh into account! use byte per bbox extent? if (params->buildBvTree) { - createBVTree(params->verts, params->vertCount, params->polys, params->polyCount, - nvp, params->cs, params->ch, params->polyCount*2, navBvtree); + createBVTree(params, navBvtree, 2*params->polyCount); } // Store Off-Mesh connections. @@ -705,14 +730,16 @@ bool dtNavMeshDataSwapEndian(unsigned char* data, const int /*dataSize*/) const int offMeshLinksSize = dtAlign4(sizeof(dtOffMeshConnection)*header->offMeshConCount); unsigned char* d = data + headerSize; - float* verts = (float*)d; d += vertsSize; - dtPoly* polys = (dtPoly*)d; d += polysSize; - /*dtLink* links = (dtLink*)d;*/ d += linksSize; - dtPolyDetail* detailMeshes = (dtPolyDetail*)d; d += detailMeshesSize; - float* detailVerts = (float*)d; d += detailVertsSize; - /*unsigned char* detailTris = (unsigned char*)d;*/ d += detailTrisSize; - dtBVNode* bvTree = (dtBVNode*)d; d += bvtreeSize; - dtOffMeshConnection* offMeshCons = (dtOffMeshConnection*)d; d += offMeshLinksSize; + float* verts = dtGetThenAdvanceBufferPointer(d, vertsSize); + dtPoly* polys = dtGetThenAdvanceBufferPointer(d, polysSize); + d += linksSize; // Ignore links; they technically should be endian-swapped but all their data is overwritten on load anyway. + //dtLink* links = dtGetThenAdvanceBufferPointer(d, linksSize); + dtPolyDetail* detailMeshes = dtGetThenAdvanceBufferPointer(d, detailMeshesSize); + float* detailVerts = dtGetThenAdvanceBufferPointer(d, detailVertsSize); + d += detailTrisSize; // Ignore detail tris; single bytes can't be endian-swapped. + //unsigned char* detailTris = dtGetThenAdvanceBufferPointer(d, detailTrisSize); + dtBVNode* bvTree = dtGetThenAdvanceBufferPointer(d, bvtreeSize); + dtOffMeshConnection* offMeshCons = dtGetThenAdvanceBufferPointer(d, offMeshLinksSize); // Vertices for (int i = 0; i < header->vertCount*3; ++i) diff --git a/Engine/lib/recast/Detour/Source/DetourNavMeshQuery.cpp b/Engine/lib/recast/Detour/Source/DetourNavMeshQuery.cpp index 87706c1de..90999f2f6 100644 --- a/Engine/lib/recast/Detour/Source/DetourNavMeshQuery.cpp +++ b/Engine/lib/recast/Detour/Source/DetourNavMeshQuery.cpp @@ -542,9 +542,9 @@ dtStatus dtNavMeshQuery::closestPointOnPoly(dtPolyRef ref, const float* pos, flo if (!dtDistancePtPolyEdgesSqr(pos, verts, nv, edged, edget)) { // Point is outside the polygon, dtClamp to nearest edge. - float dmin = FLT_MAX; - int imin = -1; - for (int i = 0; i < nv; ++i) + float dmin = edged[0]; + int imin = 0; + for (int i = 1; i < nv; ++i) { if (edged[i] < dmin) { @@ -578,7 +578,7 @@ dtStatus dtNavMeshQuery::closestPointOnPoly(dtPolyRef ref, const float* pos, flo v[k] = &tile->detailVerts[(pd->vertBase+(t[k]-poly->vertCount))*3]; } float h; - if (dtClosestHeightPointTriangle(pos, v[0], v[1], v[2], h)) + if (dtClosestHeightPointTriangle(closest, v[0], v[1], v[2], h)) { closest[1] = h; break; @@ -628,9 +628,9 @@ dtStatus dtNavMeshQuery::closestPointOnPolyBoundary(dtPolyRef ref, const float* else { // Point is outside the polygon, dtClamp to nearest edge. - float dmin = FLT_MAX; - int imin = -1; - for (int i = 0; i < nv; ++i) + float dmin = edged[0]; + int imin = 0; + for (int i = 1; i < nv; ++i) { if (edged[i] < dmin) { @@ -699,16 +699,67 @@ dtStatus dtNavMeshQuery::getPolyHeight(dtPolyRef ref, const float* pos, float* h return DT_FAILURE | DT_INVALID_PARAM; } +class dtFindNearestPolyQuery : public dtPolyQuery +{ + const dtNavMeshQuery* m_query; + const float* m_center; + float m_nearestDistanceSqr; + dtPolyRef m_nearestRef; + float m_nearestPoint[3]; + +public: + dtFindNearestPolyQuery(const dtNavMeshQuery* query, const float* center) + : m_query(query), m_center(center), m_nearestDistanceSqr(FLT_MAX), m_nearestRef(0), m_nearestPoint() + { + } + + dtPolyRef nearestRef() const { return m_nearestRef; } + const float* nearestPoint() const { return m_nearestPoint; } + + void process(const dtMeshTile* tile, dtPoly** polys, dtPolyRef* refs, int count) + { + dtIgnoreUnused(polys); + + for (int i = 0; i < count; ++i) + { + dtPolyRef ref = refs[i]; + float closestPtPoly[3]; + float diff[3]; + bool posOverPoly = false; + float d; + m_query->closestPointOnPoly(ref, m_center, closestPtPoly, &posOverPoly); + + // If a point is directly over a polygon and closer than + // climb height, favor that instead of straight line nearest point. + dtVsub(diff, m_center, closestPtPoly); + if (posOverPoly) + { + d = dtAbs(diff[1]) - tile->header->walkableClimb; + d = d > 0 ? d*d : 0; + } + else + { + d = dtVlenSqr(diff); + } + + if (d < m_nearestDistanceSqr) + { + dtVcopy(m_nearestPoint, closestPtPoly); + + m_nearestDistanceSqr = d; + m_nearestRef = ref; + } + } + } +}; + /// @par /// /// @note If the search box does not intersect any polygons the search will /// return #DT_SUCCESS, but @p nearestRef will be zero. So if in doubt, check /// @p nearestRef before using @p nearestPt. /// -/// @warning This function is not suitable for large area searches. If the search -/// extents overlaps more than MAX_SEARCH (128) polygons it may return an invalid result. -/// -dtStatus dtNavMeshQuery::findNearestPoly(const float* center, const float* extents, +dtStatus dtNavMeshQuery::findNearestPoly(const float* center, const float* halfExtents, const dtQueryFilter* filter, dtPolyRef* nearestRef, float* nearestPt) const { @@ -717,70 +768,29 @@ dtStatus dtNavMeshQuery::findNearestPoly(const float* center, const float* exten if (!nearestRef) return DT_FAILURE | DT_INVALID_PARAM; - // Get nearby polygons from proximity grid. - const int MAX_SEARCH = 128; - dtPolyRef polys[MAX_SEARCH]; - int polyCount = 0; - if (dtStatusFailed(queryPolygons(center, extents, filter, polys, &polyCount, MAX_SEARCH))) - return DT_FAILURE | DT_INVALID_PARAM; - - *nearestRef = 0; + dtFindNearestPolyQuery query(this, center); - if (polyCount == 0) - return DT_SUCCESS; - - // Find nearest polygon amongst the nearby polygons. - dtPolyRef nearest = 0; - float nearestPoint[3]; + dtStatus status = queryPolygons(center, halfExtents, filter, &query); + if (dtStatusFailed(status)) + return status; - float nearestDistanceSqr = FLT_MAX; - for (int i = 0; i < polyCount; ++i) - { - dtPolyRef ref = polys[i]; - float closestPtPoly[3]; - float diff[3]; - bool posOverPoly = false; - float d = 0; - closestPointOnPoly(ref, center, closestPtPoly, &posOverPoly); - - // If a point is directly over a polygon and closer than - // climb height, favor that instead of straight line nearest point. - dtVsub(diff, center, closestPtPoly); - if (posOverPoly) - { - const dtMeshTile* tile = 0; - const dtPoly* poly = 0; - m_nav->getTileAndPolyByRefUnsafe(polys[i], &tile, &poly); - d = dtAbs(diff[1]) - tile->header->walkableClimb; - d = d > 0 ? d*d : 0; - } - else - { - d = dtVlenSqr(diff); - } - - if (d < nearestDistanceSqr) - { - dtVcopy(nearestPoint, closestPtPoly); - - nearestDistanceSqr = d; - nearest = ref; - } - } - - *nearestRef = nearest; - - if (nearestPt) - dtVcopy(nearestPt, nearestPoint); + *nearestRef = query.nearestRef(); + // Only override nearestPt if we actually found a poly so the nearest point + // is valid. + if (nearestPt && *nearestRef) + dtVcopy(nearestPt, query.nearestPoint()); return DT_SUCCESS; } -int dtNavMeshQuery::queryPolygonsInTile(const dtMeshTile* tile, const float* qmin, const float* qmax, - const dtQueryFilter* filter, - dtPolyRef* polys, const int maxPolys) const +void dtNavMeshQuery::queryPolygonsInTile(const dtMeshTile* tile, const float* qmin, const float* qmax, + const dtQueryFilter* filter, dtPolyQuery* query) const { dtAssert(m_nav); + static const int batchSize = 32; + dtPolyRef polyRefs[batchSize]; + dtPoly* polys[batchSize]; + int n = 0; if (tile->bvTree) { @@ -789,7 +799,7 @@ int dtNavMeshQuery::queryPolygonsInTile(const dtMeshTile* tile, const float* qmi const float* tbmin = tile->header->bmin; const float* tbmax = tile->header->bmax; const float qfac = tile->header->bvQuantFactor; - + // Calculate quantized box unsigned short bmin[3], bmax[3]; // dtClamp query box to world box. @@ -806,25 +816,34 @@ int dtNavMeshQuery::queryPolygonsInTile(const dtMeshTile* tile, const float* qmi bmax[0] = (unsigned short)(qfac * maxx + 1) | 1; bmax[1] = (unsigned short)(qfac * maxy + 1) | 1; bmax[2] = (unsigned short)(qfac * maxz + 1) | 1; - + // Traverse tree const dtPolyRef base = m_nav->getPolyRefBase(tile); - int n = 0; while (node < end) { const bool overlap = dtOverlapQuantBounds(bmin, bmax, node->bmin, node->bmax); const bool isLeafNode = node->i >= 0; - + if (isLeafNode && overlap) { dtPolyRef ref = base | (dtPolyRef)node->i; if (filter->passFilter(ref, tile, &tile->polys[node->i])) { - if (n < maxPolys) - polys[n++] = ref; + polyRefs[n] = ref; + polys[n] = &tile->polys[node->i]; + + if (n == batchSize - 1) + { + query->process(tile, polys, polyRefs, batchSize); + n = 0; + } + else + { + n++; + } } } - + if (overlap || isLeafNode) node++; else @@ -833,17 +852,14 @@ int dtNavMeshQuery::queryPolygonsInTile(const dtMeshTile* tile, const float* qmi node += escapeIndex; } } - - return n; } else { float bmin[3], bmax[3]; - int n = 0; const dtPolyRef base = m_nav->getPolyRefBase(tile); for (int i = 0; i < tile->header->polyCount; ++i) { - const dtPoly* p = &tile->polys[i]; + dtPoly* p = &tile->polys[i]; // Do not return off-mesh connection polygons. if (p->getType() == DT_POLYTYPE_OFFMESH_CONNECTION) continue; @@ -861,16 +877,63 @@ int dtNavMeshQuery::queryPolygonsInTile(const dtMeshTile* tile, const float* qmi dtVmin(bmin, v); dtVmax(bmax, v); } - if (dtOverlapBounds(qmin,qmax, bmin,bmax)) + if (dtOverlapBounds(qmin, qmax, bmin, bmax)) { - if (n < maxPolys) - polys[n++] = ref; + polyRefs[n] = ref; + polys[n] = p; + + if (n == batchSize - 1) + { + query->process(tile, polys, polyRefs, batchSize); + n = 0; + } + else + { + n++; + } } } - return n; } + + // Process the last polygons that didn't make a full batch. + if (n > 0) + query->process(tile, polys, polyRefs, n); } +class dtCollectPolysQuery : public dtPolyQuery +{ + dtPolyRef* m_polys; + const int m_maxPolys; + int m_numCollected; + bool m_overflow; + +public: + dtCollectPolysQuery(dtPolyRef* polys, const int maxPolys) + : m_polys(polys), m_maxPolys(maxPolys), m_numCollected(0), m_overflow(false) + { + } + + int numCollected() const { return m_numCollected; } + bool overflowed() const { return m_overflow; } + + void process(const dtMeshTile* tile, dtPoly** polys, dtPolyRef* refs, int count) + { + dtIgnoreUnused(tile); + dtIgnoreUnused(polys); + + int numLeft = m_maxPolys - m_numCollected; + int toCopy = count; + if (toCopy > numLeft) + { + m_overflow = true; + toCopy = numLeft; + } + + memcpy(m_polys + m_numCollected, refs, (size_t)toCopy * sizeof(dtPolyRef)); + m_numCollected += toCopy; + } +}; + /// @par /// /// If no polygons are found, the function will return #DT_SUCCESS with a @@ -880,15 +943,41 @@ int dtNavMeshQuery::queryPolygonsInTile(const dtMeshTile* tile, const float* qmi /// be filled to capacity. The method of choosing which polygons from the /// full set are included in the partial result set is undefined. /// -dtStatus dtNavMeshQuery::queryPolygons(const float* center, const float* extents, +dtStatus dtNavMeshQuery::queryPolygons(const float* center, const float* halfExtents, const dtQueryFilter* filter, dtPolyRef* polys, int* polyCount, const int maxPolys) const +{ + if (!polys || !polyCount || maxPolys < 0) + return DT_FAILURE | DT_INVALID_PARAM; + + dtCollectPolysQuery collector(polys, maxPolys); + + dtStatus status = queryPolygons(center, halfExtents, filter, &collector); + if (dtStatusFailed(status)) + return status; + + *polyCount = collector.numCollected(); + return collector.overflowed() ? DT_SUCCESS | DT_BUFFER_TOO_SMALL : DT_SUCCESS; +} + +/// @par +/// +/// The query will be invoked with batches of polygons. Polygons passed +/// to the query have bounding boxes that overlap with the center and halfExtents +/// passed to this function. The dtPolyQuery::process function is invoked multiple +/// times until all overlapping polygons have been processed. +/// +dtStatus dtNavMeshQuery::queryPolygons(const float* center, const float* halfExtents, + const dtQueryFilter* filter, dtPolyQuery* query) const { dtAssert(m_nav); - + + if (!center || !halfExtents || !filter || !query) + return DT_FAILURE | DT_INVALID_PARAM; + float bmin[3], bmax[3]; - dtVsub(bmin, center, extents); - dtVadd(bmax, center, extents); + dtVsub(bmin, center, halfExtents); + dtVadd(bmax, center, halfExtents); // Find tiles the query touches. int minx, miny, maxx, maxy; @@ -898,7 +987,6 @@ dtStatus dtNavMeshQuery::queryPolygons(const float* center, const float* extents static const int MAX_NEIS = 32; const dtMeshTile* neis[MAX_NEIS]; - int n = 0; for (int y = miny; y <= maxy; ++y) { for (int x = minx; x <= maxx; ++x) @@ -906,16 +994,10 @@ dtStatus dtNavMeshQuery::queryPolygons(const float* center, const float* extents const int nneis = m_nav->getTilesAt(x,y,neis,MAX_NEIS); for (int j = 0; j < nneis; ++j) { - n += queryPolygonsInTile(neis[j], bmin, bmax, filter, polys+n, maxPolys-n); - if (n >= maxPolys) - { - *polyCount = n; - return DT_SUCCESS | DT_BUFFER_TOO_SMALL; - } + queryPolygonsInTile(neis[j], bmin, bmax, filter, query); } } } - *polyCount = n; return DT_SUCCESS; } @@ -940,18 +1022,14 @@ dtStatus dtNavMeshQuery::findPath(dtPolyRef startRef, dtPolyRef endRef, dtAssert(m_nodePool); dtAssert(m_openList); - *pathCount = 0; - - if (!startRef || !endRef) - return DT_FAILURE | DT_INVALID_PARAM; - - if (!maxPath) - return DT_FAILURE | DT_INVALID_PARAM; + if (pathCount) + *pathCount = 0; // Validate input - if (!m_nav->isValidPolyRef(startRef) || !m_nav->isValidPolyRef(endRef)) + if (!m_nav->isValidPolyRef(startRef) || !m_nav->isValidPolyRef(endRef) || + !startPos || !endPos || !filter || maxPath <= 0 || !path || !pathCount) return DT_FAILURE | DT_INVALID_PARAM; - + if (startRef == endRef) { path[0] = startRef; @@ -974,7 +1052,7 @@ dtStatus dtNavMeshQuery::findPath(dtPolyRef startRef, dtPolyRef endRef, dtNode* lastBestNode = startNode; float lastBestNodeCost = startNode->total; - dtStatus status = DT_SUCCESS; + bool outOfNodes = false; while (!m_openList->empty()) { @@ -1032,7 +1110,7 @@ dtStatus dtNavMeshQuery::findPath(dtPolyRef startRef, dtPolyRef endRef, dtNode* neighbourNode = m_nodePool->getNode(neighbourRef, crossSide); if (!neighbourNode) { - status |= DT_OUT_OF_NODES; + outOfNodes = true; continue; } @@ -1111,42 +1189,59 @@ dtStatus dtNavMeshQuery::findPath(dtPolyRef startRef, dtPolyRef endRef, } } } - + + dtStatus status = getPathToNode(lastBestNode, path, pathCount, maxPath); + if (lastBestNode->id != endRef) status |= DT_PARTIAL_RESULT; - - // Reverse the path. - dtNode* prev = 0; - dtNode* node = lastBestNode; - do - { - dtNode* next = m_nodePool->getNodeAtIdx(node->pidx); - node->pidx = m_nodePool->getNodeIdx(prev); - prev = node; - node = next; - } - while (node); - - // Store path - node = prev; - int n = 0; - do - { - path[n++] = node->id; - if (n >= maxPath) - { - status |= DT_BUFFER_TOO_SMALL; - break; - } - node = m_nodePool->getNodeAtIdx(node->pidx); - } - while (node); - - *pathCount = n; + + if (outOfNodes) + status |= DT_OUT_OF_NODES; return status; } +dtStatus dtNavMeshQuery::getPathToNode(dtNode* endNode, dtPolyRef* path, int* pathCount, int maxPath) const +{ + // Find the length of the entire path. + dtNode* curNode = endNode; + int length = 0; + do + { + length++; + curNode = m_nodePool->getNodeAtIdx(curNode->pidx); + } while (curNode); + + // If the path cannot be fully stored then advance to the last node we will be able to store. + curNode = endNode; + int writeCount; + for (writeCount = length; writeCount > maxPath; writeCount--) + { + dtAssert(curNode); + + curNode = m_nodePool->getNodeAtIdx(curNode->pidx); + } + + // Write path + for (int i = writeCount - 1; i >= 0; i--) + { + dtAssert(curNode); + + path[i] = curNode->id; + curNode = m_nodePool->getNodeAtIdx(curNode->pidx); + } + + dtAssert(!curNode); + + *pathCount = dtMin(length, maxPath); + + if (length > maxPath) + return DT_SUCCESS | DT_BUFFER_TOO_SMALL; + + return DT_SUCCESS; +} + + /// @par /// /// @warning Calling any non-slice methods before calling finalizeSlicedFindPath() @@ -1639,10 +1734,17 @@ dtStatus dtNavMeshQuery::appendVertex(const float* pos, const unsigned char flag if (straightPathRefs) straightPathRefs[(*straightPathCount)] = ref; (*straightPathCount)++; - // If reached end of path or there is no space to append more vertices, return. - if (flags == DT_STRAIGHTPATH_END || (*straightPathCount) >= maxStraightPath) + + // If there is no space to append more vertices, return. + if ((*straightPathCount) >= maxStraightPath) { - return DT_SUCCESS | (((*straightPathCount) >= maxStraightPath) ? DT_BUFFER_TOO_SMALL : 0); + return DT_SUCCESS | DT_BUFFER_TOO_SMALL; + } + + // If reached end of path, return. + if (flags == DT_STRAIGHTPATH_END) + { + return DT_SUCCESS; } } return DT_IN_PROGRESS; @@ -1767,10 +1869,12 @@ dtStatus dtNavMeshQuery::findStraightPath(const float* startPos, const float* en for (int i = 0; i < pathSize; ++i) { float left[3], right[3]; - unsigned char fromType, toType; + unsigned char toType; if (i+1 < pathSize) { + unsigned char fromType; // fromType is ignored. + // Next portal. if (dtStatusFailed(getPortalPoints(path[i], path[i+1], left, right, fromType, toType))) { @@ -1786,12 +1890,14 @@ dtStatus dtNavMeshQuery::findStraightPath(const float* startPos, const float* en // Apeend portals along the current straight path segment. if (options & (DT_STRAIGHTPATH_AREA_CROSSINGS | DT_STRAIGHTPATH_ALL_CROSSINGS)) { - stat = appendPortals(apexIndex, i, closestEndPos, path, + // Ignore status return value as we're just about to return anyway. + appendPortals(apexIndex, i, closestEndPos, path, straightPath, straightPathFlags, straightPathRefs, straightPathCount, maxStraightPath, options); } - stat = appendVertex(closestEndPos, 0, path[i], + // Ignore status return value as we're just about to return anyway. + appendVertex(closestEndPos, 0, path[i], straightPath, straightPathFlags, straightPathRefs, straightPathCount, maxStraightPath); @@ -1812,7 +1918,7 @@ dtStatus dtNavMeshQuery::findStraightPath(const float* startPos, const float* en dtVcopy(left, closestEndPos); dtVcopy(right, closestEndPos); - fromType = toType = DT_POLYTYPE_GROUND; + toType = DT_POLYTYPE_GROUND; } // Right vertex. @@ -1929,7 +2035,8 @@ dtStatus dtNavMeshQuery::findStraightPath(const float* startPos, const float* en } } - stat = appendVertex(closestEndPos, DT_STRAIGHTPATH_END, 0, + // Ignore status return value as we're just about to return anyway. + appendVertex(closestEndPos, DT_STRAIGHTPATH_END, 0, straightPath, straightPathFlags, straightPathRefs, straightPathCount, maxStraightPath); @@ -2400,10 +2507,10 @@ dtStatus dtNavMeshQuery::raycast(dtPolyRef startRef, const float* startPos, cons const dtMeshTile* prevTile, *tile, *nextTile; const dtPoly* prevPoly, *poly, *nextPoly; - dtPolyRef curRef, nextRef; + dtPolyRef curRef; // The API input has been checked already, skip checking internal data. - nextRef = curRef = startRef; + curRef = startRef; tile = 0; poly = 0; m_nav->getTileAndPolyByRefUnsafe(curRef, &tile, &poly); @@ -2458,7 +2565,7 @@ dtStatus dtNavMeshQuery::raycast(dtPolyRef startRef, const float* startPos, cons } // Follow neighbours. - nextRef = 0; + dtPolyRef nextRef = 0; for (unsigned int i = poly->firstLink; i != DT_NULL_LINK; i = tile->links[i].next) { @@ -2649,20 +2756,6 @@ dtStatus dtNavMeshQuery::findPolysAroundCircle(dtPolyRef startRef, const float* dtStatus status = DT_SUCCESS; int n = 0; - if (n < maxResult) - { - if (resultRef) - resultRef[n] = startNode->id; - if (resultParent) - resultParent[n] = 0; - if (resultCost) - resultCost[n] = 0; - ++n; - } - else - { - status |= DT_BUFFER_TOO_SMALL; - } const float radiusSqr = dtSqr(radius); @@ -2687,6 +2780,21 @@ dtStatus dtNavMeshQuery::findPolysAroundCircle(dtPolyRef startRef, const float* parentRef = m_nodePool->getNodeAtIdx(bestNode->pidx)->id; if (parentRef) m_nav->getTileAndPolyByRefUnsafe(parentRef, &parentTile, &parentPoly); + + if (n < maxResult) + { + if (resultRef) + resultRef[n] = bestRef; + if (resultParent) + resultParent[n] = parentRef; + if (resultCost) + resultCost[n] = bestNode->total; + ++n; + } + else + { + status |= DT_BUFFER_TOO_SMALL; + } for (unsigned int i = bestPoly->firstLink; i != DT_NULL_LINK; i = bestTile->links[i].next) { @@ -2730,14 +2838,19 @@ dtStatus dtNavMeshQuery::findPolysAroundCircle(dtPolyRef startRef, const float* if (neighbourNode->flags == 0) dtVlerp(neighbourNode->pos, va, vb, 0.5f); - const float total = bestNode->total + dtVdist(bestNode->pos, neighbourNode->pos); + float cost = filter->getCost( + bestNode->pos, neighbourNode->pos, + parentRef, parentTile, parentPoly, + bestRef, bestTile, bestPoly, + neighbourRef, neighbourTile, neighbourPoly); + + const float total = bestNode->total + cost; // The node is already in open list and the new result is worse, skip. if ((neighbourNode->flags & DT_NODE_OPEN) && total >= neighbourNode->total) continue; neighbourNode->id = neighbourRef; - neighbourNode->flags = (neighbourNode->flags & ~DT_NODE_CLOSED); neighbourNode->pidx = m_nodePool->getNodeIdx(bestNode); neighbourNode->total = total; @@ -2747,20 +2860,6 @@ dtStatus dtNavMeshQuery::findPolysAroundCircle(dtPolyRef startRef, const float* } else { - if (n < maxResult) - { - if (resultRef) - resultRef[n] = neighbourNode->id; - if (resultParent) - resultParent[n] = m_nodePool->getNodeAtIdx(neighbourNode->pidx)->id; - if (resultCost) - resultCost[n] = neighbourNode->total; - ++n; - } - else - { - status |= DT_BUFFER_TOO_SMALL; - } neighbourNode->flags = DT_NODE_OPEN; m_openList->push(neighbourNode); } @@ -2829,20 +2928,6 @@ dtStatus dtNavMeshQuery::findPolysAroundShape(dtPolyRef startRef, const float* v dtStatus status = DT_SUCCESS; int n = 0; - if (n < maxResult) - { - if (resultRef) - resultRef[n] = startNode->id; - if (resultParent) - resultParent[n] = 0; - if (resultCost) - resultCost[n] = 0; - ++n; - } - else - { - status |= DT_BUFFER_TOO_SMALL; - } while (!m_openList->empty()) { @@ -2865,6 +2950,22 @@ dtStatus dtNavMeshQuery::findPolysAroundShape(dtPolyRef startRef, const float* v parentRef = m_nodePool->getNodeAtIdx(bestNode->pidx)->id; if (parentRef) m_nav->getTileAndPolyByRefUnsafe(parentRef, &parentTile, &parentPoly); + + if (n < maxResult) + { + if (resultRef) + resultRef[n] = bestRef; + if (resultParent) + resultParent[n] = parentRef; + if (resultCost) + resultCost[n] = bestNode->total; + + ++n; + } + else + { + status |= DT_BUFFER_TOO_SMALL; + } for (unsigned int i = bestPoly->firstLink; i != DT_NULL_LINK; i = bestTile->links[i].next) { @@ -2910,14 +3011,19 @@ dtStatus dtNavMeshQuery::findPolysAroundShape(dtPolyRef startRef, const float* v if (neighbourNode->flags == 0) dtVlerp(neighbourNode->pos, va, vb, 0.5f); - const float total = bestNode->total + dtVdist(bestNode->pos, neighbourNode->pos); + float cost = filter->getCost( + bestNode->pos, neighbourNode->pos, + parentRef, parentTile, parentPoly, + bestRef, bestTile, bestPoly, + neighbourRef, neighbourTile, neighbourPoly); + + const float total = bestNode->total + cost; // The node is already in open list and the new result is worse, skip. if ((neighbourNode->flags & DT_NODE_OPEN) && total >= neighbourNode->total) continue; neighbourNode->id = neighbourRef; - neighbourNode->flags = (neighbourNode->flags & ~DT_NODE_CLOSED); neighbourNode->pidx = m_nodePool->getNodeIdx(bestNode); neighbourNode->total = total; @@ -2927,20 +3033,6 @@ dtStatus dtNavMeshQuery::findPolysAroundShape(dtPolyRef startRef, const float* v } else { - if (n < maxResult) - { - if (resultRef) - resultRef[n] = neighbourNode->id; - if (resultParent) - resultParent[n] = m_nodePool->getNodeAtIdx(neighbourNode->pidx)->id; - if (resultCost) - resultCost[n] = neighbourNode->total; - ++n; - } - else - { - status |= DT_BUFFER_TOO_SMALL; - } neighbourNode->flags = DT_NODE_OPEN; m_openList->push(neighbourNode); } @@ -2952,6 +3044,21 @@ dtStatus dtNavMeshQuery::findPolysAroundShape(dtPolyRef startRef, const float* v return status; } +dtStatus dtNavMeshQuery::getPathFromDijkstraSearch(dtPolyRef endRef, dtPolyRef* path, int* pathCount, int maxPath) const +{ + if (!m_nav->isValidPolyRef(endRef) || !path || !pathCount || maxPath < 0) + return DT_FAILURE | DT_INVALID_PARAM; + + *pathCount = 0; + + dtNode* endNode; + if (m_nodePool->findNodes(endRef, &endNode, 1) != 1 || + (endNode->flags & DT_NODE_CLOSED) == 0) + return DT_FAILURE | DT_INVALID_PARAM; + + return getPathToNode(endNode, path, pathCount, maxPath); +} + /// @par /// /// This method is optimized for a small search radius and small number of result diff --git a/Engine/lib/recast/DetourCrowd/Include/DetourCrowd.h b/Engine/lib/recast/DetourCrowd/Include/DetourCrowd.h index 2a2003b16..952050878 100644 --- a/Engine/lib/recast/DetourCrowd/Include/DetourCrowd.h +++ b/Engine/lib/recast/DetourCrowd/Include/DetourCrowd.h @@ -217,7 +217,7 @@ class dtCrowd dtPolyRef* m_pathResult; int m_maxPathResult; - float m_ext[3]; + float m_agentPlacementHalfExtents[3]; dtQueryFilter m_filters[DT_CROWD_MAX_QUERY_FILTER_TYPE]; @@ -325,9 +325,13 @@ public: /// @return The filter used by the crowd. inline dtQueryFilter* getEditableFilter(const int i) { return (i >= 0 && i < DT_CROWD_MAX_QUERY_FILTER_TYPE) ? &m_filters[i] : 0; } - /// Gets the search extents [(x, y, z)] used by the crowd for query operations. - /// @return The search extents used by the crowd. [(x, y, z)] - const float* getQueryExtents() const { return m_ext; } + /// Gets the search halfExtents [(x, y, z)] used by the crowd for query operations. + /// @return The search halfExtents used by the crowd. [(x, y, z)] + const float* getQueryHalfExtents() const { return m_agentPlacementHalfExtents; } + + /// Same as getQueryHalfExtents. Left to maintain backwards compatibility. + /// @return The search halfExtents used by the crowd. [(x, y, z)] + const float* getQueryExtents() const { return m_agentPlacementHalfExtents; } /// Gets the velocity sample count. /// @return The velocity sample count. @@ -453,3 +457,4 @@ A higher value will result in agents trying to stay farther away from each other the cost of more difficult steering in tight spaces. */ + diff --git a/Engine/lib/recast/DetourCrowd/Source/DetourCrowd.cpp b/Engine/lib/recast/DetourCrowd/Source/DetourCrowd.cpp index f9f436077..1e76e40ce 100644 --- a/Engine/lib/recast/DetourCrowd/Source/DetourCrowd.cpp +++ b/Engine/lib/recast/DetourCrowd/Source/DetourCrowd.cpp @@ -386,7 +386,8 @@ bool dtCrowd::init(const int maxAgents, const float maxAgentRadius, dtNavMesh* n m_maxAgents = maxAgents; m_maxAgentRadius = maxAgentRadius; - dtVset(m_ext, m_maxAgentRadius*2.0f,m_maxAgentRadius*1.5f,m_maxAgentRadius*2.0f); + // Larger than agent radius because it is also used for agent recovery. + dtVset(m_agentPlacementHalfExtents, m_maxAgentRadius*2.0f, m_maxAgentRadius*1.5f, m_maxAgentRadius*2.0f); m_grid = dtAllocProximityGrid(); if (!m_grid) @@ -531,7 +532,7 @@ int dtCrowd::addAgent(const float* pos, const dtCrowdAgentParams* params) float nearest[3]; dtPolyRef ref = 0; dtVcopy(nearest, pos); - dtStatus status = m_navquery->findNearestPoly(pos, m_ext, &m_filters[ag->params.queryFilterType], &ref, nearest); + dtStatus status = m_navquery->findNearestPoly(pos, m_agentPlacementHalfExtents, &m_filters[ag->params.queryFilterType], &ref, nearest); if (dtStatusFailed(status)) { dtVcopy(nearest, pos); @@ -965,7 +966,7 @@ void dtCrowd::checkPathValidity(dtCrowdAgent** agents, const int nagents, const float nearest[3]; dtVcopy(nearest, agentPos); agentRef = 0; - m_navquery->findNearestPoly(ag->npos, m_ext, &m_filters[ag->params.queryFilterType], &agentRef, nearest); + m_navquery->findNearestPoly(ag->npos, m_agentPlacementHalfExtents, &m_filters[ag->params.queryFilterType], &agentRef, nearest); dtVcopy(agentPos, nearest); if (!agentRef) @@ -1001,7 +1002,7 @@ void dtCrowd::checkPathValidity(dtCrowdAgent** agents, const int nagents, const float nearest[3]; dtVcopy(nearest, ag->targetPos); ag->targetRef = 0; - m_navquery->findNearestPoly(ag->targetPos, m_ext, &m_filters[ag->params.queryFilterType], &ag->targetRef, nearest); + m_navquery->findNearestPoly(ag->targetPos, m_agentPlacementHalfExtents, &m_filters[ag->params.queryFilterType], &ag->targetRef, nearest); dtVcopy(ag->targetPos, nearest); replan = true; } diff --git a/Engine/lib/recast/DetourCrowd/Source/DetourObstacleAvoidance.cpp b/Engine/lib/recast/DetourCrowd/Source/DetourObstacleAvoidance.cpp index 8466c813a..94f7df6ad 100644 --- a/Engine/lib/recast/DetourCrowd/Source/DetourObstacleAvoidance.cpp +++ b/Engine/lib/recast/DetourCrowd/Source/DetourObstacleAvoidance.cpp @@ -207,6 +207,9 @@ void dtFreeObstacleAvoidanceQuery(dtObstacleAvoidanceQuery* ptr) dtObstacleAvoidanceQuery::dtObstacleAvoidanceQuery() : + m_invHorizTime(0), + m_vmax(0), + m_invVmax(0), m_maxCircles(0), m_circles(0), m_ncircles(0), diff --git a/Engine/lib/recast/DetourCrowd/Source/DetourPathCorridor.cpp b/Engine/lib/recast/DetourCrowd/Source/DetourPathCorridor.cpp index 54a2ab8b8..e54d4637d 100644 --- a/Engine/lib/recast/DetourCrowd/Source/DetourPathCorridor.cpp +++ b/Engine/lib/recast/DetourCrowd/Source/DetourPathCorridor.cpp @@ -431,7 +431,7 @@ Behavior: - The new position will be located in the adjusted corridor's first polygon. The expected use case is that the desired position will be 'near' the current corridor. What is considered 'near' -depends on local polygon density, query search extents, etc. +depends on local polygon density, query search half extents, etc. The resulting position will differ from the desired position if the desired position is not on the navigation mesh, or it can't be reached using a local search. @@ -470,7 +470,7 @@ Behavior: - The corridor is automatically adjusted (shorted or lengthened) in order to remain valid. - The new target will be located in the adjusted corridor's last polygon. -The expected use case is that the desired target will be 'near' the current corridor. What is considered 'near' depends on local polygon density, query search extents, etc. +The expected use case is that the desired target will be 'near' the current corridor. What is considered 'near' depends on local polygon density, query search half extents, etc. The resulting target will differ from the desired target if the desired target is not on the navigation mesh, or it can't be reached using a local search. */ diff --git a/Engine/lib/recast/DetourCrowd/Source/DetourProximityGrid.cpp b/Engine/lib/recast/DetourCrowd/Source/DetourProximityGrid.cpp index 7af8efa01..fc1e2e136 100644 --- a/Engine/lib/recast/DetourCrowd/Source/DetourProximityGrid.cpp +++ b/Engine/lib/recast/DetourCrowd/Source/DetourProximityGrid.cpp @@ -48,6 +48,7 @@ inline int hashPos2(int x, int y, int n) dtProximityGrid::dtProximityGrid() : m_cellSize(0), + m_invCellSize(0), m_pool(0), m_poolHead(0), m_poolSize(0), diff --git a/Engine/lib/recast/DetourTileCache/Include/DetourTileCache.h b/Engine/lib/recast/DetourTileCache/Include/DetourTileCache.h index 9c7e01c35..75713366d 100644 --- a/Engine/lib/recast/DetourTileCache/Include/DetourTileCache.h +++ b/Engine/lib/recast/DetourTileCache/Include/DetourTileCache.h @@ -35,13 +35,47 @@ enum ObstacleState DT_OBSTACLE_REMOVING, }; +enum ObstacleType +{ + DT_OBSTACLE_CYLINDER, + DT_OBSTACLE_BOX, // AABB + DT_OBSTACLE_ORIENTED_BOX, // OBB +}; + +struct dtObstacleCylinder +{ + float pos[ 3 ]; + float radius; + float height; +}; + +struct dtObstacleBox +{ + float bmin[ 3 ]; + float bmax[ 3 ]; +}; + +struct dtObstacleOrientedBox +{ + float center[ 3 ]; + float halfExtents[ 3 ]; + float rotAux[ 2 ]; //{ cos(0.5f*angle)*sin(-0.5f*angle); cos(0.5f*angle)*cos(0.5f*angle) - 0.5 } +}; + static const int DT_MAX_TOUCHED_TILES = 8; struct dtTileCacheObstacle { - float pos[3], radius, height; + union + { + dtObstacleCylinder cylinder; + dtObstacleBox box; + dtObstacleOrientedBox orientedBox; + }; + dtCompressedTileRef touched[DT_MAX_TOUCHED_TILES]; dtCompressedTileRef pending[DT_MAX_TOUCHED_TILES]; unsigned short salt; + unsigned char type; unsigned char state; unsigned char ntouched; unsigned char npending; @@ -105,13 +139,27 @@ public: dtStatus removeTile(dtCompressedTileRef ref, unsigned char** data, int* dataSize); + // Cylinder obstacle. dtStatus addObstacle(const float* pos, const float radius, const float height, dtObstacleRef* result); + + // Aabb obstacle. + dtStatus addBoxObstacle(const float* bmin, const float* bmax, dtObstacleRef* result); + + // Box obstacle: can be rotated in Y. + dtStatus addBoxObstacle(const float* center, const float* halfExtents, const float yRadians, dtObstacleRef* result); + dtStatus removeObstacle(const dtObstacleRef ref); dtStatus queryTiles(const float* bmin, const float* bmax, dtCompressedTileRef* results, int* resultCount, const int maxResults) const; - dtStatus update(const float /*dt*/, class dtNavMesh* navmesh); + /// Updates the tile cache by rebuilding tiles touched by unfinished obstacle requests. + /// @param[in] dt The time step size. Currently not used. + /// @param[in] navmesh The mesh to affect when rebuilding tiles. + /// @param[out] upToDate Whether the tile cache is fully up to date with obstacle requests and tile rebuilds. + /// If the tile cache is up to date another (immediate) call to update will have no effect; + /// otherwise another call will continue processing obstacle requests and tile rebuilds. + dtStatus update(const float dt, class dtNavMesh* navmesh, bool* upToDate = 0); dtStatus buildNavMeshTilesAt(const int tx, const int ty, class dtNavMesh* navmesh); diff --git a/Engine/lib/recast/DetourTileCache/Include/DetourTileCacheBuilder.h b/Engine/lib/recast/DetourTileCache/Include/DetourTileCacheBuilder.h index 854183c91..ff6109193 100644 --- a/Engine/lib/recast/DetourTileCache/Include/DetourTileCacheBuilder.h +++ b/Engine/lib/recast/DetourTileCache/Include/DetourTileCacheBuilder.h @@ -127,6 +127,12 @@ void dtFreeTileCachePolyMesh(dtTileCacheAlloc* alloc, dtTileCachePolyMesh* lmesh dtStatus dtMarkCylinderArea(dtTileCacheLayer& layer, const float* orig, const float cs, const float ch, const float* pos, const float radius, const float height, const unsigned char areaId); +dtStatus dtMarkBoxArea(dtTileCacheLayer& layer, const float* orig, const float cs, const float ch, + const float* bmin, const float* bmax, const unsigned char areaId); + +dtStatus dtMarkBoxArea(dtTileCacheLayer& layer, const float* orig, const float cs, const float ch, + const float* center, const float* halfExtents, const float* rotAux, const unsigned char areaId); + dtStatus dtBuildTileCacheRegions(dtTileCacheAlloc* alloc, dtTileCacheLayer& layer, const int walkableClimb); diff --git a/Engine/lib/recast/DetourTileCache/Source/DetourTileCache.cpp b/Engine/lib/recast/DetourTileCache/Source/DetourTileCache.cpp index 9d8fac2ce..a82cd1350 100644 --- a/Engine/lib/recast/DetourTileCache/Source/DetourTileCache.cpp +++ b/Engine/lib/recast/DetourTileCache/Source/DetourTileCache.cpp @@ -77,6 +77,7 @@ dtTileCache::dtTileCache() : m_nupdate(0) { memset(&m_params, 0, sizeof(m_params)); + memset(m_reqs, 0, sizeof(ObstacleRequest) * MAX_REQUESTS); } dtTileCache::~dtTileCache() @@ -369,9 +370,10 @@ dtStatus dtTileCache::addObstacle(const float* pos, const float radius, const fl memset(ob, 0, sizeof(dtTileCacheObstacle)); ob->salt = salt; ob->state = DT_OBSTACLE_PROCESSING; - dtVcopy(ob->pos, pos); - ob->radius = radius; - ob->height = height; + ob->type = DT_OBSTACLE_CYLINDER; + dtVcopy(ob->cylinder.pos, pos); + ob->cylinder.radius = radius; + ob->cylinder.height = height; ObstacleRequest* req = &m_reqs[m_nreqs++]; memset(req, 0, sizeof(ObstacleRequest)); @@ -384,6 +386,79 @@ dtStatus dtTileCache::addObstacle(const float* pos, const float radius, const fl return DT_SUCCESS; } +dtStatus dtTileCache::addBoxObstacle(const float* bmin, const float* bmax, dtObstacleRef* result) +{ + if (m_nreqs >= MAX_REQUESTS) + return DT_FAILURE | DT_BUFFER_TOO_SMALL; + + dtTileCacheObstacle* ob = 0; + if (m_nextFreeObstacle) + { + ob = m_nextFreeObstacle; + m_nextFreeObstacle = ob->next; + ob->next = 0; + } + if (!ob) + return DT_FAILURE | DT_OUT_OF_MEMORY; + + unsigned short salt = ob->salt; + memset(ob, 0, sizeof(dtTileCacheObstacle)); + ob->salt = salt; + ob->state = DT_OBSTACLE_PROCESSING; + ob->type = DT_OBSTACLE_BOX; + dtVcopy(ob->box.bmin, bmin); + dtVcopy(ob->box.bmax, bmax); + + ObstacleRequest* req = &m_reqs[m_nreqs++]; + memset(req, 0, sizeof(ObstacleRequest)); + req->action = REQUEST_ADD; + req->ref = getObstacleRef(ob); + + if (result) + *result = req->ref; + + return DT_SUCCESS; +} + +dtStatus dtTileCache::addBoxObstacle(const float* center, const float* halfExtents, const float yRadians, dtObstacleRef* result) +{ + if (m_nreqs >= MAX_REQUESTS) + return DT_FAILURE | DT_BUFFER_TOO_SMALL; + + dtTileCacheObstacle* ob = 0; + if (m_nextFreeObstacle) + { + ob = m_nextFreeObstacle; + m_nextFreeObstacle = ob->next; + ob->next = 0; + } + if (!ob) + return DT_FAILURE | DT_OUT_OF_MEMORY; + + unsigned short salt = ob->salt; + memset(ob, 0, sizeof(dtTileCacheObstacle)); + ob->salt = salt; + ob->state = DT_OBSTACLE_PROCESSING; + ob->type = DT_OBSTACLE_ORIENTED_BOX; + dtVcopy(ob->orientedBox.center, center); + dtVcopy(ob->orientedBox.halfExtents, halfExtents); + + float coshalf= cosf(0.5f*yRadians); + float sinhalf = sinf(-0.5f*yRadians); + ob->orientedBox.rotAux[0] = coshalf*sinhalf; + ob->orientedBox.rotAux[1] = coshalf*coshalf - 0.5f; + + ObstacleRequest* req = &m_reqs[m_nreqs++]; + memset(req, 0, sizeof(ObstacleRequest)); + req->action = REQUEST_ADD; + req->ref = getObstacleRef(ob); + + if (result) + *result = req->ref; + + return DT_SUCCESS; +} + dtStatus dtTileCache::removeObstacle(const dtObstacleRef ref) { if (!ref) @@ -440,7 +515,8 @@ dtStatus dtTileCache::queryTiles(const float* bmin, const float* bmax, return DT_SUCCESS; } -dtStatus dtTileCache::update(const float /*dt*/, dtNavMesh* navmesh) +dtStatus dtTileCache::update(const float /*dt*/, dtNavMesh* navmesh, + bool* upToDate) { if (m_nupdate == 0) { @@ -499,12 +575,13 @@ dtStatus dtTileCache::update(const float /*dt*/, dtNavMesh* navmesh) m_nreqs = 0; } + dtStatus status = DT_SUCCESS; // Process updates if (m_nupdate) { // Build mesh const dtCompressedTileRef ref = m_update[0]; - dtStatus status = buildNavMeshTile(ref, navmesh); + status = buildNavMeshTile(ref, navmesh); m_nupdate--; if (m_nupdate > 0) memmove(m_update, m_update+1, m_nupdate*sizeof(dtCompressedTileRef)); @@ -547,12 +624,12 @@ dtStatus dtTileCache::update(const float /*dt*/, dtNavMesh* navmesh) } } } - - if (dtStatusFailed(status)) - return status; } - return DT_SUCCESS; + if (upToDate) + *upToDate = m_nupdate == 0 && m_nreqs == 0; + + return status; } @@ -604,8 +681,21 @@ dtStatus dtTileCache::buildNavMeshTile(const dtCompressedTileRef ref, dtNavMesh* continue; if (contains(ob->touched, ob->ntouched, ref)) { - dtMarkCylinderArea(*bc.layer, tile->header->bmin, m_params.cs, m_params.ch, - ob->pos, ob->radius, ob->height, 0); + if (ob->type == DT_OBSTACLE_CYLINDER) + { + dtMarkCylinderArea(*bc.layer, tile->header->bmin, m_params.cs, m_params.ch, + ob->cylinder.pos, ob->cylinder.radius, ob->cylinder.height, 0); + } + else if (ob->type == DT_OBSTACLE_BOX) + { + dtMarkBoxArea(*bc.layer, tile->header->bmin, m_params.cs, m_params.ch, + ob->box.bmin, ob->box.bmax, 0); + } + else if (ob->type == DT_OBSTACLE_ORIENTED_BOX) + { + dtMarkBoxArea(*bc.layer, tile->header->bmin, m_params.cs, m_params.ch, + ob->orientedBox.center, ob->orientedBox.halfExtents, ob->orientedBox.rotAux, 0); + } } } @@ -616,7 +706,7 @@ dtStatus dtTileCache::buildNavMeshTile(const dtCompressedTileRef ref, dtNavMesh* bc.lcset = dtAllocTileCacheContourSet(m_talloc); if (!bc.lcset) - return status; + return DT_FAILURE | DT_OUT_OF_MEMORY; status = dtBuildTileCacheContours(m_talloc, *bc.layer, walkableClimbVx, m_params.maxSimplificationError, *bc.lcset); if (dtStatusFailed(status)) @@ -624,7 +714,7 @@ dtStatus dtTileCache::buildNavMeshTile(const dtCompressedTileRef ref, dtNavMesh* bc.lmesh = dtAllocTileCachePolyMesh(m_talloc); if (!bc.lmesh) - return status; + return DT_FAILURE | DT_OUT_OF_MEMORY; status = dtBuildTileCachePolyMesh(m_talloc, *bc.lcset, *bc.lmesh); if (dtStatusFailed(status)) return status; @@ -699,10 +789,32 @@ void dtTileCache::calcTightTileBounds(const dtTileCacheLayerHeader* header, floa void dtTileCache::getObstacleBounds(const struct dtTileCacheObstacle* ob, float* bmin, float* bmax) const { - bmin[0] = ob->pos[0] - ob->radius; - bmin[1] = ob->pos[1]; - bmin[2] = ob->pos[2] - ob->radius; - bmax[0] = ob->pos[0] + ob->radius; - bmax[1] = ob->pos[1] + ob->height; - bmax[2] = ob->pos[2] + ob->radius; + if (ob->type == DT_OBSTACLE_CYLINDER) + { + const dtObstacleCylinder &cl = ob->cylinder; + + bmin[0] = cl.pos[0] - cl.radius; + bmin[1] = cl.pos[1]; + bmin[2] = cl.pos[2] - cl.radius; + bmax[0] = cl.pos[0] + cl.radius; + bmax[1] = cl.pos[1] + cl.height; + bmax[2] = cl.pos[2] + cl.radius; + } + else if (ob->type == DT_OBSTACLE_BOX) + { + dtVcopy(bmin, ob->box.bmin); + dtVcopy(bmax, ob->box.bmax); + } + else if (ob->type == DT_OBSTACLE_ORIENTED_BOX) + { + const dtObstacleOrientedBox &orientedBox = ob->orientedBox; + + float maxr = 1.41f*dtMax(orientedBox.halfExtents[0], orientedBox.halfExtents[2]); + bmin[0] = orientedBox.center[0] - maxr; + bmax[0] = orientedBox.center[0] + maxr; + bmin[1] = orientedBox.center[1] - orientedBox.halfExtents[1]; + bmax[1] = orientedBox.center[1] + orientedBox.halfExtents[1]; + bmin[2] = orientedBox.center[2] - maxr; + bmax[2] = orientedBox.center[2] + maxr; + } } diff --git a/Engine/lib/recast/DetourTileCache/Source/DetourTileCacheBuilder.cpp b/Engine/lib/recast/DetourTileCache/Source/DetourTileCacheBuilder.cpp index 2c82cf0a9..1bbbcc483 100644 --- a/Engine/lib/recast/DetourTileCache/Source/DetourTileCacheBuilder.cpp +++ b/Engine/lib/recast/DetourTileCache/Source/DetourTileCacheBuilder.cpp @@ -29,9 +29,7 @@ template class dtFixedArray dtTileCacheAlloc* m_alloc; T* m_ptr; const int m_size; - inline T* operator=(T* p); inline void operator=(dtFixedArray& p); - inline dtFixedArray(); public: inline dtFixedArray(dtTileCacheAlloc* a, const int s) : m_alloc(a), m_ptr((T*)a->alloc(sizeof(T)*s)), m_size(s) {} inline ~dtFixedArray() { if (m_alloc) m_alloc->free(m_ptr); } @@ -2004,6 +2002,98 @@ dtStatus dtMarkCylinderArea(dtTileCacheLayer& layer, const float* orig, const fl return DT_SUCCESS; } +dtStatus dtMarkBoxArea(dtTileCacheLayer& layer, const float* orig, const float cs, const float ch, + const float* bmin, const float* bmax, const unsigned char areaId) +{ + const int w = (int)layer.header->width; + const int h = (int)layer.header->height; + const float ics = 1.0f/cs; + const float ich = 1.0f/ch; + + int minx = (int)floorf((bmin[0]-orig[0])*ics); + int miny = (int)floorf((bmin[1]-orig[1])*ich); + int minz = (int)floorf((bmin[2]-orig[2])*ics); + int maxx = (int)floorf((bmax[0]-orig[0])*ics); + int maxy = (int)floorf((bmax[1]-orig[1])*ich); + int maxz = (int)floorf((bmax[2]-orig[2])*ics); + + if (maxx < 0) return DT_SUCCESS; + if (minx >= w) return DT_SUCCESS; + if (maxz < 0) return DT_SUCCESS; + if (minz >= h) return DT_SUCCESS; + + if (minx < 0) minx = 0; + if (maxx >= w) maxx = w-1; + if (minz < 0) minz = 0; + if (maxz >= h) maxz = h-1; + + for (int z = minz; z <= maxz; ++z) + { + for (int x = minx; x <= maxx; ++x) + { + const int y = layer.heights[x+z*w]; + if (y < miny || y > maxy) + continue; + layer.areas[x+z*w] = areaId; + } + } + + return DT_SUCCESS; +} + +dtStatus dtMarkBoxArea(dtTileCacheLayer& layer, const float* orig, const float cs, const float ch, + const float* center, const float* halfExtents, const float* rotAux, const unsigned char areaId) +{ + const int w = (int)layer.header->width; + const int h = (int)layer.header->height; + const float ics = 1.0f/cs; + const float ich = 1.0f/ch; + + float cx = (center[0] - orig[0])*ics; + float cz = (center[2] - orig[2])*ics; + + float maxr = 1.41f*dtMax(halfExtents[0], halfExtents[2]); + int minx = (int)floorf(cx - maxr*ics); + int maxx = (int)floorf(cx + maxr*ics); + int minz = (int)floorf(cz - maxr*ics); + int maxz = (int)floorf(cz + maxr*ics); + int miny = (int)floorf((center[1]-halfExtents[1]-orig[1])*ich); + int maxy = (int)floorf((center[1]+halfExtents[1]-orig[1])*ich); + + if (maxx < 0) return DT_SUCCESS; + if (minx >= w) return DT_SUCCESS; + if (maxz < 0) return DT_SUCCESS; + if (minz >= h) return DT_SUCCESS; + + if (minx < 0) minx = 0; + if (maxx >= w) maxx = w-1; + if (minz < 0) minz = 0; + if (maxz >= h) maxz = h-1; + + float xhalf = halfExtents[0]*ics + 0.5f; + float zhalf = halfExtents[2]*ics + 0.5f; + + for (int z = minz; z <= maxz; ++z) + { + for (int x = minx; x <= maxx; ++x) + { + float x2 = 2.0f*(float(x) - cx); + float z2 = 2.0f*(float(z) - cz); + float xrot = rotAux[1]*x2 + rotAux[0]*z2; + if (xrot > xhalf || xrot < -xhalf) + continue; + float zrot = rotAux[1]*z2 - rotAux[0]*x2; + if (zrot > zhalf || zrot < -zhalf) + continue; + const int y = layer.heights[x+z*w]; + if (y < miny || y > maxy) + continue; + layer.areas[x+z*w] = areaId; + } + } + + return DT_SUCCESS; +} dtStatus dtBuildTileCacheLayer(dtTileCacheCompressor* comp, dtTileCacheLayerHeader* header, @@ -2027,7 +2117,11 @@ dtStatus dtBuildTileCacheLayer(dtTileCacheCompressor* comp, const int bufferSize = gridSize*3; unsigned char* buffer = (unsigned char*)dtAlloc(bufferSize, DT_ALLOC_TEMP); if (!buffer) + { + dtFree(data); return DT_FAILURE | DT_OUT_OF_MEMORY; + } + memcpy(buffer, heights, gridSize); memcpy(buffer+gridSize, areas, gridSize); memcpy(buffer+gridSize*2, cons, gridSize); @@ -2038,7 +2132,11 @@ dtStatus dtBuildTileCacheLayer(dtTileCacheCompressor* comp, int compressedSize = 0; dtStatus status = comp->compress(buffer, bufferSize, compressed, maxCompressedSize, &compressedSize); if (dtStatusFailed(status)) + { + dtFree(buffer); + dtFree(data); return status; + } *outData = data; *outDataSize = headerSize + compressedSize; diff --git a/Engine/lib/recast/README.md b/Engine/lib/recast/README.md new file mode 100644 index 000000000..7db799636 --- /dev/null +++ b/Engine/lib/recast/README.md @@ -0,0 +1,89 @@ + +Recast & Detour +=============== + +[![Travis (Linux) Build Status](https://travis-ci.org/recastnavigation/recastnavigation.svg?branch=master)](https://travis-ci.org/recastnavigation/recastnavigation) +[![Appveyor (Windows) Build Status](https://ci.appveyor.com/api/projects/status/20w84u25b3f8h179/branch/master?svg=true)](https://ci.appveyor.com/project/recastnavigation/recastnavigation/branch/master) + +[![Issue Stats](http://www.issuestats.com/github/recastnavigation/recastnavigation/badge/pr?style=flat)](http://www.issuestats.com/github/recastnavigation/recastnavigation) +[![Issue Stats](http://www.issuestats.com/github/recastnavigation/recastnavigation/badge/issue?style=flat)](http://www.issuestats.com/github/recastnavigation/recastnavigation) + +![screenshot of a navmesh baked with the sample program](/RecastDemo/screenshot.png?raw=true) + +## Recast + +Recast is state of the art navigation mesh construction toolset for games. + +* It is automatic, which means that you can throw any level geometry at it and you will get robust mesh out +* It is fast which means swift turnaround times for level designers +* It is open source so it comes with full source and you can customize it to your heart's content. + +The Recast process starts with constructing a voxel mold from a level geometry +and then casting a navigation mesh over it. The process consists of three steps, +building the voxel mold, partitioning the mold into simple regions, peeling off +the regions as simple polygons. + +1. The voxel mold is build from the input triangle mesh by rasterizing the triangles into a multi-layer heightfield. Some simple filters are then applied to the mold to prune out locations where the character would not be able to move. +2. The walkable areas described by the mold are divided into simple overlayed 2D regions. The resulting regions have only one non-overlapping contour, which simplifies the final step of the process tremendously. +3. The navigation polygons are peeled off from the regions by first tracing the boundaries and then simplifying them. The resulting polygons are finally converted to convex polygons which makes them perfect for pathfinding and spatial reasoning about the level. + + +## Detour + +Recast is accompanied with Detour, path-finding and spatial reasoning toolkit. You can use any navigation mesh with Detour, but of course the data generated with Recast fits perfectly. + +Detour offers simple static navigation mesh which is suitable for many simple cases, as well as tiled navigation mesh which allows you to plug in and out pieces of the mesh. The tiled mesh allows you to create systems where you stream new navigation data in and out as the player progresses the level, or you may regenerate tiles as the world changes. + + +## Recast Demo + +You can find a comprehensive demo project in RecastDemo folder. It is a kitchen sink demo containing all the functionality of the library. If you are new to Recast & Detour, check out [Sample_SoloMesh.cpp](/RecastDemo/Source/Sample_SoloMesh.cpp) to get started with building navmeshes and [NavMeshTesterTool.cpp](/RecastDemo/Source/NavMeshTesterTool.cpp) to see how Detour can be used to find paths. + +### Building RecastDemo + +RecastDemo uses [premake5](http://premake.github.io/) to build platform specific projects. Download it and make sure it's available on your path, or specify the path to it. + +#### Linux + +- Install SDl2 and its dependencies according to your distro's guidelines. +- run `premake5 gmake` from the `RecastDemo` folder. +- `cd Build/gmake` then `make` +- Run `RecastDemo\Bin\RecastDemo` + +#### OSX + +- Grab the latest SDL2 development library dmg from [here](https://www.libsdl.org/download-2.0.php) and place `SDL2.framework` in `/Library/Frameworks/` +- Navigate to the `RecastDemo` folder and run `premake5 xcode4` +- Open `Build/xcode4/recastnavigation.xcworkspace` +- Select the "RecastDemo" project in the left pane, go to the "BuildPhases" tab and expand "Link Binary With Libraries" +- Remove the existing entry for SDL2 (it should have a white box icon) and re-add it by hitting the plus, selecting "Add Other", and selecting `/Library/Frameworks/SDL2.framework`. It should now have a suitcase icon. +- Set the RecastDemo project as the target and build. + +#### Windows + +- Grab the latest SDL2 development library release from [here](https://www.libsdl.org/download-2.0.php) and unzip it `RecastDemo\Contrib`. Rename the SDL folder such that the path `RecastDemo\Contrib\SDL\lib\x86` is valid. +- Run `"premake5" vs2015` from the `RecastDemo` folder +- Open the solution, build, and run. + +### Running Unit tests + +- Follow the instructions to build RecastDemo above. Premake should generate another build target called "Tests". +- Build the "Tests" project. This will generate an executable named "Tests" in `RecastDemo/Bin/` +- Run the "Tests" executable. It will execute all the unit tests, indicate those that failed, and display a count of those that succeeded. + +## Integrating with your own project + +It is recommended to add the source directories `DebugUtils`, `Detour`, `DetourCrowd`, `DetourTileCache`, and `Recast` into your own project depending on which parts of the project you need. For example your level building tool could include `DebugUtils`, `Recast`, and `Detour`, and your game runtime could just include `Detour`. + +## Contributing + +See the [Contributing document](CONTRIBUTING.md) for guidelines for making contributions. + +## Discuss + +- Discuss Recast & Detour: http://groups.google.com/group/recastnavigation +- Development blog: http://digestingduck.blogspot.com/ + +## License + +Recast & Detour is licensed under ZLib license, see License.txt for more information. diff --git a/Engine/lib/recast/Recast/Include/Recast.h b/Engine/lib/recast/Recast/Include/Recast.h index 2adcdcb34..e85c0d2e2 100644 --- a/Engine/lib/recast/Recast/Include/Recast.h +++ b/Engine/lib/recast/Recast/Include/Recast.h @@ -293,6 +293,9 @@ struct rcSpanPool /// @ingroup recast struct rcHeightfield { + rcHeightfield(); + ~rcHeightfield(); + int width; ///< The width of the heightfield. (Along the x-axis in cell units.) int height; ///< The height of the heightfield. (Along the z-axis in cell units.) float bmin[3]; ///< The minimum bounds in world space. [(x, y, z)] @@ -302,6 +305,11 @@ struct rcHeightfield rcSpan** spans; ///< Heightfield of spans (width*height). rcSpanPool* pools; ///< Linked list of span pools. rcSpan* freelist; ///< The next free span. + +private: + // Explicitly-disabled copy constructor and copy assignment operator. + rcHeightfield(const rcHeightfield&); + rcHeightfield& operator=(const rcHeightfield&); }; /// Provides information on the content of a cell column in a compact heightfield. @@ -886,7 +894,7 @@ bool rcRasterizeTriangles(rcContext* ctx, const float* verts, const int nv, bool rcRasterizeTriangles(rcContext* ctx, const float* verts, const unsigned char* areas, const int nt, rcHeightfield& solid, const int flagMergeThr = 1); -/// Marks non-walkable spans as walkable if their maximum is within @p walkableClimp of a walkable neihbor. +/// Marks non-walkable spans as walkable if their maximum is within @p walkableClimp of a walkable neighbor. /// @ingroup recast /// @param[in,out] ctx The build context to use during the operation. /// @param[in] walkableClimb Maximum ledge height that is considered to still be traversable. diff --git a/Engine/lib/recast/Recast/Include/RecastAlloc.h b/Engine/lib/recast/Recast/Include/RecastAlloc.h index f1608fb55..3cdd450d4 100644 --- a/Engine/lib/recast/Recast/Include/RecastAlloc.h +++ b/Engine/lib/recast/Recast/Include/RecastAlloc.h @@ -123,7 +123,6 @@ public: template class rcScopedDelete { T* ptr; - inline T* operator=(T* p); public: /// Constructs an instance with a null pointer. diff --git a/Engine/lib/recast/Recast/Include/RecastAssert.h b/Engine/lib/recast/Recast/Include/RecastAssert.h index 2aca0d9a1..e7cc10e49 100644 --- a/Engine/lib/recast/Recast/Include/RecastAssert.h +++ b/Engine/lib/recast/Recast/Include/RecastAssert.h @@ -23,11 +23,34 @@ // Feel free to change the file and include your own implementation instead. #ifdef NDEBUG + // From http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/ -# define rcAssert(x) do { (void)sizeof(x); } while((void)(__LINE__==-1),false) +# define rcAssert(x) do { (void)sizeof(x); } while((void)(__LINE__==-1),false) + #else + +/// An assertion failure function. +// @param[in] expression asserted expression. +// @param[in] file Filename of the failed assertion. +// @param[in] line Line number of the failed assertion. +/// @see rcAssertFailSetCustom +typedef void (rcAssertFailFunc)(const char* expression, const char* file, int line); + +/// Sets the base custom assertion failure function to be used by Recast. +/// @param[in] assertFailFunc The function to be used in case of failure of #dtAssert +void rcAssertFailSetCustom(rcAssertFailFunc *assertFailFunc); + +/// Gets the base custom assertion failure function to be used by Recast. +rcAssertFailFunc* rcAssertFailGetCustom(); + # include -# define rcAssert assert +# define rcAssert(expression) \ + { \ + rcAssertFailFunc* failFunc = rcAssertFailGetCustom(); \ + if(failFunc == NULL) { assert(expression); } \ + else if(!(expression)) { (*failFunc)(#expression, __FILE__, __LINE__); } \ + } + #endif #endif // RECASTASSERT_H diff --git a/Engine/lib/recast/Recast/Source/Recast.cpp b/Engine/lib/recast/Recast/Source/Recast.cpp index 46bc8b781..8308d1973 100644 --- a/Engine/lib/recast/Recast/Source/Recast.cpp +++ b/Engine/lib/recast/Recast/Source/Recast.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "Recast.h" #include "RecastAlloc.h" #include "RecastAssert.h" @@ -72,23 +73,39 @@ void rcContext::log(const rcLogCategory category, const char* format, ...) rcHeightfield* rcAllocHeightfield() { - rcHeightfield* hf = (rcHeightfield*)rcAlloc(sizeof(rcHeightfield), RC_ALLOC_PERM); - memset(hf, 0, sizeof(rcHeightfield)); - return hf; + return new (rcAlloc(sizeof(rcHeightfield), RC_ALLOC_PERM)) rcHeightfield; +} + +rcHeightfield::rcHeightfield() + : width() + , height() + , bmin() + , bmax() + , cs() + , ch() + , spans() + , pools() + , freelist() +{ +} + +rcHeightfield::~rcHeightfield() +{ + // Delete span array. + rcFree(spans); + // Delete span pools. + while (pools) + { + rcSpanPool* next = pools->next; + rcFree(pools); + pools = next; + } } void rcFreeHeightField(rcHeightfield* hf) { if (!hf) return; - // Delete span array. - rcFree(hf->spans); - // Delete span pools. - while (hf->pools) - { - rcSpanPool* next = hf->pools->next; - rcFree(hf->pools); - hf->pools = next; - } + hf->~rcHeightfield(); rcFree(hf); } @@ -109,7 +126,6 @@ void rcFreeCompactHeightfield(rcCompactHeightfield* chf) rcFree(chf); } - rcHeightfieldLayerSet* rcAllocHeightfieldLayerSet() { rcHeightfieldLayerSet* lset = (rcHeightfieldLayerSet*)rcAlloc(sizeof(rcHeightfieldLayerSet), RC_ALLOC_PERM); @@ -245,11 +261,12 @@ static void calcTriNormal(const float* v0, const float* v1, const float* v2, flo /// /// @see rcHeightfield, rcClearUnwalkableTriangles, rcRasterizeTriangles void rcMarkWalkableTriangles(rcContext* ctx, const float walkableSlopeAngle, - const float* verts, int /*nv*/, + const float* verts, int nv, const int* tris, int nt, unsigned char* areas) { rcIgnoreUnused(ctx); + rcIgnoreUnused(nv); const float walkableThr = cosf(walkableSlopeAngle/180.0f*RC_PI); diff --git a/Engine/lib/recast/Recast/Source/RecastAlloc.cpp b/Engine/lib/recast/Recast/Source/RecastAlloc.cpp index ee1039f2f..453b5fa6a 100644 --- a/Engine/lib/recast/Recast/Source/RecastAlloc.cpp +++ b/Engine/lib/recast/Recast/Source/RecastAlloc.cpp @@ -19,6 +19,7 @@ #include #include #include "RecastAlloc.h" +#include "RecastAssert.h" static void *rcAllocDefault(size_t size, rcAllocHint) { @@ -77,6 +78,7 @@ void rcIntArray::doResize(int n) if (!m_cap) m_cap = n; while (m_cap < n) m_cap *= 2; int* newData = (int*)rcAlloc(m_cap*sizeof(int), RC_ALLOC_TEMP); + rcAssert(newData); if (m_size && newData) memcpy(newData, m_data, m_size*sizeof(int)); rcFree(m_data); m_data = newData; diff --git a/Engine/lib/recast/Recast/Source/RecastAssert.cpp b/Engine/lib/recast/Recast/Source/RecastAssert.cpp new file mode 100644 index 000000000..6297d4202 --- /dev/null +++ b/Engine/lib/recast/Recast/Source/RecastAssert.cpp @@ -0,0 +1,35 @@ +// +// Copyright (c) 2009-2010 Mikko Mononen memon@inside.org +// +// This software is provided 'as-is', without any express or implied +// warranty. In no event will the authors be held liable for any damages +// arising from the use of this software. +// Permission is granted to anyone to use this software for any purpose, +// including commercial applications, and to alter it and redistribute it +// freely, subject to the following restrictions: +// 1. The origin of this software must not be misrepresented; you must not +// claim that you wrote the original software. If you use this software +// in a product, an acknowledgment in the product documentation would be +// appreciated but is not required. +// 2. Altered source versions must be plainly marked as such, and must not be +// misrepresented as being the original software. +// 3. This notice may not be removed or altered from any source distribution. +// + +#include "RecastAssert.h" + +#ifndef NDEBUG + +static rcAssertFailFunc* sRecastAssertFailFunc = 0; + +void rcAssertFailSetCustom(rcAssertFailFunc *assertFailFunc) +{ + sRecastAssertFailFunc = assertFailFunc; +} + +rcAssertFailFunc* rcAssertFailGetCustom() +{ + return sRecastAssertFailFunc; +} + +#endif diff --git a/Engine/lib/recast/Recast/Source/RecastLayers.cpp b/Engine/lib/recast/Recast/Source/RecastLayers.cpp index 22a357eff..acc97e44f 100644 --- a/Engine/lib/recast/Recast/Source/RecastLayers.cpp +++ b/Engine/lib/recast/Recast/Source/RecastLayers.cpp @@ -27,7 +27,9 @@ #include "RecastAssert.h" -static const int RC_MAX_LAYERS = RC_NOT_CONNECTED; +// Must be 255 or smaller (not 256) because layer IDs are stored as +// a byte where 255 is a special value. +static const int RC_MAX_LAYERS = 63; static const int RC_MAX_NEIS = 16; struct rcLayerRegion @@ -42,25 +44,31 @@ struct rcLayerRegion }; -static void addUnique(unsigned char* a, unsigned char& an, unsigned char v) -{ - const int n = (int)an; - for (int i = 0; i < n; ++i) - if (a[i] == v) - return; - a[an] = v; - an++; -} - static bool contains(const unsigned char* a, const unsigned char an, const unsigned char v) { const int n = (int)an; for (int i = 0; i < n; ++i) + { if (a[i] == v) return true; + } return false; } +static bool addUnique(unsigned char* a, unsigned char& an, int anMax, unsigned char v) +{ + if (contains(a, an, v)) + return true; + + if ((int)an >= anMax) + return false; + + a[an] = v; + an++; + return true; +} + + inline bool overlapRange(const unsigned short amin, const unsigned short amax, const unsigned short bmin, const unsigned short bmax) { @@ -258,8 +266,13 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf, const int ay = y + rcGetDirOffsetY(dir); const int ai = (int)chf.cells[ax+ay*w].index + rcGetCon(s, dir); const unsigned char rai = srcReg[ai]; - if (rai != 0xff && rai != ri && regs[ri].nneis < RC_MAX_NEIS) - addUnique(regs[ri].neis, regs[ri].nneis, rai); + if (rai != 0xff && rai != ri) + { + // Don't check return value -- if we cannot add the neighbor + // it will just cause a few more regions to be created, which + // is fine. + addUnique(regs[ri].neis, regs[ri].nneis, RC_MAX_NEIS, rai); + } } } @@ -274,8 +287,13 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf, { rcLayerRegion& ri = regs[lregs[i]]; rcLayerRegion& rj = regs[lregs[j]]; - addUnique(ri.layers, ri.nlayers, lregs[j]); - addUnique(rj.layers, rj.nlayers, lregs[i]); + + if (!addUnique(ri.layers, ri.nlayers, RC_MAX_LAYERS, lregs[j]) || + !addUnique(rj.layers, rj.nlayers, RC_MAX_LAYERS, lregs[i])) + { + ctx->log(RC_LOG_ERROR, "rcBuildHeightfieldLayers: layer overflow (too many overlapping walkable platforms). Try increasing RC_MAX_LAYERS."); + return false; + } } } } @@ -338,7 +356,13 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf, regn.layerId = layerId; // Merge current layers to root. for (int k = 0; k < regn.nlayers; ++k) - addUnique(root.layers, root.nlayers, regn.layers[k]); + { + if (!addUnique(root.layers, root.nlayers, RC_MAX_LAYERS, regn.layers[k])) + { + ctx->log(RC_LOG_ERROR, "rcBuildHeightfieldLayers: layer overflow (too many overlapping walkable platforms). Try increasing RC_MAX_LAYERS."); + return false; + } + } root.ymin = rcMin(root.ymin, regn.ymin); root.ymax = rcMax(root.ymax, regn.ymax); } @@ -416,7 +440,14 @@ bool rcBuildHeightfieldLayers(rcContext* ctx, rcCompactHeightfield& chf, rj.layerId = newId; // Add overlaid layers from 'rj' to 'ri'. for (int k = 0; k < rj.nlayers; ++k) - addUnique(ri.layers, ri.nlayers, rj.layers[k]); + { + if (!addUnique(ri.layers, ri.nlayers, RC_MAX_LAYERS, rj.layers[k])) + { + ctx->log(RC_LOG_ERROR, "rcBuildHeightfieldLayers: layer overflow (too many overlapping walkable platforms). Try increasing RC_MAX_LAYERS."); + return false; + } + } + // Update height bounds. ri.ymin = rcMin(ri.ymin, rj.ymin); ri.ymax = rcMax(ri.ymax, rj.ymax); diff --git a/Engine/lib/recast/Recast/Source/RecastMesh.cpp b/Engine/lib/recast/Recast/Source/RecastMesh.cpp index 9b6f04e30..e99eaebb7 100644 --- a/Engine/lib/recast/Recast/Source/RecastMesh.cpp +++ b/Engine/lib/recast/Recast/Source/RecastMesh.cpp @@ -379,7 +379,7 @@ static int triangulate(int n, const int* verts, int* indices, int* tris) // We might get here because the contour has overlapping segments, like this: // // A o-o=====o---o B - // / |C D| \ + // / |C D| \. // o o o o // : : : : // We'll try to recover by loosing up the inCone test a bit so that a diagonal diff --git a/Engine/lib/recast/Recast/Source/RecastMeshDetail.cpp b/Engine/lib/recast/Recast/Source/RecastMeshDetail.cpp index f1270cf20..f953132f7 100644 --- a/Engine/lib/recast/Recast/Source/RecastMeshDetail.cpp +++ b/Engine/lib/recast/Recast/Source/RecastMeshDetail.cpp @@ -647,11 +647,10 @@ static bool buildPolyDetail(rcContext* ctx, const float* in, const int nin, int hull[MAX_VERTS]; int nhull = 0; - nverts = 0; + nverts = nin; for (int i = 0; i < nin; ++i) rcVcopy(&verts[i*3], &in[i*3]); - nverts = nin; edges.resize(0); tris.resize(0); @@ -777,7 +776,7 @@ static bool buildPolyDetail(rcContext* ctx, const float* in, const int nin, // Tessellate the base mesh. // We're using the triangulateHull instead of delaunayHull as it tends to - // create a bit better triangulation for long thing triangles when there + // create a bit better triangulation for long thin triangles when there // are no internal points. triangulateHull(nverts, verts, nhull, hull, tris); diff --git a/Engine/lib/recast/Recast/Source/RecastRegion.cpp b/Engine/lib/recast/Recast/Source/RecastRegion.cpp index 54acf4b73..38a2bd6bf 100644 --- a/Engine/lib/recast/Recast/Source/RecastRegion.cpp +++ b/Engine/lib/recast/Recast/Source/RecastRegion.cpp @@ -1575,12 +1575,6 @@ bool rcBuildRegions(rcContext* ctx, rcCompactHeightfield& chf, // Make sure border will not overflow. const int bw = rcMin(w, borderSize); const int bh = rcMin(h, borderSize); - - if (regionId > 0xFFFB) - { - ctx->log(RC_LOG_ERROR, "rcBuildRegions: Region ID overflow"); - return false; - } // Paint regions paintRectRegion(0, bw, 0, h, regionId|RC_BORDER_REG, chf, srcReg); regionId++; @@ -1690,7 +1684,7 @@ bool rcBuildLayerRegions(rcContext* ctx, rcCompactHeightfield& chf, rcScopedDelete srcReg((unsigned short*)rcAlloc(sizeof(unsigned short)*chf.spanCount, RC_ALLOC_TEMP)); if (!srcReg) { - ctx->log(RC_LOG_ERROR, "rcBuildRegionsMonotone: Out of memory 'src' (%d).", chf.spanCount); + ctx->log(RC_LOG_ERROR, "rcBuildLayerRegions: Out of memory 'src' (%d).", chf.spanCount); return false; } memset(srcReg,0,sizeof(unsigned short)*chf.spanCount); @@ -1699,7 +1693,7 @@ bool rcBuildLayerRegions(rcContext* ctx, rcCompactHeightfield& chf, rcScopedDelete sweeps((rcSweepSpan*)rcAlloc(sizeof(rcSweepSpan)*nsweeps, RC_ALLOC_TEMP)); if (!sweeps) { - ctx->log(RC_LOG_ERROR, "rcBuildRegionsMonotone: Out of memory 'sweeps' (%d).", nsweeps); + ctx->log(RC_LOG_ERROR, "rcBuildLayerRegions: Out of memory 'sweeps' (%d).", nsweeps); return false; } From cf4261db4aca16df48adb55cdbedf972a6b848ee Mon Sep 17 00:00:00 2001 From: Johxz Date: Wed, 28 Feb 2018 22:42:42 -0600 Subject: [PATCH 010/144] update readme version files --- Engine/lib/recast/Readme.txt | 42 ----------------------------------- Engine/lib/recast/version.txt | 1 + 2 files changed, 1 insertion(+), 42 deletions(-) delete mode 100644 Engine/lib/recast/Readme.txt diff --git a/Engine/lib/recast/Readme.txt b/Engine/lib/recast/Readme.txt deleted file mode 100644 index bb9808ff2..000000000 --- a/Engine/lib/recast/Readme.txt +++ /dev/null @@ -1,42 +0,0 @@ - -Recast & Detour -=============== - -## Recast - -Recast is state of the art navigation mesh construction toolset for games. - -* It is automatic, which means that you can throw any level geometry at it and you will get robust mesh out -* It is fast which means swift turnaround times for level designers -* It is open source so it comes with full source and you can customize it to your heart's content. - -The Recast process starts with constructing a voxel mold from a level geometry -and then casting a navigation mesh over it. The process consists of three steps, -building the voxel mold, partitioning the mold into simple regions, peeling off -the regions as simple polygons. - -1. The voxel mold is build from the input triangle mesh by rasterizing the triangles into a multi-layer heightfield. Some simple filters are then applied to the mold to prune out locations where the character would not be able to move. -2. The walkable areas described by the mold are divided into simple overlayed 2D regions. The resulting regions have only one non-overlapping contour, which simplifies the final step of the process tremendously. -3. The navigation polygons are peeled off from the regions by first tracing the boundaries and then simplifying them. The resulting polygons are finally converted to convex polygons which makes them perfect for pathfinding and spatial reasoning about the level. - -## Detour - -Recast is accompanied with Detour, path-finding and spatial reasoning toolkit. You can use any navigation mesh with Detour, but of course the data generated with Recast fits perfectly. - -Detour offers simple static navigation mesh which is suitable for many simple cases, as well as tiled navigation mesh which allows you to plug in and out pieces of the mesh. The tiled mesh allows you to create systems where you stream new navigation data in and out as the player progresses the level, or you may regenerate tiles as the world changes. - -## Integrating with your own project - -It is recommended to add the source directories `DebugUtils`, `Detour`, `DetourCrowd`, `DetourTileCache`, and `Recast` into your own project depending on which parts of the project you need. For example your level building tool could include DebugUtils, Recast, and Detour, and your game runtime could just include Detour. - -## Discuss - -- Discuss Recast & Detour: http://groups.google.com/group/recastnavigation -- Development blog: http://digestingduck.blogspot.com/ - -## License - -Recast & Detour is licensed under ZLib license, see License.txt for more information. - -## Download -Latest code available at https://github.com/recastnavigation/recastnavigation diff --git a/Engine/lib/recast/version.txt b/Engine/lib/recast/version.txt index 9769f55cc..43c6dbfb0 100644 --- a/Engine/lib/recast/version.txt +++ b/Engine/lib/recast/version.txt @@ -1,4 +1,5 @@ +5d41860 on Jan 5, 2018 1.5.1 released this on Feb 22 2016 From 2e7d406860b9b83536b4f1b42e25cbcbf19a47d6 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 02:36:52 -0500 Subject: [PATCH 011/144] variable naming cleanup due to locals overriding in multiple places. objectname to mObjectName+ getName() refs in dictionary. --- Engine/source/console/simDictionary.cpp | 28 ++++++++++++------------- Engine/source/console/simObject.cpp | 20 +++++++++--------- Engine/source/console/simObject.h | 6 +++--- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Engine/source/console/simDictionary.cpp b/Engine/source/console/simDictionary.cpp index b733d9fcc..4f5aac411 100644 --- a/Engine/source/console/simDictionary.cpp +++ b/Engine/source/console/simDictionary.cpp @@ -45,13 +45,13 @@ SimNameDictionary::~SimNameDictionary() void SimNameDictionary::insert(SimObject* obj) { - if (!obj || !obj->objectName) + if (!obj || !obj->getName()) return; - SimObject* checkForDup = find(obj->objectName); + SimObject* checkForDup = find(obj->getName()); if (checkForDup) - Con::warnf("Warning! You have a duplicate datablock name of %s. This can cause problems. You should rename one of them.", obj->objectName); + Con::warnf("Warning! You have a duplicate datablock name of %s. This can cause problems. You should rename one of them.", obj->getName()); Mutex::lockMutex(mutex); #ifndef USE_NEW_SIMDICTIONARY @@ -64,7 +64,7 @@ void SimNameDictionary::insert(SimObject* obj) dMemset(hashTable, 0, sizeof(*hashTable) * DefaultTableSize); } - S32 idx = HashPointer(obj->objectName) % hashTableSize; + S32 idx = HashPointer(obj->getName()) % hashTableSize; obj->nextNameObject = hashTable[idx]; hashTable[idx] = obj; hashEntryCount++; @@ -86,7 +86,7 @@ void SimNameDictionary::insert(SimObject* obj) { SimObject* next = object->nextNameObject; - idx = HashPointer(object->objectName) % newHashTableSize; + idx = HashPointer(object->getName()) % newHashTableSize; object->nextNameObject = newHashTable[idx]; newHashTable[idx] = object; @@ -118,7 +118,7 @@ SimObject* SimNameDictionary::find(StringTableEntry name) SimObject *walk = hashTable[idx]; while (walk) { - if (walk->objectName == name) + if (walk->getName() == name) { Mutex::unlockMutex(mutex); return walk; @@ -139,12 +139,12 @@ SimObject* SimNameDictionary::find(StringTableEntry name) void SimNameDictionary::remove(SimObject* obj) { - if (!obj || !obj->objectName) + if (!obj || !obj->getName()) return; Mutex::lockMutex(mutex); #ifndef USE_NEW_SIMDICTIONARY - SimObject **walk = &hashTable[HashPointer(obj->objectName) % hashTableSize]; + SimObject **walk = &hashTable[HashPointer(obj->getName()) % hashTableSize]; while (*walk) { if (*walk == obj) @@ -190,12 +190,12 @@ SimManagerNameDictionary::~SimManagerNameDictionary() void SimManagerNameDictionary::insert(SimObject* obj) { - if (!obj || !obj->objectName) + if (!obj || !obj->getName()) return; Mutex::lockMutex(mutex); #ifndef USE_NEW_SIMDICTIONARY - S32 idx = HashPointer(obj->objectName) % hashTableSize; + S32 idx = HashPointer(obj->getName()) % hashTableSize; obj->nextManagerNameObject = hashTable[idx]; hashTable[idx] = obj; hashEntryCount++; @@ -217,7 +217,7 @@ void SimManagerNameDictionary::insert(SimObject* obj) { SimObject* next = object->nextManagerNameObject; - idx = HashPointer(object->objectName) % newHashTableSize; + idx = HashPointer(object->getName()) % newHashTableSize; object->nextManagerNameObject = newHashTable[idx]; newHashTable[idx] = object; @@ -247,7 +247,7 @@ SimObject* SimManagerNameDictionary::find(StringTableEntry name) SimObject *walk = hashTable[idx]; while (walk) { - if (walk->objectName == name) + if (walk->getName() == name) { Mutex::unlockMutex(mutex); return walk; @@ -267,13 +267,13 @@ SimObject* SimManagerNameDictionary::find(StringTableEntry name) void SimManagerNameDictionary::remove(SimObject* obj) { - if (!obj || !obj->objectName) + if (!obj || !obj->getName()) return; #ifndef USE_NEW_SIMDICTIONARY Mutex::lockMutex(mutex); - SimObject **walk = &hashTable[HashPointer(obj->objectName) % hashTableSize]; + SimObject **walk = &hashTable[HashPointer(obj->getName()) % hashTableSize]; while (*walk) { if (*walk == obj) diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index ef688228f..c4b6848c9 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -71,7 +71,7 @@ namespace Sim SimObject::SimObject() { - objectName = NULL; + mObjectName = NULL; mOriginalName = NULL; mInternalName = NULL; nextNameObject = nullptr; @@ -128,10 +128,10 @@ SimObject::~SimObject() AssertFatal(nextNameObject == nullptr,avar( "SimObject::~SimObject: Not removed from dictionary: name %s, id %i", - objectName, mId)); + mObjectName, mId)); AssertFatal(nextManagerNameObject == nullptr,avar( "SimObject::~SimObject: Not removed from manager dictionary: name %s, id %i", - objectName,mId)); + mObjectName,mId)); AssertFatal(mFlags.test(Added) == 0, "SimObject::object " "missing call to SimObject::onRemove"); } @@ -149,7 +149,7 @@ void SimObject::initPersistFields() { addGroup( "Ungrouped" ); - addProtectedField( "name", TypeName, Offset(objectName, SimObject), &setProtectedName, &defaultProtectedGetFn, + addProtectedField( "name", TypeName, Offset(mObjectName, SimObject), &setProtectedName, &defaultProtectedGetFn, "Optional global name of this object." ); endGroup( "Ungrouped" ); @@ -211,8 +211,8 @@ String SimObject::describeSelf() const if( mId != 0 ) desc = avar( "%s|id: %i", desc.c_str(), mId ); - if( objectName ) - desc = avar( "%s|name: %s", desc.c_str(), objectName ); + if(mObjectName) + desc = avar( "%s|name: %s", desc.c_str(), mObjectName); if( mInternalName ) desc = avar( "%s|internal: %s", desc.c_str(), mInternalName ); if( mNameSpace ) @@ -754,9 +754,9 @@ void SimObject::setId(SimObjectId newId) void SimObject::assignName(const char *name) { - if( objectName && !isNameChangeAllowed() ) + if(mObjectName && !isNameChangeAllowed() ) { - Con::errorf( "SimObject::assignName - not allowed to change name of object '%s'", objectName ); + Con::errorf( "SimObject::assignName - not allowed to change name of object '%s'", mObjectName); return; } @@ -781,7 +781,7 @@ void SimObject::assignName(const char *name) Sim::gNameDictionary->remove( this ); } - objectName = newName; + mObjectName = newName; if( mGroup ) mGroup->mNameDictionary.insert( this ); @@ -1373,7 +1373,7 @@ SimObject::SimObject(const SimObject& other, bool temp_clone) { is_temp_clone = temp_clone; - objectName = other.objectName; + mObjectName = other.mObjectName; mOriginalName = other.mOriginalName; nextNameObject = other.nextNameObject; nextManagerNameObject = other.nextManagerNameObject; diff --git a/Engine/source/console/simObject.h b/Engine/source/console/simObject.h index 2119ea6a9..585944df7 100644 --- a/Engine/source/console/simObject.h +++ b/Engine/source/console/simObject.h @@ -293,7 +293,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks }; // dictionary information stored on the object - StringTableEntry objectName; + StringTableEntry mObjectName; StringTableEntry mOriginalName; SimObject* nextNameObject; SimObject* nextManagerNameObject; @@ -358,7 +358,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks { static_cast(object)->setSuperClassNamespace(data); return false; }; static bool writeObjectName(void* obj, StringTableEntry pFieldName) - { SimObject* simObject = static_cast(obj); return simObject->objectName != NULL && simObject->objectName != StringTable->EmptyString(); } + { SimObject* simObject = static_cast(obj); return simObject->mObjectName != NULL && simObject->mObjectName != StringTable->EmptyString(); } static bool writeCanSaveDynamicFields(void* obj, StringTableEntry pFieldName) { return static_cast(obj)->mCanSaveFieldDictionary == false; } static bool writeInternalName(void* obj, StringTableEntry pFieldName) @@ -761,7 +761,7 @@ class SimObject: public ConsoleObject, public TamlCallbacks const char* getIdString() const { return mIdString; } /// Return the name of this object. - StringTableEntry getName() const { return objectName; } + StringTableEntry getName() const { return mObjectName; } /// Return the SimGroup that this object is contained in. Never NULL except for /// RootGroup and unregistered objects. From 2369645a5a7bc20685ae83f21c6df9bc90c44b19 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 03:58:19 -0500 Subject: [PATCH 012/144] simset::objectList to simset::mObjectList --- Engine/source/console/simManager.cpp | 2 +- Engine/source/console/simSet.cpp | 56 +++++++++---------- Engine/source/console/simSet.h | 30 +++++----- .../forest/editor/forestBrushElement.cpp | 4 +- Engine/source/scene/simPath.cpp | 2 +- 5 files changed, 47 insertions(+), 47 deletions(-) diff --git a/Engine/source/console/simManager.cpp b/Engine/source/console/simManager.cpp index 4f12fa85f..fc8a77edd 100644 --- a/Engine/source/console/simManager.cpp +++ b/Engine/source/console/simManager.cpp @@ -612,6 +612,6 @@ void SimDataBlockGroup::sort() if(mLastModifiedKey != SimDataBlock::getNextModifiedKey()) { mLastModifiedKey = SimDataBlock::getNextModifiedKey(); - dQsort(objectList.address(),objectList.size(),sizeof(SimObject *),compareModifiedKey); + dQsort(mObjectList.address(), mObjectList.size(),sizeof(SimObject *),compareModifiedKey); } } diff --git a/Engine/source/console/simSet.cpp b/Engine/source/console/simSet.cpp index c44b09c36..718e5f158 100644 --- a/Engine/source/console/simSet.cpp +++ b/Engine/source/console/simSet.cpp @@ -118,7 +118,7 @@ IMPLEMENT_CALLBACK( SimSet, onObjectRemoved, void, ( SimObject* object ), ( obje SimSet::SimSet() { - VECTOR_SET_ASSOCIATION( objectList ); + VECTOR_SET_ASSOCIATION(mObjectList); mMutex = Mutex::createMutex(); } @@ -139,7 +139,7 @@ void SimSet::addObject( SimObject* obj ) lock(); - const bool added = objectList.pushBack( obj ); + const bool added = mObjectList.pushBack( obj ); if( added ) deleteNotify( obj ); @@ -159,7 +159,7 @@ void SimSet::removeObject( SimObject* obj ) { lock(); - const bool removed = objectList.remove( obj ); + const bool removed = mObjectList.remove( obj ); if( removed ) clearNotify( obj ); @@ -182,7 +182,7 @@ void SimSet::pushObject( SimObject* obj ) lock(); - bool added = objectList.pushBackForce( obj ); + bool added = mObjectList.pushBackForce( obj ); if( added ) deleteNotify( obj ); @@ -200,15 +200,15 @@ void SimSet::pushObject( SimObject* obj ) void SimSet::popObject() { - if( objectList.empty() ) + if(mObjectList.empty() ) { AssertWarn(false, "Stack underflow in SimSet::popObject"); return; } lock(); - SimObject* object = objectList.last(); - objectList.pop_back(); + SimObject* object = mObjectList.last(); + mObjectList.pop_back(); clearNotify( object ); unlock(); @@ -223,7 +223,7 @@ void SimSet::popObject() void SimSet::scriptSort( const String &scriptCallbackFn ) { lock(); - objectList.scriptSort( scriptCallbackFn ); + mObjectList.scriptSort( scriptCallbackFn ); unlock(); } @@ -303,8 +303,8 @@ bool SimSet::reOrder( SimObject *obj, SimObject *target ) if ( itrS != (end()-1) ) { // remove object from its current location and push to back of list - objectList.erase(itrS); - objectList.push_back(obj); + mObjectList.erase(itrS); + mObjectList.push_back(obj); } } else @@ -314,12 +314,12 @@ bool SimSet::reOrder( SimObject *obj, SimObject *target ) // target must be in list return false; - objectList.erase(itrS); + mObjectList.erase(itrS); // once itrS has been erased, itrD won't be pointing at the // same place anymore - re-find... itrD = find(begin(),end(),target); - objectList.insert(itrD, obj); + mObjectList.insert(itrD, obj); } return true; @@ -340,15 +340,15 @@ void SimSet::onRemove() MutexHandle handle; handle.lock( mMutex ); - if( !objectList.empty() ) + if( !mObjectList.empty() ) { - objectList.sortId(); + mObjectList.sortId(); // This backwards iterator loop doesn't work if the // list is empty, check the size first. - for( SimObjectList::iterator ptr = objectList.end() - 1; - ptr >= objectList.begin(); ptr -- ) + for( SimObjectList::iterator ptr = mObjectList.end() - 1; + ptr >= mObjectList.begin(); ptr -- ) clearNotify( *ptr ); } @@ -417,8 +417,8 @@ void SimSet::deleteAllObjects() lock(); while( !empty() ) { - SimObject* object = objectList.last(); - objectList.pop_back(); + SimObject* object = mObjectList.last(); + mObjectList.pop_back(); object->deleteObject(); } @@ -536,7 +536,7 @@ SimObject* SimSet::findObjectByLineNumber(const char* fileName, S32 declarationL SimObject* SimSet::getRandom() { if (size() > 0) - return objectList[mRandI(0, size() - 1)]; + return mObjectList[mRandI(0, size() - 1)]; return NULL; } @@ -640,7 +640,7 @@ void SimGroup::_addObject( SimObject* obj, bool forcePushBack ) if( obj->getGroup() ) obj->getGroup()->removeObject( obj ); - if( forcePushBack ? objectList.pushBack( obj ) : objectList.pushBackForce( obj ) ) + if( forcePushBack ? mObjectList.pushBack( obj ) : mObjectList.pushBackForce( obj ) ) { mNameDictionary.insert( obj ); obj->mGroup = this; @@ -685,7 +685,7 @@ void SimGroup::_removeObjectNoLock( SimObject* obj ) obj->onGroupRemove(); mNameDictionary.remove( obj ); - objectList.remove( obj ); + mObjectList.remove( obj ); obj->mGroup = 0; getSetModificationSignal().trigger( SetObjectRemoved, this, obj ); @@ -709,14 +709,14 @@ void SimGroup::popObject() MutexHandle handle; handle.lock( mMutex ); - if( objectList.empty() ) + if(mObjectList.empty() ) { AssertWarn( false, "SimGroup::popObject - Stack underflow" ); return; } - SimObject* object = objectList.last(); - objectList.pop_back(); + SimObject* object = mObjectList.last(); + mObjectList.pop_back(); object->onGroupRemove(); object->mGroup = NULL; @@ -736,9 +736,9 @@ void SimGroup::popObject() void SimGroup::onRemove() { lock(); - if( !objectList.empty() ) + if( !mObjectList.empty() ) { - objectList.sortId(); + mObjectList.sortId(); clear(); } SimObject::onRemove(); @@ -752,10 +752,10 @@ void SimGroup::clear() lock(); while( size() > 0 ) { - SimObject* object = objectList.last(); + SimObject* object = mObjectList.last(); object->onGroupRemove(); - objectList.pop_back(); + mObjectList.pop_back(); mNameDictionary.remove( object ); object->mGroup = 0; diff --git a/Engine/source/console/simSet.h b/Engine/source/console/simSet.h index 9712e7945..7f49b03ed 100644 --- a/Engine/source/console/simSet.h +++ b/Engine/source/console/simSet.h @@ -114,7 +114,7 @@ class SimSet : public SimObject, public TamlChildren protected: - SimObjectList objectList; + SimObjectList mObjectList; void *mMutex; /// Signal that is triggered when objects are added or removed from the set. @@ -144,14 +144,14 @@ class SimSet : public SimObject, public TamlChildren /// typedef SimObjectList::iterator iterator; typedef SimObjectList::value_type value; - SimObject* front() { return objectList.front(); } - SimObject* first() { return objectList.first(); } - SimObject* last() { return objectList.last(); } - bool empty() const { return objectList.empty(); } - S32 size() const { return objectList.size(); } - iterator begin() { return objectList.begin(); } - iterator end() { return objectList.end(); } - value operator[] (S32 index) { return objectList[U32(index)]; } + SimObject* front() { return mObjectList.front(); } + SimObject* first() { return mObjectList.first(); } + SimObject* last() { return mObjectList.last(); } + bool empty() const { return mObjectList.empty(); } + S32 size() const { return mObjectList.size(); } + iterator begin() { return mObjectList.begin(); } + iterator end() { return mObjectList.end(); } + value operator[] (S32 index) { return mObjectList[U32(index)]; } inline iterator find( iterator first, iterator last, SimObject *obj) { return ::find(first, last, obj); } @@ -163,7 +163,7 @@ class SimSet : public SimObject, public TamlChildren virtual bool reOrder( SimObject *obj, SimObject *target=0 ); /// Return the object at the given index. - SimObject* at(S32 index) const { return objectList.at(index); } + SimObject* at(S32 index) const { return mObjectList.at(index); } /// Remove all objects from this set. virtual void clear(); @@ -263,7 +263,7 @@ class SimSet : public SimObject, public TamlChildren #ifdef TORQUE_DEBUG_GUARD inline void _setVectorAssoc( const char *file, const U32 line ) { - objectList.setFileAssociation( file, line ); + mObjectList.setFileAssociation( file, line ); } #endif @@ -324,9 +324,9 @@ void SimSet::findObjectByType( Vector &foundObjects ) // Loop through our child objects. - SimObjectList::iterator itr = objectList.begin(); + SimObjectList::iterator itr = mObjectList.begin(); - for ( ; itr != objectList.end(); itr++ ) + for ( ; itr != mObjectList.end(); itr++ ) { curObj = dynamic_cast( *itr ); curSet = dynamic_cast( *itr ); @@ -358,9 +358,9 @@ void SimSet::findObjectByCallback( bool ( *fn )( T* ), Vector &foundObjects // Loop through our child objects. - SimObjectList::iterator itr = objectList.begin(); + SimObjectList::iterator itr = mObjectList.begin(); - for ( ; itr != objectList.end(); itr++ ) + for ( ; itr != mObjectList.end(); itr++ ) { curObj = dynamic_cast( *itr ); curSet = dynamic_cast( *itr ); diff --git a/Engine/source/forest/editor/forestBrushElement.cpp b/Engine/source/forest/editor/forestBrushElement.cpp index f61834c9e..bfdedd2b8 100644 --- a/Engine/source/forest/editor/forestBrushElement.cpp +++ b/Engine/source/forest/editor/forestBrushElement.cpp @@ -172,8 +172,8 @@ SimGroup* ForestBrush::getGroup() bool ForestBrush::containsItemData( const ForestItemData *inData ) { - SimObjectList::iterator iter = objectList.begin(); - for ( ; iter != objectList.end(); iter++ ) + SimObjectList::iterator iter = mObjectList.begin(); + for ( ; iter != mObjectList.end(); iter++ ) { ForestBrushElement *pElement = dynamic_cast(*iter); diff --git a/Engine/source/scene/simPath.cpp b/Engine/source/scene/simPath.cpp index e3769df3c..2145af3cc 100644 --- a/Engine/source/scene/simPath.cpp +++ b/Engine/source/scene/simPath.cpp @@ -194,7 +194,7 @@ void Path::onRemove() /// Sort the markers objects into sequence order void Path::sortMarkers() { - dQsort(objectList.address(), objectList.size(), sizeof(SimObject*), cmpPathObject); + dQsort(mObjectList.address(), mObjectList.size(), sizeof(SimObject*), cmpPathObject); } void Path::updatePath() From 5fdad8fe3b3293bb4f6e13c698f88f35ef2815eb Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 04:03:46 -0500 Subject: [PATCH 013/144] local obectName doubleup --- Engine/source/persistence/taml/json/tamlJSONReader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/persistence/taml/json/tamlJSONReader.cpp b/Engine/source/persistence/taml/json/tamlJSONReader.cpp index 7cbc114a9..cc545ca24 100644 --- a/Engine/source/persistence/taml/json/tamlJSONReader.cpp +++ b/Engine/source/persistence/taml/json/tamlJSONReader.cpp @@ -192,7 +192,7 @@ SimObject* TamlJSONReader::parseType( const rapidjson::Value::ConstMemberIterato for( rapidjson::Value::ConstMemberIterator objectMemberItr = typeValue.MemberBegin(); objectMemberItr != typeValue.MemberEnd(); ++objectMemberItr ) { // Fetch name and value. - const rapidjson::Value& objectName = objectMemberItr->name; + const rapidjson::Value& objName = objectMemberItr->name; const rapidjson::Value& objectValue = objectMemberItr->value; // Skip if not an object. @@ -200,7 +200,7 @@ SimObject* TamlJSONReader::parseType( const rapidjson::Value::ConstMemberIterato continue; // Find the period character in the name. - const char* pPeriod = dStrchr( objectName.GetString(), '.' ); + const char* pPeriod = dStrchr( objName.GetString(), '.' ); // Did we find the period? if ( pPeriod == NULL ) From fa2ee65d331fc768c9b3ff55b681b6421b7d20c8 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 04:04:41 -0500 Subject: [PATCH 014/144] overgeneralised variable 'name' clarified between use-cases --- Engine/source/ts/tsDump.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Engine/source/ts/tsDump.cpp b/Engine/source/ts/tsDump.cpp index 57461c04e..987b2b757 100644 --- a/Engine/source/ts/tsDump.cpp +++ b/Engine/source/ts/tsDump.cpp @@ -197,10 +197,10 @@ void TSShapeInstance::dump(Stream & stream) dumpLine("\r\n Sequences:\r\n"); for (i = 0; i < mShape->sequences.size(); i++) { - const char *name = "(none)"; + const char *seqName = "(none)"; if (mShape->sequences[i].nameIndex != -1) - name = mShape->getName(mShape->sequences[i].nameIndex); - dumpLine(avar(" %3d: %s%s%s\r\n", i, name, + seqName = mShape->getName(mShape->sequences[i].nameIndex); + dumpLine(avar(" %3d: %s%s%s\r\n", i, seqName, mShape->sequences[i].isCyclic() ? " (cyclic)" : "", mShape->sequences[i].isBlend() ? " (blend)" : "")); } @@ -212,9 +212,9 @@ void TSShapeInstance::dump(Stream & stream) for (i=0; i<(S32)ml->size(); i++) { U32 flags = ml->getFlags(i); - const String& name = ml->getMaterialName(i); + const String& matName = ml->getMaterialName(i); dumpLine(avar( - " material #%i: '%s'%s.", i, name.c_str(), + " material #%i: '%s'%s.", i, matName.c_str(), flags & (TSMaterialList::S_Wrap|TSMaterialList::T_Wrap) ? "" : " not tiled") ); if (flags & TSMaterialList::Translucent) From bca01fa976f5bc49f8aeb202ea4c64d6c9d8d6c6 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 04:37:41 -0500 Subject: [PATCH 015/144] nother set of generic 'object' varnames, all of which referenced different things --- Engine/source/gui/worldEditor/worldEditor.cpp | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Engine/source/gui/worldEditor/worldEditor.cpp b/Engine/source/gui/worldEditor/worldEditor.cpp index 7846ec094..da87b6bda 100644 --- a/Engine/source/gui/worldEditor/worldEditor.cpp +++ b/Engine/source/gui/worldEditor/worldEditor.cpp @@ -3036,25 +3036,25 @@ bool WorldEditor::alignByAxis( S32 axis ) if(mSelected->size() < 2) return true; - SceneObject* object = dynamic_cast< SceneObject* >( ( *mSelected )[ 0 ] ); - if( !object ) + SceneObject* primaryObj = dynamic_cast< SceneObject* >( ( *mSelected )[ 0 ] ); + if( !primaryObj) return false; submitUndo( mSelected, "Align By Axis" ); // All objects will be repositioned to line up with the // first selected object - Point3F pos = object->getPosition(); + Point3F pos = primaryObj->getPosition(); for(S32 i=0; isize(); ++i) { - SceneObject* object = dynamic_cast< SceneObject* >( ( *mSelected )[ i ] ); - if( !object ) + SceneObject* additionalObj = dynamic_cast< SceneObject* >( ( *mSelected )[ i ] ); + if( !additionalObj) continue; - Point3F objPos = object->getPosition(); + Point3F objPos = additionalObj->getPosition(); objPos[axis] = pos[axis]; - object->setPosition(objPos); + additionalObj->setPosition(objPos); } return true; @@ -4050,8 +4050,8 @@ DefineEngineMethod( WorldEditor, createPolyhedralObject, SceneObject*, ( const c // Create the object. - SceneObject* object = dynamic_cast< SceneObject* >( classRep->create() ); - if( !Object ) + SceneObject* polyObj = dynamic_cast< SceneObject* >( classRep->create() ); + if( !polyObj) { Con::errorf( "WorldEditor::createPolyhedralObject - Could not create SceneObject with class '%s'", className ); return NULL; @@ -4069,7 +4069,7 @@ DefineEngineMethod( WorldEditor, createPolyhedralObject, SceneObject*, ( const c for( U32 i = 0; i < numPoints; ++ i ) { static StringTableEntry sPoint = StringTable->insert( "point" ); - object->setDataField( sPoint, NULL, EngineMarshallData( points[ i ] ) ); + polyObj->setDataField( sPoint, NULL, EngineMarshallData( points[ i ] ) ); } // Add the plane data. @@ -4085,7 +4085,7 @@ DefineEngineMethod( WorldEditor, createPolyhedralObject, SceneObject*, ( const c char buffer[ 1024 ]; dSprintf( buffer, sizeof( buffer ), "%g %g %g %g", plane.x, plane.y, plane.z, plane.d ); - object->setDataField( sPlane, NULL, buffer ); + polyObj->setDataField( sPlane, NULL, buffer ); } // Add the edge data. @@ -4104,24 +4104,24 @@ DefineEngineMethod( WorldEditor, createPolyhedralObject, SceneObject*, ( const c edge.vertex[ 0 ], edge.vertex[ 1 ] ); - object->setDataField( sEdge, NULL, buffer ); + polyObj->setDataField( sEdge, NULL, buffer ); } // Set the transform. - object->setTransform( savedTransform ); - object->setScale( savedScale ); + polyObj->setTransform( savedTransform ); + polyObj->setScale( savedScale ); // Register and return the object. - if( !object->registerObject() ) + if( !polyObj->registerObject() ) { Con::errorf( "WorldEditor::createPolyhedralObject - Failed to register object!" ); - delete object; + delete polyObj; return NULL; } - return object; + return polyObj; } //----------------------------------------------------------------------------- From 8ec82013ca0d8113aab665628df14a04456a7502 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 14:30:49 -0500 Subject: [PATCH 016/144] corrects PopupMenu::checkItem() not checking the item. also prepends m to member variables for the MenuItem class to correct a few more locals hiding classvar reports. --- Engine/source/gui/editor/guiMenuBar.cpp | 14 +-- Engine/source/gui/editor/guiPopupMenuCtrl.cpp | 10 +- Engine/source/gui/editor/popupMenu.cpp | 104 +++++++++--------- Engine/source/gui/editor/popupMenu.h | 48 ++++---- 4 files changed, 91 insertions(+), 85 deletions(-) diff --git a/Engine/source/gui/editor/guiMenuBar.cpp b/Engine/source/gui/editor/guiMenuBar.cpp index dc168436b..89958fa5b 100644 --- a/Engine/source/gui/editor/guiMenuBar.cpp +++ b/Engine/source/gui/editor/guiMenuBar.cpp @@ -1369,19 +1369,19 @@ void GuiMenuBar::buildWindowAcceleratorMap(WindowInputGenerator &inputGenerator) { for (U32 item = 0; item < mMenuList[i].popupMenu->mMenuItems.size(); item++) { - if (!mMenuList[i].popupMenu->mMenuItems[item].accelerator) + if (!mMenuList[i].popupMenu->mMenuItems[item].mAccelerator) { - mMenuList[i].popupMenu->mMenuItems[item].accelerator = 0; + mMenuList[i].popupMenu->mMenuItems[item].mAccelerator = 0; continue; } EventDescriptor accelEvent; - ActionMap::createEventDescriptor(mMenuList[i].popupMenu->mMenuItems[item].accelerator, &accelEvent); + ActionMap::createEventDescriptor(mMenuList[i].popupMenu->mMenuItems[item].mAccelerator, &accelEvent); //now we have a modifier, and a key, add them to the canvas - inputGenerator.addAcceleratorKey(this, mMenuList[i].popupMenu->mMenuItems[item].cmd, accelEvent.eventCode, accelEvent.flags); + inputGenerator.addAcceleratorKey(this, mMenuList[i].popupMenu->mMenuItems[item].mCMD, accelEvent.eventCode, accelEvent.flags); - mMenuList[i].popupMenu->mMenuItems[item].acceleratorIndex = mCurAcceleratorIndex; + mMenuList[i].popupMenu->mMenuItems[item].mAcceleratorIndex = mCurAcceleratorIndex; mCurAcceleratorIndex++; } } @@ -1403,7 +1403,7 @@ void GuiMenuBar::acceleratorKeyPress(U32 index) for(U32 item = 0; item < mMenuList[i].popupMenu->mMenuItems.size(); item++) { - if(mMenuList[i].popupMenu->mMenuItems[item].acceleratorIndex == index) + if(mMenuList[i].popupMenu->mMenuItems[item].mAcceleratorIndex == index) { // first, call the script callback for menu selection: onMenuSelect_callback(mMenuList[i].popupMenu->getId(), mMenuList[i].text); @@ -1454,7 +1454,7 @@ void GuiMenuBar::insert(SimObject* pObject, S32 pos) newMenu.drawBitmapOnly = false; newMenu.drawBorder = true; newMenu.bitmapIndex = -1; - newMenu.text = menu->barTitle; + newMenu.text = menu->mBarTitle; newMenu.visible = true; newMenu.popupMenu = menu; diff --git a/Engine/source/gui/editor/guiPopupMenuCtrl.cpp b/Engine/source/gui/editor/guiPopupMenuCtrl.cpp index d03a8bec1..1d72b794c 100644 --- a/Engine/source/gui/editor/guiPopupMenuCtrl.cpp +++ b/Engine/source/gui/editor/guiPopupMenuCtrl.cpp @@ -100,7 +100,7 @@ GuiPopupMenuTextListCtrl::GuiPopupMenuTextListCtrl() void GuiPopupMenuTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool selected, bool mouseOver) { //check if we're a real entry, or if it's a divider - if (mPopup->mMenuItems[cell.y].isSpacer) + if (mPopup->mMenuItems[cell.y].mIsSpacer) { S32 yp = offset.y + mCellSize.y / 2; GFX->getDrawUtil()->drawLine(offset.x + 5, yp, offset.x + mCellSize.x - 5, yp, ColorI(128, 128, 128)); @@ -214,8 +214,8 @@ void GuiPopupMenuTextListCtrl::onMouseUp(const GuiEvent &event) if (item) { - if (item->enabled) - dAtob(Con::executef(mPopup, "onSelectItem", Con::getIntArg(getSelectedCell().y), item->text.isNotEmpty() ? item->text : "")); + if (item->mEnabled) + dAtob(Con::executef(mPopup, "onSelectItem", Con::getIntArg(getSelectedCell().y), item->mText.isNotEmpty() ? item->mText : "")); } } @@ -247,9 +247,9 @@ void GuiPopupMenuTextListCtrl::onCellHighlighted(Point2I cell) { MenuItem *list = &mPopup->mMenuItems[selectionIndex]; - if (list->isSubmenu && list->subMenu != nullptr) + if (list->mIsSubmenu && list->mSubMenu != nullptr) { - list->subMenu->showPopup(getRoot(), getPosition().x + mCellSize.x, getPosition().y + (selectionIndex * mCellSize.y)); + list->mSubMenu->showPopup(getRoot(), getPosition().x + mCellSize.x, getPosition().y + (selectionIndex * mCellSize.y)); } } } \ No newline at end of file diff --git a/Engine/source/gui/editor/popupMenu.cpp b/Engine/source/gui/editor/popupMenu.cpp index 0e5db18da..63b5241e3 100644 --- a/Engine/source/gui/editor/popupMenu.cpp +++ b/Engine/source/gui/editor/popupMenu.cpp @@ -46,14 +46,20 @@ public: //----------------------------------------------------------------------------- PopupMenu::PopupMenu() { - bitmapIndex = -1; + mMenuItems = NULL; + mMenuBarCtrl = nullptr; - barTitle = StringTable->EmptyString(); + mBarTitle = StringTable->EmptyString(); + mBounds = RectI(0, 0, 64, 64); + mVisible = true; - mMenuBarCtrl = nullptr; - mTextList = nullptr; + mBitmapIndex = -1; + mDrawBitmapOnly = false; + mDrawBorder = false; - isSubmenu = false; + mTextList = nullptr; + + mIsSubmenu = false; } PopupMenu::~PopupMenu() @@ -76,7 +82,7 @@ void PopupMenu::initPersistFields() { Parent::initPersistFields(); - addField("barTitle", TypeCaseString, Offset(barTitle, PopupMenu), ""); + addField("barTitle", TypeCaseString, Offset(mBarTitle, PopupMenu), ""); } //----------------------------------------------------------------------------- @@ -134,28 +140,28 @@ S32 PopupMenu::insertItem(S32 pos, const char *title, const char* accelerator, c String titleString = title; MenuItem newItem; - newItem.id = pos; - newItem.text = titleString; - newItem.cmd = cmd; + newItem.mID = pos; + newItem.mText = titleString; + newItem.mCMD = cmd; if (titleString.isEmpty() || titleString == String("-")) - newItem.isSpacer = true; + newItem.mIsSpacer = true; else - newItem.isSpacer = false; + newItem.mIsSpacer = false; if (accelerator[0]) - newItem.accelerator = dStrdup(accelerator); + newItem.mAccelerator = dStrdup(accelerator); else - newItem.accelerator = NULL; + newItem.mAccelerator = NULL; - newItem.visible = true; - newItem.isChecked = false; - newItem.acceleratorIndex = 0; - newItem.enabled = !newItem.isSpacer; + newItem.mVisible = true; + newItem.mIsChecked = false; + newItem.mAcceleratorIndex = 0; + newItem.mEnabled = !newItem.mIsSpacer; - newItem.isSubmenu = false; - newItem.subMenu = nullptr; - newItem.subMenuParentMenu = nullptr; + newItem.mIsSubmenu = false; + newItem.mSubMenu = nullptr; + newItem.mSubMenuParentMenu = nullptr; mMenuItems.push_back(newItem); @@ -166,11 +172,11 @@ S32 PopupMenu::insertSubMenu(S32 pos, const char *title, PopupMenu *submenu) { S32 itemPos = insertItem(pos, title, "", ""); - mMenuItems[itemPos].isSubmenu = true; - mMenuItems[itemPos].subMenu = submenu; - mMenuItems[itemPos].subMenuParentMenu = this; + mMenuItems[itemPos].mIsSubmenu = true; + mMenuItems[itemPos].mSubMenu = submenu; + mMenuItems[itemPos].mSubMenuParentMenu = this; - submenu->isSubmenu = true; + submenu->mIsSubmenu = true; return itemPos; } @@ -181,15 +187,15 @@ bool PopupMenu::setItem(S32 pos, const char *title, const char* accelerator, con for (U32 i = 0; i < mMenuItems.size(); i++) { - if (mMenuItems[i].text == titleString) + if (mMenuItems[i].mText == titleString) { - mMenuItems[i].id = pos; - mMenuItems[i].cmd = cmd; + mMenuItems[i].mID = pos; + mMenuItems[i].mCMD = cmd; if (accelerator && accelerator[0]) - mMenuItems[i].accelerator = dStrdup(accelerator); + mMenuItems[i].mAccelerator = dStrdup(accelerator); else - mMenuItems[i].accelerator = NULL; + mMenuItems[i].mAccelerator = NULL; return true; } } @@ -211,7 +217,7 @@ void PopupMenu::enableItem(S32 pos, bool enable) if (mMenuItems.size() < pos || pos < 0) return; - mMenuItems[pos].enabled = enable; + mMenuItems[pos].mEnabled = enable; } void PopupMenu::checkItem(S32 pos, bool checked) @@ -219,24 +225,24 @@ void PopupMenu::checkItem(S32 pos, bool checked) if (mMenuItems.size() < pos || pos < 0) return; - if (checked && mMenuItems[pos].checkGroup != -1) + if (checked && mMenuItems[pos].mCheckGroup != -1) { // first, uncheck everything in the group: for (U32 i = 0; i < mMenuItems.size(); i++) - if (mMenuItems[i].checkGroup == mMenuItems[pos].checkGroup && mMenuItems[i].isChecked) - mMenuItems[i].isChecked = false; + if (mMenuItems[i].mCheckGroup == mMenuItems[pos].mCheckGroup && mMenuItems[i].mIsChecked) + mMenuItems[i].mIsChecked = false; } - mMenuItems[pos].isChecked; + mMenuItems[pos].mIsChecked = checked; } void PopupMenu::checkRadioItem(S32 firstPos, S32 lastPos, S32 checkPos) { for (U32 i = 0; i < mMenuItems.size(); i++) { - if (mMenuItems[i].id >= firstPos && mMenuItems[i].id <= lastPos) + if (mMenuItems[i].mID >= firstPos && mMenuItems[i].mID <= lastPos) { - mMenuItems[i].isChecked = false; + mMenuItems[i].mIsChecked = false; } } } @@ -246,7 +252,7 @@ bool PopupMenu::isItemChecked(S32 pos) if (mMenuItems.size() < pos || pos < 0) return false; - return mMenuItems[pos].isChecked; + return mMenuItems[pos].mIsChecked; } U32 PopupMenu::getItemCount() @@ -305,7 +311,7 @@ void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */) if (!backgroundCtrl || !mTextList) return; - if (!isSubmenu) + if (!mIsSubmenu) { //if we're a 'parent' menu, then tell the background to clear out all existing other popups @@ -354,11 +360,11 @@ void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */) for (U32 i = 0; i < mMenuItems.size(); i++) { - if (!mMenuItems[i].visible) + if (!mMenuItems[i].mVisible) continue; - S32 iTextWidth = font->getStrWidth(mMenuItems[i].text.c_str()); - S32 iAcceleratorWidth = mMenuItems[i].accelerator ? font->getStrWidth(mMenuItems[i].accelerator) : 0; + S32 iTextWidth = font->getStrWidth(mMenuItems[i].mText.c_str()); + S32 iAcceleratorWidth = mMenuItems[i].mAccelerator ? font->getStrWidth(mMenuItems[i].mAccelerator) : 0; if (iTextWidth > textWidth) textWidth = iTextWidth; @@ -378,7 +384,7 @@ void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */) for (U32 i = 0; i < mMenuItems.size(); i++) { - if (!mMenuItems[i].visible) + if (!mMenuItems[i].mVisible) continue; char buf[512]; @@ -386,17 +392,17 @@ void PopupMenu::showPopup(GuiCanvas *owner, S32 x /* = -1 */, S32 y /* = -1 */) // If this menu item is a submenu, then set the isSubmenu to 2 to indicate // an arrow should be drawn. Otherwise set the isSubmenu normally. char isSubmenu = 1; - if (mMenuItems[i].isSubmenu) + if (mMenuItems[i].mIsSubmenu) isSubmenu = 2; char bitmapIndex = 1; - if (mMenuItems[i].bitmapIndex >= 0 && (mMenuItems[i].bitmapIndex * 3 <= profile->mBitmapArrayRects.size())) - bitmapIndex = mMenuItems[i].bitmapIndex + 2; + if (mMenuItems[i].mBitmapIndex >= 0 && (mMenuItems[i].mBitmapIndex * 3 <= profile->mBitmapArrayRects.size())) + bitmapIndex = mMenuItems[i].mBitmapIndex + 2; - dSprintf(buf, sizeof(buf), "%c%c\t%s\t%s", bitmapIndex, isSubmenu, mMenuItems[i].text.c_str(), mMenuItems[i].accelerator ? mMenuItems[i].accelerator : ""); + dSprintf(buf, sizeof(buf), "%c%c\t%s\t%s", bitmapIndex, isSubmenu, mMenuItems[i].mText.c_str(), mMenuItems[i].mAccelerator ? mMenuItems[i].mAccelerator : ""); mTextList->addEntry(entryCount, buf); - if (!mMenuItems[i].enabled) + if (!mMenuItems[i].mEnabled) mTextList->setEntryActive(entryCount, false); entryCount++; @@ -437,8 +443,8 @@ void PopupMenu::hidePopupSubmenus() { for (U32 i = 0; i < mMenuItems.size(); i++) { - if (mMenuItems[i].subMenu != nullptr) - mMenuItems[i].subMenu->hidePopup(); + if (mMenuItems[i].mSubMenu != nullptr) + mMenuItems[i].mSubMenu->hidePopup(); } } diff --git a/Engine/source/gui/editor/popupMenu.h b/Engine/source/gui/editor/popupMenu.h index 9a6dd0821..66a67b1ff 100644 --- a/Engine/source/gui/editor/popupMenu.h +++ b/Engine/source/gui/editor/popupMenu.h @@ -34,27 +34,27 @@ class GuiPopupMenuBackgroundCtrl; struct MenuItem // an individual item in a pull-down menu { - String text; // the text of the menu item - U32 id; // a script-assigned identifier - char *accelerator; // the keyboard accelerator shortcut for the menu item - U32 acceleratorIndex; // index of this accelerator - bool enabled; // true if the menu item is selectable - bool visible; // true if the menu item is visible - S32 bitmapIndex; // index of the bitmap in the bitmap array - S32 checkGroup; // the group index of the item visa vi check marks - + String mText; // the text of the menu item + U32 mID; // a script-assigned identifier + char *mAccelerator; // the keyboard accelerator shortcut for the menu item + U32 mAcceleratorIndex; // index of this accelerator + bool mEnabled; // true if the menu item is selectable + bool mVisible; // true if the menu item is visible + S32 mBitmapIndex; // index of the bitmap in the bitmap array + S32 mCheckGroup; // the group index of the item visa vi check marks - // only one item in the group can be checked. - bool isSubmenu; // This menu item has a submenu that will be displayed + bool mIsSubmenu; // This menu item has a submenu that will be displayed - bool isChecked; + bool mIsChecked; - bool isSpacer; + bool mIsSpacer; - bool isMenubarEntry; + bool mIsMenubarEntry; - PopupMenu* subMenuParentMenu; // For a submenu, this is the parent menu - PopupMenu* subMenu; - String cmd; + PopupMenu* mSubMenuParentMenu; // For a submenu, this is the parent menu + PopupMenu* mSubMenu; + String mCMD; }; // PopupMenu represents a menu. @@ -72,16 +72,16 @@ protected: GuiMenuBar* mMenuBarCtrl; - StringTableEntry barTitle; + StringTableEntry mBarTitle; - RectI bounds; - bool visible; + RectI mBounds; + bool mVisible; - S32 bitmapIndex; // Index of the bitmap in the bitmap array (-1 = no bitmap) - bool drawBitmapOnly; // Draw only the bitmap and not the text - bool drawBorder; // Should a border be drawn around this menu (usually if we only have a bitmap, we don't want a border) + S32 mBitmapIndex; // Index of the bitmap in the bitmap array (-1 = no bitmap) + bool mDrawBitmapOnly; // Draw only the bitmap and not the text + bool mDrawBorder; // Should a border be drawn around this menu (usually if we only have a bitmap, we don't want a border) - bool isSubmenu; + bool mIsSubmenu; //This is the gui control that renders our popup GuiPopupMenuTextListCtrl *mTextList; @@ -175,8 +175,8 @@ public: virtual bool onMessageReceived(StringTableEntry queue, const char* event, const char* data ); virtual bool onMessageObjectReceived(StringTableEntry queue, Message *msg ); - bool isVisible() { return visible; } - void setVisible(bool isVis) { visible = isVis; } + bool isVisible() { return mVisible; } + void setVisible(bool isVis) { mVisible = isVis; } GuiMenuBar* getMenuBarCtrl(); }; From c875f44bd1d6b9a284c0b1f9ced354a5bb4f2cfe Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 16:00:10 -0500 Subject: [PATCH 017/144] clarified several variable 'r' definitions, as well as a doubleup of a sucessive S32 txt_w = mProfile->mFont->getStrWidth( buff ); pair --- Engine/source/gui/controls/guiPopUpCtrl.cpp | 62 ++++++++++----------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/Engine/source/gui/controls/guiPopUpCtrl.cpp b/Engine/source/gui/controls/guiPopUpCtrl.cpp index af172221a..33f3c0d30 100644 --- a/Engine/source/gui/controls/guiPopUpCtrl.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrl.cpp @@ -190,9 +190,9 @@ void GuiPopupTextListCtrl::onRenderCell(Point2I offset, Point2I cell, bool selec if(drawbox) { Point2I coloredboxsize(15,10); - RectI r(offset.x + mProfile->mTextOffset.x, offset.y+2, coloredboxsize.x, coloredboxsize.y); - GFX->getDrawUtil()->drawRectFill( r, boxColor); - GFX->getDrawUtil()->drawRect( r, ColorI(0,0,0)); + RectI boxBounds(offset.x + mProfile->mTextOffset.x, offset.y+2, coloredboxsize.x, coloredboxsize.y); + GFX->getDrawUtil()->drawRectFill(boxBounds, boxColor); + GFX->getDrawUtil()->drawRect(boxBounds, ColorI(0,0,0)); textXOffset += coloredboxsize.x + mProfile->mTextOffset.x; } @@ -854,23 +854,23 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) GFXDrawUtil* drawUtil = GFX->getDrawUtil(); - RectI r( offset, getExtent() ); + RectI baseRect( offset, getExtent() ); if ( mInAction ) { - S32 l = r.point.x, r2 = r.point.x + r.extent.x - 1; - S32 t = r.point.y, b = r.point.y + r.extent.y - 1; + S32 left = baseRect.point.x, right = baseRect.point.x + baseRect.extent.x - 1; + S32 top = baseRect.point.y, bottom = baseRect.point.y + baseRect.extent.y - 1; // Do we render a bitmap border or lines? if ( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) { // Render the fixed, filled in border - renderFixedBitmapBordersFilled(r, 3, mProfile ); + renderFixedBitmapBordersFilled(baseRect, 3, mProfile ); } else { //renderSlightlyLoweredBox(r, mProfile); - drawUtil->drawRectFill( r, mProfile->mFillColor ); + drawUtil->drawRectFill(baseRect, mProfile->mFillColor ); } // Draw a bitmap over the background? @@ -890,10 +890,10 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) // Do we render a bitmap border or lines? if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) ) { - drawUtil->drawLine( l, t, l, b, colorWhite ); - drawUtil->drawLine( l, t, r2, t, colorWhite ); - drawUtil->drawLine( l + 1, b, r2, b, mProfile->mBorderColor ); - drawUtil->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor ); + drawUtil->drawLine(left, top, left, bottom, colorWhite ); + drawUtil->drawLine(left, top, right, top, colorWhite ); + drawUtil->drawLine(left + 1, bottom, right, bottom, mProfile->mBorderColor ); + drawUtil->drawLine(right, top + 1, right, bottom - 1, mProfile->mBorderColor ); } } @@ -902,19 +902,19 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) // TODO: Add onMouseEnter() and onMouseLeave() and a definition of mMouseOver (see guiButtonBaseCtrl) for this to work. if ( mMouseOver ) { - S32 l = r.point.x, r2 = r.point.x + r.extent.x - 1; - S32 t = r.point.y, b = r.point.y + r.extent.y - 1; + S32 left = baseRect.point.x, right = baseRect.point.x + baseRect.extent.x - 1; + S32 top = baseRect.point.y, bottom = baseRect.point.y + baseRect.extent.y - 1; // Do we render a bitmap border or lines? if ( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) { // Render the fixed, filled in border - renderFixedBitmapBordersFilled( r, 2, mProfile ); + renderFixedBitmapBordersFilled(baseRect, 2, mProfile ); } else { - drawUtil->drawRectFill( r, mProfile->mFillColorHL ); + drawUtil->drawRectFill(baseRect, mProfile->mFillColorHL ); } // Draw a bitmap over the background? @@ -928,10 +928,10 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) // Do we render a bitmap border or lines? if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) ) { - drawUtil->drawLine( l, t, l, b, colorWhite ); - drawUtil->drawLine( l, t, r2, t, colorWhite ); - drawUtil->drawLine( l + 1, b, r2, b, mProfile->mBorderColor ); - drawUtil->drawLine( r2, t + 1, r2, b - 1, mProfile->mBorderColor ); + drawUtil->drawLine(left, top, left, bottom, colorWhite); + drawUtil->drawLine(left, top, right, top, colorWhite); + drawUtil->drawLine(left + 1, bottom, right, bottom, mProfile->mBorderColor); + drawUtil->drawLine(right, top + 1, right, bottom - 1, mProfile->mBorderColor); } } else @@ -940,11 +940,11 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) if ( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) { // Render the fixed, filled in border - renderFixedBitmapBordersFilled( r, 1, mProfile ); + renderFixedBitmapBordersFilled(baseRect, 1, mProfile ); } else { - drawUtil->drawRectFill( r, mProfile->mFillColorNA ); + drawUtil->drawRectFill(baseRect, mProfile->mFillColorNA ); } // Draw a bitmap over the background? @@ -958,7 +958,7 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) // Do we render a bitmap border or lines? if ( !( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) ) { - drawUtil->drawRect( r, mProfile->mBorderColorNA ); + drawUtil->drawRect( baseRect, mProfile->mBorderColorNA ); } } // renderSlightlyRaisedBox(r, mProfile); // Used to be the only 'else' condition to mInAction above. @@ -1028,9 +1028,9 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) if ( drawbox ) { Point2I coloredboxsize( 15, 10 ); - RectI r( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y ); - drawUtil->drawRectFill( r, boxColor); - drawUtil->drawRect( r, ColorI(0,0,0)); + RectI boxBounds( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y ); + drawUtil->drawRectFill(boxBounds, boxColor); + drawUtil->drawRect(boxBounds, ColorI(0,0,0)); localStart.x += coloredboxsize.x + mProfile->mTextOffset.x; } @@ -1054,18 +1054,18 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) // Draw the second column to the right getColumn( mText, buff, 1, "\t" ); - S32 txt_w = mProfile->mFont->getStrWidth( buff ); + S32 colTxt_w = mProfile->mFont->getStrWidth( buff ); if ( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) { // We're making use of a bitmap border, so take into account the // right cap of the border. RectI* bitmapBounds = mProfile->mBitmapArrayRects.address(); - Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - bitmapBounds[2].extent.x, localStart.y ) ); + Point2I textpos = localToGlobalCoord( Point2I( getWidth() - colTxt_w - bitmapBounds[2].extent.x, localStart.y ) ); drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors ); } else { - Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - 12, localStart.y ) ); + Point2I textpos = localToGlobalCoord( Point2I( getWidth() - colTxt_w - 12, localStart.y ) ); drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors ); } @@ -1078,10 +1078,10 @@ void GuiPopUpMenuCtrl::onRender( Point2I offset, const RectI &updateRect ) if ( !(mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size()) ) { // Draw a triangle (down arrow) - S32 left = r.point.x + r.extent.x - 12; + S32 left = baseRect.point.x + baseRect.extent.x - 12; S32 right = left + 8; S32 middle = left + 4; - S32 top = r.extent.y / 2 + r.point.y - 4; + S32 top = baseRect.extent.y / 2 + baseRect.point.y - 4; S32 bottom = top + 8; PrimBuild::color( mProfile->mFontColor ); From 015f07e50e73d5a7e9cf8d8c7e76ccb98004f859 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 17:41:22 -0500 Subject: [PATCH 018/144] cleans up extra=extra complaint --- Engine/source/afx/afxChoreographer.cpp | 4 ++-- Engine/source/afx/afxChoreographer.h | 4 ++-- Engine/source/afx/afxEffectron.cpp | 6 +++--- Engine/source/afx/afxMagicSpell.cpp | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Engine/source/afx/afxChoreographer.cpp b/Engine/source/afx/afxChoreographer.cpp index 5473552f5..e0f20fa75 100644 --- a/Engine/source/afx/afxChoreographer.cpp +++ b/Engine/source/afx/afxChoreographer.cpp @@ -142,7 +142,7 @@ afxChoreographer::afxChoreographer() lod = 0; exec_conds_mask = 0; choreographer_id = 0; - extra = 0; + mExtra = 0; started_with_newop = false; postpone_activation = false; remapped_cons_sent = false; // CONSTRAINT REMAPPING @@ -179,7 +179,7 @@ afxChoreographer::~afxChoreographer() void afxChoreographer::initPersistFields() { // conditionals - addField("extra", TYPEID(), Offset(extra, afxChoreographer), + addField("extra", TYPEID(), Offset(mExtra, afxChoreographer), "..."); addField("postponeActivation", TypeBool, Offset(postpone_activation, afxChoreographer), "..."); diff --git a/Engine/source/afx/afxChoreographer.h b/Engine/source/afx/afxChoreographer.h index 3665e1306..e3b83585e 100644 --- a/Engine/source/afx/afxChoreographer.h +++ b/Engine/source/afx/afxChoreographer.h @@ -121,7 +121,7 @@ protected: U8 ranking; U8 lod; U32 exec_conds_mask; - SimObject* extra; + SimObject* mExtra; Vector explicit_clients; bool started_with_newop; bool postpone_activation; @@ -182,7 +182,7 @@ public: void clearChoreographerId() { choreographer_id = 0; } U32 getChoreographerId() { return choreographer_id; } void setGhostConstraintObject(SceneObject*, StringTableEntry cons_name); - void setExtra(SimObject* extra) { this->extra = extra; } + void setExtra(SimObject* extra) { mExtra = extra; } void addExplicitClient(NetConnection* conn); void removeExplicitClient(NetConnection* conn); U32 getExplicitClientCount() { return explicit_clients.size(); } diff --git a/Engine/source/afx/afxEffectron.cpp b/Engine/source/afx/afxEffectron.cpp index b33fd9d99..5a1bacbf4 100644 --- a/Engine/source/afx/afxEffectron.cpp +++ b/Engine/source/afx/afxEffectron.cpp @@ -407,9 +407,9 @@ U32 afxEffectron::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) if (stream->writeFlag(mask & InitialUpdateMask)) { // pack extra object's ghost index or scope id if not yet ghosted - if (stream->writeFlag(dynamic_cast(extra) != 0)) + if (stream->writeFlag(dynamic_cast(mExtra) != 0)) { - NetObject* net_extra = (NetObject*)extra; + NetObject* net_extra = (NetObject*)mExtra; S32 ghost_idx = conn->getGhostIndex(net_extra); if (stream->writeFlag(ghost_idx != -1)) stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount); @@ -476,7 +476,7 @@ void afxEffectron::unpackUpdate(NetConnection * conn, BitStream * stream) if (stream->readFlag()) // is ghost_idx { S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount); - extra = dynamic_cast(conn->resolveGhost(ghost_idx)); + mExtra = dynamic_cast(conn->resolveGhost(ghost_idx)); } else { diff --git a/Engine/source/afx/afxMagicSpell.cpp b/Engine/source/afx/afxMagicSpell.cpp index 7aeb93da8..39621f8cd 100644 --- a/Engine/source/afx/afxMagicSpell.cpp +++ b/Engine/source/afx/afxMagicSpell.cpp @@ -1089,9 +1089,9 @@ U32 afxMagicSpell::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) if (stream->writeFlag(mask & InitialUpdateMask)) { // pack extra object's ghost index or scope id if not yet ghosted - if (stream->writeFlag(dynamic_cast(extra) != 0)) + if (stream->writeFlag(dynamic_cast(mExtra) != 0)) { - NetObject* net_extra = (NetObject*)extra; + NetObject* net_extra = (NetObject*)mExtra; S32 ghost_idx = conn->getGhostIndex(net_extra); if (stream->writeFlag(ghost_idx != -1)) stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount); @@ -1252,7 +1252,7 @@ void afxMagicSpell::unpackUpdate(NetConnection * conn, BitStream * stream) if (stream->readFlag()) // is ghost_idx { S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount); - extra = dynamic_cast(conn->resolveGhost(ghost_idx)); + mExtra = dynamic_cast(conn->resolveGhost(ghost_idx)); } else { From f59b92bf4e1f80e0de66cff3e07b4ee4018f7f69 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 19:10:55 -0500 Subject: [PATCH 019/144] winconsole many, many i vars. worldEditor path arguement, lockPtr doubleup. volume.cpp: uneccesary duplicated FileNode::Attributes attr; def --- Engine/source/core/volume.cpp | 1 - Engine/source/gui/worldEditor/worldEditor.cpp | 12 ++++++------ Engine/source/platformWin32/winConsole.cpp | 8 ++++---- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Engine/source/core/volume.cpp b/Engine/source/core/volume.cpp index 4c3c85b4e..3630f7ffb 100644 --- a/Engine/source/core/volume.cpp +++ b/Engine/source/core/volume.cpp @@ -808,7 +808,6 @@ bool MountSystem::isDirectory(const Path& path, FileSystemRef fsRef) if (fnRef.isNull()) return false; - FileNode::Attributes attr; if (fnRef->getAttributes(&attr)) return attr.flags & FileNode::Directory; return false; diff --git a/Engine/source/gui/worldEditor/worldEditor.cpp b/Engine/source/gui/worldEditor/worldEditor.cpp index da87b6bda..0a5b6f47b 100644 --- a/Engine/source/gui/worldEditor/worldEditor.cpp +++ b/Engine/source/gui/worldEditor/worldEditor.cpp @@ -1454,16 +1454,16 @@ void WorldEditor::renderSplinePath(SimPath::Path *path) } - CameraSpline::Knot::Path path; + CameraSpline::Knot::Path tPath; switch (pathmarker->mSmoothingType) { - case Marker::SmoothingTypeLinear: path = CameraSpline::Knot::LINEAR; break; + case Marker::SmoothingTypeLinear: tPath = CameraSpline::Knot::LINEAR; break; case Marker::SmoothingTypeSpline: - default: path = CameraSpline::Knot::SPLINE; break; + default: tPath = CameraSpline::Knot::SPLINE; break; } - spline.push_back(new CameraSpline::Knot(pos, rot, 1.0f, type, path)); + spline.push_back(new CameraSpline::Knot(pos, rot, 1.0f, type, tPath)); } F32 t = 0.0f; @@ -1559,8 +1559,8 @@ void WorldEditor::renderSplinePath(SimPath::Path *path) // Reset for next pass... vIdx = 0; - void *lockPtr = vb.lock(); - if(!lockPtr) return; + void *nextlockPtr = vb.lock(); + if(!nextlockPtr) return; } } diff --git a/Engine/source/platformWin32/winConsole.cpp b/Engine/source/platformWin32/winConsole.cpp index cc92c2c15..93ce3c68e 100644 --- a/Engine/source/platformWin32/winConsole.cpp +++ b/Engine/source/platformWin32/winConsole.cpp @@ -176,12 +176,12 @@ void WinConsole::process() S32 outpos = 0; ReadConsoleInput(stdIn, rec, 20, &numEvents); - DWORD i; - for(i = 0; i < numEvents; i++) + DWORD evt; + for(evt = 0; evt < numEvents; evt++) { - if(rec[i].EventType == KEY_EVENT) + if(rec[evt].EventType == KEY_EVENT) { - KEY_EVENT_RECORD *ke = &(rec[i].Event.KeyEvent); + KEY_EVENT_RECORD *ke = &(rec[evt].Event.KeyEvent); if(ke->bKeyDown) { switch (ke->uChar.AsciiChar) From 76602509e36de8549ddf90209a5ddd88f53c8dea Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 23:07:34 -0500 Subject: [PATCH 020/144] delta to mDelta to resolve another class var vs method var confusionpoint --- Engine/source/T3D/item.cpp | 68 ++++++++++++++--------------- Engine/source/T3D/item.h | 2 +- Engine/source/T3D/proximityMine.cpp | 4 +- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/Engine/source/T3D/item.cpp b/Engine/source/T3D/item.cpp index e6d21b93a..d8f8cad1e 100644 --- a/Engine/source/T3D/item.cpp +++ b/Engine/source/T3D/item.cpp @@ -320,8 +320,8 @@ Item::Item() mAtRest = true; mAtRestCounter = 0; mInLiquid = false; - delta.warpTicks = 0; - delta.dt = 1; + mDelta.warpTicks = 0; + mDelta.dt = 1; mCollisionObject = 0; mCollisionTimeout = 0; mPhysicsRep = NULL; @@ -350,7 +350,7 @@ bool Item::onAdd() if (mStatic) mAtRest = true; - mObjToWorld.getColumn(3,&delta.pos); + mObjToWorld.getColumn(3,&mDelta.pos); // Setup the box for our convex object... mObjBox.getCenter(&mConvex.mCenter); @@ -564,21 +564,21 @@ void Item::processTick(const Move* move) mCollisionObject = 0; // Warp to catch up to server - if (delta.warpTicks > 0) + if (mDelta.warpTicks > 0) { - delta.warpTicks--; + mDelta.warpTicks--; // Set new pos. MatrixF mat = mObjToWorld; - mat.getColumn(3,&delta.pos); - delta.pos += delta.warpOffset; - mat.setColumn(3,delta.pos); + mat.getColumn(3,&mDelta.pos); + mDelta.pos += mDelta.warpOffset; + mat.setColumn(3, mDelta.pos); Parent::setTransform(mat); // Backstepping - delta.posVec.x = -delta.warpOffset.x; - delta.posVec.y = -delta.warpOffset.y; - delta.posVec.z = -delta.warpOffset.z; + mDelta.posVec.x = -mDelta.warpOffset.x; + mDelta.posVec.y = -mDelta.warpOffset.y; + mDelta.posVec.z = -mDelta.warpOffset.z; } else { @@ -601,7 +601,7 @@ void Item::processTick(const Move* move) else { // Need to clear out last updatePos or warp interpolation - delta.posVec.set(0,0,0); + mDelta.posVec.set(0,0,0); } } } @@ -613,11 +613,11 @@ void Item::interpolateTick(F32 dt) return; // Client side interpolation - Point3F pos = delta.pos + delta.posVec * dt; + Point3F pos = mDelta.pos + mDelta.posVec * dt; MatrixF mat = mRenderObjToWorld; mat.setColumn(3,pos); setRenderTransform(mat); - delta.dt = dt; + mDelta.dt = dt; } @@ -733,7 +733,7 @@ void Item::updatePos(const U32 /*mask*/, const F32 dt) // Try and move Point3F pos; mObjToWorld.getColumn(3,&pos); - delta.posVec = pos; + mDelta.posVec = pos; bool contact = false; bool nonStatic = false; @@ -959,9 +959,9 @@ void Item::updatePos(const U32 /*mask*/, const F32 dt) // If on the client, calculate delta for backstepping if (isGhost()) { - delta.pos = pos; - delta.posVec -= pos; - delta.dt = 1; + mDelta.pos = pos; + mDelta.posVec -= pos; + mDelta.dt = 1; } // Update transform @@ -1131,40 +1131,40 @@ void Item::unpackUpdate(NetConnection *connection, BitStream *stream) if (stream->readFlag() && isProperlyAdded()) { // Determin number of ticks to warp based on the average // of the client and server velocities. - delta.warpOffset = pos - delta.pos; + mDelta.warpOffset = pos - mDelta.pos; F32 as = (speed + mVelocity.len()) * 0.5f * TickSec; - F32 dt = (as > 0.00001f) ? delta.warpOffset.len() / as: sMaxWarpTicks; - delta.warpTicks = (S32)((dt > sMinWarpTicks)? getMax(mFloor(dt + 0.5f), 1.0f): 0.0f); + F32 dt = (as > 0.00001f) ? mDelta.warpOffset.len() / as: sMaxWarpTicks; + mDelta.warpTicks = (S32)((dt > sMinWarpTicks)? getMax(mFloor(dt + 0.5f), 1.0f): 0.0f); - if (delta.warpTicks) + if (mDelta.warpTicks) { // Setup the warp to start on the next tick, only the // object's position is warped. - if (delta.warpTicks > sMaxWarpTicks) - delta.warpTicks = sMaxWarpTicks; - delta.warpOffset /= (F32)delta.warpTicks; + if (mDelta.warpTicks > sMaxWarpTicks) + mDelta.warpTicks = sMaxWarpTicks; + mDelta.warpOffset /= (F32)mDelta.warpTicks; } else { // Going to skip the warp, server and client are real close. // Adjust the frame interpolation to move smoothly to the // new position within the current tick. - Point3F cp = delta.pos + delta.posVec * delta.dt; - VectorF vec = delta.pos - cp; + Point3F cp = mDelta.pos + mDelta.posVec * mDelta.dt; + VectorF vec = mDelta.pos - cp; F32 vl = vec.len(); if (vl) { - F32 s = delta.posVec.len() / vl; - delta.posVec = (cp - pos) * s; + F32 s = mDelta.posVec.len() / vl; + mDelta.posVec = (cp - pos) * s; } - delta.pos = pos; + mDelta.pos = pos; mat.setColumn(3,pos); } } else { // Set the item to the server position - delta.warpTicks = 0; - delta.posVec.set(0,0,0); - delta.pos = pos; - delta.dt = 0; + mDelta.warpTicks = 0; + mDelta.posVec.set(0,0,0); + mDelta.pos = pos; + mDelta.dt = 0; mat.setColumn(3,pos); } } diff --git a/Engine/source/T3D/item.h b/Engine/source/T3D/item.h index 68720952b..be79e7f9d 100644 --- a/Engine/source/T3D/item.h +++ b/Engine/source/T3D/item.h @@ -88,7 +88,7 @@ class Item: public ShapeBase Point3F warpOffset; F32 dt; }; - StateDelta delta; + StateDelta mDelta; // Static attributes ItemData* mDataBlock; diff --git a/Engine/source/T3D/proximityMine.cpp b/Engine/source/T3D/proximityMine.cpp index bf43ab8c9..2102ef7e1 100644 --- a/Engine/source/T3D/proximityMine.cpp +++ b/Engine/source/T3D/proximityMine.cpp @@ -386,8 +386,8 @@ void ProximityMine::setDeployedPos( const Point3F& pos, const Point3F& normal ) MathUtils::getMatrixFromUpVector( normal, &mat ); mat.setPosition( pos + normal * mObjBox.minExtents.z ); - delta.pos = pos; - delta.posVec.set(0, 0, 0); + mDelta.pos = pos; + mDelta.posVec.set(0, 0, 0); ShapeBase::setTransform( mat ); if ( mPhysicsRep ) From a5ab4acd01ff27627a69a06084e6176fc989e90b Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 12 Mar 2018 23:09:20 -0500 Subject: [PATCH 021/144] pos to mSeqPos to resolve a method entry vs class entry --- Engine/source/ts/tsShapeInstance.h | 2 +- Engine/source/ts/tsThread.cpp | 62 +++++++++++++++--------------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Engine/source/ts/tsShapeInstance.h b/Engine/source/ts/tsShapeInstance.h index c483c8792..c29f0eac2 100644 --- a/Engine/source/ts/tsShapeInstance.h +++ b/Engine/source/ts/tsShapeInstance.h @@ -727,7 +727,7 @@ class TSThread TSShapeInstance * mShapeInstance; ///< Instance of the shape that this thread animates S32 sequence; ///< Sequence this thread will perform - F32 pos; + F32 mSeqPos; F32 timeScale; ///< How fast to play through the sequence diff --git a/Engine/source/ts/tsThread.cpp b/Engine/source/ts/tsThread.cpp index 656310bec..4cb1088d9 100644 --- a/Engine/source/ts/tsThread.cpp +++ b/Engine/source/ts/tsThread.cpp @@ -170,17 +170,17 @@ void TSThread::setSequence(S32 seq, F32 toPos) sequence = seq; priority = getSequence()->priority; - pos = toPos; + mSeqPos = toPos; makePath = getSequence()->makePath(); path.start = path.end = 0; path.loop = 0; // 1.0f doesn't exist on cyclic sequences - if (pos>0.9999f && getSequence()->isCyclic()) - pos = 0.9999f; + if (mSeqPos>0.9999f && getSequence()->isCyclic()) + mSeqPos = 0.9999f; // select keyframes - selectKeyframes(pos,getSequence(),&keyNum1,&keyNum2,&keyPos); + selectKeyframes(mSeqPos,getSequence(),&keyNum1,&keyNum2,&keyPos); } void TSThread::transitionToSequence(S32 seq, F32 toPos, F32 duration, bool continuePlay) @@ -207,7 +207,7 @@ void TSThread::transitionToSequence(S32 seq, F32 toPos, F32 duration, bool conti // set time characteristics of transition transitionData.oldSequence = sequence; - transitionData.oldPos = pos; + transitionData.oldPos = mSeqPos; transitionData.duration = duration; transitionData.pos = 0.0f; transitionData.direction = timeScale>0.0f ? 1.0f : -1.0f; @@ -219,17 +219,17 @@ void TSThread::transitionToSequence(S32 seq, F32 toPos, F32 duration, bool conti // set target sequence data sequence = seq; priority = getSequence()->priority; - pos = toPos; + mSeqPos = toPos; makePath = getSequence()->makePath(); path.start = path.end = 0; path.loop = 0; // 1.0f doesn't exist on cyclic sequences - if (pos>0.9999f && getSequence()->isCyclic()) - pos = 0.9999f; + if (mSeqPos>0.9999f && getSequence()->isCyclic()) + mSeqPos = 0.9999f; // select keyframes - selectKeyframes(pos,getSequence(),&keyNum1,&keyNum2,&keyPos); + selectKeyframes(mSeqPos,getSequence(),&keyNum1,&keyNum2,&keyPos); } bool TSThread::isInTransition() @@ -322,12 +322,12 @@ void TSThread::activateTriggers(F32 a, F32 b) F32 TSThread::getPos() { - return transitionData.inTransition ? transitionData.pos : pos; + return transitionData.inTransition ? transitionData.pos : mSeqPos; } F32 TSThread::getTime() { - return transitionData.inTransition ? transitionData.pos * transitionData.duration : pos * getSequence()->duration; + return transitionData.inTransition ? transitionData.pos * transitionData.duration : mSeqPos * getSequence()->duration; } F32 TSThread::getDuration() @@ -378,48 +378,48 @@ void TSThread::advancePos(F32 delta) if (makePath) { - path.start = pos; - pos += delta; + path.start = mSeqPos; + mSeqPos += delta; if (!getSequence()->isCyclic()) { - pos = mClampF(pos , 0.0f, 1.0f); + mSeqPos = mClampF(mSeqPos, 0.0f, 1.0f); path.loop = 0; } else { - path.loop = (S32)pos; - if (pos < 0.0f) + path.loop = (S32)mSeqPos; + if (mSeqPos < 0.0f) path.loop--; - pos -= path.loop; + mSeqPos -= path.loop; // following necessary because of floating point roundoff errors - if (pos < 0.0f) pos += 1.0f; - if (pos >= 1.0f) pos -= 1.0f; + if (mSeqPos < 0.0f) mSeqPos += 1.0f; + if (mSeqPos >= 1.0f) mSeqPos -= 1.0f; } - path.end = pos; + path.end = mSeqPos; animateTriggers(); // do this automatically...no need for user to call it - AssertFatal(pos>=0.0f && pos<=1.0f,"TSThread::advancePos (1)"); - AssertFatal(!getSequence()->isCyclic() || pos<1.0f,"TSThread::advancePos (2)"); + AssertFatal(mSeqPos >=0.0f && mSeqPos <=1.0f,"TSThread::advancePos (1)"); + AssertFatal(!getSequence()->isCyclic() || mSeqPos<1.0f,"TSThread::advancePos (2)"); } else { - pos += delta; + mSeqPos += delta; if (!getSequence()->isCyclic()) - pos = mClampF(pos, 0.0f, 1.0f); + mSeqPos = mClampF(mSeqPos, 0.0f, 1.0f); else { - pos -= S32(pos); + mSeqPos -= S32(mSeqPos); // following necessary because of floating point roundoff errors - if (pos < 0.0f) pos += 1.0f; - if (pos >= 1.0f) pos -= 1.0f; + if (mSeqPos < 0.0f) mSeqPos += 1.0f; + if (mSeqPos >= 1.0f) mSeqPos -= 1.0f; } - AssertFatal(pos>=0.0f && pos<=1.0f,"TSThread::advancePos (3)"); - AssertFatal(!getSequence()->isCyclic() || pos<1.0f,"TSThread::advancePos (4)"); + AssertFatal(mSeqPos >=0.0f && mSeqPos <=1.0f,"TSThread::advancePos (3)"); + AssertFatal(!getSequence()->isCyclic() || mSeqPos<1.0f,"TSThread::advancePos (4)"); } // select keyframes - selectKeyframes(pos,getSequence(),&keyNum1,&keyNum2,&keyPos); + selectKeyframes(mSeqPos,getSequence(),&keyNum1,&keyNum2,&keyPos); } void TSThread::advanceTime(F32 delta) @@ -459,7 +459,7 @@ void TSThread::setKeyframeNumber(S32 kf) keyNum1 = keyNum2 = kf; keyPos = 0; - pos = 0; + mSeqPos = 0; } TSThread::TSThread(TSShapeInstance * _shapeInst) From 2b6b1acdd6933d706d16edabe0d627764c7f0b78 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 00:57:31 -0500 Subject: [PATCH 022/144] many *many* generic is and js --- Engine/source/ts/tsShape.cpp | 30 ++++++++++++++--------------- Engine/source/ts/tsShapeOldRead.cpp | 28 +++++++++++++-------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Engine/source/ts/tsShape.cpp b/Engine/source/ts/tsShape.cpp index 8b0146567..52a77cf9f 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -566,8 +566,8 @@ void TSShape::initObjects() if (accel != NULL) { delete[] accel->vertexList; delete[] accel->normalList; - for (S32 j = 0; j < accel->numVerts; j++) - delete[] accel->emitStrings[j]; + for (S32 vertID = 0; vertID < accel->numVerts; vertID++) + delete[] accel->emitStrings[vertID]; delete[] accel->emitStrings; delete accel; } @@ -683,9 +683,9 @@ void TSShape::initVertexBuffers() U32 vertsInBuffer = mShapeVertexData.size / mVertexSize; U32 indsInBuffer = ibIndices - indicesStart; - for (U32 i = 0; i < primStart; i++) + for (U32 primID = 0; primID < primStart; primID++) { - GFXPrimitive &prim = mShapeVertexIndices->mPrimitiveArray[i]; + GFXPrimitive &prim = mShapeVertexIndices->mPrimitiveArray[primID]; if (prim.type != GFXTriangleList && prim.type != GFXTriangleStrip) { @@ -1303,10 +1303,10 @@ void TSShape::assembleShape() S32 oldSz = groundTranslations.size(); groundTranslations.setSize(oldSz+seq.numGroundFrames); groundRotations.setSize(oldSz+seq.numGroundFrames); - for (S32 j=0;j 10000 ) || - ( details[i].maxError == 0 ) || ( details[i].maxError > 10000 ) ) + if ( ( details[erID].averageError == 0 ) || ( details[erID].averageError > 10000 ) || + ( details[erID].maxError == 0 ) || ( details[erID].maxError > 10000 ) ) { - details[i].averageError = details[i].maxError = -1.0f; + details[erID].averageError = details[erID].maxError = -1.0f; } } @@ -1740,8 +1740,8 @@ void TSShape::disassembleShape() { // Legacy details => no explicit autobillboard parameters U32 legacyDetailSize32 = 7; // only store the first 7 4-byte values of each detail - for ( S32 i = 0; i < details.size(); i++ ) - tsalloc.copyToBuffer32( (S32*)&details[i], legacyDetailSize32 ); + for ( S32 bbID = 0; bbID < details.size(); bbID++ ) + tsalloc.copyToBuffer32( (S32*)&details[bbID], legacyDetailSize32 ); } tsalloc.setGuard(); diff --git a/Engine/source/ts/tsShapeOldRead.cpp b/Engine/source/ts/tsShapeOldRead.cpp index d20175a2e..9b06aff75 100644 --- a/Engine/source/ts/tsShapeOldRead.cpp +++ b/Engine/source/ts/tsShapeOldRead.cpp @@ -647,27 +647,27 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath) nodeUniformScales.increment(newScaleMembership.count() * seq.numKeyframes); // remap node transforms from temporary arrays - for (S32 j = 0; j < nodeMap.size(); j++) + for (S32 nodeID = 0; nodeID < nodeMap.size(); nodeID++) { - if (nodeMap[j] < 0) + if (nodeMap[nodeID] < 0) continue; - if (newTransMembership.test(nodeMap[j])) + if (newTransMembership.test(nodeMap[nodeID])) { - S32 src = seq.numKeyframes * seq.translationMatters.count(j); - S32 dest = seq.baseTranslation + seq.numKeyframes * newTransMembership.count(nodeMap[j]); + S32 src = seq.numKeyframes * seq.translationMatters.count(nodeID); + S32 dest = seq.baseTranslation + seq.numKeyframes * newTransMembership.count(nodeMap[nodeID]); dCopyArray(&nodeTranslations[dest], &seqTranslations[src], seq.numKeyframes); } - if (newRotMembership.test(nodeMap[j])) + if (newRotMembership.test(nodeMap[nodeID])) { - S32 src = seq.numKeyframes * seq.rotationMatters.count(j); - S32 dest = seq.baseRotation + seq.numKeyframes * newRotMembership.count(nodeMap[j]); + S32 src = seq.numKeyframes * seq.rotationMatters.count(nodeID); + S32 dest = seq.baseRotation + seq.numKeyframes * newRotMembership.count(nodeMap[nodeID]); dCopyArray(&nodeRotations[dest], &seqRotations[src], seq.numKeyframes); } - if (newScaleMembership.test(nodeMap[j])) + if (newScaleMembership.test(nodeMap[nodeID])) { - S32 src = seq.numKeyframes * seq.scaleMatters.count(j); - S32 dest = seq.baseScale + seq.numKeyframes * newScaleMembership.count(nodeMap[j]); + S32 src = seq.numKeyframes * seq.scaleMatters.count(nodeID); + S32 dest = seq.baseScale + seq.numKeyframes * newScaleMembership.count(nodeMap[nodeID]); if (seq.flags & TSShape::ArbitraryScale) { dCopyArray(&nodeArbitraryScaleRots[dest], &seqArbitraryScaleRots[src], seq.numKeyframes); @@ -713,10 +713,10 @@ bool TSShape::importSequences(Stream * s, const String& sequencePath) S32 oldSz = triggers.size(); s->read(&sz); triggers.setSize(oldSz+sz); - for (S32 i=0; iread(&triggers[i+oldSz].state); - s->read(&triggers[i+oldSz].pos); + s->read(&triggers[triggerID +oldSz].state); + s->read(&triggers[triggerID +oldSz].pos); } if (smInitOnRead) From 654fc29dc2a652648f4f354f32567355e9011216 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 01:05:15 -0500 Subject: [PATCH 023/144] bounds to mBounds conflict avoidance --- .../T3D/components/render/meshComponent.cpp | 4 ++-- Engine/source/T3D/debris.cpp | 2 +- .../source/T3D/examples/renderShapeExample.cpp | 2 +- Engine/source/T3D/fx/explosion.cpp | 2 +- Engine/source/T3D/fx/groundCover.cpp | 2 +- Engine/source/T3D/physics/physicsDebris.cpp | 2 +- Engine/source/T3D/physics/physicsShape.cpp | 6 +++--- Engine/source/T3D/projectile.cpp | 2 +- Engine/source/T3D/shapeBase.cpp | 14 +++++++------- Engine/source/T3D/tsStatic.cpp | 2 +- Engine/source/T3D/vehicles/wheeledVehicle.cpp | 2 +- Engine/source/afx/afxMagicMissile.cpp | 2 +- Engine/source/afx/ce/afxModel.cpp | 2 +- Engine/source/environment/VolumetricFog.cpp | 4 ++-- Engine/source/forest/ts/tsForestItemData.h | 2 +- Engine/source/gui/editor/guiShapeEdPreview.cpp | 10 +++++----- Engine/source/lighting/common/blobShadow.cpp | 2 +- Engine/source/ts/loader/tsShapeLoader.cpp | 10 +++++----- Engine/source/ts/tsCollision.cpp | 2 +- Engine/source/ts/tsShape.cpp | 8 ++++---- Engine/source/ts/tsShape.h | 2 +- Engine/source/ts/tsShapeConstruct.cpp | 16 ++++++++-------- 22 files changed, 50 insertions(+), 50 deletions(-) diff --git a/Engine/source/T3D/components/render/meshComponent.cpp b/Engine/source/T3D/components/render/meshComponent.cpp index c87733bf8..ad7ce0a5c 100644 --- a/Engine/source/T3D/components/render/meshComponent.cpp +++ b/Engine/source/T3D/components/render/meshComponent.cpp @@ -254,8 +254,8 @@ void MeshComponent::updateShape() mOwner->getWorldToObj().mulP(pos); - min = mMeshAsset->getShape()->bounds.minExtents; - max = mMeshAsset->getShape()->bounds.maxExtents; + min = mMeshAsset->getShape()->mBounds.minExtents; + max = mMeshAsset->getShape()->mBounds.maxExtents; if (mInterfaceData) { diff --git a/Engine/source/T3D/debris.cpp b/Engine/source/T3D/debris.cpp index 57d9a0577..23f18890b 100644 --- a/Engine/source/T3D/debris.cpp +++ b/Engine/source/T3D/debris.cpp @@ -669,7 +669,7 @@ bool Debris::onAdd() // Setup our bounding box if( mDataBlock->shape ) { - mObjBox = mDataBlock->shape->bounds; + mObjBox = mDataBlock->shape->mBounds; } else { diff --git a/Engine/source/T3D/examples/renderShapeExample.cpp b/Engine/source/T3D/examples/renderShapeExample.cpp index 0e60c3801..5f0847b90 100644 --- a/Engine/source/T3D/examples/renderShapeExample.cpp +++ b/Engine/source/T3D/examples/renderShapeExample.cpp @@ -213,7 +213,7 @@ void RenderShapeExample::createShape() } // Update the bounding box - mObjBox = mShape->bounds; + mObjBox = mShape->mBounds; resetWorldBox(); setRenderTransform(mObjToWorld); diff --git a/Engine/source/T3D/fx/explosion.cpp b/Engine/source/T3D/fx/explosion.cpp index 0236da6e9..4da7b2902 100644 --- a/Engine/source/T3D/fx/explosion.cpp +++ b/Engine/source/T3D/fx/explosion.cpp @@ -1384,7 +1384,7 @@ bool Explosion::explode() mEndingMS = U32(mExplosionInstance->getScaledDuration(mExplosionThread) * 1000.0f); mObjScale.convolve(mDataBlock->explosionScale); - mObjBox = mDataBlock->explosionShape->bounds; + mObjBox = mDataBlock->explosionShape->mBounds; resetWorldBox(); } diff --git a/Engine/source/T3D/fx/groundCover.cpp b/Engine/source/T3D/fx/groundCover.cpp index 63b5e3a2f..6e859e554 100644 --- a/Engine/source/T3D/fx/groundCover.cpp +++ b/Engine/source/T3D/fx/groundCover.cpp @@ -1142,7 +1142,7 @@ GroundCoverCell* GroundCover::_generateCell( const Point2I& index, const F32 typeMaxElevation = mMaxElevation[type]; const F32 typeMinElevation = mMinElevation[type]; const bool typeIsShape = mShapeInstances[ type ] != NULL; - const Box3F typeShapeBounds = typeIsShape ? mShapeInstances[ type ]->getShape()->bounds : Box3F(); + const Box3F typeShapeBounds = typeIsShape ? mShapeInstances[ type ]->getShape()->mBounds : Box3F(); const F32 typeWindScale = mWindScale[type]; StringTableEntry typeLayer = mLayer[type]; const bool typeInvertLayer = mInvertLayer[type]; diff --git a/Engine/source/T3D/physics/physicsDebris.cpp b/Engine/source/T3D/physics/physicsDebris.cpp index a2e2026b3..44d421c86 100644 --- a/Engine/source/T3D/physics/physicsDebris.cpp +++ b/Engine/source/T3D/physics/physicsDebris.cpp @@ -358,7 +358,7 @@ bool PhysicsDebris::onAdd() } // Setup our bounding box - mObjBox = mDataBlock->shape->bounds; + mObjBox = mDataBlock->shape->mBounds; resetWorldBox(); // Add it to the client scene. diff --git a/Engine/source/T3D/physics/physicsShape.cpp b/Engine/source/T3D/physics/physicsShape.cpp index 574707003..d4e0a3313 100644 --- a/Engine/source/T3D/physics/physicsShape.cpp +++ b/Engine/source/T3D/physics/physicsShape.cpp @@ -308,10 +308,10 @@ bool PhysicsShapeData::preload( bool server, String &errorBuffer ) { //no collision so we create a simple box collision shape from the shapes bounds and alert the user Con::warnf( "PhysicsShapeData::preload - No collision found for shape '%s', auto-creating one", shapeName ); - Point3F halfWidth = shape->bounds.getExtents() * 0.5f; + Point3F halfWidth = shape->mBounds.getExtents() * 0.5f; colShape = PHYSICSMGR->createCollision(); MatrixF centerXfm(true); - centerXfm.setPosition(shape->bounds.getCenter()); + centerXfm.setPosition(shape->mBounds.getCenter()); colShape->addBox(halfWidth, centerXfm); return true; } @@ -707,7 +707,7 @@ bool PhysicsShape::_createShape() return false; // Set the world box. - mObjBox = db->shape->bounds; + mObjBox = db->shape->mBounds; resetWorldBox(); // If this is the server and its a client only simulation diff --git a/Engine/source/T3D/projectile.cpp b/Engine/source/T3D/projectile.cpp index 7e77385a2..e457f6b2d 100644 --- a/Engine/source/T3D/projectile.cpp +++ b/Engine/source/T3D/projectile.cpp @@ -828,7 +828,7 @@ bool Projectile::onAdd() // Setup our bounding box if (bool(mDataBlock->projectileShape) == true) - mObjBox = mDataBlock->projectileShape->bounds; + mObjBox = mDataBlock->projectileShape->mBounds; else mObjBox = Box3F(Point3F(0, 0, 0), Point3F(0, 0, 0)); diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 643a5955d..923714a5d 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -405,17 +405,17 @@ bool ShapeBaseData::preload(bool server, String &errorStr) mShape->computeBounds(collisionDetails.last(), collisionBounds.last()); mShape->getAccelerator(collisionDetails.last()); - if (!mShape->bounds.isContained(collisionBounds.last())) + if (!mShape->mBounds.isContained(collisionBounds.last())) { if (!silent_bbox_check) Con::warnf("Warning: shape %s collision detail %d (Collision-%d) bounds exceed that of shape.", shapeName, collisionDetails.size() - 1, collisionDetails.last()); - collisionBounds.last() = mShape->bounds; + collisionBounds.last() = mShape->mBounds; } else if (collisionBounds.last().isValidBox() == false) { if (!silent_bbox_check) Con::errorf("Error: shape %s-collision detail %d (Collision-%d) bounds box invalid!", shapeName, collisionDetails.size() - 1, collisionDetails.last()); - collisionBounds.last() = mShape->bounds; + collisionBounds.last() = mShape->mBounds; } // The way LOS works is that it will check to see if there is a LOS detail that matches @@ -482,7 +482,7 @@ bool ShapeBaseData::preload(bool server, String &errorStr) damageSequence = mShape->findSequence("Damage"); // - F32 w = mShape->bounds.len_y() / 2; + F32 w = mShape->mBounds.len_y() / 2; if (cameraMaxDist < w) cameraMaxDist = w; // just parse up the string and collect the remappings in txr_tag_remappings. @@ -707,7 +707,7 @@ DefineEngineMethod( ShapeBaseData, checkDeployPos, bool, ( TransformF txfm ),, MatrixF mat = txfm.getMatrix(); - Box3F objBox = object->mShape->bounds; + Box3F objBox = object->mShape->mBounds; Point3F boxCenter = (objBox.minExtents + objBox.maxExtents) * 0.5f; objBox.minExtents = boxCenter + (objBox.minExtents - boxCenter) * 0.9f; objBox.maxExtents = boxCenter + (objBox.maxExtents - boxCenter) * 0.9f; @@ -1275,7 +1275,7 @@ bool ShapeBase::onNewDataBlock( GameBaseData *dptr, bool reload ) } } - mObjBox = mDataBlock->mShape->bounds; + mObjBox = mDataBlock->mShape->mBounds; resetWorldBox(); // Set the initial mesh hidden state. @@ -2801,7 +2801,7 @@ void ShapeBase::_renderBoundingBox( ObjectRenderInst *ri, SceneRenderState *stat MatrixF mat; getRenderImageTransform( ri->objectIndex, &mat ); - const Box3F &objBox = image.shapeInstance[getImageShapeIndex(image)]->getShape()->bounds; + const Box3F &objBox = image.shapeInstance[getImageShapeIndex(image)]->getShape()->mBounds; drawer->drawCube( desc, objBox, ColorI( 255, 255, 255 ), &mat ); } diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index 13964e632..97ae395df 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -373,7 +373,7 @@ bool TSStatic::_createShape() NetConnection::filesWereDownloaded() ) return false; - mObjBox = mShape->bounds; + mObjBox = mShape->mBounds; resetWorldBox(); mShapeInstance = new TSShapeInstance( mShape, isClientObject() ); diff --git a/Engine/source/T3D/vehicles/wheeledVehicle.cpp b/Engine/source/T3D/vehicles/wheeledVehicle.cpp index 17cfdfe6a..05524867a 100644 --- a/Engine/source/T3D/vehicles/wheeledVehicle.cpp +++ b/Engine/source/T3D/vehicles/wheeledVehicle.cpp @@ -111,7 +111,7 @@ bool WheeledVehicleTire::preload(bool server, String &errorStr) // Determinw wheel radius from the shape's bounding box. // The tire should be built with it's hub axis along the // object's Y axis. - radius = shape->bounds.len_z() / 2; + radius = shape->mBounds.len_z() / 2; } return true; diff --git a/Engine/source/afx/afxMagicMissile.cpp b/Engine/source/afx/afxMagicMissile.cpp index 36ecd1777..1cae8526c 100644 --- a/Engine/source/afx/afxMagicMissile.cpp +++ b/Engine/source/afx/afxMagicMissile.cpp @@ -1116,7 +1116,7 @@ bool afxMagicMissile::onAdd() // Setup our bounding box if (bool(mDataBlock->projectileShape) == true) - mObjBox = mDataBlock->projectileShape->bounds; + mObjBox = mDataBlock->projectileShape->mBounds; else mObjBox = Box3F(Point3F(0, 0, 0), Point3F(0, 0, 0)); resetWorldBox(); diff --git a/Engine/source/afx/ce/afxModel.cpp b/Engine/source/afx/ce/afxModel.cpp index 688cd08ad..6962aea51 100644 --- a/Engine/source/afx/ce/afxModel.cpp +++ b/Engine/source/afx/ce/afxModel.cpp @@ -397,7 +397,7 @@ bool afxModel::onAdd() // setup our bounding box if (mDataBlock->shape) - mObjBox = mDataBlock->shape->bounds; + mObjBox = mDataBlock->shape->mBounds; else mObjBox = Box3F(Point3F(-1, -1, -1), Point3F(1, 1, 1)); diff --git a/Engine/source/environment/VolumetricFog.cpp b/Engine/source/environment/VolumetricFog.cpp index 9235611d1..c000f535b 100644 --- a/Engine/source/environment/VolumetricFog.cpp +++ b/Engine/source/environment/VolumetricFog.cpp @@ -347,7 +347,7 @@ bool VolumetricFog::LoadShape() return false; } - mObjBox = mShape->bounds; + mObjBox = mShape->mBounds; mRadius = mShape->radius; resetWorldBox(); @@ -560,7 +560,7 @@ U32 VolumetricFog::packUpdate(NetConnection *con, U32 mask, BitStream *stream) mShape = ResourceManager::get().load(mShapeName); if (bool(mShape) == false) return retMask; - mObjBox = mShape->bounds; + mObjBox = mShape->mBounds; mRadius = mShape->radius; resetWorldBox(); mObjSize = mWorldBox.getGreatestDiagonalLength(); diff --git a/Engine/source/forest/ts/tsForestItemData.h b/Engine/source/forest/ts/tsForestItemData.h index 46252361b..089da98d5 100644 --- a/Engine/source/forest/ts/tsForestItemData.h +++ b/Engine/source/forest/ts/tsForestItemData.h @@ -88,7 +88,7 @@ public: const Vector& getLOSDetails() const { return mLOSDetails; } // ForestItemData - const Box3F& getObjBox() const { return mShape ? mShape->bounds : Box3F::Zero; } + const Box3F& getObjBox() const { return mShape ? mShape->mBounds : Box3F::Zero; } bool render( TSRenderState *rdata, const ForestItem& item ) const; ForestCellBatch* allocateBatch() const; bool canBillboard( const SceneRenderState *state, const ForestItem &item, F32 distToCamera ) const; diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index f04ef371a..e373a246b 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -853,7 +853,7 @@ void GuiShapeEdPreview::exportToCollada( const String& path ) if ( mModel ) { MatrixF orientation( true ); - orientation.setPosition( mModel->getShape()->bounds.getCenter() ); + orientation.setPosition( mModel->getShape()->mBounds.getCenter() ); orientation.inverse(); OptimizedPolyList polyList; @@ -1138,8 +1138,8 @@ bool GuiShapeEdPreview::getCameraTransform(MatrixF* cameraMatrix) cameraMatrix->identity(); if ( mModel ) { - Point3F camPos = mModel->getShape()->bounds.getCenter(); - F32 offset = mModel->getShape()->bounds.len(); + Point3F camPos = mModel->getShape()->mBounds.getCenter(); + F32 offset = mModel->getShape()->mBounds.len(); switch (mDisplayType) { @@ -1442,7 +1442,7 @@ void GuiShapeEdPreview::renderWorld(const RectI &updateRect) // Render the shape bounding box if ( mRenderBounds ) { - Point3F boxSize = mModel->getShape()->bounds.maxExtents - mModel->getShape()->bounds.minExtents; + Point3F boxSize = mModel->getShape()->mBounds.maxExtents - mModel->getShape()->mBounds.minExtents; GFXStateBlockDesc desc; desc.fillMode = GFXFillWireframe; @@ -1544,7 +1544,7 @@ void GuiShapeEdPreview::renderSunDirection() const { // Render four arrows aiming in the direction of the sun's light ColorI color = LinearColorF( mFakeSun->getColor()).toColorI(); - F32 length = mModel->getShape()->bounds.len() * 0.8f; + F32 length = mModel->getShape()->mBounds.len() * 0.8f; // Get the sun's vectors Point3F fwd = mFakeSun->getTransform().getForwardVector(); diff --git a/Engine/source/lighting/common/blobShadow.cpp b/Engine/source/lighting/common/blobShadow.cpp index a564ff654..3db211762 100644 --- a/Engine/source/lighting/common/blobShadow.cpp +++ b/Engine/source/lighting/common/blobShadow.cpp @@ -182,7 +182,7 @@ void BlobShadow::setRadius(F32 radius) void BlobShadow::setRadius(TSShapeInstance * shapeInstance, const Point3F & scale) { - const Box3F & bounds = shapeInstance->getShape()->bounds; + const Box3F & bounds = shapeInstance->getShape()->mBounds; F32 dx = 0.5f * (bounds.maxExtents.x-bounds.minExtents.x) * scale.x; F32 dy = 0.5f * (bounds.maxExtents.y-bounds.minExtents.y) * scale.y; F32 dz = 0.5f * (bounds.maxExtents.z-bounds.minExtents.z) * scale.z; diff --git a/Engine/source/ts/loader/tsShapeLoader.cpp b/Engine/source/ts/loader/tsShapeLoader.cpp index 61c183d27..94f5e4fbf 100644 --- a/Engine/source/ts/loader/tsShapeLoader.cpp +++ b/Engine/source/ts/loader/tsShapeLoader.cpp @@ -1220,12 +1220,12 @@ void TSShapeLoader::install() } } - computeBounds(shape->bounds); - if (!shape->bounds.isValidBox()) - shape->bounds = Box3F(1.0f); + computeBounds(shape->mBounds); + if (!shape->mBounds.isValidBox()) + shape->mBounds = Box3F(1.0f); - shape->bounds.getCenter(&shape->center); - shape->radius = (shape->bounds.maxExtents - shape->center).len(); + shape->mBounds.getCenter(&shape->center); + shape->radius = (shape->mBounds.maxExtents - shape->center).len(); shape->tubeRadius = shape->radius; shape->init(); diff --git a/Engine/source/ts/tsCollision.cpp b/Engine/source/ts/tsCollision.cpp index 1d04b409e..f5c2d77b4 100644 --- a/Engine/source/ts/tsCollision.cpp +++ b/Engine/source/ts/tsCollision.cpp @@ -414,7 +414,7 @@ void TSShapeInstance::computeBounds(S32 dl, Box3F & bounds) // use shape bounds for imposter details if (ss < 0) { - bounds = mShape->bounds; + bounds = mShape->mBounds; return; } diff --git a/Engine/source/ts/tsShape.cpp b/Engine/source/ts/tsShape.cpp index 52a77cf9f..649e4e6ba 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -1198,7 +1198,7 @@ void TSShape::assembleShape() tsalloc.get32((S32*)&radius,1); tsalloc.get32((S32*)&tubeRadius,1); tsalloc.get32((S32*)¢er,3); - tsalloc.get32((S32*)&bounds,6); + tsalloc.get32((S32*)&mBounds,6); tsalloc.checkGuard(); @@ -1673,7 +1673,7 @@ void TSShape::disassembleShape() tsalloc.copyToBuffer32((S32*)&radius,1); tsalloc.copyToBuffer32((S32*)&tubeRadius,1); tsalloc.copyToBuffer32((S32*)¢er,3); - tsalloc.copyToBuffer32((S32*)&bounds,6); + tsalloc.copyToBuffer32((S32*)&mBounds,6); tsalloc.setGuard(); @@ -2063,8 +2063,8 @@ void TSShape::createEmptyShape() radius = 0.866025f; tubeRadius = 0.707107f; center.set(0.0f, 0.5f, 0.0f); - bounds.minExtents.set(-0.5f, 0.0f, -0.5f); - bounds.maxExtents.set(0.5f, 1.0f, 0.5f); + mBounds.minExtents.set(-0.5f, 0.0f, -0.5f); + mBounds.maxExtents.set(0.5f, 1.0f, 0.5f); mExporterVersion = 124; mSmallestVisibleSize = 2; diff --git a/Engine/source/ts/tsShape.h b/Engine/source/ts/tsShape.h index e72dd8617..d6196c986 100644 --- a/Engine/source/ts/tsShape.h +++ b/Engine/source/ts/tsShape.h @@ -357,7 +357,7 @@ class TSShape F32 radius; F32 tubeRadius; Point3F center; - Box3F bounds; + Box3F mBounds; /// @} diff --git a/Engine/source/ts/tsShapeConstruct.cpp b/Engine/source/ts/tsShapeConstruct.cpp index dd2a67644..612b5dcf7 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/Engine/source/ts/tsShapeConstruct.cpp @@ -1445,7 +1445,7 @@ DefineTSShapeConstructorMethod( getBounds, Box3F, (),, "Get the bounding box for the shape.\n" "@return Bounding box \"minX minY minZ maxX maxY maxZ\"" ) { - return mShape->bounds; + return mShape->mBounds; }} DefineTSShapeConstructorMethod( setBounds, bool, ( Box3F bbox ),, @@ -1457,9 +1457,9 @@ DefineTSShapeConstructorMethod( setBounds, bool, ( Box3F bbox ),, // Set shape bounds TSShape* shape = mShape; - shape->bounds = bbox; - shape->bounds.getCenter( &shape->center ); - shape->radius = ( shape->bounds.maxExtents - shape->center ).len(); + shape->mBounds = bbox; + shape->mBounds.getCenter( &shape->center ); + shape->radius = ( shape->mBounds.maxExtents - shape->center ).len(); shape->tubeRadius = shape->radius; ADD_TO_CHANGE_SET(); @@ -2200,12 +2200,12 @@ void TSShapeConstructor::ChangeSet::write(TSShape* shape, Stream& stream, const for (U32 j = 1; j < cmd.argc; j++) { // Use relative paths when possible - String str( cmd.argv[j] ); - if ( str.startsWith( savePath ) ) - str = str.substr( savePath.length() + 1 ); + String relStr( cmd.argv[j] ); + if (relStr.startsWith( savePath ) ) + relStr = relStr.substr( savePath.length() + 1 ); stream.writeText( ", \"" ); - stream.write( str.length(), str.c_str() ); + stream.write(relStr.length(), relStr.c_str() ); stream.writeText( "\"" ); } } From 4fc6ce7b8bd12c14a5ce8eaa648e80cf1a6fa259 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 02:11:57 -0500 Subject: [PATCH 024/144] buf clarification. mModifLightRays logic cleanup --- Engine/source/environment/VolumetricFog.cpp | 25 +++++++++------------ 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/Engine/source/environment/VolumetricFog.cpp b/Engine/source/environment/VolumetricFog.cpp index c000f535b..d32f13d6c 100644 --- a/Engine/source/environment/VolumetricFog.cpp +++ b/Engine/source/environment/VolumetricFog.cpp @@ -620,25 +620,20 @@ void VolumetricFog::unpackUpdate(NetConnection *con, BitStream *stream) stream->read(&mLightRayMod); if (isTicking()) { - char buf[20]; - dSprintf(buf, sizeof(buf), "%3.7f", mGlowStrength); - Con::setVariable("$VolFogGlowPostFx::glowStrength", buf); + char glowStrBuf[20]; + dSprintf(glowStrBuf, sizeof(glowStrBuf), "%3.7f", mGlowStrength); + Con::setVariable("$VolFogGlowPostFx::glowStrength", glowStrBuf); if (mUseGlow && !glowFX->isEnabled()) glowFX->enable(); if (!mUseGlow && glowFX->isEnabled()) glowFX->disable(); - if (mModifLightRays) - { - char buf[20]; - dSprintf(buf, sizeof(buf), "%3.7f", mOldLightRayStrength * mLightRayMod); - Con::setVariable("$LightRayPostFX::brightScalar", buf); - } - if (!mModifLightRays) - { - char buf[20]; - dSprintf(buf, sizeof(buf), "%3.7f", mOldLightRayStrength); - Con::setVariable("$LightRayPostFX::brightScalar", buf); - } + + F32 rayStrength = mOldLightRayStrength; + if (mModifLightRays) + rayStrength *= mLightRayMod; + char rayStrBuf[20]; + dSprintf(rayStrBuf, sizeof(rayStrBuf), "%3.7f", rayStrength); + Con::setVariable("$LightRayPostFX::brightScalar", rayStrBuf); } } if (stream->readFlag())//Volumetric Fog From af0922e1758d516e1b2ad8f0660002f112ad6f75 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 02:12:59 -0500 Subject: [PATCH 025/144] remove inside a remove after a remove... yeah.... No. --- Engine/source/core/tSparseArray.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Engine/source/core/tSparseArray.h b/Engine/source/core/tSparseArray.h index 5a15b1f81..4f3800447 100644 --- a/Engine/source/core/tSparseArray.h +++ b/Engine/source/core/tSparseArray.h @@ -113,14 +113,14 @@ inline void SparseArray::insert(T* pObject, U32 key) template inline T* SparseArray::remove(U32 key) { - U32 remove = key % mModulus; - Node* probe = &mSentryTables[remove]; + U32 sentryID = key % mModulus; + Node* probe = &mSentryTables[sentryID]; while (probe->next != NULL) { if (probe->next->key == key) { - Node* remove = probe->next; - T* pReturn = remove->pObject; - probe->next = remove->next; - delete remove; + Node* nextProbe = probe->next; + T* pReturn = nextProbe->pObject; + probe->next = nextProbe->next; + delete nextProbe; return pReturn; } probe = probe->next; From e2d27952aabefd149246977e57e93d20ff44daf5 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 11:36:36 -0500 Subject: [PATCH 026/144] tsmesh: parentMesh and indicies to mParentMesh and mIndicies (usual deal, complaints about method vars or temp ones potentially conflicting with class vars) --- Engine/source/environment/VolumetricFog.cpp | 8 +- Engine/source/ts/loader/appMesh.cpp | 2 +- Engine/source/ts/tsCollision.cpp | 18 +-- Engine/source/ts/tsMesh.cpp | 158 ++++++++++---------- Engine/source/ts/tsMesh.h | 4 +- Engine/source/ts/tsMeshFit.cpp | 26 ++-- Engine/source/ts/tsShape.cpp | 16 +- Engine/source/ts/tsShapeEdit.cpp | 18 +-- 8 files changed, 125 insertions(+), 125 deletions(-) diff --git a/Engine/source/environment/VolumetricFog.cpp b/Engine/source/environment/VolumetricFog.cpp index d32f13d6c..067dd0c5d 100644 --- a/Engine/source/environment/VolumetricFog.cpp +++ b/Engine/source/environment/VolumetricFog.cpp @@ -421,8 +421,8 @@ bool VolumetricFog::LoadShape() det_size[i].indices = new Vector(); - for (U32 k = 0; k < mesh->indices.size(); k++) - det_size[i].indices->push_back(mesh->indices[k]); + for (U32 k = 0; k < mesh->mIndices.size(); k++) + det_size[i].indices->push_back(mesh->mIndices[k]); U32 primitivesSize = mesh->primitives.size(); for (U32 k = 0; k < primitivesSize; k++) @@ -436,7 +436,7 @@ bool VolumetricFog::LoadShape() pInfo.numPrimitives = draw.numElements / 3; pInfo.startIndex = draw.start; // Use the first index to determine which 16-bit address space we are operating in - pInfo.startVertex = mesh->indices[draw.start] & 0xFFFF0000; + pInfo.startVertex = mesh->mIndices[draw.start] & 0xFFFF0000; pInfo.minIndex = pInfo.startVertex; pInfo.numVertices = getMin((U32)0x10000, mesh->mNumVerts - pInfo.startVertex); break; @@ -445,7 +445,7 @@ bool VolumetricFog::LoadShape() pInfo.numPrimitives = draw.numElements - 2; pInfo.startIndex = draw.start; // Use the first index to determine which 16-bit address space we are operating in - pInfo.startVertex = mesh->indices[draw.start] & 0xFFFF0000; + pInfo.startVertex = mesh->mIndices[draw.start] & 0xFFFF0000; pInfo.minIndex = pInfo.startVertex; pInfo.numVertices = getMin((U32)0x10000, mesh->mNumVerts - pInfo.startVertex); break; diff --git a/Engine/source/ts/loader/appMesh.cpp b/Engine/source/ts/loader/appMesh.cpp index c06a5909e..aff73df67 100644 --- a/Engine/source/ts/loader/appMesh.cpp +++ b/Engine/source/ts/loader/appMesh.cpp @@ -151,7 +151,7 @@ TSMesh* AppMesh::constructTSMesh() tsmesh->norms = normals; tsmesh->tverts = uvs; tsmesh->primitives = primitives; - tsmesh->indices = indices; + tsmesh->mIndices = indices; tsmesh->colors = colors; tsmesh->tverts2 = uv2s; diff --git a/Engine/source/ts/tsCollision.cpp b/Engine/source/ts/tsCollision.cpp index f5c2d77b4..fc2d22ec1 100644 --- a/Engine/source/ts/tsCollision.cpp +++ b/Engine/source/ts/tsCollision.cpp @@ -1377,16 +1377,16 @@ void TSMesh::prepOpcodeCollision() else { // Have to walk the tristrip to get a count... may have degenerates - U32 idx0 = base + indices[start + 0]; + U32 idx0 = base + mIndices[start + 0]; U32 idx1; - U32 idx2 = base + indices[start + 1]; + U32 idx2 = base + mIndices[start + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = base + indices[start + j]; + idx2 = base + mIndices[start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -1421,9 +1421,9 @@ void TSMesh::prepOpcodeCollision() { for ( S32 j = 0; j < draw.numElements; ) { - curIts->mVRef[2] = base + indices[start + j + 0]; - curIts->mVRef[1] = base + indices[start + j + 1]; - curIts->mVRef[0] = base + indices[start + j + 2]; + curIts->mVRef[2] = base + mIndices[start + j + 0]; + curIts->mVRef[1] = base + mIndices[start + j + 1]; + curIts->mVRef[0] = base + mIndices[start + j + 2]; curIts->mMatIdx = matIndex; curIts++; @@ -1434,16 +1434,16 @@ void TSMesh::prepOpcodeCollision() { AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::buildPolyList (2)" ); - U32 idx0 = base + indices[start + 0]; + U32 idx0 = base + mIndices[start + 0]; U32 idx1; - U32 idx2 = base + indices[start + 1]; + U32 idx2 = base + mIndices[start + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = base + indices[start + j]; + idx2 = base + mIndices[start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; diff --git a/Engine/source/ts/tsMesh.cpp b/Engine/source/ts/tsMesh.cpp index b52a50b96..528d7f56c 100644 --- a/Engine/source/ts/tsMesh.cpp +++ b/Engine/source/ts/tsMesh.cpp @@ -386,9 +386,9 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK { for ( S32 j = 0; j < draw.numElements; ) { - U32 idx0 = base + indices[start + j + 0]; - U32 idx1 = base + indices[start + j + 1]; - U32 idx2 = base + indices[start + j + 2]; + U32 idx0 = base + mIndices[start + j + 0]; + U32 idx1 = base + mIndices[start + j + 1]; + U32 idx2 = base + mIndices[start + j + 2]; polyList->begin(material,surfaceKey++); polyList->vertex( idx0 ); polyList->vertex( idx1 ); @@ -402,16 +402,16 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK { AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::buildPolyList (2)" ); - U32 idx0 = base + indices[start + 0]; + U32 idx0 = base + mIndices[start + 0]; U32 idx1; - U32 idx2 = base + indices[start + 1]; + U32 idx2 = base + mIndices[start + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = base + indices[start + j]; + idx2 = base + mIndices[start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -452,24 +452,24 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF { for ( S32 j = 0; j < draw.numElements; j += 3 ) { - PlaneF plane( cf->mVertexList[base + indices[start + j + 0]], - cf->mVertexList[base + indices[start + j + 1]], - cf->mVertexList[base + indices[start + j + 2]]); + PlaneF plane( cf->mVertexList[base + mIndices[start + j + 0]], + cf->mVertexList[base + mIndices[start + j + 1]], + cf->mVertexList[base + mIndices[start + j + 2]]); cf->mFaceList.increment(); ConvexFeature::Face& lastFace = cf->mFaceList.last(); lastFace.normal = plane; - lastFace.vertex[0] = base + indices[start + j + 0]; - lastFace.vertex[1] = base + indices[start + j + 1]; - lastFace.vertex[2] = base + indices[start + j + 2]; + lastFace.vertex[0] = base + mIndices[start + j + 0]; + lastFace.vertex[1] = base + mIndices[start + j + 1]; + lastFace.vertex[2] = base + mIndices[start + j + 2]; for ( U32 l = 0; l < 3; l++ ) { U32 newEdge0, newEdge1; - U32 zero = base + indices[start + j + l]; - U32 one = base + indices[start + j + ((l+1)%3)]; + U32 zero = base + mIndices[start + j + l]; + U32 one = base + mIndices[start + j + ((l+1)%3)]; newEdge0 = getMin( zero, one ); newEdge1 = getMax( zero, one ); bool found = false; @@ -496,15 +496,15 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF { AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::buildPolyList (2)" ); - U32 idx0 = base + indices[start + 0]; + U32 idx0 = base + mIndices[start + 0]; U32 idx1; - U32 idx2 = base + indices[start + 1]; + U32 idx2 = base + mIndices[start + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = base + indices[start + j]; + idx2 = base + mIndices[start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -802,9 +802,9 @@ bool TSMesh::castRayRendered( S32 frame, const Point3F & start, const Point3F & { for ( S32 j = 0; j < draw.numElements-2; j += 3 ) { - idx0 = indices[drawStart + j + 0]; - idx1 = indices[drawStart + j + 1]; - idx2 = indices[drawStart + j + 2]; + idx0 = mIndices[drawStart + j + 0]; + idx1 = mIndices[drawStart + j + 1]; + idx2 = mIndices[drawStart + j + 2]; F32 cur_t = 0; Point2F b; @@ -828,15 +828,15 @@ bool TSMesh::castRayRendered( S32 frame, const Point3F & start, const Point3F & { AssertFatal( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Strip,"TSMesh::castRayRendered (2)" ); - idx0 = indices[drawStart + 0]; - idx2 = indices[drawStart + 1]; + idx0 = mIndices[drawStart + 0]; + idx2 = mIndices[drawStart + 1]; U32 * nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = indices[drawStart + j]; + idx2 = mIndices[drawStart + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -964,25 +964,25 @@ bool TSMesh::buildConvexHull() if ( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles ) { for ( j = 0; j < draw.numElements; j += 3 ) - if ( addToHull( indices[start + j + 0] + firstVert, - indices[start + j + 1] + firstVert, - indices[start + j + 2] + firstVert ) && frame == 0 ) + if ( addToHull( mIndices[start + j + 0] + firstVert, + mIndices[start + j + 1] + firstVert, + mIndices[start + j + 2] + firstVert ) && frame == 0 ) planeMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); } else { AssertFatal( (draw.matIndex&TSDrawPrimitive::Strip) == TSDrawPrimitive::Strip,"TSMesh::buildConvexHull (2)" ); - U32 idx0 = indices[start + 0] + firstVert; + U32 idx0 = mIndices[start + 0] + firstVert; U32 idx1; - U32 idx2 = indices[start + 1] + firstVert; + U32 idx2 = mIndices[start + 1] + firstVert; U32 * nextIdx = &idx1; for ( j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; // nextIdx = (j%2)==0 ? &idx0 : &idx1; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1 ); - idx2 = indices[start + j] + firstVert; + idx2 = mIndices[start + j] + firstVert; if ( addToHull( idx0, idx1, idx2 ) && frame == 0 ) planeMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); } @@ -1149,9 +1149,9 @@ S32 TSMesh::getNumPolys() const j < primitives[i].start+primitives[i].numElements-2; j++ ) { - if ((indices[j] != indices[j+1]) && - (indices[j] != indices[j+2]) && - (indices[j+1] != indices[j+2])) + if ((mIndices[j] != mIndices[j+1]) && + (mIndices[j] != mIndices[j+2]) && + (mIndices[j+1] != mIndices[j+2])) count++; } break; @@ -1167,7 +1167,7 @@ TSMesh::TSMesh() : meshType( StandardMeshType ) VECTOR_SET_ASSOCIATION( planeNormals ); VECTOR_SET_ASSOCIATION( planeConstants ); VECTOR_SET_ASSOCIATION( planeMaterials ); - parentMesh = -1; + mParentMesh = -1; mOptTree = NULL; mOpMeshInterface = NULL; @@ -2382,7 +2382,7 @@ void TSMesh::dumpPrimitives(U32 startVertex, U32 startIndex, GFXPrimitive *piArr pInfo.numPrimitives = draw.numElements / 3; pInfo.startIndex = startIndex + draw.start; // Use the first index to determine which 16-bit address space we are operating in - pInfo.startVertex = (indices[draw.start] & 0xFFFF0000); // TODO: figure out a good solution for this + pInfo.startVertex = (mIndices[draw.start] & 0xFFFF0000); // TODO: figure out a good solution for this pInfo.minIndex = 0; // minIndex are zero based index relative to startVertex. See @GFXDevice pInfo.numVertices = getMin((U32)0x10000, mNumVerts - pInfo.startVertex); pInfo.startVertex += startVertex; @@ -2393,7 +2393,7 @@ void TSMesh::dumpPrimitives(U32 startVertex, U32 startIndex, GFXPrimitive *piArr pInfo.numPrimitives = draw.numElements - 2; pInfo.startIndex = startIndex + draw.start; // Use the first index to determine which 16-bit address space we are operating in - pInfo.startVertex = (indices[draw.start] & 0xFFFF0000); // TODO: figure out a good solution for this + pInfo.startVertex = (mIndices[draw.start] & 0xFFFF0000); // TODO: figure out a good solution for this pInfo.minIndex = 0; // minIndex are zero based index relative to startVertex. See @GFXDevice pInfo.numVertices = getMin((U32)0x10000, mNumVerts - pInfo.startVertex); pInfo.startVertex += startVertex; @@ -2406,7 +2406,7 @@ void TSMesh::dumpPrimitives(U32 startVertex, U32 startIndex, GFXPrimitive *piArr *piArray++ = pInfo; } - dCopyArray(ibIndices, indices.address(), indices.size()); + dCopyArray(ibIndices, mIndices.address(), mIndices.size()); } void TSMesh::assemble( bool skip ) @@ -2415,7 +2415,7 @@ void TSMesh::assemble( bool skip ) numFrames = tsalloc.get32(); numMatFrames = tsalloc.get32(); - parentMesh = tsalloc.get32(); + mParentMesh = tsalloc.get32(); tsalloc.get32( (S32*)&mBounds, 6 ); tsalloc.get32( (S32*)&mCenter, 3 ); mRadius = (F32)tsalloc.get32(); @@ -2435,21 +2435,21 @@ void TSMesh::assemble( bool skip ) } S32 numVerts = tsalloc.get32(); - S32 *ptr32 = getSharedData32( parentMesh, 3 * numVerts, (S32**)smVertsList.address(), skip ); + S32 *ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smVertsList.address(), skip ); verts.set( (Point3F*)ptr32, numVerts ); S32 numTVerts = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, 2 * numTVerts, (S32**)smTVertsList.address(), skip ); + ptr32 = getSharedData32(mParentMesh, 2 * numTVerts, (S32**)smTVertsList.address(), skip ); tverts.set( (Point2F*)ptr32, numTVerts ); if ( TSShape::smReadVersion > 25 ) { numTVerts = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, 2 * numTVerts, (S32**)smTVerts2List.address(), skip ); + ptr32 = getSharedData32(mParentMesh, 2 * numTVerts, (S32**)smTVerts2List.address(), skip ); tverts2.set( (Point2F*)ptr32, numTVerts ); S32 numVColors = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, numVColors, (S32**)smColorsList.address(), skip ); + ptr32 = getSharedData32(mParentMesh, numVColors, (S32**)smColorsList.address(), skip ); colors.set( (ColorI*)ptr32, numVColors ); } @@ -2457,27 +2457,27 @@ void TSMesh::assemble( bool skip ) if ( TSShape::smReadVersion > 21 && TSMesh::smUseEncodedNormals) { // we have encoded normals and we want to use them... - if ( parentMesh < 0 ) + if (mParentMesh < 0 ) tsalloc.getPointer32( numVerts * 3 ); // adva nce past norms, don't use norms.set( NULL, 0 ); - ptr8 = getSharedData8( parentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip ); + ptr8 = getSharedData8(mParentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip ); encodedNorms.set( ptr8, numVerts ); } else if ( TSShape::smReadVersion > 21 ) { // we have encoded normals but we don't want to use them... - ptr32 = getSharedData32( parentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); + ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); norms.set( (Point3F*)ptr32, numVerts ); - if ( parentMesh < 0 ) + if (mParentMesh < 0 ) tsalloc.getPointer8( numVerts ); // advance past encoded normls, don't use encodedNorms.set( NULL, 0 ); } else { // no encoded normals... - ptr32 = getSharedData32( parentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); + ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); norms.set( (Point3F*)ptr32, numVerts ); encodedNorms.set( NULL, 0 ); } @@ -2554,7 +2554,7 @@ void TSMesh::assemble( bool skip ) // store output primitives.set(primOut, szPrimOut); - indices.set(indOut, szIndOut); + mIndices.set(indOut, szIndOut); // delete temporary arrays if necessary if (deleteInputArrays) @@ -2596,7 +2596,7 @@ void TSMesh::disassemble() tsalloc.set32( numFrames ); tsalloc.set32( numMatFrames ); - tsalloc.set32( parentMesh ); + tsalloc.set32(mParentMesh); tsalloc.copyToBuffer32( (S32*)&mBounds, 6 ); tsalloc.copyToBuffer32( (S32*)&mCenter, 3 ); tsalloc.set32( (S32)mRadius ); @@ -2637,33 +2637,33 @@ void TSMesh::disassemble() { // verts... tsalloc.set32(verts.size()); - if (parentMesh < 0) + if (mParentMesh < 0) tsalloc.copyToBuffer32((S32*)verts.address(), 3 * verts.size()); // if no parent mesh, then save off our verts // tverts... tsalloc.set32(tverts.size()); - if (parentMesh < 0) + if (mParentMesh < 0) tsalloc.copyToBuffer32((S32*)tverts.address(), 2 * tverts.size()); // if no parent mesh, then save off our tverts if (TSShape::smVersion > 25) { // tverts2... tsalloc.set32(tverts2.size()); - if (parentMesh < 0) + if (mParentMesh < 0) tsalloc.copyToBuffer32((S32*)tverts2.address(), 2 * tverts2.size()); // if no parent mesh, then save off our tverts // colors tsalloc.set32(colors.size()); - if (parentMesh < 0) + if (mParentMesh < 0) tsalloc.copyToBuffer32((S32*)colors.address(), colors.size()); // if no parent mesh, then save off our tverts } // norms... - if (parentMesh < 0) // if no parent mesh, then save off our norms + if (mParentMesh < 0) // if no parent mesh, then save off our norms tsalloc.copyToBuffer32((S32*)norms.address(), 3 * norms.size()); // norms.size()==verts.size() or error... // encoded norms... - if (parentMesh < 0) + if (mParentMesh < 0) { // if no parent mesh, compute encoded normals and copy over for (S32 i = 0; i < norms.size(); i++) @@ -2676,7 +2676,7 @@ void TSMesh::disassemble() // optimize triangle draw order during disassemble { - FrameTemp tmpIdxs(indices.size()); + FrameTemp tmpIdxs(mIndices.size()); for ( S32 i = 0; i < primitives.size(); i++ ) { const TSDrawPrimitive& prim = primitives[i]; @@ -2685,8 +2685,8 @@ void TSMesh::disassemble() if ( (prim.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles ) { TriListOpt::OptimizeTriangleOrdering(verts.size(), prim.numElements, - indices.address() + prim.start, tmpIdxs.address()); - dCopyArray(indices.address() + prim.start, tmpIdxs.address(), + mIndices.address() + prim.start, tmpIdxs.address()); + dCopyArray(mIndices.address() + prim.start, tmpIdxs.address(), prim.numElements); } } @@ -2699,8 +2699,8 @@ void TSMesh::disassemble() tsalloc.copyToBuffer32((S32*)primitives.address(),3*primitives.size()); // indices... - tsalloc.set32(indices.size()); - tsalloc.copyToBuffer32((S32*)indices.address(),indices.size()); + tsalloc.set32(mIndices.size()); + tsalloc.copyToBuffer32((S32*)mIndices.address(),mIndices.size()); } else { @@ -2717,10 +2717,10 @@ void TSMesh::disassemble() } // indices - tsalloc.set32(indices.size()); - Vector s16_indices(indices.size()); - for (S32 i=0; i s16_indices(mIndices.size()); + for (S32 i=0; i 21 && TSMesh::smUseEncodedNormals) { // we have encoded normals and we want to use them... - if (parentMesh < 0) + if (mParentMesh < 0) tsalloc.getPointer32(numVerts * 3); // advance past norms, don't use batchData.initialNorms.set(NULL, 0); - ptr8 = getSharedData8(parentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip); + ptr8 = getSharedData8(mParentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip); encodedNorms.set(ptr8, numVerts); // Note: we don't set the encoded normals flag because we handle them in updateSkin and // hide the fact that we are using them from base class (TSMesh) @@ -2779,10 +2779,10 @@ void TSSkinMesh::assemble( bool skip ) else if (TSShape::smReadVersion > 21) { // we have encoded normals but we don't want to use them... - ptr32 = getSharedData32(parentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip); + ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip); batchData.initialNorms.set((Point3F*)ptr32, numVerts); - if (parentMesh < 0) + if (mParentMesh < 0) tsalloc.getPointer8(numVerts); // advance past encoded normls, don't use encodedNorms.set(NULL, 0); @@ -2790,7 +2790,7 @@ void TSSkinMesh::assemble( bool skip ) else { // no encoded normals... - ptr32 = getSharedData32(parentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip); + ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip); batchData.initialNorms.set((Point3F*)ptr32, numVerts); encodedNorms.set(NULL, 0); } @@ -2815,21 +2815,21 @@ void TSSkinMesh::assemble( bool skip ) } sz = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, 16 * sz, (S32**)smInitTransformList.address(), skip ); + ptr32 = getSharedData32(mParentMesh, 16 * sz, (S32**)smInitTransformList.address(), skip ); batchData.initialTransforms.set( ptr32, sz ); sz = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, sz, (S32**)smVertexIndexList.address(), skip ); + ptr32 = getSharedData32(mParentMesh, sz, (S32**)smVertexIndexList.address(), skip ); vertexIndex.set( ptr32, sz ); - ptr32 = getSharedData32( parentMesh, sz, (S32**)smBoneIndexList.address(), skip ); + ptr32 = getSharedData32(mParentMesh, sz, (S32**)smBoneIndexList.address(), skip ); boneIndex.set( ptr32, sz ); - ptr32 = getSharedData32( parentMesh, sz, (S32**)smWeightList.address(), skip ); + ptr32 = getSharedData32(mParentMesh, sz, (S32**)smWeightList.address(), skip ); weight.set( (F32*)ptr32, sz ); sz = tsalloc.get32(); - ptr32 = getSharedData32( parentMesh, sz, (S32**)smNodeIndexList.address(), skip ); + ptr32 = getSharedData32(mParentMesh, sz, (S32**)smNodeIndexList.address(), skip ); batchData.nodeIndex.set( ptr32, sz ); tsalloc.checkGuard(); @@ -2883,7 +2883,7 @@ void TSSkinMesh::disassemble() { tsalloc.set32(batchData.initialVerts.size()); // if we have no parent mesh, then save off our verts & norms - if (parentMesh < 0) + if (mParentMesh < 0) { tsalloc.copyToBuffer32((S32*)verts.address(), 3 * verts.size()); @@ -2900,7 +2900,7 @@ void TSSkinMesh::disassemble() } tsalloc.set32( batchData.initialTransforms.size() ); - if ( parentMesh < 0 ) + if (mParentMesh < 0 ) tsalloc.copyToBuffer32( (S32*)batchData.initialTransforms.address(), batchData.initialTransforms.size() * 16 ); if (!mVertexData.isReady()) @@ -2920,7 +2920,7 @@ void TSSkinMesh::disassemble() if (TSShape::smVersion < 27) { - if (parentMesh < 0) + if (mParentMesh < 0) { tsalloc.copyToBuffer32((S32*)vertexIndex.address(), vertexIndex.size()); @@ -2931,7 +2931,7 @@ void TSSkinMesh::disassemble() } tsalloc.set32( batchData.nodeIndex.size() ); - if ( parentMesh < 0 ) + if (mParentMesh < 0 ) tsalloc.copyToBuffer32( (S32*)batchData.nodeIndex.address(), batchData.nodeIndex.size() ); tsalloc.setGuard(); @@ -3035,7 +3035,7 @@ void TSMesh::createTangents(const Vector &_verts, const Vector U32 p1Index = 0; U32 p2Index = 0; - U32 *baseIdx = &indices[draw.start]; + U32 *baseIdx = &mIndices[draw.start]; const U32 numElements = (U32)draw.numElements; diff --git a/Engine/source/ts/tsMesh.h b/Engine/source/ts/tsMesh.h index ab0a602fd..bc9793b27 100644 --- a/Engine/source/ts/tsMesh.h +++ b/Engine/source/ts/tsMesh.h @@ -268,7 +268,7 @@ protected: public: - S32 parentMesh; ///< index into shapes mesh list + S32 mParentMesh; ///< index into shapes mesh list S32 numFrames; S32 numMatFrames; S32 vertsPerFrame; @@ -333,7 +333,7 @@ protected: Vector primitives; Vector encodedNorms; - Vector indices; + Vector mIndices; /// billboard data Point3F billboardAxis; diff --git a/Engine/source/ts/tsMeshFit.cpp b/Engine/source/ts/tsMeshFit.cpp index 7ea2049c9..25b56ff32 100644 --- a/Engine/source/ts/tsMeshFit.cpp +++ b/Engine/source/ts/tsMeshFit.cpp @@ -251,19 +251,19 @@ void MeshFit::addSourceMesh( const TSShape::Object& obj, const TSMesh* mesh ) const TSDrawPrimitive& draw = mesh->primitives[i]; if ( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles ) { - mIndices.merge( &mesh->indices[draw.start], draw.numElements ); + mIndices.merge( &mesh->mIndices[draw.start], draw.numElements ); } else { - U32 idx0 = mesh->indices[draw.start + 0]; + U32 idx0 = mesh->mIndices[draw.start + 0]; U32 idx1; - U32 idx2 = mesh->indices[draw.start + 1]; + U32 idx2 = mesh->mIndices[draw.start + 1]; U32 *nextIdx = &idx1; for ( S32 j = 2; j < draw.numElements; j++ ) { *nextIdx = idx2; nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1); - idx2 = mesh->indices[draw.start + j]; + idx2 = mesh->mIndices[draw.start + j]; if ( idx0 == idx1 || idx0 == idx2 || idx1 == idx2 ) continue; @@ -329,12 +329,12 @@ TSMesh* MeshFit::createTriMesh( F32* verts, S32 numVerts, U32* indices, S32 numT mesh->setFlags(0); mesh->mNumVerts = numVerts; - mesh->indices.reserve( numTris * 3 ); + mesh->mIndices.reserve( numTris * 3 ); for ( S32 i = 0; i < numTris; i++ ) { - mesh->indices.push_back( indices[i*3 + 0] ); - mesh->indices.push_back( indices[i*3 + 2] ); - mesh->indices.push_back( indices[i*3 + 1] ); + mesh->mIndices.push_back( indices[i*3 + 0] ); + mesh->mIndices.push_back( indices[i*3 + 2] ); + mesh->mIndices.push_back( indices[i*3 + 1] ); } mesh->verts.set( verts, numVerts ); @@ -345,12 +345,12 @@ TSMesh* MeshFit::createTriMesh( F32* verts, S32 numVerts, U32* indices, S32 numT mesh->norms[iNorm] = Point3F::Zero; // Sum triangle normals for each vertex - for (S32 iInd = 0; iInd < mesh->indices.size(); iInd += 3) + for (S32 iInd = 0; iInd < mesh->mIndices.size(); iInd += 3) { // Compute the normal for this triangle - S32 idx0 = mesh->indices[iInd + 0]; - S32 idx1 = mesh->indices[iInd + 1]; - S32 idx2 = mesh->indices[iInd + 2]; + S32 idx0 = mesh->mIndices[iInd + 0]; + S32 idx1 = mesh->mIndices[iInd + 1]; + S32 idx2 = mesh->mIndices[iInd + 2]; const Point3F& v0 = mesh->verts[idx0]; const Point3F& v1 = mesh->verts[idx1]; @@ -377,7 +377,7 @@ TSMesh* MeshFit::createTriMesh( F32* verts, S32 numVerts, U32* indices, S32 numT // Add a single triangle-list primitive mesh->primitives.increment(); mesh->primitives.last().start = 0; - mesh->primitives.last().numElements = mesh->indices.size(); + mesh->primitives.last().numElements = mesh->mIndices.size(); mesh->primitives.last().matIndex = TSDrawPrimitive::Triangles | TSDrawPrimitive::Indexed | TSDrawPrimitive::NoMaterial; diff --git a/Engine/source/ts/tsShape.cpp b/Engine/source/ts/tsShape.cpp index 649e4e6ba..c5bc3000b 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -585,14 +585,14 @@ void TSShape::initObjects() if (!mesh) continue; - if (mesh->parentMesh >= meshes.size()) + if (mesh->mParentMesh >= meshes.size()) { - Con::warnf("Mesh %i has a bad parentMeshObject (%i)", iter - meshes.begin(), mesh->parentMesh); + Con::warnf("Mesh %i has a bad parentMeshObject (%i)", iter - meshes.begin(), mesh->mParentMesh); } - if (mesh->parentMesh >= 0 && mesh->parentMesh < meshes.size()) + if (mesh->mParentMesh >= 0 && mesh->mParentMesh < meshes.size()) { - mesh->parentMeshObject = meshes[mesh->parentMesh]; + mesh->parentMeshObject = meshes[mesh->mParentMesh]; } else { @@ -622,7 +622,7 @@ void TSShape::initVertexBuffers() mesh->getMeshType() != TSMesh::SkinMeshType)) continue; - destIndices += mesh->indices.size(); + destIndices += mesh->mIndices.size(); destPrims += mesh->primitives.size(); } @@ -661,14 +661,14 @@ void TSShape::initVertexBuffers() vertStart += mesh->mNumVerts; primStart += mesh->primitives.size(); - indStart += mesh->indices.size(); + indStart += mesh->mIndices.size(); mesh->mVB = mShapeVertexBuffer; mesh->mPB = mShapeVertexIndices; // Advance piInput += mesh->primitives.size(); - ibIndices += mesh->indices.size(); + ibIndices += mesh->mIndices.size(); if (TSSkinMesh::smDebugSkinVerts && mesh->getMeshType() == TSMesh::SkinMeshType) { @@ -845,7 +845,7 @@ void TSShape::initVertexFeatures() mesh->mVertOffset = destVertex; destVertex += mesh->mVertSize * mesh->getNumVerts(); - destIndices += mesh->indices.size(); + destIndices += mesh->mIndices.size(); count += 1; } diff --git a/Engine/source/ts/tsShapeEdit.cpp b/Engine/source/ts/tsShapeEdit.cpp index 94379de4d..c0c540a66 100644 --- a/Engine/source/ts/tsShapeEdit.cpp +++ b/Engine/source/ts/tsShapeEdit.cpp @@ -756,13 +756,13 @@ void TSShape::removeMeshFromObject(S32 objIndex, S32 meshIndex) if (meshes[k] == NULL) continue; - if (meshes[k]->parentMesh == idxToRemove) + if (meshes[k]->mParentMesh == idxToRemove) { - meshes[k]->parentMesh = -1; + meshes[k]->mParentMesh = -1; } - else if (meshes[k]->parentMesh > idxToRemove) + else if (meshes[k]->mParentMesh > idxToRemove) { - meshes[k]->parentMesh--; + meshes[k]->mParentMesh--; } } @@ -800,13 +800,13 @@ void TSShape::removeMeshFromObject(S32 objIndex, S32 meshIndex) if (meshes[k] == NULL) continue; - if (meshes[k]->parentMesh == idxToRemove) + if (meshes[k]->mParentMesh == idxToRemove) { - meshes[k]->parentMesh = -1; + meshes[k]->mParentMesh = -1; } - else if (meshes[k]->parentMesh > idxToRemove) + else if (meshes[k]->mParentMesh > idxToRemove) { - meshes[k]->parentMesh--; + meshes[k]->mParentMesh--; } } @@ -937,7 +937,7 @@ TSMesh* TSShape::copyMesh( const TSMesh* srcMesh ) const return mesh; // return an empty mesh // Copy mesh elements - mesh->indices = srcMesh->indices; + mesh->mIndices = srcMesh->mIndices; mesh->primitives = srcMesh->primitives; mesh->numFrames = srcMesh->numFrames; mesh->numMatFrames = srcMesh->numMatFrames; From 4915db0a323c99f1c409430d56a629fc776fc7f7 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 12:16:17 -0500 Subject: [PATCH 027/144] clarified the texture-atlas varnames a bit. (shadow vars cleanup) --- Engine/source/ts/tsLastDetail.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Engine/source/ts/tsLastDetail.cpp b/Engine/source/ts/tsLastDetail.cpp index 863e79f3f..842b28a0e 100644 --- a/Engine/source/ts/tsLastDetail.cpp +++ b/Engine/source/ts/tsLastDetail.cpp @@ -420,24 +420,24 @@ void TSLastDetail::_update() imposterCap->end(); - Point2I texSize( destBmp.getWidth(mip), destBmp.getHeight(mip) ); + Point2I atlasSize( destBmp.getWidth(mip), destBmp.getHeight(mip) ); // Ok... pack in bitmaps till we run out. - for ( S32 y=0; y+currDim <= texSize.y; ) + for ( S32 y=0; y+currDim <= atlasSize.y; ) { - for ( S32 x=0; x+currDim <= texSize.x; ) + for ( S32 x=0; x+currDim <= atlasSize.x; ) { // Copy the next bitmap to the dest texture. - GBitmap* bmp = bitmaps.first(); + GBitmap* cell = bitmaps.first(); bitmaps.pop_front(); - destBmp.copyRect( bmp, RectI( 0, 0, currDim, currDim ), Point2I( x, y ), 0, mip ); - delete bmp; + destBmp.copyRect(cell, RectI( 0, 0, currDim, currDim ), Point2I( x, y ), 0, mip ); + delete cell; // Copy the next normal to the dest texture. - GBitmap* normalmap = normalmaps.first(); + GBitmap* cellNormalmap = normalmaps.first(); normalmaps.pop_front(); - destNormal.copyRect( normalmap, RectI( 0, 0, currDim, currDim ), Point2I( x, y ), 0, mip ); - delete normalmap; + destNormal.copyRect(cellNormalmap, RectI( 0, 0, currDim, currDim ), Point2I( x, y ), 0, mip ); + delete cellNormalmap; // Did we finish? if ( bitmaps.empty() ) From 064dfbc4f4dd48d1dd8fe53c9dc0d1c43c1d3f2d Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 14:22:51 -0500 Subject: [PATCH 028/144] tsignal::order to ::mOrder. yet another potential conflict with a class member vs a method input --- Engine/source/core/util/tSignal.cpp | 6 +++--- Engine/source/core/util/tSignal.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Engine/source/core/util/tSignal.cpp b/Engine/source/core/util/tSignal.cpp index 30980a715..d323bec0c 100644 --- a/Engine/source/core/util/tSignal.cpp +++ b/Engine/source/core/util/tSignal.cpp @@ -28,9 +28,9 @@ void SignalBase::DelegateLink::insert(DelegateLink* node, F32 order) { // Note: can only legitimately be called on list head DelegateLink * walk = next; - while (order >= walk->order && walk->next != this) + while (order >= walk->mOrder && walk->next != this) walk = walk->next; - if (order >= walk->order) + if (order >= walk->mOrder) { // insert after walk node->prev = walk; @@ -46,7 +46,7 @@ void SignalBase::DelegateLink::insert(DelegateLink* node, F32 order) walk->prev->next = node; walk->prev = node; } - node->order = order; + node->mOrder = order; } void SignalBase::DelegateLink::unlink() diff --git a/Engine/source/core/util/tSignal.h b/Engine/source/core/util/tSignal.h index 4960ba8dd..f5531e217 100644 --- a/Engine/source/core/util/tSignal.h +++ b/Engine/source/core/util/tSignal.h @@ -53,7 +53,7 @@ public: SignalBase() { mList.next = mList.prev = &mList; - mList.order = 0.5f; + mList.mOrder = 0.5f; } ~SignalBase(); @@ -72,7 +72,7 @@ protected: struct DelegateLink { DelegateLink *next,*prev; - F32 order; + F32 mOrder; void insert(DelegateLink* node, F32 order); void unlink(); @@ -191,7 +191,7 @@ public: for ( DelegateLink *ptr = base.mList.next; ptr != &base.mList; ptr = ptr->next ) { DelegateLinkImpl *del = static_cast( ptr ); - notify( del->mDelegate, del->order ); + notify( del->mDelegate, del->mOrder ); } } From e5a6f4ee3da18b09f4a05f690b0a9b367292aae3 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 14:26:17 -0500 Subject: [PATCH 029/144] TSMesh::castRayOpcode method var clarifications/match for .h file --- Engine/source/ts/tsCollision.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/ts/tsCollision.cpp b/Engine/source/ts/tsCollision.cpp index fc2d22ec1..8fafbed9e 100644 --- a/Engine/source/ts/tsCollision.cpp +++ b/Engine/source/ts/tsCollision.cpp @@ -1499,14 +1499,14 @@ static Point3F texGenAxis[18] = }; -bool TSMesh::castRayOpcode( const Point3F &s, const Point3F &e, RayInfo *info, TSMaterialList *materials ) +bool TSMesh::castRayOpcode( const Point3F &start, const Point3F &end, RayInfo *info, TSMaterialList *materials ) { Opcode::RayCollider ray; Opcode::CollisionFaces cfs; - IceMaths::Point dir( e.x - s.x, e.y - s.y, e.z - s.z ); + IceMaths::Point dir(end.x - start.x, end.y - start.y, end.z - start.z ); const F32 rayLen = dir.Magnitude(); - IceMaths::Ray vec( Point(s.x, s.y, s.z), dir.Normalize() ); + IceMaths::Ray vec( Point(start.x, start.y, start.z), dir.Normalize() ); ray.SetDestination( &cfs); ray.SetFirstContact( false ); From c98f257cae1db5a9d4e1045c743c39685104a9f3 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 14:53:23 -0500 Subject: [PATCH 030/144] more compiler compliant cleanups plus a full set of tsMesh::foo to tsmesh::mFoo class var conversions for consistency --- Engine/source/environment/VolumetricFog.cpp | 4 +- .../source/gui/editor/guiShapeEdPreview.cpp | 6 +- Engine/source/ts/loader/appMesh.cpp | 16 +- Engine/source/ts/loader/tsShapeLoader.cpp | 2 +- Engine/source/ts/tsCollision.cpp | 12 +- Engine/source/ts/tsMesh.cpp | 354 +++++++++--------- Engine/source/ts/tsMesh.h | 44 +-- Engine/source/ts/tsMeshFit.cpp | 68 ++-- Engine/source/ts/tsShape.cpp | 48 +-- Engine/source/ts/tsShapeConstruct.cpp | 8 +- Engine/source/ts/tsShapeEdit.cpp | 16 +- Engine/source/ts/tsSortedMesh.cpp | 6 +- Engine/source/ts/tsSortedMesh.h | 2 +- 13 files changed, 293 insertions(+), 293 deletions(-) diff --git a/Engine/source/environment/VolumetricFog.cpp b/Engine/source/environment/VolumetricFog.cpp index 067dd0c5d..ba655ffa9 100644 --- a/Engine/source/environment/VolumetricFog.cpp +++ b/Engine/source/environment/VolumetricFog.cpp @@ -424,10 +424,10 @@ bool VolumetricFog::LoadShape() for (U32 k = 0; k < mesh->mIndices.size(); k++) det_size[i].indices->push_back(mesh->mIndices[k]); - U32 primitivesSize = mesh->primitives.size(); + U32 primitivesSize = mesh->mPrimitives.size(); for (U32 k = 0; k < primitivesSize; k++) { - const TSDrawPrimitive & draw = mesh->primitives[k]; + const TSDrawPrimitive & draw = mesh->mPrimitives[k]; GFXPrimitiveType drawType = GFXdrawTypes[draw.matIndex >> 30]; switch (drawType) { diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index e373a246b..300b6e95e 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -1244,9 +1244,9 @@ void GuiShapeEdPreview::updateDetailLevel(const SceneRenderState* state) continue; // Count the number of draw calls and materials - mNumDrawCalls += mesh->primitives.size(); - for ( S32 iPrim = 0; iPrim < mesh->primitives.size(); iPrim++ ) - usedMaterials.push_back_unique( mesh->primitives[iPrim].matIndex & TSDrawPrimitive::MaterialMask ); + mNumDrawCalls += mesh->mPrimitives.size(); + for ( S32 iPrim = 0; iPrim < mesh->mPrimitives.size(); iPrim++ ) + usedMaterials.push_back_unique( mesh->mPrimitives[iPrim].matIndex & TSDrawPrimitive::MaterialMask ); // For skinned meshes, count the number of bones and weights if ( mesh->getMeshType() == TSMesh::SkinMeshType ) diff --git a/Engine/source/ts/loader/appMesh.cpp b/Engine/source/ts/loader/appMesh.cpp index aff73df67..bd5c291e0 100644 --- a/Engine/source/ts/loader/appMesh.cpp +++ b/Engine/source/ts/loader/appMesh.cpp @@ -147,13 +147,13 @@ TSMesh* AppMesh::constructTSMesh() } // Copy mesh elements - tsmesh->verts = points; - tsmesh->norms = normals; - tsmesh->tverts = uvs; - tsmesh->primitives = primitives; + tsmesh->mVerts = points; + tsmesh->mNorms = normals; + tsmesh->mTverts = uvs; + tsmesh->mPrimitives = primitives; tsmesh->mIndices = indices; - tsmesh->colors = colors; - tsmesh->tverts2 = uv2s; + tsmesh->mColors = colors; + tsmesh->mTverts2 = uv2s; // Finish initializing the shape tsmesh->setFlags(flags); @@ -162,8 +162,8 @@ TSMesh* AppMesh::constructTSMesh() tsmesh->numFrames = numFrames; tsmesh->numMatFrames = numMatFrames; tsmesh->vertsPerFrame = vertsPerFrame; - tsmesh->createTangents(tsmesh->verts, tsmesh->norms); - tsmesh->encodedNorms.set(NULL,0); + tsmesh->createTangents(tsmesh->mVerts, tsmesh->mNorms); + tsmesh->mEncodedNorms.set(NULL,0); return tsmesh; } diff --git a/Engine/source/ts/loader/tsShapeLoader.cpp b/Engine/source/ts/loader/tsShapeLoader.cpp index 94f5e4fbf..5fa76d0fc 100644 --- a/Engine/source/ts/loader/tsShapeLoader.cpp +++ b/Engine/source/ts/loader/tsShapeLoader.cpp @@ -1172,7 +1172,7 @@ void TSShapeLoader::install() { TSMesh *mesh = shape->meshes[obj.startMeshIndex + iMesh]; - if (mesh && !mesh->primitives.size()) + if (mesh && !mesh->mPrimitives.size()) { S32 oldMeshCount = obj.numMeshes; destructInPlace(mesh); diff --git a/Engine/source/ts/tsCollision.cpp b/Engine/source/ts/tsCollision.cpp index 8fafbed9e..7dc10271b 100644 --- a/Engine/source/ts/tsCollision.cpp +++ b/Engine/source/ts/tsCollision.cpp @@ -1364,9 +1364,9 @@ void TSMesh::prepOpcodeCollision() // Figure out how many triangles we have... U32 triCount = 0; const U32 base = 0; - for ( U32 i = 0; i < primitives.size(); i++ ) + for ( U32 i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; const U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildPolyList (1)" ); @@ -1396,7 +1396,7 @@ void TSMesh::prepOpcodeCollision() } // Just do the first trilist for now. - mi->SetNbVertices( mVertexData.isReady() ? mNumVerts : verts.size() ); + mi->SetNbVertices( mVertexData.isReady() ? mNumVerts : mVerts.size() ); mi->SetNbTriangles( triCount ); // Stuff everything into appropriate arrays. @@ -1407,9 +1407,9 @@ void TSMesh::prepOpcodeCollision() mOpPoints = pts; // add the polys... - for ( U32 i = 0; i < primitives.size(); i++ ) + for ( U32 i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; const U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildPolyList (1)" ); @@ -1467,7 +1467,7 @@ void TSMesh::prepOpcodeCollision() } else { - pts[i].Set( verts[i].x, verts[i].y, verts[i].z ); + pts[i].Set( mVerts[i].x, mVerts[i].y, mVerts[i].z ); } } diff --git a/Engine/source/ts/tsMesh.cpp b/Engine/source/ts/tsMesh.cpp index 528d7f56c..5e767bd66 100644 --- a/Engine/source/ts/tsMesh.cpp +++ b/Engine/source/ts/tsMesh.cpp @@ -122,7 +122,7 @@ void TSMesh::innerRender( TSVertexBufferHandle &vb, GFXPrimitiveBufferHandle &pb GFX->setVertexBuffer( vb ); GFX->setPrimitiveBuffer( pb ); - for( U32 p = 0; p < primitives.size(); p++ ) + for( U32 p = 0; p < mPrimitives.size(); p++ ) GFX->drawPrimitive( p ); } @@ -223,9 +223,9 @@ void TSMesh::innerRender( TSMaterialList *materials, const TSRenderState &rdata, // NOTICE: SFXBB is removed and refraction is disabled! //coreRI->backBuffTex = GFX->getSfxBackBuffer(); - for ( S32 i = 0; i < primitives.size(); i++ ) + for ( S32 i = 0; i < mPrimitives.size(); i++ ) { - const TSDrawPrimitive &draw = primitives[i]; + const TSDrawPrimitive &draw = mPrimitives[i]; // We need to have a material. if ( draw.matIndex & TSDrawPrimitive::NoMaterial ) @@ -253,7 +253,7 @@ void TSMesh::innerRender( TSMaterialList *materials, const TSRenderState &rdata, #ifndef TORQUE_OS_MAC // Get the instancing material if this mesh qualifies. - if ( meshType != SkinMeshType && pb->mPrimitiveArray[i].numVertices < smMaxInstancingVerts ) + if (mMeshType != SkinMeshType && pb->mPrimitiveArray[i].numVertices < smMaxInstancingVerts ) if (matInst && !matInst->getFeatures().hasFeature(MFT_HardwareSkinning)) matInst = InstancingMaterialHook::getInstancingMat( matInst ); @@ -293,13 +293,13 @@ const Point3F * TSMesh::getNormals( S32 firstVert ) if ( getFlags( UseEncodedNormals ) ) { gNormalStore.setSize( vertsPerFrame ); - for ( S32 i = 0; i < encodedNorms.size(); i++ ) - gNormalStore[i] = decodeNormal( encodedNorms[ i + firstVert ] ); + for ( S32 i = 0; i < mEncodedNorms.size(); i++ ) + gNormalStore[i] = decodeNormal(mEncodedNorms[ i + firstVert ] ); return gNormalStore.address(); } - return &norms[firstVert]; + return &mNorms[firstVert]; } //----------------------------------------------------- @@ -352,28 +352,28 @@ bool TSMesh::buildPolyList( S32 frame, AbstractPolyList *polyList, U32 &surfaceK { // Don't use vertex() method as we want to retain the original indices OptimizedPolyList::VertIndex vert; - vert.vertIdx = opList->insertPoint( verts[ i + firstVert ] ); - vert.normalIdx = opList->insertNormal( norms[ i + firstVert ] ); - vert.uv0Idx = opList->insertUV0( tverts[ i + firstVert ] ); + vert.vertIdx = opList->insertPoint( mVerts[ i + firstVert ] ); + vert.normalIdx = opList->insertNormal( mNorms[ i + firstVert ] ); + vert.uv0Idx = opList->insertUV0( mTverts[ i + firstVert ] ); if ( hasTVert2 ) - vert.uv1Idx = opList->insertUV1( tverts2[ i + firstVert ] ); + vert.uv1Idx = opList->insertUV1(mTverts[ i + firstVert ] ); opList->mVertexList.push_back( vert ); } } else { - base = polyList->addPointAndNormal( verts[firstVert], norms[firstVert] ); + base = polyList->addPointAndNormal( mVerts[firstVert], mNorms[firstVert] ); for ( i = 1; i < vertsPerFrame; i++ ) - polyList->addPointAndNormal( verts[ i + firstVert ], norms[ i + firstVert ] ); + polyList->addPointAndNormal(mVerts[ i + firstVert ], mNorms[ i + firstVert ] ); } } } // add the polys... - for ( i = 0; i < primitives.size(); i++ ) + for ( i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildPolyList (1)" ); @@ -440,9 +440,9 @@ bool TSMesh::getFeatures( S32 frame, const MatrixF& mat, const VectorF&, ConvexF } // add the polys... - for ( i = 0; i < primitives.size(); i++ ) + for ( i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildPolyList (1)" ); @@ -627,7 +627,7 @@ void TSMesh::support( S32 frame, const Point3F &v, F32 *currMaxDP, Point3F *curr bool TSMesh::castRay( S32 frame, const Point3F & start, const Point3F & end, RayInfo * rayInfo, TSMaterialList* materials ) { - if ( planeNormals.empty() ) + if ( mPlaneNormals.empty() ) buildConvexHull(); // if haven't done it yet... // Keep track of startTime and endTime. They start out at just under 0 and just over 1, respectively. @@ -657,15 +657,15 @@ bool TSMesh::castRay( S32 frame, const Point3F & start, const Point3F & end, Ray S32 * pplane = &curPlane; bool * pfound = &found; - S32 startPlane = frame * planesPerFrame; - for ( S32 i = startPlane; i < startPlane + planesPerFrame; i++ ) + S32 startPlane = frame * mPlanesPerFrame; + for ( S32 i = startPlane; i < startPlane + mPlanesPerFrame; i++ ) { // if start & end outside, no collision // if start & end inside, continue // if start outside, end inside, or visa versa, find intersection of line with plane // then update intersection of line with hull (using startTime and endTime) - F32 dot1 = mDot( planeNormals[i], start ) - planeConstants[i]; - F32 dot2 = mDot( planeNormals[i], end) - planeConstants[i]; + F32 dot1 = mDot(mPlaneNormals[i], start ) - mPlaneConstants[i]; + F32 dot2 = mDot(mPlaneNormals[i], end) - mPlaneConstants[i]; if ( dot1 * dot2 > 0.0f ) { // same side of the plane...which side -- dot==0 considered inside @@ -747,10 +747,10 @@ bool TSMesh::castRay( S32 frame, const Point3F & start, const Point3F & end, Ray // setup rayInfo if ( found && rayInfo ) { - curMaterial = planeMaterials[ curPlane - startPlane ]; + curMaterial = mPlaneMaterials[ curPlane - startPlane ]; rayInfo->t = (F32)startNum/(F32)startDen; // finally divide... - rayInfo->normal = planeNormals[curPlane]; + rayInfo->normal = mPlaneNormals[curPlane]; if (materials && materials->size() > 0) rayInfo->material = materials->getMaterialInst( curMaterial ); @@ -785,9 +785,9 @@ bool TSMesh::castRayRendered( S32 frame, const Point3F & start, const Point3F & BaseMatInstance* bestMaterial = NULL; Point3F dir = end - start; - for ( S32 i = 0; i < primitives.size(); i++ ) + for ( S32 i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; U32 drawStart = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::castRayRendered (1)" ); @@ -927,35 +927,35 @@ bool TSMesh::addToHull( U32 idx0, U32 idx1, U32 idx2 ) normal.normalize(); F32 k = mDot( normal, mVertexData.getBase(idx0).vert() ); - for ( S32 i = 0; i < planeNormals.size(); i++ ) + for ( S32 i = 0; i < mPlaneNormals.size(); i++ ) { - if ( mDot( planeNormals[i], normal ) > 0.99f && mFabs( k-planeConstants[i] ) < 0.01f ) + if ( mDot(mPlaneNormals[i], normal ) > 0.99f && mFabs( k- mPlaneConstants[i] ) < 0.01f ) return false; // this is a repeat... } // new plane, add it to the list... - planeNormals.push_back( normal ); - planeConstants.push_back( k ); + mPlaneNormals.push_back( normal ); + mPlaneConstants.push_back( k ); return true; } bool TSMesh::buildConvexHull() { // already done, return without error - if ( planeNormals.size() ) + if (mPlaneNormals.size() ) return true; bool error = false; // should probably only have 1 frame, but just in case... - planesPerFrame = 0; + mPlanesPerFrame = 0; S32 frame, i, j; for ( frame = 0; frame < numFrames; frame++ ) { S32 firstVert = vertsPerFrame * frame; - S32 firstPlane = planeNormals.size(); - for ( i = 0; i < primitives.size(); i++ ) + S32 firstPlane = mPlaneNormals.size(); + for ( i = 0; i < mPrimitives.size(); i++ ) { - TSDrawPrimitive & draw = primitives[i]; + TSDrawPrimitive & draw = mPrimitives[i]; U32 start = draw.start; AssertFatal( draw.matIndex & TSDrawPrimitive::Indexed,"TSMesh::buildConvexHull (1)" ); @@ -967,7 +967,7 @@ bool TSMesh::buildConvexHull() if ( addToHull( mIndices[start + j + 0] + firstVert, mIndices[start + j + 1] + firstVert, mIndices[start + j + 2] + firstVert ) && frame == 0 ) - planeMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); + mPlaneMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); } else { @@ -984,51 +984,51 @@ bool TSMesh::buildConvexHull() nextIdx = (U32*) ( (dsize_t)nextIdx ^ (dsize_t)&idx0 ^ (dsize_t)&idx1 ); idx2 = mIndices[start + j] + firstVert; if ( addToHull( idx0, idx1, idx2 ) && frame == 0 ) - planeMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); + mPlaneMaterials.push_back( draw.matIndex & TSDrawPrimitive::MaterialMask ); } } } // make sure all the verts on this frame are inside all the planes for ( i = 0; i < vertsPerFrame; i++ ) - for ( j = firstPlane; j < planeNormals.size(); j++ ) - if ( mDot( mVertexData.getBase(firstVert + i).vert(), planeNormals[j] ) - planeConstants[j] < 0.01 ) // .01 == a little slack + for ( j = firstPlane; j < mPlaneNormals.size(); j++ ) + if ( mDot( mVertexData.getBase(firstVert + i).vert(), mPlaneNormals[j] ) - mPlaneConstants[j] < 0.01 ) // .01 == a little slack error = true; if ( frame == 0 ) - planesPerFrame = planeNormals.size(); + mPlanesPerFrame = mPlaneNormals.size(); - if ( (frame + 1) * planesPerFrame != planeNormals.size() ) + if ( (frame + 1) * mPlanesPerFrame != mPlaneNormals.size() ) { // eek, not all frames have same number of planes... - while ( (frame + 1) * planesPerFrame > planeNormals.size() ) + while ( (frame + 1) * mPlanesPerFrame > mPlaneNormals.size() ) { // we're short, duplicate last plane till we match - U32 sz = planeNormals.size(); - planeNormals.increment(); - planeNormals.last() = planeNormals[sz-1]; - planeConstants.increment(); - planeConstants.last() = planeConstants[sz-1]; + U32 sz = mPlaneNormals.size(); + mPlaneNormals.increment(); + mPlaneNormals.last() = mPlaneNormals[sz-1]; + mPlaneConstants.increment(); + mPlaneConstants.last() = mPlaneConstants[sz-1]; } - while ( (frame + 1) * planesPerFrame < planeNormals.size() ) + while ( (frame + 1) * mPlanesPerFrame < mPlaneNormals.size() ) { // harsh -- last frame has more than other frames // duplicate last plane in each frame for ( S32 k = frame - 1; k >= 0; k-- ) { - planeNormals.insert( k * planesPerFrame + planesPerFrame ); - planeNormals[k * planesPerFrame + planesPerFrame] = planeNormals[k * planesPerFrame + planesPerFrame - 1]; - planeConstants.insert( k * planesPerFrame + planesPerFrame ); - planeConstants[k * planesPerFrame + planesPerFrame] = planeConstants[k * planesPerFrame + planesPerFrame - 1]; + mPlaneNormals.insert( k * mPlanesPerFrame + mPlanesPerFrame ); + mPlaneNormals[k * mPlanesPerFrame + mPlanesPerFrame] = mPlaneNormals[k * mPlanesPerFrame + mPlanesPerFrame - 1]; + mPlaneConstants.insert( k * mPlanesPerFrame + mPlanesPerFrame ); + mPlaneConstants[k * mPlanesPerFrame + mPlanesPerFrame] = mPlaneConstants[k * mPlanesPerFrame + mPlanesPerFrame - 1]; if ( k == 0 ) { - planeMaterials.increment(); - planeMaterials.last() = planeMaterials[planeMaterials.size() - 2]; + mPlaneMaterials.increment(); + mPlaneMaterials.last() = mPlaneMaterials[mPlaneMaterials.size() - 2]; } } - planesPerFrame++; + mPlanesPerFrame++; } } - AssertFatal( (frame + 1) * planesPerFrame == planeNormals.size(),"TSMesh::buildConvexHull (3)" ); + AssertFatal( (frame + 1) * mPlanesPerFrame == mPlaneNormals.size(),"TSMesh::buildConvexHull (3)" ); } return !error; } @@ -1051,7 +1051,7 @@ void TSMesh::computeBounds( const MatrixF &transform, Box3F &bounds, S32 frame, AssertFatal(!mVertexData.isReady() || (mVertexData.isReady() && mNumVerts == mVertexData.size() && mNumVerts == vertsPerFrame), "vertex number mismatch"); - if(verts.size() == 0 && mVertexData.isReady() && mVertexData.size() > 0) + if(mVerts.size() == 0 && mVertexData.isReady() && mVertexData.size() > 0) { baseVert = &mVertexData.getBase(0).vert(); stride = mVertexData.vertSize(); @@ -1066,11 +1066,11 @@ void TSMesh::computeBounds( const MatrixF &transform, Box3F &bounds, S32 frame, } else { - baseVert = verts.address(); + baseVert = mVerts.address(); stride = sizeof(Point3F); if ( frame < 0 ) - numVerts = verts.size(); + numVerts = mVerts.size(); else { baseVert += frame * vertsPerFrame; @@ -1131,22 +1131,22 @@ void TSMesh::computeBounds( const Point3F *v, S32 numVerts, S32 stride, const Ma S32 TSMesh::getNumPolys() const { S32 count = 0; - for ( S32 i = 0; i < primitives.size(); i++ ) + for ( S32 i = 0; i < mPrimitives.size(); i++ ) { - switch (primitives[i].matIndex & TSDrawPrimitive::TypeMask) + switch (mPrimitives[i].matIndex & TSDrawPrimitive::TypeMask) { case TSDrawPrimitive::Triangles: - count += primitives[i].numElements / 3; + count += mPrimitives[i].numElements / 3; break; case TSDrawPrimitive::Fan: - count += primitives[i].numElements - 2; + count += mPrimitives[i].numElements - 2; break; case TSDrawPrimitive::Strip: // Don't count degenerate triangles - for ( S32 j = primitives[i].start; - j < primitives[i].start+primitives[i].numElements-2; + for ( S32 j = mPrimitives[i].start; + j < mPrimitives[i].start+ mPrimitives[i].numElements-2; j++ ) { if ((mIndices[j] != mIndices[j+1]) && @@ -1162,11 +1162,11 @@ S32 TSMesh::getNumPolys() const //----------------------------------------------------- -TSMesh::TSMesh() : meshType( StandardMeshType ) +TSMesh::TSMesh() : mMeshType( StandardMeshType ) { - VECTOR_SET_ASSOCIATION( planeNormals ); - VECTOR_SET_ASSOCIATION( planeConstants ); - VECTOR_SET_ASSOCIATION( planeMaterials ); + VECTOR_SET_ASSOCIATION(mPlaneNormals ); + VECTOR_SET_ASSOCIATION(mPlaneConstants ); + VECTOR_SET_ASSOCIATION(mPlaneMaterials ); mParentMesh = -1; mOptTree = NULL; @@ -1181,7 +1181,7 @@ TSMesh::TSMesh() : meshType( StandardMeshType ) mVertSize = 0; mVertOffset = 0; - parentMeshObject = NULL; + mParentMeshObject = NULL; } //----------------------------------------------------- @@ -1326,8 +1326,8 @@ void TSSkinMesh::createSkinBatchData() } else { - batchData.initialNorms = norms; - batchData.initialVerts = verts; + batchData.initialNorms = mNorms; + batchData.initialVerts = mVerts; } // Build the batch operations @@ -1546,10 +1546,10 @@ void TSSkinMesh::computeBounds( const MatrixF &transform, Box3F &bounds, S32 fra { TORQUE_UNUSED(frame); - if (verts.size() != 0) + if (mVerts.size() != 0) { // Use unskinned verts - TSMesh::computeBounds( verts.address(), verts.size(), sizeof(Point3F), transform, bounds, center, radius ); + TSMesh::computeBounds(mVerts.address(), mVerts.size(), sizeof(Point3F), transform, bounds, center, radius ); } else if (frame <= 0 && batchData.initialVerts.size() > 0) { @@ -2368,10 +2368,10 @@ void TSMesh::dumpPrimitives(U32 startVertex, U32 startIndex, GFXPrimitive *piArr // go through and create PrimitiveInfo array GFXPrimitive pInfo; - U32 primitivesSize = primitives.size(); + U32 primitivesSize = mPrimitives.size(); for (U32 i = 0; i < primitivesSize; i++) { - const TSDrawPrimitive & draw = primitives[i]; + const TSDrawPrimitive & draw = mPrimitives[i]; GFXPrimitiveType drawType = getDrawType(draw.matIndex >> 30); @@ -2436,21 +2436,21 @@ void TSMesh::assemble( bool skip ) S32 numVerts = tsalloc.get32(); S32 *ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smVertsList.address(), skip ); - verts.set( (Point3F*)ptr32, numVerts ); + mVerts.set( (Point3F*)ptr32, numVerts ); S32 numTVerts = tsalloc.get32(); ptr32 = getSharedData32(mParentMesh, 2 * numTVerts, (S32**)smTVertsList.address(), skip ); - tverts.set( (Point2F*)ptr32, numTVerts ); + mTverts.set( (Point2F*)ptr32, numTVerts ); if ( TSShape::smReadVersion > 25 ) { numTVerts = tsalloc.get32(); ptr32 = getSharedData32(mParentMesh, 2 * numTVerts, (S32**)smTVerts2List.address(), skip ); - tverts2.set( (Point2F*)ptr32, numTVerts ); + mTverts2.set( (Point2F*)ptr32, numTVerts ); S32 numVColors = tsalloc.get32(); ptr32 = getSharedData32(mParentMesh, numVColors, (S32**)smColorsList.address(), skip ); - colors.set( (ColorI*)ptr32, numVColors ); + mColors.set( (ColorI*)ptr32, numVColors ); } S8 *ptr8; @@ -2459,27 +2459,27 @@ void TSMesh::assemble( bool skip ) // we have encoded normals and we want to use them... if (mParentMesh < 0 ) tsalloc.getPointer32( numVerts * 3 ); // adva nce past norms, don't use - norms.set( NULL, 0 ); + mNorms.set( NULL, 0 ); ptr8 = getSharedData8(mParentMesh, numVerts, (S8**)smEncodedNormsList.address(), skip ); - encodedNorms.set( ptr8, numVerts ); + mEncodedNorms.set( ptr8, numVerts ); } else if ( TSShape::smReadVersion > 21 ) { // we have encoded normals but we don't want to use them... ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); - norms.set( (Point3F*)ptr32, numVerts ); + mNorms.set( (Point3F*)ptr32, numVerts ); if (mParentMesh < 0 ) tsalloc.getPointer8( numVerts ); // advance past encoded normls, don't use - encodedNorms.set( NULL, 0 ); + mEncodedNorms.set( NULL, 0 ); } else { // no encoded normals... ptr32 = getSharedData32(mParentMesh, 3 * numVerts, (S32**)smNormsList.address(), skip ); - norms.set( (Point3F*)ptr32, numVerts ); - encodedNorms.set( NULL, 0 ); + mNorms.set( (Point3F*)ptr32, numVerts ); + mEncodedNorms.set( NULL, 0 ); } // copy the primitives and indices...how we do this depends on what @@ -2553,7 +2553,7 @@ void TSMesh::assemble( bool skip ) AssertFatal(chkPrim==szPrimOut && chkInd==szIndOut,"TSMesh::primitive conversion"); // store output - primitives.set(primOut, szPrimOut); + mPrimitives.set(primOut, szPrimOut); mIndices.set(indOut, szIndOut); // delete temporary arrays if necessary @@ -2569,7 +2569,7 @@ void TSMesh::assemble( bool skip ) vertsPerFrame = tsalloc.get32(); U32 flags = (U32)tsalloc.get32(); - if ( encodedNorms.size() ) + if ( mEncodedNorms.size() ) flags |= UseEncodedNormals; setFlags( flags ); @@ -2577,9 +2577,9 @@ void TSMesh::assemble( bool skip ) // Set color & tvert2 flags if we have an old version if (TSShape::smReadVersion < 27) { - if (colors.size() > 0) setFlags(HasColor); - if (tverts2.size() > 0) setFlags(HasTVert2); - mNumVerts = verts.size(); + if (mColors.size() > 0) setFlags(HasColor); + if (mTverts2.size() > 0) setFlags(HasTVert2); + mNumVerts = mVerts.size(); } tsalloc.checkGuard(); @@ -2587,7 +2587,7 @@ void TSMesh::assemble( bool skip ) if ( tsalloc.allocShape32( 0 ) && TSShape::smReadVersion < 19 ) computeBounds(); // only do this if we copied the data... - createTangents(verts, norms); + createTangents(mVerts, mNorms); } void TSMesh::disassemble() @@ -2636,39 +2636,39 @@ void TSMesh::disassemble() else { // verts... - tsalloc.set32(verts.size()); + tsalloc.set32(mVerts.size()); if (mParentMesh < 0) - tsalloc.copyToBuffer32((S32*)verts.address(), 3 * verts.size()); // if no parent mesh, then save off our verts + tsalloc.copyToBuffer32((S32*)mVerts.address(), 3 * mVerts.size()); // if no parent mesh, then save off our verts // tverts... - tsalloc.set32(tverts.size()); + tsalloc.set32(mTverts.size()); if (mParentMesh < 0) - tsalloc.copyToBuffer32((S32*)tverts.address(), 2 * tverts.size()); // if no parent mesh, then save off our tverts + tsalloc.copyToBuffer32((S32*)mTverts.address(), 2 * mTverts.size()); // if no parent mesh, then save off our tverts if (TSShape::smVersion > 25) { // tverts2... - tsalloc.set32(tverts2.size()); + tsalloc.set32(mTverts2.size()); if (mParentMesh < 0) - tsalloc.copyToBuffer32((S32*)tverts2.address(), 2 * tverts2.size()); // if no parent mesh, then save off our tverts + tsalloc.copyToBuffer32((S32*)mTverts2.address(), 2 * mTverts2.size()); // if no parent mesh, then save off our tverts // colors - tsalloc.set32(colors.size()); + tsalloc.set32(mColors.size()); if (mParentMesh < 0) - tsalloc.copyToBuffer32((S32*)colors.address(), colors.size()); // if no parent mesh, then save off our tverts + tsalloc.copyToBuffer32((S32*)mColors.address(), mColors.size()); // if no parent mesh, then save off our tverts } // norms... if (mParentMesh < 0) // if no parent mesh, then save off our norms - tsalloc.copyToBuffer32((S32*)norms.address(), 3 * norms.size()); // norms.size()==verts.size() or error... + tsalloc.copyToBuffer32((S32*)mNorms.address(), 3 * mNorms.size()); // norms.size()==verts.size() or error... // encoded norms... if (mParentMesh < 0) { // if no parent mesh, compute encoded normals and copy over - for (S32 i = 0; i < norms.size(); i++) + for (S32 i = 0; i < mNorms.size(); i++) { - U8 normIdx = encodedNorms.size() ? encodedNorms[i] : encodeNormal(norms[i]); + U8 normIdx = mEncodedNorms.size() ? mEncodedNorms[i] : encodeNormal(mNorms[i]); tsalloc.copyToBuffer8((S8*)&normIdx, 1); } } @@ -2677,14 +2677,14 @@ void TSMesh::disassemble() // optimize triangle draw order during disassemble { FrameTemp tmpIdxs(mIndices.size()); - for ( S32 i = 0; i < primitives.size(); i++ ) + for ( S32 i = 0; i < mPrimitives.size(); i++ ) { - const TSDrawPrimitive& prim = primitives[i]; + const TSDrawPrimitive& prim = mPrimitives[i]; // only optimize triangle lists (strips and fans are assumed to be already optimized) if ( (prim.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles ) { - TriListOpt::OptimizeTriangleOrdering(verts.size(), prim.numElements, + TriListOpt::OptimizeTriangleOrdering(mVerts.size(), prim.numElements, mIndices.address() + prim.start, tmpIdxs.address()); dCopyArray(mIndices.address() + prim.start, tmpIdxs.address(), prim.numElements); @@ -2695,8 +2695,8 @@ void TSMesh::disassemble() if (TSShape::smVersion > 25) { // primitives... - tsalloc.set32( primitives.size() ); - tsalloc.copyToBuffer32((S32*)primitives.address(),3*primitives.size()); + tsalloc.set32(mPrimitives.size() ); + tsalloc.copyToBuffer32((S32*)mPrimitives.address(),3* mPrimitives.size()); // indices... tsalloc.set32(mIndices.size()); @@ -2705,15 +2705,15 @@ void TSMesh::disassemble() else { // primitives - tsalloc.set32( primitives.size() ); - for (S32 i=0; i &_verts, const Vector Point3F *tan1 = tan0.address() + numVerts; dMemset( tan0.address(), 0, sizeof(Point3F) * 2 * numVerts ); - U32 numPrimatives = primitives.size(); + U32 numPrimatives = mPrimitives.size(); for (S32 i = 0; i < numPrimatives; i++ ) { - const TSDrawPrimitive & draw = primitives[i]; + const TSDrawPrimitive & draw = mPrimitives[i]; GFXPrimitiveType drawType = getDrawType( draw.matIndex >> 30 ); U32 p1Index = 0; @@ -3066,7 +3066,7 @@ void TSMesh::createTangents(const Vector &_verts, const Vector } } - tangents.setSize( numVerts ); + mTangents.setSize( numVerts ); // fill out final info from accumulated basis data for( U32 i = 0; i < numVerts; i++ ) @@ -3077,12 +3077,12 @@ void TSMesh::createTangents(const Vector &_verts, const Vector Point3F tempPt = t - n * mDot( n, t ); tempPt.normalize(); - tangents[i] = tempPt; + mTangents[i] = tempPt; Point3F cp; mCross( n, t, &cp ); - tangents[i].w = (mDot( cp, b ) < 0.0f) ? -1.0f : 1.0f; + mTangents[i].w = (mDot( cp, b ) < 0.0f) ? -1.0f : 1.0f; } } @@ -3090,7 +3090,7 @@ void TSMesh::convertToVertexData() { if (!mVertexData.isReady()) { - _convertToVertexData(mVertexData, verts, norms); + _convertToVertexData(mVertexData, mVerts, mNorms); } } @@ -3111,39 +3111,39 @@ void TSSkinMesh::convertToVertexData() void TSMesh::copySourceVertexDataFrom(const TSMesh* srcMesh) { - verts = srcMesh->verts; - tverts = srcMesh->tverts; - norms = srcMesh->norms; - colors = srcMesh->colors; - tverts2 = srcMesh->tverts2; + mVerts = srcMesh->mVerts; + mTverts = srcMesh->mTverts; + mNorms = srcMesh->mNorms; + mColors = srcMesh->mColors; + mTverts2 = srcMesh->mTverts2; - if (verts.size() == 0) + if (mVerts.size() == 0) { bool hasTVert2 = srcMesh->getHasTVert2(); bool hasColor = srcMesh->getHasColor(); - verts.setSize(srcMesh->mNumVerts); - tverts.setSize(srcMesh->mNumVerts); - norms.setSize(srcMesh->mNumVerts); + mVerts.setSize(srcMesh->mNumVerts); + mTverts.setSize(srcMesh->mNumVerts); + mNorms.setSize(srcMesh->mNumVerts); if (hasColor) - colors.setSize(mNumVerts); + mColors.setSize(mNumVerts); if (hasTVert2) - tverts2.setSize(mNumVerts); + mTverts2.setSize(mNumVerts); // Fill arrays for (U32 i = 0; i < mNumVerts; i++) { const __TSMeshVertexBase &cv = srcMesh->mVertexData.getBase(i); const __TSMeshVertex_3xUVColor &cvc = srcMesh->mVertexData.getColor(i); - verts[i] = cv.vert(); - tverts[i] = cv.tvert(); - norms[i] = cv.normal(); + mVerts[i] = cv.vert(); + mTverts[i] = cv.tvert(); + mNorms[i] = cv.normal(); if (hasColor) - cvc.color().getColor(&colors[i]); + cvc.color().getColor(&mColors[i]); if (hasTVert2) - tverts2[i] = cvc.tvert2(); + mTverts2[i] = cvc.tvert2(); } } } @@ -3173,21 +3173,21 @@ void TSSkinMesh::copySourceVertexDataFrom(const TSMesh* srcMesh) U32 TSMesh::getNumVerts() { - return mVertexData.isReady() ? mNumVerts : verts.size(); + return mVertexData.isReady() ? mNumVerts : mVerts.size(); } void TSMesh::_convertToVertexData(TSMeshVertexArray &outArray, const Vector &_verts, const Vector &_norms) { // Update tangents list - createTangents(verts, norms); + createTangents(mVerts, mNorms); AssertFatal(_verts.size() == mNumVerts, "vert count mismatch"); - AssertFatal(!getHasColor() || colors.size() == _verts.size(), "Vector of color elements should be the same size as other vectors"); - AssertFatal(!getHasTVert2() || tverts2.size() == _verts.size(), "Vector of tvert2 elements should be the same size as other vectors"); + AssertFatal(!getHasColor() || mColors.size() == _verts.size(), "Vector of color elements should be the same size as other vectors"); + AssertFatal(!getHasTVert2() || mTverts2.size() == _verts.size(), "Vector of tvert2 elements should be the same size as other vectors"); AssertFatal(!outArray.isReady(), "Mesh already converted to aligned data! Re-check code!"); AssertFatal(_verts.size() == _norms.size() && - _verts.size() == tangents.size(), + _verts.size() == mTangents.size(), "Vectors: verts, norms, tangents must all be the same size"); AssertFatal(mVertSize == outArray.vertSize(), "Size inconsistency"); @@ -3206,18 +3206,18 @@ void TSMesh::_convertToVertexData(TSMeshVertexArray &outArray, const Vector 0 || meshType & HasColor; } - U32 getHasTVert2() const { return tverts2.size() > 0 || meshType & HasTVert2; } - void setFlags(U32 flag) { meshType |= flag; } - void clearFlags(U32 flag) { meshType &= ~flag; } - U32 getFlags( U32 flag = 0xFFFFFFFF ) const { return meshType & flag; } + U32 getMeshType() const { return mMeshType & TypeMask; } + U32 getHasColor() const { return mColors.size() > 0 || mMeshType & HasColor; } + U32 getHasTVert2() const { return mTverts2.size() > 0 || mMeshType & HasTVert2; } + void setFlags(U32 flag) { mMeshType |= flag; } + void clearFlags(U32 flag) { mMeshType &= ~flag; } + U32 getFlags( U32 flag = 0xFFFFFFFF ) const { return mMeshType & flag; } const Point3F* getNormals( S32 firstVert ); @@ -319,34 +319,34 @@ protected: /// @name Vertex data /// @{ - FreeableVector verts; - FreeableVector norms; - FreeableVector tverts; - FreeableVector tangents; + FreeableVector mVerts; + FreeableVector mNorms; + FreeableVector mTverts; + FreeableVector mTangents; // Optional second texture uvs. - FreeableVector tverts2; + FreeableVector mTverts2; // Optional vertex colors data. - FreeableVector colors; + FreeableVector mColors; /// @} - Vector primitives; - Vector encodedNorms; + Vector mPrimitives; + Vector mEncodedNorms; Vector mIndices; /// billboard data - Point3F billboardAxis; + Point3F mBillboardAxis; /// @name Convex Hull Data /// Convex hulls are convex (no angles >= 180º) meshes used for collision /// @{ - Vector planeNormals; - Vector planeConstants; - Vector planeMaterials; - S32 planesPerFrame; - U32 mergeBufferStart; + Vector mPlaneNormals; + Vector mPlaneConstants; + Vector mPlaneMaterials; + S32 mPlanesPerFrame; + U32 mMergeBufferStart; /// @} /// @name Render Methods diff --git a/Engine/source/ts/tsMeshFit.cpp b/Engine/source/ts/tsMeshFit.cpp index 25b56ff32..0beb2d9a2 100644 --- a/Engine/source/ts/tsMeshFit.cpp +++ b/Engine/source/ts/tsMeshFit.cpp @@ -246,9 +246,9 @@ void MeshFit::addSourceMesh( const TSShape::Object& obj, const TSMesh* mesh ) { // Add indices S32 indicesBase = mIndices.size(); - for ( S32 i = 0; i < mesh->primitives.size(); i++ ) + for ( S32 i = 0; i < mesh->mPrimitives.size(); i++ ) { - const TSDrawPrimitive& draw = mesh->primitives[i]; + const TSDrawPrimitive& draw = mesh->mPrimitives[i]; if ( (draw.matIndex & TSDrawPrimitive::TypeMask) == TSDrawPrimitive::Triangles ) { mIndices.merge( &mesh->mIndices[draw.start], draw.numElements ); @@ -282,7 +282,7 @@ void MeshFit::addSourceMesh( const TSShape::Object& obj, const TSMesh* mesh ) S32 count, stride; U8* pVert; - if ( mesh->mVertexData.isReady() && mesh->verts.size() == 0 ) + if ( mesh->mVertexData.isReady() && mesh->mVerts.size() == 0 ) { count = mesh->mVertexData.size(); stride = mesh->mVertexData.vertSize(); @@ -290,9 +290,9 @@ void MeshFit::addSourceMesh( const TSShape::Object& obj, const TSMesh* mesh ) } else { - count = mesh->verts.size(); + count = mesh->mVerts.size(); stride = sizeof(Point3F); - pVert = (U8*)mesh->verts.address(); + pVert = (U8*)mesh->mVerts.address(); } MatrixF objMat; @@ -337,12 +337,12 @@ TSMesh* MeshFit::createTriMesh( F32* verts, S32 numVerts, U32* indices, S32 numT mesh->mIndices.push_back( indices[i*3 + 1] ); } - mesh->verts.set( verts, numVerts ); + mesh->mVerts.set( verts, numVerts ); // Compute mesh normals - mesh->norms.setSize( mesh->verts.size() ); - for (S32 iNorm = 0; iNorm < mesh->norms.size(); iNorm++) - mesh->norms[iNorm] = Point3F::Zero; + mesh->mNorms.setSize( mesh->mVerts.size() ); + for (S32 iNorm = 0; iNorm < mesh->mNorms.size(); iNorm++) + mesh->mNorms[iNorm] = Point3F::Zero; // Sum triangle normals for each vertex for (S32 iInd = 0; iInd < mesh->mIndices.size(); iInd += 3) @@ -352,38 +352,38 @@ TSMesh* MeshFit::createTriMesh( F32* verts, S32 numVerts, U32* indices, S32 numT S32 idx1 = mesh->mIndices[iInd + 1]; S32 idx2 = mesh->mIndices[iInd + 2]; - const Point3F& v0 = mesh->verts[idx0]; - const Point3F& v1 = mesh->verts[idx1]; - const Point3F& v2 = mesh->verts[idx2]; + const Point3F& v0 = mesh->mVerts[idx0]; + const Point3F& v1 = mesh->mVerts[idx1]; + const Point3F& v2 = mesh->mVerts[idx2]; Point3F n; mCross(v2 - v0, v1 - v0, &n); n.normalize(); // remove this to use 'weighted' normals (large triangles will have more effect) - mesh->norms[idx0] += n; - mesh->norms[idx1] += n; - mesh->norms[idx2] += n; + mesh->mNorms[idx0] += n; + mesh->mNorms[idx1] += n; + mesh->mNorms[idx2] += n; } // Normalize the vertex normals (this takes care of averaging the triangle normals) - for (S32 iNorm = 0; iNorm < mesh->norms.size(); iNorm++) - mesh->norms[iNorm].normalize(); + for (S32 iNorm = 0; iNorm < mesh->mNorms.size(); iNorm++) + mesh->mNorms[iNorm].normalize(); // Set some dummy UVs - mesh->tverts.setSize( numVerts ); - for ( S32 j = 0; j < mesh->tverts.size(); j++ ) - mesh->tverts[j].set( 0, 0 ); + mesh->mTverts.setSize( numVerts ); + for ( S32 j = 0; j < mesh->mTverts.size(); j++ ) + mesh->mTverts[j].set( 0, 0 ); // Add a single triangle-list primitive - mesh->primitives.increment(); - mesh->primitives.last().start = 0; - mesh->primitives.last().numElements = mesh->mIndices.size(); - mesh->primitives.last().matIndex = TSDrawPrimitive::Triangles | + mesh->mPrimitives.increment(); + mesh->mPrimitives.last().start = 0; + mesh->mPrimitives.last().numElements = mesh->mIndices.size(); + mesh->mPrimitives.last().matIndex = TSDrawPrimitive::Triangles | TSDrawPrimitive::Indexed | TSDrawPrimitive::NoMaterial; - mesh->createTangents( mesh->verts, mesh->norms ); - mesh->encodedNorms.set( NULL,0 ); + mesh->createTangents( mesh->mVerts, mesh->mNorms); + mesh->mEncodedNorms.set( NULL,0 ); return mesh; } @@ -404,13 +404,13 @@ void MeshFit::addBox( const Point3F& sides, const MatrixF& mat ) if ( !mesh ) return; - if (mesh->verts.size() > 0) + if (mesh->mVerts.size() > 0) { - for (S32 i = 0; i < mesh->verts.size(); i++) + for (S32 i = 0; i < mesh->mVerts.size(); i++) { - Point3F v = mesh->verts[i]; + Point3F v = mesh->mVerts[i]; v.convolve(sides); - mesh->verts[i] = v; + mesh->mVerts[i] = v; } mesh->mVertexData.setReady(false); @@ -799,7 +799,7 @@ DefineTSShapeConstructorMethod( addPrimitive, bool, ( const char* meshName, cons MatrixF mat( txfm.getMatrix() ); // Transform the mesh vertices - if ( mesh->mVertexData.isReady() && mesh->verts.size() == 0 ) + if ( mesh->mVertexData.isReady() && mesh->mVerts.size() == 0 ) { for (S32 i = 0; i < mesh->mVertexData.size(); i++) { @@ -811,10 +811,10 @@ DefineTSShapeConstructorMethod( addPrimitive, bool, ( const char* meshName, cons } else { - for (S32 i = 0; i < mesh->verts.size(); i++) + for (S32 i = 0; i < mesh->mVerts.size(); i++) { - Point3F v(mesh->verts[i]); - mat.mulP( v, &mesh->verts[i] ); + Point3F v(mesh->mVerts[i]); + mat.mulP( v, &mesh->mVerts[i] ); } } diff --git a/Engine/source/ts/tsShape.cpp b/Engine/source/ts/tsShape.cpp index c5bc3000b..f1f77d91a 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -592,11 +592,11 @@ void TSShape::initObjects() if (mesh->mParentMesh >= 0 && mesh->mParentMesh < meshes.size()) { - mesh->parentMeshObject = meshes[mesh->mParentMesh]; + mesh->mParentMeshObject = meshes[mesh->mParentMesh]; } else { - mesh->parentMeshObject = NULL; + mesh->mParentMeshObject = NULL; } mesh->mVertexFormat = &mVertexFormat; @@ -623,7 +623,7 @@ void TSShape::initVertexBuffers() continue; destIndices += mesh->mIndices.size(); - destPrims += mesh->primitives.size(); + destPrims += mesh->mPrimitives.size(); } // For HW skinning we can just use the static buffer @@ -660,14 +660,14 @@ void TSShape::initVertexBuffers() AssertFatal(mesh->mVertOffset / mVertexSize == vertStart, "offset mismatch"); vertStart += mesh->mNumVerts; - primStart += mesh->primitives.size(); + primStart += mesh->mPrimitives.size(); indStart += mesh->mIndices.size(); mesh->mVB = mShapeVertexBuffer; mesh->mPB = mShapeVertexIndices; // Advance - piInput += mesh->primitives.size(); + piInput += mesh->mPrimitives.size(); ibIndices += mesh->mIndices.size(); if (TSSkinMesh::smDebugSkinVerts && mesh->getMeshType() == TSMesh::SkinMeshType) @@ -906,12 +906,12 @@ void TSShape::initVertexFeatures() mesh->mVertexData.setReady(true); #ifdef TORQUE_DEBUG - AssertFatal(mesh->mNumVerts == mesh->verts.size(), "vert mismatch"); + AssertFatal(mesh->mNumVerts == mesh->mVerts.size(), "vert mismatch"); for (U32 i = 0; i < mesh->mNumVerts; i++) { - Point3F v1 = mesh->verts[i]; + Point3F v1 = mesh->mVerts[i]; Point3F v2 = mesh->mVertexData.getBase(i).vert(); - AssertFatal(mesh->verts[i] == mesh->mVertexData.getBase(i).vert(), "vert data mismatch"); + AssertFatal(mesh->mVerts[i] == mesh->mVertexData.getBase(i).vert(), "vert data mismatch"); } if (mesh->getMeshType() == TSMesh::SkinMeshType) @@ -987,11 +987,11 @@ void TSShape::initMaterialList() if (!mesh) continue; - for (k=0; kprimitives.size(); k++) + for (k=0; kmPrimitives.size(); k++) { - if (mesh->primitives[k].matIndex & TSDrawPrimitive::NoMaterial) + if (mesh->mPrimitives[k].matIndex & TSDrawPrimitive::NoMaterial) continue; - S32 flags = materialList->getFlags(mesh->primitives[k].matIndex & TSDrawPrimitive::MaterialMask); + S32 flags = materialList->getFlags(mesh->mPrimitives[k].matIndex & TSDrawPrimitive::MaterialMask); if (flags & TSMaterialList::AuxiliaryMap) continue; if (flags & TSMaterialList::Translucent) @@ -1001,7 +1001,7 @@ void TSShape::initMaterialList() break; } } - if (k!=mesh->primitives.size()) + if (k!=mesh->mPrimitives.size()) break; } if (j!=obj.numMeshes) @@ -1521,15 +1521,15 @@ void TSShape::assembleShape() // fill in location of verts, tverts, and normals for detail levels if (mesh && meshType!=TSMesh::DecalMeshType) { - TSMesh::smVertsList[i] = mesh->verts.address(); - TSMesh::smTVertsList[i] = mesh->tverts.address(); + TSMesh::smVertsList[i] = mesh->mVerts.address(); + TSMesh::smTVertsList[i] = mesh->mTverts.address(); if (smReadVersion >= 26) { - TSMesh::smTVerts2List[i] = mesh->tverts2.address(); - TSMesh::smColorsList[i] = mesh->colors.address(); + TSMesh::smTVerts2List[i] = mesh->mTverts2.address(); + TSMesh::smColorsList[i] = mesh->mColors.address(); } - TSMesh::smNormsList[i] = mesh->norms.address(); - TSMesh::smEncodedNormsList[i] = mesh->encodedNorms.address(); + TSMesh::smNormsList[i] = mesh->mNorms.address(); + TSMesh::smEncodedNormsList[i] = mesh->mEncodedNorms.address(); TSMesh::smDataCopied[i] = !skip; // as long as we didn't skip this mesh, the data should be in shape now if (meshType==TSMesh::SkinMeshType) { @@ -1617,9 +1617,9 @@ void TSShape::assembleShape() if (skin) { TSMesh::smVertsList[i] = skin->batchData.initialVerts.address(); - TSMesh::smTVertsList[i] = skin->tverts.address(); + TSMesh::smTVertsList[i] = skin->mTverts.address(); TSMesh::smNormsList[i] = skin->batchData.initialNorms.address(); - TSMesh::smEncodedNormsList[i] = skin->encodedNorms.address(); + TSMesh::smEncodedNormsList[i] = skin->mEncodedNorms.address(); TSMesh::smDataCopied[i] = !skip; // as long as we didn't skip this mesh, the data should be in shape now TSSkinMesh::smInitTransformList[i] = skin->batchData.initialTransforms.address(); TSSkinMesh::smVertexIndexList[i] = skin->vertexIndex.address(); @@ -1805,15 +1805,15 @@ bool TSShape::canWriteOldFormat() const continue; // Cannot use old format if using the new functionality (COLORs, 2nd UV set) - if (meshes[i]->tverts2.size() || meshes[i]->colors.size()) + if (meshes[i]->mTverts2.size() || meshes[i]->mColors.size()) return false; // Cannot use old format if any primitive has too many triangles // (ie. cannot fit in a S16) - for (S32 j = 0; j < meshes[i]->primitives.size(); j++) + for (S32 j = 0; j < meshes[i]->mPrimitives.size(); j++) { - if ((meshes[i]->primitives[j].start + - meshes[i]->primitives[j].numElements) >= (1 << 15)) + if ((meshes[i]->mPrimitives[j].start + + meshes[i]->mPrimitives[j].numElements) >= (1 << 15)) { return false; } diff --git a/Engine/source/ts/tsShapeConstruct.cpp b/Engine/source/ts/tsShapeConstruct.cpp index 612b5dcf7..50b500828 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/Engine/source/ts/tsShapeConstruct.cpp @@ -1340,7 +1340,7 @@ DefineTSShapeConstructorMethod( getMeshMaterial, const char*, ( const char* name GET_MESH( getMeshMaterial, mesh, name, "" ); // Return the name of the first material attached to this mesh - S32 matIndex = mesh->primitives[0].matIndex & TSDrawPrimitive::MaterialMask; + S32 matIndex = mesh->mPrimitives[0].matIndex & TSDrawPrimitive::MaterialMask; if ((matIndex >= 0) && (matIndex < mShape->materialList->size())) return mShape->materialList->getMaterialName( matIndex ); else @@ -1377,10 +1377,10 @@ DefineTSShapeConstructorMethod( setMeshMaterial, bool, ( const char* meshName, c } // Set this material for all primitives in the mesh - for ( S32 i = 0; i < mesh->primitives.size(); i++ ) + for ( S32 i = 0; i < mesh->mPrimitives.size(); i++ ) { - U32 matType = mesh->primitives[i].matIndex & ( TSDrawPrimitive::TypeMask | TSDrawPrimitive::Indexed ); - mesh->primitives[i].matIndex = ( matType | matIndex ); + U32 matType = mesh->mPrimitives[i].matIndex & ( TSDrawPrimitive::TypeMask | TSDrawPrimitive::Indexed ); + mesh->mPrimitives[i].matIndex = ( matType | matIndex ); } ADD_TO_CHANGE_SET(); diff --git a/Engine/source/ts/tsShapeEdit.cpp b/Engine/source/ts/tsShapeEdit.cpp index c0c540a66..f1b35a928 100644 --- a/Engine/source/ts/tsShapeEdit.cpp +++ b/Engine/source/ts/tsShapeEdit.cpp @@ -938,7 +938,7 @@ TSMesh* TSShape::copyMesh( const TSMesh* srcMesh ) const // Copy mesh elements mesh->mIndices = srcMesh->mIndices; - mesh->primitives = srcMesh->primitives; + mesh->mPrimitives = srcMesh->mPrimitives; mesh->numFrames = srcMesh->numFrames; mesh->numMatFrames = srcMesh->numMatFrames; mesh->vertsPerFrame = srcMesh->vertsPerFrame; @@ -948,8 +948,8 @@ TSMesh* TSShape::copyMesh( const TSMesh* srcMesh ) const // Copy vertex data in an *unpacked* form mesh->copySourceVertexDataFrom(srcMesh); - mesh->createTangents(mesh->verts, mesh->norms); - mesh->encodedNorms.set(NULL, 0); + mesh->createTangents(mesh->mVerts, mesh->mNorms); + mesh->mEncodedNorms.set(NULL, 0); mesh->computeBounds(); @@ -1108,12 +1108,12 @@ bool TSShape::addMesh(TSShape* srcShape, const String& srcMeshName, const String // Copy materials used by the source mesh (only if from a different shape) if (srcShape != this) { - for (S32 i = 0; i < mesh->primitives.size(); i++) + for (S32 i = 0; i < mesh->mPrimitives.size(); i++) { - if (!(mesh->primitives[i].matIndex & TSDrawPrimitive::NoMaterial)) + if (!(mesh->mPrimitives[i].matIndex & TSDrawPrimitive::NoMaterial)) { - S32 drawType = (mesh->primitives[i].matIndex & (~TSDrawPrimitive::MaterialMask)); - S32 srcMatIndex = mesh->primitives[i].matIndex & TSDrawPrimitive::MaterialMask; + S32 drawType = (mesh->mPrimitives[i].matIndex & (~TSDrawPrimitive::MaterialMask)); + S32 srcMatIndex = mesh->mPrimitives[i].matIndex & TSDrawPrimitive::MaterialMask; const String& matName = srcShape->materialList->getMaterialName(srcMatIndex); // Add the material if it does not already exist @@ -1124,7 +1124,7 @@ bool TSShape::addMesh(TSShape* srcShape, const String& srcMeshName, const String materialList->push_back(matName, srcShape->materialList->getFlags(srcMatIndex)); } - mesh->primitives[i].matIndex = drawType | destMatIndex; + mesh->mPrimitives[i].matIndex = drawType | destMatIndex; } } } diff --git a/Engine/source/ts/tsSortedMesh.cpp b/Engine/source/ts/tsSortedMesh.cpp index e2c5b489c..8a88ff319 100644 --- a/Engine/source/ts/tsSortedMesh.cpp +++ b/Engine/source/ts/tsSortedMesh.cpp @@ -86,10 +86,10 @@ S32 TSSortedMesh::getNumPolys() Cluster & cluster = clusters[cIdx]; for (S32 i=cluster.startPrimitive; i Date: Tue, 13 Mar 2018 15:31:00 -0500 Subject: [PATCH 031/144] cleaned up member::radius --- Engine/source/T3D/guiMaterialPreview.cpp | 2 +- Engine/source/T3D/guiObjectView.cpp | 2 +- Engine/source/T3D/vehicles/wheeledVehicle.cpp | 2 +- Engine/source/environment/VolumetricFog.cpp | 4 ++-- Engine/source/gui/editor/guiShapeEdPreview.cpp | 4 ++-- Engine/source/lighting/common/blobShadow.cpp | 2 +- Engine/source/ts/loader/tsShapeLoader.cpp | 4 ++-- Engine/source/ts/tsLastDetail.cpp | 2 +- Engine/source/ts/tsShape.cpp | 6 +++--- Engine/source/ts/tsShape.h | 2 +- Engine/source/ts/tsShapeConstruct.cpp | 4 ++-- Engine/source/ts/tsShapeInstance.cpp | 2 +- 12 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Engine/source/T3D/guiMaterialPreview.cpp b/Engine/source/T3D/guiMaterialPreview.cpp index 1fa053a12..05d42b87f 100644 --- a/Engine/source/T3D/guiMaterialPreview.cpp +++ b/Engine/source/T3D/guiMaterialPreview.cpp @@ -269,7 +269,7 @@ void GuiMaterialPreview::setObjectModel(const char* modelName) // Initialize camera values: mOrbitPos = mModel->getShape()->center; - mMinOrbitDist = mModel->getShape()->radius; + mMinOrbitDist = mModel->getShape()->mRadius; lastRenderTime = Platform::getVirtualMilliseconds(); } diff --git a/Engine/source/T3D/guiObjectView.cpp b/Engine/source/T3D/guiObjectView.cpp index 13c46380c..5330a1ee6 100644 --- a/Engine/source/T3D/guiObjectView.cpp +++ b/Engine/source/T3D/guiObjectView.cpp @@ -367,7 +367,7 @@ void GuiObjectView::setObjectModel( const String& modelName ) // Initialize camera values. mOrbitPos = mModel->getShape()->center; - mMinOrbitDist = mModel->getShape()->radius; + mMinOrbitDist = mModel->getShape()->mRadius; // Initialize animation. diff --git a/Engine/source/T3D/vehicles/wheeledVehicle.cpp b/Engine/source/T3D/vehicles/wheeledVehicle.cpp index 05524867a..455dee9f5 100644 --- a/Engine/source/T3D/vehicles/wheeledVehicle.cpp +++ b/Engine/source/T3D/vehicles/wheeledVehicle.cpp @@ -400,7 +400,7 @@ bool WheeledVehicleData::preload(bool server, String &errorStr) MatrixF imat(1); SphereF sphere; sphere.center = mShape->center; - sphere.radius = mShape->radius; + sphere.radius = mShape->mRadius; PlaneExtractorPolyList polyList; polyList.mPlaneList = &rigidBody.mPlaneList; polyList.setTransform(&imat, Point3F(1,1,1)); diff --git a/Engine/source/environment/VolumetricFog.cpp b/Engine/source/environment/VolumetricFog.cpp index ba655ffa9..e0b1c6227 100644 --- a/Engine/source/environment/VolumetricFog.cpp +++ b/Engine/source/environment/VolumetricFog.cpp @@ -348,7 +348,7 @@ bool VolumetricFog::LoadShape() } mObjBox = mShape->mBounds; - mRadius = mShape->radius; + mRadius = mShape->mRadius; resetWorldBox(); if (!isClientObject()) @@ -561,7 +561,7 @@ U32 VolumetricFog::packUpdate(NetConnection *con, U32 mask, BitStream *stream) if (bool(mShape) == false) return retMask; mObjBox = mShape->mBounds; - mRadius = mShape->radius; + mRadius = mShape->mRadius; resetWorldBox(); mObjSize = mWorldBox.getGreatestDiagonalLength(); mObjScale = getScale(); diff --git a/Engine/source/gui/editor/guiShapeEdPreview.cpp b/Engine/source/gui/editor/guiShapeEdPreview.cpp index 300b6e95e..bb83d85d7 100644 --- a/Engine/source/gui/editor/guiShapeEdPreview.cpp +++ b/Engine/source/gui/editor/guiShapeEdPreview.cpp @@ -366,8 +366,8 @@ bool GuiShapeEdPreview::setObjectModel(const char* modelName) mOrbitPos = shape->center; // Set camera move and zoom speed according to model size - mMoveSpeed = shape->radius / sMoveScaler; - mZoomSpeed = shape->radius / sZoomScaler; + mMoveSpeed = shape->mRadius / sMoveScaler; + mZoomSpeed = shape->mRadius / sZoomScaler; // Reset node selection mHoverNode = -1; diff --git a/Engine/source/lighting/common/blobShadow.cpp b/Engine/source/lighting/common/blobShadow.cpp index 3db211762..f0d87be28 100644 --- a/Engine/source/lighting/common/blobShadow.cpp +++ b/Engine/source/lighting/common/blobShadow.cpp @@ -95,7 +95,7 @@ bool BlobShadow::shouldRender(F32 camDist) if (mShapeBase && mShapeBase->getFadeVal() < TSMesh::VISIBILITY_EPSILON) return false; - F32 shadowLen = 10.0f * mShapeInstance->getShape()->radius; + F32 shadowLen = 10.0f * mShapeInstance->getShape()->mRadius; Point3F pos = mShapeInstance->getShape()->center; // this is a bit of a hack...move generic shadows towards feet/base of shape diff --git a/Engine/source/ts/loader/tsShapeLoader.cpp b/Engine/source/ts/loader/tsShapeLoader.cpp index 5fa76d0fc..11779eb6b 100644 --- a/Engine/source/ts/loader/tsShapeLoader.cpp +++ b/Engine/source/ts/loader/tsShapeLoader.cpp @@ -1225,8 +1225,8 @@ void TSShapeLoader::install() shape->mBounds = Box3F(1.0f); shape->mBounds.getCenter(&shape->center); - shape->radius = (shape->mBounds.maxExtents - shape->center).len(); - shape->tubeRadius = shape->radius; + shape->mRadius = (shape->mBounds.maxExtents - shape->center).len(); + shape->tubeRadius = shape->mRadius; shape->init(); shape->finalizeEditable(); diff --git a/Engine/source/ts/tsLastDetail.cpp b/Engine/source/ts/tsLastDetail.cpp index 842b28a0e..19fd7e140 100644 --- a/Engine/source/ts/tsLastDetail.cpp +++ b/Engine/source/ts/tsLastDetail.cpp @@ -82,7 +82,7 @@ TSLastDetail::TSLastDetail( TSShape *shape, mDl = dl; mDim = getMax( dim, (S32)32 ); - mRadius = mShape->radius; + mRadius = mShape->mRadius; mCenter = mShape->center; mCachePath = cachePath; diff --git a/Engine/source/ts/tsShape.cpp b/Engine/source/ts/tsShape.cpp index f1f77d91a..681388d6d 100644 --- a/Engine/source/ts/tsShape.cpp +++ b/Engine/source/ts/tsShape.cpp @@ -1195,7 +1195,7 @@ void TSShape::assembleShape() tsalloc.checkGuard(); // get bounds... - tsalloc.get32((S32*)&radius,1); + tsalloc.get32((S32*)&mRadius,1); tsalloc.get32((S32*)&tubeRadius,1); tsalloc.get32((S32*)¢er,3); tsalloc.get32((S32*)&mBounds,6); @@ -1670,7 +1670,7 @@ void TSShape::disassembleShape() tsalloc.setGuard(); // get bounds... - tsalloc.copyToBuffer32((S32*)&radius,1); + tsalloc.copyToBuffer32((S32*)&mRadius,1); tsalloc.copyToBuffer32((S32*)&tubeRadius,1); tsalloc.copyToBuffer32((S32*)¢er,3); tsalloc.copyToBuffer32((S32*)&mBounds,6); @@ -2060,7 +2060,7 @@ void TSShape::createEmptyShape() names[1] = StringTable->insert("Mesh2"); names[2] = StringTable->insert("Mesh"); - radius = 0.866025f; + mRadius = 0.866025f; tubeRadius = 0.707107f; center.set(0.0f, 0.5f, 0.0f); mBounds.minExtents.set(-0.5f, 0.0f, -0.5f); diff --git a/Engine/source/ts/tsShape.h b/Engine/source/ts/tsShape.h index d6196c986..164e378a9 100644 --- a/Engine/source/ts/tsShape.h +++ b/Engine/source/ts/tsShape.h @@ -354,7 +354,7 @@ class TSShape /// @name Bounding /// @{ - F32 radius; + F32 mRadius; F32 tubeRadius; Point3F center; Box3F mBounds; diff --git a/Engine/source/ts/tsShapeConstruct.cpp b/Engine/source/ts/tsShapeConstruct.cpp index 50b500828..24fb85726 100644 --- a/Engine/source/ts/tsShapeConstruct.cpp +++ b/Engine/source/ts/tsShapeConstruct.cpp @@ -1459,8 +1459,8 @@ DefineTSShapeConstructorMethod( setBounds, bool, ( Box3F bbox ),, shape->mBounds = bbox; shape->mBounds.getCenter( &shape->center ); - shape->radius = ( shape->mBounds.maxExtents - shape->center ).len(); - shape->tubeRadius = shape->radius; + shape->mRadius = ( shape->mBounds.maxExtents - shape->center ).len(); + shape->tubeRadius = shape->mRadius; ADD_TO_CHANGE_SET(); return true; diff --git a/Engine/source/ts/tsShapeInstance.cpp b/Engine/source/ts/tsShapeInstance.cpp index 98d6b39ea..f9a74e446 100644 --- a/Engine/source/ts/tsShapeInstance.cpp +++ b/Engine/source/ts/tsShapeInstance.cpp @@ -662,7 +662,7 @@ S32 TSShapeInstance::setDetailFromDistance( const SceneRenderState *state, F32 s // We're inlining SceneRenderState::projectRadius here to // skip the unnessasary divide by zero protection. - F32 pixelRadius = ( mShape->radius / scaledDistance ) * state->getWorldToScreenScale().y * pixelScale; + F32 pixelRadius = ( mShape->mRadius / scaledDistance ) * state->getWorldToScreenScale().y * pixelScale; F32 pixelSize = pixelRadius * smDetailAdjust; if ( pixelSize < smSmallestVisiblePixelSize ) { From 3c9747163055e7a709e37c69984bab5e5c6ead0f Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 17:27:24 -0500 Subject: [PATCH 032/144] substitution statements conformed to standard class:mVar standard --- Engine/source/console/simDatablock.cpp | 46 +++++++++++++------------- Engine/source/console/simDatablock.h | 6 ++-- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/Engine/source/console/simDatablock.cpp b/Engine/source/console/simDatablock.cpp index ce689c054..85d2ee8f8 100644 --- a/Engine/source/console/simDatablock.cpp +++ b/Engine/source/console/simDatablock.cpp @@ -62,20 +62,20 @@ SimDataBlock::SimDataBlock() SimDataBlock::SubstitutionStatement::SubstitutionStatement(StringTableEntry slot, S32 idx, const char* value) { - this->slot = slot; - this->idx = idx; - this->value = dStrdup(value); + this->mSlot = slot; + this->mIdx = idx; + this->mValue = dStrdup(value); } SimDataBlock::SubstitutionStatement::~SubstitutionStatement() { - dFree(value); + dFree(mValue); } void SimDataBlock::SubstitutionStatement::replaceValue(const char* value) { - dFree(this->value); - this->value = dStrdup(value); + dFree(this->mValue); + this->mValue = dStrdup(value); } // this is the copy-constructor for creating temp-clones. @@ -109,7 +109,7 @@ void SimDataBlock::addSubstitution(StringTableEntry slot, S32 idx, const char* s for (S32 i = 0; i < substitutions.size(); i++) { - if (substitutions[i] && substitutions[i]->slot == slot && substitutions[i]->idx == idx) + if (substitutions[i] && substitutions[i]->mSlot == slot && substitutions[i]->mIdx == idx) { if (empty_subs) { @@ -137,8 +137,8 @@ const char* SimDataBlock::getSubstitution(StringTableEntry slot, S32 idx) { for (S32 i = 0; i < substitutions.size(); i++) { - if (substitutions[i] && substitutions[i]->slot == slot && substitutions[i]->idx == idx) - return substitutions[i]->value; + if (substitutions[i] && substitutions[i]->mSlot == slot && substitutions[i]->mIdx == idx) + return substitutions[i]->mValue; } return 0; @@ -147,7 +147,7 @@ const char* SimDataBlock::getSubstitution(StringTableEntry slot, S32 idx) bool SimDataBlock::fieldHasSubstitution(StringTableEntry slot) { for (S32 i = 0; i < substitutions.size(); i++) - if (substitutions[i] && substitutions[i]->slot == slot) + if (substitutions[i] && substitutions[i]->mSlot == slot) return true; return false; } @@ -156,7 +156,7 @@ void SimDataBlock::printSubstitutions() { for (S32 i = 0; i < substitutions.size(); i++) if (substitutions[i]) - Con::errorf("SubstitutionStatement[%s] = \"%s\" -- %d", substitutions[i]->slot, substitutions[i]->value, i); + Con::errorf("SubstitutionStatement[%s] = \"%s\" -- %d", substitutions[i]->mSlot, substitutions[i]->mValue, i); } void SimDataBlock::copySubstitutionsFrom(SimDataBlock* other) @@ -170,7 +170,7 @@ void SimDataBlock::copySubstitutionsFrom(SimDataBlock* other) if (other->substitutions[i]) { SubstitutionStatement* subs = other->substitutions[i]; - substitutions.push_back(new SubstitutionStatement(subs->slot, subs->idx, subs->value)); + substitutions.push_back(new SubstitutionStatement(subs->mSlot, subs->mIdx, subs->mValue)); } } } @@ -212,7 +212,7 @@ void SimDataBlock::performSubstitutions(SimDataBlock* dblock, const SimObject* o char* b = buffer; // perform special token expansion (%% and ##) - const char* v = substitutions[i]->value; + const char* v = substitutions[i]->mValue; while (*v != '\0') { // identify "%%" tokens and replace with id @@ -258,7 +258,7 @@ void SimDataBlock::performSubstitutions(SimDataBlock* dblock, const SimObject* o if (Compiler::gSyntaxError) { Con::errorf("Field Substitution Failed: field=\"%s\" substitution=\"%s\" -- syntax error", - substitutions[i]->slot, substitutions[i]->value); + substitutions[i]->mSlot, substitutions[i]->mValue); Compiler::gSyntaxError = false; return; } @@ -267,7 +267,7 @@ void SimDataBlock::performSubstitutions(SimDataBlock* dblock, const SimObject* o if (result == 0 || result[0] == '\0') { Con::errorf("Field Substitution Failed: field=\"%s\" substitution=\"%s\" -- empty result", - substitutions[i]->slot, substitutions[i]->value); + substitutions[i]->mSlot, substitutions[i]->mValue); return; } @@ -282,29 +282,29 @@ void SimDataBlock::performSubstitutions(SimDataBlock* dblock, const SimObject* o result = ""; } - const AbstractClassRep::Field* field = dblock->getClassRep()->findField(substitutions[i]->slot); + const AbstractClassRep::Field* field = dblock->getClassRep()->findField(substitutions[i]->mSlot); if (!field) { // this should be very unlikely... - Con::errorf("Field Substitution Failed: unknown field, \"%s\".", substitutions[i]->slot); + Con::errorf("Field Substitution Failed: unknown field, \"%s\".", substitutions[i]->mSlot); continue; } if (field->keepClearSubsOnly && result[0] != '\0') { Con::errorf("Field Substitution Failed: field \"%s\" of datablock %s only allows \"$$ ~~\" (keep) and \"$$ ~0\" (clear) field substitutions. [%s]", - substitutions[i]->slot, this->getClassName(), this->getName()); + substitutions[i]->mSlot, this->getClassName(), this->getName()); continue; } // substitute the field value with its replacement - Con::setData(field->type, (void*)(((const char*)(dblock)) + field->offset), substitutions[i]->idx, 1, &result, field->table, field->flag); + Con::setData(field->type, (void*)(((const char*)(dblock)) + field->offset), substitutions[i]->mIdx, 1, &result, field->table, field->flag); //dStrncpy(buffer, result, 255); //Con::errorf("SUBSTITUTION %s.%s[%d] = %s idx=%s", Con::getIntArg(getId()), substitutions[i]->slot, substitutions[i]->idx, buffer, index_str); // notify subclasses of a field modification - dblock->onStaticModified(substitutions[i]->slot); + dblock->onStaticModified(substitutions[i]->mSlot); } } @@ -366,9 +366,9 @@ void SimDataBlock::packData(BitStream* stream) if (substitutions[i]) { stream->writeFlag(true); - stream->writeString(substitutions[i]->slot); - stream->write(substitutions[i]->idx); - stream->writeString(substitutions[i]->value); + stream->writeString(substitutions[i]->mSlot); + stream->write(substitutions[i]->mIdx); + stream->writeString(substitutions[i]->mValue); } } stream->writeFlag(false); diff --git a/Engine/source/console/simDatablock.h b/Engine/source/console/simDatablock.h index d6a7dcd52..21856bb46 100644 --- a/Engine/source/console/simDatablock.h +++ b/Engine/source/console/simDatablock.h @@ -179,9 +179,9 @@ public: protected: struct SubstitutionStatement { - StringTableEntry slot; - S32 idx; - char* value; + StringTableEntry mSlot; + S32 mIdx; + char* mValue; SubstitutionStatement(StringTableEntry slot, S32 idx, const char* value); ~SubstitutionStatement(); void replaceValue(const char* value); From 9dd9d2f9b78c320667e9727c47be13a983bcdc79 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 17:29:03 -0500 Subject: [PATCH 033/144] scenecontainer cleanup --- Engine/source/scene/sceneContainer.cpp | 34 +++++++++++++------------- Engine/source/scene/sceneContainer.h | 4 +-- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Engine/source/scene/sceneContainer.cpp b/Engine/source/scene/sceneContainer.cpp index 6f6202414..66722a079 100644 --- a/Engine/source/scene/sceneContainer.cpp +++ b/Engine/source/scene/sceneContainer.cpp @@ -60,26 +60,26 @@ static Box3F sBoundingBox; SceneContainer::Link::Link() { - next = prev = this; + mNext = mPrev = this; } //----------------------------------------------------------------------------- void SceneContainer::Link::unlink() { - next->prev = prev; - prev->next = next; - next = prev = this; + mNext->mPrev = mPrev; + mPrev->mNext = mNext; + mNext = mPrev = this; } //----------------------------------------------------------------------------- void SceneContainer::Link::linkAfter(SceneContainer::Link* ptr) { - next = ptr->next; - next->prev = this; - prev = ptr; - prev->next = this; + mNext = ptr->mNext; + mNext->mPrev = this; + mPrev = ptr; + mPrev->mNext = this; } //============================================================================= @@ -93,8 +93,8 @@ SceneContainer::SceneContainer() mSearchInProgress = false; mCurrSeqKey = 0; - mEnd.next = mEnd.prev = &mStart; - mStart.next = mStart.prev = &mEnd; + mEnd.mNext = mEnd.mPrev = &mStart; + mStart.mNext = mStart.mPrev = &mEnd; mBinArray = new SceneObjectRef[csmNumBins * csmNumBins]; for (U32 i = 0; i < csmNumBins; i++) @@ -760,7 +760,7 @@ void SceneContainer::findObjectList( const Frustum &frustum, U32 mask, Vector *outFound ) { - for ( Link* itr = mStart.next; itr != &mEnd; itr = itr->next ) + for ( Link* itr = mStart.mNext; itr != &mEnd; itr = itr->mNext) { SceneObject* ptr = static_cast( itr ); if ( ( ptr->getTypeMask() & mask ) != 0 ) @@ -772,7 +772,7 @@ void SceneContainer::findObjectList( U32 mask, Vector *outFound ) void SceneContainer::findObjects( U32 mask, FindCallback callback, void *key ) { - for (Link* itr = mStart.next; itr != &mEnd; itr = itr->next) { + for (Link* itr = mStart.mNext; itr != &mEnd; itr = itr->mNext) { SceneObject* ptr = static_cast(itr); if ((ptr->getTypeMask() & mask) != 0 && !ptr->mCollisionCount) (*callback)(ptr,key); @@ -859,10 +859,10 @@ bool SceneContainer::_castRay( U32 type, const Point3F& start, const Point3F& en F32 currentT = 2.0; mCurrSeqKey++; - SceneObjectRef* chain = mOverflowBin.nextInBin; - while (chain) + SceneObjectRef* overflowChain = mOverflowBin.nextInBin; + while (overflowChain) { - SceneObject* ptr = chain->object; + SceneObject* ptr = overflowChain->object; if (ptr->getContainerSeqKey() != mCurrSeqKey) { ptr->setContainerSeqKey(mCurrSeqKey); @@ -897,7 +897,7 @@ bool SceneContainer::_castRay( U32 type, const Point3F& start, const Point3F& en } } } - chain = chain->nextInBin; + overflowChain = overflowChain->nextInBin; } // These are just for rasterizing the line against the grid. We want the x coord @@ -1138,7 +1138,7 @@ bool SceneContainer::collideBox(const Point3F &start, const Point3F &end, U32 ma AssertFatal( info->userData == NULL, "SceneContainer::collideBox - RayInfo->userData cannot be used here!" ); F32 currentT = 2; - for (Link* itr = mStart.next; itr != &mEnd; itr = itr->next) + for (Link* itr = mStart.mNext; itr != &mEnd; itr = itr->mNext) { SceneObject* ptr = static_cast(itr); if (ptr->getTypeMask() & mask && !ptr->mCollisionCount) diff --git a/Engine/source/scene/sceneContainer.h b/Engine/source/scene/sceneContainer.h index a98548964..2437eb396 100644 --- a/Engine/source/scene/sceneContainer.h +++ b/Engine/source/scene/sceneContainer.h @@ -151,8 +151,8 @@ class SceneContainer struct Link { - Link* next; - Link* prev; + Link* mNext; + Link* mPrev; Link(); void unlink(); void linkAfter(Link* ptr); From f36826605fb20ea60331d18674e7e7c3257a2de8 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 17:30:33 -0500 Subject: [PATCH 034/144] simobject, dictionary, stringtable, and taml clarificationsand cleanups --- Engine/source/console/simFieldDictionary.cpp | 24 ++++++++++---------- Engine/source/console/simObject.cpp | 6 ++--- Engine/source/core/stringTable.cpp | 2 +- Engine/source/persistence/taml/taml.cpp | 8 +++---- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Engine/source/console/simFieldDictionary.cpp b/Engine/source/console/simFieldDictionary.cpp index f68a8689b..2c9f474ae 100644 --- a/Engine/source/console/simFieldDictionary.cpp +++ b/Engine/source/console/simFieldDictionary.cpp @@ -245,17 +245,17 @@ void SimFieldDictionary::writeFields(SimObject *obj, Stream &stream, U32 tabStop const AbstractClassRep::FieldList &list = obj->getFieldList(); Vector flist(__FILE__, __LINE__); - for (U32 i = 0; i < HashTableSize; i++) + for (U32 curEntry = 0; curEntry < HashTableSize; curEntry++) { - for (Entry *walk = mHashTable[i]; walk; walk = walk->next) + for (Entry *walk = mHashTable[curEntry]; walk; walk = walk->next) { // make sure we haven't written this out yet: - U32 i; - for (i = 0; i < list.size(); i++) - if (list[i].pFieldname == walk->slotName) + U32 curField; + for (curField = 0; curField < list.size(); curField++) + if (list[curField].pFieldname == walk->slotName) break; - if (i != list.size()) + if (curField != list.size()) continue; @@ -293,17 +293,17 @@ void SimFieldDictionary::printFields(SimObject *obj) char expandedBuffer[4096]; Vector flist(__FILE__, __LINE__); - for (U32 i = 0; i < HashTableSize; i++) + for (U32 curEntry = 0; curEntry < HashTableSize; curEntry++) { - for (Entry *walk = mHashTable[i]; walk; walk = walk->next) + for (Entry *walk = mHashTable[curEntry]; walk; walk = walk->next) { // make sure we haven't written this out yet: - U32 i; - for (i = 0; i < list.size(); i++) - if (list[i].pFieldname == walk->slotName) + U32 curField; + for (curField = 0; curField < list.size(); curField++) + if (list[curField].pFieldname == walk->slotName) break; - if (i != list.size()) + if (curField != list.size()) continue; flist.push_back(walk); diff --git a/Engine/source/console/simObject.cpp b/Engine/source/console/simObject.cpp index c4b6848c9..c3044df0e 100644 --- a/Engine/source/console/simObject.cpp +++ b/Engine/source/console/simObject.cpp @@ -529,17 +529,17 @@ void SimObject::onTamlCustomRead(TamlCustomNodes const& customNodes) for (TamlCustomFieldVector::const_iterator fieldItr = fields.begin(); fieldItr != fields.end(); ++fieldItr) { // Fetch field. - const TamlCustomField* pField = *fieldItr; + const TamlCustomField* cField = *fieldItr; // Fetch field name. - StringTableEntry fieldName = pField->getFieldName(); + StringTableEntry fieldName = cField->getFieldName(); const AbstractClassRep::Field* field = findField(fieldName); // Check common fields. if (field) { - setDataField(fieldName, buf, pField->getFieldValue()); + setDataField(fieldName, buf, cField->getFieldValue()); } else { diff --git a/Engine/source/core/stringTable.cpp b/Engine/source/core/stringTable.cpp index 9a71603ae..cbdfaec40 100644 --- a/Engine/source/core/stringTable.cpp +++ b/Engine/source/core/stringTable.cpp @@ -232,7 +232,7 @@ void _StringTable::resize(const U32 _newSize) walk = head; while(walk) { U32 key; - Node *temp = walk; + temp = walk; walk = walk->next; key = hashString(temp->val); diff --git a/Engine/source/persistence/taml/taml.cpp b/Engine/source/persistence/taml/taml.cpp index f364ed0ce..b9144e8ed 100644 --- a/Engine/source/persistence/taml/taml.cpp +++ b/Engine/source/persistence/taml/taml.cpp @@ -1241,8 +1241,8 @@ ImplementEnumType(_TamlFormatMode, // ************************************************************* // Generate the engine type elements. - TiXmlComment* pComment = new TiXmlComment("Type Elements"); - pSchemaElement->LinkEndChild(pComment); + TiXmlComment* tComment = new TiXmlComment("Type Elements"); + pSchemaElement->LinkEndChild(tComment); for (AbstractClassRep* pType = pRootType; pType != NULL; pType = pType->getNextClass()) { // Add type. @@ -1260,8 +1260,8 @@ ImplementEnumType(_TamlFormatMode, { // Add complex type comment. dSprintf(buffer, sizeof(buffer), " %s Type ", pType->getClassName()); - TiXmlComment* pComment = new TiXmlComment(buffer); - pSchemaElement->LinkEndChild(pComment); + TiXmlComment* ctComment = new TiXmlComment(buffer); + pSchemaElement->LinkEndChild(ctComment); // Add complex type. TiXmlElement* pComplexTypeElement = new TiXmlElement("xs:complexType"); From 2e2e08f32db040c3b3957b7c899aeec8555af5b0 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 17:33:13 -0500 Subject: [PATCH 035/144] terrain file I/O and opengl rendering cleanup --- Engine/source/terrain/glsl/terrFeatureGLSL.cpp | 3 --- Engine/source/terrain/terrFile.cpp | 6 +++--- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp index 4492ca01b..2acd40871 100644 --- a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp +++ b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp @@ -569,9 +569,6 @@ void TerrainDetailMapFeatGLSL::processPix( Vector &component // amount so that it fades out with the layer blending. if ( fd.features.hasFeature( MFT_TerrainParallaxMap, detailIndex ) ) { - // Get the rest of our inputs. - Var *normalMap = _getNormalMapTex(); - // Call the library function to do the rest. if (fd.features.hasFeature(MFT_IsBC3nm, detailIndex)) { diff --git a/Engine/source/terrain/terrFile.cpp b/Engine/source/terrain/terrFile.cpp index 3a639d0b0..1ae32dc73 100644 --- a/Engine/source/terrain/terrFile.cpp +++ b/Engine/source/terrain/terrFile.cpp @@ -110,11 +110,11 @@ void TerrainFile::_buildGridMap() mGridMap.compact(); // Assign memory from the pool to each grid level. - TerrainSquare *sq = mGridMapPool.address(); + TerrainSquare *grid = mGridMapPool.address(); for ( S32 i = mGridLevels; i >= 0; i-- ) { - mGridMap[i] = sq; - sq += 1 << ( 2 * ( mGridLevels - i ) ); + mGridMap[i] = grid; + grid += 1 << ( 2 * ( mGridLevels - i ) ); } for( S32 i = mGridLevels; i >= 0; i-- ) From 190a647254a12a6ef1c474dd0819ecf0ac27bcc1 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 17:54:35 -0500 Subject: [PATCH 036/144] animation clarification --- Engine/source/ts/tsAnimate.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Engine/source/ts/tsAnimate.cpp b/Engine/source/ts/tsAnimate.cpp index 135f8a4b9..ef88d1eb8 100644 --- a/Engine/source/ts/tsAnimate.cpp +++ b/Engine/source/ts/tsAnimate.cpp @@ -212,11 +212,11 @@ void TSShapeInstance::animateNodes(S32 ss) for (i=0; i=start && nodeIndex=start && nodeIdxsetNodeTransform(this, nodeIndex, smNodeLocalTransforms[nodeIndex]); - smNodeLocalTransformDirty.set(nodeIndex); + mNodeCallbacks[i].callback->setNodeTransform(this, nodeIdx, smNodeLocalTransforms[nodeIdx]); + smNodeLocalTransformDirty.set(nodeIdx); } } From 6cbab6d117135a8c1cc813d7bdecbb0921cfbb37 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 18:03:10 -0500 Subject: [PATCH 037/144] serverquery cleanup --- Engine/source/app/net/serverQuery.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/app/net/serverQuery.cpp b/Engine/source/app/net/serverQuery.cpp index 4c91caf70..1b1f5f0e0 100644 --- a/Engine/source/app/net/serverQuery.cpp +++ b/Engine/source/app/net/serverQuery.cpp @@ -1297,7 +1297,7 @@ static void processPingsAndQueries( U32 session, bool schedule ) if ( !gPingList.size() && !waitingForMaster ) { // Start the query phase: - for ( U32 i = 0; i < gQueryList.size() && i < gMaxConcurrentQueries; ) + for ( i = 0; i < gQueryList.size() && i < gMaxConcurrentQueries; ) { Ping &p = gQueryList[i]; if ( p.time + gPingTimeout < time ) From 407e3d95b2ff2c4cf6ebca39f72a25b6771ee1e3 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 18:05:30 -0500 Subject: [PATCH 038/144] SFXMemoryStream::read clarification. --- Engine/source/sfx/sfxMemoryStream.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Engine/source/sfx/sfxMemoryStream.cpp b/Engine/source/sfx/sfxMemoryStream.cpp index d7e04785f..6dcdbc60c 100644 --- a/Engine/source/sfx/sfxMemoryStream.cpp +++ b/Engine/source/sfx/sfxMemoryStream.cpp @@ -80,13 +80,13 @@ U32 SFXMemoryStream::read( U8* buffer, U32 length ) if( numBytesLeftInCurrentPacket ) { - const U32 numBytesToCopy = getMin( numBytesLeftInCurrentPacket, numBytesLeftToCopy ); - dMemcpy( &buffer[ bufferOffset ], &mCurrentPacket->data[ mCurrentPacketOffset ], numBytesToCopy ); + const U32 remainingNumBytesToCopy = getMin( numBytesLeftInCurrentPacket, numBytesLeftToCopy ); + dMemcpy( &buffer[ bufferOffset ], &mCurrentPacket->data[ mCurrentPacketOffset ], remainingNumBytesToCopy); - bufferOffset += numBytesToCopy; - mCurrentPacketOffset += numBytesToCopy; - numBytesLeftInCurrentPacket -= numBytesToCopy; - numBytesLeftToCopy -= numBytesToCopy; + bufferOffset += remainingNumBytesToCopy; + mCurrentPacketOffset += remainingNumBytesToCopy; + numBytesLeftInCurrentPacket -= remainingNumBytesToCopy; + numBytesLeftToCopy -= remainingNumBytesToCopy; } // Discard the packet if there's no data left. From 02541ab1f9dafb3b216ab3f1bce68131051a3d82 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 18:07:58 -0500 Subject: [PATCH 039/144] shader hooks and gen cleanups --- Engine/source/materials/shaderData.cpp | 10 +++++----- Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp | 6 +++--- Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp | 5 ++--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Engine/source/materials/shaderData.cpp b/Engine/source/materials/shaderData.cpp index 3a80c0ac5..d8f4befaf 100644 --- a/Engine/source/materials/shaderData.cpp +++ b/Engine/source/materials/shaderData.cpp @@ -363,17 +363,17 @@ bool ShaderData::_checkDefinition(GFXShader *shader) { if( !shader->findShaderConstHandle( String::ToString("$rtParams%d", pos)) ) { - String error = String::ToString("ShaderData(%s) sampler[%d] used but rtParams%d not used in shader compilation. Possible error", shader->getPixelShaderFile().c_str(), pos, pos); - Con::errorf( error ); + String errStr = String::ToString("ShaderData(%s) sampler[%d] used but rtParams%d not used in shader compilation. Possible error", shader->getPixelShaderFile().c_str(), pos, pos); + Con::errorf(errStr); error = true; } } if(!find) { - String error = String::ToString("ShaderData(%s) sampler %s not defined", shader->getPixelShaderFile().c_str(), samplers[i].c_str()); - Con::errorf(error ); - GFXAssertFatal(0, error ); + String errStr = String::ToString("ShaderData(%s) sampler %s not defined", shader->getPixelShaderFile().c_str(), samplers[i].c_str()); + Con::errorf(errStr); + GFXAssertFatal(0, errStr); error = true; } } diff --git a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp index 5a6f5abd2..ab9bdb25b 100644 --- a/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp +++ b/Engine/source/shaderGen/GLSL/shaderFeatureGLSL.cpp @@ -1105,7 +1105,7 @@ void DiffuseFeatureGLSL::processPix( Vector &componentList, targ = ShaderFeature::RenderTarget1; col = (Var*)LangElement::find("col1"); - MultiLine * meta = new MultiLine; + meta = new MultiLine; if (!col) { // create color var @@ -1154,7 +1154,7 @@ void DiffuseVertColorFeatureGLSL::processVert( Vector< ShaderComponent* >& comp ShaderConnector* connectComp = dynamic_cast< ShaderConnector* >( componentList[ C_CONNECTOR ] ); AssertFatal( connectComp, "DiffuseVertColorFeatureGLSL::processVert - C_CONNECTOR is not a ShaderConnector" ); - Var* outColor = connectComp->getElement( RT_COLOR ); + outColor = connectComp->getElement( RT_COLOR ); outColor->setName( "vertColor" ); outColor->setStructName( "OUT" ); outColor->setType( "vec4" ); @@ -1455,7 +1455,7 @@ void VertLitGLSL::processVert( Vector &componentList, { // Grab the connector color ShaderConnector *connectComp = dynamic_cast( componentList[C_CONNECTOR] ); - Var *outColor = connectComp->getElement( RT_COLOR ); + outColor = connectComp->getElement( RT_COLOR ); outColor->setName( "vertColor" ); outColor->setStructName( "OUT" ); outColor->setType( "vec4" ); diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index c665d0044..6a3c296a8 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -1109,7 +1109,6 @@ void DiffuseFeatureHLSL::processPix( Vector &componentList, targ = ShaderFeature::RenderTarget1; col = (Var*)LangElement::find("col1"); - MultiLine * meta = new MultiLine; if (!col) { // create color var @@ -1158,7 +1157,7 @@ void DiffuseVertColorFeatureHLSL::processVert( Vector< ShaderComponent* >& comp ShaderConnector* connectComp = dynamic_cast< ShaderConnector* >( componentList[ C_CONNECTOR ] ); AssertFatal( connectComp, "DiffuseVertColorFeatureGLSL::processVert - C_CONNECTOR is not a ShaderConnector" ); - Var* outColor = connectComp->getElement( RT_COLOR ); + outColor = connectComp->getElement( RT_COLOR ); outColor->setName( "vertColor" ); outColor->setStructName( "OUT" ); outColor->setType( "float4" ); @@ -1487,7 +1486,7 @@ void VertLitHLSL::processVert( Vector &componentList, // Grab the connector color ShaderConnector *connectComp = dynamic_cast( componentList[C_CONNECTOR] ); - Var *outColor = connectComp->getElement( RT_COLOR ); + outColor = connectComp->getElement( RT_COLOR ); outColor->setName( "vertColor" ); outColor->setStructName( "OUT" ); outColor->setType( "float4" ); From 3d55bf614193190877669d4c77cc74aa252fda0b Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 19:27:47 -0500 Subject: [PATCH 040/144] clean up unnecessary global char buffer[100] define --- Engine/source/afx/afxCamera.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Engine/source/afx/afxCamera.cpp b/Engine/source/afx/afxCamera.cpp index 63ad635ac..d6fb5f21b 100644 --- a/Engine/source/afx/afxCamera.cpp +++ b/Engine/source/afx/afxCamera.cpp @@ -450,8 +450,6 @@ const char* afxCamera::getMode() //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// // Console Methods -static char buffer[100]; - ConsoleMethod(afxCamera, setOrbitMode, void, 7, 8, "(GameBase orbitObject, TransformF mat, float minDistance, float maxDistance, float curDistance, bool ownClientObject)" "Set the camera to orbit around some given object.\n\n" @@ -493,6 +491,7 @@ ConsoleMethod( afxCamera, getPosition, const char *, 2, 2, "()" "@returns A string of form \"x y z\".") { Point3F& pos = object->getPosition(); + char buffer[100]; dSprintf(buffer, sizeof(buffer),"%f %f %f",pos.x,pos.y,pos.z); return buffer; } @@ -558,6 +557,7 @@ ConsoleMethod(afxCamera, setThirdPersonOffset, void, 3, 4, "(Point3F offset [, P ConsoleMethod(afxCamera, getThirdPersonOffset, const char *, 2, 2, "()") { const Point3F& pos = object->getThirdPersonOffset(); + char buffer[100]; dSprintf(buffer, sizeof(buffer),"%f %f %f",pos.x,pos.y,pos.z); return buffer; } @@ -565,6 +565,7 @@ ConsoleMethod(afxCamera, getThirdPersonOffset, const char *, 2, 2, "()") ConsoleMethod(afxCamera, getThirdPersonCOIOffset, const char *, 2, 2, "()") { const Point3F& pos = object->getThirdPersonCOIOffset(); + char buffer[100]; dSprintf(buffer, sizeof(buffer),"%f %f %f",pos.x,pos.y,pos.z); return buffer; } From 6e0c24023fc0aec23f904f129a1a5241c9e30a62 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 19:29:08 -0500 Subject: [PATCH 041/144] MountedImage& image = mMountedImageList[i]; clarification cases --- Engine/source/T3D/shapeBase.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 923714a5d..71f826aa4 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -3315,23 +3315,23 @@ void ShapeBase::unpackUpdate(NetConnection *con, BitStream *stream) bool datablockChange = image.dataBlock != imageData; if (datablockChange || (image.skinNameHandle != skinDesiredNameHandle)) { - MountedImage& image = mMountedImageList[i]; - image.scriptAnimPrefix = scriptDesiredAnimPrefix; + MountedImage& neoImage = mMountedImageList[i]; + neoImage.scriptAnimPrefix = scriptDesiredAnimPrefix; setImage( i, imageData, - skinDesiredNameHandle, image.loaded, - image.ammo, image.triggerDown, image.altTriggerDown, - image.motion, image.genericTrigger[0], image.genericTrigger[1], image.genericTrigger[2], image.genericTrigger[3], - image.target); + skinDesiredNameHandle, neoImage.loaded, + neoImage.ammo, neoImage.triggerDown, neoImage.altTriggerDown, + neoImage.motion, neoImage.genericTrigger[0], neoImage.genericTrigger[1], neoImage.genericTrigger[2], neoImage.genericTrigger[3], + neoImage.target); } if (!datablockChange && image.scriptAnimPrefix != scriptDesiredAnimPrefix) { // We don't have a new image, but we do have a new script anim prefix to work with. // Notify the image of this change. - MountedImage& image = mMountedImageList[i]; - image.scriptAnimPrefix = scriptDesiredAnimPrefix; - updateAnimThread(i, getImageShapeIndex(image)); + MountedImage& animImage = mMountedImageList[i]; + animImage.scriptAnimPrefix = scriptDesiredAnimPrefix; + updateAnimThread(i, getImageShapeIndex(animImage)); } bool isFiring = stream->readFlag(); @@ -3586,8 +3586,8 @@ void ShapeBaseConvex::getFeatures(const MatrixF& mat, const VectorF& n, ConvexFe U32 numVerts = emitString[currPos++]; for (i = 0; i < numVerts; i++) { cf->mVertexList.increment(); - U32 index = emitString[currPos++]; - mat.mulP(pAccel->vertexList[index], &cf->mVertexList.last()); + U32 vListIDx = emitString[currPos++]; + mat.mulP(pAccel->vertexList[vListIDx], &cf->mVertexList.last()); } U32 numEdges = emitString[currPos++]; From 96169bc151673b98902ca3e6f9b477996996fa1a Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 21:24:37 -0500 Subject: [PATCH 042/144] ribbon classvar cleanup --- Engine/source/T3D/fx/ribbon.cpp | 6 +++--- Engine/source/T3D/fx/ribbon.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Engine/source/T3D/fx/ribbon.cpp b/Engine/source/T3D/fx/ribbon.cpp index 9dddd8131..a3d788590 100644 --- a/Engine/source/T3D/fx/ribbon.cpp +++ b/Engine/source/T3D/fx/ribbon.cpp @@ -508,10 +508,10 @@ void Ribbon::prepRenderImage(SceneRenderState *state) // Set up our vertex buffer and primitive buffer if(mUpdateBuffers) - createBuffers(state, verts, primBuffer, segments); + createBuffers(state, mVerts, mPrimBuffer, segments); - ri->vertBuff = &verts; - ri->primBuff = &primBuffer; + ri->vertBuff = &mVerts; + ri->primBuff = &mPrimBuffer; ri->visibility = 1.0f; ri->prim = renderPass->allocPrim(); diff --git a/Engine/source/T3D/fx/ribbon.h b/Engine/source/T3D/fx/ribbon.h index 36faf03c1..954dd3cf0 100644 --- a/Engine/source/T3D/fx/ribbon.h +++ b/Engine/source/T3D/fx/ribbon.h @@ -99,8 +99,8 @@ class Ribbon : public GameBase BaseMatInstance *mRibbonMat; MaterialParameterHandle* mRadiusSC; MaterialParameterHandle* mRibbonProjSC; - GFXPrimitiveBufferHandle primBuffer; - GFXVertexBufferHandle verts; + GFXPrimitiveBufferHandle mPrimBuffer; + GFXVertexBufferHandle mVerts; protected: From aad3578d1c7ac4329cd899683494400145bea9df Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 21:25:02 -0500 Subject: [PATCH 043/144] sfx shadowvar cleanup --- Engine/source/sfx/sfxDevice.cpp | 4 ++-- Engine/source/sfx/sfxSoundscape.cpp | 12 ++++++------ Engine/source/sfx/sfxSystem.cpp | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Engine/source/sfx/sfxDevice.cpp b/Engine/source/sfx/sfxDevice.cpp index 3bb37f68f..4e9576774 100644 --- a/Engine/source/sfx/sfxDevice.cpp +++ b/Engine/source/sfx/sfxDevice.cpp @@ -168,9 +168,9 @@ void SFXDevice::_removeBuffer( SFXBuffer* buffer ) BufferIterator iter = find( mBuffers.begin(), mBuffers.end(), buffer ); if( iter != mBuffers.end() ) { - SFXBuffer* buffer = *iter; + SFXBuffer* curBuf = *iter; - mStatNumBufferBytes -= buffer->getMemoryUsed(); + mStatNumBufferBytes -= curBuf->getMemoryUsed(); mStatNumBuffers --; mBuffers.erase( iter ); diff --git a/Engine/source/sfx/sfxSoundscape.cpp b/Engine/source/sfx/sfxSoundscape.cpp index afd41f842..855ebd2be 100644 --- a/Engine/source/sfx/sfxSoundscape.cpp +++ b/Engine/source/sfx/sfxSoundscape.cpp @@ -174,18 +174,18 @@ void SFXSoundscapeManager::update() // Activate SFXStates on the ambience. For state slots that // have changed, deactivate states that we have already activated. - for( U32 i = 0; i < SFXAmbience::MaxStates; ++ i ) + for( U32 ambState = 0; ambState < SFXAmbience::MaxStates; ++ambState) { - SFXState* state = ambience->getState( i ); - if( soundscape->mStates[ i ] != state ) + SFXState* state = ambience->getState(ambState); + if( soundscape->mStates[ambState] != state ) { - if( soundscape->mStates[ i ] ) - soundscape->mStates[ i ]->deactivate(); + if( soundscape->mStates[ambState] ) + soundscape->mStates[ambState]->deactivate(); if( state ) state->activate(); - soundscape->mStates[ i ] = state; + soundscape->mStates[ambState] = state; } } diff --git a/Engine/source/sfx/sfxSystem.cpp b/Engine/source/sfx/sfxSystem.cpp index 0ad80df6e..28cfde3e9 100644 --- a/Engine/source/sfx/sfxSystem.cpp +++ b/Engine/source/sfx/sfxSystem.cpp @@ -674,9 +674,9 @@ void SFXSystem::_onRemoveSource( SFXSource* source ) { // Check if it was a play once source. - Vector< SFXSource* >::iterator iter = find( mPlayOnceSources.begin(), mPlayOnceSources.end(), source ); - if ( iter != mPlayOnceSources.end() ) - mPlayOnceSources.erase_fast( iter ); + Vector< SFXSource* >::iterator sourceIter = find( mPlayOnceSources.begin(), mPlayOnceSources.end(), source ); + if (sourceIter != mPlayOnceSources.end() ) + mPlayOnceSources.erase_fast(sourceIter); // Update the stats. @@ -684,9 +684,9 @@ void SFXSystem::_onRemoveSource( SFXSource* source ) if( dynamic_cast< SFXSound* >( source ) ) { - SFXSoundVector::iterator iter = find( mSounds.begin(), mSounds.end(), static_cast< SFXSound* >( source ) ); - if( iter != mSounds.end() ) - mSounds.erase_fast( iter ); + SFXSoundVector::iterator vectorIter = find( mSounds.begin(), mSounds.end(), static_cast< SFXSound* >( source ) ); + if(vectorIter != mSounds.end() ) + mSounds.erase_fast(vectorIter); mStatNumSounds = mSounds.size(); } From 33ebe3444090714901ba8159280e07ac670361bb Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 21:25:45 -0500 Subject: [PATCH 044/144] more gfx shadowvar cleanups --- .../advanced/glsl/advancedLightingFeaturesGLSL.cpp | 2 +- .../advanced/hlsl/advancedLightingFeaturesHLSL.cpp | 4 ++-- .../source/lighting/shadowMap/pssmLightShadowMap.cpp | 2 +- Engine/source/materials/processedShaderMaterial.cpp | 10 +++++----- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp b/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp index f1223f7b0..9ac194cff 100644 --- a/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp +++ b/Engine/source/lighting/advanced/glsl/advancedLightingFeaturesGLSL.cpp @@ -350,7 +350,7 @@ void DeferredBumpFeatGLSL::processPix( Vector &componentList, if (fd.features.hasFeature(MFT_DetailNormalMap)) { - Var *bumpMap = (Var*)LangElement::find("detailBumpMap"); + bumpMap = (Var*)LangElement::find("detailBumpMap"); if (!bumpMap) { bumpMap = new Var; bumpMap->setType("sampler2D"); diff --git a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp index 7255ea564..7e3564350 100644 --- a/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp +++ b/Engine/source/lighting/advanced/hlsl/advancedLightingFeaturesHLSL.cpp @@ -367,7 +367,7 @@ void DeferredBumpFeatHLSL::processPix( Vector &componentList, if ( fd.features.hasFeature( MFT_DetailNormalMap ) ) { - Var *bumpMap = (Var*)LangElement::find( "detailBumpMap" ); + bumpMap = (Var*)LangElement::find( "detailBumpMap" ); if ( !bumpMap ) { bumpMap = new Var; @@ -378,7 +378,7 @@ void DeferredBumpFeatHLSL::processPix( Vector &componentList, bumpMap->constNum = Var::getTexUnitNum(); } - Var* bumpMapTex = (Var*)LangElement::find("detailBumpMap"); + bumpMapTex = (Var*)LangElement::find("detailBumpMap"); if (!bumpMapTex) { bumpMap->setType("SamplerState"); diff --git a/Engine/source/lighting/shadowMap/pssmLightShadowMap.cpp b/Engine/source/lighting/shadowMap/pssmLightShadowMap.cpp index d276fe3a5..c9ac7e2e3 100644 --- a/Engine/source/lighting/shadowMap/pssmLightShadowMap.cpp +++ b/Engine/source/lighting/shadowMap/pssmLightShadowMap.cpp @@ -254,7 +254,7 @@ void PSSMLightShadowMap::_render( RenderPassManager* renderPass, for (U32 i = 0; i < mNumSplits; i++) { - GFXTransformSaver saver; + GFXTransformSaver splitSaver; // Calculate a sub-frustum Frustum subFrustum(fullFrustum); diff --git a/Engine/source/materials/processedShaderMaterial.cpp b/Engine/source/materials/processedShaderMaterial.cpp index 4fb2acc94..e433a354c 100644 --- a/Engine/source/materials/processedShaderMaterial.cpp +++ b/Engine/source/materials/processedShaderMaterial.cpp @@ -531,9 +531,9 @@ bool ProcessedShaderMaterial::_createPasses( MaterialFeatureData &stageFeatures, ShaderRenderPassData passData; U32 texIndex = 0; - for( U32 i=0; i < FEATUREMGR->getFeatureCount(); i++ ) + for( U32 featureIDx=0; featureIDx < FEATUREMGR->getFeatureCount(); featureIDx++ ) { - const FeatureInfo &info = FEATUREMGR->getAt( i ); + const FeatureInfo &info = FEATUREMGR->getAt(featureIDx); if ( !stageFeatures.features.hasFeature( *info.type ) ) continue; @@ -562,7 +562,7 @@ bool ProcessedShaderMaterial::_createPasses( MaterialFeatureData &stageFeatures, #if defined(TORQUE_DEBUG) && defined( TORQUE_OPENGL) if(oldTexNumber != texIndex) { - for(int i = oldTexNumber; i < texIndex; i++) + for(int texNum = oldTexNumber; texNum < texIndex; texNum++) { AssertFatal(passData.mSamplerNames[ oldTexNumber ].isNotEmpty(), avar( "ERROR: ShaderGen feature %s don't set used sampler name", info.feature->getName().c_str()) ); } @@ -579,9 +579,9 @@ bool ProcessedShaderMaterial::_createPasses( MaterialFeatureData &stageFeatures, } #if defined(TORQUE_DEBUG) && defined( TORQUE_OPENGL) - for(int i = 0; i < texIndex; i++) + for(int samplerIDx = 0; samplerIDx < texIndex; samplerIDx++) { - AssertFatal(passData.mSamplerNames[ i ].isNotEmpty(),""); + AssertFatal(passData.mSamplerNames[samplerIDx].isNotEmpty(),""); } #endif From ebf3f2d97182f9e0eca114e9aa302a50e330fb58 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 21:26:27 -0500 Subject: [PATCH 045/144] reflector classvar cleanups --- Engine/source/scene/reflector.cpp | 34 +++++++++++++++---------------- Engine/source/scene/reflector.h | 8 ++++---- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Engine/source/scene/reflector.cpp b/Engine/source/scene/reflector.cpp index 5d9bdc3a8..ecaabc43a 100644 --- a/Engine/source/scene/reflector.cpp +++ b/Engine/source/scene/reflector.cpp @@ -315,20 +315,20 @@ void CubeReflector::updateReflection( const ReflectParams ¶ms ) const GFXFormat reflectFormat = REFLECTMGR->getReflectFormat(); if ( texResize || - cubemap.isNull() || - cubemap->getFormat() != reflectFormat ) + mCubemap.isNull() || + mCubemap->getFormat() != reflectFormat ) { - cubemap = GFX->createCubemap(); - cubemap->initDynamic( texDim, reflectFormat ); + mCubemap = GFX->createCubemap(); + mCubemap->initDynamic( texDim, reflectFormat ); } - GFXTexHandle depthBuff = LightShadowMap::_getDepthTarget( texDim, texDim ); + mDepthBuff = LightShadowMap::_getDepthTarget( texDim, texDim ); - if ( renderTarget.isNull() ) - renderTarget = GFX->allocRenderToTextureTarget(); + if ( mRenderTarget.isNull() ) + mRenderTarget = GFX->allocRenderToTextureTarget(); GFX->pushActiveRenderTarget(); - renderTarget->attachTexture( GFXTextureTarget::DepthStencil, depthBuff ); + mRenderTarget->attachTexture( GFXTextureTarget::DepthStencil, mDepthBuff ); F32 oldVisibleDist = gClientSceneGraph->getVisibleDistance(); @@ -407,8 +407,8 @@ void CubeReflector::updateFace( const ReflectParams ¶ms, U32 faceidx ) GFX->setWorldMatrix(matView); GFX->clearTextureStateImmediate(0); - renderTarget->attachTexture( GFXTextureTarget::Color0, cubemap, faceidx ); - GFX->setActiveRenderTarget( renderTarget ); + mRenderTarget->attachTexture( GFXTextureTarget::Color0, mCubemap, faceidx ); + GFX->setActiveRenderTarget(mRenderTarget); GFX->clear( GFXClearStencil | GFXClearTarget | GFXClearZBuffer, gCanvasClearColor, 1.0f, 0 ); SceneRenderState reflectRenderState @@ -427,7 +427,7 @@ void CubeReflector::updateFace( const ReflectParams ¶ms, U32 faceidx ) LIGHTMGR->unregisterAllLights(); // Clean up. - renderTarget->resolve(); + mRenderTarget->resolve(); } F32 CubeReflector::calcFaceScore( const ReflectParams ¶ms, U32 faceidx ) @@ -746,18 +746,18 @@ void PlaneReflector::setGFXMatrices( const MatrixF &camTrans ) MatrixF relCamTrans = invObjTrans * camTrans; MatrixF camReflectTrans = getCameraReflection( relCamTrans ); - MatrixF camTrans = mObject->getRenderTransform() * camReflectTrans; - camTrans.inverse(); + MatrixF objTrans = mObject->getRenderTransform() * camReflectTrans; + objTrans.inverse(); - GFX->setWorldMatrix( camTrans ); + GFX->setWorldMatrix(objTrans); // use relative reflect transform for modelview since clip plane is in object space - camTrans = camReflectTrans; - camTrans.inverse(); + objTrans = camReflectTrans; + objTrans.inverse(); // set new projection matrix gClientSceneGraph->setNonClipProjection( (MatrixF&) GFX->getProjectionMatrix() ); - MatrixF clipProj = getFrustumClipProj( camTrans ); + MatrixF clipProj = getFrustumClipProj(objTrans); GFX->setProjectionMatrix( clipProj ); } else diff --git a/Engine/source/scene/reflector.h b/Engine/source/scene/reflector.h index c0646d30d..fd0f3e08c 100644 --- a/Engine/source/scene/reflector.h +++ b/Engine/source/scene/reflector.h @@ -153,16 +153,16 @@ public: virtual void unregisterReflector(); virtual void updateReflection( const ReflectParams ¶ms ); - GFXCubemap* getCubemap() const { return cubemap; } + GFXCubemap* getCubemap() const { return mCubemap; } void updateFace( const ReflectParams ¶ms, U32 faceidx ); F32 calcFaceScore( const ReflectParams ¶ms, U32 faceidx ); protected: - GFXTexHandle depthBuff; - GFXTextureTargetRef renderTarget; - GFXCubemapHandle cubemap; + GFXTexHandle mDepthBuff; + GFXTextureTargetRef mRenderTarget; + GFXCubemapHandle mCubemap; U32 mLastTexSize; class CubeFaceReflector : public ReflectorBase From 386efa06025a27019ff3bf6eee6650934cceea7b Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 21:27:31 -0500 Subject: [PATCH 046/144] netObject classvar cleanups --- Engine/source/T3D/gameBase/gameBase.cpp | 14 +++++++------- Engine/source/afx/afxChoreographer.cpp | 4 ++-- Engine/source/sim/netObject.cpp | 22 +++++++++++----------- Engine/source/sim/netObject.h | 12 ++++++------ Engine/source/util/scopeTracker.h | 6 +++--- 5 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Engine/source/T3D/gameBase/gameBase.cpp b/Engine/source/T3D/gameBase/gameBase.cpp index 23b8a67bb..d6afda811 100644 --- a/Engine/source/T3D/gameBase/gameBase.cpp +++ b/Engine/source/T3D/gameBase/gameBase.cpp @@ -259,7 +259,7 @@ GameBase::GameBase() GameBase::~GameBase() { #ifdef TORQUE_AFX_ENABLED - if (scope_registered) + if (mScope_registered) arcaneFX::unregisterScopedObject(this); #endif } @@ -277,7 +277,7 @@ bool GameBase::onAdd() #ifdef TORQUE_AFX_ENABLED if (isClientObject()) { - if (scope_id > 0 && !scope_registered) + if (mScope_id > 0 && !mScope_registered) arcaneFX::registerScopedObject(this); } else @@ -298,7 +298,7 @@ bool GameBase::onAdd() void GameBase::onRemove() { #ifdef TORQUE_AFX_ENABLED - if (scope_registered) + if (mScope_registered) arcaneFX::unregisterScopedObject(this); #endif // EDITOR FEATURE: Remove us from the reload signal of our datablock. @@ -586,8 +586,8 @@ U32 GameBase::packUpdate( NetConnection *connection, U32 mask, BitStream *stream #ifdef TORQUE_AFX_ENABLED if (stream->writeFlag(mask & ScopeIdMask)) { - if (stream->writeFlag(scope_refs > 0)) - stream->writeInt(scope_id, SCOPE_ID_BITS); + if (stream->writeFlag(mScope_refs > 0)) + stream->writeInt(mScope_id, SCOPE_ID_BITS); } #endif return retMask; @@ -631,8 +631,8 @@ void GameBase::unpackUpdate(NetConnection *con, BitStream *stream) #ifdef TORQUE_AFX_ENABLED if (stream->readFlag()) { - scope_id = (stream->readFlag()) ? (U16) stream->readInt(SCOPE_ID_BITS) : 0; - scope_refs = 0; + mScope_id = (stream->readFlag()) ? (U16) stream->readInt(SCOPE_ID_BITS) : 0; + mScope_refs = 0; } #endif } diff --git a/Engine/source/afx/afxChoreographer.cpp b/Engine/source/afx/afxChoreographer.cpp index e0f20fa75..d1b4d9069 100644 --- a/Engine/source/afx/afxChoreographer.cpp +++ b/Engine/source/afx/afxChoreographer.cpp @@ -331,9 +331,9 @@ void afxChoreographer::unpack_constraint_info(NetConnection* conn, BitStream* st { if (stream->readFlag()) { - U16 scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); + mScope_id = stream->readInt(NetObject::SCOPE_ID_BITS); bool is_shape = stream->readFlag(); - addObjectConstraint(scope_id, cons_name, is_shape); + addObjectConstraint(mScope_id, cons_name, is_shape); } } } diff --git a/Engine/source/sim/netObject.cpp b/Engine/source/sim/netObject.cpp index a77869883..25c5e3657 100644 --- a/Engine/source/sim/netObject.cpp +++ b/Engine/source/sim/netObject.cpp @@ -56,9 +56,9 @@ NetObject::NetObject() mNextDirtyList = NULL; mDirtyMaskBits = 0; #ifdef TORQUE_AFX_ENABLED - scope_id = 0; - scope_refs = 0; - scope_registered = false; + mScope_id = 0; + mScope_refs = 0; + mScope_registered = false; #endif } @@ -478,23 +478,23 @@ DefineEngineMethod( NetObject, isServerObject, bool, (),, #ifdef TORQUE_AFX_ENABLED U16 NetObject::addScopeRef() { - if (scope_refs == 0) + if (mScope_refs == 0) { - scope_id = arcaneFX::generateScopeId(); + mScope_id = arcaneFX::generateScopeId(); onScopeIdChange(); } - scope_refs++; - return scope_id; + mScope_refs++; + return mScope_id; } void NetObject::removeScopeRef() { - if (scope_refs == 0) + if (mScope_refs == 0) return; - scope_refs--; - if (scope_refs == 0) + mScope_refs--; + if (mScope_refs == 0) { - scope_id = 0; + mScope_id = 0; onScopeIdChange(); } } diff --git a/Engine/source/sim/netObject.h b/Engine/source/sim/netObject.h index 7ea1283c4..1ba588944 100644 --- a/Engine/source/sim/netObject.h +++ b/Engine/source/sim/netObject.h @@ -411,17 +411,17 @@ public: /// @} protected: - U16 scope_id; - U16 scope_refs; - bool scope_registered; + U16 mScope_id; + U16 mScope_refs; + bool mScope_registered; virtual void onScopeIdChange() { } public: enum { SCOPE_ID_BITS = 14 }; - U16 getScopeId() const { return scope_id; } + U16 getScopeId() const { return mScope_id; } U16 addScopeRef(); void removeScopeRef(); - void setScopeRegistered(bool flag) { scope_registered = flag; } - bool getScopeRegistered() const { return scope_registered; } + void setScopeRegistered(bool flag) { mScope_registered = flag; } + bool getScopeRegistered() const { return mScope_registered; } protected: /// Add a networked field diff --git a/Engine/source/util/scopeTracker.h b/Engine/source/util/scopeTracker.h index c58711ca0..ecbf0fac9 100644 --- a/Engine/source/util/scopeTracker.h +++ b/Engine/source/util/scopeTracker.h @@ -515,11 +515,11 @@ void ScopeTracker< NUM_DIMENSIONS, Object >::updateObject( Object object ) while( !mPotentialScopeInObjects.empty() ) { - Object object = mPotentialScopeInObjects.last(); + Object obj = mPotentialScopeInObjects.last(); mPotentialScopeInObjects.decrement(); - if( Deref( object ).isInScope() ) - _onScopeIn( object ); + if( Deref(obj).isInScope() ) + _onScopeIn(obj); } } else From 1e65a01cf9c5536d8efff52b24f22da794c2e514 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 13 Mar 2018 21:29:09 -0500 Subject: [PATCH 047/144] shadowvar cleanups for scattersky and accumulationVolume --- Engine/source/T3D/accumulationVolume.cpp | 6 +++--- Engine/source/environment/scatterSky.cpp | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Engine/source/T3D/accumulationVolume.cpp b/Engine/source/T3D/accumulationVolume.cpp index 2d44d7178..4c2e8b009 100644 --- a/Engine/source/T3D/accumulationVolume.cpp +++ b/Engine/source/T3D/accumulationVolume.cpp @@ -206,11 +206,11 @@ void AccumulationVolume::buildSilhouette( const SceneCameraState& cameraState, V if( mTransformDirty ) { - const U32 numPoints = mPolyhedron.getNumPoints(); + const U32 numPolyPoints = mPolyhedron.getNumPoints(); const PolyhedronType::PointType* points = getPolyhedron().getPoints(); - mWSPoints.setSize( numPoints ); - for( U32 i = 0; i < numPoints; ++ i ) + mWSPoints.setSize(numPolyPoints); + for( U32 i = 0; i < numPolyPoints; ++ i ) { Point3F p = points[ i ]; p.convolve( getScale() ); diff --git a/Engine/source/environment/scatterSky.cpp b/Engine/source/environment/scatterSky.cpp index 1b3a60843..2f8d17d00 100644 --- a/Engine/source/environment/scatterSky.cpp +++ b/Engine/source/environment/scatterSky.cpp @@ -690,13 +690,13 @@ void ScatterSky::prepRenderImage( SceneRenderState *state ) mMatrixSet->setSceneProjection(GFX->getProjectionMatrix()); mMatrixSet->setWorld(GFX->getWorldMatrix()); - ObjectRenderInst *ri = renderPass->allocInst(); - ri->renderDelegate.bind( this, &ScatterSky::_renderMoon ); - ri->type = RenderPassManager::RIT_Sky; + ObjectRenderInst *moonRI = renderPass->allocInst(); + moonRI->renderDelegate.bind( this, &ScatterSky::_renderMoon ); + moonRI->type = RenderPassManager::RIT_Sky; // Render after sky objects and before CloudLayer! - ri->defaultKey = 5; - ri->defaultKey2 = 0; - renderPass->addInst(ri); + moonRI->defaultKey = 5; + moonRI->defaultKey2 = 0; + renderPass->addInst(moonRI); } } @@ -1346,7 +1346,7 @@ void ScatterSky::_getColor( const Point3F &pos, LinearColorF *outColor ) for ( U32 i = 0; i < 2; i++ ) { F32 fHeight = v3SamplePoint.len(); - F32 fDepth = mExp( scaleOverScaleDepth * (mSphereInnerRadius - smViewerHeight) ); + fDepth = mExp( scaleOverScaleDepth * (mSphereInnerRadius - smViewerHeight) ); F32 fLightAngle = mDot( mLightDir, v3SamplePoint ) / fHeight; F32 fCameraAngle = mDot( v3Ray, v3SamplePoint ) / fHeight; From d80f35bb7d83088d265cd30688055a52cc72b9b2 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 13:12:26 -0500 Subject: [PATCH 048/144] layer, and playerControllerComponent shadowvar cleanups --- .../physics/playerControllerComponent.cpp | 7 +- Engine/source/T3D/player.cpp | 218 +++++++++--------- Engine/source/T3D/player.h | 2 +- 3 files changed, 113 insertions(+), 114 deletions(-) diff --git a/Engine/source/T3D/components/physics/playerControllerComponent.cpp b/Engine/source/T3D/components/physics/playerControllerComponent.cpp index 761ac570c..5b7455bfc 100644 --- a/Engine/source/T3D/components/physics/playerControllerComponent.cpp +++ b/Engine/source/T3D/components/physics/playerControllerComponent.cpp @@ -441,16 +441,15 @@ void PlayerControllerComponent::updateMove() // get the head pitch and add it to the moveVec // This more accurate swim vector calc comes from Matt Fairfax - MatrixF xRot, zRot; + MatrixF xRot; xRot.set(EulerF(mOwner->getRotation().asEulerF().x, 0, 0)); - zRot.set(EulerF(0, 0, mOwner->getRotation().asEulerF().z)); + zRot.set(EulerF(0, 0, mOwner->getRotation().asEulerF().z));//reset prior uses MatrixF rot; rot.mul(zRot, xRot); rot.getColumn(0, &moveVec); moveVec *= move->x; - VectorF tv; - rot.getColumn(1, &tv); + rot.getColumn(1, &tv);//reset prior uses moveVec += tv * move->y; rot.getColumn(2, &tv); moveVec += tv * move->z; diff --git a/Engine/source/T3D/player.cpp b/Engine/source/T3D/player.cpp index 15b57046a..0399f6694 100644 --- a/Engine/source/T3D/player.cpp +++ b/Engine/source/T3D/player.cpp @@ -1577,20 +1577,20 @@ Player::Player() { mTypeMask |= PlayerObjectType | DynamicShapeObjectType; - delta.pos = mAnchorPoint = Point3F(0,0,100); - delta.rot = delta.head = Point3F(0,0,0); - delta.rotOffset.set(0.0f,0.0f,0.0f); - delta.warpOffset.set(0.0f,0.0f,0.0f); - delta.posVec.set(0.0f,0.0f,0.0f); - delta.rotVec.set(0.0f,0.0f,0.0f); - delta.headVec.set(0.0f,0.0f,0.0f); - delta.warpTicks = 0; - delta.dt = 1.0f; - delta.move = NullMove; + mDelta.pos = mAnchorPoint = Point3F(0,0,100); + mDelta.rot = mDelta.head = Point3F(0,0,0); + mDelta.rotOffset.set(0.0f,0.0f,0.0f); + mDelta.warpOffset.set(0.0f,0.0f,0.0f); + mDelta.posVec.set(0.0f,0.0f,0.0f); + mDelta.rotVec.set(0.0f,0.0f,0.0f); + mDelta.headVec.set(0.0f,0.0f,0.0f); + mDelta.warpTicks = 0; + mDelta.dt = 1.0f; + mDelta.move = NullMove; mPredictionCount = sMaxPredictionTicks; - mObjToWorld.setColumn(3,delta.pos); - mRot = delta.rot; - mHead = delta.head; + mObjToWorld.setColumn(3, mDelta.pos); + mRot = mDelta.rot; + mHead = mDelta.head; mVelocity.set(0.0f, 0.0f, 0.0f); mDataBlock = 0; mHeadHThread = mHeadVThread = mRecoilThread = mImageStateThread = 0; @@ -2103,30 +2103,30 @@ void Player::processTick(const Move* move) } } // Warp to catch up to server - if (delta.warpTicks > 0) { - delta.warpTicks--; + if (mDelta.warpTicks > 0) { + mDelta.warpTicks--; // Set new pos - getTransform().getColumn(3, &delta.pos); - delta.pos += delta.warpOffset; - delta.rot += delta.rotOffset; + getTransform().getColumn(3, &mDelta.pos); + mDelta.pos += mDelta.warpOffset; + mDelta.rot += mDelta.rotOffset; // Wrap yaw to +/-PI - if (delta.rot.z < - M_PI_F) - delta.rot.z += M_2PI_F; - else if (delta.rot.z > M_PI_F) - delta.rot.z -= M_2PI_F; + if (mDelta.rot.z < - M_PI_F) + mDelta.rot.z += M_2PI_F; + else if (mDelta.rot.z > M_PI_F) + mDelta.rot.z -= M_2PI_F; if (!ignore_updates) { - setPosition(delta.pos,delta.rot); + setPosition(mDelta.pos, mDelta.rot); } updateDeathOffsets(); updateLookAnimation(); // Backstepping - delta.posVec = -delta.warpOffset; - delta.rotVec = -delta.rotOffset; + mDelta.posVec = -mDelta.warpOffset; + mDelta.rotVec = -mDelta.rotOffset; } else { // If there is no move, the player is either an @@ -2139,7 +2139,7 @@ void Player::processTick(const Move* move) if (mPredictionCount-- <= 0) return; - move = &delta.move; + move = &mDelta.move; } else move = &NullMove; @@ -2215,8 +2215,8 @@ void Player::interpolateTick(F32 dt) // Client side interpolation Parent::interpolateTick(dt); - Point3F pos = delta.pos + delta.posVec * dt; - Point3F rot = delta.rot + delta.rotVec * dt; + Point3F pos = mDelta.pos + mDelta.posVec * dt; + Point3F rot = mDelta.rot + mDelta.rotVec * dt; if (!ignore_updates) setRenderPosition(pos,rot,dt); @@ -2237,7 +2237,7 @@ void Player::interpolateTick(F32 dt) */ updateLookAnimation(dt); - delta.dt = dt; + mDelta.dt = dt; } void Player::advanceTime(F32 dt) @@ -2561,7 +2561,7 @@ void Player::updateMove(const Move* move) } move = &my_move; } - delta.move = *move; + mDelta.move = *move; #ifdef TORQUE_OPENVR if (mControllers[0]) @@ -2611,7 +2611,7 @@ void Player::updateMove(const Move* move) // Update current orientation if (mDamageState == Enabled) { F32 prevZRot = mRot.z; - delta.headVec = mHead; + mDelta.headVec = mHead; bool doStandardMove = true; bool absoluteDelta = false; @@ -2772,29 +2772,29 @@ void Player::updateMove(const Move* move) mRot.z -= M_2PI_F; } - delta.rot = mRot; - delta.rotVec.x = delta.rotVec.y = 0.0f; - delta.rotVec.z = prevZRot - mRot.z; - if (delta.rotVec.z > M_PI_F) - delta.rotVec.z -= M_2PI_F; - else if (delta.rotVec.z < -M_PI_F) - delta.rotVec.z += M_2PI_F; + mDelta.rot = mRot; + mDelta.rotVec.x = mDelta.rotVec.y = 0.0f; + mDelta.rotVec.z = prevZRot - mRot.z; + if (mDelta.rotVec.z > M_PI_F) + mDelta.rotVec.z -= M_2PI_F; + else if (mDelta.rotVec.z < -M_PI_F) + mDelta.rotVec.z += M_2PI_F; - delta.head = mHead; - delta.headVec -= mHead; + mDelta.head = mHead; + mDelta.headVec -= mHead; if (absoluteDelta) { - delta.headVec = Point3F(0, 0, 0); - delta.rotVec = Point3F(0, 0, 0); + mDelta.headVec = Point3F(0, 0, 0); + mDelta.rotVec = Point3F(0, 0, 0); } for(U32 i=0; i<3; ++i) { - if (delta.headVec[i] > M_PI_F) - delta.headVec[i] -= M_2PI_F; - else if (delta.headVec[i] < -M_PI_F) - delta.headVec[i] += M_2PI_F; + if (mDelta.headVec[i] > M_PI_F) + mDelta.headVec[i] -= M_2PI_F; + else if (mDelta.headVec[i] < -M_PI_F) + mDelta.headVec[i] += M_2PI_F; } } MatrixF zRot; @@ -3028,7 +3028,7 @@ void Player::updateMove(const Move* move) // get the head pitch and add it to the moveVec // This more accurate swim vector calc comes from Matt Fairfax - MatrixF xRot, zRot; + MatrixF xRot; xRot.set(EulerF(mHead.x, 0, 0)); zRot.set(EulerF(0, 0, mRot.z)); MatrixF rot; @@ -3583,7 +3583,7 @@ void Player::updateLookAnimation(F32 dt) return; } // Calculate our interpolated head position. - Point3F renderHead = delta.head + delta.headVec * dt; + Point3F renderHead = mDelta.head + mDelta.headVec * dt; // Adjust look pos. This assumes that the animations match // the min and max look angles provided in the datablock. @@ -4421,8 +4421,8 @@ void Player::onImageStateAnimation(U32 imageSlot, const char* seqName, bool dire if (!found && hasImageBasePrefix && hasScriptPrefix) { - String seqName = String(imageBasePrefix) + String("_") + String(scriptPrefix) + String("_") + baseSeqName; - S32 index = mShapeInstance->getShape()->findSequence(seqName); + String comboSeqName = String(imageBasePrefix) + String("_") + String(scriptPrefix) + String("_") + baseSeqName; + S32 index = mShapeInstance->getShape()->findSequence(comboSeqName); if (index != -1) { seqIndex = index; @@ -4432,8 +4432,8 @@ void Player::onImageStateAnimation(U32 imageSlot, const char* seqName, bool dire if (!found && hasImageBasePrefix) { - String seqName = String(imageBasePrefix) + String("_") + baseSeqName; - S32 index = mShapeInstance->getShape()->findSequence(seqName); + String imgSeqName = String(imageBasePrefix) + String("_") + baseSeqName; + S32 index = mShapeInstance->getShape()->findSequence(imgSeqName); if (index != -1) { seqIndex = index; @@ -4443,8 +4443,8 @@ void Player::onImageStateAnimation(U32 imageSlot, const char* seqName, bool dire if (!found && hasScriptPrefix) { - String seqName = String(scriptPrefix) + String("_") + baseSeqName; - S32 index = mShapeInstance->getShape()->findSequence(seqName); + String scriptSeqName = String(scriptPrefix) + String("_") + baseSeqName; + S32 index = mShapeInstance->getShape()->findSequence(scriptSeqName); if (index != -1) { seqIndex = index; @@ -5113,7 +5113,7 @@ void Player::_handleCollision( const Collision &collision ) bool Player::updatePos(const F32 travelTime) { PROFILE_SCOPE(Player_UpdatePos); - getTransform().getColumn(3,&delta.posVec); + getTransform().getColumn(3,&mDelta.posVec); // When mounted to another object, only Z rotation used. if (isMounted()) { @@ -5205,7 +5205,7 @@ bool Player::updatePos(const F32 travelTime) else { if ( mVelocity.isZero() ) - newPos = delta.posVec; + newPos = mDelta.posVec; else newPos = _move( travelTime, &col ); @@ -5222,9 +5222,9 @@ bool Player::updatePos(const F32 travelTime) // If on the client, calc delta for backstepping if (isClientObject()) { - delta.pos = newPos; - delta.posVec = delta.posVec - delta.pos; - delta.dt = 1.0f; + mDelta.pos = newPos; + mDelta.posVec = mDelta.posVec - mDelta.pos; + mDelta.dt = 1.0f; } setPosition( newPos, mRot ); @@ -5460,8 +5460,8 @@ bool Player::displaceObject(const Point3F& displacement) sBalance--; - getTransform().getColumn(3, &delta.pos); - delta.posVec.set(0.0f, 0.0f, 0.0f); + getTransform().getColumn(3, &mDelta.pos); + mDelta.posVec.set(0.0f, 0.0f, 0.0f); return result; } @@ -5480,8 +5480,8 @@ bool Player::displaceObject(const Point3F& displacement) bool result = updatePos(dt); - mObjToWorld.getColumn(3, &delta.pos); - delta.posVec.set(0.0f, 0.0f, 0.0f); + mObjToWorld.getColumn(3, &mDelta.pos); + mDelta.posVec.set(0.0f, 0.0f, 0.0f); return result; } @@ -5684,10 +5684,10 @@ void Player::getRenderEyeBaseTransform(MatrixF* mat, bool includeBank) // Eye transform in world space. We only use the eye position // from the animation and supply our own rotation. MatrixF pmat,xmat,zmat; - xmat.set(EulerF(delta.head.x + delta.headVec.x * delta.dt, 0.0f, 0.0f)); + xmat.set(EulerF(mDelta.head.x + mDelta.headVec.x * mDelta.dt, 0.0f, 0.0f)); if (mUseHeadZCalc) - zmat.set(EulerF(0.0f, 0.0f, delta.head.z + delta.headVec.z * delta.dt)); + zmat.set(EulerF(0.0f, 0.0f, mDelta.head.z + mDelta.headVec.z * mDelta.dt)); else zmat.identity(); @@ -5697,7 +5697,7 @@ void Player::getRenderEyeBaseTransform(MatrixF* mat, bool includeBank) MatrixF imat; imat.mul(zmat, xmat); MatrixF ymat; - ymat.set(EulerF(0.0f, delta.head.y + delta.headVec.y * delta.dt, 0.0f)); + ymat.set(EulerF(0.0f, mDelta.head.y + mDelta.headVec.y * mDelta.dt, 0.0f)); pmat.mul(imat, ymat); } else @@ -6234,7 +6234,7 @@ void Player::readPacketData(GameConnection *connection, BitStream *stream) stream->read(&mVelocity.y); stream->read(&mVelocity.z); stream->setCompressionPoint(pos); - delta.pos = pos; + mDelta.pos = pos; mJumpSurfaceLastContact = stream->readInt(4); if (stream->readFlag()) @@ -6257,7 +6257,7 @@ void Player::readPacketData(GameConnection *connection, BitStream *stream) } } else - pos = delta.pos; + pos = mDelta.pos; stream->read(&mHead.x); if(stream->readFlag()) { @@ -6269,8 +6269,8 @@ void Player::readPacketData(GameConnection *connection, BitStream *stream) rot.x = rot.y = 0; if (!ignore_updates) setPosition(pos,rot); - delta.head = mHead; - delta.rot = rot; + mDelta.head = mHead; + mDelta.rot = rot; if (stream->readFlag()) { S32 gIndex = stream->readInt(NetConnection::GhostIdBitSize); @@ -6348,7 +6348,7 @@ U32 Player::packUpdate(NetConnection *con, U32 mask, BitStream *stream) stream->writeFloat(mRot.z / M_2PI_F, 7); stream->writeSignedFloat(mHead.x / (mDataBlock->maxLookAngle - mDataBlock->minLookAngle), 6); stream->writeSignedFloat(mHead.z / mDataBlock->maxFreelookAngle, 6); - delta.move.pack(stream); + mDelta.move.pack(stream); stream->writeFlag(!(mask & NoWarpMask)); } // Ghost need energy to predict reliably @@ -6454,67 +6454,67 @@ void Player::unpackUpdate(NetConnection *con, BitStream *stream) rot.z = stream->readFloat(7) * M_2PI_F; mHead.x = stream->readSignedFloat(6) * (mDataBlock->maxLookAngle - mDataBlock->minLookAngle); mHead.z = stream->readSignedFloat(6) * mDataBlock->maxFreelookAngle; - delta.move.unpack(stream); + mDelta.move.unpack(stream); - delta.head = mHead; - delta.headVec.set(0.0f, 0.0f, 0.0f); + mDelta.head = mHead; + mDelta.headVec.set(0.0f, 0.0f, 0.0f); if (stream->readFlag() && isProperlyAdded()) { // Determine number of ticks to warp based on the average // of the client and server velocities. - delta.warpOffset = pos - delta.pos; + mDelta.warpOffset = pos - mDelta.pos; F32 as = (speed + mVelocity.len()) * 0.5f * TickSec; - F32 dt = (as > 0.00001f) ? delta.warpOffset.len() / as: sMaxWarpTicks; - delta.warpTicks = (S32)((dt > sMinWarpTicks) ? getMax(mFloor(dt + 0.5f), 1.0f) : 0.0f); + F32 dt = (as > 0.00001f) ? mDelta.warpOffset.len() / as: sMaxWarpTicks; + mDelta.warpTicks = (S32)((dt > sMinWarpTicks) ? getMax(mFloor(dt + 0.5f), 1.0f) : 0.0f); - if (delta.warpTicks) + if (mDelta.warpTicks) { // Setup the warp to start on the next tick. - if (delta.warpTicks > sMaxWarpTicks) - delta.warpTicks = sMaxWarpTicks; - delta.warpOffset /= (F32)delta.warpTicks; + if (mDelta.warpTicks > sMaxWarpTicks) + mDelta.warpTicks = sMaxWarpTicks; + mDelta.warpOffset /= (F32)mDelta.warpTicks; - delta.rotOffset = rot - delta.rot; + mDelta.rotOffset = rot - mDelta.rot; // Ignore small rotation differences - if (mFabs(delta.rotOffset.z) < 0.001f) - delta.rotOffset.z = 0; + if (mFabs(mDelta.rotOffset.z) < 0.001f) + mDelta.rotOffset.z = 0; // Wrap rotation to +/-PI - if(delta.rotOffset.z < - M_PI_F) - delta.rotOffset.z += M_2PI_F; - else if(delta.rotOffset.z > M_PI_F) - delta.rotOffset.z -= M_2PI_F; + if(mDelta.rotOffset.z < - M_PI_F) + mDelta.rotOffset.z += M_2PI_F; + else if(mDelta.rotOffset.z > M_PI_F) + mDelta.rotOffset.z -= M_2PI_F; - delta.rotOffset /= (F32)delta.warpTicks; + mDelta.rotOffset /= (F32)mDelta.warpTicks; } else { // Going to skip the warp, server and client are real close. // Adjust the frame interpolation to move smoothly to the // new position within the current tick. - Point3F cp = delta.pos + delta.posVec * delta.dt; - if (delta.dt == 0) + Point3F cp = mDelta.pos + mDelta.posVec * mDelta.dt; + if (mDelta.dt == 0) { - delta.posVec.set(0.0f, 0.0f, 0.0f); - delta.rotVec.set(0.0f, 0.0f, 0.0f); + mDelta.posVec.set(0.0f, 0.0f, 0.0f); + mDelta.rotVec.set(0.0f, 0.0f, 0.0f); } else { - F32 dti = 1.0f / delta.dt; - delta.posVec = (cp - pos) * dti; - delta.rotVec.z = mRot.z - rot.z; + F32 dti = 1.0f / mDelta.dt; + mDelta.posVec = (cp - pos) * dti; + mDelta.rotVec.z = mRot.z - rot.z; - if(delta.rotVec.z > M_PI_F) - delta.rotVec.z -= M_2PI_F; - else if(delta.rotVec.z < -M_PI_F) - delta.rotVec.z += M_2PI_F; + if(mDelta.rotVec.z > M_PI_F) + mDelta.rotVec.z -= M_2PI_F; + else if(mDelta.rotVec.z < -M_PI_F) + mDelta.rotVec.z += M_2PI_F; - delta.rotVec.z *= dti; + mDelta.rotVec.z *= dti; } - delta.pos = pos; - delta.rot = rot; + mDelta.pos = pos; + mDelta.rot = rot; if (!ignore_updates) setPosition(pos,rot); } @@ -6522,12 +6522,12 @@ void Player::unpackUpdate(NetConnection *con, BitStream *stream) else { // Set the player to the server position - delta.pos = pos; - delta.rot = rot; - delta.posVec.set(0.0f, 0.0f, 0.0f); - delta.rotVec.set(0.0f, 0.0f, 0.0f); - delta.warpTicks = 0; - delta.dt = 0.0f; + mDelta.pos = pos; + mDelta.rot = rot; + mDelta.posVec.set(0.0f, 0.0f, 0.0f); + mDelta.rotVec.set(0.0f, 0.0f, 0.0f); + mDelta.warpTicks = 0; + mDelta.dt = 0.0f; if (!ignore_updates) setPosition(pos,rot); } diff --git a/Engine/source/T3D/player.h b/Engine/source/T3D/player.h index 0b4545114..3e1cb5e50 100644 --- a/Engine/source/T3D/player.h +++ b/Engine/source/T3D/player.h @@ -436,7 +436,7 @@ protected: Point3F rotOffset; /// @} }; - StateDelta delta; ///< Used for interpolation on the client. @see StateDelta + StateDelta mDelta; ///< Used for interpolation on the client. @see StateDelta S32 mPredictionCount; ///< Number of ticks to predict // Current pos, vel etc. From f559cf4231cfb45aefbfcd3a57d6b3f843943887 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 13:14:39 -0500 Subject: [PATCH 049/144] Polytope::intersect variable differerntiation. --- Engine/source/collision/polytope.cpp | 36 ++++++++++++++-------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Engine/source/collision/polytope.cpp b/Engine/source/collision/polytope.cpp index f07116583..127c0a1f3 100644 --- a/Engine/source/collision/polytope.cpp +++ b/Engine/source/collision/polytope.cpp @@ -193,19 +193,19 @@ void Polytope::intersect(SimObject* object,const BSPNode* root) // Split the edge into each volume mEdgeList.increment(2); - Edge& e0 = mEdgeList.last(); - e0.next = frontVolume.edgeList; + Edge& ev0 = mEdgeList.last(); + ev0.next = frontVolume.edgeList; frontVolume.edgeList = mEdgeList.size() - 1; - Edge& e1 = *(&e0 - 1); - e1.next = backVolume.edgeList; + Edge& ev1 = *(&ev0 - 1); + ev1.next = backVolume.edgeList; backVolume.edgeList = frontVolume.edgeList - 1; - e0.vertex[0] = edge.vertex[s]; - e1.vertex[0] = edge.vertex[s ^ 1]; - e0.vertex[1] = e1.vertex[1] = mVertexList.size() - 1; - e0.face[0] = e1.face[0] = edge.face[0]; - e0.face[1] = e1.face[1] = edge.face[1]; + ev0.vertex[0] = edge.vertex[s]; + ev1.vertex[0] = edge.vertex[s ^ 1]; + ev0.vertex[1] = ev1.vertex[1] = mVertexList.size() - 1; + ev0.face[0] = ev1.face[0] = edge.face[0]; + ev0.face[1] = ev1.face[1] = edge.face[1]; // Add new edges on the plane, one to each volume for (S32 f = 0; f < 2; f++) { @@ -214,19 +214,19 @@ void Polytope::intersect(SimObject* object,const BSPNode* root) face.vertex = mVertexList.size() - 1; else { mEdgeList.increment(2); - Edge& e0 = mEdgeList.last(); - e0.next = frontVolume.edgeList; + Edge& ep0 = mEdgeList.last(); + ep0.next = frontVolume.edgeList; frontVolume.edgeList = mEdgeList.size() - 1; - Edge& e1 = *(&e0 - 1); - e1.next = backVolume.edgeList; + Edge& ep1 = *(&ep0 - 1); + ep1.next = backVolume.edgeList; backVolume.edgeList = frontVolume.edgeList - 1; - e1.vertex[0] = e0.vertex[0] = face.vertex; - e1.vertex[1] = e0.vertex[1] = mVertexList.size() - 1; - e1.face[0] = e0.face[0] = edge.face[f]; - e1.face[1] = mFaceList.size() - 1; - e0.face[1] = e1.face[1] - 1; + ep1.vertex[0] = ep0.vertex[0] = face.vertex; + ep1.vertex[1] = ep0.vertex[1] = mVertexList.size() - 1; + ep1.face[0] = ep0.face[0] = edge.face[f]; + ep1.face[1] = mFaceList.size() - 1; + ep0.face[1] = ep1.face[1] - 1; } } } From 50482de41e751201b51b9a52b3157c0c7c2a692a Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 13:15:14 -0500 Subject: [PATCH 050/144] duplicate var+assignment --- Engine/source/platform/platformNet.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/Engine/source/platform/platformNet.cpp b/Engine/source/platform/platformNet.cpp index a77d29474..6c6d3b234 100644 --- a/Engine/source/platform/platformNet.cpp +++ b/Engine/source/platform/platformNet.cpp @@ -1842,8 +1842,6 @@ void Net::addressToString(const NetAddress *address, char addressString[256]) { char buffer[256]; buffer[0] = '\0'; - sockaddr_in ipAddr; - NetAddressToIPSocket(address, &ipAddr); inet_ntop(AF_INET, &(ipAddr.sin_addr), buffer, sizeof(buffer)); if (ipAddr.sin_port == 0) dSprintf(addressString, 256, "IP:%s", buffer); From 789979d58a608ddd20f8501d1429bec712d74434 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 15:10:43 -0500 Subject: [PATCH 051/144] duplicated ghostinfo itterator --- Engine/source/sim/netGhost.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/sim/netGhost.cpp b/Engine/source/sim/netGhost.cpp index 1b51b0dde..d903d7473 100644 --- a/Engine/source/sim/netGhost.cpp +++ b/Engine/source/sim/netGhost.cpp @@ -428,7 +428,7 @@ void NetConnection::ghostWritePacket(BitStream *bstream, PacketNotify *notify) // for(i = mGhostZeroUpdateIndex - 1; i >= 0 && !bstream->isFull(); i--) { - GhostInfo *walk = mGhostArray[i]; + walk = mGhostArray[i]; if(walk->flags & (GhostInfo::KillingGhost | GhostInfo::Ghosting)) continue; From d0e47ee1eee6f94a1ef65ae15f396b5f8edd1b25 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 15:13:44 -0500 Subject: [PATCH 052/144] davmesh debug draw membervar cleanup --- Engine/source/navigation/navMesh.cpp | 38 ++++++++++++++-------------- Engine/source/navigation/navMesh.h | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Engine/source/navigation/navMesh.cpp b/Engine/source/navigation/navMesh.cpp index c9bbb1fa4..04283fd1f 100644 --- a/Engine/source/navigation/navMesh.cpp +++ b/Engine/source/navigation/navMesh.cpp @@ -1232,10 +1232,10 @@ bool NavMesh::createCoverPoints() float segs[MAX_SEGS*6]; int nsegs = 0; query->getPolyWallSegments(ref, &f, segs, NULL, &nsegs, MAX_SEGS); - for(int j = 0; j < nsegs; ++j) + for(int segIDx = 0; segIDx < nsegs; ++segIDx) { - const float* sa = &segs[j*6]; - const float* sb = &segs[j*6+3]; + const float* sa = &segs[segIDx *6]; + const float* sb = &segs[segIDx *6+3]; Point3F a = RCtoDTS(sa), b = RCtoDTS(sb); F32 len = (b - a).len(); if(len < mWalkableRadius * 2) @@ -1244,7 +1244,7 @@ bool NavMesh::createCoverPoints() edge.normalize(); // Number of points to try placing - for now, one at each end. U32 pointCount = (len > mWalkableRadius * 4) ? 2 : 1; - for(U32 i = 0; i < pointCount; i++) + for(U32 pointIDx = 0; pointIDx < pointCount; pointIDx++) { MatrixF mat; Point3F pos; @@ -1254,10 +1254,10 @@ bool NavMesh::createCoverPoints() // Otherwise, stand off from edge ends. else { - if(i % 2) - pos = a + edge * (i/2+1) * mWalkableRadius; + if(pointIDx % 2) + pos = a + edge * (pointIDx /2+1) * mWalkableRadius; else - pos = b - edge * (i/2+1) * mWalkableRadius; + pos = b - edge * (pointIDx /2+1) * mWalkableRadius; } CoverPointData data; if(testEdgeCover(pos, edge, data)) @@ -1332,7 +1332,7 @@ bool NavMesh::testEdgeCover(const Point3F &pos, const VectorF &dir, CoverPointDa void NavMesh::renderToDrawer() { - dd.clear(); + mDbgDraw.clear(); // Recast debug draw NetObject *no = getServerObject(); if(no) @@ -1341,12 +1341,12 @@ void NavMesh::renderToDrawer() if(n->nm) { - dd.beginGroup(0); - duDebugDrawNavMesh (&dd, *n->nm, 0); - dd.beginGroup(1); - duDebugDrawNavMeshPortals(&dd, *n->nm); - dd.beginGroup(2); - duDebugDrawNavMeshBVTree (&dd, *n->nm); + mDbgDraw.beginGroup(0); + duDebugDrawNavMesh (&mDbgDraw, *n->nm, 0); + mDbgDraw.beginGroup(1); + duDebugDrawNavMeshPortals(&mDbgDraw, *n->nm); + mDbgDraw.beginGroup(2); + duDebugDrawNavMeshBVTree (&mDbgDraw, *n->nm); } } } @@ -1398,16 +1398,16 @@ void NavMesh::render(ObjectRenderInst *ri, SceneRenderState *state, BaseMatInsta int alpha = 80; if(!n->isSelected() || !Con::getBoolVariable("$Nav::EditorOpen")) alpha = 20; - dd.overrideColor(duRGBA(255, 0, 0, alpha)); + mDbgDraw.overrideColor(duRGBA(255, 0, 0, alpha)); } else { - dd.cancelOverride(); + mDbgDraw.cancelOverride(); } - if((!gEditingMission && n->mAlwaysRender) || (gEditingMission && Con::getBoolVariable("$Nav::Editor::renderMesh", 1))) dd.renderGroup(0); - if(Con::getBoolVariable("$Nav::Editor::renderPortals")) dd.renderGroup(1); - if(Con::getBoolVariable("$Nav::Editor::renderBVTree")) dd.renderGroup(2); + if((!gEditingMission && n->mAlwaysRender) || (gEditingMission && Con::getBoolVariable("$Nav::Editor::renderMesh", 1))) mDbgDraw.renderGroup(0); + if(Con::getBoolVariable("$Nav::Editor::renderPortals")) mDbgDraw.renderGroup(1); + if(Con::getBoolVariable("$Nav::Editor::renderBVTree")) mDbgDraw.renderGroup(2); } } diff --git a/Engine/source/navigation/navMesh.h b/Engine/source/navigation/navMesh.h index ff279c3be..75efcdacb 100644 --- a/Engine/source/navigation/navMesh.h +++ b/Engine/source/navigation/navMesh.h @@ -407,7 +407,7 @@ private: /// @name Rendering /// @{ - duDebugDrawTorque dd; + duDebugDrawTorque mDbgDraw; void renderToDrawer(); From d979cf9d2d4c0f4d9a8239b36b693a0e12636b60 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 15:18:00 -0500 Subject: [PATCH 053/144] PolyhedronVectorData core membervar cleanups --- .../components/collision/collisionTrigger.cpp | 48 ++++---- Engine/source/T3D/occlusionVolume.cpp | 6 +- Engine/source/T3D/physicalZone.cpp | 48 ++++---- Engine/source/T3D/trigger.cpp | 116 +++++++++--------- Engine/source/collision/extrudedPolyList.cpp | 14 +-- Engine/source/collision/optimizedPolyList.cpp | 26 ++-- Engine/source/math/mPolyhedron.cpp | 28 ++--- Engine/source/math/mPolyhedron.h | 66 +++++----- Engine/source/math/mPolyhedron.impl.h | 6 +- .../scene/mixin/scenePolyhedralObject.impl.h | 18 +-- Engine/source/scene/sceneContainer.cpp | 6 +- 11 files changed, 191 insertions(+), 191 deletions(-) diff --git a/Engine/source/T3D/components/collision/collisionTrigger.cpp b/Engine/source/T3D/components/collision/collisionTrigger.cpp index 7d1f50706..efac30b55 100644 --- a/Engine/source/T3D/components/collision/collisionTrigger.cpp +++ b/Engine/source/T3D/components/collision/collisionTrigger.cpp @@ -357,12 +357,12 @@ void CollisionTrigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron) { mCollisionTriggerPolyhedron = rPolyhedron; - if (mCollisionTriggerPolyhedron.pointList.size() != 0) { + if (mCollisionTriggerPolyhedron.mPointList.size() != 0) { mObjBox.minExtents.set(1e10, 1e10, 1e10); mObjBox.maxExtents.set(-1e10, -1e10, -1e10); - for (U32 i = 0; i < mCollisionTriggerPolyhedron.pointList.size(); i++) { - mObjBox.minExtents.setMin(mCollisionTriggerPolyhedron.pointList[i]); - mObjBox.maxExtents.setMax(mCollisionTriggerPolyhedron.pointList[i]); + for (U32 i = 0; i < mCollisionTriggerPolyhedron.mPointList.size(); i++) { + mObjBox.minExtents.setMin(mCollisionTriggerPolyhedron.mPointList[i]); + mObjBox.maxExtents.setMax(mCollisionTriggerPolyhedron.mPointList[i]); } } else { @@ -374,7 +374,7 @@ void CollisionTrigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron) setTransform(xform); mClippedList.clear(); - mClippedList.mPlaneList = mCollisionTriggerPolyhedron.planeList; + mClippedList.mPlaneList = mCollisionTriggerPolyhedron.mPlaneList; // for (U32 i = 0; i < mClippedList.mPlaneList.size(); i++) // mClippedList.mPlaneList[i].neg(); @@ -412,7 +412,7 @@ void CollisionTrigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron) bool CollisionTrigger::testObject(GameBase* enter) { - if (mCollisionTriggerPolyhedron.pointList.size() == 0) + if (mCollisionTriggerPolyhedron.mPointList.size() == 0) return false; mClippedList.clear(); @@ -507,17 +507,17 @@ U32 CollisionTrigger::packUpdate(NetConnection* con, U32 mask, BitStream* stream // Write the polyhedron if (stream->writeFlag(mask & PolyMask)) { - stream->write(mCollisionTriggerPolyhedron.pointList.size()); - for (i = 0; i < mCollisionTriggerPolyhedron.pointList.size(); i++) - mathWrite(*stream, mCollisionTriggerPolyhedron.pointList[i]); + stream->write(mCollisionTriggerPolyhedron.mPointList.size()); + for (i = 0; i < mCollisionTriggerPolyhedron.mPointList.size(); i++) + mathWrite(*stream, mCollisionTriggerPolyhedron.mPointList[i]); - stream->write(mCollisionTriggerPolyhedron.planeList.size()); - for (i = 0; i < mCollisionTriggerPolyhedron.planeList.size(); i++) - mathWrite(*stream, mCollisionTriggerPolyhedron.planeList[i]); + stream->write(mCollisionTriggerPolyhedron.mPlaneList.size()); + for (i = 0; i < mCollisionTriggerPolyhedron.mPlaneList.size(); i++) + mathWrite(*stream, mCollisionTriggerPolyhedron.mPlaneList[i]); - stream->write(mCollisionTriggerPolyhedron.edgeList.size()); - for (i = 0; i < mCollisionTriggerPolyhedron.edgeList.size(); i++) { - const Polyhedron::Edge& rEdge = mCollisionTriggerPolyhedron.edgeList[i]; + stream->write(mCollisionTriggerPolyhedron.mEdgeList.size()); + for (i = 0; i < mCollisionTriggerPolyhedron.mEdgeList.size(); i++) { + const Polyhedron::Edge& rEdge = mCollisionTriggerPolyhedron.mEdgeList[i]; stream->write(rEdge.face[0]); stream->write(rEdge.face[1]); @@ -555,19 +555,19 @@ void CollisionTrigger::unpackUpdate(NetConnection* con, BitStream* stream) { Polyhedron tempPH; stream->read(&size); - tempPH.pointList.setSize(size); - for (i = 0; i < tempPH.pointList.size(); i++) - mathRead(*stream, &tempPH.pointList[i]); + tempPH.mPointList.setSize(size); + for (i = 0; i < tempPH.mPointList.size(); i++) + mathRead(*stream, &tempPH.mPointList[i]); stream->read(&size); - tempPH.planeList.setSize(size); - for (i = 0; i < tempPH.planeList.size(); i++) - mathRead(*stream, &tempPH.planeList[i]); + tempPH.mPlaneList.setSize(size); + for (i = 0; i < tempPH.mPlaneList.size(); i++) + mathRead(*stream, &tempPH.mPlaneList[i]); stream->read(&size); - tempPH.edgeList.setSize(size); - for (i = 0; i < tempPH.edgeList.size(); i++) { - Polyhedron::Edge& rEdge = tempPH.edgeList[i]; + tempPH.mEdgeList.setSize(size); + for (i = 0; i < tempPH.mEdgeList.size(); i++) { + Polyhedron::Edge& rEdge = tempPH.mEdgeList[i]; stream->read(&rEdge.face[0]); stream->read(&rEdge.face[1]); diff --git a/Engine/source/T3D/occlusionVolume.cpp b/Engine/source/T3D/occlusionVolume.cpp index 7accbd507..9d55042e2 100644 --- a/Engine/source/T3D/occlusionVolume.cpp +++ b/Engine/source/T3D/occlusionVolume.cpp @@ -167,11 +167,11 @@ void OcclusionVolume::buildSilhouette( const SceneCameraState& cameraState, Vect if( mTransformDirty ) { - const U32 numPoints = mPolyhedron.getNumPoints(); + const U32 numPolyPoints = mPolyhedron.getNumPoints(); const PolyhedronType::PointType* points = getPolyhedron().getPoints(); - mWSPoints.setSize( numPoints ); - for( U32 i = 0; i < numPoints; ++ i ) + mWSPoints.setSize(numPolyPoints); + for( U32 i = 0; i < numPolyPoints; ++ i ) { Point3F p = points[ i ]; p.convolve( getScale() ); diff --git a/Engine/source/T3D/physicalZone.cpp b/Engine/source/T3D/physicalZone.cpp index f8454be5b..ba7dd90bb 100644 --- a/Engine/source/T3D/physicalZone.cpp +++ b/Engine/source/T3D/physicalZone.cpp @@ -283,17 +283,17 @@ U32 PhysicalZone::packUpdate(NetConnection* con, U32 mask, BitStream* stream) if (stream->writeFlag(mask & PolyhedronMask)) { // Write the polyhedron - stream->write(mPolyhedron.pointList.size()); - for (i = 0; i < mPolyhedron.pointList.size(); i++) - mathWrite(*stream, mPolyhedron.pointList[i]); + stream->write(mPolyhedron.mPointList.size()); + for (i = 0; i < mPolyhedron.mPointList.size(); i++) + mathWrite(*stream, mPolyhedron.mPointList[i]); - stream->write(mPolyhedron.planeList.size()); - for (i = 0; i < mPolyhedron.planeList.size(); i++) - mathWrite(*stream, mPolyhedron.planeList[i]); + stream->write(mPolyhedron.mPlaneList.size()); + for (i = 0; i < mPolyhedron.mPlaneList.size(); i++) + mathWrite(*stream, mPolyhedron.mPlaneList[i]); - stream->write(mPolyhedron.edgeList.size()); - for (i = 0; i < mPolyhedron.edgeList.size(); i++) { - const Polyhedron::Edge& rEdge = mPolyhedron.edgeList[i]; + stream->write(mPolyhedron.mEdgeList.size()); + for (i = 0; i < mPolyhedron.mEdgeList.size(); i++) { + const Polyhedron::Edge& rEdge = mPolyhedron.mEdgeList[i]; stream->write(rEdge.face[0]); stream->write(rEdge.face[1]); @@ -340,19 +340,19 @@ void PhysicalZone::unpackUpdate(NetConnection* con, BitStream* stream) // Read the polyhedron stream->read(&size); - tempPH.pointList.setSize(size); - for (i = 0; i < tempPH.pointList.size(); i++) - mathRead(*stream, &tempPH.pointList[i]); + tempPH.mPointList.setSize(size); + for (i = 0; i < tempPH.mPointList.size(); i++) + mathRead(*stream, &tempPH.mPointList[i]); stream->read(&size); - tempPH.planeList.setSize(size); - for (i = 0; i < tempPH.planeList.size(); i++) - mathRead(*stream, &tempPH.planeList[i]); + tempPH.mPlaneList.setSize(size); + for (i = 0; i < tempPH.mPlaneList.size(); i++) + mathRead(*stream, &tempPH.mPlaneList[i]); stream->read(&size); - tempPH.edgeList.setSize(size); - for (i = 0; i < tempPH.edgeList.size(); i++) { - Polyhedron::Edge& rEdge = tempPH.edgeList[i]; + tempPH.mEdgeList.setSize(size); + for (i = 0; i < tempPH.mEdgeList.size(); i++) { + Polyhedron::Edge& rEdge = tempPH.mEdgeList[i]; stream->read(&rEdge.face[0]); stream->read(&rEdge.face[1]); @@ -408,12 +408,12 @@ void PhysicalZone::setPolyhedron(const Polyhedron& rPolyhedron) { mPolyhedron = rPolyhedron; - if (mPolyhedron.pointList.size() != 0) { + if (mPolyhedron.mPointList.size() != 0) { mObjBox.minExtents.set(1e10, 1e10, 1e10); mObjBox.maxExtents.set(-1e10, -1e10, -1e10); - for (U32 i = 0; i < mPolyhedron.pointList.size(); i++) { - mObjBox.minExtents.setMin(mPolyhedron.pointList[i]); - mObjBox.maxExtents.setMax(mPolyhedron.pointList[i]); + for (U32 i = 0; i < mPolyhedron.mPointList.size(); i++) { + mObjBox.minExtents.setMin(mPolyhedron.mPointList[i]); + mObjBox.maxExtents.setMax(mPolyhedron.mPointList[i]); } } else { mObjBox.minExtents.set(-0.5, -0.5, -0.5); @@ -424,7 +424,7 @@ void PhysicalZone::setPolyhedron(const Polyhedron& rPolyhedron) setTransform(xform); mClippedList.clear(); - mClippedList.mPlaneList = mPolyhedron.planeList; + mClippedList.mPlaneList = mPolyhedron.mPlaneList; MatrixF base(true); base.scale(Point3F(1.0/mObjScale.x, @@ -481,7 +481,7 @@ bool PhysicalZone::testObject(SceneObject* enter) // all. And whats the point of building a convex if no collision methods // are implemented? - if (mPolyhedron.pointList.size() == 0) + if (mPolyhedron.mPointList.size() == 0) return false; mClippedList.clear(); diff --git a/Engine/source/T3D/trigger.cpp b/Engine/source/T3D/trigger.cpp index 64305314f..52d6898eb 100644 --- a/Engine/source/T3D/trigger.cpp +++ b/Engine/source/T3D/trigger.cpp @@ -245,16 +245,16 @@ ConsoleGetType( TypeTriggerPolyhedron ) Polyhedron* pPoly = reinterpret_cast(dptr); // First point is corner, need to find the three vectors...` - Point3F origin = pPoly->pointList[0]; + Point3F origin = pPoly->mPointList[0]; U32 currVec = 0; Point3F vecs[3]; - for (i = 0; i < pPoly->edgeList.size(); i++) { - const U32 *vertex = pPoly->edgeList[i].vertex; + for (i = 0; i < pPoly->mEdgeList.size(); i++) { + const U32 *vertex = pPoly->mEdgeList[i].vertex; if (vertex[0] == 0) - vecs[currVec++] = pPoly->pointList[vertex[1]] - origin; + vecs[currVec++] = pPoly->mPointList[vertex[1]] - origin; else if (vertex[1] == 0) - vecs[currVec++] = pPoly->pointList[vertex[0]] - origin; + vecs[currVec++] = pPoly->mPointList[vertex[0]] - origin; } AssertFatal(currVec == 3, "Internal error: Bad trigger polyhedron"); @@ -302,45 +302,45 @@ ConsoleSetType( TypeTriggerPolyhedron ) // edges with CCW instead of CW order for face[0] and that it b) lets plane // normals face outwards rather than inwards. - pPoly->pointList.setSize(8); - pPoly->pointList[0] = origin; - pPoly->pointList[1] = origin + vecs[0]; - pPoly->pointList[2] = origin + vecs[1]; - pPoly->pointList[3] = origin + vecs[2]; - pPoly->pointList[4] = origin + vecs[0] + vecs[1]; - pPoly->pointList[5] = origin + vecs[0] + vecs[2]; - pPoly->pointList[6] = origin + vecs[1] + vecs[2]; - pPoly->pointList[7] = origin + vecs[0] + vecs[1] + vecs[2]; + pPoly->mPointList.setSize(8); + pPoly->mPointList[0] = origin; + pPoly->mPointList[1] = origin + vecs[0]; + pPoly->mPointList[2] = origin + vecs[1]; + pPoly->mPointList[3] = origin + vecs[2]; + pPoly->mPointList[4] = origin + vecs[0] + vecs[1]; + pPoly->mPointList[5] = origin + vecs[0] + vecs[2]; + pPoly->mPointList[6] = origin + vecs[1] + vecs[2]; + pPoly->mPointList[7] = origin + vecs[0] + vecs[1] + vecs[2]; Point3F normal; - pPoly->planeList.setSize(6); + pPoly->mPlaneList.setSize(6); mCross(vecs[2], vecs[0], &normal); - pPoly->planeList[0].set(origin, normal); + pPoly->mPlaneList[0].set(origin, normal); mCross(vecs[0], vecs[1], &normal); - pPoly->planeList[1].set(origin, normal); + pPoly->mPlaneList[1].set(origin, normal); mCross(vecs[1], vecs[2], &normal); - pPoly->planeList[2].set(origin, normal); + pPoly->mPlaneList[2].set(origin, normal); mCross(vecs[1], vecs[0], &normal); - pPoly->planeList[3].set(pPoly->pointList[7], normal); + pPoly->mPlaneList[3].set(pPoly->mPointList[7], normal); mCross(vecs[2], vecs[1], &normal); - pPoly->planeList[4].set(pPoly->pointList[7], normal); + pPoly->mPlaneList[4].set(pPoly->mPointList[7], normal); mCross(vecs[0], vecs[2], &normal); - pPoly->planeList[5].set(pPoly->pointList[7], normal); + pPoly->mPlaneList[5].set(pPoly->mPointList[7], normal); - pPoly->edgeList.setSize(12); - pPoly->edgeList[0].vertex[0] = 0; pPoly->edgeList[0].vertex[1] = 1; pPoly->edgeList[0].face[0] = 0; pPoly->edgeList[0].face[1] = 1; - pPoly->edgeList[1].vertex[0] = 1; pPoly->edgeList[1].vertex[1] = 5; pPoly->edgeList[1].face[0] = 0; pPoly->edgeList[1].face[1] = 4; - pPoly->edgeList[2].vertex[0] = 5; pPoly->edgeList[2].vertex[1] = 3; pPoly->edgeList[2].face[0] = 0; pPoly->edgeList[2].face[1] = 3; - pPoly->edgeList[3].vertex[0] = 3; pPoly->edgeList[3].vertex[1] = 0; pPoly->edgeList[3].face[0] = 0; pPoly->edgeList[3].face[1] = 2; - pPoly->edgeList[4].vertex[0] = 3; pPoly->edgeList[4].vertex[1] = 6; pPoly->edgeList[4].face[0] = 3; pPoly->edgeList[4].face[1] = 2; - pPoly->edgeList[5].vertex[0] = 6; pPoly->edgeList[5].vertex[1] = 2; pPoly->edgeList[5].face[0] = 2; pPoly->edgeList[5].face[1] = 5; - pPoly->edgeList[6].vertex[0] = 2; pPoly->edgeList[6].vertex[1] = 0; pPoly->edgeList[6].face[0] = 2; pPoly->edgeList[6].face[1] = 1; - pPoly->edgeList[7].vertex[0] = 1; pPoly->edgeList[7].vertex[1] = 4; pPoly->edgeList[7].face[0] = 4; pPoly->edgeList[7].face[1] = 1; - pPoly->edgeList[8].vertex[0] = 4; pPoly->edgeList[8].vertex[1] = 2; pPoly->edgeList[8].face[0] = 1; pPoly->edgeList[8].face[1] = 5; - pPoly->edgeList[9].vertex[0] = 4; pPoly->edgeList[9].vertex[1] = 7; pPoly->edgeList[9].face[0] = 4; pPoly->edgeList[9].face[1] = 5; - pPoly->edgeList[10].vertex[0] = 5; pPoly->edgeList[10].vertex[1] = 7; pPoly->edgeList[10].face[0] = 3; pPoly->edgeList[10].face[1] = 4; - pPoly->edgeList[11].vertex[0] = 7; pPoly->edgeList[11].vertex[1] = 6; pPoly->edgeList[11].face[0] = 3; pPoly->edgeList[11].face[1] = 5; + pPoly->mEdgeList.setSize(12); + pPoly->mEdgeList[0].vertex[0] = 0; pPoly->mEdgeList[0].vertex[1] = 1; pPoly->mEdgeList[0].face[0] = 0; pPoly->mEdgeList[0].face[1] = 1; + pPoly->mEdgeList[1].vertex[0] = 1; pPoly->mEdgeList[1].vertex[1] = 5; pPoly->mEdgeList[1].face[0] = 0; pPoly->mEdgeList[1].face[1] = 4; + pPoly->mEdgeList[2].vertex[0] = 5; pPoly->mEdgeList[2].vertex[1] = 3; pPoly->mEdgeList[2].face[0] = 0; pPoly->mEdgeList[2].face[1] = 3; + pPoly->mEdgeList[3].vertex[0] = 3; pPoly->mEdgeList[3].vertex[1] = 0; pPoly->mEdgeList[3].face[0] = 0; pPoly->mEdgeList[3].face[1] = 2; + pPoly->mEdgeList[4].vertex[0] = 3; pPoly->mEdgeList[4].vertex[1] = 6; pPoly->mEdgeList[4].face[0] = 3; pPoly->mEdgeList[4].face[1] = 2; + pPoly->mEdgeList[5].vertex[0] = 6; pPoly->mEdgeList[5].vertex[1] = 2; pPoly->mEdgeList[5].face[0] = 2; pPoly->mEdgeList[5].face[1] = 5; + pPoly->mEdgeList[6].vertex[0] = 2; pPoly->mEdgeList[6].vertex[1] = 0; pPoly->mEdgeList[6].face[0] = 2; pPoly->mEdgeList[6].face[1] = 1; + pPoly->mEdgeList[7].vertex[0] = 1; pPoly->mEdgeList[7].vertex[1] = 4; pPoly->mEdgeList[7].face[0] = 4; pPoly->mEdgeList[7].face[1] = 1; + pPoly->mEdgeList[8].vertex[0] = 4; pPoly->mEdgeList[8].vertex[1] = 2; pPoly->mEdgeList[8].face[0] = 1; pPoly->mEdgeList[8].face[1] = 5; + pPoly->mEdgeList[9].vertex[0] = 4; pPoly->mEdgeList[9].vertex[1] = 7; pPoly->mEdgeList[9].face[0] = 4; pPoly->mEdgeList[9].face[1] = 5; + pPoly->mEdgeList[10].vertex[0] = 5; pPoly->mEdgeList[10].vertex[1] = 7; pPoly->mEdgeList[10].face[0] = 3; pPoly->mEdgeList[10].face[1] = 4; + pPoly->mEdgeList[11].vertex[0] = 7; pPoly->mEdgeList[11].vertex[1] = 6; pPoly->mEdgeList[11].face[0] = 3; pPoly->mEdgeList[11].face[1] = 5; } @@ -569,12 +569,12 @@ void Trigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron) { mTriggerPolyhedron = rPolyhedron; - if (mTriggerPolyhedron.pointList.size() != 0) { + if (mTriggerPolyhedron.mPointList.size() != 0) { mObjBox.minExtents.set(1e10, 1e10, 1e10); mObjBox.maxExtents.set(-1e10, -1e10, -1e10); - for (U32 i = 0; i < mTriggerPolyhedron.pointList.size(); i++) { - mObjBox.minExtents.setMin(mTriggerPolyhedron.pointList[i]); - mObjBox.maxExtents.setMax(mTriggerPolyhedron.pointList[i]); + for (U32 i = 0; i < mTriggerPolyhedron.mPointList.size(); i++) { + mObjBox.minExtents.setMin(mTriggerPolyhedron.mPointList[i]); + mObjBox.maxExtents.setMax(mTriggerPolyhedron.mPointList[i]); } } else { mObjBox.minExtents.set(-0.5, -0.5, -0.5); @@ -585,7 +585,7 @@ void Trigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron) setTransform(xform); mClippedList.clear(); - mClippedList.mPlaneList = mTriggerPolyhedron.planeList; + mClippedList.mPlaneList = mTriggerPolyhedron.mPlaneList; // for (U32 i = 0; i < mClippedList.mPlaneList.size(); i++) // mClippedList.mPlaneList[i].neg(); @@ -623,7 +623,7 @@ void Trigger::setTriggerPolyhedron(const Polyhedron& rPolyhedron) bool Trigger::testObject(GameBase* enter) { - if (mTriggerPolyhedron.pointList.size() == 0) + if (mTriggerPolyhedron.mPointList.size() == 0) return false; mClippedList.clear(); @@ -731,17 +731,17 @@ U32 Trigger::packUpdate(NetConnection* con, U32 mask, BitStream* stream) // Write the polyhedron if( stream->writeFlag( mask & PolyMask ) ) { - stream->write(mTriggerPolyhedron.pointList.size()); - for (i = 0; i < mTriggerPolyhedron.pointList.size(); i++) - mathWrite(*stream, mTriggerPolyhedron.pointList[i]); + stream->write(mTriggerPolyhedron.mPointList.size()); + for (i = 0; i < mTriggerPolyhedron.mPointList.size(); i++) + mathWrite(*stream, mTriggerPolyhedron.mPointList[i]); - stream->write(mTriggerPolyhedron.planeList.size()); - for (i = 0; i < mTriggerPolyhedron.planeList.size(); i++) - mathWrite(*stream, mTriggerPolyhedron.planeList[i]); + stream->write(mTriggerPolyhedron.mPlaneList.size()); + for (i = 0; i < mTriggerPolyhedron.mPlaneList.size(); i++) + mathWrite(*stream, mTriggerPolyhedron.mPlaneList[i]); - stream->write(mTriggerPolyhedron.edgeList.size()); - for (i = 0; i < mTriggerPolyhedron.edgeList.size(); i++) { - const Polyhedron::Edge& rEdge = mTriggerPolyhedron.edgeList[i]; + stream->write(mTriggerPolyhedron.mEdgeList.size()); + for (i = 0; i < mTriggerPolyhedron.mEdgeList.size(); i++) { + const Polyhedron::Edge& rEdge = mTriggerPolyhedron.mEdgeList[i]; stream->write(rEdge.face[0]); stream->write(rEdge.face[1]); @@ -779,19 +779,19 @@ void Trigger::unpackUpdate(NetConnection* con, BitStream* stream) { Polyhedron tempPH; stream->read(&size); - tempPH.pointList.setSize(size); - for (i = 0; i < tempPH.pointList.size(); i++) - mathRead(*stream, &tempPH.pointList[i]); + tempPH.mPointList.setSize(size); + for (i = 0; i < tempPH.mPointList.size(); i++) + mathRead(*stream, &tempPH.mPointList[i]); stream->read(&size); - tempPH.planeList.setSize(size); - for (i = 0; i < tempPH.planeList.size(); i++) - mathRead(*stream, &tempPH.planeList[i]); + tempPH.mPlaneList.setSize(size); + for (i = 0; i < tempPH.mPlaneList.size(); i++) + mathRead(*stream, &tempPH.mPlaneList[i]); stream->read(&size); - tempPH.edgeList.setSize(size); - for (i = 0; i < tempPH.edgeList.size(); i++) { - Polyhedron::Edge& rEdge = tempPH.edgeList[i]; + tempPH.mEdgeList.setSize(size); + for (i = 0; i < tempPH.mEdgeList.size(); i++) { + Polyhedron::Edge& rEdge = tempPH.mEdgeList[i]; stream->read(&rEdge.face[0]); stream->read(&rEdge.face[1]); diff --git a/Engine/source/collision/extrudedPolyList.cpp b/Engine/source/collision/extrudedPolyList.cpp index 0e3b744a8..24de5af29 100644 --- a/Engine/source/collision/extrudedPolyList.cpp +++ b/Engine/source/collision/extrudedPolyList.cpp @@ -72,11 +72,11 @@ void ExtrudedPolyList::extrude(const Polyhedron& pt, const VectorF& vector) mPolyPlaneList.clear(); // Determine which faces will be extruded. - mExtrudedList.setSize(pt.planeList.size()); + mExtrudedList.setSize(pt.mPlaneList.size()); - for (U32 f = 0; f < pt.planeList.size(); f++) + for (U32 f = 0; f < pt.mPlaneList.size(); f++) { - const PlaneF& face = pt.planeList[f]; + const PlaneF& face = pt.mPlaneList[f]; ExtrudedFace& eface = mExtrudedList[f]; F32 dot = mDot(face,vector); eface.active = dot > EqualEpsilon; @@ -96,9 +96,9 @@ void ExtrudedPolyList::extrude(const Polyhedron& pt, const VectorF& vector) } // Produce extruded planes for bounding and internal edges - for (U32 e = 0; e < pt.edgeList.size(); e++) + for (U32 e = 0; e < pt.mEdgeList.size(); e++) { - Polyhedron::Edge const& edge = pt.edgeList[e]; + Polyhedron::Edge const& edge = pt.mEdgeList[e]; ExtrudedFace& ef1 = mExtrudedList[edge.face[0]]; ExtrudedFace& ef2 = mExtrudedList[edge.face[1]]; if (ef1.active || ef2.active) @@ -106,8 +106,8 @@ void ExtrudedPolyList::extrude(const Polyhedron& pt, const VectorF& vector) // Assumes that the edge points are clockwise // for face[0]. - const Point3F& p1 = pt.pointList[edge.vertex[1]]; - const Point3F &p2 = pt.pointList[edge.vertex[0]]; + const Point3F& p1 = pt.mPointList[edge.vertex[1]]; + const Point3F &p2 = pt.mPointList[edge.vertex[0]]; Point3F p3 = p2 + vector; mPlaneList.increment(2); diff --git a/Engine/source/collision/optimizedPolyList.cpp b/Engine/source/collision/optimizedPolyList.cpp index 6d56332b4..d8a1704c7 100644 --- a/Engine/source/collision/optimizedPolyList.cpp +++ b/Engine/source/collision/optimizedPolyList.cpp @@ -370,12 +370,12 @@ Polyhedron OptimizedPolyList::toPolyhedron() const for( U32 i = 0; i < numPoints; ++ i ) { bool isDuplicate = false; - for( U32 npoint = 0; npoint < polyhedron.pointList.size(); ++ npoint ) + for( U32 npoint = 0; npoint < polyhedron.mPointList.size(); ++ npoint ) { if( npoint == i ) continue; - if( !polyhedron.pointList[ npoint ].equal( mPoints[ i ] ) ) + if( !polyhedron.mPointList[ npoint ].equal( mPoints[ i ] ) ) continue; pointRemap[ i ] = npoint; @@ -384,8 +384,8 @@ Polyhedron OptimizedPolyList::toPolyhedron() const if( !isDuplicate ) { - pointRemap[ i ] = polyhedron.pointList.size(); - polyhedron.pointList.push_back( mPoints[ i ] ); + pointRemap[ i ] = polyhedron.mPointList.size(); + polyhedron.mPointList.push_back( mPoints[ i ] ); } } @@ -399,13 +399,13 @@ Polyhedron OptimizedPolyList::toPolyhedron() const // Add the plane. - const U32 polyIndex = polyhedron.planeList.size(); - polyhedron.planeList.push_back( mPlaneList[ poly.plane ] ); + const U32 polyIndex = polyhedron.mPlaneList.size(); + polyhedron.mPlaneList.push_back( mPlaneList[ poly.plane ] ); // Account for polyhedrons expecting planes to // face inwards. - polyhedron.planeList.last().invert(); + polyhedron.mPlaneList.last().invert(); // Gather remapped indices according to the // current polygon type. @@ -500,7 +500,7 @@ Polyhedron OptimizedPolyList::toPolyhedron() const U32 lastIndex = 0; for( S32 n = indexList.size() - 1; n >= 0; -- n ) { - polyhedron.edgeList.push_back( + polyhedron.mEdgeList.push_back( Polyhedron::Edge( polyIndex, 0, // face1 filled later indexList[ lastIndex ], indexList[ n ] @@ -514,16 +514,16 @@ Polyhedron OptimizedPolyList::toPolyhedron() const // Finally, consolidate the edge list by merging all edges that // are shared by polygons. - for( U32 i = 0; i < polyhedron.edgeList.size(); ++ i ) + for( U32 i = 0; i < polyhedron.mEdgeList.size(); ++ i ) { - Polyhedron::Edge& edge = polyhedron.edgeList[ i ]; + Polyhedron::Edge& edge = polyhedron.mEdgeList[ i ]; // Find the corresponding duplicate edge, if any, and merge // it into our current edge. - for( U32 n = i + 1; n < polyhedron.edgeList.size(); ++ n ) + for( U32 n = i + 1; n < polyhedron.mEdgeList.size(); ++ n ) { - const Polyhedron::Edge& thisEdge = polyhedron.edgeList[ n ]; + const Polyhedron::Edge& thisEdge = polyhedron.mEdgeList[ n ]; if( ( thisEdge.vertex[ 0 ] == edge.vertex[ 1 ] && thisEdge.vertex[ 1 ] == edge.vertex[ 0 ] ) || @@ -531,7 +531,7 @@ Polyhedron OptimizedPolyList::toPolyhedron() const thisEdge.vertex[ 1 ] == edge.vertex[ 1 ] ) ) { edge.face[ 1 ] = thisEdge.face[ 0 ]; - polyhedron.edgeList.erase( n ); + polyhedron.mEdgeList.erase( n ); break; } } diff --git a/Engine/source/math/mPolyhedron.cpp b/Engine/source/math/mPolyhedron.cpp index c9b1e60a3..7a1b75c97 100644 --- a/Engine/source/math/mPolyhedron.cpp +++ b/Engine/source/math/mPolyhedron.cpp @@ -137,8 +137,8 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes ) S32 v1index = -1; bool v1Existed = false; - for( U32 nvert = 0; nvert < pointList.size(); ++ nvert ) - if( pointList[ nvert ].equal( v1, 0.001f ) ) + for( U32 nvert = 0; nvert < mPointList.size(); ++ nvert ) + if(mPointList[ nvert ].equal( v1, 0.001f ) ) { v1index = nvert; v1Existed = true; @@ -149,8 +149,8 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes ) S32 v2index = -1; bool v2Existed = false; - for( U32 nvert = 0; nvert < pointList.size(); ++ nvert ) - if( pointList[ nvert ].equal( v2, 0.001f ) ) + for( U32 nvert = 0; nvert < mPointList.size(); ++ nvert ) + if(mPointList[ nvert ].equal( v2, 0.001f ) ) { v2index = nvert; v2Existed = true; @@ -161,30 +161,30 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes ) if( !v1Existed ) { - v1index = pointList.size(); - pointList.push_back( v1 ); + v1index = mPointList.size(); + mPointList.push_back( v1 ); } // Add vertex 2, if necessary. if( !v2Existed ) { - v2index = pointList.size(); - pointList.push_back( v2 ); + v2index = mPointList.size(); + mPointList.push_back( v2 ); } // If both v1 and v2 already existed in the point // set, this must be an edge that we are sharing so try // to find it. - const U32 thisPlaneIndex = planeList.size(); + const U32 thisPlaneIndex = mPlaneList.size(); bool foundExistingEdge = false; if( v1Existed && v2Existed ) { - for( U32 nedge = 0; nedge < edgeList.size(); ++ nedge ) + for( U32 nedge = 0; nedge < mEdgeList.size(); ++ nedge ) { - Edge& edge = edgeList[ nedge ]; + Edge& edge = mEdgeList[ nedge ]; if( ( edge.vertex[ 0 ] == v1index && edge.vertex[ 1 ] == v2index ) || ( edge.vertex[ 0 ] == v2index && edge.vertex[ 1 ] == v1index ) ) @@ -222,13 +222,13 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes ) if( !invert ) { - edgeList.push_back( + mEdgeList.push_back( Edge( thisPlaneIndex, 0, v1index, v2index ) ); } else { - edgeList.push_back( + mEdgeList.push_back( Edge( thisPlaneIndex, 0, v2index, v1index ) ); } @@ -242,6 +242,6 @@ void PolyhedronVectorData::buildFromPlanes( const PlaneSetF& planes ) // If this plane produced edges, add it. if( haveEdges ) - planeList.push_back( currentPlane ); + mPlaneList.push_back( currentPlane ); } } diff --git a/Engine/source/math/mPolyhedron.h b/Engine/source/math/mPolyhedron.h index dbb874817..e7054423f 100644 --- a/Engine/source/math/mPolyhedron.h +++ b/Engine/source/math/mPolyhedron.h @@ -124,42 +124,42 @@ struct PolyhedronVectorData : public PolyhedronData typedef Vector< Edge > EdgeListType; /// List of planes. Note that by default, the normals facing *inwards*. - PlaneListType planeList; + PlaneListType mPlaneList; /// List of vertices. - PointListType pointList; + PointListType mPointList; /// List of edges. - EdgeListType edgeList; + EdgeListType mEdgeList; PolyhedronVectorData() { - VECTOR_SET_ASSOCIATION( pointList ); - VECTOR_SET_ASSOCIATION( planeList ); - VECTOR_SET_ASSOCIATION( edgeList ); + VECTOR_SET_ASSOCIATION(mPointList); + VECTOR_SET_ASSOCIATION(mPlaneList); + VECTOR_SET_ASSOCIATION(mEdgeList); } /// @name Accessors /// @{ /// Return the number of planes that make up this polyhedron. - U32 getNumPlanes() const { return planeList.size(); } + U32 getNumPlanes() const { return mPlaneList.size(); } /// Return the planes that make up the polyhedron. /// @note The normals of these planes are facing *inwards*. - PlaneF* getPlanes() const { return planeList.address(); } + PlaneF* getPlanes() const { return mPlaneList.address(); } /// Return the number of points that this polyhedron has. - U32 getNumPoints() const { return pointList.size(); } + U32 getNumPoints() const { return mPointList.size(); } /// - Point3F* getPoints() const { return pointList.address(); } + Point3F* getPoints() const { return mPointList.address(); } /// Return the number of edges that this polyhedron has. - U32 getNumEdges() const { return edgeList.size(); } + U32 getNumEdges() const { return mEdgeList.size(); } /// - Edge* getEdges() const { return edgeList.address(); } + Edge* getEdges() const { return mEdgeList.address(); } /// @} @@ -168,9 +168,9 @@ struct PolyhedronVectorData : public PolyhedronData void buildBox( const MatrixF& mat, const Box3F& box, bool invertNormals = false ) { - pointList.setSize( 8 ); - planeList.setSize( 6 ); - edgeList.setSize( 12 ); + mPointList.setSize( 8 ); + mPlaneList.setSize( 6 ); + mEdgeList.setSize( 12 ); buildBoxData( *this, mat, box, invertNormals ); } @@ -190,13 +190,13 @@ struct PolyhedronUnmanagedVectorData : public PolyhedronData protected: /// List of planes. Note that by default, the normals facing *inwards*. - PlaneListType planeList; + PlaneListType mPlaneList; /// List of vertices. - PointListType pointList; + PointListType mPointList; /// List of edges. - EdgeListType edgeList; + EdgeListType mEdgeList; public: @@ -204,26 +204,26 @@ struct PolyhedronUnmanagedVectorData : public PolyhedronData /// @{ /// Return the number of planes that make up this polyhedron. - U32 getNumPlanes() const { return planeList.size(); } + U32 getNumPlanes() const { return mPlaneList.size(); } /// Return the planes that make up the polyhedron. /// @note The normals of these planes are facing *inwards*. - const PlaneF* getPlanes() const { return planeList.address(); } - PlaneF* getPlanes() { return planeList.address(); } + const PlaneF* getPlanes() const { return mPlaneList.address(); } + PlaneF* getPlanes() { return mPlaneList.address(); } /// Return the number of points that this polyhedron has. - U32 getNumPoints() const { return pointList.size(); } + U32 getNumPoints() const { return mPointList.size(); } /// - const Point3F* getPoints() const { return pointList.address(); } - Point3F* getPoints() { return pointList.address(); } + const Point3F* getPoints() const { return mPointList.address(); } + Point3F* getPoints() { return mPointList.address(); } /// Return the number of edges that this polyhedron has. - U32 getNumEdges() const { return edgeList.size(); } + U32 getNumEdges() const { return mEdgeList.size(); } /// - const Edge* getEdges() const { return edgeList.address(); } - Edge* getEdges() { return edgeList.address(); } + const Edge* getEdges() const { return mEdgeList.address(); } + Edge* getEdges() { return mEdgeList.address(); } /// @} }; @@ -239,13 +239,13 @@ struct PolyhedronFixedVectorData : public PolyhedronData protected: /// List of planes. Note that by default, the normals facing *inwards*. - PlaneListType planeList; + PlaneListType mPlaneList; /// List of vertices. - PointListType pointList; + PointListType mPointList; /// List of edges. - EdgeListType edgeList; + EdgeListType mEdgeList; public: @@ -302,9 +302,9 @@ struct PolyhedronImpl : public Base /// Construct a polyhedron described by the given planes and edges. PolyhedronImpl( PlaneListType planes, PointListType points, EdgeListType edges ) { - this->planeList = planes; - this->pointList = points; - this->edgeList = edges; + this->mPlaneList = planes; + this->mPointList = points; + this->mEdgeList = edges; } /// Return the AABB around the polyhedron. diff --git a/Engine/source/math/mPolyhedron.impl.h b/Engine/source/math/mPolyhedron.impl.h index 796f11350..bb7f199c1 100644 --- a/Engine/source/math/mPolyhedron.impl.h +++ b/Engine/source/math/mPolyhedron.impl.h @@ -462,7 +462,7 @@ void PolyhedronData::buildBoxData( Polyhedron& poly, const MatrixF& mat, const B // Corner points. - typename Polyhedron::PointListType& pointList = poly.pointList; + typename Polyhedron::PointListType& pointList = poly.mPointList; pointList[ 0 ] = min; // near left bottom pointList[ 1 ] = min + yvec; // far left bottom @@ -475,7 +475,7 @@ void PolyhedronData::buildBoxData( Polyhedron& poly, const MatrixF& mat, const B // Side planes. - typename Polyhedron::PlaneListType& planeList = poly.planeList; + typename Polyhedron::PlaneListType& planeList = poly.mPlaneList; const F32 pos = invertNormals ? -1.f : 1.f; const F32 neg = - pos; @@ -490,7 +490,7 @@ void PolyhedronData::buildBoxData( Polyhedron& poly, const MatrixF& mat, const B // The edges are constructed so that the vertices // are oriented clockwise for face[0]. - typename Polyhedron::EdgeType* edge = &poly.edgeList[ 0 ]; + typename Polyhedron::EdgeType* edge = &poly.mEdgeList[ 0 ]; for( U32 i = 0; i < 4; ++ i ) { diff --git a/Engine/source/scene/mixin/scenePolyhedralObject.impl.h b/Engine/source/scene/mixin/scenePolyhedralObject.impl.h index b01eb9691..4ce8998f0 100644 --- a/Engine/source/scene/mixin/scenePolyhedralObject.impl.h +++ b/Engine/source/scene/mixin/scenePolyhedralObject.impl.h @@ -215,27 +215,27 @@ void ScenePolyhedralObject< Base, P >::unpackUpdate( NetConnection* connection, // Read planes. const U32 numPlanes = stream->readInt( 8 ); - mPolyhedron.planeList.setSize( numPlanes ); + mPolyhedron.mPlaneList.setSize( numPlanes ); for( U32 i = 0; i < numPlanes; ++ i ) - mathRead( *stream, &mPolyhedron.planeList[ i ] ); + mathRead( *stream, &mPolyhedron.mPlaneList[ i ] ); // Read points. const U32 numPoints = stream->readInt( 8 ); - mPolyhedron.pointList.setSize( numPoints ); + mPolyhedron.mPointList.setSize( numPoints ); for( U32 i = 0; i < numPoints; ++ i ) - mathRead( *stream, &mPolyhedron.pointList[ i ] ); + mathRead( *stream, &mPolyhedron.mPointList[ i ] ); // Read edges. const U32 numEdges = stream->readInt( 8 ); - mPolyhedron.edgeList.setSize( numEdges ); + mPolyhedron.mEdgeList.setSize( numEdges ); for( U32 i = 0; i < numEdges; ++ i ) { - typename PolyhedronType::EdgeType& edge = mPolyhedron.edgeList[ i ]; + typename PolyhedronType::EdgeType& edge = mPolyhedron.mEdgeList[ i ]; edge.face[ 0 ] = stream->readInt( 8 ); edge.face[ 1 ] = stream->readInt( 8 ); @@ -344,7 +344,7 @@ bool ScenePolyhedralObject< Base, P >::_setPlane( void* object, const char* inde &plane.d ); - obj->mPolyhedron.planeList.push_back( plane ); + obj->mPolyhedron.mPlaneList.push_back( plane ); obj->setMaskBits( PolyMask ); obj->mIsBox = false; @@ -366,7 +366,7 @@ bool ScenePolyhedralObject< Base, P >::_setPoint( void* object, const char* inde &point[ 2 ] ); - obj->mPolyhedron.pointList.push_back( point ); + obj->mPolyhedron.mPointList.push_back( point ); obj->setMaskBits( PolyMask ); obj->mIsBox = false; @@ -389,7 +389,7 @@ bool ScenePolyhedralObject< Base, P >::_setEdge( void* object, const char* index &edge.vertex[ 1 ] ); - obj->mPolyhedron.edgeList.push_back( edge ); + obj->mPolyhedron.mEdgeList.push_back( edge ); obj->setMaskBits( PolyMask ); obj->mIsBox = false; diff --git a/Engine/source/scene/sceneContainer.cpp b/Engine/source/scene/sceneContainer.cpp index 66722a079..0d2573b27 100644 --- a/Engine/source/scene/sceneContainer.cpp +++ b/Engine/source/scene/sceneContainer.cpp @@ -586,10 +586,10 @@ void SceneContainer::polyhedronFindObjects(const Polyhedron& polyhedron, U32 mas Box3F box; box.minExtents.set(1e9, 1e9, 1e9); box.maxExtents.set(-1e9, -1e9, -1e9); - for (i = 0; i < polyhedron.pointList.size(); i++) + for (i = 0; i < polyhedron.mPointList.size(); i++) { - box.minExtents.setMin(polyhedron.pointList[i]); - box.maxExtents.setMax(polyhedron.pointList[i]); + box.minExtents.setMin(polyhedron.mPointList[i]); + box.maxExtents.setMax(polyhedron.mPointList[i]); } if ( mask == WaterObjectType || From 300d9eefbf3302fcb4530e21b3a4ea9ac6f82f80 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 15:45:45 -0500 Subject: [PATCH 054/144] ease member vars tagged as member vars --- Engine/source/math/mEase.cpp | 146 +++++++++++++++---------------- Engine/source/math/mEase.h | 6 +- Engine/source/math/mathIO.h | 16 ++-- Engine/source/math/mathTypes.cpp | 8 +- 4 files changed, 88 insertions(+), 88 deletions(-) diff --git a/Engine/source/math/mEase.cpp b/Engine/source/math/mEase.cpp index 0eca22fef..e1ff97d5f 100644 --- a/Engine/source/math/mEase.cpp +++ b/Engine/source/math/mEase.cpp @@ -6,158 +6,158 @@ EaseF::EaseF() { - dir = 0; - type = 0; - param[0] = param[1] = -1.0f; + mDir = 0; + mType = 0; + mParam[0] = mParam[1] = -1.0f; } EaseF::EaseF(const EaseF &ease) { - this->dir = ease.dir; - this->type = ease.type; - this->param[0] = ease.param[0]; - this->param[1] = ease.param[1]; + this->mDir = ease.mDir; + this->mType = ease.mType; + this->mParam[0] = ease.mParam[0]; + this->mParam[1] = ease.mParam[1]; } EaseF::EaseF(const S32 dir, const S32 type) { - this->dir = dir; - this->type = type; - this->param[0] = this->param[1] = -1.0f; + this->mDir = dir; + this->mType = type; + this->mParam[0] = this->mParam[1] = -1.0f; } EaseF::EaseF(const S32 dir, const S32 type, F32 param[2]) { - this->dir = dir; - this->type = type; - this->param[0] = param[0]; - this->param[1] = param[1]; + this->mDir = dir; + this->mType = type; + this->mParam[0] = param[0]; + this->mParam[1] = param[1]; } void EaseF::set(const S32 dir, const S32 type) { - this->dir = dir; - this->type = type; - this->param[0] = this->param[1] = -1.0f; + this->mDir = dir; + this->mType = type; + this->mParam[0] = this->mParam[1] = -1.0f; } void EaseF::set(const S32 dir, const S32 type, F32 param[2]) { - this->dir = dir; - this->type = type; - this->param[0] = param[0]; - this->param[1] = param[1]; + this->mDir = dir; + this->mType = type; + this->mParam[0] = param[0]; + this->mParam[1] = param[1]; } void EaseF::set(const S32 dir, const S32 type, F32 param0, F32 param1) { - this->dir = dir; - this->type = type; - this->param[0] = param0; - this->param[1] = param1; + this->mDir = dir; + this->mType = type; + this->mParam[0] = param0; + this->mParam[1] = param1; } void EaseF::set(const char *s) { - dSscanf(s,"%d %d %f %f",&dir,&type,¶m[0],¶m[1]); + dSscanf(s,"%d %d %f %f",&mDir,&mType,&mParam[0],&mParam[1]); } F32 EaseF::getValue(F32 t, F32 b, F32 c, F32 d) const { F32 value = 0; - if (type == Ease::Linear) + if (mType == Ease::Linear) { value = mLinearTween(t,b, c, d); } - else if (type == Ease::Quadratic) + else if (mType == Ease::Quadratic) { - if (dir == Ease::In) + if (mDir == Ease::In) value = mEaseInQuad(t,b, c, d); - else if (dir == Ease::Out) + else if (mDir == Ease::Out) value = mEaseOutQuad(t,b, c, d); - else if (dir == Ease::InOut) + else if (mDir == Ease::InOut) value = mEaseInOutQuad(t,b, c, d); } - else if (type == Ease::Cubic) + else if (mType == Ease::Cubic) { - if (dir == Ease::In) + if (mDir == Ease::In) value = mEaseInCubic(t,b, c, d); - else if (dir == Ease::Out) + else if (mDir == Ease::Out) value = mEaseOutCubic(t,b, c, d); - else if (dir == Ease::InOut) + else if (mDir == Ease::InOut) value = mEaseInOutCubic(t,b, c, d); } - else if (type == Ease::Quartic) + else if (mType == Ease::Quartic) { - if (dir == Ease::In) + if (mDir == Ease::In) value = mEaseInQuart(t,b, c, d); - else if (dir == Ease::Out) + else if (mDir == Ease::Out) value = mEaseOutQuart(t,b, c, d); - else if (dir == Ease::InOut) + else if (mDir == Ease::InOut) value = mEaseInOutQuart(t,b, c, d); } - else if (type == Ease::Quintic) + else if (mType == Ease::Quintic) { - if (dir == Ease::In) + if (mDir == Ease::In) value = mEaseInQuint(t,b, c, d); - else if (dir == Ease::Out) + else if (mDir == Ease::Out) value = mEaseOutQuint(t,b, c, d); - else if (dir == Ease::InOut) + else if (mDir == Ease::InOut) value = mEaseInOutQuint(t,b, c, d); } - else if (type == Ease::Sinusoidal) + else if (mType == Ease::Sinusoidal) { - if (dir == Ease::In) + if (mDir == Ease::In) value = mEaseInSine(t,b, c, d); - else if (dir == Ease::Out) + else if (mDir == Ease::Out) value = mEaseOutSine(t,b, c, d); - else if (dir == Ease::InOut) + else if (mDir == Ease::InOut) value = mEaseInOutSine(t,b, c, d); } - else if (type == Ease::Exponential) + else if (mType == Ease::Exponential) { - if (dir == Ease::In) + if (mDir == Ease::In) value = mEaseInExpo(t,b, c, d); - else if (dir == Ease::Out) + else if (mDir == Ease::Out) value = mEaseOutExpo(t,b, c, d); - else if (dir == Ease::InOut) + else if (mDir == Ease::InOut) value = mEaseInOutExpo(t,b, c, d); } - else if (type == Ease::Circular) + else if (mType == Ease::Circular) { - if (dir == Ease::In) + if (mDir == Ease::In) value = mEaseInCirc(t,b, c, d); - else if (dir == Ease::Out) + else if (mDir == Ease::Out) value = mEaseOutCirc(t,b, c, d); - else if (dir == Ease::InOut) + else if (mDir == Ease::InOut) value = mEaseInOutCirc(t,b, c, d); } - else if (type == Ease::Elastic) + else if (mType == Ease::Elastic) { - if (dir == Ease::In) - value = mEaseInElastic(t,b, c, d, param[0], param[1]); - else if (dir == Ease::Out) - value = mEaseOutElastic(t,b, c, d, param[0], param[1]); - else if (dir == Ease::InOut) - value = mEaseInOutElastic(t,b, c, d, param[0], param[1]); + if (mDir == Ease::In) + value = mEaseInElastic(t,b, c, d, mParam[0], mParam[1]); + else if (mDir == Ease::Out) + value = mEaseOutElastic(t,b, c, d, mParam[0], mParam[1]); + else if (mDir == Ease::InOut) + value = mEaseInOutElastic(t,b, c, d, mParam[0], mParam[1]); } - else if (type == Ease::Back) + else if (mType == Ease::Back) { - if (dir == Ease::In) - value = mEaseInBack(t,b, c, d, param[0]); - else if (dir == Ease::Out) - value = mEaseOutBack(t,b, c, d, param[0]); - else if (dir == Ease::InOut) - value = mEaseInOutBack(t,b, c, d, param[0]); + if (mDir == Ease::In) + value = mEaseInBack(t,b, c, d, mParam[0]); + else if (mDir == Ease::Out) + value = mEaseOutBack(t,b, c, d, mParam[0]); + else if (mDir == Ease::InOut) + value = mEaseInOutBack(t,b, c, d, mParam[0]); } - else if (type == Ease::Bounce) + else if (mType == Ease::Bounce) { - if (dir == Ease::In) + if (mDir == Ease::In) value = mEaseInBounce(t,b, c, d); - else if (dir == Ease::Out) + else if (mDir == Ease::Out) value = mEaseOutBounce(t,b, c, d); - else if (dir == Ease::InOut) + else if (mDir == Ease::InOut) value = mEaseInOutBounce(t,b, c, d); } else diff --git a/Engine/source/math/mEase.h b/Engine/source/math/mEase.h index 8689f7fbb..33dcb1467 100644 --- a/Engine/source/math/mEase.h +++ b/Engine/source/math/mEase.h @@ -76,9 +76,9 @@ class EaseF : public Ease { //-------------------------------------- Public data public: - S32 dir; // inout, in, out - S32 type; // linear, etc... - F32 param[2]; // optional params + S32 mDir; // inout, in, out + S32 mType; // linear, etc... + F32 mParam[2]; // optional params //-------------------------------------- Public interface public: diff --git a/Engine/source/math/mathIO.h b/Engine/source/math/mathIO.h index 6acbc1b52..23fdfe438 100644 --- a/Engine/source/math/mathIO.h +++ b/Engine/source/math/mathIO.h @@ -142,10 +142,10 @@ inline bool mathRead(Stream& stream, QuatF* q) inline bool mathRead(Stream& stream, EaseF* e) { - bool success = stream.read( &e->dir ); - success &= stream.read( &e->type ); - success &= stream.read( &e->param[ 0 ] ); - success &= stream.read( &e->param[ 1 ] ); + bool success = stream.read( &e->mDir ); + success &= stream.read( &e->mType ); + success &= stream.read( &e->mParam[ 0 ] ); + success &= stream.read( &e->mParam[ 1 ] ); return success; } @@ -270,10 +270,10 @@ inline bool mathWrite(Stream& stream, const QuatF& q) inline bool mathWrite(Stream& stream, const EaseF& e) { - bool success = stream.write(e.dir); - success &= stream.write(e.type); - success &= stream.write(e.param[0]); - success &= stream.write(e.param[1]); + bool success = stream.write(e.mDir); + success &= stream.write(e.mType); + success &= stream.write(e.mParam[0]); + success &= stream.write(e.mParam[1]); return success; } diff --git a/Engine/source/math/mathTypes.cpp b/Engine/source/math/mathTypes.cpp index 1d1011d0f..7f3e44225 100644 --- a/Engine/source/math/mathTypes.cpp +++ b/Engine/source/math/mathTypes.cpp @@ -557,7 +557,7 @@ ConsoleGetType( TypeEaseF ) static const U32 bufSize = 256; char* returnBuffer = Con::getReturnBuffer(bufSize); dSprintf(returnBuffer, bufSize, "%d %d %g %g", - pEase->dir, pEase->type, pEase->param[0], pEase->param[1]); + pEase->mDir, pEase->mType, pEase->mParam[0], pEase->mParam[1]); return returnBuffer; } @@ -567,11 +567,11 @@ ConsoleSetType( TypeEaseF ) EaseF* pDst = (EaseF*)dptr; // defaults... - pDst->param[0] = -1.0f; - pDst->param[1] = -1.0f; + pDst->mParam[0] = -1.0f; + pDst->mParam[1] = -1.0f; if (argc == 1) { U32 args = dSscanf(argv[0], "%d %d %f %f", // the two params are optional and assumed -1 if not present... - &pDst->dir, &pDst->type, &pDst->param[0],&pDst->param[1]); + &pDst->mDir, &pDst->mType, &pDst->mParam[0],&pDst->mParam[1]); if( args < 2 ) Con::warnf( "Warning, EaseF probably not read properly" ); } else { From cffc9d3afe364a3e2ba6493365c57539ee546600 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 17:38:44 -0500 Subject: [PATCH 055/144] doubleup on Q defintion for baycentric coord calcs --- Engine/source/math/mathUtils.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/math/mathUtils.cpp b/Engine/source/math/mathUtils.cpp index dfc418deb..98ab052ed 100644 --- a/Engine/source/math/mathUtils.cpp +++ b/Engine/source/math/mathUtils.cpp @@ -1086,9 +1086,9 @@ bool mRayQuadCollide( const Quad &quad, - (beta * (alpha_11 - 1.0f)) - 1.0f; F32 C = alpha; F32 D = (B * B) - (4.0f * A * C); - F32 Q = -0.5f * (B + (B < 0.0f ? -1.0f : 1.0f) ) * mSqrt(D); - u = Q / A; - if ((u < 0.0f) || (u > 1.0f)) u = C / Q; + F32 F = -0.5f * (B + (B < 0.0f ? -1.0f : 1.0f) ) * mSqrt(D); + u = F / A; + if ((u < 0.0f) || (u > 1.0f)) u = C / F; v = beta / ((u * (beta_11 - 1.0f)) + 1.0f); } From 871b498d73a999a5dae0897101054829b3787ece Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 17:39:50 -0500 Subject: [PATCH 056/144] doubleup on dt (usually denotes delta-time. in this case also incorporates time-of-collision) --- Engine/source/T3D/item.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/T3D/item.cpp b/Engine/source/T3D/item.cpp index d8f8cad1e..a4fc7a339 100644 --- a/Engine/source/T3D/item.cpp +++ b/Engine/source/T3D/item.cpp @@ -891,9 +891,9 @@ void Item::updatePos(const U32 /*mask*/, const F32 dt) if (collisionList.getTime() < 1.0) { // Set to collision point - F32 dt = time * collisionList.getTime(); - pos += mVelocity * dt; - time -= dt; + F32 cdt = time * collisionList.getTime(); + pos += mVelocity * cdt; + time -= cdt; // Pick the most resistant surface F32 bd = 0; From e85af7b4d8de85563a73070156c2af36c690730f Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 17:41:29 -0500 Subject: [PATCH 057/144] XXXVehicle::updateEmitter cleanups --- Engine/source/T3D/vehicles/flyingVehicle.cpp | 8 ++++---- Engine/source/T3D/vehicles/hoverVehicle.cpp | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Engine/source/T3D/vehicles/flyingVehicle.cpp b/Engine/source/T3D/vehicles/flyingVehicle.cpp index 855850ea8..3040d94b1 100644 --- a/Engine/source/T3D/vehicles/flyingVehicle.cpp +++ b/Engine/source/T3D/vehicles/flyingVehicle.cpp @@ -731,10 +731,10 @@ void FlyingVehicle::updateEmitter(bool active,F32 dt,ParticleEmitterData *emitte } } else { - for (S32 j = idx; j < idx + count; j++) - if (bool(mJetEmitter[j])) { - mJetEmitter[j]->deleteWhenEmpty(); - mJetEmitter[j] = 0; + for (S32 k = idx; k < idx + count; k++) + if (bool(mJetEmitter[k])) { + mJetEmitter[k]->deleteWhenEmpty(); + mJetEmitter[k] = 0; } } } diff --git a/Engine/source/T3D/vehicles/hoverVehicle.cpp b/Engine/source/T3D/vehicles/hoverVehicle.cpp index 35784d26b..1da29360b 100644 --- a/Engine/source/T3D/vehicles/hoverVehicle.cpp +++ b/Engine/source/T3D/vehicles/hoverVehicle.cpp @@ -965,10 +965,10 @@ void HoverVehicle::updateEmitter(bool active,F32 dt,ParticleEmitterData *emitter } } else { - for (S32 j = idx; j < idx + count; j++) - if (bool(mJetEmitter[j])) { - mJetEmitter[j]->deleteWhenEmpty(); - mJetEmitter[j] = 0; + for (S32 k = idx; k < idx + count; k++) + if (bool(mJetEmitter[k])) { + mJetEmitter[k]->deleteWhenEmpty(); + mJetEmitter[k] = 0; } } } From d11a942f6d8575b4df1c9e12308b90630ddf8fa2 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 17:42:18 -0500 Subject: [PATCH 058/144] shadowvar cleanup --- Engine/source/T3D/systems/render/meshRenderSystem.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/systems/render/meshRenderSystem.cpp b/Engine/source/T3D/systems/render/meshRenderSystem.cpp index fe1ec6f84..39b163601 100644 --- a/Engine/source/T3D/systems/render/meshRenderSystem.cpp +++ b/Engine/source/T3D/systems/render/meshRenderSystem.cpp @@ -350,9 +350,9 @@ void MeshRenderSystem::rebuildBuffers() U16 *pIndex; buffers.primitiveBuffer.lock(&pIndex); - for (U16 i = 0; i < buffers.primData.size(); i++) + for (U16 primDataIDx = 0; primDataIDx < buffers.primData.size(); primDataIDx++) { - *pIndex = i; + *pIndex = primDataIDx; pIndex++; } From 1b548e5304984f598649715bba7006cb08bf68a7 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 17:43:03 -0500 Subject: [PATCH 059/144] cleanups for decal and mesh road, and the meshroad and river editors --- Engine/source/environment/decalRoad.cpp | 22 +++---- .../editors/guiMeshRoadEditorCtrl.cpp | 6 +- .../editors/guiRiverEditorCtrl.cpp | 6 +- Engine/source/environment/meshRoad.cpp | 60 +++++++------------ 4 files changed, 40 insertions(+), 54 deletions(-) diff --git a/Engine/source/environment/decalRoad.cpp b/Engine/source/environment/decalRoad.cpp index edf4c725b..00359f7bb 100644 --- a/Engine/source/environment/decalRoad.cpp +++ b/Engine/source/environment/decalRoad.cpp @@ -1265,7 +1265,7 @@ void DecalRoad::_generateEdges() // for ( U32 i = 0; i < mEdges.size(); i++ ) { - RoadEdge *edge = &mEdges[i]; + edge = &mEdges[i]; edge->p0 = edge->p1 - edge->rvec * edge->width * 0.5f; edge->p2 = edge->p1 + edge->rvec * edge->width * 0.5f; _getTerrainHeight( edge->p0 ); @@ -1467,20 +1467,20 @@ void DecalRoad::_captureVerts() for ( U32 i = 0; i < clipperList.size(); i++ ) { ClippedPolyList *clipper = &clipperList[i]; - RoadEdge &edge = mEdges[i]; - RoadEdge &nextEdge = mEdges[i+1]; + edge = &mEdges[i]; + nextEdge = &mEdges[i+1]; - VectorF segFvec = nextEdge.p1 - edge.p1; + VectorF segFvec = nextEdge->p1 - edge->p1; F32 segLen = segFvec.len(); segFvec.normalize(); F32 texLen = segLen / mTextureLength; texEnd = texStart + texLen; - BiQuadToSqr quadToSquare( Point2F( edge.p0.x, edge.p0.y ), - Point2F( edge.p2.x, edge.p2.y ), - Point2F( nextEdge.p2.x, nextEdge.p2.y ), - Point2F( nextEdge.p0.x, nextEdge.p0.y ) ); + BiQuadToSqr quadToSquare( Point2F( edge->p0.x, edge->p0.y ), + Point2F( edge->p2.x, edge->p2.y ), + Point2F( nextEdge->p2.x, nextEdge->p2.y ), + Point2F( nextEdge->p0.x, nextEdge->p0.y ) ); // if ( i % mSegmentsPerBatch == 0 ) @@ -1572,12 +1572,12 @@ void DecalRoad::_captureVerts() Box3F box; for ( U32 i = 0; i < mBatches.size(); i++ ) { - const RoadBatch &batch = mBatches[i]; + batch = &mBatches[i]; if ( i == 0 ) - box = batch.bounds; + box = batch->bounds; else - box.intersect( batch.bounds ); + box.intersect( batch->bounds ); } mWorldBox = box; diff --git a/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp b/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp index e1a612b00..d36fb5cd9 100644 --- a/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp +++ b/Engine/source/environment/editors/guiMeshRoadEditorCtrl.cpp @@ -1132,11 +1132,11 @@ void GuiMeshRoadEditorCtrl::setSelectedNode( S32 node ) mSelNode = node; if ( mSelNode != -1 ) { - const MeshRoadNode &node = mSelRoad->mNodes[mSelNode]; + const MeshRoadNode &curNode = mSelRoad->mNodes[mSelNode]; MatrixF objMat = mSelRoad->getNodeTransform(mSelNode); - Point3F objScale( node.width, 1.0f, node.depth ); - Point3F worldPos = node.point; + Point3F objScale(curNode.width, 1.0f, curNode.depth ); + Point3F worldPos = curNode.point; mGizmo->set( objMat, worldPos, objScale ); } diff --git a/Engine/source/environment/editors/guiRiverEditorCtrl.cpp b/Engine/source/environment/editors/guiRiverEditorCtrl.cpp index 01ab745a8..103d6e380 100644 --- a/Engine/source/environment/editors/guiRiverEditorCtrl.cpp +++ b/Engine/source/environment/editors/guiRiverEditorCtrl.cpp @@ -1277,11 +1277,11 @@ void GuiRiverEditorCtrl::setSelectedNode( S32 node ) mSelNode = node; if ( mSelNode != -1 ) { - const RiverNode &node = mSelRiver->mNodes[mSelNode]; + const RiverNode &curNode = mSelRiver->mNodes[mSelNode]; MatrixF objMat = mSelRiver->getNodeTransform(mSelNode); - Point3F objScale( node.width, 1.0f, node.depth ); - Point3F worldPos = node.point; + Point3F objScale(curNode.width, 1.0f, curNode.depth ); + Point3F worldPos = curNode.point; mGizmo->set( objMat, worldPos, objScale ); } diff --git a/Engine/source/environment/meshRoad.cpp b/Engine/source/environment/meshRoad.cpp index 0d523f9a7..1ed6768fb 100644 --- a/Engine/source/environment/meshRoad.cpp +++ b/Engine/source/environment/meshRoad.cpp @@ -1681,54 +1681,40 @@ void MeshRoad::_generateSlices() } } } - - // - // Calculate uvec, fvec, and rvec for all slices - // - + MatrixF mat(true); - - for ( U32 i = 0; i < mSlices.size(); i++ ) - { - calcSliceTransform( i, mat ); - mat.getColumn( 0, &mSlices[i].rvec ); - mat.getColumn( 1, &mSlices[i].fvec ); - mat.getColumn( 2, &mSlices[i].uvec ); - } - - // - // Calculate p0/p2/pb0/pb2 for all slices - // - for ( U32 i = 0; i < mSlices.size(); i++ ) - { - MeshRoadSlice *slice = &mSlices[i]; - slice->p0 = slice->p1 - slice->rvec * slice->width * 0.5f; - slice->p2 = slice->p1 + slice->rvec * slice->width * 0.5f; - slice->pb0 = slice->p0 - slice->uvec * slice->depth; - slice->pb2 = slice->p2 - slice->uvec * slice->depth; - } - - // Generate the object/world bounds Box3F box; for ( U32 i = 0; i < mSlices.size(); i++ ) { - const MeshRoadSlice &slice = mSlices[i]; + // Calculate uvec, fvec, and rvec for all slices + calcSliceTransform( i, mat ); + MeshRoadSlice *slicePtr = &mSlices[i]; + mat.getColumn( 0, &slicePtr->rvec ); + mat.getColumn( 1, &slicePtr->fvec ); + mat.getColumn( 2, &slicePtr->uvec ); + // Calculate p0/p2/pb0/pb2 for all slices + slicePtr->p0 = slicePtr->p1 - slicePtr->rvec * slicePtr->width * 0.5f; + slicePtr->p2 = slicePtr->p1 + slicePtr->rvec * slicePtr->width * 0.5f; + slicePtr->pb0 = slicePtr->p0 - slicePtr->uvec * slicePtr->depth; + slicePtr->pb2 = slicePtr->p2 - slicePtr->uvec * slicePtr->depth; + + // Generate or extend the object/world bounds if ( i == 0 ) { - box.minExtents = slice.p0; - box.maxExtents = slice.p2; - box.extend( slice.pb0 ); - box.extend( slice.pb2 ); + box.minExtents = slicePtr->p0; + box.maxExtents = slicePtr->p2; + box.extend(slicePtr->pb0 ); + box.extend(slicePtr->pb2 ); } else { - box.extend( slice.p0 ); - box.extend( slice.p2 ); - box.extend( slice.pb0 ); - box.extend( slice.pb2 ); + box.extend(slicePtr->p0 ); + box.extend(slicePtr->p2 ); + box.extend(slicePtr->pb0 ); + box.extend(slicePtr->pb2 ); } - } + } mWorldBox = box; resetObjectBox(); From 1138637718b281ddc125bf8ffa29219f5f29c178 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 18:44:51 -0500 Subject: [PATCH 060/144] crashfix from prior commit --- Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp index 6a3c296a8..547e77d31 100644 --- a/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp +++ b/Engine/source/shaderGen/HLSL/shaderFeatureHLSL.cpp @@ -1116,7 +1116,7 @@ void DiffuseFeatureHLSL::processPix( Vector &componentList, col->setType("fragout"); col->setName(getOutputTargetVarName(targ)); col->setStructName("OUT"); - meta->addStatement(new GenOp(" @ = float4(1.0);\r\n", col)); + meta->addStatement(new GenOp(" @ = float4(1.0,1.0,1.0,1.0);\r\n", col)); } } From 75897d8191d33cbe1d4eafb210441593ed74419d Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 14 Mar 2018 19:07:03 -0500 Subject: [PATCH 061/144] shadowvar cleanup --- Engine/source/gui/containers/guiWindowCtrl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/gui/containers/guiWindowCtrl.cpp b/Engine/source/gui/containers/guiWindowCtrl.cpp index 5ef2a71af..5077ae348 100644 --- a/Engine/source/gui/containers/guiWindowCtrl.cpp +++ b/Engine/source/gui/containers/guiWindowCtrl.cpp @@ -357,7 +357,7 @@ void GuiWindowCtrl::moveToCollapseGroup(GuiWindowCtrl* hitWindow, bool orientati } else { - S32 groupVec = hitWindow->mCollapseGroup; + groupVec = hitWindow->mCollapseGroup; if(orientation == 0) parent->mCollapseGroupVec[groupVec].push_front(this); From 25920aeee95f82256183350e9c155b2409708ee9 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 15 Mar 2018 00:43:29 -0500 Subject: [PATCH 062/144] frustum definition duplication(s) --- Engine/source/gui/3d/guiTSControl.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/Engine/source/gui/3d/guiTSControl.cpp b/Engine/source/gui/3d/guiTSControl.cpp index d19d58aee..3e2c192c9 100644 --- a/Engine/source/gui/3d/guiTSControl.cpp +++ b/Engine/source/gui/3d/guiTSControl.cpp @@ -432,8 +432,6 @@ void GuiTSCtrl::_internalRender(RectI guiViewport, RectI renderViewport, Frustum if (mRenderStyle == RenderStyleStereoSideBySide && debugDraw->willDraw()) { // For SBS we need to render over each viewport - Frustum frustum; - GFX->setViewport(mLastCameraQuery.stereoViewports[0]); MathUtils::makeFovPortFrustum(&frustum, mLastCameraQuery.ortho, mLastCameraQuery.nearPlane, mLastCameraQuery.farPlane, mLastCameraQuery.fovPort[0]); GFX->setFrustum(frustum); @@ -543,7 +541,6 @@ void GuiTSCtrl::onRender(Point2I offset, const RectI &updateRect) GFX->setStereoTargets(mLastCameraQuery.stereoTargets); MatrixF myTransforms[2]; - Frustum frustum; if (smUseLatestDisplayTransform) { From a0eebd01c81caccb2f12affe41f92e183d6c4752 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 15 Mar 2018 00:52:03 -0500 Subject: [PATCH 063/144] refactor to avoid shadowvars --- Engine/source/gui/controls/guiPopUpCtrlEx.cpp | 12 +++++------ Engine/source/gui/editor/guiGraphCtrl.cpp | 20 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp index 3c6415117..02f588e1e 100644 --- a/Engine/source/gui/controls/guiPopUpCtrlEx.cpp +++ b/Engine/source/gui/controls/guiPopUpCtrlEx.cpp @@ -1210,9 +1210,9 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect) if ( drawbox ) { Point2I coloredboxsize( 15, 10 ); - RectI r( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y ); - drawUtil->drawRectFill( r, boxColor); - drawUtil->drawRect( r, ColorI(0,0,0)); + RectI boxBounds( offset.x + mProfile->mTextOffset.x, offset.y + ( (getHeight() - coloredboxsize.y ) / 2 ), coloredboxsize.x, coloredboxsize.y ); + drawUtil->drawRectFill(boxBounds, boxColor); + drawUtil->drawRect(boxBounds, ColorI(0,0,0)); localStart.x += coloredboxsize.x + mProfile->mTextOffset.x; } @@ -1236,18 +1236,18 @@ void GuiPopUpMenuCtrlEx::onRender(Point2I offset, const RectI &updateRect) // Draw the second column to the right getColumn( mText, buff, 1, "\t" ); - S32 txt_w = mProfile->mFont->getStrWidth( buff ); + S32 colTxt_w = mProfile->mFont->getStrWidth( buff ); if ( mProfile->getChildrenProfile() && mProfile->mBitmapArrayRects.size() ) { // We're making use of a bitmap border, so take into account the // right cap of the border. RectI* bitmapBounds = mProfile->mBitmapArrayRects.address(); - Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - bitmapBounds[2].extent.x, localStart.y ) ); + Point2I textpos = localToGlobalCoord( Point2I( getWidth() - colTxt_w - bitmapBounds[2].extent.x, localStart.y ) ); drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors ); } else { - Point2I textpos = localToGlobalCoord( Point2I( getWidth() - txt_w - 12, localStart.y ) ); + Point2I textpos = localToGlobalCoord( Point2I( getWidth() - colTxt_w - 12, localStart.y ) ); drawUtil->drawText( mProfile->mFont, textpos, buff, mProfile->mFontColors ); } diff --git a/Engine/source/gui/editor/guiGraphCtrl.cpp b/Engine/source/gui/editor/guiGraphCtrl.cpp index 8b1c14108..41e4d0d14 100644 --- a/Engine/source/gui/editor/guiGraphCtrl.cpp +++ b/Engine/source/gui/editor/guiGraphCtrl.cpp @@ -168,7 +168,7 @@ void GuiGraphCtrl::onRender(Point2I offset, const RectI &updateRect) F32 Scale = F32( getExtent().y ) / F32( mGraphMax[ k ] * 1.05 ); const S32 numSamples = mGraphData[ k ].size(); - + F32 graphOffset; switch( mGraphType[ k ] ) { case Bar: @@ -180,21 +180,21 @@ void GuiGraphCtrl::onRender(Point2I offset, const RectI &updateRect) PrimBuild::begin( GFXTriangleStrip, 4 ); PrimBuild::color( mGraphColor[ k ] ); - F32 offset = F32( getExtent().x ) / F32( MaxDataPoints ) * F32( sample + 1 ); + graphOffset = F32( getExtent().x ) / F32( MaxDataPoints ) * F32( sample + 1 ); PrimBuild::vertex2f( globalPos.x + prevOffset, midPointY - ( getDatum( k, sample ) * Scale ) ); - PrimBuild::vertex2f( globalPos.x + offset, + PrimBuild::vertex2f( globalPos.x + graphOffset, midPointY - ( getDatum( k, sample ) * Scale ) ); - PrimBuild::vertex2f( globalPos.x + offset, + PrimBuild::vertex2f( globalPos.x + graphOffset, midPointY ); PrimBuild::vertex2f( globalPos.x + prevOffset, midPointY ); - prevOffset = offset; + prevOffset = graphOffset; PrimBuild::end(); } @@ -209,12 +209,12 @@ void GuiGraphCtrl::onRender(Point2I offset, const RectI &updateRect) for( S32 sample = 0; sample < numSamples; ++ sample ) { - F32 offset = F32( getExtent().x ) / F32( MaxDataPoints - 1 ) * F32( sample ); + graphOffset = F32( getExtent().x ) / F32( MaxDataPoints - 1 ) * F32( sample ); - PrimBuild::vertex2f( globalPos.x + offset, + PrimBuild::vertex2f( globalPos.x + graphOffset, midPointY ); - PrimBuild::vertex2f( globalPos.x + offset, + PrimBuild::vertex2f( globalPos.x + graphOffset, midPointY - ( getDatum( k, sample ) * Scale ) ); } @@ -234,9 +234,9 @@ void GuiGraphCtrl::onRender(Point2I offset, const RectI &updateRect) for( S32 sample = 0; sample < numSamples; ++ sample ) { - F32 offset = F32( getExtent().x ) / F32( MaxDataPoints - 1 ) * F32( sample ); + graphOffset = F32( getExtent().x ) / F32( MaxDataPoints - 1 ) * F32( sample ); - PrimBuild::vertex2f( globalPos.x + offset, + PrimBuild::vertex2f( globalPos.x + graphOffset, midPointY - ( getDatum( k, sample ) * Scale ) ); } From f0c29172ca851f344b939b3193d16d871453e339 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 15 Mar 2018 14:50:54 -0500 Subject: [PATCH 064/144] gui shadowvar cleanups --- Engine/source/gui/controls/guiDecoyCtrl.cpp | 1 - .../gui/controls/guiDirectoryFileListCtrl.cpp | 2 +- .../source/gui/controls/guiTreeViewCtrl.cpp | 24 ++++++++----------- Engine/source/gui/core/guiCanvas.cpp | 10 ++++---- Engine/source/gui/editor/guiEditCtrl.cpp | 14 +++++------ Engine/source/gui/editor/guiFilterCtrl.cpp | 18 +++++++------- Engine/source/gui/editor/guiInspector.cpp | 10 ++++---- .../source/gui/editor/guiInspectorTypes.cpp | 1 - Engine/source/navigation/guiNavEditorCtrl.cpp | 6 ++--- 9 files changed, 40 insertions(+), 46 deletions(-) diff --git a/Engine/source/gui/controls/guiDecoyCtrl.cpp b/Engine/source/gui/controls/guiDecoyCtrl.cpp index 56e2d9467..f7fd881e8 100644 --- a/Engine/source/gui/controls/guiDecoyCtrl.cpp +++ b/Engine/source/gui/controls/guiDecoyCtrl.cpp @@ -142,7 +142,6 @@ void GuiDecoyCtrl::onMouseMove(const GuiEvent &event) if(mIsDecoy == true) { mVisible = false; - GuiControl *parent = getParent(); GuiControl *tempControl = parent->findHitControl(localPoint); //the decoy control has the responsibility of keeping track of the decoyed controls status diff --git a/Engine/source/gui/controls/guiDirectoryFileListCtrl.cpp b/Engine/source/gui/controls/guiDirectoryFileListCtrl.cpp index c244af658..2752bb9dd 100644 --- a/Engine/source/gui/controls/guiDirectoryFileListCtrl.cpp +++ b/Engine/source/gui/controls/guiDirectoryFileListCtrl.cpp @@ -189,7 +189,7 @@ DefineEngineMethod( GuiDirectoryFileListCtrl, getSelectedFiles, const char*, (), // Fetch the remaining entries for( S32 i = 1; i < ItemVector.size(); i++ ) { - StringTableEntry itemText = object->getItemText( ItemVector[i] ); + itemText = object->getItemText( ItemVector[i] ); if( !itemText ) continue; diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index 9d45147e1..266151587 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -3004,10 +3004,10 @@ void GuiTreeViewCtrl::onMouseUp(const GuiEvent &event) { if( !mActive || !mAwake || !mVisible ) return; - + + BitSet32 hitFlags = 0; if( isMethod("onMouseUp") ) { - BitSet32 hitFlags = 0; Item* item; S32 hitItemId = -1; @@ -3025,7 +3025,7 @@ void GuiTreeViewCtrl::onMouseUp(const GuiEvent &event) return; } - BitSet32 hitFlags = 0; + hitFlags = 0; Item *item; bool hitCheck = _hitTest( event.mousePoint, item, hitFlags ); mRenamingItem = NULL; @@ -3061,7 +3061,7 @@ void GuiTreeViewCtrl::onMouseUp(const GuiEvent &event) { Parent::onMouseMove( event ); - BitSet32 hitFlags = 0; + hitFlags = 0; if( !_hitTest( event.mousePoint, newItem2, hitFlags ) ) { if( !mShowRoot ) @@ -3794,16 +3794,12 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event) if (item->isInspectorData()) { Entity* e = dynamic_cast(item->getObject()); - //if (item->mScriptInfo.mText != StringTable->insert("Components")) - { - Entity* e = dynamic_cast(item->getObject()); - if (e) - { - if (item->isExpanded()) - e->onInspect(); - else - e->onEndInspect(); - } + if (e) + { + if (item->isExpanded()) + e->onInspect(); + else + e->onEndInspect(); } } diff --git a/Engine/source/gui/core/guiCanvas.cpp b/Engine/source/gui/core/guiCanvas.cpp index efb0674ea..fd0b65ae0 100644 --- a/Engine/source/gui/core/guiCanvas.cpp +++ b/Engine/source/gui/core/guiCanvas.cpp @@ -1530,9 +1530,9 @@ void GuiCanvas::popDialogControl(GuiControl *gui) if (size() > 0) { - GuiControl *ctrl = static_cast(last()); - if( ctrl->getFirstResponder() ) - ctrl->getFirstResponder()->setFirstResponder(); + GuiControl *lastCtrl = static_cast(last()); + if(lastCtrl->getFirstResponder() ) + lastCtrl->getFirstResponder()->setFirstResponder(); } else { @@ -1547,8 +1547,8 @@ void GuiCanvas::popDialogControl(GuiControl *gui) if (size() > 0) { - GuiControl *ctrl = static_cast(last()); - ctrl->buildAcceleratorMap(); + GuiControl *lastCtrl = static_cast(last()); + lastCtrl->buildAcceleratorMap(); } refreshMouseControl(); } diff --git a/Engine/source/gui/editor/guiEditCtrl.cpp b/Engine/source/gui/editor/guiEditCtrl.cpp index 09644d990..f81619efe 100644 --- a/Engine/source/gui/editor/guiEditCtrl.cpp +++ b/Engine/source/gui/editor/guiEditCtrl.cpp @@ -542,10 +542,10 @@ void GuiEditCtrl::onMouseDragged( const GuiEvent &event ) // Snap the mouse cursor to grid if active. Do this on the mouse cursor so that we handle // incremental drags correctly. - Point2I mousePoint = event.mousePoint; - snapToGrid( mousePoint ); + Point2I dragPoint = event.mousePoint; + snapToGrid(dragPoint); - Point2I delta = mousePoint - mLastDragPos; + Point2I delta = dragPoint - mLastDragPos; // If CTRL is down, apply smart snapping. @@ -584,7 +584,7 @@ void GuiEditCtrl::onMouseDragged( const GuiEvent &event ) // Remember drag point. - mLastDragPos = mousePoint; + mLastDragPos = dragPoint; } else if (mMouseDownMode == MovingSelection && mSelectedControls.size()) { @@ -770,7 +770,7 @@ void GuiEditCtrl::onRender(Point2I offset, const RectI &updateRect) ( mMouseDownMode == MovingSelection || mMouseDownMode == SizingSelection ) && ( mGridSnap.x || mGridSnap.y ) ) { - Point2I cext = getContentControl()->getExtent(); + cext = getContentControl()->getExtent(); Point2I coff = getContentControl()->localToGlobalCoord(Point2I(0,0)); // create point-dots @@ -847,8 +847,8 @@ void GuiEditCtrl::onRender(Point2I offset, const RectI &updateRect) if( mSnapTargets[ axis ] ) { - RectI bounds = mSnapTargets[ axis ]->getGlobalBounds(); - drawer->drawRect( bounds, ColorI( 128, 128, 128, 128 ) ); + RectI snapBounds = mSnapTargets[ axis ]->getGlobalBounds(); + drawer->drawRect(snapBounds, ColorI( 128, 128, 128, 128 ) ); } } } diff --git a/Engine/source/gui/editor/guiFilterCtrl.cpp b/Engine/source/gui/editor/guiFilterCtrl.cpp index a00d4f670..41dfa13a6 100644 --- a/Engine/source/gui/editor/guiFilterCtrl.cpp +++ b/Engine/source/gui/editor/guiFilterCtrl.cpp @@ -177,9 +177,9 @@ void GuiFilterCtrl::onRender(Point2I offset, const RectI &updateRect) Point2I pos = offset; Point2I ext = getExtent(); - RectI r(pos, ext); - GFX->getDrawUtil()->drawRectFill(r, ColorI(255,255,255)); - GFX->getDrawUtil()->drawRect(r, ColorI(0,0,0)); + RectI bgRect(pos, ext); + GFX->getDrawUtil()->drawRectFill(bgRect, ColorI(255,255,255)); + GFX->getDrawUtil()->drawRect(bgRect, ColorI(0,0,0)); // shrink by 2 pixels pos.x += 2; @@ -218,13 +218,13 @@ void GuiFilterCtrl::onRender(Point2I offset, const RectI &updateRect) // draw the knots for (U32 k=0; k < mFilter.size(); k++) { - RectI r; - r.point.x = (S32)(((F32)ext.x/(F32)(mFilter.size()-1)*(F32)k)); - r.point.y = (S32)(ext.y - ((F32)ext.y * mFilter[k])); - r.point += pos + Point2I(-2,-2); - r.extent = Point2I(5,5); + RectI knotRect; + knotRect.point.x = (S32)(((F32)ext.x/(F32)(mFilter.size()-1)*(F32)k)); + knotRect.point.y = (S32)(ext.y - ((F32)ext.y * mFilter[k])); + knotRect.point += pos + Point2I(-2,-2); + knotRect.extent = Point2I(5,5); - GFX->getDrawUtil()->drawRectFill(r, ColorI(255,0,0)); + GFX->getDrawUtil()->drawRectFill(knotRect, ColorI(255,0,0)); } renderChildControls(offset, updateRect); diff --git a/Engine/source/gui/editor/guiInspector.cpp b/Engine/source/gui/editor/guiInspector.cpp index 4551d03e8..de6e43361 100644 --- a/Engine/source/gui/editor/guiInspector.cpp +++ b/Engine/source/gui/editor/guiInspector.cpp @@ -658,18 +658,18 @@ void GuiInspector::refresh() if( !group && !isGroupFiltered( itr->pGroupname ) ) { - GuiInspectorGroup *group = new GuiInspectorGroup( itr->pGroupname, this ); + GuiInspectorGroup *newGroup = new GuiInspectorGroup( itr->pGroupname, this ); - group->registerObject(); - if( !group->getNumFields() ) + newGroup->registerObject(); + if( !newGroup->getNumFields() ) { #ifdef DEBUG_SPEW Platform::outputDebugString( "[GuiInspector] Removing empty group '%s'", - group->getCaption().c_str() ); + newGroup->getCaption().c_str() ); #endif // The group ended up having no fields. Remove it. - group->deleteObject(); + newGroup->deleteObject(); } else { diff --git a/Engine/source/gui/editor/guiInspectorTypes.cpp b/Engine/source/gui/editor/guiInspectorTypes.cpp index f31d4facd..a90da6587 100644 --- a/Engine/source/gui/editor/guiInspectorTypes.cpp +++ b/Engine/source/gui/editor/guiInspectorTypes.cpp @@ -1035,7 +1035,6 @@ GuiControl* GuiInspectorTypeEaseF::constructEditControl() mBrowseButton = new GuiButtonCtrl(); { RectI browseRect( Point2I( ( getLeft() + getWidth()) - 26, getTop() + 2), Point2I(20, getHeight() - 4) ); - char szBuffer[512]; dSprintf( szBuffer, sizeof( szBuffer ), "GetEaseF(%d.getText(), \"%d.apply\", %d.getRoot());", retCtrl->getId(), getId(), getId() ); mBrowseButton->setField( "Command", szBuffer ); mBrowseButton->setField( "text", "E" ); diff --git a/Engine/source/navigation/guiNavEditorCtrl.cpp b/Engine/source/navigation/guiNavEditorCtrl.cpp index bc605c054..64ae03b6c 100644 --- a/Engine/source/navigation/guiNavEditorCtrl.cpp +++ b/Engine/source/navigation/guiNavEditorCtrl.cpp @@ -535,10 +535,10 @@ void GuiNavEditorCtrl::renderScene(const RectI & updateRect) GFXStateBlockDesc desc; desc.setBlend(false); desc.setZReadWrite(true ,true); - MatrixF mat(true); - mat.setPosition(mLinkStart); + MatrixF linkMat(true); + linkMat.setPosition(mLinkStart); Point3F scale(0.8f, 0.8f, 0.8f); - GFX->getDrawUtil()->drawTransform(desc, mat, &scale); + GFX->getDrawUtil()->drawTransform(desc, linkMat, &scale); } } From 46ac677906fa1315a8a7c3093d1290d30a0be748 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 15 Mar 2018 15:36:38 -0500 Subject: [PATCH 065/144] local 'duplicates' of scratchbuffer global shifted to varBuffer --- Engine/source/console/console.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Engine/source/console/console.cpp b/Engine/source/console/console.cpp index c3779de63..9605357a5 100644 --- a/Engine/source/console/console.cpp +++ b/Engine/source/console/console.cpp @@ -841,9 +841,9 @@ void setIntVariable(const char *varName, S32 value) if (getVariableObjectField(varName, &obj, &objField)) { - char scratchBuffer[32]; - dSprintf(scratchBuffer, sizeof(scratchBuffer), "%d", value); - obj->setDataField(StringTable->insert(objField), 0, scratchBuffer); + char varBuffer[32]; + dSprintf(varBuffer, sizeof(varBuffer), "%d", value); + obj->setDataField(StringTable->insert(objField), 0, varBuffer); } else { @@ -860,9 +860,9 @@ void setFloatVariable(const char *varName, F32 value) if (getVariableObjectField(varName, &obj, &objField)) { - char scratchBuffer[32]; - dSprintf(scratchBuffer, sizeof(scratchBuffer), "%g", value); - obj->setDataField(StringTable->insert(objField), 0, scratchBuffer); + char varBuffer[32]; + dSprintf(varBuffer, sizeof(varBuffer), "%g", value); + obj->setDataField(StringTable->insert(objField), 0, varBuffer); } else { From 610667f760bfdcc59f11a1caca2af24132459a3f Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 15 Mar 2018 15:37:04 -0500 Subject: [PATCH 066/144] groundcover shadowvar cleanup --- Engine/source/T3D/fx/groundCover.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/fx/groundCover.cpp b/Engine/source/T3D/fx/groundCover.cpp index 6e859e554..52ea5ef17 100644 --- a/Engine/source/T3D/fx/groundCover.cpp +++ b/Engine/source/T3D/fx/groundCover.cpp @@ -1184,9 +1184,9 @@ GroundCoverCell* GroundCover::_generateCell( const Point2I& index, terrainBlock = dynamic_cast< TerrainBlock* >( terrainBlocks.first() ); else { - for ( U32 i = 0; i < terrainBlocks.size(); i++ ) + for ( U32 blockIDx = 0; blockIDx < terrainBlocks.size(); blockIDx++ ) { - TerrainBlock *terrain = dynamic_cast< TerrainBlock* >( terrainBlocks[ i ] ); + TerrainBlock *terrain = dynamic_cast< TerrainBlock* >( terrainBlocks[ blockIDx ] ); if( !terrain ) continue; From 77e9f3c6d4dacdc8d0107478b0be709017bed739 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 15 Mar 2018 17:31:28 -0500 Subject: [PATCH 067/144] CollisionState membervar clarification --- Engine/source/T3D/rigidShape.cpp | 6 +- Engine/source/T3D/vehicles/vehicle.cpp | 6 +- Engine/source/collision/convex.cpp | 18 +-- Engine/source/collision/convex.h | 8 +- Engine/source/collision/gjk.cpp | 204 ++++++++++++------------- Engine/source/collision/gjk.h | 18 +-- 6 files changed, 130 insertions(+), 130 deletions(-) diff --git a/Engine/source/T3D/rigidShape.cpp b/Engine/source/T3D/rigidShape.cpp index c7f876305..69144461f 100644 --- a/Engine/source/T3D/rigidShape.cpp +++ b/Engine/source/T3D/rigidShape.cpp @@ -1194,7 +1194,7 @@ bool RigidShape::updateCollision(F32 dt) mCollisionList.clear(); CollisionState *state = mConvex.findClosestState(cmat, getScale(), mDataBlock->collisionTol); - if (state && state->dist <= mDataBlock->collisionTol) + if (state && state->mDist <= mDataBlock->collisionTol) { //resolveDisplacement(ns,state,dt); mConvex.getCollisionInfo(cmat, getScale(), &mCollisionList, mDataBlock->collisionTol); @@ -1326,8 +1326,8 @@ bool RigidShape::resolveContacts(Rigid& ns,CollisionList& cList,F32 dt) bool RigidShape::resolveDisplacement(Rigid& ns,CollisionState *state, F32 dt) { - SceneObject* obj = (state->a->getObject() == this)? - state->b->getObject(): state->a->getObject(); + SceneObject* obj = (state->mA->getObject() == this)? + state->mB->getObject(): state->mA->getObject(); if (obj->isDisplacable() && ((obj->getTypeMask() & ShapeBaseObjectType) != 0)) { diff --git a/Engine/source/T3D/vehicles/vehicle.cpp b/Engine/source/T3D/vehicles/vehicle.cpp index cdfff2827..a173d61fd 100644 --- a/Engine/source/T3D/vehicles/vehicle.cpp +++ b/Engine/source/T3D/vehicles/vehicle.cpp @@ -1364,7 +1364,7 @@ bool Vehicle::updateCollision(F32 dt) mCollisionList.clear(); CollisionState *state = mConvex.findClosestState(cmat, getScale(), mDataBlock->collisionTol); - if (state && state->dist <= mDataBlock->collisionTol) + if (state && state->mDist <= mDataBlock->collisionTol) { //resolveDisplacement(ns,state,dt); mConvex.getCollisionInfo(cmat, getScale(), &mCollisionList, mDataBlock->collisionTol); @@ -1497,8 +1497,8 @@ bool Vehicle::resolveDisplacement(Rigid& ns,CollisionState *state, F32 dt) { PROFILE_SCOPE( Vehicle_ResolveDisplacement ); - SceneObject* obj = (state->a->getObject() == this)? - state->b->getObject(): state->a->getObject(); + SceneObject* obj = (state->mA->getObject() == this)? + state->mB->getObject(): state->mA->getObject(); if (obj->isDisplacable() && ((obj->getTypeMask() & ShapeBaseObjectType) != 0)) { diff --git a/Engine/source/collision/convex.cpp b/Engine/source/collision/convex.cpp index 0fda42812..01583c9f0 100644 --- a/Engine/source/collision/convex.cpp +++ b/Engine/source/collision/convex.cpp @@ -520,7 +520,7 @@ void Convex::updateStateList(const MatrixF& mat, const Point3F& scale, const Poi // Destroy states which are no longer intersecting for (CollisionStateList* itr = mList.mNext; itr != &mList; itr = itr->mNext) { - Convex* cv = (itr->mState->a == this)? itr->mState->b: itr->mState->a; + Convex* cv = (itr->mState->mA == this)? itr->mState->mB: itr->mState->mA; cv->mTag = sTag; if (!box1.isOverlapped(cv->getBoundingBox())) { CollisionState* cs = itr->mState; @@ -568,9 +568,9 @@ CollisionState* Convex::findClosestState(const MatrixF& mat, const Point3F& scal state->swap(); // Prepare scaled version of transform - MatrixF bxform = state->b->getTransform(); + MatrixF bxform = state->mB->getTransform(); temp = bxform; - Point3F bscale = state->b->getScale(); + Point3F bscale = state->mB->getScale(); bxform.scale(bscale); MatrixF bxforminv(true); bxforminv.scale(Point3F(1.0f/bscale.x, 1.0f/bscale.y, 1.0f/bscale.z)); @@ -613,7 +613,7 @@ bool Convex::getCollisionInfo(const MatrixF& mat, const Point3F& scale, Collisio if (state->mLista != itr) state->swap(); - if (state->dist <= tol) + if (state->mDist <= tol) { fa.reset(); fb.reset(); @@ -628,18 +628,18 @@ bool Convex::getCollisionInfo(const MatrixF& mat, const Point3F& scale, Collisio MatrixF imat = omat; imat.inverse(); - imat.mulV(-state->v,&v); + imat.mulV(-state->mDistvec,&v); getFeatures(omat,v,&fa); - imat = state->b->getTransform(); - imat.scale(state->b->getScale()); + imat = state->mB->getTransform(); + imat.scale(state->mB->getScale()); MatrixF bxform = imat; imat.inverse(); - imat.mulV(state->v,&v); + imat.mulV(state->mDistvec,&v); - state->b->getFeatures(bxform,v,&fb); + state->mB->getFeatures(bxform,v,&fb); fa.collide(fb,cList,tol); } diff --git a/Engine/source/collision/convex.h b/Engine/source/collision/convex.h index 5de048abc..fa6106f83 100644 --- a/Engine/source/collision/convex.h +++ b/Engine/source/collision/convex.h @@ -100,11 +100,11 @@ struct CollisionState { CollisionStateList* mLista; CollisionStateList* mListb; - Convex* a; - Convex* b; + Convex* mA; + Convex* mB; - F32 dist; // Current estimated distance - VectorF v; // Vector between closest points + F32 mDist; // Current estimated distance + VectorF mDistvec; // Vector between closest points // CollisionState(); diff --git a/Engine/source/collision/gjk.cpp b/Engine/source/collision/gjk.cpp index 5dff5ec92..e9debee81 100644 --- a/Engine/source/collision/gjk.cpp +++ b/Engine/source/collision/gjk.cpp @@ -46,7 +46,7 @@ S32 num_irregularities = 0; GjkCollisionState::GjkCollisionState() { - a = b = 0; + mA = mB = 0; } GjkCollisionState::~GjkCollisionState() @@ -58,9 +58,9 @@ GjkCollisionState::~GjkCollisionState() void GjkCollisionState::swap() { - Convex* t = a; a = b; b = t; + Convex* t = mA; mA = mB; mB = t; CollisionStateList* l = mLista; mLista = mListb; mListb = l; - v.neg(); + mDistvec.neg(); } @@ -70,44 +70,44 @@ void GjkCollisionState::compute_det() { // Dot new point with current set for (S32 i = 0, bit = 1; i < 4; ++i, bit <<=1) - if (bits & bit) - dp[i][last] = dp[last][i] = mDot(y[i], y[last]); - dp[last][last] = mDot(y[last], y[last]); + if (mBits & bit) + mDP[i][mLast] = mDP[mLast][i] = mDot(mY[i], mY[mLast]); + mDP[mLast][mLast] = mDot(mY[mLast], mY[mLast]); // Calulate the determinent - det[last_bit][last] = 1; + mDet[mLast_bit][mLast] = 1; for (S32 j = 0, sj = 1; j < 4; ++j, sj <<= 1) { - if (bits & sj) { - S32 s2 = sj | last_bit; - det[s2][j] = dp[last][last] - dp[last][j]; - det[s2][last] = dp[j][j] - dp[j][last]; + if (mBits & sj) { + S32 s2 = sj | mLast_bit; + mDet[s2][j] = mDP[mLast][mLast] - mDP[mLast][j]; + mDet[s2][mLast] = mDP[j][j] - mDP[j][mLast]; for (S32 k = 0, sk = 1; k < j; ++k, sk <<= 1) { - if (bits & sk) { + if (mBits & sk) { S32 s3 = sk | s2; - det[s3][k] = det[s2][j] * (dp[j][j] - dp[j][k]) + - det[s2][last] * (dp[last][j] - dp[last][k]); - det[s3][j] = det[sk | last_bit][k] * (dp[k][k] - dp[k][j]) + - det[sk | last_bit][last] * (dp[last][k] - dp[last][j]); - det[s3][last] = det[sk | sj][k] * (dp[k][k] - dp[k][last]) + - det[sk | sj][j] * (dp[j][k] - dp[j][last]); + mDet[s3][k] = mDet[s2][j] * (mDP[j][j] - mDP[j][k]) + + mDet[s2][mLast] * (mDP[mLast][j] - mDP[mLast][k]); + mDet[s3][j] = mDet[sk | mLast_bit][k] * (mDP[k][k] - mDP[k][j]) + + mDet[sk | mLast_bit][mLast] * (mDP[mLast][k] - mDP[mLast][j]); + mDet[s3][mLast] = mDet[sk | sj][k] * (mDP[k][k] - mDP[k][mLast]) + + mDet[sk | sj][j] * (mDP[j][k] - mDP[j][mLast]); } } } } - if (all_bits == 15) { - det[15][0] = det[14][1] * (dp[1][1] - dp[1][0]) + - det[14][2] * (dp[2][1] - dp[2][0]) + - det[14][3] * (dp[3][1] - dp[3][0]); - det[15][1] = det[13][0] * (dp[0][0] - dp[0][1]) + - det[13][2] * (dp[2][0] - dp[2][1]) + - det[13][3] * (dp[3][0] - dp[3][1]); - det[15][2] = det[11][0] * (dp[0][0] - dp[0][2]) + - det[11][1] * (dp[1][0] - dp[1][2]) + - det[11][3] * (dp[3][0] - dp[3][2]); - det[15][3] = det[7][0] * (dp[0][0] - dp[0][3]) + - det[7][1] * (dp[1][0] - dp[1][3]) + - det[7][2] * (dp[2][0] - dp[2][3]); + if (mAll_bits == 15) { + mDet[15][0] = mDet[14][1] * (mDP[1][1] - mDP[1][0]) + + mDet[14][2] * (mDP[2][1] - mDP[2][0]) + + mDet[14][3] * (mDP[3][1] - mDP[3][0]); + mDet[15][1] = mDet[13][0] * (mDP[0][0] - mDP[0][1]) + + mDet[13][2] * (mDP[2][0] - mDP[2][1]) + + mDet[13][3] * (mDP[3][0] - mDP[3][1]); + mDet[15][2] = mDet[11][0] * (mDP[0][0] - mDP[0][2]) + + mDet[11][1] * (mDP[1][0] - mDP[1][2]) + + mDet[11][3] * (mDP[3][0] - mDP[3][2]); + mDet[15][3] = mDet[7][0] * (mDP[0][0] - mDP[0][3]) + + mDet[7][1] * (mDP[1][0] - mDP[1][3]) + + mDet[7][2] * (mDP[2][0] - mDP[2][3]); } } @@ -120,8 +120,8 @@ inline void GjkCollisionState::compute_vector(S32 bits, VectorF& v) v.set(0, 0, 0); for (S32 i = 0, bit = 1; i < 4; ++i, bit <<= 1) { if (bits & bit) { - sum += det[bits][i]; - v += y[i] * det[bits][i]; + sum += mDet[bits][i]; + v += mY[i] * mDet[bits][i]; } } v *= 1 / sum; @@ -133,13 +133,13 @@ inline void GjkCollisionState::compute_vector(S32 bits, VectorF& v) inline bool GjkCollisionState::valid(S32 s) { for (S32 i = 0, bit = 1; i < 4; ++i, bit <<= 1) { - if (all_bits & bit) { + if (mAll_bits & bit) { if (s & bit) { - if (det[s][i] <= 0) + if (mDet[s][i] <= 0) return false; } else - if (det[s | bit][i] > 0) + if (mDet[s | bit][i] > 0) return false; } } @@ -152,19 +152,19 @@ inline bool GjkCollisionState::valid(S32 s) inline bool GjkCollisionState::closest(VectorF& v) { compute_det(); - for (S32 s = bits; s; --s) { - if ((s & bits) == s) { - if (valid(s | last_bit)) { - bits = s | last_bit; - if (bits != 15) - compute_vector(bits, v); + for (S32 s = mBits; s; --s) { + if ((s & mBits) == s) { + if (valid(s | mLast_bit)) { + mBits = s | mLast_bit; + if (mBits != 15) + compute_vector(mBits, v); return true; } } } - if (valid(last_bit)) { - bits = last_bit; - v = y[last]; + if (valid(mLast_bit)) { + mBits = mLast_bit; + v = mY[mLast]; return true; } return false; @@ -176,7 +176,7 @@ inline bool GjkCollisionState::closest(VectorF& v) inline bool GjkCollisionState::degenerate(const VectorF& w) { for (S32 i = 0, bit = 1; i < 4; ++i, bit <<= 1) - if ((all_bits & bit) && y[i] == w) + if ((mAll_bits & bit) && mY[i] == w) return true; return false; } @@ -186,11 +186,11 @@ inline bool GjkCollisionState::degenerate(const VectorF& w) inline void GjkCollisionState::nextBit() { - last = 0; - last_bit = 1; - while (bits & last_bit) { - ++last; - last_bit <<= 1; + mLast = 0; + mLast_bit = 1; + while (mBits & mLast_bit) { + ++mLast; + mLast_bit <<= 1; } } @@ -203,11 +203,11 @@ inline void GjkCollisionState::nextBit() void GjkCollisionState::set(Convex* aa, Convex* bb, const MatrixF& a2w, const MatrixF& b2w) { - a = aa; - b = bb; + mA = aa; + mB = bb; - bits = 0; - all_bits = 0; + mBits = 0; + mAll_bits = 0; reset(a2w,b2w); // link @@ -223,10 +223,10 @@ void GjkCollisionState::set(Convex* aa, Convex* bb, void GjkCollisionState::reset(const MatrixF& a2w, const MatrixF& b2w) { VectorF zero(0,0,0),sa,sb; - a2w.mulP(a->support(zero),&sa); - b2w.mulP(b->support(zero),&sb); - v = sa - sb; - dist = v.len(); + a2w.mulP(mA->support(zero),&sa); + b2w.mulP(mB->support(zero),&sb); + mDistvec = sa - sb; + mDist = mDistvec.len(); } @@ -237,18 +237,18 @@ void GjkCollisionState::getCollisionInfo(const MatrixF& mat, Collision* info) AssertFatal(false, "GjkCollisionState::getCollisionInfo() - There remain scaling problems here."); // This assumes that the shapes do not intersect Point3F pa,pb; - if (bits) { + if (mBits) { getClosestPoints(pa,pb); mat.mulP(pa,&info->point); - b->getTransform().mulP(pb,&pa); + mB->getTransform().mulP(pb,&pa); info->normal = info->point - pa; } else { - mat.mulP(p[last],&info->point); - info->normal = v; + mat.mulP(mP[mLast],&info->point); + info->normal = mDistvec; } info->normal.normalize(); - info->object = b->getObject(); + info->object = mB->getObject(); } void GjkCollisionState::getClosestPoints(Point3F& p1, Point3F& p2) @@ -257,10 +257,10 @@ void GjkCollisionState::getClosestPoints(Point3F& p1, Point3F& p2) p1.set(0, 0, 0); p2.set(0, 0, 0); for (S32 i = 0, bit = 1; i < 4; ++i, bit <<= 1) { - if (bits & bit) { - sum += det[bits][i]; - p1 += p[i] * det[bits][i]; - p2 += q[i] * det[bits][i]; + if (mBits & bit) { + sum += mDet[mBits][i]; + p1 += mP[i] * mDet[mBits][i]; + p2 += mQ[i] * mDet[mBits][i]; } } F32 s = 1 / sum; @@ -282,40 +282,40 @@ bool GjkCollisionState::intersect(const MatrixF& a2w, const MatrixF& b2w) w2b.inverse(); reset(a2w,b2w); - bits = 0; - all_bits = 0; + mBits = 0; + mAll_bits = 0; do { nextBit(); VectorF va,sa; - w2a.mulV(-v,&va); - p[last] = a->support(va); - a2w.mulP(p[last],&sa); + w2a.mulV(-mDistvec,&va); + mP[mLast] = mA->support(va); + a2w.mulP(mP[mLast],&sa); VectorF vb,sb; - w2b.mulV(v,&vb); - q[last] = b->support(vb); - b2w.mulP(q[last],&sb); + w2b.mulV(mDistvec,&vb); + mQ[mLast] = mB->support(vb); + b2w.mulP(mQ[mLast],&sb); VectorF w = sa - sb; - if (mDot(v,w) > 0) + if (mDot(mDistvec,w) > 0) return false; if (degenerate(w)) { ++num_irregularities; return false; } - y[last] = w; - all_bits = bits | last_bit; + mY[mLast] = w; + mAll_bits = mBits | mLast_bit; ++num_iterations; - if (!closest(v) || num_iterations > sIteration) { + if (!closest(mDistvec) || num_iterations > sIteration) { ++num_irregularities; return false; } } - while (bits < 15 && v.lenSquared() > sEpsilon2); + while (mBits < 15 && mDistvec.lenSquared() > sEpsilon2); return true; } @@ -337,51 +337,51 @@ F32 GjkCollisionState::distance(const MatrixF& a2w, const MatrixF& b2w, } reset(a2w,b2w); - bits = 0; - all_bits = 0; + mBits = 0; + mAll_bits = 0; F32 mu = 0; do { nextBit(); VectorF va,sa; - w2a.mulV(-v,&va); - p[last] = a->support(va); - a2w.mulP(p[last],&sa); + w2a.mulV(-mDistvec,&va); + mP[mLast] = mA->support(va); + a2w.mulP(mP[mLast],&sa); VectorF vb,sb; - w2b.mulV(v,&vb); - q[last] = b->support(vb); - b2w.mulP(q[last],&sb); + w2b.mulV(mDistvec,&vb); + mQ[mLast] = mB->support(vb); + b2w.mulP(mQ[mLast],&sb); VectorF w = sa - sb; - F32 nm = mDot(v, w) / dist; + F32 nm = mDot(mDistvec, w) / mDist; if (nm > mu) mu = nm; if (mu > dontCareDist) return mu; - if (mFabs(dist - mu) <= dist * rel_error) - return dist; + if (mFabs(mDist - mu) <= mDist * rel_error) + return mDist; ++num_iterations; if (degenerate(w) || num_iterations > sIteration) { ++num_irregularities; - return dist; + return mDist; } - y[last] = w; - all_bits = bits | last_bit; + mY[mLast] = w; + mAll_bits = mBits | mLast_bit; - if (!closest(v)) { + if (!closest(mDistvec)) { ++num_irregularities; - return dist; + return mDist; } - dist = v.len(); + mDist = mDistvec.len(); } - while (bits < 15 && dist > sTolerance) ; + while (mBits < 15 && mDist > sTolerance) ; - if (bits == 15 && mu <= 0) - dist = 0; - return dist; + if (mBits == 15 && mu <= 0) + mDist = 0; + return mDist; } diff --git a/Engine/source/collision/gjk.h b/Engine/source/collision/gjk.h index b35f4570d..906007bb3 100644 --- a/Engine/source/collision/gjk.h +++ b/Engine/source/collision/gjk.h @@ -43,17 +43,17 @@ struct GjkCollisionState: public CollisionState { /// @name Temporary values /// @{ - Point3F p[4]; ///< support points of object A in local coordinates - Point3F q[4]; ///< support points of object B in local coordinates - VectorF y[4]; ///< support points of A - B in world coordinates + Point3F mP[4]; ///< support points of object A in local coordinates + Point3F mQ[4]; ///< support points of object B in local coordinates + VectorF mY[4]; ///< support points of A - B in world coordinates - S32 bits; ///< identifies current simplex - S32 all_bits; ///< all_bits = bits | last_bit - F32 det[16][4]; ///< cached sub-determinants - F32 dp[4][4]; ///< cached dot products + S32 mBits; ///< identifies current simplex + S32 mAll_bits; ///< all_bits = bits | last_bit + F32 mDet[16][4]; ///< cached sub-determinants + F32 mDP[4][4]; ///< cached dot products - S32 last; ///< identifies last found support point - S32 last_bit; ///< last_bit = 1< Date: Thu, 15 Mar 2018 20:44:13 -0500 Subject: [PATCH 068/144] gfxDrawutil, gizmo shadowvar cleanups --- Engine/source/gfx/gfxDrawUtil.cpp | 14 +++++++------- Engine/source/gui/worldEditor/gizmo.cpp | 6 +++--- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Engine/source/gfx/gfxDrawUtil.cpp b/Engine/source/gfx/gfxDrawUtil.cpp index 0e7a4b3e9..131d7ccaa 100644 --- a/Engine/source/gfx/gfxDrawUtil.cpp +++ b/Engine/source/gfx/gfxDrawUtil.cpp @@ -1041,9 +1041,9 @@ void GFXDrawUtil::_drawSolidPolyhedron( const GFXStateBlockDesc &desc, const Any continue; } - U32 numPoints = poly.extractFace( i, &indices[ idx ], numIndices - idx ); - numIndicesForPoly[ numPolys ] = numPoints; - idx += numPoints; + U32 polyIDx = poly.extractFace( i, &indices[ idx ], numIndices - idx ); + numIndicesForPoly[ numPolys ] = polyIDx; + idx += polyIDx; numPolys ++; } @@ -1083,11 +1083,11 @@ void GFXDrawUtil::drawObjectBox( const GFXStateBlockDesc &desc, const Point3F &s PrimBuild::color( color ); PrimBuild::begin( GFXLineList, 48 ); - static const Point3F cubePoints[8] = + Point3F cubePts[8]; + for (U32 i = 0; i < 8; i++) { - Point3F(-0.5, -0.5, -0.5), Point3F(-0.5, -0.5, 0.5), Point3F(-0.5, 0.5, -0.5), Point3F(-0.5, 0.5, 0.5), - Point3F( 0.5, -0.5, -0.5), Point3F( 0.5, -0.5, 0.5), Point3F( 0.5, 0.5, -0.5), Point3F( 0.5, 0.5, 0.5) - }; + cubePts[i] = cubePoints[i]/2; + } // 8 corner points of the box for ( U32 i = 0; i < 8; i++ ) diff --git a/Engine/source/gui/worldEditor/gizmo.cpp b/Engine/source/gui/worldEditor/gizmo.cpp index 029cae110..a74202f81 100644 --- a/Engine/source/gui/worldEditor/gizmo.cpp +++ b/Engine/source/gui/worldEditor/gizmo.cpp @@ -612,12 +612,12 @@ bool Gizmo::collideAxisGizmo( const Gui3DMouseEvent & event ) Point3F(mOrigin + (p1 + p2) * scale) }; - Point3F end = camPos + event.vec * smProjectDistance; - F32 t = plane.intersect(camPos, end); + Point3F endProj = camPos + event.vec * smProjectDistance; + F32 t = plane.intersect(camPos, endProj); if ( t >= 0 && t <= 1 ) { Point3F pos; - pos.interpolate(camPos, end, t); + pos.interpolate(camPos, endProj, t); // check if inside our 'poly' of this axisIdx vector... bool inside = true; From bb9d181615d35b6074eb397a1bf4e247db943a64 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 15 Mar 2018 20:45:18 -0500 Subject: [PATCH 069/144] tinyxml core class uses a 'value' variable. method io and tempvars altered to work around the 'conflict' --- Engine/source/persistence/taml/fsTinyXml.cpp | 6 +++--- Engine/source/persistence/taml/fsTinyXml.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Engine/source/persistence/taml/fsTinyXml.cpp b/Engine/source/persistence/taml/fsTinyXml.cpp index 441169742..8afe7f16c 100644 --- a/Engine/source/persistence/taml/fsTinyXml.cpp +++ b/Engine/source/persistence/taml/fsTinyXml.cpp @@ -199,16 +199,16 @@ void fsTiXmlAttribute::Print( FileStream& stream, int depth, TIXML_STRING* str ) { TIXML_STRING n, v; - TiXmlString value = TiXmlString(Value()); + TiXmlString val = TiXmlString(Value()); EncodeString( NameTStr(), &n ); - EncodeString( value, &v ); + EncodeString( val, &v ); for ( int i=0; i< depth; i++ ) { stream.writeText( " " ); } - if (value.find ('\"') == TIXML_STRING::npos) { + if (val.find ('\"') == TIXML_STRING::npos) { const char* pValue = v.c_str(); char buffer[4096]; const S32 length = dSprintf(buffer, sizeof(buffer), "%s=\"%s\"", n.c_str(), pValue); diff --git a/Engine/source/persistence/taml/fsTinyXml.h b/Engine/source/persistence/taml/fsTinyXml.h index 864abec09..5040abf1a 100644 --- a/Engine/source/persistence/taml/fsTinyXml.h +++ b/Engine/source/persistence/taml/fsTinyXml.h @@ -129,7 +129,7 @@ public: attrib->SetValue( _value ); } } - void SetAttribute( const char * name, int value ) + void SetAttribute( const char * name, int _value) { TiXmlAttribute* attrib = attributeSet.Find( name ); if(!attrib) @@ -139,7 +139,7 @@ public: attrib->SetName( name ); } if ( attrib ) { - attrib->SetIntValue( value ); + attrib->SetIntValue(_value); } } TiXmlNode* Identify( const char* p, TiXmlEncoding encoding ); From d810e6d208bc64e0c7bd1953a3937d462b70d827 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 15 Mar 2018 20:47:25 -0500 Subject: [PATCH 070/144] forest shadowvar cleanups --- Engine/source/forest/forestCollision.cpp | 2 +- Engine/source/forest/forestWindEmitter.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Engine/source/forest/forestCollision.cpp b/Engine/source/forest/forestCollision.cpp index 213f15775..468c901dc 100644 --- a/Engine/source/forest/forestCollision.cpp +++ b/Engine/source/forest/forestCollision.cpp @@ -151,7 +151,7 @@ void ForestConvex::getFeatures( const MatrixF &mat, const VectorF &n, ConvexFeat for (i = 0; i < numVerts; i++) { cf->mVertexList.increment(); - U32 index = emitString[currPos++]; + index = emitString[currPos++]; mat.mulP(pAccel->vertexList[index], &cf->mVertexList.last()); } diff --git a/Engine/source/forest/forestWindEmitter.cpp b/Engine/source/forest/forestWindEmitter.cpp index 46b879214..f02adbee6 100644 --- a/Engine/source/forest/forestWindEmitter.cpp +++ b/Engine/source/forest/forestWindEmitter.cpp @@ -150,10 +150,10 @@ void ForestWind::processTick() mCurrentInterp = 0; mCurrentTarget.set( 0, 0 ); - Point2F windDir( mDirection.x, mDirection.y ); - windDir.normalizeSafe(); + Point2F windNorm( mDirection.x, mDirection.y ); + windNorm.normalizeSafe(); - mCurrentTarget = finalVec + windDir; + mCurrentTarget = finalVec + windNorm; } else { From 248c5e9e6958b1a1581bc817a18facec7cb65f3b Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 15 Mar 2018 21:41:17 -0500 Subject: [PATCH 071/144] shadowvar cleanup --- Engine/source/T3D/gameBase/gameBase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/T3D/gameBase/gameBase.cpp b/Engine/source/T3D/gameBase/gameBase.cpp index d6afda811..ad7e4d983 100644 --- a/Engine/source/T3D/gameBase/gameBase.cpp +++ b/Engine/source/T3D/gameBase/gameBase.cpp @@ -455,7 +455,7 @@ F32 GameBase::getUpdatePriority(CameraScopeQuery *camInfo, U32 updateMask, S32 u // Projectiles are more interesting if they // are heading for us. wInterest = 0.30f; - F32 dot = -mDot(pos,getVelocity()); + dot = -mDot(pos,getVelocity()); if (dot > 0.0f) wInterest += 0.20 * dot; } From 5282b37d9f7473a4cd6dcae1aa9f888e8ed9dadf Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 11:13:26 -0500 Subject: [PATCH 072/144] shadowvar cleanup --- Engine/source/T3D/entity.cpp | 2 -- Engine/source/console/engineDoc.cpp | 8 ++++---- Engine/source/console/fieldBrushObject.cpp | 4 ++-- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Engine/source/T3D/entity.cpp b/Engine/source/T3D/entity.cpp index 62c0b031f..8e9426a23 100644 --- a/Engine/source/T3D/entity.cpp +++ b/Engine/source/T3D/entity.cpp @@ -1542,11 +1542,9 @@ void Entity::write(Stream &stream, U32 tabStop, U32 flags) if (mComponents.size() > 0) { // Pack out the behaviors into fields - U32 i = 0; for (U32 i = 0; i < mComponents.size(); i++) { writeTabs(stream, tabStop + 1); - char buffer[1024]; dSprintf(buffer, sizeof(buffer), "new %s() {\r\n", mComponents[i]->getClassName()); stream.write(dStrlen(buffer), buffer); //bi->writeFields( stream, tabStop + 2 ); diff --git a/Engine/source/console/engineDoc.cpp b/Engine/source/console/engineDoc.cpp index 5625418b7..cbbc7249d 100644 --- a/Engine/source/console/engineDoc.cpp +++ b/Engine/source/console/engineDoc.cpp @@ -248,13 +248,13 @@ static void dumpFunction( Stream &stream, const char* brief = dStrstr( doc, "@brief" ); if( !brief ) { - String brief = entry->getBriefDescription( &doc ); + String briefStr = entry->getBriefDescription( &doc ); - brief.trim(); - if( !brief.isEmpty() ) + briefStr.trim(); + if( !briefStr.isEmpty() ) { stream.writeText( "@brief " ); - stream.writeText( brief ); + stream.writeText(briefStr); stream.writeText( "\r\n\r\n" ); } } diff --git a/Engine/source/console/fieldBrushObject.cpp b/Engine/source/console/fieldBrushObject.cpp index 407a57cb3..3e91f711a 100644 --- a/Engine/source/console/fieldBrushObject.cpp +++ b/Engine/source/console/fieldBrushObject.cpp @@ -449,10 +449,10 @@ void FieldBrushObject::copyFields( SimObject* pSimObject, const char* fieldList // Yes, so is this field name selected? // Iterate fields... - for ( U32 fieldIndex = 0; fieldIndex < fields.size(); ++fieldIndex ) + for ( U32 findFieldIDx = 0; findFieldIDx < fields.size(); ++findFieldIDx) { // Field selected? - if ( staticField.pFieldname == fields[fieldIndex] ) + if ( staticField.pFieldname == fields[findFieldIDx] ) { // Yes, so flag as such. fieldSpecified = true; From 36c3a4d371578f1e4c15cd756ac12e7eb1412ed2 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 16:21:53 -0500 Subject: [PATCH 073/144] (crashfix) clean up shadowvar followup. --- Engine/source/gui/editor/guiInspector.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/gui/editor/guiInspector.cpp b/Engine/source/gui/editor/guiInspector.cpp index de6e43361..06e06d996 100644 --- a/Engine/source/gui/editor/guiInspector.cpp +++ b/Engine/source/gui/editor/guiInspector.cpp @@ -673,8 +673,8 @@ void GuiInspector::refresh() } else { - mGroups.push_back( group ); - addObject( group ); + mGroups.push_back(newGroup); + addObject(newGroup); } } } From c3698c1db6219296158b0af05e55407f0a88178f Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 17:12:22 -0500 Subject: [PATCH 074/144] unnecessarily duplicated var definitions --- Engine/source/T3D/decal/decalManager.cpp | 34 ++++++++++---------- Engine/source/collision/depthSortList.cpp | 2 +- Engine/source/collision/earlyOutPolyList.cpp | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Engine/source/T3D/decal/decalManager.cpp b/Engine/source/T3D/decal/decalManager.cpp index ab53842e5..2aa3bc2e0 100644 --- a/Engine/source/T3D/decal/decalManager.cpp +++ b/Engine/source/T3D/decal/decalManager.cpp @@ -1302,14 +1302,14 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) // Loop through batches allocating buffers and submitting render instances. for ( U32 i = 0; i < batches.size(); i++ ) { - DecalBatch ¤tBatch = batches[i]; + currentBatch = &batches[i]; // Copy data into the system memory arrays, from all decals in this batch... DecalVertex *vpPtr = vertData; U16 *pbPtr = indexData; - U32 lastDecal = currentBatch.startDecal + currentBatch.decalCount; + U32 lastDecal = currentBatch->startDecal + currentBatch->decalCount; U32 voffset = 0; U32 ioffset = 0; @@ -1317,13 +1317,13 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) // This is an ugly hack for ProjectedShadow! GFXTextureObject *customTex = NULL; - for ( U32 j = currentBatch.startDecal; j < lastDecal; j++ ) + for ( U32 j = currentBatch->startDecal; j < lastDecal; j++ ) { - DecalInstance *dinst = mDecalQueue[j]; + dinst = mDecalQueue[j]; const U32 indxCount = - (dinst->mIndxCount > currentBatch.iCount) ? - currentBatch.iCount : dinst->mIndxCount; + (dinst->mIndxCount > currentBatch->iCount) ? + currentBatch->iCount : dinst->mIndxCount; for ( U32 k = 0; k < indxCount; k++ ) { *( pbPtr + ioffset + k ) = dinst->mIndices[k] + voffset; @@ -1332,8 +1332,8 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) ioffset += indxCount; const U32 vertCount = - (dinst->mVertCount > currentBatch.vCount) ? - currentBatch.vCount : dinst->mVertCount; + (dinst->mVertCount > currentBatch->vCount) ? + currentBatch->vCount : dinst->mVertCount; dMemcpy( vpPtr + voffset, dinst->mVerts, sizeof( DecalVertex ) * vertCount ); voffset += vertCount; @@ -1342,8 +1342,8 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) customTex = *dinst->mCustomTex; } - AssertFatal( ioffset == currentBatch.iCount, "bad" ); - AssertFatal( voffset == currentBatch.vCount, "bad" ); + AssertFatal( ioffset == currentBatch->iCount, "bad" ); + AssertFatal( voffset == currentBatch->vCount, "bad" ); // Get handles to video memory buffers we will be filling... @@ -1385,9 +1385,9 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) pb->lock( &pbPtr ); // Memcpy from system to video memory. - const U32 vpCount = sizeof( DecalVertex ) * currentBatch.vCount; + const U32 vpCount = sizeof( DecalVertex ) * currentBatch->vCount; dMemcpy( vpPtr, vertData, vpCount ); - const U32 pbCount = sizeof( U16 ) * currentBatch.iCount; + const U32 pbCount = sizeof( U16 ) * currentBatch->iCount; dMemcpy( pbPtr, indexData, pbCount ); pb->unlock(); @@ -1400,7 +1400,7 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) // Get the best lights for the current camera position // if the materail is forward lit and we haven't got them yet. - if ( currentBatch.matInst->isForwardLit() && !baseRenderInst.lights[0] ) + if ( currentBatch->matInst->isForwardLit() && !baseRenderInst.lights[0] ) { LightQuery query; query.init( rootFrustum.getPosition(), @@ -1416,15 +1416,15 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) ri->primBuff = pb; ri->vertBuff = vb; - ri->matInst = currentBatch.matInst; + ri->matInst = currentBatch->matInst; ri->prim = renderPass->allocPrim(); ri->prim->type = GFXTriangleList; ri->prim->minIndex = 0; ri->prim->startIndex = 0; - ri->prim->numPrimitives = currentBatch.iCount / 3; + ri->prim->numPrimitives = currentBatch->iCount / 3; ri->prim->startVertex = 0; - ri->prim->numVertices = currentBatch.vCount; + ri->prim->numVertices = currentBatch->vCount; // Ugly hack for ProjectedShadow! if ( customTex ) @@ -1433,7 +1433,7 @@ void DecalManager::prepRenderImage( SceneRenderState* state ) // The decal bin will contain render instances for both decals and decalRoad's. // Dynamic decals render last, then editor decals and roads in priority order. // DefaultKey is sorted in descending order. - ri->defaultKey = currentBatch.dynamic ? 0xFFFFFFFF : (U32)currentBatch.priority; + ri->defaultKey = currentBatch->dynamic ? 0xFFFFFFFF : (U32)currentBatch->priority; ri->defaultKey2 = 1;//(U32)lastDecal->mDataBlock; renderPass->addInst( ri ); diff --git a/Engine/source/collision/depthSortList.cpp b/Engine/source/collision/depthSortList.cpp index 87a50fab5..2ead81479 100644 --- a/Engine/source/collision/depthSortList.cpp +++ b/Engine/source/collision/depthSortList.cpp @@ -123,7 +123,7 @@ void DepthSortList::setExtents(Poly & poly, PolyExtents & polyExtents) polyExtents.zMin = polyExtents.zMax = p.z; for (S32 i=poly.vertexStart+1; i 0) { iv.mask = 1 << i; break; From d95af847e4620b383fc86b4132eacede22c71c1f Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 17:14:12 -0500 Subject: [PATCH 075/144] flipped debug rendering on for convexShapes, and added the following prefs: $pref::convexDBG::ShowWorldBox = (bool); $pref::convexDBG::ShowEdges = (bool); <-----------aparantly nonfucntional $pref::convexDBG::ShowFaceColors = (bool); $pref::convexDBG::ShowWinding = (bool); $pref::convexDBG::ShowSurfaceTransforms = (bool); --- Engine/source/T3D/convexShape.cpp | 35 ++++++++++--------------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/Engine/source/T3D/convexShape.cpp b/Engine/source/T3D/convexShape.cpp index b5134be65..f97b543f6 100644 --- a/Engine/source/T3D/convexShape.cpp +++ b/Engine/source/T3D/convexShape.cpp @@ -492,7 +492,6 @@ void ConvexShape::unpackUpdate( NetConnection *conn, BitStream *stream ) void ConvexShape::prepRenderImage( SceneRenderState *state ) { - /* if ( state->isDiffusePass() ) { ObjectRenderInst *ri2 = state->getRenderPass()->allocInst(); @@ -500,8 +499,7 @@ void ConvexShape::prepRenderImage( SceneRenderState *state ) ri2->type = RenderPassManager::RIT_Editor; state->getRenderPass()->addInst( ri2 ); } - */ - + if ( mVertexBuffer.isNull() || !state) return; @@ -747,21 +745,10 @@ bool ConvexShape::castRay( const Point3F &start, const Point3F &end, RayInfo *in F32 t; F32 tmin = F32_MAX; S32 hitFace = -1; - Point3F hitPnt, pnt; + Point3F pnt; VectorF rayDir( end - start ); rayDir.normalizeSafe(); - - if ( false ) - { - PlaneF plane( Point3F(0,0,0), Point3F(0,0,1) ); - Point3F sp( 0,0,-1 ); - Point3F ep( 0,0,1 ); - - F32 t = plane.intersect( sp, ep ); - Point3F hitPnt; - hitPnt.interpolate( sp, ep, t ); - } - + for ( S32 i = 0; i < planeCount; i++ ) { // Don't hit the back-side of planes. @@ -1180,11 +1167,11 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B GFX->setTexture( 0, NULL ); // Render world box. - if ( false ) + if (Con::getBoolVariable("$pref::convexDBG::ShowWorldBox", false)) { Box3F wbox( mWorldBox ); - //if ( getServerObject() ) - // Box3F wbox = static_cast( getServerObject() )->mWorldBox; + if ( getServerObject() ) + wbox = static_cast( getServerObject() )->mWorldBox; GFXStateBlockDesc desc; desc.setCullMode( GFXCullNone ); desc.setFillModeWireframe(); @@ -1196,7 +1183,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B const Vector< ConvexShape::Face > &faceList = mGeometry.faces; // Render Edges. - if ( false ) + if (Con::getBoolVariable("$pref::convexDBG::ShowEdges", false)) { GFXTransformSaver saver; //GFXFrustumSaver fsaver; @@ -1250,7 +1237,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B objToWorld.scale( mObjScale ); // Render faces centers/colors. - if ( false ) + if (Con::getBoolVariable("$pref::convexDBG::ShowFaceColors", false)) { GFXStateBlockDesc desc; desc.setCullMode( GFXCullNone ); @@ -1274,7 +1261,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B } // Render winding order. - if ( false ) + if (Con::getBoolVariable("$pref::convexDBG::ShowWinding", false)) { GFXStateBlockDesc desc; desc.setCullMode( GFXCullNone ); @@ -1331,7 +1318,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B } // Render surface transforms. - if ( false ) + if (Con::getBoolVariable("$pref::convexDBG::ShowSurfaceTransforms", false)) { GFXStateBlockDesc desc; desc.setBlend( false ); @@ -1341,7 +1328,7 @@ void ConvexShape::_renderDebug( ObjectRenderInst *ri, SceneRenderState *state, B for ( S32 i = 0; i < mSurfaces.size(); i++ ) { - MatrixF objToWorld( mObjToWorld ); + objToWorld = mObjToWorld; objToWorld.scale( mObjScale ); MatrixF renderMat; From e4bd3e8295a86a697c937c1fdca302735c2ec400 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 17:40:25 -0500 Subject: [PATCH 076/144] shadowvar cleanup --- Engine/source/gui/controls/guiTreeViewCtrl.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index 266151587..881f76ed4 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -3026,25 +3026,25 @@ void GuiTreeViewCtrl::onMouseUp(const GuiEvent &event) } hitFlags = 0; - Item *item; - bool hitCheck = _hitTest( event.mousePoint, item, hitFlags ); + Item *hitItem; + bool hitCheck = _hitTest( event.mousePoint, hitItem, hitFlags ); mRenamingItem = NULL; if( hitCheck ) { if ( event.mouseClickCount == 1 && !mMouseDragged && mPossibleRenameItem != NULL ) { - if ( item == mPossibleRenameItem ) - showItemRenameCtrl( item ); + if (hitItem == mPossibleRenameItem ) + showItemRenameCtrl(hitItem); } else // If mouseUp occurs on the same item as mouse down { - bool wasSelected = isSelected( item ); + bool wasSelected = isSelected(hitItem); bool multiSelect = getSelectedItemsCount() > 1; - if( wasSelected && multiSelect && item == mTempItem ) + if( wasSelected && multiSelect && hitItem == mTempItem ) { clearSelection(); - addSelection( item->mId ); + addSelection( hitItem->mId ); } } } From 53ce915dcfe39f1b5558e23bbe83e30beb224b4a Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 18:40:32 -0500 Subject: [PATCH 077/144] collada/ts chain shadowvar and member var clenaups --- Engine/source/ts/collada/colladaAppMesh.cpp | 14 +- Engine/source/ts/collada/colladaImport.cpp | 6 +- .../source/ts/collada/colladaShapeLoader.cpp | 22 +- Engine/source/ts/collada/colladaUtils.cpp | 4 +- Engine/source/ts/loader/tsShapeLoader.cpp | 454 +++++++++--------- Engine/source/ts/loader/tsShapeLoader.h | 28 +- 6 files changed, 264 insertions(+), 264 deletions(-) diff --git a/Engine/source/ts/collada/colladaAppMesh.cpp b/Engine/source/ts/collada/colladaAppMesh.cpp index c1420d1cd..5a928dae0 100644 --- a/Engine/source/ts/collada/colladaAppMesh.cpp +++ b/Engine/source/ts/collada/colladaAppMesh.cpp @@ -147,12 +147,12 @@ private: end = start; // Get the set for this input - const domInputLocalOffset* localOffset = daeSafeCast(input); + domInputLocalOffset* localOffset = daeSafeCast(input); domUint newSet = localOffset ? localOffset->getSet() : 0; // Add the input to the right place in the list (somewhere between start and end) for (S32 i = start; i <= end; i++) { - const domInputLocalOffset* localOffset = daeSafeCast(sortedInputs[i]); + localOffset = daeSafeCast(sortedInputs[i]); domUint set = localOffset ? localOffset->getSet() : 0xFFFFFFFF; if (newSet < set) { for (S32 j = i + 1; j <= end; j++) @@ -181,10 +181,10 @@ private: const char* semantic = SourceTypeToSemantic( type ); for (S32 iInput = 0; iInput < vertices->getInput_array().getCount(); iInput++) { - domInputLocal* input = vertices->getInput_array().get(iInput); - if (dStrEqual(input->getSemantic(), semantic)) + domInputLocal* vInput = vertices->getInput_array().get(iInput); + if (dStrEqual(vInput->getSemantic(), semantic)) { - source = daeSafeCast(findInputSource(input)); + source = daeSafeCast(findInputSource(vInput)); break; } } @@ -966,7 +966,7 @@ void ColladaAppMesh::lookupSkinData() // Determine the offset into the vindices array for each vertex (since each // vertex may have multiple [bone, weight] pairs in the array) Vector vindicesOffset; - const domInt* vindices = (domInt*)weights_v.getRaw(0); + domInt* vindices = (domInt*)weights_v.getRaw(0); for (S32 iWeight = 0; iWeight < weights_vcount.getCount(); iWeight++) { // Store the offset into the vindices array for this vertex vindicesOffset.push_back(vindices - (domInt*)weights_v.getRaw(0)); @@ -977,7 +977,7 @@ void ColladaAppMesh::lookupSkinData() bool tooManyWeightsWarning = false; for (S32 iVert = 0; iVert < vertsPerFrame; iVert++) { const domUint* vcount = (domUint*)weights_vcount.getRaw(0); - const domInt* vindices = (domInt*)weights_v.getRaw(0); + vindices = (domInt*)weights_v.getRaw(0); vindices += vindicesOffset[vertTuples[iVert].vertex]; S32 nonZeroWeightCount = 0; diff --git a/Engine/source/ts/collada/colladaImport.cpp b/Engine/source/ts/collada/colladaImport.cpp index 1cc2909b0..ded830d5c 100644 --- a/Engine/source/ts/collada/colladaImport.cpp +++ b/Engine/source/ts/collada/colladaImport.cpp @@ -120,9 +120,9 @@ static void processNode(GuiTreeViewCtrl* tree, domNode* node, S32 parentID, Scen for (S32 i = 0; i < node->getInstance_node_array().getCount(); i++) { domInstance_node* instnode = node->getInstance_node_array()[i]; - domNode* node = daeSafeCast(instnode->getUrl().getElement()); - if (node) - processNode(tree, node, nodeID, stats); + domNode* dNode = daeSafeCast(instnode->getUrl().getElement()); + if (dNode) + processNode(tree, dNode, nodeID, stats); } } diff --git a/Engine/source/ts/collada/colladaShapeLoader.cpp b/Engine/source/ts/collada/colladaShapeLoader.cpp index afb53fdaf..1ac98e072 100644 --- a/Engine/source/ts/collada/colladaShapeLoader.cpp +++ b/Engine/source/ts/collada/colladaShapeLoader.cpp @@ -239,14 +239,14 @@ void ColladaShapeLoader::enumerateScene() for (S32 iClipLib = 0; iClipLib < root->getLibrary_animation_clips_array().getCount(); iClipLib++) { const domLibrary_animation_clips* libraryClips = root->getLibrary_animation_clips_array()[iClipLib]; for (S32 iClip = 0; iClip < libraryClips->getAnimation_clip_array().getCount(); iClip++) - appSequences.push_back(new ColladaAppSequence(libraryClips->getAnimation_clip_array()[iClip])); + mAppSequences.push_back(new ColladaAppSequence(libraryClips->getAnimation_clip_array()[iClip])); } // Process all animations => this attaches animation channels to the targeted // Collada elements, and determines the length of the sequence if it is not // already specified in the Collada element - for (S32 iSeq = 0; iSeq < appSequences.size(); iSeq++) { - ColladaAppSequence* appSeq = dynamic_cast(appSequences[iSeq]); + for (S32 iSeq = 0; iSeq < mAppSequences.size(); iSeq++) { + ColladaAppSequence* appSeq = dynamic_cast(mAppSequences[iSeq]); F32 maxEndTime = 0; F32 minFrameTime = 1000.0f; for (S32 iAnim = 0; iAnim < appSeq->getClip()->getInstance_animation_array().getCount(); iAnim++) { @@ -317,7 +317,7 @@ void ColladaShapeLoader::enumerateScene() } // Make sure that the scene has a bounds node (for getting the root scene transform) - if (!boundsNode) + if (!mBoundsNode) { domVisual_scene* visualScene = root->getLibrary_visual_scenes_array()[0]->getVisual_scene_array()[0]; domNode* dombounds = daeSafeCast( visualScene->createAndPlace( "node" ) ); @@ -354,7 +354,7 @@ void ColladaShapeLoader::computeBounds(Box3F& bounds) ColladaUtils::getOptions().adjustFloor) ) { // Compute shape offset - Point3F shapeOffset = Point3F::Zero; + Point3F shapeOffset = Point3F::Zero; if ( ColladaUtils::getOptions().adjustCenter ) { bounds.getCenter( &shapeOffset ); @@ -368,24 +368,24 @@ void ColladaShapeLoader::computeBounds(Box3F& bounds) bounds.maxExtents += shapeOffset; // Now adjust all positions for root level nodes (nodes with no parent) - for (S32 iNode = 0; iNode < shape->nodes.size(); iNode++) + for (S32 iNode = 0; iNode < mShape->nodes.size(); iNode++) { - if ( !appNodes[iNode]->isParentRoot() ) + if ( !mAppNodes[iNode]->isParentRoot() ) continue; // Adjust default translation - shape->defaultTranslations[iNode] += shapeOffset; + mShape->defaultTranslations[iNode] += shapeOffset; // Adjust animated translations - for (S32 iSeq = 0; iSeq < shape->sequences.size(); iSeq++) + for (S32 iSeq = 0; iSeq < mShape->sequences.size(); iSeq++) { - const TSShape::Sequence& seq = shape->sequences[iSeq]; + const TSShape::Sequence& seq = mShape->sequences[iSeq]; if ( seq.translationMatters.test(iNode) ) { for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { S32 index = seq.baseTranslation + seq.translationMatters.count(iNode)*seq.numKeyframes + iFrame; - shape->nodeTranslations[index] += shapeOffset; + mShape->nodeTranslations[index] += shapeOffset; } } } diff --git a/Engine/source/ts/collada/colladaUtils.cpp b/Engine/source/ts/collada/colladaUtils.cpp index e88abe372..2294ff7be 100644 --- a/Engine/source/ts/collada/colladaUtils.cpp +++ b/Engine/source/ts/collada/colladaUtils.cpp @@ -263,10 +263,10 @@ void AnimData::parseTargetString(const char* target, S32 fullCount, const char* targetValueCount = 1; } } - else if (const char* p = dStrrchr(target, '.')) { + else if (const char* p2 = dStrrchr(target, '.')) { // Check for named elements for (S32 iElem = 0; elements[iElem][0] != 0; iElem++) { - if (!dStrcmp(p, elements[iElem])) { + if (!dStrcmp(p2, elements[iElem])) { targetValueOffset = iElem; targetValueCount = 1; break; diff --git a/Engine/source/ts/loader/tsShapeLoader.cpp b/Engine/source/ts/loader/tsShapeLoader.cpp index 11779eb6b..35cc9c8bd 100644 --- a/Engine/source/ts/loader/tsShapeLoader.cpp +++ b/Engine/source/ts/loader/tsShapeLoader.cpp @@ -44,7 +44,7 @@ const F32 TSShapeLoader::DefaultTime = -1.0f; const F64 TSShapeLoader::MinFrameRate = 15.0f; const F64 TSShapeLoader::MaxFrameRate = 60.0f; const F64 TSShapeLoader::AppGroundFrameRate = 10.0f; -Torque::Path TSShapeLoader::shapePath; +Torque::Path TSShapeLoader::mShapePath; Vector TSShapeLoader::smFormats; @@ -73,7 +73,7 @@ MatrixF TSShapeLoader::getLocalNodeMatrix(AppNode* node, F32 t) if (node->mParentIndex >= 0) { - AppNode *parent = appNodes[node->mParentIndex]; + AppNode *parent = mAppNodes[node->mParentIndex]; MatrixF m2 = parent->getNodeTransform(t); @@ -84,10 +84,10 @@ MatrixF TSShapeLoader::getLocalNodeMatrix(AppNode* node, F32 t) // get local transform by pre-multiplying by inverted parent transform m1 = m2.inverse() * m1; } - else if (boundsNode && node != boundsNode) + else if (mBoundsNode && node != mBoundsNode) { // make transform relative to bounds node transform at time=t - MatrixF mb = boundsNode->getNodeTransform(t); + MatrixF mb = mBoundsNode->getNodeTransform(t); zapScale(mb); m1 = mb.inverse() * m1; } @@ -133,22 +133,22 @@ void TSShapeLoader::updateProgress(S32 major, const char* msg, S32 numMinor, S32 TSShape* TSShapeLoader::generateShape(const Torque::Path& path) { - shapePath = path; - shape = new TSShape(); + mShapePath = path; + mShape = new TSShape(); - shape->mExporterVersion = 124; - shape->mSmallestVisibleSize = 999999; - shape->mSmallestVisibleDL = 0; - shape->mReadVersion = 24; - shape->mFlags = 0; - shape->mSequencesConstructed = 0; + mShape->mExporterVersion = 124; + mShape->mSmallestVisibleSize = 999999; + mShape->mSmallestVisibleDL = 0; + mShape->mReadVersion = 24; + mShape->mFlags = 0; + mShape->mSequencesConstructed = 0; // Get all nodes, objects and sequences in the shape updateProgress(Load_EnumerateScene, "Enumerating scene..."); enumerateScene(); - if (!subshapes.size()) + if (!mSubshapes.size()) { - delete shape; + delete mShape; Con::errorf("Failed to load shape \"%s\", no subshapes found", path.getFullPath().c_str()); return NULL; } @@ -178,7 +178,7 @@ TSShape* TSShapeLoader::generateShape(const Torque::Path& path) // Install the TS memory helper into a TSShape object. install(); - return shape; + return mShape; } bool TSShapeLoader::processNode(AppNode* node) @@ -186,20 +186,20 @@ bool TSShapeLoader::processNode(AppNode* node) // Detect bounds node if ( node->isBounds() ) { - if ( boundsNode ) + if ( mBoundsNode ) { Con::warnf( "More than one bounds node found" ); return false; } - boundsNode = node; + mBoundsNode = node; // Process bounds geometry - MatrixF boundsMat(boundsNode->getNodeTransform(DefaultTime)); + MatrixF boundsMat(mBoundsNode->getNodeTransform(DefaultTime)); boundsMat.inverse(); zapScale(boundsMat); - for (S32 iMesh = 0; iMesh < boundsNode->getNumMesh(); iMesh++) + for (S32 iMesh = 0; iMesh < mBoundsNode->getNumMesh(); iMesh++) { - AppMesh* mesh = boundsNode->getMesh(iMesh); + AppMesh* mesh = mBoundsNode->getMesh(iMesh); MatrixF transform = mesh->getMeshTransform(DefaultTime); transform.mulL(boundsMat); mesh->lockMesh(DefaultTime, transform); @@ -215,10 +215,10 @@ bool TSShapeLoader::processNode(AppNode* node) } // Add this node to the subshape (create one if needed) - if ( subshapes.size() == 0 ) - subshapes.push_back( new TSShapeLoader::Subshape ); + if (mSubshapes.size() == 0 ) + mSubshapes.push_back( new TSShapeLoader::Subshape ); - subshapes.last()->branches.push_back( node ); + mSubshapes.last()->branches.push_back( node ); return true; } @@ -263,8 +263,8 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu if (appNode->isBounds()) return; - S32 subShapeNum = shape->subShapeFirstNode.size()-1; - Subshape* subshape = subshapes[subShapeNum]; + S32 subShapeNum = mShape->subShapeFirstNode.size()-1; + Subshape* subshape = mSubshapes[subShapeNum]; // Check if we should collapse this node S32 myIndex; @@ -275,16 +275,16 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu else { // Check that adding this node will not exceed the maximum node count - if (shape->nodes.size() >= MAX_TS_SET_SIZE) + if (mShape->nodes.size() >= MAX_TS_SET_SIZE) return; - myIndex = shape->nodes.size(); - String nodeName = getUniqueName(appNode->getName(), cmpShapeName, shape->names); + myIndex = mShape->nodes.size(); + String nodeName = getUniqueName(appNode->getName(), cmpShapeName, mShape->names); // Create the 3space node - shape->nodes.increment(); - TSShape::Node& lastNode = shape->nodes.last(); - lastNode.nameIndex = shape->addName(nodeName); + mShape->nodes.increment(); + TSShape::Node& lastNode = mShape->nodes.last(); + lastNode.nameIndex = mShape->addName(nodeName); lastNode.parentIndex = parentIndex; lastNode.firstObject = -1; lastNode.firstChild = -1; @@ -292,8 +292,8 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu // Add the AppNode to a matching list (so AppNodes can be accessed using 3space // node indices) - appNodes.push_back(appNode); - appNodes.last()->mParentIndex = parentIndex; + mAppNodes.push_back(appNode); + mAppNodes.last()->mParentIndex = parentIndex; // Check for NULL detail or AutoBillboard nodes (no children or geometry) if ((appNode->getNumChildNodes() == 0) && @@ -304,7 +304,7 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu if (dStrEqual(dname, "nulldetail") && (size != 0x7FFFFFFF)) { - shape->addDetail("detail", size, subShapeNum); + mShape->addDetail("detail", size, subShapeNum); } else if (appNode->isBillboard() && (size != 0x7FFFFFFF)) { @@ -323,9 +323,9 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu appNode->getInt("BB::DIM", dim); appNode->getBool("BB::INCLUDE_POLES", includePoles); - S32 detIndex = shape->addDetail( "bbDetail", size, -1 ); + S32 detIndex = mShape->addDetail( "bbDetail", size, -1 ); - TSShape::Detail& detIndexDetail = shape->details[detIndex]; + TSShape::Detail& detIndexDetail = mShape->details[detIndex]; detIndexDetail.bbEquatorSteps = numEquatorSteps; detIndexDetail.bbPolarSteps = numPolarSteps; detIndexDetail.bbDetailLevel = dl; @@ -357,23 +357,23 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu void TSShapeLoader::generateSubshapes() { - for (U32 iSub = 0; iSub < subshapes.size(); iSub++) + for (U32 iSub = 0; iSub < mSubshapes.size(); iSub++) { - updateProgress(Load_GenerateSubshapes, "Generating subshapes...", subshapes.size(), iSub); + updateProgress(Load_GenerateSubshapes, "Generating subshapes...", mSubshapes.size(), iSub); - Subshape* subshape = subshapes[iSub]; + Subshape* subshape = mSubshapes[iSub]; // Recurse through the node hierarchy, adding 3space nodes and // collecting geometry - S32 firstNode = shape->nodes.size(); - shape->subShapeFirstNode.push_back(firstNode); + S32 firstNode = mShape->nodes.size(); + mShape->subShapeFirstNode.push_back(firstNode); for (U32 iBranch = 0; iBranch < subshape->branches.size(); iBranch++) recurseSubshape(subshape->branches[iBranch], -1, true); - shape->subShapeNumNodes.push_back(shape->nodes.size() - firstNode); + mShape->subShapeNumNodes.push_back(mShape->nodes.size() - firstNode); - if (shape->nodes.size() >= MAX_TS_SET_SIZE) + if (mShape->nodes.size() >= MAX_TS_SET_SIZE) { Con::warnf("Shape exceeds the maximum node count (%d). Ignoring additional nodes.", MAX_TS_SET_SIZE); @@ -400,10 +400,10 @@ bool cmpMeshNameAndSize(const String& key, const Vector& names, void* ar void TSShapeLoader::generateObjects() { - for (S32 iSub = 0; iSub < subshapes.size(); iSub++) + for (S32 iSub = 0; iSub < mSubshapes.size(); iSub++) { - Subshape* subshape = subshapes[iSub]; - shape->subShapeFirstObject.push_back(shape->objects.size()); + Subshape* subshape = mSubshapes[iSub]; + mShape->subShapeFirstObject.push_back(mShape->objects.size()); // Get the names and sizes of the meshes for this subshape Vector meshNames; @@ -464,18 +464,18 @@ void TSShapeLoader::generateObjects() if (!lastName || (meshNames[iMesh] != *lastName)) { - shape->objects.increment(); - TSShape::Object& lastObject = shape->objects.last(); - lastObject.nameIndex = shape->addName(meshNames[iMesh]); + mShape->objects.increment(); + TSShape::Object& lastObject = mShape->objects.last(); + lastObject.nameIndex = mShape->addName(meshNames[iMesh]); lastObject.nodeIndex = subshape->objNodes[iMesh]; - lastObject.startMeshIndex = appMeshes.size(); + lastObject.startMeshIndex = mAppMeshes.size(); lastObject.numMeshes = 0; lastName = &meshNames[iMesh]; } // Add this mesh to the object - appMeshes.push_back(mesh); - shape->objects.last().numMeshes++; + mAppMeshes.push_back(mesh); + mShape->objects.last().numMeshes++; // Set mesh flags mesh->flags = 0; @@ -498,9 +498,9 @@ void TSShapeLoader::generateObjects() } // Attempt to add the detail (will fail if it already exists) - S32 oldNumDetails = shape->details.size(); - shape->addDetail(detailName, mesh->detailSize, iSub); - if (shape->details.size() > oldNumDetails) + S32 oldNumDetails = mShape->details.size(); + mShape->addDetail(detailName, mesh->detailSize, iSub); + if (mShape->details.size() > oldNumDetails) { Con::warnf("Object mesh \"%s\" has no matching detail (\"%s%d\" has" " been added automatically)", mesh->getName(false), detailName, mesh->detailSize); @@ -508,18 +508,18 @@ void TSShapeLoader::generateObjects() } // Get object count for this subshape - shape->subShapeNumObjects.push_back(shape->objects.size() - shape->subShapeFirstObject.last()); + mShape->subShapeNumObjects.push_back(mShape->objects.size() - mShape->subShapeFirstObject.last()); } } void TSShapeLoader::generateSkins() { Vector skins; - for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) { - for (S32 iMesh = 0; iMesh < shape->objects[iObject].numMeshes; iMesh++) + for (S32 iMesh = 0; iMesh < mShape->objects[iObject].numMeshes; iMesh++) { - AppMesh* mesh = appMeshes[shape->objects[iObject].startMeshIndex + iMesh]; + AppMesh* mesh = mAppMeshes[mShape->objects[iObject].startMeshIndex + iMesh]; if (mesh->isSkin()) skins.push_back(mesh); } @@ -543,12 +543,12 @@ void TSShapeLoader::generateSkins() { // Find the node that matches this bone skin->nodeIndex[iBone] = -1; - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppMeshes.size(); iNode++) { - if (appNodes[iNode]->isEqual(skin->bones[iBone])) + if (mAppNodes[iNode]->isEqual(skin->bones[iBone])) { delete skin->bones[iBone]; - skin->bones[iBone] = appNodes[iNode]; + skin->bones[iBone] = mAppNodes[iNode]; skin->nodeIndex[iBone] = iNode; break; } @@ -566,18 +566,18 @@ void TSShapeLoader::generateSkins() void TSShapeLoader::generateDefaultStates() { // Generate default object states (includes initial geometry) - for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) { updateProgress(Load_GenerateDefaultStates, "Generating initial mesh and node states...", - shape->objects.size(), iObject); + mShape->objects.size(), iObject); - TSShape::Object& obj = shape->objects[iObject]; + TSShape::Object& obj = mShape->objects[iObject]; // Calculate the objectOffset for each mesh at T=0 for (S32 iMesh = 0; iMesh < obj.numMeshes; iMesh++) { - AppMesh* appMesh = appMeshes[obj.startMeshIndex + iMesh]; - AppNode* appNode = obj.nodeIndex >= 0 ? appNodes[obj.nodeIndex] : boundsNode; + AppMesh* appMesh = mAppMeshes[obj.startMeshIndex + iMesh]; + AppNode* appNode = obj.nodeIndex >= 0 ? mAppNodes[obj.nodeIndex] : mBoundsNode; MatrixF meshMat(appMesh->getMeshTransform(DefaultTime)); MatrixF nodeMat(appMesh->isSkin() ? meshMat : appNode->getNodeTransform(DefaultTime)); @@ -587,16 +587,16 @@ void TSShapeLoader::generateDefaultStates() appMesh->objectOffset = nodeMat.inverse() * meshMat; } - generateObjectState(shape->objects[iObject], DefaultTime, true, true); + generateObjectState(mShape->objects[iObject], DefaultTime, true, true); } // Generate default node transforms - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { // Determine the default translation and rotation for the node QuatF rot, srot; Point3F trans, scale; - generateNodeTransform(appNodes[iNode], DefaultTime, false, 0, rot, trans, srot, scale); + generateNodeTransform(mAppNodes[iNode], DefaultTime, false, 0, rot, trans, srot, scale); // Add default node translation and rotation addNodeRotation(rot, true); @@ -606,20 +606,20 @@ void TSShapeLoader::generateDefaultStates() void TSShapeLoader::generateObjectState(TSShape::Object& obj, F32 t, bool addFrame, bool addMatFrame) { - shape->objectStates.increment(); - TSShape::ObjectState& state = shape->objectStates.last(); + mShape->objectStates.increment(); + TSShape::ObjectState& state = mShape->objectStates.last(); state.frameIndex = 0; state.matFrameIndex = 0; - state.vis = mClampF(appMeshes[obj.startMeshIndex]->getVisValue(t), 0.0f, 1.0f); + state.vis = mClampF(mAppMeshes[obj.startMeshIndex]->getVisValue(t), 0.0f, 1.0f); if (addFrame || addMatFrame) { generateFrame(obj, t, addFrame, addMatFrame); // set the frame number for the object state - state.frameIndex = appMeshes[obj.startMeshIndex]->numFrames - 1; - state.matFrameIndex = appMeshes[obj.startMeshIndex]->numMatFrames - 1; + state.frameIndex = mAppMeshes[obj.startMeshIndex]->numFrames - 1; + state.matFrameIndex = mAppMeshes[obj.startMeshIndex]->numMatFrames - 1; } } @@ -627,7 +627,7 @@ void TSShapeLoader::generateFrame(TSShape::Object& obj, F32 t, bool addFrame, bo { for (S32 iMesh = 0; iMesh < obj.numMeshes; iMesh++) { - AppMesh* appMesh = appMeshes[obj.startMeshIndex + iMesh]; + AppMesh* appMesh = mAppMeshes[obj.startMeshIndex + iMesh]; U32 oldNumPoints = appMesh->points.size(); U32 oldNumUvs = appMesh->uvs.size(); @@ -704,13 +704,13 @@ void TSShapeLoader::generateFrame(TSShape::Object& obj, F32 t, bool addFrame, bo void TSShapeLoader::generateMaterialList() { // Install the materials into the material list - shape->materialList = new TSMaterialList; + mShape->materialList = new TSMaterialList; for (S32 iMat = 0; iMat < AppMesh::appMaterials.size(); iMat++) { updateProgress(Load_GenerateMaterials, "Generating materials...", AppMesh::appMaterials.size(), iMat); AppMaterial* appMat = AppMesh::appMaterials[iMat]; - shape->materialList->push_back(appMat->getName(), appMat->getFlags(), U32(-1), U32(-1), U32(-1), 1.0f, appMat->getReflectance()); + mShape->materialList->push_back(appMat->getName(), appMat->getFlags(), U32(-1), U32(-1), U32(-1), 1.0f, appMat->getReflectance()); } } @@ -720,38 +720,38 @@ void TSShapeLoader::generateMaterialList() void TSShapeLoader::generateSequences() { - for (S32 iSeq = 0; iSeq < appSequences.size(); iSeq++) + for (S32 iSeq = 0; iSeq < mAppSequences.size(); iSeq++) { - updateProgress(Load_GenerateSequences, "Generating sequences...", appSequences.size(), iSeq); + updateProgress(Load_GenerateSequences, "Generating sequences...", mAppSequences.size(), iSeq); // Initialize the sequence - appSequences[iSeq]->setActive(true); + mAppSequences[iSeq]->setActive(true); - shape->sequences.increment(); - TSShape::Sequence& seq = shape->sequences.last(); + mShape->sequences.increment(); + TSShape::Sequence& seq = mShape->sequences.last(); - seq.nameIndex = shape->addName(appSequences[iSeq]->getName()); - seq.toolBegin = appSequences[iSeq]->getStart(); - seq.priority = appSequences[iSeq]->getPriority(); - seq.flags = appSequences[iSeq]->getFlags(); + seq.nameIndex = mShape->addName(mAppSequences[iSeq]->getName()); + seq.toolBegin = mAppSequences[iSeq]->getStart(); + seq.priority = mAppSequences[iSeq]->getPriority(); + seq.flags = mAppSequences[iSeq]->getFlags(); // Compute duration and number of keyframes (then adjust time between frames to match) - seq.duration = appSequences[iSeq]->getEnd() - appSequences[iSeq]->getStart(); - seq.numKeyframes = (S32)(seq.duration * appSequences[iSeq]->fps + 0.5f) + 1; + seq.duration = mAppSequences[iSeq]->getEnd() - mAppSequences[iSeq]->getStart(); + seq.numKeyframes = (S32)(seq.duration * mAppSequences[iSeq]->fps + 0.5f) + 1; seq.sourceData.start = 0; seq.sourceData.end = seq.numKeyframes-1; seq.sourceData.total = seq.numKeyframes; // Set membership arrays (ie. which nodes and objects are affected by this sequence) - setNodeMembership(seq, appSequences[iSeq]); - setObjectMembership(seq, appSequences[iSeq]); + setNodeMembership(seq, mAppSequences[iSeq]); + setObjectMembership(seq, mAppSequences[iSeq]); // Generate keyframes generateNodeAnimation(seq); - generateObjectAnimation(seq, appSequences[iSeq]); - generateGroundAnimation(seq, appSequences[iSeq]); - generateFrameTriggers(seq, appSequences[iSeq]); + generateObjectAnimation(seq, mAppSequences[iSeq]); + generateGroundAnimation(seq, mAppSequences[iSeq]); + generateFrameTriggers(seq, mAppSequences[iSeq]); // Set sequence flags seq.dirtyFlags = 0; @@ -765,11 +765,11 @@ void TSShapeLoader::generateSequences() seq.dirtyFlags |= TSShapeInstance::MatFrameDirty; // Set shape flags (only the most significant scale type) - U32 curVal = shape->mFlags & TSShape::AnyScale; - shape->mFlags &= ~(TSShape::AnyScale); - shape->mFlags |= getMax(curVal, seq.flags & TSShape::AnyScale); // take the larger value (can only convert upwards) + U32 curVal = mShape->mFlags & TSShape::AnyScale; + mShape->mFlags &= ~(TSShape::AnyScale); + mShape->mFlags |= getMax(curVal, seq.flags & TSShape::AnyScale); // take the larger value (can only convert upwards) - appSequences[iSeq]->setActive(false); + mAppSequences[iSeq]->setActive(false); } } @@ -798,16 +798,16 @@ void TSShapeLoader::setNodeMembership(TSShape::Sequence& seq, const AppSequence* void TSShapeLoader::setRotationMembership(TSShape::Sequence& seq) { - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { // Check if any of the node rotations are different to // the default rotation QuatF defaultRot; - shape->defaultRotations[iNode].getQuatF(&defaultRot); + mShape->defaultRotations[iNode].getQuatF(&defaultRot); for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { - if (nodeRotCache[iNode][iFrame] != defaultRot) + if (mNodeRotCache[iNode][iFrame] != defaultRot) { seq.rotationMatters.set(iNode); break; @@ -818,15 +818,15 @@ void TSShapeLoader::setRotationMembership(TSShape::Sequence& seq) void TSShapeLoader::setTranslationMembership(TSShape::Sequence& seq) { - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { // Check if any of the node translations are different to // the default translation - Point3F& defaultTrans = shape->defaultTranslations[iNode]; + Point3F& defaultTrans = mShape->defaultTranslations[iNode]; for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { - if (!nodeTransCache[iNode][iFrame].equal(defaultTrans)) + if (!mNodeTransCache[iNode][iFrame].equal(defaultTrans)) { seq.translationMatters.set(iNode); break; @@ -843,16 +843,16 @@ void TSShapeLoader::setScaleMembership(TSShape::Sequence& seq) U32 alignedScaleCount = 0; U32 uniformScaleCount = 0; - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { // Check if any of the node scales are not the unit scale for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { - Point3F& scale = nodeScaleCache[iNode][iFrame]; + Point3F& scale = mNodeScaleCache[iNode][iFrame]; if (!unitScale.equal(scale)) { // Determine what type of scale this is - if (!nodeScaleRotCache[iNode][iFrame].isIdentity()) + if (!mNodeScaleRotCache[iNode][iFrame].isIdentity()) arbitraryScaleCount++; else if (scale.x != scale.y || scale.y != scale.z) alignedScaleCount++; @@ -880,12 +880,12 @@ void TSShapeLoader::setObjectMembership(TSShape::Sequence& seq, const AppSequenc seq.frameMatters.clearAll(); // vert animation (morph) (size = objects.size()) seq.matFrameMatters.clearAll(); // UV animation (size = objects.size()) - for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) { - if (!appMeshes[shape->objects[iObject].startMeshIndex]) + if (!mAppMeshes[mShape->objects[iObject].startMeshIndex]) continue; - if (appMeshes[shape->objects[iObject].startMeshIndex]->animatesVis(appSeq)) + if (mAppMeshes[mShape->objects[iObject].startMeshIndex]->animatesVis(appSeq)) seq.visMatters.set(iObject); // Morph and UV animation has been deprecated //if (appMeshes[shape->objects[iObject].startMeshIndex]->animatesFrame(appSeq)) @@ -898,18 +898,18 @@ void TSShapeLoader::setObjectMembership(TSShape::Sequence& seq, const AppSequenc void TSShapeLoader::clearNodeTransformCache() { // clear out the transform caches - for (S32 i = 0; i < nodeRotCache.size(); i++) - delete [] nodeRotCache[i]; - nodeRotCache.clear(); - for (S32 i = 0; i < nodeTransCache.size(); i++) - delete [] nodeTransCache[i]; - nodeTransCache.clear(); - for (S32 i = 0; i < nodeScaleRotCache.size(); i++) - delete [] nodeScaleRotCache[i]; - nodeScaleRotCache.clear(); - for (S32 i = 0; i < nodeScaleCache.size(); i++) - delete [] nodeScaleCache[i]; - nodeScaleCache.clear(); + for (S32 i = 0; i < mNodeRotCache.size(); i++) + delete [] mNodeRotCache[i]; + mNodeRotCache.clear(); + for (S32 i = 0; i < mNodeTransCache.size(); i++) + delete [] mNodeTransCache[i]; + mNodeTransCache.clear(); + for (S32 i = 0; i < mNodeScaleRotCache.size(); i++) + delete [] mNodeScaleRotCache[i]; + mNodeScaleRotCache.clear(); + for (S32 i = 0; i < mNodeScaleCache.size(); i++) + delete [] mNodeScaleCache[i]; + mNodeScaleCache.clear(); } void TSShapeLoader::fillNodeTransformCache(TSShape::Sequence& seq, const AppSequence* appSeq) @@ -917,28 +917,28 @@ void TSShapeLoader::fillNodeTransformCache(TSShape::Sequence& seq, const AppSequ // clear out the transform caches and set it up for this sequence clearNodeTransformCache(); - nodeRotCache.setSize(appNodes.size()); - for (S32 i = 0; i < nodeRotCache.size(); i++) - nodeRotCache[i] = new QuatF[seq.numKeyframes]; - nodeTransCache.setSize(appNodes.size()); - for (S32 i = 0; i < nodeTransCache.size(); i++) - nodeTransCache[i] = new Point3F[seq.numKeyframes]; - nodeScaleRotCache.setSize(appNodes.size()); - for (S32 i = 0; i < nodeScaleRotCache.size(); i++) - nodeScaleRotCache[i] = new QuatF[seq.numKeyframes]; - nodeScaleCache.setSize(appNodes.size()); - for (S32 i = 0; i < nodeScaleCache.size(); i++) - nodeScaleCache[i] = new Point3F[seq.numKeyframes]; + mNodeRotCache.setSize(mAppNodes.size()); + for (S32 i = 0; i < mNodeRotCache.size(); i++) + mNodeRotCache[i] = new QuatF[seq.numKeyframes]; + mNodeTransCache.setSize(mAppNodes.size()); + for (S32 i = 0; i < mNodeTransCache.size(); i++) + mNodeTransCache[i] = new Point3F[seq.numKeyframes]; + mNodeScaleRotCache.setSize(mAppNodes.size()); + for (S32 i = 0; i < mNodeScaleRotCache.size(); i++) + mNodeScaleRotCache[i] = new QuatF[seq.numKeyframes]; + mNodeScaleCache.setSize(mAppNodes.size()); + for (S32 i = 0; i < mNodeScaleCache.size(); i++) + mNodeScaleCache[i] = new Point3F[seq.numKeyframes]; // get the node transforms for every frame for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numKeyframes - 1); - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { - generateNodeTransform(appNodes[iNode], time, seq.isBlend(), appSeq->getBlendRefTime(), - nodeRotCache[iNode][iFrame], nodeTransCache[iNode][iFrame], - nodeScaleRotCache[iNode][iFrame], nodeScaleCache[iNode][iFrame]); + generateNodeTransform(mAppNodes[iNode], time, seq.isBlend(), appSeq->getBlendRefTime(), + mNodeRotCache[iNode][iFrame], mNodeTransCache[iNode][iFrame], + mNodeScaleRotCache[iNode][iFrame], mNodeScaleCache[iNode][iFrame]); } } } @@ -949,57 +949,57 @@ void TSShapeLoader::addNodeRotation(QuatF& rot, bool defaultVal) rot16.set(rot); if (!defaultVal) - shape->nodeRotations.push_back(rot16); + mShape->nodeRotations.push_back(rot16); else - shape->defaultRotations.push_back(rot16); + mShape->defaultRotations.push_back(rot16); } void TSShapeLoader::addNodeTranslation(Point3F& trans, bool defaultVal) { if (!defaultVal) - shape->nodeTranslations.push_back(trans); + mShape->nodeTranslations.push_back(trans); else - shape->defaultTranslations.push_back(trans); + mShape->defaultTranslations.push_back(trans); } void TSShapeLoader::addNodeUniformScale(F32 scale) { - shape->nodeUniformScales.push_back(scale); + mShape->nodeUniformScales.push_back(scale); } void TSShapeLoader::addNodeAlignedScale(Point3F& scale) { - shape->nodeAlignedScales.push_back(scale); + mShape->nodeAlignedScales.push_back(scale); } void TSShapeLoader::addNodeArbitraryScale(QuatF& qrot, Point3F& scale) { Quat16 rot16; rot16.set(qrot); - shape->nodeArbitraryScaleRots.push_back(rot16); - shape->nodeArbitraryScaleFactors.push_back(scale); + mShape->nodeArbitraryScaleRots.push_back(rot16); + mShape->nodeArbitraryScaleFactors.push_back(scale); } void TSShapeLoader::generateNodeAnimation(TSShape::Sequence& seq) { - seq.baseRotation = shape->nodeRotations.size(); - seq.baseTranslation = shape->nodeTranslations.size(); - seq.baseScale = (seq.flags & TSShape::ArbitraryScale) ? shape->nodeArbitraryScaleRots.size() : - (seq.flags & TSShape::AlignedScale) ? shape->nodeAlignedScales.size() : - shape->nodeUniformScales.size(); + seq.baseRotation = mShape->nodeRotations.size(); + seq.baseTranslation = mShape->nodeTranslations.size(); + seq.baseScale = (seq.flags & TSShape::ArbitraryScale) ? mShape->nodeArbitraryScaleRots.size() : + (seq.flags & TSShape::AlignedScale) ? mShape->nodeAlignedScales.size() : + mShape->nodeUniformScales.size(); - for (S32 iNode = 0; iNode < appNodes.size(); iNode++) + for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) { for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { if (seq.rotationMatters.test(iNode)) - addNodeRotation(nodeRotCache[iNode][iFrame], false); + addNodeRotation(mNodeRotCache[iNode][iFrame], false); if (seq.translationMatters.test(iNode)) - addNodeTranslation(nodeTransCache[iNode][iFrame], false); + addNodeTranslation(mNodeTransCache[iNode][iFrame], false); if (seq.scaleMatters.test(iNode)) { - QuatF& rot = nodeScaleRotCache[iNode][iFrame]; - Point3F scale = nodeScaleCache[iNode][iFrame]; + QuatF& rot = mNodeScaleRotCache[iNode][iFrame]; + Point3F scale = mNodeScaleCache[iNode][iFrame]; if (seq.flags & TSShape::ArbitraryScale) addNodeArbitraryScale(rot, scale); @@ -1014,9 +1014,9 @@ void TSShapeLoader::generateNodeAnimation(TSShape::Sequence& seq) void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSequence* appSeq) { - seq.baseObjectState = shape->objectStates.size(); + seq.baseObjectState = mShape->objectStates.size(); - for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) { bool visMatters = seq.visMatters.test(iObject); bool frameMatters = seq.frameMatters.test(iObject); @@ -1027,7 +1027,7 @@ void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSeq for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numKeyframes - 1); - generateObjectState(shape->objects[iObject], time, frameMatters, matFrameMatters); + generateObjectState(mShape->objects[iObject], time, frameMatters, matFrameMatters); } } } @@ -1035,10 +1035,10 @@ void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSeq void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSequence* appSeq) { - seq.firstGroundFrame = shape->groundTranslations.size(); + seq.firstGroundFrame = mShape->groundTranslations.size(); seq.numGroundFrames = 0; - if (!boundsNode) + if (!mBoundsNode) return; // Check if the bounds node is animated by this sequence @@ -1047,7 +1047,7 @@ void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSeq seq.flags |= TSShape::MakePath; // Get ground transform at the start of the sequence - MatrixF invStartMat = boundsNode->getNodeTransform(appSeq->getStart()); + MatrixF invStartMat = mBoundsNode->getNodeTransform(appSeq->getStart()); zapScale(invStartMat); invStartMat.inverse(); @@ -1056,22 +1056,22 @@ void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSeq F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numGroundFrames - 1); // Determine delta bounds node transform at 't' - MatrixF mat = boundsNode->getNodeTransform(time); + MatrixF mat = mBoundsNode->getNodeTransform(time); zapScale(mat); mat = invStartMat * mat; // Add ground transform Quat16 rotation; rotation.set(QuatF(mat)); - shape->groundTranslations.push_back(mat.getPosition()); - shape->groundRotations.push_back(rotation); + mShape->groundTranslations.push_back(mat.getPosition()); + mShape->groundRotations.push_back(rotation); } } void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSequence* appSeq) { // Initialize triggers - seq.firstTrigger = shape->triggers.size(); + seq.firstTrigger = mShape->triggers.size(); seq.numTriggers = appSeq->getNumTriggers(); if (!seq.numTriggers) return; @@ -1081,8 +1081,8 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque // Add triggers for (S32 iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++) { - shape->triggers.increment(); - appSeq->getTrigger(iTrigger, shape->triggers.last()); + mShape->triggers.increment(); + appSeq->getTrigger(iTrigger, mShape->triggers.last()); } // Track the triggers that get turned off by this shape...normally, triggers @@ -1092,7 +1092,7 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque U32 offTriggers = 0; for (S32 iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++) { - U32 state = shape->triggers[seq.firstTrigger+iTrigger].state; + U32 state = mShape->triggers[seq.firstTrigger+iTrigger].state; if ((state & TSShape::Trigger::StateOn) == 0) offTriggers |= (state & TSShape::Trigger::StateMask); } @@ -1100,8 +1100,8 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque // We now know which states are turned off, set invert on all those (including when turned on) for (int iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++) { - if (shape->triggers[seq.firstTrigger + iTrigger].state & offTriggers) - shape->triggers[seq.firstTrigger + iTrigger].state |= TSShape::Trigger::InvertOnReverse; + if (mShape->triggers[seq.firstTrigger + iTrigger].state & offTriggers) + mShape->triggers[seq.firstTrigger + iTrigger].state |= TSShape::Trigger::InvertOnReverse; } } @@ -1113,36 +1113,36 @@ void TSShapeLoader::sortDetails() // Insert NULL meshes where required - for (S32 iSub = 0; iSub < subshapes.size(); iSub++) + for (S32 iSub = 0; iSub < mSubshapes.size(); iSub++) { Vector validDetails; - shape->getSubShapeDetails(iSub, validDetails); + mShape->getSubShapeDetails(iSub, validDetails); for (S32 iDet = 0; iDet < validDetails.size(); iDet++) { - TSShape::Detail &detail = shape->details[validDetails[iDet]]; + TSShape::Detail &detail = mShape->details[validDetails[iDet]]; if (detail.subShapeNum >= 0) detail.objectDetailNum = iDet; - for (S32 iObj = shape->subShapeFirstObject[iSub]; - iObj < (shape->subShapeFirstObject[iSub] + shape->subShapeNumObjects[iSub]); + for (S32 iObj = mShape->subShapeFirstObject[iSub]; + iObj < (mShape->subShapeFirstObject[iSub] + mShape->subShapeNumObjects[iSub]); iObj++) { - TSShape::Object &object = shape->objects[iObj]; + TSShape::Object &object = mShape->objects[iObj]; // Insert a NULL mesh for this detail level if required (ie. if the // object does not already have a mesh with an equal or higher detail) S32 meshIndex = (iDet < object.numMeshes) ? iDet : object.numMeshes-1; - if (appMeshes[object.startMeshIndex + meshIndex]->detailSize < shape->details[iDet].size) + if (mAppMeshes[object.startMeshIndex + meshIndex]->detailSize < mShape->details[iDet].size) { // Add a NULL mesh - appMeshes.insert(object.startMeshIndex + iDet, NULL); + mAppMeshes.insert(object.startMeshIndex + iDet, NULL); object.numMeshes++; // Fixup the start index for the other objects - for (S32 k = iObj+1; k < shape->objects.size(); k++) - shape->objects[k].startMeshIndex++; + for (S32 k = iObj+1; k < mShape->objects.size(); k++) + mShape->objects[k].startMeshIndex++; } } } @@ -1157,79 +1157,79 @@ void TSShapeLoader::install() { // Arrays that are filled in by ts shape init, but need // to be allocated beforehand. - shape->subShapeFirstTranslucentObject.setSize(shape->subShapeFirstObject.size()); + mShape->subShapeFirstTranslucentObject.setSize(mShape->subShapeFirstObject.size()); // Construct TS sub-meshes - shape->meshes.setSize(appMeshes.size()); - for (U32 m = 0; m < appMeshes.size(); m++) - shape->meshes[m] = appMeshes[m] ? appMeshes[m]->constructTSMesh() : NULL; + mShape->meshes.setSize(mAppMeshes.size()); + for (U32 m = 0; m < mAppMeshes.size(); m++) + mShape->meshes[m] = mAppMeshes[m] ? mAppMeshes[m]->constructTSMesh() : NULL; // Remove empty meshes and objects - for (S32 iObj = shape->objects.size()-1; iObj >= 0; iObj--) + for (S32 iObj = mShape->objects.size()-1; iObj >= 0; iObj--) { - TSShape::Object& obj = shape->objects[iObj]; + TSShape::Object& obj = mShape->objects[iObj]; for (S32 iMesh = obj.numMeshes-1; iMesh >= 0; iMesh--) { - TSMesh *mesh = shape->meshes[obj.startMeshIndex + iMesh]; + TSMesh *mesh = mShape->meshes[obj.startMeshIndex + iMesh]; if (mesh && !mesh->mPrimitives.size()) { S32 oldMeshCount = obj.numMeshes; destructInPlace(mesh); - shape->removeMeshFromObject(iObj, iMesh); + mShape->removeMeshFromObject(iObj, iMesh); iMesh -= (oldMeshCount - obj.numMeshes - 1); // handle when more than one mesh is removed } } if (!obj.numMeshes) - shape->removeObject(shape->getName(obj.nameIndex)); + mShape->removeObject(mShape->getName(obj.nameIndex)); } // Add a dummy object if needed so the shape loads and renders ok - if (!shape->details.size()) + if (!mShape->details.size()) { - shape->addDetail("detail", 2, 0); - shape->subShapeNumObjects.last() = 1; + mShape->addDetail("detail", 2, 0); + mShape->subShapeNumObjects.last() = 1; - shape->meshes.push_back(NULL); + mShape->meshes.push_back(NULL); - shape->objects.increment(); + mShape->objects.increment(); - TSShape::Object& lastObject = shape->objects.last(); - lastObject.nameIndex = shape->addName("dummy"); + TSShape::Object& lastObject = mShape->objects.last(); + lastObject.nameIndex = mShape->addName("dummy"); lastObject.nodeIndex = 0; lastObject.startMeshIndex = 0; lastObject.numMeshes = 1; - shape->objectStates.increment(); - shape->objectStates.last().frameIndex = 0; - shape->objectStates.last().matFrameIndex = 0; - shape->objectStates.last().vis = 1.0f; + mShape->objectStates.increment(); + mShape->objectStates.last().frameIndex = 0; + mShape->objectStates.last().matFrameIndex = 0; + mShape->objectStates.last().vis = 1.0f; } // Update smallest visible detail - shape->mSmallestVisibleDL = -1; - shape->mSmallestVisibleSize = 999999; - for (S32 i = 0; i < shape->details.size(); i++) + mShape->mSmallestVisibleDL = -1; + mShape->mSmallestVisibleSize = 999999; + for (S32 i = 0; i < mShape->details.size(); i++) { - if ((shape->details[i].size >= 0) && - (shape->details[i].size < shape->mSmallestVisibleSize)) + if ((mShape->details[i].size >= 0) && + (mShape->details[i].size < mShape->mSmallestVisibleSize)) { - shape->mSmallestVisibleDL = i; - shape->mSmallestVisibleSize = shape->details[i].size; + mShape->mSmallestVisibleDL = i; + mShape->mSmallestVisibleSize = mShape->details[i].size; } } - computeBounds(shape->mBounds); - if (!shape->mBounds.isValidBox()) - shape->mBounds = Box3F(1.0f); + computeBounds(mShape->mBounds); + if (!mShape->mBounds.isValidBox()) + mShape->mBounds = Box3F(1.0f); - shape->mBounds.getCenter(&shape->center); - shape->mRadius = (shape->mBounds.maxExtents - shape->center).len(); - shape->tubeRadius = shape->mRadius; + mShape->mBounds.getCenter(&mShape->center); + mShape->mRadius = (mShape->mBounds.maxExtents - mShape->center).len(); + mShape->tubeRadius = mShape->mRadius; - shape->init(); - shape->finalizeEditable(); + mShape->init(); + mShape->finalizeEditable(); } void TSShapeLoader::computeBounds(Box3F& bounds) @@ -1238,11 +1238,11 @@ void TSShapeLoader::computeBounds(Box3F& bounds) bounds = Box3F::Invalid; // Use bounds node geometry if present - if ( boundsNode && boundsNode->getNumMesh() ) + if (mBoundsNode && mBoundsNode->getNumMesh() ) { - for (S32 iMesh = 0; iMesh < boundsNode->getNumMesh(); iMesh++) + for (S32 iMesh = 0; iMesh < mBoundsNode->getNumMesh(); iMesh++) { - AppMesh* mesh = boundsNode->getMesh( iMesh ); + AppMesh* mesh = mBoundsNode->getMesh( iMesh ); if ( !mesh ) continue; @@ -1255,9 +1255,9 @@ void TSShapeLoader::computeBounds(Box3F& bounds) else { // Compute bounds based on all geometry in the model - for (S32 iMesh = 0; iMesh < appMeshes.size(); iMesh++) + for (S32 iMesh = 0; iMesh < mAppMeshes.size(); iMesh++) { - AppMesh* mesh = appMeshes[iMesh]; + AppMesh* mesh = mAppMeshes[iMesh]; if ( !mesh ) continue; @@ -1279,14 +1279,14 @@ TSShapeLoader::~TSShapeLoader() AppMesh::appMaterials.clear(); // Delete Subshapes - delete boundsNode; - for (S32 iSub = 0; iSub < subshapes.size(); iSub++) - delete subshapes[iSub]; + delete mBoundsNode; + for (S32 iSub = 0; iSub < mSubshapes.size(); iSub++) + delete mSubshapes[iSub]; // Delete AppSequences - for (S32 iSeq = 0; iSeq < appSequences.size(); iSeq++) - delete appSequences[iSeq]; - appSequences.clear(); + for (S32 iSeq = 0; iSeq < mAppSequences.size(); iSeq++) + delete mAppSequences[iSeq]; + mAppSequences.clear(); } // Static functions to handle supported formats for shape loader. diff --git a/Engine/source/ts/loader/tsShapeLoader.h b/Engine/source/ts/loader/tsShapeLoader.h index 32b462e46..9c9518bca 100644 --- a/Engine/source/ts/loader/tsShapeLoader.h +++ b/Engine/source/ts/loader/tsShapeLoader.h @@ -101,24 +101,24 @@ public: protected: // Variables used during loading that must be held until the shape is deleted - TSShape* shape; - Vector appMeshes; + TSShape* mShape; + Vector mAppMeshes; // Variables used during loading, but that can be discarded afterwards - static Torque::Path shapePath; + static Torque::Path mShapePath; - AppNode* boundsNode; - Vector appNodes; ///< Nodes in the loaded shape - Vector appSequences; + AppNode* mBoundsNode; + Vector mAppNodes; ///< Nodes in the loaded shape + Vector mAppSequences; - Vector subshapes; + Vector mSubshapes; - Vector nodeRotCache; - Vector nodeTransCache; - Vector nodeScaleRotCache; - Vector nodeScaleCache; + Vector mNodeRotCache; + Vector mNodeTransCache; + Vector mNodeScaleRotCache; + Vector mNodeScaleCache; - Point3F shapeOffset; ///< Offset used to translate the shape origin + Point3F mShapeOffset; ///< Offset used to translate the shape origin //-------------------------------------------------------------------------- @@ -183,10 +183,10 @@ protected: void install(); public: - TSShapeLoader() : boundsNode(0) { } + TSShapeLoader() : mBoundsNode(0) { } virtual ~TSShapeLoader(); - static const Torque::Path& getShapePath() { return shapePath; } + static const Torque::Path& getShapePath() { return mShapePath; } static void zapScale(MatrixF& mat); From db519a3dd5e001335924e9849245bc0626b561ca Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 20:03:02 -0500 Subject: [PATCH 078/144] local shadowvar cleanup --- Engine/source/collision/clippedPolyList.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/collision/clippedPolyList.cpp b/Engine/source/collision/clippedPolyList.cpp index 5fd665d87..f2a643a3d 100644 --- a/Engine/source/collision/clippedPolyList.cpp +++ b/Engine/source/collision/clippedPolyList.cpp @@ -270,10 +270,10 @@ void ClippedPolyList::end() iv.mask = 0; // Test against the remaining planes - for (U32 i = p + 1; i < mPlaneList.size(); i++) - if (mPlaneList[i].distToPlane(iv.point) > 0) + for (U32 rP = p + 1; rP < mPlaneList.size(); rP++) + if (mPlaneList[rP].distToPlane(iv.point) > 0) { - iv.mask = 1 << i; + iv.mask = 1 << rP; break; } } From e80b66464eb3377d83fc536d8313a4080a850c88 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 20:04:14 -0500 Subject: [PATCH 079/144] ast shadowvar cleanup --- Engine/source/console/ast.h | 4 ++-- Engine/source/console/astNodes.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Engine/source/console/ast.h b/Engine/source/console/ast.h index 65b20a926..f81971413 100644 --- a/Engine/source/console/ast.h +++ b/Engine/source/console/ast.h @@ -52,7 +52,7 @@ enum TypeReq /// each representing a different language construct. struct StmtNode { - StmtNode *next; ///< Next entry in parse tree. + StmtNode *mNext; ///< Next entry in parse tree. StmtNode(); virtual ~StmtNode() {} @@ -62,7 +62,7 @@ struct StmtNode /// void append(StmtNode *next); - StmtNode *getNext() const { return next; } + StmtNode *getNext() const { return mNext; } /// @} diff --git a/Engine/source/console/astNodes.cpp b/Engine/source/console/astNodes.cpp index 6ea557703..876a4383a 100644 --- a/Engine/source/console/astNodes.cpp +++ b/Engine/source/console/astNodes.cpp @@ -140,7 +140,7 @@ void StmtNode::addBreakLine(CodeStream &code) StmtNode::StmtNode() { - next = NULL; + mNext = NULL; dbgFileName = CodeBlock::smCurrentParser->getCurrentFile(); } @@ -151,9 +151,9 @@ void StmtNode::setPackage(StringTableEntry) void StmtNode::append(StmtNode *next) { StmtNode *walk = this; - while (walk->next) - walk = walk->next; - walk->next = next; + while (walk->mNext) + walk = walk->mNext; + walk->mNext = next; } From a0b15128574991ba5c71c167ba5fb9b3a69651d0 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 20:04:43 -0500 Subject: [PATCH 080/144] bitstream shadowvar cleanup --- Engine/source/core/stream/bitStream.cpp | 40 ++++++++++++------------- Engine/source/core/stream/bitStream.h | 6 ++-- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Engine/source/core/stream/bitStream.cpp b/Engine/source/core/stream/bitStream.cpp index f80389640..2a62b4964 100644 --- a/Engine/source/core/stream/bitStream.cpp +++ b/Engine/source/core/stream/bitStream.cpp @@ -78,7 +78,7 @@ ResizeBitStream::ResizeBitStream(U32 minSpace, U32 initialSize) : BitStream(NULL ResizeBitStream::~ResizeBitStream() { - dFree(dataPtr); + dFree(mDataPtr); } void ResizeBitStream::validate() @@ -86,7 +86,7 @@ void ResizeBitStream::validate() if(getPosition() + mMinSpace > bufSize) { bufSize = getPosition() + mMinSpace * 2; - dataPtr = (U8 *) dRealloc(dataPtr, bufSize); + mDataPtr = (U8 *) dRealloc(mDataPtr, bufSize); maxReadBitNum = bufSize << 3; maxWriteBitNum = bufSize << 3; @@ -148,7 +148,7 @@ HuffmanProcessor HuffmanProcessor::g_huffProcessor; void BitStream::setBuffer(void *bufPtr, S32 size, S32 maxSize) { - dataPtr = (U8 *) bufPtr; + mDataPtr = (U8 *) bufPtr; bitNum = 0; bufSize = size; maxReadBitNum = size << 3; @@ -178,7 +178,7 @@ U32 BitStream::getStreamSize() U8 *BitStream::getBytePtr() { - return dataPtr + getPosition(); + return mDataPtr + getPosition(); } @@ -194,7 +194,7 @@ U32 BitStream::getWriteByteSize() void BitStream::clear() { - dMemset(dataPtr, 0, bufSize); + dMemset(mDataPtr, 0, bufSize); } void BitStream::writeClassId(U32 classId, U32 classType, U32 classGroup) @@ -242,9 +242,9 @@ void BitStream::writeBits(S32 bitCount, const void *bitPtr) for(S32 srcBitNum = 0;srcBitNum < bitCount;srcBitNum++) { if((*(ptr + (srcBitNum >> 3)) & (1 << (srcBitNum & 0x7))) != 0) - *(dataPtr + (bitNum >> 3)) |= (1 << (bitNum & 0x7)); + *(mDataPtr + (bitNum >> 3)) |= (1 << (bitNum & 0x7)); else - *(dataPtr + (bitNum >> 3)) &= ~(1 << (bitNum & 0x7)); + *(mDataPtr + (bitNum >> 3)) &= ~(1 << (bitNum & 0x7)); bitNum++; } } @@ -252,14 +252,14 @@ void BitStream::writeBits(S32 bitCount, const void *bitPtr) void BitStream::setBit(S32 bitCount, bool set) { if(set) - *(dataPtr + (bitCount >> 3)) |= (1 << (bitCount & 0x7)); + *(mDataPtr + (bitCount >> 3)) |= (1 << (bitCount & 0x7)); else - *(dataPtr + (bitCount >> 3)) &= ~(1 << (bitCount & 0x7)); + *(mDataPtr + (bitCount >> 3)) &= ~(1 << (bitCount & 0x7)); } bool BitStream::testBit(S32 bitCount) { - return (*(dataPtr + (bitCount >> 3)) & (1 << (bitCount & 0x7))) != 0; + return (*(mDataPtr + (bitCount >> 3)) & (1 << (bitCount & 0x7))) != 0; } bool BitStream::writeFlag(bool val) @@ -271,9 +271,9 @@ bool BitStream::writeFlag(bool val) return false; } if(val) - *(dataPtr + (bitNum >> 3)) |= (1 << (bitNum & 0x7)); + *(mDataPtr + (bitNum >> 3)) |= (1 << (bitNum & 0x7)); else - *(dataPtr + (bitNum >> 3)) &= ~(1 << (bitNum & 0x7)); + *(mDataPtr + (bitNum >> 3)) &= ~(1 << (bitNum & 0x7)); bitNum++; return (val); } @@ -289,7 +289,7 @@ void BitStream::readBits(S32 bitCount, void *bitPtr) AssertWarn(false, "Out of range read"); return; } - U8 *stPtr = dataPtr + (bitNum >> 3); + U8 *stPtr = mDataPtr + (bitNum >> 3); S32 byteCount = (bitCount + 7) >> 3; U8 *ptr = (U8 *) bitPtr; @@ -298,7 +298,7 @@ void BitStream::readBits(S32 bitCount, void *bitPtr) S32 upShift = 8 - downShift; U8 curB = *stPtr; - const U8 *stEnd = dataPtr + bufSize; + const U8 *stEnd = mDataPtr + bufSize; while(byteCount--) { stPtr++; @@ -628,7 +628,7 @@ void InfiniteBitStream::validate(U32 upcomingBytes) if(getPosition() + upcomingBytes + mMinSpace > bufSize) { bufSize = getPosition() + upcomingBytes + mMinSpace; - dataPtr = (U8 *) dRealloc(dataPtr, bufSize); + mDataPtr = (U8 *) dRealloc(mDataPtr, bufSize); maxReadBitNum = bufSize << 3; maxWriteBitNum = bufSize << 3; @@ -643,11 +643,11 @@ void InfiniteBitStream::compact() // Copy things... bufSize = getPosition() + mMinSpace * 2; - dMemcpy(tmp, dataPtr, oldSize); + dMemcpy(tmp, mDataPtr, oldSize); // And clean up. - dFree(dataPtr); - dataPtr = tmp; + dFree(mDataPtr); + mDataPtr = tmp; maxReadBitNum = bufSize << 3; maxWriteBitNum = bufSize << 3; @@ -655,7 +655,7 @@ void InfiniteBitStream::compact() void InfiniteBitStream::writeToStream(Stream &s) { - s.write(getPosition(), dataPtr); + s.write(getPosition(), mDataPtr); } //------------------------------------------------------------------------------ @@ -781,7 +781,7 @@ void HuffmanProcessor::generateCodes(BitStream& rBS, S32 index, S32 depth) // leaf node, copy the code in, and back out... HuffLeaf& rLeaf = m_huffLeaves[-(index + 1)]; - dMemcpy(&rLeaf.code, rBS.dataPtr, sizeof(rLeaf.code)); + dMemcpy(&rLeaf.code, rBS.mDataPtr, sizeof(rLeaf.code)); rLeaf.numBits = depth; } else { HuffNode& rNode = m_huffNodes[index]; diff --git a/Engine/source/core/stream/bitStream.h b/Engine/source/core/stream/bitStream.h index 93287b938..b0bb2f22a 100644 --- a/Engine/source/core/stream/bitStream.h +++ b/Engine/source/core/stream/bitStream.h @@ -53,7 +53,7 @@ class QuatF; class BitStream : public Stream { protected: - U8 *dataPtr; + U8 *mDataPtr; S32 bitNum; S32 bufSize; bool error; @@ -68,7 +68,7 @@ public: static void sendPacketStream(const NetAddress *addr); void setBuffer(void *bufPtr, S32 bufSize, S32 maxSize = 0); - U8* getBuffer() { return dataPtr; } + U8* getBuffer() { return mDataPtr; } U8* getBytePtr(); U32 getReadByteSize(); @@ -337,7 +337,7 @@ inline bool BitStream::readFlag() return false; } S32 mask = 1 << (bitNum & 0x7); - bool ret = (*(dataPtr + (bitNum >> 3)) & mask) != 0; + bool ret = (*(mDataPtr + (bitNum >> 3)) & mask) != 0; bitNum++; return ret; } From 189595670a9058c8def9d36c8ee4dced5490d95e Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 20:05:19 -0500 Subject: [PATCH 081/144] shadowvar cleanup --- .../source/T3D/components/animation/animationComponent.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/T3D/components/animation/animationComponent.cpp b/Engine/source/T3D/components/animation/animationComponent.cpp index 42871259d..cb7808b8b 100644 --- a/Engine/source/T3D/components/animation/animationComponent.cpp +++ b/Engine/source/T3D/components/animation/animationComponent.cpp @@ -645,12 +645,12 @@ void AnimationComponent::advanceThreads(F32 dt) if (mOwnerShapeInstance && !isClientObject()) { - for (U32 i = 1; i < 32; i++) + for (U32 stateIDx = 1; stateIDx < 32; stateIDx++) { - if (mOwnerShapeInstance->getTriggerState(i)) + if (mOwnerShapeInstance->getTriggerState(stateIDx)) { const char* animName = st.thread->getSequenceName().c_str(); - onAnimationTrigger_callback(this, animName, i); + onAnimationTrigger_callback(this, animName, stateIDx); } } } From 9b8c950701e0ce7c70e26b9a9a7eeb21ae4e14fa Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 20:05:47 -0500 Subject: [PATCH 082/144] console membervar cleanup --- Engine/source/console/codeBlock.cpp | 4 +- Engine/source/console/console.cpp | 98 +++++++++++----------- Engine/source/console/console.h | 34 ++++---- Engine/source/console/consoleFunctions.cpp | 6 +- 4 files changed, 71 insertions(+), 71 deletions(-) diff --git a/Engine/source/console/codeBlock.cpp b/Engine/source/console/codeBlock.cpp index f8f814f5b..dc8910f48 100644 --- a/Engine/source/console/codeBlock.cpp +++ b/Engine/source/console/codeBlock.cpp @@ -392,14 +392,14 @@ bool CodeBlock::read(StringTableEntry fileName, Stream &st) if (size) { globalFloats = new F64[size]; - for (U32 i = 0; i < size; i++) + for (i = 0; i < size; i++) st.read(&globalFloats[i]); } st.read(&size); if (size) { functionFloats = new F64[size]; - for (U32 i = 0; i < size; i++) + for (i = 0; i < size; i++) st.read(&functionFloats[i]); } U32 codeLength; diff --git a/Engine/source/console/console.cpp b/Engine/source/console/console.cpp index 9605357a5..983aa40ba 100644 --- a/Engine/source/console/console.cpp +++ b/Engine/source/console/console.cpp @@ -49,7 +49,7 @@ ExprEvalState gEvalState; StmtNode *gStatementList; StmtNode *gAnonFunctionList; U32 gAnonFunctionID = 0; -ConsoleConstructor *ConsoleConstructor::first = NULL; +ConsoleConstructor *ConsoleConstructor::mFirst = NULL; bool gWarnUndefinedScriptVariables; static char scratchBuffer[4096]; @@ -85,47 +85,47 @@ static const char * prependPercent ( const char * name ) //-------------------------------------- void ConsoleConstructor::init( const char *cName, const char *fName, const char *usg, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) { - mina = minArgs; - maxa = maxArgs; - funcName = fName; - usage = usg; - className = cName; - sc = 0; fc = 0; vc = 0; bc = 0; ic = 0; - callback = group = false; - next = first; - ns = false; - first = this; - toolOnly = isToolOnly; - this->header = header; + mMina = minArgs; + mMaxa = maxArgs; + mFuncName = fName; + mUsage = usg; + mClassName = cName; + mSC = 0; mFC = 0; mVC = 0; mBC = 0; mIC = 0; + mCallback = mGroup = false; + mNext = mFirst; + mNS = false; + mFirst = this; + mToolOnly = isToolOnly; + mHeader = header; } void ConsoleConstructor::setup() { - for(ConsoleConstructor *walk = first; walk; walk = walk->next) + for(ConsoleConstructor *walk = mFirst; walk; walk = walk->mNext) { #ifdef TORQUE_DEBUG walk->validate(); #endif - if( walk->sc ) - Con::addCommand( walk->className, walk->funcName, walk->sc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header ); - else if( walk->ic ) - Con::addCommand( walk->className, walk->funcName, walk->ic, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header ); - else if( walk->fc ) - Con::addCommand( walk->className, walk->funcName, walk->fc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header ); - else if( walk->vc ) - Con::addCommand( walk->className, walk->funcName, walk->vc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header ); - else if( walk->bc ) - Con::addCommand( walk->className, walk->funcName, walk->bc, walk->usage, walk->mina, walk->maxa, walk->toolOnly, walk->header ); - else if( walk->group ) - Con::markCommandGroup( walk->className, walk->funcName, walk->usage ); - else if( walk->callback ) - Con::noteScriptCallback( walk->className, walk->funcName, walk->usage, walk->header ); - else if( walk->ns ) + if( walk->mSC ) + Con::addCommand( walk->mClassName, walk->mFuncName, walk->mSC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader); + else if( walk->mIC ) + Con::addCommand( walk->mClassName, walk->mFuncName, walk->mIC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader); + else if( walk->mFC ) + Con::addCommand( walk->mClassName, walk->mFuncName, walk->mFC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader); + else if( walk->mVC ) + Con::addCommand( walk->mClassName, walk->mFuncName, walk->mVC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader); + else if( walk->mBC ) + Con::addCommand( walk->mClassName, walk->mFuncName, walk->mBC, walk->mUsage, walk->mMina, walk->mMaxa, walk->mToolOnly, walk->mHeader); + else if( walk->mGroup ) + Con::markCommandGroup( walk->mClassName, walk->mFuncName, walk->mUsage); + else if( walk->mClassName) + Con::noteScriptCallback( walk->mClassName, walk->mFuncName, walk->mUsage, walk->mHeader); + else if( walk->mNS ) { - Namespace* ns = Namespace::find( StringTable->insert( walk->className ) ); + Namespace* ns = Namespace::find( StringTable->insert( walk->mClassName) ); if( ns ) - ns->mUsage = walk->usage; + ns->mUsage = walk->mUsage; } else { @@ -137,38 +137,38 @@ void ConsoleConstructor::setup() ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, StringCallback sfunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) { init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header ); - sc = sfunc; + mSC = sfunc; } ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, IntCallback ifunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) { init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header ); - ic = ifunc; + mIC = ifunc; } ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, FloatCallback ffunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) { init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header ); - fc = ffunc; + mFC = ffunc; } ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, VoidCallback vfunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) { init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header ); - vc = vfunc; + mVC = vfunc; } ConsoleConstructor::ConsoleConstructor(const char *className, const char *funcName, BoolCallback bfunc, const char *usage, S32 minArgs, S32 maxArgs, bool isToolOnly, ConsoleFunctionHeader* header ) { init( className, funcName, usage, minArgs, maxArgs, isToolOnly, header ); - bc = bfunc; + mBC = bfunc; } ConsoleConstructor::ConsoleConstructor(const char* className, const char* groupName, const char* aUsage) { - init(className, groupName, usage, -1, -2); + init(className, groupName, mUsage, -1, -2); - group = true; + mGroup = true; // Somewhere, the entry list is getting flipped, partially. // so we have to do tricks to deal with making sure usage @@ -179,36 +179,36 @@ ConsoleConstructor::ConsoleConstructor(const char* className, const char* groupN if(aUsage) lastUsage = (char *)aUsage; - usage = lastUsage; + mUsage = lastUsage; } ConsoleConstructor::ConsoleConstructor(const char *className, const char *callbackName, const char *usage, ConsoleFunctionHeader* header ) { init( className, callbackName, usage, -2, -3, false, header ); - callback = true; - ns = true; + mCallback = true; + mNS = true; } void ConsoleConstructor::validate() { #ifdef TORQUE_DEBUG // Don't do the following check if we're not a method/func. - if(this->group) + if(mGroup) return; // In debug, walk the list and make sure this isn't a duplicate. - for(ConsoleConstructor *walk = first; walk; walk = walk->next) + for(ConsoleConstructor *walk = mFirst; walk; walk = walk->mNext) { // Skip mismatching func/method names. - if(dStricmp(walk->funcName, this->funcName)) + if(dStricmp(walk->mFuncName, mFuncName)) continue; // Don't compare functions with methods or vice versa. - if(bool(this->className) != bool(walk->className)) + if(bool(mClassName) != bool(walk->mClassName)) continue; // Skip mismatching classnames, if they're present. - if(this->className && walk->className && dStricmp(walk->className, this->className)) + if(mClassName && walk->mClassName && dStricmp(walk->mClassName, mClassName)) continue; // If we encounter ourselves, stop searching; this prevents duplicate @@ -218,13 +218,13 @@ void ConsoleConstructor::validate() break; // Match! - if(this->className) + if(mClassName) { - AssertISV(false, avar("ConsoleConstructor::setup - ConsoleMethod '%s::%s' collides with another of the same name.", this->className, this->funcName)); + AssertISV(false, avar("ConsoleConstructor::setup - ConsoleMethod '%s::%s' collides with another of the same name.", mClassName, mFuncName)); } else { - AssertISV(false, avar("ConsoleConstructor::setup - ConsoleFunction '%s' collides with another of the same name.", this->funcName)); + AssertISV(false, avar("ConsoleConstructor::setup - ConsoleFunction '%s' collides with another of the same name.", mFuncName)); } } #endif diff --git a/Engine/source/console/console.h b/Engine/source/console/console.h index 4009a5393..e1e64bea2 100644 --- a/Engine/source/console/console.h +++ b/Engine/source/console/console.h @@ -972,38 +972,38 @@ public: /// @ref console_autodoc /// @{ - StringCallback sc; ///< A function/method that returns a string. - IntCallback ic; ///< A function/method that returns an int. - FloatCallback fc; ///< A function/method that returns a float. - VoidCallback vc; ///< A function/method that returns nothing. - BoolCallback bc; ///< A function/method that returns a bool. - bool group; ///< Indicates that this is a group marker. - bool ns; ///< Indicates that this is a namespace marker. + StringCallback mSC; ///< A function/method that returns a string. + IntCallback mIC; ///< A function/method that returns an int. + FloatCallback mFC; ///< A function/method that returns a float. + VoidCallback mVC; ///< A function/method that returns nothing. + BoolCallback mBC; ///< A function/method that returns a bool. + bool mGroup; ///< Indicates that this is a group marker. + bool mNS; ///< Indicates that this is a namespace marker. /// @deprecated Unused. - bool callback; ///< Is this a callback into script? + bool mCallback; ///< Is this a callback into script? /// @} /// Minimum number of arguments expected by the function. - S32 mina; + S32 mMina; /// Maximum number of arguments accepted by the funtion. Zero for varargs. - S32 maxa; + S32 mMaxa; /// Name of the function/method. - const char* funcName; + const char* mFuncName; /// Name of the class namespace to which to add the method. - const char* className; + const char* mClassName; /// Usage string for documentation. - const char* usage; + const char* mUsage; /// Whether this is a TORQUE_TOOLS only function. - bool toolOnly; + bool mToolOnly; /// The extended function header. - ConsoleFunctionHeader* header; + ConsoleFunctionHeader* mHeader; /// @name ConsoleConstructor Innards /// @@ -1066,8 +1066,8 @@ public: /// @{ /// - ConsoleConstructor *next; - static ConsoleConstructor *first; + ConsoleConstructor *mNext; + static ConsoleConstructor *mFirst; void init(const char* cName, const char* fName, const char *usg, S32 minArgs, S32 maxArgs, bool toolOnly = false, ConsoleFunctionHeader* header = NULL); diff --git a/Engine/source/console/consoleFunctions.cpp b/Engine/source/console/consoleFunctions.cpp index df89a788a..fa5ab3a2b 100644 --- a/Engine/source/console/consoleFunctions.cpp +++ b/Engine/source/console/consoleFunctions.cpp @@ -668,13 +668,13 @@ DefineConsoleFunction( strreplace, const char*, ( const char* source, const char U32 dstp = 0; for(;;) { - const char *scan = dStrstr(source + scanp, from); - if(!scan) + const char *subScan = dStrstr(source + scanp, from); + if(!subScan) { dStrcpy(ret + dstp, source + scanp); return ret; } - U32 len = scan - (source + scanp); + U32 len = subScan - (source + scanp); dStrncpy(ret + dstp, source + scanp, len); dstp += len; dStrcpy(ret + dstp, to); From 41507d2dd54a1a5b6bf242826c5902d1444e4a62 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 16 Mar 2018 20:28:01 -0500 Subject: [PATCH 083/144] shadowvar cleanup --- Engine/source/assets/assetManager.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/assets/assetManager.cpp b/Engine/source/assets/assetManager.cpp index da610a895..c2591a84f 100644 --- a/Engine/source/assets/assetManager.cpp +++ b/Engine/source/assets/assetManager.cpp @@ -1353,10 +1353,10 @@ bool AssetManager::refreshAsset( const char* pAssetId ) } // Refresh depended-on assets. - for ( Vector::iterator isDependedOnItr = dependedOn.begin(); isDependedOnItr != dependedOn.end(); ++isDependedOnItr ) + for ( Vector::iterator refreshItr = dependedOn.begin(); refreshItr != dependedOn.end(); ++refreshItr) { // Refresh dependency asset. - refreshAsset( *isDependedOnItr ); + refreshAsset( *refreshItr); } } } From dd626417a32557507e6b958e0e4aba8c037feaa6 Mon Sep 17 00:00:00 2001 From: Areloch Date: Mon, 26 Mar 2018 23:31:10 -0500 Subject: [PATCH 084/144] Includes some renderbin declarations that are needed for AFX that got missed in the original PR. --- Templates/BaseGame/game/core/renderManager.cs | 10 ++++++++++ .../Full/game/core/scripts/client/renderManager.cs | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/Templates/BaseGame/game/core/renderManager.cs b/Templates/BaseGame/game/core/renderManager.cs index 4a80a45b1..e9644c1ea 100644 --- a/Templates/BaseGame/game/core/renderManager.cs +++ b/Templates/BaseGame/game/core/renderManager.cs @@ -88,6 +88,16 @@ function initRenderManager() // Resolve format change token last. DiffuseRenderPassManager.addManager( new RenderPassStateBin(FinalBin) { renderOrder = 1.7; stateToken = AL_FormatToken; } ); + + // AFX CODE BLOCK (interior-zodiacs)(polysoup-zodiacs) << + if(isObject(afxZodiacTerrainRenderer)) + { + DiffuseRenderPassManager.addManager( new afxZodiacTerrainRenderer() { bintype = "TerrainZodiac"; renderOrder = 1.41; processAddOrder = 1.41; } ); + DiffuseRenderPassManager.addManager( new afxZodiacPolysoupRenderer() { bintype = "PolysoupZodiac"; renderOrder = 1.42; processAddOrder = 1.42; } ); + DiffuseRenderPassManager.addManager( new afxZodiacGroundPlaneRenderer() { bintype = "GroundPlaneZodiac"; renderOrder = 1.43; processAddOrder = 1.43; } ); + DiffuseRenderPassManager.addManager( new afxZodiacMeshRoadRenderer() { bintype = "MeshRoadZodiac"; renderOrder = 1.44; processAddOrder = 1.44; } ); + DiffuseRenderPassManager.addManager( new afxRenderHighlightMgr() { renderOrder = 1.55; processAddOrder = 1.55; } ); // for selection-highlighting + } } /// This is the Default PostFX state block. Put here to prevent any missing object diff --git a/Templates/Full/game/core/scripts/client/renderManager.cs b/Templates/Full/game/core/scripts/client/renderManager.cs index f9f0988d2..b52143918 100644 --- a/Templates/Full/game/core/scripts/client/renderManager.cs +++ b/Templates/Full/game/core/scripts/client/renderManager.cs @@ -87,6 +87,16 @@ function initRenderManager() // Resolve format change token last. DiffuseRenderPassManager.addManager( new RenderPassStateBin(FinalBin) { renderOrder = 1.7; stateToken = AL_FormatToken; } ); + + // AFX CODE BLOCK (interior-zodiacs)(polysoup-zodiacs) << + if(isObject(afxZodiacTerrainRenderer)) + { + DiffuseRenderPassManager.addManager( new afxZodiacTerrainRenderer() { bintype = "TerrainZodiac"; renderOrder = 1.41; processAddOrder = 1.41; } ); + DiffuseRenderPassManager.addManager( new afxZodiacPolysoupRenderer() { bintype = "PolysoupZodiac"; renderOrder = 1.42; processAddOrder = 1.42; } ); + DiffuseRenderPassManager.addManager( new afxZodiacGroundPlaneRenderer() { bintype = "GroundPlaneZodiac"; renderOrder = 1.43; processAddOrder = 1.43; } ); + DiffuseRenderPassManager.addManager( new afxZodiacMeshRoadRenderer() { bintype = "MeshRoadZodiac"; renderOrder = 1.44; processAddOrder = 1.44; } ); + DiffuseRenderPassManager.addManager( new afxRenderHighlightMgr() { renderOrder = 1.55; processAddOrder = 1.55; } ); // for selection-highlighting + } } /// This post effect is used to copy data from the non-MSAA back-buffer to the From 96093bd3ecc02c4b30b965903340ac475467e0c3 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 27 Mar 2018 14:57:23 -0500 Subject: [PATCH 085/144] augmentation to drawArrow to allow one to explicitly define a radius. --- Engine/source/gfx/gfxDrawUtil.cpp | 8 ++++---- Engine/source/gfx/gfxDrawUtil.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Engine/source/gfx/gfxDrawUtil.cpp b/Engine/source/gfx/gfxDrawUtil.cpp index 0e7a4b3e9..ac25b3f15 100644 --- a/Engine/source/gfx/gfxDrawUtil.cpp +++ b/Engine/source/gfx/gfxDrawUtil.cpp @@ -1382,7 +1382,7 @@ void GFXDrawUtil::drawCylinder( const GFXStateBlockDesc &desc, const Point3F &ba mDevice->popWorldMatrix(); } -void GFXDrawUtil::drawArrow( const GFXStateBlockDesc &desc, const Point3F &start, const Point3F &end, const ColorI &color ) +void GFXDrawUtil::drawArrow( const GFXStateBlockDesc &desc, const Point3F &start, const Point3F &end, const ColorI &color, F32 baseRad ) { GFXTransformSaver saver; @@ -1398,8 +1398,8 @@ void GFXDrawUtil::drawArrow( const GFXStateBlockDesc &desc, const Point3F &start // Calculate the radius of the cone given that we want the cone to have // an angle of 25 degrees (just because it looks good). - F32 coneLen = ( end - coneBase ).len(); - F32 coneDiameter = mTan( mDegToRad(25.0f) ) * coneLen; + F32 coneLen = (baseRad != 0.0f) ? baseRad * 4.0 :( end - coneBase ).len(); + F32 coneDiameter = (baseRad != 0.0f) ? baseRad*4.0f : mTan( mDegToRad(25.0f) ) * coneLen; // Draw the cone on at the arrow's tip. drawCone( desc, coneBase, end, coneDiameter / 2.0f, color ); @@ -1412,7 +1412,7 @@ void GFXDrawUtil::drawArrow( const GFXStateBlockDesc &desc, const Point3F &start Point3F coneDiff = end - coneBase; // Draw the cylinder. - F32 stickRadius = len * 0.025f; + F32 stickRadius = (baseRad != 0.0f) ? baseRad : len * 0.025f; drawCylinder( desc, start, end - coneDiff, stickRadius, color ); } diff --git a/Engine/source/gfx/gfxDrawUtil.h b/Engine/source/gfx/gfxDrawUtil.h index 7decad785..47f6581cf 100644 --- a/Engine/source/gfx/gfxDrawUtil.h +++ b/Engine/source/gfx/gfxDrawUtil.h @@ -115,7 +115,7 @@ public: void drawCapsule( const GFXStateBlockDesc &desc, const Point3F ¢er, F32 radius, F32 height, const ColorI &color, const MatrixF *xfm = NULL ); void drawCone( const GFXStateBlockDesc &desc, const Point3F &basePnt, const Point3F &tipPnt, F32 baseRadius, const ColorI &color ); void drawCylinder( const GFXStateBlockDesc &desc, const Point3F &basePnt, const Point3F &tipPnt, F32 baseRadius, const ColorI &color ); - void drawArrow( const GFXStateBlockDesc &desc, const Point3F &start, const Point3F &end, const ColorI &color ); + void drawArrow( const GFXStateBlockDesc &desc, const Point3F &start, const Point3F &end, const ColorI &color, F32 baseRad = 0.0f); void drawFrustum( const Frustum& f, const ColorI &color ); /// Draw a solid or wireframe (depending on fill mode of @a desc) polyhedron with the given color. From e8ac28b46356ed96e98efe4ec9b36037e1ed1286 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 27 Mar 2018 14:58:40 -0500 Subject: [PATCH 086/144] visualization augmentations for PhysicalZone. colorizes based on force vector, scales based on lengths --- Engine/source/T3D/physicalZone.cpp | 89 +++++++++++++++++++++++++----- 1 file changed, 74 insertions(+), 15 deletions(-) diff --git a/Engine/source/T3D/physicalZone.cpp b/Engine/source/T3D/physicalZone.cpp index f8454be5b..cd7da39d0 100644 --- a/Engine/source/T3D/physicalZone.cpp +++ b/Engine/source/T3D/physicalZone.cpp @@ -212,8 +212,10 @@ void PhysicalZone::onRemove() void PhysicalZone::inspectPostApply() { - setPolyhedron(mPolyhedron); Parent::inspectPostApply(); + + setPolyhedron(mPolyhedron); + setMaskBits(PolyhedronMask | MoveMask | SettingsMask | FadeMask); } //------------------------------------------------------------------------------ @@ -248,30 +250,87 @@ void PhysicalZone::prepRenderImage( SceneRenderState *state ) } -void PhysicalZone::renderObject( ObjectRenderInst *ri, - SceneRenderState *state, - BaseMatInstance *overrideMat ) +void PhysicalZone::renderObject(ObjectRenderInst *ri, + SceneRenderState *state, + BaseMatInstance *overrideMat) { if (overrideMat) return; - + GFXStateBlockDesc desc; - desc.setZReadWrite( true, false ); - desc.setBlend( true ); - desc.setCullMode( GFXCullNone ); - + desc.setZReadWrite(true, false); + desc.setBlend(true); + desc.setCullMode(GFXCullNone); + GFXTransformSaver saver; + + GFXDrawUtil *drawer = GFX->getDrawUtil(); + + Point3F start = getBoxCenter(); + Box3F obb = mObjBox; //object bounding box + + F32 baseForce = 10000; //roughly the ammount of force needed to push a player back as it walks into a zone. (used for visual scaling) + + Point3F forceDir = getForce(&start); + F32 forceLen = forceDir.len()/ baseForce; + forceDir.normalizeSafe(); + ColorI guideCol = LinearColorF(mFabs(forceDir.x), mFabs(forceDir.y), mFabs(forceDir.z), 0.125).toColorI(); + + if (force_type == VECTOR) + { + Point3F endPos = start + (forceDir * mMax(forceLen,0.75f)); + drawer->drawArrow(desc, start, endPos, guideCol, 0.05f); + } MatrixF mat = getRenderTransform(); - mat.scale( getScale() ); + mat.scale(getScale()); + + GFX->multWorld(mat); + start = obb.getCenter(); + + if (force_type == VECTOR) + { + drawer->drawPolyhedron(desc, mPolyhedron, ColorI(0, 255, 0, 45)); + } + else if (force_type == SPHERICAL) + { + F32 rad = obb.getBoundingSphere().radius/ 2; + drawer->drawSphere(desc, rad, start, ColorI(0, 255, 0, 45)); - GFX->multWorld( mat ); + rad = (rad + forceLen / 2)/2; + desc.setFillModeWireframe(); + drawer->drawSphere(desc, rad, start, ColorI(0, 0, 255, 255)); + } + else + { + Point3F bottomPos = start; + bottomPos.z -= obb.len_z() / 2; + + Point3F topPos = start; + topPos.z += obb.len_z() / 2; + F32 rad = obb.len_x() / 2; + drawer->drawCylinder(desc, bottomPos, topPos, rad, ColorI(0, 255, 0, 45)); - GFXDrawUtil *drawer = GFX->getDrawUtil(); - drawer->drawPolyhedron( desc, mPolyhedron, ColorI( 0, 255, 0, 45 ) ); + Point3F force_vec = mAppliedForce; //raw relative-applied force here as oposed to derived + F32 hieght = (force_vec.z / baseForce); + if (force_vec.z<0) + bottomPos.z = (bottomPos.z + hieght)/2; + else + topPos.z = (topPos.z + hieght) / 2; + + if (force_vec.x > force_vec.y) + rad = (rad + (force_vec.x / baseForce)) / 2; + else + rad = (rad + (force_vec.y / baseForce)) / 2; + + + desc.setFillModeWireframe(); + drawer->drawCylinder(desc, bottomPos, topPos, rad, guideCol); + } + desc.setFillModeWireframe(); - drawer->drawPolyhedron( desc, mPolyhedron, ColorI::BLACK ); + drawer->drawPolyhedron(desc, mPolyhedron, ColorI::BLACK); } //-------------------------------------------------------------------------- @@ -325,7 +384,7 @@ U32 PhysicalZone::packUpdate(NetConnection* con, U32 mask, BitStream* stream) stream->writeFlag(mActive); - return retMask; + return retMask; } void PhysicalZone::unpackUpdate(NetConnection* con, BitStream* stream) From 8ab76967e07d7e79ac6b8815a427aff83195231e Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 27 Mar 2018 20:25:46 -0500 Subject: [PATCH 087/144] retooled spherical force ammount display to be based on mAppliedForce --- Engine/source/T3D/physicalZone.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/T3D/physicalZone.cpp b/Engine/source/T3D/physicalZone.cpp index cd7da39d0..fac190b67 100644 --- a/Engine/source/T3D/physicalZone.cpp +++ b/Engine/source/T3D/physicalZone.cpp @@ -297,7 +297,7 @@ void PhysicalZone::renderObject(ObjectRenderInst *ri, F32 rad = obb.getBoundingSphere().radius/ 2; drawer->drawSphere(desc, rad, start, ColorI(0, 255, 0, 45)); - rad = (rad + forceLen / 2)/2; + rad = (rad + (mAppliedForce.most() / baseForce))/2; desc.setFillModeWireframe(); drawer->drawSphere(desc, rad, start, ColorI(0, 0, 255, 255)); } From 9fbeb3e2d0bf64e382da745bdd5b695e3f93e8f9 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 28 Mar 2018 17:50:17 -0500 Subject: [PATCH 088/144] void ColladaUtils::ExportData::processData() var clarifications --- Engine/source/ts/collada/colladaUtils.cpp | 28 +++++++++++------------ 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Engine/source/ts/collada/colladaUtils.cpp b/Engine/source/ts/collada/colladaUtils.cpp index a3c217bf5..974d2a8ed 100644 --- a/Engine/source/ts/collada/colladaUtils.cpp +++ b/Engine/source/ts/collada/colladaUtils.cpp @@ -2948,7 +2948,7 @@ void ColladaUtils::ExportData::processData() detailLevels.clear(); detailLevels.setSize(numDetailLevels); - for (U32 m = 0; m < meshData.size(); ++m) + for (U32 meshNum = 0; meshNum < meshData.size(); ++meshNum) { for (U32 i = 0; i < numDetailLevels; ++i) { @@ -2967,7 +2967,7 @@ void ColladaUtils::ExportData::processData() { //walk backwards as needed to find our first valid detail level for this mesh. if we find none, just move on S32 testDetailLevelSize = getDetailLevelSize(mdl); - detailLevelIdx = meshData[m].hasDetailLevel(testDetailLevelSize); + detailLevelIdx = meshData[meshNum].hasDetailLevel(testDetailLevelSize); if (detailLevelIdx != -1) break; @@ -2983,7 +2983,7 @@ void ColladaUtils::ExportData::processData() { //walk backwards as needed to find our first valid detail level for this mesh. if we find none, just move on S32 testDetailLevelSize = getDetailLevelSize(mdl); - detailLevelIdx = meshData[m].hasDetailLevel(testDetailLevelSize); + detailLevelIdx = meshData[meshNum].hasDetailLevel(testDetailLevelSize); if (detailLevelIdx != -1) break; @@ -2994,13 +2994,13 @@ void ColladaUtils::ExportData::processData() //If we found the detail level index, go ahead and build out the data for it if (detailLevelIdx != -1) { - curDetail->mesh.setTransform(&meshData[m].meshTransform, meshData[m].scale); - curDetail->mesh.setObject(meshData[m].originatingObject); + curDetail->mesh.setTransform(&meshData[meshNum].meshTransform, meshData[meshNum].scale); + curDetail->mesh.setObject(meshData[meshNum].originatingObject); - if (meshData[m].shapeInst != nullptr) + if (meshData[meshNum].shapeInst != nullptr) { - if (!meshData[m].shapeInst->buildPolyList(&curDetail->mesh, detailLevelIdx)) + if (!meshData[meshNum].shapeInst->buildPolyList(&curDetail->mesh, detailLevelIdx)) { Con::errorf("TSStatic::buildExportPolyList - failed to build polylist for LOD %i", i); continue; @@ -3009,10 +3009,10 @@ void ColladaUtils::ExportData::processData() else { //special handling classes - ConvexShape* convexShp = dynamic_cast(meshData[m].originatingObject); + ConvexShape* convexShp = dynamic_cast(meshData[meshNum].originatingObject); if (convexShp != nullptr) { - if (!convexShp->buildPolyList(PLC_Export, &curDetail->mesh, meshData[m].originatingObject->getWorldBox(), meshData[m].originatingObject->getWorldSphere())) + if (!convexShp->buildPolyList(PLC_Export, &curDetail->mesh, meshData[meshNum].originatingObject->getWorldBox(), meshData[meshNum].originatingObject->getWorldSphere())) { Con::errorf("TSStatic::buildExportPolyList - failed to build ConvexShape polylist for LOD %i", i); continue; @@ -3021,19 +3021,19 @@ void ColladaUtils::ExportData::processData() } //lastly, get material - for (U32 m = 0; m < curDetail->mesh.mMaterialList.size(); m++) + for (U32 matNum = 0; matNum < curDetail->mesh.mMaterialList.size(); matNum++) { - S32 matIdx = hasMaterialInstance(curDetail->mesh.mMaterialList[m]); + S32 matIdx = hasMaterialInstance(curDetail->mesh.mMaterialList[matNum]); if (matIdx == -1) { //cool, haven't already got this material, so lets store it out - materials.push_back(curDetail->mesh.mMaterialList[m]); - curDetail->materialRefList.insert(m, materials.size() - 1); + materials.push_back(curDetail->mesh.mMaterialList[matNum]); + curDetail->materialRefList.insert(matNum, materials.size() - 1); } else { - curDetail->materialRefList.insert(m, matIdx); + curDetail->materialRefList.insert(matNum, matIdx); } } } From 1aa6ace486bf943a799894979f414f1e2e6d5185 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 28 Mar 2018 17:54:49 -0500 Subject: [PATCH 089/144] afx wave scalar and color membervar cleanups --- Engine/source/afx/xm/afxXM_WaveColor.cpp | 52 ++++++++-------- Engine/source/afx/xm/afxXM_WaveScalar.cpp | 76 +++++++++++------------ 2 files changed, 64 insertions(+), 64 deletions(-) diff --git a/Engine/source/afx/xm/afxXM_WaveColor.cpp b/Engine/source/afx/xm/afxXM_WaveColor.cpp index 851ccfc4d..af823d58f 100644 --- a/Engine/source/afx/xm/afxXM_WaveColor.cpp +++ b/Engine/source/afx/xm/afxXM_WaveColor.cpp @@ -35,10 +35,10 @@ class afxXM_WaveInterp_Color : public afxXM_WaveInterp { protected: - LinearColorF a_set, b_set; - LinearColorF a_var, b_var; - LinearColorF a, b; - bool sync_var; + LinearColorF mA_set, mB_set; + LinearColorF mA_var, mB_var; + LinearColorF mA, mB; + bool mSync_var; public: afxXM_WaveInterp_Color(); @@ -51,36 +51,36 @@ public: afxXM_WaveInterp_Color::afxXM_WaveInterp_Color() { - a_set.set(0.0f, 0.0f, 0.0f, 0.0f); - b_set.set(1.0f, 1.0f, 1.0f, 1.0f); - a_var.set(0.0f, 0.0f, 0.0f, 0.0f); - b_var.set(0.0f, 0.0f, 0.0f, 0.0f); - sync_var = false; - a.set(0.0f, 0.0f, 0.0f, 0.0f); - b.set(1.0f, 1.0f, 1.0f, 1.0f); + mA_set.set(0.0f, 0.0f, 0.0f, 0.0f); + mB_set.set(1.0f, 1.0f, 1.0f, 1.0f); + mA_var.set(0.0f, 0.0f, 0.0f, 0.0f); + mB_var.set(0.0f, 0.0f, 0.0f, 0.0f); + mSync_var = false; + mA.set(0.0f, 0.0f, 0.0f, 0.0f); + mB.set(1.0f, 1.0f, 1.0f, 1.0f); } void afxXM_WaveInterp_Color::set(LinearColorF& a, LinearColorF& b, LinearColorF& a_var, LinearColorF& b_var, bool sync_var) { - a_set = a; - b_set = b; - this->a_var = a_var; - this->b_var = b_var; - this->sync_var = sync_var; - this->a = a; - this->b = b; + mA_set = a; + mB_set = b; + mA_var = a_var; + mB_var = b_var; + mSync_var = sync_var; + mA = a; + mB = b; } inline void afxXM_WaveInterp_Color::pulse() { LinearColorF temp_color; F32 rand_t = gRandGen.randF()*2.0f; - temp_color.interpolate(-a_var, a_var, rand_t); - a = a_set + temp_color; - if (!sync_var) + temp_color.interpolate(-mA_var, mA_var, rand_t); + mA = mA_set + temp_color; + if (!mSync_var) rand_t = gRandGen.randF()*2.0f; - temp_color.interpolate(-b_var, b_var, rand_t); - b = b_set + temp_color; + temp_color.interpolate(-mB_var, mB_var, rand_t); + mB = mB_set + temp_color; } //~~~~~~~~~~~~~~~~~~~~// @@ -91,7 +91,7 @@ public: virtual void interpolate(F32 t, afxXM_Params& params) { LinearColorF temp_color; - temp_color.interpolate(a, b, t); + temp_color.interpolate(mA, mB, t); params.color += temp_color; } }; @@ -104,7 +104,7 @@ public: virtual void interpolate(F32 t, afxXM_Params& params) { LinearColorF temp_color; - temp_color.interpolate(a, b, t); + temp_color.interpolate(mA, mB, t); params.color *= temp_color; } }; @@ -116,7 +116,7 @@ class afxXM_WaveInterp_Color_Rep : public afxXM_WaveInterp_Color public: virtual void interpolate(F32 t, afxXM_Params& params) { - params.color.interpolate(a, b, t); + params.color.interpolate(mA, mB, t); } }; diff --git a/Engine/source/afx/xm/afxXM_WaveScalar.cpp b/Engine/source/afx/xm/afxXM_WaveScalar.cpp index d05b1d579..7b7947abb 100644 --- a/Engine/source/afx/xm/afxXM_WaveScalar.cpp +++ b/Engine/source/afx/xm/afxXM_WaveScalar.cpp @@ -35,10 +35,10 @@ class afxXM_WaveInterp_Scalar : public afxXM_WaveInterp { protected: - F32 a_set, b_set; - F32 a_var, b_var; - F32 a, b; - bool sync_var; + F32 mA_set, mB_set; + F32 mA_var, mB_var; + F32 mA, mB; + bool mSync_var; public: afxXM_WaveInterp_Scalar(); @@ -51,33 +51,33 @@ public: afxXM_WaveInterp_Scalar::afxXM_WaveInterp_Scalar() { - a_set = 0.0f; - b_set = 1.0f; - a_var = 0.0f; - b_var = 0.0; - sync_var = false; - a = 0.0f; - b = 1.0f; + mA_set = 0.0f; + mB_set = 1.0f; + mA_var = 0.0f; + mB_var = 0.0; + mSync_var = false; + mA = 0.0f; + mB = 1.0f; } void afxXM_WaveInterp_Scalar::set(F32 a, F32 b, F32 a_var, F32 b_var, bool sync_var) { - a_set = a; - b_set = b; - this->a_var = a_var; - this->b_var = b_var; - this->sync_var = sync_var; - this->a = a; - this->b = b; + mA_set = a; + mB_set = b; + mA_var = a_var; + mB_var = b_var; + mSync_var = sync_var; + mA = a; + mA = b; } inline void afxXM_WaveInterp_Scalar::pulse() { F32 rand_t = gRandGen.randF()*2.0f; - a = a_set + rand_t*a_var - a_var; - if (!sync_var) + mA = mA_set + rand_t*mA_var - mA_var; + if (!mSync_var) rand_t = gRandGen.randF()*2.0f; - b = b_set + rand_t*b_var - b_var; + mB = mB_set + rand_t*mB_var - mB_var; } //~~~~~~~~~~~~~~~~~~~~// @@ -90,7 +90,7 @@ public: afxXM_WaveInterp_Scalar_Add(U32 o) : afxXM_WaveInterp_Scalar() { offset = o; } virtual void interpolate(F32 t, afxXM_Params& params) { - *((F32*)(((char*)(¶ms)) + offset)) += lerp(t, a, b); + *((F32*)(((char*)(¶ms)) + offset)) += lerp(t, mA, mB); } }; @@ -104,7 +104,7 @@ public: afxXM_WaveInterp_Scalar_Mul(U32 o) : afxXM_WaveInterp_Scalar() { offset = o; } virtual void interpolate(F32 t, afxXM_Params& params) { - *((F32*)(((char*)(¶ms)) + offset)) *= lerp(t, a, b); + *((F32*)(((char*)(¶ms)) + offset)) *= lerp(t, mA, mB); } }; @@ -118,7 +118,7 @@ public: afxXM_WaveInterp_Scalar_Rep(U32 o) : afxXM_WaveInterp_Scalar() { offset = o; } virtual void interpolate(F32 t, afxXM_Params& params) { - *((F32*)(((char*)(¶ms)) + offset)) = lerp(t, a, b); + *((F32*)(((char*)(¶ms)) + offset)) = lerp(t, mA, mB); } }; @@ -132,7 +132,7 @@ public: afxXM_WaveInterp_Scalar_PointAdd(U32 o) : afxXM_WaveInterp_Scalar() { offset = o; } virtual void interpolate(F32 t, afxXM_Params& params) { - F32 scalar_at_t = lerp(t, a, b); + F32 scalar_at_t = lerp(t, mA, mB); Point3F point_at_t(scalar_at_t, scalar_at_t, scalar_at_t); *((Point3F*)(((char*)(¶ms)) + offset)) += point_at_t; } @@ -148,7 +148,7 @@ public: afxXM_WaveInterp_Scalar_PointMul(U32 o) : afxXM_WaveInterp_Scalar() { offset = o; } virtual void interpolate(F32 t, afxXM_Params& params) { - *((Point3F*)(((char*)(¶ms)) + offset)) *= lerp(t, a, b); + *((Point3F*)(((char*)(¶ms)) + offset)) *= lerp(t, mA, mB); } }; @@ -162,7 +162,7 @@ public: afxXM_WaveInterp_Scalar_PointRep(U32 o) : afxXM_WaveInterp_Scalar() { offset = o; } virtual void interpolate(F32 t, afxXM_Params& params) { - F32 scalar_at_t = lerp(t, a, b); + F32 scalar_at_t = lerp(t,mA, mB); Point3F point_at_t(scalar_at_t, scalar_at_t, scalar_at_t); *((Point3F*)(((char*)(¶ms)) + offset)) = point_at_t; } @@ -179,7 +179,7 @@ public: afxXM_WaveInterp_Scalar_Axis_PointAdd(U32 o, Point3F ax) : afxXM_WaveInterp_Scalar() { offset = o; axis = ax; } virtual void interpolate(F32 t, afxXM_Params& params) { - Point3F point_at_t = axis*lerp(t, a, b); + Point3F point_at_t = axis*lerp(t, mA, mB); *((Point3F*)(((char*)(¶ms)) + offset)) += point_at_t; } }; @@ -195,7 +195,7 @@ public: { Point3F local_axis(axis); params.ori.mulV(local_axis); - Point3F point_at_t = local_axis*lerp(t, a, b); + Point3F point_at_t = local_axis*lerp(t, mA, mB); *((Point3F*)(((char*)(¶ms)) + offset)) += point_at_t; } }; @@ -211,7 +211,7 @@ public: afxXM_WaveInterp_Scalar_Axis_PointMul(U32 o, Point3F ax) : afxXM_WaveInterp_Scalar() { offset = o; axis = ax; } virtual void interpolate(F32 t, afxXM_Params& params) { - Point3F point_at_t = axis*lerp(t, a, b); + Point3F point_at_t = axis*lerp(t, mA, mB); *((Point3F*)(((char*)(¶ms)) + offset)) *= point_at_t; } }; @@ -227,7 +227,7 @@ public: { Point3F local_axis(axis); params.ori.mulV(local_axis); - Point3F point_at_t = local_axis*lerp(t, a, b); + Point3F point_at_t = local_axis*lerp(t, mA, mB); *((Point3F*)(((char*)(¶ms)) + offset)) *= point_at_t; } }; @@ -243,7 +243,7 @@ public: afxXM_WaveInterp_Scalar_Axis_PointRep(U32 o, Point3F ax) : afxXM_WaveInterp_Scalar() { offset = o; axis = ax; } virtual void interpolate(F32 t, afxXM_Params& params) { - Point3F point_at_t = axis*lerp(t, a, b); + Point3F point_at_t = axis*lerp(t, mA, mB); *((Point3F*)(((char*)(¶ms)) + offset)) = point_at_t; } }; @@ -259,7 +259,7 @@ public: { Point3F local_axis(axis); params.ori.mulV(local_axis); - Point3F point_at_t = local_axis*lerp(t, a, b); + Point3F point_at_t = local_axis*lerp(t, mA, mB); *((Point3F*)(((char*)(¶ms)) + offset)) = point_at_t; } }; @@ -272,7 +272,7 @@ public: afxXM_WaveInterp_Scalar_ColorAdd() : afxXM_WaveInterp_Scalar() { } virtual void interpolate(F32 t, afxXM_Params& params) { - F32 scalar_at_t = lerp(t, a, b); + F32 scalar_at_t = lerp(t, mA, mB); LinearColorF color_at_t(scalar_at_t, scalar_at_t, scalar_at_t, scalar_at_t); params.color += color_at_t; } @@ -286,7 +286,7 @@ public: afxXM_WaveInterp_Scalar_ColorMul() : afxXM_WaveInterp_Scalar() { } virtual void interpolate(F32 t, afxXM_Params& params) { - params.color *= lerp(t, a, b); + params.color *= lerp(t, mA, mB); } }; @@ -298,7 +298,7 @@ public: afxXM_WaveInterp_Scalar_ColorRep() : afxXM_WaveInterp_Scalar() { } virtual void interpolate(F32 t, afxXM_Params& params) { - F32 scalar_at_t = lerp(t, a, b); + F32 scalar_at_t = lerp(t, mA, mB); params.color.set(scalar_at_t, scalar_at_t, scalar_at_t, scalar_at_t); } }; @@ -313,7 +313,7 @@ public: afxXM_WaveInterp_Scalar_OriMul(Point3F& ax) : afxXM_WaveInterp_Scalar() { axis = ax; } virtual void interpolate(F32 t, afxXM_Params& params) { - F32 theta = mDegToRad(lerp(t, a, b)); + F32 theta = mDegToRad(lerp(t, mA, mB)); AngAxisF rot_aa(axis, theta); MatrixF rot_xfm; rot_aa.setMatrix(&rot_xfm); params.ori.mul(rot_xfm); @@ -330,7 +330,7 @@ public: afxXM_WaveInterp_Scalar_OriRep(Point3F& ax) : afxXM_WaveInterp_Scalar() { axis = ax; } virtual void interpolate(F32 t, afxXM_Params& params) { - F32 theta = mDegToRad(lerp(t, a, b)); + F32 theta = mDegToRad(lerp(t, mA, mB)); AngAxisF rot_aa(axis, theta); rot_aa.setMatrix(¶ms.ori); } From adb60f81df46ba332b758e0c590c2ef5904b0da1 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 28 Mar 2018 18:39:59 -0500 Subject: [PATCH 090/144] afx constraint membervar cleanups --- Engine/source/afx/afxConstraint.cpp | 358 ++++++++++++------------- Engine/source/afx/afxConstraint.h | 32 +-- Engine/source/afx/afxEffectWrapper.cpp | 6 +- 3 files changed, 198 insertions(+), 198 deletions(-) diff --git a/Engine/source/afx/afxConstraint.cpp b/Engine/source/afx/afxConstraint.cpp index 78a506c02..ab4aa59f0 100644 --- a/Engine/source/afx/afxConstraint.cpp +++ b/Engine/source/afx/afxConstraint.cpp @@ -56,25 +56,25 @@ afxConstraintDef::afxConstraintDef() bool afxConstraintDef::isDefined() { - return (def_type != CONS_UNDEFINED); + return (mDef_type != CONS_UNDEFINED); } bool afxConstraintDef::isArbitraryObject() { - return ((cons_src_name != ST_NULLSTRING) && (def_type == CONS_SCENE)); + return ((mCons_src_name != ST_NULLSTRING) && (mDef_type == CONS_SCENE)); } void afxConstraintDef::reset() { - cons_src_name = ST_NULLSTRING; - cons_node_name = ST_NULLSTRING; - def_type = CONS_UNDEFINED; - history_time = 0; - sample_rate = 30; - runs_on_server = false; - runs_on_client = false; - pos_at_box_center = false; - treat_as_camera = false; + mCons_src_name = ST_NULLSTRING; + mCons_node_name = ST_NULLSTRING; + mDef_type = CONS_UNDEFINED; + mHistory_time = 0; + mSample_rate = 30; + mRuns_on_server = false; + mRuns_on_client = false; + mPos_at_box_center = false; + mTreat_as_camera = false; } bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, @@ -85,11 +85,11 @@ bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, if (spec == 0 || spec[0] == '\0') return false; - history_time = 0.0f; - sample_rate = 30; + mHistory_time = 0.0f; + mSample_rate = 30; - this->runs_on_server = runs_on_server; - this->runs_on_client = runs_on_client; + mRuns_on_server = runs_on_server; + mRuns_on_client = runs_on_client; // spec should be in one of these forms: // CONSTRAINT_NAME (only) @@ -157,7 +157,7 @@ bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, for (S32 i = 0; i < n_words; i++) { if (dStrcmp(words[i], "#center") == 0) - pos_at_box_center = true; + mPos_at_box_center = true; else if (dStrncmp(words[i], "#history(", 9) == 0) hist_spec = words[i]; else @@ -193,9 +193,9 @@ bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, S32 args = dSscanf(hist_spec,"%g %d", &hist_age, &hist_rate); if (args > 0) - history_time = hist_age; + mHistory_time = hist_age; if (args > 1) - sample_rate = hist_rate; + mSample_rate = hist_rate; } } } @@ -212,8 +212,8 @@ bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, return false; } - cons_src_name = cons_name_key; - def_type = CONS_PREDEFINED; + mCons_src_name = cons_name_key; + mDef_type = CONS_PREDEFINED; dFree(buffer); return true; } @@ -221,10 +221,10 @@ bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, // "#scene.NAME" or "#scene.NAME.NODE"" if (cons_name_key == SCENE_CONS_KEY) { - cons_src_name = StringTable->insert(words2[1]); + mCons_src_name = StringTable->insert(words2[1]); if (n_words2 > 2) - cons_node_name = StringTable->insert(words2[2]); - def_type = CONS_SCENE; + mCons_node_name = StringTable->insert(words2[2]); + mDef_type = CONS_SCENE; dFree(buffer); return true; } @@ -232,10 +232,10 @@ bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, // "#effect.NAME" or "#effect.NAME.NODE" if (cons_name_key == EFFECT_CONS_KEY) { - cons_src_name = StringTable->insert(words2[1]); + mCons_src_name = StringTable->insert(words2[1]); if (n_words2 > 2) - cons_node_name = StringTable->insert(words2[2]); - def_type = CONS_EFFECT; + mCons_node_name = StringTable->insert(words2[2]); + mDef_type = CONS_EFFECT; dFree(buffer); return true; } @@ -249,10 +249,10 @@ bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, return false; } - cons_src_name = StringTable->insert(words2[1]); + mCons_src_name = StringTable->insert(words2[1]); if (n_words2 > 2) - cons_node_name = StringTable->insert(words2[2]); - def_type = CONS_GHOST; + mCons_node_name = StringTable->insert(words2[2]); + mDef_type = CONS_GHOST; dFree(buffer); return true; } @@ -260,9 +260,9 @@ bool afxConstraintDef::parseSpec(const char* spec, bool runs_on_server, // "CONSTRAINT_NAME.NODE" if (n_words2 == 2) { - cons_src_name = cons_name_key; - cons_node_name = StringTable->insert(words2[1]); - def_type = CONS_PREDEFINED; + mCons_src_name = cons_name_key; + mCons_node_name = StringTable->insert(words2[1]); + mDef_type = CONS_PREDEFINED; dFree(buffer); return true; } @@ -372,8 +372,8 @@ S32 afxConstraintMgr::find_cons_idx_from_name(StringTableEntry which) for (S32 i = 0; i < constraints_v.size(); i++) { afxConstraint* cons = CONS_BY_IJ(i,0); - if (cons && afxConstraintDef::CONS_EFFECT != cons->cons_def.def_type && - which == cons->cons_def.cons_src_name) + if (cons && afxConstraintDef::CONS_EFFECT != cons->cons_def.mDef_type && + which == cons->cons_def.mCons_src_name) { return i; } @@ -387,8 +387,8 @@ S32 afxConstraintMgr::find_effect_cons_idx_from_name(StringTableEntry which) for (S32 i = 0; i < constraints_v.size(); i++) { afxConstraint* cons = CONS_BY_IJ(i,0); - if (cons && afxConstraintDef::CONS_EFFECT == cons->cons_def.def_type && - which == cons->cons_def.cons_src_name) + if (cons && afxConstraintDef::CONS_EFFECT == cons->cons_def.mDef_type && + which == cons->cons_def.mCons_src_name) { return i; } @@ -472,8 +472,8 @@ afxConstraintID afxConstraintMgr::createReferenceEffect(StringTableEntry which, { afxEffectConstraint* cons = new afxEffectConstraint(this, which); //cons->cons_def = def; - cons->cons_def.def_type = afxConstraintDef::CONS_EFFECT; - cons->cons_def.cons_src_name = which; + cons->cons_def.mDef_type = afxConstraintDef::CONS_EFFECT; + cons->cons_def.mCons_src_name = which; afxConstraintList* list = new afxConstraintList(); list->push_back(cons); constraints_v.push_back(list); @@ -489,7 +489,7 @@ void afxConstraintMgr::setReferencePoint(afxConstraintID id, Point3F point, Poin if (!pt_cons) { afxConstraint* cons = CONS_BY_ID(id); - pt_cons = newPointCons(this, cons->cons_def.history_time > 0.0f); + pt_cons = newPointCons(this, cons->cons_def.mHistory_time > 0.0f); pt_cons->cons_def = cons->cons_def; CONS_BY_ID(id) = pt_cons; delete cons; @@ -514,7 +514,7 @@ void afxConstraintMgr::setReferenceTransform(afxConstraintID id, MatrixF& xfm) if (!xfm_cons) { afxConstraint* cons = CONS_BY_ID(id); - xfm_cons = newTransformCons(this, cons->cons_def.history_time > 0.0f); + xfm_cons = newTransformCons(this, cons->cons_def.mHistory_time > 0.0f); xfm_cons->cons_def = cons->cons_def; CONS_BY_ID(id) = xfm_cons; delete cons; @@ -541,7 +541,7 @@ void afxConstraintMgr::set_ref_shape(afxConstraintID id, ShapeBase* shape) if (!shape_cons) { afxConstraint* cons = CONS_BY_ID(id); - shape_cons = newShapeCons(this, cons->cons_def.history_time > 0.0f); + shape_cons = newShapeCons(this, cons->cons_def.mHistory_time > 0.0f); shape_cons->cons_def = cons->cons_def; CONS_BY_ID(id) = shape_cons; delete cons; @@ -578,7 +578,7 @@ void afxConstraintMgr::set_ref_shape(afxConstraintID id, U16 scope_id) if (!shape_cons) { afxConstraint* cons = CONS_BY_ID(id); - shape_cons = newShapeCons(this, cons->cons_def.history_time > 0.0f); + shape_cons = newShapeCons(this, cons->cons_def.mHistory_time > 0.0f); shape_cons->cons_def = cons->cons_def; CONS_BY_ID(id) = shape_cons; delete cons; @@ -602,7 +602,7 @@ void afxConstraintMgr::setReferenceObject(afxConstraintID id, SceneObject* obj) if (!initialized) Con::errorf("afxConstraintMgr::setReferenceObject() -- constraint manager not initialized"); - if (!CONS_BY_ID(id)->cons_def.treat_as_camera) + if (!CONS_BY_ID(id)->cons_def.mTreat_as_camera) { ShapeBase* shape = dynamic_cast(obj); if (shape) @@ -618,7 +618,7 @@ void afxConstraintMgr::setReferenceObject(afxConstraintID id, SceneObject* obj) if (!obj_cons) { afxConstraint* cons = CONS_BY_ID(id); - obj_cons = newObjectCons(this, cons->cons_def.history_time > 0.0f); + obj_cons = newObjectCons(this, cons->cons_def.mHistory_time > 0.0f); obj_cons->cons_def = cons->cons_def; CONS_BY_ID(id) = obj_cons; delete cons; @@ -659,7 +659,7 @@ void afxConstraintMgr::setReferenceObjectByScopeId(afxConstraintID id, U16 scope if (!obj_cons) { afxConstraint* cons = CONS_BY_ID(id); - obj_cons = newObjectCons(this, cons->cons_def.history_time > 0.0f); + obj_cons = newObjectCons(this, cons->cons_def.mHistory_time > 0.0f); obj_cons->cons_def = cons->cons_def; CONS_BY_ID(id) = obj_cons; delete cons; @@ -709,52 +709,52 @@ void afxConstraintMgr::invalidateReference(afxConstraintID id) void afxConstraintMgr::create_constraint(const afxConstraintDef& def) { - if (def.def_type == afxConstraintDef::CONS_UNDEFINED) + if (def.mDef_type == afxConstraintDef::CONS_UNDEFINED) return; //Con::printf("CON - %s [%s] [%s] h=%g", def.cons_type_name, def.cons_src_name, def.cons_node_name, def.history_time); - bool want_history = (def.history_time > 0.0f); + bool want_history = (def.mHistory_time > 0.0f); // constraint is an arbitrary named scene object // - if (def.def_type == afxConstraintDef::CONS_SCENE) + if (def.mDef_type == afxConstraintDef::CONS_SCENE) { - if (def.cons_src_name == ST_NULLSTRING) + if (def.mCons_src_name == ST_NULLSTRING) return; // find the arbitrary object by name SceneObject* arb_obj; if (on_server) { - arb_obj = dynamic_cast(Sim::findObject(def.cons_src_name)); + arb_obj = dynamic_cast(Sim::findObject(def.mCons_src_name)); if (!arb_obj) Con::errorf("afxConstraintMgr -- failed to find scene constraint source, \"%s\" on server.", - def.cons_src_name); + def.mCons_src_name); } else { - arb_obj = find_object_from_name(def.cons_src_name); + arb_obj = find_object_from_name(def.mCons_src_name); if (!arb_obj) Con::errorf("afxConstraintMgr -- failed to find scene constraint source, \"%s\" on client.", - def.cons_src_name); + def.mCons_src_name); } // if it's a shapeBase object, create a Shape or ShapeNode constraint if (dynamic_cast(arb_obj)) { - if (def.cons_node_name == ST_NULLSTRING && !def.pos_at_box_center) + if (def.mCons_node_name == ST_NULLSTRING && !def.mPos_at_box_center) { - afxShapeConstraint* cons = newShapeCons(this, def.cons_src_name, want_history); + afxShapeConstraint* cons = newShapeCons(this, def.mCons_src_name, want_history); cons->cons_def = def; cons->set((ShapeBase*)arb_obj); afxConstraintList* list = new afxConstraintList(); list->push_back(cons); constraints_v.push_back(list); } - else if (def.pos_at_box_center) + else if (def.mPos_at_box_center) { - afxShapeConstraint* cons = newShapeCons(this, def.cons_src_name, want_history); + afxShapeConstraint* cons = newShapeCons(this, def.mCons_src_name, want_history); cons->cons_def = def; cons->set((ShapeBase*)arb_obj); afxConstraintList* list = constraints_v[constraints_v.size()-1]; // SHAPE-NODE CONS-LIST (#scene)(#center) @@ -763,7 +763,7 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) } else { - afxShapeNodeConstraint* sub = newShapeNodeCons(this, def.cons_src_name, def.cons_node_name, want_history); + afxShapeNodeConstraint* sub = newShapeNodeCons(this, def.mCons_src_name, def.mCons_node_name, want_history); sub->cons_def = def; sub->set((ShapeBase*)arb_obj); afxConstraintList* list = constraints_v[constraints_v.size()-1]; @@ -774,9 +774,9 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) // if it's not a shapeBase object, create an Object constraint else if (arb_obj) { - if (!def.pos_at_box_center) + if (!def.mPos_at_box_center) { - afxObjectConstraint* cons = newObjectCons(this, def.cons_src_name, want_history); + afxObjectConstraint* cons = newObjectCons(this, def.mCons_src_name, want_history); cons->cons_def = def; cons->set(arb_obj); afxConstraintList* list = new afxConstraintList(); // OBJECT CONS-LIST (#scene) @@ -785,7 +785,7 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) } else // if (def.pos_at_box_center) { - afxObjectConstraint* cons = newObjectCons(this, def.cons_src_name, want_history); + afxObjectConstraint* cons = newObjectCons(this, def.mCons_src_name, want_history); cons->cons_def = def; cons->set(arb_obj); afxConstraintList* list = constraints_v[constraints_v.size()-1]; // OBJECT CONS-LIST (#scene)(#center) @@ -797,24 +797,24 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) // constraint is an arbitrary named effect // - else if (def.def_type == afxConstraintDef::CONS_EFFECT) + else if (def.mDef_type == afxConstraintDef::CONS_EFFECT) { - if (def.cons_src_name == ST_NULLSTRING) + if (def.mCons_src_name == ST_NULLSTRING) return; // create an Effect constraint - if (def.cons_node_name == ST_NULLSTRING && !def.pos_at_box_center) + if (def.mCons_node_name == ST_NULLSTRING && !def.mPos_at_box_center) { - afxEffectConstraint* cons = new afxEffectConstraint(this, def.cons_src_name); + afxEffectConstraint* cons = new afxEffectConstraint(this, def.mCons_src_name); cons->cons_def = def; afxConstraintList* list = new afxConstraintList(); list->push_back(cons); constraints_v.push_back(list); } // create an Effect #center constraint - else if (def.pos_at_box_center) + else if (def.mPos_at_box_center) { - afxEffectConstraint* cons = new afxEffectConstraint(this, def.cons_src_name); + afxEffectConstraint* cons = new afxEffectConstraint(this, def.mCons_src_name); cons->cons_def = def; afxConstraintList* list = constraints_v[constraints_v.size()-1]; // EFFECT-NODE CONS-LIST (#effect) if (list && (*list)[0]) @@ -823,7 +823,7 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) // create an EffectNode constraint else { - afxEffectNodeConstraint* sub = new afxEffectNodeConstraint(this, def.cons_src_name, def.cons_node_name); + afxEffectNodeConstraint* sub = new afxEffectNodeConstraint(this, def.mCons_src_name, def.mCons_node_name); sub->cons_def = def; afxConstraintList* list = constraints_v[constraints_v.size()-1]; if (list && (*list)[0]) @@ -839,25 +839,25 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) afxConstraint* cons_ctr = 0; afxConstraint* sub = 0; - if (def.def_type == afxConstraintDef::CONS_GHOST) + if (def.mDef_type == afxConstraintDef::CONS_GHOST) { for (S32 i = 0; i < predefs.size(); i++) { - if (predefs[i].name == def.cons_src_name) + if (predefs[i].name == def.mCons_src_name) { - if (def.cons_node_name == ST_NULLSTRING && !def.pos_at_box_center) + if (def.mCons_node_name == ST_NULLSTRING && !def.mPos_at_box_center) { cons = newShapeCons(this, want_history); cons->cons_def = def; } - else if (def.pos_at_box_center) + else if (def.mPos_at_box_center) { cons_ctr = newShapeCons(this, want_history); cons_ctr->cons_def = def; } else { - sub = newShapeNodeCons(this, ST_NULLSTRING, def.cons_node_name, want_history); + sub = newShapeNodeCons(this, ST_NULLSTRING, def.mCons_node_name, want_history); sub->cons_def = def; } break; @@ -868,7 +868,7 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) { for (S32 i = 0; i < predefs.size(); i++) { - if (predefs[i].name == def.cons_src_name) + if (predefs[i].name == def.mCons_src_name) { switch (predefs[i].type) { @@ -881,26 +881,26 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) cons->cons_def = def; break; case OBJECT_CONSTRAINT: - if (def.cons_node_name == ST_NULLSTRING && !def.pos_at_box_center) + if (def.mCons_node_name == ST_NULLSTRING && !def.mPos_at_box_center) { cons = newShapeCons(this, want_history); cons->cons_def = def; } - else if (def.pos_at_box_center) + else if (def.mPos_at_box_center) { cons_ctr = newShapeCons(this, want_history); cons_ctr->cons_def = def; } else { - sub = newShapeNodeCons(this, ST_NULLSTRING, def.cons_node_name, want_history); + sub = newShapeNodeCons(this, ST_NULLSTRING, def.mCons_node_name, want_history); sub->cons_def = def; } break; case CAMERA_CONSTRAINT: cons = newObjectCons(this, want_history); cons->cons_def = def; - cons->cons_def.treat_as_camera = true; + cons->cons_def.mTreat_as_camera = true; break; } break; @@ -927,29 +927,29 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) list->push_back(sub); } else - Con::printf("predef not found %s", def.cons_src_name); + Con::printf("predef not found %s", def.mCons_src_name); } } afxConstraintID afxConstraintMgr::getConstraintId(const afxConstraintDef& def) { - if (def.def_type == afxConstraintDef::CONS_UNDEFINED) + if (def.mDef_type == afxConstraintDef::CONS_UNDEFINED) return afxConstraintID(); - if (def.cons_src_name != ST_NULLSTRING) + if (def.mCons_src_name != ST_NULLSTRING) { for (S32 i = 0; i < constraints_v.size(); i++) { afxConstraintList* list = constraints_v[i]; afxConstraint* cons = (*list)[0]; - if (def.cons_src_name == cons->cons_def.cons_src_name) + if (def.mCons_src_name == cons->cons_def.mCons_src_name) { for (S32 j = 0; j < list->size(); j++) { afxConstraint* sub = (*list)[j]; - if (def.cons_node_name == sub->cons_def.cons_node_name && - def.pos_at_box_center == sub->cons_def.pos_at_box_center && - def.cons_src_name == sub->cons_def.cons_src_name) + if (def.mCons_node_name == sub->cons_def.mCons_node_name && + def.mPos_at_box_center == sub->cons_def.mPos_at_box_center && + def.mCons_src_name == sub->cons_def.mCons_src_name) { return afxConstraintID(i, j); } @@ -957,14 +957,14 @@ afxConstraintID afxConstraintMgr::getConstraintId(const afxConstraintDef& def) // if we're here, it means the root object name matched but the node name // did not. - if (def.def_type == afxConstraintDef::CONS_PREDEFINED && !def.pos_at_box_center) + if (def.mDef_type == afxConstraintDef::CONS_PREDEFINED && !def.mPos_at_box_center) { afxShapeConstraint* shape_cons = dynamic_cast(cons); if (shape_cons) { //Con::errorf("Append a Node constraint [%s.%s] [%d,%d]", def.cons_src_name, def.cons_node_name, i, list->size()); - bool want_history = (def.history_time > 0.0f); - afxConstraint* sub = newShapeNodeCons(this, ST_NULLSTRING, def.cons_node_name, want_history); + bool want_history = (def.mHistory_time > 0.0f); + afxConstraint* sub = newShapeNodeCons(this, ST_NULLSTRING, def.mCons_node_name, want_history); sub->cons_def = def; ((afxShapeConstraint*)sub)->set(shape_cons->shape); list->push_back(sub); @@ -1010,19 +1010,19 @@ S32 QSORT_CALLBACK cmp_cons_defs(const void* a, const void* b) afxConstraintDef* def_a = (afxConstraintDef*) a; afxConstraintDef* def_b = (afxConstraintDef*) b; - if (def_a->def_type == def_b->def_type) + if (def_a->mDef_type == def_b->mDef_type) { - if (def_a->cons_src_name == def_b->cons_src_name) + if (def_a->mCons_src_name == def_b->mCons_src_name) { - if (def_a->pos_at_box_center == def_b->pos_at_box_center) - return (def_a->cons_node_name - def_b->cons_node_name); + if (def_a->mPos_at_box_center == def_b->mPos_at_box_center) + return (def_a->mCons_node_name - def_b->mCons_node_name); else - return (def_a->pos_at_box_center) ? 1 : -1; + return (def_a->mPos_at_box_center) ? 1 : -1; } - return (def_a->cons_src_name - def_b->cons_src_name); + return (def_a->mCons_src_name - def_b->mCons_src_name); } - return (def_a->def_type - def_b->def_type); + return (def_a->mDef_type - def_b->mDef_type); } void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bool on_server, F32 scoping_dist) @@ -1048,7 +1048,7 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo Vector ghost_defs; for (S32 i = 0; i < all_defs.size(); i++) - if (all_defs[i].def_type == afxConstraintDef::CONS_GHOST && all_defs[i].cons_src_name != ST_NULLSTRING) + if (all_defs[i].mDef_type == afxConstraintDef::CONS_GHOST && all_defs[i].mCons_src_name != ST_NULLSTRING) ghost_defs.push_back(all_defs[i]); if (ghost_defs.size() > 0) @@ -1058,13 +1058,13 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo dQsort(ghost_defs.address(), ghost_defs.size(), sizeof(afxConstraintDef), cmp_cons_defs); S32 last = 0; - defineConstraint(OBJECT_CONSTRAINT, ghost_defs[0].cons_src_name); + defineConstraint(OBJECT_CONSTRAINT, ghost_defs[0].mCons_src_name); for (S32 i = 1; i < ghost_defs.size(); i++) { - if (ghost_defs[last].cons_src_name != ghost_defs[i].cons_src_name) + if (ghost_defs[last].mCons_src_name != ghost_defs[i].mCons_src_name) { - defineConstraint(OBJECT_CONSTRAINT, ghost_defs[i].cons_src_name); + defineConstraint(OBJECT_CONSTRAINT, ghost_defs[i].mCons_src_name); last++; } } @@ -1077,13 +1077,13 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo if (on_server) { for (S32 i = 0; i < all_defs.size(); i++) - if (all_defs[i].runs_on_server) + if (all_defs[i].mRuns_on_server) defs.push_back(all_defs[i]); } else { for (S32 i = 0; i < all_defs.size(); i++) - if (all_defs[i].runs_on_client) + if (all_defs[i].mRuns_on_client) defs.push_back(all_defs[i]); } @@ -1099,17 +1099,17 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo S32 last = 0; // manufacture root-object def if absent - if (defs[0].cons_node_name != ST_NULLSTRING) + if (defs[0].mCons_node_name != ST_NULLSTRING) { afxConstraintDef root_def = defs[0]; - root_def.cons_node_name = ST_NULLSTRING; + root_def.mCons_node_name = ST_NULLSTRING; unique_defs.push_back(root_def); last++; } - else if (defs[0].pos_at_box_center) + else if (defs[0].mPos_at_box_center) { afxConstraintDef root_def = defs[0]; - root_def.pos_at_box_center = false; + root_def.mPos_at_box_center = false; unique_defs.push_back(root_def); last++; } @@ -1118,19 +1118,19 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo for (S32 i = 1; i < defs.size(); i++) { - if (unique_defs[last].cons_node_name != defs[i].cons_node_name || - unique_defs[last].cons_src_name != defs[i].cons_src_name || - unique_defs[last].pos_at_box_center != defs[i].pos_at_box_center || - unique_defs[last].def_type != defs[i].def_type) + if (unique_defs[last].mCons_node_name != defs[i].mCons_node_name || + unique_defs[last].mCons_src_name != defs[i].mCons_src_name || + unique_defs[last].mPos_at_box_center != defs[i].mPos_at_box_center || + unique_defs[last].mDef_type != defs[i].mDef_type) { // manufacture root-object def if absent - if (defs[i].cons_src_name != ST_NULLSTRING && unique_defs[last].cons_src_name != defs[i].cons_src_name) + if (defs[i].mCons_src_name != ST_NULLSTRING && unique_defs[last].mCons_src_name != defs[i].mCons_src_name) { - if (defs[i].cons_node_name != ST_NULLSTRING || defs[i].pos_at_box_center) + if (defs[i].mCons_node_name != ST_NULLSTRING || defs[i].mPos_at_box_center) { afxConstraintDef root_def = defs[i]; - root_def.cons_node_name = ST_NULLSTRING; - root_def.pos_at_box_center = false; + root_def.mCons_node_name = ST_NULLSTRING; + root_def.mPos_at_box_center = false; unique_defs.push_back(root_def); last++; } @@ -1140,10 +1140,10 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo } else { - if (defs[i].history_time > unique_defs[last].history_time) - unique_defs[last].history_time = defs[i].history_time; - if (defs[i].sample_rate > unique_defs[last].sample_rate) - unique_defs[last].sample_rate = defs[i].sample_rate; + if (defs[i].mHistory_time > unique_defs[last].mHistory_time) + unique_defs[last].mHistory_time = defs[i].mHistory_time; + if (defs[i].mSample_rate > unique_defs[last].mSample_rate) + unique_defs[last].mSample_rate = defs[i].mSample_rate; } } @@ -1161,7 +1161,7 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo defs.clear(); for (S32 i = 0; i < all_defs.size(); i++) - if (all_defs[i].runs_on_client && all_defs[i].isArbitraryObject()) + if (all_defs[i].mRuns_on_client && all_defs[i].isArbitraryObject()) defs.push_back(all_defs[i]); if (defs.size() < 1) @@ -1172,13 +1172,13 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo dQsort(defs.address(), defs.size(), sizeof(afxConstraintDef), cmp_cons_defs); S32 last = 0; - names_on_server.push_back(defs[0].cons_src_name); + names_on_server.push_back(defs[0].mCons_src_name); for (S32 i = 1; i < defs.size(); i++) { - if (names_on_server[last] != defs[i].cons_src_name) + if (names_on_server[last] != defs[i].mCons_src_name) { - names_on_server.push_back(defs[i].cons_src_name); + names_on_server.push_back(defs[i].mCons_src_name); last++; } } @@ -1418,7 +1418,7 @@ void afxPointConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) afxTransformConstraint::afxTransformConstraint(afxConstraintMgr* mgr) : afxConstraint(mgr) { - xfm.identity(); + mXfm.identity(); } afxTransformConstraint::~afxTransformConstraint() @@ -1427,7 +1427,7 @@ afxTransformConstraint::~afxTransformConstraint() void afxTransformConstraint::set(const MatrixF& xfm) { - this->xfm = xfm; + mXfm = xfm; is_defined = true; is_valid = true; change_code++; @@ -1438,7 +1438,7 @@ void afxTransformConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_p { if (cam_pos) { - Point3F dir = (*cam_pos) - xfm.getPosition(); + Point3F dir = (*cam_pos) - mXfm.getPosition(); F32 dist_sq = dir.lenSquared(); if (dist_sq > mgr->getScopingDistanceSquared()) { @@ -1448,8 +1448,8 @@ void afxTransformConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_p is_valid = true; } - last_xfm = xfm; - last_pos = xfm.getPosition(); + last_xfm = mXfm; + last_pos = mXfm.getPosition(); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -1533,7 +1533,7 @@ void afxShapeConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) if (shape) { last_xfm = shape->getRenderTransform(); - if (cons_def.pos_at_box_center) + if (cons_def.mPos_at_box_center) last_pos = shape->getBoxCenter(); else last_pos = shape->getRenderPosition(); @@ -1757,46 +1757,46 @@ void afxShapeNodeConstraint::onDeleteNotify(SimObject* obj) afxObjectConstraint::afxObjectConstraint(afxConstraintMgr* mgr) : afxConstraint(mgr) { - arb_name = ST_NULLSTRING; - obj = 0; - scope_id = 0; - is_camera = false; + mArb_name = ST_NULLSTRING; + mObj = 0; + mScope_id = 0; + mIs_camera = false; } afxObjectConstraint::afxObjectConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name) : afxConstraint(mgr) { - this->arb_name = arb_name; - obj = 0; - scope_id = 0; - is_camera = false; + mArb_name = arb_name; + mObj = 0; + mScope_id = 0; + mIs_camera = false; } afxObjectConstraint::~afxObjectConstraint() { - if (obj) - clearNotify(obj); + if (mObj) + clearNotify(mObj); } void afxObjectConstraint::set(SceneObject* obj) { - if (this->obj) + if (mObj) { - scope_id = 0; - clearNotify(this->obj); + mScope_id = 0; + clearNotify(mObj); } - this->obj = obj; + mObj = obj; - if (this->obj) + if (mObj) { - deleteNotify(this->obj); - scope_id = this->obj->getScopeId(); + deleteNotify(mObj); + mScope_id = mObj->getScopeId(); } - if (this->obj != NULL) + if (mObj != NULL) { - is_camera = this->obj->isCamera(); + mIs_camera = mObj->isCamera(); is_defined = true; is_valid = true; @@ -1809,11 +1809,11 @@ void afxObjectConstraint::set(SceneObject* obj) void afxObjectConstraint::set_scope_id(U16 scope_id) { - if (obj) - clearNotify(obj); + if (mObj) + clearNotify(mObj); - obj = 0; - this->scope_id = scope_id; + mObj = 0; + mScope_id = scope_id; is_defined = (scope_id > 0); is_valid = false; @@ -1825,52 +1825,52 @@ void afxObjectConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) if (gone_missing) return; - if (obj) + if (mObj) { - if (!is_camera && cons_def.treat_as_camera && dynamic_cast(obj)) + if (!mIs_camera && cons_def.mTreat_as_camera && dynamic_cast(mObj)) { - ShapeBase* cam_obj = (ShapeBase*) obj; + ShapeBase* cam_obj = (ShapeBase*) mObj; F32 pov = 1.0f; cam_obj->getCameraTransform(&pov, &last_xfm); last_xfm.getColumn(3, &last_pos); } else { - last_xfm = obj->getRenderTransform(); - if (cons_def.pos_at_box_center) - last_pos = obj->getBoxCenter(); + last_xfm = mObj->getRenderTransform(); + if (cons_def.mPos_at_box_center) + last_pos = mObj->getBoxCenter(); else - last_pos = obj->getRenderPosition(); + last_pos = mObj->getRenderPosition(); } } } void afxObjectConstraint::restoreObject(SceneObject* obj) { - if (this->obj) + if (mObj) { - scope_id = 0; - clearNotify(this->obj); + mScope_id = 0; + clearNotify(mObj); } - this->obj = obj; + mObj = obj; - if (this->obj) + if (mObj) { - deleteNotify(this->obj); - scope_id = this->obj->getScopeId(); + deleteNotify(mObj); + mScope_id = mObj->getScopeId(); } - is_valid = (this->obj != NULL); + is_valid = (mObj != NULL); } void afxObjectConstraint::onDeleteNotify(SimObject* obj) { - if (this->obj == dynamic_cast(obj)) + if (mObj == dynamic_cast(obj)) { - this->obj = 0; + mObj = 0; is_valid = false; - if (scope_id > 0) + if (mScope_id > 0) mgr->postMissingConstraintObject(this, true); } @@ -1879,14 +1879,14 @@ void afxObjectConstraint::onDeleteNotify(SimObject* obj) U32 afxObjectConstraint::getTriggers() { - TSStatic* ts_static = dynamic_cast(obj); + TSStatic* ts_static = dynamic_cast(mObj); if (ts_static) { TSShapeInstance* obj_inst = ts_static->getShapeInstance(); return (obj_inst) ? obj_inst->getTriggerStateMask() : 0; } - ShapeBase* shape_base = dynamic_cast(obj); + ShapeBase* shape_base = dynamic_cast(mObj); if (shape_base) { TSShapeInstance* obj_inst = shape_base->getShapeInstance(); @@ -1922,7 +1922,7 @@ bool afxEffectConstraint::getPosition(Point3F& pos, F32 hist) if (!effect || !effect->inScope()) return false; - if (cons_def.pos_at_box_center) + if (cons_def.mPos_at_box_center) effect->getUpdatedBoxCenter(pos); else effect->getUpdatedPosition(pos); @@ -2266,7 +2266,7 @@ void afxPointHistConstraint::set(Point3F point, Point3F vector) if (!samples) { samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.history_time, cons_def.sample_rate); + samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); } Parent::set(point, vector); @@ -2325,7 +2325,7 @@ void afxTransformHistConstraint::set(const MatrixF& xfm) if (!samples) { samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.history_time, cons_def.sample_rate); + samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); } Parent::set(xfm); @@ -2390,7 +2390,7 @@ void afxShapeHistConstraint::set(ShapeBase* shape) if (shape && !samples) { samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.history_time, cons_def.sample_rate); + samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); } Parent::set(shape); @@ -2401,7 +2401,7 @@ void afxShapeHistConstraint::set_scope_id(U16 scope_id) if (scope_id > 0 && !samples) { samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.history_time, cons_def.sample_rate); + samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); } Parent::set_scope_id(scope_id); @@ -2472,7 +2472,7 @@ void afxShapeNodeHistConstraint::set(ShapeBase* shape) if (shape && !samples) { samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.history_time, cons_def.sample_rate); + samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); } Parent::set(shape); @@ -2483,7 +2483,7 @@ void afxShapeNodeHistConstraint::set_scope_id(U16 scope_id) if (scope_id > 0 && !samples) { samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.history_time, cons_def.sample_rate); + samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); } Parent::set_scope_id(scope_id); @@ -2553,7 +2553,7 @@ void afxObjectHistConstraint::set(SceneObject* obj) if (obj && !samples) { samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.history_time, cons_def.sample_rate); + samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); } Parent::set(obj); @@ -2564,7 +2564,7 @@ void afxObjectHistConstraint::set_scope_id(U16 scope_id) if (scope_id > 0 && !samples) { samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.history_time, cons_def.sample_rate); + samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); } Parent::set_scope_id(scope_id); diff --git a/Engine/source/afx/afxConstraint.h b/Engine/source/afx/afxConstraint.h index d2ea324ae..3774613d0 100644 --- a/Engine/source/afx/afxConstraint.h +++ b/Engine/source/afx/afxConstraint.h @@ -47,17 +47,17 @@ struct afxConstraintDef : public afxEffectDefs CONS_GHOST }; - DefType def_type; + DefType mDef_type; - StringTableEntry cons_src_name; - StringTableEntry cons_node_name; - F32 history_time; - U8 sample_rate; + StringTableEntry mCons_src_name; + StringTableEntry mCons_node_name; + F32 mHistory_time; + U8 mSample_rate; - bool runs_on_server; - bool runs_on_client; - bool pos_at_box_center; - bool treat_as_camera; + bool mRuns_on_server; + bool mRuns_on_client; + bool mPos_at_box_center; + bool mTreat_as_camera; /*C*/ afxConstraintDef(); @@ -298,7 +298,7 @@ class afxTransformConstraint : public afxConstraint typedef afxConstraint Parent; protected: - MatrixF xfm; + MatrixF mXfm; public: /*C*/ afxTransformConstraint(afxConstraintMgr*); @@ -404,10 +404,10 @@ class afxObjectConstraint : public afxConstraint typedef afxConstraint Parent; protected: - StringTableEntry arb_name; - SceneObject* obj; - U16 scope_id; - bool is_camera; + StringTableEntry mArb_name; + SceneObject* mObj; + U16 mScope_id; + bool mIs_camera; public: afxObjectConstraint(afxConstraintMgr*); @@ -418,9 +418,9 @@ public: virtual void set_scope_id(U16 scope_id); virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos); - virtual SceneObject* getSceneObject() { return obj; } + virtual SceneObject* getSceneObject() { return mObj; } virtual void restoreObject(SceneObject*); - virtual U16 getScopeId() { return scope_id; } + virtual U16 getScopeId() { return mScope_id; } virtual U32 getTriggers(); virtual void onDeleteNotify(SimObject*); diff --git a/Engine/source/afx/afxEffectWrapper.cpp b/Engine/source/afx/afxEffectWrapper.cpp index 7011b5f06..0f33585f6 100644 --- a/Engine/source/afx/afxEffectWrapper.cpp +++ b/Engine/source/afx/afxEffectWrapper.cpp @@ -990,7 +990,7 @@ bool afxEffectWrapper::update(F32 dt) afxConstraint* pos_constraint = getPosConstraint(); if (pos_constraint) { - bool valid = pos_constraint->getPosition(CONS_POS, datablock->pos_cons_def.history_time); + bool valid = pos_constraint->getPosition(CONS_POS, datablock->pos_cons_def.mHistory_time); if (!valid) getUnconstrainedPosition(CONS_POS); setScopeStatus(valid); @@ -1013,7 +1013,7 @@ bool afxEffectWrapper::update(F32 dt) afxConstraint* orient_constraint = getOrientConstraint(); if (orient_constraint) { - orient_constraint->getTransform(CONS_XFM, datablock->pos_cons_def.history_time); + orient_constraint->getTransform(CONS_XFM, datablock->pos_cons_def.mHistory_time); } else { @@ -1022,7 +1022,7 @@ bool afxEffectWrapper::update(F32 dt) afxConstraint* aim_constraint = getAimConstraint(); if (aim_constraint) - aim_constraint->getPosition(CONS_AIM, datablock->pos_cons_def.history_time); + aim_constraint->getPosition(CONS_AIM, datablock->pos_cons_def.mHistory_time); else CONS_AIM.zero(); From 593680fb3f657589a7277e16805f360e08005429 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Wed, 28 Mar 2018 20:52:10 -0400 Subject: [PATCH 091/144] Move StringStack methods into the cpp file --- Engine/source/console/stringStack.cpp | 179 ++++++++++++++++++++++++++ Engine/source/console/stringStack.h | 172 +++---------------------- 2 files changed, 198 insertions(+), 153 deletions(-) diff --git a/Engine/source/console/stringStack.cpp b/Engine/source/console/stringStack.cpp index 681de2898..7081756c0 100644 --- a/Engine/source/console/stringStack.cpp +++ b/Engine/source/console/stringStack.cpp @@ -24,6 +24,185 @@ #include "console/consoleInternal.h" #include "console/stringStack.h" +StringStack::StringStack() +{ + mBufferSize = 0; + mBuffer = NULL; + mArgBufferSize = 0; + mArgBuffer = NULL; + mNumFrames = 0; + mStart = 0; + mLen = 0; + mStartStackSize = 0; + mFunctionOffset = 0; + validateBufferSize(8192); + validateArgBufferSize(2048); + dMemset(mBuffer, '\0', mBufferSize); + dMemset(mArgBuffer, '\0', mArgBufferSize); +} + +StringStack::~StringStack() +{ + if( mBuffer ) + dFree( mBuffer ); + if( mArgBuffer ) + dFree( mArgBuffer ); +} + +void StringStack::validateBufferSize(U32 size) +{ + if(size > mBufferSize) + { + mBufferSize = size + 2048; + mBuffer = (char *) dRealloc(mBuffer, mBufferSize); + } +} + +void StringStack::validateArgBufferSize(U32 size) +{ + if(size > mArgBufferSize) + { + mArgBufferSize = size + 2048; + mArgBuffer = (char *) dRealloc(mArgBuffer, mArgBufferSize); + } +} + +void StringStack::setIntValue(U32 i) +{ + validateBufferSize(mStart + 32); + dSprintf(mBuffer + mStart, 32, "%d", i); + mLen = dStrlen(mBuffer + mStart); +} + +void StringStack::setFloatValue(F64 v) +{ + validateBufferSize(mStart + 32); + dSprintf(mBuffer + mStart, 32, "%g", v); + mLen = dStrlen(mBuffer + mStart); +} + +char *StringStack::getReturnBuffer(U32 size) +{ + if(size > ReturnBufferSpace) + { + AssertFatal(Con::isMainThread(), "Manipulating return buffer from a secondary thread!"); + validateArgBufferSize(size); + return mArgBuffer; + } + else + { + validateBufferSize(mStart + size); + return mBuffer + mStart; + } +} + +char *StringStack::getArgBuffer(U32 size) +{ + AssertFatal(Con::isMainThread(), "Manipulating console arg buffer from a secondary thread!"); + validateBufferSize(mStart + mFunctionOffset + size); + char *ret = mBuffer + mStart + mFunctionOffset; + mFunctionOffset += size; + return ret; +} + +void StringStack::clearFunctionOffset() +{ + //Con::printf("StringStack mFunctionOffset = 0 (from %i)", mFunctionOffset); + mFunctionOffset = 0; +} + +void StringStack::setStringValue(const char *s) +{ + if(!s) + { + mLen = 0; + mBuffer[mStart] = 0; + return; + } + mLen = dStrlen(s); + + validateBufferSize(mStart + mLen + 2); + dStrcpy(mBuffer + mStart, s, mBufferSize - mStart); +} + +void StringStack::advance() +{ + mStartOffsets[mStartStackSize++] = mStart; + mStart += mLen; + mLen = 0; +} + +void StringStack::advanceChar(char c) +{ + mStartOffsets[mStartStackSize++] = mStart; + mStart += mLen; + mBuffer[mStart] = c; + mBuffer[mStart+1] = 0; + mStart += 1; + mLen = 0; +} + +void StringStack::push() +{ + advanceChar(0); +} + +void StringStack::rewind() +{ + mStart = mStartOffsets[--mStartStackSize]; + mLen = dStrlen(mBuffer + mStart); +} + +void StringStack::rewindTerminate() +{ + mBuffer[mStart] = 0; + mStart = mStartOffsets[--mStartStackSize]; + mLen = dStrlen(mBuffer + mStart); +} + +U32 StringStack::compare() +{ + // Figure out the 1st and 2nd item offsets. + U32 oldStart = mStart; + mStart = mStartOffsets[--mStartStackSize]; + + // Compare current and previous strings. + U32 ret = !dStricmp(mBuffer + mStart, mBuffer + oldStart); + + // Put an empty string on the top of the stack. + mLen = 0; + mBuffer[mStart] = 0; + + return ret; +} + +void StringStack::pushFrame() +{ + //Con::printf("StringStack pushFrame [frame=%i, start=%i]", mNumFrames, mStartStackSize); + mFrameOffsets[mNumFrames++] = mStartStackSize; + mStartOffsets[mStartStackSize++] = mStart; + mStart += ReturnBufferSpace; + validateBufferSize(0); +} + +void StringStack::popFrame() +{ + //Con::printf("StringStack popFrame [frame=%i, start=%i]", mNumFrames, mStartStackSize); + mStartStackSize = mFrameOffsets[--mNumFrames]; + mStart = mStartOffsets[mStartStackSize]; + mLen = 0; +} + +void StringStack::clearFrames() +{ + //Con::printf("StringStack clearFrames"); + mNumFrames = 0; + mStart = 0; + mLen = 0; + mStartStackSize = 0; + mFunctionOffset = 0; +} + void ConsoleValueStack::getArgcArgv(StringTableEntry name, U32 *argc, ConsoleValueRef **in_argv, bool popStackFrame /* = false */) { diff --git a/Engine/source/console/stringStack.h b/Engine/source/console/stringStack.h index 0550bb61e..f8a300143 100644 --- a/Engine/source/console/stringStack.h +++ b/Engine/source/console/stringStack.h @@ -79,105 +79,31 @@ struct StringStack U32 mArgBufferSize; char *mArgBuffer; - void validateBufferSize(U32 size) - { - if(size > mBufferSize) - { - mBufferSize = size + 2048; - mBuffer = (char *) dRealloc(mBuffer, mBufferSize); - } - } + void validateBufferSize(U32 size); + void validateArgBufferSize(U32 size); - void validateArgBufferSize(U32 size) - { - if(size > mArgBufferSize) - { - mArgBufferSize = size + 2048; - mArgBuffer = (char *) dRealloc(mArgBuffer, mArgBufferSize); - } - } - - StringStack() - { - mBufferSize = 0; - mBuffer = NULL; - mArgBufferSize = 0; - mArgBuffer = NULL; - mNumFrames = 0; - mStart = 0; - mLen = 0; - mStartStackSize = 0; - mFunctionOffset = 0; - validateBufferSize(8192); - validateArgBufferSize(2048); - dMemset(mBuffer, '\0', mBufferSize); - dMemset(mArgBuffer, '\0', mArgBufferSize); - } - ~StringStack() - { - if( mBuffer ) - dFree( mBuffer ); - if( mArgBuffer ) - dFree( mArgBuffer ); - } + StringStack(); + ~StringStack(); /// Set the top of the stack to be an integer value. - void setIntValue(U32 i) - { - validateBufferSize(mStart + 32); - dSprintf(mBuffer + mStart, 32, "%d", i); - mLen = dStrlen(mBuffer + mStart); - } + void setIntValue(U32 i); /// Set the top of the stack to be a float value. - void setFloatValue(F64 v) - { - validateBufferSize(mStart + 32); - dSprintf(mBuffer + mStart, 32, "%g", v); - mLen = dStrlen(mBuffer + mStart); - } + void setFloatValue(F64 v); /// Return a temporary buffer we can use to return data. - char* getReturnBuffer(U32 size) - { - AssertFatal(Con::isMainThread(), "Manipulating return buffer from a secondary thread!"); - validateArgBufferSize(size); - return mArgBuffer; - } + char* getReturnBuffer(U32 size); /// Return a buffer we can use for arguments. /// /// This updates the function offset. - char *getArgBuffer(U32 size) - { - AssertFatal(Con::isMainThread(), "Manipulating console arg buffer from a secondary thread!"); - validateBufferSize(mStart + mFunctionOffset + size); - char *ret = mBuffer + mStart + mFunctionOffset; - mFunctionOffset += size; - return ret; - } + char *getArgBuffer(U32 size); /// Clear the function offset. - void clearFunctionOffset() - { - //Con::printf("StringStack mFunctionOffset = 0 (from %i)", mFunctionOffset); - mFunctionOffset = 0; - } + void clearFunctionOffset(); /// Set a string value on the top of the stack. - void setStringValue(const char *s) - { - if(!s) - { - mLen = 0; - mBuffer[mStart] = 0; - return; - } - mLen = dStrlen(s); - - validateBufferSize(mStart + mLen + 2); - dStrcpy(mBuffer + mStart, s, mBufferSize - mStart); - } + void setStringValue(const char *s); /// Get the top of the stack, as a StringTableEntry. /// @@ -226,33 +152,17 @@ struct StringStack /// /// @note You should use StringStack::push, not this, if you want to /// properly push the stack. - void advance() - { - mStartOffsets[mStartStackSize++] = mStart; - mStart += mLen; - mLen = 0; - } + void advance(); /// Advance the start stack, placing a single character, null-terminated strong /// on the top. /// /// @note You should use StringStack::push, not this, if you want to /// properly push the stack. - void advanceChar(char c) - { - mStartOffsets[mStartStackSize++] = mStart; - mStart += mLen; - mBuffer[mStart] = c; - mBuffer[mStart+1] = 0; - mStart += 1; - mLen = 0; - } + void advanceChar(char c); /// Push the stack, placing a zero-length string on the top. - void push() - { - advanceChar(0); - } + void push(); inline void setLen(U32 newlen) { @@ -260,64 +170,20 @@ struct StringStack } /// Pop the start stack. - void rewind() - { - mStart = mStartOffsets[--mStartStackSize]; - mLen = dStrlen(mBuffer + mStart); - } + void rewind(); // Terminate the current string, and pop the start stack. - void rewindTerminate() - { - mBuffer[mStart] = 0; - mStart = mStartOffsets[--mStartStackSize]; - mLen = dStrlen(mBuffer + mStart); - } + void rewindTerminate(); /// Compare 1st and 2nd items on stack, consuming them in the process, /// and returning true if they matched, false if they didn't. - U32 compare() - { - // Figure out the 1st and 2nd item offsets. - U32 oldStart = mStart; - mStart = mStartOffsets[--mStartStackSize]; + U32 compare(); - // Compare current and previous strings. - U32 ret = !dStricmp(mBuffer + mStart, mBuffer + oldStart); + void pushFrame(); - // Put an empty string on the top of the stack. - mLen = 0; - mBuffer[mStart] = 0; + void popFrame(); - return ret; - } - - void pushFrame() - { - //Con::printf("StringStack pushFrame [frame=%i, start=%i]", mNumFrames, mStartStackSize); - mFrameOffsets[mNumFrames++] = mStartStackSize; - mStartOffsets[mStartStackSize++] = mStart; - mStart += ReturnBufferSpace; - validateBufferSize(0); - } - - void popFrame() - { - //Con::printf("StringStack popFrame [frame=%i, start=%i]", mNumFrames, mStartStackSize); - mStartStackSize = mFrameOffsets[--mNumFrames]; - mStart = mStartOffsets[mStartStackSize]; - mLen = 0; - } - - void clearFrames() - { - //Con::printf("StringStack clearFrames"); - mNumFrames = 0; - mStart = 0; - mLen = 0; - mStartStackSize = 0; - mFunctionOffset = 0; - } + void clearFrames(); /// Get the arguments for a function call from the stack. void getArgcArgv(StringTableEntry name, U32 *argc, const char ***in_argv, bool popStackFrame = false); From 18dee487f90717f034cdc4b17ac32ef2bb426261 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Wed, 28 Mar 2018 20:52:46 -0400 Subject: [PATCH 092/144] Use a circular buffer for getReturnBuffer because StringStack's would get clobbered too quickly --- Engine/source/console/compiledEval.cpp | 9 +-- Engine/source/console/returnBuffer.cpp | 83 ++++++++++++++++++++++++++ Engine/source/console/returnBuffer.h | 49 +++++++++++++++ 3 files changed, 137 insertions(+), 4 deletions(-) create mode 100644 Engine/source/console/returnBuffer.cpp create mode 100644 Engine/source/console/returnBuffer.h diff --git a/Engine/source/console/compiledEval.cpp b/Engine/source/console/compiledEval.cpp index 73969afb2..47f5717ad 100644 --- a/Engine/source/console/compiledEval.cpp +++ b/Engine/source/console/compiledEval.cpp @@ -41,6 +41,7 @@ #include "core/frameAllocator.h" #include "console/codeInterpreter.h" +#include "console/returnBuffer.h" #ifndef TORQUE_TGB_ONLY #include "materials/materialDefinition.h" @@ -101,17 +102,17 @@ F64 consoleStringToNumber(const char *str, StringTableEntry file, U32 line) namespace Con { + ReturnBuffer retBuffer; char *getReturnBuffer(U32 bufferSize) - { - return STR.getReturnBuffer(bufferSize); + return retBuffer.getBuffer(bufferSize); } char *getReturnBuffer(const char *stringToCopy) { U32 len = dStrlen(stringToCopy) + 1; - char *ret = STR.getReturnBuffer(len); + char *ret = retBuffer.getBuffer(len); dMemcpy(ret, stringToCopy, len); return ret; } @@ -119,7 +120,7 @@ namespace Con char* getReturnBuffer(const String& str) { const U32 size = str.size(); - char* ret = STR.getReturnBuffer(size); + char* ret = retBuffer.getBuffer(size); dMemcpy(ret, str.c_str(), size); return ret; } diff --git a/Engine/source/console/returnBuffer.cpp b/Engine/source/console/returnBuffer.cpp new file mode 100644 index 000000000..6813339ea --- /dev/null +++ b/Engine/source/console/returnBuffer.cpp @@ -0,0 +1,83 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "returnBuffer.h" + +ReturnBuffer::ReturnBuffer() +{ + mBuffer = nullptr; + mBufferSize = 0; + mStart = 0; + + //Decent starting alloc of ~1 page = 4kb + ensureSize(4 * 1024); +} + +ReturnBuffer::~ReturnBuffer() +{ + if (mBuffer) + { + dFree(mBuffer); + } +} + +void ReturnBuffer::ensureSize(U32 newSize) +{ + //Round up to nearest multiple of 16 bytes + if (newSize & 0xF) + { + newSize = (newSize & ~0xF) + 0x10; + } + if (mBuffer == NULL) + { + //First alloc + mBuffer = (char *)dMalloc(newSize * sizeof(char)); + mBufferSize = newSize; + } + else if (mBufferSize < newSize) + { + //Just use the expected size + mBuffer = (char *)dRealloc(mBuffer, newSize * sizeof(char)); + mBufferSize = newSize; + } +} + +char *ReturnBuffer::getBuffer(U32 size, U32 alignment) +{ + ensureSize(size); + + //Align the start if necessary + if (mStart % alignment != 0) + { + mStart += alignment - (mStart % alignment); + } + + if (size + mStart > mBufferSize) + { + //Restart + mStart = 0; + } + char *buffer = mBuffer + mStart; + mStart += size; + + return buffer; +} diff --git a/Engine/source/console/returnBuffer.h b/Engine/source/console/returnBuffer.h new file mode 100644 index 000000000..9fa374cb5 --- /dev/null +++ b/Engine/source/console/returnBuffer.h @@ -0,0 +1,49 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef _RETURNBUFFER_H_ +#define _RETURNBUFFER_H_ + +#ifndef _PLATFORM_H_ + #include +#endif + +/// Simple circular buffer class for temporary return storage. +class ReturnBuffer +{ + char *mBuffer; + U32 mBufferSize; + U32 mStart; + + /// Possibly expand the buffer to be larger than newSize + void ensureSize(U32 newSize); + +public: + ReturnBuffer(); + ~ReturnBuffer(); + + /// Get a temporary buffer with a given size (and alignment) + /// @note The buffer will be re-used so do not consider it permanent + char *getBuffer(U32 size, U32 alignment = 16); +}; + +#endif //_RETURNBUFFER_H_ From fa2b0761a7a914eb9e3277dd1fb97d7eadff7b9c Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 28 Mar 2018 23:37:19 -0500 Subject: [PATCH 093/144] more afx constraint mmebervar cleanups --- Engine/source/afx/afxConstraint.cpp | 826 ++++++++++++++-------------- Engine/source/afx/afxConstraint.h | 120 ++-- 2 files changed, 473 insertions(+), 473 deletions(-) diff --git a/Engine/source/afx/afxConstraint.cpp b/Engine/source/afx/afxConstraint.cpp index ab4aa59f0..a739148f5 100644 --- a/Engine/source/afx/afxConstraint.cpp +++ b/Engine/source/afx/afxConstraint.cpp @@ -287,15 +287,15 @@ void afxConstraintDef::gather_cons_defs(Vector& defs, afxEffec afxConstraint::afxConstraint(afxConstraintMgr* mgr) { - this->mgr = mgr; - is_defined = false; - is_valid = false; - last_pos.zero(); - last_xfm.identity(); - history_time = 0.0f; - is_alive = true; - gone_missing = false; - change_code = 0; + mMgr = mgr; + mIs_defined = false; + mIs_valid = false; + mLast_pos.zero(); + mLast_xfm.identity(); + mHistory_time = 0.0f; + mIs_alive = true; + mGone_missing = false; + mChange_code = 0; } afxConstraint::~afxConstraint() @@ -342,26 +342,26 @@ inline afxObjectConstraint* newObjectCons(afxConstraintMgr* mgr, StringTableEntr //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// // afxConstraintMgr -#define CONS_BY_ID(id) ((*constraints_v[(id).index])[(id).sub_index]) -#define CONS_BY_IJ(i,j) ((*constraints_v[(i)])[(j)]) +#define CONS_BY_ID(id) ((*mConstraints_v[(id).index])[(id).sub_index]) +#define CONS_BY_IJ(i,j) ((*mConstraints_v[(i)])[(j)]) afxConstraintMgr::afxConstraintMgr() { - starttime = 0; - on_server = false; - initialized = false; - scoping_dist_sq = 1000.0f*1000.0f; + mStartTime = 0; + mOn_server = false; + mInitialized = false; + mScoping_dist_sq = 1000.0f*1000.0f; missing_objs = &missing_objs_a; missing_objs2 = &missing_objs_b; } afxConstraintMgr::~afxConstraintMgr() { - for (S32 i = 0; i < constraints_v.size(); i++) + for (S32 i = 0; i < mConstraints_v.size(); i++) { - for (S32 j = 0; j < (*constraints_v[i]).size(); j++) + for (S32 j = 0; j < (*mConstraints_v[i]).size(); j++) delete CONS_BY_IJ(i,j); - delete constraints_v[i]; + delete mConstraints_v[i]; } } @@ -369,11 +369,11 @@ afxConstraintMgr::~afxConstraintMgr() S32 afxConstraintMgr::find_cons_idx_from_name(StringTableEntry which) { - for (S32 i = 0; i < constraints_v.size(); i++) + for (S32 i = 0; i < mConstraints_v.size(); i++) { afxConstraint* cons = CONS_BY_IJ(i,0); - if (cons && afxConstraintDef::CONS_EFFECT != cons->cons_def.mDef_type && - which == cons->cons_def.mCons_src_name) + if (cons && afxConstraintDef::CONS_EFFECT != cons->mCons_def.mDef_type && + which == cons->mCons_def.mCons_src_name) { return i; } @@ -384,11 +384,11 @@ S32 afxConstraintMgr::find_cons_idx_from_name(StringTableEntry which) S32 afxConstraintMgr::find_effect_cons_idx_from_name(StringTableEntry which) { - for (S32 i = 0; i < constraints_v.size(); i++) + for (S32 i = 0; i < mConstraints_v.size(); i++) { afxConstraint* cons = CONS_BY_IJ(i,0); - if (cons && afxConstraintDef::CONS_EFFECT == cons->cons_def.mDef_type && - which == cons->cons_def.mCons_src_name) + if (cons && afxConstraintDef::CONS_EFFECT == cons->mCons_def.mDef_type && + which == cons->mCons_def.mCons_src_name) { return i; } @@ -401,7 +401,7 @@ S32 afxConstraintMgr::find_effect_cons_idx_from_name(StringTableEntry which) void afxConstraintMgr::defineConstraint(U32 type, StringTableEntry name) { preDef predef = { name, type }; - predefs.push_back(predef); + mPredefs.push_back(predef); } afxConstraintID afxConstraintMgr::setReferencePoint(StringTableEntry which, Point3F point, @@ -472,11 +472,11 @@ afxConstraintID afxConstraintMgr::createReferenceEffect(StringTableEntry which, { afxEffectConstraint* cons = new afxEffectConstraint(this, which); //cons->cons_def = def; - cons->cons_def.mDef_type = afxConstraintDef::CONS_EFFECT; - cons->cons_def.mCons_src_name = which; + cons->mCons_def.mDef_type = afxConstraintDef::CONS_EFFECT; + cons->mCons_def.mCons_src_name = which; afxConstraintList* list = new afxConstraintList(); list->push_back(cons); - constraints_v.push_back(list); + mConstraints_v.push_back(list); return setReferenceEffect(which, ew); } @@ -489,8 +489,8 @@ void afxConstraintMgr::setReferencePoint(afxConstraintID id, Point3F point, Poin if (!pt_cons) { afxConstraint* cons = CONS_BY_ID(id); - pt_cons = newPointCons(this, cons->cons_def.mHistory_time > 0.0f); - pt_cons->cons_def = cons->cons_def; + pt_cons = newPointCons(this, cons->mCons_def.mHistory_time > 0.0f); + pt_cons->mCons_def = cons->mCons_def; CONS_BY_ID(id) = pt_cons; delete cons; } @@ -498,7 +498,7 @@ void afxConstraintMgr::setReferencePoint(afxConstraintID id, Point3F point, Poin pt_cons->set(point, vector); // nullify all subnodes - for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + for (S32 j = 1; j < (*mConstraints_v[id.index]).size(); j++) { afxConstraint* cons = CONS_BY_IJ(id.index,j); if (cons) @@ -514,8 +514,8 @@ void afxConstraintMgr::setReferenceTransform(afxConstraintID id, MatrixF& xfm) if (!xfm_cons) { afxConstraint* cons = CONS_BY_ID(id); - xfm_cons = newTransformCons(this, cons->cons_def.mHistory_time > 0.0f); - xfm_cons->cons_def = cons->cons_def; + xfm_cons = newTransformCons(this, cons->mCons_def.mHistory_time > 0.0f); + xfm_cons->mCons_def = cons->mCons_def; CONS_BY_ID(id) = xfm_cons; delete cons; } @@ -523,7 +523,7 @@ void afxConstraintMgr::setReferenceTransform(afxConstraintID id, MatrixF& xfm) xfm_cons->set(xfm); // nullify all subnodes - for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + for (S32 j = 1; j < (*mConstraints_v[id.index]).size(); j++) { afxConstraint* cons = CONS_BY_IJ(id.index,j); if (cons) @@ -541,8 +541,8 @@ void afxConstraintMgr::set_ref_shape(afxConstraintID id, ShapeBase* shape) if (!shape_cons) { afxConstraint* cons = CONS_BY_ID(id); - shape_cons = newShapeCons(this, cons->cons_def.mHistory_time > 0.0f); - shape_cons->cons_def = cons->cons_def; + shape_cons = newShapeCons(this, cons->mCons_def.mHistory_time > 0.0f); + shape_cons->mCons_def = cons->mCons_def; CONS_BY_ID(id) = shape_cons; delete cons; } @@ -551,7 +551,7 @@ void afxConstraintMgr::set_ref_shape(afxConstraintID id, ShapeBase* shape) shape_cons->set(shape); // update all subnodes - for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + for (S32 j = 1; j < (*mConstraints_v[id.index]).size(); j++) { afxConstraint* cons = CONS_BY_IJ(id.index,j); if (cons) @@ -578,8 +578,8 @@ void afxConstraintMgr::set_ref_shape(afxConstraintID id, U16 scope_id) if (!shape_cons) { afxConstraint* cons = CONS_BY_ID(id); - shape_cons = newShapeCons(this, cons->cons_def.mHistory_time > 0.0f); - shape_cons->cons_def = cons->cons_def; + shape_cons = newShapeCons(this, cons->mCons_def.mHistory_time > 0.0f); + shape_cons->mCons_def = cons->mCons_def; CONS_BY_ID(id) = shape_cons; delete cons; } @@ -588,7 +588,7 @@ void afxConstraintMgr::set_ref_shape(afxConstraintID id, U16 scope_id) shape_cons->set_scope_id(scope_id); // update all subnodes - for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + for (S32 j = 1; j < (*mConstraints_v[id.index]).size(); j++) { afxConstraint* cons = CONS_BY_IJ(id.index,j); if (cons) @@ -599,10 +599,10 @@ void afxConstraintMgr::set_ref_shape(afxConstraintID id, U16 scope_id) // Assigns an existing scene-object to the constraint matching the given constraint-id. void afxConstraintMgr::setReferenceObject(afxConstraintID id, SceneObject* obj) { - if (!initialized) + if (!mInitialized) Con::errorf("afxConstraintMgr::setReferenceObject() -- constraint manager not initialized"); - if (!CONS_BY_ID(id)->cons_def.mTreat_as_camera) + if (!CONS_BY_ID(id)->mCons_def.mTreat_as_camera) { ShapeBase* shape = dynamic_cast(obj); if (shape) @@ -618,8 +618,8 @@ void afxConstraintMgr::setReferenceObject(afxConstraintID id, SceneObject* obj) if (!obj_cons) { afxConstraint* cons = CONS_BY_ID(id); - obj_cons = newObjectCons(this, cons->cons_def.mHistory_time > 0.0f); - obj_cons->cons_def = cons->cons_def; + obj_cons = newObjectCons(this, cons->mCons_def.mHistory_time > 0.0f); + obj_cons->mCons_def = cons->mCons_def; CONS_BY_ID(id) = obj_cons; delete cons; } @@ -627,7 +627,7 @@ void afxConstraintMgr::setReferenceObject(afxConstraintID id, SceneObject* obj) obj_cons->set(obj); // update all subnodes - for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + for (S32 j = 1; j < (*mConstraints_v[id.index]).size(); j++) { afxConstraint* cons = CONS_BY_IJ(id.index,j); if (cons) @@ -644,7 +644,7 @@ void afxConstraintMgr::setReferenceObject(afxConstraintID id, SceneObject* obj) // given constraint-id. void afxConstraintMgr::setReferenceObjectByScopeId(afxConstraintID id, U16 scope_id, bool is_shape) { - if (!initialized) + if (!mInitialized) Con::errorf("afxConstraintMgr::setReferenceObject() -- constraint manager not initialized"); if (is_shape) @@ -659,8 +659,8 @@ void afxConstraintMgr::setReferenceObjectByScopeId(afxConstraintID id, U16 scope if (!obj_cons) { afxConstraint* cons = CONS_BY_ID(id); - obj_cons = newObjectCons(this, cons->cons_def.mHistory_time > 0.0f); - obj_cons->cons_def = cons->cons_def; + obj_cons = newObjectCons(this, cons->mCons_def.mHistory_time > 0.0f); + obj_cons->mCons_def = cons->mCons_def; CONS_BY_ID(id) = obj_cons; delete cons; } @@ -668,7 +668,7 @@ void afxConstraintMgr::setReferenceObjectByScopeId(afxConstraintID id, U16 scope obj_cons->set_scope_id(scope_id); // update all subnodes - for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + for (S32 j = 1; j < (*mConstraints_v[id.index]).size(); j++) { afxConstraint* cons = CONS_BY_IJ(id.index,j); if (cons) @@ -685,7 +685,7 @@ void afxConstraintMgr::setReferenceEffect(afxConstraintID id, afxEffectWrapper* eff_cons->set(ew); // update all subnodes - for (S32 j = 1; j < (*constraints_v[id.index]).size(); j++) + for (S32 j = 1; j < (*mConstraints_v[id.index]).size(); j++) { afxConstraint* cons = CONS_BY_IJ(id.index,j); if (cons) @@ -704,7 +704,7 @@ void afxConstraintMgr::invalidateReference(afxConstraintID id) { afxConstraint* cons = CONS_BY_ID(id); if (cons) - cons->is_valid = false; + cons->mIs_valid = false; } void afxConstraintMgr::create_constraint(const afxConstraintDef& def) @@ -725,7 +725,7 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) // find the arbitrary object by name SceneObject* arb_obj; - if (on_server) + if (mOn_server) { arb_obj = dynamic_cast(Sim::findObject(def.mCons_src_name)); if (!arb_obj) @@ -746,27 +746,27 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) if (def.mCons_node_name == ST_NULLSTRING && !def.mPos_at_box_center) { afxShapeConstraint* cons = newShapeCons(this, def.mCons_src_name, want_history); - cons->cons_def = def; + cons->mCons_def = def; cons->set((ShapeBase*)arb_obj); afxConstraintList* list = new afxConstraintList(); list->push_back(cons); - constraints_v.push_back(list); + mConstraints_v.push_back(list); } else if (def.mPos_at_box_center) { afxShapeConstraint* cons = newShapeCons(this, def.mCons_src_name, want_history); - cons->cons_def = def; + cons->mCons_def = def; cons->set((ShapeBase*)arb_obj); - afxConstraintList* list = constraints_v[constraints_v.size()-1]; // SHAPE-NODE CONS-LIST (#scene)(#center) + afxConstraintList* list = mConstraints_v[mConstraints_v.size()-1]; // SHAPE-NODE CONS-LIST (#scene)(#center) if (list && (*list)[0]) list->push_back(cons); } else { afxShapeNodeConstraint* sub = newShapeNodeCons(this, def.mCons_src_name, def.mCons_node_name, want_history); - sub->cons_def = def; + sub->mCons_def = def; sub->set((ShapeBase*)arb_obj); - afxConstraintList* list = constraints_v[constraints_v.size()-1]; + afxConstraintList* list = mConstraints_v[mConstraints_v.size()-1]; if (list && (*list)[0]) list->push_back(sub); } @@ -777,18 +777,18 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) if (!def.mPos_at_box_center) { afxObjectConstraint* cons = newObjectCons(this, def.mCons_src_name, want_history); - cons->cons_def = def; + cons->mCons_def = def; cons->set(arb_obj); afxConstraintList* list = new afxConstraintList(); // OBJECT CONS-LIST (#scene) list->push_back(cons); - constraints_v.push_back(list); + mConstraints_v.push_back(list); } else // if (def.pos_at_box_center) { afxObjectConstraint* cons = newObjectCons(this, def.mCons_src_name, want_history); - cons->cons_def = def; + cons->mCons_def = def; cons->set(arb_obj); - afxConstraintList* list = constraints_v[constraints_v.size()-1]; // OBJECT CONS-LIST (#scene)(#center) + afxConstraintList* list = mConstraints_v[mConstraints_v.size()-1]; // OBJECT CONS-LIST (#scene)(#center) if (list && (*list)[0]) list->push_back(cons); } @@ -806,17 +806,17 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) if (def.mCons_node_name == ST_NULLSTRING && !def.mPos_at_box_center) { afxEffectConstraint* cons = new afxEffectConstraint(this, def.mCons_src_name); - cons->cons_def = def; + cons->mCons_def = def; afxConstraintList* list = new afxConstraintList(); list->push_back(cons); - constraints_v.push_back(list); + mConstraints_v.push_back(list); } // create an Effect #center constraint else if (def.mPos_at_box_center) { afxEffectConstraint* cons = new afxEffectConstraint(this, def.mCons_src_name); - cons->cons_def = def; - afxConstraintList* list = constraints_v[constraints_v.size()-1]; // EFFECT-NODE CONS-LIST (#effect) + cons->mCons_def = def; + afxConstraintList* list = mConstraints_v[mConstraints_v.size()-1]; // EFFECT-NODE CONS-LIST (#effect) if (list && (*list)[0]) list->push_back(cons); } @@ -824,8 +824,8 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) else { afxEffectNodeConstraint* sub = new afxEffectNodeConstraint(this, def.mCons_src_name, def.mCons_node_name); - sub->cons_def = def; - afxConstraintList* list = constraints_v[constraints_v.size()-1]; + sub->mCons_def = def; + afxConstraintList* list = mConstraints_v[mConstraints_v.size()-1]; if (list && (*list)[0]) list->push_back(sub); } @@ -841,24 +841,24 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) if (def.mDef_type == afxConstraintDef::CONS_GHOST) { - for (S32 i = 0; i < predefs.size(); i++) + for (S32 i = 0; i < mPredefs.size(); i++) { - if (predefs[i].name == def.mCons_src_name) + if (mPredefs[i].name == def.mCons_src_name) { if (def.mCons_node_name == ST_NULLSTRING && !def.mPos_at_box_center) { cons = newShapeCons(this, want_history); - cons->cons_def = def; + cons->mCons_def = def; } else if (def.mPos_at_box_center) { cons_ctr = newShapeCons(this, want_history); - cons_ctr->cons_def = def; + cons_ctr->mCons_def = def; } else { sub = newShapeNodeCons(this, ST_NULLSTRING, def.mCons_node_name, want_history); - sub->cons_def = def; + sub->mCons_def = def; } break; } @@ -866,41 +866,41 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) } else { - for (S32 i = 0; i < predefs.size(); i++) + for (S32 i = 0; i < mPredefs.size(); i++) { - if (predefs[i].name == def.mCons_src_name) + if (mPredefs[i].name == def.mCons_src_name) { - switch (predefs[i].type) + switch (mPredefs[i].type) { case POINT_CONSTRAINT: cons = newPointCons(this, want_history); - cons->cons_def = def; + cons->mCons_def = def; break; case TRANSFORM_CONSTRAINT: cons = newTransformCons(this, want_history); - cons->cons_def = def; + cons->mCons_def = def; break; case OBJECT_CONSTRAINT: if (def.mCons_node_name == ST_NULLSTRING && !def.mPos_at_box_center) { cons = newShapeCons(this, want_history); - cons->cons_def = def; + cons->mCons_def = def; } else if (def.mPos_at_box_center) { cons_ctr = newShapeCons(this, want_history); - cons_ctr->cons_def = def; + cons_ctr->mCons_def = def; } else { sub = newShapeNodeCons(this, ST_NULLSTRING, def.mCons_node_name, want_history); - sub->cons_def = def; + sub->mCons_def = def; } break; case CAMERA_CONSTRAINT: cons = newObjectCons(this, want_history); - cons->cons_def = def; - cons->cons_def.mTreat_as_camera = true; + cons->mCons_def = def; + cons->mCons_def.mTreat_as_camera = true; break; } break; @@ -912,17 +912,17 @@ void afxConstraintMgr::create_constraint(const afxConstraintDef& def) { afxConstraintList* list = new afxConstraintList(); list->push_back(cons); - constraints_v.push_back(list); + mConstraints_v.push_back(list); } - else if (cons_ctr && constraints_v.size() > 0) + else if (cons_ctr && mConstraints_v.size() > 0) { - afxConstraintList* list = constraints_v[constraints_v.size()-1]; // PREDEF-NODE CONS-LIST + afxConstraintList* list = mConstraints_v[mConstraints_v.size()-1]; // PREDEF-NODE CONS-LIST if (list && (*list)[0]) list->push_back(cons_ctr); } - else if (sub && constraints_v.size() > 0) + else if (sub && mConstraints_v.size() > 0) { - afxConstraintList* list = constraints_v[constraints_v.size()-1]; + afxConstraintList* list = mConstraints_v[mConstraints_v.size()-1]; if (list && (*list)[0]) list->push_back(sub); } @@ -938,18 +938,18 @@ afxConstraintID afxConstraintMgr::getConstraintId(const afxConstraintDef& def) if (def.mCons_src_name != ST_NULLSTRING) { - for (S32 i = 0; i < constraints_v.size(); i++) + for (S32 i = 0; i < mConstraints_v.size(); i++) { - afxConstraintList* list = constraints_v[i]; + afxConstraintList* list = mConstraints_v[i]; afxConstraint* cons = (*list)[0]; - if (def.mCons_src_name == cons->cons_def.mCons_src_name) + if (def.mCons_src_name == cons->mCons_def.mCons_src_name) { for (S32 j = 0; j < list->size(); j++) { afxConstraint* sub = (*list)[j]; - if (def.mCons_node_name == sub->cons_def.mCons_node_name && - def.mPos_at_box_center == sub->cons_def.mPos_at_box_center && - def.mCons_src_name == sub->cons_def.mCons_src_name) + if (def.mCons_node_name == sub->mCons_def.mCons_node_name && + def.mPos_at_box_center == sub->mCons_def.mPos_at_box_center && + def.mCons_src_name == sub->mCons_def.mCons_src_name) { return afxConstraintID(i, j); } @@ -965,8 +965,8 @@ afxConstraintID afxConstraintMgr::getConstraintId(const afxConstraintDef& def) //Con::errorf("Append a Node constraint [%s.%s] [%d,%d]", def.cons_src_name, def.cons_node_name, i, list->size()); bool want_history = (def.mHistory_time > 0.0f); afxConstraint* sub = newShapeNodeCons(this, ST_NULLSTRING, def.mCons_node_name, want_history); - sub->cons_def = def; - ((afxShapeConstraint*)sub)->set(shape_cons->shape); + sub->mCons_def = def; + ((afxShapeConstraint*)sub)->set(shape_cons->mShape); list->push_back(sub); return afxConstraintID(i, list->size()-1); @@ -995,11 +995,11 @@ afxConstraint* afxConstraintMgr::getConstraint(afxConstraintID id) void afxConstraintMgr::sample(F32 dt, U32 now, const Point3F* cam_pos) { - U32 elapsed = now - starttime; + U32 elapsed = now - mStartTime; - for (S32 i = 0; i < constraints_v.size(); i++) + for (S32 i = 0; i < mConstraints_v.size(); i++) { - afxConstraintList* list = constraints_v[i]; + afxConstraintList* list = mConstraints_v[i]; for (S32 j = 0; j < list->size(); j++) (*list)[j]->sample(dt, elapsed, cam_pos); } @@ -1027,16 +1027,16 @@ S32 QSORT_CALLBACK cmp_cons_defs(const void* a, const void* b) void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bool on_server, F32 scoping_dist) { - initialized = true; - this->on_server = on_server; + mInitialized = true; + mOn_server = on_server; if (scoping_dist > 0.0) - scoping_dist_sq = scoping_dist*scoping_dist; + mScoping_dist_sq = scoping_dist*scoping_dist; else { SceneManager* sg = (on_server) ? gServerSceneGraph : gClientSceneGraph; F32 vis_dist = (sg) ? sg->getVisibleDistance() : 1000.0f; - scoping_dist_sq = vis_dist*vis_dist; + mScoping_dist_sq = vis_dist*vis_dist; } if (all_defs.size() < 1) @@ -1157,7 +1157,7 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo // if (on_server) { - names_on_server.clear(); + mNames_on_server.clear(); defs.clear(); for (S32 i = 0; i < all_defs.size(); i++) @@ -1172,13 +1172,13 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo dQsort(defs.address(), defs.size(), sizeof(afxConstraintDef), cmp_cons_defs); S32 last = 0; - names_on_server.push_back(defs[0].mCons_src_name); + mNames_on_server.push_back(defs[0].mCons_src_name); for (S32 i = 1; i < defs.size(); i++) { - if (names_on_server[last] != defs[i].mCons_src_name) + if (mNames_on_server[last] != defs[i].mCons_src_name) { - names_on_server.push_back(defs[i].mCons_src_name); + mNames_on_server.push_back(defs[i].mCons_src_name); last++; } } @@ -1188,13 +1188,13 @@ void afxConstraintMgr::initConstraintDefs(Vector& all_defs, bo void afxConstraintMgr::packConstraintNames(NetConnection* conn, BitStream* stream) { // pack any named constraint names and ghost indices - if (stream->writeFlag(names_on_server.size() > 0)) //-- ANY NAMED CONS_BY_ID? + if (stream->writeFlag(mNames_on_server.size() > 0)) //-- ANY NAMED CONS_BY_ID? { - stream->write(names_on_server.size()); - for (S32 i = 0; i < names_on_server.size(); i++) + stream->write(mNames_on_server.size()); + for (S32 i = 0; i < mNames_on_server.size(); i++) { - stream->writeString(names_on_server[i]); - NetObject* obj = dynamic_cast(Sim::findObject(names_on_server[i])); + stream->writeString(mNames_on_server[i]); + NetObject* obj = dynamic_cast(Sim::findObject(mNames_on_server[i])); if (!obj) { //Con::printf("CONSTRAINT-OBJECT %s does not exist.", names_on_server[i]); @@ -1219,13 +1219,13 @@ void afxConstraintMgr::unpackConstraintNames(BitStream* stream) { if (stream->readFlag()) //-- ANY NAMED CONS_BY_ID? { - names_on_server.clear(); + mNames_on_server.clear(); S32 sz; stream->read(&sz); for (S32 i = 0; i < sz; i++) { - names_on_server.push_back(stream->readSTString()); + mNames_on_server.push_back(stream->readSTString()); S32 ghost_id; stream->read(&ghost_id); - ghost_ids.push_back(ghost_id); + mGhost_ids.push_back(ghost_id); } } } @@ -1234,17 +1234,17 @@ void afxConstraintMgr::unpackConstraintNames(BitStream* stream) SceneObject* afxConstraintMgr::find_object_from_name(StringTableEntry name) { - if (names_on_server.size() > 0) + if (mNames_on_server.size() > 0) { - for (S32 i = 0; i < names_on_server.size(); i++) - if (names_on_server[i] == name) + for (S32 i = 0; i < mNames_on_server.size(); i++) + if (mNames_on_server[i] == name) { - if (ghost_ids[i] == -1) + if (mGhost_ids[i] == -1) return 0; NetConnection* conn = NetConnection::getConnectionToServer(); if (!conn) return 0; - return dynamic_cast(conn->resolveGhost(ghost_ids[i])); + return dynamic_cast(conn->resolveGhost(mGhost_ids[i])); } } @@ -1283,7 +1283,7 @@ void afxConstraintMgr::clearAllScopeableObjs() void afxConstraintMgr::postMissingConstraintObject(afxConstraint* cons, bool is_deleting) { - if (cons->gone_missing) + if (cons->mGone_missing) return; if (!is_deleting) @@ -1296,7 +1296,7 @@ void afxConstraintMgr::postMissingConstraintObject(afxConstraint* cons, bool is_ } } - cons->gone_missing = true; + cons->mGone_missing = true; missing_objs->push_back(cons); } @@ -1306,7 +1306,7 @@ void afxConstraintMgr::restoreScopedObject(SceneObject* obj, afxChoreographer* c { if ((*missing_objs)[i]->getScopeId() == obj->getScopeId()) { - (*missing_objs)[i]->gone_missing = false; + (*missing_objs)[i]->mGone_missing = false; (*missing_objs)[i]->restoreObject(obj); if (ch) ch->restoreObject(obj); @@ -1329,9 +1329,9 @@ void afxConstraintMgr::adjustProcessOrdering(afxChoreographer* ch) cons_sources.push_back(ch); // collect all the ProcessObject related constraint sources - for (S32 i = 0; i < constraints_v.size(); i++) + for (S32 i = 0; i < mConstraints_v.size(); i++) { - afxConstraintList* list = constraints_v[i]; + afxConstraintList* list = mConstraints_v[i]; afxConstraint* cons = (*list)[0]; if (cons) { @@ -1375,8 +1375,8 @@ void afxConstraintMgr::adjustProcessOrdering(afxChoreographer* ch) afxPointConstraint::afxPointConstraint(afxConstraintMgr* mgr) : afxConstraint(mgr) { - point.zero(); - vector.set(0,0,1); + mPoint.zero(); + mVector.set(0,0,1); } afxPointConstraint::~afxPointConstraint() @@ -1385,11 +1385,11 @@ afxPointConstraint::~afxPointConstraint() void afxPointConstraint::set(Point3F point, Point3F vector) { - this->point = point; - this->vector = vector; - is_defined = true; - is_valid = true; - change_code++; + mPoint = point; + mVector = vector; + mIs_defined = true; + mIs_valid = true; + mChange_code++; sample(0.0f, 0, 0); } @@ -1397,19 +1397,19 @@ void afxPointConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) { if (cam_pos) { - Point3F dir = (*cam_pos) - point; + Point3F dir = (*cam_pos) - mPoint; F32 dist_sq = dir.lenSquared(); - if (dist_sq > mgr->getScopingDistanceSquared()) + if (dist_sq > mMgr->getScopingDistanceSquared()) { - is_valid = false; + mIs_valid = false; return; } - is_valid = true; + mIs_valid = true; } - last_pos = point; - last_xfm.identity(); - last_xfm.setPosition(point); + mLast_pos = mPoint; + mLast_xfm.identity(); + mLast_xfm.setPosition(mPoint); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -1428,9 +1428,9 @@ afxTransformConstraint::~afxTransformConstraint() void afxTransformConstraint::set(const MatrixF& xfm) { mXfm = xfm; - is_defined = true; - is_valid = true; - change_code++; + mIs_defined = true; + mIs_valid = true; + mChange_code++; sample(0.0f, 0, 0); } @@ -1440,16 +1440,16 @@ void afxTransformConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_p { Point3F dir = (*cam_pos) - mXfm.getPosition(); F32 dist_sq = dir.lenSquared(); - if (dist_sq > mgr->getScopingDistanceSquared()) + if (dist_sq > mMgr->getScopingDistanceSquared()) { - is_valid = false; + mIs_valid = false; return; } - is_valid = true; + mIs_valid = true; } - last_xfm = mXfm; - last_pos = mXfm.getPosition(); + mLast_xfm = mXfm; + mLast_pos = mXfm.getPosition(); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -1458,115 +1458,115 @@ void afxTransformConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_p afxShapeConstraint::afxShapeConstraint(afxConstraintMgr* mgr) : afxConstraint(mgr) { - arb_name = ST_NULLSTRING; - shape = 0; - scope_id = 0; - clip_tag = 0; - lock_tag = 0; + mArb_name = ST_NULLSTRING; + mShape = 0; + mScope_id = 0; + mClip_tag = 0; + mLock_tag = 0; } afxShapeConstraint::afxShapeConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name) : afxConstraint(mgr) { - this->arb_name = arb_name; - shape = 0; - scope_id = 0; - clip_tag = 0; - lock_tag = 0; + mArb_name = arb_name; + mShape = 0; + mScope_id = 0; + mClip_tag = 0; + mLock_tag = 0; } afxShapeConstraint::~afxShapeConstraint() { - if (shape) - clearNotify(shape); + if (mShape) + clearNotify(mShape); } void afxShapeConstraint::set(ShapeBase* shape) { - if (this->shape) + if (mShape) { - scope_id = 0; - clearNotify(this->shape); - if (clip_tag > 0) - remapAnimation(clip_tag, shape); - if (lock_tag > 0) - unlockAnimation(lock_tag); + mScope_id = 0; + clearNotify(mShape); + if (mClip_tag > 0) + remapAnimation(mClip_tag, shape); + if (mLock_tag > 0) + unlockAnimation(mLock_tag); } - this->shape = shape; + mShape = shape; - if (this->shape) + if (mShape) { - deleteNotify(this->shape); - scope_id = this->shape->getScopeId(); + deleteNotify(mShape); + mScope_id = mShape->getScopeId(); } - if (this->shape != NULL) + if (mShape != NULL) { - is_defined = true; - is_valid = true; - change_code++; + mIs_defined = true; + mIs_valid = true; + mChange_code++; sample(0.0f, 0, 0); } else - is_valid = false; + mIs_valid = false; } void afxShapeConstraint::set_scope_id(U16 scope_id) { - if (shape) - clearNotify(shape); + if (mShape) + clearNotify(mShape); - shape = 0; - this->scope_id = scope_id; + mShape = 0; + mScope_id = scope_id; - is_defined = (this->scope_id > 0); - is_valid = false; - mgr->postMissingConstraintObject(this); + mIs_defined = (mScope_id > 0); + mIs_valid = false; + mMgr->postMissingConstraintObject(this); } void afxShapeConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) { - if (gone_missing) + if (mGone_missing) return; - if (shape) + if (mShape) { - last_xfm = shape->getRenderTransform(); - if (cons_def.mPos_at_box_center) - last_pos = shape->getBoxCenter(); + mLast_xfm = mShape->getRenderTransform(); + if (mCons_def.mPos_at_box_center) + mLast_pos = mShape->getBoxCenter(); else - last_pos = shape->getRenderPosition(); + mLast_pos = mShape->getRenderPosition(); } } void afxShapeConstraint::restoreObject(SceneObject* obj) { - if (this->shape) + if (mShape) { - scope_id = 0; - clearNotify(this->shape); + mScope_id = 0; + clearNotify(mShape); } - this->shape = (ShapeBase* )obj; + mShape = (ShapeBase* )obj; - if (this->shape) + if (mShape) { - deleteNotify(this->shape); - scope_id = this->shape->getScopeId(); + deleteNotify(mShape); + mScope_id = mShape->getScopeId(); } - is_valid = (this->shape != NULL); + mIs_valid = (mShape != NULL); } void afxShapeConstraint::onDeleteNotify(SimObject* obj) { - if (shape == dynamic_cast(obj)) + if (mShape == dynamic_cast(obj)) { - shape = 0; - is_valid = false; - if (scope_id > 0) - mgr->postMissingConstraintObject(this, true); + mShape = 0; + mIs_valid = false; + if (mScope_id > 0) + mMgr->postMissingConstraintObject(this, true); } Parent::onDeleteNotify(obj); @@ -1574,12 +1574,12 @@ void afxShapeConstraint::onDeleteNotify(SimObject* obj) U32 afxShapeConstraint::setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans, bool is_death_anim) { - if (!shape) + if (!mShape) return 0; - if (shape->isServerObject()) + if (mShape->isServerObject()) { - AIPlayer* ai_player = dynamic_cast(shape); + AIPlayer* ai_player = dynamic_cast(mShape); if (ai_player && !ai_player->isBlendAnimation(clip)) { ai_player->saveMoveState(); @@ -1587,16 +1587,16 @@ U32 afxShapeConstraint::setAnimClip(const char* clip, F32 pos, F32 rate, F32 tra } } - clip_tag = shape->playAnimation(clip, pos, rate, trans, false/*hold*/, true/*wait*/, is_death_anim); - return clip_tag; + mClip_tag = mShape->playAnimation(clip, pos, rate, trans, false/*hold*/, true/*wait*/, is_death_anim); + return mClip_tag; } void afxShapeConstraint::remapAnimation(U32 tag, ShapeBase* other_shape) { - if (clip_tag == 0) + if (mClip_tag == 0) return; - if (!shape) + if (!mShape) return; if (!other_shape) @@ -1605,83 +1605,83 @@ void afxShapeConstraint::remapAnimation(U32 tag, ShapeBase* other_shape) return; } - Con::errorf("remapAnimation -- Clip name, %s.", shape->getLastClipName(tag)); + Con::errorf("remapAnimation -- Clip name, %s.", mShape->getLastClipName(tag)); - if (shape->isClientObject()) + if (mShape->isClientObject()) { - shape->restoreAnimation(tag); + mShape->restoreAnimation(tag); } else { - AIPlayer* ai_player = dynamic_cast(shape); + AIPlayer* ai_player = dynamic_cast(mShape); if (ai_player) ai_player->restartMove(tag); else - shape->restoreAnimation(tag); + mShape->restoreAnimation(tag); } - clip_tag = 0; + mClip_tag = 0; } void afxShapeConstraint::resetAnimation(U32 tag) { - if (clip_tag == 0) + if (mClip_tag == 0) return; - if (!shape) + if (!mShape) return; - if (shape->isClientObject()) + if (mShape->isClientObject()) { - shape->restoreAnimation(tag); + mShape->restoreAnimation(tag); } else { - AIPlayer* ai_player = dynamic_cast(shape); + AIPlayer* ai_player = dynamic_cast(mShape); if (ai_player) ai_player->restartMove(tag); else - shape->restoreAnimation(tag); + mShape->restoreAnimation(tag); } - if ((tag & 0x80000000) == 0 && tag == clip_tag) - clip_tag = 0; + if ((tag & 0x80000000) == 0 && tag == mClip_tag) + mClip_tag = 0; } U32 afxShapeConstraint::lockAnimation() { - if (!shape) + if (!mShape) return 0; - lock_tag = shape->lockAnimation(); - return lock_tag; + mLock_tag = mShape->lockAnimation(); + return mLock_tag; } void afxShapeConstraint::unlockAnimation(U32 tag) { - if (lock_tag == 0) + if (mLock_tag == 0) return; - if (!shape) + if (!mShape) return; - shape->unlockAnimation(tag); - lock_tag = 0; + mShape->unlockAnimation(tag); + mLock_tag = 0; } F32 afxShapeConstraint::getAnimClipDuration(const char* clip) { - return (shape) ? shape->getAnimationDuration(clip) : 0.0f; + return (mShape) ? mShape->getAnimationDuration(clip) : 0.0f; } S32 afxShapeConstraint::getDamageState() { - return (shape) ? shape->getDamageState() : -1; + return (mShape) ? mShape->getDamageState() : -1; } U32 afxShapeConstraint::getTriggers() { - return (shape) ? shape->getShapeInstance()->getTriggerStateMask() : 0; + return (mShape) ? mShape->getShapeInstance()->getTriggerStateMask() : 0; } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -1690,45 +1690,45 @@ U32 afxShapeConstraint::getTriggers() afxShapeNodeConstraint::afxShapeNodeConstraint(afxConstraintMgr* mgr) : afxShapeConstraint(mgr) { - arb_node = ST_NULLSTRING; - shape_node_ID = -1; + mArb_node = ST_NULLSTRING; + mShape_node_ID = -1; } afxShapeNodeConstraint::afxShapeNodeConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name, StringTableEntry arb_node) : afxShapeConstraint(mgr, arb_name) { - this->arb_node = arb_node; - shape_node_ID = -1; + mArb_node = arb_node; + mShape_node_ID = -1; } void afxShapeNodeConstraint::set(ShapeBase* shape) { if (shape) { - shape_node_ID = shape->getShape()->findNode(arb_node); - if (shape_node_ID == -1) - Con::errorf("Failed to find node [%s]", arb_node); + mShape_node_ID = shape->getShape()->findNode(mArb_node); + if (mShape_node_ID == -1) + Con::errorf("Failed to find node [%s]", mArb_node); } else - shape_node_ID = -1; + mShape_node_ID = -1; Parent::set(shape); } void afxShapeNodeConstraint::set_scope_id(U16 scope_id) { - shape_node_ID = -1; + mShape_node_ID = -1; Parent::set_scope_id(scope_id); } void afxShapeNodeConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) { - if (shape && shape_node_ID != -1) + if (mShape && mShape_node_ID != -1) { - last_xfm = shape->getRenderTransform(); - last_xfm.scale(shape->getScale()); - last_xfm.mul(shape->getShapeInstance()->mNodeTransforms[shape_node_ID]); - last_pos = last_xfm.getPosition(); + mLast_xfm = mShape->getRenderTransform(); + mLast_xfm.scale(mShape->getScale()); + mLast_xfm.mul(mShape->getShapeInstance()->mNodeTransforms[mShape_node_ID]); + mLast_pos = mLast_xfm.getPosition(); } } @@ -1737,12 +1737,12 @@ void afxShapeNodeConstraint::restoreObject(SceneObject* obj) ShapeBase* shape = dynamic_cast(obj); if (shape) { - shape_node_ID = shape->getShape()->findNode(arb_node); - if (shape_node_ID == -1) - Con::errorf("Failed to find node [%s]", arb_node); + mShape_node_ID = shape->getShape()->findNode(mArb_node); + if (mShape_node_ID == -1) + Con::errorf("Failed to find node [%s]", mArb_node); } else - shape_node_ID = -1; + mShape_node_ID = -1; Parent::restoreObject(obj); } @@ -1757,7 +1757,7 @@ void afxShapeNodeConstraint::onDeleteNotify(SimObject* obj) afxObjectConstraint::afxObjectConstraint(afxConstraintMgr* mgr) : afxConstraint(mgr) { - mArb_name = ST_NULLSTRING; + mArb_name = ST_NULLSTRING; mObj = 0; mScope_id = 0; mIs_camera = false; @@ -1798,13 +1798,13 @@ void afxObjectConstraint::set(SceneObject* obj) { mIs_camera = mObj->isCamera(); - is_defined = true; - is_valid = true; - change_code++; + mIs_defined = true; + mIs_valid = true; + mChange_code++; sample(0.0f, 0, 0); } else - is_valid = false; + mIs_valid = false; } void afxObjectConstraint::set_scope_id(U16 scope_id) @@ -1815,32 +1815,32 @@ void afxObjectConstraint::set_scope_id(U16 scope_id) mObj = 0; mScope_id = scope_id; - is_defined = (scope_id > 0); - is_valid = false; - mgr->postMissingConstraintObject(this); + mIs_defined = (scope_id > 0); + mIs_valid = false; + mMgr->postMissingConstraintObject(this); } void afxObjectConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos) { - if (gone_missing) + if (mGone_missing) return; if (mObj) { - if (!mIs_camera && cons_def.mTreat_as_camera && dynamic_cast(mObj)) + if (!mIs_camera && mCons_def.mTreat_as_camera && dynamic_cast(mObj)) { ShapeBase* cam_obj = (ShapeBase*) mObj; F32 pov = 1.0f; - cam_obj->getCameraTransform(&pov, &last_xfm); - last_xfm.getColumn(3, &last_pos); + cam_obj->getCameraTransform(&pov, &mLast_xfm); + mLast_xfm.getColumn(3, &mLast_pos); } else { - last_xfm = mObj->getRenderTransform(); - if (cons_def.mPos_at_box_center) - last_pos = mObj->getBoxCenter(); + mLast_xfm = mObj->getRenderTransform(); + if (mCons_def.mPos_at_box_center) + mLast_pos = mObj->getBoxCenter(); else - last_pos = mObj->getRenderPosition(); + mLast_pos = mObj->getRenderPosition(); } } } @@ -1861,7 +1861,7 @@ void afxObjectConstraint::restoreObject(SceneObject* obj) mScope_id = mObj->getScopeId(); } - is_valid = (mObj != NULL); + mIs_valid = (mObj != NULL); } void afxObjectConstraint::onDeleteNotify(SimObject* obj) @@ -1869,9 +1869,9 @@ void afxObjectConstraint::onDeleteNotify(SimObject* obj) if (mObj == dynamic_cast(obj)) { mObj = 0; - is_valid = false; + mIs_valid = false; if (mScope_id > 0) - mgr->postMissingConstraintObject(this, true); + mMgr->postMissingConstraintObject(this, true); } Parent::onDeleteNotify(obj); @@ -1902,15 +1902,15 @@ U32 afxObjectConstraint::getTriggers() afxEffectConstraint::afxEffectConstraint(afxConstraintMgr* mgr) : afxConstraint(mgr) { - effect_name = ST_NULLSTRING; - effect = 0; + mEffect_name = ST_NULLSTRING; + mEffect = 0; } afxEffectConstraint::afxEffectConstraint(afxConstraintMgr* mgr, StringTableEntry effect_name) : afxConstraint(mgr) { - this->effect_name = effect_name; - effect = 0; + mEffect_name = effect_name; + mEffect = 0; } afxEffectConstraint::~afxEffectConstraint() @@ -1919,68 +1919,68 @@ afxEffectConstraint::~afxEffectConstraint() bool afxEffectConstraint::getPosition(Point3F& pos, F32 hist) { - if (!effect || !effect->inScope()) + if (!mEffect || !mEffect->inScope()) return false; - if (cons_def.mPos_at_box_center) - effect->getUpdatedBoxCenter(pos); + if (mCons_def.mPos_at_box_center) + mEffect->getUpdatedBoxCenter(pos); else - effect->getUpdatedPosition(pos); + mEffect->getUpdatedPosition(pos); return true; } bool afxEffectConstraint::getTransform(MatrixF& xfm, F32 hist) { - if (!effect || !effect->inScope()) + if (!mEffect || !mEffect->inScope()) return false; - effect->getUpdatedTransform(xfm); + mEffect->getUpdatedTransform(xfm); return true; } bool afxEffectConstraint::getAltitudes(F32& terrain_alt, F32& interior_alt) { - if (!effect) + if (!mEffect) return false; - effect->getAltitudes(terrain_alt, interior_alt); + mEffect->getAltitudes(terrain_alt, interior_alt); return true; } void afxEffectConstraint::set(afxEffectWrapper* effect) { - this->effect = effect; + mEffect = effect; - if (this->effect != NULL) + if (mEffect != NULL) { - is_defined = true; - is_valid = true; - change_code++; + mIs_defined = true; + mIs_valid = true; + mChange_code++; } else - is_valid = false; + mIs_valid = false; } U32 afxEffectConstraint::setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans, bool is_death_anim) { - return (effect) ? effect->setAnimClip(clip, pos, rate, trans) : 0; + return (mEffect) ? mEffect->setAnimClip(clip, pos, rate, trans) : 0; } void afxEffectConstraint::resetAnimation(U32 tag) { - if (effect) - effect->resetAnimation(tag); + if (mEffect) + mEffect->resetAnimation(tag); } F32 afxEffectConstraint::getAnimClipDuration(const char* clip) { - return (effect) ? getAnimClipDuration(clip) : 0; + return (mEffect) ? getAnimClipDuration(clip) : 0; } U32 afxEffectConstraint::getTriggers() { - return (effect) ? effect->getTriggers() : 0; + return (mEffect) ? mEffect->getTriggers() : 0; } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -1989,47 +1989,47 @@ U32 afxEffectConstraint::getTriggers() afxEffectNodeConstraint::afxEffectNodeConstraint(afxConstraintMgr* mgr) : afxEffectConstraint(mgr) { - effect_node = ST_NULLSTRING; - effect_node_ID = -1; + mEffect_node = ST_NULLSTRING; + mEffect_node_ID = -1; } afxEffectNodeConstraint::afxEffectNodeConstraint(afxConstraintMgr* mgr, StringTableEntry name, StringTableEntry node) : afxEffectConstraint(mgr, name) { - this->effect_node = node; - effect_node_ID = -1; + mEffect_node = node; + mEffect_node_ID = -1; } bool afxEffectNodeConstraint::getPosition(Point3F& pos, F32 hist) { - if (!effect || !effect->inScope()) + if (!mEffect || !mEffect->inScope()) return false; - TSShapeInstance* ts_shape_inst = effect->getTSShapeInstance(); + TSShapeInstance* ts_shape_inst = mEffect->getTSShapeInstance(); if (!ts_shape_inst) return false; - if (effect_node_ID == -1) + if (mEffect_node_ID == -1) { - TSShape* ts_shape = effect->getTSShape(); - effect_node_ID = (ts_shape) ? ts_shape->findNode(effect_node) : -1; + TSShape* ts_shape = mEffect->getTSShape(); + mEffect_node_ID = (ts_shape) ? ts_shape->findNode(mEffect_node) : -1; } - if (effect_node_ID == -1) + if (mEffect_node_ID == -1) return false; - effect->getUpdatedTransform(last_xfm); + mEffect->getUpdatedTransform(mLast_xfm); Point3F scale; - effect->getUpdatedScale(scale); + mEffect->getUpdatedScale(scale); - MatrixF gag = ts_shape_inst->mNodeTransforms[effect_node_ID]; + MatrixF gag = ts_shape_inst->mNodeTransforms[mEffect_node_ID]; gag.setPosition( gag.getPosition()*scale ); MatrixF xfm; - xfm.mul(last_xfm, gag); + xfm.mul(mLast_xfm, gag); // pos = xfm.getPosition(); @@ -2038,31 +2038,31 @@ bool afxEffectNodeConstraint::getPosition(Point3F& pos, F32 hist) bool afxEffectNodeConstraint::getTransform(MatrixF& xfm, F32 hist) { - if (!effect || !effect->inScope()) + if (!mEffect || !mEffect->inScope()) return false; - TSShapeInstance* ts_shape_inst = effect->getTSShapeInstance(); + TSShapeInstance* ts_shape_inst = mEffect->getTSShapeInstance(); if (!ts_shape_inst) return false; - if (effect_node_ID == -1) + if (mEffect_node_ID == -1) { - TSShape* ts_shape = effect->getTSShape(); - effect_node_ID = (ts_shape) ? ts_shape->findNode(effect_node) : -1; + TSShape* ts_shape = mEffect->getTSShape(); + mEffect_node_ID = (ts_shape) ? ts_shape->findNode(mEffect_node) : -1; } - if (effect_node_ID == -1) + if (mEffect_node_ID == -1) return false; - effect->getUpdatedTransform(last_xfm); + mEffect->getUpdatedTransform(mLast_xfm); Point3F scale; - effect->getUpdatedScale(scale); + mEffect->getUpdatedScale(scale); - MatrixF gag = ts_shape_inst->mNodeTransforms[effect_node_ID]; + MatrixF gag = ts_shape_inst->mNodeTransforms[mEffect_node_ID]; gag.setPosition( gag.getPosition()*scale ); - xfm.mul(last_xfm, gag); + xfm.mul(mLast_xfm, gag); return true; } @@ -2072,10 +2072,10 @@ void afxEffectNodeConstraint::set(afxEffectWrapper* effect) if (effect) { TSShape* ts_shape = effect->getTSShape(); - effect_node_ID = (ts_shape) ? ts_shape->findNode(effect_node) : -1; + mEffect_node_ID = (ts_shape) ? ts_shape->findNode(mEffect_node) : -1; } else - effect_node_ID = -1; + mEffect_node_ID = -1; Parent::set(effect); } @@ -2085,13 +2085,13 @@ void afxEffectNodeConstraint::set(afxEffectWrapper* effect) afxSampleBuffer::afxSampleBuffer() { - buffer_sz = 0; - buffer_ms = 0; - ms_per_sample = 33; - elapsed_ms = 0; - last_sample_ms = 0; - next_sample_num = 0; - n_samples = 0; + mBuffer_sz = 0; + mBuffer_ms = 0; + mMS_per_sample = 33; + mElapsed_ms = 0; + mLast_sample_ms = 0; + mNext_sample_num = 0; + mNum_samples = 0; } afxSampleBuffer::~afxSampleBuffer() @@ -2100,27 +2100,27 @@ afxSampleBuffer::~afxSampleBuffer() void afxSampleBuffer::configHistory(F32 hist_len, U8 sample_rate) { - buffer_sz = mCeil(hist_len*sample_rate) + 1; - ms_per_sample = mCeil(1000.0f/sample_rate); - buffer_ms = buffer_sz*ms_per_sample; + mBuffer_sz = mCeil(hist_len*sample_rate) + 1; + mMS_per_sample = mCeil(1000.0f/sample_rate); + mBuffer_ms = mBuffer_sz*mMS_per_sample; } void afxSampleBuffer::recordSample(F32 dt, U32 elapsed_ms, void* data) { - this->elapsed_ms = elapsed_ms; + mElapsed_ms = elapsed_ms; if (!data) return; - U32 now_sample_num = elapsed_ms/ms_per_sample; - if (next_sample_num <= now_sample_num) + U32 now_sample_num = elapsed_ms/mMS_per_sample; + if (mNext_sample_num <= now_sample_num) { - last_sample_ms = elapsed_ms; - while (next_sample_num <= now_sample_num) + mLast_sample_ms = elapsed_ms; + while (mNext_sample_num <= now_sample_num) { - recSample(next_sample_num % buffer_sz, data); - next_sample_num++; - n_samples++; + recSample(mNext_sample_num % mBuffer_sz, data); + mNext_sample_num++; + mNum_samples++; } } } @@ -2130,7 +2130,7 @@ inline bool afxSampleBuffer::compute_idx_from_lag(F32 lag, U32& idx) bool in_bounds = true; U32 lag_ms = lag*1000.0f; - U32 rec_ms = (elapsed_ms < buffer_ms) ? elapsed_ms : buffer_ms; + U32 rec_ms = (mElapsed_ms < mBuffer_ms) ? mElapsed_ms : mBuffer_ms; if (lag_ms > rec_ms) { // hasn't produced enough history @@ -2138,8 +2138,8 @@ inline bool afxSampleBuffer::compute_idx_from_lag(F32 lag, U32& idx) in_bounds = false; } - U32 latest_sample_num = last_sample_ms/ms_per_sample; - U32 then_sample_num = (elapsed_ms - lag_ms)/ms_per_sample; + U32 latest_sample_num = mLast_sample_ms/mMS_per_sample; + U32 then_sample_num = (mElapsed_ms - lag_ms)/mMS_per_sample; if (then_sample_num > latest_sample_num) { @@ -2148,7 +2148,7 @@ inline bool afxSampleBuffer::compute_idx_from_lag(F32 lag, U32& idx) in_bounds = false; } - idx = then_sample_num % buffer_sz; + idx = then_sample_num % mBuffer_sz; return in_bounds; } @@ -2157,7 +2157,7 @@ inline bool afxSampleBuffer::compute_idx_from_lag(F32 lag, U32& idx1, U32& idx2, bool in_bounds = true; F32 lag_ms = lag*1000.0f; - F32 rec_ms = (elapsed_ms < buffer_ms) ? elapsed_ms : buffer_ms; + F32 rec_ms = (mElapsed_ms < mBuffer_ms) ? mElapsed_ms : mBuffer_ms; if (lag_ms > rec_ms) { // hasn't produced enough history @@ -2165,9 +2165,9 @@ inline bool afxSampleBuffer::compute_idx_from_lag(F32 lag, U32& idx1, U32& idx2, in_bounds = false; } - F32 per_samp = ms_per_sample; - F32 latest_sample_num = last_sample_ms/per_samp; - F32 then_sample_num = (elapsed_ms - lag_ms)/per_samp; + F32 per_samp = mMS_per_sample; + F32 latest_sample_num = mLast_sample_ms/per_samp; + F32 then_sample_num = (mElapsed_ms - lag_ms)/per_samp; U32 latest_sample_num_i = latest_sample_num; U32 then_sample_num_i = then_sample_num; @@ -2177,14 +2177,14 @@ inline bool afxSampleBuffer::compute_idx_from_lag(F32 lag, U32& idx1, U32& idx2, if (latest_sample_num_i < then_sample_num_i) in_bounds = false; t = 0.0; - idx1 = then_sample_num_i % buffer_sz; + idx1 = then_sample_num_i % mBuffer_sz; idx2 = idx1; } else { t = then_sample_num - then_sample_num_i; - idx1 = then_sample_num_i % buffer_sz; - idx2 = (then_sample_num_i+1) % buffer_sz; + idx1 = then_sample_num_i % mBuffer_sz; + idx2 = (then_sample_num_i+1) % mBuffer_sz; } return in_bounds; @@ -2195,27 +2195,27 @@ inline bool afxSampleBuffer::compute_idx_from_lag(F32 lag, U32& idx1, U32& idx2, afxSampleXfmBuffer::afxSampleXfmBuffer() { - xfm_buffer = 0; + mXfm_buffer = 0; } afxSampleXfmBuffer::~afxSampleXfmBuffer() { - delete [] xfm_buffer; + delete [] mXfm_buffer; } void afxSampleXfmBuffer::configHistory(F32 hist_len, U8 sample_rate) { - if (!xfm_buffer) + if (!mXfm_buffer) { afxSampleBuffer::configHistory(hist_len, sample_rate); - if (buffer_sz > 0) - xfm_buffer = new MatrixF[buffer_sz]; + if (mBuffer_sz > 0) + mXfm_buffer = new MatrixF[mBuffer_sz]; } } void afxSampleXfmBuffer::recSample(U32 idx, void* data) { - xfm_buffer[idx] = *((MatrixF*)data); + mXfm_buffer[idx] = *((MatrixF*)data); } void afxSampleXfmBuffer::getSample(F32 lag, void* data, bool& in_bounds) @@ -2226,13 +2226,13 @@ void afxSampleXfmBuffer::getSample(F32 lag, void* data, bool& in_bounds) if (idx1 == idx2) { - MatrixF* m1 = &xfm_buffer[idx1]; + MatrixF* m1 = &mXfm_buffer[idx1]; *((MatrixF*)data) = *m1; } else { - MatrixF* m1 = &xfm_buffer[idx1]; - MatrixF* m2 = &xfm_buffer[idx2]; + MatrixF* m1 = &mXfm_buffer[idx1]; + MatrixF* m2 = &mXfm_buffer[idx2]; Point3F p1 = m1->getPosition(); Point3F p2 = m2->getPosition(); @@ -2253,20 +2253,20 @@ void afxSampleXfmBuffer::getSample(F32 lag, void* data, bool& in_bounds) afxPointHistConstraint::afxPointHistConstraint(afxConstraintMgr* mgr) : afxPointConstraint(mgr) { - samples = 0; + mSamples = 0; } afxPointHistConstraint::~afxPointHistConstraint() { - delete samples; + delete mSamples; } void afxPointHistConstraint::set(Point3F point, Point3F vector) { - if (!samples) + if (!mSamples) { - samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); + mSamples = new afxSampleXfmBuffer; + mSamples->configHistory(mCons_def.mHistory_time, mCons_def.mSample_rate); } Parent::set(point, vector); @@ -2279,9 +2279,9 @@ void afxPointHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_p if (isDefined()) { if (isValid()) - samples->recordSample(dt, elapsed_ms, &last_xfm); + mSamples->recordSample(dt, elapsed_ms, &mLast_xfm); else - samples->recordSample(dt, elapsed_ms, 0); + mSamples->recordSample(dt, elapsed_ms, 0); } } @@ -2290,7 +2290,7 @@ bool afxPointHistConstraint::getPosition(Point3F& pos, F32 hist) bool in_bounds; MatrixF xfm; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); pos = xfm.getPosition(); @@ -2301,7 +2301,7 @@ bool afxPointHistConstraint::getTransform(MatrixF& xfm, F32 hist) { bool in_bounds; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); return in_bounds; } @@ -2312,20 +2312,20 @@ bool afxPointHistConstraint::getTransform(MatrixF& xfm, F32 hist) afxTransformHistConstraint::afxTransformHistConstraint(afxConstraintMgr* mgr) : afxTransformConstraint(mgr) { - samples = 0; + mSamples = 0; } afxTransformHistConstraint::~afxTransformHistConstraint() { - delete samples; + delete mSamples; } void afxTransformHistConstraint::set(const MatrixF& xfm) { - if (!samples) + if (!mSamples) { - samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); + mSamples = new afxSampleXfmBuffer; + mSamples->configHistory(mCons_def.mHistory_time, mCons_def.mSample_rate); } Parent::set(xfm); @@ -2338,9 +2338,9 @@ void afxTransformHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* c if (isDefined()) { if (isValid()) - samples->recordSample(dt, elapsed_ms, &last_xfm); + mSamples->recordSample(dt, elapsed_ms, &mLast_xfm); else - samples->recordSample(dt, elapsed_ms, 0); + mSamples->recordSample(dt, elapsed_ms, 0); } } @@ -2349,7 +2349,7 @@ bool afxTransformHistConstraint::getPosition(Point3F& pos, F32 hist) bool in_bounds; MatrixF xfm; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); pos = xfm.getPosition(); @@ -2360,7 +2360,7 @@ bool afxTransformHistConstraint::getTransform(MatrixF& xfm, F32 hist) { bool in_bounds; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); return in_bounds; } @@ -2371,26 +2371,26 @@ bool afxTransformHistConstraint::getTransform(MatrixF& xfm, F32 hist) afxShapeHistConstraint::afxShapeHistConstraint(afxConstraintMgr* mgr) : afxShapeConstraint(mgr) { - samples = 0; + mSamples = 0; } afxShapeHistConstraint::afxShapeHistConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name) : afxShapeConstraint(mgr, arb_name) { - samples = 0; + mSamples = 0; } afxShapeHistConstraint::~afxShapeHistConstraint() { - delete samples; + delete mSamples; } void afxShapeHistConstraint::set(ShapeBase* shape) { - if (shape && !samples) + if (shape && !mSamples) { - samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); + mSamples = new afxSampleXfmBuffer; + mSamples->configHistory(mCons_def.mHistory_time, mCons_def.mSample_rate); } Parent::set(shape); @@ -2398,10 +2398,10 @@ void afxShapeHistConstraint::set(ShapeBase* shape) void afxShapeHistConstraint::set_scope_id(U16 scope_id) { - if (scope_id > 0 && !samples) + if (scope_id > 0 && !mSamples) { - samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); + mSamples = new afxSampleXfmBuffer; + mSamples->configHistory(mCons_def.mHistory_time, mCons_def.mSample_rate); } Parent::set_scope_id(scope_id); @@ -2414,9 +2414,9 @@ void afxShapeHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_p if (isDefined()) { if (isValid()) - samples->recordSample(dt, elapsed_ms, &last_xfm); + mSamples->recordSample(dt, elapsed_ms, &mLast_xfm); else - samples->recordSample(dt, elapsed_ms, 0); + mSamples->recordSample(dt, elapsed_ms, 0); } } @@ -2425,7 +2425,7 @@ bool afxShapeHistConstraint::getPosition(Point3F& pos, F32 hist) bool in_bounds; MatrixF xfm; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); pos = xfm.getPosition(); @@ -2436,7 +2436,7 @@ bool afxShapeHistConstraint::getTransform(MatrixF& xfm, F32 hist) { bool in_bounds; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); return in_bounds; } @@ -2452,27 +2452,27 @@ void afxShapeHistConstraint::onDeleteNotify(SimObject* obj) afxShapeNodeHistConstraint::afxShapeNodeHistConstraint(afxConstraintMgr* mgr) : afxShapeNodeConstraint(mgr) { - samples = 0; + mSamples = 0; } afxShapeNodeHistConstraint::afxShapeNodeHistConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name, StringTableEntry arb_node) : afxShapeNodeConstraint(mgr, arb_name, arb_node) { - samples = 0; + mSamples = 0; } afxShapeNodeHistConstraint::~afxShapeNodeHistConstraint() { - delete samples; + delete mSamples; } void afxShapeNodeHistConstraint::set(ShapeBase* shape) { - if (shape && !samples) + if (shape && !mSamples) { - samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); + mSamples = new afxSampleXfmBuffer; + mSamples->configHistory(mCons_def.mHistory_time, mCons_def.mSample_rate); } Parent::set(shape); @@ -2480,10 +2480,10 @@ void afxShapeNodeHistConstraint::set(ShapeBase* shape) void afxShapeNodeHistConstraint::set_scope_id(U16 scope_id) { - if (scope_id > 0 && !samples) + if (scope_id > 0 && !mSamples) { - samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); + mSamples = new afxSampleXfmBuffer; + mSamples->configHistory(mCons_def.mHistory_time, mCons_def.mSample_rate); } Parent::set_scope_id(scope_id); @@ -2496,9 +2496,9 @@ void afxShapeNodeHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* c if (isDefined()) { if (isValid()) - samples->recordSample(dt, elapsed_ms, &last_xfm); + mSamples->recordSample(dt, elapsed_ms, &mLast_xfm); else - samples->recordSample(dt, elapsed_ms, 0); + mSamples->recordSample(dt, elapsed_ms, 0); } } @@ -2507,7 +2507,7 @@ bool afxShapeNodeHistConstraint::getPosition(Point3F& pos, F32 hist) bool in_bounds; MatrixF xfm; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); pos = xfm.getPosition(); @@ -2518,7 +2518,7 @@ bool afxShapeNodeHistConstraint::getTransform(MatrixF& xfm, F32 hist) { bool in_bounds; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); return in_bounds; } @@ -2534,26 +2534,26 @@ void afxShapeNodeHistConstraint::onDeleteNotify(SimObject* obj) afxObjectHistConstraint::afxObjectHistConstraint(afxConstraintMgr* mgr) : afxObjectConstraint(mgr) { - samples = 0; + mSamples = 0; } afxObjectHistConstraint::afxObjectHistConstraint(afxConstraintMgr* mgr, StringTableEntry arb_name) : afxObjectConstraint(mgr, arb_name) { - samples = 0; + mSamples = 0; } afxObjectHistConstraint::~afxObjectHistConstraint() { - delete samples; + delete mSamples; } void afxObjectHistConstraint::set(SceneObject* obj) { - if (obj && !samples) + if (obj && !mSamples) { - samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); + mSamples = new afxSampleXfmBuffer; + mSamples->configHistory(mCons_def.mHistory_time, mCons_def.mSample_rate); } Parent::set(obj); @@ -2561,10 +2561,10 @@ void afxObjectHistConstraint::set(SceneObject* obj) void afxObjectHistConstraint::set_scope_id(U16 scope_id) { - if (scope_id > 0 && !samples) + if (scope_id > 0 && !mSamples) { - samples = new afxSampleXfmBuffer; - samples->configHistory(cons_def.mHistory_time, cons_def.mSample_rate); + mSamples = new afxSampleXfmBuffer; + mSamples->configHistory(mCons_def.mHistory_time, mCons_def.mSample_rate); } Parent::set_scope_id(scope_id); @@ -2577,9 +2577,9 @@ void afxObjectHistConstraint::sample(F32 dt, U32 elapsed_ms, const Point3F* cam_ if (isDefined()) { if (isValid()) - samples->recordSample(dt, elapsed_ms, &last_xfm); + mSamples->recordSample(dt, elapsed_ms, &mLast_xfm); else - samples->recordSample(dt, elapsed_ms, 0); + mSamples->recordSample(dt, elapsed_ms, 0); } } @@ -2588,7 +2588,7 @@ bool afxObjectHistConstraint::getPosition(Point3F& pos, F32 hist) bool in_bounds; MatrixF xfm; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); pos = xfm.getPosition(); @@ -2599,7 +2599,7 @@ bool afxObjectHistConstraint::getTransform(MatrixF& xfm, F32 hist) { bool in_bounds; - samples->getSample(hist, &xfm, in_bounds); + mSamples->getSample(hist, &xfm, in_bounds); return in_bounds; } diff --git a/Engine/source/afx/afxConstraint.h b/Engine/source/afx/afxConstraint.h index 3774613d0..a17ed3b29 100644 --- a/Engine/source/afx/afxConstraint.h +++ b/Engine/source/afx/afxConstraint.h @@ -94,30 +94,30 @@ class afxConstraint : public SimObject, public afxEffectDefs typedef SimObject Parent; protected: - afxConstraintMgr* mgr; - afxConstraintDef cons_def; - bool is_defined; - bool is_valid; - Point3F last_pos; - MatrixF last_xfm; - F32 history_time; - bool is_alive; - bool gone_missing; - U32 change_code; + afxConstraintMgr* mMgr; + afxConstraintDef mCons_def; + bool mIs_defined; + bool mIs_valid; + Point3F mLast_pos; + MatrixF mLast_xfm; + F32 mHistory_time; + bool mIs_alive; + bool mGone_missing; + U32 mChange_code; public: /*C*/ afxConstraint(afxConstraintMgr*); virtual ~afxConstraint(); virtual bool getPosition(Point3F& pos, F32 hist=0.0f) - { pos = last_pos; return is_valid; } + { pos = mLast_pos; return mIs_valid; } virtual bool getTransform(MatrixF& xfm, F32 hist=0.0f) - { xfm = last_xfm; return is_valid;} + { xfm = mLast_xfm; return mIs_valid;} virtual bool getAltitudes(F32& terrain_alt, F32& interior_alt) { return false; } - virtual bool isDefined() { return is_defined; } - virtual bool isValid() { return is_valid; } - virtual U32 getChangeCode() { return change_code; } + virtual bool isDefined() { return mIs_defined; } + virtual bool isValid() { return mIs_valid; } + virtual U32 getChangeCode() { return mChange_code; } virtual U32 setAnimClip(const char* clip, F32 pos, F32 rate, F32 trans, bool is_death_anim) { return 0; }; @@ -127,8 +127,8 @@ public: virtual F32 getAnimClipDuration(const char* clip) { return 0.0f; } virtual S32 getDamageState() { return -1; } - virtual void setLivingState(bool state) { is_alive = state; }; - virtual bool getLivingState() { return is_alive; }; + virtual void setLivingState(bool state) { mIs_alive = state; }; + virtual bool getLivingState() { return mIs_alive; }; virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos)=0; @@ -175,15 +175,15 @@ class afxConstraintMgr : public afxEffectDefs U32 type; }; - Vector constraints_v; + Vector mConstraints_v; - Vector names_on_server; - Vector ghost_ids; - Vector predefs; - U32 starttime; - bool on_server; - bool initialized; - F32 scoping_dist_sq; + Vector mNames_on_server; + Vector mGhost_ids; + Vector mPredefs; + U32 mStartTime; + bool mOn_server; + bool mInitialized; + F32 mScoping_dist_sq; SceneObject* find_object_from_name(StringTableEntry); S32 find_cons_idx_from_name(StringTableEntry); @@ -221,7 +221,7 @@ public: void sample(F32 dt, U32 now, const Point3F* cam_pos=0); - void setStartTime(U32 timestamp) { starttime = timestamp; } + void setStartTime(U32 timestamp) { mStartTime = timestamp; } void initConstraintDefs(Vector&, bool on_server, F32 scoping_dist=-1.0f); void packConstraintNames(NetConnection* conn, BitStream* stream); void unpackConstraintNames(BitStream* stream); @@ -245,7 +245,7 @@ public: void restoreScopedObject(SceneObject*, afxChoreographer* ch); void adjustProcessOrdering(afxChoreographer*); - F32 getScopingDistanceSquared() const { return scoping_dist_sq; } + F32 getScopingDistanceSquared() const { return mScoping_dist_sq; } }; inline afxConstraintID afxConstraintMgr::setReferencePoint(StringTableEntry which, Point3F point) @@ -270,8 +270,8 @@ class afxPointConstraint : public afxConstraint typedef afxConstraint Parent; protected: - Point3F point; - Point3F vector; + Point3F mPoint; + Point3F mVector; public: /*C*/ afxPointConstraint(afxConstraintMgr*); @@ -329,11 +329,11 @@ class afxShapeConstraint : public afxConstraint typedef afxConstraint Parent; protected: - StringTableEntry arb_name; - ShapeBase* shape; - U16 scope_id; - U32 clip_tag; - U32 lock_tag; + StringTableEntry mArb_name; + ShapeBase* mShape; + U16 mScope_id; + U32 mClip_tag; + U32 mLock_tag; public: /*C*/ afxShapeConstraint(afxConstraintMgr*); @@ -354,9 +354,9 @@ public: virtual S32 getDamageState(); - virtual SceneObject* getSceneObject() { return shape; } + virtual SceneObject* getSceneObject() { return mShape; } virtual void restoreObject(SceneObject*); - virtual U16 getScopeId() { return scope_id; } + virtual U16 getScopeId() { return mScope_id; } virtual U32 getTriggers(); virtual void onDeleteNotify(SimObject*); @@ -373,8 +373,8 @@ class afxShapeNodeConstraint : public afxShapeConstraint typedef afxShapeConstraint Parent; protected: - StringTableEntry arb_node; - S32 shape_node_ID; + StringTableEntry mArb_node; + S32 mShape_node_ID; public: /*C*/ afxShapeNodeConstraint(afxConstraintMgr*); @@ -385,7 +385,7 @@ public: virtual void sample(F32 dt, U32 elapsed_ms, const Point3F* cam_pos); virtual void restoreObject(SceneObject*); - S32 getNodeID() const { return shape_node_ID; } + S32 getNodeID() const { return mShape_node_ID; } virtual void onDeleteNotify(SimObject*); }; @@ -441,11 +441,11 @@ class afxEffectConstraint : public afxConstraint typedef afxConstraint Parent; protected: - StringTableEntry effect_name; - afxEffectWrapper* effect; - U32 clip_tag; - bool is_death_clip; - U32 lock_tag; + StringTableEntry mEffect_name; + afxEffectWrapper* mEffect; + U32 mClip_tag; + bool mIs_death_clip; + U32 mLock_tag; public: /*C*/ afxEffectConstraint(afxConstraintMgr*); @@ -480,8 +480,8 @@ class afxEffectNodeConstraint : public afxEffectConstraint typedef afxEffectConstraint Parent; protected: - StringTableEntry effect_node; - S32 effect_node_ID; + StringTableEntry mEffect_node; + S32 mEffect_node_ID; public: /*C*/ afxEffectNodeConstraint(afxConstraintMgr*); @@ -492,7 +492,7 @@ public: virtual void set(afxEffectWrapper* effect); - S32 getNodeID() const { return effect_node_ID; } + S32 getNodeID() const { return mEffect_node_ID; } }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -501,13 +501,13 @@ public: class afxSampleBuffer { protected: - U32 buffer_sz; - U32 buffer_ms; - U32 ms_per_sample; - U32 elapsed_ms; - U32 last_sample_ms; - U32 next_sample_num; - U32 n_samples; + U32 mBuffer_sz; + U32 mBuffer_ms; + U32 mMS_per_sample; + U32 mElapsed_ms; + U32 mLast_sample_ms; + U32 mNext_sample_num; + U32 mNum_samples; virtual void recSample(U32 idx, void* data) = 0; bool compute_idx_from_lag(F32 lag, U32& idx); @@ -530,7 +530,7 @@ class afxSampleXfmBuffer : public afxSampleBuffer typedef afxSampleBuffer Parent; protected: - MatrixF* xfm_buffer; + MatrixF* mXfm_buffer; virtual void recSample(U32 idx, void* data); @@ -552,7 +552,7 @@ class afxPointHistConstraint : public afxPointConstraint typedef afxPointConstraint Parent; protected: - afxSampleBuffer* samples; + afxSampleBuffer* mSamples; public: /*C*/ afxPointHistConstraint(afxConstraintMgr*); @@ -575,7 +575,7 @@ class afxTransformHistConstraint : public afxTransformConstraint typedef afxTransformConstraint Parent; protected: - afxSampleBuffer* samples; + afxSampleBuffer* mSamples; public: /*C*/ afxTransformHistConstraint(afxConstraintMgr*); @@ -598,7 +598,7 @@ class afxShapeHistConstraint : public afxShapeConstraint typedef afxShapeConstraint Parent; protected: - afxSampleBuffer* samples; + afxSampleBuffer* mSamples; public: /*C*/ afxShapeHistConstraint(afxConstraintMgr*); @@ -625,7 +625,7 @@ class afxShapeNodeHistConstraint : public afxShapeNodeConstraint typedef afxShapeNodeConstraint Parent; protected: - afxSampleBuffer* samples; + afxSampleBuffer* mSamples; public: /*C*/ afxShapeNodeHistConstraint(afxConstraintMgr*); @@ -654,7 +654,7 @@ class afxObjectHistConstraint : public afxObjectConstraint typedef afxObjectConstraint Parent; protected: - afxSampleBuffer* samples; + afxSampleBuffer* mSamples; public: afxObjectHistConstraint(afxConstraintMgr*); From f0686647422f9abf677153656c8394657a756392 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 28 Mar 2018 23:41:47 -0500 Subject: [PATCH 094/144] gamebase mmebervar cleanups. mPacked in particular is likely to geta followup for other cleaning. --- Engine/source/T3D/debris.cpp | 2 +- Engine/source/T3D/fx/particleEmitter.cpp | 2 +- Engine/source/T3D/gameBase/gameBase.cpp | 14 +++++++------- Engine/source/T3D/gameBase/gameBase.h | 4 ++-- Engine/source/T3D/shapeBase.cpp | 2 +- Engine/source/T3D/shapeImage.cpp | 6 +++--- Engine/source/T3D/vehicles/flyingVehicle.cpp | 4 ++-- Engine/source/T3D/vehicles/hoverVehicle.cpp | 4 ++-- Engine/source/T3D/vehicles/vehicle.cpp | 2 +- Engine/source/T3D/vehicles/wheeledVehicle.cpp | 2 +- Engine/source/afx/afxEffectGroup.cpp | 2 +- Engine/source/afx/afxEffectWrapper.cpp | 4 ++-- Engine/source/afx/afxEffectron.cpp | 2 +- Engine/source/afx/afxMagicSpell.cpp | 12 ++++++------ Engine/source/afx/afxSelectron.cpp | 6 +++--- Engine/source/afx/afxSpellBook.cpp | 2 +- Engine/source/afx/ce/afxLightBase_T3D.cpp | 4 ++-- Engine/source/afx/ce/afxPhraseEffect.cpp | 2 +- 18 files changed, 38 insertions(+), 38 deletions(-) diff --git a/Engine/source/T3D/debris.cpp b/Engine/source/T3D/debris.cpp index 23f18890b..24014d5c8 100644 --- a/Engine/source/T3D/debris.cpp +++ b/Engine/source/T3D/debris.cpp @@ -396,7 +396,7 @@ void DebrisData::packData(BitStream* stream) if( stream->writeFlag( explosion ) ) { - stream->writeRangedU32(packed? SimObjectId((uintptr_t)explosion): + stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)explosion): explosion->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); } diff --git a/Engine/source/T3D/fx/particleEmitter.cpp b/Engine/source/T3D/fx/particleEmitter.cpp index cab153574..079ea84b8 100644 --- a/Engine/source/T3D/fx/particleEmitter.cpp +++ b/Engine/source/T3D/fx/particleEmitter.cpp @@ -412,7 +412,7 @@ void ParticleEmitterData::packData(BitStream* stream) #if defined(AFX_CAP_PARTICLE_POOLS) if (stream->writeFlag(pool_datablock)) { - stream->writeRangedU32(packed ? SimObjectId((uintptr_t)pool_datablock) : pool_datablock->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast); + stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)pool_datablock) : pool_datablock->getId(), DataBlockObjectIdFirst, DataBlockObjectIdLast); stream->write(pool_index); stream->writeFlag(pool_depth_fade); stream->writeFlag(pool_radial_fade); diff --git a/Engine/source/T3D/gameBase/gameBase.cpp b/Engine/source/T3D/gameBase/gameBase.cpp index ad7e4d983..17c050309 100644 --- a/Engine/source/T3D/gameBase/gameBase.cpp +++ b/Engine/source/T3D/gameBase/gameBase.cpp @@ -127,13 +127,13 @@ IMPLEMENT_CALLBACK( GameBase, setControl, void, ( bool controlled ), ( controlle GameBaseData::GameBaseData() { - category = ""; - packed = false; + mCategory = ""; + mPacked = false; } GameBaseData::GameBaseData(const GameBaseData& other, bool temp_clone) : SimDataBlock(other, temp_clone) { - packed = other.packed; - category = other.category; + mPacked = other.mPacked; + mCategory = other.mCategory; //mReloadSignal = other.mReloadSignal; // DO NOT copy the mReloadSignal member. } @@ -158,7 +158,7 @@ void GameBaseData::initPersistFields() { addGroup("Scripting"); - addField( "category", TypeCaseString, Offset( category, GameBaseData ), + addField( "category", TypeCaseString, Offset(mCategory, GameBaseData ), "The group that this datablock will show up in under the \"Scripted\" " "tab in the World Editor Library." ); @@ -171,14 +171,14 @@ bool GameBaseData::preload(bool server, String &errorStr) { if (!Parent::preload(server, errorStr)) return false; - packed = false; + mPacked = false; return true; } void GameBaseData::unpackData(BitStream* stream) { Parent::unpackData(stream); - packed = true; + mPacked = true; } //---------------------------------------------------------------------------- diff --git a/Engine/source/T3D/gameBase/gameBase.h b/Engine/source/T3D/gameBase/gameBase.h index e6cf5c973..2571c1426 100644 --- a/Engine/source/T3D/gameBase/gameBase.h +++ b/Engine/source/T3D/gameBase/gameBase.h @@ -91,8 +91,8 @@ private: public: - bool packed; - StringTableEntry category; + bool mPacked; + StringTableEntry mCategory; // Signal triggered when this datablock is modified. // GameBase objects referencing this datablock notify with this signal. diff --git a/Engine/source/T3D/shapeBase.cpp b/Engine/source/T3D/shapeBase.cpp index 71f826aa4..652e5ce35 100644 --- a/Engine/source/T3D/shapeBase.cpp +++ b/Engine/source/T3D/shapeBase.cpp @@ -808,7 +808,7 @@ void ShapeBaseData::packData(BitStream* stream) if( stream->writeFlag( debris != NULL ) ) { - stream->writeRangedU32(packed? SimObjectId((uintptr_t)debris): + stream->writeRangedU32(mPacked? SimObjectId((uintptr_t)debris): debris->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); } diff --git a/Engine/source/T3D/shapeImage.cpp b/Engine/source/T3D/shapeImage.cpp index 4319baa4e..56d413a2b 100644 --- a/Engine/source/T3D/shapeImage.cpp +++ b/Engine/source/T3D/shapeImage.cpp @@ -1019,7 +1019,7 @@ void ShapeBaseImageData::packData(BitStream* stream) // Write the projectile datablock if (stream->writeFlag(projectile)) - stream->writeRangedU32(packed? SimObjectId((uintptr_t)projectile): + stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)projectile): projectile->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); stream->writeFlag(cloakable); @@ -1050,7 +1050,7 @@ void ShapeBaseImageData::packData(BitStream* stream) if( stream->writeFlag( casing ) ) { - stream->writeRangedU32(packed? SimObjectId((uintptr_t)casing): + stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)casing): casing->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); } @@ -1139,7 +1139,7 @@ void ShapeBaseImageData::packData(BitStream* stream) if (stream->writeFlag(s.emitter)) { - stream->writeRangedU32(packed? SimObjectId((uintptr_t)s.emitter): + stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)s.emitter): s.emitter->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); stream->write(s.emitterTime); diff --git a/Engine/source/T3D/vehicles/flyingVehicle.cpp b/Engine/source/T3D/vehicles/flyingVehicle.cpp index 3040d94b1..2ee5bc375 100644 --- a/Engine/source/T3D/vehicles/flyingVehicle.cpp +++ b/Engine/source/T3D/vehicles/flyingVehicle.cpp @@ -244,7 +244,7 @@ void FlyingVehicleData::packData(BitStream* stream) { if (stream->writeFlag(sound[i])) { - SimObjectId writtenId = packed ? SimObjectId((uintptr_t)sound[i]) : sound[i]->getId(); + SimObjectId writtenId = mPacked ? SimObjectId((uintptr_t)sound[i]) : sound[i]->getId(); stream->writeRangedU32(writtenId, DataBlockObjectIdFirst, DataBlockObjectIdLast); } } @@ -253,7 +253,7 @@ void FlyingVehicleData::packData(BitStream* stream) { if (stream->writeFlag(jetEmitter[j])) { - SimObjectId writtenId = packed ? SimObjectId((uintptr_t)jetEmitter[j]) : jetEmitter[j]->getId(); + SimObjectId writtenId = mPacked ? SimObjectId((uintptr_t)jetEmitter[j]) : jetEmitter[j]->getId(); stream->writeRangedU32(writtenId, DataBlockObjectIdFirst,DataBlockObjectIdLast); } } diff --git a/Engine/source/T3D/vehicles/hoverVehicle.cpp b/Engine/source/T3D/vehicles/hoverVehicle.cpp index 1da29360b..1f1d259b5 100644 --- a/Engine/source/T3D/vehicles/hoverVehicle.cpp +++ b/Engine/source/T3D/vehicles/hoverVehicle.cpp @@ -362,14 +362,14 @@ void HoverVehicleData::packData(BitStream* stream) for (S32 i = 0; i < MaxSounds; i++) if (stream->writeFlag(sound[i])) - stream->writeRangedU32(packed? SimObjectId((uintptr_t)sound[i]): + stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)sound[i]): sound[i]->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); for (S32 j = 0; j < MaxJetEmitters; j++) { if (stream->writeFlag(jetEmitter[j])) { - SimObjectId writtenId = packed ? SimObjectId((uintptr_t)jetEmitter[j]) : jetEmitter[j]->getId(); + SimObjectId writtenId = mPacked ? SimObjectId((uintptr_t)jetEmitter[j]) : jetEmitter[j]->getId(); stream->writeRangedU32(writtenId, DataBlockObjectIdFirst,DataBlockObjectIdLast); } } diff --git a/Engine/source/T3D/vehicles/vehicle.cpp b/Engine/source/T3D/vehicles/vehicle.cpp index a173d61fd..18a7c4466 100644 --- a/Engine/source/T3D/vehicles/vehicle.cpp +++ b/Engine/source/T3D/vehicles/vehicle.cpp @@ -277,7 +277,7 @@ void VehicleData::packData(BitStream* stream) stream->write(body.friction); for (i = 0; i < Body::MaxSounds; i++) if (stream->writeFlag(body.sound[i])) - stream->writeRangedU32(packed? SimObjectId((uintptr_t)body.sound[i]): + stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)body.sound[i]): body.sound[i]->getId(),DataBlockObjectIdFirst, DataBlockObjectIdLast); diff --git a/Engine/source/T3D/vehicles/wheeledVehicle.cpp b/Engine/source/T3D/vehicles/wheeledVehicle.cpp index 455dee9f5..f4f272fd3 100644 --- a/Engine/source/T3D/vehicles/wheeledVehicle.cpp +++ b/Engine/source/T3D/vehicles/wheeledVehicle.cpp @@ -477,7 +477,7 @@ void WheeledVehicleData::packData(BitStream* stream) Parent::packData(stream); if (stream->writeFlag(tireEmitter)) - stream->writeRangedU32(packed? SimObjectId((uintptr_t)tireEmitter): + stream->writeRangedU32(mPacked ? SimObjectId((uintptr_t)tireEmitter): tireEmitter->getId(),DataBlockObjectIdFirst,DataBlockObjectIdLast); for (S32 i = 0; i < MaxSounds; i++) diff --git a/Engine/source/afx/afxEffectGroup.cpp b/Engine/source/afx/afxEffectGroup.cpp index a7e97f25e..749dbbddb 100644 --- a/Engine/source/afx/afxEffectGroup.cpp +++ b/Engine/source/afx/afxEffectGroup.cpp @@ -184,7 +184,7 @@ void afxEffectGroupData::packData(BitStream* stream) stream->write(timing.fade_in_time); stream->write(timing.fade_out_time); - pack_fx(stream, fx_list, packed); + pack_fx(stream, fx_list, mPacked); } void afxEffectGroupData::unpackData(BitStream* stream) diff --git a/Engine/source/afx/afxEffectWrapper.cpp b/Engine/source/afx/afxEffectWrapper.cpp index 0f33585f6..33f73f787 100644 --- a/Engine/source/afx/afxEffectWrapper.cpp +++ b/Engine/source/afx/afxEffectWrapper.cpp @@ -380,7 +380,7 @@ void afxEffectWrapperData::packData(BitStream* stream) { Parent::packData(stream); - writeDatablockID(stream, effect_data, packed); + writeDatablockID(stream, effect_data, mPacked); stream->writeString(effect_name); @@ -419,7 +419,7 @@ void afxEffectWrapperData::packData(BitStream* stream) stream->write(scale_factor); // modifiers - pack_mods(stream, xfm_modifiers, packed); + pack_mods(stream, xfm_modifiers, mPacked); mathWrite(*stream, forced_bbox); stream->write(update_forced_bbox); diff --git a/Engine/source/afx/afxEffectron.cpp b/Engine/source/afx/afxEffectron.cpp index 5a1bacbf4..b1b7f7eff 100644 --- a/Engine/source/afx/afxEffectron.cpp +++ b/Engine/source/afx/afxEffectron.cpp @@ -157,7 +157,7 @@ void afxEffectronData::packData(BitStream* stream) stream->write(duration); stream->write(n_loops); - pack_fx(stream, fx_list, packed); + pack_fx(stream, fx_list, mPacked); } void afxEffectronData::unpackData(BitStream* stream) diff --git a/Engine/source/afx/afxMagicSpell.cpp b/Engine/source/afx/afxMagicSpell.cpp index 39621f8cd..3302d3f35 100644 --- a/Engine/source/afx/afxMagicSpell.cpp +++ b/Engine/source/afx/afxMagicSpell.cpp @@ -326,15 +326,15 @@ void afxMagicSpellData::packData(BitStream* stream) stream->writeFlag(do_move_interrupts); stream->write(move_interrupt_speed); - writeDatablockID(stream, missile_db, packed); + writeDatablockID(stream, missile_db, mPacked); stream->write(launch_on_server_signal); stream->write(primary_target_types); - pack_fx(stream, casting_fx_list, packed); - pack_fx(stream, launch_fx_list, packed); - pack_fx(stream, delivery_fx_list, packed); - pack_fx(stream, impact_fx_list, packed); - pack_fx(stream, linger_fx_list, packed); + pack_fx(stream, casting_fx_list, mPacked); + pack_fx(stream, launch_fx_list, mPacked); + pack_fx(stream, delivery_fx_list, mPacked); + pack_fx(stream, impact_fx_list, mPacked); + pack_fx(stream, linger_fx_list, mPacked); } void afxMagicSpellData::unpackData(BitStream* stream) diff --git a/Engine/source/afx/afxSelectron.cpp b/Engine/source/afx/afxSelectron.cpp index 148bcceca..81b60c836 100644 --- a/Engine/source/afx/afxSelectron.cpp +++ b/Engine/source/afx/afxSelectron.cpp @@ -230,9 +230,9 @@ void afxSelectronData::packData(BitStream* stream) stream->write(obj_type_style); stream->write(obj_type_mask); - pack_fx(stream, main_fx_list, packed); - pack_fx(stream, select_fx_list, packed); - pack_fx(stream, deselect_fx_list, packed); + pack_fx(stream, main_fx_list, mPacked); + pack_fx(stream, select_fx_list, mPacked); + pack_fx(stream, deselect_fx_list, mPacked); } void afxSelectronData::unpackData(BitStream* stream) diff --git a/Engine/source/afx/afxSpellBook.cpp b/Engine/source/afx/afxSpellBook.cpp index 42d28d550..cce22129b 100644 --- a/Engine/source/afx/afxSpellBook.cpp +++ b/Engine/source/afx/afxSpellBook.cpp @@ -116,7 +116,7 @@ void afxSpellBookData::packData(BitStream* stream) stream->write(pages_per_book); for (S32 i = 0; i < pages_per_book*spells_per_page; i++) - writeDatablockID(stream, rpg_spells[i], packed); + writeDatablockID(stream, rpg_spells[i], mPacked); } void afxSpellBookData::unpackData(BitStream* stream) diff --git a/Engine/source/afx/ce/afxLightBase_T3D.cpp b/Engine/source/afx/ce/afxLightBase_T3D.cpp index 209bc7426..56b76ccca 100644 --- a/Engine/source/afx/ce/afxLightBase_T3D.cpp +++ b/Engine/source/afx/ce/afxLightBase_T3D.cpp @@ -176,8 +176,8 @@ void afxT3DLightBaseData::packData(BitStream* stream) stream->write( mAnimState.animationPhase ); stream->write( mFlareScale ); - writeDatablockID(stream, mAnimationData, packed); - writeDatablockID(stream, mFlareData, packed); + writeDatablockID(stream, mAnimationData, mPacked); + writeDatablockID(stream, mFlareData, mPacked); } void afxT3DLightBaseData::unpackData(BitStream* stream) diff --git a/Engine/source/afx/ce/afxPhraseEffect.cpp b/Engine/source/afx/ce/afxPhraseEffect.cpp index 3710e2fe6..5df7dfc26 100644 --- a/Engine/source/afx/ce/afxPhraseEffect.cpp +++ b/Engine/source/afx/ce/afxPhraseEffect.cpp @@ -235,7 +235,7 @@ void afxPhraseEffectData::packData(BitStream* stream) stream->writeString(on_trig_cmd); - pack_fx(stream, fx_list, packed); + pack_fx(stream, fx_list, mPacked); } void afxPhraseEffectData::unpackData(BitStream* stream) From ec4043604ed4104fad36cdfd8770ddbc87edd065 Mon Sep 17 00:00:00 2001 From: Areloch Date: Thu, 29 Mar 2018 00:44:10 -0500 Subject: [PATCH 095/144] Remove a now-unneeded fix for offsetof on new versions of Visual Studio. --- Engine/source/console/consoleTypes.h | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Engine/source/console/consoleTypes.h b/Engine/source/console/consoleTypes.h index df3fc000f..a5da7661e 100644 --- a/Engine/source/console/consoleTypes.h +++ b/Engine/source/console/consoleTypes.h @@ -48,13 +48,6 @@ template inline const T nullAsType(){ return nullptr; } /// @ingroup console_system Console System /// @{ -#if _MSC_VER >= 1911 - #ifdef offsetof - #undef offsetof - #endif // offsetof - #define offsetof(s,m) ((size_t)&reinterpret_cast((((s*)0)->m))) -#endif - #ifndef Offset #define Offset(x, cls) offsetof(cls, x) #endif From 8353d87a4978fe6219268e82c20d6e554d847fdb Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 29 Mar 2018 03:40:24 -0500 Subject: [PATCH 096/144] afx path 3d membervar cleanup --- Engine/source/afx/util/afxPath3D.cpp | 120 +++++++++++++-------------- Engine/source/afx/util/afxPath3D.h | 12 +-- 2 files changed, 66 insertions(+), 66 deletions(-) diff --git a/Engine/source/afx/util/afxPath3D.cpp b/Engine/source/afx/util/afxPath3D.cpp index f37b141d9..5997bdc12 100644 --- a/Engine/source/afx/util/afxPath3D.cpp +++ b/Engine/source/afx/util/afxPath3D.cpp @@ -29,7 +29,7 @@ #include "afx/util/afxPath3D.h" -afxPath3D::afxPath3D() : start_time(0), num_points(0), loop_type(LOOP_CONSTANT) +afxPath3D::afxPath3D() : mStart_time(0), mNum_points(0), mLoop_type(LOOP_CONSTANT) { } @@ -39,88 +39,88 @@ afxPath3D::~afxPath3D() void afxPath3D::sortAll() { - curve.sort(); - curve_parameters.sort(); + mCurve.sort(); + mCurve_parameters.sort(); } void afxPath3D::setStartTime( F32 time ) { - start_time = time; + mStart_time = time; } void afxPath3D::setLoopType( U32 loop_type ) { - this->loop_type = loop_type; + mLoop_type = loop_type; } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// F32 afxPath3D::getEndTime() { - return end_time; + return mEnd_time; } int afxPath3D::getNumPoints() { - return num_points; + return mNum_points; } Point3F afxPath3D::getPointPosition( int index ) { - if (index < 0 || index >= num_points) + if (index < 0 || index >= mNum_points) return Point3F(0.0f, 0.0f, 0.0f); - return curve.getPoint(index); + return mCurve.getPoint(index); } F32 afxPath3D::getPointTime( int index ) { - if (index < 0 || index >= num_points) + if (index < 0 || index >= mNum_points) return 0.0f; - return curve_parameters.getKeyTime(index); + return mCurve_parameters.getKeyTime(index); } F32 afxPath3D::getPointParameter( int index ) { - if (index < 0 || index >= num_points) + if (index < 0 || index >= mNum_points) return 0.0f; - return curve_parameters.getKeyValue(index); + return mCurve_parameters.getKeyValue(index); } Point2F afxPath3D::getParameterSegment( F32 time ) { - return curve_parameters.getSegment(time); + return mCurve_parameters.getSegment(time); } void afxPath3D::setPointPosition( int index, Point3F &p ) { - if (index < 0 || index >= num_points) + if (index < 0 || index >= mNum_points) return; - curve.setPoint(index, p); + mCurve.setPoint(index, p); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// F32 afxPath3D::calcCurveTime( F32 time ) { - if( time <= start_time ) + if( time <= mStart_time ) return 0.0f; - if( time <= end_time ) - return time-start_time; + if( time <= mEnd_time ) + return time-mStart_time; - switch( loop_type ) + switch( mLoop_type ) { case LOOP_CYCLE : { - return mFmod( time-start_time, end_time-start_time ); + return mFmod( time-mStart_time, mEnd_time-mStart_time ); } case LOOP_OSCILLATE : { - F32 t1 = time-start_time; - F32 t2 = end_time-start_time; + F32 t1 = time- mStart_time; + F32 t2 = mEnd_time - mStart_time; if( (int)(t1/t2) % 2 ) // odd segment return t2 - mFmod( t1, t2 ); @@ -129,26 +129,26 @@ F32 afxPath3D::calcCurveTime( F32 time ) } case LOOP_CONSTANT : default: - return end_time; + return mEnd_time; } } Point3F afxPath3D::evaluateAtTime( F32 time ) { F32 ctime = calcCurveTime( time ); - F32 param = curve_parameters.evaluate( ctime ); - return curve.evaluate(param); + F32 param = mCurve_parameters.evaluate( ctime ); + return mCurve.evaluate(param); } Point3F afxPath3D::evaluateAtTime(F32 t0, F32 t1) { F32 ctime = calcCurveTime(t0); - F32 param = curve_parameters.evaluate( ctime ); - Point3F p0 = curve.evaluate(param); + F32 param = mCurve_parameters.evaluate( ctime ); + Point3F p0 = mCurve.evaluate(param); ctime = calcCurveTime(t1); - param = curve_parameters.evaluate( ctime ); - Point3F p1 = curve.evaluate(param); + param = mCurve_parameters.evaluate( ctime ); + Point3F p1 = mCurve.evaluate(param); return p1-p0; } @@ -156,21 +156,21 @@ Point3F afxPath3D::evaluateAtTime(F32 t0, F32 t1) Point3F afxPath3D::evaluateTangentAtTime( F32 time ) { F32 ctime = calcCurveTime( time ); - F32 param = curve_parameters.evaluate( ctime ); - return curve.evaluateTangent(param); + F32 param = mCurve_parameters.evaluate( ctime ); + return mCurve.evaluateTangent(param); } Point3F afxPath3D::evaluateTangentAtPoint( int index ) { - F32 param = curve_parameters.getKeyValue(index); - return curve.evaluateTangent(param); + F32 param = mCurve_parameters.getKeyValue(index); + return mCurve.evaluateTangent(param); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 start_time, F32 end_time ) { - this->num_points = num_points; + mNum_points = num_points; // Add points to path F32 param_inc = 1.0f / (F32)(num_points - 1); @@ -179,10 +179,10 @@ void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 start_tim { if( i == num_points-1 ) param = 1.0f; - curve.addPoint( param, curve_points[i] ); + mCurve.addPoint( param, curve_points[i] ); } - curve.computeTangents(); + mCurve.computeTangents(); initPathParametersNEW( curve_points, start_time, end_time ); @@ -191,7 +191,7 @@ void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 start_tim void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 speed ) { - this->num_points = num_points; + mNum_points = num_points; // Add points to path F32 param_inc = 1.0f / (F32)(num_points - 1); @@ -200,7 +200,7 @@ void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 speed ) { if( i == num_points-1 ) param = 1.0f; - curve.addPoint( param, curve_points[i] ); + mCurve.addPoint( param, curve_points[i] ); } initPathParameters( curve_points, speed ); @@ -211,7 +211,7 @@ void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 speed ) void afxPath3D::buildPath( int num_points, Point3F curve_points[], F32 point_times[], F32 time_offset, F32 time_factor ) { - this->num_points = num_points; + mNum_points = num_points; // Add points to path F32 param_inc = 1.0f / (F32)(num_points - 1); @@ -220,20 +220,20 @@ void afxPath3D::buildPath( int num_points, Point3F curve_points[], { if( i == num_points-1 ) param = 1.0f; - curve.addPoint( param, curve_points[i] ); + mCurve.addPoint( param, curve_points[i] ); - curve_parameters.addKey( (point_times[i]+time_offset)*time_factor, param ); + mCurve_parameters.addKey( (point_times[i]+time_offset)*time_factor, param ); } // Set end time - end_time = (point_times[num_points-1]+time_offset)*time_factor; + mEnd_time = (point_times[num_points-1]+time_offset)*time_factor; sortAll(); } void afxPath3D::buildPath( int num_points, Point3F curve_points[], Point2F curve_params[] ) { - this->num_points = num_points; + mNum_points = num_points; // Add points to path F32 param_inc = 1.0f / (F32)(num_points - 1); @@ -242,22 +242,22 @@ void afxPath3D::buildPath( int num_points, Point3F curve_points[], Point2F curve { if( i == num_points-1 ) param = 1.0f; - curve.addPoint( param, curve_points[i] ); + mCurve.addPoint( param, curve_points[i] ); } // for (int i = 0; i < num_points; i++) - curve_parameters.addKey( curve_params[i] ); + mCurve_parameters.addKey( curve_params[i] ); // Set end time - end_time = curve_params[num_points - 1].x; + mEnd_time = curve_params[num_points - 1].x; sortAll(); } void afxPath3D::reBuildPath() { - curve.computeTangents(); + mCurve.computeTangents(); sortAll(); } @@ -265,7 +265,7 @@ void afxPath3D::initPathParameters( Point3F curve_points[], F32 speed ) { // Compute the time for each point dependent on the speed of the character and the // distance it must travel (approximately!) - int num_segments = num_points - 1; + int num_segments = mNum_points - 1; F32 *point_distances = new F32[num_segments]; for( int i = 0; i < num_segments; i++ ) { @@ -283,14 +283,14 @@ void afxPath3D::initPathParameters( Point3F curve_points[], F32 speed ) last_time = times[i]; } - curve_parameters.addKey( 0, 0.0f );//start_time, 0.0f ); - F32 param_inc = 1.0f / (F32)(num_points - 1); + mCurve_parameters.addKey( 0, 0.0f );//start_time, 0.0f ); + F32 param_inc = 1.0f / (F32)(mNum_points - 1); F32 param = 0.0f + param_inc; for( int i = 0; i < num_segments; i++, param += param_inc ) - curve_parameters.addKey( times[i], param ); + mCurve_parameters.addKey( times[i], param ); // Set end time - end_time = times[num_segments-1]; + mEnd_time = times[num_segments-1]; if (point_distances) delete [] point_distances; @@ -300,7 +300,7 @@ void afxPath3D::initPathParameters( Point3F curve_points[], F32 speed ) void afxPath3D::initPathParametersNEW( Point3F curve_points[], F32 start_time, F32 end_time ) { - int num_segments = num_points - 1; + int num_segments = mNum_points - 1; F32 *point_distances = new F32[num_segments]; F32 total_distance = 0.0f; for( int i = 0; i < num_segments; i++ ) @@ -315,19 +315,19 @@ void afxPath3D::initPathParametersNEW( Point3F curve_points[], F32 start_time, F F32 duration = end_time - start_time; F32 time = 0.0f; //start_time; - curve_parameters.addKey( time, 0.0f ); - F32 param_inc = 1.0f / (F32)(num_points - 1); + mCurve_parameters.addKey( time, 0.0f ); + F32 param_inc = 1.0f / (F32)(mNum_points - 1); F32 param = 0.0f + param_inc; for( int i=0; i < num_segments; i++, param += param_inc ) { time += (point_distances[i]/total_distance) * duration; - curve_parameters.addKey( time, param ); + mCurve_parameters.addKey( time, param ); } // Set end time ???? //end_time = time; - this->start_time = start_time; - this->end_time = end_time; + mStart_time = start_time; + mEnd_time = end_time; if (point_distances) delete [] point_distances; @@ -336,7 +336,7 @@ void afxPath3D::initPathParametersNEW( Point3F curve_points[], F32 start_time, F void afxPath3D::print() { // curve.print(); - curve_parameters.print(); + mCurve_parameters.print(); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/util/afxPath3D.h b/Engine/source/afx/util/afxPath3D.h index 77d2e2ad2..9c01767b6 100644 --- a/Engine/source/afx/util/afxPath3D.h +++ b/Engine/source/afx/util/afxPath3D.h @@ -37,13 +37,13 @@ class afxPath3D : public EngineObject { private: // Path-related data - afxCurve3D curve; - afxAnimCurve curve_parameters; - int num_points; + afxCurve3D mCurve; + afxAnimCurve mCurve_parameters; + int mNum_points; // Time data - F32 start_time; - F32 end_time; + F32 mStart_time; + F32 mEnd_time; public: /*C*/ afxPath3D( ); @@ -83,7 +83,7 @@ public: LOOP_OSCILLATE }; - U32 loop_type; + U32 mLoop_type; void setLoopType(U32); private: From 0df2cf1b9d8d069223ec566a03e69001eadc703b Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 29 Mar 2018 03:41:34 -0500 Subject: [PATCH 097/144] afx magic spell membervar cleanup (plus an additional shadowvar one in magic missile) --- Engine/source/afx/afxMagicMissile.cpp | 22 +- Engine/source/afx/afxMagicSpell.cpp | 1224 ++++++++++++------------- Engine/source/afx/afxMagicSpell.h | 124 +-- 3 files changed, 685 insertions(+), 685 deletions(-) diff --git a/Engine/source/afx/afxMagicMissile.cpp b/Engine/source/afx/afxMagicMissile.cpp index b0549e35d..87d919510 100644 --- a/Engine/source/afx/afxMagicMissile.cpp +++ b/Engine/source/afx/afxMagicMissile.cpp @@ -532,9 +532,9 @@ bool afxMagicMissileData::preload(bool server, String &errorStr) Con::errorf(ConsoleLogEntry::General, "ProjectileData::preload: Invalid packet, bad datablockId(decal): %d", decalId); */ - String errorStr; - if( !sfxResolve( &sound, errorStr ) ) - Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet: %s", errorStr.c_str()); + String sfxErrorStr; + if( !sfxResolve( &sound, sfxErrorStr) ) + Con::errorf(ConsoleLogEntry::General, "afxMagicMissileData::preload: Invalid packet: %s", sfxErrorStr.c_str()); if (!lightDesc && lightDescId != 0) if (Sim::findObject(lightDescId, lightDesc) == false) @@ -1864,7 +1864,7 @@ SceneObject* afxMagicMissile::get_default_launcher() const if (mDataBlock->reverse_targeting) { if (dynamic_cast(choreographer)) - launch_cons_obj = ((afxMagicSpell*)choreographer)->target; + launch_cons_obj = ((afxMagicSpell*)choreographer)->mTarget; if (!launch_cons_obj) { Con::errorf("afxMagicMissile::get_launch_data(): missing target constraint object for reverse targeted missile."); @@ -1874,7 +1874,7 @@ SceneObject* afxMagicMissile::get_default_launcher() const else { if (dynamic_cast(choreographer)) - launch_cons_obj = ((afxMagicSpell*)choreographer)->caster; + launch_cons_obj = ((afxMagicSpell*)choreographer)->mCaster; if (!launch_cons_obj) { Con::errorf("afxMagicMissile::get_launch_data(): missing launch constraint object missile."); @@ -2036,17 +2036,17 @@ void afxMagicMissile::launch() { if (mDataBlock->reverse_targeting) { - missile_target = spell->caster; - collide_exempt = spell->target; + missile_target = spell->mCaster; + collide_exempt = spell->mTarget; } else { - missile_target = spell->target; - collide_exempt = spell->caster; + missile_target = spell->mTarget; + collide_exempt = spell->mCaster; } - if (spell->caster) - processAfter(spell->caster); + if (spell->mCaster) + processAfter(spell->mCaster); if (missile_target) deleteNotify(missile_target); if (collide_exempt) diff --git a/Engine/source/afx/afxMagicSpell.cpp b/Engine/source/afx/afxMagicSpell.cpp index 3302d3f35..f9fb2ba01 100644 --- a/Engine/source/afx/afxMagicSpell.cpp +++ b/Engine/source/afx/afxMagicSpell.cpp @@ -53,19 +53,19 @@ void afxMagicSpellData::ewValidator::validateType(SimObject* object, void* typeP switch (id) { case CASTING_PHRASE: - spelldata->casting_fx_list.push_back(*ew); + spelldata->mCasting_fx_list.push_back(*ew); break; case LAUNCH_PHRASE: - spelldata->launch_fx_list.push_back(*ew); + spelldata->mLaunch_fx_list.push_back(*ew); break; case DELIVERY_PHRASE: - spelldata->delivery_fx_list.push_back(*ew); + spelldata->mDelivery_fx_list.push_back(*ew); break; case IMPACT_PHRASE: - spelldata->impact_fx_list.push_back(*ew); + spelldata->mImpact_fx_list.push_back(*ew); break; case LINGER_PHRASE: - spelldata->linger_fx_list.push_back(*ew); + spelldata->mLinger_fx_list.push_back(*ew); break; } *ew = 0; @@ -140,70 +140,70 @@ IMPLEMENT_CALLBACK( afxMagicSpellData, onActivate, void, afxMagicSpellData::afxMagicSpellData() { - casting_dur = 0.0f; - delivery_dur = 0.0f; - linger_dur = 0.0f; + mCasting_dur = 0.0f; + mDelivery_dur = 0.0f; + mLinger_dur = 0.0f; - n_casting_loops = 1; - n_delivery_loops = 1; - n_linger_loops = 1; + mNum_casting_loops = 1; + mNum_delivery_loops = 1; + mNum_linger_loops = 1; - extra_casting_time = 0.0f; - extra_delivery_time = 0.0f; - extra_linger_time = 0.0f; + mExtra_casting_time = 0.0f; + mExtra_delivery_time = 0.0f; + mExtra_linger_time = 0.0f; // interrupt flags - do_move_interrupts = true; - move_interrupt_speed = 2.0f; + mDo_move_interrupts = true; + mMove_interrupt_speed = 2.0f; // delivers projectile spells - missile_db = 0; - launch_on_server_signal = false; - primary_target_types = PlayerObjectType; + mMissile_db = 0; + mLaunch_on_server_signal = false; + mPrimary_target_types = PlayerObjectType; // dummy entry holds effect-wrapper pointer while a special validator // grabs it and adds it to an appropriate effects list - dummy_fx_entry = NULL; + mDummy_fx_entry = NULL; // marked true if datablock ids need to // be converted into pointers - do_id_convert = false; + mDo_id_convert = false; } afxMagicSpellData::afxMagicSpellData(const afxMagicSpellData& other, bool temp_clone) : afxChoreographerData(other, temp_clone) { - casting_dur = other.casting_dur; - delivery_dur = other.delivery_dur; - linger_dur = other.linger_dur; - n_casting_loops = other.n_casting_loops; - n_delivery_loops = other.n_delivery_loops; - n_linger_loops = other.n_linger_loops; - extra_casting_time = other.extra_casting_time; - extra_delivery_time = other.extra_delivery_time; - extra_linger_time = other.extra_linger_time; - do_move_interrupts = other.do_move_interrupts; - move_interrupt_speed = other.move_interrupt_speed; - missile_db = other.missile_db; - launch_on_server_signal = other.launch_on_server_signal; - primary_target_types = other.primary_target_types; + mCasting_dur = other.mCasting_dur; + mDelivery_dur = other.mDelivery_dur; + mLinger_dur = other.mLinger_dur; + mNum_casting_loops = other.mNum_casting_loops; + mNum_delivery_loops = other.mNum_delivery_loops; + mNum_linger_loops = other.mNum_linger_loops; + mExtra_casting_time = other.mExtra_casting_time; + mExtra_delivery_time = other.mExtra_delivery_time; + mExtra_linger_time = other.mExtra_linger_time; + mDo_move_interrupts = other.mDo_move_interrupts; + mMove_interrupt_speed = other.mMove_interrupt_speed; + mMissile_db = other.mMissile_db; + mLaunch_on_server_signal = other.mLaunch_on_server_signal; + mPrimary_target_types = other.mPrimary_target_types; - dummy_fx_entry = other.dummy_fx_entry; - do_id_convert = other.do_id_convert; + mDummy_fx_entry = other.mDummy_fx_entry; + mDo_id_convert = other.mDo_id_convert; - casting_fx_list = other.casting_fx_list; - launch_fx_list = other.launch_fx_list; - delivery_fx_list = other.delivery_fx_list; - impact_fx_list = other.impact_fx_list; - linger_fx_list = other.linger_fx_list; + mCasting_fx_list = other.mCasting_fx_list; + mLaunch_fx_list = other.mLaunch_fx_list; + mDelivery_fx_list = other.mDelivery_fx_list; + mImpact_fx_list = other.mImpact_fx_list; + mLinger_fx_list = other.mLinger_fx_list; } void afxMagicSpellData::reloadReset() { - casting_fx_list.clear(); - launch_fx_list.clear(); - delivery_fx_list.clear(); - impact_fx_list.clear(); - linger_fx_list.clear(); + mCasting_fx_list.clear(); + mLaunch_fx_list.clear(); + mDelivery_fx_list.clear(); + mImpact_fx_list.clear(); + mLinger_fx_list.clear(); } #define myOffset(field) Offset(field, afxMagicSpellData) @@ -219,54 +219,54 @@ void afxMagicSpellData::initPersistFields() // for each effect list, dummy_fx_entry is set and then a validator adds it to the appropriate effects list addGroup("Casting Stage"); - addField("castingDur", TypeF32, myOffset(casting_dur), + addField("castingDur", TypeF32, myOffset(mCasting_dur), "..."); - addField("numCastingLoops", TypeS32, myOffset(n_casting_loops), + addField("numCastingLoops", TypeS32, myOffset(mNum_casting_loops), "..."); - addField("extraCastingTime", TypeF32, myOffset(extra_casting_time), + addField("extraCastingTime", TypeF32, myOffset(mExtra_casting_time), "..."); - addFieldV("addCastingEffect", TYPEID(), Offset(dummy_fx_entry, afxMagicSpellData), &_castingPhrase, + addFieldV("addCastingEffect", TYPEID(), Offset(mDummy_fx_entry, afxMagicSpellData), &_castingPhrase, "..."); endGroup("Casting Stage"); addGroup("Delivery Stage"); - addField("deliveryDur", TypeF32, myOffset(delivery_dur), + addField("deliveryDur", TypeF32, myOffset(mDelivery_dur), "..."); - addField("numDeliveryLoops", TypeS32, myOffset(n_delivery_loops), + addField("numDeliveryLoops", TypeS32, myOffset(mNum_delivery_loops), "..."); - addField("extraDeliveryTime", TypeF32, myOffset(extra_delivery_time), + addField("extraDeliveryTime", TypeF32, myOffset(mExtra_delivery_time), "..."); - addFieldV("addLaunchEffect", TYPEID(), Offset(dummy_fx_entry, afxMagicSpellData), &_launchPhrase, + addFieldV("addLaunchEffect", TYPEID(), Offset(mDummy_fx_entry, afxMagicSpellData), &_launchPhrase, "..."); - addFieldV("addDeliveryEffect", TYPEID(), Offset(dummy_fx_entry, afxMagicSpellData), &_deliveryPhrase, + addFieldV("addDeliveryEffect", TYPEID(), Offset(mDummy_fx_entry, afxMagicSpellData), &_deliveryPhrase, "..."); endGroup("Delivery Stage"); addGroup("Linger Stage"); - addField("lingerDur", TypeF32, myOffset(linger_dur), + addField("lingerDur", TypeF32, myOffset(mLinger_dur), "..."); - addField("numLingerLoops", TypeS32, myOffset(n_linger_loops), + addField("numLingerLoops", TypeS32, myOffset(mNum_linger_loops), "..."); - addField("extraLingerTime", TypeF32, myOffset(extra_linger_time), + addField("extraLingerTime", TypeF32, myOffset(mExtra_linger_time), "..."); - addFieldV("addImpactEffect", TYPEID(), Offset(dummy_fx_entry, afxMagicSpellData), &_impactPhrase, + addFieldV("addImpactEffect", TYPEID(), Offset(mDummy_fx_entry, afxMagicSpellData), &_impactPhrase, "..."); - addFieldV("addLingerEffect", TYPEID(), Offset(dummy_fx_entry, afxMagicSpellData), &_lingerPhrase, + addFieldV("addLingerEffect", TYPEID(), Offset(mDummy_fx_entry, afxMagicSpellData), &_lingerPhrase, "..."); endGroup("Linger Stage"); // interrupt flags - addField("allowMovementInterrupts", TypeBool, myOffset(do_move_interrupts), + addField("allowMovementInterrupts", TypeBool, myOffset(mDo_move_interrupts), "..."); - addField("movementInterruptSpeed", TypeF32, myOffset(move_interrupt_speed), + addField("movementInterruptSpeed", TypeF32, myOffset(mMove_interrupt_speed), "..."); // delivers projectile spells - addField("missile", TYPEID(), myOffset(missile_db), + addField("missile", TYPEID(), myOffset(mMissile_db), "..."); - addField("launchOnServerSignal", TypeBool, myOffset(launch_on_server_signal), + addField("launchOnServerSignal", TypeBool, myOffset(mLaunch_on_server_signal), "..."); - addField("primaryTargetTypes", TypeS32, myOffset(primary_target_types), + addField("primaryTargetTypes", TypeS32, myOffset(mPrimary_target_types), "..."); @@ -286,8 +286,8 @@ bool afxMagicSpellData::onAdd() if (Parent::onAdd() == false) return false; - if (missile_db != NULL && delivery_dur == 0.0) - delivery_dur = -1; + if (mMissile_db != NULL && mDelivery_dur == 0.0) + mDelivery_dur = -1; return true; } @@ -311,61 +311,61 @@ void afxMagicSpellData::packData(BitStream* stream) { Parent::packData(stream); - stream->write(casting_dur); - stream->write(delivery_dur); - stream->write(linger_dur); + stream->write(mCasting_dur); + stream->write(mDelivery_dur); + stream->write(mLinger_dur); // - stream->write(n_casting_loops); - stream->write(n_delivery_loops); - stream->write(n_linger_loops); + stream->write(mNum_casting_loops); + stream->write(mNum_delivery_loops); + stream->write(mNum_linger_loops); // - stream->write(extra_casting_time); - stream->write(extra_delivery_time); - stream->write(extra_linger_time); + stream->write(mExtra_casting_time); + stream->write(mExtra_delivery_time); + stream->write(mExtra_linger_time); - stream->writeFlag(do_move_interrupts); - stream->write(move_interrupt_speed); + stream->writeFlag(mDo_move_interrupts); + stream->write(mMove_interrupt_speed); - writeDatablockID(stream, missile_db, mPacked); - stream->write(launch_on_server_signal); - stream->write(primary_target_types); + writeDatablockID(stream, mMissile_db, mPacked); + stream->write(mLaunch_on_server_signal); + stream->write(mPrimary_target_types); - pack_fx(stream, casting_fx_list, mPacked); - pack_fx(stream, launch_fx_list, mPacked); - pack_fx(stream, delivery_fx_list, mPacked); - pack_fx(stream, impact_fx_list, mPacked); - pack_fx(stream, linger_fx_list, mPacked); + pack_fx(stream, mCasting_fx_list, mPacked); + pack_fx(stream, mLaunch_fx_list, mPacked); + pack_fx(stream, mDelivery_fx_list, mPacked); + pack_fx(stream, mImpact_fx_list, mPacked); + pack_fx(stream, mLinger_fx_list, mPacked); } void afxMagicSpellData::unpackData(BitStream* stream) { Parent::unpackData(stream); - stream->read(&casting_dur); - stream->read(&delivery_dur); - stream->read(&linger_dur); + stream->read(&mCasting_dur); + stream->read(&mDelivery_dur); + stream->read(&mLinger_dur); // - stream->read(&n_casting_loops); - stream->read(&n_delivery_loops); - stream->read(&n_linger_loops); + stream->read(&mNum_casting_loops); + stream->read(&mNum_delivery_loops); + stream->read(&mNum_linger_loops); // - stream->read(&extra_casting_time); - stream->read(&extra_delivery_time); - stream->read(&extra_linger_time); + stream->read(&mExtra_casting_time); + stream->read(&mExtra_delivery_time); + stream->read(&mExtra_linger_time); - do_move_interrupts = stream->readFlag(); - stream->read(&move_interrupt_speed); + mDo_move_interrupts = stream->readFlag(); + stream->read(&mMove_interrupt_speed); - missile_db = (afxMagicMissileData*) readDatablockID(stream); - stream->read(&launch_on_server_signal); - stream->read(&primary_target_types); + mMissile_db = (afxMagicMissileData*) readDatablockID(stream); + stream->read(&mLaunch_on_server_signal); + stream->read(&mPrimary_target_types); - do_id_convert = true; - unpack_fx(stream, casting_fx_list); - unpack_fx(stream, launch_fx_list); - unpack_fx(stream, delivery_fx_list); - unpack_fx(stream, impact_fx_list); - unpack_fx(stream, linger_fx_list); + mDo_id_convert = true; + unpack_fx(stream, mCasting_fx_list); + unpack_fx(stream, mLaunch_fx_list); + unpack_fx(stream, mDelivery_fx_list); + unpack_fx(stream, mImpact_fx_list); + unpack_fx(stream, mLinger_fx_list); } bool afxMagicSpellData::writeField(StringTableEntry fieldname, const char* value) @@ -414,25 +414,25 @@ bool afxMagicSpellData::preload(bool server, String &errorStr) // Resolve objects transmitted from server if (!server) { - if (do_id_convert) + if (mDo_id_convert) { - SimObjectId missile_id = SimObjectId((uintptr_t)missile_db); + SimObjectId missile_id = SimObjectId((uintptr_t)mMissile_db); if (missile_id != 0) { // try to convert id to pointer - if (!Sim::findObject(missile_id, missile_db)) + if (!Sim::findObject(missile_id, mMissile_db)) { Con::errorf(ConsoleLogEntry::General, "afxMagicSpellData::preload() -- bad datablockId: 0x%x (missile)", missile_id); } } - expand_fx_list(casting_fx_list, "casting"); - expand_fx_list(launch_fx_list, "launch"); - expand_fx_list(delivery_fx_list, "delivery"); - expand_fx_list(impact_fx_list, "impact"); - expand_fx_list(linger_fx_list, "linger"); - do_id_convert = false; + expand_fx_list(mCasting_fx_list, "casting"); + expand_fx_list(mLaunch_fx_list, "launch"); + expand_fx_list(mDelivery_fx_list, "delivery"); + expand_fx_list(mImpact_fx_list, "impact"); + expand_fx_list(mLinger_fx_list, "linger"); + mDo_id_convert = false; } } @@ -441,14 +441,14 @@ bool afxMagicSpellData::preload(bool server, String &errorStr) void afxMagicSpellData::gatherConstraintDefs(Vector& defs) { - afxConstraintDef::gather_cons_defs(defs, casting_fx_list); - afxConstraintDef::gather_cons_defs(defs, launch_fx_list); - afxConstraintDef::gather_cons_defs(defs, delivery_fx_list); - afxConstraintDef::gather_cons_defs(defs, impact_fx_list); - afxConstraintDef::gather_cons_defs(defs, linger_fx_list); + afxConstraintDef::gather_cons_defs(defs, mCasting_fx_list); + afxConstraintDef::gather_cons_defs(defs, mLaunch_fx_list); + afxConstraintDef::gather_cons_defs(defs, mDelivery_fx_list); + afxConstraintDef::gather_cons_defs(defs, mImpact_fx_list); + afxConstraintDef::gather_cons_defs(defs, mLinger_fx_list); - if (missile_db) - missile_db->gather_cons_defs(defs); + if (mMissile_db) + mMissile_db->gather_cons_defs(defs); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// @@ -472,7 +472,7 @@ DefineEngineMethod(afxMagicSpellData, addCastingEffect, void, (afxEffectBaseData return; } - object->casting_fx_list.push_back(effect); + object->mCasting_fx_list.push_back(effect); } DefineEngineMethod(afxMagicSpellData, addLaunchEffect, void, (afxEffectBaseData* effect),, @@ -488,7 +488,7 @@ DefineEngineMethod(afxMagicSpellData, addLaunchEffect, void, (afxEffectBaseData* return; } - object->launch_fx_list.push_back(effect); + object->mLaunch_fx_list.push_back(effect); } DefineEngineMethod(afxMagicSpellData, addDeliveryEffect, void, (afxEffectBaseData* effect),, @@ -504,7 +504,7 @@ DefineEngineMethod(afxMagicSpellData, addDeliveryEffect, void, (afxEffectBaseDat return; } - object->delivery_fx_list.push_back(effect); + object->mDelivery_fx_list.push_back(effect); } DefineEngineMethod(afxMagicSpellData, addImpactEffect, void, (afxEffectBaseData* effect),, @@ -520,7 +520,7 @@ DefineEngineMethod(afxMagicSpellData, addImpactEffect, void, (afxEffectBaseData* return; } - object->impact_fx_list.push_back(effect); + object->mImpact_fx_list.push_back(effect); } DefineEngineMethod(afxMagicSpellData, addLingerEffect, void, (afxEffectBaseData* effect),, @@ -536,7 +536,7 @@ DefineEngineMethod(afxMagicSpellData, addLingerEffect, void, (afxEffectBaseData* return; } - object->linger_fx_list.push_back(effect); + object->mLinger_fx_list.push_back(effect); } @@ -568,9 +568,9 @@ IMPLEMENT_GLOBAL_CALLBACK( onCastingEnd, void, (), (), class CastingPhrase_C : public afxPhrase { typedef afxPhrase Parent; - ShapeBase* caster; - bool notify_castbar; - F32 castbar_progress; + ShapeBase* mCaster; + bool mNotify_castbar; + F32 mCastbar_progress; public: /*C*/ CastingPhrase_C(ShapeBase* caster, bool notify_castbar); virtual void start(F32 startstamp, F32 timestamp); @@ -582,17 +582,17 @@ public: CastingPhrase_C::CastingPhrase_C(ShapeBase* c, bool notify) : afxPhrase(false, true) { - caster = c; - notify_castbar = notify; - castbar_progress = 0.0f; + mCaster = c; + mNotify_castbar = notify; + mCastbar_progress = 0.0f; } void CastingPhrase_C::start(F32 startstamp, F32 timestamp) { Parent::start(startstamp, timestamp); //START - if (notify_castbar) + if (mNotify_castbar) { - castbar_progress = 0.0f; + mCastbar_progress = 0.0f; onCastingStart_callback(); } } @@ -601,16 +601,16 @@ void CastingPhrase_C::update(F32 dt, F32 timestamp) { Parent::update(dt, timestamp); - if (!notify_castbar) + if (!mNotify_castbar) return; if (dur > 0 && n_loops > 0) { F32 nfrac = (timestamp - starttime)/(dur*n_loops); - if (nfrac - castbar_progress > 1.0f/200.0f) + if (nfrac - mCastbar_progress > 1.0f/200.0f) { - castbar_progress = (nfrac < 1.0f) ? nfrac : 1.0f; - onCastingProgressUpdate_callback(castbar_progress); + mCastbar_progress = (nfrac < 1.0f) ? nfrac : 1.0f; + onCastingProgressUpdate_callback(mCastbar_progress); } } } @@ -618,20 +618,20 @@ void CastingPhrase_C::update(F32 dt, F32 timestamp) void CastingPhrase_C::stop(F32 timestamp) { Parent::stop(timestamp); - if (notify_castbar) + if (mCastbar_progress) { onCastingEnd_callback(); - notify_castbar = false; + mNotify_castbar = false; } } void CastingPhrase_C::interrupt(F32 timestamp) { Parent::interrupt(timestamp); - if (notify_castbar) + if (mNotify_castbar) { onCastingEnd_callback(); - notify_castbar = false; + mNotify_castbar = false; } } @@ -733,25 +733,25 @@ void afxMagicSpell::init() //mNetFlags.set(Ghostable | ScopeAlways); mNetFlags.clear(Ghostable | ScopeAlways); - datablock = NULL; - exeblock = NULL; - missile_db = NULL; + mDatablock = NULL; + mExeblock = NULL; + mMissile_db = NULL; - caster = NULL; - target = NULL; + mCaster = NULL; + mTarget = NULL; - caster_field = NULL; - target_field = NULL; + mCaster_field = NULL; + mTarget_field = NULL; - caster_scope_id = 0; - target_scope_id = 0; - target_is_shape = false; + mCaster_scope_id = 0; + mTarget_scope_id = 0; + mTarget_is_shape = false; - constraints_initialized = false; - scoping_initialized = false; + mConstraints_initialized = false; + mScoping_initialized = false; - spell_state = (U8) INACTIVE_STATE; - spell_elapsed = 0; + mSpell_state = (U8) INACTIVE_STATE; + mSpell_elapsed = 0; // define named constraints constraint_mgr->defineConstraint(OBJECT_CONSTRAINT, CASTER_CONS); @@ -764,24 +764,24 @@ void afxMagicSpell::init() for (S32 i = 0; i < NUM_PHRASES; i++) { - phrases[i] = NULL; - tfactors[i] = 1.0f; + mPhrases[i] = NULL; + mTfactors[i] = 1.0f; } - notify_castbar = false; - overall_time_factor = 1.0f; + mNotify_castbar = false; + mOverall_time_factor = 1.0f; - camera_cons_obj = 0; + mCamera_cons_obj = 0; - marks_mask = 0; + mMarks_mask = 0; - missile = NULL; - missile_is_armed = false; - impacted_obj = NULL; - impact_pos.zero(); - impact_norm.set(0,0,1); - impacted_scope_id = 0; - impacted_is_shape = false; + mMissile = NULL; + mMissile_is_armed = false; + mImpacted_obj = NULL; + mImpact_pos.zero(); + mImpact_norm.set(0,0,1); + mImpacted_scope_id = 0; + mImpacted_is_shape = false; } afxMagicSpell::afxMagicSpell() @@ -795,18 +795,18 @@ afxMagicSpell::afxMagicSpell(ShapeBase* caster, SceneObject* target) started_with_newop = false; init(); - this->caster = caster; + mCaster = caster; if (caster) { - caster_field = caster; + mCaster_field = caster; deleteNotify(caster); processAfter(caster); } - this->target = target; + mTarget = target; if (target) { - target_field = target; + mTarget_field = target; deleteNotify(target); } } @@ -815,26 +815,26 @@ afxMagicSpell::~afxMagicSpell() { for (S32 i = 0; i < NUM_PHRASES; i++) { - if (phrases[i]) + if (mPhrases[i]) { - phrases[i]->interrupt(spell_elapsed); - delete phrases[i]; + mPhrases[i]->interrupt(mSpell_elapsed); + delete mPhrases[i]; } } - if (missile) - missile->deleteObject(); + if (mMissile) + mMissile->deleteObject(); - if (missile_db && missile_db->isTempClone()) + if (mMissile_db && mMissile_db->isTempClone()) { - delete missile_db; - missile_db = 0; + delete mMissile_db; + mMissile_db = 0; } - if (datablock && datablock->isTempClone()) + if (mDatablock && mDatablock->isTempClone()) { - delete datablock; - datablock = 0; + delete mDatablock; + mDatablock = 0; } } @@ -844,8 +844,8 @@ afxMagicSpell::~afxMagicSpell() bool afxMagicSpell::onNewDataBlock(GameBaseData* dptr, bool reload) { - datablock = dynamic_cast(dptr); - if (!datablock || !Parent::onNewDataBlock(dptr, reload)) + mDatablock = dynamic_cast(dptr); + if (!mDatablock || !Parent::onNewDataBlock(dptr, reload)) return false; if (isServerObject() && started_with_newop) @@ -855,18 +855,18 @@ bool afxMagicSpell::onNewDataBlock(GameBaseData* dptr, bool reload) assignDynamicFieldsFrom(dptr, arcaneFX::sParameterFieldPrefix, true); } - exeblock = datablock; - missile_db = datablock->missile_db; + mExeblock = mDatablock; + mMissile_db = mDatablock->mMissile_db; if (isClientObject()) { // make a temp datablock clone if there are substitutions - if (datablock->getSubstitutionCount() > 0) + if (mDatablock->getSubstitutionCount() > 0) { - afxMagicSpellData* orig_db = datablock; - datablock = new afxMagicSpellData(*orig_db, true); - exeblock = orig_db; - missile_db = datablock->missile_db; + afxMagicSpellData* orig_db = mDatablock; + mDatablock = new afxMagicSpellData(*orig_db, true); + mExeblock = orig_db; + mMissile_db = mDatablock->mMissile_db; // Don't perform substitutions yet, the spell's dynamic fields haven't // arrived yet and the substitutions may refer to them. Hold off and do // in in the onAdd() method. @@ -875,13 +875,13 @@ bool afxMagicSpell::onNewDataBlock(GameBaseData* dptr, bool reload) else if (started_with_newop) { // make a temp datablock clone if there are substitutions - if (datablock->getSubstitutionCount() > 0) + if (mDatablock->getSubstitutionCount() > 0) { - afxMagicSpellData* orig_db = datablock; - datablock = new afxMagicSpellData(*orig_db, true); - exeblock = orig_db; - orig_db->performSubstitutions(datablock, this, ranking); - missile_db = datablock->missile_db; + afxMagicSpellData* orig_db = mDatablock; + mDatablock = new afxMagicSpellData(*orig_db, true); + mExeblock = orig_db; + orig_db->performSubstitutions(mDatablock, this, ranking); + mMissile_db = mDatablock->mMissile_db; } } @@ -913,12 +913,12 @@ bool afxMagicSpell::onAdd() if (isClientObject()) { - if (datablock->isTempClone()) + if (mDatablock->isTempClone()) { - afxMagicSpellData* orig_db = (afxMagicSpellData*)exeblock; - orig_db->performSubstitutions(datablock, this, ranking); - missile_db = datablock->missile_db; - notify_castbar = (notify_castbar && (datablock->casting_dur > 0.0f)); + afxMagicSpellData* orig_db = (afxMagicSpellData*)mExeblock; + orig_db->performSubstitutions(mDatablock, this, ranking); + mMissile_db = mDatablock->mMissile_db; + mNotify_castbar = (mNotify_castbar && (mDatablock->mCasting_dur > 0.0f)); } } else if (started_with_newop && !postpone_activation) @@ -940,37 +940,37 @@ void afxMagicSpell::onDeleteNotify(SimObject* obj) { // caster deleted? ShapeBase* shape = dynamic_cast(obj); - if (shape == caster) + if (shape == mCaster) { clearProcessAfter(); - caster = NULL; - caster_field = NULL; - caster_scope_id = 0; + mCaster = NULL; + mCaster_field = NULL; + mCaster_scope_id = 0; } // target deleted? SceneObject* scene_obj = dynamic_cast(obj); - if (scene_obj == target) + if (scene_obj == mTarget) { - target = NULL; - target_field = NULL; - target_scope_id = 0; - target_is_shape = false; + mTarget = NULL; + mTarget_field = NULL; + mTarget_scope_id = 0; + mTarget_is_shape = false; } // impacted_obj deleted? - if (scene_obj == impacted_obj) + if (scene_obj == mImpacted_obj) { - impacted_obj = NULL; - impacted_scope_id = 0; - impacted_is_shape = false; + mImpacted_obj = NULL; + mImpacted_scope_id = 0; + mImpacted_is_shape = false; } // missile deleted? afxMagicMissile* missile = dynamic_cast(obj); - if (missile != NULL && missile == this->missile) + if (missile != NULL && missile == mMissile) { - this->missile = NULL; + mMissile = NULL; } // something else @@ -980,9 +980,9 @@ void afxMagicSpell::onDeleteNotify(SimObject* obj) // static void afxMagicSpell::initPersistFields() { - addField("caster", TYPEID(), Offset(caster_field, afxMagicSpell), + addField("caster", TYPEID(), Offset(mCaster_field, afxMagicSpell), "..."); - addField("target", TYPEID(), Offset(target_field, afxMagicSpell), + addField("target", TYPEID(), Offset(mTarget_field, afxMagicSpell), "..."); Parent::initPersistFields(); @@ -993,31 +993,31 @@ void afxMagicSpell::initPersistFields() void afxMagicSpell::pack_constraint_info(NetConnection* conn, BitStream* stream) { // pack caster's ghost index or scope id if not yet ghosted - if (stream->writeFlag(caster != NULL)) + if (stream->writeFlag(mCaster != NULL)) { - S32 ghost_idx = conn->getGhostIndex(caster); + S32 ghost_idx = conn->getGhostIndex(mCaster); if (stream->writeFlag(ghost_idx != -1)) stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount); else { - bool bit = (caster) ? (caster->getScopeId() > 0) : false; + bool bit = (mCaster) ? (mCaster->getScopeId() > 0) : false; if (stream->writeFlag(bit)) - stream->writeInt(caster->getScopeId(), NetObject::SCOPE_ID_BITS); + stream->writeInt(mCaster->getScopeId(), NetObject::SCOPE_ID_BITS); } } // pack target's ghost index or scope id if not yet ghosted - if (stream->writeFlag(target != NULL)) + if (stream->writeFlag(mTarget != NULL)) { - S32 ghost_idx = conn->getGhostIndex(target); + S32 ghost_idx = conn->getGhostIndex(mTarget); if (stream->writeFlag(ghost_idx != -1)) stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount); else { - if (stream->writeFlag(target->getScopeId() > 0)) + if (stream->writeFlag(mTarget->getScopeId() > 0)) { - stream->writeInt(target->getScopeId(), NetObject::SCOPE_ID_BITS); - stream->writeFlag(dynamic_cast(target) != NULL); // is shape? + stream->writeInt(mTarget->getScopeId(), NetObject::SCOPE_ID_BITS); + stream->writeFlag(dynamic_cast(mTarget) != NULL); // is shape? } } } @@ -1027,51 +1027,51 @@ void afxMagicSpell::pack_constraint_info(NetConnection* conn, BitStream* stream) void afxMagicSpell::unpack_constraint_info(NetConnection* conn, BitStream* stream) { - caster = NULL; - caster_field = NULL; - caster_scope_id = 0; + mCaster = NULL; + mCaster_field = NULL; + mCaster_scope_id = 0; if (stream->readFlag()) // has caster { if (stream->readFlag()) // has ghost_idx { S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount); - caster = dynamic_cast(conn->resolveGhost(ghost_idx)); - if (caster) + mCaster = dynamic_cast(conn->resolveGhost(ghost_idx)); + if (mCaster) { - caster_field = caster; - deleteNotify(caster); - processAfter(caster); + mCaster_field = mCaster; + deleteNotify(mCaster); + processAfter(mCaster); } } else { if (stream->readFlag()) // has scope_id (is always a shape) - caster_scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); + mCaster_scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); } } - target = NULL; - target_field = NULL; - target_scope_id = 0; - target_is_shape = false; + mTarget = NULL; + mTarget_field = NULL; + mTarget_scope_id = 0; + mTarget_is_shape = false; if (stream->readFlag()) // has target { if (stream->readFlag()) // has ghost_idx { S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount); - target = dynamic_cast(conn->resolveGhost(ghost_idx)); - if (target) + mTarget = dynamic_cast(conn->resolveGhost(ghost_idx)); + if (mTarget) { - target_field = target; - deleteNotify(target); + mTarget_field = mTarget; + deleteNotify(mTarget); } } else { if (stream->readFlag()) // has scope_id { - target_scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); - target_is_shape = stream->readFlag(); // is shape? + mTarget_scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); + mTarget_is_shape = stream->readFlag(); // is shape? } } } @@ -1108,12 +1108,12 @@ U32 afxMagicSpell::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) stream->write(exec_conds_mask); // flag if this client owns the spellcaster - bool client_owns_caster = is_caster_client(caster, dynamic_cast(conn)); + bool client_owns_caster = is_caster_client(mCaster, dynamic_cast(conn)); stream->writeFlag(client_owns_caster); // pack per-phrase time-factor values for (S32 i = 0; i < NUM_PHRASES; i++) - stream->write(tfactors[i]); + stream->write(mTfactors[i]); // flag if this conn is zoned-in yet bool zoned_in = client_owns_caster; @@ -1129,10 +1129,10 @@ U32 afxMagicSpell::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) // StateEvent or SyncEvent if (stream->writeFlag((mask & StateEventMask) || (mask & SyncEventMask))) { - stream->write(marks_mask); - stream->write(spell_state); + stream->write(mMarks_mask); + stream->write(mSpell_state); stream->write(state_elapsed()); - stream->write(spell_elapsed); + stream->write(mSpell_elapsed); } // SyncEvent @@ -1142,44 +1142,44 @@ U32 afxMagicSpell::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) } // LaunchEvent - if (stream->writeFlag((mask & LaunchEventMask) && (marks_mask & MARK_LAUNCH) && missile)) + if (stream->writeFlag((mask & LaunchEventMask) && (mMarks_mask & MARK_LAUNCH) && mMissile)) { F32 vel; Point3F vel_vec; - missile->getStartingVelocityValues(vel, vel_vec); + mMissile->getStartingVelocityValues(vel, vel_vec); // pack launch vector and velocity stream->write(vel); mathWrite(*stream, vel_vec); } // ImpactEvent - if (stream->writeFlag(((mask & ImpactEventMask) || (mask & SyncEventMask)) && (marks_mask & MARK_IMPACT))) + if (stream->writeFlag(((mask & ImpactEventMask) || (mask & SyncEventMask)) && (mMarks_mask & MARK_IMPACT))) { // pack impact objects's ghost index or scope id if not yet ghosted - if (stream->writeFlag(impacted_obj != NULL)) + if (stream->writeFlag(mImpacted_obj != NULL)) { - S32 ghost_idx = conn->getGhostIndex(impacted_obj); + S32 ghost_idx = conn->getGhostIndex(mImpacted_obj); if (stream->writeFlag(ghost_idx != -1)) stream->writeRangedU32(U32(ghost_idx), 0, NetConnection::MaxGhostCount); else { - if (stream->writeFlag(impacted_obj->getScopeId() > 0)) + if (stream->writeFlag(mImpacted_obj->getScopeId() > 0)) { - stream->writeInt(impacted_obj->getScopeId(), NetObject::SCOPE_ID_BITS); - stream->writeFlag(dynamic_cast(impacted_obj) != NULL); + stream->writeInt(mImpacted_obj->getScopeId(), NetObject::SCOPE_ID_BITS); + stream->writeFlag(dynamic_cast(mImpacted_obj) != NULL); } } } // pack impact position and normal - mathWrite(*stream, impact_pos); - mathWrite(*stream, impact_norm); + mathWrite(*stream, mImpact_pos); + mathWrite(*stream, mImpact_norm); stream->write(exec_conds_mask); ShapeBase* temp_shape; - stream->writeFlag(caster != 0 && caster->getDamageState() == ShapeBase::Enabled); - temp_shape = dynamic_cast(target); + stream->writeFlag(mCaster != 0 && mCaster->getDamageState() == ShapeBase::Enabled); + temp_shape = dynamic_cast(mTarget); stream->writeFlag(temp_shape != 0 && temp_shape->getDamageState() == ShapeBase::Enabled); - temp_shape = dynamic_cast(impacted_obj); + temp_shape = dynamic_cast(mImpacted_obj); stream->writeFlag(temp_shape != 0 && temp_shape->getDamageState() == ShapeBase::Enabled); } @@ -1201,14 +1201,14 @@ bool afxMagicSpell::remap_builtin_constraint(SceneObject* obj, const char* cons_ return true; if (cons_name_ste == TARGET_CONS) { - if (obj && target && obj != target && !target_cons_id.undefined()) + if (obj && mTarget && obj != mTarget && !mTarget_cons_id.undefined()) { - target = obj; - constraint_mgr->setReferenceObject(target_cons_id, target); + mTarget = obj; + constraint_mgr->setReferenceObject(mTarget_cons_id, mTarget); if (isServerObject()) { - if (target->isScopeable()) - constraint_mgr->addScopeableObject(target); + if (mTarget->isScopeable()) + constraint_mgr->addScopeableObject(mTarget); } } return true; @@ -1271,11 +1271,11 @@ void afxMagicSpell::unpackUpdate(NetConnection * conn, BitStream * stream) // enable castbar updates bool client_owns_caster = stream->readFlag(); if (client_owns_caster) - notify_castbar = Con::isFunction("onCastingStart"); + mNotify_castbar = Con::isFunction("onCastingStart"); // unpack per-phrase time-factor values for (S32 i = 0; i < NUM_PHRASES; i++) - stream->read(&tfactors[i]); + stream->read(&mTfactors[i]); // if client is marked as fully zoned in if ((zoned_in = stream->readFlag()) == true) @@ -1294,7 +1294,7 @@ void afxMagicSpell::unpackUpdate(NetConnection * conn, BitStream * stream) stream->read(&new_spell_state); stream->read(&new_state_elapsed); stream->read(&new_spell_elapsed); - marks_mask = new_marks_mask; + mMarks_mask = new_marks_mask; } // SyncEvent @@ -1310,42 +1310,42 @@ void afxMagicSpell::unpackUpdate(NetConnection * conn, BitStream * stream) F32 vel; Point3F vel_vec; stream->read(&vel); mathRead(*stream, &vel_vec); - if (missile) + if (mMissile) { - missile->setStartingVelocity(vel); - missile->setStartingVelocityVector(vel_vec); + mMissile->setStartingVelocity(vel); + mMissile->setStartingVelocityVector(vel_vec); } } // ImpactEvent if (stream->readFlag()) { - if (impacted_obj) - clearNotify(impacted_obj); - impacted_obj = NULL; - impacted_scope_id = 0; - impacted_is_shape = false; + if (mImpacted_obj) + clearNotify(mImpacted_obj); + mImpacted_obj = NULL; + mImpacted_scope_id = 0; + mImpacted_is_shape = false; if (stream->readFlag()) // is impacted_obj { if (stream->readFlag()) // is ghost_idx { S32 ghost_idx = stream->readRangedU32(0, NetConnection::MaxGhostCount); - impacted_obj = dynamic_cast(conn->resolveGhost(ghost_idx)); - if (impacted_obj) - deleteNotify(impacted_obj); + mImpacted_obj = dynamic_cast(conn->resolveGhost(ghost_idx)); + if (mImpacted_obj) + deleteNotify(mImpacted_obj); } else { if (stream->readFlag()) // has scope_id { - impacted_scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); - impacted_is_shape = stream->readFlag(); // is shape? + mImpacted_scope_id = stream->readInt(NetObject::SCOPE_ID_BITS); + mImpacted_is_shape = stream->readFlag(); // is shape? } } } - mathRead(*stream, &impact_pos); - mathRead(*stream, &impact_norm); + mathRead(*stream, &mImpact_pos); + mathRead(*stream, &mImpact_norm); stream->read(&exec_conds_mask); bool caster_alive = stream->readFlag(); @@ -1353,18 +1353,18 @@ void afxMagicSpell::unpackUpdate(NetConnection * conn, BitStream * stream) bool impacted_alive = stream->readFlag(); afxConstraint* cons; - if ((cons = constraint_mgr->getConstraint(caster_cons_id)) != 0) + if ((cons = constraint_mgr->getConstraint(mCaster_cons_id)) != 0) cons->setLivingState(caster_alive); - if ((cons = constraint_mgr->getConstraint(target_cons_id)) != 0) + if ((cons = constraint_mgr->getConstraint(mTarget_cons_id)) != 0) cons->setLivingState(target_alive); - if ((cons = constraint_mgr->getConstraint(impacted_cons_id)) != 0) + if ((cons = constraint_mgr->getConstraint(mImpacted_cons_id)) != 0) cons->setLivingState(impacted_alive); } //~~~~~~~~~~~~~~~~~~~~// if (!zoned_in) - spell_state = LATE_STATE; + mSpell_state = LATE_STATE; // need to adjust state info to get all synced up with spell on server if (do_sync_event && !initial_update) @@ -1383,23 +1383,23 @@ bool afxMagicSpell::state_expired() { afxPhrase* phrase = NULL; - switch (spell_state) + switch (mSpell_state) { case CASTING_STATE: - phrase = phrases[CASTING_PHRASE]; + phrase = mPhrases[CASTING_PHRASE]; break; case DELIVERY_STATE: - phrase = phrases[DELIVERY_PHRASE]; + phrase = mPhrases[DELIVERY_PHRASE]; break; case LINGER_STATE: - phrase = phrases[LINGER_PHRASE]; + phrase = mPhrases[LINGER_PHRASE]; break; } if (phrase) { - if (phrase->expired(spell_elapsed)) - return (!phrase->recycle(spell_elapsed)); + if (phrase->expired(mSpell_elapsed)) + return (!phrase->recycle(mSpell_elapsed)); return false; } @@ -1410,83 +1410,83 @@ F32 afxMagicSpell::state_elapsed() { afxPhrase* phrase = NULL; - switch (spell_state) + switch (mSpell_state) { case CASTING_STATE: - phrase = phrases[CASTING_PHRASE]; + phrase = mPhrases[CASTING_PHRASE]; break; case DELIVERY_STATE: - phrase = phrases[DELIVERY_PHRASE]; + phrase = mPhrases[DELIVERY_PHRASE]; break; case LINGER_STATE: - phrase = phrases[LINGER_PHRASE]; + phrase = mPhrases[LINGER_PHRASE]; break; } - return (phrase) ? phrase->elapsed(spell_elapsed) : 0.0f; + return (phrase) ? phrase->elapsed(mSpell_elapsed) : 0.0f; } void afxMagicSpell::init_constraints() { - if (constraints_initialized) + if (mConstraints_initialized) { //Con::printf("CONSTRAINTS ALREADY INITIALIZED"); return; } Vector defs; - datablock->gatherConstraintDefs(defs); + mDatablock->gatherConstraintDefs(defs); constraint_mgr->initConstraintDefs(defs, isServerObject()); if (isServerObject()) { - caster_cons_id = constraint_mgr->setReferenceObject(CASTER_CONS, caster); - target_cons_id = constraint_mgr->setReferenceObject(TARGET_CONS, target); + mCaster_cons_id = constraint_mgr->setReferenceObject(CASTER_CONS, mCaster); + mTarget_cons_id = constraint_mgr->setReferenceObject(TARGET_CONS, mTarget); #if defined(AFX_CAP_SCOPE_TRACKING) - if (caster && caster->isScopeable()) - constraint_mgr->addScopeableObject(caster); + if (mCaster && mCaster->isScopeable()) + constraint_mgr->addScopeableObject(mCaster); - if (target && target->isScopeable()) - constraint_mgr->addScopeableObject(target); + if (mTarget && mTarget->isScopeable()) + constraint_mgr->addScopeableObject(mTarget); #endif // find local camera - camera_cons_obj = get_camera(); - if (camera_cons_obj) - camera_cons_id = constraint_mgr->setReferenceObject(CAMERA_CONS, camera_cons_obj); + mCamera_cons_obj = get_camera(); + if (mCamera_cons_obj) + mCamera_cons_id = constraint_mgr->setReferenceObject(CAMERA_CONS, mCamera_cons_obj); } else // if (isClientObject()) { - if (caster) - caster_cons_id = constraint_mgr->setReferenceObject(CASTER_CONS, caster); - else if (caster_scope_id > 0) - caster_cons_id = constraint_mgr->setReferenceObjectByScopeId(CASTER_CONS, caster_scope_id, true); + if (mCaster) + mCaster_cons_id = constraint_mgr->setReferenceObject(CASTER_CONS, mCaster); + else if (mCaster_scope_id > 0) + mCaster_cons_id = constraint_mgr->setReferenceObjectByScopeId(CASTER_CONS, mCaster_scope_id, true); - if (target) - target_cons_id = constraint_mgr->setReferenceObject(TARGET_CONS, target); - else if (target_scope_id > 0) - target_cons_id = constraint_mgr->setReferenceObjectByScopeId(TARGET_CONS, target_scope_id, target_is_shape); + if (mTarget) + mTarget_cons_id = constraint_mgr->setReferenceObject(TARGET_CONS, mTarget); + else if (mTarget_scope_id > 0) + mTarget_cons_id = constraint_mgr->setReferenceObjectByScopeId(TARGET_CONS, mTarget_scope_id, mTarget_is_shape); // find local camera - camera_cons_obj = get_camera(); - if (camera_cons_obj) - camera_cons_id = constraint_mgr->setReferenceObject(CAMERA_CONS, camera_cons_obj); + mCamera_cons_obj = get_camera(); + if (mCamera_cons_obj) + mCamera_cons_id = constraint_mgr->setReferenceObject(CAMERA_CONS, mCamera_cons_obj); // find local listener Point3F listener_pos; listener_pos = SFX->getListener().getTransform().getPosition(); - listener_cons_id = constraint_mgr->setReferencePoint(LISTENER_CONS, listener_pos); + mListener_cons_id = constraint_mgr->setReferencePoint(LISTENER_CONS, listener_pos); } constraint_mgr->adjustProcessOrdering(this); - constraints_initialized = true; + mConstraints_initialized = true; } void afxMagicSpell::init_scoping() { - if (scoping_initialized) + if (mScoping_initialized) { //Con::printf("SCOPING ALREADY INITIALIZED"); return; @@ -1504,65 +1504,65 @@ void afxMagicSpell::init_scoping() mNetFlags.set(Ghostable); setScopeAlways(); } - scoping_initialized = true; + mScoping_initialized = true; } } void afxMagicSpell::setup_casting_fx() { if (isServerObject()) - phrases[CASTING_PHRASE] = new afxPhrase(isServerObject(), true); + mPhrases[CASTING_PHRASE] = new afxPhrase(isServerObject(), true); else - phrases[CASTING_PHRASE] = new CastingPhrase_C(caster, notify_castbar); + mPhrases[CASTING_PHRASE] = new CastingPhrase_C(mCaster, mNotify_castbar); - if (phrases[CASTING_PHRASE]) - phrases[CASTING_PHRASE]->init(datablock->casting_fx_list, datablock->casting_dur, this, - tfactors[CASTING_PHRASE], datablock->n_casting_loops, 0, - datablock->extra_casting_time); + if (mPhrases[CASTING_PHRASE]) + mPhrases[CASTING_PHRASE]->init(mDatablock->mCasting_fx_list, mDatablock->mCasting_dur, this, + mTfactors[CASTING_PHRASE], mDatablock->mNum_casting_loops, 0, + mDatablock->mExtra_casting_time); } void afxMagicSpell::setup_launch_fx() { - phrases[LAUNCH_PHRASE] = new afxPhrase(isServerObject(), false); - if (phrases[LAUNCH_PHRASE]) - phrases[LAUNCH_PHRASE]->init(datablock->launch_fx_list, -1, this, - tfactors[LAUNCH_PHRASE], 1); + mPhrases[LAUNCH_PHRASE] = new afxPhrase(isServerObject(), false); + if (mPhrases[LAUNCH_PHRASE]) + mPhrases[LAUNCH_PHRASE]->init(mDatablock->mLaunch_fx_list, -1, this, + mTfactors[LAUNCH_PHRASE], 1); } void afxMagicSpell::setup_delivery_fx() { - phrases[DELIVERY_PHRASE] = new afxPhrase(isServerObject(), true); - if (phrases[DELIVERY_PHRASE]) + mPhrases[DELIVERY_PHRASE] = new afxPhrase(isServerObject(), true); + if (mPhrases[DELIVERY_PHRASE]) { - phrases[DELIVERY_PHRASE]->init(datablock->delivery_fx_list, datablock->delivery_dur, this, - tfactors[DELIVERY_PHRASE], datablock->n_delivery_loops, 0, - datablock->extra_delivery_time); + mPhrases[DELIVERY_PHRASE]->init(mDatablock->mDelivery_fx_list, mDatablock->mDelivery_dur, this, + mTfactors[DELIVERY_PHRASE], mDatablock->mNum_delivery_loops, 0, + mDatablock->mExtra_delivery_time); } } void afxMagicSpell::setup_impact_fx() { - phrases[IMPACT_PHRASE] = new afxPhrase(isServerObject(), false); - if (phrases[IMPACT_PHRASE]) + mPhrases[IMPACT_PHRASE] = new afxPhrase(isServerObject(), false); + if (mPhrases[IMPACT_PHRASE]) { - phrases[IMPACT_PHRASE]->init(datablock->impact_fx_list, -1, this, - tfactors[IMPACT_PHRASE], 1); + mPhrases[IMPACT_PHRASE]->init(mDatablock->mImpact_fx_list, -1, this, + mTfactors[IMPACT_PHRASE], 1); } } void afxMagicSpell::setup_linger_fx() { - phrases[LINGER_PHRASE] = new afxPhrase(isServerObject(), true); - if (phrases[LINGER_PHRASE]) - phrases[LINGER_PHRASE]->init(datablock->linger_fx_list, datablock->linger_dur, this, - tfactors[LINGER_PHRASE], datablock->n_linger_loops, 0, - datablock->extra_linger_time); + mPhrases[LINGER_PHRASE] = new afxPhrase(isServerObject(), true); + if (mPhrases[LINGER_PHRASE]) + mPhrases[LINGER_PHRASE]->init(mDatablock->mLinger_fx_list, mDatablock->mLinger_dur, this, + mTfactors[LINGER_PHRASE], mDatablock->mNum_linger_loops, 0, + mDatablock->mExtra_linger_time); } bool afxMagicSpell::cleanup_over() { for (S32 i = 0; i < NUM_PHRASES; i++) - if (phrases[i] && !phrases[i]->isEmpty()) + if (mPhrases[i] && !mPhrases[i]->isEmpty()) return false; return true; @@ -1576,67 +1576,67 @@ bool afxMagicSpell::cleanup_over() void afxMagicSpell::init_missile_s(afxMagicMissileData* mm_db) { - if (missile) - clearNotify(missile); + if (mMissile) + clearNotify(mMissile); // create the missile - missile = new afxMagicMissile(true, false); - missile->setSubstitutionData(this, ranking); - missile->setDataBlock(mm_db); - missile->setChoreographer(this); - if (!missile->registerObject()) + mMissile = new afxMagicMissile(true, false); + mMissile->setSubstitutionData(this, ranking); + mMissile->setDataBlock(mm_db); + mMissile->setChoreographer(this); + if (!mMissile->registerObject()) { Con::errorf("afxMagicSpell: failed to register missile instance."); - delete missile; - missile = NULL; + delete mMissile; + mMissile = NULL; } - if (missile) + if (mMissile) { - deleteNotify(missile); - registerForCleanup(missile); + deleteNotify(mMissile); + registerForCleanup(mMissile); } } void afxMagicSpell::launch_missile_s() { - if (missile) + if (mMissile) { - missile->launch(); - constraint_mgr->setReferenceObject(MISSILE_CONS, missile); + mMissile->launch(); + constraint_mgr->setReferenceObject(MISSILE_CONS, mMissile); } } void afxMagicSpell::init_missile_c(afxMagicMissileData* mm_db) { - if (missile) - clearNotify(missile); + if (mMissile) + clearNotify(mMissile); // create the missile - missile = new afxMagicMissile(false, true); - missile->setSubstitutionData(this, ranking); - missile->setDataBlock(mm_db); - missile->setChoreographer(this); - if (!missile->registerObject()) + mMissile = new afxMagicMissile(false, true); + mMissile->setSubstitutionData(this, ranking); + mMissile->setDataBlock(mm_db); + mMissile->setChoreographer(this); + if (!mMissile->registerObject()) { Con::errorf("afxMagicSpell: failed to register missile instance."); - delete missile; - missile = NULL; + delete mMissile; + mMissile = NULL; } - if (missile) + if (mMissile) { - deleteNotify(missile); - registerForCleanup(missile); + deleteNotify(mMissile); + registerForCleanup(mMissile); } } void afxMagicSpell::launch_missile_c() { - if (missile) + if (mMissile) { - missile->launch(); - constraint_mgr->setReferenceObject(MISSILE_CONS, missile); + mMissile->launch(); + constraint_mgr->setReferenceObject(MISSILE_CONS, mMissile); } } @@ -1652,19 +1652,19 @@ void afxMagicSpell::impactNotify(const Point3F& p, const Point3F& n, SceneObject return; ///impact_time_ms = spell_elapsed_ms; - if (impacted_obj) - clearNotify(impacted_obj); - impacted_obj = obj; - impact_pos = p; - impact_norm = n; + if (mImpacted_obj) + clearNotify(mImpacted_obj); + mImpacted_obj = obj; + mImpact_pos = p; + mImpact_norm = n; - if (impacted_obj != NULL) + if (mImpacted_obj != NULL) { - deleteNotify(impacted_obj); + deleteNotify(mImpacted_obj); exec_conds_mask |= IMPACTED_SOMETHING; - if (impacted_obj == target) + if (mImpacted_obj == mTarget) exec_conds_mask |= IMPACTED_TARGET; - if (impacted_obj->getTypeMask() & datablock->primary_target_types) + if (mImpacted_obj->getTypeMask() & mDatablock->mPrimary_target_types) exec_conds_mask |= IMPACTED_PRIMARY; } @@ -1673,9 +1673,9 @@ void afxMagicSpell::impactNotify(const Point3F& p, const Point3F& n, SceneObject postSpellEvent(IMPACT_EVENT); - if (missile) - clearNotify(missile); - missile = NULL; + if (mMissile) + clearNotify(mMissile); + mMissile = NULL; } void afxMagicSpell::executeScriptEvent(const char* method, afxConstraint* cons, @@ -1692,9 +1692,9 @@ void afxMagicSpell::executeScriptEvent(const char* method, afxConstraint* cons, aa.axis.x, aa.axis.y, aa.axis.z, aa.angle); // CALL SCRIPT afxChoreographerData::method(%spell, %caster, %constraint, %transform, %data) - Con::executef(exeblock, method, + Con::executef(mExeblock, method, getIdString(), - (caster) ? caster->getIdString() : "", + (mCaster) ? mCaster->getIdString() : "", (cons_obj) ? cons_obj->getIdString() : "", arg_buf, data); @@ -1709,7 +1709,7 @@ void afxMagicSpell::inflictDamage(const char * label, const char* flavor, SimObj // CALL SCRIPT afxMagicSpellData::onDamage() // onDamage(%spell, %label, %type, %damaged_obj, %amount, %count, %pos, %ad_amount, // %radius, %impulse) - datablock->onDamage_callback(this, label, flavor, target_id, amount, n, pos, ad_amount, radius, impulse); + mDatablock->onDamage_callback(this, label, flavor, target_id, amount, n, pos, ad_amount, radius, impulse); } @@ -1718,68 +1718,68 @@ void afxMagicSpell::inflictDamage(const char * label, const char* flavor, SimObj void afxMagicSpell::process_server() { - if (spell_state != INACTIVE_STATE) - spell_elapsed += TickSec; + if (mSpell_state != INACTIVE_STATE) + mSpell_elapsed += TickSec; - U8 pending_state = spell_state; + U8 pending_state = mSpell_state; // check for state changes - switch (spell_state) + switch (mSpell_state) { case INACTIVE_STATE: - if (marks_mask & MARK_ACTIVATE) + if (mMarks_mask & MARK_ACTIVATE) pending_state = CASTING_STATE; break; case CASTING_STATE: - if (datablock->casting_dur > 0.0f && datablock->do_move_interrupts && is_caster_moving()) + if (mDatablock->mCasting_dur > 0.0f && mDatablock->mDo_move_interrupts && is_caster_moving()) { - displayScreenMessage(caster, "SPELL INTERRUPTED."); + displayScreenMessage(mCaster, "SPELL INTERRUPTED."); postSpellEvent(INTERRUPT_SPELL_EVENT); } - if (marks_mask & MARK_INTERRUPT_CASTING) + if (mMarks_mask & MARK_INTERRUPT_CASTING) pending_state = CLEANUP_STATE; - else if (marks_mask & MARK_END_CASTING) + else if (mMarks_mask & MARK_END_CASTING) pending_state = DELIVERY_STATE; - else if (marks_mask & MARK_LAUNCH) + else if (mMarks_mask & MARK_LAUNCH) pending_state = DELIVERY_STATE; else if (state_expired()) pending_state = DELIVERY_STATE; break; case DELIVERY_STATE: - if (marks_mask & MARK_INTERRUPT_DELIVERY) + if (mMarks_mask & MARK_INTERRUPT_DELIVERY) pending_state = CLEANUP_STATE; - else if (marks_mask & MARK_END_DELIVERY) + else if (mMarks_mask & MARK_END_DELIVERY) pending_state = LINGER_STATE; - else if (marks_mask & MARK_IMPACT) + else if (mMarks_mask & MARK_IMPACT) pending_state = LINGER_STATE; else if (state_expired()) pending_state = LINGER_STATE; break; case LINGER_STATE: - if (marks_mask & MARK_INTERRUPT_LINGER) + if (mMarks_mask & MARK_INTERRUPT_LINGER) pending_state = CLEANUP_STATE; - else if (marks_mask & MARK_END_LINGER) + else if (mMarks_mask & MARK_END_LINGER) pending_state = CLEANUP_STATE; - else if (marks_mask & MARK_SHUTDOWN) + else if (mMarks_mask & MARK_SHUTDOWN) pending_state = CLEANUP_STATE; else if (state_expired()) pending_state = CLEANUP_STATE; break; case CLEANUP_STATE: - if ((marks_mask & MARK_INTERRUPT_CLEANUP) || cleanup_over()) + if ((mMarks_mask & MARK_INTERRUPT_CLEANUP) || cleanup_over()) pending_state = DONE_STATE; break; } - if (spell_state != pending_state) + if (mSpell_state != pending_state) change_state_s(pending_state); - if (spell_state == INACTIVE_STATE) + if (mSpell_state == INACTIVE_STATE) return; //--------------------------// @@ -1788,23 +1788,23 @@ void afxMagicSpell::process_server() constraint_mgr->sample(TickSec, Platform::getVirtualMilliseconds()); for (S32 i = 0; i < NUM_PHRASES; i++) - if (phrases[i]) - phrases[i]->update(TickSec, spell_elapsed); + if (mPhrases[i]) + mPhrases[i]->update(TickSec, mSpell_elapsed); - if (missile_is_armed) + if (mMissile_is_armed) { launch_missile_s(); - missile_is_armed = false; + mMissile_is_armed = false; } } void afxMagicSpell::change_state_s(U8 pending_state) { - if (spell_state == pending_state) + if (mSpell_state == pending_state) return; // LEAVING THIS STATE - switch (spell_state) + switch (mSpell_state) { case INACTIVE_STATE: break; @@ -1823,7 +1823,7 @@ void afxMagicSpell::change_state_s(U8 pending_state) break; } - spell_state = pending_state; + mSpell_state = pending_state; // ENTERING THIS STATE switch (pending_state) @@ -1851,29 +1851,29 @@ void afxMagicSpell::enter_done_state_s() { postSpellEvent(DEACTIVATE_EVENT); - if (marks_mask & MARK_INTERRUPTS) + if (mMarks_mask & MARK_INTERRUPTS) { Sim::postEvent(this, new ObjectDeleteEvent, Sim::getCurrentTime() + 500); } else { - F32 done_time = spell_elapsed; + F32 done_time = mSpell_elapsed; for (S32 i = 0; i < NUM_PHRASES; i++) { - if (phrases[i]) + if (mPhrases[i]) { F32 phrase_done; - if (phrases[i]->willStop() && phrases[i]->isInfinite()) - phrase_done = spell_elapsed + phrases[i]->calcAfterLife(); + if (mPhrases[i]->willStop() && mPhrases[i]->isInfinite()) + phrase_done = mSpell_elapsed + mPhrases[i]->calcAfterLife(); else - phrase_done = phrases[i]->calcDoneTime(); + phrase_done = mPhrases[i]->calcDoneTime(); if (phrase_done > done_time) done_time = phrase_done; } } - F32 time_left = done_time - spell_elapsed; + F32 time_left = done_time - mSpell_elapsed; if (time_left < 0) time_left = 0; @@ -1881,7 +1881,7 @@ void afxMagicSpell::enter_done_state_s() } // CALL SCRIPT afxMagicSpellData::onDeactivate(%spell) - datablock->onDeactivate_callback(this); + mDatablock->onDeactivate_callback(this); } void afxMagicSpell::enter_casting_state_s() @@ -1891,90 +1891,90 @@ void afxMagicSpell::enter_casting_state_s() // stamp constraint-mgr starting time and reset spell timer constraint_mgr->setStartTime(Platform::getVirtualMilliseconds()); - spell_elapsed = 0; + mSpell_elapsed = 0; setup_dynamic_constraints(); // start casting effects setup_casting_fx(); - if (phrases[CASTING_PHRASE]) - phrases[CASTING_PHRASE]->start(spell_elapsed, spell_elapsed); + if (mPhrases[CASTING_PHRASE]) + mPhrases[CASTING_PHRASE]->start(mSpell_elapsed, mSpell_elapsed); // initialize missile - if (missile_db) + if (mMissile_db) { - missile_db = missile_db->cloneAndPerformSubstitutions(this, ranking); - init_missile_s(missile_db); + mMissile_db = mMissile_db->cloneAndPerformSubstitutions(this, ranking); + init_missile_s(mMissile_db); } } void afxMagicSpell::leave_casting_state_s() { - if (phrases[CASTING_PHRASE]) + if (mPhrases[CASTING_PHRASE]) { - if (marks_mask & MARK_INTERRUPT_CASTING) + if (mMarks_mask & MARK_INTERRUPT_CASTING) { //Con::printf("INTERRUPT CASTING (S)"); - phrases[CASTING_PHRASE]->interrupt(spell_elapsed); + mPhrases[CASTING_PHRASE]->interrupt(mSpell_elapsed); } else { //Con::printf("LEAVING CASTING (S)"); - phrases[CASTING_PHRASE]->stop(spell_elapsed); + mPhrases[CASTING_PHRASE]->stop(mSpell_elapsed); } } - if (marks_mask & MARK_INTERRUPT_CASTING) + if (mMarks_mask & MARK_INTERRUPT_CASTING) { // CALL SCRIPT afxMagicSpellData::onInterrupt(%spell, %caster) - datablock->onInterrupt_callback(this, caster); + mDatablock->onInterrupt_callback(this, mCaster); } } void afxMagicSpell::enter_delivery_state_s() { // CALL SCRIPT afxMagicSpellData::onLaunch(%spell, %caster, %target, %missile) - datablock->onLaunch_callback(this, caster, target, missile); + mDatablock->onLaunch_callback(this, mCaster, mTarget, mMissile); - if (datablock->launch_on_server_signal) + if (mDatablock->mLaunch_on_server_signal) postSpellEvent(LAUNCH_EVENT); - missile_is_armed = true; + mMissile_is_armed = true; // start launch effects setup_launch_fx(); - if (phrases[LAUNCH_PHRASE]) - phrases[LAUNCH_PHRASE]->start(spell_elapsed, spell_elapsed); //START + if (mPhrases[LAUNCH_PHRASE]) + mPhrases[LAUNCH_PHRASE]->start(mSpell_elapsed, mSpell_elapsed); //START // start delivery effects setup_delivery_fx(); - if (phrases[DELIVERY_PHRASE]) - phrases[DELIVERY_PHRASE]->start(spell_elapsed, spell_elapsed); //START + if (mPhrases[DELIVERY_PHRASE]) + mPhrases[DELIVERY_PHRASE]->start(mSpell_elapsed, mSpell_elapsed); //START } void afxMagicSpell::leave_delivery_state_s() { - if (phrases[DELIVERY_PHRASE]) + if (mPhrases[DELIVERY_PHRASE]) { - if (marks_mask & MARK_INTERRUPT_DELIVERY) + if (mMarks_mask & MARK_INTERRUPT_DELIVERY) { //Con::printf("INTERRUPT DELIVERY (S)"); - phrases[DELIVERY_PHRASE]->interrupt(spell_elapsed); + mPhrases[DELIVERY_PHRASE]->interrupt(mSpell_elapsed); } else { //Con::printf("LEAVING DELIVERY (S)"); - phrases[DELIVERY_PHRASE]->stop(spell_elapsed); + mPhrases[DELIVERY_PHRASE]->stop(mSpell_elapsed); } } - if (!missile && !(marks_mask & MARK_IMPACT)) + if (!mMissile && !(mMarks_mask & MARK_IMPACT)) { - if (target) + if (mTarget) { - Point3F p = afxMagicSpell::getShapeImpactPos(target); + Point3F p = afxMagicSpell::getShapeImpactPos(mTarget); Point3F n = Point3F(0,0,1); - impactNotify(p, n, target); + impactNotify(p, n, mTarget); } else { @@ -1987,57 +1987,57 @@ void afxMagicSpell::leave_delivery_state_s() void afxMagicSpell::enter_linger_state_s() { - if (impacted_obj) + if (mImpacted_obj) { - impacted_cons_id = constraint_mgr->setReferenceObject(IMPACTED_OBJECT_CONS, impacted_obj); + mImpacted_cons_id = constraint_mgr->setReferenceObject(IMPACTED_OBJECT_CONS, mImpacted_obj); #if defined(AFX_CAP_SCOPE_TRACKING) - if (impacted_obj->isScopeable()) - constraint_mgr->addScopeableObject(impacted_obj); + if (mImpacted_obj->isScopeable()) + constraint_mgr->addScopeableObject(mImpacted_obj); #endif } else - constraint_mgr->setReferencePoint(IMPACTED_OBJECT_CONS, impact_pos, impact_norm); - constraint_mgr->setReferencePoint(IMPACT_POINT_CONS, impact_pos, impact_norm); + constraint_mgr->setReferencePoint(IMPACTED_OBJECT_CONS, mImpact_pos, mImpact_norm); + constraint_mgr->setReferencePoint(IMPACT_POINT_CONS, mImpact_pos, mImpact_norm); constraint_mgr->setReferenceObject(MISSILE_CONS, 0); // start impact effects setup_impact_fx(); - if (phrases[IMPACT_PHRASE]) - phrases[IMPACT_PHRASE]->start(spell_elapsed, spell_elapsed); //START + if (mPhrases[IMPACT_PHRASE]) + mPhrases[IMPACT_PHRASE]->start(mSpell_elapsed, mSpell_elapsed); //START // start linger effects setup_linger_fx(); - if (phrases[LINGER_PHRASE]) - phrases[LINGER_PHRASE]->start(spell_elapsed, spell_elapsed); //START + if (mPhrases[LINGER_PHRASE]) + mPhrases[LINGER_PHRASE]->start(mSpell_elapsed, mSpell_elapsed); //START #if 0 // code temporarily replaced with old callback technique in order to avoid engine bug. // CALL SCRIPT afxMagicSpellData::onImpact(%spell, %caster, %impactedObj, %impactedPos, %impactedNorm) - datablock->onImpact_callback(this, caster, impacted_obj, impact_pos, impact_norm); + mDatablock->onImpact_callback(this, mCaster, mImpacted_obj, mImpact_pos, mImpact_norm); #else char pos_buf[128]; - dSprintf(pos_buf, sizeof(pos_buf), "%g %g %g", impact_pos.x, impact_pos.y, impact_pos.z); + dSprintf(pos_buf, sizeof(pos_buf), "%g %g %g", mImpact_pos.x, mImpact_pos.y, mImpact_pos.z); char norm_buf[128]; - dSprintf(norm_buf, sizeof(norm_buf), "%g %g %g", impact_norm.x, impact_norm.y, impact_norm.z); - Con::executef(exeblock, "onImpact", getIdString(), - (caster) ? caster->getIdString(): "", - (impacted_obj) ? impacted_obj->getIdString(): "", + dSprintf(norm_buf, sizeof(norm_buf), "%g %g %g", mImpact_norm.x, mImpact_norm.y, mImpact_norm.z); + Con::executef(mExeblock, "onImpact", getIdString(), + (mCaster) ? mCaster->getIdString(): "", + (mImpacted_obj) ? mImpacted_obj->getIdString(): "", pos_buf, norm_buf); #endif } void afxMagicSpell::leave_linger_state_s() { - if (phrases[LINGER_PHRASE]) + if (mPhrases[LINGER_PHRASE]) { - if (marks_mask & MARK_INTERRUPT_LINGER) + if (mMarks_mask & MARK_INTERRUPT_LINGER) { //Con::printf("INTERRUPT LINGER (S)"); - phrases[LINGER_PHRASE]->interrupt(spell_elapsed); + mPhrases[LINGER_PHRASE]->interrupt(mSpell_elapsed); } else { //Con::printf("LEAVING LINGER (S)"); - phrases[LINGER_PHRASE]->stop(spell_elapsed); + mPhrases[LINGER_PHRASE]->stop(mSpell_elapsed); } } } @@ -2049,25 +2049,25 @@ void afxMagicSpell::leave_linger_state_s() void afxMagicSpell::process_client(F32 dt) { - spell_elapsed += dt; //SPELL_ELAPSED + mSpell_elapsed += dt; //SPELL_ELAPSED - U8 pending_state = spell_state; + U8 pending_state = mSpell_state; // check for state changes - switch (spell_state) + switch (mSpell_state) { case INACTIVE_STATE: - if (marks_mask & MARK_ACTIVATE) + if (mMarks_mask & MARK_ACTIVATE) pending_state = CASTING_STATE; break; case CASTING_STATE: - if (marks_mask & MARK_INTERRUPT_CASTING) + if (mMarks_mask & MARK_INTERRUPT_CASTING) pending_state = CLEANUP_STATE; - else if (marks_mask & MARK_END_CASTING) + else if (mMarks_mask & MARK_END_CASTING) pending_state = DELIVERY_STATE; - else if (datablock->launch_on_server_signal) + else if (mDatablock->mLaunch_on_server_signal) { - if (marks_mask & MARK_LAUNCH) + if (mMarks_mask & MARK_LAUNCH) pending_state = DELIVERY_STATE; } else @@ -2077,45 +2077,45 @@ void afxMagicSpell::process_client(F32 dt) } break; case DELIVERY_STATE: - if (marks_mask & MARK_INTERRUPT_DELIVERY) + if (mMarks_mask & MARK_INTERRUPT_DELIVERY) pending_state = CLEANUP_STATE; - else if (marks_mask & MARK_END_DELIVERY) + else if (mMarks_mask & MARK_END_DELIVERY) pending_state = LINGER_STATE; - else if (marks_mask & MARK_IMPACT) + else if (mMarks_mask & MARK_IMPACT) pending_state = LINGER_STATE; else state_expired(); break; case LINGER_STATE: - if (marks_mask & MARK_INTERRUPT_LINGER) + if (mMarks_mask & MARK_INTERRUPT_LINGER) pending_state = CLEANUP_STATE; - else if (marks_mask & MARK_END_LINGER) + else if (mMarks_mask & MARK_END_LINGER) pending_state = CLEANUP_STATE; - else if (marks_mask & MARK_SHUTDOWN) + else if (mMarks_mask & MARK_SHUTDOWN) pending_state = CLEANUP_STATE; else if (state_expired()) pending_state = CLEANUP_STATE; break; case CLEANUP_STATE: - if ((marks_mask & MARK_INTERRUPT_CLEANUP) || cleanup_over()) + if ((mMarks_mask & MARK_INTERRUPT_CLEANUP) || cleanup_over()) pending_state = DONE_STATE; break; } - if (spell_state != pending_state) + if (mSpell_state != pending_state) change_state_c(pending_state); - if (spell_state == INACTIVE_STATE) + if (mSpell_state == INACTIVE_STATE) return; //--------------------------// // update the listener constraint position - if (!listener_cons_id.undefined()) + if (!mListener_cons_id.undefined()) { Point3F listener_pos; listener_pos = SFX->getListener().getTransform().getPosition(); - constraint_mgr->setReferencePoint(listener_cons_id, listener_pos); + constraint_mgr->setReferencePoint(mListener_cons_id, listener_pos); } // find local camera position @@ -2123,10 +2123,10 @@ void afxMagicSpell::process_client(F32 dt) SceneObject* current_cam = get_camera(&cam_pos); // detect camera changes - if (!camera_cons_id.undefined() && current_cam != camera_cons_obj) + if (!mCamera_cons_id.undefined() && current_cam != mCamera_cons_obj) { - constraint_mgr->setReferenceObject(camera_cons_id, current_cam); - camera_cons_obj = current_cam; + constraint_mgr->setReferenceObject(mCamera_cons_id, current_cam); + mCamera_cons_obj = current_cam; } // sample the constraints @@ -2134,23 +2134,23 @@ void afxMagicSpell::process_client(F32 dt) // update active effects lists for (S32 i = 0; i < NUM_PHRASES; i++) - if (phrases[i]) - phrases[i]->update(dt, spell_elapsed); + if (mPhrases[i]) + mPhrases[i]->update(dt, mSpell_elapsed); - if (missile_is_armed) + if (mMissile_is_armed) { launch_missile_c(); - missile_is_armed = false; + mMissile_is_armed = false; } } void afxMagicSpell::change_state_c(U8 pending_state) { - if (spell_state == pending_state) + if (mSpell_state == pending_state) return; // LEAVING THIS STATE - switch (spell_state) + switch (mSpell_state) { case INACTIVE_STATE: break; @@ -2169,7 +2169,7 @@ void afxMagicSpell::change_state_c(U8 pending_state) break; } - spell_state = pending_state; + mSpell_state = pending_state; // ENTERING THIS STATE switch (pending_state) @@ -2177,13 +2177,13 @@ void afxMagicSpell::change_state_c(U8 pending_state) case INACTIVE_STATE: break; case CASTING_STATE: - enter_casting_state_c(spell_elapsed); + enter_casting_state_c(mSpell_elapsed); break; case DELIVERY_STATE: - enter_delivery_state_c(spell_elapsed); + enter_delivery_state_c(mSpell_elapsed); break; case LINGER_STATE: - enter_linger_state_c(spell_elapsed); + enter_linger_state_c(mSpell_elapsed); break; case CLEANUP_STATE: break; @@ -2195,113 +2195,113 @@ void afxMagicSpell::change_state_c(U8 pending_state) void afxMagicSpell::enter_casting_state_c(F32 starttime) { // stamp constraint-mgr starting time - constraint_mgr->setStartTime(Platform::getVirtualMilliseconds() - (U32)(spell_elapsed*1000)); + constraint_mgr->setStartTime(Platform::getVirtualMilliseconds() - (U32)(mSpell_elapsed *1000)); //spell_elapsed = 0; //SPELL_ELAPSED setup_dynamic_constraints(); // start casting effects and castbar setup_casting_fx(); - if (phrases[CASTING_PHRASE]) - phrases[CASTING_PHRASE]->start(starttime, spell_elapsed); //START + if (mPhrases[CASTING_PHRASE]) + mPhrases[CASTING_PHRASE]->start(starttime, mSpell_elapsed); //START // initialize missile - if (missile_db) + if (mMissile_db) { - missile_db = missile_db->cloneAndPerformSubstitutions(this, ranking); - init_missile_c(missile_db); + mMissile_db = mMissile_db->cloneAndPerformSubstitutions(this, ranking); + init_missile_c(mMissile_db); } } void afxMagicSpell::leave_casting_state_c() { - if (phrases[CASTING_PHRASE]) + if (mPhrases[CASTING_PHRASE]) { - if (marks_mask & MARK_INTERRUPT_CASTING) + if (mMarks_mask & MARK_INTERRUPT_CASTING) { //Con::printf("INTERRUPT CASTING (C)"); - phrases[CASTING_PHRASE]->interrupt(spell_elapsed); + mPhrases[CASTING_PHRASE]->interrupt(mSpell_elapsed); } else { //Con::printf("LEAVING CASTING (C)"); - phrases[CASTING_PHRASE]->stop(spell_elapsed); + mPhrases[CASTING_PHRASE]->stop(mSpell_elapsed); } } } void afxMagicSpell::enter_delivery_state_c(F32 starttime) { - missile_is_armed = true; + mMissile_is_armed = true; setup_launch_fx(); - if (phrases[LAUNCH_PHRASE]) - phrases[LAUNCH_PHRASE]->start(starttime, spell_elapsed); //START + if (mPhrases[LAUNCH_PHRASE]) + mPhrases[LAUNCH_PHRASE]->start(starttime, mSpell_elapsed); //START setup_delivery_fx(); - if (phrases[DELIVERY_PHRASE]) - phrases[DELIVERY_PHRASE]->start(starttime, spell_elapsed); //START + if (mPhrases[DELIVERY_PHRASE]) + mPhrases[DELIVERY_PHRASE]->start(starttime, mSpell_elapsed); //START } void afxMagicSpell::leave_delivery_state_c() { - if (missile) + if (mMissile) { - clearNotify(missile); - missile->deleteObject(); - missile = NULL; + clearNotify(mMissile); + mMissile->deleteObject(); + mMissile = NULL; } - if (phrases[DELIVERY_PHRASE]) + if (mPhrases[DELIVERY_PHRASE]) { - if (marks_mask & MARK_INTERRUPT_DELIVERY) + if (mMarks_mask & MARK_INTERRUPT_DELIVERY) { //Con::printf("INTERRUPT DELIVERY (C)"); - phrases[DELIVERY_PHRASE]->interrupt(spell_elapsed); + mPhrases[DELIVERY_PHRASE]->interrupt(mSpell_elapsed); } else { //Con::printf("LEAVING DELIVERY (C)"); - phrases[DELIVERY_PHRASE]->stop(spell_elapsed); + mPhrases[DELIVERY_PHRASE]->stop(mSpell_elapsed); } } } void afxMagicSpell::enter_linger_state_c(F32 starttime) { - if (impacted_obj) - impacted_cons_id = constraint_mgr->setReferenceObject(IMPACTED_OBJECT_CONS, impacted_obj); - else if (impacted_scope_id > 0) - impacted_cons_id = constraint_mgr->setReferenceObjectByScopeId(IMPACTED_OBJECT_CONS, impacted_scope_id, impacted_is_shape); + if (mImpacted_obj) + mImpacted_cons_id = constraint_mgr->setReferenceObject(IMPACTED_OBJECT_CONS, mImpacted_obj); + else if (mImpacted_scope_id > 0) + mImpacted_cons_id = constraint_mgr->setReferenceObjectByScopeId(IMPACTED_OBJECT_CONS, mImpacted_scope_id, mImpacted_is_shape); else - constraint_mgr->setReferencePoint(IMPACTED_OBJECT_CONS, impact_pos, impact_norm); - constraint_mgr->setReferencePoint(IMPACT_POINT_CONS, impact_pos, impact_norm); + constraint_mgr->setReferencePoint(IMPACTED_OBJECT_CONS, mImpact_pos, mImpact_norm); + constraint_mgr->setReferencePoint(IMPACT_POINT_CONS, mImpact_pos, mImpact_norm); constraint_mgr->setReferenceObject(MISSILE_CONS, 0); setup_impact_fx(); - if (phrases[IMPACT_PHRASE]) - phrases[IMPACT_PHRASE]->start(starttime, spell_elapsed); //START + if (mPhrases[IMPACT_PHRASE]) + mPhrases[IMPACT_PHRASE]->start(starttime, mSpell_elapsed); //START setup_linger_fx(); - if (phrases[LINGER_PHRASE]) + if (mPhrases[LINGER_PHRASE]) { - phrases[LINGER_PHRASE]->start(starttime, spell_elapsed); //START + mPhrases[LINGER_PHRASE]->start(starttime, mSpell_elapsed); //START } } void afxMagicSpell::leave_linger_state_c() { - if (phrases[LINGER_PHRASE]) + if (mPhrases[LINGER_PHRASE]) { - if (marks_mask & MARK_INTERRUPT_LINGER) + if (mMarks_mask & MARK_INTERRUPT_LINGER) { //Con::printf("INTERRUPT LINGER (C)"); - phrases[LINGER_PHRASE]->interrupt(spell_elapsed); + mPhrases[LINGER_PHRASE]->interrupt(mSpell_elapsed); } else { //Con::printf("LEAVING LINGER (C)"); - phrases[LINGER_PHRASE]->stop(spell_elapsed); + mPhrases[LINGER_PHRASE]->stop(mSpell_elapsed); } } } @@ -2312,15 +2312,15 @@ void afxMagicSpell::sync_client(U16 marks, U8 state, F32 elapsed, F32 spell_elap // marks, name_from_state(spell_state), name_from_state(state), elapsed, // spell_elapsed); - if (spell_state != LATE_STATE) + if (mSpell_state != LATE_STATE) return; - marks_mask = marks; + mMarks_mask = marks; // don't want to be started on late zoning clients - if (!datablock->exec_on_new_clients) + if (!mDatablock->exec_on_new_clients) { - spell_state = DONE_STATE; + mSpell_state = DONE_STATE; } // it looks like we're ghosting pretty late and @@ -2328,31 +2328,31 @@ void afxMagicSpell::sync_client(U16 marks, U8 state, F32 elapsed, F32 spell_elap else if ((marks & (MARK_INTERRUPTS | MARK_DEACTIVATE | MARK_SHUTDOWN)) || (((marks & MARK_IMPACT) || (marks & MARK_END_DELIVERY)) && (marks & MARK_END_LINGER))) { - spell_state = DONE_STATE; + mSpell_state = DONE_STATE; } // it looks like we should be in the linger state. else if ((marks & MARK_IMPACT) || (((marks & MARK_LAUNCH) || (marks & MARK_END_CASTING)) && (marks & MARK_END_DELIVERY))) { - spell_state = LINGER_STATE; - this->spell_elapsed = spell_elapsed; + mSpell_state = LINGER_STATE; + mSpell_elapsed = spell_elapsed; enter_linger_state_c(spell_elapsed-elapsed); } // it looks like we should be in the delivery state. else if ((marks & MARK_LAUNCH) || (marks & MARK_END_CASTING)) { - spell_state = DELIVERY_STATE; - this->spell_elapsed = spell_elapsed; + mSpell_state = DELIVERY_STATE; + mSpell_elapsed = spell_elapsed; enter_delivery_state_c(spell_elapsed-elapsed); } // it looks like we should be in the casting state. else if (marks & MARK_ACTIVATE) { - spell_state = CASTING_STATE; //SPELL_STATE - this->spell_elapsed = spell_elapsed; + mSpell_state = CASTING_STATE; //SPELL_STATE + mSpell_elapsed = spell_elapsed; enter_casting_state_c(spell_elapsed-elapsed); } } @@ -2367,39 +2367,39 @@ void afxMagicSpell::postSpellEvent(U8 event) switch (event) { case ACTIVATE_EVENT: - marks_mask |= MARK_ACTIVATE; + mMarks_mask |= MARK_ACTIVATE; break; case LAUNCH_EVENT: - marks_mask |= MARK_LAUNCH; + mMarks_mask |= MARK_LAUNCH; setMaskBits(LaunchEventMask); break; case IMPACT_EVENT: - marks_mask |= MARK_IMPACT; + mMarks_mask |= MARK_IMPACT; setMaskBits(ImpactEventMask); break; case SHUTDOWN_EVENT: - marks_mask |= MARK_SHUTDOWN; + mMarks_mask |= MARK_SHUTDOWN; break; case DEACTIVATE_EVENT: - marks_mask |= MARK_DEACTIVATE; + mMarks_mask |= MARK_DEACTIVATE; break; case INTERRUPT_PHASE_EVENT: - if (spell_state == CASTING_STATE) - marks_mask |= MARK_END_CASTING; - else if (spell_state == DELIVERY_STATE) - marks_mask |= MARK_END_DELIVERY; - else if (spell_state == LINGER_STATE) - marks_mask |= MARK_END_LINGER; + if (mSpell_state == CASTING_STATE) + mMarks_mask |= MARK_END_CASTING; + else if (mSpell_state == DELIVERY_STATE) + mMarks_mask |= MARK_END_DELIVERY; + else if (mSpell_state == LINGER_STATE) + mMarks_mask |= MARK_END_LINGER; break; case INTERRUPT_SPELL_EVENT: - if (spell_state == CASTING_STATE) - marks_mask |= MARK_INTERRUPT_CASTING; - else if (spell_state == DELIVERY_STATE) - marks_mask |= MARK_INTERRUPT_DELIVERY; - else if (spell_state == LINGER_STATE) - marks_mask |= MARK_INTERRUPT_LINGER; - else if (spell_state == CLEANUP_STATE) - marks_mask |= MARK_INTERRUPT_CLEANUP; + if (mSpell_state == CASTING_STATE) + mMarks_mask |= MARK_INTERRUPT_CASTING; + else if (mSpell_state == DELIVERY_STATE) + mMarks_mask |= MARK_INTERRUPT_DELIVERY; + else if (mSpell_state == LINGER_STATE) + mMarks_mask |= MARK_INTERRUPT_LINGER; + else if (mSpell_state == CLEANUP_STATE) + mMarks_mask |= MARK_INTERRUPT_CLEANUP; break; } } @@ -2407,7 +2407,7 @@ void afxMagicSpell::postSpellEvent(U8 event) void afxMagicSpell::resolveTimeFactors() { for (S32 i = 0; i < NUM_PHRASES; i++) - tfactors[i] *= overall_time_factor; + mTfactors[i] *= mOverall_time_factor; } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// @@ -2416,10 +2416,10 @@ void afxMagicSpell::finish_startup() { #if !defined(BROKEN_POINT_IN_WATER) // test if caster is in water - if (caster) + if (mCaster) { - Point3F pos = caster->getPosition(); - if (caster->pointInWater(pos)) + Point3F pos = mCaster->getPosition(); + if (mCaster->pointInWater(pos)) exec_conds_mask |= CASTER_IN_WATER; } #endif @@ -2480,7 +2480,7 @@ afxMagicSpell::cast_spell(afxMagicSpellData* datablock, ShapeBase* caster, Scene // create a new spell instance afxMagicSpell* spell = new afxMagicSpell(caster, target); spell->setDataBlock(datablock); - spell->exeblock = exeblock; + spell->mExeblock = exeblock; spell->setExtra(extra); // copy dynamic fields from the param holder to the spell @@ -2527,28 +2527,28 @@ Point3F afxMagicSpell::getShapeImpactPos(SceneObject* obj) void afxMagicSpell::restoreObject(SceneObject* obj) { - if (obj->getScopeId() == caster_scope_id && dynamic_cast(obj) != NULL) + if (obj->getScopeId() == mCaster_scope_id && dynamic_cast(obj) != NULL) { - caster_scope_id = 0; - caster = (ShapeBase*)obj; - caster_field = caster; - deleteNotify(caster); - processAfter(caster); + mCaster_scope_id = 0; + mCaster = (ShapeBase*)obj; + mCaster_field = mCaster; + deleteNotify(mCaster); + processAfter(mCaster); } - if (obj->getScopeId() == target_scope_id) + if (obj->getScopeId() == mTarget_scope_id) { - target_scope_id = 0; - target = obj; - target_field = target; - deleteNotify(target); + mTarget_scope_id = 0; + mTarget = obj; + mTarget_field = mTarget; + deleteNotify(mTarget); } - if (obj->getScopeId() == impacted_scope_id) + if (obj->getScopeId() == mImpacted_scope_id) { - impacted_scope_id = 0; - impacted_obj = obj; - deleteNotify(impacted_obj); + mImpacted_scope_id = 0; + mImpacted_obj = obj; + deleteNotify(mImpacted_obj); } } @@ -2561,23 +2561,23 @@ bool afxMagicSpell::activationCallInit(bool postponed) return false; } - if (!caster_field) + if (!mCaster_field) { Con::errorf("afxMagicSpell::activate() -- no spellcaster specified."); return false; } - caster = dynamic_cast(caster_field); - if (!caster) + mCaster = dynamic_cast(mCaster_field); + if (!mCaster) { Con::errorf("afxMagicSpell::activate() -- spellcaster is not a ShapeBase derived object."); return false; } - if (target_field) + if (mTarget_field) { - target = dynamic_cast(target_field); - if (!target) + mTarget = dynamic_cast(mTarget_field); + if (!mTarget) Con::warnf("afxMagicSpell::activate() -- target is not a SceneObject derived object."); } @@ -2591,11 +2591,11 @@ void afxMagicSpell::activate() // to happen prior to object registration. Sim::postEvent(this, new SpellFinishStartupEvent, Sim::getCurrentTime()); - caster_field = caster; - target_field = target; + mCaster_field = mCaster; + mTarget_field = mTarget; // CALL SCRIPT afxMagicSpellData::onActivate(%spell, %caster, %target) - datablock->onActivate_callback(this, caster, target); + mDatablock->onActivate_callback(this, mCaster, mTarget); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxMagicSpell.h b/Engine/source/afx/afxMagicSpell.h index 1f760e48b..f7545bdb8 100644 --- a/Engine/source/afx/afxMagicSpell.h +++ b/Engine/source/afx/afxMagicSpell.h @@ -68,36 +68,36 @@ class afxMagicSpellData : public afxChoreographerData, public afxMagicSpellDefs void validateType(SimObject *object, void *typePtr); }; - bool do_id_convert; + bool mDo_id_convert; public: - F32 casting_dur; - F32 delivery_dur; - F32 linger_dur; + F32 mCasting_dur; + F32 mDelivery_dur; + F32 mLinger_dur; // - S32 n_casting_loops; - S32 n_delivery_loops; - S32 n_linger_loops; + S32 mNum_casting_loops; + S32 mNum_delivery_loops; + S32 mNum_linger_loops; // - F32 extra_casting_time; - F32 extra_delivery_time; - F32 extra_linger_time; + F32 mExtra_casting_time; + F32 mExtra_delivery_time; + F32 mExtra_linger_time; // - bool do_move_interrupts; - F32 move_interrupt_speed; + bool mDo_move_interrupts; + F32 mMove_interrupt_speed; // - afxMagicMissileData* missile_db; - bool launch_on_server_signal; - U32 primary_target_types; + afxMagicMissileData* mMissile_db; + bool mLaunch_on_server_signal; + U32 mPrimary_target_types; // - afxEffectWrapperData* dummy_fx_entry; + afxEffectWrapperData* mDummy_fx_entry; // various effects lists - afxEffectList casting_fx_list; - afxEffectList launch_fx_list; - afxEffectList delivery_fx_list; - afxEffectList impact_fx_list; - afxEffectList linger_fx_list; + afxEffectList mCasting_fx_list; + afxEffectList mLaunch_fx_list; + afxEffectList mDelivery_fx_list; + afxEffectList mImpact_fx_list; + afxEffectList mLinger_fx_list; void pack_fx(BitStream* stream, const afxEffectList& fx, bool packed); void unpack_fx(BitStream* stream, afxEffectList& fx); @@ -222,39 +222,39 @@ private: static StringTableEntry IMPACTED_OBJECT_CONS; private: - afxMagicSpellData* datablock; - SimObject* exeblock; - afxMagicMissileData* missile_db; + afxMagicSpellData* mDatablock; + SimObject* mExeblock; + afxMagicMissileData* mMissile_db; - ShapeBase* caster; - SceneObject* target; - SimObject* caster_field; - SimObject* target_field; + ShapeBase* mCaster; + SceneObject* mTarget; + SimObject* mCaster_field; + SimObject* mTarget_field; - U16 caster_scope_id; - U16 target_scope_id; - bool target_is_shape; + U16 mCaster_scope_id; + U16 mTarget_scope_id; + bool mTarget_is_shape; - bool constraints_initialized; - bool scoping_initialized; + bool mConstraints_initialized; + bool mScoping_initialized; - U8 spell_state; - F32 spell_elapsed; + U8 mSpell_state; + F32 mSpell_elapsed; - afxConstraintID listener_cons_id; - afxConstraintID caster_cons_id; - afxConstraintID target_cons_id; - afxConstraintID impacted_cons_id; - afxConstraintID camera_cons_id; - SceneObject* camera_cons_obj; + afxConstraintID mListener_cons_id; + afxConstraintID mCaster_cons_id; + afxConstraintID mTarget_cons_id; + afxConstraintID mImpacted_cons_id; + afxConstraintID mCamera_cons_id; + SceneObject* mCamera_cons_obj; - afxPhrase* phrases[NUM_PHRASES]; - F32 tfactors[NUM_PHRASES]; + afxPhrase* mPhrases[NUM_PHRASES]; + F32 mTfactors[NUM_PHRASES]; - bool notify_castbar; - F32 overall_time_factor; + bool mNotify_castbar; + F32 mOverall_time_factor; - U16 marks_mask; + U16 mMarks_mask; private: void init(); @@ -278,13 +278,13 @@ protected: virtual void unpack_constraint_info(NetConnection* conn, BitStream* stream); private: - afxMagicMissile* missile; - bool missile_is_armed; - SceneObject* impacted_obj; - Point3F impact_pos; - Point3F impact_norm; - U16 impacted_scope_id; - bool impacted_is_shape; + afxMagicMissile* mMissile; + bool mMissile_is_armed; + SceneObject* mImpacted_obj; + Point3F mImpact_pos; + Point3F mImpact_norm; + U16 mImpacted_scope_id; + bool mImpacted_is_shape; void init_missile_s(afxMagicMissileData* mm); void launch_missile_s(); @@ -353,15 +353,15 @@ public: void postSpellEvent(U8 event); void resolveTimeFactors(); - void setTimeFactor(F32 f) { overall_time_factor = (f > 0) ? f : 1.0f; } - F32 getTimeFactor() { return overall_time_factor; } - void setTimeFactor(U8 phase, F32 f) { tfactors[phase] = (f > 0) ? f : 1.0f; } - F32 getTimeFactor(U8 phase) { return tfactors[phase]; } + void setTimeFactor(F32 f) { mOverall_time_factor = (f > 0) ? f : 1.0f; } + F32 getTimeFactor() { return mOverall_time_factor; } + void setTimeFactor(U8 phase, F32 f) { mTfactors[phase] = (f > 0) ? f : 1.0f; } + F32 getTimeFactor(U8 phase) { return mTfactors[phase]; } - ShapeBase* getCaster() const { return caster; } - SceneObject* getTarget() const { return target; } - afxMagicMissile* getMissile() const { return missile; } - SceneObject* getImpactedObject() const { return impacted_obj; } + ShapeBase* getCaster() const { return mCaster; } + SceneObject* getTarget() const { return mTarget; } + afxMagicMissile* getMissile() const { return mMissile; } + SceneObject* getImpactedObject() const { return mImpacted_obj; } virtual void restoreObject(SceneObject*); @@ -377,7 +377,7 @@ public: inline bool afxMagicSpell::is_caster_moving() { - return (caster) ? (caster->getVelocity().len() > datablock->move_interrupt_speed) : false; + return (mCaster) ? (mCaster->getVelocity().len() > mDatablock->mMove_interrupt_speed) : false; } inline bool afxMagicSpell::is_caster_client(ShapeBase* caster, GameConnection* conn) From b6076c55dd687d28ee991ce7cb485a2ed82cf698 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 29 Mar 2018 17:46:57 -0500 Subject: [PATCH 098/144] afxEffectWrapper membervar cleanup --- Engine/source/afx/afxEffectVector.cpp | 10 +- Engine/source/afx/afxEffectWrapper.cpp | 316 +++++++++--------- Engine/source/afx/afxEffectWrapper.h | 122 +++---- Engine/source/afx/ea/afxEA_AnimClip.cpp | 10 +- Engine/source/afx/ea/afxEA_AreaDamage.cpp | 8 +- Engine/source/afx/ea/afxEA_AudioBank.cpp | 6 +- Engine/source/afx/ea/afxEA_Billboard.cpp | 14 +- Engine/source/afx/ea/afxEA_CameraPuppet.cpp | 10 +- Engine/source/afx/ea/afxEA_CameraShake.cpp | 6 +- Engine/source/afx/ea/afxEA_CollisionEvent.cpp | 14 +- Engine/source/afx/ea/afxEA_ConsoleMessage.cpp | 2 +- Engine/source/afx/ea/afxEA_Damage.cpp | 20 +- Engine/source/afx/ea/afxEA_Debris.cpp | 16 +- Engine/source/afx/ea/afxEA_Explosion.cpp | 10 +- Engine/source/afx/ea/afxEA_FootSwitch.cpp | 2 +- Engine/source/afx/ea/afxEA_GuiController.cpp | 12 +- Engine/source/afx/ea/afxEA_GuiText.cpp | 14 +- Engine/source/afx/ea/afxEA_MachineGun.cpp | 16 +- Engine/source/afx/ea/afxEA_Model.cpp | 18 +- Engine/source/afx/ea/afxEA_Mooring.cpp | 10 +- .../source/afx/ea/afxEA_ParticleEmitter.cpp | 48 +-- Engine/source/afx/ea/afxEA_PhraseEffect.cpp | 24 +- Engine/source/afx/ea/afxEA_PhysicalZone.cpp | 8 +- Engine/source/afx/ea/afxEA_PlayerMovement.cpp | 2 +- Engine/source/afx/ea/afxEA_PlayerPuppet.cpp | 10 +- Engine/source/afx/ea/afxEA_PointLight_T3D.cpp | 10 +- Engine/source/afx/ea/afxEA_Projectile.cpp | 32 +- Engine/source/afx/ea/afxEA_ScriptEvent.cpp | 6 +- Engine/source/afx/ea/afxEA_Sound.cpp | 8 +- Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp | 10 +- Engine/source/afx/ea/afxEA_StaticShape.cpp | 28 +- Engine/source/afx/ea/afxEA_Zodiac.cpp | 64 ++-- Engine/source/afx/ea/afxEA_ZodiacPlane.cpp | 34 +- Engine/source/afx/forces/afxEA_Force.cpp | 10 +- .../source/afx/xm/afxXM_AltitudeConform.cpp | 88 +++-- .../source/afx/xm/afxXM_MountedImageNode.cpp | 46 +-- 36 files changed, 531 insertions(+), 533 deletions(-) diff --git a/Engine/source/afx/afxEffectVector.cpp b/Engine/source/afx/afxEffectVector.cpp index b3d03e4c6..47e0d1aee 100644 --- a/Engine/source/afx/afxEffectVector.cpp +++ b/Engine/source/afx/afxEffectVector.cpp @@ -40,7 +40,7 @@ void afxEffectVector::filter_client_server() for (S32 i = 0; i < fx_v->size(); i++) { - if ((*fx_v)[i]->datablock->runsHere(on_server)) + if ((*fx_v)[i]->mDatablock->runsHere(on_server)) fx_v2->push_back((*fx_v)[i]); else { @@ -68,15 +68,15 @@ void afxEffectVector::calc_fx_dur_and_afterlife() if (ew) { F32 ew_dur; - if (ew->ew_timing.lifetime < 0) + if (ew->mEW_timing.lifetime < 0) { - if (phrase_dur > ew->ew_timing.delay) + if (phrase_dur > ew->mEW_timing.delay) ew_dur = phrase_dur + ew->afterStopTime(); else - ew_dur = ew->ew_timing.delay + ew->afterStopTime(); + ew_dur = ew->mEW_timing.delay + ew->afterStopTime(); } else - ew_dur = ew->ew_timing.delay + ew->ew_timing.lifetime + ew->ew_timing.fade_out_time; + ew_dur = ew->mEW_timing.delay + ew->mEW_timing.lifetime + ew->mEW_timing.fade_out_time; if (ew_dur > total_fx_dur) total_fx_dur = ew_dur; diff --git a/Engine/source/afx/afxEffectWrapper.cpp b/Engine/source/afx/afxEffectWrapper.cpp index 33f73f787..5906947ee 100644 --- a/Engine/source/afx/afxEffectWrapper.cpp +++ b/Engine/source/afx/afxEffectWrapper.cpp @@ -681,55 +681,55 @@ ConsoleDocClass( afxEffectWrapper, afxEffectWrapper::afxEffectWrapper() { - choreographer = 0; - datablock = 0; - cons_mgr = 0; + mChoreographer = 0; + mDatablock = 0; + mCons_mgr = 0; - cond_alive = true; - elapsed = 0; - life_end = 0; - life_elapsed = 0; - stopped = false; - n_updates = 0; - fade_value = 1.0f; - last_fade_value = 0.0f; - fade_in_end = 0.0; - fade_out_start = 0.0f; - in_scope = true; - is_aborted = false; - do_fade_inout = false; - do_fades = false; - full_lifetime = 0; + mCond_alive = true; + mElapsed = 0; + mLife_end = 0; + mLife_elapsed = 0; + mStopped = false; + mNum_updates = 0; + mFade_value = 1.0f; + mLast_fade_value = 0.0f; + mFade_in_end = 0.0; + mFade_out_start = 0.0f; + mIn_scope = true; + mIs_aborted = false; + mDo_fade_inout = false; + mDo_fades = false; + mFull_lifetime = 0; - time_factor = 1.0f; - prop_time_factor = 1.0f; + mTime_factor = 1.0f; + mProp_time_factor = 1.0f; - live_scale_factor = 1.0f; - live_fade_factor = 1.0f; - terrain_altitude = -1.0f; - interior_altitude = -1.0f; + mLive_scale_factor = 1.0f; + mLive_fade_factor = 1.0f; + mTerrain_altitude = -1.0f; + mInterior_altitude = -1.0f; - group_index = 0; + mGroup_index = 0; - dMemset(xfm_modifiers, 0, sizeof(xfm_modifiers)); + dMemset(mXfm_modifiers, 0, sizeof(mXfm_modifiers)); } afxEffectWrapper::~afxEffectWrapper() { for (S32 i = 0; i < MAX_XFM_MODIFIERS; i++) - if (xfm_modifiers[i]) - delete xfm_modifiers[i]; + if (mXfm_modifiers[i]) + delete mXfm_modifiers[i]; - if (datablock && datablock->effect_name != ST_NULLSTRING) + if (mDatablock && mDatablock->effect_name != ST_NULLSTRING) { - choreographer->removeNamedEffect(this); - if (datablock->use_as_cons_obj && !effect_cons_id.undefined()) - cons_mgr->setReferenceEffect(effect_cons_id, 0); + mChoreographer->removeNamedEffect(this); + if (mDatablock->use_as_cons_obj && !mEffect_cons_id.undefined()) + mCons_mgr->setReferenceEffect(mEffect_cons_id, 0); } - if (datablock && datablock->isTempClone()) - delete datablock; - datablock = 0; + if (mDatablock && mDatablock->isTempClone()) + delete mDatablock; + mDatablock = 0; } #undef myOffset @@ -737,9 +737,9 @@ afxEffectWrapper::~afxEffectWrapper() void afxEffectWrapper::initPersistFields() { - addField("liveScaleFactor", TypeF32, myOffset(live_scale_factor), + addField("liveScaleFactor", TypeF32, myOffset(mLive_scale_factor), "..."); - addField("liveFadeFactor", TypeF32, myOffset(live_fade_factor), + addField("liveFadeFactor", TypeF32, myOffset(mLive_fade_factor), "..."); Parent::initPersistFields(); @@ -754,37 +754,37 @@ void afxEffectWrapper::ew_init(afxChoreographer* choreographer, AssertFatal(datablock != NULL, "Datablock is missing."); AssertFatal(cons_mgr != NULL, "Constraint manager is missing."); - this->choreographer = choreographer; - this->datablock = datablock; - this->cons_mgr = cons_mgr; + mChoreographer = choreographer; + mDatablock = datablock; + mCons_mgr = cons_mgr; ea_set_datablock(datablock->effect_data); - ew_timing = datablock->ewd_timing; - if (ew_timing.life_bias != 1.0f) + mEW_timing = datablock->ewd_timing; + if (mEW_timing.life_bias != 1.0f) { - if (ew_timing.lifetime > 0) - ew_timing.lifetime *= ew_timing.life_bias; - ew_timing.fade_in_time *= ew_timing.life_bias; - ew_timing.fade_out_time *= ew_timing.life_bias; + if (mEW_timing.lifetime > 0) + mEW_timing.lifetime *= mEW_timing.life_bias; + mEW_timing.fade_in_time *= mEW_timing.life_bias; + mEW_timing.fade_out_time *= mEW_timing.life_bias; } - pos_cons_id = cons_mgr->getConstraintId(datablock->pos_cons_def); - orient_cons_id = cons_mgr->getConstraintId(datablock->orient_cons_def); - aim_cons_id = cons_mgr->getConstraintId(datablock->aim_cons_def); - life_cons_id = cons_mgr->getConstraintId(datablock->life_cons_def); + mPos_cons_id = cons_mgr->getConstraintId(datablock->pos_cons_def); + mOrient_cons_id = cons_mgr->getConstraintId(datablock->orient_cons_def); + mAim_cons_id = cons_mgr->getConstraintId(datablock->aim_cons_def); + mLife_cons_id = cons_mgr->getConstraintId(datablock->life_cons_def); - this->time_factor = (datablock->ignore_time_factor) ? 1.0f : time_factor; + mTime_factor = (datablock->ignore_time_factor) ? 1.0f : time_factor; if (datablock->propagate_time_factor) - prop_time_factor = time_factor; + mProp_time_factor = time_factor; if (datablock->runsHere(choreographer->isServerObject())) { for (int i = 0; i < MAX_XFM_MODIFIERS && datablock->xfm_modifiers[i] != 0; i++) { - xfm_modifiers[i] = datablock->xfm_modifiers[i]->create(this, choreographer->isServerObject()); - AssertFatal(xfm_modifiers[i] != 0, avar("Error, creation failed for xfm_modifiers[%d] of %s.", i, datablock->getName())); - if (xfm_modifiers[i] == 0) + mXfm_modifiers[i] = datablock->xfm_modifiers[i]->create(this, choreographer->isServerObject()); + AssertFatal(mXfm_modifiers[i] != 0, avar("Error, creation failed for xfm_modifiers[%d] of %s.", i, datablock->getName())); + if (mXfm_modifiers[i] == 0) Con::errorf("Error, creation failed for xfm_modifiers[%d] of %s.", i, datablock->getName()); } } @@ -795,9 +795,9 @@ void afxEffectWrapper::ew_init(afxChoreographer* choreographer, choreographer->addNamedEffect(this); if (datablock->use_as_cons_obj) { - effect_cons_id = cons_mgr->setReferenceEffect(datablock->effect_name, this); - if (effect_cons_id.undefined() && datablock->isTempClone() && datablock->runsHere(choreographer->isServerObject())) - effect_cons_id = cons_mgr->createReferenceEffect(datablock->effect_name, this); + mEffect_cons_id = cons_mgr->setReferenceEffect(datablock->effect_name, this); + if (mEffect_cons_id.undefined() && datablock->isTempClone() && datablock->runsHere(choreographer->isServerObject())) + mEffect_cons_id = cons_mgr->createReferenceEffect(datablock->effect_name, this); } } } @@ -805,37 +805,37 @@ void afxEffectWrapper::ew_init(afxChoreographer* choreographer, void afxEffectWrapper::prestart() { // modify timing values by time_factor - if (ew_timing.lifetime > 0) - ew_timing.lifetime *= time_factor; - ew_timing.delay *= time_factor; - ew_timing.fade_in_time *= time_factor; - ew_timing.fade_out_time *= time_factor; + if (mEW_timing.lifetime > 0) + mEW_timing.lifetime *= mTime_factor; + mEW_timing.delay *= mTime_factor; + mEW_timing.fade_in_time *= mTime_factor; + mEW_timing.fade_out_time *= mTime_factor; - if (ew_timing.lifetime < 0) + if (mEW_timing.lifetime < 0) { - full_lifetime = INFINITE_LIFETIME; - life_end = INFINITE_LIFETIME; + mFull_lifetime = INFINITE_LIFETIME; + mLife_end = INFINITE_LIFETIME; } else { - full_lifetime = ew_timing.lifetime + ew_timing.fade_out_time; - life_end = ew_timing.delay + ew_timing.lifetime; + mFull_lifetime = mEW_timing.lifetime + mEW_timing.fade_out_time; + mLife_end = mEW_timing.delay + mEW_timing.lifetime; } - if ((ew_timing.fade_in_time + ew_timing.fade_out_time) > 0.0f) + if ((mEW_timing.fade_in_time + mEW_timing.fade_out_time) > 0.0f) { - fade_in_end = ew_timing.delay + ew_timing.fade_in_time; - if (full_lifetime == INFINITE_LIFETIME) - fade_out_start = INFINITE_LIFETIME; + mFade_in_end = mEW_timing.delay + mEW_timing.fade_in_time; + if (mFull_lifetime == INFINITE_LIFETIME) + mFade_out_start = INFINITE_LIFETIME; else - fade_out_start = ew_timing.delay + ew_timing.lifetime; - do_fade_inout = true; + mFade_out_start = mEW_timing.delay + mEW_timing.lifetime; + mDo_fade_inout = true; } - if (!do_fade_inout && datablock->vis_keys != NULL && datablock->vis_keys->numKeys() > 0) + if (!mDo_fade_inout && mDatablock->vis_keys != NULL && mDatablock->vis_keys->numKeys() > 0) { //do_fades = true; - fade_out_start = ew_timing.delay + ew_timing.lifetime; + mFade_out_start = mEW_timing.delay + mEW_timing.lifetime; } } @@ -843,22 +843,22 @@ bool afxEffectWrapper::start(F32 timestamp) { if (!ea_is_enabled()) { - Con::warnf("afxEffectWrapper::start() -- effect type of %s is currently disabled.", datablock->getName()); + Con::warnf("afxEffectWrapper::start() -- effect type of %s is currently disabled.", mDatablock->getName()); return false; } afxConstraint* life_constraint = getLifeConstraint(); if (life_constraint) - cond_alive = life_constraint->getLivingState(); + mCond_alive = life_constraint->getLivingState(); - elapsed = timestamp; + mElapsed = timestamp; for (S32 i = 0; i < MAX_XFM_MODIFIERS; i++) { - if (!xfm_modifiers[i]) + if (!mXfm_modifiers[i]) break; else - xfm_modifiers[i]->start(timestamp); + mXfm_modifiers[i]->start(timestamp); } if (!ea_start()) @@ -874,109 +874,109 @@ bool afxEffectWrapper::start(F32 timestamp) bool afxEffectWrapper::test_life_conds() { afxConstraint* life_constraint = getLifeConstraint(); - if (!life_constraint || datablock->life_conds == 0) + if (!life_constraint || mDatablock->life_conds == 0) return true; S32 now_state = life_constraint->getDamageState(); - if ((datablock->life_conds & DEAD) != 0 && now_state == ShapeBase::Disabled) + if ((mDatablock->life_conds & DEAD) != 0 && now_state == ShapeBase::Disabled) return true; - if ((datablock->life_conds & ALIVE) != 0 && now_state == ShapeBase::Enabled) + if ((mDatablock->life_conds & ALIVE) != 0 && now_state == ShapeBase::Enabled) return true; - if ((datablock->life_conds & DYING) != 0) - return (cond_alive && now_state == ShapeBase::Disabled); + if ((mDatablock->life_conds & DYING) != 0) + return (mCond_alive && now_state == ShapeBase::Disabled); return false; } bool afxEffectWrapper::update(F32 dt) { - elapsed += dt; + mElapsed += dt; // life_elapsed won't exceed full_lifetime - life_elapsed = getMin(elapsed - ew_timing.delay, full_lifetime); + mLife_elapsed = getMin(mElapsed - mEW_timing.delay, mFull_lifetime); // update() returns early if elapsed is outside of active timing range // (delay <= elapsed <= delay+lifetime) // note: execution is always allowed beyond this point at least once, // even if elapsed exceeds the lifetime. - if (elapsed < ew_timing.delay) + if (mElapsed < mEW_timing.delay) { setScopeStatus(false); return false; } - if (!datablock->requiresStop(ew_timing) && ew_timing.lifetime < 0) + if (!mDatablock->requiresStop(mEW_timing) && mEW_timing.lifetime < 0) { - F32 afterlife = elapsed - ew_timing.delay; - if (afterlife > 1.0f || ((afterlife > 0.0f) && (n_updates > 0))) + F32 afterlife = mElapsed - mEW_timing.delay; + if (afterlife > 1.0f || ((afterlife > 0.0f) && (mNum_updates > 0))) { - setScopeStatus(ew_timing.residue_lifetime > 0.0f); + setScopeStatus(mEW_timing.residue_lifetime > 0.0f); return false; } } else { - F32 afterlife = elapsed - (full_lifetime + ew_timing.delay); - if (afterlife > 1.0f || ((afterlife > 0.0f) && (n_updates > 0))) + F32 afterlife = mElapsed - (mFull_lifetime + mEW_timing.delay); + if (afterlife > 1.0f || ((afterlife > 0.0f) && (mNum_updates > 0))) { - setScopeStatus(ew_timing.residue_lifetime > 0.0f); + setScopeStatus(mEW_timing.residue_lifetime > 0.0f); return false; } } // first time here, test if required conditions for effect are met - if (n_updates == 0) + if (mNum_updates == 0) { if (!test_life_conds()) { - elapsed = full_lifetime + ew_timing.delay; + mElapsed = mFull_lifetime + mEW_timing.delay; setScopeStatus(false); - n_updates++; + mNum_updates++; return false; } } setScopeStatus(true); - n_updates++; + mNum_updates++; // calculate current fade value if enabled - if (do_fade_inout) + if (mDo_fade_inout) { - if (ew_timing.fade_in_time > 0 && elapsed <= fade_in_end) + if (mEW_timing.fade_in_time > 0 && mElapsed <= mFade_in_end) { - F32 t = mClampF((elapsed-ew_timing.delay)/ew_timing.fade_in_time, 0.0f, 1.0f); - fade_value = afxEase::t(t, ew_timing.fadein_ease.x,ew_timing.fadein_ease.y); - do_fades = true; + F32 t = mClampF((mElapsed - mEW_timing.delay)/ mEW_timing.fade_in_time, 0.0f, 1.0f); + mFade_value = afxEase::t(t, mEW_timing.fadein_ease.x, mEW_timing.fadein_ease.y); + mDo_fades = true; } - else if (elapsed > fade_out_start) + else if (mElapsed > mFade_out_start) { - if (ew_timing.fade_out_time == 0) - fade_value = 0.0f; + if (mEW_timing.fade_out_time == 0) + mFade_value = 0.0f; else { - F32 t = mClampF(1.0f-(elapsed-fade_out_start)/ew_timing.fade_out_time, 0.0f, 1.0f); - fade_value = afxEase::t(t, ew_timing.fadeout_ease.x,ew_timing.fadeout_ease.y); + F32 t = mClampF(1.0f-(mElapsed - mFade_out_start)/ mEW_timing.fade_out_time, 0.0f, 1.0f); + mFade_value = afxEase::t(t, mEW_timing.fadeout_ease.x, mEW_timing.fadeout_ease.y); } - do_fades = true; + mDo_fades = true; } else { - fade_value = 1.0f; - do_fades = false; + mFade_value = 1.0f; + mDo_fades = false; } } else { - fade_value = 1.0; - do_fades = false; + mFade_value = 1.0; + mDo_fades = false; } - if (datablock->vis_keys && datablock->vis_keys->numKeys() > 0) + if (mDatablock->vis_keys && mDatablock->vis_keys->numKeys() > 0) { - F32 vis = datablock->vis_keys->evaluate(elapsed-ew_timing.delay); - fade_value *= mClampF(vis, 0.0f, 1.0f); - do_fades = (fade_value < 1.0f); + F32 vis = mDatablock->vis_keys->evaluate(mElapsed - mEW_timing.delay); + mFade_value *= mClampF(vis, 0.0f, 1.0f); + mDo_fades = (mFade_value < 1.0f); } // DEAL WITH CONSTRAINTS @@ -990,17 +990,17 @@ bool afxEffectWrapper::update(F32 dt) afxConstraint* pos_constraint = getPosConstraint(); if (pos_constraint) { - bool valid = pos_constraint->getPosition(CONS_POS, datablock->pos_cons_def.mHistory_time); + bool valid = pos_constraint->getPosition(CONS_POS, mDatablock->pos_cons_def.mHistory_time); if (!valid) getUnconstrainedPosition(CONS_POS); setScopeStatus(valid); - if (valid && datablock->borrow_altitudes) + if (valid && mDatablock->borrow_altitudes) { F32 terr_alt, inter_alt; if (pos_constraint->getAltitudes(terr_alt, inter_alt)) { - terrain_altitude = terr_alt; - interior_altitude = inter_alt; + mTerrain_altitude = terr_alt; + mInterior_altitude = inter_alt; } } } @@ -1013,7 +1013,7 @@ bool afxEffectWrapper::update(F32 dt) afxConstraint* orient_constraint = getOrientConstraint(); if (orient_constraint) { - orient_constraint->getTransform(CONS_XFM, datablock->pos_cons_def.mHistory_time); + orient_constraint->getTransform(CONS_XFM, mDatablock->pos_cons_def.mHistory_time); } else { @@ -1022,11 +1022,11 @@ bool afxEffectWrapper::update(F32 dt) afxConstraint* aim_constraint = getAimConstraint(); if (aim_constraint) - aim_constraint->getPosition(CONS_AIM, datablock->pos_cons_def.mHistory_time); + aim_constraint->getPosition(CONS_AIM, mDatablock->pos_cons_def.mHistory_time); else CONS_AIM.zero(); - CONS_SCALE.set(datablock->scale_factor, datablock->scale_factor, datablock->scale_factor); + CONS_SCALE.set(mDatablock->scale_factor, mDatablock->scale_factor, mDatablock->scale_factor); /* if (datablock->isPositional() && CONS_POS.isZero() && in_scope) @@ -1035,44 +1035,44 @@ bool afxEffectWrapper::update(F32 dt) getBaseColor(CONS_COLOR); - params.vis = fade_value; + params.vis = mFade_value; // apply modifiers for (int i = 0; i < MAX_XFM_MODIFIERS; i++) { - if (!xfm_modifiers[i]) + if (!mXfm_modifiers[i]) break; else - xfm_modifiers[i]->updateParams(dt, life_elapsed, params); + mXfm_modifiers[i]->updateParams(dt, mLife_elapsed, params); } // final pos/orient is determined - updated_xfm = CONS_XFM; - updated_pos = CONS_POS; - updated_aim = CONS_AIM; - updated_xfm.setPosition(updated_pos); - updated_scale = CONS_SCALE; - updated_color = CONS_COLOR; + mUpdated_xfm = CONS_XFM; + mUpdated_pos = CONS_POS; + mUpdated_aim = CONS_AIM; + mUpdated_xfm.setPosition(mUpdated_pos); + mUpdated_scale = CONS_SCALE; + mUpdated_color = CONS_COLOR; if (params.vis > 1.0f) - fade_value = 1.0f; + mFade_value = 1.0f; else - fade_value = params.vis; + mFade_value = params.vis; - if (last_fade_value != fade_value) + if (mLast_fade_value != mFade_value) { - do_fades = true; - last_fade_value = fade_value; + mDo_fades = true; + mLast_fade_value = mFade_value; } else { - do_fades = (fade_value < 1.0f); + mDo_fades = (mFade_value < 1.0f); } if (!ea_update(dt)) { - is_aborted = true; - Con::errorf("afxEffectWrapper::update() -- effect %s ended unexpectedly.", datablock->getName()); + mIs_aborted = true; + Con::errorf("afxEffectWrapper::update() -- effect %s ended unexpectedly.", mDatablock->getName()); } return true; @@ -1080,44 +1080,44 @@ bool afxEffectWrapper::update(F32 dt) void afxEffectWrapper::stop() { - if (!datablock->requiresStop(ew_timing)) + if (!mDatablock->requiresStop(mEW_timing)) return; - stopped = true; + mStopped = true; // this resets full_lifetime so it starts to shrink or fade - if (full_lifetime == INFINITE_LIFETIME) + if (mFull_lifetime == INFINITE_LIFETIME) { - full_lifetime = (elapsed - ew_timing.delay) + afterStopTime(); - life_end = elapsed; - if (ew_timing.fade_out_time > 0) - fade_out_start = elapsed; + mFull_lifetime = (mElapsed - mEW_timing.delay) + afterStopTime(); + mLife_end = mElapsed; + if (mEW_timing.fade_out_time > 0) + mFade_out_start = mElapsed; } } void afxEffectWrapper::cleanup(bool was_stopped) { ea_finish(was_stopped); - if (!effect_cons_id.undefined()) + if (!mEffect_cons_id.undefined()) { - cons_mgr->setReferenceEffect(effect_cons_id, 0); - effect_cons_id = afxConstraintID(); + mCons_mgr->setReferenceEffect(mEffect_cons_id, 0); + mEffect_cons_id = afxConstraintID(); } } void afxEffectWrapper::setScopeStatus(bool in_scope) { - if (this->in_scope != in_scope) + if (mIn_scope != in_scope) { - this->in_scope = in_scope; + mIn_scope = in_scope; ea_set_scope_status(in_scope); } } bool afxEffectWrapper::isDone() { - if (!datablock->is_looping) - return (elapsed >= (life_end + ew_timing.fade_out_time)); + if (!mDatablock->is_looping) + return (mElapsed >= (mLife_end + mEW_timing.fade_out_time)); return false; } @@ -1136,7 +1136,7 @@ afxEffectWrapper* afxEffectWrapper::ew_create(afxChoreographer* choreograph if (adapter) { - adapter->group_index = (datablock->group_index != -1) ? datablock->group_index : group_index; + adapter->mGroup_index = (datablock->group_index != -1) ? datablock->group_index : group_index; adapter->ew_init(choreographer, datablock, cons_mgr, time_factor); } diff --git a/Engine/source/afx/afxEffectWrapper.h b/Engine/source/afx/afxEffectWrapper.h index 8d5ef646c..79459f76f 100644 --- a/Engine/source/afx/afxEffectWrapper.h +++ b/Engine/source/afx/afxEffectWrapper.h @@ -255,59 +255,59 @@ private: bool test_life_conds(); protected: - afxEffectWrapperData* datablock; + afxEffectWrapperData* mDatablock; - afxEffectTimingData ew_timing; + afxEffectTimingData mEW_timing; - F32 fade_in_end; - F32 fade_out_start; - F32 full_lifetime; + F32 mFade_in_end; + F32 mFade_out_start; + F32 mFull_lifetime; - F32 time_factor; - F32 prop_time_factor; + F32 mTime_factor; + F32 mProp_time_factor; - afxChoreographer* choreographer; - afxConstraintMgr* cons_mgr; + afxChoreographer* mChoreographer; + afxConstraintMgr* mCons_mgr; - afxConstraintID pos_cons_id; - afxConstraintID orient_cons_id; - afxConstraintID aim_cons_id; - afxConstraintID life_cons_id; + afxConstraintID mPos_cons_id; + afxConstraintID mOrient_cons_id; + afxConstraintID mAim_cons_id; + afxConstraintID mLife_cons_id; - afxConstraintID effect_cons_id; + afxConstraintID mEffect_cons_id; - F32 elapsed; - F32 life_elapsed; - F32 life_end; - bool stopped; - bool cond_alive; + F32 mElapsed; + F32 mLife_elapsed; + F32 mLife_end; + bool mStopped; + bool mCond_alive; - U32 n_updates; + U32 mNum_updates; - MatrixF updated_xfm; - Point3F updated_pos; - Point3F updated_aim; - Point3F updated_scale; - LinearColorF updated_color; + MatrixF mUpdated_xfm; + Point3F mUpdated_pos; + Point3F mUpdated_aim; + Point3F mUpdated_scale; + LinearColorF mUpdated_color; - F32 fade_value; - F32 last_fade_value; + F32 mFade_value; + F32 mLast_fade_value; - bool do_fade_inout; - bool do_fades; - bool in_scope; - bool is_aborted; + bool mDo_fade_inout; + bool mDo_fades; + bool mIn_scope; + bool mIs_aborted; - U8 effect_flags; + U8 mEffect_flags; - afxXM_Base* xfm_modifiers[MAX_XFM_MODIFIERS]; + afxXM_Base* mXfm_modifiers[MAX_XFM_MODIFIERS]; - F32 live_scale_factor; - F32 live_fade_factor; - F32 terrain_altitude; - F32 interior_altitude; + F32 mLive_scale_factor; + F32 mLive_fade_factor; + F32 mTerrain_altitude; + F32 mInterior_altitude; - S32 group_index; + S32 mGroup_index; public: /*C*/ afxEffectWrapper(); @@ -316,18 +316,18 @@ public: void ew_init(afxChoreographer*, afxEffectWrapperData*, afxConstraintMgr*, F32 time_factor); - F32 getFullLifetime() { return ew_timing.lifetime + ew_timing.fade_out_time; } - F32 getTimeFactor() { return time_factor; } - afxConstraint* getPosConstraint() { return cons_mgr->getConstraint(pos_cons_id); } - afxConstraint* getOrientConstraint() { return cons_mgr->getConstraint(orient_cons_id); } - afxConstraint* getAimConstraint() { return cons_mgr->getConstraint(aim_cons_id); } - afxConstraint* getLifeConstraint() { return cons_mgr->getConstraint(life_cons_id); } - afxChoreographer* getChoreographer() { return choreographer; } + F32 getFullLifetime() { return mEW_timing.lifetime + mEW_timing.fade_out_time; } + F32 getTimeFactor() { return mTime_factor; } + afxConstraint* getPosConstraint() { return mCons_mgr->getConstraint(mPos_cons_id); } + afxConstraint* getOrientConstraint() { return mCons_mgr->getConstraint(mOrient_cons_id); } + afxConstraint* getAimConstraint() { return mCons_mgr->getConstraint(mAim_cons_id); } + afxConstraint* getLifeConstraint() { return mCons_mgr->getConstraint(mLife_cons_id); } + afxChoreographer* getChoreographer() { return mChoreographer; } virtual bool isDone(); virtual bool deleteWhenStopped() { return false; } - F32 afterStopTime() { return ew_timing.fade_out_time; } - bool isAborted() const { return is_aborted; } + F32 afterStopTime() { return mEW_timing.fade_out_time; } + bool isAborted() const { return mIs_aborted; } void prestart(); bool start(F32 timestamp); @@ -345,11 +345,11 @@ public: virtual SceneObject* ea_get_scene_object() const { return 0; } U32 ea_get_triggers() const { return 0; } - void getUpdatedPosition(Point3F& pos) { pos = updated_pos;} - void getUpdatedTransform(MatrixF& xfm) { xfm = updated_xfm; } - void getUpdatedScale(Point3F& scale) { scale = updated_scale; } - void getUpdatedColor(LinearColorF& color) { color = updated_color; } - virtual void getUpdatedBoxCenter(Point3F& pos) { pos = updated_pos;} + void getUpdatedPosition(Point3F& pos) { pos = mUpdated_pos;} + void getUpdatedTransform(MatrixF& xfm) { xfm = mUpdated_xfm; } + void getUpdatedScale(Point3F& scale) { scale = mUpdated_scale; } + void getUpdatedColor(LinearColorF& color) { color = mUpdated_color; } + virtual void getUpdatedBoxCenter(Point3F& pos) { pos = mUpdated_pos;} virtual void getUnconstrainedPosition(Point3F& pos) { pos.zero();} virtual void getUnconstrainedTransform(MatrixF& xfm) { xfm.identity(); } @@ -358,9 +358,9 @@ public: SceneObject* getSceneObject() const { return ea_get_scene_object(); } U32 getTriggers() const { return ea_get_triggers(); } - F32 getMass() { return datablock->mass; } - Point3F getDirection() { return datablock->direction; } - F32 getSpeed() { return datablock->speed; } + F32 getMass() { return mDatablock->mass; } + Point3F getDirection() { return mDatablock->direction; } + F32 getSpeed() { return mDatablock->speed; } virtual TSShape* getTSShape() { return 0; } virtual TSShapeInstance* getTSShapeInstance() { return 0; } @@ -369,14 +369,14 @@ public: virtual void resetAnimation(U32 tag) { } virtual F32 getAnimClipDuration(const char* clip) { return 0.0f; } - void setTerrainAltitude(F32 alt) { terrain_altitude = alt; } - void setInteriorAltitude(F32 alt) { interior_altitude = alt; } - void getAltitudes(F32& terr_alt, F32& inter_alt) const { terr_alt = terrain_altitude; inter_alt = interior_altitude; } + void setTerrainAltitude(F32 alt) { mTerrain_altitude = alt; } + void setInteriorAltitude(F32 alt) { mInterior_altitude = alt; } + void getAltitudes(F32& terr_alt, F32& inter_alt) const { terr_alt = mTerrain_altitude; inter_alt = mInterior_altitude; } - void setGroupIndex(S32 idx) { group_index = idx; } - S32 getGroupIndex() const { return group_index; } + void setGroupIndex(S32 idx) { mGroup_index = idx; } + S32 getGroupIndex() const { return mGroup_index; } - bool inScope() const { return in_scope; } + bool inScope() const { return mIn_scope; } public: static void initPersistFields(); diff --git a/Engine/source/afx/ea/afxEA_AnimClip.cpp b/Engine/source/afx/ea/afxEA_AnimClip.cpp index 4e635a1db..601d54515 100644 --- a/Engine/source/afx/ea/afxEA_AnimClip.cpp +++ b/Engine/source/afx/ea/afxEA_AnimClip.cpp @@ -89,10 +89,10 @@ bool afxEA_AnimClip::ea_start() do_runtime_substitutions(); afxConstraint* pos_constraint = getPosConstraint(); - if (full_lifetime == INFINITE_LIFETIME && pos_constraint != 0) + if (mFull_lifetime == INFINITE_LIFETIME && pos_constraint != 0) anim_lifetime = pos_constraint->getAnimClipDuration(clip_data->clip_name); else - anim_lifetime = full_lifetime; + anim_lifetime = mFull_lifetime; anim_tag = 0; lock_tag = 0; @@ -127,8 +127,8 @@ bool afxEA_AnimClip::ea_update(F32 dt) if (go_for_it) { - F32 rate = clip_data->rate/prop_time_factor; - F32 pos = mFmod(life_elapsed, anim_lifetime)/anim_lifetime; + F32 rate = clip_data->rate/mProp_time_factor; + F32 pos = mFmod(mLife_elapsed, anim_lifetime)/anim_lifetime; pos = mFmod(pos + clip_data->pos_offset, 1.0); if (clip_data->rate < 0) pos = 1.0f - pos; @@ -164,7 +164,7 @@ void afxEA_AnimClip::do_runtime_substitutions() // clone the datablock and perform substitutions afxAnimClipData* orig_db = clip_data; clip_data = new afxAnimClipData(*orig_db, true); - orig_db->performSubstitutions(clip_data, choreographer, group_index); + orig_db->performSubstitutions(clip_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_AreaDamage.cpp b/Engine/source/afx/ea/afxEA_AreaDamage.cpp index 3c5d26aae..a9a6036fb 100644 --- a/Engine/source/afx/ea/afxEA_AreaDamage.cpp +++ b/Engine/source/afx/ea/afxEA_AreaDamage.cpp @@ -133,7 +133,7 @@ void afxEA_AreaDamage::do_runtime_substitutions() // clone the datablock and perform substitutions afxAreaDamageData* orig_db = damage_data; damage_data = new afxAreaDamageData(*orig_db, true); - orig_db->performSubstitutions(damage_data, choreographer, group_index); + orig_db->performSubstitutions(damage_data, mChoreographer, mGroup_index); } } @@ -204,8 +204,8 @@ void afxEA_AreaDamage::notify_damage_source(ShapeBase* damaged, F32 damage, cons char *posArg = Con::getArgBuffer(64); dSprintf(posArg, 64, "%f %f %f", pos.x, pos.y, pos.z); - Con::executef(choreographer->getDataBlock(), "onInflictedAreaDamage", - choreographer->getIdString(), + Con::executef(mChoreographer->getDataBlock(), "onInflictedAreaDamage", + mChoreographer->getIdString(), damaged->getIdString(), Con::getFloatArg(damage), flavor, @@ -221,7 +221,7 @@ void afxEA_AreaDamage::apply_damage(ShapeBase* shape, F32 damage, const char* fl dSprintf(posArg, 64, "%f %f %f", pos.x, pos.y, pos.z); Con::executef(shape, "damage", - choreographer->getIdString(), + mChoreographer->getIdString(), posArg, Con::getFloatArg(damage), flavor); diff --git a/Engine/source/afx/ea/afxEA_AudioBank.cpp b/Engine/source/afx/ea/afxEA_AudioBank.cpp index 3cf7bd912..6ae095dcf 100644 --- a/Engine/source/afx/ea/afxEA_AudioBank.cpp +++ b/Engine/source/afx/ea/afxEA_AudioBank.cpp @@ -125,8 +125,8 @@ bool afxEA_AudioBank::ea_update(F32 dt) if (sound_handle) { - sound_handle->setTransform(updated_xfm); - sound_handle->setVolume(updated_scale.x*fade_value); + sound_handle->setTransform(mUpdated_xfm); + sound_handle->setVolume(mUpdated_scale.x*mFade_value); } return true; @@ -143,7 +143,7 @@ void afxEA_AudioBank::ea_finish(bool was_stopped) void afxEA_AudioBank::do_runtime_substitutions() { - sound_bank = sound_bank->cloneAndPerformSubstitutions(choreographer, group_index); + sound_bank = sound_bank->cloneAndPerformSubstitutions(mChoreographer, mGroup_index); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ea/afxEA_Billboard.cpp b/Engine/source/afx/ea/afxEA_Billboard.cpp index 254dab1d6..012b364f9 100644 --- a/Engine/source/afx/ea/afxEA_Billboard.cpp +++ b/Engine/source/afx/ea/afxEA_Billboard.cpp @@ -108,18 +108,18 @@ bool afxEA_Billboard::ea_update(F32 dt) deleteNotify(bb); ///bb->setSequenceRateFactor(datablock->rate_factor/prop_time_factor); - bb->setSortPriority(datablock->sort_priority); + bb->setSortPriority(mDatablock->sort_priority); } if (bb) { - bb->live_color = updated_color; - if (do_fades) + bb->live_color = mUpdated_color; + if (mDo_fades) { - bb->setFadeAmount(fade_value); + bb->setFadeAmount(mFade_value); } - bb->setTransform(updated_xfm); - bb->setScale(updated_scale); + bb->setTransform(mUpdated_xfm); + bb->setScale(mUpdated_scale); } return true; @@ -162,7 +162,7 @@ void afxEA_Billboard::do_runtime_substitutions() // clone the datablock and perform substitutions afxBillboardData* orig_db = bb_data; bb_data = new afxBillboardData(*orig_db, true); - orig_db->performSubstitutions(bb_data, choreographer, group_index); + orig_db->performSubstitutions(bb_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_CameraPuppet.cpp b/Engine/source/afx/ea/afxEA_CameraPuppet.cpp index b307bcb2f..51a3a3dd9 100644 --- a/Engine/source/afx/ea/afxEA_CameraPuppet.cpp +++ b/Engine/source/afx/ea/afxEA_CameraPuppet.cpp @@ -83,8 +83,8 @@ bool afxEA_CameraPuppet::ea_start() do_runtime_substitutions(); - afxConstraintID obj_id = cons_mgr->getConstraintId(puppet_data->cam_def); - cam_cons = cons_mgr->getConstraint(obj_id); + afxConstraintID obj_id = mCons_mgr->getConstraintId(puppet_data->cam_def); + cam_cons = mCons_mgr->getConstraint(obj_id); SceneObject* obj = (cam_cons) ? cam_cons->getSceneObject() : 0; if (obj && obj->isClientObject()) @@ -105,9 +105,9 @@ bool afxEA_CameraPuppet::ea_update(F32 dt) { SceneObject* obj = (cam_cons) ? cam_cons->getSceneObject() : 0; - if (obj && in_scope) + if (obj && mIn_scope) { - obj->setTransform(updated_xfm); + obj->setTransform(mUpdated_xfm); } return true; @@ -153,7 +153,7 @@ void afxEA_CameraPuppet::do_runtime_substitutions() // clone the datablock and perform substitutions afxCameraPuppetData* orig_db = puppet_data; puppet_data = new afxCameraPuppetData(*orig_db, true); - orig_db->performSubstitutions(puppet_data, choreographer, group_index); + orig_db->performSubstitutions(puppet_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_CameraShake.cpp b/Engine/source/afx/ea/afxEA_CameraShake.cpp index 9c26e32b6..2e5a461fa 100644 --- a/Engine/source/afx/ea/afxEA_CameraShake.cpp +++ b/Engine/source/afx/ea/afxEA_CameraShake.cpp @@ -91,7 +91,7 @@ bool afxEA_CameraShake::ea_start() if (aim_constraint && pos_constraint) { - if (full_lifetime <= 0 || full_lifetime == INFINITE_LIFETIME) + if (mFull_lifetime <= 0 || mFull_lifetime == INFINITE_LIFETIME) { Con::errorf("afxEA_CameraShake::ea_start() -- effect requires a finite lifetime."); return false; @@ -106,7 +106,7 @@ bool afxEA_CameraShake::ea_start() if (dist < shake_data->camShakeRadius) { camera_shake = new CameraShake; - camera_shake->setDuration(full_lifetime); + camera_shake->setDuration(mFull_lifetime); camera_shake->setFrequency(shake_data->camShakeFreq); F32 falloff = dist/shake_data->camShakeRadius; @@ -161,7 +161,7 @@ void afxEA_CameraShake::do_runtime_substitutions() // clone the datablock and perform substitutions afxCameraShakeData* orig_db = shake_data; shake_data = new afxCameraShakeData(*orig_db, true); - orig_db->performSubstitutions(shake_data, choreographer, group_index); + orig_db->performSubstitutions(shake_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_CollisionEvent.cpp b/Engine/source/afx/ea/afxEA_CollisionEvent.cpp index b06492acc..73b6fa707 100644 --- a/Engine/source/afx/ea/afxEA_CollisionEvent.cpp +++ b/Engine/source/afx/ea/afxEA_CollisionEvent.cpp @@ -107,16 +107,16 @@ bool afxEA_CollisionEvent::ea_update(F32 dt) afxConstraint* pos_constraint = getPosConstraint(); set_shape((pos_constraint) ? dynamic_cast(pos_constraint->getSceneObject()) : 0); - if (choreographer && trigger_mask != 0) + if (mChoreographer && trigger_mask != 0) { if (triggered) { - choreographer->setTriggerMask(trigger_mask | choreographer->getTriggerMask()); + mChoreographer->setTriggerMask(trigger_mask | mChoreographer->getTriggerMask()); triggered = false; } else { - choreographer->setTriggerMask(~trigger_mask & choreographer->getTriggerMask()); + mChoreographer->setTriggerMask(~trigger_mask & mChoreographer->getTriggerMask()); } } @@ -136,7 +136,7 @@ void afxEA_CollisionEvent::do_runtime_substitutions() // clone the datablock and perform substitutions afxCollisionEventData* orig_db = script_data; script_data = new afxCollisionEventData(*orig_db, true); - orig_db->performSubstitutions(script_data, choreographer, group_index); + orig_db->performSubstitutions(script_data, mChoreographer, mGroup_index); } } @@ -162,7 +162,7 @@ void afxEA_CollisionEvent::set_shape(ShapeBase* new_shape) void afxEA_CollisionEvent::collisionNotify(SceneObject* obj0, SceneObject* obj1, const VectorF& vel) { - if (obj0 != shape || !choreographer || !choreographer->getDataBlock()) + if (obj0 != shape || !mChoreographer || !mChoreographer->getDataBlock()) return; if (script_data->method_name != ST_NULLSTRING) @@ -171,8 +171,8 @@ void afxEA_CollisionEvent::collisionNotify(SceneObject* obj0, SceneObject* obj1, dSprintf(arg_buf, 256, "%g %g %g", vel.x, vel.y, vel.z); // CALL SCRIPT afxChoreographerData::method(%spell, %obj0, %obj1, %velocity) - Con::executef(choreographer->getDataBlock(), script_data->method_name, - choreographer->getIdString(), + Con::executef(mChoreographer->getDataBlock(), script_data->method_name, + mChoreographer->getIdString(), (obj0) ? obj0->getIdString() : "", (obj1) ? obj1->getIdString() : "", arg_buf, diff --git a/Engine/source/afx/ea/afxEA_ConsoleMessage.cpp b/Engine/source/afx/ea/afxEA_ConsoleMessage.cpp index cb08cfa72..0f80a194a 100644 --- a/Engine/source/afx/ea/afxEA_ConsoleMessage.cpp +++ b/Engine/source/afx/ea/afxEA_ConsoleMessage.cpp @@ -98,7 +98,7 @@ void afxEA_ConsoleMessage::do_runtime_substitutions() // clone the datablock and perform substitutions afxConsoleMessageData* orig_db = message_data; message_data = new afxConsoleMessageData(*orig_db, true); - orig_db->performSubstitutions(message_data, choreographer, group_index); + orig_db->performSubstitutions(message_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_Damage.cpp b/Engine/source/afx/ea/afxEA_Damage.cpp index e0691eae3..a338bfa38 100644 --- a/Engine/source/afx/ea/afxEA_Damage.cpp +++ b/Engine/source/afx/ea/afxEA_Damage.cpp @@ -101,7 +101,7 @@ bool afxEA_Damage::ea_start() if (damage_data->repeats > 1) { - dot_delta_ms = full_lifetime/(damage_data->repeats - 1); + dot_delta_ms = mFull_lifetime /(damage_data->repeats - 1); next_dot_time = dot_delta_ms; } @@ -122,15 +122,15 @@ bool afxEA_Damage::ea_update(F32 dt) if (aim_cons && aim_cons->getSceneObject()) impacted_obj_id = aim_cons->getSceneObject()->getId(); - if (choreographer) - choreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount, + if (mChoreographer) + mChoreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount, repeat_cnt, damage_data->ad_amount, damage_data->radius, impact_pos, damage_data->impulse); repeat_cnt++; } else if (repeat_cnt < damage_data->repeats) { - if (next_dot_time <= life_elapsed) + if (next_dot_time <= mLife_elapsed) { // CONSTRAINT REMAPPING << afxConstraint* aim_cons = getAimConstraint(); @@ -138,8 +138,8 @@ bool afxEA_Damage::ea_update(F32 dt) impacted_obj_id = aim_cons->getSceneObject()->getId(); // CONSTRAINT REMAPPING >> - if (choreographer) - choreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount, + if (mChoreographer) + mChoreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount, repeat_cnt, 0, 0, impact_pos, 0); next_dot_time += dot_delta_ms; repeat_cnt++; @@ -153,10 +153,10 @@ void afxEA_Damage::ea_finish(bool was_stopped) { if (started && (repeat_cnt < damage_data->repeats)) { - if (next_dot_time <= life_elapsed) + if (next_dot_time <= mLife_elapsed) { - if (choreographer) - choreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount, + if (mChoreographer) + mChoreographer->inflictDamage(damage_data->label, damage_data->flavor, impacted_obj_id, damage_data->amount, repeat_cnt, 0, 0, impact_pos, 0); } } @@ -172,7 +172,7 @@ void afxEA_Damage::do_runtime_substitutions() // clone the datablock and perform substitutions afxDamageData* orig_db = damage_data; damage_data = new afxDamageData(*orig_db, true); - orig_db->performSubstitutions(damage_data, choreographer, group_index); + orig_db->performSubstitutions(damage_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_Debris.cpp b/Engine/source/afx/ea/afxEA_Debris.cpp index e4a46fc6b..678c02726 100644 --- a/Engine/source/afx/ea/afxEA_Debris.cpp +++ b/Engine/source/afx/ea/afxEA_Debris.cpp @@ -78,7 +78,7 @@ afxEA_Debris::~afxEA_Debris() bool afxEA_Debris::isDone() { - return (datablock->use_as_cons_obj) ? debris_done : exploded; + return (mDatablock->use_as_cons_obj) ? debris_done : exploded; } void afxEA_Debris::ea_set_datablock(SimDataBlock* db) @@ -106,21 +106,21 @@ bool afxEA_Debris::ea_update(F32 dt) { if (exploded && debris) { - if (in_scope) + if (mIn_scope) { - updated_xfm = debris->getRenderTransform(); - updated_xfm.getColumn(3, &updated_pos); + mUpdated_xfm = debris->getRenderTransform(); + mUpdated_xfm.getColumn(3, &mUpdated_pos); } } if (!exploded && debris) { - if (in_scope) + if (mIn_scope) { Point3F dir_vec(0,1,0); - updated_xfm.mulV(dir_vec); + mUpdated_xfm.mulV(dir_vec); - debris->init(updated_pos, dir_vec); + debris->init(mUpdated_pos, dir_vec); if (!debris->registerObject()) { delete debris; @@ -165,7 +165,7 @@ void afxEA_Debris::do_runtime_substitutions() // clone the datablock and perform substitutions DebrisData* orig_db = debris_data; debris_data = new DebrisData(*orig_db, true); - orig_db->performSubstitutions(debris_data, choreographer, group_index); + orig_db->performSubstitutions(debris_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_Explosion.cpp b/Engine/source/afx/ea/afxEA_Explosion.cpp index f8e424f84..d8fcd3377 100644 --- a/Engine/source/afx/ea/afxEA_Explosion.cpp +++ b/Engine/source/afx/ea/afxEA_Explosion.cpp @@ -81,7 +81,7 @@ bool afxEA_Explosion::ea_start() do_runtime_substitutions(); explosion = new Explosion(); - explosion->setSubstitutionData(choreographer, group_index); + explosion->setSubstitutionData(mChoreographer, mGroup_index); explosion->setDataBlock(explosion_data); return true; @@ -91,10 +91,10 @@ bool afxEA_Explosion::ea_update(F32 dt) { if (!exploded && explosion) { - if (in_scope) + if (mIn_scope) { - Point3F norm(0,0,1); updated_xfm.mulV(norm); - explosion->setInitialState(updated_pos, norm); + Point3F norm(0,0,1); mUpdated_xfm.mulV(norm); + explosion->setInitialState(mUpdated_pos, norm); if (!explosion->registerObject()) { delete explosion; @@ -117,7 +117,7 @@ void afxEA_Explosion::ea_finish(bool was_stopped) void afxEA_Explosion::do_runtime_substitutions() { - explosion_data = explosion_data->cloneAndPerformSubstitutions(choreographer, group_index); + explosion_data = explosion_data->cloneAndPerformSubstitutions(mChoreographer, mGroup_index); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/ea/afxEA_FootSwitch.cpp b/Engine/source/afx/ea/afxEA_FootSwitch.cpp index 822dfb1e4..7bac59d85 100644 --- a/Engine/source/afx/ea/afxEA_FootSwitch.cpp +++ b/Engine/source/afx/ea/afxEA_FootSwitch.cpp @@ -145,7 +145,7 @@ void afxEA_FootSwitch::do_runtime_substitutions() // clone the datablock and perform substitutions afxFootSwitchData* orig_db = footfall_data; footfall_data = new afxFootSwitchData(*orig_db, true); - orig_db->performSubstitutions(footfall_data, choreographer, group_index); + orig_db->performSubstitutions(footfall_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_GuiController.cpp b/Engine/source/afx/ea/afxEA_GuiController.cpp index 9387278e7..e4fe1251e 100644 --- a/Engine/source/afx/ea/afxEA_GuiController.cpp +++ b/Engine/source/afx/ea/afxEA_GuiController.cpp @@ -146,7 +146,7 @@ bool afxEA_GuiController::ea_update(F32 dt) if (ts_ctrl && !controller_data->preserve_pos) { Point3F screen_pos; - if (ts_ctrl->project(updated_pos, &screen_pos)) + if (ts_ctrl->project(mUpdated_pos, &screen_pos)) { const Point2I ext = gui_control->getExtent(); Point2I newpos(screen_pos.x - ext.x/2, screen_pos.y - ext.y/2); @@ -155,12 +155,12 @@ bool afxEA_GuiController::ea_update(F32 dt) } if (progress_base) - progress_base->setProgress((ew_timing.lifetime > 0.0) ? life_elapsed/ew_timing.lifetime : 0.0f); + progress_base->setProgress((mEW_timing.lifetime > 0.0) ? mLife_elapsed / mEW_timing.lifetime : 0.0f); else if (progress_ctrl) - progress_ctrl->setScriptValue((ew_timing.lifetime > 0.0) ? avar("%g", life_elapsed/ew_timing.lifetime) : 0); + progress_ctrl->setScriptValue((mEW_timing.lifetime > 0.0) ? avar("%g", mLife_elapsed / mEW_timing.lifetime) : 0); - if (do_fades) - gui_control->setFadeAmount(fade_value); + if (mDo_fades) + gui_control->setFadeAmount(mFade_value); return true; } @@ -182,7 +182,7 @@ void afxEA_GuiController::do_runtime_substitutions() // clone the datablock and perform substitutions afxGuiControllerData* orig_db = controller_data; controller_data = new afxGuiControllerData(*orig_db, true); - orig_db->performSubstitutions(controller_data, choreographer, group_index); + orig_db->performSubstitutions(controller_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_GuiText.cpp b/Engine/source/afx/ea/afxEA_GuiText.cpp index 7dfc77422..41b8e4346 100644 --- a/Engine/source/afx/ea/afxEA_GuiText.cpp +++ b/Engine/source/afx/ea/afxEA_GuiText.cpp @@ -105,9 +105,9 @@ bool afxEA_GuiText::ea_update(F32 dt) case USER_TEXT: { LinearColorF temp_clr = text_clr; - if (do_fades) - temp_clr.alpha = fade_value; - afxGuiTextHud::addTextItem(updated_pos, text_data->text_str, temp_clr); + if (mDo_fades) + temp_clr.alpha = mFade_value; + afxGuiTextHud::addTextItem(mUpdated_pos, text_data->text_str, temp_clr); } break; case SHAPE_NAME: @@ -127,9 +127,9 @@ bool afxEA_GuiText::ea_update(F32 dt) if (name && name[0] != '\0') { LinearColorF temp_clr = text_clr; - if (do_fades) - temp_clr.alpha = fade_value; - afxGuiTextHud::addTextItem(updated_pos, name, temp_clr, cons_obj); + if (mDo_fades) + temp_clr.alpha = mFade_value; + afxGuiTextHud::addTextItem(mUpdated_pos, name, temp_clr, cons_obj); } } break; @@ -146,7 +146,7 @@ void afxEA_GuiText::do_runtime_substitutions() // clone the datablock and perform substitutions afxGuiTextData* orig_db = text_data; text_data = new afxGuiTextData(*orig_db, true); - orig_db->performSubstitutions(text_data, choreographer, group_index); + orig_db->performSubstitutions(text_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_MachineGun.cpp b/Engine/source/afx/ea/afxEA_MachineGun.cpp index 0db257b87..32b09c267 100644 --- a/Engine/source/afx/ea/afxEA_MachineGun.cpp +++ b/Engine/source/afx/ea/afxEA_MachineGun.cpp @@ -110,15 +110,15 @@ bool afxEA_MachineGun::ea_update(F32 dt) { if (!shooting) { - start_time = elapsed; + start_time = mElapsed; shooting = true; } else { F32 next_shot = start_time + (shot_count+1)*shot_gap; - while (next_shot < elapsed) + while (next_shot < mElapsed) { - if (in_scope) + if (mIn_scope) launch_projectile(); next_shot += shot_gap; shot_count++; @@ -141,7 +141,7 @@ void afxEA_MachineGun::launch_projectile() if (bullet_data->getSubstitutionCount() > 0) { next_bullet = new ProjectileData(*bullet_data, true); - bullet_data->performSubstitutions(next_bullet, choreographer, group_index); + bullet_data->performSubstitutions(next_bullet, mChoreographer, mGroup_index); } projectile->onNewDataBlock(next_bullet, false); @@ -151,10 +151,10 @@ void afxEA_MachineGun::launch_projectile() afxConstraint* pos_cons = getPosConstraint(); ShapeBase* src_obj = (pos_cons) ? (dynamic_cast(pos_cons->getSceneObject())) : 0; - Point3F dir_vec = updated_aim - updated_pos; + Point3F dir_vec = mUpdated_aim - mUpdated_pos; dir_vec.normalizeSafe(); dir_vec *= muzzle_vel; - projectile->init(updated_pos, dir_vec, src_obj); + projectile->init(mUpdated_pos, dir_vec, src_obj); if (!projectile->registerObject()) { delete projectile; @@ -162,7 +162,7 @@ void afxEA_MachineGun::launch_projectile() Con::errorf("afxEA_MachineGun::launch_projectile() -- projectile failed to register."); } if (projectile) - projectile->setDataField(StringTable->insert("afxOwner"), 0, choreographer->getIdString()); + projectile->setDataField(StringTable->insert("afxOwner"), 0, mChoreographer->getIdString()); } void afxEA_MachineGun::do_runtime_substitutions() @@ -173,7 +173,7 @@ void afxEA_MachineGun::do_runtime_substitutions() // clone the datablock and perform substitutions afxMachineGunData* orig_db = gun_data; gun_data = new afxMachineGunData(*orig_db, true); - orig_db->performSubstitutions(gun_data, choreographer, group_index); + orig_db->performSubstitutions(gun_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_Model.cpp b/Engine/source/afx/ea/afxEA_Model.cpp index 23179ebe4..004acd887 100644 --- a/Engine/source/afx/ea/afxEA_Model.cpp +++ b/Engine/source/afx/ea/afxEA_Model.cpp @@ -119,18 +119,18 @@ bool afxEA_Model::ea_update(F32 dt) } deleteNotify(model); - model->setSequenceRateFactor(datablock->rate_factor/prop_time_factor); - model->setSortPriority(datablock->sort_priority); + model->setSequenceRateFactor(mDatablock->rate_factor/ mProp_time_factor); + model->setSortPriority(mDatablock->sort_priority); } if (model) { - if (do_fades) + if (mDo_fades) { - model->setFadeAmount(fade_value); + model->setFadeAmount(mFade_value); } - model->setTransform(updated_xfm); - model->setScale(updated_scale); + model->setTransform(mUpdated_xfm); + model->setScale(mUpdated_scale); } return true; @@ -141,10 +141,10 @@ void afxEA_Model::ea_finish(bool was_stopped) if (!model) return; - if (in_scope && ew_timing.residue_lifetime > 0) + if (mIn_scope && mEW_timing.residue_lifetime > 0) { clearNotify(model); - afxResidueMgr::add(ew_timing.residue_lifetime, ew_timing.residue_fadetime, model); + afxResidueMgr::add(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, model); model = 0; } else @@ -203,7 +203,7 @@ void afxEA_Model::do_runtime_substitutions() // clone the datablock and perform substitutions afxModelData* orig_db = model_data; model_data = new afxModelData(*orig_db, true); - orig_db->performSubstitutions(model_data, choreographer, group_index); + orig_db->performSubstitutions(model_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_Mooring.cpp b/Engine/source/afx/ea/afxEA_Mooring.cpp index a4e8743ee..307575149 100644 --- a/Engine/source/afx/ea/afxEA_Mooring.cpp +++ b/Engine/source/afx/ea/afxEA_Mooring.cpp @@ -92,11 +92,11 @@ bool afxEA_Mooring::ea_update(F32 dt) { if (!obj) { - if (datablock->use_ghost_as_cons_obj && datablock->effect_name != ST_NULLSTRING) + if (mDatablock->use_ghost_as_cons_obj && mDatablock->effect_name != ST_NULLSTRING) { obj = new afxMooring(mooring_data->networking, - choreographer->getChoreographerId(), - datablock->effect_name); + mChoreographer->getChoreographerId(), + mDatablock->effect_name); } else { @@ -116,7 +116,7 @@ bool afxEA_Mooring::ea_update(F32 dt) if (obj) { - obj->setTransform(updated_xfm); + obj->setTransform(mUpdated_xfm); } return true; @@ -142,7 +142,7 @@ void afxEA_Mooring::do_runtime_substitutions() // clone the datablock and perform substitutions afxMooringData* orig_db = mooring_data; mooring_data = new afxMooringData(*orig_db, true); - orig_db->performSubstitutions(mooring_data, choreographer, group_index); + orig_db->performSubstitutions(mooring_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_ParticleEmitter.cpp b/Engine/source/afx/ea/afxEA_ParticleEmitter.cpp index 7f289b893..18835e1bc 100644 --- a/Engine/source/afx/ea/afxEA_ParticleEmitter.cpp +++ b/Engine/source/afx/ea/afxEA_ParticleEmitter.cpp @@ -84,28 +84,28 @@ bool afxEA_ParticleEmitter::ea_start() { afxParticleEmitterVector* pe = new afxParticleEmitterVector(); pe->onNewDataBlock(afx_emitter_db, false); - pe->setAFXOwner(choreographer); + pe->setAFXOwner(mChoreographer); emitter = pe; } else if (dynamic_cast(emitter_data)) { afxParticleEmitterCone* pe = new afxParticleEmitterCone(); pe->onNewDataBlock(afx_emitter_db, false); - pe->setAFXOwner(choreographer); + pe->setAFXOwner(mChoreographer); emitter = pe; } else if (dynamic_cast(emitter_data)) { afxParticleEmitterPath* pe = new afxParticleEmitterPath(); pe->onNewDataBlock(afx_emitter_db, false); - pe->setAFXOwner(choreographer); + pe->setAFXOwner(mChoreographer); emitter = pe; } else if (dynamic_cast(emitter_data)) { afxParticleEmitterDisc* pe = new afxParticleEmitterDisc(); pe->onNewDataBlock(afx_emitter_db, false); - pe->setAFXOwner(choreographer); + pe->setAFXOwner(mChoreographer); emitter = pe; } } @@ -120,7 +120,7 @@ bool afxEA_ParticleEmitter::ea_start() // here we find or create any required particle-pools if (emitter_data->pool_datablock) { - afxParticlePool* pool = choreographer->findParticlePool(emitter_data->pool_datablock, emitter_data->pool_index); + afxParticlePool* pool = mChoreographer->findParticlePool(emitter_data->pool_datablock, emitter_data->pool_index); if (!pool) { afxParticlePoolData* pool_data = emitter_data->pool_datablock; @@ -129,7 +129,7 @@ bool afxEA_ParticleEmitter::ea_start() // clone the datablock and perform substitutions afxParticlePoolData* orig_db = pool_data; pool_data = new afxParticlePoolData(*orig_db, true); - orig_db->performSubstitutions(pool_data, choreographer, group_index); + orig_db->performSubstitutions(pool_data, mChoreographer, mGroup_index); } pool = new afxParticlePool(); @@ -143,8 +143,8 @@ bool afxEA_ParticleEmitter::ea_start() } if (pool) { - pool->setChoreographer(choreographer); - choreographer->registerParticlePool(pool); + pool->setChoreographer(mChoreographer); + mChoreographer->registerParticlePool(pool); } } if (pool) @@ -160,12 +160,12 @@ bool afxEA_ParticleEmitter::ea_start() return false; } - if (datablock->forced_bbox.isValidBox()) + if (mDatablock->forced_bbox.isValidBox()) { do_bbox_update = true; } - emitter->setSortPriority(datablock->sort_priority); + emitter->setSortPriority(mDatablock->sort_priority); deleteNotify(emitter); return true; @@ -173,26 +173,26 @@ bool afxEA_ParticleEmitter::ea_start() bool afxEA_ParticleEmitter::ea_update(F32 dt) { - if (emitter && in_scope) + if (emitter && mIn_scope) { if (do_bbox_update) { Box3F bbox = emitter->getObjBox(); - bbox.minExtents = updated_pos + datablock->forced_bbox.minExtents; - bbox.maxExtents = updated_pos + datablock->forced_bbox.maxExtents; + bbox.minExtents = mUpdated_pos + mDatablock->forced_bbox.minExtents; + bbox.maxExtents = mUpdated_pos + mDatablock->forced_bbox.maxExtents; emitter->setForcedObjBox(bbox); emitter->setTransform(emitter->getTransform()); - if (!datablock->update_forced_bbox) + if (!mDatablock->update_forced_bbox) do_bbox_update = false; } - if (do_fades) - emitter->setFadeAmount(fade_value); + if (mDo_fades) + emitter->setFadeAmount(mFade_value); - emitter->emitParticlesExt(updated_xfm, updated_pos, Point3F(0.0,0.0,0.0), (U32)(dt*1000)); + emitter->emitParticlesExt(mUpdated_xfm, mUpdated_pos, Point3F(0.0,0.0,0.0), (U32)(dt*1000)); } return true; @@ -209,7 +209,7 @@ void afxEA_ParticleEmitter::ea_finish(bool was_stopped) // note - fully faded particles are not always // invisible, so they are still kept alive and // deleted via deleteWhenEmpty(). - if (ew_timing.fade_out_time > 0.0f) + if (mEW_timing.fade_out_time > 0.0f) emitter->setFadeAmount(0.0f); if (dynamic_cast(emitter)) ((afxParticleEmitter*)emitter)->setAFXOwner(0); @@ -240,32 +240,32 @@ void afxEA_ParticleEmitter::do_runtime_substitutions() { afxParticleEmitterVectorData* orig_db = (afxParticleEmitterVectorData*)emitter_data; emitter_data = new afxParticleEmitterVectorData(*orig_db, true); - orig_db->performSubstitutions(emitter_data, choreographer, group_index); + orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index); } else if (dynamic_cast(emitter_data)) { afxParticleEmitterConeData* orig_db = (afxParticleEmitterConeData*)emitter_data; emitter_data = new afxParticleEmitterConeData(*orig_db, true); - orig_db->performSubstitutions(emitter_data, choreographer, group_index); + orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index); } else if (dynamic_cast(emitter_data)) { afxParticleEmitterPathData* orig_db = (afxParticleEmitterPathData*)emitter_data; emitter_data = new afxParticleEmitterPathData(*orig_db, true); - orig_db->performSubstitutions(emitter_data, choreographer, group_index); + orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index); } else if (dynamic_cast(emitter_data)) { afxParticleEmitterDiscData* orig_db = (afxParticleEmitterDiscData*)emitter_data; emitter_data = new afxParticleEmitterDiscData(*orig_db, true); - orig_db->performSubstitutions(emitter_data, choreographer, group_index); + orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index); } } else { ParticleEmitterData* orig_db = emitter_data; emitter_data = new ParticleEmitterData(*orig_db, true); - orig_db->performSubstitutions(emitter_data, choreographer, group_index); + orig_db->performSubstitutions(emitter_data, mChoreographer, mGroup_index); } if (clone_particles) @@ -277,7 +277,7 @@ void afxEA_ParticleEmitter::do_runtime_substitutions() // clone the datablock and perform substitutions ParticleData* orig_db = emitter_data->particleDataBlocks[i]; emitter_data->particleDataBlocks[i] = new ParticleData(*orig_db, true); - orig_db->performSubstitutions(emitter_data->particleDataBlocks[i], choreographer, group_index); + orig_db->performSubstitutions(emitter_data->particleDataBlocks[i], mChoreographer, mGroup_index); } } } diff --git a/Engine/source/afx/ea/afxEA_PhraseEffect.cpp b/Engine/source/afx/ea/afxEA_PhraseEffect.cpp index e253ab1ee..1e14d2c6a 100644 --- a/Engine/source/afx/ea/afxEA_PhraseEffect.cpp +++ b/Engine/source/afx/ea/afxEA_PhraseEffect.cpp @@ -137,7 +137,7 @@ void afxEA_PhraseEffect::grab_player_triggers(U32& trigger_mask) bool afxEA_PhraseEffect::ea_update(F32 dt) { - if (fade_value >= 1.0f) + if (mFade_value >= 1.0f) { // // Choreographer Triggers: @@ -145,7 +145,7 @@ bool afxEA_PhraseEffect::ea_update(F32 dt) // They must be set explicitly by calls to afxChoreographer // console-methods, setTriggerBit(), or clearTriggerBit(). // - U32 trigger_mask = (phrase_fx_data->no_choreographer_trigs) ? 0 : choreographer->getTriggerMask(); + U32 trigger_mask = (phrase_fx_data->no_choreographer_trigs) ? 0 : mChoreographer->getTriggerMask(); // // Constraint Triggers: @@ -191,7 +191,7 @@ bool afxEA_PhraseEffect::ea_update(F32 dt) { for (S32 i = 0; i < active_phrases->size(); i++) { - (*active_phrases)[i]->stop(life_elapsed); + (*active_phrases)[i]->stop(mLife_elapsed); } } } @@ -240,7 +240,7 @@ void afxEA_PhraseEffect::ea_finish(bool was_stopped) { for (S32 i = 0; i < active_phrases->size(); i++) { - (*active_phrases)[i]->stop(life_elapsed); + (*active_phrases)[i]->stop(mLife_elapsed); } } @@ -252,7 +252,7 @@ void afxEA_PhraseEffect::do_runtime_substitutions() // clone the datablock and perform substitutions afxPhraseEffectData* orig_db = phrase_fx_data; phrase_fx_data = new afxPhraseEffectData(*orig_db, true); - orig_db->performSubstitutions(phrase_fx_data, choreographer, group_index); + orig_db->performSubstitutions(phrase_fx_data, mChoreographer, mGroup_index); } } @@ -260,8 +260,8 @@ void afxEA_PhraseEffect::trigger_new_phrase() { //afxPhrase* phrase = new afxPhrase(choreographer->isServerObject(), /*willStop=*/false); bool will_stop = phrase_fx_data->phrase_type == afxPhraseEffectData::PHRASE_CONTINUOUS; - afxPhrase* phrase = new afxPhrase(choreographer->isServerObject(), will_stop); - phrase->init(phrase_fx_data->fx_list, datablock->ewd_timing.lifetime, choreographer, time_factor, phrase_fx_data->n_loops, group_index); + afxPhrase* phrase = new afxPhrase(mChoreographer->isServerObject(), will_stop); + phrase->init(phrase_fx_data->fx_list, mDatablock->ewd_timing.lifetime, mChoreographer, mTime_factor, phrase_fx_data->n_loops, mGroup_index); phrase->start(0, 0); if (phrase->isEmpty()) { @@ -272,10 +272,10 @@ void afxEA_PhraseEffect::trigger_new_phrase() if (phrase_fx_data->on_trig_cmd != ST_NULLSTRING) { char obj_str[32]; - dStrcpy(obj_str, Con::getIntArg(choreographer->getId()), 32); + dStrcpy(obj_str, Con::getIntArg(mChoreographer->getId()), 32); char index_str[32]; - dStrcpy(index_str, Con::getIntArg(group_index), 32); + dStrcpy(index_str, Con::getIntArg(mGroup_index), 32); char buffer[1024]; char* b = buffer; @@ -331,9 +331,9 @@ void afxEA_PhraseEffect::update_active_phrases(F32 dt) for (S32 i = 0; i < active_phrases->size(); i++) { afxPhrase* phrase = (*active_phrases)[i]; - if (phrase->expired(life_elapsed)) - phrase->recycle(life_elapsed); - phrase->update(dt, life_elapsed); + if (phrase->expired(mLife_elapsed)) + phrase->recycle(mLife_elapsed); + phrase->update(dt, mLife_elapsed); } } diff --git a/Engine/source/afx/ea/afxEA_PhysicalZone.cpp b/Engine/source/afx/ea/afxEA_PhysicalZone.cpp index 02012c358..7dbc8062f 100644 --- a/Engine/source/afx/ea/afxEA_PhysicalZone.cpp +++ b/Engine/source/afx/ea/afxEA_PhysicalZone.cpp @@ -127,9 +127,9 @@ bool afxEA_PhysicalZone::ea_update(F32 dt) set_cons_object((pos_constraint) ? pos_constraint->getSceneObject() : 0); } - if (do_fades) - physical_zone->setFadeAmount(fade_value); - physical_zone->setTransform(updated_xfm); + if (mDo_fades) + physical_zone->setFadeAmount(mFade_value); + physical_zone->setTransform(mUpdated_xfm); } return true; @@ -172,7 +172,7 @@ void afxEA_PhysicalZone::do_runtime_substitutions() // clone the datablock and perform substitutions afxPhysicalZoneData* orig_db = zone_data; zone_data = new afxPhysicalZoneData(*orig_db, true); - orig_db->performSubstitutions(zone_data, choreographer, group_index); + orig_db->performSubstitutions(zone_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_PlayerMovement.cpp b/Engine/source/afx/ea/afxEA_PlayerMovement.cpp index 03aac77b2..a563201cc 100644 --- a/Engine/source/afx/ea/afxEA_PlayerMovement.cpp +++ b/Engine/source/afx/ea/afxEA_PlayerMovement.cpp @@ -136,7 +136,7 @@ void afxEA_PlayerMovement::do_runtime_substitutions() // clone the datablock and perform substitutions afxPlayerMovementData* orig_db = movement_data; movement_data = new afxPlayerMovementData(*orig_db, true); - orig_db->performSubstitutions(movement_data, choreographer, group_index); + orig_db->performSubstitutions(movement_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_PlayerPuppet.cpp b/Engine/source/afx/ea/afxEA_PlayerPuppet.cpp index 08c446956..822a69b06 100644 --- a/Engine/source/afx/ea/afxEA_PlayerPuppet.cpp +++ b/Engine/source/afx/ea/afxEA_PlayerPuppet.cpp @@ -80,8 +80,8 @@ bool afxEA_PlayerPuppet::ea_start() do_runtime_substitutions(); - afxConstraintID obj_id = cons_mgr->getConstraintId(mover_data->obj_def); - obj_cons = cons_mgr->getConstraint(obj_id); + afxConstraintID obj_id = mCons_mgr->getConstraintId(mover_data->obj_def); + obj_cons = mCons_mgr->getConstraint(obj_id); Player* player = dynamic_cast((obj_cons) ? obj_cons->getSceneObject() : 0); if (player) @@ -94,9 +94,9 @@ bool afxEA_PlayerPuppet::ea_update(F32 dt) { SceneObject* obj = (obj_cons) ? obj_cons->getSceneObject() : 0; - if (obj && in_scope) + if (obj && mIn_scope) { - obj->setTransform(updated_xfm); + obj->setTransform(mUpdated_xfm); } return true; @@ -138,7 +138,7 @@ void afxEA_PlayerPuppet::do_runtime_substitutions() // clone the datablock and perform substitutions afxPlayerPuppetData* orig_db = mover_data; mover_data = new afxPlayerPuppetData(*orig_db, true); - orig_db->performSubstitutions(mover_data, choreographer, group_index); + orig_db->performSubstitutions(mover_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp b/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp index 3035da8d3..d0e87bf19 100644 --- a/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp +++ b/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp @@ -203,12 +203,12 @@ bool afxEA_T3DPointLight::ea_update(F32 dt) light->setConstraintObject(cons_obj); #endif - light->setLiveColor(updated_color); + light->setLiveColor(mUpdated_color); - if (do_fades) - light->setFadeAmount(fade_value*updated_scale.x); + if (mDo_fades) + light->setFadeAmount(mFade_value*mUpdated_scale.x); - light->updateTransform(updated_xfm); + light->updateTransform(mUpdated_xfm); // scale should not be updated this way. It messes up the culling. //light->setScale(updated_scale); @@ -254,7 +254,7 @@ void afxEA_T3DPointLight::do_runtime_substitutions() // clone the datablock and perform substitutions afxT3DPointLightData* orig_db = light_data; light_data = new afxT3DPointLightData(*orig_db, true); - orig_db->performSubstitutions(light_data, choreographer, group_index); + orig_db->performSubstitutions(light_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_Projectile.cpp b/Engine/source/afx/ea/afxEA_Projectile.cpp index 104d5abb2..0f26d79b3 100644 --- a/Engine/source/afx/ea/afxEA_Projectile.cpp +++ b/Engine/source/afx/ea/afxEA_Projectile.cpp @@ -92,7 +92,7 @@ afxEA_Projectile::~afxEA_Projectile() bool afxEA_Projectile::isDone() { - return (datablock->use_as_cons_obj || datablock->use_ghost_as_cons_obj) ? projectile_done : impacted; + return (mDatablock->use_as_cons_obj || mDatablock->use_ghost_as_cons_obj) ? projectile_done : impacted; } void afxEA_Projectile::ea_set_datablock(SimDataBlock* db) @@ -117,8 +117,8 @@ bool afxEA_Projectile::ea_start() } else { - if (datablock->use_ghost_as_cons_obj && datablock->effect_name != ST_NULLSTRING) - projectile = new afxProjectile(afx_projectile_data->networking, choreographer->getChoreographerId(), datablock->effect_name); + if (mDatablock->use_ghost_as_cons_obj && mDatablock->effect_name != ST_NULLSTRING) + projectile = new afxProjectile(afx_projectile_data->networking, mChoreographer->getChoreographerId(), mDatablock->effect_name); else projectile = new afxProjectile(afx_projectile_data->networking, 0, ST_NULLSTRING); projectile->ignoreSourceTimeout = afx_projectile_data->ignore_src_timeout; @@ -127,8 +127,8 @@ bool afxEA_Projectile::ea_start() projectile->dynamicCollisionMask = afx_projectile_data->dynamicCollisionMask; projectile->staticCollisionMask = afx_projectile_data->staticCollisionMask; } - afxConstraintID launch_pos_id = cons_mgr->getConstraintId(afx_projectile_data->launch_pos_def); - launch_cons = cons_mgr->getConstraint(launch_pos_id); + afxConstraintID launch_pos_id = mCons_mgr->getConstraintId(afx_projectile_data->launch_pos_def); + launch_cons = mCons_mgr->getConstraint(launch_pos_id); launch_dir_bias = afx_projectile_data->launch_dir_bias; } @@ -141,7 +141,7 @@ bool afxEA_Projectile::ea_update(F32 dt) { if (!launched && projectile) { - if (in_scope) + if (mIn_scope) { afxConstraint* pos_cons = getPosConstraint(); ShapeBase* src_obj = (pos_cons) ? (dynamic_cast(pos_cons->getSceneObject())) : 0; @@ -155,19 +155,19 @@ bool afxEA_Projectile::ea_update(F32 dt) { case afxProjectileData::OrientConstraint: dir_vec.set(0,0,1); - updated_xfm.mulV(dir_vec); + mUpdated_xfm.mulV(dir_vec); break; case afxProjectileData::LaunchDirField: dir_vec.set(0,0,1); break; case afxProjectileData::TowardPos2Constraint: default: - dir_vec = updated_aim - updated_pos; + dir_vec = mUpdated_aim - mUpdated_pos; break; } } else - dir_vec = updated_aim - updated_pos; + dir_vec = mUpdated_aim - mUpdated_pos; dir_vec.normalizeSafe(); if (!launch_dir_bias.isZero()) @@ -184,7 +184,7 @@ bool afxEA_Projectile::ea_update(F32 dt) projectile->init(launch_pos, dir_vec, (launch_obj) ? launch_obj : src_obj); } else - projectile->init(updated_pos, dir_vec, src_obj); + projectile->init(mUpdated_pos, dir_vec, src_obj); if (!projectile->registerObject()) { @@ -197,7 +197,7 @@ bool afxEA_Projectile::ea_update(F32 dt) deleteNotify(projectile); if (projectile) - projectile->setDataField(StringTable->insert("afxOwner"), 0, choreographer->getIdString()); + projectile->setDataField(StringTable->insert("afxOwner"), 0, mChoreographer->getIdString()); } launched = true; @@ -205,10 +205,10 @@ bool afxEA_Projectile::ea_update(F32 dt) if (launched && projectile) { - if (in_scope) + if (mIn_scope) { - updated_xfm = projectile->getRenderTransform(); - updated_xfm.getColumn(3, &updated_pos); + mUpdated_xfm = projectile->getRenderTransform(); + mUpdated_xfm.getColumn(3, &mUpdated_pos); } } @@ -247,7 +247,7 @@ void afxEA_Projectile::do_runtime_substitutions() afxProjectileData* orig_db = (afxProjectileData*)projectile_data; afx_projectile_data = new afxProjectileData(*orig_db, true); projectile_data = afx_projectile_data; - orig_db->performSubstitutions(projectile_data, choreographer, group_index); + orig_db->performSubstitutions(projectile_data, mChoreographer, mGroup_index); } else { @@ -255,7 +255,7 @@ void afxEA_Projectile::do_runtime_substitutions() ProjectileData* orig_db = projectile_data; afx_projectile_data = 0; projectile_data = new ProjectileData(*orig_db, true); - orig_db->performSubstitutions(projectile_data, choreographer, group_index); + orig_db->performSubstitutions(projectile_data, mChoreographer, mGroup_index); } } } diff --git a/Engine/source/afx/ea/afxEA_ScriptEvent.cpp b/Engine/source/afx/ea/afxEA_ScriptEvent.cpp index ca5de9966..a80c1b8d2 100644 --- a/Engine/source/afx/ea/afxEA_ScriptEvent.cpp +++ b/Engine/source/afx/ea/afxEA_ScriptEvent.cpp @@ -91,10 +91,10 @@ bool afxEA_ScriptEvent::ea_start() bool afxEA_ScriptEvent::ea_update(F32 dt) { - if (!ran_script && choreographer != NULL) + if (!ran_script && mChoreographer != NULL) { afxConstraint* pos_constraint = getPosConstraint(); - choreographer->executeScriptEvent(script_data->method_name, pos_constraint, updated_xfm, + mChoreographer->executeScriptEvent(script_data->method_name, pos_constraint, mUpdated_xfm, script_data->script_data); ran_script = true; } @@ -115,7 +115,7 @@ void afxEA_ScriptEvent::do_runtime_substitutions() // clone the datablock and perform substitutions afxScriptEventData* orig_db = script_data; script_data = new afxScriptEventData(*orig_db, true); - orig_db->performSubstitutions(script_data, choreographer, group_index); + orig_db->performSubstitutions(script_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_Sound.cpp b/Engine/source/afx/ea/afxEA_Sound.cpp index 3b7f69a88..36ceebcd3 100644 --- a/Engine/source/afx/ea/afxEA_Sound.cpp +++ b/Engine/source/afx/ea/afxEA_Sound.cpp @@ -108,15 +108,15 @@ bool afxEA_Sound::ea_update(F32 dt) { if (!sound_handle) { - sound_handle = SFX->createSource(sound_prof, &updated_xfm, 0); + sound_handle = SFX->createSource(sound_prof, &mUpdated_xfm, 0); if (sound_handle) sound_handle->play(); } if (sound_handle) { - sound_handle->setTransform(updated_xfm); - sound_handle->setVolume((in_scope) ? updated_scale.x*fade_value : 0.0f); + sound_handle->setTransform(mUpdated_xfm); + sound_handle->setVolume((mIn_scope) ? mUpdated_scale.x*mFade_value : 0.0f); deleteNotify(sound_handle); } @@ -134,7 +134,7 @@ void afxEA_Sound::ea_finish(bool was_stopped) void afxEA_Sound::do_runtime_substitutions() { - sound_prof = sound_prof->cloneAndPerformSubstitutions(choreographer, group_index); + sound_prof = sound_prof->cloneAndPerformSubstitutions(mChoreographer, mGroup_index); sound_desc = sound_prof->getDescription(); } diff --git a/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp b/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp index eebab60c8..9e847fa1e 100644 --- a/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp +++ b/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp @@ -207,12 +207,12 @@ bool afxEA_T3DSpotLight::ea_update(F32 dt) light->setConstraintObject(cons_obj); #endif - light->setLiveColor(updated_color); + light->setLiveColor(mUpdated_color); - if (do_fades) - light->setFadeAmount(fade_value); + if (mDo_fades) + light->setFadeAmount(mFade_value); - light->updateTransform(updated_xfm); + light->updateTransform(mUpdated_xfm); // scale should not be updated this way. It messes up the culling. //light->setScale(updated_scale); @@ -258,7 +258,7 @@ void afxEA_T3DSpotLight::do_runtime_substitutions() // clone the datablock and perform substitutions afxT3DSpotLightData* orig_db = light_data; light_data = new afxT3DSpotLightData(*orig_db, true); - orig_db->performSubstitutions(light_data, choreographer, group_index); + orig_db->performSubstitutions(light_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_StaticShape.cpp b/Engine/source/afx/ea/afxEA_StaticShape.cpp index 7f0b35351..20e276335 100644 --- a/Engine/source/afx/ea/afxEA_StaticShape.cpp +++ b/Engine/source/afx/ea/afxEA_StaticShape.cpp @@ -97,7 +97,7 @@ bool afxEA_StaticShape::ea_start() do_runtime_substitutions(); // fades are handled using startFade() calls. - do_fades = false; + mDo_fades = false; return true; } @@ -108,8 +108,8 @@ bool afxEA_StaticShape::ea_update(F32 dt) { // create and register effect static_shape = new afxStaticShape(); - if (datablock->use_ghost_as_cons_obj && datablock->effect_name != ST_NULLSTRING) - static_shape->init(choreographer->getChoreographerId(), datablock->effect_name); + if (mDatablock->use_ghost_as_cons_obj && mDatablock->effect_name != ST_NULLSTRING) + static_shape->init(mChoreographer->getChoreographerId(), mDatablock->effect_name); static_shape->onNewDataBlock(shape_data, false); if (!static_shape->registerObject()) @@ -122,26 +122,26 @@ bool afxEA_StaticShape::ea_update(F32 dt) deleteNotify(static_shape); registerForCleanup(static_shape); - if (ew_timing.fade_in_time > 0.0f) - static_shape->startFade(ew_timing.fade_in_time, 0, false); + if (mEW_timing.fade_in_time > 0.0f) + static_shape->startFade(mEW_timing.fade_in_time, 0, false); } if (static_shape) { - if (!fade_out_started && elapsed > fade_out_start) + if (!fade_out_started && mElapsed > mFade_out_start) { if (!do_spawn) { - if (ew_timing.fade_out_time > 0.0f) - static_shape->startFade(ew_timing.fade_out_time, 0, true); + if (mEW_timing.fade_out_time > 0.0f) + static_shape->startFade(mEW_timing.fade_out_time, 0, true); } fade_out_started = true; } - if (in_scope) + if (mIn_scope) { - static_shape->setTransform(updated_xfm); - static_shape->setScale(updated_scale); + static_shape->setTransform(mUpdated_xfm); + static_shape->setScale(mUpdated_scale); } } @@ -155,7 +155,7 @@ void afxEA_StaticShape::ea_finish(bool was_stopped) if (do_spawn) { - Con::executef(shape_data, "onSpawn", static_shape->getIdString(), datablock->effect_name); + Con::executef(shape_data, "onSpawn", static_shape->getIdString(), mDatablock->effect_name); clearNotify(static_shape); } else @@ -204,13 +204,13 @@ void afxEA_StaticShape::do_runtime_substitutions() { afxStaticShapeData* orig_db = (afxStaticShapeData*)shape_data; shape_data = new afxStaticShapeData(*orig_db, true); - orig_db->performSubstitutions(shape_data, choreographer, group_index); + orig_db->performSubstitutions(shape_data, mChoreographer, mGroup_index); } else { StaticShapeData* orig_db = shape_data; shape_data = new StaticShapeData(*orig_db, true); - orig_db->performSubstitutions(shape_data, choreographer, group_index); + orig_db->performSubstitutions(shape_data, mChoreographer, mGroup_index); } } } diff --git a/Engine/source/afx/ea/afxEA_Zodiac.cpp b/Engine/source/afx/ea/afxEA_Zodiac.cpp index d5fb5dd9c..9e76f50ad 100644 --- a/Engine/source/afx/ea/afxEA_Zodiac.cpp +++ b/Engine/source/afx/ea/afxEA_Zodiac.cpp @@ -108,16 +108,16 @@ F32 afxEA_Zodiac::calc_facing_angle() inline F32 afxEA_Zodiac::calc_terrain_alt_bias() { - if (terrain_altitude >= zode_data->altitude_max) + if (mTerrain_altitude >= zode_data->altitude_max) return 0.0f; - return 1.0f - (terrain_altitude - zode_data->altitude_falloff)/altitude_falloff_range; + return 1.0f - (mTerrain_altitude - zode_data->altitude_falloff)/altitude_falloff_range; } inline F32 afxEA_Zodiac::calc_interior_alt_bias() { - if (interior_altitude >= zode_data->altitude_max) + if (mInterior_altitude >= zode_data->altitude_max) return 0.0f; - return 1.0f - (interior_altitude - zode_data->altitude_falloff)/altitude_falloff_range; + return 1.0f - (mInterior_altitude - zode_data->altitude_falloff)/altitude_falloff_range; } afxEA_Zodiac::afxEA_Zodiac() @@ -170,13 +170,13 @@ bool afxEA_Zodiac::ea_start() bool afxEA_Zodiac::ea_update(F32 dt) { - if (!in_scope) + if (!mIn_scope) return true; //~~~~~~~~~~~~~~~~~~~~// // Zodiac Color - zode_color = updated_color; + zode_color = mUpdated_color; if (live_color_factor > 0.0) { @@ -190,15 +190,15 @@ bool afxEA_Zodiac::ea_update(F32 dt) //Con::printf("LIVE-COLOR-FACTOR is ZERO"); } - if (do_fades) + if (mDo_fades) { - if (fade_value < 0.01f) + if (mFade_value < 0.01f) return true; // too transparent if (zode_data->blend_flags == afxZodiacDefs::BLEND_SUBTRACTIVE) - zode_color *= fade_value*live_fade_factor; + zode_color *= mFade_value * mLive_fade_factor; else - zode_color.alpha *= fade_value*live_fade_factor; + zode_color.alpha *= mFade_value * mLive_fade_factor; } if (zode_color.alpha < 0.01f) @@ -208,22 +208,22 @@ bool afxEA_Zodiac::ea_update(F32 dt) // Zodiac // scale and grow zode - zode_radius = zode_data->radius_xy*updated_scale.x + life_elapsed*zode_data->growth_rate; + zode_radius = zode_data->radius_xy*mUpdated_scale.x + mLife_elapsed *zode_data->growth_rate; // zode is growing - if (life_elapsed < zode_data->grow_in_time) + if (mLife_elapsed < zode_data->grow_in_time) { - F32 t = life_elapsed/zode_data->grow_in_time; + F32 t = mLife_elapsed /zode_data->grow_in_time; zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.2f, 0.8f); } // zode is shrinking - else if (full_lifetime - life_elapsed < zode_data->shrink_out_time) + else if (mFull_lifetime - mLife_elapsed < zode_data->shrink_out_time) { - F32 t = (full_lifetime - life_elapsed)/zode_data->shrink_out_time; + F32 t = (mFull_lifetime - mLife_elapsed)/zode_data->shrink_out_time; zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.0f, 0.9f); } - zode_radius *= live_scale_factor; + zode_radius *= mLive_scale_factor; if (zode_radius < 0.001f) return true; // too small @@ -238,7 +238,7 @@ bool afxEA_Zodiac::ea_update(F32 dt) //~~~~~~~~~~~~~~~~~~~~// // Zodiac Position - zode_pos = updated_pos; + zode_pos = mUpdated_pos; //~~~~~~~~~~~~~~~~~~~~// // Zodiac Rotation @@ -249,7 +249,7 @@ bool afxEA_Zodiac::ea_update(F32 dt) if (orient_constraint) { VectorF shape_vec; - updated_xfm.getColumn(1, &shape_vec); + mUpdated_xfm.getColumn(1, &shape_vec); shape_vec.z = 0.0f; shape_vec.normalize(); F32 pitch, yaw; @@ -258,14 +258,14 @@ bool afxEA_Zodiac::ea_update(F32 dt) } } - zode_angle = zode_data->calcRotationAngle(life_elapsed, datablock->rate_factor/prop_time_factor); + zode_angle = zode_data->calcRotationAngle(mLife_elapsed, mDatablock->rate_factor/ mProp_time_factor); zode_angle = mFmod(zode_angle + zode_angle_offset, 360.0f); //~~~~~~~~~~~~~~~~~~~~// // post zodiac if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_TERRAIN) != 0) { - if (do_altitude_bias && terrain_altitude > zode_data->altitude_falloff) + if (do_altitude_bias && mTerrain_altitude > zode_data->altitude_falloff) { F32 alt_bias = calc_terrain_alt_bias(); if (alt_bias > 0.0f) @@ -287,7 +287,7 @@ bool afxEA_Zodiac::ea_update(F32 dt) if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_INTERIORS) != 0) { - if (do_altitude_bias && interior_altitude > zode_data->altitude_falloff) + if (do_altitude_bias && mInterior_altitude > zode_data->altitude_falloff) { F32 alt_bias = calc_interior_alt_bias(); if (alt_bias > 0.0f) @@ -310,17 +310,17 @@ bool afxEA_Zodiac::ea_update(F32 dt) void afxEA_Zodiac::ea_finish(bool was_stopped) { - if (in_scope && ew_timing.residue_lifetime > 0) + if (mIn_scope && mEW_timing.residue_lifetime > 0) { - if (do_fades) + if (mDo_fades) { - if (fade_value < 0.01f) + if (mFade_value < 0.01f) return; - zode_color.alpha *= fade_value; + zode_color.alpha *= mFade_value; } if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_TERRAIN) != 0) { - if (do_altitude_bias && terrain_altitude > zode_data->altitude_falloff) + if (do_altitude_bias && mTerrain_altitude > zode_data->altitude_falloff) { F32 alt_bias = calc_terrain_alt_bias(); if (alt_bias > 0.0f) @@ -332,20 +332,20 @@ void afxEA_Zodiac::ea_finish(bool was_stopped) if (zode_data->altitude_fades) zode_color.alpha *= alt_bias; became_residue = true; - afxResidueMgr::add_terrain_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, zode_data, zode_pos, alt_rad, + afxResidueMgr::add_terrain_zodiac(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, zode_data, zode_pos, alt_rad, alt_clr, zode_angle); } } else { became_residue = true; - afxResidueMgr::add_terrain_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, zode_data, zode_pos, zode_radius, + afxResidueMgr::add_terrain_zodiac(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, zode_data, zode_pos, zode_radius, zode_color, zode_angle); } } if ((zode_data->zflags & afxZodiacDefs::SHOW_ON_INTERIORS) != 0) { - if (do_altitude_bias && interior_altitude > zode_data->altitude_falloff) + if (do_altitude_bias && mInterior_altitude > zode_data->altitude_falloff) { F32 alt_bias = calc_interior_alt_bias(); if (alt_bias > 0.0f) @@ -361,7 +361,7 @@ void afxEA_Zodiac::ea_finish(bool was_stopped) if (became_residue) temp_zode = new afxZodiacData(*zode_data, true); became_residue = true; - afxResidueMgr::add_interior_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, temp_zode, zode_pos, alt_rad, + afxResidueMgr::add_interior_zodiac(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, temp_zode, zode_pos, alt_rad, zode_vrange, alt_clr, zode_angle); } @@ -372,7 +372,7 @@ void afxEA_Zodiac::ea_finish(bool was_stopped) if (became_residue) temp_zode = new afxZodiacData(*zode_data, true); became_residue = true; - afxResidueMgr::add_interior_zodiac(ew_timing.residue_lifetime, ew_timing.residue_fadetime, temp_zode, zode_pos, zode_radius, + afxResidueMgr::add_interior_zodiac(mEW_timing.residue_lifetime, mEW_timing.residue_fadetime, temp_zode, zode_pos, zode_radius, zode_vrange, zode_color, zode_angle); } } @@ -387,7 +387,7 @@ void afxEA_Zodiac::do_runtime_substitutions() // clone the datablock and perform substitutions afxZodiacData* orig_db = zode_data; zode_data = new afxZodiacData(*orig_db, true); - orig_db->performSubstitutions(zode_data, choreographer, group_index); + orig_db->performSubstitutions(zode_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/ea/afxEA_ZodiacPlane.cpp b/Engine/source/afx/ea/afxEA_ZodiacPlane.cpp index ca4271860..43246f8f1 100644 --- a/Engine/source/afx/ea/afxEA_ZodiacPlane.cpp +++ b/Engine/source/afx/ea/afxEA_ZodiacPlane.cpp @@ -174,42 +174,42 @@ bool afxEA_ZodiacPlane::ea_update(F32 dt) if (pzode) { //LinearColorF zode_color = zode_data->color; - LinearColorF zode_color = updated_color; + LinearColorF zode_color = mUpdated_color; if (live_color_factor > 0.0) zode_color.interpolate(zode_color, live_color, live_color_factor); - if (do_fades) + if (mDo_fades) { if (zode_data->blend_flags == afxZodiacDefs::BLEND_SUBTRACTIVE) - zode_color *= fade_value*live_fade_factor; + zode_color *= mFade_value *mLive_fade_factor; else - zode_color.alpha *= fade_value*live_fade_factor; + zode_color.alpha *= mFade_value * mLive_fade_factor; } // scale and grow zode //F32 zode_radius = zode_data->radius_xy*updated_scale.x + life_elapsed*zode_data->growth_rate; - F32 zode_radius = zode_data->radius_xy + life_elapsed*zode_data->growth_rate; + F32 zode_radius = zode_data->radius_xy + mLife_elapsed *zode_data->growth_rate; // zode is growing - if (life_elapsed < zode_data->grow_in_time) + if (mLife_elapsed < zode_data->grow_in_time) { - F32 t = life_elapsed/zode_data->grow_in_time; + F32 t = mLife_elapsed /zode_data->grow_in_time; zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.2f, 0.8f); } // zode is shrinking - else if (full_lifetime - life_elapsed < zode_data->shrink_out_time) + else if (mFull_lifetime - mLife_elapsed < zode_data->shrink_out_time) { - F32 t = (full_lifetime - life_elapsed)/zode_data->shrink_out_time; + F32 t = (mFull_lifetime - mLife_elapsed)/zode_data->shrink_out_time; zode_radius = afxEase::eq(t, 0.001f, zode_radius, 0.0f, 0.9f); } - zode_radius *= live_scale_factor; + zode_radius *= mLive_scale_factor; if (zode_data->respect_ori_cons && !zode_data->use_full_xfm) { VectorF shape_vec; - updated_xfm.getColumn(1, &shape_vec); + mUpdated_xfm.getColumn(1, &shape_vec); shape_vec.normalize(); F32 ang; @@ -246,7 +246,7 @@ bool afxEA_ZodiacPlane::ea_update(F32 dt) zode_angle_offset = mRadToDeg(ang); } - F32 zode_angle = zode_data->calcRotationAngle(life_elapsed, datablock->rate_factor/prop_time_factor); + F32 zode_angle = zode_data->calcRotationAngle(mLife_elapsed, mDatablock->rate_factor/ mProp_time_factor); zode_angle = mFmod(zode_angle + zode_angle_offset, 360.0f); aa_rot.angle = mDegToRad(zode_angle); @@ -258,13 +258,13 @@ bool afxEA_ZodiacPlane::ea_update(F32 dt) pzode->setRadius(zode_radius); if (zode_data->use_full_xfm) { - updated_xfm.mul(spin_xfm); - pzode->setTransform(updated_xfm); + mUpdated_xfm.mul(spin_xfm); + pzode->setTransform(mUpdated_xfm); } else pzode->setTransform(spin_xfm); - pzode->setPosition(updated_pos); - pzode->setScale(updated_scale); + pzode->setPosition(mUpdated_pos); + pzode->setScale(mUpdated_scale); } return true; @@ -307,7 +307,7 @@ void afxEA_ZodiacPlane::do_runtime_substitutions() // clone the datablock and perform substitutions afxZodiacPlaneData* orig_db = zode_data; zode_data = new afxZodiacPlaneData(*orig_db, true); - orig_db->performSubstitutions(zode_data, choreographer, group_index); + orig_db->performSubstitutions(zode_data, mChoreographer, mGroup_index); } } diff --git a/Engine/source/afx/forces/afxEA_Force.cpp b/Engine/source/afx/forces/afxEA_Force.cpp index 7ec2332f1..4f2ac1273 100644 --- a/Engine/source/afx/forces/afxEA_Force.cpp +++ b/Engine/source/afx/forces/afxEA_Force.cpp @@ -95,7 +95,7 @@ bool afxEA_Force::ea_start() do_runtime_substitutions(); - force_set_mgr = choreographer->getForceSetMgr(); + force_set_mgr = mChoreographer->getForceSetMgr(); return true; } @@ -109,7 +109,7 @@ bool afxEA_Force::ea_update(F32 dt) { delete force; force = 0; - Con::errorf(ConsoleLogEntry::General, "Force effect failed to instantiate. (%s)", datablock->getName()); + Con::errorf(ConsoleLogEntry::General, "Force effect failed to instantiate. (%s)", mDatablock->getName()); return false; } force->onNewDataBlock(force_data, false); @@ -123,8 +123,8 @@ bool afxEA_Force::ea_update(F32 dt) if (force) // && in_scope) { - if (do_fades) - force->setFadeAmount(fade_value); + if (mDo_fades) + force->setFadeAmount(mFade_value); force->update(dt); } @@ -145,7 +145,7 @@ void afxEA_Force::ea_finish(bool was_stopped) void afxEA_Force::do_runtime_substitutions() { - force_data = force_data->cloneAndPerformSubstitutions(choreographer, group_index); + force_data = force_data->cloneAndPerformSubstitutions(mChoreographer, mGroup_index); } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/xm/afxXM_AltitudeConform.cpp b/Engine/source/afx/xm/afxXM_AltitudeConform.cpp index 02ce4634b..d2be81cc8 100644 --- a/Engine/source/afx/xm/afxXM_AltitudeConform.cpp +++ b/Engine/source/afx/xm/afxXM_AltitudeConform.cpp @@ -60,13 +60,13 @@ class afxXM_AltitudeConform : public afxXM_WeightedBase { typedef afxXM_WeightedBase Parent; - afxXM_AltitudeConformData* db; - SceneContainer* container; - bool do_freeze; - bool is_frozen; - F32 terrain_alt; - F32 interior_alt; - Point3F conformed_pos; + afxXM_AltitudeConformData* mConformData; + SceneContainer* mContainer; + bool mDo_freeze; + bool mIs_frozen; + F32 mTerrain_alt; + F32 mInterior_alt; + Point3F mConformed_pos; public: /*C*/ afxXM_AltitudeConform(afxXM_AltitudeConformData*, afxEffectWrapper*, bool on_server); @@ -157,24 +157,24 @@ afxXM_Base* afxXM_AltitudeConformData::create(afxEffectWrapper* fx, bool on_serv afxXM_AltitudeConform::afxXM_AltitudeConform(afxXM_AltitudeConformData* db, afxEffectWrapper* fxw, bool on_server) : afxXM_WeightedBase(db, fxw) { - this->db = db; - container = (on_server) ? &gServerContainer : &gClientContainer; - do_freeze = db->do_freeze; - is_frozen = false; - terrain_alt = -1.0f; - interior_alt = -1.0f; - conformed_pos.zero(); + mConformData = db; + mContainer = (on_server) ? &gServerContainer : &gClientContainer; + mDo_freeze = db->do_freeze; + mIs_frozen = false; + mTerrain_alt = -1.0f; + mInterior_alt = -1.0f; + mConformed_pos.zero(); } void afxXM_AltitudeConform::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) { - if (is_frozen) + if (mIs_frozen) { - if (terrain_alt >= 0.0f) - fx_wrapper->setTerrainAltitude(terrain_alt); - if (interior_alt >= 0.0f) - fx_wrapper->setInteriorAltitude(interior_alt); - params.pos = conformed_pos; + if (mTerrain_alt >= 0.0f) + fx_wrapper->setTerrainAltitude(mTerrain_alt); + if (mInterior_alt >= 0.0f) + fx_wrapper->setInteriorAltitude(mInterior_alt); + params.pos = mConformed_pos; return; } @@ -185,53 +185,51 @@ void afxXM_AltitudeConform::updateParams(F32 dt, F32 elapsed, afxXM_Params& para // find primary ground Point3F above_pos(params.pos); above_pos.z += 0.1f; Point3F below_pos(params.pos); below_pos.z -= 10000; - hit1 = container->castRay(above_pos, below_pos, db->interior_types | db->terrain_types, &rInfo1); + hit1 = mContainer->castRay(above_pos, below_pos, mConformData->interior_types | mConformData->terrain_types, &rInfo1); // find secondary ground if (hit1 && rInfo1.object) { - hit1_is_interior = ((rInfo1.object->getTypeMask() & db->interior_types) != 0); - U32 mask = (hit1_is_interior) ? db->terrain_types : db->interior_types; - Point3F above_pos(params.pos); above_pos.z += 0.1f; - Point3F below_pos(params.pos); below_pos.z -= 10000; - hit2 = container->castRay(above_pos, below_pos, mask, &rInfo2); + hit1_is_interior = ((rInfo1.object->getTypeMask() & mConformData->interior_types) != 0); + U32 mask = (hit1_is_interior) ? mConformData->terrain_types : mConformData->interior_types; + hit2 = mContainer->castRay(above_pos, below_pos, mask, &rInfo2); } if (hit1) { F32 wt_factor = calc_weight_factor(elapsed); F32 incoming_z = params.pos.z; - F32 ground1_z = rInfo1.point.z + db->height; + F32 ground1_z = rInfo1.point.z + mConformData->height; F32 pos_z = ground1_z + (1.0f - wt_factor)*(incoming_z - ground1_z); if (hit1_is_interior) { - interior_alt = incoming_z - pos_z; - fx_wrapper->setInteriorAltitude(interior_alt); - if (db->do_interiors) + mInterior_alt = incoming_z - pos_z; + fx_wrapper->setInteriorAltitude(mInterior_alt); + if (mConformData->do_interiors) params.pos.z = pos_z; } else { - terrain_alt = incoming_z - pos_z; - fx_wrapper->setTerrainAltitude(terrain_alt); - if (db->do_terrain) + mTerrain_alt = incoming_z - pos_z; + fx_wrapper->setTerrainAltitude(mTerrain_alt); + if (mConformData->do_terrain) params.pos.z = pos_z; } if (hit2) { - F32 ground2_z = rInfo2.point.z + db->height; + F32 ground2_z = rInfo2.point.z + mConformData->height; F32 z2 = ground2_z + (1.0f - wt_factor)*(incoming_z - ground2_z); if (hit1_is_interior) { - terrain_alt = incoming_z - z2; - fx_wrapper->setTerrainAltitude(terrain_alt); + mTerrain_alt = incoming_z - z2; + fx_wrapper->setTerrainAltitude(mTerrain_alt); } else { - interior_alt = incoming_z - z2; - fx_wrapper->setInteriorAltitude(interior_alt); + mInterior_alt = incoming_z - z2; + fx_wrapper->setInteriorAltitude(mInterior_alt); } } @@ -241,19 +239,19 @@ void afxXM_AltitudeConform::updateParams(F32 dt, F32 elapsed, afxXM_Params& para RayInfo rInfo0; Point3F lookup_from_pos(params.pos); lookup_from_pos.z -= 0.1f; Point3F lookup_to_pos(params.pos); lookup_to_pos.z += 10000; - if (container->castRay(lookup_from_pos, lookup_to_pos, TerrainObjectType, &rInfo0)) + if (mContainer->castRay(lookup_from_pos, lookup_to_pos, TerrainObjectType, &rInfo0)) { - F32 ground2_z = rInfo0.point.z + db->height; + F32 ground2_z = rInfo0.point.z + mConformData->height; F32 z2 = ground2_z + (1.0f - wt_factor)*(incoming_z - ground2_z); - terrain_alt = z2 - incoming_z; - fx_wrapper->setTerrainAltitude(terrain_alt); + mTerrain_alt = z2 - incoming_z; + fx_wrapper->setTerrainAltitude(mTerrain_alt); } } - if (do_freeze) + if (mDo_freeze) { - conformed_pos = params.pos; - is_frozen = true; + mConformed_pos = params.pos; + mIs_frozen = true; } } } diff --git a/Engine/source/afx/xm/afxXM_MountedImageNode.cpp b/Engine/source/afx/xm/afxXM_MountedImageNode.cpp index 8f54f2d9d..b4b244011 100644 --- a/Engine/source/afx/xm/afxXM_MountedImageNode.cpp +++ b/Engine/source/afx/xm/afxXM_MountedImageNode.cpp @@ -63,11 +63,11 @@ class afxXM_MountedImageNode : public afxXM_Base { typedef afxXM_Base Parent; - StringTableEntry node_name; - U32 image_slot; - S32 node_ID; - ShapeBase* shape; - afxConstraint* cons; + StringTableEntry mNode_name; + U32 mImage_slot; + S32 mNode_ID; + ShapeBase* mShape; + afxConstraint* mCons; afxConstraint* find_constraint(); @@ -163,11 +163,11 @@ afxXM_Base* afxXM_MountedImageNodeData::create(afxEffectWrapper* fx, bool on_ser afxXM_MountedImageNode::afxXM_MountedImageNode(afxXM_MountedImageNodeData* db, afxEffectWrapper* fxw) : afxXM_Base(db, fxw) { - image_slot = db->image_slot; - node_name = db->node_name; - cons = 0; - node_ID = -1; - shape = 0; + mImage_slot = db->image_slot; + mNode_name = db->node_name; + mCons = 0; + mNode_ID = -1; + mShape = 0; } // find the first constraint with a shape by checking pos @@ -189,41 +189,41 @@ void afxXM_MountedImageNode::start(F32 timestamp) { // constraint won't change over the modifier's // lifetime so we find it here in start(). - cons = find_constraint(); - if (!cons) + mCons = find_constraint(); + if (!mCons) Con::errorf(ConsoleLogEntry::General, "afxXM_MountedImageNode: failed to find a ShapeBase derived constraint source."); } void afxXM_MountedImageNode::updateParams(F32 dt, F32 elapsed, afxXM_Params& params) { - if (!cons) + if (!mCons) return; // validate shape // The shape must be validated in case it gets deleted // of goes out scope. - SceneObject* scene_object = cons->getSceneObject(); - if (scene_object != (SceneObject*)shape) + SceneObject* scene_object = mCons->getSceneObject(); + if (scene_object != (SceneObject*)mShape) { - shape = dynamic_cast(scene_object); - if (shape && node_name != ST_NULLSTRING) + mShape = dynamic_cast(scene_object); + if (mShape && mNode_name != ST_NULLSTRING) { - node_ID = shape->getNodeIndex(image_slot, node_name); - if (node_ID < 0) + mNode_ID = mShape->getNodeIndex(mImage_slot, mNode_name); + if (mNode_ID < 0) { Con::errorf(ConsoleLogEntry::General, "afxXM_MountedImageNode: failed to find nodeName, \"%s\".", - node_name); + mNode_name); } } else - node_ID = -1; + mNode_ID = -1; } - if (shape) + if (mShape) { - shape->getImageTransform(image_slot, node_ID, ¶ms.ori); + mShape->getImageTransform(mImage_slot, mNode_ID, ¶ms.ori); params.pos = params.ori.getPosition(); } } From 17b627e05f0fed6ffb9f9333c448bdba64121285 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Thu, 29 Mar 2018 19:40:34 -0500 Subject: [PATCH 099/144] afxforceset membervar cleanups --- Engine/source/afx/forces/afxForceSet.cpp | 38 ++++++++++++------------ Engine/source/afx/forces/afxForceSet.h | 26 ++++++++-------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/Engine/source/afx/forces/afxForceSet.cpp b/Engine/source/afx/forces/afxForceSet.cpp index 49658022f..0d650e3b4 100644 --- a/Engine/source/afx/forces/afxForceSet.cpp +++ b/Engine/source/afx/forces/afxForceSet.cpp @@ -32,21 +32,21 @@ afxForceSet::afxForceSet(const char* name) { - this->name = (name) ? StringTable->insert(name) : ST_NULLSTRING; - update_dt = 10.0f; // seems like an ok maximum, force-xmods will probably lower it. - elapsed_dt = 0.0f; - elapsed_ms = 0; - num_updates = 0; - last_num_updates = 0; + mName = (name) ? StringTable->insert(name) : ST_NULLSTRING; + mUpdate_dt = 10.0f; // seems like an ok maximum, force-xmods will probably lower it. + mElapsed_dt = 0.0f; + mElapsed_ms = 0; + mNum_updates = 0; + mLast_num_updates = 0; } void afxForceSet::remove(afxForce* force) { - for (S32 i = 0; i < force_v.size(); i++) + for (S32 i = 0; i < mForce_v.size(); i++) { - if (force_v[i] == force) + if (mForce_v[i] == force) { - force_v.erase(i); + mForce_v.erase(i); return; } } @@ -56,23 +56,23 @@ S32 afxForceSet::updateDT(F32 dt) { U32 now = Platform::getVirtualMilliseconds(); - if (elapsed_ms == now) - return last_num_updates; + if (mElapsed_ms == now) + return mLast_num_updates; - elapsed_ms = now; - elapsed_dt += dt; + mElapsed_ms = now; + mElapsed_dt += dt; - if (elapsed_dt < update_dt) + if (mElapsed_dt < mUpdate_dt) { - last_num_updates = 0; + mLast_num_updates = 0; return 0; } - num_updates = mFloor(elapsed_dt/update_dt); - elapsed_dt -= update_dt*num_updates; - last_num_updates = num_updates; + mNum_updates = mFloor(mElapsed_dt/mUpdate_dt); + mElapsed_dt -= mUpdate_dt*mNum_updates; + mLast_num_updates = mNum_updates; - return num_updates; + return mNum_updates; } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/forces/afxForceSet.h b/Engine/source/afx/forces/afxForceSet.h index 8c42a2dd3..7c0cabc54 100644 --- a/Engine/source/afx/forces/afxForceSet.h +++ b/Engine/source/afx/forces/afxForceSet.h @@ -32,28 +32,28 @@ class afxForce; class afxForceSet { - Vector force_v; - StringTableEntry name; + Vector mForce_v; + StringTableEntry mName; // tick-based updating - F32 update_dt; // constant update interval, in seconds - F32 elapsed_dt; // runtime elapsed delta, in seconds - U32 elapsed_ms; - S32 num_updates; - S32 last_num_updates; + F32 mUpdate_dt; // constant update interval, in seconds + F32 mElapsed_dt; // runtime elapsed delta, in seconds + U32 mElapsed_ms; + S32 mNum_updates; + S32 mLast_num_updates; public: /*C*/ afxForceSet(const char* name=0); - void add(afxForce* force) { force_v.push_back(force); } + void add(afxForce* force) { mForce_v.push_back(force); } void remove(afxForce* force); - S32 count() { return force_v.size(); } - afxForce* getForce(S32 idx) { return force_v[idx]; } - const char* getName() const { return name; } + S32 count() { return mForce_v.size(); } + afxForce* getForce(S32 idx) { return mForce_v[idx]; } + const char* getName() const { return mName; } - void setUpdateDT(F32 update_dt) { this->update_dt = update_dt; } - F32 getUpdateDT() { return update_dt; } + void setUpdateDT(F32 update_dt) { mUpdate_dt = update_dt; } + F32 getUpdateDT() { return mUpdate_dt; } S32 updateDT(F32 dt); }; From 0ebd75604d71b2a19631649cf5ca1a37a7997023 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Fri, 30 Mar 2018 02:27:43 -0400 Subject: [PATCH 100/144] Badly sized buffer in dumpConsoleClasses --- Engine/source/console/consoleDoc.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/console/consoleDoc.cpp b/Engine/source/console/consoleDoc.cpp index f4b74402b..d9ff78020 100644 --- a/Engine/source/console/consoleDoc.cpp +++ b/Engine/source/console/consoleDoc.cpp @@ -88,7 +88,7 @@ void printClassHeader(const char* usage, const char * className, const char * su if((usage != NULL) && strlen(usage)) { // Copy Usage Document - S32 usageLen = dStrlen( usage ); + S32 usageLen = dStrlen( usage ) + 1; FrameTemp usageStr( usageLen ); dStrcpy( usageStr, usage, usageLen ); From b486ab73bd53766450caf3e95f2e96fde33e3359 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Fri, 30 Mar 2018 02:28:04 -0400 Subject: [PATCH 101/144] CodeBlock::getFunctionArgs used the wrong offsets --- Engine/source/console/codeBlock.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/console/codeBlock.cpp b/Engine/source/console/codeBlock.cpp index f8f814f5b..6b60e7789 100644 --- a/Engine/source/console/codeBlock.cpp +++ b/Engine/source/console/codeBlock.cpp @@ -698,10 +698,10 @@ String CodeBlock::getFunctionArgs(U32 ip) { StringBuilder str; - U32 fnArgc = code[ip + 5]; + U32 fnArgc = code[ip + 8]; for (U32 i = 0; i < fnArgc; ++i) { - StringTableEntry var = CodeToSTE(code, ip + (i * 2) + 6); + StringTableEntry var = CodeToSTE(code, ip + (i * 2) + 9); if (i != 0) str.append(", "); From e0b79d4dc89598a7d50dbee807382f4ddbca6c50 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 30 Mar 2018 02:49:35 -0500 Subject: [PATCH 102/144] afx staticshape membervar cleanups --- Engine/source/afx/ce/afxStaticShape.cpp | 42 ++++++++++++------------- Engine/source/afx/ce/afxStaticShape.h | 12 +++---- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Engine/source/afx/ce/afxStaticShape.cpp b/Engine/source/afx/ce/afxStaticShape.cpp index 5eb4fb815..4bef19629 100644 --- a/Engine/source/afx/ce/afxStaticShape.cpp +++ b/Engine/source/afx/ce/afxStaticShape.cpp @@ -122,11 +122,11 @@ ConsoleDocClass( afxStaticShape, afxStaticShape::afxStaticShape() { - afx_data = 0; - is_visible = true; - chor_id = 0; - hookup_with_chor = false; - ghost_cons_name = ST_NULLSTRING; + mAFX_data = 0; + mIs_visible = true; + mChor_id = 0; + mHookup_with_chor = false; + mGhost_cons_name = ST_NULLSTRING; } afxStaticShape::~afxStaticShape() @@ -135,8 +135,8 @@ afxStaticShape::~afxStaticShape() void afxStaticShape::init(U32 chor_id, StringTableEntry cons_name) { - this->chor_id = chor_id; - ghost_cons_name = cons_name; + mChor_id = chor_id; + mGhost_cons_name = cons_name; } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~// @@ -147,7 +147,7 @@ bool afxStaticShape::onNewDataBlock(GameBaseData* dptr, bool reload) if (!mDataBlock || !Parent::onNewDataBlock(dptr, reload)) return false; - afx_data = dynamic_cast(mDataBlock); + mAFX_data = dynamic_cast(mDataBlock); if (!mShapeInstance) return true; @@ -156,10 +156,10 @@ bool afxStaticShape::onNewDataBlock(GameBaseData* dptr, bool reload) // if datablock is afxStaticShapeData we get the sequence setting // directly from the datablock on the client-side only - if (afx_data) + if (mAFX_data) { if (isClientObject()) - seq_name = afx_data->sequence; + seq_name = mAFX_data->sequence; } // otherwise datablock is stock StaticShapeData and we look for // a sequence name on a dynamic field on the server. @@ -188,13 +188,13 @@ void afxStaticShape::advanceTime(F32 dt) { Parent::advanceTime(dt); - if (hookup_with_chor) + if (mHookup_with_chor) { - afxChoreographer* chor = arcaneFX::findClientChoreographer(chor_id); + afxChoreographer* chor = arcaneFX::findClientChoreographer(mChor_id); if (chor) { - chor->setGhostConstraintObject(this, ghost_cons_name); - hookup_with_chor = false; + chor->setGhostConstraintObject(this, mGhost_cons_name); + mHookup_with_chor = false; } } } @@ -206,8 +206,8 @@ U32 afxStaticShape::packUpdate(NetConnection* conn, U32 mask, BitStream* stream) // InitialUpdate if (stream->writeFlag(mask & InitialUpdateMask)) { - stream->write(chor_id); - stream->writeString(ghost_cons_name); + stream->write(mChor_id); + stream->writeString(mGhost_cons_name); } return retMask; @@ -222,11 +222,11 @@ void afxStaticShape::unpackUpdate(NetConnection * conn, BitStream * stream) // InitialUpdate if (stream->readFlag()) { - stream->read(&chor_id); - ghost_cons_name = stream->readSTString(); + stream->read(&mChor_id); + mGhost_cons_name = stream->readSTString(); - if (chor_id != 0 && ghost_cons_name != ST_NULLSTRING) - hookup_with_chor = true; + if (mChor_id != 0 && mGhost_cons_name != ST_NULLSTRING) + mHookup_with_chor = true; } } @@ -234,7 +234,7 @@ void afxStaticShape::unpackUpdate(NetConnection * conn, BitStream * stream) void afxStaticShape::prepRenderImage(SceneRenderState* state) { - if (is_visible) + if (mIs_visible) Parent::prepRenderImage(state); } diff --git a/Engine/source/afx/ce/afxStaticShape.h b/Engine/source/afx/ce/afxStaticShape.h index ed84e0774..ad3c895e3 100644 --- a/Engine/source/afx/ce/afxStaticShape.h +++ b/Engine/source/afx/ce/afxStaticShape.h @@ -66,11 +66,11 @@ class afxStaticShape : public StaticShape private: StaticShapeData* mDataBlock; - afxStaticShapeData* afx_data; - bool is_visible; - U32 chor_id; - bool hookup_with_chor; - StringTableEntry ghost_cons_name; + afxStaticShapeData* mAFX_data; + bool mIs_visible; + U32 mChor_id; + bool mHookup_with_chor; + StringTableEntry mGhost_cons_name; protected: virtual void prepRenderImage(SceneRenderState*); @@ -87,7 +87,7 @@ public: virtual void unpackUpdate(NetConnection*, BitStream*); const char* getShapeFileName() const { return mDataBlock->shapeName; } - void setVisibility(bool flag) { is_visible = flag; } + void setVisibility(bool flag) { mIs_visible = flag; } DECLARE_CONOBJECT(afxStaticShape); DECLARE_CATEGORY("AFX"); From 4375e5f1457bc57d21a8df746110f005ea9bb7a8 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 30 Mar 2018 02:50:12 -0500 Subject: [PATCH 103/144] afx mooring membervar cleanups --- Engine/source/afx/ea/afxEA_Mooring.cpp | 52 +++++++++++++------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Engine/source/afx/ea/afxEA_Mooring.cpp b/Engine/source/afx/ea/afxEA_Mooring.cpp index 307575149..76982679b 100644 --- a/Engine/source/afx/ea/afxEA_Mooring.cpp +++ b/Engine/source/afx/ea/afxEA_Mooring.cpp @@ -37,8 +37,8 @@ class afxEA_Mooring : public afxEffectWrapper { typedef afxEffectWrapper Parent; - afxMooringData* mooring_data; - afxMooring* obj; + afxMooringData* mMooring_data; + afxMooring* mObj; void do_runtime_substitutions(); @@ -57,27 +57,27 @@ public: afxEA_Mooring::afxEA_Mooring() { - mooring_data = 0; - obj = 0; + mMooring_data = 0; + mObj = 0; } afxEA_Mooring::~afxEA_Mooring() { - if (obj) - obj->deleteObject(); - if (mooring_data && mooring_data->isTempClone()) - delete mooring_data; - mooring_data = 0; + if (mObj) + mObj->deleteObject(); + if (mMooring_data && mMooring_data->isTempClone()) + delete mMooring_data; + mMooring_data = 0; } void afxEA_Mooring::ea_set_datablock(SimDataBlock* db) { - mooring_data = dynamic_cast(db); + mMooring_data = dynamic_cast(db); } bool afxEA_Mooring::ea_start() { - if (!mooring_data) + if (!mMooring_data) { Con::errorf("afxEA_Mooring::ea_start() -- missing or incompatible datablock."); return false; @@ -90,33 +90,33 @@ bool afxEA_Mooring::ea_start() bool afxEA_Mooring::ea_update(F32 dt) { - if (!obj) + if (!mObj) { if (mDatablock->use_ghost_as_cons_obj && mDatablock->effect_name != ST_NULLSTRING) { - obj = new afxMooring(mooring_data->networking, + mObj = new afxMooring(mMooring_data->networking, mChoreographer->getChoreographerId(), mDatablock->effect_name); } else { - obj = new afxMooring(mooring_data->networking, 0, ST_NULLSTRING); + mObj = new afxMooring(mMooring_data->networking, 0, ST_NULLSTRING); } - obj->onNewDataBlock(mooring_data, false); - if (!obj->registerObject()) + mObj->onNewDataBlock(mMooring_data, false); + if (!mObj->registerObject()) { - delete obj; - obj = 0; + delete mObj; + mObj = 0; Con::errorf("afxEA_Mooring::ea_update() -- effect failed to register."); return false; } - deleteNotify(obj); + deleteNotify(mObj); } - if (obj) + if (mObj) { - obj->setTransform(mUpdated_xfm); + mObj->setTransform(mUpdated_xfm); } return true; @@ -128,7 +128,7 @@ void afxEA_Mooring::ea_finish(bool was_stopped) void afxEA_Mooring::onDeleteNotify(SimObject* obj) { - if (this->obj == obj) + if (mObj == obj) obj = 0; Parent::onDeleteNotify(obj); @@ -137,12 +137,12 @@ void afxEA_Mooring::onDeleteNotify(SimObject* obj) void afxEA_Mooring::do_runtime_substitutions() { // only clone the datablock if there are substitutions - if (mooring_data->getSubstitutionCount() > 0) + if (mMooring_data->getSubstitutionCount() > 0) { // clone the datablock and perform substitutions - afxMooringData* orig_db = mooring_data; - mooring_data = new afxMooringData(*orig_db, true); - orig_db->performSubstitutions(mooring_data, mChoreographer, mGroup_index); + afxMooringData* orig_db = mMooring_data; + mMooring_data = new afxMooringData(*orig_db, true); + orig_db->performSubstitutions(mMooring_data, mChoreographer, mGroup_index); } } From 58f15d5235671da980d121cd2799c8e6f25678bf Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 30 Mar 2018 02:51:17 -0500 Subject: [PATCH 104/144] a pair of afx audio-class membervar cleanups --- Engine/source/afx/ea/afxEA_AudioBank.cpp | 4 ++-- Engine/source/afx/ea/afxEA_Sound.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Engine/source/afx/ea/afxEA_AudioBank.cpp b/Engine/source/afx/ea/afxEA_AudioBank.cpp index 6ae095dcf..6a52ca345 100644 --- a/Engine/source/afx/ea/afxEA_AudioBank.cpp +++ b/Engine/source/afx/ea/afxEA_AudioBank.cpp @@ -150,7 +150,7 @@ void afxEA_AudioBank::do_runtime_substitutions() class afxEA_SoundBankDesc : public afxEffectAdapterDesc, public afxEffectDefs { - static afxEA_SoundBankDesc desc; + static afxEA_SoundBankDesc mDesc; public: virtual bool testEffectType(const SimDataBlock*) const; @@ -162,7 +162,7 @@ public: virtual afxEffectWrapper* create() const { return new afxEA_AudioBank; } }; -afxEA_SoundBankDesc afxEA_SoundBankDesc::desc; +afxEA_SoundBankDesc afxEA_SoundBankDesc::mDesc; bool afxEA_SoundBankDesc::testEffectType(const SimDataBlock* db) const { diff --git a/Engine/source/afx/ea/afxEA_Sound.cpp b/Engine/source/afx/ea/afxEA_Sound.cpp index 36ceebcd3..335800d84 100644 --- a/Engine/source/afx/ea/afxEA_Sound.cpp +++ b/Engine/source/afx/ea/afxEA_Sound.cpp @@ -150,7 +150,7 @@ void afxEA_Sound::onDeleteNotify(SimObject* obj) class afxEA_SoundDesc : public afxEffectAdapterDesc, public afxEffectDefs { - static afxEA_SoundDesc desc; + static afxEA_SoundDesc mDesc; public: virtual bool testEffectType(const SimDataBlock*) const; @@ -162,7 +162,7 @@ public: virtual afxEffectWrapper* create() const { return new afxEA_Sound; } }; -afxEA_SoundDesc afxEA_SoundDesc::desc; +afxEA_SoundDesc afxEA_SoundDesc::mDesc; bool afxEA_SoundDesc::testEffectType(const SimDataBlock* db) const { From 88cdf37f7d9e5431d6c32f4ed056072bf86e48f9 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 30 Mar 2018 02:51:44 -0500 Subject: [PATCH 105/144] afx camera membervar cleanups --- Engine/source/afx/afxCamera.cpp | 258 ++++++++++++++++---------------- Engine/source/afx/afxCamera.h | 30 ++-- 2 files changed, 144 insertions(+), 144 deletions(-) diff --git a/Engine/source/afx/afxCamera.cpp b/Engine/source/afx/afxCamera.cpp index d6fb5f21b..84acee518 100644 --- a/Engine/source/afx/afxCamera.cpp +++ b/Engine/source/afx/afxCamera.cpp @@ -99,11 +99,11 @@ afxCamera::afxCamera() { mNetFlags.clear(Ghostable); mTypeMask |= CameraObjectType; - delta.pos = Point3F(0,0,100); - delta.rot = Point3F(0,0,0); - delta.posVec = delta.rotVec = VectorF(0,0,0); - mObjToWorld.setColumn(3,delta.pos); - mRot = delta.rot; + mDelta.pos = Point3F(0,0,100); + mDelta.rot = Point3F(0,0,0); + mDelta.posVec = mDelta.rotVec = VectorF(0,0,0); + mObjToWorld.setColumn(3, mDelta.pos); + mRot = mDelta.rot; mMinOrbitDist = 0; mMaxOrbitDist = 0; @@ -111,19 +111,19 @@ afxCamera::afxCamera() mOrbitObject = NULL; mPosition.set(0.f, 0.f, 0.f); mObservingClientObject = false; - mode = FlyMode; + mMode = FlyMode; - cam_subject = NULL; - coi_offset.set(0, 0, 2); - cam_offset.set(0, 0, 0); - cam_distance = 0.0f; - cam_angle = 0.0f; - cam_dirty = false; + mCam_subject = NULL; + mCoi_offset.set(0, 0, 2); + mCam_offset.set(0, 0, 0); + mCam_distance = 0.0f; + mCam_angle = 0.0f; + mCam_dirty = false; - flymode_saved = false; - third_person_snap_s = 1; - third_person_snap_c = 1; - flymode_saved_pos.zero(); + mFlymode_saved = false; + mThird_person_snap_s = 1; + mThird_person_snap_c = 1; + mFlymode_saved_pos.zero(); mDamageState = Disabled; } @@ -136,7 +136,7 @@ afxCamera::~afxCamera() void afxCamera::cam_update(F32 dt, bool on_server) { - if (mode == ThirdPersonMode && cam_subject) + if (mMode == ThirdPersonMode && mCam_subject) cam_update_3pov(dt, on_server); } @@ -176,9 +176,9 @@ Point3F &afxCamera::getPosition() //---------------------------------------------------------------------------- void afxCamera::setFlyMode() { - mode = FlyMode; - if (flymode_saved) - snapToPosition(flymode_saved_pos); + mMode = FlyMode; + if (mFlymode_saved) + snapToPosition(mFlymode_saved_pos); if (bool(mOrbitObject)) { @@ -202,11 +202,11 @@ void afxCamera::setOrbitMode(GameBase *obj, Point3F &pos, AngAxisF &rot, F32 min processAfter(mOrbitObject); deleteNotify(mOrbitObject); mOrbitObject->getWorldBox().getCenter(&mPosition); - mode = OrbitObjectMode; + mMode = OrbitObjectMode; } else { - mode = OrbitPointMode; + mMode = OrbitPointMode; mPosition = pos; } @@ -278,14 +278,14 @@ void afxCamera::snapToPosition(const Point3F& tPos) { MatrixF transMat; - if (cam_subject) + if (mCam_subject) { // get the subject's transform - MatrixF objToWorld = cam_subject->getRenderTransform(); + MatrixF objToWorld = mCam_subject->getRenderTransform(); // transform the center-of-interest to world-space Point3F objPos; - objToWorld.mulP(coi_offset, &objPos); + objToWorld.mulP(mCoi_offset, &objPos); // find normalized direction vector looking from camera to coi VectorF dirVec = objPos - tPos; @@ -308,31 +308,31 @@ void afxCamera::snapToPosition(const Point3F& tPos) void afxCamera::setCameraSubject(SceneObject* new_subject) { // cleanup any existing chase subject - if (cam_subject) + if (mCam_subject) { - if (dynamic_cast(cam_subject)) + if (dynamic_cast(mCam_subject)) clearProcessAfter(); - clearNotify(cam_subject); + clearNotify(mCam_subject); } - cam_subject = new_subject; + mCam_subject = new_subject; // set associations with new chase subject - if (cam_subject) + if (mCam_subject) { - if (dynamic_cast(cam_subject)) - processAfter((GameBase*)cam_subject); - deleteNotify(cam_subject); + if (dynamic_cast(mCam_subject)) + processAfter((GameBase*)mCam_subject); + deleteNotify(mCam_subject); } - mode = (cam_subject) ? ThirdPersonMode : FlyMode; + mMode = (mCam_subject) ? ThirdPersonMode : FlyMode; setMaskBits(SubjectMask); } void afxCamera::setThirdPersonOffset(const Point3F& offset) { // new method - if (cam_distance > 0.0f) + if (mCam_distance > 0.0f) { if (isClientObject()) { @@ -342,25 +342,25 @@ void afxCamera::setThirdPersonOffset(const Point3F& offset) // this auto switches to/from first person if (conn->isFirstPerson()) { - if (cam_distance >= 1.0f) + if (mCam_distance >= 1.0f) conn->setFirstPerson(false); } else { - if (cam_distance < 1.0f) + if (mCam_distance < 1.0f) conn->setFirstPerson(true); } } } - cam_offset = offset; - cam_dirty = true; + mCam_offset = offset; + mCam_dirty = true; return; } // old backwards-compatible method - if (offset.y != cam_offset.y && isClientObject()) + if (offset.y != mCam_offset.y && isClientObject()) { GameConnection* conn = GameConnection::getConnectionToServer(); if (conn) @@ -379,62 +379,62 @@ void afxCamera::setThirdPersonOffset(const Point3F& offset) } } - cam_offset = offset; - cam_dirty = true; + mCam_offset = offset; + mCam_dirty = true; } void afxCamera::setThirdPersonOffset(const Point3F& offset, const Point3F& coi_offset) { - this->coi_offset = coi_offset; + mCoi_offset = coi_offset; setThirdPersonOffset(offset); } void afxCamera::setThirdPersonDistance(F32 distance) { - cam_distance = distance; - cam_dirty = true; + mCam_distance = distance; + mCam_dirty = true; } F32 afxCamera::getThirdPersonDistance() { - return cam_distance; + return mCam_distance; } void afxCamera::setThirdPersonAngle(F32 angle) { - cam_angle = angle; - cam_dirty = true; + mCam_angle = angle; + mCam_dirty = true; } F32 afxCamera::getThirdPersonAngle() { - return cam_angle; + return mCam_angle; } void afxCamera::setThirdPersonMode() { - mode = ThirdPersonMode; - flymode_saved_pos = getPosition(); - flymode_saved = true; - cam_dirty = true; - third_person_snap_s++; + mMode = ThirdPersonMode; + mFlymode_saved_pos = getPosition(); + mFlymode_saved = true; + mCam_dirty = true; + mThird_person_snap_s++; } void afxCamera::setThirdPersonSnap() { - if (mode == ThirdPersonMode) - third_person_snap_s += 2; + if (mMode == ThirdPersonMode) + mThird_person_snap_s += 2; } void afxCamera::setThirdPersonSnapClient() { - if (mode == ThirdPersonMode) - third_person_snap_c++; + if (mMode == ThirdPersonMode) + mThird_person_snap_c++; } const char* afxCamera::getMode() { - switch (mode) + switch (mMode) { case ThirdPersonMode: return "ThirdPerson"; @@ -593,17 +593,17 @@ void afxCamera::cam_update_3pov(F32 dt, bool on_server) { Point3F goal_pos; Point3F curr_pos = getRenderPosition(); - MatrixF xfm = cam_subject->getRenderTransform(); - Point3F coi = cam_subject->getRenderPosition() + coi_offset; + MatrixF xfm = mCam_subject->getRenderTransform(); + Point3F coi = mCam_subject->getRenderPosition() + mCoi_offset; // for player subjects, pitch is adjusted - Player* player_subj = dynamic_cast(cam_subject); + Player* player_subj = dynamic_cast(mCam_subject); if (player_subj) { - if (cam_distance > 0.0f) + if (mCam_distance > 0.0f) { // rotate xfm by amount of cam_angle - F32 look_yaw = player_subj->getHeadRotation().z + mDegToRad(-cam_angle); + F32 look_yaw = player_subj->getHeadRotation().z + mDegToRad(-mCam_angle); MatrixF look_yaw_mtx(EulerF(0,0,look_yaw)); xfm.mul(look_yaw_mtx); @@ -612,9 +612,9 @@ void afxCamera::cam_update_3pov(F32 dt, bool on_server) MatrixF head_pitch_mtx(EulerF(head_pitch,0,0)); xfm.mul(head_pitch_mtx); - VectorF behind_vec(0, -cam_distance, 0); + VectorF behind_vec(0, -mCam_distance, 0); xfm.mulP(behind_vec, &goal_pos); - goal_pos += cam_offset; + goal_pos += mCam_offset; } else // old backwards-compatible method { @@ -623,15 +623,15 @@ void afxCamera::cam_update_3pov(F32 dt, bool on_server) MatrixF head_pitch_mtx(EulerF(head_pitch,0,0)); xfm.mul(head_pitch_mtx); - VectorF behind_vec(0, cam_offset.y, 0); + VectorF behind_vec(0, mCam_offset.y, 0); xfm.mulP(behind_vec, &goal_pos); - goal_pos.z += cam_offset.z; + goal_pos.z += mCam_offset.z; } } // for non-player subjects, camera will follow, but pitch won't adjust. else { - xfm.mulP(cam_offset, &goal_pos); + xfm.mulP(mCam_offset, &goal_pos); } // avoid view occlusion @@ -639,7 +639,7 @@ void afxCamera::cam_update_3pov(F32 dt, bool on_server) { // snap to final position if path to goal is blocked if (test_blocked_line(curr_pos, goal_pos)) - third_person_snap_c++; + mThird_person_snap_c++; } // place camera into its final position @@ -653,11 +653,11 @@ void afxCamera::cam_update_3pov(F32 dt, bool on_server) F32 time_inc = 1.0f/speed_factor; // snap to final position - if (on_server || (third_person_snap_c > 0 || dt > time_inc)) + if (on_server || (mThird_person_snap_c > 0 || dt > time_inc)) { snapToPosition(goal_pos); - if (!on_server && third_person_snap_c > 0) - third_person_snap_c--; + if (!on_server && mThird_person_snap_c > 0) + mThird_person_snap_c--; return; } // interpolate to final position @@ -732,13 +732,13 @@ void afxCamera::onDeleteNotify(SimObject *obj) if (obj == (SimObject*)mOrbitObject) { mOrbitObject = NULL; - if (mode == OrbitObjectMode) - mode = OrbitPointMode; + if (mMode == OrbitObjectMode) + mMode = OrbitPointMode; } - if (obj == cam_subject) + if (obj == mCam_subject) { - cam_subject = NULL; + mCam_subject = NULL; } } @@ -748,12 +748,12 @@ void afxCamera::advanceTime(F32 dt) if (gSFX3DWorld) { - if (mode == ThirdPersonMode && cam_subject) + if (mMode == ThirdPersonMode && mCam_subject) { - if (gSFX3DWorld->getListener() != cam_subject) - gSFX3DWorld->setListener(cam_subject); + if (gSFX3DWorld->getListener() != mCam_subject) + gSFX3DWorld->setListener(mCam_subject); } - else if (mode == FlyMode) + else if (mMode == FlyMode) { if (gSFX3DWorld->getListener() != this) gSFX3DWorld->setListener(this); @@ -772,15 +772,15 @@ void afxCamera::processTick(const Move* move) if (move) { // UPDATE ORIENTATION // - delta.rotVec = mRot; - mObjToWorld.getColumn(3, &delta.posVec); + mDelta.rotVec = mRot; + mObjToWorld.getColumn(3, &mDelta.posVec); mRot.x = mClampF(mRot.x + move->pitch, -MaxPitch, MaxPitch); mRot.z += move->yaw; // ORBIT MODE // - if (mode == OrbitObjectMode || mode == OrbitPointMode) + if (mMode == OrbitObjectMode || mMode == OrbitPointMode) { - if(mode == OrbitObjectMode && bool(mOrbitObject)) + if(mMode == OrbitObjectMode && bool(mOrbitObject)) { // If this is a shapebase, use its render eye transform // to avoid jittering. @@ -823,10 +823,10 @@ void afxCamera::processTick(const Move* move) // If on the client, calc delta for backstepping if (isClientObject()) { - delta.pos = pos; - delta.rot = mRot; - delta.posVec = delta.posVec - delta.pos; - delta.rotVec = delta.rotVec - delta.rot; + mDelta.pos = pos; + mDelta.rot = mRot; + mDelta.posVec = mDelta.posVec - mDelta.pos; + mDelta.rotVec = mDelta.rotVec - mDelta.rot; } else { @@ -847,14 +847,14 @@ void afxCamera::interpolateTick(F32 dt) { Parent::interpolateTick(dt); - if (mode == ThirdPersonMode) + if (mMode == ThirdPersonMode) return; - Point3F rot = delta.rot + delta.rotVec * dt; + Point3F rot = mDelta.rot + mDelta.rotVec * dt; - if(mode == OrbitObjectMode || mode == OrbitPointMode) + if(mMode == OrbitObjectMode || mMode == OrbitPointMode) { - if(mode == OrbitObjectMode && bool(mOrbitObject)) + if(mMode == OrbitObjectMode && bool(mOrbitObject)) { // If this is a shapebase, use its render eye transform // to avoid jittering. @@ -880,7 +880,7 @@ void afxCamera::interpolateTick(F32 dt) { // NOTE - posVec is 0,0,0 unless cam is control-object and process tick is // updating the delta - Point3F pos = delta.pos + delta.posVec * dt; + Point3F pos = mDelta.pos + mDelta.posVec * dt; set_cam_pos(pos,rot); } } @@ -896,19 +896,19 @@ void afxCamera::writePacketData(GameConnection *connection, BitStream *bstream) bstream->write(mRot.x); // SND X ROT bstream->write(mRot.z); // SND Z ROT - if (bstream->writeFlag(cam_dirty)) + if (bstream->writeFlag(mCam_dirty)) { - mathWrite(*bstream, cam_offset); // SND CAM_OFFSET - mathWrite(*bstream, coi_offset); // SND COI_OFFSET - bstream->write(cam_distance); - bstream->write(cam_angle); - cam_dirty = false; + mathWrite(*bstream, mCam_offset); // SND CAM_OFFSET + mathWrite(*bstream, mCoi_offset); // SND COI_OFFSET + bstream->write(mCam_distance); + bstream->write(mCam_angle); + mCam_dirty = false; } - U32 writeMode = mode; + U32 writeMode = mMode; Point3F writePos = mPosition; S32 gIndex = -1; - if (mode == OrbitObjectMode) + if (mMode == OrbitObjectMode) { gIndex = bool(mOrbitObject) ? connection->getGhostIndex(mOrbitObject): -1; if(gIndex == -1) @@ -921,9 +921,9 @@ void afxCamera::writePacketData(GameConnection *connection, BitStream *bstream) bstream->writeRangedU32(writeMode, CameraFirstMode, CameraLastMode); // SND MODE if (writeMode == ThirdPersonMode) { - bstream->write(third_person_snap_s > 0); // SND SNAP - if (third_person_snap_s > 0) - third_person_snap_s--; + bstream->write(mThird_person_snap_s > 0); // SND SNAP + if (mThird_person_snap_s > 0) + mThird_person_snap_s--; } if (writeMode == OrbitObjectMode || writeMode == OrbitPointMode) @@ -956,34 +956,34 @@ void afxCamera::readPacketData(GameConnection *connection, BitStream *bstream) Point3F new_cam_offset, new_coi_offset; mathRead(*bstream, &new_cam_offset); // RCV CAM_OFFSET mathRead(*bstream, &new_coi_offset); // RCV COI_OFFSET - bstream->read(&cam_distance); - bstream->read(&cam_angle); + bstream->read(&mCam_distance); + bstream->read(&mCam_angle); setThirdPersonOffset(new_cam_offset, new_coi_offset); } GameBase* obj = 0; - mode = bstream->readRangedU32(CameraFirstMode, // RCV MODE + mMode = bstream->readRangedU32(CameraFirstMode, // RCV MODE CameraLastMode); - if (mode == ThirdPersonMode) + if (mMode == ThirdPersonMode) { bool snap; bstream->read(&snap); if (snap) - third_person_snap_c++; + mThird_person_snap_c++; } mObservingClientObject = false; - if (mode == OrbitObjectMode || mode == OrbitPointMode) { + if (mMode == OrbitObjectMode || mMode == OrbitPointMode) { bstream->read(&mMinOrbitDist); bstream->read(&mMaxOrbitDist); bstream->read(&mCurOrbitDist); - if(mode == OrbitObjectMode) + if(mMode == OrbitObjectMode) { mObservingClientObject = bstream->readFlag(); S32 gIndex = bstream->readInt(NetConnection::GhostIdBitSize); obj = static_cast(connection->resolveGhost(gIndex)); } - if (mode == OrbitPointMode) + if (mMode == OrbitPointMode) bstream->readCompressedPoint(&mPosition); } if (obj != (GameBase*)mOrbitObject) { @@ -998,14 +998,14 @@ void afxCamera::readPacketData(GameConnection *connection, BitStream *bstream) } } - if (mode == ThirdPersonMode) + if (mMode == ThirdPersonMode) return; set_cam_pos(pos,rot); - delta.pos = pos; - delta.rot = rot; - delta.rotVec.set(0,0,0); - delta.posVec.set(0,0,0); + mDelta.pos = pos; + mDelta.rot = rot; + mDelta.rotVec.set(0,0,0); + mDelta.posVec.set(0,0,0); } U32 afxCamera::packUpdate(NetConnection* conn, U32 mask, BitStream *bstream) @@ -1029,10 +1029,10 @@ U32 afxCamera::packUpdate(NetConnection* conn, U32 mask, BitStream *bstream) if (bstream->writeFlag(mask & SubjectMask)) { - S32 ghost_id = (cam_subject) ? conn->getGhostIndex(cam_subject) : -1; + S32 ghost_id = (mCam_subject) ? conn->getGhostIndex(mCam_subject) : -1; if (bstream->writeFlag(ghost_id != -1)) bstream->writeRangedU32(U32(ghost_id), 0, NetConnection::MaxGhostCount); - else if (cam_subject) + else if (mCam_subject) retMask |= SubjectMask; } @@ -1057,9 +1057,9 @@ void afxCamera::unpackUpdate(NetConnection *conn, BitStream *bstream) set_cam_pos(pos,rot); // New delta for client side interpolation - delta.pos = pos; - delta.rot = rot; - delta.posVec = delta.rotVec = VectorF(0,0,0); + mDelta.pos = pos; + mDelta.rot = rot; + mDelta.posVec = mDelta.rotVec = VectorF(0,0,0); } if (bstream->readFlag()) @@ -1067,18 +1067,18 @@ void afxCamera::unpackUpdate(NetConnection *conn, BitStream *bstream) if (bstream->readFlag()) { S32 ghost_id = bstream->readRangedU32(0, NetConnection::MaxGhostCount); - cam_subject = dynamic_cast(conn->resolveGhost(ghost_id)); + mCam_subject = dynamic_cast(conn->resolveGhost(ghost_id)); } else - cam_subject = NULL; + mCam_subject = NULL; } } // Override to ensure both are kept in scope void afxCamera::onCameraScopeQuery(NetConnection* conn, CameraScopeQuery* query) { - if (cam_subject) - conn->objectInScope(cam_subject); + if (mCam_subject) + conn->objectInScope(mCam_subject); Parent::onCameraScopeQuery(conn, query); } @@ -1156,7 +1156,7 @@ void afxCamera::setCameraFov(F32 fov) F32 afxCamera::getDamageFlash() const { - if (mode == OrbitObjectMode && isServerObject() && bool(mOrbitObject)) + if (mMode == OrbitObjectMode && isServerObject() && bool(mOrbitObject)) { const GameBase *castObj = mOrbitObject; const ShapeBase* psb = dynamic_cast(castObj); @@ -1169,7 +1169,7 @@ F32 afxCamera::getDamageFlash() const F32 afxCamera::getWhiteOut() const { - if (mode == OrbitObjectMode && isServerObject() && bool(mOrbitObject)) + if (mMode == OrbitObjectMode && isServerObject() && bool(mOrbitObject)) { const GameBase *castObj = mOrbitObject; const ShapeBase* psb = dynamic_cast(castObj); diff --git a/Engine/source/afx/afxCamera.h b/Engine/source/afx/afxCamera.h index 934f293cf..957f182f6 100644 --- a/Engine/source/afx/afxCamera.h +++ b/Engine/source/afx/afxCamera.h @@ -88,9 +88,9 @@ class afxCamera: public ShapeBase }; private: - int mode; + int mMode; Point3F mRot; - StateDelta delta; + StateDelta mDelta; SimObjectPtr mOrbitObject; F32 mMinOrbitDist; @@ -99,17 +99,17 @@ private: Point3F mPosition; bool mObservingClientObject; - SceneObject* cam_subject; - Point3F cam_offset; - Point3F coi_offset; - F32 cam_distance; - F32 cam_angle; - bool cam_dirty; + SceneObject* mCam_subject; + Point3F mCam_offset; + Point3F mCoi_offset; + F32 mCam_distance; + F32 mCam_angle; + bool mCam_dirty; - bool flymode_saved; - Point3F flymode_saved_pos; - S8 third_person_snap_c; - S8 third_person_snap_s; + bool mFlymode_saved; + Point3F mFlymode_saved_pos; + S8 mThird_person_snap_c; + S8 mThird_person_snap_s; void set_cam_pos(const Point3F& pos, const Point3F& viewRot); void cam_update(F32 dt, bool on_server); @@ -130,8 +130,8 @@ public: void setCameraSubject(SceneObject* subject); void setThirdPersonOffset(const Point3F& offset); void setThirdPersonOffset(const Point3F& offset, const Point3F& coi_offset); - const Point3F& getThirdPersonOffset() const { return cam_offset; } - const Point3F& getThirdPersonCOIOffset() const { return coi_offset; } + const Point3F& getThirdPersonOffset() const { return mCam_offset; } + const Point3F& getThirdPersonCOIOffset() const { return mCoi_offset; } void setThirdPersonDistance(F32 distance); F32 getThirdPersonDistance(); void setThirdPersonAngle(F32 angle); @@ -147,7 +147,7 @@ public: DECLARE_CATEGORY("AFX"); private: // 3POV SECTION - U32 blockers_mask_3pov; + U32 mBlockers_mask_3pov; void cam_update_3pov(F32 dt, bool on_server); bool avoid_blocked_view(const Point3F& start, const Point3F& end, Point3F& newpos); From fa3839f11cc79e9172ed571da4d80f205e5491f9 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 30 Mar 2018 02:52:22 -0500 Subject: [PATCH 106/144] afx point and spot light membervar cleanups --- Engine/source/afx/ea/afxEA_PointLight_T3D.cpp | 10 +++++----- Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp b/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp index d0e87bf19..ebbfecc47 100644 --- a/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp +++ b/Engine/source/afx/ea/afxEA_PointLight_T3D.cpp @@ -66,10 +66,10 @@ public: class PointLightProxy : public PointLight { - F32 fade_amt; + F32 mFade_amt; public: - PointLightProxy() { fade_amt = 1.0f; } + PointLightProxy() { mFade_amt = 1.0f; } void force_ghost() { @@ -79,7 +79,7 @@ public: void setFadeAmount(F32 fade_amt) { - this->fade_amt = fade_amt; + mFade_amt = fade_amt; mLight->setBrightness(mBrightness*fade_amt); } @@ -125,10 +125,10 @@ public: void submitLights(LightManager* lm, bool staticLighting) { - if (mAnimState.active && mAnimationData && fade_amt < 1.0f) + if (mAnimState.active && mAnimationData && mFade_amt < 1.0f) { F32 mBrightness_save = mBrightness; - mBrightness *= fade_amt; + mBrightness *= mFade_amt; PointLight::submitLights(lm, staticLighting); mBrightness = mBrightness_save; return; diff --git a/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp b/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp index 9e847fa1e..fac4d4ff0 100644 --- a/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp +++ b/Engine/source/afx/ea/afxEA_SpotLight_T3D.cpp @@ -66,10 +66,10 @@ public: class SpotLightProxy : public SpotLight { - F32 fade_amt; + F32 mFade_amt; public: - SpotLightProxy() { fade_amt = 1.0f; } + SpotLightProxy() { mFade_amt = 1.0f; } void force_ghost() { @@ -79,7 +79,7 @@ public: void setFadeAmount(F32 fade_amt) { - this->fade_amt = fade_amt; + mFade_amt = fade_amt; mLight->setBrightness(mBrightness*fade_amt); } @@ -130,10 +130,10 @@ public: void submitLights(LightManager* lm, bool staticLighting) { - if (mAnimState.active && mAnimationData && fade_amt < 1.0f) + if (mAnimState.active && mAnimationData && mFade_amt < 1.0f) { F32 mBrightness_save = mBrightness; - mBrightness *= fade_amt; + mBrightness *= mFade_amt; SpotLight::submitLights(lm, staticLighting); mBrightness = mBrightness_save; return; From fa6b65a9812ca24c4eec3b7c8f35fe2b1ccdcaee Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 30 Mar 2018 02:53:07 -0500 Subject: [PATCH 107/144] afx footswitch membervar cleanups --- Engine/source/afx/ea/afxEA_FootSwitch.cpp | 58 +++++++++++------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/Engine/source/afx/ea/afxEA_FootSwitch.cpp b/Engine/source/afx/ea/afxEA_FootSwitch.cpp index 7bac59d85..e2cfb016b 100644 --- a/Engine/source/afx/ea/afxEA_FootSwitch.cpp +++ b/Engine/source/afx/ea/afxEA_FootSwitch.cpp @@ -40,8 +40,8 @@ class afxEA_FootSwitch : public afxEffectWrapper { typedef afxEffectWrapper Parent; - afxFootSwitchData* footfall_data; - Player* player; + afxFootSwitchData* mFootfall_data; + Player* mPlayer; void do_runtime_substitutions(); @@ -62,38 +62,38 @@ public: afxEA_FootSwitch::afxEA_FootSwitch() { - footfall_data = 0; - player = 0; + mFootfall_data = 0; + mPlayer = 0; } inline void afxEA_FootSwitch::set_overrides(Player* player) { - if (footfall_data->override_all) + if (mFootfall_data->override_all) player->overrideFootfallFX(); else - player->overrideFootfallFX(footfall_data->override_decals, - footfall_data->override_sounds, - footfall_data->override_dust); + player->overrideFootfallFX(mFootfall_data->override_decals, + mFootfall_data->override_sounds, + mFootfall_data->override_dust); } inline void afxEA_FootSwitch::clear_overrides(Player* player) { - if (footfall_data->override_all) + if (mFootfall_data->override_all) player->restoreFootfallFX(); else - player->restoreFootfallFX(footfall_data->override_decals, - footfall_data->override_sounds, - footfall_data->override_dust); + player->restoreFootfallFX(mFootfall_data->override_decals, + mFootfall_data->override_sounds, + mFootfall_data->override_dust); } void afxEA_FootSwitch::ea_set_datablock(SimDataBlock* db) { - footfall_data = dynamic_cast(db); + mFootfall_data = dynamic_cast(db); } bool afxEA_FootSwitch::ea_start() { - if (!footfall_data) + if (!mFootfall_data) { Con::errorf("afxEA_FootSwitch::ea_start() -- missing or incompatible datablock."); return false; @@ -102,25 +102,25 @@ bool afxEA_FootSwitch::ea_start() do_runtime_substitutions(); afxConstraint* pos_cons = getPosConstraint(); - player = (pos_cons) ? dynamic_cast(pos_cons->getSceneObject()) : 0; - if (player) - set_overrides(player); + mPlayer = (pos_cons) ? dynamic_cast(pos_cons->getSceneObject()) : 0; + if (mPlayer) + set_overrides(mPlayer); return true; } bool afxEA_FootSwitch::ea_update(F32 dt) { - if (!player) + if (!mPlayer) return true; afxConstraint* pos_cons = getPosConstraint(); Player* temp_player = (pos_cons) ? dynamic_cast(pos_cons->getSceneObject()) : 0; - if (temp_player && temp_player != player) + if (temp_player && temp_player != mPlayer) { - player = temp_player; - if (player) - set_overrides(player); + mPlayer = temp_player; + if (mPlayer) + set_overrides(mPlayer); } return true; @@ -128,24 +128,24 @@ bool afxEA_FootSwitch::ea_update(F32 dt) void afxEA_FootSwitch::ea_finish(bool was_stopped) { - if (!player) + if (!mPlayer) return; afxConstraint* pos_cons = getPosConstraint(); Player* temp_player = (pos_cons) ? dynamic_cast(pos_cons->getSceneObject()) : 0; - if (temp_player == player) - clear_overrides(player); + if (temp_player == mPlayer) + clear_overrides(mPlayer); } void afxEA_FootSwitch::do_runtime_substitutions() { // only clone the datablock if there are substitutions - if (footfall_data->getSubstitutionCount() > 0) + if (mFootfall_data->getSubstitutionCount() > 0) { // clone the datablock and perform substitutions - afxFootSwitchData* orig_db = footfall_data; - footfall_data = new afxFootSwitchData(*orig_db, true); - orig_db->performSubstitutions(footfall_data, mChoreographer, mGroup_index); + afxFootSwitchData* orig_db = mFootfall_data; + mFootfall_data = new afxFootSwitchData(*orig_db, true); + orig_db->performSubstitutions(mFootfall_data, mChoreographer, mGroup_index); } } From b7a6f6140c76ed861402eda91598e62a111d64f3 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 30 Mar 2018 02:54:48 -0500 Subject: [PATCH 108/144] afx effect-vector and phrase membervar cleanups --- Engine/source/afx/afxEffectVector.cpp | 144 +++++++++++++------------- Engine/source/afx/afxEffectVector.h | 32 +++--- Engine/source/afx/afxMagicSpell.cpp | 4 +- Engine/source/afx/afxPhrase.cpp | 120 ++++++++++----------- Engine/source/afx/afxPhrase.h | 38 +++---- 5 files changed, 169 insertions(+), 169 deletions(-) diff --git a/Engine/source/afx/afxEffectVector.cpp b/Engine/source/afx/afxEffectVector.cpp index 47e0d1aee..5de0a5e40 100644 --- a/Engine/source/afx/afxEffectVector.cpp +++ b/Engine/source/afx/afxEffectVector.cpp @@ -38,52 +38,52 @@ void afxEffectVector::filter_client_server() if (empty()) return; - for (S32 i = 0; i < fx_v->size(); i++) + for (S32 i = 0; i < mFX_v->size(); i++) { - if ((*fx_v)[i]->mDatablock->runsHere(on_server)) - fx_v2->push_back((*fx_v)[i]); + if ((*mFX_v)[i]->mDatablock->runsHere(mOn_server)) + mFX_v2->push_back((*mFX_v)[i]); else { - delete (*fx_v)[i]; - (*fx_v)[i] = 0; + delete (*mFX_v)[i]; + (*mFX_v)[i] = 0; } } swap_vecs(); - fx_v2->clear(); + mFX_v2->clear(); } void afxEffectVector::calc_fx_dur_and_afterlife() { - total_fx_dur = 0.0f; - after_life = 0.0f; + mTotal_fx_dur = 0.0f; + mAfter_life = 0.0f; if (empty()) return; - for (S32 i = 0; i < fx_v->size(); i++) + for (S32 i = 0; i < mFX_v->size(); i++) { - afxEffectWrapper* ew = (*fx_v)[i]; + afxEffectWrapper* ew = (*mFX_v)[i]; if (ew) { F32 ew_dur; if (ew->mEW_timing.lifetime < 0) { - if (phrase_dur > ew->mEW_timing.delay) - ew_dur = phrase_dur + ew->afterStopTime(); + if (mPhrase_dur > ew->mEW_timing.delay) + ew_dur = mPhrase_dur + ew->afterStopTime(); else ew_dur = ew->mEW_timing.delay + ew->afterStopTime(); } else ew_dur = ew->mEW_timing.delay + ew->mEW_timing.lifetime + ew->mEW_timing.fade_out_time; - if (ew_dur > total_fx_dur) - total_fx_dur = ew_dur; + if (ew_dur > mTotal_fx_dur) + mTotal_fx_dur = ew_dur; F32 after = ew->afterStopTime(); - if (after > after_life) - after_life = after; + if (after > mAfter_life) + mAfter_life = after; } } } @@ -92,19 +92,19 @@ void afxEffectVector::calc_fx_dur_and_afterlife() afxEffectVector::afxEffectVector() { - fx_v = 0; - fx_v2 = 0; - active = false; - on_server = false; - total_fx_dur = 0; - after_life = 0; + mFX_v = 0; + mFX_v2 = 0; + mActive = false; + mOn_server = false; + mTotal_fx_dur = 0; + mAfter_life = 0; } afxEffectVector::~afxEffectVector() { stop(true); - delete fx_v; - delete fx_v2; + delete mFX_v; + delete mFX_v2; } void afxEffectVector::effects_init(afxChoreographer* chor, afxEffectList& effects, bool will_stop, F32 time_factor, @@ -189,7 +189,7 @@ void afxEffectVector::effects_init(afxChoreographer* chor, afxEffectList& effect afxEffectWrapper* effect; effect = afxEffectWrapper::ew_create(chor, ewd, cons_mgr, time_factor, group_index); if (effect) - fx_v->push_back(effect); + mFX_v->push_back(effect); } } else @@ -205,14 +205,14 @@ void afxEffectVector::effects_init(afxChoreographer* chor, afxEffectList& effect void afxEffectVector::ev_init(afxChoreographer* chor, afxEffectList& effects, bool on_server, bool will_stop, F32 time_factor, F32 phrase_dur, S32 group_index) { - this->on_server = on_server; - this->phrase_dur = phrase_dur; + mOn_server = on_server; + mPhrase_dur = phrase_dur; - fx_v = new Vector; + mFX_v = new Vector; effects_init(chor, effects, will_stop, time_factor, group_index); - fx_v2 = new Vector(fx_v->size()); + mFX_v2 = new Vector(mFX_v->size()); } void afxEffectVector::start(F32 timestamp) @@ -222,8 +222,8 @@ void afxEffectVector::start(F32 timestamp) // At this point both client and server effects are in the list. // Timing adjustments are made during prestart(). - for (S32 i = 0; i < fx_v->size(); i++) - (*fx_v)[i]->prestart(); + for (S32 i = 0; i < mFX_v->size(); i++) + (*mFX_v)[i]->prestart(); // duration and afterlife values are pre-calculated here calc_fx_dur_and_afterlife(); @@ -232,58 +232,58 @@ void afxEffectVector::start(F32 timestamp) // don't belong here, filter_client_server(); - active = true; + mActive = true; - for (S32 j = 0; j < fx_v->size(); j++) + for (S32 j = 0; j < mFX_v->size(); j++) { - if ((*fx_v)[j]->start(timestamp)) - fx_v2->push_back((*fx_v)[j]); + if ((*mFX_v)[j]->start(timestamp)) + mFX_v2->push_back((*mFX_v)[j]); else { - delete (*fx_v)[j]; - (*fx_v)[j] = 0; + delete (*mFX_v)[j]; + (*mFX_v)[j] = 0; } } swap_vecs(); - fx_v2->clear(); + mFX_v2->clear(); } void afxEffectVector::update(F32 dt) { if (empty()) { - active = false; + mActive = false; return; } - for (int i = 0; i < fx_v->size(); i++) + for (int i = 0; i < mFX_v->size(); i++) { - (*fx_v)[i]->update(dt); + (*mFX_v)[i]->update(dt); - if ((*fx_v)[i]->isDone() || (*fx_v)[i]->isAborted()) + if ((*mFX_v)[i]->isDone() || (*mFX_v)[i]->isAborted()) { // effect has ended, cleanup and delete - (*fx_v)[i]->cleanup(); - delete (*fx_v)[i]; - (*fx_v)[i] = 0; + (*mFX_v)[i]->cleanup(); + delete (*mFX_v)[i]; + (*mFX_v)[i] = 0; } else { // effect is still going, so keep it around - fx_v2->push_back((*fx_v)[i]); + mFX_v2->push_back((*mFX_v)[i]); } } swap_vecs(); - fx_v2->clear(); + mFX_v2->clear(); if (empty()) { - active = false; - delete fx_v; fx_v =0; - delete fx_v2; fx_v2 = 0; + mActive = false; + delete mFX_v; mFX_v =0; + delete mFX_v2; mFX_v2 = 0; } } @@ -291,37 +291,37 @@ void afxEffectVector::stop(bool force_cleanup) { if (empty()) { - active = false; + mActive = false; return; } - for (int i = 0; i < fx_v->size(); i++) + for (int i = 0; i < mFX_v->size(); i++) { - (*fx_v)[i]->stop(); + (*mFX_v)[i]->stop(); - if (force_cleanup || (*fx_v)[i]->deleteWhenStopped()) + if (force_cleanup || (*mFX_v)[i]->deleteWhenStopped()) { // effect is over when stopped, cleanup and delete - (*fx_v)[i]->cleanup(); - delete (*fx_v)[i]; - (*fx_v)[i] = 0; + (*mFX_v)[i]->cleanup(); + delete (*mFX_v)[i]; + (*mFX_v)[i] = 0; } else { // effect needs to fadeout or something, so keep it around - fx_v2->push_back((*fx_v)[i]); + mFX_v2->push_back((*mFX_v)[i]); } } swap_vecs(); - fx_v2->clear(); + mFX_v2->clear(); if (empty()) { - active = false; - delete fx_v; fx_v =0; - delete fx_v2; fx_v2 = 0; + mActive = false; + delete mFX_v; mFX_v =0; + delete mFX_v2; mFX_v2 = 0; } } @@ -329,27 +329,27 @@ void afxEffectVector::interrupt() { if (empty()) { - active = false; + mActive = false; return; } - for (int i = 0; i < fx_v->size(); i++) + for (int i = 0; i < mFX_v->size(); i++) { - (*fx_v)[i]->stop(); - (*fx_v)[i]->cleanup(); - delete (*fx_v)[i]; - (*fx_v)[i] = 0; + (*mFX_v)[i]->stop(); + (*mFX_v)[i]->cleanup(); + delete (*mFX_v)[i]; + (*mFX_v)[i] = 0; } swap_vecs(); - fx_v2->clear(); + mFX_v2->clear(); if (empty()) { - active = false; - delete fx_v; fx_v =0; - delete fx_v2; fx_v2 = 0; + mActive = false; + delete mFX_v; mFX_v =0; + delete mFX_v2; mFX_v2 = 0; } } diff --git a/Engine/source/afx/afxEffectVector.h b/Engine/source/afx/afxEffectVector.h index 49dc11908..837dfe2ce 100644 --- a/Engine/source/afx/afxEffectVector.h +++ b/Engine/source/afx/afxEffectVector.h @@ -37,14 +37,14 @@ class afxChoreographer; class afxEffectVector { - Vector* fx_v; - Vector* fx_v2; + Vector* mFX_v; + Vector* mFX_v2; - bool active; - bool on_server; - F32 phrase_dur; - F32 total_fx_dur; - F32 after_life; + bool mActive; + bool mOn_server; + F32 mPhrase_dur; + F32 mTotal_fx_dur; + F32 mAfter_life; void swap_vecs(); void filter_client_server(); @@ -64,21 +64,21 @@ public: void update(F32 dt); void stop(bool force_cleanup=false); void interrupt(); - bool empty() { return (!fx_v || fx_v->empty()); } - bool isActive() { return active; } - S32 count() { return (fx_v) ? fx_v->size() : 0; } + bool empty() { return (!mFX_v || mFX_v->empty()); } + bool isActive() { return mActive; } + S32 count() { return (mFX_v) ? mFX_v->size() : 0; } - F32 getTotalDur() { return total_fx_dur; } - F32 getAfterLife() { return after_life; } + F32 getTotalDur() { return mTotal_fx_dur; } + F32 getAfterLife() { return mAfter_life; } - Vector* getFX() { return fx_v; } + Vector* getFX() { return mFX_v; } }; inline void afxEffectVector::swap_vecs() { - Vector* tmp = fx_v; - fx_v = fx_v2; - fx_v2 = tmp; + Vector* tmp = mFX_v; + mFX_v = mFX_v2; + mFX_v2 = tmp; } //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// diff --git a/Engine/source/afx/afxMagicSpell.cpp b/Engine/source/afx/afxMagicSpell.cpp index f9fb2ba01..513df0d13 100644 --- a/Engine/source/afx/afxMagicSpell.cpp +++ b/Engine/source/afx/afxMagicSpell.cpp @@ -604,9 +604,9 @@ void CastingPhrase_C::update(F32 dt, F32 timestamp) if (!mNotify_castbar) return; - if (dur > 0 && n_loops > 0) + if (mDur > 0 && mNum_loops > 0) { - F32 nfrac = (timestamp - starttime)/(dur*n_loops); + F32 nfrac = (timestamp - mStartTime)/(mDur*mNum_loops); if (nfrac - mCastbar_progress > 1.0f/200.0f) { mCastbar_progress = (nfrac < 1.0f) ? nfrac : 1.0f; diff --git a/Engine/source/afx/afxPhrase.cpp b/Engine/source/afx/afxPhrase.cpp index 3e0a2bee0..3f4e44167 100644 --- a/Engine/source/afx/afxPhrase.cpp +++ b/Engine/source/afx/afxPhrase.cpp @@ -34,51 +34,51 @@ void afxPhrase::init_fx(S32 group_index) { - fx->ev_init(init_chor, *init_fx_list, on_server, will_stop, init_time_factor, init_dur, group_index); + mFX->ev_init(mInit_chor, *mInit_fx_list, mOn_server, mWill_stop, mInit_time_factor, mInit_dur, group_index); } //~~~~~~~~~~~~~~~~~~~~// afxPhrase::afxPhrase(bool on_server, bool will_stop) { - this->on_server = on_server; - this->will_stop = will_stop; + mOn_server = on_server; + mWill_stop = will_stop; - init_fx_list = NULL; - init_dur = 0.0f; - init_chor = NULL; - init_time_factor = 1.0f; + mInit_fx_list = NULL; + mInit_dur = 0.0f; + mInit_chor = NULL; + mInit_time_factor = 1.0f; - fx = new afxEffectVector; - fx2 = NULL; - starttime = 0; - dur = 0; + mFX = new afxEffectVector; + mFX2 = NULL; + mStartTime = 0; + mDur = 0; - n_loops = 1; - loop_cnt = 1; + mNum_loops = 1; + mLoop_cnt = 1; - extra_time = 0.0f; - extra_stoptime = 0.0f; + mExtra_time = 0.0f; + mExtra_stoptime = 0.0f; } afxPhrase::~afxPhrase() { - delete fx; - delete fx2; + delete mFX; + delete mFX2; }; void afxPhrase::init(afxEffectList& fx_list, F32 dur, afxChoreographer* chor, F32 time_factor, S32 n_loops, S32 group_index, F32 extra_time) { - init_fx_list = &fx_list; - init_dur = dur; - init_chor = chor; - init_time_factor = time_factor; + mInit_fx_list = &fx_list; + mInit_dur = dur; + mInit_chor = chor; + mInit_time_factor = time_factor; - this->n_loops = n_loops; - this->extra_time = extra_time; - this->dur = (init_dur < 0) ? init_dur : init_dur*init_time_factor; + mNum_loops = n_loops; + mExtra_time = extra_time; + mDur = (mInit_dur < 0) ? mInit_dur : mInit_dur*mInit_time_factor; init_fx(group_index); } @@ -86,30 +86,30 @@ afxPhrase::init(afxEffectList& fx_list, F32 dur, afxChoreographer* chor, F32 tim void afxPhrase::start(F32 startstamp, F32 timestamp) { - starttime = startstamp; + mStartTime = startstamp; F32 loopstart = timestamp - startstamp; - if (dur > 0 && loopstart > dur) + if (mDur > 0 && loopstart > mDur) { - loop_cnt += (S32) (loopstart/dur); - loopstart = mFmod(loopstart, dur); + mLoop_cnt += (S32) (loopstart/ mDur); + loopstart = mFmod(loopstart, mDur); } - if (!fx->empty()) - fx->start(loopstart); + if (!mFX->empty()) + mFX->start(loopstart); } void afxPhrase::update(F32 dt, F32 timestamp) { - if (fx->isActive()) - fx->update(dt); + if (mFX->isActive()) + mFX->update(dt); - if (fx2 && fx2->isActive()) - fx2->update(dt); + if (mFX2 && mFX2->isActive()) + mFX2->update(dt); - if (extra_stoptime > 0 && timestamp > extra_stoptime) + if (mExtra_stoptime > 0 && timestamp > mExtra_stoptime) { stop(timestamp); } @@ -118,54 +118,54 @@ afxPhrase::update(F32 dt, F32 timestamp) void afxPhrase::stop(F32 timestamp) { - if (extra_time > 0 && !(extra_stoptime > 0)) + if (mExtra_time > 0 && !(mExtra_stoptime > 0)) { - extra_stoptime = timestamp + extra_time; + mExtra_stoptime = timestamp + mExtra_time; return; } - if (fx->isActive()) - fx->stop(); + if (mFX->isActive()) + mFX->stop(); - if (fx2 && fx2->isActive()) - fx2->stop(); + if (mFX2 && mFX2->isActive()) + mFX2->stop(); } bool afxPhrase::expired(F32 timestamp) { - if (dur < 0) + if (mDur < 0) return false; - return ((timestamp - starttime) > loop_cnt*dur); + return ((timestamp - mStartTime) > mLoop_cnt*mDur); } F32 afxPhrase::elapsed(F32 timestamp) { - return (timestamp - starttime); + return (timestamp - mStartTime); } bool afxPhrase::recycle(F32 timestamp) { - if (n_loops < 0 || loop_cnt < n_loops) + if (mNum_loops < 0 || mLoop_cnt < mNum_loops) { - if (fx2) - delete fx2; + if (mFX2) + delete mFX2; - fx2 = fx; + mFX2 = mFX; - fx = new afxEffectVector; + mFX = new afxEffectVector; init_fx(); - if (fx2 && !fx2->empty()) - fx2->stop(); + if (mFX2 && !mFX2->empty()) + mFX2->stop(); - if (!fx->empty()) - fx->start(0.0F); + if (!mFX->empty()) + mFX->start(0.0F); - loop_cnt++; + mLoop_cnt++; return true; } @@ -175,21 +175,21 @@ afxPhrase::recycle(F32 timestamp) void afxPhrase::interrupt(F32 timestamp) { - if (fx->isActive()) - fx->interrupt(); + if (mFX->isActive()) + mFX->interrupt(); - if (fx2 && fx2->isActive()) - fx2->interrupt(); + if (mFX2 && mFX2->isActive()) + mFX2->interrupt(); } F32 afxPhrase::calcDoneTime() { - return starttime + fx->getTotalDur(); + return mStartTime + mFX->getTotalDur(); } F32 afxPhrase::calcAfterLife() { - return fx->getAfterLife(); + return mFX->getAfterLife(); } diff --git a/Engine/source/afx/afxPhrase.h b/Engine/source/afx/afxPhrase.h index 2525c2656..12803dc5f 100644 --- a/Engine/source/afx/afxPhrase.h +++ b/Engine/source/afx/afxPhrase.h @@ -38,23 +38,23 @@ class afxEffectVector; class afxPhrase { protected: - afxEffectList* init_fx_list; - F32 init_dur; - afxChoreographer* init_chor; - F32 init_time_factor; - F32 extra_time; + afxEffectList* mInit_fx_list; + F32 mInit_dur; + afxChoreographer* mInit_chor; + F32 mInit_time_factor; + F32 mExtra_time; - afxEffectVector* fx; - afxEffectVector* fx2; + afxEffectVector* mFX; + afxEffectVector* mFX2; - bool on_server; - bool will_stop; + bool mOn_server; + bool mWill_stop; - F32 starttime; - F32 dur; - S32 n_loops; - S32 loop_cnt; - F32 extra_stoptime; + F32 mStartTime; + F32 mDur; + S32 mNum_loops; + S32 mLoop_cnt; + F32 mExtra_stoptime; void init_fx(S32 group_index=0); @@ -73,13 +73,13 @@ public: virtual bool recycle(F32 timestamp); virtual F32 elapsed(F32 timestamp); - bool isEmpty() { return fx->empty(); } - bool isInfinite() { return (init_dur < 0); } + bool isEmpty() { return mFX->empty(); } + bool isInfinite() { return (mInit_dur < 0); } F32 calcDoneTime(); F32 calcAfterLife(); - bool willStop() { return will_stop; } - bool onServer() { return on_server; } - S32 count() { return fx->count(); } + bool willStop() { return mWill_stop; } + bool onServer() { return mOn_server; } + S32 count() { return mFX->count(); } }; //~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~//~~~~~~~~~~~~~~~~~~~~~// From c386e90348e04b18de816dc7e2aaa1290b106410 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Sun, 1 Apr 2018 17:48:10 -0500 Subject: [PATCH 109/144] further membervar issue with PolyhedronFixedVectorData template found with clang. --- Engine/source/math/mPolyhedron.h | 10 +++++----- Templates/AFXDemo/game/shaders/procedural/.gitignore | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) create mode 100644 Templates/AFXDemo/game/shaders/procedural/.gitignore diff --git a/Engine/source/math/mPolyhedron.h b/Engine/source/math/mPolyhedron.h index e7054423f..8888d531d 100644 --- a/Engine/source/math/mPolyhedron.h +++ b/Engine/source/math/mPolyhedron.h @@ -254,23 +254,23 @@ struct PolyhedronFixedVectorData : public PolyhedronData /// @{ /// Return the number of planes that make up this polyhedron. - U32 getNumPlanes() const { return planeList.size(); } + U32 getNumPlanes() const { return mPlaneList.size(); } /// Return the planes that make up the polyhedron. /// @note The normals of these planes are facing *inwards*. - PlaneF* getPlanes() const { return planeList.address(); } + PlaneF* getPlanes() const { return mPlaneList.address(); } /// Return the number of points that this polyhedron has. - U32 getNumPoints() const { return pointList.size(); } + U32 getNumPoints() const { return mPointList.size(); } /// - Point3F* getPoints() const { return pointList.address(); } + Point3F* getPoints() const { return mPointList.address(); } /// Return the number of edges that this polyhedron has. U32 getNumEdges() const { return edgeList.size(); } /// - Edge* getEdges() const { return edgeList.address(); } + Edge* getEdges() const { return mEdgeList.address(); } /// @} diff --git a/Templates/AFXDemo/game/shaders/procedural/.gitignore b/Templates/AFXDemo/game/shaders/procedural/.gitignore new file mode 100644 index 000000000..1bc0e838a --- /dev/null +++ b/Templates/AFXDemo/game/shaders/procedural/.gitignore @@ -0,0 +1 @@ +# Keep directory in git repo From 0c316dab469b8287c29bc7eabf050fa23e5b4b8c Mon Sep 17 00:00:00 2001 From: Azaezel Date: Sun, 1 Apr 2018 23:16:13 -0500 Subject: [PATCH 110/144] Revert "collada/ts chain shadowvar and member var clenaups" This reverts commit 3ce15b33eb9375cc05298273a2029438b10f5216. --- Engine/source/ts/collada/colladaAppMesh.cpp | 14 +- Engine/source/ts/collada/colladaImport.cpp | 6 +- .../source/ts/collada/colladaShapeLoader.cpp | 22 +- Engine/source/ts/collada/colladaUtils.cpp | 4 +- Engine/source/ts/loader/tsShapeLoader.cpp | 454 +++++++++--------- Engine/source/ts/loader/tsShapeLoader.h | 28 +- 6 files changed, 264 insertions(+), 264 deletions(-) diff --git a/Engine/source/ts/collada/colladaAppMesh.cpp b/Engine/source/ts/collada/colladaAppMesh.cpp index 5a928dae0..c1420d1cd 100644 --- a/Engine/source/ts/collada/colladaAppMesh.cpp +++ b/Engine/source/ts/collada/colladaAppMesh.cpp @@ -147,12 +147,12 @@ private: end = start; // Get the set for this input - domInputLocalOffset* localOffset = daeSafeCast(input); + const domInputLocalOffset* localOffset = daeSafeCast(input); domUint newSet = localOffset ? localOffset->getSet() : 0; // Add the input to the right place in the list (somewhere between start and end) for (S32 i = start; i <= end; i++) { - localOffset = daeSafeCast(sortedInputs[i]); + const domInputLocalOffset* localOffset = daeSafeCast(sortedInputs[i]); domUint set = localOffset ? localOffset->getSet() : 0xFFFFFFFF; if (newSet < set) { for (S32 j = i + 1; j <= end; j++) @@ -181,10 +181,10 @@ private: const char* semantic = SourceTypeToSemantic( type ); for (S32 iInput = 0; iInput < vertices->getInput_array().getCount(); iInput++) { - domInputLocal* vInput = vertices->getInput_array().get(iInput); - if (dStrEqual(vInput->getSemantic(), semantic)) + domInputLocal* input = vertices->getInput_array().get(iInput); + if (dStrEqual(input->getSemantic(), semantic)) { - source = daeSafeCast(findInputSource(vInput)); + source = daeSafeCast(findInputSource(input)); break; } } @@ -966,7 +966,7 @@ void ColladaAppMesh::lookupSkinData() // Determine the offset into the vindices array for each vertex (since each // vertex may have multiple [bone, weight] pairs in the array) Vector vindicesOffset; - domInt* vindices = (domInt*)weights_v.getRaw(0); + const domInt* vindices = (domInt*)weights_v.getRaw(0); for (S32 iWeight = 0; iWeight < weights_vcount.getCount(); iWeight++) { // Store the offset into the vindices array for this vertex vindicesOffset.push_back(vindices - (domInt*)weights_v.getRaw(0)); @@ -977,7 +977,7 @@ void ColladaAppMesh::lookupSkinData() bool tooManyWeightsWarning = false; for (S32 iVert = 0; iVert < vertsPerFrame; iVert++) { const domUint* vcount = (domUint*)weights_vcount.getRaw(0); - vindices = (domInt*)weights_v.getRaw(0); + const domInt* vindices = (domInt*)weights_v.getRaw(0); vindices += vindicesOffset[vertTuples[iVert].vertex]; S32 nonZeroWeightCount = 0; diff --git a/Engine/source/ts/collada/colladaImport.cpp b/Engine/source/ts/collada/colladaImport.cpp index ded830d5c..1cc2909b0 100644 --- a/Engine/source/ts/collada/colladaImport.cpp +++ b/Engine/source/ts/collada/colladaImport.cpp @@ -120,9 +120,9 @@ static void processNode(GuiTreeViewCtrl* tree, domNode* node, S32 parentID, Scen for (S32 i = 0; i < node->getInstance_node_array().getCount(); i++) { domInstance_node* instnode = node->getInstance_node_array()[i]; - domNode* dNode = daeSafeCast(instnode->getUrl().getElement()); - if (dNode) - processNode(tree, dNode, nodeID, stats); + domNode* node = daeSafeCast(instnode->getUrl().getElement()); + if (node) + processNode(tree, node, nodeID, stats); } } diff --git a/Engine/source/ts/collada/colladaShapeLoader.cpp b/Engine/source/ts/collada/colladaShapeLoader.cpp index 1ac98e072..afb53fdaf 100644 --- a/Engine/source/ts/collada/colladaShapeLoader.cpp +++ b/Engine/source/ts/collada/colladaShapeLoader.cpp @@ -239,14 +239,14 @@ void ColladaShapeLoader::enumerateScene() for (S32 iClipLib = 0; iClipLib < root->getLibrary_animation_clips_array().getCount(); iClipLib++) { const domLibrary_animation_clips* libraryClips = root->getLibrary_animation_clips_array()[iClipLib]; for (S32 iClip = 0; iClip < libraryClips->getAnimation_clip_array().getCount(); iClip++) - mAppSequences.push_back(new ColladaAppSequence(libraryClips->getAnimation_clip_array()[iClip])); + appSequences.push_back(new ColladaAppSequence(libraryClips->getAnimation_clip_array()[iClip])); } // Process all animations => this attaches animation channels to the targeted // Collada elements, and determines the length of the sequence if it is not // already specified in the Collada element - for (S32 iSeq = 0; iSeq < mAppSequences.size(); iSeq++) { - ColladaAppSequence* appSeq = dynamic_cast(mAppSequences[iSeq]); + for (S32 iSeq = 0; iSeq < appSequences.size(); iSeq++) { + ColladaAppSequence* appSeq = dynamic_cast(appSequences[iSeq]); F32 maxEndTime = 0; F32 minFrameTime = 1000.0f; for (S32 iAnim = 0; iAnim < appSeq->getClip()->getInstance_animation_array().getCount(); iAnim++) { @@ -317,7 +317,7 @@ void ColladaShapeLoader::enumerateScene() } // Make sure that the scene has a bounds node (for getting the root scene transform) - if (!mBoundsNode) + if (!boundsNode) { domVisual_scene* visualScene = root->getLibrary_visual_scenes_array()[0]->getVisual_scene_array()[0]; domNode* dombounds = daeSafeCast( visualScene->createAndPlace( "node" ) ); @@ -354,7 +354,7 @@ void ColladaShapeLoader::computeBounds(Box3F& bounds) ColladaUtils::getOptions().adjustFloor) ) { // Compute shape offset - Point3F shapeOffset = Point3F::Zero; + Point3F shapeOffset = Point3F::Zero; if ( ColladaUtils::getOptions().adjustCenter ) { bounds.getCenter( &shapeOffset ); @@ -368,24 +368,24 @@ void ColladaShapeLoader::computeBounds(Box3F& bounds) bounds.maxExtents += shapeOffset; // Now adjust all positions for root level nodes (nodes with no parent) - for (S32 iNode = 0; iNode < mShape->nodes.size(); iNode++) + for (S32 iNode = 0; iNode < shape->nodes.size(); iNode++) { - if ( !mAppNodes[iNode]->isParentRoot() ) + if ( !appNodes[iNode]->isParentRoot() ) continue; // Adjust default translation - mShape->defaultTranslations[iNode] += shapeOffset; + shape->defaultTranslations[iNode] += shapeOffset; // Adjust animated translations - for (S32 iSeq = 0; iSeq < mShape->sequences.size(); iSeq++) + for (S32 iSeq = 0; iSeq < shape->sequences.size(); iSeq++) { - const TSShape::Sequence& seq = mShape->sequences[iSeq]; + const TSShape::Sequence& seq = shape->sequences[iSeq]; if ( seq.translationMatters.test(iNode) ) { for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { S32 index = seq.baseTranslation + seq.translationMatters.count(iNode)*seq.numKeyframes + iFrame; - mShape->nodeTranslations[index] += shapeOffset; + shape->nodeTranslations[index] += shapeOffset; } } } diff --git a/Engine/source/ts/collada/colladaUtils.cpp b/Engine/source/ts/collada/colladaUtils.cpp index 974d2a8ed..c9b7872b1 100644 --- a/Engine/source/ts/collada/colladaUtils.cpp +++ b/Engine/source/ts/collada/colladaUtils.cpp @@ -266,10 +266,10 @@ void AnimData::parseTargetString(const char* target, S32 fullCount, const char* targetValueCount = 1; } } - else if (const char* p2 = dStrrchr(target, '.')) { + else if (const char* p = dStrrchr(target, '.')) { // Check for named elements for (S32 iElem = 0; elements[iElem][0] != 0; iElem++) { - if (!dStrcmp(p2, elements[iElem])) { + if (!dStrcmp(p, elements[iElem])) { targetValueOffset = iElem; targetValueCount = 1; break; diff --git a/Engine/source/ts/loader/tsShapeLoader.cpp b/Engine/source/ts/loader/tsShapeLoader.cpp index 35cc9c8bd..11779eb6b 100644 --- a/Engine/source/ts/loader/tsShapeLoader.cpp +++ b/Engine/source/ts/loader/tsShapeLoader.cpp @@ -44,7 +44,7 @@ const F32 TSShapeLoader::DefaultTime = -1.0f; const F64 TSShapeLoader::MinFrameRate = 15.0f; const F64 TSShapeLoader::MaxFrameRate = 60.0f; const F64 TSShapeLoader::AppGroundFrameRate = 10.0f; -Torque::Path TSShapeLoader::mShapePath; +Torque::Path TSShapeLoader::shapePath; Vector TSShapeLoader::smFormats; @@ -73,7 +73,7 @@ MatrixF TSShapeLoader::getLocalNodeMatrix(AppNode* node, F32 t) if (node->mParentIndex >= 0) { - AppNode *parent = mAppNodes[node->mParentIndex]; + AppNode *parent = appNodes[node->mParentIndex]; MatrixF m2 = parent->getNodeTransform(t); @@ -84,10 +84,10 @@ MatrixF TSShapeLoader::getLocalNodeMatrix(AppNode* node, F32 t) // get local transform by pre-multiplying by inverted parent transform m1 = m2.inverse() * m1; } - else if (mBoundsNode && node != mBoundsNode) + else if (boundsNode && node != boundsNode) { // make transform relative to bounds node transform at time=t - MatrixF mb = mBoundsNode->getNodeTransform(t); + MatrixF mb = boundsNode->getNodeTransform(t); zapScale(mb); m1 = mb.inverse() * m1; } @@ -133,22 +133,22 @@ void TSShapeLoader::updateProgress(S32 major, const char* msg, S32 numMinor, S32 TSShape* TSShapeLoader::generateShape(const Torque::Path& path) { - mShapePath = path; - mShape = new TSShape(); + shapePath = path; + shape = new TSShape(); - mShape->mExporterVersion = 124; - mShape->mSmallestVisibleSize = 999999; - mShape->mSmallestVisibleDL = 0; - mShape->mReadVersion = 24; - mShape->mFlags = 0; - mShape->mSequencesConstructed = 0; + shape->mExporterVersion = 124; + shape->mSmallestVisibleSize = 999999; + shape->mSmallestVisibleDL = 0; + shape->mReadVersion = 24; + shape->mFlags = 0; + shape->mSequencesConstructed = 0; // Get all nodes, objects and sequences in the shape updateProgress(Load_EnumerateScene, "Enumerating scene..."); enumerateScene(); - if (!mSubshapes.size()) + if (!subshapes.size()) { - delete mShape; + delete shape; Con::errorf("Failed to load shape \"%s\", no subshapes found", path.getFullPath().c_str()); return NULL; } @@ -178,7 +178,7 @@ TSShape* TSShapeLoader::generateShape(const Torque::Path& path) // Install the TS memory helper into a TSShape object. install(); - return mShape; + return shape; } bool TSShapeLoader::processNode(AppNode* node) @@ -186,20 +186,20 @@ bool TSShapeLoader::processNode(AppNode* node) // Detect bounds node if ( node->isBounds() ) { - if ( mBoundsNode ) + if ( boundsNode ) { Con::warnf( "More than one bounds node found" ); return false; } - mBoundsNode = node; + boundsNode = node; // Process bounds geometry - MatrixF boundsMat(mBoundsNode->getNodeTransform(DefaultTime)); + MatrixF boundsMat(boundsNode->getNodeTransform(DefaultTime)); boundsMat.inverse(); zapScale(boundsMat); - for (S32 iMesh = 0; iMesh < mBoundsNode->getNumMesh(); iMesh++) + for (S32 iMesh = 0; iMesh < boundsNode->getNumMesh(); iMesh++) { - AppMesh* mesh = mBoundsNode->getMesh(iMesh); + AppMesh* mesh = boundsNode->getMesh(iMesh); MatrixF transform = mesh->getMeshTransform(DefaultTime); transform.mulL(boundsMat); mesh->lockMesh(DefaultTime, transform); @@ -215,10 +215,10 @@ bool TSShapeLoader::processNode(AppNode* node) } // Add this node to the subshape (create one if needed) - if (mSubshapes.size() == 0 ) - mSubshapes.push_back( new TSShapeLoader::Subshape ); + if ( subshapes.size() == 0 ) + subshapes.push_back( new TSShapeLoader::Subshape ); - mSubshapes.last()->branches.push_back( node ); + subshapes.last()->branches.push_back( node ); return true; } @@ -263,8 +263,8 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu if (appNode->isBounds()) return; - S32 subShapeNum = mShape->subShapeFirstNode.size()-1; - Subshape* subshape = mSubshapes[subShapeNum]; + S32 subShapeNum = shape->subShapeFirstNode.size()-1; + Subshape* subshape = subshapes[subShapeNum]; // Check if we should collapse this node S32 myIndex; @@ -275,16 +275,16 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu else { // Check that adding this node will not exceed the maximum node count - if (mShape->nodes.size() >= MAX_TS_SET_SIZE) + if (shape->nodes.size() >= MAX_TS_SET_SIZE) return; - myIndex = mShape->nodes.size(); - String nodeName = getUniqueName(appNode->getName(), cmpShapeName, mShape->names); + myIndex = shape->nodes.size(); + String nodeName = getUniqueName(appNode->getName(), cmpShapeName, shape->names); // Create the 3space node - mShape->nodes.increment(); - TSShape::Node& lastNode = mShape->nodes.last(); - lastNode.nameIndex = mShape->addName(nodeName); + shape->nodes.increment(); + TSShape::Node& lastNode = shape->nodes.last(); + lastNode.nameIndex = shape->addName(nodeName); lastNode.parentIndex = parentIndex; lastNode.firstObject = -1; lastNode.firstChild = -1; @@ -292,8 +292,8 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu // Add the AppNode to a matching list (so AppNodes can be accessed using 3space // node indices) - mAppNodes.push_back(appNode); - mAppNodes.last()->mParentIndex = parentIndex; + appNodes.push_back(appNode); + appNodes.last()->mParentIndex = parentIndex; // Check for NULL detail or AutoBillboard nodes (no children or geometry) if ((appNode->getNumChildNodes() == 0) && @@ -304,7 +304,7 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu if (dStrEqual(dname, "nulldetail") && (size != 0x7FFFFFFF)) { - mShape->addDetail("detail", size, subShapeNum); + shape->addDetail("detail", size, subShapeNum); } else if (appNode->isBillboard() && (size != 0x7FFFFFFF)) { @@ -323,9 +323,9 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu appNode->getInt("BB::DIM", dim); appNode->getBool("BB::INCLUDE_POLES", includePoles); - S32 detIndex = mShape->addDetail( "bbDetail", size, -1 ); + S32 detIndex = shape->addDetail( "bbDetail", size, -1 ); - TSShape::Detail& detIndexDetail = mShape->details[detIndex]; + TSShape::Detail& detIndexDetail = shape->details[detIndex]; detIndexDetail.bbEquatorSteps = numEquatorSteps; detIndexDetail.bbPolarSteps = numPolarSteps; detIndexDetail.bbDetailLevel = dl; @@ -357,23 +357,23 @@ void TSShapeLoader::recurseSubshape(AppNode* appNode, S32 parentIndex, bool recu void TSShapeLoader::generateSubshapes() { - for (U32 iSub = 0; iSub < mSubshapes.size(); iSub++) + for (U32 iSub = 0; iSub < subshapes.size(); iSub++) { - updateProgress(Load_GenerateSubshapes, "Generating subshapes...", mSubshapes.size(), iSub); + updateProgress(Load_GenerateSubshapes, "Generating subshapes...", subshapes.size(), iSub); - Subshape* subshape = mSubshapes[iSub]; + Subshape* subshape = subshapes[iSub]; // Recurse through the node hierarchy, adding 3space nodes and // collecting geometry - S32 firstNode = mShape->nodes.size(); - mShape->subShapeFirstNode.push_back(firstNode); + S32 firstNode = shape->nodes.size(); + shape->subShapeFirstNode.push_back(firstNode); for (U32 iBranch = 0; iBranch < subshape->branches.size(); iBranch++) recurseSubshape(subshape->branches[iBranch], -1, true); - mShape->subShapeNumNodes.push_back(mShape->nodes.size() - firstNode); + shape->subShapeNumNodes.push_back(shape->nodes.size() - firstNode); - if (mShape->nodes.size() >= MAX_TS_SET_SIZE) + if (shape->nodes.size() >= MAX_TS_SET_SIZE) { Con::warnf("Shape exceeds the maximum node count (%d). Ignoring additional nodes.", MAX_TS_SET_SIZE); @@ -400,10 +400,10 @@ bool cmpMeshNameAndSize(const String& key, const Vector& names, void* ar void TSShapeLoader::generateObjects() { - for (S32 iSub = 0; iSub < mSubshapes.size(); iSub++) + for (S32 iSub = 0; iSub < subshapes.size(); iSub++) { - Subshape* subshape = mSubshapes[iSub]; - mShape->subShapeFirstObject.push_back(mShape->objects.size()); + Subshape* subshape = subshapes[iSub]; + shape->subShapeFirstObject.push_back(shape->objects.size()); // Get the names and sizes of the meshes for this subshape Vector meshNames; @@ -464,18 +464,18 @@ void TSShapeLoader::generateObjects() if (!lastName || (meshNames[iMesh] != *lastName)) { - mShape->objects.increment(); - TSShape::Object& lastObject = mShape->objects.last(); - lastObject.nameIndex = mShape->addName(meshNames[iMesh]); + shape->objects.increment(); + TSShape::Object& lastObject = shape->objects.last(); + lastObject.nameIndex = shape->addName(meshNames[iMesh]); lastObject.nodeIndex = subshape->objNodes[iMesh]; - lastObject.startMeshIndex = mAppMeshes.size(); + lastObject.startMeshIndex = appMeshes.size(); lastObject.numMeshes = 0; lastName = &meshNames[iMesh]; } // Add this mesh to the object - mAppMeshes.push_back(mesh); - mShape->objects.last().numMeshes++; + appMeshes.push_back(mesh); + shape->objects.last().numMeshes++; // Set mesh flags mesh->flags = 0; @@ -498,9 +498,9 @@ void TSShapeLoader::generateObjects() } // Attempt to add the detail (will fail if it already exists) - S32 oldNumDetails = mShape->details.size(); - mShape->addDetail(detailName, mesh->detailSize, iSub); - if (mShape->details.size() > oldNumDetails) + S32 oldNumDetails = shape->details.size(); + shape->addDetail(detailName, mesh->detailSize, iSub); + if (shape->details.size() > oldNumDetails) { Con::warnf("Object mesh \"%s\" has no matching detail (\"%s%d\" has" " been added automatically)", mesh->getName(false), detailName, mesh->detailSize); @@ -508,18 +508,18 @@ void TSShapeLoader::generateObjects() } // Get object count for this subshape - mShape->subShapeNumObjects.push_back(mShape->objects.size() - mShape->subShapeFirstObject.last()); + shape->subShapeNumObjects.push_back(shape->objects.size() - shape->subShapeFirstObject.last()); } } void TSShapeLoader::generateSkins() { Vector skins; - for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) { - for (S32 iMesh = 0; iMesh < mShape->objects[iObject].numMeshes; iMesh++) + for (S32 iMesh = 0; iMesh < shape->objects[iObject].numMeshes; iMesh++) { - AppMesh* mesh = mAppMeshes[mShape->objects[iObject].startMeshIndex + iMesh]; + AppMesh* mesh = appMeshes[shape->objects[iObject].startMeshIndex + iMesh]; if (mesh->isSkin()) skins.push_back(mesh); } @@ -543,12 +543,12 @@ void TSShapeLoader::generateSkins() { // Find the node that matches this bone skin->nodeIndex[iBone] = -1; - for (S32 iNode = 0; iNode < mAppMeshes.size(); iNode++) + for (S32 iNode = 0; iNode < appNodes.size(); iNode++) { - if (mAppNodes[iNode]->isEqual(skin->bones[iBone])) + if (appNodes[iNode]->isEqual(skin->bones[iBone])) { delete skin->bones[iBone]; - skin->bones[iBone] = mAppNodes[iNode]; + skin->bones[iBone] = appNodes[iNode]; skin->nodeIndex[iBone] = iNode; break; } @@ -566,18 +566,18 @@ void TSShapeLoader::generateSkins() void TSShapeLoader::generateDefaultStates() { // Generate default object states (includes initial geometry) - for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) { updateProgress(Load_GenerateDefaultStates, "Generating initial mesh and node states...", - mShape->objects.size(), iObject); + shape->objects.size(), iObject); - TSShape::Object& obj = mShape->objects[iObject]; + TSShape::Object& obj = shape->objects[iObject]; // Calculate the objectOffset for each mesh at T=0 for (S32 iMesh = 0; iMesh < obj.numMeshes; iMesh++) { - AppMesh* appMesh = mAppMeshes[obj.startMeshIndex + iMesh]; - AppNode* appNode = obj.nodeIndex >= 0 ? mAppNodes[obj.nodeIndex] : mBoundsNode; + AppMesh* appMesh = appMeshes[obj.startMeshIndex + iMesh]; + AppNode* appNode = obj.nodeIndex >= 0 ? appNodes[obj.nodeIndex] : boundsNode; MatrixF meshMat(appMesh->getMeshTransform(DefaultTime)); MatrixF nodeMat(appMesh->isSkin() ? meshMat : appNode->getNodeTransform(DefaultTime)); @@ -587,16 +587,16 @@ void TSShapeLoader::generateDefaultStates() appMesh->objectOffset = nodeMat.inverse() * meshMat; } - generateObjectState(mShape->objects[iObject], DefaultTime, true, true); + generateObjectState(shape->objects[iObject], DefaultTime, true, true); } // Generate default node transforms - for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) + for (S32 iNode = 0; iNode < appNodes.size(); iNode++) { // Determine the default translation and rotation for the node QuatF rot, srot; Point3F trans, scale; - generateNodeTransform(mAppNodes[iNode], DefaultTime, false, 0, rot, trans, srot, scale); + generateNodeTransform(appNodes[iNode], DefaultTime, false, 0, rot, trans, srot, scale); // Add default node translation and rotation addNodeRotation(rot, true); @@ -606,20 +606,20 @@ void TSShapeLoader::generateDefaultStates() void TSShapeLoader::generateObjectState(TSShape::Object& obj, F32 t, bool addFrame, bool addMatFrame) { - mShape->objectStates.increment(); - TSShape::ObjectState& state = mShape->objectStates.last(); + shape->objectStates.increment(); + TSShape::ObjectState& state = shape->objectStates.last(); state.frameIndex = 0; state.matFrameIndex = 0; - state.vis = mClampF(mAppMeshes[obj.startMeshIndex]->getVisValue(t), 0.0f, 1.0f); + state.vis = mClampF(appMeshes[obj.startMeshIndex]->getVisValue(t), 0.0f, 1.0f); if (addFrame || addMatFrame) { generateFrame(obj, t, addFrame, addMatFrame); // set the frame number for the object state - state.frameIndex = mAppMeshes[obj.startMeshIndex]->numFrames - 1; - state.matFrameIndex = mAppMeshes[obj.startMeshIndex]->numMatFrames - 1; + state.frameIndex = appMeshes[obj.startMeshIndex]->numFrames - 1; + state.matFrameIndex = appMeshes[obj.startMeshIndex]->numMatFrames - 1; } } @@ -627,7 +627,7 @@ void TSShapeLoader::generateFrame(TSShape::Object& obj, F32 t, bool addFrame, bo { for (S32 iMesh = 0; iMesh < obj.numMeshes; iMesh++) { - AppMesh* appMesh = mAppMeshes[obj.startMeshIndex + iMesh]; + AppMesh* appMesh = appMeshes[obj.startMeshIndex + iMesh]; U32 oldNumPoints = appMesh->points.size(); U32 oldNumUvs = appMesh->uvs.size(); @@ -704,13 +704,13 @@ void TSShapeLoader::generateFrame(TSShape::Object& obj, F32 t, bool addFrame, bo void TSShapeLoader::generateMaterialList() { // Install the materials into the material list - mShape->materialList = new TSMaterialList; + shape->materialList = new TSMaterialList; for (S32 iMat = 0; iMat < AppMesh::appMaterials.size(); iMat++) { updateProgress(Load_GenerateMaterials, "Generating materials...", AppMesh::appMaterials.size(), iMat); AppMaterial* appMat = AppMesh::appMaterials[iMat]; - mShape->materialList->push_back(appMat->getName(), appMat->getFlags(), U32(-1), U32(-1), U32(-1), 1.0f, appMat->getReflectance()); + shape->materialList->push_back(appMat->getName(), appMat->getFlags(), U32(-1), U32(-1), U32(-1), 1.0f, appMat->getReflectance()); } } @@ -720,38 +720,38 @@ void TSShapeLoader::generateMaterialList() void TSShapeLoader::generateSequences() { - for (S32 iSeq = 0; iSeq < mAppSequences.size(); iSeq++) + for (S32 iSeq = 0; iSeq < appSequences.size(); iSeq++) { - updateProgress(Load_GenerateSequences, "Generating sequences...", mAppSequences.size(), iSeq); + updateProgress(Load_GenerateSequences, "Generating sequences...", appSequences.size(), iSeq); // Initialize the sequence - mAppSequences[iSeq]->setActive(true); + appSequences[iSeq]->setActive(true); - mShape->sequences.increment(); - TSShape::Sequence& seq = mShape->sequences.last(); + shape->sequences.increment(); + TSShape::Sequence& seq = shape->sequences.last(); - seq.nameIndex = mShape->addName(mAppSequences[iSeq]->getName()); - seq.toolBegin = mAppSequences[iSeq]->getStart(); - seq.priority = mAppSequences[iSeq]->getPriority(); - seq.flags = mAppSequences[iSeq]->getFlags(); + seq.nameIndex = shape->addName(appSequences[iSeq]->getName()); + seq.toolBegin = appSequences[iSeq]->getStart(); + seq.priority = appSequences[iSeq]->getPriority(); + seq.flags = appSequences[iSeq]->getFlags(); // Compute duration and number of keyframes (then adjust time between frames to match) - seq.duration = mAppSequences[iSeq]->getEnd() - mAppSequences[iSeq]->getStart(); - seq.numKeyframes = (S32)(seq.duration * mAppSequences[iSeq]->fps + 0.5f) + 1; + seq.duration = appSequences[iSeq]->getEnd() - appSequences[iSeq]->getStart(); + seq.numKeyframes = (S32)(seq.duration * appSequences[iSeq]->fps + 0.5f) + 1; seq.sourceData.start = 0; seq.sourceData.end = seq.numKeyframes-1; seq.sourceData.total = seq.numKeyframes; // Set membership arrays (ie. which nodes and objects are affected by this sequence) - setNodeMembership(seq, mAppSequences[iSeq]); - setObjectMembership(seq, mAppSequences[iSeq]); + setNodeMembership(seq, appSequences[iSeq]); + setObjectMembership(seq, appSequences[iSeq]); // Generate keyframes generateNodeAnimation(seq); - generateObjectAnimation(seq, mAppSequences[iSeq]); - generateGroundAnimation(seq, mAppSequences[iSeq]); - generateFrameTriggers(seq, mAppSequences[iSeq]); + generateObjectAnimation(seq, appSequences[iSeq]); + generateGroundAnimation(seq, appSequences[iSeq]); + generateFrameTriggers(seq, appSequences[iSeq]); // Set sequence flags seq.dirtyFlags = 0; @@ -765,11 +765,11 @@ void TSShapeLoader::generateSequences() seq.dirtyFlags |= TSShapeInstance::MatFrameDirty; // Set shape flags (only the most significant scale type) - U32 curVal = mShape->mFlags & TSShape::AnyScale; - mShape->mFlags &= ~(TSShape::AnyScale); - mShape->mFlags |= getMax(curVal, seq.flags & TSShape::AnyScale); // take the larger value (can only convert upwards) + U32 curVal = shape->mFlags & TSShape::AnyScale; + shape->mFlags &= ~(TSShape::AnyScale); + shape->mFlags |= getMax(curVal, seq.flags & TSShape::AnyScale); // take the larger value (can only convert upwards) - mAppSequences[iSeq]->setActive(false); + appSequences[iSeq]->setActive(false); } } @@ -798,16 +798,16 @@ void TSShapeLoader::setNodeMembership(TSShape::Sequence& seq, const AppSequence* void TSShapeLoader::setRotationMembership(TSShape::Sequence& seq) { - for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) + for (S32 iNode = 0; iNode < appNodes.size(); iNode++) { // Check if any of the node rotations are different to // the default rotation QuatF defaultRot; - mShape->defaultRotations[iNode].getQuatF(&defaultRot); + shape->defaultRotations[iNode].getQuatF(&defaultRot); for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { - if (mNodeRotCache[iNode][iFrame] != defaultRot) + if (nodeRotCache[iNode][iFrame] != defaultRot) { seq.rotationMatters.set(iNode); break; @@ -818,15 +818,15 @@ void TSShapeLoader::setRotationMembership(TSShape::Sequence& seq) void TSShapeLoader::setTranslationMembership(TSShape::Sequence& seq) { - for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) + for (S32 iNode = 0; iNode < appNodes.size(); iNode++) { // Check if any of the node translations are different to // the default translation - Point3F& defaultTrans = mShape->defaultTranslations[iNode]; + Point3F& defaultTrans = shape->defaultTranslations[iNode]; for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { - if (!mNodeTransCache[iNode][iFrame].equal(defaultTrans)) + if (!nodeTransCache[iNode][iFrame].equal(defaultTrans)) { seq.translationMatters.set(iNode); break; @@ -843,16 +843,16 @@ void TSShapeLoader::setScaleMembership(TSShape::Sequence& seq) U32 alignedScaleCount = 0; U32 uniformScaleCount = 0; - for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) + for (S32 iNode = 0; iNode < appNodes.size(); iNode++) { // Check if any of the node scales are not the unit scale for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { - Point3F& scale = mNodeScaleCache[iNode][iFrame]; + Point3F& scale = nodeScaleCache[iNode][iFrame]; if (!unitScale.equal(scale)) { // Determine what type of scale this is - if (!mNodeScaleRotCache[iNode][iFrame].isIdentity()) + if (!nodeScaleRotCache[iNode][iFrame].isIdentity()) arbitraryScaleCount++; else if (scale.x != scale.y || scale.y != scale.z) alignedScaleCount++; @@ -880,12 +880,12 @@ void TSShapeLoader::setObjectMembership(TSShape::Sequence& seq, const AppSequenc seq.frameMatters.clearAll(); // vert animation (morph) (size = objects.size()) seq.matFrameMatters.clearAll(); // UV animation (size = objects.size()) - for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) { - if (!mAppMeshes[mShape->objects[iObject].startMeshIndex]) + if (!appMeshes[shape->objects[iObject].startMeshIndex]) continue; - if (mAppMeshes[mShape->objects[iObject].startMeshIndex]->animatesVis(appSeq)) + if (appMeshes[shape->objects[iObject].startMeshIndex]->animatesVis(appSeq)) seq.visMatters.set(iObject); // Morph and UV animation has been deprecated //if (appMeshes[shape->objects[iObject].startMeshIndex]->animatesFrame(appSeq)) @@ -898,18 +898,18 @@ void TSShapeLoader::setObjectMembership(TSShape::Sequence& seq, const AppSequenc void TSShapeLoader::clearNodeTransformCache() { // clear out the transform caches - for (S32 i = 0; i < mNodeRotCache.size(); i++) - delete [] mNodeRotCache[i]; - mNodeRotCache.clear(); - for (S32 i = 0; i < mNodeTransCache.size(); i++) - delete [] mNodeTransCache[i]; - mNodeTransCache.clear(); - for (S32 i = 0; i < mNodeScaleRotCache.size(); i++) - delete [] mNodeScaleRotCache[i]; - mNodeScaleRotCache.clear(); - for (S32 i = 0; i < mNodeScaleCache.size(); i++) - delete [] mNodeScaleCache[i]; - mNodeScaleCache.clear(); + for (S32 i = 0; i < nodeRotCache.size(); i++) + delete [] nodeRotCache[i]; + nodeRotCache.clear(); + for (S32 i = 0; i < nodeTransCache.size(); i++) + delete [] nodeTransCache[i]; + nodeTransCache.clear(); + for (S32 i = 0; i < nodeScaleRotCache.size(); i++) + delete [] nodeScaleRotCache[i]; + nodeScaleRotCache.clear(); + for (S32 i = 0; i < nodeScaleCache.size(); i++) + delete [] nodeScaleCache[i]; + nodeScaleCache.clear(); } void TSShapeLoader::fillNodeTransformCache(TSShape::Sequence& seq, const AppSequence* appSeq) @@ -917,28 +917,28 @@ void TSShapeLoader::fillNodeTransformCache(TSShape::Sequence& seq, const AppSequ // clear out the transform caches and set it up for this sequence clearNodeTransformCache(); - mNodeRotCache.setSize(mAppNodes.size()); - for (S32 i = 0; i < mNodeRotCache.size(); i++) - mNodeRotCache[i] = new QuatF[seq.numKeyframes]; - mNodeTransCache.setSize(mAppNodes.size()); - for (S32 i = 0; i < mNodeTransCache.size(); i++) - mNodeTransCache[i] = new Point3F[seq.numKeyframes]; - mNodeScaleRotCache.setSize(mAppNodes.size()); - for (S32 i = 0; i < mNodeScaleRotCache.size(); i++) - mNodeScaleRotCache[i] = new QuatF[seq.numKeyframes]; - mNodeScaleCache.setSize(mAppNodes.size()); - for (S32 i = 0; i < mNodeScaleCache.size(); i++) - mNodeScaleCache[i] = new Point3F[seq.numKeyframes]; + nodeRotCache.setSize(appNodes.size()); + for (S32 i = 0; i < nodeRotCache.size(); i++) + nodeRotCache[i] = new QuatF[seq.numKeyframes]; + nodeTransCache.setSize(appNodes.size()); + for (S32 i = 0; i < nodeTransCache.size(); i++) + nodeTransCache[i] = new Point3F[seq.numKeyframes]; + nodeScaleRotCache.setSize(appNodes.size()); + for (S32 i = 0; i < nodeScaleRotCache.size(); i++) + nodeScaleRotCache[i] = new QuatF[seq.numKeyframes]; + nodeScaleCache.setSize(appNodes.size()); + for (S32 i = 0; i < nodeScaleCache.size(); i++) + nodeScaleCache[i] = new Point3F[seq.numKeyframes]; // get the node transforms for every frame for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numKeyframes - 1); - for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) + for (S32 iNode = 0; iNode < appNodes.size(); iNode++) { - generateNodeTransform(mAppNodes[iNode], time, seq.isBlend(), appSeq->getBlendRefTime(), - mNodeRotCache[iNode][iFrame], mNodeTransCache[iNode][iFrame], - mNodeScaleRotCache[iNode][iFrame], mNodeScaleCache[iNode][iFrame]); + generateNodeTransform(appNodes[iNode], time, seq.isBlend(), appSeq->getBlendRefTime(), + nodeRotCache[iNode][iFrame], nodeTransCache[iNode][iFrame], + nodeScaleRotCache[iNode][iFrame], nodeScaleCache[iNode][iFrame]); } } } @@ -949,57 +949,57 @@ void TSShapeLoader::addNodeRotation(QuatF& rot, bool defaultVal) rot16.set(rot); if (!defaultVal) - mShape->nodeRotations.push_back(rot16); + shape->nodeRotations.push_back(rot16); else - mShape->defaultRotations.push_back(rot16); + shape->defaultRotations.push_back(rot16); } void TSShapeLoader::addNodeTranslation(Point3F& trans, bool defaultVal) { if (!defaultVal) - mShape->nodeTranslations.push_back(trans); + shape->nodeTranslations.push_back(trans); else - mShape->defaultTranslations.push_back(trans); + shape->defaultTranslations.push_back(trans); } void TSShapeLoader::addNodeUniformScale(F32 scale) { - mShape->nodeUniformScales.push_back(scale); + shape->nodeUniformScales.push_back(scale); } void TSShapeLoader::addNodeAlignedScale(Point3F& scale) { - mShape->nodeAlignedScales.push_back(scale); + shape->nodeAlignedScales.push_back(scale); } void TSShapeLoader::addNodeArbitraryScale(QuatF& qrot, Point3F& scale) { Quat16 rot16; rot16.set(qrot); - mShape->nodeArbitraryScaleRots.push_back(rot16); - mShape->nodeArbitraryScaleFactors.push_back(scale); + shape->nodeArbitraryScaleRots.push_back(rot16); + shape->nodeArbitraryScaleFactors.push_back(scale); } void TSShapeLoader::generateNodeAnimation(TSShape::Sequence& seq) { - seq.baseRotation = mShape->nodeRotations.size(); - seq.baseTranslation = mShape->nodeTranslations.size(); - seq.baseScale = (seq.flags & TSShape::ArbitraryScale) ? mShape->nodeArbitraryScaleRots.size() : - (seq.flags & TSShape::AlignedScale) ? mShape->nodeAlignedScales.size() : - mShape->nodeUniformScales.size(); + seq.baseRotation = shape->nodeRotations.size(); + seq.baseTranslation = shape->nodeTranslations.size(); + seq.baseScale = (seq.flags & TSShape::ArbitraryScale) ? shape->nodeArbitraryScaleRots.size() : + (seq.flags & TSShape::AlignedScale) ? shape->nodeAlignedScales.size() : + shape->nodeUniformScales.size(); - for (S32 iNode = 0; iNode < mAppNodes.size(); iNode++) + for (S32 iNode = 0; iNode < appNodes.size(); iNode++) { for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { if (seq.rotationMatters.test(iNode)) - addNodeRotation(mNodeRotCache[iNode][iFrame], false); + addNodeRotation(nodeRotCache[iNode][iFrame], false); if (seq.translationMatters.test(iNode)) - addNodeTranslation(mNodeTransCache[iNode][iFrame], false); + addNodeTranslation(nodeTransCache[iNode][iFrame], false); if (seq.scaleMatters.test(iNode)) { - QuatF& rot = mNodeScaleRotCache[iNode][iFrame]; - Point3F scale = mNodeScaleCache[iNode][iFrame]; + QuatF& rot = nodeScaleRotCache[iNode][iFrame]; + Point3F scale = nodeScaleCache[iNode][iFrame]; if (seq.flags & TSShape::ArbitraryScale) addNodeArbitraryScale(rot, scale); @@ -1014,9 +1014,9 @@ void TSShapeLoader::generateNodeAnimation(TSShape::Sequence& seq) void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSequence* appSeq) { - seq.baseObjectState = mShape->objectStates.size(); + seq.baseObjectState = shape->objectStates.size(); - for (S32 iObject = 0; iObject < mShape->objects.size(); iObject++) + for (S32 iObject = 0; iObject < shape->objects.size(); iObject++) { bool visMatters = seq.visMatters.test(iObject); bool frameMatters = seq.frameMatters.test(iObject); @@ -1027,7 +1027,7 @@ void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSeq for (S32 iFrame = 0; iFrame < seq.numKeyframes; iFrame++) { F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numKeyframes - 1); - generateObjectState(mShape->objects[iObject], time, frameMatters, matFrameMatters); + generateObjectState(shape->objects[iObject], time, frameMatters, matFrameMatters); } } } @@ -1035,10 +1035,10 @@ void TSShapeLoader::generateObjectAnimation(TSShape::Sequence& seq, const AppSeq void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSequence* appSeq) { - seq.firstGroundFrame = mShape->groundTranslations.size(); + seq.firstGroundFrame = shape->groundTranslations.size(); seq.numGroundFrames = 0; - if (!mBoundsNode) + if (!boundsNode) return; // Check if the bounds node is animated by this sequence @@ -1047,7 +1047,7 @@ void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSeq seq.flags |= TSShape::MakePath; // Get ground transform at the start of the sequence - MatrixF invStartMat = mBoundsNode->getNodeTransform(appSeq->getStart()); + MatrixF invStartMat = boundsNode->getNodeTransform(appSeq->getStart()); zapScale(invStartMat); invStartMat.inverse(); @@ -1056,22 +1056,22 @@ void TSShapeLoader::generateGroundAnimation(TSShape::Sequence& seq, const AppSeq F32 time = appSeq->getStart() + seq.duration * iFrame / getMax(1, seq.numGroundFrames - 1); // Determine delta bounds node transform at 't' - MatrixF mat = mBoundsNode->getNodeTransform(time); + MatrixF mat = boundsNode->getNodeTransform(time); zapScale(mat); mat = invStartMat * mat; // Add ground transform Quat16 rotation; rotation.set(QuatF(mat)); - mShape->groundTranslations.push_back(mat.getPosition()); - mShape->groundRotations.push_back(rotation); + shape->groundTranslations.push_back(mat.getPosition()); + shape->groundRotations.push_back(rotation); } } void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSequence* appSeq) { // Initialize triggers - seq.firstTrigger = mShape->triggers.size(); + seq.firstTrigger = shape->triggers.size(); seq.numTriggers = appSeq->getNumTriggers(); if (!seq.numTriggers) return; @@ -1081,8 +1081,8 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque // Add triggers for (S32 iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++) { - mShape->triggers.increment(); - appSeq->getTrigger(iTrigger, mShape->triggers.last()); + shape->triggers.increment(); + appSeq->getTrigger(iTrigger, shape->triggers.last()); } // Track the triggers that get turned off by this shape...normally, triggers @@ -1092,7 +1092,7 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque U32 offTriggers = 0; for (S32 iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++) { - U32 state = mShape->triggers[seq.firstTrigger+iTrigger].state; + U32 state = shape->triggers[seq.firstTrigger+iTrigger].state; if ((state & TSShape::Trigger::StateOn) == 0) offTriggers |= (state & TSShape::Trigger::StateMask); } @@ -1100,8 +1100,8 @@ void TSShapeLoader::generateFrameTriggers(TSShape::Sequence& seq, const AppSeque // We now know which states are turned off, set invert on all those (including when turned on) for (int iTrigger = 0; iTrigger < seq.numTriggers; iTrigger++) { - if (mShape->triggers[seq.firstTrigger + iTrigger].state & offTriggers) - mShape->triggers[seq.firstTrigger + iTrigger].state |= TSShape::Trigger::InvertOnReverse; + if (shape->triggers[seq.firstTrigger + iTrigger].state & offTriggers) + shape->triggers[seq.firstTrigger + iTrigger].state |= TSShape::Trigger::InvertOnReverse; } } @@ -1113,36 +1113,36 @@ void TSShapeLoader::sortDetails() // Insert NULL meshes where required - for (S32 iSub = 0; iSub < mSubshapes.size(); iSub++) + for (S32 iSub = 0; iSub < subshapes.size(); iSub++) { Vector validDetails; - mShape->getSubShapeDetails(iSub, validDetails); + shape->getSubShapeDetails(iSub, validDetails); for (S32 iDet = 0; iDet < validDetails.size(); iDet++) { - TSShape::Detail &detail = mShape->details[validDetails[iDet]]; + TSShape::Detail &detail = shape->details[validDetails[iDet]]; if (detail.subShapeNum >= 0) detail.objectDetailNum = iDet; - for (S32 iObj = mShape->subShapeFirstObject[iSub]; - iObj < (mShape->subShapeFirstObject[iSub] + mShape->subShapeNumObjects[iSub]); + for (S32 iObj = shape->subShapeFirstObject[iSub]; + iObj < (shape->subShapeFirstObject[iSub] + shape->subShapeNumObjects[iSub]); iObj++) { - TSShape::Object &object = mShape->objects[iObj]; + TSShape::Object &object = shape->objects[iObj]; // Insert a NULL mesh for this detail level if required (ie. if the // object does not already have a mesh with an equal or higher detail) S32 meshIndex = (iDet < object.numMeshes) ? iDet : object.numMeshes-1; - if (mAppMeshes[object.startMeshIndex + meshIndex]->detailSize < mShape->details[iDet].size) + if (appMeshes[object.startMeshIndex + meshIndex]->detailSize < shape->details[iDet].size) { // Add a NULL mesh - mAppMeshes.insert(object.startMeshIndex + iDet, NULL); + appMeshes.insert(object.startMeshIndex + iDet, NULL); object.numMeshes++; // Fixup the start index for the other objects - for (S32 k = iObj+1; k < mShape->objects.size(); k++) - mShape->objects[k].startMeshIndex++; + for (S32 k = iObj+1; k < shape->objects.size(); k++) + shape->objects[k].startMeshIndex++; } } } @@ -1157,79 +1157,79 @@ void TSShapeLoader::install() { // Arrays that are filled in by ts shape init, but need // to be allocated beforehand. - mShape->subShapeFirstTranslucentObject.setSize(mShape->subShapeFirstObject.size()); + shape->subShapeFirstTranslucentObject.setSize(shape->subShapeFirstObject.size()); // Construct TS sub-meshes - mShape->meshes.setSize(mAppMeshes.size()); - for (U32 m = 0; m < mAppMeshes.size(); m++) - mShape->meshes[m] = mAppMeshes[m] ? mAppMeshes[m]->constructTSMesh() : NULL; + shape->meshes.setSize(appMeshes.size()); + for (U32 m = 0; m < appMeshes.size(); m++) + shape->meshes[m] = appMeshes[m] ? appMeshes[m]->constructTSMesh() : NULL; // Remove empty meshes and objects - for (S32 iObj = mShape->objects.size()-1; iObj >= 0; iObj--) + for (S32 iObj = shape->objects.size()-1; iObj >= 0; iObj--) { - TSShape::Object& obj = mShape->objects[iObj]; + TSShape::Object& obj = shape->objects[iObj]; for (S32 iMesh = obj.numMeshes-1; iMesh >= 0; iMesh--) { - TSMesh *mesh = mShape->meshes[obj.startMeshIndex + iMesh]; + TSMesh *mesh = shape->meshes[obj.startMeshIndex + iMesh]; if (mesh && !mesh->mPrimitives.size()) { S32 oldMeshCount = obj.numMeshes; destructInPlace(mesh); - mShape->removeMeshFromObject(iObj, iMesh); + shape->removeMeshFromObject(iObj, iMesh); iMesh -= (oldMeshCount - obj.numMeshes - 1); // handle when more than one mesh is removed } } if (!obj.numMeshes) - mShape->removeObject(mShape->getName(obj.nameIndex)); + shape->removeObject(shape->getName(obj.nameIndex)); } // Add a dummy object if needed so the shape loads and renders ok - if (!mShape->details.size()) + if (!shape->details.size()) { - mShape->addDetail("detail", 2, 0); - mShape->subShapeNumObjects.last() = 1; + shape->addDetail("detail", 2, 0); + shape->subShapeNumObjects.last() = 1; - mShape->meshes.push_back(NULL); + shape->meshes.push_back(NULL); - mShape->objects.increment(); + shape->objects.increment(); - TSShape::Object& lastObject = mShape->objects.last(); - lastObject.nameIndex = mShape->addName("dummy"); + TSShape::Object& lastObject = shape->objects.last(); + lastObject.nameIndex = shape->addName("dummy"); lastObject.nodeIndex = 0; lastObject.startMeshIndex = 0; lastObject.numMeshes = 1; - mShape->objectStates.increment(); - mShape->objectStates.last().frameIndex = 0; - mShape->objectStates.last().matFrameIndex = 0; - mShape->objectStates.last().vis = 1.0f; + shape->objectStates.increment(); + shape->objectStates.last().frameIndex = 0; + shape->objectStates.last().matFrameIndex = 0; + shape->objectStates.last().vis = 1.0f; } // Update smallest visible detail - mShape->mSmallestVisibleDL = -1; - mShape->mSmallestVisibleSize = 999999; - for (S32 i = 0; i < mShape->details.size(); i++) + shape->mSmallestVisibleDL = -1; + shape->mSmallestVisibleSize = 999999; + for (S32 i = 0; i < shape->details.size(); i++) { - if ((mShape->details[i].size >= 0) && - (mShape->details[i].size < mShape->mSmallestVisibleSize)) + if ((shape->details[i].size >= 0) && + (shape->details[i].size < shape->mSmallestVisibleSize)) { - mShape->mSmallestVisibleDL = i; - mShape->mSmallestVisibleSize = mShape->details[i].size; + shape->mSmallestVisibleDL = i; + shape->mSmallestVisibleSize = shape->details[i].size; } } - computeBounds(mShape->mBounds); - if (!mShape->mBounds.isValidBox()) - mShape->mBounds = Box3F(1.0f); + computeBounds(shape->mBounds); + if (!shape->mBounds.isValidBox()) + shape->mBounds = Box3F(1.0f); - mShape->mBounds.getCenter(&mShape->center); - mShape->mRadius = (mShape->mBounds.maxExtents - mShape->center).len(); - mShape->tubeRadius = mShape->mRadius; + shape->mBounds.getCenter(&shape->center); + shape->mRadius = (shape->mBounds.maxExtents - shape->center).len(); + shape->tubeRadius = shape->mRadius; - mShape->init(); - mShape->finalizeEditable(); + shape->init(); + shape->finalizeEditable(); } void TSShapeLoader::computeBounds(Box3F& bounds) @@ -1238,11 +1238,11 @@ void TSShapeLoader::computeBounds(Box3F& bounds) bounds = Box3F::Invalid; // Use bounds node geometry if present - if (mBoundsNode && mBoundsNode->getNumMesh() ) + if ( boundsNode && boundsNode->getNumMesh() ) { - for (S32 iMesh = 0; iMesh < mBoundsNode->getNumMesh(); iMesh++) + for (S32 iMesh = 0; iMesh < boundsNode->getNumMesh(); iMesh++) { - AppMesh* mesh = mBoundsNode->getMesh( iMesh ); + AppMesh* mesh = boundsNode->getMesh( iMesh ); if ( !mesh ) continue; @@ -1255,9 +1255,9 @@ void TSShapeLoader::computeBounds(Box3F& bounds) else { // Compute bounds based on all geometry in the model - for (S32 iMesh = 0; iMesh < mAppMeshes.size(); iMesh++) + for (S32 iMesh = 0; iMesh < appMeshes.size(); iMesh++) { - AppMesh* mesh = mAppMeshes[iMesh]; + AppMesh* mesh = appMeshes[iMesh]; if ( !mesh ) continue; @@ -1279,14 +1279,14 @@ TSShapeLoader::~TSShapeLoader() AppMesh::appMaterials.clear(); // Delete Subshapes - delete mBoundsNode; - for (S32 iSub = 0; iSub < mSubshapes.size(); iSub++) - delete mSubshapes[iSub]; + delete boundsNode; + for (S32 iSub = 0; iSub < subshapes.size(); iSub++) + delete subshapes[iSub]; // Delete AppSequences - for (S32 iSeq = 0; iSeq < mAppSequences.size(); iSeq++) - delete mAppSequences[iSeq]; - mAppSequences.clear(); + for (S32 iSeq = 0; iSeq < appSequences.size(); iSeq++) + delete appSequences[iSeq]; + appSequences.clear(); } // Static functions to handle supported formats for shape loader. diff --git a/Engine/source/ts/loader/tsShapeLoader.h b/Engine/source/ts/loader/tsShapeLoader.h index 9c9518bca..32b462e46 100644 --- a/Engine/source/ts/loader/tsShapeLoader.h +++ b/Engine/source/ts/loader/tsShapeLoader.h @@ -101,24 +101,24 @@ public: protected: // Variables used during loading that must be held until the shape is deleted - TSShape* mShape; - Vector mAppMeshes; + TSShape* shape; + Vector appMeshes; // Variables used during loading, but that can be discarded afterwards - static Torque::Path mShapePath; + static Torque::Path shapePath; - AppNode* mBoundsNode; - Vector mAppNodes; ///< Nodes in the loaded shape - Vector mAppSequences; + AppNode* boundsNode; + Vector appNodes; ///< Nodes in the loaded shape + Vector appSequences; - Vector mSubshapes; + Vector subshapes; - Vector mNodeRotCache; - Vector mNodeTransCache; - Vector mNodeScaleRotCache; - Vector mNodeScaleCache; + Vector nodeRotCache; + Vector nodeTransCache; + Vector nodeScaleRotCache; + Vector nodeScaleCache; - Point3F mShapeOffset; ///< Offset used to translate the shape origin + Point3F shapeOffset; ///< Offset used to translate the shape origin //-------------------------------------------------------------------------- @@ -183,10 +183,10 @@ protected: void install(); public: - TSShapeLoader() : mBoundsNode(0) { } + TSShapeLoader() : boundsNode(0) { } virtual ~TSShapeLoader(); - static const Torque::Path& getShapePath() { return mShapePath; } + static const Torque::Path& getShapePath() { return shapePath; } static void zapScale(MatrixF& mat); From 0e3c128ec4dd1eb35ed1521735149cda69bed5c4 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 2 Apr 2018 03:06:58 -0500 Subject: [PATCH 111/144] slimmed down shadowvar cleanups, plus removal of an unused membervar. --- Engine/source/ts/collada/colladaAppMesh.cpp | 10 +++++----- Engine/source/ts/collada/colladaImport.cpp | 6 +++--- Engine/source/ts/collada/colladaUtils.cpp | 4 ++-- Engine/source/ts/loader/tsShapeLoader.h | 2 -- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Engine/source/ts/collada/colladaAppMesh.cpp b/Engine/source/ts/collada/colladaAppMesh.cpp index c1420d1cd..a6bb56f04 100644 --- a/Engine/source/ts/collada/colladaAppMesh.cpp +++ b/Engine/source/ts/collada/colladaAppMesh.cpp @@ -152,7 +152,7 @@ private: // Add the input to the right place in the list (somewhere between start and end) for (S32 i = start; i <= end; i++) { - const domInputLocalOffset* localOffset = daeSafeCast(sortedInputs[i]); + localOffset = daeSafeCast(sortedInputs[i]); domUint set = localOffset ? localOffset->getSet() : 0xFFFFFFFF; if (newSet < set) { for (S32 j = i + 1; j <= end; j++) @@ -181,10 +181,10 @@ private: const char* semantic = SourceTypeToSemantic( type ); for (S32 iInput = 0; iInput < vertices->getInput_array().getCount(); iInput++) { - domInputLocal* input = vertices->getInput_array().get(iInput); - if (dStrEqual(input->getSemantic(), semantic)) + domInputLocal* vInput = vertices->getInput_array().get(iInput); + if (dStrEqual(vInput->getSemantic(), semantic)) { - source = daeSafeCast(findInputSource(input)); + source = daeSafeCast(findInputSource(vInput)); break; } } @@ -977,7 +977,7 @@ void ColladaAppMesh::lookupSkinData() bool tooManyWeightsWarning = false; for (S32 iVert = 0; iVert < vertsPerFrame; iVert++) { const domUint* vcount = (domUint*)weights_vcount.getRaw(0); - const domInt* vindices = (domInt*)weights_v.getRaw(0); + vindices = (domInt*)weights_v.getRaw(0); vindices += vindicesOffset[vertTuples[iVert].vertex]; S32 nonZeroWeightCount = 0; diff --git a/Engine/source/ts/collada/colladaImport.cpp b/Engine/source/ts/collada/colladaImport.cpp index 1cc2909b0..ded830d5c 100644 --- a/Engine/source/ts/collada/colladaImport.cpp +++ b/Engine/source/ts/collada/colladaImport.cpp @@ -120,9 +120,9 @@ static void processNode(GuiTreeViewCtrl* tree, domNode* node, S32 parentID, Scen for (S32 i = 0; i < node->getInstance_node_array().getCount(); i++) { domInstance_node* instnode = node->getInstance_node_array()[i]; - domNode* node = daeSafeCast(instnode->getUrl().getElement()); - if (node) - processNode(tree, node, nodeID, stats); + domNode* dNode = daeSafeCast(instnode->getUrl().getElement()); + if (dNode) + processNode(tree, dNode, nodeID, stats); } } diff --git a/Engine/source/ts/collada/colladaUtils.cpp b/Engine/source/ts/collada/colladaUtils.cpp index c9b7872b1..974d2a8ed 100644 --- a/Engine/source/ts/collada/colladaUtils.cpp +++ b/Engine/source/ts/collada/colladaUtils.cpp @@ -266,10 +266,10 @@ void AnimData::parseTargetString(const char* target, S32 fullCount, const char* targetValueCount = 1; } } - else if (const char* p = dStrrchr(target, '.')) { + else if (const char* p2 = dStrrchr(target, '.')) { // Check for named elements for (S32 iElem = 0; elements[iElem][0] != 0; iElem++) { - if (!dStrcmp(p, elements[iElem])) { + if (!dStrcmp(p2, elements[iElem])) { targetValueOffset = iElem; targetValueCount = 1; break; diff --git a/Engine/source/ts/loader/tsShapeLoader.h b/Engine/source/ts/loader/tsShapeLoader.h index 32b462e46..e58496ce7 100644 --- a/Engine/source/ts/loader/tsShapeLoader.h +++ b/Engine/source/ts/loader/tsShapeLoader.h @@ -118,8 +118,6 @@ protected: Vector nodeScaleRotCache; Vector nodeScaleCache; - Point3F shapeOffset; ///< Offset used to translate the shape origin - //-------------------------------------------------------------------------- // Collect the nodes, objects and sequences for the scene From 5d8b367de853a25361a85fd303d665d20777c5ea Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Mon, 2 Apr 2018 23:38:17 -0400 Subject: [PATCH 112/144] Remove unused variables and cleanup precision warnings as dSprintf takes a U32 for the size of the buffer to use. --- Engine/source/console/codeInterpreter.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Engine/source/console/codeInterpreter.cpp b/Engine/source/console/codeInterpreter.cpp index 46d58476e..f465e16e0 100644 --- a/Engine/source/console/codeInterpreter.cpp +++ b/Engine/source/console/codeInterpreter.cpp @@ -426,12 +426,12 @@ exitLabel: } if (thisNamespace && thisNamespace->mName) { - dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), sizeof(sTraceBuffer) - dStrlen(sTraceBuffer), + dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), (U32)(sizeof(sTraceBuffer) - dStrlen(sTraceBuffer)), "%s::%s() - return %s", thisNamespace->mName, mThisFunctionName, STR.getStringValue()); } else { - dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), sizeof(sTraceBuffer) - dStrlen(sTraceBuffer), + dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), (U32)(sizeof(sTraceBuffer) - dStrlen(sTraceBuffer)), "%s() - return %s", mThisFunctionName, STR.getStringValue()); } Con::printf("%s", sTraceBuffer); @@ -477,12 +477,12 @@ void CodeInterpreter::parseArgs(U32 &ip) } if (mExec.thisNamespace && mExec.thisNamespace->mName) { - dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), sizeof(sTraceBuffer) - dStrlen(sTraceBuffer), + dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), (U32)(sizeof(sTraceBuffer) - dStrlen(sTraceBuffer)), "%s::%s(", mExec.thisNamespace->mName, mThisFunctionName); } else { - dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), sizeof(sTraceBuffer) - dStrlen(sTraceBuffer), + dSprintf(sTraceBuffer + dStrlen(sTraceBuffer), (U32)(sizeof(sTraceBuffer) - dStrlen(sTraceBuffer)), "%s(", mThisFunctionName); } for (S32 i = 0; i < wantedArgc; i++) @@ -2373,9 +2373,6 @@ OPCodeReturn CodeInterpreter::op_callfunc_pointer(U32 &ip) { const char* nsName = ""; - Namespace::Entry::CallbackUnion * nsCb = &mNSEntry->cb; - const char * nsUsage = mNSEntry->mUsage; - #ifndef TORQUE_DEBUG // [tom, 12/13/2006] This stops tools functions from working in the console, // which is useful behavior when debugging so I'm ifdefing this out for debug builds. @@ -2567,8 +2564,6 @@ OPCodeReturn CodeInterpreter::op_callfunc_this(U32 &ip) } else { - Namespace::Entry::CallbackUnion * nsCb = &mNSEntry->cb; - const char * nsUsage = mNSEntry->mUsage; const char* nsName = ns ? ns->mName : ""; #ifndef TORQUE_DEBUG // [tom, 12/13/2006] This stops tools functions from working in the console, From 11064fb1dc54f050e7121bb9626c141daa91d6eb Mon Sep 17 00:00:00 2001 From: Azaezel Date: Mon, 2 Apr 2018 23:58:54 -0500 Subject: [PATCH 113/144] stray fork contamination cleanup --- Templates/AFXDemo/game/shaders/procedural/.gitignore | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Templates/AFXDemo/game/shaders/procedural/.gitignore diff --git a/Templates/AFXDemo/game/shaders/procedural/.gitignore b/Templates/AFXDemo/game/shaders/procedural/.gitignore deleted file mode 100644 index 1bc0e838a..000000000 --- a/Templates/AFXDemo/game/shaders/procedural/.gitignore +++ /dev/null @@ -1 +0,0 @@ -# Keep directory in git repo From 12134ceb2b87e0f180eb67f44e2fafd5ec66d49e Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Tue, 10 Apr 2018 22:21:40 -0400 Subject: [PATCH 114/144] Check for NULL on the thisObject before using it. Also cleanup break to goto. --- Engine/source/console/codeInterpreter.cpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Engine/source/console/codeInterpreter.cpp b/Engine/source/console/codeInterpreter.cpp index 46d58476e..cd25d47f3 100644 --- a/Engine/source/console/codeInterpreter.cpp +++ b/Engine/source/console/codeInterpreter.cpp @@ -400,11 +400,11 @@ ConsoleValueRef CodeInterpreter::exec(U32 ip, breakContinueLabel: OPCodeReturn ret = (this->*gOpCodeArray[mCurrentInstruction])(ip); if (ret == OPCodeReturn::exitCode) - goto exitLabel; + break; else if (ret == OPCodeReturn::breakContinue) goto breakContinueLabel; } -exitLabel: + if (telDebuggerOn && setFrame < 0) TelDebugger->popStackFrame(); @@ -2133,7 +2133,7 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip) if (!mExec.noCalls && !(routingId == MethodOnComponent)) { Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName); - if (callType == FuncCallExprNode::MethodCall) + if (callType == FuncCallExprNode::MethodCall && gEvalState.thisObject != NULL) { Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s", gEvalState.thisObject->getName() ? gEvalState.thisObject->getName() : "", @@ -2522,9 +2522,17 @@ OPCodeReturn CodeInterpreter::op_callfunc_this(U32 &ip) if (!mExec.noCalls) { Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName); - Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s", - mThisObject->getName() ? mThisObject->getName() : "", - mThisObject->getId(), Con::getNamespaceList(ns)); + if (mThisObject) + { + Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s", + mThisObject->getName() ? mThisObject->getName() : "", + mThisObject->getId(), Con::getNamespaceList(ns)); + } + else + { + // At least let the scripter know that they access the object. + Con::warnf(ConsoleLogEntry::General, " Object is NULL."); + } } STR.popFrame(); CSTK.popFrame(); From c75eecbf53836f73d9d6fcaff31d24c120571eab Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Thu, 12 Apr 2018 23:14:57 -0400 Subject: [PATCH 115/144] fix this pointer in op_callfunc_this --- Engine/source/console/codeInterpreter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/console/codeInterpreter.cpp b/Engine/source/console/codeInterpreter.cpp index cd25d47f3..8f5d829ed 100644 --- a/Engine/source/console/codeInterpreter.cpp +++ b/Engine/source/console/codeInterpreter.cpp @@ -2511,7 +2511,7 @@ OPCodeReturn CodeInterpreter::op_callfunc_this(U32 &ip) ip += 2; CSTK.getArgcArgv(fnName, &mCallArgc, &mCallArgv); - Namespace *ns = mThisObject->getNamespace(); + Namespace *ns = mThisObject ? mThisObject->getNamespace() : NULL; if (ns) mNSEntry = ns->lookup(fnName); else From c6ec1f8d86bf9a2a926394fa3b106b090353310d Mon Sep 17 00:00:00 2001 From: Jeff Hutchinson Date: Sat, 14 Apr 2018 10:59:09 -0400 Subject: [PATCH 116/144] Added better script interpreter logging. --- Engine/source/console/codeInterpreter.cpp | 36 ++++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/Engine/source/console/codeInterpreter.cpp b/Engine/source/console/codeInterpreter.cpp index 8f5d829ed..7654a6da1 100644 --- a/Engine/source/console/codeInterpreter.cpp +++ b/Engine/source/console/codeInterpreter.cpp @@ -2132,12 +2132,27 @@ OPCodeReturn CodeInterpreter::op_callfunc(U32 &ip) { if (!mExec.noCalls && !(routingId == MethodOnComponent)) { - Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName); - if (callType == FuncCallExprNode::MethodCall && gEvalState.thisObject != NULL) + if (callType == FuncCallExprNode::MethodCall) { - Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s", - gEvalState.thisObject->getName() ? gEvalState.thisObject->getName() : "", - gEvalState.thisObject->getId(), Con::getNamespaceList(ns)); + if (gEvalState.thisObject != NULL) + { + // Try to use the name instead of the id + StringTableEntry name = gEvalState.thisObject->getName() ? gEvalState.thisObject->getName() : gEvalState.thisObject->getIdString(); + Con::warnf(ConsoleLogEntry::General, "%s: Unknown method %s.%s Namespace List: %s", mCodeBlock->getFileLine(ip - 6), name, fnName, Con::getNamespaceList(ns)); + } + else + { + // NULL. + Con::warnf(ConsoleLogEntry::General, "%s: Unknown method NULL.%s", mCodeBlock->getFileLine(ip - 6), fnName); + } + } + else if (callType == FuncCallExprNode::ParentCall) + { + Con::warnf(ConsoleLogEntry::General, "%s: Unknown parent call %s.", mCodeBlock->getFileLine(ip - 6), fnName); + } + else + { + Con::warnf(ConsoleLogEntry::General, "%s: Unknown function %s.", mCodeBlock->getFileLine(ip - 6), fnName); } } STR.popFrame(); @@ -2328,7 +2343,7 @@ OPCodeReturn CodeInterpreter::op_callfunc_pointer(U32 &ip) { if (!mExec.noCalls) { - Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName); + Con::warnf(ConsoleLogEntry::General, "%s: Unknown function %s.", mCodeBlock->getFileLine(ip - 6), fnName); } STR.popFrame(); CSTK.popFrame(); @@ -2521,17 +2536,16 @@ OPCodeReturn CodeInterpreter::op_callfunc_this(U32 &ip) { if (!mExec.noCalls) { - Con::warnf(ConsoleLogEntry::General, "%s: Unknown command %s.", mCodeBlock->getFileLine(ip - 6), fnName); if (mThisObject) { - Con::warnf(ConsoleLogEntry::General, " Object %s(%d) %s", - mThisObject->getName() ? mThisObject->getName() : "", - mThisObject->getId(), Con::getNamespaceList(ns)); + // Try to use the name instead of the id + StringTableEntry name = mThisObject->getName() ? mThisObject->getName() : mThisObject->getIdString(); + Con::warnf(ConsoleLogEntry::General, "%s: Unknown method %s.%s Namespace List: %s", mCodeBlock->getFileLine(ip - 6), name, fnName, Con::getNamespaceList(ns)); } else { // At least let the scripter know that they access the object. - Con::warnf(ConsoleLogEntry::General, " Object is NULL."); + Con::warnf(ConsoleLogEntry::General, "%s: Unknown method NULL.%s", mCodeBlock->getFileLine(ip - 6), fnName); } } STR.popFrame(); From cecf109f93d13056ed5c82ed7fc3c7538635a092 Mon Sep 17 00:00:00 2001 From: Glenn Smith Date: Sat, 14 Apr 2018 17:51:29 -0400 Subject: [PATCH 117/144] Higher resolution torque icon, 1024x1024 for macOS, 256x256 for Windows. --- Tools/CMake/torque.icns | Bin 27205 -> 248361 bytes Tools/CMake/torque.ico | Bin 25214 -> 36805 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/Tools/CMake/torque.icns b/Tools/CMake/torque.icns index 10d3dce34710ea36d1daf62a1c58dc8657cc5740..50aa70257ae6cb51b0c5fa327547526b84e44896 100644 GIT binary patch literal 248361 zcmdSAWmp{Dwk}%T&`2ZQxVr~;3+_&W2Pe3@251}-2#`R4paBvz0TKw1;1)=*;KAKp zg43t-t-aR$&f0sO^W5jTe{TJ#8smMZj2dIss980uoF2RT0BGMie8k*b004vq{LdR2 z=zqgGs}%pP3v3`iqWukcghXD+{!QoFL?S<8{u98m8ofm#kq`f=KSL>d=Sajq^(Z8= zi@^t(|4&`@7Fmm_aW|J;O8gh}6p6eUSwmGqKKP?!^!^c%XM3yD?tk=q$4F#uu%93^ z86Nr{-SY0{M(>aCUmJ~-loY`~mH&2h@(~n3`5`kM0FX}s@W)=81OTmL;p_bb06iy4 zS&BIxfIPNQQ58{(0WhsPmbxA&D@vop#?2}%c{v3El;|@N$VzAbH75puHY}L4GB<2~ z?;B2x1fWCHiW~`R>pMrg%_wd9n+SjMkI&`VDIO63X8Gy|UTzryXbgbfxblpHJsv<$ zuP~;deFYQ&U~+04logb8RCp*Wh=~bc=qMT&pO6qQ4#1#dpduiEW1~7IXQUv+hY{hT zL^vHGE`UQtg0g{vjsOQBXP}{`!9(>*O%KB-WME`uW}-l8^fWLy2`vRVF)=>M20{i3 zI36C(9~;Q&3Gpycoe+{>p~L>N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Ddrz8xL>cw+D_LXQJKi zw92$i_3xpsaT9j8#?CQtALuS8t zgN|K3wJm#o7grjH`5hzfBEMVel!Ex$fAY<4H=px&@ZXaJG4Jo=#^zAJ-6b(axD~$L zW$Fd*cX?&Ox4XEiNWR-`3&Yy5N)mryKmMkc{i(@cRQ?p?KJz(?b!zGM`Zsaa^f0*&AO%8hOJ+`;~8qF7dZq_l*Pk+&$ zn|gzGtgq?7j#jogb)l&Tb$eHOY4M+bpxZOmdziX|X9~XY`ab9O;^IHvamSE>-Kr^Ne$VGwhJ_qwBMz zTwksS=Mnp$o28A7Lz!Nhd23+bybEUR;99qXH>-?Y#BU+0cdK>4!2J#)->mA$x2p$; F{|~!ycEJDu From 96c71a4d5d7b594b2cdfbca741f604a26f2ab599 Mon Sep 17 00:00:00 2001 From: rextimmy Date: Sat, 21 Apr 2018 18:19:17 +1000 Subject: [PATCH 118/144] Corrects a problem with the D3D11 texture lock/unlock mechanism --- .../gfx/D3D11/gfxD3D11TextureObject.cpp | 109 +++++++++--------- .../source/gfx/D3D11/gfxD3D11TextureObject.h | 3 +- 2 files changed, 55 insertions(+), 57 deletions(-) diff --git a/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp b/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp index 7fdd8201e..7c33e1c16 100644 --- a/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp +++ b/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp @@ -65,59 +65,56 @@ GFXLockedRect *GFXD3D11TextureObject::lock(U32 mipLevel /*= 0*/, RectI *inRect / { AssertFatal( !mLocked, "GFXD3D11TextureObject::lock - The texture is already locked!" ); - D3D11_MAPPED_SUBRESOURCE mapInfo; - - if( mProfile->isRenderTarget() ) + if( !mStagingTex || + mStagingTex->getWidth() != getWidth() || + mStagingTex->getHeight() != getHeight() ) { - //AssertFatal( 0, "GFXD3D11TextureObject::lock - Need to handle mapping render targets" ); - if( !mLockTex || - mLockTex->getWidth() != getWidth() || - mLockTex->getHeight() != getHeight() ) - { - mLockTex.set( getWidth(), getHeight(), mFormat, &GFXSystemMemTextureProfile, avar("%s() - mLockTex (line %d)", __FUNCTION__, __LINE__) ); - } + mStagingTex.set( getWidth(), getHeight(), mFormat, &GFXSystemMemTextureProfile, avar("%s() - mLockTex (line %d)", __FUNCTION__, __LINE__) ); + } - PROFILE_START(GFXD3D11TextureObject_lockRT); + ID3D11DeviceContext* pContext = D3D11DEVICECONTEXT; + D3D11_MAPPED_SUBRESOURCE mapInfo; + U32 offset = 0; + mLockedSubresource = D3D11CalcSubresource(mipLevel, 0, getMipLevels()); + GFXD3D11TextureObject* pD3DStagingTex = (GFXD3D11TextureObject*)&(*mStagingTex); - GFXD3D11Device* dev = D3D11; + //map staging texture + HRESULT hr = pContext->Map(pD3DStagingTex->get2DTex(), mLockedSubresource, D3D11_MAP_READ, 0, &mapInfo); - GFXD3D11TextureObject* to = (GFXD3D11TextureObject*) &(*mLockTex); - dev->getDeviceContext()->CopyResource(to->get2DTex(), mD3DTexture); + if (FAILED(hr)) + AssertFatal(false, "GFXD3D11TextureObject:lock - failed to map render target resource!"); - mLockedSubresource = D3D11CalcSubresource(0, 0, 1); - HRESULT hr = dev->getDeviceContext()->Map(to->get2DTex(), mLockedSubresource, D3D11_MAP_READ, 0, &mapInfo); - - if (FAILED(hr)) - AssertFatal(false, "GFXD3D11TextureObject:lock- failed to map render target resource!"); + const U32 width = mTextureSize.x >> mipLevel; + const U32 height = mTextureSize.y >> mipLevel; - mLocked = true; + //calculate locked box region and offset + if (inRect) + { + if ((inRect->point.x + inRect->extent.x > width) || (inRect->point.y + inRect->extent.y > height)) + AssertFatal(false, "GFXD3D11TextureObject::lock - Rectangle too big!"); + mLockBox.top = inRect->point.y; + mLockBox.left = inRect->point.x; + mLockBox.bottom = inRect->point.y + inRect->extent.y; + mLockBox.right = inRect->point.x + inRect->extent.x; + mLockBox.back = 1; + mLockBox.front = 0; - PROFILE_END(); + //calculate offset + offset = inRect->point.x * getFormatByteSize() + inRect->point.y * mapInfo.RowPitch; } else { - RECT r; - - if(inRect) - { - r.top = inRect->point.y; - r.left = inRect->point.x; - r.bottom = inRect->point.y + inRect->extent.y; - r.right = inRect->point.x + inRect->extent.x; - } - - mLockedSubresource = D3D11CalcSubresource(mipLevel, 0, getMipLevels()); - HRESULT hr = D3D11DEVICECONTEXT->Map(mD3DTexture, mLockedSubresource, D3D11_MAP_WRITE_DISCARD, 0, &mapInfo); - - if ( FAILED(hr) ) - AssertFatal(false, "GFXD3D11TextureObject::lock - Failed to map subresource."); - - mLocked = true; - + mLockBox.top = 0; + mLockBox.left = 0; + mLockBox.bottom = height; + mLockBox.right = width; + mLockBox.back = 1; + mLockBox.front = 0; } - mLockRect.pBits = static_cast(mapInfo.pData); + mLocked = true; + mLockRect.pBits = static_cast(mapInfo.pData) + offset; mLockRect.Pitch = mapInfo.RowPitch; return (GFXLockedRect*)&mLockRect; @@ -127,22 +124,22 @@ void GFXD3D11TextureObject::unlock(U32 mipLevel) { AssertFatal( mLocked, "GFXD3D11TextureObject::unlock - Attempting to unlock a surface that has not been locked" ); - if( mProfile->isRenderTarget() ) - { - //AssertFatal( 0, "GFXD3D11TextureObject::unlock - Need to handle mapping render targets" ); - GFXD3D11TextureObject* to = (GFXD3D11TextureObject*)&(*mLockTex); - - D3D11->getDeviceContext()->Unmap(to->get2DTex(), mLockedSubresource); - - mLockedSubresource = 0; - mLocked = false; - } - else - { - D3D11DEVICECONTEXT->Unmap(get2DTex(), mLockedSubresource); - mLockedSubresource = 0; - mLocked = false; - } + //profile in the unlock function because all the heavy lifting is done here + PROFILE_START(GFXD3D11TextureObject_lockRT); + + ID3D11DeviceContext* pContext = D3D11DEVICECONTEXT; + GFXD3D11TextureObject* pD3DStagingTex = (GFXD3D11TextureObject*)&(*mStagingTex); + ID3D11Texture2D *pStagingTex = pD3DStagingTex->get2DTex(); + + //unmap staging texture + pContext->Unmap(pStagingTex, mLockedSubresource); + //copy lock box region from the staging texture to our regular texture + pContext->CopySubresourceRegion(mD3DTexture, mLockedSubresource, mLockBox.left, mLockBox.top, 0, pStagingTex, mLockedSubresource, &mLockBox); + + PROFILE_END(); + + mLockedSubresource = 0; + mLocked = false; } void GFXD3D11TextureObject::release() diff --git a/Engine/source/gfx/D3D11/gfxD3D11TextureObject.h b/Engine/source/gfx/D3D11/gfxD3D11TextureObject.h index b50cc2465..2152cc62a 100644 --- a/Engine/source/gfx/D3D11/gfxD3D11TextureObject.h +++ b/Engine/source/gfx/D3D11/gfxD3D11TextureObject.h @@ -31,8 +31,9 @@ class GFXD3D11TextureObject : public GFXTextureObject { protected: static U32 mTexCount; - GFXTexHandle mLockTex; + GFXTexHandle mStagingTex; DXGI_MAPPED_RECT mLockRect; + D3D11_BOX mLockBox; bool mLocked; U32 mLockedSubresource; From 10988915651707306420f7b5b58456e3241debd3 Mon Sep 17 00:00:00 2001 From: OTHGMars Date: Fri, 27 Apr 2018 21:44:04 -0400 Subject: [PATCH 119/144] Updates PlatformCursorController to use full set of SDL cursors. Adds support for the SDL_SYSTEM_CURSOR_WAITARROW and SDL_SYSTEM_CURSOR_NO. --- Engine/source/windowManager/platformCursorController.h | 3 +++ Engine/source/windowManager/sdl/sdlCursorController.cpp | 5 +++-- Engine/source/windowManager/win32/win32CursorController.cpp | 5 +++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/Engine/source/windowManager/platformCursorController.h b/Engine/source/windowManager/platformCursorController.h index 686f4d390..4bd969a5c 100644 --- a/Engine/source/windowManager/platformCursorController.h +++ b/Engine/source/windowManager/platformCursorController.h @@ -76,6 +76,9 @@ public: curResizeNESW, curResizeNWSE, curHand, + curWaitArrow, + curNoNo, + numPlatformCursors }; public: diff --git a/Engine/source/windowManager/sdl/sdlCursorController.cpp b/Engine/source/windowManager/sdl/sdlCursorController.cpp index dca1f04be..601df4e19 100644 --- a/Engine/source/windowManager/sdl/sdlCursorController.cpp +++ b/Engine/source/windowManager/sdl/sdlCursorController.cpp @@ -41,7 +41,8 @@ static struct { U32 id; SDL_SystemCursor resourceID; SDL_Cursor *cursor;} sgCurs { PlatformCursorController::curResizeNESW, SDL_SYSTEM_CURSOR_SIZENESW, NULL }, { PlatformCursorController::curResizeNWSE, SDL_SYSTEM_CURSOR_SIZENWSE, NULL }, { PlatformCursorController::curHand, SDL_SYSTEM_CURSOR_HAND, NULL }, - { 0, SDL_SYSTEM_CURSOR_NO, NULL }, + { PlatformCursorController::curWaitArrow, SDL_SYSTEM_CURSOR_WAITARROW, NULL }, + { PlatformCursorController::curNoNo, SDL_SYSTEM_CURSOR_NO, NULL }, }; @@ -90,7 +91,7 @@ void PlatformCursorControllerSDL::setCursorShape(U32 cursorID) { SDL_Cursor* cursor = NULL; - for(S32 i = 0; sgCursorShapeMap[i].resourceID != SDL_SYSTEM_CURSOR_NO; ++i) + for(S32 i = 0; i < numPlatformCursors; ++i) { if(cursorID == sgCursorShapeMap[i].id) { diff --git a/Engine/source/windowManager/win32/win32CursorController.cpp b/Engine/source/windowManager/win32/win32CursorController.cpp index ba19b0979..25e024e65 100644 --- a/Engine/source/windowManager/win32/win32CursorController.cpp +++ b/Engine/source/windowManager/win32/win32CursorController.cpp @@ -43,7 +43,8 @@ static struct { U32 id; LPTSTR resourceID; } sgCursorShapeMap[]= { PlatformCursorController::curResizeNESW, IDC_SIZENESW }, { PlatformCursorController::curResizeNWSE, IDC_SIZENWSE }, { PlatformCursorController::curHand, IDC_HAND }, - { 0, 0 }, + { PlatformCursorController::curWaitArrow, IDC_WAIT }, + { PlatformCursorController::curNoNo, IDC_NO }, }; //static const EnumTable::Enums curManagerShapesEnums[] = @@ -129,7 +130,7 @@ void Win32CursorController::setCursorShape(U32 cursorID) { LPTSTR resourceID = NULL; - for(S32 i = 0;sgCursorShapeMap[i].resourceID != NULL;++i) + for(S32 i = 0; i < numPlatformCursors; ++i) { if(cursorID == sgCursorShapeMap[i].id) { From fea3724f4e2da2e446a8d2dd804656b1dc3a1d29 Mon Sep 17 00:00:00 2001 From: Ratfish Studios Date: Tue, 8 May 2018 00:30:15 -0500 Subject: [PATCH 120/144] Rearranges the right-mouse click popup menus for the world editor and gui editors to a) be organized more logically and b) be more flexible. This also fixes some insecure behavior relying on %this value eval'ing, which has also been modified to be better. Also fixes up some old calls for getting menubar menus by internal name, which is no longer supported, instead using the findMenu function call. --- Engine/source/gui/editor/popupMenu.cpp | 18 +- Engine/source/gui/editor/popupMenu.h | 3 + .../game/tools/base/menuBar/menuBuilder.ed.cs | 13 +- .../guiEditor/scripts/guiEditorTreeView.ed.cs | 58 ++-- .../shapeEditor/scripts/shapeEditor.ed.cs | 2 +- .../tools/worldEditor/scripts/EditorGui.ed.cs | 298 ++++++------------ .../game/tools/base/menuBar/menuBuilder.ed.cs | 13 +- .../tools/guiEditor/scripts/guiEditor.ed.cs | 40 +-- .../guiEditor/scripts/guiEditorTreeView.ed.cs | 58 ++-- .../shapeEditor/scripts/shapeEditor.ed.cs | 2 +- .../tools/worldEditor/scripts/EditorGui.ed.cs | 298 ++++++------------ 11 files changed, 305 insertions(+), 498 deletions(-) diff --git a/Engine/source/gui/editor/popupMenu.cpp b/Engine/source/gui/editor/popupMenu.cpp index 0e5db18da..b02865bc7 100644 --- a/Engine/source/gui/editor/popupMenu.cpp +++ b/Engine/source/gui/editor/popupMenu.cpp @@ -199,7 +199,7 @@ bool PopupMenu::setItem(S32 pos, const char *title, const char* accelerator, con void PopupMenu::removeItem(S32 itemPos) { - if (mMenuItems.size() < itemPos || itemPos < 0) + if (mMenuItems.empty() || mMenuItems.size() < itemPos || itemPos < 0) return; mMenuItems.erase(itemPos); @@ -208,7 +208,7 @@ void PopupMenu::removeItem(S32 itemPos) ////////////////////////////////////////////////////////////////////////// void PopupMenu::enableItem(S32 pos, bool enable) { - if (mMenuItems.size() < pos || pos < 0) + if (mMenuItems.empty() || mMenuItems.size() < pos || pos < 0) return; mMenuItems[pos].enabled = enable; @@ -216,7 +216,7 @@ void PopupMenu::enableItem(S32 pos, bool enable) void PopupMenu::checkItem(S32 pos, bool checked) { - if (mMenuItems.size() < pos || pos < 0) + if (mMenuItems.empty() || mMenuItems.size() < pos || pos < 0) return; if (checked && mMenuItems[pos].checkGroup != -1) @@ -243,7 +243,7 @@ void PopupMenu::checkRadioItem(S32 firstPos, S32 lastPos, S32 checkPos) bool PopupMenu::isItemChecked(S32 pos) { - if (mMenuItems.size() < pos || pos < 0) + if (mMenuItems.empty() || mMenuItems.size() < pos || pos < 0) return false; return mMenuItems[pos].isChecked; @@ -254,6 +254,11 @@ U32 PopupMenu::getItemCount() return mMenuItems.size(); } +void PopupMenu::clearItems() +{ + mMenuItems.clear(); +} + ////////////////////////////////////////////////////////////////////////// bool PopupMenu::canHandleID(U32 id) { @@ -498,6 +503,11 @@ DefineConsoleMethod(PopupMenu, getItemCount, S32, (), , "()") return object->getItemCount(); } +DefineConsoleMethod(PopupMenu, clearItems, void, (), , "()") +{ + return object->clearItems(); +} + //----------------------------------------------------------------------------- DefineConsoleMethod(PopupMenu, showPopup, void, (const char * canvasName, S32 x, S32 y), ( -1, -1), "(Canvas,[x, y])") { diff --git a/Engine/source/gui/editor/popupMenu.h b/Engine/source/gui/editor/popupMenu.h index 9a6dd0821..4ee7439ff 100644 --- a/Engine/source/gui/editor/popupMenu.h +++ b/Engine/source/gui/editor/popupMenu.h @@ -137,6 +137,9 @@ public: /// Returns the number of items in the menu. U32 getItemCount(); + ///Clears all items + void clearItems(); + //----------------------------------------------------------------------------- /// Displays this menu as a popup menu and blocks until the user has selected /// an item. diff --git a/Templates/BaseGame/game/tools/base/menuBar/menuBuilder.ed.cs b/Templates/BaseGame/game/tools/base/menuBar/menuBuilder.ed.cs index 11d66b2ed..183eef7eb 100644 --- a/Templates/BaseGame/game/tools/base/menuBar/menuBuilder.ed.cs +++ b/Templates/BaseGame/game/tools/base/menuBar/menuBuilder.ed.cs @@ -152,9 +152,20 @@ function MenuBuilder::onAdd(%this) } } +function MenuBuilder::reloadItems(%this) +{ + %this.clearItems(); + + for(%i = 0;%this.item[%i] !$= "";%i++) + { + %this.addItem(%i); + } +} + function MenuBuilder::onRemove(%this) { - %this.removeFromMenuBar(); + if(%this.isMethod("removeFromMenuBar")) + %this.removeFromMenuBar(); } ////////////////////////////////////////////////////////////////////////// diff --git a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs index 82a14bea0..5db0e049d 100644 --- a/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs +++ b/Templates/BaseGame/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs @@ -28,33 +28,6 @@ function GuiEditorTreeView::init(%this) { - if( !isObject( %this.contextMenu ) ) - %this.contextMenu = new PopupMenu() - { - superClass = "MenuBuilder"; - isPopup = true; - - item[ 0 ] = "Rename" TAB "" TAB "GuiEditorTreeView.showItemRenameCtrl( GuiEditorTreeView.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "GuiEditor.deleteControl( %this.object );"; - item[ 2 ] = "-"; - item[ 3 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); GuiEditorTreeView.update();"; - item[ 4 ] = "Hidden" TAB "" TAB "%this.object.setVisible( !%this.object.isVisible() ); GuiEditorTreeView.update();"; - item[ 5 ] = "-"; - item[ 6 ] = "Add New Controls Here" TAB "" TAB "GuiEditor.setCurrentAddSet( %this.object );"; - item[ 7 ] = "Add Child Controls to Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( %this.object, false );"; - item[ 8 ] = "Remove Child Controls from Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( %this.object, true );"; - - object = -1; - }; - - if( !isObject( %this.contextMenuMultiSel ) ) - %this.contextMenuMultiSel = new PopupMenu() - { - superClass = "MenuBuilder"; - isPopup = true; - - item[ 0 ] = "Delete" TAB "" TAB "GuiEditor.deleteSelection();"; - }; } //--------------------------------------------------------------------------------------------- @@ -113,12 +86,36 @@ function GuiEditorTreeView::onRightMouseDown( %this, %item, %pts, %obj ) { if( %this.getSelectedItemsCount() > 1 ) { - %popup = %this.contextMenuMultiSel; + %popup = new PopupMenu() + { + superClass = "MenuBuilder"; + isPopup = true; + object = -1; + }; + + %popup.item[ 0 ] = "Delete" TAB "" TAB "GuiEditor.deleteSelection();"; + + %popup.reloadItems(); %popup.showPopup( Canvas ); } else if( %obj ) { - %popup = %this.contextMenu; + %popup = new PopupMenu() + { + superClass = "MenuBuilder"; + isPopup = true; + object = %obj; + }; + + %popup.item[ 0 ] = "Rename" TAB "" TAB "GuiEditorTreeView.showItemRenameCtrl( GuiEditorTreeView.findItemByObjectId(" @ %popup.object @ ") );"; + %popup.item[ 1 ] = "Delete" TAB "" TAB "GuiEditor.deleteControl(" @ %popup.object @ ");"; + %popup.item[ 2 ] = "-"; + %popup.item[ 3 ] = "Locked" TAB "" TAB "%this.object.setLocked( !" @ %popup.object @ ".locked); GuiEditorTreeView.update();"; + %popup.item[ 4 ] = "Hidden" TAB "" TAB "%this.object.setVisible( !" @ %popup.object @ ".isVisible() ); GuiEditorTreeView.update();"; + %popup.item[ 5 ] = "-"; + %popup.item[ 6 ] = "Add New Controls Here" TAB "" TAB "GuiEditor.setCurrentAddSet( " @ %popup.object @ ");"; + %popup.item[ 7 ] = "Add Child Controls to Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( " @ %popup.object @ ", false );"; + %popup.item[ 8 ] = "Remove Child Controls from Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( " @ %popup.object @ ", true );"; %popup.checkItem( 3, %obj.locked ); %popup.checkItem( 4, !%obj.isVisible() ); @@ -127,7 +124,8 @@ function GuiEditorTreeView::onRightMouseDown( %this, %item, %pts, %obj ) %popup.enableItem( 7, %obj.getCount() > 0 ); %popup.enableItem( 8, %obj.getCount() > 0 ); - %popup.object = %obj; + %popup.reloadItems(); + %popup.showPopup( Canvas ); } } diff --git a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.cs b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.cs index 9675ac7c9..b9551c983 100644 --- a/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.cs +++ b/Templates/BaseGame/game/tools/shapeEditor/scripts/shapeEditor.ed.cs @@ -2733,7 +2733,7 @@ function ShapeEdDetailTree::onRightMouseUp( %this, %itemId, %mouse ) superClass = "MenuBuilder"; isPopup = "1"; - item[ 0 ] = "Hidden" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem( %this._objName, !%this._itemHidden );"; + item[ 0 ] = "Hidden" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem(" @ ShapeEdMeshPopup._objName @ ", !" @ ShapeEdMeshPopup @ "._itemHidden );"; item[ 1 ] = "-"; item[ 2 ] = "Hide all" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem( \"\", true );"; item[ 3 ] = "Show all" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem( \"\", false );"; diff --git a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs index 2d9e2ec53..50aac111b 100644 --- a/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs +++ b/Templates/BaseGame/game/tools/worldEditor/scripts/EditorGui.ed.cs @@ -1571,224 +1571,111 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) %haveLockAndHideEntries = true; //Set up the generic pop-up pre-emptively if we haven't already - if( !isObject( ETContextPopup ) ) + %popup = new PopupMenu() { - %popup = new PopupMenu( ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; - item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; - item[ 3 ] = "-"; - item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); EWorldEditor.syncGui();"; - item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( %this.object, !%this.object.hidden ); EWorldEditor.syncGui();"; - item[ 6 ] = "-"; - item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - - object = -1; - }; - } + superClass = "MenuBuilder"; + isPopup = "1"; + object = -1; + bookmark = -1; + }; - // Handle multi-selection. if( %this.getSelectedItemsCount() > 1 ) { - %popup = ETMultiSelectionContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETMultiSelectionContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Delete" TAB "" TAB "EditorMenuEditDelete();"; - item[ 1 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - }; + %popup.item[ 0 ] = "Delete" TAB "" TAB "EditorMenuEditDelete();"; + %popup.item[ 1 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; } - - // Open context menu if this is a CameraBookmark - else if( %obj.isMemberOfClass( "CameraBookmark" ) ) - { - %popup = ETCameraBookmarkContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETCameraBookmarkContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Go To Bookmark" TAB "" TAB "EditorGui.jumpToBookmark( %this.bookmark.getInternalName() );"; - - bookmark = -1; - }; - - ETCameraBookmarkContextPopup.bookmark = %obj; - } - - // Open context menu if this is set CameraBookmarks group. - else if( %obj.name $= "CameraBookmarks" ) - { - %popup = ETCameraBookmarksGroupContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETCameraBookmarksGroupContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Add Camera Bookmark" TAB "" TAB "EditorGui.addCameraBookmarkByGui();"; - }; - } - - else if(%obj.isMemberOfClass("Entity")) - { - %popup = EntityObjectPopup; - if(!isObject(EntityObjectPopup)) - { - %popup = new PopupMenu( EntityObjectPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; - item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; - item[ 3 ] = "-"; - item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( %this.object );"; - item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( %this.object );"; - item[ 6 ] = "-"; - item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - item[ 8 ] = "-"; - item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( %this.object );"; - item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, false );"; - item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, true );"; - item[ 12 ] = "-"; - item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( %this.object );"; - item[ 14 ] = "Duplicate Game Object" TAB "" TAB "EWorldEditor.duplicateGameObject( %this.object );"; - item[ 15 ] = "Show in Asset Browser" TAB "" TAB "EWorldEditor.showGameObjectInAssetBrowser( %this.object );"; - - object = -1; - }; - } - - if(!isObject(AssetDatabase.acquireAsset(%obj.gameObjectAsset))) - { - EntityObjectPopup.enableItem(13, true); - EntityObjectPopup.enableItem(14, false); - EntityObjectPopup.enableItem(15, false); - } - else - { - EntityObjectPopup.enableItem(13, false); - EntityObjectPopup.enableItem(14, true); - EntityObjectPopup.enableItem(15, true); - } - - %popup.object = %obj; - - %hasChildren = %obj.getCount() > 0; - %popup.enableItem( 10, %hasChildren ); - %popup.enableItem( 11, %hasChildren ); - - %haveObjectEntries = true; - %haveLockAndHideEntries = false; - } - - // Open context menu if this is a SimGroup - else if( !%obj.isMemberOfClass( "SceneObject" ) ) - { - %popup = ETSimGroupContextPopup; - if( !isObject( %popup ) ) - { - %popup = new PopupMenu( ETSimGroupContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; - item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; - item[ 3 ] = "-"; - item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( %this.object );"; - item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( %this.object );"; - item[ 6 ] = "-"; - item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - item[ 8 ] = "-"; - item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( %this.object );"; - item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, false );"; - item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, true );"; - - object = -1; - }; - } - - %popup.object = %obj; - - %hasChildren = %obj.getCount() > 0; - %popup.enableItem( 10, %hasChildren ); - %popup.enableItem( 11, %hasChildren ); - - %haveObjectEntries = true; - %haveLockAndHideEntries = false; - } - - // Specialized version for ConvexShapes. - else if( %obj.isMemberOfClass( "ConvexShape" ) ) - { - %popup = ETConvexShapeContextPopup; - if( !isObject( %popup ) ) - { - %popup = new PopupMenu( ETConvexShapeContextPopup : ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 8 ] = "-"; - item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );"; - item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );"; - item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );"; - item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );"; - }; - } - - %popup.object = %obj; - %haveObjectEntries = true; - } - - // Specialized version for polyhedral objects. - else if( %obj.isMemberOfClass( "Zone" ) || - %obj.isMemberOfClass( "Portal" ) || - %obj.isMemberOfClass( "OcclusionVolume" ) || - %obj.isMemberOfClass( "SFXSpace" ) ) - { - %popup = ETPolyObjectContextPopup; - if( !isObject( %popup ) ) - { - %popup = new PopupMenu( ETPolyObjectContextPopup : ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 8 ] = "-"; - item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();"; - }; - } - - %popup.object = %obj; - %haveObjectEntries = true; - } - - // Open generic context menu. else { - %popup = ETContextPopup; - - %popup.object = %obj; - %haveObjectEntries = true; + if( %obj.isMemberOfClass( "CameraBookmark" ) ) + { + %popup.bookmark = %obj; + + %popup.item[ 0 ] = "Go To Bookmark" TAB "" TAB "EditorGui.jumpToBookmark( " @ %popup.bookmark.getInternalName() @ " );"; + } + else if( %obj.name $= "CameraBookmarks" ) + { + %popup.item[ 0 ] = "Add Camera Bookmark" TAB "" TAB "EditorGui.addCameraBookmarkByGui();"; + } + else + { + %popup.object = %obj; + %haveObjectEntries = true; + + %popup.item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId(" @ %popup.object @ ") );"; + %popup.item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject(" @ %popup.object @ ");"; + %popup.item[ 2 ] = "Inspect" TAB "" TAB "inspectObject(" @ %popup.object @ ");"; + %popup.item[ 3 ] = "-"; + %popup.item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !" @ %popup.object @ ".locked ); EWorldEditor.syncGui();"; + %popup.item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( " @ %popup.object @ ", !" @ %popup.object @ ".hidden ); EWorldEditor.syncGui();"; + %popup.item[ 6 ] = "-"; + %popup.item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; + + if( %obj.isMemberOfClass( "ConvexShape" ) ) + { + %popup.item[ 8 ] = "-"; + %popup.item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );"; + %popup.item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );"; + %popup.item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );"; + %popup.item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );"; + } + else if( %obj.isMemberOfClass( "Zone" ) || + %obj.isMemberOfClass( "Portal" ) || + %obj.isMemberOfClass( "OcclusionVolume" ) || + %obj.isMemberOfClass( "SFXSpace" ) ) + { + %popup.item[ 8 ] = "-"; + %popup.item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();"; + } + else if(%obj.getClassName() $= "SimGroup" || + %obj.isMemberOfClass( "Path" ) || + %obj.isMemberOfClass("Entity") ) + { + //If it's not any special-handle classes above, then it'll be group-based stuff here + %popup.item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( " @ %popup.object @ " );"; + %popup.item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( " @ %popup.object @ " );"; + + %popup.item[ 8 ] = "-"; + %popup.item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( " @ %popup.object @ " );"; + %popup.item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( " @ %popup.object @ ", false );"; + %popup.item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( " @ %popup.object @ ", true );"; + + %hasChildren = %obj.getCount() > 0; + %popup.enableItem( 10, %hasChildren ); + %popup.enableItem( 11, %hasChildren ); + + %haveObjectEntries = true; + %haveLockAndHideEntries = false; + + //Special case for Entities, which is special-case AND does group stuff with chld objects + if(%obj.isMemberOfClass("Entity")) + { + %popup.item[ 12 ] = "-"; + %popup.item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( " @ %popup.object @ " );"; + %popup.item[ 14 ] = "Duplicate Game Object" TAB "" TAB "EWorldEditor.duplicateGameObject( " @ %popup.object @ " );"; + %popup.item[ 15 ] = "Show in Asset Browser" TAB "" TAB "EWorldEditor.showGameObjectInAssetBrowser( " @ %popup.object @ " );"; + + if(!isObject(AssetDatabase.acquireAsset(%obj.gameObjectAsset))) + { + %popup.enableItem(13, true); + %popup.enableItem(14, false); + %popup.enableItem(15, false); + } + else + { + %popup.enableItem(13, false); + %popup.enableItem(14, true); + %popup.enableItem(15, true); + } + } + } + } } if( %haveObjectEntries ) { %popup.enableItem( 0, %obj.isNameChangeAllowed() && %obj.getName() !$= "MissionGroup" ); %popup.enableItem( 1, %obj.getName() !$= "MissionGroup" ); + if( %haveLockAndHideEntries ) { %popup.checkItem( 4, %obj.locked ); @@ -1797,6 +1684,7 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) %popup.enableItem( 7, %this.isItemSelected( %itemId ) ); } + %popup.reloadItems(); %popup.showPopup( Canvas ); } diff --git a/Templates/Full/game/tools/base/menuBar/menuBuilder.ed.cs b/Templates/Full/game/tools/base/menuBar/menuBuilder.ed.cs index 11d66b2ed..183eef7eb 100644 --- a/Templates/Full/game/tools/base/menuBar/menuBuilder.ed.cs +++ b/Templates/Full/game/tools/base/menuBar/menuBuilder.ed.cs @@ -152,9 +152,20 @@ function MenuBuilder::onAdd(%this) } } +function MenuBuilder::reloadItems(%this) +{ + %this.clearItems(); + + for(%i = 0;%this.item[%i] !$= "";%i++) + { + %this.addItem(%i); + } +} + function MenuBuilder::onRemove(%this) { - %this.removeFromMenuBar(); + if(%this.isMethod("removeFromMenuBar")) + %this.removeFromMenuBar(); } ////////////////////////////////////////////////////////////////////////// diff --git a/Templates/Full/game/tools/guiEditor/scripts/guiEditor.ed.cs b/Templates/Full/game/tools/guiEditor/scripts/guiEditor.ed.cs index 61dc8c5e7..e68c2e3db 100644 --- a/Templates/Full/game/tools/guiEditor/scripts/guiEditor.ed.cs +++ b/Templates/Full/game/tools/guiEditor/scripts/guiEditor.ed.cs @@ -223,7 +223,7 @@ function GuiEditor::switchToWorldEditor( %this ) function GuiEditor::enableMenuItems(%this, %val) { - %menu = GuiEditCanvas.menuBar->EditMenu.getID(); + %menu = GuiEditCanvas.menuBar.findMenu("Edit").getID(); %menu.enableItem( 3, %val ); // cut %menu.enableItem( 4, %val ); // copy @@ -239,8 +239,8 @@ function GuiEditor::enableMenuItems(%this, %val) %menu.enableItem( 18, %val ); // group %menu.enableItem( 19, %val ); // ungroup - GuiEditCanvas.menuBar->LayoutMenu.enableAllItems( %val ); - GuiEditCanvas.menuBar->MoveMenu.enableAllItems( %val ); + GuiEditCanvas.menuBar.findMenu("Layout").enableAllItems( %val ); + GuiEditCanvas.menuBar.findMenu("Move").enableAllItems( %val ); } //--------------------------------------------------------------------------------------------- @@ -294,7 +294,7 @@ function GuiEditor::updateUndoMenu(%this) %nextUndo = %uman.getNextUndoName(); %nextRedo = %uman.getNextRedoName(); - %editMenu = GuiEditCanvas.menuBar->editMenu; + %editMenu = GuiEditCanvas.menuBar.findMenu("Edit"); %editMenu.setItemName( 0, "Undo " @ %nextUndo ); %editMenu.setItemName( 1, "Redo " @ %nextRedo ); @@ -443,7 +443,7 @@ function GuiEditor::setPreviewResolution( %this, %width, %height ) function GuiEditor::toggleEdgeSnap( %this ) { %this.snapToEdges = !%this.snapToEdges; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, %this.snapToEdges ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, %this.snapToEdges ); GuiEditorEdgeSnapping_btn.setStateOn( %this.snapToEdges ); } @@ -452,7 +452,7 @@ function GuiEditor::toggleEdgeSnap( %this ) function GuiEditor::toggleCenterSnap( %this ) { %this.snapToCenters = !%this.snapToCenters; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, %this.snapToCenters ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, %this.snapToCenters ); GuiEditorCenterSnapping_btn.setStateOn( %this.snapToCenters ); } @@ -461,7 +461,7 @@ function GuiEditor::toggleCenterSnap( %this ) function GuiEditor::toggleFullBoxSelection( %this ) { %this.fullBoxSelection = !%this.fullBoxSelection; - GuiEditCanvas.menuBar->EditMenu.checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, %this.fullBoxSelection ); + GuiEditCanvas.menuBar.findMenu("Edit").checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, %this.fullBoxSelection ); } //--------------------------------------------------------------------------------------------- @@ -469,7 +469,7 @@ function GuiEditor::toggleFullBoxSelection( %this ) function GuiEditor::toggleDrawGuides( %this ) { %this.drawGuides= !%this.drawGuides; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, %this.drawGuides ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, %this.drawGuides ); } //--------------------------------------------------------------------------------------------- @@ -477,7 +477,7 @@ function GuiEditor::toggleDrawGuides( %this ) function GuiEditor::toggleGuideSnap( %this ) { %this.snapToGuides = !%this.snapToGuides; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, %this.snapToGuides ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, %this.snapToGuides ); } //--------------------------------------------------------------------------------------------- @@ -485,7 +485,7 @@ function GuiEditor::toggleGuideSnap( %this ) function GuiEditor::toggleControlSnap( %this ) { %this.snapToControls = !%this.snapToControls; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, %this.snapToControls ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, %this.snapToControls ); } //--------------------------------------------------------------------------------------------- @@ -493,7 +493,7 @@ function GuiEditor::toggleControlSnap( %this ) function GuiEditor::toggleCanvasSnap( %this ) { %this.snapToCanvas = !%this.snapToCanvas; - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, %this.snapToCanvas ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, %this.snapToCanvas ); } //--------------------------------------------------------------------------------------------- @@ -506,7 +506,7 @@ function GuiEditor::toggleGridSnap( %this ) else %this.setSnapToGrid( %this.snap2GridSize ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, %this.snap2Grid ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, %this.snap2Grid ); GuiEditorSnapCheckBox.setStateOn( %this.snap2Grid ); } @@ -993,14 +993,14 @@ function GuiEditorGui::onWake( %this ) // Set up initial menu toggle states. - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, GuiEditor.snapToEdges ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, GuiEditor.snapToCenters ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, GuiEditor.snapToGuides ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, GuiEditor.snapToControls ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, GuiEditor.snapToCanvas ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, GuiEditor.snap2Grid ); - GuiEditCanvas.menuBar->SnapMenu.checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, GuiEditor.drawGuides ); - GuiEditCanvas.menuBar->EditMenu.checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, GuiEditor.fullBoxSelection ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_EDGESNAP_INDEX, GuiEditor.snapToEdges ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CENTERSNAP_INDEX, GuiEditor.snapToCenters ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GUIDESNAP_INDEX, GuiEditor.snapToGuides ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CONTROLSNAP_INDEX, GuiEditor.snapToControls ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_CANVASSNAP_INDEX, GuiEditor.snapToCanvas ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_GRIDSNAP_INDEX, GuiEditor.snap2Grid ); + GuiEditCanvas.menuBar.findMenu("Snap").checkItem( $GUI_EDITOR_MENU_DRAWGUIDES_INDEX, GuiEditor.drawGuides ); + GuiEditCanvas.menuBar.findMenu("Edit").checkItem( $GUI_EDITOR_MENU_FULLBOXSELECT_INDEX, GuiEditor.fullBoxSelection ); // Sync toolbar buttons. diff --git a/Templates/Full/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs b/Templates/Full/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs index 82a14bea0..5db0e049d 100644 --- a/Templates/Full/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs +++ b/Templates/Full/game/tools/guiEditor/scripts/guiEditorTreeView.ed.cs @@ -28,33 +28,6 @@ function GuiEditorTreeView::init(%this) { - if( !isObject( %this.contextMenu ) ) - %this.contextMenu = new PopupMenu() - { - superClass = "MenuBuilder"; - isPopup = true; - - item[ 0 ] = "Rename" TAB "" TAB "GuiEditorTreeView.showItemRenameCtrl( GuiEditorTreeView.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "GuiEditor.deleteControl( %this.object );"; - item[ 2 ] = "-"; - item[ 3 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); GuiEditorTreeView.update();"; - item[ 4 ] = "Hidden" TAB "" TAB "%this.object.setVisible( !%this.object.isVisible() ); GuiEditorTreeView.update();"; - item[ 5 ] = "-"; - item[ 6 ] = "Add New Controls Here" TAB "" TAB "GuiEditor.setCurrentAddSet( %this.object );"; - item[ 7 ] = "Add Child Controls to Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( %this.object, false );"; - item[ 8 ] = "Remove Child Controls from Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( %this.object, true );"; - - object = -1; - }; - - if( !isObject( %this.contextMenuMultiSel ) ) - %this.contextMenuMultiSel = new PopupMenu() - { - superClass = "MenuBuilder"; - isPopup = true; - - item[ 0 ] = "Delete" TAB "" TAB "GuiEditor.deleteSelection();"; - }; } //--------------------------------------------------------------------------------------------- @@ -113,12 +86,36 @@ function GuiEditorTreeView::onRightMouseDown( %this, %item, %pts, %obj ) { if( %this.getSelectedItemsCount() > 1 ) { - %popup = %this.contextMenuMultiSel; + %popup = new PopupMenu() + { + superClass = "MenuBuilder"; + isPopup = true; + object = -1; + }; + + %popup.item[ 0 ] = "Delete" TAB "" TAB "GuiEditor.deleteSelection();"; + + %popup.reloadItems(); %popup.showPopup( Canvas ); } else if( %obj ) { - %popup = %this.contextMenu; + %popup = new PopupMenu() + { + superClass = "MenuBuilder"; + isPopup = true; + object = %obj; + }; + + %popup.item[ 0 ] = "Rename" TAB "" TAB "GuiEditorTreeView.showItemRenameCtrl( GuiEditorTreeView.findItemByObjectId(" @ %popup.object @ ") );"; + %popup.item[ 1 ] = "Delete" TAB "" TAB "GuiEditor.deleteControl(" @ %popup.object @ ");"; + %popup.item[ 2 ] = "-"; + %popup.item[ 3 ] = "Locked" TAB "" TAB "%this.object.setLocked( !" @ %popup.object @ ".locked); GuiEditorTreeView.update();"; + %popup.item[ 4 ] = "Hidden" TAB "" TAB "%this.object.setVisible( !" @ %popup.object @ ".isVisible() ); GuiEditorTreeView.update();"; + %popup.item[ 5 ] = "-"; + %popup.item[ 6 ] = "Add New Controls Here" TAB "" TAB "GuiEditor.setCurrentAddSet( " @ %popup.object @ ");"; + %popup.item[ 7 ] = "Add Child Controls to Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( " @ %popup.object @ ", false );"; + %popup.item[ 8 ] = "Remove Child Controls from Selection" TAB "" TAB "GuiEditor.selectAllControlsInSet( " @ %popup.object @ ", true );"; %popup.checkItem( 3, %obj.locked ); %popup.checkItem( 4, !%obj.isVisible() ); @@ -127,7 +124,8 @@ function GuiEditorTreeView::onRightMouseDown( %this, %item, %pts, %obj ) %popup.enableItem( 7, %obj.getCount() > 0 ); %popup.enableItem( 8, %obj.getCount() > 0 ); - %popup.object = %obj; + %popup.reloadItems(); + %popup.showPopup( Canvas ); } } diff --git a/Templates/Full/game/tools/shapeEditor/scripts/shapeEditor.ed.cs b/Templates/Full/game/tools/shapeEditor/scripts/shapeEditor.ed.cs index d79923776..a62605821 100644 --- a/Templates/Full/game/tools/shapeEditor/scripts/shapeEditor.ed.cs +++ b/Templates/Full/game/tools/shapeEditor/scripts/shapeEditor.ed.cs @@ -2719,7 +2719,7 @@ function ShapeEdDetailTree::onRightMouseUp( %this, %itemId, %mouse ) superClass = "MenuBuilder"; isPopup = "1"; - item[ 0 ] = "Hidden" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem( %this._objName, !%this._itemHidden );"; + item[ 0 ] = "Hidden" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem(" @ ShapeEdMeshPopup._objName @ ", !" @ ShapeEdMeshPopup @ "._itemHidden );"; item[ 1 ] = "-"; item[ 2 ] = "Hide all" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem( \"\", true );"; item[ 3 ] = "Show all" TAB "" TAB "ShapeEdDetailTree.onHideMeshItem( \"\", false );"; diff --git a/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs b/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs index 2d9e2ec53..50aac111b 100644 --- a/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs +++ b/Templates/Full/game/tools/worldEditor/scripts/EditorGui.ed.cs @@ -1571,224 +1571,111 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) %haveLockAndHideEntries = true; //Set up the generic pop-up pre-emptively if we haven't already - if( !isObject( ETContextPopup ) ) + %popup = new PopupMenu() { - %popup = new PopupMenu( ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; - item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; - item[ 3 ] = "-"; - item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !%this.object.locked ); EWorldEditor.syncGui();"; - item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( %this.object, !%this.object.hidden ); EWorldEditor.syncGui();"; - item[ 6 ] = "-"; - item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - - object = -1; - }; - } + superClass = "MenuBuilder"; + isPopup = "1"; + object = -1; + bookmark = -1; + }; - // Handle multi-selection. if( %this.getSelectedItemsCount() > 1 ) { - %popup = ETMultiSelectionContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETMultiSelectionContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Delete" TAB "" TAB "EditorMenuEditDelete();"; - item[ 1 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - }; + %popup.item[ 0 ] = "Delete" TAB "" TAB "EditorMenuEditDelete();"; + %popup.item[ 1 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; } - - // Open context menu if this is a CameraBookmark - else if( %obj.isMemberOfClass( "CameraBookmark" ) ) - { - %popup = ETCameraBookmarkContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETCameraBookmarkContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Go To Bookmark" TAB "" TAB "EditorGui.jumpToBookmark( %this.bookmark.getInternalName() );"; - - bookmark = -1; - }; - - ETCameraBookmarkContextPopup.bookmark = %obj; - } - - // Open context menu if this is set CameraBookmarks group. - else if( %obj.name $= "CameraBookmarks" ) - { - %popup = ETCameraBookmarksGroupContextPopup; - if( !isObject( %popup ) ) - %popup = new PopupMenu( ETCameraBookmarksGroupContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Add Camera Bookmark" TAB "" TAB "EditorGui.addCameraBookmarkByGui();"; - }; - } - - else if(%obj.isMemberOfClass("Entity")) - { - %popup = EntityObjectPopup; - if(!isObject(EntityObjectPopup)) - { - %popup = new PopupMenu( EntityObjectPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; - item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; - item[ 3 ] = "-"; - item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( %this.object );"; - item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( %this.object );"; - item[ 6 ] = "-"; - item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - item[ 8 ] = "-"; - item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( %this.object );"; - item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, false );"; - item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, true );"; - item[ 12 ] = "-"; - item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( %this.object );"; - item[ 14 ] = "Duplicate Game Object" TAB "" TAB "EWorldEditor.duplicateGameObject( %this.object );"; - item[ 15 ] = "Show in Asset Browser" TAB "" TAB "EWorldEditor.showGameObjectInAssetBrowser( %this.object );"; - - object = -1; - }; - } - - if(!isObject(AssetDatabase.acquireAsset(%obj.gameObjectAsset))) - { - EntityObjectPopup.enableItem(13, true); - EntityObjectPopup.enableItem(14, false); - EntityObjectPopup.enableItem(15, false); - } - else - { - EntityObjectPopup.enableItem(13, false); - EntityObjectPopup.enableItem(14, true); - EntityObjectPopup.enableItem(15, true); - } - - %popup.object = %obj; - - %hasChildren = %obj.getCount() > 0; - %popup.enableItem( 10, %hasChildren ); - %popup.enableItem( 11, %hasChildren ); - - %haveObjectEntries = true; - %haveLockAndHideEntries = false; - } - - // Open context menu if this is a SimGroup - else if( !%obj.isMemberOfClass( "SceneObject" ) ) - { - %popup = ETSimGroupContextPopup; - if( !isObject( %popup ) ) - { - %popup = new PopupMenu( ETSimGroupContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId( %this.object ) );"; - item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject( %this.object );"; - item[ 2 ] = "Inspect" TAB "" TAB "inspectObject( %this.object );"; - item[ 3 ] = "-"; - item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( %this.object );"; - item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( %this.object );"; - item[ 6 ] = "-"; - item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; - item[ 8 ] = "-"; - item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( %this.object );"; - item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, false );"; - item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( %this.object, true );"; - - object = -1; - }; - } - - %popup.object = %obj; - - %hasChildren = %obj.getCount() > 0; - %popup.enableItem( 10, %hasChildren ); - %popup.enableItem( 11, %hasChildren ); - - %haveObjectEntries = true; - %haveLockAndHideEntries = false; - } - - // Specialized version for ConvexShapes. - else if( %obj.isMemberOfClass( "ConvexShape" ) ) - { - %popup = ETConvexShapeContextPopup; - if( !isObject( %popup ) ) - { - %popup = new PopupMenu( ETConvexShapeContextPopup : ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 8 ] = "-"; - item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );"; - item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );"; - item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );"; - item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );"; - }; - } - - %popup.object = %obj; - %haveObjectEntries = true; - } - - // Specialized version for polyhedral objects. - else if( %obj.isMemberOfClass( "Zone" ) || - %obj.isMemberOfClass( "Portal" ) || - %obj.isMemberOfClass( "OcclusionVolume" ) || - %obj.isMemberOfClass( "SFXSpace" ) ) - { - %popup = ETPolyObjectContextPopup; - if( !isObject( %popup ) ) - { - %popup = new PopupMenu( ETPolyObjectContextPopup : ETContextPopup ) - { - superClass = "MenuBuilder"; - isPopup = "1"; - - item[ 8 ] = "-"; - item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();"; - }; - } - - %popup.object = %obj; - %haveObjectEntries = true; - } - - // Open generic context menu. else { - %popup = ETContextPopup; - - %popup.object = %obj; - %haveObjectEntries = true; + if( %obj.isMemberOfClass( "CameraBookmark" ) ) + { + %popup.bookmark = %obj; + + %popup.item[ 0 ] = "Go To Bookmark" TAB "" TAB "EditorGui.jumpToBookmark( " @ %popup.bookmark.getInternalName() @ " );"; + } + else if( %obj.name $= "CameraBookmarks" ) + { + %popup.item[ 0 ] = "Add Camera Bookmark" TAB "" TAB "EditorGui.addCameraBookmarkByGui();"; + } + else + { + %popup.object = %obj; + %haveObjectEntries = true; + + %popup.item[ 0 ] = "Rename" TAB "" TAB "EditorTree.showItemRenameCtrl( EditorTree.findItemByObjectId(" @ %popup.object @ ") );"; + %popup.item[ 1 ] = "Delete" TAB "" TAB "EWorldEditor.deleteMissionObject(" @ %popup.object @ ");"; + %popup.item[ 2 ] = "Inspect" TAB "" TAB "inspectObject(" @ %popup.object @ ");"; + %popup.item[ 3 ] = "-"; + %popup.item[ 4 ] = "Locked" TAB "" TAB "%this.object.setLocked( !" @ %popup.object @ ".locked ); EWorldEditor.syncGui();"; + %popup.item[ 5 ] = "Hidden" TAB "" TAB "EWorldEditor.hideObject( " @ %popup.object @ ", !" @ %popup.object @ ".hidden ); EWorldEditor.syncGui();"; + %popup.item[ 6 ] = "-"; + %popup.item[ 7 ] = "Group" TAB "" TAB "EWorldEditor.addSimGroup( true );"; + + if( %obj.isMemberOfClass( "ConvexShape" ) ) + { + %popup.item[ 8 ] = "-"; + %popup.item[ 9 ] = "Convert to Zone" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Zone\" );"; + %popup.item[ 10 ] = "Convert to Portal" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"Portal\" );"; + %popup.item[ 11 ] = "Convert to Occluder" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"OcclusionVolume\" );"; + %popup.item[ 12 ] = "Convert to Sound Space" TAB "" TAB "EWorldEditor.convertSelectionToPolyhedralObjects( \"SFXSpace\" );"; + } + else if( %obj.isMemberOfClass( "Zone" ) || + %obj.isMemberOfClass( "Portal" ) || + %obj.isMemberOfClass( "OcclusionVolume" ) || + %obj.isMemberOfClass( "SFXSpace" ) ) + { + %popup.item[ 8 ] = "-"; + %popup.item[ 9 ] = "Convert to ConvexShape" TAB "" TAB "EWorldEditor.convertSelectionToConvexShape();"; + } + else if(%obj.getClassName() $= "SimGroup" || + %obj.isMemberOfClass( "Path" ) || + %obj.isMemberOfClass("Entity") ) + { + //If it's not any special-handle classes above, then it'll be group-based stuff here + %popup.item[ 4 ] = "Toggle Lock Children" TAB "" TAB "EWorldEditor.toggleLockChildren( " @ %popup.object @ " );"; + %popup.item[ 5 ] = "Toggle Hide Children" TAB "" TAB "EWorldEditor.toggleHideChildren( " @ %popup.object @ " );"; + + %popup.item[ 8 ] = "-"; + %popup.item[ 9 ] = "Add New Objects Here" TAB "" TAB "EWCreatorWindow.setNewObjectGroup( " @ %popup.object @ " );"; + %popup.item[ 10 ] = "Add Children to Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( " @ %popup.object @ ", false );"; + %popup.item[ 11 ] = "Remove Children from Selection" TAB "" TAB "EWorldEditor.selectAllObjectsInSet( " @ %popup.object @ ", true );"; + + %hasChildren = %obj.getCount() > 0; + %popup.enableItem( 10, %hasChildren ); + %popup.enableItem( 11, %hasChildren ); + + %haveObjectEntries = true; + %haveLockAndHideEntries = false; + + //Special case for Entities, which is special-case AND does group stuff with chld objects + if(%obj.isMemberOfClass("Entity")) + { + %popup.item[ 12 ] = "-"; + %popup.item[ 13 ] = "Convert to Game Object" TAB "" TAB "EWorldEditor.createGameObject( " @ %popup.object @ " );"; + %popup.item[ 14 ] = "Duplicate Game Object" TAB "" TAB "EWorldEditor.duplicateGameObject( " @ %popup.object @ " );"; + %popup.item[ 15 ] = "Show in Asset Browser" TAB "" TAB "EWorldEditor.showGameObjectInAssetBrowser( " @ %popup.object @ " );"; + + if(!isObject(AssetDatabase.acquireAsset(%obj.gameObjectAsset))) + { + %popup.enableItem(13, true); + %popup.enableItem(14, false); + %popup.enableItem(15, false); + } + else + { + %popup.enableItem(13, false); + %popup.enableItem(14, true); + %popup.enableItem(15, true); + } + } + } + } } if( %haveObjectEntries ) { %popup.enableItem( 0, %obj.isNameChangeAllowed() && %obj.getName() !$= "MissionGroup" ); %popup.enableItem( 1, %obj.getName() !$= "MissionGroup" ); + if( %haveLockAndHideEntries ) { %popup.checkItem( 4, %obj.locked ); @@ -1797,6 +1684,7 @@ function EditorTree::onRightMouseUp( %this, %itemId, %mouse, %obj ) %popup.enableItem( 7, %this.isItemSelected( %itemId ) ); } + %popup.reloadItems(); %popup.showPopup( Canvas ); } From 925d8b27cf4938ed90a341f46fee90024787dbbc Mon Sep 17 00:00:00 2001 From: rextimmy Date: Wed, 9 May 2018 20:48:18 +1000 Subject: [PATCH 121/144] openal-soft updates --- Engine/lib/openal-soft/.gitignore | 10 +- Engine/lib/openal-soft/.travis.yml | 69 +- Engine/lib/openal-soft/Alc/ALc.c | 2383 ++++++++++------ Engine/lib/openal-soft/Alc/ALu.c | 2424 +++++++++------- Engine/lib/openal-soft/Alc/alcRing.c | 301 -- .../Alc/{alcConfig.c => alconfig.c} | 179 +- Engine/lib/openal-soft/Alc/alconfig.h | 17 + Engine/lib/openal-soft/Alc/alstring.h | 45 +- Engine/lib/openal-soft/Alc/ambdec.c | 33 +- Engine/lib/openal-soft/Alc/ambdec.h | 2 +- Engine/lib/openal-soft/Alc/backends/alsa.c | 178 +- Engine/lib/openal-soft/Alc/backends/base.c | 176 +- Engine/lib/openal-soft/Alc/backends/base.h | 25 +- .../lib/openal-soft/Alc/backends/coreaudio.c | 552 ++-- Engine/lib/openal-soft/Alc/backends/dsound.c | 336 +-- Engine/lib/openal-soft/Alc/backends/jack.c | 146 +- .../lib/openal-soft/Alc/backends/loopback.c | 7 +- Engine/lib/openal-soft/Alc/backends/null.c | 22 +- Engine/lib/openal-soft/Alc/backends/opensl.c | 1002 +++++-- Engine/lib/openal-soft/Alc/backends/oss.c | 329 ++- .../lib/openal-soft/Alc/backends/portaudio.c | 49 +- .../lib/openal-soft/Alc/backends/pulseaudio.c | 332 ++- Engine/lib/openal-soft/Alc/backends/qsa.c | 381 ++- Engine/lib/openal-soft/Alc/backends/sdl2.c | 287 ++ Engine/lib/openal-soft/Alc/backends/sndio.c | 216 +- Engine/lib/openal-soft/Alc/backends/solaris.c | 103 +- .../Alc/backends/{mmdevapi.c => wasapi.c} | 777 ++--- Engine/lib/openal-soft/Alc/backends/wave.c | 71 +- Engine/lib/openal-soft/Alc/backends/winmm.c | 139 +- Engine/lib/openal-soft/Alc/bformatdec.c | 544 ++-- Engine/lib/openal-soft/Alc/bformatdec.h | 60 +- Engine/lib/openal-soft/Alc/bs2b.c | 8 +- Engine/lib/openal-soft/Alc/bsinc.c | 981 ------- Engine/lib/openal-soft/Alc/compat.h | 18 +- Engine/lib/openal-soft/Alc/converter.c | 468 +++ Engine/lib/openal-soft/Alc/converter.h | 55 + Engine/lib/openal-soft/Alc/cpu_caps.h | 15 + Engine/lib/openal-soft/Alc/effects/chorus.c | 461 +-- .../lib/openal-soft/Alc/effects/compressor.c | 72 +- .../lib/openal-soft/Alc/effects/dedicated.c | 109 +- .../lib/openal-soft/Alc/effects/distortion.c | 203 +- Engine/lib/openal-soft/Alc/effects/echo.c | 198 +- .../lib/openal-soft/Alc/effects/equalizer.c | 247 +- Engine/lib/openal-soft/Alc/effects/flanger.c | 411 --- .../lib/openal-soft/Alc/effects/modulator.c | 180 +- Engine/lib/openal-soft/Alc/effects/null.c | 74 +- Engine/lib/openal-soft/Alc/effects/pshifter.c | 526 ++++ Engine/lib/openal-soft/Alc/effects/reverb.c | 2500 +++++++++-------- Engine/lib/openal-soft/Alc/filters/defs.h | 112 + Engine/lib/openal-soft/Alc/filters/filter.c | 129 + Engine/lib/openal-soft/Alc/filters/nfc.c | 426 +++ Engine/lib/openal-soft/Alc/filters/nfc.h | 49 + Engine/lib/openal-soft/Alc/filters/splitter.c | 109 + Engine/lib/openal-soft/Alc/filters/splitter.h | 40 + Engine/lib/openal-soft/Alc/fpu_modes.h | 34 + Engine/lib/openal-soft/Alc/helpers.c | 527 ++-- Engine/lib/openal-soft/Alc/hrtf.c | 1395 +++++---- Engine/lib/openal-soft/Alc/hrtf.h | 95 +- Engine/lib/openal-soft/Alc/hrtf_res.h | 5 - Engine/lib/openal-soft/Alc/hrtf_res.rc | 4 - Engine/lib/openal-soft/Alc/inprogext.h | 79 + Engine/lib/openal-soft/Alc/logging.h | 69 + Engine/lib/openal-soft/Alc/mastering.c | 232 ++ Engine/lib/openal-soft/Alc/mastering.h | 57 + Engine/lib/openal-soft/Alc/mixer.c | 702 ----- Engine/lib/openal-soft/Alc/mixer/defs.h | 119 + Engine/lib/openal-soft/Alc/mixer/hrtf_inc.c | 123 + Engine/lib/openal-soft/Alc/mixer/mixer_c.c | 176 ++ Engine/lib/openal-soft/Alc/mixer/mixer_neon.c | 269 ++ .../openal-soft/Alc/{ => mixer}/mixer_sse.c | 164 +- .../openal-soft/Alc/{ => mixer}/mixer_sse2.c | 18 +- Engine/lib/openal-soft/Alc/mixer/mixer_sse3.c | 0 .../lib/openal-soft/Alc/mixer/mixer_sse41.c | 88 + Engine/lib/openal-soft/Alc/mixer_c.c | 228 -- Engine/lib/openal-soft/Alc/mixer_defs.h | 110 - Engine/lib/openal-soft/Alc/mixer_inc.c | 149 - Engine/lib/openal-soft/Alc/mixer_neon.c | 173 -- Engine/lib/openal-soft/Alc/mixer_sse3.c | 164 -- Engine/lib/openal-soft/Alc/mixer_sse41.c | 227 -- Engine/lib/openal-soft/Alc/mixvoice.c | 761 +++++ Engine/lib/openal-soft/Alc/panning.c | 908 +++--- Engine/lib/openal-soft/Alc/polymorphism.h | 105 + Engine/lib/openal-soft/Alc/ringbuffer.c | 295 ++ Engine/lib/openal-soft/Alc/ringbuffer.h | 77 + Engine/lib/openal-soft/Alc/uhjfilter.c | 90 +- Engine/lib/openal-soft/Alc/uhjfilter.h | 11 +- Engine/lib/openal-soft/Alc/vector.h | 24 +- Engine/lib/openal-soft/CMakeLists.txt | 967 ++++--- Engine/lib/openal-soft/ChangeLog | 165 ++ .../OpenAL32/Include/alAuxEffectSlot.h | 114 +- .../openal-soft/OpenAL32/Include/alBuffer.h | 109 +- .../openal-soft/OpenAL32/Include/alEffect.h | 78 +- .../openal-soft/OpenAL32/Include/alError.h | 22 +- .../openal-soft/OpenAL32/Include/alFilter.h | 146 +- .../openal-soft/OpenAL32/Include/alListener.h | 49 +- .../lib/openal-soft/OpenAL32/Include/alMain.h | 909 +++--- .../openal-soft/OpenAL32/Include/alSource.h | 153 +- .../openal-soft/OpenAL32/Include/alThunk.h | 20 - Engine/lib/openal-soft/OpenAL32/Include/alu.h | 379 ++- .../lib/openal-soft/OpenAL32/Include/bs2b.h | 2 +- .../openal-soft/OpenAL32/Include/sample_cvt.h | 8 +- .../openal-soft/OpenAL32/alAuxEffectSlot.c | 517 ++-- Engine/lib/openal-soft/OpenAL32/alBuffer.c | 1334 ++++----- Engine/lib/openal-soft/OpenAL32/alEffect.c | 312 +- Engine/lib/openal-soft/OpenAL32/alError.c | 54 +- Engine/lib/openal-soft/OpenAL32/alExtension.c | 20 +- Engine/lib/openal-soft/OpenAL32/alFilter.c | 534 ++-- Engine/lib/openal-soft/OpenAL32/alListener.c | 253 +- Engine/lib/openal-soft/OpenAL32/alSource.c | 2322 ++++++++------- Engine/lib/openal-soft/OpenAL32/alState.c | 387 ++- Engine/lib/openal-soft/OpenAL32/alThunk.c | 105 - Engine/lib/openal-soft/OpenAL32/event.c | 140 + Engine/lib/openal-soft/OpenAL32/sample_cvt.c | 968 +------ Engine/lib/openal-soft/README | 55 - Engine/lib/openal-soft/README.md | 61 + Engine/lib/openal-soft/alsoftrc.sample | 110 +- Engine/lib/openal-soft/appveyor.yml | 9 +- .../cmake/CheckSharedFunctionExists.cmake | 4 +- Engine/lib/openal-soft/cmake/FindDSound.cmake | 30 +- Engine/lib/openal-soft/cmake/FindFFmpeg.cmake | 6 + Engine/lib/openal-soft/cmake/FindOSS.cmake | 14 +- Engine/lib/openal-soft/cmake/FindSDL2.cmake | 20 +- .../openal-soft/cmake/FindWindowsSDK.cmake | 626 +++++ .../openal-soft/{include => common}/align.h | 0 Engine/lib/openal-soft/common/almalloc.c | 48 + Engine/lib/openal-soft/common/almalloc.h | 30 + Engine/lib/openal-soft/common/atomic.h | 439 +++ .../openal-soft/{include => common}/bool.h | 0 Engine/lib/openal-soft/common/math_defs.h | 46 + Engine/lib/openal-soft/common/rwlock.c | 20 +- .../openal-soft/{include => common}/rwlock.h | 9 +- .../{include => common}/static_assert.h | 0 Engine/lib/openal-soft/common/threads.c | 245 +- .../openal-soft/{include => common}/threads.h | 29 +- Engine/lib/openal-soft/common/uintmap.c | 138 +- .../openal-soft/{include => common}/uintmap.h | 18 +- Engine/lib/openal-soft/common/win_main_utf8.h | 97 + Engine/lib/openal-soft/config.h.in | 44 +- Engine/lib/openal-soft/include/AL/alext.h | 73 + Engine/lib/openal-soft/include/almalloc.h | 18 - Engine/lib/openal-soft/include/atomic.h | 317 --- Engine/lib/openal-soft/include/math_defs.h | 19 - .../openal-soft/native-tools/CMakeLists.txt | 29 + Engine/lib/openal-soft/native-tools/bin2h.c | 100 + .../lib/openal-soft/native-tools/bsincgen.c | 367 +++ Engine/lib/openal-soft/openal.pc.in | 1 + Engine/lib/openal-soft/version.cmake | 11 + Engine/lib/openal-soft/version.h.in | 8 + Tools/CMake/torque3d.cmake | 8 + 149 files changed, 22293 insertions(+), 16887 deletions(-) delete mode 100644 Engine/lib/openal-soft/Alc/alcRing.c rename Engine/lib/openal-soft/Alc/{alcConfig.c => alconfig.c} (70%) create mode 100644 Engine/lib/openal-soft/Alc/alconfig.h create mode 100644 Engine/lib/openal-soft/Alc/backends/sdl2.c rename Engine/lib/openal-soft/Alc/backends/{mmdevapi.c => wasapi.c} (67%) delete mode 100644 Engine/lib/openal-soft/Alc/bsinc.c create mode 100644 Engine/lib/openal-soft/Alc/converter.c create mode 100644 Engine/lib/openal-soft/Alc/converter.h create mode 100644 Engine/lib/openal-soft/Alc/cpu_caps.h delete mode 100644 Engine/lib/openal-soft/Alc/effects/flanger.c create mode 100644 Engine/lib/openal-soft/Alc/effects/pshifter.c create mode 100644 Engine/lib/openal-soft/Alc/filters/defs.h create mode 100644 Engine/lib/openal-soft/Alc/filters/filter.c create mode 100644 Engine/lib/openal-soft/Alc/filters/nfc.c create mode 100644 Engine/lib/openal-soft/Alc/filters/nfc.h create mode 100644 Engine/lib/openal-soft/Alc/filters/splitter.c create mode 100644 Engine/lib/openal-soft/Alc/filters/splitter.h create mode 100644 Engine/lib/openal-soft/Alc/fpu_modes.h delete mode 100644 Engine/lib/openal-soft/Alc/hrtf_res.h delete mode 100644 Engine/lib/openal-soft/Alc/hrtf_res.rc create mode 100644 Engine/lib/openal-soft/Alc/inprogext.h create mode 100644 Engine/lib/openal-soft/Alc/logging.h create mode 100644 Engine/lib/openal-soft/Alc/mastering.c create mode 100644 Engine/lib/openal-soft/Alc/mastering.h delete mode 100644 Engine/lib/openal-soft/Alc/mixer.c create mode 100644 Engine/lib/openal-soft/Alc/mixer/defs.h create mode 100644 Engine/lib/openal-soft/Alc/mixer/hrtf_inc.c create mode 100644 Engine/lib/openal-soft/Alc/mixer/mixer_c.c create mode 100644 Engine/lib/openal-soft/Alc/mixer/mixer_neon.c rename Engine/lib/openal-soft/Alc/{ => mixer}/mixer_sse.c (55%) rename Engine/lib/openal-soft/Alc/{ => mixer}/mixer_sse2.c (86%) create mode 100644 Engine/lib/openal-soft/Alc/mixer/mixer_sse3.c create mode 100644 Engine/lib/openal-soft/Alc/mixer/mixer_sse41.c delete mode 100644 Engine/lib/openal-soft/Alc/mixer_c.c delete mode 100644 Engine/lib/openal-soft/Alc/mixer_defs.h delete mode 100644 Engine/lib/openal-soft/Alc/mixer_inc.c delete mode 100644 Engine/lib/openal-soft/Alc/mixer_neon.c delete mode 100644 Engine/lib/openal-soft/Alc/mixer_sse3.c delete mode 100644 Engine/lib/openal-soft/Alc/mixer_sse41.c create mode 100644 Engine/lib/openal-soft/Alc/mixvoice.c create mode 100644 Engine/lib/openal-soft/Alc/polymorphism.h create mode 100644 Engine/lib/openal-soft/Alc/ringbuffer.c create mode 100644 Engine/lib/openal-soft/Alc/ringbuffer.h delete mode 100644 Engine/lib/openal-soft/OpenAL32/Include/alThunk.h delete mode 100644 Engine/lib/openal-soft/OpenAL32/alThunk.c create mode 100644 Engine/lib/openal-soft/OpenAL32/event.c delete mode 100644 Engine/lib/openal-soft/README create mode 100644 Engine/lib/openal-soft/README.md create mode 100644 Engine/lib/openal-soft/cmake/FindWindowsSDK.cmake rename Engine/lib/openal-soft/{include => common}/align.h (100%) create mode 100644 Engine/lib/openal-soft/common/almalloc.h create mode 100644 Engine/lib/openal-soft/common/atomic.h rename Engine/lib/openal-soft/{include => common}/bool.h (100%) create mode 100644 Engine/lib/openal-soft/common/math_defs.h rename Engine/lib/openal-soft/{include => common}/rwlock.h (67%) rename Engine/lib/openal-soft/{include => common}/static_assert.h (100%) rename Engine/lib/openal-soft/{include => common}/threads.h (83%) rename Engine/lib/openal-soft/{include => common}/uintmap.h (60%) create mode 100644 Engine/lib/openal-soft/common/win_main_utf8.h delete mode 100644 Engine/lib/openal-soft/include/almalloc.h delete mode 100644 Engine/lib/openal-soft/include/atomic.h delete mode 100644 Engine/lib/openal-soft/include/math_defs.h create mode 100644 Engine/lib/openal-soft/native-tools/CMakeLists.txt create mode 100644 Engine/lib/openal-soft/native-tools/bin2h.c create mode 100644 Engine/lib/openal-soft/native-tools/bsincgen.c create mode 100644 Engine/lib/openal-soft/version.cmake create mode 100644 Engine/lib/openal-soft/version.h.in diff --git a/Engine/lib/openal-soft/.gitignore b/Engine/lib/openal-soft/.gitignore index 9aa081c61..de57ef223 100644 --- a/Engine/lib/openal-soft/.gitignore +++ b/Engine/lib/openal-soft/.gitignore @@ -1,7 +1,5 @@ -build -winbuild -win64build -include/SLES -include/sndio.h -include/sys +build*/ +winbuild/ +win64build/ openal-soft.kdev4 +.kdev4/ diff --git a/Engine/lib/openal-soft/.travis.yml b/Engine/lib/openal-soft/.travis.yml index dfae8e7a5..426eef40c 100644 --- a/Engine/lib/openal-soft/.travis.yml +++ b/Engine/lib/openal-soft/.travis.yml @@ -1,5 +1,66 @@ -os: - - linux - - osx language: c -script: cmake . && make -j2 +matrix: + include: + - os: linux + dist: trusty + - os: linux + dist: trusty + env: + - BUILD_ANDROID=true + - os: osx +sudo: required +install: + - > + if [[ "${TRAVIS_OS_NAME}" == "linux" && -z "${BUILD_ANDROID}" ]]; then + # Install pulseaudio, portaudio, ALSA, JACK dependencies for + # corresponding backends. + # Install Qt5 dependency for alsoft-config. + sudo apt-get install -qq \ + libpulse-dev \ + portaudio19-dev \ + libasound2-dev \ + libjack-dev \ + qtbase5-dev + fi + - > + if [[ "${TRAVIS_OS_NAME}" == "linux" && "${BUILD_ANDROID}" == "true" ]]; then + curl -o ~/android-ndk.zip https://dl.google.com/android/repository/android-ndk-r15-linux-x86_64.zip + unzip -q ~/android-ndk.zip -d ~ \ + 'android-ndk-r15/build/cmake/*' \ + 'android-ndk-r15/build/core/toolchains/arm-linux-androideabi-*/*' \ + 'android-ndk-r15/platforms/android-14/arch-arm/*' \ + 'android-ndk-r15/source.properties' \ + 'android-ndk-r15/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/*' \ + 'android-ndk-r15/sources/cxx-stl/gnu-libstdc++/4.9/include/*' \ + 'android-ndk-r15/sysroot/*' \ + 'android-ndk-r15/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/*' \ + 'android-ndk-r15/toolchains/llvm/prebuilt/linux-x86_64/*' + fi +script: + - > + if [[ "${TRAVIS_OS_NAME}" == "linux" && -z "${BUILD_ANDROID}" ]]; then + cmake \ + -DALSOFT_REQUIRE_ALSA=ON \ + -DALSOFT_REQUIRE_OSS=ON \ + -DALSOFT_REQUIRE_PORTAUDIO=ON \ + -DALSOFT_REQUIRE_PULSEAUDIO=ON \ + -DALSOFT_REQUIRE_JACK=ON \ + -DALSOFT_EMBED_HRTF_DATA=YES \ + . + fi + - > + if [[ "${TRAVIS_OS_NAME}" == "linux" && "${BUILD_ANDROID}" == "true" ]]; then + cmake \ + -DCMAKE_TOOLCHAIN_FILE=~/android-ndk-r15/build/cmake/android.toolchain.cmake \ + -DALSOFT_REQUIRE_OPENSL=ON \ + -DALSOFT_EMBED_HRTF_DATA=YES \ + . + fi + - > + if [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then + cmake \ + -DALSOFT_REQUIRE_COREAUDIO=ON \ + -DALSOFT_EMBED_HRTF_DATA=YES \ + . + fi + - make -j2 diff --git a/Engine/lib/openal-soft/Alc/ALc.c b/Engine/lib/openal-soft/Alc/ALc.c index 7e220205c..597cc890c 100644 --- a/Engine/lib/openal-soft/Alc/ALc.c +++ b/Engine/lib/openal-soft/Alc/ALc.c @@ -20,6 +20,8 @@ #include "config.h" +#include "version.h" + #include #include #include @@ -30,14 +32,20 @@ #include "alMain.h" #include "alSource.h" #include "alListener.h" -#include "alThunk.h" #include "alSource.h" #include "alBuffer.h" +#include "alFilter.h" +#include "alEffect.h" #include "alAuxEffectSlot.h" #include "alError.h" +#include "mastering.h" #include "bformatdec.h" #include "alu.h" +#include "alconfig.h" +#include "ringbuffer.h" +#include "fpu_modes.h" +#include "cpu_caps.h" #include "compat.h" #include "threads.h" #include "alstring.h" @@ -52,61 +60,58 @@ struct BackendInfo { const char *name; ALCbackendFactory* (*getFactory)(void); - ALCboolean (*Init)(BackendFuncs*); - void (*Deinit)(void); - void (*Probe)(enum DevProbe); - BackendFuncs Funcs; }; -#define EmptyFuncs { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } static struct BackendInfo BackendList[] = { #ifdef HAVE_JACK - { "jack", ALCjackBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "jack", ALCjackBackendFactory_getFactory }, #endif #ifdef HAVE_PULSEAUDIO - { "pulse", ALCpulseBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "pulse", ALCpulseBackendFactory_getFactory }, #endif #ifdef HAVE_ALSA - { "alsa", ALCalsaBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "alsa", ALCalsaBackendFactory_getFactory }, #endif #ifdef HAVE_COREAUDIO - { "core", NULL, alc_ca_init, alc_ca_deinit, alc_ca_probe, EmptyFuncs }, + { "core", ALCcoreAudioBackendFactory_getFactory }, #endif #ifdef HAVE_OSS - { "oss", ALCossBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "oss", ALCossBackendFactory_getFactory }, #endif #ifdef HAVE_SOLARIS - { "solaris", ALCsolarisBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "solaris", ALCsolarisBackendFactory_getFactory }, #endif #ifdef HAVE_SNDIO - { "sndio", NULL, alc_sndio_init, alc_sndio_deinit, alc_sndio_probe, EmptyFuncs }, + { "sndio", ALCsndioBackendFactory_getFactory }, #endif #ifdef HAVE_QSA - { "qsa", NULL, alc_qsa_init, alc_qsa_deinit, alc_qsa_probe, EmptyFuncs }, + { "qsa", ALCqsaBackendFactory_getFactory }, #endif -#ifdef HAVE_MMDEVAPI - { "mmdevapi", ALCmmdevBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, +#ifdef HAVE_WASAPI + { "wasapi", ALCwasapiBackendFactory_getFactory }, #endif #ifdef HAVE_DSOUND - { "dsound", ALCdsoundBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "dsound", ALCdsoundBackendFactory_getFactory }, #endif #ifdef HAVE_WINMM - { "winmm", ALCwinmmBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "winmm", ALCwinmmBackendFactory_getFactory }, #endif #ifdef HAVE_PORTAUDIO - { "port", ALCportBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "port", ALCportBackendFactory_getFactory }, #endif #ifdef HAVE_OPENSL - { "opensl", NULL, alc_opensl_init, alc_opensl_deinit, alc_opensl_probe, EmptyFuncs }, + { "opensl", ALCopenslBackendFactory_getFactory }, +#endif +#ifdef HAVE_SDL2 + { "sdl2", ALCsdl2BackendFactory_getFactory }, #endif - { "null", ALCnullBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "null", ALCnullBackendFactory_getFactory }, #ifdef HAVE_WAVE - { "wave", ALCwaveBackendFactory_getFactory, NULL, NULL, NULL, EmptyFuncs }, + { "wave", ALCwaveBackendFactory_getFactory }, #endif - - { NULL, NULL, NULL, NULL, NULL, EmptyFuncs } }; +static ALsizei BackendListSize = COUNTOF(BackendList); #undef EmptyFuncs static struct BackendInfo PlaybackBackend; @@ -116,18 +121,11 @@ static struct BackendInfo CaptureBackend; /************************************************ * Functions, enums, and errors ************************************************/ -typedef struct ALCfunction { +#define DECL(x) { #x, (ALCvoid*)(x) } +static const struct { const ALCchar *funcName; ALCvoid *address; -} ALCfunction; - -typedef struct ALCenums { - const ALCchar *enumName; - ALCenum value; -} ALCenums; - -#define DECL(x) { #x, (ALCvoid*)(x) } -static const ALCfunction alcFunctions[] = { +} alcFunctions[] = { DECL(alcCreateContext), DECL(alcMakeContextCurrent), DECL(alcProcessContext), @@ -288,16 +286,25 @@ static const ALCfunction alcFunctions[] = { DECL(alGetSource3i64SOFT), DECL(alGetSourcei64vSOFT), - DECL(alBufferSamplesSOFT), - DECL(alGetBufferSamplesSOFT), - DECL(alIsBufferFormatSupportedSOFT), + DECL(alGetStringiSOFT), - { NULL, NULL } + DECL(alBufferStorageSOFT), + DECL(alMapBufferSOFT), + DECL(alUnmapBufferSOFT), + DECL(alFlushMappedBufferSOFT), + + DECL(alEventControlSOFT), + DECL(alEventCallbackSOFT), + DECL(alGetPointerSOFT), + DECL(alGetPointervSOFT), }; #undef DECL #define DECL(x) { #x, (x) } -static const ALCenums enumeration[] = { +static const struct { + const ALCchar *enumName; + ALCenum value; +} alcEnumerations[] = { DECL(ALC_INVALID), DECL(ALC_FALSE), DECL(ALC_TRUE), @@ -334,6 +341,7 @@ static const ALCenums enumeration[] = { DECL(ALC_5POINT1_SOFT), DECL(ALC_6POINT1_SOFT), DECL(ALC_7POINT1_SOFT), + DECL(ALC_BFORMAT3D_SOFT), DECL(ALC_BYTE_SOFT), DECL(ALC_UNSIGNED_BYTE_SOFT), @@ -356,6 +364,16 @@ static const ALCenums enumeration[] = { DECL(ALC_HRTF_SPECIFIER_SOFT), DECL(ALC_HRTF_ID_SOFT), + DECL(ALC_AMBISONIC_LAYOUT_SOFT), + DECL(ALC_AMBISONIC_SCALING_SOFT), + DECL(ALC_AMBISONIC_ORDER_SOFT), + DECL(ALC_ACN_SOFT), + DECL(ALC_FUMA_SOFT), + DECL(ALC_N3D_SOFT), + DECL(ALC_SN3D_SOFT), + + DECL(ALC_OUTPUT_LIMITER_SOFT), + DECL(ALC_NO_ERROR), DECL(ALC_INVALID_DEVICE), DECL(ALC_INVALID_CONTEXT), @@ -465,64 +483,10 @@ static const ALCenums enumeration[] = { DECL(AL_FORMAT_BFORMAT3D_FLOAT32), DECL(AL_FORMAT_BFORMAT3D_MULAW), - DECL(AL_MONO8_SOFT), - DECL(AL_MONO16_SOFT), - DECL(AL_MONO32F_SOFT), - DECL(AL_STEREO8_SOFT), - DECL(AL_STEREO16_SOFT), - DECL(AL_STEREO32F_SOFT), - DECL(AL_QUAD8_SOFT), - DECL(AL_QUAD16_SOFT), - DECL(AL_QUAD32F_SOFT), - DECL(AL_REAR8_SOFT), - DECL(AL_REAR16_SOFT), - DECL(AL_REAR32F_SOFT), - DECL(AL_5POINT1_8_SOFT), - DECL(AL_5POINT1_16_SOFT), - DECL(AL_5POINT1_32F_SOFT), - DECL(AL_6POINT1_8_SOFT), - DECL(AL_6POINT1_16_SOFT), - DECL(AL_6POINT1_32F_SOFT), - DECL(AL_7POINT1_8_SOFT), - DECL(AL_7POINT1_16_SOFT), - DECL(AL_7POINT1_32F_SOFT), - DECL(AL_BFORMAT2D_8_SOFT), - DECL(AL_BFORMAT2D_16_SOFT), - DECL(AL_BFORMAT2D_32F_SOFT), - DECL(AL_BFORMAT3D_8_SOFT), - DECL(AL_BFORMAT3D_16_SOFT), - DECL(AL_BFORMAT3D_32F_SOFT), - - DECL(AL_MONO_SOFT), - DECL(AL_STEREO_SOFT), - DECL(AL_QUAD_SOFT), - DECL(AL_REAR_SOFT), - DECL(AL_5POINT1_SOFT), - DECL(AL_6POINT1_SOFT), - DECL(AL_7POINT1_SOFT), - DECL(AL_BFORMAT2D_SOFT), - DECL(AL_BFORMAT3D_SOFT), - - DECL(AL_BYTE_SOFT), - DECL(AL_UNSIGNED_BYTE_SOFT), - DECL(AL_SHORT_SOFT), - DECL(AL_UNSIGNED_SHORT_SOFT), - DECL(AL_INT_SOFT), - DECL(AL_UNSIGNED_INT_SOFT), - DECL(AL_FLOAT_SOFT), - DECL(AL_DOUBLE_SOFT), - DECL(AL_BYTE3_SOFT), - DECL(AL_UNSIGNED_BYTE3_SOFT), - DECL(AL_MULAW_SOFT), - DECL(AL_FREQUENCY), DECL(AL_BITS), DECL(AL_CHANNELS), DECL(AL_SIZE), - DECL(AL_INTERNAL_FORMAT_SOFT), - DECL(AL_BYTE_LENGTH_SOFT), - DECL(AL_SAMPLE_LENGTH_SOFT), - DECL(AL_SEC_LENGTH_SOFT), DECL(AL_UNPACK_BLOCK_ALIGNMENT_SOFT), DECL(AL_PACK_BLOCK_ALIGNMENT_SOFT), @@ -585,10 +549,10 @@ static const ALCenums enumeration[] = { DECL(AL_EFFECT_DISTORTION), DECL(AL_EFFECT_ECHO), DECL(AL_EFFECT_FLANGER), + DECL(AL_EFFECT_PITCH_SHIFTER), #if 0 DECL(AL_EFFECT_FREQUENCY_SHIFTER), DECL(AL_EFFECT_VOCAL_MORPHER), - DECL(AL_EFFECT_PITCH_SHIFTER), #endif DECL(AL_EFFECT_RING_MODULATOR), #if 0 @@ -599,6 +563,11 @@ static const ALCenums enumeration[] = { DECL(AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT), DECL(AL_EFFECT_DEDICATED_DIALOGUE), + DECL(AL_EFFECTSLOT_EFFECT), + DECL(AL_EFFECTSLOT_GAIN), + DECL(AL_EFFECTSLOT_AUXILIARY_SEND_AUTO), + DECL(AL_EFFECTSLOT_NULL), + DECL(AL_EAXREVERB_DENSITY), DECL(AL_EAXREVERB_DIFFUSION), DECL(AL_EAXREVERB_GAIN), @@ -667,6 +636,9 @@ static const ALCenums enumeration[] = { DECL(AL_RING_MODULATOR_HIGHPASS_CUTOFF), DECL(AL_RING_MODULATOR_WAVEFORM), + DECL(AL_PITCH_SHIFTER_COARSE_TUNE), + DECL(AL_PITCH_SHIFTER_FINE_TUNE), + DECL(AL_COMPRESSOR_ONOFF), DECL(AL_EQUALIZER_LOW_GAIN), @@ -682,7 +654,26 @@ static const ALCenums enumeration[] = { DECL(AL_DEDICATED_GAIN), - { NULL, (ALCenum)0 } + DECL(AL_NUM_RESAMPLERS_SOFT), + DECL(AL_DEFAULT_RESAMPLER_SOFT), + DECL(AL_SOURCE_RESAMPLER_SOFT), + DECL(AL_RESAMPLER_NAME_SOFT), + + DECL(AL_SOURCE_SPATIALIZE_SOFT), + DECL(AL_AUTO_SOFT), + + DECL(AL_MAP_READ_BIT_SOFT), + DECL(AL_MAP_WRITE_BIT_SOFT), + DECL(AL_MAP_PERSISTENT_BIT_SOFT), + DECL(AL_PRESERVE_DATA_BIT_SOFT), + + DECL(AL_EVENT_CALLBACK_FUNCTION_SOFT), + DECL(AL_EVENT_CALLBACK_USER_PARAM_SOFT), + DECL(AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT), + DECL(AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT), + DECL(AL_EVENT_TYPE_ERROR_SOFT), + DECL(AL_EVENT_TYPE_PERFORMANCE_SOFT), + DECL(AL_EVENT_TYPE_DEPRECATED_SOFT), }; #undef DECL @@ -710,13 +701,34 @@ static ALCchar *alcCaptureDefaultDeviceSpecifier; /* Default context extensions */ static const ALchar alExtList[] = - "AL_EXT_ALAW AL_EXT_BFORMAT AL_EXT_DOUBLE AL_EXT_EXPONENT_DISTANCE " - "AL_EXT_FLOAT32 AL_EXT_IMA4 AL_EXT_LINEAR_DISTANCE AL_EXT_MCFORMATS " - "AL_EXT_MULAW AL_EXT_MULAW_BFORMAT AL_EXT_MULAW_MCFORMATS AL_EXT_OFFSET " - "AL_EXT_source_distance_model AL_EXT_SOURCE_RADIUS AL_EXT_STEREO_ANGLES " - "AL_LOKI_quadriphonic AL_SOFT_block_alignment AL_SOFT_deferred_updates " - "AL_SOFT_direct_channels AL_SOFT_gain_clamp_ex AL_SOFT_loop_points " - "AL_SOFT_MSADPCM AL_SOFT_source_latency AL_SOFT_source_length"; + "AL_EXT_ALAW " + "AL_EXT_BFORMAT " + "AL_EXT_DOUBLE " + "AL_EXT_EXPONENT_DISTANCE " + "AL_EXT_FLOAT32 " + "AL_EXT_IMA4 " + "AL_EXT_LINEAR_DISTANCE " + "AL_EXT_MCFORMATS " + "AL_EXT_MULAW " + "AL_EXT_MULAW_BFORMAT " + "AL_EXT_MULAW_MCFORMATS " + "AL_EXT_OFFSET " + "AL_EXT_source_distance_model " + "AL_EXT_SOURCE_RADIUS " + "AL_EXT_STEREO_ANGLES " + "AL_LOKI_quadriphonic " + "AL_SOFT_block_alignment " + "AL_SOFT_deferred_updates " + "AL_SOFT_direct_channels " + "AL_SOFTX_events " + "AL_SOFT_gain_clamp_ex " + "AL_SOFT_loop_points " + "AL_SOFTX_map_buffer " + "AL_SOFT_MSADPCM " + "AL_SOFT_source_latency " + "AL_SOFT_source_length " + "AL_SOFT_source_resampler " + "AL_SOFT_source_spatialize"; static ATOMIC(ALCenum) LastNullDeviceError = ATOMIC_INIT_STATIC(ALC_NO_ERROR); @@ -759,8 +771,8 @@ static const ALCchar alcNoDeviceExtList[] = static const ALCchar alcExtensionList[] = "ALC_ENUMERATE_ALL_EXT ALC_ENUMERATION_EXT ALC_EXT_CAPTURE " "ALC_EXT_DEDICATED ALC_EXT_disconnect ALC_EXT_EFX " - "ALC_EXT_thread_local_context ALC_SOFTX_device_clock ALC_SOFT_HRTF " - "ALC_SOFT_loopback ALC_SOFT_pause_device"; + "ALC_EXT_thread_local_context ALC_SOFT_device_clock ALC_SOFT_HRTF " + "ALC_SOFT_loopback ALC_SOFT_output_limiter ALC_SOFT_pause_device"; static const ALCint alcMajorVersion = 1; static const ALCint alcMinorVersion = 1; @@ -806,6 +818,7 @@ BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD reason, LPVOID lpReserved) break; case DLL_THREAD_DETACH: + althrd_thread_detach(); break; case DLL_PROCESS_DETACH: @@ -868,19 +881,21 @@ static void alc_init(void) if(str && (strcasecmp(str, "true") == 0 || strtol(str, NULL, 0) == 1)) ZScale *= -1.0f; + str = getenv("__ALSOFT_REVERB_IGNORES_SOUND_SPEED"); + if(str && (strcasecmp(str, "true") == 0 || strtol(str, NULL, 0) == 1)) + OverrideReverbSpeedOfSound = AL_TRUE; + ret = altss_create(&LocalContext, ReleaseThreadCtx); assert(ret == althrd_success); ret = almtx_init(&ListLock, almtx_recursive); assert(ret == althrd_success); - - ThunkInit(); } static void alc_initconfig(void) { const char *devs, *str; - ALuint capfilter; + int capfilter; float valf; int i, n; @@ -900,10 +915,15 @@ static void alc_initconfig(void) else ERR("Failed to open log file '%s'\n", str); } + TRACE("Initializing library v%s-%s %s\n", ALSOFT_VERSION, + ALSOFT_GIT_COMMIT_HASH, ALSOFT_GIT_BRANCH); { char buf[1024] = ""; - int len = snprintf(buf, sizeof(buf), "%s", BackendList[0].name); - for(i = 1;BackendList[i].name;i++) + int len = 0; + + if(BackendListSize > 0) + len += snprintf(buf, sizeof(buf), "%s", BackendList[0].name); + for(i = 1;i < BackendListSize;i++) len += snprintf(buf+len, sizeof(buf)-len, ", %s", BackendList[i].name); TRACE("Supported backends: %s\n", buf); } @@ -979,6 +999,7 @@ static void alc_initconfig(void) #endif ConfigValueInt(NULL, NULL, "rt-prio", &RTPrioLevel); + aluInit(); aluInitMixer(); str = getenv("ALSOFT_TRAP_ERROR"); @@ -1003,8 +1024,6 @@ static void alc_initconfig(void) if(ConfigValueFloat(NULL, "reverb", "boost", &valf)) ReverbBoost *= powf(10.0f, valf / 20.0f); - EmulateEAXReverb = GetConfigValueBool(NULL, "reverb", "emulate-eax", AL_FALSE); - if(((devs=getenv("ALSOFT_DRIVERS")) && devs[0]) || ConfigValueStr(NULL, NULL, "drivers", &devs)) { @@ -1033,26 +1052,32 @@ static void alc_initconfig(void) len = (next ? ((size_t)(next-devs)) : strlen(devs)); while(len > 0 && isspace(devs[len-1])) len--; - for(n = i;BackendList[n].name;n++) +#ifdef HAVE_WASAPI + /* HACK: For backwards compatibility, convert backend references of + * mmdevapi to wasapi. This should eventually be removed. + */ + if(len == 8 && strncmp(devs, "mmdevapi", len) == 0) + { + devs = "wasapi"; + len = 6; + } +#endif + for(n = i;n < BackendListSize;n++) { if(len == strlen(BackendList[n].name) && strncmp(BackendList[n].name, devs, len) == 0) { if(delitem) { - do { + for(;n+1 < BackendListSize;n++) BackendList[n] = BackendList[n+1]; - ++n; - } while(BackendList[n].name); + BackendListSize--; } else { struct BackendInfo Bkp = BackendList[n]; - while(n > i) - { + for(;n > i;n--) BackendList[n] = BackendList[n-1]; - --n; - } BackendList[n] = Bkp; i++; @@ -1063,59 +1088,36 @@ static void alc_initconfig(void) } while(next++); if(endlist) - { - BackendList[i].name = NULL; - BackendList[i].getFactory = NULL; - BackendList[i].Init = NULL; - BackendList[i].Deinit = NULL; - BackendList[i].Probe = NULL; - } + BackendListSize = i; } - for(i = 0;(BackendList[i].Init || BackendList[i].getFactory) && (!PlaybackBackend.name || !CaptureBackend.name);i++) + for(n = i = 0;i < BackendListSize && (!PlaybackBackend.name || !CaptureBackend.name);i++) { - if(BackendList[i].getFactory) + ALCbackendFactory *factory; + BackendList[n] = BackendList[i]; + + factory = BackendList[n].getFactory(); + if(!V0(factory,init)()) { - ALCbackendFactory *factory = BackendList[i].getFactory(); - if(!V0(factory,init)()) - { - WARN("Failed to initialize backend \"%s\"\n", BackendList[i].name); - continue; - } - - TRACE("Initialized backend \"%s\"\n", BackendList[i].name); - if(!PlaybackBackend.name && V(factory,querySupport)(ALCbackend_Playback)) - { - PlaybackBackend = BackendList[i]; - TRACE("Added \"%s\" for playback\n", PlaybackBackend.name); - } - if(!CaptureBackend.name && V(factory,querySupport)(ALCbackend_Capture)) - { - CaptureBackend = BackendList[i]; - TRACE("Added \"%s\" for capture\n", CaptureBackend.name); - } - + WARN("Failed to initialize backend \"%s\"\n", BackendList[n].name); continue; } - if(!BackendList[i].Init(&BackendList[i].Funcs)) + TRACE("Initialized backend \"%s\"\n", BackendList[n].name); + if(!PlaybackBackend.name && V(factory,querySupport)(ALCbackend_Playback)) { - WARN("Failed to initialize backend \"%s\"\n", BackendList[i].name); - continue; - } - - TRACE("Initialized backend \"%s\"\n", BackendList[i].name); - if(BackendList[i].Funcs.OpenPlayback && !PlaybackBackend.name) - { - PlaybackBackend = BackendList[i]; + PlaybackBackend = BackendList[n]; TRACE("Added \"%s\" for playback\n", PlaybackBackend.name); } - if(BackendList[i].Funcs.OpenCapture && !CaptureBackend.name) + if(!CaptureBackend.name && V(factory,querySupport)(ALCbackend_Capture)) { - CaptureBackend = BackendList[i]; + CaptureBackend = BackendList[n]; TRACE("Added \"%s\" for capture\n", CaptureBackend.name); } + n++; } + BackendListSize = n; + { ALCbackendFactory *factory = ALCloopbackFactory_getFactory(); V0(factory,init)(); @@ -1139,7 +1141,7 @@ static void alc_initconfig(void) continue; len = (next ? ((size_t)(next-str)) : strlen(str)); - for(n = 0;EffectList[n].name;n++) + for(n = 0;n < EFFECTLIST_SIZE;n++) { if(len == strlen(EffectList[n].name) && strncmp(EffectList[n].name, str, len) == 0) @@ -1148,8 +1150,6 @@ static void alc_initconfig(void) } while(next++); } - InitEffectFactoryMap(); - InitEffect(&DefaultEffect); str = getenv("ALSOFT_DEFAULT_REVERB"); if((str && str[0]) || ConfigValueStr(NULL, NULL, "default-reverb", &str)) @@ -1157,6 +1157,75 @@ static void alc_initconfig(void) } #define DO_INITCONFIG() alcall_once(&alc_config_once, alc_initconfig) +#ifdef __ANDROID__ +#include + +static JavaVM *gJavaVM; +static pthread_key_t gJVMThreadKey; + +static void CleanupJNIEnv(void* UNUSED(ptr)) +{ + JCALL0(gJavaVM,DetachCurrentThread)(); +} + +void *Android_GetJNIEnv(void) +{ + if(!gJavaVM) + { + WARN("gJavaVM is NULL!\n"); + return NULL; + } + + /* http://developer.android.com/guide/practices/jni.html + * + * All threads are Linux threads, scheduled by the kernel. They're usually + * started from managed code (using Thread.start), but they can also be + * created elsewhere and then attached to the JavaVM. For example, a thread + * started with pthread_create can be attached with the JNI + * AttachCurrentThread or AttachCurrentThreadAsDaemon functions. Until a + * thread is attached, it has no JNIEnv, and cannot make JNI calls. + * Attaching a natively-created thread causes a java.lang.Thread object to + * be constructed and added to the "main" ThreadGroup, making it visible to + * the debugger. Calling AttachCurrentThread on an already-attached thread + * is a no-op. + */ + JNIEnv *env = pthread_getspecific(gJVMThreadKey); + if(!env) + { + int status = JCALL(gJavaVM,AttachCurrentThread)(&env, NULL); + if(status < 0) + { + ERR("Failed to attach current thread\n"); + return NULL; + } + pthread_setspecific(gJVMThreadKey, env); + } + return env; +} + +/* Automatically called by JNI. */ +JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void* UNUSED(reserved)) +{ + void *env; + int err; + + gJavaVM = jvm; + if(JCALL(gJavaVM,GetEnv)(&env, JNI_VERSION_1_4) != JNI_OK) + { + ERR("Failed to get JNIEnv with JNI_VERSION_1_4\n"); + return JNI_ERR; + } + + /* Create gJVMThreadKey so we can keep track of the JNIEnv assigned to each + * thread. The JNIEnv *must* be detached before the thread is destroyed. + */ + if((err=pthread_key_create(&gJVMThreadKey, CleanupJNIEnv)) != 0) + ERR("pthread_key_create failed: %d\n", err); + pthread_setspecific(gJVMThreadKey, env); + return JNI_VERSION_1_4; +} +#endif + /************************************************ * Library deinitialization @@ -1173,16 +1242,15 @@ static void alc_cleanup(void) free(alcCaptureDefaultDeviceSpecifier); alcCaptureDefaultDeviceSpecifier = NULL; - if((dev=ATOMIC_EXCHANGE(ALCdevice*, &DeviceList, NULL)) != NULL) + if((dev=ATOMIC_EXCHANGE_PTR_SEQ(&DeviceList, NULL)) != NULL) { ALCuint num = 0; do { num++; - } while((dev=dev->next) != NULL); + dev = ATOMIC_LOAD(&dev->next, almemory_order_relaxed); + } while(dev != NULL); ERR("%u device%s not closed\n", num, (num>1)?"s":""); } - - DeinitEffectFactoryMap(); } static void alc_deinit_safe(void) @@ -1192,13 +1260,14 @@ static void alc_deinit_safe(void) FreeHrtfs(); FreeALConfig(); - ThunkExit(); almtx_destroy(&ListLock); altss_delete(LocalContext); if(LogFile != stderr) fclose(LogFile); LogFile = NULL; + + althrd_deinit(); } static void alc_deinit(void) @@ -1210,15 +1279,10 @@ static void alc_deinit(void) memset(&PlaybackBackend, 0, sizeof(PlaybackBackend)); memset(&CaptureBackend, 0, sizeof(CaptureBackend)); - for(i = 0;BackendList[i].Deinit || BackendList[i].getFactory;i++) + for(i = 0;i < BackendListSize;i++) { - if(!BackendList[i].getFactory) - BackendList[i].Deinit(); - else - { - ALCbackendFactory *factory = BackendList[i].getFactory(); - V0(factory,deinit)(); - } + ALCbackendFactory *factory = BackendList[i].getFactory(); + V0(factory,deinit)(); } { ALCbackendFactory *factory = ALCloopbackFactory_getFactory(); @@ -1237,11 +1301,9 @@ static void ProbeDevices(al_string *list, struct BackendInfo *backendinfo, enum DO_INITCONFIG(); LockLists(); - al_string_clear(list); + alstr_clear(list); - if(backendinfo->Probe) - backendinfo->Probe(type); - else if(backendinfo->getFactory) + if(backendinfo->getFactory) { ALCbackendFactory *factory = backendinfo->getFactory(); V(factory,probe)(type); @@ -1258,7 +1320,7 @@ static void AppendDevice(const ALCchar *name, al_string *devnames) { size_t len = strlen(name); if(len > 0) - al_string_append_range(devnames, name, name+len+1); + alstr_append_range(devnames, name, name+len+1); } void AppendAllDevicesList(const ALCchar *name) { AppendDevice(name, &alcAllDevicesList); } @@ -1294,15 +1356,13 @@ const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans) case DevFmtX51Rear: return "5.1 Surround (Rear)"; case DevFmtX61: return "6.1 Surround"; case DevFmtX71: return "7.1 Surround"; - case DevFmtAmbi1: return "Ambisonic (1st Order)"; - case DevFmtAmbi2: return "Ambisonic (2nd Order)"; - case DevFmtAmbi3: return "Ambisonic (3rd Order)"; + case DevFmtAmbi3D: return "Ambisonic 3D"; } return "(unknown channels)"; } -extern inline ALuint FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType type); -ALuint BytesFromDevFmt(enum DevFmtType type) +extern inline ALsizei FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType type, ALsizei ambiorder); +ALsizei BytesFromDevFmt(enum DevFmtType type) { switch(type) { @@ -1316,7 +1376,7 @@ ALuint BytesFromDevFmt(enum DevFmtType type) } return 0; } -ALuint ChannelsFromDevFmt(enum DevFmtChannels chans) +ALsizei ChannelsFromDevFmt(enum DevFmtChannels chans, ALsizei ambiorder) { switch(chans) { @@ -1327,9 +1387,9 @@ ALuint ChannelsFromDevFmt(enum DevFmtChannels chans) case DevFmtX51Rear: return 6; case DevFmtX61: return 7; case DevFmtX71: return 8; - case DevFmtAmbi1: return 4; - case DevFmtAmbi2: return 9; - case DevFmtAmbi3: return 16; + case DevFmtAmbi3D: return (ambiorder >= 3) ? 16 : + (ambiorder == 2) ? 9 : + (ambiorder == 1) ? 4 : 1; } return 0; } @@ -1407,37 +1467,46 @@ static ALCboolean IsValidALCChannels(ALCenum channels) case ALC_5POINT1_SOFT: case ALC_6POINT1_SOFT: case ALC_7POINT1_SOFT: + case ALC_BFORMAT3D_SOFT: return ALC_TRUE; } return ALC_FALSE; } +static ALCboolean IsValidAmbiLayout(ALCenum layout) +{ + switch(layout) + { + case ALC_ACN_SOFT: + case ALC_FUMA_SOFT: + return ALC_TRUE; + } + return ALC_FALSE; +} + +static ALCboolean IsValidAmbiScaling(ALCenum scaling) +{ + switch(scaling) + { + case ALC_N3D_SOFT: + case ALC_SN3D_SOFT: + case ALC_FUMA_SOFT: + return ALC_TRUE; + } + return ALC_FALSE; +} /************************************************ * Miscellaneous ALC helpers ************************************************/ -extern inline void LockContext(ALCcontext *context); -extern inline void UnlockContext(ALCcontext *context); - -void ALCdevice_Lock(ALCdevice *device) -{ - V0(device->Backend,lock)(); -} - -void ALCdevice_Unlock(ALCdevice *device) -{ - V0(device->Backend,unlock)(); -} - - /* SetDefaultWFXChannelOrder * * Sets the default channel order used by WaveFormatEx. */ void SetDefaultWFXChannelOrder(ALCdevice *device) { - ALuint i; + ALsizei i; for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) device->RealOut.ChannelName[i] = InvalidChannel; @@ -1492,40 +1561,32 @@ void SetDefaultWFXChannelOrder(ALCdevice *device) device->RealOut.ChannelName[6] = SideLeft; device->RealOut.ChannelName[7] = SideRight; break; - case DevFmtAmbi1: + case DevFmtAmbi3D: device->RealOut.ChannelName[0] = Aux0; - device->RealOut.ChannelName[1] = Aux1; - device->RealOut.ChannelName[2] = Aux2; - device->RealOut.ChannelName[3] = Aux3; - break; - case DevFmtAmbi2: - device->RealOut.ChannelName[0] = Aux0; - device->RealOut.ChannelName[1] = Aux1; - device->RealOut.ChannelName[2] = Aux2; - device->RealOut.ChannelName[3] = Aux3; - device->RealOut.ChannelName[4] = Aux4; - device->RealOut.ChannelName[5] = Aux5; - device->RealOut.ChannelName[6] = Aux6; - device->RealOut.ChannelName[7] = Aux7; - device->RealOut.ChannelName[8] = Aux8; - break; - case DevFmtAmbi3: - device->RealOut.ChannelName[0] = Aux0; - device->RealOut.ChannelName[1] = Aux1; - device->RealOut.ChannelName[2] = Aux2; - device->RealOut.ChannelName[3] = Aux3; - device->RealOut.ChannelName[4] = Aux4; - device->RealOut.ChannelName[5] = Aux5; - device->RealOut.ChannelName[6] = Aux6; - device->RealOut.ChannelName[7] = Aux7; - device->RealOut.ChannelName[8] = Aux8; - device->RealOut.ChannelName[9] = Aux9; - device->RealOut.ChannelName[10] = Aux10; - device->RealOut.ChannelName[11] = Aux11; - device->RealOut.ChannelName[12] = Aux12; - device->RealOut.ChannelName[13] = Aux13; - device->RealOut.ChannelName[14] = Aux14; - device->RealOut.ChannelName[15] = Aux15; + if(device->AmbiOrder > 0) + { + device->RealOut.ChannelName[1] = Aux1; + device->RealOut.ChannelName[2] = Aux2; + device->RealOut.ChannelName[3] = Aux3; + } + if(device->AmbiOrder > 1) + { + device->RealOut.ChannelName[4] = Aux4; + device->RealOut.ChannelName[5] = Aux5; + device->RealOut.ChannelName[6] = Aux6; + device->RealOut.ChannelName[7] = Aux7; + device->RealOut.ChannelName[8] = Aux8; + } + if(device->AmbiOrder > 2) + { + device->RealOut.ChannelName[9] = Aux9; + device->RealOut.ChannelName[10] = Aux10; + device->RealOut.ChannelName[11] = Aux11; + device->RealOut.ChannelName[12] = Aux12; + device->RealOut.ChannelName[13] = Aux13; + device->RealOut.ChannelName[14] = Aux14; + device->RealOut.ChannelName[15] = Aux15; + } break; } } @@ -1536,7 +1597,7 @@ void SetDefaultWFXChannelOrder(ALCdevice *device) */ void SetDefaultChannelOrder(ALCdevice *device) { - ALuint i; + ALsizei i; for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) device->RealOut.ChannelName[i] = InvalidChannel; @@ -1568,15 +1629,14 @@ void SetDefaultChannelOrder(ALCdevice *device) case DevFmtQuad: case DevFmtX51: case DevFmtX61: - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: SetDefaultWFXChannelOrder(device); break; } } extern inline ALint GetChannelIndex(const enum Channel names[MAX_OUTPUT_CHANNELS], enum Channel chan); +extern inline ALint GetChannelIdxByName(const RealMixParams *real, enum Channel chan); /* ALCcontext_DeferUpdates @@ -1585,9 +1645,9 @@ extern inline ALint GetChannelIndex(const enum Channel names[MAX_OUTPUT_CHANNELS * does *NOT* stop mixing, but rather prevents certain property changes from * taking effect. */ -void ALCcontext_DeferUpdates(ALCcontext *context, ALenum type) +void ALCcontext_DeferUpdates(ALCcontext *context) { - ATOMIC_STORE(&context->DeferUpdates, type); + ATOMIC_STORE_SEQ(&context->DeferUpdates, AL_TRUE); } /* ALCcontext_ProcessUpdates @@ -1596,55 +1656,29 @@ void ALCcontext_DeferUpdates(ALCcontext *context, ALenum type) */ void ALCcontext_ProcessUpdates(ALCcontext *context) { - ALCdevice *device = context->Device; - - ReadLock(&context->PropLock); - if(ATOMIC_EXCHANGE(ALenum, &context->DeferUpdates, AL_FALSE)) + almtx_lock(&context->PropLock); + if(ATOMIC_EXCHANGE_SEQ(&context->DeferUpdates, AL_FALSE)) { - ALsizei pos; - uint updates; - /* Tell the mixer to stop applying updates, then wait for any active * updating to finish, before providing updates. */ - ATOMIC_STORE(&context->HoldUpdates, AL_TRUE); - while(((updates=ReadRef(&context->UpdateCount))&1) != 0) + ATOMIC_STORE_SEQ(&context->HoldUpdates, AL_TRUE); + while((ATOMIC_LOAD(&context->UpdateCount, almemory_order_acquire)&1) != 0) althrd_yield(); - UpdateListenerProps(context); + if(!ATOMIC_FLAG_TEST_AND_SET(&context->PropsClean, almemory_order_acq_rel)) + UpdateContextProps(context); + if(!ATOMIC_FLAG_TEST_AND_SET(&context->Listener->PropsClean, almemory_order_acq_rel)) + UpdateListenerProps(context); UpdateAllEffectSlotProps(context); - - LockUIntMapRead(&context->SourceMap); - V0(device->Backend,lock)(); - for(pos = 0;pos < context->SourceMap.size;pos++) - { - ALsource *Source = context->SourceMap.values[pos]; - ALenum new_state; - - if((Source->state == AL_PLAYING || Source->state == AL_PAUSED) && - Source->OffsetType != AL_NONE) - { - WriteLock(&Source->queue_lock); - ApplyOffset(Source); - WriteUnlock(&Source->queue_lock); - } - - new_state = Source->new_state; - Source->new_state = AL_NONE; - if(new_state) - SetSourceState(Source, context, new_state); - } - V0(device->Backend,unlock)(); - UnlockUIntMapRead(&context->SourceMap); - UpdateAllSourceProps(context); /* Now with all updates declared, let the mixer continue applying them * so they all happen at once. */ - ATOMIC_STORE(&context->HoldUpdates, AL_FALSE); + ATOMIC_STORE_SEQ(&context->HoldUpdates, AL_FALSE); } - ReadUnlock(&context->PropLock); + almtx_unlock(&context->PropLock); } @@ -1654,6 +1688,7 @@ void ALCcontext_ProcessUpdates(ALCcontext *context) */ static void alcSetError(ALCdevice *device, ALCenum errorCode) { + WARN("Error generated on device %p, code 0x%04x\n", device, errorCode); if(TrapALCError) { #ifdef _WIN32 @@ -1666,22 +1701,31 @@ static void alcSetError(ALCdevice *device, ALCenum errorCode) } if(device) - ATOMIC_STORE(&device->LastError, errorCode); + ATOMIC_STORE_SEQ(&device->LastError, errorCode); else - ATOMIC_STORE(&LastNullDeviceError, errorCode); + ATOMIC_STORE_SEQ(&LastNullDeviceError, errorCode); } +struct Compressor *CreateDeviceLimiter(const ALCdevice *device) +{ + return CompressorInit(0.0f, 0.0f, AL_FALSE, AL_TRUE, 0.0f, 0.0f, 0.5f, 2.0f, + 0.0f, -3.0f, 3.0f, device->Frequency); +} + /* UpdateClockBase * * Updates the device's base clock time with however many samples have been * done. This is used so frequency changes on the device don't cause the time - * to jump forward or back. + * to jump forward or back. Must not be called while the device is running/ + * mixing. */ static inline void UpdateClockBase(ALCdevice *device) { + IncrementRef(&device->MixCount); device->ClockBase += device->SamplesDone * DEVICE_CLOCK_RES / device->Frequency; device->SamplesDone = 0; + IncrementRef(&device->MixCount); } /* UpdateDeviceParams @@ -1691,30 +1735,32 @@ static inline void UpdateClockBase(ALCdevice *device) */ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) { - ALCcontext *context; - enum HrtfRequestMode hrtf_appreq = Hrtf_Default; enum HrtfRequestMode hrtf_userreq = Hrtf_Default; + enum HrtfRequestMode hrtf_appreq = Hrtf_Default; + ALCenum gainLimiter = device->Limiter ? ALC_TRUE : ALC_FALSE; + const ALsizei old_sends = device->NumAuxSends; + ALsizei new_sends = device->NumAuxSends; enum DevFmtChannels oldChans; enum DevFmtType oldType; - ALCuint oldFreq; - FPUCtl oldMode; + ALboolean update_failed; ALCsizei hrtf_id = -1; + ALCcontext *context; + ALCuint oldFreq; size_t size; + ALCsizei i; + int val; // Check for attributes if(device->Type == Loopback) { - enum { - GotFreq = 1<<0, - GotChans = 1<<1, - GotType = 1<<2, - GotAll = GotFreq|GotChans|GotType - }; - ALCuint freq, numMono, numStereo, numSends; - enum DevFmtChannels schans; - enum DevFmtType stype; - ALCuint attrIdx = 0; - ALCint gotFmt = 0; + ALCsizei numMono, numStereo, numSends; + ALCenum alayout = AL_NONE; + ALCenum ascale = AL_NONE; + ALCenum schans = AL_NONE; + ALCenum stype = AL_NONE; + ALCsizei attrIdx = 0; + ALCsizei aorder = 0; + ALCuint freq = 0; if(!attrList) { @@ -1724,88 +1770,113 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) numMono = device->NumMonoSources; numStereo = device->NumStereoSources; - numSends = device->NumAuxSends; - schans = device->FmtChans; - stype = device->FmtType; - freq = device->Frequency; + numSends = old_sends; #define TRACE_ATTR(a, v) TRACE("Loopback %s = %d\n", #a, v) while(attrList[attrIdx]) { - if(attrList[attrIdx] == ALC_FORMAT_CHANNELS_SOFT) + switch(attrList[attrIdx]) { - ALCint val = attrList[attrIdx + 1]; - TRACE_ATTR(ALC_FORMAT_CHANNELS_SOFT, val); - if(!IsValidALCChannels(val) || !ChannelsFromDevFmt(val)) - return ALC_INVALID_VALUE; - schans = val; - gotFmt |= GotChans; - } + case ALC_FORMAT_CHANNELS_SOFT: + schans = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_FORMAT_CHANNELS_SOFT, schans); + if(!IsValidALCChannels(schans)) + return ALC_INVALID_VALUE; + break; - if(attrList[attrIdx] == ALC_FORMAT_TYPE_SOFT) - { - ALCint val = attrList[attrIdx + 1]; - TRACE_ATTR(ALC_FORMAT_TYPE_SOFT, val); - if(!IsValidALCType(val) || !BytesFromDevFmt(val)) - return ALC_INVALID_VALUE; - stype = val; - gotFmt |= GotType; - } + case ALC_FORMAT_TYPE_SOFT: + stype = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_FORMAT_TYPE_SOFT, stype); + if(!IsValidALCType(stype)) + return ALC_INVALID_VALUE; + break; - if(attrList[attrIdx] == ALC_FREQUENCY) - { - freq = attrList[attrIdx + 1]; - TRACE_ATTR(ALC_FREQUENCY, freq); - if(freq < MIN_OUTPUT_RATE) - return ALC_INVALID_VALUE; - gotFmt |= GotFreq; - } + case ALC_FREQUENCY: + freq = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_FREQUENCY, freq); + if(freq < MIN_OUTPUT_RATE) + return ALC_INVALID_VALUE; + break; - if(attrList[attrIdx] == ALC_STEREO_SOURCES) - { - numStereo = attrList[attrIdx + 1]; - TRACE_ATTR(ALC_STEREO_SOURCES, numStereo); - if(numStereo > device->SourcesMax) - numStereo = device->SourcesMax; + case ALC_AMBISONIC_LAYOUT_SOFT: + alayout = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_AMBISONIC_LAYOUT_SOFT, alayout); + if(!IsValidAmbiLayout(alayout)) + return ALC_INVALID_VALUE; + break; - numMono = device->SourcesMax - numStereo; - } + case ALC_AMBISONIC_SCALING_SOFT: + ascale = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_AMBISONIC_SCALING_SOFT, ascale); + if(!IsValidAmbiScaling(ascale)) + return ALC_INVALID_VALUE; + break; - if(attrList[attrIdx] == ALC_MAX_AUXILIARY_SENDS) - { - numSends = attrList[attrIdx + 1]; - TRACE_ATTR(ALC_MAX_AUXILIARY_SENDS, numSends); - } + case ALC_AMBISONIC_ORDER_SOFT: + aorder = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_AMBISONIC_ORDER_SOFT, aorder); + if(aorder < 1 || aorder > MAX_AMBI_ORDER) + return ALC_INVALID_VALUE; + break; - if(attrList[attrIdx] == ALC_HRTF_SOFT) - { - TRACE_ATTR(ALC_HRTF_SOFT, attrList[attrIdx + 1]); - if(attrList[attrIdx + 1] == ALC_FALSE) - hrtf_appreq = Hrtf_Disable; - else if(attrList[attrIdx + 1] == ALC_TRUE) - hrtf_appreq = Hrtf_Enable; - else - hrtf_appreq = Hrtf_Default; - } + case ALC_MONO_SOURCES: + numMono = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_MONO_SOURCES, numMono); + numMono = maxi(numMono, 0); + break; - if(attrList[attrIdx] == ALC_HRTF_ID_SOFT) - { - hrtf_id = attrList[attrIdx + 1]; - TRACE_ATTR(ALC_HRTF_ID_SOFT, hrtf_id); + case ALC_STEREO_SOURCES: + numStereo = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_STEREO_SOURCES, numStereo); + numStereo = maxi(numStereo, 0); + break; + + case ALC_MAX_AUXILIARY_SENDS: + numSends = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_MAX_AUXILIARY_SENDS, numSends); + numSends = clampi(numSends, 0, MAX_SENDS); + break; + + case ALC_HRTF_SOFT: + TRACE_ATTR(ALC_HRTF_SOFT, attrList[attrIdx + 1]); + if(attrList[attrIdx + 1] == ALC_FALSE) + hrtf_appreq = Hrtf_Disable; + else if(attrList[attrIdx + 1] == ALC_TRUE) + hrtf_appreq = Hrtf_Enable; + else + hrtf_appreq = Hrtf_Default; + break; + + case ALC_HRTF_ID_SOFT: + hrtf_id = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_HRTF_ID_SOFT, hrtf_id); + break; + + case ALC_OUTPUT_LIMITER_SOFT: + gainLimiter = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_OUTPUT_LIMITER_SOFT, gainLimiter); + break; + + default: + TRACE("Loopback 0x%04X = %d (0x%x)\n", attrList[attrIdx], + attrList[attrIdx + 1], attrList[attrIdx + 1]); + break; } attrIdx += 2; } #undef TRACE_ATTR - if(gotFmt != GotAll) + if(!schans || !stype || !freq) { WARN("Missing format for loopback device\n"); return ALC_INVALID_VALUE; } - - ConfigValueUInt(NULL, NULL, "sends", &numSends); - numSends = minu(MAX_SENDS, numSends); + if(schans == ALC_BFORMAT3D_SOFT && (!alayout || !ascale || !aorder)) + { + WARN("Missing ambisonic info for loopback device\n"); + return ALC_INVALID_VALUE; + } if((device->Flags&DEVICE_RUNNING)) V0(device->Backend,stop)(); @@ -1816,14 +1887,40 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) device->Frequency = freq; device->FmtChans = schans; device->FmtType = stype; + if(schans == ALC_BFORMAT3D_SOFT) + { + device->AmbiOrder = aorder; + device->AmbiLayout = alayout; + device->AmbiScale = ascale; + } + + if(numMono > INT_MAX-numStereo) + numMono = INT_MAX-numStereo; + numMono += numStereo; + if(ConfigValueInt(NULL, NULL, "sources", &numMono)) + { + if(numMono <= 0) + numMono = 256; + } + else + numMono = maxi(numMono, 256); + numStereo = mini(numStereo, numMono); + numMono -= numStereo; + device->SourcesMax = numMono + numStereo; + device->NumMonoSources = numMono; device->NumStereoSources = numStereo; - device->NumAuxSends = numSends; + + if(ConfigValueInt(NULL, NULL, "sends", &new_sends)) + new_sends = mini(numSends, clampi(new_sends, 0, MAX_SENDS)); + else + new_sends = numSends; } else if(attrList && attrList[0]) { - ALCuint freq, numMono, numStereo, numSends; - ALCuint attrIdx = 0; + ALCsizei numMono, numStereo, numSends; + ALCsizei attrIdx = 0; + ALCuint freq; /* If a context is already running on the device, stop playback so the * device attributes can be updated. */ @@ -1831,66 +1928,75 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) V0(device->Backend,stop)(); device->Flags &= ~DEVICE_RUNNING; + UpdateClockBase(device); + freq = device->Frequency; numMono = device->NumMonoSources; numStereo = device->NumStereoSources; - numSends = device->NumAuxSends; + numSends = old_sends; #define TRACE_ATTR(a, v) TRACE("%s = %d\n", #a, v) while(attrList[attrIdx]) { - if(attrList[attrIdx] == ALC_FREQUENCY) + switch(attrList[attrIdx]) { - freq = attrList[attrIdx + 1]; - device->Flags |= DEVICE_FREQUENCY_REQUEST; - TRACE_ATTR(ALC_FREQUENCY, freq); - } + case ALC_FREQUENCY: + freq = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_FREQUENCY, freq); + device->Flags |= DEVICE_FREQUENCY_REQUEST; + break; - if(attrList[attrIdx] == ALC_STEREO_SOURCES) - { - numStereo = attrList[attrIdx + 1]; - TRACE_ATTR(ALC_STEREO_SOURCES, numStereo); - if(numStereo > device->SourcesMax) - numStereo = device->SourcesMax; + case ALC_MONO_SOURCES: + numMono = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_MONO_SOURCES, numMono); + numMono = maxi(numMono, 0); + break; - numMono = device->SourcesMax - numStereo; - } + case ALC_STEREO_SOURCES: + numStereo = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_STEREO_SOURCES, numStereo); + numStereo = maxi(numStereo, 0); + break; - if(attrList[attrIdx] == ALC_MAX_AUXILIARY_SENDS) - { - numSends = attrList[attrIdx + 1]; - TRACE_ATTR(ALC_MAX_AUXILIARY_SENDS, numSends); - } + case ALC_MAX_AUXILIARY_SENDS: + numSends = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_MAX_AUXILIARY_SENDS, numSends); + numSends = clampi(numSends, 0, MAX_SENDS); + break; - if(attrList[attrIdx] == ALC_HRTF_SOFT) - { - TRACE_ATTR(ALC_HRTF_SOFT, attrList[attrIdx + 1]); - if(attrList[attrIdx + 1] == ALC_FALSE) - hrtf_appreq = Hrtf_Disable; - else if(attrList[attrIdx + 1] == ALC_TRUE) - hrtf_appreq = Hrtf_Enable; - else - hrtf_appreq = Hrtf_Default; - } + case ALC_HRTF_SOFT: + TRACE_ATTR(ALC_HRTF_SOFT, attrList[attrIdx + 1]); + if(attrList[attrIdx + 1] == ALC_FALSE) + hrtf_appreq = Hrtf_Disable; + else if(attrList[attrIdx + 1] == ALC_TRUE) + hrtf_appreq = Hrtf_Enable; + else + hrtf_appreq = Hrtf_Default; + break; - if(attrList[attrIdx] == ALC_HRTF_ID_SOFT) - { - hrtf_id = attrList[attrIdx + 1]; - TRACE_ATTR(ALC_HRTF_ID_SOFT, hrtf_id); + case ALC_HRTF_ID_SOFT: + hrtf_id = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_HRTF_ID_SOFT, hrtf_id); + break; + + case ALC_OUTPUT_LIMITER_SOFT: + gainLimiter = attrList[attrIdx + 1]; + TRACE_ATTR(ALC_OUTPUT_LIMITER_SOFT, gainLimiter); + break; + + default: + TRACE("0x%04X = %d (0x%x)\n", attrList[attrIdx], + attrList[attrIdx + 1], attrList[attrIdx + 1]); + break; } attrIdx += 2; } #undef TRACE_ATTR - ConfigValueUInt(al_string_get_cstr(device->DeviceName), NULL, "frequency", &freq); + ConfigValueUInt(alstr_get_cstr(device->DeviceName), NULL, "frequency", &freq); freq = maxu(freq, MIN_OUTPUT_RATE); - ConfigValueUInt(al_string_get_cstr(device->DeviceName), NULL, "sends", &numSends); - numSends = minu(MAX_SENDS, numSends); - - UpdateClockBase(device); - device->UpdateSize = (ALuint64)device->UpdateSize * freq / device->Frequency; /* SSE and Neon do best with the update size being a multiple of 4 */ @@ -1898,9 +2004,28 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) device->UpdateSize = (device->UpdateSize+3)&~3; device->Frequency = freq; + + if(numMono > INT_MAX-numStereo) + numMono = INT_MAX-numStereo; + numMono += numStereo; + if(ConfigValueInt(alstr_get_cstr(device->DeviceName), NULL, "sources", &numMono)) + { + if(numMono <= 0) + numMono = 256; + } + else + numMono = maxi(numMono, 256); + numStereo = mini(numStereo, numMono); + numMono -= numStereo; + device->SourcesMax = numMono + numStereo; + device->NumMonoSources = numMono; device->NumStereoSources = numStereo; - device->NumAuxSends = numSends; + + if(ConfigValueInt(alstr_get_cstr(device->DeviceName), NULL, "sends", &new_sends)) + new_sends = mini(numSends, clampi(new_sends, 0, MAX_SENDS)); + else + new_sends = numSends; } if((device->Flags&DEVICE_RUNNING)) @@ -1912,6 +2037,13 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) al_free(device->Bs2b); device->Bs2b = NULL; + al_free(device->ChannelDelay[0].Buffer); + for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) + { + device->ChannelDelay[i].Length = 0; + device->ChannelDelay[i].Buffer = NULL; + } + al_free(device->Dry.Buffer); device->Dry.Buffer = NULL; device->Dry.NumChannels = 0; @@ -1922,14 +2054,16 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) UpdateClockBase(device); + device->DitherSeed = DITHER_RNG_SEED; + /************************************************************************* * Update device format request if HRTF is requested */ - device->Hrtf.Status = ALC_HRTF_DISABLED_SOFT; + device->HrtfStatus = ALC_HRTF_DISABLED_SOFT; if(device->Type != Loopback) { const char *hrtf; - if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "hrtf", &hrtf)) + if(ConfigValueStr(alstr_get_cstr(device->DeviceName), NULL, "hrtf", &hrtf)) { if(strcasecmp(hrtf, "true") == 0) hrtf_userreq = Hrtf_Enable; @@ -1941,58 +2075,37 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) if(hrtf_userreq == Hrtf_Enable || (hrtf_userreq != Hrtf_Disable && hrtf_appreq == Hrtf_Enable)) { - if(VECTOR_SIZE(device->Hrtf.List) == 0) + struct Hrtf *hrtf = NULL; + if(VECTOR_SIZE(device->HrtfList) == 0) { - VECTOR_DEINIT(device->Hrtf.List); - device->Hrtf.List = EnumerateHrtf(device->DeviceName); + VECTOR_DEINIT(device->HrtfList); + device->HrtfList = EnumerateHrtf(device->DeviceName); } - if(VECTOR_SIZE(device->Hrtf.List) > 0) + if(VECTOR_SIZE(device->HrtfList) > 0) + { + if(hrtf_id >= 0 && (size_t)hrtf_id < VECTOR_SIZE(device->HrtfList)) + hrtf = GetLoadedHrtf(VECTOR_ELEM(device->HrtfList, hrtf_id).hrtf); + else + hrtf = GetLoadedHrtf(VECTOR_ELEM(device->HrtfList, 0).hrtf); + } + + if(hrtf) { device->FmtChans = DevFmtStereo; - if(hrtf_id >= 0 && (size_t)hrtf_id < VECTOR_SIZE(device->Hrtf.List)) - device->Frequency = VECTOR_ELEM(device->Hrtf.List, hrtf_id).hrtf->sampleRate; - else - device->Frequency = VECTOR_ELEM(device->Hrtf.List, 0).hrtf->sampleRate; + device->Frequency = hrtf->sampleRate; device->Flags |= DEVICE_CHANNELS_REQUEST | DEVICE_FREQUENCY_REQUEST; + if(device->HrtfHandle) + Hrtf_DecRef(device->HrtfHandle); + device->HrtfHandle = hrtf; } else { hrtf_userreq = Hrtf_Default; hrtf_appreq = Hrtf_Disable; - device->Hrtf.Status = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT; + device->HrtfStatus = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT; } } } - else if(hrtf_appreq == Hrtf_Enable) - { - size_t i = VECTOR_SIZE(device->Hrtf.List); - /* Loopback device. We don't need to match to a specific HRTF entry - * here. If the requested ID matches, we'll pick that later, if not, - * we'll try to auto-select one anyway. Just make sure one exists - * that'll work. - */ - if(device->FmtChans == DevFmtStereo) - { - if(VECTOR_SIZE(device->Hrtf.List) == 0) - { - VECTOR_DEINIT(device->Hrtf.List); - device->Hrtf.List = EnumerateHrtf(device->DeviceName); - } - for(i = 0;i < VECTOR_SIZE(device->Hrtf.List);i++) - { - const struct Hrtf *hrtf = VECTOR_ELEM(device->Hrtf.List, i).hrtf; - if(hrtf->sampleRate == device->Frequency) - break; - } - } - if(i == VECTOR_SIZE(device->Hrtf.List)) - { - ERR("Requested format not HRTF compatible: %s, %uhz\n", - DevFmtChannelsString(device->FmtChans), device->Frequency); - hrtf_appreq = Hrtf_Disable; - device->Hrtf.Status = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT; - } - } oldFreq = device->Frequency; oldChans = device->FmtChans; @@ -2040,15 +2153,14 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) ); aluInitRenderer(device, hrtf_id, hrtf_appreq, hrtf_userreq); + TRACE("Channel config, Dry: %d, FOA: %d, Real: %d\n", device->Dry.NumChannels, + device->FOAOut.NumChannels, device->RealOut.NumChannels); /* Allocate extra channels for any post-filter output. */ - size = device->Dry.NumChannels * sizeof(device->Dry.Buffer[0]); - if((device->AmbiDecoder && bformatdec_getOrder(device->AmbiDecoder) >= 2)) - size += (ChannelsFromDevFmt(device->FmtChans)+4) * sizeof(device->Dry.Buffer[0]); - else if(device->Hrtf.Handle || device->Uhj_Encoder || device->AmbiDecoder) - size += ChannelsFromDevFmt(device->FmtChans) * sizeof(device->Dry.Buffer[0]); - else if(device->FmtChans > DevFmtAmbi1 && device->FmtChans <= DevFmtAmbi3) - size += 4 * sizeof(device->Dry.Buffer[0]); + size = (device->Dry.NumChannels + device->FOAOut.NumChannels + + device->RealOut.NumChannels)*sizeof(device->Dry.Buffer[0]); + + TRACE("Allocating "SZFMT" channels, "SZFMT" bytes\n", size/sizeof(device->Dry.Buffer[0]), size); device->Dry.Buffer = al_calloc(16, size); if(!device->Dry.Buffer) { @@ -2056,100 +2168,214 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) return ALC_INVALID_DEVICE; } - if(device->Hrtf.Handle || device->Uhj_Encoder || device->AmbiDecoder) - { - device->RealOut.Buffer = device->Dry.Buffer + device->Dry.NumChannels; - device->RealOut.NumChannels = ChannelsFromDevFmt(device->FmtChans); - } + if(device->RealOut.NumChannels != 0) + device->RealOut.Buffer = device->Dry.Buffer + device->Dry.NumChannels + + device->FOAOut.NumChannels; else { device->RealOut.Buffer = device->Dry.Buffer; device->RealOut.NumChannels = device->Dry.NumChannels; } - if((device->AmbiDecoder && bformatdec_getOrder(device->AmbiDecoder) >= 2) || - (device->FmtChans > DevFmtAmbi1 && device->FmtChans <= DevFmtAmbi3)) - { - /* Higher-order rendering requires upsampling first-order content, so - * make sure to mix it separately. - */ - device->FOAOut.Buffer = device->RealOut.Buffer + device->RealOut.NumChannels; - device->FOAOut.NumChannels = 4; - } + if(device->FOAOut.NumChannels != 0) + device->FOAOut.Buffer = device->Dry.Buffer + device->Dry.NumChannels; else { device->FOAOut.Buffer = device->Dry.Buffer; device->FOAOut.NumChannels = device->Dry.NumChannels; } - SetMixerFPUMode(&oldMode); - if(device->DefaultSlot) + device->NumAuxSends = new_sends; + TRACE("Max sources: %d (%d + %d), effect slots: %d, sends: %d\n", + device->SourcesMax, device->NumMonoSources, device->NumStereoSources, + device->AuxiliaryEffectSlotMax, device->NumAuxSends); + + device->DitherDepth = 0.0f; + if(GetConfigValueBool(alstr_get_cstr(device->DeviceName), NULL, "dither", 1)) { - ALeffectslot *slot = device->DefaultSlot; - ALeffectState *state = slot->Effect.State; - - state->OutBuffer = device->Dry.Buffer; - state->OutChannels = device->Dry.NumChannels; - if(V(state,deviceUpdate)(device) == AL_FALSE) + ALint depth = 0; + ConfigValueInt(alstr_get_cstr(device->DeviceName), NULL, "dither-depth", &depth); + if(depth <= 0) { - RestoreFPUMode(&oldMode); - return ALC_INVALID_DEVICE; + switch(device->FmtType) + { + case DevFmtByte: + case DevFmtUByte: + depth = 8; + break; + case DevFmtShort: + case DevFmtUShort: + depth = 16; + break; + case DevFmtInt: + case DevFmtUInt: + case DevFmtFloat: + break; + } } - UpdateEffectSlotProps(slot); + else if(depth > 24) + depth = 24; + device->DitherDepth = (depth > 0) ? powf(2.0f, (ALfloat)(depth-1)) : 0.0f; } + if(!(device->DitherDepth > 0.0f)) + TRACE("Dithering disabled\n"); + else + TRACE("Dithering enabled (%g-bit, %g)\n", log2f(device->DitherDepth)+1.0f, + device->DitherDepth); - context = ATOMIC_LOAD(&device->ContextList); + if(ConfigValueBool(alstr_get_cstr(device->DeviceName), NULL, "output-limiter", &val)) + gainLimiter = val ? ALC_TRUE : ALC_FALSE; + /* Valid values for gainLimiter are ALC_DONT_CARE_SOFT, ALC_TRUE, and + * ALC_FALSE. We default to on, so ALC_DONT_CARE_SOFT is the same as + * ALC_TRUE. + */ + if(gainLimiter != ALC_FALSE) + { + if(!device->Limiter || device->Frequency != GetCompressorSampleRate(device->Limiter)) + { + al_free(device->Limiter); + device->Limiter = CreateDeviceLimiter(device); + } + } + else + { + al_free(device->Limiter); + device->Limiter = NULL; + } + TRACE("Output limiter %s\n", device->Limiter ? "enabled" : "disabled"); + + aluSelectPostProcess(device); + + /* Need to delay returning failure until replacement Send arrays have been + * allocated with the appropriate size. + */ + update_failed = AL_FALSE; + START_MIXER_MODE(); + context = ATOMIC_LOAD_SEQ(&device->ContextList); while(context) { + SourceSubList *sublist, *subend; + struct ALvoiceProps *vprops; ALsizei pos; - ReadLock(&context->PropLock); - LockUIntMapRead(&context->EffectSlotMap); - for(pos = 0;pos < context->EffectSlotMap.size;pos++) + if(context->DefaultSlot) { - ALeffectslot *slot = context->EffectSlotMap.values[pos]; + ALeffectslot *slot = context->DefaultSlot; ALeffectState *state = slot->Effect.State; state->OutBuffer = device->Dry.Buffer; state->OutChannels = device->Dry.NumChannels; if(V(state,deviceUpdate)(device) == AL_FALSE) - { - UnlockUIntMapRead(&context->EffectSlotMap); - ReadUnlock(&context->PropLock); - RestoreFPUMode(&oldMode); - return ALC_INVALID_DEVICE; - } - - UpdateEffectSlotProps(slot); + update_failed = AL_TRUE; + else + UpdateEffectSlotProps(slot, context); } - UnlockUIntMapRead(&context->EffectSlotMap); - LockUIntMapRead(&context->SourceMap); - for(pos = 0;pos < context->SourceMap.size;pos++) + almtx_lock(&context->PropLock); + almtx_lock(&context->EffectSlotLock); + for(pos = 0;pos < (ALsizei)VECTOR_SIZE(context->EffectSlotList);pos++) { - ALsource *source = context->SourceMap.values[pos]; - ALuint s = device->NumAuxSends; - while(s < MAX_SENDS) + ALeffectslot *slot = VECTOR_ELEM(context->EffectSlotList, pos); + ALeffectState *state = slot->Effect.State; + + state->OutBuffer = device->Dry.Buffer; + state->OutChannels = device->Dry.NumChannels; + if(V(state,deviceUpdate)(device) == AL_FALSE) + update_failed = AL_TRUE; + else + UpdateEffectSlotProps(slot, context); + } + almtx_unlock(&context->EffectSlotLock); + + almtx_lock(&context->SourceLock); + sublist = VECTOR_BEGIN(context->SourceList); + subend = VECTOR_END(context->SourceList); + for(;sublist != subend;++sublist) + { + ALuint64 usemask = ~sublist->FreeMask; + while(usemask) { - if(source->Send[s].Slot) - DecrementRef(&source->Send[s].Slot->ref); - source->Send[s].Slot = NULL; - source->Send[s].Gain = 1.0f; - source->Send[s].GainHF = 1.0f; - source->Send[s].HFReference = LOWPASSFREQREF; - source->Send[s].GainLF = 1.0f; - source->Send[s].LFReference = HIGHPASSFREQREF; - s++; + ALsizei idx = CTZ64(usemask); + ALsource *source = sublist->Sources + idx; + + usemask &= ~(U64(1) << idx); + + if(old_sends != device->NumAuxSends) + { + ALvoid *sends = al_calloc(16, device->NumAuxSends*sizeof(source->Send[0])); + ALsizei s; + + memcpy(sends, source->Send, + mini(device->NumAuxSends, old_sends)*sizeof(source->Send[0]) + ); + for(s = device->NumAuxSends;s < old_sends;s++) + { + if(source->Send[s].Slot) + DecrementRef(&source->Send[s].Slot->ref); + source->Send[s].Slot = NULL; + } + al_free(source->Send); + source->Send = sends; + for(s = old_sends;s < device->NumAuxSends;s++) + { + source->Send[s].Slot = NULL; + source->Send[s].Gain = 1.0f; + source->Send[s].GainHF = 1.0f; + source->Send[s].HFReference = LOWPASSFREQREF; + source->Send[s].GainLF = 1.0f; + source->Send[s].LFReference = HIGHPASSFREQREF; + } + } + + ATOMIC_FLAG_CLEAR(&source->PropsClean, almemory_order_release); } } - UnlockUIntMapRead(&context->SourceMap); + /* Clear any pre-existing voice property structs, in case the number of + * auxiliary sends is changing. Active sources will have updates + * respecified in UpdateAllSourceProps. + */ + vprops = ATOMIC_EXCHANGE_PTR(&context->FreeVoiceProps, NULL, almemory_order_acq_rel); + while(vprops) + { + struct ALvoiceProps *next = ATOMIC_LOAD(&vprops->next, almemory_order_relaxed); + al_free(vprops); + vprops = next; + } + + AllocateVoices(context, context->MaxVoices, old_sends); + for(pos = 0;pos < context->VoiceCount;pos++) + { + ALvoice *voice = context->Voices[pos]; + + al_free(ATOMIC_EXCHANGE_PTR(&voice->Update, NULL, almemory_order_acq_rel)); + + if(ATOMIC_LOAD(&voice->Source, almemory_order_acquire) == NULL) + continue; + + if(device->AvgSpeakerDist > 0.0f) + { + /* Reinitialize the NFC filters for new parameters. */ + ALfloat w1 = SPEEDOFSOUNDMETRESPERSEC / + (device->AvgSpeakerDist * device->Frequency); + for(i = 0;i < voice->NumChannels;i++) + NfcFilterCreate(&voice->Direct.Params[i].NFCtrlFilter, 0.0f, w1); + } + } + almtx_unlock(&context->SourceLock); + + ATOMIC_FLAG_TEST_AND_SET(&context->PropsClean, almemory_order_release); + UpdateContextProps(context); + ATOMIC_FLAG_TEST_AND_SET(&context->Listener->PropsClean, almemory_order_release); + UpdateListenerProps(context); UpdateAllSourceProps(context); - ReadUnlock(&context->PropLock); + almtx_unlock(&context->PropLock); - context = context->next; + context = ATOMIC_LOAD(&context->next, almemory_order_relaxed); } - RestoreFPUMode(&oldMode); + END_MIXER_MODE(); + if(update_failed) + return ALC_INVALID_DEVICE; if(!(device->Flags&DEVICE_PAUSED)) { @@ -2161,6 +2387,71 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) return ALC_NO_ERROR; } + +static void InitDevice(ALCdevice *device, enum DeviceType type) +{ + ALsizei i; + + InitRef(&device->ref, 1); + ATOMIC_INIT(&device->Connected, ALC_TRUE); + device->Type = type; + ATOMIC_INIT(&device->LastError, ALC_NO_ERROR); + + device->Flags = 0; + device->Render_Mode = NormalRender; + device->AvgSpeakerDist = 0.0f; + + ATOMIC_INIT(&device->ContextList, NULL); + + device->ClockBase = 0; + device->SamplesDone = 0; + + device->SourcesMax = 0; + device->AuxiliaryEffectSlotMax = 0; + device->NumAuxSends = 0; + + device->Dry.Buffer = NULL; + device->Dry.NumChannels = 0; + device->FOAOut.Buffer = NULL; + device->FOAOut.NumChannels = 0; + device->RealOut.Buffer = NULL; + device->RealOut.NumChannels = 0; + + AL_STRING_INIT(device->DeviceName); + + for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) + { + device->ChannelDelay[i].Gain = 1.0f; + device->ChannelDelay[i].Length = 0; + device->ChannelDelay[i].Buffer = NULL; + } + + AL_STRING_INIT(device->HrtfName); + VECTOR_INIT(device->HrtfList); + device->HrtfHandle = NULL; + device->Hrtf = NULL; + device->Bs2b = NULL; + device->Uhj_Encoder = NULL; + device->AmbiDecoder = NULL; + device->AmbiUp = NULL; + device->Stablizer = NULL; + device->Limiter = NULL; + + VECTOR_INIT(device->BufferList); + almtx_init(&device->BufferLock, almtx_plain); + + VECTOR_INIT(device->EffectList); + almtx_init(&device->EffectLock, almtx_plain); + + VECTOR_INIT(device->FilterList); + almtx_init(&device->FilterLock, almtx_plain); + + almtx_init(&device->BackendLock, almtx_plain); + device->Backend = NULL; + + ATOMIC_INIT(&device->next, NULL); +} + /* FreeDevice * * Frees the device structure, and destroys any objects the app failed to @@ -2168,46 +2459,44 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const ALCint *attrList) */ static ALCvoid FreeDevice(ALCdevice *device) { + ALsizei i; + TRACE("%p\n", device); - V0(device->Backend,close)(); - DELETE_OBJ(device->Backend); + if(device->Backend) + DELETE_OBJ(device->Backend); device->Backend = NULL; almtx_destroy(&device->BackendLock); - if(device->DefaultSlot) - { - DeinitEffectSlot(device->DefaultSlot); - device->DefaultSlot = NULL; - } + ReleaseALBuffers(device); +#define FREE_BUFFERSUBLIST(x) al_free((x)->Buffers) + VECTOR_FOR_EACH(BufferSubList, device->BufferList, FREE_BUFFERSUBLIST); +#undef FREE_BUFFERSUBLIST + VECTOR_DEINIT(device->BufferList); + almtx_destroy(&device->BufferLock); - if(device->BufferMap.size > 0) - { - WARN("(%p) Deleting %d Buffer%s\n", device, device->BufferMap.size, - (device->BufferMap.size==1)?"":"s"); - ReleaseALBuffers(device); - } - ResetUIntMap(&device->BufferMap); + ReleaseALEffects(device); +#define FREE_EFFECTSUBLIST(x) al_free((x)->Effects) + VECTOR_FOR_EACH(EffectSubList, device->EffectList, FREE_EFFECTSUBLIST); +#undef FREE_EFFECTSUBLIST + VECTOR_DEINIT(device->EffectList); + almtx_destroy(&device->EffectLock); - if(device->EffectMap.size > 0) - { - WARN("(%p) Deleting %d Effect%s\n", device, device->EffectMap.size, - (device->EffectMap.size==1)?"":"s"); - ReleaseALEffects(device); - } - ResetUIntMap(&device->EffectMap); + ReleaseALFilters(device); +#define FREE_FILTERSUBLIST(x) al_free((x)->Filters) + VECTOR_FOR_EACH(FilterSubList, device->FilterList, FREE_FILTERSUBLIST); +#undef FREE_FILTERSUBLIST + VECTOR_DEINIT(device->FilterList); + almtx_destroy(&device->FilterLock); - if(device->FilterMap.size > 0) - { - WARN("(%p) Deleting %d Filter%s\n", device, device->FilterMap.size, - (device->FilterMap.size==1)?"":"s"); - ReleaseALFilters(device); - } - ResetUIntMap(&device->FilterMap); - - AL_STRING_DEINIT(device->Hrtf.Name); - FreeHrtfList(&device->Hrtf.List); + AL_STRING_DEINIT(device->HrtfName); + FreeHrtfList(&device->HrtfList); + if(device->HrtfHandle) + Hrtf_DecRef(device->HrtfHandle); + device->HrtfHandle = NULL; + al_free(device->Hrtf); + device->Hrtf = NULL; al_free(device->Bs2b); device->Bs2b = NULL; @@ -2215,11 +2504,22 @@ static ALCvoid FreeDevice(ALCdevice *device) al_free(device->Uhj_Encoder); device->Uhj_Encoder = NULL; - bformatdec_free(device->AmbiDecoder); - device->AmbiDecoder = NULL; + bformatdec_free(&device->AmbiDecoder); + ambiup_free(&device->AmbiUp); - ambiup_free(device->AmbiUp); - device->AmbiUp = NULL; + al_free(device->Stablizer); + device->Stablizer = NULL; + + al_free(device->Limiter); + device->Limiter = NULL; + + al_free(device->ChannelDelay[0].Buffer); + for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) + { + device->ChannelDelay[i].Gain = 1.0f; + device->ChannelDelay[i].Length = 0; + device->ChannelDelay[i].Buffer = NULL; + } AL_STRING_DEINIT(device->DeviceName); @@ -2259,7 +2559,7 @@ static ALCboolean VerifyDevice(ALCdevice **device) ALCdevice *tmpDevice; LockLists(); - tmpDevice = ATOMIC_LOAD(&DeviceList); + tmpDevice = ATOMIC_LOAD_SEQ(&DeviceList); while(tmpDevice) { if(tmpDevice == *device) @@ -2268,7 +2568,7 @@ static ALCboolean VerifyDevice(ALCdevice **device) UnlockLists(); return ALC_TRUE; } - tmpDevice = tmpDevice->next; + tmpDevice = ATOMIC_LOAD(&tmpDevice->next, almemory_order_relaxed); } UnlockLists(); @@ -2284,10 +2584,10 @@ static ALCboolean VerifyDevice(ALCdevice **device) static ALvoid InitContext(ALCcontext *Context) { ALlistener *listener = Context->Listener; + struct ALeffectslotArray *auxslots; //Initialise listener listener->Gain = 1.0f; - listener->MetersPerUnit = 1.0f; listener->Position[0] = 0.0f; listener->Position[1] = 0.0f; listener->Position[2] = 0.0f; @@ -2300,30 +2600,34 @@ static ALvoid InitContext(ALCcontext *Context) listener->Up[0] = 0.0f; listener->Up[1] = 1.0f; listener->Up[2] = 0.0f; - - aluMatrixfSet(&listener->Params.Matrix, - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f - ); - aluVectorSet(&listener->Params.Velocity, 0.0f, 0.0f, 0.0f, 0.0f); - listener->Params.Gain = 1.0f; - listener->Params.MetersPerUnit = 1.0f; - listener->Params.DopplerFactor = 1.0f; - listener->Params.SpeedOfSound = SPEEDOFSOUNDMETRESPERSEC; + ATOMIC_FLAG_TEST_AND_SET(&listener->PropsClean, almemory_order_relaxed); ATOMIC_INIT(&listener->Update, NULL); - ATOMIC_INIT(&listener->FreeList, NULL); //Validate Context InitRef(&Context->UpdateCount, 0); ATOMIC_INIT(&Context->HoldUpdates, AL_FALSE); Context->GainBoost = 1.0f; - RWLockInit(&Context->PropLock); + almtx_init(&Context->PropLock, almtx_plain); ATOMIC_INIT(&Context->LastError, AL_NO_ERROR); - InitUIntMap(&Context->SourceMap, Context->Device->SourcesMax); - InitUIntMap(&Context->EffectSlotMap, Context->Device->AuxiliaryEffectSlotMax); + VECTOR_INIT(Context->SourceList); + Context->NumSources = 0; + almtx_init(&Context->SourceLock, almtx_plain); + VECTOR_INIT(Context->EffectSlotList); + almtx_init(&Context->EffectSlotLock, almtx_plain); + + if(Context->DefaultSlot) + { + auxslots = al_calloc(DEF_ALIGN, FAM_SIZE(struct ALeffectslotArray, slot, 1)); + auxslots->count = 1; + auxslots->slot[0] = Context->DefaultSlot; + } + else + { + auxslots = al_calloc(DEF_ALIGN, sizeof(struct ALeffectslotArray)); + auxslots->count = 0; + } + ATOMIC_INIT(&Context->ActiveAuxSlots, auxslots); //Set globals Context->DistanceModel = DefaultDistanceModel; @@ -2331,9 +2635,36 @@ static ALvoid InitContext(ALCcontext *Context) Context->DopplerFactor = 1.0f; Context->DopplerVelocity = 1.0f; Context->SpeedOfSound = SPEEDOFSOUNDMETRESPERSEC; + Context->MetersPerUnit = AL_DEFAULT_METERS_PER_UNIT; + ATOMIC_FLAG_TEST_AND_SET(&Context->PropsClean, almemory_order_relaxed); ATOMIC_INIT(&Context->DeferUpdates, AL_FALSE); + almtx_init(&Context->EventThrdLock, almtx_plain); + alsem_init(&Context->EventSem, 0); + Context->AsyncEvents = NULL; + ATOMIC_INIT(&Context->EnabledEvts, 0); + almtx_init(&Context->EventCbLock, almtx_plain); + Context->EventCb = NULL; + Context->EventParam = NULL; + + ATOMIC_INIT(&Context->Update, NULL); + ATOMIC_INIT(&Context->FreeContextProps, NULL); + ATOMIC_INIT(&Context->FreeListenerProps, NULL); + ATOMIC_INIT(&Context->FreeVoiceProps, NULL); + ATOMIC_INIT(&Context->FreeEffectslotProps, NULL); Context->ExtensionList = alExtList; + + + listener->Params.Matrix = IdentityMatrixf; + aluVectorSet(&listener->Params.Velocity, 0.0f, 0.0f, 0.0f, 0.0f); + listener->Params.Gain = listener->Gain; + listener->Params.MetersPerUnit = Context->MetersPerUnit; + listener->Params.DopplerFactor = Context->DopplerFactor; + listener->Params.SpeedOfSound = Context->SpeedOfSound * Context->DopplerVelocity; + listener->Params.ReverbSpeedOfSound = listener->Params.SpeedOfSound * + listener->Params.MetersPerUnit; + listener->Params.SourceDistanceModel = Context->SourceDistanceModel; + listener->Params.DistanceModel = Context->DistanceModel; } @@ -2345,27 +2676,82 @@ static ALvoid InitContext(ALCcontext *Context) static void FreeContext(ALCcontext *context) { ALlistener *listener = context->Listener; + struct ALeffectslotArray *auxslots; + struct ALeffectslotProps *eprops; struct ALlistenerProps *lprops; + struct ALcontextProps *cprops; + struct ALvoiceProps *vprops; size_t count; + ALsizei i; TRACE("%p\n", context); - if(context->SourceMap.size > 0) + if((cprops=ATOMIC_LOAD(&context->Update, almemory_order_acquire)) != NULL) { - WARN("(%p) Deleting %d Source%s\n", context, context->SourceMap.size, - (context->SourceMap.size==1)?"":"s"); - ReleaseALSources(context); + TRACE("Freed unapplied context update %p\n", cprops); + al_free(cprops); } - ResetUIntMap(&context->SourceMap); - if(context->EffectSlotMap.size > 0) + count = 0; + cprops = ATOMIC_LOAD(&context->FreeContextProps, almemory_order_acquire); + while(cprops) { - WARN("(%p) Deleting %d AuxiliaryEffectSlot%s\n", context, context->EffectSlotMap.size, - (context->EffectSlotMap.size==1)?"":"s"); - ReleaseALAuxiliaryEffectSlots(context); + struct ALcontextProps *next = ATOMIC_LOAD(&cprops->next, almemory_order_acquire); + al_free(cprops); + cprops = next; + ++count; } - ResetUIntMap(&context->EffectSlotMap); + TRACE("Freed "SZFMT" context property object%s\n", count, (count==1)?"":"s"); + if(context->DefaultSlot) + { + DeinitEffectSlot(context->DefaultSlot); + context->DefaultSlot = NULL; + } + + auxslots = ATOMIC_EXCHANGE_PTR(&context->ActiveAuxSlots, NULL, almemory_order_relaxed); + al_free(auxslots); + + ReleaseALSources(context); +#define FREE_SOURCESUBLIST(x) al_free((x)->Sources) + VECTOR_FOR_EACH(SourceSubList, context->SourceList, FREE_SOURCESUBLIST); +#undef FREE_SOURCESUBLIST + VECTOR_DEINIT(context->SourceList); + context->NumSources = 0; + almtx_destroy(&context->SourceLock); + + count = 0; + eprops = ATOMIC_LOAD(&context->FreeEffectslotProps, almemory_order_relaxed); + while(eprops) + { + struct ALeffectslotProps *next = ATOMIC_LOAD(&eprops->next, almemory_order_relaxed); + if(eprops->State) ALeffectState_DecRef(eprops->State); + al_free(eprops); + eprops = next; + ++count; + } + TRACE("Freed "SZFMT" AuxiliaryEffectSlot property object%s\n", count, (count==1)?"":"s"); + + ReleaseALAuxiliaryEffectSlots(context); +#define FREE_EFFECTSLOTPTR(x) al_free(*(x)) + VECTOR_FOR_EACH(ALeffectslotPtr, context->EffectSlotList, FREE_EFFECTSLOTPTR); +#undef FREE_EFFECTSLOTPTR + VECTOR_DEINIT(context->EffectSlotList); + almtx_destroy(&context->EffectSlotLock); + + count = 0; + vprops = ATOMIC_LOAD(&context->FreeVoiceProps, almemory_order_relaxed); + while(vprops) + { + struct ALvoiceProps *next = ATOMIC_LOAD(&vprops->next, almemory_order_relaxed); + al_free(vprops); + vprops = next; + ++count; + } + TRACE("Freed "SZFMT" voice property object%s\n", count, (count==1)?"":"s"); + + for(i = 0;i < context->VoiceCount;i++) + DeinitVoice(context->Voices[i]); al_free(context->Voices); context->Voices = NULL; context->VoiceCount = 0; @@ -2377,16 +2763,34 @@ static void FreeContext(ALCcontext *context) al_free(lprops); } count = 0; - lprops = ATOMIC_LOAD(&listener->FreeList, almemory_order_consume); + lprops = ATOMIC_LOAD(&context->FreeListenerProps, almemory_order_acquire); while(lprops) { - struct ALlistenerProps *next = ATOMIC_LOAD(&lprops->next, almemory_order_consume); + struct ALlistenerProps *next = ATOMIC_LOAD(&lprops->next, almemory_order_acquire); al_free(lprops); lprops = next; ++count; } TRACE("Freed "SZFMT" listener property object%s\n", count, (count==1)?"":"s"); + if(ATOMIC_EXCHANGE(&context->EnabledEvts, 0, almemory_order_acq_rel)) + { + static const AsyncEvent kill_evt = { 0 }; + while(ll_ringbuffer_write(context->AsyncEvents, (const char*)&kill_evt, 1) == 0) + althrd_yield(); + alsem_post(&context->EventSem); + althrd_join(context->EventThread, NULL); + } + + almtx_destroy(&context->EventCbLock); + almtx_destroy(&context->EventThrdLock); + alsem_destroy(&context->EventSem); + + ll_ringbuffer_free(context->AsyncEvents); + context->AsyncEvents = NULL; + + almtx_destroy(&context->PropLock); + ALCdevice_DecRef(context->Device); context->Device = NULL; @@ -2398,12 +2802,13 @@ static void FreeContext(ALCcontext *context) /* ReleaseContext * * Removes the context reference from the given device and removes it from - * being current on the running thread or globally. + * being current on the running thread or globally. Returns true if other + * contexts still exist on the device. */ -static void ReleaseContext(ALCcontext *context, ALCdevice *device) +static bool ReleaseContext(ALCcontext *context, ALCdevice *device) { - ALCcontext *nextctx; - ALCcontext *origctx; + ALCcontext *origctx, *newhead; + bool ret = true; if(altss_get(LocalContext) == context) { @@ -2413,26 +2818,32 @@ static void ReleaseContext(ALCcontext *context, ALCdevice *device) } origctx = context; - if(ATOMIC_COMPARE_EXCHANGE_STRONG(ALCcontext*, &GlobalContext, &origctx, NULL)) + if(ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&GlobalContext, &origctx, NULL)) ALCcontext_DecRef(context); - ALCdevice_Lock(device); + V0(device->Backend,lock)(); origctx = context; - nextctx = context->next; - if(!ATOMIC_COMPARE_EXCHANGE_STRONG(ALCcontext*, &device->ContextList, &origctx, nextctx)) + newhead = ATOMIC_LOAD(&context->next, almemory_order_relaxed); + if(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&device->ContextList, &origctx, newhead)) { ALCcontext *list; do { + /* origctx is what the desired context failed to match. Try + * swapping out the next one in the list. + */ list = origctx; origctx = context; - } while(!COMPARE_EXCHANGE(&list->next, &origctx, nextctx)); + } while(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&list->next, &origctx, newhead)); } - ALCdevice_Unlock(device); + else + ret = !!newhead; + V0(device->Backend,unlock)(); ALCcontext_DecRef(context); + return ret; } -void ALCcontext_IncRef(ALCcontext *context) +static void ALCcontext_IncRef(ALCcontext *context) { uint ref = IncrementRef(&context->ref); TRACEREF("%p increasing refcount to %u\n", context, ref); @@ -2462,10 +2873,10 @@ static ALCboolean VerifyContext(ALCcontext **context) ALCdevice *dev; LockLists(); - dev = ATOMIC_LOAD(&DeviceList); + dev = ATOMIC_LOAD_SEQ(&DeviceList); while(dev) { - ALCcontext *ctx = ATOMIC_LOAD(&dev->ContextList); + ALCcontext *ctx = ATOMIC_LOAD(&dev->ContextList, almemory_order_acquire); while(ctx) { if(ctx == *context) @@ -2474,9 +2885,9 @@ static ALCboolean VerifyContext(ALCcontext **context) UnlockLists(); return ALC_TRUE; } - ctx = ctx->next; + ctx = ATOMIC_LOAD(&ctx->next, almemory_order_relaxed); } - dev = dev->next; + dev = ATOMIC_LOAD(&dev->next, almemory_order_relaxed); } UnlockLists(); @@ -2500,7 +2911,7 @@ ALCcontext *GetContextRef(void) else { LockLists(); - context = ATOMIC_LOAD(&GlobalContext); + context = ATOMIC_LOAD_SEQ(&GlobalContext); if(context) ALCcontext_IncRef(context); UnlockLists(); @@ -2510,6 +2921,91 @@ ALCcontext *GetContextRef(void) } +void AllocateVoices(ALCcontext *context, ALsizei num_voices, ALsizei old_sends) +{ + ALCdevice *device = context->Device; + ALsizei num_sends = device->NumAuxSends; + struct ALvoiceProps *props; + size_t sizeof_props; + size_t sizeof_voice; + ALvoice **voices; + ALvoice *voice; + ALsizei v = 0; + size_t size; + + if(num_voices == context->MaxVoices && num_sends == old_sends) + return; + + /* Allocate the voice pointers, voices, and the voices' stored source + * property set (including the dynamically-sized Send[] array) in one + * chunk. + */ + sizeof_voice = RoundUp(FAM_SIZE(ALvoice, Send, num_sends), 16); + sizeof_props = RoundUp(FAM_SIZE(struct ALvoiceProps, Send, num_sends), 16); + size = sizeof(ALvoice*) + sizeof_voice + sizeof_props; + + voices = al_calloc(16, RoundUp(size*num_voices, 16)); + /* The voice and property objects are stored interleaved since they're + * paired together. + */ + voice = (ALvoice*)((char*)voices + RoundUp(num_voices*sizeof(ALvoice*), 16)); + props = (struct ALvoiceProps*)((char*)voice + sizeof_voice); + + if(context->Voices) + { + const ALsizei v_count = mini(context->VoiceCount, num_voices); + const ALsizei s_count = mini(old_sends, num_sends); + + for(;v < v_count;v++) + { + ALvoice *old_voice = context->Voices[v]; + ALsizei i; + + /* Copy the old voice data and source property set to the new + * storage. + */ + *voice = *old_voice; + for(i = 0;i < s_count;i++) + voice->Send[i] = old_voice->Send[i]; + *props = *(old_voice->Props); + for(i = 0;i < s_count;i++) + props->Send[i] = old_voice->Props->Send[i]; + + /* Set this voice's property set pointer and voice reference. */ + voice->Props = props; + voices[v] = voice; + + /* Increment pointers to the next storage space. */ + voice = (ALvoice*)((char*)props + sizeof_props); + props = (struct ALvoiceProps*)((char*)voice + sizeof_voice); + } + /* Deinit any left over voices that weren't copied over to the new + * array. NOTE: If this does anything, v equals num_voices and + * num_voices is less than VoiceCount, so the following loop won't do + * anything. + */ + for(;v < context->VoiceCount;v++) + DeinitVoice(context->Voices[v]); + } + /* Finish setting the voices' property set pointers and references. */ + for(;v < num_voices;v++) + { + ATOMIC_INIT(&voice->Update, NULL); + + voice->Props = props; + voices[v] = voice; + + voice = (ALvoice*)((char*)props + sizeof_props); + props = (struct ALvoiceProps*)((char*)voice + sizeof_voice); + } + + al_free(context->Voices); + context->Voices = voices; + context->MaxVoices = num_voices; + context->VoiceCount = mini(context->VoiceCount, num_voices); +} + + /************************************************ * Standard ALC functions ************************************************/ @@ -2524,11 +3020,11 @@ ALC_API ALCenum ALC_APIENTRY alcGetError(ALCdevice *device) if(VerifyDevice(&device)) { - errorCode = ATOMIC_EXCHANGE(ALCenum, &device->LastError, ALC_NO_ERROR); + errorCode = ATOMIC_EXCHANGE_SEQ(&device->LastError, ALC_NO_ERROR); ALCdevice_DecRef(device); } else - errorCode = ATOMIC_EXCHANGE(ALCenum, &LastNullDeviceError, ALC_NO_ERROR); + errorCode = ATOMIC_EXCHANGE_SEQ(&LastNullDeviceError, ALC_NO_ERROR); return errorCode; } @@ -2547,7 +3043,7 @@ ALC_API ALCvoid ALC_APIENTRY alcSuspendContext(ALCcontext *context) alcSetError(NULL, ALC_INVALID_CONTEXT); else { - ALCcontext_DeferUpdates(context, DeferAllowPlay); + ALCcontext_DeferUpdates(context); ALCcontext_DecRef(context); } } @@ -2612,26 +3108,26 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para case ALC_ALL_DEVICES_SPECIFIER: if(VerifyDevice(&Device)) { - value = al_string_get_cstr(Device->DeviceName); + value = alstr_get_cstr(Device->DeviceName); ALCdevice_DecRef(Device); } else { ProbeAllDevicesList(); - value = al_string_get_cstr(alcAllDevicesList); + value = alstr_get_cstr(alcAllDevicesList); } break; case ALC_CAPTURE_DEVICE_SPECIFIER: if(VerifyDevice(&Device)) { - value = al_string_get_cstr(Device->DeviceName); + value = alstr_get_cstr(Device->DeviceName); ALCdevice_DecRef(Device); } else { ProbeCaptureDeviceList(); - value = al_string_get_cstr(alcCaptureDeviceList); + value = alstr_get_cstr(alcCaptureDeviceList); } break; @@ -2641,13 +3137,13 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para break; case ALC_DEFAULT_ALL_DEVICES_SPECIFIER: - if(al_string_empty(alcAllDevicesList)) + if(alstr_empty(alcAllDevicesList)) ProbeAllDevicesList(); VerifyDevice(&Device); free(alcDefaultAllDevicesSpecifier); - alcDefaultAllDevicesSpecifier = strdup(al_string_get_cstr(alcAllDevicesList)); + alcDefaultAllDevicesSpecifier = strdup(alstr_get_cstr(alcAllDevicesList)); if(!alcDefaultAllDevicesSpecifier) alcSetError(Device, ALC_OUT_OF_MEMORY); @@ -2656,13 +3152,13 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para break; case ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER: - if(al_string_empty(alcCaptureDeviceList)) + if(alstr_empty(alcCaptureDeviceList)) ProbeCaptureDeviceList(); VerifyDevice(&Device); free(alcCaptureDefaultDeviceSpecifier); - alcCaptureDefaultDeviceSpecifier = strdup(al_string_get_cstr(alcCaptureDeviceList)); + alcCaptureDefaultDeviceSpecifier = strdup(alstr_get_cstr(alcCaptureDeviceList)); if(!alcCaptureDefaultDeviceSpecifier) alcSetError(Device, ALC_OUT_OF_MEMORY); @@ -2686,7 +3182,7 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para else { almtx_lock(&Device->BackendLock); - value = (Device->Hrtf.Handle ? al_string_get_cstr(Device->Hrtf.Name) : ""); + value = (Device->HrtfHandle ? alstr_get_cstr(Device->HrtfName) : ""); almtx_unlock(&Device->BackendLock); ALCdevice_DecRef(Device); } @@ -2703,6 +3199,15 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *Device, ALCenum para } +static inline ALCsizei NumAttrsForDevice(ALCdevice *device) +{ + if(device->Type == Capture) return 9; + if(device->Type != Loopback) return 29; + if(device->FmtChans == DevFmtAmbi3D) + return 35; + return 29; +} + static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values) { ALCsizei i; @@ -2734,6 +3239,10 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC case ALC_CAPTURE_SAMPLES: case ALC_FORMAT_CHANNELS_SOFT: case ALC_FORMAT_TYPE_SOFT: + case ALC_AMBISONIC_LAYOUT_SOFT: + case ALC_AMBISONIC_SCALING_SOFT: + case ALC_AMBISONIC_ORDER_SOFT: + case ALC_MAX_AMBISONIC_ORDER_SOFT: alcSetError(NULL, ALC_INVALID_DEVICE); return 0; @@ -2748,6 +3257,39 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC { switch(param) { + case ALC_ATTRIBUTES_SIZE: + values[0] = NumAttrsForDevice(device); + return 1; + + case ALC_ALL_ATTRIBUTES: + if(size < NumAttrsForDevice(device)) + { + alcSetError(device, ALC_INVALID_VALUE); + return 0; + } + + i = 0; + almtx_lock(&device->BackendLock); + values[i++] = ALC_MAJOR_VERSION; + values[i++] = alcMajorVersion; + values[i++] = ALC_MINOR_VERSION; + values[i++] = alcMinorVersion; + values[i++] = ALC_CAPTURE_SAMPLES; + values[i++] = V0(device->Backend,availableSamples)(); + values[i++] = ALC_CONNECTED; + values[i++] = ATOMIC_LOAD(&device->Connected, almemory_order_relaxed); + almtx_unlock(&device->BackendLock); + + values[i++] = 0; + return i; + + case ALC_MAJOR_VERSION: + values[0] = alcMajorVersion; + return 1; + case ALC_MINOR_VERSION: + values[0] = alcMinorVersion; + return 1; + case ALC_CAPTURE_SAMPLES: almtx_lock(&device->BackendLock); values[0] = V0(device->Backend,availableSamples)(); @@ -2755,7 +3297,7 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC return 1; case ALC_CONNECTED: - values[0] = device->Connected; + values[0] = ATOMIC_LOAD(&device->Connected, almemory_order_acquire); return 1; default: @@ -2768,28 +3310,12 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC /* render device */ switch(param) { - case ALC_MAJOR_VERSION: - values[0] = alcMajorVersion; - return 1; - - case ALC_MINOR_VERSION: - values[0] = alcMinorVersion; - return 1; - - case ALC_EFX_MAJOR_VERSION: - values[0] = alcEFXMajorVersion; - return 1; - - case ALC_EFX_MINOR_VERSION: - values[0] = alcEFXMinorVersion; - return 1; - case ALC_ATTRIBUTES_SIZE: - values[0] = 17; + values[0] = NumAttrsForDevice(device); return 1; case ALC_ALL_ATTRIBUTES: - if(size < 17) + if(size < NumAttrsForDevice(device)) { alcSetError(device, ALC_INVALID_VALUE); return 0; @@ -2797,9 +3323,17 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC i = 0; almtx_lock(&device->BackendLock); + values[i++] = ALC_MAJOR_VERSION; + values[i++] = alcMajorVersion; + values[i++] = ALC_MINOR_VERSION; + values[i++] = alcMinorVersion; + values[i++] = ALC_EFX_MAJOR_VERSION; + values[i++] = alcEFXMajorVersion; + values[i++] = ALC_EFX_MINOR_VERSION; + values[i++] = alcEFXMinorVersion; + values[i++] = ALC_FREQUENCY; values[i++] = device->Frequency; - if(device->Type != Loopback) { values[i++] = ALC_REFRESH; @@ -2810,6 +3344,18 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC } else { + if(device->FmtChans == DevFmtAmbi3D) + { + values[i++] = ALC_AMBISONIC_LAYOUT_SOFT; + values[i++] = device->AmbiLayout; + + values[i++] = ALC_AMBISONIC_SCALING_SOFT; + values[i++] = device->AmbiScale; + + values[i++] = ALC_AMBISONIC_ORDER_SOFT; + values[i++] = device->AmbiOrder; + } + values[i++] = ALC_FORMAT_CHANNELS_SOFT; values[i++] = device->FmtChans; @@ -2827,15 +3373,37 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC values[i++] = device->NumAuxSends; values[i++] = ALC_HRTF_SOFT; - values[i++] = (device->Hrtf.Handle ? ALC_TRUE : ALC_FALSE); + values[i++] = (device->HrtfHandle ? ALC_TRUE : ALC_FALSE); values[i++] = ALC_HRTF_STATUS_SOFT; - values[i++] = device->Hrtf.Status; + values[i++] = device->HrtfStatus; + + values[i++] = ALC_OUTPUT_LIMITER_SOFT; + values[i++] = device->Limiter ? ALC_TRUE : ALC_FALSE; + + values[i++] = ALC_MAX_AMBISONIC_ORDER_SOFT; + values[i++] = MAX_AMBI_ORDER; almtx_unlock(&device->BackendLock); values[i++] = 0; return i; + case ALC_MAJOR_VERSION: + values[0] = alcMajorVersion; + return 1; + + case ALC_MINOR_VERSION: + values[0] = alcMinorVersion; + return 1; + + case ALC_EFX_MAJOR_VERSION: + values[0] = alcEFXMajorVersion; + return 1; + + case ALC_EFX_MINOR_VERSION: + values[0] = alcEFXMinorVersion; + return 1; + case ALC_FREQUENCY: values[0] = device->Frequency; return 1; @@ -2878,6 +3446,33 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC values[0] = device->FmtType; return 1; + case ALC_AMBISONIC_LAYOUT_SOFT: + if(device->Type != Loopback || device->FmtChans != DevFmtAmbi3D) + { + alcSetError(device, ALC_INVALID_DEVICE); + return 0; + } + values[0] = device->AmbiLayout; + return 1; + + case ALC_AMBISONIC_SCALING_SOFT: + if(device->Type != Loopback || device->FmtChans != DevFmtAmbi3D) + { + alcSetError(device, ALC_INVALID_DEVICE); + return 0; + } + values[0] = device->AmbiScale; + return 1; + + case ALC_AMBISONIC_ORDER_SOFT: + if(device->Type != Loopback || device->FmtChans != DevFmtAmbi3D) + { + alcSetError(device, ALC_INVALID_DEVICE); + return 0; + } + values[0] = device->AmbiOrder; + return 1; + case ALC_MONO_SOURCES: values[0] = device->NumMonoSources; return 1; @@ -2891,25 +3486,33 @@ static ALCsizei GetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALC return 1; case ALC_CONNECTED: - values[0] = device->Connected; + values[0] = ATOMIC_LOAD(&device->Connected, almemory_order_acquire); return 1; case ALC_HRTF_SOFT: - values[0] = (device->Hrtf.Handle ? ALC_TRUE : ALC_FALSE); + values[0] = (device->HrtfHandle ? ALC_TRUE : ALC_FALSE); return 1; case ALC_HRTF_STATUS_SOFT: - values[0] = device->Hrtf.Status; + values[0] = device->HrtfStatus; return 1; case ALC_NUM_HRTF_SPECIFIERS_SOFT: almtx_lock(&device->BackendLock); - FreeHrtfList(&device->Hrtf.List); - device->Hrtf.List = EnumerateHrtf(device->DeviceName); - values[0] = (ALCint)VECTOR_SIZE(device->Hrtf.List); + FreeHrtfList(&device->HrtfList); + device->HrtfList = EnumerateHrtf(device->DeviceName); + values[0] = (ALCint)VECTOR_SIZE(device->HrtfList); almtx_unlock(&device->BackendLock); return 1; + case ALC_OUTPUT_LIMITER_SOFT: + values[0] = device->Limiter ? ALC_TRUE : ALC_FALSE; + return 1; + + case ALC_MAX_AMBISONIC_ORDER_SOFT: + values[0] = MAX_AMBI_ORDER; + return 1; + default: alcSetError(device, ALC_INVALID_ENUM); return 0; @@ -2957,11 +3560,11 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, switch(pname) { case ALC_ATTRIBUTES_SIZE: - *values = 21; + *values = NumAttrsForDevice(device)+4; break; case ALC_ALL_ATTRIBUTES: - if(size < 21) + if(size < NumAttrsForDevice(device)+4) alcSetError(device, ALC_INVALID_VALUE); else { @@ -2980,6 +3583,18 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, } else { + if(device->FmtChans == DevFmtAmbi3D) + { + values[i++] = ALC_AMBISONIC_LAYOUT_SOFT; + values[i++] = device->AmbiLayout; + + values[i++] = ALC_AMBISONIC_SCALING_SOFT; + values[i++] = device->AmbiScale; + + values[i++] = ALC_AMBISONIC_ORDER_SOFT; + values[i++] = device->AmbiOrder; + } + values[i++] = ALC_FORMAT_CHANNELS_SOFT; values[i++] = device->FmtChans; @@ -2997,10 +3612,13 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, values[i++] = device->NumAuxSends; values[i++] = ALC_HRTF_SOFT; - values[i++] = (device->Hrtf.Handle ? ALC_TRUE : ALC_FALSE); + values[i++] = (device->HrtfHandle ? ALC_TRUE : ALC_FALSE); values[i++] = ALC_HRTF_STATUS_SOFT; - values[i++] = device->Hrtf.Status; + values[i++] = device->HrtfStatus; + + values[i++] = ALC_OUTPUT_LIMITER_SOFT; + values[i++] = device->Limiter ? ALC_TRUE : ALC_FALSE; clock = V0(device->Backend,getClockLatency)(); values[i++] = ALC_DEVICE_CLOCK_SOFT; @@ -3027,12 +3645,10 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, break; case ALC_DEVICE_LATENCY_SOFT: - { - almtx_lock(&device->BackendLock); - clock = V0(device->Backend,getClockLatency)(); - almtx_unlock(&device->BackendLock); - *values = clock.Latency; - } + almtx_lock(&device->BackendLock); + clock = V0(device->Backend,getClockLatency)(); + almtx_unlock(&device->BackendLock); + *values = clock.Latency; break; case ALC_DEVICE_CLOCK_LATENCY_SOFT: @@ -3040,7 +3656,6 @@ ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, alcSetError(device, ALC_INVALID_VALUE); else { - ClockLatency clock; almtx_lock(&device->BackendLock); clock = V0(device->Backend,getClockLatency)(); almtx_unlock(&device->BackendLock); @@ -3117,10 +3732,15 @@ ALC_API ALCvoid* ALC_APIENTRY alcGetProcAddress(ALCdevice *device, const ALCchar } else { - ALsizei i = 0; - while(alcFunctions[i].funcName && strcmp(alcFunctions[i].funcName, funcName) != 0) - i++; - ptr = alcFunctions[i].address; + size_t i = 0; + for(i = 0;i < COUNTOF(alcFunctions);i++) + { + if(strcmp(alcFunctions[i].funcName, funcName) == 0) + { + ptr = alcFunctions[i].address; + break; + } + } } return ptr; @@ -3143,10 +3763,15 @@ ALC_API ALCenum ALC_APIENTRY alcGetEnumValue(ALCdevice *device, const ALCchar *e } else { - ALsizei i = 0; - while(enumeration[i].enumName && strcmp(enumeration[i].enumName, enumName) != 0) - i++; - val = enumeration[i].value; + size_t i = 0; + for(i = 0;i < COUNTOF(alcEnumerations);i++) + { + if(strcmp(alcEnumerations[i].enumName, enumName) == 0) + { + val = alcEnumerations[i].value; + break; + } + } } return val; @@ -3163,8 +3788,13 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin ALfloat valf; ALCenum err; + /* Explicitly hold the list lock while taking the BackendLock in case the + * device is asynchronously destropyed, to ensure this new context is + * properly cleaned up after being made. + */ LockLists(); - if(!VerifyDevice(&device) || device->Type == Capture || !device->Connected) + if(!VerifyDevice(&device) || device->Type == Capture || + !ATOMIC_LOAD(&device->Connected, almemory_order_relaxed)) { UnlockLists(); alcSetError(device, ALC_INVALID_DEVICE); @@ -3174,45 +3804,36 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin almtx_lock(&device->BackendLock); UnlockLists(); - ATOMIC_STORE(&device->LastError, ALC_NO_ERROR); + ATOMIC_STORE_SEQ(&device->LastError, ALC_NO_ERROR); - ALContext = al_calloc(16, sizeof(ALCcontext)+sizeof(ALlistener)); - if(ALContext) - { - InitRef(&ALContext->ref, 1); - ALContext->Listener = (ALlistener*)ALContext->_listener_mem; - - ATOMIC_INIT(&ALContext->ActiveAuxSlotList, NULL); - - ALContext->VoiceCount = 0; - ALContext->MaxVoices = 256; - ALContext->Voices = al_calloc(16, ALContext->MaxVoices * sizeof(ALContext->Voices[0])); - } - if(!ALContext || !ALContext->Voices) + if(device->Type == Playback && DefaultEffect.type != AL_EFFECT_NULL) + ALContext = al_calloc(16, sizeof(ALCcontext)+sizeof(ALlistener)+sizeof(ALeffectslot)); + else + ALContext = al_calloc(16, sizeof(ALCcontext)+sizeof(ALlistener)); + if(!ALContext) { almtx_unlock(&device->BackendLock); - if(ALContext) - { - al_free(ALContext->Voices); - ALContext->Voices = NULL; - - al_free(ALContext); - ALContext = NULL; - } - alcSetError(device, ALC_OUT_OF_MEMORY); ALCdevice_DecRef(device); return NULL; } + InitRef(&ALContext->ref, 1); + ALContext->Listener = (ALlistener*)ALContext->_listener_mem; + ALContext->DefaultSlot = NULL; + + ALContext->Voices = NULL; + ALContext->VoiceCount = 0; + ALContext->MaxVoices = 0; + ATOMIC_INIT(&ALContext->ActiveAuxSlots, NULL); + ALContext->Device = device; + ATOMIC_INIT(&ALContext->next, NULL); + if((err=UpdateDeviceParams(device, attrList)) != ALC_NO_ERROR) { almtx_unlock(&device->BackendLock); - al_free(ALContext->Voices); - ALContext->Voices = NULL; - al_free(ALContext); ALContext = NULL; @@ -3220,18 +3841,30 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin if(err == ALC_INVALID_DEVICE) { V0(device->Backend,lock)(); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Device update failure"); V0(device->Backend,unlock)(); } ALCdevice_DecRef(device); return NULL; } + AllocateVoices(ALContext, 256, device->NumAuxSends); - ALContext->Device = device; - ALCdevice_IncRef(device); + if(DefaultEffect.type != AL_EFFECT_NULL && device->Type == Playback) + { + ALContext->DefaultSlot = (ALeffectslot*)(ALContext->_listener_mem + sizeof(ALlistener)); + if(InitEffectSlot(ALContext->DefaultSlot) == AL_NO_ERROR) + aluInitEffectPanning(ALContext->DefaultSlot); + else + { + ALContext->DefaultSlot = NULL; + ERR("Failed to initialize the default effect slot\n"); + } + } + + ALCdevice_IncRef(ALContext->Device); InitContext(ALContext); - if(ConfigValueFloat(al_string_get_cstr(device->DeviceName), NULL, "volume-adjust", &valf)) + if(ConfigValueFloat(alstr_get_cstr(device->DeviceName), NULL, "volume-adjust", &valf)) { if(!isfinite(valf)) ERR("volume-adjust must be finite: %f\n", valf); @@ -3247,13 +3880,22 @@ ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCin UpdateListenerProps(ALContext); { - ALCcontext *head = ATOMIC_LOAD(&device->ContextList); + ALCcontext *head = ATOMIC_LOAD_SEQ(&device->ContextList); do { - ALContext->next = head; - } while(!ATOMIC_COMPARE_EXCHANGE_WEAK(ALCcontext*, &device->ContextList, &head, ALContext)); + ATOMIC_STORE(&ALContext->next, head, almemory_order_relaxed); + } while(ATOMIC_COMPARE_EXCHANGE_PTR_WEAK_SEQ(&device->ContextList, &head, + ALContext) == 0); } almtx_unlock(&device->BackendLock); + if(ALContext->DefaultSlot) + { + if(InitializeEffect(ALContext, ALContext->DefaultSlot, &DefaultEffect) == AL_NO_ERROR) + UpdateEffectSlotProps(ALContext->DefaultSlot, ALContext); + else + ERR("Failed to initialize the default effect\n"); + } + ALCdevice_DecRef(device); TRACE("Created context %p\n", ALContext); @@ -3269,13 +3911,18 @@ ALC_API ALCvoid ALC_APIENTRY alcDestroyContext(ALCcontext *context) ALCdevice *Device; LockLists(); - /* alcGetContextsDevice sets an error for invalid contexts */ - Device = alcGetContextsDevice(context); + if(!VerifyContext(&context)) + { + UnlockLists(); + alcSetError(NULL, ALC_INVALID_CONTEXT); + return; + } + + Device = context->Device; if(Device) { almtx_lock(&Device->BackendLock); - ReleaseContext(context, Device); - if(!ATOMIC_LOAD(&Device->ContextList)) + if(!ReleaseContext(context, Device)) { V0(Device->Backend,stop)(); Device->Flags &= ~DEVICE_RUNNING; @@ -3283,6 +3930,8 @@ ALC_API ALCvoid ALC_APIENTRY alcDestroyContext(ALCcontext *context) almtx_unlock(&Device->BackendLock); } UnlockLists(); + + ALCcontext_DecRef(context); } @@ -3293,7 +3942,7 @@ ALC_API ALCvoid ALC_APIENTRY alcDestroyContext(ALCcontext *context) ALC_API ALCcontext* ALC_APIENTRY alcGetCurrentContext(void) { ALCcontext *Context = altss_get(LocalContext); - if(!Context) Context = ATOMIC_LOAD(&GlobalContext); + if(!Context) Context = ATOMIC_LOAD_SEQ(&GlobalContext); return Context; } @@ -3321,7 +3970,7 @@ ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent(ALCcontext *context) return ALC_FALSE; } /* context's reference count is already incremented */ - context = ATOMIC_EXCHANGE(ALCcontext*, &GlobalContext, context); + context = ATOMIC_EXCHANGE_PTR_SEQ(&GlobalContext, context); if(context) ALCcontext_DecRef(context); if((context=altss_get(LocalContext)) != NULL) @@ -3382,6 +4031,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice(ALCcontext *Context) */ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) { + ALCbackendFactory *factory; const ALCchar *fmt; ALCdevice *device; ALCenum err; @@ -3406,7 +4056,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) )) deviceName = NULL; - device = al_calloc(16, sizeof(ALCdevice)+sizeof(ALeffectslot)); + device = al_calloc(16, sizeof(ALCdevice)); if(!device) { alcSetError(NULL, ALC_OUT_OF_MEMORY); @@ -3414,79 +4064,39 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) } //Validate device - InitRef(&device->ref, 1); - device->Connected = ALC_TRUE; - device->Type = Playback; - ATOMIC_INIT(&device->LastError, ALC_NO_ERROR); - - device->Flags = 0; - device->Bs2b = NULL; - device->Uhj_Encoder = NULL; - VECTOR_INIT(device->Hrtf.List); - AL_STRING_INIT(device->Hrtf.Name); - device->Render_Mode = NormalRender; - AL_STRING_INIT(device->DeviceName); - device->Dry.Buffer = NULL; - device->Dry.NumChannels = 0; - device->FOAOut.Buffer = NULL; - device->FOAOut.NumChannels = 0; - device->RealOut.Buffer = NULL; - device->RealOut.NumChannels = 0; - - ATOMIC_INIT(&device->ContextList, NULL); - - device->ClockBase = 0; - device->SamplesDone = 0; - - device->SourcesMax = 256; - device->AuxiliaryEffectSlotMax = 4; - device->NumAuxSends = MAX_SENDS; - - InitUIntMap(&device->BufferMap, ~0); - InitUIntMap(&device->EffectMap, ~0); - InitUIntMap(&device->FilterMap, ~0); + InitDevice(device, Playback); //Set output format device->FmtChans = DevFmtChannelsDefault; device->FmtType = DevFmtTypeDefault; device->Frequency = DEFAULT_OUTPUT_RATE; device->IsHeadphones = AL_FALSE; - device->AmbiFmt = AmbiFormat_Default; - device->NumUpdates = 4; + device->AmbiLayout = AmbiLayout_Default; + device->AmbiScale = AmbiNorm_Default; + device->NumUpdates = 3; device->UpdateSize = 1024; - if(!PlaybackBackend.getFactory) - device->Backend = create_backend_wrapper(device, &PlaybackBackend.Funcs, - ALCbackend_Playback); - else - { - ALCbackendFactory *factory = PlaybackBackend.getFactory(); - device->Backend = V(factory,createBackend)(device, ALCbackend_Playback); - } - if(!device->Backend) - { - al_free(device); - alcSetError(NULL, ALC_OUT_OF_MEMORY); - return NULL; - } - + device->SourcesMax = 256; + device->AuxiliaryEffectSlotMax = 64; + device->NumAuxSends = DEFAULT_SENDS; if(ConfigValueStr(deviceName, NULL, "channels", &fmt)) { static const struct { const char name[16]; enum DevFmtChannels chans; + ALsizei order; } chanlist[] = { - { "mono", DevFmtMono }, - { "stereo", DevFmtStereo }, - { "quad", DevFmtQuad }, - { "surround51", DevFmtX51 }, - { "surround61", DevFmtX61 }, - { "surround71", DevFmtX71 }, - { "surround51rear", DevFmtX51Rear }, - { "ambi1", DevFmtAmbi1 }, - { "ambi2", DevFmtAmbi2 }, - { "ambi3", DevFmtAmbi3 }, + { "mono", DevFmtMono, 0 }, + { "stereo", DevFmtStereo, 0 }, + { "quad", DevFmtQuad, 0 }, + { "surround51", DevFmtX51, 0 }, + { "surround61", DevFmtX61, 0 }, + { "surround71", DevFmtX71, 0 }, + { "surround51rear", DevFmtX51Rear, 0 }, + { "ambi1", DevFmtAmbi3D, 1 }, + { "ambi2", DevFmtAmbi3D, 2 }, + { "ambi3", DevFmtAmbi3D, 3 }, }; size_t i; @@ -3495,6 +4105,7 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) if(strcasecmp(chanlist[i].name, fmt) == 0) { device->FmtChans = chanlist[i].chans; + device->AmbiOrder = chanlist[i].order; device->Flags |= DEVICE_CHANNELS_REQUEST; break; } @@ -3551,64 +4162,65 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) if(device->SourcesMax == 0) device->SourcesMax = 256; ConfigValueUInt(deviceName, NULL, "slots", &device->AuxiliaryEffectSlotMax); - if(device->AuxiliaryEffectSlotMax == 0) device->AuxiliaryEffectSlotMax = 4; + if(device->AuxiliaryEffectSlotMax == 0) device->AuxiliaryEffectSlotMax = 64; + else device->AuxiliaryEffectSlotMax = minu(device->AuxiliaryEffectSlotMax, INT_MAX); - ConfigValueUInt(deviceName, NULL, "sends", &device->NumAuxSends); - if(device->NumAuxSends > MAX_SENDS) device->NumAuxSends = MAX_SENDS; + if(ConfigValueInt(deviceName, NULL, "sends", &device->NumAuxSends)) + device->NumAuxSends = clampi( + DEFAULT_SENDS, 0, clampi(device->NumAuxSends, 0, MAX_SENDS) + ); device->NumStereoSources = 1; device->NumMonoSources = device->SourcesMax - device->NumStereoSources; + factory = PlaybackBackend.getFactory(); + device->Backend = V(factory,createBackend)(device, ALCbackend_Playback); + if(!device->Backend) + { + FreeDevice(device); + alcSetError(NULL, ALC_OUT_OF_MEMORY); + return NULL; + } + // Find a playback device to open if((err=V(device->Backend,open)(deviceName)) != ALC_NO_ERROR) { - DELETE_OBJ(device->Backend); - al_free(device); + FreeDevice(device); alcSetError(NULL, err); return NULL; } - almtx_init(&device->BackendLock, almtx_plain); - if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "ambi-format", &fmt)) + if(ConfigValueStr(alstr_get_cstr(device->DeviceName), NULL, "ambi-format", &fmt)) { if(strcasecmp(fmt, "fuma") == 0) - device->AmbiFmt = AmbiFormat_FuMa; + { + device->AmbiLayout = AmbiLayout_FuMa; + device->AmbiScale = AmbiNorm_FuMa; + } else if(strcasecmp(fmt, "acn+sn3d") == 0) - device->AmbiFmt = AmbiFormat_ACN_SN3D; + { + device->AmbiLayout = AmbiLayout_ACN; + device->AmbiScale = AmbiNorm_SN3D; + } else if(strcasecmp(fmt, "acn+n3d") == 0) - device->AmbiFmt = AmbiFormat_ACN_N3D; + { + device->AmbiLayout = AmbiLayout_ACN; + device->AmbiScale = AmbiNorm_N3D; + } else ERR("Unsupported ambi-format: %s\n", fmt); } - if(DefaultEffect.type != AL_EFFECT_NULL) - { - device->DefaultSlot = (ALeffectslot*)device->_slot_mem; - if(InitEffectSlot(device->DefaultSlot) != AL_NO_ERROR) - { - device->DefaultSlot = NULL; - ERR("Failed to initialize the default effect slot\n"); - } - else - { - aluInitEffectPanning(device->DefaultSlot); - if(InitializeEffect(device, device->DefaultSlot, &DefaultEffect) != AL_NO_ERROR) - { - DeinitEffectSlot(device->DefaultSlot); - device->DefaultSlot = NULL; - ERR("Failed to initialize the default effect\n"); - } - } - } + device->Limiter = CreateDeviceLimiter(device); { - ALCdevice *head = ATOMIC_LOAD(&DeviceList); + ALCdevice *head = ATOMIC_LOAD_SEQ(&DeviceList); do { - device->next = head; - } while(!ATOMIC_COMPARE_EXCHANGE_WEAK(ALCdevice*, &DeviceList, &head, device)); + ATOMIC_STORE(&device->next, head, almemory_order_relaxed); + } while(!ATOMIC_COMPARE_EXCHANGE_PTR_WEAK_SEQ(&DeviceList, &head, device)); } - TRACE("Created device %p, \"%s\"\n", device, al_string_get_cstr(device->DeviceName)); + TRACE("Created device %p, \"%s\"\n", device, alstr_get_cstr(device->DeviceName)); return device; } @@ -3618,38 +4230,40 @@ ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *deviceName) */ ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *device) { - ALCdevice *list, *origdev, *nextdev; + ALCdevice *iter, *origdev, *nextdev; ALCcontext *ctx; LockLists(); - list = ATOMIC_LOAD(&DeviceList); + iter = ATOMIC_LOAD_SEQ(&DeviceList); do { - if(list == device) + if(iter == device) break; - } while((list=list->next) != NULL); - if(!list || list->Type == Capture) + iter = ATOMIC_LOAD(&iter->next, almemory_order_relaxed); + } while(iter != NULL); + if(!iter || iter->Type == Capture) { - alcSetError(list, ALC_INVALID_DEVICE); + alcSetError(iter, ALC_INVALID_DEVICE); UnlockLists(); return ALC_FALSE; } almtx_lock(&device->BackendLock); origdev = device; - nextdev = device->next; - if(!ATOMIC_COMPARE_EXCHANGE_STRONG(ALCdevice*, &DeviceList, &origdev, nextdev)) + nextdev = ATOMIC_LOAD(&device->next, almemory_order_relaxed); + if(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&DeviceList, &origdev, nextdev)) { + ALCdevice *list; do { list = origdev; origdev = device; - } while(!COMPARE_EXCHANGE(&list->next, &origdev, nextdev)); + } while(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&list->next, &origdev, nextdev)); } UnlockLists(); - ctx = ATOMIC_LOAD(&device->ContextList); + ctx = ATOMIC_LOAD_SEQ(&device->ContextList); while(ctx != NULL) { - ALCcontext *next = ctx->next; + ALCcontext *next = ATOMIC_LOAD(&ctx->next, almemory_order_relaxed); WARN("Releasing context %p\n", ctx); ReleaseContext(ctx, device); ctx = next; @@ -3670,6 +4284,7 @@ ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *device) ************************************************/ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName, ALCuint frequency, ALCenum format, ALCsizei samples) { + ALCbackendFactory *factory; ALCdevice *device = NULL; ALCenum err; @@ -3698,100 +4313,84 @@ ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *deviceName, } //Validate device - InitRef(&device->ref, 1); - device->Connected = ALC_TRUE; - device->Type = Capture; + InitDevice(device, Capture); - VECTOR_INIT(device->Hrtf.List); - AL_STRING_INIT(device->Hrtf.Name); - - AL_STRING_INIT(device->DeviceName); - device->Dry.Buffer = NULL; - device->Dry.NumChannels = 0; - device->FOAOut.Buffer = NULL; - device->FOAOut.NumChannels = 0; - device->RealOut.Buffer = NULL; - device->RealOut.NumChannels = 0; - - InitUIntMap(&device->BufferMap, ~0); - InitUIntMap(&device->EffectMap, ~0); - InitUIntMap(&device->FilterMap, ~0); - - if(!CaptureBackend.getFactory) - device->Backend = create_backend_wrapper(device, &CaptureBackend.Funcs, - ALCbackend_Capture); - else - { - ALCbackendFactory *factory = CaptureBackend.getFactory(); - device->Backend = V(factory,createBackend)(device, ALCbackend_Capture); - } - if(!device->Backend) - { - al_free(device); - alcSetError(NULL, ALC_OUT_OF_MEMORY); - return NULL; - } - - device->Flags |= DEVICE_FREQUENCY_REQUEST; device->Frequency = frequency; + device->Flags |= DEVICE_FREQUENCY_REQUEST; - device->Flags |= DEVICE_CHANNELS_REQUEST | DEVICE_SAMPLE_TYPE_REQUEST; if(DecomposeDevFormat(format, &device->FmtChans, &device->FmtType) == AL_FALSE) { - al_free(device); + FreeDevice(device); alcSetError(NULL, ALC_INVALID_ENUM); return NULL; } + device->Flags |= DEVICE_CHANNELS_REQUEST | DEVICE_SAMPLE_TYPE_REQUEST; device->IsHeadphones = AL_FALSE; - device->AmbiFmt = AmbiFormat_Default; + device->AmbiOrder = 0; + device->AmbiLayout = AmbiLayout_Default; + device->AmbiScale = AmbiNorm_Default; device->UpdateSize = samples; device->NumUpdates = 1; + factory = CaptureBackend.getFactory(); + device->Backend = V(factory,createBackend)(device, ALCbackend_Capture); + if(!device->Backend) + { + FreeDevice(device); + alcSetError(NULL, ALC_OUT_OF_MEMORY); + return NULL; + } + + TRACE("Capture format: %s, %s, %uhz, %u update size x%d\n", + DevFmtChannelsString(device->FmtChans), DevFmtTypeString(device->FmtType), + device->Frequency, device->UpdateSize, device->NumUpdates + ); if((err=V(device->Backend,open)(deviceName)) != ALC_NO_ERROR) { - al_free(device); + FreeDevice(device); alcSetError(NULL, err); return NULL; } - almtx_init(&device->BackendLock, almtx_plain); { - ALCdevice *head = ATOMIC_LOAD(&DeviceList); + ALCdevice *head = ATOMIC_LOAD_SEQ(&DeviceList); do { - device->next = head; - } while(!ATOMIC_COMPARE_EXCHANGE_WEAK(ALCdevice*, &DeviceList, &head, device)); + ATOMIC_STORE(&device->next, head, almemory_order_relaxed); + } while(!ATOMIC_COMPARE_EXCHANGE_PTR_WEAK_SEQ(&DeviceList, &head, device)); } - TRACE("Created device %p, \"%s\"\n", device, al_string_get_cstr(device->DeviceName)); + TRACE("Created device %p, \"%s\"\n", device, alstr_get_cstr(device->DeviceName)); return device; } ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice(ALCdevice *device) { - ALCdevice *list, *next, *nextdev; + ALCdevice *iter, *origdev, *nextdev; LockLists(); - list = ATOMIC_LOAD(&DeviceList); + iter = ATOMIC_LOAD_SEQ(&DeviceList); do { - if(list == device) + if(iter == device) break; - } while((list=list->next) != NULL); - if(!list || list->Type != Capture) + iter = ATOMIC_LOAD(&iter->next, almemory_order_relaxed); + } while(iter != NULL); + if(!iter || iter->Type != Capture) { - alcSetError(list, ALC_INVALID_DEVICE); + alcSetError(iter, ALC_INVALID_DEVICE); UnlockLists(); return ALC_FALSE; } - next = device; - nextdev = device->next; - if(!ATOMIC_COMPARE_EXCHANGE_STRONG(ALCdevice*, &DeviceList, &next, nextdev)) + origdev = device; + nextdev = ATOMIC_LOAD(&device->next, almemory_order_relaxed); + if(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&DeviceList, &origdev, nextdev)) { + ALCdevice *list; do { - list = next; - next = device; - } while(!COMPARE_EXCHANGE(&list->next, &next, nextdev)); + list = origdev; + origdev = device; + } while(!ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(&list->next, &origdev, nextdev)); } UnlockLists(); @@ -3807,7 +4406,7 @@ ALC_API void ALC_APIENTRY alcCaptureStart(ALCdevice *device) else { almtx_lock(&device->BackendLock); - if(!device->Connected) + if(!ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) alcSetError(device, ALC_INVALID_DEVICE); else if(!(device->Flags&DEVICE_RUNNING)) { @@ -3815,7 +4414,7 @@ ALC_API void ALC_APIENTRY alcCaptureStart(ALCdevice *device) device->Flags |= DEVICE_RUNNING; else { - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Device start failure"); alcSetError(device, ALC_INVALID_DEVICE); } } @@ -3891,47 +4490,11 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceN } //Validate device - InitRef(&device->ref, 1); - device->Connected = ALC_TRUE; - device->Type = Loopback; - ATOMIC_INIT(&device->LastError, ALC_NO_ERROR); - - device->Flags = 0; - VECTOR_INIT(device->Hrtf.List); - AL_STRING_INIT(device->Hrtf.Name); - device->Bs2b = NULL; - device->Uhj_Encoder = NULL; - device->Render_Mode = NormalRender; - AL_STRING_INIT(device->DeviceName); - device->Dry.Buffer = NULL; - device->Dry.NumChannels = 0; - device->FOAOut.Buffer = NULL; - device->FOAOut.NumChannels = 0; - device->RealOut.Buffer = NULL; - device->RealOut.NumChannels = 0; - - ATOMIC_INIT(&device->ContextList, NULL); - - device->ClockBase = 0; - device->SamplesDone = 0; + InitDevice(device, Loopback); device->SourcesMax = 256; - device->AuxiliaryEffectSlotMax = 4; - device->NumAuxSends = MAX_SENDS; - - InitUIntMap(&device->BufferMap, ~0); - InitUIntMap(&device->EffectMap, ~0); - InitUIntMap(&device->FilterMap, ~0); - - factory = ALCloopbackFactory_getFactory(); - device->Backend = V(factory,createBackend)(device, ALCbackend_Loopback); - if(!device->Backend) - { - al_free(device); - alcSetError(NULL, ALC_OUT_OF_MEMORY); - return NULL; - } - almtx_init(&device->BackendLock, almtx_plain); + device->AuxiliaryEffectSlotMax = 64; + device->NumAuxSends = DEFAULT_SENDS; //Set output format device->NumUpdates = 0; @@ -3941,28 +4504,43 @@ ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(const ALCchar *deviceN device->FmtChans = DevFmtChannelsDefault; device->FmtType = DevFmtTypeDefault; device->IsHeadphones = AL_FALSE; - device->AmbiFmt = AmbiFormat_Default; + device->AmbiLayout = AmbiLayout_Default; + device->AmbiScale = AmbiNorm_Default; ConfigValueUInt(NULL, NULL, "sources", &device->SourcesMax); if(device->SourcesMax == 0) device->SourcesMax = 256; ConfigValueUInt(NULL, NULL, "slots", &device->AuxiliaryEffectSlotMax); - if(device->AuxiliaryEffectSlotMax == 0) device->AuxiliaryEffectSlotMax = 4; + if(device->AuxiliaryEffectSlotMax == 0) device->AuxiliaryEffectSlotMax = 64; + else device->AuxiliaryEffectSlotMax = minu(device->AuxiliaryEffectSlotMax, INT_MAX); - ConfigValueUInt(NULL, NULL, "sends", &device->NumAuxSends); - if(device->NumAuxSends > MAX_SENDS) device->NumAuxSends = MAX_SENDS; + if(ConfigValueInt(NULL, NULL, "sends", &device->NumAuxSends)) + device->NumAuxSends = clampi( + DEFAULT_SENDS, 0, clampi(device->NumAuxSends, 0, MAX_SENDS) + ); device->NumStereoSources = 1; device->NumMonoSources = device->SourcesMax - device->NumStereoSources; + factory = ALCloopbackFactory_getFactory(); + device->Backend = V(factory,createBackend)(device, ALCbackend_Loopback); + if(!device->Backend) + { + al_free(device); + alcSetError(NULL, ALC_OUT_OF_MEMORY); + return NULL; + } + // Open the "backend" V(device->Backend,open)("Loopback"); + device->Limiter = CreateDeviceLimiter(device); + { - ALCdevice *head = ATOMIC_LOAD(&DeviceList); + ALCdevice *head = ATOMIC_LOAD_SEQ(&DeviceList); do { - device->next = head; - } while(!ATOMIC_COMPARE_EXCHANGE_WEAK(ALCdevice*, &DeviceList, &head, device)); + ATOMIC_STORE(&device->next, head, almemory_order_relaxed); + } while(!ATOMIC_COMPARE_EXCHANGE_PTR_WEAK_SEQ(&DeviceList, &head, device)); } TRACE("Created device %p\n", device); @@ -3983,9 +4561,7 @@ ALC_API ALCboolean ALC_APIENTRY alcIsRenderFormatSupportedSOFT(ALCdevice *device alcSetError(device, ALC_INVALID_VALUE); else { - if(IsValidALCType(type) && BytesFromDevFmt(type) > 0 && - IsValidALCChannels(channels) && ChannelsFromDevFmt(channels) > 0 && - freq >= MIN_OUTPUT_RATE) + if(IsValidALCType(type) && IsValidALCChannels(channels) && freq >= MIN_OUTPUT_RATE) ret = ALC_TRUE; } if(device) ALCdevice_DecRef(device); @@ -4005,7 +4581,11 @@ FORCE_ALIGN ALC_API void ALC_APIENTRY alcRenderSamplesSOFT(ALCdevice *device, AL else if(samples < 0 || (samples > 0 && buffer == NULL)) alcSetError(device, ALC_INVALID_VALUE); else + { + V0(device->Backend,lock)(); aluMixData(device, buffer, samples); + V0(device->Backend,unlock)(); + } if(device) ALCdevice_DecRef(device); } @@ -4048,16 +4628,16 @@ ALC_API void ALC_APIENTRY alcDeviceResumeSOFT(ALCdevice *device) if((device->Flags&DEVICE_PAUSED)) { device->Flags &= ~DEVICE_PAUSED; - if(ATOMIC_LOAD(&device->ContextList) != NULL) + if(ATOMIC_LOAD_SEQ(&device->ContextList) != NULL) { if(V0(device->Backend,start)() != ALC_FALSE) device->Flags |= DEVICE_RUNNING; else { - alcSetError(device, ALC_INVALID_DEVICE); V0(device->Backend,lock)(); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Device start failure"); V0(device->Backend,unlock)(); + alcSetError(device, ALC_INVALID_DEVICE); } } } @@ -4084,8 +4664,8 @@ ALC_API const ALCchar* ALC_APIENTRY alcGetStringiSOFT(ALCdevice *device, ALCenum else switch(paramName) { case ALC_HRTF_SPECIFIER_SOFT: - if(index >= 0 && (size_t)index < VECTOR_SIZE(device->Hrtf.List)) - str = al_string_get_cstr(VECTOR_ELEM(device->Hrtf.List, index).name); + if(index >= 0 && (size_t)index < VECTOR_SIZE(device->HrtfList)) + str = alstr_get_cstr(VECTOR_ELEM(device->HrtfList, index).name); else alcSetError(device, ALC_INVALID_VALUE); break; @@ -4108,7 +4688,8 @@ ALC_API ALCboolean ALC_APIENTRY alcResetDeviceSOFT(ALCdevice *device, const ALCi ALCenum err; LockLists(); - if(!VerifyDevice(&device) || device->Type == Capture || !device->Connected) + if(!VerifyDevice(&device) || device->Type == Capture || + !ATOMIC_LOAD(&device->Connected, almemory_order_relaxed)) { UnlockLists(); alcSetError(device, ALC_INVALID_DEVICE); @@ -4127,7 +4708,7 @@ ALC_API ALCboolean ALC_APIENTRY alcResetDeviceSOFT(ALCdevice *device, const ALCi if(err == ALC_INVALID_DEVICE) { V0(device->Backend,lock)(); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Device start failure"); V0(device->Backend,unlock)(); } ALCdevice_DecRef(device); diff --git a/Engine/lib/openal-soft/Alc/ALu.c b/Engine/lib/openal-soft/Alc/ALu.c index cc01f3367..81914850c 100644 --- a/Engine/lib/openal-soft/Alc/ALu.c +++ b/Engine/lib/openal-soft/Alc/ALu.c @@ -34,27 +34,21 @@ #include "alu.h" #include "bs2b.h" #include "hrtf.h" +#include "mastering.h" #include "uhjfilter.h" #include "bformatdec.h" #include "static_assert.h" +#include "ringbuffer.h" +#include "filters/splitter.h" -#include "mixer_defs.h" +#include "mixer/defs.h" +#include "fpu_modes.h" +#include "cpu_caps.h" +#include "bsinc_inc.h" #include "backends/base.h" -struct ChanMap { - enum Channel channel; - ALfloat angle; - ALfloat elevation; -}; - -/* Cone scalar */ -ALfloat ConeScale = 1.0f; - -/* Localized Z scalar for mono sources */ -ALfloat ZScale = 1.0f; - extern inline ALfloat minf(ALfloat a, ALfloat b); extern inline ALfloat maxf(ALfloat a, ALfloat b); extern inline ALfloat clampf(ALfloat val, ALfloat min, ALfloat max); @@ -79,9 +73,12 @@ extern inline ALuint64 minu64(ALuint64 a, ALuint64 b); extern inline ALuint64 maxu64(ALuint64 a, ALuint64 b); extern inline ALuint64 clampu64(ALuint64 val, ALuint64 min, ALuint64 max); +extern inline size_t minz(size_t a, size_t b); +extern inline size_t maxz(size_t a, size_t b); +extern inline size_t clampz(size_t val, size_t min, size_t max); + extern inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu); -extern inline ALfloat resample_fir4(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALuint frac); -extern inline ALfloat resample_fir8(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALfloat val4, ALfloat val5, ALfloat val6, ALfloat val7, ALuint frac); +extern inline ALfloat cubic(ALfloat val1, ALfloat val2, ALfloat val3, ALfloat val4, ALfloat mu); extern inline void aluVectorSet(aluVector *restrict vector, ALfloat x, ALfloat y, ALfloat z, ALfloat w); @@ -93,6 +90,16 @@ extern inline void aluMatrixfSet(aluMatrixf *matrix, ALfloat m20, ALfloat m21, ALfloat m22, ALfloat m23, ALfloat m30, ALfloat m31, ALfloat m32, ALfloat m33); + +/* Cone scalar */ +ALfloat ConeScale = 1.0f; + +/* Localized Z scalar for mono sources */ +ALfloat ZScale = 1.0f; + +/* Force default speed of sound for distance-related reverb decay. */ +ALboolean OverrideReverbSpeedOfSound = AL_FALSE; + const aluMatrixf IdentityMatrixf = {{ { 1.0f, 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f, 0.0f }, @@ -101,21 +108,64 @@ const aluMatrixf IdentityMatrixf = {{ }}; +static void ClearArray(ALfloat f[MAX_OUTPUT_CHANNELS]) +{ + size_t i; + for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) + f[i] = 0.0f; +} + +struct ChanMap { + enum Channel channel; + ALfloat angle; + ALfloat elevation; +}; + +static HrtfDirectMixerFunc MixDirectHrtf = MixDirectHrtf_C; + + +void DeinitVoice(ALvoice *voice) +{ + al_free(ATOMIC_EXCHANGE_PTR_SEQ(&voice->Update, NULL)); +} + + static inline HrtfDirectMixerFunc SelectHrtfMixer(void) { -#ifdef HAVE_SSE - if((CPUCapFlags&CPU_CAP_SSE)) - return MixDirectHrtf_SSE; -#endif #ifdef HAVE_NEON if((CPUCapFlags&CPU_CAP_NEON)) return MixDirectHrtf_Neon; #endif +#ifdef HAVE_SSE + if((CPUCapFlags&CPU_CAP_SSE)) + return MixDirectHrtf_SSE; +#endif return MixDirectHrtf_C; } +/* Prior to VS2013, MSVC lacks the round() family of functions. */ +#if defined(_MSC_VER) && _MSC_VER < 1800 +static float roundf(float val) +{ + if(val < 0.0f) + return ceilf(val-0.5f); + return floorf(val+0.5f); +} +#endif + +/* This RNG method was created based on the math found in opusdec. It's quick, + * and starting with a seed value of 22222, is suitable for generating + * whitenoise. + */ +static inline ALuint dither_rng(ALuint *seed) +{ + *seed = (*seed * 96314165) + 907633515; + return *seed; +} + + static inline void aluCrossproduct(const ALfloat *inVector1, const ALfloat *inVector2, ALfloat *outVector) { outVector[0] = inVector1[1]*inVector2[2] - inVector1[2]*inVector2[1]; @@ -131,14 +181,16 @@ static inline ALfloat aluDotproduct(const aluVector *vec1, const aluVector *vec2 static ALfloat aluNormalize(ALfloat *vec) { ALfloat length = sqrtf(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]); - if(length > 0.0f) + if(length > FLT_EPSILON) { ALfloat inv_length = 1.0f/length; vec[0] *= inv_length; vec[1] *= inv_length; vec[2] *= inv_length; + return length; } - return length; + vec[0] = vec[1] = vec[2] = 0.0f; + return 0.0f; } static void aluMatrixfFloat3(ALfloat *vec, ALfloat w, const aluMatrixf *mtx) @@ -161,6 +213,135 @@ static aluVector aluMatrixfVector(const aluMatrixf *mtx, const aluVector *vec) } +void aluInit(void) +{ + MixDirectHrtf = SelectHrtfMixer(); +} + + +static void SendSourceStoppedEvent(ALCcontext *context, ALuint id) +{ + ALbitfieldSOFT enabledevt; + AsyncEvent evt; + size_t strpos; + ALuint scale; + + enabledevt = ATOMIC_LOAD(&context->EnabledEvts, almemory_order_acquire); + if(!(enabledevt&EventType_SourceStateChange)) return; + + evt.EnumType = EventType_SourceStateChange; + evt.Type = AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT; + evt.ObjectId = id; + evt.Param = AL_STOPPED; + + /* Normally snprintf would be used, but this is called from the mixer and + * that function's not real-time safe, so we have to construct it manually. + */ + strcpy(evt.Message, "Source ID "); strpos = 10; + scale = 1000000000; + while(scale > 0 && scale > id) + scale /= 10; + while(scale > 0) + { + evt.Message[strpos++] = '0' + ((id/scale)%10); + scale /= 10; + } + strcpy(evt.Message+strpos, " state changed to AL_STOPPED"); + + if(ll_ringbuffer_write(context->AsyncEvents, (const char*)&evt, 1) == 1) + alsem_post(&context->EventSem); +} + + +static void ProcessHrtf(ALCdevice *device, ALsizei SamplesToDo) +{ + DirectHrtfState *state; + int lidx, ridx; + ALsizei c; + + if(device->AmbiUp) + ambiup_process(device->AmbiUp, + device->Dry.Buffer, device->Dry.NumChannels, device->FOAOut.Buffer, + SamplesToDo + ); + + lidx = GetChannelIdxByName(&device->RealOut, FrontLeft); + ridx = GetChannelIdxByName(&device->RealOut, FrontRight); + assert(lidx != -1 && ridx != -1); + + state = device->Hrtf; + for(c = 0;c < device->Dry.NumChannels;c++) + { + MixDirectHrtf(device->RealOut.Buffer[lidx], device->RealOut.Buffer[ridx], + device->Dry.Buffer[c], state->Offset, state->IrSize, + state->Chan[c].Coeffs, state->Chan[c].Values, SamplesToDo + ); + } + state->Offset += SamplesToDo; +} + +static void ProcessAmbiDec(ALCdevice *device, ALsizei SamplesToDo) +{ + if(device->Dry.Buffer != device->FOAOut.Buffer) + bformatdec_upSample(device->AmbiDecoder, + device->Dry.Buffer, device->FOAOut.Buffer, device->FOAOut.NumChannels, + SamplesToDo + ); + bformatdec_process(device->AmbiDecoder, + device->RealOut.Buffer, device->RealOut.NumChannels, device->Dry.Buffer, + SamplesToDo + ); +} + +static void ProcessAmbiUp(ALCdevice *device, ALsizei SamplesToDo) +{ + ambiup_process(device->AmbiUp, + device->RealOut.Buffer, device->RealOut.NumChannels, device->FOAOut.Buffer, + SamplesToDo + ); +} + +static void ProcessUhj(ALCdevice *device, ALsizei SamplesToDo) +{ + int lidx = GetChannelIdxByName(&device->RealOut, FrontLeft); + int ridx = GetChannelIdxByName(&device->RealOut, FrontRight); + assert(lidx != -1 && ridx != -1); + + /* Encode to stereo-compatible 2-channel UHJ output. */ + EncodeUhj2(device->Uhj_Encoder, + device->RealOut.Buffer[lidx], device->RealOut.Buffer[ridx], + device->Dry.Buffer, SamplesToDo + ); +} + +static void ProcessBs2b(ALCdevice *device, ALsizei SamplesToDo) +{ + int lidx = GetChannelIdxByName(&device->RealOut, FrontLeft); + int ridx = GetChannelIdxByName(&device->RealOut, FrontRight); + assert(lidx != -1 && ridx != -1); + + /* Apply binaural/crossfeed filter */ + bs2b_cross_feed(device->Bs2b, device->RealOut.Buffer[lidx], + device->RealOut.Buffer[ridx], SamplesToDo); +} + +void aluSelectPostProcess(ALCdevice *device) +{ + if(device->HrtfHandle) + device->PostProcess = ProcessHrtf; + else if(device->AmbiDecoder) + device->PostProcess = ProcessAmbiDec; + else if(device->AmbiUp) + device->PostProcess = ProcessAmbiUp; + else if(device->Uhj_Encoder) + device->PostProcess = ProcessUhj; + else if(device->Bs2b) + device->PostProcess = ProcessBs2b; + else + device->PostProcess = NULL; +} + + /* Prepares the interpolator for a given rate (determined by increment). A * result of AL_FALSE indicates that the filter output will completely cut * the input signal. @@ -169,91 +350,71 @@ static aluVector aluMatrixfVector(const aluMatrixf *mtx, const aluVector *vec) * modified for use with an interpolated increment for buttery-smooth pitch * changes. */ -static ALboolean BsincPrepare(const ALuint increment, BsincState *state) +void BsincPrepare(const ALuint increment, BsincState *state, const BSincTable *table) { - static const ALfloat scaleBase = 1.510578918e-01f, scaleRange = 1.177936623e+00f; - static const ALuint m[BSINC_SCALE_COUNT] = { 24, 24, 24, 24, 24, 24, 24, 20, 20, 20, 16, 16, 16, 12, 12, 12 }; - static const ALuint to[4][BSINC_SCALE_COUNT] = - { - { 0, 24, 408, 792, 1176, 1560, 1944, 2328, 2648, 2968, 3288, 3544, 3800, 4056, 4248, 4440 }, - { 4632, 5016, 5400, 5784, 6168, 6552, 6936, 7320, 7640, 7960, 8280, 8536, 8792, 9048, 9240, 0 }, - { 0, 9432, 9816, 10200, 10584, 10968, 11352, 11736, 12056, 12376, 12696, 12952, 13208, 13464, 13656, 13848 }, - { 14040, 14424, 14808, 15192, 15576, 15960, 16344, 16728, 17048, 17368, 17688, 17944, 18200, 18456, 18648, 0 } - }; - static const ALuint tm[2][BSINC_SCALE_COUNT] = - { - { 0, 24, 24, 24, 24, 24, 24, 20, 20, 20, 16, 16, 16, 12, 12, 12 }, - { 24, 24, 24, 24, 24, 24, 24, 20, 20, 20, 16, 16, 16, 12, 12, 0 } - }; - ALfloat sf; - ALuint si, pi; - ALboolean uncut = AL_TRUE; + ALfloat sf = 0.0f; + ALsizei si = BSINC_SCALE_COUNT-1; if(increment > FRACTIONONE) { sf = (ALfloat)FRACTIONONE / increment; - if(sf < scaleBase) - { - /* Signal has been completely cut. The return result can be used - * to skip the filter (and output zeros) as an optimization. - */ - sf = 0.0f; - si = 0; - uncut = AL_FALSE; - } - else - { - sf = (BSINC_SCALE_COUNT - 1) * (sf - scaleBase) * scaleRange; - si = fastf2u(sf); - /* The interpolation factor is fit to this diagonally-symmetric - * curve to reduce the transition ripple caused by interpolating - * different scales of the sinc function. - */ - sf = 1.0f - cosf(asinf(sf - si)); - } - } - else - { - sf = 0.0f; - si = BSINC_SCALE_COUNT - 1; + sf = maxf(0.0f, (BSINC_SCALE_COUNT-1) * (sf-table->scaleBase) * table->scaleRange); + si = float2int(sf); + /* The interpolation factor is fit to this diagonally-symmetric curve + * to reduce the transition ripple caused by interpolating different + * scales of the sinc function. + */ + sf = 1.0f - cosf(asinf(sf - si)); } state->sf = sf; - state->m = m[si]; - state->l = -(ALint)((m[si] / 2) - 1); - /* The CPU cost of this table re-mapping could be traded for the memory - * cost of a complete table map (1024 elements large). - */ - for(pi = 0;pi < BSINC_PHASE_COUNT;pi++) - { - state->coeffs[pi].filter = &bsincTab[to[0][si] + tm[0][si]*pi]; - state->coeffs[pi].scDelta = &bsincTab[to[1][si] + tm[1][si]*pi]; - state->coeffs[pi].phDelta = &bsincTab[to[2][si] + tm[0][si]*pi]; - state->coeffs[pi].spDelta = &bsincTab[to[3][si] + tm[1][si]*pi]; - } - return uncut; + state->m = table->m[si]; + state->l = -((state->m/2) - 1); + state->filter = table->Tab + table->filterOffset[si]; } -static ALboolean CalcListenerParams(ALCcontext *Context) +static bool CalcContextParams(ALCcontext *Context) +{ + ALlistener *Listener = Context->Listener; + struct ALcontextProps *props; + + props = ATOMIC_EXCHANGE_PTR(&Context->Update, NULL, almemory_order_acq_rel); + if(!props) return false; + + Listener->Params.MetersPerUnit = props->MetersPerUnit; + + Listener->Params.DopplerFactor = props->DopplerFactor; + Listener->Params.SpeedOfSound = props->SpeedOfSound * props->DopplerVelocity; + if(!OverrideReverbSpeedOfSound) + Listener->Params.ReverbSpeedOfSound = Listener->Params.SpeedOfSound * + Listener->Params.MetersPerUnit; + + Listener->Params.SourceDistanceModel = props->SourceDistanceModel; + Listener->Params.DistanceModel = props->DistanceModel; + + ATOMIC_REPLACE_HEAD(struct ALcontextProps*, &Context->FreeContextProps, props); + return true; +} + +static bool CalcListenerParams(ALCcontext *Context) { ALlistener *Listener = Context->Listener; ALfloat N[3], V[3], U[3], P[3]; - struct ALlistenerProps *first; struct ALlistenerProps *props; aluVector vel; - props = ATOMIC_EXCHANGE(struct ALlistenerProps*, &Listener->Update, NULL, almemory_order_acq_rel); - if(!props) return AL_FALSE; + props = ATOMIC_EXCHANGE_PTR(&Listener->Update, NULL, almemory_order_acq_rel); + if(!props) return false; /* AT then UP */ - N[0] = ATOMIC_LOAD(&props->Forward[0], almemory_order_relaxed); - N[1] = ATOMIC_LOAD(&props->Forward[1], almemory_order_relaxed); - N[2] = ATOMIC_LOAD(&props->Forward[2], almemory_order_relaxed); + N[0] = props->Forward[0]; + N[1] = props->Forward[1]; + N[2] = props->Forward[2]; aluNormalize(N); - V[0] = ATOMIC_LOAD(&props->Up[0], almemory_order_relaxed); - V[1] = ATOMIC_LOAD(&props->Up[1], almemory_order_relaxed); - V[2] = ATOMIC_LOAD(&props->Up[2], almemory_order_relaxed); + V[0] = props->Up[0]; + V[1] = props->Up[1]; + V[2] = props->Up[2]; aluNormalize(V); /* Build and normalize right-vector */ aluCrossproduct(N, V, U); @@ -266,661 +427,787 @@ static ALboolean CalcListenerParams(ALCcontext *Context) 0.0, 0.0, 0.0, 1.0 ); - P[0] = ATOMIC_LOAD(&props->Position[0], almemory_order_relaxed); - P[1] = ATOMIC_LOAD(&props->Position[1], almemory_order_relaxed); - P[2] = ATOMIC_LOAD(&props->Position[2], almemory_order_relaxed); + P[0] = props->Position[0]; + P[1] = props->Position[1]; + P[2] = props->Position[2]; aluMatrixfFloat3(P, 1.0, &Listener->Params.Matrix); aluMatrixfSetRow(&Listener->Params.Matrix, 3, -P[0], -P[1], -P[2], 1.0f); - aluVectorSet(&vel, ATOMIC_LOAD(&props->Velocity[0], almemory_order_relaxed), - ATOMIC_LOAD(&props->Velocity[1], almemory_order_relaxed), - ATOMIC_LOAD(&props->Velocity[2], almemory_order_relaxed), - 0.0f); + aluVectorSet(&vel, props->Velocity[0], props->Velocity[1], props->Velocity[2], 0.0f); Listener->Params.Velocity = aluMatrixfVector(&Listener->Params.Matrix, &vel); - Listener->Params.Gain = ATOMIC_LOAD(&props->Gain, almemory_order_relaxed) * Context->GainBoost; - Listener->Params.MetersPerUnit = ATOMIC_LOAD(&props->MetersPerUnit, almemory_order_relaxed); + Listener->Params.Gain = props->Gain * Context->GainBoost; - Listener->Params.DopplerFactor = ATOMIC_LOAD(&props->DopplerFactor, almemory_order_relaxed); - Listener->Params.SpeedOfSound = ATOMIC_LOAD(&props->SpeedOfSound, almemory_order_relaxed) * - ATOMIC_LOAD(&props->DopplerVelocity, almemory_order_relaxed); - - Listener->Params.SourceDistanceModel = ATOMIC_LOAD(&props->SourceDistanceModel, almemory_order_relaxed); - Listener->Params.DistanceModel = ATOMIC_LOAD(&props->DistanceModel, almemory_order_relaxed); - - /* WARNING: A livelock is theoretically possible if another thread keeps - * changing the freelist head without giving this a chance to actually swap - * in the old container (practically impossible with this little code, - * but...). - */ - first = ATOMIC_LOAD(&Listener->FreeList); - do { - ATOMIC_STORE(&props->next, first, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALlistenerProps*, - &Listener->FreeList, &first, props) == 0); - - return AL_TRUE; + ATOMIC_REPLACE_HEAD(struct ALlistenerProps*, &Context->FreeListenerProps, props); + return true; } -static ALboolean CalcEffectSlotParams(ALeffectslot *slot, ALCdevice *device) +static bool CalcEffectSlotParams(ALeffectslot *slot, ALCcontext *context, bool force) { - struct ALeffectslotProps *first; struct ALeffectslotProps *props; ALeffectState *state; - props = ATOMIC_EXCHANGE(struct ALeffectslotProps*, &slot->Update, NULL, almemory_order_acq_rel); - if(!props) return AL_FALSE; + props = ATOMIC_EXCHANGE_PTR(&slot->Update, NULL, almemory_order_acq_rel); + if(!props && !force) return false; - slot->Params.Gain = ATOMIC_LOAD(&props->Gain, almemory_order_relaxed); - slot->Params.AuxSendAuto = ATOMIC_LOAD(&props->AuxSendAuto, almemory_order_relaxed); - slot->Params.EffectType = ATOMIC_LOAD(&props->Type, almemory_order_relaxed); - if(IsReverbEffect(slot->Params.EffectType)) + if(props) { - slot->Params.RoomRolloff = props->Props.Reverb.RoomRolloffFactor; - slot->Params.DecayTime = props->Props.Reverb.DecayTime; - slot->Params.AirAbsorptionGainHF = props->Props.Reverb.AirAbsorptionGainHF; + slot->Params.Gain = props->Gain; + slot->Params.AuxSendAuto = props->AuxSendAuto; + slot->Params.EffectType = props->Type; + slot->Params.EffectProps = props->Props; + if(IsReverbEffect(props->Type)) + { + slot->Params.RoomRolloff = props->Props.Reverb.RoomRolloffFactor; + slot->Params.DecayTime = props->Props.Reverb.DecayTime; + slot->Params.DecayLFRatio = props->Props.Reverb.DecayLFRatio; + slot->Params.DecayHFRatio = props->Props.Reverb.DecayHFRatio; + slot->Params.DecayHFLimit = props->Props.Reverb.DecayHFLimit; + slot->Params.AirAbsorptionGainHF = props->Props.Reverb.AirAbsorptionGainHF; + } + else + { + slot->Params.RoomRolloff = 0.0f; + slot->Params.DecayTime = 0.0f; + slot->Params.DecayLFRatio = 0.0f; + slot->Params.DecayHFRatio = 0.0f; + slot->Params.DecayHFLimit = AL_FALSE; + slot->Params.AirAbsorptionGainHF = 1.0f; + } + + /* Swap effect states. No need to play with the ref counts since they + * keep the same number of refs. + */ + state = props->State; + props->State = slot->Params.EffectState; + slot->Params.EffectState = state; + + ATOMIC_REPLACE_HEAD(struct ALeffectslotProps*, &context->FreeEffectslotProps, props); } else - { - slot->Params.RoomRolloff = 0.0f; - slot->Params.DecayTime = 0.0f; - slot->Params.AirAbsorptionGainHF = 1.0f; - } + state = slot->Params.EffectState; - /* Swap effect states. No need to play with the ref counts since they keep - * the same number of refs. - */ - state = ATOMIC_EXCHANGE(ALeffectState*, &props->State, slot->Params.EffectState, - almemory_order_relaxed); - slot->Params.EffectState = state; - - V(state,update)(device, slot, &props->Props); - - /* WARNING: A livelock is theoretically possible if another thread keeps - * changing the freelist head without giving this a chance to actually swap - * in the old container (practically impossible with this little code, - * but...). - */ - first = ATOMIC_LOAD(&slot->FreeList); - do { - ATOMIC_STORE(&props->next, first, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALeffectslotProps*, - &slot->FreeList, &first, props) == 0); - - return AL_TRUE; + V(state,update)(context, slot, &slot->Params.EffectProps); + return true; } -static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALsourceProps *props, const ALbuffer *ALBuffer, const ALCcontext *ALContext) -{ - static const struct ChanMap MonoMap[1] = { - { FrontCenter, 0.0f, 0.0f } - }, RearMap[2] = { - { BackLeft, DEG2RAD(-150.0f), DEG2RAD(0.0f) }, - { BackRight, DEG2RAD( 150.0f), DEG2RAD(0.0f) } - }, QuadMap[4] = { - { FrontLeft, DEG2RAD( -45.0f), DEG2RAD(0.0f) }, - { FrontRight, DEG2RAD( 45.0f), DEG2RAD(0.0f) }, - { BackLeft, DEG2RAD(-135.0f), DEG2RAD(0.0f) }, - { BackRight, DEG2RAD( 135.0f), DEG2RAD(0.0f) } - }, X51Map[6] = { - { FrontLeft, DEG2RAD( -30.0f), DEG2RAD(0.0f) }, - { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f) }, - { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f) }, - { LFE, 0.0f, 0.0f }, - { SideLeft, DEG2RAD(-110.0f), DEG2RAD(0.0f) }, - { SideRight, DEG2RAD( 110.0f), DEG2RAD(0.0f) } - }, X61Map[7] = { - { FrontLeft, DEG2RAD(-30.0f), DEG2RAD(0.0f) }, - { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f) }, - { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f) }, - { LFE, 0.0f, 0.0f }, - { BackCenter, DEG2RAD(180.0f), DEG2RAD(0.0f) }, - { SideLeft, DEG2RAD(-90.0f), DEG2RAD(0.0f) }, - { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f) } - }, X71Map[8] = { - { FrontLeft, DEG2RAD( -30.0f), DEG2RAD(0.0f) }, - { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f) }, - { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f) }, - { LFE, 0.0f, 0.0f }, - { BackLeft, DEG2RAD(-150.0f), DEG2RAD(0.0f) }, - { BackRight, DEG2RAD( 150.0f), DEG2RAD(0.0f) }, - { SideLeft, DEG2RAD( -90.0f), DEG2RAD(0.0f) }, - { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f) } - }; +static const struct ChanMap MonoMap[1] = { + { FrontCenter, 0.0f, 0.0f } +}, RearMap[2] = { + { BackLeft, DEG2RAD(-150.0f), DEG2RAD(0.0f) }, + { BackRight, DEG2RAD( 150.0f), DEG2RAD(0.0f) } +}, QuadMap[4] = { + { FrontLeft, DEG2RAD( -45.0f), DEG2RAD(0.0f) }, + { FrontRight, DEG2RAD( 45.0f), DEG2RAD(0.0f) }, + { BackLeft, DEG2RAD(-135.0f), DEG2RAD(0.0f) }, + { BackRight, DEG2RAD( 135.0f), DEG2RAD(0.0f) } +}, X51Map[6] = { + { FrontLeft, DEG2RAD( -30.0f), DEG2RAD(0.0f) }, + { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f) }, + { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f) }, + { LFE, 0.0f, 0.0f }, + { SideLeft, DEG2RAD(-110.0f), DEG2RAD(0.0f) }, + { SideRight, DEG2RAD( 110.0f), DEG2RAD(0.0f) } +}, X61Map[7] = { + { FrontLeft, DEG2RAD(-30.0f), DEG2RAD(0.0f) }, + { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f) }, + { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f) }, + { LFE, 0.0f, 0.0f }, + { BackCenter, DEG2RAD(180.0f), DEG2RAD(0.0f) }, + { SideLeft, DEG2RAD(-90.0f), DEG2RAD(0.0f) }, + { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f) } +}, X71Map[8] = { + { FrontLeft, DEG2RAD( -30.0f), DEG2RAD(0.0f) }, + { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f) }, + { FrontCenter, DEG2RAD( 0.0f), DEG2RAD(0.0f) }, + { LFE, 0.0f, 0.0f }, + { BackLeft, DEG2RAD(-150.0f), DEG2RAD(0.0f) }, + { BackRight, DEG2RAD( 150.0f), DEG2RAD(0.0f) }, + { SideLeft, DEG2RAD( -90.0f), DEG2RAD(0.0f) }, + { SideRight, DEG2RAD( 90.0f), DEG2RAD(0.0f) } +}; - const ALCdevice *Device = ALContext->Device; - const ALlistener *Listener = ALContext->Listener; - ALfloat SourceVolume,ListenerGain,MinVolume,MaxVolume; - ALfloat DryGain, DryGainHF, DryGainLF; - ALfloat WetGain[MAX_SENDS]; - ALfloat WetGainHF[MAX_SENDS]; - ALfloat WetGainLF[MAX_SENDS]; - ALeffectslot *SendSlots[MAX_SENDS]; - ALuint NumSends, Frequency; - ALboolean Relative; - const struct ChanMap *chans = NULL; +static void CalcPanningAndFilters(ALvoice *voice, const ALfloat Azi, const ALfloat Elev, + const ALfloat Distance, const ALfloat Spread, + const ALfloat DryGain, const ALfloat DryGainHF, + const ALfloat DryGainLF, const ALfloat *WetGain, + const ALfloat *WetGainLF, const ALfloat *WetGainHF, + ALeffectslot **SendSlots, const ALbuffer *Buffer, + const struct ALvoiceProps *props, const ALlistener *Listener, + const ALCdevice *Device) +{ struct ChanMap StereoMap[2] = { { FrontLeft, DEG2RAD(-30.0f), DEG2RAD(0.0f) }, { FrontRight, DEG2RAD( 30.0f), DEG2RAD(0.0f) } }; - ALuint num_channels = 0; - ALboolean DirectChannels; - ALboolean isbformat = AL_FALSE; - ALfloat Pitch; - ALuint i, j, c; + bool DirectChannels = props->DirectChannels; + const ALsizei NumSends = Device->NumAuxSends; + const ALuint Frequency = Device->Frequency; + const struct ChanMap *chans = NULL; + ALsizei num_channels = 0; + bool isbformat = false; + ALfloat downmix_gain = 1.0f; + ALsizei c, i; - /* Get device properties */ - NumSends = Device->NumAuxSends; - Frequency = Device->Frequency; - - /* Get listener properties */ - ListenerGain = Listener->Params.Gain; - - /* Get source properties */ - SourceVolume = ATOMIC_LOAD(&props->Gain, almemory_order_relaxed); - MinVolume = ATOMIC_LOAD(&props->MinGain, almemory_order_relaxed); - MaxVolume = ATOMIC_LOAD(&props->MaxGain, almemory_order_relaxed); - Pitch = ATOMIC_LOAD(&props->Pitch, almemory_order_relaxed); - Relative = ATOMIC_LOAD(&props->HeadRelative, almemory_order_relaxed); - DirectChannels = ATOMIC_LOAD(&props->DirectChannels, almemory_order_relaxed); - - /* Convert counter-clockwise to clockwise. */ - StereoMap[0].angle = -ATOMIC_LOAD(&props->StereoPan[0], almemory_order_relaxed); - StereoMap[1].angle = -ATOMIC_LOAD(&props->StereoPan[1], almemory_order_relaxed); - - voice->DirectOut.Buffer = Device->Dry.Buffer; - voice->DirectOut.Channels = Device->Dry.NumChannels; - for(i = 0;i < NumSends;i++) - { - SendSlots[i] = ATOMIC_LOAD(&props->Send[i].Slot, almemory_order_relaxed); - if(!SendSlots[i] && i == 0) - SendSlots[i] = Device->DefaultSlot; - if(!SendSlots[i] || SendSlots[i]->Params.EffectType == AL_EFFECT_NULL) - { - SendSlots[i] = NULL; - voice->SendOut[i].Buffer = NULL; - voice->SendOut[i].Channels = 0; - } - else - { - voice->SendOut[i].Buffer = SendSlots[i]->WetBuffer; - voice->SendOut[i].Channels = SendSlots[i]->NumChannels; - } - } - - /* Calculate the stepping value */ - Pitch *= (ALfloat)ALBuffer->Frequency / Frequency; - if(Pitch > (ALfloat)MAX_PITCH) - voice->Step = MAX_PITCH<Step = maxi(fastf2i(Pitch*FRACTIONONE + 0.5f), 1); - BsincPrepare(voice->Step, &voice->SincState); - - /* Calculate gains */ - DryGain = clampf(SourceVolume, MinVolume, MaxVolume); - DryGain *= ATOMIC_LOAD(&props->Direct.Gain, almemory_order_relaxed) * ListenerGain; - DryGain = minf(DryGain, GAIN_MIX_MAX); - DryGainHF = ATOMIC_LOAD(&props->Direct.GainHF, almemory_order_relaxed); - DryGainLF = ATOMIC_LOAD(&props->Direct.GainLF, almemory_order_relaxed); - for(i = 0;i < NumSends;i++) - { - WetGain[i] = clampf(SourceVolume, MinVolume, MaxVolume); - WetGain[i] *= ATOMIC_LOAD(&props->Send[i].Gain, almemory_order_relaxed) * ListenerGain; - WetGain[i] = minf(WetGain[i], GAIN_MIX_MAX); - WetGainHF[i] = ATOMIC_LOAD(&props->Send[i].GainHF, almemory_order_relaxed); - WetGainLF[i] = ATOMIC_LOAD(&props->Send[i].GainLF, almemory_order_relaxed); - } - - switch(ALBuffer->FmtChannels) + switch(Buffer->FmtChannels) { case FmtMono: chans = MonoMap; num_channels = 1; + /* Mono buffers are never played direct. */ + DirectChannels = false; break; case FmtStereo: + /* Convert counter-clockwise to clockwise. */ + StereoMap[0].angle = -props->StereoPan[0]; + StereoMap[1].angle = -props->StereoPan[1]; + chans = StereoMap; num_channels = 2; + downmix_gain = 1.0f / 2.0f; break; case FmtRear: chans = RearMap; num_channels = 2; + downmix_gain = 1.0f / 2.0f; break; case FmtQuad: chans = QuadMap; num_channels = 4; + downmix_gain = 1.0f / 4.0f; break; case FmtX51: chans = X51Map; num_channels = 6; + /* NOTE: Excludes LFE. */ + downmix_gain = 1.0f / 5.0f; break; case FmtX61: chans = X61Map; num_channels = 7; + /* NOTE: Excludes LFE. */ + downmix_gain = 1.0f / 6.0f; break; case FmtX71: chans = X71Map; num_channels = 8; + /* NOTE: Excludes LFE. */ + downmix_gain = 1.0f / 7.0f; break; case FmtBFormat2D: num_channels = 3; - isbformat = AL_TRUE; - DirectChannels = AL_FALSE; + isbformat = true; + DirectChannels = false; break; case FmtBFormat3D: num_channels = 4; - isbformat = AL_TRUE; - DirectChannels = AL_FALSE; + isbformat = true; + DirectChannels = false; break; } + for(c = 0;c < num_channels;c++) + { + memset(&voice->Direct.Params[c].Hrtf.Target, 0, + sizeof(voice->Direct.Params[c].Hrtf.Target)); + ClearArray(voice->Direct.Params[c].Gains.Target); + } + for(i = 0;i < NumSends;i++) + { + for(c = 0;c < num_channels;c++) + ClearArray(voice->Send[i].Params[c].Gains.Target); + } + + voice->Flags &= ~(VOICE_HAS_HRTF | VOICE_HAS_NFC); if(isbformat) { - ALfloat N[3], V[3], U[3]; - aluMatrixf matrix; - ALfloat scale; + /* Special handling for B-Format sources. */ - /* AT then UP */ - N[0] = ATOMIC_LOAD(&props->Orientation[0][0], almemory_order_relaxed); - N[1] = ATOMIC_LOAD(&props->Orientation[0][1], almemory_order_relaxed); - N[2] = ATOMIC_LOAD(&props->Orientation[0][2], almemory_order_relaxed); - aluNormalize(N); - V[0] = ATOMIC_LOAD(&props->Orientation[1][0], almemory_order_relaxed); - V[1] = ATOMIC_LOAD(&props->Orientation[1][1], almemory_order_relaxed); - V[2] = ATOMIC_LOAD(&props->Orientation[1][2], almemory_order_relaxed); - aluNormalize(V); - if(!Relative) + if(Distance > FLT_EPSILON) { - const aluMatrixf *lmatrix = &Listener->Params.Matrix; - aluMatrixfFloat3(N, 0.0f, lmatrix); - aluMatrixfFloat3(V, 0.0f, lmatrix); - } - /* Build and normalize right-vector */ - aluCrossproduct(N, V, U); - aluNormalize(U); - - /* Build a rotate + conversion matrix (FuMa -> ACN+N3D). */ - scale = 1.732050808f; - aluMatrixfSet(&matrix, - 1.414213562f, 0.0f, 0.0f, 0.0f, - 0.0f, -N[0]*scale, N[1]*scale, -N[2]*scale, - 0.0f, U[0]*scale, -U[1]*scale, U[2]*scale, - 0.0f, -V[0]*scale, V[1]*scale, -V[2]*scale - ); - - voice->DirectOut.Buffer = Device->FOAOut.Buffer; - voice->DirectOut.Channels = Device->FOAOut.NumChannels; - for(c = 0;c < num_channels;c++) - ComputeFirstOrderGains(Device->FOAOut, matrix.m[c], DryGain, - voice->Chan[c].Direct.Gains.Target); - - for(i = 0;i < NumSends;i++) - { - if(!SendSlots[i]) - { - for(c = 0;c < num_channels;c++) - { - for(j = 0;j < MAX_EFFECT_CHANNELS;j++) - voice->Chan[c].Send[i].Gains.Target[j] = 0.0f; - } - } - else - { - for(c = 0;c < num_channels;c++) - { - const ALeffectslot *Slot = SendSlots[i]; - ComputeFirstOrderGainsBF(Slot->ChanMap, Slot->NumChannels, matrix.m[c], - WetGain[i], voice->Chan[c].Send[i].Gains.Target); - } - } - } - - voice->IsHrtf = AL_FALSE; - } - else - { - ALfloat coeffs[MAX_AMBI_COEFFS]; - - if(DirectChannels) - { - /* Skip the virtual channels and write inputs to the real output. */ - voice->DirectOut.Buffer = Device->RealOut.Buffer; - voice->DirectOut.Channels = Device->RealOut.NumChannels; - for(c = 0;c < num_channels;c++) - { - int idx; - for(j = 0;j < MAX_OUTPUT_CHANNELS;j++) - voice->Chan[c].Direct.Gains.Target[j] = 0.0f; - if((idx=GetChannelIdxByName(Device->RealOut, chans[c].channel)) != -1) - voice->Chan[c].Direct.Gains.Target[idx] = DryGain; - } - - /* Auxiliary sends still use normal panning since they mix to B-Format, which can't - * channel-match. */ - for(c = 0;c < num_channels;c++) - { - CalcAngleCoeffs(chans[c].angle, chans[c].elevation, 0.0f, coeffs); - - for(i = 0;i < NumSends;i++) - { - if(!SendSlots[i]) - { - for(j = 0;j < MAX_EFFECT_CHANNELS;j++) - voice->Chan[c].Send[i].Gains.Target[j] = 0.0f; - } - else - { - const ALeffectslot *Slot = SendSlots[i]; - ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs, - WetGain[i], voice->Chan[c].Send[i].Gains.Target); - } - } - } - - voice->IsHrtf = AL_FALSE; - } - else if(Device->Render_Mode == HrtfRender) - { - /* Full HRTF rendering. Skip the virtual channels and render each - * input channel to the real outputs. + /* Panning a B-Format sound toward some direction is easy. Just pan + * the first (W) channel as a normal mono sound and silence the + * others. */ - voice->DirectOut.Buffer = Device->RealOut.Buffer; - voice->DirectOut.Channels = Device->RealOut.NumChannels; - for(c = 0;c < num_channels;c++) + ALfloat coeffs[MAX_AMBI_COEFFS]; + + if(Device->AvgSpeakerDist > 0.0f) { - if(chans[c].channel == LFE) - { - /* Skip LFE */ - voice->Chan[c].Direct.Hrtf.Target.Delay[0] = 0; - voice->Chan[c].Direct.Hrtf.Target.Delay[1] = 0; - for(i = 0;i < HRIR_LENGTH;i++) - { - voice->Chan[c].Direct.Hrtf.Target.Coeffs[i][0] = 0.0f; - voice->Chan[c].Direct.Hrtf.Target.Coeffs[i][1] = 0.0f; - } + ALfloat mdist = Distance * Listener->Params.MetersPerUnit; + ALfloat w0 = SPEEDOFSOUNDMETRESPERSEC / + (mdist * (ALfloat)Device->Frequency); + ALfloat w1 = SPEEDOFSOUNDMETRESPERSEC / + (Device->AvgSpeakerDist * (ALfloat)Device->Frequency); + /* Clamp w0 for really close distances, to prevent excessive + * bass. + */ + w0 = minf(w0, w1*4.0f); - for(i = 0;i < NumSends;i++) - { - for(j = 0;j < MAX_EFFECT_CHANNELS;j++) - voice->Chan[c].Send[i].Gains.Target[j] = 0.0f; - } + /* Only need to adjust the first channel of a B-Format source. */ + NfcFilterAdjust(&voice->Direct.Params[0].NFCtrlFilter, w0); - continue; - } - - /* Get the static HRIR coefficients and delays for this channel. */ - GetHrtfCoeffs(Device->Hrtf.Handle, - chans[c].elevation, chans[c].angle, 0.0f, DryGain, - voice->Chan[c].Direct.Hrtf.Target.Coeffs, - voice->Chan[c].Direct.Hrtf.Target.Delay - ); - - /* Normal panning for auxiliary sends. */ - CalcAngleCoeffs(chans[c].angle, chans[c].elevation, 0.0f, coeffs); - - for(i = 0;i < NumSends;i++) - { - if(!SendSlots[i]) - { - for(j = 0;j < MAX_EFFECT_CHANNELS;j++) - voice->Chan[c].Send[i].Gains.Target[j] = 0.0f; - } - else - { - const ALeffectslot *Slot = SendSlots[i]; - ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs, - WetGain[i], voice->Chan[c].Send[i].Gains.Target); - } - } + for(i = 0;i < MAX_AMBI_ORDER+1;i++) + voice->Direct.ChannelsPerOrder[i] = Device->Dry.NumChannelsPerOrder[i]; + voice->Flags |= VOICE_HAS_NFC; } - voice->IsHrtf = AL_TRUE; + if(Device->Render_Mode == StereoPair) + CalcAnglePairwiseCoeffs(Azi, Elev, Spread, coeffs); + else + CalcAngleCoeffs(Azi, Elev, Spread, coeffs); + + /* NOTE: W needs to be scaled by sqrt(2) due to FuMa normalization. */ + ComputeDryPanGains(&Device->Dry, coeffs, DryGain*1.414213562f, + voice->Direct.Params[0].Gains.Target); + for(i = 0;i < NumSends;i++) + { + const ALeffectslot *Slot = SendSlots[i]; + if(Slot) + ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, + coeffs, WetGain[i]*1.414213562f, voice->Send[i].Params[0].Gains.Target + ); + } } else { - /* Non-HRTF rendering. Use normal panning to the output. */ + /* Local B-Format sources have their XYZ channels rotated according + * to the orientation. + */ + const ALfloat sqrt_2 = sqrtf(2.0f); + const ALfloat sqrt_3 = sqrtf(3.0f); + ALfloat N[3], V[3], U[3]; + aluMatrixf matrix; + + if(Device->AvgSpeakerDist > 0.0f) + { + /* NOTE: The NFCtrlFilters were created with a w0 of 0, which + * is what we want for FOA input. The first channel may have + * been previously re-adjusted if panned, so reset it. + */ + NfcFilterAdjust(&voice->Direct.Params[0].NFCtrlFilter, 0.0f); + + voice->Direct.ChannelsPerOrder[0] = 1; + voice->Direct.ChannelsPerOrder[1] = mini(voice->Direct.Channels-1, 3); + for(i = 2;i < MAX_AMBI_ORDER+1;i++) + voice->Direct.ChannelsPerOrder[i] = 0; + voice->Flags |= VOICE_HAS_NFC; + } + + /* AT then UP */ + N[0] = props->Orientation[0][0]; + N[1] = props->Orientation[0][1]; + N[2] = props->Orientation[0][2]; + aluNormalize(N); + V[0] = props->Orientation[1][0]; + V[1] = props->Orientation[1][1]; + V[2] = props->Orientation[1][2]; + aluNormalize(V); + if(!props->HeadRelative) + { + const aluMatrixf *lmatrix = &Listener->Params.Matrix; + aluMatrixfFloat3(N, 0.0f, lmatrix); + aluMatrixfFloat3(V, 0.0f, lmatrix); + } + /* Build and normalize right-vector */ + aluCrossproduct(N, V, U); + aluNormalize(U); + + /* Build a rotate + conversion matrix (FuMa -> ACN+N3D). NOTE: This + * matrix is transposed, for the inputs to align on the rows and + * outputs on the columns. + */ + aluMatrixfSet(&matrix, + // ACN0 ACN1 ACN2 ACN3 + sqrt_2, 0.0f, 0.0f, 0.0f, // Ambi W + 0.0f, -N[0]*sqrt_3, N[1]*sqrt_3, -N[2]*sqrt_3, // Ambi X + 0.0f, U[0]*sqrt_3, -U[1]*sqrt_3, U[2]*sqrt_3, // Ambi Y + 0.0f, -V[0]*sqrt_3, V[1]*sqrt_3, -V[2]*sqrt_3 // Ambi Z + ); + + voice->Direct.Buffer = Device->FOAOut.Buffer; + voice->Direct.Channels = Device->FOAOut.NumChannels; + for(c = 0;c < num_channels;c++) + ComputeFirstOrderGains(&Device->FOAOut, matrix.m[c], DryGain, + voice->Direct.Params[c].Gains.Target); + for(i = 0;i < NumSends;i++) + { + const ALeffectslot *Slot = SendSlots[i]; + if(Slot) + { + for(c = 0;c < num_channels;c++) + ComputeFirstOrderGainsBF(Slot->ChanMap, Slot->NumChannels, + matrix.m[c], WetGain[i], voice->Send[i].Params[c].Gains.Target + ); + } + } + } + } + else if(DirectChannels) + { + /* Direct source channels always play local. Skip the virtual channels + * and write inputs to the matching real outputs. + */ + voice->Direct.Buffer = Device->RealOut.Buffer; + voice->Direct.Channels = Device->RealOut.NumChannels; + + for(c = 0;c < num_channels;c++) + { + int idx = GetChannelIdxByName(&Device->RealOut, chans[c].channel); + if(idx != -1) voice->Direct.Params[c].Gains.Target[idx] = DryGain; + } + + /* Auxiliary sends still use normal channel panning since they mix to + * B-Format, which can't channel-match. + */ + for(c = 0;c < num_channels;c++) + { + ALfloat coeffs[MAX_AMBI_COEFFS]; + CalcAngleCoeffs(chans[c].angle, chans[c].elevation, 0.0f, coeffs); + + for(i = 0;i < NumSends;i++) + { + const ALeffectslot *Slot = SendSlots[i]; + if(Slot) + ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, + coeffs, WetGain[i], voice->Send[i].Params[c].Gains.Target + ); + } + } + } + else if(Device->Render_Mode == HrtfRender) + { + /* Full HRTF rendering. Skip the virtual channels and render to the + * real outputs. + */ + voice->Direct.Buffer = Device->RealOut.Buffer; + voice->Direct.Channels = Device->RealOut.NumChannels; + + if(Distance > FLT_EPSILON) + { + ALfloat coeffs[MAX_AMBI_COEFFS]; + + /* Get the HRIR coefficients and delays just once, for the given + * source direction. + */ + GetHrtfCoeffs(Device->HrtfHandle, Elev, Azi, Spread, + voice->Direct.Params[0].Hrtf.Target.Coeffs, + voice->Direct.Params[0].Hrtf.Target.Delay); + voice->Direct.Params[0].Hrtf.Target.Gain = DryGain * downmix_gain; + + /* Remaining channels use the same results as the first. */ + for(c = 1;c < num_channels;c++) + { + /* Skip LFE */ + if(chans[c].channel != LFE) + voice->Direct.Params[c].Hrtf.Target = voice->Direct.Params[0].Hrtf.Target; + } + + /* Calculate the directional coefficients once, which apply to all + * input channels of the source sends. + */ + CalcAngleCoeffs(Azi, Elev, Spread, coeffs); + + for(i = 0;i < NumSends;i++) + { + const ALeffectslot *Slot = SendSlots[i]; + if(Slot) + for(c = 0;c < num_channels;c++) + { + /* Skip LFE */ + if(chans[c].channel != LFE) + ComputePanningGainsBF(Slot->ChanMap, + Slot->NumChannels, coeffs, WetGain[i] * downmix_gain, + voice->Send[i].Params[c].Gains.Target + ); + } + } + } + else + { + /* Local sources on HRTF play with each channel panned to its + * relative location around the listener, providing "virtual + * speaker" responses. + */ + for(c = 0;c < num_channels;c++) + { + ALfloat coeffs[MAX_AMBI_COEFFS]; + + if(chans[c].channel == LFE) + { + /* Skip LFE */ + continue; + } + + /* Get the HRIR coefficients and delays for this channel + * position. + */ + GetHrtfCoeffs(Device->HrtfHandle, + chans[c].elevation, chans[c].angle, Spread, + voice->Direct.Params[c].Hrtf.Target.Coeffs, + voice->Direct.Params[c].Hrtf.Target.Delay + ); + voice->Direct.Params[c].Hrtf.Target.Gain = DryGain; + + /* Normal panning for auxiliary sends. */ + CalcAngleCoeffs(chans[c].angle, chans[c].elevation, Spread, coeffs); + + for(i = 0;i < NumSends;i++) + { + const ALeffectslot *Slot = SendSlots[i]; + if(Slot) + ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, + coeffs, WetGain[i], voice->Send[i].Params[c].Gains.Target + ); + } + } + } + + voice->Flags |= VOICE_HAS_HRTF; + } + else + { + /* Non-HRTF rendering. Use normal panning to the output. */ + + if(Distance > FLT_EPSILON) + { + ALfloat coeffs[MAX_AMBI_COEFFS]; + ALfloat w0 = 0.0f; + + /* Calculate NFC filter coefficient if needed. */ + if(Device->AvgSpeakerDist > 0.0f) + { + ALfloat mdist = Distance * Listener->Params.MetersPerUnit; + ALfloat w1 = SPEEDOFSOUNDMETRESPERSEC / + (Device->AvgSpeakerDist * (ALfloat)Device->Frequency); + w0 = SPEEDOFSOUNDMETRESPERSEC / + (mdist * (ALfloat)Device->Frequency); + /* Clamp w0 for really close distances, to prevent excessive + * bass. + */ + w0 = minf(w0, w1*4.0f); + + /* Adjust NFC filters. */ + for(c = 0;c < num_channels;c++) + NfcFilterAdjust(&voice->Direct.Params[c].NFCtrlFilter, w0); + + for(i = 0;i < MAX_AMBI_ORDER+1;i++) + voice->Direct.ChannelsPerOrder[i] = Device->Dry.NumChannelsPerOrder[i]; + voice->Flags |= VOICE_HAS_NFC; + } + + /* Calculate the directional coefficients once, which apply to all + * input channels. + */ + if(Device->Render_Mode == StereoPair) + CalcAnglePairwiseCoeffs(Azi, Elev, Spread, coeffs); + else + CalcAngleCoeffs(Azi, Elev, Spread, coeffs); + for(c = 0;c < num_channels;c++) { /* Special-case LFE */ if(chans[c].channel == LFE) { - for(j = 0;j < MAX_OUTPUT_CHANNELS;j++) - voice->Chan[c].Direct.Gains.Target[j] = 0.0f; if(Device->Dry.Buffer == Device->RealOut.Buffer) { - int idx; - if((idx=GetChannelIdxByName(Device->RealOut, chans[c].channel)) != -1) - voice->Chan[c].Direct.Gains.Target[idx] = DryGain; + int idx = GetChannelIdxByName(&Device->RealOut, chans[c].channel); + if(idx != -1) voice->Direct.Params[c].Gains.Target[idx] = DryGain; } + continue; + } - for(i = 0;i < NumSends;i++) + ComputeDryPanGains(&Device->Dry, + coeffs, DryGain * downmix_gain, voice->Direct.Params[c].Gains.Target + ); + } + + for(i = 0;i < NumSends;i++) + { + const ALeffectslot *Slot = SendSlots[i]; + if(Slot) + for(c = 0;c < num_channels;c++) { - ALuint j; - for(j = 0;j < MAX_EFFECT_CHANNELS;j++) - voice->Chan[c].Send[i].Gains.Target[j] = 0.0f; + /* Skip LFE */ + if(chans[c].channel != LFE) + ComputePanningGainsBF(Slot->ChanMap, + Slot->NumChannels, coeffs, WetGain[i] * downmix_gain, + voice->Send[i].Params[c].Gains.Target + ); + } + } + } + else + { + ALfloat w0 = 0.0f; + + if(Device->AvgSpeakerDist > 0.0f) + { + /* If the source distance is 0, set w0 to w1 to act as a pass- + * through. We still want to pass the signal through the + * filters so they keep an appropriate history, in case the + * source moves away from the listener. + */ + w0 = SPEEDOFSOUNDMETRESPERSEC / + (Device->AvgSpeakerDist * (ALfloat)Device->Frequency); + + for(c = 0;c < num_channels;c++) + NfcFilterAdjust(&voice->Direct.Params[c].NFCtrlFilter, w0); + + for(i = 0;i < MAX_AMBI_ORDER+1;i++) + voice->Direct.ChannelsPerOrder[i] = Device->Dry.NumChannelsPerOrder[i]; + voice->Flags |= VOICE_HAS_NFC; + } + + for(c = 0;c < num_channels;c++) + { + ALfloat coeffs[MAX_AMBI_COEFFS]; + + /* Special-case LFE */ + if(chans[c].channel == LFE) + { + if(Device->Dry.Buffer == Device->RealOut.Buffer) + { + int idx = GetChannelIdxByName(&Device->RealOut, chans[c].channel); + if(idx != -1) voice->Direct.Params[c].Gains.Target[idx] = DryGain; } continue; } if(Device->Render_Mode == StereoPair) - { - /* Clamp X so it remains within 30 degrees of 0 or 180 degree azimuth. */ - ALfloat x = sinf(chans[c].angle) * cosf(chans[c].elevation); - coeffs[0] = clampf(-x, -0.5f, 0.5f) + 0.5f; - voice->Chan[c].Direct.Gains.Target[0] = coeffs[0] * DryGain; - voice->Chan[c].Direct.Gains.Target[1] = (1.0f-coeffs[0]) * DryGain; - for(j = 2;j < MAX_OUTPUT_CHANNELS;j++) - voice->Chan[c].Direct.Gains.Target[j] = 0.0f; - - CalcAngleCoeffs(chans[c].angle, chans[c].elevation, 0.0f, coeffs); - } + CalcAnglePairwiseCoeffs(chans[c].angle, chans[c].elevation, Spread, coeffs); else - { - CalcAngleCoeffs(chans[c].angle, chans[c].elevation, 0.0f, coeffs); - ComputePanningGains(Device->Dry, coeffs, DryGain, - voice->Chan[c].Direct.Gains.Target); - } + CalcAngleCoeffs(chans[c].angle, chans[c].elevation, Spread, coeffs); + ComputeDryPanGains(&Device->Dry, + coeffs, DryGain, voice->Direct.Params[c].Gains.Target + ); for(i = 0;i < NumSends;i++) { - if(!SendSlots[i]) - { - ALuint j; - for(j = 0;j < MAX_EFFECT_CHANNELS;j++) - voice->Chan[c].Send[i].Gains.Target[j] = 0.0f; - } - else - { - const ALeffectslot *Slot = SendSlots[i]; - ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs, - WetGain[i], voice->Chan[c].Send[i].Gains.Target); - } + const ALeffectslot *Slot = SendSlots[i]; + if(Slot) + ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, + coeffs, WetGain[i], voice->Send[i].Params[c].Gains.Target + ); } } - - voice->IsHrtf = AL_FALSE; } } { - ALfloat hfscale = ATOMIC_LOAD(&props->Direct.HFReference, almemory_order_relaxed) / - Frequency; - ALfloat lfscale = ATOMIC_LOAD(&props->Direct.LFReference, almemory_order_relaxed) / - Frequency; - DryGainHF = maxf(DryGainHF, 0.0001f); - DryGainLF = maxf(DryGainLF, 0.0001f); - for(c = 0;c < num_channels;c++) + ALfloat hfScale = props->Direct.HFReference / Frequency; + ALfloat lfScale = props->Direct.LFReference / Frequency; + ALfloat gainHF = maxf(DryGainHF, 0.001f); /* Limit -60dB */ + ALfloat gainLF = maxf(DryGainLF, 0.001f); + + voice->Direct.FilterType = AF_None; + if(gainHF != 1.0f) voice->Direct.FilterType |= AF_LowPass; + if(gainLF != 1.0f) voice->Direct.FilterType |= AF_HighPass; + BiquadFilter_setParams( + &voice->Direct.Params[0].LowPass, BiquadType_HighShelf, + gainHF, hfScale, calc_rcpQ_from_slope(gainHF, 1.0f) + ); + BiquadFilter_setParams( + &voice->Direct.Params[0].HighPass, BiquadType_LowShelf, + gainLF, lfScale, calc_rcpQ_from_slope(gainLF, 1.0f) + ); + for(c = 1;c < num_channels;c++) { - voice->Chan[c].Direct.FilterType = AF_None; - if(DryGainHF != 1.0f) voice->Chan[c].Direct.FilterType |= AF_LowPass; - if(DryGainLF != 1.0f) voice->Chan[c].Direct.FilterType |= AF_HighPass; - ALfilterState_setParams( - &voice->Chan[c].Direct.LowPass, ALfilterType_HighShelf, - DryGainHF, hfscale, calc_rcpQ_from_slope(DryGainHF, 0.75f) - ); - ALfilterState_setParams( - &voice->Chan[c].Direct.HighPass, ALfilterType_LowShelf, - DryGainLF, lfscale, calc_rcpQ_from_slope(DryGainLF, 0.75f) - ); + BiquadFilter_copyParams(&voice->Direct.Params[c].LowPass, + &voice->Direct.Params[0].LowPass); + BiquadFilter_copyParams(&voice->Direct.Params[c].HighPass, + &voice->Direct.Params[0].HighPass); } } for(i = 0;i < NumSends;i++) { - ALfloat hfscale = ATOMIC_LOAD(&props->Send[i].HFReference, almemory_order_relaxed) / - Frequency; - ALfloat lfscale = ATOMIC_LOAD(&props->Send[i].LFReference, almemory_order_relaxed) / - Frequency; - WetGainHF[i] = maxf(WetGainHF[i], 0.0001f); - WetGainLF[i] = maxf(WetGainLF[i], 0.0001f); - for(c = 0;c < num_channels;c++) + ALfloat hfScale = props->Send[i].HFReference / Frequency; + ALfloat lfScale = props->Send[i].LFReference / Frequency; + ALfloat gainHF = maxf(WetGainHF[i], 0.001f); + ALfloat gainLF = maxf(WetGainLF[i], 0.001f); + + voice->Send[i].FilterType = AF_None; + if(gainHF != 1.0f) voice->Send[i].FilterType |= AF_LowPass; + if(gainLF != 1.0f) voice->Send[i].FilterType |= AF_HighPass; + BiquadFilter_setParams( + &voice->Send[i].Params[0].LowPass, BiquadType_HighShelf, + gainHF, hfScale, calc_rcpQ_from_slope(gainHF, 1.0f) + ); + BiquadFilter_setParams( + &voice->Send[i].Params[0].HighPass, BiquadType_LowShelf, + gainLF, lfScale, calc_rcpQ_from_slope(gainLF, 1.0f) + ); + for(c = 1;c < num_channels;c++) { - voice->Chan[c].Send[i].FilterType = AF_None; - if(WetGainHF[i] != 1.0f) voice->Chan[c].Send[i].FilterType |= AF_LowPass; - if(WetGainLF[i] != 1.0f) voice->Chan[c].Send[i].FilterType |= AF_HighPass; - ALfilterState_setParams( - &voice->Chan[c].Send[i].LowPass, ALfilterType_HighShelf, - WetGainHF[i], hfscale, calc_rcpQ_from_slope(WetGainHF[i], 0.75f) - ); - ALfilterState_setParams( - &voice->Chan[c].Send[i].HighPass, ALfilterType_LowShelf, - WetGainLF[i], lfscale, calc_rcpQ_from_slope(WetGainLF[i], 0.75f) - ); + BiquadFilter_copyParams(&voice->Send[i].Params[c].LowPass, + &voice->Send[i].Params[0].LowPass); + BiquadFilter_copyParams(&voice->Send[i].Params[c].HighPass, + &voice->Send[i].Params[0].HighPass); } } } -static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *props, const ALbuffer *ALBuffer, const ALCcontext *ALContext) +static void CalcNonAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *props, const ALbuffer *ALBuffer, const ALCcontext *ALContext) { const ALCdevice *Device = ALContext->Device; const ALlistener *Listener = ALContext->Listener; - aluVector Position, Velocity, Direction, SourceToListener; - ALfloat InnerAngle,OuterAngle,Distance,ClampedDist; - ALfloat MinVolume,MaxVolume,MinDist,MaxDist,Rolloff; - ALfloat SourceVolume,ListenerGain; - ALfloat DopplerFactor, SpeedOfSound; - ALfloat AirAbsorptionFactor; - ALfloat RoomAirAbsorption[MAX_SENDS]; - ALeffectslot *SendSlots[MAX_SENDS]; - ALfloat Attenuation; - ALfloat RoomAttenuation[MAX_SENDS]; - ALfloat MetersPerUnit; - ALfloat RoomRolloffBase; - ALfloat RoomRolloff[MAX_SENDS]; - ALfloat DecayDistance[MAX_SENDS]; - ALfloat DryGain; - ALfloat DryGainHF; - ALfloat DryGainLF; - ALboolean DryGainHFAuto; + ALfloat DryGain, DryGainHF, DryGainLF; ALfloat WetGain[MAX_SENDS]; ALfloat WetGainHF[MAX_SENDS]; ALfloat WetGainLF[MAX_SENDS]; - ALboolean WetGainAuto; - ALboolean WetGainHFAuto; + ALeffectslot *SendSlots[MAX_SENDS]; ALfloat Pitch; - ALuint Frequency; - ALint NumSends; - ALint i; + ALsizei i; - DryGainHF = 1.0f; - DryGainLF = 1.0f; - for(i = 0;i < MAX_SENDS;i++) + voice->Direct.Buffer = Device->Dry.Buffer; + voice->Direct.Channels = Device->Dry.NumChannels; + for(i = 0;i < Device->NumAuxSends;i++) { - WetGainHF[i] = 1.0f; - WetGainLF[i] = 1.0f; + SendSlots[i] = props->Send[i].Slot; + if(!SendSlots[i] && i == 0) + SendSlots[i] = ALContext->DefaultSlot; + if(!SendSlots[i] || SendSlots[i]->Params.EffectType == AL_EFFECT_NULL) + { + SendSlots[i] = NULL; + voice->Send[i].Buffer = NULL; + voice->Send[i].Channels = 0; + } + else + { + voice->Send[i].Buffer = SendSlots[i]->WetBuffer; + voice->Send[i].Channels = SendSlots[i]->NumChannels; + } } - /* Get context/device properties */ - DopplerFactor = Listener->Params.DopplerFactor; - SpeedOfSound = Listener->Params.SpeedOfSound; - NumSends = Device->NumAuxSends; - Frequency = Device->Frequency; + /* Calculate the stepping value */ + Pitch = (ALfloat)ALBuffer->Frequency/(ALfloat)Device->Frequency * props->Pitch; + if(Pitch > (ALfloat)MAX_PITCH) + voice->Step = MAX_PITCH<Step = maxi(fastf2i(Pitch * FRACTIONONE), 1); + if(props->Resampler == BSinc24Resampler) + BsincPrepare(voice->Step, &voice->ResampleState.bsinc, &bsinc24); + else if(props->Resampler == BSinc12Resampler) + BsincPrepare(voice->Step, &voice->ResampleState.bsinc, &bsinc12); + voice->Resampler = SelectResampler(props->Resampler); - /* Get listener properties */ - ListenerGain = Listener->Params.Gain; - MetersPerUnit = Listener->Params.MetersPerUnit; + /* Calculate gains */ + DryGain = clampf(props->Gain, props->MinGain, props->MaxGain); + DryGain *= props->Direct.Gain * Listener->Params.Gain; + DryGain = minf(DryGain, GAIN_MIX_MAX); + DryGainHF = props->Direct.GainHF; + DryGainLF = props->Direct.GainLF; + for(i = 0;i < Device->NumAuxSends;i++) + { + WetGain[i] = clampf(props->Gain, props->MinGain, props->MaxGain); + WetGain[i] *= props->Send[i].Gain * Listener->Params.Gain; + WetGain[i] = minf(WetGain[i], GAIN_MIX_MAX); + WetGainHF[i] = props->Send[i].GainHF; + WetGainLF[i] = props->Send[i].GainLF; + } - /* Get source properties */ - SourceVolume = ATOMIC_LOAD(&props->Gain, almemory_order_relaxed); - MinVolume = ATOMIC_LOAD(&props->MinGain, almemory_order_relaxed); - MaxVolume = ATOMIC_LOAD(&props->MaxGain, almemory_order_relaxed); - Pitch = ATOMIC_LOAD(&props->Pitch, almemory_order_relaxed); - aluVectorSet(&Position, ATOMIC_LOAD(&props->Position[0], almemory_order_relaxed), - ATOMIC_LOAD(&props->Position[1], almemory_order_relaxed), - ATOMIC_LOAD(&props->Position[2], almemory_order_relaxed), - 1.0f); - aluVectorSet(&Direction, ATOMIC_LOAD(&props->Direction[0], almemory_order_relaxed), - ATOMIC_LOAD(&props->Direction[1], almemory_order_relaxed), - ATOMIC_LOAD(&props->Direction[2], almemory_order_relaxed), - 0.0f); - aluVectorSet(&Velocity, ATOMIC_LOAD(&props->Velocity[0], almemory_order_relaxed), - ATOMIC_LOAD(&props->Velocity[1], almemory_order_relaxed), - ATOMIC_LOAD(&props->Velocity[2], almemory_order_relaxed), - 0.0f); - MinDist = ATOMIC_LOAD(&props->RefDistance, almemory_order_relaxed); - MaxDist = ATOMIC_LOAD(&props->MaxDistance, almemory_order_relaxed); - Rolloff = ATOMIC_LOAD(&props->RollOffFactor, almemory_order_relaxed); - DopplerFactor *= ATOMIC_LOAD(&props->DopplerFactor, almemory_order_relaxed); - InnerAngle = ATOMIC_LOAD(&props->InnerAngle, almemory_order_relaxed); - OuterAngle = ATOMIC_LOAD(&props->OuterAngle, almemory_order_relaxed); - AirAbsorptionFactor = ATOMIC_LOAD(&props->AirAbsorptionFactor, almemory_order_relaxed); - DryGainHFAuto = ATOMIC_LOAD(&props->DryGainHFAuto, almemory_order_relaxed); - WetGainAuto = ATOMIC_LOAD(&props->WetGainAuto, almemory_order_relaxed); - WetGainHFAuto = ATOMIC_LOAD(&props->WetGainHFAuto, almemory_order_relaxed); - RoomRolloffBase = ATOMIC_LOAD(&props->RoomRolloffFactor, almemory_order_relaxed); + CalcPanningAndFilters(voice, 0.0f, 0.0f, 0.0f, 0.0f, DryGain, DryGainHF, DryGainLF, WetGain, + WetGainLF, WetGainHF, SendSlots, ALBuffer, props, Listener, Device); +} - voice->DirectOut.Buffer = Device->Dry.Buffer; - voice->DirectOut.Channels = Device->Dry.NumChannels; +static void CalcAttnSourceParams(ALvoice *voice, const struct ALvoiceProps *props, const ALbuffer *ALBuffer, const ALCcontext *ALContext) +{ + const ALCdevice *Device = ALContext->Device; + const ALlistener *Listener = ALContext->Listener; + const ALsizei NumSends = Device->NumAuxSends; + aluVector Position, Velocity, Direction, SourceToListener; + ALfloat Distance, ClampedDist, DopplerFactor; + ALeffectslot *SendSlots[MAX_SENDS]; + ALfloat RoomRolloff[MAX_SENDS]; + ALfloat DecayDistance[MAX_SENDS]; + ALfloat DecayLFDistance[MAX_SENDS]; + ALfloat DecayHFDistance[MAX_SENDS]; + ALfloat DryGain, DryGainHF, DryGainLF; + ALfloat WetGain[MAX_SENDS]; + ALfloat WetGainHF[MAX_SENDS]; + ALfloat WetGainLF[MAX_SENDS]; + bool directional; + ALfloat ev, az; + ALfloat spread; + ALfloat Pitch; + ALint i; + + /* Set mixing buffers and get send parameters. */ + voice->Direct.Buffer = Device->Dry.Buffer; + voice->Direct.Channels = Device->Dry.NumChannels; for(i = 0;i < NumSends;i++) { - SendSlots[i] = ATOMIC_LOAD(&props->Send[i].Slot, almemory_order_relaxed); - + SendSlots[i] = props->Send[i].Slot; if(!SendSlots[i] && i == 0) - SendSlots[i] = Device->DefaultSlot; + SendSlots[i] = ALContext->DefaultSlot; if(!SendSlots[i] || SendSlots[i]->Params.EffectType == AL_EFFECT_NULL) { SendSlots[i] = NULL; RoomRolloff[i] = 0.0f; DecayDistance[i] = 0.0f; - RoomAirAbsorption[i] = 1.0f; + DecayLFDistance[i] = 0.0f; + DecayHFDistance[i] = 0.0f; } else if(SendSlots[i]->Params.AuxSendAuto) { - RoomRolloff[i] = SendSlots[i]->Params.RoomRolloff + RoomRolloffBase; + RoomRolloff[i] = SendSlots[i]->Params.RoomRolloff + props->RoomRolloffFactor; + /* Calculate the distances to where this effect's decay reaches + * -60dB. + */ DecayDistance[i] = SendSlots[i]->Params.DecayTime * - SPEEDOFSOUNDMETRESPERSEC; - RoomAirAbsorption[i] = SendSlots[i]->Params.AirAbsorptionGainHF; + Listener->Params.ReverbSpeedOfSound; + DecayLFDistance[i] = DecayDistance[i] * SendSlots[i]->Params.DecayLFRatio; + DecayHFDistance[i] = DecayDistance[i] * SendSlots[i]->Params.DecayHFRatio; + if(SendSlots[i]->Params.DecayHFLimit) + { + ALfloat airAbsorption = SendSlots[i]->Params.AirAbsorptionGainHF; + if(airAbsorption < 1.0f) + { + /* Calculate the distance to where this effect's air + * absorption reaches -60dB, and limit the effect's HF + * decay distance (so it doesn't take any longer to decay + * than the air would allow). + */ + ALfloat absorb_dist = log10f(REVERB_DECAY_GAIN) / log10f(airAbsorption); + DecayHFDistance[i] = minf(absorb_dist, DecayHFDistance[i]); + } + } } else { /* If the slot's auxiliary send auto is off, the data sent to the * effect slot is the same as the dry path, sans filter effects */ - RoomRolloff[i] = Rolloff; + RoomRolloff[i] = props->RolloffFactor; DecayDistance[i] = 0.0f; - RoomAirAbsorption[i] = AIRABSORBGAINHF; + DecayLFDistance[i] = 0.0f; + DecayHFDistance[i] = 0.0f; } if(!SendSlots[i]) { - voice->SendOut[i].Buffer = NULL; - voice->SendOut[i].Channels = 0; + voice->Send[i].Buffer = NULL; + voice->Send[i].Channels = 0; } else { - voice->SendOut[i].Buffer = SendSlots[i]->WetBuffer; - voice->SendOut[i].Channels = SendSlots[i]->NumChannels; + voice->Send[i].Buffer = SendSlots[i]->WetBuffer; + voice->Send[i].Channels = SendSlots[i]->NumChannels; } } /* Transform source to listener space (convert to head relative) */ - if(ATOMIC_LOAD(&props->HeadRelative, almemory_order_relaxed) == AL_FALSE) + aluVectorSet(&Position, props->Position[0], props->Position[1], props->Position[2], 1.0f); + aluVectorSet(&Direction, props->Direction[0], props->Direction[1], props->Direction[2], 0.0f); + aluVectorSet(&Velocity, props->Velocity[0], props->Velocity[1], props->Velocity[2], 0.0f); + if(props->HeadRelative == AL_FALSE) { const aluMatrixf *Matrix = &Listener->Params.Matrix; /* Transform source vectors */ @@ -937,573 +1224,569 @@ static void CalcAttnSourceParams(ALvoice *voice, const struct ALsourceProps *pro Velocity.v[2] += lvelocity->v[2]; } - aluNormalize(Direction.v); + directional = aluNormalize(Direction.v) > 0.0f; SourceToListener.v[0] = -Position.v[0]; SourceToListener.v[1] = -Position.v[1]; SourceToListener.v[2] = -Position.v[2]; SourceToListener.v[3] = 0.0f; Distance = aluNormalize(SourceToListener.v); + /* Initial source gain */ + DryGain = props->Gain; + DryGainHF = 1.0f; + DryGainLF = 1.0f; + for(i = 0;i < NumSends;i++) + { + WetGain[i] = props->Gain; + WetGainHF[i] = 1.0f; + WetGainLF[i] = 1.0f; + } + /* Calculate distance attenuation */ ClampedDist = Distance; - Attenuation = 1.0f; - for(i = 0;i < NumSends;i++) - RoomAttenuation[i] = 1.0f; switch(Listener->Params.SourceDistanceModel ? - ATOMIC_LOAD(&props->DistanceModel, almemory_order_relaxed) : - Listener->Params.DistanceModel) + props->DistanceModel : Listener->Params.DistanceModel) { case InverseDistanceClamped: - ClampedDist = clampf(ClampedDist, MinDist, MaxDist); - if(MaxDist < MinDist) + ClampedDist = clampf(ClampedDist, props->RefDistance, props->MaxDistance); + if(props->MaxDistance < props->RefDistance) break; /*fall-through*/ case InverseDistance: - if(MinDist > 0.0f) + if(!(props->RefDistance > 0.0f)) + ClampedDist = props->RefDistance; + else { - ALfloat dist = lerp(MinDist, ClampedDist, Rolloff); - if(dist > 0.0f) Attenuation = MinDist / dist; + ALfloat dist = lerp(props->RefDistance, ClampedDist, props->RolloffFactor); + if(dist > 0.0f) DryGain *= props->RefDistance / dist; for(i = 0;i < NumSends;i++) { - dist = lerp(MinDist, ClampedDist, RoomRolloff[i]); - if(dist > 0.0f) RoomAttenuation[i] = MinDist / dist; + dist = lerp(props->RefDistance, ClampedDist, RoomRolloff[i]); + if(dist > 0.0f) WetGain[i] *= props->RefDistance / dist; } } break; case LinearDistanceClamped: - ClampedDist = clampf(ClampedDist, MinDist, MaxDist); - if(MaxDist < MinDist) + ClampedDist = clampf(ClampedDist, props->RefDistance, props->MaxDistance); + if(props->MaxDistance < props->RefDistance) break; /*fall-through*/ case LinearDistance: - if(MaxDist != MinDist) + if(!(props->MaxDistance != props->RefDistance)) + ClampedDist = props->RefDistance; + else { - Attenuation = 1.0f - (Rolloff*(ClampedDist-MinDist)/(MaxDist - MinDist)); - Attenuation = maxf(Attenuation, 0.0f); + ALfloat attn = props->RolloffFactor * (ClampedDist-props->RefDistance) / + (props->MaxDistance-props->RefDistance); + DryGain *= maxf(1.0f - attn, 0.0f); for(i = 0;i < NumSends;i++) { - RoomAttenuation[i] = 1.0f - (RoomRolloff[i]*(ClampedDist-MinDist)/(MaxDist - MinDist)); - RoomAttenuation[i] = maxf(RoomAttenuation[i], 0.0f); + attn = RoomRolloff[i] * (ClampedDist-props->RefDistance) / + (props->MaxDistance-props->RefDistance); + WetGain[i] *= maxf(1.0f - attn, 0.0f); } } break; case ExponentDistanceClamped: - ClampedDist = clampf(ClampedDist, MinDist, MaxDist); - if(MaxDist < MinDist) + ClampedDist = clampf(ClampedDist, props->RefDistance, props->MaxDistance); + if(props->MaxDistance < props->RefDistance) break; /*fall-through*/ case ExponentDistance: - if(ClampedDist > 0.0f && MinDist > 0.0f) + if(!(ClampedDist > 0.0f && props->RefDistance > 0.0f)) + ClampedDist = props->RefDistance; + else { - Attenuation = powf(ClampedDist/MinDist, -Rolloff); + DryGain *= powf(ClampedDist/props->RefDistance, -props->RolloffFactor); for(i = 0;i < NumSends;i++) - RoomAttenuation[i] = powf(ClampedDist/MinDist, -RoomRolloff[i]); + WetGain[i] *= powf(ClampedDist/props->RefDistance, -RoomRolloff[i]); } break; case DisableDistance: - ClampedDist = MinDist; + ClampedDist = props->RefDistance; break; } - /* Source Gain + Attenuation */ - DryGain = SourceVolume * Attenuation; - for(i = 0;i < NumSends;i++) - WetGain[i] = SourceVolume * RoomAttenuation[i]; - - /* Distance-based air absorption */ - if(AirAbsorptionFactor > 0.0f && ClampedDist > MinDist) - { - ALfloat meters = (ClampedDist-MinDist) * MetersPerUnit; - DryGainHF *= powf(AIRABSORBGAINHF, AirAbsorptionFactor*meters); - for(i = 0;i < NumSends;i++) - WetGainHF[i] *= powf(RoomAirAbsorption[i], AirAbsorptionFactor*meters); - } - - if(WetGainAuto) - { - ALfloat ApparentDist = 1.0f/maxf(Attenuation, 0.00001f) - 1.0f; - - /* Apply a decay-time transformation to the wet path, based on the - * attenuation of the dry path. - * - * Using the apparent distance, based on the distance attenuation, the - * initial decay of the reverb effect is calculated and applied to the - * wet path. - */ - for(i = 0;i < NumSends;i++) - { - if(DecayDistance[i] > 0.0f) - WetGain[i] *= powf(0.001f/*-60dB*/, ApparentDist/DecayDistance[i]); - } - } - /* Calculate directional soundcones */ - if(InnerAngle < 360.0f) + if(directional && props->InnerAngle < 360.0f) { ALfloat ConeVolume; ALfloat ConeHF; ALfloat Angle; - ALfloat scale; - Angle = RAD2DEG(acosf(aluDotproduct(&Direction, &SourceToListener)) * ConeScale) * 2.0f; - if(Angle > InnerAngle) + Angle = acosf(aluDotproduct(&Direction, &SourceToListener)); + Angle = RAD2DEG(Angle * ConeScale * 2.0f); + if(!(Angle > props->InnerAngle)) { - if(Angle < OuterAngle) - { - scale = (Angle-InnerAngle) / (OuterAngle-InnerAngle); - ConeVolume = lerp( - 1.0f, ATOMIC_LOAD(&props->OuterGain, almemory_order_relaxed), scale - ); - ConeHF = lerp( - 1.0f, ATOMIC_LOAD(&props->OuterGainHF, almemory_order_relaxed), scale - ); - } - else - { - ConeVolume = ATOMIC_LOAD(&props->OuterGain, almemory_order_relaxed); - ConeHF = ATOMIC_LOAD(&props->OuterGainHF, almemory_order_relaxed); - } - DryGain *= ConeVolume; - if(DryGainHFAuto) - DryGainHF *= ConeHF; + ConeVolume = 1.0f; + ConeHF = 1.0f; + } + else if(Angle < props->OuterAngle) + { + ALfloat scale = ( Angle-props->InnerAngle) / + (props->OuterAngle-props->InnerAngle); + ConeVolume = lerp(1.0f, props->OuterGain, scale); + ConeHF = lerp(1.0f, props->OuterGainHF, scale); + } + else + { + ConeVolume = props->OuterGain; + ConeHF = props->OuterGainHF; } - /* Wet path uses the total area of the cone emitter (the room will - * receive the same amount of sound regardless of its direction). - */ - scale = (asinf(maxf((OuterAngle-InnerAngle)/360.0f, 0.0f)) / F_PI) + - (InnerAngle/360.0f); - if(WetGainAuto) + DryGain *= ConeVolume; + if(props->DryGainHFAuto) + DryGainHF *= ConeHF; + if(props->WetGainAuto) { - ConeVolume = lerp( - 1.0f, ATOMIC_LOAD(&props->OuterGain, almemory_order_relaxed), scale - ); for(i = 0;i < NumSends;i++) WetGain[i] *= ConeVolume; } - if(WetGainHFAuto) + if(props->WetGainHFAuto) { - ConeHF = lerp( - 1.0f, ATOMIC_LOAD(&props->OuterGainHF, almemory_order_relaxed), scale - ); for(i = 0;i < NumSends;i++) WetGainHF[i] *= ConeHF; } } /* Apply gain and frequency filters */ - DryGain = clampf(DryGain, MinVolume, MaxVolume); - DryGain *= ATOMIC_LOAD(&props->Direct.Gain, almemory_order_relaxed) * ListenerGain; - DryGain = minf(DryGain, GAIN_MIX_MAX); - DryGainHF *= ATOMIC_LOAD(&props->Direct.GainHF, almemory_order_relaxed); - DryGainLF *= ATOMIC_LOAD(&props->Direct.GainLF, almemory_order_relaxed); + DryGain = clampf(DryGain, props->MinGain, props->MaxGain); + DryGain = minf(DryGain*props->Direct.Gain*Listener->Params.Gain, GAIN_MIX_MAX); + DryGainHF *= props->Direct.GainHF; + DryGainLF *= props->Direct.GainLF; for(i = 0;i < NumSends;i++) { - WetGain[i] = clampf(WetGain[i], MinVolume, MaxVolume); - WetGain[i] *= ATOMIC_LOAD(&props->Send[i].Gain, almemory_order_relaxed) * ListenerGain; - WetGain[i] = minf(WetGain[i], GAIN_MIX_MAX); - WetGainHF[i] *= ATOMIC_LOAD(&props->Send[i].GainHF, almemory_order_relaxed); - WetGainLF[i] *= ATOMIC_LOAD(&props->Send[i].GainLF, almemory_order_relaxed); + WetGain[i] = clampf(WetGain[i], props->MinGain, props->MaxGain); + WetGain[i] = minf(WetGain[i]*props->Send[i].Gain*Listener->Params.Gain, GAIN_MIX_MAX); + WetGainHF[i] *= props->Send[i].GainHF; + WetGainLF[i] *= props->Send[i].GainLF; } + /* Distance-based air absorption and initial send decay. */ + if(ClampedDist > props->RefDistance && props->RolloffFactor > 0.0f) + { + ALfloat meters_base = (ClampedDist-props->RefDistance) * props->RolloffFactor * + Listener->Params.MetersPerUnit; + if(props->AirAbsorptionFactor > 0.0f) + { + ALfloat hfattn = powf(AIRABSORBGAINHF, meters_base * props->AirAbsorptionFactor); + DryGainHF *= hfattn; + for(i = 0;i < NumSends;i++) + WetGainHF[i] *= hfattn; + } + + if(props->WetGainAuto) + { + /* Apply a decay-time transformation to the wet path, based on the + * source distance in meters. The initial decay of the reverb + * effect is calculated and applied to the wet path. + */ + for(i = 0;i < NumSends;i++) + { + ALfloat gain, gainhf, gainlf; + + if(!(DecayDistance[i] > 0.0f)) + continue; + + gain = powf(REVERB_DECAY_GAIN, meters_base/DecayDistance[i]); + WetGain[i] *= gain; + /* Yes, the wet path's air absorption is applied with + * WetGainAuto on, rather than WetGainHFAuto. + */ + if(gain > 0.0f) + { + gainhf = powf(REVERB_DECAY_GAIN, meters_base/DecayHFDistance[i]); + WetGainHF[i] *= minf(gainhf / gain, 1.0f); + gainlf = powf(REVERB_DECAY_GAIN, meters_base/DecayLFDistance[i]); + WetGainLF[i] *= minf(gainlf / gain, 1.0f); + } + } + } + } + + + /* Initial source pitch */ + Pitch = props->Pitch; + /* Calculate velocity-based doppler effect */ + DopplerFactor = props->DopplerFactor * Listener->Params.DopplerFactor; if(DopplerFactor > 0.0f) { const aluVector *lvelocity = &Listener->Params.Velocity; - ALfloat VSS, VLS; + const ALfloat SpeedOfSound = Listener->Params.SpeedOfSound; + ALfloat vss, vls; - if(SpeedOfSound < 1.0f) + vss = aluDotproduct(&Velocity, &SourceToListener) * DopplerFactor; + vls = aluDotproduct(lvelocity, &SourceToListener) * DopplerFactor; + + if(!(vls < SpeedOfSound)) { - DopplerFactor *= 1.0f/SpeedOfSound; - SpeedOfSound = 1.0f; + /* Listener moving away from the source at the speed of sound. + * Sound waves can't catch it. + */ + Pitch = 0.0f; } - - VSS = aluDotproduct(&Velocity, &SourceToListener) * DopplerFactor; - VLS = aluDotproduct(lvelocity, &SourceToListener) * DopplerFactor; - - Pitch *= clampf(SpeedOfSound-VLS, 1.0f, SpeedOfSound*2.0f - 1.0f) / - clampf(SpeedOfSound-VSS, 1.0f, SpeedOfSound*2.0f - 1.0f); - } - - /* Calculate fixed-point stepping value, based on the pitch, buffer - * frequency, and output frequency. - */ - Pitch *= (ALfloat)ALBuffer->Frequency / Frequency; - if(Pitch > (ALfloat)MAX_PITCH) - voice->Step = MAX_PITCH<Step = maxi(fastf2i(Pitch*FRACTIONONE + 0.5f), 1); - BsincPrepare(voice->Step, &voice->SincState); - - if(Device->Render_Mode == HrtfRender) - { - /* Full HRTF rendering. Skip the virtual channels and render to the - * real outputs. - */ - ALfloat dir[3] = { 0.0f, 0.0f, -1.0f }; - ALfloat ev = 0.0f, az = 0.0f; - ALfloat radius = ATOMIC_LOAD(&props->Radius, almemory_order_relaxed); - ALfloat coeffs[MAX_AMBI_COEFFS]; - ALfloat spread = 0.0f; - - voice->DirectOut.Buffer = Device->RealOut.Buffer; - voice->DirectOut.Channels = Device->RealOut.NumChannels; - - if(Distance > FLT_EPSILON) + else if(!(vss < SpeedOfSound)) { - dir[0] = -SourceToListener.v[0]; - dir[1] = -SourceToListener.v[1]; - dir[2] = -SourceToListener.v[2] * ZScale; - - /* Calculate elevation and azimuth only when the source is not at - * the listener. This prevents +0 and -0 Z from producing - * inconsistent panning. Also, clamp Y in case FP precision errors - * cause it to land outside of -1..+1. */ - ev = asinf(clampf(dir[1], -1.0f, 1.0f)); - az = atan2f(dir[0], -dir[2]); - } - if(radius > Distance) - spread = F_TAU - Distance/radius*F_PI; - else if(Distance > FLT_EPSILON) - spread = asinf(radius / Distance) * 2.0f; - - /* Get the HRIR coefficients and delays. */ - GetHrtfCoeffs(Device->Hrtf.Handle, ev, az, spread, DryGain, - voice->Chan[0].Direct.Hrtf.Target.Coeffs, - voice->Chan[0].Direct.Hrtf.Target.Delay); - - CalcDirectionCoeffs(dir, spread, coeffs); - - for(i = 0;i < NumSends;i++) - { - if(!SendSlots[i]) - { - ALuint j; - for(j = 0;j < MAX_EFFECT_CHANNELS;j++) - voice->Chan[0].Send[i].Gains.Target[j] = 0.0f; - } - else - { - const ALeffectslot *Slot = SendSlots[i]; - ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs, - WetGain[i], voice->Chan[0].Send[i].Gains.Target); - } - } - - voice->IsHrtf = AL_TRUE; - } - else - { - /* Non-HRTF rendering. */ - ALfloat dir[3] = { 0.0f, 0.0f, -1.0f }; - ALfloat radius = ATOMIC_LOAD(&props->Radius, almemory_order_relaxed); - ALfloat coeffs[MAX_AMBI_COEFFS]; - ALfloat spread = 0.0f; - - /* Get the localized direction, and compute panned gains. */ - if(Distance > FLT_EPSILON) - { - dir[0] = -SourceToListener.v[0]; - dir[1] = -SourceToListener.v[1]; - dir[2] = -SourceToListener.v[2] * ZScale; - } - if(radius > Distance) - spread = F_TAU - Distance/radius*F_PI; - else if(Distance > FLT_EPSILON) - spread = asinf(radius / Distance) * 2.0f; - - if(Device->Render_Mode == StereoPair) - { - /* Clamp X so it remains within 30 degrees of 0 or 180 degree azimuth. */ - ALfloat x = -dir[0] * (0.5f * (cosf(spread*0.5f) + 1.0f)); - x = clampf(x, -0.5f, 0.5f) + 0.5f; - voice->Chan[0].Direct.Gains.Target[0] = x * DryGain; - voice->Chan[0].Direct.Gains.Target[1] = (1.0f-x) * DryGain; - for(i = 2;i < MAX_OUTPUT_CHANNELS;i++) - voice->Chan[0].Direct.Gains.Target[i] = 0.0f; - - CalcDirectionCoeffs(dir, spread, coeffs); + /* Source moving toward the listener at the speed of sound. Sound + * waves bunch up to extreme frequencies. + */ + Pitch = HUGE_VALF; } else { - CalcDirectionCoeffs(dir, spread, coeffs); - ComputePanningGains(Device->Dry, coeffs, DryGain, - voice->Chan[0].Direct.Gains.Target); + /* Source and listener movement is nominal. Calculate the proper + * doppler shift. + */ + Pitch *= (SpeedOfSound-vls) / (SpeedOfSound-vss); } - - for(i = 0;i < NumSends;i++) - { - if(!SendSlots[i]) - { - ALuint j; - for(j = 0;j < MAX_EFFECT_CHANNELS;j++) - voice->Chan[0].Send[i].Gains.Target[j] = 0.0f; - } - else - { - const ALeffectslot *Slot = SendSlots[i]; - ComputePanningGainsBF(Slot->ChanMap, Slot->NumChannels, coeffs, - WetGain[i], voice->Chan[0].Send[i].Gains.Target); - } - } - - voice->IsHrtf = AL_FALSE; } + /* Adjust pitch based on the buffer and output frequencies, and calculate + * fixed-point stepping value. + */ + Pitch *= (ALfloat)ALBuffer->Frequency/(ALfloat)Device->Frequency; + if(Pitch > (ALfloat)MAX_PITCH) + voice->Step = MAX_PITCH<Step = maxi(fastf2i(Pitch * FRACTIONONE), 1); + if(props->Resampler == BSinc24Resampler) + BsincPrepare(voice->Step, &voice->ResampleState.bsinc, &bsinc24); + else if(props->Resampler == BSinc12Resampler) + BsincPrepare(voice->Step, &voice->ResampleState.bsinc, &bsinc12); + voice->Resampler = SelectResampler(props->Resampler); + + if(Distance > 0.0f) { - ALfloat hfscale = ATOMIC_LOAD(&props->Direct.HFReference, almemory_order_relaxed) / - Frequency; - ALfloat lfscale = ATOMIC_LOAD(&props->Direct.LFReference, almemory_order_relaxed) / - Frequency; - DryGainHF = maxf(DryGainHF, 0.0001f); - DryGainLF = maxf(DryGainLF, 0.0001f); - voice->Chan[0].Direct.FilterType = AF_None; - if(DryGainHF != 1.0f) voice->Chan[0].Direct.FilterType |= AF_LowPass; - if(DryGainLF != 1.0f) voice->Chan[0].Direct.FilterType |= AF_HighPass; - ALfilterState_setParams( - &voice->Chan[0].Direct.LowPass, ALfilterType_HighShelf, - DryGainHF, hfscale, calc_rcpQ_from_slope(DryGainHF, 0.75f) - ); - ALfilterState_setParams( - &voice->Chan[0].Direct.HighPass, ALfilterType_LowShelf, - DryGainLF, lfscale, calc_rcpQ_from_slope(DryGainLF, 0.75f) - ); - } - for(i = 0;i < NumSends;i++) - { - ALfloat hfscale = ATOMIC_LOAD(&props->Send[i].HFReference, almemory_order_relaxed) / - Frequency; - ALfloat lfscale = ATOMIC_LOAD(&props->Send[i].LFReference, almemory_order_relaxed) / - Frequency; - WetGainHF[i] = maxf(WetGainHF[i], 0.0001f); - WetGainLF[i] = maxf(WetGainLF[i], 0.0001f); - voice->Chan[0].Send[i].FilterType = AF_None; - if(WetGainHF[i] != 1.0f) voice->Chan[0].Send[i].FilterType |= AF_LowPass; - if(WetGainLF[i] != 1.0f) voice->Chan[0].Send[i].FilterType |= AF_HighPass; - ALfilterState_setParams( - &voice->Chan[0].Send[i].LowPass, ALfilterType_HighShelf, - WetGainHF[i], hfscale, calc_rcpQ_from_slope(WetGainHF[i], 0.75f) - ); - ALfilterState_setParams( - &voice->Chan[0].Send[i].HighPass, ALfilterType_LowShelf, - WetGainLF[i], lfscale, calc_rcpQ_from_slope(WetGainLF[i], 0.75f) - ); + /* Clamp Y, in case rounding errors caused it to end up outside of + * -1...+1. + */ + ev = asinf(clampf(-SourceToListener.v[1], -1.0f, 1.0f)); + /* Double negation on Z cancels out; negate once for changing source- + * to-listener to listener-to-source, and again for right-handed coords + * with -Z in front. + */ + az = atan2f(-SourceToListener.v[0], SourceToListener.v[2]*ZScale); } + else + ev = az = 0.0f; + + if(props->Radius > Distance) + spread = F_TAU - Distance/props->Radius*F_PI; + else if(Distance > 0.0f) + spread = asinf(props->Radius / Distance) * 2.0f; + else + spread = 0.0f; + + CalcPanningAndFilters(voice, az, ev, Distance, spread, DryGain, DryGainHF, DryGainLF, WetGain, + WetGainLF, WetGainHF, SendSlots, ALBuffer, props, Listener, Device); } -static void CalcSourceParams(ALvoice *voice, ALCcontext *context, ALboolean force) +static void CalcSourceParams(ALvoice *voice, ALCcontext *context, bool force) { - ALsource *source = voice->Source; - const ALbufferlistitem *BufferListItem; - struct ALsourceProps *first; - struct ALsourceProps *props; + ALbufferlistitem *BufferListItem; + struct ALvoiceProps *props; - props = ATOMIC_EXCHANGE(struct ALsourceProps*, &source->Update, NULL, almemory_order_acq_rel); + props = ATOMIC_EXCHANGE_PTR(&voice->Update, NULL, almemory_order_acq_rel); if(!props && !force) return; if(props) { - voice->Props = *props; + memcpy(voice->Props, props, + FAM_SIZE(struct ALvoiceProps, Send, context->Device->NumAuxSends) + ); - /* WARNING: A livelock is theoretically possible if another thread - * keeps changing the freelist head without giving this a chance to - * actually swap in the old container (practically impossible with this - * little code, but...). - */ - first = ATOMIC_LOAD(&source->FreeList); - do { - ATOMIC_STORE(&props->next, first, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALsourceProps*, - &source->FreeList, &first, props) == 0); + ATOMIC_REPLACE_HEAD(struct ALvoiceProps*, &context->FreeVoiceProps, props); } + props = voice->Props; - BufferListItem = ATOMIC_LOAD(&source->queue, almemory_order_relaxed); + BufferListItem = ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed); while(BufferListItem != NULL) { - const ALbuffer *buffer; - if((buffer=BufferListItem->buffer) != NULL) + const ALbuffer *buffer = NULL; + ALsizei i = 0; + while(!buffer && i < BufferListItem->num_buffers) + buffer = BufferListItem->buffers[i]; + if(LIKELY(buffer)) { - if(buffer->FmtChannels == FmtMono) - CalcAttnSourceParams(voice, &voice->Props, buffer, context); + if(props->SpatializeMode == SpatializeOn || + (props->SpatializeMode == SpatializeAuto && buffer->FmtChannels == FmtMono)) + CalcAttnSourceParams(voice, props, buffer, context); else - CalcNonAttnSourceParams(voice, &voice->Props, buffer, context); + CalcNonAttnSourceParams(voice, props, buffer, context); break; } - BufferListItem = BufferListItem->next; + BufferListItem = ATOMIC_LOAD(&BufferListItem->next, almemory_order_acquire); } } -static void UpdateContextSources(ALCcontext *ctx, ALeffectslot *slot) +static void ProcessParamUpdates(ALCcontext *ctx, const struct ALeffectslotArray *slots) { - ALvoice *voice, *voice_end; + ALvoice **voice, **voice_end; ALsource *source; + ALsizei i; IncrementRef(&ctx->UpdateCount); - if(!ATOMIC_LOAD(&ctx->HoldUpdates)) + if(!ATOMIC_LOAD(&ctx->HoldUpdates, almemory_order_acquire)) { - ALboolean force = CalcListenerParams(ctx); - while(slot) - { - force |= CalcEffectSlotParams(slot, ctx->Device); - slot = ATOMIC_LOAD(&slot->next, almemory_order_relaxed); - } + bool cforce = CalcContextParams(ctx); + bool force = CalcListenerParams(ctx) | cforce; + for(i = 0;i < slots->count;i++) + force |= CalcEffectSlotParams(slots->slot[i], ctx, cforce); voice = ctx->Voices; voice_end = voice + ctx->VoiceCount; for(;voice != voice_end;++voice) { - if(!(source=voice->Source)) continue; - if(source->state != AL_PLAYING && source->state != AL_PAUSED) - voice->Source = NULL; - else - CalcSourceParams(voice, ctx, force); + source = ATOMIC_LOAD(&(*voice)->Source, almemory_order_acquire); + if(source) CalcSourceParams(*voice, ctx, force); } } IncrementRef(&ctx->UpdateCount); } -/* Specialized function to clamp to [-1, +1] with only one branch. This also - * converts NaN to 0. */ -static inline ALfloat aluClampf(ALfloat val) +static void ApplyStablizer(FrontStablizer *Stablizer, ALfloat (*restrict Buffer)[BUFFERSIZE], + int lidx, int ridx, int cidx, ALsizei SamplesToDo, + ALsizei NumChannels) { - if(fabsf(val) <= 1.0f) return val; - return (ALfloat)((0.0f < val) - (val < 0.0f)); -} + ALfloat (*restrict lsplit)[BUFFERSIZE] = ASSUME_ALIGNED(Stablizer->LSplit, 16); + ALfloat (*restrict rsplit)[BUFFERSIZE] = ASSUME_ALIGNED(Stablizer->RSplit, 16); + ALsizei i; -static inline ALfloat aluF2F(ALfloat val) -{ return val; } - -static inline ALint aluF2I(ALfloat val) -{ - /* Floats only have a 24-bit mantissa, so [-16777215, +16777215] is the max - * integer range normalized floats can be safely converted to. + /* Apply an all-pass to all channels, except the front-left and front- + * right, so they maintain the same relative phase. */ - return fastf2i(aluClampf(val)*16777215.0f)<<7; + for(i = 0;i < NumChannels;i++) + { + if(i == lidx || i == ridx) + continue; + splitterap_process(&Stablizer->APFilter[i], Buffer[i], SamplesToDo); + } + + bandsplit_process(&Stablizer->LFilter, lsplit[1], lsplit[0], Buffer[lidx], SamplesToDo); + bandsplit_process(&Stablizer->RFilter, rsplit[1], rsplit[0], Buffer[ridx], SamplesToDo); + + for(i = 0;i < SamplesToDo;i++) + { + ALfloat lfsum, hfsum; + ALfloat m, s, c; + + lfsum = lsplit[0][i] + rsplit[0][i]; + hfsum = lsplit[1][i] + rsplit[1][i]; + s = lsplit[0][i] + lsplit[1][i] - rsplit[0][i] - rsplit[1][i]; + + /* This pans the separate low- and high-frequency sums between being on + * the center channel and the left/right channels. The low-frequency + * sum is 1/3rd toward center (2/3rds on left/right) and the high- + * frequency sum is 1/4th toward center (3/4ths on left/right). These + * values can be tweaked. + */ + m = lfsum*cosf(1.0f/3.0f * F_PI_2) + hfsum*cosf(1.0f/4.0f * F_PI_2); + c = lfsum*sinf(1.0f/3.0f * F_PI_2) + hfsum*sinf(1.0f/4.0f * F_PI_2); + + /* The generated center channel signal adds to the existing signal, + * while the modified left and right channels replace. + */ + Buffer[lidx][i] = (m + s) * 0.5f; + Buffer[ridx][i] = (m - s) * 0.5f; + Buffer[cidx][i] += c * 0.5f; + } } -static inline ALuint aluF2UI(ALfloat val) -{ return aluF2I(val)+2147483648u; } -static inline ALshort aluF2S(ALfloat val) -{ return fastf2i(aluClampf(val)*32767.0f); } -static inline ALushort aluF2US(ALfloat val) -{ return aluF2S(val)+32768; } +static void ApplyDistanceComp(ALfloat (*restrict Samples)[BUFFERSIZE], DistanceComp *distcomp, + ALfloat *restrict Values, ALsizei SamplesToDo, ALsizei numchans) +{ + ALsizei i, c; -static inline ALbyte aluF2B(ALfloat val) -{ return fastf2i(aluClampf(val)*127.0f); } -static inline ALubyte aluF2UB(ALfloat val) -{ return aluF2B(val)+128; } + Values = ASSUME_ALIGNED(Values, 16); + for(c = 0;c < numchans;c++) + { + ALfloat *restrict inout = ASSUME_ALIGNED(Samples[c], 16); + const ALfloat gain = distcomp[c].Gain; + const ALsizei base = distcomp[c].Length; + ALfloat *restrict distbuf = ASSUME_ALIGNED(distcomp[c].Buffer, 16); -#define DECL_TEMPLATE(T, func) \ -static void Write_##T(ALfloatBUFFERSIZE *InBuffer, ALvoid *OutBuffer, \ - ALuint SamplesToDo, ALuint numchans) \ + if(base == 0) + { + if(gain < 1.0f) + { + for(i = 0;i < SamplesToDo;i++) + inout[i] *= gain; + } + continue; + } + + if(SamplesToDo >= base) + { + for(i = 0;i < base;i++) + Values[i] = distbuf[i]; + for(;i < SamplesToDo;i++) + Values[i] = inout[i-base]; + memcpy(distbuf, &inout[SamplesToDo-base], base*sizeof(ALfloat)); + } + else + { + for(i = 0;i < SamplesToDo;i++) + Values[i] = distbuf[i]; + memmove(distbuf, distbuf+SamplesToDo, (base-SamplesToDo)*sizeof(ALfloat)); + memcpy(distbuf+base-SamplesToDo, inout, SamplesToDo*sizeof(ALfloat)); + } + for(i = 0;i < SamplesToDo;i++) + inout[i] = Values[i]*gain; + } +} + +static void ApplyDither(ALfloat (*restrict Samples)[BUFFERSIZE], ALuint *dither_seed, + const ALfloat quant_scale, const ALsizei SamplesToDo, + const ALsizei numchans) +{ + const ALfloat invscale = 1.0f / quant_scale; + ALuint seed = *dither_seed; + ALsizei c, i; + + /* Dithering. Step 1, generate whitenoise (uniform distribution of random + * values between -1 and +1). Step 2 is to add the noise to the samples, + * before rounding and after scaling up to the desired quantization depth. + */ + for(c = 0;c < numchans;c++) + { + ALfloat *restrict samples = Samples[c]; + for(i = 0;i < SamplesToDo;i++) + { + ALfloat val = samples[i] * quant_scale; + ALuint rng0 = dither_rng(&seed); + ALuint rng1 = dither_rng(&seed); + val += (ALfloat)(rng0*(1.0/UINT_MAX) - rng1*(1.0/UINT_MAX)); + samples[i] = fastf2i(val) * invscale; + } + } + *dither_seed = seed; +} + + +static inline ALfloat Conv_ALfloat(ALfloat val) +{ return val; } +static inline ALint Conv_ALint(ALfloat val) +{ + /* Floats have a 23-bit mantissa. A bit of the exponent helps out along + * with the sign bit, giving 25 bits. So [-16777216, +16777216] is the max + * integer range normalized floats can be converted to before losing + * precision. + */ + return fastf2i(clampf(val*16777216.0f, -16777216.0f, 16777215.0f))<<7; +} +static inline ALshort Conv_ALshort(ALfloat val) +{ return fastf2i(clampf(val*32768.0f, -32768.0f, 32767.0f)); } +static inline ALbyte Conv_ALbyte(ALfloat val) +{ return fastf2i(clampf(val*128.0f, -128.0f, 127.0f)); } + +/* Define unsigned output variations. */ +#define DECL_TEMPLATE(T, func, O) \ +static inline T Conv_##T(ALfloat val) { return func(val)+O; } + +DECL_TEMPLATE(ALubyte, Conv_ALbyte, 128) +DECL_TEMPLATE(ALushort, Conv_ALshort, 32768) +DECL_TEMPLATE(ALuint, Conv_ALint, 2147483648u) + +#undef DECL_TEMPLATE + +#define DECL_TEMPLATE(T, A) \ +static void Write##A(const ALfloat (*restrict InBuffer)[BUFFERSIZE], \ + ALvoid *OutBuffer, ALsizei Offset, ALsizei SamplesToDo, \ + ALsizei numchans) \ { \ - ALuint i, j; \ + ALsizei i, j; \ for(j = 0;j < numchans;j++) \ { \ - const ALfloat *in = InBuffer[j]; \ - T *restrict out = (T*)OutBuffer + j; \ + const ALfloat *restrict in = ASSUME_ALIGNED(InBuffer[j], 16); \ + T *restrict out = (T*)OutBuffer + Offset*numchans + j; \ + \ for(i = 0;i < SamplesToDo;i++) \ - out[i*numchans] = func(in[i]); \ + out[i*numchans] = Conv_##T(in[i]); \ } \ } -DECL_TEMPLATE(ALfloat, aluF2F) -DECL_TEMPLATE(ALuint, aluF2UI) -DECL_TEMPLATE(ALint, aluF2I) -DECL_TEMPLATE(ALushort, aluF2US) -DECL_TEMPLATE(ALshort, aluF2S) -DECL_TEMPLATE(ALubyte, aluF2UB) -DECL_TEMPLATE(ALbyte, aluF2B) +DECL_TEMPLATE(ALfloat, F32) +DECL_TEMPLATE(ALuint, UI32) +DECL_TEMPLATE(ALint, I32) +DECL_TEMPLATE(ALushort, UI16) +DECL_TEMPLATE(ALshort, I16) +DECL_TEMPLATE(ALubyte, UI8) +DECL_TEMPLATE(ALbyte, I8) #undef DECL_TEMPLATE -ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) +void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples) { - ALuint SamplesToDo; - ALvoice *voice, *voice_end; - ALeffectslot *slot; - ALsource *source; + ALsizei SamplesToDo; + ALsizei SamplesDone; ALCcontext *ctx; - FPUCtl oldMode; - ALuint i, c; + ALsizei i, c; - SetMixerFPUMode(&oldMode); - - while(size > 0) + START_MIXER_MODE(); + for(SamplesDone = 0;SamplesDone < NumSamples;) { - SamplesToDo = minu(size, BUFFERSIZE); + SamplesToDo = mini(NumSamples-SamplesDone, BUFFERSIZE); for(c = 0;c < device->Dry.NumChannels;c++) memset(device->Dry.Buffer[c], 0, SamplesToDo*sizeof(ALfloat)); - if(device->Dry.Buffer != device->RealOut.Buffer) - for(c = 0;c < device->RealOut.NumChannels;c++) - memset(device->RealOut.Buffer[c], 0, SamplesToDo*sizeof(ALfloat)); if(device->Dry.Buffer != device->FOAOut.Buffer) for(c = 0;c < device->FOAOut.NumChannels;c++) memset(device->FOAOut.Buffer[c], 0, SamplesToDo*sizeof(ALfloat)); + if(device->Dry.Buffer != device->RealOut.Buffer) + for(c = 0;c < device->RealOut.NumChannels;c++) + memset(device->RealOut.Buffer[c], 0, SamplesToDo*sizeof(ALfloat)); IncrementRef(&device->MixCount); - V0(device->Backend,lock)(); - if((slot=device->DefaultSlot) != NULL) - { - CalcEffectSlotParams(device->DefaultSlot, device); - for(i = 0;i < slot->NumChannels;i++) - memset(slot->WetBuffer[i], 0, SamplesToDo*sizeof(ALfloat)); - } - - ctx = ATOMIC_LOAD(&device->ContextList); + ctx = ATOMIC_LOAD(&device->ContextList, almemory_order_acquire); while(ctx) { - ALeffectslot *slotroot; + const struct ALeffectslotArray *auxslots; - slotroot = ATOMIC_LOAD(&ctx->ActiveAuxSlotList); - UpdateContextSources(ctx, slotroot); + auxslots = ATOMIC_LOAD(&ctx->ActiveAuxSlots, almemory_order_acquire); + ProcessParamUpdates(ctx, auxslots); - slot = slotroot; - while(slot) + for(i = 0;i < auxslots->count;i++) { - for(i = 0;i < slot->NumChannels;i++) - memset(slot->WetBuffer[i], 0, SamplesToDo*sizeof(ALfloat)); - slot = ATOMIC_LOAD(&slot->next, almemory_order_relaxed); + ALeffectslot *slot = auxslots->slot[i]; + for(c = 0;c < slot->NumChannels;c++) + memset(slot->WetBuffer[c], 0, SamplesToDo*sizeof(ALfloat)); } /* source processing */ - voice = ctx->Voices; - voice_end = voice + ctx->VoiceCount; - for(;voice != voice_end;++voice) + for(i = 0;i < ctx->VoiceCount;i++) { - ALboolean IsVoiceInit = (voice->Step > 0); - source = voice->Source; - if(source && source->state == AL_PLAYING && IsVoiceInit) - MixSource(voice, source, device, SamplesToDo); + ALvoice *voice = ctx->Voices[i]; + ALsource *source = ATOMIC_LOAD(&voice->Source, almemory_order_acquire); + if(source && ATOMIC_LOAD(&voice->Playing, almemory_order_relaxed) && + voice->Step > 0) + { + if(!MixSource(voice, source->id, ctx, SamplesToDo)) + { + ATOMIC_STORE(&voice->Source, NULL, almemory_order_relaxed); + ATOMIC_STORE(&voice->Playing, false, almemory_order_release); + SendSourceStoppedEvent(ctx, source->id); + } + } } /* effect slot processing */ - slot = slotroot; - while(slot) + for(i = 0;i < auxslots->count;i++) { + const ALeffectslot *slot = auxslots->slot[i]; ALeffectState *state = slot->Params.EffectState; - V(state,process)(SamplesToDo, SAFE_CONST(ALfloatBUFFERSIZE*,slot->WetBuffer), - state->OutBuffer, state->OutChannels); - slot = ATOMIC_LOAD(&slot->next, almemory_order_relaxed); + V(state,process)(SamplesToDo, slot->WetBuffer, state->OutBuffer, + state->OutChannels); } - ctx = ctx->next; - } - - if(device->DefaultSlot != NULL) - { - const ALeffectslot *slot = device->DefaultSlot; - ALeffectState *state = slot->Params.EffectState; - V(state,process)(SamplesToDo, slot->WetBuffer, state->OutBuffer, - state->OutChannels); + ctx = ATOMIC_LOAD(&ctx->next, almemory_order_relaxed); } /* Increment the clock time. Every second's worth of samples is @@ -1513,145 +1796,132 @@ ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size) device->SamplesDone += SamplesToDo; device->ClockBase += (device->SamplesDone/device->Frequency) * DEVICE_CLOCK_RES; device->SamplesDone %= device->Frequency; - V0(device->Backend,unlock)(); IncrementRef(&device->MixCount); - if(device->Hrtf.Handle) + /* Apply post-process for finalizing the Dry mix to the RealOut + * (Ambisonic decode, UHJ encode, etc). + */ + if(LIKELY(device->PostProcess)) + device->PostProcess(device, SamplesToDo); + + if(device->Stablizer) { - int lidx = GetChannelIdxByName(device->RealOut, FrontLeft); - int ridx = GetChannelIdxByName(device->RealOut, FrontRight); - if(lidx != -1 && ridx != -1) - { - HrtfDirectMixerFunc HrtfMix = SelectHrtfMixer(); - ALuint irsize = device->Hrtf.IrSize; - for(c = 0;c < device->Dry.NumChannels;c++) - { - HrtfMix(device->RealOut.Buffer, lidx, ridx, - device->Dry.Buffer[c], device->Hrtf.Offset, irsize, - device->Hrtf.Coeffs[c], device->Hrtf.Values[c], - SamplesToDo - ); - } - device->Hrtf.Offset += SamplesToDo; - } - } - else if(device->AmbiDecoder) - { - if(device->Dry.Buffer != device->FOAOut.Buffer) - bformatdec_upSample(device->AmbiDecoder, - device->Dry.Buffer, SAFE_CONST(ALfloatBUFFERSIZE*,device->FOAOut.Buffer), - device->FOAOut.NumChannels, SamplesToDo - ); - bformatdec_process(device->AmbiDecoder, - device->RealOut.Buffer, device->RealOut.NumChannels, - SAFE_CONST(ALfloatBUFFERSIZE*,device->Dry.Buffer), SamplesToDo - ); - } - else if(device->AmbiUp) - { - ambiup_process(device->AmbiUp, - device->RealOut.Buffer, device->RealOut.NumChannels, - SAFE_CONST(ALfloatBUFFERSIZE*,device->FOAOut.Buffer), SamplesToDo - ); - } - else if(device->Uhj_Encoder) - { - int lidx = GetChannelIdxByName(device->RealOut, FrontLeft); - int ridx = GetChannelIdxByName(device->RealOut, FrontRight); - if(lidx != -1 && ridx != -1) - { - /* Encode to stereo-compatible 2-channel UHJ output. */ - EncodeUhj2(device->Uhj_Encoder, - device->RealOut.Buffer[lidx], device->RealOut.Buffer[ridx], - device->Dry.Buffer, SamplesToDo - ); - } - } - else if(device->Bs2b) - { - int lidx = GetChannelIdxByName(device->RealOut, FrontLeft); - int ridx = GetChannelIdxByName(device->RealOut, FrontRight); - if(lidx != -1 && ridx != -1) - { - /* Apply binaural/crossfeed filter */ - bs2b_cross_feed(device->Bs2b, device->RealOut.Buffer[lidx], - device->RealOut.Buffer[ridx], SamplesToDo); - } + int lidx = GetChannelIdxByName(&device->RealOut, FrontLeft); + int ridx = GetChannelIdxByName(&device->RealOut, FrontRight); + int cidx = GetChannelIdxByName(&device->RealOut, FrontCenter); + assert(lidx >= 0 && ridx >= 0 && cidx >= 0); + + ApplyStablizer(device->Stablizer, device->RealOut.Buffer, lidx, ridx, cidx, + SamplesToDo, device->RealOut.NumChannels); } - if(buffer) - { - ALfloat (*OutBuffer)[BUFFERSIZE] = device->RealOut.Buffer; - ALuint OutChannels = device->RealOut.NumChannels; + ApplyDistanceComp(device->RealOut.Buffer, device->ChannelDelay, device->TempBuffer[0], + SamplesToDo, device->RealOut.NumChannels); + + if(device->Limiter) + ApplyCompression(device->Limiter, device->RealOut.NumChannels, SamplesToDo, + device->RealOut.Buffer); + + if(device->DitherDepth > 0.0f) + ApplyDither(device->RealOut.Buffer, &device->DitherSeed, device->DitherDepth, + SamplesToDo, device->RealOut.NumChannels); + + if(LIKELY(OutBuffer)) + { + ALfloat (*Buffer)[BUFFERSIZE] = device->RealOut.Buffer; + ALsizei Channels = device->RealOut.NumChannels; -#define WRITE(T, a, b, c, d) do { \ - Write_##T((a), (b), (c), (d)); \ - buffer = (T*)buffer + (c)*(d); \ -} while(0) switch(device->FmtType) { case DevFmtByte: - WRITE(ALbyte, OutBuffer, buffer, SamplesToDo, OutChannels); + WriteI8(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels); break; case DevFmtUByte: - WRITE(ALubyte, OutBuffer, buffer, SamplesToDo, OutChannels); + WriteUI8(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels); break; case DevFmtShort: - WRITE(ALshort, OutBuffer, buffer, SamplesToDo, OutChannels); + WriteI16(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels); break; case DevFmtUShort: - WRITE(ALushort, OutBuffer, buffer, SamplesToDo, OutChannels); + WriteUI16(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels); break; case DevFmtInt: - WRITE(ALint, OutBuffer, buffer, SamplesToDo, OutChannels); + WriteI32(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels); break; case DevFmtUInt: - WRITE(ALuint, OutBuffer, buffer, SamplesToDo, OutChannels); + WriteUI32(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels); break; case DevFmtFloat: - WRITE(ALfloat, OutBuffer, buffer, SamplesToDo, OutChannels); + WriteF32(Buffer, OutBuffer, SamplesDone, SamplesToDo, Channels); break; } -#undef WRITE } - size -= SamplesToDo; + SamplesDone += SamplesToDo; } - - RestoreFPUMode(&oldMode); + END_MIXER_MODE(); } -ALvoid aluHandleDisconnect(ALCdevice *device) +void aluHandleDisconnect(ALCdevice *device, const char *msg, ...) { - ALCcontext *Context; + ALCcontext *ctx; + AsyncEvent evt; + va_list args; + int msglen; - device->Connected = ALC_FALSE; + if(!ATOMIC_EXCHANGE(&device->Connected, AL_FALSE, almemory_order_acq_rel)) + return; - Context = ATOMIC_LOAD(&device->ContextList); - while(Context) + evt.EnumType = EventType_Disconnected; + evt.Type = AL_EVENT_TYPE_DISCONNECTED_SOFT; + evt.ObjectId = 0; + evt.Param = 0; + + va_start(args, msg); + msglen = vsnprintf(evt.Message, sizeof(evt.Message), msg, args); + va_end(args); + + if(msglen < 0 || (size_t)msglen >= sizeof(evt.Message)) { - ALvoice *voice, *voice_end; + evt.Message[sizeof(evt.Message)-1] = 0; + msglen = (int)strlen(evt.Message); + } + if(msglen > 0) + msg = evt.Message; + else + { + msg = ""; + msglen = (int)strlen(msg); + } - voice = Context->Voices; - voice_end = voice + Context->VoiceCount; - while(voice != voice_end) + ctx = ATOMIC_LOAD_SEQ(&device->ContextList); + while(ctx) + { + ALbitfieldSOFT enabledevt = ATOMIC_LOAD(&ctx->EnabledEvts, almemory_order_acquire); + ALsizei i; + + if((enabledevt&EventType_Disconnected) && + ll_ringbuffer_write(ctx->AsyncEvents, (const char*)&evt, 1) == 1) + alsem_post(&ctx->EventSem); + + for(i = 0;i < ctx->VoiceCount;i++) { - ALsource *source = voice->Source; - voice->Source = NULL; + ALvoice *voice = ctx->Voices[i]; + ALsource *source; - if(source && source->state == AL_PLAYING) + source = ATOMIC_EXCHANGE_PTR(&voice->Source, NULL, almemory_order_relaxed); + if(source && ATOMIC_LOAD(&voice->Playing, almemory_order_relaxed)) { - source->state = AL_STOPPED; - ATOMIC_STORE(&source->current_buffer, NULL); - ATOMIC_STORE(&source->position, 0); - ATOMIC_STORE(&source->position_fraction, 0); + /* If the source's voice was playing, it's now effectively + * stopped (the source state will be updated the next time it's + * checked). + */ + SendSourceStoppedEvent(ctx, source->id); } - - voice++; + ATOMIC_STORE(&voice->Playing, false, almemory_order_release); } - Context->VoiceCount = 0; - Context = Context->next; + ctx = ATOMIC_LOAD(&ctx->next, almemory_order_relaxed); } } diff --git a/Engine/lib/openal-soft/Alc/alcRing.c b/Engine/lib/openal-soft/Alc/alcRing.c deleted file mode 100644 index 5994f1967..000000000 --- a/Engine/lib/openal-soft/Alc/alcRing.c +++ /dev/null @@ -1,301 +0,0 @@ -/** - * OpenAL cross platform audio library - * Copyright (C) 1999-2007 by authors. - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * Or go to http://www.gnu.org/copyleft/lgpl.html - */ - -#include "config.h" - -#include -#include - -#include "alMain.h" -#include "threads.h" -#include "almalloc.h" -#include "compat.h" - - -/* NOTE: This lockless ringbuffer implementation is copied from JACK, extended - * to include an element size. Consequently, parameters and return values for a - * size or count is in 'elements', not bytes. Additionally, it only supports - * single-consumer/single-provider operation. */ -struct ll_ringbuffer { - volatile size_t write_ptr; - volatile size_t read_ptr; - size_t size; - size_t size_mask; - size_t elem_size; - int mlocked; - - alignas(16) char buf[]; -}; - -/* Create a new ringbuffer to hold at least `sz' elements of `elem_sz' bytes. - * The number of elements is rounded up to the next power of two. */ -ll_ringbuffer_t *ll_ringbuffer_create(size_t sz, size_t elem_sz) -{ - ll_ringbuffer_t *rb; - ALuint power_of_two; - - power_of_two = NextPowerOf2(sz); - if(power_of_two < sz) - return NULL; - - rb = al_malloc(16, sizeof(*rb) + power_of_two*elem_sz); - if(!rb) return NULL; - - rb->size = power_of_two; - rb->size_mask = rb->size - 1; - rb->elem_size = elem_sz; - rb->write_ptr = 0; - rb->read_ptr = 0; - rb->mlocked = 0; - return rb; -} - -/* Free all data associated with the ringbuffer `rb'. */ -void ll_ringbuffer_free(ll_ringbuffer_t *rb) -{ - if(rb) - { -#ifdef USE_MLOCK - if(rb->mlocked) - munlock(rb, sizeof(*rb) + rb->size*rb->elem_size); -#endif /* USE_MLOCK */ - al_free(rb); - } -} - -/* Lock the data block of `rb' using the system call 'mlock'. */ -int ll_ringbuffer_mlock(ll_ringbuffer_t *rb) -{ -#ifdef USE_MLOCK - if(!rb->locked && mlock(rb, sizeof(*rb) + rb->size*rb->elem_size)) - return -1; -#endif /* USE_MLOCK */ - rb->mlocked = 1; - return 0; -} - -/* Reset the read and write pointers to zero. This is not thread safe. */ -void ll_ringbuffer_reset(ll_ringbuffer_t *rb) -{ - rb->read_ptr = 0; - rb->write_ptr = 0; - memset(rb->buf, 0, rb->size*rb->elem_size); -} - -/* Return the number of elements available for reading. This is the number of - * elements in front of the read pointer and behind the write pointer. */ -size_t ll_ringbuffer_read_space(const ll_ringbuffer_t *rb) -{ - size_t w = rb->write_ptr; - size_t r = rb->read_ptr; - return (rb->size+w-r) & rb->size_mask; -} -/* Return the number of elements available for writing. This is the number of - * elements in front of the write pointer and behind the read pointer. */ -size_t ll_ringbuffer_write_space(const ll_ringbuffer_t *rb) -{ - size_t w = rb->write_ptr; - size_t r = rb->read_ptr; - return (rb->size+r-w-1) & rb->size_mask; -} - -/* The copying data reader. Copy at most `cnt' elements from `rb' to `dest'. - * Returns the actual number of elements copied. */ -size_t ll_ringbuffer_read(ll_ringbuffer_t *rb, char *dest, size_t cnt) -{ - size_t free_cnt; - size_t cnt2; - size_t to_read; - size_t n1, n2; - - free_cnt = ll_ringbuffer_read_space(rb); - if(free_cnt == 0) return 0; - - to_read = (cnt > free_cnt) ? free_cnt : cnt; - cnt2 = rb->read_ptr + to_read; - if(cnt2 > rb->size) - { - n1 = rb->size - rb->read_ptr; - n2 = cnt2 & rb->size_mask; - } - else - { - n1 = to_read; - n2 = 0; - } - - memcpy(dest, &(rb->buf[rb->read_ptr*rb->elem_size]), n1*rb->elem_size); - rb->read_ptr = (rb->read_ptr + n1) & rb->size_mask; - if(n2) - { - memcpy(dest + n1*rb->elem_size, &(rb->buf[rb->read_ptr*rb->elem_size]), n2*rb->elem_size); - rb->read_ptr = (rb->read_ptr + n2) & rb->size_mask; - } - return to_read; -} - -/* The copying data reader w/o read pointer advance. Copy at most `cnt' - * elements from `rb' to `dest'. Returns the actual number of elements copied. - */ -size_t ll_ringbuffer_peek(ll_ringbuffer_t *rb, char *dest, size_t cnt) -{ - size_t free_cnt; - size_t cnt2; - size_t to_read; - size_t n1, n2; - size_t tmp_read_ptr; - - tmp_read_ptr = rb->read_ptr; - free_cnt = ll_ringbuffer_read_space(rb); - if(free_cnt == 0) return 0; - - to_read = (cnt > free_cnt) ? free_cnt : cnt; - cnt2 = tmp_read_ptr + to_read; - if(cnt2 > rb->size) - { - n1 = rb->size - tmp_read_ptr; - n2 = cnt2 & rb->size_mask; - } - else - { - n1 = to_read; - n2 = 0; - } - - memcpy(dest, &(rb->buf[tmp_read_ptr*rb->elem_size]), n1*rb->elem_size); - tmp_read_ptr = (tmp_read_ptr + n1) & rb->size_mask; - if(n2) - memcpy(dest + n1*rb->elem_size, &(rb->buf[tmp_read_ptr*rb->elem_size]), n2*rb->elem_size); - return to_read; -} - -/* The copying data writer. Copy at most `cnt' elements to `rb' from `src'. - * Returns the actual number of elements copied. */ -size_t ll_ringbuffer_write(ll_ringbuffer_t *rb, const char *src, size_t cnt) -{ - size_t free_cnt; - size_t cnt2; - size_t to_write; - size_t n1, n2; - - free_cnt = ll_ringbuffer_write_space(rb); - if(free_cnt == 0) return 0; - - to_write = (cnt > free_cnt) ? free_cnt : cnt; - cnt2 = rb->write_ptr + to_write; - if(cnt2 > rb->size) - { - n1 = rb->size - rb->write_ptr; - n2 = cnt2 & rb->size_mask; - } - else - { - n1 = to_write; - n2 = 0; - } - - memcpy(&(rb->buf[rb->write_ptr*rb->elem_size]), src, n1*rb->elem_size); - rb->write_ptr = (rb->write_ptr + n1) & rb->size_mask; - if(n2) - { - memcpy(&(rb->buf[rb->write_ptr*rb->elem_size]), src + n1*rb->elem_size, n2*rb->elem_size); - rb->write_ptr = (rb->write_ptr + n2) & rb->size_mask; - } - return to_write; -} - -/* Advance the read pointer `cnt' places. */ -void ll_ringbuffer_read_advance(ll_ringbuffer_t *rb, size_t cnt) -{ - size_t tmp = (rb->read_ptr + cnt) & rb->size_mask; - rb->read_ptr = tmp; -} - -/* Advance the write pointer `cnt' places. */ -void ll_ringbuffer_write_advance(ll_ringbuffer_t *rb, size_t cnt) -{ - size_t tmp = (rb->write_ptr + cnt) & rb->size_mask; - rb->write_ptr = tmp; -} - -/* The non-copying data reader. `vec' is an array of two places. Set the values - * at `vec' to hold the current readable data at `rb'. If the readable data is - * in one segment the second segment has zero length. */ -void ll_ringbuffer_get_read_vector(const ll_ringbuffer_t *rb, ll_ringbuffer_data_t * vec) -{ - size_t free_cnt; - size_t cnt2; - size_t w, r; - - w = rb->write_ptr; - r = rb->read_ptr; - free_cnt = (rb->size+w-r) & rb->size_mask; - - cnt2 = r + free_cnt; - if(cnt2 > rb->size) - { - /* Two part vector: the rest of the buffer after the current write ptr, - * plus some from the start of the buffer. */ - vec[0].buf = (char*)&(rb->buf[r*rb->elem_size]); - vec[0].len = rb->size - r; - vec[1].buf = (char*)rb->buf; - vec[1].len = cnt2 & rb->size_mask; - } - else - { - /* Single part vector: just the rest of the buffer */ - vec[0].buf = (char*)&(rb->buf[r*rb->elem_size]); - vec[0].len = free_cnt; - vec[1].buf = NULL; - vec[1].len = 0; - } -} - -/* The non-copying data writer. `vec' is an array of two places. Set the values - * at `vec' to hold the current writeable data at `rb'. If the writeable data - * is in one segment the second segment has zero length. */ -void ll_ringbuffer_get_write_vector(const ll_ringbuffer_t *rb, ll_ringbuffer_data_t *vec) -{ - size_t free_cnt; - size_t cnt2; - size_t w, r; - - w = rb->write_ptr; - r = rb->read_ptr; - free_cnt = (rb->size+r-w-1) & rb->size_mask; - - cnt2 = w + free_cnt; - if(cnt2 > rb->size) - { - /* Two part vector: the rest of the buffer after the current write ptr, - * plus some from the start of the buffer. */ - vec[0].buf = (char*)&(rb->buf[w*rb->elem_size]); - vec[0].len = rb->size - w; - vec[1].buf = (char*)rb->buf; - vec[1].len = cnt2 & rb->size_mask; - } - else - { - vec[0].buf = (char*)&(rb->buf[w*rb->elem_size]); - vec[0].len = free_cnt; - vec[1].buf = NULL; - vec[1].len = 0; - } -} diff --git a/Engine/lib/openal-soft/Alc/alcConfig.c b/Engine/lib/openal-soft/Alc/alconfig.c similarity index 70% rename from Engine/lib/openal-soft/Alc/alcConfig.c rename to Engine/lib/openal-soft/Alc/alconfig.c index f83ffd941..5dbf59d2b 100644 --- a/Engine/lib/openal-soft/Alc/alcConfig.c +++ b/Engine/lib/openal-soft/Alc/alconfig.c @@ -38,6 +38,7 @@ #endif #include "alMain.h" +#include "alconfig.h" #include "compat.h" #include "bool.h" @@ -233,7 +234,61 @@ static void LoadConfigFromFile(FILE *f) curSection[0] = 0; else { - strncpy(curSection, section, sizeof(curSection)-1); + size_t len, p = 0; + do { + char *nextp = strchr(section, '%'); + if(!nextp) + { + strncpy(curSection+p, section, sizeof(curSection)-1-p); + break; + } + + len = nextp - section; + if(len > sizeof(curSection)-1-p) + len = sizeof(curSection)-1-p; + strncpy(curSection+p, section, len); + p += len; + section = nextp; + + if(((section[1] >= '0' && section[1] <= '9') || + (section[1] >= 'a' && section[1] <= 'f') || + (section[1] >= 'A' && section[1] <= 'F')) && + ((section[2] >= '0' && section[2] <= '9') || + (section[2] >= 'a' && section[2] <= 'f') || + (section[2] >= 'A' && section[2] <= 'F'))) + { + unsigned char b = 0; + if(section[1] >= '0' && section[1] <= '9') + b = (section[1]-'0') << 4; + else if(section[1] >= 'a' && section[1] <= 'f') + b = (section[1]-'a'+0xa) << 4; + else if(section[1] >= 'A' && section[1] <= 'F') + b = (section[1]-'A'+0x0a) << 4; + if(section[2] >= '0' && section[2] <= '9') + b |= (section[2]-'0'); + else if(section[2] >= 'a' && section[2] <= 'f') + b |= (section[2]-'a'+0xa); + else if(section[2] >= 'A' && section[2] <= 'F') + b |= (section[2]-'A'+0x0a); + if(p < sizeof(curSection)-1) + curSection[p++] = b; + section += 3; + } + else if(section[1] == '%') + { + if(p < sizeof(curSection)-1) + curSection[p++] = '%'; + section += 2; + } + else + { + if(p < sizeof(curSection)-1) + curSection[p++] = '%'; + section += 1; + } + if(p < sizeof(curSection)-1) + curSection[p] = 0; + } while(p < sizeof(curSection)-1 && *section != 0); curSection[sizeof(curSection)-1] = 0; } @@ -311,33 +366,33 @@ static void LoadConfigFromFile(FILE *f) #ifdef _WIN32 void ReadALConfig(void) { - WCHAR buffer[PATH_MAX]; + al_string ppath = AL_STRING_INIT_STATIC(); + WCHAR buffer[MAX_PATH]; const WCHAR *str; - al_string ppath; FILE *f; if(SHGetSpecialFolderPathW(NULL, buffer, CSIDL_APPDATA, FALSE) != FALSE) { al_string filepath = AL_STRING_INIT_STATIC(); - al_string_copy_wcstr(&filepath, buffer); - al_string_append_cstr(&filepath, "\\alsoft.ini"); + alstr_copy_wcstr(&filepath, buffer); + alstr_append_cstr(&filepath, "\\alsoft.ini"); - TRACE("Loading config %s...\n", al_string_get_cstr(filepath)); - f = al_fopen(al_string_get_cstr(filepath), "rt"); + TRACE("Loading config %s...\n", alstr_get_cstr(filepath)); + f = al_fopen(alstr_get_cstr(filepath), "rt"); if(f) { LoadConfigFromFile(f); fclose(f); } - al_string_deinit(&filepath); + alstr_reset(&filepath); } - ppath = GetProcPath(); - if(!al_string_empty(ppath)) + GetProcBinary(&ppath, NULL); + if(!alstr_empty(ppath)) { - al_string_append_cstr(&ppath, "\\alsoft.ini"); - TRACE("Loading config %s...\n", al_string_get_cstr(ppath)); - f = al_fopen(al_string_get_cstr(ppath), "r"); + alstr_append_cstr(&ppath, "\\alsoft.ini"); + TRACE("Loading config %s...\n", alstr_get_cstr(ppath)); + f = al_fopen(alstr_get_cstr(ppath), "r"); if(f) { LoadConfigFromFile(f); @@ -348,26 +403,26 @@ void ReadALConfig(void) if((str=_wgetenv(L"ALSOFT_CONF")) != NULL && *str) { al_string filepath = AL_STRING_INIT_STATIC(); - al_string_copy_wcstr(&filepath, str); + alstr_copy_wcstr(&filepath, str); - TRACE("Loading config %s...\n", al_string_get_cstr(filepath)); - f = al_fopen(al_string_get_cstr(filepath), "rt"); + TRACE("Loading config %s...\n", alstr_get_cstr(filepath)); + f = al_fopen(alstr_get_cstr(filepath), "rt"); if(f) { LoadConfigFromFile(f); fclose(f); } - al_string_deinit(&filepath); + alstr_reset(&filepath); } - al_string_deinit(&ppath); + alstr_reset(&ppath); } #else void ReadALConfig(void) { - char buffer[PATH_MAX]; + al_string confpaths = AL_STRING_INIT_STATIC(); + al_string fname = AL_STRING_INIT_STATIC(); const char *str; - al_string ppath; FILE *f; str = "/etc/openal/alsoft.conf"; @@ -382,45 +437,55 @@ void ReadALConfig(void) if(!(str=getenv("XDG_CONFIG_DIRS")) || str[0] == 0) str = "/etc/xdg"; - strncpy(buffer, str, sizeof(buffer)-1); - buffer[sizeof(buffer)-1] = 0; + alstr_copy_cstr(&confpaths, str); /* Go through the list in reverse, since "the order of base directories * denotes their importance; the first directory listed is the most * important". Ergo, we need to load the settings from the later dirs * first so that the settings in the earlier dirs override them. */ - while(1) + while(!alstr_empty(confpaths)) { - char *next = strrchr(buffer, ':'); - if(next) *(next++) = 0; - else next = buffer; - - if(next[0] != '/') - WARN("Ignoring XDG config dir: %s\n", next); + char *next = strrchr(alstr_get_cstr(confpaths), ':'); + if(next) + { + size_t len = next - alstr_get_cstr(confpaths); + alstr_copy_cstr(&fname, next+1); + VECTOR_RESIZE(confpaths, len, len+1); + VECTOR_ELEM(confpaths, len) = 0; + } else { - size_t len = strlen(next); - strncpy(next+len, "/alsoft.conf", buffer+sizeof(buffer)-next-len); - buffer[sizeof(buffer)-1] = 0; + alstr_reset(&fname); + fname = confpaths; + AL_STRING_INIT(confpaths); + } - TRACE("Loading config %s...\n", next); - f = al_fopen(next, "r"); + if(alstr_empty(fname) || VECTOR_FRONT(fname) != '/') + WARN("Ignoring XDG config dir: %s\n", alstr_get_cstr(fname)); + else + { + if(VECTOR_BACK(fname) != '/') alstr_append_cstr(&fname, "/alsoft.conf"); + else alstr_append_cstr(&fname, "alsoft.conf"); + + TRACE("Loading config %s...\n", alstr_get_cstr(fname)); + f = al_fopen(alstr_get_cstr(fname), "r"); if(f) { LoadConfigFromFile(f); fclose(f); } } - if(next == buffer) - break; + alstr_clear(&fname); } if((str=getenv("HOME")) != NULL && *str) { - snprintf(buffer, sizeof(buffer), "%s/.alsoftrc", str); + alstr_copy_cstr(&fname, str); + if(VECTOR_BACK(fname) != '/') alstr_append_cstr(&fname, "/.alsoftrc"); + else alstr_append_cstr(&fname, ".alsoftrc"); - TRACE("Loading config %s...\n", buffer); - f = al_fopen(buffer, "r"); + TRACE("Loading config %s...\n", alstr_get_cstr(fname)); + f = al_fopen(alstr_get_cstr(fname), "r"); if(f) { LoadConfigFromFile(f); @@ -429,17 +494,25 @@ void ReadALConfig(void) } if((str=getenv("XDG_CONFIG_HOME")) != NULL && str[0] != 0) - snprintf(buffer, sizeof(buffer), "%s/%s", str, "alsoft.conf"); + { + alstr_copy_cstr(&fname, str); + if(VECTOR_BACK(fname) != '/') alstr_append_cstr(&fname, "/alsoft.conf"); + else alstr_append_cstr(&fname, "alsoft.conf"); + } else { - buffer[0] = 0; + alstr_clear(&fname); if((str=getenv("HOME")) != NULL && str[0] != 0) - snprintf(buffer, sizeof(buffer), "%s/.config/%s", str, "alsoft.conf"); + { + alstr_copy_cstr(&fname, str); + if(VECTOR_BACK(fname) != '/') alstr_append_cstr(&fname, "/.config/alsoft.conf"); + else alstr_append_cstr(&fname, ".config/alsoft.conf"); + } } - if(buffer[0] != 0) + if(!alstr_empty(fname)) { - TRACE("Loading config %s...\n", buffer); - f = al_fopen(buffer, "r"); + TRACE("Loading config %s...\n", alstr_get_cstr(fname)); + f = al_fopen(alstr_get_cstr(fname), "r"); if(f) { LoadConfigFromFile(f); @@ -447,12 +520,15 @@ void ReadALConfig(void) } } - ppath = GetProcPath(); - if(!al_string_empty(ppath)) + alstr_clear(&fname); + GetProcBinary(&fname, NULL); + if(!alstr_empty(fname)) { - al_string_append_cstr(&ppath, "/alsoft.conf"); - TRACE("Loading config %s...\n", al_string_get_cstr(ppath)); - f = al_fopen(al_string_get_cstr(ppath), "r"); + if(VECTOR_BACK(fname) != '/') alstr_append_cstr(&fname, "/alsoft.conf"); + else alstr_append_cstr(&fname, "alsoft.conf"); + + TRACE("Loading config %s...\n", alstr_get_cstr(fname)); + f = al_fopen(alstr_get_cstr(fname), "r"); if(f) { LoadConfigFromFile(f); @@ -471,7 +547,8 @@ void ReadALConfig(void) } } - al_string_deinit(&ppath); + alstr_reset(&fname); + alstr_reset(&confpaths); } #endif diff --git a/Engine/lib/openal-soft/Alc/alconfig.h b/Engine/lib/openal-soft/Alc/alconfig.h new file mode 100644 index 000000000..1e493e2ee --- /dev/null +++ b/Engine/lib/openal-soft/Alc/alconfig.h @@ -0,0 +1,17 @@ +#ifndef ALCONFIG_H +#define ALCONFIG_H + +void ReadALConfig(void); +void FreeALConfig(void); + +int ConfigValueExists(const char *devName, const char *blockName, const char *keyName); +const char *GetConfigValue(const char *devName, const char *blockName, const char *keyName, const char *def); +int GetConfigValueBool(const char *devName, const char *blockName, const char *keyName, int def); + +int ConfigValueStr(const char *devName, const char *blockName, const char *keyName, const char **ret); +int ConfigValueInt(const char *devName, const char *blockName, const char *keyName, int *ret); +int ConfigValueUInt(const char *devName, const char *blockName, const char *keyName, unsigned int *ret); +int ConfigValueFloat(const char *devName, const char *blockName, const char *keyName, float *ret); +int ConfigValueBool(const char *devName, const char *blockName, const char *keyName, int *ret); + +#endif /* ALCONFIG_H */ diff --git a/Engine/lib/openal-soft/Alc/alstring.h b/Engine/lib/openal-soft/Alc/alstring.h index 6167f5ce1..923a5ea2d 100644 --- a/Engine/lib/openal-soft/Alc/alstring.h +++ b/Engine/lib/openal-soft/Alc/alstring.h @@ -6,44 +6,53 @@ #include "vector.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef char al_string_char_type; TYPEDEF_VECTOR(al_string_char_type, al_string) TYPEDEF_VECTOR(al_string, vector_al_string) -inline void al_string_deinit(al_string *str) +inline void alstr_reset(al_string *str) { VECTOR_DEINIT(*str); } #define AL_STRING_INIT(_x) do { (_x) = (al_string)NULL; } while(0) #define AL_STRING_INIT_STATIC() ((al_string)NULL) -#define AL_STRING_DEINIT(_x) al_string_deinit(&(_x)) +#define AL_STRING_DEINIT(_x) alstr_reset(&(_x)) -inline size_t al_string_length(const_al_string str) +inline size_t alstr_length(const_al_string str) { return VECTOR_SIZE(str); } -inline ALboolean al_string_empty(const_al_string str) -{ return al_string_length(str) == 0; } +inline ALboolean alstr_empty(const_al_string str) +{ return alstr_length(str) == 0; } -inline const al_string_char_type *al_string_get_cstr(const_al_string str) +inline const al_string_char_type *alstr_get_cstr(const_al_string str) { return str ? &VECTOR_FRONT(str) : ""; } -void al_string_clear(al_string *str); +void alstr_clear(al_string *str); -int al_string_cmp(const_al_string str1, const_al_string str2); -int al_string_cmp_cstr(const_al_string str1, const al_string_char_type *str2); +int alstr_cmp(const_al_string str1, const_al_string str2); +int alstr_cmp_cstr(const_al_string str1, const al_string_char_type *str2); -void al_string_copy(al_string *str, const_al_string from); -void al_string_copy_cstr(al_string *str, const al_string_char_type *from); -void al_string_copy_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to); +void alstr_copy(al_string *str, const_al_string from); +void alstr_copy_cstr(al_string *str, const al_string_char_type *from); +void alstr_copy_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to); -void al_string_append_char(al_string *str, const al_string_char_type c); -void al_string_append_cstr(al_string *str, const al_string_char_type *from); -void al_string_append_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to); +void alstr_append_char(al_string *str, const al_string_char_type c); +void alstr_append_cstr(al_string *str, const al_string_char_type *from); +void alstr_append_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to); #ifdef _WIN32 #include /* Windows-only methods to deal with WideChar strings. */ -void al_string_copy_wcstr(al_string *str, const wchar_t *from); -void al_string_append_wcstr(al_string *str, const wchar_t *from); -void al_string_append_wrange(al_string *str, const wchar_t *from, const wchar_t *to); +void alstr_copy_wcstr(al_string *str, const wchar_t *from); +void alstr_append_wcstr(al_string *str, const wchar_t *from); +void alstr_copy_wrange(al_string *str, const wchar_t *from, const wchar_t *to); +void alstr_append_wrange(al_string *str, const wchar_t *from, const wchar_t *to); +#endif + +#ifdef __cplusplus +} /* extern "C" */ #endif #endif /* ALSTRING_H */ diff --git a/Engine/lib/openal-soft/Alc/ambdec.c b/Engine/lib/openal-soft/Alc/ambdec.c index 255011d5e..da1143354 100644 --- a/Engine/lib/openal-soft/Alc/ambdec.c +++ b/Engine/lib/openal-soft/Alc/ambdec.c @@ -90,6 +90,15 @@ static char *my_strtok_r(char *str, const char *delim, char **saveptr) return str; } +static char *read_int(ALint *num, const char *line, int base) +{ + char *end; + *num = strtol(line, &end, base); + if(end && *end != '\0') + end = lstrip(end); + return end; +} + static char *read_uint(ALuint *num, const char *line, int base) { char *end; @@ -131,7 +140,7 @@ char *read_clipped_line(FILE *f, char **buffer, size_t *maxlen) static int load_ambdec_speakers(AmbDecConf *conf, FILE *f, char **buffer, size_t *maxlen, char **saveptr) { - ALuint cur = 0; + ALsizei cur = 0; while(cur < conf->NumSpeakers) { const char *cmd = my_strtok_r(NULL, " \t", saveptr); @@ -155,7 +164,7 @@ static int load_ambdec_speakers(AmbDecConf *conf, FILE *f, char **buffer, size_t const char *conn = my_strtok_r(NULL, " \t", saveptr); if(!name) WARN("Name not specified for speaker %u\n", cur+1); - else al_string_copy_cstr(&conf->Speakers[cur].Name, name); + else alstr_copy_cstr(&conf->Speakers[cur].Name, name); if(!dist) WARN("Distance not specified for speaker %u\n", cur+1); else read_float(&conf->Speakers[cur].Distance, dist); if(!az) WARN("Azimuth not specified for speaker %u\n", cur+1); @@ -163,7 +172,7 @@ static int load_ambdec_speakers(AmbDecConf *conf, FILE *f, char **buffer, size_t if(!elev) WARN("Elevation not specified for speaker %u\n", cur+1); else read_float(&conf->Speakers[cur].Elevation, elev); if(!conn) TRACE("Connection not specified for speaker %u\n", cur+1); - else al_string_copy_cstr(&conf->Speakers[cur].Connection, conn); + else alstr_copy_cstr(&conf->Speakers[cur].Connection, conn); cur++; } @@ -184,10 +193,10 @@ static int load_ambdec_speakers(AmbDecConf *conf, FILE *f, char **buffer, size_t return 1; } -static int load_ambdec_matrix(ALfloat *gains, ALfloat (*matrix)[MAX_AMBI_COEFFS], ALuint maxrow, FILE *f, char **buffer, size_t *maxlen, char **saveptr) +static int load_ambdec_matrix(ALfloat *gains, ALfloat (*matrix)[MAX_AMBI_COEFFS], ALsizei maxrow, FILE *f, char **buffer, size_t *maxlen, char **saveptr) { int gotgains = 0; - ALuint cur = 0; + ALsizei cur = 0; while(cur < maxrow) { const char *cmd = my_strtok_r(NULL, " \t", saveptr); @@ -269,7 +278,7 @@ static int load_ambdec_matrix(ALfloat *gains, ALfloat (*matrix)[MAX_AMBI_COEFFS] void ambdec_init(AmbDecConf *conf) { - ALuint i; + ALsizei i; memset(conf, 0, sizeof(*conf)); AL_STRING_INIT(conf->Description); @@ -282,13 +291,13 @@ void ambdec_init(AmbDecConf *conf) void ambdec_deinit(AmbDecConf *conf) { - ALuint i; + ALsizei i; - al_string_deinit(&conf->Description); + alstr_reset(&conf->Description); for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) { - al_string_deinit(&conf->Speakers[i].Name); - al_string_deinit(&conf->Speakers[i].Connection); + alstr_reset(&conf->Speakers[i].Name); + alstr_reset(&conf->Speakers[i].Connection); } memset(conf, 0, sizeof(*conf)); } @@ -322,7 +331,7 @@ int ambdec_load(AmbDecConf *conf, const char *fname) if(strcmp(command, "description") == 0) { char *value = my_strtok_r(NULL, "", &saveptr); - al_string_copy_cstr(&conf->Description, lstrip(value)); + alstr_copy_cstr(&conf->Description, lstrip(value)); } else if(strcmp(command, "version") == 0) { @@ -370,7 +379,7 @@ int ambdec_load(AmbDecConf *conf, const char *fname) else if(strcmp(dec, "speakers") == 0) { line = my_strtok_r(NULL, "", &saveptr); - line = read_uint(&conf->NumSpeakers, line, 10); + line = read_int(&conf->NumSpeakers, line, 10); if(line && *line != '\0') { ERR("Extra junk after speakers: %s\n", line); diff --git a/Engine/lib/openal-soft/Alc/ambdec.h b/Engine/lib/openal-soft/Alc/ambdec.h index 8a3befc1a..0bb84072b 100644 --- a/Engine/lib/openal-soft/Alc/ambdec.h +++ b/Engine/lib/openal-soft/Alc/ambdec.h @@ -17,7 +17,7 @@ typedef struct AmbDecConf { ALuint ChanMask; ALuint FreqBands; /* Must be 1 or 2 */ - ALuint NumSpeakers; + ALsizei NumSpeakers; enum AmbDecScaleType CoeffScale; ALfloat XOverFreq; diff --git a/Engine/lib/openal-soft/Alc/backends/alsa.c b/Engine/lib/openal-soft/Alc/backends/alsa.c index 7a9045bb0..e0fdc070b 100644 --- a/Engine/lib/openal-soft/Alc/backends/alsa.c +++ b/Engine/lib/openal-soft/Alc/backends/alsa.c @@ -26,6 +26,8 @@ #include "alMain.h" #include "alu.h" +#include "alconfig.h" +#include "ringbuffer.h" #include "threads.h" #include "compat.h" @@ -199,15 +201,21 @@ static ALCboolean alsa_load(void) #ifdef HAVE_DYNLOAD if(!alsa_handle) { + al_string missing_funcs = AL_STRING_INIT_STATIC(); + alsa_handle = LoadLib("libasound.so.2"); if(!alsa_handle) + { + WARN("Failed to load %s\n", "libasound.so.2"); return ALC_FALSE; + } error = ALC_FALSE; #define LOAD_FUNC(f) do { \ p##f = GetSymbol(alsa_handle, #f); \ if(p##f == NULL) { \ error = ALC_TRUE; \ + alstr_append_cstr(&missing_funcs, "\n" #f); \ } \ } while(0) ALSA_FUNCS(LOAD_FUNC); @@ -215,10 +223,11 @@ static ALCboolean alsa_load(void) if(error) { + WARN("Missing expected functions:%s\n", alstr_get_cstr(missing_funcs)); CloseLib(alsa_handle); alsa_handle = NULL; - return ALC_FALSE; } + alstr_reset(&missing_funcs); } #endif @@ -269,11 +278,45 @@ static void probe_devices(snd_pcm_stream_t stream, vector_DevMap *DeviceList) AL_STRING_INIT(entry.name); AL_STRING_INIT(entry.device_name); - al_string_copy_cstr(&entry.name, alsaDevice); - al_string_copy_cstr(&entry.device_name, GetConfigValue(NULL, "alsa", (stream==SND_PCM_STREAM_PLAYBACK) ? - "device" : "capture", "default")); + alstr_copy_cstr(&entry.name, alsaDevice); + alstr_copy_cstr(&entry.device_name, GetConfigValue( + NULL, "alsa", (stream==SND_PCM_STREAM_PLAYBACK) ? "device" : "capture", "default" + )); VECTOR_PUSH_BACK(*DeviceList, entry); + if(stream == SND_PCM_STREAM_PLAYBACK) + { + const char *customdevs, *sep, *next; + next = GetConfigValue(NULL, "alsa", "custom-devices", ""); + while((customdevs=next) != NULL && customdevs[0]) + { + next = strchr(customdevs, ';'); + sep = strchr(customdevs, '='); + if(!sep) + { + al_string spec = AL_STRING_INIT_STATIC(); + if(next) + alstr_copy_range(&spec, customdevs, next++); + else + alstr_copy_cstr(&spec, customdevs); + ERR("Invalid ALSA device specification \"%s\"\n", alstr_get_cstr(spec)); + alstr_reset(&spec); + continue; + } + + AL_STRING_INIT(entry.name); + AL_STRING_INIT(entry.device_name); + alstr_copy_range(&entry.name, customdevs, sep++); + if(next) + alstr_copy_range(&entry.device_name, sep, next++); + else + alstr_copy_cstr(&entry.device_name, sep); + TRACE("Got device \"%s\", \"%s\"\n", alstr_get_cstr(entry.name), + alstr_get_cstr(entry.device_name)); + VECTOR_PUSH_BACK(*DeviceList, entry); + } + } + card = -1; if((err=snd_card_next(&card)) < 0) ERR("Failed to find a card: %s\n", snd_strerror(err)); @@ -318,7 +361,8 @@ static void probe_devices(snd_pcm_stream_t stream, vector_DevMap *DeviceList) snd_pcm_info_set_device(pcminfo, dev); snd_pcm_info_set_subdevice(pcminfo, 0); snd_pcm_info_set_stream(pcminfo, stream); - if((err = snd_ctl_pcm_info(handle, pcminfo)) < 0) { + if((err = snd_ctl_pcm_info(handle, pcminfo)) < 0) + { if(err != -ENOENT) ERR("control digital audio info (hw:%d): %s\n", card, snd_strerror(err)); continue; @@ -330,15 +374,15 @@ static void probe_devices(snd_pcm_stream_t stream, vector_DevMap *DeviceList) ConfigValueStr(NULL, "alsa", name, &device_prefix); snprintf(name, sizeof(name), "%s, %s (CARD=%s,DEV=%d)", - cardname, devname, cardid, dev); + cardname, devname, cardid, dev); snprintf(device, sizeof(device), "%sCARD=%s,DEV=%d", - device_prefix, cardid, dev); + device_prefix, cardid, dev); TRACE("Got device \"%s\", \"%s\"\n", name, device); AL_STRING_INIT(entry.name); AL_STRING_INIT(entry.device_name); - al_string_copy_cstr(&entry.name, name); - al_string_copy_cstr(&entry.device_name, device); + alstr_copy_cstr(&entry.name, name); + alstr_copy_cstr(&entry.device_name, device); VECTOR_PUSH_BACK(*DeviceList, entry); } snd_ctl_close(handle); @@ -394,7 +438,7 @@ typedef struct ALCplaybackAlsa { ALvoid *buffer; ALsizei size; - volatile int killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCplaybackAlsa; @@ -402,9 +446,8 @@ static int ALCplaybackAlsa_mixerProc(void *ptr); static int ALCplaybackAlsa_mixerNoMMapProc(void *ptr); static void ALCplaybackAlsa_Construct(ALCplaybackAlsa *self, ALCdevice *device); -static DECLARE_FORWARD(ALCplaybackAlsa, ALCbackend, void, Destruct) +static void ALCplaybackAlsa_Destruct(ALCplaybackAlsa *self); static ALCenum ALCplaybackAlsa_open(ALCplaybackAlsa *self, const ALCchar *name); -static void ALCplaybackAlsa_close(ALCplaybackAlsa *self); static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self); static ALCboolean ALCplaybackAlsa_start(ALCplaybackAlsa *self); static void ALCplaybackAlsa_stop(ALCplaybackAlsa *self); @@ -422,6 +465,19 @@ static void ALCplaybackAlsa_Construct(ALCplaybackAlsa *self, ALCdevice *device) { ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCplaybackAlsa, ALCbackend, self); + + self->pcmHandle = NULL; + self->buffer = NULL; + + ATOMIC_INIT(&self->killNow, AL_TRUE); +} + +void ALCplaybackAlsa_Destruct(ALCplaybackAlsa *self) +{ + if(self->pcmHandle) + snd_pcm_close(self->pcmHandle); + self->pcmHandle = NULL; + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } @@ -441,14 +497,14 @@ static int ALCplaybackAlsa_mixerProc(void *ptr) update_size = device->UpdateSize; num_updates = device->NumUpdates; - while(!self->killNow) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire)) { int state = verify_state(self->pcmHandle); if(state < 0) { ERR("Invalid state detected: %s\n", snd_strerror(state)); ALCplaybackAlsa_lock(self); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Bad state: %s", snd_strerror(state)); ALCplaybackAlsa_unlock(self); break; } @@ -531,14 +587,14 @@ static int ALCplaybackAlsa_mixerNoMMapProc(void *ptr) update_size = device->UpdateSize; num_updates = device->NumUpdates; - while(!self->killNow) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire)) { int state = verify_state(self->pcmHandle); if(state < 0) { ERR("Invalid state detected: %s\n", snd_strerror(state)); ALCplaybackAlsa_lock(self); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Bad state: %s", snd_strerror(state)); ALCplaybackAlsa_unlock(self); break; } @@ -629,12 +685,12 @@ static ALCenum ALCplaybackAlsa_open(ALCplaybackAlsa *self, const ALCchar *name) if(VECTOR_SIZE(PlaybackDevices) == 0) probe_devices(SND_PCM_STREAM_PLAYBACK, &PlaybackDevices); -#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, name) == 0) +#define MATCH_NAME(i) (alstr_cmp_cstr((i)->name, name) == 0) VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_NAME); #undef MATCH_NAME if(iter == VECTOR_END(PlaybackDevices)) return ALC_INVALID_VALUE; - driver = al_string_get_cstr(iter->device_name); + driver = alstr_get_cstr(iter->device_name); } else { @@ -653,16 +709,11 @@ static ALCenum ALCplaybackAlsa_open(ALCplaybackAlsa *self, const ALCchar *name) /* Free alsa's global config tree. Otherwise valgrind reports a ton of leaks. */ snd_config_update_free_global(); - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCplaybackAlsa_close(ALCplaybackAlsa *self) -{ - snd_pcm_close(self->pcmHandle); -} - static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; @@ -704,7 +755,7 @@ static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self) break; } - allowmmap = GetConfigValueBool(al_string_get_cstr(device->DeviceName), "alsa", "mmap", 1); + allowmmap = GetConfigValueBool(alstr_get_cstr(device->DeviceName), "alsa", "mmap", 1); periods = device->NumUpdates; periodLen = (ALuint64)device->UpdateSize * 1000000 / device->Frequency; bufferLen = periodLen * periods; @@ -748,7 +799,7 @@ static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self) } CHECK(snd_pcm_hw_params_set_format(self->pcmHandle, hp, format)); /* test and set channels (implicitly sets frame bits) */ - if(snd_pcm_hw_params_test_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans)) < 0) + if(snd_pcm_hw_params_test_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder)) < 0) { static const enum DevFmtChannels channellist[] = { DevFmtStereo, @@ -761,16 +812,17 @@ static ALCboolean ALCplaybackAlsa_reset(ALCplaybackAlsa *self) for(k = 0;k < COUNTOF(channellist);k++) { - if(snd_pcm_hw_params_test_channels(self->pcmHandle, hp, ChannelsFromDevFmt(channellist[k])) >= 0) + if(snd_pcm_hw_params_test_channels(self->pcmHandle, hp, ChannelsFromDevFmt(channellist[k], 0)) >= 0) { device->FmtChans = channellist[k]; + device->AmbiOrder = 0; break; } } } - CHECK(snd_pcm_hw_params_set_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans))); + CHECK(snd_pcm_hw_params_set_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder))); /* set rate (implicitly constrains period/buffer parameters) */ - if(!GetConfigValueBool(al_string_get_cstr(device->DeviceName), "alsa", "allow-resampler", 0) || + if(!GetConfigValueBool(alstr_get_cstr(device->DeviceName), "alsa", "allow-resampler", 0) || !(device->Flags&DEVICE_FREQUENCY_REQUEST)) { if(snd_pcm_hw_params_set_rate_resample(self->pcmHandle, hp, 0) < 0) @@ -860,7 +912,7 @@ static ALCboolean ALCplaybackAlsa_start(ALCplaybackAlsa *self) } thread_func = ALCplaybackAlsa_mixerProc; } - self->killNow = 0; + ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); if(althrd_create(&self->thread, thread_func, self) != althrd_success) { ERR("Could not create playback thread\n"); @@ -881,10 +933,8 @@ static void ALCplaybackAlsa_stop(ALCplaybackAlsa *self) { int res; - if(self->killNow) + if(ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) return; - - self->killNow = 1; althrd_join(self->thread, &res); al_free(self->buffer); @@ -928,9 +978,8 @@ typedef struct ALCcaptureAlsa { } ALCcaptureAlsa; static void ALCcaptureAlsa_Construct(ALCcaptureAlsa *self, ALCdevice *device); -static DECLARE_FORWARD(ALCcaptureAlsa, ALCbackend, void, Destruct) +static void ALCcaptureAlsa_Destruct(ALCcaptureAlsa *self); static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name); -static void ALCcaptureAlsa_close(ALCcaptureAlsa *self); static DECLARE_FORWARD(ALCcaptureAlsa, ALCbackend, ALCboolean, reset) static ALCboolean ALCcaptureAlsa_start(ALCcaptureAlsa *self); static void ALCcaptureAlsa_stop(ALCcaptureAlsa *self); @@ -948,6 +997,25 @@ static void ALCcaptureAlsa_Construct(ALCcaptureAlsa *self, ALCdevice *device) { ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCcaptureAlsa, ALCbackend, self); + + self->pcmHandle = NULL; + self->buffer = NULL; + self->ring = NULL; +} + +void ALCcaptureAlsa_Destruct(ALCcaptureAlsa *self) +{ + if(self->pcmHandle) + snd_pcm_close(self->pcmHandle); + self->pcmHandle = NULL; + + al_free(self->buffer); + self->buffer = NULL; + + ll_ringbuffer_free(self->ring); + self->ring = NULL; + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } @@ -970,12 +1038,12 @@ static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name) if(VECTOR_SIZE(CaptureDevices) == 0) probe_devices(SND_PCM_STREAM_CAPTURE, &CaptureDevices); -#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, name) == 0) +#define MATCH_NAME(i) (alstr_cmp_cstr((i)->name, name) == 0) VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_NAME); #undef MATCH_NAME if(iter == VECTOR_END(CaptureDevices)) return ALC_INVALID_VALUE; - driver = al_string_get_cstr(iter->device_name); + driver = alstr_get_cstr(iter->device_name); } else { @@ -1032,7 +1100,7 @@ static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name) /* set format (implicitly sets sample bits) */ CHECK(snd_pcm_hw_params_set_format(self->pcmHandle, hp, format)); /* set channels (implicitly sets frame bits) */ - CHECK(snd_pcm_hw_params_set_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans))); + CHECK(snd_pcm_hw_params_set_channels(self->pcmHandle, hp, ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder))); /* set rate (implicitly constrains period/buffer parameters) */ CHECK(snd_pcm_hw_params_set_rate(self->pcmHandle, hp, device->Frequency, 0)); /* set buffer size in frame units (implicitly sets period size/bytes/time and buffer time/bytes) */ @@ -1055,8 +1123,9 @@ static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name) if(needring) { self->ring = ll_ringbuffer_create( - device->UpdateSize*device->NumUpdates + 1, - FrameSizeFromDevFmt(device->FmtChans, device->FmtType) + device->UpdateSize*device->NumUpdates, + FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder), + false ); if(!self->ring) { @@ -1065,7 +1134,7 @@ static ALCenum ALCcaptureAlsa_open(ALCcaptureAlsa *self, const ALCchar *name) } } - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; @@ -1077,26 +1146,19 @@ error2: ll_ringbuffer_free(self->ring); self->ring = NULL; snd_pcm_close(self->pcmHandle); + self->pcmHandle = NULL; return ALC_INVALID_VALUE; } -static void ALCcaptureAlsa_close(ALCcaptureAlsa *self) -{ - snd_pcm_close(self->pcmHandle); - ll_ringbuffer_free(self->ring); - - al_free(self->buffer); - self->buffer = NULL; -} - static ALCboolean ALCcaptureAlsa_start(ALCcaptureAlsa *self) { int err = snd_pcm_start(self->pcmHandle); if(err < 0) { ERR("start failed: %s\n", snd_strerror(err)); - aluHandleDisconnect(STATIC_CAST(ALCbackend, self)->mDevice); + aluHandleDisconnect(STATIC_CAST(ALCbackend, self)->mDevice, "Capture state failure: %s", + snd_strerror(err)); return ALC_FALSE; } @@ -1147,7 +1209,7 @@ static ALCenum ALCcaptureAlsa_captureSamples(ALCcaptureAlsa *self, ALCvoid *buff } self->last_avail -= samples; - while(device->Connected && samples > 0) + while(ATOMIC_LOAD(&device->Connected, almemory_order_acquire) && samples > 0) { snd_pcm_sframes_t amt = 0; @@ -1190,7 +1252,7 @@ static ALCenum ALCcaptureAlsa_captureSamples(ALCcaptureAlsa *self, ALCvoid *buff if(amt < 0) { ERR("restore error: %s\n", snd_strerror(amt)); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Capture recovery failure: %s", snd_strerror(amt)); break; } /* If the amount available is less than what's asked, we lost it @@ -1215,7 +1277,7 @@ static ALCuint ALCcaptureAlsa_availableSamples(ALCcaptureAlsa *self) ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; snd_pcm_sframes_t avail = 0; - if(device->Connected && self->doCapture) + if(ATOMIC_LOAD(&device->Connected, almemory_order_acquire) && self->doCapture) avail = snd_pcm_avail_update(self->pcmHandle); if(avail < 0) { @@ -1231,7 +1293,7 @@ static ALCuint ALCcaptureAlsa_availableSamples(ALCcaptureAlsa *self) if(avail < 0) { ERR("restore error: %s\n", snd_strerror(avail)); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Capture recovery failure: %s", snd_strerror(avail)); } } @@ -1270,7 +1332,7 @@ static ALCuint ALCcaptureAlsa_availableSamples(ALCcaptureAlsa *self) if(amt < 0) { ERR("restore error: %s\n", snd_strerror(amt)); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Capture recovery failure: %s", snd_strerror(amt)); break; } avail = amt; @@ -1307,9 +1369,9 @@ static ClockLatency ALCcaptureAlsa_getClockLatency(ALCcaptureAlsa *self) static inline void AppendAllDevicesList2(const DevMap *entry) -{ AppendAllDevicesList(al_string_get_cstr(entry->name)); } +{ AppendAllDevicesList(alstr_get_cstr(entry->name)); } static inline void AppendCaptureDeviceList2(const DevMap *entry) -{ AppendCaptureDeviceList(al_string_get_cstr(entry->name)); } +{ AppendCaptureDeviceList(alstr_get_cstr(entry->name)); } typedef struct ALCalsaBackendFactory { DERIVE_FROM_TYPE(ALCbackendFactory); diff --git a/Engine/lib/openal-soft/Alc/backends/base.c b/Engine/lib/openal-soft/Alc/backends/base.c index ff808f535..a451fee9b 100644 --- a/Engine/lib/openal-soft/Alc/backends/base.c +++ b/Engine/lib/openal-soft/Alc/backends/base.c @@ -4,11 +4,14 @@ #include #include "alMain.h" +#include "alu.h" #include "backends/base.h" extern inline ALuint64 GetDeviceClockTime(ALCdevice *device); +extern inline void ALCdevice_Lock(ALCdevice *device); +extern inline void ALCdevice_Unlock(ALCdevice *device); /* Base ALCbackend method implementations. */ void ALCbackend_Construct(ALCbackend *self, ALCdevice *device) @@ -41,13 +44,22 @@ ALCuint ALCbackend_availableSamples(ALCbackend* UNUSED(self)) ClockLatency ALCbackend_getClockLatency(ALCbackend *self) { ALCdevice *device = self->mDevice; + ALuint refcount; ClockLatency ret; - almtx_lock(&self->mMutex); - ret.ClockTime = GetDeviceClockTime(device); - // TODO: Perhaps should be NumUpdates-1 worth of UpdateSize? - ret.Latency = 0; - almtx_unlock(&self->mMutex); + do { + while(((refcount=ATOMIC_LOAD(&device->MixCount, almemory_order_acquire))&1)) + althrd_yield(); + ret.ClockTime = GetDeviceClockTime(device); + ATOMIC_THREAD_FENCE(almemory_order_acquire); + } while(refcount != ATOMIC_LOAD(&device->MixCount, almemory_order_relaxed)); + + /* NOTE: The device will generally have about all but one periods filled at + * any given time during playback. Without a more accurate measurement from + * the output, this is an okay approximation. + */ + ret.Latency = device->UpdateSize * DEVICE_CLOCK_RES / device->Frequency * + maxu(device->NumUpdates-1, 1); return ret; } @@ -69,157 +81,3 @@ void ALCbackend_unlock(ALCbackend *self) void ALCbackendFactory_deinit(ALCbackendFactory* UNUSED(self)) { } - - -/* Wrappers to use an old-style backend with the new interface. */ -typedef struct PlaybackWrapper { - DERIVE_FROM_TYPE(ALCbackend); - - const BackendFuncs *Funcs; -} PlaybackWrapper; - -static void PlaybackWrapper_Construct(PlaybackWrapper *self, ALCdevice *device, const BackendFuncs *funcs); -static DECLARE_FORWARD(PlaybackWrapper, ALCbackend, void, Destruct) -static ALCenum PlaybackWrapper_open(PlaybackWrapper *self, const ALCchar *name); -static void PlaybackWrapper_close(PlaybackWrapper *self); -static ALCboolean PlaybackWrapper_reset(PlaybackWrapper *self); -static ALCboolean PlaybackWrapper_start(PlaybackWrapper *self); -static void PlaybackWrapper_stop(PlaybackWrapper *self); -static DECLARE_FORWARD2(PlaybackWrapper, ALCbackend, ALCenum, captureSamples, void*, ALCuint) -static DECLARE_FORWARD(PlaybackWrapper, ALCbackend, ALCuint, availableSamples) -static DECLARE_FORWARD(PlaybackWrapper, ALCbackend, ClockLatency, getClockLatency) -static DECLARE_FORWARD(PlaybackWrapper, ALCbackend, void, lock) -static DECLARE_FORWARD(PlaybackWrapper, ALCbackend, void, unlock) -DECLARE_DEFAULT_ALLOCATORS(PlaybackWrapper) -DEFINE_ALCBACKEND_VTABLE(PlaybackWrapper); - -static void PlaybackWrapper_Construct(PlaybackWrapper *self, ALCdevice *device, const BackendFuncs *funcs) -{ - ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); - SET_VTABLE2(PlaybackWrapper, ALCbackend, self); - - self->Funcs = funcs; -} - -static ALCenum PlaybackWrapper_open(PlaybackWrapper *self, const ALCchar *name) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - return self->Funcs->OpenPlayback(device, name); -} - -static void PlaybackWrapper_close(PlaybackWrapper *self) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - self->Funcs->ClosePlayback(device); -} - -static ALCboolean PlaybackWrapper_reset(PlaybackWrapper *self) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - return self->Funcs->ResetPlayback(device); -} - -static ALCboolean PlaybackWrapper_start(PlaybackWrapper *self) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - return self->Funcs->StartPlayback(device); -} - -static void PlaybackWrapper_stop(PlaybackWrapper *self) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - self->Funcs->StopPlayback(device); -} - - -typedef struct CaptureWrapper { - DERIVE_FROM_TYPE(ALCbackend); - - const BackendFuncs *Funcs; -} CaptureWrapper; - -static void CaptureWrapper_Construct(CaptureWrapper *self, ALCdevice *device, const BackendFuncs *funcs); -static DECLARE_FORWARD(CaptureWrapper, ALCbackend, void, Destruct) -static ALCenum CaptureWrapper_open(CaptureWrapper *self, const ALCchar *name); -static void CaptureWrapper_close(CaptureWrapper *self); -static DECLARE_FORWARD(CaptureWrapper, ALCbackend, ALCboolean, reset) -static ALCboolean CaptureWrapper_start(CaptureWrapper *self); -static void CaptureWrapper_stop(CaptureWrapper *self); -static ALCenum CaptureWrapper_captureSamples(CaptureWrapper *self, void *buffer, ALCuint samples); -static ALCuint CaptureWrapper_availableSamples(CaptureWrapper *self); -static DECLARE_FORWARD(CaptureWrapper, ALCbackend, ClockLatency, getClockLatency) -static DECLARE_FORWARD(CaptureWrapper, ALCbackend, void, lock) -static DECLARE_FORWARD(CaptureWrapper, ALCbackend, void, unlock) -DECLARE_DEFAULT_ALLOCATORS(CaptureWrapper) -DEFINE_ALCBACKEND_VTABLE(CaptureWrapper); - -static void CaptureWrapper_Construct(CaptureWrapper *self, ALCdevice *device, const BackendFuncs *funcs) -{ - ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); - SET_VTABLE2(CaptureWrapper, ALCbackend, self); - - self->Funcs = funcs; -} - -static ALCenum CaptureWrapper_open(CaptureWrapper *self, const ALCchar *name) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - return self->Funcs->OpenCapture(device, name); -} - -static void CaptureWrapper_close(CaptureWrapper *self) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - self->Funcs->CloseCapture(device); -} - -static ALCboolean CaptureWrapper_start(CaptureWrapper *self) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - self->Funcs->StartCapture(device); - return ALC_TRUE; -} - -static void CaptureWrapper_stop(CaptureWrapper *self) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - self->Funcs->StopCapture(device); -} - -static ALCenum CaptureWrapper_captureSamples(CaptureWrapper *self, void *buffer, ALCuint samples) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - return self->Funcs->CaptureSamples(device, buffer, samples); -} - -static ALCuint CaptureWrapper_availableSamples(CaptureWrapper *self) -{ - ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - return self->Funcs->AvailableSamples(device); -} - - -ALCbackend *create_backend_wrapper(ALCdevice *device, const BackendFuncs *funcs, ALCbackend_Type type) -{ - if(type == ALCbackend_Playback) - { - PlaybackWrapper *backend; - - NEW_OBJ(backend, PlaybackWrapper)(device, funcs); - if(!backend) return NULL; - - return STATIC_CAST(ALCbackend, backend); - } - - if(type == ALCbackend_Capture) - { - CaptureWrapper *backend; - - NEW_OBJ(backend, CaptureWrapper)(device, funcs); - if(!backend) return NULL; - - return STATIC_CAST(ALCbackend, backend); - } - - return NULL; -} diff --git a/Engine/lib/openal-soft/Alc/backends/base.h b/Engine/lib/openal-soft/Alc/backends/base.h index 04795b368..ba92b4ac6 100644 --- a/Engine/lib/openal-soft/Alc/backends/base.h +++ b/Engine/lib/openal-soft/Alc/backends/base.h @@ -5,6 +5,10 @@ #include "threads.h" +#ifdef __cplusplus +extern "C" { +#endif + typedef struct ClockLatency { ALint64 ClockTime; ALint64 Latency; @@ -43,7 +47,6 @@ struct ALCbackendVtable { void (*const Destruct)(ALCbackend*); ALCenum (*const open)(ALCbackend*, const ALCchar*); - void (*const close)(ALCbackend*); ALCboolean (*const reset)(ALCbackend*); ALCboolean (*const start)(ALCbackend*); @@ -63,7 +66,6 @@ struct ALCbackendVtable { #define DEFINE_ALCBACKEND_VTABLE(T) \ DECLARE_THUNK(T, ALCbackend, void, Destruct) \ DECLARE_THUNK1(T, ALCbackend, ALCenum, open, const ALCchar*) \ -DECLARE_THUNK(T, ALCbackend, void, close) \ DECLARE_THUNK(T, ALCbackend, ALCboolean, reset) \ DECLARE_THUNK(T, ALCbackend, ALCboolean, start) \ DECLARE_THUNK(T, ALCbackend, void, stop) \ @@ -79,7 +81,6 @@ static const struct ALCbackendVtable T##_ALCbackend_vtable = { \ T##_ALCbackend_Destruct, \ \ T##_ALCbackend_open, \ - T##_ALCbackend_close, \ T##_ALCbackend_reset, \ T##_ALCbackend_start, \ T##_ALCbackend_stop, \ @@ -137,17 +138,31 @@ static const struct ALCbackendFactoryVtable T##_ALCbackendFactory_vtable = { \ ALCbackendFactory *ALCpulseBackendFactory_getFactory(void); ALCbackendFactory *ALCalsaBackendFactory_getFactory(void); +ALCbackendFactory *ALCcoreAudioBackendFactory_getFactory(void); ALCbackendFactory *ALCossBackendFactory_getFactory(void); ALCbackendFactory *ALCjackBackendFactory_getFactory(void); ALCbackendFactory *ALCsolarisBackendFactory_getFactory(void); -ALCbackendFactory *ALCmmdevBackendFactory_getFactory(void); +ALCbackendFactory *ALCsndioBackendFactory_getFactory(void); +ALCbackendFactory *ALCqsaBackendFactory_getFactory(void); +ALCbackendFactory *ALCwasapiBackendFactory_getFactory(void); ALCbackendFactory *ALCdsoundBackendFactory_getFactory(void); ALCbackendFactory *ALCwinmmBackendFactory_getFactory(void); ALCbackendFactory *ALCportBackendFactory_getFactory(void); +ALCbackendFactory *ALCopenslBackendFactory_getFactory(void); ALCbackendFactory *ALCnullBackendFactory_getFactory(void); ALCbackendFactory *ALCwaveBackendFactory_getFactory(void); +ALCbackendFactory *ALCsdl2BackendFactory_getFactory(void); ALCbackendFactory *ALCloopbackFactory_getFactory(void); -ALCbackend *create_backend_wrapper(ALCdevice *device, const BackendFuncs *funcs, ALCbackend_Type type); + +inline void ALCdevice_Lock(ALCdevice *device) +{ V0(device->Backend,lock)(); } + +inline void ALCdevice_Unlock(ALCdevice *device) +{ V0(device->Backend,unlock)(); } + +#ifdef __cplusplus +} /* extern "C" */ +#endif #endif /* AL_BACKENDS_BASE_H */ diff --git a/Engine/lib/openal-soft/Alc/backends/coreaudio.c b/Engine/lib/openal-soft/Alc/backends/coreaudio.c index 24aeabd42..a8787f7b0 100644 --- a/Engine/lib/openal-soft/Alc/backends/coreaudio.c +++ b/Engine/lib/openal-soft/Alc/backends/coreaudio.c @@ -23,128 +23,91 @@ #include #include #include -#include #include "alMain.h" #include "alu.h" +#include "ringbuffer.h" #include #include #include #include +#include "backends/base.h" -typedef struct { - AudioUnit audioUnit; - - ALuint frameSize; - ALdouble sampleRateRatio; // Ratio of hardware sample rate / requested sample rate - AudioStreamBasicDescription format; // This is the OpenAL format as a CoreAudio ASBD - - AudioConverterRef audioConverter; // Sample rate converter if needed - AudioBufferList *bufferList; // Buffer for data coming from the input device - ALCvoid *resampleBuffer; // Buffer for returned RingBuffer data when resampling - - ll_ringbuffer_t *ring; -} ca_data; static const ALCchar ca_device[] = "CoreAudio Default"; -static void destroy_buffer_list(AudioBufferList* list) +typedef struct ALCcoreAudioPlayback { + DERIVE_FROM_TYPE(ALCbackend); + + AudioUnit audioUnit; + + ALuint frameSize; + AudioStreamBasicDescription format; // This is the OpenAL format as a CoreAudio ASBD +} ALCcoreAudioPlayback; + +static void ALCcoreAudioPlayback_Construct(ALCcoreAudioPlayback *self, ALCdevice *device); +static void ALCcoreAudioPlayback_Destruct(ALCcoreAudioPlayback *self); +static ALCenum ALCcoreAudioPlayback_open(ALCcoreAudioPlayback *self, const ALCchar *name); +static ALCboolean ALCcoreAudioPlayback_reset(ALCcoreAudioPlayback *self); +static ALCboolean ALCcoreAudioPlayback_start(ALCcoreAudioPlayback *self); +static void ALCcoreAudioPlayback_stop(ALCcoreAudioPlayback *self); +static DECLARE_FORWARD2(ALCcoreAudioPlayback, ALCbackend, ALCenum, captureSamples, void*, ALCuint) +static DECLARE_FORWARD(ALCcoreAudioPlayback, ALCbackend, ALCuint, availableSamples) +static DECLARE_FORWARD(ALCcoreAudioPlayback, ALCbackend, ClockLatency, getClockLatency) +static DECLARE_FORWARD(ALCcoreAudioPlayback, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCcoreAudioPlayback, ALCbackend, void, unlock) +DECLARE_DEFAULT_ALLOCATORS(ALCcoreAudioPlayback) + +DEFINE_ALCBACKEND_VTABLE(ALCcoreAudioPlayback); + + +static void ALCcoreAudioPlayback_Construct(ALCcoreAudioPlayback *self, ALCdevice *device) { - if(list) - { - UInt32 i; - for(i = 0;i < list->mNumberBuffers;i++) - free(list->mBuffers[i].mData); - free(list); - } + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(ALCcoreAudioPlayback, ALCbackend, self); + + self->frameSize = 0; + memset(&self->format, 0, sizeof(self->format)); } -static AudioBufferList* allocate_buffer_list(UInt32 channelCount, UInt32 byteSize) +static void ALCcoreAudioPlayback_Destruct(ALCcoreAudioPlayback *self) { - AudioBufferList *list; + AudioUnitUninitialize(self->audioUnit); + AudioComponentInstanceDispose(self->audioUnit); - list = calloc(1, sizeof(AudioBufferList) + sizeof(AudioBuffer)); - if(list) - { - list->mNumberBuffers = 1; - - list->mBuffers[0].mNumberChannels = channelCount; - list->mBuffers[0].mDataByteSize = byteSize; - list->mBuffers[0].mData = malloc(byteSize); - if(list->mBuffers[0].mData == NULL) - { - free(list); - list = NULL; - } - } - return list; + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } -static OSStatus ca_callback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, const AudioTimeStamp *inTimeStamp, - UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList *ioData) -{ - ALCdevice *device = (ALCdevice*)inRefCon; - ca_data *data = (ca_data*)device->ExtraData; +static OSStatus ALCcoreAudioPlayback_MixerProc(void *inRefCon, + AudioUnitRenderActionFlags* UNUSED(ioActionFlags), const AudioTimeStamp* UNUSED(inTimeStamp), + UInt32 UNUSED(inBusNumber), UInt32 UNUSED(inNumberFrames), AudioBufferList *ioData) +{ + ALCcoreAudioPlayback *self = inRefCon; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; + + ALCcoreAudioPlayback_lock(self); aluMixData(device, ioData->mBuffers[0].mData, - ioData->mBuffers[0].mDataByteSize / data->frameSize); + ioData->mBuffers[0].mDataByteSize / self->frameSize); + ALCcoreAudioPlayback_unlock(self); return noErr; } -static OSStatus ca_capture_conversion_callback(AudioConverterRef inAudioConverter, UInt32 *ioNumberDataPackets, - AudioBufferList *ioData, AudioStreamPacketDescription **outDataPacketDescription, void* inUserData) -{ - ALCdevice *device = (ALCdevice*)inUserData; - ca_data *data = (ca_data*)device->ExtraData; - - // Read from the ring buffer and store temporarily in a large buffer - ll_ringbuffer_read(data->ring, data->resampleBuffer, *ioNumberDataPackets); - - // Set the input data - ioData->mNumberBuffers = 1; - ioData->mBuffers[0].mNumberChannels = data->format.mChannelsPerFrame; - ioData->mBuffers[0].mData = data->resampleBuffer; - ioData->mBuffers[0].mDataByteSize = (*ioNumberDataPackets) * data->format.mBytesPerFrame; - - return noErr; -} - -static OSStatus ca_capture_callback(void *inRefCon, AudioUnitRenderActionFlags *ioActionFlags, - const AudioTimeStamp *inTimeStamp, UInt32 inBusNumber, - UInt32 inNumberFrames, AudioBufferList *ioData) -{ - ALCdevice *device = (ALCdevice*)inRefCon; - ca_data *data = (ca_data*)device->ExtraData; - AudioUnitRenderActionFlags flags = 0; - OSStatus err; - - // fill the bufferList with data from the input device - err = AudioUnitRender(data->audioUnit, &flags, inTimeStamp, 1, inNumberFrames, data->bufferList); - if(err != noErr) - { - ERR("AudioUnitRender error: %d\n", err); - return err; - } - - ll_ringbuffer_write(data->ring, data->bufferList->mBuffers[0].mData, inNumberFrames); - - return noErr; -} - -static ALCenum ca_open_playback(ALCdevice *device, const ALCchar *deviceName) + +static ALCenum ALCcoreAudioPlayback_open(ALCcoreAudioPlayback *self, const ALCchar *name) { + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; AudioComponentDescription desc; AudioComponent comp; - ca_data *data; OSStatus err; - if(!deviceName) - deviceName = ca_device; - else if(strcmp(deviceName, ca_device) != 0) + if(!name) + name = ca_device; + else if(strcmp(name, ca_device) != 0) return ALC_INVALID_VALUE; /* open the default output unit */ @@ -161,57 +124,41 @@ static ALCenum ca_open_playback(ALCdevice *device, const ALCchar *deviceName) return ALC_INVALID_VALUE; } - data = calloc(1, sizeof(*data)); - - err = AudioComponentInstanceNew(comp, &data->audioUnit); + err = AudioComponentInstanceNew(comp, &self->audioUnit); if(err != noErr) { ERR("AudioComponentInstanceNew failed\n"); - free(data); return ALC_INVALID_VALUE; } /* init and start the default audio unit... */ - err = AudioUnitInitialize(data->audioUnit); + err = AudioUnitInitialize(self->audioUnit); if(err != noErr) { ERR("AudioUnitInitialize failed\n"); - AudioComponentInstanceDispose(data->audioUnit); - free(data); + AudioComponentInstanceDispose(self->audioUnit); return ALC_INVALID_VALUE; } - al_string_copy_cstr(&device->DeviceName, deviceName); - device->ExtraData = data; + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ca_close_playback(ALCdevice *device) +static ALCboolean ALCcoreAudioPlayback_reset(ALCcoreAudioPlayback *self) { - ca_data *data = (ca_data*)device->ExtraData; - - AudioUnitUninitialize(data->audioUnit); - AudioComponentInstanceDispose(data->audioUnit); - - free(data); - device->ExtraData = NULL; -} - -static ALCboolean ca_reset_playback(ALCdevice *device) -{ - ca_data *data = (ca_data*)device->ExtraData; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; AudioStreamBasicDescription streamFormat; AURenderCallbackStruct input; OSStatus err; UInt32 size; - err = AudioUnitUninitialize(data->audioUnit); + err = AudioUnitUninitialize(self->audioUnit); if(err != noErr) ERR("-- AudioUnitUninitialize failed.\n"); /* retrieve default output unit's properties (output side) */ size = sizeof(AudioStreamBasicDescription); - err = AudioUnitGetProperty(data->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &streamFormat, &size); + err = AudioUnitGetProperty(self->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 0, &streamFormat, &size); if(err != noErr || size != sizeof(AudioStreamBasicDescription)) { ERR("AudioUnitGetProperty failed\n"); @@ -229,7 +176,7 @@ static ALCboolean ca_reset_playback(ALCdevice *device) #endif /* set default output unit's input side to match output side */ - err = AudioUnitSetProperty(data->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &streamFormat, size); + err = AudioUnitSetProperty(self->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &streamFormat, size); if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); @@ -313,7 +260,7 @@ static ALCboolean ca_reset_playback(ALCdevice *device) streamFormat.mFormatFlags |= kAudioFormatFlagsNativeEndian | kLinearPCMFormatFlagIsPacked; - err = AudioUnitSetProperty(data->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &streamFormat, sizeof(AudioStreamBasicDescription)); + err = AudioUnitSetProperty(self->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &streamFormat, sizeof(AudioStreamBasicDescription)); if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); @@ -321,11 +268,11 @@ static ALCboolean ca_reset_playback(ALCdevice *device) } /* setup callback */ - data->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType); - input.inputProc = ca_callback; - input.inputProcRefCon = device; + self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); + input.inputProc = ALCcoreAudioPlayback_MixerProc; + input.inputProcRefCon = self; - err = AudioUnitSetProperty(data->audioUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &input, sizeof(AURenderCallbackStruct)); + err = AudioUnitSetProperty(self->audioUnit, kAudioUnitProperty_SetRenderCallback, kAudioUnitScope_Input, 0, &input, sizeof(AURenderCallbackStruct)); if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); @@ -333,7 +280,7 @@ static ALCboolean ca_reset_playback(ALCdevice *device) } /* init the default audio unit... */ - err = AudioUnitInitialize(data->audioUnit); + err = AudioUnitInitialize(self->audioUnit); if(err != noErr) { ERR("AudioUnitInitialize failed\n"); @@ -343,12 +290,9 @@ static ALCboolean ca_reset_playback(ALCdevice *device) return ALC_TRUE; } -static ALCboolean ca_start_playback(ALCdevice *device) +static ALCboolean ALCcoreAudioPlayback_start(ALCcoreAudioPlayback *self) { - ca_data *data = (ca_data*)device->ExtraData; - OSStatus err; - - err = AudioOutputUnitStart(data->audioUnit); + OSStatus err = AudioOutputUnitStart(self->audioUnit); if(err != noErr) { ERR("AudioOutputUnitStart failed\n"); @@ -358,18 +302,150 @@ static ALCboolean ca_start_playback(ALCdevice *device) return ALC_TRUE; } -static void ca_stop_playback(ALCdevice *device) +static void ALCcoreAudioPlayback_stop(ALCcoreAudioPlayback *self) { - ca_data *data = (ca_data*)device->ExtraData; - OSStatus err; - - err = AudioOutputUnitStop(data->audioUnit); + OSStatus err = AudioOutputUnitStop(self->audioUnit); if(err != noErr) ERR("AudioOutputUnitStop failed\n"); } -static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) + + + +typedef struct ALCcoreAudioCapture { + DERIVE_FROM_TYPE(ALCbackend); + + AudioUnit audioUnit; + + ALuint frameSize; + ALdouble sampleRateRatio; // Ratio of hardware sample rate / requested sample rate + AudioStreamBasicDescription format; // This is the OpenAL format as a CoreAudio ASBD + + AudioConverterRef audioConverter; // Sample rate converter if needed + AudioBufferList *bufferList; // Buffer for data coming from the input device + ALCvoid *resampleBuffer; // Buffer for returned RingBuffer data when resampling + + ll_ringbuffer_t *ring; +} ALCcoreAudioCapture; + +static void ALCcoreAudioCapture_Construct(ALCcoreAudioCapture *self, ALCdevice *device); +static void ALCcoreAudioCapture_Destruct(ALCcoreAudioCapture *self); +static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar *name); +static DECLARE_FORWARD(ALCcoreAudioCapture, ALCbackend, ALCboolean, reset) +static ALCboolean ALCcoreAudioCapture_start(ALCcoreAudioCapture *self); +static void ALCcoreAudioCapture_stop(ALCcoreAudioCapture *self); +static ALCenum ALCcoreAudioCapture_captureSamples(ALCcoreAudioCapture *self, ALCvoid *buffer, ALCuint samples); +static ALCuint ALCcoreAudioCapture_availableSamples(ALCcoreAudioCapture *self); +static DECLARE_FORWARD(ALCcoreAudioCapture, ALCbackend, ClockLatency, getClockLatency) +static DECLARE_FORWARD(ALCcoreAudioCapture, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCcoreAudioCapture, ALCbackend, void, unlock) +DECLARE_DEFAULT_ALLOCATORS(ALCcoreAudioCapture) + +DEFINE_ALCBACKEND_VTABLE(ALCcoreAudioCapture); + + +static AudioBufferList *allocate_buffer_list(UInt32 channelCount, UInt32 byteSize) { + AudioBufferList *list; + + list = calloc(1, FAM_SIZE(AudioBufferList, mBuffers, 1) + byteSize); + if(list) + { + list->mNumberBuffers = 1; + + list->mBuffers[0].mNumberChannels = channelCount; + list->mBuffers[0].mDataByteSize = byteSize; + list->mBuffers[0].mData = &list->mBuffers[1]; + } + return list; +} + +static void destroy_buffer_list(AudioBufferList *list) +{ + free(list); +} + + +static void ALCcoreAudioCapture_Construct(ALCcoreAudioCapture *self, ALCdevice *device) +{ + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(ALCcoreAudioCapture, ALCbackend, self); + + self->audioUnit = 0; + self->audioConverter = NULL; + self->bufferList = NULL; + self->resampleBuffer = NULL; + self->ring = NULL; +} + +static void ALCcoreAudioCapture_Destruct(ALCcoreAudioCapture *self) +{ + ll_ringbuffer_free(self->ring); + self->ring = NULL; + + free(self->resampleBuffer); + self->resampleBuffer = NULL; + + destroy_buffer_list(self->bufferList); + self->bufferList = NULL; + + if(self->audioConverter) + AudioConverterDispose(self->audioConverter); + self->audioConverter = NULL; + + if(self->audioUnit) + AudioComponentInstanceDispose(self->audioUnit); + self->audioUnit = 0; + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); +} + + +static OSStatus ALCcoreAudioCapture_RecordProc(void *inRefCon, + AudioUnitRenderActionFlags* UNUSED(ioActionFlags), + const AudioTimeStamp *inTimeStamp, UInt32 UNUSED(inBusNumber), + UInt32 inNumberFrames, AudioBufferList* UNUSED(ioData)) +{ + ALCcoreAudioCapture *self = inRefCon; + AudioUnitRenderActionFlags flags = 0; + OSStatus err; + + // fill the bufferList with data from the input device + err = AudioUnitRender(self->audioUnit, &flags, inTimeStamp, 1, inNumberFrames, self->bufferList); + if(err != noErr) + { + ERR("AudioUnitRender error: %d\n", err); + return err; + } + + ll_ringbuffer_write(self->ring, self->bufferList->mBuffers[0].mData, inNumberFrames); + + return noErr; +} + +static OSStatus ALCcoreAudioCapture_ConvertCallback(AudioConverterRef UNUSED(inAudioConverter), + UInt32 *ioNumberDataPackets, AudioBufferList *ioData, + AudioStreamPacketDescription** UNUSED(outDataPacketDescription), + void *inUserData) +{ + ALCcoreAudioCapture *self = inUserData; + + // Read from the ring buffer and store temporarily in a large buffer + ll_ringbuffer_read(self->ring, self->resampleBuffer, *ioNumberDataPackets); + + // Set the input data + ioData->mNumberBuffers = 1; + ioData->mBuffers[0].mNumberChannels = self->format.mChannelsPerFrame; + ioData->mBuffers[0].mData = self->resampleBuffer; + ioData->mBuffers[0].mDataByteSize = (*ioNumberDataPackets) * self->format.mBytesPerFrame; + + return noErr; +} + + +static ALCenum ALCcoreAudioCapture_open(ALCcoreAudioCapture *self, const ALCchar *name) +{ + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; AudioStreamBasicDescription requestedFormat; // The application requested format AudioStreamBasicDescription hardwareFormat; // The hardware format AudioStreamBasicDescription outputFormat; // The AudioUnit output format @@ -381,12 +457,11 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) AudioObjectPropertyAddress propertyAddress; UInt32 enableIO; AudioComponent comp; - ca_data *data; OSStatus err; - if(!deviceName) - deviceName = ca_device; - else if(strcmp(deviceName, ca_device) != 0) + if(!name) + name = ca_device; + else if(strcmp(name, ca_device) != 0) return ALC_INVALID_VALUE; desc.componentType = kAudioUnitType_Output; @@ -403,11 +478,8 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) return ALC_INVALID_VALUE; } - data = calloc(1, sizeof(*data)); - device->ExtraData = data; - // Open the component - err = AudioComponentInstanceNew(comp, &data->audioUnit); + err = AudioComponentInstanceNew(comp, &self->audioUnit); if(err != noErr) { ERR("AudioComponentInstanceNew failed\n"); @@ -416,7 +488,7 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) // Turn off AudioUnit output enableIO = 0; - err = AudioUnitSetProperty(data->audioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output, 0, &enableIO, sizeof(ALuint)); + err = AudioUnitSetProperty(self->audioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Output, 0, &enableIO, sizeof(ALuint)); if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); @@ -425,7 +497,7 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) // Turn on AudioUnit input enableIO = 1; - err = AudioUnitSetProperty(data->audioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, 1, &enableIO, sizeof(ALuint)); + err = AudioUnitSetProperty(self->audioUnit, kAudioOutputUnitProperty_EnableIO, kAudioUnitScope_Input, 1, &enableIO, sizeof(ALuint)); if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); @@ -453,7 +525,7 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) } // Track the input device - err = AudioUnitSetProperty(data->audioUnit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &inputDevice, sizeof(AudioDeviceID)); + err = AudioUnitSetProperty(self->audioUnit, kAudioOutputUnitProperty_CurrentDevice, kAudioUnitScope_Global, 0, &inputDevice, sizeof(AudioDeviceID)); if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); @@ -461,10 +533,10 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) } // set capture callback - input.inputProc = ca_capture_callback; - input.inputProcRefCon = device; + input.inputProc = ALCcoreAudioCapture_RecordProc; + input.inputProcRefCon = self; - err = AudioUnitSetProperty(data->audioUnit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, 0, &input, sizeof(AURenderCallbackStruct)); + err = AudioUnitSetProperty(self->audioUnit, kAudioOutputUnitProperty_SetInputCallback, kAudioUnitScope_Global, 0, &input, sizeof(AURenderCallbackStruct)); if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); @@ -472,7 +544,7 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) } // Initialize the device - err = AudioUnitInitialize(data->audioUnit); + err = AudioUnitInitialize(self->audioUnit); if(err != noErr) { ERR("AudioUnitInitialize failed\n"); @@ -481,7 +553,7 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) // Get the hardware format propertySize = sizeof(AudioStreamBasicDescription); - err = AudioUnitGetProperty(data->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 1, &hardwareFormat, &propertySize); + err = AudioUnitGetProperty(self->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 1, &hardwareFormat, &propertySize); if(err != noErr || propertySize != sizeof(AudioStreamBasicDescription)) { ERR("AudioUnitGetProperty failed\n"); @@ -528,9 +600,7 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) case DevFmtX51Rear: case DevFmtX61: case DevFmtX71: - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: ERR("%s not supported\n", DevFmtChannelsString(device->FmtChans)); goto error; } @@ -543,8 +613,8 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) requestedFormat.mFramesPerPacket = 1; // save requested format description for later use - data->format = requestedFormat; - data->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + self->format = requestedFormat; + self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); // Use intermediate format for sample rate conversion (outputFormat) // Set sample rate to the same as hardware for resampling later @@ -552,11 +622,11 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) outputFormat.mSampleRate = hardwareFormat.mSampleRate; // Determine sample rate ratio for resampling - data->sampleRateRatio = outputFormat.mSampleRate / device->Frequency; + self->sampleRateRatio = outputFormat.mSampleRate / device->Frequency; // The output format should be the requested format, but using the hardware sample rate // This is because the AudioUnit will automatically scale other properties, except for sample rate - err = AudioUnitSetProperty(data->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, (void *)&outputFormat, sizeof(outputFormat)); + err = AudioUnitSetProperty(self->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Output, 1, (void *)&outputFormat, sizeof(outputFormat)); if(err != noErr) { ERR("AudioUnitSetProperty failed\n"); @@ -564,8 +634,8 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) } // Set the AudioUnit output format frame count - outputFrameCount = device->UpdateSize * data->sampleRateRatio; - err = AudioUnitSetProperty(data->audioUnit, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Output, 0, &outputFrameCount, sizeof(outputFrameCount)); + outputFrameCount = device->UpdateSize * self->sampleRateRatio; + err = AudioUnitSetProperty(self->audioUnit, kAudioUnitProperty_MaximumFramesPerSlice, kAudioUnitScope_Output, 0, &outputFrameCount, sizeof(outputFrameCount)); if(err != noErr) { ERR("AudioUnitSetProperty failed: %d\n", err); @@ -573,7 +643,7 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) } // Set up sample converter - err = AudioConverterNew(&outputFormat, &requestedFormat, &data->audioConverter); + err = AudioConverterNew(&outputFormat, &requestedFormat, &self->audioConverter); if(err != noErr) { ERR("AudioConverterNew failed: %d\n", err); @@ -581,96 +651,83 @@ static ALCenum ca_open_capture(ALCdevice *device, const ALCchar *deviceName) } // Create a buffer for use in the resample callback - data->resampleBuffer = malloc(device->UpdateSize * data->frameSize * data->sampleRateRatio); + self->resampleBuffer = malloc(device->UpdateSize * self->frameSize * self->sampleRateRatio); // Allocate buffer for the AudioUnit output - data->bufferList = allocate_buffer_list(outputFormat.mChannelsPerFrame, device->UpdateSize * data->frameSize * data->sampleRateRatio); - if(data->bufferList == NULL) + self->bufferList = allocate_buffer_list(outputFormat.mChannelsPerFrame, device->UpdateSize * self->frameSize * self->sampleRateRatio); + if(self->bufferList == NULL) goto error; - data->ring = ll_ringbuffer_create( - device->UpdateSize*data->sampleRateRatio*device->NumUpdates + 1, - data->frameSize + self->ring = ll_ringbuffer_create( + (size_t)ceil(device->UpdateSize*self->sampleRateRatio*device->NumUpdates), + self->frameSize, false ); - if(!data->ring) goto error; + if(!self->ring) goto error; - al_string_copy_cstr(&device->DeviceName, deviceName); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; error: - ll_ringbuffer_free(data->ring); - data->ring = NULL; - free(data->resampleBuffer); - destroy_buffer_list(data->bufferList); + ll_ringbuffer_free(self->ring); + self->ring = NULL; + free(self->resampleBuffer); + self->resampleBuffer = NULL; + destroy_buffer_list(self->bufferList); + self->bufferList = NULL; - if(data->audioConverter) - AudioConverterDispose(data->audioConverter); - if(data->audioUnit) - AudioComponentInstanceDispose(data->audioUnit); - - free(data); - device->ExtraData = NULL; + if(self->audioConverter) + AudioConverterDispose(self->audioConverter); + self->audioConverter = NULL; + if(self->audioUnit) + AudioComponentInstanceDispose(self->audioUnit); + self->audioUnit = 0; return ALC_INVALID_VALUE; } -static void ca_close_capture(ALCdevice *device) + +static ALCboolean ALCcoreAudioCapture_start(ALCcoreAudioCapture *self) { - ca_data *data = (ca_data*)device->ExtraData; - - ll_ringbuffer_free(data->ring); - data->ring = NULL; - free(data->resampleBuffer); - destroy_buffer_list(data->bufferList); - - AudioConverterDispose(data->audioConverter); - AudioComponentInstanceDispose(data->audioUnit); - - free(data); - device->ExtraData = NULL; -} - -static void ca_start_capture(ALCdevice *device) -{ - ca_data *data = (ca_data*)device->ExtraData; - OSStatus err = AudioOutputUnitStart(data->audioUnit); + OSStatus err = AudioOutputUnitStart(self->audioUnit); if(err != noErr) + { ERR("AudioOutputUnitStart failed\n"); + return ALC_FALSE; + } + return ALC_TRUE; } -static void ca_stop_capture(ALCdevice *device) +static void ALCcoreAudioCapture_stop(ALCcoreAudioCapture *self) { - ca_data *data = (ca_data*)device->ExtraData; - OSStatus err = AudioOutputUnitStop(data->audioUnit); + OSStatus err = AudioOutputUnitStop(self->audioUnit); if(err != noErr) ERR("AudioOutputUnitStop failed\n"); } -static ALCenum ca_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint samples) +static ALCenum ALCcoreAudioCapture_captureSamples(ALCcoreAudioCapture *self, ALCvoid *buffer, ALCuint samples) { - ca_data *data = (ca_data*)device->ExtraData; - AudioBufferList *list; + union { + ALbyte _[sizeof(AudioBufferList) + sizeof(AudioBuffer)]; + AudioBufferList list; + } audiobuf = { { 0 } }; UInt32 frameCount; OSStatus err; // If no samples are requested, just return - if(samples == 0) - return ALC_NO_ERROR; - - // Allocate a temporary AudioBufferList to use as the return resamples data - list = alloca(sizeof(AudioBufferList) + sizeof(AudioBuffer)); + if(samples == 0) return ALC_NO_ERROR; // Point the resampling buffer to the capture buffer - list->mNumberBuffers = 1; - list->mBuffers[0].mNumberChannels = data->format.mChannelsPerFrame; - list->mBuffers[0].mDataByteSize = samples * data->frameSize; - list->mBuffers[0].mData = buffer; + audiobuf.list.mNumberBuffers = 1; + audiobuf.list.mBuffers[0].mNumberChannels = self->format.mChannelsPerFrame; + audiobuf.list.mBuffers[0].mDataByteSize = samples * self->frameSize; + audiobuf.list.mBuffers[0].mData = buffer; // Resample into another AudioBufferList frameCount = samples; - err = AudioConverterFillComplexBuffer(data->audioConverter, ca_capture_conversion_callback, - device, &frameCount, list, NULL); + err = AudioConverterFillComplexBuffer(self->audioConverter, + ALCcoreAudioCapture_ConvertCallback, self, &frameCount, &audiobuf.list, NULL + ); if(err != noErr) { ERR("AudioConverterFillComplexBuffer error: %d\n", err); @@ -679,38 +736,47 @@ static ALCenum ca_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint sa return ALC_NO_ERROR; } -static ALCuint ca_available_samples(ALCdevice *device) +static ALCuint ALCcoreAudioCapture_availableSamples(ALCcoreAudioCapture *self) { - ca_data *data = device->ExtraData; - return ll_ringbuffer_read_space(data->ring) / data->sampleRateRatio; + return ll_ringbuffer_read_space(self->ring) / self->sampleRateRatio; } -static const BackendFuncs ca_funcs = { - ca_open_playback, - ca_close_playback, - ca_reset_playback, - ca_start_playback, - ca_stop_playback, - ca_open_capture, - ca_close_capture, - ca_start_capture, - ca_stop_capture, - ca_capture_samples, - ca_available_samples -}; +typedef struct ALCcoreAudioBackendFactory { + DERIVE_FROM_TYPE(ALCbackendFactory); +} ALCcoreAudioBackendFactory; +#define ALCCOREAUDIOBACKENDFACTORY_INITIALIZER { { GET_VTABLE2(ALCcoreAudioBackendFactory, ALCbackendFactory) } } -ALCboolean alc_ca_init(BackendFuncs *func_list) +ALCbackendFactory *ALCcoreAudioBackendFactory_getFactory(void); + +static ALCboolean ALCcoreAudioBackendFactory_init(ALCcoreAudioBackendFactory *self); +static DECLARE_FORWARD(ALCcoreAudioBackendFactory, ALCbackendFactory, void, deinit) +static ALCboolean ALCcoreAudioBackendFactory_querySupport(ALCcoreAudioBackendFactory *self, ALCbackend_Type type); +static void ALCcoreAudioBackendFactory_probe(ALCcoreAudioBackendFactory *self, enum DevProbe type); +static ALCbackend* ALCcoreAudioBackendFactory_createBackend(ALCcoreAudioBackendFactory *self, ALCdevice *device, ALCbackend_Type type); +DEFINE_ALCBACKENDFACTORY_VTABLE(ALCcoreAudioBackendFactory); + + +ALCbackendFactory *ALCcoreAudioBackendFactory_getFactory(void) +{ + static ALCcoreAudioBackendFactory factory = ALCCOREAUDIOBACKENDFACTORY_INITIALIZER; + return STATIC_CAST(ALCbackendFactory, &factory); +} + + +static ALCboolean ALCcoreAudioBackendFactory_init(ALCcoreAudioBackendFactory* UNUSED(self)) { - *func_list = ca_funcs; return ALC_TRUE; } -void alc_ca_deinit(void) +static ALCboolean ALCcoreAudioBackendFactory_querySupport(ALCcoreAudioBackendFactory* UNUSED(self), ALCbackend_Type type) { + if(type == ALCbackend_Playback || ALCbackend_Capture) + return ALC_TRUE; + return ALC_FALSE; } -void alc_ca_probe(enum DevProbe type) +static void ALCcoreAudioBackendFactory_probe(ALCcoreAudioBackendFactory* UNUSED(self), enum DevProbe type) { switch(type) { @@ -722,3 +788,23 @@ void alc_ca_probe(enum DevProbe type) break; } } + +static ALCbackend* ALCcoreAudioBackendFactory_createBackend(ALCcoreAudioBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type) +{ + if(type == ALCbackend_Playback) + { + ALCcoreAudioPlayback *backend; + NEW_OBJ(backend, ALCcoreAudioPlayback)(device); + if(!backend) return NULL; + return STATIC_CAST(ALCbackend, backend); + } + if(type == ALCbackend_Capture) + { + ALCcoreAudioCapture *backend; + NEW_OBJ(backend, ALCcoreAudioCapture)(device); + if(!backend) return NULL; + return STATIC_CAST(ALCbackend, backend); + } + + return NULL; +} diff --git a/Engine/lib/openal-soft/Alc/backends/dsound.c b/Engine/lib/openal-soft/Alc/backends/dsound.c index bb38d516b..6bab641c7 100644 --- a/Engine/lib/openal-soft/Alc/backends/dsound.c +++ b/Engine/lib/openal-soft/Alc/backends/dsound.c @@ -34,6 +34,7 @@ #include "alMain.h" #include "alu.h" +#include "ringbuffer.h" #include "threads.h" #include "compat.h" #include "alstring.h" @@ -145,16 +146,16 @@ static BOOL CALLBACK DSoundEnumDevices(GUID *guid, const WCHAR *desc, const WCHA { const DevMap *iter; - al_string_copy_cstr(&entry.name, DEVNAME_HEAD); - al_string_append_wcstr(&entry.name, desc); + alstr_copy_cstr(&entry.name, DEVNAME_HEAD); + alstr_append_wcstr(&entry.name, desc); if(count != 0) { char str[64]; snprintf(str, sizeof(str), " #%d", count+1); - al_string_append_cstr(&entry.name, str); + alstr_append_cstr(&entry.name, str); } -#define MATCH_ENTRY(i) (al_string_cmp(entry.name, (i)->name) == 0) +#define MATCH_ENTRY(i) (alstr_cmp(entry.name, (i)->name) == 0) VECTOR_FIND_IF(iter, const DevMap, *devices, MATCH_ENTRY); if(iter == VECTOR_END(*devices)) break; #undef MATCH_ENTRY @@ -165,7 +166,7 @@ static BOOL CALLBACK DSoundEnumDevices(GUID *guid, const WCHAR *desc, const WCHA hr = StringFromCLSID(guid, &guidstr); if(SUCCEEDED(hr)) { - TRACE("Got device \"%s\", GUID \"%ls\"\n", al_string_get_cstr(entry.name), guidstr); + TRACE("Got device \"%s\", GUID \"%ls\"\n", alstr_get_cstr(entry.name), guidstr); CoTaskMemFree(guidstr); } @@ -184,16 +185,15 @@ typedef struct ALCdsoundPlayback { IDirectSoundNotify *Notifies; HANDLE NotifyEvent; - volatile int killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCdsoundPlayback; static int ALCdsoundPlayback_mixerProc(void *ptr); static void ALCdsoundPlayback_Construct(ALCdsoundPlayback *self, ALCdevice *device); -static DECLARE_FORWARD(ALCdsoundPlayback, ALCbackend, void, Destruct) +static void ALCdsoundPlayback_Destruct(ALCdsoundPlayback *self); static ALCenum ALCdsoundPlayback_open(ALCdsoundPlayback *self, const ALCchar *name); -static void ALCdsoundPlayback_close(ALCdsoundPlayback *self); static ALCboolean ALCdsoundPlayback_reset(ALCdsoundPlayback *self); static ALCboolean ALCdsoundPlayback_start(ALCdsoundPlayback *self); static void ALCdsoundPlayback_stop(ALCdsoundPlayback *self); @@ -211,6 +211,35 @@ static void ALCdsoundPlayback_Construct(ALCdsoundPlayback *self, ALCdevice *devi { ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCdsoundPlayback, ALCbackend, self); + + self->DS = NULL; + self->PrimaryBuffer = NULL; + self->Buffer = NULL; + self->Notifies = NULL; + self->NotifyEvent = NULL; + ATOMIC_INIT(&self->killNow, AL_TRUE); +} + +static void ALCdsoundPlayback_Destruct(ALCdsoundPlayback *self) +{ + if(self->Notifies) + IDirectSoundNotify_Release(self->Notifies); + self->Notifies = NULL; + if(self->Buffer) + IDirectSoundBuffer_Release(self->Buffer); + self->Buffer = NULL; + if(self->PrimaryBuffer != NULL) + IDirectSoundBuffer_Release(self->PrimaryBuffer); + self->PrimaryBuffer = NULL; + + if(self->DS) + IDirectSound_Release(self->DS); + self->DS = NULL; + if(self->NotifyEvent) + CloseHandle(self->NotifyEvent); + self->NotifyEvent = NULL; + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } @@ -239,16 +268,17 @@ FORCE_ALIGN static int ALCdsoundPlayback_mixerProc(void *ptr) { ERR("Failed to get buffer caps: 0x%lx\n", err); ALCdevice_Lock(device); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failure retrieving playback buffer info: 0x%lx", err); ALCdevice_Unlock(device); return 1; } - FrameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + FrameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); FragSize = device->UpdateSize * FrameSize; IDirectSoundBuffer_GetCurrentPosition(self->Buffer, &LastCursor, NULL); - while(!self->killNow) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) && + ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) { // Get current play cursor IDirectSoundBuffer_GetCurrentPosition(self->Buffer, &PlayCursor, NULL); @@ -263,7 +293,7 @@ FORCE_ALIGN static int ALCdsoundPlayback_mixerProc(void *ptr) { ERR("Failed to play buffer: 0x%lx\n", err); ALCdevice_Lock(device); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failure starting playback: 0x%lx", err); ALCdevice_Unlock(device); return 1; } @@ -299,8 +329,10 @@ FORCE_ALIGN static int ALCdsoundPlayback_mixerProc(void *ptr) if(SUCCEEDED(err)) { // If we have an active context, mix data directly into output buffer otherwise fill with silence + ALCdevice_Lock(device); aluMixData(device, WritePtr1, WriteCnt1/FrameSize); aluMixData(device, WritePtr2, WriteCnt2/FrameSize); + ALCdevice_Unlock(device); // Unlock output buffer only when successfully locked IDirectSoundBuffer_Unlock(self->Buffer, WritePtr1, WriteCnt1, WritePtr2, WriteCnt2); @@ -309,7 +341,7 @@ FORCE_ALIGN static int ALCdsoundPlayback_mixerProc(void *ptr) { ERR("Buffer lock error: %#lx\n", err); ALCdevice_Lock(device); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed to lock output buffer: 0x%lx", err); ALCdevice_Unlock(device); return 1; } @@ -341,14 +373,14 @@ static ALCenum ALCdsoundPlayback_open(ALCdsoundPlayback *self, const ALCchar *de if(!deviceName && VECTOR_SIZE(PlaybackDevices) > 0) { - deviceName = al_string_get_cstr(VECTOR_FRONT(PlaybackDevices).name); + deviceName = alstr_get_cstr(VECTOR_FRONT(PlaybackDevices).name); guid = &VECTOR_FRONT(PlaybackDevices).guid; } else { const DevMap *iter; -#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, deviceName) == 0) +#define MATCH_NAME(i) (alstr_cmp_cstr((i)->name, deviceName) == 0) VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_NAME); #undef MATCH_NAME if(iter == VECTOR_END(PlaybackDevices)) @@ -379,29 +411,11 @@ static ALCenum ALCdsoundPlayback_open(ALCdsoundPlayback *self, const ALCchar *de return ALC_INVALID_VALUE; } - al_string_copy_cstr(&device->DeviceName, deviceName); + alstr_copy_cstr(&device->DeviceName, deviceName); return ALC_NO_ERROR; } -static void ALCdsoundPlayback_close(ALCdsoundPlayback *self) -{ - if(self->Notifies) - IDirectSoundNotify_Release(self->Notifies); - self->Notifies = NULL; - if(self->Buffer) - IDirectSoundBuffer_Release(self->Buffer); - self->Buffer = NULL; - if(self->PrimaryBuffer != NULL) - IDirectSoundBuffer_Release(self->PrimaryBuffer); - self->PrimaryBuffer = NULL; - - IDirectSound_Release(self->DS); - self->DS = NULL; - CloseHandle(self->NotifyEvent); - self->NotifyEvent = NULL; -} - static ALCboolean ALCdsoundPlayback_reset(ALCdsoundPlayback *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; @@ -472,9 +486,7 @@ static ALCboolean ALCdsoundPlayback_reset(ALCdsoundPlayback *self) case DevFmtMono: OutputType.dwChannelMask = SPEAKER_FRONT_CENTER; break; - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: device->FmtChans = DevFmtStereo; /*fall-through*/ case DevFmtStereo: @@ -527,7 +539,7 @@ static ALCboolean ALCdsoundPlayback_reset(ALCdsoundPlayback *self) retry_open: hr = S_OK; OutputType.Format.wFormatTag = WAVE_FORMAT_PCM; - OutputType.Format.nChannels = ChannelsFromDevFmt(device->FmtChans); + OutputType.Format.nChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); OutputType.Format.wBitsPerSample = BytesFromDevFmt(device->FmtType) * 8; OutputType.Format.nBlockAlign = OutputType.Format.nChannels*OutputType.Format.wBitsPerSample/8; OutputType.Format.nSamplesPerSec = device->Frequency; @@ -626,7 +638,7 @@ retry_open: static ALCboolean ALCdsoundPlayback_start(ALCdsoundPlayback *self) { - self->killNow = 0; + ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); if(althrd_create(&self->thread, ALCdsoundPlayback_mixerProc, self) != althrd_success) return ALC_FALSE; @@ -637,10 +649,8 @@ static void ALCdsoundPlayback_stop(ALCdsoundPlayback *self) { int res; - if(self->killNow) + if(ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) return; - - self->killNow = 1; althrd_join(self->thread, &res); IDirectSoundBuffer_Stop(self->Buffer); @@ -660,9 +670,8 @@ typedef struct ALCdsoundCapture { } ALCdsoundCapture; static void ALCdsoundCapture_Construct(ALCdsoundCapture *self, ALCdevice *device); -static DECLARE_FORWARD(ALCdsoundCapture, ALCbackend, void, Destruct) +static void ALCdsoundCapture_Destruct(ALCdsoundCapture *self); static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *name); -static void ALCdsoundCapture_close(ALCdsoundCapture *self); static DECLARE_FORWARD(ALCdsoundCapture, ALCbackend, ALCboolean, reset) static ALCboolean ALCdsoundCapture_start(ALCdsoundCapture *self); static void ALCdsoundCapture_stop(ALCdsoundCapture *self); @@ -679,6 +688,29 @@ static void ALCdsoundCapture_Construct(ALCdsoundCapture *self, ALCdevice *device { ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCdsoundCapture, ALCbackend, self); + + self->DSC = NULL; + self->DSCbuffer = NULL; + self->Ring = NULL; +} + +static void ALCdsoundCapture_Destruct(ALCdsoundCapture *self) +{ + ll_ringbuffer_free(self->Ring); + self->Ring = NULL; + + if(self->DSCbuffer != NULL) + { + IDirectSoundCaptureBuffer_Stop(self->DSCbuffer); + IDirectSoundCaptureBuffer_Release(self->DSCbuffer); + self->DSCbuffer = NULL; + } + + if(self->DSC) + IDirectSoundCapture_Release(self->DSC); + self->DSC = NULL; + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } @@ -704,14 +736,14 @@ static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *devi if(!deviceName && VECTOR_SIZE(CaptureDevices) > 0) { - deviceName = al_string_get_cstr(VECTOR_FRONT(CaptureDevices).name); + deviceName = alstr_get_cstr(VECTOR_FRONT(CaptureDevices).name); guid = &VECTOR_FRONT(CaptureDevices).guid; } else { const DevMap *iter; -#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, deviceName) == 0) +#define MATCH_NAME(i) (alstr_cmp_cstr((i)->name, deviceName) == 0) VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_NAME); #undef MATCH_NAME if(iter == VECTOR_END(CaptureDevices)) @@ -734,102 +766,98 @@ static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *devi break; } + memset(&InputType, 0, sizeof(InputType)); + switch(device->FmtChans) + { + case DevFmtMono: + InputType.dwChannelMask = SPEAKER_FRONT_CENTER; + break; + case DevFmtStereo: + InputType.dwChannelMask = SPEAKER_FRONT_LEFT | + SPEAKER_FRONT_RIGHT; + break; + case DevFmtQuad: + InputType.dwChannelMask = SPEAKER_FRONT_LEFT | + SPEAKER_FRONT_RIGHT | + SPEAKER_BACK_LEFT | + SPEAKER_BACK_RIGHT; + break; + case DevFmtX51: + InputType.dwChannelMask = SPEAKER_FRONT_LEFT | + SPEAKER_FRONT_RIGHT | + SPEAKER_FRONT_CENTER | + SPEAKER_LOW_FREQUENCY | + SPEAKER_SIDE_LEFT | + SPEAKER_SIDE_RIGHT; + break; + case DevFmtX51Rear: + InputType.dwChannelMask = SPEAKER_FRONT_LEFT | + SPEAKER_FRONT_RIGHT | + SPEAKER_FRONT_CENTER | + SPEAKER_LOW_FREQUENCY | + SPEAKER_BACK_LEFT | + SPEAKER_BACK_RIGHT; + break; + case DevFmtX61: + InputType.dwChannelMask = SPEAKER_FRONT_LEFT | + SPEAKER_FRONT_RIGHT | + SPEAKER_FRONT_CENTER | + SPEAKER_LOW_FREQUENCY | + SPEAKER_BACK_CENTER | + SPEAKER_SIDE_LEFT | + SPEAKER_SIDE_RIGHT; + break; + case DevFmtX71: + InputType.dwChannelMask = SPEAKER_FRONT_LEFT | + SPEAKER_FRONT_RIGHT | + SPEAKER_FRONT_CENTER | + SPEAKER_LOW_FREQUENCY | + SPEAKER_BACK_LEFT | + SPEAKER_BACK_RIGHT | + SPEAKER_SIDE_LEFT | + SPEAKER_SIDE_RIGHT; + break; + case DevFmtAmbi3D: + WARN("%s capture not supported\n", DevFmtChannelsString(device->FmtChans)); + return ALC_INVALID_ENUM; + } + + InputType.Format.wFormatTag = WAVE_FORMAT_PCM; + InputType.Format.nChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); + InputType.Format.wBitsPerSample = BytesFromDevFmt(device->FmtType) * 8; + InputType.Format.nBlockAlign = InputType.Format.nChannels*InputType.Format.wBitsPerSample/8; + InputType.Format.nSamplesPerSec = device->Frequency; + InputType.Format.nAvgBytesPerSec = InputType.Format.nSamplesPerSec*InputType.Format.nBlockAlign; + InputType.Format.cbSize = 0; + InputType.Samples.wValidBitsPerSample = InputType.Format.wBitsPerSample; + if(device->FmtType == DevFmtFloat) + InputType.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; + else + InputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; + + if(InputType.Format.nChannels > 2 || device->FmtType == DevFmtFloat) + { + InputType.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; + InputType.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); + } + + samples = device->UpdateSize * device->NumUpdates; + samples = maxu(samples, 100 * device->Frequency / 1000); + + memset(&DSCBDescription, 0, sizeof(DSCBUFFERDESC)); + DSCBDescription.dwSize = sizeof(DSCBUFFERDESC); + DSCBDescription.dwFlags = 0; + DSCBDescription.dwBufferBytes = samples * InputType.Format.nBlockAlign; + DSCBDescription.lpwfxFormat = &InputType.Format; + //DirectSoundCapture Init code hr = DirectSoundCaptureCreate(guid, &self->DSC, NULL); if(SUCCEEDED(hr)) - { - memset(&InputType, 0, sizeof(InputType)); - - switch(device->FmtChans) - { - case DevFmtMono: - InputType.dwChannelMask = SPEAKER_FRONT_CENTER; - break; - case DevFmtStereo: - InputType.dwChannelMask = SPEAKER_FRONT_LEFT | - SPEAKER_FRONT_RIGHT; - break; - case DevFmtQuad: - InputType.dwChannelMask = SPEAKER_FRONT_LEFT | - SPEAKER_FRONT_RIGHT | - SPEAKER_BACK_LEFT | - SPEAKER_BACK_RIGHT; - break; - case DevFmtX51: - InputType.dwChannelMask = SPEAKER_FRONT_LEFT | - SPEAKER_FRONT_RIGHT | - SPEAKER_FRONT_CENTER | - SPEAKER_LOW_FREQUENCY | - SPEAKER_SIDE_LEFT | - SPEAKER_SIDE_RIGHT; - break; - case DevFmtX51Rear: - InputType.dwChannelMask = SPEAKER_FRONT_LEFT | - SPEAKER_FRONT_RIGHT | - SPEAKER_FRONT_CENTER | - SPEAKER_LOW_FREQUENCY | - SPEAKER_BACK_LEFT | - SPEAKER_BACK_RIGHT; - break; - case DevFmtX61: - InputType.dwChannelMask = SPEAKER_FRONT_LEFT | - SPEAKER_FRONT_RIGHT | - SPEAKER_FRONT_CENTER | - SPEAKER_LOW_FREQUENCY | - SPEAKER_BACK_CENTER | - SPEAKER_SIDE_LEFT | - SPEAKER_SIDE_RIGHT; - break; - case DevFmtX71: - InputType.dwChannelMask = SPEAKER_FRONT_LEFT | - SPEAKER_FRONT_RIGHT | - SPEAKER_FRONT_CENTER | - SPEAKER_LOW_FREQUENCY | - SPEAKER_BACK_LEFT | - SPEAKER_BACK_RIGHT | - SPEAKER_SIDE_LEFT | - SPEAKER_SIDE_RIGHT; - break; - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: - break; - } - - InputType.Format.wFormatTag = WAVE_FORMAT_PCM; - InputType.Format.nChannels = ChannelsFromDevFmt(device->FmtChans); - InputType.Format.wBitsPerSample = BytesFromDevFmt(device->FmtType) * 8; - InputType.Format.nBlockAlign = InputType.Format.nChannels*InputType.Format.wBitsPerSample/8; - InputType.Format.nSamplesPerSec = device->Frequency; - InputType.Format.nAvgBytesPerSec = InputType.Format.nSamplesPerSec*InputType.Format.nBlockAlign; - InputType.Format.cbSize = 0; - - if(InputType.Format.nChannels > 2 || device->FmtType == DevFmtFloat) - { - InputType.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; - InputType.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); - InputType.Samples.wValidBitsPerSample = InputType.Format.wBitsPerSample; - if(device->FmtType == DevFmtFloat) - InputType.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; - else - InputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; - } - - samples = device->UpdateSize * device->NumUpdates; - samples = maxu(samples, 100 * device->Frequency / 1000); - - memset(&DSCBDescription, 0, sizeof(DSCBUFFERDESC)); - DSCBDescription.dwSize = sizeof(DSCBUFFERDESC); - DSCBDescription.dwFlags = 0; - DSCBDescription.dwBufferBytes = samples * InputType.Format.nBlockAlign; - DSCBDescription.lpwfxFormat = &InputType.Format; - hr = IDirectSoundCapture_CreateCaptureBuffer(self->DSC, &DSCBDescription, &self->DSCbuffer, NULL); - } if(SUCCEEDED(hr)) { - self->Ring = ll_ringbuffer_create(device->UpdateSize*device->NumUpdates + 1, - InputType.Format.nBlockAlign); + self->Ring = ll_ringbuffer_create(device->UpdateSize*device->NumUpdates, + InputType.Format.nBlockAlign, false); if(self->Ring == NULL) hr = DSERR_OUTOFMEMORY; } @@ -853,27 +881,11 @@ static ALCenum ALCdsoundCapture_open(ALCdsoundCapture *self, const ALCchar *devi self->BufferBytes = DSCBDescription.dwBufferBytes; SetDefaultWFXChannelOrder(device); - al_string_copy_cstr(&device->DeviceName, deviceName); + alstr_copy_cstr(&device->DeviceName, deviceName); return ALC_NO_ERROR; } -static void ALCdsoundCapture_close(ALCdsoundCapture *self) -{ - ll_ringbuffer_free(self->Ring); - self->Ring = NULL; - - if(self->DSCbuffer != NULL) - { - IDirectSoundCaptureBuffer_Stop(self->DSCbuffer); - IDirectSoundCaptureBuffer_Release(self->DSCbuffer); - self->DSCbuffer = NULL; - } - - IDirectSoundCapture_Release(self->DSC); - self->DSC = NULL; -} - static ALCboolean ALCdsoundCapture_start(ALCdsoundCapture *self) { HRESULT hr; @@ -882,7 +894,8 @@ static ALCboolean ALCdsoundCapture_start(ALCdsoundCapture *self) if(FAILED(hr)) { ERR("start failed: 0x%08lx\n", hr); - aluHandleDisconnect(STATIC_CAST(ALCbackend, self)->mDevice); + aluHandleDisconnect(STATIC_CAST(ALCbackend, self)->mDevice, + "Failure starting capture: 0x%lx", hr); return ALC_FALSE; } @@ -897,7 +910,8 @@ static void ALCdsoundCapture_stop(ALCdsoundCapture *self) if(FAILED(hr)) { ERR("stop failed: 0x%08lx\n", hr); - aluHandleDisconnect(STATIC_CAST(ALCbackend, self)->mDevice); + aluHandleDisconnect(STATIC_CAST(ALCbackend, self)->mDevice, + "Failure stopping capture: 0x%lx", hr); } } @@ -916,10 +930,10 @@ static ALCuint ALCdsoundCapture_availableSamples(ALCdsoundCapture *self) DWORD FrameSize; HRESULT hr; - if(!device->Connected) + if(!ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) goto done; - FrameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + FrameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); BufferBytes = self->BufferBytes; LastCursor = self->Cursor; @@ -947,18 +961,18 @@ static ALCuint ALCdsoundCapture_availableSamples(ALCdsoundCapture *self) if(FAILED(hr)) { ERR("update failed: 0x%08lx\n", hr); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failure retrieving capture data: 0x%lx", hr); } done: - return ll_ringbuffer_read_space(self->Ring); + return (ALCuint)ll_ringbuffer_read_space(self->Ring); } static inline void AppendAllDevicesList2(const DevMap *entry) -{ AppendAllDevicesList(al_string_get_cstr(entry->name)); } +{ AppendAllDevicesList(alstr_get_cstr(entry->name)); } static inline void AppendCaptureDeviceList2(const DevMap *entry) -{ AppendCaptureDeviceList(al_string_get_cstr(entry->name)); } +{ AppendCaptureDeviceList(alstr_get_cstr(entry->name)); } typedef struct ALCdsoundBackendFactory { DERIVE_FROM_TYPE(ALCbackendFactory); diff --git a/Engine/lib/openal-soft/Alc/backends/jack.c b/Engine/lib/openal-soft/Alc/backends/jack.c index 283df297a..67e3c1068 100644 --- a/Engine/lib/openal-soft/Alc/backends/jack.c +++ b/Engine/lib/openal-soft/Alc/backends/jack.c @@ -26,6 +26,8 @@ #include "alMain.h" #include "alu.h" +#include "alconfig.h" +#include "ringbuffer.h" #include "threads.h" #include "compat.h" @@ -63,6 +65,7 @@ static const ALCchar jackDevice[] = "JACK Default"; static void *jack_handle; #define MAKE_FUNC(f) static __typeof(f) * p##f JACK_FUNCS(MAKE_FUNC); +static __typeof(jack_error_callback) * pjack_error_callback; #undef MAKE_FUNC #define jack_client_open pjack_client_open @@ -84,6 +87,7 @@ JACK_FUNCS(MAKE_FUNC); #define jack_set_buffer_size_callback pjack_set_buffer_size_callback #define jack_set_buffer_size pjack_set_buffer_size #define jack_get_buffer_size pjack_get_buffer_size +#define jack_error_callback (*pjack_error_callback) #endif @@ -96,6 +100,8 @@ static ALCboolean jack_load(void) #ifdef HAVE_DYNLOAD if(!jack_handle) { + al_string missing_funcs = AL_STRING_INIT_STATIC(); + #ifdef _WIN32 #define JACKLIB "libjack.dll" #else @@ -103,24 +109,33 @@ static ALCboolean jack_load(void) #endif jack_handle = LoadLib(JACKLIB); if(!jack_handle) + { + WARN("Failed to load %s\n", JACKLIB); return ALC_FALSE; + } error = ALC_FALSE; #define LOAD_FUNC(f) do { \ p##f = GetSymbol(jack_handle, #f); \ if(p##f == NULL) { \ error = ALC_TRUE; \ + alstr_append_cstr(&missing_funcs, "\n" #f); \ } \ } while(0) JACK_FUNCS(LOAD_FUNC); #undef LOAD_FUNC + /* Optional symbols. These don't exist in all versions of JACK. */ +#define LOAD_SYM(f) p##f = GetSymbol(jack_handle, #f) + LOAD_SYM(jack_error_callback); +#undef LOAD_SYM if(error) { + WARN("Missing expected functions:%s\n", alstr_get_cstr(missing_funcs)); CloseLib(jack_handle); jack_handle = NULL; - return ALC_FALSE; } + alstr_reset(&missing_funcs); } #endif @@ -135,9 +150,9 @@ typedef struct ALCjackPlayback { jack_port_t *Port[MAX_OUTPUT_CHANNELS]; ll_ringbuffer_t *Ring; - alcnd_t Cond; + alsem_t Sem; - volatile int killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCjackPlayback; @@ -149,15 +164,14 @@ static int ALCjackPlayback_mixerProc(void *arg); static void ALCjackPlayback_Construct(ALCjackPlayback *self, ALCdevice *device); static void ALCjackPlayback_Destruct(ALCjackPlayback *self); static ALCenum ALCjackPlayback_open(ALCjackPlayback *self, const ALCchar *name); -static void ALCjackPlayback_close(ALCjackPlayback *self); static ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self); static ALCboolean ALCjackPlayback_start(ALCjackPlayback *self); static void ALCjackPlayback_stop(ALCjackPlayback *self); static DECLARE_FORWARD2(ALCjackPlayback, ALCbackend, ALCenum, captureSamples, void*, ALCuint) static DECLARE_FORWARD(ALCjackPlayback, ALCbackend, ALCuint, availableSamples) static ClockLatency ALCjackPlayback_getClockLatency(ALCjackPlayback *self); -static void ALCjackPlayback_lock(ALCjackPlayback *self); -static void ALCjackPlayback_unlock(ALCjackPlayback *self); +static DECLARE_FORWARD(ALCjackPlayback, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCjackPlayback, ALCbackend, void, unlock) DECLARE_DEFAULT_ALLOCATORS(ALCjackPlayback) DEFINE_ALCBACKEND_VTABLE(ALCjackPlayback); @@ -170,14 +184,14 @@ static void ALCjackPlayback_Construct(ALCjackPlayback *self, ALCdevice *device) ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCjackPlayback, ALCbackend, self); - alcnd_init(&self->Cond); + alsem_init(&self->Sem, 0); self->Client = NULL; for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) self->Port[i] = NULL; self->Ring = NULL; - self->killNow = 1; + ATOMIC_INIT(&self->killNow, AL_TRUE); } static void ALCjackPlayback_Destruct(ALCjackPlayback *self) @@ -196,7 +210,7 @@ static void ALCjackPlayback_Destruct(ALCjackPlayback *self) self->Client = NULL; } - alcnd_destroy(&self->Cond); + alsem_destroy(&self->Sem); ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } @@ -211,19 +225,23 @@ static int ALCjackPlayback_bufferSizeNotify(jack_nframes_t numframes, void *arg) ALCjackPlayback_lock(self); device->UpdateSize = numframes; device->NumUpdates = 2; - TRACE("%u update size x%u\n", device->UpdateSize, device->NumUpdates); bufsize = device->UpdateSize; - if(ConfigValueUInt(al_string_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize)) + if(ConfigValueUInt(alstr_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize)) bufsize = maxu(NextPowerOf2(bufsize), device->UpdateSize); - bufsize += device->UpdateSize; + device->NumUpdates = (bufsize+device->UpdateSize) / device->UpdateSize; + + TRACE("%u update size x%u\n", device->UpdateSize, device->NumUpdates); ll_ringbuffer_free(self->Ring); - self->Ring = ll_ringbuffer_create(bufsize, FrameSizeFromDevFmt(device->FmtChans, device->FmtType)); + self->Ring = ll_ringbuffer_create(bufsize, + FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder), + true + ); if(!self->Ring) { ERR("Failed to reallocate ringbuffer\n"); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed to reallocate %u-sample buffer", bufsize); } ALCjackPlayback_unlock(self); return 0; @@ -237,7 +255,7 @@ static int ALCjackPlayback_process(jack_nframes_t numframes, void *arg) ll_ringbuffer_data_t data[2]; jack_nframes_t total = 0; jack_nframes_t todo; - ALuint i, c, numchans; + ALsizei i, c, numchans; ll_ringbuffer_get_read_vector(self->Ring, data); @@ -248,8 +266,9 @@ static int ALCjackPlayback_process(jack_nframes_t numframes, void *arg) todo = minu(numframes, data[0].len); for(c = 0;c < numchans;c++) { - for(i = 0;i < todo;i++) - out[c][i] = ((ALfloat*)data[0].buf)[i*numchans + c]; + const ALfloat *restrict in = ((ALfloat*)data[0].buf) + c; + for(i = 0;(jack_nframes_t)i < todo;i++) + out[c][i] = in[i*numchans]; out[c] += todo; } total += todo; @@ -259,22 +278,23 @@ static int ALCjackPlayback_process(jack_nframes_t numframes, void *arg) { for(c = 0;c < numchans;c++) { - for(i = 0;i < todo;i++) - out[c][i] = ((ALfloat*)data[1].buf)[i*numchans + c]; + const ALfloat *restrict in = ((ALfloat*)data[1].buf) + c; + for(i = 0;(jack_nframes_t)i < todo;i++) + out[c][i] = in[i*numchans]; out[c] += todo; } total += todo; } ll_ringbuffer_read_advance(self->Ring, total); - alcnd_signal(&self->Cond); + alsem_post(&self->Sem); if(numframes > total) { todo = numframes-total; for(c = 0;c < numchans;c++) { - for(i = 0;i < todo;i++) + for(i = 0;(jack_nframes_t)i < todo;i++) out[c][i] = 0.0f; } } @@ -292,27 +312,16 @@ static int ALCjackPlayback_mixerProc(void *arg) althrd_setname(althrd_current(), MIXER_THREAD_NAME); ALCjackPlayback_lock(self); - while(!self->killNow && device->Connected) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) && + ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) { ALuint todo, len1, len2; - /* NOTE: Unfortunately, there is an unavoidable race condition here. - * It's possible for the process() method to run, updating the read - * pointer and signaling the condition variable, in between the mixer - * loop checking the write size and waiting for the condition variable. - * This will cause the mixer loop to wait until the *next* process() - * invocation, most likely writing silence for it. - * - * However, this should only happen if the mixer is running behind - * anyway (as ideally we'll be asleep in alcnd_wait by the time the - * process() method is invoked), so this behavior is not unwarranted. - * It's unfortunate since it'll be wasting time sleeping that could be - * used to catch up, but there's no way around it without blocking in - * the process() method. - */ if(ll_ringbuffer_write_space(self->Ring) < device->UpdateSize) { - alcnd_wait(&self->Cond, &STATIC_CAST(ALCbackend,self)->mMutex); + ALCjackPlayback_unlock(self); + alsem_wait(&self->Sem); + ALCjackPlayback_lock(self); continue; } @@ -362,29 +371,15 @@ static ALCenum ALCjackPlayback_open(ALCjackPlayback *self, const ALCchar *name) jack_set_process_callback(self->Client, ALCjackPlayback_process, self); jack_set_buffer_size_callback(self->Client, ALCjackPlayback_bufferSizeNotify, self); - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCjackPlayback_close(ALCjackPlayback *self) -{ - ALuint i; - - for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) - { - if(self->Port[i]) - jack_port_unregister(self->Client, self->Port[i]); - self->Port[i] = NULL; - } - jack_client_close(self->Client); - self->Client = NULL; -} - static ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - ALuint numchans, i; + ALsizei numchans, i; ALuint bufsize; for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) @@ -395,23 +390,21 @@ static ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self) } /* Ignore the requested buffer metrics and just keep one JACK-sized buffer - * ready for when requested. Note that one period's worth of audio in the - * ring buffer will always be left unfilled because one element of the ring - * buffer will not be writeable, and we only write in period-sized chunks. + * ready for when requested. */ device->Frequency = jack_get_sample_rate(self->Client); device->UpdateSize = jack_get_buffer_size(self->Client); device->NumUpdates = 2; bufsize = device->UpdateSize; - if(ConfigValueUInt(al_string_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize)) + if(ConfigValueUInt(alstr_get_cstr(device->DeviceName), "jack", "buffer-size", &bufsize)) bufsize = maxu(NextPowerOf2(bufsize), device->UpdateSize); - bufsize += device->UpdateSize; + device->NumUpdates = (bufsize+device->UpdateSize) / device->UpdateSize; /* Force 32-bit float output. */ device->FmtType = DevFmtFloat; - numchans = ChannelsFromDevFmt(device->FmtChans); + numchans = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); for(i = 0;i < numchans;i++) { char name[64]; @@ -440,7 +433,10 @@ static ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self) } ll_ringbuffer_free(self->Ring); - self->Ring = ll_ringbuffer_create(bufsize, FrameSizeFromDevFmt(device->FmtChans, device->FmtType)); + self->Ring = ll_ringbuffer_create(bufsize, + FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder), + true + ); if(!self->Ring) { ERR("Failed to allocate ringbuffer\n"); @@ -455,7 +451,7 @@ static ALCboolean ALCjackPlayback_reset(ALCjackPlayback *self) static ALCboolean ALCjackPlayback_start(ALCjackPlayback *self) { const char **ports; - ALuint i; + ALsizei i; if(jack_activate(self->Client)) { @@ -482,7 +478,7 @@ static ALCboolean ALCjackPlayback_start(ALCjackPlayback *self) } jack_free(ports); - self->killNow = 0; + ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); if(althrd_create(&self->thread, ALCjackPlayback_mixerProc, self) != althrd_success) { jack_deactivate(self->Client); @@ -496,17 +492,10 @@ static void ALCjackPlayback_stop(ALCjackPlayback *self) { int res; - if(self->killNow) + if(ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) return; - self->killNow = 1; - /* Lock the backend to ensure we don't flag the mixer to die and signal the - * mixer to wake up in between it checking the flag and going to sleep and - * wait for a wakeup (potentially leading to it never waking back up to see - * the flag). */ - ALCjackPlayback_lock(self); - ALCjackPlayback_unlock(self); - alcnd_signal(&self->Cond); + alsem_post(&self->Sem); althrd_join(self->thread, &res); jack_deactivate(self->Client); @@ -528,17 +517,6 @@ static ClockLatency ALCjackPlayback_getClockLatency(ALCjackPlayback *self) } -static void ALCjackPlayback_lock(ALCjackPlayback *self) -{ - almtx_lock(&STATIC_CAST(ALCbackend,self)->mMutex); -} - -static void ALCjackPlayback_unlock(ALCjackPlayback *self) -{ - almtx_unlock(&STATIC_CAST(ALCbackend,self)->mMutex); -} - - static void jack_msg_handler(const char *message) { WARN("%s\n", message); @@ -551,6 +529,7 @@ typedef struct ALCjackBackendFactory { static ALCboolean ALCjackBackendFactory_init(ALCjackBackendFactory* UNUSED(self)) { + void (*old_error_cb)(const char*); jack_client_t *client; jack_status_t status; @@ -560,9 +539,10 @@ static ALCboolean ALCjackBackendFactory_init(ALCjackBackendFactory* UNUSED(self) if(!GetConfigValueBool(NULL, "jack", "spawn-server", 0)) ClientOptions |= JackNoStartServer; + old_error_cb = (&jack_error_callback ? jack_error_callback : NULL); jack_set_error_function(jack_msg_handler); client = jack_client_open("alsoft", ClientOptions, &status, NULL); - jack_set_error_function(NULL); + jack_set_error_function(old_error_cb); if(client == NULL) { WARN("jack_client_open() failed, 0x%02x\n", status); diff --git a/Engine/lib/openal-soft/Alc/backends/loopback.c b/Engine/lib/openal-soft/Alc/backends/loopback.c index 0164bc5a7..9186a92f6 100644 --- a/Engine/lib/openal-soft/Alc/backends/loopback.c +++ b/Engine/lib/openal-soft/Alc/backends/loopback.c @@ -35,7 +35,6 @@ typedef struct ALCloopback { static void ALCloopback_Construct(ALCloopback *self, ALCdevice *device); static DECLARE_FORWARD(ALCloopback, ALCbackend, void, Destruct) static ALCenum ALCloopback_open(ALCloopback *self, const ALCchar *name); -static void ALCloopback_close(ALCloopback *self); static ALCboolean ALCloopback_reset(ALCloopback *self); static ALCboolean ALCloopback_start(ALCloopback *self); static void ALCloopback_stop(ALCloopback *self); @@ -59,14 +58,10 @@ static ALCenum ALCloopback_open(ALCloopback *self, const ALCchar *name) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCloopback_close(ALCloopback* UNUSED(self)) -{ -} - static ALCboolean ALCloopback_reset(ALCloopback *self) { SetDefaultWFXChannelOrder(STATIC_CAST(ALCbackend, self)->mDevice); diff --git a/Engine/lib/openal-soft/Alc/backends/null.c b/Engine/lib/openal-soft/Alc/backends/null.c index 5b153cd97..2c2db54ef 100644 --- a/Engine/lib/openal-soft/Alc/backends/null.c +++ b/Engine/lib/openal-soft/Alc/backends/null.c @@ -36,7 +36,7 @@ typedef struct ALCnullBackend { DERIVE_FROM_TYPE(ALCbackend); - volatile int killNow; + ATOMIC(int) killNow; althrd_t thread; } ALCnullBackend; @@ -45,7 +45,6 @@ static int ALCnullBackend_mixerProc(void *ptr); static void ALCnullBackend_Construct(ALCnullBackend *self, ALCdevice *device); static DECLARE_FORWARD(ALCnullBackend, ALCbackend, void, Destruct) static ALCenum ALCnullBackend_open(ALCnullBackend *self, const ALCchar *name); -static void ALCnullBackend_close(ALCnullBackend *self); static ALCboolean ALCnullBackend_reset(ALCnullBackend *self); static ALCboolean ALCnullBackend_start(ALCnullBackend *self); static void ALCnullBackend_stop(ALCnullBackend *self); @@ -66,6 +65,8 @@ static void ALCnullBackend_Construct(ALCnullBackend *self, ALCdevice *device) { ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCnullBackend, ALCbackend, self); + + ATOMIC_INIT(&self->killNow, AL_TRUE); } @@ -87,7 +88,8 @@ static int ALCnullBackend_mixerProc(void *ptr) ERR("Failed to get starting time\n"); return 1; } - while(!self->killNow && device->Connected) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) && + ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) { if(altimespec_get(&now, AL_TIME_UTC) != AL_TIME_UTC) { @@ -109,7 +111,9 @@ static int ALCnullBackend_mixerProc(void *ptr) al_nssleep(restTime); else while(avail-done >= device->UpdateSize) { + ALCnullBackend_lock(self); aluMixData(device, NULL, device->UpdateSize); + ALCnullBackend_unlock(self); done += device->UpdateSize; } } @@ -128,15 +132,11 @@ static ALCenum ALCnullBackend_open(ALCnullBackend *self, const ALCchar *name) return ALC_INVALID_VALUE; device = STATIC_CAST(ALCbackend, self)->mDevice; - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCnullBackend_close(ALCnullBackend* UNUSED(self)) -{ -} - static ALCboolean ALCnullBackend_reset(ALCnullBackend *self) { SetDefaultWFXChannelOrder(STATIC_CAST(ALCbackend, self)->mDevice); @@ -145,7 +145,7 @@ static ALCboolean ALCnullBackend_reset(ALCnullBackend *self) static ALCboolean ALCnullBackend_start(ALCnullBackend *self) { - self->killNow = 0; + ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); if(althrd_create(&self->thread, ALCnullBackend_mixerProc, self) != althrd_success) return ALC_FALSE; return ALC_TRUE; @@ -155,10 +155,8 @@ static void ALCnullBackend_stop(ALCnullBackend *self) { int res; - if(self->killNow) + if(ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) return; - - self->killNow = 1; althrd_join(self->thread, &res); } diff --git a/Engine/lib/openal-soft/Alc/backends/opensl.c b/Engine/lib/openal-soft/Alc/backends/opensl.c index 0796c49ab..a5ad3b098 100644 --- a/Engine/lib/openal-soft/Alc/backends/opensl.c +++ b/Engine/lib/openal-soft/Alc/backends/opensl.c @@ -22,38 +22,25 @@ #include "config.h" #include +#include #include "alMain.h" #include "alu.h" +#include "ringbuffer.h" #include "threads.h" +#include "compat.h" + +#include "backends/base.h" #include #include +#include /* Helper macros */ #define VCALL(obj, func) ((*(obj))->func((obj), EXTRACT_VCALL_ARGS #define VCALL0(obj, func) ((*(obj))->func((obj) EXTRACT_VCALL_ARGS -typedef struct { - /* engine interfaces */ - SLObjectItf engineObject; - SLEngineItf engine; - - /* output mix interfaces */ - SLObjectItf outputMix; - - /* buffer queue player interfaces */ - SLObjectItf bufferQueueObject; - - void *buffer; - ALuint bufferSize; - ALuint curBuffer; - - ALuint frameSize; -} osl_data; - - static const ALCchar opensl_device[] = "OpenSL"; @@ -79,14 +66,32 @@ static SLuint32 GetChannelMask(enum DevFmtChannels chans) SL_SPEAKER_FRONT_CENTER|SL_SPEAKER_LOW_FREQUENCY| SL_SPEAKER_BACK_LEFT|SL_SPEAKER_BACK_RIGHT| SL_SPEAKER_SIDE_LEFT|SL_SPEAKER_SIDE_RIGHT; - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: break; } return 0; } +#ifdef SL_DATAFORMAT_PCM_EX +static SLuint32 GetTypeRepresentation(enum DevFmtType type) +{ + switch(type) + { + case DevFmtUByte: + case DevFmtUShort: + case DevFmtUInt: + return SL_PCM_REPRESENTATION_UNSIGNED_INT; + case DevFmtByte: + case DevFmtShort: + case DevFmtInt: + return SL_PCM_REPRESENTATION_SIGNED_INT; + case DevFmtFloat: + return SL_PCM_REPRESENTATION_FLOAT; + } + return 0; +} +#endif + static const char *res_str(SLresult result) { switch(result) @@ -126,168 +131,427 @@ static const char *res_str(SLresult result) ERR("%s: %s\n", (s), res_str((x))); \ } while(0) -/* this callback handler is called every time a buffer finishes playing */ -static void opensl_callback(SLAndroidSimpleBufferQueueItf bq, void *context) + +typedef struct ALCopenslPlayback { + DERIVE_FROM_TYPE(ALCbackend); + + /* engine interfaces */ + SLObjectItf mEngineObj; + SLEngineItf mEngine; + + /* output mix interfaces */ + SLObjectItf mOutputMix; + + /* buffer queue player interfaces */ + SLObjectItf mBufferQueueObj; + + ll_ringbuffer_t *mRing; + alsem_t mSem; + + ALsizei mFrameSize; + + ATOMIC(ALenum) mKillNow; + althrd_t mThread; +} ALCopenslPlayback; + +static void ALCopenslPlayback_process(SLAndroidSimpleBufferQueueItf bq, void *context); +static int ALCopenslPlayback_mixerProc(void *arg); + +static void ALCopenslPlayback_Construct(ALCopenslPlayback *self, ALCdevice *device); +static void ALCopenslPlayback_Destruct(ALCopenslPlayback *self); +static ALCenum ALCopenslPlayback_open(ALCopenslPlayback *self, const ALCchar *name); +static ALCboolean ALCopenslPlayback_reset(ALCopenslPlayback *self); +static ALCboolean ALCopenslPlayback_start(ALCopenslPlayback *self); +static void ALCopenslPlayback_stop(ALCopenslPlayback *self); +static DECLARE_FORWARD2(ALCopenslPlayback, ALCbackend, ALCenum, captureSamples, void*, ALCuint) +static DECLARE_FORWARD(ALCopenslPlayback, ALCbackend, ALCuint, availableSamples) +static ClockLatency ALCopenslPlayback_getClockLatency(ALCopenslPlayback *self); +static DECLARE_FORWARD(ALCopenslPlayback, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCopenslPlayback, ALCbackend, void, unlock) +DECLARE_DEFAULT_ALLOCATORS(ALCopenslPlayback) + +DEFINE_ALCBACKEND_VTABLE(ALCopenslPlayback); + + +static void ALCopenslPlayback_Construct(ALCopenslPlayback *self, ALCdevice *device) { - ALCdevice *Device = context; - osl_data *data = Device->ExtraData; - ALvoid *buf; - SLresult result; + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(ALCopenslPlayback, ALCbackend, self); - buf = (ALbyte*)data->buffer + data->curBuffer*data->bufferSize; - aluMixData(Device, buf, data->bufferSize/data->frameSize); + self->mEngineObj = NULL; + self->mEngine = NULL; + self->mOutputMix = NULL; + self->mBufferQueueObj = NULL; - result = VCALL(bq,Enqueue)(buf, data->bufferSize); - PRINTERR(result, "bq->Enqueue"); + self->mRing = NULL; + alsem_init(&self->mSem, 0); - data->curBuffer = (data->curBuffer+1) % Device->NumUpdates; + self->mFrameSize = 0; + + ATOMIC_INIT(&self->mKillNow, AL_FALSE); +} + +static void ALCopenslPlayback_Destruct(ALCopenslPlayback* self) +{ + if(self->mBufferQueueObj != NULL) + VCALL0(self->mBufferQueueObj,Destroy)(); + self->mBufferQueueObj = NULL; + + if(self->mOutputMix) + VCALL0(self->mOutputMix,Destroy)(); + self->mOutputMix = NULL; + + if(self->mEngineObj) + VCALL0(self->mEngineObj,Destroy)(); + self->mEngineObj = NULL; + self->mEngine = NULL; + + alsem_destroy(&self->mSem); + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } -static ALCenum opensl_open_playback(ALCdevice *Device, const ALCchar *deviceName) +/* this callback handler is called every time a buffer finishes playing */ +static void ALCopenslPlayback_process(SLAndroidSimpleBufferQueueItf UNUSED(bq), void *context) { - osl_data *data = NULL; + ALCopenslPlayback *self = context; + + /* A note on the ringbuffer usage: The buffer queue seems to hold on to the + * pointer passed to the Enqueue method, rather than copying the audio. + * Consequently, the ringbuffer contains the audio that is currently queued + * and waiting to play. This process() callback is called when a buffer is + * finished, so we simply move the read pointer up to indicate the space is + * available for writing again, and wake up the mixer thread to mix and + * queue more audio. + */ + ll_ringbuffer_read_advance(self->mRing, 1); + + alsem_post(&self->mSem); +} + + +static int ALCopenslPlayback_mixerProc(void *arg) +{ + ALCopenslPlayback *self = arg; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; + SLAndroidSimpleBufferQueueItf bufferQueue; + ll_ringbuffer_data_t data[2]; + SLPlayItf player; SLresult result; - if(!deviceName) - deviceName = opensl_device; - else if(strcmp(deviceName, opensl_device) != 0) + SetRTPriority(); + althrd_setname(althrd_current(), MIXER_THREAD_NAME); + + result = VCALL(self->mBufferQueueObj,GetInterface)(SL_IID_ANDROIDSIMPLEBUFFERQUEUE, + &bufferQueue); + PRINTERR(result, "bufferQueue->GetInterface SL_IID_ANDROIDSIMPLEBUFFERQUEUE"); + if(SL_RESULT_SUCCESS == result) + { + result = VCALL(self->mBufferQueueObj,GetInterface)(SL_IID_PLAY, &player); + PRINTERR(result, "bufferQueue->GetInterface SL_IID_PLAY"); + } + if(SL_RESULT_SUCCESS != result) + { + ALCopenslPlayback_lock(self); + aluHandleDisconnect(device, "Failed to get playback buffer: 0x%08x", result); + ALCopenslPlayback_unlock(self); + return 1; + } + + ALCopenslPlayback_lock(self); + while(!ATOMIC_LOAD(&self->mKillNow, almemory_order_acquire) && + ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) + { + size_t todo, len0, len1; + + if(ll_ringbuffer_write_space(self->mRing) == 0) + { + SLuint32 state = 0; + + result = VCALL(player,GetPlayState)(&state); + PRINTERR(result, "player->GetPlayState"); + if(SL_RESULT_SUCCESS == result && state != SL_PLAYSTATE_PLAYING) + { + result = VCALL(player,SetPlayState)(SL_PLAYSTATE_PLAYING); + PRINTERR(result, "player->SetPlayState"); + } + if(SL_RESULT_SUCCESS != result) + { + aluHandleDisconnect(device, "Failed to start platback: 0x%08x", result); + break; + } + + if(ll_ringbuffer_write_space(self->mRing) == 0) + { + ALCopenslPlayback_unlock(self); + alsem_wait(&self->mSem); + ALCopenslPlayback_lock(self); + continue; + } + } + + ll_ringbuffer_get_write_vector(self->mRing, data); + todo = data[0].len+data[1].len; + + len0 = minu(todo, data[0].len); + len1 = minu(todo-len0, data[1].len); + + aluMixData(device, data[0].buf, len0*device->UpdateSize); + for(size_t i = 0;i < len0;i++) + { + result = VCALL(bufferQueue,Enqueue)(data[0].buf, device->UpdateSize*self->mFrameSize); + PRINTERR(result, "bufferQueue->Enqueue"); + if(SL_RESULT_SUCCESS == result) + ll_ringbuffer_write_advance(self->mRing, 1); + + data[0].buf += device->UpdateSize*self->mFrameSize; + } + + if(len1 > 0) + { + aluMixData(device, data[1].buf, len1*device->UpdateSize); + for(size_t i = 0;i < len1;i++) + { + result = VCALL(bufferQueue,Enqueue)(data[1].buf, device->UpdateSize*self->mFrameSize); + PRINTERR(result, "bufferQueue->Enqueue"); + if(SL_RESULT_SUCCESS == result) + ll_ringbuffer_write_advance(self->mRing, 1); + + data[1].buf += device->UpdateSize*self->mFrameSize; + } + } + } + ALCopenslPlayback_unlock(self); + + return 0; +} + + +static ALCenum ALCopenslPlayback_open(ALCopenslPlayback *self, const ALCchar *name) +{ + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; + SLresult result; + + if(!name) + name = opensl_device; + else if(strcmp(name, opensl_device) != 0) return ALC_INVALID_VALUE; - data = calloc(1, sizeof(*data)); - if(!data) - return ALC_OUT_OF_MEMORY; - // create engine - result = slCreateEngine(&data->engineObject, 0, NULL, 0, NULL, NULL); + result = slCreateEngine(&self->mEngineObj, 0, NULL, 0, NULL, NULL); PRINTERR(result, "slCreateEngine"); if(SL_RESULT_SUCCESS == result) { - result = VCALL(data->engineObject,Realize)(SL_BOOLEAN_FALSE); + result = VCALL(self->mEngineObj,Realize)(SL_BOOLEAN_FALSE); PRINTERR(result, "engine->Realize"); } if(SL_RESULT_SUCCESS == result) { - result = VCALL(data->engineObject,GetInterface)(SL_IID_ENGINE, &data->engine); + result = VCALL(self->mEngineObj,GetInterface)(SL_IID_ENGINE, &self->mEngine); PRINTERR(result, "engine->GetInterface"); } if(SL_RESULT_SUCCESS == result) { - result = VCALL(data->engine,CreateOutputMix)(&data->outputMix, 0, NULL, NULL); + result = VCALL(self->mEngine,CreateOutputMix)(&self->mOutputMix, 0, NULL, NULL); PRINTERR(result, "engine->CreateOutputMix"); } if(SL_RESULT_SUCCESS == result) { - result = VCALL(data->outputMix,Realize)(SL_BOOLEAN_FALSE); + result = VCALL(self->mOutputMix,Realize)(SL_BOOLEAN_FALSE); PRINTERR(result, "outputMix->Realize"); } if(SL_RESULT_SUCCESS != result) { - if(data->outputMix != NULL) - VCALL0(data->outputMix,Destroy)(); - data->outputMix = NULL; + if(self->mOutputMix != NULL) + VCALL0(self->mOutputMix,Destroy)(); + self->mOutputMix = NULL; - if(data->engineObject != NULL) - VCALL0(data->engineObject,Destroy)(); - data->engineObject = NULL; - data->engine = NULL; + if(self->mEngineObj != NULL) + VCALL0(self->mEngineObj,Destroy)(); + self->mEngineObj = NULL; + self->mEngine = NULL; - free(data); return ALC_INVALID_VALUE; } - al_string_copy_cstr(&Device->DeviceName, deviceName); - Device->ExtraData = data; + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } - -static void opensl_close_playback(ALCdevice *Device) +static ALCboolean ALCopenslPlayback_reset(ALCopenslPlayback *self) { - osl_data *data = Device->ExtraData; - - if(data->bufferQueueObject != NULL) - VCALL0(data->bufferQueueObject,Destroy)(); - data->bufferQueueObject = NULL; - - VCALL0(data->outputMix,Destroy)(); - data->outputMix = NULL; - - VCALL0(data->engineObject,Destroy)(); - data->engineObject = NULL; - data->engine = NULL; - - free(data); - Device->ExtraData = NULL; -} - -static ALCboolean opensl_reset_playback(ALCdevice *Device) -{ - osl_data *data = Device->ExtraData; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; SLDataLocator_AndroidSimpleBufferQueue loc_bufq; SLDataLocator_OutputMix loc_outmix; - SLDataFormat_PCM format_pcm; SLDataSource audioSrc; SLDataSink audioSnk; - SLInterfaceID id; - SLboolean req; + ALuint sampleRate; + SLInterfaceID ids[2]; + SLboolean reqs[2]; SLresult result; + JNIEnv *env; + if(self->mBufferQueueObj != NULL) + VCALL0(self->mBufferQueueObj,Destroy)(); + self->mBufferQueueObj = NULL; - Device->UpdateSize = (ALuint64)Device->UpdateSize * 44100 / Device->Frequency; - Device->UpdateSize = Device->UpdateSize * Device->NumUpdates / 2; - Device->NumUpdates = 2; + sampleRate = device->Frequency; + if(!(device->Flags&DEVICE_FREQUENCY_REQUEST) && (env=Android_GetJNIEnv()) != NULL) + { + /* FIXME: Disabled until I figure out how to get the Context needed for + * the getSystemService call. + */ +#if 0 + /* Get necessary stuff for using java.lang.Integer, + * android.content.Context, and android.media.AudioManager. + */ + jclass int_cls = JCALL(env,FindClass)("java/lang/Integer"); + jmethodID int_parseint = JCALL(env,GetStaticMethodID)(int_cls, + "parseInt", "(Ljava/lang/String;)I" + ); + TRACE("Integer: %p, parseInt: %p\n", int_cls, int_parseint); - Device->Frequency = 44100; - Device->FmtChans = DevFmtStereo; - Device->FmtType = DevFmtShort; + jclass ctx_cls = JCALL(env,FindClass)("android/content/Context"); + jfieldID ctx_audsvc = JCALL(env,GetStaticFieldID)(ctx_cls, + "AUDIO_SERVICE", "Ljava/lang/String;" + ); + jmethodID ctx_getSysSvc = JCALL(env,GetMethodID)(ctx_cls, + "getSystemService", "(Ljava/lang/String;)Ljava/lang/Object;" + ); + TRACE("Context: %p, AUDIO_SERVICE: %p, getSystemService: %p\n", + ctx_cls, ctx_audsvc, ctx_getSysSvc); - SetDefaultWFXChannelOrder(Device); + jclass audmgr_cls = JCALL(env,FindClass)("android/media/AudioManager"); + jfieldID audmgr_prop_out_srate = JCALL(env,GetStaticFieldID)(audmgr_cls, + "PROPERTY_OUTPUT_SAMPLE_RATE", "Ljava/lang/String;" + ); + jmethodID audmgr_getproperty = JCALL(env,GetMethodID)(audmgr_cls, + "getProperty", "(Ljava/lang/String;)Ljava/lang/String;" + ); + TRACE("AudioManager: %p, PROPERTY_OUTPUT_SAMPLE_RATE: %p, getProperty: %p\n", + audmgr_cls, audmgr_prop_out_srate, audmgr_getproperty); + const char *strchars; + jstring strobj; + + /* Now make the calls. */ + //AudioManager audMgr = (AudioManager)getSystemService(Context.AUDIO_SERVICE); + strobj = JCALL(env,GetStaticObjectField)(ctx_cls, ctx_audsvc); + jobject audMgr = JCALL(env,CallObjectMethod)(ctx_cls, ctx_getSysSvc, strobj); + strchars = JCALL(env,GetStringUTFChars)(strobj, NULL); + TRACE("Context.getSystemService(%s) = %p\n", strchars, audMgr); + JCALL(env,ReleaseStringUTFChars)(strobj, strchars); + + //String srateStr = audMgr.getProperty(AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE); + strobj = JCALL(env,GetStaticObjectField)(audmgr_cls, audmgr_prop_out_srate); + jstring srateStr = JCALL(env,CallObjectMethod)(audMgr, audmgr_getproperty, strobj); + strchars = JCALL(env,GetStringUTFChars)(strobj, NULL); + TRACE("audMgr.getProperty(%s) = %p\n", strchars, srateStr); + JCALL(env,ReleaseStringUTFChars)(strobj, strchars); + + //int sampleRate = Integer.parseInt(srateStr); + sampleRate = JCALL(env,CallStaticIntMethod)(int_cls, int_parseint, srateStr); + + strchars = JCALL(env,GetStringUTFChars)(srateStr, NULL); + TRACE("Got system sample rate %uhz (%s)\n", sampleRate, strchars); + JCALL(env,ReleaseStringUTFChars)(srateStr, strchars); + + if(!sampleRate) sampleRate = device->Frequency; + else sampleRate = maxu(sampleRate, MIN_OUTPUT_RATE); +#endif + } + + if(sampleRate != device->Frequency) + { + device->NumUpdates = (device->NumUpdates*sampleRate + (device->Frequency>>1)) / + device->Frequency; + device->NumUpdates = maxu(device->NumUpdates, 2); + device->Frequency = sampleRate; + } + + device->FmtChans = DevFmtStereo; + device->FmtType = DevFmtShort; + + SetDefaultWFXChannelOrder(device); + self->mFrameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); - id = SL_IID_ANDROIDSIMPLEBUFFERQUEUE; - req = SL_BOOLEAN_TRUE; loc_bufq.locatorType = SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE; - loc_bufq.numBuffers = Device->NumUpdates; + loc_bufq.numBuffers = device->NumUpdates; - format_pcm.formatType = SL_DATAFORMAT_PCM; - format_pcm.numChannels = ChannelsFromDevFmt(Device->FmtChans); - format_pcm.samplesPerSec = Device->Frequency * 1000; - format_pcm.bitsPerSample = BytesFromDevFmt(Device->FmtType) * 8; +#ifdef SL_DATAFORMAT_PCM_EX + SLDataFormat_PCM_EX format_pcm; + format_pcm.formatType = SL_DATAFORMAT_PCM_EX; + format_pcm.numChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); + format_pcm.sampleRate = device->Frequency * 1000; + format_pcm.bitsPerSample = BytesFromDevFmt(device->FmtType) * 8; format_pcm.containerSize = format_pcm.bitsPerSample; - format_pcm.channelMask = GetChannelMask(Device->FmtChans); + format_pcm.channelMask = GetChannelMask(device->FmtChans); format_pcm.endianness = IS_LITTLE_ENDIAN ? SL_BYTEORDER_LITTLEENDIAN : SL_BYTEORDER_BIGENDIAN; + format_pcm.representation = GetTypeRepresentation(device->FmtType); +#else + SLDataFormat_PCM format_pcm; + format_pcm.formatType = SL_DATAFORMAT_PCM; + format_pcm.numChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); + format_pcm.samplesPerSec = device->Frequency * 1000; + format_pcm.bitsPerSample = BytesFromDevFmt(device->FmtType) * 8; + format_pcm.containerSize = format_pcm.bitsPerSample; + format_pcm.channelMask = GetChannelMask(device->FmtChans); + format_pcm.endianness = IS_LITTLE_ENDIAN ? SL_BYTEORDER_LITTLEENDIAN : + SL_BYTEORDER_BIGENDIAN; +#endif audioSrc.pLocator = &loc_bufq; audioSrc.pFormat = &format_pcm; loc_outmix.locatorType = SL_DATALOCATOR_OUTPUTMIX; - loc_outmix.outputMix = data->outputMix; + loc_outmix.outputMix = self->mOutputMix; audioSnk.pLocator = &loc_outmix; audioSnk.pFormat = NULL; - if(data->bufferQueueObject != NULL) - VCALL0(data->bufferQueueObject,Destroy)(); - data->bufferQueueObject = NULL; + ids[0] = SL_IID_ANDROIDSIMPLEBUFFERQUEUE; + reqs[0] = SL_BOOLEAN_TRUE; + ids[1] = SL_IID_ANDROIDCONFIGURATION; + reqs[1] = SL_BOOLEAN_FALSE; - result = VCALL(data->engine,CreateAudioPlayer)(&data->bufferQueueObject, &audioSrc, &audioSnk, 1, &id, &req); + result = VCALL(self->mEngine,CreateAudioPlayer)(&self->mBufferQueueObj, + &audioSrc, &audioSnk, COUNTOF(ids), ids, reqs + ); PRINTERR(result, "engine->CreateAudioPlayer"); if(SL_RESULT_SUCCESS == result) { - result = VCALL(data->bufferQueueObject,Realize)(SL_BOOLEAN_FALSE); + /* Set the stream type to "media" (games, music, etc), if possible. */ + SLAndroidConfigurationItf config; + result = VCALL(self->mBufferQueueObj,GetInterface)(SL_IID_ANDROIDCONFIGURATION, &config); + PRINTERR(result, "bufferQueue->GetInterface SL_IID_ANDROIDCONFIGURATION"); + if(SL_RESULT_SUCCESS == result) + { + SLint32 streamType = SL_ANDROID_STREAM_MEDIA; + result = VCALL(config,SetConfiguration)(SL_ANDROID_KEY_STREAM_TYPE, + &streamType, sizeof(streamType) + ); + PRINTERR(result, "config->SetConfiguration"); + } + + /* Clear any error since this was optional. */ + result = SL_RESULT_SUCCESS; + } + if(SL_RESULT_SUCCESS == result) + { + result = VCALL(self->mBufferQueueObj,Realize)(SL_BOOLEAN_FALSE); PRINTERR(result, "bufferQueue->Realize"); } if(SL_RESULT_SUCCESS != result) { - if(data->bufferQueueObject != NULL) - VCALL0(data->bufferQueueObject,Destroy)(); - data->bufferQueueObject = NULL; + if(self->mBufferQueueObj != NULL) + VCALL0(self->mBufferQueueObj,Destroy)(); + self->mBufferQueueObj = NULL; return ALC_FALSE; } @@ -295,64 +559,31 @@ static ALCboolean opensl_reset_playback(ALCdevice *Device) return ALC_TRUE; } -static ALCboolean opensl_start_playback(ALCdevice *Device) +static ALCboolean ALCopenslPlayback_start(ALCopenslPlayback *self) { - osl_data *data = Device->ExtraData; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; SLAndroidSimpleBufferQueueItf bufferQueue; - SLPlayItf player; SLresult result; - ALuint i; - result = VCALL(data->bufferQueueObject,GetInterface)(SL_IID_BUFFERQUEUE, &bufferQueue); + ll_ringbuffer_free(self->mRing); + self->mRing = ll_ringbuffer_create(device->NumUpdates, self->mFrameSize*device->UpdateSize, + true); + + result = VCALL(self->mBufferQueueObj,GetInterface)(SL_IID_ANDROIDSIMPLEBUFFERQUEUE, + &bufferQueue); PRINTERR(result, "bufferQueue->GetInterface"); - if(SL_RESULT_SUCCESS == result) - { - result = VCALL(bufferQueue,RegisterCallback)(opensl_callback, Device); - PRINTERR(result, "bufferQueue->RegisterCallback"); - } - if(SL_RESULT_SUCCESS == result) - { - data->frameSize = FrameSizeFromDevFmt(Device->FmtChans, Device->FmtType); - data->bufferSize = Device->UpdateSize * data->frameSize; - data->buffer = calloc(Device->NumUpdates, data->bufferSize); - if(!data->buffer) - { - result = SL_RESULT_MEMORY_FAILURE; - PRINTERR(result, "calloc"); - } - } - /* enqueue the first buffer to kick off the callbacks */ - for(i = 0;i < Device->NumUpdates;i++) - { - if(SL_RESULT_SUCCESS == result) - { - ALvoid *buf = (ALbyte*)data->buffer + i*data->bufferSize; - result = VCALL(bufferQueue,Enqueue)(buf, data->bufferSize); - PRINTERR(result, "bufferQueue->Enqueue"); - } - } - data->curBuffer = 0; - if(SL_RESULT_SUCCESS == result) - { - result = VCALL(data->bufferQueueObject,GetInterface)(SL_IID_PLAY, &player); - PRINTERR(result, "bufferQueue->GetInterface"); - } - if(SL_RESULT_SUCCESS == result) - { - result = VCALL(player,SetPlayState)(SL_PLAYSTATE_PLAYING); - PRINTERR(result, "player->SetPlayState"); - } - if(SL_RESULT_SUCCESS != result) + return ALC_FALSE; + + result = VCALL(bufferQueue,RegisterCallback)(ALCopenslPlayback_process, self); + PRINTERR(result, "bufferQueue->RegisterCallback"); + if(SL_RESULT_SUCCESS != result) + return ALC_FALSE; + + ATOMIC_STORE_SEQ(&self->mKillNow, AL_FALSE); + if(althrd_create(&self->mThread, ALCopenslPlayback_mixerProc, self) != althrd_success) { - if(data->bufferQueueObject != NULL) - VCALL0(data->bufferQueueObject,Destroy)(); - data->bufferQueueObject = NULL; - - free(data->buffer); - data->buffer = NULL; - data->bufferSize = 0; - + ERR("Failed to start mixer thread\n"); return ALC_FALSE; } @@ -360,14 +591,20 @@ static ALCboolean opensl_start_playback(ALCdevice *Device) } -static void opensl_stop_playback(ALCdevice *Device) +static void ALCopenslPlayback_stop(ALCopenslPlayback *self) { - osl_data *data = Device->ExtraData; - SLPlayItf player; SLAndroidSimpleBufferQueueItf bufferQueue; + SLPlayItf player; SLresult result; + int res; - result = VCALL(data->bufferQueueObject,GetInterface)(SL_IID_PLAY, &player); + if(ATOMIC_EXCHANGE_SEQ(&self->mKillNow, AL_TRUE)) + return; + + alsem_post(&self->mSem); + althrd_join(self->mThread, &res); + + result = VCALL(self->mBufferQueueObj,GetInterface)(SL_IID_PLAY, &player); PRINTERR(result, "bufferQueue->GetInterface"); if(SL_RESULT_SUCCESS == result) { @@ -375,7 +612,8 @@ static void opensl_stop_playback(ALCdevice *Device) PRINTERR(result, "player->SetPlayState"); } - result = VCALL(data->bufferQueueObject,GetInterface)(SL_IID_BUFFERQUEUE, &bufferQueue); + result = VCALL(self->mBufferQueueObj,GetInterface)(SL_IID_ANDROIDSIMPLEBUFFERQUEUE, + &bufferQueue); PRINTERR(result, "bufferQueue->GetInterface"); if(SL_RESULT_SUCCESS == result) { @@ -383,6 +621,11 @@ static void opensl_stop_playback(ALCdevice *Device) PRINTERR(result, "bufferQueue->Clear"); } if(SL_RESULT_SUCCESS == result) + { + result = VCALL(bufferQueue,RegisterCallback)(NULL, NULL); + PRINTERR(result, "bufferQueue->RegisterCallback"); + } + if(SL_RESULT_SUCCESS == result) { SLAndroidSimpleBufferQueueState state; do { @@ -392,45 +635,440 @@ static void opensl_stop_playback(ALCdevice *Device) PRINTERR(result, "bufferQueue->GetState"); } - free(data->buffer); - data->buffer = NULL; - data->bufferSize = 0; + ll_ringbuffer_free(self->mRing); + self->mRing = NULL; +} + +static ClockLatency ALCopenslPlayback_getClockLatency(ALCopenslPlayback *self) +{ + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + ClockLatency ret; + + ALCopenslPlayback_lock(self); + ret.ClockTime = GetDeviceClockTime(device); + ret.Latency = ll_ringbuffer_read_space(self->mRing)*device->UpdateSize * + DEVICE_CLOCK_RES / device->Frequency; + ALCopenslPlayback_unlock(self); + + return ret; } -static const BackendFuncs opensl_funcs = { - opensl_open_playback, - opensl_close_playback, - opensl_reset_playback, - opensl_start_playback, - opensl_stop_playback, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL -}; +typedef struct ALCopenslCapture { + DERIVE_FROM_TYPE(ALCbackend); + + /* engine interfaces */ + SLObjectItf mEngineObj; + SLEngineItf mEngine; + + /* recording interfaces */ + SLObjectItf mRecordObj; + + ll_ringbuffer_t *mRing; + ALCuint mSplOffset; + + ALsizei mFrameSize; +} ALCopenslCapture; + +static void ALCopenslCapture_process(SLAndroidSimpleBufferQueueItf bq, void *context); + +static void ALCopenslCapture_Construct(ALCopenslCapture *self, ALCdevice *device); +static void ALCopenslCapture_Destruct(ALCopenslCapture *self); +static ALCenum ALCopenslCapture_open(ALCopenslCapture *self, const ALCchar *name); +static DECLARE_FORWARD(ALCopenslCapture, ALCbackend, ALCboolean, reset) +static ALCboolean ALCopenslCapture_start(ALCopenslCapture *self); +static void ALCopenslCapture_stop(ALCopenslCapture *self); +static ALCenum ALCopenslCapture_captureSamples(ALCopenslCapture *self, ALCvoid *buffer, ALCuint samples); +static ALCuint ALCopenslCapture_availableSamples(ALCopenslCapture *self); +static DECLARE_FORWARD(ALCopenslCapture, ALCbackend, ClockLatency, getClockLatency) +static DECLARE_FORWARD(ALCopenslCapture, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCopenslCapture, ALCbackend, void, unlock) +DECLARE_DEFAULT_ALLOCATORS(ALCopenslCapture) +DEFINE_ALCBACKEND_VTABLE(ALCopenslCapture); -ALCboolean alc_opensl_init(BackendFuncs *func_list) +static void ALCopenslCapture_process(SLAndroidSimpleBufferQueueItf UNUSED(bq), void *context) { - *func_list = opensl_funcs; + ALCopenslCapture *self = context; + /* A new chunk has been written into the ring buffer, advance it. */ + ll_ringbuffer_write_advance(self->mRing, 1); +} + + +static void ALCopenslCapture_Construct(ALCopenslCapture *self, ALCdevice *device) +{ + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(ALCopenslCapture, ALCbackend, self); + + self->mEngineObj = NULL; + self->mEngine = NULL; + + self->mRecordObj = NULL; + + self->mRing = NULL; + self->mSplOffset = 0; + + self->mFrameSize = 0; +} + +static void ALCopenslCapture_Destruct(ALCopenslCapture *self) +{ + ll_ringbuffer_free(self->mRing); + self->mRing = NULL; + + if(self->mRecordObj != NULL) + VCALL0(self->mRecordObj,Destroy)(); + self->mRecordObj = NULL; + + if(self->mEngineObj != NULL) + VCALL0(self->mEngineObj,Destroy)(); + self->mEngineObj = NULL; + self->mEngine = NULL; + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); +} + +static ALCenum ALCopenslCapture_open(ALCopenslCapture *self, const ALCchar *name) +{ + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + SLDataLocator_AndroidSimpleBufferQueue loc_bq; + SLAndroidSimpleBufferQueueItf bufferQueue; + SLDataLocator_IODevice loc_dev; + SLDataSource audioSrc; + SLDataSink audioSnk; + SLresult result; + + if(!name) + name = opensl_device; + else if(strcmp(name, opensl_device) != 0) + return ALC_INVALID_VALUE; + + result = slCreateEngine(&self->mEngineObj, 0, NULL, 0, NULL, NULL); + PRINTERR(result, "slCreateEngine"); + if(SL_RESULT_SUCCESS == result) + { + result = VCALL(self->mEngineObj,Realize)(SL_BOOLEAN_FALSE); + PRINTERR(result, "engine->Realize"); + } + if(SL_RESULT_SUCCESS == result) + { + result = VCALL(self->mEngineObj,GetInterface)(SL_IID_ENGINE, &self->mEngine); + PRINTERR(result, "engine->GetInterface"); + } + if(SL_RESULT_SUCCESS == result) + { + /* Ensure the total length is at least 100ms */ + ALsizei length = maxi(device->NumUpdates * device->UpdateSize, + device->Frequency / 10); + /* Ensure the per-chunk length is at least 10ms, and no more than 50ms. */ + ALsizei update_len = clampi(device->NumUpdates*device->UpdateSize / 3, + device->Frequency / 100, + device->Frequency / 100 * 5); + + device->UpdateSize = update_len; + device->NumUpdates = (length+update_len-1) / update_len; + + self->mFrameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); + } + loc_dev.locatorType = SL_DATALOCATOR_IODEVICE; + loc_dev.deviceType = SL_IODEVICE_AUDIOINPUT; + loc_dev.deviceID = SL_DEFAULTDEVICEID_AUDIOINPUT; + loc_dev.device = NULL; + + audioSrc.pLocator = &loc_dev; + audioSrc.pFormat = NULL; + + loc_bq.locatorType = SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE; + loc_bq.numBuffers = device->NumUpdates; + +#ifdef SL_DATAFORMAT_PCM_EX + SLDataFormat_PCM_EX format_pcm; + format_pcm.formatType = SL_DATAFORMAT_PCM_EX; + format_pcm.numChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); + format_pcm.sampleRate = device->Frequency * 1000; + format_pcm.bitsPerSample = BytesFromDevFmt(device->FmtType) * 8; + format_pcm.containerSize = format_pcm.bitsPerSample; + format_pcm.channelMask = GetChannelMask(device->FmtChans); + format_pcm.endianness = IS_LITTLE_ENDIAN ? SL_BYTEORDER_LITTLEENDIAN : + SL_BYTEORDER_BIGENDIAN; + format_pcm.representation = GetTypeRepresentation(device->FmtType); +#else + SLDataFormat_PCM format_pcm; + format_pcm.formatType = SL_DATAFORMAT_PCM; + format_pcm.numChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); + format_pcm.samplesPerSec = device->Frequency * 1000; + format_pcm.bitsPerSample = BytesFromDevFmt(device->FmtType) * 8; + format_pcm.containerSize = format_pcm.bitsPerSample; + format_pcm.channelMask = GetChannelMask(device->FmtChans); + format_pcm.endianness = IS_LITTLE_ENDIAN ? SL_BYTEORDER_LITTLEENDIAN : + SL_BYTEORDER_BIGENDIAN; +#endif + + audioSnk.pLocator = &loc_bq; + audioSnk.pFormat = &format_pcm; + + if(SL_RESULT_SUCCESS == result) + { + const SLInterfaceID ids[2] = { SL_IID_ANDROIDSIMPLEBUFFERQUEUE, SL_IID_ANDROIDCONFIGURATION }; + const SLboolean reqs[2] = { SL_BOOLEAN_TRUE, SL_BOOLEAN_FALSE }; + + result = VCALL(self->mEngine,CreateAudioRecorder)(&self->mRecordObj, + &audioSrc, &audioSnk, COUNTOF(ids), ids, reqs + ); + PRINTERR(result, "engine->CreateAudioRecorder"); + } + if(SL_RESULT_SUCCESS == result) + { + /* Set the record preset to "generic", if possible. */ + SLAndroidConfigurationItf config; + result = VCALL(self->mRecordObj,GetInterface)(SL_IID_ANDROIDCONFIGURATION, &config); + PRINTERR(result, "recordObj->GetInterface SL_IID_ANDROIDCONFIGURATION"); + if(SL_RESULT_SUCCESS == result) + { + SLuint32 preset = SL_ANDROID_RECORDING_PRESET_GENERIC; + result = VCALL(config,SetConfiguration)(SL_ANDROID_KEY_RECORDING_PRESET, + &preset, sizeof(preset) + ); + PRINTERR(result, "config->SetConfiguration"); + } + + /* Clear any error since this was optional. */ + result = SL_RESULT_SUCCESS; + } + if(SL_RESULT_SUCCESS == result) + { + result = VCALL(self->mRecordObj,Realize)(SL_BOOLEAN_FALSE); + PRINTERR(result, "recordObj->Realize"); + } + + if(SL_RESULT_SUCCESS == result) + { + self->mRing = ll_ringbuffer_create(device->NumUpdates, device->UpdateSize*self->mFrameSize, + false); + + result = VCALL(self->mRecordObj,GetInterface)(SL_IID_ANDROIDSIMPLEBUFFERQUEUE, + &bufferQueue); + PRINTERR(result, "recordObj->GetInterface"); + } + if(SL_RESULT_SUCCESS == result) + { + result = VCALL(bufferQueue,RegisterCallback)(ALCopenslCapture_process, self); + PRINTERR(result, "bufferQueue->RegisterCallback"); + } + if(SL_RESULT_SUCCESS == result) + { + ALsizei chunk_size = device->UpdateSize * self->mFrameSize; + ll_ringbuffer_data_t data[2]; + size_t i; + + ll_ringbuffer_get_write_vector(self->mRing, data); + for(i = 0;i < data[0].len && SL_RESULT_SUCCESS == result;i++) + { + result = VCALL(bufferQueue,Enqueue)(data[0].buf + chunk_size*i, chunk_size); + PRINTERR(result, "bufferQueue->Enqueue"); + } + for(i = 0;i < data[1].len && SL_RESULT_SUCCESS == result;i++) + { + result = VCALL(bufferQueue,Enqueue)(data[1].buf + chunk_size*i, chunk_size); + PRINTERR(result, "bufferQueue->Enqueue"); + } + } + + if(SL_RESULT_SUCCESS != result) + { + if(self->mRecordObj != NULL) + VCALL0(self->mRecordObj,Destroy)(); + self->mRecordObj = NULL; + + if(self->mEngineObj != NULL) + VCALL0(self->mEngineObj,Destroy)(); + self->mEngineObj = NULL; + self->mEngine = NULL; + + return ALC_INVALID_VALUE; + } + + alstr_copy_cstr(&device->DeviceName, name); + + return ALC_NO_ERROR; +} + +static ALCboolean ALCopenslCapture_start(ALCopenslCapture *self) +{ + SLRecordItf record; + SLresult result; + + result = VCALL(self->mRecordObj,GetInterface)(SL_IID_RECORD, &record); + PRINTERR(result, "recordObj->GetInterface"); + + if(SL_RESULT_SUCCESS == result) + { + result = VCALL(record,SetRecordState)(SL_RECORDSTATE_RECORDING); + PRINTERR(result, "record->SetRecordState"); + } + + if(SL_RESULT_SUCCESS != result) + { + ALCopenslCapture_lock(self); + aluHandleDisconnect(STATIC_CAST(ALCbackend, self)->mDevice, + "Failed to start capture: 0x%08x", result); + ALCopenslCapture_unlock(self); + return ALC_FALSE; + } + return ALC_TRUE; } -void alc_opensl_deinit(void) +static void ALCopenslCapture_stop(ALCopenslCapture *self) +{ + SLRecordItf record; + SLresult result; + + result = VCALL(self->mRecordObj,GetInterface)(SL_IID_RECORD, &record); + PRINTERR(result, "recordObj->GetInterface"); + + if(SL_RESULT_SUCCESS == result) + { + result = VCALL(record,SetRecordState)(SL_RECORDSTATE_PAUSED); + PRINTERR(result, "record->SetRecordState"); + } +} + +static ALCenum ALCopenslCapture_captureSamples(ALCopenslCapture *self, ALCvoid *buffer, ALCuint samples) +{ + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + ALsizei chunk_size = device->UpdateSize * self->mFrameSize; + SLAndroidSimpleBufferQueueItf bufferQueue; + ll_ringbuffer_data_t data[2]; + SLresult result; + size_t advance; + ALCuint i; + + /* Read the desired samples from the ring buffer then advance its read + * pointer. + */ + ll_ringbuffer_get_read_vector(self->mRing, data); + advance = 0; + for(i = 0;i < samples;) + { + ALCuint rem = minu(samples - i, device->UpdateSize - self->mSplOffset); + memcpy((ALCbyte*)buffer + i*self->mFrameSize, + data[0].buf + self->mSplOffset*self->mFrameSize, + rem * self->mFrameSize); + + self->mSplOffset += rem; + if(self->mSplOffset == device->UpdateSize) + { + /* Finished a chunk, reset the offset and advance the read pointer. */ + self->mSplOffset = 0; + advance++; + + data[0].len--; + if(!data[0].len) + data[0] = data[1]; + else + data[0].buf += chunk_size; + } + + i += rem; + } + ll_ringbuffer_read_advance(self->mRing, advance); + + result = VCALL(self->mRecordObj,GetInterface)(SL_IID_ANDROIDSIMPLEBUFFERQUEUE, + &bufferQueue); + PRINTERR(result, "recordObj->GetInterface"); + + /* Enqueue any newly-writable chunks in the ring buffer. */ + ll_ringbuffer_get_write_vector(self->mRing, data); + for(i = 0;i < data[0].len && SL_RESULT_SUCCESS == result;i++) + { + result = VCALL(bufferQueue,Enqueue)(data[0].buf + chunk_size*i, chunk_size); + PRINTERR(result, "bufferQueue->Enqueue"); + } + for(i = 0;i < data[1].len && SL_RESULT_SUCCESS == result;i++) + { + result = VCALL(bufferQueue,Enqueue)(data[1].buf + chunk_size*i, chunk_size); + PRINTERR(result, "bufferQueue->Enqueue"); + } + + if(SL_RESULT_SUCCESS != result) + { + ALCopenslCapture_lock(self); + aluHandleDisconnect(device, "Failed to update capture buffer: 0x%08x", result); + ALCopenslCapture_unlock(self); + return ALC_INVALID_DEVICE; + } + + return ALC_NO_ERROR; +} + +static ALCuint ALCopenslCapture_availableSamples(ALCopenslCapture *self) +{ + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + return ll_ringbuffer_read_space(self->mRing) * device->UpdateSize; +} + + +typedef struct ALCopenslBackendFactory { + DERIVE_FROM_TYPE(ALCbackendFactory); +} ALCopenslBackendFactory; +#define ALCOPENSLBACKENDFACTORY_INITIALIZER { { GET_VTABLE2(ALCopenslBackendFactory, ALCbackendFactory) } } + +static ALCboolean ALCopenslBackendFactory_init(ALCopenslBackendFactory* UNUSED(self)) +{ + return ALC_TRUE; +} + +static void ALCopenslBackendFactory_deinit(ALCopenslBackendFactory* UNUSED(self)) { } -void alc_opensl_probe(enum DevProbe type) +static ALCboolean ALCopenslBackendFactory_querySupport(ALCopenslBackendFactory* UNUSED(self), ALCbackend_Type type) +{ + if(type == ALCbackend_Playback || type == ALCbackend_Capture) + return ALC_TRUE; + return ALC_FALSE; +} + +static void ALCopenslBackendFactory_probe(ALCopenslBackendFactory* UNUSED(self), enum DevProbe type) { switch(type) { case ALL_DEVICE_PROBE: AppendAllDevicesList(opensl_device); break; + case CAPTURE_DEVICE_PROBE: + AppendAllDevicesList(opensl_device); break; } } + +static ALCbackend* ALCopenslBackendFactory_createBackend(ALCopenslBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type) +{ + if(type == ALCbackend_Playback) + { + ALCopenslPlayback *backend; + NEW_OBJ(backend, ALCopenslPlayback)(device); + if(!backend) return NULL; + return STATIC_CAST(ALCbackend, backend); + } + if(type == ALCbackend_Capture) + { + ALCopenslCapture *backend; + NEW_OBJ(backend, ALCopenslCapture)(device); + if(!backend) return NULL; + return STATIC_CAST(ALCbackend, backend); + } + + return NULL; +} + +DEFINE_ALCBACKENDFACTORY_VTABLE(ALCopenslBackendFactory); + + +ALCbackendFactory *ALCopenslBackendFactory_getFactory(void) +{ + static ALCopenslBackendFactory factory = ALCOPENSLBACKENDFACTORY_INITIALIZER; + return STATIC_CAST(ALCbackendFactory, &factory); +} diff --git a/Engine/lib/openal-soft/Alc/backends/oss.c b/Engine/lib/openal-soft/Alc/backends/oss.c index 432c75f21..c0c98c432 100644 --- a/Engine/lib/openal-soft/Alc/backends/oss.c +++ b/Engine/lib/openal-soft/Alc/backends/oss.c @@ -35,6 +35,8 @@ #include "alMain.h" #include "alu.h" +#include "alconfig.h" +#include "ringbuffer.h" #include "threads.h" #include "compat.h" @@ -88,7 +90,9 @@ static struct oss_device oss_capture = { #ifdef ALC_OSS_COMPAT -static void ALCossListPopulate(struct oss_device *UNUSED(playback), struct oss_device *UNUSED(capture)) +#define DSP_CAP_OUTPUT 0x00020000 +#define DSP_CAP_INPUT 0x00010000 +static void ALCossListPopulate(struct oss_device *UNUSED(devlist), int UNUSED(type_flag)) { } @@ -153,7 +157,7 @@ static void ALCossListAppend(struct oss_device *list, const char *handle, size_t TRACE("Got device \"%s\", \"%s\"\n", next->handle, next->path); } -static void ALCossListPopulate(struct oss_device *playback, struct oss_device *capture) +static void ALCossListPopulate(struct oss_device *devlist, int type_flag) { struct oss_sysinfo si; struct oss_audioinfo ai; @@ -161,12 +165,12 @@ static void ALCossListPopulate(struct oss_device *playback, struct oss_device *c if((fd=open("/dev/mixer", O_RDONLY)) < 0) { - ERR("Could not open /dev/mixer\n"); + TRACE("Could not open /dev/mixer: %s\n", strerror(errno)); return; } if(ioctl(fd, SNDCTL_SYSINFO, &si) == -1) { - ERR("SNDCTL_SYSINFO failed: %s\n", strerror(errno)); + TRACE("SNDCTL_SYSINFO failed: %s\n", strerror(errno)); goto done; } for(i = 0;i < si.numaudios;i++) @@ -193,10 +197,9 @@ static void ALCossListPopulate(struct oss_device *playback, struct oss_device *c len = strnlen(ai.name, sizeof(ai.name)); handle = ai.name; } - if((ai.caps&DSP_CAP_INPUT) && capture != NULL) - ALCossListAppend(capture, handle, len, ai.devnode, strnlen(ai.devnode, sizeof(ai.devnode))); - if((ai.caps&DSP_CAP_OUTPUT) && playback != NULL) - ALCossListAppend(playback, handle, len, ai.devnode, strnlen(ai.devnode, sizeof(ai.devnode))); + if((ai.caps&type_flag)) + ALCossListAppend(devlist, handle, len, ai.devnode, + strnlen(ai.devnode, sizeof(ai.devnode))); } done: @@ -242,16 +245,15 @@ typedef struct ALCplaybackOSS { ALubyte *mix_data; int data_size; - volatile int killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCplaybackOSS; static int ALCplaybackOSS_mixerProc(void *ptr); static void ALCplaybackOSS_Construct(ALCplaybackOSS *self, ALCdevice *device); -static DECLARE_FORWARD(ALCplaybackOSS, ALCbackend, void, Destruct) +static void ALCplaybackOSS_Destruct(ALCplaybackOSS *self); static ALCenum ALCplaybackOSS_open(ALCplaybackOSS *self, const ALCchar *name); -static void ALCplaybackOSS_close(ALCplaybackOSS *self); static ALCboolean ALCplaybackOSS_reset(ALCplaybackOSS *self); static ALCboolean ALCplaybackOSS_start(ALCplaybackOSS *self); static void ALCplaybackOSS_stop(ALCplaybackOSS *self); @@ -268,42 +270,66 @@ static int ALCplaybackOSS_mixerProc(void *ptr) { ALCplaybackOSS *self = (ALCplaybackOSS*)ptr; ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - ALint frameSize; + struct timeval timeout; + ALubyte *write_ptr; + ALint frame_size; + ALint to_write; ssize_t wrote; + fd_set wfds; + int sret; SetRTPriority(); althrd_setname(althrd_current(), MIXER_THREAD_NAME); - frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); - while(!self->killNow && device->Connected) + ALCplaybackOSS_lock(self); + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) && + ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) { - ALint len = self->data_size; - ALubyte *WritePtr = self->mix_data; + FD_ZERO(&wfds); + FD_SET(self->fd, &wfds); + timeout.tv_sec = 1; + timeout.tv_usec = 0; - aluMixData(device, WritePtr, len/frameSize); - while(len > 0 && !self->killNow) + ALCplaybackOSS_unlock(self); + sret = select(self->fd+1, NULL, &wfds, NULL, &timeout); + ALCplaybackOSS_lock(self); + if(sret < 0) { - wrote = write(self->fd, WritePtr, len); + if(errno == EINTR) + continue; + ERR("select failed: %s\n", strerror(errno)); + aluHandleDisconnect(device, "Failed waiting for playback buffer: %s", strerror(errno)); + break; + } + else if(sret == 0) + { + WARN("select timeout\n"); + continue; + } + + write_ptr = self->mix_data; + to_write = self->data_size; + aluMixData(device, write_ptr, to_write/frame_size); + while(to_write > 0 && !ATOMIC_LOAD_SEQ(&self->killNow)) + { + wrote = write(self->fd, write_ptr, to_write); if(wrote < 0) { - if(errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR) - { - ERR("write failed: %s\n", strerror(errno)); - ALCplaybackOSS_lock(self); - aluHandleDisconnect(device); - ALCplaybackOSS_unlock(self); - break; - } - - al_nssleep(1000000); - continue; + if(errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) + continue; + ERR("write failed: %s\n", strerror(errno)); + aluHandleDisconnect(device, "Failed writing playback samples: %s", + strerror(errno)); + break; } - len -= wrote; - WritePtr += wrote; + to_write -= wrote; + write_ptr += wrote; } } + ALCplaybackOSS_unlock(self); return 0; } @@ -313,6 +339,18 @@ static void ALCplaybackOSS_Construct(ALCplaybackOSS *self, ALCdevice *device) { ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCplaybackOSS, ALCbackend, self); + + self->fd = -1; + ATOMIC_INIT(&self->killNow, AL_FALSE); +} + +static void ALCplaybackOSS_Destruct(ALCplaybackOSS *self) +{ + if(self->fd != -1) + close(self->fd); + self->fd = -1; + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } static ALCenum ALCplaybackOSS_open(ALCplaybackOSS *self, const ALCchar *name) @@ -320,22 +358,28 @@ static ALCenum ALCplaybackOSS_open(ALCplaybackOSS *self, const ALCchar *name) struct oss_device *dev = &oss_playback; ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - if(!name) + if(!name || strcmp(name, dev->handle) == 0) name = dev->handle; else { - while (dev != NULL) + if(!dev->next) + { + ALCossListPopulate(&oss_playback, DSP_CAP_OUTPUT); + dev = &oss_playback; + } + while(dev != NULL) { if (strcmp(dev->handle, name) == 0) break; dev = dev->next; } - if (dev == NULL) + if(dev == NULL) + { + WARN("Could not find \"%s\" in device list\n", name); return ALC_INVALID_VALUE; + } } - self->killNow = 0; - self->fd = open(dev->path, O_WRONLY); if(self->fd == -1) { @@ -343,17 +387,11 @@ static ALCenum ALCplaybackOSS_open(ALCplaybackOSS *self, const ALCchar *name) return ALC_INVALID_VALUE; } - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCplaybackOSS_close(ALCplaybackOSS *self) -{ - close(self->fd); - self->fd = -1; -} - static ALCboolean ALCplaybackOSS_reset(ALCplaybackOSS *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; @@ -387,18 +425,11 @@ static ALCboolean ALCplaybackOSS_reset(ALCplaybackOSS *self) } periods = device->NumUpdates; - numChannels = ChannelsFromDevFmt(device->FmtChans); - frameSize = numChannels * BytesFromDevFmt(device->FmtType); - + numChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); ossSpeed = device->Frequency; - log2FragmentSize = log2i(device->UpdateSize * frameSize); - - /* according to the OSS spec, 16 bytes are the minimum */ - if (log2FragmentSize < 4) - log2FragmentSize = 4; - /* Subtract one period since the temp mixing buffer counts as one. Still - * need at least two on the card, though. */ - if(periods > 2) periods--; + frameSize = numChannels * BytesFromDevFmt(device->FmtType); + /* According to the OSS spec, 16 bytes (log2(16)) is the minimum. */ + log2FragmentSize = maxi(log2i(device->UpdateSize*frameSize), 4); numFragmentsLogSize = (periods << 16) | log2FragmentSize; #define CHECKERR(func) if((func) < 0) { \ @@ -420,7 +451,7 @@ static ALCboolean ALCplaybackOSS_reset(ALCplaybackOSS *self) } #undef CHECKERR - if((int)ChannelsFromDevFmt(device->FmtChans) != numChannels) + if((int)ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder) != numChannels) { ERR("Failed to set %s, got %d channels instead\n", DevFmtChannelsString(device->FmtChans), numChannels); return ALC_FALSE; @@ -436,7 +467,7 @@ static ALCboolean ALCplaybackOSS_reset(ALCplaybackOSS *self) device->Frequency = ossSpeed; device->UpdateSize = info.fragsize / frameSize; - device->NumUpdates = info.fragments + 1; + device->NumUpdates = info.fragments; SetDefaultChannelOrder(device); @@ -447,10 +478,12 @@ static ALCboolean ALCplaybackOSS_start(ALCplaybackOSS *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - self->data_size = device->UpdateSize * FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + self->data_size = device->UpdateSize * FrameSizeFromDevFmt( + device->FmtChans, device->FmtType, device->AmbiOrder + ); self->mix_data = calloc(1, self->data_size); - self->killNow = 0; + ATOMIC_STORE_SEQ(&self->killNow, AL_FALSE); if(althrd_create(&self->thread, ALCplaybackOSS_mixerProc, self) != althrd_success) { free(self->mix_data); @@ -465,10 +498,8 @@ static void ALCplaybackOSS_stop(ALCplaybackOSS *self) { int res; - if(self->killNow) + if(ATOMIC_EXCHANGE_SEQ(&self->killNow, AL_TRUE)) return; - - self->killNow = 1; althrd_join(self->thread, &res); if(ioctl(self->fd, SNDCTL_DSP_RESET) != 0) @@ -485,18 +516,16 @@ typedef struct ALCcaptureOSS { int fd; ll_ringbuffer_t *ring; - int doCapture; - volatile int killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCcaptureOSS; static int ALCcaptureOSS_recordProc(void *ptr); static void ALCcaptureOSS_Construct(ALCcaptureOSS *self, ALCdevice *device); -static DECLARE_FORWARD(ALCcaptureOSS, ALCbackend, void, Destruct) +static void ALCcaptureOSS_Destruct(ALCcaptureOSS *self); static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name); -static void ALCcaptureOSS_close(ALCcaptureOSS *self); static DECLARE_FORWARD(ALCcaptureOSS, ALCbackend, ALCboolean, reset) static ALCboolean ALCcaptureOSS_start(ALCcaptureOSS *self); static void ALCcaptureOSS_stop(ALCcaptureOSS *self); @@ -513,41 +542,55 @@ static int ALCcaptureOSS_recordProc(void *ptr) { ALCcaptureOSS *self = (ALCcaptureOSS*)ptr; ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - int frameSize; + struct timeval timeout; + int frame_size; + fd_set rfds; ssize_t amt; + int sret; SetRTPriority(); althrd_setname(althrd_current(), RECORD_THREAD_NAME); - frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); - while(!self->killNow) + while(!ATOMIC_LOAD_SEQ(&self->killNow)) { ll_ringbuffer_data_t vec[2]; - amt = 0; - if(self->doCapture) + FD_ZERO(&rfds); + FD_SET(self->fd, &rfds); + timeout.tv_sec = 1; + timeout.tv_usec = 0; + + sret = select(self->fd+1, &rfds, NULL, NULL, &timeout); + if(sret < 0) { - ll_ringbuffer_get_write_vector(self->ring, vec); - if(vec[0].len > 0) - { - amt = read(self->fd, vec[0].buf, vec[0].len*frameSize); - if(amt < 0) - { - ERR("read failed: %s\n", strerror(errno)); - ALCcaptureOSS_lock(self); - aluHandleDisconnect(device); - ALCcaptureOSS_unlock(self); - break; - } - ll_ringbuffer_write_advance(self->ring, amt/frameSize); - } + if(errno == EINTR) + continue; + ERR("select failed: %s\n", strerror(errno)); + aluHandleDisconnect(device, "Failed to check capture samples: %s", strerror(errno)); + break; } - if(amt == 0) + else if(sret == 0) { - al_nssleep(1000000); + WARN("select timeout\n"); continue; } + + ll_ringbuffer_get_write_vector(self->ring, vec); + if(vec[0].len > 0) + { + amt = read(self->fd, vec[0].buf, vec[0].len*frame_size); + if(amt < 0) + { + ERR("read failed: %s\n", strerror(errno)); + ALCcaptureOSS_lock(self); + aluHandleDisconnect(device, "Failed reading capture samples: %s", strerror(errno)); + ALCcaptureOSS_unlock(self); + break; + } + ll_ringbuffer_write_advance(self->ring, amt/frame_size); + } } return 0; @@ -558,6 +601,21 @@ static void ALCcaptureOSS_Construct(ALCcaptureOSS *self, ALCdevice *device) { ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCcaptureOSS, ALCbackend, self); + + self->fd = -1; + self->ring = NULL; + ATOMIC_INIT(&self->killNow, AL_FALSE); +} + +static void ALCcaptureOSS_Destruct(ALCcaptureOSS *self) +{ + if(self->fd != -1) + close(self->fd); + self->fd = -1; + + ll_ringbuffer_free(self->ring); + self->ring = NULL; + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name) @@ -574,18 +632,26 @@ static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name) int ossSpeed; char *err; - if(!name) + if(!name || strcmp(name, dev->handle) == 0) name = dev->handle; else { - while (dev != NULL) + if(!dev->next) + { + ALCossListPopulate(&oss_capture, DSP_CAP_INPUT); + dev = &oss_capture; + } + while(dev != NULL) { if (strcmp(dev->handle, name) == 0) break; dev = dev->next; } - if (dev == NULL) + if(dev == NULL) + { + WARN("Could not find \"%s\" in device list\n", name); return ALC_INVALID_VALUE; + } } self->fd = open(dev->path, O_RDONLY); @@ -615,7 +681,7 @@ static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name) } periods = 4; - numChannels = ChannelsFromDevFmt(device->FmtChans); + numChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); frameSize = numChannels * BytesFromDevFmt(device->FmtType); ossSpeed = device->Frequency; log2FragmentSize = log2i(device->UpdateSize * device->NumUpdates * @@ -645,7 +711,7 @@ static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name) } #undef CHECKERR - if((int)ChannelsFromDevFmt(device->FmtChans) != numChannels) + if((int)ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder) != numChannels) { ERR("Failed to set %s, got %d channels instead\n", DevFmtChannelsString(device->FmtChans), numChannels); close(self->fd); @@ -663,7 +729,7 @@ static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name) return ALC_INVALID_VALUE; } - self->ring = ll_ringbuffer_create(device->UpdateSize*device->NumUpdates + 1, frameSize); + self->ring = ll_ringbuffer_create(device->UpdateSize*device->NumUpdates, frameSize, false); if(!self->ring) { ERR("Ring buffer create failed\n"); @@ -672,44 +738,30 @@ static ALCenum ALCcaptureOSS_open(ALCcaptureOSS *self, const ALCchar *name) return ALC_OUT_OF_MEMORY; } - self->killNow = 0; - if(althrd_create(&self->thread, ALCcaptureOSS_recordProc, self) != althrd_success) - { - ll_ringbuffer_free(self->ring); - self->ring = NULL; - close(self->fd); - self->fd = -1; - return ALC_OUT_OF_MEMORY; - } - - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCcaptureOSS_close(ALCcaptureOSS *self) -{ - int res; - - self->killNow = 1; - althrd_join(self->thread, &res); - - close(self->fd); - self->fd = -1; - - ll_ringbuffer_free(self->ring); - self->ring = NULL; -} - static ALCboolean ALCcaptureOSS_start(ALCcaptureOSS *self) { - self->doCapture = 1; + ATOMIC_STORE_SEQ(&self->killNow, AL_FALSE); + if(althrd_create(&self->thread, ALCcaptureOSS_recordProc, self) != althrd_success) + return ALC_FALSE; return ALC_TRUE; } static void ALCcaptureOSS_stop(ALCcaptureOSS *self) { - self->doCapture = 0; + int res; + + if(ATOMIC_EXCHANGE_SEQ(&self->killNow, AL_TRUE)) + return; + + althrd_join(self->thread, &res); + + if(ioctl(self->fd, SNDCTL_DSP_RESET) != 0) + ERR("Error resetting device: %s\n", strerror(errno)); } static ALCenum ALCcaptureOSS_captureSamples(ALCcaptureOSS *self, ALCvoid *buffer, ALCuint samples) @@ -770,33 +822,38 @@ ALCboolean ALCossBackendFactory_querySupport(ALCossBackendFactory* UNUSED(self), void ALCossBackendFactory_probe(ALCossBackendFactory* UNUSED(self), enum DevProbe type) { + struct oss_device *cur; switch(type) { case ALL_DEVICE_PROBE: - { - struct oss_device *cur = &oss_playback; - ALCossListFree(cur); - ALCossListPopulate(cur, NULL); - while (cur != NULL) + ALCossListFree(&oss_playback); + ALCossListPopulate(&oss_playback, DSP_CAP_OUTPUT); + cur = &oss_playback; + while(cur != NULL) { - AppendAllDevicesList(cur->handle); +#ifdef HAVE_STAT + struct stat buf; + if(stat(cur->path, &buf) == 0) +#endif + AppendAllDevicesList(cur->handle); cur = cur->next; } - } - break; + break; case CAPTURE_DEVICE_PROBE: - { - struct oss_device *cur = &oss_capture; - ALCossListFree(cur); - ALCossListPopulate(NULL, cur); - while (cur != NULL) + ALCossListFree(&oss_capture); + ALCossListPopulate(&oss_capture, DSP_CAP_INPUT); + cur = &oss_capture; + while(cur != NULL) { - AppendCaptureDeviceList(cur->handle); +#ifdef HAVE_STAT + struct stat buf; + if(stat(cur->path, &buf) == 0) +#endif + AppendCaptureDeviceList(cur->handle); cur = cur->next; } - } - break; + break; } } diff --git a/Engine/lib/openal-soft/Alc/backends/portaudio.c b/Engine/lib/openal-soft/Alc/backends/portaudio.c index 1dbca9416..9b0d34878 100644 --- a/Engine/lib/openal-soft/Alc/backends/portaudio.c +++ b/Engine/lib/openal-soft/Alc/backends/portaudio.c @@ -26,6 +26,8 @@ #include "alMain.h" #include "alu.h" +#include "alconfig.h" +#include "ringbuffer.h" #include "compat.h" #include "backends/base.h" @@ -139,7 +141,6 @@ static int ALCportPlayback_WriteCallback(const void *inputBuffer, void *outputBu static void ALCportPlayback_Construct(ALCportPlayback *self, ALCdevice *device); static void ALCportPlayback_Destruct(ALCportPlayback *self); static ALCenum ALCportPlayback_open(ALCportPlayback *self, const ALCchar *name); -static void ALCportPlayback_close(ALCportPlayback *self); static ALCboolean ALCportPlayback_reset(ALCportPlayback *self); static ALCboolean ALCportPlayback_start(ALCportPlayback *self); static void ALCportPlayback_stop(ALCportPlayback *self); @@ -163,8 +164,9 @@ static void ALCportPlayback_Construct(ALCportPlayback *self, ALCdevice *device) static void ALCportPlayback_Destruct(ALCportPlayback *self) { - if(self->stream) - Pa_CloseStream(self->stream); + PaError err = self->stream ? Pa_CloseStream(self->stream) : paNoError; + if(err != paNoError) + ERR("Error closing stream: %s\n", Pa_GetErrorText(err)); self->stream = NULL; ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); @@ -177,7 +179,9 @@ static int ALCportPlayback_WriteCallback(const void *UNUSED(inputBuffer), void * { ALCportPlayback *self = userData; + ALCportPlayback_lock(self); aluMixData(STATIC_CAST(ALCbackend, self)->mDevice, outputBuffer, framesPerBuffer); + ALCportPlayback_unlock(self); return 0; } @@ -243,20 +247,12 @@ retry_open: return ALC_INVALID_VALUE; } - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCportPlayback_close(ALCportPlayback *self) -{ - PaError err = Pa_CloseStream(self->stream); - if(err != paNoError) - ERR("Error closing stream: %s\n", Pa_GetErrorText(err)); - self->stream = NULL; -} - static ALCboolean ALCportPlayback_reset(ALCportPlayback *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; @@ -334,7 +330,6 @@ static int ALCportCapture_ReadCallback(const void *inputBuffer, void *outputBuff static void ALCportCapture_Construct(ALCportCapture *self, ALCdevice *device); static void ALCportCapture_Destruct(ALCportCapture *self); static ALCenum ALCportCapture_open(ALCportCapture *self, const ALCchar *name); -static void ALCportCapture_close(ALCportCapture *self); static DECLARE_FORWARD(ALCportCapture, ALCbackend, ALCboolean, reset) static ALCboolean ALCportCapture_start(ALCportCapture *self); static void ALCportCapture_stop(ALCportCapture *self); @@ -354,16 +349,17 @@ static void ALCportCapture_Construct(ALCportCapture *self, ALCdevice *device) SET_VTABLE2(ALCportCapture, ALCbackend, self); self->stream = NULL; + self->ring = NULL; } static void ALCportCapture_Destruct(ALCportCapture *self) { - if(self->stream) - Pa_CloseStream(self->stream); + PaError err = self->stream ? Pa_CloseStream(self->stream) : paNoError; + if(err != paNoError) + ERR("Error closing stream: %s\n", Pa_GetErrorText(err)); self->stream = NULL; - if(self->ring) - ll_ringbuffer_free(self->ring); + ll_ringbuffer_free(self->ring); self->ring = NULL; ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); @@ -397,9 +393,9 @@ static ALCenum ALCportCapture_open(ALCportCapture *self, const ALCchar *name) samples = device->UpdateSize * device->NumUpdates; samples = maxu(samples, 100 * device->Frequency / 1000); - frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); - self->ring = ll_ringbuffer_create(samples, frame_size); + self->ring = ll_ringbuffer_create(samples, frame_size, false); if(self->ring == NULL) return ALC_INVALID_VALUE; self->params.device = -1; @@ -431,7 +427,7 @@ static ALCenum ALCportCapture_open(ALCportCapture *self, const ALCchar *name) ERR("%s samples not supported\n", DevFmtTypeString(device->FmtType)); return ALC_INVALID_VALUE; } - self->params.channelCount = ChannelsFromDevFmt(device->FmtChans); + self->params.channelCount = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); err = Pa_OpenStream(&self->stream, &self->params, NULL, device->Frequency, paFramesPerBufferUnspecified, paNoFlag, @@ -443,22 +439,11 @@ static ALCenum ALCportCapture_open(ALCportCapture *self, const ALCchar *name) return ALC_INVALID_VALUE; } - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCportCapture_close(ALCportCapture *self) -{ - PaError err = Pa_CloseStream(self->stream); - if(err != paNoError) - ERR("Error closing stream: %s\n", Pa_GetErrorText(err)); - self->stream = NULL; - - ll_ringbuffer_free(self->ring); - self->ring = NULL; -} - static ALCboolean ALCportCapture_start(ALCportCapture *self) { diff --git a/Engine/lib/openal-soft/Alc/backends/pulseaudio.c b/Engine/lib/openal-soft/Alc/backends/pulseaudio.c index f46386e4f..74d1a1492 100644 --- a/Engine/lib/openal-soft/Alc/backends/pulseaudio.c +++ b/Engine/lib/openal-soft/Alc/backends/pulseaudio.c @@ -25,6 +25,7 @@ #include "alMain.h" #include "alu.h" +#include "alconfig.h" #include "threads.h" #include "compat.h" @@ -182,6 +183,8 @@ static ALCboolean pulse_load(void) #ifdef HAVE_DYNLOAD if(!pa_handle) { + al_string missing_funcs = AL_STRING_INIT_STATIC(); + #ifdef _WIN32 #define PALIB "libpulse-0.dll" #elif defined(__APPLE__) && defined(__MACH__) @@ -191,12 +194,16 @@ static ALCboolean pulse_load(void) #endif pa_handle = LoadLib(PALIB); if(!pa_handle) + { + WARN("Failed to load %s\n", PALIB); return ALC_FALSE; + } #define LOAD_FUNC(x) do { \ p##x = GetSymbol(pa_handle, #x); \ if(!(p##x)) { \ ret = ALC_FALSE; \ + alstr_append_cstr(&missing_funcs, "\n" #x); \ } \ } while(0) LOAD_FUNC(pa_context_unref); @@ -270,9 +277,11 @@ static ALCboolean pulse_load(void) if(ret == ALC_FALSE) { + WARN("Missing expected functions:%s\n", alstr_get_cstr(missing_funcs)); CloseLib(pa_handle); pa_handle = NULL; } + alstr_reset(&missing_funcs); } #endif /* HAVE_DYNLOAD */ return ret; @@ -325,18 +334,20 @@ static void wait_for_operation(pa_operation *op, pa_threaded_mainloop *loop) static pa_context *connect_context(pa_threaded_mainloop *loop, ALboolean silent) { const char *name = "OpenAL Soft"; - char path_name[PATH_MAX]; + al_string binname = AL_STRING_INIT_STATIC(); pa_context_state_t state; pa_context *context; int err; - if(pa_get_binary_name(path_name, sizeof(path_name))) - name = pa_path_get_filename(path_name); + GetProcBinary(NULL, &binname); + if(!alstr_empty(binname)) + name = alstr_get_cstr(binname); context = pa_context_new(pa_threaded_mainloop_get_api(loop), name); if(!context) { ERR("pa_context_new() failed\n"); + alstr_reset(&binname); return NULL; } @@ -363,9 +374,10 @@ static pa_context *connect_context(pa_threaded_mainloop *loop, ALboolean silent) if(!silent) ERR("Context did not connect: %s\n", pa_strerror(err)); pa_context_unref(context); - return NULL; + context = NULL; } + alstr_reset(&binname); return context; } @@ -460,7 +472,7 @@ typedef struct ALCpulsePlayback { pa_stream *stream; pa_context *context; - volatile ALboolean killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCpulsePlayback; @@ -483,7 +495,6 @@ static int ALCpulsePlayback_mixerProc(void *ptr); static void ALCpulsePlayback_Construct(ALCpulsePlayback *self, ALCdevice *device); static void ALCpulsePlayback_Destruct(ALCpulsePlayback *self); static ALCenum ALCpulsePlayback_open(ALCpulsePlayback *self, const ALCchar *name); -static void ALCpulsePlayback_close(ALCpulsePlayback *self); static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self); static ALCboolean ALCpulsePlayback_start(ALCpulsePlayback *self); static void ALCpulsePlayback_stop(ALCpulsePlayback *self); @@ -502,11 +513,20 @@ static void ALCpulsePlayback_Construct(ALCpulsePlayback *self, ALCdevice *device ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCpulsePlayback, ALCbackend, self); + self->loop = NULL; AL_STRING_INIT(self->device_name); + ATOMIC_INIT(&self->killNow, AL_TRUE); } static void ALCpulsePlayback_Destruct(ALCpulsePlayback *self) { + if(self->loop) + { + pulse_close(self->loop, self->context, self->stream); + self->loop = NULL; + self->context = NULL; + self->stream = NULL; + } AL_STRING_DEINIT(self->device_name); ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } @@ -525,7 +545,7 @@ static void ALCpulsePlayback_deviceCallback(pa_context *UNUSED(context), const p return; } -#define MATCH_INFO_NAME(iter) (al_string_cmp_cstr((iter)->device_name, info->name) == 0) +#define MATCH_INFO_NAME(iter) (alstr_cmp_cstr((iter)->device_name, info->name) == 0) VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_INFO_NAME); if(iter != VECTOR_END(PlaybackDevices)) return; #undef MATCH_INFO_NAME @@ -533,27 +553,27 @@ static void ALCpulsePlayback_deviceCallback(pa_context *UNUSED(context), const p AL_STRING_INIT(entry.name); AL_STRING_INIT(entry.device_name); - al_string_copy_cstr(&entry.device_name, info->name); + alstr_copy_cstr(&entry.device_name, info->name); count = 0; while(1) { - al_string_copy_cstr(&entry.name, info->description); + alstr_copy_cstr(&entry.name, info->description); if(count != 0) { char str[64]; snprintf(str, sizeof(str), " #%d", count+1); - al_string_append_cstr(&entry.name, str); + alstr_append_cstr(&entry.name, str); } -#define MATCH_ENTRY(i) (al_string_cmp(entry.name, (i)->name) == 0) +#define MATCH_ENTRY(i) (alstr_cmp(entry.name, (i)->name) == 0) VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_ENTRY); if(iter == VECTOR_END(PlaybackDevices)) break; #undef MATCH_ENTRY count++; } - TRACE("Got device \"%s\", \"%s\"\n", al_string_get_cstr(entry.name), al_string_get_cstr(entry.device_name)); + TRACE("Got device \"%s\", \"%s\"\n", alstr_get_cstr(entry.name), alstr_get_cstr(entry.device_name)); VECTOR_PUSH_BACK(PlaybackDevices, entry); } @@ -618,6 +638,11 @@ static void ALCpulsePlayback_bufferAttrCallback(pa_stream *stream, void *pdata) self->attr = *pa_stream_get_buffer_attr(stream); TRACE("minreq=%d, tlength=%d, prebuf=%d\n", self->attr.minreq, self->attr.tlength, self->attr.prebuf); + /* FIXME: Update the device's UpdateSize (and/or NumUpdates) using the new + * buffer attributes? Changing UpdateSize will change the ALC_REFRESH + * property, which probably shouldn't change between device resets. But + * leaving it alone means ALC_REFRESH will be off. + */ } static void ALCpulsePlayback_contextStateCallback(pa_context *context, void *pdata) @@ -626,7 +651,7 @@ static void ALCpulsePlayback_contextStateCallback(pa_context *context, void *pda if(pa_context_get_state(context) == PA_CONTEXT_FAILED) { ERR("Received context failure!\n"); - aluHandleDisconnect(STATIC_CAST(ALCbackend,self)->mDevice); + aluHandleDisconnect(STATIC_CAST(ALCbackend,self)->mDevice, "Playback state failure"); } pa_threaded_mainloop_signal(self->loop, 0); } @@ -637,7 +662,7 @@ static void ALCpulsePlayback_streamStateCallback(pa_stream *stream, void *pdata) if(pa_stream_get_state(stream) == PA_STREAM_FAILED) { ERR("Received stream failure!\n"); - aluHandleDisconnect(STATIC_CAST(ALCbackend,self)->mDevice); + aluHandleDisconnect(STATIC_CAST(ALCbackend,self)->mDevice, "Playback stream failure"); } pa_threaded_mainloop_signal(self->loop, 0); } @@ -729,7 +754,7 @@ static void ALCpulsePlayback_sinkNameCallback(pa_context *UNUSED(context), const return; } - al_string_copy_cstr(&device->DeviceName, info->description); + alstr_copy_cstr(&device->DeviceName, info->description); } @@ -737,9 +762,9 @@ static void ALCpulsePlayback_streamMovedCallback(pa_stream *stream, void *pdata) { ALCpulsePlayback *self = pdata; - al_string_copy_cstr(&self->device_name, pa_stream_get_device_name(stream)); + alstr_copy_cstr(&self->device_name, pa_stream_get_device_name(stream)); - TRACE("Stream moved to %s\n", al_string_get_cstr(self->device_name)); + TRACE("Stream moved to %s\n", alstr_get_cstr(self->device_name)); } @@ -751,6 +776,13 @@ static pa_stream *ALCpulsePlayback_connectStream(const char *device_name, pa_stream_state_t state; pa_stream *stream; + if(!device_name) + { + device_name = getenv("ALSOFT_PULSE_DEFAULT"); + if(device_name && !device_name[0]) + device_name = NULL; + } + stream = pa_stream_new_with_proplist(context, "Playback Stream", spec, chanmap, prop_filter); if(!stream) { @@ -789,7 +821,6 @@ static int ALCpulsePlayback_mixerProc(void *ptr) ALCpulsePlayback *self = ptr; ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; ALuint buffer_size; - ALint update_size; size_t frame_size; ssize_t len; @@ -798,18 +829,35 @@ static int ALCpulsePlayback_mixerProc(void *ptr) pa_threaded_mainloop_lock(self->loop); frame_size = pa_frame_size(&self->spec); - update_size = device->UpdateSize * frame_size; - /* Sanitize buffer metrics, in case we actually have less than what we - * asked for. */ - buffer_size = minu(update_size*device->NumUpdates, self->attr.tlength); - update_size = minu(update_size, buffer_size/2); - do { - len = pa_stream_writable_size(self->stream) - self->attr.tlength + - buffer_size; - if(len < update_size) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) && + ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) + { + void *buf; + int ret; + + len = pa_stream_writable_size(self->stream); + if(len < 0) { - if(pa_stream_is_corked(self->stream) == 1) + ERR("Failed to get writable size: %ld", (long)len); + aluHandleDisconnect(device, "Failed to get writable size: %ld", (long)len); + break; + } + + /* Make sure we're going to write at least 2 'periods' (minreqs), in + * case the server increased it since starting playback. Also round up + * the number of writable periods if it's not an integer count. + */ + buffer_size = maxu((self->attr.tlength + self->attr.minreq/2) / self->attr.minreq, 2) * + self->attr.minreq; + + /* NOTE: This assumes pa_stream_writable_size returns between 0 and + * tlength, else there will be more latency than intended. + */ + len = mini(len - (ssize_t)self->attr.tlength, 0) + buffer_size; + if(len < (int32_t)self->attr.minreq) + { + if(pa_stream_is_corked(self->stream)) { pa_operation *o; o = pa_stream_cork(self->stream, 0, NULL, NULL); @@ -818,26 +866,17 @@ static int ALCpulsePlayback_mixerProc(void *ptr) pa_threaded_mainloop_wait(self->loop); continue; } - len -= len%update_size; - while(len > 0) - { - size_t newlen = len; - void *buf; - pa_free_cb_t free_func = NULL; + len -= len%self->attr.minreq; + len -= len%frame_size; - if(pa_stream_begin_write(self->stream, &buf, &newlen) < 0) - { - buf = pa_xmalloc(newlen); - free_func = pa_xfree; - } + buf = pa_xmalloc(len); - aluMixData(device, buf, newlen/frame_size); + aluMixData(device, buf, len/frame_size); - pa_stream_write(self->stream, buf, newlen, free_func, 0, PA_SEEK_RELATIVE); - len -= newlen; - } - } while(!self->killNow && device->Connected); + ret = pa_stream_write(self->stream, buf, len, pa_xfree, 0, PA_SEEK_RELATIVE); + if(ret != PA_OK) ERR("Failed to write to stream: %d, %s\n", ret, pa_strerror(ret)); + } pa_threaded_mainloop_unlock(self->loop); return 0; @@ -858,12 +897,12 @@ static ALCenum ALCpulsePlayback_open(ALCpulsePlayback *self, const ALCchar *name if(VECTOR_SIZE(PlaybackDevices) == 0) ALCpulsePlayback_probeDevices(); -#define MATCH_NAME(iter) (al_string_cmp_cstr((iter)->name, name) == 0) +#define MATCH_NAME(iter) (alstr_cmp_cstr((iter)->name, name) == 0) VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_NAME); #undef MATCH_NAME if(iter == VECTOR_END(PlaybackDevices)) return ALC_INVALID_VALUE; - pulse_name = al_string_get_cstr(iter->device_name); + pulse_name = alstr_get_cstr(iter->device_name); dev_name = iter->name; } @@ -894,11 +933,11 @@ static ALCenum ALCpulsePlayback_open(ALCpulsePlayback *self, const ALCchar *name } pa_stream_set_moved_callback(self->stream, ALCpulsePlayback_streamMovedCallback, self); - al_string_copy_cstr(&self->device_name, pa_stream_get_device_name(self->stream)); - if(al_string_empty(dev_name)) + alstr_copy_cstr(&self->device_name, pa_stream_get_device_name(self->stream)); + if(alstr_empty(dev_name)) { pa_operation *o = pa_context_get_sink_info_by_name( - self->context, al_string_get_cstr(self->device_name), + self->context, alstr_get_cstr(self->device_name), ALCpulsePlayback_sinkNameCallback, self ); wait_for_operation(o, self->loop); @@ -906,7 +945,7 @@ static ALCenum ALCpulsePlayback_open(ALCpulsePlayback *self, const ALCchar *name else { ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; - al_string_copy(&device->DeviceName, dev_name); + alstr_copy(&device->DeviceName, dev_name); } pa_threaded_mainloop_unlock(self->loop); @@ -914,16 +953,6 @@ static ALCenum ALCpulsePlayback_open(ALCpulsePlayback *self, const ALCchar *name return ALC_NO_ERROR; } -static void ALCpulsePlayback_close(ALCpulsePlayback *self) -{ - pulse_close(self->loop, self->context, self->stream); - self->loop = NULL; - self->context = NULL; - self->stream = NULL; - - al_string_clear(&self->device_name); -} - static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) { ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; @@ -931,7 +960,6 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) const char *mapname = NULL; pa_channel_map chanmap; pa_operation *o; - ALuint len; pa_threaded_mainloop_lock(self->loop); @@ -946,11 +974,11 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) self->stream = NULL; } - o = pa_context_get_sink_info_by_name(self->context, al_string_get_cstr(self->device_name), + o = pa_context_get_sink_info_by_name(self->context, alstr_get_cstr(self->device_name), ALCpulsePlayback_sinkInfoCallback, self); wait_for_operation(o, self->loop); - if(GetConfigValueBool(al_string_get_cstr(device->DeviceName), "pulse", "fix-rate", 0) || + if(GetConfigValueBool(alstr_get_cstr(device->DeviceName), "pulse", "fix-rate", 0) || !(device->Flags&DEVICE_FREQUENCY_REQUEST)) flags |= PA_STREAM_FIX_RATE; flags |= PA_STREAM_INTERPOLATE_TIMING | PA_STREAM_AUTO_TIMING_UPDATE; @@ -984,7 +1012,7 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) break; } self->spec.rate = device->Frequency; - self->spec.channels = ChannelsFromDevFmt(device->FmtChans); + self->spec.channels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); if(pa_sample_spec_valid(&self->spec) == 0) { @@ -998,9 +1026,7 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) case DevFmtMono: mapname = "mono"; break; - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: device->FmtChans = DevFmtStereo; /*fall-through*/ case DevFmtStereo: @@ -1036,9 +1062,9 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) self->attr.tlength = self->attr.minreq * maxu(device->NumUpdates, 2); self->attr.maxlength = -1; - self->stream = ALCpulsePlayback_connectStream(al_string_get_cstr(self->device_name), - self->loop, self->context, flags, - &self->attr, &self->spec, &chanmap); + self->stream = ALCpulsePlayback_connectStream(alstr_get_cstr(self->device_name), + self->loop, self->context, flags, &self->attr, &self->spec, &chanmap + ); if(!self->stream) { pa_threaded_mainloop_unlock(self->loop); @@ -1072,11 +1098,10 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) pa_stream_set_buffer_attr_callback(self->stream, ALCpulsePlayback_bufferAttrCallback, self); ALCpulsePlayback_bufferAttrCallback(self->stream, self); - len = self->attr.minreq / pa_frame_size(&self->spec); - device->NumUpdates = (ALuint)clampd( - (ALdouble)device->NumUpdates/len*device->UpdateSize + 0.5, 2.0, 16.0 + device->NumUpdates = (ALuint)clampu64( + (self->attr.tlength + self->attr.minreq/2) / self->attr.minreq, 2, 16 ); - device->UpdateSize = len; + device->UpdateSize = self->attr.minreq / pa_frame_size(&self->spec); /* HACK: prebuf should be 0 as that's what we set it to. However on some * systems it comes back as non-0, so we have to make sure the device will @@ -1086,7 +1111,7 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) */ if(self->attr.prebuf != 0) { - len = self->attr.prebuf / pa_frame_size(&self->spec); + ALuint len = self->attr.prebuf / pa_frame_size(&self->spec); if(len <= device->UpdateSize*device->NumUpdates) ERR("Non-0 prebuf, %u samples (%u bytes), device has %u samples\n", len, self->attr.prebuf, device->UpdateSize*device->NumUpdates); @@ -1104,7 +1129,7 @@ static ALCboolean ALCpulsePlayback_reset(ALCpulsePlayback *self) static ALCboolean ALCpulsePlayback_start(ALCpulsePlayback *self) { - self->killNow = AL_FALSE; + ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); if(althrd_create(&self->thread, ALCpulsePlayback_mixerProc, self) != althrd_success) return ALC_FALSE; return ALC_TRUE; @@ -1115,10 +1140,9 @@ static void ALCpulsePlayback_stop(ALCpulsePlayback *self) pa_operation *o; int res; - if(!self->stream || self->killNow) + if(!self->stream || ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) return; - self->killNow = AL_TRUE; /* Signal the main loop in case PulseAudio isn't sending us audio requests * (e.g. if the device is suspended). We need to lock the mainloop in case * the mixer is between checking the killNow flag but before waiting for @@ -1140,13 +1164,16 @@ static void ALCpulsePlayback_stop(ALCpulsePlayback *self) static ClockLatency ALCpulsePlayback_getClockLatency(ALCpulsePlayback *self) { - pa_usec_t latency = 0; ClockLatency ret; + pa_usec_t latency; int neg, err; pa_threaded_mainloop_lock(self->loop); ret.ClockTime = GetDeviceClockTime(STATIC_CAST(ALCbackend,self)->mDevice); - if((err=pa_stream_get_latency(self->stream, &latency, &neg)) != 0) + err = pa_stream_get_latency(self->stream, &latency, &neg); + pa_threaded_mainloop_unlock(self->loop); + + if(UNLIKELY(err != 0)) { /* FIXME: if err = -PA_ERR_NODATA, it means we were called too soon * after starting the stream and no timing info has been received from @@ -1157,9 +1184,9 @@ static ClockLatency ALCpulsePlayback_getClockLatency(ALCpulsePlayback *self) latency = 0; neg = 0; } - if(neg) latency = 0; - ret.Latency = minu64(latency, U64(0xffffffffffffffff)/1000) * 1000; - pa_threaded_mainloop_unlock(self->loop); + else if(UNLIKELY(neg)) + latency = 0; + ret.Latency = (ALint64)minu64(latency, U64(0x7fffffffffffffff)/1000) * 1000; return ret; } @@ -1211,7 +1238,6 @@ static pa_stream *ALCpulseCapture_connectStream(const char *device_name, static void ALCpulseCapture_Construct(ALCpulseCapture *self, ALCdevice *device); static void ALCpulseCapture_Destruct(ALCpulseCapture *self); static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name); -static void ALCpulseCapture_close(ALCpulseCapture *self); static DECLARE_FORWARD(ALCpulseCapture, ALCbackend, ALCboolean, reset) static ALCboolean ALCpulseCapture_start(ALCpulseCapture *self); static void ALCpulseCapture_stop(ALCpulseCapture *self); @@ -1230,11 +1256,19 @@ static void ALCpulseCapture_Construct(ALCpulseCapture *self, ALCdevice *device) ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); SET_VTABLE2(ALCpulseCapture, ALCbackend, self); + self->loop = NULL; AL_STRING_INIT(self->device_name); } static void ALCpulseCapture_Destruct(ALCpulseCapture *self) { + if(self->loop) + { + pulse_close(self->loop, self->context, self->stream); + self->loop = NULL; + self->context = NULL; + self->stream = NULL; + } AL_STRING_DEINIT(self->device_name); ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } @@ -1253,7 +1287,7 @@ static void ALCpulseCapture_deviceCallback(pa_context *UNUSED(context), const pa return; } -#define MATCH_INFO_NAME(iter) (al_string_cmp_cstr((iter)->device_name, info->name) == 0) +#define MATCH_INFO_NAME(iter) (alstr_cmp_cstr((iter)->device_name, info->name) == 0) VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_INFO_NAME); if(iter != VECTOR_END(CaptureDevices)) return; #undef MATCH_INFO_NAME @@ -1261,27 +1295,27 @@ static void ALCpulseCapture_deviceCallback(pa_context *UNUSED(context), const pa AL_STRING_INIT(entry.name); AL_STRING_INIT(entry.device_name); - al_string_copy_cstr(&entry.device_name, info->name); + alstr_copy_cstr(&entry.device_name, info->name); count = 0; while(1) { - al_string_copy_cstr(&entry.name, info->description); + alstr_copy_cstr(&entry.name, info->description); if(count != 0) { char str[64]; snprintf(str, sizeof(str), " #%d", count+1); - al_string_append_cstr(&entry.name, str); + alstr_append_cstr(&entry.name, str); } -#define MATCH_ENTRY(i) (al_string_cmp(entry.name, (i)->name) == 0) +#define MATCH_ENTRY(i) (alstr_cmp(entry.name, (i)->name) == 0) VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_ENTRY); if(iter == VECTOR_END(CaptureDevices)) break; #undef MATCH_ENTRY count++; } - TRACE("Got device \"%s\", \"%s\"\n", al_string_get_cstr(entry.name), al_string_get_cstr(entry.device_name)); + TRACE("Got device \"%s\", \"%s\"\n", alstr_get_cstr(entry.name), alstr_get_cstr(entry.device_name)); VECTOR_PUSH_BACK(CaptureDevices, entry); } @@ -1346,7 +1380,7 @@ static void ALCpulseCapture_contextStateCallback(pa_context *context, void *pdat if(pa_context_get_state(context) == PA_CONTEXT_FAILED) { ERR("Received context failure!\n"); - aluHandleDisconnect(STATIC_CAST(ALCbackend,self)->mDevice); + aluHandleDisconnect(STATIC_CAST(ALCbackend,self)->mDevice, "Capture state failure"); } pa_threaded_mainloop_signal(self->loop, 0); } @@ -1357,7 +1391,7 @@ static void ALCpulseCapture_streamStateCallback(pa_stream *stream, void *pdata) if(pa_stream_get_state(stream) == PA_STREAM_FAILED) { ERR("Received stream failure!\n"); - aluHandleDisconnect(STATIC_CAST(ALCbackend,self)->mDevice); + aluHandleDisconnect(STATIC_CAST(ALCbackend,self)->mDevice, "Capture stream failure"); } pa_threaded_mainloop_signal(self->loop, 0); } @@ -1374,7 +1408,7 @@ static void ALCpulseCapture_sourceNameCallback(pa_context *UNUSED(context), cons return; } - al_string_copy_cstr(&device->DeviceName, info->description); + alstr_copy_cstr(&device->DeviceName, info->description); } @@ -1382,9 +1416,9 @@ static void ALCpulseCapture_streamMovedCallback(pa_stream *stream, void *pdata) { ALCpulseCapture *self = pdata; - al_string_copy_cstr(&self->device_name, pa_stream_get_device_name(stream)); + alstr_copy_cstr(&self->device_name, pa_stream_get_device_name(stream)); - TRACE("Stream moved to %s\n", al_string_get_cstr(self->device_name)); + TRACE("Stream moved to %s\n", alstr_get_cstr(self->device_name)); } @@ -1434,6 +1468,7 @@ static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name) ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; const char *pulse_name = NULL; pa_stream_flags_t flags = 0; + const char *mapname = NULL; pa_channel_map chanmap; ALuint samples; @@ -1444,13 +1479,13 @@ static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name) if(VECTOR_SIZE(CaptureDevices) == 0) ALCpulseCapture_probeDevices(); -#define MATCH_NAME(iter) (al_string_cmp_cstr((iter)->name, name) == 0) +#define MATCH_NAME(iter) (alstr_cmp_cstr((iter)->name, name) == 0) VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_NAME); #undef MATCH_NAME if(iter == VECTOR_END(CaptureDevices)) return ALC_INVALID_VALUE; - pulse_name = al_string_get_cstr(iter->device_name); - al_string_copy(&device->DeviceName, iter->name); + pulse_name = alstr_get_cstr(iter->device_name); + alstr_copy(&device->DeviceName, iter->name); } if(!pulse_open(&self->loop, &self->context, ALCpulseCapture_contextStateCallback, self)) @@ -1458,9 +1493,6 @@ static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name) pa_threaded_mainloop_lock(self->loop); - self->spec.rate = device->Frequency; - self->spec.channels = ChannelsFromDevFmt(device->FmtChans); - switch(device->FmtType) { case DevFmtUByte: @@ -1483,6 +1515,44 @@ static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name) goto fail; } + switch(device->FmtChans) + { + case DevFmtMono: + mapname = "mono"; + break; + case DevFmtStereo: + mapname = "front-left,front-right"; + break; + case DevFmtQuad: + mapname = "front-left,front-right,rear-left,rear-right"; + break; + case DevFmtX51: + mapname = "front-left,front-right,front-center,lfe,side-left,side-right"; + break; + case DevFmtX51Rear: + mapname = "front-left,front-right,front-center,lfe,rear-left,rear-right"; + break; + case DevFmtX61: + mapname = "front-left,front-right,front-center,lfe,rear-center,side-left,side-right"; + break; + case DevFmtX71: + mapname = "front-left,front-right,front-center,lfe,rear-left,rear-right,side-left,side-right"; + break; + case DevFmtAmbi3D: + ERR("%s capture samples not supported\n", DevFmtChannelsString(device->FmtChans)); + pa_threaded_mainloop_unlock(self->loop); + goto fail; + } + if(!pa_channel_map_parse(&chanmap, mapname)) + { + ERR("Failed to build channel map for %s\n", DevFmtChannelsString(device->FmtChans)); + pa_threaded_mainloop_unlock(self->loop); + return ALC_FALSE; + } + + self->spec.rate = device->Frequency; + self->spec.channels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); + if(pa_sample_spec_valid(&self->spec) == 0) { ERR("Invalid sample format\n"); @@ -1512,9 +1582,9 @@ static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name) flags |= PA_STREAM_DONT_MOVE; TRACE("Connecting to \"%s\"\n", pulse_name ? pulse_name : "(default)"); - self->stream = ALCpulseCapture_connectStream(pulse_name, self->loop, self->context, - flags, &self->attr, &self->spec, - &chanmap); + self->stream = ALCpulseCapture_connectStream(pulse_name, + self->loop, self->context, flags, &self->attr, &self->spec, &chanmap + ); if(!self->stream) { pa_threaded_mainloop_unlock(self->loop); @@ -1523,11 +1593,11 @@ static ALCenum ALCpulseCapture_open(ALCpulseCapture *self, const ALCchar *name) pa_stream_set_moved_callback(self->stream, ALCpulseCapture_streamMovedCallback, self); pa_stream_set_state_callback(self->stream, ALCpulseCapture_streamStateCallback, self); - al_string_copy_cstr(&self->device_name, pa_stream_get_device_name(self->stream)); - if(al_string_empty(device->DeviceName)) + alstr_copy_cstr(&self->device_name, pa_stream_get_device_name(self->stream)); + if(alstr_empty(device->DeviceName)) { pa_operation *o = pa_context_get_source_info_by_name( - self->context, al_string_get_cstr(self->device_name), + self->context, alstr_get_cstr(self->device_name), ALCpulseCapture_sourceNameCallback, self ); wait_for_operation(o, self->loop); @@ -1545,30 +1615,23 @@ fail: return ALC_INVALID_VALUE; } -static void ALCpulseCapture_close(ALCpulseCapture *self) -{ - pulse_close(self->loop, self->context, self->stream); - self->loop = NULL; - self->context = NULL; - self->stream = NULL; - - al_string_clear(&self->device_name); -} - static ALCboolean ALCpulseCapture_start(ALCpulseCapture *self) { pa_operation *o; + pa_threaded_mainloop_lock(self->loop); o = pa_stream_cork(self->stream, 0, stream_success_callback, self->loop); wait_for_operation(o, self->loop); - + pa_threaded_mainloop_unlock(self->loop); return ALC_TRUE; } static void ALCpulseCapture_stop(ALCpulseCapture *self) { pa_operation *o; + pa_threaded_mainloop_lock(self->loop); o = pa_stream_cork(self->stream, 1, stream_success_callback, self->loop); wait_for_operation(o, self->loop); + pa_threaded_mainloop_unlock(self->loop); } static ALCenum ALCpulseCapture_captureSamples(ALCpulseCapture *self, ALCvoid *buffer, ALCuint samples) @@ -1579,6 +1642,7 @@ static ALCenum ALCpulseCapture_captureSamples(ALCpulseCapture *self, ALCvoid *bu /* Capture is done in fragment-sized chunks, so we loop until we get all * that's available */ self->last_readable -= todo; + pa_threaded_mainloop_lock(self->loop); while(todo > 0) { size_t rem = todo; @@ -1590,14 +1654,15 @@ static ALCenum ALCpulseCapture_captureSamples(ALCpulseCapture *self, ALCvoid *bu state = pa_stream_get_state(self->stream); if(!PA_STREAM_IS_GOOD(state)) { - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Bad capture state: %u", state); break; } if(pa_stream_peek(self->stream, &self->cap_store, &self->cap_len) < 0) { ERR("pa_stream_peek() failed: %s\n", pa_strerror(pa_context_errno(self->context))); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed retrieving capture samples: %s", + pa_strerror(pa_context_errno(self->context))); break; } self->cap_remain = self->cap_len; @@ -1618,6 +1683,7 @@ static ALCenum ALCpulseCapture_captureSamples(ALCpulseCapture *self, ALCvoid *bu self->cap_len = 0; } } + pa_threaded_mainloop_unlock(self->loop); if(todo > 0) memset(buffer, ((device->FmtType==DevFmtUByte) ? 0x80 : 0), todo); @@ -1629,16 +1695,19 @@ static ALCuint ALCpulseCapture_availableSamples(ALCpulseCapture *self) ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; size_t readable = self->cap_remain; - if(device->Connected) + if(ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) { - ssize_t got = pa_stream_readable_size(self->stream); + ssize_t got; + pa_threaded_mainloop_lock(self->loop); + got = pa_stream_readable_size(self->stream); if(got < 0) { ERR("pa_stream_readable_size() failed: %s\n", pa_strerror(got)); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed getting readable size: %s", pa_strerror(got)); } else if((size_t)got > self->cap_len) readable += got - self->cap_len; + pa_threaded_mainloop_unlock(self->loop); } if(self->last_readable < readable) @@ -1649,21 +1718,24 @@ static ALCuint ALCpulseCapture_availableSamples(ALCpulseCapture *self) static ClockLatency ALCpulseCapture_getClockLatency(ALCpulseCapture *self) { - pa_usec_t latency = 0; ClockLatency ret; + pa_usec_t latency; int neg, err; pa_threaded_mainloop_lock(self->loop); ret.ClockTime = GetDeviceClockTime(STATIC_CAST(ALCbackend,self)->mDevice); - if((err=pa_stream_get_latency(self->stream, &latency, &neg)) != 0) + err = pa_stream_get_latency(self->stream, &latency, &neg); + pa_threaded_mainloop_unlock(self->loop); + + if(UNLIKELY(err != 0)) { ERR("Failed to get stream latency: 0x%x\n", err); latency = 0; neg = 0; } - if(neg) latency = 0; - ret.Latency = minu64(latency, U64(0xffffffffffffffff)/1000) * 1000; - pa_threaded_mainloop_unlock(self->loop); + else if(UNLIKELY(neg)) + latency = 0; + ret.Latency = (ALint64)minu64(latency, U64(0x7fffffffffffffff)/1000) * 1000; return ret; } @@ -1769,14 +1841,14 @@ static void ALCpulseBackendFactory_probe(ALCpulseBackendFactory* UNUSED(self), e { case ALL_DEVICE_PROBE: ALCpulsePlayback_probeDevices(); -#define APPEND_ALL_DEVICES_LIST(e) AppendAllDevicesList(al_string_get_cstr((e)->name)) +#define APPEND_ALL_DEVICES_LIST(e) AppendAllDevicesList(alstr_get_cstr((e)->name)) VECTOR_FOR_EACH(const DevMap, PlaybackDevices, APPEND_ALL_DEVICES_LIST); #undef APPEND_ALL_DEVICES_LIST break; case CAPTURE_DEVICE_PROBE: ALCpulseCapture_probeDevices(); -#define APPEND_CAPTURE_DEVICE_LIST(e) AppendCaptureDeviceList(al_string_get_cstr((e)->name)) +#define APPEND_CAPTURE_DEVICE_LIST(e) AppendCaptureDeviceList(alstr_get_cstr((e)->name)) VECTOR_FOR_EACH(const DevMap, CaptureDevices, APPEND_CAPTURE_DEVICE_LIST); #undef APPEND_CAPTURE_DEVICE_LIST break; diff --git a/Engine/lib/openal-soft/Alc/backends/qsa.c b/Engine/lib/openal-soft/Alc/backends/qsa.c index b7923517a..8f87779ba 100644 --- a/Engine/lib/openal-soft/Alc/backends/qsa.c +++ b/Engine/lib/openal-soft/Alc/backends/qsa.c @@ -33,6 +33,8 @@ #include "alu.h" #include "threads.h" +#include "backends/base.h" + typedef struct { snd_pcm_t* pcmHandle; @@ -44,7 +46,7 @@ typedef struct { ALvoid* buffer; ALsizei size; - volatile int killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } qsa_data; @@ -157,17 +159,39 @@ static void deviceList(int type, vector_DevMap *devmap) } -FORCE_ALIGN static int qsa_proc_playback(void* ptr) +/* Wrappers to use an old-style backend with the new interface. */ +typedef struct PlaybackWrapper { + DERIVE_FROM_TYPE(ALCbackend); + qsa_data *ExtraData; +} PlaybackWrapper; + +static void PlaybackWrapper_Construct(PlaybackWrapper *self, ALCdevice *device); +static void PlaybackWrapper_Destruct(PlaybackWrapper *self); +static ALCenum PlaybackWrapper_open(PlaybackWrapper *self, const ALCchar *name); +static ALCboolean PlaybackWrapper_reset(PlaybackWrapper *self); +static ALCboolean PlaybackWrapper_start(PlaybackWrapper *self); +static void PlaybackWrapper_stop(PlaybackWrapper *self); +static DECLARE_FORWARD2(PlaybackWrapper, ALCbackend, ALCenum, captureSamples, void*, ALCuint) +static DECLARE_FORWARD(PlaybackWrapper, ALCbackend, ALCuint, availableSamples) +static DECLARE_FORWARD(PlaybackWrapper, ALCbackend, ClockLatency, getClockLatency) +static DECLARE_FORWARD(PlaybackWrapper, ALCbackend, void, lock) +static DECLARE_FORWARD(PlaybackWrapper, ALCbackend, void, unlock) +DECLARE_DEFAULT_ALLOCATORS(PlaybackWrapper) +DEFINE_ALCBACKEND_VTABLE(PlaybackWrapper); + + +FORCE_ALIGN static int qsa_proc_playback(void *ptr) { - ALCdevice* device=(ALCdevice*)ptr; - qsa_data* data=(qsa_data*)device->ExtraData; - char* write_ptr; - int avail; + PlaybackWrapper *self = ptr; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; + qsa_data *data = self->ExtraData; snd_pcm_channel_status_t status; struct sched_param param; - fd_set wfds; - int selectret; struct timeval timeout; + char* write_ptr; + fd_set wfds; + ALint len; + int sret; SetRTPriority(); althrd_setname(althrd_current(), MIXER_THREAD_NAME); @@ -177,72 +201,69 @@ FORCE_ALIGN static int qsa_proc_playback(void* ptr) param.sched_priority=param.sched_curpriority+1; SchedSet(0, 0, SCHED_NOCHANGE, ¶m); - ALint frame_size=FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + const ALint frame_size = FrameSizeFromDevFmt( + device->FmtChans, device->FmtType, device->AmbiOrder + ); - while (!data->killNow) + V0(device->Backend,lock)(); + while(!ATOMIC_LOAD(&data->killNow, almemory_order_acquire)) { - ALint len=data->size; - write_ptr=data->buffer; + FD_ZERO(&wfds); + FD_SET(data->audio_fd, &wfds); + timeout.tv_sec=2; + timeout.tv_usec=0; - avail=len/frame_size; - aluMixData(device, write_ptr, avail); - - while (len>0 && !data->killNow) + /* Select also works like time slice to OS */ + V0(device->Backend,unlock)(); + sret = select(data->audio_fd+1, NULL, &wfds, NULL, &timeout); + V0(device->Backend,lock)(); + if(sret == -1) { - FD_ZERO(&wfds); - FD_SET(data->audio_fd, &wfds); - timeout.tv_sec=2; - timeout.tv_usec=0; + ERR("select error: %s\n", strerror(errno)); + aluHandleDisconnect(device, "Failed waiting for playback buffer: %s", strerror(errno)); + break; + } + if(sret == 0) + { + ERR("select timeout\n"); + continue; + } - /* Select also works like time slice to OS */ - selectret=select(data->audio_fd+1, NULL, &wfds, NULL, &timeout); - switch (selectret) + len = data->size; + write_ptr = data->buffer; + aluMixData(device, write_ptr, len/frame_size); + while(len>0 && !ATOMIC_LOAD(&data->killNow, almemory_order_acquire)) + { + int wrote = snd_pcm_plugin_write(data->pcmHandle, write_ptr, len); + if(wrote <= 0) { - case -1: - aluHandleDisconnect(device); - return 1; - case 0: - break; - default: - if (FD_ISSET(data->audio_fd, &wfds)) - { - break; - } - break; - } - - int wrote=snd_pcm_plugin_write(data->pcmHandle, write_ptr, len); - - if (wrote<=0) - { - if ((errno==EAGAIN) || (errno==EWOULDBLOCK)) - { + if(errno==EAGAIN || errno==EWOULDBLOCK) continue; - } - memset(&status, 0, sizeof (status)); - status.channel=SND_PCM_CHANNEL_PLAYBACK; + memset(&status, 0, sizeof(status)); + status.channel = SND_PCM_CHANNEL_PLAYBACK; snd_pcm_plugin_status(data->pcmHandle, &status); /* we need to reinitialize the sound channel if we've underrun the buffer */ - if ((status.status==SND_PCM_STATUS_UNDERRUN) || - (status.status==SND_PCM_STATUS_READY)) + if(status.status == SND_PCM_STATUS_UNDERRUN || + status.status == SND_PCM_STATUS_READY) { - if ((snd_pcm_plugin_prepare(data->pcmHandle, SND_PCM_CHANNEL_PLAYBACK))<0) + if(snd_pcm_plugin_prepare(data->pcmHandle, SND_PCM_CHANNEL_PLAYBACK) < 0) { - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Playback recovery failed"); break; } } } else { - write_ptr+=wrote; - len-=wrote; + write_ptr += wrote; + len -= wrote; } } } + V0(device->Backend,unlock)(); return 0; } @@ -251,8 +272,9 @@ FORCE_ALIGN static int qsa_proc_playback(void* ptr) /* Playback */ /************/ -static ALCenum qsa_open_playback(ALCdevice* device, const ALCchar* deviceName) +static ALCenum qsa_open_playback(PlaybackWrapper *self, const ALCchar* deviceName) { + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; qsa_data *data; int card, dev; int status; @@ -260,6 +282,7 @@ static ALCenum qsa_open_playback(ALCdevice* device, const ALCchar* deviceName) data = (qsa_data*)calloc(1, sizeof(qsa_data)); if(data == NULL) return ALC_OUT_OF_MEMORY; + ATOMIC_INIT(&data->killNow, AL_TRUE); if(!deviceName) deviceName = qsaDevice; @@ -299,15 +322,15 @@ static ALCenum qsa_open_playback(ALCdevice* device, const ALCchar* deviceName) return ALC_INVALID_DEVICE; } - al_string_copy_cstr(&device->DeviceName, deviceName); - device->ExtraData = data; + alstr_copy_cstr(&device->DeviceName, deviceName); + self->ExtraData = data; return ALC_NO_ERROR; } -static void qsa_close_playback(ALCdevice* device) +static void qsa_close_playback(PlaybackWrapper *self) { - qsa_data* data=(qsa_data*)device->ExtraData; + qsa_data *data = self->ExtraData; if (data->buffer!=NULL) { @@ -318,12 +341,13 @@ static void qsa_close_playback(ALCdevice* device) snd_pcm_close(data->pcmHandle); free(data); - device->ExtraData=NULL; + self->ExtraData = NULL; } -static ALCboolean qsa_reset_playback(ALCdevice* device) +static ALCboolean qsa_reset_playback(PlaybackWrapper *self) { - qsa_data* data=(qsa_data*)device->ExtraData; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; + qsa_data *data = self->ExtraData; int32_t format=-1; switch(device->FmtType) @@ -364,14 +388,14 @@ static ALCboolean qsa_reset_playback(ALCdevice* device) data->cparams.start_mode=SND_PCM_START_FULL; data->cparams.stop_mode=SND_PCM_STOP_STOP; - data->cparams.buf.block.frag_size=device->UpdateSize* - ChannelsFromDevFmt(device->FmtChans)*BytesFromDevFmt(device->FmtType); + data->cparams.buf.block.frag_size=device->UpdateSize * + FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); data->cparams.buf.block.frags_max=device->NumUpdates; data->cparams.buf.block.frags_min=device->NumUpdates; data->cparams.format.interleave=1; data->cparams.format.rate=device->Frequency; - data->cparams.format.voices=ChannelsFromDevFmt(device->FmtChans); + data->cparams.format.voices=ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); data->cparams.format.format=format; if ((snd_pcm_plugin_params(data->pcmHandle, &data->cparams))<0) @@ -555,7 +579,7 @@ static ALCboolean qsa_reset_playback(ALCdevice* device) SetDefaultChannelOrder(device); device->UpdateSize=data->csetup.buf.block.frag_size/ - (ChannelsFromDevFmt(device->FmtChans)*BytesFromDevFmt(device->FmtType)); + FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); device->NumUpdates=data->csetup.buf.block.frags; data->size=data->csetup.buf.block.frag_size; @@ -568,35 +592,93 @@ static ALCboolean qsa_reset_playback(ALCdevice* device) return ALC_TRUE; } -static ALCboolean qsa_start_playback(ALCdevice* device) +static ALCboolean qsa_start_playback(PlaybackWrapper *self) { - qsa_data *data = (qsa_data*)device->ExtraData; + qsa_data *data = self->ExtraData; - data->killNow = 0; - if(althrd_create(&data->thread, qsa_proc_playback, device) != althrd_success) + ATOMIC_STORE(&data->killNow, AL_FALSE, almemory_order_release); + if(althrd_create(&data->thread, qsa_proc_playback, self) != althrd_success) return ALC_FALSE; return ALC_TRUE; } -static void qsa_stop_playback(ALCdevice* device) +static void qsa_stop_playback(PlaybackWrapper *self) { - qsa_data *data = (qsa_data*)device->ExtraData; + qsa_data *data = self->ExtraData; int res; - if(data->killNow) + if(ATOMIC_EXCHANGE(&data->killNow, AL_TRUE, almemory_order_acq_rel)) return; - - data->killNow = 1; althrd_join(data->thread, &res); } + +static void PlaybackWrapper_Construct(PlaybackWrapper *self, ALCdevice *device) +{ + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(PlaybackWrapper, ALCbackend, self); + + self->ExtraData = NULL; +} + +static void PlaybackWrapper_Destruct(PlaybackWrapper *self) +{ + if(self->ExtraData) + qsa_close_playback(self); + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); +} + +static ALCenum PlaybackWrapper_open(PlaybackWrapper *self, const ALCchar *name) +{ + return qsa_open_playback(self, name); +} + +static ALCboolean PlaybackWrapper_reset(PlaybackWrapper *self) +{ + return qsa_reset_playback(self); +} + +static ALCboolean PlaybackWrapper_start(PlaybackWrapper *self) +{ + return qsa_start_playback(self); +} + +static void PlaybackWrapper_stop(PlaybackWrapper *self) +{ + qsa_stop_playback(self); +} + + + /***********/ /* Capture */ /***********/ -static ALCenum qsa_open_capture(ALCdevice* device, const ALCchar* deviceName) +typedef struct CaptureWrapper { + DERIVE_FROM_TYPE(ALCbackend); + qsa_data *ExtraData; +} CaptureWrapper; + +static void CaptureWrapper_Construct(CaptureWrapper *self, ALCdevice *device); +static void CaptureWrapper_Destruct(CaptureWrapper *self); +static ALCenum CaptureWrapper_open(CaptureWrapper *self, const ALCchar *name); +static DECLARE_FORWARD(CaptureWrapper, ALCbackend, ALCboolean, reset) +static ALCboolean CaptureWrapper_start(CaptureWrapper *self); +static void CaptureWrapper_stop(CaptureWrapper *self); +static ALCenum CaptureWrapper_captureSamples(CaptureWrapper *self, void *buffer, ALCuint samples); +static ALCuint CaptureWrapper_availableSamples(CaptureWrapper *self); +static DECLARE_FORWARD(CaptureWrapper, ALCbackend, ClockLatency, getClockLatency) +static DECLARE_FORWARD(CaptureWrapper, ALCbackend, void, lock) +static DECLARE_FORWARD(CaptureWrapper, ALCbackend, void, unlock) +DECLARE_DEFAULT_ALLOCATORS(CaptureWrapper) +DEFINE_ALCBACKEND_VTABLE(CaptureWrapper); + + +static ALCenum qsa_open_capture(CaptureWrapper *self, const ALCchar *deviceName) { + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; qsa_data *data; int card, dev; int format=-1; @@ -646,8 +728,8 @@ static ALCenum qsa_open_capture(ALCdevice* device, const ALCchar* deviceName) return ALC_INVALID_DEVICE; } - al_string_copy_cstr(&device->DeviceName, deviceName); - device->ExtraData = data; + alstr_copy_cstr(&device->DeviceName, deviceName); + self->ExtraData = data; switch (device->FmtType) { @@ -687,20 +769,19 @@ static ALCenum qsa_open_capture(ALCdevice* device, const ALCchar* deviceName) data->cparams.stop_mode=SND_PCM_STOP_STOP; data->cparams.buf.block.frag_size=device->UpdateSize* - ChannelsFromDevFmt(device->FmtChans)*BytesFromDevFmt(device->FmtType); + FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); data->cparams.buf.block.frags_max=device->NumUpdates; data->cparams.buf.block.frags_min=device->NumUpdates; data->cparams.format.interleave=1; data->cparams.format.rate=device->Frequency; - data->cparams.format.voices=ChannelsFromDevFmt(device->FmtChans); + data->cparams.format.voices=ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); data->cparams.format.format=format; if(snd_pcm_plugin_params(data->pcmHandle, &data->cparams) < 0) { snd_pcm_close(data->pcmHandle); free(data); - device->ExtraData=NULL; return ALC_INVALID_VALUE; } @@ -708,20 +789,20 @@ static ALCenum qsa_open_capture(ALCdevice* device, const ALCchar* deviceName) return ALC_NO_ERROR; } -static void qsa_close_capture(ALCdevice* device) +static void qsa_close_capture(CaptureWrapper *self) { - qsa_data* data=(qsa_data*)device->ExtraData; + qsa_data *data = self->ExtraData; if (data->pcmHandle!=NULL) snd_pcm_close(data->pcmHandle); free(data); - device->ExtraData=NULL; + self->ExtraData = NULL; } -static void qsa_start_capture(ALCdevice* device) +static void qsa_start_capture(CaptureWrapper *self) { - qsa_data* data=(qsa_data*)device->ExtraData; + qsa_data *data = self->ExtraData; int rstatus; if ((rstatus=snd_pcm_plugin_prepare(data->pcmHandle, SND_PCM_CHANNEL_CAPTURE))<0) @@ -741,18 +822,18 @@ static void qsa_start_capture(ALCdevice* device) snd_pcm_capture_go(data->pcmHandle); } -static void qsa_stop_capture(ALCdevice* device) +static void qsa_stop_capture(CaptureWrapper *self) { - qsa_data* data=(qsa_data*)device->ExtraData; - + qsa_data *data = self->ExtraData; snd_pcm_capture_flush(data->pcmHandle); } -static ALCuint qsa_available_samples(ALCdevice* device) +static ALCuint qsa_available_samples(CaptureWrapper *self) { - qsa_data* data=(qsa_data*)device->ExtraData; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; + qsa_data *data = self->ExtraData; snd_pcm_channel_status_t status; - ALint frame_size=FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + ALint frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); ALint free_size; int rstatus; @@ -765,7 +846,7 @@ static ALCuint qsa_available_samples(ALCdevice* device) if ((rstatus=snd_pcm_plugin_prepare(data->pcmHandle, SND_PCM_CHANNEL_CAPTURE))<0) { ERR("capture prepare failed: %s\n", snd_strerror(rstatus)); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed capture recovery: %s", snd_strerror(rstatus)); return 0; } @@ -779,16 +860,17 @@ static ALCuint qsa_available_samples(ALCdevice* device) return free_size/frame_size; } -static ALCenum qsa_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint samples) +static ALCenum qsa_capture_samples(CaptureWrapper *self, ALCvoid *buffer, ALCuint samples) { - qsa_data* data=(qsa_data*)device->ExtraData; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; + qsa_data *data = self->ExtraData; char* read_ptr; snd_pcm_channel_status_t status; fd_set rfds; int selectret; struct timeval timeout; int bytes_read; - ALint frame_size=FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + ALint frame_size=FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); ALint len=samples*frame_size; int rstatus; @@ -807,7 +889,7 @@ static ALCenum qsa_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint s switch (selectret) { case -1: - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed to check capture samples"); return ALC_INVALID_DEVICE; case 0: break; @@ -838,7 +920,8 @@ static ALCenum qsa_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint s if ((rstatus=snd_pcm_plugin_prepare(data->pcmHandle, SND_PCM_CHANNEL_CAPTURE))<0) { ERR("capture prepare failed: %s\n", snd_strerror(rstatus)); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed capture recovery: %s", + snd_strerror(rstatus)); return ALC_INVALID_DEVICE; } snd_pcm_capture_go(data->pcmHandle); @@ -854,27 +937,68 @@ static ALCenum qsa_capture_samples(ALCdevice *device, ALCvoid *buffer, ALCuint s return ALC_NO_ERROR; } -static const BackendFuncs qsa_funcs= { - qsa_open_playback, - qsa_close_playback, - qsa_reset_playback, - qsa_start_playback, - qsa_stop_playback, - qsa_open_capture, - qsa_close_capture, - qsa_start_capture, - qsa_stop_capture, - qsa_capture_samples, - qsa_available_samples -}; -ALCboolean alc_qsa_init(BackendFuncs* func_list) +static void CaptureWrapper_Construct(CaptureWrapper *self, ALCdevice *device) { - *func_list = qsa_funcs; + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(CaptureWrapper, ALCbackend, self); + + self->ExtraData = NULL; +} + +static void CaptureWrapper_Destruct(CaptureWrapper *self) +{ + if(self->ExtraData) + qsa_close_capture(self); + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); +} + +static ALCenum CaptureWrapper_open(CaptureWrapper *self, const ALCchar *name) +{ + return qsa_open_capture(self, name); +} + +static ALCboolean CaptureWrapper_start(CaptureWrapper *self) +{ + qsa_start_capture(self); return ALC_TRUE; } -void alc_qsa_deinit(void) +static void CaptureWrapper_stop(CaptureWrapper *self) +{ + qsa_stop_capture(self); +} + +static ALCenum CaptureWrapper_captureSamples(CaptureWrapper *self, void *buffer, ALCuint samples) +{ + return qsa_capture_samples(self, buffer, samples); +} + +static ALCuint CaptureWrapper_availableSamples(CaptureWrapper *self) +{ + return qsa_available_samples(self); +} + + +typedef struct ALCqsaBackendFactory { + DERIVE_FROM_TYPE(ALCbackendFactory); +} ALCqsaBackendFactory; +#define ALCQSABACKENDFACTORY_INITIALIZER { { GET_VTABLE2(ALCqsaBackendFactory, ALCbackendFactory) } } + +static ALCboolean ALCqsaBackendFactory_init(ALCqsaBackendFactory* UNUSED(self)); +static void ALCqsaBackendFactory_deinit(ALCqsaBackendFactory* UNUSED(self)); +static ALCboolean ALCqsaBackendFactory_querySupport(ALCqsaBackendFactory* UNUSED(self), ALCbackend_Type type); +static void ALCqsaBackendFactory_probe(ALCqsaBackendFactory* UNUSED(self), enum DevProbe type); +static ALCbackend* ALCqsaBackendFactory_createBackend(ALCqsaBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type); +DEFINE_ALCBACKENDFACTORY_VTABLE(ALCqsaBackendFactory); + +static ALCboolean ALCqsaBackendFactory_init(ALCqsaBackendFactory* UNUSED(self)) +{ + return ALC_TRUE; +} + +static void ALCqsaBackendFactory_deinit(ALCqsaBackendFactory* UNUSED(self)) { #define FREE_NAME(iter) free((iter)->name) VECTOR_FOR_EACH(DevMap, DeviceNameMap, FREE_NAME); @@ -885,7 +1009,14 @@ void alc_qsa_deinit(void) #undef FREE_NAME } -void alc_qsa_probe(enum DevProbe type) +static ALCboolean ALCqsaBackendFactory_querySupport(ALCqsaBackendFactory* UNUSED(self), ALCbackend_Type type) +{ + if(type == ALCbackend_Playback || type == ALCbackend_Capture) + return ALC_TRUE; + return ALC_FALSE; +} + +static void ALCqsaBackendFactory_probe(ALCqsaBackendFactory* UNUSED(self), enum DevProbe type) { switch (type) { @@ -914,3 +1045,29 @@ void alc_qsa_probe(enum DevProbe type) break; } } + +static ALCbackend* ALCqsaBackendFactory_createBackend(ALCqsaBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type) +{ + if(type == ALCbackend_Playback) + { + PlaybackWrapper *backend; + NEW_OBJ(backend, PlaybackWrapper)(device); + if(!backend) return NULL; + return STATIC_CAST(ALCbackend, backend); + } + if(type == ALCbackend_Capture) + { + CaptureWrapper *backend; + NEW_OBJ(backend, CaptureWrapper)(device); + if(!backend) return NULL; + return STATIC_CAST(ALCbackend, backend); + } + + return NULL; +} + +ALCbackendFactory *ALCqsaBackendFactory_getFactory(void) +{ + static ALCqsaBackendFactory factory = ALCQSABACKENDFACTORY_INITIALIZER; + return STATIC_CAST(ALCbackendFactory, &factory); +} diff --git a/Engine/lib/openal-soft/Alc/backends/sdl2.c b/Engine/lib/openal-soft/Alc/backends/sdl2.c new file mode 100644 index 000000000..cf005024f --- /dev/null +++ b/Engine/lib/openal-soft/Alc/backends/sdl2.c @@ -0,0 +1,287 @@ +/** + * OpenAL cross platform audio library + * Copyright (C) 2018 by authors. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Or go to http://www.gnu.org/copyleft/lgpl.html + */ + +#include "config.h" + +#include +#include + +#include "alMain.h" +#include "alu.h" +#include "threads.h" +#include "compat.h" + +#include "backends/base.h" + + +#ifdef _WIN32 +#define DEVNAME_PREFIX "OpenAL Soft on " +#else +#define DEVNAME_PREFIX "" +#endif + +typedef struct ALCsdl2Backend { + DERIVE_FROM_TYPE(ALCbackend); + + SDL_AudioDeviceID deviceID; + ALsizei frameSize; + + ALuint Frequency; + enum DevFmtChannels FmtChans; + enum DevFmtType FmtType; + ALuint UpdateSize; +} ALCsdl2Backend; + +static void ALCsdl2Backend_Construct(ALCsdl2Backend *self, ALCdevice *device); +static void ALCsdl2Backend_Destruct(ALCsdl2Backend *self); +static ALCenum ALCsdl2Backend_open(ALCsdl2Backend *self, const ALCchar *name); +static ALCboolean ALCsdl2Backend_reset(ALCsdl2Backend *self); +static ALCboolean ALCsdl2Backend_start(ALCsdl2Backend *self); +static void ALCsdl2Backend_stop(ALCsdl2Backend *self); +static DECLARE_FORWARD2(ALCsdl2Backend, ALCbackend, ALCenum, captureSamples, void*, ALCuint) +static DECLARE_FORWARD(ALCsdl2Backend, ALCbackend, ALCuint, availableSamples) +static DECLARE_FORWARD(ALCsdl2Backend, ALCbackend, ClockLatency, getClockLatency) +static void ALCsdl2Backend_lock(ALCsdl2Backend *self); +static void ALCsdl2Backend_unlock(ALCsdl2Backend *self); +DECLARE_DEFAULT_ALLOCATORS(ALCsdl2Backend) + +DEFINE_ALCBACKEND_VTABLE(ALCsdl2Backend); + +static const ALCchar defaultDeviceName[] = DEVNAME_PREFIX "Default Device"; + +static void ALCsdl2Backend_Construct(ALCsdl2Backend *self, ALCdevice *device) +{ + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(ALCsdl2Backend, ALCbackend, self); + + self->deviceID = 0; + self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); + self->Frequency = device->Frequency; + self->FmtChans = device->FmtChans; + self->FmtType = device->FmtType; + self->UpdateSize = device->UpdateSize; +} + +static void ALCsdl2Backend_Destruct(ALCsdl2Backend *self) +{ + if(self->deviceID) + SDL_CloseAudioDevice(self->deviceID); + self->deviceID = 0; + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); +} + + +static void ALCsdl2Backend_audioCallback(void *ptr, Uint8 *stream, int len) +{ + ALCsdl2Backend *self = (ALCsdl2Backend*)ptr; + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + + assert((len % self->frameSize) == 0); + aluMixData(device, stream, len / self->frameSize); +} + +static ALCenum ALCsdl2Backend_open(ALCsdl2Backend *self, const ALCchar *name) +{ + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + SDL_AudioSpec want, have; + + SDL_zero(want); + SDL_zero(have); + + want.freq = device->Frequency; + switch(device->FmtType) + { + case DevFmtUByte: want.format = AUDIO_U8; break; + case DevFmtByte: want.format = AUDIO_S8; break; + case DevFmtUShort: want.format = AUDIO_U16SYS; break; + case DevFmtShort: want.format = AUDIO_S16SYS; break; + case DevFmtUInt: /* fall-through */ + case DevFmtInt: want.format = AUDIO_S32SYS; break; + case DevFmtFloat: want.format = AUDIO_F32; break; + } + want.channels = (device->FmtChans == DevFmtMono) ? 1 : 2; + want.samples = device->UpdateSize; + want.callback = ALCsdl2Backend_audioCallback; + want.userdata = self; + + /* Passing NULL to SDL_OpenAudioDevice opens a default, which isn't + * necessarily the first in the list. + */ + if(!name || strcmp(name, defaultDeviceName) == 0) + self->deviceID = SDL_OpenAudioDevice(NULL, SDL_FALSE, &want, &have, + SDL_AUDIO_ALLOW_ANY_CHANGE); + else + { + const size_t prefix_len = strlen(DEVNAME_PREFIX); + if(strncmp(name, DEVNAME_PREFIX, prefix_len) == 0) + self->deviceID = SDL_OpenAudioDevice(name+prefix_len, SDL_FALSE, &want, &have, + SDL_AUDIO_ALLOW_ANY_CHANGE); + else + self->deviceID = SDL_OpenAudioDevice(name, SDL_FALSE, &want, &have, + SDL_AUDIO_ALLOW_ANY_CHANGE); + } + if(self->deviceID == 0) + return ALC_INVALID_VALUE; + + device->Frequency = have.freq; + if(have.channels == 1) + device->FmtChans = DevFmtMono; + else if(have.channels == 2) + device->FmtChans = DevFmtStereo; + else + { + ERR("Got unhandled SDL channel count: %d\n", (int)have.channels); + return ALC_INVALID_VALUE; + } + switch(have.format) + { + case AUDIO_U8: device->FmtType = DevFmtUByte; break; + case AUDIO_S8: device->FmtType = DevFmtByte; break; + case AUDIO_U16SYS: device->FmtType = DevFmtUShort; break; + case AUDIO_S16SYS: device->FmtType = DevFmtShort; break; + case AUDIO_S32SYS: device->FmtType = DevFmtInt; break; + case AUDIO_F32SYS: device->FmtType = DevFmtFloat; break; + default: + ERR("Got unsupported SDL format: 0x%04x\n", have.format); + return ALC_INVALID_VALUE; + } + device->UpdateSize = have.samples; + device->NumUpdates = 2; /* SDL always (tries to) use two periods. */ + + self->frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); + self->Frequency = device->Frequency; + self->FmtChans = device->FmtChans; + self->FmtType = device->FmtType; + self->UpdateSize = device->UpdateSize; + + alstr_copy_cstr(&device->DeviceName, name ? name : defaultDeviceName); + + return ALC_NO_ERROR; +} + +static ALCboolean ALCsdl2Backend_reset(ALCsdl2Backend *self) +{ + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + device->Frequency = self->Frequency; + device->FmtChans = self->FmtChans; + device->FmtType = self->FmtType; + device->UpdateSize = self->UpdateSize; + device->NumUpdates = 2; + SetDefaultWFXChannelOrder(device); + return ALC_TRUE; +} + +static ALCboolean ALCsdl2Backend_start(ALCsdl2Backend *self) +{ + SDL_PauseAudioDevice(self->deviceID, 0); + return ALC_TRUE; +} + +static void ALCsdl2Backend_stop(ALCsdl2Backend *self) +{ + SDL_PauseAudioDevice(self->deviceID, 1); +} + +static void ALCsdl2Backend_lock(ALCsdl2Backend *self) +{ + SDL_LockAudioDevice(self->deviceID); +} + +static void ALCsdl2Backend_unlock(ALCsdl2Backend *self) +{ + SDL_UnlockAudioDevice(self->deviceID); +} + + +typedef struct ALCsdl2BackendFactory { + DERIVE_FROM_TYPE(ALCbackendFactory); +} ALCsdl2BackendFactory; +#define ALCsdl2BACKENDFACTORY_INITIALIZER { { GET_VTABLE2(ALCsdl2BackendFactory, ALCbackendFactory) } } + +ALCbackendFactory *ALCsdl2BackendFactory_getFactory(void); + +static ALCboolean ALCsdl2BackendFactory_init(ALCsdl2BackendFactory *self); +static void ALCsdl2BackendFactory_deinit(ALCsdl2BackendFactory *self); +static ALCboolean ALCsdl2BackendFactory_querySupport(ALCsdl2BackendFactory *self, ALCbackend_Type type); +static void ALCsdl2BackendFactory_probe(ALCsdl2BackendFactory *self, enum DevProbe type); +static ALCbackend* ALCsdl2BackendFactory_createBackend(ALCsdl2BackendFactory *self, ALCdevice *device, ALCbackend_Type type); +DEFINE_ALCBACKENDFACTORY_VTABLE(ALCsdl2BackendFactory); + + +ALCbackendFactory *ALCsdl2BackendFactory_getFactory(void) +{ + static ALCsdl2BackendFactory factory = ALCsdl2BACKENDFACTORY_INITIALIZER; + return STATIC_CAST(ALCbackendFactory, &factory); +} + + +static ALCboolean ALCsdl2BackendFactory_init(ALCsdl2BackendFactory* UNUSED(self)) +{ + if(SDL_InitSubSystem(SDL_INIT_AUDIO) == 0) + return AL_TRUE; + return ALC_FALSE; +} + +static void ALCsdl2BackendFactory_deinit(ALCsdl2BackendFactory* UNUSED(self)) +{ + SDL_QuitSubSystem(SDL_INIT_AUDIO); +} + +static ALCboolean ALCsdl2BackendFactory_querySupport(ALCsdl2BackendFactory* UNUSED(self), ALCbackend_Type type) +{ + if(type == ALCbackend_Playback) + return ALC_TRUE; + return ALC_FALSE; +} + +static void ALCsdl2BackendFactory_probe(ALCsdl2BackendFactory* UNUSED(self), enum DevProbe type) +{ + int num_devices, i; + al_string name; + + if(type != ALL_DEVICE_PROBE) + return; + + AL_STRING_INIT(name); + num_devices = SDL_GetNumAudioDevices(SDL_FALSE); + + AppendAllDevicesList(defaultDeviceName); + for(i = 0;i < num_devices;++i) + { + alstr_copy_cstr(&name, DEVNAME_PREFIX); + alstr_append_cstr(&name, SDL_GetAudioDeviceName(i, SDL_FALSE)); + AppendAllDevicesList(alstr_get_cstr(name)); + } + alstr_reset(&name); +} + +static ALCbackend* ALCsdl2BackendFactory_createBackend(ALCsdl2BackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type) +{ + if(type == ALCbackend_Playback) + { + ALCsdl2Backend *backend; + NEW_OBJ(backend, ALCsdl2Backend)(device); + if(!backend) return NULL; + return STATIC_CAST(ALCbackend, backend); + } + + return NULL; +} diff --git a/Engine/lib/openal-soft/Alc/backends/sndio.c b/Engine/lib/openal-soft/Alc/backends/sndio.c index 52bff13a5..5aea457b5 100644 --- a/Engine/lib/openal-soft/Alc/backends/sndio.c +++ b/Engine/lib/openal-soft/Alc/backends/sndio.c @@ -28,55 +28,98 @@ #include "alu.h" #include "threads.h" +#include "backends/base.h" + #include -static const ALCchar sndio_device[] = "SndIO Default"; -static ALCboolean sndio_load(void) -{ - return ALC_TRUE; -} +typedef struct ALCsndioBackend { + DERIVE_FROM_TYPE(ALCbackend); - -typedef struct { struct sio_hdl *sndHandle; ALvoid *mix_data; ALsizei data_size; - volatile int killNow; + ATOMIC(int) killNow; althrd_t thread; -} sndio_data; +} ALCsndioBackend; + +static int ALCsndioBackend_mixerProc(void *ptr); + +static void ALCsndioBackend_Construct(ALCsndioBackend *self, ALCdevice *device); +static void ALCsndioBackend_Destruct(ALCsndioBackend *self); +static ALCenum ALCsndioBackend_open(ALCsndioBackend *self, const ALCchar *name); +static ALCboolean ALCsndioBackend_reset(ALCsndioBackend *self); +static ALCboolean ALCsndioBackend_start(ALCsndioBackend *self); +static void ALCsndioBackend_stop(ALCsndioBackend *self); +static DECLARE_FORWARD2(ALCsndioBackend, ALCbackend, ALCenum, captureSamples, void*, ALCuint) +static DECLARE_FORWARD(ALCsndioBackend, ALCbackend, ALCuint, availableSamples) +static DECLARE_FORWARD(ALCsndioBackend, ALCbackend, ClockLatency, getClockLatency) +static DECLARE_FORWARD(ALCsndioBackend, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCsndioBackend, ALCbackend, void, unlock) +DECLARE_DEFAULT_ALLOCATORS(ALCsndioBackend) + +DEFINE_ALCBACKEND_VTABLE(ALCsndioBackend); -static int sndio_proc(void *ptr) +static const ALCchar sndio_device[] = "SndIO Default"; + + +static void ALCsndioBackend_Construct(ALCsndioBackend *self, ALCdevice *device) { - ALCdevice *device = ptr; - sndio_data *data = device->ExtraData; + ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); + SET_VTABLE2(ALCsndioBackend, ALCbackend, self); + + self->sndHandle = NULL; + self->mix_data = NULL; + ATOMIC_INIT(&self->killNow, AL_TRUE); +} + +static void ALCsndioBackend_Destruct(ALCsndioBackend *self) +{ + if(self->sndHandle) + sio_close(self->sndHandle); + self->sndHandle = NULL; + + al_free(self->mix_data); + self->mix_data = NULL; + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); +} + + +static int ALCsndioBackend_mixerProc(void *ptr) +{ + ALCsndioBackend *self = (ALCsndioBackend*)ptr; + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; ALsizei frameSize; size_t wrote; SetRTPriority(); althrd_setname(althrd_current(), MIXER_THREAD_NAME); - frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); - while(!data->killNow && device->Connected) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) && + ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) { - ALsizei len = data->data_size; - ALubyte *WritePtr = data->mix_data; + ALsizei len = self->data_size; + ALubyte *WritePtr = self->mix_data; + ALCsndioBackend_lock(self); aluMixData(device, WritePtr, len/frameSize); - while(len > 0 && !data->killNow) + ALCsndioBackend_unlock(self); + while(len > 0 && !ATOMIC_LOAD(&self->killNow, almemory_order_acquire)) { - wrote = sio_write(data->sndHandle, WritePtr, len); + wrote = sio_write(self->sndHandle, WritePtr, len); if(wrote == 0) { ERR("sio_write failed\n"); ALCdevice_Lock(device); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed to write playback samples"); ALCdevice_Unlock(device); break; } @@ -90,45 +133,30 @@ static int sndio_proc(void *ptr) } - -static ALCenum sndio_open_playback(ALCdevice *device, const ALCchar *deviceName) +static ALCenum ALCsndioBackend_open(ALCsndioBackend *self, const ALCchar *name) { - sndio_data *data; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; - if(!deviceName) - deviceName = sndio_device; - else if(strcmp(deviceName, sndio_device) != 0) + if(!name) + name = sndio_device; + else if(strcmp(name, sndio_device) != 0) return ALC_INVALID_VALUE; - data = calloc(1, sizeof(*data)); - data->killNow = 0; - - data->sndHandle = sio_open(NULL, SIO_PLAY, 0); - if(data->sndHandle == NULL) + self->sndHandle = sio_open(NULL, SIO_PLAY, 0); + if(self->sndHandle == NULL) { - free(data); ERR("Could not open device\n"); return ALC_INVALID_VALUE; } - al_string_copy_cstr(&device->DeviceName, deviceName); - device->ExtraData = data; + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void sndio_close_playback(ALCdevice *device) +static ALCboolean ALCsndioBackend_reset(ALCsndioBackend *self) { - sndio_data *data = device->ExtraData; - - sio_close(data->sndHandle); - free(data); - device->ExtraData = NULL; -} - -static ALCboolean sndio_reset_playback(ALCdevice *device) -{ - sndio_data *data = device->ExtraData; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; struct sio_par par; sio_initpar(&par); @@ -170,7 +198,7 @@ static ALCboolean sndio_reset_playback(ALCdevice *device) par.appbufsz = device->UpdateSize * (device->NumUpdates-1); if(!par.appbufsz) par.appbufsz = device->UpdateSize; - if(!sio_setpar(data->sndHandle, &par) || !sio_getpar(data->sndHandle, &par)) + if(!sio_setpar(self->sndHandle, &par) || !sio_getpar(self->sndHandle, &par)) { ERR("Failed to set device parameters\n"); return ALC_FALSE; @@ -211,77 +239,84 @@ static ALCboolean sndio_reset_playback(ALCdevice *device) return ALC_TRUE; } -static ALCboolean sndio_start_playback(ALCdevice *device) +static ALCboolean ALCsndioBackend_start(ALCsndioBackend *self) { - sndio_data *data = device->ExtraData; + ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; - if(!sio_start(data->sndHandle)) + self->data_size = device->UpdateSize * FrameSizeFromDevFmt( + device->FmtChans, device->FmtType, device->AmbiOrder + ); + al_free(self->mix_data); + self->mix_data = al_calloc(16, self->data_size); + + if(!sio_start(self->sndHandle)) { ERR("Error starting playback\n"); return ALC_FALSE; } - data->data_size = device->UpdateSize * FrameSizeFromDevFmt(device->FmtChans, device->FmtType); - data->mix_data = calloc(1, data->data_size); - - data->killNow = 0; - if(althrd_create(&data->thread, sndio_proc, device) != althrd_success) + ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); + if(althrd_create(&self->thread, ALCsndioBackend_mixerProc, self) != althrd_success) { - sio_stop(data->sndHandle); - free(data->mix_data); - data->mix_data = NULL; + sio_stop(self->sndHandle); return ALC_FALSE; } return ALC_TRUE; } -static void sndio_stop_playback(ALCdevice *device) +static void ALCsndioBackend_stop(ALCsndioBackend *self) { - sndio_data *data = device->ExtraData; int res; - if(data->killNow) + if(ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) return; + althrd_join(self->thread, &res); - data->killNow = 1; - althrd_join(data->thread, &res); - - if(!sio_stop(data->sndHandle)) + if(!sio_stop(self->sndHandle)) ERR("Error stopping device\n"); - free(data->mix_data); - data->mix_data = NULL; + al_free(self->mix_data); + self->mix_data = NULL; } -static const BackendFuncs sndio_funcs = { - sndio_open_playback, - sndio_close_playback, - sndio_reset_playback, - sndio_start_playback, - sndio_stop_playback, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL -}; +typedef struct ALCsndioBackendFactory { + DERIVE_FROM_TYPE(ALCbackendFactory); +} ALCsndioBackendFactory; +#define ALCSNDIOBACKENDFACTORY_INITIALIZER { { GET_VTABLE2(ALCsndioBackendFactory, ALCbackendFactory) } } -ALCboolean alc_sndio_init(BackendFuncs *func_list) +ALCbackendFactory *ALCsndioBackendFactory_getFactory(void); + +static ALCboolean ALCsndioBackendFactory_init(ALCsndioBackendFactory *self); +static DECLARE_FORWARD(ALCsndioBackendFactory, ALCbackendFactory, void, deinit) +static ALCboolean ALCsndioBackendFactory_querySupport(ALCsndioBackendFactory *self, ALCbackend_Type type); +static void ALCsndioBackendFactory_probe(ALCsndioBackendFactory *self, enum DevProbe type); +static ALCbackend* ALCsndioBackendFactory_createBackend(ALCsndioBackendFactory *self, ALCdevice *device, ALCbackend_Type type); +DEFINE_ALCBACKENDFACTORY_VTABLE(ALCsndioBackendFactory); + + +ALCbackendFactory *ALCsndioBackendFactory_getFactory(void) { - if(!sndio_load()) - return ALC_FALSE; - *func_list = sndio_funcs; + static ALCsndioBackendFactory factory = ALCSNDIOBACKENDFACTORY_INITIALIZER; + return STATIC_CAST(ALCbackendFactory, &factory); +} + + +static ALCboolean ALCsndioBackendFactory_init(ALCsndioBackendFactory* UNUSED(self)) +{ + /* No dynamic loading */ return ALC_TRUE; } -void alc_sndio_deinit(void) +static ALCboolean ALCsndioBackendFactory_querySupport(ALCsndioBackendFactory* UNUSED(self), ALCbackend_Type type) { + if(type == ALCbackend_Playback) + return ALC_TRUE; + return ALC_FALSE; } -void alc_sndio_probe(enum DevProbe type) +static void ALCsndioBackendFactory_probe(ALCsndioBackendFactory* UNUSED(self), enum DevProbe type) { switch(type) { @@ -292,3 +327,16 @@ void alc_sndio_probe(enum DevProbe type) break; } } + +static ALCbackend* ALCsndioBackendFactory_createBackend(ALCsndioBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type) +{ + if(type == ALCbackend_Playback) + { + ALCsndioBackend *backend; + NEW_OBJ(backend, ALCsndioBackend)(device); + if(!backend) return NULL; + return STATIC_CAST(ALCbackend, backend); + } + + return NULL; +} diff --git a/Engine/lib/openal-soft/Alc/backends/solaris.c b/Engine/lib/openal-soft/Alc/backends/solaris.c index 01472e6a1..f1c4aeaa2 100644 --- a/Engine/lib/openal-soft/Alc/backends/solaris.c +++ b/Engine/lib/openal-soft/Alc/backends/solaris.c @@ -34,6 +34,7 @@ #include "alMain.h" #include "alu.h" +#include "alconfig.h" #include "threads.h" #include "compat.h" @@ -50,7 +51,7 @@ typedef struct ALCsolarisBackend { ALubyte *mix_data; int data_size; - volatile int killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCsolarisBackend; @@ -59,7 +60,6 @@ static int ALCsolarisBackend_mixerProc(void *ptr); static void ALCsolarisBackend_Construct(ALCsolarisBackend *self, ALCdevice *device); static void ALCsolarisBackend_Destruct(ALCsolarisBackend *self); static ALCenum ALCsolarisBackend_open(ALCsolarisBackend *self, const ALCchar *name); -static void ALCsolarisBackend_close(ALCsolarisBackend *self); static ALCboolean ALCsolarisBackend_reset(ALCsolarisBackend *self); static ALCboolean ALCsolarisBackend_start(ALCsolarisBackend *self); static void ALCsolarisBackend_stop(ALCsolarisBackend *self); @@ -84,6 +84,8 @@ static void ALCsolarisBackend_Construct(ALCsolarisBackend *self, ALCdevice *devi SET_VTABLE2(ALCsolarisBackend, ALCbackend, self); self->fd = -1; + self->mix_data = NULL; + ATOMIC_INIT(&self->killNow, AL_FALSE); } static void ALCsolarisBackend_Destruct(ALCsolarisBackend *self) @@ -103,43 +105,67 @@ static void ALCsolarisBackend_Destruct(ALCsolarisBackend *self) static int ALCsolarisBackend_mixerProc(void *ptr) { ALCsolarisBackend *self = ptr; - ALCdevice *Device = STATIC_CAST(ALCbackend,self)->mDevice; - ALint frameSize; - int wrote; + ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + struct timeval timeout; + ALubyte *write_ptr; + ALint frame_size; + ALint to_write; + ssize_t wrote; + fd_set wfds; + int sret; SetRTPriority(); althrd_setname(althrd_current(), MIXER_THREAD_NAME); - frameSize = FrameSizeFromDevFmt(Device->FmtChans, Device->FmtType); + frame_size = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); - while(!self->killNow && Device->Connected) + ALCsolarisBackend_lock(self); + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) && + ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) { - ALint len = self->data_size; - ALubyte *WritePtr = self->mix_data; + FD_ZERO(&wfds); + FD_SET(self->fd, &wfds); + timeout.tv_sec = 1; + timeout.tv_usec = 0; - aluMixData(Device, WritePtr, len/frameSize); - while(len > 0 && !self->killNow) + ALCsolarisBackend_unlock(self); + sret = select(self->fd+1, NULL, &wfds, NULL, &timeout); + ALCsolarisBackend_lock(self); + if(sret < 0) { - wrote = write(self->fd, WritePtr, len); + if(errno == EINTR) + continue; + ERR("select failed: %s\n", strerror(errno)); + aluHandleDisconnect(device, "Failed to wait for playback buffer: %s", strerror(errno)); + break; + } + else if(sret == 0) + { + WARN("select timeout\n"); + continue; + } + + write_ptr = self->mix_data; + to_write = self->data_size; + aluMixData(device, write_ptr, to_write/frame_size); + while(to_write > 0 && !ATOMIC_LOAD_SEQ(&self->killNow)) + { + wrote = write(self->fd, write_ptr, to_write); if(wrote < 0) { - if(errno != EAGAIN && errno != EWOULDBLOCK && errno != EINTR) - { - ERR("write failed: %s\n", strerror(errno)); - ALCsolarisBackend_lock(self); - aluHandleDisconnect(Device); - ALCsolarisBackend_unlock(self); - break; - } - - al_nssleep(1000000); - continue; + if(errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR) + continue; + ERR("write failed: %s\n", strerror(errno)); + aluHandleDisconnect(device, "Failed to write playback samples: %s", + strerror(errno)); + break; } - len -= wrote; - WritePtr += wrote; + to_write -= wrote; + write_ptr += wrote; } } + ALCsolarisBackend_unlock(self); return 0; } @@ -162,23 +188,17 @@ static ALCenum ALCsolarisBackend_open(ALCsolarisBackend *self, const ALCchar *na } device = STATIC_CAST(ALCbackend,self)->mDevice; - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCsolarisBackend_close(ALCsolarisBackend *self) -{ - close(self->fd); - self->fd = -1; -} - static ALCboolean ALCsolarisBackend_reset(ALCsolarisBackend *self) { ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; audio_info_t info; - ALuint frameSize; - int numChannels; + ALsizei frameSize; + ALsizei numChannels; AUDIO_INITINFO(&info); @@ -186,7 +206,7 @@ static ALCboolean ALCsolarisBackend_reset(ALCsolarisBackend *self) if(device->FmtChans != DevFmtMono) device->FmtChans = DevFmtStereo; - numChannels = ChannelsFromDevFmt(device->FmtChans); + numChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); info.play.channels = numChannels; switch(device->FmtType) @@ -220,9 +240,9 @@ static ALCboolean ALCsolarisBackend_reset(ALCsolarisBackend *self) return ALC_FALSE; } - if(ChannelsFromDevFmt(device->FmtChans) != info.play.channels) + if(ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder) != (ALsizei)info.play.channels) { - ERR("Could not set %d channels, got %d instead\n", ChannelsFromDevFmt(device->FmtChans), info.play.channels); + ERR("Failed to set %s, got %u channels instead\n", DevFmtChannelsString(device->FmtChans), info.play.channels); return ALC_FALSE; } @@ -242,7 +262,9 @@ static ALCboolean ALCsolarisBackend_reset(ALCsolarisBackend *self) SetDefaultChannelOrder(device); free(self->mix_data); - self->data_size = device->UpdateSize * FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + self->data_size = device->UpdateSize * FrameSizeFromDevFmt( + device->FmtChans, device->FmtType, device->AmbiOrder + ); self->mix_data = calloc(1, self->data_size); return ALC_TRUE; @@ -250,7 +272,7 @@ static ALCboolean ALCsolarisBackend_reset(ALCsolarisBackend *self) static ALCboolean ALCsolarisBackend_start(ALCsolarisBackend *self) { - self->killNow = 0; + ATOMIC_STORE_SEQ(&self->killNow, AL_FALSE); if(althrd_create(&self->thread, ALCsolarisBackend_mixerProc, self) != althrd_success) return ALC_FALSE; return ALC_TRUE; @@ -260,10 +282,9 @@ static void ALCsolarisBackend_stop(ALCsolarisBackend *self) { int res; - if(self->killNow) + if(ATOMIC_EXCHANGE_SEQ(&self->killNow, AL_TRUE)) return; - self->killNow = 1; althrd_join(self->thread, &res); if(ioctl(self->fd, AUDIO_DRAIN) < 0) diff --git a/Engine/lib/openal-soft/Alc/backends/mmdevapi.c b/Engine/lib/openal-soft/Alc/backends/wasapi.c similarity index 67% rename from Engine/lib/openal-soft/Alc/backends/mmdevapi.c rename to Engine/lib/openal-soft/Alc/backends/wasapi.c index 3882b08f0..50471f6b6 100644 --- a/Engine/lib/openal-soft/Alc/backends/mmdevapi.c +++ b/Engine/lib/openal-soft/Alc/backends/wasapi.c @@ -41,9 +41,11 @@ #include "alMain.h" #include "alu.h" +#include "ringbuffer.h" #include "threads.h" #include "compat.h" #include "alstring.h" +#include "converter.h" #include "backends/base.h" @@ -64,9 +66,18 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x #define X7DOT1 (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_SIDE_LEFT|SPEAKER_SIDE_RIGHT) #define X7DOT1_WIDE (SPEAKER_FRONT_LEFT|SPEAKER_FRONT_RIGHT|SPEAKER_FRONT_CENTER|SPEAKER_LOW_FREQUENCY|SPEAKER_BACK_LEFT|SPEAKER_BACK_RIGHT|SPEAKER_FRONT_LEFT_OF_CENTER|SPEAKER_FRONT_RIGHT_OF_CENTER) +#define REFTIME_PER_SEC ((REFERENCE_TIME)10000000) + #define DEVNAME_HEAD "OpenAL Soft on " +/* Scales the given value using 64-bit integer math, ceiling the result. */ +static inline ALuint64 ScaleCeil(ALuint64 val, ALuint64 new_scale, ALuint64 old_scale) +{ + return (val*new_scale + old_scale-1) / old_scale; +} + + typedef struct { al_string name; al_string endpoint_guid; // obtained from PKEY_AudioEndpoint_GUID , set to "Unknown device GUID" if absent. @@ -108,6 +119,15 @@ typedef struct { #define WM_USER_Enumerate (WM_USER+5) #define WM_USER_Last (WM_USER+5) +static const char MessageStr[WM_USER_Last+1-WM_USER][20] = { + "Open Device", + "Reset Device", + "Start Device", + "Stop Device", + "Close Device", + "Enumerate Devices", +}; + static inline void ReturnMsgResponse(ThreadRequest *req, HRESULT res) { req->result = res; @@ -130,14 +150,14 @@ static void get_device_name_and_guid(IMMDevice *device, al_string *name, al_stri PROPVARIANT pvguid; HRESULT hr; - al_string_copy_cstr(name, DEVNAME_HEAD); + alstr_copy_cstr(name, DEVNAME_HEAD); hr = IMMDevice_OpenPropertyStore(device, STGM_READ, &ps); if(FAILED(hr)) { WARN("OpenPropertyStore failed: 0x%08lx\n", hr); - al_string_append_cstr(name, "Unknown Device Name"); - if(guid!=NULL)al_string_copy_cstr(guid, "Unknown Device GUID"); + alstr_append_cstr(name, "Unknown Device Name"); + if(guid!=NULL)alstr_copy_cstr(guid, "Unknown Device GUID"); return; } @@ -147,14 +167,14 @@ static void get_device_name_and_guid(IMMDevice *device, al_string *name, al_stri if(FAILED(hr)) { WARN("GetValue Device_FriendlyName failed: 0x%08lx\n", hr); - al_string_append_cstr(name, "Unknown Device Name"); + alstr_append_cstr(name, "Unknown Device Name"); } else if(pvname.vt == VT_LPWSTR) - al_string_append_wcstr(name, pvname.pwszVal); + alstr_append_wcstr(name, pvname.pwszVal); else { WARN("Unexpected PROPVARIANT type: 0x%04x\n", pvname.vt); - al_string_append_cstr(name, "Unknown Device Name"); + alstr_append_cstr(name, "Unknown Device Name"); } PropVariantClear(&pvname); @@ -165,14 +185,14 @@ static void get_device_name_and_guid(IMMDevice *device, al_string *name, al_stri if(FAILED(hr)) { WARN("GetValue AudioEndpoint_GUID failed: 0x%08lx\n", hr); - al_string_copy_cstr(guid, "Unknown Device GUID"); + alstr_copy_cstr(guid, "Unknown Device GUID"); } else if(pvguid.vt == VT_LPWSTR) - al_string_copy_wcstr(guid, pvguid.pwszVal); + alstr_copy_wcstr(guid, pvguid.pwszVal); else { WARN("Unexpected PROPVARIANT type: 0x%04x\n", pvguid.vt); - al_string_copy_cstr(guid, "Unknown Device GUID"); + alstr_copy_cstr(guid, "Unknown Device GUID"); } PropVariantClear(&pvguid); @@ -211,7 +231,7 @@ static void get_device_formfactor(IMMDevice *device, EndpointFormFactor *formfac } -static void add_device(IMMDevice *device, LPCWSTR devid, vector_DevMap *list) +static void add_device(IMMDevice *device, const WCHAR *devid, vector_DevMap *list) { int count = 0; al_string tmpname; @@ -228,30 +248,30 @@ static void add_device(IMMDevice *device, LPCWSTR devid, vector_DevMap *list) { const DevMap *iter; - al_string_copy(&entry.name, tmpname); + alstr_copy(&entry.name, tmpname); if(count != 0) { char str[64]; snprintf(str, sizeof(str), " #%d", count+1); - al_string_append_cstr(&entry.name, str); + alstr_append_cstr(&entry.name, str); } -#define MATCH_ENTRY(i) (al_string_cmp(entry.name, (i)->name) == 0) +#define MATCH_ENTRY(i) (alstr_cmp(entry.name, (i)->name) == 0) VECTOR_FIND_IF(iter, const DevMap, *list, MATCH_ENTRY); if(iter == VECTOR_END(*list)) break; #undef MATCH_ENTRY count++; } - TRACE("Got device \"%s\", \"%s\", \"%ls\"\n", al_string_get_cstr(entry.name), al_string_get_cstr(entry.endpoint_guid), entry.devid); + TRACE("Got device \"%s\", \"%s\", \"%ls\"\n", alstr_get_cstr(entry.name), alstr_get_cstr(entry.endpoint_guid), entry.devid); VECTOR_PUSH_BACK(*list, entry); AL_STRING_DEINIT(tmpname); } -static LPWSTR get_device_id(IMMDevice *device) +static WCHAR *get_device_id(IMMDevice *device) { - LPWSTR devid; + WCHAR *devid; HRESULT hr; hr = IMMDevice_GetId(device, &devid); @@ -268,7 +288,7 @@ static HRESULT probe_devices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, ve { IMMDeviceCollection *coll; IMMDevice *defdev = NULL; - LPWSTR defdevid = NULL; + WCHAR *defdevid = NULL; HRESULT hr; UINT count; UINT i; @@ -300,7 +320,7 @@ static HRESULT probe_devices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, ve for(i = 0;i < count;++i) { IMMDevice *device; - LPWSTR devid; + WCHAR *devid; hr = IMMDeviceCollection_Item(coll, i, &device); if(FAILED(hr)) continue; @@ -324,51 +344,51 @@ static HRESULT probe_devices(IMMDeviceEnumerator *devenum, EDataFlow flowdir, ve /* Proxy interface used by the message handler. */ -struct ALCmmdevProxyVtable; +struct ALCwasapiProxyVtable; -typedef struct ALCmmdevProxy { - const struct ALCmmdevProxyVtable *vtbl; -} ALCmmdevProxy; +typedef struct ALCwasapiProxy { + const struct ALCwasapiProxyVtable *vtbl; +} ALCwasapiProxy; -struct ALCmmdevProxyVtable { - HRESULT (*const openProxy)(ALCmmdevProxy*); - void (*const closeProxy)(ALCmmdevProxy*); +struct ALCwasapiProxyVtable { + HRESULT (*const openProxy)(ALCwasapiProxy*); + void (*const closeProxy)(ALCwasapiProxy*); - HRESULT (*const resetProxy)(ALCmmdevProxy*); - HRESULT (*const startProxy)(ALCmmdevProxy*); - void (*const stopProxy)(ALCmmdevProxy*); + HRESULT (*const resetProxy)(ALCwasapiProxy*); + HRESULT (*const startProxy)(ALCwasapiProxy*); + void (*const stopProxy)(ALCwasapiProxy*); }; -#define DEFINE_ALCMMDEVPROXY_VTABLE(T) \ -DECLARE_THUNK(T, ALCmmdevProxy, HRESULT, openProxy) \ -DECLARE_THUNK(T, ALCmmdevProxy, void, closeProxy) \ -DECLARE_THUNK(T, ALCmmdevProxy, HRESULT, resetProxy) \ -DECLARE_THUNK(T, ALCmmdevProxy, HRESULT, startProxy) \ -DECLARE_THUNK(T, ALCmmdevProxy, void, stopProxy) \ +#define DEFINE_ALCWASAPIPROXY_VTABLE(T) \ +DECLARE_THUNK(T, ALCwasapiProxy, HRESULT, openProxy) \ +DECLARE_THUNK(T, ALCwasapiProxy, void, closeProxy) \ +DECLARE_THUNK(T, ALCwasapiProxy, HRESULT, resetProxy) \ +DECLARE_THUNK(T, ALCwasapiProxy, HRESULT, startProxy) \ +DECLARE_THUNK(T, ALCwasapiProxy, void, stopProxy) \ \ -static const struct ALCmmdevProxyVtable T##_ALCmmdevProxy_vtable = { \ - T##_ALCmmdevProxy_openProxy, \ - T##_ALCmmdevProxy_closeProxy, \ - T##_ALCmmdevProxy_resetProxy, \ - T##_ALCmmdevProxy_startProxy, \ - T##_ALCmmdevProxy_stopProxy, \ +static const struct ALCwasapiProxyVtable T##_ALCwasapiProxy_vtable = { \ + T##_ALCwasapiProxy_openProxy, \ + T##_ALCwasapiProxy_closeProxy, \ + T##_ALCwasapiProxy_resetProxy, \ + T##_ALCwasapiProxy_startProxy, \ + T##_ALCwasapiProxy_stopProxy, \ } -static void ALCmmdevProxy_Construct(ALCmmdevProxy* UNUSED(self)) { } -static void ALCmmdevProxy_Destruct(ALCmmdevProxy* UNUSED(self)) { } +static void ALCwasapiProxy_Construct(ALCwasapiProxy* UNUSED(self)) { } +static void ALCwasapiProxy_Destruct(ALCwasapiProxy* UNUSED(self)) { } -static DWORD CALLBACK ALCmmdevProxy_messageHandler(void *ptr) +static DWORD CALLBACK ALCwasapiProxy_messageHandler(void *ptr) { ThreadRequest *req = ptr; IMMDeviceEnumerator *Enumerator; ALuint deviceCount = 0; - ALCmmdevProxy *proxy; + ALCwasapiProxy *proxy; HRESULT hr, cohr; MSG msg; TRACE("Starting message thread\n"); - cohr = CoInitialize(NULL); + cohr = CoInitializeEx(NULL, COINIT_MULTITHREADED); if(FAILED(cohr)) { WARN("Failed to initialize COM: 0x%08lx\n", cohr); @@ -402,16 +422,20 @@ static DWORD CALLBACK ALCmmdevProxy_messageHandler(void *ptr) TRACE("Starting message loop\n"); while(GetMessage(&msg, NULL, WM_USER_First, WM_USER_Last)) { - TRACE("Got message %u (lparam=%p, wparam=%p)\n", msg.message, (void*)msg.lParam, (void*)msg.wParam); + TRACE("Got message \"%s\" (0x%04x, lparam=%p, wparam=%p)\n", + (msg.message >= WM_USER && msg.message <= WM_USER_Last) ? + MessageStr[msg.message-WM_USER] : "Unknown", + msg.message, (void*)msg.lParam, (void*)msg.wParam + ); switch(msg.message) { case WM_USER_OpenDevice: req = (ThreadRequest*)msg.wParam; - proxy = (ALCmmdevProxy*)msg.lParam; + proxy = (ALCwasapiProxy*)msg.lParam; hr = cohr = S_OK; if(++deviceCount == 1) - hr = cohr = CoInitialize(NULL); + hr = cohr = CoInitializeEx(NULL, COINIT_MULTITHREADED); if(SUCCEEDED(hr)) hr = V0(proxy,openProxy)(); if(FAILED(hr)) @@ -425,7 +449,7 @@ static DWORD CALLBACK ALCmmdevProxy_messageHandler(void *ptr) case WM_USER_ResetDevice: req = (ThreadRequest*)msg.wParam; - proxy = (ALCmmdevProxy*)msg.lParam; + proxy = (ALCwasapiProxy*)msg.lParam; hr = V0(proxy,resetProxy)(); ReturnMsgResponse(req, hr); @@ -433,7 +457,7 @@ static DWORD CALLBACK ALCmmdevProxy_messageHandler(void *ptr) case WM_USER_StartDevice: req = (ThreadRequest*)msg.wParam; - proxy = (ALCmmdevProxy*)msg.lParam; + proxy = (ALCwasapiProxy*)msg.lParam; hr = V0(proxy,startProxy)(); ReturnMsgResponse(req, hr); @@ -441,7 +465,7 @@ static DWORD CALLBACK ALCmmdevProxy_messageHandler(void *ptr) case WM_USER_StopDevice: req = (ThreadRequest*)msg.wParam; - proxy = (ALCmmdevProxy*)msg.lParam; + proxy = (ALCwasapiProxy*)msg.lParam; V0(proxy,stopProxy)(); ReturnMsgResponse(req, S_OK); @@ -449,7 +473,7 @@ static DWORD CALLBACK ALCmmdevProxy_messageHandler(void *ptr) case WM_USER_CloseDevice: req = (ThreadRequest*)msg.wParam; - proxy = (ALCmmdevProxy*)msg.lParam; + proxy = (ALCwasapiProxy*)msg.lParam; V0(proxy,closeProxy)(); if(--deviceCount == 0) @@ -463,7 +487,7 @@ static DWORD CALLBACK ALCmmdevProxy_messageHandler(void *ptr) hr = cohr = S_OK; if(++deviceCount == 1) - hr = cohr = CoInitialize(NULL); + hr = cohr = CoInitializeEx(NULL, COINIT_MULTITHREADED); if(SUCCEEDED(hr)) hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &IID_IMMDeviceEnumerator, &ptr); if(SUCCEEDED(hr)) @@ -496,9 +520,9 @@ static DWORD CALLBACK ALCmmdevProxy_messageHandler(void *ptr) } -typedef struct ALCmmdevPlayback { +typedef struct ALCwasapiPlayback { DERIVE_FROM_TYPE(ALCbackend); - DERIVE_FROM_TYPE(ALCmmdevProxy); + DERIVE_FROM_TYPE(ALCwasapiProxy); WCHAR *devid; @@ -509,43 +533,42 @@ typedef struct ALCmmdevPlayback { HANDLE MsgEvent; - volatile UINT32 Padding; + ATOMIC(UINT32) Padding; - volatile int killNow; + ATOMIC(int) killNow; althrd_t thread; -} ALCmmdevPlayback; +} ALCwasapiPlayback; -static int ALCmmdevPlayback_mixerProc(void *arg); +static int ALCwasapiPlayback_mixerProc(void *arg); -static void ALCmmdevPlayback_Construct(ALCmmdevPlayback *self, ALCdevice *device); -static void ALCmmdevPlayback_Destruct(ALCmmdevPlayback *self); -static ALCenum ALCmmdevPlayback_open(ALCmmdevPlayback *self, const ALCchar *name); -static HRESULT ALCmmdevPlayback_openProxy(ALCmmdevPlayback *self); -static void ALCmmdevPlayback_close(ALCmmdevPlayback *self); -static void ALCmmdevPlayback_closeProxy(ALCmmdevPlayback *self); -static ALCboolean ALCmmdevPlayback_reset(ALCmmdevPlayback *self); -static HRESULT ALCmmdevPlayback_resetProxy(ALCmmdevPlayback *self); -static ALCboolean ALCmmdevPlayback_start(ALCmmdevPlayback *self); -static HRESULT ALCmmdevPlayback_startProxy(ALCmmdevPlayback *self); -static void ALCmmdevPlayback_stop(ALCmmdevPlayback *self); -static void ALCmmdevPlayback_stopProxy(ALCmmdevPlayback *self); -static DECLARE_FORWARD2(ALCmmdevPlayback, ALCbackend, ALCenum, captureSamples, ALCvoid*, ALCuint) -static DECLARE_FORWARD(ALCmmdevPlayback, ALCbackend, ALCuint, availableSamples) -static ClockLatency ALCmmdevPlayback_getClockLatency(ALCmmdevPlayback *self); -static DECLARE_FORWARD(ALCmmdevPlayback, ALCbackend, void, lock) -static DECLARE_FORWARD(ALCmmdevPlayback, ALCbackend, void, unlock) -DECLARE_DEFAULT_ALLOCATORS(ALCmmdevPlayback) +static void ALCwasapiPlayback_Construct(ALCwasapiPlayback *self, ALCdevice *device); +static void ALCwasapiPlayback_Destruct(ALCwasapiPlayback *self); +static ALCenum ALCwasapiPlayback_open(ALCwasapiPlayback *self, const ALCchar *name); +static HRESULT ALCwasapiPlayback_openProxy(ALCwasapiPlayback *self); +static void ALCwasapiPlayback_closeProxy(ALCwasapiPlayback *self); +static ALCboolean ALCwasapiPlayback_reset(ALCwasapiPlayback *self); +static HRESULT ALCwasapiPlayback_resetProxy(ALCwasapiPlayback *self); +static ALCboolean ALCwasapiPlayback_start(ALCwasapiPlayback *self); +static HRESULT ALCwasapiPlayback_startProxy(ALCwasapiPlayback *self); +static void ALCwasapiPlayback_stop(ALCwasapiPlayback *self); +static void ALCwasapiPlayback_stopProxy(ALCwasapiPlayback *self); +static DECLARE_FORWARD2(ALCwasapiPlayback, ALCbackend, ALCenum, captureSamples, ALCvoid*, ALCuint) +static DECLARE_FORWARD(ALCwasapiPlayback, ALCbackend, ALCuint, availableSamples) +static ClockLatency ALCwasapiPlayback_getClockLatency(ALCwasapiPlayback *self); +static DECLARE_FORWARD(ALCwasapiPlayback, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCwasapiPlayback, ALCbackend, void, unlock) +DECLARE_DEFAULT_ALLOCATORS(ALCwasapiPlayback) -DEFINE_ALCMMDEVPROXY_VTABLE(ALCmmdevPlayback); -DEFINE_ALCBACKEND_VTABLE(ALCmmdevPlayback); +DEFINE_ALCWASAPIPROXY_VTABLE(ALCwasapiPlayback); +DEFINE_ALCBACKEND_VTABLE(ALCwasapiPlayback); -static void ALCmmdevPlayback_Construct(ALCmmdevPlayback *self, ALCdevice *device) +static void ALCwasapiPlayback_Construct(ALCwasapiPlayback *self, ALCdevice *device) { - SET_VTABLE2(ALCmmdevPlayback, ALCbackend, self); - SET_VTABLE2(ALCmmdevPlayback, ALCmmdevProxy, self); + SET_VTABLE2(ALCwasapiPlayback, ALCbackend, self); + SET_VTABLE2(ALCwasapiPlayback, ALCwasapiProxy, self); ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); - ALCmmdevProxy_Construct(STATIC_CAST(ALCmmdevProxy, self)); + ALCwasapiProxy_Construct(STATIC_CAST(ALCwasapiProxy, self)); self->devid = NULL; @@ -556,13 +579,30 @@ static void ALCmmdevPlayback_Construct(ALCmmdevPlayback *self, ALCdevice *device self->MsgEvent = NULL; - self->Padding = 0; + ATOMIC_INIT(&self->Padding, 0); - self->killNow = 0; + ATOMIC_INIT(&self->killNow, 0); } -static void ALCmmdevPlayback_Destruct(ALCmmdevPlayback *self) +static void ALCwasapiPlayback_Destruct(ALCwasapiPlayback *self) { + if(self->MsgEvent) + { + ThreadRequest req = { self->MsgEvent, 0 }; + if(PostThreadMessage(ThreadID, WM_USER_CloseDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) + (void)WaitForResponse(&req); + + CloseHandle(self->MsgEvent); + self->MsgEvent = NULL; + } + + if(self->NotifyEvent) + CloseHandle(self->NotifyEvent); + self->NotifyEvent = NULL; + + free(self->devid); + self->devid = NULL; + if(self->NotifyEvent != NULL) CloseHandle(self->NotifyEvent); self->NotifyEvent = NULL; @@ -573,26 +613,26 @@ static void ALCmmdevPlayback_Destruct(ALCmmdevPlayback *self) free(self->devid); self->devid = NULL; - ALCmmdevProxy_Destruct(STATIC_CAST(ALCmmdevProxy, self)); + ALCwasapiProxy_Destruct(STATIC_CAST(ALCwasapiProxy, self)); ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } -FORCE_ALIGN static int ALCmmdevPlayback_mixerProc(void *arg) +FORCE_ALIGN static int ALCwasapiPlayback_mixerProc(void *arg) { - ALCmmdevPlayback *self = arg; + ALCwasapiPlayback *self = arg; ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; UINT32 buffer_len, written; ALuint update_size, len; BYTE *buffer; HRESULT hr; - hr = CoInitialize(NULL); + hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); if(FAILED(hr)) { - ERR("CoInitialize(NULL) failed: 0x%08lx\n", hr); + ERR("CoInitializeEx(NULL, COINIT_MULTITHREADED) failed: 0x%08lx\n", hr); V0(device->Backend,lock)(); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "COM init failed: 0x%08lx", hr); V0(device->Backend,unlock)(); return 1; } @@ -602,18 +642,18 @@ FORCE_ALIGN static int ALCmmdevPlayback_mixerProc(void *arg) update_size = device->UpdateSize; buffer_len = update_size * device->NumUpdates; - while(!self->killNow) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_relaxed)) { hr = IAudioClient_GetCurrentPadding(self->client, &written); if(FAILED(hr)) { ERR("Failed to get padding: 0x%08lx\n", hr); V0(device->Backend,lock)(); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed to retrieve buffer padding: 0x%08lx", hr); V0(device->Backend,unlock)(); break; } - self->Padding = written; + ATOMIC_STORE(&self->Padding, written, almemory_order_relaxed); len = buffer_len - written; if(len < update_size) @@ -629,22 +669,22 @@ FORCE_ALIGN static int ALCmmdevPlayback_mixerProc(void *arg) hr = IAudioRenderClient_GetBuffer(self->render, len, &buffer); if(SUCCEEDED(hr)) { - V0(device->Backend,lock)(); + ALCwasapiPlayback_lock(self); aluMixData(device, buffer, len); - self->Padding = written + len; - V0(device->Backend,unlock)(); + ATOMIC_STORE(&self->Padding, written + len, almemory_order_relaxed); + ALCwasapiPlayback_unlock(self); hr = IAudioRenderClient_ReleaseBuffer(self->render, len, 0); } if(FAILED(hr)) { ERR("Failed to buffer data: 0x%08lx\n", hr); V0(device->Backend,lock)(); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed to send playback samples: 0x%08lx", hr); V0(device->Backend,unlock)(); break; } } - self->Padding = 0; + ATOMIC_STORE(&self->Padding, 0, almemory_order_release); CoUninitialize(); return 0; @@ -690,7 +730,7 @@ static ALCboolean MakeExtensible(WAVEFORMATEXTENSIBLE *out, const WAVEFORMATEX * return ALC_TRUE; } -static ALCenum ALCmmdevPlayback_open(ALCmmdevPlayback *self, const ALCchar *deviceName) +static ALCenum ALCwasapiPlayback_open(ALCwasapiPlayback *self, const ALCchar *deviceName) { HRESULT hr = S_OK; @@ -716,8 +756,8 @@ static ALCenum ALCmmdevPlayback_open(ALCmmdevPlayback *self, const ALCchar *devi } hr = E_FAIL; -#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, deviceName) == 0 || \ - al_string_cmp_cstr((i)->endpoint_guid, deviceName) == 0) +#define MATCH_NAME(i) (alstr_cmp_cstr((i)->name, deviceName) == 0 || \ + alstr_cmp_cstr((i)->endpoint_guid, deviceName) == 0) VECTOR_FIND_IF(iter, const DevMap, PlaybackDevices, MATCH_NAME); #undef MATCH_NAME if(iter == VECTOR_END(PlaybackDevices)) @@ -739,7 +779,7 @@ static ALCenum ALCmmdevPlayback_open(ALCmmdevPlayback *self, const ALCchar *devi { ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; self->devid = strdupW(iter->devid); - al_string_copy(&device->DeviceName, iter->name); + alstr_copy(&device->DeviceName, iter->name); hr = S_OK; } } @@ -750,7 +790,7 @@ static ALCenum ALCmmdevPlayback_open(ALCmmdevPlayback *self, const ALCchar *devi ThreadRequest req = { self->MsgEvent, 0 }; hr = E_FAIL; - if(PostThreadMessage(ThreadID, WM_USER_OpenDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) + if(PostThreadMessage(ThreadID, WM_USER_OpenDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) hr = WaitForResponse(&req); else ERR("Failed to post thread message: %lu\n", GetLastError()); @@ -775,7 +815,7 @@ static ALCenum ALCmmdevPlayback_open(ALCmmdevPlayback *self, const ALCchar *devi return ALC_NO_ERROR; } -static HRESULT ALCmmdevPlayback_openProxy(ALCmmdevPlayback *self) +static HRESULT ALCwasapiPlayback_openProxy(ALCwasapiPlayback *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; void *ptr; @@ -797,7 +837,7 @@ static HRESULT ALCmmdevPlayback_openProxy(ALCmmdevPlayback *self) if(SUCCEEDED(hr)) { self->client = ptr; - if(al_string_empty(device->DeviceName)) + if(alstr_empty(device->DeviceName)) get_device_name_and_guid(self->mmdev, &device->DeviceName, NULL); } @@ -812,24 +852,7 @@ static HRESULT ALCmmdevPlayback_openProxy(ALCmmdevPlayback *self) } -static void ALCmmdevPlayback_close(ALCmmdevPlayback *self) -{ - ThreadRequest req = { self->MsgEvent, 0 }; - - if(PostThreadMessage(ThreadID, WM_USER_CloseDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) - (void)WaitForResponse(&req); - - CloseHandle(self->MsgEvent); - self->MsgEvent = NULL; - - CloseHandle(self->NotifyEvent); - self->NotifyEvent = NULL; - - free(self->devid); - self->devid = NULL; -} - -static void ALCmmdevPlayback_closeProxy(ALCmmdevPlayback *self) +static void ALCwasapiPlayback_closeProxy(ALCwasapiPlayback *self) { if(self->client) IAudioClient_Release(self->client); @@ -841,18 +864,18 @@ static void ALCmmdevPlayback_closeProxy(ALCmmdevPlayback *self) } -static ALCboolean ALCmmdevPlayback_reset(ALCmmdevPlayback *self) +static ALCboolean ALCwasapiPlayback_reset(ALCwasapiPlayback *self) { ThreadRequest req = { self->MsgEvent, 0 }; HRESULT hr = E_FAIL; - if(PostThreadMessage(ThreadID, WM_USER_ResetDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) + if(PostThreadMessage(ThreadID, WM_USER_ResetDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) hr = WaitForResponse(&req); return SUCCEEDED(hr) ? ALC_TRUE : ALC_FALSE; } -static HRESULT ALCmmdevPlayback_resetProxy(ALCmmdevPlayback *self) +static HRESULT ALCwasapiPlayback_resetProxy(ALCwasapiPlayback *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; EndpointFormFactor formfactor = UnknownFormFactor; @@ -890,8 +913,8 @@ static HRESULT ALCmmdevPlayback_resetProxy(ALCmmdevPlayback *self) CoTaskMemFree(wfx); wfx = NULL; - buf_time = ((REFERENCE_TIME)device->UpdateSize*device->NumUpdates*10000000 + - device->Frequency-1) / device->Frequency; + buf_time = ScaleCeil(device->UpdateSize*device->NumUpdates, REFTIME_PER_SEC, + device->Frequency); if(!(device->Flags&DEVICE_FREQUENCY_REQUEST)) device->Frequency = OutputType.Format.nSamplesPerSec; @@ -921,9 +944,7 @@ static HRESULT ALCmmdevPlayback_resetProxy(ALCmmdevPlayback *self) OutputType.Format.nChannels = 1; OutputType.dwChannelMask = MONO; break; - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: device->FmtChans = DevFmtStereo; /*fall-through*/ case DevFmtStereo: @@ -1082,7 +1103,7 @@ static HRESULT ALCmmdevPlayback_resetProxy(ALCmmdevPlayback *self) hr = IAudioClient_GetDevicePeriod(self->client, &min_per, NULL); if(SUCCEEDED(hr)) { - min_len = (UINT32)((min_per*device->Frequency + 10000000-1) / 10000000); + min_len = (UINT32)ScaleCeil(min_per, device->Frequency, REFTIME_PER_SEC); /* Find the nearest multiple of the period size to the update size */ if(min_len < device->UpdateSize) min_len *= (device->UpdateSize + min_len/2)/min_len; @@ -1114,18 +1135,18 @@ static HRESULT ALCmmdevPlayback_resetProxy(ALCmmdevPlayback *self) } -static ALCboolean ALCmmdevPlayback_start(ALCmmdevPlayback *self) +static ALCboolean ALCwasapiPlayback_start(ALCwasapiPlayback *self) { ThreadRequest req = { self->MsgEvent, 0 }; HRESULT hr = E_FAIL; - if(PostThreadMessage(ThreadID, WM_USER_StartDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) + if(PostThreadMessage(ThreadID, WM_USER_StartDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) hr = WaitForResponse(&req); return SUCCEEDED(hr) ? ALC_TRUE : ALC_FALSE; } -static HRESULT ALCmmdevPlayback_startProxy(ALCmmdevPlayback *self) +static HRESULT ALCwasapiPlayback_startProxy(ALCwasapiPlayback *self) { HRESULT hr; void *ptr; @@ -1140,8 +1161,8 @@ static HRESULT ALCmmdevPlayback_startProxy(ALCmmdevPlayback *self) if(SUCCEEDED(hr)) { self->render = ptr; - self->killNow = 0; - if(althrd_create(&self->thread, ALCmmdevPlayback_mixerProc, self) != althrd_success) + ATOMIC_STORE(&self->killNow, 0, almemory_order_release); + if(althrd_create(&self->thread, ALCwasapiPlayback_mixerProc, self) != althrd_success) { if(self->render) IAudioRenderClient_Release(self->render); @@ -1156,21 +1177,21 @@ static HRESULT ALCmmdevPlayback_startProxy(ALCmmdevPlayback *self) } -static void ALCmmdevPlayback_stop(ALCmmdevPlayback *self) +static void ALCwasapiPlayback_stop(ALCwasapiPlayback *self) { ThreadRequest req = { self->MsgEvent, 0 }; - if(PostThreadMessage(ThreadID, WM_USER_StopDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) + if(PostThreadMessage(ThreadID, WM_USER_StopDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) (void)WaitForResponse(&req); } -static void ALCmmdevPlayback_stopProxy(ALCmmdevPlayback *self) +static void ALCwasapiPlayback_stopProxy(ALCwasapiPlayback *self) { int res; if(!self->render) return; - self->killNow = 1; + ATOMIC_STORE_SEQ(&self->killNow, 1); althrd_join(self->thread, &res); IAudioRenderClient_Release(self->render); @@ -1179,23 +1200,24 @@ static void ALCmmdevPlayback_stopProxy(ALCmmdevPlayback *self) } -static ClockLatency ALCmmdevPlayback_getClockLatency(ALCmmdevPlayback *self) +static ClockLatency ALCwasapiPlayback_getClockLatency(ALCwasapiPlayback *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; ClockLatency ret; - ALCmmdevPlayback_lock(self); + ALCwasapiPlayback_lock(self); ret.ClockTime = GetDeviceClockTime(device); - ret.Latency = self->Padding * DEVICE_CLOCK_RES / device->Frequency; - ALCmmdevPlayback_unlock(self); + ret.Latency = ATOMIC_LOAD(&self->Padding, almemory_order_relaxed) * DEVICE_CLOCK_RES / + device->Frequency; + ALCwasapiPlayback_unlock(self); return ret; } -typedef struct ALCmmdevCapture { +typedef struct ALCwasapiCapture { DERIVE_FROM_TYPE(ALCbackend); - DERIVE_FROM_TYPE(ALCmmdevProxy); + DERIVE_FROM_TYPE(ALCwasapiProxy); WCHAR *devid; @@ -1206,43 +1228,44 @@ typedef struct ALCmmdevCapture { HANDLE MsgEvent; + ChannelConverter *ChannelConv; + SampleConverter *SampleConv; ll_ringbuffer_t *Ring; - volatile int killNow; + ATOMIC(int) killNow; althrd_t thread; -} ALCmmdevCapture; +} ALCwasapiCapture; -static int ALCmmdevCapture_recordProc(void *arg); +static int ALCwasapiCapture_recordProc(void *arg); -static void ALCmmdevCapture_Construct(ALCmmdevCapture *self, ALCdevice *device); -static void ALCmmdevCapture_Destruct(ALCmmdevCapture *self); -static ALCenum ALCmmdevCapture_open(ALCmmdevCapture *self, const ALCchar *name); -static HRESULT ALCmmdevCapture_openProxy(ALCmmdevCapture *self); -static void ALCmmdevCapture_close(ALCmmdevCapture *self); -static void ALCmmdevCapture_closeProxy(ALCmmdevCapture *self); -static DECLARE_FORWARD(ALCmmdevCapture, ALCbackend, ALCboolean, reset) -static HRESULT ALCmmdevCapture_resetProxy(ALCmmdevCapture *self); -static ALCboolean ALCmmdevCapture_start(ALCmmdevCapture *self); -static HRESULT ALCmmdevCapture_startProxy(ALCmmdevCapture *self); -static void ALCmmdevCapture_stop(ALCmmdevCapture *self); -static void ALCmmdevCapture_stopProxy(ALCmmdevCapture *self); -static ALCenum ALCmmdevCapture_captureSamples(ALCmmdevCapture *self, ALCvoid *buffer, ALCuint samples); -static ALuint ALCmmdevCapture_availableSamples(ALCmmdevCapture *self); -static DECLARE_FORWARD(ALCmmdevCapture, ALCbackend, ClockLatency, getClockLatency) -static DECLARE_FORWARD(ALCmmdevCapture, ALCbackend, void, lock) -static DECLARE_FORWARD(ALCmmdevCapture, ALCbackend, void, unlock) -DECLARE_DEFAULT_ALLOCATORS(ALCmmdevCapture) +static void ALCwasapiCapture_Construct(ALCwasapiCapture *self, ALCdevice *device); +static void ALCwasapiCapture_Destruct(ALCwasapiCapture *self); +static ALCenum ALCwasapiCapture_open(ALCwasapiCapture *self, const ALCchar *name); +static HRESULT ALCwasapiCapture_openProxy(ALCwasapiCapture *self); +static void ALCwasapiCapture_closeProxy(ALCwasapiCapture *self); +static DECLARE_FORWARD(ALCwasapiCapture, ALCbackend, ALCboolean, reset) +static HRESULT ALCwasapiCapture_resetProxy(ALCwasapiCapture *self); +static ALCboolean ALCwasapiCapture_start(ALCwasapiCapture *self); +static HRESULT ALCwasapiCapture_startProxy(ALCwasapiCapture *self); +static void ALCwasapiCapture_stop(ALCwasapiCapture *self); +static void ALCwasapiCapture_stopProxy(ALCwasapiCapture *self); +static ALCenum ALCwasapiCapture_captureSamples(ALCwasapiCapture *self, ALCvoid *buffer, ALCuint samples); +static ALuint ALCwasapiCapture_availableSamples(ALCwasapiCapture *self); +static DECLARE_FORWARD(ALCwasapiCapture, ALCbackend, ClockLatency, getClockLatency) +static DECLARE_FORWARD(ALCwasapiCapture, ALCbackend, void, lock) +static DECLARE_FORWARD(ALCwasapiCapture, ALCbackend, void, unlock) +DECLARE_DEFAULT_ALLOCATORS(ALCwasapiCapture) -DEFINE_ALCMMDEVPROXY_VTABLE(ALCmmdevCapture); -DEFINE_ALCBACKEND_VTABLE(ALCmmdevCapture); +DEFINE_ALCWASAPIPROXY_VTABLE(ALCwasapiCapture); +DEFINE_ALCBACKEND_VTABLE(ALCwasapiCapture); -static void ALCmmdevCapture_Construct(ALCmmdevCapture *self, ALCdevice *device) +static void ALCwasapiCapture_Construct(ALCwasapiCapture *self, ALCdevice *device) { - SET_VTABLE2(ALCmmdevCapture, ALCbackend, self); - SET_VTABLE2(ALCmmdevCapture, ALCmmdevProxy, self); + SET_VTABLE2(ALCwasapiCapture, ALCbackend, self); + SET_VTABLE2(ALCwasapiCapture, ALCwasapiProxy, self); ALCbackend_Construct(STATIC_CAST(ALCbackend, self), device); - ALCmmdevProxy_Construct(STATIC_CAST(ALCmmdevProxy, self)); + ALCwasapiProxy_Construct(STATIC_CAST(ALCwasapiProxy, self)); self->devid = NULL; @@ -1253,50 +1276,64 @@ static void ALCmmdevCapture_Construct(ALCmmdevCapture *self, ALCdevice *device) self->MsgEvent = NULL; + self->ChannelConv = NULL; + self->SampleConv = NULL; self->Ring = NULL; - self->killNow = 0; + ATOMIC_INIT(&self->killNow, 0); } -static void ALCmmdevCapture_Destruct(ALCmmdevCapture *self) +static void ALCwasapiCapture_Destruct(ALCwasapiCapture *self) { - ll_ringbuffer_free(self->Ring); - self->Ring = NULL; + if(self->MsgEvent) + { + ThreadRequest req = { self->MsgEvent, 0 }; + if(PostThreadMessage(ThreadID, WM_USER_CloseDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) + (void)WaitForResponse(&req); + + CloseHandle(self->MsgEvent); + self->MsgEvent = NULL; + } if(self->NotifyEvent != NULL) CloseHandle(self->NotifyEvent); self->NotifyEvent = NULL; - if(self->MsgEvent != NULL) - CloseHandle(self->MsgEvent); - self->MsgEvent = NULL; + + ll_ringbuffer_free(self->Ring); + self->Ring = NULL; + + DestroySampleConverter(&self->SampleConv); + DestroyChannelConverter(&self->ChannelConv); free(self->devid); self->devid = NULL; - ALCmmdevProxy_Destruct(STATIC_CAST(ALCmmdevProxy, self)); + ALCwasapiProxy_Destruct(STATIC_CAST(ALCwasapiProxy, self)); ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); } -FORCE_ALIGN int ALCmmdevCapture_recordProc(void *arg) +FORCE_ALIGN int ALCwasapiCapture_recordProc(void *arg) { - ALCmmdevCapture *self = arg; + ALCwasapiCapture *self = arg; ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; + ALfloat *samples = NULL; + size_t samplesmax = 0; HRESULT hr; - hr = CoInitialize(NULL); + hr = CoInitializeEx(NULL, COINIT_MULTITHREADED); if(FAILED(hr)) { - ERR("CoInitialize(NULL) failed: 0x%08lx\n", hr); + ERR("CoInitializeEx(NULL, COINIT_MULTITHREADED) failed: 0x%08lx\n", hr); V0(device->Backend,lock)(); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "COM init failed: 0x%08lx", hr); V0(device->Backend,unlock)(); return 1; } althrd_setname(althrd_current(), RECORD_THREAD_NAME); - while(!self->killNow) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_relaxed)) { UINT32 avail; DWORD res; @@ -1304,39 +1341,81 @@ FORCE_ALIGN int ALCmmdevCapture_recordProc(void *arg) hr = IAudioCaptureClient_GetNextPacketSize(self->capture, &avail); if(FAILED(hr)) ERR("Failed to get next packet size: 0x%08lx\n", hr); - else while(avail > 0 && SUCCEEDED(hr)) + else if(avail > 0) { UINT32 numsamples; DWORD flags; - BYTE *data; + BYTE *rdata; hr = IAudioCaptureClient_GetBuffer(self->capture, - &data, &numsamples, &flags, NULL, NULL + &rdata, &numsamples, &flags, NULL, NULL ); if(FAILED(hr)) - { ERR("Failed to get capture buffer: 0x%08lx\n", hr); - break; - } - - ll_ringbuffer_write(self->Ring, (char*)data, numsamples); - - hr = IAudioCaptureClient_ReleaseBuffer(self->capture, numsamples); - if(FAILED(hr)) + else { - ERR("Failed to release capture buffer: 0x%08lx\n", hr); - break; - } + ll_ringbuffer_data_t data[2]; + size_t dstframes = 0; - hr = IAudioCaptureClient_GetNextPacketSize(self->capture, &avail); - if(FAILED(hr)) - ERR("Failed to get next packet size: 0x%08lx\n", hr); + if(self->ChannelConv) + { + if(samplesmax < numsamples) + { + size_t newmax = RoundUp(numsamples, 4096); + ALfloat *tmp = al_calloc(DEF_ALIGN, newmax*2*sizeof(ALfloat)); + al_free(samples); + samples = tmp; + samplesmax = newmax; + } + ChannelConverterInput(self->ChannelConv, rdata, samples, numsamples); + rdata = (BYTE*)samples; + } + + ll_ringbuffer_get_write_vector(self->Ring, data); + + if(self->SampleConv) + { + const ALvoid *srcdata = rdata; + ALsizei srcframes = numsamples; + + dstframes = SampleConverterInput(self->SampleConv, + &srcdata, &srcframes, data[0].buf, (ALsizei)minz(data[0].len, INT_MAX) + ); + if(srcframes > 0 && dstframes == data[0].len && data[1].len > 0) + { + /* If some source samples remain, all of the first dest + * block was filled, and there's space in the second + * dest block, do another run for the second block. + */ + dstframes += SampleConverterInput(self->SampleConv, + &srcdata, &srcframes, data[1].buf, (ALsizei)minz(data[1].len, INT_MAX) + ); + } + } + else + { + ALuint framesize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, + device->AmbiOrder); + size_t len1 = minz(data[0].len, numsamples); + size_t len2 = minz(data[1].len, numsamples-len1); + + memcpy(data[0].buf, rdata, len1*framesize); + if(len2 > 0) + memcpy(data[1].buf, rdata+len1*framesize, len2*framesize); + dstframes = len1 + len2; + } + + ll_ringbuffer_write_advance(self->Ring, dstframes); + + hr = IAudioCaptureClient_ReleaseBuffer(self->capture, numsamples); + if(FAILED(hr)) ERR("Failed to release capture buffer: 0x%08lx\n", hr); + } } if(FAILED(hr)) { V0(device->Backend,lock)(); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed to capture samples: 0x%08lx", hr); V0(device->Backend,unlock)(); break; } @@ -1346,12 +1425,16 @@ FORCE_ALIGN int ALCmmdevCapture_recordProc(void *arg) ERR("WaitForSingleObjectEx error: 0x%lx\n", res); } + al_free(samples); + samples = NULL; + samplesmax = 0; + CoUninitialize(); return 0; } -static ALCenum ALCmmdevCapture_open(ALCmmdevCapture *self, const ALCchar *deviceName) +static ALCenum ALCwasapiCapture_open(ALCwasapiCapture *self, const ALCchar *deviceName) { HRESULT hr = S_OK; @@ -1377,8 +1460,8 @@ static ALCenum ALCmmdevCapture_open(ALCmmdevCapture *self, const ALCchar *device } hr = E_FAIL; -#define MATCH_NAME(i) (al_string_cmp_cstr((i)->name, deviceName) == 0 || \ - al_string_cmp_cstr((i)->endpoint_guid, deviceName) == 0) +#define MATCH_NAME(i) (alstr_cmp_cstr((i)->name, deviceName) == 0 || \ + alstr_cmp_cstr((i)->endpoint_guid, deviceName) == 0) VECTOR_FIND_IF(iter, const DevMap, CaptureDevices, MATCH_NAME); #undef MATCH_NAME if(iter == VECTOR_END(CaptureDevices)) @@ -1400,7 +1483,7 @@ static ALCenum ALCmmdevCapture_open(ALCmmdevCapture *self, const ALCchar *device { ALCdevice *device = STATIC_CAST(ALCbackend,self)->mDevice; self->devid = strdupW(iter->devid); - al_string_copy(&device->DeviceName, iter->name); + alstr_copy(&device->DeviceName, iter->name); hr = S_OK; } } @@ -1411,7 +1494,7 @@ static ALCenum ALCmmdevCapture_open(ALCmmdevCapture *self, const ALCchar *device ThreadRequest req = { self->MsgEvent, 0 }; hr = E_FAIL; - if(PostThreadMessage(ThreadID, WM_USER_OpenDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) + if(PostThreadMessage(ThreadID, WM_USER_OpenDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) hr = WaitForResponse(&req); else ERR("Failed to post thread message: %lu\n", GetLastError()); @@ -1437,14 +1520,13 @@ static ALCenum ALCmmdevCapture_open(ALCmmdevCapture *self, const ALCchar *device ThreadRequest req = { self->MsgEvent, 0 }; hr = E_FAIL; - if(PostThreadMessage(ThreadID, WM_USER_ResetDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) + if(PostThreadMessage(ThreadID, WM_USER_ResetDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) hr = WaitForResponse(&req); else ERR("Failed to post thread message: %lu\n", GetLastError()); if(FAILED(hr)) { - ALCmmdevCapture_close(self); if(hr == E_OUTOFMEMORY) return ALC_OUT_OF_MEMORY; return ALC_INVALID_VALUE; @@ -1454,7 +1536,7 @@ static ALCenum ALCmmdevCapture_open(ALCmmdevCapture *self, const ALCchar *device return ALC_NO_ERROR; } -static HRESULT ALCmmdevCapture_openProxy(ALCmmdevCapture *self) +static HRESULT ALCwasapiCapture_openProxy(ALCwasapiCapture *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; void *ptr; @@ -1476,7 +1558,7 @@ static HRESULT ALCmmdevCapture_openProxy(ALCmmdevCapture *self) if(SUCCEEDED(hr)) { self->client = ptr; - if(al_string_empty(device->DeviceName)) + if(alstr_empty(device->DeviceName)) get_device_name_and_guid(self->mmdev, &device->DeviceName, NULL); } @@ -1491,27 +1573,7 @@ static HRESULT ALCmmdevCapture_openProxy(ALCmmdevCapture *self) } -static void ALCmmdevCapture_close(ALCmmdevCapture *self) -{ - ThreadRequest req = { self->MsgEvent, 0 }; - - if(PostThreadMessage(ThreadID, WM_USER_CloseDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) - (void)WaitForResponse(&req); - - ll_ringbuffer_free(self->Ring); - self->Ring = NULL; - - CloseHandle(self->MsgEvent); - self->MsgEvent = NULL; - - CloseHandle(self->NotifyEvent); - self->NotifyEvent = NULL; - - free(self->devid); - self->devid = NULL; -} - -static void ALCmmdevCapture_closeProxy(ALCmmdevCapture *self) +static void ALCwasapiCapture_closeProxy(ALCwasapiCapture *self) { if(self->client) IAudioClient_Release(self->client); @@ -1523,11 +1585,12 @@ static void ALCmmdevCapture_closeProxy(ALCmmdevCapture *self) } -static HRESULT ALCmmdevCapture_resetProxy(ALCmmdevCapture *self) +static HRESULT ALCwasapiCapture_resetProxy(ALCwasapiCapture *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; WAVEFORMATEXTENSIBLE OutputType; WAVEFORMATEX *wfx = NULL; + enum DevFmtType srcType; REFERENCE_TIME buf_time; UINT32 buffer_len; void *ptr = NULL; @@ -1545,8 +1608,12 @@ static HRESULT ALCmmdevCapture_resetProxy(ALCmmdevCapture *self) } self->client = ptr; - buf_time = ((REFERENCE_TIME)device->UpdateSize*device->NumUpdates*10000000 + - device->Frequency-1) / device->Frequency; + buf_time = ScaleCeil(device->UpdateSize*device->NumUpdates, REFTIME_PER_SEC, + device->Frequency); + // Make sure buffer is at least 100ms in size + buf_time = maxu64(buf_time, REFTIME_PER_SEC/10); + device->UpdateSize = (ALuint)ScaleCeil(buf_time, device->Frequency, REFTIME_PER_SEC) / + device->NumUpdates; OutputType.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; switch(device->FmtChans) @@ -1580,40 +1647,33 @@ static HRESULT ALCmmdevCapture_resetProxy(ALCmmdevCapture *self) OutputType.dwChannelMask = X7DOT1; break; - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: return E_FAIL; } switch(device->FmtType) { + /* NOTE: Signedness doesn't matter, the converter will handle it. */ + case DevFmtByte: case DevFmtUByte: OutputType.Format.wBitsPerSample = 8; - OutputType.Samples.wValidBitsPerSample = 8; OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; break; case DevFmtShort: + case DevFmtUShort: OutputType.Format.wBitsPerSample = 16; - OutputType.Samples.wValidBitsPerSample = 16; OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; break; case DevFmtInt: + case DevFmtUInt: OutputType.Format.wBitsPerSample = 32; - OutputType.Samples.wValidBitsPerSample = 32; OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_PCM; break; case DevFmtFloat: OutputType.Format.wBitsPerSample = 32; - OutputType.Samples.wValidBitsPerSample = 32; OutputType.SubFormat = KSDATAFORMAT_SUBTYPE_IEEE_FLOAT; break; - - case DevFmtByte: - case DevFmtUShort: - case DevFmtUInt: - WARN("%s capture samples not supported\n", DevFmtTypeString(device->FmtType)); - return E_FAIL; } + OutputType.Samples.wValidBitsPerSample = OutputType.Format.wBitsPerSample; OutputType.Format.nSamplesPerSec = device->Frequency; OutputType.Format.nBlockAlign = OutputType.Format.nChannels * @@ -1631,27 +1691,107 @@ static HRESULT ALCmmdevCapture_resetProxy(ALCmmdevCapture *self) return hr; } - /* FIXME: We should do conversion/resampling if we didn't get a matching format. */ - if(wfx->nSamplesPerSec != OutputType.Format.nSamplesPerSec || - wfx->wBitsPerSample != OutputType.Format.wBitsPerSample || - wfx->nChannels != OutputType.Format.nChannels || - wfx->nBlockAlign != OutputType.Format.nBlockAlign) + DestroySampleConverter(&self->SampleConv); + DestroyChannelConverter(&self->ChannelConv); + + if(wfx != NULL) { - ERR("Failed to get matching format, wanted: %s %s %uhz, got: %d channel%s %d-bit %luhz\n", - DevFmtChannelsString(device->FmtChans), DevFmtTypeString(device->FmtType), - device->Frequency, wfx->nChannels, (wfx->nChannels==1)?"":"s", wfx->wBitsPerSample, - wfx->nSamplesPerSec); + if(!(wfx->nChannels == OutputType.Format.nChannels || + (wfx->nChannels == 1 && OutputType.Format.nChannels == 2) || + (wfx->nChannels == 2 && OutputType.Format.nChannels == 1))) + { + ERR("Failed to get matching format, wanted: %s %s %uhz, got: %d channel%s %d-bit %luhz\n", + DevFmtChannelsString(device->FmtChans), DevFmtTypeString(device->FmtType), + device->Frequency, wfx->nChannels, (wfx->nChannels==1)?"":"s", wfx->wBitsPerSample, + wfx->nSamplesPerSec); + CoTaskMemFree(wfx); + return E_FAIL; + } + + if(!MakeExtensible(&OutputType, wfx)) + { + CoTaskMemFree(wfx); + return E_FAIL; + } CoTaskMemFree(wfx); + wfx = NULL; + } + + if(IsEqualGUID(&OutputType.SubFormat, &KSDATAFORMAT_SUBTYPE_PCM)) + { + if(OutputType.Format.wBitsPerSample == 8) + srcType = DevFmtUByte; + else if(OutputType.Format.wBitsPerSample == 16) + srcType = DevFmtShort; + else if(OutputType.Format.wBitsPerSample == 32) + srcType = DevFmtInt; + else + { + ERR("Unhandled integer bit depth: %d\n", OutputType.Format.wBitsPerSample); + return E_FAIL; + } + } + else if(IsEqualGUID(&OutputType.SubFormat, &KSDATAFORMAT_SUBTYPE_IEEE_FLOAT)) + { + if(OutputType.Format.wBitsPerSample == 32) + srcType = DevFmtFloat; + else + { + ERR("Unhandled float bit depth: %d\n", OutputType.Format.wBitsPerSample); + return E_FAIL; + } + } + else + { + ERR("Unhandled format sub-type\n"); return E_FAIL; } - if(!MakeExtensible(&OutputType, wfx)) + if(device->FmtChans == DevFmtMono && OutputType.Format.nChannels == 2) { - CoTaskMemFree(wfx); - return E_FAIL; + self->ChannelConv = CreateChannelConverter(srcType, DevFmtStereo, + device->FmtChans); + if(!self->ChannelConv) + { + ERR("Failed to create %s stereo-to-mono converter\n", DevFmtTypeString(srcType)); + return E_FAIL; + } + TRACE("Created %s stereo-to-mono converter\n", DevFmtTypeString(srcType)); + /* The channel converter always outputs float, so change the input type + * for the resampler/type-converter. + */ + srcType = DevFmtFloat; + } + else if(device->FmtChans == DevFmtStereo && OutputType.Format.nChannels == 1) + { + self->ChannelConv = CreateChannelConverter(srcType, DevFmtMono, + device->FmtChans); + if(!self->ChannelConv) + { + ERR("Failed to create %s mono-to-stereo converter\n", DevFmtTypeString(srcType)); + return E_FAIL; + } + TRACE("Created %s mono-to-stereo converter\n", DevFmtTypeString(srcType)); + srcType = DevFmtFloat; + } + + if(device->Frequency != OutputType.Format.nSamplesPerSec || device->FmtType != srcType) + { + self->SampleConv = CreateSampleConverter( + srcType, device->FmtType, ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder), + OutputType.Format.nSamplesPerSec, device->Frequency + ); + if(!self->SampleConv) + { + ERR("Failed to create converter for %s format, dst: %s %uhz, src: %s %luhz\n", + DevFmtChannelsString(device->FmtChans), DevFmtTypeString(device->FmtType), + device->Frequency, DevFmtTypeString(srcType), OutputType.Format.nSamplesPerSec); + return E_FAIL; + } + TRACE("Created converter for %s format, dst: %s %uhz, src: %s %luhz\n", + DevFmtChannelsString(device->FmtChans), DevFmtTypeString(device->FmtType), + device->Frequency, DevFmtTypeString(srcType), OutputType.Format.nSamplesPerSec); } - CoTaskMemFree(wfx); - wfx = NULL; hr = IAudioClient_Initialize(self->client, AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK, @@ -1670,9 +1810,12 @@ static HRESULT ALCmmdevCapture_resetProxy(ALCmmdevCapture *self) return hr; } - buffer_len = maxu(device->UpdateSize*device->NumUpdates + 1, buffer_len); + buffer_len = maxu(device->UpdateSize*device->NumUpdates, buffer_len); ll_ringbuffer_free(self->Ring); - self->Ring = ll_ringbuffer_create(buffer_len, OutputType.Format.nBlockAlign); + self->Ring = ll_ringbuffer_create(buffer_len, + FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder), + false + ); if(!self->Ring) { ERR("Failed to allocate capture ring buffer\n"); @@ -1690,18 +1833,18 @@ static HRESULT ALCmmdevCapture_resetProxy(ALCmmdevCapture *self) } -static ALCboolean ALCmmdevCapture_start(ALCmmdevCapture *self) +static ALCboolean ALCwasapiCapture_start(ALCwasapiCapture *self) { ThreadRequest req = { self->MsgEvent, 0 }; HRESULT hr = E_FAIL; - if(PostThreadMessage(ThreadID, WM_USER_StartDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) + if(PostThreadMessage(ThreadID, WM_USER_StartDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) hr = WaitForResponse(&req); return SUCCEEDED(hr) ? ALC_TRUE : ALC_FALSE; } -static HRESULT ALCmmdevCapture_startProxy(ALCmmdevCapture *self) +static HRESULT ALCwasapiCapture_startProxy(ALCwasapiCapture *self) { HRESULT hr; void *ptr; @@ -1718,8 +1861,8 @@ static HRESULT ALCmmdevCapture_startProxy(ALCmmdevCapture *self) if(SUCCEEDED(hr)) { self->capture = ptr; - self->killNow = 0; - if(althrd_create(&self->thread, ALCmmdevCapture_recordProc, self) != althrd_success) + ATOMIC_STORE(&self->killNow, 0, almemory_order_release); + if(althrd_create(&self->thread, ALCwasapiCapture_recordProc, self) != althrd_success) { ERR("Failed to start thread\n"); IAudioCaptureClient_Release(self->capture); @@ -1738,21 +1881,21 @@ static HRESULT ALCmmdevCapture_startProxy(ALCmmdevCapture *self) } -static void ALCmmdevCapture_stop(ALCmmdevCapture *self) +static void ALCwasapiCapture_stop(ALCwasapiCapture *self) { ThreadRequest req = { self->MsgEvent, 0 }; - if(PostThreadMessage(ThreadID, WM_USER_StopDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCmmdevProxy, self))) + if(PostThreadMessage(ThreadID, WM_USER_StopDevice, (WPARAM)&req, (LPARAM)STATIC_CAST(ALCwasapiProxy, self))) (void)WaitForResponse(&req); } -static void ALCmmdevCapture_stopProxy(ALCmmdevCapture *self) +static void ALCwasapiCapture_stopProxy(ALCwasapiCapture *self) { int res; if(!self->capture) return; - self->killNow = 1; + ATOMIC_STORE_SEQ(&self->killNow, 1); althrd_join(self->thread, &res); IAudioCaptureClient_Release(self->capture); @@ -1762,14 +1905,14 @@ static void ALCmmdevCapture_stopProxy(ALCmmdevCapture *self) } -ALuint ALCmmdevCapture_availableSamples(ALCmmdevCapture *self) +ALuint ALCwasapiCapture_availableSamples(ALCwasapiCapture *self) { return (ALuint)ll_ringbuffer_read_space(self->Ring); } -ALCenum ALCmmdevCapture_captureSamples(ALCmmdevCapture *self, ALCvoid *buffer, ALCuint samples) +ALCenum ALCwasapiCapture_captureSamples(ALCwasapiCapture *self, ALCvoid *buffer, ALCuint samples) { - if(ALCmmdevCapture_availableSamples(self) < samples) + if(ALCwasapiCapture_availableSamples(self) < samples) return ALC_INVALID_VALUE; ll_ringbuffer_read(self->Ring, buffer, samples); return ALC_NO_ERROR; @@ -1777,27 +1920,31 @@ ALCenum ALCmmdevCapture_captureSamples(ALCmmdevCapture *self, ALCvoid *buffer, A static inline void AppendAllDevicesList2(const DevMap *entry) -{ AppendAllDevicesList(al_string_get_cstr(entry->name)); } +{ AppendAllDevicesList(alstr_get_cstr(entry->name)); } static inline void AppendCaptureDeviceList2(const DevMap *entry) -{ AppendCaptureDeviceList(al_string_get_cstr(entry->name)); } +{ AppendCaptureDeviceList(alstr_get_cstr(entry->name)); } -typedef struct ALCmmdevBackendFactory { +typedef struct ALCwasapiBackendFactory { DERIVE_FROM_TYPE(ALCbackendFactory); -} ALCmmdevBackendFactory; -#define ALCMMDEVBACKENDFACTORY_INITIALIZER { { GET_VTABLE2(ALCmmdevBackendFactory, ALCbackendFactory) } } +} ALCwasapiBackendFactory; +#define ALCWASAPIBACKENDFACTORY_INITIALIZER { { GET_VTABLE2(ALCwasapiBackendFactory, ALCbackendFactory) } } -static ALCboolean ALCmmdevBackendFactory_init(ALCmmdevBackendFactory *self); -static void ALCmmdevBackendFactory_deinit(ALCmmdevBackendFactory *self); -static ALCboolean ALCmmdevBackendFactory_querySupport(ALCmmdevBackendFactory *self, ALCbackend_Type type); -static void ALCmmdevBackendFactory_probe(ALCmmdevBackendFactory *self, enum DevProbe type); -static ALCbackend* ALCmmdevBackendFactory_createBackend(ALCmmdevBackendFactory *self, ALCdevice *device, ALCbackend_Type type); +static ALCboolean ALCwasapiBackendFactory_init(ALCwasapiBackendFactory *self); +static void ALCwasapiBackendFactory_deinit(ALCwasapiBackendFactory *self); +static ALCboolean ALCwasapiBackendFactory_querySupport(ALCwasapiBackendFactory *self, ALCbackend_Type type); +static void ALCwasapiBackendFactory_probe(ALCwasapiBackendFactory *self, enum DevProbe type); +static ALCbackend* ALCwasapiBackendFactory_createBackend(ALCwasapiBackendFactory *self, ALCdevice *device, ALCbackend_Type type); -DEFINE_ALCBACKENDFACTORY_VTABLE(ALCmmdevBackendFactory); +DEFINE_ALCBACKENDFACTORY_VTABLE(ALCwasapiBackendFactory); -static BOOL MMDevApiLoad(void) +static ALCboolean ALCwasapiBackendFactory_init(ALCwasapiBackendFactory* UNUSED(self)) { static HRESULT InitResult; + + VECTOR_INIT(PlaybackDevices); + VECTOR_INIT(CaptureDevices); + if(!ThreadHdl) { ThreadRequest req; @@ -1808,26 +1955,17 @@ static BOOL MMDevApiLoad(void) ERR("Failed to create event: %lu\n", GetLastError()); else { - ThreadHdl = CreateThread(NULL, 0, ALCmmdevProxy_messageHandler, &req, 0, &ThreadID); + ThreadHdl = CreateThread(NULL, 0, ALCwasapiProxy_messageHandler, &req, 0, &ThreadID); if(ThreadHdl != NULL) InitResult = WaitForResponse(&req); CloseHandle(req.FinishedEvt); } } - return SUCCEEDED(InitResult); + + return SUCCEEDED(InitResult) ? ALC_TRUE : ALC_FALSE; } -static ALCboolean ALCmmdevBackendFactory_init(ALCmmdevBackendFactory* UNUSED(self)) -{ - VECTOR_INIT(PlaybackDevices); - VECTOR_INIT(CaptureDevices); - - if(!MMDevApiLoad()) - return ALC_FALSE; - return ALC_TRUE; -} - -static void ALCmmdevBackendFactory_deinit(ALCmmdevBackendFactory* UNUSED(self)) +static void ALCwasapiBackendFactory_deinit(ALCwasapiBackendFactory* UNUSED(self)) { clear_devlist(&PlaybackDevices); VECTOR_DEINIT(PlaybackDevices); @@ -1844,19 +1982,14 @@ static void ALCmmdevBackendFactory_deinit(ALCmmdevBackendFactory* UNUSED(self)) } } -static ALCboolean ALCmmdevBackendFactory_querySupport(ALCmmdevBackendFactory* UNUSED(self), ALCbackend_Type type) +static ALCboolean ALCwasapiBackendFactory_querySupport(ALCwasapiBackendFactory* UNUSED(self), ALCbackend_Type type) { - /* TODO: Disable capture with mmdevapi for now, since it doesn't do any - * rechanneling or resampling; if the device is configured for 48000hz - * stereo input, for example, and the app asks for 22050hz mono, - * initialization will fail. - */ - if(type == ALCbackend_Playback /*|| type == ALCbackend_Capture*/) + if(type == ALCbackend_Playback || type == ALCbackend_Capture) return ALC_TRUE; return ALC_FALSE; } -static void ALCmmdevBackendFactory_probe(ALCmmdevBackendFactory* UNUSED(self), enum DevProbe type) +static void ALCwasapiBackendFactory_probe(ALCwasapiBackendFactory* UNUSED(self), enum DevProbe type) { ThreadRequest req = { NULL, 0 }; @@ -1883,19 +2016,19 @@ static void ALCmmdevBackendFactory_probe(ALCmmdevBackendFactory* UNUSED(self), e } } -static ALCbackend* ALCmmdevBackendFactory_createBackend(ALCmmdevBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type) +static ALCbackend* ALCwasapiBackendFactory_createBackend(ALCwasapiBackendFactory* UNUSED(self), ALCdevice *device, ALCbackend_Type type) { if(type == ALCbackend_Playback) { - ALCmmdevPlayback *backend; - NEW_OBJ(backend, ALCmmdevPlayback)(device); + ALCwasapiPlayback *backend; + NEW_OBJ(backend, ALCwasapiPlayback)(device); if(!backend) return NULL; return STATIC_CAST(ALCbackend, backend); } if(type == ALCbackend_Capture) { - ALCmmdevCapture *backend; - NEW_OBJ(backend, ALCmmdevCapture)(device); + ALCwasapiCapture *backend; + NEW_OBJ(backend, ALCwasapiCapture)(device); if(!backend) return NULL; return STATIC_CAST(ALCbackend, backend); } @@ -1904,8 +2037,8 @@ static ALCbackend* ALCmmdevBackendFactory_createBackend(ALCmmdevBackendFactory* } -ALCbackendFactory *ALCmmdevBackendFactory_getFactory(void) +ALCbackendFactory *ALCwasapiBackendFactory_getFactory(void) { - static ALCmmdevBackendFactory factory = ALCMMDEVBACKENDFACTORY_INITIALIZER; + static ALCwasapiBackendFactory factory = ALCWASAPIBACKENDFACTORY_INITIALIZER; return STATIC_CAST(ALCbackendFactory, &factory); } diff --git a/Engine/lib/openal-soft/Alc/backends/wave.c b/Engine/lib/openal-soft/Alc/backends/wave.c index 9bf5a7274..557c2bf26 100644 --- a/Engine/lib/openal-soft/Alc/backends/wave.c +++ b/Engine/lib/openal-soft/Alc/backends/wave.c @@ -27,6 +27,7 @@ #include "alMain.h" #include "alu.h" +#include "alconfig.h" #include "threads.h" #include "compat.h" @@ -76,16 +77,15 @@ typedef struct ALCwaveBackend { ALvoid *mBuffer; ALuint mSize; - volatile int killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCwaveBackend; static int ALCwaveBackend_mixerProc(void *ptr); static void ALCwaveBackend_Construct(ALCwaveBackend *self, ALCdevice *device); -static DECLARE_FORWARD(ALCwaveBackend, ALCbackend, void, Destruct) +static void ALCwaveBackend_Destruct(ALCwaveBackend *self); static ALCenum ALCwaveBackend_open(ALCwaveBackend *self, const ALCchar *name); -static void ALCwaveBackend_close(ALCwaveBackend *self); static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self); static ALCboolean ALCwaveBackend_start(ALCwaveBackend *self); static void ALCwaveBackend_stop(ALCwaveBackend *self); @@ -110,9 +110,17 @@ static void ALCwaveBackend_Construct(ALCwaveBackend *self, ALCdevice *device) self->mBuffer = NULL; self->mSize = 0; - self->killNow = 1; + ATOMIC_INIT(&self->killNow, AL_TRUE); } +static void ALCwaveBackend_Destruct(ALCwaveBackend *self) +{ + if(self->mFile) + fclose(self->mFile); + self->mFile = NULL; + + ALCbackend_Destruct(STATIC_CAST(ALCbackend, self)); +} static int ALCwaveBackend_mixerProc(void *ptr) { @@ -127,7 +135,7 @@ static int ALCwaveBackend_mixerProc(void *ptr) althrd_setname(althrd_current(), MIXER_THREAD_NAME); - frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + frameSize = FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); done = 0; if(altimespec_get(&start, AL_TIME_UTC) != AL_TIME_UTC) @@ -135,7 +143,8 @@ static int ALCwaveBackend_mixerProc(void *ptr) ERR("Failed to get starting time\n"); return 1; } - while(!self->killNow && device->Connected) + while(!ATOMIC_LOAD(&self->killNow, almemory_order_acquire) && + ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) { if(altimespec_get(&now, AL_TIME_UTC) != AL_TIME_UTC) { @@ -157,7 +166,9 @@ static int ALCwaveBackend_mixerProc(void *ptr) al_nssleep(restTime); else while(avail-done >= device->UpdateSize) { + ALCwaveBackend_lock(self); aluMixData(device, self->mBuffer, device->UpdateSize); + ALCwaveBackend_unlock(self); done += device->UpdateSize; if(!IS_LITTLE_ENDIAN) @@ -194,7 +205,7 @@ static int ALCwaveBackend_mixerProc(void *ptr) { ERR("Error writing to file\n"); ALCdevice_Lock(device); - aluHandleDisconnect(device); + aluHandleDisconnect(device, "Failed to write playback samples"); ALCdevice_Unlock(device); break; } @@ -226,18 +237,11 @@ static ALCenum ALCwaveBackend_open(ALCwaveBackend *self, const ALCchar *name) } device = STATIC_CAST(ALCbackend, self)->mDevice; - al_string_copy_cstr(&device->DeviceName, name); + alstr_copy_cstr(&device->DeviceName, name); return ALC_NO_ERROR; } -static void ALCwaveBackend_close(ALCwaveBackend *self) -{ - if(self->mFile) - fclose(self->mFile); - self->mFile = NULL; -} - static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; @@ -249,7 +253,10 @@ static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self) clearerr(self->mFile); if(GetConfigValueBool(NULL, "wave", "bformat", 0)) - device->FmtChans = DevFmtAmbi1; + { + device->FmtChans = DevFmtAmbi3D; + device->AmbiOrder = 1; + } switch(device->FmtType) { @@ -277,24 +284,23 @@ static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self) case DevFmtX51Rear: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020; break; case DevFmtX61: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x100 | 0x200 | 0x400; break; case DevFmtX71: chanmask = 0x01 | 0x02 | 0x04 | 0x08 | 0x010 | 0x020 | 0x200 | 0x400; break; - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: /* .amb output requires FuMa */ - device->AmbiFmt = AmbiFormat_FuMa; + device->AmbiLayout = AmbiLayout_FuMa; + device->AmbiScale = AmbiNorm_FuMa; isbformat = 1; chanmask = 0; break; } bits = BytesFromDevFmt(device->FmtType) * 8; - channels = ChannelsFromDevFmt(device->FmtChans); + channels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); - fprintf(self->mFile, "RIFF"); + fputs("RIFF", self->mFile); fwrite32le(0xFFFFFFFF, self->mFile); // 'RIFF' header len; filled in at close - fprintf(self->mFile, "WAVE"); + fputs("WAVE", self->mFile); - fprintf(self->mFile, "fmt "); + fputs("fmt ", self->mFile); fwrite32le(40, self->mFile); // 'fmt ' header len; 40 bytes for EXTENSIBLE // 16-bit val, format type id (extensible: 0xFFFE) @@ -316,11 +322,12 @@ static ALCboolean ALCwaveBackend_reset(ALCwaveBackend *self) // 32-bit val, channel mask fwrite32le(chanmask, self->mFile); // 16 byte GUID, sub-type format - val = fwrite(((bits==32) ? (isbformat ? SUBTYPE_BFORMAT_FLOAT : SUBTYPE_FLOAT) : - (isbformat ? SUBTYPE_BFORMAT_PCM : SUBTYPE_PCM)), 1, 16, self->mFile); + val = fwrite((device->FmtType == DevFmtFloat) ? + (isbformat ? SUBTYPE_BFORMAT_FLOAT : SUBTYPE_FLOAT) : + (isbformat ? SUBTYPE_BFORMAT_PCM : SUBTYPE_PCM), 1, 16, self->mFile); (void)val; - fprintf(self->mFile, "data"); + fputs("data", self->mFile); fwrite32le(0xFFFFFFFF, self->mFile); // 'data' header len; filled in at close if(ferror(self->mFile)) @@ -339,7 +346,9 @@ static ALCboolean ALCwaveBackend_start(ALCwaveBackend *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; - self->mSize = device->UpdateSize * FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + self->mSize = device->UpdateSize * FrameSizeFromDevFmt( + device->FmtChans, device->FmtType, device->AmbiOrder + ); self->mBuffer = malloc(self->mSize); if(!self->mBuffer) { @@ -347,7 +356,7 @@ static ALCboolean ALCwaveBackend_start(ALCwaveBackend *self) return ALC_FALSE; } - self->killNow = 0; + ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); if(althrd_create(&self->thread, ALCwaveBackend_mixerProc, self) != althrd_success) { free(self->mBuffer); @@ -365,10 +374,8 @@ static void ALCwaveBackend_stop(ALCwaveBackend *self) long size; int res; - if(self->killNow) + if(ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) return; - - self->killNow = 1; althrd_join(self->thread, &res); free(self->mBuffer); diff --git a/Engine/lib/openal-soft/Alc/backends/winmm.c b/Engine/lib/openal-soft/Alc/backends/winmm.c index 9d8f8e9d8..2f4c65dff 100644 --- a/Engine/lib/openal-soft/Alc/backends/winmm.c +++ b/Engine/lib/openal-soft/Alc/backends/winmm.c @@ -29,6 +29,7 @@ #include "alMain.h" #include "alu.h" +#include "ringbuffer.h" #include "threads.h" #include "backends/base.h" @@ -45,7 +46,7 @@ static vector_al_string CaptureDevices; static void clear_devlist(vector_al_string *list) { - VECTOR_FOR_EACH(al_string, *list, al_string_deinit); + VECTOR_FOR_EACH(al_string, *list, alstr_reset); VECTOR_RESIZE(*list, 0, 0); } @@ -71,23 +72,23 @@ static void ProbePlaybackDevices(void) ALuint count = 0; while(1) { - al_string_copy_cstr(&dname, DEVNAME_HEAD); - al_string_append_wcstr(&dname, WaveCaps.szPname); + alstr_copy_cstr(&dname, DEVNAME_HEAD); + alstr_append_wcstr(&dname, WaveCaps.szPname); if(count != 0) { char str[64]; snprintf(str, sizeof(str), " #%d", count+1); - al_string_append_cstr(&dname, str); + alstr_append_cstr(&dname, str); } count++; -#define MATCH_ENTRY(i) (al_string_cmp(dname, *(i)) == 0) +#define MATCH_ENTRY(i) (alstr_cmp(dname, *(i)) == 0) VECTOR_FIND_IF(iter, const al_string, PlaybackDevices, MATCH_ENTRY); if(iter == VECTOR_END(PlaybackDevices)) break; #undef MATCH_ENTRY } - TRACE("Got device \"%s\", ID %u\n", al_string_get_cstr(dname), i); + TRACE("Got device \"%s\", ID %u\n", alstr_get_cstr(dname), i); } VECTOR_PUSH_BACK(PlaybackDevices, dname); } @@ -114,23 +115,23 @@ static void ProbeCaptureDevices(void) ALuint count = 0; while(1) { - al_string_copy_cstr(&dname, DEVNAME_HEAD); - al_string_append_wcstr(&dname, WaveCaps.szPname); + alstr_copy_cstr(&dname, DEVNAME_HEAD); + alstr_append_wcstr(&dname, WaveCaps.szPname); if(count != 0) { char str[64]; snprintf(str, sizeof(str), " #%d", count+1); - al_string_append_cstr(&dname, str); + alstr_append_cstr(&dname, str); } count++; -#define MATCH_ENTRY(i) (al_string_cmp(dname, *(i)) == 0) +#define MATCH_ENTRY(i) (alstr_cmp(dname, *(i)) == 0) VECTOR_FIND_IF(iter, const al_string, CaptureDevices, MATCH_ENTRY); if(iter == VECTOR_END(CaptureDevices)) break; #undef MATCH_ENTRY } - TRACE("Got device \"%s\", ID %u\n", al_string_get_cstr(dname), i); + TRACE("Got device \"%s\", ID %u\n", alstr_get_cstr(dname), i); } VECTOR_PUSH_BACK(CaptureDevices, dname); } @@ -147,7 +148,7 @@ typedef struct ALCwinmmPlayback { WAVEFORMATEX Format; - volatile ALboolean killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCwinmmPlayback; @@ -158,7 +159,6 @@ static void CALLBACK ALCwinmmPlayback_waveOutProc(HWAVEOUT device, UINT msg, DWO static int ALCwinmmPlayback_mixerProc(void *arg); static ALCenum ALCwinmmPlayback_open(ALCwinmmPlayback *self, const ALCchar *name); -static void ALCwinmmPlayback_close(ALCwinmmPlayback *self); static ALCboolean ALCwinmmPlayback_reset(ALCwinmmPlayback *self); static ALCboolean ALCwinmmPlayback_start(ALCwinmmPlayback *self); static void ALCwinmmPlayback_stop(ALCwinmmPlayback *self); @@ -180,7 +180,7 @@ static void ALCwinmmPlayback_Construct(ALCwinmmPlayback *self, ALCdevice *device InitRef(&self->WaveBuffersCommitted, 0); self->OutHdl = NULL; - self->killNow = AL_TRUE; + ATOMIC_INIT(&self->killNow, AL_TRUE); } static void ALCwinmmPlayback_Destruct(ALCwinmmPlayback *self) @@ -224,7 +224,7 @@ FORCE_ALIGN static int ALCwinmmPlayback_mixerProc(void *arg) if(msg.message != WOM_DONE) continue; - if(self->killNow) + if(ATOMIC_LOAD(&self->killNow, almemory_order_acquire)) { if(ReadRef(&self->WaveBuffersCommitted) == 0) break; @@ -232,8 +232,10 @@ FORCE_ALIGN static int ALCwinmmPlayback_mixerProc(void *arg) } WaveHdr = ((WAVEHDR*)msg.lParam); + ALCwinmmPlayback_lock(self); aluMixData(device, WaveHdr->lpData, WaveHdr->dwBufferLength / self->Format.nBlockAlign); + ALCwinmmPlayback_unlock(self); // Send buffer back to play more data waveOutWrite(self->OutHdl, WaveHdr, sizeof(WAVEHDR)); @@ -255,8 +257,8 @@ static ALCenum ALCwinmmPlayback_open(ALCwinmmPlayback *self, const ALCchar *devi ProbePlaybackDevices(); // Find the Device ID matching the deviceName if valid -#define MATCH_DEVNAME(iter) (!al_string_empty(*(iter)) && \ - (!deviceName || al_string_cmp_cstr(*(iter), deviceName) == 0)) +#define MATCH_DEVNAME(iter) (!alstr_empty(*(iter)) && \ + (!deviceName || alstr_cmp_cstr(*(iter), deviceName) == 0)) VECTOR_FIND_IF(iter, const al_string, PlaybackDevices, MATCH_DEVNAME); if(iter == VECTOR_END(PlaybackDevices)) return ALC_INVALID_VALUE; @@ -298,7 +300,7 @@ retry_open: goto failure; } - al_string_copy(&device->DeviceName, VECTOR_ELEM(PlaybackDevices, DeviceID)); + alstr_copy(&device->DeviceName, VECTOR_ELEM(PlaybackDevices, DeviceID)); return ALC_NO_ERROR; failure: @@ -309,9 +311,6 @@ failure: return ALC_INVALID_VALUE; } -static void ALCwinmmPlayback_close(ALCwinmmPlayback* UNUSED(self)) -{ } - static ALCboolean ALCwinmmPlayback_reset(ALCwinmmPlayback *self) { ALCdevice *device = STATIC_CAST(ALCbackend, self)->mDevice; @@ -372,7 +371,7 @@ static ALCboolean ALCwinmmPlayback_start(ALCwinmmPlayback *self) ALint BufferSize; ALuint i; - self->killNow = AL_FALSE; + ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); if(althrd_create(&self->thread, ALCwinmmPlayback_mixerProc, self) != althrd_success) return ALC_FALSE; @@ -380,7 +379,7 @@ static ALCboolean ALCwinmmPlayback_start(ALCwinmmPlayback *self) // Create 4 Buffers BufferSize = device->UpdateSize*device->NumUpdates / 4; - BufferSize *= FrameSizeFromDevFmt(device->FmtChans, device->FmtType); + BufferSize *= FrameSizeFromDevFmt(device->FmtChans, device->FmtType, device->AmbiOrder); BufferData = calloc(4, BufferSize); for(i = 0;i < 4;i++) @@ -403,11 +402,8 @@ static void ALCwinmmPlayback_stop(ALCwinmmPlayback *self) void *buffer = NULL; int i; - if(self->killNow) + if(ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) return; - - // Set flag to stop processing headers - self->killNow = AL_TRUE; althrd_join(self->thread, &i); // Release the wave buffers @@ -434,7 +430,7 @@ typedef struct ALCwinmmCapture { WAVEFORMATEX Format; - volatile ALboolean killNow; + ATOMIC(ALenum) killNow; althrd_t thread; } ALCwinmmCapture; @@ -445,7 +441,6 @@ static void CALLBACK ALCwinmmCapture_waveInProc(HWAVEIN device, UINT msg, DWORD_ static int ALCwinmmCapture_captureProc(void *arg); static ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *name); -static void ALCwinmmCapture_close(ALCwinmmCapture *self); static DECLARE_FORWARD(ALCwinmmCapture, ALCbackend, ALCboolean, reset) static ALCboolean ALCwinmmCapture_start(ALCwinmmCapture *self); static void ALCwinmmCapture_stop(ALCwinmmCapture *self); @@ -467,11 +462,38 @@ static void ALCwinmmCapture_Construct(ALCwinmmCapture *self, ALCdevice *device) InitRef(&self->WaveBuffersCommitted, 0); self->InHdl = NULL; - self->killNow = AL_TRUE; + ATOMIC_INIT(&self->killNow, AL_TRUE); } static void ALCwinmmCapture_Destruct(ALCwinmmCapture *self) { + void *buffer = NULL; + int i; + + /* Tell the processing thread to quit and wait for it to do so. */ + if(!ATOMIC_EXCHANGE(&self->killNow, AL_TRUE, almemory_order_acq_rel)) + { + PostThreadMessage(self->thread, WM_QUIT, 0, 0); + + althrd_join(self->thread, &i); + + /* Make sure capture is stopped and all pending buffers are flushed. */ + waveInReset(self->InHdl); + + // Release the wave buffers + for(i = 0;i < 4;i++) + { + waveInUnprepareHeader(self->InHdl, &self->WaveBuffer[i], sizeof(WAVEHDR)); + if(i == 0) buffer = self->WaveBuffer[i].lpData; + self->WaveBuffer[i].lpData = NULL; + } + free(buffer); + } + + ll_ringbuffer_free(self->Ring); + self->Ring = NULL; + + // Close the Wave device if(self->InHdl) waveInClose(self->InHdl); self->InHdl = 0; @@ -510,7 +532,7 @@ static int ALCwinmmCapture_captureProc(void *arg) continue; /* Don't wait for other buffers to finish before quitting. We're * closing so we don't need them. */ - if(self->killNow) + if(ATOMIC_LOAD(&self->killNow, almemory_order_acquire)) break; WaveHdr = ((WAVEHDR*)msg.lParam); @@ -542,7 +564,7 @@ static ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *name) ProbeCaptureDevices(); // Find the Device ID matching the deviceName if valid -#define MATCH_DEVNAME(iter) (!al_string_empty(*(iter)) && (!name || al_string_cmp_cstr(*iter, name) == 0)) +#define MATCH_DEVNAME(iter) (!alstr_empty(*(iter)) && (!name || alstr_cmp_cstr(*iter, name) == 0)) VECTOR_FIND_IF(iter, const al_string, CaptureDevices, MATCH_DEVNAME); if(iter == VECTOR_END(CaptureDevices)) return ALC_INVALID_VALUE; @@ -561,9 +583,7 @@ static ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *name) case DevFmtX51Rear: case DevFmtX61: case DevFmtX71: - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: return ALC_INVALID_ENUM; } @@ -584,7 +604,7 @@ static ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *name) memset(&self->Format, 0, sizeof(WAVEFORMATEX)); self->Format.wFormatTag = ((device->FmtType == DevFmtFloat) ? WAVE_FORMAT_IEEE_FLOAT : WAVE_FORMAT_PCM); - self->Format.nChannels = ChannelsFromDevFmt(device->FmtChans); + self->Format.nChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); self->Format.wBitsPerSample = BytesFromDevFmt(device->FmtType) * 8; self->Format.nBlockAlign = self->Format.wBitsPerSample * self->Format.nChannels / 8; @@ -606,7 +626,7 @@ static ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *name) if(CapturedDataSize < (self->Format.nSamplesPerSec / 10)) CapturedDataSize = self->Format.nSamplesPerSec / 10; - self->Ring = ll_ringbuffer_create(CapturedDataSize+1, self->Format.nBlockAlign); + self->Ring = ll_ringbuffer_create(CapturedDataSize, self->Format.nBlockAlign, false); if(!self->Ring) goto failure; InitRef(&self->WaveBuffersCommitted, 0); @@ -632,11 +652,11 @@ static ALCenum ALCwinmmCapture_open(ALCwinmmCapture *self, const ALCchar *name) IncrementRef(&self->WaveBuffersCommitted); } - self->killNow = AL_FALSE; + ATOMIC_STORE(&self->killNow, AL_FALSE, almemory_order_release); if(althrd_create(&self->thread, ALCwinmmCapture_captureProc, self) != althrd_success) goto failure; - al_string_copy(&device->DeviceName, VECTOR_ELEM(CaptureDevices, DeviceID)); + alstr_copy(&device->DeviceName, VECTOR_ELEM(CaptureDevices, DeviceID)); return ALC_NO_ERROR; failure: @@ -657,37 +677,6 @@ failure: return ALC_INVALID_VALUE; } -static void ALCwinmmCapture_close(ALCwinmmCapture *self) -{ - void *buffer = NULL; - int i; - - /* Tell the processing thread to quit and wait for it to do so. */ - self->killNow = AL_TRUE; - PostThreadMessage(self->thread, WM_QUIT, 0, 0); - - althrd_join(self->thread, &i); - - /* Make sure capture is stopped and all pending buffers are flushed. */ - waveInReset(self->InHdl); - - // Release the wave buffers - for(i = 0;i < 4;i++) - { - waveInUnprepareHeader(self->InHdl, &self->WaveBuffer[i], sizeof(WAVEHDR)); - if(i == 0) buffer = self->WaveBuffer[i].lpData; - self->WaveBuffer[i].lpData = NULL; - } - free(buffer); - - ll_ringbuffer_free(self->Ring); - self->Ring = NULL; - - // Close the Wave device - waveInClose(self->InHdl); - self->InHdl = NULL; -} - static ALCboolean ALCwinmmCapture_start(ALCwinmmCapture *self) { waveInStart(self->InHdl); @@ -707,19 +696,19 @@ static ALCenum ALCwinmmCapture_captureSamples(ALCwinmmCapture *self, ALCvoid *bu static ALCuint ALCwinmmCapture_availableSamples(ALCwinmmCapture *self) { - return ll_ringbuffer_read_space(self->Ring); + return (ALCuint)ll_ringbuffer_read_space(self->Ring); } static inline void AppendAllDevicesList2(const al_string *name) { - if(!al_string_empty(*name)) - AppendAllDevicesList(al_string_get_cstr(*name)); + if(!alstr_empty(*name)) + AppendAllDevicesList(alstr_get_cstr(*name)); } static inline void AppendCaptureDeviceList2(const al_string *name) { - if(!al_string_empty(*name)) - AppendCaptureDeviceList(al_string_get_cstr(*name)); + if(!alstr_empty(*name)) + AppendCaptureDeviceList(alstr_get_cstr(*name)); } typedef struct ALCwinmmBackendFactory { diff --git a/Engine/lib/openal-soft/Alc/bformatdec.c b/Engine/lib/openal-soft/Alc/bformatdec.c index 2aab4ed8f..dcde7d70a 100644 --- a/Engine/lib/openal-soft/Alc/bformatdec.c +++ b/Engine/lib/openal-soft/Alc/bformatdec.c @@ -3,82 +3,22 @@ #include "bformatdec.h" #include "ambdec.h" -#include "mixer_defs.h" +#include "filters/splitter.h" #include "alu.h" +#include "bool.h" #include "threads.h" #include "almalloc.h" -void bandsplit_init(BandSplitter *splitter, ALfloat freq_mult) -{ - ALfloat w = freq_mult * F_TAU; - ALfloat cw = cosf(w); - if(cw > FLT_EPSILON) - splitter->coeff = (sinf(w) - 1.0f) / cw; - else - splitter->coeff = cw * -0.5f; - - splitter->lp_z1 = 0.0f; - splitter->lp_z2 = 0.0f; - splitter->hp_z1 = 0.0f; -} - -void bandsplit_clear(BandSplitter *splitter) -{ - splitter->lp_z1 = 0.0f; - splitter->lp_z2 = 0.0f; - splitter->hp_z1 = 0.0f; -} - -void bandsplit_process(BandSplitter *splitter, ALfloat *restrict hpout, ALfloat *restrict lpout, - const ALfloat *input, ALuint count) -{ - ALfloat coeff, d, x; - ALfloat z1, z2; - ALuint i; - - coeff = splitter->coeff*0.5f + 0.5f; - z1 = splitter->lp_z1; - z2 = splitter->lp_z2; - for(i = 0;i < count;i++) - { - x = input[i]; - - d = (x - z1) * coeff; - x = z1 + d; - z1 = x + d; - - d = (x - z2) * coeff; - x = z2 + d; - z2 = x + d; - - lpout[i] = x; - } - splitter->lp_z1 = z1; - splitter->lp_z2 = z2; - - coeff = splitter->coeff; - z1 = splitter->hp_z1; - for(i = 0;i < count;i++) - { - x = input[i]; - - d = x - coeff*z1; - x = z1 + coeff*d; - z1 = d; - - hpout[i] = x - lpout[i]; - } - splitter->hp_z1 = z1; -} - - -static const ALfloat UnitScale[MAX_AMBI_COEFFS] = { +/* NOTE: These are scale factors as applied to Ambisonics content. Decoder + * coefficients should be divided by these values to get proper N3D scalings. + */ +const ALfloat N3D2N3DScale[MAX_AMBI_COEFFS] = { 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f }; -static const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS] = { +const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS] = { 1.000000000f, /* ACN 0 (W), sqrt(1) */ 1.732050808f, /* ACN 1 (Y), sqrt(3) */ 1.732050808f, /* ACN 2 (Z), sqrt(3) */ @@ -96,7 +36,7 @@ static const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS] = { 2.645751311f, /* ACN 14 (N), sqrt(7) */ 2.645751311f, /* ACN 15 (P), sqrt(7) */ }; -static const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS] = { +const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS] = { 1.414213562f, /* ACN 0 (W), sqrt(2) */ 1.732050808f, /* ACN 1 (Y), sqrt(3) */ 1.732050808f, /* ACN 2 (Z), sqrt(3) */ @@ -116,26 +56,9 @@ static const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS] = { }; -enum FreqBand { - FB_HighFreq, - FB_LowFreq, - FB_Max -}; - -/* These points are in AL coordinates! */ -static const ALfloat Ambi2DPoints[4][3] = { - { -0.707106781f, 0.0f, -0.707106781f }, - { 0.707106781f, 0.0f, -0.707106781f }, - { -0.707106781f, 0.0f, 0.707106781f }, - { 0.707106781f, 0.0f, 0.707106781f }, -}; -static const ALfloat Ambi2DDecoder[4][FB_Max][MAX_AMBI_COEFFS] = { - { { 0.353553f, 0.204094f, 0.0f, 0.204094f }, { 0.25f, 0.204094f, 0.0f, 0.204094f } }, - { { 0.353553f, -0.204094f, 0.0f, 0.204094f }, { 0.25f, -0.204094f, 0.0f, 0.204094f } }, - { { 0.353553f, 0.204094f, 0.0f, -0.204094f }, { 0.25f, 0.204094f, 0.0f, -0.204094f } }, - { { 0.353553f, -0.204094f, 0.0f, -0.204094f }, { 0.25f, -0.204094f, 0.0f, -0.204094f } }, -}; -static ALfloat Ambi2DEncoder[4][MAX_AMBI_COEFFS]; +#define HF_BAND 0 +#define LF_BAND 1 +#define NUM_BANDS 2 /* These points are in AL coordinates! */ static const ALfloat Ambi3DPoints[8][3] = { @@ -148,57 +71,28 @@ static const ALfloat Ambi3DPoints[8][3] = { { -0.577350269f, -0.577350269f, 0.577350269f }, { 0.577350269f, -0.577350269f, 0.577350269f }, }; -static const ALfloat Ambi3DDecoder[8][FB_Max][MAX_AMBI_COEFFS] = { - { { 0.25f, 0.1443375672f, 0.1443375672f, 0.1443375672f }, { 0.125f, 0.125f, 0.125f, 0.125f } }, - { { 0.25f, -0.1443375672f, 0.1443375672f, 0.1443375672f }, { 0.125f, -0.125f, 0.125f, 0.125f } }, - { { 0.25f, 0.1443375672f, 0.1443375672f, -0.1443375672f }, { 0.125f, 0.125f, 0.125f, -0.125f } }, - { { 0.25f, -0.1443375672f, 0.1443375672f, -0.1443375672f }, { 0.125f, -0.125f, 0.125f, -0.125f } }, - { { 0.25f, 0.1443375672f, -0.1443375672f, 0.1443375672f }, { 0.125f, 0.125f, -0.125f, 0.125f } }, - { { 0.25f, -0.1443375672f, -0.1443375672f, 0.1443375672f }, { 0.125f, -0.125f, -0.125f, 0.125f } }, - { { 0.25f, 0.1443375672f, -0.1443375672f, -0.1443375672f }, { 0.125f, 0.125f, -0.125f, -0.125f } }, - { { 0.25f, -0.1443375672f, -0.1443375672f, -0.1443375672f }, { 0.125f, -0.125f, -0.125f, -0.125f } }, +static const ALfloat Ambi3DDecoder[8][MAX_AMBI_COEFFS] = { + { 0.125f, 0.125f, 0.125f, 0.125f }, + { 0.125f, -0.125f, 0.125f, 0.125f }, + { 0.125f, 0.125f, 0.125f, -0.125f }, + { 0.125f, -0.125f, 0.125f, -0.125f }, + { 0.125f, 0.125f, -0.125f, 0.125f }, + { 0.125f, -0.125f, -0.125f, 0.125f }, + { 0.125f, 0.125f, -0.125f, -0.125f }, + { 0.125f, -0.125f, -0.125f, -0.125f }, +}; +static const ALfloat Ambi3DDecoderHFScale[MAX_AMBI_COEFFS] = { + 2.0f, + 1.15470054f, 1.15470054f, 1.15470054f }; -static ALfloat Ambi3DEncoder[8][MAX_AMBI_COEFFS]; -static RowMixerFunc MixMatrixRow = MixRow_C; - - -static alonce_flag bformatdec_inited = AL_ONCE_FLAG_INIT; - -static void init_bformatdec(void) -{ - ALuint i, j; - - MixMatrixRow = SelectRowMixer(); - - for(i = 0;i < COUNTOF(Ambi3DPoints);i++) - CalcDirectionCoeffs(Ambi3DPoints[i], 0.0f, Ambi3DEncoder[i]); - - for(i = 0;i < COUNTOF(Ambi2DPoints);i++) - { - CalcDirectionCoeffs(Ambi2DPoints[i], 0.0f, Ambi2DEncoder[i]); - - /* Remove the skipped height-related coefficients for 2D rendering. */ - Ambi2DEncoder[i][2] = Ambi2DEncoder[i][3]; - Ambi2DEncoder[i][3] = Ambi2DEncoder[i][4]; - Ambi2DEncoder[i][4] = Ambi2DEncoder[i][8]; - Ambi2DEncoder[i][5] = Ambi2DEncoder[i][9]; - Ambi2DEncoder[i][6] = Ambi2DEncoder[i][15]; - for(j = 7;j < MAX_AMBI_COEFFS;j++) - Ambi2DEncoder[i][j] = 0.0f; - } -} - - -#define MAX_DELAY_LENGTH 128 - /* NOTE: BandSplitter filters are unused with single-band decoding */ typedef struct BFormatDec { - ALboolean Enabled[MAX_OUTPUT_CHANNELS]; + ALuint Enabled; /* Bitfield of enabled channels. */ union { - alignas(16) ALfloat Dual[MAX_OUTPUT_CHANNELS][FB_Max][MAX_AMBI_COEFFS]; + alignas(16) ALfloat Dual[MAX_OUTPUT_CHANNELS][NUM_BANDS][MAX_AMBI_COEFFS]; alignas(16) ALfloat Single[MAX_OUTPUT_CHANNELS][MAX_AMBI_COEFFS]; } Matrix; @@ -212,67 +106,42 @@ typedef struct BFormatDec { alignas(16) ALfloat ChannelMix[BUFFERSIZE]; struct { - alignas(16) ALfloat Buffer[MAX_DELAY_LENGTH]; - ALuint Length; /* Valid range is [0...MAX_DELAY_LENGTH). */ - } Delay[MAX_OUTPUT_CHANNELS]; + BandSplitter XOver; + ALfloat Gains[NUM_BANDS]; + } UpSampler[4]; - struct { - BandSplitter XOver[4]; - - ALfloat Gains[4][MAX_OUTPUT_CHANNELS][FB_Max]; - } UpSampler; - - ALuint NumChannels; + ALsizei NumChannels; ALboolean DualBand; - ALboolean Periphonic; } BFormatDec; BFormatDec *bformatdec_alloc() { - alcall_once(&bformatdec_inited, init_bformatdec); return al_calloc(16, sizeof(BFormatDec)); } -void bformatdec_free(BFormatDec *dec) +void bformatdec_free(BFormatDec **dec) { - if(dec) + if(dec && *dec) { - al_free(dec->Samples); - dec->Samples = NULL; - dec->SamplesHF = NULL; - dec->SamplesLF = NULL; + al_free((*dec)->Samples); + (*dec)->Samples = NULL; + (*dec)->SamplesHF = NULL; + (*dec)->SamplesLF = NULL; - memset(dec, 0, sizeof(*dec)); - al_free(dec); + al_free(*dec); + *dec = NULL; } } -int bformatdec_getOrder(const struct BFormatDec *dec) +void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALsizei chancount, ALuint srate, const ALsizei chanmap[MAX_OUTPUT_CHANNELS]) { - if(dec->Periphonic) - { - if(dec->NumChannels > 9) return 3; - if(dec->NumChannels > 4) return 2; - if(dec->NumChannels > 1) return 1; - } - else - { - if(dec->NumChannels > 5) return 3; - if(dec->NumChannels > 3) return 2; - if(dec->NumChannels > 1) return 1; - } - return 0; -} - -void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, ALuint srate, const ALuint chanmap[MAX_OUTPUT_CHANNELS], int flags) -{ - static const ALuint map2DTo3D[MAX_AMBI2D_COEFFS] = { + static const ALsizei map2DTo3D[MAX_AMBI2D_COEFFS] = { 0, 1, 3, 4, 8, 9, 15 }; - const ALfloat *coeff_scale = UnitScale; - ALfloat distgain[MAX_OUTPUT_CHANNELS]; - ALfloat maxdist, ratio; - ALuint i, j, k; + const ALfloat *coeff_scale = N3D2N3DScale; + bool periphonic; + ALfloat ratio; + ALsizei i; al_free(dec->Samples); dec->Samples = NULL; @@ -284,91 +153,48 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, dec->SamplesHF = dec->Samples; dec->SamplesLF = dec->SamplesHF + dec->NumChannels; - for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) - dec->Enabled[i] = AL_FALSE; + dec->Enabled = 0; for(i = 0;i < conf->NumSpeakers;i++) - dec->Enabled[chanmap[i]] = AL_TRUE; + dec->Enabled |= 1 << chanmap[i]; if(conf->CoeffScale == ADS_SN3D) coeff_scale = SN3D2N3DScale; else if(conf->CoeffScale == ADS_FuMa) coeff_scale = FuMa2N3DScale; + memset(dec->UpSampler, 0, sizeof(dec->UpSampler)); ratio = 400.0f / (ALfloat)srate; for(i = 0;i < 4;i++) - bandsplit_init(&dec->UpSampler.XOver[i], ratio); - memset(dec->UpSampler.Gains, 0, sizeof(dec->UpSampler.Gains)); + bandsplit_init(&dec->UpSampler[i].XOver, ratio); if((conf->ChanMask&AMBI_PERIPHONIC_MASK)) { - /* Combine the matrices that do the in->virt and virt->out conversions - * so we get a single in->out conversion. - */ - for(i = 0;i < 4;i++) - { - for(j = 0;j < dec->NumChannels;j++) - { - ALfloat *gains = dec->UpSampler.Gains[i][j]; - for(k = 0;k < COUNTOF(Ambi3DDecoder);k++) - { - gains[FB_HighFreq] += Ambi3DDecoder[k][FB_HighFreq][i]*Ambi3DEncoder[k][j]; - gains[FB_LowFreq] += Ambi3DDecoder[k][FB_LowFreq][i]*Ambi3DEncoder[k][j]; - } - } - } + periphonic = true; - dec->Periphonic = AL_TRUE; + dec->UpSampler[0].Gains[HF_BAND] = (conf->ChanMask > 0x1ff) ? W_SCALE_3H3P : + (conf->ChanMask > 0xf) ? W_SCALE_2H2P : 1.0f; + dec->UpSampler[0].Gains[LF_BAND] = 1.0f; + for(i = 1;i < 4;i++) + { + dec->UpSampler[i].Gains[HF_BAND] = (conf->ChanMask > 0x1ff) ? XYZ_SCALE_3H3P : + (conf->ChanMask > 0xf) ? XYZ_SCALE_2H2P : 1.0f; + dec->UpSampler[i].Gains[LF_BAND] = 1.0f; + } } else { - for(i = 0;i < 4;i++) + periphonic = false; + + dec->UpSampler[0].Gains[HF_BAND] = (conf->ChanMask > 0x1ff) ? W_SCALE_3H0P : + (conf->ChanMask > 0xf) ? W_SCALE_2H0P : 1.0f; + dec->UpSampler[0].Gains[LF_BAND] = 1.0f; + for(i = 1;i < 3;i++) { - for(j = 0;j < dec->NumChannels;j++) - { - ALfloat *gains = dec->UpSampler.Gains[i][j]; - for(k = 0;k < COUNTOF(Ambi2DDecoder);k++) - { - gains[FB_HighFreq] += Ambi2DDecoder[k][FB_HighFreq][i]*Ambi2DEncoder[k][j]; - gains[FB_LowFreq] += Ambi2DDecoder[k][FB_LowFreq][i]*Ambi2DEncoder[k][j]; - } - } - } - - dec->Periphonic = AL_FALSE; - } - - maxdist = 0.0f; - for(i = 0;i < conf->NumSpeakers;i++) - { - maxdist = maxf(maxdist, conf->Speakers[i].Distance); - distgain[i] = 1.0f; - } - - memset(dec->Delay, 0, sizeof(dec->Delay)); - if((flags&BFDF_DistanceComp) && maxdist > 0.0f) - { - for(i = 0;i < conf->NumSpeakers;i++) - { - ALuint chan = chanmap[i]; - ALfloat delay; - - /* Distance compensation only delays in steps of the sample rate. - * This is a bit less accurate since the delay time falls to the - * nearest sample time, but it's far simpler as it doesn't have to - * deal with phase offsets. This means at 48khz, for instance, the - * distance delay will be in steps of about 7 millimeters. - */ - delay = floorf((maxdist-conf->Speakers[i].Distance) / SPEEDOFSOUNDMETRESPERSEC * - (ALfloat)srate + 0.5f); - if(delay >= (ALfloat)MAX_DELAY_LENGTH) - ERR("Delay for speaker \"%s\" exceeds buffer length (%f >= %u)\n", - al_string_get_cstr(conf->Speakers[i].Name), delay, MAX_DELAY_LENGTH); - - dec->Delay[chan].Length = (ALuint)clampf(delay, 0.0f, (ALfloat)(MAX_DELAY_LENGTH-1)); - distgain[i] = conf->Speakers[i].Distance / maxdist; - TRACE("Channel %u \"%s\" distance compensation: %u samples, %f gain\n", chan, - al_string_get_cstr(conf->Speakers[i].Name), dec->Delay[chan].Length, distgain[i] - ); + dec->UpSampler[i].Gains[HF_BAND] = (conf->ChanMask > 0x1ff) ? XYZ_SCALE_3H0P : + (conf->ChanMask > 0xf) ? XYZ_SCALE_2H0P : 1.0f; + dec->UpSampler[i].Gains[LF_BAND] = 1.0f; } + dec->UpSampler[3].Gains[HF_BAND] = 0.0f; + dec->UpSampler[3].Gains[LF_BAND] = 0.0f; } memset(&dec->Matrix, 0, sizeof(dec->Matrix)); @@ -377,22 +203,22 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, dec->DualBand = AL_FALSE; for(i = 0;i < conf->NumSpeakers;i++) { - ALuint chan = chanmap[i]; + ALsizei chan = chanmap[i]; ALfloat gain; - ALuint j, k; + ALsizei j, k; - if(!dec->Periphonic) + if(!periphonic) { for(j = 0,k = 0;j < MAX_AMBI2D_COEFFS;j++) { - ALuint l = map2DTo3D[j]; + ALsizei l = map2DTo3D[j]; if(j == 0) gain = conf->HFOrderGain[0]; else if(j == 1) gain = conf->HFOrderGain[1]; else if(j == 3) gain = conf->HFOrderGain[2]; else if(j == 5) gain = conf->HFOrderGain[3]; if((conf->ChanMask&(1<Matrix.Single[chan][j] = conf->HFMatrix[i][k++] / coeff_scale[l] * - gain * distgain[i]; + gain; } } else @@ -405,7 +231,7 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, else if(j == 9) gain = conf->HFOrderGain[3]; if((conf->ChanMask&(1<Matrix.Single[chan][j] = conf->HFMatrix[i][k++] / coeff_scale[j] * - gain * distgain[i]; + gain; } } } @@ -421,35 +247,33 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, ratio = powf(10.0f, conf->XOverRatio / 40.0f); for(i = 0;i < conf->NumSpeakers;i++) { - ALuint chan = chanmap[i]; + ALsizei chan = chanmap[i]; ALfloat gain; - ALuint j, k; + ALsizei j, k; - if(!dec->Periphonic) + if(!periphonic) { for(j = 0,k = 0;j < MAX_AMBI2D_COEFFS;j++) { - ALuint l = map2DTo3D[j]; + ALsizei l = map2DTo3D[j]; if(j == 0) gain = conf->HFOrderGain[0] * ratio; else if(j == 1) gain = conf->HFOrderGain[1] * ratio; else if(j == 3) gain = conf->HFOrderGain[2] * ratio; else if(j == 5) gain = conf->HFOrderGain[3] * ratio; if((conf->ChanMask&(1<Matrix.Dual[chan][FB_HighFreq][j] = conf->HFMatrix[i][k++] / - coeff_scale[l] * gain * - distgain[i]; + dec->Matrix.Dual[chan][HF_BAND][j] = conf->HFMatrix[i][k++] / + coeff_scale[l] * gain; } for(j = 0,k = 0;j < MAX_AMBI2D_COEFFS;j++) { - ALuint l = map2DTo3D[j]; + ALsizei l = map2DTo3D[j]; if(j == 0) gain = conf->LFOrderGain[0] / ratio; else if(j == 1) gain = conf->LFOrderGain[1] / ratio; else if(j == 3) gain = conf->LFOrderGain[2] / ratio; else if(j == 5) gain = conf->LFOrderGain[3] / ratio; if((conf->ChanMask&(1<Matrix.Dual[chan][FB_LowFreq][j] = conf->LFMatrix[i][k++] / - coeff_scale[l] * gain * - distgain[i]; + dec->Matrix.Dual[chan][LF_BAND][j] = conf->LFMatrix[i][k++] / + coeff_scale[l] * gain; } } else @@ -461,9 +285,8 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, else if(j == 4) gain = conf->HFOrderGain[2] * ratio; else if(j == 9) gain = conf->HFOrderGain[3] * ratio; if((conf->ChanMask&(1<Matrix.Dual[chan][FB_HighFreq][j] = conf->HFMatrix[i][k++] / - coeff_scale[j] * gain * - distgain[i]; + dec->Matrix.Dual[chan][HF_BAND][j] = conf->HFMatrix[i][k++] / + coeff_scale[j] * gain; } for(j = 0,k = 0;j < MAX_AMBI_COEFFS;j++) { @@ -472,9 +295,8 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, else if(j == 4) gain = conf->LFOrderGain[2] / ratio; else if(j == 9) gain = conf->LFOrderGain[3] / ratio; if((conf->ChanMask&(1<Matrix.Dual[chan][FB_LowFreq][j] = conf->LFMatrix[i][k++] / - coeff_scale[j] * gain * - distgain[i]; + dec->Matrix.Dual[chan][LF_BAND][j] = conf->LFMatrix[i][k++] / + coeff_scale[j] * gain; } } } @@ -482,10 +304,11 @@ void bformatdec_reset(BFormatDec *dec, const AmbDecConf *conf, ALuint chancount, } -void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALuint SamplesToDo) +void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALsizei OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei SamplesToDo) { - ALuint chan, i; + ALsizei chan, i; + OutBuffer = ASSUME_ALIGNED(OutBuffer, 16); if(dec->DualBand) { for(i = 0;i < dec->NumChannels;i++) @@ -494,42 +317,18 @@ void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BU for(chan = 0;chan < OutChannels;chan++) { - if(!dec->Enabled[chan]) + if(!(dec->Enabled&(1<ChannelMix, 0, SamplesToDo*sizeof(ALfloat)); - MixMatrixRow(dec->ChannelMix, dec->Matrix.Dual[chan][FB_HighFreq], - SAFE_CONST(ALfloatBUFFERSIZE*,dec->SamplesHF), dec->NumChannels, 0, - SamplesToDo + MixRowSamples(dec->ChannelMix, dec->Matrix.Dual[chan][HF_BAND], + dec->SamplesHF, dec->NumChannels, 0, SamplesToDo ); - MixMatrixRow(dec->ChannelMix, dec->Matrix.Dual[chan][FB_LowFreq], - SAFE_CONST(ALfloatBUFFERSIZE*,dec->SamplesLF), dec->NumChannels, 0, - SamplesToDo + MixRowSamples(dec->ChannelMix, dec->Matrix.Dual[chan][LF_BAND], + dec->SamplesLF, dec->NumChannels, 0, SamplesToDo ); - if(dec->Delay[chan].Length > 0) - { - const ALuint base = dec->Delay[chan].Length; - if(SamplesToDo >= base) - { - for(i = 0;i < base;i++) - OutBuffer[chan][i] += dec->Delay[chan].Buffer[i]; - for(;i < SamplesToDo;i++) - OutBuffer[chan][i] += dec->ChannelMix[i-base]; - memcpy(dec->Delay[chan].Buffer, &dec->ChannelMix[SamplesToDo-base], - base*sizeof(ALfloat)); - } - else - { - for(i = 0;i < SamplesToDo;i++) - OutBuffer[chan][i] += dec->Delay[chan].Buffer[i]; - memmove(dec->Delay[chan].Buffer, dec->Delay[chan].Buffer+SamplesToDo, - base - SamplesToDo); - memcpy(dec->Delay[chan].Buffer+base-SamplesToDo, dec->ChannelMix, - SamplesToDo*sizeof(ALfloat)); - } - } - else for(i = 0;i < SamplesToDo;i++) + for(i = 0;i < SamplesToDo;i++) OutBuffer[chan][i] += dec->ChannelMix[i]; } } @@ -537,134 +336,157 @@ void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BU { for(chan = 0;chan < OutChannels;chan++) { - if(!dec->Enabled[chan]) + if(!(dec->Enabled&(1<ChannelMix, 0, SamplesToDo*sizeof(ALfloat)); - MixMatrixRow(dec->ChannelMix, dec->Matrix.Single[chan], InSamples, - dec->NumChannels, 0, SamplesToDo); + MixRowSamples(dec->ChannelMix, dec->Matrix.Single[chan], InSamples, + dec->NumChannels, 0, SamplesToDo); - if(dec->Delay[chan].Length > 0) - { - const ALuint base = dec->Delay[chan].Length; - if(SamplesToDo >= base) - { - for(i = 0;i < base;i++) - OutBuffer[chan][i] += dec->Delay[chan].Buffer[i]; - for(;i < SamplesToDo;i++) - OutBuffer[chan][i] += dec->ChannelMix[i-base]; - memcpy(dec->Delay[chan].Buffer, &dec->ChannelMix[SamplesToDo-base], - base*sizeof(ALfloat)); - } - else - { - for(i = 0;i < SamplesToDo;i++) - OutBuffer[chan][i] += dec->Delay[chan].Buffer[i]; - memmove(dec->Delay[chan].Buffer, dec->Delay[chan].Buffer+SamplesToDo, - base - SamplesToDo); - memcpy(dec->Delay[chan].Buffer+base-SamplesToDo, dec->ChannelMix, - SamplesToDo*sizeof(ALfloat)); - } - } - else for(i = 0;i < SamplesToDo;i++) + for(i = 0;i < SamplesToDo;i++) OutBuffer[chan][i] += dec->ChannelMix[i]; } } } -void bformatdec_upSample(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat (*restrict InSamples)[BUFFERSIZE], ALuint InChannels, ALuint SamplesToDo) +void bformatdec_upSample(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei InChannels, ALsizei SamplesToDo) { - ALuint i, j; + ALsizei i; - /* This up-sampler is very simplistic. It essentially decodes the first- - * order content to a square channel array (or cube if height is desired), - * then encodes those points onto the higher order soundfield. The decoder - * and encoder matrices have been combined to directly convert each input - * channel to the output, without the need for storing the virtual channel - * array. + /* This up-sampler leverages the differences observed in dual-band second- + * and third-order decoder matrices compared to first-order. For the same + * output channel configuration, the low-frequency matrix has identical + * coefficients in the shared input channels, while the high-frequency + * matrix has extra scalars applied to the W channel and X/Y/Z channels. + * Mixing the first-order content into the higher-order stream with the + * appropriate counter-scales applied to the HF response results in the + * subsequent higher-order decode generating the same response as a first- + * order decode. */ for(i = 0;i < InChannels;i++) { /* First, split the first-order components into low and high frequency * bands. */ - bandsplit_process(&dec->UpSampler.XOver[i], - dec->Samples[FB_HighFreq], dec->Samples[FB_LowFreq], + bandsplit_process(&dec->UpSampler[i].XOver, + dec->Samples[HF_BAND], dec->Samples[LF_BAND], InSamples[i], SamplesToDo ); /* Now write each band to the output. */ - for(j = 0;j < dec->NumChannels;j++) - MixMatrixRow(OutBuffer[j], dec->UpSampler.Gains[i][j], - SAFE_CONST(ALfloatBUFFERSIZE*,dec->Samples), FB_Max, 0, - SamplesToDo - ); + MixRowSamples(OutBuffer[i], dec->UpSampler[i].Gains, + dec->Samples, NUM_BANDS, 0, SamplesToDo + ); } } +#define INVALID_UPSAMPLE_INDEX INT_MAX + +static ALsizei GetACNIndex(const BFChannelConfig *chans, ALsizei numchans, ALsizei acn) +{ + ALsizei i; + for(i = 0;i < numchans;i++) + { + if(chans[i].Index == acn) + return i; + } + return INVALID_UPSAMPLE_INDEX; +} +#define GetChannelForACN(b, a) GetACNIndex((b).Ambi.Map, (b).NumChannels, (a)) + typedef struct AmbiUpsampler { - alignas(16) ALfloat Samples[FB_Max][BUFFERSIZE]; + alignas(16) ALfloat Samples[NUM_BANDS][BUFFERSIZE]; BandSplitter XOver[4]; - ALfloat Gains[4][MAX_OUTPUT_CHANNELS][FB_Max]; + ALfloat Gains[4][MAX_OUTPUT_CHANNELS][NUM_BANDS]; } AmbiUpsampler; AmbiUpsampler *ambiup_alloc() { - alcall_once(&bformatdec_inited, init_bformatdec); return al_calloc(16, sizeof(AmbiUpsampler)); } -void ambiup_free(struct AmbiUpsampler *ambiup) +void ambiup_free(struct AmbiUpsampler **ambiup) { - al_free(ambiup); + if(ambiup) + { + al_free(*ambiup); + *ambiup = NULL; + } } -void ambiup_reset(struct AmbiUpsampler *ambiup, const ALCdevice *device) +void ambiup_reset(struct AmbiUpsampler *ambiup, const ALCdevice *device, ALfloat w_scale, ALfloat xyz_scale) { - ALfloat gains[8][MAX_OUTPUT_CHANNELS]; ALfloat ratio; - ALuint i, j, k; + ALsizei i; ratio = 400.0f / (ALfloat)device->Frequency; for(i = 0;i < 4;i++) bandsplit_init(&ambiup->XOver[i], ratio); - for(i = 0;i < COUNTOF(Ambi3DEncoder);i++) - ComputePanningGains(device->Dry, Ambi3DEncoder[i], 1.0f, gains[i]); - memset(ambiup->Gains, 0, sizeof(ambiup->Gains)); - for(i = 0;i < 4;i++) + if(device->Dry.CoeffCount > 0) { - for(j = 0;j < device->Dry.NumChannels;j++) + ALfloat encgains[8][MAX_OUTPUT_CHANNELS]; + ALsizei j; + size_t k; + + for(k = 0;k < COUNTOF(Ambi3DPoints);k++) { - for(k = 0;k < COUNTOF(Ambi3DDecoder);k++) + ALfloat coeffs[MAX_AMBI_COEFFS] = { 0.0f }; + CalcDirectionCoeffs(Ambi3DPoints[k], 0.0f, coeffs); + ComputeDryPanGains(&device->Dry, coeffs, 1.0f, encgains[k]); + } + + /* Combine the matrices that do the in->virt and virt->out conversions + * so we get a single in->out conversion. NOTE: the Encoder matrix + * (encgains) and output are transposed, so the input channels line up + * with the rows and the output channels line up with the columns. + */ + for(i = 0;i < 4;i++) + { + for(j = 0;j < device->Dry.NumChannels;j++) { - ambiup->Gains[i][j][FB_HighFreq] += Ambi3DDecoder[k][FB_HighFreq][i]*gains[k][j]; - ambiup->Gains[i][j][FB_LowFreq] += Ambi3DDecoder[k][FB_LowFreq][i]*gains[k][j]; + ALfloat gain=0.0f; + for(k = 0;k < COUNTOF(Ambi3DDecoder);k++) + gain += Ambi3DDecoder[k][i] * encgains[k][j]; + ambiup->Gains[i][j][HF_BAND] = gain * Ambi3DDecoderHFScale[i]; + ambiup->Gains[i][j][LF_BAND] = gain; + } + } + } + else + { + for(i = 0;i < 4;i++) + { + ALsizei index = GetChannelForACN(device->Dry, i); + if(index != INVALID_UPSAMPLE_INDEX) + { + ALfloat scale = device->Dry.Ambi.Map[index].Scale; + ambiup->Gains[i][index][HF_BAND] = scale * ((i==0) ? w_scale : xyz_scale); + ambiup->Gains[i][index][LF_BAND] = scale; } } } } -void ambiup_process(struct AmbiUpsampler *ambiup, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALuint SamplesToDo) +void ambiup_process(struct AmbiUpsampler *ambiup, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALsizei OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei SamplesToDo) { - ALuint i, j; + ALsizei i, j; for(i = 0;i < 4;i++) { bandsplit_process(&ambiup->XOver[i], - ambiup->Samples[FB_HighFreq], ambiup->Samples[FB_LowFreq], + ambiup->Samples[HF_BAND], ambiup->Samples[LF_BAND], InSamples[i], SamplesToDo ); for(j = 0;j < OutChannels;j++) - MixMatrixRow(OutBuffer[j], ambiup->Gains[i][j], - SAFE_CONST(ALfloatBUFFERSIZE*,ambiup->Samples), FB_Max, 0, - SamplesToDo + MixRowSamples(OutBuffer[j], ambiup->Gains[i][j], + ambiup->Samples, NUM_BANDS, 0, SamplesToDo ); } } diff --git a/Engine/lib/openal-soft/Alc/bformatdec.h b/Engine/lib/openal-soft/Alc/bformatdec.h index e78d89a7b..2d7d1d624 100644 --- a/Engine/lib/openal-soft/Alc/bformatdec.h +++ b/Engine/lib/openal-soft/Alc/bformatdec.h @@ -3,47 +3,55 @@ #include "alMain.h" + +/* These are the necessary scales for first-order HF responses to play over + * higher-order 2D (non-periphonic) decoders. + */ +#define W_SCALE_2H0P 1.224744871f /* sqrt(1.5) */ +#define XYZ_SCALE_2H0P 1.0f +#define W_SCALE_3H0P 1.414213562f /* sqrt(2) */ +#define XYZ_SCALE_3H0P 1.082392196f + +/* These are the necessary scales for first-order HF responses to play over + * higher-order 3D (periphonic) decoders. + */ +#define W_SCALE_2H2P 1.341640787f /* sqrt(1.8) */ +#define XYZ_SCALE_2H2P 1.0f +#define W_SCALE_3H3P 1.695486018f +#define XYZ_SCALE_3H3P 1.136697713f + + +/* NOTE: These are scale factors as applied to Ambisonics content. Decoder + * coefficients should be divided by these values to get proper N3D scalings. + */ +const ALfloat N3D2N3DScale[MAX_AMBI_COEFFS]; +const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS]; +const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS]; + + struct AmbDecConf; struct BFormatDec; struct AmbiUpsampler; -enum BFormatDecFlags { - BFDF_DistanceComp = 1<<0 -}; struct BFormatDec *bformatdec_alloc(); -void bformatdec_free(struct BFormatDec *dec); -int bformatdec_getOrder(const struct BFormatDec *dec); -void bformatdec_reset(struct BFormatDec *dec, const struct AmbDecConf *conf, ALuint chancount, ALuint srate, const ALuint chanmap[MAX_OUTPUT_CHANNELS], int flags); +void bformatdec_free(struct BFormatDec **dec); +void bformatdec_reset(struct BFormatDec *dec, const struct AmbDecConf *conf, ALsizei chancount, ALuint srate, const ALsizei chanmap[MAX_OUTPUT_CHANNELS]); /* Decodes the ambisonic input to the given output channels. */ -void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALuint SamplesToDo); +void bformatdec_process(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALsizei OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei SamplesToDo); /* Up-samples a first-order input to the decoder's configuration. */ -void bformatdec_upSample(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat (*restrict InSamples)[BUFFERSIZE], ALuint InChannels, ALuint SamplesToDo); +void bformatdec_upSample(struct BFormatDec *dec, ALfloat (*restrict OutBuffer)[BUFFERSIZE], const ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei InChannels, ALsizei SamplesToDo); /* Stand-alone first-order upsampler. Kept here because it shares some stuff - * with bformatdec. + * with bformatdec. Assumes a periphonic (4-channel) input mix! */ struct AmbiUpsampler *ambiup_alloc(); -void ambiup_free(struct AmbiUpsampler *ambiup); -void ambiup_reset(struct AmbiUpsampler *ambiup, const ALCdevice *device); +void ambiup_free(struct AmbiUpsampler **ambiup); +void ambiup_reset(struct AmbiUpsampler *ambiup, const ALCdevice *device, ALfloat w_scale, ALfloat xyz_scale); -void ambiup_process(struct AmbiUpsampler *ambiup, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALuint SamplesToDo); - - -/* Band splitter. Splits a signal into two phase-matching frequency bands. */ -typedef struct BandSplitter { - ALfloat coeff; - ALfloat lp_z1; - ALfloat lp_z2; - ALfloat hp_z1; -} BandSplitter; - -void bandsplit_init(BandSplitter *splitter, ALfloat freq_mult); -void bandsplit_clear(BandSplitter *splitter); -void bandsplit_process(BandSplitter *splitter, ALfloat *restrict hpout, ALfloat *restrict lpout, - const ALfloat *input, ALuint count); +void ambiup_process(struct AmbiUpsampler *ambiup, ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALsizei OutChannels, const ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei SamplesToDo); #endif /* BFORMATDEC_H */ diff --git a/Engine/lib/openal-soft/Alc/bs2b.c b/Engine/lib/openal-soft/Alc/bs2b.c index ddc2e2f24..e235e5475 100644 --- a/Engine/lib/openal-soft/Alc/bs2b.c +++ b/Engine/lib/openal-soft/Alc/bs2b.c @@ -129,16 +129,16 @@ void bs2b_clear(struct bs2b *bs2b) memset(&bs2b->last_sample, 0, sizeof(bs2b->last_sample)); } /* bs2b_clear */ -void bs2b_cross_feed(struct bs2b *bs2b, float *restrict Left, float *restrict Right, unsigned int SamplesToDo) +void bs2b_cross_feed(struct bs2b *bs2b, float *restrict Left, float *restrict Right, int SamplesToDo) { float lsamples[128][2]; float rsamples[128][2]; - unsigned int base; + int base; for(base = 0;base < SamplesToDo;) { - unsigned int todo = minu(128, SamplesToDo-base); - unsigned int i; + int todo = mini(128, SamplesToDo-base); + int i; /* Process left input */ lsamples[0][0] = bs2b->a0_lo*Left[0] + diff --git a/Engine/lib/openal-soft/Alc/bsinc.c b/Engine/lib/openal-soft/Alc/bsinc.c deleted file mode 100644 index f795120f7..000000000 --- a/Engine/lib/openal-soft/Alc/bsinc.c +++ /dev/null @@ -1,981 +0,0 @@ - -#include "config.h" - -#include "AL/al.h" -#include "align.h" - -/* Table of windowed sinc coefficients and deltas. This 11th order filter - * has a rejection of -60 dB, yielding a transition width of ~0.302 - * (normalized frequency). Order increases when downsampling to a limit of - * one octave, after which the quality of the filter (transition width) - * suffers to reduce the CPU cost. The bandlimiting will cut all sound after - * downsampling by ~2.73 octaves. - */ -alignas(16) const ALfloat bsincTab[18840] = -{ - /* 24, 0 */ +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, +0.000000000e+00f, - - /* 24, 0 */ +1.501390780e-03f, +3.431804419e-03f, +6.512803185e-03f, +1.091425387e-02f, +1.664594540e-02f, +2.351091132e-02f, +3.109255671e-02f, +3.878419288e-02f, +4.586050701e-02f, +5.158058002e-02f, +5.530384985e-02f, +5.659614054e-02f, +5.530384985e-02f, +5.158058002e-02f, +4.586050701e-02f, +3.878419288e-02f, +3.109255671e-02f, +2.351091132e-02f, +1.664594540e-02f, +1.091425387e-02f, +6.512803185e-03f, +3.431804419e-03f, +1.501390780e-03f, +4.573885647e-04f, - /* 24, 1 */ +1.413186400e-03f, +3.279858311e-03f, +6.282638036e-03f, +1.059932179e-02f, +1.625135142e-02f, +2.305547031e-02f, +3.060840342e-02f, +3.831365198e-02f, +4.545054680e-02f, +5.127577001e-02f, +5.513916011e-02f, +5.659104154e-02f, +5.545895049e-02f, +5.187752167e-02f, +4.626513642e-02f, +3.925233583e-02f, +3.157717954e-02f, +2.396921539e-02f, +1.704503934e-02f, +1.123445076e-02f, +6.748179094e-03f, +3.588275667e-03f, +1.593065611e-03f, +5.022154476e-04f, - /* 24, 2 */ +1.328380648e-03f, +3.132379333e-03f, +6.057656813e-03f, +1.028967374e-02f, +1.586133102e-02f, +2.260301890e-02f, +3.012488684e-02f, +3.784089895e-02f, +4.503543229e-02f, +5.096323022e-02f, +5.496495842e-02f, +5.657574693e-02f, +5.560438923e-02f, +5.216645963e-02f, +4.666426010e-02f, +3.971789474e-02f, +3.206210284e-02f, +2.443025293e-02f, +1.744855617e-02f, +1.155988996e-02f, +6.988790100e-03f, +3.749328623e-03f, +1.688282347e-03f, +5.494305796e-04f, - /* 24, 3 */ +1.246901403e-03f, +2.989308098e-03f, +5.837830254e-03f, +9.985325752e-03f, +1.547595434e-02f, +2.215368059e-02f, +2.964217216e-02f, +3.736611920e-02f, +4.461534144e-02f, +5.064310236e-02f, +5.478132634e-02f, +5.655026396e-02f, +5.574009777e-02f, +5.244726189e-02f, +4.705770477e-02f, +4.018068337e-02f, +3.254715574e-02f, +2.489389144e-02f, +1.785641537e-02f, +1.189054572e-02f, +7.234657995e-03f, +3.915018340e-03f, +1.787112015e-03f, +5.991047395e-04f, - /* 24, 4 */ +1.168676301e-03f, +2.850583915e-03f, +5.623126723e-03f, +9.686290690e-03f, +1.509528803e-02f, +2.170757578e-02f, +2.916042250e-02f, +3.688949768e-02f, +4.419045351e-02f, +5.031553118e-02f, +5.458834968e-02f, +5.651460469e-02f, +5.586601230e-02f, +5.271979985e-02f, +4.744529894e-02f, +4.064051541e-02f, +3.303216567e-02f, +2.535999546e-02f, +1.826853297e-02f, +1.222638897e-02f, +7.485801959e-03f, +4.085398290e-03f, +1.889625146e-03f, +6.513091287e-04f, - /* 24, 5 */ +1.093632798e-03f, +2.716144855e-03f, +5.413512274e-03f, +9.392578266e-03f, +1.471939531e-02f, +2.126482169e-02f, +2.867979883e-02f, +3.641121873e-02f, +4.376094899e-02f, +4.998066438e-02f, +5.438611851e-02f, +5.646878599e-02f, +5.598207354e-02f, +5.298394839e-02f, +4.782687301e-02f, +4.109720465e-02f, +3.351695842e-02f, +2.582842673e-02f, +1.868482156e-02f, +1.256738733e-02f, +7.742238512e-03f, +4.260520294e-03f, +1.995891717e-03f, +7.061153220e-04f, - /* 24, 6 */ +1.021698233e-03f, +2.585927824e-03f, +5.208950715e-03f, +9.104195104e-03f, +1.434833590e-02f, +2.082553239e-02f, +2.820045990e-02f, +3.593146595e-02f, +4.332700946e-02f, +4.963865252e-02f, +5.417472708e-02f, +5.641282954e-02f, +5.608822683e-02f, +5.323958602e-02f, +4.820225940e-02f, +4.155056502e-02f, +3.400135826e-02f, +2.629904416e-02f, +1.910519032e-02f, +1.291350505e-02f, +8.003981455e-03f, +4.440434453e-03f, +2.105981077e-03f, +7.635952183e-04f, - /* 24, 7 */ +9.527998831e-04f, +2.459868628e-03f, +5.009403670e-03f, +8.821144768e-03f, +1.398216608e-02f, +2.038981869e-02f, +2.772256216e-02f, +3.545042216e-02f, +4.288881749e-02f, +4.928964888e-02f, +5.395427373e-02f, +5.634676181e-02f, +5.618442211e-02f, +5.348659488e-02f, +4.857129262e-02f, +4.200041076e-02f, +3.448518802e-02f, +2.677170395e-02f, +1.952954505e-02f, +1.326470299e-02f, +8.271041819e-03f, +4.625189083e-03f, +2.219961884e-03f, +8.238209888e-04f, - /* 24, 8 */ +8.868650246e-04f, +2.337902042e-03f, +4.814830642e-03f, +8.543427812e-03f, +1.362093865e-02f, +1.995778816e-02f, +2.724625964e-02f, +3.496826923e-02f, +4.244655653e-02f, +4.893380942e-02f, +5.372486088e-02f, +5.627061400e-02f, +5.627061400e-02f, +5.372486088e-02f, +4.893380942e-02f, +4.244655653e-02f, +3.496826923e-02f, +2.724625964e-02f, +1.995778816e-02f, +1.362093865e-02f, +8.543427812e-03f, +4.814830642e-03f, +2.337902042e-03f, +8.868650246e-04f, - /* 24, 9 */ +8.238209888e-04f, +2.219961884e-03f, +4.625189083e-03f, +8.271041819e-03f, +1.326470299e-02f, +1.952954505e-02f, +2.677170395e-02f, +3.448518802e-02f, +4.200041076e-02f, +4.857129262e-02f, +5.348659488e-02f, +5.618442211e-02f, +5.634676181e-02f, +5.395427373e-02f, +4.928964888e-02f, +4.288881749e-02f, +3.545042216e-02f, +2.772256216e-02f, +2.038981869e-02f, +1.398216608e-02f, +8.821144768e-03f, +5.009403670e-03f, +2.459868628e-03f, +9.527998831e-04f, - /* 24,10 */ +7.635952183e-04f, +2.105981077e-03f, +4.440434453e-03f, +8.003981455e-03f, +1.291350505e-02f, +1.910519032e-02f, +2.629904416e-02f, +3.400135826e-02f, +4.155056502e-02f, +4.820225940e-02f, +5.323958602e-02f, +5.608822683e-02f, +5.641282954e-02f, +5.417472708e-02f, +4.963865252e-02f, +4.332700946e-02f, +3.593146595e-02f, +2.820045990e-02f, +2.082553239e-02f, +1.434833590e-02f, +9.104195104e-03f, +5.208950715e-03f, +2.585927824e-03f, +1.021698233e-03f, - /* 24,11 */ +7.061153220e-04f, +1.995891717e-03f, +4.260520294e-03f, +7.742238512e-03f, +1.256738733e-02f, +1.868482156e-02f, +2.582842673e-02f, +3.351695842e-02f, +4.109720465e-02f, +4.782687301e-02f, +5.298394839e-02f, +5.598207354e-02f, +5.646878599e-02f, +5.438611851e-02f, +4.998066438e-02f, +4.376094899e-02f, +3.641121873e-02f, +2.867979883e-02f, +2.126482169e-02f, +1.471939531e-02f, +9.392578266e-03f, +5.413512274e-03f, +2.716144855e-03f, +1.093632798e-03f, - /* 24,12 */ +6.513091287e-04f, +1.889625146e-03f, +4.085398290e-03f, +7.485801959e-03f, +1.222638897e-02f, +1.826853297e-02f, +2.535999546e-02f, +3.303216567e-02f, +4.064051541e-02f, +4.744529894e-02f, +5.271979985e-02f, +5.586601230e-02f, +5.651460469e-02f, +5.458834968e-02f, +5.031553118e-02f, +4.419045351e-02f, +3.688949768e-02f, +2.916042250e-02f, +2.170757578e-02f, +1.509528803e-02f, +9.686290690e-03f, +5.623126723e-03f, +2.850583915e-03f, +1.168676301e-03f, - /* 24,13 */ +5.991047395e-04f, +1.787112015e-03f, +3.915018340e-03f, +7.234657995e-03f, +1.189054572e-02f, +1.785641537e-02f, +2.489389144e-02f, +3.254715574e-02f, +4.018068337e-02f, +4.705770477e-02f, +5.244726189e-02f, +5.574009777e-02f, +5.655026396e-02f, +5.478132634e-02f, +5.064310236e-02f, +4.461534144e-02f, +3.736611920e-02f, +2.964217216e-02f, +2.215368059e-02f, +1.547595434e-02f, +9.985325752e-03f, +5.837830254e-03f, +2.989308098e-03f, +1.246901403e-03f, - /* 24,14 */ +5.494305796e-04f, +1.688282347e-03f, +3.749328623e-03f, +6.988790100e-03f, +1.155988996e-02f, +1.744855617e-02f, +2.443025293e-02f, +3.206210284e-02f, +3.971789474e-02f, +4.666426010e-02f, +5.216645963e-02f, +5.560438923e-02f, +5.657574693e-02f, +5.496495842e-02f, +5.096323022e-02f, +4.503543229e-02f, +3.784089895e-02f, +3.012488684e-02f, +2.260301890e-02f, +1.586133102e-02f, +1.028967374e-02f, +6.057656813e-03f, +3.132379333e-03f, +1.328380648e-03f, - /* 24,15 */ +5.022154476e-04f, +1.593065611e-03f, +3.588275667e-03f, +6.748179094e-03f, +1.123445076e-02f, +1.704503934e-02f, +2.396921539e-02f, +3.157717954e-02f, +3.925233583e-02f, +4.626513642e-02f, +5.187752167e-02f, +5.545895049e-02f, +5.659104154e-02f, +5.513916011e-02f, +5.127577001e-02f, +4.545054680e-02f, +3.831365198e-02f, +3.060840342e-02f, +2.305547031e-02f, +1.625135142e-02f, +1.059932179e-02f, +6.282638036e-03f, +3.279858311e-03f, +1.413186400e-03f, - /* 24, 0 */ -1.127794091e-03f, -1.412146034e-03f, -3.831821143e-04f, +3.227045776e-03f, +1.066768284e-02f, +2.270769386e-02f, +3.918787347e-02f, +5.876378120e-02f, +7.897914846e-02f, +9.670702233e-02f, +1.088639494e-01f, +1.131922811e-01f, +1.088639494e-01f, +9.670702233e-02f, +7.897914846e-02f, +5.876378120e-02f, +3.918787347e-02f, +2.270769386e-02f, +1.066768284e-02f, +3.227045776e-03f, -3.831821143e-04f, -1.412146034e-03f, -1.127794091e-03f, -4.881068065e-04f, - /* 24, 1 */ -1.090580766e-03f, -1.420873386e-03f, -5.091873886e-04f, +2.900756187e-03f, +1.007202248e-02f, +2.181774373e-02f, +3.804709217e-02f, +5.749143322e-02f, +7.775467878e-02f, +9.573284944e-02f, +1.083163184e-01f, +1.131750947e-01f, +1.093805191e-01f, +9.765915788e-02f, +8.019389052e-02f, +6.003885715e-02f, +4.034112484e-02f, +2.361538773e-02f, +1.128161899e-02f, +3.568453927e-03f, -2.470940015e-04f, -1.398398357e-03f, -1.163769773e-03f, -5.264712252e-04f, - /* 24, 2 */ -1.052308046e-03f, -1.424863695e-03f, -6.254426725e-04f, +2.589304991e-03f, +9.494532203e-03f, +2.094570441e-02f, +3.691925193e-02f, +5.622252667e-02f, +7.652128881e-02f, +9.473734332e-02f, +1.077380418e-01f, +1.131235487e-01f, +1.098656350e-01f, +9.858856505e-02f, +8.139809812e-02f, +6.131593665e-02f, +4.150635732e-02f, +2.454063933e-02f, +1.191392194e-02f, +3.925253463e-03f, -1.005901154e-04f, -1.379341793e-03f, -1.198322390e-03f, -5.655319713e-04f, - /* 24, 3 */ -1.013146991e-03f, -1.424394748e-03f, -7.322803183e-04f, +2.292405169e-03f, +8.935092066e-03f, +2.009172411e-02f, +3.580480556e-02f, +5.495776346e-02f, +7.527978553e-02f, +9.372122042e-02f, +1.071295572e-01f, +1.130376830e-01f, +1.103189277e-01f, +9.949456662e-02f, +8.259096568e-02f, +6.259428489e-02f, +4.268306423e-02f, +2.548324354e-02f, +1.256466766e-02f, +4.297709369e-03f, +5.666214823e-05f, -1.354682733e-03f, -1.231259367e-03f, -6.052075404e-04f, - /* 24, 4 */ -9.732614753e-04f, -1.419738627e-03f, -8.300317840e-04f, +2.009763334e-03f, +8.393568260e-03f, +1.925593236e-02f, +3.470418745e-02f, +5.369783330e-02f, +7.403097485e-02f, +9.268520876e-02f, +1.064913245e-01f, +1.129175635e-01f, +1.107400515e-01f, +1.003764999e-01f, +8.377168968e-02f, +6.387315732e-02f, +4.387072153e-02f, +2.644297610e-02f, +1.323391671e-02f, +4.686078310e-03f, +2.249946366e-04f, -1.324122762e-03f, -1.262381011e-03f, -6.454100415e-04f, - /* 24, 5 */ -9.328082015e-04f, -1.411161525e-03f, -9.190272443e-04f, +1.741080225e-03f, +7.869813543e-03f, +1.843844016e-02f, +3.361781336e-02f, +5.244341325e-02f, +7.277566076e-02f, +9.163004717e-02f, +1.058238246e-01f, +1.127632829e-01f, +1.111286847e-01f, +1.012337173e-01f, +8.493946948e-02f, +6.515180031e-02f, +4.506878807e-02f, +2.741959349e-02f, +1.392171386e-02f, +5.090608136e-03f, +4.047380047e-04f, -1.287358924e-03f, -1.291480556e-03f, -6.860450823e-04f, - /* 24, 6 */ -8.919367204e-04f, -1.398923562e-03f, -9.995952120e-04f, +1.486051192e-03f, +7.363667669e-03f, +1.763934022e-02f, +3.254608027e-02f, +5.119516710e-02f, +7.151464464e-02f, +9.055648452e-02f, +1.051275597e-01f, +1.125749599e-01f, +1.114845301e-01f, +1.020655875e-01f, +8.609350809e-02f, +6.642945179e-02f, +4.627670593e-02f, +2.841283293e-02f, +1.462808772e-02f, +5.511537402e-03f, +5.962212734e-04f, -1.244083985e-03f, -1.318344226e-03f, -7.270116618e-04f, - /* 24, 7 */ -8.507894667e-04f, -1.383278624e-03f, -1.072062171e-03f, +1.244366682e-03f, +6.874957829e-03f, +1.685870710e-02f, +3.148936626e-02f, +4.995374490e-02f, +7.024872443e-02f, +8.946527894e-02f, +1.044030520e-01f, +1.123527394e-01f, +1.118073151e-01f, +1.028714955e-01f, +8.723301301e-02f, +6.770534195e-02f, +4.749390083e-02f, +2.942241233e-02f, +1.535305047e-02f, +5.949094883e-03f, +7.997713791e-04f, -1.193986722e-03f, -1.342751302e-03f, -7.682020711e-04f, - /* 24, 8 */ -8.095018024e-04f, -1.364474212e-03f, -1.136752219e-03f, +1.015712718e-03f, +6.403499096e-03f, +1.609659749e-02f, +3.044803032e-02f, +4.871978245e-02f, +6.897869391e-02f, +8.835719701e-02f, +1.036508436e-01f, +1.120967923e-01f, +1.120967923e-01f, +1.036508436e-01f, +8.835719701e-02f, +6.897869391e-02f, +4.871978245e-02f, +3.044803032e-02f, +1.609659749e-02f, +6.403499096e-03f, +1.015712718e-03f, -1.136752219e-03f, -1.364474212e-03f, -8.095018024e-04f, - /* 24, 9 */ -7.682020711e-04f, -1.342751302e-03f, -1.193986722e-03f, +7.997713791e-04f, +5.949094883e-03f, +1.535305047e-02f, +2.942241233e-02f, +4.749390083e-02f, +6.770534195e-02f, +8.723301301e-02f, +1.028714955e-01f, +1.118073151e-01f, +1.123527394e-01f, +1.044030520e-01f, +8.946527894e-02f, +7.024872443e-02f, +4.995374490e-02f, +3.148936626e-02f, +1.685870710e-02f, +6.874957829e-03f, +1.244366682e-03f, -1.072062171e-03f, -1.383278624e-03f, -8.507894667e-04f, - /* 24,10 */ -7.270116618e-04f, -1.318344226e-03f, -1.244083985e-03f, +5.962212734e-04f, +5.511537402e-03f, +1.462808772e-02f, +2.841283293e-02f, +4.627670593e-02f, +6.642945179e-02f, +8.609350809e-02f, +1.020655875e-01f, +1.114845301e-01f, +1.125749599e-01f, +1.051275597e-01f, +9.055648452e-02f, +7.151464464e-02f, +5.119516710e-02f, +3.254608027e-02f, +1.763934022e-02f, +7.363667669e-03f, +1.486051192e-03f, -9.995952120e-04f, -1.398923562e-03f, -8.919367204e-04f, - /* 24,11 */ -6.860450823e-04f, -1.291480556e-03f, -1.287358924e-03f, +4.047380047e-04f, +5.090608136e-03f, +1.392171386e-02f, +2.741959349e-02f, +4.506878807e-02f, +6.515180031e-02f, +8.493946948e-02f, +1.012337173e-01f, +1.111286847e-01f, +1.127632829e-01f, +1.058238246e-01f, +9.163004717e-02f, +7.277566076e-02f, +5.244341325e-02f, +3.361781336e-02f, +1.843844016e-02f, +7.869813543e-03f, +1.741080225e-03f, -9.190272443e-04f, -1.411161525e-03f, -9.328082015e-04f, - /* 24,12 */ -6.454100415e-04f, -1.262381011e-03f, -1.324122762e-03f, +2.249946366e-04f, +4.686078310e-03f, +1.323391671e-02f, +2.644297610e-02f, +4.387072153e-02f, +6.387315732e-02f, +8.377168968e-02f, +1.003764999e-01f, +1.107400515e-01f, +1.129175635e-01f, +1.064913245e-01f, +9.268520876e-02f, +7.403097485e-02f, +5.369783330e-02f, +3.470418745e-02f, +1.925593236e-02f, +8.393568260e-03f, +2.009763334e-03f, -8.300317840e-04f, -1.419738627e-03f, -9.732614753e-04f, - /* 24,13 */ -6.052075404e-04f, -1.231259367e-03f, -1.354682733e-03f, +5.666214823e-05f, +4.297709369e-03f, +1.256466766e-02f, +2.548324354e-02f, +4.268306423e-02f, +6.259428489e-02f, +8.259096568e-02f, +9.949456662e-02f, +1.103189277e-01f, +1.130376830e-01f, +1.071295572e-01f, +9.372122042e-02f, +7.527978553e-02f, +5.495776346e-02f, +3.580480556e-02f, +2.009172411e-02f, +8.935092066e-03f, +2.292405169e-03f, -7.322803183e-04f, -1.424394748e-03f, -1.013146991e-03f, - /* 24,14 */ -5.655319713e-04f, -1.198322390e-03f, -1.379341793e-03f, -1.005901154e-04f, +3.925253463e-03f, +1.191392194e-02f, +2.454063933e-02f, +4.150635732e-02f, +6.131593665e-02f, +8.139809812e-02f, +9.858856505e-02f, +1.098656350e-01f, +1.131235487e-01f, +1.077380418e-01f, +9.473734332e-02f, +7.652128881e-02f, +5.622252667e-02f, +3.691925193e-02f, +2.094570441e-02f, +9.494532203e-03f, +2.589304991e-03f, -6.254426725e-04f, -1.424863695e-03f, -1.052308046e-03f, - /* 24,15 */ -5.264712252e-04f, -1.163769773e-03f, -1.398398357e-03f, -2.470940015e-04f, +3.568453927e-03f, +1.128161899e-02f, +2.361538773e-02f, +4.034112484e-02f, +6.003885715e-02f, +8.019389052e-02f, +9.765915788e-02f, +1.093805191e-01f, +1.131750947e-01f, +1.083163184e-01f, +9.573284944e-02f, +7.775467878e-02f, +5.749143322e-02f, +3.804709217e-02f, +2.181774373e-02f, +1.007202248e-02f, +2.900756187e-03f, -5.091873886e-04f, -1.420873386e-03f, -1.090580766e-03f, - /* 24, 0 */ -6.542299160e-04f, -2.850723396e-03f, -6.490258587e-03f, -9.960104872e-03f, -9.809478345e-03f, -1.578994128e-03f, +1.829834548e-02f, +5.025161588e-02f, +9.015425381e-02f, +1.297327779e-01f, +1.589915292e-01f, +1.697884216e-01f, +1.589915292e-01f, +1.297327779e-01f, +9.015425381e-02f, +5.025161588e-02f, +1.829834548e-02f, -1.578994128e-03f, -9.809478345e-03f, -9.960104872e-03f, -6.490258587e-03f, -2.850723396e-03f, -6.542299160e-04f, +6.349952235e-05f, - /* 24, 1 */ -5.715660670e-04f, -2.664319167e-03f, -6.241370053e-03f, -9.805460951e-03f, -1.000906214e-02f, -2.409006146e-03f, +1.668518463e-02f, +4.795494216e-02f, +8.756853655e-02f, +1.274593023e-01f, +1.576392865e-01f, +1.697451719e-01f, +1.602699418e-01f, +1.319653222e-01f, +9.273931864e-02f, +5.258078166e-02f, +1.996024013e-02f, -7.024321916e-04f, -9.578061730e-03f, -1.010098516e-02f, -6.739131402e-03f, -3.043301383e-03f, -7.429059724e-04f, +4.968305000e-05f, - /* 24, 2 */ -4.947700224e-04f, -2.484234158e-03f, -5.993080931e-03f, -9.638098137e-03f, -1.017794029e-02f, -3.193110201e-03f, +1.512113085e-02f, +4.569233080e-02f, +8.498458400e-02f, +1.251473534e-01f, +1.562147818e-01f, +1.696154741e-01f, +1.614730379e-01f, +1.341545065e-01f, +9.532128436e-02f, +5.494080034e-02f, +2.167042077e-02f, +2.212715669e-04f, -9.313697641e-03f, -1.022703863e-02f, -6.987342300e-03f, -3.241882098e-03f, -8.377276082e-04f, +3.267464436e-05f, - /* 24, 3 */ -4.236872966e-04f, -2.310589033e-03f, -5.745975157e-03f, -9.459041324e-03f, -1.031725016e-02f, -3.931996122e-03f, +1.360648366e-02f, +4.346528177e-02f, +8.240478048e-02f, +1.227994149e-01f, +1.547196623e-01f, +1.693994819e-01f, +1.625994153e-01f, +1.362979353e-01f, +9.789767810e-02f, +5.732996534e-02f, +2.342836441e-02f, +1.192656872e-03f, -9.015286272e-03f, -1.033718507e-02f, -7.234214214e-03f, -3.446268223e-03f, -9.388162067e-04f, +1.226776811e-05f, - /* 24, 4 */ -3.581542611e-04f, -2.143480447e-03f, -5.500605429e-03f, -9.269294257e-03f, -1.042813706e-02f, -4.626399385e-03f, +1.214146970e-02f, +4.127522351e-02f, +7.983147433e-02f, +1.204179923e-01f, +1.531556516e-01f, +1.690974512e-01f, +1.636477581e-01f, +1.383932498e-01f, +1.004660042e-01f, +5.974650439e-02f, +2.523347234e-02f, +2.212209196e-03f, -8.681745020e-03f, -1.043032883e-02f, -7.479039479e-03f, -3.656235461e-03f, -1.046280200e-03f, -1.174474466e-05f, - /* 24, 5 */ -2.979990698e-04f, -1.982981877e-03f, -5.257493218e-03f, -9.069838305e-03f, -1.051175200e-02f, -5.277098842e-03f, +1.072624378e-02f, +3.912351177e-02f, +7.726697481e-02f, +1.180056089e-01f, +1.515245471e-01f, +1.687097397e-01f, +1.646168392e-01f, +1.404381320e-01f, +1.030237476e-01f, +6.218858132e-02f, +2.708506973e-02f, +3.280357753e-03f, -8.312010872e-03f, -1.050536039e-02f, -7.721080180e-03f, -3.871531888e-03f, -1.160214103e-03f, -3.957001380e-05f, - /* 24, 6 */ -2.430425717e-04f, -1.829144469e-03f, -5.017128860e-03f, -8.861631306e-03f, -1.056924947e-02f, -5.884914422e-03f, +9.360889972e-03f, +3.701142868e-02f, +7.471354913e-02f, +1.155648023e-01f, +1.498282170e-01f, +1.682368061e-01f, +1.655055219e-01f, +1.424303080e-01f, +1.055683777e-01f, +6.465429798e-02f, +2.898240538e-02f, +4.397473555e-03f, -7.905042791e-03f, -1.056115807e-02f, -7.959568583e-03f, -4.091877352e-03f, -1.280697546e-03f, -7.141440876e-05f, - /* 24, 7 */ -1.930992056e-04f, -1.681997919e-03f, -4.779971710e-03f, -8.645606504e-03f, -1.060178532e-02f, -6.450704795e-03f, +8.045422842e-03f, +3.494018190e-02f, +7.217341954e-02f, +1.130981205e-01f, +1.480685972e-01f, +1.676792097e-01f, +1.663127619e-01f, +1.443675516e-01f, +1.080973515e-01f, +6.714169632e-02f, +3.092465153e-02f, +5.563867546e-03f, -7.459824124e-03f, -1.059658974e-02f, -8.193707637e-03f, -4.316962918e-03f, -1.407794310e-03f, -1.074828157e-04f, - /* 24, 8 */ -1.479778772e-04f, -1.541551365e-03f, -4.546450360e-03f, -8.422671559e-03f, -1.061051465e-02f, -6.975365011e-03f, +6.779788805e-03f, +3.291090392e-02f, +6.964876056e-02f, +1.106081178e-01f, +1.462476880e-01f, +1.670376092e-01f, +1.670376092e-01f, +1.462476880e-01f, +1.106081178e-01f, +6.964876056e-02f, +3.291090392e-02f, +6.779788805e-03f, -6.975365011e-03f, -1.061051465e-02f, -8.422671559e-03f, -4.546450360e-03f, -1.541551365e-03f, -1.479778772e-04f, - /* 24, 9 */ -1.074828157e-04f, -1.407794310e-03f, -4.316962918e-03f, -8.193707637e-03f, -1.059658974e-02f, -7.459824124e-03f, +5.563867546e-03f, +3.092465153e-02f, +6.714169632e-02f, +1.080973515e-01f, +1.443675516e-01f, +1.663127619e-01f, +1.676792097e-01f, +1.480685972e-01f, +1.130981205e-01f, +7.217341954e-02f, +3.494018190e-02f, +8.045422842e-03f, -6.450704795e-03f, -1.060178532e-02f, -8.645606504e-03f, -4.779971710e-03f, -1.681997919e-03f, -1.930992056e-04f, - /* 24,10 */ -7.141440876e-05f, -1.280697546e-03f, -4.091877352e-03f, -7.959568583e-03f, -1.056115807e-02f, -7.905042791e-03f, +4.397473555e-03f, +2.898240538e-02f, +6.465429798e-02f, +1.055683777e-01f, +1.424303080e-01f, +1.655055219e-01f, +1.682368061e-01f, +1.498282170e-01f, +1.155648023e-01f, +7.471354913e-02f, +3.701142868e-02f, +9.360889972e-03f, -5.884914422e-03f, -1.056924947e-02f, -8.861631306e-03f, -5.017128860e-03f, -1.829144469e-03f, -2.430425717e-04f, - /* 24,11 */ -3.957001380e-05f, -1.160214103e-03f, -3.871531888e-03f, -7.721080180e-03f, -1.050536039e-02f, -8.312010872e-03f, +3.280357753e-03f, +2.708506973e-02f, +6.218858132e-02f, +1.030237476e-01f, +1.404381320e-01f, +1.646168392e-01f, +1.687097397e-01f, +1.515245471e-01f, +1.180056089e-01f, +7.726697481e-02f, +3.912351177e-02f, +1.072624378e-02f, -5.277098842e-03f, -1.051175200e-02f, -9.069838305e-03f, -5.257493218e-03f, -1.982981877e-03f, -2.979990698e-04f, - /* 24,12 */ -1.174474466e-05f, -1.046280200e-03f, -3.656235461e-03f, -7.479039479e-03f, -1.043032883e-02f, -8.681745020e-03f, +2.212209196e-03f, +2.523347234e-02f, +5.974650439e-02f, +1.004660042e-01f, +1.383932498e-01f, +1.636477581e-01f, +1.690974512e-01f, +1.531556516e-01f, +1.204179923e-01f, +7.983147433e-02f, +4.127522351e-02f, +1.214146970e-02f, -4.626399385e-03f, -1.042813706e-02f, -9.269294257e-03f, -5.500605429e-03f, -2.143480447e-03f, -3.581542611e-04f, - /* 24,13 */ +1.226776811e-05f, -9.388162067e-04f, -3.446268223e-03f, -7.234214214e-03f, -1.033718507e-02f, -9.015286272e-03f, +1.192656872e-03f, +2.342836441e-02f, +5.732996534e-02f, +9.789767810e-02f, +1.362979353e-01f, +1.625994153e-01f, +1.693994819e-01f, +1.547196623e-01f, +1.227994149e-01f, +8.240478048e-02f, +4.346528177e-02f, +1.360648366e-02f, -3.931996122e-03f, -1.031725016e-02f, -9.459041324e-03f, -5.745975157e-03f, -2.310589033e-03f, -4.236872966e-04f, - /* 24,14 */ +3.267464436e-05f, -8.377276082e-04f, -3.241882098e-03f, -6.987342300e-03f, -1.022703863e-02f, -9.313697641e-03f, +2.212715669e-04f, +2.167042077e-02f, +5.494080034e-02f, +9.532128436e-02f, +1.341545065e-01f, +1.614730379e-01f, +1.696154741e-01f, +1.562147818e-01f, +1.251473534e-01f, +8.498458400e-02f, +4.569233080e-02f, +1.512113085e-02f, -3.193110201e-03f, -1.017794029e-02f, -9.638098137e-03f, -5.993080931e-03f, -2.484234158e-03f, -4.947700224e-04f, - /* 24,15 */ +4.968305000e-05f, -7.429059724e-04f, -3.043301383e-03f, -6.739131402e-03f, -1.010098516e-02f, -9.578061730e-03f, -7.024321916e-04f, +1.996024013e-02f, +5.258078166e-02f, +9.273931864e-02f, +1.319653222e-01f, +1.602699418e-01f, +1.697451719e-01f, +1.576392865e-01f, +1.274593023e-01f, +8.756853655e-02f, +4.795494216e-02f, +1.668518463e-02f, -2.409006146e-03f, -1.000906214e-02f, -9.805460951e-03f, -6.241370053e-03f, -2.664319167e-03f, -5.715660670e-04f, - /* 24, 0 */ +1.619229527e-03f, +2.585184252e-03f, +7.650378125e-04f, -6.171975840e-03f, -1.695416291e-02f, -2.423274385e-02f, -1.612533623e-02f, +1.737483974e-02f, +7.628093610e-02f, +1.465254238e-01f, +2.041060488e-01f, +2.263845622e-01f, +2.041060488e-01f, +1.465254238e-01f, +7.628093610e-02f, +1.737483974e-02f, -1.612533623e-02f, -2.423274385e-02f, -1.695416291e-02f, -6.171975840e-03f, +7.650378125e-04f, +2.585184252e-03f, +1.619229527e-03f, +4.203426526e-04f, - /* 24, 1 */ +1.531668339e-03f, +2.575087939e-03f, +1.015030141e-03f, -5.584253498e-03f, -1.627529113e-02f, -2.409742304e-02f, -1.730694612e-02f, +1.446720847e-02f, +7.205349539e-02f, +1.422361210e-01f, +2.013530187e-01f, +2.262942875e-01f, +2.067165090e-01f, +1.507648574e-01f, +8.055624103e-02f, +2.038667606e-02f, -1.484111026e-02f, -2.430745079e-02f, -1.762106127e-02f, -6.776879595e-03f, +4.938567092e-04f, +2.584413048e-03f, +1.706479068e-03f, +4.743886054e-04f, - /* 24, 2 */ +1.444251783e-03f, +2.554897668e-03f, +1.244217996e-03f, -5.014646771e-03f, -1.558700841e-02f, -2.390468713e-02f, -1.838770218e-02f, +1.166535016e-02f, +6.787901036e-02f, +1.379034790e-01f, +1.984620386e-01f, +2.260236194e-01f, +2.091800031e-01f, +1.549479100e-01f, +8.487414623e-02f, +2.350091114e-02f, -1.345266938e-02f, -2.431836796e-02f, -1.827334019e-02f, -7.397926552e-03f, +2.011593926e-04f, +2.571998910e-03f, +1.792931314e-03f, +5.318997770e-04f, - /* 24, 3 */ +1.357406375e-03f, +2.525382259e-03f, +1.453038602e-03f, -4.463987325e-03f, -1.489178967e-02f, -2.365774922e-02f, -1.936952211e-02f, +8.970595311e-03f, +6.376239146e-02f, +1.335340325e-01f, +1.954379419e-01f, +2.255730254e-01f, +2.114923689e-01f, +1.590681020e-01f, +8.922922426e-02f, +2.671549986e-02f, -1.195858585e-02f, -2.426235104e-02f, -1.890827435e-02f, -8.033973302e-03f, -1.133208208e-04f, +2.547167581e-03f, +1.878071789e-03f, +5.928148062e-04f, - /* 24, 4 */ +1.271528621e-03f, +2.487303056e-03f, +1.641978155e-03f, -3.933006021e-03f, -1.419201875e-02f, -2.335982837e-02f, -2.025447087e-02f, +6.384038515e-03f, +5.970836021e-02f, +1.291343068e-01f, +1.922857641e-01f, +2.249432832e-01f, +2.136496877e-01f, +1.631190001e-01f, +9.361589375e-02f, +3.002815853e-02f, -1.035761042e-02f, -2.413629608e-02f, -1.952306378e-02f, -8.683770335e-03f, -4.497860188e-04f, +2.509149105e-03f, +1.961357874e-03f, +6.570484107e-04f, - /* 24, 5 */ +1.186984902e-03f, +2.441411339e-03f, +1.811567846e-03f, -3.422334900e-03f, -1.348998519e-02f, -2.301414142e-02f, -2.104475231e-02f, +3.906540614e-03f, +5.572144173e-02f, +1.247108046e-01f, +1.890107314e-01f, +2.241354793e-01f, +2.156482934e-01f, +1.670942309e-01f, +9.802842938e-02f, +3.343636564e-02f, -8.648679404e-03f, -2.393714847e-02f, -2.011483893e-02f, -9.345961431e-03f, -8.083699235e-04f, +2.457181100e-03f, +2.042219659e-03f, +7.244903794e-04f, - /* 24, 6 */ +1.104111497e-03f, +2.388445882e-03f, +1.962379900e-03f, -2.932509404e-03f, -1.278788140e-02f, -2.262389503e-02f, -2.174270056e-02f, +1.538731332e-03f, +5.180595798e-02f, +1.202699924e-01f, +1.856182490e-01f, +2.231510062e-01f, +2.174847808e-01f, +1.709874949e-01f, +1.024609723e-01f, +3.693736330e-02f, -6.830921421e-03f, -2.366191192e-02f, -2.068066597e-02f, -1.001908338e-02f, -1.189134206e-03f, +2.390512141e-03f, +2.120060933e-03f, +7.950046334e-04f, - /* 24, 7 */ +1.023214729e-03f, +2.329130668e-03f, +2.095023622e-03f, -2.463970822e-03f, -1.208780014e-02f, -2.219227795e-02f, -2.235077131e-02f, -7.189875350e-04f, +4.796602143e-02f, +1.158182872e-01f, +1.821138888e-01f, +2.219915591e-01f, +2.191560137e-01f, +1.747925803e-01f, +1.069075413e-01f, +4.052815924e-02f, -4.903663772e-03f, -2.330765754e-02f, -2.121755248e-02f, -1.070156599e-02f, -1.592064902e-03f, +2.308405249e-03f, +2.194260355e-03f, +8.684283615e-04f, - /* 24, 8 */ +9.445712380e-04f, +2.264172764e-03f, +2.210141486e-03f, -2.017068943e-03f, -1.139173248e-02f, -2.172245353e-02f, -2.287153293e-02f, -2.866438416e-03f, +4.420552946e-02f, +1.113620436e-01f, +1.785033768e-01f, +2.206591322e-01f, +2.206591322e-01f, +1.785033768e-01f, +1.113620436e-01f, +4.420552946e-02f, -2.866438416e-03f, -2.287153293e-02f, -2.172245353e-02f, -1.139173248e-02f, -2.017068943e-03f, +2.210141486e-03f, +2.264172764e-03f, +9.445712380e-04f, - /* 24, 9 */ +8.684283615e-04f, +2.194260355e-03f, +2.308405249e-03f, -1.592064902e-03f, -1.070156599e-02f, -2.121755248e-02f, -2.330765754e-02f, -4.903663772e-03f, +4.052815924e-02f, +1.069075413e-01f, +1.747925803e-01f, +2.191560137e-01f, +2.219915591e-01f, +1.821138888e-01f, +1.158182872e-01f, +4.796602143e-02f, -7.189875350e-04f, -2.235077131e-02f, -2.219227795e-02f, -1.208780014e-02f, -2.463970822e-03f, +2.095023622e-03f, +2.329130668e-03f, +1.023214729e-03f, - /* 24,10 */ +7.950046334e-04f, +2.120060933e-03f, +2.390512141e-03f, -1.189134206e-03f, -1.001908338e-02f, -2.068066597e-02f, -2.366191192e-02f, -6.830921421e-03f, +3.693736330e-02f, +1.024609723e-01f, +1.709874949e-01f, +2.174847808e-01f, +2.231510062e-01f, +1.856182490e-01f, +1.202699924e-01f, +5.180595798e-02f, +1.538731332e-03f, -2.174270056e-02f, -2.262389503e-02f, -1.278788140e-02f, -2.932509404e-03f, +1.962379900e-03f, +2.388445882e-03f, +1.104111497e-03f, - /* 24,11 */ +7.244903794e-04f, +2.042219659e-03f, +2.457181100e-03f, -8.083699235e-04f, -9.345961431e-03f, -2.011483893e-02f, -2.393714847e-02f, -8.648679404e-03f, +3.343636564e-02f, +9.802842938e-02f, +1.670942309e-01f, +2.156482934e-01f, +2.241354793e-01f, +1.890107314e-01f, +1.247108046e-01f, +5.572144173e-02f, +3.906540614e-03f, -2.104475231e-02f, -2.301414142e-02f, -1.348998519e-02f, -3.422334900e-03f, +1.811567846e-03f, +2.441411339e-03f, +1.186984902e-03f, - /* 24,12 */ +6.570484107e-04f, +1.961357874e-03f, +2.509149105e-03f, -4.497860188e-04f, -8.683770335e-03f, -1.952306378e-02f, -2.413629608e-02f, -1.035761042e-02f, +3.002815853e-02f, +9.361589375e-02f, +1.631190001e-01f, +2.136496877e-01f, +2.249432832e-01f, +1.922857641e-01f, +1.291343068e-01f, +5.970836021e-02f, +6.384038515e-03f, -2.025447087e-02f, -2.335982837e-02f, -1.419201875e-02f, -3.933006021e-03f, +1.641978155e-03f, +2.487303056e-03f, +1.271528621e-03f, - /* 24,13 */ +5.928148062e-04f, +1.878071789e-03f, +2.547167581e-03f, -1.133208208e-04f, -8.033973302e-03f, -1.890827435e-02f, -2.426235104e-02f, -1.195858585e-02f, +2.671549986e-02f, +8.922922426e-02f, +1.590681020e-01f, +2.114923689e-01f, +2.255730254e-01f, +1.954379419e-01f, +1.335340325e-01f, +6.376239146e-02f, +8.970595311e-03f, -1.936952211e-02f, -2.365774922e-02f, -1.489178967e-02f, -4.463987325e-03f, +1.453038602e-03f, +2.525382259e-03f, +1.357406375e-03f, - /* 24,14 */ +5.318997770e-04f, +1.792931314e-03f, +2.571998910e-03f, +2.011593926e-04f, -7.397926552e-03f, -1.827334019e-02f, -2.431836796e-02f, -1.345266938e-02f, +2.350091114e-02f, +8.487414623e-02f, +1.549479100e-01f, +2.091800031e-01f, +2.260236194e-01f, +1.984620386e-01f, +1.379034790e-01f, +6.787901036e-02f, +1.166535016e-02f, -1.838770218e-02f, -2.390468713e-02f, -1.558700841e-02f, -5.014646771e-03f, +1.244217996e-03f, +2.554897668e-03f, +1.444251783e-03f, - /* 24,15 */ +4.743886054e-04f, +1.706479068e-03f, +2.584413048e-03f, +4.938567092e-04f, -6.776879595e-03f, -1.762106127e-02f, -2.430745079e-02f, -1.484111026e-02f, +2.038667606e-02f, +8.055624103e-02f, +1.507648574e-01f, +2.067165090e-01f, +2.262942875e-01f, +2.013530187e-01f, +1.422361210e-01f, +7.205349539e-02f, +1.446720847e-02f, -1.730694612e-02f, -2.409742304e-02f, -1.627529113e-02f, -5.584253498e-03f, +1.015030141e-03f, +2.575087939e-03f, +1.531668339e-03f, - /* 24, 0 */ -5.620806651e-04f, +1.786951327e-03f, +6.445247430e-03f, +8.135220753e-03f, -1.055728075e-03f, -2.182587186e-02f, -3.862210468e-02f, -2.392616717e-02f, +4.121375257e-02f, +1.449837419e-01f, +2.427850309e-01f, +2.829807027e-01f, +2.427850309e-01f, +1.449837419e-01f, +4.121375257e-02f, -2.392616717e-02f, -3.862210468e-02f, -2.182587186e-02f, -1.055728075e-03f, +8.135220753e-03f, +6.445247430e-03f, +1.786951327e-03f, -5.620806651e-04f, -5.120724112e-04f, - /* 24, 1 */ -6.104492932e-04f, +1.548760636e-03f, +6.159105160e-03f, +8.277197332e-03f, -7.779733613e-05f, -2.039475337e-02f, -3.819819741e-02f, -2.624621678e-02f, +3.569722776e-02f, +1.380982730e-01f, +2.379020609e-01f, +2.828154582e-01f, +2.474326717e-01f, +1.518487179e-01f, +4.689321837e-02f, -2.139810919e-02f, -3.892035913e-02f, -2.324619800e-02f, -2.084809535e-03f, +7.948411519e-03f, +6.721048149e-03f, +2.036121529e-03f, -5.037148469e-04f, -5.469834647e-04f, - /* 24, 2 */ -6.493280747e-04f, +1.322056610e-03f, +5.864617557e-03f, +8.376206823e-03f, +8.476165560e-04f, -1.895882060e-02f, -3.765599422e-02f, -2.836041007e-02f, +3.035103267e-02f, +1.312062799e-01f, +2.327950895e-01f, +2.823201223e-01f, +2.518341522e-01f, +1.586790922e-01f, +5.272765217e-02f, -1.866041870e-02f, -3.908572584e-02f, -2.464952038e-02f, -3.163389088e-03f, +7.715013258e-03f, +6.984447000e-03f, +2.295668536e-03f, -4.348733531e-04f, -5.801620624e-04f, - /* 24, 3 */ -6.792484933e-04f, +1.107253309e-03f, +5.563710253e-03f, +8.434210700e-03f, +1.719427448e-03f, -1.752380524e-02f, -3.700294628e-02f, -3.027140813e-02f, +2.518195985e-02f, +1.243215533e-01f, +2.274759065e-01f, +2.814958870e-01f, +2.559791715e-01f, +1.654606562e-01f, +5.870851072e-02f, -1.571201688e-02f, -3.911111998e-02f, -2.602940857e-02f, -4.289522020e-03f, +7.433392157e-03f, +7.233326681e-03f, +2.564892035e-03f, -3.551113499e-04f, -6.111213026e-04f, - /* 24, 4 */ -7.007615573e-04f, +9.046745282e-04f, +5.258232435e-03f, +8.453253159e-03f, +2.536821717e-03f, -1.609518093e-02f, -3.624657153e-02f, -3.198236083e-02f, +2.019619593e-02f, +1.174576676e-01f, +2.219567270e-01f, +2.803447347e-01f, +2.598579915e-01f, +1.721791413e-01f, +6.482669661e-02f, -1.255238605e-02f, -3.898963496e-02f, -2.737922870e-02f, -5.460966964e-03f, +7.102050305e-03f, +7.465520628e-03f, +2.842992490e-03f, -2.640225027e-04f, -6.393525967e-04f, - /* 24, 5 */ -7.144333056e-04f, +7.145569834e-04f, +4.949951622e-03f, +8.435448103e-03f, +3.299249997e-03f, -1.467815287e-02f, -3.539442781e-02f, -3.349688539e-02f, +1.539931407e-02f, +1.106279448e-01f, +2.162501543e-01f, +2.788694321e-01f, +2.634614666e-01f, +1.788202595e-01f, +7.107257652e-02f, -9.181583996e-03f, -3.871457066e-02f, -2.869216031e-02f, -6.675182397e-03f, +6.719638981e-03f, +7.678821339e-03f, +3.129069982e-03f, -1.612438490e-04f, -6.643278432e-04f, - /* 24, 6 */ -7.208404573e-04f, +5.370537968e-04f, +4.640549073e-03f, +8.382966356e-03f, +4.006418111e-03f, -1.327764882e-02f, -3.445408633e-02f, -3.481904366e-02f, +1.079626845e-02f, +1.038454185e-01f, +2.103691410e-01f, +2.770735210e-01f, +2.667810728e-01f, +1.853697450e-01f, +7.743600141e-02f, -5.600256400e-03f, -3.827946167e-02f, -2.996121443e-02f, -7.929324241e-03f, +6.284971816e-03f, +7.870989279e-03f, +3.422123547e-03f, -4.646067064e-05f, -6.855018549e-04f, - /* 24, 7 */ -7.205662235e-04f, +3.722382714e-04f, +4.331615834e-03f, +8.298023138e-03f, +4.658277300e-03f, -1.189831143e-02f, -3.343310598e-02f, -3.595331849e-02f, +6.391391026e-03f, +9.712280024e-02f, +2.043269499e-01f, +2.749613076e-01f, +2.698089343e-01f, +1.918133956e-01f, +8.390632879e-02f, -1.809647645e-03f, -3.767810524e-02f, -3.117925279e-02f, -9.220244622e-03f, +5.797037759e-03f, +8.039762345e-03f, +3.721051017e-03f, +8.058866307e-05f, -7.023150347e-04f, - /* 24, 8 */ -7.141962964e-04f, +2.201079121e-04f, +4.024649403e-03f, +8.182865872e-03f, +5.255013788e-03f, -1.054449181e-02f, -3.233900821e-02f, -3.690458903e-02f, +2.188390323e-03f, +9.047244679e-02f, +1.981371140e-01f, +2.725378483e-01f, +2.725378483e-01f, +1.981371140e-01f, +9.047244679e-02f, +2.188390323e-03f, -3.690458903e-02f, -3.233900821e-02f, -1.054449181e-02f, +5.255013788e-03f, +8.182865872e-03f, +4.024649403e-03f, +2.201079121e-04f, -7.141962964e-04f, - /* 24, 9 */ -7.023150347e-04f, +8.058866307e-05f, +3.721051017e-03f, +8.039762345e-03f, +5.797037759e-03f, -9.220244622e-03f, -3.117925279e-02f, -3.767810524e-02f, -1.809647645e-03f, +8.390632879e-02f, +1.918133956e-01f, +2.698089343e-01f, +2.749613076e-01f, +2.043269499e-01f, +9.712280024e-02f, +6.391391026e-03f, -3.595331849e-02f, -3.343310598e-02f, -1.189831143e-02f, +4.658277300e-03f, +8.298023138e-03f, +4.331615834e-03f, +3.722382714e-04f, -7.205662235e-04f, - /* 24,10 */ -6.855018549e-04f, -4.646067064e-05f, +3.422123547e-03f, +7.870989279e-03f, +6.284971816e-03f, -7.929324241e-03f, -2.996121443e-02f, -3.827946167e-02f, -5.600256400e-03f, +7.743600141e-02f, +1.853697450e-01f, +2.667810728e-01f, +2.770735210e-01f, +2.103691410e-01f, +1.038454185e-01f, +1.079626845e-02f, -3.481904366e-02f, -3.445408633e-02f, -1.327764882e-02f, +4.006418111e-03f, +8.382966356e-03f, +4.640549073e-03f, +5.370537968e-04f, -7.208404573e-04f, - /* 24,11 */ -6.643278432e-04f, -1.612438490e-04f, +3.129069982e-03f, +7.678821339e-03f, +6.719638981e-03f, -6.675182397e-03f, -2.869216031e-02f, -3.871457066e-02f, -9.181583996e-03f, +7.107257652e-02f, +1.788202595e-01f, +2.634614666e-01f, +2.788694321e-01f, +2.162501543e-01f, +1.106279448e-01f, +1.539931407e-02f, -3.349688539e-02f, -3.539442781e-02f, -1.467815287e-02f, +3.299249997e-03f, +8.435448103e-03f, +4.949951622e-03f, +7.145569834e-04f, -7.144333056e-04f, - /* 24,12 */ -6.393525967e-04f, -2.640225027e-04f, +2.842992490e-03f, +7.465520628e-03f, +7.102050305e-03f, -5.460966964e-03f, -2.737922870e-02f, -3.898963496e-02f, -1.255238605e-02f, +6.482669661e-02f, +1.721791413e-01f, +2.598579915e-01f, +2.803447347e-01f, +2.219567270e-01f, +1.174576676e-01f, +2.019619593e-02f, -3.198236083e-02f, -3.624657153e-02f, -1.609518093e-02f, +2.536821717e-03f, +8.453253159e-03f, +5.258232435e-03f, +9.046745282e-04f, -7.007615573e-04f, - /* 24,13 */ -6.111213026e-04f, -3.551113499e-04f, +2.564892035e-03f, +7.233326681e-03f, +7.433392157e-03f, -4.289522020e-03f, -2.602940857e-02f, -3.911111998e-02f, -1.571201688e-02f, +5.870851072e-02f, +1.654606562e-01f, +2.559791715e-01f, +2.814958870e-01f, +2.274759065e-01f, +1.243215533e-01f, +2.518195985e-02f, -3.027140813e-02f, -3.700294628e-02f, -1.752380524e-02f, +1.719427448e-03f, +8.434210700e-03f, +5.563710253e-03f, +1.107253309e-03f, -6.792484933e-04f, - /* 24,14 */ -5.801620624e-04f, -4.348733531e-04f, +2.295668536e-03f, +6.984447000e-03f, +7.715013258e-03f, -3.163389088e-03f, -2.464952038e-02f, -3.908572584e-02f, -1.866041870e-02f, +5.272765217e-02f, +1.586790922e-01f, +2.518341522e-01f, +2.823201223e-01f, +2.327950895e-01f, +1.312062799e-01f, +3.035103267e-02f, -2.836041007e-02f, -3.765599422e-02f, -1.895882060e-02f, +8.476165560e-04f, +8.376206823e-03f, +5.864617557e-03f, +1.322056610e-03f, -6.493280747e-04f, - /* 24,15 */ -5.469834647e-04f, -5.037148469e-04f, +2.036121529e-03f, +6.721048149e-03f, +7.948411519e-03f, -2.084809535e-03f, -2.324619800e-02f, -3.892035913e-02f, -2.139810919e-02f, +4.689321837e-02f, +1.518487179e-01f, +2.474326717e-01f, +2.828154582e-01f, +2.379020609e-01f, +1.380982730e-01f, +3.569722776e-02f, -2.624621678e-02f, -3.819819741e-02f, -2.039475337e-02f, -7.779733613e-05f, +8.277197332e-03f, +6.159105160e-03f, +1.548760636e-03f, -6.104492932e-04f, - /* 24, 0 */ -1.197013499e-03f, -3.320493122e-03f, -1.144245270e-03f, +8.577337679e-03f, +1.627759141e-02f, +3.152522439e-03f, -3.255249254e-02f, -5.362651723e-02f, -5.304244056e-03f, +1.253006387e-01f, +2.738089134e-01f, +3.395768433e-01f, +2.738089134e-01f, +1.253006387e-01f, -5.304244056e-03f, -5.362651723e-02f, -3.255249254e-02f, +3.152522439e-03f, +1.627759141e-02f, +8.577337679e-03f, -1.144245270e-03f, -3.320493122e-03f, -1.197013499e-03f, +1.261205705e-04f, - /* 24, 1 */ -1.060573898e-03f, -3.246029352e-03f, -1.514205592e-03f, +7.849505167e-03f, +1.622707505e-02f, +4.797556391e-03f, -3.017446993e-02f, -5.385088872e-02f, -1.098434059e-02f, +1.155960124e-01f, +2.659858985e-01f, +3.393017042e-01f, +2.812897341e-01f, +1.350895441e-01f, +7.263382766e-04f, -5.311639759e-02f, -3.488122370e-02f, +1.404407443e-03f, +1.624118609e-02f, +9.301572693e-03f, -7.399572733e-04f, -3.377916464e-03f, -1.338504197e-03f, +9.901282259e-05f, - /* 24, 2 */ -9.298712414e-04f, -3.156277727e-03f, -1.849729696e-03f, +7.122444811e-03f, +1.609438844e-02f, +6.335978542e-03f, -2.776122262e-02f, -5.380213751e-02f, -1.630850202e-02f, +1.060004951e-01f, +2.578448120e-01f, +3.384771755e-01f, +2.884051592e-01f, +1.449371908e-01f, +7.100538384e-03f, -5.230860749e-02f, -3.714619841e-02f, -4.425295608e-04f, +1.611336946e-02f, +1.001762126e-02f, -3.016869975e-04f, -3.416553196e-03f, -1.484263468e-03f, +6.526428163e-05f, - /* 24, 3 */ -8.054954021e-04f, -3.052984548e-03f, -2.150934111e-03f, +6.400291527e-03f, +1.588450664e-02f, +7.764974256e-03f, -2.532636892e-02f, -5.349351937e-02f, -2.127269005e-02f, +9.653812261e-02f, +2.494105998e-01f, +3.371059190e-01f, +2.951330020e-01f, +1.548174220e-01f, +1.381006797e-02f, -5.119199897e-02f, -3.933260713e-02f, -2.383292518e-03f, +1.588995194e-02f, +1.072069264e-02f, +1.699725421e-04f, -3.434676821e-03f, -1.633412152e-03f, +2.453170435e-05f, - /* 24, 4 */ -6.879416803e-04f, -2.937877889e-03f, -2.418147761e-03f, +5.686932142e-03f, +1.560259046e-02f, +9.082429619e-03f, -2.288303213e-02f, -5.293884648e-02f, -2.587426360e-02f, +8.723205545e-02f, +2.407089312e-01f, +3.351923590e-01f, +3.014521813e-01f, +1.647035561e-01f, +2.084522321e-02f, -4.975626781e-02f, -4.142535273e-02f, -4.412143180e-03f, +1.556708209e-02f, +1.140581394e-02f, +6.741710759e-04f, -3.430594409e-03f, -1.784975276e-03f, -2.348660763e-05f, - /* 24, 5 */ -5.776128643e-04f, -2.812656385e-03f, -2.651898517e-03f, +4.985994150e-03f, +1.525394912e-02f, +1.028691298e-02f, -2.044379769e-02f, -5.215241275e-02f, -3.011195925e-02f, +7.810450253e-02f, +2.317660961e-01f, +3.327426635e-01f, +3.073428069e-01f, +1.745684830e-01f, +2.819489579e-02f, -4.799202051e-02f, -4.340911052e-02f, -6.522599631e-03f, +1.514128438e-02f, +1.206785167e-02f, +1.209792693e-03f, -3.402660968e-03f, -1.937883690e-03f, -7.904503123e-05f, - /* 24, 6 */ -4.748218959e-04f, -2.678978820e-03f, -2.852899102e-03f, +4.300836533e-03f, +1.484400357e-02f, +1.137765361e-02f, -1.802067434e-02f, -5.114891871e-02f, -3.398586582e-02f, +6.917664952e-02f, +2.226089010e-01f, +3.297647184e-01f, +3.127862620e-01f, +1.843847637e-01f, +3.584659036e-02f, -4.589083871e-02f, -4.526839113e-02f, -8.707438641e-03f, +1.460949637e-02f, +1.270153536e-02f, +1.775448814e-03f, -3.349294247e-03f, -2.090976552e-03f, -1.423449116e-04f, - /* 24, 7 */ -3.797950945e-04f, -2.538454547e-03f, -3.022032460e-03f, +3.634542645e-03f, +1.437825069e-02f, +1.235451773e-02f, -1.562505912e-02f, -4.994339647e-02f, -3.749739364e-02f, +6.046859273e-02f, +2.132645624e-01f, +3.262680950e-01f, +3.177652787e-01f, +1.941247325e-01f, +4.378644843e-02f, -4.344534054e-02f, -4.698760595e-02f, -1.095870195e-02f, +1.396910503e-02f, +1.330148306e-02f, +2.369472628e-03f, -3.268989872e-03f, -2.243004675e-03f, -2.135289700e-04f, - /* 24, 8 */ -2.926758839e-04f, -2.392634763e-03f, -3.160336722e-03f, +2.989915102e-03f, +1.386222860e-02f, +1.321798203e-02f, -1.326770657e-02f, -4.855113496e-02f, -4.064923848e-02f, +5.199927852e-02f, +2.037606007e-01f, +3.222640100e-01f, +3.222640100e-01f, +2.037606007e-01f, +5.199927852e-02f, -4.064923848e-02f, -4.855113496e-02f, -1.326770657e-02f, +1.321798203e-02f, +1.386222860e-02f, +2.989915102e-03f, -3.160336722e-03f, -2.392634763e-03f, -2.926758839e-04f, - /* 24, 9 */ -2.135289700e-04f, -2.243004675e-03f, -3.268989872e-03f, +2.369472628e-03f, +1.330148306e-02f, +1.396910503e-02f, -1.095870195e-02f, -4.698760595e-02f, -4.344534054e-02f, +4.378644843e-02f, +1.941247325e-01f, +3.177652787e-01f, +3.262680950e-01f, +2.132645624e-01f, +6.046859273e-02f, -3.749739364e-02f, -4.994339647e-02f, -1.562505912e-02f, +1.235451773e-02f, +1.437825069e-02f, +3.634542645e-03f, -3.022032460e-03f, -2.538454547e-03f, -3.797950945e-04f, - /* 24,10 */ -1.423449116e-04f, -2.090976552e-03f, -3.349294247e-03f, +1.775448814e-03f, +1.270153536e-02f, +1.460949637e-02f, -8.707438641e-03f, -4.526839113e-02f, -4.589083871e-02f, +3.584659036e-02f, +1.843847637e-01f, +3.127862620e-01f, +3.297647184e-01f, +2.226089010e-01f, +6.917664952e-02f, -3.398586582e-02f, -5.114891871e-02f, -1.802067434e-02f, +1.137765361e-02f, +1.484400357e-02f, +4.300836533e-03f, -2.852899102e-03f, -2.678978820e-03f, -4.748218959e-04f, - /* 24,11 */ -7.904503123e-05f, -1.937883690e-03f, -3.402660968e-03f, +1.209792693e-03f, +1.206785167e-02f, +1.514128438e-02f, -6.522599631e-03f, -4.340911052e-02f, -4.799202051e-02f, +2.819489579e-02f, +1.745684830e-01f, +3.073428069e-01f, +3.327426635e-01f, +2.317660961e-01f, +7.810450253e-02f, -3.011195925e-02f, -5.215241275e-02f, -2.044379769e-02f, +1.028691298e-02f, +1.525394912e-02f, +4.985994150e-03f, -2.651898517e-03f, -2.812656385e-03f, -5.776128643e-04f, - /* 24,12 */ -2.348660763e-05f, -1.784975276e-03f, -3.430594409e-03f, +6.741710759e-04f, +1.140581394e-02f, +1.556708209e-02f, -4.412143180e-03f, -4.142535273e-02f, -4.975626781e-02f, +2.084522321e-02f, +1.647035561e-01f, +3.014521813e-01f, +3.351923590e-01f, +2.407089312e-01f, +8.723205545e-02f, -2.587426360e-02f, -5.293884648e-02f, -2.288303213e-02f, +9.082429619e-03f, +1.560259046e-02f, +5.686932142e-03f, -2.418147761e-03f, -2.937877889e-03f, -6.879416803e-04f, - /* 24,13 */ +2.453170435e-05f, -1.633412152e-03f, -3.434676821e-03f, +1.699725421e-04f, +1.072069264e-02f, +1.588995194e-02f, -2.383292518e-03f, -3.933260713e-02f, -5.119199897e-02f, +1.381006797e-02f, +1.548174220e-01f, +2.951330020e-01f, +3.371059190e-01f, +2.494105998e-01f, +9.653812261e-02f, -2.127269005e-02f, -5.349351937e-02f, -2.532636892e-02f, +7.764974256e-03f, +1.588450664e-02f, +6.400291527e-03f, -2.150934111e-03f, -3.052984548e-03f, -8.054954021e-04f, - /* 24,14 */ +6.526428163e-05f, -1.484263468e-03f, -3.416553196e-03f, -3.016869975e-04f, +1.001762126e-02f, +1.611336946e-02f, -4.425295608e-04f, -3.714619841e-02f, -5.230860749e-02f, +7.100538384e-03f, +1.449371908e-01f, +2.884051592e-01f, +3.384771755e-01f, +2.578448120e-01f, +1.060004951e-01f, -1.630850202e-02f, -5.380213751e-02f, -2.776122262e-02f, +6.335978542e-03f, +1.609438844e-02f, +7.122444811e-03f, -1.849729696e-03f, -3.156277727e-03f, -9.298712414e-04f, - /* 24,15 */ +9.901282259e-05f, -1.338504197e-03f, -3.377916464e-03f, -7.399572733e-04f, +9.301572693e-03f, +1.624118609e-02f, +1.404407443e-03f, -3.488122370e-02f, -5.311639759e-02f, +7.263382766e-04f, +1.350895441e-01f, +2.812897341e-01f, +3.393017042e-01f, +2.659858985e-01f, +1.155960124e-01f, -1.098434059e-02f, -5.385088872e-02f, -3.017446993e-02f, +4.797556391e-03f, +1.622707505e-02f, +7.849505167e-03f, -1.514205592e-03f, -3.246029352e-03f, -1.060573898e-03f, - /* 20, 0 */ -4.161478318e-03f, -1.410215661e-03f, +1.216462436e-02f, +1.839753508e-02f, -1.019572218e-02f, -5.576407638e-02f, -3.857794503e-02f, +9.869941459e-02f, +2.903842315e-01f, +3.819037908e-01f, +2.903842315e-01f, +9.869941459e-02f, -3.857794503e-02f, -5.576407638e-02f, -1.019572218e-02f, +1.839753508e-02f, +1.216462436e-02f, -1.410215661e-03f, -4.161478318e-03f, -1.002136091e-03f, - /* 20, 1 */ -4.024812873e-03f, -1.935046598e-03f, +1.120868183e-02f, +1.884704309e-02f, -7.349314558e-03f, -5.377462232e-02f, -4.306909662e-02f, +8.713841011e-02f, +2.797272456e-01f, +3.815142140e-01f, +3.006231905e-01f, +1.105090175e-01f, -3.357053763e-02f, -5.750258783e-02f, -1.313424017e-02f, +1.779561475e-02f, +1.309754391e-02f, -8.338854378e-04f, -4.274968522e-03f, -1.184613130e-03f, - /* 20, 2 */ -3.867923854e-03f, -2.407896178e-03f, +1.023778220e-02f, +1.914947854e-02f, -4.608279480e-03f, -5.155911253e-02f, -4.704785126e-02f, +7.585987841e-02f, +2.686929243e-01f, +3.803470604e-01f, +3.104047352e-01f, +1.225315522e-01f, -2.804532708e-02f, -5.896552129e-02f, -1.615031726e-02f, +1.703673197e-02f, +1.399907244e-02f, -2.069933478e-04f, -4.362323551e-03f, -1.376799150e-03f, - /* 20, 3 */ -3.693729756e-03f, -2.828715617e-03f, +9.259646102e-03f, +1.931089692e-02f, -1.984565051e-03f, -4.914254142e-02f, -5.052030051e-02f, +6.489576800e-02f, +2.573230589e-01f, +3.784070525e-01f, +3.196909791e-01f, +1.347297046e-01f, -2.200314505e-02f, -6.012863981e-02f, -1.922814732e-02f, +1.611719780e-02f, +1.486058724e-02f, +4.690483654e-04f, -4.420601658e-03f, -1.577606548e-03f, - /* 20, 4 */ -3.505092707e-03f, -3.197865053e-03f, +8.281610454e-03f, +1.933799402e-02f, +5.112106557e-04f, -4.654987033e-02f, -5.349467921e-02f, +5.427598051e-02f, +2.456603330e-01f, +3.757020336e-01f, +3.284457292e-01f, +1.470646693e-01f, -1.544725782e-02f, -6.096825350e-02f, -2.235071271e-02f, +1.503425320e-02f, +1.567326271e-02f, +1.192336051e-03f, -4.446907145e-03f, -1.785766437e-03f, - /* 20, 5 */ -3.304797071e-03f, -3.516087186e-03f, +7.310594668e-03f, +1.923802927e-02f, +2.869766685e-03f, -4.380589142e-02f, -5.598126618e-02f, +4.402826232e-02f, +2.337481127e-01f, +3.722429273e-01f, +3.366346688e-01f, +1.594963158e-01f, -8.383409345e-03f, -6.146136934e-02f, -2.549983702e-02f, +1.378613431e-02f, +1.642812632e-02f, +1.960461229e-03f, -4.438419451e-03f, -1.999828319e-03f, - /* 20, 6 */ -3.095529963e-03f, -3.784479230e-03f, +6.353071566e-03f, +1.901874863e-02f, +5.083157654e-03f, -4.093509653e-02f, -5.799227582e-02f, +3.417810958e-02f, +2.216302330e-01f, +3.680436800e-01f, +3.442255330e-01f, +1.719833640e-01f, -8.198514564e-04f, -6.158584092e-02f, -2.865624686e-02f, +1.237213363e-02f, +1.711611824e-02f, +2.770500592e-03f, -4.392423280e-03f, -2.218161540e-03f, - /* 20, 7 */ -2.879863731e-03f, -4.004463491e-03f, +5.415043050e-03f, +1.868830751e-02f, +7.144763866e-03f, -3.796155187e-02f, -5.954174144e-02f, +2.474868675e-02f, +2.093507858e-01f, +3.631211887e-01f, +3.511882735e-01f, +1.844835679e-01f, +7.232639407e-03f, -6.132051750e-02f, -3.179964276e-02f, +1.079265669e-02f, +1.772815465e-02f, +3.619009684e-03f, -4.306339536e-03f, -2.438958613e-03f, - /* 20, 8 */ -2.660240473e-03f, -4.177756859e-03f, +4.502020476e-03f, +1.825519424e-02f, +9.049273418e-03f, -3.490877898e-02f, -6.064539119e-02f, +1.576075912e-02f, +1.969539074e-01f, +3.574952133e-01f, +3.574952133e-01f, +1.969539074e-01f, +1.576075912e-02f, -6.064539119e-02f, -3.490877898e-02f, +9.049273418e-03f, +1.825519424e-02f, +4.502020476e-03f, -4.177756859e-03f, -2.660240473e-03f, - /* 20, 9 */ -2.438958613e-03f, -4.306339536e-03f, +3.619009684e-03f, +1.772815465e-02f, +1.079265669e-02f, -3.179964276e-02f, -6.132051750e-02f, +7.232639407e-03f, +1.844835679e-01f, +3.511882735e-01f, +3.631211887e-01f, +2.093507858e-01f, +2.474868675e-02f, -5.954174144e-02f, -3.796155187e-02f, +7.144763866e-03f, +1.868830751e-02f, +5.415043050e-03f, -4.004463491e-03f, -2.879863731e-03f, - /* 20,10 */ -2.218161540e-03f, -4.392423280e-03f, +2.770500592e-03f, +1.711611824e-02f, +1.237213363e-02f, -2.865624686e-02f, -6.158584092e-02f, -8.198514564e-04f, +1.719833640e-01f, +3.442255330e-01f, +3.680436800e-01f, +2.216302330e-01f, +3.417810958e-02f, -5.799227582e-02f, -4.093509653e-02f, +5.083157654e-03f, +1.901874863e-02f, +6.353071566e-03f, -3.784479230e-03f, -3.095529963e-03f, - /* 20,11 */ -1.999828319e-03f, -4.438419451e-03f, +1.960461229e-03f, +1.642812632e-02f, +1.378613431e-02f, -2.549983702e-02f, -6.146136934e-02f, -8.383409345e-03f, +1.594963158e-01f, +3.366346688e-01f, +3.722429273e-01f, +2.337481127e-01f, +4.402826232e-02f, -5.598126618e-02f, -4.380589142e-02f, +2.869766685e-03f, +1.923802927e-02f, +7.310594668e-03f, -3.516087186e-03f, -3.304797071e-03f, - /* 20,12 */ -1.785766437e-03f, -4.446907145e-03f, +1.192336051e-03f, +1.567326271e-02f, +1.503425320e-02f, -2.235071271e-02f, -6.096825350e-02f, -1.544725782e-02f, +1.470646693e-01f, +3.284457292e-01f, +3.757020336e-01f, +2.456603330e-01f, +5.427598051e-02f, -5.349467921e-02f, -4.654987033e-02f, +5.112106557e-04f, +1.933799402e-02f, +8.281610454e-03f, -3.197865053e-03f, -3.505092707e-03f, - /* 20,13 */ -1.577606548e-03f, -4.420601658e-03f, +4.690483654e-04f, +1.486058724e-02f, +1.611719780e-02f, -1.922814732e-02f, -6.012863981e-02f, -2.200314505e-02f, +1.347297046e-01f, +3.196909791e-01f, +3.784070525e-01f, +2.573230589e-01f, +6.489576800e-02f, -5.052030051e-02f, -4.914254142e-02f, -1.984565051e-03f, +1.931089692e-02f, +9.259646102e-03f, -2.828715617e-03f, -3.693729756e-03f, - /* 20,14 */ -1.376799150e-03f, -4.362323551e-03f, -2.069933478e-04f, +1.399907244e-02f, +1.703673197e-02f, -1.615031726e-02f, -5.896552129e-02f, -2.804532708e-02f, +1.225315522e-01f, +3.104047352e-01f, +3.803470604e-01f, +2.686929243e-01f, +7.585987841e-02f, -4.704785126e-02f, -5.155911253e-02f, -4.608279480e-03f, +1.914947854e-02f, +1.023778220e-02f, -2.407896178e-03f, -3.867923854e-03f, - /* 20,15 */ -1.184613130e-03f, -4.274968522e-03f, -8.338854378e-04f, +1.309754391e-02f, +1.779561475e-02f, -1.313424017e-02f, -5.750258783e-02f, -3.357053763e-02f, +1.105090175e-01f, +3.006231905e-01f, +3.815142140e-01f, +2.797272456e-01f, +8.713841011e-02f, -4.306909662e-02f, -5.377462232e-02f, -7.349314558e-03f, +1.884704309e-02f, +1.120868183e-02f, -1.935046598e-03f, -4.024812873e-03f, - /* 20, 0 */ -1.329352252e-03f, -4.865562069e-03f, +1.662947600e-03f, +1.893743982e-02f, +1.052975469e-02f, -4.314924294e-02f, -6.168215525e-02f, +6.793829558e-02f, +3.007295231e-01f, +4.214013440e-01f, +3.007295231e-01f, +6.793829558e-02f, -6.168215525e-02f, -4.314924294e-02f, +1.052975469e-02f, +1.893743982e-02f, +1.662947600e-03f, -4.865562069e-03f, -1.329352252e-03f, +0.000000000e+00f, - /* 20, 1 */ -1.106503038e-03f, -4.784011640e-03f, +7.620481209e-04f, +1.810159639e-02f, +1.258770510e-02f, -3.946126222e-02f, -6.412166469e-02f, +5.516844650e-02f, +2.870012762e-01f, +4.208780002e-01f, +3.139874692e-01f, +8.118253044e-02f, -5.860314053e-02f, -4.671882663e-02f, +8.254179692e-03f, +1.967037055e-02f, +2.622520317e-03f, -4.905078775e-03f, -1.565095816e-03f, +0.000000000e+00f, - /* 20, 2 */ -8.979094201e-04f, -4.664743082e-03f, -7.633034189e-05f, +1.717630323e-02f, +1.442449893e-02f, -3.568911340e-02f, -6.594250862e-02f, +4.291292121e-02f, +2.728656387e-01f, +4.193105477e-01f, +3.267137817e-01f, +9.485763802e-02f, -5.486676259e-02f, -5.013477905e-02f, +5.766539049e-03f, +2.028700325e-02f, +3.636071544e-03f, -4.898357639e-03f, -1.812078842e-03f, +3.513221827e-04f, - /* 20, 3 */ -7.046452899e-04f, -4.512131585e-03f, -8.491713087e-04f, +1.617498084e-02f, +1.603855621e-02f, -3.186582692e-02f, -6.716828458e-02f, +3.120792005e-02f, +2.583867198e-01f, +4.167067067e-01f, +3.388490774e-01f, +1.089167196e-01f, -5.045835457e-02f, -5.336106841e-02f, +3.074480429e-03f, +2.077415592e-02f, +4.698051453e-03f, -4.841360048e-03f, -2.068349661e-03f, +3.288882594e-04f, - /* 20, 4 */ -5.275063595e-04f, -4.330562617e-03f, -1.554266965e-03f, +1.511089362e-02f, +1.743016199e-02f, -2.802305698e-02f, -6.782511100e-02f, +2.008577030e-02f, +2.436294448e-01f, +4.130792899e-01f, +3.503362849e-01f, +1.233097059e-01f, -4.536663323e-02f, -5.636108634e-02f, +1.877878266e-04f, +2.111898038e-02f, +5.802054958e-03f, -4.730268616e-03f, -2.331660076e-03f, +2.941732022e-04f, - /* 20, 5 */ -3.670219514e-04f, -4.124385552e-03f, -2.190189120e-03f, +1.399704337e-02f, +1.860136846e-02f, -2.419092016e-02f, -6.794137953e-02f, +9.574818877e-03f, +2.286591711e-01f, +4.084461208e-01f, +3.611209950e-01f, +1.379835966e-01f, -3.958387309e-02f, -5.909788086e-02f, -2.881585959e-03f, +2.130909659e-02f, +6.940829951e-03f, -4.561544087e-03f, -2.599469210e-03f, +2.461206998e-04f, - /* 20, 6 */ -2.234691091e-04f, -3.897870552e-03f, -2.756254356e-03f, +1.284607053e-02f, +1.955588746e-02f, -2.039785121e-02f, -6.754749865e-02f, -3.006469464e-04f, +2.135413047e-01f, +4.028299211e-01f, +3.711517965e-01f, +1.528827232e-01f, -3.310606021e-02f, -6.153439984e-02f, -6.119502817e-03f, +2.133272965e-02f, +8.106294302e-03f, -4.331982887e-03f, -2.868951124e-03f, +1.837671888e-04f, - /* 20, 7 */ -9.688872179e-05f, -3.655168976e-03f, -3.252484018e-03f, +1.167016373e-02f, +2.029897446e-02f, -1.667047641e-02f, -6.667563061e-02f, -9.520450398e-03f, +1.983409219e-01f, +3.962581664e-01f, +3.803805952e-01f, +1.679490334e-01f, -2.593302438e-02f, -6.363374348e-02f, -9.509639499e-03f, +2.117884859e-02f, +9.289561904e-03f, -4.038774728e-03f, -3.137006363e-03f, +1.062635081e-04f, - /* 20, 8 */ +1.289664191e-05f, -3.400277535e-03f, -3.679559671e-03f, +1.048097797e-02f, +2.083730557e-02f, -1.303350512e-02f, -6.535942396e-02f, -1.806854797e-02f, +1.831223958e-01f, +3.887629129e-01f, +3.887629129e-01f, +1.831223958e-01f, -1.806854797e-02f, -6.535942396e-02f, -1.303350512e-02f, +2.083730557e-02f, +1.048097797e-02f, -3.679559671e-03f, -3.400277535e-03f, +1.289664191e-05f, - /* 20, 9 */ +1.062635081e-04f, -3.137006363e-03f, -4.038774728e-03f, +9.289561904e-03f, +2.117884859e-02f, -9.509639499e-03f, -6.363374348e-02f, -2.593302438e-02f, +1.679490334e-01f, +3.803805952e-01f, +3.962581664e-01f, +1.983409219e-01f, -9.520450398e-03f, -6.667563061e-02f, -1.667047641e-02f, +2.029897446e-02f, +1.167016373e-02f, -3.252484018e-03f, -3.655168976e-03f, -9.688872179e-05f, - /* 20,10 */ +1.837671888e-04f, -2.868951124e-03f, -4.331982887e-03f, +8.106294302e-03f, +2.133272965e-02f, -6.119502817e-03f, -6.153439984e-02f, -3.310606021e-02f, +1.528827232e-01f, +3.711517965e-01f, +4.028299211e-01f, +2.135413047e-01f, -3.006469464e-04f, -6.754749865e-02f, -2.039785121e-02f, +1.955588746e-02f, +1.284607053e-02f, -2.756254356e-03f, -3.897870552e-03f, -2.234691091e-04f, - /* 20,11 */ +2.461206998e-04f, -2.599469210e-03f, -4.561544087e-03f, +6.940829951e-03f, +2.130909659e-02f, -2.881585959e-03f, -5.909788086e-02f, -3.958387309e-02f, +1.379835966e-01f, +3.611209950e-01f, +4.084461208e-01f, +2.286591711e-01f, +9.574818877e-03f, -6.794137953e-02f, -2.419092016e-02f, +1.860136846e-02f, +1.399704337e-02f, -2.190189120e-03f, -4.124385552e-03f, -3.670219514e-04f, - /* 20,12 */ +2.941732022e-04f, -2.331660076e-03f, -4.730268616e-03f, +5.802054958e-03f, +2.111898038e-02f, +1.877878266e-04f, -5.636108634e-02f, -4.536663323e-02f, +1.233097059e-01f, +3.503362849e-01f, +4.130792899e-01f, +2.436294448e-01f, +2.008577030e-02f, -6.782511100e-02f, -2.802305698e-02f, +1.743016199e-02f, +1.511089362e-02f, -1.554266965e-03f, -4.330562617e-03f, -5.275063595e-04f, - /* 20,13 */ +3.288882594e-04f, -2.068349661e-03f, -4.841360048e-03f, +4.698051453e-03f, +2.077415592e-02f, +3.074480429e-03f, -5.336106841e-02f, -5.045835457e-02f, +1.089167196e-01f, +3.388490774e-01f, +4.167067067e-01f, +2.583867198e-01f, +3.120792005e-02f, -6.716828458e-02f, -3.186582692e-02f, +1.603855621e-02f, +1.617498084e-02f, -8.491713087e-04f, -4.512131585e-03f, -7.046452899e-04f, - /* 20,14 */ +3.513221827e-04f, -1.812078842e-03f, -4.898357639e-03f, +3.636071544e-03f, +2.028700325e-02f, +5.766539049e-03f, -5.013477905e-02f, -5.486676259e-02f, +9.485763802e-02f, +3.267137817e-01f, +4.193105477e-01f, +2.728656387e-01f, +4.291292121e-02f, -6.594250862e-02f, -3.568911340e-02f, +1.442449893e-02f, +1.717630323e-02f, -7.633034189e-05f, -4.664743082e-03f, -8.979094201e-04f, - /* 20,15 */ +0.000000000e+00f, -1.565095816e-03f, -4.905078775e-03f, +2.622520317e-03f, +1.967037055e-02f, +8.254179692e-03f, -4.671882663e-02f, -5.860314053e-02f, +8.118253044e-02f, +3.139874692e-01f, +4.208780002e-01f, +2.870012762e-01f, +5.516844650e-02f, -6.412166469e-02f, -3.946126222e-02f, +1.258770510e-02f, +1.810159639e-02f, +7.620481209e-04f, -4.784011640e-03f, -1.106503038e-03f, - /* 20, 0 */ +3.735125865e-04f, -2.550984103e-03f, -4.871486096e-03f, +1.016287769e-02f, +2.252246682e-02f, -2.231523982e-02f, -7.431762424e-02f, +3.414137659e-02f, +3.062278786e-01f, +4.608988972e-01f, +3.062278786e-01f, +3.414137659e-02f, -7.431762424e-02f, -2.231523982e-02f, +2.252246682e-02f, +1.016287769e-02f, -4.871486096e-03f, -2.550984103e-03f, +3.735125865e-04f, +0.000000000e+00f, - /* 20, 1 */ +3.929324583e-04f, -2.236335973e-03f, -5.106050653e-03f, +8.748210493e-03f, +2.303691111e-02f, -1.786093260e-02f, -7.411924916e-02f, +2.086992015e-02f, +2.890848421e-01f, +4.602142272e-01f, +3.228796668e-01f, +4.817530421e-02f, -7.382833631e-02f, -2.685541297e-02f, +2.174514756e-02f, +1.158816420e-02f, -4.555417854e-03f, -2.871502680e-03f, +3.387491377e-04f, +0.000000000e+00f, - /* 20, 2 */ +0.000000000e+00f, -1.931175707e-03f, -5.263447672e-03f, +7.357928950e-03f, +2.330080531e-02f, -1.352771902e-02f, -7.327813327e-02f, +8.401230311e-03f, +2.715429904e-01f, +4.581642525e-01f, +3.389493512e-01f, +6.292517925e-02f, -7.260941515e-02f, -3.144322519e-02f, +2.069454672e-02f, +1.300917115e-02f, -4.154170312e-03f, -3.193828376e-03f, +2.870815261e-04f, +0.000000000e+00f, - /* 20, 3 */ +0.000000000e+00f, -1.638662038e-03f, -5.348575554e-03f, +6.004591146e-03f, +2.332816092e-02f, -9.347674729e-03f, -7.184169597e-02f, -3.230759097e-03f, +2.536956771e-01f, +4.547610488e-01f, +3.543483057e-01f, +7.833843581e-02f, -7.062228683e-02f, -3.603763775e-02f, +1.936240016e-02f, +1.440996064e-02f, -3.664825055e-03f, -3.513472060e-03f, +2.170808154e-04f, +0.000000000e+00f, - /* 20, 4 */ +0.000000000e+00f, -1.361489293e-03f, -5.366796329e-03f, +4.699488665e-03f, +2.313444000e-02f, -5.349604768e-03f, -6.985939290e-02f, -1.399855627e-02f, +2.356365195e-01f, +4.500246402e-01f, +3.689907742e-01f, +9.435670405e-02f, -6.783220328e-02f, -4.059502103e-02f, +1.774280068e-02f, +1.577366666e-02f, -3.085314600e-03f, -3.825546457e-03f, +1.274866066e-04f, +0.000000000e+00f, - /* 20, 5 */ +0.000000000e+00f, -1.101888322e-03f, -5.323837897e-03f, +3.452605627e-03f, +2.273631696e-02f, -1.558959414e-03f, -6.738225311e-02f, -2.388113922e-02f, +2.174587480e-01f, +4.439828472e-01f, +3.827944964e-01f, +1.109160995e-01f, -6.420865295e-02f, -4.506940842e-02f, +1.583239979e-02f, +1.708262332e-02f, -2.414511840e-03f, -4.124801502e-03f, +1.724424543e-05f, +0.000000000e+00f, - /* 20, 6 */ +0.000000000e+00f, -8.616336525e-04f, -5.225698259e-03f, +2.272594520e-03f, +2.215144089e-02f, +2.002216238e-03f, -6.446241843e-02f, -3.286393171e-02f, +1.992545658e-01f, +4.366710759e-01f, +3.956813102e-01f, +1.279475618e-01f, -5.972574809e-02f, -4.941278189e-02f, +1.363059437e-02f, +1.831850983e-02f, -1.652313816e-03f, -4.405667401e-03f, -1.144582079e-04f, +0.000000000e+00f, - /* 20, 7 */ +0.000000000e+00f, -6.420563626e-04f, -5.078552799e-03f, +1.166768183e-03f, +2.139820068e-02f, +5.315299677e-03f, -6.115268907e-02f, -4.093872873e-02f, +1.811145256e-01f, +4.281320500e-01f, +4.075777294e-01f, +1.453772407e-01f, -5.436258502e-02f, -5.357538755e-02f, +1.113969540e-02f, +1.946251142e-02f, -7.997184460e-04f, -4.662305323e-03f, -2.681538305e-04f, +0.000000000e+00f, - /* 20, 8 */ +0.000000000e+00f, -4.440621234e-04f, -4.888665552e-03f, +1.411071672e-04f, +2.049549532e-02f, +8.365076494e-03f, -5.750607943e-02f, -4.810357305e-02f, +1.631269271e-01f, +4.184154881e-01f, +4.184154881e-01f, +1.631269271e-01f, -4.810357305e-02f, -5.750607943e-02f, +8.365076494e-03f, +2.049549532e-02f, +1.411071672e-04f, -4.888665552e-03f, -4.440621234e-04f, +0.000000000e+00f, - /* 20, 9 */ +0.000000000e+00f, -2.681538305e-04f, -4.662305323e-03f, -7.997184460e-04f, +1.946251142e-02f, +1.113969540e-02f, -5.357538755e-02f, -5.436258502e-02f, +1.453772407e-01f, +4.075777294e-01f, +4.281320500e-01f, +1.811145256e-01f, -4.093872873e-02f, -6.115268907e-02f, +5.315299677e-03f, +2.139820068e-02f, +1.166768183e-03f, -5.078552799e-03f, -6.420563626e-04f, +0.000000000e+00f, - /* 20,10 */ +0.000000000e+00f, -1.144582079e-04f, -4.405667401e-03f, -1.652313816e-03f, +1.831850983e-02f, +1.363059437e-02f, -4.941278189e-02f, -5.972574809e-02f, +1.279475618e-01f, +3.956813102e-01f, +4.366710759e-01f, +1.992545658e-01f, -3.286393171e-02f, -6.446241843e-02f, +2.002216238e-03f, +2.215144089e-02f, +2.272594520e-03f, -5.225698259e-03f, -8.616336525e-04f, +0.000000000e+00f, - /* 20,11 */ +0.000000000e+00f, +1.724424543e-05f, -4.124801502e-03f, -2.414511840e-03f, +1.708262332e-02f, +1.583239979e-02f, -4.506940842e-02f, -6.420865295e-02f, +1.109160995e-01f, +3.827944964e-01f, +4.439828472e-01f, +2.174587480e-01f, -2.388113922e-02f, -6.738225311e-02f, -1.558959414e-03f, +2.273631696e-02f, +3.452605627e-03f, -5.323837897e-03f, -1.101888322e-03f, +0.000000000e+00f, - /* 20,12 */ +0.000000000e+00f, +1.274866066e-04f, -3.825546457e-03f, -3.085314600e-03f, +1.577366666e-02f, +1.774280068e-02f, -4.059502103e-02f, -6.783220328e-02f, +9.435670405e-02f, +3.689907742e-01f, +4.500246402e-01f, +2.356365195e-01f, -1.399855627e-02f, -6.985939290e-02f, -5.349604768e-03f, +2.313444000e-02f, +4.699488665e-03f, -5.366796329e-03f, -1.361489293e-03f, +0.000000000e+00f, - /* 20,13 */ +0.000000000e+00f, +2.170808154e-04f, -3.513472060e-03f, -3.664825055e-03f, +1.440996064e-02f, +1.936240016e-02f, -3.603763775e-02f, -7.062228683e-02f, +7.833843581e-02f, +3.543483057e-01f, +4.547610488e-01f, +2.536956771e-01f, -3.230759097e-03f, -7.184169597e-02f, -9.347674729e-03f, +2.332816092e-02f, +6.004591146e-03f, -5.348575554e-03f, -1.638662038e-03f, +0.000000000e+00f, - /* 20,14 */ +0.000000000e+00f, +2.870815261e-04f, -3.193828376e-03f, -4.154170312e-03f, +1.300917115e-02f, +2.069454672e-02f, -3.144322519e-02f, -7.260941515e-02f, +6.292517925e-02f, +3.389493512e-01f, +4.581642525e-01f, +2.715429904e-01f, +8.401230311e-03f, -7.327813327e-02f, -1.352771902e-02f, +2.330080531e-02f, +7.357928950e-03f, -5.263447672e-03f, -1.931175707e-03f, +0.000000000e+00f, - /* 20,15 */ +0.000000000e+00f, +3.387491377e-04f, -2.871502680e-03f, -4.555417854e-03f, +1.158816420e-02f, +2.174514756e-02f, -2.685541297e-02f, -7.382833631e-02f, +4.817530421e-02f, +3.228796668e-01f, +4.602142272e-01f, +2.890848421e-01f, +2.086992015e-02f, -7.411924916e-02f, -1.786093260e-02f, +2.303691111e-02f, +8.748210493e-03f, -5.106050653e-03f, -2.236335973e-03f, +3.929324583e-04f, - /* 16, 0 */ -4.898743621e-03f, -8.679086087e-05f, +2.336043359e-02f, +2.135055302e-04f, -7.556698393e-02f, -3.418085064e-04f, +3.068350485e-01f, +5.003964504e-01f, +3.068350485e-01f, -3.418085064e-04f, -7.556698393e-02f, +2.135055302e-04f, +2.336043359e-02f, -8.679086087e-05f, -4.898743621e-03f, +1.466795211e-05f, - /* 16, 1 */ -4.577177643e-03f, -1.168030162e-03f, +2.231338881e-02f, +4.259286102e-03f, -7.256190983e-02f, -1.325523148e-02f, +2.859961851e-01f, +4.995203198e-01f, +3.272077887e-01f, +1.366916740e-02f, -7.794631959e-02f, -4.137969722e-03f, +2.421268789e-02f, +1.104119466e-03f, -5.186216174e-03f, -1.424716020e-04f, - /* 16, 2 */ -4.229744004e-03f, -2.135347302e-03f, +2.109817837e-02f, +7.975999347e-03f, -6.900371451e-02f, -2.503996167e-02f, +2.648211478e-01f, +4.968980143e-01f, +3.469854770e-01f, +2.873680235e-02f, -7.962890015e-02f, -8.766610174e-03f, +2.484400873e-02f, +2.398541233e-03f, -5.431090074e-03f, -3.278051009e-04f, - /* 16, 3 */ -3.864289504e-03f, -2.986316790e-03f, +1.974155805e-02f, +1.134537917e-02f, -6.496587406e-02f, -3.567459207e-02f, +2.434398342e-01f, +4.925477372e-01f, +3.660412816e-01f, +4.481051979e-02f, -8.054606315e-02f, -1.363873477e-02f, +2.522910176e-02f, +3.788344934e-03f, -5.624692566e-03f, -5.415628140e-04f, - /* 16, 4 */ -3.488195595e-03f, -3.720237037e-03f, +1.827008292e-02f, +1.435416313e-02f, -6.052200094e-02f, -4.514733704e-02f, +2.219810322e-01f, +4.864996469e-01f, +3.842515379e-01f, +6.183022559e-02f, -8.063225815e-02f, -1.871557408e-02f, +2.534390000e-02f, +5.263393235e-03f, -5.758306879e-03f, -7.834433658e-04f, - /* 16, 5 */ -3.108305495e-03f, -4.338012209e-03f, +1.670979794e-02f, +1.699394035e-02f, -5.574514781e-02f, -5.345583367e-02f, +2.005713869e-01f, +4.787955863e-01f, +4.014968013e-01f, +7.972656727e-02f, -7.982580067e-02f, -2.395339311e-02f, +2.516595041e-02f, +6.811528665e-03f, -5.823306183e-03f, -1.052565974e-03f, - /* 16, 6 */ -2.730865011e-03f, -4.842020290e-03f, +1.508595356e-02f, +1.926095418e-02f, -5.070714412e-02f, -6.060686010e-02f, +1.793344024e-01f, +4.694887096e-01f, +4.176628724e-01f, +9.842128660e-02f, -7.806961406e-02f, -2.930367505e-02f, +2.467480385e-02f, +8.418588685e-03f, -5.811296621e-03f, -1.347428958e-03f, - /* 16, 7 */ -2.361477017e-03f, -5.235970004e-03f, +1.342274837e-02f, +2.115586371e-02f, -4.547797122e-02f, -6.661597542e-02f, +1.583894867e-01f, +4.586430086e-01f, +4.326417845e-01f, +1.178276637e-01f, -7.531195111e-02f, -3.471336612e-02f, +2.385240383e-02f, +1.006844961e-02f, -5.714267850e-03f, -1.665875716e-03f, - /* 16, 8 */ -2.005069351e-03f, -5.524749278e-03f, +1.174310057e-02f, +2.268346885e-02f, -4.012518151e-02f, -7.150708699e-02f, +1.378510501e-01f, +4.463327434e-01f, +4.463327434e-01f, +1.378510501e-01f, -7.150708699e-02f, -4.012518151e-02f, +2.268346885e-02f, +1.174310057e-02f, -5.524749278e-03f, -2.005069351e-03f, - /* 16, 9 */ -1.665875716e-03f, -5.714267850e-03f, +1.006844961e-02f, +2.385240383e-02f, -3.471336612e-02f, -7.531195111e-02f, +1.178276637e-01f, +4.326417845e-01f, +4.586430086e-01f, +1.583894867e-01f, -6.661597542e-02f, -4.547797122e-02f, +2.115586371e-02f, +1.342274837e-02f, -5.235970004e-03f, -2.361477017e-03f, - /* 16,10 */ -1.347428958e-03f, -5.811296621e-03f, +8.418588685e-03f, +2.467480385e-02f, -2.930367505e-02f, -7.806961406e-02f, +9.842128660e-02f, +4.176628724e-01f, +4.694887096e-01f, +1.793344024e-01f, -6.060686010e-02f, -5.070714412e-02f, +1.926095418e-02f, +1.508595356e-02f, -4.842020290e-03f, -2.730865011e-03f, - /* 16,11 */ -1.052565974e-03f, -5.823306183e-03f, +6.811528665e-03f, +2.516595041e-02f, -2.395339311e-02f, -7.982580067e-02f, +7.972656727e-02f, +4.014968013e-01f, +4.787955863e-01f, +2.005713869e-01f, -5.345583367e-02f, -5.574514781e-02f, +1.699394035e-02f, +1.670979794e-02f, -4.338012209e-03f, -3.108305495e-03f, - /* 16,12 */ -7.834433658e-04f, -5.758306879e-03f, +5.263393235e-03f, +2.534390000e-02f, -1.871557408e-02f, -8.063225815e-02f, +6.183022559e-02f, +3.842515379e-01f, +4.864996469e-01f, +2.219810322e-01f, -4.514733704e-02f, -6.052200094e-02f, +1.435416313e-02f, +1.827008292e-02f, -3.720237037e-03f, -3.488195595e-03f, - /* 16,13 */ -5.415628140e-04f, -5.624692566e-03f, +3.788344934e-03f, +2.522910176e-02f, -1.363873477e-02f, -8.054606315e-02f, +4.481051979e-02f, +3.660412816e-01f, +4.925477372e-01f, +2.434398342e-01f, -3.567459207e-02f, -6.496587406e-02f, +1.134537917e-02f, +1.974155805e-02f, -2.986316790e-03f, -3.864289504e-03f, - /* 16,14 */ -3.278051009e-04f, -5.431090074e-03f, +2.398541233e-03f, +2.484400873e-02f, -8.766610174e-03f, -7.962890015e-02f, +2.873680235e-02f, +3.469854770e-01f, +4.968980143e-01f, +2.648211478e-01f, -2.503996167e-02f, -6.900371451e-02f, +7.975999347e-03f, +2.109817837e-02f, -2.135347302e-03f, -4.229744004e-03f, - /* 16,15 */ -1.424716020e-04f, -5.186216174e-03f, +1.104119466e-03f, +2.421268789e-02f, -4.137969722e-03f, -7.794631959e-02f, +1.366916740e-02f, +3.272077887e-01f, +4.995203198e-01f, +2.859961851e-01f, -1.325523148e-02f, -7.256190983e-02f, +4.259286102e-03f, +2.231338881e-02f, -1.168030162e-03f, -4.577177643e-03f, - /* 16, 0 */ -1.854349243e-03f, -5.842655877e-03f, +1.571555836e-02f, +1.847159410e-02f, -6.634453543e-02f, -3.320569278e-02f, +3.025932104e-01f, +5.398940036e-01f, +3.025932104e-01f, -3.320569278e-02f, -6.634453543e-02f, +1.847159410e-02f, +1.571555836e-02f, -5.842655877e-03f, -1.854349243e-03f, +0.000000000e+00f, - /* 16, 1 */ -1.480579358e-03f, -6.106700866e-03f, +1.376986381e-02f, +2.107103425e-02f, -6.084498265e-02f, -4.482173865e-02f, +2.778559558e-01f, +5.387937054e-01f, +3.269511876e-01f, -2.013603096e-02f, -7.140657205e-02f, +1.540395578e-02f, +1.762103499e-02f, -5.450677830e-03f, -2.253515747e-03f, +0.000000000e+00f, - /* 16, 2 */ -1.136163241e-03f, -6.251562574e-03f, +1.181432209e-02f, +2.320368920e-02f, -5.500558000e-02f, -5.497544958e-02f, +2.529151163e-01f, +5.355017071e-01f, +3.507537104e-01f, -5.635398845e-03f, -7.593183970e-02f, +1.187314151e-02f, +1.945395611e-02f, -4.923375547e-03f, -2.673102395e-03f, +0.000000000e+00f, - /* 16, 3 */ -8.240613879e-04f, -6.287094834e-03f, +9.877041313e-03f, +2.487696888e-02f, -4.892141083e-02f, -6.367164518e-02f, +2.279442418e-01f, +5.300446041e-01f, +3.738258052e-01f, +1.025938806e-02f, -7.982055919e-02f, +7.890985370e-03f, +2.118036474e-02f, -4.254967852e-03f, -3.107109230e-03f, +0.000000000e+00f, - /* 16, 4 */ -5.462770218e-04f, -6.224002243e-03f, +7.983624178e-03f, +2.610378910e-02f, -4.268405269e-02f, -7.092815895e-02f, +2.031131300e-01f, +5.224664143e-01f, +3.959953988e-01f, +2.749725254e-02f, -8.297353764e-02f, +3.476439880e-03f, +2.276508169e-02f, -3.441527233e-03f, -3.548528769e-03f, +4.634120047e-04f, - /* 16, 5 */ -3.039101756e-04f, -6.073592210e-03f, +6.156978545e-03f, +2.690203687e-02f, -3.638073666e-02f, -7.677518685e-02f, +1.785862812e-01f, +5.128281199e-01f, +4.170950072e-01f, +4.601292009e-02f, -8.529332152e-02f, -1.344195268e-03f, +2.417214928e-02f, -2.481210963e-03f, -3.989383394e-03f, +4.400286560e-04f, - /* 16, 6 */ -9.722433303e-05f, -5.847536081e-03f, +4.417180930e-03f, +2.729400173e-02f, -3.009359622e-02f, -8.125451993e-02f, +1.545214364e-01f, +5.012070337e-01f, +4.369633957e-01f, +6.572714234e-02f, -8.668537697e-02f, -6.537129252e-03f, +2.536531778e-02f, -1.374474827e-03f, -4.420785166e-03f, +3.921992729e-04f, - /* 16, 7 */ +7.427658644e-05f, -5.557642708e-03f, +2.781391675e-03f, +2.730578215e-02f, -2.389901141e-02f, -8.441867356e-02f, +1.310682124e-01f, +4.876959980e-01f, +4.554471907e-01f, +8.654708074e-02f, -8.705928349e-02f, -1.206102709e-02f, +2.630856978e-02f, -1.242645535e-04f, -4.833018707e-03f, +3.169896142e-04f, - /* 16, 8 */ +2.117631665e-04f, -5.215647395e-03f, +1.263819875e-03f, +2.696667686e-02f, -1.786705263e-02f, -8.632992647e-02f, +1.083668491e-01f, +4.724024249e-01f, +4.724024249e-01f, +1.083668491e-01f, -8.632992647e-02f, -1.786705263e-02f, +2.696667686e-02f, +1.263819875e-03f, -5.215647395e-03f, +2.117631665e-04f, - /* 16, 9 */ +3.169896142e-04f, -4.833018707e-03f, -1.242645535e-04f, +2.630856978e-02f, -1.206102709e-02f, -8.705928349e-02f, +8.654708074e-02f, +4.554471907e-01f, +4.876959980e-01f, +1.310682124e-01f, -8.441867356e-02f, -2.389901141e-02f, +2.730578215e-02f, +2.781391675e-03f, -5.557642708e-03f, +7.427658644e-05f, - /* 16,10 */ +3.921992729e-04f, -4.420785166e-03f, -1.374474827e-03f, +2.536531778e-02f, -6.537129252e-03f, -8.668537697e-02f, +6.572714234e-02f, +4.369633957e-01f, +5.012070337e-01f, +1.545214364e-01f, -8.125451993e-02f, -3.009359622e-02f, +2.729400173e-02f, +4.417180930e-03f, -5.847536081e-03f, -9.722433303e-05f, - /* 16,11 */ +4.400286560e-04f, -3.989383394e-03f, -2.481210963e-03f, +2.417214928e-02f, -1.344195268e-03f, -8.529332152e-02f, +4.601292009e-02f, +4.170950072e-01f, +5.128281199e-01f, +1.785862812e-01f, -7.677518685e-02f, -3.638073666e-02f, +2.690203687e-02f, +6.156978545e-03f, -6.073592210e-03f, -3.039101756e-04f, - /* 16,12 */ +4.634120047e-04f, -3.548528769e-03f, -3.441527233e-03f, +2.276508169e-02f, +3.476439880e-03f, -8.297353764e-02f, +2.749725254e-02f, +3.959953988e-01f, +5.224664143e-01f, +2.031131300e-01f, -7.092815895e-02f, -4.268405269e-02f, +2.610378910e-02f, +7.983624178e-03f, -6.224002243e-03f, -5.462770218e-04f, - /* 16,13 */ +0.000000000e+00f, -3.107109230e-03f, -4.254967852e-03f, +2.118036474e-02f, +7.890985370e-03f, -7.982055919e-02f, +1.025938806e-02f, +3.738258052e-01f, +5.300446041e-01f, +2.279442418e-01f, -6.367164518e-02f, -4.892141083e-02f, +2.487696888e-02f, +9.877041313e-03f, -6.287094834e-03f, -8.240613879e-04f, - /* 16,14 */ +0.000000000e+00f, -2.673102395e-03f, -4.923375547e-03f, +1.945395611e-02f, +1.187314151e-02f, -7.593183970e-02f, -5.635398845e-03f, +3.507537104e-01f, +5.355017071e-01f, +2.529151163e-01f, -5.497544958e-02f, -5.500558000e-02f, +2.320368920e-02f, +1.181432209e-02f, -6.251562574e-03f, -1.136163241e-03f, - /* 16,15 */ +0.000000000e+00f, -2.253515747e-03f, -5.450677830e-03f, +1.762103499e-02f, +1.540395578e-02f, -7.140657205e-02f, -2.013603096e-02f, +3.269511876e-01f, +5.387937054e-01f, +2.778559558e-01f, -4.482173865e-02f, -6.084498265e-02f, +2.107103425e-02f, +1.376986381e-02f, -6.106700866e-03f, -1.480579358e-03f, - /* 16, 0 */ +2.517634455e-04f, -5.956310854e-03f, +5.008864062e-03f, +2.864631470e-02f, -4.909056125e-02f, -6.235528720e-02f, +2.936293584e-01f, +5.793915568e-01f, +2.936293584e-01f, -6.235528720e-02f, -4.909056125e-02f, +2.864631470e-02f, +5.008864062e-03f, -5.956310854e-03f, +2.517634455e-04f, +0.000000000e+00f, - /* 16, 1 */ +3.647589216e-04f, -5.559366521e-03f, +3.110945653e-03f, +2.922667528e-02f, -4.185408685e-02f, -7.174125192e-02f, +2.648835910e-01f, +5.780318135e-01f, +3.221602930e-01f, -5.117389488e-02f, -5.619351824e-02f, +2.755457966e-02f, +7.032385926e-03f, -6.289189967e-03f, +9.939782505e-05f, +0.000000000e+00f, - /* 16, 2 */ +4.414886472e-04f, -5.113535158e-03f, +1.357910925e-03f, +2.932892142e-02f, -3.459618474e-02f, -7.936172697e-02f, +2.361522790e-01f, +5.739652427e-01f, +3.502436629e-01f, -3.818535953e-02f, -6.304412145e-02f, +2.592390265e-02f, +9.158035052e-03f, -6.542440674e-03f, -9.477253367e-05f, +0.000000000e+00f, - /* 16, 3 */ +4.855802427e-04f, -4.633347213e-03f, -2.351453324e-04f, +2.899108127e-02f, -2.742112952e-02f, -8.526380919e-02f, +2.076588264e-01f, +5.672296697e-01f, +3.776458156e-01f, -2.339704980e-02f, -6.951800781e-02f, +2.373330296e-02f, +1.135820669e-02f, -6.700410184e-03f, -3.323676319e-04f, +0.000000000e+00f, - /* 16, 4 */ +0.000000000e+00f, -4.132457962e-03f, -1.657230762e-03f, +2.825501306e-02f, -2.042447313e-02f, -8.951050933e-02f, +1.796184274e-01f, +5.578876325e-01f, +4.041347532e-01f, -6.836060229e-03f, -7.548664793e-02f, +2.096923455e-02f, +1.360131724e-02f, -6.747680557e-03f, -6.140535745e-04f, +0.000000000e+00f, - /* 16, 5 */ +0.000000000e+00f, -3.623457200e-03f, -2.901306411e-03f, +2.716546883e-02f, -1.369230379e-02f, -9.217934767e-02f, +1.522358833e-01f, +5.460256322e-01f, +4.294827240e-01f, +1.145038182e-02f, -8.081883229e-02f, +1.762637069e-02f, +1.585203938e-02f, -6.669417793e-03f, -9.394126333e-04f, +0.000000000e+00f, - /* 16, 6 */ +0.000000000e+00f, -3.117716971e-03f, -3.964078879e-03f, +2.576917487e-02f, -7.300675124e-03f, -9.336081470e-02f, +1.257035893e-01f, +5.317530991e-01f, +4.534687988e-01f, +3.139475616e-02f, -8.538226676e-02f, +1.370830904e-02f, +1.807162423e-02f, -6.451740247e-03f, -1.306826648e-03f, +0.000000000e+00f, - /* 16, 7 */ +0.000000000e+00f, -2.625277441e-03f, -4.845741482e-03f, +2.411394259e-02f, -1.315205805e-03f, -9.315672206e-02f, +1.001997139e-01f, +5.152010878e-01f, +4.758813956e-01f, +5.290934542e-02f, -8.904525833e-02f, +9.228181275e-03f, +2.021831098e-02f, -6.082100328e-03f, -1.713377737e-03f, +0.000000000e+00f, - /* 16, 8 */ +0.000000000e+00f, -2.154770219e-03f, -5.549672684e-03f, +2.224782226e-02f, +4.209152176e-03f, -9.167847004e-02f, +7.588659143e-02f, +4.965207199e-01f, +4.965207199e-01f, +7.588659143e-02f, -9.167847004e-02f, +4.209152176e-03f, +2.224782226e-02f, -5.549672684e-03f, -2.154770219e-03f, +0.000000000e+00f, - /* 16, 9 */ +0.000000000e+00f, -1.713377737e-03f, -6.082100328e-03f, +2.021831098e-02f, +9.228181275e-03f, -8.904525833e-02f, +5.290934542e-02f, +4.758813956e-01f, +5.152010878e-01f, +1.001997139e-01f, -9.315672206e-02f, -1.315205805e-03f, +2.411394259e-02f, -4.845741482e-03f, -2.625277441e-03f, +0.000000000e+00f, - /* 16,10 */ +0.000000000e+00f, -1.306826648e-03f, -6.451740247e-03f, +1.807162423e-02f, +1.370830904e-02f, -8.538226676e-02f, +3.139475616e-02f, +4.534687988e-01f, +5.317530991e-01f, +1.257035893e-01f, -9.336081470e-02f, -7.300675124e-03f, +2.576917487e-02f, -3.964078879e-03f, -3.117716971e-03f, +0.000000000e+00f, - /* 16,11 */ +0.000000000e+00f, -9.394126333e-04f, -6.669417793e-03f, +1.585203938e-02f, +1.762637069e-02f, -8.081883229e-02f, +1.145038182e-02f, +4.294827240e-01f, +5.460256322e-01f, +1.522358833e-01f, -9.217934767e-02f, -1.369230379e-02f, +2.716546883e-02f, -2.901306411e-03f, -3.623457200e-03f, +0.000000000e+00f, - /* 16,12 */ +0.000000000e+00f, -6.140535745e-04f, -6.747680557e-03f, +1.360131724e-02f, +2.096923455e-02f, -7.548664793e-02f, -6.836060229e-03f, +4.041347532e-01f, +5.578876325e-01f, +1.796184274e-01f, -8.951050933e-02f, -2.042447313e-02f, +2.825501306e-02f, -1.657230762e-03f, -4.132457962e-03f, +0.000000000e+00f, - /* 16,13 */ +0.000000000e+00f, -3.323676319e-04f, -6.700410184e-03f, +1.135820669e-02f, +2.373330296e-02f, -6.951800781e-02f, -2.339704980e-02f, +3.776458156e-01f, +5.672296697e-01f, +2.076588264e-01f, -8.526380919e-02f, -2.742112952e-02f, +2.899108127e-02f, -2.351453324e-04f, -4.633347213e-03f, +4.855802427e-04f, - /* 16,14 */ +0.000000000e+00f, -9.477253367e-05f, -6.542440674e-03f, +9.158035052e-03f, +2.592390265e-02f, -6.304412145e-02f, -3.818535953e-02f, +3.502436629e-01f, +5.739652427e-01f, +2.361522790e-01f, -7.936172697e-02f, -3.459618474e-02f, +2.932892142e-02f, +1.357910925e-03f, -5.113535158e-03f, +4.414886472e-04f, - /* 16,15 */ +0.000000000e+00f, +9.939782505e-05f, -6.289189967e-03f, +7.032385926e-03f, +2.755457966e-02f, -5.619351824e-02f, -5.117389488e-02f, +3.221602930e-01f, +5.780318135e-01f, +2.648835910e-01f, -7.174125192e-02f, -4.185408685e-02f, +2.922667528e-02f, +3.110945653e-03f, -5.559366521e-03f, +3.647589216e-04f, - /* 12, 0 */ -3.638165547e-03f, +2.979985982e-02f, -2.723323293e-02f, -8.605047059e-02f, +2.801520768e-01f, +6.188891100e-01f, +2.801520768e-01f, -8.605047059e-02f, -2.723323293e-02f, +2.979985982e-02f, -3.638165547e-03f, -3.041512814e-03f, - /* 12, 1 */ -4.749738186e-03f, +2.841159300e-02f, -1.933319589e-02f, -9.237133076e-02f, +2.473915856e-01f, +6.172320760e-01f, +3.129551421e-01f, -7.764805088e-02f, -3.538029377e-02f, +3.077779188e-02f, -2.305275216e-03f, -3.612081594e-03f, - /* 12, 2 */ -5.642312008e-03f, +2.667449885e-02f, -1.178831271e-02f, -9.669686191e-02f, +2.149632830e-01f, +6.122785731e-01f, +3.455026876e-01f, -6.709962705e-02f, -4.365285408e-02f, +3.128617370e-02f, -7.534120996e-04f, -4.192641091e-03f, - /* 12, 3 */ -6.322395719e-03f, +2.465107974e-02f, -4.692548813e-03f, -9.913294928e-02f, +1.831448749e-01f, +6.040811565e-01f, +3.774917553e-01f, -5.436442589e-02f, -5.191703591e-02f, +3.126943445e-02f, +1.010002855e-03f, -4.769140004e-03f, - /* 12, 4 */ -6.800166749e-03f, +2.240361196e-02f, +1.874795505e-03f, -9.980279721e-02f, +1.521989634e-01f, +5.927266195e-01f, +4.086182709e-01f, -3.942694703e-02f, -6.002791415e-02f, +3.067703358e-02f, +2.972136287e-03f, -5.325763732e-03f, - /* 12, 5 */ -7.088917510e-03f, +1.999301835e-02f, +7.849320649e-03f, -9.884443272e-02f, +1.223701278e-01f, +5.783348068e-01f, +4.385808709e-01f, -2.229824534e-02f, -6.783107929e-02f, +2.946485483e-02f, +5.114495497e-03f, -5.845139328e-03f, - /* 12, 6 */ -7.204483224e-03f, +1.747784955e-02f, +1.318150805e-02f, -9.640809295e-02f, +9.388232321e-02f, +5.610569814e-01f, +4.670847512e-01f, -3.016864363e-03f, -7.516444191e-02f, +2.759658236e-02f, +7.412783505e-03f, -6.308600966e-03f, - /* 12, 7 */ -7.164664930e-03f, +1.491338589e-02f, +1.783645872e-02f, -9.265354184e-02f, +6.693662660e-02f, +5.410737692e-01f, +4.938454794e-01f, +1.835060492e-02f, -8.186025948e-02f, +2.504503167e-02f, +9.836867291e-03f, -6.696514785e-03f, - /* 12, 8 */ -6.988660420e-03f, +1.235086875e-02f, +2.179340724e-02f, -8.774736114e-02f, +4.170935934e-02f, +5.185927134e-01f, +5.185927134e-01f, +4.170935934e-02f, -8.774736114e-02f, +2.179340724e-02f, +1.235086875e-02f, -6.988660420e-03f, - /* 12, 9 */ -6.696514785e-03f, +9.836867291e-03f, +2.504503167e-02f, -8.186025948e-02f, +1.835060492e-02f, +4.938454794e-01f, +5.410737692e-01f, +6.693662660e-02f, -9.265354184e-02f, +1.783645872e-02f, +1.491338589e-02f, -7.164664930e-03f, - /* 12,10 */ -6.308600966e-03f, +7.412783505e-03f, +2.759658236e-02f, -7.516444191e-02f, -3.016864363e-03f, +4.670847512e-01f, +5.610569814e-01f, +9.388232321e-02f, -9.640809295e-02f, +1.318150805e-02f, +1.747784955e-02f, -7.204483224e-03f, - /* 12,11 */ -5.845139328e-03f, +5.114495497e-03f, +2.946485483e-02f, -6.783107929e-02f, -2.229824534e-02f, +4.385808709e-01f, +5.783348068e-01f, +1.223701278e-01f, -9.884443272e-02f, +7.849320649e-03f, +1.999301835e-02f, -7.088917510e-03f, - /* 12,12 */ -5.325763732e-03f, +2.972136287e-03f, +3.067703358e-02f, -6.002791415e-02f, -3.942694703e-02f, +4.086182709e-01f, +5.927266195e-01f, +1.521989634e-01f, -9.980279721e-02f, +1.874795505e-03f, +2.240361196e-02f, -6.800166749e-03f, - /* 12,13 */ -4.769140004e-03f, +1.010002855e-03f, +3.126943445e-02f, -5.191703591e-02f, -5.436442589e-02f, +3.774917553e-01f, +6.040811565e-01f, +1.831448749e-01f, -9.913294928e-02f, -4.692548813e-03f, +2.465107974e-02f, -6.322395719e-03f, - /* 12,14 */ -4.192641091e-03f, -7.534120996e-04f, +3.128617370e-02f, -4.365285408e-02f, -6.709962705e-02f, +3.455026876e-01f, +6.122785731e-01f, +2.149632830e-01f, -9.669686191e-02f, -1.178831271e-02f, +2.667449885e-02f, -5.642312008e-03f, - /* 12,15 */ -3.612081594e-03f, -2.305275216e-03f, +3.077779188e-02f, -3.538029377e-02f, -7.764805088e-02f, +3.129551421e-01f, +6.172320760e-01f, +2.473915856e-01f, -9.237133076e-02f, -1.933319589e-02f, +2.841159300e-02f, -4.749738186e-03f, - /* 12, 0 */ -7.562702671e-03f, +2.362257603e-02f, -4.531854693e-03f, -1.030173373e-01f, +2.624467795e-01f, +6.583866631e-01f, +2.624467795e-01f, -1.030173373e-01f, -4.531854693e-03f, +2.362257603e-02f, -7.562702671e-03f, -3.516889901e-04f, - /* 12, 1 */ -7.668183010e-03f, +2.087771707e-02f, +2.839059860e-03f, -1.056218320e-01f, +2.257778124e-01f, +6.563919279e-01f, +2.995227467e-01f, -9.814415944e-02f, -1.254420342e-02f, +2.617709089e-02f, -7.250906804e-03f, -7.142430143e-04f, - /* 12, 2 */ -7.590423774e-03f, +1.801705410e-02f, +9.487879886e-03f, -1.061169074e-01f, +1.898705313e-01f, +6.504316937e-01f, +3.366347146e-01f, -9.086648783e-02f, -2.109702270e-02f, +2.846338313e-02f, -6.712315500e-03f, -1.140764971e-03f, - /* 12, 3 */ -7.354275530e-03f, +1.511050856e-02f, +1.535418598e-02f, -1.046816488e-01f, +1.550586973e-01f, +6.405775033e-01f, +3.734003416e-01f, -8.107535131e-02f, -3.006937567e-02f, +3.040170317e-02f, -5.929880498e-03f, -1.628307909e-03f, - /* 12, 4 */ -6.985575046e-03f, +1.222230420e-02f, +2.039736787e-02f, -1.015111601e-01f, +1.216509697e-01f, +6.269473635e-01f, +4.094311989e-01f, -6.869168809e-02f, -3.932109040e-02f, +3.191206547e-02f, -4.890814148e-03f, -2.171433859e-03f, - /* 12, 5 */ -6.510406524e-03f, +9.410098002e-03f, +2.459585213e-02f, -9.681266365e-02f, +8.992722338e-02f, +6.097039216e-01f, +4.443382217e-01f, -5.366903171e-02f, -4.869391429e-02f, +3.291602689e-02f, -3.587389454e-03f, -2.762058981e-03f, - /* 12, 6 */ -5.954426605e-03f, +6.724324555e-03f, +2.794602403e-02f, -9.080157573e-02f, +6.013541337e-02f, +5.890519583e-01f, +4.777372670e-01f, -3.599575069e-02f, -5.801308453e-02f, +3.333857894e-02f, -2.017687876e-03f, -3.389362400e-03f, - /* 12, 7 */ -5.342264546e-03f, +4.207752570e-03f, +3.046088231e-02f, -8.369763050e-02f, +3.248902822e-02f, +5.652352421e-01f, +5.092546840e-01f, -1.569678608e-02f, -6.708930595e-02f, +3.311011989e-02f, -1.862710466e-04f, -4.039767889e-03f, - /* 12, 8 */ -4.697006242e-03f, +1.895247343e-03f, +3.216846911e-02f, -7.572111885e-02f, +7.165160645e-03f, +5.385328020e-01f, +5.385328020e-01f, +7.165160645e-03f, -7.572111885e-02f, +3.216846911e-02f, +1.895247343e-03f, -4.697006242e-03f, - /* 12, 9 */ -4.039767889e-03f, -1.862710466e-04f, +3.311011989e-02f, -6.708930595e-02f, -1.569678608e-02f, +5.092546840e-01f, +5.652352421e-01f, +3.248902822e-02f, -8.369763050e-02f, +3.046088231e-02f, +4.207752570e-03f, -5.342264546e-03f, - /* 12,10 */ -3.389362400e-03f, -2.017687876e-03f, +3.333857894e-02f, -5.801308453e-02f, -3.599575069e-02f, +4.777372670e-01f, +5.890519583e-01f, +6.013541337e-02f, -9.080157573e-02f, +2.794602403e-02f, +6.724324555e-03f, -5.954426605e-03f, - /* 12,11 */ -2.762058981e-03f, -3.587389454e-03f, +3.291602689e-02f, -4.869391429e-02f, -5.366903171e-02f, +4.443382217e-01f, +6.097039216e-01f, +8.992722338e-02f, -9.681266365e-02f, +2.459585213e-02f, +9.410098002e-03f, -6.510406524e-03f, - /* 12,12 */ -2.171433859e-03f, -4.890814148e-03f, +3.191206547e-02f, -3.932109040e-02f, -6.869168809e-02f, +4.094311989e-01f, +6.269473635e-01f, +1.216509697e-01f, -1.015111601e-01f, +2.039736787e-02f, +1.222230420e-02f, -6.985575046e-03f, - /* 12,13 */ -1.628307909e-03f, -5.929880498e-03f, +3.040170317e-02f, -3.006937567e-02f, -8.107535131e-02f, +3.734003416e-01f, +6.405775033e-01f, +1.550586973e-01f, -1.046816488e-01f, +1.535418598e-02f, +1.511050856e-02f, -7.354275530e-03f, - /* 12,14 */ -1.140764971e-03f, -6.712315500e-03f, +2.846338313e-02f, -2.109702270e-02f, -9.086648783e-02f, +3.366347146e-01f, +6.504316937e-01f, +1.898705313e-01f, -1.061169074e-01f, +9.487879886e-03f, +1.801705410e-02f, -7.590423774e-03f, - /* 12,15 */ -7.142430143e-04f, -7.250906804e-03f, +2.617709089e-02f, -1.254420342e-02f, -9.814415944e-02f, +2.995227467e-01f, +6.563919279e-01f, +2.257778124e-01f, -1.056218320e-01f, +2.839059860e-03f, +2.087771707e-02f, -7.668183010e-03f, - /* 12, 0 */ -7.009786996e-03f, +1.344312953e-02f, +1.557210222e-02f, -1.125190619e-01f, +2.408695221e-01f, +6.978842163e-01f, +2.408695221e-01f, -1.125190619e-01f, +1.557210222e-02f, +1.344312953e-02f, -7.009786996e-03f, +6.003640016e-04f, - /* 12, 1 */ -6.398742119e-03f, +1.026913982e-02f, +2.132332546e-02f, -1.110115061e-01f, +2.005160832e-01f, +6.955088069e-01f, +2.821133540e-01f, -1.117099281e-01f, +8.845385329e-03f, +1.669708199e-02f, -7.518519523e-03f, +5.590854556e-04f, - /* 12, 2 */ -5.716737920e-03f, +7.240001966e-03f, +2.606967700e-02f, -1.074325911e-01f, +1.614746033e-01f, +6.884146462e-01f, +3.237982615e-01f, -1.083606220e-01f, +1.198165974e-03f, +1.995657080e-02f, -7.892366537e-03f, +4.637249154e-04f, - /* 12, 3 */ -4.993154633e-03f, +4.410399512e-03f, +2.980590100e-02f, -1.020439692e-01f, +1.241329667e-01f, +6.766973789e-01f, +3.654537522e-01f, -1.022748781e-01f, -7.287927063e-03f, +2.313861998e-02f, -8.098411048e-03f, +3.063703263e-04f, - /* 12, 4 */ -4.254780730e-03f, +1.824453005e-03f, +3.254896791e-02f, -9.511805181e-02f, +8.884019172e-02f, +6.605145641e-01f, +4.065952670e-01f, -9.328874484e-02f, -1.650412301e-02f, +2.615301189e-02f, -8.104377377e-03f, +8.035370630e-05f, - /* 12, 5 */ -3.525333045e-03f, -4.843426812e-04f, +3.433584064e-02f, -8.693252112e-02f, +5.590207404e-02f, +6.400829406e-01f, +4.467316931e-01f, -8.127529114e-02f, -2.631456917e-02f, +2.890390773e-02f, -7.879705669e-03f, -2.193022854e-04f, - /* 12, 6 */ -2.825116890e-03f, -2.492908449e-03f, +3.522097401e-02f, -7.776502604e-02f, +2.557772128e-02f, +6.156746770e-01f, +4.853731430e-01f, -6.614880956e-02f, -3.655698883e-02f, +3.129176395e-02f, -7.396691856e-03f, -5.954441701e-04f, - /* 12, 7 */ -2.170822930e-03f, -4.188126176e-03f, +3.527362061e-02f, -6.788815999e-02f, -1.922977207e-03f, +5.876126808e-01f, +5.220388545e-01f, -4.786841211e-02f, -4.704395826e-02f, +3.321551909e-02f, -6.631665064e-03f, -1.048370326e-03f, - /* 12, 8 */ -1.575453811e-03f, -5.566170902e-03f, +3.457501660e-02f, -5.756481055e-02f, -2.644092188e-02f, +5.562650609e-01f, +5.562650609e-01f, -2.644092188e-02f, -5.756481055e-02f, +3.457501660e-02f, -5.566170902e-03f, -1.575453811e-03f, - /* 12, 9 */ -1.048370326e-03f, -6.631665064e-03f, +3.321551909e-02f, -4.704395826e-02f, -4.786841211e-02f, +5.220388545e-01f, +5.876126808e-01f, -1.922977207e-03f, -6.788815999e-02f, +3.527362061e-02f, -4.188126176e-03f, -2.170822930e-03f, - /* 12,10 */ -5.954441701e-04f, -7.396691856e-03f, +3.129176395e-02f, -3.655698883e-02f, -6.614880956e-02f, +4.853731430e-01f, +6.156746770e-01f, +2.557772128e-02f, -7.776502604e-02f, +3.522097401e-02f, -2.492908449e-03f, -2.825116890e-03f, - /* 12,11 */ -2.193022854e-04f, -7.879705669e-03f, +2.890390773e-02f, -2.631456917e-02f, -8.127529114e-02f, +4.467316931e-01f, +6.400829406e-01f, +5.590207404e-02f, -8.693252112e-02f, +3.433584064e-02f, -4.843426812e-04f, -3.525333045e-03f, - /* 12,12 */ +8.035370630e-05f, -8.104377377e-03f, +2.615301189e-02f, -1.650412301e-02f, -9.328874484e-02f, +4.065952670e-01f, +6.605145641e-01f, +8.884019172e-02f, -9.511805181e-02f, +3.254896791e-02f, +1.824453005e-03f, -4.254780730e-03f, - /* 12,13 */ +3.063703263e-04f, -8.098411048e-03f, +2.313861998e-02f, -7.287927063e-03f, -1.022748781e-01f, +3.654537522e-01f, +6.766973789e-01f, +1.241329667e-01f, -1.020439692e-01f, +2.980590100e-02f, +4.410399512e-03f, -4.993154633e-03f, - /* 12,14 */ +4.637249154e-04f, -7.892366537e-03f, +1.995657080e-02f, +1.198165974e-03f, -1.083606220e-01f, +3.237982615e-01f, +6.884146462e-01f, +1.614746033e-01f, -1.074325911e-01f, +2.606967700e-02f, +7.240001966e-03f, -5.716737920e-03f, - /* 12,15 */ +5.590854556e-04f, -7.518519523e-03f, +1.669708199e-02f, +8.845385329e-03f, -1.117099281e-01f, +2.821133540e-01f, +6.955088069e-01f, +2.005160832e-01f, -1.110115061e-01f, +2.132332546e-02f, +1.026913982e-02f, -6.398742119e-03f, - - /* 24, 0 */ +1.501390780e-03f, +3.431804419e-03f, +6.512803185e-03f, +1.091425387e-02f, +1.664594540e-02f, +2.351091132e-02f, +3.109255671e-02f, +3.878419288e-02f, +4.586050701e-02f, +5.158058002e-02f, +5.530384985e-02f, +5.659614054e-02f, +5.530384985e-02f, +5.158058002e-02f, +4.586050701e-02f, +3.878419288e-02f, +3.109255671e-02f, +2.351091132e-02f, +1.664594540e-02f, +1.091425387e-02f, +6.512803185e-03f, +3.431804419e-03f, +1.501390780e-03f, +4.573885647e-04f, - /* 24, 1 */ +1.413186400e-03f, +3.279858311e-03f, +6.282638036e-03f, +1.059932179e-02f, +1.625135142e-02f, +2.305547031e-02f, +3.060840342e-02f, +3.831365198e-02f, +4.545054680e-02f, +5.127577001e-02f, +5.513916011e-02f, +5.659104154e-02f, +5.545895049e-02f, +5.187752167e-02f, +4.626513642e-02f, +3.925233583e-02f, +3.157717954e-02f, +2.396921539e-02f, +1.704503934e-02f, +1.123445076e-02f, +6.748179094e-03f, +3.588275667e-03f, +1.593065611e-03f, +5.022154476e-04f, - /* 24, 2 */ +1.328380648e-03f, +3.132379333e-03f, +6.057656813e-03f, +1.028967374e-02f, +1.586133102e-02f, +2.260301890e-02f, +3.012488684e-02f, +3.784089895e-02f, +4.503543229e-02f, +5.096323022e-02f, +5.496495842e-02f, +5.657574693e-02f, +5.560438923e-02f, +5.216645963e-02f, +4.666426010e-02f, +3.971789474e-02f, +3.206210284e-02f, +2.443025293e-02f, +1.744855617e-02f, +1.155988996e-02f, +6.988790100e-03f, +3.749328623e-03f, +1.688282347e-03f, +5.494305796e-04f, - /* 24, 3 */ +1.246901403e-03f, +2.989308098e-03f, +5.837830254e-03f, +9.985325752e-03f, +1.547595434e-02f, +2.215368059e-02f, +2.964217216e-02f, +3.736611920e-02f, +4.461534144e-02f, +5.064310236e-02f, +5.478132634e-02f, +5.655026396e-02f, +5.574009777e-02f, +5.244726189e-02f, +4.705770477e-02f, +4.018068337e-02f, +3.254715574e-02f, +2.489389144e-02f, +1.785641537e-02f, +1.189054572e-02f, +7.234657995e-03f, +3.915018340e-03f, +1.787112015e-03f, +5.991047395e-04f, - /* 24, 4 */ +1.168676301e-03f, +2.850583915e-03f, +5.623126723e-03f, +9.686290690e-03f, +1.509528803e-02f, +2.170757578e-02f, +2.916042250e-02f, +3.688949768e-02f, +4.419045351e-02f, +5.031553118e-02f, +5.458834968e-02f, +5.651460469e-02f, +5.586601230e-02f, +5.271979985e-02f, +4.744529894e-02f, +4.064051541e-02f, +3.303216567e-02f, +2.535999546e-02f, +1.826853297e-02f, +1.222638897e-02f, +7.485801959e-03f, +4.085398290e-03f, +1.889625146e-03f, +6.513091287e-04f, - /* 24, 5 */ +1.093632798e-03f, +2.716144855e-03f, +5.413512274e-03f, +9.392578266e-03f, +1.471939531e-02f, +2.126482169e-02f, +2.867979883e-02f, +3.641121873e-02f, +4.376094899e-02f, +4.998066438e-02f, +5.438611851e-02f, +5.646878599e-02f, +5.598207354e-02f, +5.298394839e-02f, +4.782687301e-02f, +4.109720465e-02f, +3.351695842e-02f, +2.582842673e-02f, +1.868482156e-02f, +1.256738733e-02f, +7.742238512e-03f, +4.260520294e-03f, +1.995891717e-03f, +7.061153220e-04f, - /* 24, 6 */ +1.021698233e-03f, +2.585927824e-03f, +5.208950715e-03f, +9.104195104e-03f, +1.434833590e-02f, +2.082553239e-02f, +2.820045990e-02f, +3.593146595e-02f, +4.332700946e-02f, +4.963865252e-02f, +5.417472708e-02f, +5.641282954e-02f, +5.608822683e-02f, +5.323958602e-02f, +4.820225940e-02f, +4.155056502e-02f, +3.400135826e-02f, +2.629904416e-02f, +1.910519032e-02f, +1.291350505e-02f, +8.003981455e-03f, +4.440434453e-03f, +2.105981077e-03f, +7.635952183e-04f, - /* 24, 7 */ +9.527998831e-04f, +2.459868628e-03f, +5.009403670e-03f, +8.821144768e-03f, +1.398216608e-02f, +2.038981869e-02f, +2.772256216e-02f, +3.545042216e-02f, +4.288881749e-02f, +4.928964888e-02f, +5.395427373e-02f, +5.634676181e-02f, +5.618442211e-02f, +5.348659488e-02f, +4.857129262e-02f, +4.200041076e-02f, +3.448518802e-02f, +2.677170395e-02f, +1.952954505e-02f, +1.326470299e-02f, +8.271041819e-03f, +4.625189083e-03f, +2.219961884e-03f, +8.238209888e-04f, - /* 24, 8 */ +8.868650246e-04f, +2.337902042e-03f, +4.814830642e-03f, +8.543427812e-03f, +1.362093865e-02f, +1.995778816e-02f, +2.724625964e-02f, +3.496826923e-02f, +4.244655653e-02f, +4.893380942e-02f, +5.372486088e-02f, +5.627061400e-02f, +5.627061400e-02f, +5.372486088e-02f, +4.893380942e-02f, +4.244655653e-02f, +3.496826923e-02f, +2.724625964e-02f, +1.995778816e-02f, +1.362093865e-02f, +8.543427812e-03f, +4.814830642e-03f, +2.337902042e-03f, +8.868650246e-04f, - /* 24, 9 */ +8.238209888e-04f, +2.219961884e-03f, +4.625189083e-03f, +8.271041819e-03f, +1.326470299e-02f, +1.952954505e-02f, +2.677170395e-02f, +3.448518802e-02f, +4.200041076e-02f, +4.857129262e-02f, +5.348659488e-02f, +5.618442211e-02f, +5.634676181e-02f, +5.395427373e-02f, +4.928964888e-02f, +4.288881749e-02f, +3.545042216e-02f, +2.772256216e-02f, +2.038981869e-02f, +1.398216608e-02f, +8.821144768e-03f, +5.009403670e-03f, +2.459868628e-03f, +9.527998831e-04f, - /* 24,10 */ +7.635952183e-04f, +2.105981077e-03f, +4.440434453e-03f, +8.003981455e-03f, +1.291350505e-02f, +1.910519032e-02f, +2.629904416e-02f, +3.400135826e-02f, +4.155056502e-02f, +4.820225940e-02f, +5.323958602e-02f, +5.608822683e-02f, +5.641282954e-02f, +5.417472708e-02f, +4.963865252e-02f, +4.332700946e-02f, +3.593146595e-02f, +2.820045990e-02f, +2.082553239e-02f, +1.434833590e-02f, +9.104195104e-03f, +5.208950715e-03f, +2.585927824e-03f, +1.021698233e-03f, - /* 24,11 */ +7.061153220e-04f, +1.995891717e-03f, +4.260520294e-03f, +7.742238512e-03f, +1.256738733e-02f, +1.868482156e-02f, +2.582842673e-02f, +3.351695842e-02f, +4.109720465e-02f, +4.782687301e-02f, +5.298394839e-02f, +5.598207354e-02f, +5.646878599e-02f, +5.438611851e-02f, +4.998066438e-02f, +4.376094899e-02f, +3.641121873e-02f, +2.867979883e-02f, +2.126482169e-02f, +1.471939531e-02f, +9.392578266e-03f, +5.413512274e-03f, +2.716144855e-03f, +1.093632798e-03f, - /* 24,12 */ +6.513091287e-04f, +1.889625146e-03f, +4.085398290e-03f, +7.485801959e-03f, +1.222638897e-02f, +1.826853297e-02f, +2.535999546e-02f, +3.303216567e-02f, +4.064051541e-02f, +4.744529894e-02f, +5.271979985e-02f, +5.586601230e-02f, +5.651460469e-02f, +5.458834968e-02f, +5.031553118e-02f, +4.419045351e-02f, +3.688949768e-02f, +2.916042250e-02f, +2.170757578e-02f, +1.509528803e-02f, +9.686290690e-03f, +5.623126723e-03f, +2.850583915e-03f, +1.168676301e-03f, - /* 24,13 */ +5.991047395e-04f, +1.787112015e-03f, +3.915018340e-03f, +7.234657995e-03f, +1.189054572e-02f, +1.785641537e-02f, +2.489389144e-02f, +3.254715574e-02f, +4.018068337e-02f, +4.705770477e-02f, +5.244726189e-02f, +5.574009777e-02f, +5.655026396e-02f, +5.478132634e-02f, +5.064310236e-02f, +4.461534144e-02f, +3.736611920e-02f, +2.964217216e-02f, +2.215368059e-02f, +1.547595434e-02f, +9.985325752e-03f, +5.837830254e-03f, +2.989308098e-03f, +1.246901403e-03f, - /* 24,14 */ +5.494305796e-04f, +1.688282347e-03f, +3.749328623e-03f, +6.988790100e-03f, +1.155988996e-02f, +1.744855617e-02f, +2.443025293e-02f, +3.206210284e-02f, +3.971789474e-02f, +4.666426010e-02f, +5.216645963e-02f, +5.560438923e-02f, +5.657574693e-02f, +5.496495842e-02f, +5.096323022e-02f, +4.503543229e-02f, +3.784089895e-02f, +3.012488684e-02f, +2.260301890e-02f, +1.586133102e-02f, +1.028967374e-02f, +6.057656813e-03f, +3.132379333e-03f, +1.328380648e-03f, - /* 24,15 */ +5.022154476e-04f, +1.593065611e-03f, +3.588275667e-03f, +6.748179094e-03f, +1.123445076e-02f, +1.704503934e-02f, +2.396921539e-02f, +3.157717954e-02f, +3.925233583e-02f, +4.626513642e-02f, +5.187752167e-02f, +5.545895049e-02f, +5.659104154e-02f, +5.513916011e-02f, +5.127577001e-02f, +4.545054680e-02f, +3.831365198e-02f, +3.060840342e-02f, +2.305547031e-02f, +1.625135142e-02f, +1.059932179e-02f, +6.282638036e-03f, +3.279858311e-03f, +1.413186400e-03f, - /* 24, 0 */ -2.629184871e-03f, -4.843950453e-03f, -6.895985300e-03f, -7.687208098e-03f, -5.978262553e-03f, -8.032174656e-04f, +8.095316761e-03f, +1.997958831e-02f, +3.311864145e-02f, +4.512644231e-02f, +5.356009950e-02f, +5.659614054e-02f, +5.356009950e-02f, +4.512644231e-02f, +3.311864145e-02f, +1.997958831e-02f, +8.095316761e-03f, -8.032174656e-04f, -5.978262553e-03f, -7.687208098e-03f, -6.895985300e-03f, -4.843950453e-03f, -2.629184871e-03f, -9.454953712e-04f, - /* 24, 1 */ -2.503767166e-03f, -4.700731697e-03f, -6.791825424e-03f, -7.698565601e-03f, -6.179328945e-03f, -1.237726578e-03f, +7.438688744e-03f, +1.917778123e-02f, +3.230413198e-02f, +4.445707943e-02f, +5.317715832e-02f, +5.658405316e-02f, +5.392156860e-02f, +4.578163621e-02f, +3.392875410e-02f, +2.078652132e-02f, +8.763945305e-03f, -3.538276542e-04f, -5.763420347e-03f, -7.665996832e-03f, -6.995273095e-03f, -4.986674025e-03f, -2.756835384e-03f, -1.028686673e-03f, - /* 24, 2 */ -2.380688695e-03f, -4.557243028e-03f, -6.683099486e-03f, -7.700368745e-03f, -6.366798820e-03f, -1.657314491e-03f, +6.794365087e-03f, +1.838162773e-02f, +3.148585651e-02f, +4.377411309e-02f, +5.277308334e-02f, +5.654780182e-02f, +5.426124576e-02f, +4.642210542e-02f, +3.473383802e-02f, +2.159804191e-02f, +9.444254477e-03f, +1.103863968e-04f, -5.534634231e-03f, -7.634636496e-03f, -7.089380216e-03f, -5.128670417e-03f, -2.886604737e-03f, -1.114962551e-03f, - /* 24, 3 */ -2.260048394e-03f, -4.413702845e-03f, -6.570110572e-03f, -7.692920583e-03f, -6.540862270e-03f, -2.061956485e-03f, +6.162633403e-03f, +1.759164425e-02f, +3.066444409e-02f, +4.307811806e-02f, +5.234823086e-02f, +5.648741902e-02f, +5.457882991e-02f, +4.704730472e-02f, +3.553326091e-02f, +2.241360152e-02f, +1.013590849e-02f, +5.893521078e-04f, -5.291747706e-03f, -7.592836347e-03f, -7.177995846e-03f, -5.269701073e-03f, -3.018371382e-03f, -1.204312280e-03f, - /* 24, 4 */ -2.141937776e-03f, -4.270322542e-03f, -6.453158507e-03f, -7.676527355e-03f, -6.701719772e-03f, -2.451643421e-03f, +5.543764951e-03f, +1.680833562e-02f, +2.984052134e-02f, +4.236967758e-02f, +5.190297478e-02f, +5.640295884e-02f, +5.487403917e-02f, +4.765670002e-02f, +3.632639074e-02f, +2.323264190e-02f, +1.083855586e-02f, +1.082980638e-03f, -5.034616251e-03f, -7.540310660e-03f, -7.260807322e-03f, -5.409521052e-03f, -3.152006158e-03f, -1.296719170e-03f, - /* 24, 5 */ -2.026441000e-03f, -4.127306381e-03f, -6.332539518e-03f, -7.651498041e-03f, -6.849581767e-03f, -2.826381528e-03f, +4.938014526e-03f, +1.603219452e-02f, +2.901471178e-02f, +4.164938279e-02f, +5.143770614e-02f, +5.629449693e-02f, +5.514661113e-02f, +4.824976895e-02f, +3.711259647e-02f, +2.405459566e-02f, +1.155182965e-02f, +1.591166761e-03f, -4.763107701e-03f, -7.476779193e-03f, -7.337500507e-03f, -5.547879217e-03f, -3.287372274e-03f, -1.392160404e-03f, - /* 24, 6 */ -1.913634953e-03f, -3.984851387e-03f, -6.208545927e-03f, -7.618143912e-03f, -6.984668233e-03f, -3.186192169e-03f, +4.345620369e-03f, +1.526370115e-02f, +2.818763519e-02f, +4.091783200e-02f, +5.095283267e-02f, +5.616213037e-02f, +5.539630322e-02f, +4.882600150e-02f, +3.789124869e-02f, +2.487888677e-02f, +1.227534767e-02f, +2.113788767e-03f, -4.477102606e-03f, -7.401967644e-03f, -7.407760182e-03f, -5.684518438e-03f, -3.424325302e-03f, -1.490606880e-03f, - /* 24, 7 */ -1.803589350e-03f, -3.843147252e-03f, -6.081465840e-03f, -7.576778087e-03f, -7.107208249e-03f, -3.531111592e-03f, +3.766804102e-03f, +1.450332275e-02f, +2.735990694e-02f, +4.017563005e-02f, +5.044877831e-02f, +5.600597761e-02f, +5.562289296e-02f, +4.938490059e-02f, +3.866172039e-02f, +2.570493119e-02f, +1.300871280e-02f, +2.650708377e-03f, -4.176494585e-03f, -7.315608112e-03f, -7.471270440e-03f, -5.819175805e-03f, -3.562713186e-03f, -1.592023060e-03f, - /* 24, 8 */ -1.696366827e-03f, -3.702376254e-03f, -5.951582861e-03f, -7.527715094e-03f, -7.217439556e-03f, -3.861190662e-03f, +3.201770681e-03f, +1.375151322e-02f, +2.653213738e-02f, +3.942338759e-02f, +4.992598268e-02f, +5.582617825e-02f, +5.582617825e-02f, +4.992598268e-02f, +3.942338759e-02f, +2.653213738e-02f, +1.375151322e-02f, +3.201770681e-03f, -3.861190662e-03f, -7.217439556e-03f, -7.527715094e-03f, -5.951582861e-03f, -3.702376254e-03f, -1.696366827e-03f, - /* 24, 9 */ -1.592023060e-03f, -3.562713186e-03f, -5.819175805e-03f, -7.471270440e-03f, -7.315608112e-03f, -4.176494585e-03f, +2.650708377e-03f, +1.300871280e-02f, +2.570493119e-02f, +3.866172039e-02f, +4.938490059e-02f, +5.562289296e-02f, +5.600597761e-02f, +5.044877831e-02f, +4.017563005e-02f, +2.735990694e-02f, +1.450332275e-02f, +3.766804102e-03f, -3.531111592e-03f, -7.107208249e-03f, -7.576778087e-03f, -6.081465840e-03f, -3.843147252e-03f, -1.803589350e-03f, - /* 24,10 */ -1.490606880e-03f, -3.424325302e-03f, -5.684518438e-03f, -7.407760182e-03f, -7.401967644e-03f, -4.477102606e-03f, +2.113788767e-03f, +1.227534767e-02f, +2.487888677e-02f, +3.789124869e-02f, +4.882600150e-02f, +5.539630322e-02f, +5.616213037e-02f, +5.095283267e-02f, +4.091783200e-02f, +2.818763519e-02f, +1.526370115e-02f, +4.345620369e-03f, -3.186192169e-03f, -6.984668233e-03f, -7.618143912e-03f, -6.208545927e-03f, -3.984851387e-03f, -1.913634953e-03f, - /* 24,11 */ -1.392160404e-03f, -3.287372274e-03f, -5.547879217e-03f, -7.337500507e-03f, -7.476779193e-03f, -4.763107701e-03f, +1.591166761e-03f, +1.155182965e-02f, +2.405459566e-02f, +3.711259647e-02f, +4.824976895e-02f, +5.514661113e-02f, +5.629449693e-02f, +5.143770614e-02f, +4.164938279e-02f, +2.901471178e-02f, +1.603219452e-02f, +4.938014526e-03f, -2.826381528e-03f, -6.849581767e-03f, -7.651498041e-03f, -6.332539518e-03f, -4.127306381e-03f, -2.026441000e-03f, - /* 24,12 */ -1.296719170e-03f, -3.152006158e-03f, -5.409521052e-03f, -7.260807322e-03f, -7.540310660e-03f, -5.034616251e-03f, +1.082980638e-03f, +1.083855586e-02f, +2.323264190e-02f, +3.632639074e-02f, +4.765670002e-02f, +5.487403917e-02f, +5.640295884e-02f, +5.190297478e-02f, +4.236967758e-02f, +2.984052134e-02f, +1.680833562e-02f, +5.543764951e-03f, -2.451643421e-03f, -6.701719772e-03f, -7.676527355e-03f, -6.453158507e-03f, -4.270322542e-03f, -2.141937776e-03f, - /* 24,13 */ -1.204312280e-03f, -3.018371382e-03f, -5.269701073e-03f, -7.177995846e-03f, -7.592836347e-03f, -5.291747706e-03f, +5.893521078e-04f, +1.013590849e-02f, +2.241360152e-02f, +3.553326091e-02f, +4.704730472e-02f, +5.457882991e-02f, +5.648741902e-02f, +5.234823086e-02f, +4.307811806e-02f, +3.066444409e-02f, +1.759164425e-02f, +6.162633403e-03f, -2.061956485e-03f, -6.540862270e-03f, -7.692920583e-03f, -6.570110572e-03f, -4.413702845e-03f, -2.260048394e-03f, - /* 24,14 */ -1.114962551e-03f, -2.886604737e-03f, -5.128670417e-03f, -7.089380216e-03f, -7.634636496e-03f, -5.534634231e-03f, +1.103863968e-04f, +9.444254477e-03f, +2.159804191e-02f, +3.473383802e-02f, +4.642210542e-02f, +5.426124576e-02f, +5.654780182e-02f, +5.277308334e-02f, +4.377411309e-02f, +3.148585651e-02f, +1.838162773e-02f, +6.794365087e-03f, -1.657314491e-03f, -6.366798820e-03f, -7.700368745e-03f, -6.683099486e-03f, -4.557243028e-03f, -2.380688695e-03f, - /* 24,15 */ -1.028686673e-03f, -2.756835384e-03f, -4.986674025e-03f, -6.995273095e-03f, -7.665996832e-03f, -5.763420347e-03f, -3.538276542e-04f, +8.763945305e-03f, +2.078652132e-02f, +3.392875410e-02f, +4.578163621e-02f, +5.392156860e-02f, +5.658405316e-02f, +5.317715832e-02f, +4.445707943e-02f, +3.230413198e-02f, +1.917778123e-02f, +7.438688744e-03f, -1.237726578e-03f, -6.179328945e-03f, -7.698565601e-03f, -6.791825424e-03f, -4.700731697e-03f, -2.503767166e-03f, - /* 24, 0 */ +4.735641749e-04f, -1.438577362e-03f, -6.107076473e-03f, -1.318715065e-02f, -2.047716119e-02f, -2.428668798e-02f, -2.088952800e-02f, -8.512165320e-03f, +1.117510535e-02f, +3.302575560e-02f, +5.012757987e-02f, +5.659614054e-02f, +5.012757987e-02f, +3.302575560e-02f, +1.117510535e-02f, -8.512165320e-03f, -2.088952800e-02f, -2.428668798e-02f, -2.047716119e-02f, -1.318715065e-02f, -6.107076473e-03f, -1.438577362e-03f, +4.735641749e-04f, +5.516063288e-04f, - /* 24, 1 */ +5.190146993e-04f, -1.243445781e-03f, -5.732182665e-03f, -1.270621714e-02f, -2.008108462e-02f, -2.422674988e-02f, -2.136190754e-02f, -9.536491055e-03f, +9.813857768e-03f, +3.172645287e-02f, +4.932296812e-02f, +5.657007725e-02f, +5.088942272e-02f, +3.430616434e-02f, +1.254542812e-02f, -7.458075491e-03f, -2.038088472e-02f, -2.431781992e-02f, -2.085968072e-02f, -1.366943909e-02f, -6.492037400e-03f, -1.644903025e-03f, +4.208638005e-04f, +5.761542752e-04f, - /* 24, 2 */ +5.575380238e-04f, -1.059370463e-03f, -5.367638258e-03f, -1.222740313e-02f, -1.967247249e-02f, -2.413881461e-02f, -2.179812108e-02f, -1.053019587e-02f, +8.463295193e-03f, +3.041001010e-02f, +4.847674006e-02f, +5.649192540e-02f, +5.160740292e-02f, +3.556594146e-02f, +1.392318625e-02f, -6.375136316e-03f, -1.983593655e-02f, -2.431936776e-02f, -2.122761958e-02f, -1.415229209e-02f, -6.886752185e-03f, -1.862540304e-03f, +3.605947820e-04f, +5.982066157e-04f, - /* 24, 3 */ +5.894596941e-04f, -8.861942853e-04f, -5.013694839e-03f, -1.175144649e-02f, -1.925234223e-02f, -2.402372023e-02f, -2.219832191e-02f, -1.149248169e-02f, +7.124994951e-03f, +2.907819451e-02f, +4.759010507e-02f, +5.636179897e-02f, +5.228048761e-02f, +3.680336864e-02f, +1.530671242e-02f, -5.264319552e-03f, -1.925469982e-02f, -2.429058667e-02f, -2.157995394e-02f, -1.463489443e-02f, -7.290876362e-03f, -2.091585491e-03f, +2.924431607e-04f, +6.174753085e-04f, - /* 24, 4 */ +6.151072142e-04f, -7.237418200e-04f, -4.670573645e-03f, -1.127905759e-02f, -1.882170532e-02f, -2.388233174e-02f, -2.256271775e-02f, -1.242260980e-02f, +5.800499486e-03f, +2.773278351e-02f, +4.666432713e-02f, +5.617988770e-02f, +5.290770668e-02f, +3.801674993e-02f, +1.669431448e-02f, -4.126652928e-03f, -1.863724919e-02f, -2.423076690e-02f, -2.191566174e-02f, -1.511640714e-02f, -7.704034115e-03f, -2.332112699e-03f, +2.161008111e-04f, +6.336652968e-04f, - /* 24, 5 */ +6.348091316e-04f, -5.718203517e-04f, -4.338465973e-03f, -1.081091853e-02f, -1.838156554e-02f, -2.371553901e-02f, -2.289156957e-02f, -1.331990148e-02f, +4.491314051e-03f, +2.637556170e-02f, +4.570072248e-02f, +5.594645674e-02f, +5.348815454e-02f, +3.920441468e-02f, +1.808427811e-02f, -2.963218986e-03f, -1.798371833e-02f, -2.413923574e-02f, -2.223372473e-02f, -1.559596853e-02f, -8.125818185e-03f, -2.584172964e-03f, +1.312664533e-04f, +6.464750685e-04f, - /* 24, 6 */ +6.488941487e-04f, -4.302209069e-04f, -4.017533648e-03f, -1.034768250e-02f, -1.793291714e-02f, -2.352425464e-02f, -2.318519030e-02f, -1.418373842e-02f, +3.198904487e-03f, +2.500831779e-02f, +4.470065727e-02f, +5.566184614e-02f, +5.402099181e-02f, +4.036472049e-02f, +1.947486957e-02f, -1.775153809e-03f, -1.729430055e-02f, -2.401535937e-02f, -2.253313051e-02f, -1.607269547e-02f, -8.555789856e-03f, -2.847793367e-03f, +3.764667972e-05f, +6.555972530e-04f, - /* 24, 7 */ +6.576902611e-04f, -2.987192943e-04f, -3.707909539e-03f, -9.889973186e-03f, -1.747674315e-02f, -2.330941189e-02f, -2.344394342e-02f, -1.501356300e-02f, +1.924695104e-03f, +2.363284155e-02f, +4.366554511e-02f, +5.532647026e-02f, +5.450544680e-02f, +4.149605616e-02f, +2.086433852e-02f, -5.636456344e-04f, -1.656924930e-02f, -2.385854478e-02f, -2.281287459e-02f, -1.654568462e-02f, -8.993479016e-03f, -3.122976195e-03f, -6.504300803e-05f, +6.607192554e-04f, - /* 24, 8 */ +6.615239252e-04f, -1.770771536e-04f, -3.409698141e-03f, -9.438384277e-03f, -1.701401374e-02f, -2.307196251e-02f, -2.366824152e-02f, -1.580887853e-02f, +6.700666468e-04f, +2.225092083e-02f, +4.259684448e-02f, +5.494081698e-02f, +5.494081698e-02f, +4.259684448e-02f, +2.225092083e-02f, +6.700666468e-04f, -1.580887853e-02f, -2.366824152e-02f, -2.307196251e-02f, -1.701401374e-02f, -9.438384277e-03f, -3.409698141e-03f, -1.770771536e-04f, +6.615239252e-04f, - /* 24, 9 */ +6.607192554e-04f, -6.504300803e-05f, -3.122976195e-03f, -8.993479016e-03f, -1.654568462e-02f, -2.281287459e-02f, -2.385854478e-02f, -1.656924930e-02f, -5.636456344e-04f, +2.086433852e-02f, +4.149605616e-02f, +5.450544680e-02f, +5.532647026e-02f, +4.366554511e-02f, +2.363284155e-02f, +1.924695104e-03f, -1.501356300e-02f, -2.344394342e-02f, -2.330941189e-02f, -1.747674315e-02f, -9.889973186e-03f, -3.707909539e-03f, -2.987192943e-04f, +6.576902611e-04f, - /* 24,10 */ +6.555972530e-04f, +3.764667972e-05f, -2.847793367e-03f, -8.555789856e-03f, -1.607269547e-02f, -2.253313051e-02f, -2.401535937e-02f, -1.729430055e-02f, -1.775153809e-03f, +1.947486957e-02f, +4.036472049e-02f, +5.402099181e-02f, +5.566184614e-02f, +4.470065727e-02f, +2.500831779e-02f, +3.198904487e-03f, -1.418373842e-02f, -2.318519030e-02f, -2.352425464e-02f, -1.793291714e-02f, -1.034768250e-02f, -4.017533648e-03f, -4.302209069e-04f, +6.488941487e-04f, - /* 24,11 */ +6.464750685e-04f, +1.312664533e-04f, -2.584172964e-03f, -8.125818185e-03f, -1.559596853e-02f, -2.223372473e-02f, -2.413923574e-02f, -1.798371833e-02f, -2.963218986e-03f, +1.808427811e-02f, +3.920441468e-02f, +5.348815454e-02f, +5.594645674e-02f, +4.570072248e-02f, +2.637556170e-02f, +4.491314051e-03f, -1.331990148e-02f, -2.289156957e-02f, -2.371553901e-02f, -1.838156554e-02f, -1.081091853e-02f, -4.338465973e-03f, -5.718203517e-04f, +6.348091316e-04f, - /* 24,12 */ +6.336652968e-04f, +2.161008111e-04f, -2.332112699e-03f, -7.704034115e-03f, -1.511640714e-02f, -2.191566174e-02f, -2.423076690e-02f, -1.863724919e-02f, -4.126652928e-03f, +1.669431448e-02f, +3.801674993e-02f, +5.290770668e-02f, +5.617988770e-02f, +4.666432713e-02f, +2.773278351e-02f, +5.800499486e-03f, -1.242260980e-02f, -2.256271775e-02f, -2.388233174e-02f, -1.882170532e-02f, -1.127905759e-02f, -4.670573645e-03f, -7.237418200e-04f, +6.151072142e-04f, - /* 24,13 */ +6.174753085e-04f, +2.924431607e-04f, -2.091585491e-03f, -7.290876362e-03f, -1.463489443e-02f, -2.157995394e-02f, -2.429058667e-02f, -1.925469982e-02f, -5.264319552e-03f, +1.530671242e-02f, +3.680336864e-02f, +5.228048761e-02f, +5.636179897e-02f, +4.759010507e-02f, +2.907819451e-02f, +7.124994951e-03f, -1.149248169e-02f, -2.219832191e-02f, -2.402372023e-02f, -1.925234223e-02f, -1.175144649e-02f, -5.013694839e-03f, -8.861942853e-04f, +5.894596941e-04f, - /* 24,14 */ +5.982066157e-04f, +3.605947820e-04f, -1.862540304e-03f, -6.886752185e-03f, -1.415229209e-02f, -2.122761958e-02f, -2.431936776e-02f, -1.983593655e-02f, -6.375136316e-03f, +1.392318625e-02f, +3.556594146e-02f, +5.160740292e-02f, +5.649192540e-02f, +4.847674006e-02f, +3.041001010e-02f, +8.463295193e-03f, -1.053019587e-02f, -2.179812108e-02f, -2.413881461e-02f, -1.967247249e-02f, -1.222740313e-02f, -5.367638258e-03f, -1.059370463e-03f, +5.575380238e-04f, - /* 24,15 */ +5.761542752e-04f, +4.208638005e-04f, -1.644903025e-03f, -6.492037400e-03f, -1.366943909e-02f, -2.085968072e-02f, -2.431781992e-02f, -2.038088472e-02f, -7.458075491e-03f, +1.254542812e-02f, +3.430616434e-02f, +5.088942272e-02f, +5.657007725e-02f, +4.932296812e-02f, +3.172645287e-02f, +9.813857768e-03f, -9.536491055e-03f, -2.136190754e-02f, -2.422674988e-02f, -2.008108462e-02f, -1.270621714e-02f, -5.732182665e-03f, -1.243445781e-03f, +5.190146993e-04f, - /* 24, 0 */ +2.273459443e-03f, +5.435907648e-03f, +7.255296399e-03f, +3.788129032e-03f, -7.144684562e-03f, -2.265374973e-02f, -3.442368170e-02f, -3.287677614e-02f, -1.387331771e-02f, +1.679264590e-02f, +4.511451955e-02f, +5.659614054e-02f, +4.511451955e-02f, +1.679264590e-02f, -1.387331771e-02f, -3.287677614e-02f, -3.442368170e-02f, -2.265374973e-02f, -7.144684562e-03f, +3.788129032e-03f, +7.255296399e-03f, +5.435907648e-03f, +2.273459443e-03f, +3.568431303e-04f, - /* 24, 1 */ +2.103234406e-03f, +5.239407106e-03f, +7.256400195e-03f, +4.221207454e-03f, -6.266228991e-03f, -2.168841690e-02f, -3.399213075e-02f, -3.348773370e-02f, -1.551504116e-02f, +1.477681868e-02f, +4.371373211e-02f, +5.654911556e-02f, +4.644656718e-02f, +1.879953521e-02f, -1.218307761e-02f, -3.219410560e-02f, -3.480135038e-02f, -2.360501860e-02f, -8.042999544e-03f, +3.324105568e-03f, +7.232988111e-03f, +5.627714430e-03f, +2.449385040e-03f, +4.247055554e-04f, - /* 24, 2 */ +1.939021806e-03f, +5.039131826e-03f, +7.237298926e-03f, +4.623451366e-03f, -5.409068119e-03f, -2.071157693e-02f, -3.350883303e-02f, -3.402698064e-02f, -1.710557364e-02f, +1.275612557e-02f, +4.224725679e-02f, +5.640814528e-02f, +4.770696520e-02f, +2.079340350e-02f, -1.044713814e-02f, -3.143988919e-02f, -3.512309015e-02f, -2.453963953e-02f, -8.959642554e-03f, +2.829112073e-03f, +7.188501693e-03f, +5.813881008e-03f, +2.630658922e-03f, +4.992251326e-04f, - /* 24, 3 */ +1.781093672e-03f, +4.835971292e-03f, +7.199013760e-03f, +4.995053998e-03f, -4.574539506e-03f, -1.972575310e-02f, -3.297600576e-02f, -3.449468646e-02f, -1.864238902e-02f, +1.073461753e-02f, +4.071827965e-02f, +5.617354343e-02f, +4.889295364e-02f, +2.277016679e-02f, -8.668453837e-03f, -3.061446547e-02f, -3.538695026e-02f, -2.545500791e-02f, -9.892988076e-03f, +2.303211764e-03f, +7.120893393e-03f, +5.993435804e-03f, +2.816887995e-03f, +5.805470381e-04f, - /* 24, 4 */ +1.629682882e-03f, +4.630783503e-03f, +7.142583584e-03f, +5.336288236e-03f, -3.763881685e-03f, -1.873342898e-02f, -3.239594057e-02f, -3.489118499e-02f, -2.012311412e-02f, +8.716314532e-03f, +3.913011251e-02f, +5.584583195e-02f, +5.000192959e-02f, +2.472575033e-02f, -6.850110412e-03f, -2.971834586e-02f, -3.559108276e-02f, -2.634850527e-02f, -1.084131876e-02f, +1.746558492e-03f, +7.029253460e-03f, +6.165384566e-03f, +3.007638074e-03f, +6.687931554e-04f, - /* 24, 5 */ +1.484983972e-03f, +4.424393216e-03f, +7.069061064e-03f, +5.647503405e-03f, -2.978233194e-03f, -1.773704257e-02f, -3.177099609e-02f, -3.521697115e-02f, -2.154553308e-02f, +6.705195776e-03f, +3.748618427e-02f, +5.542573963e-02f, +5.103145416e-02f, +2.665609886e-02f, -4.995318215e-03f, -2.875221569e-02f, -3.573374914e-02f, -2.721750622e-02f, -1.180282806e-02f, +1.159398961e-03f, +6.912710257e-03f, +6.328712988e-03f, +3.202433762e-03f, +7.640603932e-04f, - /* 24, 6 */ +1.347154069e-03f, +4.217590351e-03f, +6.979508760e-03f, +5.929121902e-03f, -2.218631929e-03f, -1.673898061e-02f, -3.110359053e-02f, -3.547269735e-02f, -2.290759116e-02f, +4.705190128e-03f, +3.579003198e-02f, +5.491420012e-02f, +5.197925890e-02f, +2.855718684e-02f, -3.107405323e-03f, -2.771693469e-02f, -3.581332680e-02f, -2.805938547e-02f, -1.277562317e-02f, +5.420746921e-04f, +6.770434377e-03f, +6.482389493e-03f, +3.400758480e-03f, +8.664190421e-04f, - /* 24, 7 */ +1.216313935e-03f, +4.011128586e-03f, +6.874995333e-03f, +6.181635683e-03f, -1.486014823e-03f, -1.574157316e-02f, -3.039619415e-02f, -3.565916944e-02f, -2.420739811e-02f, +2.720166717e-03f, +3.404529163e-02f, +5.431234943e-02f, +5.284325182e-02f, +3.042502866e-02f, -1.189810237e-03f, -2.661353708e-02f, -3.582831530e-02f, -2.887152508e-02f, -1.375772836e-02f, -1.049762569e-04f, +6.601642735e-03f, +6.625368167e-03f, +3.602054665e-03f, +9.759111772e-04f, - /* 24, 8 */ +1.092549115e-03f, +3.805724130e-03f, +6.756591845e-03f, +6.405602617e-03f, -7.812178358e-04f, -1.474708852e-02f, -2.965132174e-02f, -3.577734234e-02f, -2.544323110e-02f, +7.539257812e-04f, +3.225568873e-02f, +5.362152294e-02f, +5.362152294e-02f, +3.225568873e-02f, +7.539257812e-04f, -2.544323110e-02f, -3.577734234e-02f, -2.965132174e-02f, -1.474708852e-02f, -7.812178358e-04f, +6.405602617e-03f, +6.756591845e-03f, +3.805724130e-03f, +1.092549115e-03f, - /* 24, 9 */ +9.759111772e-04f, +3.602054665e-03f, +6.625368167e-03f, +6.601642735e-03f, -1.049762569e-04f, -1.375772836e-02f, -2.887152508e-02f, -3.582831530e-02f, -2.661353708e-02f, -1.189810237e-03f, +3.042502866e-02f, +5.284325182e-02f, +5.431234943e-02f, +3.404529163e-02f, +2.720166717e-03f, -2.420739811e-02f, -3.565916944e-02f, -3.039619415e-02f, -1.574157316e-02f, -1.486014823e-03f, +6.181635683e-03f, +6.874995333e-03f, +4.011128586e-03f, +1.216313935e-03f, - /* 24,10 */ +8.664190421e-04f, +3.400758480e-03f, +6.482389493e-03f, +6.770434377e-03f, +5.420746921e-04f, -1.277562317e-02f, -2.805938547e-02f, -3.581332680e-02f, -2.771693469e-02f, -3.107405323e-03f, +2.855718684e-02f, +5.197925890e-02f, +5.491420012e-02f, +3.579003198e-02f, +4.705190128e-03f, -2.290759116e-02f, -3.547269735e-02f, -3.110359053e-02f, -1.673898061e-02f, -2.218631929e-03f, +5.929121902e-03f, +6.979508760e-03f, +4.217590351e-03f, +1.347154069e-03f, - /* 24,11 */ +7.640603932e-04f, +3.202433762e-03f, +6.328712988e-03f, +6.912710257e-03f, +1.159398961e-03f, -1.180282806e-02f, -2.721750622e-02f, -3.573374914e-02f, -2.875221569e-02f, -4.995318215e-03f, +2.665609886e-02f, +5.103145416e-02f, +5.542573963e-02f, +3.748618427e-02f, +6.705195776e-03f, -2.154553308e-02f, -3.521697115e-02f, -3.177099609e-02f, -1.773704257e-02f, -2.978233194e-03f, +5.647503405e-03f, +7.069061064e-03f, +4.424393216e-03f, +1.484983972e-03f, - /* 24,12 */ +6.687931554e-04f, +3.007638074e-03f, +6.165384566e-03f, +7.029253460e-03f, +1.746558492e-03f, -1.084131876e-02f, -2.634850527e-02f, -3.559108276e-02f, -2.971834586e-02f, -6.850110412e-03f, +2.472575033e-02f, +5.000192959e-02f, +5.584583195e-02f, +3.913011251e-02f, +8.716314532e-03f, -2.012311412e-02f, -3.489118499e-02f, -3.239594057e-02f, -1.873342898e-02f, -3.763881685e-03f, +5.336288236e-03f, +7.142583584e-03f, +4.630783503e-03f, +1.629682882e-03f, - /* 24,13 */ +5.805470381e-04f, +2.816887995e-03f, +5.993435804e-03f, +7.120893393e-03f, +2.303211764e-03f, -9.892988076e-03f, -2.545500791e-02f, -3.538695026e-02f, -3.061446547e-02f, -8.668453837e-03f, +2.277016679e-02f, +4.889295364e-02f, +5.617354343e-02f, +4.071827965e-02f, +1.073461753e-02f, -1.864238902e-02f, -3.449468646e-02f, -3.297600576e-02f, -1.972575310e-02f, -4.574539506e-03f, +4.995053998e-03f, +7.199013760e-03f, +4.835971292e-03f, +1.781093672e-03f, - /* 24,14 */ +4.992251326e-04f, +2.630658922e-03f, +5.813881008e-03f, +7.188501693e-03f, +2.829112073e-03f, -8.959642554e-03f, -2.453963953e-02f, -3.512309015e-02f, -3.143988919e-02f, -1.044713814e-02f, +2.079340350e-02f, +4.770696520e-02f, +5.640814528e-02f, +4.224725679e-02f, +1.275612557e-02f, -1.710557364e-02f, -3.402698064e-02f, -3.350883303e-02f, -2.071157693e-02f, -5.409068119e-03f, +4.623451366e-03f, +7.237298926e-03f, +5.039131826e-03f, +1.939021806e-03f, - /* 24,15 */ +4.247055554e-04f, +2.449385040e-03f, +5.627714430e-03f, +7.232988111e-03f, +3.324105568e-03f, -8.042999544e-03f, -2.360501860e-02f, -3.480135038e-02f, -3.219410560e-02f, -1.218307761e-02f, +1.879953521e-02f, +4.644656718e-02f, +5.654911556e-02f, +4.371373211e-02f, +1.477681868e-02f, -1.551504116e-02f, -3.348773370e-02f, -3.399213075e-02f, -2.168841690e-02f, -6.266228991e-03f, +4.221207454e-03f, +7.256400195e-03f, +5.239407106e-03f, +2.103234406e-03f, - /* 24, 0 */ -2.181310192e-03f, -7.982329251e-04f, +5.680209618e-03f, +1.430719659e-02f, +1.589843483e-02f, +2.406871994e-03f, -2.249676846e-02f, -4.130100690e-02f, -3.506718353e-02f, -1.541681908e-03f, +3.867898214e-02f, +5.659614054e-02f, +3.867898214e-02f, -1.541681908e-03f, -3.506718353e-02f, -4.130100690e-02f, -2.249676846e-02f, +2.406871994e-03f, +1.589843483e-02f, +1.430719659e-02f, +5.680209618e-03f, -7.982329251e-04f, -2.181310192e-03f, -9.324150638e-04f, - /* 24, 1 */ -2.142117633e-03f, -1.026327303e-03f, +5.144075019e-03f, +1.386145083e-02f, +1.619749380e-02f, +3.702669669e-03f, -2.089125129e-02f, -4.071342524e-02f, -3.635626763e-02f, -4.137848013e-03f, +3.654904222e-02f, +5.652117066e-02f, +4.071616274e-02f, +1.083860427e-03f, -3.366302266e-02f, -4.178478525e-02f, -2.407924887e-02f, +1.061252794e-03f, +1.553625174e-02f, +1.472529111e-02f, +6.227191439e-03f, -5.482915187e-04f, -2.210193915e-03f, -1.021372070e-03f, - /* 24, 2 */ -2.093579858e-03f, -1.232841058e-03f, +4.620399561e-03f, +1.339085359e-02f, +1.643462496e-02f, +4.945866528e-03f, -1.926829204e-02f, -4.002576024e-02f, -3.752797769e-02f, -6.697199080e-03f, +3.433305089e-02f, +5.629650283e-02f, +4.265414906e-02f, +3.731182183e-03f, -3.214649405e-02f, -4.216132985e-02f, -2.563305646e-02f, -3.311524193e-04f, +1.510995111e-02f, +1.511293981e-02f, +6.783287607e-03f, -2.763303743e-04f, -2.227804667e-03f, -1.112061839e-03f, - /* 24, 3 */ -2.036654869e-03f, -1.418128950e-03f, +4.110671651e-03f, +1.289819803e-02f, +1.661121711e-02f, +6.133943976e-03f, -1.763342417e-02f, -3.924200344e-02f, -3.858043162e-02f, -9.212479159e-03f, +3.203796457e-02f, +5.592286159e-02f, +4.448680259e-02f, +6.392554173e-03f, -3.052071354e-02f, -4.242751674e-02f, -2.715253413e-02f, -1.767057534e-03f, +1.461875233e-02f, +1.546736546e-02f, +7.346647501e-03f, +1.772445414e-05f, -2.233183138e-03f, -1.203936109e-03f, - /* 24, 4 */ -1.972290178e-03f, -1.582628528e-03f, +3.616254280e-03f, +1.238625918e-02f, +1.672884047e-02f, +7.264647438e-03f, -1.599210066e-02f, -3.836639935e-02f, -3.951216427e-02f, -1.167663915e-02f, +2.967096294e-02f, +5.540145153e-02f, +4.620830373e-02f, +9.060141131e-03f, -2.878919714e-02f, -4.258054458e-02f, -2.863202454e-02f, -3.242932618e-03f, +1.406209682e-02f, +1.578582064e-02f, +7.915306646e-03f, +3.338433846e-04f, -2.225380377e-03f, -1.296401007e-03f, - /* 24, 5 */ -1.901418208e-03f, -1.726854356e-03f, +3.138383775e-03f, +1.185778300e-02f, +1.678923519e-02f, +8.335988548e-03f, -1.434967550e-02f, -3.740342600e-02f, -4.032212766e-02f, -1.408285985e-02f, +2.723942290e-02f, +5.473395280e-02f, +4.781317317e-02f, +1.172602857e-02f, -2.695585286e-02f, -4.261794963e-02f, -3.006589126e-02f, -4.755011838e-03f, +1.343965653e-02f, +1.606560041e-02f, +8.487191262e-03f, +6.718888821e-04f, -2.203463508e-03f, -1.388818223e-03f, - /* 24, 6 */ -1.824951954e-03f, -1.851392085e-03f, +2.678169173e-03f, +1.131547576e-02f, +1.679429951e-02f, +9.346246206e-03f, -1.271138577e-02f, -3.635777499e-02f, -4.100968953e-02f, -1.642457396e-02f, +2.475089197e-02f, +5.392251484e-02f, +4.929629202e-02f, +1.438225015e-02f, -2.502497093e-02f, -4.253761970e-02f, -3.144854025e-02f, -6.299302508e-03f, +1.275134172e-02f, +1.630405519e-02f, +9.060123484e-03f, +1.031611407e-03f, -2.166521604e-03f, -1.480506488e-03f, - /* 24, 7 */ -1.743780953e-03f, -1.956892396e-03f, +2.236592212e-03f, +1.076199396e-02f, +1.674607744e-02f, +1.029396653e-02f, -1.108233467e-02f, -3.523433096e-02f, -4.157463041e-02f, -1.869548696e-02f, +2.221306113e-02f, +5.296974848e-02f, +5.065292065e-02f, +1.702081530e-02f, -2.300121251e-02f, -4.233780689e-02f, -3.277444146e-02f, -7.871595256e-03f, +1.199730786e-02f, +1.649860375e-02f, +9.631827247e-03f, +1.412645767e-03f, -2.113671692e-03f, -1.570743396e-03f, - /* 24, 8 */ -1.658767534e-03f, -2.044064852e-03f, +1.814507917e-03f, +1.019993481e-02f, +1.664674627e-02f, +1.117796172e-02f, -9.467475281e-03f, -3.403815061e-02f, -4.201713914e-02f, -2.088959684e-02f, +1.963373727e-02f, +5.187871616e-02f, +5.187871616e-02f, +1.963373727e-02f, -2.088959684e-02f, -4.201713914e-02f, -3.403815061e-02f, -9.467475281e-03f, +1.117796172e-02f, +1.664674627e-02f, +1.019993481e-02f, +1.814507917e-03f, -2.044064852e-03f, -1.658767534e-03f, - /* 24, 9 */ -1.570743396e-03f, -2.113671692e-03f, +1.412645767e-03f, +9.631827247e-03f, +1.649860375e-02f, +1.199730786e-02f, -7.871595256e-03f, -3.277444146e-02f, -4.233780689e-02f, -2.300121251e-02f, +1.702081530e-02f, +5.065292065e-02f, +5.296974848e-02f, +2.221306113e-02f, -1.869548696e-02f, -4.157463041e-02f, -3.523433096e-02f, -1.108233467e-02f, +1.029396653e-02f, +1.674607744e-02f, +1.076199396e-02f, +2.236592212e-03f, -1.956892396e-03f, -1.743780953e-03f, - /* 24,10 */ -1.480506488e-03f, -2.166521604e-03f, +1.031611407e-03f, +9.060123484e-03f, +1.630405519e-02f, +1.275134172e-02f, -6.299302508e-03f, -3.144854025e-02f, -4.253761970e-02f, -2.502497093e-02f, +1.438225015e-02f, +4.929629202e-02f, +5.392251484e-02f, +2.475089197e-02f, -1.642457396e-02f, -4.100968953e-02f, -3.635777499e-02f, -1.271138577e-02f, +9.346246206e-03f, +1.679429951e-02f, +1.131547576e-02f, +2.678169173e-03f, -1.851392085e-03f, -1.824951954e-03f, - /* 24,11 */ -1.388818223e-03f, -2.203463508e-03f, +6.718888821e-04f, +8.487191262e-03f, +1.606560041e-02f, +1.343965653e-02f, -4.755011838e-03f, -3.006589126e-02f, -4.261794963e-02f, -2.695585286e-02f, +1.172602857e-02f, +4.781317317e-02f, +5.473395280e-02f, +2.723942290e-02f, -1.408285985e-02f, -4.032212766e-02f, -3.740342600e-02f, -1.434967550e-02f, +8.335988548e-03f, +1.678923519e-02f, +1.185778300e-02f, +3.138383775e-03f, -1.726854356e-03f, -1.901418208e-03f, - /* 24,12 */ -1.296401007e-03f, -2.225380377e-03f, +3.338433846e-04f, +7.915306646e-03f, +1.578582064e-02f, +1.406209682e-02f, -3.242932618e-03f, -2.863202454e-02f, -4.258054458e-02f, -2.878919714e-02f, +9.060141131e-03f, +4.620830373e-02f, +5.540145153e-02f, +2.967096294e-02f, -1.167663915e-02f, -3.951216427e-02f, -3.836639935e-02f, -1.599210066e-02f, +7.264647438e-03f, +1.672884047e-02f, +1.238625918e-02f, +3.616254280e-03f, -1.582628528e-03f, -1.972290178e-03f, - /* 24,13 */ -1.203936109e-03f, -2.233183138e-03f, +1.772445414e-05f, +7.346647501e-03f, +1.546736546e-02f, +1.461875233e-02f, -1.767057534e-03f, -2.715253413e-02f, -4.242751674e-02f, -3.052071354e-02f, +6.392554173e-03f, +4.448680259e-02f, +5.592286159e-02f, +3.203796457e-02f, -9.212479159e-03f, -3.858043162e-02f, -3.924200344e-02f, -1.763342417e-02f, +6.133943976e-03f, +1.661121711e-02f, +1.289819803e-02f, +4.110671651e-03f, -1.418128950e-03f, -2.036654869e-03f, - /* 24,14 */ -1.112061839e-03f, -2.227804667e-03f, -2.763303743e-04f, +6.783287607e-03f, +1.511293981e-02f, +1.510995111e-02f, -3.311524193e-04f, -2.563305646e-02f, -4.216132985e-02f, -3.214649405e-02f, +3.731182183e-03f, +4.265414906e-02f, +5.629650283e-02f, +3.433305089e-02f, -6.697199080e-03f, -3.752797769e-02f, -4.002576024e-02f, -1.926829204e-02f, +4.945866528e-03f, +1.643462496e-02f, +1.339085359e-02f, +4.620399561e-03f, -1.232841058e-03f, -2.093579858e-03f, - /* 24,15 */ -1.021372070e-03f, -2.210193915e-03f, -5.482915187e-04f, +6.227191439e-03f, +1.472529111e-02f, +1.553625174e-02f, +1.061252794e-03f, -2.407924887e-02f, -4.178478525e-02f, -3.366302266e-02f, +1.083860427e-03f, +4.071616274e-02f, +5.652117066e-02f, +3.654904222e-02f, -4.137848013e-03f, -3.635626763e-02f, -4.071342524e-02f, -2.089125129e-02f, +3.702669669e-03f, +1.619749380e-02f, +1.386145083e-02f, +5.144075019e-03f, -1.026327303e-03f, -2.142117633e-03f, - /* 24, 0 */ -6.349328336e-04f, -5.107444449e-03f, -7.589492700e-03f, +4.421169254e-04f, +1.733331948e-02f, +2.497839430e-02f, +6.069612140e-03f, -2.970035006e-02f, -4.651799663e-02f, -1.968310326e-02f, +3.102388246e-02f, +5.659614054e-02f, +3.102388246e-02f, -1.968310326e-02f, -4.651799663e-02f, -2.970035006e-02f, +6.069612140e-03f, +2.497839430e-02f, +1.733331948e-02f, +4.421169254e-04f, -7.589492700e-03f, -5.107444449e-03f, -6.349328336e-04f, +6.381929817e-04f, - /* 24, 1 */ -4.501246045e-04f, -4.794789988e-03f, -7.673310752e-03f, -4.276921651e-04f, +1.630487239e-02f, +2.519230977e-02f, +8.023727481e-03f, -2.760467194e-02f, -4.668156835e-02f, -2.250226055e-02f, +2.808383767e-02f, +5.648624601e-02f, +3.385706239e-02f, -1.675917373e-02f, -4.616688010e-02f, -3.171828840e-02f, +4.039135426e-03f, +2.465060544e-02f, +1.832599562e-02f, +1.353161175e-03f, -7.461005422e-03f, -5.414037993e-03f, -8.347893499e-04f, +6.459962873e-04f, - /* 24, 2 */ -2.805431667e-04f, -4.478334337e-03f, -7.714347254e-03f, -1.253762011e-03f, +1.524677189e-02f, +2.529479915e-02f, +9.894771606e-03f, -2.544172743e-02f, -4.665953469e-02f, -2.520578478e-02f, +2.504972253e-02f, +5.615705320e-02f, +3.657100703e-02f, -1.374190145e-02f, -4.562711379e-02f, -3.364818878e-02f, +1.939527429e-03f, +2.420699082e-02f, +1.927675855e-02f, +2.302607998e-03f, -7.286133997e-03f, -5.712221732e-03f, -1.049390115e-03f, +6.454263440e-04f, - /* 24, 3 */ -1.262469087e-04f, -4.160237857e-03f, -7.714644364e-03f, -2.033919173e-03f, +1.416507919e-02f, +2.528877950e-02f, +1.167657735e-02f, -2.322211124e-02f, -4.645464989e-02f, -2.778343069e-02f, +2.193469332e-02f, +5.561003206e-02f, +3.915383052e-02f, -1.064323425e-02f, -4.489844274e-02f, -3.547998209e-02f, -2.214871506e-04f, +2.364611605e-02f, +2.017947396e-02f, +3.287300483e-03f, -7.063354139e-03f, -5.999568857e-03f, -1.278300802e-03f, +6.356530069e-04f, - /* 24, 4 */ +1.281987696e-05f, -3.842552418e-03f, -7.676380196e-03f, -2.766321017e-03f, +1.306576874e-02f, +2.517761055e-02f, +1.336353941e-02f, -2.095648565e-02f, -4.607045954e-02f, -3.022561220e-02f, +1.875220414e-02f, +5.484762432e-02f, +4.159418981e-02f, -7.475585158e-03f, -4.398147340e-02f, -3.720388175e-02f, -2.435717775e-03f, +2.296708552e-02f, +2.102804905e-02f, +4.303763633e-03f, -6.791349552e-03f, -6.273586899e-03f, -1.520952773e-03f, +6.158659890e-04f, - /* 24, 5 */ +1.368204413e-04f, -3.527213369e-03f, -7.601850138e-03f, -3.449453954e-03f, +1.195469912e-02f, +2.496506585e-02f, +1.495063011e-02f, -1.865552736e-02f, -4.551127331e-02f, -3.252344226e-02f, +1.551594186e-02f, +5.387323140e-02f, +4.388134039e-02f, -4.251776447e-03f, -4.287768073e-02f, -3.881043651e-02f, -4.694539858e-03f, +2.216956067e-02f, +2.181646678e-02f, +5.348212687e-03f, -6.469028645e-03f, -6.531730950e-03f, -1.776639841e-03f, +5.852828120e-04f, - /* 24, 6 */ +2.460185614e-04f, -3.216032617e-03f, -7.493448175e-03f, -4.082129823e-03f, +1.083758546e-02f, +2.465530244e-02f, +1.643341199e-02f, -1.632987505e-02f, -4.478213426e-02f, -3.466876896e-02f, +1.223976005e-02f, +5.269119738e-02f, +4.600518917e-02f, -9.849812576e-04f, -4.158941105e-02f, -4.029058231e-02f, -6.988929457e-03f, +2.125377578e-02f, +2.253882061e-02f, +6.416563547e-03f, -6.095540465e-03f, -6.771417794e-03f, -2.044515881e-03f, +5.431569434e-04f, - /* 24, 7 */ +3.407711290e-04f, -2.910692818e-03f, -7.353648294e-03f, -4.663480492e-03f, +9.719973395e-03f, +2.425282916e-02f, +1.780804686e-02f, -1.399007798e-02f, -4.388878466e-02f, -3.665420751e-02f, +8.937612534e-03f, +5.130678745e-02f, +4.795634432e-02f, +2.311336934e-03f, -4.011988036e-02f, -4.163569289e-02f, -9.309500719e-03f, +2.022055084e-02f, +2.318934965e-02f, +7.504445299e-03f, -5.670289717e-03f, -6.990040888e-03f, -2.323593338e-03f, +4.887860648e-04f, - /* 24, 8 */ +4.215204125e-04f, -2.612742676e-03f, -7.184986124e-03f, -5.192950770e-03f, +8.607214812e-03f, +2.376247385e-02f, +1.907130164e-02f, -1.164654593e-02f, -4.283762880e-02f, -3.847316827e-02f, +5.623486691e-03f, +4.972616165e-02f, +4.972616165e-02f, +5.623486691e-03f, -3.847316827e-02f, -4.283762880e-02f, -1.164654593e-02f, +1.907130164e-02f, +2.376247385e-02f, +8.607214812e-03f, -5.192950770e-03f, -7.184986124e-03f, -2.612742676e-03f, +4.215204125e-04f, - /* 24, 9 */ +4.887860648e-04f, -2.323593338e-03f, -6.990040888e-03f, -5.670289717e-03f, +7.504445299e-03f, +2.318934965e-02f, +2.022055084e-02f, -9.309500719e-03f, -4.163569289e-02f, -4.011988036e-02f, +2.311336934e-03f, +4.795634432e-02f, +5.130678745e-02f, +8.937612534e-03f, -3.665420751e-02f, -4.388878466e-02f, -1.399007798e-02f, +1.780804686e-02f, +2.425282916e-02f, +9.719973395e-03f, -4.663480492e-03f, -7.353648294e-03f, -2.910692818e-03f, +3.407711290e-04f, - /* 24,10 */ +5.431569434e-04f, -2.044515881e-03f, -6.771417794e-03f, -6.095540465e-03f, +6.416563547e-03f, +2.253882061e-02f, +2.125377578e-02f, -6.988929457e-03f, -4.029058231e-02f, -4.158941105e-02f, -9.849812576e-04f, +4.600518917e-02f, +5.269119738e-02f, +1.223976005e-02f, -3.466876896e-02f, -4.478213426e-02f, -1.632987505e-02f, +1.643341199e-02f, +2.465530244e-02f, +1.083758546e-02f, -4.082129823e-03f, -7.493448175e-03f, -3.216032617e-03f, +2.460185614e-04f, - /* 24,11 */ +5.852828120e-04f, -1.776639841e-03f, -6.531730950e-03f, -6.469028645e-03f, +5.348212687e-03f, +2.181646678e-02f, +2.216956067e-02f, -4.694539858e-03f, -3.881043651e-02f, -4.287768073e-02f, -4.251776447e-03f, +4.388134039e-02f, +5.387323140e-02f, +1.551594186e-02f, -3.252344226e-02f, -4.551127331e-02f, -1.865552736e-02f, +1.495063011e-02f, +2.496506585e-02f, +1.195469912e-02f, -3.449453954e-03f, -7.601850138e-03f, -3.527213369e-03f, +1.368204413e-04f, - /* 24,12 */ +6.158659890e-04f, -1.520952773e-03f, -6.273586899e-03f, -6.791349552e-03f, +4.303763633e-03f, +2.102804905e-02f, +2.296708552e-02f, -2.435717775e-03f, -3.720388175e-02f, -4.398147340e-02f, -7.475585158e-03f, +4.159418981e-02f, +5.484762432e-02f, +1.875220414e-02f, -3.022561220e-02f, -4.607045954e-02f, -2.095648565e-02f, +1.336353941e-02f, +2.517761055e-02f, +1.306576874e-02f, -2.766321017e-03f, -7.676380196e-03f, -3.842552418e-03f, +1.281987696e-05f, - /* 24,13 */ +6.356530069e-04f, -1.278300802e-03f, -5.999568857e-03f, -7.063354139e-03f, +3.287300483e-03f, +2.017947396e-02f, +2.364611605e-02f, -2.214871506e-04f, -3.547998209e-02f, -4.489844274e-02f, -1.064323425e-02f, +3.915383052e-02f, +5.561003206e-02f, +2.193469332e-02f, -2.778343069e-02f, -4.645464989e-02f, -2.322211124e-02f, +1.167657735e-02f, +2.528877950e-02f, +1.416507919e-02f, -2.033919173e-03f, -7.714644364e-03f, -4.160237857e-03f, -1.262469087e-04f, - /* 24,14 */ +6.454263440e-04f, -1.049390115e-03f, -5.712221732e-03f, -7.286133997e-03f, +2.302607998e-03f, +1.927675855e-02f, +2.420699082e-02f, +1.939527429e-03f, -3.364818878e-02f, -4.562711379e-02f, -1.374190145e-02f, +3.657100703e-02f, +5.615705320e-02f, +2.504972253e-02f, -2.520578478e-02f, -4.665953469e-02f, -2.544172743e-02f, +9.894771606e-03f, +2.529479915e-02f, +1.524677189e-02f, -1.253762011e-03f, -7.714347254e-03f, -4.478334337e-03f, -2.805431667e-04f, - /* 24,15 */ +6.459962873e-04f, -8.347893499e-04f, -5.414037993e-03f, -7.461005422e-03f, +1.353161175e-03f, +1.832599562e-02f, +2.465060544e-02f, +4.039135426e-03f, -3.171828840e-02f, -4.616688010e-02f, -1.675917373e-02f, +3.385706239e-02f, +5.648624601e-02f, +2.808383767e-02f, -2.250226055e-02f, -4.668156835e-02f, -2.760467194e-02f, +8.023727481e-03f, +2.519230977e-02f, +1.630487239e-02f, -4.276921651e-04f, -7.673310752e-03f, -4.794789988e-03f, -4.501246045e-04f, - /* 24, 0 */ +1.197013499e-03f, +3.320493122e-03f, -3.017233048e-03f, -9.987553340e-03f, -4.112967049e-03f, +1.524501264e-02f, +2.235677036e-02f, -2.137559158e-03f, -3.327370097e-02f, -2.660122408e-02f, +1.657531807e-02f, +4.232694754e-02f, +1.657531807e-02f, -2.660122408e-02f, -3.327370097e-02f, -2.137559158e-03f, +2.235677036e-02f, +1.524501264e-02f, -4.112967049e-03f, -9.987553340e-03f, -3.017233048e-03f, +2.318357031e-03f, +1.197013499e-03f, -1.261205705e-04f, - /* 24, 1 */ +1.060573898e-03f, +3.246029352e-03f, -2.510607281e-03f, -9.784551764e-03f, -5.018393221e-03f, +1.404948670e-02f, +2.282515537e-02f, +7.626640355e-05f, -3.208475603e-02f, -2.845760231e-02f, +1.374134711e-02f, +4.221250979e-02f, +1.933345641e-02f, -2.458052660e-02f, -3.429687591e-02f, -4.386190237e-03f, +2.174698353e-02f, +1.639120730e-02f, -3.143642175e-03f, -1.013545813e-02f, -3.535011248e-03f, +2.193303334e-03f, +1.338504197e-03f, -9.901282259e-05f, - /* 24, 2 */ +9.298712414e-04f, +3.156277727e-03f, -2.018194158e-03f, -9.530340989e-03f, -5.856606243e-03f, +1.281349999e-02f, +2.315294314e-02f, +2.243024978e-03f, -3.073934924e-02f, -3.014061672e-02f, +1.084811230e-02f, +4.186988491e-02f, +2.199957595e-02f, -2.240563854e-02f, -3.514586546e-02f, -6.656913804e-03f, +2.099588115e-02f, +1.747926153e-02f, -2.114297018e-03f, -1.022461460e-02f, -4.060636553e-03f, +2.039754046e-03f, +1.484263468e-03f, -6.526428163e-05f, - /* 24, 3 */ +8.054954021e-04f, +3.052984548e-03f, -1.542795645e-03f, -9.229007144e-03f, -6.624860539e-03f, +1.154592266e-02f, +2.334180387e-02f, +4.350977952e-03f, -2.924761047e-02f, -3.164235460e-02f, +7.912459038e-03f, +4.130113344e-02f, +2.455797710e-02f, -2.008771737e-02f, -3.581321303e-02f, -8.936640836e-03f, +2.010445982e-02f, +1.850049032e-02f, -1.029364704e-03f, -1.025164428e-02f, -4.590574200e-03f, +1.857070273e-03f, +1.633412152e-03f, -2.453170435e-05f, - /* 24, 4 */ +6.879416803e-04f, +2.937877889e-03f, -1.086944946e-03f, -8.884797195e-03f, -7.320980005e-03f, +1.025556440e-02f, +2.339424278e-02f, +6.388976156e-03f, -2.762041561e-02f, -3.295607494e-02f, +4.951401864e-03f, +4.050967459e-02f, +2.699354793e-02f, -1.763888677e-02f, -3.629248103e-02f, -1.121198570e-02f, +1.907464002e-02f, +1.944639638e-02f, +1.061806254e-04f, -1.021347789e-02f, -5.121078221e-03f, +1.644827972e-03f, +1.784975276e-03f, +2.348660763e-05f, - /* 24, 5 */ +5.776128643e-04f, +2.812656385e-03f, -6.528985547e-04f, -8.502081335e-03f, -7.943354450e-03f, +8.951116293e-03f, +2.331356438e-02f, +8.346521334e-03f, -2.586930694e-02f, -3.407624020e-02f, +1.982016505e-03f, +3.950026382e-02f, +2.929186185e-02f, -1.507216716e-02f, -3.657830513e-02f, -1.346934883e-02f, +1.790927350e-02f, +2.030873394e-02f, +1.286841938e-03f, -1.010739044e-02f, -5.648212144e-03f, +1.402832649e-03f, +1.937883690e-03f, +7.904503123e-05f, - /* 24, 6 */ +4.748218959e-04f, +2.678978820e-03f, -2.426308611e-04f, -8.085315763e-03f, -8.490932000e-03f, +7.641095022e-03f, +2.310383199e-02f, +1.021382218e-02f, -2.400641001e-02f, -3.499853994e-02f, -9.786680537e-04f, +3.827896159e-02f, +3.143927100e-02f, -1.240139974e-02f, -3.666644182e-02f, -1.569500220e-02f, +1.661214427e-02f, +2.107957227e-02f, +2.506621864e-03f, -9.931034771e-03f, -6.167872094e-03f, +1.131132707e-03f, +2.090976552e-03f, +1.423449116e-04f, - /* 24, 7 */ +3.797950945e-04f, +2.538454547e-03f, +1.421687298e-04f, -7.639006136e-03f, -8.963207645e-03f, +6.333789781e-03f, +2.276982298e-02f, +1.198184460e-02f, -2.204434780e-02f, -3.571990598e-02f, -3.913776625e-03f, +3.685309369e-02f, +3.342299483e-02f, -9.641164594e-03f, -3.655380902e-02f, -1.787517696e-02f, +1.518796320e-02f, +2.175135864e-02f, +3.759049618e-03f, -9.682473374e-03f, -6.675812165e-03f, +8.300312585e-04f, +2.243004675e-03f, +2.135289700e-04f, - /* 24, 8 */ +2.926758839e-04f, +2.392634763e-03f, +5.000962484e-04f, -7.167671961e-03f, -9.360208124e-03f, +5.037212205e-03f, +2.231697999e-02f, +1.364235598e-02f, -1.999615271e-02f, -3.623851940e-02f, -6.806693291e-03f, +3.523120326e-02f, +3.523120326e-02f, -6.806693291e-03f, -3.623851940e-02f, -1.999615271e-02f, +1.364235598e-02f, +2.231697999e-02f, +5.037212205e-03f, -9.360208124e-03f, -7.167671961e-03f, +5.000962484e-04f, +2.392634763e-03f, +2.926758839e-04f, - /* 24, 9 */ +2.135289700e-04f, +2.243004675e-03f, +8.300312585e-04f, -6.675812165e-03f, -9.682473374e-03f, +3.759049618e-03f, +2.175135864e-02f, +1.518796320e-02f, -1.787517696e-02f, -3.655380902e-02f, -9.641164594e-03f, +3.342299483e-02f, +3.685309369e-02f, -3.913776625e-03f, -3.571990598e-02f, -2.204434780e-02f, +1.198184460e-02f, +2.276982298e-02f, +6.333789781e-03f, -8.963207645e-03f, -7.639006136e-03f, +1.421687298e-04f, +2.538454547e-03f, +3.797950945e-04f, - /* 24,10 */ +1.423449116e-04f, +2.090976552e-03f, +1.131132707e-03f, -6.167872094e-03f, -9.931034771e-03f, +2.506621864e-03f, +2.107957227e-02f, +1.661214427e-02f, -1.569500220e-02f, -3.666644182e-02f, -1.240139974e-02f, +3.143927100e-02f, +3.827896159e-02f, -9.786680537e-04f, -3.499853994e-02f, -2.400641001e-02f, +1.021382218e-02f, +2.310383199e-02f, +7.641095022e-03f, -8.490932000e-03f, -8.085315763e-03f, -2.426308611e-04f, +2.678978820e-03f, +4.748218959e-04f, - /* 24,11 */ +7.904503123e-05f, +1.937883690e-03f, +1.402832649e-03f, -5.648212144e-03f, -1.010739044e-02f, +1.286841938e-03f, +2.030873394e-02f, +1.790927350e-02f, -1.346934883e-02f, -3.657830513e-02f, -1.507216716e-02f, +2.929186185e-02f, +3.950026382e-02f, +1.982016505e-03f, -3.407624020e-02f, -2.586930694e-02f, +8.346521334e-03f, +2.331356438e-02f, +8.951116293e-03f, -7.943354450e-03f, -8.502081335e-03f, -6.528985547e-04f, +2.812656385e-03f, +5.776128643e-04f, - /* 24,12 */ +2.348660763e-05f, +1.784975276e-03f, +1.644827972e-03f, -5.121078221e-03f, -1.021347789e-02f, +1.061806254e-04f, +1.944639638e-02f, +1.907464002e-02f, -1.121198570e-02f, -3.629248103e-02f, -1.763888677e-02f, +2.699354793e-02f, +4.050967459e-02f, +4.951401864e-03f, -3.295607494e-02f, -2.762041561e-02f, +6.388976156e-03f, +2.339424278e-02f, +1.025556440e-02f, -7.320980005e-03f, -8.884797195e-03f, -1.086944946e-03f, +2.937877889e-03f, +6.879416803e-04f, - /* 24,13 */ -2.453170435e-05f, +1.633412152e-03f, +1.857070273e-03f, -4.590574200e-03f, -1.025164428e-02f, -1.029364704e-03f, +1.850049032e-02f, +2.010445982e-02f, -8.936640836e-03f, -3.581321303e-02f, -2.008771737e-02f, +2.455797710e-02f, +4.130113344e-02f, +7.912459038e-03f, -3.164235460e-02f, -2.924761047e-02f, +4.350977952e-03f, +2.334180387e-02f, +1.154592266e-02f, -6.624860539e-03f, -9.229007144e-03f, -1.542795645e-03f, +3.052984548e-03f, +8.054954021e-04f, - /* 24,14 */ -6.526428163e-05f, +1.484263468e-03f, +2.039754046e-03f, -4.060636553e-03f, -1.022461460e-02f, -2.114297018e-03f, +1.747926153e-02f, +2.099588115e-02f, -6.656913804e-03f, -3.514586546e-02f, -2.240563854e-02f, +2.199957595e-02f, +4.186988491e-02f, +1.084811230e-02f, -3.014061672e-02f, -3.073934924e-02f, +2.243024978e-03f, +2.315294314e-02f, +1.281349999e-02f, -5.856606243e-03f, -9.530340989e-03f, -2.018194158e-03f, +3.156277727e-03f, +9.298712414e-04f, - /* 24,15 */ -9.901282259e-05f, +1.338504197e-03f, +2.193303334e-03f, -3.535011248e-03f, -1.013545813e-02f, -3.143642175e-03f, +1.639120730e-02f, +2.174698353e-02f, -4.386190237e-03f, -3.429687591e-02f, -2.458052660e-02f, +1.933345641e-02f, +4.221250979e-02f, +1.374134711e-02f, -2.845760231e-02f, -3.208475603e-02f, +7.626640355e-05f, +2.282515537e-02f, +1.404948670e-02f, -5.018393221e-03f, -9.784551764e-03f, -2.510607281e-03f, +3.246029352e-03f, +1.060573898e-03f, - /* 20, 0 */ +2.832126065e-03f, -3.455346407e-03f, -1.050167676e-02f, +5.399047405e-04f, +2.072547687e-02f, +1.261483344e-02f, -2.310421022e-02f, -3.076111900e-02f, +1.034529168e-02f, +3.949755319e-02f, +1.034529168e-02f, -3.076111900e-02f, -2.310421022e-02f, +1.261483344e-02f, +2.072547687e-02f, +5.399047405e-04f, -1.050167676e-02f, -3.455346407e-03f, +2.832126065e-03f, +1.002136091e-03f, - /* 20, 1 */ +2.918309836e-03f, -2.848965042e-03f, -1.044663371e-02f, -7.454467031e-04f, +1.993701966e-02f, +1.431336010e-02f, -2.105256806e-02f, -3.196996361e-02f, +7.274030562e-03f, +3.936378623e-02f, +1.336427867e-02f, -2.932648708e-02f, -2.503260290e-02f, +1.078376120e-02f, +2.138841986e-02f, +1.874755806e-03f, -1.047502359e-02f, -4.071193337e-03f, +2.709872705e-03f, +1.184613130e-03f, - /* 20, 2 */ +2.970014434e-03f, -2.256846905e-03f, -1.031411254e-02f, -1.973175306e-03f, +1.903277841e-02f, +1.586999913e-02f, -1.889465735e-02f, -3.294695719e-02f, +4.172714360e-03f, +3.896348732e-02f, +1.630904655e-02f, -2.767391419e-02f, -2.682143551e-02f, +8.830742245e-03f, +2.191685631e-02f, +3.250271284e-03f, -1.036300090e-02f, -4.691364292e-03f, +2.550244709e-03f, +1.728121332e-03f, - /* 20, 3 */ +2.989084466e-03f, -1.683415968e-03f, -1.010881741e-02f, -3.135916081e-03f, +1.802312126e-02f, +1.727671449e-02f, -1.664798407e-02f, -3.368784795e-02f, +1.063660935e-03f, +3.829965427e-02f, +1.915809828e-02f, -2.581298498e-02f, -2.845520951e-02f, +6.767571398e-03f, +2.230262774e-02f, +4.656958119e-03f, -1.016253578e-02f, -5.310408414e-03f, +2.352251997e-03f, +1.906494808e-03f, - /* 20, 4 */ +2.977586348e-03f, -1.132697564e-03f, -9.835877420e-03f, -4.227100403e-03f, +1.691895133e-02f, +1.852681335e-02f, -1.433043179e-02f, -3.419021020e-02f, -2.030888217e-03f, +3.737725626e-02f, +2.189055571e-02f, -2.375496340e-02f, -2.991937541e-02f, +4.607167163e-03f, +2.253850054e-02f, +6.084727180e-03f, -9.871207756e-03f, -5.922604667e-03f, +2.115247068e-03f, +2.079939639e-03f, - /* 20, 5 */ +2.937775120e-03f, -6.082983663e-04f, -9.500783787e-03f, -5.240985904e-03f, +1.573160178e-02f, +1.961497125e-02f, -1.196011335e-02f, -3.445344345e-02f, -5.088941581e-03f, +3.620319350e-02f, +2.448632622e-02f, -2.151271924e-02f, -3.120046374e-02f, +2.363488482e-03f, +2.261825107e-02f, +7.522962281e-03f, -9.487296369e-03f, -6.522005316e-03f, +1.838950241e-03f, +2.245949018e-03f, - /* 20, 6 */ +2.872060854e-03f, -1.133913219e-04f, -9.109325922e-03f, -6.172678101e-03f, +1.447272980e-02f, +2.053724533e-02f, -9.555222824e-03f, -3.447875653e-02f, -8.088928223e-03f, +3.478624106e-02f, +2.692626358e-02f, -1.910064083e-02f, -3.228620876e-02f, +5.144107936e-05f, +2.253674404e-02f, +8.960596019e-03f, -9.009823935e-03f, -7.102483479e-03f, +1.523472156e-03f, +2.401928729e-03f, - /* 20, 7 */ +2.782975009e-03f, +3.492945151e-04f, -8.667527067e-03f, -7.018143782e-03f, +1.315421060e-02f, +2.129107545e-02f, -7.133889173e-03f, -3.426913715e-02f, -1.100986395e-02f, +3.313697764e-02f, +2.919232167e-02f, -1.653453452e-02f, -3.316566379e-02f, -2.313225982e-03f, +2.229000326e-02f, +1.038619190e-02f, -8.438592747e-03f, -7.657784411e-03f, +1.169333173e-03f, +2.545222121e-03f, - /* 20, 8 */ +2.673137115e-03f, +7.774793244e-04f, -8.181580147e-03f, -7.774216267e-03f, +1.178803215e-02f, +2.187527386e-02f, -4.714032773e-03f, -3.382930709e-02f, -1.383151166e-02f, +3.126769968e-02f, +3.126769968e-02f, -1.383151166e-02f, -3.382930709e-02f, -4.714032773e-03f, +2.187527386e-02f, +1.178803215e-02f, -7.774216267e-03f, -8.181580147e-03f, +7.774793244e-04f, +2.673137115e-03f, - /* 20, 9 */ +2.545222121e-03f, +1.169333173e-03f, -7.657784411e-03f, -8.438592747e-03f, +1.038619190e-02f, +2.229000326e-02f, -2.313225982e-03f, -3.316566379e-02f, -1.653453452e-02f, +2.919232167e-02f, +3.313697764e-02f, -1.100986395e-02f, -3.426913715e-02f, -7.133889173e-03f, +2.129107545e-02f, +1.315421060e-02f, -7.018143782e-03f, -8.667527067e-03f, +3.492945151e-04f, +2.782975009e-03f, - /* 20,10 */ +2.401928729e-03f, +1.523472156e-03f, -7.102483479e-03f, -9.009823935e-03f, +8.960596019e-03f, +2.253674404e-02f, +5.144107936e-05f, -3.228620876e-02f, -1.910064083e-02f, +2.692626358e-02f, +3.478624106e-02f, -8.088928223e-03f, -3.447875653e-02f, -9.555222824e-03f, +2.053724533e-02f, +1.447272980e-02f, -6.172678101e-03f, -9.109325922e-03f, -1.133913219e-04f, +2.872060854e-03f, - /* 20,11 */ +2.245949018e-03f, +1.838950241e-03f, -6.522005316e-03f, -9.487296369e-03f, +7.522962281e-03f, +2.261825107e-02f, +2.363488482e-03f, -3.120046374e-02f, -2.151271924e-02f, +2.448632622e-02f, +3.620319350e-02f, -5.088941581e-03f, -3.445344345e-02f, -1.196011335e-02f, +1.961497125e-02f, +1.573160178e-02f, -5.240985904e-03f, -9.500783787e-03f, -6.082983663e-04f, +2.937775120e-03f, - /* 20,12 */ +2.079939639e-03f, +2.115247068e-03f, -5.922604667e-03f, -9.871207756e-03f, +6.084727180e-03f, +2.253850054e-02f, +4.607167163e-03f, -2.991937541e-02f, -2.375496340e-02f, +2.189055571e-02f, +3.737725626e-02f, -2.030888217e-03f, -3.419021020e-02f, -1.433043179e-02f, +1.852681335e-02f, +1.691895133e-02f, -4.227100403e-03f, -9.835877420e-03f, -1.132697564e-03f, +2.977586348e-03f, - /* 20,13 */ +1.906494808e-03f, +2.352251997e-03f, -5.310408414e-03f, -1.016253578e-02f, +4.656958119e-03f, +2.230262774e-02f, +6.767571398e-03f, -2.845520951e-02f, -2.581298498e-02f, +1.915809828e-02f, +3.829965427e-02f, +1.063660935e-03f, -3.368784795e-02f, -1.664798407e-02f, +1.727671449e-02f, +1.802312126e-02f, -3.135916081e-03f, -1.010881741e-02f, -1.683415968e-03f, +2.989084466e-03f, - /* 20,14 */ +1.728121332e-03f, +2.550244709e-03f, -4.691364292e-03f, -1.036300090e-02f, +3.250271284e-03f, +2.191685631e-02f, +8.830742245e-03f, -2.682143551e-02f, -2.767391419e-02f, +1.630904655e-02f, +3.896348732e-02f, +4.172714360e-03f, -3.294695719e-02f, -1.889465735e-02f, +1.586999913e-02f, +1.903277841e-02f, -1.973175306e-03f, -1.031411254e-02f, -2.256846905e-03f, +2.970014434e-03f, - /* 20,15 */ +1.184613130e-03f, +2.709872705e-03f, -4.071193337e-03f, -1.047502359e-02f, +1.874755806e-03f, +2.138841986e-02f, +1.078376120e-02f, -2.503260290e-02f, -2.932648708e-02f, +1.336427867e-02f, +3.936378623e-02f, +7.274030562e-03f, -3.196996361e-02f, -2.105256806e-02f, +1.431336010e-02f, +1.993701966e-02f, -7.454467031e-04f, -1.044663371e-02f, -2.848965042e-03f, +2.918309836e-03f, - /* 20, 0 */ +1.702864838e-03f, +2.314577966e-03f, -6.534433696e-03f, -8.774562126e-03f, +1.199271213e-02f, +2.083400312e-02f, -1.263546899e-02f, -3.379691899e-02f, +5.498355442e-03f, +3.949755319e-02f, +5.498355442e-03f, -3.379691899e-02f, -1.263546899e-02f, +2.083400312e-02f, +1.199271213e-02f, -8.774562126e-03f, -6.534433696e-03f, +2.314577966e-03f, +1.702864838e-03f, +0.000000000e+00f, - /* 20, 1 */ +1.499435496e-03f, +2.547675666e-03f, -5.868098774e-03f, -9.353385898e-03f, +1.044920601e-02f, +2.160032962e-02f, -9.997584470e-03f, -3.429852636e-02f, +2.083565903e-03f, +3.933622696e-02f, +8.892197588e-03f, -3.300722623e-02f, -1.522519578e-02f, +1.986341365e-02f, +1.349096787e-02f, -8.082206357e-03f, -7.177938171e-03f, +2.033576095e-03f, +1.903844954e-03f, +0.000000000e+00f, - /* 20, 2 */ +8.979094201e-04f, +2.733567376e-03f, -5.187117330e-03f, -9.818374279e-03f, +8.876306372e-03f, +2.216139438e-02f, -7.335624654e-03f, -3.451169090e-02f, -1.322648265e-03f, +3.885370480e-02f, +1.223556951e-02f, -3.193245877e-02f, -1.774265256e-02f, +1.869155385e-02f, +1.492800767e-02f, -7.277832099e-03f, -7.790241855e-03f, +1.704529263e-03f, +2.099160368e-03f, -3.513221827e-04f, - /* 20, 3 */ +7.046452899e-04f, +2.873469547e-03f, -4.499404245e-03f, -1.017038969e-02f, +7.289604703e-03f, +2.251815219e-02f, -4.673411391e-03f, -3.443867914e-02f, -4.691042688e-03f, +3.805434209e-02f, +1.549922824e-02f, -3.057828381e-02f, -2.016393226e-02f, +1.732343066e-02f, +1.628791973e-02f, -6.364195274e-03f, -8.362876507e-03f, +1.327887989e-03f, +2.285430476e-03f, -3.288882594e-04f, - /* 20, 4 */ +5.275063595e-04f, +2.969073324e-03f, -3.812529364e-03f, -1.041140495e-02f, +5.704278009e-03f, +2.267345221e-02f, -2.034281900e-03f, -3.408432658e-02f, -7.992925296e-03f, +3.694535030e-02f, +1.865448932e-02f, -2.895300188e-02f, -2.246557005e-02f, +1.576606531e-02f, +1.755501285e-02f, -5.345313722e-03f, -8.887369558e-03f, +9.047221591e-04f, +2.459146683e-03f, -2.941732022e-04f, - /* 20, 5 */ +3.670219514e-04f, +3.022497230e-03f, -3.133648777e-03f, -1.054443774e-02f, +4.134948499e-03f, +2.263196075e-02f, +5.591264205e-04f, -3.345595810e-02f, -1.120042307e-02f, +3.553672638e-02f, +2.167350137e-02f, -2.706749712e-02f, -2.462477986e-02f, +1.402847243e-02f, +1.871398575e-02f, -4.226473266e-03f, -9.355341791e-03f, +4.367425848e-04f, +2.616713456e-03f, -2.461206998e-04f, - /* 20, 6 */ +2.234691091e-04f, +3.036236900e-03f, -2.469443903e-03f, -1.057347601e-02f, +2.595553432e-03f, +2.240006745e-02f, +3.085080219e-03f, -3.256328476e-02f, -1.428673893e-02f, +3.384115481e-02f, +2.452951370e-02f, -2.493516141e-02f, -2.661968788e-02f, +1.212161795e-02f, +1.975009719e-02f, -3.014219819e-03f, -9.758608118e-03f, -7.368451392e-05f, +2.754492916e-03f, -1.837671888e-04f, - /* 20, 7 */ +9.688872179e-05f, +3.013112613e-03f, -1.826068782e-03f, -1.050339555e-02f, +1.099226216e-03f, +2.198577609e-02f, +5.522941542e-03f, -3.141827834e-02f, -1.722639627e-02f, +3.187388359e-02f, +2.719713425e-02f, -2.257179274e-02f, -2.842956063e-02f, +1.005835593e-02f, +2.064933490e-02f, -1.716337171e-03f, -1.008928035e-02f, -6.235305950e-04f, +2.868852533e-03f, -1.062635081e-04f, - /* 20, 8 */ -1.289664191e-05f, +2.956215411e-03f, -1.209105881e-03f, -1.033987080e-02f, -3.418102460e-04f, +2.139858161e-02f, +7.853344535e-03f, -3.003502508e-02f, -1.999546871e-02f, +2.965257519e-02f, +2.965257519e-02f, -1.999546871e-02f, -3.003502508e-02f, +7.853344535e-03f, +2.139858161e-02f, -3.418102460e-04f, -1.033987080e-02f, -1.209105881e-03f, +2.956215411e-03f, -1.289664191e-05f, - /* 20, 9 */ -1.062635081e-04f, +2.868852533e-03f, -6.235305950e-04f, -1.008928035e-02f, -1.716337171e-03f, +2.064933490e-02f, +1.005835593e-02f, -2.842956063e-02f, -2.257179274e-02f, +2.719713425e-02f, +3.187388359e-02f, -1.722639627e-02f, -3.141827834e-02f, +5.522941542e-03f, +2.198577609e-02f, +1.099226216e-03f, -1.050339555e-02f, -1.826068782e-03f, +3.013112613e-03f, +9.688872179e-05f, - /* 20,10 */ -1.837671888e-04f, +2.754492916e-03f, -7.368451392e-05f, -9.758608118e-03f, -3.014219819e-03f, +1.975009719e-02f, +1.212161795e-02f, -2.661968788e-02f, -2.493516141e-02f, +2.452951370e-02f, +3.384115481e-02f, -1.428673893e-02f, -3.256328476e-02f, +3.085080219e-03f, +2.240006745e-02f, +2.595553432e-03f, -1.057347601e-02f, -2.469443903e-03f, +3.036236900e-03f, +2.234691091e-04f, - /* 20,11 */ -2.461206998e-04f, +2.616713456e-03f, +4.367425848e-04f, -9.355341791e-03f, -4.226473266e-03f, +1.871398575e-02f, +1.402847243e-02f, -2.462477986e-02f, -2.706749712e-02f, +2.167350137e-02f, +3.553672638e-02f, -1.120042307e-02f, -3.345595810e-02f, +5.591264205e-04f, +2.263196075e-02f, +4.134948499e-03f, -1.054443774e-02f, -3.133648777e-03f, +3.022497230e-03f, +3.670219514e-04f, - /* 20,12 */ -2.941732022e-04f, +2.459146683e-03f, +9.047221591e-04f, -8.887369558e-03f, -5.345313722e-03f, +1.755501285e-02f, +1.576606531e-02f, -2.246557005e-02f, -2.895300188e-02f, +1.865448932e-02f, +3.694535030e-02f, -7.992925296e-03f, -3.408432658e-02f, -2.034281900e-03f, +2.267345221e-02f, +5.704278009e-03f, -1.041140495e-02f, -3.812529364e-03f, +2.969073324e-03f, +5.275063595e-04f, - /* 20,13 */ -3.288882594e-04f, +2.285430476e-03f, +1.327887989e-03f, -8.362876507e-03f, -6.364195274e-03f, +1.628791973e-02f, +1.732343066e-02f, -2.016393226e-02f, -3.057828381e-02f, +1.549922824e-02f, +3.805434209e-02f, -4.691042688e-03f, -3.443867914e-02f, -4.673411391e-03f, +2.251815219e-02f, +7.289604703e-03f, -1.017038969e-02f, -4.499404245e-03f, +2.873469547e-03f, +7.046452899e-04f, - /* 20,14 */ -3.513221827e-04f, +2.099160368e-03f, +1.704529263e-03f, -7.790241855e-03f, -7.277832099e-03f, +1.492800767e-02f, +1.869155385e-02f, -1.774265256e-02f, -3.193245877e-02f, +1.223556951e-02f, +3.885370480e-02f, -1.322648265e-03f, -3.451169090e-02f, -7.335624654e-03f, +2.216139438e-02f, +8.876306372e-03f, -9.818374279e-03f, -5.187117330e-03f, +2.733567376e-03f, +8.979094201e-04f, - /* 20,15 */ +0.000000000e+00f, +1.903844954e-03f, +2.033576095e-03f, -7.177938171e-03f, -8.082206357e-03f, +1.349096787e-02f, +1.986341365e-02f, -1.522519578e-02f, -3.300722623e-02f, +8.892197588e-03f, +3.933622696e-02f, +2.083565903e-03f, -3.429852636e-02f, -9.997584470e-03f, +2.160032962e-02f, +1.044920601e-02f, -9.353385898e-03f, -5.868098774e-03f, +2.547675666e-03f, +1.499435496e-03f, - /* 20, 0 */ -3.735125865e-04f, +2.550984103e-03f, -2.725752467e-05f, -1.024966855e-02f, +8.379667777e-04f, +2.252874535e-02f, -1.249359695e-03f, -3.448318510e-02f, +6.071698875e-04f, +3.949755319e-02f, +6.071698875e-04f, -3.448318510e-02f, -1.249359695e-03f, +2.252874535e-02f, +8.379667777e-04f, -1.024966855e-02f, -2.725752467e-05f, +2.565652055e-03f, -3.735125865e-04f, +0.000000000e+00f, - /* 20, 1 */ -3.929324583e-04f, +2.236335973e-03f, +5.288730096e-04f, -9.916240655e-03f, -7.235223044e-04f, +2.212021870e-02f, +1.557339330e-03f, -3.412515163e-02f, -3.088657053e-03f, +3.930609269e-02f, +4.328121901e-03f, -3.450613681e-02f, -4.117983282e-03f, +2.271744325e-02f, +2.467540325e-03f, -1.048404473e-02f, -6.307983207e-04f, +2.729031078e-03f, -3.387491377e-04f, +0.000000000e+00f, - /* 20, 2 */ +0.000000000e+00f, +1.931175707e-03f, +1.033703668e-03f, -9.493276252e-03f, -2.202626937e-03f, +2.150371837e-02f, +4.274418757e-03f, -3.344119198e-02f, -6.721842627e-03f, +3.873376177e-02f, +8.036125742e-03f, -3.418837690e-02f, -7.019484999e-03f, +2.267661502e-02f, +4.149462009e-03f, -1.061062992e-02f, -1.276919763e-03f, +2.866023275e-03f, -2.870815261e-04f, +0.000000000e+00f, - /* 20, 3 */ +0.000000000e+00f, +1.638662038e-03f, +1.484286050e-03f, -8.990907936e-03f, -3.586602863e-03f, +2.069305390e-02f, +6.875821908e-03f, -3.244383298e-02f, -1.025584288e-02f, +3.778668841e-02f, +1.169297592e-02f, -3.352791602e-02f, -9.923776326e-03f, +2.239890298e-02f, +5.866701604e-03f, -1.062161571e-02f, -1.959867511e-03f, +2.971909246e-03f, -2.170808154e-04f, +0.000000000e+00f, - /* 20, 4 */ +0.000000000e+00f, +1.361489293e-03f, +1.878600735e-03f, -8.419725702e-03f, -4.864357078e-03f, +1.970376789e-02f, +9.337391966e-03f, -3.114878076e-02f, -1.365548733e-02f, +3.647500669e-02f, +1.526076366e-02f, -3.252647846e-02f, -1.280005487e-02f, +2.187944695e-02f, +7.601099328e-03f, -1.051027343e-02f, -2.672992279e-03f, +3.042103091e-03f, -1.274866066e-04f, +0.000000000e+00f, - /* 20, 5 */ +0.000000000e+00f, +1.101888322e-03f, +2.215532402e-03f, -7.790617836e-03f, -6.026519023e-03f, +1.855289977e-02f, +1.163710530e-02f, -2.957469445e-02f, -1.688736106e-02f, +3.481273909e-02f, +1.870230489e-02f, -3.118953221e-02f, -1.561714772e-02f, +2.111601531e-02f, +9.333550613e-03f, -1.027109466e-02f, -3.408794343e-03f, +3.072235528e-03f, -1.724424543e-05f, +0.000000000e+00f, - /* 20, 6 */ +0.000000000e+00f, +8.616336525e-04f, +2.494833248e-03f, -7.114614810e-03f, -7.065487327e-03f, +1.725873795e-02f, +1.375527431e-02f, -2.774292839e-02f, -1.992016339e-02f, +3.281763375e-02f, +2.198156213e-02f, -2.952627516e-02f, -1.834386597e-02f, +2.010910684e-02f, +1.104420948e-02f, -9.899921148e-03f, -4.158982805e-03f, +3.058238443e-03f, +1.144582079e-04f, +0.000000000e+00f, - /* 20, 7 */ +0.000000000e+00f, +6.420563626e-04f, +2.717075783e-03f, -6.402738187e-03f, -7.975452307e-03f, +1.584056403e-02f, +1.567471786e-02f, -2.567724669e-02f, -2.272503888e-02f, +3.051095862e-02f, +2.506405514e-02f, -2.754957697e-02f, -2.094936609e-02f, +1.886202143e-02f, +1.271270843e-02f, -9.394061811e-03f, -4.914549404e-03f, +2.996429606e-03f, +2.681538305e-04f, +0.000000000e+00f, - /* 20, 8 */ +0.000000000e+00f, +4.440621234e-04f, +2.883596201e-03f, -5.665856445e-03f, -8.752394750e-03f, +1.431839236e-02f, +1.738089791e-02f, -2.340351394e-02f, -2.527587699e-02f, +2.791725525e-02f, +2.791725525e-02f, -2.527587699e-02f, -2.340351394e-02f, +1.738089791e-02f, +1.431839236e-02f, -8.752394750e-03f, -5.665856445e-03f, +2.883596201e-03f, +4.440621234e-04f, +0.000000000e+00f, - /* 20, 9 */ +0.000000000e+00f, +2.681538305e-04f, +2.996429606e-03f, -4.914549404e-03f, -9.394061811e-03f, +1.271270843e-02f, +1.886202143e-02f, -2.094936609e-02f, -2.754957697e-02f, +2.506405514e-02f, +3.051095862e-02f, -2.272503888e-02f, -2.567724669e-02f, +1.567471786e-02f, +1.584056403e-02f, -7.975452307e-03f, -6.402738187e-03f, +2.717075783e-03f, +6.420563626e-04f, +0.000000000e+00f, - /* 20,10 */ +0.000000000e+00f, +1.144582079e-04f, +3.058238443e-03f, -4.158982805e-03f, -9.899921148e-03f, +1.104420948e-02f, +2.010910684e-02f, -1.834386597e-02f, -2.952627516e-02f, +2.198156213e-02f, +3.281763375e-02f, -1.992016339e-02f, -2.774292839e-02f, +1.375527431e-02f, +1.725873795e-02f, -7.065487327e-03f, -7.114614810e-03f, +2.494833248e-03f, +8.616336525e-04f, +0.000000000e+00f, - /* 20,11 */ +0.000000000e+00f, -1.724424543e-05f, +3.072235528e-03f, -3.408794343e-03f, -1.027109466e-02f, +9.333550613e-03f, +2.111601531e-02f, -1.561714772e-02f, -3.118953221e-02f, +1.870230489e-02f, +3.481273909e-02f, -1.688736106e-02f, -2.957469445e-02f, +1.163710530e-02f, +1.855289977e-02f, -6.026519023e-03f, -7.790617836e-03f, +2.215532402e-03f, +1.101888322e-03f, +0.000000000e+00f, - /* 20,12 */ +0.000000000e+00f, -1.274866066e-04f, +3.042103091e-03f, -2.672992279e-03f, -1.051027343e-02f, +7.601099328e-03f, +2.187944695e-02f, -1.280005487e-02f, -3.252647846e-02f, +1.526076366e-02f, +3.647500669e-02f, -1.365548733e-02f, -3.114878076e-02f, +9.337391966e-03f, +1.970376789e-02f, -4.864357078e-03f, -8.419725702e-03f, +1.878600735e-03f, +1.361489293e-03f, +0.000000000e+00f, - /* 20,13 */ +0.000000000e+00f, -2.170808154e-04f, +2.971909246e-03f, -1.959867511e-03f, -1.062161571e-02f, +5.866701604e-03f, +2.239890298e-02f, -9.923776326e-03f, -3.352791602e-02f, +1.169297592e-02f, +3.778668841e-02f, -1.025584288e-02f, -3.244383298e-02f, +6.875821908e-03f, +2.069305390e-02f, -3.586602863e-03f, -8.990907936e-03f, +1.484286050e-03f, +1.638662038e-03f, +0.000000000e+00f, - /* 20,14 */ +0.000000000e+00f, -2.870815261e-04f, +2.866023275e-03f, -1.276919763e-03f, -1.061062992e-02f, +4.149462009e-03f, +2.267661502e-02f, -7.019484999e-03f, -3.418837690e-02f, +8.036125742e-03f, +3.873376177e-02f, -6.721842627e-03f, -3.344119198e-02f, +4.274418757e-03f, +2.150371837e-02f, -2.202626937e-03f, -9.493276252e-03f, +1.033703668e-03f, +1.931175707e-03f, +0.000000000e+00f, - /* 20,15 */ +0.000000000e+00f, -3.387491377e-04f, +2.729031078e-03f, -6.307983207e-04f, -1.048404473e-02f, +2.467540325e-03f, +2.271744325e-02f, -4.117983282e-03f, -3.450613681e-02f, +4.328121901e-03f, +3.930609269e-02f, -3.088657053e-03f, -3.412515163e-02f, +1.557339330e-03f, +2.212021870e-02f, -7.235223044e-04f, -9.916240655e-03f, +5.288730096e-04f, +2.236335973e-03f, -3.929324583e-04f, - /* 16, 0 */ +3.044394378e-03f, -5.755865016e-03f, -7.644875237e-03f, +1.825808857e-02f, +9.222448502e-03f, -3.286388427e-02f, -4.241838036e-03f, +3.949755319e-02f, -4.241838036e-03f, -3.286388427e-02f, +9.222448502e-03f, +1.825808857e-02f, -7.644875237e-03f, -5.755865016e-03f, +3.044394378e-03f, -1.466795211e-05f, - /* 16, 1 */ +3.096598285e-03f, -4.938670705e-03f, -8.543525001e-03f, +1.681174815e-02f, +1.171692718e-02f, -3.156650717e-02f, -8.140229219e-03f, +3.927338559e-02f, -2.566011090e-04f, -3.380519836e-02f, +6.539747546e-03f, +1.954192550e-02f, -6.591652894e-03f, -6.554797296e-03f, +2.932700428e-03f, +1.424716020e-04f, - /* 16, 2 */ +3.093580763e-03f, -4.116215273e-03f, -9.283856280e-03f, +1.522768985e-02f, +1.399813452e-02f, -2.993548791e-02f, -1.190603152e-02f, +3.860369285e-02f, +3.768233493e-03f, -3.437220120e-02f, +3.697060454e-03f, +2.063975168e-02f, -5.390052618e-03f, -7.321916780e-03f, +2.757987679e-03f, +3.278051009e-04f, - /* 16, 3 */ +3.040228116e-03f, -3.300778044e-03f, -9.864516741e-03f, +1.353158972e-02f, +1.604446323e-02f, -2.799705310e-02f, -1.549559239e-02f, +3.749686691e-02f, +7.784523662e-03f, -3.455113173e-02f, +7.255039591e-04f, +2.152972014e-02f, -4.048737024e-03f, -8.043312786e-03f, +2.517583336e-03f, +5.415628140e-04f, - /* 16, 4 */ +2.941918573e-03f, -2.503765206e-03f, -1.028645874e-02f, +1.174962597e-02f, +1.783794825e-02f, -2.578082191e-02f, -1.886790220e-02f, +3.596676747e-02f, +1.174386090e-02f, -3.433297304e-02f, -2.341279491e-03f, +2.219201396e-02f, -2.578818314e-03f, -8.704920467e-03f, +2.209778110e-03f, +1.246855370e-03f, - /* 16, 5 */ +2.804395319e-03f, -1.735580001e-03f, -1.055281940e-02f, +9.908096520e-03f, +1.936441115e-02f, -2.331935318e-02f, -2.198510572e-02f, +3.403253365e-02f, +1.559820593e-02f, -3.371364718e-02f, -5.467520855e-03f, +2.260919785e-02f, -9.938011251e-04f, -9.292739628e-03f, +1.833922789e-03f, +1.492594630e-03f, - /* 16, 6 */ +2.633640678e-03f, -1.005515791e-03f, -1.066877263e-02f, +8.033047542e-03f, +2.061354789e-02f, -2.064765983e-02f, -2.481296600e-02f, +3.171832409e-02f, +1.930052332e-02f, -3.269414425e-02f, -8.615762914e-03f, +2.276654580e-02f, +6.905139302e-04f, -9.793063512e-03f, +1.390511455e-03f, +1.739628231e-03f, - /* 16, 7 */ +2.435753603e-03f, -3.216727033e-04f, -1.064135670e-02f, +6.149918447e-03f, +2.157895980e-02f, -1.780269814e-02f, -2.732127429e-02f, +2.905298940e-02f, +2.280540611e-02f, -3.128058296e-02f, -1.174733238e-02f, +2.265233903e-02f, +2.456165958e-03f, -1.019271416e-02f, +8.812491435e-04f, +1.982865330e-03f, - /* 16, 8 */ +2.216832517e-03f, +3.091018830e-04f, -1.047928070e-02f, +4.283208005e-03f, +2.225812888e-02f, -1.482283947e-02f, -2.948420097e-02f, +2.606968157e-02f, +2.606968157e-02f, -2.948420097e-02f, -1.482283947e-02f, +2.225812888e-02f, +4.283208005e-03f, -1.047928070e-02f, +3.091018830e-04f, +2.216832517e-03f, - /* 16, 9 */ +1.982865330e-03f, +8.812491435e-04f, -1.019271416e-02f, +2.456165958e-03f, +2.265233903e-02f, -1.174733238e-02f, -3.128058296e-02f, +2.280540611e-02f, +2.905298940e-02f, -2.732127429e-02f, -1.780269814e-02f, +2.157895980e-02f, +6.149918447e-03f, -1.064135670e-02f, -3.216727033e-04f, +2.435753603e-03f, - /* 16,10 */ +1.739628231e-03f, +1.390511455e-03f, -9.793063512e-03f, +6.905139302e-04f, +2.276654580e-02f, -8.615762914e-03f, -3.269414425e-02f, +1.930052332e-02f, +3.171832409e-02f, -2.481296600e-02f, -2.064765983e-02f, +2.061354789e-02f, +8.033047542e-03f, -1.066877263e-02f, -1.005515791e-03f, +2.633640678e-03f, - /* 16,11 */ +1.492594630e-03f, +1.833922789e-03f, -9.292739628e-03f, -9.938011251e-04f, +2.260919785e-02f, -5.467520855e-03f, -3.371364718e-02f, +1.559820593e-02f, +3.403253365e-02f, -2.198510572e-02f, -2.331935318e-02f, +1.936441115e-02f, +9.908096520e-03f, -1.055281940e-02f, -1.735580001e-03f, +2.804395319e-03f, - /* 16,12 */ +1.246855370e-03f, +2.209778110e-03f, -8.704920467e-03f, -2.578818314e-03f, +2.219201396e-02f, -2.341279491e-03f, -3.433297304e-02f, +1.174386090e-02f, +3.596676747e-02f, -1.886790220e-02f, -2.578082191e-02f, +1.783794825e-02f, +1.174962597e-02f, -1.028645874e-02f, -2.503765206e-03f, +2.941918573e-03f, - /* 16,13 */ +5.415628140e-04f, +2.517583336e-03f, -8.043312786e-03f, -4.048737024e-03f, +2.152972014e-02f, +7.255039591e-04f, -3.455113173e-02f, +7.784523662e-03f, +3.749686691e-02f, -1.549559239e-02f, -2.799705310e-02f, +1.604446323e-02f, +1.353158972e-02f, -9.864516741e-03f, -3.300778044e-03f, +3.040228116e-03f, - /* 16,14 */ +3.278051009e-04f, +2.757987679e-03f, -7.321916780e-03f, -5.390052618e-03f, +2.063975168e-02f, +3.697060454e-03f, -3.437220120e-02f, +3.768233493e-03f, +3.860369285e-02f, -1.190603152e-02f, -2.993548791e-02f, +1.399813452e-02f, +1.522768985e-02f, -9.283856280e-03f, -4.116215273e-03f, +3.093580763e-03f, - /* 16,15 */ +1.424716020e-04f, +2.932700428e-03f, -6.554797296e-03f, -6.591652894e-03f, +1.954192550e-02f, +6.539747546e-03f, -3.380519836e-02f, -2.566011090e-04f, +3.927338559e-02f, -8.140229219e-03f, -3.156650717e-02f, +1.171692718e-02f, +1.681174815e-02f, -8.543525001e-03f, -4.938670705e-03f, +3.096598285e-03f, - /* 16, 0 */ +2.106112688e-03f, -1.136549770e-04f, -1.070669430e-02f, +1.017472059e-02f, +1.725397418e-02f, -2.914959442e-02f, -8.963852042e-03f, +3.949755319e-02f, -8.963852042e-03f, -2.914959442e-02f, +1.725397418e-02f, +1.017472059e-02f, -1.070669430e-02f, -1.136549770e-04f, +2.106112688e-03f, +0.000000000e+00f, - /* 16, 1 */ +1.845338280e-03f, +5.473343456e-04f, -1.065891816e-02f, +8.155641030e-03f, +1.899089579e-02f, -2.691951328e-02f, -1.297236480e-02f, +3.923810803e-02f, -4.790894575e-03f, -3.103786392e-02f, +1.521305380e-02f, +1.215062389e-02f, -1.058864907e-02f, -8.385121370e-04f, +2.352913572e-03f, +0.000000000e+00f, - /* 16, 2 */ +1.577651889e-03f, +1.138027416e-03f, -1.045641117e-02f, +6.125232216e-03f, +2.040939526e-02f, -2.438627738e-02f, -1.676283724e-02f, +3.846353557e-02f, -5.100475811e-04f, -3.254996068e-02f, +1.288771825e-02f, +1.405076114e-02f, -1.029592106e-02f, -1.619065127e-03f, +2.578329862e-03f, +0.000000000e+00f, - /* 16, 3 */ +1.309641631e-03f, +1.653747621e-03f, -1.011218665e-02f, +4.114112388e-03f, +2.150028131e-02f, -2.159216402e-02f, -2.028541539e-02f, +3.718506562e-02f, +3.820010384e-03f, -3.365643786e-02f, +1.030255138e-02f, +1.584231759e-02f, -9.822158049e-03f, -2.445442331e-03f, +2.774741598e-03f, +0.000000000e+00f, - /* 16, 4 */ +5.462770218e-04f, +2.091544281e-03f, -9.640854940e-03f, +2.151223968e-03f, +2.225957955e-02f, -1.858235038e-02f, -2.349470263e-02f, +3.542121816e-02f, +8.139354376e-03f, -3.433331277e-02f, +7.486889709e-03f, +1.749279467e-02f, -9.163764446e-03f, -3.306153325e-03f, +2.934475195e-03f, -4.634120047e-04f, - /* 16, 5 */ +3.039101756e-04f, +2.450135010e-03f, -9.058284956e-03f, +2.634319572e-04f, +2.268843286e-02f, -1.540416082e-02f, -2.635039795e-02f, +3.319751225e-02f, +1.238771678e-02f, -3.456253827e-02f, +4.474489227e-03f, +1.897056596e-02f, -8.320109905e-03f, -4.188206830e-03f, +3.049970761e-03f, -4.400286560e-04f, - /* 16, 6 */ +9.722433303e-05f, +2.729819110e-03f, -8.381259809e-03f, -1.524826854e-03f, +2.279292110e-02f, -1.210629477e-02f, -2.881784707e-02f, +3.054606534e-02f, +1.650540309e-02f, -3.433238619e-02f, +1.303110212e-03f, +2.024543829e-02f, -7.293693549e-03f, -5.077265419e-03f, +3.113958519e-03f, -3.921992729e-04f, - /* 16, 7 */ -7.427658644e-05f, +2.932365266e-03f, -7.627133157e-03f, -3.191839567e-03f, +2.258380561e-02f, -8.738048497e-03f, -3.086849848e-02f, +2.750508980e-02f, +2.043420490e-02f, -3.363773532e-02f, -1.985974837e-03f, +2.128920837e-02f, -6.090258802e-03f, -5.957835775e-03f, +3.119640969e-03f, -3.169896142e-04f, - /* 16, 8 */ -2.117631665e-04f, +3.060877176e-03f, -6.813492559e-03f, -4.718854594e-03f, +2.207620481e-02f, -5.348543574e-03f, -3.248025769e-02f, +2.411829496e-02f, +2.411829496e-02f, -3.248025769e-02f, -5.348543574e-03f, +2.207620481e-02f, -4.718854594e-03f, -6.813492559e-03f, +3.060877176e-03f, -2.117631665e-04f, - /* 16, 9 */ -3.169896142e-04f, +3.119640969e-03f, -5.957835775e-03f, -6.090258802e-03f, +2.128920837e-02f, -1.985974837e-03f, -3.363773532e-02f, +2.043420490e-02f, +2.750508980e-02f, -3.086849848e-02f, -8.738048497e-03f, +2.258380561e-02f, -3.191839567e-03f, -7.627133157e-03f, +2.932365266e-03f, -7.427658644e-05f, - /* 16,10 */ -3.921992729e-04f, +3.113958519e-03f, -5.077265419e-03f, -7.293693549e-03f, +2.024543829e-02f, +1.303110212e-03f, -3.433238619e-02f, +1.650540309e-02f, +3.054606534e-02f, -2.881784707e-02f, -1.210629477e-02f, +2.279292110e-02f, -1.524826854e-03f, -8.381259809e-03f, +2.729819110e-03f, +9.722433303e-05f, - /* 16,11 */ -4.400286560e-04f, +3.049970761e-03f, -4.188206830e-03f, -8.320109905e-03f, +1.897056596e-02f, +4.474489227e-03f, -3.456253827e-02f, +1.238771678e-02f, +3.319751225e-02f, -2.635039795e-02f, -1.540416082e-02f, +2.268843286e-02f, +2.634319572e-04f, -9.058284956e-03f, +2.450135010e-03f, +3.039101756e-04f, - /* 16,12 */ -4.634120047e-04f, +2.934475195e-03f, -3.306153325e-03f, -9.163764446e-03f, +1.749279467e-02f, +7.486889709e-03f, -3.433331277e-02f, +8.139354376e-03f, +3.542121816e-02f, -2.349470263e-02f, -1.858235038e-02f, +2.225957955e-02f, +2.151223968e-03f, -9.640854940e-03f, +2.091544281e-03f, +5.462770218e-04f, - /* 16,13 */ +0.000000000e+00f, +2.774741598e-03f, -2.445442331e-03f, -9.822158049e-03f, +1.584231759e-02f, +1.030255138e-02f, -3.365643786e-02f, +3.820010384e-03f, +3.718506562e-02f, -2.028541539e-02f, -2.159216402e-02f, +2.150028131e-02f, +4.114112388e-03f, -1.011218665e-02f, +1.653747621e-03f, +1.309641631e-03f, - /* 16,14 */ +0.000000000e+00f, +2.578329862e-03f, -1.619065127e-03f, -1.029592106e-02f, +1.405076114e-02f, +1.288771825e-02f, -3.254996068e-02f, -5.100475811e-04f, +3.846353557e-02f, -1.676283724e-02f, -2.438627738e-02f, +2.040939526e-02f, +6.125232216e-03f, -1.045641117e-02f, +1.138027416e-03f, +1.577651889e-03f, - /* 16,15 */ +0.000000000e+00f, +2.352913572e-03f, -8.385121370e-04f, -1.058864907e-02f, +1.215062389e-02f, +1.521305380e-02f, -3.103786392e-02f, -4.790894575e-03f, +3.923810803e-02f, -1.297236480e-02f, -2.691951328e-02f, +1.899089579e-02f, +8.155641030e-03f, -1.065891816e-02f, +5.473343456e-04f, +1.845338280e-03f, - /* 16, 0 */ -2.517634455e-04f, +5.956310854e-03f, -8.647029609e-03f, +1.153545125e-03f, +2.185732832e-02f, -2.369518339e-02f, -1.347728153e-02f, +3.949755319e-02f, -1.347728153e-02f, -2.369518339e-02f, +2.185732832e-02f, +1.153545125e-03f, -8.647029609e-03f, +2.914798040e-03f, -2.517634455e-04f, +0.000000000e+00f, - /* 16, 1 */ -3.647589216e-04f, +5.559366521e-03f, -7.860683839e-03f, -8.150822761e-04f, +2.252089097e-02f, -2.063007883e-02f, -1.749200540e-02f, +3.920026256e-02f, -9.205150933e-03f, -2.647415600e-02f, +2.081322447e-02f, +3.223212212e-03f, -9.337661142e-03f, +2.677108373e-03f, -9.939782505e-05f, +0.000000000e+00f, - /* 16, 2 */ -4.414886472e-04f, +5.113535158e-03f, -7.000222932e-03f, -2.654422569e-03f, +2.280787202e-02f, -1.733513495e-02f, -2.118899605e-02f, +3.831333038e-02f, -4.740975303e-03f, -2.891426752e-02f, +1.939126736e-02f, +5.362271050e-03f, -9.911447152e-03f, +2.349799583e-03f, +9.477253367e-05f, +0.000000000e+00f, - /* 16, 3 */ -4.855802427e-04f, +4.633347213e-03f, -6.087250386e-03f, -4.340001532e-03f, +2.272858071e-02f, -1.386914009e-02f, -2.451395150e-02f, +3.685148678e-02f, -1.540603716e-04f, -3.096737610e-02f, +1.760097190e-02f, +7.536131493e-03f, -1.034820384e-02f, +1.931270179e-03f, +3.323676319e-04f, +0.000000000e+00f, - /* 16, 4 */ +0.000000000e+00f, +4.132457962e-03f, -5.142935987e-03f, -5.851401101e-03f, +2.229926864e-02f, -1.029228788e-02f, -2.741946400e-02f, +3.483898696e-02f, +4.483517704e-03f, -3.259088680e-02f, +1.545873378e-02f, +9.707799030e-03f, -1.062918096e-02f, +1.421916825e-03f, +6.140535745e-04f, +0.000000000e+00f, - /* 16, 5 */ +0.000000000e+00f, +3.623457200e-03f, -4.187611099e-03f, -7.172450485e-03f, +2.154162444e-02f, -6.665085054e-03f, -2.986575546e-02f, +3.230917458e-02f, +9.098146940e-03f, -3.374862716e-02f, +1.298775300e-02f, +1.183848413e-02f, -1.073754388e-02f, +8.242784646e-04f, +9.394126333e-04f, +0.000000000e+00f, - /* 16, 6 */ +0.000000000e+00f, +3.117716971e-03f, -3.240404345e-03f, -8.291325326e-03f, +2.048218318e-02f, -3.047278250e-03f, -3.182126614e-02f, +2.930388237e-02f, +1.361595241e-02f, -3.441162052e-02f, +1.021782484e-02f, +1.388827332e-02f, -1.065884073e-02f, +1.431392807e-04f, +1.306826648e-03f, +0.000000000e+00f, - /* 16, 7 */ +0.000000000e+00f, +2.625277441e-03f, -2.318923448e-03f, -9.200556695e-03f, +1.915166452e-02f, +5.031802154e-04f, -3.326308735e-02f, +2.587268140e-02f, +1.796408380e-02f, -3.455874049e-02f, +7.184998851e-03f, +1.581685040e-02f, -1.038144369e-02f, -6.144144569e-04f, +1.713377737e-03f, +0.000000000e+00f, - /* 16, 8 */ +0.000000000e+00f, +2.154770219e-03f, -1.438987736e-03f, -9.896953513e-03f, +1.758425506e-02f, +3.931108902e-03f, -3.417723209e-02f, +2.207199352e-02f, +2.207199352e-02f, -3.417723209e-02f, +3.931108902e-03f, +1.758425506e-02f, -9.896953513e-03f, -1.438987736e-03f, +2.154770219e-03f, +0.000000000e+00f, - /* 16, 9 */ +0.000000000e+00f, +1.713377737e-03f, -6.144144569e-04f, -1.038144369e-02f, +1.581685040e-02f, +7.184998851e-03f, -3.455874049e-02f, +1.796408380e-02f, +2.587268140e-02f, -3.326308735e-02f, +5.031802154e-04f, +1.915166452e-02f, -9.200556695e-03f, -2.318923448e-03f, +2.625277441e-03f, +0.000000000e+00f, - /* 16,10 */ +0.000000000e+00f, +1.306826648e-03f, +1.431392807e-04f, -1.065884073e-02f, +1.388827332e-02f, +1.021782484e-02f, -3.441162052e-02f, +1.361595241e-02f, +2.930388237e-02f, -3.182126614e-02f, -3.047278250e-03f, +2.048218318e-02f, -8.291325326e-03f, -3.240404345e-03f, +3.117716971e-03f, +0.000000000e+00f, - /* 16,11 */ +0.000000000e+00f, +9.394126333e-04f, +8.242784646e-04f, -1.073754388e-02f, +1.183848413e-02f, +1.298775300e-02f, -3.374862716e-02f, +9.098146940e-03f, +3.230917458e-02f, -2.986575546e-02f, -6.665085054e-03f, +2.154162444e-02f, -7.172450485e-03f, -4.187611099e-03f, +3.623457200e-03f, +0.000000000e+00f, - /* 16,12 */ +0.000000000e+00f, +6.140535745e-04f, +1.421916825e-03f, -1.062918096e-02f, +9.707799030e-03f, +1.545873378e-02f, -3.259088680e-02f, +4.483517704e-03f, +3.483898696e-02f, -2.741946400e-02f, -1.029228788e-02f, +2.229926864e-02f, -5.851401101e-03f, -5.142935987e-03f, +4.132457962e-03f, +0.000000000e+00f, - /* 16,13 */ +0.000000000e+00f, +3.323676319e-04f, +1.931270179e-03f, -1.034820384e-02f, +7.536131493e-03f, +1.760097190e-02f, -3.096737610e-02f, -1.540603716e-04f, +3.685148678e-02f, -2.451395150e-02f, -1.386914009e-02f, +2.272858071e-02f, -4.340001532e-03f, -6.087250386e-03f, +4.633347213e-03f, -4.855802427e-04f, - /* 16,14 */ +0.000000000e+00f, +9.477253367e-05f, +2.349799583e-03f, -9.911447152e-03f, +5.362271050e-03f, +1.939126736e-02f, -2.891426752e-02f, -4.740975303e-03f, +3.831333038e-02f, -2.118899605e-02f, -1.733513495e-02f, +2.280787202e-02f, -2.654422569e-03f, -7.000222932e-03f, +5.113535158e-03f, -4.414886472e-04f, - /* 16,15 */ +0.000000000e+00f, -9.939782505e-05f, +2.677108373e-03f, -9.337661142e-03f, +3.223212212e-03f, +2.081322447e-02f, -2.647415600e-02f, -9.205150933e-03f, +3.920026256e-02f, -1.749200540e-02f, -2.063007883e-02f, +2.252089097e-02f, -8.150822761e-04f, -7.860683839e-03f, +5.559366521e-03f, -3.647589216e-04f, - /* 12, 0 */ -3.924537125e-03f, -6.177283790e-03f, +2.270137823e-02f, -1.696686670e-02f, -1.770529738e-02f, +3.949755319e-02f, -1.770529738e-02f, -1.696686670e-02f, +2.270137823e-02f, -6.177283790e-03f, -3.924537125e-03f, +2.689823824e-03f, - /* 12, 1 */ -2.918444824e-03f, -7.533875928e-03f, +2.217225575e-02f, -1.325050127e-02f, -2.161377319e-02f, +3.915985190e-02f, -1.343239533e-02f, -2.049610855e-02f, +2.283609035e-02f, -4.600700986e-03f, -4.945631587e-03f, +2.897838580e-03f, - /* 12, 2 */ -1.948111766e-03f, -8.657444743e-03f, +2.127619260e-02f, -9.420045488e-03f, -2.509275167e-02f, +3.815312062e-02f, -8.867972963e-03f, -2.376686078e-02f, +2.255583139e-02f, -2.822790564e-03f, -5.958903400e-03f, +3.051876120e-03f, - /* 12, 3 */ -1.031879811e-03f, -9.540571177e-03f, +2.004673480e-02f, -5.548699503e-03f, -2.808617760e-02f, +3.649634673e-02f, -4.091413649e-03f, -2.671092541e-02f, +2.184766025e-02f, -8.677312765e-04f, -6.939883353e-03f, +3.140832095e-03f, - /* 12, 4 */ -1.854082964e-04f, -1.018130776e-02f, +1.852257236e-02f, -1.708362919e-03f, -3.054799363e-02f, +3.422074403e-02f, +8.129280323e-04f, -2.926474106e-02f, +2.070682375e-02f, +1.235031889e-03f, -7.862950435e-03f, +3.154329873e-03f, - /* 12, 5 */ +5.785109863e-04f, -1.058292035e-02f, +1.674653148e-02f, +2.031769072e-03f, -3.244290444e-02f, +3.136911490e-02f, +5.757350815e-03f, -3.137078637e-02f, +1.913716500e-02f, +3.451172065e-03f, -8.701884951e-03f, +3.083080347e-03f, - /* 12, 6 */ +1.250056620e-03f, -1.075352499e-02f, +1.476451598e-02f, +5.606517218e-03f, -3.374690984e-02f, +2.799497691e-02f, +1.065251585e-02f, -3.297888633e-02f, +1.715135739e-02f, +5.741996578e-03f, -9.430471381e-03f, +2.919238566e-03f, - /* 12, 7 */ +1.822400383e-03f, -1.070563332e-02f, +1.262442359e-02f, +8.955911342e-03f, -3.444759838e-02f, +2.416147295e-02f, +1.540920462e-02f, -3.404739100e-02f, +1.477095353e-02f, +8.065088216e-03f, -1.002313834e-02f, +2.656746896e-03f, - /* 12, 8 */ +2.291654178e-03f, -1.045562141e-02f, +1.037506188e-02f, +1.202624229e-02f, -3.454419870e-02f, +1.994008861e-02f, +1.994008861e-02f, -3.454419870e-02f, +1.202624229e-02f, +1.037506188e-02f, -1.045562141e-02f, +2.291654178e-03f, - /* 12, 9 */ +2.656746896e-03f, -1.002313834e-02f, +8.065088216e-03f, +1.477095353e-02f, -3.404739100e-02f, +1.540920462e-02f, +2.416147295e-02f, -3.444759838e-02f, +8.955911342e-03f, +1.262442359e-02f, -1.070563332e-02f, +1.822400383e-03f, - /* 12,10 */ +2.919238566e-03f, -9.430471381e-03f, +5.741996578e-03f, +1.715135739e-02f, -3.297888633e-02f, +1.065251585e-02f, +2.799497691e-02f, -3.374690984e-02f, +5.606517218e-03f, +1.476451598e-02f, -1.075352499e-02f, +1.250056620e-03f, - /* 12,11 */ +3.083080347e-03f, -8.701884951e-03f, +3.451172065e-03f, +1.913716500e-02f, -3.137078637e-02f, +5.757350815e-03f, +3.136911490e-02f, -3.244290444e-02f, +2.031769072e-03f, +1.674653148e-02f, -1.058292035e-02f, +5.785109863e-04f, - /* 12,12 */ +3.154329873e-03f, -7.862950435e-03f, +1.235031889e-03f, +2.070682375e-02f, -2.926474106e-02f, +8.129280323e-04f, +3.422074403e-02f, -3.054799363e-02f, -1.708362919e-03f, +1.852257236e-02f, -1.018130776e-02f, -1.854082964e-04f, - /* 12,13 */ +3.140832095e-03f, -6.939883353e-03f, -8.677312765e-04f, +2.184766025e-02f, -2.671092541e-02f, -4.091413649e-03f, +3.649634673e-02f, -2.808617760e-02f, -5.548699503e-03f, +2.004673480e-02f, -9.540571177e-03f, -1.031879811e-03f, - /* 12,14 */ +3.051876120e-03f, -5.958903400e-03f, -2.822790564e-03f, +2.255583139e-02f, -2.376686078e-02f, -8.867972963e-03f, +3.815312062e-02f, -2.509275167e-02f, -9.420045488e-03f, +2.127619260e-02f, -8.657444743e-03f, -1.948111766e-03f, - /* 12,15 */ +2.897838580e-03f, -4.945631587e-03f, -4.600700986e-03f, +2.283609035e-02f, -2.049610855e-02f, -1.343239533e-02f, +3.915985190e-02f, -2.161377319e-02f, -1.325050127e-02f, +2.217225575e-02f, -7.533875928e-03f, -2.918444824e-03f, - /* 12, 0 */ +5.529156756e-04f, -1.017944650e-02f, +2.010395691e-02f, -9.501724583e-03f, -2.157725737e-02f, +3.949755319e-02f, -2.157725737e-02f, -9.501724583e-03f, +2.010395691e-02f, -1.017944650e-02f, +5.529156756e-04f, +9.520529918e-04f, - /* 12, 1 */ +1.269440891e-03f, -1.060857725e-02f, +1.848426560e-02f, -5.389674050e-03f, -2.526172923e-02f, +3.911687897e-02f, -1.740939271e-02f, -1.356576871e-02f, +2.138958875e-02f, -9.480008902e-03f, -2.676127190e-04f, +1.273328470e-03f, - /* 12, 2 */ +1.873685854e-03f, -1.077705214e-02f, +1.658179711e-02f, -1.315683663e-03f, -2.839592801e-02f, +3.798295250e-02f, -1.283645305e-02f, -1.749413418e-02f, +2.229518867e-02f, -8.506812328e-03f, -1.180051037e-03f, +1.604489886e-03f, - /* 12, 3 */ +2.361120897e-03f, -1.070010905e-02f, +1.445171501e-02f, +2.637679549e-03f, -3.092573063e-02f, +3.611987567e-02f, -7.946589383e-03f, -2.119952675e-02f, +2.278144860e-02f, -7.263083188e-03f, -2.168530550e-03f, +1.934678236e-03f, - /* 12, 4 */ +2.730794315e-03f, -1.039785120e-02f, +1.215160004e-02f, +6.393108320e-03f, -3.281077803e-02f, +3.356720057e-02f, -2.835931904e-03f, -2.459705675e-02f, +2.281696739e-02f, -5.759053577e-03f, -3.213563229e-03f, +2.251787566e-03f, - /* 12, 5 */ +2.985073479e-03f, -9.894440683e-03f, +9.739988515e-03f, +9.880142532e-03f, -3.402514934e-02f, +3.037901891e-02f, +2.393471366e-03f, -2.760625942e-02f, +2.237934513e-02f, -4.012119167e-03f, -4.292316215e-03f, +2.542756696e-03f, - /* 12, 6 */ +3.129309714e-03f, -9.217233004e-03f, +7.274949975e-03f, +1.303654969e-02f, -3.455769209e-02f, +2.662271867e-02f, +7.635875993e-03f, -3.015305887e-02f, +2.145609570e-02f, -2.046814992e-03f, -5.379003980e-03f, +2.793918230e-03f, - /* 12, 7 */ +3.171441616e-03f, -8.395878746e-03f, +4.812738303e-03f, +1.580947051e-02f, -3.441200543e-02f, +2.237743869e-02f, +1.278417054e-02f, -3.217162603e-02f, +2.004534769e-02f, +1.053992035e-04f, -6.445394017e-03f, +2.991397563e-03f, - /* 12, 8 */ +3.121552430e-03f, -7.461418245e-03f, +2.406547485e-03f, +1.815630830e-02f, -3.360608252e-02f, +1.773225889e-02f, +1.773225889e-02f, -3.360608252e-02f, +1.815630830e-02f, +2.406547485e-03f, -7.461418245e-03f, +3.121552430e-03f, - /* 12, 9 */ +2.991397563e-03f, -6.445394017e-03f, +1.053992035e-04f, +2.004534769e-02f, -3.217162603e-02f, +1.278417054e-02f, +2.237743869e-02f, -3.441200543e-02f, +1.580947051e-02f, +4.812738303e-03f, -8.395878746e-03f, +3.171441616e-03f, - /* 12,10 */ +2.793918230e-03f, -5.379003980e-03f, -2.046814992e-03f, +2.145609570e-02f, -3.015305887e-02f, +7.635875993e-03f, +2.662271867e-02f, -3.455769209e-02f, +1.303654969e-02f, +7.274949975e-03f, -9.217233004e-03f, +3.129309714e-03f, - /* 12,11 */ +2.542756696e-03f, -4.292316215e-03f, -4.012119167e-03f, +2.237934513e-02f, -2.760625942e-02f, +2.393471366e-03f, +3.037901891e-02f, -3.402514934e-02f, +9.880142532e-03f, +9.739988515e-03f, -9.894440683e-03f, +2.985073479e-03f, - /* 12,12 */ +2.251787566e-03f, -3.213563229e-03f, -5.759053577e-03f, +2.281696739e-02f, -2.459705675e-02f, -2.835931904e-03f, +3.356720057e-02f, -3.281077803e-02f, +6.393108320e-03f, +1.215160004e-02f, -1.039785120e-02f, +2.730794315e-03f, - /* 12,13 */ +1.934678236e-03f, -2.168530550e-03f, -7.263083188e-03f, +2.278144860e-02f, -2.119952675e-02f, -7.946589383e-03f, +3.611987567e-02f, -3.092573063e-02f, +2.637679549e-03f, +1.445171501e-02f, -1.070010905e-02f, +2.361120897e-03f, - /* 12,14 */ +1.604489886e-03f, -1.180051037e-03f, -8.506812328e-03f, +2.229518867e-02f, -1.749413418e-02f, -1.283645305e-02f, +3.798295250e-02f, -2.839592801e-02f, -1.315683663e-03f, +1.658179711e-02f, -1.077705214e-02f, +1.873685854e-03f, - /* 12,15 */ +1.273328470e-03f, -2.676127190e-04f, -9.480008902e-03f, +2.138958875e-02f, -1.356576871e-02f, -1.740939271e-02f, +3.911687897e-02f, -2.526172923e-02f, -5.389674050e-03f, +1.848426560e-02f, -1.060857725e-02f, +1.269440891e-03f, - - /* 24, 0 */ -8.820438069e-05f, -1.519461079e-04f, -2.301651496e-04f, -3.149320871e-04f, -3.945939739e-04f, -4.554410135e-04f, -4.841532882e-04f, -4.705408991e-04f, -4.099602091e-04f, -3.048100066e-04f, -1.646897470e-04f, -5.099007530e-06f, +1.551006323e-04f, +2.969416536e-04f, +4.046294158e-04f, +4.681429482e-04f, +4.846228261e-04f, +4.583040637e-04f, +3.990939388e-04f, +3.201968846e-04f, +2.353759082e-04f, +1.564712483e-04f, +9.167483068e-05f, +4.482688286e-05f, - /* 24, 1 */ -8.480575132e-05f, -1.474789784e-04f, -2.249812225e-04f, -3.096480504e-04f, -3.900204007e-04f, -4.524514078e-04f, -4.835165803e-04f, -4.727530367e-04f, -4.151145025e-04f, -3.125397891e-04f, -1.742016828e-04f, -1.529460870e-05f, +1.454387449e-04f, +2.889379628e-04f, +3.991236794e-04f, +4.655589110e-04f, +4.849233000e-04f, +4.610375470e-04f, +4.035168325e-04f, +3.254391996e-04f, +2.406110065e-04f, +1.610529558e-04f, +9.521673594e-05f, +4.721513201e-05f, - /* 24, 2 */ -8.147924507e-05f, -1.430712350e-04f, -2.198265592e-04f, -3.043479843e-04f, -3.853766873e-04f, -4.493383067e-04f, -4.827146831e-04f, -4.747797448e-04f, -4.200908527e-04f, -3.201278616e-04f, -1.836320864e-04f, -2.548296987e-05f, +1.357085413e-04f, +2.808022583e-04f, +3.934446700e-04f, +4.627886263e-04f, +4.850529052e-04f, +4.636385032e-04f, +4.078592000e-04f, +3.306557574e-04f, +2.458678944e-04f, +1.656897170e-04f, +9.882966748e-05f, +4.967415993e-05f, - /* 24, 3 */ -7.822510242e-05f, -1.387241832e-04f, -2.147035314e-04f, -2.990350629e-04f, -3.806663042e-04f, -4.461048161e-04f, -4.817496625e-04f, -4.766215175e-04f, -4.248879309e-04f, -3.275711800e-04f, -1.929766610e-04f, -3.565926997e-05f, +1.259145254e-04f, +2.725379532e-04f, +3.875941701e-04f, +4.598320457e-04f, +4.850099279e-04f, +4.661040260e-04f, +4.121175966e-04f, +3.358432542e-04f, +2.511439643e-04f, +1.703799499e-04f, +1.025131319e-04f, +5.220438912e-05f, - /* 24, 4 */ -7.504350274e-05f, -1.344390595e-04f, -2.096144489e-04f, -2.937124231e-04f, -3.758927218e-04f, -4.427540852e-04f, -4.806236671e-04f, -4.782789577e-04f, -4.295045226e-04f, -3.348667971e-04f, -2.022311686e-04f, -4.581869630e-05f, +1.160612449e-04f, +2.641485480e-04f, +3.815740737e-04f, +4.566892339e-04f, +4.847927474e-04f, +4.684312656e-04f, +4.162885910e-04f, +3.409983591e-04f, +2.564365532e-04f, +1.751220037e-04f, +1.062665706e-04f, +5.480619333e-05f, - /* 24, 5 */ -7.193456522e-05f, -1.302170312e-04f, -2.045615590e-04f, -2.883831622e-04f, -3.710594077e-04f, -4.392893036e-04f, -4.793389263e-04f, -4.797527765e-04f, -4.339395286e-04f, -3.420118645e-04f, -2.113914331e-04f, -5.595644787e-05f, +1.061532886e-04f, +2.556376279e-04f, +3.753863858e-04f, +4.533603695e-04f, +4.843998374e-04f, +4.706174312e-04f, +4.203687678e-04f, +3.461177167e-04f, +2.617429433e-04f, +1.799141593e-04f, +1.100893595e-04f, +5.747989630e-05f, - /* 24, 6 */ -6.889834987e-05f, -1.260591965e-04f, -1.995470454e-04f, -2.830503358e-04f, -3.661698243e-04f, -4.357136989e-04f, -4.778977479e-04f, -4.810437916e-04f, -4.381919648e-04f, -3.490036345e-04f, -2.204533432e-04f, -6.606773875e-05f, +9.619528314e-05f, +2.470088608e-04f, +3.690332209e-04f, +4.498457452e-04f, +4.838297683e-04f, +4.726597937e-04f, +4.243547301e-04f, +3.511979487e-04f, +2.670603639e-04f, +1.847546294e-04f, +1.139808078e-04f, +6.022577049e-05f, - /* 24, 7 */ -6.593485851e-05f, -1.219665852e-04f, -1.945730275e-04f, -2.777169567e-04f, -3.612274261e-04f, -4.320305335e-04f, -4.763025159e-04f, -4.821529264e-04f, -4.422609626e-04f, -3.558394612e-04f, -2.294128549e-04f, -7.614780136e-05f, +8.619188981e-05f, +2.382659945e-04f, +3.625168024e-04f, +4.461457687e-04f, +4.830812085e-04f, +4.745556880e-04f, +4.282431024e-04f, +3.562356572e-04f, +2.723859925e-04f, +1.896415594e-04f, +1.179401580e-04f, +6.304403582e-05f, - /* 24, 8 */ -6.304403582e-05f, -1.179401580e-04f, -1.896415594e-04f, -2.723859925e-04f, -3.562356572e-04f, -4.282431024e-04f, -4.745556880e-04f, -4.830812085e-04f, -4.461457687e-04f, -3.625168024e-04f, -2.382659945e-04f, -8.619188981e-05f, +7.614780136e-05f, +2.294128549e-04f, +3.558394612e-04f, +4.422609626e-04f, +4.821529264e-04f, +4.763025159e-04f, +4.320305335e-04f, +3.612274261e-04f, +2.777169567e-04f, +1.945730275e-04f, +1.219665852e-04f, +6.593485851e-05f, - /* 24, 9 */ -6.022577049e-05f, -1.139808078e-04f, -1.847546294e-04f, -2.670603639e-04f, -3.511979487e-04f, -4.243547301e-04f, -4.726597937e-04f, -4.838297683e-04f, -4.498457452e-04f, -3.690332209e-04f, -2.470088608e-04f, -9.619528314e-05f, +6.606773875e-05f, +2.204533432e-04f, +3.490036345e-04f, +4.381919648e-04f, +4.810437916e-04f, +4.778977479e-04f, +4.357136989e-04f, +3.661698243e-04f, +2.830503358e-04f, +1.995470454e-04f, +1.260591965e-04f, +6.889834987e-05f, - /* 24,10 */ -5.747989630e-05f, -1.100893595e-04f, -1.799141593e-04f, -2.617429433e-04f, -3.461177167e-04f, -4.203687678e-04f, -4.706174312e-04f, -4.843998374e-04f, -4.533603695e-04f, -3.753863858e-04f, -2.556376279e-04f, -1.061532886e-04f, +5.595644787e-05f, +2.113914331e-04f, +3.420118645e-04f, +4.339395286e-04f, +4.797527765e-04f, +4.793389263e-04f, +4.392893036e-04f, +3.710594077e-04f, +2.883831622e-04f, +2.045615590e-04f, +1.302170312e-04f, +7.193456522e-05f, - /* 24,11 */ -5.480619333e-05f, -1.062665706e-04f, -1.751220037e-04f, -2.564365532e-04f, -3.409983591e-04f, -4.162885910e-04f, -4.684312656e-04f, -4.847927474e-04f, -4.566892339e-04f, -3.815740737e-04f, -2.641485480e-04f, -1.160612449e-04f, +4.581869630e-05f, +2.022311686e-04f, +3.348667971e-04f, +4.295045226e-04f, +4.782789577e-04f, +4.806236671e-04f, +4.427540852e-04f, +3.758927218e-04f, +2.937124231e-04f, +2.096144489e-04f, +1.344390595e-04f, +7.504350274e-05f, - /* 24,12 */ -5.220438912e-05f, -1.025131319e-04f, -1.703799499e-04f, -2.511439643e-04f, -3.358432542e-04f, -4.121175966e-04f, -4.661040260e-04f, -4.850099279e-04f, -4.598320457e-04f, -3.875941701e-04f, -2.725379532e-04f, -1.259145254e-04f, +3.565926997e-05f, +1.929766610e-04f, +3.275711800e-04f, +4.248879309e-04f, +4.766215175e-04f, +4.817496625e-04f, +4.461048161e-04f, +3.806663042e-04f, +2.990350629e-04f, +2.147035314e-04f, +1.387241832e-04f, +7.822510242e-05f, - /* 24,13 */ -4.967415993e-05f, -9.882966748e-05f, -1.656897170e-04f, -2.458678944e-04f, -3.306557574e-04f, -4.078592000e-04f, -4.636385032e-04f, -4.850529052e-04f, -4.627886263e-04f, -3.934446700e-04f, -2.808022583e-04f, -1.357085413e-04f, +2.548296987e-05f, +1.836320864e-04f, +3.201278616e-04f, +4.200908527e-04f, +4.747797448e-04f, +4.827146831e-04f, +4.493383067e-04f, +3.853766873e-04f, +3.043479843e-04f, +2.198265592e-04f, +1.430712350e-04f, +8.147924507e-05f, - /* 24,14 */ -4.721513201e-05f, -9.521673594e-05f, -1.610529558e-04f, -2.406110065e-04f, -3.254391996e-04f, -4.035168325e-04f, -4.610375470e-04f, -4.849233000e-04f, -4.655589110e-04f, -3.991236794e-04f, -2.889379628e-04f, -1.454387449e-04f, +1.529460870e-05f, +1.742016828e-04f, +3.125397891e-04f, +4.151145025e-04f, +4.727530367e-04f, +4.835165803e-04f, +4.524514078e-04f, +3.900204007e-04f, +3.096480504e-04f, +2.249812225e-04f, +1.474789784e-04f, +8.480575132e-05f, - /* 24,15 */ -4.482688286e-05f, -9.167483068e-05f, -1.564712483e-04f, -2.353759082e-04f, -3.201968846e-04f, -3.990939388e-04f, -4.583040637e-04f, -4.846228261e-04f, -4.681429482e-04f, -4.046294158e-04f, -2.969416536e-04f, -1.551006323e-04f, +5.099007530e-06f, +1.646897470e-04f, +3.048100066e-04f, +4.099602091e-04f, +4.705408991e-04f, +4.841532882e-04f, +4.554410135e-04f, +3.945939739e-04f, +3.149320871e-04f, +2.301651496e-04f, +1.519461079e-04f, +8.820438069e-05f, - /* 24, 0 */ +3.721332452e-05f, -8.727351622e-06f, -1.260052743e-04f, -3.262895896e-04f, -5.956603662e-04f, -8.899501259e-04f, -1.140781305e-03f, -1.272347980e-03f, -1.224469676e-03f, -9.741728935e-04f, -5.476309302e-04f, -1.718639697e-05f, +5.165697336e-04f, +9.521355524e-04f, +1.214742061e-03f, +1.275075958e-03f, +1.153251370e-03f, +9.076938752e-04f, +6.139361451e-04f, +3.414081512e-04f, +1.360881127e-04f, +1.374767685e-05f, -3.597568203e-05f, -3.836441874e-05f, - /* 24, 1 */ +3.827272022e-05f, -3.990309212e-06f, -1.162552839e-04f, -3.114511951e-04f, -5.774902753e-04f, -8.720393210e-04f, -1.127840237e-03f, -1.268906542e-03f, -1.233389975e-03f, -9.955061195e-04f, -5.782766642e-04f, -5.154594549e-05f, +4.851159022e-04f, +9.294071718e-04f, +1.204207601e-03f, +1.277079499e-03f, +1.165232472e-03f, +9.252515980e-04f, +6.323029482e-04f, +3.567995352e-04f, +1.465038861e-04f, +1.905656402e-05f, -3.455261727e-05f, -3.906074609e-05f, - /* 24, 2 */ +3.916105537e-05f, +4.689475139e-07f, -1.068376458e-04f, -2.968998221e-04f, -5.594401371e-04f, -8.539803004e-04f, -1.114446367e-03f, -1.264763218e-03f, -1.241503276e-03f, -1.016122900e-03f, -6.084845647e-04f, -8.586577249e-05f, +4.532926958e-04f, +9.060015608e-04f, +1.192867560e-03f, +1.278348235e-03f, +1.176706916e-03f, +9.426042142e-04f, +6.507457252e-04f, +3.724559064e-04f, +1.572522637e-04f, +2.465906089e-05f, -3.293697730e-05f, -3.967556907e-05f, - /* 24, 3 */ +3.988551544e-05f, +4.656120273e-06f, -9.775146571e-05f, -2.826418349e-04f, -5.415238064e-04f, -8.357917522e-04f, -1.100618114e-03f, -1.259930153e-03f, -1.248810685e-03f, -1.036011659e-03f, -6.382327409e-04f, -1.201194461e-04f, +4.211237814e-04f, +8.819332498e-04f, +1.180724004e-03f, +1.278872430e-03f, +1.187657300e-03f, +9.597325558e-04f, +6.692490513e-04f, +3.883689407e-04f, +1.683324883e-04f, +3.055997058e-05f, -3.112164378e-05f, -4.020250110e-05f, - /* 24, 4 */ +4.045327387e-05f, +8.577101915e-06f, -8.899546026e-05f, -2.686831091e-04f, -5.237547173e-04f, -8.174921923e-04f, -1.086374092e-03f, -1.254420050e-03f, -1.255314082e-03f, -1.055161588e-03f, -6.674998060e-04f, -1.542806079e-04f, +3.886332072e-04f, +8.572174771e-04f, +1.167779798e-03f, +1.278642989e-03f, +1.198066533e-03f, +9.766173891e-04f, +6.877971412e-04f, +4.045298263e-04f, +1.797433681e-04f, +3.676383839e-05f, -2.909954521e-05f, -4.063504078e-05f, - /* 24, 5 */ +4.087148106e-05f, +1.223796294e-05f, -8.056796775e-05f, -2.550290329e-04f, -5.061458738e-04f, -7.990999447e-04f, -1.071733083e-03f, -1.248246148e-03f, -1.261016119e-03f, -1.073562648e-03f, -6.962648992e-04f, -1.883230024e-04f, +3.558453770e-04f, +8.318701747e-04f, +1.154038613e-03f, +1.277651484e-03f, +1.207917863e-03f, +9.932394374e-04f, +7.063738625e-04f, +4.209292660e-04f, +1.914832687e-04f, +4.327493877e-05f, -2.686366939e-05f, -4.096657950e-05f, - /* 24, 6 */ +4.114725367e-05f, +1.564493806e-05f, -7.246695886e-05f, -2.416845105e-04f, -4.887098400e-04f, -7.806331214e-04f, -1.056714015e-03f, -1.241422199e-03f, -1.265920211e-03f, -1.091205584e-03f, -7.245077077e-04f, -2.222205061e-04f, +3.227850234e-04f, +8.059079530e-04f, +1.139504920e-03f, +1.275890161e-03f, +1.217194897e-03f, +1.009579403e-03f, +7.249627509e-04f, +4.375574807e-04f, +2.035501057e-04f, +5.009726244e-05f, -2.440707607e-05f, -4.119040933e-05f, - /* 24, 7 */ +4.128766430e-05f, +1.880441272e-05f, -6.469004778e-05f, -2.286539641e-04f, -4.714587328e-04f, -7.621096041e-04f, -1.041335936e-03f, -1.233962452e-03f, -1.270030522e-03f, -1.108081926e-03f, -7.522084876e-04f, -2.559471563e-04f, +2.894771803e-04f, +7.793480846e-04f, +1.124183998e-03f, +1.273351959e-03f, +1.225881627e-03f, +1.025617992e-03f, +7.435470253e-04f, +4.544042133e-04f, +2.159413387e-04f, +5.723450367e-05f, -2.172290976e-05f, -4.129973134e-05f, - /* 24, 8 */ +4.129973134e-05f, +2.172290976e-05f, -5.723450367e-05f, -2.159413387e-04f, -4.544042133e-04f, -7.435470253e-04f, -1.025617992e-03f, -1.225881627e-03f, -1.273351959e-03f, -1.124183998e-03f, -7.793480846e-04f, -2.894771803e-04f, +2.559471563e-04f, +7.522084876e-04f, +1.108081926e-03f, +1.270030522e-03f, +1.233962452e-03f, +1.041335936e-03f, +7.621096041e-04f, +4.714587328e-04f, +2.286539641e-04f, +6.469004778e-05f, -1.880441272e-05f, -4.128766430e-05f, - /* 24, 9 */ +4.119040933e-05f, +2.440707607e-05f, -5.009726244e-05f, -2.035501057e-04f, -4.375574807e-04f, -7.249627509e-04f, -1.009579403e-03f, -1.217194897e-03f, -1.275890161e-03f, -1.139504920e-03f, -8.059079530e-04f, -3.227850234e-04f, +2.222205061e-04f, +7.245077077e-04f, +1.091205584e-03f, +1.265920211e-03f, +1.241422199e-03f, +1.056714015e-03f, +7.806331214e-04f, +4.887098400e-04f, +2.416845105e-04f, +7.246695886e-05f, -1.564493806e-05f, -4.114725367e-05f, - /* 24,10 */ +4.096657950e-05f, +2.686366939e-05f, -4.327493877e-05f, -1.914832687e-04f, -4.209292660e-04f, -7.063738625e-04f, -9.932394374e-04f, -1.207917863e-03f, -1.277651484e-03f, -1.154038613e-03f, -8.318701747e-04f, -3.558453770e-04f, +1.883230024e-04f, +6.962648992e-04f, +1.073562648e-03f, +1.261016119e-03f, +1.248246148e-03f, +1.071733083e-03f, +7.990999447e-04f, +5.061458738e-04f, +2.550290329e-04f, +8.056796775e-05f, -1.223796294e-05f, -4.087148106e-05f, - /* 24,11 */ +4.063504078e-05f, +2.909954521e-05f, -3.676383839e-05f, -1.797433681e-04f, -4.045298263e-04f, -6.877971412e-04f, -9.766173891e-04f, -1.198066533e-03f, -1.278642989e-03f, -1.167779798e-03f, -8.572174771e-04f, -3.886332072e-04f, +1.542806079e-04f, +6.674998060e-04f, +1.055161588e-03f, +1.255314082e-03f, +1.254420050e-03f, +1.086374092e-03f, +8.174921923e-04f, +5.237547173e-04f, +2.686831091e-04f, +8.899546026e-05f, -8.577101915e-06f, -4.045327387e-05f, - /* 24,12 */ +4.020250110e-05f, +3.112164378e-05f, -3.055997058e-05f, -1.683324883e-04f, -3.883689407e-04f, -6.692490513e-04f, -9.597325558e-04f, -1.187657300e-03f, -1.278872430e-03f, -1.180724004e-03f, -8.819332498e-04f, -4.211237814e-04f, +1.201194461e-04f, +6.382327409e-04f, +1.036011659e-03f, +1.248810685e-03f, +1.259930153e-03f, +1.100618114e-03f, +8.357917522e-04f, +5.415238064e-04f, +2.826418349e-04f, +9.775146571e-05f, -4.656120273e-06f, -3.988551544e-05f, - /* 24,13 */ +3.967556907e-05f, +3.293697730e-05f, -2.465906089e-05f, -1.572522637e-04f, -3.724559064e-04f, -6.507457252e-04f, -9.426042142e-04f, -1.176706916e-03f, -1.278348235e-03f, -1.192867560e-03f, -9.060015608e-04f, -4.532926958e-04f, +8.586577249e-05f, +6.084845647e-04f, +1.016122900e-03f, +1.241503276e-03f, +1.264763218e-03f, +1.114446367e-03f, +8.539803004e-04f, +5.594401371e-04f, +2.968998221e-04f, +1.068376458e-04f, -4.689475139e-07f, -3.916105537e-05f, - /* 24,14 */ +3.906074609e-05f, +3.455261727e-05f, -1.905656402e-05f, -1.465038861e-04f, -3.567995352e-04f, -6.323029482e-04f, -9.252515980e-04f, -1.165232472e-03f, -1.277079499e-03f, -1.204207601e-03f, -9.294071718e-04f, -4.851159022e-04f, +5.154594549e-05f, +5.782766642e-04f, +9.955061195e-04f, +1.233389975e-03f, +1.268906542e-03f, +1.127840237e-03f, +8.720393210e-04f, +5.774902753e-04f, +3.114511951e-04f, +1.162552839e-04f, +3.990309212e-06f, -3.827272022e-05f, - /* 24,15 */ +3.836441874e-05f, +3.597568203e-05f, -1.374767685e-05f, -1.360881127e-04f, -3.414081512e-04f, -6.139361451e-04f, -9.076938752e-04f, -1.153251370e-03f, -1.275075958e-03f, -1.214742061e-03f, -9.521355524e-04f, -5.165697336e-04f, +1.718639697e-05f, +5.476309302e-04f, +9.741728935e-04f, +1.224469676e-03f, +1.272347980e-03f, +1.140781305e-03f, +8.899501259e-04f, +5.956603662e-04f, +3.262895896e-04f, +1.260052743e-04f, +8.727351622e-06f, -3.721332452e-05f, - /* 24, 0 */ +8.266384897e-05f, +1.864042294e-04f, +2.488885336e-04f, +1.546439211e-04f, -1.995837972e-04f, -8.300120177e-04f, -1.613160849e-03f, -2.296673715e-03f, -2.585717258e-03f, -2.273475621e-03f, -1.352242686e-03f, -4.324968723e-05f, +1.278412578e-03f, +2.232544293e-03f, +2.585064833e-03f, +2.329165788e-03f, +1.661894649e-03f, +8.765619362e-04f, +2.314166150e-04f, -1.408802900e-04f, -2.488728147e-04f, -1.925779863e-04f, -8.867605644e-05f, -1.381647235e-05f, - /* 24, 1 */ +7.679604466e-05f, +1.800850086e-04f, +2.482891228e-04f, +1.673628145e-04f, -1.688781476e-04f, -7.841040553e-04f, -1.564053778e-03f, -2.262611362e-03f, -2.583952550e-03f, -2.311948888e-03f, -1.424504725e-03f, -1.296977982e-04f, +1.203096102e-03f, +2.189184288e-03f, +2.581965725e-03f, +2.360018674e-03f, +1.710180642e-03f, +9.237037585e-04f, +2.643640884e-04f, -1.260534627e-04f, -2.482108983e-04f, -1.985807152e-04f, -9.482163577e-05f, -1.700840565e-05f, - /* 24, 2 */ +7.108272573e-05f, +1.736451253e-04f, +2.471057735e-04f, +1.790568131e-04f, -1.393098721e-04f, -7.388859215e-04f, -1.514647192e-03f, -2.227049028e-03f, -2.579803518e-03f, -2.347938498e-03f, -1.495119547e-03f, -2.159922036e-04f, +1.126377386e-03f, +2.143428746e-03f, +2.576393731e-03f, +2.389164999e-03f, +1.757943642e-03f, +9.713853048e-04f, +2.984113695e-04f, -1.101464409e-04f, -2.468719141e-04f, -2.043861254e-04f, -1.010885985e-04f, -2.040687624e-05f, - /* 24, 3 */ +6.553303557e-05f, +1.671085856e-04f, +2.453697283e-04f, +1.897470664e-04f, -1.108869031e-04f, -6.944032625e-04f, -1.465013955e-03f, -2.190058265e-03f, -2.573306150e-03f, -2.381422658e-03f, -1.564010684e-03f, -3.020307159e-04f, +1.048342851e-03f, +2.095314540e-03f, +2.568326065e-03f, +2.416539054e-03f, +1.805107932e-03f, +1.019552324e-03f, +3.335412514e-04f, -9.314376077e-05f, -2.448252646e-04f, -2.099672379e-04f, -1.074639934e-04f, -2.401251277e-05f, - /* 24, 4 */ +6.015519126e-05f, +1.604985702e-04f, +2.431122111e-04f, +1.994559526e-04f, -8.361493575e-05f, -6.506994570e-04f, -1.415225919e-03f, -2.151711738e-03f, -2.564499518e-03f, -2.412383397e-03f, -1.631104459e-03f, -3.877115714e-04f, +9.690810727e-04f, +2.044882222e-03f, +2.557743429e-03f, +2.442076932e-03f, +1.851597394e-03f, +1.068148557e-03f, +3.697341485e-04f, -7.503156587e-05f, -2.420407013e-04f, -2.152964269e-04f, -1.139339030e-04f, -2.782526914e-05f, - /* 24, 5 */ +5.495649810e-05f, +1.538374078e-04f, +2.403643576e-04f, +2.082069988e-04f, -5.749746926e-05f, -6.078155802e-04f, -1.365353811e-03f, -2.112083086e-03f, -2.553425683e-03f, -2.440806561e-03f, -1.696330106e-03f, -4.729335981e-04f, +8.886826408e-04f, +1.992175989e-03f, +2.544630075e-03f, +2.465716661e-03f, +1.897335642e-03f, +1.117115802e-03f, +4.069680813e-04f, -5.579767803e-05f, -2.384884029e-04f, -2.203454641e-04f, -1.204834430e-04f, -3.184439496e-05f, - /* 24, 6 */ +4.994336610e-05f, +1.471465506e-04f, +2.371571498e-04f, +2.160248014e-04f, -3.253585139e-05f, -5.657903730e-04f, -1.315467130e-03f, -2.071246779e-03f, -2.540129593e-03f, -2.466681818e-03f, -1.759619871e-03f, -5.575963834e-04f, +8.072400133e-04f, +1.937243618e-03f, +2.528973864e-03f, +2.487398336e-03f, +1.942246152e-03f, +1.166393990e-03f, +4.452186667e-04f, -3.543166589e-05f, -2.341390536e-04f, -2.250855657e-04f, -1.270967638e-04f, -3.606840695e-05f, - /* 24, 7 */ +4.512132841e-05f, +1.404465535e-04f, +2.335213506e-04f, +2.229349451e-04f, -8.729326764e-06f, -5.246602166e-04f, -1.265634037e-03f, -2.029277978e-03f, -2.524658979e-03f, -2.490002646e-03f, -1.820909115e-03f, -6.416004392e-04f, +7.248473657e-04f, +1.880136408e-03f, +2.510766314e-03f, +2.507064240e-03f, +1.986252395e-03f, +1.215921259e-03f, +4.844591124e-04f, -1.392491133e-05f, -2.289639228e-04f, -2.294874421e-04f, -1.337570553e-04f, -4.049506149e-05f, - /* 24, 8 */ +4.049506149e-05f, +1.337570553e-04f, +2.294874421e-04f, +2.289639228e-04f, +1.392491133e-05f, -4.844591124e-04f, -1.215921259e-03f, -1.986252395e-03f, -2.507064240e-03f, -2.510766314e-03f, -1.880136408e-03f, -7.248473657e-04f, +6.416004392e-04f, +1.820909115e-03f, +2.490002646e-03f, +2.524658979e-03f, +2.029277978e-03f, +1.265634037e-03f, +5.246602166e-04f, +8.729326764e-06f, -2.229349451e-04f, -2.335213506e-04f, -1.404465535e-04f, -4.512132841e-05f, - /* 24, 9 */ +3.606840695e-05f, +1.270967638e-04f, +2.250855657e-04f, +2.341390536e-04f, +3.543166589e-05f, -4.452186667e-04f, -1.166393990e-03f, -1.942246152e-03f, -2.487398336e-03f, -2.528973864e-03f, -1.937243618e-03f, -8.072400133e-04f, +5.575963834e-04f, +1.759619871e-03f, +2.466681818e-03f, +2.540129593e-03f, +2.071246779e-03f, +1.315467130e-03f, +5.657903730e-04f, +3.253585139e-05f, -2.160248014e-04f, -2.371571498e-04f, -1.471465506e-04f, -4.994336610e-05f, - /* 24,10 */ +3.184439496e-05f, +1.204834430e-04f, +2.203454641e-04f, +2.384884029e-04f, +5.579767803e-05f, -4.069680813e-04f, -1.117115802e-03f, -1.897335642e-03f, -2.465716661e-03f, -2.544630075e-03f, -1.992175989e-03f, -8.886826408e-04f, +4.729335981e-04f, +1.696330106e-03f, +2.440806561e-03f, +2.553425683e-03f, +2.112083086e-03f, +1.365353811e-03f, +6.078155802e-04f, +5.749746926e-05f, -2.082069988e-04f, -2.403643576e-04f, -1.538374078e-04f, -5.495649810e-05f, - /* 24,11 */ +2.782526914e-05f, +1.139339030e-04f, +2.152964269e-04f, +2.420407013e-04f, +7.503156587e-05f, -3.697341485e-04f, -1.068148557e-03f, -1.851597394e-03f, -2.442076932e-03f, -2.557743429e-03f, -2.044882222e-03f, -9.690810727e-04f, +3.877115714e-04f, +1.631104459e-03f, +2.412383397e-03f, +2.564499518e-03f, +2.151711738e-03f, +1.415225919e-03f, +6.506994570e-04f, +8.361493575e-05f, -1.994559526e-04f, -2.431122111e-04f, -1.604985702e-04f, -6.015519126e-05f, - /* 24,12 */ +2.401251277e-05f, +1.074639934e-04f, +2.099672379e-04f, +2.448252646e-04f, +9.314376077e-05f, -3.335412514e-04f, -1.019552324e-03f, -1.805107932e-03f, -2.416539054e-03f, -2.568326065e-03f, -2.095314540e-03f, -1.048342851e-03f, +3.020307159e-04f, +1.564010684e-03f, +2.381422658e-03f, +2.573306150e-03f, +2.190058265e-03f, +1.465013955e-03f, +6.944032625e-04f, +1.108869031e-04f, -1.897470664e-04f, -2.453697283e-04f, -1.671085856e-04f, -6.553303557e-05f, - /* 24,13 */ +2.040687624e-05f, +1.010885985e-04f, +2.043861254e-04f, +2.468719141e-04f, +1.101464409e-04f, -2.984113695e-04f, -9.713853048e-04f, -1.757943642e-03f, -2.389164999e-03f, -2.576393731e-03f, -2.143428746e-03f, -1.126377386e-03f, +2.159922036e-04f, +1.495119547e-03f, +2.347938498e-03f, +2.579803518e-03f, +2.227049028e-03f, +1.514647192e-03f, +7.388859215e-04f, +1.393098721e-04f, -1.790568131e-04f, -2.471057735e-04f, -1.736451253e-04f, -7.108272573e-05f, - /* 24,14 */ +1.700840565e-05f, +9.482163577e-05f, +1.985807152e-04f, +2.482108983e-04f, +1.260534627e-04f, -2.643640884e-04f, -9.237037585e-04f, -1.710180642e-03f, -2.360018674e-03f, -2.581965725e-03f, -2.189184288e-03f, -1.203096102e-03f, +1.296977982e-04f, +1.424504725e-03f, +2.311948888e-03f, +2.583952550e-03f, +2.262611362e-03f, +1.564053778e-03f, +7.841040553e-04f, +1.688781476e-04f, -1.673628145e-04f, -2.482891228e-04f, -1.800850086e-04f, -7.679604466e-05f, - /* 24,15 */ +1.381647235e-05f, +8.867605644e-05f, +1.925779863e-04f, +2.488728147e-04f, +1.408802900e-04f, -2.314166150e-04f, -8.765619362e-04f, -1.661894649e-03f, -2.329165788e-03f, -2.585064833e-03f, -2.232544293e-03f, -1.278412578e-03f, +4.324968723e-05f, +1.352242686e-03f, +2.273475621e-03f, +2.585717258e-03f, +2.296673715e-03f, +1.613160849e-03f, +8.300120177e-04f, +1.995837972e-04f, -1.546439211e-04f, -2.488885336e-04f, -1.864042294e-04f, -8.266384897e-05f, - /* 24, 0 */ -8.756118778e-05f, -1.009631262e-05f, +2.499923290e-04f, +5.877223422e-04f, +6.788717735e-04f, +1.353208099e-04f, -1.181609893e-03f, -2.907631270e-03f, -4.227440709e-03f, -4.289302846e-03f, -2.753030129e-03f, -9.027467135e-05f, +2.610460208e-03f, +4.239433597e-03f, +4.275304929e-03f, +3.011836329e-03f, +1.284225967e-03f, -7.470693818e-05f, -6.668983668e-04f, -6.049037547e-04f, -2.711811033e-04f, -7.712041122e-07f, +8.724954076e-05f, +5.404595280e-05f, - /* 24, 1 */ -8.741655630e-05f, -2.019027119e-05f, +2.291878545e-04f, +5.696067266e-04f, +6.882827247e-04f, +1.927359117e-04f, -1.080756061e-03f, -2.801858302e-03f, -4.174485032e-03f, -4.332641998e-03f, -2.890980043e-03f, -2.706680808e-04f, +2.463494124e-03f, +4.183052585e-03f, +4.317905196e-03f, +3.114235078e-03f, +1.388440877e-03f, -1.091717027e-05f, -6.522789212e-04f, -6.210469572e-04f, -2.926973166e-04f, -1.241413728e-05f, +8.645224618e-05f, +5.751117153e-05f, - /* 24, 2 */ -8.684540791e-05f, -2.951540942e-05f, +2.088206066e-04f, +5.506594457e-04f, +6.952187414e-04f, +2.469379129e-04f, -9.818199274e-04f, -2.694754852e-03f, -4.116618896e-03f, -4.369446535e-03f, -3.024096686e-03f, -4.505940556e-04f, +2.312365817e-03f, +4.120192033e-03f, +4.355078033e-03f, +3.214588722e-03f, +1.494083528e-03f, +5.601692583e-05f, -6.349341530e-04f, -6.360467505e-04f, -3.144802134e-04f, -2.483132916e-05f, +8.514047439e-05f, +6.091502927e-05f, - /* 24, 3 */ -8.587775422e-05f, -3.807920270e-05f, +1.889395528e-04f, +5.309813040e-04f, +6.997709178e-04f, +2.979208532e-04f, -8.849487633e-04f, -2.586556795e-03f, -4.054031257e-03f, -4.399725659e-03f, -3.152177828e-03f, -6.297421881e-04f, +2.157318805e-03f, +4.050898074e-03f, +4.386669491e-03f, +3.312658663e-03f, +1.600975431e-03f, +1.260549593e-04f, -6.147894349e-04f, -6.497970322e-04f, -3.364651980e-04f, -3.801847602e-05f, +8.328608571e-05f, +6.423360450e-05f, - /* 24, 4 */ -8.454371894e-05f, -4.589171696e-05f, +1.695896910e-04f, +5.106711213e-04f, +7.020335552e-04f, +3.456869501e-04f, -7.902814402e-04f, -2.477497901e-03f, -3.986918477e-03f, -4.423502152e-03f, -3.275032702e-03f, -8.078038906e-04f, +1.998605647e-03f, +3.975230752e-03f, +4.412535626e-03f, +3.408207107e-03f, +1.708931018e-03f, +1.991476106e-04f, -5.917751493e-04f, -6.621910968e-04f, -3.585839047e-04f, -5.196800512e-05f, +8.086178430e-05f, +6.744196867e-05f, - /* 24, 5 */ -8.287340509e-05f, -5.296545744e-05f, +1.508120534e-04f, +4.898254962e-04f, +7.021037953e-04f, +3.902463858e-04f, -6.979482496e-04f, -2.367809282e-03f, -3.915483754e-03f, -4.440812209e-03f, -3.392482395e-03f, -9.844731162e-04f, +1.836487379e-03f, +3.893263974e-03f, +4.432542967e-03f, +3.500997660e-03f, +1.817757983e-03f, +2.752365501e-04f, -5.658270331e-04f, -6.731219472e-04f, -3.807642824e-04f, -6.666895953e-05f, +7.784127492e-05f, +7.051425394e-05f, - /* 24, 6 */ -8.089676755e-05f, -5.931521393e-05f, +1.326437227e-04f, +4.685385820e-04f, +7.000812546e-04f, +4.316170765e-04f, -6.080707472e-04f, -2.257718867e-03f, -3.839936544e-03f, -4.451705229e-03f, -3.504360214e-03f, -1.159447072e-03f, +1.671232927e-03f, +3.805085432e-03f, +4.446568950e-03f, +3.590795947e-03f, +1.927257648e-03f, +3.542543807e-04f, -5.368865161e-04f, -6.824826149e-04f, -4.029306956e-04f, -8.210689127e-05f, +7.419942176e-05f, +7.342372810e-05f, - /* 24, 7 */ -7.864349144e-05f, -6.495790319e-05f, +1.151178633e-04f, +4.469018792e-04f, +6.960676605e-04f, +4.698244236e-04f, -5.207616239e-04f, -2.147450881e-03f, -3.760491970e-03f, -4.456243581e-03f, -3.610512013e-03f, -1.332426925e-03f, +1.503118492e-03f, +3.710796487e-03f, +4.454502333e-03f, +3.677370219e-03f, +2.037225356e-03f, +4.361246060e-04f, -5.049010493e-04f, -6.901664903e-04f, -4.250040411e-04f, -9.826376366e-05f, +6.991240915e-05f, +7.614287656e-05f, - /* 24, 8 */ -7.614287656e-05f, -6.991240915e-05f, +9.826376366e-05f, +4.250040411e-04f, +6.901664903e-04f, +5.049010493e-04f, -4.361246060e-04f, -2.037225356e-03f, -3.677370219e-03f, -4.454502333e-03f, -3.710796487e-03f, -1.503118492e-03f, +1.332426925e-03f, +3.610512013e-03f, +4.456243581e-03f, +3.760491970e-03f, +2.147450881e-03f, +5.207616239e-04f, -4.698244236e-04f, -6.960676605e-04f, -4.469018792e-04f, -1.151178633e-04f, +6.495790319e-05f, +7.864349144e-05f, - /* 24, 9 */ -7.342372810e-05f, -7.419942176e-05f, +8.210689127e-05f, +4.029306956e-04f, +6.824826149e-04f, +5.368865161e-04f, -3.542543807e-04f, -1.927257648e-03f, -3.590795947e-03f, -4.446568950e-03f, -3.805085432e-03f, -1.671232927e-03f, +1.159447072e-03f, +3.504360214e-03f, +4.451705229e-03f, +3.839936544e-03f, +2.257718867e-03f, +6.080707472e-04f, -4.316170765e-04f, -7.000812546e-04f, -4.685385820e-04f, -1.326437227e-04f, +5.931521393e-05f, +8.089676755e-05f, - /* 24,10 */ -7.051425394e-05f, -7.784127492e-05f, +6.666895953e-05f, +3.807642824e-04f, +6.731219472e-04f, +5.658270331e-04f, -2.752365501e-04f, -1.817757983e-03f, -3.500997660e-03f, -4.432542967e-03f, -3.893263974e-03f, -1.836487379e-03f, +9.844731162e-04f, +3.392482395e-03f, +4.440812209e-03f, +3.915483754e-03f, +2.367809282e-03f, +6.979482496e-04f, -3.902463858e-04f, -7.021037953e-04f, -4.898254962e-04f, -1.508120534e-04f, +5.296545744e-05f, +8.287340509e-05f, - /* 24,11 */ -6.744196867e-05f, -8.086178430e-05f, +5.196800512e-05f, +3.585839047e-04f, +6.621910968e-04f, +5.917751493e-04f, -1.991476106e-04f, -1.708931018e-03f, -3.408207107e-03f, -4.412535626e-03f, -3.975230752e-03f, -1.998605647e-03f, +8.078038906e-04f, +3.275032702e-03f, +4.423502152e-03f, +3.986918477e-03f, +2.477497901e-03f, +7.902814402e-04f, -3.456869501e-04f, -7.020335552e-04f, -5.106711213e-04f, -1.695896910e-04f, +4.589171696e-05f, +8.454371894e-05f, - /* 24,12 */ -6.423360450e-05f, -8.328608571e-05f, +3.801847602e-05f, +3.364651980e-04f, +6.497970322e-04f, +6.147894349e-04f, -1.260549593e-04f, -1.600975431e-03f, -3.312658663e-03f, -4.386669491e-03f, -4.050898074e-03f, -2.157318805e-03f, +6.297421881e-04f, +3.152177828e-03f, +4.399725659e-03f, +4.054031257e-03f, +2.586556795e-03f, +8.849487633e-04f, -2.979208532e-04f, -6.997709178e-04f, -5.309813040e-04f, -1.889395528e-04f, +3.807920270e-05f, +8.587775422e-05f, - /* 24,13 */ -6.091502927e-05f, -8.514047439e-05f, +2.483132916e-05f, +3.144802134e-04f, +6.360467505e-04f, +6.349341530e-04f, -5.601692583e-05f, -1.494083528e-03f, -3.214588722e-03f, -4.355078033e-03f, -4.120192033e-03f, -2.312365817e-03f, +4.505940556e-04f, +3.024096686e-03f, +4.369446535e-03f, +4.116618896e-03f, +2.694754852e-03f, +9.818199274e-04f, -2.469379129e-04f, -6.952187414e-04f, -5.506594457e-04f, -2.088206066e-04f, +2.951540942e-05f, +8.684540791e-05f, - /* 24,14 */ -5.751117153e-05f, -8.645224618e-05f, +1.241413728e-05f, +2.926973166e-04f, +6.210469572e-04f, +6.522789212e-04f, +1.091717027e-05f, -1.388440877e-03f, -3.114235078e-03f, -4.317905196e-03f, -4.183052585e-03f, -2.463494124e-03f, +2.706680808e-04f, +2.890980043e-03f, +4.332641998e-03f, +4.174485032e-03f, +2.801858302e-03f, +1.080756061e-03f, -1.927359117e-04f, -6.882827247e-04f, -5.696067266e-04f, -2.291878545e-04f, +2.019027119e-05f, +8.741655630e-05f, - /* 24,15 */ -5.404595280e-05f, -8.724954076e-05f, +7.712041122e-07f, +2.711811033e-04f, +6.049037547e-04f, +6.668983668e-04f, +7.470693818e-05f, -1.284225967e-03f, -3.011836329e-03f, -4.275304929e-03f, -4.239433597e-03f, -2.610460208e-03f, +9.027467135e-05f, +2.753030129e-03f, +4.289302846e-03f, +4.227440709e-03f, +2.907631270e-03f, +1.181609893e-03f, -1.353208099e-04f, -6.788717735e-04f, -5.877223422e-04f, -2.499923290e-04f, +1.009631262e-05f, +8.756118778e-05f, - /* 24, 0 */ -4.836862817e-05f, -2.381906908e-04f, -2.861422699e-04f, +1.419765781e-04f, +9.779307384e-04f, +1.431118485e-03f, +4.239072727e-04f, -2.320049614e-03f, -5.516524807e-03f, -6.885468951e-03f, -4.882970050e-03f, -1.652445539e-04f, +4.647640808e-03f, +6.864975932e-03f, +5.679465803e-03f, +2.528057977e-03f, -2.982544427e-04f, -1.420326139e-03f, -1.029081461e-03f, -1.868092348e-04f, +2.758007186e-04f, +2.491702023e-04f, +5.836581816e-05f, -3.491105347e-05f, - /* 24, 1 */ -3.887878147e-05f, -2.267040256e-04f, -2.944876029e-04f, +9.900949096e-05f, +9.254138922e-04f, +1.435932770e-03f, +5.422031866e-04f, -2.114193296e-03f, -5.346195092e-03f, -6.891993065e-03f, -5.106971374e-03f, -4.953359135e-04f, +4.401480442e-03f, +6.830374341e-03f, +5.834433801e-03f, +2.737690485e-03f, -1.653667139e-04f, -1.403322383e-03f, -1.078579553e-03f, -2.333982604e-04f, +2.633988510e-04f, +2.595470071e-04f, +6.884149383e-05f, -3.317859772e-05f, - /* 24, 2 */ -2.992041863e-05f, -2.148033017e-04f, -3.009073041e-04f, +5.800387728e-05f, +8.718108917e-04f, +1.435015360e-03f, +6.530479478e-04f, -1.910998057e-03f, -5.169072824e-03f, -6.884726614e-03f, -5.319183002e-03f, -8.242352929e-04f, +4.145019341e-03f, +6.781564023e-03f, +5.980858542e-03f, +2.948401826e-03f, -2.539414214e-05f, -1.379888189e-03f, -1.126132932e-03f, -2.816211011e-04f, +2.488796810e-04f, +2.692234993e-04f, +7.976200316e-05f, -3.095924021e-05f, - /* 24, 3 */ -2.151306397e-05f, -2.025787804e-04f, -3.054778181e-04f, +1.904245883e-05f, +8.173942695e-04f, +1.428624316e-03f, +7.563747429e-04f, -1.710952703e-03f, -4.985763915e-03f, -6.863885651e-03f, -5.519179462e-03f, -1.151152247e-03f, +3.878819947e-03f, +6.718485032e-03f, +6.118185890e-03f, +3.159630822e-03f, +1.214850236e-04f, -1.349820125e-03f, -1.171444944e-03f, -3.313418525e-04f, +2.321939470e-04f, +2.781004545e-04f, +9.108884721e-05f, -2.823129406e-05f, - /* 24, 4 */ -1.367174826e-05f, -1.901175448e-04f, -3.082808136e-04f, -1.780505549e-05f, +7.624282793e-04f, +1.417028061e-03f, +8.521437270e-04f, -1.514524553e-03f, -4.796881865e-03f, -6.829722854e-03f, -5.706572744e-03f, -1.475302628e-03f, +3.603475092e-03f, +6.641118197e-03f, +6.245879909e-03f, +3.370802059e-03f, +2.750642929e-04f, -1.312931609e-03f, -1.214215433e-03f, -3.824113238e-04f, +2.133007109e-04f, +2.860774924e-04f, +1.027786538e-04f, -2.497524656e-05f, - /* 24, 5 */ -6.407151783e-06f, -1.775031866e-04f, -3.094025487e-04f, -5.248174754e-05f, +7.071681142e-04f, +1.400504044e-03f, +9.403414758e-04f, -1.322158275e-03f, -4.603045619e-03f, -6.782526316e-03f, -5.881013326e-03f, -1.795911068e-03f, +3.319606230e-03f, +6.549485546e-03f, +6.363424898e-03f, +3.581327596e-03f, +4.351089927e-04f, -1.269054120e-03f, -1.254141844e-03f, -4.346671648e-04f, +1.921679399e-04f, +2.930535649e-04f, +1.147831783e-04f, -2.117401174e-05f, - /* 24, 6 */ +2.742338831e-07f, -1.648155254e-04f, -3.089332390e-04f, -8.494321776e-05f, +6.518591895e-04f, +1.379337399e-03f, +1.020980349e-03f, -1.134274832e-03f, -4.404877423e-03f, -6.722618231e-03f, -6.042191052e-03f, -2.112213435e-03f, +3.027861551e-03f, +6.443650588e-03f, +6.470327373e-03f, +3.790608755e-03f, +6.013564365e-04f, -1.218038367e-03f, -1.290920380e-03f, -4.879340571e-04f, +1.687730668e-04f, +2.989274696e-04f, +1.270493337e-04f, -1.681317980e-05f, - /* 24, 7 */ +6.369927035e-06f, -1.521303593e-04f, -3.069664313e-04f, -1.151572658e-04f, +5.967364879e-04f, +1.353819611e-03f, +1.094097769e-03f, -9.512705360e-04f, -4.203000702e-03f, -6.650353458e-03f, -6.189835876e-03f, -2.423459243e-03f, +2.728914008e-03f, +6.323718452e-03f, +6.566118000e-03f, +3.998037969e-03f, +7.735162047e-04f, -1.159755419e-03f, -1.324247193e-03f, -5.420239710e-04f, +1.431035268e-04f, +3.035983857e-04f, +1.395192491e-04f, -1.188126168e-05f, - /* 24, 8 */ +1.188126168e-05f, -1.395192491e-04f, -3.035983857e-04f, -1.431035268e-04f, +5.420239710e-04f, +1.324247193e-03f, +1.159755419e-03f, -7.735162047e-04f, -3.998037969e-03f, -6.566118000e-03f, -6.323718452e-03f, -2.728914008e-03f, +2.423459243e-03f, +6.189835876e-03f, +6.650353458e-03f, +4.203000702e-03f, +9.512705360e-04f, -1.094097769e-03f, -1.353819611e-03f, -5.967364879e-04f, +1.151572658e-04f, +3.069664313e-04f, +1.521303593e-04f, -6.369927035e-06f, - /* 24, 9 */ +1.681317980e-05f, -1.270493337e-04f, -2.989274696e-04f, -1.687730668e-04f, +4.879340571e-04f, +1.290920380e-03f, +1.218038367e-03f, -6.013564365e-04f, -3.790608755e-03f, -6.470327373e-03f, -6.443650588e-03f, -3.027861551e-03f, +2.112213435e-03f, +6.042191052e-03f, +6.722618231e-03f, +4.404877423e-03f, +1.134274832e-03f, -1.020980349e-03f, -1.379337399e-03f, -6.518591895e-04f, +8.494321776e-05f, +3.089332390e-04f, +1.648155254e-04f, -2.742338831e-07f, - /* 24,10 */ +2.117401174e-05f, -1.147831783e-04f, -2.930535649e-04f, -1.921679399e-04f, +4.346671648e-04f, +1.254141844e-03f, +1.269054120e-03f, -4.351089927e-04f, -3.581327596e-03f, -6.363424898e-03f, -6.549485546e-03f, -3.319606230e-03f, +1.795911068e-03f, +5.881013326e-03f, +6.782526316e-03f, +4.603045619e-03f, +1.322158275e-03f, -9.403414758e-04f, -1.400504044e-03f, -7.071681142e-04f, +5.248174754e-05f, +3.094025487e-04f, +1.775031866e-04f, +6.407151783e-06f, - /* 24,11 */ +2.497524656e-05f, -1.027786538e-04f, -2.860774924e-04f, -2.133007109e-04f, +3.824113238e-04f, +1.214215433e-03f, +1.312931609e-03f, -2.750642929e-04f, -3.370802059e-03f, -6.245879909e-03f, -6.641118197e-03f, -3.603475092e-03f, +1.475302628e-03f, +5.706572744e-03f, +6.829722854e-03f, +4.796881865e-03f, +1.514524553e-03f, -8.521437270e-04f, -1.417028061e-03f, -7.624282793e-04f, +1.780505549e-05f, +3.082808136e-04f, +1.901175448e-04f, +1.367174826e-05f, - /* 24,12 */ +2.823129406e-05f, -9.108884721e-05f, -2.781004545e-04f, -2.321939470e-04f, +3.313418525e-04f, +1.171444944e-03f, +1.349820125e-03f, -1.214850236e-04f, -3.159630822e-03f, -6.118185890e-03f, -6.718485032e-03f, -3.878819947e-03f, +1.151152247e-03f, +5.519179462e-03f, +6.863885651e-03f, +4.985763915e-03f, +1.710952703e-03f, -7.563747429e-04f, -1.428624316e-03f, -8.173942695e-04f, -1.904245883e-05f, +3.054778181e-04f, +2.025787804e-04f, +2.151306397e-05f, - /* 24,13 */ +3.095924021e-05f, -7.976200316e-05f, -2.692234993e-04f, -2.488796810e-04f, +2.816211011e-04f, +1.126132932e-03f, +1.379888189e-03f, +2.539414214e-05f, -2.948401826e-03f, -5.980858542e-03f, -6.781564023e-03f, -4.145019341e-03f, +8.242352929e-04f, +5.319183002e-03f, +6.884726614e-03f, +5.169072824e-03f, +1.910998057e-03f, -6.530479478e-04f, -1.435015360e-03f, -8.718108917e-04f, -5.800387728e-05f, +3.009073041e-04f, +2.148033017e-04f, +2.992041863e-05f, - /* 24,14 */ +3.317859772e-05f, -6.884149383e-05f, -2.595470071e-04f, -2.633988510e-04f, +2.333982604e-04f, +1.078579553e-03f, +1.403322383e-03f, +1.653667139e-04f, -2.737690485e-03f, -5.834433801e-03f, -6.830374341e-03f, -4.401480442e-03f, +4.953359135e-04f, +5.106971374e-03f, +6.891993065e-03f, +5.346195092e-03f, +2.114193296e-03f, -5.422031866e-04f, -1.435932770e-03f, -9.254138922e-04f, -9.900949096e-05f, +2.944876029e-04f, +2.267040256e-04f, +3.887878147e-05f, - /* 24,15 */ +3.491105347e-05f, -5.836581816e-05f, -2.491702023e-04f, -2.758007186e-04f, +1.868092348e-04f, +1.029081461e-03f, +1.420326139e-03f, +2.982544427e-04f, -2.528057977e-03f, -5.679465803e-03f, -6.864975932e-03f, -4.647640808e-03f, +1.652445539e-04f, +4.882970050e-03f, +6.885468951e-03f, +5.516524807e-03f, +2.320049614e-03f, -4.239072727e-04f, -1.431118485e-03f, -9.779307384e-04f, -1.419765781e-04f, +2.861422699e-04f, +2.381906908e-04f, +4.836862817e-05f, - /* 24, 0 */ +1.364396009e-04f, +7.446376994e-05f, -3.699603221e-04f, -7.278325124e-04f, -5.051635567e-05f, +1.645033952e-03f, +2.378022613e-03f, -2.243714932e-04f, -5.680096534e-03f, -9.704626250e-03f, -7.823014841e-03f, -2.751390883e-04f, +7.480820734e-03f, +9.788905453e-03f, +6.030582333e-03f, +5.101196376e-04f, -2.328731157e-03f, -1.748114996e-03f, -3.640531891e-05f, +7.242350145e-04f, +4.042879967e-04f, -5.742334247e-05f, -1.414906982e-04f, -2.710774794e-05f, - /* 24, 1 */ +1.307026563e-04f, +8.975162518e-05f, -3.355241044e-04f, -7.270603554e-04f, -1.326866063e-04f, +1.538422151e-03f, +2.413247311e-03f, +4.875121157e-05f, -5.324161431e-03f, -9.595517291e-03f, -8.141086512e-03f, -8.245287223e-04f, +7.115425083e-03f, +9.847646625e-03f, +6.374200107e-03f, +8.077901021e-04f, -2.264974711e-03f, -1.846937004e-03f, -1.278166248e-04f, +7.160485626e-04f, +4.382702758e-04f, -3.863673145e-05f, -1.457592711e-04f, -3.374854096e-05f, - /* 24, 2 */ +1.243758393e-04f, +1.032931784e-04f, -3.012044148e-04f, -7.221532843e-04f, -2.098818030e-04f, +1.428995714e-03f, +2.434853697e-03f, +3.086181402e-04f, -4.964188024e-03f, -9.462372525e-03f, -8.434212217e-03f, -1.371256439e-03f, +6.727842835e-03f, +9.880231223e-03f, +6.709529590e-03f, +1.116608515e-03f, -2.186408722e-03f, -1.940762958e-03f, -2.234175210e-04f, +7.030713845e-04f, +4.716595396e-04f, -1.812362539e-05f, -1.491486840e-04f, -4.073257728e-05f, - /* 24, 3 */ +1.175537217e-04f, +1.151066589e-04f, -2.672136493e-04f, -7.133593846e-04f, -2.819161814e-04f, +1.317455363e-03f, +2.443336794e-03f, +5.546728855e-04f, -4.601573558e-03f, -9.306067159e-03f, -8.701668636e-03f, -1.913559980e-03f, +6.319179241e-03f, +9.886134123e-03f, +7.035155238e-03f, +1.435731166e-03f, -2.092745601e-03f, -2.028850662e-03f, -3.228698520e-04f, +6.851212972e-04f, +5.041985339e-04f, +4.082412249e-06f, -1.515631236e-04f, -4.801831197e-05f, - /* 24, 4 */ +1.103288160e-04f, +1.252215041e-04f, -2.337507561e-04f, -7.009379926e-04f, -3.486413414e-04f, +1.204483360e-03f, +2.439234434e-03f, +7.864337317e-04f, -4.237695644e-03f, -9.127552920e-03f, -8.942835031e-03f, -2.449695551e-03f, +5.890625670e-03f, +9.864926907e-03f, +7.349672574e-03f, +1.764247300e-03f, -1.983757790e-03f, -2.110456450e-03f, -4.257977068e-04f, +6.620377298e-04f, +5.356216172e-04f, +2.793344097e-05f, -1.529084143e-04f, -5.555842361e-05f, - /* 24, 5 */ +1.027909684e-04f, +1.336775649e-04f, -2.010005851e-04f, -6.851576168e-04f, -4.099455518e-04f, +1.090740633e-03f, +2.423123355e-03f, +1.003494037e-03f, -3.873906570e-03f, -8.927853008e-03f, -9.157195135e-03f, -2.977945083e-03f, +5.443455012e-03f, +9.816280735e-03f, +7.651694576e-03f, +2.101181791e-03f, -1.859280606e-03f, -2.184839011e-03f, -5.317880090e-04f, +6.336836952e-04f, +5.656561208e-04f, +5.336672075e-05f, -1.530928622e-04f, -6.329988035e-05f, - /* 24, 6 */ +9.502680145e-05f, +1.405242734e-04f, -1.691333585e-04f, -6.662938873e-04f, -4.657528710e-04f, +9.768641187e-04f, +2.395615219e-03f, +1.205522243e-03f, -3.511527821e-03f, -8.708056786e-03f, -9.344338564e-03f, -3.496623369e-03f, +4.979016698e-03f, +9.739968779e-03f, +7.939858067e-03f, +2.445498177e-03f, -1.719214825e-03f, -2.251263312e-03f, -6.403913399e-04f, +5.999476948e-04f, +5.940238143e-04f, +8.030437567e-05f, -1.520281231e-04f, -7.118405837e-05f, - /* 24, 7 */ +8.711921055e-05f, +1.458197836e-04f, -1.383042613e-04f, -6.446275435e-04f, -5.160220948e-04f, +8.634643034e-04f, +2.357352548e-03f, +1.392261511e-03f, -3.151844842e-03f, -8.469314215e-03f, -9.503961719e-03f, -4.004085039e-03f, +4.498731341e-03f, +9.635868210e-03f, +8.212830089e-03f, +2.796102059e-03f, -1.563529005e-03f, -2.309004616e-03f, -7.511229995e-04f, +5.607455425e-04f, +6.204424737e-04f, +1.086531499e-04f, -1.496300883e-04f, -7.914691395e-05f, - /* 24, 8 */ +7.914691395e-05f, +1.496300883e-04f, -1.086531499e-04f, -6.204424737e-04f, -5.607455425e-04f, +7.511229995e-04f, +2.309004616e-03f, +1.563529005e-03f, -2.796102059e-03f, -8.212830089e-03f, -9.635868210e-03f, -4.498731341e-03f, +4.004085039e-03f, +9.503961719e-03f, +8.469314215e-03f, +3.151844842e-03f, -1.392261511e-03f, -2.357352548e-03f, -8.634643034e-04f, +5.160220948e-04f, +6.446275435e-04f, +1.383042613e-04f, -1.458197836e-04f, -8.711921055e-05f, - /* 24, 9 */ +7.118405837e-05f, +1.520281231e-04f, -8.030437567e-05f, -5.940238143e-04f, -5.999476948e-04f, +6.403913399e-04f, +2.251263312e-03f, +1.719214825e-03f, -2.445498177e-03f, -7.939858067e-03f, -9.739968779e-03f, -4.979016698e-03f, +3.496623369e-03f, +9.344338564e-03f, +8.708056786e-03f, +3.511527821e-03f, -1.205522243e-03f, -2.395615219e-03f, -9.768641187e-04f, +4.657528710e-04f, +6.662938873e-04f, +1.691333585e-04f, -1.405242734e-04f, -9.502680145e-05f, - /* 24,10 */ +6.329988035e-05f, +1.530928622e-04f, -5.336672075e-05f, -5.656561208e-04f, -6.336836952e-04f, +5.317880090e-04f, +2.184839011e-03f, +1.859280606e-03f, -2.101181791e-03f, -7.651694576e-03f, -9.816280735e-03f, -5.443455012e-03f, +2.977945083e-03f, +9.157195135e-03f, +8.927853008e-03f, +3.873906570e-03f, -1.003494037e-03f, -2.423123355e-03f, -1.090740633e-03f, +4.099455518e-04f, +6.851576168e-04f, +2.010005851e-04f, -1.336775649e-04f, -1.027909684e-04f, - /* 24,11 */ +5.555842361e-05f, +1.529084143e-04f, -2.793344097e-05f, -5.356216172e-04f, -6.620377298e-04f, +4.257977068e-04f, +2.110456450e-03f, +1.983757790e-03f, -1.764247300e-03f, -7.349672574e-03f, -9.864926907e-03f, -5.890625670e-03f, +2.449695551e-03f, +8.942835031e-03f, +9.127552920e-03f, +4.237695644e-03f, -7.864337317e-04f, -2.439234434e-03f, -1.204483360e-03f, +3.486413414e-04f, +7.009379926e-04f, +2.337507561e-04f, -1.252215041e-04f, -1.103288160e-04f, - /* 24,12 */ +4.801831197e-05f, +1.515631236e-04f, -4.082412249e-06f, -5.041985339e-04f, -6.851212972e-04f, +3.228698520e-04f, +2.028850662e-03f, +2.092745601e-03f, -1.435731166e-03f, -7.035155238e-03f, -9.886134123e-03f, -6.319179241e-03f, +1.913559980e-03f, +8.701668636e-03f, +9.306067159e-03f, +4.601573558e-03f, -5.546728855e-04f, -2.443336794e-03f, -1.317455363e-03f, +2.819161814e-04f, +7.133593846e-04f, +2.672136493e-04f, -1.151066589e-04f, -1.175537217e-04f, - /* 24,13 */ +4.073257728e-05f, +1.491486840e-04f, +1.812362539e-05f, -4.716595396e-04f, -7.030713845e-04f, +2.234175210e-04f, +1.940762958e-03f, +2.186408722e-03f, -1.116608515e-03f, -6.709529590e-03f, -9.880231223e-03f, -6.727842835e-03f, +1.371256439e-03f, +8.434212217e-03f, +9.462372525e-03f, +4.964188024e-03f, -3.086181402e-04f, -2.434853697e-03f, -1.428995714e-03f, +2.098818030e-04f, +7.221532843e-04f, +3.012044148e-04f, -1.032931784e-04f, -1.243758393e-04f, - /* 24,14 */ +3.374854096e-05f, +1.457592711e-04f, +3.863673145e-05f, -4.382702758e-04f, -7.160485626e-04f, +1.278166248e-04f, +1.846937004e-03f, +2.264974711e-03f, -8.077901021e-04f, -6.374200107e-03f, -9.847646625e-03f, -7.115425083e-03f, +8.245287223e-04f, +8.141086512e-03f, +9.595517291e-03f, +5.324161431e-03f, -4.875121157e-05f, -2.413247311e-03f, -1.538422151e-03f, +1.326866063e-04f, +7.270603554e-04f, +3.355241044e-04f, -8.975162518e-05f, -1.307026563e-04f, - /* 24,15 */ +2.710774794e-05f, +1.414906982e-04f, +5.742334247e-05f, -4.042879967e-04f, -7.242350145e-04f, +3.640531891e-05f, +1.748114996e-03f, +2.328731157e-03f, -5.101196376e-04f, -6.030582333e-03f, -9.788905453e-03f, -7.480820734e-03f, +2.751390883e-04f, +7.823014841e-03f, +9.704626250e-03f, +5.680096534e-03f, +2.243714932e-04f, -2.378022613e-03f, -1.645033952e-03f, +5.051635567e-05f, +7.278325124e-04f, +3.699603221e-04f, -7.446376994e-05f, -1.364396009e-04f, - /* 20, 0 */ +1.366654441e-04f, -5.248309364e-04f, -9.559425272e-04f, +4.495080153e-04f, +2.846407623e-03f, +1.989454068e-03f, -4.491151594e-03f, -1.156100448e-02f, -1.065698581e-02f, -3.895768346e-04f, +1.023895907e-02f, +1.180960294e-02f, +5.007407400e-03f, -1.738511442e-03f, -2.938517986e-03f, -6.019203323e-04f, +9.329195550e-04f, +5.763302237e-04f, -1.134902041e-04f, -1.824770389e-04f, - /* 20, 1 */ +1.568890194e-04f, -4.728495798e-04f, -9.708996289e-04f, +3.024354413e-04f, +2.741035078e-03f, +2.215509786e-03f, -3.978754642e-03f, -1.127853170e-02f, -1.103432131e-02f, -1.167153605e-03f, +9.781544627e-03f, +1.202253469e-02f, +5.525210549e-03f, -1.462933465e-03f, -3.016077094e-03f, -7.588827792e-04f, +9.015285321e-04f, +6.268920900e-04f, -8.735502929e-05f, -1.921860197e-04f, - /* 20, 2 */ +1.741940978e-04f, -4.208194393e-04f, -9.781360984e-04f, +1.614183836e-04f, +2.623714429e-03f, +2.416571115e-03f, -3.472449249e-03f, -1.096411041e-02f, -1.136986548e-02f, -1.940007910e-03f, +9.286243980e-03f, +1.219815240e-02f, +6.042182027e-03f, -1.163118517e-03f, -3.077830056e-03f, -9.195341683e-04f, +8.615147935e-04f, +6.760417132e-04f, -5.827810709e-05f, -2.008073985e-04f, - /* 20, 3 */ +1.886370492e-04f, -3.691494362e-04f, -9.780356474e-04f, +2.709710175e-05f, +2.495775707e-03f, +2.592671089e-03f, -2.974378699e-03f, -1.061978749e-02f, -1.166272581e-02f, -2.705018824e-03f, +8.754750074e-03f, +1.233496472e-02f, +6.555887236e-03f, -8.396136973e-04f, -3.122565398e-03f, -1.082944596e-03f, +8.126754773e-04f, +7.232876858e-04f, -2.630548656e-05f, -2.081598890e-04f, - /* 20, 4 */ +2.002956356e-04f, -3.182221327e-04f, -9.710157868e-04f, -9.996474913e-05f, +2.358556029e-03f, +2.743978910e-03f, -2.486586970e-03f, -1.024771819e-02f, -1.191222039e-02f, -3.459106327e-03f, +8.188939591e-03f, +1.243164652e-02f, +7.063848473e-03f, -4.931158341e-04f, -3.149124311e-03f, -1.248118895e-03f, +7.548636055e-04f, +7.681251779e-04f, +8.487693398e-06f, -2.140618814e-04f, - /* 20, 5 */ +2.092671085e-04f, -2.683920446e-04f, -9.575231021e-04f, -2.192806382e-04f, +2.213390969e-03f, +2.870794883e-03f, -2.011009640e-03f, -9.850152742e-03f, -1.211787969e-02f, -4.199247312e-03f, +7.590864160e-03f, +1.248704815e-02f, +7.563557889e-03f, -1.244715801e-04f, -3.156409832e-03f, -1.414000676e-03f, +6.879919170e-04f, +8.100393630e-04f, +4.599617124e-05f, -2.183332212e-04f, - /* 20, 6 */ +2.156662323e-04f, -2.199842607e-04f, -9.380285157e-04f, -3.304411223e-04f, +2.061606212e-03f, +2.973544666e-03f, -1.549465619e-03f, -9.429422833e-03f, -1.227944713e-02f, -4.922491262e-03f, +6.962740532e-03f, +1.250020393e-02f, +8.052490864e-03f, +2.653234199e-04f, -3.143395899e-03f, -1.579476941e-03f, +6.120364145e-04f, +8.485090918e-04f, +8.608374363e-05f, -2.207970734e-04f, - /* 20, 7 */ +2.196232573e-04f, -1.732933680e-04f, -9.130225739e-04f, -4.331132727e-04f, +1.904509553e-03f, +3.052772891e-03f, -1.103649750e-03f, -8.987927630e-03f, -1.239687839e-02f, -5.625975475e-03f, +6.306939763e-03f, +1.247033951e-02f, +8.528119711e-03f, +6.751263085e-04f, -3.109136222e-03f, -1.743383273e-03f, +5.270395872e-04f, +8.830107920e-04f, +1.285826773e-04f, -2.212818602e-04f, - /* 20, 8 */ +2.212818602e-04f, -1.285826773e-04f, -8.830107920e-04f, -5.270395872e-04f, +1.743383273e-03f, +3.109136222e-03f, -6.751263085e-04f, -8.528119711e-03f, -1.247033951e-02f, -6.306939763e-03f, +5.625975475e-03f, +1.239687839e-02f, +8.987927630e-03f, +1.103649750e-03f, -3.052772891e-03f, -1.904509553e-03f, +4.331132727e-04f, +9.130225739e-04f, +1.732933680e-04f, -2.196232573e-04f, - /* 20, 9 */ +2.207970734e-04f, -8.608374363e-05f, -8.485090918e-04f, -6.120364145e-04f, +1.579476941e-03f, +3.143395899e-03f, -2.653234199e-04f, -8.052490864e-03f, -1.250020393e-02f, -6.962740532e-03f, +4.922491262e-03f, +1.227944713e-02f, +9.429422833e-03f, +1.549465619e-03f, -2.973544666e-03f, -2.061606212e-03f, +3.304411223e-04f, +9.380285157e-04f, +2.199842607e-04f, -2.156662323e-04f, - /* 20,10 */ +2.183332212e-04f, -4.599617124e-05f, -8.100393630e-04f, -6.879919170e-04f, +1.414000676e-03f, +3.156409832e-03f, +1.244715801e-04f, -7.563557889e-03f, -1.248704815e-02f, -7.590864160e-03f, +4.199247312e-03f, +1.211787969e-02f, +9.850152742e-03f, +2.011009640e-03f, -2.870794883e-03f, -2.213390969e-03f, +2.192806382e-04f, +9.575231021e-04f, +2.683920446e-04f, -2.092671085e-04f, - /* 20,11 */ +2.140618814e-04f, -8.487693398e-06f, -7.681251779e-04f, -7.548636055e-04f, +1.248118895e-03f, +3.149124311e-03f, +4.931158341e-04f, -7.063848473e-03f, -1.243164652e-02f, -8.188939591e-03f, +3.459106327e-03f, +1.191222039e-02f, +1.024771819e-02f, +2.486586970e-03f, -2.743978910e-03f, -2.358556029e-03f, +9.996474913e-05f, +9.710157868e-04f, +3.182221327e-04f, -2.002956356e-04f, - /* 20,12 */ +2.081598890e-04f, +2.630548656e-05f, -7.232876858e-04f, -8.126754773e-04f, +1.082944596e-03f, +3.122565398e-03f, +8.396136973e-04f, -6.555887236e-03f, -1.233496472e-02f, -8.754750074e-03f, +2.705018824e-03f, +1.166272581e-02f, +1.061978749e-02f, +2.974378699e-03f, -2.592671089e-03f, -2.495775707e-03f, -2.709710175e-05f, +9.780356474e-04f, +3.691494362e-04f, -1.886370492e-04f, - /* 20,13 */ +2.008073985e-04f, +5.827810709e-05f, -6.760417132e-04f, -8.615147935e-04f, +9.195341683e-04f, +3.077830056e-03f, +1.163118517e-03f, -6.042182027e-03f, -1.219815240e-02f, -9.286243980e-03f, +1.940007910e-03f, +1.136986548e-02f, +1.096411041e-02f, +3.472449249e-03f, -2.416571115e-03f, -2.623714429e-03f, -1.614183836e-04f, +9.781360984e-04f, +4.208194393e-04f, -1.741940978e-04f, - /* 20,14 */ +1.921860197e-04f, +8.735502929e-05f, -6.268920900e-04f, -9.015285321e-04f, +7.588827792e-04f, +3.016077094e-03f, +1.462933465e-03f, -5.525210549e-03f, -1.202253469e-02f, -9.781544627e-03f, +1.167153605e-03f, +1.103432131e-02f, +1.127853170e-02f, +3.978754642e-03f, -2.215509786e-03f, -2.741035078e-03f, -3.024354413e-04f, +9.708996289e-04f, +4.728495798e-04f, -1.568890194e-04f, - /* 20,15 */ +1.824770389e-04f, +1.134902041e-04f, -5.763302237e-04f, -9.329195550e-04f, +6.019203323e-04f, +2.938517986e-03f, +1.738511442e-03f, -5.007407400e-03f, -1.180960294e-02f, -1.023895907e-02f, +3.895768346e-04f, +1.065698581e-02f, +1.156100448e-02f, +4.491151594e-03f, -1.989454068e-03f, -2.846407623e-03f, -4.495080153e-04f, +9.559425272e-04f, +5.248309364e-04f, -1.366654441e-04f, - /* 20, 0 */ +2.228492143e-04f, +8.155042897e-05f, -9.008994790e-04f, -8.358434283e-04f, +2.057950411e-03f, +3.687980724e-03f, -2.439509438e-03f, -1.276984908e-02f, -1.372824692e-02f, -5.233437973e-04f, +1.325794606e-02f, +1.324423486e-02f, +3.079014715e-03f, -3.569583683e-03f, -2.275574997e-03f, +7.329307333e-04f, +9.595727172e-04f, -3.951670647e-05f, -2.357435643e-04f, +0.000000000e+00f, - /* 20, 1 */ +2.085936177e-04f, +1.192685572e-04f, -8.383784628e-04f, -9.252931617e-04f, +1.836793834e-03f, +3.772148819e-03f, -1.820843931e-03f, -1.225552529e-02f, -1.413563751e-02f, -1.567452511e-03f, +1.272631251e-02f, +1.367510758e-02f, +3.736377939e-03f, -3.415952420e-03f, -2.487640644e-03f, +6.166326985e-04f, +1.013551226e-03f, +6.721135679e-06f, -2.469830254e-04f, +3.513221827e-04f, - /* 20, 2 */ +1.932641301e-04f, +1.526114972e-04f, -7.728409668e-04f, -1.001322392e-03f, +1.614057279e-03f, +3.823286477e-03f, -1.225775962e-03f, -1.170500117e-02f, -1.447891891e-02f, -2.603840968e-03f, +1.213529571e-02f, +1.405908160e-02f, +4.408408028e-03f, -3.226289363e-03f, -2.692058620e-03f, +4.871526668e-04f, +1.061979909e-03f, +5.699759108e-05f, -2.562708188e-04f, -2.243392330e-05f, - /* 20, 3 */ +1.771389305e-04f, +1.815689683e-04f, -7.050956564e-04f, -1.064087220e-03f, +1.391605775e-03f, +3.842769943e-03f, -6.568264230e-04f, -1.112214974e-02f, -1.475727496e-02f, -3.627416831e-03f, +1.148720750e-02f, +1.439298630e-02f, +5.091721334e-03f, -3.000017933e-03f, -2.886692602e-03f, +3.448244648e-04f, +1.104003505e-03f, +1.110914327e-04f, -2.633104157e-04f, -3.471505729e-05f, - /* 20, 4 */ +1.604844080e-04f, +2.061770649e-04f, -6.359221544e-04f, -1.113850250e-03f, +1.171206475e-03f, +3.832136817e-03f, -1.162685315e-04f, -1.051095143e-02f, -1.497027375e-02f, -4.633169088e-03f, +1.078471010e-02f, +1.467389068e-02f, +5.782760145e-03f, -2.736794515e-03f, -3.069373786e-03f, +1.901162062e-04f, +1.138774993e-03f, +1.687245284e-04f, -2.678091338e-04f, -4.805250238e-05f, - /* 20, 5 */ +1.435528424e-04f, +2.265149998e-04f, -5.660652366e-04f, -1.150972836e-03f, +9.545189950e-04f, +3.793068954e-03f, +3.938808876e-04f, -9.875465824e-03f, -1.511786634e-02f, -5.616199746e-03f, +1.003080152e-02f, +1.489912656e-02f, +6.477812874e-03f, -2.436518983e-03f, -3.237916857e-03f, +2.363306300e-05f, +1.165464351e-03f, +2.295611999e-04f, -2.694819135e-04f, -6.235351094e-05f, - /* 20, 6 */ +1.265803873e-04f, +2.427015763e-04f, -4.962296614e-04f, -1.175906803e-03f, +7.430870045e-04f, +3.727374795e-03f, +8.718680321e-04f, -9.219803451e-03f, -1.520038286e-02f, -6.571754682e-03f, +9.228798617e-03f, +1.506631023e-02f, +7.173035830e-03f, -2.099343642e-03f, -3.390136682e-03f, -1.538810619e-04f, +1.183267602e-03f, +2.932081598e-04f, -2.680552395e-04f, -7.750368078e-05f, - /* 20, 7 */ +1.097853637e-04f, +2.548914413e-04f, -4.270756535e-04f, -1.189185758e-03f, +5.383311068e-04f, +3.636971298e-03f, +1.316206650e-03f, -8.548097577e-03f, -1.521852609e-02f, -7.495253444e-03f, +8.382317770e-03f, +1.517336238e-02f, +7.864476409e-03f, -1.725680482e-03f, -3.523865616e-03f, -3.415430197e-04f, +1.191416067e-03f, +3.592150564e-04f, -2.632711715e-04f, -9.336686615e-05f, - /* 20, 8 */ +9.336686615e-05f, +2.632711715e-04f, -3.592150564e-04f, -1.191416067e-03f, +3.415430197e-04f, +3.523865616e-03f, +1.725680482e-03f, -7.864476409e-03f, -1.517336238e-02f, -8.382317770e-03f, +7.495253444e-03f, +1.521852609e-02f, +8.548097577e-03f, -1.316206650e-03f, -3.636971298e-03f, -5.383311068e-04f, +1.189185758e-03f, +4.270756535e-04f, -2.548914413e-04f, -1.097853637e-04f, - /* 20, 9 */ +7.750368078e-05f, +2.680552395e-04f, -2.932081598e-04f, -1.183267602e-03f, +1.538810619e-04f, +3.390136682e-03f, +2.099343642e-03f, -7.173035830e-03f, -1.506631023e-02f, -9.228798617e-03f, +6.571754682e-03f, +1.520038286e-02f, +9.219803451e-03f, -8.718680321e-04f, -3.727374795e-03f, -7.430870045e-04f, +1.175906803e-03f, +4.962296614e-04f, -2.427015763e-04f, -1.265803873e-04f, - /* 20,10 */ +6.235351094e-05f, +2.694819135e-04f, -2.295611999e-04f, -1.165464351e-03f, -2.363306300e-05f, +3.237916857e-03f, +2.436518983e-03f, -6.477812874e-03f, -1.489912656e-02f, -1.003080152e-02f, +5.616199746e-03f, +1.511786634e-02f, +9.875465824e-03f, -3.938808876e-04f, -3.793068954e-03f, -9.545189950e-04f, +1.150972836e-03f, +5.660652366e-04f, -2.265149998e-04f, -1.435528424e-04f, - /* 20,11 */ +4.805250238e-05f, +2.678091338e-04f, -1.687245284e-04f, -1.138774993e-03f, -1.901162062e-04f, +3.069373786e-03f, +2.736794515e-03f, -5.782760145e-03f, -1.467389068e-02f, -1.078471010e-02f, +4.633169088e-03f, +1.497027375e-02f, +1.051095143e-02f, +1.162685315e-04f, -3.832136817e-03f, -1.171206475e-03f, +1.113850250e-03f, +6.359221544e-04f, -2.061770649e-04f, -1.604844080e-04f, - /* 20,12 */ +3.471505729e-05f, +2.633104157e-04f, -1.110914327e-04f, -1.104003505e-03f, -3.448244648e-04f, +2.886692602e-03f, +3.000017933e-03f, -5.091721334e-03f, -1.439298630e-02f, -1.148720750e-02f, +3.627416831e-03f, +1.475727496e-02f, +1.112214974e-02f, +6.568264230e-04f, -3.842769943e-03f, -1.391605775e-03f, +1.064087220e-03f, +7.050956564e-04f, -1.815689683e-04f, -1.771389305e-04f, - /* 20,13 */ +2.243392330e-05f, +2.562708188e-04f, -5.699759108e-05f, -1.061979909e-03f, -4.871526668e-04f, +2.692058620e-03f, +3.226289363e-03f, -4.408408028e-03f, -1.405908160e-02f, -1.213529571e-02f, +2.603840968e-03f, +1.447891891e-02f, +1.170500117e-02f, +1.225775962e-03f, -3.823286477e-03f, -1.614057279e-03f, +1.001322392e-03f, +7.728409668e-04f, -1.526114972e-04f, -1.932641301e-04f, - /* 20,14 */ -3.513221827e-04f, +2.469830254e-04f, -6.721135679e-06f, -1.013551226e-03f, -6.166326985e-04f, +2.487640644e-03f, +3.415952420e-03f, -3.736377939e-03f, -1.367510758e-02f, -1.272631251e-02f, +1.567452511e-03f, +1.413563751e-02f, +1.225552529e-02f, +1.820843931e-03f, -3.772148819e-03f, -1.836793834e-03f, +9.252931617e-04f, +8.383784628e-04f, -1.192685572e-04f, -2.085936177e-04f, - /* 20,15 */ +0.000000000e+00f, +2.357435643e-04f, +3.951670647e-05f, -9.595727172e-04f, -7.329307333e-04f, +2.275574997e-03f, +3.569583683e-03f, -3.079014715e-03f, -1.324423486e-02f, -1.325794606e-02f, +5.233437973e-04f, +1.372824692e-02f, +1.276984908e-02f, +2.439509438e-03f, -3.687980724e-03f, -2.057950411e-03f, +8.358434283e-04f, +9.008994790e-04f, -8.155042897e-05f, -2.228492143e-04f, - /* 20, 0 */ +1.941987182e-05f, +3.146481294e-04f, -2.345645569e-04f, -1.414667200e-03f, +5.144442975e-04f, +4.454307224e-03f, +1.983750799e-04f, -1.327145644e-02f, -1.714303646e-02f, -6.846700315e-04f, +1.665178821e-02f, +1.403392762e-02f, +4.892879248e-04f, -4.540173148e-03f, -7.773192529e-04f, +1.425286503e-03f, +3.160682424e-04f, -3.205185770e-04f, -3.476344875e-05f, +0.000000000e+00f, - /* 20, 1 */ -3.929324583e-04f, +3.051602666e-04f, -1.573970191e-04f, -1.390281543e-03f, +2.638941923e-04f, +4.333213577e-03f, +8.411158857e-04f, -1.246868983e-02f, -1.754185168e-02f, -2.049974665e-03f, +1.606968443e-02f, +1.474987505e-02f, +1.218921159e-03f, -4.587812221e-03f, -1.050600845e-03f, +1.421006956e-03f, +4.012475422e-04f, -3.223256966e-04f, -5.166761157e-05f, +0.000000000e+00f, - /* 20, 2 */ +0.000000000e+00f, +2.925136688e-04f, -8.512788201e-05f, -1.353337804e-03f, +2.735561011e-05f, +4.180044295e-03f, +1.436437300e-03f, -1.163198941e-02f, -1.784731333e-02f, -3.403203680e-03f, +1.539895444e-02f, +1.541325656e-02f, +1.987128326e-03f, -4.594412557e-03f, -1.332146559e-03f, +1.400789491e-03f, +4.893452569e-04f, -3.196436833e-04f, -7.000071077e-05f, +0.000000000e+00f, - /* 20, 3 */ +0.000000000e+00f, +2.771727451e-04f, -1.822077520e-05f, -1.305102482e-03f, -1.937209193e-04f, +3.998069961e-03f, +1.982303068e-03f, -1.076779718e-02f, -1.805915757e-02f, -4.736408619e-03f, +1.464246859e-02f, +1.601826823e-02f, +2.790083541e-03f, -4.557383277e-03f, -1.619599483e-03f, +1.363706016e-03f, +5.795104543e-04f, -3.120743969e-04f, -8.959420873e-05f, +0.000000000e+00f, - /* 20, 4 */ +0.000000000e+00f, +2.596009711e-04f, +4.295843246e-05f, -1.246883037e-03f, -3.981230344e-04f, +3.790645354e-03f, +2.477139789e-03f, -9.882582946e-03f, -1.817777152e-02f, -6.041793017e-03f, +1.380372215e-02f, +1.655939544e-02f, +3.623550339e-03f, -4.474387395e-03f, -1.910400883e-03f, +1.308956662e-03f, +6.708027600e-04f, -2.992550459e-04f, -1.102423612e-04f, +0.000000000e+00f, - /* 20, 5 */ +0.000000000e+00f, +2.402546692e-04f, +9.813963752e-05f, -1.180011107e-03f, -5.848760724e-04f, +3.561175652e-03f, +2.919834686e-03f, -8.982792490e-03f, -1.820418220e-02f, -7.311771311e-03f, +1.288681385e-02f, +1.703146227e-02f, +4.482904855e-03f, -4.343373467e-03f, -2.201805423e-03f, +1.235886510e-03f, +7.621980241e-04f, -2.808658988e-04f, -1.317024534e-04f, +0.000000000e+00f, - /* 20, 6 */ +0.000000000e+00f, +2.195772899e-04f, +1.471454599e-04f, -1.105826337e-03f, -7.532402115e-04f, +3.313083439e-03f, +3.309729355e-03f, -8.074797022e-03f, -1.814004021e-02f, -8.539025902e-03f, +1.189641917e-02f, +1.742967891e-02f, +5.363163073e-03f, -4.162605659e-03f, -2.490898970e-03f, +1.144001586e-03f, +8.525953702e-04f, -2.566379213e-04f, -1.536956226e-04f, +0.000000000e+00f, - /* 20, 7 */ +0.000000000e+00f, +1.979942392e-04f, +1.898872476e-04f, -1.025661016e-03f, -9.027053553e-04f, +3.049776817e-03f, +3.646609643e-03f, -7.164844319e-03f, -1.798759853e-02f, -9.716561844e-03f, +1.083775871e-02f, +1.774968640e-02f, +6.259011965e-03f, -3.930691879e-03f, -2.774618906e-03f, +1.032983905e-03f, +9.408256132e-04f, -2.263602294e-04f, -1.759082929e-04f, +0.000000000e+00f, - /* 20, 8 */ +0.000000000e+00f, +1.759082929e-04f, +2.263602294e-04f, -9.408256132e-04f, -1.032983905e-03f, +2.774618906e-03f, +3.930691879e-03f, -6.259011965e-03f, -1.774968640e-02f, -1.083775871e-02f, +9.716561844e-03f, +1.798759853e-02f, +7.164844319e-03f, -3.646609643e-03f, -3.049776817e-03f, +9.027053553e-04f, +1.025661016e-03f, -1.898872476e-04f, -1.979942392e-04f, +0.000000000e+00f, - /* 20, 9 */ +0.000000000e+00f, +1.536956226e-04f, +2.566379213e-04f, -8.525953702e-04f, -1.144001586e-03f, +2.490898970e-03f, +4.162605659e-03f, -5.363163073e-03f, -1.742967891e-02f, -1.189641917e-02f, +8.539025902e-03f, +1.814004021e-02f, +8.074797022e-03f, -3.309729355e-03f, -3.313083439e-03f, +7.532402115e-04f, +1.105826337e-03f, -1.471454599e-04f, -2.195772899e-04f, +0.000000000e+00f, - /* 20,10 */ +0.000000000e+00f, +1.317024534e-04f, +2.808658988e-04f, -7.621980241e-04f, -1.235886510e-03f, +2.201805423e-03f, +4.343373467e-03f, -4.482904855e-03f, -1.703146227e-02f, -1.288681385e-02f, +7.311771311e-03f, +1.820418220e-02f, +8.982792490e-03f, -2.919834686e-03f, -3.561175652e-03f, +5.848760724e-04f, +1.180011107e-03f, -9.813963752e-05f, -2.402546692e-04f, +0.000000000e+00f, - /* 20,11 */ +0.000000000e+00f, +1.102423612e-04f, +2.992550459e-04f, -6.708027600e-04f, -1.308956662e-03f, +1.910400883e-03f, +4.474387395e-03f, -3.623550339e-03f, -1.655939544e-02f, -1.380372215e-02f, +6.041793017e-03f, +1.817777152e-02f, +9.882582946e-03f, -2.477139789e-03f, -3.790645354e-03f, +3.981230344e-04f, +1.246883037e-03f, -4.295843246e-05f, -2.596009711e-04f, +0.000000000e+00f, - /* 20,12 */ +0.000000000e+00f, +8.959420873e-05f, +3.120743969e-04f, -5.795104543e-04f, -1.363706016e-03f, +1.619599483e-03f, +4.557383277e-03f, -2.790083541e-03f, -1.601826823e-02f, -1.464246859e-02f, +4.736408619e-03f, +1.805915757e-02f, +1.076779718e-02f, -1.982303068e-03f, -3.998069961e-03f, +1.937209193e-04f, +1.305102482e-03f, +1.822077520e-05f, -2.771727451e-04f, +0.000000000e+00f, - /* 20,13 */ +0.000000000e+00f, +7.000071077e-05f, +3.196436833e-04f, -4.893452569e-04f, -1.400789491e-03f, +1.332146559e-03f, +4.594412557e-03f, -1.987128326e-03f, -1.541325656e-02f, -1.539895444e-02f, +3.403203680e-03f, +1.784731333e-02f, +1.163198941e-02f, -1.436437300e-03f, -4.180044295e-03f, -2.735561011e-05f, +1.353337804e-03f, +8.512788201e-05f, -2.925136688e-04f, +0.000000000e+00f, - /* 20,14 */ +0.000000000e+00f, +5.166761157e-05f, +3.223256966e-04f, -4.012475422e-04f, -1.421006956e-03f, +1.050600845e-03f, +4.587812221e-03f, -1.218921159e-03f, -1.474987505e-02f, -1.606968443e-02f, +2.049974665e-03f, +1.754185168e-02f, +1.246868983e-02f, -8.411158857e-04f, -4.333213577e-03f, -2.638941923e-04f, +1.390281543e-03f, +1.573970191e-04f, -3.051602666e-04f, +3.929324583e-04f, - /* 20,15 */ +0.000000000e+00f, +3.476344875e-05f, +3.205185770e-04f, -3.160682424e-04f, -1.425286503e-03f, +7.773192529e-04f, +4.540173148e-03f, -4.892879248e-04f, -1.403392762e-02f, -1.665178821e-02f, +6.846700315e-04f, +1.714303646e-02f, +1.327145644e-02f, -1.983750799e-04f, -4.454307224e-03f, -5.144442975e-04f, +1.414667200e-03f, +2.345645569e-04f, -3.146481294e-04f, -1.941987182e-05f, - /* 16, 0 */ +3.215659774e-04f, -1.081239301e-03f, -1.047044785e-03f, +4.045780572e-03f, +3.005074105e-03f, -1.291342297e-02f, -2.083886340e-02f, -8.761305366e-04f, +2.037274022e-02f, +1.401097590e-02f, -2.379335663e-03f, -4.351475252e-03f, +8.522542940e-04f, +1.190910327e-03f, -2.874725537e-04f, -1.571395541e-04f, - /* 16, 1 */ +3.474336395e-04f, -9.673171402e-04f, -1.215210440e-03f, +3.716713245e-03f, +3.558195313e-03f, -1.178473019e-02f, -2.117503726e-02f, -2.622305580e-03f, +1.977768827e-02f, +1.506763496e-02f, -1.682580557e-03f, -4.628640452e-03f, +6.313208395e-04f, +1.294421768e-03f, -2.448738999e-04f, -1.853334990e-04f, - /* 16, 2 */ +3.654544998e-04f, -8.509694882e-04f, -1.356620316e-03f, +3.369379821e-03f, +4.037840451e-03f, -1.063463040e-02f, -2.138131359e-02f, -4.350277043e-03f, +1.905580462e-02f, +1.607371744e-02f, -9.171630004e-04f, -4.872124601e-03f, +3.850930357e-04f, +1.389803701e-03f, -1.936024914e-04f, -2.137577131e-04f, - /* 16, 3 */ +3.760939096e-04f, -7.339202470e-04f, -1.471475134e-03f, +3.008783957e-03f, +4.443873126e-03f, -9.472744965e-03f, -2.145880202e-02f, -6.048090342e-03f, +1.821025632e-02f, +1.701970579e-02f, -8.619500088e-05f, -5.076839304e-03f, +1.147982409e-04f, +1.475048300e-03f, -1.336143134e-04f, -2.418805517e-04f, - /* 16, 4 */ +3.798900997e-04f, -6.177751723e-04f, -1.560284979e-03f, +2.639777229e-03f, +4.776853126e-03f, -8.308496634e-03f, -2.140964525e-02f, -7.704060609e-03f, +1.724526338e-02f, +1.789634168e-02f, +8.064574864e-04f, -5.237819035e-03f, -1.779495980e-04f, +1.548135431e-03f, -6.499930382e-05f, -2.691226085e-04f, - /* 16, 5 */ +3.774404835e-04f, -5.040080805e-04f, -1.623844377e-03f, +2.267013831e-03f, +5.038003695e-03f, -7.151026424e-03f, -2.123698452e-02f, -9.306876654e-03f, +1.616607109e-02f, +1.869471933e-02f, +1.756186609e-03f, -5.350281937e-03f, -4.911465534e-04f, +1.607060019e-03f, +1.200956190e-05f, -2.948629835e-04f, - /* 16, 6 */ +3.693879948e-04f, -3.939497146e-04f, -1.663205192e-03f, +1.894909522e-03f, +5.229172900e-03f, -6.009115326e-03f, -2.094491570e-02f, -1.084570103e-02f, +1.497891218e-02f, +1.940637710e-02f, +2.757662946e-03f, -5.409691072e-03f, -8.224000281e-04f, +1.649860923e-03f, +9.702877105e-05f, -3.184467584e-04f, - /* 16, 7 */ +3.564076658e-04f, -2.887792732e-04f, -1.679647798e-03f, +1.527605146e-03f, +5.352789702e-03f, -4.891111570e-03f, -2.053843663e-02f, -1.231026521e-02f, +1.369095882e-02f, +2.002338639e-02f, +3.804864118e-03f, -5.411815390e-03f, -1.168934972e-03f, +1.674650966e-03f, +1.895185724e-04f, -3.391936346e-04f, - /* 16, 8 */ +3.391936346e-04f, -1.895185724e-04f, -1.674650966e-03f, +1.168934972e-03f, +5.411815390e-03f, -3.804864118e-03f, -2.002338639e-02f, -1.369095882e-02f, +1.231026521e-02f, +2.053843663e-02f, +4.891111570e-03f, -5.352789702e-03f, -1.527605146e-03f, +1.679647798e-03f, +2.887792732e-04f, -3.564076658e-04f, - /* 16, 9 */ +3.184467584e-04f, -9.702877105e-05f, -1.649860923e-03f, +8.224000281e-04f, +5.409691072e-03f, -2.757662946e-03f, -1.940637710e-02f, -1.497891218e-02f, +1.084570103e-02f, +2.094491570e-02f, +6.009115326e-03f, -5.229172900e-03f, -1.894909522e-03f, +1.663205192e-03f, +3.939497146e-04f, -3.693879948e-04f, - /* 16,10 */ +2.948629835e-04f, -1.200956190e-05f, -1.607060019e-03f, +4.911465534e-04f, +5.350281937e-03f, -1.756186609e-03f, -1.869471933e-02f, -1.616607109e-02f, +9.306876654e-03f, +2.123698452e-02f, +7.151026424e-03f, -5.038003695e-03f, -2.267013831e-03f, +1.623844377e-03f, +5.040080805e-04f, -3.774404835e-04f, - /* 16,11 */ +2.691226085e-04f, +6.499930382e-05f, -1.548135431e-03f, +1.779495980e-04f, +5.237819035e-03f, -8.064574864e-04f, -1.789634168e-02f, -1.724526338e-02f, +7.704060609e-03f, +2.140964525e-02f, +8.308496634e-03f, -4.776853126e-03f, -2.639777229e-03f, +1.560284979e-03f, +6.177751723e-04f, -3.798900997e-04f, - /* 16,12 */ +2.418805517e-04f, +1.336143134e-04f, -1.475048300e-03f, -1.147982409e-04f, +5.076839304e-03f, +8.619500088e-05f, -1.701970579e-02f, -1.821025632e-02f, +6.048090342e-03f, +2.145880202e-02f, +9.472744965e-03f, -4.443873126e-03f, -3.008783957e-03f, +1.471475134e-03f, +7.339202470e-04f, -3.760939096e-04f, - /* 16,13 */ +2.137577131e-04f, +1.936024914e-04f, -1.389803701e-03f, -3.850930357e-04f, +4.872124601e-03f, +9.171630004e-04f, -1.607371744e-02f, -1.905580462e-02f, +4.350277043e-03f, +2.138131359e-02f, +1.063463040e-02f, -4.037840451e-03f, -3.369379821e-03f, +1.356620316e-03f, +8.509694882e-04f, -3.654544998e-04f, - /* 16,14 */ +1.853334990e-04f, +2.448738999e-04f, -1.294421768e-03f, -6.313208395e-04f, +4.628640452e-03f, +1.682580557e-03f, -1.506763496e-02f, -1.977768827e-02f, +2.622305580e-03f, +2.117503726e-02f, +1.178473019e-02f, -3.558195313e-03f, -3.716713245e-03f, +1.215210440e-03f, +9.673171402e-04f, -3.474336395e-04f, - /* 16,15 */ +1.571395541e-04f, +2.874725537e-04f, -1.190910327e-03f, -8.522542940e-04f, +4.351475252e-03f, +2.379335663e-03f, -1.401097590e-02f, -2.037274022e-02f, +8.761305366e-04f, +2.083886340e-02f, +1.291342297e-02f, -3.005074105e-03f, -4.045780572e-03f, +1.047044785e-03f, +1.081239301e-03f, -3.215659774e-04f, - /* 16, 0 */ +3.737698842e-04f, -2.640449894e-04f, -1.945694549e-03f, +2.599440145e-03f, +5.499552783e-03f, -1.161604587e-02f, -2.473725459e-02f, -1.100298137e-03f, +2.435797715e-02f, +1.306966182e-02f, -5.062036618e-03f, -3.067638325e-03f, +1.905476637e-03f, +3.919780470e-04f, -3.991665042e-04f, +0.000000000e+00f, - /* 16, 1 */ +3.444161169e-04f, -1.448617079e-04f, -1.955541719e-03f, +2.132654952e-03f, +5.839402648e-03f, -1.015371093e-02f, -2.494083956e-02f, -3.291998323e-03f, +2.380252288e-02f, +1.450063212e-02f, -4.525267650e-03f, -3.530814272e-03f, +1.832921116e-03f, +5.273022833e-04f, -4.195866486e-04f, +0.000000000e+00f, - /* 16, 2 */ +3.121018536e-04f, -3.553225965e-05f, -1.937280777e-03f, +1.673279684e-03f, +6.084169165e-03f, -8.696195593e-03f, -2.497087446e-02f, -5.457102987e-03f, +2.307209479e-02f, +1.589478690e-02f, -3.888719495e-03f, -3.982156136e-03f, +1.726408630e-03f, +6.684076945e-04f, -4.340068349e-04f, +0.000000000e+00f, - /* 16, 3 */ +2.777843660e-04f, +6.309259068e-05f, -1.893417136e-03f, +1.226820211e-03f, +6.237358144e-03f, -7.256513778e-03f, -2.483111182e-02f, -7.578189778e-03f, +2.216959356e-02f, +1.723786448e-02f, -3.152978451e-03f, -4.414545490e-03f, +1.584716951e-03f, +8.134406195e-04f, -4.414195390e-04f, +4.634120047e-04f, - /* 16, 4 */ +2.423668462e-04f, +1.504100330e-04f, -1.826645633e-03f, +7.982477790e-04f, +6.303316031e-03f, -5.847027899e-03f, -2.452684878e-02f, -9.638294429e-03f, +2.109960841e-02f, +1.851566754e-02f, -2.319783877e-03f, -4.820635148e-03f, +1.407067591e-03f, +9.603162700e-04f, -4.408546251e-04f, -2.338334874e-05f, - /* 16, 5 */ +2.066858426e-04f, +2.260561294e-04f, -1.739797615e-03f, +3.919648528e-04f, +6.287140435e-03f, -4.479333074e-03f, -2.406484480e-02f, -1.162108621e-02f, +1.986838848e-02f, +1.971422226e-02f, -1.392055451e-03f, -5.192933984e-03f, +1.193168502e-03f, +1.106736135e-03f, -4.314017719e-04f, -4.782938304e-05f, - /* 16, 6 */ +1.715009195e-04f, +2.898933732e-04f, -1.635789255e-03f, +1.178042715e-05f, +6.194584811e-03f, -3.164153635e-03f, -2.345322399e-02f, -1.351103572e-02f, +1.848379497e-02f, +2.081993840e-02f, -3.739065234e-04f, -5.523897843e-03f, +9.432519997e-04f, +1.250210274e-03f, -4.122335402e-04f, -7.520965874e-05f, - /* 16, 7 */ +1.374865801e-04f, +3.419953130e-04f, -1.517571800e-03f, -3.391052954e-04f, +6.031958779e-03f, -1.911252903e-03f, -2.270136331e-02f, -1.529357304e-02f, +1.695523429e-02f, +2.181976838e-02f, +7.293570292e-04f, -5.806025538e-03f, +6.581070752e-04f, +1.388084428e-03f, -3.826286881e-04f, -1.052264476e-04f, - /* 16, 8 */ +1.052264476e-04f, +3.826286881e-04f, -1.388084428e-03f, -6.581070752e-04f, +5.806025538e-03f, -7.293570292e-04f, -2.181976838e-02f, -1.695523429e-02f, +1.529357304e-02f, +2.270136331e-02f, +1.911252903e-03f, -6.031958779e-03f, +3.391052954e-04f, +1.517571800e-03f, -3.419953130e-04f, -1.374865801e-04f, - /* 16, 9 */ +7.520965874e-05f, +4.122335402e-04f, -1.250210274e-03f, -9.432519997e-04f, +5.523897843e-03f, +3.739065234e-04f, -2.081993840e-02f, -1.848379497e-02f, +1.351103572e-02f, +2.345322399e-02f, +3.164153635e-03f, -6.194584811e-03f, -1.178042715e-05f, +1.635789255e-03f, -2.898933732e-04f, -1.715009195e-04f, - /* 16,10 */ +4.782938304e-05f, +4.314017719e-04f, -1.106736135e-03f, -1.193168502e-03f, +5.192933984e-03f, +1.392055451e-03f, -1.971422226e-02f, -1.986838848e-02f, +1.162108621e-02f, +2.406484480e-02f, +4.479333074e-03f, -6.287140435e-03f, -3.919648528e-04f, +1.739797615e-03f, -2.260561294e-04f, -2.066858426e-04f, - /* 16,11 */ +2.338334874e-05f, +4.408546251e-04f, -9.603162700e-04f, -1.407067591e-03f, +4.820635148e-03f, +2.319783877e-03f, -1.851566754e-02f, -2.109960841e-02f, +9.638294429e-03f, +2.452684878e-02f, +5.847027899e-03f, -6.303316031e-03f, -7.982477790e-04f, +1.826645633e-03f, -1.504100330e-04f, -2.423668462e-04f, - /* 16,12 */ -4.634120047e-04f, +4.414195390e-04f, -8.134406195e-04f, -1.584716951e-03f, +4.414545490e-03f, +3.152978451e-03f, -1.723786448e-02f, -2.216959356e-02f, +7.578189778e-03f, +2.483111182e-02f, +7.256513778e-03f, -6.237358144e-03f, -1.226820211e-03f, +1.893417136e-03f, -6.309259068e-05f, -2.777843660e-04f, - /* 16,13 */ +0.000000000e+00f, +4.340068349e-04f, -6.684076945e-04f, -1.726408630e-03f, +3.982156136e-03f, +3.888719495e-03f, -1.589478690e-02f, -2.307209479e-02f, +5.457102987e-03f, +2.497087446e-02f, +8.696195593e-03f, -6.084169165e-03f, -1.673279684e-03f, +1.937280777e-03f, +3.553225965e-05f, -3.121018536e-04f, - /* 16,14 */ +0.000000000e+00f, +4.195866486e-04f, -5.273022833e-04f, -1.832921116e-03f, +3.530814272e-03f, +4.525267650e-03f, -1.450063212e-02f, -2.380252288e-02f, +3.291998323e-03f, +2.494083956e-02f, +1.015371093e-02f, -5.839402648e-03f, -2.132654952e-03f, +1.955541719e-03f, +1.448617079e-04f, -3.444161169e-04f, - /* 16,15 */ +0.000000000e+00f, +3.991665042e-04f, -3.919780470e-04f, -1.905476637e-03f, +3.067638325e-03f, +5.062036618e-03f, -1.306966182e-02f, -2.435797715e-02f, +1.100298137e-03f, +2.473725459e-02f, +1.161604587e-02f, -5.499552783e-03f, -2.599440145e-03f, +1.945694549e-03f, +2.640449894e-04f, -3.737698842e-04f, - /* 16, 0 */ +1.129954761e-04f, +3.969443331e-04f, -1.897918409e-03f, +5.803605804e-04f, +7.236474393e-03f, -9.385964725e-03f, -2.874576735e-02f, -1.359743295e-03f, +2.853093461e-02f, +1.118139232e-02f, -7.102956997e-03f, -1.091735034e-03f, +2.023521864e-03f, -3.328791130e-04f, -1.523656204e-04f, +0.000000000e+00f, - /* 16, 1 */ +7.672972562e-05f, +4.458313625e-04f, -1.753034729e-03f, +1.022461377e-04f, +7.257902118e-03f, -7.620475041e-03f, -2.873131200e-02f, -4.066570788e-03f, +2.808336987e-02f, +1.298853535e-02f, -6.850603202e-03f, -1.630677017e-03f, +2.125649126e-03f, -2.532507071e-04f, -1.941703587e-04f, +0.000000000e+00f, - /* 16, 2 */ +4.409159553e-05f, +4.801879450e-04f, -1.593056257e-03f, -3.378401438e-04f, +7.175055211e-03f, -5.902082228e-03f, -2.849345261e-02f, -6.735572940e-03f, +2.740215275e-02f, +1.478830973e-02f, -6.473886365e-03f, -2.190599691e-03f, +2.200171639e-03f, -1.579695096e-04f, -2.375950982e-04f, +0.000000000e+00f, - /* 16, 3 */ -4.855802427e-04f, +5.008892512e-04f, -1.422085430e-03f, -7.360682089e-04f, +6.996656391e-03f, -4.246700138e-03f, -2.804039906e-02f, -9.342037235e-03f, +2.648893755e-02f, +1.656098957e-02f, -5.968640123e-03f, -2.764068406e-03f, +2.243110553e-03f, -4.727037370e-05f, -2.816859426e-04f, +0.000000000e+00f, - /* 16, 4 */ +0.000000000e+00f, +5.090007623e-04f, -1.244075649e-03f, -1.089544232e-03f, +6.732169339e-03f, -2.668838337e-03f, -2.738254409e-02f, -1.186200034e-02f, +2.534797081e-02f, +1.828644204e-02f, -5.332184360e-03f, -3.342863857e-03f, +2.250722132e-03f, +7.826276448e-05f, -3.253590588e-04f, +0.000000000e+00f, - /* 16, 5 */ +0.000000000e+00f, +5.057402285e-04f, -1.062772468e-03f, -1.396293958e-03f, +6.391628670e-03f, -1.181467029e-03f, -2.653229393e-02f, -1.427253312e-02f, +2.398607480e-02f, +1.994437434e-02f, -4.563434465e-03f, -3.918061651e-03f, +2.219584858e-03f, +2.176775461e-04f, -3.674140144e-04f, +0.000000000e+00f, - /* 16, 6 */ +0.000000000e+00f, +4.924395299e-04f, -8.816626027e-04f, -1.655232286e-03f, +5.985469320e-03f, +2.040926394e-04f, -2.550387540e-02f, -1.655201127e-02f, +2.241259678e-02f, +2.151458926e-02f, -3.662991573e-03f, -4.480127768e-03f, +2.146686747e-03f, +3.696399185e-04f, -4.065510896e-04f, +0.000000000e+00f, - /* 16, 7 */ +0.000000000e+00f, +4.705072223e-04f, -7.039312026e-04f, -1.866120323e-03f, +5.524357980e-03f, +1.478252020e-03f, -2.431312252e-02f, -1.868036788e-02f, +2.063932435e-02f, +2.297724601e-02f, -2.633211707e-03f, -5.019029099e-03f, +2.029511283e-03f, +5.324276437e-04f, -4.413924818e-04f, +0.000000000e+00f, - /* 16, 8 */ +0.000000000e+00f, +4.413924818e-04f, -5.324276437e-04f, -2.029511283e-03f, +5.019029099e-03f, +2.633211707e-03f, -2.297724601e-02f, -2.063932435e-02f, +1.868036788e-02f, +2.431312252e-02f, -1.478252020e-03f, -5.524357980e-03f, +1.866120323e-03f, +7.039312026e-04f, -4.705072223e-04f, +0.000000000e+00f, - /* 16, 9 */ +0.000000000e+00f, +4.065510896e-04f, -3.696399185e-04f, -2.146686747e-03f, +4.480127768e-03f, +3.662991573e-03f, -2.151458926e-02f, -2.241259678e-02f, +1.655201127e-02f, +2.550387540e-02f, -2.040926394e-04f, -5.985469320e-03f, +1.655232286e-03f, +8.816626027e-04f, -4.924395299e-04f, +0.000000000e+00f, - /* 16,10 */ +0.000000000e+00f, +3.674140144e-04f, -2.176775461e-04f, -2.219584858e-03f, +3.918061651e-03f, +4.563434465e-03f, -1.994437434e-02f, -2.398607480e-02f, +1.427253312e-02f, +2.653229393e-02f, +1.181467029e-03f, -6.391628670e-03f, +1.396293958e-03f, +1.062772468e-03f, -5.057402285e-04f, +0.000000000e+00f, - /* 16,11 */ +0.000000000e+00f, +3.253590588e-04f, -7.826276448e-05f, -2.250722132e-03f, +3.342863857e-03f, +5.332184360e-03f, -1.828644204e-02f, -2.534797081e-02f, +1.186200034e-02f, +2.738254409e-02f, +2.668838337e-03f, -6.732169339e-03f, +1.089544232e-03f, +1.244075649e-03f, -5.090007623e-04f, +0.000000000e+00f, - /* 16,12 */ +0.000000000e+00f, +2.816859426e-04f, +4.727037370e-05f, -2.243110553e-03f, +2.764068406e-03f, +5.968640123e-03f, -1.656098957e-02f, -2.648893755e-02f, +9.342037235e-03f, +2.804039906e-02f, +4.246700138e-03f, -6.996656391e-03f, +7.360682089e-04f, +1.422085430e-03f, -5.008892512e-04f, +4.855802427e-04f, - /* 16,13 */ +0.000000000e+00f, +2.375950982e-04f, +1.579695096e-04f, -2.200171639e-03f, +2.190599691e-03f, +6.473886365e-03f, -1.478830973e-02f, -2.740215275e-02f, +6.735572940e-03f, +2.849345261e-02f, +5.902082228e-03f, -7.175055211e-03f, +3.378401438e-04f, +1.593056257e-03f, -4.801879450e-04f, -4.409159553e-05f, - /* 16,14 */ +0.000000000e+00f, +1.941703587e-04f, +2.532507071e-04f, -2.125649126e-03f, +1.630677017e-03f, +6.850603202e-03f, -1.298853535e-02f, -2.808336987e-02f, +4.066570788e-03f, +2.873131200e-02f, +7.620475041e-03f, -7.257902118e-03f, -1.022461377e-04f, +1.753034729e-03f, -4.458313625e-04f, -7.672972562e-05f, - /* 16,15 */ +0.000000000e+00f, +1.523656204e-04f, +3.328791130e-04f, -2.023521864e-03f, +1.091735034e-03f, +7.102956997e-03f, -1.118139232e-02f, -2.853093461e-02f, +1.359743295e-03f, +2.874576735e-02f, +9.385964725e-03f, -7.236474393e-03f, -5.803605804e-04f, +1.897918409e-03f, -3.969443331e-04f, -1.129954761e-04f, - /* 12, 0 */ -1.111572639e-03f, -1.388266820e-03f, +7.900037037e-03f, -6.320860170e-03f, -3.276049121e-02f, -1.657033928e-03f, +3.280306521e-02f, +8.402419704e-03f, -8.147060845e-03f, +9.779320530e-04f, +1.332890330e-03f, -5.705687800e-04f, - /* 12, 1 */ -8.925738220e-04f, -1.737094155e-03f, +7.544883174e-03f, -4.325531156e-03f, -3.242830266e-02f, -4.953502968e-03f, +3.254754550e-02f, +1.054842384e-02f, -8.272560314e-03f, +5.083818205e-04f, +1.551863117e-03f, -5.805594968e-04f, - /* 12, 2 */ -6.800837112e-04f, -2.023419107e-03f, +7.095763901e-03f, -2.436087367e-03f, -3.181840805e-02f, -8.197416535e-03f, +3.198906769e-02f, +1.273520115e-02f, -8.264181830e-03f, -1.673924732e-05f, +1.763414955e-03f, -5.764989135e-04f, - /* 12, 3 */ -4.777710304e-04f, -2.247467778e-03f, +6.567344318e-03f, -6.698479312e-04f, -3.094591156e-02f, -1.135453705e-02f, +3.112651563e-02f, +1.493747887e-02f, -8.110878239e-03f, -5.924008684e-04f, +1.962133432e-03f, -5.566237283e-04f, - /* 12, 4 */ -2.887507612e-04f, -2.410593616e-03f, +5.974525144e-03f, +9.583644900e-04f, -2.982883555e-02f, -1.439181272e-02f, +2.996260004e-02f, +1.712870168e-02f, -7.803165138e-03f, -1.212178752e-03f, +2.142359210e-03f, -5.193755958e-04f, - /* 12, 5 */ -1.155657138e-04f, -2.515168800e-03f, +5.332187403e-03f, +2.436339775e-03f, -2.848780461e-02f, -1.727782533e-02f, +2.850388027e-02f, +1.928138098e-02f, -7.333362623e-03f, -1.868272468e-03f, +2.298288008e-03f, -4.634616378e-04f, - /* 12, 6 */ +3.981829456e-05f, -2.564463655e-03f, +4.654950666e-03f, +3.754551105e-03f, -2.694569661e-02f, -1.998321224e-02f, +2.676072816e-02f, +2.136746929e-02f, -6.695817566e-03f, -2.551550686e-03f, +2.424083786e-03f, -3.879138191e-04f, - /* 12, 7 */ +1.760045094e-04f, -2.562517141e-03f, +3.956948521e-03f, +4.906180706e-03f, -2.522726725e-02f, -2.248105576e-02f, +2.474723407e-02f, +2.335875442e-02f, -5.887101657e-03f, -3.251624436e-03f, +2.514001460e-03f, -2.921456350e-04f, - /* 12, 8 */ +2.921456350e-04f, -2.514001460e-03f, +3.251624436e-03f, +5.887101657e-03f, -2.335875442e-02f, -2.474723407e-02f, +2.248105576e-02f, +2.522726725e-02f, -4.906180706e-03f, -3.956948521e-03f, +2.562517141e-03f, -1.760045094e-04f, - /* 12, 9 */ +3.879138191e-04f, -2.424083786e-03f, +2.551550686e-03f, +6.695817566e-03f, -2.136746929e-02f, -2.676072816e-02f, +1.998321224e-02f, +2.694569661e-02f, -3.754551105e-03f, -4.654950666e-03f, +2.564463655e-03f, -3.981829456e-05f, - /* 12,10 */ +4.634616378e-04f, -2.298288008e-03f, +1.868272468e-03f, +7.333362623e-03f, -1.928138098e-02f, -2.850388027e-02f, +1.727782533e-02f, +2.848780461e-02f, -2.436339775e-03f, -5.332187403e-03f, +2.515168800e-03f, +1.155657138e-04f, - /* 12,11 */ +5.193755958e-04f, -2.142359210e-03f, +1.212178752e-03f, +7.803165138e-03f, -1.712870168e-02f, -2.996260004e-02f, +1.439181272e-02f, +2.982883555e-02f, -9.583644900e-04f, -5.974525144e-03f, +2.410593616e-03f, +2.887507612e-04f, - /* 12,12 */ +5.566237283e-04f, -1.962133432e-03f, +5.924008684e-04f, +8.110878239e-03f, -1.493747887e-02f, -3.112651563e-02f, +1.135453705e-02f, +3.094591156e-02f, +6.698479312e-04f, -6.567344318e-03f, +2.247467778e-03f, +4.777710304e-04f, - /* 12,13 */ +5.764989135e-04f, -1.763414955e-03f, +1.673924732e-05f, +8.264181830e-03f, -1.273520115e-02f, -3.198906769e-02f, +8.197416535e-03f, +3.181840805e-02f, +2.436087367e-03f, -7.095763901e-03f, +2.023419107e-03f, +6.800837112e-04f, - /* 12,14 */ +5.805594968e-04f, -1.551863117e-03f, -5.083818205e-04f, +8.272560314e-03f, -1.054842384e-02f, -3.254754550e-02f, +4.953502968e-03f, +3.242830266e-02f, +4.325531156e-03f, -7.544883174e-03f, +1.737094155e-03f, +8.925738220e-04f, - /* 12,15 */ +5.705687800e-04f, -1.332890330e-03f, -9.779320530e-04f, +8.147060845e-03f, -8.402419704e-03f, -3.280306521e-02f, +1.657033928e-03f, +3.276049121e-02f, +6.320860170e-03f, -7.900037037e-03f, +1.388266820e-03f, +1.111572639e-03f, - /* 12, 0 */ -1.054803383e-04f, -2.744858958e-03f, +7.370914553e-03f, -2.604494739e-03f, -3.666896703e-02f, -1.994735221e-03f, +3.707596726e-02f, +4.873177855e-03f, -8.012348726e-03f, +2.554514858e-03f, +3.117958677e-04f, -3.625540242e-04f, - /* 12, 1 */ +7.775923585e-05f, -2.860662969e-03f, +6.648820026e-03f, -4.950753709e-04f, -3.590728113e-02f, -5.960234251e-03f, +3.711196787e-02f, +7.277671607e-03f, -8.552819277e-03f, +2.286292242e-03f, +5.385913036e-04f, -4.265219564e-04f, - /* 12, 2 */ +2.361482435e-04f, -2.906545541e-03f, +5.866306097e-03f, +1.435258618e-03f, -3.481183398e-02f, -9.854190425e-03f, +3.676562700e-02f, +9.791136525e-03f, -8.972352970e-03f, +1.938320040e-03f, +7.824350015e-04f, -4.875429386e-04f, - /* 12, 3 */ +3.687004846e-04f, -2.888204359e-03f, +5.043181884e-03f, +3.170488652e-03f, -3.340772759e-02f, -1.363013975e-02f, +3.603085731e-02f, +1.238366322e-02f, -9.251714734e-03f, +1.510362297e-03f, +1.039066351e-03f, -5.431259501e-04f, - /* 12, 4 */ +4.751685216e-04f, -2.812206203e-03f, +4.198484259e-03f, +4.698496481e-03f, -3.172374637e-02f, -1.724344185e-02f, +3.490702283e-02f, +1.502265637e-02f, -9.372823891e-03f, +1.003961424e-03f, +1.303424694e-03f, -5.906251216e-04f, - /* 12, 5 */ +5.559799195e-04f, -2.685773447e-03f, +3.350171906e-03f, +6.011087921e-03f, -2.979181001e-02f, -2.065196332e-02f, +3.339904530e-02f, +1.767328103e-02f, -9.319170237e-03f, +4.225520445e-04f, +1.569701578e-03f, -6.273034189e-04f, - /* 12, 6 */ +6.121620582e-04f, -2.516571985e-03f, +2.514858275e-03f, +7.103945228e-03f, -2.764638515e-02f, -2.381671619e-02f, +3.151741694e-02f, +2.029896461e-02f, -9.076221424e-03f, -2.284590483e-04f, +1.831416829e-03f, -6.504054889e-04f, - /* 12, 7 */ +6.452583046e-04f, -2.312505227e-03f, +1.707586806e-03f, +7.976511649e-03f, -2.532386758e-02f, -2.670244010e-02f, +2.927811806e-02f, +2.286194672e-02f, -8.631812899e-03f, -9.416507761e-04f, +2.081518390e-03f, -6.572383529e-04f, - /* 12, 8 */ +6.572383529e-04f, -2.081518390e-03f, +9.416507761e-04f, +8.631812899e-03f, -2.286194672e-02f, -2.927811806e-02f, +2.670244010e-02f, +2.532386758e-02f, -7.976511649e-03f, -1.707586806e-03f, +2.312505227e-03f, -6.452583046e-04f, - /* 12, 9 */ +6.504054889e-04f, -1.831416829e-03f, +2.284590483e-04f, +9.076221424e-03f, -2.029896461e-02f, -3.151741694e-02f, +2.381671619e-02f, +2.764638515e-02f, -7.103945228e-03f, -2.514858275e-03f, +2.516571985e-03f, -6.121620582e-04f, - /* 12,10 */ +6.273034189e-04f, -1.569701578e-03f, -4.225520445e-04f, +9.319170237e-03f, -1.767328103e-02f, -3.339904530e-02f, +2.065196332e-02f, +2.979181001e-02f, -6.011087921e-03f, -3.350171906e-03f, +2.685773447e-03f, -5.559799195e-04f, - /* 12,11 */ +5.906251216e-04f, -1.303424694e-03f, -1.003961424e-03f, +9.372823891e-03f, -1.502265637e-02f, -3.490702283e-02f, +1.724344185e-02f, +3.172374637e-02f, -4.698496481e-03f, -4.198484259e-03f, +2.812206203e-03f, -4.751685216e-04f, - /* 12,12 */ +5.431259501e-04f, -1.039066351e-03f, -1.510362297e-03f, +9.251714734e-03f, -1.238366322e-02f, -3.603085731e-02f, +1.363013975e-02f, +3.340772759e-02f, -3.170488652e-03f, -5.043181884e-03f, +2.888204359e-03f, -3.687004846e-04f, - /* 12,13 */ +4.875429386e-04f, -7.824350015e-04f, -1.938320040e-03f, +8.972352970e-03f, -9.791136525e-03f, -3.676562700e-02f, +9.854190425e-03f, +3.481183398e-02f, -1.435258618e-03f, -5.866306097e-03f, +2.906545541e-03f, -2.361482435e-04f, - /* 12,14 */ +4.265219564e-04f, -5.385913036e-04f, -2.286292242e-03f, +8.552819277e-03f, -7.277671607e-03f, -3.711196787e-02f, +5.960234251e-03f, +3.590728113e-02f, +4.950753709e-04f, -6.648820026e-03f, +2.860662969e-03f, -7.775923585e-05f, - /* 12,15 */ +3.625540242e-04f, -3.117958677e-04f, -2.554514858e-03f, +8.012348726e-03f, -4.873177855e-03f, -3.707596726e-02f, +1.994735221e-03f, +3.666896703e-02f, +2.604494739e-03f, -7.370914553e-03f, +2.744858958e-03f, +1.054803383e-04f, - /* 12, 0 */ +6.110448771e-04f, -3.173989705e-03f, +5.751223243e-03f, +1.507555794e-03f, -4.035343888e-02f, -2.375409442e-03f, +4.124383193e-02f, +8.091337269e-04f, -6.726716888e-03f, +3.253952459e-03f, -5.087325269e-04f, -4.127854608e-05f, - /* 12, 1 */ +6.820041984e-04f, -3.029137857e-03f, +4.746351538e-03f, +3.578915017e-03f, -3.904147991e-02f, -7.094160720e-03f, +4.168490752e-02f, +3.349306133e-03f, -7.647219355e-03f, +3.259488816e-03f, -3.738470149e-04f, -9.536054020e-05f, - /* 12, 2 */ +7.235832870e-04f, -2.829602454e-03f, +3.736224000e-03f, +5.388621830e-03f, -3.734163661e-02f, -1.171726725e-02f, +4.165549067e-02f, +6.085743956e-03f, -8.486093037e-03f, +3.182049180e-03f, -2.060445111e-04f, -1.573545891e-04f, - /* 12, 3 */ +7.383739029e-04f, -2.585946508e-03f, +2.743066911e-03f, +6.925917423e-03f, -3.529277498e-02f, -1.618281485e-02f, +4.114151479e-02f, +8.986133221e-03f, -9.216195947e-03f, +3.014391908e-03f, -5.966328360e-06f, -2.260166200e-04f, - /* 12, 4 */ +7.294476853e-04f, -2.308795686e-03f, +1.786872733e-03f, +8.185530694e-03f, -3.293811768e-02f, -2.043162352e-02f, +4.013642610e-02f, +1.201345370e-02f, -9.810446156e-03f, +2.750895834e-03f, +2.246717082e-04f, -2.996559917e-04f, - /* 12, 5 */ +7.002161546e-04f, -2.008565767e-03f, +8.851333656e-04f, +9.167495079e-03f, -3.032435275e-02f, -2.440826356e-02f, +3.864144993e-02f, +1.512648157e-02f, -1.024241966e-02f, +2.387856219e-03f, +4.830138128e-04f, -3.761418846e-04f, - /* 12, 6 */ +6.542939604e-04f, -1.695217727e-03f, +5.264660367e-05f, +9.876866054e-03f, -2.750069849e-02f, -2.806199617e-02f, +3.666571148e-02f, +1.828039745e-02f, -1.048696943e-02f, +1.923755148e-03f, +7.650267923e-04f, -4.529261561e-04f, - /* 12, 7 */ +5.953691186e-04f, -1.378044726e-03f, -6.986040124e-04f, +1.032334944e-02f, -2.451794467e-02f, -3.134761990e-02f, +3.422620641e-02f, +2.142749023e-02f, -1.052085229e-02f, +1.359497506e-03f, +1.065494162e-03f, -5.270834853e-04f, - /* 12, 8 */ +5.270834853e-04f, -1.065494162e-03f, -1.359497506e-03f, +1.052085229e-02f, -2.142749023e-02f, -3.422620641e-02f, +3.134761990e-02f, +2.451794467e-02f, -1.032334944e-02f, +6.986040124e-04f, +1.378044726e-03f, -5.953691186e-04f, - /* 12, 9 */ +4.529261561e-04f, -7.650267923e-04f, -1.923755148e-03f, +1.048696943e-02f, -1.828039745e-02f, -3.666571148e-02f, +2.806199617e-02f, +2.750069849e-02f, -9.876866054e-03f, -5.264660367e-05f, +1.695217727e-03f, -6.542939604e-04f, - /* 12,10 */ +3.761418846e-04f, -4.830138128e-04f, -2.387856219e-03f, +1.024241966e-02f, -1.512648157e-02f, -3.864144993e-02f, +2.440826356e-02f, +3.032435275e-02f, -9.167495079e-03f, -8.851333656e-04f, +2.008565767e-03f, -7.002161546e-04f, - /* 12,11 */ +2.996559917e-04f, -2.246717082e-04f, -2.750895834e-03f, +9.810446156e-03f, -1.201345370e-02f, -4.013642610e-02f, +2.043162352e-02f, +3.293811768e-02f, -8.185530694e-03f, -1.786872733e-03f, +2.308795686e-03f, -7.294476853e-04f, - /* 12,12 */ +2.260166200e-04f, +5.966328360e-06f, -3.014391908e-03f, +9.216195947e-03f, -8.986133221e-03f, -4.114151479e-02f, +1.618281485e-02f, +3.529277498e-02f, -6.925917423e-03f, -2.743066911e-03f, +2.585946508e-03f, -7.383739029e-04f, - /* 12,13 */ +1.573545891e-04f, +2.060445111e-04f, -3.182049180e-03f, +8.486093037e-03f, -6.085743956e-03f, -4.165549067e-02f, +1.171726725e-02f, +3.734163661e-02f, -5.388621830e-03f, -3.736224000e-03f, +2.829602454e-03f, -7.235832870e-04f, - /* 12,14 */ +9.536054020e-05f, +3.738470149e-04f, -3.259488816e-03f, +7.647219355e-03f, -3.349306133e-03f, -4.168490752e-02f, +7.094160720e-03f, +3.904147991e-02f, -3.578915017e-03f, -4.746351538e-03f, +3.029137857e-03f, -6.820041984e-04f, - /* 12,15 */ +4.127854608e-05f, +5.087325269e-04f, -3.253952459e-03f, +6.726716888e-03f, -8.091337269e-04f, -4.124383193e-02f, +2.375409442e-03f, +4.035343888e-02f, -1.507555794e-03f, -5.751223243e-03f, +3.173989705e-03f, -6.110448771e-04f, - - /* 24, 0 */ -8.820438069e-05f, -1.519461079e-04f, -2.301651496e-04f, -3.149320871e-04f, -3.945939739e-04f, -4.554410135e-04f, -4.841532882e-04f, -4.705408991e-04f, -4.099602091e-04f, -3.048100066e-04f, -1.646897470e-04f, -5.099007530e-06f, +1.551006323e-04f, +2.969416536e-04f, +4.046294158e-04f, +4.681429482e-04f, +4.846228261e-04f, +4.583040637e-04f, +3.990939388e-04f, +3.201968846e-04f, +2.353759082e-04f, +1.564712483e-04f, +9.167483068e-05f, +4.482688286e-05f, - /* 24, 1 */ -8.480575132e-05f, -1.474789784e-04f, -2.249812225e-04f, -3.096480504e-04f, -3.900204007e-04f, -4.524514078e-04f, -4.835165803e-04f, -4.727530367e-04f, -4.151145025e-04f, -3.125397891e-04f, -1.742016828e-04f, -1.529460870e-05f, +1.454387449e-04f, +2.889379628e-04f, +3.991236794e-04f, +4.655589110e-04f, +4.849233000e-04f, +4.610375470e-04f, +4.035168325e-04f, +3.254391996e-04f, +2.406110065e-04f, +1.610529558e-04f, +9.521673594e-05f, +4.721513201e-05f, - /* 24, 2 */ -8.147924507e-05f, -1.430712350e-04f, -2.198265592e-04f, -3.043479843e-04f, -3.853766873e-04f, -4.493383067e-04f, -4.827146831e-04f, -4.747797448e-04f, -4.200908527e-04f, -3.201278616e-04f, -1.836320864e-04f, -2.548296987e-05f, +1.357085413e-04f, +2.808022583e-04f, +3.934446700e-04f, +4.627886263e-04f, +4.850529052e-04f, +4.636385032e-04f, +4.078592000e-04f, +3.306557574e-04f, +2.458678944e-04f, +1.656897170e-04f, +9.882966748e-05f, +4.967415993e-05f, - /* 24, 3 */ -7.822510242e-05f, -1.387241832e-04f, -2.147035314e-04f, -2.990350629e-04f, -3.806663042e-04f, -4.461048161e-04f, -4.817496625e-04f, -4.766215175e-04f, -4.248879309e-04f, -3.275711800e-04f, -1.929766610e-04f, -3.565926997e-05f, +1.259145254e-04f, +2.725379532e-04f, +3.875941701e-04f, +4.598320457e-04f, +4.850099279e-04f, +4.661040260e-04f, +4.121175966e-04f, +3.358432542e-04f, +2.511439643e-04f, +1.703799499e-04f, +1.025131319e-04f, +5.220438912e-05f, - /* 24, 4 */ -7.504350274e-05f, -1.344390595e-04f, -2.096144489e-04f, -2.937124231e-04f, -3.758927218e-04f, -4.427540852e-04f, -4.806236671e-04f, -4.782789577e-04f, -4.295045226e-04f, -3.348667971e-04f, -2.022311686e-04f, -4.581869630e-05f, +1.160612449e-04f, +2.641485480e-04f, +3.815740737e-04f, +4.566892339e-04f, +4.847927474e-04f, +4.684312656e-04f, +4.162885910e-04f, +3.409983591e-04f, +2.564365532e-04f, +1.751220037e-04f, +1.062665706e-04f, +5.480619333e-05f, - /* 24, 5 */ -7.193456522e-05f, -1.302170312e-04f, -2.045615590e-04f, -2.883831622e-04f, -3.710594077e-04f, -4.392893036e-04f, -4.793389263e-04f, -4.797527765e-04f, -4.339395286e-04f, -3.420118645e-04f, -2.113914331e-04f, -5.595644787e-05f, +1.061532886e-04f, +2.556376279e-04f, +3.753863858e-04f, +4.533603695e-04f, +4.843998374e-04f, +4.706174312e-04f, +4.203687678e-04f, +3.461177167e-04f, +2.617429433e-04f, +1.799141593e-04f, +1.100893595e-04f, +5.747989630e-05f, - /* 24, 6 */ -6.889834987e-05f, -1.260591965e-04f, -1.995470454e-04f, -2.830503358e-04f, -3.661698243e-04f, -4.357136989e-04f, -4.778977479e-04f, -4.810437916e-04f, -4.381919648e-04f, -3.490036345e-04f, -2.204533432e-04f, -6.606773875e-05f, +9.619528314e-05f, +2.470088608e-04f, +3.690332209e-04f, +4.498457452e-04f, +4.838297683e-04f, +4.726597937e-04f, +4.243547301e-04f, +3.511979487e-04f, +2.670603639e-04f, +1.847546294e-04f, +1.139808078e-04f, +6.022577049e-05f, - /* 24, 7 */ -6.593485851e-05f, -1.219665852e-04f, -1.945730275e-04f, -2.777169567e-04f, -3.612274261e-04f, -4.320305335e-04f, -4.763025159e-04f, -4.821529264e-04f, -4.422609626e-04f, -3.558394612e-04f, -2.294128549e-04f, -7.614780136e-05f, +8.619188981e-05f, +2.382659945e-04f, +3.625168024e-04f, +4.461457687e-04f, +4.830812085e-04f, +4.745556880e-04f, +4.282431024e-04f, +3.562356572e-04f, +2.723859925e-04f, +1.896415594e-04f, +1.179401580e-04f, +6.304403582e-05f, - /* 24, 8 */ -6.304403582e-05f, -1.179401580e-04f, -1.896415594e-04f, -2.723859925e-04f, -3.562356572e-04f, -4.282431024e-04f, -4.745556880e-04f, -4.830812085e-04f, -4.461457687e-04f, -3.625168024e-04f, -2.382659945e-04f, -8.619188981e-05f, +7.614780136e-05f, +2.294128549e-04f, +3.558394612e-04f, +4.422609626e-04f, +4.821529264e-04f, +4.763025159e-04f, +4.320305335e-04f, +3.612274261e-04f, +2.777169567e-04f, +1.945730275e-04f, +1.219665852e-04f, +6.593485851e-05f, - /* 24, 9 */ -6.022577049e-05f, -1.139808078e-04f, -1.847546294e-04f, -2.670603639e-04f, -3.511979487e-04f, -4.243547301e-04f, -4.726597937e-04f, -4.838297683e-04f, -4.498457452e-04f, -3.690332209e-04f, -2.470088608e-04f, -9.619528314e-05f, +6.606773875e-05f, +2.204533432e-04f, +3.490036345e-04f, +4.381919648e-04f, +4.810437916e-04f, +4.778977479e-04f, +4.357136989e-04f, +3.661698243e-04f, +2.830503358e-04f, +1.995470454e-04f, +1.260591965e-04f, +6.889834987e-05f, - /* 24,10 */ -5.747989630e-05f, -1.100893595e-04f, -1.799141593e-04f, -2.617429433e-04f, -3.461177167e-04f, -4.203687678e-04f, -4.706174312e-04f, -4.843998374e-04f, -4.533603695e-04f, -3.753863858e-04f, -2.556376279e-04f, -1.061532886e-04f, +5.595644787e-05f, +2.113914331e-04f, +3.420118645e-04f, +4.339395286e-04f, +4.797527765e-04f, +4.793389263e-04f, +4.392893036e-04f, +3.710594077e-04f, +2.883831622e-04f, +2.045615590e-04f, +1.302170312e-04f, +7.193456522e-05f, - /* 24,11 */ -5.480619333e-05f, -1.062665706e-04f, -1.751220037e-04f, -2.564365532e-04f, -3.409983591e-04f, -4.162885910e-04f, -4.684312656e-04f, -4.847927474e-04f, -4.566892339e-04f, -3.815740737e-04f, -2.641485480e-04f, -1.160612449e-04f, +4.581869630e-05f, +2.022311686e-04f, +3.348667971e-04f, +4.295045226e-04f, +4.782789577e-04f, +4.806236671e-04f, +4.427540852e-04f, +3.758927218e-04f, +2.937124231e-04f, +2.096144489e-04f, +1.344390595e-04f, +7.504350274e-05f, - /* 24,12 */ -5.220438912e-05f, -1.025131319e-04f, -1.703799499e-04f, -2.511439643e-04f, -3.358432542e-04f, -4.121175966e-04f, -4.661040260e-04f, -4.850099279e-04f, -4.598320457e-04f, -3.875941701e-04f, -2.725379532e-04f, -1.259145254e-04f, +3.565926997e-05f, +1.929766610e-04f, +3.275711800e-04f, +4.248879309e-04f, +4.766215175e-04f, +4.817496625e-04f, +4.461048161e-04f, +3.806663042e-04f, +2.990350629e-04f, +2.147035314e-04f, +1.387241832e-04f, +7.822510242e-05f, - /* 24,13 */ -4.967415993e-05f, -9.882966748e-05f, -1.656897170e-04f, -2.458678944e-04f, -3.306557574e-04f, -4.078592000e-04f, -4.636385032e-04f, -4.850529052e-04f, -4.627886263e-04f, -3.934446700e-04f, -2.808022583e-04f, -1.357085413e-04f, +2.548296987e-05f, +1.836320864e-04f, +3.201278616e-04f, +4.200908527e-04f, +4.747797448e-04f, +4.827146831e-04f, +4.493383067e-04f, +3.853766873e-04f, +3.043479843e-04f, +2.198265592e-04f, +1.430712350e-04f, +8.147924507e-05f, - /* 24,14 */ -4.721513201e-05f, -9.521673594e-05f, -1.610529558e-04f, -2.406110065e-04f, -3.254391996e-04f, -4.035168325e-04f, -4.610375470e-04f, -4.849233000e-04f, -4.655589110e-04f, -3.991236794e-04f, -2.889379628e-04f, -1.454387449e-04f, +1.529460870e-05f, +1.742016828e-04f, +3.125397891e-04f, +4.151145025e-04f, +4.727530367e-04f, +4.835165803e-04f, +4.524514078e-04f, +3.900204007e-04f, +3.096480504e-04f, +2.249812225e-04f, +1.474789784e-04f, +8.480575132e-05f, - /* 24,15 */ -4.482688286e-05f, -9.167483068e-05f, -1.564712483e-04f, -2.353759082e-04f, -3.201968846e-04f, -3.990939388e-04f, -4.583040637e-04f, -4.846228261e-04f, -4.681429482e-04f, -4.046294158e-04f, -2.969416536e-04f, -1.551006323e-04f, +5.099007530e-06f, +1.646897470e-04f, +3.048100066e-04f, +4.099602091e-04f, +4.705408991e-04f, +4.841532882e-04f, +4.554410135e-04f, +3.945939739e-04f, +3.149320871e-04f, +2.301651496e-04f, +1.519461079e-04f, +8.820438069e-05f, - /* 24, 0 */ +1.254177052e-04f, +1.432187562e-04f, +1.041598752e-04f, -1.135750248e-05f, -2.010663923e-04f, -4.345091125e-04f, -6.566280172e-04f, -8.018070806e-04f, -8.145094672e-04f, -6.693628869e-04f, -3.829411831e-04f, -1.208738944e-05f, +3.614691013e-04f, +6.551938988e-04f, +8.101126455e-04f, +8.069330100e-04f, +6.686285441e-04f, +4.493898115e-04f, +2.148422063e-04f, +2.121126661e-05f, -9.928779545e-05f, -1.427235715e-04f, -1.276505127e-04f, -8.319130160e-05f, - /* 24, 1 */ +1.230784715e-04f, +1.434886692e-04f, +1.087259386e-04f, -1.803144714e-06f, -1.874698746e-04f, -4.195879132e-04f, -6.443236569e-04f, -7.961535056e-04f, -8.182754723e-04f, -6.829663304e-04f, -4.040749814e-04f, -3.625133679e-05f, +3.396771574e-04f, +6.404692089e-04f, +8.050839212e-04f, +8.115205881e-04f, +6.803091718e-04f, +4.642140510e-04f, +2.287861157e-04f, +3.136033560e-05f, -9.410712043e-05f, -1.419963918e-04f, -1.297693532e-04f, -8.627587811e-05f, - /* 24, 2 */ +1.206403004e-04f, +1.435401825e-04f, +1.129889134e-04f, +7.448162127e-06f, -1.740634498e-04f, -4.046419937e-04f, -6.317316839e-04f, -7.899834729e-04f, -8.214124236e-04f, -6.959950382e-04f, -4.248524782e-04f, -6.038280262e-05f, +3.175841545e-04f, +6.251993025e-04f, +7.994228899e-04f, +8.155596091e-04f, +6.916540113e-04f, +4.789657110e-04f, +2.428865252e-04f, +4.180014906e-05f, -8.861563067e-05f, -1.410306561e-04f, -1.317666448e-04f, -8.934972901e-05f, - /* 24, 3 */ +1.181106179e-04f, +1.433803035e-04f, +1.169520657e-04f, +1.639322797e-05f, -1.608575022e-04f, -3.896869361e-04f, -6.188684520e-04f, -7.833086355e-04f, -8.239227539e-04f, -7.084404793e-04f, -4.452560799e-04f, -8.446017611e-05f, +2.952092559e-04f, +6.093952965e-04f, +7.931298338e-04f, +8.190403838e-04f, +7.026473724e-04f, +4.936285297e-04f, +2.571314547e-04f, +5.252568657e-05f, -8.281147599e-05f, -1.398199793e-04f, -1.336347757e-04f, -9.240689021e-05f, - /* 24, 4 */ +1.154967766e-04f, +1.430161614e-04f, +1.206189886e-04f, +2.502931407e-05f, -1.478619956e-04f, -3.747381071e-04f, -6.057504254e-04f, -7.761410928e-04f, -8.258095592e-04f, -7.202947906e-04f, -4.652686374e-04f, -1.084619116e-04f, +2.725719623e-04f, +5.930689291e-04f, +7.862057246e-04f, +8.219537553e-04f, +7.132737861e-04f, +5.081861235e-04f, +2.715085502e-04f, +6.353146713e-05f, -7.669318508e-05f, -1.383581653e-04f, -1.353661159e-04f, -9.544123411e-05f, - /* 24, 5 */ +1.128060463e-04f, +1.424549941e-04f, +1.239935912e-04f, +3.335412922e-05f, -1.350864661e-04f, -3.598106411e-04f, -5.923941571e-04f, -7.684933716e-04f, -8.270765907e-04f, -7.315507834e-04f, -4.848734661e-04f, -1.323665545e-04f, +2.496920884e-04f, +5.762325468e-04f, +7.786522269e-04f, +8.242911148e-04f, +7.235180256e-04f, +5.226220062e-04f, +2.860050947e-04f, +7.481154929e-05f, -7.025967465e-05f, -1.366392205e-04f, -1.369530289e-04f, -9.844647580e-05f, - /* 24, 6 */ +1.100456035e-04f, +1.417041346e-04f, +1.270800866e-04f, +4.136582536e-05f, -1.225400157e-04f, -3.449194225e-04f, -5.788162671e-04f, -7.603784078e-04f, -8.277282458e-04f, -7.422019493e-04f, -5.040543645e-04f, -1.561527673e-04f, +2.265897402e-04f, +5.588990922e-04f, +7.704716994e-04f, +8.260444163e-04f, +7.333651287e-04f, +5.369196097e-04f, +3.006080208e-04f, +8.635953200e-05f, -6.351025813e-05f, -1.346573670e-04f, -1.383878839e-04f, -1.014161798e-04f, - /* 24, 7 */ +1.072225228e-04f, +1.407709979e-04f, +1.298829797e-04f, +4.906299265e-05f, -1.102313067e-04f, -3.300790706e-04f, -5.650334202e-04f, -7.518095256e-04f, -8.277695590e-04f, -7.522424649e-04f, -5.227956327e-04f, -1.797993550e-04f, +2.032852905e-04f, +5.410820901e-04f, +7.616671958e-04f, +8.272061905e-04f, +7.428004186e-04f, +5.510623045e-04f, +3.153039229e-04f, +9.816855611e-05f, -5.644465382e-05f, -1.324070557e-04f, -1.396630677e-04f, -1.043437672e-04f, - /* 24, 8 */ +1.043437672e-04f, +1.396630677e-04f, +1.324070557e-04f, +5.644465382e-05f, -9.816855611e-05f, -3.153039229e-04f, -5.510623045e-04f, -7.428004186e-04f, -8.272061905e-04f, -7.616671958e-04f, -5.410820901e-04f, -2.032852905e-04f, +1.797993550e-04f, +5.227956327e-04f, +7.522424649e-04f, +8.277695590e-04f, +7.518095256e-04f, +5.650334202e-04f, +3.300790706e-04f, +1.102313067e-04f, -4.906299265e-05f, -1.298829797e-04f, -1.407709979e-04f, -1.072225228e-04f, - /* 24, 9 */ +1.014161798e-04f, +1.383878839e-04f, +1.346573670e-04f, +6.351025813e-05f, -8.635953200e-05f, -3.006080208e-04f, -5.369196097e-04f, -7.333651287e-04f, -8.260444163e-04f, -7.704716994e-04f, -5.588990922e-04f, -2.265897402e-04f, +1.561527673e-04f, +5.040543645e-04f, +7.422019493e-04f, +8.277282458e-04f, +7.603784078e-04f, +5.788162671e-04f, +3.449194225e-04f, +1.225400157e-04f, -4.136582536e-05f, -1.270800866e-04f, -1.417041346e-04f, -1.100456035e-04f, - /* 24,10 */ +9.844647580e-05f, +1.369530289e-04f, +1.366392205e-04f, +7.025967465e-05f, -7.481154929e-05f, -2.860050947e-04f, -5.226220062e-04f, -7.235180256e-04f, -8.242911148e-04f, -7.786522269e-04f, -5.762325468e-04f, -2.496920884e-04f, +1.323665545e-04f, +4.848734661e-04f, +7.315507834e-04f, +8.270765907e-04f, +7.684933716e-04f, +5.923941571e-04f, +3.598106411e-04f, +1.350864661e-04f, -3.335412922e-05f, -1.239935912e-04f, -1.424549941e-04f, -1.128060463e-04f, - /* 24,11 */ +9.544123411e-05f, +1.353661159e-04f, +1.383581653e-04f, +7.669318508e-05f, -6.353146713e-05f, -2.715085502e-04f, -5.081861235e-04f, -7.132737861e-04f, -8.219537553e-04f, -7.862057246e-04f, -5.930689291e-04f, -2.725719623e-04f, +1.084619116e-04f, +4.652686374e-04f, +7.202947906e-04f, +8.258095592e-04f, +7.761410928e-04f, +6.057504254e-04f, +3.747381071e-04f, +1.478619956e-04f, -2.502931407e-05f, -1.206189886e-04f, -1.430161614e-04f, -1.154967766e-04f, - /* 24,12 */ +9.240689021e-05f, +1.336347757e-04f, +1.398199793e-04f, +8.281147599e-05f, -5.252568657e-05f, -2.571314547e-04f, -4.936285297e-04f, -7.026473724e-04f, -8.190403838e-04f, -7.931298338e-04f, -6.093952965e-04f, -2.952092559e-04f, +8.446017611e-05f, +4.452560799e-04f, +7.084404793e-04f, +8.239227539e-04f, +7.833086355e-04f, +6.188684520e-04f, +3.896869361e-04f, +1.608575022e-04f, -1.639322797e-05f, -1.169520657e-04f, -1.433803035e-04f, -1.181106179e-04f, - /* 24,13 */ +8.934972901e-05f, +1.317666448e-04f, +1.410306561e-04f, +8.861563067e-05f, -4.180014906e-05f, -2.428865252e-04f, -4.789657110e-04f, -6.916540113e-04f, -8.155596091e-04f, -7.994228899e-04f, -6.251993025e-04f, -3.175841545e-04f, +6.038280262e-05f, +4.248524782e-04f, +6.959950382e-04f, +8.214124236e-04f, +7.899834729e-04f, +6.317316839e-04f, +4.046419937e-04f, +1.740634498e-04f, -7.448162127e-06f, -1.129889134e-04f, -1.435401825e-04f, -1.206403004e-04f, - /* 24,14 */ +8.627587811e-05f, +1.297693532e-04f, +1.419963918e-04f, +9.410712043e-05f, -3.136033560e-05f, -2.287861157e-04f, -4.642140510e-04f, -6.803091718e-04f, -8.115205881e-04f, -8.050839212e-04f, -6.404692089e-04f, -3.396771574e-04f, +3.625133679e-05f, +4.040749814e-04f, +6.829663304e-04f, +8.182754723e-04f, +7.961535056e-04f, +6.443236569e-04f, +4.195879132e-04f, +1.874698746e-04f, +1.803144714e-06f, -1.087259386e-04f, -1.434886692e-04f, -1.230784715e-04f, - /* 24,15 */ +8.319130160e-05f, +1.276505127e-04f, +1.427235715e-04f, +9.928779545e-05f, -2.121126661e-05f, -2.148422063e-04f, -4.493898115e-04f, -6.686285441e-04f, -8.069330100e-04f, -8.101126455e-04f, -6.551938988e-04f, -3.614691013e-04f, +1.208738944e-05f, +3.829411831e-04f, +6.693628869e-04f, +8.145094672e-04f, +8.018070806e-04f, +6.566280172e-04f, +4.345091125e-04f, +2.010663923e-04f, +1.135750248e-05f, -1.041598752e-04f, -1.432187562e-04f, -1.254177052e-04f, - /* 24, 0 */ +4.545052445e-05f, +1.951315810e-04f, +3.748938080e-04f, +4.809335107e-04f, +3.960765690e-04f, +5.993810822e-05f, -4.723795438e-04f, -1.024325735e-03f, -1.361247582e-03f, -1.299302728e-03f, -8.046117557e-04f, -2.606329026e-05f, +7.618428442e-04f, +1.280408741e-03f, +1.370322771e-03f, +1.054089829e-03f, +5.086432784e-04f, -3.113193898e-05f, -3.825195300e-04f, -4.822884412e-04f, -3.849609275e-04f, -2.063256631e-04f, -5.270037440e-05f, +2.454794639e-05f, - /* 24, 1 */ +3.852332445e-05f, +1.840753178e-04f, +3.645444067e-04f, +4.788140096e-04f, +4.086121277e-04f, +8.793526572e-05f, -4.362135407e-04f, -9.937048198e-04f, -1.350562575e-03f, -1.316442769e-03f, -8.462280606e-04f, -7.815185270e-05f, +7.179801999e-04f, +1.259777116e-03f, +1.377758125e-03f, +1.082939175e-03f, +5.449481703e-04f, -1.547839432e-06f, -3.679388598e-04f, -4.828529979e-04f, -3.947147844e-04f, -2.176372792e-04f, -6.026901850e-05f, +2.205234045e-05f, - /* 24, 2 */ +3.192167036e-05f, +1.731761778e-04f, +3.539434193e-04f, +4.759566352e-04f, +4.201302650e-04f, +1.150943789e-04f, -4.002008253e-04f, -9.622858103e-04f, -1.338300241e-03f, -1.331815598e-03f, -8.866349827e-04f, -1.301264311e-04f, +6.730846905e-04f, +1.237427186e-03f, +1.383526171e-03f, +1.110816763e-03f, +5.812367254e-04f, +2.878109064e-05f, -3.523343557e-04f, -4.826023474e-04f, -4.041241778e-04f, -2.290451863e-04f, -6.815162122e-05f, +1.926869283e-05f, - /* 24, 3 */ +2.564752013e-05f, +1.624524653e-04f, +3.431211940e-04f, +4.723889014e-04f, +4.306369033e-04f, +1.413884897e-04f, -3.643958409e-04f, -9.301281119e-04f, -1.324495465e-03f, -1.345410999e-03f, -9.257779427e-04f, -1.819112698e-04f, +6.272190697e-04f, +1.213381290e-03f, +1.387602061e-03f, +1.137666624e-03f, +6.174506312e-04f, +5.981976836e-05f, -3.357077999e-04f, -4.815127015e-04f, -4.131577529e-04f, -2.405272085e-04f, -7.634234963e-05f, +1.618998833e-05f, - /* 24, 4 */ +1.970191739e-05f, +1.519214683e-04f, +3.321076713e-04f, +4.681390617e-04f, +4.401397816e-04f, +1.667927354e-04f, -3.288518263e-04f, -8.972916878e-04f, -1.309185436e-03f, -1.357221809e-03f, -9.636046528e-04f, -2.334309635e-04f, +5.804478655e-04f, +1.187664745e-03f, +1.389963631e-03f, +1.163433942e-03f, +6.535308606e-04f, +9.153116784e-05f, -3.180629927e-04f, -4.795613921e-04f, -4.217840695e-04f, -2.520602653e-04f, -8.483435780e-05f, +1.280977164e-05f, - /* 24, 5 */ +1.408501704e-05f, +1.415994448e-04f, +3.209323254e-04f, +4.632360317e-04f, +4.486484045e-04f, +1.912843645e-04f, -2.936207276e-04f, -8.638369381e-04f, -1.292409564e-03f, -1.367243913e-03f, -1.000065207e-03f, -2.846105957e-04f, +5.328372638e-04f, +1.160305814e-03f, +1.390591463e-03f, +1.188065177e-03f, +6.894177793e-04f, +1.238763650e-04f, -2.994057812e-04f, -4.767269440e-04f, -4.299716716e-04f, -2.636204028e-04f, -9.361977359e-05f, +9.122184539e-06f, - /* 24, 6 */ +8.796112429e-06f, +1.315016126e-04f, +3.096241086e-04f, +4.577093118e-04f, +4.561739887e-04f, +2.148427485e-04f, -2.587531149e-04f, -8.298245798e-04f, -1.274209383e-03f, -1.375476234e-03f, -1.035112163e-03f, -3.353758773e-04f, +4.844549899e-04f, +1.131335665e-03f, +1.389468944e-03f, +1.211508174e-03f, +7.250512548e-04f, +1.568145870e-04f, -2.797440842e-04f, -4.729891466e-04f, -4.376891593e-04f, -2.751828281e-04f, -1.026896878e-04f, +5.122002376e-06f, - /* 24, 7 */ +3.833664119e-06f, +1.216421408e-04f, +2.982113984e-04f, +4.515889092e-04f, +4.627294060e-04f, +2.374493875e-04f, -2.242981012e-04f, -7.953155261e-04f, -1.254628457e-03f, -1.381920720e-03f, -1.068700627e-03f, -3.856532828e-04f, +4.353701854e-04f, +1.100788324e-03f, +1.386582316e-03f, +1.233712281e-03f, +7.603707678e-04f, +1.903032668e-04f, -2.590879129e-04f, -4.683291247e-04f, -4.449052614e-04f, -2.867219458e-04f, -1.120341455e-04f, +8.046698450e-07f, - /* 24, 8 */ -8.046698450e-07f, +1.120341455e-04f, +2.867219458e-04f, +4.449052614e-04f, +4.683291247e-04f, +2.590879129e-04f, -1.903032668e-04f, -7.603707678e-04f, -1.233712281e-03f, -1.386582316e-03f, -1.100788324e-03f, -4.353701854e-04f, +3.856532828e-04f, +1.068700627e-03f, +1.381920720e-03f, +1.254628457e-03f, +7.953155261e-04f, +2.242981012e-04f, -2.374493875e-04f, -4.627294060e-04f, -4.515889092e-04f, -2.982113984e-04f, -1.216421408e-04f, -3.833664119e-06f, - /* 24, 9 */ -5.122002376e-06f, +1.026896878e-04f, +2.751828281e-04f, +4.376891593e-04f, +4.729891466e-04f, +2.797440842e-04f, -1.568145870e-04f, -7.250512548e-04f, -1.211508174e-03f, -1.389468944e-03f, -1.131335665e-03f, -4.844549899e-04f, +3.353758773e-04f, +1.035112163e-03f, +1.375476234e-03f, +1.274209383e-03f, +8.298245798e-04f, +2.587531149e-04f, -2.148427485e-04f, -4.561739887e-04f, -4.577093118e-04f, -3.096241086e-04f, -1.315016126e-04f, -8.796112429e-06f, - /* 24,10 */ -9.122184539e-06f, +9.361977359e-05f, +2.636204028e-04f, +4.299716716e-04f, +4.767269440e-04f, +2.994057812e-04f, -1.238763650e-04f, -6.894177793e-04f, -1.188065177e-03f, -1.390591463e-03f, -1.160305814e-03f, -5.328372638e-04f, +2.846105957e-04f, +1.000065207e-03f, +1.367243913e-03f, +1.292409564e-03f, +8.638369381e-04f, +2.936207276e-04f, -1.912843645e-04f, -4.486484045e-04f, -4.632360317e-04f, -3.209323254e-04f, -1.415994448e-04f, -1.408501704e-05f, - /* 24,11 */ -1.280977164e-05f, +8.483435780e-05f, +2.520602653e-04f, +4.217840695e-04f, +4.795613921e-04f, +3.180629927e-04f, -9.153116784e-05f, -6.535308606e-04f, -1.163433942e-03f, -1.389963631e-03f, -1.187664745e-03f, -5.804478655e-04f, +2.334309635e-04f, +9.636046528e-04f, +1.357221809e-03f, +1.309185436e-03f, +8.972916878e-04f, +3.288518263e-04f, -1.667927354e-04f, -4.401397816e-04f, -4.681390617e-04f, -3.321076713e-04f, -1.519214683e-04f, -1.970191739e-05f, - /* 24,12 */ -1.618998833e-05f, +7.634234963e-05f, +2.405272085e-04f, +4.131577529e-04f, +4.815127015e-04f, +3.357077999e-04f, -5.981976836e-05f, -6.174506312e-04f, -1.137666624e-03f, -1.387602061e-03f, -1.213381290e-03f, -6.272190697e-04f, +1.819112698e-04f, +9.257779427e-04f, +1.345410999e-03f, +1.324495465e-03f, +9.301281119e-04f, +3.643958409e-04f, -1.413884897e-04f, -4.306369033e-04f, -4.723889014e-04f, -3.431211940e-04f, -1.624524653e-04f, -2.564752013e-05f, - /* 24,13 */ -1.926869283e-05f, +6.815162122e-05f, +2.290451863e-04f, +4.041241778e-04f, +4.826023474e-04f, +3.523343557e-04f, -2.878109064e-05f, -5.812367254e-04f, -1.110816763e-03f, -1.383526171e-03f, -1.237427186e-03f, -6.730846905e-04f, +1.301264311e-04f, +8.866349827e-04f, +1.331815598e-03f, +1.338300241e-03f, +9.622858103e-04f, +4.002008253e-04f, -1.150943789e-04f, -4.201302650e-04f, -4.759566352e-04f, -3.539434193e-04f, -1.731761778e-04f, -3.192167036e-05f, - /* 24,14 */ -2.205234045e-05f, +6.026901850e-05f, +2.176372792e-04f, +3.947147844e-04f, +4.828529979e-04f, +3.679388598e-04f, +1.547839432e-06f, -5.449481703e-04f, -1.082939175e-03f, -1.377758125e-03f, -1.259777116e-03f, -7.179801999e-04f, +7.815185270e-05f, +8.462280606e-04f, +1.316442769e-03f, +1.350562575e-03f, +9.937048198e-04f, +4.362135407e-04f, -8.793526572e-05f, -4.086121277e-04f, -4.788140096e-04f, -3.645444067e-04f, -1.840753178e-04f, -3.852332445e-05f, - /* 24,15 */ -2.454794639e-05f, +5.270037440e-05f, +2.063256631e-04f, +3.849609275e-04f, +4.822884412e-04f, +3.825195300e-04f, +3.113193898e-05f, -5.086432784e-04f, -1.054089829e-03f, -1.370322771e-03f, -1.280408741e-03f, -7.618428442e-04f, +2.606329026e-05f, +8.046117557e-04f, +1.299302728e-03f, +1.361247582e-03f, +1.024325735e-03f, +4.723795438e-04f, -5.993810822e-05f, -3.960765690e-04f, -4.809335107e-04f, -3.748938080e-04f, -1.951315810e-04f, -4.545052445e-05f, - /* 24, 0 */ -1.702250368e-04f, -1.965005420e-04f, +1.103795304e-06f, +4.330784212e-04f, +8.784555707e-04f, +9.653328276e-04f, +4.315509563e-04f, -6.109575553e-04f, -1.641723450e-03f, -2.015827225e-03f, -1.400787443e-03f, -4.702498413e-05f, +1.332047630e-03f, +2.006889303e-03f, +1.690240096e-03f, +6.826705419e-04f, -3.776686811e-04f, -9.512688743e-04f, -8.983149818e-04f, -4.640234647e-04f, -2.230828855e-05f, +1.918067822e-04f, +1.759255972e-04f, +6.786242515e-05f, - /* 24, 1 */ -1.642126010e-04f, -2.002752798e-04f, -1.910126829e-05f, +4.022439121e-04f, +8.571608722e-04f, +9.768399670e-04f, +4.832977173e-04f, -5.392469404e-04f, -1.590532482e-03f, -2.020693110e-03f, -1.466475318e-03f, -1.409702826e-04f, +1.260398022e-03f, +1.993868298e-03f, +1.735939471e-03f, +7.542164043e-04f, -3.217397652e-04f, -9.346209288e-04f, -9.166430096e-04f, -4.949934945e-04f, -4.448641826e-05f, +1.861665779e-04f, +1.812738819e-04f, +7.451957718e-05f, - /* 24, 2 */ -1.579281336e-04f, -2.031605347e-04f, -3.828516688e-05f, +3.716026326e-04f, +8.345286135e-04f, +9.858238344e-04f, +5.328272649e-04f, -4.677058239e-04f, -1.536815378e-03f, -2.021508037e-03f, -1.528977139e-03f, -2.346018520e-04f, +1.185988431e-03f, +1.976763286e-03f, +1.778684302e-03f, +8.254237228e-04f, -2.638601140e-04f, -9.153683790e-04f, -9.333455225e-04f, -5.259003096e-04f, -6.760829922e-05f, +1.795547962e-04f, +1.862290729e-04f, +8.132190552e-05f, - /* 24, 3 */ -1.514107898e-04f, -2.051877883e-04f, -5.643017558e-05f, +3.412342375e-04f, +8.106578209e-04f, +9.923241157e-04f, +5.800651921e-04f, -3.964985305e-04f, -1.480725107e-03f, -2.018303000e-03f, -1.588167145e-03f, -3.277114722e-04f, +1.108975953e-03f, +1.955583535e-03f, +1.818343426e-03f, +8.961196099e-04f, -2.041325004e-04f, -8.934973649e-04f, -9.483306864e-04f, -5.566532714e-04f, -9.163993343e-05f, +1.719487619e-04f, +1.907500791e-04f, +8.824611727e-05f, - /* 24, 4 */ -1.446989102e-04f, -2.063902871e-04f, -7.352252002e-05f, +3.112151687e-04f, +7.856484910e-04f, +9.963864071e-04f, +6.249444785e-04f, -3.257861630e-04f, -1.422418959e-03f, -2.011118755e-03f, -1.643928243e-03f, -4.200923193e-04f, +1.029524574e-03f, +1.930348530e-03f, +1.854792197e-03f, +9.661301752e-04f, -1.426663759e-04f, -8.690009463e-04f, -9.615092978e-04f, -5.871595310e-04f, -1.165432034e-04f, +1.633284218e-04f, +1.947956873e-04f, +9.526723781e-05f, - /* 24, 5 */ -1.378299032e-04f, -2.068028652e-04f, -8.955230425e-05f, +2.816184974e-04f, +7.596012646e-04f, +9.980619660e-04f, +6.674055614e-04f, -2.557261963e-04f, -1.362058071e-03f, -2.000005648e-03f, -1.696152289e-03f, -5.115395181e-04f, +9.478047386e-04f, +1.901087985e-03f, +1.887912892e-03f, +1.035280999e-03f, -7.957765930e-05f, -8.418792522e-04f, -9.727951144e-04f, -6.173242692e-04f, -1.422758795e-04f, +1.536765045e-04f, +1.983247179e-04f, +1.023586489e-04f, - /* 24, 6 */ -1.308401336e-04f, -2.064617646e-04f, -1.045134271e-04f, +2.525137807e-04f, +7.326171060e-04f, +9.974074494e-04f, +7.073963828e-04f, -1.864720875e-04f, -1.299806951e-03f, -1.985023411e-03f, -1.744740344e-03f, -6.018506887e-04f, +8.639929140e-04f, +1.867841815e-03f, +1.917595086e-03f, +1.103397612e-03f, -1.498850339e-05f, -8.121396097e-04f, -9.821051828e-04f, -6.470509490e-04f, -1.687916421e-04f, +1.429786744e-04f, +2.012961856e-04f, +1.094921351e-04f, - /* 24, 7 */ -1.237648199e-04f, -2.054044567e-04f, -1.184034872e-04f, +2.239669341e-04f, +7.047969872e-04f, +9.944846402e-04f, +7.448724134e-04f, -1.181729029e-04f, -1.235832990e-03f, -1.966240936e-03f, -1.789602898e-03f, -6.908264855e-04f, +7.782711267e-04f, +1.830660078e-03f, +1.943736019e-03f, +1.170305979e-03f, +5.097296116e-05f, -7.797966533e-04f, -9.893601617e-04f, -6.762415789e-04f, -1.960401183e-04f, +1.312236785e-04f, +2.036694644e-04f, +1.166379381e-04f, - /* 24, 8 */ -1.166379381e-04f, -2.036694644e-04f, -1.312236785e-04f, +1.960401183e-04f, +6.762415789e-04f, +9.893601617e-04f, +7.797966533e-04f, -5.097296116e-05f, -1.170305979e-03f, -1.943736019e-03f, -1.830660078e-03f, -7.782711267e-04f, +6.908264855e-04f, +1.789602898e-03f, +1.966240936e-03f, +1.235832990e-03f, +1.181729029e-04f, -7.448724134e-04f, -9.944846402e-04f, -7.047969872e-04f, -2.239669341e-04f, +1.184034872e-04f, +2.054044567e-04f, +1.237648199e-04f, - /* 24, 9 */ -1.094921351e-04f, -2.012961856e-04f, -1.429786744e-04f, +1.687916421e-04f, +6.470509490e-04f, +9.821051828e-04f, +8.121396097e-04f, +1.498850339e-05f, -1.103397612e-03f, -1.917595086e-03f, -1.867841815e-03f, -8.639929140e-04f, +6.018506887e-04f, +1.744740344e-03f, +1.985023411e-03f, +1.299806951e-03f, +1.864720875e-04f, -7.073963828e-04f, -9.974074494e-04f, -7.326171060e-04f, -2.525137807e-04f, +1.045134271e-04f, +2.064617646e-04f, +1.308401336e-04f, - /* 24,10 */ -1.023586489e-04f, -1.983247179e-04f, -1.536765045e-04f, +1.422758795e-04f, +6.173242692e-04f, +9.727951144e-04f, +8.418792522e-04f, +7.957765930e-05f, -1.035280999e-03f, -1.887912892e-03f, -1.901087985e-03f, -9.478047386e-04f, +5.115395181e-04f, +1.696152289e-03f, +2.000005648e-03f, +1.362058071e-03f, +2.557261963e-04f, -6.674055614e-04f, -9.980619660e-04f, -7.596012646e-04f, -2.816184974e-04f, +8.955230425e-05f, +2.068028652e-04f, +1.378299032e-04f, - /* 24,11 */ -9.526723781e-05f, -1.947956873e-04f, -1.633284218e-04f, +1.165432034e-04f, +5.871595310e-04f, +9.615092978e-04f, +8.690009463e-04f, +1.426663759e-04f, -9.661301752e-04f, -1.854792197e-03f, -1.930348530e-03f, -1.029524574e-03f, +4.200923193e-04f, +1.643928243e-03f, +2.011118755e-03f, +1.422418959e-03f, +3.257861630e-04f, -6.249444785e-04f, -9.963864071e-04f, -7.856484910e-04f, -3.112151687e-04f, +7.352252002e-05f, +2.063902871e-04f, +1.446989102e-04f, - /* 24,12 */ -8.824611727e-05f, -1.907500791e-04f, -1.719487619e-04f, +9.163993343e-05f, +5.566532714e-04f, +9.483306864e-04f, +8.934973649e-04f, +2.041325004e-04f, -8.961196099e-04f, -1.818343426e-03f, -1.955583535e-03f, -1.108975953e-03f, +3.277114722e-04f, +1.588167145e-03f, +2.018303000e-03f, +1.480725107e-03f, +3.964985305e-04f, -5.800651921e-04f, -9.923241157e-04f, -8.106578209e-04f, -3.412342375e-04f, +5.643017558e-05f, +2.051877883e-04f, +1.514107898e-04f, - /* 24,13 */ -8.132190552e-05f, -1.862290729e-04f, -1.795547962e-04f, +6.760829922e-05f, +5.259003096e-04f, +9.333455225e-04f, +9.153683790e-04f, +2.638601140e-04f, -8.254237228e-04f, -1.778684302e-03f, -1.976763286e-03f, -1.185988431e-03f, +2.346018520e-04f, +1.528977139e-03f, +2.021508037e-03f, +1.536815378e-03f, +4.677058239e-04f, -5.328272649e-04f, -9.858238344e-04f, -8.345286135e-04f, -3.716026326e-04f, +3.828516688e-05f, +2.031605347e-04f, +1.579281336e-04f, - /* 24,14 */ -7.451957718e-05f, -1.812738819e-04f, -1.861665779e-04f, +4.448641826e-05f, +4.949934945e-04f, +9.166430096e-04f, +9.346209288e-04f, +3.217397652e-04f, -7.542164043e-04f, -1.735939471e-03f, -1.993868298e-03f, -1.260398022e-03f, +1.409702826e-04f, +1.466475318e-03f, +2.020693110e-03f, +1.590532482e-03f, +5.392469404e-04f, -4.832977173e-04f, -9.768399670e-04f, -8.571608722e-04f, -4.022439121e-04f, +1.910126829e-05f, +2.002752798e-04f, +1.642126010e-04f, - /* 24,15 */ -6.786242515e-05f, -1.759255972e-04f, -1.918067822e-04f, +2.230828855e-05f, +4.640234647e-04f, +8.983149818e-04f, +9.512688743e-04f, +3.776686811e-04f, -6.826705419e-04f, -1.690240096e-03f, -2.006889303e-03f, -1.332047630e-03f, +4.702498413e-05f, +1.400787443e-03f, +2.015827225e-03f, +1.641723450e-03f, +6.109575553e-04f, -4.315509563e-04f, -9.653328276e-04f, -8.784555707e-04f, -4.330784212e-04f, -1.103795304e-06f, +1.965005420e-04f, +1.702250368e-04f, - /* 24, 0 */ +3.919255962e-05f, -2.280943782e-04f, -5.361345988e-04f, -4.457457641e-04f, +2.990589649e-04f, +1.295797675e-03f, +1.605517166e-03f, +5.875816565e-04f, -1.289084098e-03f, -2.596166105e-03f, -2.129939921e-03f, -7.496988250e-05f, +2.037180601e-03f, +2.625542335e-03f, +1.404160874e-03f, -4.837783526e-04f, -1.582480410e-03f, -1.345619201e-03f, -3.621830939e-04f, +4.180945199e-04f, +5.469818219e-04f, +2.499414065e-04f, -2.888372260e-05f, -8.895700627e-05f, - /* 24, 1 */ +4.853777483e-05f, -2.065137544e-04f, -5.236754574e-04f, -4.705972357e-04f, +2.371311675e-04f, +1.243196859e-03f, +1.622959247e-03f, +6.876650067e-04f, -1.171710060e-03f, -2.559351067e-03f, -2.215991331e-03f, -2.246678327e-04f, +1.937986318e-03f, +2.647321756e-03f, +1.516528605e-03f, -3.765445934e-04f, -1.553807591e-03f, -1.392405213e-03f, -4.263006320e-04f, +3.876486968e-04f, +5.560961676e-04f, +2.719611444e-04f, -1.761075235e-05f, -9.068976925e-05f, - /* 24, 2 */ +5.692498928e-05f, -1.852878923e-04f, -5.097279107e-04f, -4.926555685e-04f, +1.765921503e-04f, +1.188077447e-03f, +1.634867875e-03f, +7.837567953e-04f, -1.052453928e-03f, -2.515280079e-03f, -2.295086316e-03f, -3.736412373e-04f, +1.832653524e-03f, +2.661371990e-03f, +1.625780509e-03f, -2.661868955e-04f, -1.519477670e-03f, -1.435905115e-03f, -4.911987788e-04f, +3.544256494e-04f, +5.633598944e-04f, +2.940548284e-04f, -5.378471232e-06f, -9.187426948e-05f, - /* 24, 3 */ +6.436469025e-05f, -1.644995777e-04f, -4.944173708e-04f, -5.119388451e-04f, +1.176233517e-04f, +1.130703462e-03f, +1.641323506e-03f, +8.756040923e-04f, -9.317326579e-04f, -2.464159993e-03f, -2.367001633e-03f, -5.214100591e-04f, +1.721501142e-03f, +2.667586958e-03f, +1.731516399e-03f, -1.530278412e-04f, -1.479490407e-03f, -1.475875084e-03f, -5.566555092e-04f, +3.184551797e-04f, +5.686591450e-04f, +3.161189305e-04f, +7.802761507e-06f, -9.246489856e-05f, - /* 24, 4 */ +7.087197068e-05f, -1.442258278e-04f, -4.778705046e-04f, -5.284761768e-04f, +6.039472401e-05f, +1.071341110e-03f, +1.642425167e-03f, +9.629733481e-04f, -8.099633882e-04f, -2.406220702e-03f, -2.431540042e-03f, -6.674987371e-04f, +1.604869446e-03f, +2.665887444e-03f, +1.833344283e-03f, -3.740504807e-05f, -1.433866725e-03f, -1.512079220e-03f, -6.224402836e-04f, +2.797797731e-04f, +5.718846156e-04f, +3.380454975e-04f, +2.191686946e-05f, -9.241721523e-05f, - /* 24, 5 */ +7.646625331e-05f, -1.245377292e-04f, -4.602146020e-04f, -5.423072437e-04f, +5.064318866e-06f, +1.010257658e-03f, +1.638289725e-03f, +1.045651008e-03f, -6.875618648e-04f, -2.341714107e-03f, -2.488530931e-03f, -8.114379517e-04f, +1.483118851e-03f, +2.656221571e-03f, +1.930881931e-03f, +8.032993590e-05f, -1.382648990e-03f, -1.544290670e-03f, -6.883148110e-04f, +2.384547825e-04f, +5.729322223e-04f, +3.597225244e-04f, +3.694190340e-05f, -9.168826568e-05f, - /* 24, 6 */ +8.117100143e-05f, -1.055003114e-04f, -4.415769617e-04f, -5.534817998e-04f, -4.822206513e-05f, +9.477203224e-04f, +1.629051096e-03f, +1.123444034e-03f, -5.649408783e-04f, -2.270913001e-03f, -2.537830838e-03f, -9.527663633e-04f, +1.356628624e-03f, +2.638565156e-03f, +2.023758423e-03f, +1.998128074e-04f, -1.325901212e-03f, -1.572292748e-03f, -7.540338642e-04f, +1.945485578e-04f, +5.717037624e-04f, +3.810343609e-04f, +5.284991195e-05f, -9.023690790e-05f, - /* 24, 7 */ +8.501341847e-05f, -8.717245610e-05f, -4.220842946e-04f, -5.620591450e-04f, -9.933117260e-05f, +8.839951872e-04f, +1.614859393e-03f, +1.196180345e-03f, -4.425087329e-04f, -2.194109877e-03f, -2.579323863e-03f, -1.091032318e-03f, +1.225795515e-03f, +2.612921966e-03f, +2.111615667e-03f, +3.206677492e-04f, -1.263709151e-03f, -1.595880025e-03f, -8.193461436e-04f, +1.481425192e-04f, +5.681075679e-04f, +4.018621494e-04f, +6.960683992e-05f, -8.802413824e-05f, - /* 24, 8 */ +8.802413824e-05f, -6.960683992e-05f, -4.018621494e-04f, -5.681075679e-04f, -1.481425192e-04f, +8.193461436e-04f, +1.595880025e-03f, +1.263709151e-03f, -3.206677492e-04f, -2.111615667e-03f, -2.612921966e-03f, -1.225795515e-03f, +1.091032318e-03f, +2.579323863e-03f, +2.194109877e-03f, +4.425087329e-04f, -1.196180345e-03f, -1.614859393e-03f, -8.839951872e-04f, +9.933117260e-05f, +5.620591450e-04f, +4.220842946e-04f, +8.717245610e-05f, -8.501341847e-05f, - /* 24, 9 */ +9.023690790e-05f, -5.284991195e-05f, -3.810343609e-04f, -5.717037624e-04f, -1.945485578e-04f, +7.540338642e-04f, +1.572292748e-03f, +1.325901212e-03f, -1.998128074e-04f, -2.023758423e-03f, -2.638565156e-03f, -1.356628624e-03f, +9.527663633e-04f, +2.537830838e-03f, +2.270913001e-03f, +5.649408783e-04f, -1.123444034e-03f, -1.629051096e-03f, -9.477203224e-04f, +4.822206513e-05f, +5.534817998e-04f, +4.415769617e-04f, +1.055003114e-04f, -8.117100143e-05f, - /* 24,10 */ +9.168826568e-05f, -3.694190340e-05f, -3.597225244e-04f, -5.729322223e-04f, -2.384547825e-04f, +6.883148110e-04f, +1.544290670e-03f, +1.382648990e-03f, -8.032993590e-05f, -1.930881931e-03f, -2.656221571e-03f, -1.483118851e-03f, +8.114379517e-04f, +2.488530931e-03f, +2.341714107e-03f, +6.875618648e-04f, -1.045651008e-03f, -1.638289725e-03f, -1.010257658e-03f, -5.064318866e-06f, +5.423072437e-04f, +4.602146020e-04f, +1.245377292e-04f, -7.646625331e-05f, - /* 24,11 */ +9.241721523e-05f, -2.191686946e-05f, -3.380454975e-04f, -5.718846156e-04f, -2.797797731e-04f, +6.224402836e-04f, +1.512079220e-03f, +1.433866725e-03f, +3.740504807e-05f, -1.833344283e-03f, -2.665887444e-03f, -1.604869446e-03f, +6.674987371e-04f, +2.431540042e-03f, +2.406220702e-03f, +8.099633882e-04f, -9.629733481e-04f, -1.642425167e-03f, -1.071341110e-03f, -6.039472401e-05f, +5.284761768e-04f, +4.778705046e-04f, +1.442258278e-04f, -7.087197068e-05f, - /* 24,12 */ +9.246489856e-05f, -7.802761507e-06f, -3.161189305e-04f, -5.686591450e-04f, -3.184551797e-04f, +5.566555092e-04f, +1.475875084e-03f, +1.479490407e-03f, +1.530278412e-04f, -1.731516399e-03f, -2.667586958e-03f, -1.721501142e-03f, +5.214100591e-04f, +2.367001633e-03f, +2.464159993e-03f, +9.317326579e-04f, -8.756040923e-04f, -1.641323506e-03f, -1.130703462e-03f, -1.176233517e-04f, +5.119388451e-04f, +4.944173708e-04f, +1.644995777e-04f, -6.436469025e-05f, - /* 24,13 */ +9.187426948e-05f, +5.378471232e-06f, -2.940548284e-04f, -5.633598944e-04f, -3.544256494e-04f, +4.911987788e-04f, +1.435905115e-03f, +1.519477670e-03f, +2.661868955e-04f, -1.625780509e-03f, -2.661371990e-03f, -1.832653524e-03f, +3.736412373e-04f, +2.295086316e-03f, +2.515280079e-03f, +1.052453928e-03f, -7.837567953e-04f, -1.634867875e-03f, -1.188077447e-03f, -1.765921503e-04f, +4.926555685e-04f, +5.097279107e-04f, +1.852878923e-04f, -5.692498928e-05f, - /* 24,14 */ +9.068976925e-05f, +1.761075235e-05f, -2.719611444e-04f, -5.560961676e-04f, -3.876486968e-04f, +4.263006320e-04f, +1.392405213e-03f, +1.553807591e-03f, +3.765445934e-04f, -1.516528605e-03f, -2.647321756e-03f, -1.937986318e-03f, +2.246678327e-04f, +2.215991331e-03f, +2.559351067e-03f, +1.171710060e-03f, -6.876650067e-04f, -1.622959247e-03f, -1.243196859e-03f, -2.371311675e-04f, +4.705972357e-04f, +5.236754574e-04f, +2.065137544e-04f, -4.853777483e-05f, - /* 24,15 */ +8.895700627e-05f, +2.888372260e-05f, -2.499414065e-04f, -5.469818219e-04f, -4.180945199e-04f, +3.621830939e-04f, +1.345619201e-03f, +1.582480410e-03f, +4.837783526e-04f, -1.404160874e-03f, -2.625542335e-03f, -2.037180601e-03f, +7.496988250e-05f, +2.129939921e-03f, +2.596166105e-03f, +1.289084098e-03f, -5.875816565e-04f, -1.605517166e-03f, -1.295797675e-03f, -2.990589649e-04f, +4.457457641e-04f, +5.361345988e-04f, +2.280943782e-04f, -3.919255962e-05f, - /* 24, 0 */ +1.848082291e-04f, +3.126544607e-04f, -8.381805218e-05f, -8.698090905e-04f, -1.028447094e-03f, +2.139154673e-04f, +1.954115341e-03f, +2.095678120e-03f, -1.635717275e-04f, -2.819157299e-03f, -2.940044791e-03f, -1.098945345e-04f, +2.833179926e-03f, +2.923929522e-03f, +3.511165299e-04f, -2.017938339e-03f, -2.030476715e-03f, -3.277888569e-04f, +9.926761418e-04f, +9.110442493e-04f, +1.284872781e-04f, -3.065935448e-04f, -1.998565163e-04f, +7.803305534e-06f, - /* 24, 1 */ +1.695814378e-04f, +3.164556508e-04f, -4.103650150e-05f, -8.260698464e-04f, -1.058100498e-03f, +1.024893805e-04f, +1.871044125e-03f, +2.162944507e-03f, +2.203366063e-05f, -2.703524226e-03f, -3.034115138e-03f, -3.291928088e-04f, +2.713944640e-03f, +3.017272284e-03f, +5.397663057e-04f, -1.929900383e-03f, -2.099607997e-03f, -4.436146208e-04f, +9.507629285e-04f, +9.494468230e-04f, +1.748714247e-04f, -2.981837386e-04f, -2.146007649e-04f, -5.699432396e-07f, - /* 24, 2 */ +1.542962580e-04f, +3.180964801e-04f, -2.971107404e-07f, -7.801571616e-04f, -1.081692695e-03f, -6.019646704e-06f, +1.781805749e-03f, +2.219616197e-03f, +2.048848004e-04f, -2.577645910e-03f, -3.115029215e-03f, -5.470211463e-04f, +2.582823494e-03f, +3.098667200e-03f, +7.286710477e-04f, -1.831793311e-03f, -2.161014579e-03f, -5.608747689e-04f, +9.027154107e-04f, +9.846924856e-04f, +2.227798586e-04f, -2.873471247e-04f, -2.289106872e-04f, -9.773337074e-06f, - /* 24, 3 */ +1.390667857e-04f, +3.176854393e-04f, +3.826416878e-05f, -7.324018434e-04f, -1.099310451e-03f, -1.111689527e-04f, +1.686962051e-03f, +2.265625589e-03f, +3.841903571e-04f, -2.442181508e-03f, -3.182489175e-03f, -7.624077328e-04f, +2.440359294e-03f, +3.167649091e-03f, +9.169693475e-04f, -1.723899657e-03f, -2.214230624e-03f, -6.790305367e-04f, +8.485750922e-04f, +1.016463150e-03f, +2.720045869e-04f, -2.740180422e-04f, -2.426519708e-04f, -1.978701792e-05f, - /* 24, 4 */ +1.240005643e-04f, +3.153390489e-04f, +7.453005747e-05f, -6.831329371e-04f, -1.111069621e-03f, -2.125447010e-04f, +1.587090707e-03f, +2.300958285e-03f, +5.591862212e-04f, -2.297830066e-03f, -3.236262287e-03f, -9.743929228e-04f, +2.287150577e-03f, +3.223808711e-03f, +1.103792665e-03f, -1.606554759e-03f, -2.258822083e-03f, -7.975248409e-04f, +7.884177261e-04f, +1.044449054e-03f, +3.223209063e-04f, -2.581440514e-04f, -2.556870681e-04f, -3.058317705e-05f, - /* 24, 5 */ +1.091981202e-04f, +3.111807515e-04f, +1.084019636e-04f, -6.326758693e-04f, -1.117113666e-03f, -3.097634105e-04f, +1.482781879e-03f, +2.325652312e-03f, +7.291390495e-04f, -2.145326692e-03f, -3.276181809e-03f, -1.182034015e-03f, +2.123848782e-03f, +3.266795190e-03f, +1.288269679e-03f, -1.480145805e-03f, -2.294389599e-03f, -9.157848908e-04f, +7.223538352e-04f, +1.068350860e-03f, +3.734881809e-04f, -2.396868442e-04f, -2.678760406e-04f, -4.212586861e-05f, - /* 24, 6 */ +9.475256757e-05f, +3.053397988e-04f, +1.397998805e-04f, -5.813506695e-04f, -1.117612060e-03f, -4.024732802e-04f, +1.374634870e-03f, +2.339797075e-03f, +8.933496022e-04f, -1.985438555e-03f, -3.302147511e-03f, -1.384409934e-03f, +1.951155148e-03f, +3.296318191e-03f, +1.469530695e-03f, -1.345110577e-03f, -2.320571262e-03f, -1.033224945e-03f, +6.505290403e-04f, +1.087881752e-03f, +4.252507475e-04f, -2.186230940e-04f, -2.790774568e-04f, -5.437087857e-05f, - /* 24, 7 */ +8.074928352e-05f, +2.979501429e-04f, +1.686621699e-04f, -5.294702777e-04f, -1.112758583e-03f, -4.903553074e-04f, +1.263254779e-03f, +2.343532047e-03f, +1.051155860e-03f, -1.818960757e-03f, -3.314125843e-03f, -1.580625796e-03f, +1.769817333e-03f, +3.312149758e-03f, +1.646712089e-03f, -1.201935910e-03f, -2.337045209e-03f, -1.149249197e-03f, +5.731241934e-04f, +1.102769514e-03f, +4.773389469e-04f, -1.949452358e-04f, -2.891493374e-04f, -6.726565227e-05f, - /* 24, 8 */ +6.726565227e-05f, +2.891493374e-04f, +1.949452358e-04f, -4.773389469e-04f, -1.102769514e-03f, -5.731241934e-04f, +1.149249197e-03f, +2.337045209e-03f, +1.201935910e-03f, -1.646712089e-03f, -3.312149758e-03f, -1.769817333e-03f, +1.580625796e-03f, +3.314125843e-03f, +1.818960757e-03f, -1.051155860e-03f, -2.343532047e-03f, -1.263254779e-03f, +4.903553074e-04f, +1.112758583e-03f, +5.294702777e-04f, -1.686621699e-04f, -2.979501429e-04f, -8.074928352e-05f, - /* 24, 9 */ +5.437087857e-05f, +2.790774568e-04f, +2.186230940e-04f, -4.252507475e-04f, -1.087881752e-03f, -6.505290403e-04f, +1.033224945e-03f, +2.320571262e-03f, +1.345110577e-03f, -1.469530695e-03f, -3.296318191e-03f, -1.951155148e-03f, +1.384409934e-03f, +3.302147511e-03f, +1.985438555e-03f, -8.933496022e-04f, -2.339797075e-03f, -1.374634870e-03f, +4.024732802e-04f, +1.117612060e-03f, +5.813506695e-04f, -1.397998805e-04f, -3.053397988e-04f, -9.475256757e-05f, - /* 24,10 */ +4.212586861e-05f, +2.678760406e-04f, +2.396868442e-04f, -3.734881809e-04f, -1.068350860e-03f, -7.223538352e-04f, +9.157848908e-04f, +2.294389599e-03f, +1.480145805e-03f, -1.288269679e-03f, -3.266795190e-03f, -2.123848782e-03f, +1.182034015e-03f, +3.276181809e-03f, +2.145326692e-03f, -7.291390495e-04f, -2.325652312e-03f, -1.482781879e-03f, +3.097634105e-04f, +1.117113666e-03f, +6.326758693e-04f, -1.084019636e-04f, -3.111807515e-04f, -1.091981202e-04f, - /* 24,11 */ +3.058317705e-05f, +2.556870681e-04f, +2.581440514e-04f, -3.223209063e-04f, -1.044449054e-03f, -7.884177261e-04f, +7.975248409e-04f, +2.258822083e-03f, +1.606554759e-03f, -1.103792665e-03f, -3.223808711e-03f, -2.287150577e-03f, +9.743929228e-04f, +3.236262287e-03f, +2.297830066e-03f, -5.591862212e-04f, -2.300958285e-03f, -1.587090707e-03f, +2.125447010e-04f, +1.111069621e-03f, +6.831329371e-04f, -7.453005747e-05f, -3.153390489e-04f, -1.240005643e-04f, - /* 24,12 */ +1.978701792e-05f, +2.426519708e-04f, +2.740180422e-04f, -2.720045869e-04f, -1.016463150e-03f, -8.485750922e-04f, +6.790305367e-04f, +2.214230624e-03f, +1.723899657e-03f, -9.169693475e-04f, -3.167649091e-03f, -2.440359294e-03f, +7.624077328e-04f, +3.182489175e-03f, +2.442181508e-03f, -3.841903571e-04f, -2.265625589e-03f, -1.686962051e-03f, +1.111689527e-04f, +1.099310451e-03f, +7.324018434e-04f, -3.826416878e-05f, -3.176854393e-04f, -1.390667857e-04f, - /* 24,13 */ +9.773337074e-06f, +2.289106872e-04f, +2.873471247e-04f, -2.227798586e-04f, -9.846924856e-04f, -9.027154107e-04f, +5.608747689e-04f, +2.161014579e-03f, +1.831793311e-03f, -7.286710477e-04f, -3.098667200e-03f, -2.582823494e-03f, +5.470211463e-04f, +3.115029215e-03f, +2.577645910e-03f, -2.048848004e-04f, -2.219616197e-03f, -1.781805749e-03f, +6.019646704e-06f, +1.081692695e-03f, +7.801571616e-04f, +2.971107404e-07f, -3.180964801e-04f, -1.542962580e-04f, - /* 24,14 */ +5.699432396e-07f, +2.146007649e-04f, +2.981837386e-04f, -1.748714247e-04f, -9.494468230e-04f, -9.507629285e-04f, +4.436146208e-04f, +2.099607997e-03f, +1.929900383e-03f, -5.397663057e-04f, -3.017272284e-03f, -2.713944640e-03f, +3.291928088e-04f, +3.034115138e-03f, +2.703524226e-03f, -2.203366063e-05f, -2.162944507e-03f, -1.871044125e-03f, -1.024893805e-04f, +1.058100498e-03f, +8.260698464e-04f, +4.103650150e-05f, -3.164556508e-04f, -1.695814378e-04f, - /* 24,15 */ -7.803305534e-06f, +1.998565163e-04f, +3.065935448e-04f, -1.284872781e-04f, -9.110442493e-04f, -9.926761418e-04f, +3.277888569e-04f, +2.030476715e-03f, +2.017938339e-03f, -3.511165299e-04f, -2.923929522e-03f, -2.833179926e-03f, +1.098945345e-04f, +2.940044791e-03f, +2.819157299e-03f, +1.635717275e-04f, -2.095678120e-03f, -1.954115341e-03f, -2.139154673e-04f, +1.028447094e-03f, +8.698090905e-04f, +8.381805218e-05f, -3.126544607e-04f, -1.848082291e-04f, - /* 24, 0 */ -1.364396009e-04f, -7.446376994e-05f, +5.066257662e-04f, +2.030015760e-04f, -9.054261715e-04f, -1.195525937e-03f, +4.683850093e-04f, +2.213825561e-03f, +1.188944940e-03f, -1.856378227e-03f, -2.833970964e-03f, -1.144377463e-04f, +2.758138339e-03f, +2.020697482e-03f, -1.023174933e-03f, -2.248631080e-03f, -6.097868283e-04f, +1.146194663e-03f, +9.693248739e-04f, -1.479047908e-04f, -5.177782008e-04f, -1.250536964e-04f, +1.414906982e-04f, +2.710774794e-05f, - /* 24, 1 */ -1.307026563e-04f, -8.975162518e-05f, +4.924131238e-04f, +2.542107757e-04f, -8.382130226e-04f, -1.235986710e-03f, +3.277877666e-04f, +2.166758574e-03f, +1.345406789e-03f, -1.683014413e-03f, -2.893234801e-03f, -3.426248829e-04f, +2.666119545e-03f, +2.174888063e-03f, -8.489895579e-04f, -2.270723567e-03f, -7.511023835e-04f, +1.088054225e-03f, +1.029345157e-03f, -8.915647260e-05f, -5.256253050e-04f, -1.535492882e-04f, +1.457592711e-04f, +3.374854096e-05f, - /* 24, 2 */ -1.243758393e-04f, -1.032931784e-04f, +4.753985127e-04f, +3.013338450e-04f, -7.682542954e-04f, -1.267577330e-03f, +1.888607322e-04f, +2.107952975e-03f, +1.491738775e-03f, -1.501737881e-03f, -2.935653267e-03f, -5.687514710e-04f, +2.558401145e-03f, +2.317921172e-03f, -6.673475630e-04f, -2.279727032e-03f, -8.914213340e-04f, +1.021228789e-03f, +1.084932315e-03f, -2.702967135e-05f, -5.299376467e-04f, -1.826837732e-04f, +1.491486840e-04f, +4.073257728e-05f, - /* 24, 3 */ -1.175537217e-04f, -1.151066589e-04f, +4.558506985e-04f, +3.442099484e-04f, -6.961194660e-04f, -1.290358261e-03f, +5.243891240e-05f, +2.037998203e-03f, +1.627194859e-03f, -1.313720334e-03f, -2.961057174e-03f, -7.914588446e-04f, +2.435570833e-03f, +2.448830599e-03f, -4.792680017e-04f, -2.275344863e-03f, -1.029819797e-03f, +9.459060659e-04f, +1.135545329e-03f, +3.816638860e-05f, -5.305040204e-04f, -2.122423012e-04f, +1.515631236e-04f, +4.801831197e-05f, - /* 24, 4 */ -1.103288160e-04f, -1.252215041e-04f, +4.340463917e-04f, +3.827158599e-04f, -6.223744454e-04f, -1.304448109e-03f, -8.067840470e-05f, +1.957545178e-03f, +1.751108674e-03f, -1.120165265e-03f, -2.969385358e-03f, -1.009410776e-03f, +2.298313921e-03f, +2.566719612e-03f, -2.858241016e-04f, -2.257363134e-03f, -1.165366520e-03f, +8.623375551e-04f, +1.180661312e-03f, +1.060874480e-04f, -5.271339238e-04f, -2.419953224e-04f, +1.529084143e-04f, +5.555842361e-05f, - /* 24, 5 */ -1.027909684e-04f, -1.336775649e-04f, +4.102676936e-04f, +4.167655723e-04f, -5.475775503e-04f, -1.310021272e-03f, -2.097323863e-04f, +1.867300846e-03f, +1.862896930e-03f, -9.222997333e-04f, -2.960684559e-03f, -1.221302229e-03f, +2.147409148e-03f, +2.670767418e-03f, -8.813668768e-05f, -2.225653372e-03f, -1.297129225e-03f, +7.708383352e-04f, +1.219779926e-03f, +1.763556677e-04f, -5.196599496e-04f, -2.716999419e-04f, +1.530928622e-04f, +6.329988035e-05f, - /* 24, 6 */ -9.502680145e-05f, -1.405242734e-04f, +3.847995909e-04f, +4.463096266e-04f, -4.722756447e-04f, -1.307305241e-03f, -3.340090076e-04f, +1.768022423e-03f, +1.962062202e-03f, -7.213660470e-04f, -2.935108571e-03f, -1.425867893e-03f, +1.983723834e-03f, +2.760235146e-03f, +1.126327965e-04f, -2.180174758e-03f, -1.424181074e-03f, +6.717863708e-04f, +1.252427754e-03f, +2.485613970e-04f, -5.079400707e-04f, -3.011014490e-04f, +1.520281231e-04f, +7.118405837e-05f, - /* 24, 7 */ -8.711921055e-05f, -1.458197836e-04f, +3.579275186e-04f, +4.713341756e-04f, -3.970004792e-04f, -1.296577576e-03f, -4.528429958e-04f, +1.660511380e-03f, +2.048195092e-03f, -5.186134147e-04f, -2.892916666e-03f, -1.621890436e-03f, +1.808208423e-03f, +2.834471303e-03f, +3.152896222e-04f, -2.120975750e-03f, -1.545607217e-03f, +5.656213428e-04f, +1.278162587e-03f, +3.222652495e-04f, -4.918597964e-04f, -3.299350101e-04f, +1.496300883e-04f, +7.914691395e-05f, - /* 24, 8 */ -7.914691395e-05f, -1.496300883e-04f, +3.299350101e-04f, +4.918597964e-04f, -3.222652495e-04f, -1.278162587e-03f, -5.656213428e-04f, +1.545607217e-03f, +2.120975750e-03f, -3.152896222e-04f, -2.834471303e-03f, -1.808208423e-03f, +1.621890436e-03f, +2.892916666e-03f, +5.186134147e-04f, -2.048195092e-03f, -1.660511380e-03f, +4.528429958e-04f, +1.296577576e-03f, +3.970004792e-04f, -4.713341756e-04f, -3.579275186e-04f, +1.458197836e-04f, +8.711921055e-05f, - /* 24, 9 */ -7.118405837e-05f, -1.520281231e-04f, +3.011014490e-04f, +5.079400707e-04f, -2.485613970e-04f, -1.252427754e-03f, -6.717863708e-04f, +1.424181074e-03f, +2.180174758e-03f, -1.126327965e-04f, -2.760235146e-03f, -1.983723834e-03f, +1.425867893e-03f, +2.935108571e-03f, +7.213660470e-04f, -1.962062202e-03f, -1.768022423e-03f, +3.340090076e-04f, +1.307305241e-03f, +4.722756447e-04f, -4.463096266e-04f, -3.847995909e-04f, +1.405242734e-04f, +9.502680145e-05f, - /* 24,10 */ -6.329988035e-05f, -1.530928622e-04f, +2.716999419e-04f, +5.196599496e-04f, -1.763556677e-04f, -1.219779926e-03f, -7.708383352e-04f, +1.297129225e-03f, +2.225653372e-03f, +8.813668768e-05f, -2.670767418e-03f, -2.147409148e-03f, +1.221302229e-03f, +2.960684559e-03f, +9.222997333e-04f, -1.862896930e-03f, -1.867300846e-03f, +2.097323863e-04f, +1.310021272e-03f, +5.475775503e-04f, -4.167655723e-04f, -4.102676936e-04f, +1.336775649e-04f, +1.027909684e-04f, - /* 24,11 */ -5.555842361e-05f, -1.529084143e-04f, +2.419953224e-04f, +5.271339238e-04f, -1.060874480e-04f, -1.180661312e-03f, -8.623375551e-04f, +1.165366520e-03f, +2.257363134e-03f, +2.858241016e-04f, -2.566719612e-03f, -2.298313921e-03f, +1.009410776e-03f, +2.969385358e-03f, +1.120165265e-03f, -1.751108674e-03f, -1.957545178e-03f, +8.067840470e-05f, +1.304448109e-03f, +6.223744454e-04f, -3.827158599e-04f, -4.340463917e-04f, +1.252215041e-04f, +1.103288160e-04f, - /* 24,12 */ -4.801831197e-05f, -1.515631236e-04f, +2.122423012e-04f, +5.305040204e-04f, -3.816638860e-05f, -1.135545329e-03f, -9.459060659e-04f, +1.029819797e-03f, +2.275344863e-03f, +4.792680017e-04f, -2.448830599e-03f, -2.435570833e-03f, +7.914588446e-04f, +2.961057174e-03f, +1.313720334e-03f, -1.627194859e-03f, -2.037998203e-03f, -5.243891240e-05f, +1.290358261e-03f, +6.961194660e-04f, -3.442099484e-04f, -4.558506985e-04f, +1.151066589e-04f, +1.175537217e-04f, - /* 24,13 */ -4.073257728e-05f, -1.491486840e-04f, +1.826837732e-04f, +5.299376467e-04f, +2.702967135e-05f, -1.084932315e-03f, -1.021228789e-03f, +8.914213340e-04f, +2.279727032e-03f, +6.673475630e-04f, -2.317921172e-03f, -2.558401145e-03f, +5.687514710e-04f, +2.935653267e-03f, +1.501737881e-03f, -1.491738775e-03f, -2.107952975e-03f, -1.888607322e-04f, +1.267577330e-03f, +7.682542954e-04f, -3.013338450e-04f, -4.753985127e-04f, +1.032931784e-04f, +1.243758393e-04f, - /* 24,14 */ -3.374854096e-05f, -1.457592711e-04f, +1.535492882e-04f, +5.256253050e-04f, +8.915647260e-05f, -1.029345157e-03f, -1.088054225e-03f, +7.511023835e-04f, +2.270723567e-03f, +8.489895579e-04f, -2.174888063e-03f, -2.666119545e-03f, +3.426248829e-04f, +2.893234801e-03f, +1.683014413e-03f, -1.345406789e-03f, -2.166758574e-03f, -3.277877666e-04f, +1.235986710e-03f, +8.382130226e-04f, -2.542107757e-04f, -4.924131238e-04f, +8.975162518e-05f, +1.307026563e-04f, - /* 24,15 */ -2.710774794e-05f, -1.414906982e-04f, +1.250536964e-04f, +5.177782008e-04f, +1.479047908e-04f, -9.693248739e-04f, -1.146194663e-03f, +6.097868283e-04f, +2.248631080e-03f, +1.023174933e-03f, -2.020697482e-03f, -2.758138339e-03f, +1.144377463e-04f, +2.833970964e-03f, +1.856378227e-03f, -1.188944940e-03f, -2.213825561e-03f, -4.683850093e-04f, +1.195525937e-03f, +9.054261715e-04f, -2.030015760e-04f, -5.066257662e-04f, +7.446376994e-05f, +1.364396009e-04f, - /* 20, 0 */ +8.618377023e-05f, +6.063813654e-04f, +5.504304823e-05f, -1.285351444e-03f, -7.884572117e-04f, +1.698526656e-03f, +2.051642156e-03f, -1.208844608e-03f, -3.071261118e-03f, -1.337669627e-04f, +3.018986987e-03f, +1.434631920e-03f, -1.928392685e-03f, -1.831072241e-03f, +6.629429882e-04f, +1.334851066e-03f, +2.665316224e-05f, -6.158469302e-04f, -1.222533602e-04f, +1.824770389e-04f, - /* 20, 1 */ +5.170459821e-05f, +5.921181369e-04f, +1.325211661e-04f, -1.227728603e-03f, -9.042412445e-04f, +1.556639033e-03f, +2.157910711e-03f, -9.769935819e-04f, -3.101316201e-03f, -4.002989059e-04f, +2.944767882e-03f, +1.652572896e-03f, -1.788832610e-03f, -1.953018956e-03f, +5.284364506e-04f, +1.375515478e-03f, +1.120226944e-04f, -6.201709543e-04f, -1.596279961e-04f, +5.435082024e-04f, - /* 20, 2 */ +1.907003227e-05f, +5.734309365e-04f, +2.052951315e-04f, -1.162740775e-03f, -1.009657150e-03f, +1.406715362e-03f, +2.246673287e-03f, -7.408907618e-04f, -3.109053425e-03f, -6.638330580e-04f, +2.849051730e-03f, +1.860929207e-03f, -1.633773999e-03f, -2.063170847e-03f, +3.857714352e-04f, +1.406686835e-03f, +2.004651158e-04f, -6.190441221e-04f, -1.979927117e-04f, +1.783734753e-04f, - /* 20, 3 */ -1.149811868e-05f, +5.507184044e-04f, +2.729399910e-04f, -1.091184321e-03f, -1.104169932e-03f, +1.250098855e-03f, +2.317552276e-03f, -5.023622502e-04f, -3.094549152e-03f, -9.223980063e-04f, +2.732457430e-03f, +2.058021578e-03f, -1.464165902e-03f, -2.160404235e-03f, +2.358727957e-04f, +1.427769061e-03f, +2.913280278e-04f, -6.121962531e-04f, -2.370049292e-04f, +1.734448317e-04f, - /* 20, 4 */ -3.981122763e-05f, +5.243991976e-04f, +3.350936324e-04f, -1.013885501e-03f, -1.187349554e-03f, +1.088157908e-03f, +2.370318438e-03f, -2.632332411e-04f, -3.058053364e-03f, -1.174062761e-03f, +2.595770512e-03f, +2.242244162e-03f, -1.281088328e-03f, -2.243678681e-03f, +7.975052491e-05f, +1.438235101e-03f, +3.839113875e-04f, -5.994006494e-04f, -2.762968272e-04f, +1.660093790e-04f, - /* 20, 5 */ -6.571426612e-05f, +4.949070444e-04f, +3.914578654e-04f, -9.316921975e-04f, -1.258871974e-03f, +9.222740706e-04f, +2.404890527e-03f, -2.531308203e-05f, -2.999986642e-03f, -1.416952434e-03f, +2.439937364e-03f, +2.412078410e-03f, -1.085745014e-03f, -2.312047403e-03f, -8.150702581e-05f, +1.437633739e-03f, +4.774724341e-04f, -5.804781630e-04f, -3.154780847e-04f, +1.559797103e-04f, - /* 20, 6 */ -8.908584503e-05f, +4.626858369e-04f, +4.417988543e-04f, -8.454656803e-04f, -1.318519207e-03f, +7.538301290e-04f, +2.421333651e-03f, +2.096193816e-04f, -2.920935727e-03f, -1.649263420e-03f, +2.266058084e-03f, +2.566106310e-03f, -8.794550343e-04f, -2.364667062e-03f, -2.467407834e-04f, +1.425595879e-03f, +5.712311871e-04f, -5.553009320e-04f, -3.541389831e-04f, +1.432933926e-04f, - /* 20, 7 */ -1.098378936e-04f, +4.281848093e-04f, +4.859469205e-04f, -7.560724855e-04f, -1.366178446e-03f, +5.841984075e-04f, +2.419856400e-03f, +4.398300532e-04f, -2.821647705e-03f, -1.869277969e-03f, +2.075378006e-03f, +2.703022864e-03f, -6.636433018e-04f, -2.400806791e-03f, -4.147293943e-04f, +1.401840253e-03f, +6.643764801e-04f, -5.237957356e-04f, -3.918538488e-04f, +1.279149940e-04f, - /* 20, 8 */ -1.279149940e-04f, +3.918538488e-04f, +5.237957356e-04f, -6.643764801e-04f, -1.401840253e-03f, +4.147293943e-04f, +2.400806791e-03f, +6.636433018e-04f, -2.703022864e-03f, -2.075378006e-03f, +1.869277969e-03f, +2.821647705e-03f, -4.398300532e-04f, -2.419856400e-03f, -5.841984075e-04f, +1.366178446e-03f, +7.560724855e-04f, -4.859469205e-04f, -4.281848093e-04f, +1.098378936e-04f, - /* 20, 9 */ -1.432933926e-04f, +3.541389831e-04f, +5.553009320e-04f, -5.712311871e-04f, -1.425595879e-03f, +2.467407834e-04f, +2.364667062e-03f, +8.794550343e-04f, -2.566106310e-03f, -2.266058084e-03f, +1.649263420e-03f, +2.920935727e-03f, -2.096193816e-04f, -2.421333651e-03f, -7.538301290e-04f, +1.318519207e-03f, +8.454656803e-04f, -4.417988543e-04f, -4.626858369e-04f, +8.908584503e-05f, - /* 20,10 */ -1.559797103e-04f, +3.154780847e-04f, +5.804781630e-04f, -4.774724341e-04f, -1.437633739e-03f, +8.150702581e-05f, +2.312047403e-03f, +1.085745014e-03f, -2.412078410e-03f, -2.439937364e-03f, +1.416952434e-03f, +2.999986642e-03f, +2.531308203e-05f, -2.404890527e-03f, -9.222740706e-04f, +1.258871974e-03f, +9.316921975e-04f, -3.914578654e-04f, -4.949070444e-04f, +6.571426612e-05f, - /* 20,11 */ -1.660093790e-04f, +2.762968272e-04f, +5.994006494e-04f, -3.839113875e-04f, -1.438235101e-03f, -7.975052491e-05f, +2.243678681e-03f, +1.281088328e-03f, -2.242244162e-03f, -2.595770512e-03f, +1.174062761e-03f, +3.058053364e-03f, +2.632332411e-04f, -2.370318438e-03f, -1.088157908e-03f, +1.187349554e-03f, +1.013885501e-03f, -3.350936324e-04f, -5.243991976e-04f, +3.981122763e-05f, - /* 20,12 */ -1.734448317e-04f, +2.370049292e-04f, +6.121962531e-04f, -2.913280278e-04f, -1.427769061e-03f, -2.358727957e-04f, +2.160404235e-03f, +1.464165902e-03f, -2.058021578e-03f, -2.732457430e-03f, +9.223980063e-04f, +3.094549152e-03f, +5.023622502e-04f, -2.317552276e-03f, -1.250098855e-03f, +1.104169932e-03f, +1.091184321e-03f, -2.729399910e-04f, -5.507184044e-04f, +1.149811868e-05f, - /* 20,13 */ -1.783734753e-04f, +1.979927117e-04f, +6.190441221e-04f, -2.004651158e-04f, -1.406686835e-03f, -3.857714352e-04f, +2.063170847e-03f, +1.633773999e-03f, -1.860929207e-03f, -2.849051730e-03f, +6.638330580e-04f, +3.109053425e-03f, +7.408907618e-04f, -2.246673287e-03f, -1.406715362e-03f, +1.009657150e-03f, +1.162740775e-03f, -2.052951315e-04f, -5.734309365e-04f, -1.907003227e-05f, - /* 20,14 */ -5.435082024e-04f, +1.596279961e-04f, +6.201709543e-04f, -1.120226944e-04f, -1.375515478e-03f, -5.284364506e-04f, +1.953018956e-03f, +1.788832610e-03f, -1.652572896e-03f, -2.944767882e-03f, +4.002989059e-04f, +3.101316201e-03f, +9.769935819e-04f, -2.157910711e-03f, -1.556639033e-03f, +9.042412445e-04f, +1.227728603e-03f, -1.325211661e-04f, -5.921181369e-04f, -5.170459821e-05f, - /* 20,15 */ -1.824770389e-04f, +1.222533602e-04f, +6.158469302e-04f, -2.665316224e-05f, -1.334851066e-03f, -6.629429882e-04f, +1.831072241e-03f, +1.928392685e-03f, -1.434631920e-03f, -3.018986987e-03f, +1.337669627e-04f, +3.071261118e-03f, +1.208844608e-03f, -2.051642156e-03f, -1.698526656e-03f, +7.884572117e-04f, +1.285351444e-03f, -5.504304823e-05f, -6.063813654e-04f, -8.618377023e-05f, - /* 20, 0 */ -2.034293425e-04f, +2.330977005e-04f, +6.663349221e-04f, -5.788237715e-04f, -1.543506114e-03f, +7.663264997e-04f, +2.637884518e-03f, -5.016073607e-04f, -3.414789539e-03f, -1.613262342e-04f, +3.393842146e-03f, +7.896927597e-04f, -2.589726790e-03f, -9.705894653e-04f, +1.498255744e-03f, +6.923557695e-04f, -6.435044748e-04f, -2.810018705e-04f, +2.009801156e-04f, +0.000000000e+00f, - /* 20, 1 */ -6.015260759e-04f, +1.858917095e-04f, +6.809814437e-04f, -4.649883812e-04f, -1.572899641e-03f, +5.610647582e-04f, +2.661959816e-03f, -2.131645492e-04f, -3.406214168e-03f, -4.825221542e-04f, +3.343371924e-03f, +1.074767465e-03f, -2.517456780e-03f, -1.171859801e-03f, +1.437039798e-03f, +8.043742580e-04f, -6.123036842e-04f, -3.290468323e-04f, +1.953154138e-04f, -3.513221827e-04f, - /* 20, 2 */ -1.932641301e-04f, +1.399021716e-04f, +6.877130848e-04f, -3.520154127e-04f, -1.586701669e-03f, +3.567578182e-04f, +2.662213263e-03f, +7.301175991e-05f, -3.368394423e-03f, -7.993627115e-04f, +3.263658730e-03f, +1.354174959e-03f, -2.421279702e-03f, -1.368123194e-03f, +1.359912061e-03f, +9.136368247e-04f, -5.726346524e-04f, -3.766412744e-04f, +1.862701081e-04f, +2.243392330e-05f, - /* 20, 3 */ -1.771389305e-04f, +9.560377684e-05f, +6.868748812e-04f, -2.410152618e-04f, -1.585326694e-03f, +1.553000173e-04f, +2.639129491e-03f, +3.543525656e-04f, -3.301882608e-03f, -1.108991788e-03f, +3.155261081e-03f, +1.625281932e-03f, -2.301637793e-03f, -1.557365345e-03f, +1.267093119e-03f, +1.018881552e-03f, -5.244930508e-04f, -4.231658296e-04f, +1.737162070e-04f, +3.471505729e-05f, - /* 20, 4 */ -1.604844080e-04f, +5.342390613e-05f, +6.788805869e-04f, -1.330327870e-04f, -1.569329509e-03f, -4.149146373e-05f, +2.593408320e-03f, +6.283684809e-04f, -3.207497769e-03f, -1.408623929e-03f, +3.019012048e-03f, +1.885504757e-03f, -2.159209806e-03f, -1.737592880e-03f, +1.158972903e-03f, +1.118840456e-03f, -4.679722330e-04f, -4.679795743e-04f, +1.575667726e-04f, +4.805250238e-05f, - /* 20, 5 */ -1.435528424e-04f, +1.373966937e-05f, +6.642048742e-04f, -2.903827106e-05f, -1.539395067e-03f, -2.318933016e-04f, +2.525953799e-03f, +8.926733333e-04f, -3.086315860e-03f, -1.695571566e-03f, +2.856012327e-03f, +2.132335710e-03f, -1.994908019e-03f, -1.906854484e-03f, +1.036111434e-03f, +1.212253447e-03f, -4.032663270e-04f, -5.104270987e-04f, +1.377794601e-04f, +6.235351094e-05f, - /* 20, 6 */ -1.265803873e-04f, -2.312428639e-05f, +6.433751213e-04f, +7.008046528e-05f, -1.496327216e-03f, -4.142913555e-04f, +2.437861323e-03f, +1.145006429e-03f, -2.939657349e-03f, -1.967271220e-03f, +2.667620552e-03f, +2.363368676e-03f, -1.809872756e-03f, -2.063262017e-03f, +8.992377119e-04f, +1.297882648e-03f, -3.306722314e-04f, -5.498460811e-04f, +1.143596169e-04f, +7.750368078e-05f, - /* 20, 7 */ -1.097853637e-04f, -5.689720211e-05f, +6.169629011e-04f, +1.635247423e-04f, -1.441036462e-03f, -5.871944806e-04f, +2.330402993e-03f, +1.383253258e-03f, -2.769072436e-03f, -2.221308400e-03f, +2.455440941e-03f, +2.576324026e-03f, -1.605464444e-03f, -2.205011397e-03f, +7.492467105e-04f, +1.374526925e-03f, -2.505904541e-04f, -5.855752858e-04f, +8.736287854e-05f, +9.336686615e-05f, - /* 20, 8 */ -9.336686615e-05f, -8.736287854e-05f, +5.855752858e-04f, +2.505904541e-04f, -1.374526925e-03f, -7.492467105e-04f, +2.205011397e-03f, +1.605464444e-03f, -2.576324026e-03f, -2.455440941e-03f, +2.221308400e-03f, +2.769072436e-03f, -1.383253258e-03f, -2.330402993e-03f, +5.871944806e-04f, +1.441036462e-03f, -1.635247423e-04f, -6.169629011e-04f, +5.689720211e-05f, +1.097853637e-04f, - /* 20, 9 */ -7.750368078e-05f, -1.143596169e-04f, +5.498460811e-04f, +3.306722314e-04f, -1.297882648e-03f, -8.992377119e-04f, +2.063262017e-03f, +1.809872756e-03f, -2.363368676e-03f, -2.667620552e-03f, +1.967271220e-03f, +2.939657349e-03f, -1.145006429e-03f, -2.437861323e-03f, +4.142913555e-04f, +1.496327216e-03f, -7.008046528e-05f, -6.433751213e-04f, +2.312428639e-05f, +1.265803873e-04f, - /* 20,10 */ -6.235351094e-05f, -1.377794601e-04f, +5.104270987e-04f, +4.032663270e-04f, -1.212253447e-03f, -1.036111434e-03f, +1.906854484e-03f, +1.994908019e-03f, -2.132335710e-03f, -2.856012327e-03f, +1.695571566e-03f, +3.086315860e-03f, -8.926733333e-04f, -2.525953799e-03f, +2.318933016e-04f, +1.539395067e-03f, +2.903827106e-05f, -6.642048742e-04f, -1.373966937e-05f, +1.435528424e-04f, - /* 20,11 */ -4.805250238e-05f, -1.575667726e-04f, +4.679795743e-04f, +4.679722330e-04f, -1.118840456e-03f, -1.158972903e-03f, +1.737592880e-03f, +2.159209806e-03f, -1.885504757e-03f, -3.019012048e-03f, +1.408623929e-03f, +3.207497769e-03f, -6.283684809e-04f, -2.593408320e-03f, +4.149146373e-05f, +1.569329509e-03f, +1.330327870e-04f, -6.788805869e-04f, -5.342390613e-05f, +1.604844080e-04f, - /* 20,12 */ -3.471505729e-05f, -1.737162070e-04f, +4.231658296e-04f, +5.244930508e-04f, -1.018881552e-03f, -1.267093119e-03f, +1.557365345e-03f, +2.301637793e-03f, -1.625281932e-03f, -3.155261081e-03f, +1.108991788e-03f, +3.301882608e-03f, -3.543525656e-04f, -2.639129491e-03f, -1.553000173e-04f, +1.585326694e-03f, +2.410152618e-04f, -6.868748812e-04f, -9.560377684e-05f, +1.771389305e-04f, - /* 20,13 */ -2.243392330e-05f, -1.862701081e-04f, +3.766412744e-04f, +5.726346524e-04f, -9.136368247e-04f, -1.359912061e-03f, +1.368123194e-03f, +2.421279702e-03f, -1.354174959e-03f, -3.263658730e-03f, +7.993627115e-04f, +3.368394423e-03f, -7.301175991e-05f, -2.662213263e-03f, -3.567578182e-04f, +1.586701669e-03f, +3.520154127e-04f, -6.877130848e-04f, -1.399021716e-04f, +1.932641301e-04f, - /* 20,14 */ +3.513221827e-04f, -1.953154138e-04f, +3.290468323e-04f, +6.123036842e-04f, -8.043742580e-04f, -1.437039798e-03f, +1.171859801e-03f, +2.517456780e-03f, -1.074767465e-03f, -3.343371924e-03f, +4.825221542e-04f, +3.406214168e-03f, +2.131645492e-04f, -2.661959816e-03f, -5.610647582e-04f, +1.572899641e-03f, +4.649883812e-04f, -6.809814437e-04f, -1.858917095e-04f, +6.015260759e-04f, - /* 20,15 */ +0.000000000e+00f, -2.009801156e-04f, +2.810018705e-04f, +6.435044748e-04f, -6.923557695e-04f, -1.498255744e-03f, +9.705894653e-04f, +2.589726790e-03f, -7.896927597e-04f, -3.393842146e-03f, +1.613262342e-04f, +3.414789539e-03f, +5.016073607e-04f, -2.637884518e-03f, -7.663264997e-04f, +1.543506114e-03f, +5.788237715e-04f, -6.663349221e-04f, -2.330977005e-04f, +2.034293425e-04f, - /* 20, 0 */ -1.941987182e-05f, -3.146481294e-04f, +5.561305343e-04f, +3.334278991e-04f, -1.561489082e-03f, -4.085266513e-04f, +2.806699025e-03f, +3.580334706e-04f, -3.695826941e-03f, -1.914605051e-04f, +3.720952014e-03f, -2.295171057e-05f, -2.868623587e-03f, +1.886978960e-04f, +1.629573547e-03f, -2.343761763e-04f, -6.035407960e-04f, +1.633790229e-04f, +3.476344875e-05f, +0.000000000e+00f, - /* 20, 1 */ +3.929324583e-04f, -3.051602666e-04f, +5.048306585e-04f, +4.229644027e-04f, -1.479104632e-03f, -6.165003319e-04f, +2.717079427e-03f, +6.839596419e-04f, -3.633185574e-03f, -5.723309145e-04f, +3.708003841e-03f, +3.177599071e-04f, -2.901501717e-03f, -4.082823094e-05f, +1.681921685e-03f, -1.265851889e-04f, -6.461214422e-04f, +1.369921977e-04f, +5.166761157e-05f, +0.000000000e+00f, - /* 20, 2 */ +0.000000000e+00f, -2.925136688e-04f, +4.505823818e-04f, +5.023683161e-04f, -1.383975926e-03f, -8.106644739e-04f, +2.601403151e-03f, +9.973590062e-04f, -3.534000256e-03f, -9.470733637e-04f, +3.656850180e-03f, +6.604608766e-04f, -2.904291326e-03f, -2.777120434e-04f, +1.717239595e-03f, -1.098579054e-05f, -6.829477483e-04f, +1.058859702e-04f, +7.000071077e-05f, +0.000000000e+00f, - /* 20, 3 */ +0.000000000e+00f, -2.771727451e-04f, +3.943146848e-04f, +5.711822345e-04f, -1.277754215e-03f, -9.892860040e-04f, +2.461570058e-03f, +1.295052213e-03f, -3.399644449e-03f, -1.311681723e-03f, +3.567787737e-03f, +1.001437562e-03f, -2.876278542e-03f, -5.194560271e-04f, +1.734397724e-03f, +1.113422841e-04f, -7.131247677e-04f, +7.019384523e-05f, +8.959420873e-05f, +0.000000000e+00f, - /* 20, 4 */ +0.000000000e+00f, -2.596009711e-04f, +3.369316672e-04f, +6.291078651e-04f, -1.162161945e-03f, -1.150868125e-03f, +2.299713337e-03f, +1.574086312e-03f, -3.231873732e-03f, -1.662267592e-03f, +3.441541225e-03f, +1.336946247e-03f, -2.817092852e-03f, -7.634316403e-04f, +1.732451285e-03f, +2.391787684e-04f, -7.358020638e-04f, +3.013243736e-05f, +1.102423612e-04f, +0.000000000e+00f, - /* 20, 5 */ +0.000000000e+00f, -2.402546692e-04f, +2.793008459e-04f, +6.760030262e-04f, -1.038968304e-03f, -1.294161821e-03f, +2.118169008e-03f, +1.831766066e-03f, -3.032802328e-03f, -1.995105343e-03f, +3.279257242e-03f, +1.663257052e-03f, -2.726718246e-03f, -1.006908470e-03f, +1.710658870e-03f, +3.711735089e-04f, -7.501884622e-04f, -1.399708473e-05f, +1.317024534e-04f, +0.000000000e+00f, - /* 20, 6 */ +0.000000000e+00f, -2.195772899e-04f, +2.222425350e-04f, +7.118766228e-04f, -9.099649801e-04f, -1.418173917e-03f, +1.919443545e-03f, +2.065681697e-03f, -2.804875489e-03f, -2.306675131e-03f, +3.082493013e-03f, +1.976698190e-03f, -2.605500127e-03f, -1.247085413e-03f, +1.668498942e-03f, +5.058593370e-04f, -7.555665992e-04f, -6.180883712e-05f, +1.536956226e-04f, +0.000000000e+00f, - /* 20, 7 */ +0.000000000e+00f, -1.979942392e-04f, +1.665204182e-04f, +7.368817426e-04f, -7.769424426e-04f, -1.522171671e-03f, +1.706180058e-03f, +2.273732749e-03f, -2.550838108e-03f, -2.593703365e-03f, +2.853200114e-03f, +2.273699984e-03f, -2.454147846e-03f, -1.481123511e-03f, +1.605683934e-03f, +6.416670612e-04f, -7.513070408e-04f, -1.128334053e-04f, +1.759082929e-04f, +0.000000000e+00f, - /* 20, 8 */ +0.000000000e+00f, -1.759082929e-04f, +1.128334053e-04f, +7.513070408e-04f, -6.416670612e-04f, -1.605683934e-03f, +1.481123511e-03f, +2.454147846e-03f, -2.273699984e-03f, -2.853200114e-03f, +2.593703365e-03f, +2.550838108e-03f, -2.273732749e-03f, -1.706180058e-03f, +1.522171671e-03f, +7.769424426e-04f, -7.368817426e-04f, -1.665204182e-04f, +1.979942392e-04f, +0.000000000e+00f, - /* 20, 9 */ +0.000000000e+00f, -1.536956226e-04f, +6.180883712e-05f, +7.555665992e-04f, -5.058593370e-04f, -1.668498942e-03f, +1.247085413e-03f, +2.605500127e-03f, -1.976698190e-03f, -3.082493013e-03f, +2.306675131e-03f, +2.804875489e-03f, -2.065681697e-03f, -1.919443545e-03f, +1.418173917e-03f, +9.099649801e-04f, -7.118766228e-04f, -2.222425350e-04f, +2.195772899e-04f, +0.000000000e+00f, - /* 20,10 */ +0.000000000e+00f, -1.317024534e-04f, +1.399708473e-05f, +7.501884622e-04f, -3.711735089e-04f, -1.710658870e-03f, +1.006908470e-03f, +2.726718246e-03f, -1.663257052e-03f, -3.279257242e-03f, +1.995105343e-03f, +3.032802328e-03f, -1.831766066e-03f, -2.118169008e-03f, +1.294161821e-03f, +1.038968304e-03f, -6.760030262e-04f, -2.793008459e-04f, +2.402546692e-04f, +0.000000000e+00f, - /* 20,11 */ +0.000000000e+00f, -1.102423612e-04f, -3.013243736e-05f, +7.358020638e-04f, -2.391787684e-04f, -1.732451285e-03f, +7.634316403e-04f, +2.817092852e-03f, -1.336946247e-03f, -3.441541225e-03f, +1.662267592e-03f, +3.231873732e-03f, -1.574086312e-03f, -2.299713337e-03f, +1.150868125e-03f, +1.162161945e-03f, -6.291078651e-04f, -3.369316672e-04f, +2.596009711e-04f, +0.000000000e+00f, - /* 20,12 */ +0.000000000e+00f, -8.959420873e-05f, -7.019384523e-05f, +7.131247677e-04f, -1.113422841e-04f, -1.734397724e-03f, +5.194560271e-04f, +2.876278542e-03f, -1.001437562e-03f, -3.567787737e-03f, +1.311681723e-03f, +3.399644449e-03f, -1.295052213e-03f, -2.461570058e-03f, +9.892860040e-04f, +1.277754215e-03f, -5.711822345e-04f, -3.943146848e-04f, +2.771727451e-04f, +0.000000000e+00f, - /* 20,13 */ +0.000000000e+00f, -7.000071077e-05f, -1.058859702e-04f, +6.829477483e-04f, +1.098579054e-05f, -1.717239595e-03f, +2.777120434e-04f, +2.904291326e-03f, -6.604608766e-04f, -3.656850180e-03f, +9.470733637e-04f, +3.534000256e-03f, -9.973590062e-04f, -2.601403151e-03f, +8.106644739e-04f, +1.383975926e-03f, -5.023683161e-04f, -4.505823818e-04f, +2.925136688e-04f, +0.000000000e+00f, - /* 20,14 */ +0.000000000e+00f, -5.166761157e-05f, -1.369921977e-04f, +6.461214422e-04f, +1.265851889e-04f, -1.681921685e-03f, +4.082823094e-05f, +2.901501717e-03f, -3.177599071e-04f, -3.708003841e-03f, +5.723309145e-04f, +3.633185574e-03f, -6.839596419e-04f, -2.717079427e-03f, +6.165003319e-04f, +1.479104632e-03f, -4.229644027e-04f, -5.048306585e-04f, +3.051602666e-04f, -3.929324583e-04f, - /* 20,15 */ +0.000000000e+00f, -3.476344875e-05f, -1.633790229e-04f, +6.035407960e-04f, +2.343761763e-04f, -1.629573547e-03f, -1.886978960e-04f, +2.868623587e-03f, +2.295171057e-05f, -3.720952014e-03f, +1.914605051e-04f, +3.695826941e-03f, -3.580334706e-04f, -2.806699025e-03f, +4.085266513e-04f, +1.561489082e-03f, -3.334278991e-04f, -5.561305343e-04f, +3.146481294e-04f, +1.941987182e-05f, - /* 16, 0 */ +5.220390682e-05f, +8.171943113e-04f, -8.986497643e-04f, -1.446340428e-03f, +2.494478678e-03f, +1.297377101e-03f, -3.898391184e-03f, -2.241676001e-04f, +3.985236927e-03f, -9.413140896e-04f, -2.682700956e-03f, +1.283836927e-03f, +1.053222343e-03f, -7.989322796e-04f, -1.116939505e-04f, +1.571395541e-04f, - /* 16, 1 */ -3.017522584e-06f, +8.224554322e-04f, -7.403312787e-04f, -1.584058293e-03f, +2.281207335e-03f, +1.631019258e-03f, -3.765802305e-03f, -6.696927435e-04f, +4.024834602e-03f, -5.670028406e-04f, -2.842687093e-03f, +1.097826180e-03f, +1.201600277e-03f, -7.671194843e-04f, -1.747127487e-04f, +1.853334990e-04f, - /* 16, 2 */ -5.335264618e-05f, +8.154372286e-04f, -5.806604605e-04f, -1.696100138e-03f, +2.046328714e-03f, +1.938434809e-03f, -3.589560871e-03f, -1.106825943e-03f, +4.016290169e-03f, -1.789305351e-04f, -2.971556495e-03f, +8.899684644e-04f, +1.341315594e-03f, -7.213960065e-04f, -2.404043435e-04f, +2.137577131e-04f, - /* 16, 3 */ -9.830954357e-05f, +7.970128377e-04f, -4.219420013e-04f, -1.781963746e-03f, +1.793485018e-03f, +2.216231187e-03f, -3.372309802e-03f, -1.530099436e-03f, +3.959337237e-03f, +2.181586899e-04f, -3.066783450e-03f, +6.622938144e-04f, +1.469918710e-03f, -6.616076810e-04f, -3.078052257e-04f, +7.052925564e-04f, - /* 16, 4 */ -1.375232535e-04f, +7.681852053e-04f, -2.663606532e-04f, -1.841529450e-03f, +1.526462906e-03f, +2.461468734e-03f, -3.117203525e-03f, -1.934233820e-03f, +3.854345030e-03f, +6.193258599e-04f, -3.126241364e-03f, +4.171838871e-04f, +1.585017189e-03f, -5.878191605e-04f, -3.758553213e-04f, +2.457392598e-04f, - /* 16, 5 */ -1.707546409e-04f, +7.300642099e-04f, -1.159532388e-04f, -1.875048978e-03f, +1.249136740e-03f, +2.671693350e-03f, -2.827860277e-03f, -2.314209556e-03f, +3.702317390e-03f, +1.019502933e-03f, -3.148242059e-03f, +1.573479538e-04f, +1.684315055e-03f, -5.003238841e-04f, -4.434113338e-04f, +2.470336005e-04f, - /* 16, 6 */ -1.978870754e-04f, +6.838430878e-04f, +2.741593655e-05f, -1.883129095e-03f, +9.654119112e-04f, +2.844961691e-03f, -2.508308289e-03f, -2.665334690e-03f, +3.504882792e-03f, +1.413561295e-03f, -3.131569469e-03f, -1.142067707e-04f, +1.765652028e-03f, -3.996506493e-04f, -5.092623113e-04f, +2.432370997e-04f, - /* 16, 7 */ -2.189210857e-04f, +6.307745862e-04f, +1.620759979e-04f, -1.866710442e-03f, +6.791690772e-04f, +2.979858667e-03f, -2.162926680e-03f, -2.983307830e-03f, +3.264275462e-03f, +1.796381989e-03f, -3.075507089e-03f, -3.942101476e-04f, +1.827042047e-03f, -2.865665382e-04f, -5.721472605e-04f, +2.339671870e-04f, - /* 16, 8 */ -2.339671870e-04f, +5.721472605e-04f, +2.865665382e-04f, -1.827042047e-03f, +3.942101476e-04f, +3.075507089e-03f, -1.796381989e-03f, -3.264275462e-03f, +2.983307830e-03f, +2.162926680e-03f, -2.979858667e-03f, -6.791690772e-04f, +1.866710442e-03f, -1.620759979e-04f, -6.307745862e-04f, +2.189210857e-04f, - /* 16, 9 */ -2.432370997e-04f, +5.092623113e-04f, +3.996506493e-04f, -1.765652028e-03f, +1.142067707e-04f, +3.131569469e-03f, -1.413561295e-03f, -3.504882792e-03f, +2.665334690e-03f, +2.508308289e-03f, -2.844961691e-03f, -9.654119112e-04f, +1.883129095e-03f, -2.741593655e-05f, -6.838430878e-04f, +1.978870754e-04f, - /* 16,10 */ -2.470336005e-04f, +4.434113338e-04f, +5.003238841e-04f, -1.684315055e-03f, -1.573479538e-04f, +3.148242059e-03f, -1.019502933e-03f, -3.702317390e-03f, +2.314209556e-03f, +2.827860277e-03f, -2.671693350e-03f, -1.249136740e-03f, +1.875048978e-03f, +1.159532388e-04f, -7.300642099e-04f, +1.707546409e-04f, - /* 16,11 */ -2.457392598e-04f, +3.758553213e-04f, +5.878191605e-04f, -1.585017189e-03f, -4.171838871e-04f, +3.126241364e-03f, -6.193258599e-04f, -3.854345030e-03f, +1.934233820e-03f, +3.117203525e-03f, -2.461468734e-03f, -1.526462906e-03f, +1.841529450e-03f, +2.663606532e-04f, -7.681852053e-04f, +1.375232535e-04f, - /* 16,12 */ -7.052925564e-04f, +3.078052257e-04f, +6.616076810e-04f, -1.469918710e-03f, -6.622938144e-04f, +3.066783450e-03f, -2.181586899e-04f, -3.959337237e-03f, +1.530099436e-03f, +3.372309802e-03f, -2.216231187e-03f, -1.793485018e-03f, +1.781963746e-03f, +4.219420013e-04f, -7.970128377e-04f, +9.830954357e-05f, - /* 16,13 */ -2.137577131e-04f, +2.404043435e-04f, +7.213960065e-04f, -1.341315594e-03f, -8.899684644e-04f, +2.971556495e-03f, +1.789305351e-04f, -4.016290169e-03f, +1.106825943e-03f, +3.589560871e-03f, -1.938434809e-03f, -2.046328714e-03f, +1.696100138e-03f, +5.806604605e-04f, -8.154372286e-04f, +5.335264618e-05f, - /* 16,14 */ -1.853334990e-04f, +1.747127487e-04f, +7.671194843e-04f, -1.201600277e-03f, -1.097826180e-03f, +2.842687093e-03f, +5.670028406e-04f, -4.024834602e-03f, +6.696927435e-04f, +3.765802305e-03f, -1.631019258e-03f, -2.281207335e-03f, +1.584058293e-03f, +7.403312787e-04f, -8.224554322e-04f, +3.017522584e-06f, - /* 16,15 */ -1.571395541e-04f, +1.116939505e-04f, +7.989322796e-04f, -1.053222343e-03f, -1.283836927e-03f, +2.682700956e-03f, +9.413140896e-04f, -3.985236927e-03f, +2.241676001e-04f, +3.898391184e-03f, -1.297377101e-03f, -2.494478678e-03f, +1.446340428e-03f, +8.986497643e-04f, -8.171943113e-04f, -5.220390682e-05f, - /* 16, 0 */ -2.607744081e-04f, +6.609893225e-04f, +4.777614003e-05f, -2.019079564e-03f, +1.736921610e-03f, +2.230081148e-03f, -4.008512761e-03f, -2.594451583e-04f, +4.172957467e-03f, -1.888269495e-03f, -2.040920379e-03f, +1.975903291e-03f, +1.180452271e-04f, -7.248571600e-04f, +2.468008838e-04f, +0.000000000e+00f, - /* 16, 1 */ -2.676863913e-04f, +5.906930705e-04f, +2.025069901e-04f, -2.030408814e-03f, +1.418499470e-03f, +2.533235894e-03f, -3.790472440e-03f, -7.745724648e-04f, +4.280846994e-03f, -1.512096765e-03f, -2.325335551e-03f, +1.900137256e-03f, +2.927280105e-04f, -7.805529904e-04f, +2.254162899e-04f, +0.000000000e+00f, - /* 16, 2 */ -2.680102581e-04f, +5.157202047e-04f, +3.442245196e-04f, -2.011119828e-03f, +1.090886046e-03f, +2.794113365e-03f, -3.522578151e-03f, -1.278469954e-03f, +4.330057965e-03f, -1.106477171e-03f, -2.585166870e-03f, +1.791556445e-03f, +4.737630093e-04f, -8.263772041e-04f, +1.964117366e-04f, +0.000000000e+00f, - /* 16, 3 */ -7.633646088e-04f, +4.377966605e-04f, +4.713317060e-04f, -1.962888420e-03f, +7.592982470e-04f, +3.009813640e-03f, -3.209287239e-03f, -1.763847458e-03f, +4.319343992e-03f, -6.768749158e-04f, -2.815661672e-03f, +1.650477084e-03f, +6.583936022e-04f, -8.607109932e-04f, +1.597335965e-04f, -4.634120047e-04f, - /* 16, 4 */ -2.423668462e-04f, +3.585907293e-04f, +5.825699836e-04f, -1.887792011e-03f, +4.288533077e-04f, +3.178189562e-03f, -2.855695312e-03f, -2.223705909e-03f, +4.248362401e-03f, -2.292254995e-04f, -3.012400483e-03f, +1.477771292e-03f, +8.436545409e-04f, -8.820535056e-04f, +1.154955663e-04f, +2.338334874e-05f, - /* 16, 5 */ -2.066858426e-04f, +2.796840991e-04f, +6.770251471e-04f, -1.788258811e-03f, +1.044882353e-04f, +3.297866045e-03f, -2.467449129e-03f, -2.651446905e-03f, +4.117686315e-03f, +2.301520823e-04f, -3.171379014e-03f, +1.274872332e-03f, +1.026416356e-03f, -8.890585891e-04f, +6.398775754e-05f, +4.782938304e-05f, - /* 16, 6 */ -1.715009195e-04f, +2.025461567e-04f, +7.541266524e-04f, -1.667012713e-03f, -2.091154912e-04f, +3.368246274e-03f, -2.050651409e-03f, -3.040975547e-03f, +3.928801804e-03f, +6.946508648e-04f, -3.289085050e-03f, +1.043770075e-03f, +1.203434747e-03f, -8.805703554e-04f, +5.682450650e-06f, +7.520965874e-05f, - /* 16, 7 */ -1.374865801e-04f, +1.285119093e-04f, +8.136405975e-04f, -1.527015027e-03f, -5.076007987e-04f, +3.389504923e-03f, -1.611759203e-03f, -3.386794836e-03f, +3.684090065e-03f, +1.157477637e-03f, -3.362568736e-03f, +7.869964389e-04f, +1.371404208e-03f, -8.556567843e-04f, -5.876379361e-05f, +1.052264476e-04f, - /* 16, 8 */ -1.052264476e-04f, +5.876379361e-05f, +8.556567843e-04f, -1.371404208e-03f, -7.869964389e-04f, +3.362568736e-03f, -1.157477637e-03f, -3.684090065e-03f, +3.386794836e-03f, +1.611759203e-03f, -3.389504923e-03f, +5.076007987e-04f, +1.527015027e-03f, -8.136405975e-04f, -1.285119093e-04f, +1.374865801e-04f, - /* 16, 9 */ -7.520965874e-05f, -5.682450650e-06f, +8.805703554e-04f, -1.203434747e-03f, -1.043770075e-03f, +3.289085050e-03f, -6.946508648e-04f, -3.928801804e-03f, +3.040975547e-03f, +2.050651409e-03f, -3.368246274e-03f, +2.091154912e-04f, +1.667012713e-03f, -7.541266524e-04f, -2.025461567e-04f, +1.715009195e-04f, - /* 16,10 */ -4.782938304e-05f, -6.398775754e-05f, +8.890585891e-04f, -1.026416356e-03f, -1.274872332e-03f, +3.171379014e-03f, -2.301520823e-04f, -4.117686315e-03f, +2.651446905e-03f, +2.467449129e-03f, -3.297866045e-03f, -1.044882353e-04f, +1.788258811e-03f, -6.770251471e-04f, -2.796840991e-04f, +2.066858426e-04f, - /* 16,11 */ -2.338334874e-05f, -1.154955663e-04f, +8.820535056e-04f, -8.436545409e-04f, -1.477771292e-03f, +3.012400483e-03f, +2.292254995e-04f, -4.248362401e-03f, +2.223705909e-03f, +2.855695312e-03f, -3.178189562e-03f, -4.288533077e-04f, +1.887792011e-03f, -5.825699836e-04f, -3.585907293e-04f, +2.423668462e-04f, - /* 16,12 */ +4.634120047e-04f, -1.597335965e-04f, +8.607109932e-04f, -6.583936022e-04f, -1.650477084e-03f, +2.815661672e-03f, +6.768749158e-04f, -4.319343992e-03f, +1.763847458e-03f, +3.209287239e-03f, -3.009813640e-03f, -7.592982470e-04f, +1.962888420e-03f, -4.713317060e-04f, -4.377966605e-04f, +7.633646088e-04f, - /* 16,13 */ +0.000000000e+00f, -1.964117366e-04f, +8.263772041e-04f, -4.737630093e-04f, -1.791556445e-03f, +2.585166870e-03f, +1.106477171e-03f, -4.330057965e-03f, +1.278469954e-03f, +3.522578151e-03f, -2.794113365e-03f, -1.090886046e-03f, +2.011119828e-03f, -3.442245196e-04f, -5.157202047e-04f, +2.680102581e-04f, - /* 16,14 */ +0.000000000e+00f, -2.254162899e-04f, +7.805529904e-04f, -2.927280105e-04f, -1.900137256e-03f, +2.325335551e-03f, +1.512096765e-03f, -4.280846994e-03f, +7.745724648e-04f, +3.790472440e-03f, -2.533235894e-03f, -1.418499470e-03f, +2.030408814e-03f, -2.025069901e-04f, -5.906930705e-04f, +2.676863913e-04f, - /* 16,15 */ +0.000000000e+00f, -2.468008838e-04f, +7.248571600e-04f, -1.180452271e-04f, -1.975903291e-03f, +2.040920379e-03f, +1.888269495e-03f, -4.172957467e-03f, +2.594451583e-04f, +4.008512761e-03f, -2.230081148e-03f, -1.736921610e-03f, +2.019079564e-03f, -4.777614003e-05f, -6.609893225e-04f, +2.607744081e-04f, - /* 16, 0 */ -1.129954761e-04f, -3.969443331e-04f, +7.863457700e-04f, -1.968627401e-03f, +6.635626436e-04f, +3.065104554e-03f, -4.014723865e-03f, -2.972906332e-04f, +4.272130602e-03f, -2.778972616e-03f, -1.044103847e-03f, +2.069667087e-03f, -6.906315332e-04f, -2.376896670e-04f, +1.523656204e-04f, +0.000000000e+00f, - /* 16, 1 */ -7.672972562e-05f, -4.458313625e-04f, +8.604609066e-04f, -1.839340292e-03f, +2.869810557e-04f, +3.294943885e-03f, -3.696990655e-03f, -8.869321804e-04f, +4.464175630e-03f, -2.440111513e-03f, -1.421957113e-03f, +2.139058837e-03f, -5.737860098e-04f, -3.273087897e-04f, +1.941703587e-04f, +0.000000000e+00f, - /* 16, 2 */ -4.409159553e-05f, -4.801879450e-04f, +9.129725459e-04f, -1.685578963e-03f, -7.929130936e-05f, +3.465994861e-03f, -3.324955442e-03f, -1.461843594e-03f, +4.586914931e-03f, -2.053108579e-03f, -1.790295465e-03f, +2.173860444e-03f, -4.367566844e-04f, -4.185294039e-04f, +2.375950982e-04f, +0.000000000e+00f, - /* 16, 3 */ +4.855802427e-04f, -5.008892512e-04f, +9.443143993e-04f, -1.511399569e-03f, -4.293120730e-04f, +3.576852207e-03f, -2.905512498e-03f, -2.012499819e-03f, +4.637578076e-03f, -1.623510702e-03f, -2.142238116e-03f, +2.171667537e-03f, -2.809771210e-04f, -5.093533546e-04f, +2.816859426e-04f, +0.000000000e+00f, - /* 16, 4 */ +0.000000000e+00f, -5.090007623e-04f, +9.553248878e-04f, -1.321049384e-03f, -7.576441950e-04f, +3.627202827e-03f, -2.446291464e-03f, -2.529812382e-03f, +4.614629236e-03f, -1.157740361e-03f, -2.470980778e-03f, +2.130685105e-03f, -1.083629217e-04f, -5.976383603e-04f, +3.253590588e-04f, +0.000000000e+00f, - /* 16, 5 */ +0.000000000e+00f, -5.057402285e-04f, +9.472067544e-04f, -1.118874842e-03f, -1.059441268e-03f, +3.617806804e-03f, -1.955510679e-03f, -3.005292216e-03f, +4.517805471e-03f, -6.629933593e-04f, -2.769928158e-03f, +2.049789183e-03f, +7.870314989e-05f, -6.811391839e-04f, +3.674140144e-04f, +0.000000000e+00f, - /* 16, 6 */ +0.000000000e+00f, -4.924395299e-04f, +9.214808972e-04f, -9.092313688e-04f, -1.330518654e-03f, +3.550458465e-03f, -1.441821213e-03f, -3.431200966e-03f, +4.348131386e-03f, -1.471199733e-04f, -3.032825993e-03f, +1.928577081e-03f, +2.773970394e-04f, -7.575537377e-04f, +4.065510896e-04f, +0.000000000e+00f, - /* 16, 7 */ +0.000000000e+00f, -4.705072223e-04f, +8.799357120e-04f, -6.963968181e-04f, -1.567409460e-03f, +3.427928686e-03f, -9.141447359e-04f, -3.800687882e-03f, +4.107909720e-03f, +3.815084058e-04f, -3.253889950e-03f, +1.767404663e-03f, +4.844901765e-04f, -8.245732787e-04f, +4.413924818e-04f, +0.000000000e+00f, - /* 16, 8 */ +0.000000000e+00f, -4.413924818e-04f, +8.245732787e-04f, -4.844901765e-04f, -1.767404663e-03f, +3.253889950e-03f, -3.815084058e-04f, -4.107909720e-03f, +3.800687882e-03f, +9.141447359e-04f, -3.427928686e-03f, +1.567409460e-03f, +6.963968181e-04f, -8.799357120e-04f, +4.705072223e-04f, +0.000000000e+00f, - /* 16, 9 */ +0.000000000e+00f, -4.065510896e-04f, +7.575537377e-04f, -2.773970394e-04f, -1.928577081e-03f, +3.032825993e-03f, +1.471199733e-04f, -4.348131386e-03f, +3.431200966e-03f, +1.441821213e-03f, -3.550458465e-03f, +1.330518654e-03f, +9.092313688e-04f, -9.214808972e-04f, +4.924395299e-04f, +0.000000000e+00f, - /* 16,10 */ +0.000000000e+00f, -3.674140144e-04f, +6.811391839e-04f, -7.870314989e-05f, -2.049789183e-03f, +2.769928158e-03f, +6.629933593e-04f, -4.517805471e-03f, +3.005292216e-03f, +1.955510679e-03f, -3.617806804e-03f, +1.059441268e-03f, +1.118874842e-03f, -9.472067544e-04f, +5.057402285e-04f, +0.000000000e+00f, - /* 16,11 */ +0.000000000e+00f, -3.253590588e-04f, +5.976383603e-04f, +1.083629217e-04f, -2.130685105e-03f, +2.470980778e-03f, +1.157740361e-03f, -4.614629236e-03f, +2.529812382e-03f, +2.446291464e-03f, -3.627202827e-03f, +7.576441950e-04f, +1.321049384e-03f, -9.553248878e-04f, +5.090007623e-04f, +0.000000000e+00f, - /* 16,12 */ +0.000000000e+00f, -2.816859426e-04f, +5.093533546e-04f, +2.809771210e-04f, -2.171667537e-03f, +2.142238116e-03f, +1.623510702e-03f, -4.637578076e-03f, +2.012499819e-03f, +2.905512498e-03f, -3.576852207e-03f, +4.293120730e-04f, +1.511399569e-03f, -9.443143993e-04f, +5.008892512e-04f, -4.855802427e-04f, - /* 16,13 */ +0.000000000e+00f, -2.375950982e-04f, +4.185294039e-04f, +4.367566844e-04f, -2.173860444e-03f, +1.790295465e-03f, +2.053108579e-03f, -4.586914931e-03f, +1.461843594e-03f, +3.324955442e-03f, -3.465994861e-03f, +7.929130936e-05f, +1.685578963e-03f, -9.129725459e-04f, +4.801879450e-04f, +4.409159553e-05f, - /* 16,14 */ +0.000000000e+00f, -1.941703587e-04f, +3.273087897e-04f, +5.737860098e-04f, -2.139058837e-03f, +1.421957113e-03f, +2.440111513e-03f, -4.464175630e-03f, +8.869321804e-04f, +3.696990655e-03f, -3.294943885e-03f, -2.869810557e-04f, +1.839340292e-03f, -8.604609066e-04f, +4.458313625e-04f, +7.672972562e-05f, - /* 16,15 */ +0.000000000e+00f, -1.523656204e-04f, +2.376896670e-04f, +6.906315332e-04f, -2.069667087e-03f, +1.044103847e-03f, +2.778972616e-03f, -4.272130602e-03f, +2.972906332e-04f, +4.014723865e-03f, -3.065104554e-03f, -6.635626436e-04f, +1.968627401e-03f, -7.863457700e-04f, +3.969443331e-04f, +1.129954761e-04f, - /* 12, 0 */ +1.006092301e-03f, -1.356592138e-03f, -5.291224839e-04f, +3.716365432e-03f, -3.908475818e-03f, -3.377012930e-04f, +4.272902045e-03f, -3.529241849e-03f, +1.347121185e-04f, +1.576582805e-03f, -1.021094463e-03f, +2.080147558e-04f, - /* 12, 1 */ +9.703330579e-04f, -1.123568815e-03f, -8.960631472e-04f, +3.830455785e-03f, -3.478978472e-03f, -1.006731283e-03f, +4.564422369e-03f, -3.270752231e-03f, -2.802589631e-04f, +1.777910422e-03f, -1.013271813e-03f, +1.540375404e-04f, - /* 12, 2 */ +9.162319547e-04f, -8.831264337e-04f, -1.229457804e-03f, +3.871345986e-03f, -2.993425932e-03f, -1.656773890e-03f, +4.776559314e-03f, -2.944064628e-03f, -7.081711396e-04f, +1.955059288e-03f, -9.809799530e-04f, +8.895597490e-05f, - /* 12, 3 */ +8.464715149e-04f, -6.407365814e-04f, -1.524162434e-03f, +3.840336583e-03f, -2.461816027e-03f, -2.275602698e-03f, +4.904341682e-03f, -2.553815646e-03f, -1.140836495e-03f, +2.102763165e-03f, -9.230670815e-04f, +1.349777819e-05f, - /* 12, 4 */ +7.639192828e-04f, -4.016125871e-04f, -1.776040886e-03f, +3.740131991e-03f, -1.894910812e-03f, -2.851629129e-03f, +4.944422783e-03f, -2.106045312e-03f, -1.569658753e-03f, +2.216140176e-03f, -8.389345160e-04f, -7.124952580e-05f, - /* 12, 5 */ +6.715456333e-04f, -1.706046467e-04f, -1.982015497e-03f, +3.574748146e-03f, -1.304005398e-03f, -3.374137989e-03f, +4.895165032e-03f, -1.608099956e-03f, -1.985807614e-03f, +2.290824513e-03f, -7.285864297e-04f, -1.638417811e-04f, - /* 12, 6 */ +5.723437636e-04f, +4.789167018e-05f, -2.140092391e-03f, +3.349394124e-03f, -7.006885404e-04f, -3.833503957e-03f, +4.756688774e-03f, -1.068504673e-03f, -2.380403858e-03f, +2.323091638e-03f, -5.926669574e-04f, -2.624916697e-04f, - /* 12, 7 */ +4.692537952e-04f, +2.500119139e-04f, -2.249361715e-03f, +3.070330944e-03f, -9.660032268e-05f, -4.221384345e-03f, +4.530883988e-03f, -4.968076992e-04f, -2.744711242e-03f, +2.309973659e-03f, -4.324830696e-04f, -3.650927179e-04f, - /* 12, 8 */ +3.650927179e-04f, +4.324830696e-04f, -2.309973659e-03f, +2.744711242e-03f, +4.968076992e-04f, -4.530883988e-03f, +4.221384345e-03f, +9.660032268e-05f, -3.070330944e-03f, +2.249361715e-03f, -2.500119139e-04f, -4.692537952e-04f, - /* 12, 9 */ +2.624916697e-04f, +5.926669574e-04f, -2.323091638e-03f, +2.380403858e-03f, +1.068504673e-03f, -4.756688774e-03f, +3.833503957e-03f, +7.006885404e-04f, -3.349394124e-03f, +2.140092391e-03f, -4.789167018e-05f, -5.723437636e-04f, - /* 12,10 */ +1.638417811e-04f, +7.285864297e-04f, -2.290824513e-03f, +1.985807614e-03f, +1.608099956e-03f, -4.895165032e-03f, +3.374137989e-03f, +1.304005398e-03f, -3.574748146e-03f, +1.982015497e-03f, +1.706046467e-04f, -6.715456333e-04f, - /* 12,11 */ +7.124952580e-05f, +8.389345160e-04f, -2.216140176e-03f, +1.569658753e-03f, +2.106045312e-03f, -4.944422783e-03f, +2.851629129e-03f, +1.894910812e-03f, -3.740131991e-03f, +1.776040886e-03f, +4.016125871e-04f, -7.639192828e-04f, - /* 12,12 */ -1.349777819e-05f, +9.230670815e-04f, -2.102763165e-03f, +1.140836495e-03f, +2.553815646e-03f, -4.904341682e-03f, +2.275602698e-03f, +2.461816027e-03f, -3.840336583e-03f, +1.524162434e-03f, +6.407365814e-04f, -8.464715149e-04f, - /* 12,13 */ -8.895597490e-05f, +9.809799530e-04f, -1.955059288e-03f, +7.081711396e-04f, +2.944064628e-03f, -4.776559314e-03f, +1.656773890e-03f, +2.993425932e-03f, -3.871345986e-03f, +1.229457804e-03f, +8.831264337e-04f, -9.162319547e-04f, - /* 12,14 */ -1.540375404e-04f, +1.013271813e-03f, -1.777910422e-03f, +2.802589631e-04f, +3.270752231e-03f, -4.564422369e-03f, +1.006731283e-03f, +3.478978472e-03f, -3.830455785e-03f, +8.960631472e-04f, +1.123568815e-03f, -9.703330579e-04f, - /* 12,15 */ -2.080147558e-04f, +1.021094463e-03f, -1.576582805e-03f, -1.347121185e-04f, +3.529241849e-03f, -4.272902045e-03f, +3.377012930e-04f, +3.908475818e-03f, -3.716365432e-03f, +5.291224839e-04f, +1.356592138e-03f, -1.006092301e-03f, - /* 12, 0 */ +7.165252154e-04f, -4.291307465e-04f, -1.619691310e-03f, +4.112050532e-03f, -3.684471854e-03f, -3.806742210e-04f, +4.167864669e-03f, -4.064044128e-03f, +1.285631838e-03f, +6.994376016e-04f, -8.205283947e-04f, +3.212754781e-04f, - /* 12, 1 */ +6.042449626e-04f, -1.684748882e-04f, -1.902468489e-03f, +4.073990388e-03f, -3.134198780e-03f, -1.133926469e-03f, +4.572939653e-03f, -3.928365474e-03f, +9.055999228e-04f, +9.731965741e-04f, -9.124383184e-04f, +3.311614162e-04f, - /* 12, 2 */ +4.874350434e-04f, +7.694308689e-05f, -2.130082097e-03f, +3.953363211e-03f, -2.529802622e-03f, -1.863076830e-03f, +4.889863669e-03f, -3.705392569e-03f, +4.862599326e-04f, +1.243729140e-03f, -9.884795125e-04f, +3.301883495e-04f, - /* 12, 3 */ +3.696734183e-04f, +3.022578517e-04f, -2.300114973e-03f, +3.755428771e-03f, -1.885047396e-03f, -2.552675098e-03f, +5.110657479e-03f, -3.397530000e-03f, +3.551878686e-05f, +1.504029611e-03f, -1.045032679e-03f, +3.171093301e-04f, - /* 12, 4 */ +2.542791637e-04f, +5.034105172e-04f, -2.411611526e-03f, +3.487034212e-03f, -1.214371318e-03f, -3.188181667e-03f, +5.229403271e-03f, -3.009202669e-03f, -4.376222644e-04f, +1.746934410e-03f, -1.078752986e-03f, +2.909691299e-04f, - /* 12, 5 */ +1.442362351e-04f, +6.772076791e-04f, -2.465038541e-03f, +3.156407157e-03f, -5.325427440e-04f, -3.756300237e-03f, +5.242404627e-03f, -2.546799451e-03f, -9.232494237e-04f, +1.965304174e-03f, -1.086687765e-03f, +2.511615343e-04f, - /* 12, 6 */ +4.213190220e-05f, +8.213542577e-04f, -2.462211671e-03f, +2.772920825e-03f, +1.456866600e-04f, -4.245279979e-03f, +5.148294544e-03f, -2.018567160e-03f, -1.410748009e-03f, +2.152214196e-03f, -1.066390037e-03f, +1.974793328e-04f, - /* 12, 7 */ -4.988918599e-05f, +9.344605010e-04f, -2.406190818e-03f, +2.346837790e-03f, +8.059229054e-04f, -4.645179801e-03f, +4.948088353e-03f, -1.434456490e-03f, -1.889039390e-03f, +2.301148282e-03f, -1.016024228e-03f, +1.301548676e-04f, - /* 12, 8 */ -1.301548676e-04f, +1.016024228e-03f, -2.301148282e-03f, +1.889039390e-03f, +1.434456490e-03f, -4.948088353e-03f, +4.645179801e-03f, -8.059229054e-04f, -2.346837790e-03f, +2.406190818e-03f, -9.344605010e-04f, +4.988918599e-05f, - /* 12, 9 */ -1.974793328e-04f, +1.066390037e-03f, -2.152214196e-03f, +1.410748009e-03f, +2.018567160e-03f, -5.148294544e-03f, +4.245279979e-03f, -1.456866600e-04f, -2.772920825e-03f, +2.462211671e-03f, -8.213542577e-04f, -4.213190220e-05f, - /* 12,10 */ -2.511615343e-04f, +1.086687765e-03f, -1.965304174e-03f, +9.232494237e-04f, +2.546799451e-03f, -5.242404627e-03f, +3.756300237e-03f, +5.325427440e-04f, -3.156407157e-03f, +2.465038541e-03f, -6.772076791e-04f, -1.442362351e-04f, - /* 12,11 */ -2.909691299e-04f, +1.078752986e-03f, -1.746934410e-03f, +4.376222644e-04f, +3.009202669e-03f, -5.229403271e-03f, +3.188181667e-03f, +1.214371318e-03f, -3.487034212e-03f, +2.411611526e-03f, -5.034105172e-04f, -2.542791637e-04f, - /* 12,12 */ -3.171093301e-04f, +1.045032679e-03f, -1.504029611e-03f, -3.551878686e-05f, +3.397530000e-03f, -5.110657479e-03f, +2.552675098e-03f, +1.885047396e-03f, -3.755428771e-03f, +2.300114973e-03f, -3.022578517e-04f, -3.696734183e-04f, - /* 12,13 */ -3.301883495e-04f, +9.884795125e-04f, -1.243729140e-03f, -4.862599326e-04f, +3.705392569e-03f, -4.889863669e-03f, +1.863076830e-03f, +2.529802622e-03f, -3.953363211e-03f, +2.130082097e-03f, -7.694308689e-05f, -4.874350434e-04f, - /* 12,14 */ -3.311614162e-04f, +9.124383184e-04f, -9.731965741e-04f, -9.055999228e-04f, +3.928365474e-03f, -4.572939653e-03f, +1.133926469e-03f, +3.134198780e-03f, -4.073990388e-03f, +1.902468489e-03f, +1.684748882e-04f, -6.042449626e-04f, - /* 12,15 */ -3.212754781e-04f, +8.205283947e-04f, -6.994376016e-04f, -1.285631838e-03f, +4.064044128e-03f, -4.167864669e-03f, +3.806742210e-04f, +3.684471854e-03f, -4.112050532e-03f, +1.619691310e-03f, +4.291307465e-04f, -7.165252154e-04f -}; diff --git a/Engine/lib/openal-soft/Alc/compat.h b/Engine/lib/openal-soft/Alc/compat.h index 114fc655d..093184c81 100644 --- a/Engine/lib/openal-soft/Alc/compat.h +++ b/Engine/lib/openal-soft/Alc/compat.h @@ -3,6 +3,10 @@ #include "alstring.h" +#ifdef __cplusplus +extern "C" { +#endif + #ifdef _WIN32 #define WIN32_LEAN_AND_MEAN @@ -38,7 +42,7 @@ struct FileMapping { struct FileMapping MapFileToMem(const char *fname); void UnmapFileMem(const struct FileMapping *mapping); -al_string GetProcPath(void); +void GetProcBinary(al_string *path, al_string *fname); #ifdef HAVE_DYNLOAD void *LoadLib(const char *name); @@ -46,4 +50,16 @@ void CloseLib(void *handle); void *GetSymbol(void *handle, const char *name); #endif +#ifdef __ANDROID__ +#define JCALL(obj, func) ((*(obj))->func((obj), EXTRACT_VCALL_ARGS +#define JCALL0(obj, func) ((*(obj))->func((obj) EXTRACT_VCALL_ARGS + +/** Returns a JNIEnv*. */ +void *Android_GetJNIEnv(void); +#endif + +#ifdef __cplusplus +} /* extern "C" */ +#endif + #endif /* AL_COMPAT_H */ diff --git a/Engine/lib/openal-soft/Alc/converter.c b/Engine/lib/openal-soft/Alc/converter.c new file mode 100644 index 000000000..ef2eb9af2 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/converter.c @@ -0,0 +1,468 @@ + +#include "config.h" + +#include "converter.h" + +#include "fpu_modes.h" +#include "mixer/defs.h" + + +SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType dstType, ALsizei numchans, ALsizei srcRate, ALsizei dstRate) +{ + SampleConverter *converter; + ALsizei step; + + if(numchans <= 0 || srcRate <= 0 || dstRate <= 0) + return NULL; + + converter = al_calloc(16, FAM_SIZE(SampleConverter, Chan, numchans)); + converter->mSrcType = srcType; + converter->mDstType = dstType; + converter->mNumChannels = numchans; + converter->mSrcTypeSize = BytesFromDevFmt(srcType); + converter->mDstTypeSize = BytesFromDevFmt(dstType); + + converter->mSrcPrepCount = 0; + converter->mFracOffset = 0; + + /* Have to set the mixer FPU mode since that's what the resampler code expects. */ + START_MIXER_MODE(); + step = (ALsizei)mind(((ALdouble)srcRate/dstRate*FRACTIONONE) + 0.5, + MAX_PITCH * FRACTIONONE); + converter->mIncrement = maxi(step, 1); + if(converter->mIncrement == FRACTIONONE) + converter->mResample = Resample_copy_C; + else + { + /* TODO: Allow other resamplers. */ + BsincPrepare(converter->mIncrement, &converter->mState.bsinc, &bsinc12); + converter->mResample = SelectResampler(BSinc12Resampler); + } + END_MIXER_MODE(); + + return converter; +} + +void DestroySampleConverter(SampleConverter **converter) +{ + if(converter) + { + al_free(*converter); + *converter = NULL; + } +} + + +static inline ALfloat Sample_ALbyte(ALbyte val) +{ return val * (1.0f/128.0f); } +static inline ALfloat Sample_ALubyte(ALubyte val) +{ return Sample_ALbyte((ALint)val - 128); } + +static inline ALfloat Sample_ALshort(ALshort val) +{ return val * (1.0f/32768.0f); } +static inline ALfloat Sample_ALushort(ALushort val) +{ return Sample_ALshort((ALint)val - 32768); } + +static inline ALfloat Sample_ALint(ALint val) +{ return (val>>7) * (1.0f/16777216.0f); } +static inline ALfloat Sample_ALuint(ALuint val) +{ return Sample_ALint(val - INT_MAX - 1); } + +static inline ALfloat Sample_ALfloat(ALfloat val) +{ return val; } + +#define DECL_TEMPLATE(T) \ +static inline void Load_##T(ALfloat *restrict dst, const T *restrict src, \ + ALint srcstep, ALsizei samples) \ +{ \ + ALsizei i; \ + for(i = 0;i < samples;i++) \ + dst[i] = Sample_##T(src[i*srcstep]); \ +} + +DECL_TEMPLATE(ALbyte) +DECL_TEMPLATE(ALubyte) +DECL_TEMPLATE(ALshort) +DECL_TEMPLATE(ALushort) +DECL_TEMPLATE(ALint) +DECL_TEMPLATE(ALuint) +DECL_TEMPLATE(ALfloat) + +#undef DECL_TEMPLATE + +static void LoadSamples(ALfloat *dst, const ALvoid *src, ALint srcstep, enum DevFmtType srctype, ALsizei samples) +{ + switch(srctype) + { + case DevFmtByte: + Load_ALbyte(dst, src, srcstep, samples); + break; + case DevFmtUByte: + Load_ALubyte(dst, src, srcstep, samples); + break; + case DevFmtShort: + Load_ALshort(dst, src, srcstep, samples); + break; + case DevFmtUShort: + Load_ALushort(dst, src, srcstep, samples); + break; + case DevFmtInt: + Load_ALint(dst, src, srcstep, samples); + break; + case DevFmtUInt: + Load_ALuint(dst, src, srcstep, samples); + break; + case DevFmtFloat: + Load_ALfloat(dst, src, srcstep, samples); + break; + } +} + + +static inline ALbyte ALbyte_Sample(ALfloat val) +{ return fastf2i(clampf(val*128.0f, -128.0f, 127.0f)); } +static inline ALubyte ALubyte_Sample(ALfloat val) +{ return ALbyte_Sample(val)+128; } + +static inline ALshort ALshort_Sample(ALfloat val) +{ return fastf2i(clampf(val*32768.0f, -32768.0f, 32767.0f)); } +static inline ALushort ALushort_Sample(ALfloat val) +{ return ALshort_Sample(val)+32768; } + +static inline ALint ALint_Sample(ALfloat val) +{ return fastf2i(clampf(val*16777216.0f, -16777216.0f, 16777215.0f)) << 7; } +static inline ALuint ALuint_Sample(ALfloat val) +{ return ALint_Sample(val)+INT_MAX+1; } + +static inline ALfloat ALfloat_Sample(ALfloat val) +{ return val; } + +#define DECL_TEMPLATE(T) \ +static inline void Store_##T(T *restrict dst, const ALfloat *restrict src, \ + ALint dststep, ALsizei samples) \ +{ \ + ALsizei i; \ + for(i = 0;i < samples;i++) \ + dst[i*dststep] = T##_Sample(src[i]); \ +} + +DECL_TEMPLATE(ALbyte) +DECL_TEMPLATE(ALubyte) +DECL_TEMPLATE(ALshort) +DECL_TEMPLATE(ALushort) +DECL_TEMPLATE(ALint) +DECL_TEMPLATE(ALuint) +DECL_TEMPLATE(ALfloat) + +#undef DECL_TEMPLATE + +static void StoreSamples(ALvoid *dst, const ALfloat *src, ALint dststep, enum DevFmtType dsttype, ALsizei samples) +{ + switch(dsttype) + { + case DevFmtByte: + Store_ALbyte(dst, src, dststep, samples); + break; + case DevFmtUByte: + Store_ALubyte(dst, src, dststep, samples); + break; + case DevFmtShort: + Store_ALshort(dst, src, dststep, samples); + break; + case DevFmtUShort: + Store_ALushort(dst, src, dststep, samples); + break; + case DevFmtInt: + Store_ALint(dst, src, dststep, samples); + break; + case DevFmtUInt: + Store_ALuint(dst, src, dststep, samples); + break; + case DevFmtFloat: + Store_ALfloat(dst, src, dststep, samples); + break; + } +} + + +ALsizei SampleConverterAvailableOut(SampleConverter *converter, ALsizei srcframes) +{ + ALint prepcount = converter->mSrcPrepCount; + ALsizei increment = converter->mIncrement; + ALsizei DataPosFrac = converter->mFracOffset; + ALuint64 DataSize64; + + if(prepcount < 0) + { + /* Negative prepcount means we need to skip that many input samples. */ + if(-prepcount >= srcframes) + return 0; + srcframes += prepcount; + prepcount = 0; + } + + if(srcframes < 1) + { + /* No output samples if there's no input samples. */ + return 0; + } + + if(prepcount < MAX_RESAMPLE_PADDING*2 && + MAX_RESAMPLE_PADDING*2 - prepcount >= srcframes) + { + /* Not enough input samples to generate an output sample. */ + return 0; + } + + DataSize64 = prepcount; + DataSize64 += srcframes; + DataSize64 -= MAX_RESAMPLE_PADDING*2; + DataSize64 <<= FRACTIONBITS; + DataSize64 -= DataPosFrac; + + /* If we have a full prep, we can generate at least one sample. */ + return (ALsizei)clampu64((DataSize64 + increment-1)/increment, 1, BUFFERSIZE); +} + + +ALsizei SampleConverterInput(SampleConverter *converter, const ALvoid **src, ALsizei *srcframes, ALvoid *dst, ALsizei dstframes) +{ + const ALsizei SrcFrameSize = converter->mNumChannels * converter->mSrcTypeSize; + const ALsizei DstFrameSize = converter->mNumChannels * converter->mDstTypeSize; + const ALsizei increment = converter->mIncrement; + ALsizei pos = 0; + + START_MIXER_MODE(); + while(pos < dstframes && *srcframes > 0) + { + ALfloat *restrict SrcData = ASSUME_ALIGNED(converter->mSrcSamples, 16); + ALfloat *restrict DstData = ASSUME_ALIGNED(converter->mDstSamples, 16); + ALint prepcount = converter->mSrcPrepCount; + ALsizei DataPosFrac = converter->mFracOffset; + ALuint64 DataSize64; + ALsizei DstSize; + ALint toread; + ALsizei chan; + + if(prepcount < 0) + { + /* Negative prepcount means we need to skip that many input samples. */ + if(-prepcount >= *srcframes) + { + converter->mSrcPrepCount = prepcount + *srcframes; + *srcframes = 0; + break; + } + *src = (const ALbyte*)*src + SrcFrameSize*-prepcount; + *srcframes += prepcount; + converter->mSrcPrepCount = 0; + continue; + } + toread = mini(*srcframes, BUFFERSIZE - MAX_RESAMPLE_PADDING*2); + + if(prepcount < MAX_RESAMPLE_PADDING*2 && + MAX_RESAMPLE_PADDING*2 - prepcount >= toread) + { + /* Not enough input samples to generate an output sample. Store + * what we're given for later. + */ + for(chan = 0;chan < converter->mNumChannels;chan++) + LoadSamples(&converter->Chan[chan].mPrevSamples[prepcount], + (const ALbyte*)*src + converter->mSrcTypeSize*chan, + converter->mNumChannels, converter->mSrcType, toread + ); + + converter->mSrcPrepCount = prepcount + toread; + *srcframes = 0; + break; + } + + DataSize64 = prepcount; + DataSize64 += toread; + DataSize64 -= MAX_RESAMPLE_PADDING*2; + DataSize64 <<= FRACTIONBITS; + DataSize64 -= DataPosFrac; + + /* If we have a full prep, we can generate at least one sample. */ + DstSize = (ALsizei)clampu64((DataSize64 + increment-1)/increment, 1, BUFFERSIZE); + DstSize = mini(DstSize, dstframes-pos); + + for(chan = 0;chan < converter->mNumChannels;chan++) + { + const ALbyte *SrcSamples = (const ALbyte*)*src + converter->mSrcTypeSize*chan; + ALbyte *DstSamples = (ALbyte*)dst + converter->mDstTypeSize*chan; + const ALfloat *ResampledData; + ALsizei SrcDataEnd; + + /* Load the previous samples into the source data first, then the + * new samples from the input buffer. + */ + memcpy(SrcData, converter->Chan[chan].mPrevSamples, + prepcount*sizeof(ALfloat)); + LoadSamples(SrcData + prepcount, SrcSamples, + converter->mNumChannels, converter->mSrcType, toread + ); + + /* Store as many prep samples for next time as possible, given the + * number of output samples being generated. + */ + SrcDataEnd = (DataPosFrac + increment*DstSize)>>FRACTIONBITS; + if(SrcDataEnd >= prepcount+toread) + memset(converter->Chan[chan].mPrevSamples, 0, + sizeof(converter->Chan[chan].mPrevSamples)); + else + { + size_t len = mini(MAX_RESAMPLE_PADDING*2, prepcount+toread-SrcDataEnd); + memcpy(converter->Chan[chan].mPrevSamples, &SrcData[SrcDataEnd], + len*sizeof(ALfloat)); + memset(converter->Chan[chan].mPrevSamples+len, 0, + sizeof(converter->Chan[chan].mPrevSamples) - len*sizeof(ALfloat)); + } + + /* Now resample, and store the result in the output buffer. */ + ResampledData = converter->mResample(&converter->mState, + SrcData+MAX_RESAMPLE_PADDING, DataPosFrac, increment, + DstData, DstSize + ); + + StoreSamples(DstSamples, ResampledData, converter->mNumChannels, + converter->mDstType, DstSize); + } + + /* Update the number of prep samples still available, as well as the + * fractional offset. + */ + DataPosFrac += increment*DstSize; + converter->mSrcPrepCount = mini(prepcount + toread - (DataPosFrac>>FRACTIONBITS), + MAX_RESAMPLE_PADDING*2); + converter->mFracOffset = DataPosFrac & FRACTIONMASK; + + /* Update the src and dst pointers in case there's still more to do. */ + *src = (const ALbyte*)*src + SrcFrameSize*(DataPosFrac>>FRACTIONBITS); + *srcframes -= mini(*srcframes, (DataPosFrac>>FRACTIONBITS)); + + dst = (ALbyte*)dst + DstFrameSize*DstSize; + pos += DstSize; + } + END_MIXER_MODE(); + + return pos; +} + + +ChannelConverter *CreateChannelConverter(enum DevFmtType srcType, enum DevFmtChannels srcChans, enum DevFmtChannels dstChans) +{ + ChannelConverter *converter; + + if(srcChans != dstChans && !((srcChans == DevFmtMono && dstChans == DevFmtStereo) || + (srcChans == DevFmtStereo && dstChans == DevFmtMono))) + return NULL; + + converter = al_calloc(DEF_ALIGN, sizeof(*converter)); + converter->mSrcType = srcType; + converter->mSrcChans = srcChans; + converter->mDstChans = dstChans; + + return converter; +} + +void DestroyChannelConverter(ChannelConverter **converter) +{ + if(converter) + { + al_free(*converter); + *converter = NULL; + } +} + + +#define DECL_TEMPLATE(T) \ +static void Mono2Stereo##T(ALfloat *restrict dst, const T *src, ALsizei frames)\ +{ \ + ALsizei i; \ + for(i = 0;i < frames;i++) \ + dst[i*2 + 1] = dst[i*2 + 0] = Sample_##T(src[i]) * 0.707106781187f; \ +} \ + \ +static void Stereo2Mono##T(ALfloat *restrict dst, const T *src, ALsizei frames)\ +{ \ + ALsizei i; \ + for(i = 0;i < frames;i++) \ + dst[i] = (Sample_##T(src[i*2 + 0])+Sample_##T(src[i*2 + 1])) * \ + 0.707106781187f; \ +} + +DECL_TEMPLATE(ALbyte) +DECL_TEMPLATE(ALubyte) +DECL_TEMPLATE(ALshort) +DECL_TEMPLATE(ALushort) +DECL_TEMPLATE(ALint) +DECL_TEMPLATE(ALuint) +DECL_TEMPLATE(ALfloat) + +#undef DECL_TEMPLATE + +void ChannelConverterInput(ChannelConverter *converter, const ALvoid *src, ALfloat *dst, ALsizei frames) +{ + if(converter->mSrcChans == converter->mDstChans) + { + LoadSamples(dst, src, 1, converter->mSrcType, + frames*ChannelsFromDevFmt(converter->mSrcChans, 0)); + return; + } + + if(converter->mSrcChans == DevFmtStereo && converter->mDstChans == DevFmtMono) + { + switch(converter->mSrcType) + { + case DevFmtByte: + Stereo2MonoALbyte(dst, src, frames); + break; + case DevFmtUByte: + Stereo2MonoALubyte(dst, src, frames); + break; + case DevFmtShort: + Stereo2MonoALshort(dst, src, frames); + break; + case DevFmtUShort: + Stereo2MonoALushort(dst, src, frames); + break; + case DevFmtInt: + Stereo2MonoALint(dst, src, frames); + break; + case DevFmtUInt: + Stereo2MonoALuint(dst, src, frames); + break; + case DevFmtFloat: + Stereo2MonoALfloat(dst, src, frames); + break; + } + } + else /*if(converter->mSrcChans == DevFmtMono && converter->mDstChans == DevFmtStereo)*/ + { + switch(converter->mSrcType) + { + case DevFmtByte: + Mono2StereoALbyte(dst, src, frames); + break; + case DevFmtUByte: + Mono2StereoALubyte(dst, src, frames); + break; + case DevFmtShort: + Mono2StereoALshort(dst, src, frames); + break; + case DevFmtUShort: + Mono2StereoALushort(dst, src, frames); + break; + case DevFmtInt: + Mono2StereoALint(dst, src, frames); + break; + case DevFmtUInt: + Mono2StereoALuint(dst, src, frames); + break; + case DevFmtFloat: + Mono2StereoALfloat(dst, src, frames); + break; + } + } +} diff --git a/Engine/lib/openal-soft/Alc/converter.h b/Engine/lib/openal-soft/Alc/converter.h new file mode 100644 index 000000000..b58fd831d --- /dev/null +++ b/Engine/lib/openal-soft/Alc/converter.h @@ -0,0 +1,55 @@ +#ifndef CONVERTER_H +#define CONVERTER_H + +#include "alMain.h" +#include "alu.h" + +#ifdef __cpluspluc +extern "C" { +#endif + +typedef struct SampleConverter { + enum DevFmtType mSrcType; + enum DevFmtType mDstType; + ALsizei mNumChannels; + ALsizei mSrcTypeSize; + ALsizei mDstTypeSize; + + ALint mSrcPrepCount; + + ALsizei mFracOffset; + ALsizei mIncrement; + InterpState mState; + ResamplerFunc mResample; + + alignas(16) ALfloat mSrcSamples[BUFFERSIZE]; + alignas(16) ALfloat mDstSamples[BUFFERSIZE]; + + struct { + alignas(16) ALfloat mPrevSamples[MAX_RESAMPLE_PADDING*2]; + } Chan[]; +} SampleConverter; + +SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType dstType, ALsizei numchans, ALsizei srcRate, ALsizei dstRate); +void DestroySampleConverter(SampleConverter **converter); + +ALsizei SampleConverterInput(SampleConverter *converter, const ALvoid **src, ALsizei *srcframes, ALvoid *dst, ALsizei dstframes); +ALsizei SampleConverterAvailableOut(SampleConverter *converter, ALsizei srcframes); + + +typedef struct ChannelConverter { + enum DevFmtType mSrcType; + enum DevFmtChannels mSrcChans; + enum DevFmtChannels mDstChans; +} ChannelConverter; + +ChannelConverter *CreateChannelConverter(enum DevFmtType srcType, enum DevFmtChannels srcChans, enum DevFmtChannels dstChans); +void DestroyChannelConverter(ChannelConverter **converter); + +void ChannelConverterInput(ChannelConverter *converter, const ALvoid *src, ALfloat *dst, ALsizei frames); + +#ifdef __cpluspluc +} +#endif + +#endif /* CONVERTER_H */ diff --git a/Engine/lib/openal-soft/Alc/cpu_caps.h b/Engine/lib/openal-soft/Alc/cpu_caps.h new file mode 100644 index 000000000..328d470e4 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/cpu_caps.h @@ -0,0 +1,15 @@ +#ifndef CPU_CAPS_H +#define CPU_CAPS_H + +extern int CPUCapFlags; +enum { + CPU_CAP_SSE = 1<<0, + CPU_CAP_SSE2 = 1<<1, + CPU_CAP_SSE3 = 1<<2, + CPU_CAP_SSE4_1 = 1<<3, + CPU_CAP_NEON = 1<<4, +}; + +void FillCPUCaps(int capfilter); + +#endif /* CPU_CAPS_H */ diff --git a/Engine/lib/openal-soft/Alc/effects/chorus.c b/Engine/lib/openal-soft/Alc/effects/chorus.c index 63d0ca018..ffb2b572e 100644 --- a/Engine/lib/openal-soft/Alc/effects/chorus.c +++ b/Engine/lib/openal-soft/Alc/effects/chorus.c @@ -24,32 +24,40 @@ #include #include "alMain.h" -#include "alFilter.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" +#include "filters/defs.h" -enum ChorusWaveForm { - CWF_Triangle = AL_CHORUS_WAVEFORM_TRIANGLE, - CWF_Sinusoid = AL_CHORUS_WAVEFORM_SINUSOID +static_assert(AL_CHORUS_WAVEFORM_SINUSOID == AL_FLANGER_WAVEFORM_SINUSOID, "Chorus/Flanger waveform value mismatch"); +static_assert(AL_CHORUS_WAVEFORM_TRIANGLE == AL_FLANGER_WAVEFORM_TRIANGLE, "Chorus/Flanger waveform value mismatch"); + +enum WaveForm { + WF_Sinusoid, + WF_Triangle }; typedef struct ALchorusState { DERIVE_FROM_TYPE(ALeffectState); - ALfloat *SampleBuffer[2]; - ALuint BufferLength; - ALuint offset; - ALuint lfo_range; + ALfloat *SampleBuffer; + ALsizei BufferLength; + ALsizei offset; + + ALsizei lfo_offset; + ALsizei lfo_range; ALfloat lfo_scale; ALint lfo_disp; /* Gains for left and right sides */ - ALfloat Gain[2][MAX_OUTPUT_CHANNELS]; + struct { + ALfloat Current[MAX_OUTPUT_CHANNELS]; + ALfloat Target[MAX_OUTPUT_CHANNELS]; + } Gains[2]; /* effect parameters */ - enum ChorusWaveForm waveform; + enum WaveForm waveform; ALint delay; ALfloat depth; ALfloat feedback; @@ -57,8 +65,8 @@ typedef struct ALchorusState { static ALvoid ALchorusState_Destruct(ALchorusState *state); static ALboolean ALchorusState_deviceUpdate(ALchorusState *state, ALCdevice *Device); -static ALvoid ALchorusState_update(ALchorusState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props); -static ALvoid ALchorusState_process(ALchorusState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); +static ALvoid ALchorusState_update(ALchorusState *state, const ALCcontext *Context, const ALeffectslot *Slot, const ALeffectProps *props); +static ALvoid ALchorusState_process(ALchorusState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels); DECLARE_DEFAULT_ALLOCATORS(ALchorusState) DEFINE_ALEFFECTSTATE_VTABLE(ALchorusState); @@ -70,54 +78,51 @@ static void ALchorusState_Construct(ALchorusState *state) SET_VTABLE2(ALchorusState, ALeffectState, state); state->BufferLength = 0; - state->SampleBuffer[0] = NULL; - state->SampleBuffer[1] = NULL; + state->SampleBuffer = NULL; state->offset = 0; + state->lfo_offset = 0; state->lfo_range = 1; - state->waveform = CWF_Triangle; + state->waveform = WF_Triangle; } static ALvoid ALchorusState_Destruct(ALchorusState *state) { - al_free(state->SampleBuffer[0]); - state->SampleBuffer[0] = NULL; - state->SampleBuffer[1] = NULL; + al_free(state->SampleBuffer); + state->SampleBuffer = NULL; ALeffectState_Destruct(STATIC_CAST(ALeffectState,state)); } static ALboolean ALchorusState_deviceUpdate(ALchorusState *state, ALCdevice *Device) { - ALuint maxlen; - ALuint it; + const ALfloat max_delay = maxf(AL_CHORUS_MAX_DELAY, AL_FLANGER_MAX_DELAY); + ALsizei maxlen; - maxlen = fastf2u(AL_CHORUS_MAX_DELAY * 3.0f * Device->Frequency) + 1; - maxlen = NextPowerOf2(maxlen); + maxlen = NextPowerOf2(float2int(max_delay*2.0f*Device->Frequency) + 1u); + if(maxlen <= 0) return AL_FALSE; if(maxlen != state->BufferLength) { - void *temp = al_calloc(16, maxlen * sizeof(ALfloat) * 2); + void *temp = al_calloc(16, maxlen * sizeof(ALfloat)); if(!temp) return AL_FALSE; - al_free(state->SampleBuffer[0]); - state->SampleBuffer[0] = temp; - state->SampleBuffer[1] = state->SampleBuffer[0] + maxlen; + al_free(state->SampleBuffer); + state->SampleBuffer = temp; state->BufferLength = maxlen; } - for(it = 0;it < state->BufferLength;it++) - { - state->SampleBuffer[0][it] = 0.0f; - state->SampleBuffer[1][it] = 0.0f; - } + memset(state->SampleBuffer, 0, state->BufferLength*sizeof(ALfloat)); + memset(state->Gains, 0, sizeof(state->Gains)); return AL_TRUE; } -static ALvoid ALchorusState_update(ALchorusState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) +static ALvoid ALchorusState_update(ALchorusState *state, const ALCcontext *Context, const ALeffectslot *Slot, const ALeffectProps *props) { - ALfloat frequency = (ALfloat)Device->Frequency; + const ALsizei mindelay = MAX_RESAMPLE_PADDING << FRACTIONBITS; + const ALCdevice *device = Context->Device; + ALfloat frequency = (ALfloat)device->Frequency; ALfloat coeffs[MAX_AMBI_COEFFS]; ALfloat rate; ALint phase; @@ -125,156 +130,166 @@ static ALvoid ALchorusState_update(ALchorusState *state, const ALCdevice *Device switch(props->Chorus.Waveform) { case AL_CHORUS_WAVEFORM_TRIANGLE: - state->waveform = CWF_Triangle; + state->waveform = WF_Triangle; break; case AL_CHORUS_WAVEFORM_SINUSOID: - state->waveform = CWF_Sinusoid; + state->waveform = WF_Sinusoid; break; } - state->depth = props->Chorus.Depth; + + /* The LFO depth is scaled to be relative to the sample delay. Clamp the + * delay and depth to allow enough padding for resampling. + */ + state->delay = maxi(float2int(props->Chorus.Delay*frequency*FRACTIONONE + 0.5f), + mindelay); + state->depth = minf(props->Chorus.Depth * state->delay, + (ALfloat)(state->delay - mindelay)); + state->feedback = props->Chorus.Feedback; - state->delay = fastf2i(props->Chorus.Delay * frequency); /* Gains for left and right sides */ - CalcXYZCoeffs(-1.0f, 0.0f, 0.0f, 0.0f, coeffs); - ComputePanningGains(Device->Dry, coeffs, Slot->Params.Gain, state->Gain[0]); - CalcXYZCoeffs( 1.0f, 0.0f, 0.0f, 0.0f, coeffs); - ComputePanningGains(Device->Dry, coeffs, Slot->Params.Gain, state->Gain[1]); + CalcAngleCoeffs(-F_PI_2, 0.0f, 0.0f, coeffs); + ComputeDryPanGains(&device->Dry, coeffs, Slot->Params.Gain, state->Gains[0].Target); + CalcAngleCoeffs( F_PI_2, 0.0f, 0.0f, coeffs); + ComputeDryPanGains(&device->Dry, coeffs, Slot->Params.Gain, state->Gains[1].Target); phase = props->Chorus.Phase; rate = props->Chorus.Rate; if(!(rate > 0.0f)) { - state->lfo_scale = 0.0f; + state->lfo_offset = 0; state->lfo_range = 1; + state->lfo_scale = 0.0f; state->lfo_disp = 0; } else { - /* Calculate LFO coefficient */ - state->lfo_range = fastf2u(frequency/rate + 0.5f); + /* Calculate LFO coefficient (number of samples per cycle). Limit the + * max range to avoid overflow when calculating the displacement. + */ + ALsizei lfo_range = float2int(minf(frequency/rate + 0.5f, (ALfloat)(INT_MAX/360 - 180))); + + state->lfo_offset = float2int((ALfloat)state->lfo_offset/state->lfo_range* + lfo_range + 0.5f) % lfo_range; + state->lfo_range = lfo_range; switch(state->waveform) { - case CWF_Triangle: + case WF_Triangle: state->lfo_scale = 4.0f / state->lfo_range; break; - case CWF_Sinusoid: + case WF_Sinusoid: state->lfo_scale = F_TAU / state->lfo_range; break; } /* Calculate lfo phase displacement */ - state->lfo_disp = fastf2i(state->lfo_range * (phase/360.0f)); + if(phase < 0) phase = 360 + phase; + state->lfo_disp = (state->lfo_range*phase + 180) / 360; } } -static inline void Triangle(ALint *delay_left, ALint *delay_right, ALuint offset, const ALchorusState *state) +static void GetTriangleDelays(ALint *restrict delays, ALsizei offset, const ALsizei lfo_range, + const ALfloat lfo_scale, const ALfloat depth, const ALsizei delay, + const ALsizei todo) { - ALfloat lfo_value; - - lfo_value = 2.0f - fabsf(2.0f - state->lfo_scale*(offset%state->lfo_range)); - lfo_value *= state->depth * state->delay; - *delay_left = fastf2i(lfo_value) + state->delay; - - offset += state->lfo_disp; - lfo_value = 2.0f - fabsf(2.0f - state->lfo_scale*(offset%state->lfo_range)); - lfo_value *= state->depth * state->delay; - *delay_right = fastf2i(lfo_value) + state->delay; + ALsizei i; + for(i = 0;i < todo;i++) + { + delays[i] = fastf2i((1.0f - fabsf(2.0f - lfo_scale*offset)) * depth) + delay; + offset = (offset+1)%lfo_range; + } } -static inline void Sinusoid(ALint *delay_left, ALint *delay_right, ALuint offset, const ALchorusState *state) +static void GetSinusoidDelays(ALint *restrict delays, ALsizei offset, const ALsizei lfo_range, + const ALfloat lfo_scale, const ALfloat depth, const ALsizei delay, + const ALsizei todo) { - ALfloat lfo_value; - - lfo_value = 1.0f + sinf(state->lfo_scale*(offset%state->lfo_range)); - lfo_value *= state->depth * state->delay; - *delay_left = fastf2i(lfo_value) + state->delay; - - offset += state->lfo_disp; - lfo_value = 1.0f + sinf(state->lfo_scale*(offset%state->lfo_range)); - lfo_value *= state->depth * state->delay; - *delay_right = fastf2i(lfo_value) + state->delay; + ALsizei i; + for(i = 0;i < todo;i++) + { + delays[i] = fastf2i(sinf(lfo_scale*offset) * depth) + delay; + offset = (offset+1)%lfo_range; + } } -#define DECL_TEMPLATE(Func) \ -static void Process##Func(ALchorusState *state, const ALuint SamplesToDo, \ - const ALfloat *restrict SamplesIn, ALfloat (*restrict out)[2]) \ -{ \ - const ALuint bufmask = state->BufferLength-1; \ - ALfloat *restrict leftbuf = state->SampleBuffer[0]; \ - ALfloat *restrict rightbuf = state->SampleBuffer[1]; \ - ALuint offset = state->offset; \ - const ALfloat feedback = state->feedback; \ - ALuint it; \ - \ - for(it = 0;it < SamplesToDo;it++) \ - { \ - ALint delay_left, delay_right; \ - Func(&delay_left, &delay_right, offset, state); \ - \ - out[it][0] = leftbuf[(offset-delay_left)&bufmask]; \ - leftbuf[offset&bufmask] = (out[it][0]+SamplesIn[it]) * feedback; \ - \ - out[it][1] = rightbuf[(offset-delay_right)&bufmask]; \ - rightbuf[offset&bufmask] = (out[it][1]+SamplesIn[it]) * feedback; \ - \ - offset++; \ - } \ - state->offset = offset; \ -} -DECL_TEMPLATE(Triangle) -DECL_TEMPLATE(Sinusoid) - -#undef DECL_TEMPLATE - -static ALvoid ALchorusState_process(ALchorusState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) +static ALvoid ALchorusState_process(ALchorusState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) { - ALuint it, kt; - ALuint base; + const ALsizei bufmask = state->BufferLength-1; + const ALfloat feedback = state->feedback; + const ALsizei avgdelay = (state->delay + (FRACTIONONE>>1)) >> FRACTIONBITS; + ALfloat *restrict delaybuf = state->SampleBuffer; + ALsizei offset = state->offset; + ALsizei i, c; + ALsizei base; for(base = 0;base < SamplesToDo;) { - ALfloat temps[128][2]; - ALuint td = minu(128, SamplesToDo-base); + const ALsizei todo = mini(256, SamplesToDo-base); + ALint moddelays[2][256]; + alignas(16) ALfloat temps[2][256]; - switch(state->waveform) + if(state->waveform == WF_Sinusoid) { - case CWF_Triangle: - ProcessTriangle(state, td, SamplesIn[0]+base, temps); - break; - case CWF_Sinusoid: - ProcessSinusoid(state, td, SamplesIn[0]+base, temps); - break; + GetSinusoidDelays(moddelays[0], state->lfo_offset, state->lfo_range, state->lfo_scale, + state->depth, state->delay, todo); + GetSinusoidDelays(moddelays[1], (state->lfo_offset+state->lfo_disp)%state->lfo_range, + state->lfo_range, state->lfo_scale, state->depth, state->delay, + todo); + } + else /*if(state->waveform == WF_Triangle)*/ + { + GetTriangleDelays(moddelays[0], state->lfo_offset, state->lfo_range, state->lfo_scale, + state->depth, state->delay, todo); + GetTriangleDelays(moddelays[1], (state->lfo_offset+state->lfo_disp)%state->lfo_range, + state->lfo_range, state->lfo_scale, state->depth, state->delay, + todo); + } + state->lfo_offset = (state->lfo_offset+todo) % state->lfo_range; + + for(i = 0;i < todo;i++) + { + ALint delay; + ALfloat mu; + + // Feed the buffer's input first (necessary for delays < 1). + delaybuf[offset&bufmask] = SamplesIn[0][base+i]; + + // Tap for the left output. + delay = offset - (moddelays[0][i]>>FRACTIONBITS); + mu = (moddelays[0][i]&FRACTIONMASK) * (1.0f/FRACTIONONE); + temps[0][i] = cubic(delaybuf[(delay+1) & bufmask], delaybuf[(delay ) & bufmask], + delaybuf[(delay-1) & bufmask], delaybuf[(delay-2) & bufmask], + mu); + + // Tap for the right output. + delay = offset - (moddelays[1][i]>>FRACTIONBITS); + mu = (moddelays[1][i]&FRACTIONMASK) * (1.0f/FRACTIONONE); + temps[1][i] = cubic(delaybuf[(delay+1) & bufmask], delaybuf[(delay ) & bufmask], + delaybuf[(delay-1) & bufmask], delaybuf[(delay-2) & bufmask], + mu); + + // Accumulate feedback from the average delay of the taps. + delaybuf[offset&bufmask] += delaybuf[(offset-avgdelay) & bufmask] * feedback; + offset++; } - for(kt = 0;kt < NumChannels;kt++) - { - ALfloat gain = state->Gain[0][kt]; - if(fabsf(gain) > GAIN_SILENCE_THRESHOLD) - { - for(it = 0;it < td;it++) - SamplesOut[kt][it+base] += temps[it][0] * gain; - } + for(c = 0;c < 2;c++) + MixSamples(temps[c], NumChannels, SamplesOut, state->Gains[c].Current, + state->Gains[c].Target, SamplesToDo-base, base, todo); - gain = state->Gain[1][kt]; - if(fabsf(gain) > GAIN_SILENCE_THRESHOLD) - { - for(it = 0;it < td;it++) - SamplesOut[kt][it+base] += temps[it][1] * gain; - } - } - - base += td; + base += todo; } + + state->offset = offset; } -typedef struct ALchorusStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALchorusStateFactory; +typedef struct ChorusStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} ChorusStateFactory; -static ALeffectState *ALchorusStateFactory_create(ALchorusStateFactory *UNUSED(factory)) +static ALeffectState *ChorusStateFactory_create(ChorusStateFactory *UNUSED(factory)) { ALchorusState *state; @@ -284,14 +299,14 @@ static ALeffectState *ALchorusStateFactory_create(ALchorusStateFactory *UNUSED(f return STATIC_CAST(ALeffectState, state); } -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALchorusStateFactory); +DEFINE_EFFECTSTATEFACTORY_VTABLE(ChorusStateFactory); -ALeffectStateFactory *ALchorusStateFactory_getFactory(void) +EffectStateFactory *ChorusStateFactory_getFactory(void) { - static ALchorusStateFactory ChorusFactory = { { GET_VTABLE2(ALchorusStateFactory, ALeffectStateFactory) } }; + static ChorusStateFactory ChorusFactory = { { GET_VTABLE2(ChorusStateFactory, EffectStateFactory) } }; - return STATIC_CAST(ALeffectStateFactory, &ChorusFactory); + return STATIC_CAST(EffectStateFactory, &ChorusFactory); } @@ -302,24 +317,22 @@ void ALchorus_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALi { case AL_CHORUS_WAVEFORM: if(!(val >= AL_CHORUS_MIN_WAVEFORM && val <= AL_CHORUS_MAX_WAVEFORM)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Invalid chorus waveform"); props->Chorus.Waveform = val; break; case AL_CHORUS_PHASE: if(!(val >= AL_CHORUS_MIN_PHASE && val <= AL_CHORUS_MAX_PHASE)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Chorus phase out of range"); props->Chorus.Phase = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid chorus integer property 0x%04x", param); } } void ALchorus_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALchorus_setParami(effect, context, param, vals[0]); -} +{ ALchorus_setParami(effect, context, param, vals[0]); } void ALchorus_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { ALeffectProps *props = &effect->Props; @@ -327,36 +340,34 @@ void ALchorus_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALf { case AL_CHORUS_RATE: if(!(val >= AL_CHORUS_MIN_RATE && val <= AL_CHORUS_MAX_RATE)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Chorus rate out of range"); props->Chorus.Rate = val; break; case AL_CHORUS_DEPTH: if(!(val >= AL_CHORUS_MIN_DEPTH && val <= AL_CHORUS_MAX_DEPTH)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Chorus depth out of range"); props->Chorus.Depth = val; break; case AL_CHORUS_FEEDBACK: if(!(val >= AL_CHORUS_MIN_FEEDBACK && val <= AL_CHORUS_MAX_FEEDBACK)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Chorus feedback out of range"); props->Chorus.Feedback = val; break; case AL_CHORUS_DELAY: if(!(val >= AL_CHORUS_MIN_DELAY && val <= AL_CHORUS_MAX_DELAY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Chorus delay out of range"); props->Chorus.Delay = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid chorus float property 0x%04x", param); } } void ALchorus_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ALchorus_setParamf(effect, context, param, vals[0]); -} +{ ALchorus_setParamf(effect, context, param, vals[0]); } void ALchorus_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) { @@ -372,13 +383,11 @@ void ALchorus_getParami(const ALeffect *effect, ALCcontext *context, ALenum para break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid chorus integer property 0x%04x", param); } } void ALchorus_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALchorus_getParami(effect, context, param, vals); -} +{ ALchorus_getParami(effect, context, param, vals); } void ALchorus_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { const ALeffectProps *props = &effect->Props; @@ -401,12 +410,146 @@ void ALchorus_getParamf(const ALeffect *effect, ALCcontext *context, ALenum para break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid chorus float property 0x%04x", param); } } void ALchorus_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ALchorus_getParamf(effect, context, param, vals); -} +{ ALchorus_getParamf(effect, context, param, vals); } DEFINE_ALEFFECT_VTABLE(ALchorus); + + +/* Flanger is basically a chorus with a really short delay. They can both use + * the same processing functions, so piggyback flanger on the chorus functions. + */ +typedef struct FlangerStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} FlangerStateFactory; + +ALeffectState *FlangerStateFactory_create(FlangerStateFactory *UNUSED(factory)) +{ + ALchorusState *state; + + NEW_OBJ0(state, ALchorusState)(); + if(!state) return NULL; + + return STATIC_CAST(ALeffectState, state); +} + +DEFINE_EFFECTSTATEFACTORY_VTABLE(FlangerStateFactory); + +EffectStateFactory *FlangerStateFactory_getFactory(void) +{ + static FlangerStateFactory FlangerFactory = { { GET_VTABLE2(FlangerStateFactory, EffectStateFactory) } }; + + return STATIC_CAST(EffectStateFactory, &FlangerFactory); +} + + +void ALflanger_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +{ + ALeffectProps *props = &effect->Props; + switch(param) + { + case AL_FLANGER_WAVEFORM: + if(!(val >= AL_FLANGER_MIN_WAVEFORM && val <= AL_FLANGER_MAX_WAVEFORM)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "Invalid flanger waveform"); + props->Chorus.Waveform = val; + break; + + case AL_FLANGER_PHASE: + if(!(val >= AL_FLANGER_MIN_PHASE && val <= AL_FLANGER_MAX_PHASE)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "Flanger phase out of range"); + props->Chorus.Phase = val; + break; + + default: + alSetError(context, AL_INVALID_ENUM, "Invalid flanger integer property 0x%04x", param); + } +} +void ALflanger_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) +{ ALflanger_setParami(effect, context, param, vals[0]); } +void ALflanger_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) +{ + ALeffectProps *props = &effect->Props; + switch(param) + { + case AL_FLANGER_RATE: + if(!(val >= AL_FLANGER_MIN_RATE && val <= AL_FLANGER_MAX_RATE)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "Flanger rate out of range"); + props->Chorus.Rate = val; + break; + + case AL_FLANGER_DEPTH: + if(!(val >= AL_FLANGER_MIN_DEPTH && val <= AL_FLANGER_MAX_DEPTH)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "Flanger depth out of range"); + props->Chorus.Depth = val; + break; + + case AL_FLANGER_FEEDBACK: + if(!(val >= AL_FLANGER_MIN_FEEDBACK && val <= AL_FLANGER_MAX_FEEDBACK)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "Flanger feedback out of range"); + props->Chorus.Feedback = val; + break; + + case AL_FLANGER_DELAY: + if(!(val >= AL_FLANGER_MIN_DELAY && val <= AL_FLANGER_MAX_DELAY)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "Flanger delay out of range"); + props->Chorus.Delay = val; + break; + + default: + alSetError(context, AL_INVALID_ENUM, "Invalid flanger float property 0x%04x", param); + } +} +void ALflanger_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) +{ ALflanger_setParamf(effect, context, param, vals[0]); } + +void ALflanger_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +{ + const ALeffectProps *props = &effect->Props; + switch(param) + { + case AL_FLANGER_WAVEFORM: + *val = props->Chorus.Waveform; + break; + + case AL_FLANGER_PHASE: + *val = props->Chorus.Phase; + break; + + default: + alSetError(context, AL_INVALID_ENUM, "Invalid flanger integer property 0x%04x", param); + } +} +void ALflanger_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) +{ ALflanger_getParami(effect, context, param, vals); } +void ALflanger_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) +{ + const ALeffectProps *props = &effect->Props; + switch(param) + { + case AL_FLANGER_RATE: + *val = props->Chorus.Rate; + break; + + case AL_FLANGER_DEPTH: + *val = props->Chorus.Depth; + break; + + case AL_FLANGER_FEEDBACK: + *val = props->Chorus.Feedback; + break; + + case AL_FLANGER_DELAY: + *val = props->Chorus.Delay; + break; + + default: + alSetError(context, AL_INVALID_ENUM, "Invalid flanger float property 0x%04x", param); + } +} +void ALflanger_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) +{ ALflanger_getParamf(effect, context, param, vals); } + +DEFINE_ALEFFECT_VTABLE(ALflanger); diff --git a/Engine/lib/openal-soft/Alc/effects/compressor.c b/Engine/lib/openal-soft/Alc/effects/compressor.c index ab0a42167..4ec28f9aa 100644 --- a/Engine/lib/openal-soft/Alc/effects/compressor.c +++ b/Engine/lib/openal-soft/Alc/effects/compressor.c @@ -42,8 +42,8 @@ typedef struct ALcompressorState { static ALvoid ALcompressorState_Destruct(ALcompressorState *state); static ALboolean ALcompressorState_deviceUpdate(ALcompressorState *state, ALCdevice *device); -static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCdevice *device, const ALeffectslot *slot, const ALeffectProps *props); -static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); +static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props); +static ALvoid ALcompressorState_process(ALcompressorState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels); DECLARE_DEFAULT_ALLOCATORS(ALcompressorState) DEFINE_ALEFFECTSTATE_VTABLE(ALcompressorState); @@ -76,8 +76,9 @@ static ALboolean ALcompressorState_deviceUpdate(ALcompressorState *state, ALCdev return AL_TRUE; } -static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCdevice *device, const ALeffectslot *slot, const ALeffectProps *props) +static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props) { + const ALCdevice *device = context->Device; ALuint i; state->Enabled = props->Compressor.OnOff; @@ -85,19 +86,19 @@ static ALvoid ALcompressorState_update(ALcompressorState *state, const ALCdevice STATIC_CAST(ALeffectState,state)->OutBuffer = device->FOAOut.Buffer; STATIC_CAST(ALeffectState,state)->OutChannels = device->FOAOut.NumChannels; for(i = 0;i < 4;i++) - ComputeFirstOrderGains(device->FOAOut, IdentityMatrixf.m[i], + ComputeFirstOrderGains(&device->FOAOut, IdentityMatrixf.m[i], slot->Params.Gain, state->Gain[i]); } -static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) +static ALvoid ALcompressorState_process(ALcompressorState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) { - ALuint i, j, k; - ALuint base; + ALsizei i, j, k; + ALsizei base; for(base = 0;base < SamplesToDo;) { ALfloat temps[64][4]; - ALuint td = minu(64, SamplesToDo-base); + ALsizei td = mini(64, SamplesToDo-base); /* Load samples into the temp buffer first. */ for(j = 0;j < 4;j++) @@ -178,11 +179,11 @@ static ALvoid ALcompressorState_process(ALcompressorState *state, ALuint Samples } -typedef struct ALcompressorStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALcompressorStateFactory; +typedef struct CompressorStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} CompressorStateFactory; -static ALeffectState *ALcompressorStateFactory_create(ALcompressorStateFactory *UNUSED(factory)) +static ALeffectState *CompressorStateFactory_create(CompressorStateFactory *UNUSED(factory)) { ALcompressorState *state; @@ -192,13 +193,13 @@ static ALeffectState *ALcompressorStateFactory_create(ALcompressorStateFactory * return STATIC_CAST(ALeffectState, state); } -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALcompressorStateFactory); +DEFINE_EFFECTSTATEFACTORY_VTABLE(CompressorStateFactory); -ALeffectStateFactory *ALcompressorStateFactory_getFactory(void) +EffectStateFactory *CompressorStateFactory_getFactory(void) { - static ALcompressorStateFactory CompressorFactory = { { GET_VTABLE2(ALcompressorStateFactory, ALeffectStateFactory) } }; + static CompressorStateFactory CompressorFactory = { { GET_VTABLE2(CompressorStateFactory, EffectStateFactory) } }; - return STATIC_CAST(ALeffectStateFactory, &CompressorFactory); + return STATIC_CAST(EffectStateFactory, &CompressorFactory); } @@ -209,24 +210,21 @@ void ALcompressor_setParami(ALeffect *effect, ALCcontext *context, ALenum param, { case AL_COMPRESSOR_ONOFF: if(!(val >= AL_COMPRESSOR_MIN_ONOFF && val <= AL_COMPRESSOR_MAX_ONOFF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Compressor state out of range"); props->Compressor.OnOff = val; break; - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + default: + alSetError(context, AL_INVALID_ENUM, "Invalid compressor integer property 0x%04x", + param); } } void ALcompressor_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALcompressor_setParami(effect, context, param, vals[0]); -} -void ALcompressor_setParamf(ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALfloat UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALcompressor_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ALcompressor_setParamf(effect, context, param, vals[0]); -} +{ ALcompressor_setParami(effect, context, param, vals[0]); } +void ALcompressor_setParamf(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid compressor float property 0x%04x", param); } +void ALcompressor_setParamfv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALfloat *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid compressor float-vector property 0x%04x", param); } void ALcompressor_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) { @@ -236,19 +234,17 @@ void ALcompressor_getParami(const ALeffect *effect, ALCcontext *context, ALenum case AL_COMPRESSOR_ONOFF: *val = props->Compressor.OnOff; break; + default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid compressor integer property 0x%04x", + param); } } void ALcompressor_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALcompressor_getParami(effect, context, param, vals); -} -void ALcompressor_getParamf(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALfloat *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALcompressor_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ALcompressor_getParamf(effect, context, param, vals); -} +{ ALcompressor_getParami(effect, context, param, vals); } +void ALcompressor_getParamf(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid compressor float property 0x%04x", param); } +void ALcompressor_getParamfv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid compressor float-vector property 0x%04x", param); } DEFINE_ALEFFECT_VTABLE(ALcompressor); diff --git a/Engine/lib/openal-soft/Alc/effects/dedicated.c b/Engine/lib/openal-soft/Alc/effects/dedicated.c index 818cbb6bb..62a3894fe 100644 --- a/Engine/lib/openal-soft/Alc/effects/dedicated.c +++ b/Engine/lib/openal-soft/Alc/effects/dedicated.c @@ -23,22 +23,23 @@ #include #include "alMain.h" -#include "alFilter.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" +#include "filters/defs.h" typedef struct ALdedicatedState { DERIVE_FROM_TYPE(ALeffectState); - ALfloat gains[MAX_OUTPUT_CHANNELS]; + ALfloat CurrentGains[MAX_OUTPUT_CHANNELS]; + ALfloat TargetGains[MAX_OUTPUT_CHANNELS]; } ALdedicatedState; static ALvoid ALdedicatedState_Destruct(ALdedicatedState *state); static ALboolean ALdedicatedState_deviceUpdate(ALdedicatedState *state, ALCdevice *device); -static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCdevice *device, const ALeffectslot *Slot, const ALeffectProps *props); -static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); +static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props); +static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels); DECLARE_DEFAULT_ALLOCATORS(ALdedicatedState) DEFINE_ALEFFECTSTATE_VTABLE(ALdedicatedState); @@ -46,13 +47,8 @@ DEFINE_ALEFFECTSTATE_VTABLE(ALdedicatedState); static void ALdedicatedState_Construct(ALdedicatedState *state) { - ALsizei s; - ALeffectState_Construct(STATIC_CAST(ALeffectState, state)); SET_VTABLE2(ALdedicatedState, ALeffectState, state); - - for(s = 0;s < MAX_OUTPUT_CHANNELS;s++) - state->gains[s] = 0.0f; } static ALvoid ALdedicatedState_Destruct(ALdedicatedState *state) @@ -60,74 +56,69 @@ static ALvoid ALdedicatedState_Destruct(ALdedicatedState *state) ALeffectState_Destruct(STATIC_CAST(ALeffectState,state)); } -static ALboolean ALdedicatedState_deviceUpdate(ALdedicatedState *UNUSED(state), ALCdevice *UNUSED(device)) +static ALboolean ALdedicatedState_deviceUpdate(ALdedicatedState *state, ALCdevice *UNUSED(device)) { + ALsizei i; + for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) + state->CurrentGains[i] = 0.0f; return AL_TRUE; } -static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCdevice *device, const ALeffectslot *Slot, const ALeffectProps *props) +static ALvoid ALdedicatedState_update(ALdedicatedState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props) { + const ALCdevice *device = context->Device; ALfloat Gain; - ALuint i; + ALsizei i; for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) - state->gains[i] = 0.0f; + state->TargetGains[i] = 0.0f; - Gain = Slot->Params.Gain * props->Dedicated.Gain; - if(Slot->Params.EffectType == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT) + Gain = slot->Params.Gain * props->Dedicated.Gain; + if(slot->Params.EffectType == AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT) { int idx; - if((idx=GetChannelIdxByName(device->RealOut, LFE)) != -1) + if((idx=GetChannelIdxByName(&device->RealOut, LFE)) != -1) { STATIC_CAST(ALeffectState,state)->OutBuffer = device->RealOut.Buffer; STATIC_CAST(ALeffectState,state)->OutChannels = device->RealOut.NumChannels; - state->gains[idx] = Gain; + state->TargetGains[idx] = Gain; } } - else if(Slot->Params.EffectType == AL_EFFECT_DEDICATED_DIALOGUE) + else if(slot->Params.EffectType == AL_EFFECT_DEDICATED_DIALOGUE) { int idx; /* Dialog goes to the front-center speaker if it exists, otherwise it * plays from the front-center location. */ - if((idx=GetChannelIdxByName(device->RealOut, FrontCenter)) != -1) + if((idx=GetChannelIdxByName(&device->RealOut, FrontCenter)) != -1) { STATIC_CAST(ALeffectState,state)->OutBuffer = device->RealOut.Buffer; STATIC_CAST(ALeffectState,state)->OutChannels = device->RealOut.NumChannels; - state->gains[idx] = Gain; + state->TargetGains[idx] = Gain; } else { ALfloat coeffs[MAX_AMBI_COEFFS]; - CalcXYZCoeffs(0.0f, 0.0f, -1.0f, 0.0f, coeffs); + CalcAngleCoeffs(0.0f, 0.0f, 0.0f, coeffs); STATIC_CAST(ALeffectState,state)->OutBuffer = device->Dry.Buffer; STATIC_CAST(ALeffectState,state)->OutChannels = device->Dry.NumChannels; - ComputePanningGains(device->Dry, coeffs, Gain, state->gains); + ComputeDryPanGains(&device->Dry, coeffs, Gain, state->TargetGains); } } } -static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) +static ALvoid ALdedicatedState_process(ALdedicatedState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) { - const ALfloat *gains = state->gains; - ALuint i, c; - - for(c = 0;c < NumChannels;c++) - { - if(!(fabsf(gains[c]) > GAIN_SILENCE_THRESHOLD)) - continue; - - for(i = 0;i < SamplesToDo;i++) - SamplesOut[c][i] += SamplesIn[0][i] * gains[c]; - } + MixSamples(SamplesIn[0], NumChannels, SamplesOut, state->CurrentGains, + state->TargetGains, SamplesToDo, 0, SamplesToDo); } -typedef struct ALdedicatedStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALdedicatedStateFactory; +typedef struct DedicatedStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} DedicatedStateFactory; -ALeffectState *ALdedicatedStateFactory_create(ALdedicatedStateFactory *UNUSED(factory)) +ALeffectState *DedicatedStateFactory_create(DedicatedStateFactory *UNUSED(factory)) { ALdedicatedState *state; @@ -137,23 +128,21 @@ ALeffectState *ALdedicatedStateFactory_create(ALdedicatedStateFactory *UNUSED(fa return STATIC_CAST(ALeffectState, state); } -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALdedicatedStateFactory); +DEFINE_EFFECTSTATEFACTORY_VTABLE(DedicatedStateFactory); -ALeffectStateFactory *ALdedicatedStateFactory_getFactory(void) +EffectStateFactory *DedicatedStateFactory_getFactory(void) { - static ALdedicatedStateFactory DedicatedFactory = { { GET_VTABLE2(ALdedicatedStateFactory, ALeffectStateFactory) } }; + static DedicatedStateFactory DedicatedFactory = { { GET_VTABLE2(DedicatedStateFactory, EffectStateFactory) } }; - return STATIC_CAST(ALeffectStateFactory, &DedicatedFactory); + return STATIC_CAST(EffectStateFactory, &DedicatedFactory); } -void ALdedicated_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALdedicated_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALdedicated_setParami(effect, context, param, vals[0]); -} +void ALdedicated_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param); } +void ALdedicated_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x", param); } void ALdedicated_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { ALeffectProps *props = &effect->Props; @@ -161,25 +150,21 @@ void ALdedicated_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, { case AL_DEDICATED_GAIN: if(!(val >= 0.0f && isfinite(val))) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Dedicated gain out of range"); props->Dedicated.Gain = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param); } } void ALdedicated_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ALdedicated_setParamf(effect, context, param, vals[0]); -} +{ ALdedicated_setParamf(effect, context, param, vals[0]); } -void ALdedicated_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALdedicated_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALdedicated_getParami(effect, context, param, vals); -} +void ALdedicated_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid dedicated integer property 0x%04x", param); } +void ALdedicated_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid dedicated integer-vector property 0x%04x", param); } void ALdedicated_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { const ALeffectProps *props = &effect->Props; @@ -190,12 +175,10 @@ void ALdedicated_getParamf(const ALeffect *effect, ALCcontext *context, ALenum p break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid dedicated float property 0x%04x", param); } } void ALdedicated_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ALdedicated_getParamf(effect, context, param, vals); -} +{ ALdedicated_getParamf(effect, context, param, vals); } DEFINE_ALEFFECT_VTABLE(ALdedicated); diff --git a/Engine/lib/openal-soft/Alc/effects/distortion.c b/Engine/lib/openal-soft/Alc/effects/distortion.c index bc1e7d84f..f4e9969c0 100644 --- a/Engine/lib/openal-soft/Alc/effects/distortion.c +++ b/Engine/lib/openal-soft/Alc/effects/distortion.c @@ -24,10 +24,10 @@ #include #include "alMain.h" -#include "alFilter.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" +#include "filters/defs.h" typedef struct ALdistortionState { @@ -37,16 +37,18 @@ typedef struct ALdistortionState { ALfloat Gain[MAX_OUTPUT_CHANNELS]; /* Effect parameters */ - ALfilterState lowpass; - ALfilterState bandpass; + BiquadFilter lowpass; + BiquadFilter bandpass; ALfloat attenuation; ALfloat edge_coeff; + + ALfloat Buffer[2][BUFFERSIZE]; } ALdistortionState; static ALvoid ALdistortionState_Destruct(ALdistortionState *state); static ALboolean ALdistortionState_deviceUpdate(ALdistortionState *state, ALCdevice *device); -static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props); -static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); +static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props); +static ALvoid ALdistortionState_process(ALdistortionState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels); DECLARE_DEFAULT_ALLOCATORS(ALdistortionState) DEFINE_ALEFFECTSTATE_VTABLE(ALdistortionState); @@ -56,9 +58,6 @@ static void ALdistortionState_Construct(ALdistortionState *state) { ALeffectState_Construct(STATIC_CAST(ALeffectState, state)); SET_VTABLE2(ALdistortionState, ALeffectState, state); - - ALfilterState_clear(&state->lowpass); - ALfilterState_clear(&state->bandpass); } static ALvoid ALdistortionState_Destruct(ALdistortionState *state) @@ -66,125 +65,121 @@ static ALvoid ALdistortionState_Destruct(ALdistortionState *state) ALeffectState_Destruct(STATIC_CAST(ALeffectState,state)); } -static ALboolean ALdistortionState_deviceUpdate(ALdistortionState *UNUSED(state), ALCdevice *UNUSED(device)) +static ALboolean ALdistortionState_deviceUpdate(ALdistortionState *state, ALCdevice *UNUSED(device)) { + BiquadFilter_clear(&state->lowpass); + BiquadFilter_clear(&state->bandpass); return AL_TRUE; } -static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) +static ALvoid ALdistortionState_update(ALdistortionState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props) { - ALfloat frequency = (ALfloat)Device->Frequency; + const ALCdevice *device = context->Device; + ALfloat frequency = (ALfloat)device->Frequency; + ALfloat coeffs[MAX_AMBI_COEFFS]; ALfloat bandwidth; ALfloat cutoff; ALfloat edge; - /* Store distorted signal attenuation settings */ - state->attenuation = props->Distortion.Gain; - - /* Store waveshaper edge settings */ + /* Store waveshaper edge settings. */ edge = sinf(props->Distortion.Edge * (F_PI_2)); edge = minf(edge, 0.99f); state->edge_coeff = 2.0f * edge / (1.0f-edge); - /* Lowpass filter */ cutoff = props->Distortion.LowpassCutoff; - /* Bandwidth value is constant in octaves */ + /* Bandwidth value is constant in octaves. */ bandwidth = (cutoff / 2.0f) / (cutoff * 0.67f); - ALfilterState_setParams(&state->lowpass, ALfilterType_LowPass, 1.0f, + /* Multiply sampling frequency by the amount of oversampling done during + * processing. + */ + BiquadFilter_setParams(&state->lowpass, BiquadType_LowPass, 1.0f, cutoff / (frequency*4.0f), calc_rcpQ_from_bandwidth(cutoff / (frequency*4.0f), bandwidth) ); - /* Bandpass filter */ cutoff = props->Distortion.EQCenter; - /* Convert bandwidth in Hz to octaves */ + /* Convert bandwidth in Hz to octaves. */ bandwidth = props->Distortion.EQBandwidth / (cutoff * 0.67f); - ALfilterState_setParams(&state->bandpass, ALfilterType_BandPass, 1.0f, + BiquadFilter_setParams(&state->bandpass, BiquadType_BandPass, 1.0f, cutoff / (frequency*4.0f), calc_rcpQ_from_bandwidth(cutoff / (frequency*4.0f), bandwidth) ); - ComputeAmbientGains(Device->Dry, Slot->Params.Gain, state->Gain); + CalcAngleCoeffs(0.0f, 0.0f, 0.0f, coeffs); + ComputeDryPanGains(&device->Dry, coeffs, slot->Params.Gain * props->Distortion.Gain, + state->Gain); } -static ALvoid ALdistortionState_process(ALdistortionState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) +static ALvoid ALdistortionState_process(ALdistortionState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) { + ALfloat (*restrict buffer)[BUFFERSIZE] = state->Buffer; const ALfloat fc = state->edge_coeff; - ALuint base; - ALuint it; - ALuint ot; - ALuint kt; + ALsizei base; + ALsizei i, k; for(base = 0;base < SamplesToDo;) { - float buffer[2][64 * 4]; - ALuint td = minu(64, SamplesToDo-base); + /* Perform 4x oversampling to avoid aliasing. Oversampling greatly + * improves distortion quality and allows to implement lowpass and + * bandpass filters using high frequencies, at which classic IIR + * filters became unstable. + */ + ALsizei todo = mini(BUFFERSIZE, (SamplesToDo-base) * 4); - /* Perform 4x oversampling to avoid aliasing. */ - /* Oversampling greatly improves distortion */ - /* quality and allows to implement lowpass and */ - /* bandpass filters using high frequencies, at */ - /* which classic IIR filters became unstable. */ + /* Fill oversample buffer using zero stuffing. Multiply the sample by + * the amount of oversampling to maintain the signal's power. + */ + for(i = 0;i < todo;i++) + buffer[0][i] = !(i&3) ? SamplesIn[0][(i>>2)+base] * 4.0f : 0.0f; - /* Fill oversample buffer using zero stuffing */ - for(it = 0;it < td;it++) + /* First step, do lowpass filtering of original signal. Additionally + * perform buffer interpolation and lowpass cutoff for oversampling + * (which is fortunately first step of distortion). So combine three + * operations into the one. + */ + BiquadFilter_process(&state->lowpass, buffer[1], buffer[0], todo); + + /* Second step, do distortion using waveshaper function to emulate + * signal processing during tube overdriving. Three steps of + * waveshaping are intended to modify waveform without boost/clipping/ + * attenuation process. + */ + for(i = 0;i < todo;i++) { - buffer[0][it*4 + 0] = SamplesIn[0][it+base]; - buffer[0][it*4 + 1] = 0.0f; - buffer[0][it*4 + 2] = 0.0f; - buffer[0][it*4 + 3] = 0.0f; + ALfloat smp = buffer[1][i]; + + smp = (1.0f + fc) * smp/(1.0f + fc*fabsf(smp)); + smp = (1.0f + fc) * smp/(1.0f + fc*fabsf(smp)) * -1.0f; + smp = (1.0f + fc) * smp/(1.0f + fc*fabsf(smp)); + + buffer[0][i] = smp; } - /* First step, do lowpass filtering of original signal, */ - /* additionally perform buffer interpolation and lowpass */ - /* cutoff for oversampling (which is fortunately first */ - /* step of distortion). So combine three operations into */ - /* the one. */ - ALfilterState_process(&state->lowpass, buffer[1], buffer[0], td*4); + /* Third step, do bandpass filtering of distorted signal. */ + BiquadFilter_process(&state->bandpass, buffer[1], buffer[0], todo); - /* Second step, do distortion using waveshaper function */ - /* to emulate signal processing during tube overdriving. */ - /* Three steps of waveshaping are intended to modify */ - /* waveform without boost/clipping/attenuation process. */ - for(it = 0;it < td;it++) - { - for(ot = 0;ot < 4;ot++) - { - /* Restore signal power by multiplying sample by amount of oversampling */ - ALfloat smp = buffer[1][it*4 + ot] * 4.0f; - - smp = (1.0f + fc) * smp/(1.0f + fc*fabsf(smp)); - smp = (1.0f + fc) * smp/(1.0f + fc*fabsf(smp)) * -1.0f; - smp = (1.0f + fc) * smp/(1.0f + fc*fabsf(smp)); - - buffer[1][it*4 + ot] = smp; - } - } - - /* Third step, do bandpass filtering of distorted signal */ - ALfilterState_process(&state->bandpass, buffer[0], buffer[1], td*4); - - for(kt = 0;kt < NumChannels;kt++) + todo >>= 2; + for(k = 0;k < NumChannels;k++) { /* Fourth step, final, do attenuation and perform decimation, - * store only one sample out of 4. + * storing only one sample out of four. */ - ALfloat gain = state->Gain[kt] * state->attenuation; + ALfloat gain = state->Gain[k]; if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) continue; - for(it = 0;it < td;it++) - SamplesOut[kt][base+it] += gain * buffer[0][it*4]; + for(i = 0;i < todo;i++) + SamplesOut[k][base+i] += gain * buffer[1][i*4]; } - base += td; + base += todo; } } -typedef struct ALdistortionStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALdistortionStateFactory; +typedef struct DistortionStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} DistortionStateFactory; -static ALeffectState *ALdistortionStateFactory_create(ALdistortionStateFactory *UNUSED(factory)) +static ALeffectState *DistortionStateFactory_create(DistortionStateFactory *UNUSED(factory)) { ALdistortionState *state; @@ -194,23 +189,21 @@ static ALeffectState *ALdistortionStateFactory_create(ALdistortionStateFactory * return STATIC_CAST(ALeffectState, state); } -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALdistortionStateFactory); +DEFINE_EFFECTSTATEFACTORY_VTABLE(DistortionStateFactory); -ALeffectStateFactory *ALdistortionStateFactory_getFactory(void) +EffectStateFactory *DistortionStateFactory_getFactory(void) { - static ALdistortionStateFactory DistortionFactory = { { GET_VTABLE2(ALdistortionStateFactory, ALeffectStateFactory) } }; + static DistortionStateFactory DistortionFactory = { { GET_VTABLE2(DistortionStateFactory, EffectStateFactory) } }; - return STATIC_CAST(ALeffectStateFactory, &DistortionFactory); + return STATIC_CAST(EffectStateFactory, &DistortionFactory); } -void ALdistortion_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALdistortion_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALdistortion_setParami(effect, context, param, vals[0]); -} +void ALdistortion_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid distortion integer property 0x%04x", param); } +void ALdistortion_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid distortion integer-vector property 0x%04x", param); } void ALdistortion_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { ALeffectProps *props = &effect->Props; @@ -218,49 +211,46 @@ void ALdistortion_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, { case AL_DISTORTION_EDGE: if(!(val >= AL_DISTORTION_MIN_EDGE && val <= AL_DISTORTION_MAX_EDGE)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Distortion edge out of range"); props->Distortion.Edge = val; break; case AL_DISTORTION_GAIN: if(!(val >= AL_DISTORTION_MIN_GAIN && val <= AL_DISTORTION_MAX_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Distortion gain out of range"); props->Distortion.Gain = val; break; case AL_DISTORTION_LOWPASS_CUTOFF: if(!(val >= AL_DISTORTION_MIN_LOWPASS_CUTOFF && val <= AL_DISTORTION_MAX_LOWPASS_CUTOFF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Distortion low-pass cutoff out of range"); props->Distortion.LowpassCutoff = val; break; case AL_DISTORTION_EQCENTER: if(!(val >= AL_DISTORTION_MIN_EQCENTER && val <= AL_DISTORTION_MAX_EQCENTER)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Distortion EQ center out of range"); props->Distortion.EQCenter = val; break; case AL_DISTORTION_EQBANDWIDTH: if(!(val >= AL_DISTORTION_MIN_EQBANDWIDTH && val <= AL_DISTORTION_MAX_EQBANDWIDTH)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Distortion EQ bandwidth out of range"); props->Distortion.EQBandwidth = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid distortion float property 0x%04x", + param); } } void ALdistortion_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ALdistortion_setParamf(effect, context, param, vals[0]); -} +{ ALdistortion_setParamf(effect, context, param, vals[0]); } -void ALdistortion_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALdistortion_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALdistortion_getParami(effect, context, param, vals); -} +void ALdistortion_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid distortion integer property 0x%04x", param); } +void ALdistortion_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid distortion integer-vector property 0x%04x", param); } void ALdistortion_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { const ALeffectProps *props = &effect->Props; @@ -287,12 +277,11 @@ void ALdistortion_getParamf(const ALeffect *effect, ALCcontext *context, ALenum break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid distortion float property 0x%04x", + param); } } void ALdistortion_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ALdistortion_getParamf(effect, context, param, vals); -} +{ ALdistortion_getParamf(effect, context, param, vals); } DEFINE_ALEFFECT_VTABLE(ALdistortion); diff --git a/Engine/lib/openal-soft/Alc/effects/echo.c b/Engine/lib/openal-soft/Alc/effects/echo.c index 3ad1e9752..676b17e8e 100644 --- a/Engine/lib/openal-soft/Alc/effects/echo.c +++ b/Engine/lib/openal-soft/Alc/effects/echo.c @@ -28,32 +28,37 @@ #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" +#include "filters/defs.h" typedef struct ALechoState { DERIVE_FROM_TYPE(ALeffectState); ALfloat *SampleBuffer; - ALuint BufferLength; + ALsizei BufferLength; // The echo is two tap. The delay is the number of samples from before the // current offset struct { - ALuint delay; + ALsizei delay; } Tap[2]; - ALuint Offset; + ALsizei Offset; + /* The panning gains for the two taps */ - ALfloat Gain[2][MAX_OUTPUT_CHANNELS]; + struct { + ALfloat Current[MAX_OUTPUT_CHANNELS]; + ALfloat Target[MAX_OUTPUT_CHANNELS]; + } Gains[2]; ALfloat FeedGain; - ALfilterState Filter; + BiquadFilter Filter; } ALechoState; static ALvoid ALechoState_Destruct(ALechoState *state); static ALboolean ALechoState_deviceUpdate(ALechoState *state, ALCdevice *Device); -static ALvoid ALechoState_update(ALechoState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props); -static ALvoid ALechoState_process(ALechoState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); +static ALvoid ALechoState_update(ALechoState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props); +static ALvoid ALechoState_process(ALechoState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels); DECLARE_DEFAULT_ALLOCATORS(ALechoState) DEFINE_ALEFFECTSTATE_VTABLE(ALechoState); @@ -71,7 +76,7 @@ static void ALechoState_Construct(ALechoState *state) state->Tap[1].delay = 0; state->Offset = 0; - ALfilterState_clear(&state->Filter); + BiquadFilter_clear(&state->Filter); } static ALvoid ALechoState_Destruct(ALechoState *state) @@ -83,13 +88,14 @@ static ALvoid ALechoState_Destruct(ALechoState *state) static ALboolean ALechoState_deviceUpdate(ALechoState *state, ALCdevice *Device) { - ALuint maxlen, i; + ALsizei maxlen; // Use the next power of 2 for the buffer length, so the tap offsets can be // wrapped using a mask instead of a modulo - maxlen = fastf2u(AL_ECHO_MAX_DELAY * Device->Frequency) + 1; - maxlen += fastf2u(AL_ECHO_MAX_LRDELAY * Device->Frequency) + 1; - maxlen = NextPowerOf2(maxlen); + maxlen = float2int(AL_ECHO_MAX_DELAY*Device->Frequency + 0.5f) + + float2int(AL_ECHO_MAX_LRDELAY*Device->Frequency + 0.5f); + maxlen = NextPowerOf2(maxlen); + if(maxlen <= 0) return AL_FALSE; if(maxlen != state->BufferLength) { @@ -100,20 +106,22 @@ static ALboolean ALechoState_deviceUpdate(ALechoState *state, ALCdevice *Device) state->SampleBuffer = temp; state->BufferLength = maxlen; } - for(i = 0;i < state->BufferLength;i++) - state->SampleBuffer[i] = 0.0f; + + memset(state->SampleBuffer, 0, state->BufferLength*sizeof(ALfloat)); + memset(state->Gains, 0, sizeof(state->Gains)); return AL_TRUE; } -static ALvoid ALechoState_update(ALechoState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) +static ALvoid ALechoState_update(ALechoState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props) { - ALuint frequency = Device->Frequency; + const ALCdevice *device = context->Device; + ALuint frequency = device->Frequency; ALfloat coeffs[MAX_AMBI_COEFFS]; - ALfloat gain, lrpan, spread; + ALfloat gainhf, lrpan, spread; - state->Tap[0].delay = fastf2u(props->Echo.Delay * frequency) + 1; - state->Tap[1].delay = fastf2u(props->Echo.LRDelay * frequency); + state->Tap[0].delay = maxi(float2int(props->Echo.Delay*frequency + 0.5f), 1); + state->Tap[1].delay = float2int(props->Echo.LRDelay*frequency + 0.5f); state->Tap[1].delay += state->Tap[0].delay; spread = props->Echo.Spread; @@ -126,94 +134,78 @@ static ALvoid ALechoState_update(ALechoState *state, const ALCdevice *Device, co state->FeedGain = props->Echo.Feedback; - gain = minf(1.0f - props->Echo.Damping, 0.01f); - ALfilterState_setParams(&state->Filter, ALfilterType_HighShelf, - gain, LOWPASSFREQREF/frequency, - calc_rcpQ_from_slope(gain, 0.75f)); - - gain = Slot->Params.Gain; + gainhf = maxf(1.0f - props->Echo.Damping, 0.0625f); /* Limit -24dB */ + BiquadFilter_setParams(&state->Filter, BiquadType_HighShelf, + gainhf, LOWPASSFREQREF/frequency, calc_rcpQ_from_slope(gainhf, 1.0f) + ); /* First tap panning */ - CalcXYZCoeffs(-lrpan, 0.0f, 0.0f, spread, coeffs); - ComputePanningGains(Device->Dry, coeffs, gain, state->Gain[0]); + CalcAngleCoeffs(-F_PI_2*lrpan, 0.0f, spread, coeffs); + ComputeDryPanGains(&device->Dry, coeffs, slot->Params.Gain, state->Gains[0].Target); /* Second tap panning */ - CalcXYZCoeffs( lrpan, 0.0f, 0.0f, spread, coeffs); - ComputePanningGains(Device->Dry, coeffs, gain, state->Gain[1]); + CalcAngleCoeffs( F_PI_2*lrpan, 0.0f, spread, coeffs); + ComputeDryPanGains(&device->Dry, coeffs, slot->Params.Gain, state->Gains[1].Target); } -static ALvoid ALechoState_process(ALechoState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) +static ALvoid ALechoState_process(ALechoState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) { - const ALuint mask = state->BufferLength-1; - const ALuint tap1 = state->Tap[0].delay; - const ALuint tap2 = state->Tap[1].delay; - ALuint offset = state->Offset; - ALfloat x[2], y[2], in, out; - ALuint base; - ALuint i, k; + const ALsizei mask = state->BufferLength-1; + const ALsizei tap1 = state->Tap[0].delay; + const ALsizei tap2 = state->Tap[1].delay; + ALfloat *restrict delaybuf = state->SampleBuffer; + ALsizei offset = state->Offset; + ALfloat z1, z2, in, out; + ALsizei base; + ALsizei c, i; - x[0] = state->Filter.x[0]; - x[1] = state->Filter.x[1]; - y[0] = state->Filter.y[0]; - y[1] = state->Filter.y[1]; + z1 = state->Filter.z1; + z2 = state->Filter.z2; for(base = 0;base < SamplesToDo;) { - ALfloat temps[128][2]; - ALuint td = minu(128, SamplesToDo-base); + alignas(16) ALfloat temps[2][128]; + ALsizei td = mini(128, SamplesToDo-base); for(i = 0;i < td;i++) { + /* Feed the delay buffer's input first. */ + delaybuf[offset&mask] = SamplesIn[0][i+base]; + /* First tap */ - temps[i][0] = state->SampleBuffer[(offset-tap1) & mask]; + temps[0][i] = delaybuf[(offset-tap1) & mask]; /* Second tap */ - temps[i][1] = state->SampleBuffer[(offset-tap2) & mask]; + temps[1][i] = delaybuf[(offset-tap2) & mask]; - // Apply damping and feedback gain to the second tap, and mix in the - // new sample - in = temps[i][1] + SamplesIn[0][i+base]; - out = in*state->Filter.b0 + - x[0]*state->Filter.b1 + x[1]*state->Filter.b2 - - y[0]*state->Filter.a1 - y[1]*state->Filter.a2; - x[1] = x[0]; x[0] = in; - y[1] = y[0]; y[0] = out; + /* Apply damping to the second tap, then add it to the buffer with + * feedback attenuation. + */ + in = temps[1][i]; + out = in*state->Filter.b0 + z1; + z1 = in*state->Filter.b1 - out*state->Filter.a1 + z2; + z2 = in*state->Filter.b2 - out*state->Filter.a2; - state->SampleBuffer[offset&mask] = out * state->FeedGain; + delaybuf[offset&mask] += out * state->FeedGain; offset++; } - for(k = 0;k < NumChannels;k++) - { - ALfloat gain = state->Gain[0][k]; - if(fabsf(gain) > GAIN_SILENCE_THRESHOLD) - { - for(i = 0;i < td;i++) - SamplesOut[k][i+base] += temps[i][0] * gain; - } - - gain = state->Gain[1][k]; - if(fabsf(gain) > GAIN_SILENCE_THRESHOLD) - { - for(i = 0;i < td;i++) - SamplesOut[k][i+base] += temps[i][1] * gain; - } - } + for(c = 0;c < 2;c++) + MixSamples(temps[c], NumChannels, SamplesOut, state->Gains[c].Current, + state->Gains[c].Target, SamplesToDo-base, base, td); base += td; } - state->Filter.x[0] = x[0]; - state->Filter.x[1] = x[1]; - state->Filter.y[0] = y[0]; - state->Filter.y[1] = y[1]; + state->Filter.z1 = z1; + state->Filter.z2 = z2; state->Offset = offset; } -typedef struct ALechoStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALechoStateFactory; +typedef struct EchoStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} EchoStateFactory; -ALeffectState *ALechoStateFactory_create(ALechoStateFactory *UNUSED(factory)) +ALeffectState *EchoStateFactory_create(EchoStateFactory *UNUSED(factory)) { ALechoState *state; @@ -223,22 +215,20 @@ ALeffectState *ALechoStateFactory_create(ALechoStateFactory *UNUSED(factory)) return STATIC_CAST(ALeffectState, state); } -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALechoStateFactory); +DEFINE_EFFECTSTATEFACTORY_VTABLE(EchoStateFactory); -ALeffectStateFactory *ALechoStateFactory_getFactory(void) +EffectStateFactory *EchoStateFactory_getFactory(void) { - static ALechoStateFactory EchoFactory = { { GET_VTABLE2(ALechoStateFactory, ALeffectStateFactory) } }; + static EchoStateFactory EchoFactory = { { GET_VTABLE2(EchoStateFactory, EffectStateFactory) } }; - return STATIC_CAST(ALeffectStateFactory, &EchoFactory); + return STATIC_CAST(EffectStateFactory, &EchoFactory); } -void ALecho_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALecho_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALecho_setParami(effect, context, param, vals[0]); -} +void ALecho_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid echo integer property 0x%04x", param); } +void ALecho_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid echo integer-vector property 0x%04x", param); } void ALecho_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { ALeffectProps *props = &effect->Props; @@ -246,49 +236,45 @@ void ALecho_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALflo { case AL_ECHO_DELAY: if(!(val >= AL_ECHO_MIN_DELAY && val <= AL_ECHO_MAX_DELAY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Echo delay out of range"); props->Echo.Delay = val; break; case AL_ECHO_LRDELAY: if(!(val >= AL_ECHO_MIN_LRDELAY && val <= AL_ECHO_MAX_LRDELAY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Echo LR delay out of range"); props->Echo.LRDelay = val; break; case AL_ECHO_DAMPING: if(!(val >= AL_ECHO_MIN_DAMPING && val <= AL_ECHO_MAX_DAMPING)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Echo damping out of range"); props->Echo.Damping = val; break; case AL_ECHO_FEEDBACK: if(!(val >= AL_ECHO_MIN_FEEDBACK && val <= AL_ECHO_MAX_FEEDBACK)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Echo feedback out of range"); props->Echo.Feedback = val; break; case AL_ECHO_SPREAD: if(!(val >= AL_ECHO_MIN_SPREAD && val <= AL_ECHO_MAX_SPREAD)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Echo spread out of range"); props->Echo.Spread = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid echo float property 0x%04x", param); } } void ALecho_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ALecho_setParamf(effect, context, param, vals[0]); -} +{ ALecho_setParamf(effect, context, param, vals[0]); } -void ALecho_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALecho_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALecho_getParami(effect, context, param, vals); -} +void ALecho_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid echo integer property 0x%04x", param); } +void ALecho_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid echo integer-vector property 0x%04x", param); } void ALecho_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { const ALeffectProps *props = &effect->Props; @@ -315,12 +301,10 @@ void ALecho_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid echo float property 0x%04x", param); } } void ALecho_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ALecho_getParamf(effect, context, param, vals); -} +{ ALecho_getParamf(effect, context, param, vals); } DEFINE_ALEFFECT_VTABLE(ALecho); diff --git a/Engine/lib/openal-soft/Alc/effects/equalizer.c b/Engine/lib/openal-soft/Alc/effects/equalizer.c index 1a63b4181..8ff56fb5d 100644 --- a/Engine/lib/openal-soft/Alc/effects/equalizer.c +++ b/Engine/lib/openal-soft/Alc/effects/equalizer.c @@ -24,10 +24,10 @@ #include #include "alMain.h" -#include "alFilter.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" +#include "filters/defs.h" /* The document "Effects Extension Guide.pdf" says that low and high * @@ -72,25 +72,25 @@ * http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt */ -/* The maximum number of sample frames per update. */ -#define MAX_UPDATE_SAMPLES 256 - typedef struct ALequalizerState { DERIVE_FROM_TYPE(ALeffectState); - /* Effect gains for each channel */ - ALfloat Gain[MAX_EFFECT_CHANNELS][MAX_OUTPUT_CHANNELS]; + struct { + /* Effect gains for each channel */ + ALfloat CurrentGains[MAX_OUTPUT_CHANNELS]; + ALfloat TargetGains[MAX_OUTPUT_CHANNELS]; - /* Effect parameters */ - ALfilterState filter[4][MAX_EFFECT_CHANNELS]; + /* Effect parameters */ + BiquadFilter filter[4]; + } Chans[MAX_EFFECT_CHANNELS]; - ALfloat SampleBuffer[4][MAX_EFFECT_CHANNELS][MAX_UPDATE_SAMPLES]; + ALfloat SampleBuffer[MAX_EFFECT_CHANNELS][BUFFERSIZE]; } ALequalizerState; static ALvoid ALequalizerState_Destruct(ALequalizerState *state); static ALboolean ALequalizerState_deviceUpdate(ALequalizerState *state, ALCdevice *device); -static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice *device, const ALeffectslot *slot, const ALeffectProps *props); -static ALvoid ALequalizerState_process(ALequalizerState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); +static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props); +static ALvoid ALequalizerState_process(ALequalizerState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels); DECLARE_DEFAULT_ALLOCATORS(ALequalizerState) DEFINE_ALEFFECTSTATE_VTABLE(ALequalizerState); @@ -98,18 +98,8 @@ DEFINE_ALEFFECTSTATE_VTABLE(ALequalizerState); static void ALequalizerState_Construct(ALequalizerState *state) { - int it, ft; - ALeffectState_Construct(STATIC_CAST(ALeffectState, state)); SET_VTABLE2(ALequalizerState, ALeffectState, state); - - /* Initialize sample history only on filter creation to avoid */ - /* sound clicks if filter settings were changed in runtime. */ - for(it = 0; it < 4; it++) - { - for(ft = 0;ft < MAX_EFFECT_CHANNELS;ft++) - ALfilterState_clear(&state->filter[it][ft]); - } } static ALvoid ALequalizerState_Destruct(ALequalizerState *state) @@ -117,131 +107,100 @@ static ALvoid ALequalizerState_Destruct(ALequalizerState *state) ALeffectState_Destruct(STATIC_CAST(ALeffectState,state)); } -static ALboolean ALequalizerState_deviceUpdate(ALequalizerState *UNUSED(state), ALCdevice *UNUSED(device)) +static ALboolean ALequalizerState_deviceUpdate(ALequalizerState *state, ALCdevice *UNUSED(device)) { + ALsizei i, j; + + for(i = 0; i < MAX_EFFECT_CHANNELS;i++) + { + for(j = 0;j < 4;j++) + BiquadFilter_clear(&state->Chans[i].filter[j]); + for(j = 0;j < MAX_OUTPUT_CHANNELS;j++) + state->Chans[i].CurrentGains[j] = 0.0f; + } return AL_TRUE; } -static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCdevice *device, const ALeffectslot *slot, const ALeffectProps *props) +static ALvoid ALequalizerState_update(ALequalizerState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props) { + const ALCdevice *device = context->Device; ALfloat frequency = (ALfloat)device->Frequency; - ALfloat gain, freq_mult; + ALfloat gain, f0norm; ALuint i; STATIC_CAST(ALeffectState,state)->OutBuffer = device->FOAOut.Buffer; STATIC_CAST(ALeffectState,state)->OutChannels = device->FOAOut.NumChannels; for(i = 0;i < MAX_EFFECT_CHANNELS;i++) - ComputeFirstOrderGains(device->FOAOut, IdentityMatrixf.m[i], - slot->Params.Gain, state->Gain[i]); + ComputeFirstOrderGains(&device->FOAOut, IdentityMatrixf.m[i], + slot->Params.Gain, state->Chans[i].TargetGains); /* Calculate coefficients for the each type of filter. Note that the shelf * filters' gain is for the reference frequency, which is the centerpoint * of the transition band. */ - gain = sqrtf(props->Equalizer.LowGain); - freq_mult = props->Equalizer.LowCutoff/frequency; - ALfilterState_setParams(&state->filter[0][0], ALfilterType_LowShelf, - gain, freq_mult, calc_rcpQ_from_slope(gain, 0.75f) + gain = maxf(sqrtf(props->Equalizer.LowGain), 0.0625f); /* Limit -24dB */ + f0norm = props->Equalizer.LowCutoff/frequency; + BiquadFilter_setParams(&state->Chans[0].filter[0], BiquadType_LowShelf, + gain, f0norm, calc_rcpQ_from_slope(gain, 0.75f) ); + + gain = maxf(props->Equalizer.Mid1Gain, 0.0625f); + f0norm = props->Equalizer.Mid1Center/frequency; + BiquadFilter_setParams(&state->Chans[0].filter[1], BiquadType_Peaking, + gain, f0norm, calc_rcpQ_from_bandwidth( + f0norm, props->Equalizer.Mid1Width + ) + ); + + gain = maxf(props->Equalizer.Mid2Gain, 0.0625f); + f0norm = props->Equalizer.Mid2Center/frequency; + BiquadFilter_setParams(&state->Chans[0].filter[2], BiquadType_Peaking, + gain, f0norm, calc_rcpQ_from_bandwidth( + f0norm, props->Equalizer.Mid2Width + ) + ); + + gain = maxf(sqrtf(props->Equalizer.HighGain), 0.0625f); + f0norm = props->Equalizer.HighCutoff/frequency; + BiquadFilter_setParams(&state->Chans[0].filter[3], BiquadType_HighShelf, + gain, f0norm, calc_rcpQ_from_slope(gain, 0.75f) + ); + /* Copy the filter coefficients for the other input channels. */ for(i = 1;i < MAX_EFFECT_CHANNELS;i++) { - state->filter[0][i].a1 = state->filter[0][0].a1; - state->filter[0][i].a2 = state->filter[0][0].a2; - state->filter[0][i].b0 = state->filter[0][0].b0; - state->filter[0][i].b1 = state->filter[0][0].b1; - state->filter[0][i].b2 = state->filter[0][0].b2; - } - - gain = props->Equalizer.Mid1Gain; - freq_mult = props->Equalizer.Mid1Center/frequency; - ALfilterState_setParams(&state->filter[1][0], ALfilterType_Peaking, - gain, freq_mult, calc_rcpQ_from_bandwidth( - freq_mult, props->Equalizer.Mid1Width - ) - ); - for(i = 1;i < MAX_EFFECT_CHANNELS;i++) - { - state->filter[1][i].a1 = state->filter[1][0].a1; - state->filter[1][i].a2 = state->filter[1][0].a2; - state->filter[1][i].b0 = state->filter[1][0].b0; - state->filter[1][i].b1 = state->filter[1][0].b1; - state->filter[1][i].b2 = state->filter[1][0].b2; - } - - gain = props->Equalizer.Mid2Gain; - freq_mult = props->Equalizer.Mid2Center/frequency; - ALfilterState_setParams(&state->filter[2][0], ALfilterType_Peaking, - gain, freq_mult, calc_rcpQ_from_bandwidth( - freq_mult, props->Equalizer.Mid2Width - ) - ); - for(i = 1;i < MAX_EFFECT_CHANNELS;i++) - { - state->filter[2][i].a1 = state->filter[2][0].a1; - state->filter[2][i].a2 = state->filter[2][0].a2; - state->filter[2][i].b0 = state->filter[2][0].b0; - state->filter[2][i].b1 = state->filter[2][0].b1; - state->filter[2][i].b2 = state->filter[2][0].b2; - } - - gain = sqrtf(props->Equalizer.HighGain); - freq_mult = props->Equalizer.HighCutoff/frequency; - ALfilterState_setParams(&state->filter[3][0], ALfilterType_HighShelf, - gain, freq_mult, calc_rcpQ_from_slope(gain, 0.75f) - ); - for(i = 1;i < MAX_EFFECT_CHANNELS;i++) - { - state->filter[3][i].a1 = state->filter[3][0].a1; - state->filter[3][i].a2 = state->filter[3][0].a2; - state->filter[3][i].b0 = state->filter[3][0].b0; - state->filter[3][i].b1 = state->filter[3][0].b1; - state->filter[3][i].b2 = state->filter[3][0].b2; + BiquadFilter_copyParams(&state->Chans[i].filter[0], &state->Chans[0].filter[0]); + BiquadFilter_copyParams(&state->Chans[i].filter[1], &state->Chans[0].filter[1]); + BiquadFilter_copyParams(&state->Chans[i].filter[2], &state->Chans[0].filter[2]); + BiquadFilter_copyParams(&state->Chans[i].filter[3], &state->Chans[0].filter[3]); } } -static ALvoid ALequalizerState_process(ALequalizerState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) +static ALvoid ALequalizerState_process(ALequalizerState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) { - ALfloat (*Samples)[MAX_EFFECT_CHANNELS][MAX_UPDATE_SAMPLES] = state->SampleBuffer; - ALuint it, kt, ft; - ALuint base; + ALfloat (*restrict temps)[BUFFERSIZE] = state->SampleBuffer; + ALsizei c; - for(base = 0;base < SamplesToDo;) + for(c = 0;c < MAX_EFFECT_CHANNELS;c++) { - ALuint td = minu(MAX_UPDATE_SAMPLES, SamplesToDo-base); + BiquadFilter_process(&state->Chans[c].filter[0], temps[0], SamplesIn[c], SamplesToDo); + BiquadFilter_process(&state->Chans[c].filter[1], temps[1], temps[0], SamplesToDo); + BiquadFilter_process(&state->Chans[c].filter[2], temps[2], temps[1], SamplesToDo); + BiquadFilter_process(&state->Chans[c].filter[3], temps[3], temps[2], SamplesToDo); - for(ft = 0;ft < MAX_EFFECT_CHANNELS;ft++) - ALfilterState_process(&state->filter[0][ft], Samples[0][ft], &SamplesIn[ft][base], td); - for(ft = 0;ft < MAX_EFFECT_CHANNELS;ft++) - ALfilterState_process(&state->filter[1][ft], Samples[1][ft], Samples[0][ft], td); - for(ft = 0;ft < MAX_EFFECT_CHANNELS;ft++) - ALfilterState_process(&state->filter[2][ft], Samples[2][ft], Samples[1][ft], td); - for(ft = 0;ft < MAX_EFFECT_CHANNELS;ft++) - ALfilterState_process(&state->filter[3][ft], Samples[3][ft], Samples[2][ft], td); - - for(ft = 0;ft < MAX_EFFECT_CHANNELS;ft++) - { - for(kt = 0;kt < NumChannels;kt++) - { - ALfloat gain = state->Gain[ft][kt]; - if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) - continue; - - for(it = 0;it < td;it++) - SamplesOut[kt][base+it] += gain * Samples[3][ft][it]; - } - } - - base += td; + MixSamples(temps[3], NumChannels, SamplesOut, + state->Chans[c].CurrentGains, state->Chans[c].TargetGains, + SamplesToDo, 0, SamplesToDo + ); } } -typedef struct ALequalizerStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALequalizerStateFactory; +typedef struct EqualizerStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} EqualizerStateFactory; -ALeffectState *ALequalizerStateFactory_create(ALequalizerStateFactory *UNUSED(factory)) +ALeffectState *EqualizerStateFactory_create(EqualizerStateFactory *UNUSED(factory)) { ALequalizerState *state; @@ -251,22 +210,20 @@ ALeffectState *ALequalizerStateFactory_create(ALequalizerStateFactory *UNUSED(fa return STATIC_CAST(ALeffectState, state); } -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALequalizerStateFactory); +DEFINE_EFFECTSTATEFACTORY_VTABLE(EqualizerStateFactory); -ALeffectStateFactory *ALequalizerStateFactory_getFactory(void) +EffectStateFactory *EqualizerStateFactory_getFactory(void) { - static ALequalizerStateFactory EqualizerFactory = { { GET_VTABLE2(ALequalizerStateFactory, ALeffectStateFactory) } }; + static EqualizerStateFactory EqualizerFactory = { { GET_VTABLE2(EqualizerStateFactory, EffectStateFactory) } }; - return STATIC_CAST(ALeffectStateFactory, &EqualizerFactory); + return STATIC_CAST(EffectStateFactory, &EqualizerFactory); } -void ALequalizer_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALequalizer_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALequalizer_setParami(effect, context, param, vals[0]); -} +void ALequalizer_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid equalizer integer property 0x%04x", param); } +void ALequalizer_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid equalizer integer-vector property 0x%04x", param); } void ALequalizer_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { ALeffectProps *props = &effect->Props; @@ -274,79 +231,75 @@ void ALequalizer_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, { case AL_EQUALIZER_LOW_GAIN: if(!(val >= AL_EQUALIZER_MIN_LOW_GAIN && val <= AL_EQUALIZER_MAX_LOW_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer low-band gain out of range"); props->Equalizer.LowGain = val; break; case AL_EQUALIZER_LOW_CUTOFF: if(!(val >= AL_EQUALIZER_MIN_LOW_CUTOFF && val <= AL_EQUALIZER_MAX_LOW_CUTOFF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer low-band cutoff out of range"); props->Equalizer.LowCutoff = val; break; case AL_EQUALIZER_MID1_GAIN: if(!(val >= AL_EQUALIZER_MIN_MID1_GAIN && val <= AL_EQUALIZER_MAX_MID1_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer mid1-band gain out of range"); props->Equalizer.Mid1Gain = val; break; case AL_EQUALIZER_MID1_CENTER: if(!(val >= AL_EQUALIZER_MIN_MID1_CENTER && val <= AL_EQUALIZER_MAX_MID1_CENTER)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer mid1-band center out of range"); props->Equalizer.Mid1Center = val; break; case AL_EQUALIZER_MID1_WIDTH: if(!(val >= AL_EQUALIZER_MIN_MID1_WIDTH && val <= AL_EQUALIZER_MAX_MID1_WIDTH)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer mid1-band width out of range"); props->Equalizer.Mid1Width = val; break; case AL_EQUALIZER_MID2_GAIN: if(!(val >= AL_EQUALIZER_MIN_MID2_GAIN && val <= AL_EQUALIZER_MAX_MID2_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer mid2-band gain out of range"); props->Equalizer.Mid2Gain = val; break; case AL_EQUALIZER_MID2_CENTER: if(!(val >= AL_EQUALIZER_MIN_MID2_CENTER && val <= AL_EQUALIZER_MAX_MID2_CENTER)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer mid2-band center out of range"); props->Equalizer.Mid2Center = val; break; case AL_EQUALIZER_MID2_WIDTH: if(!(val >= AL_EQUALIZER_MIN_MID2_WIDTH && val <= AL_EQUALIZER_MAX_MID2_WIDTH)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer mid2-band width out of range"); props->Equalizer.Mid2Width = val; break; case AL_EQUALIZER_HIGH_GAIN: if(!(val >= AL_EQUALIZER_MIN_HIGH_GAIN && val <= AL_EQUALIZER_MAX_HIGH_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer high-band gain out of range"); props->Equalizer.HighGain = val; break; case AL_EQUALIZER_HIGH_CUTOFF: if(!(val >= AL_EQUALIZER_MIN_HIGH_CUTOFF && val <= AL_EQUALIZER_MAX_HIGH_CUTOFF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Equalizer high-band cutoff out of range"); props->Equalizer.HighCutoff = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid equalizer float property 0x%04x", param); } } void ALequalizer_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ALequalizer_setParamf(effect, context, param, vals[0]); -} +{ ALequalizer_setParamf(effect, context, param, vals[0]); } -void ALequalizer_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -void ALequalizer_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALequalizer_getParami(effect, context, param, vals); -} +void ALequalizer_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid equalizer integer property 0x%04x", param); } +void ALequalizer_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid equalizer integer-vector property 0x%04x", param); } void ALequalizer_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { const ALeffectProps *props = &effect->Props; @@ -393,12 +346,10 @@ void ALequalizer_getParamf(const ALeffect *effect, ALCcontext *context, ALenum p break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid equalizer float property 0x%04x", param); } } void ALequalizer_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ALequalizer_getParamf(effect, context, param, vals); -} +{ ALequalizer_getParamf(effect, context, param, vals); } DEFINE_ALEFFECT_VTABLE(ALequalizer); diff --git a/Engine/lib/openal-soft/Alc/effects/flanger.c b/Engine/lib/openal-soft/Alc/effects/flanger.c deleted file mode 100644 index 1575212bc..000000000 --- a/Engine/lib/openal-soft/Alc/effects/flanger.c +++ /dev/null @@ -1,411 +0,0 @@ -/** - * OpenAL cross platform audio library - * Copyright (C) 2013 by Mike Gorchak - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * Or go to http://www.gnu.org/copyleft/lgpl.html - */ - -#include "config.h" - -#include -#include - -#include "alMain.h" -#include "alFilter.h" -#include "alAuxEffectSlot.h" -#include "alError.h" -#include "alu.h" - - -enum FlangerWaveForm { - FWF_Triangle = AL_FLANGER_WAVEFORM_TRIANGLE, - FWF_Sinusoid = AL_FLANGER_WAVEFORM_SINUSOID -}; - -typedef struct ALflangerState { - DERIVE_FROM_TYPE(ALeffectState); - - ALfloat *SampleBuffer[2]; - ALuint BufferLength; - ALuint offset; - ALuint lfo_range; - ALfloat lfo_scale; - ALint lfo_disp; - - /* Gains for left and right sides */ - ALfloat Gain[2][MAX_OUTPUT_CHANNELS]; - - /* effect parameters */ - enum FlangerWaveForm waveform; - ALint delay; - ALfloat depth; - ALfloat feedback; -} ALflangerState; - -static ALvoid ALflangerState_Destruct(ALflangerState *state); -static ALboolean ALflangerState_deviceUpdate(ALflangerState *state, ALCdevice *Device); -static ALvoid ALflangerState_update(ALflangerState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props); -static ALvoid ALflangerState_process(ALflangerState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); -DECLARE_DEFAULT_ALLOCATORS(ALflangerState) - -DEFINE_ALEFFECTSTATE_VTABLE(ALflangerState); - - -static void ALflangerState_Construct(ALflangerState *state) -{ - ALeffectState_Construct(STATIC_CAST(ALeffectState, state)); - SET_VTABLE2(ALflangerState, ALeffectState, state); - - state->BufferLength = 0; - state->SampleBuffer[0] = NULL; - state->SampleBuffer[1] = NULL; - state->offset = 0; - state->lfo_range = 1; - state->waveform = FWF_Triangle; -} - -static ALvoid ALflangerState_Destruct(ALflangerState *state) -{ - al_free(state->SampleBuffer[0]); - state->SampleBuffer[0] = NULL; - state->SampleBuffer[1] = NULL; - - ALeffectState_Destruct(STATIC_CAST(ALeffectState,state)); -} - -static ALboolean ALflangerState_deviceUpdate(ALflangerState *state, ALCdevice *Device) -{ - ALuint maxlen; - ALuint it; - - maxlen = fastf2u(AL_FLANGER_MAX_DELAY * 3.0f * Device->Frequency) + 1; - maxlen = NextPowerOf2(maxlen); - - if(maxlen != state->BufferLength) - { - void *temp = al_calloc(16, maxlen * sizeof(ALfloat) * 2); - if(!temp) return AL_FALSE; - - al_free(state->SampleBuffer[0]); - state->SampleBuffer[0] = temp; - state->SampleBuffer[1] = state->SampleBuffer[0] + maxlen; - - state->BufferLength = maxlen; - } - - for(it = 0;it < state->BufferLength;it++) - { - state->SampleBuffer[0][it] = 0.0f; - state->SampleBuffer[1][it] = 0.0f; - } - - return AL_TRUE; -} - -static ALvoid ALflangerState_update(ALflangerState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) -{ - ALfloat frequency = (ALfloat)Device->Frequency; - ALfloat coeffs[MAX_AMBI_COEFFS]; - ALfloat rate; - ALint phase; - - switch(props->Flanger.Waveform) - { - case AL_FLANGER_WAVEFORM_TRIANGLE: - state->waveform = FWF_Triangle; - break; - case AL_FLANGER_WAVEFORM_SINUSOID: - state->waveform = FWF_Sinusoid; - break; - } - state->depth = props->Flanger.Depth; - state->feedback = props->Flanger.Feedback; - state->delay = fastf2i(props->Flanger.Delay * frequency); - - /* Gains for left and right sides */ - CalcXYZCoeffs(-1.0f, 0.0f, 0.0f, 0.0f, coeffs); - ComputePanningGains(Device->Dry, coeffs, Slot->Params.Gain, state->Gain[0]); - CalcXYZCoeffs( 1.0f, 0.0f, 0.0f, 0.0f, coeffs); - ComputePanningGains(Device->Dry, coeffs, Slot->Params.Gain, state->Gain[1]); - - phase = props->Flanger.Phase; - rate = props->Flanger.Rate; - if(!(rate > 0.0f)) - { - state->lfo_scale = 0.0f; - state->lfo_range = 1; - state->lfo_disp = 0; - } - else - { - /* Calculate LFO coefficient */ - state->lfo_range = fastf2u(frequency/rate + 0.5f); - switch(state->waveform) - { - case FWF_Triangle: - state->lfo_scale = 4.0f / state->lfo_range; - break; - case FWF_Sinusoid: - state->lfo_scale = F_TAU / state->lfo_range; - break; - } - - /* Calculate lfo phase displacement */ - state->lfo_disp = fastf2i(state->lfo_range * (phase/360.0f)); - } -} - -static inline void Triangle(ALint *delay_left, ALint *delay_right, ALuint offset, const ALflangerState *state) -{ - ALfloat lfo_value; - - lfo_value = 2.0f - fabsf(2.0f - state->lfo_scale*(offset%state->lfo_range)); - lfo_value *= state->depth * state->delay; - *delay_left = fastf2i(lfo_value) + state->delay; - - offset += state->lfo_disp; - lfo_value = 2.0f - fabsf(2.0f - state->lfo_scale*(offset%state->lfo_range)); - lfo_value *= state->depth * state->delay; - *delay_right = fastf2i(lfo_value) + state->delay; -} - -static inline void Sinusoid(ALint *delay_left, ALint *delay_right, ALuint offset, const ALflangerState *state) -{ - ALfloat lfo_value; - - lfo_value = 1.0f + sinf(state->lfo_scale*(offset%state->lfo_range)); - lfo_value *= state->depth * state->delay; - *delay_left = fastf2i(lfo_value) + state->delay; - - offset += state->lfo_disp; - lfo_value = 1.0f + sinf(state->lfo_scale*(offset%state->lfo_range)); - lfo_value *= state->depth * state->delay; - *delay_right = fastf2i(lfo_value) + state->delay; -} - -#define DECL_TEMPLATE(Func) \ -static void Process##Func(ALflangerState *state, const ALuint SamplesToDo, \ - const ALfloat *restrict SamplesIn, ALfloat (*restrict out)[2]) \ -{ \ - const ALuint bufmask = state->BufferLength-1; \ - ALfloat *restrict leftbuf = state->SampleBuffer[0]; \ - ALfloat *restrict rightbuf = state->SampleBuffer[1]; \ - ALuint offset = state->offset; \ - const ALfloat feedback = state->feedback; \ - ALuint it; \ - \ - for(it = 0;it < SamplesToDo;it++) \ - { \ - ALint delay_left, delay_right; \ - Func(&delay_left, &delay_right, offset, state); \ - \ - out[it][0] = leftbuf[(offset-delay_left)&bufmask]; \ - leftbuf[offset&bufmask] = (out[it][0]+SamplesIn[it]) * feedback; \ - \ - out[it][1] = rightbuf[(offset-delay_right)&bufmask]; \ - rightbuf[offset&bufmask] = (out[it][1]+SamplesIn[it]) * feedback; \ - \ - offset++; \ - } \ - state->offset = offset; \ -} - -DECL_TEMPLATE(Triangle) -DECL_TEMPLATE(Sinusoid) - -#undef DECL_TEMPLATE - -static ALvoid ALflangerState_process(ALflangerState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) -{ - ALuint it, kt; - ALuint base; - - for(base = 0;base < SamplesToDo;) - { - ALfloat temps[128][2]; - ALuint td = minu(128, SamplesToDo-base); - - switch(state->waveform) - { - case FWF_Triangle: - ProcessTriangle(state, td, SamplesIn[0]+base, temps); - break; - case FWF_Sinusoid: - ProcessSinusoid(state, td, SamplesIn[0]+base, temps); - break; - } - - for(kt = 0;kt < NumChannels;kt++) - { - ALfloat gain = state->Gain[0][kt]; - if(fabsf(gain) > GAIN_SILENCE_THRESHOLD) - { - for(it = 0;it < td;it++) - SamplesOut[kt][it+base] += temps[it][0] * gain; - } - - gain = state->Gain[1][kt]; - if(fabsf(gain) > GAIN_SILENCE_THRESHOLD) - { - for(it = 0;it < td;it++) - SamplesOut[kt][it+base] += temps[it][1] * gain; - } - } - - base += td; - } -} - - -typedef struct ALflangerStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALflangerStateFactory; - -ALeffectState *ALflangerStateFactory_create(ALflangerStateFactory *UNUSED(factory)) -{ - ALflangerState *state; - - NEW_OBJ0(state, ALflangerState)(); - if(!state) return NULL; - - return STATIC_CAST(ALeffectState, state); -} - -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALflangerStateFactory); - -ALeffectStateFactory *ALflangerStateFactory_getFactory(void) -{ - static ALflangerStateFactory FlangerFactory = { { GET_VTABLE2(ALflangerStateFactory, ALeffectStateFactory) } }; - - return STATIC_CAST(ALeffectStateFactory, &FlangerFactory); -} - - -void ALflanger_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) -{ - ALeffectProps *props = &effect->Props; - switch(param) - { - case AL_FLANGER_WAVEFORM: - if(!(val >= AL_FLANGER_MIN_WAVEFORM && val <= AL_FLANGER_MAX_WAVEFORM)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); - props->Flanger.Waveform = val; - break; - - case AL_FLANGER_PHASE: - if(!(val >= AL_FLANGER_MIN_PHASE && val <= AL_FLANGER_MAX_PHASE)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); - props->Flanger.Phase = val; - break; - - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); - } -} -void ALflanger_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALflanger_setParami(effect, context, param, vals[0]); -} -void ALflanger_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) -{ - ALeffectProps *props = &effect->Props; - switch(param) - { - case AL_FLANGER_RATE: - if(!(val >= AL_FLANGER_MIN_RATE && val <= AL_FLANGER_MAX_RATE)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); - props->Flanger.Rate = val; - break; - - case AL_FLANGER_DEPTH: - if(!(val >= AL_FLANGER_MIN_DEPTH && val <= AL_FLANGER_MAX_DEPTH)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); - props->Flanger.Depth = val; - break; - - case AL_FLANGER_FEEDBACK: - if(!(val >= AL_FLANGER_MIN_FEEDBACK && val <= AL_FLANGER_MAX_FEEDBACK)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); - props->Flanger.Feedback = val; - break; - - case AL_FLANGER_DELAY: - if(!(val >= AL_FLANGER_MIN_DELAY && val <= AL_FLANGER_MAX_DELAY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); - props->Flanger.Delay = val; - break; - - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); - } -} -void ALflanger_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ALflanger_setParamf(effect, context, param, vals[0]); -} - -void ALflanger_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) -{ - const ALeffectProps *props = &effect->Props; - switch(param) - { - case AL_FLANGER_WAVEFORM: - *val = props->Flanger.Waveform; - break; - - case AL_FLANGER_PHASE: - *val = props->Flanger.Phase; - break; - - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); - } -} -void ALflanger_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALflanger_getParami(effect, context, param, vals); -} -void ALflanger_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) -{ - const ALeffectProps *props = &effect->Props; - switch(param) - { - case AL_FLANGER_RATE: - *val = props->Flanger.Rate; - break; - - case AL_FLANGER_DEPTH: - *val = props->Flanger.Depth; - break; - - case AL_FLANGER_FEEDBACK: - *val = props->Flanger.Feedback; - break; - - case AL_FLANGER_DELAY: - *val = props->Flanger.Delay; - break; - - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); - } -} -void ALflanger_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ALflanger_getParamf(effect, context, param, vals); -} - -DEFINE_ALEFFECT_VTABLE(ALflanger); diff --git a/Engine/lib/openal-soft/Alc/effects/modulator.c b/Engine/lib/openal-soft/Alc/effects/modulator.c index 247cdf61a..7f1a2cad0 100644 --- a/Engine/lib/openal-soft/Alc/effects/modulator.c +++ b/Engine/lib/openal-soft/Alc/effects/modulator.c @@ -24,29 +24,36 @@ #include #include "alMain.h" -#include "alFilter.h" #include "alAuxEffectSlot.h" #include "alError.h" #include "alu.h" +#include "filters/defs.h" +#define MAX_UPDATE_SAMPLES 128 + typedef struct ALmodulatorState { DERIVE_FROM_TYPE(ALeffectState); - void (*Process)(ALfloat*, const ALfloat*, ALuint, const ALuint, ALuint); + void (*GetSamples)(ALfloat*, ALsizei, const ALsizei, ALsizei); - ALuint index; - ALuint step; + ALsizei index; + ALsizei step; - ALfloat Gain[MAX_EFFECT_CHANNELS][MAX_OUTPUT_CHANNELS]; + alignas(16) ALfloat ModSamples[MAX_UPDATE_SAMPLES]; - ALfilterState Filter[MAX_EFFECT_CHANNELS]; + struct { + BiquadFilter Filter; + + ALfloat CurrentGains[MAX_OUTPUT_CHANNELS]; + ALfloat TargetGains[MAX_OUTPUT_CHANNELS]; + } Chans[MAX_EFFECT_CHANNELS]; } ALmodulatorState; static ALvoid ALmodulatorState_Destruct(ALmodulatorState *state); static ALboolean ALmodulatorState_deviceUpdate(ALmodulatorState *state, ALCdevice *device); -static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props); -static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); +static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props); +static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels); DECLARE_DEFAULT_ALLOCATORS(ALmodulatorState) DEFINE_ALEFFECTSTATE_VTABLE(ALmodulatorState); @@ -56,31 +63,31 @@ DEFINE_ALEFFECTSTATE_VTABLE(ALmodulatorState); #define WAVEFORM_FRACONE (1<> (WAVEFORM_FRACBITS - 1)) & 1); } #define DECL_TEMPLATE(func) \ -static void Modulate##func(ALfloat *restrict dst, const ALfloat *restrict src,\ - ALuint index, const ALuint step, ALuint todo) \ +static void Modulate##func(ALfloat *restrict dst, ALsizei index, \ + const ALsizei step, ALsizei todo) \ { \ - ALuint i; \ + ALsizei i; \ for(i = 0;i < todo;i++) \ { \ index += step; \ index &= WAVEFORM_FRACMASK; \ - dst[i] = src[i] * func(index); \ + dst[i] = func(index); \ } \ } @@ -93,16 +100,11 @@ DECL_TEMPLATE(Square) static void ALmodulatorState_Construct(ALmodulatorState *state) { - ALuint i; - ALeffectState_Construct(STATIC_CAST(ALeffectState, state)); SET_VTABLE2(ALmodulatorState, ALeffectState, state); state->index = 0; state->step = 1; - - for(i = 0;i < MAX_EFFECT_CHANNELS;i++) - ALfilterState_clear(&state->Filter[i]); } static ALvoid ALmodulatorState_Destruct(ALmodulatorState *state) @@ -110,91 +112,89 @@ static ALvoid ALmodulatorState_Destruct(ALmodulatorState *state) ALeffectState_Destruct(STATIC_CAST(ALeffectState,state)); } -static ALboolean ALmodulatorState_deviceUpdate(ALmodulatorState *UNUSED(state), ALCdevice *UNUSED(device)) +static ALboolean ALmodulatorState_deviceUpdate(ALmodulatorState *state, ALCdevice *UNUSED(device)) { + ALsizei i, j; + for(i = 0;i < MAX_EFFECT_CHANNELS;i++) + { + BiquadFilter_clear(&state->Chans[i].Filter); + for(j = 0;j < MAX_OUTPUT_CHANNELS;j++) + state->Chans[i].CurrentGains[j] = 0.0f; + } return AL_TRUE; } -static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) +static ALvoid ALmodulatorState_update(ALmodulatorState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props) { + const ALCdevice *device = context->Device; ALfloat cw, a; - ALuint i; + ALsizei i; if(props->Modulator.Waveform == AL_RING_MODULATOR_SINUSOID) - state->Process = ModulateSin; + state->GetSamples = ModulateSin; else if(props->Modulator.Waveform == AL_RING_MODULATOR_SAWTOOTH) - state->Process = ModulateSaw; + state->GetSamples = ModulateSaw; else /*if(Slot->Params.EffectProps.Modulator.Waveform == AL_RING_MODULATOR_SQUARE)*/ - state->Process = ModulateSquare; + state->GetSamples = ModulateSquare; - state->step = fastf2u(props->Modulator.Frequency*WAVEFORM_FRACONE / - Device->Frequency); - if(state->step == 0) state->step = 1; + state->step = float2int(props->Modulator.Frequency*WAVEFORM_FRACONE/device->Frequency + 0.5f); + state->step = clampi(state->step, 1, WAVEFORM_FRACONE-1); /* Custom filter coeffs, which match the old version instead of a low-shelf. */ - cw = cosf(F_TAU * props->Modulator.HighPassCutoff / Device->Frequency); + cw = cosf(F_TAU * props->Modulator.HighPassCutoff / device->Frequency); a = (2.0f-cw) - sqrtf(powf(2.0f-cw, 2.0f) - 1.0f); - for(i = 0;i < MAX_EFFECT_CHANNELS;i++) - { - state->Filter[i].a1 = -a; - state->Filter[i].a2 = 0.0f; - state->Filter[i].b0 = a; - state->Filter[i].b1 = -a; - state->Filter[i].b2 = 0.0f; - } + state->Chans[0].Filter.b0 = a; + state->Chans[0].Filter.b1 = -a; + state->Chans[0].Filter.b2 = 0.0f; + state->Chans[0].Filter.a1 = -a; + state->Chans[0].Filter.a2 = 0.0f; + for(i = 1;i < MAX_EFFECT_CHANNELS;i++) + BiquadFilter_copyParams(&state->Chans[i].Filter, &state->Chans[0].Filter); - STATIC_CAST(ALeffectState,state)->OutBuffer = Device->FOAOut.Buffer; - STATIC_CAST(ALeffectState,state)->OutChannels = Device->FOAOut.NumChannels; + STATIC_CAST(ALeffectState,state)->OutBuffer = device->FOAOut.Buffer; + STATIC_CAST(ALeffectState,state)->OutChannels = device->FOAOut.NumChannels; for(i = 0;i < MAX_EFFECT_CHANNELS;i++) - ComputeFirstOrderGains(Device->FOAOut, IdentityMatrixf.m[i], - Slot->Params.Gain, state->Gain[i]); + ComputeFirstOrderGains(&device->FOAOut, IdentityMatrixf.m[i], + slot->Params.Gain, state->Chans[i].TargetGains); } -static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) +static ALvoid ALmodulatorState_process(ALmodulatorState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) { - const ALuint step = state->step; - ALuint index = state->index; - ALuint base; + ALfloat *restrict modsamples = ASSUME_ALIGNED(state->ModSamples, 16); + const ALsizei step = state->step; + ALsizei base; for(base = 0;base < SamplesToDo;) { - ALfloat temps[2][128]; - ALuint td = minu(128, SamplesToDo-base); - ALuint i, j, k; + alignas(16) ALfloat temps[2][MAX_UPDATE_SAMPLES]; + ALsizei td = mini(MAX_UPDATE_SAMPLES, SamplesToDo-base); + ALsizei c, i; - for(j = 0;j < MAX_EFFECT_CHANNELS;j++) + state->GetSamples(modsamples, state->index, step, td); + state->index += (step*td) & WAVEFORM_FRACMASK; + state->index &= WAVEFORM_FRACMASK; + + for(c = 0;c < MAX_EFFECT_CHANNELS;c++) { - ALfilterState_process(&state->Filter[j], temps[0], &SamplesIn[j][base], td); - state->Process(temps[1], temps[0], index, step, td); + BiquadFilter_process(&state->Chans[c].Filter, temps[0], &SamplesIn[c][base], td); + for(i = 0;i < td;i++) + temps[1][i] = temps[0][i] * modsamples[i]; - for(k = 0;k < NumChannels;k++) - { - ALfloat gain = state->Gain[j][k]; - if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) - continue; - - for(i = 0;i < td;i++) - SamplesOut[k][base+i] += gain * temps[1][i]; - } + MixSamples(temps[1], NumChannels, SamplesOut, state->Chans[c].CurrentGains, + state->Chans[c].TargetGains, SamplesToDo-base, base, td); } - for(i = 0;i < td;i++) - { - index += step; - index &= WAVEFORM_FRACMASK; - } base += td; } - state->index = index; } -typedef struct ALmodulatorStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALmodulatorStateFactory; +typedef struct ModulatorStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} ModulatorStateFactory; -static ALeffectState *ALmodulatorStateFactory_create(ALmodulatorStateFactory *UNUSED(factory)) +static ALeffectState *ModulatorStateFactory_create(ModulatorStateFactory *UNUSED(factory)) { ALmodulatorState *state; @@ -204,13 +204,13 @@ static ALeffectState *ALmodulatorStateFactory_create(ALmodulatorStateFactory *UN return STATIC_CAST(ALeffectState, state); } -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALmodulatorStateFactory); +DEFINE_EFFECTSTATEFACTORY_VTABLE(ModulatorStateFactory); -ALeffectStateFactory *ALmodulatorStateFactory_getFactory(void) +EffectStateFactory *ModulatorStateFactory_getFactory(void) { - static ALmodulatorStateFactory ModulatorFactory = { { GET_VTABLE2(ALmodulatorStateFactory, ALeffectStateFactory) } }; + static ModulatorStateFactory ModulatorFactory = { { GET_VTABLE2(ModulatorStateFactory, EffectStateFactory) } }; - return STATIC_CAST(ALeffectStateFactory, &ModulatorFactory); + return STATIC_CAST(EffectStateFactory, &ModulatorFactory); } @@ -221,24 +221,22 @@ void ALmodulator_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, { case AL_RING_MODULATOR_FREQUENCY: if(!(val >= AL_RING_MODULATOR_MIN_FREQUENCY && val <= AL_RING_MODULATOR_MAX_FREQUENCY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Modulator frequency out of range"); props->Modulator.Frequency = val; break; case AL_RING_MODULATOR_HIGHPASS_CUTOFF: if(!(val >= AL_RING_MODULATOR_MIN_HIGHPASS_CUTOFF && val <= AL_RING_MODULATOR_MAX_HIGHPASS_CUTOFF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Modulator high-pass cutoff out of range"); props->Modulator.HighPassCutoff = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid modulator float property 0x%04x", param); } } void ALmodulator_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ALmodulator_setParamf(effect, context, param, vals[0]); -} +{ ALmodulator_setParamf(effect, context, param, vals[0]); } void ALmodulator_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) { ALeffectProps *props = &effect->Props; @@ -251,18 +249,16 @@ void ALmodulator_setParami(ALeffect *effect, ALCcontext *context, ALenum param, case AL_RING_MODULATOR_WAVEFORM: if(!(val >= AL_RING_MODULATOR_MIN_WAVEFORM && val <= AL_RING_MODULATOR_MAX_WAVEFORM)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Invalid modulator waveform"); props->Modulator.Waveform = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid modulator integer property 0x%04x", param); } } void ALmodulator_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALmodulator_setParami(effect, context, param, vals[0]); -} +{ ALmodulator_setParami(effect, context, param, vals[0]); } void ALmodulator_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) { @@ -280,13 +276,11 @@ void ALmodulator_getParami(const ALeffect *effect, ALCcontext *context, ALenum p break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid modulator integer property 0x%04x", param); } } void ALmodulator_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALmodulator_getParami(effect, context, param, vals); -} +{ ALmodulator_getParami(effect, context, param, vals); } void ALmodulator_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { const ALeffectProps *props = &effect->Props; @@ -300,12 +294,10 @@ void ALmodulator_getParamf(const ALeffect *effect, ALCcontext *context, ALenum p break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid modulator float property 0x%04x", param); } } void ALmodulator_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ALmodulator_getParamf(effect, context, param, vals); -} +{ ALmodulator_getParamf(effect, context, param, vals); } DEFINE_ALEFFECT_VTABLE(ALmodulator); diff --git a/Engine/lib/openal-soft/Alc/effects/null.c b/Engine/lib/openal-soft/Alc/effects/null.c index bff00b567..e57359e39 100644 --- a/Engine/lib/openal-soft/Alc/effects/null.c +++ b/Engine/lib/openal-soft/Alc/effects/null.c @@ -16,8 +16,8 @@ typedef struct ALnullState { /* Forward-declare "virtual" functions to define the vtable with. */ static ALvoid ALnullState_Destruct(ALnullState *state); static ALboolean ALnullState_deviceUpdate(ALnullState *state, ALCdevice *device); -static ALvoid ALnullState_update(ALnullState *state, const ALCdevice *device, const ALeffectslot *slot, const ALeffectProps *props); -static ALvoid ALnullState_process(ALnullState *state, ALuint samplesToDo, const ALfloatBUFFERSIZE*restrict samplesIn, ALfloatBUFFERSIZE*restrict samplesOut, ALuint NumChannels); +static ALvoid ALnullState_update(ALnullState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props); +static ALvoid ALnullState_process(ALnullState *state, ALsizei samplesToDo, const ALfloat (*restrict samplesIn)[BUFFERSIZE], ALfloat (*restrict samplesOut)[BUFFERSIZE], ALsizei mumChannels); static void *ALnullState_New(size_t size); static void ALnullState_Delete(void *ptr); @@ -56,7 +56,7 @@ static ALboolean ALnullState_deviceUpdate(ALnullState* UNUSED(state), ALCdevice* /* This updates the effect state. This is called any time the effect is * (re)loaded into a slot. */ -static ALvoid ALnullState_update(ALnullState* UNUSED(state), const ALCdevice* UNUSED(device), const ALeffectslot* UNUSED(slot), const ALeffectProps* UNUSED(props)) +static ALvoid ALnullState_update(ALnullState* UNUSED(state), const ALCcontext* UNUSED(context), const ALeffectslot* UNUSED(slot), const ALeffectProps* UNUSED(props)) { } @@ -64,7 +64,7 @@ static ALvoid ALnullState_update(ALnullState* UNUSED(state), const ALCdevice* UN * input to the output buffer. The result should be added to the output buffer, * not replace it. */ -static ALvoid ALnullState_process(ALnullState* UNUSED(state), ALuint UNUSED(samplesToDo), const ALfloatBUFFERSIZE*restrict UNUSED(samplesIn), ALfloatBUFFERSIZE*restrict UNUSED(samplesOut), ALuint UNUSED(NumChannels)) +static ALvoid ALnullState_process(ALnullState* UNUSED(state), ALsizei UNUSED(samplesToDo), const ALfloatBUFFERSIZE*restrict UNUSED(samplesIn), ALfloatBUFFERSIZE*restrict UNUSED(samplesOut), ALsizei UNUSED(numChannels)) { } @@ -85,12 +85,12 @@ static void ALnullState_Delete(void *ptr) } -typedef struct ALnullStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALnullStateFactory; +typedef struct NullStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} NullStateFactory; /* Creates ALeffectState objects of the appropriate type. */ -ALeffectState *ALnullStateFactory_create(ALnullStateFactory *UNUSED(factory)) +ALeffectState *NullStateFactory_create(NullStateFactory *UNUSED(factory)) { ALnullState *state; @@ -100,79 +100,79 @@ ALeffectState *ALnullStateFactory_create(ALnullStateFactory *UNUSED(factory)) return STATIC_CAST(ALeffectState, state); } -/* Define the ALeffectStateFactory vtable for this type. */ -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALnullStateFactory); +/* Define the EffectStateFactory vtable for this type. */ +DEFINE_EFFECTSTATEFACTORY_VTABLE(NullStateFactory); -ALeffectStateFactory *ALnullStateFactory_getFactory(void) +EffectStateFactory *NullStateFactory_getFactory(void) { - static ALnullStateFactory NullFactory = { { GET_VTABLE2(ALnullStateFactory, ALeffectStateFactory) } }; - return STATIC_CAST(ALeffectStateFactory, &NullFactory); + static NullStateFactory NullFactory = { { GET_VTABLE2(NullStateFactory, EffectStateFactory) } }; + return STATIC_CAST(EffectStateFactory, &NullFactory); } -void ALnull_setParami(ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) +void ALnull_setParami(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint UNUSED(val)) { switch(param) { - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + default: + alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x", param); } } -void ALnull_setParamiv(ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, const ALint* UNUSED(vals)) +void ALnull_setParamiv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALint* UNUSED(vals)) { switch(param) { - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + default: + alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer-vector property 0x%04x", param); } } -void ALnull_setParamf(ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, ALfloat UNUSED(val)) +void ALnull_setParamf(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat UNUSED(val)) { switch(param) { - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + default: + alSetError(context, AL_INVALID_ENUM, "Invalid null effect float property 0x%04x", param); } } -void ALnull_setParamfv(ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, const ALfloat* UNUSED(vals)) +void ALnull_setParamfv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALfloat* UNUSED(vals)) { switch(param) { - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + default: + alSetError(context, AL_INVALID_ENUM, "Invalid null effect float-vector property 0x%04x", param); } } -void ALnull_getParami(const ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, ALint* UNUSED(val)) +void ALnull_getParami(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint* UNUSED(val)) { switch(param) { - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + default: + alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer property 0x%04x", param); } } -void ALnull_getParamiv(const ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, ALint* UNUSED(vals)) +void ALnull_getParamiv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALint* UNUSED(vals)) { switch(param) { - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + default: + alSetError(context, AL_INVALID_ENUM, "Invalid null effect integer-vector property 0x%04x", param); } } -void ALnull_getParamf(const ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, ALfloat* UNUSED(val)) +void ALnull_getParamf(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat* UNUSED(val)) { switch(param) { - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + default: + alSetError(context, AL_INVALID_ENUM, "Invalid null effect float property 0x%04x", param); } } -void ALnull_getParamfv(const ALeffect* UNUSED(effect), ALCcontext *context, ALenum param, ALfloat* UNUSED(vals)) +void ALnull_getParamfv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat* UNUSED(vals)) { switch(param) { - default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + default: + alSetError(context, AL_INVALID_ENUM, "Invalid null effect float-vector property 0x%04x", param); } } diff --git a/Engine/lib/openal-soft/Alc/effects/pshifter.c b/Engine/lib/openal-soft/Alc/effects/pshifter.c new file mode 100644 index 000000000..618573431 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/effects/pshifter.c @@ -0,0 +1,526 @@ +/** + * OpenAL cross platform audio library + * Copyright (C) 2018 by Raul Herraiz. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Or go to http://www.gnu.org/copyleft/lgpl.html + */ + +#include "config.h" + +#include +#include + +#include "alMain.h" +#include "alAuxEffectSlot.h" +#include "alError.h" +#include "alu.h" +#include "filters/defs.h" + + +#define STFT_SIZE 1024 +#define STFT_HALF_SIZE (STFT_SIZE>>1) +#define OVERSAMP (1<<2) + +#define STFT_STEP (STFT_SIZE / OVERSAMP) +#define FIFO_LATENCY (STFT_STEP * (OVERSAMP-1)) + +typedef struct ALcomplex { + ALdouble Real; + ALdouble Imag; +} ALcomplex; + +typedef struct ALphasor { + ALdouble Amplitude; + ALdouble Phase; +} ALphasor; + +typedef struct ALFrequencyDomain { + ALdouble Amplitude; + ALdouble Frequency; +} ALfrequencyDomain; + +typedef struct ALpshifterState { + DERIVE_FROM_TYPE(ALeffectState); + + /* Effect parameters */ + ALsizei count; + ALsizei PitchShiftI; + ALfloat PitchShift; + ALfloat FreqPerBin; + + /*Effects buffers*/ + ALfloat InFIFO[STFT_SIZE]; + ALfloat OutFIFO[STFT_STEP]; + ALdouble LastPhase[STFT_HALF_SIZE+1]; + ALdouble SumPhase[STFT_HALF_SIZE+1]; + ALdouble OutputAccum[STFT_SIZE]; + + ALcomplex FFTbuffer[STFT_SIZE]; + + ALfrequencyDomain Analysis_buffer[STFT_HALF_SIZE+1]; + ALfrequencyDomain Syntesis_buffer[STFT_HALF_SIZE+1]; + + alignas(16) ALfloat BufferOut[BUFFERSIZE]; + + /* Effect gains for each output channel */ + ALfloat CurrentGains[MAX_OUTPUT_CHANNELS]; + ALfloat TargetGains[MAX_OUTPUT_CHANNELS]; +} ALpshifterState; + +static ALvoid ALpshifterState_Destruct(ALpshifterState *state); +static ALboolean ALpshifterState_deviceUpdate(ALpshifterState *state, ALCdevice *device); +static ALvoid ALpshifterState_update(ALpshifterState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props); +static ALvoid ALpshifterState_process(ALpshifterState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels); +DECLARE_DEFAULT_ALLOCATORS(ALpshifterState) + +DEFINE_ALEFFECTSTATE_VTABLE(ALpshifterState); + + +/* Define a Hann window, used to filter the STFT input and output. */ +alignas(16) static ALdouble HannWindow[STFT_SIZE]; + +static void InitHannWindow(void) +{ + ALsizei i; + + /* Create lookup table of the Hann window for the desired size, i.e. STFT_SIZE */ + for(i = 0;i < STFT_SIZE>>1;i++) + { + ALdouble val = sin(M_PI * (ALdouble)i / (ALdouble)(STFT_SIZE-1)); + HannWindow[i] = HannWindow[STFT_SIZE-1-i] = val * val; + } +} +static alonce_flag HannInitOnce = AL_ONCE_FLAG_INIT; + + +/* Fast double-to-int conversion. Assumes the FPU is already in round-to-zero + * mode. */ +static inline ALint fastd2i(ALdouble d) +{ + /* NOTE: SSE2 is required for the efficient double-to-int opcodes on x86. + * Otherwise, we need to rely on x87's fistp opcode with it already in + * round-to-zero mode. x86-64 guarantees SSE2 support. + */ +#if (defined(__i386__) && !defined(__SSE2_MATH__)) || (defined(_M_IX86_FP) && (_M_IX86_FP < 2)) +#ifdef HAVE_LRINTF + return lrint(d); +#elif defined(_MSC_VER) && defined(_M_IX86) + ALint i; + __asm fld d + __asm fistp i + return i; +#else + return (ALint)d; +#endif +#else + return (ALint)d; +#endif +} + + +/* Converts ALcomplex to ALphasor */ +static inline ALphasor rect2polar(ALcomplex number) +{ + ALphasor polar; + + polar.Amplitude = sqrt(number.Real*number.Real + number.Imag*number.Imag); + polar.Phase = atan2(number.Imag, number.Real); + + return polar; +} + +/* Converts ALphasor to ALcomplex */ +static inline ALcomplex polar2rect(ALphasor number) +{ + ALcomplex cartesian; + + cartesian.Real = number.Amplitude * cos(number.Phase); + cartesian.Imag = number.Amplitude * sin(number.Phase); + + return cartesian; +} + +/* Addition of two complex numbers (ALcomplex format) */ +static inline ALcomplex complex_add(ALcomplex a, ALcomplex b) +{ + ALcomplex result; + + result.Real = a.Real + b.Real; + result.Imag = a.Imag + b.Imag; + + return result; +} + +/* Subtraction of two complex numbers (ALcomplex format) */ +static inline ALcomplex complex_sub(ALcomplex a, ALcomplex b) +{ + ALcomplex result; + + result.Real = a.Real - b.Real; + result.Imag = a.Imag - b.Imag; + + return result; +} + +/* Multiplication of two complex numbers (ALcomplex format) */ +static inline ALcomplex complex_mult(ALcomplex a, ALcomplex b) +{ + ALcomplex result; + + result.Real = a.Real*b.Real - a.Imag*b.Imag; + result.Imag = a.Imag*b.Real + a.Real*b.Imag; + + return result; +} + +/* Iterative implementation of 2-radix FFT (In-place algorithm). Sign = -1 is + * FFT and 1 is iFFT (inverse). Fills FFTBuffer[0...FFTSize-1] with the + * Discrete Fourier Transform (DFT) of the time domain data stored in + * FFTBuffer[0...FFTSize-1]. FFTBuffer is an array of complex numbers + * (ALcomplex), FFTSize MUST BE power of two. + */ +static inline ALvoid FFT(ALcomplex *FFTBuffer, ALsizei FFTSize, ALdouble Sign) +{ + ALsizei i, j, k, mask, step, step2; + ALcomplex temp, u, w; + ALdouble arg; + + /* Bit-reversal permutation applied to a sequence of FFTSize items */ + for(i = 1;i < FFTSize-1;i++) + { + for(mask = 0x1, j = 0;mask < FFTSize;mask <<= 1) + { + if((i&mask) != 0) + j++; + j <<= 1; + } + j >>= 1; + + if(i < j) + { + temp = FFTBuffer[i]; + FFTBuffer[i] = FFTBuffer[j]; + FFTBuffer[j] = temp; + } + } + + /* Iterative form of Danielson–Lanczos lemma */ + for(i = 1, step = 2;i < FFTSize;i<<=1, step<<=1) + { + step2 = step >> 1; + arg = M_PI / step2; + + w.Real = cos(arg); + w.Imag = sin(arg) * Sign; + + u.Real = 1.0; + u.Imag = 0.0; + + for(j = 0;j < step2;j++) + { + for(k = j;k < FFTSize;k+=step) + { + temp = complex_mult(FFTBuffer[k+step2], u); + FFTBuffer[k+step2] = complex_sub(FFTBuffer[k], temp); + FFTBuffer[k] = complex_add(FFTBuffer[k], temp); + } + + u = complex_mult(u, w); + } + } +} + + +static void ALpshifterState_Construct(ALpshifterState *state) +{ + ALeffectState_Construct(STATIC_CAST(ALeffectState, state)); + SET_VTABLE2(ALpshifterState, ALeffectState, state); + + alcall_once(&HannInitOnce, InitHannWindow); +} + +static ALvoid ALpshifterState_Destruct(ALpshifterState *state) +{ + ALeffectState_Destruct(STATIC_CAST(ALeffectState,state)); +} + +static ALboolean ALpshifterState_deviceUpdate(ALpshifterState *state, ALCdevice *device) +{ + /* (Re-)initializing parameters and clear the buffers. */ + state->count = FIFO_LATENCY; + state->PitchShiftI = FRACTIONONE; + state->PitchShift = 1.0f; + state->FreqPerBin = device->Frequency / (ALfloat)STFT_SIZE; + + memset(state->InFIFO, 0, sizeof(state->InFIFO)); + memset(state->OutFIFO, 0, sizeof(state->OutFIFO)); + memset(state->FFTbuffer, 0, sizeof(state->FFTbuffer)); + memset(state->LastPhase, 0, sizeof(state->LastPhase)); + memset(state->SumPhase, 0, sizeof(state->SumPhase)); + memset(state->OutputAccum, 0, sizeof(state->OutputAccum)); + memset(state->Analysis_buffer, 0, sizeof(state->Analysis_buffer)); + memset(state->Syntesis_buffer, 0, sizeof(state->Syntesis_buffer)); + + memset(state->CurrentGains, 0, sizeof(state->CurrentGains)); + memset(state->TargetGains, 0, sizeof(state->TargetGains)); + + return AL_TRUE; +} + +static ALvoid ALpshifterState_update(ALpshifterState *state, const ALCcontext *context, const ALeffectslot *slot, const ALeffectProps *props) +{ + const ALCdevice *device = context->Device; + ALfloat coeffs[MAX_AMBI_COEFFS]; + float pitch; + + pitch = powf(2.0f, + (ALfloat)(props->Pshifter.CoarseTune*100 + props->Pshifter.FineTune) / 1200.0f + ); + state->PitchShiftI = (ALsizei)(pitch*FRACTIONONE + 0.5f); + state->PitchShift = state->PitchShiftI * (1.0f/FRACTIONONE); + + CalcAngleCoeffs(0.0f, 0.0f, 0.0f, coeffs); + ComputeDryPanGains(&device->Dry, coeffs, slot->Params.Gain, state->TargetGains); +} + +static ALvoid ALpshifterState_process(ALpshifterState *state, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) +{ + /* Pitch shifter engine based on the work of Stephan Bernsee. + * http://blogs.zynaptiq.com/bernsee/pitch-shifting-using-the-ft/ + */ + + static const ALdouble expected = M_PI*2.0 / OVERSAMP; + const ALdouble freq_per_bin = state->FreqPerBin; + ALfloat *restrict bufferOut = state->BufferOut; + ALsizei count = state->count; + ALsizei i, j, k; + + for(i = 0;i < SamplesToDo;) + { + do { + /* Fill FIFO buffer with samples data */ + state->InFIFO[count] = SamplesIn[0][i]; + bufferOut[i] = state->OutFIFO[count - FIFO_LATENCY]; + + count++; + } while(++i < SamplesToDo && count < STFT_SIZE); + + /* Check whether FIFO buffer is filled */ + if(count < STFT_SIZE) break; + count = FIFO_LATENCY; + + /* Real signal windowing and store in FFTbuffer */ + for(k = 0;k < STFT_SIZE;k++) + { + state->FFTbuffer[k].Real = state->InFIFO[k] * HannWindow[k]; + state->FFTbuffer[k].Imag = 0.0; + } + + /* ANALYSIS */ + /* Apply FFT to FFTbuffer data */ + FFT(state->FFTbuffer, STFT_SIZE, -1.0); + + /* Analyze the obtained data. Since the real FFT is symmetric, only + * STFT_HALF_SIZE+1 samples are needed. + */ + for(k = 0;k < STFT_HALF_SIZE+1;k++) + { + ALphasor component; + ALdouble tmp; + ALint qpd; + + /* Compute amplitude and phase */ + component = rect2polar(state->FFTbuffer[k]); + + /* Compute phase difference and subtract expected phase difference */ + tmp = (component.Phase - state->LastPhase[k]) - k*expected; + + /* Map delta phase into +/- Pi interval */ + qpd = fastd2i(tmp / M_PI); + tmp -= M_PI * (qpd + (qpd%2)); + + /* Get deviation from bin frequency from the +/- Pi interval */ + tmp /= expected; + + /* Compute the k-th partials' true frequency, twice the amplitude + * for maintain the gain (because half of bins are used) and store + * amplitude and true frequency in analysis buffer. + */ + state->Analysis_buffer[k].Amplitude = 2.0 * component.Amplitude; + state->Analysis_buffer[k].Frequency = (k + tmp) * freq_per_bin; + + /* Store actual phase[k] for the calculations in the next frame*/ + state->LastPhase[k] = component.Phase; + } + + /* PROCESSING */ + /* pitch shifting */ + for(k = 0;k < STFT_HALF_SIZE+1;k++) + { + state->Syntesis_buffer[k].Amplitude = 0.0; + state->Syntesis_buffer[k].Frequency = 0.0; + } + + for(k = 0;k < STFT_HALF_SIZE+1;k++) + { + j = (k*state->PitchShiftI) >> FRACTIONBITS; + if(j >= STFT_HALF_SIZE+1) break; + + state->Syntesis_buffer[j].Amplitude += state->Analysis_buffer[k].Amplitude; + state->Syntesis_buffer[j].Frequency = state->Analysis_buffer[k].Frequency * + state->PitchShift; + } + + /* SYNTHESIS */ + /* Synthesis the processing data */ + for(k = 0;k < STFT_HALF_SIZE+1;k++) + { + ALphasor component; + ALdouble tmp; + + /* Compute bin deviation from scaled freq */ + tmp = state->Syntesis_buffer[k].Frequency/freq_per_bin - k; + + /* Calculate actual delta phase and accumulate it to get bin phase */ + state->SumPhase[k] += (k + tmp) * expected; + + component.Amplitude = state->Syntesis_buffer[k].Amplitude; + component.Phase = state->SumPhase[k]; + + /* Compute phasor component to cartesian complex number and storage it into FFTbuffer*/ + state->FFTbuffer[k] = polar2rect(component); + } + /* zero negative frequencies for recontruct a real signal */ + for(k = STFT_HALF_SIZE+1;k < STFT_SIZE;k++) + { + state->FFTbuffer[k].Real = 0.0; + state->FFTbuffer[k].Imag = 0.0; + } + + /* Apply iFFT to buffer data */ + FFT(state->FFTbuffer, STFT_SIZE, 1.0); + + /* Windowing and add to output */ + for(k = 0;k < STFT_SIZE;k++) + state->OutputAccum[k] += HannWindow[k] * state->FFTbuffer[k].Real / + (0.5 * STFT_HALF_SIZE * OVERSAMP); + + /* Shift accumulator, input & output FIFO */ + for(k = 0;k < STFT_STEP;k++) state->OutFIFO[k] = (ALfloat)state->OutputAccum[k]; + for(j = 0;k < STFT_SIZE;k++,j++) state->OutputAccum[j] = state->OutputAccum[k]; + for(;j < STFT_SIZE;j++) state->OutputAccum[j] = 0.0; + for(k = 0;k < FIFO_LATENCY;k++) + state->InFIFO[k] = state->InFIFO[k+STFT_STEP]; + } + state->count = count; + + /* Now, mix the processed sound data to the output. */ + MixSamples(bufferOut, NumChannels, SamplesOut, state->CurrentGains, state->TargetGains, + maxi(SamplesToDo, 512), 0, SamplesToDo); +} + +typedef struct PshifterStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} PshifterStateFactory; + +static ALeffectState *PshifterStateFactory_create(PshifterStateFactory *UNUSED(factory)) +{ + ALpshifterState *state; + + NEW_OBJ0(state, ALpshifterState)(); + if(!state) return NULL; + + return STATIC_CAST(ALeffectState, state); +} + +DEFINE_EFFECTSTATEFACTORY_VTABLE(PshifterStateFactory); + +EffectStateFactory *PshifterStateFactory_getFactory(void) +{ + static PshifterStateFactory PshifterFactory = { { GET_VTABLE2(PshifterStateFactory, EffectStateFactory) } }; + + return STATIC_CAST(EffectStateFactory, &PshifterFactory); +} + + +void ALpshifter_setParamf(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat UNUSED(val)) +{ + alSetError( context, AL_INVALID_ENUM, "Invalid pitch shifter float property 0x%04x", param ); +} + +void ALpshifter_setParamfv(ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, const ALfloat *UNUSED(vals)) +{ + alSetError( context, AL_INVALID_ENUM, "Invalid pitch shifter float-vector property 0x%04x", param ); +} + +void ALpshifter_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALint val) +{ + ALeffectProps *props = &effect->Props; + switch(param) + { + case AL_PITCH_SHIFTER_COARSE_TUNE: + if(!(val >= AL_PITCH_SHIFTER_MIN_COARSE_TUNE && val <= AL_PITCH_SHIFTER_MAX_COARSE_TUNE)) + SETERR_RETURN(context, AL_INVALID_VALUE,,"Pitch shifter coarse tune out of range"); + props->Pshifter.CoarseTune = val; + break; + + case AL_PITCH_SHIFTER_FINE_TUNE: + if(!(val >= AL_PITCH_SHIFTER_MIN_FINE_TUNE && val <= AL_PITCH_SHIFTER_MAX_FINE_TUNE)) + SETERR_RETURN(context, AL_INVALID_VALUE,,"Pitch shifter fine tune out of range"); + props->Pshifter.FineTune = val; + break; + + default: + alSetError(context, AL_INVALID_ENUM, "Invalid pitch shifter integer property 0x%04x", param); + } +} +void ALpshifter_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) +{ + ALpshifter_setParami(effect, context, param, vals[0]); +} + +void ALpshifter_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) +{ + const ALeffectProps *props = &effect->Props; + switch(param) + { + case AL_PITCH_SHIFTER_COARSE_TUNE: + *val = (ALint)props->Pshifter.CoarseTune; + break; + case AL_PITCH_SHIFTER_FINE_TUNE: + *val = (ALint)props->Pshifter.FineTune; + break; + + default: + alSetError(context, AL_INVALID_ENUM, "Invalid pitch shifter integer property 0x%04x", param); + } +} +void ALpshifter_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) +{ + ALpshifter_getParami(effect, context, param, vals); +} + +void ALpshifter_getParamf(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat *UNUSED(val)) +{ + alSetError(context, AL_INVALID_ENUM, "Invalid pitch shifter float property 0x%04x", param); +} + +void ALpshifter_getParamfv(const ALeffect *UNUSED(effect), ALCcontext *context, ALenum param, ALfloat *UNUSED(vals)) +{ + alSetError(context, AL_INVALID_ENUM, "Invalid pitch shifter float vector-property 0x%04x", param); +} + +DEFINE_ALEFFECT_VTABLE(ALpshifter); diff --git a/Engine/lib/openal-soft/Alc/effects/reverb.c b/Engine/lib/openal-soft/Alc/effects/reverb.c index f2d5b7189..12e78bdfc 100644 --- a/Engine/lib/openal-soft/Alc/effects/reverb.c +++ b/Engine/lib/openal-soft/Alc/effects/reverb.c @@ -1,6 +1,6 @@ /** - * Reverb for the OpenAL cross platform audio library - * Copyright (C) 2008-2009 by Christopher Fitzgerald. + * Ambisonic reverb engine for the OpenAL cross platform audio library + * Copyright (C) 2008-2017 by Chris Robinson and Christopher Fitzgerald. * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either @@ -27,258 +27,400 @@ #include "alMain.h" #include "alu.h" #include "alAuxEffectSlot.h" -#include "alEffect.h" -#include "alFilter.h" +#include "alListener.h" #include "alError.h" -#include "mixer_defs.h" +#include "filters/defs.h" +/* This is a user config option for modifying the overall output of the reverb + * effect. + */ +ALfloat ReverbBoost = 1.0f; /* This is the maximum number of samples processed for each inner loop * iteration. */ #define MAX_UPDATE_SAMPLES 256 +/* The number of samples used for cross-faded delay lines. This can be used + * to balance the compensation for abrupt line changes and attenuation due to + * minimally lengthed recursive lines. Try to keep this below the device + * update size. + */ +#define FADE_SAMPLES 128 -static MixerFunc MixSamples = Mix_C; -static RowMixerFunc MixRowSamples = MixRow_C; +/* The number of spatialized lines or channels to process. Four channels allows + * for a 3D A-Format response. NOTE: This can't be changed without taking care + * of the conversion matrices, and a few places where the length arrays are + * assumed to have 4 elements. + */ +#define NUM_LINES 4 -static alonce_flag mixfunc_inited = AL_ONCE_FLAG_INIT; -static void init_mixfunc(void) + +/* The B-Format to A-Format conversion matrix. The arrangement of rows is + * deliberately chosen to align the resulting lines to their spatial opposites + * (0:above front left <-> 3:above back right, 1:below front right <-> 2:below + * back left). It's not quite opposite, since the A-Format results in a + * tetrahedron, but it's close enough. Should the model be extended to 8-lines + * in the future, true opposites can be used. + */ +static const aluMatrixf B2A = {{ + { 0.288675134595f, 0.288675134595f, 0.288675134595f, 0.288675134595f }, + { 0.288675134595f, -0.288675134595f, -0.288675134595f, 0.288675134595f }, + { 0.288675134595f, 0.288675134595f, -0.288675134595f, -0.288675134595f }, + { 0.288675134595f, -0.288675134595f, 0.288675134595f, -0.288675134595f } +}}; + +/* Converts A-Format to B-Format. */ +static const aluMatrixf A2B = {{ + { 0.866025403785f, 0.866025403785f, 0.866025403785f, 0.866025403785f }, + { 0.866025403785f, -0.866025403785f, 0.866025403785f, -0.866025403785f }, + { 0.866025403785f, -0.866025403785f, -0.866025403785f, 0.866025403785f }, + { 0.866025403785f, 0.866025403785f, -0.866025403785f, -0.866025403785f } +}}; + +static const ALfloat FadeStep = 1.0f / FADE_SAMPLES; + +/* The all-pass and delay lines have a variable length dependent on the + * effect's density parameter, which helps alter the perceived environment + * size. The size-to-density conversion is a cubed scale: + * + * density = min(1.0, pow(size, 3.0) / DENSITY_SCALE); + * + * The line lengths scale linearly with room size, so the inverse density + * conversion is needed, taking the cube root of the re-scaled density to + * calculate the line length multiplier: + * + * length_mult = max(5.0, cbrtf(density*DENSITY_SCALE)); + * + * The density scale below will result in a max line multiplier of 50, for an + * effective size range of 5m to 50m. + */ +static const ALfloat DENSITY_SCALE = 125000.0f; + +/* All delay line lengths are specified in seconds. + * + * To approximate early reflections, we break them up into primary (those + * arriving from the same direction as the source) and secondary (those + * arriving from the opposite direction). + * + * The early taps decorrelate the 4-channel signal to approximate an average + * room response for the primary reflections after the initial early delay. + * + * Given an average room dimension (d_a) and the speed of sound (c) we can + * calculate the average reflection delay (r_a) regardless of listener and + * source positions as: + * + * r_a = d_a / c + * c = 343.3 + * + * This can extended to finding the average difference (r_d) between the + * maximum (r_1) and minimum (r_0) reflection delays: + * + * r_0 = 2 / 3 r_a + * = r_a - r_d / 2 + * = r_d + * r_1 = 4 / 3 r_a + * = r_a + r_d / 2 + * = 2 r_d + * r_d = 2 / 3 r_a + * = r_1 - r_0 + * + * As can be determined by integrating the 1D model with a source (s) and + * listener (l) positioned across the dimension of length (d_a): + * + * r_d = int_(l=0)^d_a (int_(s=0)^d_a |2 d_a - 2 (l + s)| ds) dl / c + * + * The initial taps (T_(i=0)^N) are then specified by taking a power series + * that ranges between r_0 and half of r_1 less r_0: + * + * R_i = 2^(i / (2 N - 1)) r_d + * = r_0 + (2^(i / (2 N - 1)) - 1) r_d + * = r_0 + T_i + * T_i = R_i - r_0 + * = (2^(i / (2 N - 1)) - 1) r_d + * + * Assuming an average of 1m, we get the following taps: + */ +static const ALfloat EARLY_TAP_LENGTHS[NUM_LINES] = { - MixSamples = SelectMixer(); - MixRowSamples = SelectRowMixer(); -} + 0.0000000e+0f, 2.0213520e-4f, 4.2531060e-4f, 6.7171600e-4f +}; - -typedef struct DelayLine +/* The early all-pass filter lengths are based on the early tap lengths: + * + * A_i = R_i / a + * + * Where a is the approximate maximum all-pass cycle limit (20). + */ +static const ALfloat EARLY_ALLPASS_LENGTHS[NUM_LINES] = { - // The delay lines use sample lengths that are powers of 2 to allow the - // use of bit-masking instead of a modulus for wrapping. - ALuint Mask; - ALfloat *Line; -} DelayLine; + 9.7096800e-5f, 1.0720356e-4f, 1.1836234e-4f, 1.3068260e-4f +}; + +/* The early delay lines are used to transform the primary reflections into + * the secondary reflections. The A-format is arranged in such a way that + * the channels/lines are spatially opposite: + * + * C_i is opposite C_(N-i-1) + * + * The delays of the two opposing reflections (R_i and O_i) from a source + * anywhere along a particular dimension always sum to twice its full delay: + * + * 2 r_a = R_i + O_i + * + * With that in mind we can determine the delay between the two reflections + * and thus specify our early line lengths (L_(i=0)^N) using: + * + * O_i = 2 r_a - R_(N-i-1) + * L_i = O_i - R_(N-i-1) + * = 2 (r_a - R_(N-i-1)) + * = 2 (r_a - T_(N-i-1) - r_0) + * = 2 r_a (1 - (2 / 3) 2^((N - i - 1) / (2 N - 1))) + * + * Using an average dimension of 1m, we get: + */ +static const ALfloat EARLY_LINE_LENGTHS[NUM_LINES] = +{ + 5.9850400e-4f, 1.0913150e-3f, 1.5376658e-3f, 1.9419362e-3f +}; + +/* The late all-pass filter lengths are based on the late line lengths: + * + * A_i = (5 / 3) L_i / r_1 + */ +static const ALfloat LATE_ALLPASS_LENGTHS[NUM_LINES] = +{ + 1.6182800e-4f, 2.0389060e-4f, 2.8159360e-4f, 3.2365600e-4f +}; + +/* The late lines are used to approximate the decaying cycle of recursive + * late reflections. + * + * Splitting the lines in half, we start with the shortest reflection paths + * (L_(i=0)^(N/2)): + * + * L_i = 2^(i / (N - 1)) r_d + * + * Then for the opposite (longest) reflection paths (L_(i=N/2)^N): + * + * L_i = 2 r_a - L_(i-N/2) + * = 2 r_a - 2^((i - N / 2) / (N - 1)) r_d + * + * For our 1m average room, we get: + */ +static const ALfloat LATE_LINE_LENGTHS[NUM_LINES] = +{ + 1.9419362e-3f, 2.4466860e-3f, 3.3791220e-3f, 3.8838720e-3f +}; + + +typedef struct DelayLineI { + /* The delay lines use interleaved samples, with the lengths being powers + * of 2 to allow the use of bit-masking instead of a modulus for wrapping. + */ + ALsizei Mask; + ALfloat (*Line)[NUM_LINES]; +} DelayLineI; + +typedef struct VecAllpass { + DelayLineI Delay; + ALsizei Offset[NUM_LINES][2]; +} VecAllpass; + +typedef struct T60Filter { + /* Two filters are used to adjust the signal. One to control the low + * frequencies, and one to control the high frequencies. The HF filter also + * adjusts the overall output gain, affecting the remaining mid-band. + */ + ALfloat HFCoeffs[3]; + ALfloat LFCoeffs[3]; + + /* The HF and LF filters each keep a delay component. */ + ALfloat HFState; + ALfloat LFState; +} T60Filter; + +typedef struct EarlyReflections { + /* A Gerzon vector all-pass filter is used to simulate initial diffusion. + * The spread from this filter also helps smooth out the reverb tail. + */ + VecAllpass VecAp; + + /* An echo line is used to complete the second half of the early + * reflections. + */ + DelayLineI Delay; + ALsizei Offset[NUM_LINES][2]; + ALfloat Coeff[NUM_LINES]; + + /* The gain for each output channel based on 3D panning. */ + ALfloat CurrentGain[NUM_LINES][MAX_OUTPUT_CHANNELS]; + ALfloat PanGain[NUM_LINES][MAX_OUTPUT_CHANNELS]; +} EarlyReflections; + +typedef struct LateReverb { + /* Attenuation to compensate for the modal density and decay rate of the + * late lines. + */ + ALfloat DensityGain; + + /* A recursive delay line is used fill in the reverb tail. */ + DelayLineI Delay; + ALsizei Offset[NUM_LINES][2]; + + /* T60 decay filters are used to simulate absorption. */ + T60Filter T60[NUM_LINES]; + + /* A Gerzon vector all-pass filter is used to simulate diffusion. */ + VecAllpass VecAp; + + /* The gain for each output channel based on 3D panning. */ + ALfloat CurrentGain[NUM_LINES][MAX_OUTPUT_CHANNELS]; + ALfloat PanGain[NUM_LINES][MAX_OUTPUT_CHANNELS]; +} LateReverb; typedef struct ALreverbState { DERIVE_FROM_TYPE(ALeffectState); - ALboolean IsEax; + /* All delay lines are allocated as a single buffer to reduce memory + * fragmentation and management code. + */ + ALfloat *SampleBuffer; + ALuint TotalSamples; - // All delay lines are allocated as a single buffer to reduce memory - // fragmentation and management code. - ALfloat *SampleBuffer; - ALuint TotalSamples; - - // Master effect filters + /* Master effect filters */ struct { - ALfilterState Lp; - ALfilterState Hp; // EAX only - } Filter[4]; - - struct { - // Modulator delay line. - DelayLine Delay[4]; - - // The vibrato time is tracked with an index over a modulus-wrapped - // range (in samples). - ALuint Index; - ALuint Range; - - // The depth of frequency change (also in samples) and its filter. - ALfloat Depth; - ALfloat Coeff; - ALfloat Filter; - } Mod; // EAX only + BiquadFilter Lp; + BiquadFilter Hp; + } Filter[NUM_LINES]; /* Core delay line (early reflections and late reverb tap from this). */ - DelayLine Delay; - /* The tap points for the initial delay. First set go to early - * reflections, second to late reverb. - */ - ALuint EarlyDelayTap[4]; - ALuint LateDelayTap[4]; + DelayLineI Delay; - struct { - // Early reflections are done with 4 delay lines. - ALfloat Coeff[4]; - DelayLine Delay[4]; - ALuint Offset[4]; + /* Tap points for early reflection delay. */ + ALsizei EarlyDelayTap[NUM_LINES][2]; + ALfloat EarlyDelayCoeff[NUM_LINES]; - // The gain for each output channel based on 3D panning. - ALfloat CurrentGain[4][MAX_OUTPUT_CHANNELS]; - ALfloat PanGain[4][MAX_OUTPUT_CHANNELS]; - } Early; + /* Tap points for late reverb feed and delay. */ + ALsizei LateFeedTap; + ALsizei LateDelayTap[NUM_LINES][2]; - struct { - // Output gain for late reverb. - ALfloat Gain; + /* The feed-back and feed-forward all-pass coefficient. */ + ALfloat ApFeedCoeff; - // Attenuation to compensate for the modal density and decay rate of - // the late lines. - ALfloat DensityGain; + /* Coefficients for the all-pass and line scattering matrices. */ + ALfloat MixX; + ALfloat MixY; - // The feed-back and feed-forward all-pass coefficient. - ALfloat ApFeedCoeff; + EarlyReflections Early; - // Mixing matrix coefficient. - ALfloat MixCoeff; + LateReverb Late; - // Late reverb has 4 parallel all-pass filters. - struct { - ALfloat Coeff; - DelayLine Delay; - ALuint Offset; - } Ap[4]; + /* Indicates the cross-fade point for delay line reads [0,FADE_SAMPLES]. */ + ALsizei FadeCount; - // In addition to 4 cyclical delay lines. - ALfloat Coeff[4]; - DelayLine Delay[4]; - ALuint Offset[4]; - - // The cyclical delay lines are 1-pole low-pass filtered. - struct { - ALfloat Sample; - ALfloat Coeff; - } Lp[4]; - - // The gain for each output channel based on 3D panning. - ALfloat CurrentGain[4][MAX_OUTPUT_CHANNELS]; - ALfloat PanGain[4][MAX_OUTPUT_CHANNELS]; - } Late; - - struct { - // Attenuation to compensate for the modal density and decay rate of - // the echo line. - ALfloat DensityGain; - - // Echo delay and all-pass lines. - struct { - DelayLine Feedback; - DelayLine Ap; - } Delay[4]; - - ALfloat Coeff; - ALfloat ApFeedCoeff; - ALfloat ApCoeff; - - ALuint Offset; - ALuint ApOffset; - - // The echo line is 1-pole low-pass filtered. - ALfloat LpCoeff; - ALfloat LpSample[4]; - - // Echo mixing coefficient. - ALfloat MixCoeff; - } Echo; // EAX only - - // The current read offset for all delay lines. - ALuint Offset; + /* The current write offset for all delay lines. */ + ALsizei Offset; /* Temporary storage used when processing. */ - alignas(16) ALfloat AFormatSamples[4][MAX_UPDATE_SAMPLES]; - alignas(16) ALfloat ReverbSamples[4][MAX_UPDATE_SAMPLES]; - alignas(16) ALfloat EarlySamples[4][MAX_UPDATE_SAMPLES]; + alignas(16) ALfloat AFormatSamples[NUM_LINES][MAX_UPDATE_SAMPLES]; + alignas(16) ALfloat ReverbSamples[NUM_LINES][MAX_UPDATE_SAMPLES]; + alignas(16) ALfloat EarlySamples[NUM_LINES][MAX_UPDATE_SAMPLES]; } ALreverbState; static ALvoid ALreverbState_Destruct(ALreverbState *State); static ALboolean ALreverbState_deviceUpdate(ALreverbState *State, ALCdevice *Device); -static ALvoid ALreverbState_update(ALreverbState *State, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props); -static ALvoid ALreverbState_process(ALreverbState *State, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels); +static ALvoid ALreverbState_update(ALreverbState *State, const ALCcontext *Context, const ALeffectslot *Slot, const ALeffectProps *props); +static ALvoid ALreverbState_process(ALreverbState *State, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels); DECLARE_DEFAULT_ALLOCATORS(ALreverbState) DEFINE_ALEFFECTSTATE_VTABLE(ALreverbState); - static void ALreverbState_Construct(ALreverbState *state) { - ALuint index, l; + ALsizei i, j; ALeffectState_Construct(STATIC_CAST(ALeffectState, state)); SET_VTABLE2(ALreverbState, ALeffectState, state); - state->IsEax = AL_FALSE; - state->TotalSamples = 0; state->SampleBuffer = NULL; - for(index = 0;index < 4;index++) + for(i = 0;i < NUM_LINES;i++) { - ALfilterState_clear(&state->Filter[index].Lp); - ALfilterState_clear(&state->Filter[index].Hp); - - state->Mod.Delay[index].Mask = 0; - state->Mod.Delay[index].Line = NULL; + BiquadFilter_clear(&state->Filter[i].Lp); + BiquadFilter_clear(&state->Filter[i].Hp); } - state->Mod.Index = 0; - state->Mod.Range = 1; - state->Mod.Depth = 0.0f; - state->Mod.Coeff = 0.0f; - state->Mod.Filter = 0.0f; - state->Delay.Mask = 0; state->Delay.Line = NULL; - for(index = 0;index < 4;index++) - state->EarlyDelayTap[index] = 0; - for(index = 0;index < 4;index++) - state->LateDelayTap[index] = 0; - for(index = 0;index < 4;index++) + for(i = 0;i < NUM_LINES;i++) { - state->Early.Coeff[index] = 0.0f; - state->Early.Delay[index].Mask = 0; - state->Early.Delay[index].Line = NULL; - state->Early.Offset[index] = 0; + state->EarlyDelayTap[i][0] = 0; + state->EarlyDelayTap[i][1] = 0; + state->EarlyDelayCoeff[i] = 0.0f; + } + + state->LateFeedTap = 0; + + for(i = 0;i < NUM_LINES;i++) + { + state->LateDelayTap[i][0] = 0; + state->LateDelayTap[i][1] = 0; + } + + state->ApFeedCoeff = 0.0f; + state->MixX = 0.0f; + state->MixY = 0.0f; + + state->Early.VecAp.Delay.Mask = 0; + state->Early.VecAp.Delay.Line = NULL; + state->Early.Delay.Mask = 0; + state->Early.Delay.Line = NULL; + for(i = 0;i < NUM_LINES;i++) + { + state->Early.VecAp.Offset[i][0] = 0; + state->Early.VecAp.Offset[i][1] = 0; + state->Early.Offset[i][0] = 0; + state->Early.Offset[i][1] = 0; + state->Early.Coeff[i] = 0.0f; } - state->Late.Gain = 0.0f; state->Late.DensityGain = 0.0f; - state->Late.ApFeedCoeff = 0.0f; - state->Late.MixCoeff = 0.0f; - for(index = 0;index < 4;index++) + + state->Late.Delay.Mask = 0; + state->Late.Delay.Line = NULL; + state->Late.VecAp.Delay.Mask = 0; + state->Late.VecAp.Delay.Line = NULL; + for(i = 0;i < NUM_LINES;i++) { - state->Late.Ap[index].Coeff = 0.0f; - state->Late.Ap[index].Delay.Mask = 0; - state->Late.Ap[index].Delay.Line = NULL; - state->Late.Ap[index].Offset = 0; + state->Late.Offset[i][0] = 0; + state->Late.Offset[i][1] = 0; - state->Late.Coeff[index] = 0.0f; - state->Late.Delay[index].Mask = 0; - state->Late.Delay[index].Line = NULL; - state->Late.Offset[index] = 0; + state->Late.VecAp.Offset[i][0] = 0; + state->Late.VecAp.Offset[i][1] = 0; - state->Late.Lp[index].Sample = 0.0f; - state->Late.Lp[index].Coeff = 0.0f; + for(j = 0;j < 3;j++) + { + state->Late.T60[i].HFCoeffs[j] = 0.0f; + state->Late.T60[i].LFCoeffs[j] = 0.0f; + } + state->Late.T60[i].HFState = 0.0f; + state->Late.T60[i].LFState = 0.0f; } - for(l = 0;l < 4;l++) + for(i = 0;i < NUM_LINES;i++) { - for(index = 0;index < MAX_OUTPUT_CHANNELS;index++) + for(j = 0;j < MAX_OUTPUT_CHANNELS;j++) { - state->Early.CurrentGain[l][index] = 0.0f; - state->Early.PanGain[l][index] = 0.0f; - state->Late.CurrentGain[l][index] = 0.0f; - state->Late.PanGain[l][index] = 0.0f; + state->Early.CurrentGain[i][j] = 0.0f; + state->Early.PanGain[i][j] = 0.0f; + state->Late.CurrentGain[i][j] = 0.0f; + state->Late.PanGain[i][j] = 0.0f; } } - state->Echo.DensityGain = 0.0f; - for(l = 0;l < 4;l++) - { - state->Echo.Delay[l].Feedback.Mask = 0; - state->Echo.Delay[l].Feedback.Line = NULL; - state->Echo.Delay[l].Ap.Mask = 0; - state->Echo.Delay[l].Ap.Line = NULL; - } - state->Echo.Coeff = 0.0f; - state->Echo.ApFeedCoeff = 0.0f; - state->Echo.ApCoeff = 0.0f; - state->Echo.Offset = 0; - state->Echo.ApOffset = 0; - state->Echo.LpCoeff = 0.0f; - for(l = 0;l < 4;l++) - state->Echo.LpSample[l] = 0.0f; - state->Echo.MixCoeff = 0.0f; - + state->FadeCount = 0; state->Offset = 0; } @@ -290,107 +432,45 @@ static ALvoid ALreverbState_Destruct(ALreverbState *State) ALeffectState_Destruct(STATIC_CAST(ALeffectState,State)); } -/* This is a user config option for modifying the overall output of the reverb - * effect. - */ -ALfloat ReverbBoost = 1.0f; - -/* Specifies whether to use a standard reverb effect in place of EAX reverb (no - * high-pass, modulation, or echo). - */ -ALboolean EmulateEAXReverb = AL_FALSE; - -/* This coefficient is used to define the maximum frequency range controlled - * by the modulation depth. The current value of 0.1 will allow it to swing - * from 0.9x to 1.1x. This value must be below 1. At 1 it will cause the - * sampler to stall on the downswing, and above 1 it will cause it to sample - * backwards. - */ -static const ALfloat MODULATION_DEPTH_COEFF = 0.1f; - -/* A filter is used to avoid the terrible distortion caused by changing - * modulation time and/or depth. To be consistent across different sample - * rates, the coefficient must be raised to a constant divided by the sample - * rate: coeff^(constant / rate). - */ -static const ALfloat MODULATION_FILTER_COEFF = 0.048f; -static const ALfloat MODULATION_FILTER_CONST = 100000.0f; - -// When diffusion is above 0, an all-pass filter is used to take the edge off -// the echo effect. It uses the following line length (in seconds). -static const ALfloat ECHO_ALLPASS_LENGTH = 0.0133f; - -/* Input into the early reflections and late reverb are decorrelated between - * four channels. Their timings are dependent on a fraction and multiplier. See - * the UpdateDelayLine() routine for the calculations involved. - */ -static const ALfloat DECO_FRACTION = 0.15f; -static const ALfloat DECO_MULTIPLIER = 2.0f; - -// All delay line lengths are specified in seconds. - -// The lengths of the early delay lines. -static const ALfloat EARLY_LINE_LENGTH[4] = -{ - 0.0015f, 0.0045f, 0.0135f, 0.0405f -}; - -// The lengths of the late cyclical delay lines. -static const ALfloat LATE_LINE_LENGTH[4] = -{ - 0.0211f, 0.0311f, 0.0461f, 0.0680f -}; - -// The lengths of the late all-pass delay lines. -static const ALfloat ALLPASS_LINE_LENGTH[4] = -{ - 0.0151f, 0.0167f, 0.0183f, 0.0200f, -}; - -// The late cyclical delay lines have a variable length dependent on the -// effect's density parameter (inverted for some reason) and this multiplier. -static const ALfloat LATE_LINE_MULTIPLIER = 4.0f; - - -#if defined(_WIN32) && !defined (_M_X64) && !defined(_M_ARM) -/* HACK: Workaround for a modff bug in 32-bit Windows, which attempts to write - * a 64-bit double to the 32-bit float parameter. - */ -static inline float hack_modff(float x, float *y) -{ - double di; - double df = modf((double)x, &di); - *y = (float)di; - return (float)df; -} -#define modff hack_modff -#endif - - /************************************** * Device Update * **************************************/ -// Given the allocated sample buffer, this function updates each delay line -// offset. -static inline ALvoid RealizeLineOffset(ALfloat *sampleBuffer, DelayLine *Delay) +static inline ALfloat CalcDelayLengthMult(ALfloat density) { - Delay->Line = &sampleBuffer[(ptrdiff_t)Delay->Line]; + return maxf(5.0f, cbrtf(density*DENSITY_SCALE)); } -// Calculate the length of a delay line and store its mask and offset. -static ALuint CalcLineLength(ALfloat length, ptrdiff_t offset, ALuint frequency, ALuint extra, DelayLine *Delay) +/* Given the allocated sample buffer, this function updates each delay line + * offset. + */ +static inline ALvoid RealizeLineOffset(ALfloat *sampleBuffer, DelayLineI *Delay) +{ + union { + ALfloat *f; + ALfloat (*f4)[NUM_LINES]; + } u; + u.f = &sampleBuffer[(ptrdiff_t)Delay->Line * NUM_LINES]; + Delay->Line = u.f4; +} + +/* Calculate the length of a delay line and store its mask and offset. */ +static ALuint CalcLineLength(const ALfloat length, const ptrdiff_t offset, const ALuint frequency, + const ALuint extra, DelayLineI *Delay) { ALuint samples; - // All line lengths are powers of 2, calculated from their lengths, with - // an additional sample in case of rounding errors. - samples = fastf2u(length*frequency) + extra; - samples = NextPowerOf2(samples + 1); - // All lines share a single sample buffer. + /* All line lengths are powers of 2, calculated from their lengths in + * seconds, rounded up. + */ + samples = float2int(ceilf(length*frequency)); + samples = NextPowerOf2(samples + extra); + + /* All lines share a single sample buffer. */ Delay->Mask = samples - 1; - Delay->Line = (ALfloat*)offset; - // Return the sample count for accumulation. + Delay->Line = (ALfloat(*)[NUM_LINES])offset; + + /* Return the sample count for accumulation. */ return samples; } @@ -398,73 +478,60 @@ static ALuint CalcLineLength(ALfloat length, ptrdiff_t offset, ALuint frequency, * for all lines given the sample rate (frequency). If an allocation failure * occurs, it returns AL_FALSE. */ -static ALboolean AllocLines(ALuint frequency, ALreverbState *State) +static ALboolean AllocLines(const ALuint frequency, ALreverbState *State) { - ALuint totalSamples, index; - ALfloat length; + ALuint totalSamples, i; + ALfloat multiplier, length; - // All delay line lengths are calculated to accomodate the full range of - // lengths given their respective paramters. + /* All delay line lengths are calculated to accomodate the full range of + * lengths given their respective paramters. + */ totalSamples = 0; - /* The modulator's line length is calculated from the maximum modulation - * time and depth coefficient, and halfed for the low-to-high frequency - * swing. An additional sample is added to keep it stable when there is no - * modulation. + /* Multiplier for the maximum density value, i.e. density=1, which is + * actually the least density... */ - length = (AL_EAXREVERB_MAX_MODULATION_TIME*MODULATION_DEPTH_COEFF/2.0f); - for(index = 0;index < 4;index++) - totalSamples += CalcLineLength(length, totalSamples, frequency, 1, - &State->Mod.Delay[index]); + multiplier = CalcDelayLengthMult(AL_EAXREVERB_MAX_DENSITY); - /* The initial delay is the sum of the reflections and late reverb delays. - * The decorrelator length is calculated from the lowest reverb density (a - * parameter value of 1). This must include space for storing a loop - * update. + /* The main delay length includes the maximum early reflection delay, the + * largest early tap width, the maximum late reverb delay, and the + * largest late tap width. Finally, it must also be extended by the + * update size (MAX_UPDATE_SAMPLES) for block processing. */ - length = AL_EAXREVERB_MAX_REFLECTIONS_DELAY + - AL_EAXREVERB_MAX_LATE_REVERB_DELAY; - length += (DECO_FRACTION * DECO_MULTIPLIER * DECO_MULTIPLIER) * - LATE_LINE_LENGTH[0] * (1.0f + LATE_LINE_MULTIPLIER); - /* Multiply length by 4, since we're storing 4 interleaved channels in the - * main delay line. + length = AL_EAXREVERB_MAX_REFLECTIONS_DELAY + EARLY_TAP_LENGTHS[NUM_LINES-1]*multiplier + + AL_EAXREVERB_MAX_LATE_REVERB_DELAY + + (LATE_LINE_LENGTHS[NUM_LINES-1] - LATE_LINE_LENGTHS[0])*0.25f*multiplier; + totalSamples += CalcLineLength(length, totalSamples, frequency, MAX_UPDATE_SAMPLES, + &State->Delay); + + /* The early vector all-pass line. */ + length = EARLY_ALLPASS_LENGTHS[NUM_LINES-1] * multiplier; + totalSamples += CalcLineLength(length, totalSamples, frequency, 0, + &State->Early.VecAp.Delay); + + /* The early reflection line. */ + length = EARLY_LINE_LENGTHS[NUM_LINES-1] * multiplier; + totalSamples += CalcLineLength(length, totalSamples, frequency, 0, + &State->Early.Delay); + + /* The late vector all-pass line. */ + length = LATE_ALLPASS_LENGTHS[NUM_LINES-1] * multiplier; + totalSamples += CalcLineLength(length, totalSamples, frequency, 0, + &State->Late.VecAp.Delay); + + /* The late delay lines are calculated from the larger of the maximum + * density line length or the maximum echo time. */ - totalSamples += CalcLineLength(length*4, totalSamples, frequency, - MAX_UPDATE_SAMPLES*4, &State->Delay); - - // The early reflection lines. - for(index = 0;index < 4;index++) - totalSamples += CalcLineLength(EARLY_LINE_LENGTH[index], totalSamples, - frequency, 0, &State->Early.Delay[index]); - - // The late delay lines are calculated from the lowest reverb density. - for(index = 0;index < 4;index++) - { - length = LATE_LINE_LENGTH[index] * (1.0f + LATE_LINE_MULTIPLIER); - totalSamples += CalcLineLength(length, totalSamples, frequency, 0, - &State->Late.Delay[index]); - } - - // The late all-pass lines. - for(index = 0;index < 4;index++) - totalSamples += CalcLineLength(ALLPASS_LINE_LENGTH[index], totalSamples, - frequency, 0, &State->Late.Ap[index].Delay); - - // The echo all-pass and delay lines. - for(index = 0;index < 4;index++) - { - totalSamples += CalcLineLength(ECHO_ALLPASS_LENGTH, totalSamples, - frequency, 0, &State->Echo.Delay[index].Ap); - totalSamples += CalcLineLength(AL_EAXREVERB_MAX_ECHO_TIME, totalSamples, - frequency, 0, &State->Echo.Delay[index].Feedback); - } + length = maxf(AL_EAXREVERB_MAX_ECHO_TIME, LATE_LINE_LENGTHS[NUM_LINES-1]*multiplier); + totalSamples += CalcLineLength(length, totalSamples, frequency, 0, + &State->Late.Delay); if(totalSamples != State->TotalSamples) { ALfloat *newBuffer; - TRACE("New reverb buffer length: %u samples\n", totalSamples); - newBuffer = al_calloc(16, sizeof(ALfloat) * totalSamples); + TRACE("New reverb buffer length: %ux4 samples\n", totalSamples); + newBuffer = al_calloc(16, sizeof(ALfloat[NUM_LINES]) * totalSamples); if(!newBuffer) return AL_FALSE; al_free(State->SampleBuffer); @@ -472,54 +539,35 @@ static ALboolean AllocLines(ALuint frequency, ALreverbState *State) State->TotalSamples = totalSamples; } - // Update all delays to reflect the new sample buffer. + /* Update all delays to reflect the new sample buffer. */ RealizeLineOffset(State->SampleBuffer, &State->Delay); - for(index = 0;index < 4;index++) - { - RealizeLineOffset(State->SampleBuffer, &State->Mod.Delay[index]); + RealizeLineOffset(State->SampleBuffer, &State->Early.VecAp.Delay); + RealizeLineOffset(State->SampleBuffer, &State->Early.Delay); + RealizeLineOffset(State->SampleBuffer, &State->Late.VecAp.Delay); + RealizeLineOffset(State->SampleBuffer, &State->Late.Delay); - RealizeLineOffset(State->SampleBuffer, &State->Early.Delay[index]); - - RealizeLineOffset(State->SampleBuffer, &State->Late.Ap[index].Delay); - RealizeLineOffset(State->SampleBuffer, &State->Late.Delay[index]); - - RealizeLineOffset(State->SampleBuffer, &State->Echo.Delay[index].Ap); - RealizeLineOffset(State->SampleBuffer, &State->Echo.Delay[index].Feedback); - } - - // Clear the sample buffer. - for(index = 0;index < State->TotalSamples;index++) - State->SampleBuffer[index] = 0.0f; + /* Clear the sample buffer. */ + for(i = 0;i < State->TotalSamples;i++) + State->SampleBuffer[i] = 0.0f; return AL_TRUE; } static ALboolean ALreverbState_deviceUpdate(ALreverbState *State, ALCdevice *Device) { - ALuint frequency = Device->Frequency, index; + ALuint frequency = Device->Frequency; + ALfloat multiplier; - // Allocate the delay lines. + /* Allocate the delay lines. */ if(!AllocLines(frequency, State)) return AL_FALSE; - // Calculate the modulation filter coefficient. Notice that the exponent - // is calculated given the current sample rate. This ensures that the - // resulting filter response over time is consistent across all sample - // rates. - State->Mod.Coeff = powf(MODULATION_FILTER_COEFF, - MODULATION_FILTER_CONST / frequency); + multiplier = CalcDelayLengthMult(AL_EAXREVERB_MAX_DENSITY); - // The early reflection and late all-pass filter line lengths are static, - // so their offsets only need to be calculated once. - for(index = 0;index < 4;index++) - { - State->Early.Offset[index] = fastf2u(EARLY_LINE_LENGTH[index] * frequency); - State->Late.Ap[index].Offset = fastf2u(ALLPASS_LINE_LENGTH[index] * frequency); - } - - // The echo all-pass filter line length is static, so its offset only - // needs to be calculated once. - State->Echo.ApOffset = fastf2u(ECHO_ALLPASS_LENGTH * frequency); + /* The late feed taps are set a fixed position past the latest delay tap. */ + State->LateFeedTap = float2int((AL_EAXREVERB_MAX_REFLECTIONS_DELAY + + EARLY_TAP_LENGTHS[NUM_LINES-1]*multiplier) * + frequency); return AL_TRUE; } @@ -528,23 +576,26 @@ static ALboolean ALreverbState_deviceUpdate(ALreverbState *State, ALCdevice *Dev * Effect Update * **************************************/ -// Calculate a decay coefficient given the length of each cycle and the time -// until the decay reaches -60 dB. -static inline ALfloat CalcDecayCoeff(ALfloat length, ALfloat decayTime) +/* Calculate a decay coefficient given the length of each cycle and the time + * until the decay reaches -60 dB. + */ +static inline ALfloat CalcDecayCoeff(const ALfloat length, const ALfloat decayTime) { - return powf(0.001f/*-60 dB*/, length/decayTime); + return powf(REVERB_DECAY_GAIN, length/decayTime); } -// Calculate a decay length from a coefficient and the time until the decay -// reaches -60 dB. -static inline ALfloat CalcDecayLength(ALfloat coeff, ALfloat decayTime) +/* Calculate a decay length from a coefficient and the time until the decay + * reaches -60 dB. + */ +static inline ALfloat CalcDecayLength(const ALfloat coeff, const ALfloat decayTime) { - return log10f(coeff) * decayTime / log10f(0.001f)/*-60 dB*/; + return log10f(coeff) * decayTime / log10f(REVERB_DECAY_GAIN); } -// Calculate an attenuation to be applied to the input of any echo models to -// compensate for modal density and decay time. -static inline ALfloat CalcDensityGain(ALfloat a) +/* Calculate an attenuation to be applied to the input of any echo models to + * compensate for modal density and decay time. + */ +static inline ALfloat CalcDensityGain(const ALfloat a) { /* The energy of a signal can be obtained by finding the area under the * squared signal. This takes the form of Sum(x_n^2), where x is the @@ -554,32 +605,34 @@ static inline ALfloat CalcDensityGain(ALfloat a) * where a is the attenuation coefficient, and n is the sample. The area * under this decay curve can be calculated as: 1 / (1 - a). * - * Modifying the above equation to find the squared area under the curve + * Modifying the above equation to find the area under the squared curve * (for energy) yields: 1 / (1 - a^2). Input attenuation can then be * calculated by inverting the square root of this approximation, * yielding: 1 / sqrt(1 / (1 - a^2)), simplified to: sqrt(1 - a^2). */ - return sqrtf(1.0f - (a * a)); + return sqrtf(1.0f - a*a); } -// Calculate the mixing matrix coefficients given a diffusion factor. -static inline ALvoid CalcMatrixCoeffs(ALfloat diffusion, ALfloat *x, ALfloat *y) +/* Calculate the scattering matrix coefficients given a diffusion factor. */ +static inline ALvoid CalcMatrixCoeffs(const ALfloat diffusion, ALfloat *x, ALfloat *y) { ALfloat n, t; - // The matrix is of order 4, so n is sqrt (4 - 1). + /* The matrix is of order 4, so n is sqrt(4 - 1). */ n = sqrtf(3.0f); t = diffusion * atanf(n); - // Calculate the first mixing matrix coefficient. + /* Calculate the first mixing matrix coefficient. */ *x = cosf(t); - // Calculate the second mixing matrix coefficient. + /* Calculate the second mixing matrix coefficient. */ *y = sinf(t) / n; } -// Calculate the limited HF ratio for use with the late reverb low-pass -// filters. -static ALfloat CalcLimitedHfRatio(ALfloat hfRatio, ALfloat airAbsorptionGainHF, ALfloat decayTime) +/* Calculate the limited HF ratio for use with the late reverb low-pass + * filters. + */ +static ALfloat CalcLimitedHfRatio(const ALfloat hfRatio, const ALfloat airAbsorptionGainHF, + const ALfloat decayTime, const ALfloat SpeedOfSound) { ALfloat limitRatio; @@ -588,420 +641,591 @@ static ALfloat CalcLimitedHfRatio(ALfloat hfRatio, ALfloat airAbsorptionGainHF, * equation, solve for HF ratio. The delay length is cancelled out of * the equation, so it can be calculated once for all lines. */ - limitRatio = 1.0f / (CalcDecayLength(airAbsorptionGainHF, decayTime) * - SPEEDOFSOUNDMETRESPERSEC); - /* Using the limit calculated above, apply the upper bound to the HF - * ratio. Also need to limit the result to a minimum of 0.1, just like the - * HF ratio parameter. */ - return clampf(limitRatio, 0.1f, hfRatio); + limitRatio = 1.0f / (CalcDecayLength(airAbsorptionGainHF, decayTime) * SpeedOfSound); + + /* Using the limit calculated above, apply the upper bound to the HF ratio. + */ + return minf(limitRatio, hfRatio); } -// Calculate the coefficient for a HF (and eventually LF) decay damping -// filter. -static inline ALfloat CalcDampingCoeff(ALfloat hfRatio, ALfloat length, ALfloat decayTime, ALfloat decayCoeff, ALfloat cw) +/* Calculates the first-order high-pass coefficients following the I3DL2 + * reference model. This is the transfer function: + * + * 1 - z^-1 + * H(z) = p ------------ + * 1 - p z^-1 + * + * And this is the I3DL2 coefficient calculation given gain (g) and reference + * angular frequency (w): + * + * g + * p = ------------------------------------------------------ + * g cos(w) + sqrt((cos(w) - 1) (g^2 cos(w) + g^2 - 2)) + * + * The coefficient is applied to the partial differential filter equation as: + * + * c_0 = p + * c_1 = -p + * c_2 = p + * y_i = c_0 x_i + c_1 x_(i-1) + c_2 y_(i-1) + * + */ +static inline void CalcHighpassCoeffs(const ALfloat gain, const ALfloat w, ALfloat coeffs[3]) { - ALfloat coeff, g; + ALfloat g, g2, cw, p; - // Eventually this should boost the high frequencies when the ratio - // exceeds 1. - coeff = 0.0f; - if (hfRatio < 1.0f) + if(gain >= 1.0f) { - // Calculate the low-pass coefficient by dividing the HF decay - // coefficient by the full decay coefficient. - g = CalcDecayCoeff(length, decayTime * hfRatio) / decayCoeff; - - // Damping is done with a 1-pole filter, so g needs to be squared. - g *= g; - if(g < 0.9999f) /* 1-epsilon */ - { - /* Be careful with gains < 0.001, as that causes the coefficient - * head towards 1, which will flatten the signal. */ - g = maxf(g, 0.001f); - coeff = (1 - g*cw - sqrtf(2*g*(1-cw) - g*g*(1 - cw*cw))) / - (1 - g); - } - - // Very low decay times will produce minimal output, so apply an - // upper bound to the coefficient. - coeff = minf(coeff, 0.98f); + coeffs[0] = 1.0f; + coeffs[1] = 0.0f; + coeffs[2] = 0.0f; + return; } - return coeff; + + g = maxf(0.001f, gain); + g2 = g * g; + cw = cosf(w); + p = g / (g*cw + sqrtf((cw - 1.0f) * (g2*cw + g2 - 2.0f))); + + coeffs[0] = p; + coeffs[1] = -p; + coeffs[2] = p; } -// Update the EAX modulation index, range, and depth. Keep in mind that this -// kind of vibrato is additive and not multiplicative as one may expect. The -// downswing will sound stronger than the upswing. -static ALvoid UpdateModulator(ALfloat modTime, ALfloat modDepth, ALuint frequency, ALreverbState *State) +/* Calculates the first-order low-pass coefficients following the I3DL2 + * reference model. This is the transfer function: + * + * (1 - a) z^0 + * H(z) = ---------------- + * 1 z^0 - a z^-1 + * + * And this is the I3DL2 coefficient calculation given gain (g) and reference + * angular frequency (w): + * + * 1 - g^2 cos(w) - sqrt(2 g^2 (1 - cos(w)) - g^4 (1 - cos(w)^2)) + * a = ---------------------------------------------------------------- + * 1 - g^2 + * + * The coefficient is applied to the partial differential filter equation as: + * + * c_0 = 1 - a + * c_1 = 0 + * c_2 = a + * y_i = c_0 x_i + c_1 x_(i-1) + c_2 y_(i-1) + * + */ +static inline void CalcLowpassCoeffs(const ALfloat gain, const ALfloat w, ALfloat coeffs[3]) { - ALuint range; + ALfloat g, g2, cw, a; - /* Modulation is calculated in two parts. - * - * The modulation time effects the sinus applied to the change in - * frequency. An index out of the current time range (both in samples) - * is incremented each sample. The range is bound to a reasonable - * minimum (1 sample) and when the timing changes, the index is rescaled - * to the new range (to keep the sinus consistent). - */ - range = maxu(fastf2u(modTime*frequency), 1); - State->Mod.Index = (ALuint)(State->Mod.Index * (ALuint64)range / - State->Mod.Range); - State->Mod.Range = range; + if(gain >= 1.0f) + { + coeffs[0] = 1.0f; + coeffs[1] = 0.0f; + coeffs[2] = 0.0f; + return; + } - /* The modulation depth effects the amount of frequency change over the - * range of the sinus. It needs to be scaled by the modulation time so - * that a given depth produces a consistent change in frequency over all - * ranges of time. Since the depth is applied to a sinus value, it needs - * to be halfed once for the sinus range and again for the sinus swing - * in time (half of it is spent decreasing the frequency, half is spent - * increasing it). - */ - State->Mod.Depth = modDepth * MODULATION_DEPTH_COEFF * modTime / 2.0f / - 2.0f * frequency; + /* Be careful with gains < 0.001, as that causes the coefficient + * to head towards 1, which will flatten the signal. */ + g = maxf(0.001f, gain); + g2 = g * g; + cw = cosf(w); + a = (1.0f - g2*cw - sqrtf((2.0f*g2*(1.0f - cw)) - g2*g2*(1.0f - cw*cw))) / + (1.0f - g2); + + coeffs[0] = 1.0f - a; + coeffs[1] = 0.0f; + coeffs[2] = a; } -// Update the offsets for the main effect delay line. -static ALvoid UpdateDelayLine(ALfloat earlyDelay, ALfloat lateDelay, ALfloat density, ALuint frequency, ALreverbState *State) +/* Calculates the first-order low-shelf coefficients. The shelf filters are + * used in place of low/high-pass filters to preserve the mid-band. This is + * the transfer function: + * + * a_0 + a_1 z^-1 + * H(z) = ---------------- + * 1 + b_1 z^-1 + * + * And these are the coefficient calculations given cut gain (g) and a center + * angular frequency (w): + * + * sin(0.5 (pi - w) - 0.25 pi) + * p = ----------------------------- + * sin(0.5 (pi - w) + 0.25 pi) + * + * g + 1 g + 1 + * a = ------- + sqrt((-------)^2 - 1) + * g - 1 g - 1 + * + * 1 + g + (1 - g) a + * b_0 = ------------------- + * 2 + * + * 1 - g + (1 + g) a + * b_1 = ------------------- + * 2 + * + * The coefficients are applied to the partial differential filter equation + * as: + * + * b_0 + p b_1 + * c_0 = ------------- + * 1 + p a + * + * -(b_1 + p b_0) + * c_1 = ---------------- + * 1 + p a + * + * p + a + * c_2 = --------- + * 1 + p a + * + * y_i = c_0 x_i + c_1 x_(i-1) + c_2 y_(i-1) + * + */ +static inline void CalcLowShelfCoeffs(const ALfloat gain, const ALfloat w, ALfloat coeffs[3]) { - ALfloat length; + ALfloat g, rw, p, n; + ALfloat alpha, beta0, beta1; + + if(gain >= 1.0f) + { + coeffs[0] = 1.0f; + coeffs[1] = 0.0f; + coeffs[2] = 0.0f; + return; + } + + g = maxf(0.001f, gain); + rw = F_PI - w; + p = sinf(0.5f*rw - 0.25f*F_PI) / sinf(0.5f*rw + 0.25f*F_PI); + n = (g + 1.0f) / (g - 1.0f); + alpha = n + sqrtf(n*n - 1.0f); + beta0 = (1.0f + g + (1.0f - g)*alpha) / 2.0f; + beta1 = (1.0f - g + (1.0f + g)*alpha) / 2.0f; + + coeffs[0] = (beta0 + p*beta1) / (1.0f + p*alpha); + coeffs[1] = -(beta1 + p*beta0) / (1.0f + p*alpha); + coeffs[2] = (p + alpha) / (1.0f + p*alpha); +} + +/* Calculates the first-order high-shelf coefficients. The shelf filters are + * used in place of low/high-pass filters to preserve the mid-band. This is + * the transfer function: + * + * a_0 + a_1 z^-1 + * H(z) = ---------------- + * 1 + b_1 z^-1 + * + * And these are the coefficient calculations given cut gain (g) and a center + * angular frequency (w): + * + * sin(0.5 w - 0.25 pi) + * p = ---------------------- + * sin(0.5 w + 0.25 pi) + * + * g + 1 g + 1 + * a = ------- + sqrt((-------)^2 - 1) + * g - 1 g - 1 + * + * 1 + g + (1 - g) a + * b_0 = ------------------- + * 2 + * + * 1 - g + (1 + g) a + * b_1 = ------------------- + * 2 + * + * The coefficients are applied to the partial differential filter equation + * as: + * + * b_0 + p b_1 + * c_0 = ------------- + * 1 + p a + * + * b_1 + p b_0 + * c_1 = ------------- + * 1 + p a + * + * -(p + a) + * c_2 = ---------- + * 1 + p a + * + * y_i = c_0 x_i + c_1 x_(i-1) + c_2 y_(i-1) + * + */ +static inline void CalcHighShelfCoeffs(const ALfloat gain, const ALfloat w, ALfloat coeffs[3]) +{ + ALfloat g, p, n; + ALfloat alpha, beta0, beta1; + + if(gain >= 1.0f) + { + coeffs[0] = 1.0f; + coeffs[1] = 0.0f; + coeffs[2] = 0.0f; + return; + } + + g = maxf(0.001f, gain); + p = sinf(0.5f*w - 0.25f*F_PI) / sinf(0.5f*w + 0.25f*F_PI); + n = (g + 1.0f) / (g - 1.0f); + alpha = n + sqrtf(n*n - 1.0f); + beta0 = (1.0f + g + (1.0f - g)*alpha) / 2.0f; + beta1 = (1.0f - g + (1.0f + g)*alpha) / 2.0f; + + coeffs[0] = (beta0 + p*beta1) / (1.0f + p*alpha); + coeffs[1] = (beta1 + p*beta0) / (1.0f + p*alpha); + coeffs[2] = -(p + alpha) / (1.0f + p*alpha); +} + +/* Calculates the 3-band T60 damping coefficients for a particular delay line + * of specified length using a combination of two low/high-pass/shelf or + * pass-through filter sections (producing 3 coefficients each) given decay + * times for each band split at two (LF/HF) reference frequencies (w). + */ +static void CalcT60DampingCoeffs(const ALfloat length, const ALfloat lfDecayTime, + const ALfloat mfDecayTime, const ALfloat hfDecayTime, + const ALfloat lfW, const ALfloat hfW, ALfloat lfcoeffs[3], + ALfloat hfcoeffs[3]) +{ + ALfloat lfGain = CalcDecayCoeff(length, lfDecayTime); + ALfloat mfGain = CalcDecayCoeff(length, mfDecayTime); + ALfloat hfGain = CalcDecayCoeff(length, hfDecayTime); + + if(lfGain <= mfGain) + { + CalcHighpassCoeffs(lfGain / mfGain, lfW, lfcoeffs); + if(mfGain >= hfGain) + { + CalcLowpassCoeffs(hfGain / mfGain, hfW, hfcoeffs); + hfcoeffs[0] *= mfGain; hfcoeffs[1] *= mfGain; + } + else + { + CalcLowShelfCoeffs(mfGain / hfGain, hfW, hfcoeffs); + hfcoeffs[0] *= hfGain; hfcoeffs[1] *= hfGain; + } + } + else + { + CalcHighShelfCoeffs(mfGain / lfGain, lfW, lfcoeffs); + if(mfGain >= hfGain) + { + CalcLowpassCoeffs(hfGain / mfGain, hfW, hfcoeffs); + hfcoeffs[0] *= lfGain; hfcoeffs[1] *= lfGain; + } + else + { + ALfloat hg = mfGain / lfGain; + ALfloat lg = mfGain / hfGain; + ALfloat mg = maxf(lfGain, hfGain) / maxf(hg, lg); + + CalcLowShelfCoeffs(lg, hfW, hfcoeffs); + hfcoeffs[0] *= mg; hfcoeffs[1] *= mg; + } + } +} + +/* Update the offsets for the main effect delay line. */ +static ALvoid UpdateDelayLine(const ALfloat earlyDelay, const ALfloat lateDelay, const ALfloat density, const ALfloat decayTime, const ALuint frequency, ALreverbState *State) +{ + ALfloat multiplier, length; ALuint i; - /* The early reflections and late reverb inputs are decorrelated to provide - * time-varying reflections, smooth out the reverb tail, and reduce harsh - * echoes. The first tap occurs immediately, while the remaining taps are - * delayed by multiples of a fraction of the smallest cyclical delay time. - * - * offset[index] = (FRACTION (MULTIPLIER^(index-1))) smallest_delay - * - * for index = 1...max_lines - */ - State->EarlyDelayTap[0] = fastf2u(earlyDelay * frequency); - for(i = 1;i < 4;i++) - { - length = (DECO_FRACTION * powf(DECO_MULTIPLIER, (ALfloat)i-1.0f)) * - EARLY_LINE_LENGTH[0]; - State->EarlyDelayTap[i] = fastf2u(length * frequency) + State->EarlyDelayTap[0]; - } + multiplier = CalcDelayLengthMult(density); - State->LateDelayTap[0] = fastf2u((earlyDelay + lateDelay) * frequency); - for(i = 1;i < 4;i++) + /* Early reflection taps are decorrelated by means of an average room + * reflection approximation described above the definition of the taps. + * This approximation is linear and so the above density multiplier can + * be applied to adjust the width of the taps. A single-band decay + * coefficient is applied to simulate initial attenuation and absorption. + * + * Late reverb taps are based on the late line lengths to allow a zero- + * delay path and offsets that would continue the propagation naturally + * into the late lines. + */ + for(i = 0;i < NUM_LINES;i++) { - length = (DECO_FRACTION * powf(DECO_MULTIPLIER, (ALfloat)i-1.0f)) * - LATE_LINE_LENGTH[0] * (1.0f + (density * LATE_LINE_MULTIPLIER)); - State->LateDelayTap[i] = fastf2u(length * frequency) + State->LateDelayTap[0]; + length = earlyDelay + EARLY_TAP_LENGTHS[i]*multiplier; + State->EarlyDelayTap[i][1] = float2int(length * frequency); + + length = EARLY_TAP_LENGTHS[i]*multiplier; + State->EarlyDelayCoeff[i] = CalcDecayCoeff(length, decayTime); + + length = lateDelay + (LATE_LINE_LENGTHS[i] - LATE_LINE_LENGTHS[0])*0.25f*multiplier; + State->LateDelayTap[i][1] = State->LateFeedTap + float2int(length * frequency); } } -// Update the early reflections mix and line coefficients. -static ALvoid UpdateEarlyLines(ALfloat lateDelay, ALreverbState *State) +/* Update the early reflection line lengths and gain coefficients. */ +static ALvoid UpdateEarlyLines(const ALfloat density, const ALfloat decayTime, const ALuint frequency, EarlyReflections *Early) { - ALuint index; + ALfloat multiplier, length; + ALsizei i; - // Calculate the gain (coefficient) for each early delay line using the - // late delay time. This expands the early reflections to the start of - // the late reverb. - for(index = 0;index < 4;index++) - State->Early.Coeff[index] = CalcDecayCoeff(EARLY_LINE_LENGTH[index], - lateDelay); + multiplier = CalcDelayLengthMult(density); + + for(i = 0;i < NUM_LINES;i++) + { + /* Calculate the length (in seconds) of each all-pass line. */ + length = EARLY_ALLPASS_LENGTHS[i] * multiplier; + + /* Calculate the delay offset for each all-pass line. */ + Early->VecAp.Offset[i][1] = float2int(length * frequency); + + /* Calculate the length (in seconds) of each delay line. */ + length = EARLY_LINE_LENGTHS[i] * multiplier; + + /* Calculate the delay offset for each delay line. */ + Early->Offset[i][1] = float2int(length * frequency); + + /* Calculate the gain (coefficient) for each line. */ + Early->Coeff[i] = CalcDecayCoeff(length, decayTime); + } } -// Update the late reverb mix, line lengths, and line coefficients. -static ALvoid UpdateLateLines(ALfloat xMix, ALfloat density, ALfloat decayTime, ALfloat diffusion, ALfloat echoDepth, ALfloat hfRatio, ALfloat cw, ALuint frequency, ALreverbState *State) +/* Update the late reverb line lengths and T60 coefficients. */ +static ALvoid UpdateLateLines(const ALfloat density, const ALfloat diffusion, const ALfloat lfDecayTime, const ALfloat mfDecayTime, const ALfloat hfDecayTime, const ALfloat lfW, const ALfloat hfW, const ALfloat echoTime, const ALfloat echoDepth, const ALuint frequency, LateReverb *Late) { - ALfloat length; - ALuint index; - - /* Calculate the late reverb gain. Since the output is tapped prior to the - * application of the next delay line coefficients, this gain needs to be - * attenuated by the 'x' mixing matrix coefficient as well. Also attenuate - * the late reverb when echo depth is high and diffusion is low, so the - * echo is slightly stronger than the decorrelated echos in the reverb - * tail. - */ - State->Late.Gain = xMix * (1.0f - (echoDepth*0.5f*(1.0f - diffusion))); + ALfloat multiplier, length, bandWeights[3]; + ALsizei i; /* To compensate for changes in modal density and decay time of the late * reverb signal, the input is attenuated based on the maximal energy of * the outgoing signal. This approximation is used to keep the apparent * energy of the signal equal for all ranges of density and decay time. * - * The average length of the cyclcical delay lines is used to calculate - * the attenuation coefficient. + * The average length of the delay lines is used to calculate the + * attenuation coefficient. */ - length = (LATE_LINE_LENGTH[0] + LATE_LINE_LENGTH[1] + - LATE_LINE_LENGTH[2] + LATE_LINE_LENGTH[3]) / 4.0f; - length *= 1.0f + (density * LATE_LINE_MULTIPLIER); - /* To account for each channel being a discrete input, also multiply by - * sqrt(num_channels). + multiplier = CalcDelayLengthMult(density); + length = (LATE_LINE_LENGTHS[0] + LATE_LINE_LENGTHS[1] + + LATE_LINE_LENGTHS[2] + LATE_LINE_LENGTHS[3]) / 4.0f * multiplier; + /* Include the echo transformation (see below). */ + length = lerp(length, echoTime, echoDepth); + length += (LATE_ALLPASS_LENGTHS[0] + LATE_ALLPASS_LENGTHS[1] + + LATE_ALLPASS_LENGTHS[2] + LATE_ALLPASS_LENGTHS[3]) / 4.0f * multiplier; + /* The density gain calculation uses an average decay time weighted by + * approximate bandwidth. This attempts to compensate for losses of + * energy that reduce decay time due to scattering into highly attenuated + * bands. */ - State->Late.DensityGain = 2.0f * CalcDensityGain( - CalcDecayCoeff(length, decayTime) + bandWeights[0] = lfW; + bandWeights[1] = hfW - lfW; + bandWeights[2] = F_TAU - hfW; + Late->DensityGain = CalcDensityGain( + CalcDecayCoeff(length, (bandWeights[0]*lfDecayTime + bandWeights[1]*mfDecayTime + + bandWeights[2]*hfDecayTime) / F_TAU) ); - // Calculate the all-pass feed-back and feed-forward coefficient. - State->Late.ApFeedCoeff = 0.5f * powf(diffusion, 2.0f); - - for(index = 0;index < 4;index++) + for(i = 0;i < NUM_LINES;i++) { - // Calculate the gain (coefficient) for each all-pass line. - State->Late.Ap[index].Coeff = CalcDecayCoeff( - ALLPASS_LINE_LENGTH[index], decayTime - ); + /* Calculate the length (in seconds) of each all-pass line. */ + length = LATE_ALLPASS_LENGTHS[i] * multiplier; - // Calculate the length (in seconds) of each cyclical delay line. - length = LATE_LINE_LENGTH[index] * - (1.0f + (density * LATE_LINE_MULTIPLIER)); + /* Calculate the delay offset for each all-pass line. */ + Late->VecAp.Offset[i][1] = float2int(length * frequency); - // Calculate the delay offset for each cyclical delay line. - State->Late.Offset[index] = fastf2u(length * frequency); + /* Calculate the length (in seconds) of each delay line. This also + * applies the echo transformation. As the EAX echo depth approaches + * 1, the line lengths approach a length equal to the echoTime. This + * helps to produce distinct echoes along the tail. + */ + length = lerp(LATE_LINE_LENGTHS[i] * multiplier, echoTime, echoDepth); - // Calculate the gain (coefficient) for each cyclical line. - State->Late.Coeff[index] = CalcDecayCoeff(length, decayTime); + /* Calculate the delay offset for each delay line. */ + Late->Offset[i][1] = float2int(length*frequency + 0.5f); - // Calculate the damping coefficient for each low-pass filter. - State->Late.Lp[index].Coeff = CalcDampingCoeff( - hfRatio, length, decayTime, State->Late.Coeff[index], cw - ); + /* Approximate the absorption that the vector all-pass would exhibit + * given the current diffusion so we don't have to process a full T60 + * filter for each of its four lines. + */ + length += lerp(LATE_ALLPASS_LENGTHS[i], + (LATE_ALLPASS_LENGTHS[0] + LATE_ALLPASS_LENGTHS[1] + + LATE_ALLPASS_LENGTHS[2] + LATE_ALLPASS_LENGTHS[3]) / 4.0f, + diffusion) * multiplier; - // Attenuate the cyclical line coefficients by the mixing coefficient - // (x). - State->Late.Coeff[index] *= xMix; + /* Calculate the T60 damping coefficients for each line. */ + CalcT60DampingCoeffs(length, lfDecayTime, mfDecayTime, hfDecayTime, + lfW, hfW, Late->T60[i].LFCoeffs, + Late->T60[i].HFCoeffs); } } -// Update the echo gain, line offset, line coefficients, and mixing -// coefficients. -static ALvoid UpdateEchoLine(ALfloat echoTime, ALfloat decayTime, ALfloat diffusion, ALfloat echoDepth, ALfloat hfRatio, ALfloat cw, ALuint frequency, ALreverbState *State) -{ - // Update the offset and coefficient for the echo delay line. - State->Echo.Offset = fastf2u(echoTime * frequency); - - // Calculate the decay coefficient for the echo line. - State->Echo.Coeff = CalcDecayCoeff(echoTime, decayTime); - - // Calculate the energy-based attenuation coefficient for the echo delay - // line. - State->Echo.DensityGain = CalcDensityGain(State->Echo.Coeff); - - // Calculate the echo all-pass feed coefficient. - State->Echo.ApFeedCoeff = 0.5f * powf(diffusion, 2.0f); - - // Calculate the echo all-pass attenuation coefficient. - State->Echo.ApCoeff = CalcDecayCoeff(ECHO_ALLPASS_LENGTH, decayTime); - - // Calculate the damping coefficient for each low-pass filter. - State->Echo.LpCoeff = CalcDampingCoeff(hfRatio, echoTime, decayTime, - State->Echo.Coeff, cw); - - /* Calculate the echo mixing coefficient. This is applied to the output mix - * only, not the feedback. - */ - State->Echo.MixCoeff = echoDepth; -} - -/* Creates a transform matrix given a reverb vector. This works by creating a - * Z-focus transform, then a rotate transform around X, then Y, to place the - * focal point in the direction of the vector, using the vector length as a - * focus strength. - * - * This isn't technically correct since the vector is supposed to define the - * aperture and not rotate the perceived soundfield, but in practice it's - * probably good enough. +/* Creates a transform matrix given a reverb vector. The vector pans the reverb + * reflections toward the given direction, using its magnitude (up to 1) as a + * focal strength. This function results in a B-Format transformation matrix + * that spatially focuses the signal in the desired direction. */ static aluMatrixf GetTransformFromVector(const ALfloat *vec) { - aluMatrixf zfocus, xrot, yrot; - aluMatrixf tmp1, tmp2; - ALfloat length; - ALfloat sa, a; + const ALfloat sqrt_3 = 1.732050808f; + aluMatrixf focus; + ALfloat norm[3]; + ALfloat mag; - length = sqrtf(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]); - - /* Define a Z-focus (X in Ambisonics) transform, given the panning vector - * length. + /* Normalize the panning vector according to the N3D scale, which has an + * extra sqrt(3) term on the directional components. Converting from OpenAL + * to B-Format also requires negating X (ACN 1) and Z (ACN 3). Note however + * that the reverb panning vectors use left-handed coordinates, unlike the + * rest of OpenAL which use right-handed. This is fixed by negating Z, + * which cancels out with the B-Format Z negation. */ - sa = sinf(minf(length, 1.0f) * (F_PI/4.0f)); - aluMatrixfSet(&zfocus, - 1.0f/(1.0f+sa), 0.0f, 0.0f, (sa/(1.0f+sa))/1.732050808f, - 0.0f, sqrtf((1.0f-sa)/(1.0f+sa)), 0.0f, 0.0f, - 0.0f, 0.0f, sqrtf((1.0f-sa)/(1.0f+sa)), 0.0f, - (sa/(1.0f+sa))*1.732050808f, 0.0f, 0.0f, 1.0f/(1.0f+sa) + mag = sqrtf(vec[0]*vec[0] + vec[1]*vec[1] + vec[2]*vec[2]); + if(mag > 1.0f) + { + norm[0] = vec[0] / mag * -sqrt_3; + norm[1] = vec[1] / mag * sqrt_3; + norm[2] = vec[2] / mag * sqrt_3; + mag = 1.0f; + } + else + { + /* If the magnitude is less than or equal to 1, just apply the sqrt(3) + * term. There's no need to renormalize the magnitude since it would + * just be reapplied in the matrix. + */ + norm[0] = vec[0] * -sqrt_3; + norm[1] = vec[1] * sqrt_3; + norm[2] = vec[2] * sqrt_3; + } + + aluMatrixfSet(&focus, + 1.0f, 0.0f, 0.0f, 0.0f, + norm[0], 1.0f-mag, 0.0f, 0.0f, + norm[1], 0.0f, 1.0f-mag, 0.0f, + norm[2], 0.0f, 0.0f, 1.0f-mag ); - /* Define rotation around X (Y in Ambisonics) */ - a = atan2f(vec[1], sqrtf(vec[0]*vec[0] + vec[2]*vec[2])); - aluMatrixfSet(&xrot, - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, cosf(a), sinf(a), - 0.0f, 0.0f, -sinf(a), cosf(a) - ); - - /* Define rotation around Y (Z in Ambisonics). NOTE: EFX's reverb vectors - * use a right-handled coordinate system, compared to the rest of OpenAL - * which uses left-handed. This is fixed by negating Z, however it would - * need to also be negated to get a proper Ambisonics angle, thus - * cancelling it out. - */ - a = atan2f(-vec[0], vec[2]); - aluMatrixfSet(&yrot, - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, cosf(a), 0.0f, sinf(a), - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, -sinf(a), 0.0f, cosf(a) - ); - -#define MATRIX_MULT(_res, _m1, _m2) do { \ - int row, col; \ - for(col = 0;col < 4;col++) \ - { \ - for(row = 0;row < 4;row++) \ - _res.m[row][col] = _m1.m[row][0]*_m2.m[0][col] + _m1.m[row][1]*_m2.m[1][col] + \ - _m1.m[row][2]*_m2.m[2][col] + _m1.m[row][3]*_m2.m[3][col]; \ - } \ -} while(0) - /* Define a matrix that first focuses on Z, then rotates around X then Y to - * focus the output in the direction of the vector. - */ - MATRIX_MULT(tmp1, xrot, zfocus); - MATRIX_MULT(tmp2, yrot, tmp1); -#undef MATRIX_MULT - - return tmp2; + return focus; } -// Update the early and late 3D panning gains. -static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *ReflectionsPan, const ALfloat *LateReverbPan, ALfloat Gain, ALfloat EarlyGain, ALfloat LateGain, ALreverbState *State) +/* Update the early and late 3D panning gains. */ +static ALvoid Update3DPanning(const ALCdevice *Device, const ALfloat *ReflectionsPan, const ALfloat *LateReverbPan, const ALfloat gain, const ALfloat earlyGain, const ALfloat lateGain, ALreverbState *State) { - /* Converts early reflections A-Format to B-Format (transposed). */ - static const aluMatrixf EarlyA2B = {{ - { 0.8660254038f, 0.8660254038f, 0.8660254038f, 0.8660254038f }, - { 0.8660254038f, 0.8660254038f, -0.8660254038f, -0.8660254038f }, - { 0.8660254038f, -0.8660254038f, 0.8660254038f, -0.8660254038f }, - { 0.8660254038f, -0.8660254038f, -0.8660254038f, 0.8660254038f } - }}; - /* Converts late reverb A-Format to B-Format (transposed). */ - static const aluMatrixf LateA2B = {{ - { 0.8660254038f, -0.8660254038f, 0.8660254038f, 0.8660254038f }, - { 0.8660254038f, -0.8660254038f, -0.8660254038f, -0.8660254038f }, - { 0.8660254038f, 0.8660254038f, 0.8660254038f, -0.8660254038f }, - { 0.8660254038f, 0.8660254038f, -0.8660254038f, 0.8660254038f } -/* { 0.8660254038f, 1.2247448714f, 0.0f, 0.8660254038f }, - { 0.8660254038f, 0.0f, -1.2247448714f, -0.8660254038f }, - { 0.8660254038f, 0.0f, 1.2247448714f, -0.8660254038f }, - { 0.8660254038f, -1.2247448714f, 0.0f, 0.8660254038f }*/ - }}; aluMatrixf transform, rot; - ALuint i; + ALsizei i; STATIC_CAST(ALeffectState,State)->OutBuffer = Device->FOAOut.Buffer; STATIC_CAST(ALeffectState,State)->OutChannels = Device->FOAOut.NumChannels; - /* Note: Both _m2 and _res are transposed. */ -#define MATRIX_MULT(_res, _m1, _m2) do { \ - int row, col; \ - for(col = 0;col < 4;col++) \ - { \ - for(row = 0;row < 4;row++) \ - _res.m[col][row] = _m1.m[row][0]*_m2.m[col][0] + _m1.m[row][1]*_m2.m[col][1] + \ - _m1.m[row][2]*_m2.m[col][2] + _m1.m[row][3]*_m2.m[col][3]; \ - } \ + /* Note: _res is transposed. */ +#define MATRIX_MULT(_res, _m1, _m2) do { \ + int row, col; \ + for(col = 0;col < 4;col++) \ + { \ + for(row = 0;row < 4;row++) \ + _res.m[col][row] = _m1.m[row][0]*_m2.m[0][col] + _m1.m[row][1]*_m2.m[1][col] + \ + _m1.m[row][2]*_m2.m[2][col] + _m1.m[row][3]*_m2.m[3][col]; \ + } \ } while(0) - /* Create a matrix that first converts A-Format to B-Format, then rotates - * the B-Format soundfield according to the panning vector. + /* Create a matrix that first converts A-Format to B-Format, then + * transforms the B-Format signal according to the panning vector. */ rot = GetTransformFromVector(ReflectionsPan); - MATRIX_MULT(transform, rot, EarlyA2B); + MATRIX_MULT(transform, rot, A2B); memset(&State->Early.PanGain, 0, sizeof(State->Early.PanGain)); for(i = 0;i < MAX_EFFECT_CHANNELS;i++) - ComputeFirstOrderGains(Device->FOAOut, transform.m[i], Gain*EarlyGain, State->Early.PanGain[i]); + ComputeFirstOrderGains(&Device->FOAOut, transform.m[i], gain*earlyGain, + State->Early.PanGain[i]); rot = GetTransformFromVector(LateReverbPan); - MATRIX_MULT(transform, rot, LateA2B); + MATRIX_MULT(transform, rot, A2B); memset(&State->Late.PanGain, 0, sizeof(State->Late.PanGain)); for(i = 0;i < MAX_EFFECT_CHANNELS;i++) - ComputeFirstOrderGains(Device->FOAOut, transform.m[i], Gain*LateGain, State->Late.PanGain[i]); + ComputeFirstOrderGains(&Device->FOAOut, transform.m[i], gain*lateGain, + State->Late.PanGain[i]); #undef MATRIX_MULT } -static ALvoid ALreverbState_update(ALreverbState *State, const ALCdevice *Device, const ALeffectslot *Slot, const ALeffectProps *props) +static ALvoid ALreverbState_update(ALreverbState *State, const ALCcontext *Context, const ALeffectslot *Slot, const ALeffectProps *props) { + const ALCdevice *Device = Context->Device; + const ALlistener *Listener = Context->Listener; ALuint frequency = Device->Frequency; - ALfloat lfscale, hfscale, hfRatio; + ALfloat lf0norm, hf0norm, hfRatio; + ALfloat lfDecayTime, hfDecayTime; ALfloat gain, gainlf, gainhf; - ALfloat cw, x, y; - ALuint i; + ALsizei i; - if(Slot->Params.EffectType == AL_EFFECT_EAXREVERB && !EmulateEAXReverb) - State->IsEax = AL_TRUE; - else if(Slot->Params.EffectType == AL_EFFECT_REVERB || EmulateEAXReverb) - State->IsEax = AL_FALSE; - - // Calculate the master filters - hfscale = props->Reverb.HFReference / frequency; - gainhf = maxf(props->Reverb.GainHF, 0.0001f); - ALfilterState_setParams(&State->Filter[0].Lp, ALfilterType_HighShelf, - gainhf, hfscale, calc_rcpQ_from_slope(gainhf, 0.75f)); - lfscale = props->Reverb.LFReference / frequency; - gainlf = maxf(props->Reverb.GainLF, 0.0001f); - ALfilterState_setParams(&State->Filter[0].Hp, ALfilterType_LowShelf, - gainlf, lfscale, calc_rcpQ_from_slope(gainlf, 0.75f)); - for(i = 1;i < 4;i++) + /* Calculate the master filters */ + hf0norm = props->Reverb.HFReference / frequency; + /* Restrict the filter gains from going below -60dB to keep the filter from + * killing most of the signal. + */ + gainhf = maxf(props->Reverb.GainHF, 0.001f); + BiquadFilter_setParams(&State->Filter[0].Lp, BiquadType_HighShelf, gainhf, hf0norm, + calc_rcpQ_from_slope(gainhf, 1.0f)); + lf0norm = props->Reverb.LFReference / frequency; + gainlf = maxf(props->Reverb.GainLF, 0.001f); + BiquadFilter_setParams(&State->Filter[0].Hp, BiquadType_LowShelf, gainlf, lf0norm, + calc_rcpQ_from_slope(gainlf, 1.0f)); + for(i = 1;i < NUM_LINES;i++) { - State->Filter[i].Lp.a1 = State->Filter[0].Lp.a1; - State->Filter[i].Lp.a2 = State->Filter[0].Lp.a2; - State->Filter[i].Lp.b0 = State->Filter[0].Lp.b0; - State->Filter[i].Lp.b1 = State->Filter[0].Lp.b1; - State->Filter[i].Lp.b2 = State->Filter[0].Lp.b2; - - State->Filter[i].Hp.a1 = State->Filter[0].Hp.a1; - State->Filter[i].Hp.a2 = State->Filter[0].Hp.a2; - State->Filter[i].Hp.b0 = State->Filter[0].Hp.b0; - State->Filter[i].Hp.b1 = State->Filter[0].Hp.b1; - State->Filter[i].Hp.b2 = State->Filter[0].Hp.b2; + BiquadFilter_copyParams(&State->Filter[i].Lp, &State->Filter[0].Lp); + BiquadFilter_copyParams(&State->Filter[i].Hp, &State->Filter[0].Hp); } - // Update the modulator line. - UpdateModulator(props->Reverb.ModulationTime, props->Reverb.ModulationDepth, - frequency, State); - - // Update the main effect delay. + /* Update the main effect delay and associated taps. */ UpdateDelayLine(props->Reverb.ReflectionsDelay, props->Reverb.LateReverbDelay, - props->Reverb.Density, frequency, State); + props->Reverb.Density, props->Reverb.DecayTime, frequency, + State); - // Update the early lines. - UpdateEarlyLines(props->Reverb.LateReverbDelay, State); + /* Calculate the all-pass feed-back/forward coefficient. */ + State->ApFeedCoeff = sqrtf(0.5f) * powf(props->Reverb.Diffusion, 2.0f); - // Get the mixing matrix coefficients (x and y). - CalcMatrixCoeffs(props->Reverb.Diffusion, &x, &y); - // Then divide x into y to simplify the matrix calculation. - State->Late.MixCoeff = y / x; + /* Update the early lines. */ + UpdateEarlyLines(props->Reverb.Density, props->Reverb.DecayTime, + frequency, &State->Early); - // If the HF limit parameter is flagged, calculate an appropriate limit - // based on the air absorption parameter. + /* Get the mixing matrix coefficients. */ + CalcMatrixCoeffs(props->Reverb.Diffusion, &State->MixX, &State->MixY); + + /* If the HF limit parameter is flagged, calculate an appropriate limit + * based on the air absorption parameter. + */ hfRatio = props->Reverb.DecayHFRatio; if(props->Reverb.DecayHFLimit && props->Reverb.AirAbsorptionGainHF < 1.0f) hfRatio = CalcLimitedHfRatio(hfRatio, props->Reverb.AirAbsorptionGainHF, - props->Reverb.DecayTime); + props->Reverb.DecayTime, Listener->Params.ReverbSpeedOfSound + ); - cw = cosf(F_TAU * hfscale); - // Update the late lines. - UpdateLateLines(x, props->Reverb.Density, props->Reverb.DecayTime, - props->Reverb.Diffusion, props->Reverb.EchoDepth, - hfRatio, cw, frequency, State); + /* Calculate the LF/HF decay times. */ + lfDecayTime = clampf(props->Reverb.DecayTime * props->Reverb.DecayLFRatio, + AL_EAXREVERB_MIN_DECAY_TIME, AL_EAXREVERB_MAX_DECAY_TIME); + hfDecayTime = clampf(props->Reverb.DecayTime * hfRatio, + AL_EAXREVERB_MIN_DECAY_TIME, AL_EAXREVERB_MAX_DECAY_TIME); - // Update the echo line. - UpdateEchoLine(props->Reverb.EchoTime, props->Reverb.DecayTime, - props->Reverb.Diffusion, props->Reverb.EchoDepth, - hfRatio, cw, frequency, State); + /* Update the late lines. */ + UpdateLateLines(props->Reverb.Density, props->Reverb.Diffusion, + lfDecayTime, props->Reverb.DecayTime, hfDecayTime, + F_TAU * lf0norm, F_TAU * hf0norm, + props->Reverb.EchoTime, props->Reverb.EchoDepth, + frequency, &State->Late); + /* Update early and late 3D panning. */ gain = props->Reverb.Gain * Slot->Params.Gain * ReverbBoost; - // Update early and late 3D panning. Update3DPanning(Device, props->Reverb.ReflectionsPan, props->Reverb.LateReverbPan, gain, props->Reverb.ReflectionsGain, props->Reverb.LateReverbGain, State); + + /* Determine if delay-line cross-fading is required. */ + for(i = 0;i < NUM_LINES;i++) + { + if(State->EarlyDelayTap[i][1] != State->EarlyDelayTap[i][0] || + State->Early.VecAp.Offset[i][1] != State->Early.VecAp.Offset[i][0] || + State->Early.Offset[i][1] != State->Early.Offset[i][0] || + State->LateDelayTap[i][1] != State->LateDelayTap[i][0] || + State->Late.VecAp.Offset[i][1] != State->Late.VecAp.Offset[i][0] || + State->Late.Offset[i][1] != State->Late.Offset[i][0]) + { + State->FadeCount = 0; + break; + } + } } @@ -1009,415 +1233,373 @@ static ALvoid ALreverbState_update(ALreverbState *State, const ALCdevice *Device * Effect Processing * **************************************/ -// Basic delay line input/output routines. -static inline ALfloat DelayLineOut(DelayLine *Delay, ALuint offset) +/* Basic delay line input/output routines. */ +static inline ALfloat DelayLineOut(const DelayLineI *Delay, const ALsizei offset, const ALsizei c) { - return Delay->Line[offset&Delay->Mask]; + return Delay->Line[offset&Delay->Mask][c]; } -static inline ALvoid DelayLineIn(DelayLine *Delay, ALuint offset, ALfloat in) -{ - Delay->Line[offset&Delay->Mask] = in; -} - -static inline ALfloat DelayLineInOut(DelayLine *Delay, ALuint offset, ALuint outoffset, ALfloat in) -{ - Delay->Line[offset&Delay->Mask] = in; - return Delay->Line[(offset-outoffset)&Delay->Mask]; -} - -static void CalcModulationDelays(ALreverbState *State, ALfloat *restrict delays, ALuint todo) -{ - ALfloat sinus, range; - ALuint index, i; - - index = State->Mod.Index; - range = State->Mod.Filter; - for(i = 0;i < todo;i++) - { - /* Calculate the sinus rythm (dependent on modulation time and the - * sampling rate). The center of the sinus is moved to reduce the - * delay of the effect when the time or depth are low. - */ - sinus = 1.0f - cosf(F_TAU * index / State->Mod.Range); - - /* Step the modulation index forward, keeping it bound to its range. */ - index = (index+1) % State->Mod.Range; - - /* The depth determines the range over which to read the input samples - * from, so it must be filtered to reduce the distortion caused by even - * small parameter changes. - */ - range = lerp(range, State->Mod.Depth, State->Mod.Coeff); - - /* Calculate the read offset with fraction. */ - delays[i] = range*sinus; - } - State->Mod.Index = index; - State->Mod.Filter = range; -} - -// Given some input samples, this function produces modulation for the late -// reverb. -static void EAXModulation(DelayLine *ModDelay, ALuint offset, const ALfloat *restrict delays, ALfloat*restrict dst, const ALfloat*restrict src, ALuint todo) -{ - ALfloat frac, fdelay; - ALfloat out0, out1; - ALuint delay, i; - - for(i = 0;i < todo;i++) - { - /* Separate the integer offset and fraction between it and the next - * sample. - */ - frac = modff(delays[i], &fdelay); - delay = fastf2u(fdelay); - - /* Add the incoming sample to the delay line, and get the two samples - * crossed by the offset delay. - */ - out0 = DelayLineInOut(ModDelay, offset, delay, src[i]); - out1 = DelayLineOut(ModDelay, offset - delay - 1); - offset++; - - /* The output is obtained by linearly interpolating the two samples - * that were acquired above. - */ - dst[i] = lerp(out0, out1, frac); - } -} - -/* Given some input samples from the main delay line, this function produces - * four-channel outputs for the early reflections. +/* Cross-faded delay line output routine. Instead of interpolating the + * offsets, this interpolates (cross-fades) the outputs at each offset. */ -static ALvoid EarlyReflection(ALreverbState *State, ALuint todo, ALfloat (*restrict out)[MAX_UPDATE_SAMPLES]) +static inline ALfloat FadedDelayLineOut(const DelayLineI *Delay, const ALsizei off0, + const ALsizei off1, const ALsizei c, const ALfloat mu) { - ALfloat d[4], v, f[4]; - ALuint i; + return Delay->Line[off0&Delay->Mask][c]*(1.0f-mu) + + Delay->Line[off1&Delay->Mask][c]*( mu); +} +#define UnfadedDelayLineOut(d, o0, o1, c, mu) DelayLineOut(d, o0, c) - for(i = 0;i < todo;i++) - { - ALuint offset = State->Offset+i; - - /* Obtain the first reflection samples from the main delay line. */ - f[0] = DelayLineOut(&State->Delay, (offset-State->EarlyDelayTap[0])*4 + 0); - f[1] = DelayLineOut(&State->Delay, (offset-State->EarlyDelayTap[1])*4 + 1); - f[2] = DelayLineOut(&State->Delay, (offset-State->EarlyDelayTap[2])*4 + 2); - f[3] = DelayLineOut(&State->Delay, (offset-State->EarlyDelayTap[3])*4 + 3); - - /* The following uses a lossless scattering junction from waveguide - * theory. It actually amounts to a householder mixing matrix, which - * will produce a maximally diffuse response, and means this can - * probably be considered a simple feed-back delay network (FDN). - * N - * --- - * \ - * v = 2/N / d_i - * --- - * i=1 - */ - v = (f[0] + f[1] + f[2] + f[3]) * 0.5f; - - /* Calculate the feed values for the early delay lines. */ - d[0] = v - f[0]; - d[1] = v - f[1]; - d[2] = v - f[2]; - d[3] = v - f[3]; - - /* Feed the early delay lines, and load the delayed results. */ - d[0] = DelayLineInOut(&State->Early.Delay[0], offset, State->Early.Offset[0], d[0]); - d[1] = DelayLineInOut(&State->Early.Delay[1], offset, State->Early.Offset[1], d[1]); - d[2] = DelayLineInOut(&State->Early.Delay[2], offset, State->Early.Offset[2], d[2]); - d[3] = DelayLineInOut(&State->Early.Delay[3], offset, State->Early.Offset[3], d[3]); - - /* Output the initial reflection taps and the results of the delayed - * and decayed junction for all four channels. - */ - out[0][i] = f[0] + d[0]*State->Early.Coeff[0]; - out[1][i] = f[1] + d[1]*State->Early.Coeff[1]; - out[2][i] = f[2] + d[2]*State->Early.Coeff[2]; - out[3][i] = f[3] + d[3]*State->Early.Coeff[3]; - } +static inline ALvoid DelayLineIn(DelayLineI *Delay, ALsizei offset, const ALsizei c, + const ALfloat *restrict in, ALsizei count) +{ + ALsizei i; + for(i = 0;i < count;i++) + Delay->Line[(offset++)&Delay->Mask][c] = *(in++); } -// Basic attenuated all-pass input/output routine. -static inline ALfloat AllpassInOut(DelayLine *Delay, ALuint outOffset, ALuint inOffset, ALfloat in, ALfloat feedCoeff, ALfloat coeff) +static inline ALvoid DelayLineIn4(DelayLineI *Delay, ALsizei offset, const ALfloat in[NUM_LINES]) { - ALfloat out, feed; - - out = DelayLineOut(Delay, outOffset); - feed = feedCoeff * in; - DelayLineIn(Delay, inOffset, (feedCoeff * (out - feed)) + in); - - // The time-based attenuation is only applied to the delay output to - // keep it from affecting the feed-back path (which is already controlled - // by the all-pass feed coefficient). - return (coeff * out) - feed; + ALsizei i; + offset &= Delay->Mask; + for(i = 0;i < NUM_LINES;i++) + Delay->Line[offset][i] = in[i]; } -// All-pass input/output routine for late reverb. -static inline ALfloat LateAllPassInOut(ALreverbState *State, ALuint offset, ALuint index, ALfloat in) +static inline ALvoid DelayLineIn4Rev(DelayLineI *Delay, ALsizei offset, const ALfloat in[NUM_LINES]) { - return AllpassInOut(&State->Late.Ap[index].Delay, - offset - State->Late.Ap[index].Offset, - offset, in, State->Late.ApFeedCoeff, - State->Late.Ap[index].Coeff); + ALsizei i; + offset &= Delay->Mask; + for(i = 0;i < NUM_LINES;i++) + Delay->Line[offset][i] = in[NUM_LINES-1-i]; } -// Low-pass filter input/output routine for late reverb. -static inline ALfloat LateLowPassInOut(ALreverbState *State, ALuint index, ALfloat in) +/* Applies a scattering matrix to the 4-line (vector) input. This is used + * for both the below vector all-pass model and to perform modal feed-back + * delay network (FDN) mixing. + * + * The matrix is derived from a skew-symmetric matrix to form a 4D rotation + * matrix with a single unitary rotational parameter: + * + * [ d, a, b, c ] 1 = a^2 + b^2 + c^2 + d^2 + * [ -a, d, c, -b ] + * [ -b, -c, d, a ] + * [ -c, b, -a, d ] + * + * The rotation is constructed from the effect's diffusion parameter, + * yielding: + * + * 1 = x^2 + 3 y^2 + * + * Where a, b, and c are the coefficient y with differing signs, and d is the + * coefficient x. The final matrix is thus: + * + * [ x, y, -y, y ] n = sqrt(matrix_order - 1) + * [ -y, x, y, y ] t = diffusion_parameter * atan(n) + * [ y, -y, x, y ] x = cos(t) + * [ -y, -y, -y, x ] y = sin(t) / n + * + * Any square orthogonal matrix with an order that is a power of two will + * work (where ^T is transpose, ^-1 is inverse): + * + * M^T = M^-1 + * + * Using that knowledge, finding an appropriate matrix can be accomplished + * naively by searching all combinations of: + * + * M = D + S - S^T + * + * Where D is a diagonal matrix (of x), and S is a triangular matrix (of y) + * whose combination of signs are being iterated. + */ +static inline void VectorPartialScatter(ALfloat *restrict out, const ALfloat *restrict in, + const ALfloat xCoeff, const ALfloat yCoeff) { - in = lerp(in, State->Late.Lp[index].Sample, State->Late.Lp[index].Coeff); - State->Late.Lp[index].Sample = in; - return in; + out[0] = xCoeff*in[0] + yCoeff*( in[1] + -in[2] + in[3]); + out[1] = xCoeff*in[1] + yCoeff*(-in[0] + in[2] + in[3]); + out[2] = xCoeff*in[2] + yCoeff*( in[0] + -in[1] + in[3]); + out[3] = xCoeff*in[3] + yCoeff*(-in[0] + -in[1] + -in[2] ); } -// Given four decorrelated input samples, this function produces four-channel -// output for the late reverb. -static ALvoid LateReverb(ALreverbState *State, ALuint todo, ALfloat (*restrict out)[MAX_UPDATE_SAMPLES]) +/* Same as above, but reverses the input. */ +static inline void VectorPartialScatterRev(ALfloat *restrict out, const ALfloat *restrict in, + const ALfloat xCoeff, const ALfloat yCoeff) { - ALfloat d[4], f[4]; - ALuint offset; - ALuint base, i; - - offset = State->Offset; - for(base = 0;base < todo;) - { - ALfloat tmp[MAX_UPDATE_SAMPLES/4][4]; - ALuint tmp_todo = minu(todo, MAX_UPDATE_SAMPLES/4); - - for(i = 0;i < tmp_todo;i++) - { - /* Obtain four decorrelated input samples. */ - f[0] = DelayLineOut(&State->Delay, (offset-State->LateDelayTap[0])*4 + 0) * State->Late.DensityGain; - f[1] = DelayLineOut(&State->Delay, (offset-State->LateDelayTap[1])*4 + 1) * State->Late.DensityGain; - f[2] = DelayLineOut(&State->Delay, (offset-State->LateDelayTap[2])*4 + 2) * State->Late.DensityGain; - f[3] = DelayLineOut(&State->Delay, (offset-State->LateDelayTap[3])*4 + 3) * State->Late.DensityGain; - - /* Add the decayed results of the cyclical delay lines, then pass - * the results through the low-pass filters. - */ - f[0] += DelayLineOut(&State->Late.Delay[0], offset-State->Late.Offset[0]) * State->Late.Coeff[0]; - f[1] += DelayLineOut(&State->Late.Delay[1], offset-State->Late.Offset[1]) * State->Late.Coeff[1]; - f[2] += DelayLineOut(&State->Late.Delay[2], offset-State->Late.Offset[2]) * State->Late.Coeff[2]; - f[3] += DelayLineOut(&State->Late.Delay[3], offset-State->Late.Offset[3]) * State->Late.Coeff[3]; - - /* This is where the feed-back cycles from line 0 to 3 to 1 to 2 - * and back to 0. - */ - d[0] = LateLowPassInOut(State, 2, f[2]); - d[1] = LateLowPassInOut(State, 3, f[3]); - d[2] = LateLowPassInOut(State, 1, f[1]); - d[3] = LateLowPassInOut(State, 0, f[0]); - - /* To help increase diffusion, run each line through an all-pass - * filter. When there is no diffusion, the shortest all-pass filter - * will feed the shortest delay line. - */ - d[0] = LateAllPassInOut(State, offset, 0, d[0]); - d[1] = LateAllPassInOut(State, offset, 1, d[1]); - d[2] = LateAllPassInOut(State, offset, 2, d[2]); - d[3] = LateAllPassInOut(State, offset, 3, d[3]); - - /* Late reverb is done with a modified feed-back delay network (FDN) - * topology. Four input lines are each fed through their own all-pass - * filter and then into the mixing matrix. The four outputs of the - * mixing matrix are then cycled back to the inputs. Each output feeds - * a different input to form a circlular feed cycle. - * - * The mixing matrix used is a 4D skew-symmetric rotation matrix - * derived using a single unitary rotational parameter: - * - * [ d, a, b, c ] 1 = a^2 + b^2 + c^2 + d^2 - * [ -a, d, c, -b ] - * [ -b, -c, d, a ] - * [ -c, b, -a, d ] - * - * The rotation is constructed from the effect's diffusion parameter, - * yielding: 1 = x^2 + 3 y^2; where a, b, and c are the coefficient y - * with differing signs, and d is the coefficient x. The matrix is - * thus: - * - * [ x, y, -y, y ] n = sqrt(matrix_order - 1) - * [ -y, x, y, y ] t = diffusion_parameter * atan(n) - * [ y, -y, x, y ] x = cos(t) - * [ -y, -y, -y, x ] y = sin(t) / n - * - * To reduce the number of multiplies, the x coefficient is applied - * with the cyclical delay line coefficients. Thus only the y - * coefficient is applied when mixing, and is modified to be: y / x. - */ - f[0] = d[0] + (State->Late.MixCoeff * ( d[1] + -d[2] + d[3])); - f[1] = d[1] + (State->Late.MixCoeff * (-d[0] + d[2] + d[3])); - f[2] = d[2] + (State->Late.MixCoeff * ( d[0] + -d[1] + d[3])); - f[3] = d[3] + (State->Late.MixCoeff * (-d[0] + -d[1] + -d[2] )); - - /* Re-feed the cyclical delay lines. */ - DelayLineIn(&State->Late.Delay[0], offset, f[0]); - DelayLineIn(&State->Late.Delay[1], offset, f[1]); - DelayLineIn(&State->Late.Delay[2], offset, f[2]); - DelayLineIn(&State->Late.Delay[3], offset, f[3]); - offset++; - - /* Output the results of the matrix for all four channels, - * attenuated by the late reverb gain (which is attenuated by the - * 'x' mix coefficient). - */ - tmp[i][0] = State->Late.Gain * f[0]; - tmp[i][1] = State->Late.Gain * f[1]; - tmp[i][2] = State->Late.Gain * f[2]; - tmp[i][3] = State->Late.Gain * f[3]; - } - - /* Deinterlace to output */ - for(i = 0;i < tmp_todo;i++) out[0][base+i] = tmp[i][0]; - for(i = 0;i < tmp_todo;i++) out[1][base+i] = tmp[i][1]; - for(i = 0;i < tmp_todo;i++) out[2][base+i] = tmp[i][2]; - for(i = 0;i < tmp_todo;i++) out[3][base+i] = tmp[i][3]; - - base += tmp_todo; - } + out[0] = xCoeff*in[3] + yCoeff*(in[0] + -in[1] + in[2] ); + out[1] = xCoeff*in[2] + yCoeff*(in[0] + in[1] + -in[3]); + out[2] = xCoeff*in[1] + yCoeff*(in[0] + -in[2] + in[3]); + out[3] = xCoeff*in[0] + yCoeff*( -in[1] + -in[2] + -in[3]); } -// Given an input sample, this function mixes echo into the four-channel late -// reverb. -static ALvoid EAXEcho(ALreverbState *State, ALuint todo, ALfloat (*restrict late)[MAX_UPDATE_SAMPLES]) +/* This applies a Gerzon multiple-in/multiple-out (MIMO) vector all-pass + * filter to the 4-line input. + * + * It works by vectorizing a regular all-pass filter and replacing the delay + * element with a scattering matrix (like the one above) and a diagonal + * matrix of delay elements. + * + * Two static specializations are used for transitional (cross-faded) delay + * line processing and non-transitional processing. + */ +#define DECL_TEMPLATE(T) \ +static void VectorAllpass_##T(ALfloat *restrict out, \ + const ALfloat *restrict in, \ + const ALsizei offset, const ALfloat feedCoeff, \ + const ALfloat xCoeff, const ALfloat yCoeff, \ + const ALfloat mu, VecAllpass *Vap) \ +{ \ + ALfloat f[NUM_LINES], fs[NUM_LINES]; \ + ALfloat input; \ + ALsizei i; \ + \ + (void)mu; /* Ignore for Unfaded. */ \ + \ + for(i = 0;i < NUM_LINES;i++) \ + { \ + input = in[i]; \ + out[i] = T##DelayLineOut(&Vap->Delay, offset-Vap->Offset[i][0], \ + offset-Vap->Offset[i][1], i, mu) - \ + feedCoeff*input; \ + f[i] = input + feedCoeff*out[i]; \ + } \ + VectorPartialScatter(fs, f, xCoeff, yCoeff); \ + \ + DelayLineIn4(&Vap->Delay, offset, fs); \ +} +DECL_TEMPLATE(Unfaded) +DECL_TEMPLATE(Faded) +#undef DECL_TEMPLATE + +/* This generates early reflections. + * + * This is done by obtaining the primary reflections (those arriving from the + * same direction as the source) from the main delay line. These are + * attenuated and all-pass filtered (based on the diffusion parameter). + * + * The early lines are then fed in reverse (according to the approximately + * opposite spatial location of the A-Format lines) to create the secondary + * reflections (those arriving from the opposite direction as the source). + * + * The early response is then completed by combining the primary reflections + * with the delayed and attenuated output from the early lines. + * + * Finally, the early response is reversed, scattered (based on diffusion), + * and fed into the late reverb section of the main delay line. + * + * Two static specializations are used for transitional (cross-faded) delay + * line processing and non-transitional processing. + */ +#define DECL_TEMPLATE(T) \ +static void EarlyReflection_##T(ALreverbState *State, const ALsizei todo, \ + ALfloat fade, \ + ALfloat (*restrict out)[MAX_UPDATE_SAMPLES]) \ +{ \ + ALsizei offset = State->Offset; \ + const ALfloat apFeedCoeff = State->ApFeedCoeff; \ + const ALfloat mixX = State->MixX; \ + const ALfloat mixY = State->MixY; \ + ALfloat f[NUM_LINES], fr[NUM_LINES]; \ + ALsizei i, j; \ + \ + for(i = 0;i < todo;i++) \ + { \ + for(j = 0;j < NUM_LINES;j++) \ + fr[j] = T##DelayLineOut(&State->Delay, \ + offset-State->EarlyDelayTap[j][0], \ + offset-State->EarlyDelayTap[j][1], j, fade \ + ) * State->EarlyDelayCoeff[j]; \ + \ + VectorAllpass_##T(f, fr, offset, apFeedCoeff, mixX, mixY, fade, \ + &State->Early.VecAp); \ + \ + DelayLineIn4Rev(&State->Early.Delay, offset, f); \ + \ + for(j = 0;j < NUM_LINES;j++) \ + f[j] += T##DelayLineOut(&State->Early.Delay, \ + offset-State->Early.Offset[j][0], \ + offset-State->Early.Offset[j][1], j, fade \ + ) * State->Early.Coeff[j]; \ + \ + for(j = 0;j < NUM_LINES;j++) \ + out[j][i] = f[j]; \ + \ + VectorPartialScatterRev(fr, f, mixX, mixY); \ + \ + DelayLineIn4(&State->Delay, offset-State->LateFeedTap, fr); \ + \ + offset++; \ + fade += FadeStep; \ + } \ +} +DECL_TEMPLATE(Unfaded) +DECL_TEMPLATE(Faded) +#undef DECL_TEMPLATE + +/* Applies a first order filter section. */ +static inline ALfloat FirstOrderFilter(const ALfloat in, const ALfloat *restrict coeffs, + ALfloat *restrict state) { - ALfloat feed; - ALuint offset; - ALuint c, i; - - for(c = 0;c < 4;c++) - { - offset = State->Offset; - for(i = 0;i < todo;i++) - { - // Get the latest attenuated echo sample for output. - feed = DelayLineOut(&State->Echo.Delay[c].Feedback, offset-State->Echo.Offset) * - State->Echo.Coeff; - - // Write the output. - late[c][i] += State->Echo.MixCoeff * feed; - - // Mix the energy-attenuated input with the output and pass it through - // the echo low-pass filter. - feed += DelayLineOut(&State->Delay, (offset-State->LateDelayTap[0])*4 + c) * - State->Echo.DensityGain; - feed = lerp(feed, State->Echo.LpSample[c], State->Echo.LpCoeff); - State->Echo.LpSample[c] = feed; - - // Then the echo all-pass filter. - feed = AllpassInOut(&State->Echo.Delay[c].Ap, offset-State->Echo.ApOffset, - offset, feed, State->Echo.ApFeedCoeff, - State->Echo.ApCoeff); - - // Feed the delay with the mixed and filtered sample. - DelayLineIn(&State->Echo.Delay[c].Feedback, offset, feed); - offset++; - } - } + ALfloat out = coeffs[0]*in + *state; + *state = coeffs[1]*in + coeffs[2]*out; + return out; } -// Perform the non-EAX reverb pass on a given input sample, resulting in -// four-channel output. -static ALvoid VerbPass(ALreverbState *State, ALuint todo, ALfloat (*restrict input)[MAX_UPDATE_SAMPLES], ALfloat (*restrict early)[MAX_UPDATE_SAMPLES], ALfloat (*restrict late)[MAX_UPDATE_SAMPLES]) +/* Applies the two T60 damping filter sections. */ +static inline void LateT60Filter(ALfloat *restrict out, const ALfloat *restrict in, + T60Filter *filter) { - ALuint i, c; - - for(c = 0;c < 4;c++) - { - /* Low-pass filter the incoming samples (use the early buffer as temp - * storage). - */ - ALfilterState_process(&State->Filter[c].Lp, &early[0][0], input[c], todo); - for(i = 0;i < todo;i++) - DelayLineIn(&State->Delay, (State->Offset+i)*4 + c, early[0][i]); - } - - // Calculate the early reflection from the first delay tap. - EarlyReflection(State, todo, early); - - // Calculate the late reverb from the decorrelator taps. - LateReverb(State, todo, late); - - // Step all delays forward one sample. - State->Offset += todo; + ALsizei i; + for(i = 0;i < NUM_LINES;i++) + out[i] = FirstOrderFilter( + FirstOrderFilter(in[i], filter[i].HFCoeffs, &filter[i].HFState), + filter[i].LFCoeffs, &filter[i].LFState + ); } -// Perform the EAX reverb pass on a given input sample, resulting in four- -// channel output. -static ALvoid EAXVerbPass(ALreverbState *State, ALuint todo, ALfloat (*restrict input)[MAX_UPDATE_SAMPLES], ALfloat (*restrict early)[MAX_UPDATE_SAMPLES], ALfloat (*restrict late)[MAX_UPDATE_SAMPLES]) -{ - ALuint i, c; - - /* Perform any modulation on the input (use the early and late buffers as - * temp storage). - */ - CalcModulationDelays(State, &late[0][0], todo); - for(c = 0;c < 4;c++) - { - EAXModulation(&State->Mod.Delay[c], State->Offset, &late[0][0], - &early[0][0], input[c], todo); - - /* Band-pass the incoming samples */ - ALfilterState_process(&State->Filter[c].Lp, &early[1][0], &early[0][0], todo); - ALfilterState_process(&State->Filter[c].Hp, &early[2][0], &early[1][0], todo); - - /* Feed the initial delay line. */ - for(i = 0;i < todo;i++) - DelayLineIn(&State->Delay, (State->Offset+i)*4 + c, early[2][i]); - } - - // Calculate the early reflection from the first delay tap. - EarlyReflection(State, todo, early); - - // Calculate the late reverb from the decorrelator taps. - LateReverb(State, todo, late); - - // Calculate and mix in any echo. - EAXEcho(State, todo, late); - - // Step all delays forward. - State->Offset += todo; +/* This generates the reverb tail using a modified feed-back delay network + * (FDN). + * + * Results from the early reflections are attenuated by the density gain and + * mixed with the output from the late delay lines. + * + * The late response is then completed by T60 and all-pass filtering the mix. + * + * Finally, the lines are reversed (so they feed their opposite directions) + * and scattered with the FDN matrix before re-feeding the delay lines. + * + * Two variations are made, one for for transitional (cross-faded) delay line + * processing and one for non-transitional processing. + */ +#define DECL_TEMPLATE(T) \ +static void LateReverb_##T(ALreverbState *State, const ALsizei todo, \ + ALfloat fade, \ + ALfloat (*restrict out)[MAX_UPDATE_SAMPLES]) \ +{ \ + const ALfloat apFeedCoeff = State->ApFeedCoeff; \ + const ALfloat mixX = State->MixX; \ + const ALfloat mixY = State->MixY; \ + ALsizei offset; \ + ALsizei i, j; \ + \ + offset = State->Offset; \ + for(i = 0;i < todo;i++) \ + { \ + ALfloat f[NUM_LINES], fr[NUM_LINES]; \ + \ + for(j = 0;j < NUM_LINES;j++) \ + f[j] = T##DelayLineOut(&State->Delay, \ + offset - State->LateDelayTap[j][0], \ + offset - State->LateDelayTap[j][1], j, fade \ + ) * State->Late.DensityGain; \ + \ + for(j = 0;j < NUM_LINES;j++) \ + f[j] += T##DelayLineOut(&State->Late.Delay, \ + offset - State->Late.Offset[j][0], \ + offset - State->Late.Offset[j][1], j, fade \ + ); \ + \ + LateT60Filter(fr, f, State->Late.T60); \ + VectorAllpass_##T(f, fr, offset, apFeedCoeff, mixX, mixY, fade, \ + &State->Late.VecAp); \ + \ + for(j = 0;j < NUM_LINES;j++) \ + out[j][i] = f[j]; \ + \ + VectorPartialScatterRev(fr, f, mixX, mixY); \ + \ + DelayLineIn4(&State->Late.Delay, offset, fr); \ + \ + offset++; \ + fade += FadeStep; \ + } \ } +DECL_TEMPLATE(Unfaded) +DECL_TEMPLATE(Faded) +#undef DECL_TEMPLATE - -static ALvoid ALreverbState_processStandard(ALreverbState *State, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) +static ALvoid ALreverbState_process(ALreverbState *State, ALsizei SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALsizei NumChannels) { - static const aluMatrixf B2A = {{ - { 0.288675134595f, 0.288675134595f, 0.288675134595f, 0.288675134595f }, - { 0.288675134595f, 0.288675134595f, -0.288675134595f, -0.288675134595f }, - { 0.288675134595f, -0.288675134595f, 0.288675134595f, -0.288675134595f }, - { 0.288675134595f, -0.288675134595f, -0.288675134595f, 0.288675134595f } - }}; ALfloat (*restrict afmt)[MAX_UPDATE_SAMPLES] = State->AFormatSamples; ALfloat (*restrict early)[MAX_UPDATE_SAMPLES] = State->EarlySamples; ALfloat (*restrict late)[MAX_UPDATE_SAMPLES] = State->ReverbSamples; - ALuint base, c; + ALsizei fadeCount = State->FadeCount; + ALfloat fade = (ALfloat)fadeCount / FADE_SAMPLES; + ALsizei base, c; /* Process reverb for these samples. */ for(base = 0;base < SamplesToDo;) { - ALuint todo = minu(SamplesToDo-base, MAX_UPDATE_SAMPLES); + ALsizei todo = mini(SamplesToDo-base, MAX_UPDATE_SAMPLES); + /* If cross-fading, don't do more samples than there are to fade. */ + if(FADE_SAMPLES-fadeCount > 0) + todo = mini(todo, FADE_SAMPLES-fadeCount); - /* Convert B-Foramt to A-Format for processing. */ - memset(afmt, 0, sizeof(*afmt)*4); - for(c = 0;c < 4;c++) + /* Convert B-Format to A-Format for processing. */ + memset(afmt, 0, sizeof(*afmt)*NUM_LINES); + for(c = 0;c < NUM_LINES;c++) MixRowSamples(afmt[c], B2A.m[c], SamplesIn, MAX_EFFECT_CHANNELS, base, todo ); - VerbPass(State, todo, afmt, early, late); + /* Process the samples for reverb. */ + for(c = 0;c < NUM_LINES;c++) + { + /* Band-pass the incoming samples. Use the early output lines for + * temp storage. + */ + BiquadFilter_process(&State->Filter[c].Lp, early[0], afmt[c], todo); + BiquadFilter_process(&State->Filter[c].Hp, early[1], early[0], todo); + + /* Feed the initial delay line. */ + DelayLineIn(&State->Delay, State->Offset, c, early[1], todo); + } + + if(UNLIKELY(fadeCount < FADE_SAMPLES)) + { + /* Generate early reflections. */ + EarlyReflection_Faded(State, todo, fade, early); + + /* Generate late reverb. */ + LateReverb_Faded(State, todo, fade, late); + fade = minf(1.0f, fade + todo*FadeStep); + } + else + { + /* Generate early reflections. */ + EarlyReflection_Unfaded(State, todo, fade, early); + + /* Generate late reverb. */ + LateReverb_Unfaded(State, todo, fade, late); + } + + /* Step all delays forward. */ + State->Offset += todo; + + if(UNLIKELY(fadeCount < FADE_SAMPLES) && (fadeCount += todo) >= FADE_SAMPLES) + { + /* Update the cross-fading delay line taps. */ + fadeCount = FADE_SAMPLES; + fade = 1.0f; + for(c = 0;c < NUM_LINES;c++) + { + State->EarlyDelayTap[c][0] = State->EarlyDelayTap[c][1]; + State->Early.VecAp.Offset[c][0] = State->Early.VecAp.Offset[c][1]; + State->Early.Offset[c][0] = State->Early.Offset[c][1]; + State->LateDelayTap[c][0] = State->LateDelayTap[c][1]; + State->Late.VecAp.Offset[c][0] = State->Late.VecAp.Offset[c][1]; + State->Late.Offset[c][0] = State->Late.Offset[c][1]; + } + } /* Mix the A-Format results to output, implicitly converting back to * B-Format. */ - for(c = 0;c < 4;c++) + for(c = 0;c < NUM_LINES;c++) MixSamples(early[c], NumChannels, SamplesOut, State->Early.CurrentGain[c], State->Early.PanGain[c], SamplesToDo-base, base, todo ); - for(c = 0;c < 4;c++) + for(c = 0;c < NUM_LINES;c++) MixSamples(late[c], NumChannels, SamplesOut, State->Late.CurrentGain[c], State->Late.PanGain[c], SamplesToDo-base, base, todo @@ -1425,81 +1607,31 @@ static ALvoid ALreverbState_processStandard(ALreverbState *State, ALuint Samples base += todo; } -} - -static ALvoid ALreverbState_processEax(ALreverbState *State, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) -{ - static const aluMatrixf B2A = {{ - { 0.288675134595f, 0.288675134595f, 0.288675134595f, 0.288675134595f }, - { 0.288675134595f, 0.288675134595f, -0.288675134595f, -0.288675134595f }, - { 0.288675134595f, -0.288675134595f, 0.288675134595f, -0.288675134595f }, - { 0.288675134595f, -0.288675134595f, -0.288675134595f, 0.288675134595f } - }}; - ALfloat (*restrict afmt)[MAX_UPDATE_SAMPLES] = State->AFormatSamples; - ALfloat (*restrict early)[MAX_UPDATE_SAMPLES] = State->EarlySamples; - ALfloat (*restrict late)[MAX_UPDATE_SAMPLES] = State->ReverbSamples; - ALuint base, c; - - /* Process reverb for these samples. */ - for(base = 0;base < SamplesToDo;) - { - ALuint todo = minu(SamplesToDo-base, MAX_UPDATE_SAMPLES); - - memset(afmt, 0, 4*MAX_UPDATE_SAMPLES*sizeof(float)); - for(c = 0;c < 4;c++) - MixRowSamples(afmt[c], B2A.m[c], - SamplesIn, MAX_EFFECT_CHANNELS, base, todo - ); - - EAXVerbPass(State, todo, afmt, early, late); - - for(c = 0;c < 4;c++) - MixSamples(early[c], NumChannels, SamplesOut, - State->Early.CurrentGain[c], State->Early.PanGain[c], - SamplesToDo-base, base, todo - ); - for(c = 0;c < 4;c++) - MixSamples(late[c], NumChannels, SamplesOut, - State->Late.CurrentGain[c], State->Late.PanGain[c], - SamplesToDo-base, base, todo - ); - - base += todo; - } -} - -static ALvoid ALreverbState_process(ALreverbState *State, ALuint SamplesToDo, const ALfloat (*restrict SamplesIn)[BUFFERSIZE], ALfloat (*restrict SamplesOut)[BUFFERSIZE], ALuint NumChannels) -{ - if(State->IsEax) - ALreverbState_processEax(State, SamplesToDo, SamplesIn, SamplesOut, NumChannels); - else - ALreverbState_processStandard(State, SamplesToDo, SamplesIn, SamplesOut, NumChannels); + State->FadeCount = fadeCount; } -typedef struct ALreverbStateFactory { - DERIVE_FROM_TYPE(ALeffectStateFactory); -} ALreverbStateFactory; +typedef struct ReverbStateFactory { + DERIVE_FROM_TYPE(EffectStateFactory); +} ReverbStateFactory; -static ALeffectState *ALreverbStateFactory_create(ALreverbStateFactory* UNUSED(factory)) +static ALeffectState *ReverbStateFactory_create(ReverbStateFactory* UNUSED(factory)) { ALreverbState *state; - alcall_once(&mixfunc_inited, init_mixfunc); - NEW_OBJ0(state, ALreverbState)(); if(!state) return NULL; return STATIC_CAST(ALeffectState, state); } -DEFINE_ALEFFECTSTATEFACTORY_VTABLE(ALreverbStateFactory); +DEFINE_EFFECTSTATEFACTORY_VTABLE(ReverbStateFactory); -ALeffectStateFactory *ALreverbStateFactory_getFactory(void) +EffectStateFactory *ReverbStateFactory_getFactory(void) { - static ALreverbStateFactory ReverbFactory = { { GET_VTABLE2(ALreverbStateFactory, ALeffectStateFactory) } }; + static ReverbStateFactory ReverbFactory = { { GET_VTABLE2(ReverbStateFactory, EffectStateFactory) } }; - return STATIC_CAST(ALeffectStateFactory, &ReverbFactory); + return STATIC_CAST(EffectStateFactory, &ReverbFactory); } @@ -1510,18 +1642,17 @@ void ALeaxreverb_setParami(ALeffect *effect, ALCcontext *context, ALenum param, { case AL_EAXREVERB_DECAY_HFLIMIT: if(!(val >= AL_EAXREVERB_MIN_DECAY_HFLIMIT && val <= AL_EAXREVERB_MAX_DECAY_HFLIMIT)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb decay hflimit out of range"); props->Reverb.DecayHFLimit = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid EAX reverb integer property 0x%04x", + param); } } void ALeaxreverb_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALeaxreverb_setParami(effect, context, param, vals[0]); -} +{ ALeaxreverb_setParami(effect, context, param, vals[0]); } void ALeaxreverb_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { ALeffectProps *props = &effect->Props; @@ -1529,126 +1660,127 @@ void ALeaxreverb_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, { case AL_EAXREVERB_DENSITY: if(!(val >= AL_EAXREVERB_MIN_DENSITY && val <= AL_EAXREVERB_MAX_DENSITY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb density out of range"); props->Reverb.Density = val; break; case AL_EAXREVERB_DIFFUSION: if(!(val >= AL_EAXREVERB_MIN_DIFFUSION && val <= AL_EAXREVERB_MAX_DIFFUSION)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb diffusion out of range"); props->Reverb.Diffusion = val; break; case AL_EAXREVERB_GAIN: if(!(val >= AL_EAXREVERB_MIN_GAIN && val <= AL_EAXREVERB_MAX_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb gain out of range"); props->Reverb.Gain = val; break; case AL_EAXREVERB_GAINHF: if(!(val >= AL_EAXREVERB_MIN_GAINHF && val <= AL_EAXREVERB_MAX_GAINHF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb gainhf out of range"); props->Reverb.GainHF = val; break; case AL_EAXREVERB_GAINLF: if(!(val >= AL_EAXREVERB_MIN_GAINLF && val <= AL_EAXREVERB_MAX_GAINLF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb gainlf out of range"); props->Reverb.GainLF = val; break; case AL_EAXREVERB_DECAY_TIME: if(!(val >= AL_EAXREVERB_MIN_DECAY_TIME && val <= AL_EAXREVERB_MAX_DECAY_TIME)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb decay time out of range"); props->Reverb.DecayTime = val; break; case AL_EAXREVERB_DECAY_HFRATIO: if(!(val >= AL_EAXREVERB_MIN_DECAY_HFRATIO && val <= AL_EAXREVERB_MAX_DECAY_HFRATIO)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb decay hfratio out of range"); props->Reverb.DecayHFRatio = val; break; case AL_EAXREVERB_DECAY_LFRATIO: if(!(val >= AL_EAXREVERB_MIN_DECAY_LFRATIO && val <= AL_EAXREVERB_MAX_DECAY_LFRATIO)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb decay lfratio out of range"); props->Reverb.DecayLFRatio = val; break; case AL_EAXREVERB_REFLECTIONS_GAIN: if(!(val >= AL_EAXREVERB_MIN_REFLECTIONS_GAIN && val <= AL_EAXREVERB_MAX_REFLECTIONS_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb reflections gain out of range"); props->Reverb.ReflectionsGain = val; break; case AL_EAXREVERB_REFLECTIONS_DELAY: if(!(val >= AL_EAXREVERB_MIN_REFLECTIONS_DELAY && val <= AL_EAXREVERB_MAX_REFLECTIONS_DELAY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb reflections delay out of range"); props->Reverb.ReflectionsDelay = val; break; case AL_EAXREVERB_LATE_REVERB_GAIN: if(!(val >= AL_EAXREVERB_MIN_LATE_REVERB_GAIN && val <= AL_EAXREVERB_MAX_LATE_REVERB_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb late reverb gain out of range"); props->Reverb.LateReverbGain = val; break; case AL_EAXREVERB_LATE_REVERB_DELAY: if(!(val >= AL_EAXREVERB_MIN_LATE_REVERB_DELAY && val <= AL_EAXREVERB_MAX_LATE_REVERB_DELAY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb late reverb delay out of range"); props->Reverb.LateReverbDelay = val; break; case AL_EAXREVERB_AIR_ABSORPTION_GAINHF: if(!(val >= AL_EAXREVERB_MIN_AIR_ABSORPTION_GAINHF && val <= AL_EAXREVERB_MAX_AIR_ABSORPTION_GAINHF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb air absorption gainhf out of range"); props->Reverb.AirAbsorptionGainHF = val; break; case AL_EAXREVERB_ECHO_TIME: if(!(val >= AL_EAXREVERB_MIN_ECHO_TIME && val <= AL_EAXREVERB_MAX_ECHO_TIME)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb echo time out of range"); props->Reverb.EchoTime = val; break; case AL_EAXREVERB_ECHO_DEPTH: if(!(val >= AL_EAXREVERB_MIN_ECHO_DEPTH && val <= AL_EAXREVERB_MAX_ECHO_DEPTH)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb echo depth out of range"); props->Reverb.EchoDepth = val; break; case AL_EAXREVERB_MODULATION_TIME: if(!(val >= AL_EAXREVERB_MIN_MODULATION_TIME && val <= AL_EAXREVERB_MAX_MODULATION_TIME)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb modulation time out of range"); props->Reverb.ModulationTime = val; break; case AL_EAXREVERB_MODULATION_DEPTH: if(!(val >= AL_EAXREVERB_MIN_MODULATION_DEPTH && val <= AL_EAXREVERB_MAX_MODULATION_DEPTH)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb modulation depth out of range"); props->Reverb.ModulationDepth = val; break; case AL_EAXREVERB_HFREFERENCE: if(!(val >= AL_EAXREVERB_MIN_HFREFERENCE && val <= AL_EAXREVERB_MAX_HFREFERENCE)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb hfreference out of range"); props->Reverb.HFReference = val; break; case AL_EAXREVERB_LFREFERENCE: if(!(val >= AL_EAXREVERB_MIN_LFREFERENCE && val <= AL_EAXREVERB_MAX_LFREFERENCE)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb lfreference out of range"); props->Reverb.LFReference = val; break; case AL_EAXREVERB_ROOM_ROLLOFF_FACTOR: if(!(val >= AL_EAXREVERB_MIN_ROOM_ROLLOFF_FACTOR && val <= AL_EAXREVERB_MAX_ROOM_ROLLOFF_FACTOR)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb room rolloff factor out of range"); props->Reverb.RoomRolloffFactor = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid EAX reverb float property 0x%04x", + param); } } void ALeaxreverb_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) @@ -1658,14 +1790,14 @@ void ALeaxreverb_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, { case AL_EAXREVERB_REFLECTIONS_PAN: if(!(isfinite(vals[0]) && isfinite(vals[1]) && isfinite(vals[2]))) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb reflections pan out of range"); props->Reverb.ReflectionsPan[0] = vals[0]; props->Reverb.ReflectionsPan[1] = vals[1]; props->Reverb.ReflectionsPan[2] = vals[2]; break; case AL_EAXREVERB_LATE_REVERB_PAN: if(!(isfinite(vals[0]) && isfinite(vals[1]) && isfinite(vals[2]))) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "EAX Reverb late reverb pan out of range"); props->Reverb.LateReverbPan[0] = vals[0]; props->Reverb.LateReverbPan[1] = vals[1]; props->Reverb.LateReverbPan[2] = vals[2]; @@ -1687,13 +1819,12 @@ void ALeaxreverb_getParami(const ALeffect *effect, ALCcontext *context, ALenum p break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid EAX reverb integer property 0x%04x", + param); } } void ALeaxreverb_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALeaxreverb_getParami(effect, context, param, vals); -} +{ ALeaxreverb_getParami(effect, context, param, vals); } void ALeaxreverb_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { const ALeffectProps *props = &effect->Props; @@ -1780,7 +1911,8 @@ void ALeaxreverb_getParamf(const ALeffect *effect, ALCcontext *context, ALenum p break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid EAX reverb float property 0x%04x", + param); } } void ALeaxreverb_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) @@ -1814,18 +1946,16 @@ void ALreverb_setParami(ALeffect *effect, ALCcontext *context, ALenum param, ALi { case AL_REVERB_DECAY_HFLIMIT: if(!(val >= AL_REVERB_MIN_DECAY_HFLIMIT && val <= AL_REVERB_MAX_DECAY_HFLIMIT)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb decay hflimit out of range"); props->Reverb.DecayHFLimit = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid reverb integer property 0x%04x", param); } } void ALreverb_setParamiv(ALeffect *effect, ALCcontext *context, ALenum param, const ALint *vals) -{ - ALreverb_setParami(effect, context, param, vals[0]); -} +{ ALreverb_setParami(effect, context, param, vals[0]); } void ALreverb_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALfloat val) { ALeffectProps *props = &effect->Props; @@ -1833,84 +1963,82 @@ void ALreverb_setParamf(ALeffect *effect, ALCcontext *context, ALenum param, ALf { case AL_REVERB_DENSITY: if(!(val >= AL_REVERB_MIN_DENSITY && val <= AL_REVERB_MAX_DENSITY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb density out of range"); props->Reverb.Density = val; break; case AL_REVERB_DIFFUSION: if(!(val >= AL_REVERB_MIN_DIFFUSION && val <= AL_REVERB_MAX_DIFFUSION)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb diffusion out of range"); props->Reverb.Diffusion = val; break; case AL_REVERB_GAIN: if(!(val >= AL_REVERB_MIN_GAIN && val <= AL_REVERB_MAX_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb gain out of range"); props->Reverb.Gain = val; break; case AL_REVERB_GAINHF: if(!(val >= AL_REVERB_MIN_GAINHF && val <= AL_REVERB_MAX_GAINHF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb gainhf out of range"); props->Reverb.GainHF = val; break; case AL_REVERB_DECAY_TIME: if(!(val >= AL_REVERB_MIN_DECAY_TIME && val <= AL_REVERB_MAX_DECAY_TIME)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb decay time out of range"); props->Reverb.DecayTime = val; break; case AL_REVERB_DECAY_HFRATIO: if(!(val >= AL_REVERB_MIN_DECAY_HFRATIO && val <= AL_REVERB_MAX_DECAY_HFRATIO)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb decay hfratio out of range"); props->Reverb.DecayHFRatio = val; break; case AL_REVERB_REFLECTIONS_GAIN: if(!(val >= AL_REVERB_MIN_REFLECTIONS_GAIN && val <= AL_REVERB_MAX_REFLECTIONS_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb reflections gain out of range"); props->Reverb.ReflectionsGain = val; break; case AL_REVERB_REFLECTIONS_DELAY: if(!(val >= AL_REVERB_MIN_REFLECTIONS_DELAY && val <= AL_REVERB_MAX_REFLECTIONS_DELAY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb reflections delay out of range"); props->Reverb.ReflectionsDelay = val; break; case AL_REVERB_LATE_REVERB_GAIN: if(!(val >= AL_REVERB_MIN_LATE_REVERB_GAIN && val <= AL_REVERB_MAX_LATE_REVERB_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb late reverb gain out of range"); props->Reverb.LateReverbGain = val; break; case AL_REVERB_LATE_REVERB_DELAY: if(!(val >= AL_REVERB_MIN_LATE_REVERB_DELAY && val <= AL_REVERB_MAX_LATE_REVERB_DELAY)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb late reverb delay out of range"); props->Reverb.LateReverbDelay = val; break; case AL_REVERB_AIR_ABSORPTION_GAINHF: if(!(val >= AL_REVERB_MIN_AIR_ABSORPTION_GAINHF && val <= AL_REVERB_MAX_AIR_ABSORPTION_GAINHF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb air absorption gainhf out of range"); props->Reverb.AirAbsorptionGainHF = val; break; case AL_REVERB_ROOM_ROLLOFF_FACTOR: if(!(val >= AL_REVERB_MIN_ROOM_ROLLOFF_FACTOR && val <= AL_REVERB_MAX_ROOM_ROLLOFF_FACTOR)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Reverb room rolloff factor out of range"); props->Reverb.RoomRolloffFactor = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid reverb float property 0x%04x", param); } } void ALreverb_setParamfv(ALeffect *effect, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - ALreverb_setParamf(effect, context, param, vals[0]); -} +{ ALreverb_setParamf(effect, context, param, vals[0]); } void ALreverb_getParami(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *val) { @@ -1922,13 +2050,11 @@ void ALreverb_getParami(const ALeffect *effect, ALCcontext *context, ALenum para break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid reverb integer property 0x%04x", param); } } void ALreverb_getParamiv(const ALeffect *effect, ALCcontext *context, ALenum param, ALint *vals) -{ - ALreverb_getParami(effect, context, param, vals); -} +{ ALreverb_getParami(effect, context, param, vals); } void ALreverb_getParamf(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *val) { const ALeffectProps *props = &effect->Props; @@ -1983,12 +2109,10 @@ void ALreverb_getParamf(const ALeffect *effect, ALCcontext *context, ALenum para break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid reverb float property 0x%04x", param); } } void ALreverb_getParamfv(const ALeffect *effect, ALCcontext *context, ALenum param, ALfloat *vals) -{ - ALreverb_getParamf(effect, context, param, vals); -} +{ ALreverb_getParamf(effect, context, param, vals); } DEFINE_ALEFFECT_VTABLE(ALreverb); diff --git a/Engine/lib/openal-soft/Alc/filters/defs.h b/Engine/lib/openal-soft/Alc/filters/defs.h new file mode 100644 index 000000000..133a85ebd --- /dev/null +++ b/Engine/lib/openal-soft/Alc/filters/defs.h @@ -0,0 +1,112 @@ +#ifndef ALC_FILTER_H +#define ALC_FILTER_H + +#include "AL/al.h" +#include "math_defs.h" + +/* Filters implementation is based on the "Cookbook formulae for audio + * EQ biquad filter coefficients" by Robert Bristow-Johnson + * http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt + */ +/* Implementation note: For the shelf filters, the specified gain is for the + * reference frequency, which is the centerpoint of the transition band. This + * better matches EFX filter design. To set the gain for the shelf itself, use + * the square root of the desired linear gain (or halve the dB gain). + */ + +typedef enum BiquadType { + /** EFX-style low-pass filter, specifying a gain and reference frequency. */ + BiquadType_HighShelf, + /** EFX-style high-pass filter, specifying a gain and reference frequency. */ + BiquadType_LowShelf, + /** Peaking filter, specifying a gain and reference frequency. */ + BiquadType_Peaking, + + /** Low-pass cut-off filter, specifying a cut-off frequency. */ + BiquadType_LowPass, + /** High-pass cut-off filter, specifying a cut-off frequency. */ + BiquadType_HighPass, + /** Band-pass filter, specifying a center frequency. */ + BiquadType_BandPass, +} BiquadType; + +typedef struct BiquadFilter { + ALfloat z1, z2; /* Last two delayed components for direct form II. */ + ALfloat b0, b1, b2; /* Transfer function coefficients "b" (numerator) */ + ALfloat a1, a2; /* Transfer function coefficients "a" (denominator; a0 is + * pre-applied). */ +} BiquadFilter; +/* Currently only a C-based filter process method is implemented. */ +#define BiquadFilter_process BiquadFilter_processC + +/** + * Calculates the rcpQ (i.e. 1/Q) coefficient for shelving filters, using the + * reference gain and shelf slope parameter. + * \param gain 0 < gain + * \param slope 0 < slope <= 1 + */ +inline ALfloat calc_rcpQ_from_slope(ALfloat gain, ALfloat slope) +{ + return sqrtf((gain + 1.0f/gain)*(1.0f/slope - 1.0f) + 2.0f); +} +/** + * Calculates the rcpQ (i.e. 1/Q) coefficient for filters, using the normalized + * reference frequency and bandwidth. + * \param f0norm 0 < f0norm < 0.5. + * \param bandwidth 0 < bandwidth + */ +inline ALfloat calc_rcpQ_from_bandwidth(ALfloat f0norm, ALfloat bandwidth) +{ + ALfloat w0 = F_TAU * f0norm; + return 2.0f*sinhf(logf(2.0f)/2.0f*bandwidth*w0/sinf(w0)); +} + +inline void BiquadFilter_clear(BiquadFilter *filter) +{ + filter->z1 = 0.0f; + filter->z2 = 0.0f; +} + +/** + * Sets up the filter state for the specified filter type and its parameters. + * + * \param filter The filter object to prepare. + * \param type The type of filter for the object to apply. + * \param gain The gain for the reference frequency response. Only used by the + * Shelf and Peaking filter types. + * \param f0norm The normalized reference frequency (ref_freq / sample_rate). + * This is the center point for the Shelf, Peaking, and BandPass + * filter types, or the cutoff frequency for the LowPass and + * HighPass filter types. + * \param rcpQ The reciprocal of the Q coefficient for the filter's transition + * band. Can be generated from calc_rcpQ_from_slope or + * calc_rcpQ_from_bandwidth depending on the available data. + */ +void BiquadFilter_setParams(BiquadFilter *filter, BiquadType type, ALfloat gain, ALfloat f0norm, ALfloat rcpQ); + +inline void BiquadFilter_copyParams(BiquadFilter *restrict dst, const BiquadFilter *restrict src) +{ + dst->b0 = src->b0; + dst->b1 = src->b1; + dst->b2 = src->b2; + dst->a1 = src->a1; + dst->a2 = src->a2; +} + +void BiquadFilter_processC(BiquadFilter *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALsizei numsamples); + +inline void BiquadFilter_passthru(BiquadFilter *filter, ALsizei numsamples) +{ + if(LIKELY(numsamples >= 2)) + { + filter->z1 = 0.0f; + filter->z2 = 0.0f; + } + else if(numsamples == 1) + { + filter->z1 = filter->z2; + filter->z2 = 0.0f; + } +} + +#endif /* ALC_FILTER_H */ diff --git a/Engine/lib/openal-soft/Alc/filters/filter.c b/Engine/lib/openal-soft/Alc/filters/filter.c new file mode 100644 index 000000000..2b370f89d --- /dev/null +++ b/Engine/lib/openal-soft/Alc/filters/filter.c @@ -0,0 +1,129 @@ + +#include "config.h" + +#include "AL/alc.h" +#include "AL/al.h" + +#include "alMain.h" +#include "defs.h" + +extern inline void BiquadFilter_clear(BiquadFilter *filter); +extern inline void BiquadFilter_copyParams(BiquadFilter *restrict dst, const BiquadFilter *restrict src); +extern inline void BiquadFilter_passthru(BiquadFilter *filter, ALsizei numsamples); +extern inline ALfloat calc_rcpQ_from_slope(ALfloat gain, ALfloat slope); +extern inline ALfloat calc_rcpQ_from_bandwidth(ALfloat f0norm, ALfloat bandwidth); + + +void BiquadFilter_setParams(BiquadFilter *filter, BiquadType type, ALfloat gain, ALfloat f0norm, ALfloat rcpQ) +{ + ALfloat alpha, sqrtgain_alpha_2; + ALfloat w0, sin_w0, cos_w0; + ALfloat a[3] = { 1.0f, 0.0f, 0.0f }; + ALfloat b[3] = { 1.0f, 0.0f, 0.0f }; + + // Limit gain to -100dB + assert(gain > 0.00001f); + + w0 = F_TAU * f0norm; + sin_w0 = sinf(w0); + cos_w0 = cosf(w0); + alpha = sin_w0/2.0f * rcpQ; + + /* Calculate filter coefficients depending on filter type */ + switch(type) + { + case BiquadType_HighShelf: + sqrtgain_alpha_2 = 2.0f * sqrtf(gain) * alpha; + b[0] = gain*((gain+1.0f) + (gain-1.0f)*cos_w0 + sqrtgain_alpha_2); + b[1] = -2.0f*gain*((gain-1.0f) + (gain+1.0f)*cos_w0 ); + b[2] = gain*((gain+1.0f) + (gain-1.0f)*cos_w0 - sqrtgain_alpha_2); + a[0] = (gain+1.0f) - (gain-1.0f)*cos_w0 + sqrtgain_alpha_2; + a[1] = 2.0f* ((gain-1.0f) - (gain+1.0f)*cos_w0 ); + a[2] = (gain+1.0f) - (gain-1.0f)*cos_w0 - sqrtgain_alpha_2; + break; + case BiquadType_LowShelf: + sqrtgain_alpha_2 = 2.0f * sqrtf(gain) * alpha; + b[0] = gain*((gain+1.0f) - (gain-1.0f)*cos_w0 + sqrtgain_alpha_2); + b[1] = 2.0f*gain*((gain-1.0f) - (gain+1.0f)*cos_w0 ); + b[2] = gain*((gain+1.0f) - (gain-1.0f)*cos_w0 - sqrtgain_alpha_2); + a[0] = (gain+1.0f) + (gain-1.0f)*cos_w0 + sqrtgain_alpha_2; + a[1] = -2.0f* ((gain-1.0f) + (gain+1.0f)*cos_w0 ); + a[2] = (gain+1.0f) + (gain-1.0f)*cos_w0 - sqrtgain_alpha_2; + break; + case BiquadType_Peaking: + gain = sqrtf(gain); + b[0] = 1.0f + alpha * gain; + b[1] = -2.0f * cos_w0; + b[2] = 1.0f - alpha * gain; + a[0] = 1.0f + alpha / gain; + a[1] = -2.0f * cos_w0; + a[2] = 1.0f - alpha / gain; + break; + + case BiquadType_LowPass: + b[0] = (1.0f - cos_w0) / 2.0f; + b[1] = 1.0f - cos_w0; + b[2] = (1.0f - cos_w0) / 2.0f; + a[0] = 1.0f + alpha; + a[1] = -2.0f * cos_w0; + a[2] = 1.0f - alpha; + break; + case BiquadType_HighPass: + b[0] = (1.0f + cos_w0) / 2.0f; + b[1] = -(1.0f + cos_w0); + b[2] = (1.0f + cos_w0) / 2.0f; + a[0] = 1.0f + alpha; + a[1] = -2.0f * cos_w0; + a[2] = 1.0f - alpha; + break; + case BiquadType_BandPass: + b[0] = alpha; + b[1] = 0; + b[2] = -alpha; + a[0] = 1.0f + alpha; + a[1] = -2.0f * cos_w0; + a[2] = 1.0f - alpha; + break; + } + + filter->a1 = a[1] / a[0]; + filter->a2 = a[2] / a[0]; + filter->b0 = b[0] / a[0]; + filter->b1 = b[1] / a[0]; + filter->b2 = b[2] / a[0]; +} + + +void BiquadFilter_processC(BiquadFilter *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALsizei numsamples) +{ + const ALfloat a1 = filter->a1; + const ALfloat a2 = filter->a2; + const ALfloat b0 = filter->b0; + const ALfloat b1 = filter->b1; + const ALfloat b2 = filter->b2; + ALfloat z1 = filter->z1; + ALfloat z2 = filter->z2; + ALsizei i; + + ASSUME(numsamples > 0); + + /* Processing loop is Transposed Direct Form II. This requires less storage + * compared to Direct Form I (only two delay components, instead of a four- + * sample history; the last two inputs and outputs), and works better for + * floating-point which favors summing similarly-sized values while being + * less bothered by overflow. + * + * See: http://www.earlevel.com/main/2003/02/28/biquads/ + */ + for(i = 0;i < numsamples;i++) + { + ALfloat input = src[i]; + ALfloat output = input*b0 + z1; + z1 = input*b1 - output*a1 + z2; + z2 = input*b2 - output*a2; + dst[i] = output; + } + + filter->z1 = z1; + filter->z2 = z2; +} diff --git a/Engine/lib/openal-soft/Alc/filters/nfc.c b/Engine/lib/openal-soft/Alc/filters/nfc.c new file mode 100644 index 000000000..8869d1d00 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/filters/nfc.c @@ -0,0 +1,426 @@ + +#include "config.h" + +#include "nfc.h" +#include "alMain.h" + +#include + + +/* Near-field control filters are the basis for handling the near-field effect. + * The near-field effect is a bass-boost present in the directional components + * of a recorded signal, created as a result of the wavefront curvature (itself + * a function of sound distance). Proper reproduction dictates this be + * compensated for using a bass-cut given the playback speaker distance, to + * avoid excessive bass in the playback. + * + * For real-time rendered audio, emulating the near-field effect based on the + * sound source's distance, and subsequently compensating for it at output + * based on the speaker distances, can create a more realistic perception of + * sound distance beyond a simple 1/r attenuation. + * + * These filters do just that. Each one applies a low-shelf filter, created as + * the combination of a bass-boost for a given sound source distance (near- + * field emulation) along with a bass-cut for a given control/speaker distance + * (near-field compensation). + * + * Note that it is necessary to apply a cut along with the boost, since the + * boost alone is unstable in higher-order ambisonics as it causes an infinite + * DC gain (even first-order ambisonics requires there to be no DC offset for + * the boost to work). Consequently, ambisonics requires a control parameter to + * be used to avoid an unstable boost-only filter. NFC-HOA defines this control + * as a reference delay, calculated with: + * + * reference_delay = control_distance / speed_of_sound + * + * This means w0 (for input) or w1 (for output) should be set to: + * + * wN = 1 / (reference_delay * sample_rate) + * + * when dealing with NFC-HOA content. For FOA input content, which does not + * specify a reference_delay variable, w0 should be set to 0 to apply only + * near-field compensation for output. It's important that w1 be a finite, + * positive, non-0 value or else the bass-boost will become unstable again. + * Also, w0 should not be too large compared to w1, to avoid excessively loud + * low frequencies. + */ + +static const float B[4][3] = { + { 0.0f }, + { 1.0f }, + { 3.0f, 3.0f }, + { 3.6778f, 6.4595f, 2.3222f }, + /*{ 4.2076f, 11.4877f, 5.7924f, 9.1401f }*/ +}; + +static void NfcFilterCreate1(struct NfcFilter1 *nfc, const float w0, const float w1) +{ + float b_00, g_0; + float r; + + nfc->base_gain = 1.0f; + nfc->gain = 1.0f; + + /* Calculate bass-boost coefficients. */ + r = 0.5f * w0; + b_00 = B[1][0] * r; + g_0 = 1.0f + b_00; + + nfc->gain *= g_0; + nfc->b1 = 2.0f * b_00 / g_0; + + /* Calculate bass-cut coefficients. */ + r = 0.5f * w1; + b_00 = B[1][0] * r; + g_0 = 1.0f + b_00; + + nfc->base_gain /= g_0; + nfc->gain /= g_0; + nfc->a1 = 2.0f * b_00 / g_0; +} + +static void NfcFilterAdjust1(struct NfcFilter1 *nfc, const float w0) +{ + float b_00, g_0; + float r; + + r = 0.5f * w0; + b_00 = B[1][0] * r; + g_0 = 1.0f + b_00; + + nfc->gain = nfc->base_gain * g_0; + nfc->b1 = 2.0f * b_00 / g_0; +} + + +static void NfcFilterCreate2(struct NfcFilter2 *nfc, const float w0, const float w1) +{ + float b_10, b_11, g_1; + float r; + + nfc->base_gain = 1.0f; + nfc->gain = 1.0f; + + /* Calculate bass-boost coefficients. */ + r = 0.5f * w0; + b_10 = B[2][0] * r; + b_11 = B[2][1] * r * r; + g_1 = 1.0f + b_10 + b_11; + + nfc->gain *= g_1; + nfc->b1 = (2.0f*b_10 + 4.0f*b_11) / g_1; + nfc->b2 = 4.0f * b_11 / g_1; + + /* Calculate bass-cut coefficients. */ + r = 0.5f * w1; + b_10 = B[2][0] * r; + b_11 = B[2][1] * r * r; + g_1 = 1.0f + b_10 + b_11; + + nfc->base_gain /= g_1; + nfc->gain /= g_1; + nfc->a1 = (2.0f*b_10 + 4.0f*b_11) / g_1; + nfc->a2 = 4.0f * b_11 / g_1; +} + +static void NfcFilterAdjust2(struct NfcFilter2 *nfc, const float w0) +{ + float b_10, b_11, g_1; + float r; + + r = 0.5f * w0; + b_10 = B[2][0] * r; + b_11 = B[2][1] * r * r; + g_1 = 1.0f + b_10 + b_11; + + nfc->gain = nfc->base_gain * g_1; + nfc->b1 = (2.0f*b_10 + 4.0f*b_11) / g_1; + nfc->b2 = 4.0f * b_11 / g_1; +} + + +static void NfcFilterCreate3(struct NfcFilter3 *nfc, const float w0, const float w1) +{ + float b_10, b_11, g_1; + float b_00, g_0; + float r; + + nfc->base_gain = 1.0f; + nfc->gain = 1.0f; + + /* Calculate bass-boost coefficients. */ + r = 0.5f * w0; + b_10 = B[3][0] * r; + b_11 = B[3][1] * r * r; + g_1 = 1.0f + b_10 + b_11; + + nfc->gain *= g_1; + nfc->b1 = (2.0f*b_10 + 4.0f*b_11) / g_1; + nfc->b2 = 4.0f * b_11 / g_1; + + b_00 = B[3][2] * r; + g_0 = 1.0f + b_00; + + nfc->gain *= g_0; + nfc->b3 = 2.0f * b_00 / g_0; + + /* Calculate bass-cut coefficients. */ + r = 0.5f * w1; + b_10 = B[3][0] * r; + b_11 = B[3][1] * r * r; + g_1 = 1.0f + b_10 + b_11; + + nfc->base_gain /= g_1; + nfc->gain /= g_1; + nfc->a1 = (2.0f*b_10 + 4.0f*b_11) / g_1; + nfc->a2 = 4.0f * b_11 / g_1; + + b_00 = B[3][2] * r; + g_0 = 1.0f + b_00; + + nfc->base_gain /= g_0; + nfc->gain /= g_0; + nfc->a3 = 2.0f * b_00 / g_0; +} + +static void NfcFilterAdjust3(struct NfcFilter3 *nfc, const float w0) +{ + float b_10, b_11, g_1; + float b_00, g_0; + float r; + + r = 0.5f * w0; + b_10 = B[3][0] * r; + b_11 = B[3][1] * r * r; + g_1 = 1.0f + b_10 + b_11; + + nfc->gain = nfc->base_gain * g_1; + nfc->b1 = (2.0f*b_10 + 4.0f*b_11) / g_1; + nfc->b2 = 4.0f * b_11 / g_1; + + b_00 = B[3][2] * r; + g_0 = 1.0f + b_00; + + nfc->gain *= g_0; + nfc->b3 = 2.0f * b_00 / g_0; +} + + +void NfcFilterCreate(NfcFilter *nfc, const float w0, const float w1) +{ + memset(nfc, 0, sizeof(*nfc)); + NfcFilterCreate1(&nfc->first, w0, w1); + NfcFilterCreate2(&nfc->second, w0, w1); + NfcFilterCreate3(&nfc->third, w0, w1); +} + +void NfcFilterAdjust(NfcFilter *nfc, const float w0) +{ + NfcFilterAdjust1(&nfc->first, w0); + NfcFilterAdjust2(&nfc->second, w0); + NfcFilterAdjust3(&nfc->third, w0); +} + + +void NfcFilterProcess1(NfcFilter *nfc, float *restrict dst, const float *restrict src, const int count) +{ + const float gain = nfc->first.gain; + const float b1 = nfc->first.b1; + const float a1 = nfc->first.a1; + float z1 = nfc->first.z[0]; + int i; + + ASSUME(count > 0); + + for(i = 0;i < count;i++) + { + float y = src[i]*gain - a1*z1; + float out = y + b1*z1; + z1 += y; + + dst[i] = out; + } + nfc->first.z[0] = z1; +} + +void NfcFilterProcess2(NfcFilter *nfc, float *restrict dst, const float *restrict src, const int count) +{ + const float gain = nfc->second.gain; + const float b1 = nfc->second.b1; + const float b2 = nfc->second.b2; + const float a1 = nfc->second.a1; + const float a2 = nfc->second.a2; + float z1 = nfc->second.z[0]; + float z2 = nfc->second.z[1]; + int i; + + ASSUME(count > 0); + + for(i = 0;i < count;i++) + { + float y = src[i]*gain - a1*z1 - a2*z2; + float out = y + b1*z1 + b2*z2; + z2 += z1; + z1 += y; + + dst[i] = out; + } + nfc->second.z[0] = z1; + nfc->second.z[1] = z2; +} + +void NfcFilterProcess3(NfcFilter *nfc, float *restrict dst, const float *restrict src, const int count) +{ + const float gain = nfc->third.gain; + const float b1 = nfc->third.b1; + const float b2 = nfc->third.b2; + const float b3 = nfc->third.b3; + const float a1 = nfc->third.a1; + const float a2 = nfc->third.a2; + const float a3 = nfc->third.a3; + float z1 = nfc->third.z[0]; + float z2 = nfc->third.z[1]; + float z3 = nfc->third.z[2]; + int i; + + ASSUME(count > 0); + + for(i = 0;i < count;i++) + { + float y = src[i]*gain - a1*z1 - a2*z2; + float out = y + b1*z1 + b2*z2; + z2 += z1; + z1 += y; + + y = out - a3*z3; + out = y + b3*z3; + z3 += y; + + dst[i] = out; + } + nfc->third.z[0] = z1; + nfc->third.z[1] = z2; + nfc->third.z[2] = z3; +} + +#if 0 /* Original methods the above are derived from. */ +static void NfcFilterCreate(NfcFilter *nfc, const ALsizei order, const float src_dist, const float ctl_dist, const float rate) +{ + static const float B[4][5] = { + { }, + { 1.0f }, + { 3.0f, 3.0f }, + { 3.6778f, 6.4595f, 2.3222f }, + { 4.2076f, 11.4877f, 5.7924f, 9.1401f } + }; + float w0 = SPEEDOFSOUNDMETRESPERSEC / (src_dist * rate); + float w1 = SPEEDOFSOUNDMETRESPERSEC / (ctl_dist * rate); + ALsizei i; + float r; + + nfc->g = 1.0f; + nfc->coeffs[0] = 1.0f; + + /* NOTE: Slight adjustment from the literature to raise the center + * frequency a bit (0.5 -> 1.0). + */ + r = 1.0f * w0; + for(i = 0; i < (order-1);i += 2) + { + float b_10 = B[order][i ] * r; + float b_11 = B[order][i+1] * r * r; + float g_1 = 1.0f + b_10 + b_11; + + nfc->b[i] = b_10; + nfc->b[i + 1] = b_11; + nfc->coeffs[0] *= g_1; + nfc->coeffs[i+1] = ((2.0f * b_10) + (4.0f * b_11)) / g_1; + nfc->coeffs[i+2] = (4.0f * b_11) / g_1; + } + if(i < order) + { + float b_00 = B[order][i] * r; + float g_0 = 1.0f + b_00; + + nfc->b[i] = b_00; + nfc->coeffs[0] *= g_0; + nfc->coeffs[i+1] = (2.0f * b_00) / g_0; + } + + r = 1.0f * w1; + for(i = 0;i < (order-1);i += 2) + { + float b_10 = B[order][i ] * r; + float b_11 = B[order][i+1] * r * r; + float g_1 = 1.0f + b_10 + b_11; + + nfc->g /= g_1; + nfc->coeffs[0] /= g_1; + nfc->coeffs[order+i+1] = ((2.0f * b_10) + (4.0f * b_11)) / g_1; + nfc->coeffs[order+i+2] = (4.0f * b_11) / g_1; + } + if(i < order) + { + float b_00 = B[order][i] * r; + float g_0 = 1.0f + b_00; + + nfc->g /= g_0; + nfc->coeffs[0] /= g_0; + nfc->coeffs[order+i+1] = (2.0f * b_00) / g_0; + } + + for(i = 0; i < MAX_AMBI_ORDER; i++) + nfc->history[i] = 0.0f; +} + +static void NfcFilterAdjust(NfcFilter *nfc, const float distance) +{ + int i; + + nfc->coeffs[0] = nfc->g; + + for(i = 0;i < (nfc->order-1);i += 2) + { + float b_10 = nfc->b[i] / distance; + float b_11 = nfc->b[i+1] / (distance * distance); + float g_1 = 1.0f + b_10 + b_11; + + nfc->coeffs[0] *= g_1; + nfc->coeffs[i+1] = ((2.0f * b_10) + (4.0f * b_11)) / g_1; + nfc->coeffs[i+2] = (4.0f * b_11) / g_1; + } + if(i < nfc->order) + { + float b_00 = nfc->b[i] / distance; + float g_0 = 1.0f + b_00; + + nfc->coeffs[0] *= g_0; + nfc->coeffs[i+1] = (2.0f * b_00) / g_0; + } +} + +static float NfcFilterProcess(const float in, NfcFilter *nfc) +{ + int i; + float out = in * nfc->coeffs[0]; + + for(i = 0;i < (nfc->order-1);i += 2) + { + float y = out - (nfc->coeffs[nfc->order+i+1] * nfc->history[i]) - + (nfc->coeffs[nfc->order+i+2] * nfc->history[i+1]) + 1.0e-30f; + out = y + (nfc->coeffs[i+1]*nfc->history[i]) + (nfc->coeffs[i+2]*nfc->history[i+1]); + + nfc->history[i+1] += nfc->history[i]; + nfc->history[i] += y; + } + if(i < nfc->order) + { + float y = out - (nfc->coeffs[nfc->order+i+1] * nfc->history[i]) + 1.0e-30f; + + out = y + (nfc->coeffs[i+1] * nfc->history[i]); + nfc->history[i] += y; + } + + return out; +} +#endif diff --git a/Engine/lib/openal-soft/Alc/filters/nfc.h b/Engine/lib/openal-soft/Alc/filters/nfc.h new file mode 100644 index 000000000..12a5a18f3 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/filters/nfc.h @@ -0,0 +1,49 @@ +#ifndef FILTER_NFC_H +#define FILTER_NFC_H + +struct NfcFilter1 { + float base_gain, gain; + float b1, a1; + float z[1]; +}; +struct NfcFilter2 { + float base_gain, gain; + float b1, b2, a1, a2; + float z[2]; +}; +struct NfcFilter3 { + float base_gain, gain; + float b1, b2, b3, a1, a2, a3; + float z[3]; +}; + +typedef struct NfcFilter { + struct NfcFilter1 first; + struct NfcFilter2 second; + struct NfcFilter3 third; +} NfcFilter; + + +/* NOTE: + * w0 = speed_of_sound / (source_distance * sample_rate); + * w1 = speed_of_sound / (control_distance * sample_rate); + * + * Generally speaking, the control distance should be approximately the average + * speaker distance, or based on the reference delay if outputing NFC-HOA. It + * must not be negative, 0, or infinite. The source distance should not be too + * small relative to the control distance. + */ + +void NfcFilterCreate(NfcFilter *nfc, const float w0, const float w1); +void NfcFilterAdjust(NfcFilter *nfc, const float w0); + +/* Near-field control filter for first-order ambisonic channels (1-3). */ +void NfcFilterProcess1(NfcFilter *nfc, float *restrict dst, const float *restrict src, const int count); + +/* Near-field control filter for second-order ambisonic channels (4-8). */ +void NfcFilterProcess2(NfcFilter *nfc, float *restrict dst, const float *restrict src, const int count); + +/* Near-field control filter for third-order ambisonic channels (9-15). */ +void NfcFilterProcess3(NfcFilter *nfc, float *restrict dst, const float *restrict src, const int count); + +#endif /* FILTER_NFC_H */ diff --git a/Engine/lib/openal-soft/Alc/filters/splitter.c b/Engine/lib/openal-soft/Alc/filters/splitter.c new file mode 100644 index 000000000..e99f4b953 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/filters/splitter.c @@ -0,0 +1,109 @@ + +#include "config.h" + +#include "splitter.h" + +#include "math_defs.h" + + +void bandsplit_init(BandSplitter *splitter, ALfloat f0norm) +{ + ALfloat w = f0norm * F_TAU; + ALfloat cw = cosf(w); + if(cw > FLT_EPSILON) + splitter->coeff = (sinf(w) - 1.0f) / cw; + else + splitter->coeff = cw * -0.5f; + + splitter->lp_z1 = 0.0f; + splitter->lp_z2 = 0.0f; + splitter->hp_z1 = 0.0f; +} + +void bandsplit_clear(BandSplitter *splitter) +{ + splitter->lp_z1 = 0.0f; + splitter->lp_z2 = 0.0f; + splitter->hp_z1 = 0.0f; +} + +void bandsplit_process(BandSplitter *splitter, ALfloat *restrict hpout, ALfloat *restrict lpout, + const ALfloat *input, ALsizei count) +{ + ALfloat lp_coeff, hp_coeff, lp_y, hp_y, d; + ALfloat lp_z1, lp_z2, hp_z1; + ALsizei i; + + ASSUME(count > 0); + + hp_coeff = splitter->coeff; + lp_coeff = splitter->coeff*0.5f + 0.5f; + lp_z1 = splitter->lp_z1; + lp_z2 = splitter->lp_z2; + hp_z1 = splitter->hp_z1; + for(i = 0;i < count;i++) + { + ALfloat in = input[i]; + + /* Low-pass sample processing. */ + d = (in - lp_z1) * lp_coeff; + lp_y = lp_z1 + d; + lp_z1 = lp_y + d; + + d = (lp_y - lp_z2) * lp_coeff; + lp_y = lp_z2 + d; + lp_z2 = lp_y + d; + + lpout[i] = lp_y; + + /* All-pass sample processing. */ + hp_y = in*hp_coeff + hp_z1; + hp_z1 = in - hp_y*hp_coeff; + + /* High-pass generated from removing low-passed output. */ + hpout[i] = hp_y - lp_y; + } + splitter->lp_z1 = lp_z1; + splitter->lp_z2 = lp_z2; + splitter->hp_z1 = hp_z1; +} + + +void splitterap_init(SplitterAllpass *splitter, ALfloat f0norm) +{ + ALfloat w = f0norm * F_TAU; + ALfloat cw = cosf(w); + if(cw > FLT_EPSILON) + splitter->coeff = (sinf(w) - 1.0f) / cw; + else + splitter->coeff = cw * -0.5f; + + splitter->z1 = 0.0f; +} + +void splitterap_clear(SplitterAllpass *splitter) +{ + splitter->z1 = 0.0f; +} + +void splitterap_process(SplitterAllpass *splitter, ALfloat *restrict samples, ALsizei count) +{ + ALfloat coeff, in, out; + ALfloat z1; + ALsizei i; + + ASSUME(count > 0); + + coeff = splitter->coeff; + z1 = splitter->z1; + for(i = 0;i < count;i++) + { + in = samples[i]; + + out = in*coeff + z1; + z1 = in - out*coeff; + + samples[i] = out; + } + splitter->z1 = z1; +} diff --git a/Engine/lib/openal-soft/Alc/filters/splitter.h b/Engine/lib/openal-soft/Alc/filters/splitter.h new file mode 100644 index 000000000..a788bc3e9 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/filters/splitter.h @@ -0,0 +1,40 @@ +#ifndef FILTER_SPLITTER_H +#define FILTER_SPLITTER_H + +#include "alMain.h" + + +/* Band splitter. Splits a signal into two phase-matching frequency bands. */ +typedef struct BandSplitter { + ALfloat coeff; + ALfloat lp_z1; + ALfloat lp_z2; + ALfloat hp_z1; +} BandSplitter; + +void bandsplit_init(BandSplitter *splitter, ALfloat f0norm); +void bandsplit_clear(BandSplitter *splitter); +void bandsplit_process(BandSplitter *splitter, ALfloat *restrict hpout, ALfloat *restrict lpout, + const ALfloat *input, ALsizei count); + +/* The all-pass portion of the band splitter. Applies the same phase shift + * without splitting the signal. + */ +typedef struct SplitterAllpass { + ALfloat coeff; + ALfloat z1; +} SplitterAllpass; + +void splitterap_init(SplitterAllpass *splitter, ALfloat f0norm); +void splitterap_clear(SplitterAllpass *splitter); +void splitterap_process(SplitterAllpass *splitter, ALfloat *restrict samples, ALsizei count); + + +typedef struct FrontStablizer { + SplitterAllpass APFilter[MAX_OUTPUT_CHANNELS]; + BandSplitter LFilter, RFilter; + alignas(16) ALfloat LSplit[2][BUFFERSIZE]; + alignas(16) ALfloat RSplit[2][BUFFERSIZE]; +} FrontStablizer; + +#endif /* FILTER_SPLITTER_H */ diff --git a/Engine/lib/openal-soft/Alc/fpu_modes.h b/Engine/lib/openal-soft/Alc/fpu_modes.h new file mode 100644 index 000000000..eb3059679 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/fpu_modes.h @@ -0,0 +1,34 @@ +#ifndef FPU_MODES_H +#define FPU_MODES_H + +#ifdef HAVE_FENV_H +#include +#endif + + +typedef struct FPUCtl { +#if defined(__GNUC__) && defined(HAVE_SSE) + unsigned int sse_state; +#elif defined(HAVE___CONTROL87_2) + unsigned int state; + unsigned int sse_state; +#elif defined(HAVE__CONTROLFP) + unsigned int state; +#endif +} FPUCtl; +void SetMixerFPUMode(FPUCtl *ctl); +void RestoreFPUMode(const FPUCtl *ctl); + +#ifdef __GNUC__ +/* Use an alternate macro set with GCC to avoid accidental continue or break + * statements within the mixer mode. + */ +#define START_MIXER_MODE() __extension__({ FPUCtl _oldMode; SetMixerFPUMode(&_oldMode) +#define END_MIXER_MODE() RestoreFPUMode(&_oldMode); }) +#else +#define START_MIXER_MODE() do { FPUCtl _oldMode; SetMixerFPUMode(&_oldMode) +#define END_MIXER_MODE() RestoreFPUMode(&_oldMode); } while(0) +#endif +#define LEAVE_MIXER_MODE() RestoreFPUMode(&_oldMode) + +#endif /* FPU_MODES_H */ diff --git a/Engine/lib/openal-soft/Alc/helpers.c b/Engine/lib/openal-soft/Alc/helpers.c index 0a6982e90..7bcb3f4ab 100644 --- a/Engine/lib/openal-soft/Alc/helpers.c +++ b/Engine/lib/openal-soft/Alc/helpers.c @@ -39,6 +39,14 @@ #ifdef HAVE_DIRENT_H #include #endif +#ifdef HAVE_PROC_PIDPATH +#include +#endif + +#ifdef __FreeBSD__ +#include +#include +#endif #ifndef AL_NO_UID_DEFS #if defined(HAVE_GUIDDEF_H) || defined(HAVE_INITGUID_H) @@ -61,7 +69,7 @@ DEFINE_GUID(IID_IAudioClient, 0x1cb9ad4c, 0xdbfa, 0x4c32, 0xb1,0x78, 0xc DEFINE_GUID(IID_IAudioRenderClient, 0xf294acfc, 0x3146, 0x4483, 0xa7,0xbf, 0xad,0xdc,0xa7,0xc2,0x60,0xe2); DEFINE_GUID(IID_IAudioCaptureClient, 0xc8adbd64, 0xe71e, 0x48a0, 0xa4,0xde, 0x18,0x5c,0x39,0x5c,0xd3,0x17); -#ifdef HAVE_MMDEVAPI +#ifdef HAVE_WASAPI #include #include #include @@ -103,6 +111,8 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x #include "alMain.h" #include "alu.h" +#include "cpu_caps.h" +#include "fpu_modes.h" #include "atomic.h" #include "uintmap.h" #include "vector.h" @@ -112,71 +122,50 @@ DEFINE_PROPERTYKEY(PKEY_AudioEndpoint_GUID, 0x1da5d803, 0xd492, 0x4edd, 0x8c, 0x extern inline ALuint NextPowerOf2(ALuint value); +extern inline size_t RoundUp(size_t value, size_t r); extern inline ALint fastf2i(ALfloat f); -extern inline ALuint fastf2u(ALfloat f); +extern inline int float2int(float f); +#ifndef __GNUC__ +#if defined(HAVE_BITSCANFORWARD64_INTRINSIC) +extern inline int msvc64_ctz64(ALuint64 v); +#elif defined(HAVE_BITSCANFORWARD_INTRINSIC) +extern inline int msvc_ctz64(ALuint64 v); +#else +extern inline int fallback_popcnt64(ALuint64 v); +extern inline int fallback_ctz64(ALuint64 value); +#endif +#endif -ALuint CPUCapFlags = 0; +#if defined(HAVE_GCC_GET_CPUID) && (defined(__i386__) || defined(__x86_64__) || \ + defined(_M_IX86) || defined(_M_X64)) +typedef unsigned int reg_type; +static inline void get_cpuid(int f, reg_type *regs) +{ __get_cpuid(f, ®s[0], ®s[1], ®s[2], ®s[3]); } +#define CAN_GET_CPUID +#elif defined(HAVE_CPUID_INTRINSIC) && (defined(__i386__) || defined(__x86_64__) || \ + defined(_M_IX86) || defined(_M_X64)) +typedef int reg_type; +static inline void get_cpuid(int f, reg_type *regs) +{ (__cpuid)(regs, f); } +#define CAN_GET_CPUID +#endif +int CPUCapFlags = 0; -void FillCPUCaps(ALuint capfilter) +void FillCPUCaps(int capfilter) { - ALuint caps = 0; + int caps = 0; /* FIXME: We really should get this for all available CPUs in case different * CPUs have different caps (is that possible on one machine?). */ -#if defined(HAVE_GCC_GET_CPUID) && (defined(__i386__) || defined(__x86_64__) || \ - defined(_M_IX86) || defined(_M_X64)) +#ifdef CAN_GET_CPUID union { - unsigned int regs[4]; - char str[sizeof(unsigned int[4])]; - } cpuinf[3]; + reg_type regs[4]; + char str[sizeof(reg_type[4])]; + } cpuinf[3] = {{ { 0, 0, 0, 0 } }}; - if(!__get_cpuid(0, &cpuinf[0].regs[0], &cpuinf[0].regs[1], &cpuinf[0].regs[2], &cpuinf[0].regs[3])) - ERR("Failed to get CPUID\n"); - else - { - unsigned int maxfunc = cpuinf[0].regs[0]; - unsigned int maxextfunc = 0; - - if(__get_cpuid(0x80000000, &cpuinf[0].regs[0], &cpuinf[0].regs[1], &cpuinf[0].regs[2], &cpuinf[0].regs[3])) - maxextfunc = cpuinf[0].regs[0]; - TRACE("Detected max CPUID function: 0x%x (ext. 0x%x)\n", maxfunc, maxextfunc); - - TRACE("Vendor ID: \"%.4s%.4s%.4s\"\n", cpuinf[0].str+4, cpuinf[0].str+12, cpuinf[0].str+8); - if(maxextfunc >= 0x80000004 && - __get_cpuid(0x80000002, &cpuinf[0].regs[0], &cpuinf[0].regs[1], &cpuinf[0].regs[2], &cpuinf[0].regs[3]) && - __get_cpuid(0x80000003, &cpuinf[1].regs[0], &cpuinf[1].regs[1], &cpuinf[1].regs[2], &cpuinf[1].regs[3]) && - __get_cpuid(0x80000004, &cpuinf[2].regs[0], &cpuinf[2].regs[1], &cpuinf[2].regs[2], &cpuinf[2].regs[3])) - TRACE("Name: \"%.16s%.16s%.16s\"\n", cpuinf[0].str, cpuinf[1].str, cpuinf[2].str); - - if(maxfunc >= 1 && - __get_cpuid(1, &cpuinf[0].regs[0], &cpuinf[0].regs[1], &cpuinf[0].regs[2], &cpuinf[0].regs[3])) - { - if((cpuinf[0].regs[3]&(1<<25))) - { - caps |= CPU_CAP_SSE; - if((cpuinf[0].regs[3]&(1<<26))) - { - caps |= CPU_CAP_SSE2; - if((cpuinf[0].regs[2]&(1<<0))) - { - caps |= CPU_CAP_SSE3; - if((cpuinf[0].regs[2]&(1<<19))) - caps |= CPU_CAP_SSE4_1; - } - } - } - } - } -#elif defined(HAVE_CPUID_INTRINSIC) && (defined(__i386__) || defined(__x86_64__) || \ - defined(_M_IX86) || defined(_M_X64)) - union { - int regs[4]; - char str[sizeof(int[4])]; - } cpuinf[3]; - - (__cpuid)(cpuinf[0].regs, 0); + get_cpuid(0, cpuinf[0].regs); if(cpuinf[0].regs[0] == 0) ERR("Failed to get CPUID\n"); else @@ -184,7 +173,7 @@ void FillCPUCaps(ALuint capfilter) unsigned int maxfunc = cpuinf[0].regs[0]; unsigned int maxextfunc; - (__cpuid)(cpuinf[0].regs, 0x80000000); + get_cpuid(0x80000000, cpuinf[0].regs); maxextfunc = cpuinf[0].regs[0]; TRACE("Detected max CPUID function: 0x%x (ext. 0x%x)\n", maxfunc, maxextfunc); @@ -192,29 +181,23 @@ void FillCPUCaps(ALuint capfilter) TRACE("Vendor ID: \"%.4s%.4s%.4s\"\n", cpuinf[0].str+4, cpuinf[0].str+12, cpuinf[0].str+8); if(maxextfunc >= 0x80000004) { - (__cpuid)(cpuinf[0].regs, 0x80000002); - (__cpuid)(cpuinf[1].regs, 0x80000003); - (__cpuid)(cpuinf[2].regs, 0x80000004); + get_cpuid(0x80000002, cpuinf[0].regs); + get_cpuid(0x80000003, cpuinf[1].regs); + get_cpuid(0x80000004, cpuinf[2].regs); TRACE("Name: \"%.16s%.16s%.16s\"\n", cpuinf[0].str, cpuinf[1].str, cpuinf[2].str); } if(maxfunc >= 1) { - (__cpuid)(cpuinf[0].regs, 1); + get_cpuid(1, cpuinf[0].regs); if((cpuinf[0].regs[3]&(1<<25))) - { caps |= CPU_CAP_SSE; - if((cpuinf[0].regs[3]&(1<<26))) - { - caps |= CPU_CAP_SSE2; - if((cpuinf[0].regs[2]&(1<<0))) - { - caps |= CPU_CAP_SSE3; - if((cpuinf[0].regs[2]&(1<<19))) - caps |= CPU_CAP_SSE4_1; - } - } - } + if((caps&CPU_CAP_SSE) && (cpuinf[0].regs[3]&(1<<26))) + caps |= CPU_CAP_SSE2; + if((caps&CPU_CAP_SSE2) && (cpuinf[0].regs[2]&(1<<0))) + caps |= CPU_CAP_SSE3; + if((caps&CPU_CAP_SSE3) && (cpuinf[0].regs[2]&(1<<19))) + caps |= CPU_CAP_SSE4_1; } } #else @@ -242,11 +225,16 @@ void FillCPUCaps(ALuint capfilter) char buf[256]; while(fgets(buf, sizeof(buf), file) != NULL) { + size_t len; char *str; if(strncmp(buf, "Features\t:", 10) != 0) continue; + len = strlen(buf); + while(len > 0 && isspace(buf[len-1])) + buf[--len] = 0; + TRACE("Got features string:%s\n", buf+10); str = buf; @@ -272,7 +260,7 @@ void FillCPUCaps(ALuint capfilter) ((capfilter&CPU_CAP_SSE2) ? ((caps&CPU_CAP_SSE2) ? " +SSE2" : " -SSE2") : ""), ((capfilter&CPU_CAP_SSE3) ? ((caps&CPU_CAP_SSE3) ? " +SSE3" : " -SSE3") : ""), ((capfilter&CPU_CAP_SSE4_1) ? ((caps&CPU_CAP_SSE4_1) ? " +SSE4.1" : " -SSE4.1") : ""), - ((capfilter&CPU_CAP_NEON) ? ((caps&CPU_CAP_NEON) ? " +Neon" : " -Neon") : ""), + ((capfilter&CPU_CAP_NEON) ? ((caps&CPU_CAP_NEON) ? " +NEON" : " -NEON") : ""), ((!capfilter) ? " -none-" : "") ); CPUCapFlags = caps & capfilter; @@ -281,78 +269,51 @@ void FillCPUCaps(ALuint capfilter) void SetMixerFPUMode(FPUCtl *ctl) { -#ifdef HAVE_FENV_H - fegetenv(STATIC_CAST(fenv_t, ctl)); -#if defined(__GNUC__) && defined(HAVE_SSE) - /* FIXME: Some fegetenv implementations can get the SSE environment too? - * How to tell when it does? */ - if((CPUCapFlags&CPU_CAP_SSE)) - __asm__ __volatile__("stmxcsr %0" : "=m" (*&ctl->sse_state)); -#endif - -#ifdef FE_TOWARDZERO - fesetround(FE_TOWARDZERO); -#endif #if defined(__GNUC__) && defined(HAVE_SSE) if((CPUCapFlags&CPU_CAP_SSE)) { - int sseState = ctl->sse_state; - sseState |= 0x6000; /* set round-to-zero */ + __asm__ __volatile__("stmxcsr %0" : "=m" (*&ctl->sse_state)); + unsigned int sseState = ctl->sse_state; sseState |= 0x8000; /* set flush-to-zero */ if((CPUCapFlags&CPU_CAP_SSE2)) sseState |= 0x0040; /* set denormals-are-zero */ __asm__ __volatile__("ldmxcsr %0" : : "m" (*&sseState)); } -#endif #elif defined(HAVE___CONTROL87_2) - int mode; - __control87_2(0, 0, &ctl->state, NULL); - __control87_2(_RC_CHOP, _MCW_RC, &mode, NULL); -#ifdef HAVE_SSE - if((CPUCapFlags&CPU_CAP_SSE)) - { - __control87_2(0, 0, NULL, &ctl->sse_state); - __control87_2(_RC_CHOP|_DN_FLUSH, _MCW_RC|_MCW_DN, NULL, &mode); - } -#endif + __control87_2(0, 0, &ctl->state, &ctl->sse_state); + _control87(_DN_FLUSH, _MCW_DN); #elif defined(HAVE__CONTROLFP) ctl->state = _controlfp(0, 0); - (void)_controlfp(_RC_CHOP, _MCW_RC); + _controlfp(_DN_FLUSH, _MCW_DN); #endif } void RestoreFPUMode(const FPUCtl *ctl) { -#ifdef HAVE_FENV_H - fesetenv(STATIC_CAST(fenv_t, ctl)); #if defined(__GNUC__) && defined(HAVE_SSE) if((CPUCapFlags&CPU_CAP_SSE)) __asm__ __volatile__("ldmxcsr %0" : : "m" (*&ctl->sse_state)); -#endif #elif defined(HAVE___CONTROL87_2) int mode; - __control87_2(ctl->state, _MCW_RC, &mode, NULL); -#ifdef HAVE_SSE - if((CPUCapFlags&CPU_CAP_SSE)) - __control87_2(ctl->sse_state, _MCW_RC|_MCW_DN, NULL, &mode); -#endif + __control87_2(ctl->state, _MCW_DN, &mode, NULL); + __control87_2(ctl->sse_state, _MCW_DN, NULL, &mode); #elif defined(HAVE__CONTROLFP) - _controlfp(ctl->state, _MCW_RC); + _controlfp(ctl->state, _MCW_DN); #endif } static int StringSortCompare(const void *str1, const void *str2) { - return al_string_cmp(*(const_al_string*)str1, *(const_al_string*)str2); + return alstr_cmp(*(const_al_string*)str1, *(const_al_string*)str2); } #ifdef _WIN32 @@ -369,9 +330,8 @@ static WCHAR *strrchrW(WCHAR *str, WCHAR ch) return ret; } -al_string GetProcPath(void) +void GetProcBinary(al_string *path, al_string *fname) { - al_string ret = AL_STRING_INIT_STATIC(); WCHAR *pathname, *sep; DWORD pathlen; DWORD len; @@ -388,23 +348,34 @@ al_string GetProcPath(void) { free(pathname); ERR("Failed to get process name: error %lu\n", GetLastError()); - return ret; + return; } pathname[len] = 0; - if((sep = strrchrW(pathname, '\\'))) + if((sep=strrchrW(pathname, '\\')) != NULL) { - WCHAR *sep2 = strrchrW(pathname, '/'); - if(sep2) *sep2 = 0; - else *sep = 0; + WCHAR *sep2 = strrchrW(sep+1, '/'); + if(sep2) sep = sep2; + } + else + sep = strrchrW(pathname, '/'); + + if(sep) + { + if(path) alstr_copy_wrange(path, pathname, sep); + if(fname) alstr_copy_wcstr(fname, sep+1); + } + else + { + if(path) alstr_clear(path); + if(fname) alstr_copy_wcstr(fname, pathname); } - else if((sep = strrchrW(pathname, '/'))) - *sep = 0; - al_string_copy_wcstr(&ret, pathname); free(pathname); - TRACE("Got: %s\n", al_string_get_cstr(ret)); - return ret; + if(path && fname) + TRACE("Got: %s, %s\n", alstr_get_cstr(*path), alstr_get_cstr(*fname)); + else if(path) TRACE("Got path: %s\n", alstr_get_cstr(*path)); + else if(fname) TRACE("Got filename: %s\n", alstr_get_cstr(*fname)); } @@ -520,13 +491,13 @@ static void DirectorySearch(const char *path, const char *ext, vector_al_string WCHAR *wpath; HANDLE hdl; - al_string_copy_cstr(&pathstr, path); - al_string_append_cstr(&pathstr, "\\*"); - al_string_append_cstr(&pathstr, ext); + alstr_copy_cstr(&pathstr, path); + alstr_append_cstr(&pathstr, "\\*"); + alstr_append_cstr(&pathstr, ext); - TRACE("Searching %s\n", al_string_get_cstr(pathstr)); + TRACE("Searching %s\n", alstr_get_cstr(pathstr)); - wpath = FromUTF8(al_string_get_cstr(pathstr)); + wpath = FromUTF8(alstr_get_cstr(pathstr)); hdl = FindFirstFileW(wpath, &fdata); if(hdl != INVALID_HANDLE_VALUE) @@ -534,10 +505,10 @@ static void DirectorySearch(const char *path, const char *ext, vector_al_string size_t base = VECTOR_SIZE(*results); do { al_string str = AL_STRING_INIT_STATIC(); - al_string_copy_cstr(&str, path); - al_string_append_char(&str, '\\'); - al_string_append_wcstr(&str, fdata.cFileName); - TRACE("Got result %s\n", al_string_get_cstr(str)); + alstr_copy_cstr(&str, path); + alstr_append_char(&str, '\\'); + alstr_append_wcstr(&str, fdata.cFileName); + TRACE("Got result %s\n", alstr_get_cstr(str)); VECTOR_PUSH_BACK(*results, str); } while(FindNextFileW(hdl, &fdata)); FindClose(hdl); @@ -548,7 +519,7 @@ static void DirectorySearch(const char *path, const char *ext, vector_al_string } free(wpath); - al_string_deinit(&pathstr); + alstr_reset(&pathstr); } vector_al_string SearchDataFiles(const char *ext, const char *subdir) @@ -558,21 +529,21 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir) vector_al_string results = VECTOR_INIT_STATIC(); size_t i; - while(ATOMIC_EXCHANGE(uint, &search_lock, 1) == 1) + while(ATOMIC_EXCHANGE_SEQ(&search_lock, 1) == 1) althrd_yield(); /* If the path is absolute, use it directly. */ if(isalpha(subdir[0]) && subdir[1] == ':' && is_slash(subdir[2])) { al_string path = AL_STRING_INIT_STATIC(); - al_string_copy_cstr(&path, subdir); + alstr_copy_cstr(&path, subdir); #define FIX_SLASH(i) do { if(*(i) == '/') *(i) = '\\'; } while(0) VECTOR_FOR_EACH(char, path, FIX_SLASH); #undef FIX_SLASH - DirectorySearch(al_string_get_cstr(path), ext, &results); + DirectorySearch(alstr_get_cstr(path), ext, &results); - al_string_deinit(&path); + alstr_reset(&path); } else if(subdir[0] == '\\' && subdir[1] == '\\' && subdir[2] == '?' && subdir[3] == '\\') DirectorySearch(subdir, ext, &results); @@ -584,7 +555,7 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir) /* Search the app-local directory. */ if((cwdbuf=_wgetenv(L"ALSOFT_LOCAL_PATH")) && *cwdbuf != '\0') { - al_string_copy_wcstr(&path, cwdbuf); + alstr_copy_wcstr(&path, cwdbuf); if(is_slash(VECTOR_BACK(path))) { VECTOR_POP_BACK(path); @@ -592,10 +563,10 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir) } } else if(!(cwdbuf=_wgetcwd(NULL, 0))) - al_string_copy_cstr(&path, "."); + alstr_copy_cstr(&path, "."); else { - al_string_copy_wcstr(&path, cwdbuf); + alstr_copy_wcstr(&path, cwdbuf); if(is_slash(VECTOR_BACK(path))) { VECTOR_POP_BACK(path); @@ -606,30 +577,30 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir) #define FIX_SLASH(i) do { if(*(i) == '/') *(i) = '\\'; } while(0) VECTOR_FOR_EACH(char, path, FIX_SLASH); #undef FIX_SLASH - DirectorySearch(al_string_get_cstr(path), ext, &results); + DirectorySearch(alstr_get_cstr(path), ext, &results); /* Search the local and global data dirs. */ for(i = 0;i < COUNTOF(ids);i++) { - WCHAR buffer[PATH_MAX]; + WCHAR buffer[MAX_PATH]; if(SHGetSpecialFolderPathW(NULL, buffer, ids[i], FALSE) != FALSE) { - al_string_copy_wcstr(&path, buffer); + alstr_copy_wcstr(&path, buffer); if(!is_slash(VECTOR_BACK(path))) - al_string_append_char(&path, '\\'); - al_string_append_cstr(&path, subdir); + alstr_append_char(&path, '\\'); + alstr_append_cstr(&path, subdir); #define FIX_SLASH(i) do { if(*(i) == '/') *(i) = '\\'; } while(0) VECTOR_FOR_EACH(char, path, FIX_SLASH); #undef FIX_SLASH - DirectorySearch(al_string_get_cstr(path), ext, &results); + DirectorySearch(alstr_get_cstr(path), ext, &results); } } - al_string_deinit(&path); + alstr_reset(&path); } - ATOMIC_STORE(&search_lock, 0); + ATOMIC_STORE_SEQ(&search_lock, 0); return results; } @@ -698,49 +669,103 @@ void UnmapFileMem(const struct FileMapping *mapping) #else -al_string GetProcPath(void) +void GetProcBinary(al_string *path, al_string *fname) { - al_string ret = AL_STRING_INIT_STATIC(); - const char *fname; - char *pathname, *sep; + char *pathname = NULL; size_t pathlen; - ssize_t len; - pathlen = 256; - pathname = malloc(pathlen); - - fname = "/proc/self/exe"; - len = readlink(fname, pathname, pathlen); - if(len == -1 && errno == ENOENT) - { - fname = "/proc/self/file"; - len = readlink(fname, pathname, pathlen); - } - - while(len > 0 && (size_t)len == pathlen) - { - free(pathname); - pathlen <<= 1; - pathname = malloc(pathlen); - len = readlink(fname, pathname, pathlen); - } - if(len <= 0) - { - free(pathname); - WARN("Failed to readlink %s: %s\n", fname, strerror(errno)); - return ret; - } - - pathname[len] = 0; - sep = strrchr(pathname, '/'); - if(sep) - al_string_copy_range(&ret, pathname, sep); +#ifdef __FreeBSD__ + int mib[4] = { CTL_KERN, KERN_PROC_ARGS, getpid() }; + if(sysctl(mib, 3, NULL, &pathlen, NULL, 0) == -1) + WARN("Failed to sysctl kern.procargs.%d: %s\n", mib[2], strerror(errno)); else - al_string_copy_cstr(&ret, pathname); + { + pathname = malloc(pathlen + 1); + sysctl(mib, 3, (void*)pathname, &pathlen, NULL, 0); + pathname[pathlen] = 0; + } +#endif +#ifdef HAVE_PROC_PIDPATH + if(!pathname) + { + const pid_t pid = getpid(); + char procpath[PROC_PIDPATHINFO_MAXSIZE]; + int ret; + + ret = proc_pidpath(pid, procpath, sizeof(procpath)); + if(ret < 1) + { + WARN("proc_pidpath(%d, ...) failed: %s\n", pid, strerror(errno)); + free(pathname); + pathname = NULL; + } + else + { + pathlen = strlen(procpath); + pathname = strdup(procpath); + } + } +#endif + if(!pathname) + { + const char *selfname; + ssize_t len; + + pathlen = 256; + pathname = malloc(pathlen); + + selfname = "/proc/self/exe"; + len = readlink(selfname, pathname, pathlen); + if(len == -1 && errno == ENOENT) + { + selfname = "/proc/self/file"; + len = readlink(selfname, pathname, pathlen); + } + if(len == -1 && errno == ENOENT) + { + selfname = "/proc/curproc/exe"; + len = readlink(selfname, pathname, pathlen); + } + if(len == -1 && errno == ENOENT) + { + selfname = "/proc/curproc/file"; + len = readlink(selfname, pathname, pathlen); + } + + while(len > 0 && (size_t)len == pathlen) + { + free(pathname); + pathlen <<= 1; + pathname = malloc(pathlen); + len = readlink(selfname, pathname, pathlen); + } + if(len <= 0) + { + free(pathname); + WARN("Failed to readlink %s: %s\n", selfname, strerror(errno)); + return; + } + + pathname[len] = 0; + } + + char *sep = strrchr(pathname, '/'); + if(sep) + { + if(path) alstr_copy_range(path, pathname, sep); + if(fname) alstr_copy_cstr(fname, sep+1); + } + else + { + if(path) alstr_clear(path); + if(fname) alstr_copy_cstr(fname, pathname); + } free(pathname); - TRACE("Got: %s\n", al_string_get_cstr(ret)); - return ret; + if(path && fname) + TRACE("Got: %s, %s\n", alstr_get_cstr(*path), alstr_get_cstr(*fname)); + else if(path) TRACE("Got path: %s\n", alstr_get_cstr(*path)); + else if(fname) TRACE("Got filename: %s\n", alstr_get_cstr(*fname)); } @@ -814,11 +839,11 @@ static void DirectorySearch(const char *path, const char *ext, vector_al_string continue; AL_STRING_INIT(str); - al_string_copy_cstr(&str, path); + alstr_copy_cstr(&str, path); if(VECTOR_BACK(str) != '/') - al_string_append_char(&str, '/'); - al_string_append_cstr(&str, dirent->d_name); - TRACE("Got result %s\n", al_string_get_cstr(str)); + alstr_append_char(&str, '/'); + alstr_append_cstr(&str, dirent->d_name); + TRACE("Got result %s\n", alstr_get_cstr(str)); VECTOR_PUSH_BACK(*results, str); } closedir(dir); @@ -834,7 +859,7 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir) static RefCount search_lock; vector_al_string results = VECTOR_INIT_STATIC(); - while(ATOMIC_EXCHANGE(uint, &search_lock, 1) == 1) + while(ATOMIC_EXCHANGE_SEQ(&search_lock, 1) == 1) althrd_yield(); if(subdir[0] == '/') @@ -843,36 +868,53 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir) { al_string path = AL_STRING_INIT_STATIC(); const char *str, *next; - char cwdbuf[PATH_MAX]; /* Search the app-local directory. */ if((str=getenv("ALSOFT_LOCAL_PATH")) && *str != '\0') DirectorySearch(str, ext, &results); - else if(getcwd(cwdbuf, sizeof(cwdbuf))) - DirectorySearch(cwdbuf, ext, &results); else - DirectorySearch(".", ext, &results); + { + size_t cwdlen = 256; + char *cwdbuf = malloc(cwdlen); + while(!getcwd(cwdbuf, cwdlen)) + { + free(cwdbuf); + cwdbuf = NULL; + if(errno != ERANGE) + break; + cwdlen <<= 1; + cwdbuf = malloc(cwdlen); + } + if(!cwdbuf) + DirectorySearch(".", ext, &results); + else + { + DirectorySearch(cwdbuf, ext, &results); + free(cwdbuf); + cwdbuf = NULL; + } + } // Search local data dir if((str=getenv("XDG_DATA_HOME")) != NULL && str[0] != '\0') { - al_string_copy_cstr(&path, str); + alstr_copy_cstr(&path, str); if(VECTOR_BACK(path) != '/') - al_string_append_char(&path, '/'); - al_string_append_cstr(&path, subdir); - DirectorySearch(al_string_get_cstr(path), ext, &results); + alstr_append_char(&path, '/'); + alstr_append_cstr(&path, subdir); + DirectorySearch(alstr_get_cstr(path), ext, &results); } else if((str=getenv("HOME")) != NULL && str[0] != '\0') { - al_string_copy_cstr(&path, str); + alstr_copy_cstr(&path, str); if(VECTOR_BACK(path) == '/') { VECTOR_POP_BACK(path); *VECTOR_END(path) = 0; } - al_string_append_cstr(&path, "/.local/share/"); - al_string_append_cstr(&path, subdir); - DirectorySearch(al_string_get_cstr(path), ext, &results); + alstr_append_cstr(&path, "/.local/share/"); + alstr_append_cstr(&path, subdir); + DirectorySearch(alstr_get_cstr(path), ext, &results); } // Search global data dirs @@ -884,26 +926,26 @@ vector_al_string SearchDataFiles(const char *ext, const char *subdir) { next = strchr(str, ':'); if(!next) - al_string_copy_cstr(&path, str); + alstr_copy_cstr(&path, str); else { - al_string_copy_range(&path, str, next); + alstr_copy_range(&path, str, next); ++next; } - if(!al_string_empty(path)) + if(!alstr_empty(path)) { if(VECTOR_BACK(path) != '/') - al_string_append_char(&path, '/'); - al_string_append_cstr(&path, subdir); + alstr_append_char(&path, '/'); + alstr_append_cstr(&path, subdir); - DirectorySearch(al_string_get_cstr(path), ext, &results); + DirectorySearch(alstr_get_cstr(path), ext, &results); } } - al_string_deinit(&path); + alstr_reset(&path); } - ATOMIC_STORE(&search_lock, 0); + ATOMIC_STORE_SEQ(&search_lock, 0); return results; } @@ -977,14 +1019,14 @@ void SetRTPriority(void) } -extern inline void al_string_deinit(al_string *str); -extern inline size_t al_string_length(const_al_string str); -extern inline ALboolean al_string_empty(const_al_string str); -extern inline const al_string_char_type *al_string_get_cstr(const_al_string str); +extern inline void alstr_reset(al_string *str); +extern inline size_t alstr_length(const_al_string str); +extern inline ALboolean alstr_empty(const_al_string str); +extern inline const al_string_char_type *alstr_get_cstr(const_al_string str); -void al_string_clear(al_string *str) +void alstr_clear(al_string *str) { - if(!al_string_empty(*str)) + if(!alstr_empty(*str)) { /* Reserve one more character than the total size of the string. This * is to ensure we have space to add a null terminator in the string @@ -995,8 +1037,8 @@ void al_string_clear(al_string *str) } } -static inline int al_string_compare(const al_string_char_type *str1, size_t str1len, - const al_string_char_type *str2, size_t str2len) +static inline int alstr_compare(const al_string_char_type *str1, size_t str1len, + const al_string_char_type *str2, size_t str2len) { size_t complen = (str1len < str2len) ? str1len : str2len; int ret = memcmp(str1, str2, complen); @@ -1007,20 +1049,20 @@ static inline int al_string_compare(const al_string_char_type *str1, size_t str1 } return ret; } -int al_string_cmp(const_al_string str1, const_al_string str2) +int alstr_cmp(const_al_string str1, const_al_string str2) { - return al_string_compare(&VECTOR_FRONT(str1), al_string_length(str1), - &VECTOR_FRONT(str2), al_string_length(str2)); + return alstr_compare(&VECTOR_FRONT(str1), alstr_length(str1), + &VECTOR_FRONT(str2), alstr_length(str2)); } -int al_string_cmp_cstr(const_al_string str1, const al_string_char_type *str2) +int alstr_cmp_cstr(const_al_string str1, const al_string_char_type *str2) { - return al_string_compare(&VECTOR_FRONT(str1), al_string_length(str1), - str2, strlen(str2)); + return alstr_compare(&VECTOR_FRONT(str1), alstr_length(str1), + str2, strlen(str2)); } -void al_string_copy(al_string *str, const_al_string from) +void alstr_copy(al_string *str, const_al_string from) { - size_t len = al_string_length(from); + size_t len = alstr_length(from); size_t i; VECTOR_RESIZE(*str, len, len+1); @@ -1029,7 +1071,7 @@ void al_string_copy(al_string *str, const_al_string from) VECTOR_ELEM(*str, i) = 0; } -void al_string_copy_cstr(al_string *str, const al_string_char_type *from) +void alstr_copy_cstr(al_string *str, const al_string_char_type *from) { size_t len = strlen(from); size_t i; @@ -1040,7 +1082,7 @@ void al_string_copy_cstr(al_string *str, const al_string_char_type *from) VECTOR_ELEM(*str, i) = 0; } -void al_string_copy_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to) +void alstr_copy_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to) { size_t len = to - from; size_t i; @@ -1051,20 +1093,20 @@ void al_string_copy_range(al_string *str, const al_string_char_type *from, const VECTOR_ELEM(*str, i) = 0; } -void al_string_append_char(al_string *str, const al_string_char_type c) +void alstr_append_char(al_string *str, const al_string_char_type c) { - size_t len = al_string_length(*str); + size_t len = alstr_length(*str); VECTOR_RESIZE(*str, len, len+2); VECTOR_PUSH_BACK(*str, c); VECTOR_ELEM(*str, len+1) = 0; } -void al_string_append_cstr(al_string *str, const al_string_char_type *from) +void alstr_append_cstr(al_string *str, const al_string_char_type *from) { size_t len = strlen(from); if(len != 0) { - size_t base = al_string_length(*str); + size_t base = alstr_length(*str); size_t i; VECTOR_RESIZE(*str, base+len, base+len+1); @@ -1074,12 +1116,12 @@ void al_string_append_cstr(al_string *str, const al_string_char_type *from) } } -void al_string_append_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to) +void alstr_append_range(al_string *str, const al_string_char_type *from, const al_string_char_type *to) { size_t len = to - from; if(len != 0) { - size_t base = al_string_length(*str); + size_t base = alstr_length(*str); size_t i; VECTOR_RESIZE(*str, base+len, base+len+1); @@ -1090,7 +1132,7 @@ void al_string_append_range(al_string *str, const al_string_char_type *from, con } #ifdef _WIN32 -void al_string_copy_wcstr(al_string *str, const wchar_t *from) +void alstr_copy_wcstr(al_string *str, const wchar_t *from) { int len; if((len=WideCharToMultiByte(CP_UTF8, 0, from, -1, NULL, 0, NULL, NULL)) > 0) @@ -1101,24 +1143,35 @@ void al_string_copy_wcstr(al_string *str, const wchar_t *from) } } -void al_string_append_wcstr(al_string *str, const wchar_t *from) +void alstr_append_wcstr(al_string *str, const wchar_t *from) { int len; if((len=WideCharToMultiByte(CP_UTF8, 0, from, -1, NULL, 0, NULL, NULL)) > 0) { - size_t base = al_string_length(*str); + size_t base = alstr_length(*str); VECTOR_RESIZE(*str, base+len-1, base+len); WideCharToMultiByte(CP_UTF8, 0, from, -1, &VECTOR_ELEM(*str, base), len, NULL, NULL); VECTOR_ELEM(*str, base+len-1) = 0; } } -void al_string_append_wrange(al_string *str, const wchar_t *from, const wchar_t *to) +void alstr_copy_wrange(al_string *str, const wchar_t *from, const wchar_t *to) { int len; if((len=WideCharToMultiByte(CP_UTF8, 0, from, (int)(to-from), NULL, 0, NULL, NULL)) > 0) { - size_t base = al_string_length(*str); + VECTOR_RESIZE(*str, len, len+1); + WideCharToMultiByte(CP_UTF8, 0, from, (int)(to-from), &VECTOR_FRONT(*str), len+1, NULL, NULL); + VECTOR_ELEM(*str, len) = 0; + } +} + +void alstr_append_wrange(al_string *str, const wchar_t *from, const wchar_t *to) +{ + int len; + if((len=WideCharToMultiByte(CP_UTF8, 0, from, (int)(to-from), NULL, 0, NULL, NULL)) > 0) + { + size_t base = alstr_length(*str); VECTOR_RESIZE(*str, base+len, base+len+1); WideCharToMultiByte(CP_UTF8, 0, from, (int)(to-from), &VECTOR_ELEM(*str, base), len+1, NULL, NULL); VECTOR_ELEM(*str, base+len) = 0; diff --git a/Engine/lib/openal-soft/Alc/hrtf.c b/Engine/lib/openal-soft/Alc/hrtf.c index 02889736c..810530e5c 100644 --- a/Engine/lib/openal-soft/Alc/hrtf.c +++ b/Engine/lib/openal-soft/Alc/hrtf.c @@ -28,8 +28,9 @@ #include "alMain.h" #include "alSource.h" #include "alu.h" -#include "bformatdec.h" #include "hrtf.h" +#include "alconfig.h" +#include "filters/splitter.h" #include "compat.h" #include "almalloc.h" @@ -37,290 +38,447 @@ /* Current data set limits defined by the makehrtf utility. */ #define MIN_IR_SIZE (8) -#define MAX_IR_SIZE (128) +#define MAX_IR_SIZE (512) #define MOD_IR_SIZE (8) +#define MIN_FD_COUNT (1) +#define MAX_FD_COUNT (16) + +#define MIN_FD_DISTANCE (50) +#define MAX_FD_DISTANCE (2500) + #define MIN_EV_COUNT (5) #define MAX_EV_COUNT (128) #define MIN_AZ_COUNT (1) #define MAX_AZ_COUNT (128) +#define MAX_HRIR_DELAY (HRTF_HISTORY_LENGTH-1) + +struct HrtfEntry { + struct HrtfEntry *next; + struct Hrtf *handle; + char filename[]; +}; + static const ALchar magicMarker00[8] = "MinPHR00"; static const ALchar magicMarker01[8] = "MinPHR01"; +static const ALchar magicMarker02[8] = "MinPHR02"; /* First value for pass-through coefficients (remaining are 0), used for omni- * directional sounds. */ -static const ALfloat PassthruCoeff = 32767.0f * 0.707106781187f/*sqrt(0.5)*/; +static const ALfloat PassthruCoeff = 0.707106781187f/*sqrt(0.5)*/; -static struct Hrtf *LoadedHrtfs = NULL; +static ATOMIC_FLAG LoadedHrtfLock = ATOMIC_FLAG_INIT; +static struct HrtfEntry *LoadedHrtfs = NULL; /* Calculate the elevation index given the polar elevation in radians. This - * will return an index between 0 and (evcount - 1). Assumes the FPU is in - * round-to-zero mode. + * will return an index between 0 and (evcount - 1). */ -static ALuint CalcEvIndex(ALuint evcount, ALfloat ev) +static ALsizei CalcEvIndex(ALsizei evcount, ALfloat ev, ALfloat *mu) { - ev = (F_PI_2 + ev) * (evcount-1) / F_PI; - return minu(fastf2u(ev + 0.5f), evcount-1); + ALsizei idx; + ev = (F_PI_2+ev) * (evcount-1) / F_PI; + idx = float2int(ev); + + *mu = ev - idx; + return mini(idx, evcount-1); } /* Calculate the azimuth index given the polar azimuth in radians. This will - * return an index between 0 and (azcount - 1). Assumes the FPU is in round-to- - * zero mode. + * return an index between 0 and (azcount - 1). */ -static ALuint CalcAzIndex(ALuint azcount, ALfloat az) +static ALsizei CalcAzIndex(ALsizei azcount, ALfloat az, ALfloat *mu) { - az = (F_TAU + az) * azcount / F_TAU; - return fastf2u(az + 0.5f) % azcount; + ALsizei idx; + az = (F_TAU+az) * azcount / F_TAU; + + idx = float2int(az); + *mu = az - idx; + return idx % azcount; } /* Calculates static HRIR coefficients and delays for the given polar elevation - * and azimuth in radians. The coefficients are normalized and attenuated by - * the specified gain. + * and azimuth in radians. The coefficients are normalized. */ -void GetHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat spread, ALfloat gain, ALfloat (*coeffs)[2], ALuint *delays) +void GetHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat spread, + ALfloat (*restrict coeffs)[2], ALsizei *delays) { - ALuint evidx, azidx, lidx, ridx; - ALuint azcount, evoffset; + ALsizei evidx, azidx, idx[4]; + ALsizei evoffset; + ALfloat emu, amu[2]; + ALfloat blend[4]; ALfloat dirfact; - ALuint i; + ALsizei i, c; dirfact = 1.0f - (spread / F_TAU); - /* Claculate elevation index. */ - evidx = CalcEvIndex(Hrtf->evCount, elevation); - azcount = Hrtf->azCount[evidx]; + /* Claculate the lower elevation index. */ + evidx = CalcEvIndex(Hrtf->evCount, elevation, &emu); evoffset = Hrtf->evOffset[evidx]; - /* Calculate azimuth index. */ - azidx = CalcAzIndex(Hrtf->azCount[evidx], azimuth); + /* Calculate lower azimuth index. */ + azidx= CalcAzIndex(Hrtf->azCount[evidx], azimuth, &amu[0]); - /* Calculate the HRIR indices for left and right channels. */ - lidx = evoffset + azidx; - ridx = evoffset + ((azcount-azidx) % azcount); - - /* Calculate the HRIR delays. */ - delays[0] = fastf2u(Hrtf->delays[lidx]*dirfact + 0.5f) << HRTFDELAY_BITS; - delays[1] = fastf2u(Hrtf->delays[ridx]*dirfact + 0.5f) << HRTFDELAY_BITS; - - /* Calculate the sample offsets for the HRIR indices. */ - lidx *= Hrtf->irSize; - ridx *= Hrtf->irSize; - - /* Calculate the normalized and attenuated HRIR coefficients. Zero the - * coefficients if gain is too low. - */ - if(gain > 0.0001f) + /* Calculate the lower HRIR indices. */ + idx[0] = evoffset + azidx; + idx[1] = evoffset + ((azidx+1) % Hrtf->azCount[evidx]); + if(evidx < Hrtf->evCount-1) { - gain /= 32767.0f; + /* Increment elevation to the next (upper) index. */ + evidx++; + evoffset = Hrtf->evOffset[evidx]; - i = 0; - coeffs[i][0] = lerp(PassthruCoeff, Hrtf->coeffs[lidx+i], dirfact)*gain; - coeffs[i][1] = lerp(PassthruCoeff, Hrtf->coeffs[ridx+i], dirfact)*gain; - for(i = 1;i < Hrtf->irSize;i++) - { - coeffs[i][0] = Hrtf->coeffs[lidx+i]*gain * dirfact; - coeffs[i][1] = Hrtf->coeffs[ridx+i]*gain * dirfact; - } + /* Calculate upper azimuth index. */ + azidx = CalcAzIndex(Hrtf->azCount[evidx], azimuth, &amu[1]); + + /* Calculate the upper HRIR indices. */ + idx[2] = evoffset + azidx; + idx[3] = evoffset + ((azidx+1) % Hrtf->azCount[evidx]); } else { + /* If the lower elevation is the top index, the upper elevation is the + * same as the lower. + */ + amu[1] = amu[0]; + idx[2] = idx[0]; + idx[3] = idx[1]; + } + + /* Calculate bilinear blending weights, attenuated according to the + * directional panning factor. + */ + blend[0] = (1.0f-emu) * (1.0f-amu[0]) * dirfact; + blend[1] = (1.0f-emu) * ( amu[0]) * dirfact; + blend[2] = ( emu) * (1.0f-amu[1]) * dirfact; + blend[3] = ( emu) * ( amu[1]) * dirfact; + + /* Calculate the blended HRIR delays. */ + delays[0] = float2int( + Hrtf->delays[idx[0]][0]*blend[0] + Hrtf->delays[idx[1]][0]*blend[1] + + Hrtf->delays[idx[2]][0]*blend[2] + Hrtf->delays[idx[3]][0]*blend[3] + 0.5f + ); + delays[1] = float2int( + Hrtf->delays[idx[0]][1]*blend[0] + Hrtf->delays[idx[1]][1]*blend[1] + + Hrtf->delays[idx[2]][1]*blend[2] + Hrtf->delays[idx[3]][1]*blend[3] + 0.5f + ); + + /* Calculate the sample offsets for the HRIR indices. */ + idx[0] *= Hrtf->irSize; + idx[1] *= Hrtf->irSize; + idx[2] *= Hrtf->irSize; + idx[3] *= Hrtf->irSize; + + ASSUME(Hrtf->irSize >= MIN_IR_SIZE && (Hrtf->irSize%MOD_IR_SIZE) == 0); + coeffs = ASSUME_ALIGNED(coeffs, 16); + /* Calculate the blended HRIR coefficients. */ + coeffs[0][0] = PassthruCoeff * (1.0f-dirfact); + coeffs[0][1] = PassthruCoeff * (1.0f-dirfact); + for(i = 1;i < Hrtf->irSize;i++) + { + coeffs[i][0] = 0.0f; + coeffs[i][1] = 0.0f; + } + for(c = 0;c < 4;c++) + { + const ALfloat (*restrict srccoeffs)[2] = ASSUME_ALIGNED(Hrtf->coeffs+idx[c], 16); for(i = 0;i < Hrtf->irSize;i++) { - coeffs[i][0] = 0.0f; - coeffs[i][1] = 0.0f; + coeffs[i][0] += srccoeffs[i][0] * blend[c]; + coeffs[i][1] += srccoeffs[i][1] * blend[c]; } } } -ALuint BuildBFormatHrtf(const struct Hrtf *Hrtf, ALfloat (*coeffs)[HRIR_LENGTH][2], ALuint NumChannels) +void BuildBFormatHrtf(const struct Hrtf *Hrtf, DirectHrtfState *state, ALsizei NumChannels, const struct AngularPoint *AmbiPoints, const ALfloat (*restrict AmbiMatrix)[MAX_AMBI_COEFFS], ALsizei AmbiCount, const ALfloat *restrict AmbiOrderHFGain) { - static const struct { - ALfloat elevation; - ALfloat azimuth; - } Ambi3DPoints[14] = { - { DEG2RAD( 90.0f), DEG2RAD( 0.0f) }, - { DEG2RAD( 35.0f), DEG2RAD( -45.0f) }, - { DEG2RAD( 35.0f), DEG2RAD( 45.0f) }, - { DEG2RAD( 35.0f), DEG2RAD( 135.0f) }, - { DEG2RAD( 35.0f), DEG2RAD(-135.0f) }, - { DEG2RAD( 0.0f), DEG2RAD( 0.0f) }, - { DEG2RAD( 0.0f), DEG2RAD( 90.0f) }, - { DEG2RAD( 0.0f), DEG2RAD( 180.0f) }, - { DEG2RAD( 0.0f), DEG2RAD( -90.0f) }, - { DEG2RAD(-35.0f), DEG2RAD( -45.0f) }, - { DEG2RAD(-35.0f), DEG2RAD( 45.0f) }, - { DEG2RAD(-35.0f), DEG2RAD( 135.0f) }, - { DEG2RAD(-35.0f), DEG2RAD(-135.0f) }, - { DEG2RAD(-90.0f), DEG2RAD( 0.0f) }, - }; - static const ALfloat Ambi3DMatrix[14][2][MAX_AMBI_COEFFS] = { - { { 0.078851598f, 0.000000000f, 0.070561967f, 0.000000000f }, { 0.0269973975f, 0.0000000000f, 0.0467610443f, 0.0000000000f } }, - { { 0.124051278f, 0.059847972f, 0.059847972f, 0.059847972f }, { 0.0269973975f, 0.0269973975f, 0.0269973975f, 0.0269973975f } }, - { { 0.124051278f, -0.059847972f, 0.059847972f, 0.059847972f }, { 0.0269973975f, -0.0269973975f, 0.0269973975f, 0.0269973975f } }, - { { 0.124051278f, -0.059847972f, 0.059847972f, -0.059847972f }, { 0.0269973975f, -0.0269973975f, 0.0269973975f, -0.0269973975f } }, - { { 0.124051278f, 0.059847972f, 0.059847972f, -0.059847972f }, { 0.0269973975f, 0.0269973975f, 0.0269973975f, -0.0269973975f } }, - { { 0.078851598f, 0.000000000f, 0.000000000f, 0.070561967f }, { 0.0269973975f, 0.0000000000f, 0.0000000000f, 0.0467610443f } }, - { { 0.078851598f, -0.070561967f, 0.000000000f, 0.000000000f }, { 0.0269973975f, -0.0467610443f, 0.0000000000f, 0.0000000000f } }, - { { 0.078851598f, 0.000000000f, 0.000000000f, -0.070561967f }, { 0.0269973975f, 0.0000000000f, 0.0000000000f, -0.0467610443f } }, - { { 0.078851598f, 0.070561967f, 0.000000000f, 0.000000000f }, { 0.0269973975f, 0.0467610443f, 0.0000000000f, 0.0000000000f } }, - { { 0.124051278f, 0.059847972f, -0.059847972f, 0.059847972f }, { 0.0269973975f, 0.0269973975f, -0.0269973975f, 0.0269973975f } }, - { { 0.124051278f, -0.059847972f, -0.059847972f, 0.059847972f }, { 0.0269973975f, -0.0269973975f, -0.0269973975f, 0.0269973975f } }, - { { 0.124051278f, -0.059847972f, -0.059847972f, -0.059847972f }, { 0.0269973975f, -0.0269973975f, -0.0269973975f, -0.0269973975f } }, - { { 0.124051278f, 0.059847972f, -0.059847972f, -0.059847972f }, { 0.0269973975f, 0.0269973975f, -0.0269973975f, -0.0269973975f } }, - { { 0.078851598f, 0.000000000f, -0.070561967f, 0.000000000f }, { 0.0269973975f, 0.0000000000f, -0.0467610443f, 0.0000000000f } }, - }; -/* Change this to 2 for dual-band HRTF processing. May require a higher quality +/* Set this to 2 for dual-band HRTF processing. May require a higher quality * band-splitter, or better calculation of the new IR length to deal with the * tail generated by the filter. */ #define NUM_BANDS 2 BandSplitter splitter; + ALdouble (*tmpres)[HRIR_LENGTH][2]; + ALsizei idx[HRTF_AMBI_MAX_CHANNELS]; + ALsizei min_delay = HRTF_HISTORY_LENGTH; ALfloat temps[3][HRIR_LENGTH]; - ALuint lidx[14], ridx[14]; - ALuint min_delay = HRTF_HISTORY_LENGTH; - ALuint max_length = 0; - ALuint i, j, c, b; + ALsizei max_length = 0; + ALsizei i, c, b; - assert(NumChannels == 4); - - for(c = 0;c < COUNTOF(Ambi3DPoints);c++) + for(c = 0;c < AmbiCount;c++) { ALuint evidx, azidx; ALuint evoffset; ALuint azcount; /* Calculate elevation index. */ - evidx = (ALuint)floorf((F_PI_2 + Ambi3DPoints[c].elevation) * - (Hrtf->evCount-1)/F_PI + 0.5f); - evidx = minu(evidx, Hrtf->evCount-1); + evidx = (ALsizei)((F_PI_2+AmbiPoints[c].Elev) * (Hrtf->evCount-1) / F_PI + 0.5f); + evidx = clampi(evidx, 0, Hrtf->evCount-1); azcount = Hrtf->azCount[evidx]; evoffset = Hrtf->evOffset[evidx]; /* Calculate azimuth index for this elevation. */ - azidx = (ALuint)floorf((F_TAU+Ambi3DPoints[c].azimuth) * - azcount/F_TAU + 0.5f) % azcount; + azidx = (ALsizei)((F_TAU+AmbiPoints[c].Azim) * azcount / F_TAU + 0.5f) % azcount; /* Calculate indices for left and right channels. */ - lidx[c] = evoffset + azidx; - ridx[c] = evoffset + ((azcount-azidx) % azcount); + idx[c] = evoffset + azidx; - min_delay = minu(min_delay, minu(Hrtf->delays[lidx[c]], Hrtf->delays[ridx[c]])); + min_delay = mini(min_delay, mini(Hrtf->delays[idx[c]][0], Hrtf->delays[idx[c]][1])); } + tmpres = al_calloc(16, NumChannels * sizeof(*tmpres)); + memset(temps, 0, sizeof(temps)); bandsplit_init(&splitter, 400.0f / (ALfloat)Hrtf->sampleRate); - for(c = 0;c < COUNTOF(Ambi3DMatrix);c++) + for(c = 0;c < AmbiCount;c++) { - const ALshort *fir; - ALuint delay; + const ALfloat (*fir)[2] = &Hrtf->coeffs[idx[c] * Hrtf->irSize]; + ALsizei ldelay = Hrtf->delays[idx[c]][0] - min_delay; + ALsizei rdelay = Hrtf->delays[idx[c]][1] - min_delay; - /* Convert the left FIR from shorts to float */ - fir = &Hrtf->coeffs[lidx[c] * Hrtf->irSize]; if(NUM_BANDS == 1) { - for(i = 0;i < Hrtf->irSize;i++) - temps[0][i] = fir[i] / 32767.0f; + max_length = maxi(max_length, + mini(maxi(ldelay, rdelay) + Hrtf->irSize, HRIR_LENGTH) + ); + + for(i = 0;i < NumChannels;++i) + { + ALdouble mult = (ALdouble)AmbiOrderHFGain[(ALsizei)sqrt(i)] * AmbiMatrix[c][i]; + ALsizei lidx = ldelay, ridx = rdelay; + ALsizei j = 0; + while(lidx < HRIR_LENGTH && ridx < HRIR_LENGTH && j < Hrtf->irSize) + { + tmpres[i][lidx++][0] += fir[j][0] * mult; + tmpres[i][ridx++][1] += fir[j][1] * mult; + j++; + } + } } else { + /* Increase the IR size by 2/3rds to account for the tail generated + * by the band-split filter. + */ + const ALsizei irsize = mini(Hrtf->irSize*5/3, HRIR_LENGTH); + + max_length = maxi(max_length, + mini(maxi(ldelay, rdelay) + irsize, HRIR_LENGTH) + ); + /* Band-split left HRIR into low and high frequency responses. */ bandsplit_clear(&splitter); for(i = 0;i < Hrtf->irSize;i++) - temps[2][i] = fir[i] / 32767.0f; + temps[2][i] = fir[i][0]; bandsplit_process(&splitter, temps[0], temps[1], temps[2], HRIR_LENGTH); - } - /* Add to the left output coefficients with the specified delay. */ - delay = Hrtf->delays[lidx[c]] - min_delay; - for(i = 0;i < NumChannels;++i) - { - for(b = 0;b < NUM_BANDS;b++) + /* Apply left ear response with delay. */ + for(i = 0;i < NumChannels;++i) { - ALuint k = 0; - for(j = delay;j < HRIR_LENGTH;++j) - coeffs[i][j][0] += temps[b][k++] * Ambi3DMatrix[c][b][i]; + ALfloat hfgain = AmbiOrderHFGain[(ALsizei)sqrt(i)]; + for(b = 0;b < NUM_BANDS;b++) + { + ALdouble mult = AmbiMatrix[c][i] * (ALdouble)((b==0) ? hfgain : 1.0); + ALsizei lidx = ldelay; + ALsizei j = 0; + while(lidx < HRIR_LENGTH) + tmpres[i][lidx++][0] += temps[b][j++] * mult; + } } - } - max_length = maxu(max_length, minu(delay + Hrtf->irSize, HRIR_LENGTH)); - /* Convert the right FIR from shorts to float */ - fir = &Hrtf->coeffs[ridx[c] * Hrtf->irSize]; - if(NUM_BANDS == 1) - { - for(i = 0;i < Hrtf->irSize;i++) - temps[0][i] = fir[i] / 32767.0f; - } - else - { /* Band-split right HRIR into low and high frequency responses. */ bandsplit_clear(&splitter); for(i = 0;i < Hrtf->irSize;i++) - temps[2][i] = fir[i] / 32767.0f; + temps[2][i] = fir[i][1]; bandsplit_process(&splitter, temps[0], temps[1], temps[2], HRIR_LENGTH); - } - /* Add to the right output coefficients with the specified delay. */ - delay = Hrtf->delays[ridx[c]] - min_delay; - for(i = 0;i < NumChannels;++i) - { - for(b = 0;b < NUM_BANDS;b++) + /* Apply right ear response with delay. */ + for(i = 0;i < NumChannels;++i) { - ALuint k = 0; - for(j = delay;j < HRIR_LENGTH;++j) - coeffs[i][j][1] += temps[b][k++] * Ambi3DMatrix[c][b][i]; + ALfloat hfgain = AmbiOrderHFGain[(ALsizei)sqrt(i)]; + for(b = 0;b < NUM_BANDS;b++) + { + ALdouble mult = AmbiMatrix[c][i] * (ALdouble)((b==0) ? hfgain : 1.0); + ALsizei ridx = rdelay; + ALsizei j = 0; + while(ridx < HRIR_LENGTH) + tmpres[i][ridx++][1] += temps[b][j++] * mult; + } } } - max_length = maxu(max_length, minu(delay + Hrtf->irSize, HRIR_LENGTH)); } - TRACE("Skipped min delay: %u, new combined length: %u\n", min_delay, max_length); -#undef NUM_BANDS + /* Round up to the next IR size multiple. */ + max_length += MOD_IR_SIZE-1; + max_length -= max_length%MOD_IR_SIZE; - return max_length; + for(i = 0;i < NumChannels;++i) + { + int idx; + for(idx = 0;idx < HRIR_LENGTH;idx++) + { + state->Chan[i].Coeffs[idx][0] = (ALfloat)tmpres[i][idx][0]; + state->Chan[i].Coeffs[idx][1] = (ALfloat)tmpres[i][idx][1]; + } + } + + al_free(tmpres); + tmpres = NULL; + + TRACE("Skipped delay: %d, new FIR length: %d\n", min_delay, max_length); + state->IrSize = max_length; +#undef NUM_BANDS } -static struct Hrtf *LoadHrtf00(const ALubyte *data, size_t datalen, const_al_string filename) +static struct Hrtf *CreateHrtfStore(ALuint rate, ALsizei irSize, + ALfloat distance, ALsizei evCount, ALsizei irCount, const ALubyte *azCount, + const ALushort *evOffset, const ALfloat (*coeffs)[2], const ALubyte (*delays)[2], + const char *filename) +{ + struct Hrtf *Hrtf; + size_t total; + + total = sizeof(struct Hrtf); + total += sizeof(Hrtf->azCount[0])*evCount; + total = RoundUp(total, sizeof(ALushort)); /* Align for ushort fields */ + total += sizeof(Hrtf->evOffset[0])*evCount; + total = RoundUp(total, 16); /* Align for coefficients using SIMD */ + total += sizeof(Hrtf->coeffs[0])*irSize*irCount; + total += sizeof(Hrtf->delays[0])*irCount; + + Hrtf = al_calloc(16, total); + if(Hrtf == NULL) + ERR("Out of memory allocating storage for %s.\n", filename); + else + { + uintptr_t offset = sizeof(struct Hrtf); + char *base = (char*)Hrtf; + ALushort *_evOffset; + ALubyte *_azCount; + ALubyte (*_delays)[2]; + ALfloat (*_coeffs)[2]; + ALsizei i; + + InitRef(&Hrtf->ref, 0); + Hrtf->sampleRate = rate; + Hrtf->irSize = irSize; + Hrtf->distance = distance; + Hrtf->evCount = evCount; + + /* Set up pointers to storage following the main HRTF struct. */ + _azCount = (ALubyte*)(base + offset); + offset += sizeof(_azCount[0])*evCount; + + offset = RoundUp(offset, sizeof(ALushort)); /* Align for ushort fields */ + _evOffset = (ALushort*)(base + offset); + offset += sizeof(_evOffset[0])*evCount; + + offset = RoundUp(offset, 16); /* Align for coefficients using SIMD */ + _coeffs = (ALfloat(*)[2])(base + offset); + offset += sizeof(_coeffs[0])*irSize*irCount; + + _delays = (ALubyte(*)[2])(base + offset); + offset += sizeof(_delays[0])*irCount; + + assert(offset == total); + + /* Copy input data to storage. */ + for(i = 0;i < evCount;i++) _azCount[i] = azCount[i]; + for(i = 0;i < evCount;i++) _evOffset[i] = evOffset[i]; + for(i = 0;i < irSize*irCount;i++) + { + _coeffs[i][0] = coeffs[i][0]; + _coeffs[i][1] = coeffs[i][1]; + } + for(i = 0;i < irCount;i++) + { + _delays[i][0] = delays[i][0]; + _delays[i][1] = delays[i][1]; + } + + /* Finally, assign the storage pointers. */ + Hrtf->azCount = _azCount; + Hrtf->evOffset = _evOffset; + Hrtf->coeffs = _coeffs; + Hrtf->delays = _delays; + } + + return Hrtf; +} + +static ALubyte GetLE_ALubyte(const ALubyte **data, size_t *len) +{ + ALubyte ret = (*data)[0]; + *data += 1; *len -= 1; + return ret; +} + +static ALshort GetLE_ALshort(const ALubyte **data, size_t *len) +{ + ALshort ret = (*data)[0] | ((*data)[1]<<8); + *data += 2; *len -= 2; + return ret; +} + +static ALushort GetLE_ALushort(const ALubyte **data, size_t *len) +{ + ALushort ret = (*data)[0] | ((*data)[1]<<8); + *data += 2; *len -= 2; + return ret; +} + +static ALint GetLE_ALint24(const ALubyte **data, size_t *len) +{ + ALint ret = (*data)[0] | ((*data)[1]<<8) | ((*data)[2]<<16); + *data += 3; *len -= 3; + return (ret^0x800000) - 0x800000; +} + +static ALuint GetLE_ALuint(const ALubyte **data, size_t *len) +{ + ALuint ret = (*data)[0] | ((*data)[1]<<8) | ((*data)[2]<<16) | ((*data)[3]<<24); + *data += 4; *len -= 4; + return ret; +} + +static const ALubyte *Get_ALubytePtr(const ALubyte **data, size_t *len, size_t size) +{ + const ALubyte *ret = *data; + *data += size; *len -= size; + return ret; +} + +static struct Hrtf *LoadHrtf00(const ALubyte *data, size_t datalen, const char *filename) { - const ALubyte maxDelay = HRTF_HISTORY_LENGTH-1; struct Hrtf *Hrtf = NULL; ALboolean failed = AL_FALSE; - ALuint rate = 0, irCount = 0; + ALuint rate = 0; + ALushort irCount = 0; ALushort irSize = 0; ALubyte evCount = 0; ALubyte *azCount = NULL; ALushort *evOffset = NULL; - ALshort *coeffs = NULL; - const ALubyte *delays = NULL; - ALuint i, j; + ALfloat (*coeffs)[2] = NULL; + ALubyte (*delays)[2] = NULL; + ALsizei i, j; if(datalen < 9) { - ERR("Unexpected end of %s data (req %d, rem "SZFMT")\n", - al_string_get_cstr(filename), 9, datalen); + ERR("Unexpected end of %s data (req %d, rem "SZFMT")\n", filename, 9, datalen); return NULL; } - rate = *(data++); - rate |= *(data++)<<8; - rate |= *(data++)<<16; - rate |= *(data++)<<24; - datalen -= 4; + rate = GetLE_ALuint(&data, &datalen); - irCount = *(data++); - irCount |= *(data++)<<8; - datalen -= 2; + irCount = GetLE_ALushort(&data, &datalen); - irSize = *(data++); - irSize |= *(data++)<<8; - datalen -= 2; + irSize = GetLE_ALushort(&data, &datalen); - evCount = *(data++); - datalen -= 1; + evCount = GetLE_ALubyte(&data, &datalen); if(irSize < MIN_IR_SIZE || irSize > MAX_IR_SIZE || (irSize%MOD_IR_SIZE)) { @@ -337,10 +495,9 @@ static struct Hrtf *LoadHrtf00(const ALubyte *data, size_t datalen, const_al_str if(failed) return NULL; - if(datalen < evCount*2) + if(datalen < evCount*2u) { - ERR("Unexpected end of %s data (req %d, rem "SZFMT")\n", - al_string_get_cstr(filename), evCount*2, datalen); + ERR("Unexpected end of %s data (req %d, rem "SZFMT")\n", filename, evCount*2, datalen); return NULL; } @@ -354,14 +511,10 @@ static struct Hrtf *LoadHrtf00(const ALubyte *data, size_t datalen, const_al_str if(!failed) { - evOffset[0] = *(data++); - evOffset[0] |= *(data++)<<8; - datalen -= 2; + evOffset[0] = GetLE_ALushort(&data, &datalen); for(i = 1;i < evCount;i++) { - evOffset[i] = *(data++); - evOffset[i] |= *(data++)<<8; - datalen -= 2; + evOffset[i] = GetLE_ALushort(&data, &datalen); if(evOffset[i] <= evOffset[i-1]) { ERR("Invalid evOffset: evOffset[%d]=%d (last=%d)\n", @@ -396,7 +549,8 @@ static struct Hrtf *LoadHrtf00(const ALubyte *data, size_t datalen, const_al_str if(!failed) { coeffs = malloc(sizeof(coeffs[0])*irSize*irCount); - if(coeffs == NULL) + delays = malloc(sizeof(delays[0])*irCount); + if(coeffs == NULL || delays == NULL) { ERR("Out of memory.\n"); failed = AL_TRUE; @@ -409,31 +563,25 @@ static struct Hrtf *LoadHrtf00(const ALubyte *data, size_t datalen, const_al_str if(datalen < reqsize) { ERR("Unexpected end of %s data (req "SZFMT", rem "SZFMT")\n", - al_string_get_cstr(filename), reqsize, datalen); + filename, reqsize, datalen); failed = AL_TRUE; } } if(!failed) { - for(i = 0;i < irCount*irSize;i+=irSize) - { - for(j = 0;j < irSize;j++) - { - coeffs[i+j] = *(data++); - coeffs[i+j] |= *(data++)<<8; - datalen -= 2; - } - } - - delays = data; - data += irCount; - datalen -= irCount; for(i = 0;i < irCount;i++) { - if(delays[i] > maxDelay) + for(j = 0;j < irSize;j++) + coeffs[i*irSize + j][0] = GetLE_ALshort(&data, &datalen) / 32768.0f; + } + + for(i = 0;i < irCount;i++) + { + delays[i][0] = GetLE_ALubyte(&data, &datalen); + if(delays[i][0] > MAX_HRIR_DELAY) { - ERR("Invalid delays[%d]: %d (%d)\n", i, delays[i], maxDelay); + ERR("Invalid delays[%d]: %d (%d)\n", i, delays[i][0], MAX_HRIR_DELAY); failed = AL_TRUE; } } @@ -441,82 +589,59 @@ static struct Hrtf *LoadHrtf00(const ALubyte *data, size_t datalen, const_al_str if(!failed) { - size_t total = sizeof(struct Hrtf); - total += sizeof(azCount[0])*evCount; - total = (total+1)&~1; /* Align for (u)short fields */ - total += sizeof(evOffset[0])*evCount; - total += sizeof(coeffs[0])*irSize*irCount; - total += sizeof(delays[0])*irCount; - total += al_string_length(filename)+1; - - Hrtf = al_calloc(16, total); - if(Hrtf == NULL) + /* Mirror the left ear responses to the right ear. */ + for(i = 0;i < evCount;i++) { - ERR("Out of memory.\n"); - failed = AL_TRUE; + ALushort evoffset = evOffset[i]; + ALubyte azcount = azCount[i]; + for(j = 0;j < azcount;j++) + { + ALsizei lidx = evoffset + j; + ALsizei ridx = evoffset + ((azcount-j) % azcount); + ALsizei k; + + for(k = 0;k < irSize;k++) + coeffs[ridx*irSize + k][1] = coeffs[lidx*irSize + k][0]; + delays[ridx][1] = delays[lidx][0]; + } } - } - if(!failed) - { - char *base = (char*)Hrtf; - uintptr_t offset = sizeof(*Hrtf); - - Hrtf->sampleRate = rate; - Hrtf->irSize = irSize; - Hrtf->evCount = evCount; - Hrtf->azCount = ((ALubyte*)(base + offset)); offset += evCount*sizeof(Hrtf->azCount[0]); - offset = (offset+1)&~1; /* Align for (u)short fields */ - Hrtf->evOffset = ((ALushort*)(base + offset)); offset += evCount*sizeof(Hrtf->evOffset[0]); - Hrtf->coeffs = ((ALshort*)(base + offset)); offset += irSize*irCount*sizeof(Hrtf->coeffs[0]); - Hrtf->delays = ((ALubyte*)(base + offset)); offset += irCount*sizeof(Hrtf->delays[0]); - Hrtf->filename = ((char*)(base + offset)); - Hrtf->next = NULL; - - memcpy((void*)Hrtf->azCount, azCount, sizeof(azCount[0])*evCount); - memcpy((void*)Hrtf->evOffset, evOffset, sizeof(evOffset[0])*evCount); - memcpy((void*)Hrtf->coeffs, coeffs, sizeof(coeffs[0])*irSize*irCount); - memcpy((void*)Hrtf->delays, delays, sizeof(delays[0])*irCount); - memcpy((void*)Hrtf->filename, al_string_get_cstr(filename), al_string_length(filename)+1); + Hrtf = CreateHrtfStore(rate, irSize, 0.0f, evCount, irCount, azCount, + evOffset, coeffs, delays, filename); } free(azCount); free(evOffset); free(coeffs); + free(delays); return Hrtf; } -static struct Hrtf *LoadHrtf01(const ALubyte *data, size_t datalen, const_al_string filename) +static struct Hrtf *LoadHrtf01(const ALubyte *data, size_t datalen, const char *filename) { - const ALubyte maxDelay = HRTF_HISTORY_LENGTH-1; struct Hrtf *Hrtf = NULL; ALboolean failed = AL_FALSE; - ALuint rate = 0, irCount = 0; - ALubyte irSize = 0, evCount = 0; + ALuint rate = 0; + ALushort irCount = 0; + ALushort irSize = 0; + ALubyte evCount = 0; const ALubyte *azCount = NULL; ALushort *evOffset = NULL; - ALshort *coeffs = NULL; - const ALubyte *delays = NULL; - ALuint i, j; + ALfloat (*coeffs)[2] = NULL; + ALubyte (*delays)[2] = NULL; + ALsizei i, j; if(datalen < 6) { - ERR("Unexpected end of %s data (req %d, rem "SZFMT"\n", - al_string_get_cstr(filename), 6, datalen); + ERR("Unexpected end of %s data (req %d, rem "SZFMT"\n", filename, 6, datalen); return NULL; } - rate = *(data++); - rate |= *(data++)<<8; - rate |= *(data++)<<16; - rate |= *(data++)<<24; - datalen -= 4; + rate = GetLE_ALuint(&data, &datalen); - irSize = *(data++); - datalen -= 1; + irSize = GetLE_ALubyte(&data, &datalen); - evCount = *(data++); - datalen -= 1; + evCount = GetLE_ALubyte(&data, &datalen); if(irSize < MIN_IR_SIZE || irSize > MAX_IR_SIZE || (irSize%MOD_IR_SIZE)) { @@ -535,14 +660,11 @@ static struct Hrtf *LoadHrtf01(const ALubyte *data, size_t datalen, const_al_str if(datalen < evCount) { - ERR("Unexpected end of %s data (req %d, rem "SZFMT"\n", - al_string_get_cstr(filename), evCount, datalen); + ERR("Unexpected end of %s data (req %d, rem "SZFMT"\n", filename, evCount, datalen); return NULL; } - azCount = data; - data += evCount; - datalen -= evCount; + azCount = Get_ALubytePtr(&data, &datalen, evCount); evOffset = malloc(sizeof(evOffset[0])*evCount); if(azCount == NULL || evOffset == NULL) @@ -575,7 +697,8 @@ static struct Hrtf *LoadHrtf01(const ALubyte *data, size_t datalen, const_al_str } coeffs = malloc(sizeof(coeffs[0])*irSize*irCount); - if(coeffs == NULL) + delays = malloc(sizeof(delays[0])*irCount); + if(coeffs == NULL || delays == NULL) { ERR("Out of memory.\n"); failed = AL_TRUE; @@ -588,33 +711,25 @@ static struct Hrtf *LoadHrtf01(const ALubyte *data, size_t datalen, const_al_str if(datalen < reqsize) { ERR("Unexpected end of %s data (req "SZFMT", rem "SZFMT"\n", - al_string_get_cstr(filename), reqsize, datalen); + filename, reqsize, datalen); failed = AL_TRUE; } } if(!failed) { - for(i = 0;i < irCount*irSize;i+=irSize) - { - for(j = 0;j < irSize;j++) - { - ALshort coeff; - coeff = *(data++); - coeff |= *(data++)<<8; - datalen -= 2; - coeffs[i+j] = coeff; - } - } - - delays = data; - data += irCount; - datalen -= irCount; for(i = 0;i < irCount;i++) { - if(delays[i] > maxDelay) + for(j = 0;j < irSize;j++) + coeffs[i*irSize + j][0] = GetLE_ALshort(&data, &datalen) / 32768.0f; + } + + for(i = 0;i < irCount;i++) + { + delays[i][0] = GetLE_ALubyte(&data, &datalen); + if(delays[i][0] > MAX_HRIR_DELAY) { - ERR("Invalid delays[%d]: %d (%d)\n", i, delays[i], maxDelay); + ERR("Invalid delays[%d]: %d (%d)\n", i, delays[i][0], MAX_HRIR_DELAY); failed = AL_TRUE; } } @@ -622,16 +737,163 @@ static struct Hrtf *LoadHrtf01(const ALubyte *data, size_t datalen, const_al_str if(!failed) { - size_t total = sizeof(struct Hrtf); - total += sizeof(azCount[0])*evCount; - total = (total+1)&~1; /* Align for (u)short fields */ - total += sizeof(evOffset[0])*evCount; - total += sizeof(coeffs[0])*irSize*irCount; - total += sizeof(delays[0])*irCount; - total += al_string_length(filename)+1; + /* Mirror the left ear responses to the right ear. */ + for(i = 0;i < evCount;i++) + { + ALushort evoffset = evOffset[i]; + ALubyte azcount = azCount[i]; + for(j = 0;j < azcount;j++) + { + ALsizei lidx = evoffset + j; + ALsizei ridx = evoffset + ((azcount-j) % azcount); + ALsizei k; - Hrtf = al_calloc(16, total); - if(Hrtf == NULL) + for(k = 0;k < irSize;k++) + coeffs[ridx*irSize + k][1] = coeffs[lidx*irSize + k][0]; + delays[ridx][1] = delays[lidx][0]; + } + } + + Hrtf = CreateHrtfStore(rate, irSize, 0.0f, evCount, irCount, azCount, + evOffset, coeffs, delays, filename); + } + + free(evOffset); + free(coeffs); + free(delays); + return Hrtf; +} + +#define SAMPLETYPE_S16 0 +#define SAMPLETYPE_S24 1 + +#define CHANTYPE_LEFTONLY 0 +#define CHANTYPE_LEFTRIGHT 1 + +static struct Hrtf *LoadHrtf02(const ALubyte *data, size_t datalen, const char *filename) +{ + struct Hrtf *Hrtf = NULL; + ALboolean failed = AL_FALSE; + ALuint rate = 0; + ALubyte sampleType; + ALubyte channelType; + ALushort irCount = 0; + ALushort irSize = 0; + ALubyte fdCount = 0; + ALushort distance = 0; + ALubyte evCount = 0; + const ALubyte *azCount = NULL; + ALushort *evOffset = NULL; + ALfloat (*coeffs)[2] = NULL; + ALubyte (*delays)[2] = NULL; + ALsizei i, j; + + if(datalen < 8) + { + ERR("Unexpected end of %s data (req %d, rem "SZFMT"\n", filename, 8, datalen); + return NULL; + } + + rate = GetLE_ALuint(&data, &datalen); + sampleType = GetLE_ALubyte(&data, &datalen); + channelType = GetLE_ALubyte(&data, &datalen); + + irSize = GetLE_ALubyte(&data, &datalen); + + fdCount = GetLE_ALubyte(&data, &datalen); + + if(sampleType > SAMPLETYPE_S24) + { + ERR("Unsupported sample type: %d\n", sampleType); + failed = AL_TRUE; + } + if(channelType > CHANTYPE_LEFTRIGHT) + { + ERR("Unsupported channel type: %d\n", channelType); + failed = AL_TRUE; + } + + if(irSize < MIN_IR_SIZE || irSize > MAX_IR_SIZE || (irSize%MOD_IR_SIZE)) + { + ERR("Unsupported HRIR size: irSize=%d (%d to %d by %d)\n", + irSize, MIN_IR_SIZE, MAX_IR_SIZE, MOD_IR_SIZE); + failed = AL_TRUE; + } + if(fdCount != 1) + { + ERR("Multiple field-depths not supported: fdCount=%d (%d to %d)\n", + evCount, MIN_FD_COUNT, MAX_FD_COUNT); + failed = AL_TRUE; + } + if(failed) + return NULL; + + for(i = 0;i < fdCount;i++) + { + if(datalen < 3) + { + ERR("Unexpected end of %s data (req %d, rem "SZFMT"\n", filename, 3, datalen); + return NULL; + } + + distance = GetLE_ALushort(&data, &datalen); + if(distance < MIN_FD_DISTANCE || distance > MAX_FD_DISTANCE) + { + ERR("Unsupported field distance: distance=%d (%dmm to %dmm)\n", + distance, MIN_FD_DISTANCE, MAX_FD_DISTANCE); + failed = AL_TRUE; + } + + evCount = GetLE_ALubyte(&data, &datalen); + if(evCount < MIN_EV_COUNT || evCount > MAX_EV_COUNT) + { + ERR("Unsupported elevation count: evCount=%d (%d to %d)\n", + evCount, MIN_EV_COUNT, MAX_EV_COUNT); + failed = AL_TRUE; + } + if(failed) + return NULL; + + if(datalen < evCount) + { + ERR("Unexpected end of %s data (req %d, rem "SZFMT"\n", filename, evCount, datalen); + return NULL; + } + + azCount = Get_ALubytePtr(&data, &datalen, evCount); + for(j = 0;j < evCount;j++) + { + if(azCount[j] < MIN_AZ_COUNT || azCount[j] > MAX_AZ_COUNT) + { + ERR("Unsupported azimuth count: azCount[%d]=%d (%d to %d)\n", + j, azCount[j], MIN_AZ_COUNT, MAX_AZ_COUNT); + failed = AL_TRUE; + } + } + } + if(failed) + return NULL; + + evOffset = malloc(sizeof(evOffset[0])*evCount); + if(azCount == NULL || evOffset == NULL) + { + ERR("Out of memory.\n"); + failed = AL_TRUE; + } + + if(!failed) + { + evOffset[0] = 0; + irCount = azCount[0]; + for(i = 1;i < evCount;i++) + { + evOffset[i] = evOffset[i-1] + azCount[i-1]; + irCount += azCount[i]; + } + + coeffs = malloc(sizeof(coeffs[0])*irSize*irCount); + delays = malloc(sizeof(delays[0])*irCount); + if(coeffs == NULL || delays == NULL) { ERR("Out of memory.\n"); failed = AL_TRUE; @@ -640,108 +902,164 @@ static struct Hrtf *LoadHrtf01(const ALubyte *data, size_t datalen, const_al_str if(!failed) { - char *base = (char*)Hrtf; - uintptr_t offset = sizeof(*Hrtf); + size_t reqsize = 2*irSize*irCount + irCount; + if(datalen < reqsize) + { + ERR("Unexpected end of %s data (req "SZFMT", rem "SZFMT"\n", + filename, reqsize, datalen); + failed = AL_TRUE; + } + } - Hrtf->sampleRate = rate; - Hrtf->irSize = irSize; - Hrtf->evCount = evCount; - Hrtf->azCount = ((ALubyte*)(base + offset)); offset += evCount*sizeof(Hrtf->azCount[0]); - offset = (offset+1)&~1; /* Align for (u)short fields */ - Hrtf->evOffset = ((ALushort*)(base + offset)); offset += evCount*sizeof(Hrtf->evOffset[0]); - Hrtf->coeffs = ((ALshort*)(base + offset)); offset += irSize*irCount*sizeof(Hrtf->coeffs[0]); - Hrtf->delays = ((ALubyte*)(base + offset)); offset += irCount*sizeof(Hrtf->delays[0]); - Hrtf->filename = ((char*)(base + offset)); - Hrtf->next = NULL; + if(!failed) + { + if(channelType == CHANTYPE_LEFTONLY) + { + if(sampleType == SAMPLETYPE_S16) + for(i = 0;i < irCount;i++) + { + for(j = 0;j < irSize;j++) + coeffs[i*irSize + j][0] = GetLE_ALshort(&data, &datalen) / 32768.0f; + } + else if(sampleType == SAMPLETYPE_S24) + for(i = 0;i < irCount;i++) + { + for(j = 0;j < irSize;j++) + coeffs[i*irSize + j][0] = GetLE_ALint24(&data, &datalen) / 8388608.0f; + } - memcpy((void*)Hrtf->azCount, azCount, sizeof(azCount[0])*evCount); - memcpy((void*)Hrtf->evOffset, evOffset, sizeof(evOffset[0])*evCount); - memcpy((void*)Hrtf->coeffs, coeffs, sizeof(coeffs[0])*irSize*irCount); - memcpy((void*)Hrtf->delays, delays, sizeof(delays[0])*irCount); - memcpy((void*)Hrtf->filename, al_string_get_cstr(filename), al_string_length(filename)+1); + for(i = 0;i < irCount;i++) + { + delays[i][0] = GetLE_ALubyte(&data, &datalen); + if(delays[i][0] > MAX_HRIR_DELAY) + { + ERR("Invalid delays[%d][0]: %d (%d)\n", i, delays[i][0], MAX_HRIR_DELAY); + failed = AL_TRUE; + } + } + } + else if(channelType == CHANTYPE_LEFTRIGHT) + { + if(sampleType == SAMPLETYPE_S16) + for(i = 0;i < irCount;i++) + { + for(j = 0;j < irSize;j++) + { + coeffs[i*irSize + j][0] = GetLE_ALshort(&data, &datalen) / 32768.0f; + coeffs[i*irSize + j][1] = GetLE_ALshort(&data, &datalen) / 32768.0f; + } + } + else if(sampleType == SAMPLETYPE_S24) + for(i = 0;i < irCount;i++) + { + for(j = 0;j < irSize;j++) + { + coeffs[i*irSize + j][0] = GetLE_ALint24(&data, &datalen) / 8388608.0f; + coeffs[i*irSize + j][1] = GetLE_ALint24(&data, &datalen) / 8388608.0f; + } + } + + for(i = 0;i < irCount;i++) + { + delays[i][0] = GetLE_ALubyte(&data, &datalen); + if(delays[i][0] > MAX_HRIR_DELAY) + { + ERR("Invalid delays[%d][0]: %d (%d)\n", i, delays[i][0], MAX_HRIR_DELAY); + failed = AL_TRUE; + } + delays[i][1] = GetLE_ALubyte(&data, &datalen); + if(delays[i][1] > MAX_HRIR_DELAY) + { + ERR("Invalid delays[%d][1]: %d (%d)\n", i, delays[i][1], MAX_HRIR_DELAY); + failed = AL_TRUE; + } + } + } + } + + if(!failed) + { + if(channelType == CHANTYPE_LEFTONLY) + { + /* Mirror the left ear responses to the right ear. */ + for(i = 0;i < evCount;i++) + { + ALushort evoffset = evOffset[i]; + ALubyte azcount = azCount[i]; + for(j = 0;j < azcount;j++) + { + ALsizei lidx = evoffset + j; + ALsizei ridx = evoffset + ((azcount-j) % azcount); + ALsizei k; + + for(k = 0;k < irSize;k++) + coeffs[ridx*irSize + k][1] = coeffs[lidx*irSize + k][0]; + delays[ridx][1] = delays[lidx][0]; + } + } + } + + Hrtf = CreateHrtfStore(rate, irSize, + (ALfloat)distance / 1000.0f, evCount, irCount, azCount, evOffset, + coeffs, delays, filename + ); } free(evOffset); free(coeffs); + free(delays); return Hrtf; } -static void AddFileEntry(vector_HrtfEntry *list, al_string *filename) + +static void AddFileEntry(vector_EnumeratedHrtf *list, const_al_string filename) { - HrtfEntry entry = { AL_STRING_INIT_STATIC(), NULL }; - struct Hrtf *hrtf = NULL; - const HrtfEntry *iter; - struct FileMapping fmap; + EnumeratedHrtf entry = { AL_STRING_INIT_STATIC(), NULL }; + struct HrtfEntry *loaded_entry; + const EnumeratedHrtf *iter; const char *name; const char *ext; int i; -#define MATCH_FNAME(i) (al_string_cmp_cstr(*filename, (i)->hrtf->filename) == 0) - VECTOR_FIND_IF(iter, const HrtfEntry, *list, MATCH_FNAME); - if(iter != VECTOR_END(*list)) + /* Check if this file has already been loaded globally. */ + loaded_entry = LoadedHrtfs; + while(loaded_entry) { - TRACE("Skipping duplicate file entry %s\n", al_string_get_cstr(*filename)); - goto done; - } + if(alstr_cmp_cstr(filename, loaded_entry->filename) == 0) + { + /* Check if this entry has already been added to the list. */ +#define MATCH_ENTRY(i) (loaded_entry == (i)->hrtf) + VECTOR_FIND_IF(iter, const EnumeratedHrtf, *list, MATCH_ENTRY); + if(iter != VECTOR_END(*list)) + { + TRACE("Skipping duplicate file entry %s\n", alstr_get_cstr(filename)); + return; + } #undef MATCH_FNAME - entry.hrtf = LoadedHrtfs; - while(entry.hrtf) - { - if(al_string_cmp_cstr(*filename, entry.hrtf->filename) == 0) - { - TRACE("Skipping load of already-loaded file %s\n", al_string_get_cstr(*filename)); - goto skip_load; + break; } - entry.hrtf = entry.hrtf->next; + loaded_entry = loaded_entry->next; } - TRACE("Loading %s...\n", al_string_get_cstr(*filename)); - fmap = MapFileToMem(al_string_get_cstr(*filename)); - if(fmap.ptr == NULL) + if(!loaded_entry) { - ERR("Could not open %s\n", al_string_get_cstr(*filename)); - goto done; - } + TRACE("Got new file \"%s\"\n", alstr_get_cstr(filename)); - if(fmap.len < sizeof(magicMarker01)) - ERR("%s data is too short ("SZFMT" bytes)\n", al_string_get_cstr(*filename), fmap.len); - else if(memcmp(fmap.ptr, magicMarker01, sizeof(magicMarker01)) == 0) - { - TRACE("Detected data set format v1\n"); - hrtf = LoadHrtf01((const ALubyte*)fmap.ptr+sizeof(magicMarker01), - fmap.len-sizeof(magicMarker01), *filename + loaded_entry = al_calloc(DEF_ALIGN, + FAM_SIZE(struct HrtfEntry, filename, alstr_length(filename)+1) ); - } - else if(memcmp(fmap.ptr, magicMarker00, sizeof(magicMarker00)) == 0) - { - TRACE("Detected data set format v0\n"); - hrtf = LoadHrtf00((const ALubyte*)fmap.ptr+sizeof(magicMarker00), - fmap.len-sizeof(magicMarker00), *filename - ); - } - else - ERR("Invalid header in %s: \"%.8s\"\n", al_string_get_cstr(*filename), (const char*)fmap.ptr); - UnmapFileMem(&fmap); - - if(!hrtf) - { - ERR("Failed to load %s\n", al_string_get_cstr(*filename)); - goto done; + loaded_entry->next = LoadedHrtfs; + loaded_entry->handle = NULL; + strcpy(loaded_entry->filename, alstr_get_cstr(filename)); + LoadedHrtfs = loaded_entry; } - hrtf->next = LoadedHrtfs; - LoadedHrtfs = hrtf; - TRACE("Loaded HRTF support for format: %s %uhz\n", - DevFmtChannelsString(DevFmtStereo), hrtf->sampleRate); - entry.hrtf = hrtf; - -skip_load: /* TODO: Get a human-readable name from the HRTF data (possibly coming in a * format update). */ - name = strrchr(al_string_get_cstr(*filename), '/'); - if(!name) name = strrchr(al_string_get_cstr(*filename), '\\'); - if(!name) name = al_string_get_cstr(*filename); + name = strrchr(alstr_get_cstr(filename), '/'); + if(!name) name = strrchr(alstr_get_cstr(filename), '\\'); + if(!name) name = alstr_get_cstr(filename); else ++name; ext = strrchr(name, '.'); @@ -749,124 +1067,114 @@ skip_load: i = 0; do { if(!ext) - al_string_copy_cstr(&entry.name, name); + alstr_copy_cstr(&entry.name, name); else - al_string_copy_range(&entry.name, name, ext); + alstr_copy_range(&entry.name, name, ext); if(i != 0) { char str[64]; snprintf(str, sizeof(str), " #%d", i+1); - al_string_append_cstr(&entry.name, str); + alstr_append_cstr(&entry.name, str); } ++i; -#define MATCH_NAME(i) (al_string_cmp(entry.name, (i)->name) == 0) - VECTOR_FIND_IF(iter, const HrtfEntry, *list, MATCH_NAME); +#define MATCH_NAME(i) (alstr_cmp(entry.name, (i)->name) == 0) + VECTOR_FIND_IF(iter, const EnumeratedHrtf, *list, MATCH_NAME); #undef MATCH_NAME } while(iter != VECTOR_END(*list)); + entry.hrtf = loaded_entry; - TRACE("Adding entry \"%s\" from file \"%s\"\n", al_string_get_cstr(entry.name), - al_string_get_cstr(*filename)); + TRACE("Adding entry \"%s\" from file \"%s\"\n", alstr_get_cstr(entry.name), + alstr_get_cstr(filename)); VECTOR_PUSH_BACK(*list, entry); - -done: - al_string_deinit(filename); } /* Unfortunate that we have to duplicate AddFileEntry to take a memory buffer * for input instead of opening the given filename. */ -static void AddBuiltInEntry(vector_HrtfEntry *list, const ALubyte *data, size_t datalen, al_string *filename) +static void AddBuiltInEntry(vector_EnumeratedHrtf *list, const_al_string filename, ALuint residx) { - HrtfEntry entry = { AL_STRING_INIT_STATIC(), NULL }; + EnumeratedHrtf entry = { AL_STRING_INIT_STATIC(), NULL }; + struct HrtfEntry *loaded_entry; struct Hrtf *hrtf = NULL; - const HrtfEntry *iter; + const EnumeratedHrtf *iter; + const char *name; + const char *ext; int i; -#define MATCH_FNAME(i) (al_string_cmp_cstr(*filename, (i)->hrtf->filename) == 0) - VECTOR_FIND_IF(iter, const HrtfEntry, *list, MATCH_FNAME); - if(iter != VECTOR_END(*list)) + loaded_entry = LoadedHrtfs; + while(loaded_entry) { - TRACE("Skipping duplicate file entry %s\n", al_string_get_cstr(*filename)); - goto done; - } + if(alstr_cmp_cstr(filename, loaded_entry->filename) == 0) + { +#define MATCH_ENTRY(i) (loaded_entry == (i)->hrtf) + VECTOR_FIND_IF(iter, const EnumeratedHrtf, *list, MATCH_ENTRY); + if(iter != VECTOR_END(*list)) + { + TRACE("Skipping duplicate file entry %s\n", alstr_get_cstr(filename)); + return; + } #undef MATCH_FNAME - entry.hrtf = LoadedHrtfs; - while(entry.hrtf) - { - if(al_string_cmp_cstr(*filename, entry.hrtf->filename) == 0) - { - TRACE("Skipping load of already-loaded file %s\n", al_string_get_cstr(*filename)); - goto skip_load; + break; } - entry.hrtf = entry.hrtf->next; + loaded_entry = loaded_entry->next; } - TRACE("Loading %s...\n", al_string_get_cstr(*filename)); - if(datalen < sizeof(magicMarker01)) + if(!loaded_entry) { - ERR("%s data is too short ("SZFMT" bytes)\n", al_string_get_cstr(*filename), datalen); - goto done; - } + size_t namelen = alstr_length(filename)+32; - if(memcmp(data, magicMarker01, sizeof(magicMarker01)) == 0) - { - TRACE("Detected data set format v1\n"); - hrtf = LoadHrtf01(data+sizeof(magicMarker01), - datalen-sizeof(magicMarker01), *filename + TRACE("Got new file \"%s\"\n", alstr_get_cstr(filename)); + + loaded_entry = al_calloc(DEF_ALIGN, + FAM_SIZE(struct HrtfEntry, filename, namelen) ); - } - else if(memcmp(data, magicMarker00, sizeof(magicMarker00)) == 0) - { - TRACE("Detected data set format v0\n"); - hrtf = LoadHrtf00(data+sizeof(magicMarker00), - datalen-sizeof(magicMarker00), *filename - ); - } - else - ERR("Invalid header in %s: \"%.8s\"\n", al_string_get_cstr(*filename), data); - - if(!hrtf) - { - ERR("Failed to load %s\n", al_string_get_cstr(*filename)); - goto done; + loaded_entry->next = LoadedHrtfs; + loaded_entry->handle = hrtf; + snprintf(loaded_entry->filename, namelen, "!%u_%s", + residx, alstr_get_cstr(filename)); + LoadedHrtfs = loaded_entry; } - hrtf->next = LoadedHrtfs; - LoadedHrtfs = hrtf; - TRACE("Loaded HRTF support for format: %s %uhz\n", - DevFmtChannelsString(DevFmtStereo), hrtf->sampleRate); - entry.hrtf = hrtf; + /* TODO: Get a human-readable name from the HRTF data (possibly coming in a + * format update). */ + name = strrchr(alstr_get_cstr(filename), '/'); + if(!name) name = strrchr(alstr_get_cstr(filename), '\\'); + if(!name) name = alstr_get_cstr(filename); + else ++name; + + ext = strrchr(name, '.'); -skip_load: i = 0; do { - al_string_copy(&entry.name, *filename); + if(!ext) + alstr_copy_cstr(&entry.name, name); + else + alstr_copy_range(&entry.name, name, ext); if(i != 0) { char str[64]; snprintf(str, sizeof(str), " #%d", i+1); - al_string_append_cstr(&entry.name, str); + alstr_append_cstr(&entry.name, str); } ++i; -#define MATCH_NAME(i) (al_string_cmp(entry.name, (i)->name) == 0) - VECTOR_FIND_IF(iter, const HrtfEntry, *list, MATCH_NAME); +#define MATCH_NAME(i) (alstr_cmp(entry.name, (i)->name) == 0) + VECTOR_FIND_IF(iter, const EnumeratedHrtf, *list, MATCH_NAME); #undef MATCH_NAME } while(iter != VECTOR_END(*list)); + entry.hrtf = loaded_entry; - TRACE("Adding built-in entry \"%s\"\n", al_string_get_cstr(entry.name)); + TRACE("Adding built-in entry \"%s\"\n", alstr_get_cstr(entry.name)); VECTOR_PUSH_BACK(*list, entry); - -done: - al_string_deinit(filename); } +#define IDR_DEFAULT_44100_MHR 1 +#define IDR_DEFAULT_48000_MHR 2 + #ifndef ALSOFT_EMBED_HRTF_DATA -#define IDR_DEFAULT_44100_MHR 0 -#define IDR_DEFAULT_48000_MHR 1 static const ALubyte *GetResource(int UNUSED(name), size_t *size) { @@ -875,72 +1183,37 @@ static const ALubyte *GetResource(int UNUSED(name), size_t *size) } #else -#include "hrtf_res.h" -#ifdef _WIN32 -static const ALubyte *GetResource(int name, size_t *size) -{ - HMODULE handle; - HGLOBAL res; - HRSRC rc; - - GetModuleHandleExW( - GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT | GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, - (LPCWSTR)GetResource, &handle - ); - rc = FindResourceW(handle, MAKEINTRESOURCEW(name), MAKEINTRESOURCEW(MHRTYPE)); - res = LoadResource(handle, rc); - - *size = SizeofResource(handle, rc); - return LockResource(res); -} - -#else - -extern const ALubyte _binary_default_44100_mhr_start[] HIDDEN_DECL; -extern const ALubyte _binary_default_44100_mhr_end[] HIDDEN_DECL; -extern const ALubyte _binary_default_44100_mhr_size[] HIDDEN_DECL; - -extern const ALubyte _binary_default_48000_mhr_start[] HIDDEN_DECL; -extern const ALubyte _binary_default_48000_mhr_end[] HIDDEN_DECL; -extern const ALubyte _binary_default_48000_mhr_size[] HIDDEN_DECL; +#include "default-44100.mhr.h" +#include "default-48000.mhr.h" static const ALubyte *GetResource(int name, size_t *size) { if(name == IDR_DEFAULT_44100_MHR) { - /* Make sure all symbols are referenced, to ensure the compiler won't - * ignore the declarations and lose the visibility attribute used to - * hide them (would be nice if ld or objcopy could automatically mark - * them as hidden when generating them, but apparently they can't). - */ - const void *volatile ptr =_binary_default_44100_mhr_size; - (void)ptr; - *size = _binary_default_44100_mhr_end - _binary_default_44100_mhr_start; - return _binary_default_44100_mhr_start; + *size = sizeof(hrtf_default_44100); + return hrtf_default_44100; } if(name == IDR_DEFAULT_48000_MHR) { - const void *volatile ptr =_binary_default_48000_mhr_size; - (void)ptr; - *size = _binary_default_48000_mhr_end - _binary_default_48000_mhr_start; - return _binary_default_48000_mhr_start; + *size = sizeof(hrtf_default_48000); + return hrtf_default_48000; } *size = 0; return NULL; } #endif -#endif -vector_HrtfEntry EnumerateHrtf(const_al_string devname) +vector_EnumeratedHrtf EnumerateHrtf(const_al_string devname) { - vector_HrtfEntry list = VECTOR_INIT_STATIC(); + vector_EnumeratedHrtf list = VECTOR_INIT_STATIC(); const char *defaulthrtf = ""; const char *pathlist = ""; bool usedefaults = true; - if(ConfigValueStr(al_string_get_cstr(devname), NULL, "hrtf-paths", &pathlist)) + if(ConfigValueStr(alstr_get_cstr(devname), NULL, "hrtf-paths", &pathlist)) { + al_string pname = AL_STRING_INIT_STATIC(); while(pathlist && *pathlist) { const char *next, *end; @@ -963,65 +1236,69 @@ vector_HrtfEntry EnumerateHrtf(const_al_string devname) --end; if(end != pathlist) { - al_string pname = AL_STRING_INIT_STATIC(); vector_al_string flist; + size_t i; - al_string_append_range(&pname, pathlist, end); + alstr_copy_range(&pname, pathlist, end); - flist = SearchDataFiles(".mhr", al_string_get_cstr(pname)); - VECTOR_FOR_EACH_PARAMS(al_string, flist, AddFileEntry, &list); + flist = SearchDataFiles(".mhr", alstr_get_cstr(pname)); + for(i = 0;i < VECTOR_SIZE(flist);i++) + AddFileEntry(&list, VECTOR_ELEM(flist, i)); + VECTOR_FOR_EACH(al_string, flist, alstr_reset); VECTOR_DEINIT(flist); - - al_string_deinit(&pname); } pathlist = next; } + + alstr_reset(&pname); } - else if(ConfigValueExists(al_string_get_cstr(devname), NULL, "hrtf_tables")) + else if(ConfigValueExists(alstr_get_cstr(devname), NULL, "hrtf_tables")) ERR("The hrtf_tables option is deprecated, please use hrtf-paths instead.\n"); if(usedefaults) { + al_string ename = AL_STRING_INIT_STATIC(); vector_al_string flist; const ALubyte *rdata; - size_t rsize; + size_t rsize, i; flist = SearchDataFiles(".mhr", "openal/hrtf"); - VECTOR_FOR_EACH_PARAMS(al_string, flist, AddFileEntry, &list); + for(i = 0;i < VECTOR_SIZE(flist);i++) + AddFileEntry(&list, VECTOR_ELEM(flist, i)); + VECTOR_FOR_EACH(al_string, flist, alstr_reset); VECTOR_DEINIT(flist); rdata = GetResource(IDR_DEFAULT_44100_MHR, &rsize); if(rdata != NULL && rsize > 0) { - al_string ename = AL_STRING_INIT_STATIC(); - al_string_copy_cstr(&ename, "Built-In 44100hz"); - AddBuiltInEntry(&list, rdata, rsize, &ename); + alstr_copy_cstr(&ename, "Built-In 44100hz"); + AddBuiltInEntry(&list, ename, IDR_DEFAULT_44100_MHR); } rdata = GetResource(IDR_DEFAULT_48000_MHR, &rsize); if(rdata != NULL && rsize > 0) { - al_string ename = AL_STRING_INIT_STATIC(); - al_string_copy_cstr(&ename, "Built-In 48000hz"); - AddBuiltInEntry(&list, rdata, rsize, &ename); + alstr_copy_cstr(&ename, "Built-In 48000hz"); + AddBuiltInEntry(&list, ename, IDR_DEFAULT_48000_MHR); } + alstr_reset(&ename); } - if(VECTOR_SIZE(list) > 1 && ConfigValueStr(al_string_get_cstr(devname), NULL, "default-hrtf", &defaulthrtf)) + if(VECTOR_SIZE(list) > 1 && ConfigValueStr(alstr_get_cstr(devname), NULL, "default-hrtf", &defaulthrtf)) { - const HrtfEntry *iter; + const EnumeratedHrtf *iter; /* Find the preferred HRTF and move it to the front of the list. */ -#define FIND_ENTRY(i) (al_string_cmp_cstr((i)->name, defaulthrtf) == 0) - VECTOR_FIND_IF(iter, const HrtfEntry, list, FIND_ENTRY); +#define FIND_ENTRY(i) (alstr_cmp_cstr((i)->name, defaulthrtf) == 0) + VECTOR_FIND_IF(iter, const EnumeratedHrtf, list, FIND_ENTRY); #undef FIND_ENTRY if(iter == VECTOR_END(list)) WARN("Failed to find default HRTF \"%s\"\n", defaulthrtf); else if(iter != VECTOR_BEGIN(list)) { - HrtfEntry entry = *iter; + EnumeratedHrtf entry = *iter; memmove(&VECTOR_ELEM(list,1), &VECTOR_ELEM(list,0), - (iter-VECTOR_BEGIN(list))*sizeof(HrtfEntry)); + (iter-VECTOR_BEGIN(list))*sizeof(EnumeratedHrtf)); VECTOR_ELEM(list,0) = entry; } } @@ -1029,25 +1306,155 @@ vector_HrtfEntry EnumerateHrtf(const_al_string devname) return list; } -void FreeHrtfList(vector_HrtfEntry *list) +void FreeHrtfList(vector_EnumeratedHrtf *list) { -#define CLEAR_ENTRY(i) do { \ - al_string_deinit(&(i)->name); \ -} while(0) - VECTOR_FOR_EACH(HrtfEntry, *list, CLEAR_ENTRY); +#define CLEAR_ENTRY(i) alstr_reset(&(i)->name) + VECTOR_FOR_EACH(EnumeratedHrtf, *list, CLEAR_ENTRY); VECTOR_DEINIT(*list); #undef CLEAR_ENTRY } +struct Hrtf *GetLoadedHrtf(struct HrtfEntry *entry) +{ + struct Hrtf *hrtf = NULL; + struct FileMapping fmap; + const ALubyte *rdata; + const char *name; + ALuint residx; + size_t rsize; + char ch; + + while(ATOMIC_FLAG_TEST_AND_SET(&LoadedHrtfLock, almemory_order_seq_cst)) + althrd_yield(); + + if(entry->handle) + { + hrtf = entry->handle; + Hrtf_IncRef(hrtf); + goto done; + } + + fmap.ptr = NULL; + fmap.len = 0; + if(sscanf(entry->filename, "!%u%c", &residx, &ch) == 2 && ch == '_') + { + name = strchr(entry->filename, ch)+1; + + TRACE("Loading %s...\n", name); + rdata = GetResource(residx, &rsize); + if(rdata == NULL || rsize == 0) + { + ERR("Could not get resource %u, %s\n", residx, name); + goto done; + } + } + else + { + name = entry->filename; + + TRACE("Loading %s...\n", entry->filename); + fmap = MapFileToMem(entry->filename); + if(fmap.ptr == NULL) + { + ERR("Could not open %s\n", entry->filename); + goto done; + } + + rdata = fmap.ptr; + rsize = fmap.len; + } + + if(rsize < sizeof(magicMarker02)) + ERR("%s data is too short ("SZFMT" bytes)\n", name, rsize); + else if(memcmp(rdata, magicMarker02, sizeof(magicMarker02)) == 0) + { + TRACE("Detected data set format v2\n"); + hrtf = LoadHrtf02(rdata+sizeof(magicMarker02), + rsize-sizeof(magicMarker02), name + ); + } + else if(memcmp(rdata, magicMarker01, sizeof(magicMarker01)) == 0) + { + TRACE("Detected data set format v1\n"); + hrtf = LoadHrtf01(rdata+sizeof(magicMarker01), + rsize-sizeof(magicMarker01), name + ); + } + else if(memcmp(rdata, magicMarker00, sizeof(magicMarker00)) == 0) + { + TRACE("Detected data set format v0\n"); + hrtf = LoadHrtf00(rdata+sizeof(magicMarker00), + rsize-sizeof(magicMarker00), name + ); + } + else + ERR("Invalid header in %s: \"%.8s\"\n", name, (const char*)rdata); + if(fmap.ptr) + UnmapFileMem(&fmap); + + if(!hrtf) + { + ERR("Failed to load %s\n", name); + goto done; + } + entry->handle = hrtf; + Hrtf_IncRef(hrtf); + + TRACE("Loaded HRTF support for format: %s %uhz\n", + DevFmtChannelsString(DevFmtStereo), hrtf->sampleRate); + +done: + ATOMIC_FLAG_CLEAR(&LoadedHrtfLock, almemory_order_seq_cst); + return hrtf; +} + + +void Hrtf_IncRef(struct Hrtf *hrtf) +{ + uint ref = IncrementRef(&hrtf->ref); + TRACEREF("%p increasing refcount to %u\n", hrtf, ref); +} + +void Hrtf_DecRef(struct Hrtf *hrtf) +{ + struct HrtfEntry *Hrtf; + uint ref = DecrementRef(&hrtf->ref); + TRACEREF("%p decreasing refcount to %u\n", hrtf, ref); + if(ref == 0) + { + while(ATOMIC_FLAG_TEST_AND_SET(&LoadedHrtfLock, almemory_order_seq_cst)) + althrd_yield(); + + Hrtf = LoadedHrtfs; + while(Hrtf != NULL) + { + /* Need to double-check that it's still unused, as another device + * could've reacquired this HRTF after its reference went to 0 and + * before the lock was taken. + */ + if(hrtf == Hrtf->handle && ReadRef(&hrtf->ref) == 0) + { + al_free(Hrtf->handle); + Hrtf->handle = NULL; + TRACE("Unloaded unused HRTF %s\n", Hrtf->filename); + } + Hrtf = Hrtf->next; + } + + ATOMIC_FLAG_CLEAR(&LoadedHrtfLock, almemory_order_seq_cst); + } +} + void FreeHrtfs(void) { - struct Hrtf *Hrtf = LoadedHrtfs; + struct HrtfEntry *Hrtf = LoadedHrtfs; LoadedHrtfs = NULL; while(Hrtf != NULL) { - struct Hrtf *next = Hrtf->next; + struct HrtfEntry *next = Hrtf->next; + al_free(Hrtf->handle); al_free(Hrtf); Hrtf = next; } diff --git a/Engine/lib/openal-soft/Alc/hrtf.h b/Engine/lib/openal-soft/Alc/hrtf.h index ebba0d50c..cb6dfddc8 100644 --- a/Engine/lib/openal-soft/Alc/hrtf.h +++ b/Engine/lib/openal-soft/Alc/hrtf.h @@ -4,49 +4,86 @@ #include "AL/al.h" #include "AL/alc.h" +#include "alMain.h" #include "alstring.h" +#include "atomic.h" -struct Hrtf { - ALuint sampleRate; - ALuint irSize; - ALubyte evCount; +/* The maximum number of virtual speakers used to generate HRTF coefficients + * for decoding B-Format. + */ +#define HRTF_AMBI_MAX_CHANNELS 18 - const ALubyte *azCount; - const ALushort *evOffset; - const ALshort *coeffs; - const ALubyte *delays; - const char *filename; - struct Hrtf *next; -}; - -typedef struct HrtfEntry { - al_string name; - - const struct Hrtf *hrtf; -} HrtfEntry; -TYPEDEF_VECTOR(HrtfEntry, vector_HrtfEntry) +#define HRTF_HISTORY_BITS (6) +#define HRTF_HISTORY_LENGTH (1< + + +#ifdef __GNUC__ +#define DECL_FORMAT(x, y, z) __attribute__((format(x, (y), (z)))) +#else +#define DECL_FORMAT(x, y, z) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +extern FILE *LogFile; + +#if defined(__GNUC__) && !defined(_WIN32) +#define AL_PRINT(T, MSG, ...) fprintf(LogFile, "AL lib: %s %s: "MSG, T, __FUNCTION__ , ## __VA_ARGS__) +#else +void al_print(const char *type, const char *func, const char *fmt, ...) DECL_FORMAT(printf, 3,4); +#define AL_PRINT(T, ...) al_print((T), __FUNCTION__, __VA_ARGS__) +#endif + +#ifdef __ANDROID__ +#include +#define LOG_ANDROID(T, MSG, ...) __android_log_print(T, "openal", "AL lib: %s: "MSG, __FUNCTION__ , ## __VA_ARGS__) +#else +#define LOG_ANDROID(T, MSG, ...) ((void)0) +#endif + +enum LogLevel { + NoLog, + LogError, + LogWarning, + LogTrace, + LogRef +}; +extern enum LogLevel LogLevel; + +#define TRACEREF(...) do { \ + if(LogLevel >= LogRef) \ + AL_PRINT("(--)", __VA_ARGS__); \ +} while(0) + +#define TRACE(...) do { \ + if(LogLevel >= LogTrace) \ + AL_PRINT("(II)", __VA_ARGS__); \ + LOG_ANDROID(ANDROID_LOG_DEBUG, __VA_ARGS__); \ +} while(0) + +#define WARN(...) do { \ + if(LogLevel >= LogWarning) \ + AL_PRINT("(WW)", __VA_ARGS__); \ + LOG_ANDROID(ANDROID_LOG_WARN, __VA_ARGS__); \ +} while(0) + +#define ERR(...) do { \ + if(LogLevel >= LogError) \ + AL_PRINT("(EE)", __VA_ARGS__); \ + LOG_ANDROID(ANDROID_LOG_ERROR, __VA_ARGS__); \ +} while(0) + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* LOGGING_H */ diff --git a/Engine/lib/openal-soft/Alc/mastering.c b/Engine/lib/openal-soft/Alc/mastering.c new file mode 100644 index 000000000..1636c8d93 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/mastering.c @@ -0,0 +1,232 @@ +#include "config.h" + +#include + +#include "mastering.h" +#include "alu.h" +#include "almalloc.h" + + +extern inline ALuint GetCompressorSampleRate(const Compressor *Comp); + +#define RMS_WINDOW_SIZE (1<<7) +#define RMS_WINDOW_MASK (RMS_WINDOW_SIZE-1) +#define RMS_VALUE_MAX (1<<24) + +static_assert(RMS_VALUE_MAX < (UINT_MAX / RMS_WINDOW_SIZE), "RMS_VALUE_MAX is too big"); + + +/* Multichannel compression is linked via one of two modes: + * + * Summed - Absolute sum of all channels. + * Maxed - Absolute maximum of any channel. + */ +static void SumChannels(Compressor *Comp, const ALsizei NumChans, const ALsizei SamplesToDo, + ALfloat (*restrict OutBuffer)[BUFFERSIZE]) +{ + ALsizei c, i; + + for(i = 0;i < SamplesToDo;i++) + Comp->Envelope[i] = 0.0f; + + for(c = 0;c < NumChans;c++) + { + for(i = 0;i < SamplesToDo;i++) + Comp->Envelope[i] += OutBuffer[c][i]; + } + + for(i = 0;i < SamplesToDo;i++) + Comp->Envelope[i] = fabsf(Comp->Envelope[i]); +} + +static void MaxChannels(Compressor *Comp, const ALsizei NumChans, const ALsizei SamplesToDo, + ALfloat (*restrict OutBuffer)[BUFFERSIZE]) +{ + ALsizei c, i; + + for(i = 0;i < SamplesToDo;i++) + Comp->Envelope[i] = 0.0f; + + for(c = 0;c < NumChans;c++) + { + for(i = 0;i < SamplesToDo;i++) + Comp->Envelope[i] = maxf(Comp->Envelope[i], fabsf(OutBuffer[c][i])); + } +} + +/* Envelope detection/sensing can be done via: + * + * RMS - Rectangular windowed root mean square of linking stage. + * Peak - Implicit output from linking stage. + */ +static void RmsDetection(Compressor *Comp, const ALsizei SamplesToDo) +{ + ALuint sum = Comp->RmsSum; + ALuint *window = Comp->RmsWindow; + ALsizei index = Comp->RmsIndex; + ALsizei i; + + for(i = 0;i < SamplesToDo;i++) + { + ALfloat sig = Comp->Envelope[i]; + + sum -= window[index]; + window[index] = fastf2i(minf(sig * sig * 65536.0f, RMS_VALUE_MAX)); + sum += window[index]; + index = (index + 1) & RMS_WINDOW_MASK; + + Comp->Envelope[i] = sqrtf(sum / 65536.0f / RMS_WINDOW_SIZE); + } + + Comp->RmsSum = sum; + Comp->RmsIndex = index; +} + +/* This isn't a very sophisticated envelope follower, but it gets the job + * done. First, it operates at logarithmic scales to keep transitions + * appropriate for human hearing. Second, it can apply adaptive (automated) + * attack/release adjustments based on the signal. + */ +static void FollowEnvelope(Compressor *Comp, const ALsizei SamplesToDo) +{ + ALfloat attackMin = Comp->AttackMin; + ALfloat attackMax = Comp->AttackMax; + ALfloat releaseMin = Comp->ReleaseMin; + ALfloat releaseMax = Comp->ReleaseMax; + ALfloat last = Comp->EnvLast; + ALsizei i; + + for(i = 0;i < SamplesToDo;i++) + { + ALfloat env = log10f(maxf(Comp->Envelope[i], 0.000001f)); + ALfloat slope = minf(1.0f, fabsf(env - last) / 4.5f); + + if(env > last) + last = minf(env, last + lerp(attackMin, attackMax, 1.0f - (slope * slope))); + else + last = maxf(env, last + lerp(releaseMin, releaseMax, 1.0f - (slope * slope))); + + Comp->Envelope[i] = last; + } + + Comp->EnvLast = last; +} + +/* The envelope is converted to control gain with an optional soft knee. */ +static void EnvelopeGain(Compressor *Comp, const ALsizei SamplesToDo, const ALfloat Slope) +{ + const ALfloat threshold = Comp->Threshold; + const ALfloat knee = Comp->Knee; + ALsizei i; + + if(!(knee > 0.0f)) + { + for(i = 0;i < SamplesToDo;i++) + { + ALfloat gain = Slope * (threshold - Comp->Envelope[i]); + Comp->Envelope[i] = powf(10.0f, minf(0.0f, gain)); + } + } + else + { + const ALfloat lower = threshold - (0.5f * knee); + const ALfloat upper = threshold + (0.5f * knee); + const ALfloat m = 0.5f * Slope / knee; + + for(i = 0;i < SamplesToDo;i++) + { + ALfloat env = Comp->Envelope[i]; + ALfloat gain; + + if(env > lower && env < upper) + gain = m * (env - lower) * (lower - env); + else + gain = Slope * (threshold - env); + + Comp->Envelope[i] = powf(10.0f, minf(0.0f, gain)); + } + } +} + + +Compressor *CompressorInit(const ALfloat PreGainDb, const ALfloat PostGainDb, + const ALboolean SummedLink, const ALboolean RmsSensing, + const ALfloat AttackTimeMin, const ALfloat AttackTimeMax, + const ALfloat ReleaseTimeMin, const ALfloat ReleaseTimeMax, + const ALfloat Ratio, const ALfloat ThresholdDb, + const ALfloat KneeDb, const ALuint SampleRate) +{ + Compressor *Comp; + size_t size; + ALsizei i; + + size = sizeof(*Comp); + if(RmsSensing) + size += sizeof(Comp->RmsWindow[0]) * RMS_WINDOW_SIZE; + Comp = al_calloc(16, size); + + Comp->PreGain = powf(10.0f, PreGainDb / 20.0f); + Comp->PostGain = powf(10.0f, PostGainDb / 20.0f); + Comp->SummedLink = SummedLink; + Comp->AttackMin = 1.0f / maxf(0.000001f, AttackTimeMin * SampleRate * logf(10.0f)); + Comp->AttackMax = 1.0f / maxf(0.000001f, AttackTimeMax * SampleRate * logf(10.0f)); + Comp->ReleaseMin = -1.0f / maxf(0.000001f, ReleaseTimeMin * SampleRate * logf(10.0f)); + Comp->ReleaseMax = -1.0f / maxf(0.000001f, ReleaseTimeMax * SampleRate * logf(10.0f)); + Comp->Ratio = Ratio; + Comp->Threshold = ThresholdDb / 20.0f; + Comp->Knee = maxf(0.0f, KneeDb / 20.0f); + Comp->SampleRate = SampleRate; + + Comp->RmsSum = 0; + if(RmsSensing) + Comp->RmsWindow = (ALuint*)(Comp+1); + else + Comp->RmsWindow = NULL; + Comp->RmsIndex = 0; + + for(i = 0;i < BUFFERSIZE;i++) + Comp->Envelope[i] = 0.0f; + Comp->EnvLast = -6.0f; + + return Comp; +} + +void ApplyCompression(Compressor *Comp, const ALsizei NumChans, const ALsizei SamplesToDo, + ALfloat (*restrict OutBuffer)[BUFFERSIZE]) +{ + ALsizei c, i; + + if(Comp->PreGain != 1.0f) + { + for(c = 0;c < NumChans;c++) + { + for(i = 0;i < SamplesToDo;i++) + OutBuffer[c][i] *= Comp->PreGain; + } + } + + if(Comp->SummedLink) + SumChannels(Comp, NumChans, SamplesToDo, OutBuffer); + else + MaxChannels(Comp, NumChans, SamplesToDo, OutBuffer); + + if(Comp->RmsWindow) + RmsDetection(Comp, SamplesToDo); + FollowEnvelope(Comp, SamplesToDo); + + if(Comp->Ratio > 0.0f) + EnvelopeGain(Comp, SamplesToDo, 1.0f - (1.0f / Comp->Ratio)); + else + EnvelopeGain(Comp, SamplesToDo, 1.0f); + + if(Comp->PostGain != 1.0f) + { + for(i = 0;i < SamplesToDo;i++) + Comp->Envelope[i] *= Comp->PostGain; + } + for(c = 0;c < NumChans;c++) + { + for(i = 0;i < SamplesToDo;i++) + OutBuffer[c][i] *= Comp->Envelope[i]; + } +} diff --git a/Engine/lib/openal-soft/Alc/mastering.h b/Engine/lib/openal-soft/Alc/mastering.h new file mode 100644 index 000000000..0a7b49017 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/mastering.h @@ -0,0 +1,57 @@ +#ifndef MASTERING_H +#define MASTERING_H + +#include "AL/al.h" + +/* For BUFFERSIZE. */ +#include "alMain.h" + +typedef struct Compressor { + ALfloat PreGain; + ALfloat PostGain; + ALboolean SummedLink; + ALfloat AttackMin; + ALfloat AttackMax; + ALfloat ReleaseMin; + ALfloat ReleaseMax; + ALfloat Ratio; + ALfloat Threshold; + ALfloat Knee; + ALuint SampleRate; + + ALuint RmsSum; + ALuint *RmsWindow; + ALsizei RmsIndex; + ALfloat Envelope[BUFFERSIZE]; + ALfloat EnvLast; +} Compressor; + +/* The compressor requires the following information for proper + * initialization: + * + * PreGainDb - Gain applied before detection (in dB). + * PostGainDb - Gain applied after compression (in dB). + * SummedLink - Whether to use summed (true) or maxed (false) linking. + * RmsSensing - Whether to use RMS (true) or Peak (false) sensing. + * AttackTimeMin - Minimum attack time (in seconds). + * AttackTimeMax - Maximum attack time. Automates when min != max. + * ReleaseTimeMin - Minimum release time (in seconds). + * ReleaseTimeMax - Maximum release time. Automates when min != max. + * Ratio - Compression ratio (x:1). Set to 0 for true limiter. + * ThresholdDb - Triggering threshold (in dB). + * KneeDb - Knee width (below threshold; in dB). + * SampleRate - Sample rate to process. + */ +Compressor *CompressorInit(const ALfloat PreGainDb, const ALfloat PostGainDb, + const ALboolean SummedLink, const ALboolean RmsSensing, const ALfloat AttackTimeMin, + const ALfloat AttackTimeMax, const ALfloat ReleaseTimeMin, const ALfloat ReleaseTimeMax, + const ALfloat Ratio, const ALfloat ThresholdDb, const ALfloat KneeDb, + const ALuint SampleRate); + +void ApplyCompression(struct Compressor *Comp, const ALsizei NumChans, const ALsizei SamplesToDo, + ALfloat (*restrict OutBuffer)[BUFFERSIZE]); + +inline ALuint GetCompressorSampleRate(const Compressor *Comp) +{ return Comp->SampleRate; } + +#endif /* MASTERING_H */ diff --git a/Engine/lib/openal-soft/Alc/mixer.c b/Engine/lib/openal-soft/Alc/mixer.c deleted file mode 100644 index b1f79d055..000000000 --- a/Engine/lib/openal-soft/Alc/mixer.c +++ /dev/null @@ -1,702 +0,0 @@ -/** - * OpenAL cross platform audio library - * Copyright (C) 1999-2007 by authors. - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * Or go to http://www.gnu.org/copyleft/lgpl.html - */ - -#include "config.h" - -#include -#include -#include -#include -#include - -#include "alMain.h" -#include "AL/al.h" -#include "AL/alc.h" -#include "alSource.h" -#include "alBuffer.h" -#include "alListener.h" -#include "alAuxEffectSlot.h" -#include "alu.h" - -#include "mixer_defs.h" - - -static_assert((INT_MAX>>FRACTIONBITS)/MAX_PITCH > BUFFERSIZE, - "MAX_PITCH and/or BUFFERSIZE are too large for FRACTIONBITS!"); - -extern inline void InitiatePositionArrays(ALuint frac, ALuint increment, ALuint *restrict frac_arr, ALuint *restrict pos_arr, ALuint size); - -alignas(16) union ResamplerCoeffs ResampleCoeffs; - - -enum Resampler { - PointResampler, - LinearResampler, - FIR4Resampler, - FIR8Resampler, - BSincResampler, - - ResamplerDefault = LinearResampler -}; - -/* FIR8 requires 3 extra samples before the current position, and 4 after. */ -static_assert(MAX_PRE_SAMPLES >= 3, "MAX_PRE_SAMPLES must be at least 3!"); -static_assert(MAX_POST_SAMPLES >= 4, "MAX_POST_SAMPLES must be at least 4!"); - - -static MixerFunc MixSamples = Mix_C; -static HrtfMixerFunc MixHrtfSamples = MixHrtf_C; -static ResamplerFunc ResampleSamples = Resample_point32_C; - -MixerFunc SelectMixer(void) -{ -#ifdef HAVE_SSE - if((CPUCapFlags&CPU_CAP_SSE)) - return Mix_SSE; -#endif -#ifdef HAVE_NEON - if((CPUCapFlags&CPU_CAP_NEON)) - return Mix_Neon; -#endif - - return Mix_C; -} - -RowMixerFunc SelectRowMixer(void) -{ -#ifdef HAVE_SSE - if((CPUCapFlags&CPU_CAP_SSE)) - return MixRow_SSE; -#endif -#ifdef HAVE_NEON - if((CPUCapFlags&CPU_CAP_NEON)) - return MixRow_Neon; -#endif - return MixRow_C; -} - -static inline HrtfMixerFunc SelectHrtfMixer(void) -{ -#ifdef HAVE_SSE - if((CPUCapFlags&CPU_CAP_SSE)) - return MixHrtf_SSE; -#endif -#ifdef HAVE_NEON - if((CPUCapFlags&CPU_CAP_NEON)) - return MixHrtf_Neon; -#endif - - return MixHrtf_C; -} - -static inline ResamplerFunc SelectResampler(enum Resampler resampler) -{ - switch(resampler) - { - case PointResampler: - return Resample_point32_C; - case LinearResampler: -#ifdef HAVE_SSE4_1 - if((CPUCapFlags&CPU_CAP_SSE4_1)) - return Resample_lerp32_SSE41; -#endif -#ifdef HAVE_SSE2 - if((CPUCapFlags&CPU_CAP_SSE2)) - return Resample_lerp32_SSE2; -#endif - return Resample_lerp32_C; - case FIR4Resampler: -#ifdef HAVE_SSE4_1 - if((CPUCapFlags&CPU_CAP_SSE4_1)) - return Resample_fir4_32_SSE41; -#endif -#ifdef HAVE_SSE3 - if((CPUCapFlags&CPU_CAP_SSE3)) - return Resample_fir4_32_SSE3; -#endif - return Resample_fir4_32_C; - case FIR8Resampler: -#ifdef HAVE_SSE4_1 - if((CPUCapFlags&CPU_CAP_SSE4_1)) - return Resample_fir8_32_SSE41; -#endif -#ifdef HAVE_SSE3 - if((CPUCapFlags&CPU_CAP_SSE3)) - return Resample_fir8_32_SSE3; -#endif - return Resample_fir8_32_C; - case BSincResampler: -#ifdef HAVE_SSE - if((CPUCapFlags&CPU_CAP_SSE)) - return Resample_bsinc32_SSE; -#endif - return Resample_bsinc32_C; - } - - return Resample_point32_C; -} - - -/* The sinc resampler makes use of a Kaiser window to limit the needed sample - * points to 4 and 8, respectively. - */ - -#ifndef M_PI -#define M_PI (3.14159265358979323846) -#endif -static inline double Sinc(double x) -{ - if(x == 0.0) return 1.0; - return sin(x*M_PI) / (x*M_PI); -} - -/* The zero-order modified Bessel function of the first kind, used for the - * Kaiser window. - * - * I_0(x) = sum_{k=0}^inf (1 / k!)^2 (x / 2)^(2 k) - * = sum_{k=0}^inf ((x / 2)^k / k!)^2 - */ -static double BesselI_0(double x) -{ - double term, sum, x2, y, last_sum; - int k; - - /* Start at k=1 since k=0 is trivial. */ - term = 1.0; - sum = 1.0; - x2 = x / 2.0; - k = 1; - - /* Let the integration converge until the term of the sum is no longer - * significant. - */ - do { - y = x2 / k; - k ++; - last_sum = sum; - term *= y * y; - sum += term; - } while(sum != last_sum); - return sum; -} - -/* Calculate a Kaiser window from the given beta value and a normalized k - * [-1, 1]. - * - * w(k) = { I_0(B sqrt(1 - k^2)) / I_0(B), -1 <= k <= 1 - * { 0, elsewhere. - * - * Where k can be calculated as: - * - * k = i / l, where -l <= i <= l. - * - * or: - * - * k = 2 i / M - 1, where 0 <= i <= M. - */ -static inline double Kaiser(double b, double k) -{ - if(k <= -1.0 || k >= 1.0) return 0.0; - return BesselI_0(b * sqrt(1.0 - (k*k))) / BesselI_0(b); -} - -static inline double CalcKaiserBeta(double rejection) -{ - if(rejection > 50.0) - return 0.1102 * (rejection - 8.7); - if(rejection >= 21.0) - return (0.5842 * pow(rejection - 21.0, 0.4)) + - (0.07886 * (rejection - 21.0)); - return 0.0; -} - -static float SincKaiser(double r, double x) -{ - /* Limit rippling to -60dB. */ - return (float)(Kaiser(CalcKaiserBeta(60.0), x / r) * Sinc(x)); -} - - -void aluInitMixer(void) -{ - enum Resampler resampler = ResamplerDefault; - const char *str; - ALuint i; - - if(ConfigValueStr(NULL, NULL, "resampler", &str)) - { - if(strcasecmp(str, "point") == 0 || strcasecmp(str, "none") == 0) - resampler = PointResampler; - else if(strcasecmp(str, "linear") == 0) - resampler = LinearResampler; - else if(strcasecmp(str, "sinc4") == 0) - resampler = FIR4Resampler; - else if(strcasecmp(str, "sinc8") == 0) - resampler = FIR8Resampler; - else if(strcasecmp(str, "bsinc") == 0) - resampler = BSincResampler; - else if(strcasecmp(str, "cubic") == 0) - { - WARN("Resampler option \"cubic\" is deprecated, using sinc4\n"); - resampler = FIR4Resampler; - } - else - { - char *end; - long n = strtol(str, &end, 0); - if(*end == '\0' && (n == PointResampler || n == LinearResampler || n == FIR4Resampler)) - resampler = n; - else - WARN("Invalid resampler: %s\n", str); - } - } - - if(resampler == FIR8Resampler) - for(i = 0;i < FRACTIONONE;i++) - { - ALdouble mu = (ALdouble)i / FRACTIONONE; - ResampleCoeffs.FIR8[i][0] = SincKaiser(4.0, mu - -3.0); - ResampleCoeffs.FIR8[i][1] = SincKaiser(4.0, mu - -2.0); - ResampleCoeffs.FIR8[i][2] = SincKaiser(4.0, mu - -1.0); - ResampleCoeffs.FIR8[i][3] = SincKaiser(4.0, mu - 0.0); - ResampleCoeffs.FIR8[i][4] = SincKaiser(4.0, mu - 1.0); - ResampleCoeffs.FIR8[i][5] = SincKaiser(4.0, mu - 2.0); - ResampleCoeffs.FIR8[i][6] = SincKaiser(4.0, mu - 3.0); - ResampleCoeffs.FIR8[i][7] = SincKaiser(4.0, mu - 4.0); - } - else if(resampler == FIR4Resampler) - for(i = 0;i < FRACTIONONE;i++) - { - ALdouble mu = (ALdouble)i / FRACTIONONE; - ResampleCoeffs.FIR4[i][0] = SincKaiser(2.0, mu - -1.0); - ResampleCoeffs.FIR4[i][1] = SincKaiser(2.0, mu - 0.0); - ResampleCoeffs.FIR4[i][2] = SincKaiser(2.0, mu - 1.0); - ResampleCoeffs.FIR4[i][3] = SincKaiser(2.0, mu - 2.0); - } - - MixHrtfSamples = SelectHrtfMixer(); - MixSamples = SelectMixer(); - ResampleSamples = SelectResampler(resampler); -} - - -static inline ALfloat Sample_ALbyte(ALbyte val) -{ return val * (1.0f/127.0f); } - -static inline ALfloat Sample_ALshort(ALshort val) -{ return val * (1.0f/32767.0f); } - -static inline ALfloat Sample_ALfloat(ALfloat val) -{ return val; } - -#define DECL_TEMPLATE(T) \ -static inline void Load_##T(ALfloat *dst, const T *src, ALuint srcstep, ALuint samples)\ -{ \ - ALuint i; \ - for(i = 0;i < samples;i++) \ - dst[i] = Sample_##T(src[i*srcstep]); \ -} - -DECL_TEMPLATE(ALbyte) -DECL_TEMPLATE(ALshort) -DECL_TEMPLATE(ALfloat) - -#undef DECL_TEMPLATE - -static void LoadSamples(ALfloat *dst, const ALvoid *src, ALuint srcstep, enum FmtType srctype, ALuint samples) -{ - switch(srctype) - { - case FmtByte: - Load_ALbyte(dst, src, srcstep, samples); - break; - case FmtShort: - Load_ALshort(dst, src, srcstep, samples); - break; - case FmtFloat: - Load_ALfloat(dst, src, srcstep, samples); - break; - } -} - -static inline void SilenceSamples(ALfloat *dst, ALuint samples) -{ - ALuint i; - for(i = 0;i < samples;i++) - dst[i] = 0.0f; -} - - -static const ALfloat *DoFilters(ALfilterState *lpfilter, ALfilterState *hpfilter, - ALfloat *restrict dst, const ALfloat *restrict src, - ALuint numsamples, enum ActiveFilters type) -{ - ALuint i; - switch(type) - { - case AF_None: - ALfilterState_processPassthru(lpfilter, src, numsamples); - ALfilterState_processPassthru(hpfilter, src, numsamples); - break; - - case AF_LowPass: - ALfilterState_process(lpfilter, dst, src, numsamples); - ALfilterState_processPassthru(hpfilter, dst, numsamples); - return dst; - case AF_HighPass: - ALfilterState_processPassthru(lpfilter, src, numsamples); - ALfilterState_process(hpfilter, dst, src, numsamples); - return dst; - - case AF_BandPass: - for(i = 0;i < numsamples;) - { - ALfloat temp[256]; - ALuint todo = minu(256, numsamples-i); - - ALfilterState_process(lpfilter, temp, src+i, todo); - ALfilterState_process(hpfilter, dst+i, temp, todo); - i += todo; - } - return dst; - } - return src; -} - - -ALvoid MixSource(ALvoice *voice, ALsource *Source, ALCdevice *Device, ALuint SamplesToDo) -{ - ResamplerFunc Resample; - ALbufferlistitem *BufferListItem; - ALuint DataPosInt, DataPosFrac; - ALboolean Looping; - ALuint increment; - ALenum State; - ALuint OutPos; - ALuint NumChannels; - ALuint SampleSize; - ALint64 DataSize64; - ALuint Counter; - ALuint IrSize; - ALuint chan, send, j; - - /* Get source info */ - State = AL_PLAYING; /* Only called while playing. */ - BufferListItem = ATOMIC_LOAD(&Source->current_buffer); - DataPosInt = ATOMIC_LOAD(&Source->position, almemory_order_relaxed); - DataPosFrac = ATOMIC_LOAD(&Source->position_fraction, almemory_order_relaxed); - Looping = ATOMIC_LOAD(&Source->looping, almemory_order_relaxed); - NumChannels = Source->NumChannels; - SampleSize = Source->SampleSize; - increment = voice->Step; - - IrSize = (Device->Hrtf.Handle ? Device->Hrtf.Handle->irSize : 0); - - Resample = ((increment == FRACTIONONE && DataPosFrac == 0) ? - Resample_copy32_C : ResampleSamples); - - Counter = voice->Moving ? SamplesToDo : 0; - OutPos = 0; - do { - ALuint SrcBufferSize, DstBufferSize; - - /* Figure out how many buffer samples will be needed */ - DataSize64 = SamplesToDo-OutPos; - DataSize64 *= increment; - DataSize64 += DataPosFrac+FRACTIONMASK; - DataSize64 >>= FRACTIONBITS; - DataSize64 += MAX_POST_SAMPLES+MAX_PRE_SAMPLES; - - SrcBufferSize = (ALuint)mini64(DataSize64, BUFFERSIZE); - - /* Figure out how many samples we can actually mix from this. */ - DataSize64 = SrcBufferSize; - DataSize64 -= MAX_POST_SAMPLES+MAX_PRE_SAMPLES; - DataSize64 <<= FRACTIONBITS; - DataSize64 -= DataPosFrac; - - DstBufferSize = (ALuint)((DataSize64+(increment-1)) / increment); - DstBufferSize = minu(DstBufferSize, (SamplesToDo-OutPos)); - - /* Some mixers like having a multiple of 4, so try to give that unless - * this is the last update. */ - if(OutPos+DstBufferSize < SamplesToDo) - DstBufferSize &= ~3; - - for(chan = 0;chan < NumChannels;chan++) - { - const ALfloat *ResampledData; - ALfloat *SrcData = Device->SourceData; - ALuint SrcDataSize; - - /* Load the previous samples into the source data first. */ - memcpy(SrcData, voice->PrevSamples[chan], MAX_PRE_SAMPLES*sizeof(ALfloat)); - SrcDataSize = MAX_PRE_SAMPLES; - - if(Source->SourceType == AL_STATIC) - { - const ALbuffer *ALBuffer = BufferListItem->buffer; - const ALubyte *Data = ALBuffer->data; - ALuint DataSize; - ALuint pos; - - /* Offset buffer data to current channel */ - Data += chan*SampleSize; - - /* If current pos is beyond the loop range, do not loop */ - if(Looping == AL_FALSE || DataPosInt >= (ALuint)ALBuffer->LoopEnd) - { - Looping = AL_FALSE; - - /* Load what's left to play from the source buffer, and - * clear the rest of the temp buffer */ - pos = DataPosInt; - DataSize = minu(SrcBufferSize - SrcDataSize, ALBuffer->SampleLen - pos); - - LoadSamples(&SrcData[SrcDataSize], &Data[pos * NumChannels*SampleSize], - NumChannels, ALBuffer->FmtType, DataSize); - SrcDataSize += DataSize; - - SilenceSamples(&SrcData[SrcDataSize], SrcBufferSize - SrcDataSize); - SrcDataSize += SrcBufferSize - SrcDataSize; - } - else - { - ALuint LoopStart = ALBuffer->LoopStart; - ALuint LoopEnd = ALBuffer->LoopEnd; - - /* Load what's left of this loop iteration, then load - * repeats of the loop section */ - pos = DataPosInt; - DataSize = LoopEnd - pos; - DataSize = minu(SrcBufferSize - SrcDataSize, DataSize); - - LoadSamples(&SrcData[SrcDataSize], &Data[pos * NumChannels*SampleSize], - NumChannels, ALBuffer->FmtType, DataSize); - SrcDataSize += DataSize; - - DataSize = LoopEnd-LoopStart; - while(SrcBufferSize > SrcDataSize) - { - DataSize = minu(SrcBufferSize - SrcDataSize, DataSize); - - LoadSamples(&SrcData[SrcDataSize], &Data[LoopStart * NumChannels*SampleSize], - NumChannels, ALBuffer->FmtType, DataSize); - SrcDataSize += DataSize; - } - } - } - else - { - /* Crawl the buffer queue to fill in the temp buffer */ - ALbufferlistitem *tmpiter = BufferListItem; - ALuint pos = DataPosInt; - - while(tmpiter && SrcBufferSize > SrcDataSize) - { - const ALbuffer *ALBuffer; - if((ALBuffer=tmpiter->buffer) != NULL) - { - const ALubyte *Data = ALBuffer->data; - ALuint DataSize = ALBuffer->SampleLen; - - /* Skip the data already played */ - if(DataSize <= pos) - pos -= DataSize; - else - { - Data += (pos*NumChannels + chan)*SampleSize; - DataSize -= pos; - pos -= pos; - - DataSize = minu(SrcBufferSize - SrcDataSize, DataSize); - LoadSamples(&SrcData[SrcDataSize], Data, NumChannels, - ALBuffer->FmtType, DataSize); - SrcDataSize += DataSize; - } - } - tmpiter = tmpiter->next; - if(!tmpiter && Looping) - tmpiter = ATOMIC_LOAD(&Source->queue); - else if(!tmpiter) - { - SilenceSamples(&SrcData[SrcDataSize], SrcBufferSize - SrcDataSize); - SrcDataSize += SrcBufferSize - SrcDataSize; - } - } - } - - /* Store the last source samples used for next time. */ - memcpy(voice->PrevSamples[chan], - &SrcData[(increment*DstBufferSize + DataPosFrac)>>FRACTIONBITS], - MAX_PRE_SAMPLES*sizeof(ALfloat) - ); - - /* Now resample, then filter and mix to the appropriate outputs. */ - ResampledData = Resample(&voice->SincState, - &SrcData[MAX_PRE_SAMPLES], DataPosFrac, increment, - Device->ResampledData, DstBufferSize - ); - { - DirectParams *parms = &voice->Chan[chan].Direct; - const ALfloat *samples; - - samples = DoFilters( - &parms->LowPass, &parms->HighPass, Device->FilteredData, - ResampledData, DstBufferSize, parms->FilterType - ); - if(!voice->IsHrtf) - { - if(!Counter) - memcpy(parms->Gains.Current, parms->Gains.Target, - sizeof(parms->Gains.Current)); - MixSamples(samples, voice->DirectOut.Channels, voice->DirectOut.Buffer, - parms->Gains.Current, parms->Gains.Target, Counter, OutPos, DstBufferSize - ); - } - else - { - MixHrtfParams hrtfparams; - int lidx, ridx; - - if(!Counter) - { - parms->Hrtf.Current = parms->Hrtf.Target; - for(j = 0;j < HRIR_LENGTH;j++) - { - hrtfparams.Steps.Coeffs[j][0] = 0.0f; - hrtfparams.Steps.Coeffs[j][1] = 0.0f; - } - hrtfparams.Steps.Delay[0] = 0; - hrtfparams.Steps.Delay[1] = 0; - } - else - { - ALfloat delta = 1.0f / (ALfloat)Counter; - ALfloat coeffdiff; - ALint delaydiff; - for(j = 0;j < IrSize;j++) - { - coeffdiff = parms->Hrtf.Target.Coeffs[j][0] - parms->Hrtf.Current.Coeffs[j][0]; - hrtfparams.Steps.Coeffs[j][0] = coeffdiff * delta; - coeffdiff = parms->Hrtf.Target.Coeffs[j][1] - parms->Hrtf.Current.Coeffs[j][1]; - hrtfparams.Steps.Coeffs[j][1] = coeffdiff * delta; - } - delaydiff = (ALint)(parms->Hrtf.Target.Delay[0] - parms->Hrtf.Current.Delay[0]); - hrtfparams.Steps.Delay[0] = fastf2i((ALfloat)delaydiff * delta); - delaydiff = (ALint)(parms->Hrtf.Target.Delay[1] - parms->Hrtf.Current.Delay[1]); - hrtfparams.Steps.Delay[1] = fastf2i((ALfloat)delaydiff * delta); - } - hrtfparams.Target = &parms->Hrtf.Target; - hrtfparams.Current = &parms->Hrtf.Current; - - lidx = GetChannelIdxByName(Device->RealOut, FrontLeft); - ridx = GetChannelIdxByName(Device->RealOut, FrontRight); - assert(lidx != -1 && ridx != -1); - - MixHrtfSamples(voice->DirectOut.Buffer, lidx, ridx, samples, Counter, - voice->Offset, OutPos, IrSize, &hrtfparams, - &parms->Hrtf.State, DstBufferSize); - } - } - - for(send = 0;send < Device->NumAuxSends;send++) - { - SendParams *parms = &voice->Chan[chan].Send[send]; - const ALfloat *samples; - - if(!voice->SendOut[send].Buffer) - continue; - - samples = DoFilters( - &parms->LowPass, &parms->HighPass, Device->FilteredData, - ResampledData, DstBufferSize, parms->FilterType - ); - - if(!Counter) - memcpy(parms->Gains.Current, parms->Gains.Target, - sizeof(parms->Gains.Current)); - MixSamples(samples, voice->SendOut[send].Channels, voice->SendOut[send].Buffer, - parms->Gains.Current, parms->Gains.Target, Counter, OutPos, DstBufferSize - ); - } - } - /* Update positions */ - DataPosFrac += increment*DstBufferSize; - DataPosInt += DataPosFrac>>FRACTIONBITS; - DataPosFrac &= FRACTIONMASK; - - OutPos += DstBufferSize; - voice->Offset += DstBufferSize; - Counter = maxu(DstBufferSize, Counter) - DstBufferSize; - - /* Handle looping sources */ - while(1) - { - const ALbuffer *ALBuffer; - ALuint DataSize = 0; - ALuint LoopStart = 0; - ALuint LoopEnd = 0; - - if((ALBuffer=BufferListItem->buffer) != NULL) - { - DataSize = ALBuffer->SampleLen; - LoopStart = ALBuffer->LoopStart; - LoopEnd = ALBuffer->LoopEnd; - if(LoopEnd > DataPosInt) - break; - } - - if(Looping && Source->SourceType == AL_STATIC) - { - assert(LoopEnd > LoopStart); - DataPosInt = ((DataPosInt-LoopStart)%(LoopEnd-LoopStart)) + LoopStart; - break; - } - - if(DataSize > DataPosInt) - break; - - if(!(BufferListItem=BufferListItem->next)) - { - if(Looping) - BufferListItem = ATOMIC_LOAD(&Source->queue); - else - { - State = AL_STOPPED; - BufferListItem = NULL; - DataPosInt = 0; - DataPosFrac = 0; - break; - } - } - - DataPosInt -= DataSize; - } - } while(State == AL_PLAYING && OutPos < SamplesToDo); - - voice->Moving = AL_TRUE; - - /* Update source info */ - Source->state = State; - ATOMIC_STORE(&Source->current_buffer, BufferListItem, almemory_order_relaxed); - ATOMIC_STORE(&Source->position, DataPosInt, almemory_order_relaxed); - ATOMIC_STORE(&Source->position_fraction, DataPosFrac); -} diff --git a/Engine/lib/openal-soft/Alc/mixer/defs.h b/Engine/lib/openal-soft/Alc/mixer/defs.h new file mode 100644 index 000000000..fe19cef4f --- /dev/null +++ b/Engine/lib/openal-soft/Alc/mixer/defs.h @@ -0,0 +1,119 @@ +#ifndef MIXER_DEFS_H +#define MIXER_DEFS_H + +#include "AL/alc.h" +#include "AL/al.h" +#include "alMain.h" +#include "alu.h" + +struct MixGains; + +struct MixHrtfParams; +struct HrtfState; + +/* C resamplers */ +const ALfloat *Resample_copy_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); +const ALfloat *Resample_point_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); +const ALfloat *Resample_lerp_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); +const ALfloat *Resample_cubic_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); +const ALfloat *Resample_bsinc_C(const InterpState *state, const ALfloat *restrict src, ALsizei frac, ALint increment, ALfloat *restrict dst, ALsizei dstlen); + + +/* C mixers */ +void MixHrtf_C(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, ALsizei OutPos, + const ALsizei IrSize, struct MixHrtfParams *hrtfparams, + struct HrtfState *hrtfstate, ALsizei BufferSize); +void MixHrtfBlend_C(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, ALsizei OutPos, + const ALsizei IrSize, const HrtfParams *oldparams, + MixHrtfParams *newparams, HrtfState *hrtfstate, + ALsizei BufferSize); +void MixDirectHrtf_C(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, const ALsizei IrSize, + const ALfloat (*restrict Coeffs)[2], ALfloat (*restrict Values)[2], + ALsizei BufferSize); +void Mix_C(const ALfloat *data, ALsizei OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], + ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos, + ALsizei BufferSize); +void MixRow_C(ALfloat *OutBuffer, const ALfloat *Gains, + const ALfloat (*restrict data)[BUFFERSIZE], ALsizei InChans, + ALsizei InPos, ALsizei BufferSize); + +/* SSE mixers */ +void MixHrtf_SSE(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, ALsizei OutPos, + const ALsizei IrSize, struct MixHrtfParams *hrtfparams, + struct HrtfState *hrtfstate, ALsizei BufferSize); +void MixHrtfBlend_SSE(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, ALsizei OutPos, + const ALsizei IrSize, const HrtfParams *oldparams, + MixHrtfParams *newparams, HrtfState *hrtfstate, + ALsizei BufferSize); +void MixDirectHrtf_SSE(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, const ALsizei IrSize, + const ALfloat (*restrict Coeffs)[2], ALfloat (*restrict Values)[2], + ALsizei BufferSize); +void Mix_SSE(const ALfloat *data, ALsizei OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], + ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos, + ALsizei BufferSize); +void MixRow_SSE(ALfloat *OutBuffer, const ALfloat *Gains, + const ALfloat (*restrict data)[BUFFERSIZE], ALsizei InChans, + ALsizei InPos, ALsizei BufferSize); + +/* SSE resamplers */ +inline void InitiatePositionArrays(ALsizei frac, ALint increment, ALsizei *restrict frac_arr, ALint *restrict pos_arr, ALsizei size) +{ + ALsizei i; + + pos_arr[0] = 0; + frac_arr[0] = frac; + for(i = 1;i < size;i++) + { + ALint frac_tmp = frac_arr[i-1] + increment; + pos_arr[i] = pos_arr[i-1] + (frac_tmp>>FRACTIONBITS); + frac_arr[i] = frac_tmp&FRACTIONMASK; + } +} + +const ALfloat *Resample_lerp_SSE2(const InterpState *state, const ALfloat *restrict src, + ALsizei frac, ALint increment, ALfloat *restrict dst, + ALsizei numsamples); +const ALfloat *Resample_lerp_SSE41(const InterpState *state, const ALfloat *restrict src, + ALsizei frac, ALint increment, ALfloat *restrict dst, + ALsizei numsamples); + +const ALfloat *Resample_bsinc_SSE(const InterpState *state, const ALfloat *restrict src, + ALsizei frac, ALint increment, ALfloat *restrict dst, + ALsizei dstlen); + +/* Neon mixers */ +void MixHrtf_Neon(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, ALsizei OutPos, + const ALsizei IrSize, struct MixHrtfParams *hrtfparams, + struct HrtfState *hrtfstate, ALsizei BufferSize); +void MixHrtfBlend_Neon(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, ALsizei OutPos, + const ALsizei IrSize, const HrtfParams *oldparams, + MixHrtfParams *newparams, HrtfState *hrtfstate, + ALsizei BufferSize); +void MixDirectHrtf_Neon(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, const ALsizei IrSize, + const ALfloat (*restrict Coeffs)[2], ALfloat (*restrict Values)[2], + ALsizei BufferSize); +void Mix_Neon(const ALfloat *data, ALsizei OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], + ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos, + ALsizei BufferSize); +void MixRow_Neon(ALfloat *OutBuffer, const ALfloat *Gains, + const ALfloat (*restrict data)[BUFFERSIZE], ALsizei InChans, + ALsizei InPos, ALsizei BufferSize); + +/* Neon resamplers */ +const ALfloat *Resample_lerp_Neon(const InterpState *state, const ALfloat *restrict src, + ALsizei frac, ALint increment, ALfloat *restrict dst, + ALsizei numsamples); +const ALfloat *Resample_bsinc_Neon(const InterpState *state, const ALfloat *restrict src, + ALsizei frac, ALint increment, ALfloat *restrict dst, + ALsizei dstlen); + +#endif /* MIXER_DEFS_H */ diff --git a/Engine/lib/openal-soft/Alc/mixer/hrtf_inc.c b/Engine/lib/openal-soft/Alc/mixer/hrtf_inc.c new file mode 100644 index 000000000..d6bd8042c --- /dev/null +++ b/Engine/lib/openal-soft/Alc/mixer/hrtf_inc.c @@ -0,0 +1,123 @@ +#include "config.h" + +#include "alMain.h" +#include "alSource.h" + +#include "hrtf.h" +#include "align.h" +#include "alu.h" +#include "defs.h" + + +static inline void ApplyCoeffs(ALsizei Offset, ALfloat (*restrict Values)[2], + const ALsizei irSize, + const ALfloat (*restrict Coeffs)[2], + ALfloat left, ALfloat right); + + +void MixHrtf(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, ALsizei OutPos, + const ALsizei IrSize, MixHrtfParams *hrtfparams, HrtfState *hrtfstate, + ALsizei BufferSize) +{ + const ALfloat (*Coeffs)[2] = ASSUME_ALIGNED(hrtfparams->Coeffs, 16); + const ALsizei Delay[2] = { hrtfparams->Delay[0], hrtfparams->Delay[1] }; + ALfloat gainstep = hrtfparams->GainStep; + ALfloat gain = hrtfparams->Gain; + ALfloat left, right; + ALsizei i; + + ASSUME(IrSize >= 4); + ASSUME(BufferSize > 0); + + LeftOut += OutPos; + RightOut += OutPos; + for(i = 0;i < BufferSize;i++) + { + hrtfstate->History[Offset&HRTF_HISTORY_MASK] = *(data++); + left = hrtfstate->History[(Offset-Delay[0])&HRTF_HISTORY_MASK]*gain; + right = hrtfstate->History[(Offset-Delay[1])&HRTF_HISTORY_MASK]*gain; + + hrtfstate->Values[(Offset+IrSize-1)&HRIR_MASK][0] = 0.0f; + hrtfstate->Values[(Offset+IrSize-1)&HRIR_MASK][1] = 0.0f; + + ApplyCoeffs(Offset, hrtfstate->Values, IrSize, Coeffs, left, right); + *(LeftOut++) += hrtfstate->Values[Offset&HRIR_MASK][0]; + *(RightOut++) += hrtfstate->Values[Offset&HRIR_MASK][1]; + + gain += gainstep; + Offset++; + } + hrtfparams->Gain = gain; +} + +void MixHrtfBlend(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, ALsizei OutPos, + const ALsizei IrSize, const HrtfParams *oldparams, + MixHrtfParams *newparams, HrtfState *hrtfstate, + ALsizei BufferSize) +{ + const ALfloat (*OldCoeffs)[2] = ASSUME_ALIGNED(oldparams->Coeffs, 16); + const ALsizei OldDelay[2] = { oldparams->Delay[0], oldparams->Delay[1] }; + ALfloat oldGain = oldparams->Gain; + ALfloat oldGainStep = -oldGain / (ALfloat)BufferSize; + const ALfloat (*NewCoeffs)[2] = ASSUME_ALIGNED(newparams->Coeffs, 16); + const ALsizei NewDelay[2] = { newparams->Delay[0], newparams->Delay[1] }; + ALfloat newGain = newparams->Gain; + ALfloat newGainStep = newparams->GainStep; + ALfloat left, right; + ALsizei i; + + ASSUME(IrSize >= 4); + ASSUME(BufferSize > 0); + + LeftOut += OutPos; + RightOut += OutPos; + for(i = 0;i < BufferSize;i++) + { + hrtfstate->Values[(Offset+IrSize-1)&HRIR_MASK][0] = 0.0f; + hrtfstate->Values[(Offset+IrSize-1)&HRIR_MASK][1] = 0.0f; + + hrtfstate->History[Offset&HRTF_HISTORY_MASK] = *(data++); + + left = hrtfstate->History[(Offset-OldDelay[0])&HRTF_HISTORY_MASK]*oldGain; + right = hrtfstate->History[(Offset-OldDelay[1])&HRTF_HISTORY_MASK]*oldGain; + ApplyCoeffs(Offset, hrtfstate->Values, IrSize, OldCoeffs, left, right); + + left = hrtfstate->History[(Offset-NewDelay[0])&HRTF_HISTORY_MASK]*newGain; + right = hrtfstate->History[(Offset-NewDelay[1])&HRTF_HISTORY_MASK]*newGain; + ApplyCoeffs(Offset, hrtfstate->Values, IrSize, NewCoeffs, left, right); + + *(LeftOut++) += hrtfstate->Values[Offset&HRIR_MASK][0]; + *(RightOut++) += hrtfstate->Values[Offset&HRIR_MASK][1]; + + oldGain += oldGainStep; + newGain += newGainStep; + Offset++; + } + newparams->Gain = newGain; +} + +void MixDirectHrtf(ALfloat *restrict LeftOut, ALfloat *restrict RightOut, + const ALfloat *data, ALsizei Offset, const ALsizei IrSize, + const ALfloat (*restrict Coeffs)[2], ALfloat (*restrict Values)[2], + ALsizei BufferSize) +{ + ALfloat insample; + ALsizei i; + + ASSUME(IrSize >= 4); + ASSUME(BufferSize > 0); + + for(i = 0;i < BufferSize;i++) + { + Values[(Offset+IrSize)&HRIR_MASK][0] = 0.0f; + Values[(Offset+IrSize)&HRIR_MASK][1] = 0.0f; + Offset++; + + insample = *(data++); + ApplyCoeffs(Offset, Values, IrSize, Coeffs, insample, insample); + *(LeftOut++) += Values[Offset&HRIR_MASK][0]; + *(RightOut++) += Values[Offset&HRIR_MASK][1]; + } +} diff --git a/Engine/lib/openal-soft/Alc/mixer/mixer_c.c b/Engine/lib/openal-soft/Alc/mixer/mixer_c.c new file mode 100644 index 000000000..844852060 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/mixer/mixer_c.c @@ -0,0 +1,176 @@ +#include "config.h" + +#include + +#include "alMain.h" +#include "alu.h" +#include "alSource.h" +#include "alAuxEffectSlot.h" +#include "defs.h" + + +static inline ALfloat do_point(const ALfloat *restrict vals, ALsizei UNUSED(frac)) +{ return vals[0]; } +static inline ALfloat do_lerp(const ALfloat *restrict vals, ALsizei frac) +{ return lerp(vals[0], vals[1], frac * (1.0f/FRACTIONONE)); } +static inline ALfloat do_cubic(const ALfloat *restrict vals, ALsizei frac) +{ return cubic(vals[0], vals[1], vals[2], vals[3], frac * (1.0f/FRACTIONONE)); } + +const ALfloat *Resample_copy_C(const InterpState* UNUSED(state), + const ALfloat *restrict src, ALsizei UNUSED(frac), ALint UNUSED(increment), + ALfloat *restrict dst, ALsizei numsamples) +{ +#if defined(HAVE_SSE) || defined(HAVE_NEON) + /* Avoid copying the source data if it's aligned like the destination. */ + if((((intptr_t)src)&15) == (((intptr_t)dst)&15)) + return src; +#endif + memcpy(dst, src, numsamples*sizeof(ALfloat)); + return dst; +} + +#define DECL_TEMPLATE(Tag, Sampler, O) \ +const ALfloat *Resample_##Tag##_C(const InterpState* UNUSED(state), \ + const ALfloat *restrict src, ALsizei frac, ALint increment, \ + ALfloat *restrict dst, ALsizei numsamples) \ +{ \ + ALsizei i; \ + \ + src -= O; \ + for(i = 0;i < numsamples;i++) \ + { \ + dst[i] = Sampler(src, frac); \ + \ + frac += increment; \ + src += frac>>FRACTIONBITS; \ + frac &= FRACTIONMASK; \ + } \ + return dst; \ +} + +DECL_TEMPLATE(point, do_point, 0) +DECL_TEMPLATE(lerp, do_lerp, 0) +DECL_TEMPLATE(cubic, do_cubic, 1) + +#undef DECL_TEMPLATE + +const ALfloat *Resample_bsinc_C(const InterpState *state, const ALfloat *restrict src, + ALsizei frac, ALint increment, ALfloat *restrict dst, + ALsizei dstlen) +{ + const ALfloat *fil, *scd, *phd, *spd; + const ALfloat *const filter = state->bsinc.filter; + const ALfloat sf = state->bsinc.sf; + const ALsizei m = state->bsinc.m; + ALsizei j_f, pi, i; + ALfloat pf, r; + + ASSUME(m > 0); + + src += state->bsinc.l; + for(i = 0;i < dstlen;i++) + { + // Calculate the phase index and factor. +#define FRAC_PHASE_BITDIFF (FRACTIONBITS-BSINC_PHASE_BITS) + pi = frac >> FRAC_PHASE_BITDIFF; + pf = (frac & ((1<>FRACTIONBITS; + frac &= FRACTIONMASK; + } + return dst; +} + + +static inline void ApplyCoeffs(ALsizei Offset, ALfloat (*restrict Values)[2], + const ALsizei IrSize, + const ALfloat (*restrict Coeffs)[2], + ALfloat left, ALfloat right) +{ + ALsizei c; + for(c = 0;c < IrSize;c++) + { + const ALsizei off = (Offset+c)&HRIR_MASK; + Values[off][0] += Coeffs[c][0] * left; + Values[off][1] += Coeffs[c][1] * right; + } +} + +#define MixHrtf MixHrtf_C +#define MixHrtfBlend MixHrtfBlend_C +#define MixDirectHrtf MixDirectHrtf_C +#include "hrtf_inc.c" + + +void Mix_C(const ALfloat *data, ALsizei OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], + ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos, + ALsizei BufferSize) +{ + ALfloat gain, delta, step; + ALsizei c; + + ASSUME(OutChans > 0); + ASSUME(BufferSize > 0); + delta = (Counter > 0) ? 1.0f/(ALfloat)Counter : 0.0f; + + for(c = 0;c < OutChans;c++) + { + ALsizei pos = 0; + gain = CurrentGains[c]; + step = (TargetGains[c] - gain) * delta; + if(fabsf(step) > FLT_EPSILON) + { + ALsizei minsize = mini(BufferSize, Counter); + for(;pos < minsize;pos++) + { + OutBuffer[c][OutPos+pos] += data[pos]*gain; + gain += step; + } + if(pos == Counter) + gain = TargetGains[c]; + CurrentGains[c] = gain; + } + + if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) + continue; + for(;pos < BufferSize;pos++) + OutBuffer[c][OutPos+pos] += data[pos]*gain; + } +} + +/* Basically the inverse of the above. Rather than one input going to multiple + * outputs (each with its own gain), it's multiple inputs (each with its own + * gain) going to one output. This applies one row (vs one column) of a matrix + * transform. And as the matrices are more or less static once set up, no + * stepping is necessary. + */ +void MixRow_C(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*restrict data)[BUFFERSIZE], ALsizei InChans, ALsizei InPos, ALsizei BufferSize) +{ + ALsizei c, i; + + ASSUME(InChans > 0); + ASSUME(BufferSize > 0); + + for(c = 0;c < InChans;c++) + { + ALfloat gain = Gains[c]; + if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) + continue; + + for(i = 0;i < BufferSize;i++) + OutBuffer[i] += data[c][InPos+i] * gain; + } +} diff --git a/Engine/lib/openal-soft/Alc/mixer/mixer_neon.c b/Engine/lib/openal-soft/Alc/mixer/mixer_neon.c new file mode 100644 index 000000000..1a5e8ee77 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/mixer/mixer_neon.c @@ -0,0 +1,269 @@ +#include "config.h" + +#include + +#include "AL/al.h" +#include "AL/alc.h" +#include "alMain.h" +#include "alu.h" +#include "hrtf.h" +#include "defs.h" + + +const ALfloat *Resample_lerp_Neon(const InterpState* UNUSED(state), + const ALfloat *restrict src, ALsizei frac, ALint increment, + ALfloat *restrict dst, ALsizei numsamples) +{ + const int32x4_t increment4 = vdupq_n_s32(increment*4); + const float32x4_t fracOne4 = vdupq_n_f32(1.0f/FRACTIONONE); + const int32x4_t fracMask4 = vdupq_n_s32(FRACTIONMASK); + alignas(16) ALint pos_[4]; + alignas(16) ALsizei frac_[4]; + int32x4_t pos4; + int32x4_t frac4; + ALsizei i; + + ASSUME(numsamples > 0); + + InitiatePositionArrays(frac, increment, frac_, pos_, 4); + + frac4 = vld1q_s32(frac_); + pos4 = vld1q_s32(pos_); + + for(i = 0;numsamples-i > 3;i += 4) + { + const float32x4_t val1 = (float32x4_t){src[pos_[0]], src[pos_[1]], src[pos_[2]], src[pos_[3]]}; + const float32x4_t val2 = (float32x4_t){src[pos_[0]+1], src[pos_[1]+1], src[pos_[2]+1], src[pos_[3]+1]}; + + /* val1 + (val2-val1)*mu */ + const float32x4_t r0 = vsubq_f32(val2, val1); + const float32x4_t mu = vmulq_f32(vcvtq_f32_s32(frac4), fracOne4); + const float32x4_t out = vmlaq_f32(val1, mu, r0); + + vst1q_f32(&dst[i], out); + + frac4 = vaddq_s32(frac4, increment4); + pos4 = vaddq_s32(pos4, vshrq_n_s32(frac4, FRACTIONBITS)); + frac4 = vandq_s32(frac4, fracMask4); + + vst1q_s32(pos_, pos4); + } + + if(i < numsamples) + { + /* NOTE: These four elements represent the position *after* the last + * four samples, so the lowest element is the next position to + * resample. + */ + ALint pos = pos_[0]; + frac = vgetq_lane_s32(frac4, 0); + do { + dst[i] = lerp(src[pos], src[pos+1], frac * (1.0f/FRACTIONONE)); + + frac += increment; + pos += frac>>FRACTIONBITS; + frac &= FRACTIONMASK; + } while(++i < numsamples); + } + return dst; +} + +const ALfloat *Resample_bsinc_Neon(const InterpState *state, + const ALfloat *restrict src, ALsizei frac, ALint increment, + ALfloat *restrict dst, ALsizei dstlen) +{ + const ALfloat *const filter = state->bsinc.filter; + const float32x4_t sf4 = vdupq_n_f32(state->bsinc.sf); + const ALsizei m = state->bsinc.m; + const float32x4_t *fil, *scd, *phd, *spd; + ALsizei pi, i, j, offset; + float32x4_t r4; + ALfloat pf; + + ASSUME(m > 0); + ASSUME(dstlen > 0); + + src += state->bsinc.l; + for(i = 0;i < dstlen;i++) + { + // Calculate the phase index and factor. +#define FRAC_PHASE_BITDIFF (FRACTIONBITS-BSINC_PHASE_BITS) + pi = frac >> FRAC_PHASE_BITDIFF; + pf = (frac & ((1<>FRACTIONBITS; + frac &= FRACTIONMASK; + } + return dst; +} + + +static inline void ApplyCoeffs(ALsizei Offset, ALfloat (*restrict Values)[2], + const ALsizei IrSize, + const ALfloat (*restrict Coeffs)[2], + ALfloat left, ALfloat right) +{ + ALsizei c; + float32x4_t leftright4; + { + float32x2_t leftright2 = vdup_n_f32(0.0); + leftright2 = vset_lane_f32(left, leftright2, 0); + leftright2 = vset_lane_f32(right, leftright2, 1); + leftright4 = vcombine_f32(leftright2, leftright2); + } + Values = ASSUME_ALIGNED(Values, 16); + Coeffs = ASSUME_ALIGNED(Coeffs, 16); + for(c = 0;c < IrSize;c += 2) + { + const ALsizei o0 = (Offset+c)&HRIR_MASK; + const ALsizei o1 = (o0+1)&HRIR_MASK; + float32x4_t vals = vcombine_f32(vld1_f32((float32_t*)&Values[o0][0]), + vld1_f32((float32_t*)&Values[o1][0])); + float32x4_t coefs = vld1q_f32((float32_t*)&Coeffs[c][0]); + + vals = vmlaq_f32(vals, coefs, leftright4); + + vst1_f32((float32_t*)&Values[o0][0], vget_low_f32(vals)); + vst1_f32((float32_t*)&Values[o1][0], vget_high_f32(vals)); + } +} + +#define MixHrtf MixHrtf_Neon +#define MixHrtfBlend MixHrtfBlend_Neon +#define MixDirectHrtf MixDirectHrtf_Neon +#include "hrtf_inc.c" + + +void Mix_Neon(const ALfloat *data, ALsizei OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], + ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos, + ALsizei BufferSize) +{ + ALfloat gain, delta, step; + float32x4_t gain4; + ALsizei c; + + ASSUME(OutChans > 0); + ASSUME(BufferSize > 0); + data = ASSUME_ALIGNED(data, 16); + OutBuffer = ASSUME_ALIGNED(OutBuffer, 16); + + delta = (Counter > 0) ? 1.0f/(ALfloat)Counter : 0.0f; + + for(c = 0;c < OutChans;c++) + { + ALsizei pos = 0; + gain = CurrentGains[c]; + step = (TargetGains[c] - gain) * delta; + if(fabsf(step) > FLT_EPSILON) + { + ALsizei minsize = mini(BufferSize, Counter); + /* Mix with applying gain steps in aligned multiples of 4. */ + if(minsize-pos > 3) + { + float32x4_t step4; + gain4 = vsetq_lane_f32(gain, gain4, 0); + gain4 = vsetq_lane_f32(gain + step, gain4, 1); + gain4 = vsetq_lane_f32(gain + step + step, gain4, 2); + gain4 = vsetq_lane_f32(gain + step + step + step, gain4, 3); + step4 = vdupq_n_f32(step + step + step + step); + do { + const float32x4_t val4 = vld1q_f32(&data[pos]); + float32x4_t dry4 = vld1q_f32(&OutBuffer[c][OutPos+pos]); + dry4 = vmlaq_f32(dry4, val4, gain4); + gain4 = vaddq_f32(gain4, step4); + vst1q_f32(&OutBuffer[c][OutPos+pos], dry4); + pos += 4; + } while(minsize-pos > 3); + /* NOTE: gain4 now represents the next four gains after the + * last four mixed samples, so the lowest element represents + * the next gain to apply. + */ + gain = vgetq_lane_f32(gain4, 0); + } + /* Mix with applying left over gain steps that aren't aligned multiples of 4. */ + for(;pos < minsize;pos++) + { + OutBuffer[c][OutPos+pos] += data[pos]*gain; + gain += step; + } + if(pos == Counter) + gain = TargetGains[c]; + CurrentGains[c] = gain; + + /* Mix until pos is aligned with 4 or the mix is done. */ + minsize = mini(BufferSize, (pos+3)&~3); + for(;pos < minsize;pos++) + OutBuffer[c][OutPos+pos] += data[pos]*gain; + } + + if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) + continue; + gain4 = vdupq_n_f32(gain); + for(;BufferSize-pos > 3;pos += 4) + { + const float32x4_t val4 = vld1q_f32(&data[pos]); + float32x4_t dry4 = vld1q_f32(&OutBuffer[c][OutPos+pos]); + dry4 = vmlaq_f32(dry4, val4, gain4); + vst1q_f32(&OutBuffer[c][OutPos+pos], dry4); + } + for(;pos < BufferSize;pos++) + OutBuffer[c][OutPos+pos] += data[pos]*gain; + } +} + +void MixRow_Neon(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*restrict data)[BUFFERSIZE], ALsizei InChans, ALsizei InPos, ALsizei BufferSize) +{ + float32x4_t gain4; + ALsizei c; + + ASSUME(InChans > 0); + ASSUME(BufferSize > 0); + data = ASSUME_ALIGNED(data, 16); + OutBuffer = ASSUME_ALIGNED(OutBuffer, 16); + + for(c = 0;c < InChans;c++) + { + ALsizei pos = 0; + ALfloat gain = Gains[c]; + if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) + continue; + + gain4 = vdupq_n_f32(gain); + for(;BufferSize-pos > 3;pos += 4) + { + const float32x4_t val4 = vld1q_f32(&data[c][InPos+pos]); + float32x4_t dry4 = vld1q_f32(&OutBuffer[pos]); + dry4 = vmlaq_f32(dry4, val4, gain4); + vst1q_f32(&OutBuffer[pos], dry4); + } + for(;pos < BufferSize;pos++) + OutBuffer[pos] += data[c][InPos+pos]*gain; + } +} diff --git a/Engine/lib/openal-soft/Alc/mixer_sse.c b/Engine/lib/openal-soft/Alc/mixer/mixer_sse.c similarity index 55% rename from Engine/lib/openal-soft/Alc/mixer_sse.c rename to Engine/lib/openal-soft/Alc/mixer/mixer_sse.c index f5e21e23d..a178477f8 100644 --- a/Engine/lib/openal-soft/Alc/mixer_sse.c +++ b/Engine/lib/openal-soft/Alc/mixer/mixer_sse.c @@ -9,22 +9,25 @@ #include "alSource.h" #include "alAuxEffectSlot.h" -#include "mixer_defs.h" +#include "defs.h" -const ALfloat *Resample_bsinc32_SSE(const BsincState *state, const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint dstlen) +const ALfloat *Resample_bsinc_SSE(const InterpState *state, const ALfloat *restrict src, + ALsizei frac, ALint increment, ALfloat *restrict dst, + ALsizei dstlen) { - const __m128 sf4 = _mm_set1_ps(state->sf); - const ALuint m = state->m; - const ALint l = state->l; - const ALfloat *fil, *scd, *phd, *spd; - ALuint pi, j_f, i; + const ALfloat *const filter = state->bsinc.filter; + const __m128 sf4 = _mm_set1_ps(state->bsinc.sf); + const ALsizei m = state->bsinc.m; + const __m128 *fil, *scd, *phd, *spd; + ALsizei pi, i, j, offset; ALfloat pf; - ALint j_s; __m128 r4; + ASSUME(m > 0); + ASSUME(dstlen > 0); + + src += state->bsinc.l; for(i = 0;i < dstlen;i++) { // Calculate the phase index and factor. @@ -33,32 +36,28 @@ const ALfloat *Resample_bsinc32_SSE(const BsincState *state, const ALfloat *rest pf = (frac & ((1<coeffs[pi].filter; - scd = state->coeffs[pi].scDelta; - phd = state->coeffs[pi].phDelta; - spd = state->coeffs[pi].spDelta; + offset = m*pi*4; + fil = (const __m128*)ASSUME_ALIGNED(filter + offset, 16); offset += m; + scd = (const __m128*)ASSUME_ALIGNED(filter + offset, 16); offset += m; + phd = (const __m128*)ASSUME_ALIGNED(filter + offset, 16); offset += m; + spd = (const __m128*)ASSUME_ALIGNED(filter + offset, 16); // Apply the scale and phase interpolated filter. r4 = _mm_setzero_ps(); { const __m128 pf4 = _mm_set1_ps(pf); - for(j_f = 0,j_s = l;j_f < m;j_f+=4,j_s+=4) +#define MLA4(x, y, z) _mm_add_ps(x, _mm_mul_ps(y, z)) + for(j = 0;j < m;j+=4,fil++,scd++,phd++,spd++) { - const __m128 f4 = _mm_add_ps( - _mm_add_ps( - _mm_load_ps(&fil[j_f]), - _mm_mul_ps(sf4, _mm_load_ps(&scd[j_f])) - ), - _mm_mul_ps( - pf4, - _mm_add_ps( - _mm_load_ps(&phd[j_f]), - _mm_mul_ps(sf4, _mm_load_ps(&spd[j_f])) - ) - ) + /* f = ((fil + sf*scd) + pf*(phd + sf*spd)) */ + const __m128 f4 = MLA4( + MLA4(*fil, sf4, *scd), + pf4, MLA4(*phd, sf4, *spd) ); - r4 = _mm_add_ps(r4, _mm_mul_ps(f4, _mm_loadu_ps(&src[j_s]))); + /* r += f*src */ + r4 = MLA4(r4, f4, _mm_loadu_ps(&src[j])); } +#undef MLA4 } r4 = _mm_add_ps(r4, _mm_shuffle_ps(r4, r4, _MM_SHUFFLE(0, 1, 2, 3))); r4 = _mm_add_ps(r4, _mm_movehl_ps(r4, r4)); @@ -72,82 +71,22 @@ const ALfloat *Resample_bsinc32_SSE(const BsincState *state, const ALfloat *rest } -static inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], - const ALfloat (*restrict CoeffStep)[2], - ALfloat left, ALfloat right) -{ - const __m128 lrlr = _mm_setr_ps(left, right, left, right); - __m128 coeffs, deltas, imp0, imp1; - __m128 vals = _mm_setzero_ps(); - ALuint i; - - if((Offset&1)) - { - const ALuint o0 = Offset&HRIR_MASK; - const ALuint o1 = (Offset+IrSize-1)&HRIR_MASK; - - coeffs = _mm_load_ps(&Coeffs[0][0]); - deltas = _mm_load_ps(&CoeffStep[0][0]); - vals = _mm_loadl_pi(vals, (__m64*)&Values[o0][0]); - imp0 = _mm_mul_ps(lrlr, coeffs); - coeffs = _mm_add_ps(coeffs, deltas); - vals = _mm_add_ps(imp0, vals); - _mm_store_ps(&Coeffs[0][0], coeffs); - _mm_storel_pi((__m64*)&Values[o0][0], vals); - for(i = 1;i < IrSize-1;i += 2) - { - const ALuint o2 = (Offset+i)&HRIR_MASK; - - coeffs = _mm_load_ps(&Coeffs[i+1][0]); - deltas = _mm_load_ps(&CoeffStep[i+1][0]); - vals = _mm_load_ps(&Values[o2][0]); - imp1 = _mm_mul_ps(lrlr, coeffs); - coeffs = _mm_add_ps(coeffs, deltas); - imp0 = _mm_shuffle_ps(imp0, imp1, _MM_SHUFFLE(1, 0, 3, 2)); - vals = _mm_add_ps(imp0, vals); - _mm_store_ps(&Coeffs[i+1][0], coeffs); - _mm_store_ps(&Values[o2][0], vals); - imp0 = imp1; - } - vals = _mm_loadl_pi(vals, (__m64*)&Values[o1][0]); - imp0 = _mm_movehl_ps(imp0, imp0); - vals = _mm_add_ps(imp0, vals); - _mm_storel_pi((__m64*)&Values[o1][0], vals); - } - else - { - for(i = 0;i < IrSize;i += 2) - { - const ALuint o = (Offset + i)&HRIR_MASK; - - coeffs = _mm_load_ps(&Coeffs[i][0]); - deltas = _mm_load_ps(&CoeffStep[i][0]); - vals = _mm_load_ps(&Values[o][0]); - imp0 = _mm_mul_ps(lrlr, coeffs); - coeffs = _mm_add_ps(coeffs, deltas); - vals = _mm_add_ps(imp0, vals); - _mm_store_ps(&Coeffs[i][0], coeffs); - _mm_store_ps(&Values[o][0], vals); - } - } -} - -static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], +static inline void ApplyCoeffs(ALsizei Offset, ALfloat (*restrict Values)[2], + const ALsizei IrSize, + const ALfloat (*restrict Coeffs)[2], ALfloat left, ALfloat right) { const __m128 lrlr = _mm_setr_ps(left, right, left, right); __m128 vals = _mm_setzero_ps(); __m128 coeffs; - ALuint i; + ALsizei i; + Values = ASSUME_ALIGNED(Values, 16); + Coeffs = ASSUME_ALIGNED(Coeffs, 16); if((Offset&1)) { - const ALuint o0 = Offset&HRIR_MASK; - const ALuint o1 = (Offset+IrSize-1)&HRIR_MASK; + const ALsizei o0 = Offset&HRIR_MASK; + const ALsizei o1 = (Offset+IrSize-1)&HRIR_MASK; __m128 imp0, imp1; coeffs = _mm_load_ps(&Coeffs[0][0]); @@ -157,7 +96,7 @@ static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], _mm_storel_pi((__m64*)&Values[o0][0], vals); for(i = 1;i < IrSize-1;i += 2) { - const ALuint o2 = (Offset+i)&HRIR_MASK; + const ALsizei o2 = (Offset+i)&HRIR_MASK; coeffs = _mm_load_ps(&Coeffs[i+1][0]); vals = _mm_load_ps(&Values[o2][0]); @@ -176,7 +115,7 @@ static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], { for(i = 0;i < IrSize;i += 2) { - const ALuint o = (Offset + i)&HRIR_MASK; + const ALsizei o = (Offset + i)&HRIR_MASK; coeffs = _mm_load_ps(&Coeffs[i][0]); vals = _mm_load_ps(&Values[o][0]); @@ -187,29 +126,31 @@ static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], } #define MixHrtf MixHrtf_SSE +#define MixHrtfBlend MixHrtfBlend_SSE #define MixDirectHrtf MixDirectHrtf_SSE -#include "mixer_inc.c" -#undef MixHrtf +#include "hrtf_inc.c" -void Mix_SSE(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], - ALfloat *CurrentGains, const ALfloat *TargetGains, ALuint Counter, ALuint OutPos, - ALuint BufferSize) +void Mix_SSE(const ALfloat *data, ALsizei OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], + ALfloat *CurrentGains, const ALfloat *TargetGains, ALsizei Counter, ALsizei OutPos, + ALsizei BufferSize) { ALfloat gain, delta, step; __m128 gain4; - ALuint c; + ALsizei c; + ASSUME(OutChans > 0); + ASSUME(BufferSize > 0); delta = (Counter > 0) ? 1.0f/(ALfloat)Counter : 0.0f; for(c = 0;c < OutChans;c++) { - ALuint pos = 0; + ALsizei pos = 0; gain = CurrentGains[c]; step = (TargetGains[c] - gain) * delta; if(fabsf(step) > FLT_EPSILON) { - ALuint minsize = minu(BufferSize, Counter); + ALsizei minsize = mini(BufferSize, Counter); /* Mix with applying gain steps in aligned multiples of 4. */ if(minsize-pos > 3) { @@ -246,7 +187,7 @@ void Mix_SSE(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer) CurrentGains[c] = gain; /* Mix until pos is aligned with 4 or the mix is done. */ - minsize = minu(BufferSize, (pos+3)&~3); + minsize = mini(BufferSize, (pos+3)&~3); for(;pos < minsize;pos++) OutBuffer[c][OutPos+pos] += data[pos]*gain; } @@ -266,14 +207,17 @@ void Mix_SSE(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer) } } -void MixRow_SSE(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*restrict data)[BUFFERSIZE], ALuint InChans, ALuint InPos, ALuint BufferSize) +void MixRow_SSE(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*restrict data)[BUFFERSIZE], ALsizei InChans, ALsizei InPos, ALsizei BufferSize) { __m128 gain4; - ALuint c; + ALsizei c; + + ASSUME(InChans > 0); + ASSUME(BufferSize > 0); for(c = 0;c < InChans;c++) { - ALuint pos = 0; + ALsizei pos = 0; ALfloat gain = Gains[c]; if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) continue; diff --git a/Engine/lib/openal-soft/Alc/mixer_sse2.c b/Engine/lib/openal-soft/Alc/mixer/mixer_sse2.c similarity index 86% rename from Engine/lib/openal-soft/Alc/mixer_sse2.c rename to Engine/lib/openal-soft/Alc/mixer/mixer_sse2.c index 22a18ef3d..4aeb6fc4c 100644 --- a/Engine/lib/openal-soft/Alc/mixer_sse2.c +++ b/Engine/lib/openal-soft/Alc/mixer/mixer_sse2.c @@ -24,21 +24,23 @@ #include #include "alu.h" -#include "mixer_defs.h" +#include "defs.h" -const ALfloat *Resample_lerp32_SSE2(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples) +const ALfloat *Resample_lerp_SSE2(const InterpState* UNUSED(state), + const ALfloat *restrict src, ALsizei frac, ALint increment, + ALfloat *restrict dst, ALsizei numsamples) { const __m128i increment4 = _mm_set1_epi32(increment*4); const __m128 fracOne4 = _mm_set1_ps(1.0f/FRACTIONONE); const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); - union { alignas(16) ALuint i[4]; float f[4]; } pos_; - union { alignas(16) ALuint i[4]; float f[4]; } frac_; + union { alignas(16) ALint i[4]; float f[4]; } pos_; + union { alignas(16) ALsizei i[4]; float f[4]; } frac_; __m128i frac4, pos4; - ALuint pos; - ALuint i; + ALint pos; + ALsizei i; + + ASSUME(numsamples > 0); InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4); diff --git a/Engine/lib/openal-soft/Alc/mixer/mixer_sse3.c b/Engine/lib/openal-soft/Alc/mixer/mixer_sse3.c new file mode 100644 index 000000000..e69de29bb diff --git a/Engine/lib/openal-soft/Alc/mixer/mixer_sse41.c b/Engine/lib/openal-soft/Alc/mixer/mixer_sse41.c new file mode 100644 index 000000000..98a3ef74b --- /dev/null +++ b/Engine/lib/openal-soft/Alc/mixer/mixer_sse41.c @@ -0,0 +1,88 @@ +/** + * OpenAL cross platform audio library + * Copyright (C) 2014 by Timothy Arceri . + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Or go to http://www.gnu.org/copyleft/lgpl.html + */ + +#include "config.h" + +#include +#include +#include + +#include "alu.h" +#include "defs.h" + + +const ALfloat *Resample_lerp_SSE41(const InterpState* UNUSED(state), + const ALfloat *restrict src, ALsizei frac, ALint increment, + ALfloat *restrict dst, ALsizei numsamples) +{ + const __m128i increment4 = _mm_set1_epi32(increment*4); + const __m128 fracOne4 = _mm_set1_ps(1.0f/FRACTIONONE); + const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); + union { alignas(16) ALint i[4]; float f[4]; } pos_; + union { alignas(16) ALsizei i[4]; float f[4]; } frac_; + __m128i frac4, pos4; + ALint pos; + ALsizei i; + + ASSUME(numsamples > 0); + + InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4); + + frac4 = _mm_castps_si128(_mm_load_ps(frac_.f)); + pos4 = _mm_castps_si128(_mm_load_ps(pos_.f)); + + for(i = 0;numsamples-i > 3;i += 4) + { + const __m128 val1 = _mm_setr_ps(src[pos_.i[0]], src[pos_.i[1]], src[pos_.i[2]], src[pos_.i[3]]); + const __m128 val2 = _mm_setr_ps(src[pos_.i[0]+1], src[pos_.i[1]+1], src[pos_.i[2]+1], src[pos_.i[3]+1]); + + /* val1 + (val2-val1)*mu */ + const __m128 r0 = _mm_sub_ps(val2, val1); + const __m128 mu = _mm_mul_ps(_mm_cvtepi32_ps(frac4), fracOne4); + const __m128 out = _mm_add_ps(val1, _mm_mul_ps(mu, r0)); + + _mm_store_ps(&dst[i], out); + + frac4 = _mm_add_epi32(frac4, increment4); + pos4 = _mm_add_epi32(pos4, _mm_srli_epi32(frac4, FRACTIONBITS)); + frac4 = _mm_and_si128(frac4, fracMask4); + + pos_.i[0] = _mm_extract_epi32(pos4, 0); + pos_.i[1] = _mm_extract_epi32(pos4, 1); + pos_.i[2] = _mm_extract_epi32(pos4, 2); + pos_.i[3] = _mm_extract_epi32(pos4, 3); + } + + /* NOTE: These four elements represent the position *after* the last four + * samples, so the lowest element is the next position to resample. + */ + pos = pos_.i[0]; + frac = _mm_cvtsi128_si32(frac4); + + for(;i < numsamples;i++) + { + dst[i] = lerp(src[pos], src[pos+1], frac * (1.0f/FRACTIONONE)); + + frac += increment; + pos += frac>>FRACTIONBITS; + frac &= FRACTIONMASK; + } + return dst; +} diff --git a/Engine/lib/openal-soft/Alc/mixer_c.c b/Engine/lib/openal-soft/Alc/mixer_c.c deleted file mode 100644 index 6ef818c78..000000000 --- a/Engine/lib/openal-soft/Alc/mixer_c.c +++ /dev/null @@ -1,228 +0,0 @@ -#include "config.h" - -#include - -#include "alMain.h" -#include "alu.h" -#include "alSource.h" -#include "alAuxEffectSlot.h" - - -static inline ALfloat point32(const ALfloat *restrict vals, ALuint UNUSED(frac)) -{ return vals[0]; } -static inline ALfloat lerp32(const ALfloat *restrict vals, ALuint frac) -{ return lerp(vals[0], vals[1], frac * (1.0f/FRACTIONONE)); } -static inline ALfloat fir4_32(const ALfloat *restrict vals, ALuint frac) -{ return resample_fir4(vals[-1], vals[0], vals[1], vals[2], frac); } -static inline ALfloat fir8_32(const ALfloat *restrict vals, ALuint frac) -{ return resample_fir8(vals[-3], vals[-2], vals[-1], vals[0], vals[1], vals[2], vals[3], vals[4], frac); } - - -const ALfloat *Resample_copy32_C(const BsincState* UNUSED(state), const ALfloat *restrict src, ALuint UNUSED(frac), - ALuint UNUSED(increment), ALfloat *restrict dst, ALuint numsamples) -{ -#if defined(HAVE_SSE) || defined(HAVE_NEON) - /* Avoid copying the source data if it's aligned like the destination. */ - if((((intptr_t)src)&15) == (((intptr_t)dst)&15)) - return src; -#endif - memcpy(dst, src, numsamples*sizeof(ALfloat)); - return dst; -} - -#define DECL_TEMPLATE(Sampler) \ -const ALfloat *Resample_##Sampler##_C(const BsincState* UNUSED(state), \ - const ALfloat *restrict src, ALuint frac, ALuint increment, \ - ALfloat *restrict dst, ALuint numsamples) \ -{ \ - ALuint i; \ - for(i = 0;i < numsamples;i++) \ - { \ - dst[i] = Sampler(src, frac); \ - \ - frac += increment; \ - src += frac>>FRACTIONBITS; \ - frac &= FRACTIONMASK; \ - } \ - return dst; \ -} - -DECL_TEMPLATE(point32) -DECL_TEMPLATE(lerp32) -DECL_TEMPLATE(fir4_32) -DECL_TEMPLATE(fir8_32) - -#undef DECL_TEMPLATE - -const ALfloat *Resample_bsinc32_C(const BsincState *state, const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint dstlen) -{ - const ALfloat *fil, *scd, *phd, *spd; - const ALfloat sf = state->sf; - const ALuint m = state->m; - const ALint l = state->l; - ALuint j_f, pi, i; - ALfloat pf, r; - ALint j_s; - - for(i = 0;i < dstlen;i++) - { - // Calculate the phase index and factor. -#define FRAC_PHASE_BITDIFF (FRACTIONBITS-BSINC_PHASE_BITS) - pi = frac >> FRAC_PHASE_BITDIFF; - pf = (frac & ((1<coeffs[pi].filter; - scd = state->coeffs[pi].scDelta; - phd = state->coeffs[pi].phDelta; - spd = state->coeffs[pi].spDelta; - - // Apply the scale and phase interpolated filter. - r = 0.0f; - for(j_f = 0,j_s = l;j_f < m;j_f++,j_s++) - r += (fil[j_f] + sf*scd[j_f] + pf*(phd[j_f] + sf*spd[j_f])) * - src[j_s]; - dst[i] = r; - - frac += increment; - src += frac>>FRACTIONBITS; - frac &= FRACTIONMASK; - } - return dst; -} - - -void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALuint numsamples) -{ - ALuint i; - if(numsamples > 1) - { - dst[0] = filter->b0 * src[0] + - filter->b1 * filter->x[0] + - filter->b2 * filter->x[1] - - filter->a1 * filter->y[0] - - filter->a2 * filter->y[1]; - dst[1] = filter->b0 * src[1] + - filter->b1 * src[0] + - filter->b2 * filter->x[0] - - filter->a1 * dst[0] - - filter->a2 * filter->y[0]; - for(i = 2;i < numsamples;i++) - dst[i] = filter->b0 * src[i] + - filter->b1 * src[i-1] + - filter->b2 * src[i-2] - - filter->a1 * dst[i-1] - - filter->a2 * dst[i-2]; - filter->x[0] = src[i-1]; - filter->x[1] = src[i-2]; - filter->y[0] = dst[i-1]; - filter->y[1] = dst[i-2]; - } - else if(numsamples == 1) - { - dst[0] = filter->b0 * src[0] + - filter->b1 * filter->x[0] + - filter->b2 * filter->x[1] - - filter->a1 * filter->y[0] - - filter->a2 * filter->y[1]; - filter->x[1] = filter->x[0]; - filter->x[0] = src[0]; - filter->y[1] = filter->y[0]; - filter->y[0] = dst[0]; - } -} - - -static inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], - const ALfloat (*restrict CoeffStep)[2], - ALfloat left, ALfloat right) -{ - ALuint c; - for(c = 0;c < IrSize;c++) - { - const ALuint off = (Offset+c)&HRIR_MASK; - Values[off][0] += Coeffs[c][0] * left; - Values[off][1] += Coeffs[c][1] * right; - Coeffs[c][0] += CoeffStep[c][0]; - Coeffs[c][1] += CoeffStep[c][1]; - } -} - -static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], - ALfloat left, ALfloat right) -{ - ALuint c; - for(c = 0;c < IrSize;c++) - { - const ALuint off = (Offset+c)&HRIR_MASK; - Values[off][0] += Coeffs[c][0] * left; - Values[off][1] += Coeffs[c][1] * right; - } -} - -#define MixHrtf MixHrtf_C -#define MixDirectHrtf MixDirectHrtf_C -#include "mixer_inc.c" -#undef MixHrtf - - -void Mix_C(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], - ALfloat *CurrentGains, const ALfloat *TargetGains, ALuint Counter, ALuint OutPos, - ALuint BufferSize) -{ - ALfloat gain, delta, step; - ALuint c; - - delta = (Counter > 0) ? 1.0f/(ALfloat)Counter : 0.0f; - - for(c = 0;c < OutChans;c++) - { - ALuint pos = 0; - gain = CurrentGains[c]; - step = (TargetGains[c] - gain) * delta; - if(fabsf(step) > FLT_EPSILON) - { - ALuint minsize = minu(BufferSize, Counter); - for(;pos < minsize;pos++) - { - OutBuffer[c][OutPos+pos] += data[pos]*gain; - gain += step; - } - if(pos == Counter) - gain = TargetGains[c]; - CurrentGains[c] = gain; - } - - if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) - continue; - for(;pos < BufferSize;pos++) - OutBuffer[c][OutPos+pos] += data[pos]*gain; - } -} - -/* Basically the inverse of the above. Rather than one input going to multiple - * outputs (each with its own gain), it's multiple inputs (each with its own - * gain) going to one output. This applies one row (vs one column) of a matrix - * transform. And as the matrices are more or less static once set up, no - * stepping is necessary. - */ -void MixRow_C(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*restrict data)[BUFFERSIZE], ALuint InChans, ALuint InPos, ALuint BufferSize) -{ - ALuint c, i; - - for(c = 0;c < InChans;c++) - { - ALfloat gain = Gains[c]; - if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) - continue; - - for(i = 0;i < BufferSize;i++) - OutBuffer[i] += data[c][InPos+i] * gain; - } -} diff --git a/Engine/lib/openal-soft/Alc/mixer_defs.h b/Engine/lib/openal-soft/Alc/mixer_defs.h deleted file mode 100644 index 249160025..000000000 --- a/Engine/lib/openal-soft/Alc/mixer_defs.h +++ /dev/null @@ -1,110 +0,0 @@ -#ifndef MIXER_DEFS_H -#define MIXER_DEFS_H - -#include "AL/alc.h" -#include "AL/al.h" -#include "alMain.h" -#include "alu.h" - -struct MixGains; - -struct MixHrtfParams; -struct HrtfState; - -/* C resamplers */ -const ALfloat *Resample_copy32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); -const ALfloat *Resample_point32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); -const ALfloat *Resample_lerp32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); -const ALfloat *Resample_fir4_32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); -const ALfloat *Resample_fir8_32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); -const ALfloat *Resample_bsinc32_C(const BsincState *state, const ALfloat *restrict src, ALuint frac, ALuint increment, ALfloat *restrict dst, ALuint dstlen); - - -/* C mixers */ -void MixHrtf_C(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint lidx, ALuint ridx, - const ALfloat *data, ALuint Counter, ALuint Offset, ALuint OutPos, - const ALuint IrSize, const struct MixHrtfParams *hrtfparams, - struct HrtfState *hrtfstate, ALuint BufferSize); -void MixDirectHrtf_C(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint lidx, ALuint ridx, - const ALfloat *data, ALuint Offset, const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], ALfloat (*restrict Values)[2], - ALuint BufferSize); -void Mix_C(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], - ALfloat *CurrentGains, const ALfloat *TargetGains, ALuint Counter, ALuint OutPos, - ALuint BufferSize); -void MixRow_C(ALfloat *OutBuffer, const ALfloat *Gains, - const ALfloat (*restrict data)[BUFFERSIZE], ALuint InChans, - ALuint InPos, ALuint BufferSize); - -/* SSE mixers */ -void MixHrtf_SSE(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint lidx, ALuint ridx, - const ALfloat *data, ALuint Counter, ALuint Offset, ALuint OutPos, - const ALuint IrSize, const struct MixHrtfParams *hrtfparams, - struct HrtfState *hrtfstate, ALuint BufferSize); -void MixDirectHrtf_SSE(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint lidx, ALuint ridx, - const ALfloat *data, ALuint Offset, const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], ALfloat (*restrict Values)[2], - ALuint BufferSize); -void Mix_SSE(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], - ALfloat *CurrentGains, const ALfloat *TargetGains, ALuint Counter, ALuint OutPos, - ALuint BufferSize); -void MixRow_SSE(ALfloat *OutBuffer, const ALfloat *Gains, - const ALfloat (*restrict data)[BUFFERSIZE], ALuint InChans, - ALuint InPos, ALuint BufferSize); - -/* SSE resamplers */ -inline void InitiatePositionArrays(ALuint frac, ALuint increment, ALuint *restrict frac_arr, ALuint *restrict pos_arr, ALuint size) -{ - ALuint i; - - pos_arr[0] = 0; - frac_arr[0] = frac; - for(i = 1;i < size;i++) - { - ALuint frac_tmp = frac_arr[i-1] + increment; - pos_arr[i] = pos_arr[i-1] + (frac_tmp>>FRACTIONBITS); - frac_arr[i] = frac_tmp&FRACTIONMASK; - } -} - -const ALfloat *Resample_bsinc32_SSE(const BsincState *state, const ALfloat *restrict src, ALuint frac, - ALuint increment, ALfloat *restrict dst, ALuint dstlen); - -const ALfloat *Resample_lerp32_SSE2(const BsincState *state, const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples); -const ALfloat *Resample_lerp32_SSE41(const BsincState *state, const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples); - -const ALfloat *Resample_fir4_32_SSE3(const BsincState *state, const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples); -const ALfloat *Resample_fir4_32_SSE41(const BsincState *state, const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples); - -const ALfloat *Resample_fir8_32_SSE3(const BsincState *state, const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples); -const ALfloat *Resample_fir8_32_SSE41(const BsincState *state, const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples); - -/* Neon mixers */ -void MixHrtf_Neon(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint lidx, ALuint ridx, - const ALfloat *data, ALuint Counter, ALuint Offset, ALuint OutPos, - const ALuint IrSize, const struct MixHrtfParams *hrtfparams, - struct HrtfState *hrtfstate, ALuint BufferSize); -void MixDirectHrtf_Neon(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint lidx, ALuint ridx, - const ALfloat *data, ALuint Offset, const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], ALfloat (*restrict Values)[2], - ALuint BufferSize); -void Mix_Neon(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], - ALfloat *CurrentGains, const ALfloat *TargetGains, ALuint Counter, ALuint OutPos, - ALuint BufferSize); -void MixRow_Neon(ALfloat *OutBuffer, const ALfloat *Gains, - const ALfloat (*restrict data)[BUFFERSIZE], ALuint InChans, - ALuint InPos, ALuint BufferSize); - -#endif /* MIXER_DEFS_H */ diff --git a/Engine/lib/openal-soft/Alc/mixer_inc.c b/Engine/lib/openal-soft/Alc/mixer_inc.c deleted file mode 100644 index 25dc2b588..000000000 --- a/Engine/lib/openal-soft/Alc/mixer_inc.c +++ /dev/null @@ -1,149 +0,0 @@ -#include "config.h" - -#include "alMain.h" -#include "alSource.h" - -#include "hrtf.h" -#include "mixer_defs.h" -#include "align.h" -#include "alu.h" - - -#define MAX_UPDATE_SAMPLES 128 - - -static inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint irSize, - ALfloat (*restrict Coeffs)[2], - const ALfloat (*restrict CoeffStep)[2], - ALfloat left, ALfloat right); -static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint irSize, - ALfloat (*restrict Coeffs)[2], - ALfloat left, ALfloat right); - - -void MixHrtf(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint lidx, ALuint ridx, - const ALfloat *data, ALuint Counter, ALuint Offset, ALuint OutPos, - const ALuint IrSize, const MixHrtfParams *hrtfparams, HrtfState *hrtfstate, - ALuint BufferSize) -{ - ALfloat (*Coeffs)[2] = hrtfparams->Current->Coeffs; - ALuint Delay[2] = { hrtfparams->Current->Delay[0], hrtfparams->Current->Delay[1] }; - ALfloat out[MAX_UPDATE_SAMPLES][2]; - ALfloat left, right; - ALuint minsize; - ALuint pos, i; - - pos = 0; - if(Counter == 0) - goto skip_stepping; - - minsize = minu(BufferSize, Counter); - while(pos < minsize) - { - ALuint todo = minu(minsize-pos, MAX_UPDATE_SAMPLES); - - for(i = 0;i < todo;i++) - { - hrtfstate->History[Offset&HRTF_HISTORY_MASK] = data[pos++]; - left = lerp(hrtfstate->History[(Offset-(Delay[0]>>HRTFDELAY_BITS))&HRTF_HISTORY_MASK], - hrtfstate->History[(Offset-(Delay[0]>>HRTFDELAY_BITS)-1)&HRTF_HISTORY_MASK], - (Delay[0]&HRTFDELAY_MASK)*(1.0f/HRTFDELAY_FRACONE)); - right = lerp(hrtfstate->History[(Offset-(Delay[1]>>HRTFDELAY_BITS))&HRTF_HISTORY_MASK], - hrtfstate->History[(Offset-(Delay[1]>>HRTFDELAY_BITS)-1)&HRTF_HISTORY_MASK], - (Delay[1]&HRTFDELAY_MASK)*(1.0f/HRTFDELAY_FRACONE)); - - Delay[0] += hrtfparams->Steps.Delay[0]; - Delay[1] += hrtfparams->Steps.Delay[1]; - - hrtfstate->Values[(Offset+IrSize)&HRIR_MASK][0] = 0.0f; - hrtfstate->Values[(Offset+IrSize)&HRIR_MASK][1] = 0.0f; - Offset++; - - ApplyCoeffsStep(Offset, hrtfstate->Values, IrSize, Coeffs, hrtfparams->Steps.Coeffs, left, right); - out[i][0] = hrtfstate->Values[Offset&HRIR_MASK][0]; - out[i][1] = hrtfstate->Values[Offset&HRIR_MASK][1]; - } - - for(i = 0;i < todo;i++) - OutBuffer[lidx][OutPos+i] += out[i][0]; - for(i = 0;i < todo;i++) - OutBuffer[ridx][OutPos+i] += out[i][1]; - OutPos += todo; - } - - if(pos == Counter) - { - *hrtfparams->Current = *hrtfparams->Target; - Delay[0] = hrtfparams->Target->Delay[0]; - Delay[1] = hrtfparams->Target->Delay[1]; - } - else - { - hrtfparams->Current->Delay[0] = Delay[0]; - hrtfparams->Current->Delay[1] = Delay[1]; - } - -skip_stepping: - Delay[0] >>= HRTFDELAY_BITS; - Delay[1] >>= HRTFDELAY_BITS; - while(pos < BufferSize) - { - ALuint todo = minu(BufferSize-pos, MAX_UPDATE_SAMPLES); - - for(i = 0;i < todo;i++) - { - hrtfstate->History[Offset&HRTF_HISTORY_MASK] = data[pos++]; - left = hrtfstate->History[(Offset-Delay[0])&HRTF_HISTORY_MASK]; - right = hrtfstate->History[(Offset-Delay[1])&HRTF_HISTORY_MASK]; - - hrtfstate->Values[(Offset+IrSize)&HRIR_MASK][0] = 0.0f; - hrtfstate->Values[(Offset+IrSize)&HRIR_MASK][1] = 0.0f; - Offset++; - - ApplyCoeffs(Offset, hrtfstate->Values, IrSize, Coeffs, left, right); - out[i][0] = hrtfstate->Values[Offset&HRIR_MASK][0]; - out[i][1] = hrtfstate->Values[Offset&HRIR_MASK][1]; - } - - for(i = 0;i < todo;i++) - OutBuffer[lidx][OutPos+i] += out[i][0]; - for(i = 0;i < todo;i++) - OutBuffer[ridx][OutPos+i] += out[i][1]; - OutPos += todo; - } -} - -void MixDirectHrtf(ALfloat (*restrict OutBuffer)[BUFFERSIZE], ALuint lidx, ALuint ridx, - const ALfloat *data, ALuint Offset, const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], ALfloat (*restrict Values)[2], - ALuint BufferSize) -{ - ALfloat out[MAX_UPDATE_SAMPLES][2]; - ALfloat insample; - ALuint pos, i; - - for(pos = 0;pos < BufferSize;) - { - ALuint todo = minu(BufferSize-pos, MAX_UPDATE_SAMPLES); - - for(i = 0;i < todo;i++) - { - Values[(Offset+IrSize)&HRIR_MASK][0] = 0.0f; - Values[(Offset+IrSize)&HRIR_MASK][1] = 0.0f; - Offset++; - - insample = *(data++); - ApplyCoeffs(Offset, Values, IrSize, Coeffs, insample, insample); - out[i][0] = Values[Offset&HRIR_MASK][0]; - out[i][1] = Values[Offset&HRIR_MASK][1]; - } - - for(i = 0;i < todo;i++) - OutBuffer[lidx][pos+i] += out[i][0]; - for(i = 0;i < todo;i++) - OutBuffer[ridx][pos+i] += out[i][1]; - pos += todo; - } -} diff --git a/Engine/lib/openal-soft/Alc/mixer_neon.c b/Engine/lib/openal-soft/Alc/mixer_neon.c deleted file mode 100644 index 6b506357b..000000000 --- a/Engine/lib/openal-soft/Alc/mixer_neon.c +++ /dev/null @@ -1,173 +0,0 @@ -#include "config.h" - -#include - -#include "AL/al.h" -#include "AL/alc.h" -#include "alMain.h" -#include "alu.h" -#include "hrtf.h" - - -static inline void ApplyCoeffsStep(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], - const ALfloat (*restrict CoeffStep)[2], - ALfloat left, ALfloat right) -{ - ALuint c; - float32x4_t leftright4; - { - float32x2_t leftright2 = vdup_n_f32(0.0); - leftright2 = vset_lane_f32(left, leftright2, 0); - leftright2 = vset_lane_f32(right, leftright2, 1); - leftright4 = vcombine_f32(leftright2, leftright2); - } - for(c = 0;c < IrSize;c += 2) - { - const ALuint o0 = (Offset+c)&HRIR_MASK; - const ALuint o1 = (o0+1)&HRIR_MASK; - float32x4_t vals = vcombine_f32(vld1_f32((float32_t*)&Values[o0][0]), - vld1_f32((float32_t*)&Values[o1][0])); - float32x4_t coefs = vld1q_f32((float32_t*)&Coeffs[c][0]); - float32x4_t deltas = vld1q_f32(&CoeffStep[c][0]); - - vals = vmlaq_f32(vals, coefs, leftright4); - coefs = vaddq_f32(coefs, deltas); - - vst1_f32((float32_t*)&Values[o0][0], vget_low_f32(vals)); - vst1_f32((float32_t*)&Values[o1][0], vget_high_f32(vals)); - vst1q_f32(&Coeffs[c][0], coefs); - } -} - -static inline void ApplyCoeffs(ALuint Offset, ALfloat (*restrict Values)[2], - const ALuint IrSize, - ALfloat (*restrict Coeffs)[2], - ALfloat left, ALfloat right) -{ - ALuint c; - float32x4_t leftright4; - { - float32x2_t leftright2 = vdup_n_f32(0.0); - leftright2 = vset_lane_f32(left, leftright2, 0); - leftright2 = vset_lane_f32(right, leftright2, 1); - leftright4 = vcombine_f32(leftright2, leftright2); - } - for(c = 0;c < IrSize;c += 2) - { - const ALuint o0 = (Offset+c)&HRIR_MASK; - const ALuint o1 = (o0+1)&HRIR_MASK; - float32x4_t vals = vcombine_f32(vld1_f32((float32_t*)&Values[o0][0]), - vld1_f32((float32_t*)&Values[o1][0])); - float32x4_t coefs = vld1q_f32((float32_t*)&Coeffs[c][0]); - - vals = vmlaq_f32(vals, coefs, leftright4); - - vst1_f32((float32_t*)&Values[o0][0], vget_low_f32(vals)); - vst1_f32((float32_t*)&Values[o1][0], vget_high_f32(vals)); - } -} - -#define MixHrtf MixHrtf_Neon -#define MixDirectHrtf MixDirectHrtf_Neon -#include "mixer_inc.c" -#undef MixHrtf - - -void Mix_Neon(const ALfloat *data, ALuint OutChans, ALfloat (*restrict OutBuffer)[BUFFERSIZE], - ALfloat *CurrentGains, const ALfloat *TargetGains, ALuint Counter, ALuint OutPos, - ALuint BufferSize) -{ - ALfloat gain, delta, step; - float32x4_t gain4; - ALuint c; - - delta = (Counter > 0) ? 1.0f/(ALfloat)Counter : 0.0f; - - for(c = 0;c < OutChans;c++) - { - ALuint pos = 0; - gain = CurrentGains[c]; - step = (TargetGains[c] - gain) * delta; - if(fabsf(step) > FLT_EPSILON) - { - ALuint minsize = minu(BufferSize, Counter); - /* Mix with applying gain steps in aligned multiples of 4. */ - if(minsize-pos > 3) - { - float32x4_t step4; - gain4 = vsetq_lane_f32(gain, gain4, 0); - gain4 = vsetq_lane_f32(gain + step, gain4, 1); - gain4 = vsetq_lane_f32(gain + step + step, gain4, 2); - gain4 = vsetq_lane_f32(gain + step + step + step, gain4, 3); - step4 = vdupq_n_f32(step + step + step + step); - do { - const float32x4_t val4 = vld1q_f32(&data[pos]); - float32x4_t dry4 = vld1q_f32(&OutBuffer[c][OutPos+pos]); - dry4 = vmlaq_f32(dry4, val4, gain4); - gain4 = vaddq_f32(gain4, step4); - vst1q_f32(&OutBuffer[c][OutPos+pos], dry4); - pos += 4; - } while(minsize-pos > 3); - /* NOTE: gain4 now represents the next four gains after the - * last four mixed samples, so the lowest element represents - * the next gain to apply. - */ - gain = vgetq_lane_f32(gain4, 0); - } - /* Mix with applying left over gain steps that aren't aligned multiples of 4. */ - for(;pos < minsize;pos++) - { - OutBuffer[c][OutPos+pos] += data[pos]*gain; - gain += step; - } - if(pos == Counter) - gain = TargetGains[c]; - CurrentGains[c] = gain; - - /* Mix until pos is aligned with 4 or the mix is done. */ - minsize = minu(BufferSize, (pos+3)&~3); - for(;pos < minsize;pos++) - OutBuffer[c][OutPos+pos] += data[pos]*gain; - } - - if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) - continue; - gain4 = vdupq_n_f32(gain); - for(;BufferSize-pos > 3;pos += 4) - { - const float32x4_t val4 = vld1q_f32(&data[pos]); - float32x4_t dry4 = vld1q_f32(&OutBuffer[c][OutPos+pos]); - dry4 = vmlaq_f32(dry4, val4, gain4); - vst1q_f32(&OutBuffer[c][OutPos+pos], dry4); - } - for(;pos < BufferSize;pos++) - OutBuffer[c][OutPos+pos] += data[pos]*gain; - } -} - -void MixRow_Neon(ALfloat *OutBuffer, const ALfloat *Gains, const ALfloat (*restrict data)[BUFFERSIZE], ALuint InChans, ALuint InPos, ALuint BufferSize) -{ - float32x4_t gain4; - ALuint c; - - for(c = 0;c < InChans;c++) - { - ALuint pos = 0; - ALfloat gain = Gains[c]; - if(!(fabsf(gain) > GAIN_SILENCE_THRESHOLD)) - continue; - - gain4 = vdupq_n_f32(gain); - for(;BufferSize-pos > 3;pos += 4) - { - const float32x4_t val4 = vld1q_f32(&data[c][InPos+pos]); - float32x4_t dry4 = vld1q_f32(&OutBuffer[pos]); - dry4 = vmlaq_f32(dry4, val4, gain4); - vst1q_f32(&OutBuffer[pos], dry4); - } - for(;pos < BufferSize;pos++) - OutBuffer[pos] += data[c][InPos+pos]*gain; - } -} diff --git a/Engine/lib/openal-soft/Alc/mixer_sse3.c b/Engine/lib/openal-soft/Alc/mixer_sse3.c deleted file mode 100644 index 66005e534..000000000 --- a/Engine/lib/openal-soft/Alc/mixer_sse3.c +++ /dev/null @@ -1,164 +0,0 @@ -/** - * OpenAL cross platform audio library, SSE3 mixer functions - * - * Copyright (C) 2014 by Timothy Arceri . - * Copyright (C) 2015 by Chris Robinson . - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * Or go to http://www.gnu.org/copyleft/lgpl.html - */ - -#include "config.h" - -#include -#include -#include - -#include "alu.h" -#include "mixer_defs.h" - - -const ALfloat *Resample_fir4_32_SSE3(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples) -{ - const __m128i increment4 = _mm_set1_epi32(increment*4); - const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); - union { alignas(16) ALuint i[4]; float f[4]; } pos_; - union { alignas(16) ALuint i[4]; float f[4]; } frac_; - __m128i frac4, pos4; - ALuint pos; - ALuint i; - - InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4); - - frac4 = _mm_castps_si128(_mm_load_ps(frac_.f)); - pos4 = _mm_castps_si128(_mm_load_ps(pos_.f)); - - --src; - for(i = 0;numsamples-i > 3;i += 4) - { - const __m128 val0 = _mm_loadu_ps(&src[pos_.i[0]]); - const __m128 val1 = _mm_loadu_ps(&src[pos_.i[1]]); - const __m128 val2 = _mm_loadu_ps(&src[pos_.i[2]]); - const __m128 val3 = _mm_loadu_ps(&src[pos_.i[3]]); - __m128 k0 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[0]]); - __m128 k1 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[1]]); - __m128 k2 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[2]]); - __m128 k3 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[3]]); - __m128 out; - - k0 = _mm_mul_ps(k0, val0); - k1 = _mm_mul_ps(k1, val1); - k2 = _mm_mul_ps(k2, val2); - k3 = _mm_mul_ps(k3, val3); - k0 = _mm_hadd_ps(k0, k1); - k2 = _mm_hadd_ps(k2, k3); - out = _mm_hadd_ps(k0, k2); - - _mm_store_ps(&dst[i], out); - - frac4 = _mm_add_epi32(frac4, increment4); - pos4 = _mm_add_epi32(pos4, _mm_srli_epi32(frac4, FRACTIONBITS)); - frac4 = _mm_and_si128(frac4, fracMask4); - - _mm_store_ps(pos_.f, _mm_castsi128_ps(pos4)); - _mm_store_ps(frac_.f, _mm_castsi128_ps(frac4)); - } - - /* NOTE: These four elements represent the position *after* the last four - * samples, so the lowest element is the next position to resample. - */ - pos = pos_.i[0]; - frac = frac_.i[0]; - - for(;i < numsamples;i++) - { - dst[i] = resample_fir4(src[pos], src[pos+1], src[pos+2], src[pos+3], frac); - - frac += increment; - pos += frac>>FRACTIONBITS; - frac &= FRACTIONMASK; - } - return dst; -} - -const ALfloat *Resample_fir8_32_SSE3(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples) -{ - const __m128i increment4 = _mm_set1_epi32(increment*4); - const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); - union { alignas(16) ALuint i[4]; float f[4]; } pos_; - union { alignas(16) ALuint i[4]; float f[4]; } frac_; - __m128i frac4, pos4; - ALuint pos; - ALuint i, j; - - InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4); - - frac4 = _mm_castps_si128(_mm_load_ps(frac_.f)); - pos4 = _mm_castps_si128(_mm_load_ps(pos_.f)); - - src -= 3; - for(i = 0;numsamples-i > 3;i += 4) - { - __m128 out[2]; - for(j = 0;j < 8;j+=4) - { - const __m128 val0 = _mm_loadu_ps(&src[pos_.i[0]+j]); - const __m128 val1 = _mm_loadu_ps(&src[pos_.i[1]+j]); - const __m128 val2 = _mm_loadu_ps(&src[pos_.i[2]+j]); - const __m128 val3 = _mm_loadu_ps(&src[pos_.i[3]+j]); - __m128 k0 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[0]][j]); - __m128 k1 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[1]][j]); - __m128 k2 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[2]][j]); - __m128 k3 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[3]][j]); - - k0 = _mm_mul_ps(k0, val0); - k1 = _mm_mul_ps(k1, val1); - k2 = _mm_mul_ps(k2, val2); - k3 = _mm_mul_ps(k3, val3); - k0 = _mm_hadd_ps(k0, k1); - k2 = _mm_hadd_ps(k2, k3); - out[j>>2] = _mm_hadd_ps(k0, k2); - } - - out[0] = _mm_add_ps(out[0], out[1]); - _mm_store_ps(&dst[i], out[0]); - - frac4 = _mm_add_epi32(frac4, increment4); - pos4 = _mm_add_epi32(pos4, _mm_srli_epi32(frac4, FRACTIONBITS)); - frac4 = _mm_and_si128(frac4, fracMask4); - - _mm_store_ps(pos_.f, _mm_castsi128_ps(pos4)); - _mm_store_ps(frac_.f, _mm_castsi128_ps(frac4)); - } - - pos = pos_.i[0]; - frac = frac_.i[0]; - - for(;i < numsamples;i++) - { - dst[i] = resample_fir8(src[pos ], src[pos+1], src[pos+2], src[pos+3], - src[pos+4], src[pos+5], src[pos+6], src[pos+7], frac); - - frac += increment; - pos += frac>>FRACTIONBITS; - frac &= FRACTIONMASK; - } - return dst; -} diff --git a/Engine/lib/openal-soft/Alc/mixer_sse41.c b/Engine/lib/openal-soft/Alc/mixer_sse41.c deleted file mode 100644 index 7a4db6cf7..000000000 --- a/Engine/lib/openal-soft/Alc/mixer_sse41.c +++ /dev/null @@ -1,227 +0,0 @@ -/** - * OpenAL cross platform audio library - * Copyright (C) 2014 by Timothy Arceri . - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * Or go to http://www.gnu.org/copyleft/lgpl.html - */ - -#include "config.h" - -#include -#include -#include - -#include "alu.h" -#include "mixer_defs.h" - - -const ALfloat *Resample_lerp32_SSE41(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples) -{ - const __m128i increment4 = _mm_set1_epi32(increment*4); - const __m128 fracOne4 = _mm_set1_ps(1.0f/FRACTIONONE); - const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); - union { alignas(16) ALuint i[4]; float f[4]; } pos_; - union { alignas(16) ALuint i[4]; float f[4]; } frac_; - __m128i frac4, pos4; - ALuint pos; - ALuint i; - - InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4); - - frac4 = _mm_castps_si128(_mm_load_ps(frac_.f)); - pos4 = _mm_castps_si128(_mm_load_ps(pos_.f)); - - for(i = 0;numsamples-i > 3;i += 4) - { - const __m128 val1 = _mm_setr_ps(src[pos_.i[0]], src[pos_.i[1]], src[pos_.i[2]], src[pos_.i[3]]); - const __m128 val2 = _mm_setr_ps(src[pos_.i[0]+1], src[pos_.i[1]+1], src[pos_.i[2]+1], src[pos_.i[3]+1]); - - /* val1 + (val2-val1)*mu */ - const __m128 r0 = _mm_sub_ps(val2, val1); - const __m128 mu = _mm_mul_ps(_mm_cvtepi32_ps(frac4), fracOne4); - const __m128 out = _mm_add_ps(val1, _mm_mul_ps(mu, r0)); - - _mm_store_ps(&dst[i], out); - - frac4 = _mm_add_epi32(frac4, increment4); - pos4 = _mm_add_epi32(pos4, _mm_srli_epi32(frac4, FRACTIONBITS)); - frac4 = _mm_and_si128(frac4, fracMask4); - - pos_.i[0] = _mm_extract_epi32(pos4, 0); - pos_.i[1] = _mm_extract_epi32(pos4, 1); - pos_.i[2] = _mm_extract_epi32(pos4, 2); - pos_.i[3] = _mm_extract_epi32(pos4, 3); - } - - /* NOTE: These four elements represent the position *after* the last four - * samples, so the lowest element is the next position to resample. - */ - pos = pos_.i[0]; - frac = _mm_cvtsi128_si32(frac4); - - for(;i < numsamples;i++) - { - dst[i] = lerp(src[pos], src[pos+1], frac * (1.0f/FRACTIONONE)); - - frac += increment; - pos += frac>>FRACTIONBITS; - frac &= FRACTIONMASK; - } - return dst; -} - -const ALfloat *Resample_fir4_32_SSE41(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples) -{ - const __m128i increment4 = _mm_set1_epi32(increment*4); - const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); - union { alignas(16) ALuint i[4]; float f[4]; } pos_; - union { alignas(16) ALuint i[4]; float f[4]; } frac_; - __m128i frac4, pos4; - ALuint pos; - ALuint i; - - InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4); - - frac4 = _mm_castps_si128(_mm_load_ps(frac_.f)); - pos4 = _mm_castps_si128(_mm_load_ps(pos_.f)); - - --src; - for(i = 0;numsamples-i > 3;i += 4) - { - const __m128 val0 = _mm_loadu_ps(&src[pos_.i[0]]); - const __m128 val1 = _mm_loadu_ps(&src[pos_.i[1]]); - const __m128 val2 = _mm_loadu_ps(&src[pos_.i[2]]); - const __m128 val3 = _mm_loadu_ps(&src[pos_.i[3]]); - __m128 k0 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[0]]); - __m128 k1 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[1]]); - __m128 k2 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[2]]); - __m128 k3 = _mm_load_ps(ResampleCoeffs.FIR4[frac_.i[3]]); - __m128 out; - - k0 = _mm_mul_ps(k0, val0); - k1 = _mm_mul_ps(k1, val1); - k2 = _mm_mul_ps(k2, val2); - k3 = _mm_mul_ps(k3, val3); - k0 = _mm_hadd_ps(k0, k1); - k2 = _mm_hadd_ps(k2, k3); - out = _mm_hadd_ps(k0, k2); - - _mm_store_ps(&dst[i], out); - - frac4 = _mm_add_epi32(frac4, increment4); - pos4 = _mm_add_epi32(pos4, _mm_srli_epi32(frac4, FRACTIONBITS)); - frac4 = _mm_and_si128(frac4, fracMask4); - - pos_.i[0] = _mm_extract_epi32(pos4, 0); - pos_.i[1] = _mm_extract_epi32(pos4, 1); - pos_.i[2] = _mm_extract_epi32(pos4, 2); - pos_.i[3] = _mm_extract_epi32(pos4, 3); - frac_.i[0] = _mm_extract_epi32(frac4, 0); - frac_.i[1] = _mm_extract_epi32(frac4, 1); - frac_.i[2] = _mm_extract_epi32(frac4, 2); - frac_.i[3] = _mm_extract_epi32(frac4, 3); - } - - pos = pos_.i[0]; - frac = frac_.i[0]; - - for(;i < numsamples;i++) - { - dst[i] = resample_fir4(src[pos], src[pos+1], src[pos+2], src[pos+3], frac); - - frac += increment; - pos += frac>>FRACTIONBITS; - frac &= FRACTIONMASK; - } - return dst; -} - -const ALfloat *Resample_fir8_32_SSE41(const BsincState* UNUSED(state), const ALfloat *restrict src, - ALuint frac, ALuint increment, ALfloat *restrict dst, - ALuint numsamples) -{ - const __m128i increment4 = _mm_set1_epi32(increment*4); - const __m128i fracMask4 = _mm_set1_epi32(FRACTIONMASK); - union { alignas(16) ALuint i[4]; float f[4]; } pos_; - union { alignas(16) ALuint i[4]; float f[4]; } frac_; - __m128i frac4, pos4; - ALuint pos; - ALuint i, j; - - InitiatePositionArrays(frac, increment, frac_.i, pos_.i, 4); - - frac4 = _mm_castps_si128(_mm_load_ps(frac_.f)); - pos4 = _mm_castps_si128(_mm_load_ps(pos_.f)); - - src -= 3; - for(i = 0;numsamples-i > 3;i += 4) - { - __m128 out[2]; - for(j = 0;j < 8;j+=4) - { - const __m128 val0 = _mm_loadu_ps(&src[pos_.i[0]+j]); - const __m128 val1 = _mm_loadu_ps(&src[pos_.i[1]+j]); - const __m128 val2 = _mm_loadu_ps(&src[pos_.i[2]+j]); - const __m128 val3 = _mm_loadu_ps(&src[pos_.i[3]+j]); - __m128 k0 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[0]][j]); - __m128 k1 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[1]][j]); - __m128 k2 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[2]][j]); - __m128 k3 = _mm_load_ps(&ResampleCoeffs.FIR8[frac_.i[3]][j]); - - k0 = _mm_mul_ps(k0, val0); - k1 = _mm_mul_ps(k1, val1); - k2 = _mm_mul_ps(k2, val2); - k3 = _mm_mul_ps(k3, val3); - k0 = _mm_hadd_ps(k0, k1); - k2 = _mm_hadd_ps(k2, k3); - out[j>>2] = _mm_hadd_ps(k0, k2); - } - - out[0] = _mm_add_ps(out[0], out[1]); - _mm_store_ps(&dst[i], out[0]); - - frac4 = _mm_add_epi32(frac4, increment4); - pos4 = _mm_add_epi32(pos4, _mm_srli_epi32(frac4, FRACTIONBITS)); - frac4 = _mm_and_si128(frac4, fracMask4); - - pos_.i[0] = _mm_extract_epi32(pos4, 0); - pos_.i[1] = _mm_extract_epi32(pos4, 1); - pos_.i[2] = _mm_extract_epi32(pos4, 2); - pos_.i[3] = _mm_extract_epi32(pos4, 3); - frac_.i[0] = _mm_extract_epi32(frac4, 0); - frac_.i[1] = _mm_extract_epi32(frac4, 1); - frac_.i[2] = _mm_extract_epi32(frac4, 2); - frac_.i[3] = _mm_extract_epi32(frac4, 3); - } - - pos = pos_.i[0]; - frac = frac_.i[0]; - - for(;i < numsamples;i++) - { - dst[i] = resample_fir8(src[pos ], src[pos+1], src[pos+2], src[pos+3], - src[pos+4], src[pos+5], src[pos+6], src[pos+7], frac); - - frac += increment; - pos += frac>>FRACTIONBITS; - frac &= FRACTIONMASK; - } - return dst; -} diff --git a/Engine/lib/openal-soft/Alc/mixvoice.c b/Engine/lib/openal-soft/Alc/mixvoice.c new file mode 100644 index 000000000..2d935ce5e --- /dev/null +++ b/Engine/lib/openal-soft/Alc/mixvoice.c @@ -0,0 +1,761 @@ +/** + * OpenAL cross platform audio library + * Copyright (C) 1999-2007 by authors. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Or go to http://www.gnu.org/copyleft/lgpl.html + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "alMain.h" +#include "AL/al.h" +#include "AL/alc.h" +#include "alSource.h" +#include "alBuffer.h" +#include "alListener.h" +#include "alAuxEffectSlot.h" +#include "sample_cvt.h" +#include "alu.h" +#include "alconfig.h" +#include "ringbuffer.h" + +#include "cpu_caps.h" +#include "mixer/defs.h" + + +static_assert((INT_MAX>>FRACTIONBITS)/MAX_PITCH > BUFFERSIZE, + "MAX_PITCH and/or BUFFERSIZE are too large for FRACTIONBITS!"); + +extern inline void InitiatePositionArrays(ALsizei frac, ALint increment, ALsizei *restrict frac_arr, ALint *restrict pos_arr, ALsizei size); + + +/* BSinc24 requires up to 23 extra samples before the current position, and 24 after. */ +static_assert(MAX_RESAMPLE_PADDING >= 24, "MAX_RESAMPLE_PADDING must be at least 24!"); + + +enum Resampler ResamplerDefault = LinearResampler; + +MixerFunc MixSamples = Mix_C; +RowMixerFunc MixRowSamples = MixRow_C; +static HrtfMixerFunc MixHrtfSamples = MixHrtf_C; +static HrtfMixerBlendFunc MixHrtfBlendSamples = MixHrtfBlend_C; + +static MixerFunc SelectMixer(void) +{ +#ifdef HAVE_NEON + if((CPUCapFlags&CPU_CAP_NEON)) + return Mix_Neon; +#endif +#ifdef HAVE_SSE + if((CPUCapFlags&CPU_CAP_SSE)) + return Mix_SSE; +#endif + return Mix_C; +} + +static RowMixerFunc SelectRowMixer(void) +{ +#ifdef HAVE_NEON + if((CPUCapFlags&CPU_CAP_NEON)) + return MixRow_Neon; +#endif +#ifdef HAVE_SSE + if((CPUCapFlags&CPU_CAP_SSE)) + return MixRow_SSE; +#endif + return MixRow_C; +} + +static inline HrtfMixerFunc SelectHrtfMixer(void) +{ +#ifdef HAVE_NEON + if((CPUCapFlags&CPU_CAP_NEON)) + return MixHrtf_Neon; +#endif +#ifdef HAVE_SSE + if((CPUCapFlags&CPU_CAP_SSE)) + return MixHrtf_SSE; +#endif + return MixHrtf_C; +} + +static inline HrtfMixerBlendFunc SelectHrtfBlendMixer(void) +{ +#ifdef HAVE_NEON + if((CPUCapFlags&CPU_CAP_NEON)) + return MixHrtfBlend_Neon; +#endif +#ifdef HAVE_SSE + if((CPUCapFlags&CPU_CAP_SSE)) + return MixHrtfBlend_SSE; +#endif + return MixHrtfBlend_C; +} + +ResamplerFunc SelectResampler(enum Resampler resampler) +{ + switch(resampler) + { + case PointResampler: + return Resample_point_C; + case LinearResampler: +#ifdef HAVE_NEON + if((CPUCapFlags&CPU_CAP_NEON)) + return Resample_lerp_Neon; +#endif +#ifdef HAVE_SSE4_1 + if((CPUCapFlags&CPU_CAP_SSE4_1)) + return Resample_lerp_SSE41; +#endif +#ifdef HAVE_SSE2 + if((CPUCapFlags&CPU_CAP_SSE2)) + return Resample_lerp_SSE2; +#endif + return Resample_lerp_C; + case FIR4Resampler: + return Resample_cubic_C; + case BSinc12Resampler: + case BSinc24Resampler: +#ifdef HAVE_NEON + if((CPUCapFlags&CPU_CAP_NEON)) + return Resample_bsinc_Neon; +#endif +#ifdef HAVE_SSE + if((CPUCapFlags&CPU_CAP_SSE)) + return Resample_bsinc_SSE; +#endif + return Resample_bsinc_C; + } + + return Resample_point_C; +} + + +void aluInitMixer(void) +{ + const char *str; + + if(ConfigValueStr(NULL, NULL, "resampler", &str)) + { + if(strcasecmp(str, "point") == 0 || strcasecmp(str, "none") == 0) + ResamplerDefault = PointResampler; + else if(strcasecmp(str, "linear") == 0) + ResamplerDefault = LinearResampler; + else if(strcasecmp(str, "cubic") == 0) + ResamplerDefault = FIR4Resampler; + else if(strcasecmp(str, "bsinc12") == 0) + ResamplerDefault = BSinc12Resampler; + else if(strcasecmp(str, "bsinc24") == 0) + ResamplerDefault = BSinc24Resampler; + else if(strcasecmp(str, "bsinc") == 0) + { + WARN("Resampler option \"%s\" is deprecated, using bsinc12\n", str); + ResamplerDefault = BSinc12Resampler; + } + else if(strcasecmp(str, "sinc4") == 0 || strcasecmp(str, "sinc8") == 0) + { + WARN("Resampler option \"%s\" is deprecated, using cubic\n", str); + ResamplerDefault = FIR4Resampler; + } + else + { + char *end; + long n = strtol(str, &end, 0); + if(*end == '\0' && (n == PointResampler || n == LinearResampler || n == FIR4Resampler)) + ResamplerDefault = n; + else + WARN("Invalid resampler: %s\n", str); + } + } + + MixHrtfBlendSamples = SelectHrtfBlendMixer(); + MixHrtfSamples = SelectHrtfMixer(); + MixSamples = SelectMixer(); + MixRowSamples = SelectRowMixer(); +} + + +static void SendAsyncEvent(ALCcontext *context, ALuint enumtype, ALenum type, + ALuint objid, ALuint param, const char *msg) +{ + AsyncEvent evt; + evt.EnumType = enumtype; + evt.Type = type; + evt.ObjectId = objid; + evt.Param = param; + strcpy(evt.Message, msg); + if(ll_ringbuffer_write(context->AsyncEvents, (const char*)&evt, 1) == 1) + alsem_post(&context->EventSem); +} + + +static inline ALfloat Sample_ALubyte(ALubyte val) +{ return (val-128) * (1.0f/128.0f); } + +static inline ALfloat Sample_ALshort(ALshort val) +{ return val * (1.0f/32768.0f); } + +static inline ALfloat Sample_ALfloat(ALfloat val) +{ return val; } + +static inline ALfloat Sample_ALdouble(ALdouble val) +{ return (ALfloat)val; } + +typedef ALubyte ALmulaw; +static inline ALfloat Sample_ALmulaw(ALmulaw val) +{ return muLawDecompressionTable[val] * (1.0f/32768.0f); } + +typedef ALubyte ALalaw; +static inline ALfloat Sample_ALalaw(ALalaw val) +{ return aLawDecompressionTable[val] * (1.0f/32768.0f); } + +#define DECL_TEMPLATE(T) \ +static inline void Load_##T(ALfloat *restrict dst, const T *restrict src, \ + ALint srcstep, ALsizei samples) \ +{ \ + ALsizei i; \ + for(i = 0;i < samples;i++) \ + dst[i] += Sample_##T(src[i*srcstep]); \ +} + +DECL_TEMPLATE(ALubyte) +DECL_TEMPLATE(ALshort) +DECL_TEMPLATE(ALfloat) +DECL_TEMPLATE(ALdouble) +DECL_TEMPLATE(ALmulaw) +DECL_TEMPLATE(ALalaw) + +#undef DECL_TEMPLATE + +static void LoadSamples(ALfloat *restrict dst, const ALvoid *restrict src, ALint srcstep, + enum FmtType srctype, ALsizei samples) +{ +#define HANDLE_FMT(ET, ST) case ET: Load_##ST(dst, src, srcstep, samples); break + switch(srctype) + { + HANDLE_FMT(FmtUByte, ALubyte); + HANDLE_FMT(FmtShort, ALshort); + HANDLE_FMT(FmtFloat, ALfloat); + HANDLE_FMT(FmtDouble, ALdouble); + HANDLE_FMT(FmtMulaw, ALmulaw); + HANDLE_FMT(FmtAlaw, ALalaw); + } +#undef HANDLE_FMT +} + + +static const ALfloat *DoFilters(BiquadFilter *lpfilter, BiquadFilter *hpfilter, + ALfloat *restrict dst, const ALfloat *restrict src, + ALsizei numsamples, enum ActiveFilters type) +{ + ALsizei i; + switch(type) + { + case AF_None: + BiquadFilter_passthru(lpfilter, numsamples); + BiquadFilter_passthru(hpfilter, numsamples); + break; + + case AF_LowPass: + BiquadFilter_process(lpfilter, dst, src, numsamples); + BiquadFilter_passthru(hpfilter, numsamples); + return dst; + case AF_HighPass: + BiquadFilter_passthru(lpfilter, numsamples); + BiquadFilter_process(hpfilter, dst, src, numsamples); + return dst; + + case AF_BandPass: + for(i = 0;i < numsamples;) + { + ALfloat temp[256]; + ALsizei todo = mini(256, numsamples-i); + + BiquadFilter_process(lpfilter, temp, src+i, todo); + BiquadFilter_process(hpfilter, dst+i, temp, todo); + i += todo; + } + return dst; + } + return src; +} + + +/* This function uses these device temp buffers. */ +#define SOURCE_DATA_BUF 0 +#define RESAMPLED_BUF 1 +#define FILTERED_BUF 2 +#define NFC_DATA_BUF 3 +ALboolean MixSource(ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsizei SamplesToDo) +{ + ALCdevice *Device = Context->Device; + ALbufferlistitem *BufferListItem; + ALbufferlistitem *BufferLoopItem; + ALsizei NumChannels, SampleSize; + ALbitfieldSOFT enabledevt; + ALsizei buffers_done = 0; + ResamplerFunc Resample; + ALsizei DataPosInt; + ALsizei DataPosFrac; + ALint64 DataSize64; + ALint increment; + ALsizei Counter; + ALsizei OutPos; + ALsizei IrSize; + bool isplaying; + bool firstpass; + bool isstatic; + ALsizei chan; + ALsizei send; + + /* Get source info */ + isplaying = true; /* Will only be called while playing. */ + isstatic = !!(voice->Flags&VOICE_IS_STATIC); + DataPosInt = ATOMIC_LOAD(&voice->position, almemory_order_acquire); + DataPosFrac = ATOMIC_LOAD(&voice->position_fraction, almemory_order_relaxed); + BufferListItem = ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed); + BufferLoopItem = ATOMIC_LOAD(&voice->loop_buffer, almemory_order_relaxed); + NumChannels = voice->NumChannels; + SampleSize = voice->SampleSize; + increment = voice->Step; + + IrSize = (Device->HrtfHandle ? Device->HrtfHandle->irSize : 0); + + Resample = ((increment == FRACTIONONE && DataPosFrac == 0) ? + Resample_copy_C : voice->Resampler); + + Counter = (voice->Flags&VOICE_IS_FADING) ? SamplesToDo : 0; + firstpass = true; + OutPos = 0; + + do { + ALsizei SrcBufferSize, DstBufferSize; + + /* Figure out how many buffer samples will be needed */ + DataSize64 = SamplesToDo-OutPos; + DataSize64 *= increment; + DataSize64 += DataPosFrac+FRACTIONMASK; + DataSize64 >>= FRACTIONBITS; + DataSize64 += MAX_RESAMPLE_PADDING*2; + SrcBufferSize = (ALsizei)mini64(DataSize64, BUFFERSIZE); + + /* Figure out how many samples we can actually mix from this. */ + DataSize64 = SrcBufferSize; + DataSize64 -= MAX_RESAMPLE_PADDING*2; + DataSize64 <<= FRACTIONBITS; + DataSize64 -= DataPosFrac; + DstBufferSize = (ALsizei)mini64((DataSize64+(increment-1)) / increment, + SamplesToDo - OutPos); + + /* Some mixers like having a multiple of 4, so try to give that unless + * this is the last update. */ + if(DstBufferSize < SamplesToDo-OutPos) + DstBufferSize &= ~3; + + /* It's impossible to have a buffer list item with no entries. */ + assert(BufferListItem->num_buffers > 0); + + for(chan = 0;chan < NumChannels;chan++) + { + const ALfloat *ResampledData; + ALfloat *SrcData = Device->TempBuffer[SOURCE_DATA_BUF]; + ALsizei FilledAmt; + + /* Load the previous samples into the source data first, and clear the rest. */ + memcpy(SrcData, voice->PrevSamples[chan], MAX_RESAMPLE_PADDING*sizeof(ALfloat)); + memset(SrcData+MAX_RESAMPLE_PADDING, 0, (BUFFERSIZE-MAX_RESAMPLE_PADDING)* + sizeof(ALfloat)); + FilledAmt = MAX_RESAMPLE_PADDING; + + if(isstatic) + { + /* TODO: For static sources, loop points are taken from the + * first buffer (should be adjusted by any buffer offset, to + * possibly be added later). + */ + const ALbuffer *Buffer0 = BufferListItem->buffers[0]; + const ALsizei LoopStart = Buffer0->LoopStart; + const ALsizei LoopEnd = Buffer0->LoopEnd; + const ALsizei LoopSize = LoopEnd - LoopStart; + + /* If current pos is beyond the loop range, do not loop */ + if(!BufferLoopItem || DataPosInt >= LoopEnd) + { + ALsizei SizeToDo = SrcBufferSize - FilledAmt; + ALsizei CompLen = 0; + ALsizei i; + + BufferLoopItem = NULL; + + for(i = 0;i < BufferListItem->num_buffers;i++) + { + const ALbuffer *buffer = BufferListItem->buffers[i]; + const ALubyte *Data = buffer->data; + ALsizei DataSize; + + if(DataPosInt >= buffer->SampleLen) + continue; + + /* Load what's left to play from the buffer */ + DataSize = mini(SizeToDo, buffer->SampleLen - DataPosInt); + CompLen = maxi(CompLen, DataSize); + + LoadSamples(&SrcData[FilledAmt], + &Data[(DataPosInt*NumChannels + chan)*SampleSize], + NumChannels, buffer->FmtType, DataSize + ); + } + FilledAmt += CompLen; + } + else + { + ALsizei SizeToDo = mini(SrcBufferSize - FilledAmt, LoopEnd - DataPosInt); + ALsizei CompLen = 0; + ALsizei i; + + for(i = 0;i < BufferListItem->num_buffers;i++) + { + const ALbuffer *buffer = BufferListItem->buffers[i]; + const ALubyte *Data = buffer->data; + ALsizei DataSize; + + if(DataPosInt >= buffer->SampleLen) + continue; + + /* Load what's left of this loop iteration */ + DataSize = mini(SizeToDo, buffer->SampleLen - DataPosInt); + CompLen = maxi(CompLen, DataSize); + + LoadSamples(&SrcData[FilledAmt], + &Data[(DataPosInt*NumChannels + chan)*SampleSize], + NumChannels, buffer->FmtType, DataSize + ); + } + FilledAmt += CompLen; + + while(SrcBufferSize > FilledAmt) + { + const ALsizei SizeToDo = mini(SrcBufferSize - FilledAmt, LoopSize); + + CompLen = 0; + for(i = 0;i < BufferListItem->num_buffers;i++) + { + const ALbuffer *buffer = BufferListItem->buffers[i]; + const ALubyte *Data = buffer->data; + ALsizei DataSize; + + if(LoopStart >= buffer->SampleLen) + continue; + + DataSize = mini(SizeToDo, buffer->SampleLen - LoopStart); + CompLen = maxi(CompLen, DataSize); + + LoadSamples(&SrcData[FilledAmt], + &Data[(LoopStart*NumChannels + chan)*SampleSize], + NumChannels, buffer->FmtType, DataSize + ); + } + FilledAmt += CompLen; + } + } + } + else + { + /* Crawl the buffer queue to fill in the temp buffer */ + ALbufferlistitem *tmpiter = BufferListItem; + ALsizei pos = DataPosInt; + + while(tmpiter && SrcBufferSize > FilledAmt) + { + ALsizei SizeToDo = SrcBufferSize - FilledAmt; + ALsizei i; + + for(i = 0;i < tmpiter->num_buffers;i++) + { + const ALbuffer *ALBuffer = tmpiter->buffers[i]; + ALsizei DataSize = ALBuffer ? ALBuffer->SampleLen : 0; + + if(DataSize > pos) + { + const ALubyte *Data = ALBuffer->data; + Data += (pos*NumChannels + chan)*SampleSize; + + DataSize = minu(SizeToDo, DataSize - pos); + LoadSamples(&SrcData[FilledAmt], Data, NumChannels, + ALBuffer->FmtType, DataSize); + } + } + if(pos > tmpiter->max_samples) + pos -= tmpiter->max_samples; + else + { + FilledAmt += tmpiter->max_samples - pos; + pos = 0; + } + if(SrcBufferSize > FilledAmt) + { + tmpiter = ATOMIC_LOAD(&tmpiter->next, almemory_order_acquire); + if(!tmpiter) tmpiter = BufferLoopItem; + } + } + } + + /* Store the last source samples used for next time. */ + memcpy(voice->PrevSamples[chan], + &SrcData[(increment*DstBufferSize + DataPosFrac)>>FRACTIONBITS], + MAX_RESAMPLE_PADDING*sizeof(ALfloat) + ); + + /* Now resample, then filter and mix to the appropriate outputs. */ + ResampledData = Resample(&voice->ResampleState, + &SrcData[MAX_RESAMPLE_PADDING], DataPosFrac, increment, + Device->TempBuffer[RESAMPLED_BUF], DstBufferSize + ); + { + DirectParams *parms = &voice->Direct.Params[chan]; + const ALfloat *samples; + + samples = DoFilters( + &parms->LowPass, &parms->HighPass, Device->TempBuffer[FILTERED_BUF], + ResampledData, DstBufferSize, voice->Direct.FilterType + ); + if(!(voice->Flags&VOICE_HAS_HRTF)) + { + if(!Counter) + memcpy(parms->Gains.Current, parms->Gains.Target, + sizeof(parms->Gains.Current)); + if(!(voice->Flags&VOICE_HAS_NFC)) + MixSamples(samples, voice->Direct.Channels, voice->Direct.Buffer, + parms->Gains.Current, parms->Gains.Target, Counter, OutPos, + DstBufferSize + ); + else + { + ALfloat *nfcsamples = Device->TempBuffer[NFC_DATA_BUF]; + ALsizei chanoffset = 0; + + MixSamples(samples, + voice->Direct.ChannelsPerOrder[0], voice->Direct.Buffer, + parms->Gains.Current, parms->Gains.Target, Counter, OutPos, + DstBufferSize + ); + chanoffset += voice->Direct.ChannelsPerOrder[0]; +#define APPLY_NFC_MIX(order) \ + if(voice->Direct.ChannelsPerOrder[order] > 0) \ + { \ + NfcFilterProcess##order(&parms->NFCtrlFilter, nfcsamples, samples, \ + DstBufferSize); \ + MixSamples(nfcsamples, voice->Direct.ChannelsPerOrder[order], \ + voice->Direct.Buffer+chanoffset, parms->Gains.Current+chanoffset, \ + parms->Gains.Target+chanoffset, Counter, OutPos, DstBufferSize \ + ); \ + chanoffset += voice->Direct.ChannelsPerOrder[order]; \ + } + APPLY_NFC_MIX(1) + APPLY_NFC_MIX(2) + APPLY_NFC_MIX(3) +#undef APPLY_NFC_MIX + } + } + else + { + MixHrtfParams hrtfparams; + ALsizei fademix = 0; + int lidx, ridx; + + lidx = GetChannelIdxByName(&Device->RealOut, FrontLeft); + ridx = GetChannelIdxByName(&Device->RealOut, FrontRight); + assert(lidx != -1 && ridx != -1); + + if(!Counter) + { + /* No fading, just overwrite the old HRTF params. */ + parms->Hrtf.Old = parms->Hrtf.Target; + } + else if(!(parms->Hrtf.Old.Gain > GAIN_SILENCE_THRESHOLD)) + { + /* The old HRTF params are silent, so overwrite the old + * coefficients with the new, and reset the old gain to + * 0. The future mix will then fade from silence. + */ + parms->Hrtf.Old = parms->Hrtf.Target; + parms->Hrtf.Old.Gain = 0.0f; + } + else if(firstpass) + { + ALfloat gain; + + /* Fade between the coefficients over 128 samples. */ + fademix = mini(DstBufferSize, 128); + + /* The new coefficients need to fade in completely + * since they're replacing the old ones. To keep the + * gain fading consistent, interpolate between the old + * and new target gains given how much of the fade time + * this mix handles. + */ + gain = lerp(parms->Hrtf.Old.Gain, parms->Hrtf.Target.Gain, + minf(1.0f, (ALfloat)fademix/Counter)); + hrtfparams.Coeffs = parms->Hrtf.Target.Coeffs; + hrtfparams.Delay[0] = parms->Hrtf.Target.Delay[0]; + hrtfparams.Delay[1] = parms->Hrtf.Target.Delay[1]; + hrtfparams.Gain = 0.0f; + hrtfparams.GainStep = gain / (ALfloat)fademix; + + MixHrtfBlendSamples( + voice->Direct.Buffer[lidx], voice->Direct.Buffer[ridx], + samples, voice->Offset, OutPos, IrSize, &parms->Hrtf.Old, + &hrtfparams, &parms->Hrtf.State, fademix + ); + /* Update the old parameters with the result. */ + parms->Hrtf.Old = parms->Hrtf.Target; + if(fademix < Counter) + parms->Hrtf.Old.Gain = hrtfparams.Gain; + } + + if(fademix < DstBufferSize) + { + ALsizei todo = DstBufferSize - fademix; + ALfloat gain = parms->Hrtf.Target.Gain; + + /* Interpolate the target gain if the gain fading lasts + * longer than this mix. + */ + if(Counter > DstBufferSize) + gain = lerp(parms->Hrtf.Old.Gain, gain, + (ALfloat)todo/(Counter-fademix)); + + hrtfparams.Coeffs = parms->Hrtf.Target.Coeffs; + hrtfparams.Delay[0] = parms->Hrtf.Target.Delay[0]; + hrtfparams.Delay[1] = parms->Hrtf.Target.Delay[1]; + hrtfparams.Gain = parms->Hrtf.Old.Gain; + hrtfparams.GainStep = (gain - parms->Hrtf.Old.Gain) / (ALfloat)todo; + MixHrtfSamples( + voice->Direct.Buffer[lidx], voice->Direct.Buffer[ridx], + samples+fademix, voice->Offset+fademix, OutPos+fademix, IrSize, + &hrtfparams, &parms->Hrtf.State, todo + ); + /* Store the interpolated gain or the final target gain + * depending if the fade is done. + */ + if(DstBufferSize < Counter) + parms->Hrtf.Old.Gain = gain; + else + parms->Hrtf.Old.Gain = parms->Hrtf.Target.Gain; + } + } + } + + for(send = 0;send < Device->NumAuxSends;send++) + { + SendParams *parms = &voice->Send[send].Params[chan]; + const ALfloat *samples; + + if(!voice->Send[send].Buffer) + continue; + + samples = DoFilters( + &parms->LowPass, &parms->HighPass, Device->TempBuffer[FILTERED_BUF], + ResampledData, DstBufferSize, voice->Send[send].FilterType + ); + + if(!Counter) + memcpy(parms->Gains.Current, parms->Gains.Target, + sizeof(parms->Gains.Current)); + MixSamples(samples, voice->Send[send].Channels, voice->Send[send].Buffer, + parms->Gains.Current, parms->Gains.Target, Counter, OutPos, DstBufferSize + ); + } + } + /* Update positions */ + DataPosFrac += increment*DstBufferSize; + DataPosInt += DataPosFrac>>FRACTIONBITS; + DataPosFrac &= FRACTIONMASK; + + OutPos += DstBufferSize; + voice->Offset += DstBufferSize; + Counter = maxi(DstBufferSize, Counter) - DstBufferSize; + firstpass = false; + + if(isstatic) + { + if(BufferLoopItem) + { + /* Handle looping static source */ + const ALbuffer *Buffer = BufferListItem->buffers[0]; + ALsizei LoopStart = Buffer->LoopStart; + ALsizei LoopEnd = Buffer->LoopEnd; + if(DataPosInt >= LoopEnd) + { + assert(LoopEnd > LoopStart); + DataPosInt = ((DataPosInt-LoopStart)%(LoopEnd-LoopStart)) + LoopStart; + } + } + else + { + /* Handle non-looping static source */ + if(DataPosInt >= BufferListItem->max_samples) + { + isplaying = false; + BufferListItem = NULL; + DataPosInt = 0; + DataPosFrac = 0; + break; + } + } + } + else while(1) + { + /* Handle streaming source */ + if(BufferListItem->max_samples > DataPosInt) + break; + + buffers_done += BufferListItem->num_buffers; + BufferListItem = ATOMIC_LOAD(&BufferListItem->next, almemory_order_acquire); + if(!BufferListItem && !(BufferListItem=BufferLoopItem)) + { + isplaying = false; + DataPosInt = 0; + DataPosFrac = 0; + break; + } + + DataPosInt -= BufferListItem->max_samples; + } + } while(isplaying && OutPos < SamplesToDo); + + voice->Flags |= VOICE_IS_FADING; + + /* Update source info */ + ATOMIC_STORE(&voice->position, DataPosInt, almemory_order_relaxed); + ATOMIC_STORE(&voice->position_fraction, DataPosFrac, almemory_order_relaxed); + ATOMIC_STORE(&voice->current_buffer, BufferListItem, almemory_order_release); + + /* Send any events now, after the position/buffer info was updated. */ + enabledevt = ATOMIC_LOAD(&Context->EnabledEvts, almemory_order_acquire); + if(buffers_done > 0 && (enabledevt&EventType_BufferCompleted)) + SendAsyncEvent(Context, EventType_BufferCompleted, + AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT, SourceID, buffers_done, "Buffer completed" + ); + + return isplaying; +} diff --git a/Engine/lib/openal-soft/Alc/panning.c b/Engine/lib/openal-soft/Alc/panning.c index 1162bbbcf..7f9e74e25 100644 --- a/Engine/lib/openal-soft/Alc/panning.c +++ b/Engine/lib/openal-soft/Alc/panning.c @@ -29,23 +29,21 @@ #include "alMain.h" #include "alAuxEffectSlot.h" #include "alu.h" +#include "alconfig.h" #include "bool.h" #include "ambdec.h" #include "bformatdec.h" +#include "filters/splitter.h" #include "uhjfilter.h" #include "bs2b.h" -extern inline void CalcXYZCoeffs(ALfloat x, ALfloat y, ALfloat z, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]); +extern inline void CalcAngleCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]); +extern inline void ComputeDryPanGains(const DryMixParams *dry, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); +extern inline void ComputeFirstOrderGains(const BFMixParams *foa, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); -#define ZERO_ORDER_SCALE 0.0f -#define FIRST_ORDER_SCALE 1.0f -#define SECOND_ORDER_SCALE (1.0f / 1.22474f) -#define THIRD_ORDER_SCALE (1.0f / 1.30657f) - - -static const ALuint FuMa2ACN[MAX_AMBI_COEFFS] = { +static const ALsizei FuMa2ACN[MAX_AMBI_COEFFS] = { 0, /* W */ 3, /* X */ 1, /* Y */ @@ -63,55 +61,11 @@ static const ALuint FuMa2ACN[MAX_AMBI_COEFFS] = { 15, /* P */ 9, /* Q */ }; -static const ALuint ACN2ACN[MAX_AMBI_COEFFS] = { +static const ALsizei ACN2ACN[MAX_AMBI_COEFFS] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; -/* NOTE: These are scale factors as applied to Ambisonics content. Decoder - * coefficients should be divided by these values to get proper N3D scalings. - */ -static const ALfloat UnitScale[MAX_AMBI_COEFFS] = { - 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, - 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f -}; -static const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS] = { - 1.000000000f, /* ACN 0 (W), sqrt(1) */ - 1.732050808f, /* ACN 1 (Y), sqrt(3) */ - 1.732050808f, /* ACN 2 (Z), sqrt(3) */ - 1.732050808f, /* ACN 3 (X), sqrt(3) */ - 2.236067978f, /* ACN 4 (V), sqrt(5) */ - 2.236067978f, /* ACN 5 (T), sqrt(5) */ - 2.236067978f, /* ACN 6 (R), sqrt(5) */ - 2.236067978f, /* ACN 7 (S), sqrt(5) */ - 2.236067978f, /* ACN 8 (U), sqrt(5) */ - 2.645751311f, /* ACN 9 (Q), sqrt(7) */ - 2.645751311f, /* ACN 10 (O), sqrt(7) */ - 2.645751311f, /* ACN 11 (M), sqrt(7) */ - 2.645751311f, /* ACN 12 (K), sqrt(7) */ - 2.645751311f, /* ACN 13 (L), sqrt(7) */ - 2.645751311f, /* ACN 14 (N), sqrt(7) */ - 2.645751311f, /* ACN 15 (P), sqrt(7) */ -}; -static const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS] = { - 1.414213562f, /* ACN 0 (W), sqrt(2) */ - 1.732050808f, /* ACN 1 (Y), sqrt(3) */ - 1.732050808f, /* ACN 2 (Z), sqrt(3) */ - 1.732050808f, /* ACN 3 (X), sqrt(3) */ - 1.936491673f, /* ACN 4 (V), sqrt(15)/2 */ - 1.936491673f, /* ACN 5 (T), sqrt(15)/2 */ - 2.236067978f, /* ACN 6 (R), sqrt(5) */ - 1.936491673f, /* ACN 7 (S), sqrt(15)/2 */ - 1.936491673f, /* ACN 8 (U), sqrt(15)/2 */ - 2.091650066f, /* ACN 9 (Q), sqrt(35/8) */ - 1.972026594f, /* ACN 10 (O), sqrt(35)/3 */ - 2.231093404f, /* ACN 11 (M), sqrt(224/45) */ - 2.645751311f, /* ACN 12 (K), sqrt(7) */ - 2.231093404f, /* ACN 13 (L), sqrt(224/45) */ - 1.972026594f, /* ACN 14 (N), sqrt(35)/3 */ - 2.091650066f, /* ACN 15 (P), sqrt(35/8) */ -}; - void CalcDirectionCoeffs(const ALfloat dir[3], ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]) { @@ -158,8 +112,7 @@ void CalcDirectionCoeffs(const ALfloat dir[3], ALfloat spread, ALfloat coeffs[MA * ZH5 = -0.0625*sqrt(pi) * (-1+ca)*(ca+1)*(21*ca*ca*ca*ca - 14*ca*ca + 1); * * The gain of the source is compensated for size, so that the - * loundness doesn't depend on the spread. That is, the factors are - * scaled so that ZH0 remains 1 regardless of the spread. Thus: + * loundness doesn't depend on the spread. Thus: * * ZH0 = 1.0f; * ZH1 = 0.5f * (ca+1.0f); @@ -169,11 +122,13 @@ void CalcDirectionCoeffs(const ALfloat dir[3], ALfloat spread, ALfloat coeffs[MA * ZH5 = 0.0625f * (ca+1.0f)*(21.0f*ca*ca*ca*ca - 14.0f*ca*ca + 1.0f); */ ALfloat ca = cosf(spread * 0.5f); + /* Increase the source volume by up to +3dB for a full spread. */ + ALfloat scale = sqrtf(1.0f + spread/F_TAU); - ALfloat ZH0_norm = 1.0f; - ALfloat ZH1_norm = 0.5f * (ca+1.f); - ALfloat ZH2_norm = 0.5f * (ca+1.f)*ca; - ALfloat ZH3_norm = 0.125f * (ca+1.f)*(5.f*ca*ca-1.f); + ALfloat ZH0_norm = scale; + ALfloat ZH1_norm = 0.5f * (ca+1.f) * scale; + ALfloat ZH2_norm = 0.5f * (ca+1.f)*ca * scale; + ALfloat ZH3_norm = 0.125f * (ca+1.f)*(5.f*ca*ca-1.f) * scale; /* Zeroth-order */ coeffs[0] *= ZH0_norm; @@ -198,65 +153,33 @@ void CalcDirectionCoeffs(const ALfloat dir[3], ALfloat spread, ALfloat coeffs[MA } } -void CalcAngleCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]) +void CalcAnglePairwiseCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]) { - ALfloat dir[3] = { - sinf(azimuth) * cosf(elevation), - sinf(elevation), - -cosf(azimuth) * cosf(elevation) - }; - CalcDirectionCoeffs(dir, spread, coeffs); + ALfloat sign = (azimuth < 0.0f) ? -1.0f : 1.0f; + if(!(fabsf(azimuth) > F_PI_2)) + azimuth = minf(fabsf(azimuth) * F_PI_2 / (F_PI/6.0f), F_PI_2) * sign; + CalcAngleCoeffs(azimuth, elevation, spread, coeffs); } -void ComputeAmbientGainsMC(const ChannelConfig *chancoeffs, ALuint numchans, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) +void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALsizei numcoeffs, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) { - ALuint i; - - for(i = 0;i < numchans;i++) - { - // The W coefficients are based on a mathematical average of the - // output. The square root of the base average provides for a more - // perceptual average volume, better suited to non-directional gains. - gains[i] = sqrtf(chancoeffs[i][0]) * ingain; - } - for(;i < MAX_OUTPUT_CHANNELS;i++) - gains[i] = 0.0f; -} - -void ComputeAmbientGainsBF(const BFChannelConfig *chanmap, ALuint numchans, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) -{ - ALfloat gain = 0.0f; - ALuint i; - - for(i = 0;i < numchans;i++) - { - if(chanmap[i].Index == 0) - gain += chanmap[i].Scale; - } - gains[0] = gain * 1.414213562f * ingain; - for(i = 1;i < MAX_OUTPUT_CHANNELS;i++) - gains[i] = 0.0f; -} - -void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALuint numchans, ALuint numcoeffs, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) -{ - ALuint i, j; + ALsizei i, j; for(i = 0;i < numchans;i++) { float gain = 0.0f; for(j = 0;j < numcoeffs;j++) gain += chancoeffs[i][j]*coeffs[j]; - gains[i] = gain * ingain; + gains[i] = clampf(gain, 0.0f, 1.0f) * ingain; } for(;i < MAX_OUTPUT_CHANNELS;i++) gains[i] = 0.0f; } -void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALuint numchans, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) +void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) { - ALuint i; + ALsizei i; for(i = 0;i < numchans;i++) gains[i] = chanmap[i].Scale * coeffs[chanmap[i].Index] * ingain; @@ -264,24 +187,24 @@ void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALuint numchans, cons gains[i] = 0.0f; } -void ComputeFirstOrderGainsMC(const ChannelConfig *chancoeffs, ALuint numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) +void ComputeFirstOrderGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) { - ALuint i, j; + ALsizei i, j; for(i = 0;i < numchans;i++) { float gain = 0.0f; for(j = 0;j < 4;j++) gain += chancoeffs[i][j] * mtx[j]; - gains[i] = gain * ingain; + gains[i] = clampf(gain, 0.0f, 1.0f) * ingain; } for(;i < MAX_OUTPUT_CHANNELS;i++) gains[i] = 0.0f; } -void ComputeFirstOrderGainsBF(const BFChannelConfig *chanmap, ALuint numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) +void ComputeFirstOrderGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) { - ALuint i; + ALsizei i; for(i = 0;i < numchans;i++) gains[i] = chanmap[i].Scale * mtx[chanmap[i].Index] * ingain; @@ -341,49 +264,38 @@ typedef struct ChannelMap { ChannelConfig Config; } ChannelMap; -static void SetChannelMap(const enum Channel *devchans, ChannelConfig *ambicoeffs, - const ChannelMap *chanmap, size_t count, ALuint *outcount, - ALboolean isfuma) +static void SetChannelMap(const enum Channel devchans[MAX_OUTPUT_CHANNELS], + ChannelConfig *ambicoeffs, const ChannelMap *chanmap, + ALsizei count, ALsizei *outcount) { - const ALuint *acnmap = isfuma ? FuMa2ACN : ACN2ACN; - const ALfloat *n3dscale = isfuma ? FuMa2N3DScale : UnitScale; - size_t j, k; - ALuint i; + ALsizei maxchans = 0; + ALsizei i, j; - for(i = 0;i < MAX_OUTPUT_CHANNELS && devchans[i] != InvalidChannel;i++) + for(i = 0;i < count;i++) { - if(devchans[i] == LFE) + ALint idx = GetChannelIndex(devchans, chanmap[i].ChanName); + if(idx < 0) { - for(j = 0;j < MAX_AMBI_COEFFS;j++) - ambicoeffs[i][j] = 0.0f; + ERR("Failed to find %s channel in device\n", + GetLabelFromChannel(chanmap[i].ChanName)); continue; } - for(j = 0;j < count;j++) - { - if(devchans[i] != chanmap[j].ChanName) - continue; - - for(k = 0;k < MAX_AMBI_COEFFS;++k) - { - ALuint acn = acnmap[k]; - ambicoeffs[i][acn] = chanmap[j].Config[k] / n3dscale[acn]; - } - break; - } - if(j == count) - ERR("Failed to match %s channel (%u) in channel map\n", GetLabelFromChannel(devchans[i]), i); + maxchans = maxi(maxchans, idx+1); + for(j = 0;j < MAX_AMBI_COEFFS;j++) + ambicoeffs[idx][j] = chanmap[i].Config[j]; } - *outcount = i; + *outcount = mini(maxchans, MAX_OUTPUT_CHANNELS); } -static bool MakeSpeakerMap(ALCdevice *device, const AmbDecConf *conf, ALuint speakermap[MAX_OUTPUT_CHANNELS]) +static bool MakeSpeakerMap(ALCdevice *device, const AmbDecConf *conf, ALsizei speakermap[MAX_OUTPUT_CHANNELS]) { - ALuint i; + ALsizei i; for(i = 0;i < conf->NumSpeakers;i++) { - int c = -1; + enum Channel ch; + int chidx = -1; /* NOTE: AmbDec does not define any standard speaker names, however * for this to work we have to by able to find the output channel @@ -405,204 +317,268 @@ static bool MakeSpeakerMap(ALCdevice *device, const AmbDecConf *conf, ALuint spe * use the side channels when the device is configured for back, * and vice-versa. */ - if(al_string_cmp_cstr(conf->Speakers[i].Name, "LF") == 0) - c = GetChannelIdxByName(device->RealOut, FrontLeft); - else if(al_string_cmp_cstr(conf->Speakers[i].Name, "RF") == 0) - c = GetChannelIdxByName(device->RealOut, FrontRight); - else if(al_string_cmp_cstr(conf->Speakers[i].Name, "CE") == 0) - c = GetChannelIdxByName(device->RealOut, FrontCenter); - else if(al_string_cmp_cstr(conf->Speakers[i].Name, "LS") == 0) + if(alstr_cmp_cstr(conf->Speakers[i].Name, "LF") == 0) + ch = FrontLeft; + else if(alstr_cmp_cstr(conf->Speakers[i].Name, "RF") == 0) + ch = FrontRight; + else if(alstr_cmp_cstr(conf->Speakers[i].Name, "CE") == 0) + ch = FrontCenter; + else if(alstr_cmp_cstr(conf->Speakers[i].Name, "LS") == 0) { if(device->FmtChans == DevFmtX51Rear) - c = GetChannelIdxByName(device->RealOut, BackLeft); + ch = BackLeft; else - c = GetChannelIdxByName(device->RealOut, SideLeft); + ch = SideLeft; } - else if(al_string_cmp_cstr(conf->Speakers[i].Name, "RS") == 0) + else if(alstr_cmp_cstr(conf->Speakers[i].Name, "RS") == 0) { if(device->FmtChans == DevFmtX51Rear) - c = GetChannelIdxByName(device->RealOut, BackRight); + ch = BackRight; else - c = GetChannelIdxByName(device->RealOut, SideRight); + ch = SideRight; } - else if(al_string_cmp_cstr(conf->Speakers[i].Name, "LB") == 0) + else if(alstr_cmp_cstr(conf->Speakers[i].Name, "LB") == 0) { if(device->FmtChans == DevFmtX51) - c = GetChannelIdxByName(device->RealOut, SideLeft); + ch = SideLeft; else - c = GetChannelIdxByName(device->RealOut, BackLeft); + ch = BackLeft; } - else if(al_string_cmp_cstr(conf->Speakers[i].Name, "RB") == 0) + else if(alstr_cmp_cstr(conf->Speakers[i].Name, "RB") == 0) { if(device->FmtChans == DevFmtX51) - c = GetChannelIdxByName(device->RealOut, SideRight); + ch = SideRight; else - c = GetChannelIdxByName(device->RealOut, BackRight); + ch = BackRight; } - else if(al_string_cmp_cstr(conf->Speakers[i].Name, "CB") == 0) - c = GetChannelIdxByName(device->RealOut, BackCenter); + else if(alstr_cmp_cstr(conf->Speakers[i].Name, "CB") == 0) + ch = BackCenter; else { - const char *name = al_string_get_cstr(conf->Speakers[i].Name); + const char *name = alstr_get_cstr(conf->Speakers[i].Name); unsigned int n; - char ch; + char c; - if(sscanf(name, "AUX%u%c", &n, &ch) == 1 && n < 16) - c = GetChannelIdxByName(device->RealOut, Aux0+n); + if(sscanf(name, "AUX%u%c", &n, &c) == 1 && n < 16) + ch = Aux0+n; else { ERR("AmbDec speaker label \"%s\" not recognized\n", name); return false; } } - if(c == -1) + chidx = GetChannelIdxByName(&device->RealOut, ch); + if(chidx == -1) { ERR("Failed to lookup AmbDec speaker label %s\n", - al_string_get_cstr(conf->Speakers[i].Name)); + alstr_get_cstr(conf->Speakers[i].Name)); return false; } - speakermap[i] = c; + speakermap[i] = chidx; } return true; } -/* NOTE: These decoder coefficients are using FuMa channel ordering and - * normalization, since that's what was produced by the Ambisonic Decoder - * Toolbox. SetChannelMap will convert them to N3D. - */ static const ChannelMap MonoCfg[1] = { - { FrontCenter, { 1.414213562f } }, + { FrontCenter, { 1.0f } }, }, StereoCfg[2] = { - { FrontLeft, { 0.707106781f, 0.0f, 0.5f, 0.0f } }, - { FrontRight, { 0.707106781f, 0.0f, -0.5f, 0.0f } }, + { FrontLeft, { 5.00000000e-1f, 2.88675135e-1f, 0.0f, 5.52305643e-2f } }, + { FrontRight, { 5.00000000e-1f, -2.88675135e-1f, 0.0f, 5.52305643e-2f } }, }, QuadCfg[4] = { - { FrontLeft, { 0.353553f, 0.306186f, 0.306186f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.125000f } }, - { FrontRight, { 0.353553f, 0.306186f, -0.306186f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.125000f } }, - { BackLeft, { 0.353553f, -0.306186f, 0.306186f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.125000f } }, - { BackRight, { 0.353553f, -0.306186f, -0.306186f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.125000f } }, -}, X51SideCfg[5] = { - { FrontLeft, { 0.208954f, 0.199518f, 0.223424f, 0.0f, 0.0f, 0.0f, 0.0f, -0.012543f, 0.144260f } }, - { FrontRight, { 0.208950f, 0.199514f, -0.223425f, 0.0f, 0.0f, 0.0f, 0.0f, -0.012544f, -0.144258f } }, - { FrontCenter, { 0.109403f, 0.168250f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.100431f, -0.000001f } }, - { SideLeft, { 0.470934f, -0.346484f, 0.327504f, 0.0f, 0.0f, 0.0f, 0.0f, -0.022188f, -0.041113f } }, - { SideRight, { 0.470936f, -0.346480f, -0.327507f, 0.0f, 0.0f, 0.0f, 0.0f, -0.022186f, 0.041114f } }, -}, X51RearCfg[5] = { - { FrontLeft, { 0.208954f, 0.199518f, 0.223424f, 0.0f, 0.0f, 0.0f, 0.0f, -0.012543f, 0.144260f } }, - { FrontRight, { 0.208950f, 0.199514f, -0.223425f, 0.0f, 0.0f, 0.0f, 0.0f, -0.012544f, -0.144258f } }, - { FrontCenter, { 0.109403f, 0.168250f, -0.000002f, 0.0f, 0.0f, 0.0f, 0.0f, 0.100431f, -0.000001f } }, - { BackLeft, { 0.470934f, -0.346484f, 0.327504f, 0.0f, 0.0f, 0.0f, 0.0f, -0.022188f, -0.041113f } }, - { BackRight, { 0.470936f, -0.346480f, -0.327507f, 0.0f, 0.0f, 0.0f, 0.0f, -0.022186f, 0.041114f } }, + { BackLeft, { 3.53553391e-1f, 2.04124145e-1f, 0.0f, -2.04124145e-1f } }, + { FrontLeft, { 3.53553391e-1f, 2.04124145e-1f, 0.0f, 2.04124145e-1f } }, + { FrontRight, { 3.53553391e-1f, -2.04124145e-1f, 0.0f, 2.04124145e-1f } }, + { BackRight, { 3.53553391e-1f, -2.04124145e-1f, 0.0f, -2.04124145e-1f } }, +}, X51SideCfg[4] = { + { SideLeft, { 3.33000782e-1f, 1.89084803e-1f, 0.0f, -2.00042375e-1f, -2.12307769e-2f, 0.0f, 0.0f, 0.0f, -1.14579885e-2f } }, + { FrontLeft, { 1.88542860e-1f, 1.27709292e-1f, 0.0f, 1.66295695e-1f, 7.30571517e-2f, 0.0f, 0.0f, 0.0f, 2.10901184e-2f } }, + { FrontRight, { 1.88542860e-1f, -1.27709292e-1f, 0.0f, 1.66295695e-1f, -7.30571517e-2f, 0.0f, 0.0f, 0.0f, 2.10901184e-2f } }, + { SideRight, { 3.33000782e-1f, -1.89084803e-1f, 0.0f, -2.00042375e-1f, 2.12307769e-2f, 0.0f, 0.0f, 0.0f, -1.14579885e-2f } }, +}, X51RearCfg[4] = { + { BackLeft, { 3.33000782e-1f, 1.89084803e-1f, 0.0f, -2.00042375e-1f, -2.12307769e-2f, 0.0f, 0.0f, 0.0f, -1.14579885e-2f } }, + { FrontLeft, { 1.88542860e-1f, 1.27709292e-1f, 0.0f, 1.66295695e-1f, 7.30571517e-2f, 0.0f, 0.0f, 0.0f, 2.10901184e-2f } }, + { FrontRight, { 1.88542860e-1f, -1.27709292e-1f, 0.0f, 1.66295695e-1f, -7.30571517e-2f, 0.0f, 0.0f, 0.0f, 2.10901184e-2f } }, + { BackRight, { 3.33000782e-1f, -1.89084803e-1f, 0.0f, -2.00042375e-1f, 2.12307769e-2f, 0.0f, 0.0f, 0.0f, -1.14579885e-2f } }, }, X61Cfg[6] = { - { FrontLeft, { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f } }, - { FrontRight, { 0.167065f, 0.200583f, -0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, -0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068910f } }, - { FrontCenter, { 0.109403f, 0.179490f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, 0.000000f } }, - { BackCenter, { 0.353556f, -0.461940f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.165723f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.000000f } }, - { SideLeft, { 0.289151f, -0.081301f, 0.401292f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, -0.071420f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, -0.032897f } }, - { SideRight, { 0.289151f, -0.081301f, -0.401292f, 0.0f, 0.0f, 0.0f, 0.0f, -0.188208f, 0.071420f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.010099f, 0.032897f } }, -}, X71Cfg[7] = { - { FrontLeft, { 0.167065f, 0.200583f, 0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, 0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, 0.068910f } }, - { FrontRight, { 0.167065f, 0.200583f, -0.172695f, 0.0f, 0.0f, 0.0f, 0.0f, 0.029855f, -0.186407f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, -0.039241f, -0.068910f } }, - { FrontCenter, { 0.109403f, 0.179490f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.142031f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.072024f, 0.000000f } }, - { BackLeft, { 0.224752f, -0.295009f, 0.170325f, 0.0f, 0.0f, 0.0f, 0.0f, 0.105349f, -0.182473f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.065799f } }, - { BackRight, { 0.224752f, -0.295009f, -0.170325f, 0.0f, 0.0f, 0.0f, 0.0f, 0.105349f, 0.182473f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.065799f } }, - { SideLeft, { 0.224739f, 0.000000f, 0.340644f, 0.0f, 0.0f, 0.0f, 0.0f, -0.210697f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, -0.065795f } }, - { SideRight, { 0.224739f, 0.000000f, -0.340644f, 0.0f, 0.0f, 0.0f, 0.0f, -0.210697f, 0.000000f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.000000f, 0.065795f } }, + { SideLeft, { 2.04460341e-1f, 2.17177926e-1f, 0.0f, -4.39996780e-2f, -2.60790269e-2f, 0.0f, 0.0f, 0.0f, -6.87239792e-2f } }, + { FrontLeft, { 1.58923161e-1f, 9.21772680e-2f, 0.0f, 1.59658796e-1f, 6.66278083e-2f, 0.0f, 0.0f, 0.0f, 3.84686854e-2f } }, + { FrontRight, { 1.58923161e-1f, -9.21772680e-2f, 0.0f, 1.59658796e-1f, -6.66278083e-2f, 0.0f, 0.0f, 0.0f, 3.84686854e-2f } }, + { SideRight, { 2.04460341e-1f, -2.17177926e-1f, 0.0f, -4.39996780e-2f, 2.60790269e-2f, 0.0f, 0.0f, 0.0f, -6.87239792e-2f } }, + { BackCenter, { 2.50001688e-1f, 0.00000000e+0f, 0.0f, -2.50000094e-1f, 0.00000000e+0f, 0.0f, 0.0f, 0.0f, 6.05133395e-2f } }, +}, X71Cfg[6] = { + { BackLeft, { 2.04124145e-1f, 1.08880247e-1f, 0.0f, -1.88586120e-1f, -1.29099444e-1f, 0.0f, 0.0f, 0.0f, 7.45355993e-2f, 3.73460789e-2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.00000000e+0f } }, + { SideLeft, { 2.04124145e-1f, 2.17760495e-1f, 0.0f, 0.00000000e+0f, 0.00000000e+0f, 0.0f, 0.0f, 0.0f, -1.49071198e-1f, -3.73460789e-2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.00000000e+0f } }, + { FrontLeft, { 2.04124145e-1f, 1.08880247e-1f, 0.0f, 1.88586120e-1f, 1.29099444e-1f, 0.0f, 0.0f, 0.0f, 7.45355993e-2f, 3.73460789e-2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.00000000e+0f } }, + { FrontRight, { 2.04124145e-1f, -1.08880247e-1f, 0.0f, 1.88586120e-1f, -1.29099444e-1f, 0.0f, 0.0f, 0.0f, 7.45355993e-2f, -3.73460789e-2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.00000000e+0f } }, + { SideRight, { 2.04124145e-1f, -2.17760495e-1f, 0.0f, 0.00000000e+0f, 0.00000000e+0f, 0.0f, 0.0f, 0.0f, -1.49071198e-1f, 3.73460789e-2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.00000000e+0f } }, + { BackRight, { 2.04124145e-1f, -1.08880247e-1f, 0.0f, -1.88586120e-1f, 1.29099444e-1f, 0.0f, 0.0f, 0.0f, 7.45355993e-2f, -3.73460789e-2f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.00000000e+0f } }, }; +static void InitNearFieldCtrl(ALCdevice *device, ALfloat ctrl_dist, ALsizei order, + const ALsizei *restrict chans_per_order) +{ + const char *devname = alstr_get_cstr(device->DeviceName); + ALsizei i; + + if(GetConfigValueBool(devname, "decoder", "nfc", 1) && ctrl_dist > 0.0f) + { + /* NFC is only used when AvgSpeakerDist is greater than 0, and can only + * be used when rendering to an ambisonic buffer. + */ + device->AvgSpeakerDist = minf(ctrl_dist, 10.0f); + + for(i = 0;i < order+1;i++) + device->Dry.NumChannelsPerOrder[i] = chans_per_order[i]; + for(;i < MAX_AMBI_ORDER+1;i++) + device->Dry.NumChannelsPerOrder[i] = 0; + } +} + +static void InitDistanceComp(ALCdevice *device, const AmbDecConf *conf, const ALsizei speakermap[MAX_OUTPUT_CHANNELS]) +{ + const char *devname = alstr_get_cstr(device->DeviceName); + ALfloat maxdist = 0.0f; + size_t total = 0; + ALsizei i; + + for(i = 0;i < conf->NumSpeakers;i++) + maxdist = maxf(maxdist, conf->Speakers[i].Distance); + + if(GetConfigValueBool(devname, "decoder", "distance-comp", 1) && maxdist > 0.0f) + { + ALfloat srate = (ALfloat)device->Frequency; + for(i = 0;i < conf->NumSpeakers;i++) + { + ALsizei chan = speakermap[i]; + ALfloat delay; + + /* Distance compensation only delays in steps of the sample rate. + * This is a bit less accurate since the delay time falls to the + * nearest sample time, but it's far simpler as it doesn't have to + * deal with phase offsets. This means at 48khz, for instance, the + * distance delay will be in steps of about 7 millimeters. + */ + delay = floorf((maxdist-conf->Speakers[i].Distance) / SPEEDOFSOUNDMETRESPERSEC * + srate + 0.5f); + if(delay >= (ALfloat)MAX_DELAY_LENGTH) + ERR("Delay for speaker \"%s\" exceeds buffer length (%f >= %u)\n", + alstr_get_cstr(conf->Speakers[i].Name), delay, MAX_DELAY_LENGTH); + + device->ChannelDelay[chan].Length = (ALsizei)clampf( + delay, 0.0f, (ALfloat)(MAX_DELAY_LENGTH-1) + ); + device->ChannelDelay[chan].Gain = conf->Speakers[i].Distance / maxdist; + TRACE("Channel %u \"%s\" distance compensation: %d samples, %f gain\n", chan, + alstr_get_cstr(conf->Speakers[i].Name), device->ChannelDelay[chan].Length, + device->ChannelDelay[chan].Gain + ); + + /* Round up to the next 4th sample, so each channel buffer starts + * 16-byte aligned. + */ + total += RoundUp(device->ChannelDelay[chan].Length, 4); + } + } + + if(total > 0) + { + device->ChannelDelay[0].Buffer = al_calloc(16, total * sizeof(ALfloat)); + for(i = 1;i < MAX_OUTPUT_CHANNELS;i++) + { + size_t len = RoundUp(device->ChannelDelay[i-1].Length, 4); + device->ChannelDelay[i].Buffer = device->ChannelDelay[i-1].Buffer + len; + } + } +} + static void InitPanning(ALCdevice *device) { const ChannelMap *chanmap = NULL; - ALuint coeffcount = 0; - ALfloat ambiscale; - size_t count = 0; - ALuint i, j; + ALsizei coeffcount = 0; + ALsizei count = 0; + ALsizei i, j; - ambiscale = 1.0f; switch(device->FmtChans) { case DevFmtMono: count = COUNTOF(MonoCfg); chanmap = MonoCfg; - ambiscale = ZERO_ORDER_SCALE; coeffcount = 1; break; case DevFmtStereo: count = COUNTOF(StereoCfg); chanmap = StereoCfg; - ambiscale = FIRST_ORDER_SCALE; coeffcount = 4; break; case DevFmtQuad: count = COUNTOF(QuadCfg); chanmap = QuadCfg; - ambiscale = SECOND_ORDER_SCALE; - coeffcount = 9; + coeffcount = 4; break; case DevFmtX51: count = COUNTOF(X51SideCfg); chanmap = X51SideCfg; - ambiscale = SECOND_ORDER_SCALE; coeffcount = 9; break; case DevFmtX51Rear: count = COUNTOF(X51RearCfg); chanmap = X51RearCfg; - ambiscale = SECOND_ORDER_SCALE; coeffcount = 9; break; case DevFmtX61: count = COUNTOF(X61Cfg); chanmap = X61Cfg; - ambiscale = THIRD_ORDER_SCALE; - coeffcount = 16; + coeffcount = 9; break; case DevFmtX71: count = COUNTOF(X71Cfg); chanmap = X71Cfg; - ambiscale = THIRD_ORDER_SCALE; coeffcount = 16; break; - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: break; } - if(device->FmtChans >= DevFmtAmbi1 && device->FmtChans <= DevFmtAmbi3) + if(device->FmtChans == DevFmtAmbi3D) { - const ALuint *acnmap = (device->AmbiFmt == AmbiFormat_FuMa) ? FuMa2ACN : ACN2ACN; - const ALfloat *n3dscale = (device->AmbiFmt == AmbiFormat_FuMa) ? FuMa2N3DScale : - (device->AmbiFmt == AmbiFormat_ACN_SN3D) ? SN3D2N3DScale : - /*(device->AmbiFmt == AmbiFormat_ACN_N3D) ?*/ UnitScale; + const char *devname = alstr_get_cstr(device->DeviceName); + const ALsizei *acnmap = (device->AmbiLayout == AmbiLayout_FuMa) ? FuMa2ACN : ACN2ACN; + const ALfloat *n3dscale = (device->AmbiScale == AmbiNorm_FuMa) ? FuMa2N3DScale : + (device->AmbiScale == AmbiNorm_SN3D) ? SN3D2N3DScale : + /*(device->AmbiScale == AmbiNorm_N3D) ?*/ N3D2N3DScale; + ALfloat nfc_delay = 0.0f; - count = (device->FmtChans == DevFmtAmbi3) ? 16 : - (device->FmtChans == DevFmtAmbi2) ? 9 : - (device->FmtChans == DevFmtAmbi1) ? 4 : 1; + count = (device->AmbiOrder == 3) ? 16 : + (device->AmbiOrder == 2) ? 9 : + (device->AmbiOrder == 1) ? 4 : 1; for(i = 0;i < count;i++) { - ALuint acn = acnmap[i]; + ALsizei acn = acnmap[i]; device->Dry.Ambi.Map[i].Scale = 1.0f/n3dscale[acn]; device->Dry.Ambi.Map[i].Index = acn; } device->Dry.CoeffCount = 0; device->Dry.NumChannels = count; - if(device->FmtChans == DevFmtAmbi1) + if(device->AmbiOrder < 2) { device->FOAOut.Ambi = device->Dry.Ambi; device->FOAOut.CoeffCount = device->Dry.CoeffCount; + device->FOAOut.NumChannels = 0; } else { + ALfloat w_scale=1.0f, xyz_scale=1.0f; + /* FOA output is always ACN+N3D for higher-order ambisonic output. * The upsampler expects this and will convert it for output. */ @@ -613,46 +589,95 @@ static void InitPanning(ALCdevice *device) device->FOAOut.Ambi.Map[i].Index = i; } device->FOAOut.CoeffCount = 0; + device->FOAOut.NumChannels = 4; - ambiup_reset(device->AmbiUp, device); + if(device->AmbiOrder >= 3) + { + w_scale = W_SCALE_3H3P; + xyz_scale = XYZ_SCALE_3H3P; + } + else + { + w_scale = W_SCALE_2H2P; + xyz_scale = XYZ_SCALE_2H2P; + } + ambiup_reset(device->AmbiUp, device, w_scale, xyz_scale); + } + + if(ConfigValueFloat(devname, "decoder", "nfc-ref-delay", &nfc_delay) && nfc_delay > 0.0f) + { + static const ALsizei chans_per_order[MAX_AMBI_ORDER+1] = { + 1, 3, 5, 7 + }; + nfc_delay = clampf(nfc_delay, 0.001f, 1000.0f); + InitNearFieldCtrl(device, nfc_delay * SPEEDOFSOUNDMETRESPERSEC, + device->AmbiOrder, chans_per_order); } } else { + ALfloat w_scale, xyz_scale; + SetChannelMap(device->RealOut.ChannelName, device->Dry.Ambi.Coeffs, - chanmap, count, &device->Dry.NumChannels, AL_TRUE); + chanmap, count, &device->Dry.NumChannels); device->Dry.CoeffCount = coeffcount; + w_scale = (device->Dry.CoeffCount > 9) ? W_SCALE_3H0P : + (device->Dry.CoeffCount > 4) ? W_SCALE_2H0P : 1.0f; + xyz_scale = (device->Dry.CoeffCount > 9) ? XYZ_SCALE_3H0P : + (device->Dry.CoeffCount > 4) ? XYZ_SCALE_2H0P : 1.0f; + memset(&device->FOAOut.Ambi, 0, sizeof(device->FOAOut.Ambi)); for(i = 0;i < device->Dry.NumChannels;i++) { - device->FOAOut.Ambi.Coeffs[i][0] = device->Dry.Ambi.Coeffs[i][0]; + device->FOAOut.Ambi.Coeffs[i][0] = device->Dry.Ambi.Coeffs[i][0] * w_scale; for(j = 1;j < 4;j++) - device->FOAOut.Ambi.Coeffs[i][j] = device->Dry.Ambi.Coeffs[i][j] * ambiscale; + device->FOAOut.Ambi.Coeffs[i][j] = device->Dry.Ambi.Coeffs[i][j] * xyz_scale; } device->FOAOut.CoeffCount = 4; + device->FOAOut.NumChannels = 0; } + device->RealOut.NumChannels = 0; } -static void InitCustomPanning(ALCdevice *device, const AmbDecConf *conf, const ALuint speakermap[MAX_OUTPUT_CHANNELS]) +static void InitCustomPanning(ALCdevice *device, const AmbDecConf *conf, const ALsizei speakermap[MAX_OUTPUT_CHANNELS]) { ChannelMap chanmap[MAX_OUTPUT_CHANNELS]; - const ALfloat *coeff_scale = UnitScale; - ALfloat ambiscale = 1.0f; - ALuint i, j; + const ALfloat *coeff_scale = N3D2N3DScale; + ALfloat w_scale = 1.0f; + ALfloat xyz_scale = 1.0f; + ALsizei i, j; if(conf->FreqBands != 1) ERR("Basic renderer uses the high-frequency matrix as single-band (xover_freq = %.0fhz)\n", conf->XOverFreq); - if(conf->ChanMask > 0x1ff) - ambiscale = THIRD_ORDER_SCALE; - else if(conf->ChanMask > 0xf) - ambiscale = SECOND_ORDER_SCALE; - else if(conf->ChanMask > 0x1) - ambiscale = FIRST_ORDER_SCALE; + if((conf->ChanMask&AMBI_PERIPHONIC_MASK)) + { + if(conf->ChanMask > 0x1ff) + { + w_scale = W_SCALE_3H3P; + xyz_scale = XYZ_SCALE_3H3P; + } + else if(conf->ChanMask > 0xf) + { + w_scale = W_SCALE_2H2P; + xyz_scale = XYZ_SCALE_2H2P; + } + } else - ambiscale = 0.0f; + { + if(conf->ChanMask > 0x1ff) + { + w_scale = W_SCALE_3H0P; + xyz_scale = XYZ_SCALE_3H0P; + } + else if(conf->ChanMask > 0xf) + { + w_scale = W_SCALE_2H0P; + xyz_scale = XYZ_SCALE_2H0P; + } + } if(conf->CoeffScale == ADS_SN3D) coeff_scale = SN3D2N3DScale; @@ -661,9 +686,9 @@ static void InitCustomPanning(ALCdevice *device, const AmbDecConf *conf, const A for(i = 0;i < conf->NumSpeakers;i++) { - ALuint chan = speakermap[i]; + ALsizei chan = speakermap[i]; ALfloat gain; - ALuint k = 0; + ALsizei k = 0; for(j = 0;j < MAX_AMBI_COEFFS;j++) chanmap[i].Config[j] = 0.0f; @@ -681,30 +706,32 @@ static void InitCustomPanning(ALCdevice *device, const AmbDecConf *conf, const A } SetChannelMap(device->RealOut.ChannelName, device->Dry.Ambi.Coeffs, chanmap, - conf->NumSpeakers, &device->Dry.NumChannels, AL_FALSE); + conf->NumSpeakers, &device->Dry.NumChannels); device->Dry.CoeffCount = (conf->ChanMask > 0x1ff) ? 16 : (conf->ChanMask > 0xf) ? 9 : 4; memset(&device->FOAOut.Ambi, 0, sizeof(device->FOAOut.Ambi)); for(i = 0;i < device->Dry.NumChannels;i++) { - device->FOAOut.Ambi.Coeffs[i][0] = device->Dry.Ambi.Coeffs[i][0]; + device->FOAOut.Ambi.Coeffs[i][0] = device->Dry.Ambi.Coeffs[i][0] * w_scale; for(j = 1;j < 4;j++) - device->FOAOut.Ambi.Coeffs[i][j] = device->Dry.Ambi.Coeffs[i][j] * ambiscale; + device->FOAOut.Ambi.Coeffs[i][j] = device->Dry.Ambi.Coeffs[i][j] * xyz_scale; } device->FOAOut.CoeffCount = 4; + device->FOAOut.NumChannels = 0; + + device->RealOut.NumChannels = 0; + + InitDistanceComp(device, conf, speakermap); } -static void InitHQPanning(ALCdevice *device, const AmbDecConf *conf, const ALuint speakermap[MAX_OUTPUT_CHANNELS]) +static void InitHQPanning(ALCdevice *device, const AmbDecConf *conf, const ALsizei speakermap[MAX_OUTPUT_CHANNELS]) { - const char *devname; - int decflags = 0; - size_t count; - ALuint i; - - devname = al_string_get_cstr(device->DeviceName); - if(GetConfigValueBool(devname, "decoder", "distance-comp", 1)) - decflags |= BFDF_DistanceComp; + static const ALsizei chans_per_order2d[MAX_AMBI_ORDER+1] = { 1, 2, 2, 2 }; + static const ALsizei chans_per_order3d[MAX_AMBI_ORDER+1] = { 1, 3, 5, 7 }; + ALfloat avg_dist; + ALsizei count; + ALsizei i; if((conf->ChanMask&AMBI_PERIPHONIC_MASK)) { @@ -736,15 +763,150 @@ static void InitHQPanning(ALCdevice *device, const AmbDecConf *conf, const ALuin (conf->ChanMask > 0xf) ? (conf->ChanMask > 0x1ff) ? "third" : "second" : "first", (conf->ChanMask&AMBI_PERIPHONIC_MASK) ? " periphonic" : "" ); - bformatdec_reset(device->AmbiDecoder, conf, count, device->Frequency, - speakermap, decflags); + bformatdec_reset(device->AmbiDecoder, conf, count, device->Frequency, speakermap); - if(bformatdec_getOrder(device->AmbiDecoder) < 2) + if(!(conf->ChanMask > 0xf)) { device->FOAOut.Ambi = device->Dry.Ambi; device->FOAOut.CoeffCount = device->Dry.CoeffCount; + device->FOAOut.NumChannels = 0; } else + { + memset(&device->FOAOut.Ambi, 0, sizeof(device->FOAOut.Ambi)); + if((conf->ChanMask&AMBI_PERIPHONIC_MASK)) + { + count = 4; + for(i = 0;i < count;i++) + { + device->FOAOut.Ambi.Map[i].Scale = 1.0f; + device->FOAOut.Ambi.Map[i].Index = i; + } + } + else + { + static const int map[3] = { 0, 1, 3 }; + count = 3; + for(i = 0;i < count;i++) + { + device->FOAOut.Ambi.Map[i].Scale = 1.0f; + device->FOAOut.Ambi.Map[i].Index = map[i]; + } + } + device->FOAOut.CoeffCount = 0; + device->FOAOut.NumChannels = count; + } + + device->RealOut.NumChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); + + avg_dist = 0.0f; + for(i = 0;i < conf->NumSpeakers;i++) + avg_dist += conf->Speakers[i].Distance; + avg_dist /= (ALfloat)conf->NumSpeakers; + InitNearFieldCtrl(device, avg_dist, + (conf->ChanMask > 0x1ff) ? 3 : (conf->ChanMask > 0xf) ? 2 : 1, + (conf->ChanMask&AMBI_PERIPHONIC_MASK) ? chans_per_order3d : chans_per_order2d + ); + + InitDistanceComp(device, conf, speakermap); +} + +static void InitHrtfPanning(ALCdevice *device) +{ + /* NOTE: azimuth goes clockwise. */ + static const struct AngularPoint AmbiPoints[] = { + { DEG2RAD( 90.0f), DEG2RAD( 0.0f) }, + { DEG2RAD( 35.0f), DEG2RAD( 45.0f) }, + { DEG2RAD( 35.0f), DEG2RAD( 135.0f) }, + { DEG2RAD( 35.0f), DEG2RAD(-135.0f) }, + { DEG2RAD( 35.0f), DEG2RAD( -45.0f) }, + { DEG2RAD( 0.0f), DEG2RAD( 0.0f) }, + { DEG2RAD( 0.0f), DEG2RAD( 45.0f) }, + { DEG2RAD( 0.0f), DEG2RAD( 90.0f) }, + { DEG2RAD( 0.0f), DEG2RAD( 135.0f) }, + { DEG2RAD( 0.0f), DEG2RAD( 180.0f) }, + { DEG2RAD( 0.0f), DEG2RAD(-135.0f) }, + { DEG2RAD( 0.0f), DEG2RAD( -90.0f) }, + { DEG2RAD( 0.0f), DEG2RAD( -45.0f) }, + { DEG2RAD(-35.0f), DEG2RAD( 45.0f) }, + { DEG2RAD(-35.0f), DEG2RAD( 135.0f) }, + { DEG2RAD(-35.0f), DEG2RAD(-135.0f) }, + { DEG2RAD(-35.0f), DEG2RAD( -45.0f) }, + { DEG2RAD(-90.0f), DEG2RAD( 0.0f) }, + }; + static const ALfloat AmbiMatrixFOA[][MAX_AMBI_COEFFS] = { + { 5.55555556e-02f, 0.00000000e+00f, 1.23717915e-01f, 0.00000000e+00f }, + { 5.55555556e-02f, -5.00000000e-02f, 7.14285715e-02f, 5.00000000e-02f }, + { 5.55555556e-02f, -5.00000000e-02f, 7.14285715e-02f, -5.00000000e-02f }, + { 5.55555556e-02f, 5.00000000e-02f, 7.14285715e-02f, -5.00000000e-02f }, + { 5.55555556e-02f, 5.00000000e-02f, 7.14285715e-02f, 5.00000000e-02f }, + { 5.55555556e-02f, 0.00000000e+00f, 0.00000000e+00f, 8.66025404e-02f }, + { 5.55555556e-02f, -6.12372435e-02f, 0.00000000e+00f, 6.12372435e-02f }, + { 5.55555556e-02f, -8.66025404e-02f, 0.00000000e+00f, 0.00000000e+00f }, + { 5.55555556e-02f, -6.12372435e-02f, 0.00000000e+00f, -6.12372435e-02f }, + { 5.55555556e-02f, 0.00000000e+00f, 0.00000000e+00f, -8.66025404e-02f }, + { 5.55555556e-02f, 6.12372435e-02f, 0.00000000e+00f, -6.12372435e-02f }, + { 5.55555556e-02f, 8.66025404e-02f, 0.00000000e+00f, 0.00000000e+00f }, + { 5.55555556e-02f, 6.12372435e-02f, 0.00000000e+00f, 6.12372435e-02f }, + { 5.55555556e-02f, -5.00000000e-02f, -7.14285715e-02f, 5.00000000e-02f }, + { 5.55555556e-02f, -5.00000000e-02f, -7.14285715e-02f, -5.00000000e-02f }, + { 5.55555556e-02f, 5.00000000e-02f, -7.14285715e-02f, -5.00000000e-02f }, + { 5.55555556e-02f, 5.00000000e-02f, -7.14285715e-02f, 5.00000000e-02f }, + { 5.55555556e-02f, 0.00000000e+00f, -1.23717915e-01f, 0.00000000e+00f }, + }, AmbiMatrixHOA[][MAX_AMBI_COEFFS] = { + { 5.55555556e-02f, 0.00000000e+00f, 1.23717915e-01f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f }, + { 5.55555556e-02f, -5.00000000e-02f, 7.14285715e-02f, 5.00000000e-02f, -4.55645099e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, -5.00000000e-02f, 7.14285715e-02f, -5.00000000e-02f, 4.55645099e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, 5.00000000e-02f, 7.14285715e-02f, -5.00000000e-02f, -4.55645099e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, 5.00000000e-02f, 7.14285715e-02f, 5.00000000e-02f, 4.55645099e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, 0.00000000e+00f, 0.00000000e+00f, 8.66025404e-02f, 0.00000000e+00f, 1.29099445e-01f }, + { 5.55555556e-02f, -6.12372435e-02f, 0.00000000e+00f, 6.12372435e-02f, -6.83467648e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, -8.66025404e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, -1.29099445e-01f }, + { 5.55555556e-02f, -6.12372435e-02f, 0.00000000e+00f, -6.12372435e-02f, 6.83467648e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, 0.00000000e+00f, 0.00000000e+00f, -8.66025404e-02f, 0.00000000e+00f, 1.29099445e-01f }, + { 5.55555556e-02f, 6.12372435e-02f, 0.00000000e+00f, -6.12372435e-02f, -6.83467648e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, 8.66025404e-02f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f, -1.29099445e-01f }, + { 5.55555556e-02f, 6.12372435e-02f, 0.00000000e+00f, 6.12372435e-02f, 6.83467648e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, -5.00000000e-02f, -7.14285715e-02f, 5.00000000e-02f, -4.55645099e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, -5.00000000e-02f, -7.14285715e-02f, -5.00000000e-02f, 4.55645099e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, 5.00000000e-02f, -7.14285715e-02f, -5.00000000e-02f, -4.55645099e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, 5.00000000e-02f, -7.14285715e-02f, 5.00000000e-02f, 4.55645099e-02f, 0.00000000e+00f }, + { 5.55555556e-02f, 0.00000000e+00f, -1.23717915e-01f, 0.00000000e+00f, 0.00000000e+00f, 0.00000000e+00f }, + }; + static const ALfloat AmbiOrderHFGainFOA[MAX_AMBI_ORDER+1] = { + 3.00000000e+00f, 1.73205081e+00f + }, AmbiOrderHFGainHOA[MAX_AMBI_ORDER+1] = { + 2.40192231e+00f, 1.86052102e+00f, 9.60768923e-01f + }; + static const ALsizei IndexMap[6] = { 0, 1, 2, 3, 4, 8 }; + static const ALsizei ChansPerOrder[MAX_AMBI_ORDER+1] = { 1, 3, 2, 0 }; + const ALfloat (*restrict AmbiMatrix)[MAX_AMBI_COEFFS] = AmbiMatrixFOA; + const ALfloat *restrict AmbiOrderHFGain = AmbiOrderHFGainFOA; + ALsizei count = 4; + ALsizei i; + + static_assert(COUNTOF(AmbiPoints) == COUNTOF(AmbiMatrixFOA), "FOA Ambisonic HRTF mismatch"); + static_assert(COUNTOF(AmbiPoints) == COUNTOF(AmbiMatrixHOA), "HOA Ambisonic HRTF mismatch"); + static_assert(COUNTOF(AmbiPoints) <= HRTF_AMBI_MAX_CHANNELS, "HRTF_AMBI_MAX_CHANNELS is too small"); + + if(device->AmbiUp) + { + AmbiMatrix = AmbiMatrixHOA; + AmbiOrderHFGain = AmbiOrderHFGainHOA; + count = COUNTOF(IndexMap); + } + + device->Hrtf = al_calloc(16, FAM_SIZE(DirectHrtfState, Chan, count)); + + for(i = 0;i < count;i++) + { + device->Dry.Ambi.Map[i].Scale = 1.0f; + device->Dry.Ambi.Map[i].Index = IndexMap[i]; + } + device->Dry.CoeffCount = 0; + device->Dry.NumChannels = count; + + if(device->AmbiUp) { memset(&device->FOAOut.Ambi, 0, sizeof(device->FOAOut.Ambi)); for(i = 0;i < 4;i++) @@ -753,42 +915,37 @@ static void InitHQPanning(ALCdevice *device, const AmbDecConf *conf, const ALuin device->FOAOut.Ambi.Map[i].Index = i; } device->FOAOut.CoeffCount = 0; + device->FOAOut.NumChannels = 4; + + ambiup_reset(device->AmbiUp, device, AmbiOrderHFGainFOA[0] / AmbiOrderHFGain[0], + AmbiOrderHFGainFOA[1] / AmbiOrderHFGain[1]); } -} - -static void InitHrtfPanning(ALCdevice *device) -{ - size_t count = 4; - ALuint i; - - for(i = 0;i < count;i++) + else { - device->Dry.Ambi.Map[i].Scale = 1.0f; - device->Dry.Ambi.Map[i].Index = i; + device->FOAOut.Ambi = device->Dry.Ambi; + device->FOAOut.CoeffCount = device->Dry.CoeffCount; + device->FOAOut.NumChannels = 0; } - device->Dry.CoeffCount = 0; - device->Dry.NumChannels = count; - device->FOAOut.Ambi = device->Dry.Ambi; - device->FOAOut.CoeffCount = device->Dry.CoeffCount; + device->RealOut.NumChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); - memset(device->Hrtf.Coeffs, 0, sizeof(device->Hrtf.Coeffs)); - device->Hrtf.IrSize = BuildBFormatHrtf(device->Hrtf.Handle, - device->Hrtf.Coeffs, device->Dry.NumChannels + BuildBFormatHrtf(device->HrtfHandle, + device->Hrtf, device->Dry.NumChannels, AmbiPoints, AmbiMatrix, COUNTOF(AmbiPoints), + AmbiOrderHFGain ); - /* Round up to the nearest multiple of 8 */ - device->Hrtf.IrSize = (device->Hrtf.IrSize+7)&~7; + InitNearFieldCtrl(device, device->HrtfHandle->distance, device->AmbiUp ? 2 : 1, + ChansPerOrder); } static void InitUhjPanning(ALCdevice *device) { - size_t count = 3; - ALuint i; + ALsizei count = 3; + ALsizei i; for(i = 0;i < count;i++) { - ALuint acn = FuMa2ACN[i]; + ALsizei acn = FuMa2ACN[i]; device->Dry.Ambi.Map[i].Scale = 1.0f/FuMa2N3DScale[acn]; device->Dry.Ambi.Map[i].Index = acn; } @@ -797,48 +954,69 @@ static void InitUhjPanning(ALCdevice *device) device->FOAOut.Ambi = device->Dry.Ambi; device->FOAOut.CoeffCount = device->Dry.CoeffCount; + device->FOAOut.NumChannels = 0; + + device->RealOut.NumChannels = ChannelsFromDevFmt(device->FmtChans, device->AmbiOrder); } void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf_appreq, enum HrtfRequestMode hrtf_userreq) { + /* Hold the HRTF the device last used, in case it's used again. */ + struct Hrtf *old_hrtf = device->HrtfHandle; const char *mode; bool headphones; int bs2blevel; size_t i; - device->Hrtf.Handle = NULL; - al_string_clear(&device->Hrtf.Name); + al_free(device->Hrtf); + device->Hrtf = NULL; + device->HrtfHandle = NULL; + alstr_clear(&device->HrtfName); device->Render_Mode = NormalRender; memset(&device->Dry.Ambi, 0, sizeof(device->Dry.Ambi)); device->Dry.CoeffCount = 0; device->Dry.NumChannels = 0; + for(i = 0;i < MAX_AMBI_ORDER+1;i++) + device->Dry.NumChannelsPerOrder[i] = 0; + + device->AvgSpeakerDist = 0.0f; + memset(device->ChannelDelay, 0, sizeof(device->ChannelDelay)); + for(i = 0;i < MAX_OUTPUT_CHANNELS;i++) + { + device->ChannelDelay[i].Gain = 1.0f; + device->ChannelDelay[i].Length = 0; + } + + al_free(device->Stablizer); + device->Stablizer = NULL; if(device->FmtChans != DevFmtStereo) { - ALuint speakermap[MAX_OUTPUT_CHANNELS]; + ALsizei speakermap[MAX_OUTPUT_CHANNELS]; const char *devname, *layout = NULL; AmbDecConf conf, *pconf = NULL; + if(old_hrtf) + Hrtf_DecRef(old_hrtf); + old_hrtf = NULL; if(hrtf_appreq == Hrtf_Enable) - device->Hrtf.Status = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT; + device->HrtfStatus = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT; ambdec_init(&conf); - devname = al_string_get_cstr(device->DeviceName); + devname = alstr_get_cstr(device->DeviceName); switch(device->FmtChans) { case DevFmtQuad: layout = "quad"; break; - case DevFmtX51: layout = "surround51"; break; - case DevFmtX51Rear: layout = "surround51rear"; break; + case DevFmtX51: /* fall-through */ + case DevFmtX51Rear: layout = "surround51"; break; case DevFmtX61: layout = "surround61"; break; case DevFmtX71: layout = "surround71"; break; /* Mono, Stereo, and Ambisonics output don't use custom decoders. */ case DevFmtMono: case DevFmtStereo: - case DevFmtAmbi1: - case DevFmtAmbi2: - case DevFmtAmbi3: + case DevFmtAmbi3D: break; } if(layout) @@ -863,25 +1041,20 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf if(pconf && GetConfigValueBool(devname, "decoder", "hq-mode", 0)) { - ambiup_free(device->AmbiUp); - device->AmbiUp = NULL; + ambiup_free(&device->AmbiUp); if(!device->AmbiDecoder) device->AmbiDecoder = bformatdec_alloc(); } else { - bformatdec_free(device->AmbiDecoder); - device->AmbiDecoder = NULL; - if(device->FmtChans > DevFmtAmbi1 && device->FmtChans <= DevFmtAmbi3) + bformatdec_free(&device->AmbiDecoder); + if(device->FmtChans != DevFmtAmbi3D || device->AmbiOrder < 2) + ambiup_free(&device->AmbiUp); + else { if(!device->AmbiUp) device->AmbiUp = ambiup_alloc(); } - else - { - ambiup_free(device->AmbiUp); - device->AmbiUp = NULL; - } } if(!pconf) @@ -891,20 +1064,54 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf else InitCustomPanning(device, pconf, speakermap); + /* Enable the stablizer only for formats that have front-left, front- + * right, and front-center outputs. + */ + switch(device->FmtChans) + { + case DevFmtX51: + case DevFmtX51Rear: + case DevFmtX61: + case DevFmtX71: + if(GetConfigValueBool(devname, NULL, "front-stablizer", 0)) + { + /* Initialize band-splitting filters for the front-left and + * front-right channels, with a crossover at 5khz (could be + * higher). + */ + ALfloat scale = (ALfloat)(5000.0 / device->Frequency); + FrontStablizer *stablizer = al_calloc(16, sizeof(*stablizer)); + + bandsplit_init(&stablizer->LFilter, scale); + stablizer->RFilter = stablizer->LFilter; + + /* Initialize all-pass filters for all other channels. */ + splitterap_init(&stablizer->APFilter[0], scale); + for(i = 1;i < (size_t)device->RealOut.NumChannels;i++) + stablizer->APFilter[i] = stablizer->APFilter[0]; + + device->Stablizer = stablizer; + } + break; + case DevFmtMono: + case DevFmtStereo: + case DevFmtQuad: + case DevFmtAmbi3D: + break; + } + TRACE("Front stablizer %s\n", device->Stablizer ? "enabled" : "disabled"); + ambdec_deinit(&conf); return; } - ambiup_free(device->AmbiUp); - device->AmbiUp = NULL; - bformatdec_free(device->AmbiDecoder); - device->AmbiDecoder = NULL; + bformatdec_free(&device->AmbiDecoder); headphones = device->IsHeadphones; if(device->Type != Loopback) { const char *mode; - if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "stereo-mode", &mode)) + if(ConfigValueStr(alstr_get_cstr(device->DeviceName), NULL, "stereo-mode", &mode)) { if(strcasecmp(mode, "headphones") == 0) headphones = true; @@ -921,51 +1128,61 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf (hrtf_appreq == Hrtf_Enable); if(!usehrtf) goto no_hrtf; - device->Hrtf.Status = ALC_HRTF_ENABLED_SOFT; + device->HrtfStatus = ALC_HRTF_ENABLED_SOFT; if(headphones && hrtf_appreq != Hrtf_Disable) - device->Hrtf.Status = ALC_HRTF_HEADPHONES_DETECTED_SOFT; + device->HrtfStatus = ALC_HRTF_HEADPHONES_DETECTED_SOFT; } else { if(hrtf_userreq != Hrtf_Enable) { if(hrtf_appreq == Hrtf_Enable) - device->Hrtf.Status = ALC_HRTF_DENIED_SOFT; + device->HrtfStatus = ALC_HRTF_DENIED_SOFT; goto no_hrtf; } - device->Hrtf.Status = ALC_HRTF_REQUIRED_SOFT; + device->HrtfStatus = ALC_HRTF_REQUIRED_SOFT; } - if(VECTOR_SIZE(device->Hrtf.List) == 0) + if(VECTOR_SIZE(device->HrtfList) == 0) { - VECTOR_DEINIT(device->Hrtf.List); - device->Hrtf.List = EnumerateHrtf(device->DeviceName); + VECTOR_DEINIT(device->HrtfList); + device->HrtfList = EnumerateHrtf(device->DeviceName); } - if(hrtf_id >= 0 && (size_t)hrtf_id < VECTOR_SIZE(device->Hrtf.List)) + if(hrtf_id >= 0 && (size_t)hrtf_id < VECTOR_SIZE(device->HrtfList)) { - const HrtfEntry *entry = &VECTOR_ELEM(device->Hrtf.List, hrtf_id); - if(entry->hrtf->sampleRate == device->Frequency) + const EnumeratedHrtf *entry = &VECTOR_ELEM(device->HrtfList, hrtf_id); + struct Hrtf *hrtf = GetLoadedHrtf(entry->hrtf); + if(hrtf && hrtf->sampleRate == device->Frequency) { - device->Hrtf.Handle = entry->hrtf; - al_string_copy(&device->Hrtf.Name, entry->name); + device->HrtfHandle = hrtf; + alstr_copy(&device->HrtfName, entry->name); } + else if(hrtf) + Hrtf_DecRef(hrtf); } - for(i = 0;!device->Hrtf.Handle && i < VECTOR_SIZE(device->Hrtf.List);i++) + for(i = 0;!device->HrtfHandle && i < VECTOR_SIZE(device->HrtfList);i++) { - const HrtfEntry *entry = &VECTOR_ELEM(device->Hrtf.List, i); - if(entry->hrtf->sampleRate == device->Frequency) + const EnumeratedHrtf *entry = &VECTOR_ELEM(device->HrtfList, i); + struct Hrtf *hrtf = GetLoadedHrtf(entry->hrtf); + if(hrtf && hrtf->sampleRate == device->Frequency) { - device->Hrtf.Handle = entry->hrtf; - al_string_copy(&device->Hrtf.Name, entry->name); + device->HrtfHandle = hrtf; + alstr_copy(&device->HrtfName, entry->name); } + else if(hrtf) + Hrtf_DecRef(hrtf); } - if(device->Hrtf.Handle) + if(device->HrtfHandle) { + if(old_hrtf) + Hrtf_DecRef(old_hrtf); + old_hrtf = NULL; + device->Render_Mode = HrtfRender; - if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "hrtf-mode", &mode)) + if(ConfigValueStr(alstr_get_cstr(device->DeviceName), NULL, "hrtf-mode", &mode)) { if(strcasecmp(mode, "full") == 0) device->Render_Mode = HrtfRender; @@ -975,24 +1192,46 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf ERR("Unexpected hrtf-mode: %s\n", mode); } - TRACE("HRTF enabled, \"%s\"\n", al_string_get_cstr(device->Hrtf.Name)); + if(device->Render_Mode == HrtfRender) + { + /* Don't bother with HOA when using full HRTF rendering. Nothing + * needs it, and it eases the CPU/memory load. + */ + ambiup_free(&device->AmbiUp); + } + else + { + if(!device->AmbiUp) + device->AmbiUp = ambiup_alloc(); + } + + TRACE("%s HRTF rendering enabled, using \"%s\"\n", + ((device->Render_Mode == HrtfRender) ? "Full" : "Basic"), + alstr_get_cstr(device->HrtfName) + ); InitHrtfPanning(device); return; } - device->Hrtf.Status = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT; + device->HrtfStatus = ALC_HRTF_UNSUPPORTED_FORMAT_SOFT; no_hrtf: + if(old_hrtf) + Hrtf_DecRef(old_hrtf); + old_hrtf = NULL; TRACE("HRTF disabled\n"); + device->Render_Mode = StereoPair; + + ambiup_free(&device->AmbiUp); + bs2blevel = ((headphones && hrtf_appreq != Hrtf_Disable) || (hrtf_appreq == Hrtf_Enable)) ? 5 : 0; if(device->Type != Loopback) - ConfigValueInt(al_string_get_cstr(device->DeviceName), NULL, "cf_level", &bs2blevel); + ConfigValueInt(alstr_get_cstr(device->DeviceName), NULL, "cf_level", &bs2blevel); if(bs2blevel > 0 && bs2blevel <= 6) { device->Bs2b = al_calloc(16, sizeof(*device->Bs2b)); bs2b_set_params(device->Bs2b, bs2blevel, device->Frequency); - device->Render_Mode = StereoPair; TRACE("BS2B enabled\n"); InitPanning(device); return; @@ -1000,13 +1239,12 @@ no_hrtf: TRACE("BS2B disabled\n"); - device->Render_Mode = NormalRender; - if(ConfigValueStr(al_string_get_cstr(device->DeviceName), NULL, "stereo-panning", &mode)) + if(ConfigValueStr(alstr_get_cstr(device->DeviceName), NULL, "stereo-encoding", &mode)) { - if(strcasecmp(mode, "paired") == 0) - device->Render_Mode = StereoPair; - else if(strcasecmp(mode, "uhj") != 0) - ERR("Unexpected stereo-panning: %s\n", mode); + if(strcasecmp(mode, "uhj") == 0) + device->Render_Mode = NormalRender; + else if(strcasecmp(mode, "panpot") != 0) + ERR("Unexpected stereo-encoding: %s\n", mode); } if(device->Render_Mode == NormalRender) { @@ -1023,7 +1261,7 @@ no_hrtf: void aluInitEffectPanning(ALeffectslot *slot) { - ALuint i; + ALsizei i; memset(slot->ChanMap, 0, sizeof(slot->ChanMap)); slot->NumChannels = 0; diff --git a/Engine/lib/openal-soft/Alc/polymorphism.h b/Engine/lib/openal-soft/Alc/polymorphism.h new file mode 100644 index 000000000..fa31fad25 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/polymorphism.h @@ -0,0 +1,105 @@ +#ifndef POLYMORPHISM_H +#define POLYMORPHISM_H + +/* Macros to declare inheriting types, and to (down-)cast and up-cast. */ +#define DERIVE_FROM_TYPE(t) t t##_parent +#define STATIC_CAST(to, obj) (&(obj)->to##_parent) +#ifdef __GNUC__ +#define STATIC_UPCAST(to, from, obj) __extension__({ \ + static_assert(__builtin_types_compatible_p(from, __typeof(*(obj))), \ + "Invalid upcast object from type"); \ + (to*)((char*)(obj) - offsetof(to, from##_parent)); \ +}) +#else +#define STATIC_UPCAST(to, from, obj) ((to*)((char*)(obj) - offsetof(to, from##_parent))) +#endif + +/* Defines method forwards, which call the given parent's (T2's) implementation. */ +#define DECLARE_FORWARD(T1, T2, rettype, func) \ +rettype T1##_##func(T1 *obj) \ +{ return T2##_##func(STATIC_CAST(T2, obj)); } + +#define DECLARE_FORWARD1(T1, T2, rettype, func, argtype1) \ +rettype T1##_##func(T1 *obj, argtype1 a) \ +{ return T2##_##func(STATIC_CAST(T2, obj), a); } + +#define DECLARE_FORWARD2(T1, T2, rettype, func, argtype1, argtype2) \ +rettype T1##_##func(T1 *obj, argtype1 a, argtype2 b) \ +{ return T2##_##func(STATIC_CAST(T2, obj), a, b); } + +#define DECLARE_FORWARD3(T1, T2, rettype, func, argtype1, argtype2, argtype3) \ +rettype T1##_##func(T1 *obj, argtype1 a, argtype2 b, argtype3 c) \ +{ return T2##_##func(STATIC_CAST(T2, obj), a, b, c); } + +/* Defines method thunks, functions that call to the child's method. */ +#define DECLARE_THUNK(T1, T2, rettype, func) \ +static rettype T1##_##T2##_##func(T2 *obj) \ +{ return T1##_##func(STATIC_UPCAST(T1, T2, obj)); } + +#define DECLARE_THUNK1(T1, T2, rettype, func, argtype1) \ +static rettype T1##_##T2##_##func(T2 *obj, argtype1 a) \ +{ return T1##_##func(STATIC_UPCAST(T1, T2, obj), a); } + +#define DECLARE_THUNK2(T1, T2, rettype, func, argtype1, argtype2) \ +static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b) \ +{ return T1##_##func(STATIC_UPCAST(T1, T2, obj), a, b); } + +#define DECLARE_THUNK3(T1, T2, rettype, func, argtype1, argtype2, argtype3) \ +static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b, argtype3 c) \ +{ return T1##_##func(STATIC_UPCAST(T1, T2, obj), a, b, c); } + +#define DECLARE_THUNK4(T1, T2, rettype, func, argtype1, argtype2, argtype3, argtype4) \ +static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b, argtype3 c, argtype4 d) \ +{ return T1##_##func(STATIC_UPCAST(T1, T2, obj), a, b, c, d); } + +/* Defines the default functions used to (de)allocate a polymorphic object. */ +#define DECLARE_DEFAULT_ALLOCATORS(T) \ +static void* T##_New(size_t size) { return al_malloc(16, size); } \ +static void T##_Delete(void *ptr) { al_free(ptr); } + + +/* Helper to extract an argument list for virtual method calls. */ +#define EXTRACT_VCALL_ARGS(...) __VA_ARGS__)) + +/* Call a "virtual" method on an object, with arguments. */ +#define V(obj, func) ((obj)->vtbl->func((obj), EXTRACT_VCALL_ARGS +/* Call a "virtual" method on an object, with no arguments. */ +#define V0(obj, func) ((obj)->vtbl->func((obj) EXTRACT_VCALL_ARGS + + +/* Helper to extract an argument list for NEW_OBJ calls. */ +#define EXTRACT_NEW_ARGS(...) __VA_ARGS__); \ + } \ +} while(0) + +/* Allocate and construct an object, with arguments. */ +#define NEW_OBJ(_res, T) do { \ + _res = T##_New(sizeof(T)); \ + if(_res) \ + { \ + memset(_res, 0, sizeof(T)); \ + T##_Construct(_res, EXTRACT_NEW_ARGS +/* Allocate and construct an object, with no arguments. */ +#define NEW_OBJ0(_res, T) do { \ + _res = T##_New(sizeof(T)); \ + if(_res) \ + { \ + memset(_res, 0, sizeof(T)); \ + T##_Construct(_res EXTRACT_NEW_ARGS + +/* Destructs and deallocate an object. */ +#define DELETE_OBJ(obj) do { \ + if((obj) != NULL) \ + { \ + V0((obj),Destruct)(); \ + V0((obj),Delete)(); \ + } \ +} while(0) + + +/* Helper to get a type's vtable thunk for a child type. */ +#define GET_VTABLE2(T1, T2) (&(T1##_##T2##_vtable)) +/* Helper to set an object's vtable thunk for a child type. Used when constructing an object. */ +#define SET_VTABLE2(T1, T2, obj) (STATIC_CAST(T2, obj)->vtbl = GET_VTABLE2(T1, T2)) + +#endif /* POLYMORPHISM_H */ diff --git a/Engine/lib/openal-soft/Alc/ringbuffer.c b/Engine/lib/openal-soft/Alc/ringbuffer.c new file mode 100644 index 000000000..6c419cf8e --- /dev/null +++ b/Engine/lib/openal-soft/Alc/ringbuffer.c @@ -0,0 +1,295 @@ +/** + * OpenAL cross platform audio library + * Copyright (C) 1999-2007 by authors. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * Or go to http://www.gnu.org/copyleft/lgpl.html + */ + +#include "config.h" + +#include +#include +#include + +#include "ringbuffer.h" +#include "align.h" +#include "atomic.h" +#include "threads.h" +#include "almalloc.h" +#include "compat.h" + + +/* NOTE: This lockless ringbuffer implementation is copied from JACK, extended + * to include an element size. Consequently, parameters and return values for a + * size or count is in 'elements', not bytes. Additionally, it only supports + * single-consumer/single-provider operation. */ +struct ll_ringbuffer { + ATOMIC(size_t) write_ptr; + ATOMIC(size_t) read_ptr; + size_t size; + size_t size_mask; + size_t elem_size; + + alignas(16) char buf[]; +}; + +ll_ringbuffer_t *ll_ringbuffer_create(size_t sz, size_t elem_sz, int limit_writes) +{ + ll_ringbuffer_t *rb; + size_t power_of_two = 0; + + if(sz > 0) + { + power_of_two = sz; + power_of_two |= power_of_two>>1; + power_of_two |= power_of_two>>2; + power_of_two |= power_of_two>>4; + power_of_two |= power_of_two>>8; + power_of_two |= power_of_two>>16; +#if SIZE_MAX > UINT_MAX + power_of_two |= power_of_two>>32; +#endif + } + power_of_two++; + if(power_of_two < sz) return NULL; + + rb = al_malloc(16, sizeof(*rb) + power_of_two*elem_sz); + if(!rb) return NULL; + + ATOMIC_INIT(&rb->write_ptr, 0); + ATOMIC_INIT(&rb->read_ptr, 0); + rb->size = limit_writes ? sz : power_of_two; + rb->size_mask = power_of_two - 1; + rb->elem_size = elem_sz; + return rb; +} + +void ll_ringbuffer_free(ll_ringbuffer_t *rb) +{ + al_free(rb); +} + +void ll_ringbuffer_reset(ll_ringbuffer_t *rb) +{ + ATOMIC_STORE(&rb->write_ptr, 0, almemory_order_release); + ATOMIC_STORE(&rb->read_ptr, 0, almemory_order_release); + memset(rb->buf, 0, (rb->size_mask+1)*rb->elem_size); +} + + +size_t ll_ringbuffer_read_space(const ll_ringbuffer_t *rb) +{ + size_t w = ATOMIC_LOAD(&CONST_CAST(ll_ringbuffer_t*,rb)->write_ptr, almemory_order_acquire); + size_t r = ATOMIC_LOAD(&CONST_CAST(ll_ringbuffer_t*,rb)->read_ptr, almemory_order_acquire); + return (w-r) & rb->size_mask; +} + +size_t ll_ringbuffer_write_space(const ll_ringbuffer_t *rb) +{ + size_t w = ATOMIC_LOAD(&CONST_CAST(ll_ringbuffer_t*,rb)->write_ptr, almemory_order_acquire); + size_t r = ATOMIC_LOAD(&CONST_CAST(ll_ringbuffer_t*,rb)->read_ptr, almemory_order_acquire); + w = (r-w-1) & rb->size_mask; + return (w > rb->size) ? rb->size : w; +} + + +size_t ll_ringbuffer_read(ll_ringbuffer_t *rb, char *dest, size_t cnt) +{ + size_t read_ptr; + size_t free_cnt; + size_t cnt2; + size_t to_read; + size_t n1, n2; + + free_cnt = ll_ringbuffer_read_space(rb); + if(free_cnt == 0) return 0; + + to_read = (cnt > free_cnt) ? free_cnt : cnt; + read_ptr = ATOMIC_LOAD(&rb->read_ptr, almemory_order_relaxed) & rb->size_mask; + + cnt2 = read_ptr + to_read; + if(cnt2 > rb->size_mask+1) + { + n1 = rb->size_mask+1 - read_ptr; + n2 = cnt2 & rb->size_mask; + } + else + { + n1 = to_read; + n2 = 0; + } + + memcpy(dest, &rb->buf[read_ptr*rb->elem_size], n1*rb->elem_size); + read_ptr += n1; + if(n2) + { + memcpy(dest + n1*rb->elem_size, &rb->buf[(read_ptr&rb->size_mask)*rb->elem_size], + n2*rb->elem_size); + read_ptr += n2; + } + ATOMIC_STORE(&rb->read_ptr, read_ptr, almemory_order_release); + return to_read; +} + +size_t ll_ringbuffer_peek(ll_ringbuffer_t *rb, char *dest, size_t cnt) +{ + size_t free_cnt; + size_t cnt2; + size_t to_read; + size_t n1, n2; + size_t read_ptr; + + free_cnt = ll_ringbuffer_read_space(rb); + if(free_cnt == 0) return 0; + + to_read = (cnt > free_cnt) ? free_cnt : cnt; + read_ptr = ATOMIC_LOAD(&rb->read_ptr, almemory_order_relaxed) & rb->size_mask; + + cnt2 = read_ptr + to_read; + if(cnt2 > rb->size_mask+1) + { + n1 = rb->size_mask+1 - read_ptr; + n2 = cnt2 & rb->size_mask; + } + else + { + n1 = to_read; + n2 = 0; + } + + memcpy(dest, &rb->buf[read_ptr*rb->elem_size], n1*rb->elem_size); + if(n2) + { + read_ptr += n1; + memcpy(dest + n1*rb->elem_size, &rb->buf[(read_ptr&rb->size_mask)*rb->elem_size], + n2*rb->elem_size); + } + return to_read; +} + +size_t ll_ringbuffer_write(ll_ringbuffer_t *rb, const char *src, size_t cnt) +{ + size_t write_ptr; + size_t free_cnt; + size_t cnt2; + size_t to_write; + size_t n1, n2; + + free_cnt = ll_ringbuffer_write_space(rb); + if(free_cnt == 0) return 0; + + to_write = (cnt > free_cnt) ? free_cnt : cnt; + write_ptr = ATOMIC_LOAD(&rb->write_ptr, almemory_order_relaxed) & rb->size_mask; + + cnt2 = write_ptr + to_write; + if(cnt2 > rb->size_mask+1) + { + n1 = rb->size_mask+1 - write_ptr; + n2 = cnt2 & rb->size_mask; + } + else + { + n1 = to_write; + n2 = 0; + } + + memcpy(&rb->buf[write_ptr*rb->elem_size], src, n1*rb->elem_size); + write_ptr += n1; + if(n2) + { + memcpy(&rb->buf[(write_ptr&rb->size_mask)*rb->elem_size], src + n1*rb->elem_size, + n2*rb->elem_size); + write_ptr += n2; + } + ATOMIC_STORE(&rb->write_ptr, write_ptr, almemory_order_release); + return to_write; +} + + +void ll_ringbuffer_read_advance(ll_ringbuffer_t *rb, size_t cnt) +{ + ATOMIC_ADD(&rb->read_ptr, cnt, almemory_order_acq_rel); +} + +void ll_ringbuffer_write_advance(ll_ringbuffer_t *rb, size_t cnt) +{ + ATOMIC_ADD(&rb->write_ptr, cnt, almemory_order_acq_rel); +} + + +void ll_ringbuffer_get_read_vector(const ll_ringbuffer_t *rb, ll_ringbuffer_data_t vec[2]) +{ + size_t free_cnt; + size_t cnt2; + size_t w, r; + + w = ATOMIC_LOAD(&CONST_CAST(ll_ringbuffer_t*,rb)->write_ptr, almemory_order_acquire); + r = ATOMIC_LOAD(&CONST_CAST(ll_ringbuffer_t*,rb)->read_ptr, almemory_order_acquire); + w &= rb->size_mask; + r &= rb->size_mask; + free_cnt = (w-r) & rb->size_mask; + + cnt2 = r + free_cnt; + if(cnt2 > rb->size_mask+1) + { + /* Two part vector: the rest of the buffer after the current write ptr, + * plus some from the start of the buffer. */ + vec[0].buf = (char*)&rb->buf[r*rb->elem_size]; + vec[0].len = rb->size_mask+1 - r; + vec[1].buf = (char*)rb->buf; + vec[1].len = cnt2 & rb->size_mask; + } + else + { + /* Single part vector: just the rest of the buffer */ + vec[0].buf = (char*)&rb->buf[r*rb->elem_size]; + vec[0].len = free_cnt; + vec[1].buf = NULL; + vec[1].len = 0; + } +} + +void ll_ringbuffer_get_write_vector(const ll_ringbuffer_t *rb, ll_ringbuffer_data_t vec[2]) +{ + size_t free_cnt; + size_t cnt2; + size_t w, r; + + w = ATOMIC_LOAD(&CONST_CAST(ll_ringbuffer_t*,rb)->write_ptr, almemory_order_acquire); + r = ATOMIC_LOAD(&CONST_CAST(ll_ringbuffer_t*,rb)->read_ptr, almemory_order_acquire); + w &= rb->size_mask; + r &= rb->size_mask; + free_cnt = (r-w-1) & rb->size_mask; + if(free_cnt > rb->size) free_cnt = rb->size; + + cnt2 = w + free_cnt; + if(cnt2 > rb->size_mask+1) + { + /* Two part vector: the rest of the buffer after the current write ptr, + * plus some from the start of the buffer. */ + vec[0].buf = (char*)&rb->buf[w*rb->elem_size]; + vec[0].len = rb->size_mask+1 - w; + vec[1].buf = (char*)rb->buf; + vec[1].len = cnt2 & rb->size_mask; + } + else + { + vec[0].buf = (char*)&rb->buf[w*rb->elem_size]; + vec[0].len = free_cnt; + vec[1].buf = NULL; + vec[1].len = 0; + } +} diff --git a/Engine/lib/openal-soft/Alc/ringbuffer.h b/Engine/lib/openal-soft/Alc/ringbuffer.h new file mode 100644 index 000000000..0d05ec840 --- /dev/null +++ b/Engine/lib/openal-soft/Alc/ringbuffer.h @@ -0,0 +1,77 @@ +#ifndef RINGBUFFER_H +#define RINGBUFFER_H + +#include + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct ll_ringbuffer ll_ringbuffer_t; +typedef struct ll_ringbuffer_data { + char *buf; + size_t len; +} ll_ringbuffer_data_t; + + +/** + * Create a new ringbuffer to hold at least `sz' elements of `elem_sz' bytes. + * The number of elements is rounded up to the next power of two (even if it is + * already a power of two, to ensure the requested amount can be written). + */ +ll_ringbuffer_t *ll_ringbuffer_create(size_t sz, size_t elem_sz, int limit_writes); +/** Free all data associated with the ringbuffer `rb'. */ +void ll_ringbuffer_free(ll_ringbuffer_t *rb); +/** Reset the read and write pointers to zero. This is not thread safe. */ +void ll_ringbuffer_reset(ll_ringbuffer_t *rb); + +/** + * The non-copying data reader. `vec' is an array of two places. Set the values + * at `vec' to hold the current readable data at `rb'. If the readable data is + * in one segment the second segment has zero length. + */ +void ll_ringbuffer_get_read_vector(const ll_ringbuffer_t *rb, ll_ringbuffer_data_t vec[2]); +/** + * The non-copying data writer. `vec' is an array of two places. Set the values + * at `vec' to hold the current writeable data at `rb'. If the writeable data + * is in one segment the second segment has zero length. + */ +void ll_ringbuffer_get_write_vector(const ll_ringbuffer_t *rb, ll_ringbuffer_data_t vec[2]); + +/** + * Return the number of elements available for reading. This is the number of + * elements in front of the read pointer and behind the write pointer. + */ +size_t ll_ringbuffer_read_space(const ll_ringbuffer_t *rb); +/** + * The copying data reader. Copy at most `cnt' elements from `rb' to `dest'. + * Returns the actual number of elements copied. + */ +size_t ll_ringbuffer_read(ll_ringbuffer_t *rb, char *dest, size_t cnt); +/** + * The copying data reader w/o read pointer advance. Copy at most `cnt' + * elements from `rb' to `dest'. Returns the actual number of elements copied. + */ +size_t ll_ringbuffer_peek(ll_ringbuffer_t *rb, char *dest, size_t cnt); +/** Advance the read pointer `cnt' places. */ +void ll_ringbuffer_read_advance(ll_ringbuffer_t *rb, size_t cnt); + +/** + * Return the number of elements available for writing. This is the number of + * elements in front of the write pointer and behind the read pointer. + */ +size_t ll_ringbuffer_write_space(const ll_ringbuffer_t *rb); +/** + * The copying data writer. Copy at most `cnt' elements to `rb' from `src'. + * Returns the actual number of elements copied. + */ +size_t ll_ringbuffer_write(ll_ringbuffer_t *rb, const char *src, size_t cnt); +/** Advance the write pointer `cnt' places. */ +void ll_ringbuffer_write_advance(ll_ringbuffer_t *rb, size_t cnt); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* RINGBUFFER_H */ diff --git a/Engine/lib/openal-soft/Alc/uhjfilter.c b/Engine/lib/openal-soft/Alc/uhjfilter.c index 0a702873c..42b0bc40f 100644 --- a/Engine/lib/openal-soft/Alc/uhjfilter.c +++ b/Engine/lib/openal-soft/Alc/uhjfilter.c @@ -9,36 +9,29 @@ #define MAX_UPDATE_SAMPLES 128 -static const ALfloat Filter1Coeff[4] = { - 0.6923878f, 0.9360654322959f, 0.9882295226860f, 0.9987488452737f +static const ALfloat Filter1CoeffSqr[4] = { + 0.479400865589f, 0.876218493539f, 0.976597589508f, 0.997499255936f }; -static const ALfloat Filter2Coeff[4] = { - 0.4021921162426f, 0.8561710882420f, 0.9722909545651f, 0.9952884791278f +static const ALfloat Filter2CoeffSqr[4] = { + 0.161758498368f, 0.733028932341f, 0.945349700329f, 0.990599156685f }; -static void allpass_process(AllPassState *state, ALfloat *restrict dst, const ALfloat *restrict src, const ALfloat aa, ALuint todo) +static void allpass_process(AllPassState *state, ALfloat *restrict dst, const ALfloat *restrict src, const ALfloat aa, ALsizei todo) { - ALuint i; + ALfloat z1 = state->z[0]; + ALfloat z2 = state->z[1]; + ALsizei i; - if(todo > 1) + for(i = 0;i < todo;i++) { - dst[0] = aa*(src[0] + state->y[1]) - state->x[1]; - dst[1] = aa*(src[1] + state->y[0]) - state->x[0]; - for(i = 2;i < todo;i++) - dst[i] = aa*(src[i] + dst[i-2]) - src[i-2]; - state->x[1] = src[i-2]; - state->x[0] = src[i-1]; - state->y[1] = dst[i-2]; - state->y[0] = dst[i-1]; - } - else if(todo == 1) - { - dst[0] = aa*(src[0] + state->y[1]) - state->x[1]; - state->x[1] = state->x[0]; - state->x[0] = src[0]; - state->y[1] = state->y[0]; - state->y[0] = dst[0]; + ALfloat input = src[i]; + ALfloat output = input*aa + z1; + z1 = z2; z2 = output*aa - input; + dst[i] = output; } + + state->z[0] = z1; + state->z[1] = z2; } @@ -62,47 +55,43 @@ static void allpass_process(AllPassState *state, ALfloat *restrict dst, const AL * know which is the intended result. */ -void EncodeUhj2(Uhj2Encoder *enc, ALfloat *restrict LeftOut, ALfloat *restrict RightOut, ALfloat (*restrict InSamples)[BUFFERSIZE], ALuint SamplesToDo) +void EncodeUhj2(Uhj2Encoder *enc, ALfloat *restrict LeftOut, ALfloat *restrict RightOut, ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei SamplesToDo) { ALfloat D[MAX_UPDATE_SAMPLES], S[MAX_UPDATE_SAMPLES]; ALfloat temp[2][MAX_UPDATE_SAMPLES]; - ALuint base, i; + ALsizei base, i; + + ASSUME(SamplesToDo > 0); for(base = 0;base < SamplesToDo;) { - ALuint todo = minu(SamplesToDo - base, MAX_UPDATE_SAMPLES); + ALsizei todo = mini(SamplesToDo - base, MAX_UPDATE_SAMPLES); + ASSUME(todo > 0); /* D = 0.6554516*Y */ for(i = 0;i < todo;i++) temp[0][i] = 0.6554516f*InSamples[2][base+i]; - allpass_process(&enc->Filter1_Y[0], temp[1], temp[0], - Filter1Coeff[0]*Filter1Coeff[0], todo); - allpass_process(&enc->Filter1_Y[1], temp[0], temp[1], - Filter1Coeff[1]*Filter1Coeff[1], todo); - allpass_process(&enc->Filter1_Y[2], temp[1], temp[0], - Filter1Coeff[2]*Filter1Coeff[2], todo); + allpass_process(&enc->Filter1_Y[0], temp[1], temp[0], Filter1CoeffSqr[0], todo); + allpass_process(&enc->Filter1_Y[1], temp[0], temp[1], Filter1CoeffSqr[1], todo); + allpass_process(&enc->Filter1_Y[2], temp[1], temp[0], Filter1CoeffSqr[2], todo); + allpass_process(&enc->Filter1_Y[3], temp[0], temp[1], Filter1CoeffSqr[3], todo); /* NOTE: Filter1 requires a 1 sample delay for the final output, so * take the last processed sample from the previous run as the first * output sample. */ - D[0] = enc->Filter1_Y[3].y[0]; - allpass_process(&enc->Filter1_Y[3], temp[0], temp[1], - Filter1Coeff[3]*Filter1Coeff[3], todo); + D[0] = enc->LastY; for(i = 1;i < todo;i++) D[i] = temp[0][i-1]; + enc->LastY = temp[0][i-1]; /* D += j(-0.3420201*W + 0.5098604*X) */ for(i = 0;i < todo;i++) temp[0][i] = -0.3420201f*InSamples[0][base+i] + 0.5098604f*InSamples[1][base+i]; - allpass_process(&enc->Filter2_WX[0], temp[1], temp[0], - Filter2Coeff[0]*Filter2Coeff[0], todo); - allpass_process(&enc->Filter2_WX[1], temp[0], temp[1], - Filter2Coeff[1]*Filter2Coeff[1], todo); - allpass_process(&enc->Filter2_WX[2], temp[1], temp[0], - Filter2Coeff[2]*Filter2Coeff[2], todo); - allpass_process(&enc->Filter2_WX[3], temp[0], temp[1], - Filter2Coeff[3]*Filter2Coeff[3], todo); + allpass_process(&enc->Filter2_WX[0], temp[1], temp[0], Filter2CoeffSqr[0], todo); + allpass_process(&enc->Filter2_WX[1], temp[0], temp[1], Filter2CoeffSqr[1], todo); + allpass_process(&enc->Filter2_WX[2], temp[1], temp[0], Filter2CoeffSqr[2], todo); + allpass_process(&enc->Filter2_WX[3], temp[0], temp[1], Filter2CoeffSqr[3], todo); for(i = 0;i < todo;i++) D[i] += temp[0][i]; @@ -110,17 +99,14 @@ void EncodeUhj2(Uhj2Encoder *enc, ALfloat *restrict LeftOut, ALfloat *restrict R for(i = 0;i < todo;i++) temp[0][i] = 0.9396926f*InSamples[0][base+i] + 0.1855740f*InSamples[1][base+i]; - allpass_process(&enc->Filter1_WX[0], temp[1], temp[0], - Filter1Coeff[0]*Filter1Coeff[0], todo); - allpass_process(&enc->Filter1_WX[1], temp[0], temp[1], - Filter1Coeff[1]*Filter1Coeff[1], todo); - allpass_process(&enc->Filter1_WX[2], temp[1], temp[0], - Filter1Coeff[2]*Filter1Coeff[2], todo); - S[0] = enc->Filter1_WX[3].y[0]; - allpass_process(&enc->Filter1_WX[3], temp[0], temp[1], - Filter1Coeff[3]*Filter1Coeff[3], todo); + allpass_process(&enc->Filter1_WX[0], temp[1], temp[0], Filter1CoeffSqr[0], todo); + allpass_process(&enc->Filter1_WX[1], temp[0], temp[1], Filter1CoeffSqr[1], todo); + allpass_process(&enc->Filter1_WX[2], temp[1], temp[0], Filter1CoeffSqr[2], todo); + allpass_process(&enc->Filter1_WX[3], temp[0], temp[1], Filter1CoeffSqr[3], todo); + S[0] = enc->LastWX; for(i = 1;i < todo;i++) S[i] = temp[0][i-1]; + enc->LastWX = temp[0][i-1]; /* Left = (S + D)/2.0 */ for(i = 0;i < todo;i++) diff --git a/Engine/lib/openal-soft/Alc/uhjfilter.h b/Engine/lib/openal-soft/Alc/uhjfilter.h index 14572bc31..e773e0a72 100644 --- a/Engine/lib/openal-soft/Alc/uhjfilter.h +++ b/Engine/lib/openal-soft/Alc/uhjfilter.h @@ -6,8 +6,7 @@ #include "alMain.h" typedef struct AllPassState { - ALfloat x[2]; /* Last two input samples */ - ALfloat y[2]; /* Last two output samples */ + ALfloat z[2]; } AllPassState; /* Encoding 2-channel UHJ from B-Format is done as: @@ -36,13 +35,15 @@ typedef struct AllPassState { */ typedef struct Uhj2Encoder { - AllPassState Filter1_WX[4]; AllPassState Filter1_Y[4]; AllPassState Filter2_WX[4]; + AllPassState Filter1_WX[4]; + ALfloat LastY, LastWX; } Uhj2Encoder; /* Encodes a 2-channel UHJ (stereo-compatible) signal from a B-Format input - * signal. */ -void EncodeUhj2(Uhj2Encoder *enc, ALfloat *restrict LeftOut, ALfloat *restrict RightOut, ALfloat (*restrict InSamples)[BUFFERSIZE], ALuint SamplesToDo); + * signal. The input must use FuMa channel ordering and scaling. + */ +void EncodeUhj2(Uhj2Encoder *enc, ALfloat *restrict LeftOut, ALfloat *restrict RightOut, ALfloat (*restrict InSamples)[BUFFERSIZE], ALsizei SamplesToDo); #endif /* UHJFILTER_H */ diff --git a/Engine/lib/openal-soft/Alc/vector.h b/Engine/lib/openal-soft/Alc/vector.h index 4bb92458f..ed9acfb02 100644 --- a/Engine/lib/openal-soft/Alc/vector.h +++ b/Engine/lib/openal-soft/Alc/vector.h @@ -37,13 +37,15 @@ typedef const _##N* const_##N; \ if(((_x) ? (_x)->Capacity : 0) < _cap) \ { \ + ptrdiff_t data_offset = (_x) ? (char*)((_x)->Data) - (char*)(_x) : \ + sizeof(*(_x)); \ size_t old_size = ((_x) ? (_x)->Size : 0); \ void *temp; \ \ - temp = al_calloc(16, sizeof(*(_x)) + sizeof((_x)->Data[0])*_cap); \ + temp = al_calloc(16, data_offset + sizeof((_x)->Data[0])*_cap); \ assert(temp != NULL); \ if((_x)) \ - memcpy(((ALubyte*)temp)+sizeof(*(_x)), (_x)->Data, \ + memcpy(((char*)temp)+data_offset, (_x)->Data, \ sizeof((_x)->Data[0])*old_size); \ \ al_free((_x)); \ @@ -78,13 +80,6 @@ typedef const _##N* const_##N; _f(_iter); \ } while(0) -#define VECTOR_FOR_EACH_PARAMS(_t, _x, _f, ...) do { \ - _t *_iter = VECTOR_BEGIN((_x)); \ - _t *_end = VECTOR_END((_x)); \ - for(;_iter != _end;++_iter) \ - _f(__VA_ARGS__, _iter); \ -} while(0) - #define VECTOR_FIND_IF(_i, _t, _x, _f) do { \ _t *_iter = VECTOR_BEGIN((_x)); \ _t *_end = VECTOR_END((_x)); \ @@ -96,15 +91,4 @@ typedef const _##N* const_##N; (_i) = _iter; \ } while(0) -#define VECTOR_FIND_IF_PARMS(_i, _t, _x, _f, ...) do { \ - _t *_iter = VECTOR_BEGIN((_x)); \ - _t *_end = VECTOR_END((_x)); \ - for(;_iter != _end;++_iter) \ - { \ - if(_f(__VA_ARGS__, _iter)) \ - break; \ - } \ - (_i) = _iter; \ -} while(0) - #endif /* AL_VECTOR_H */ diff --git a/Engine/lib/openal-soft/CMakeLists.txt b/Engine/lib/openal-soft/CMakeLists.txt index cf6d7ca6f..6a4f8ff4a 100644 --- a/Engine/lib/openal-soft/CMakeLists.txt +++ b/Engine/lib/openal-soft/CMakeLists.txt @@ -1,15 +1,21 @@ # CMake build file list for OpenAL -CMAKE_MINIMUM_REQUIRED(VERSION 2.8.5) +CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2) PROJECT(OpenAL) IF(COMMAND CMAKE_POLICY) CMAKE_POLICY(SET CMP0003 NEW) CMAKE_POLICY(SET CMP0005 NEW) + IF(POLICY CMP0020) + CMAKE_POLICY(SET CMP0020 NEW) + ENDIF(POLICY CMP0020) IF(POLICY CMP0042) CMAKE_POLICY(SET CMP0042 NEW) ENDIF(POLICY CMP0042) + IF(POLICY CMP0054) + CMAKE_POLICY(SET CMP0054 NEW) + ENDIF(POLICY CMP0054) ENDIF(COMMAND CMAKE_POLICY) SET(CMAKE_MODULE_PATH "${OpenAL_SOURCE_DIR}/cmake") @@ -21,13 +27,13 @@ INCLUDE(CheckIncludeFile) INCLUDE(CheckIncludeFiles) INCLUDE(CheckSymbolExists) INCLUDE(CheckCCompilerFlag) +INCLUDE(CheckCXXCompilerFlag) INCLUDE(CheckCSourceCompiles) INCLUDE(CheckTypeSize) include(CheckStructHasMember) include(CheckFileOffsetBits) include(GNUInstallDirs) - SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE) @@ -56,11 +62,16 @@ if(DEFINED LIB_SUFFIX) endif() -IF(NOT WIN32) - SET(LIBNAME openal) -ELSE() - SET(LIBNAME OpenAL32) - ADD_DEFINITIONS("-D_WIN32 -D_WIN32_WINNT=0x0502") +SET(CPP_DEFS ) # C pre-process, not C++ +SET(INC_PATHS ) +SET(C_FLAGS ) +SET(LINKER_FLAGS ) +SET(EXTRA_LIBS ) + +IF(WIN32) + SET(CPP_DEFS ${CPP_DEFS} _WIN32 _WIN32_WINNT=0x0502) + + OPTION(ALSOFT_BUILD_ROUTER "Build the router (EXPERIMENTAL; creates OpenAL32.dll and soft_oal.dll)" OFF) # This option is mainly for static linking OpenAL Soft into another project # that already defines the IDs. It is up to that project to ensure all @@ -82,8 +93,8 @@ ENDIF() # QNX's gcc do not uses /usr/include and /usr/lib pathes by default IF ("${CMAKE_C_PLATFORM_ID}" STREQUAL "QNX") - ADD_DEFINITIONS("-I/usr/include") - SET(EXTRA_LIBS ${EXTRA_LIBS} -L/usr/lib) + SET(INC_PATHS ${INC_PATHS} /usr/include) + SET(LINKER_FLAGS ${LINKER_FLAGS} -L/usr/lib) ENDIF() IF(NOT LIBTYPE) @@ -91,7 +102,7 @@ IF(NOT LIBTYPE) ENDIF() SET(LIB_MAJOR_VERSION "1") -SET(LIB_MINOR_VERSION "17") +SET(LIB_MINOR_VERSION "18") SET(LIB_REVISION "2") SET(LIB_VERSION "${LIB_MAJOR_VERSION}.${LIB_MINOR_VERSION}.${LIB_REVISION}") @@ -113,17 +124,22 @@ ELSE() ENDIF() ENDIF() +CHECK_CXX_COMPILER_FLAG(-std=c++11 HAVE_STD_CXX11) +IF(HAVE_STD_CXX11) + SET(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS}") +ENDIF() + if(NOT WIN32) # Check if _POSIX_C_SOURCE and _XOPEN_SOURCE needs to be set for POSIX functions CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN_DEFAULT) IF(NOT HAVE_POSIX_MEMALIGN_DEFAULT) SET(OLD_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) - SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=500") + SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=600") CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN_POSIX) IF(NOT HAVE_POSIX_MEMALIGN_POSIX) SET(CMAKE_REQUIRED_FLAGS ${OLD_REQUIRED_FLAGS}) ELSE() - ADD_DEFINITIONS(-D_POSIX_C_SOURCE=200112L -D_XOPEN_SOURCE=500) + SET(CPP_DEFS ${CPP_DEFS} _POSIX_C_SOURCE=200112L _XOPEN_SOURCE=600) ENDIF() ENDIF() UNSET(OLD_REQUIRED_FLAGS) @@ -132,10 +148,10 @@ ENDIF() # Set defines for large file support CHECK_FILE_OFFSET_BITS() IF(_FILE_OFFSET_BITS) - ADD_DEFINITIONS(-D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS}) + SET(CPP_DEFS ${CPP_DEFS} "_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS}") SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_FILE_OFFSET_BITS=${_FILE_OFFSET_BITS}") ENDIF() -ADD_DEFINITIONS(-D_LARGEFILE_SOURCE -D_LARGE_FILES) +SET(CPP_DEFS ${CPP_DEFS} _LARGEFILE_SOURCE _LARGE_FILES) SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -D_LARGEFILE_SOURCE -D_LARGE_FILES") # MSVC may need workarounds for C99 restrict and inline @@ -145,7 +161,7 @@ IF(MSVC) CHECK_C_SOURCE_COMPILES("int *restrict foo; int main() {return 0;}" HAVE_RESTRICT) IF(NOT HAVE_RESTRICT) - ADD_DEFINITIONS("-Drestrict=") + SET(CPP_DEFS ${CPP_DEFS} "restrict=") SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Drestrict=") ENDIF() @@ -158,13 +174,15 @@ IF(MSVC) MESSAGE(FATAL_ERROR "No inline keyword found, please report!") ENDIF() - ADD_DEFINITIONS(-Dinline=__inline) + SET(CPP_DEFS ${CPP_DEFS} inline=__inline) SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Dinline=__inline") ENDIF() ENDIF() # Make sure we have C99-style inline semantics with GCC (4.3 or newer). IF(CMAKE_COMPILER_IS_GNUCC) + SET(CMAKE_C_FLAGS "-fno-gnu89-inline ${CMAKE_C_FLAGS}") + SET(OLD_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") # Force no inlining for the next test. SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS} -fno-inline") @@ -183,7 +201,7 @@ ENDIF() CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_sec time.h HAVE_STRUCT_TIMESPEC) IF(HAVE_STRUCT_TIMESPEC) # Define it here so we don't have to include config.h for it - ADD_DEFINITIONS("-DHAVE_STRUCT_TIMESPEC") + SET(CPP_DEFS ${CPP_DEFS} HAVE_STRUCT_TIMESPEC) ENDIF() # Some systems may need libatomic for C11 atomic functions to work @@ -203,15 +221,12 @@ ELSE() ENDIF() UNSET(OLD_REQUIRED_LIBRARIES) -# Check if we have C99 variable length arrays -CHECK_C_SOURCE_COMPILES( -"int main(int argc, char *argv[]) - { - volatile int tmp[argc]; - tmp[0] = argv[0][0]; - return tmp[0]; - }" -HAVE_C99_VLA) +# Include liblog for Android logging +CHECK_LIBRARY_EXISTS(log __android_log_print "" HAVE_LIBLOG) +IF(HAVE_LIBLOG) + SET(EXTRA_LIBS log ${EXTRA_LIBS}) + SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} log) +ENDIF() # Check if we have C99 bool CHECK_C_SOURCE_COMPILES( @@ -244,23 +259,16 @@ HAVE_C11_ALIGNAS) # Check if we have C11 _Atomic CHECK_C_SOURCE_COMPILES( "#include - const int _Atomic foo = ATOMIC_VAR_INIT(~0); - int _Atomic bar = ATOMIC_VAR_INIT(0); + int _Atomic foo = ATOMIC_VAR_INIT(0); int main() { - atomic_fetch_add(&bar, 2); - return atomic_load(&foo); + atomic_fetch_add(&foo, 2); + return 0; }" HAVE_C11_ATOMIC) # Add definitions, compiler switches, etc. -INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/include" "${OpenAL_BINARY_DIR}") -IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc") - IF(WIN32 AND ALSOFT_NO_UID_DEFS) - ADD_DEFINITIONS("-DAL_NO_UID_DEFS") - ENDIF() -ENDIF() +INCLUDE_DIRECTORIES("${OpenAL_SOURCE_DIR}/include" "${OpenAL_SOURCE_DIR}/common" "${OpenAL_BINARY_DIR}") IF(NOT CMAKE_BUILD_TYPE) SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING @@ -273,11 +281,9 @@ IF(NOT CMAKE_DEBUG_POSTFIX) FORCE) ENDIF() -SET(EXTRA_CFLAGS "") IF(MSVC) - ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) - ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_DEPRECATE) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} /wd4098") + SET(CPP_DEFS ${CPP_DEFS} _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_DEPRECATE) + SET(C_FLAGS ${C_FLAGS} /wd4098) IF(NOT DXSDK_DIR) STRING(REGEX REPLACE "\\\\" "/" DXSDK_DIR "$ENV{DXSDK_DIR}") @@ -299,25 +305,14 @@ IF(MSVC) ENDFOREACH(flag_var) ENDIF() ELSE() - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Winline -Wall") + SET(C_FLAGS ${C_FLAGS} -Winline -Wall) CHECK_C_COMPILER_FLAG(-Wextra HAVE_W_EXTRA) IF(HAVE_W_EXTRA) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Wextra") + SET(C_FLAGS ${C_FLAGS} -Wextra) ENDIF() IF(ALSOFT_WERROR) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -Werror") - ENDIF() - - # Force enable -fPIC for CMake versions before 2.8.9 (later versions have - # the POSITION_INDEPENDENT_CODE target property). The static common library - # will be linked into the dynamic openal library, which requires all its - # code to be position-independent. - IF(CMAKE_VERSION VERSION_LESS "2.8.9" AND NOT WIN32) - CHECK_C_COMPILER_FLAG(-fPIC HAVE_FPIC_SWITCH) - IF(HAVE_FPIC_SWITCH) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fPIC") - ENDIF() + SET(C_FLAGS ${C_FLAGS} -Werror) ENDIF() # We want RelWithDebInfo to actually include debug stuff (define _DEBUG @@ -328,6 +323,11 @@ ELSE() ENDIF() ENDFOREACH() + CHECK_C_COMPILER_FLAG(-fno-math-errno HAVE_FNO_MATH_ERRNO) + IF(HAVE_FNO_MATH_ERRNO) + SET(C_FLAGS ${C_FLAGS} -fno-math-errno) + ENDIF() + CHECK_C_SOURCE_COMPILES("int foo() __attribute__((destructor)); int main() {return 0;}" HAVE_GCC_DESTRUCTOR) @@ -344,7 +344,7 @@ int main() HAVE_STATIC_LIBGCC_SWITCH ) if(HAVE_STATIC_LIBGCC_SWITCH) - set(EXTRA_LIBS ${EXTRA_LIBS} -static-libgcc) + SET(LINKER_FLAGS ${LINKER_FLAGS} -static-libgcc) endif() set(CMAKE_REQUIRED_LIBRARIES ${OLD_REQUIRED_LIBRARIES}) unset(OLD_REQUIRED_LIBRARIES) @@ -352,7 +352,6 @@ int main() ENDIF() # Set visibility/export options if available -SET(HIDDEN_DECL "") IF(WIN32) SET(EXPORT_DECL "__declspec(dllexport)") IF(NOT MINGW) @@ -380,8 +379,7 @@ ELSE() IF(HAVE_GCC_PROTECTED_VISIBILITY OR HAVE_GCC_DEFAULT_VISIBILITY) CHECK_C_COMPILER_FLAG(-fvisibility=hidden HAVE_VISIBILITY_HIDDEN_SWITCH) IF(HAVE_VISIBILITY_HIDDEN_SWITCH) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -fvisibility=hidden") - SET(HIDDEN_DECL "__attribute__((visibility(\"hidden\")))") + SET(C_FLAGS ${C_FLAGS} -fvisibility=hidden) ENDIF() ENDIF() @@ -394,32 +392,44 @@ ELSE() SET(CMAKE_REQUIRED_FLAGS "${OLD_REQUIRED_FLAGS}") ENDIF() +CHECK_C_SOURCE_COMPILES(" +int main() +{ + float *ptr; + ptr = __builtin_assume_aligned(ptr, 16); + return 0; +}" HAVE___BUILTIN_ASSUME_ALIGNED) +IF(HAVE___BUILTIN_ASSUME_ALIGNED) + SET(ASSUME_ALIGNED_DECL "__builtin_assume_aligned(x, y)") +ELSE() + SET(ASSUME_ALIGNED_DECL "x") +ENDIF() + SET(SSE_SWITCH "") SET(SSE2_SWITCH "") SET(SSE3_SWITCH "") SET(SSE4_1_SWITCH "") SET(FPU_NEON_SWITCH "") -IF(NOT MSVC) - CHECK_C_COMPILER_FLAG(-msse HAVE_MSSE_SWITCH) - IF(HAVE_MSSE_SWITCH) - SET(SSE_SWITCH "-msse") - ENDIF() - CHECK_C_COMPILER_FLAG(-msse2 HAVE_MSSE2_SWITCH) - IF(HAVE_MSSE2_SWITCH) - SET(SSE2_SWITCH "-msse2") - ENDIF() - CHECK_C_COMPILER_FLAG(-msse3 HAVE_MSSE3_SWITCH) - IF(HAVE_MSSE3_SWITCH) - SET(SSE3_SWITCH "-msse3") - ENDIF() - CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH) - IF(HAVE_MSSE4_1_SWITCH) - SET(SSE4_1_SWITCH "-msse4.1") - ENDIF() - CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_MFPU_NEON_SWITCH) - IF(HAVE_MFPU_NEON_SWITCH) - SET(FPU_NEON_SWITCH "-mfpu=neon") - ENDIF() + +CHECK_C_COMPILER_FLAG(-msse HAVE_MSSE_SWITCH) +IF(HAVE_MSSE_SWITCH) + SET(SSE_SWITCH "-msse") +ENDIF() +CHECK_C_COMPILER_FLAG(-msse2 HAVE_MSSE2_SWITCH) +IF(HAVE_MSSE2_SWITCH) + SET(SSE2_SWITCH "-msse2") +ENDIF() +CHECK_C_COMPILER_FLAG(-msse3 HAVE_MSSE3_SWITCH) +IF(HAVE_MSSE3_SWITCH) + SET(SSE3_SWITCH "-msse3") +ENDIF() +CHECK_C_COMPILER_FLAG(-msse4.1 HAVE_MSSE4_1_SWITCH) +IF(HAVE_MSSE4_1_SWITCH) + SET(SSE4_1_SWITCH "-msse4.1") +ENDIF() +CHECK_C_COMPILER_FLAG(-mfpu=neon HAVE_MFPU_NEON_SWITCH) +IF(HAVE_MFPU_NEON_SWITCH) + SET(FPU_NEON_SWITCH "-mfpu=neon") ENDIF() CHECK_C_SOURCE_COMPILES("int foo(const char *str, ...) __attribute__((format(printf, 1, 2))); @@ -442,9 +452,10 @@ IF(NOT HAVE_GUIDDEF_H) ENDIF() # Some systems need libm for some of the following math functions to work +SET(MATH_LIB ) CHECK_LIBRARY_EXISTS(m pow "" HAVE_LIBM) IF(HAVE_LIBM) - SET(EXTRA_LIBS m ${EXTRA_LIBS}) + SET(MATH_LIB ${MATH_LIB} m) SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} m) ENDIF() @@ -476,19 +487,31 @@ IF(HAVE_INTRIN_H) __cpuid(regs, 0); return regs[0]; }" HAVE_CPUID_INTRINSIC) + CHECK_C_SOURCE_COMPILES("#include + int main() + { + unsigned long idx = 0; + _BitScanForward64(&idx, 1); + return idx; + }" HAVE_BITSCANFORWARD64_INTRINSIC) + CHECK_C_SOURCE_COMPILES("#include + int main() + { + unsigned long idx = 0; + _BitScanForward(&idx, 1); + return idx; + }" HAVE_BITSCANFORWARD_INTRINSIC) ENDIF() +CHECK_SYMBOL_EXISTS(sysconf unistd.h HAVE_SYSCONF) CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC) CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN) CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC) +CHECK_SYMBOL_EXISTS(proc_pidpath libproc.h HAVE_PROC_PIDPATH) CHECK_SYMBOL_EXISTS(lrintf math.h HAVE_LRINTF) CHECK_SYMBOL_EXISTS(modff math.h HAVE_MODFF) -IF(NOT HAVE_C99_VLA) - CHECK_SYMBOL_EXISTS(alloca malloc.h HAVE_ALLOCA) - IF(NOT HAVE_ALLOCA) - MESSAGE(FATAL_ERROR "No alloca function found, please report!") - ENDIF() -ENDIF() +CHECK_SYMBOL_EXISTS(log2f math.h HAVE_LOG2F) +CHECK_SYMBOL_EXISTS(cbrtf math.h HAVE_CBRTF) IF(HAVE_FLOAT_H) CHECK_SYMBOL_EXISTS(_controlfp float.h HAVE__CONTROLFP) @@ -504,7 +527,7 @@ IF(NOT HAVE_STRCASECMP) MESSAGE(FATAL_ERROR "No case-insensitive compare function found, please report!") ENDIF() - ADD_DEFINITIONS(-Dstrcasecmp=_stricmp) + SET(CPP_DEFS ${CPP_DEFS} strcasecmp=_stricmp) ENDIF() CHECK_FUNCTION_EXISTS(strncasecmp HAVE_STRNCASECMP) @@ -514,7 +537,7 @@ IF(NOT HAVE_STRNCASECMP) MESSAGE(FATAL_ERROR "No case-insensitive size-limitted compare function found, please report!") ENDIF() - ADD_DEFINITIONS(-Dstrncasecmp=_strnicmp) + SET(CPP_DEFS ${CPP_DEFS} strncasecmp=_strnicmp) ENDIF() CHECK_SYMBOL_EXISTS(strnlen string.h HAVE_STRNLEN) @@ -525,7 +548,7 @@ IF(NOT HAVE_SNPRINTF) MESSAGE(FATAL_ERROR "No snprintf function found, please report!") ENDIF() - ADD_DEFINITIONS(-Dsnprintf=_snprintf) + SET(CPP_DEFS ${CPP_DEFS} snprintf=_snprintf) ENDIF() CHECK_SYMBOL_EXISTS(isfinite math.h HAVE_ISFINITE) @@ -536,9 +559,9 @@ IF(NOT HAVE_ISFINITE) IF(NOT HAVE__FINITE) MESSAGE(FATAL_ERROR "No isfinite function found, please report!") ENDIF() - ADD_DEFINITIONS(-Disfinite=_finite) + SET(CPP_DEFS ${CPP_DEFS} isfinite=_finite) ELSE() - ADD_DEFINITIONS(-Disfinite=finite) + SET(CPP_DEFS ${CPP_DEFS} isfinite=finite) ENDIF() ENDIF() @@ -549,12 +572,17 @@ IF(NOT HAVE_ISNAN) MESSAGE(FATAL_ERROR "No isnan function found, please report!") ENDIF() - ADD_DEFINITIONS(-Disnan=_isnan) + SET(CPP_DEFS ${CPP_DEFS} isnan=_isnan) ENDIF() # Check if we have Windows headers -CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H -D_WIN32_WINNT=0x0502) +SET(OLD_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}) +SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0502) +CHECK_INCLUDE_FILE(windows.h HAVE_WINDOWS_H) +SET(CMAKE_REQUIRED_DEFINITIONS ${OLD_REQUIRED_DEFINITIONS}) +UNSET(OLD_REQUIRED_DEFINITIONS) + IF(NOT HAVE_WINDOWS_H) CHECK_SYMBOL_EXISTS(gettimeofday sys/time.h HAVE_GETTIMEOFDAY) IF(NOT HAVE_GETTIMEOFDAY) @@ -576,9 +604,9 @@ IF(NOT HAVE_WINDOWS_H) CHECK_C_COMPILER_FLAG(-pthread HAVE_PTHREAD) IF(HAVE_PTHREAD) - SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -pthread") SET(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -pthread") - SET(EXTRA_LIBS ${EXTRA_LIBS} -pthread) + SET(C_FLAGS ${C_FLAGS} -pthread) + SET(LINKER_FLAGS ${LINKER_FLAGS} -pthread) ENDIF() CHECK_LIBRARY_EXISTS(pthread pthread_create "" HAVE_LIBPTHREAD) @@ -603,6 +631,16 @@ int main() }" PTHREAD_SETNAME_NP_ONE_PARAM ) + CHECK_C_SOURCE_COMPILES(" +#include +#include +int main() +{ + pthread_setname_np(pthread_self(), \"%s\", \"testname\"); + return 0; +}" + PTHREAD_SETNAME_NP_THREE_PARAMS + ) ENDIF() CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np "pthread.h;pthread_np.h" HAVE_PTHREAD_MUTEXATTR_SETKIND_NP) ELSE() @@ -619,6 +657,15 @@ int main() }" PTHREAD_SETNAME_NP_ONE_PARAM ) + CHECK_C_SOURCE_COMPILES(" +#include +int main() +{ + pthread_setname_np(pthread_self(), \"%s\", \"testname\"); + return 0; +}" + PTHREAD_SETNAME_NP_THREE_PARAMS + ) ENDIF() CHECK_SYMBOL_EXISTS(pthread_mutexattr_setkind_np pthread.h HAVE_PTHREAD_MUTEXATTR_SETKIND_NP) ENDIF() @@ -631,6 +678,8 @@ int main() ENDIF() ENDIF() +CHECK_SYMBOL_EXISTS(getopt unistd.h HAVE_GETOPT) + # Check for a 64-bit type CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H) IF(NOT HAVE_STDINT_H) @@ -650,48 +699,96 @@ IF(NOT HAVE_STDINT_H) ENDIF() -SET(COMMON_OBJS common/almalloc.c - common/atomic.c - common/rwlock.c - common/threads.c - common/uintmap.c +SET(COMMON_OBJS + common/align.h + common/almalloc.c + common/almalloc.h + common/atomic.c + common/atomic.h + common/bool.h + common/math_defs.h + common/rwlock.c + common/rwlock.h + common/static_assert.h + common/threads.c + common/threads.h + common/uintmap.c + common/uintmap.h ) -SET(OPENAL_OBJS OpenAL32/alAuxEffectSlot.c - OpenAL32/alBuffer.c - OpenAL32/alEffect.c - OpenAL32/alError.c - OpenAL32/alExtension.c - OpenAL32/alFilter.c - OpenAL32/alListener.c - OpenAL32/alSource.c - OpenAL32/alState.c - OpenAL32/alThunk.c - OpenAL32/sample_cvt.c +SET(OPENAL_OBJS + OpenAL32/Include/bs2b.h + OpenAL32/Include/alMain.h + OpenAL32/Include/alu.h + + OpenAL32/Include/alAuxEffectSlot.h + OpenAL32/alAuxEffectSlot.c + OpenAL32/Include/alBuffer.h + OpenAL32/alBuffer.c + OpenAL32/Include/alEffect.h + OpenAL32/alEffect.c + OpenAL32/Include/alError.h + OpenAL32/alError.c + OpenAL32/alExtension.c + OpenAL32/Include/alFilter.h + OpenAL32/alFilter.c + OpenAL32/Include/alListener.h + OpenAL32/alListener.c + OpenAL32/Include/alSource.h + OpenAL32/alSource.c + OpenAL32/alState.c + OpenAL32/event.c + OpenAL32/Include/sample_cvt.h + OpenAL32/sample_cvt.c ) -SET(ALC_OBJS Alc/ALc.c - Alc/ALu.c - Alc/alcConfig.c - Alc/alcRing.c - Alc/bs2b.c - Alc/effects/chorus.c - Alc/effects/compressor.c - Alc/effects/dedicated.c - Alc/effects/distortion.c - Alc/effects/echo.c - Alc/effects/equalizer.c - Alc/effects/flanger.c - Alc/effects/modulator.c - Alc/effects/null.c - Alc/effects/reverb.c - Alc/helpers.c - Alc/bsinc.c - Alc/hrtf.c - Alc/uhjfilter.c - Alc/ambdec.c - Alc/bformatdec.c - Alc/panning.c - Alc/mixer.c - Alc/mixer_c.c +SET(ALC_OBJS + Alc/ALc.c + Alc/ALu.c + Alc/alconfig.c + Alc/alconfig.h + Alc/bs2b.c + Alc/converter.c + Alc/converter.h + Alc/inprogext.h + Alc/mastering.c + Alc/mastering.h + Alc/ringbuffer.c + Alc/ringbuffer.h + Alc/effects/chorus.c + Alc/effects/compressor.c + Alc/effects/dedicated.c + Alc/effects/distortion.c + Alc/effects/echo.c + Alc/effects/equalizer.c + Alc/effects/modulator.c + Alc/effects/null.c + Alc/effects/pshifter.c + Alc/effects/reverb.c + Alc/filters/defs.h + Alc/filters/filter.c + Alc/filters/nfc.c + Alc/filters/nfc.h + Alc/filters/splitter.c + Alc/filters/splitter.h + Alc/helpers.c + Alc/alstring.h + Alc/compat.h + Alc/cpu_caps.h + Alc/fpu_modes.h + Alc/logging.h + Alc/vector.h + Alc/hrtf.c + Alc/hrtf.h + Alc/uhjfilter.c + Alc/uhjfilter.h + Alc/ambdec.c + Alc/ambdec.h + Alc/bformatdec.c + Alc/bformatdec.h + Alc/panning.c + Alc/polymorphism.h + Alc/mixvoice.c + Alc/mixer/defs.h + Alc/mixer/mixer_c.c ) @@ -708,13 +805,14 @@ SET(HAVE_SOLARIS 0) SET(HAVE_SNDIO 0) SET(HAVE_QSA 0) SET(HAVE_DSOUND 0) -SET(HAVE_MMDEVAPI 0) +SET(HAVE_WASAPI 0) SET(HAVE_WINMM 0) SET(HAVE_PORTAUDIO 0) SET(HAVE_PULSEAUDIO 0) SET(HAVE_COREAUDIO 0) SET(HAVE_OPENSL 0) SET(HAVE_WAVE 0) +SET(HAVE_SDL2 0) # Check for SSE support OPTION(ALSOFT_REQUIRE_SSE "Require SSE support" OFF) @@ -724,9 +822,9 @@ IF(HAVE_XMMINTRIN_H) IF(ALSOFT_CPUEXT_SSE) IF(ALIGN_DECL OR HAVE_C11_ALIGNAS) SET(HAVE_SSE 1) - SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse.c) + SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse.c) IF(SSE_SWITCH) - SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse.c PROPERTIES + SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse.c PROPERTIES COMPILE_FLAGS "${SSE_SWITCH}") ENDIF() SET(CPU_EXTS "${CPU_EXTS}, SSE") @@ -744,9 +842,9 @@ IF(HAVE_EMMINTRIN_H) IF(HAVE_SSE AND ALSOFT_CPUEXT_SSE2) IF(ALIGN_DECL OR HAVE_C11_ALIGNAS) SET(HAVE_SSE2 1) - SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse2.c) + SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse2.c) IF(SSE2_SWITCH) - SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse2.c PROPERTIES + SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse2.c PROPERTIES COMPILE_FLAGS "${SSE2_SWITCH}") ENDIF() SET(CPU_EXTS "${CPU_EXTS}, SSE2") @@ -764,9 +862,9 @@ IF(HAVE_EMMINTRIN_H) IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE3) IF(ALIGN_DECL OR HAVE_C11_ALIGNAS) SET(HAVE_SSE3 1) - SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse3.c) + SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse3.c) IF(SSE2_SWITCH) - SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse3.c PROPERTIES + SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse3.c PROPERTIES COMPILE_FLAGS "${SSE3_SWITCH}") ENDIF() SET(CPU_EXTS "${CPU_EXTS}, SSE3") @@ -784,9 +882,9 @@ IF(HAVE_SMMINTRIN_H) IF(HAVE_SSE2 AND ALSOFT_CPUEXT_SSE4_1) IF(ALIGN_DECL OR HAVE_C11_ALIGNAS) SET(HAVE_SSE4_1 1) - SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_sse41.c) + SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_sse41.c) IF(SSE4_1_SWITCH) - SET_SOURCE_FILES_PROPERTIES(Alc/mixer_sse41.c PROPERTIES + SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_sse41.c PROPERTIES COMPILE_FLAGS "${SSE4_1_SWITCH}") ENDIF() SET(CPU_EXTS "${CPU_EXTS}, SSE4.1") @@ -799,14 +897,14 @@ ENDIF() # Check for ARM Neon support OPTION(ALSOFT_REQUIRE_NEON "Require ARM Neon support" OFF) -CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H) +CHECK_INCLUDE_FILE(arm_neon.h HAVE_ARM_NEON_H ${FPU_NEON_SWITCH}) IF(HAVE_ARM_NEON_H) OPTION(ALSOFT_CPUEXT_NEON "Enable ARM Neon support" ON) IF(ALSOFT_CPUEXT_NEON) SET(HAVE_NEON 1) - SET(ALC_OBJS ${ALC_OBJS} Alc/mixer_neon.c) + SET(ALC_OBJS ${ALC_OBJS} Alc/mixer/mixer_neon.c) IF(FPU_NEON_SWITCH) - SET_SOURCE_FILES_PROPERTIES(Alc/mixer_neon.c PROPERTIES + SET_SOURCE_FILES_PROPERTIES(Alc/mixer/mixer_neon.c PROPERTIES COMPILE_FLAGS "${FPU_NEON_SWITCH}") ENDIF() SET(CPU_EXTS "${CPU_EXTS}, Neon") @@ -830,10 +928,11 @@ ENDIF() SET(BACKENDS "") SET(ALC_OBJS ${ALC_OBJS} - Alc/backends/base.c - # Default backends, always available - Alc/backends/loopback.c - Alc/backends/null.c + Alc/backends/base.c + Alc/backends/base.h + # Default backends, always available + Alc/backends/loopback.c + Alc/backends/null.c ) # Check ALSA backend @@ -846,9 +945,7 @@ IF(ALSA_FOUND) SET(BACKENDS "${BACKENDS} ALSA${IS_LINKED},") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/alsa.c) ADD_BACKEND_LIBS(${ALSA_LIBRARIES}) - IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${ALSA_INCLUDE_DIRS}) - ENDIF() + SET(INC_PATHS ${INC_PATHS} ${ALSA_INCLUDE_DIRS}) ENDIF() ENDIF() IF(ALSOFT_REQUIRE_ALSA AND NOT HAVE_ALSA) @@ -864,9 +961,10 @@ IF(OSS_FOUND) SET(HAVE_OSS 1) SET(BACKENDS "${BACKENDS} OSS,") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/oss.c) - IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${OSS_INCLUDE_DIRS}) + IF(OSS_LIBRARIES) + SET(EXTRA_LIBS ${OSS_LIBRARIES} ${EXTRA_LIBS}) ENDIF() + SET(INC_PATHS ${INC_PATHS} ${OSS_INCLUDE_DIRS}) ENDIF() ENDIF() IF(ALSOFT_REQUIRE_OSS AND NOT HAVE_OSS) @@ -882,9 +980,7 @@ IF(AUDIOIO_FOUND) SET(HAVE_SOLARIS 1) SET(BACKENDS "${BACKENDS} Solaris,") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/solaris.c) - IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${AUDIOIO_INCLUDE_DIRS}) - ENDIF() + SET(INC_PATHS ${INC_PATHS} ${AUDIOIO_INCLUDE_DIRS}) ENDIF() ENDIF() IF(ALSOFT_REQUIRE_SOLARIS AND NOT HAVE_SOLARIS) @@ -901,9 +997,7 @@ IF(SOUNDIO_FOUND) SET(BACKENDS "${BACKENDS} SndIO (linked),") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sndio.c) SET(EXTRA_LIBS ${SOUNDIO_LIBRARIES} ${EXTRA_LIBS}) - IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${SOUNDIO_INCLUDE_DIRS}) - ENDIF() + SET(INC_PATHS ${INC_PATHS} ${SOUNDIO_INCLUDE_DIRS}) ENDIF() ENDIF() IF(ALSOFT_REQUIRE_SNDIO AND NOT HAVE_SNDIO) @@ -920,9 +1014,7 @@ IF(QSA_FOUND) SET(BACKENDS "${BACKENDS} QSA (linked),") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/qsa.c) SET(EXTRA_LIBS ${QSA_LIBRARIES} ${EXTRA_LIBS}) - IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${QSA_INCLUDE_DIRS}) - ENDIF() + SET(INC_PATHS ${INC_PATHS} ${QSA_INCLUDE_DIRS}) ENDIF() ENDIF() IF(ALSOFT_REQUIRE_QSA AND NOT HAVE_QSA) @@ -932,10 +1024,13 @@ ENDIF() # Check Windows-only backends OPTION(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF) OPTION(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF) -OPTION(ALSOFT_REQUIRE_MMDEVAPI "Require MMDevApi backend" OFF) +OPTION(ALSOFT_REQUIRE_WASAPI "Require WASAPI backend" OFF) IF(HAVE_WINDOWS_H) + SET(OLD_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}) + SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0502) + # Check MMSystem backend - CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H -D_WIN32_WINNT=0x0502) + CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H) IF(HAVE_MMSYSTEM_H) CHECK_SHARED_FUNCTION_EXISTS(waveOutOpen "windows.h;mmsystem.h" winmm "" HAVE_LIBWINMM) IF(HAVE_LIBWINMM) @@ -958,22 +1053,23 @@ IF(HAVE_WINDOWS_H) SET(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c) ADD_BACKEND_LIBS(${DSOUND_LIBRARIES}) - IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${DSOUND_INCLUDE_DIRS}) - ENDIF() + SET(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIRS}) ENDIF() ENDIF() - # Check for MMDevApi backend + # Check for WASAPI backend CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H) IF(HAVE_MMDEVICEAPI_H) - OPTION(ALSOFT_BACKEND_MMDEVAPI "Enable MMDevApi backend" ON) - IF(ALSOFT_BACKEND_MMDEVAPI) - SET(HAVE_MMDEVAPI 1) - SET(BACKENDS "${BACKENDS} MMDevApi,") - SET(ALC_OBJS ${ALC_OBJS} Alc/backends/mmdevapi.c) + OPTION(ALSOFT_BACKEND_WASAPI "Enable WASAPI backend" ON) + IF(ALSOFT_BACKEND_WASAPI) + SET(HAVE_WASAPI 1) + SET(BACKENDS "${BACKENDS} WASAPI,") + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/wasapi.c) ENDIF() ENDIF() + + SET(CMAKE_REQUIRED_DEFINITIONS ${OLD_REQUIRED_DEFINITIONS}) + UNSET(OLD_REQUIRED_DEFINITIONS) ENDIF() IF(ALSOFT_REQUIRE_WINMM AND NOT HAVE_WINMM) MESSAGE(FATAL_ERROR "Failed to enabled required WinMM backend") @@ -981,8 +1077,8 @@ ENDIF() IF(ALSOFT_REQUIRE_DSOUND AND NOT HAVE_DSOUND) MESSAGE(FATAL_ERROR "Failed to enabled required DSound backend") ENDIF() -IF(ALSOFT_REQUIRE_MMDEVAPI AND NOT HAVE_MMDEVAPI) - MESSAGE(FATAL_ERROR "Failed to enabled required MMDevApi backend") +IF(ALSOFT_REQUIRE_WASAPI AND NOT HAVE_WASAPI) + MESSAGE(FATAL_ERROR "Failed to enabled required WASAPI backend") ENDIF() # Check PortAudio backend @@ -995,9 +1091,7 @@ IF(PORTAUDIO_FOUND) SET(BACKENDS "${BACKENDS} PortAudio${IS_LINKED},") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/portaudio.c) ADD_BACKEND_LIBS(${PORTAUDIO_LIBRARIES}) - IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${PORTAUDIO_INCLUDE_DIRS}) - ENDIF() + SET(INC_PATHS ${INC_PATHS} ${PORTAUDIO_INCLUDE_DIRS}) ENDIF() ENDIF() IF(ALSOFT_REQUIRE_PORTAUDIO AND NOT HAVE_PORTAUDIO) @@ -1014,9 +1108,7 @@ IF(PULSEAUDIO_FOUND) SET(BACKENDS "${BACKENDS} PulseAudio${IS_LINKED},") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/pulseaudio.c) ADD_BACKEND_LIBS(${PULSEAUDIO_LIBRARIES}) - IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${PULSEAUDIO_INCLUDE_DIRS}) - ENDIF() + SET(INC_PATHS ${INC_PATHS} ${PULSEAUDIO_INCLUDE_DIRS}) ENDIF() ENDIF() IF(ALSOFT_REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO) @@ -1033,9 +1125,7 @@ IF(JACK_FOUND) SET(BACKENDS "${BACKENDS} JACK${IS_LINKED},") SET(ALC_OBJS ${ALC_OBJS} Alc/backends/jack.c) ADD_BACKEND_LIBS(${JACK_LIBRARIES}) - IF(CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${JACK_INCLUDE_DIRS}) - ENDIF() + SET(INC_PATHS ${INC_PATHS} ${JACK_INCLUDE_DIRS}) ENDIF() ENDIF() IF(ALSOFT_REQUIRE_JACK AND NOT HAVE_JACK) @@ -1094,6 +1184,24 @@ IF(ALSOFT_REQUIRE_OPENSL AND NOT HAVE_OPENSL) MESSAGE(FATAL_ERROR "Failed to enabled required OpenSL backend") ENDIF() +# Check for SDL2 backend +OPTION(ALSOFT_REQUIRE_SDL2 "Require SDL2 backend" OFF) +FIND_PACKAGE(SDL2) +IF(SDL2_FOUND) + # Off by default, since it adds a runtime dependency + OPTION(ALSOFT_BACKEND_SDL2 "Enable SDL2 backend" OFF) + IF(ALSOFT_BACKEND_SDL2) + SET(HAVE_SDL2 1) + SET(ALC_OBJS ${ALC_OBJS} Alc/backends/sdl2.c) + SET(BACKENDS "${BACKENDS} SDL2,") + SET(EXTRA_LIBS ${SDL2_LIBRARY} ${EXTRA_LIBS}) + SET(INC_PATHS ${INC_PATHS} ${SDL2_INCLUDE_DIR}) + ENDIF() +ENDIF() +IF(ALSOFT_REQUIRE_SDL2 AND NOT SDL2_FOUND) + MESSAGE(FATAL_ERROR "Failed to enabled required SDL2 backend") +ENDIF() + # Optionally enable the Wave Writer backend OPTION(ALSOFT_BACKEND_WAVE "Enable Wave Writer backend" ON) IF(ALSOFT_BACKEND_WAVE) @@ -1105,50 +1213,91 @@ ENDIF() # This is always available SET(BACKENDS "${BACKENDS} Null") + +FIND_PACKAGE(Git) +IF(GIT_FOUND AND EXISTS "${OpenAL_SOURCE_DIR}/.git") + # Get the current working branch and its latest abbreviated commit hash + ADD_CUSTOM_TARGET(build_version + ${CMAKE_COMMAND} -D GIT_EXECUTABLE=${GIT_EXECUTABLE} + -D LIB_VERSION=${LIB_VERSION} + -D SRC=${OpenAL_SOURCE_DIR}/version.h.in + -D DST=${OpenAL_BINARY_DIR}/version.h + -P ${OpenAL_SOURCE_DIR}/version.cmake + WORKING_DIRECTORY "${OpenAL_SOURCE_DIR}" + VERBATIM + ) +ELSE() + SET(GIT_BRANCH "UNKNOWN") + SET(GIT_COMMIT_HASH "unknown") + CONFIGURE_FILE( + "${OpenAL_SOURCE_DIR}/version.h.in" + "${OpenAL_BINARY_DIR}/version.h") +ENDIF() + +SET(NATIVE_SRC_DIR "${OpenAL_SOURCE_DIR}/native-tools/") +SET(NATIVE_BIN_DIR "${OpenAL_BINARY_DIR}/native-tools/") +FILE(MAKE_DIRECTORY "${NATIVE_BIN_DIR}") + +SET(BIN2H_COMMAND "${NATIVE_BIN_DIR}bin2h") +SET(BSINCGEN_COMMAND "${NATIVE_BIN_DIR}bsincgen") +ADD_CUSTOM_COMMAND(OUTPUT "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}" + COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" "${NATIVE_SRC_DIR}" + COMMAND ${CMAKE_COMMAND} -E remove "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}" + COMMAND ${CMAKE_COMMAND} --build . --config "Release" + WORKING_DIRECTORY "${NATIVE_BIN_DIR}" + DEPENDS "${NATIVE_SRC_DIR}CMakeLists.txt" + IMPLICIT_DEPENDS C "${NATIVE_SRC_DIR}bin2h.c" + C "${NATIVE_SRC_DIR}bsincgen.c" + VERBATIM +) +ADD_CUSTOM_TARGET(native-tools + DEPENDS "${BIN2H_COMMAND}" "${BSINCGEN_COMMAND}" + VERBATIM +) + option(ALSOFT_EMBED_HRTF_DATA "Embed the HRTF data files (increases library footprint)" OFF) if(ALSOFT_EMBED_HRTF_DATA) - if(WIN32) - set(ALC_OBJS ${ALC_OBJS} Alc/hrtf_res.rc) - else() - set(FILENAMES default-44100.mhr default-48000.mhr) - foreach(FILENAME ${FILENAMES}) - set(outfile ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${FILENAME}${CMAKE_C_OUTPUT_EXTENSION}) - add_custom_command(OUTPUT ${outfile} - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/hrtf/${FILENAME}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/hrtf" - COMMAND "${CMAKE_LINKER}" -r -b binary -o "${outfile}" ${FILENAME} - COMMAND "${CMAKE_OBJCOPY}" --rename-section .data=.rodata,alloc,load,readonly,data,contents "${outfile}" "${outfile}" - COMMENT "Generating ${FILENAME}${CMAKE_C_OUTPUT_EXTENSION}" - VERBATIM - ) - set(ALC_OBJS ${ALC_OBJS} ${outfile}) - endforeach() - unset(outfile) - unset(FILENAMES) - endif() + MACRO(make_hrtf_header FILENAME VARNAME) + SET(infile "${OpenAL_SOURCE_DIR}/hrtf/${FILENAME}") + SET(outfile "${OpenAL_BINARY_DIR}/${FILENAME}.h") + + ADD_CUSTOM_COMMAND(OUTPUT "${outfile}" + COMMAND "${BIN2H_COMMAND}" "${infile}" "${outfile}" ${VARNAME} + DEPENDS native-tools "${infile}" + VERBATIM + ) + SET(ALC_OBJS ${ALC_OBJS} "${outfile}") + ENDMACRO() + + make_hrtf_header(default-44100.mhr "hrtf_default_44100") + make_hrtf_header(default-48000.mhr "hrtf_default_48000") endif() +ADD_CUSTOM_COMMAND(OUTPUT "${OpenAL_BINARY_DIR}/bsinc_inc.h" + COMMAND "${BSINCGEN_COMMAND}" "${OpenAL_BINARY_DIR}/bsinc_inc.h" + DEPENDS native-tools "${NATIVE_SRC_DIR}bsincgen.c" + VERBATIM +) +SET(ALC_OBJS ${ALC_OBJS} "${OpenAL_BINARY_DIR}/bsinc_inc.h") + IF(ALSOFT_UTILS AND NOT ALSOFT_NO_CONFIG_UTIL) add_subdirectory(utils/alsoft-config) ENDIF() IF(ALSOFT_EXAMPLES) - FIND_PACKAGE(SDL2) + IF(NOT SDL2_FOUND) + FIND_PACKAGE(SDL2) + ENDIF() IF(SDL2_FOUND) FIND_PACKAGE(SDL_sound) - IF(SDL_SOUND_FOUND AND CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) - ENDIF() FIND_PACKAGE(FFmpeg COMPONENTS AVFORMAT AVCODEC AVUTIL SWSCALE SWRESAMPLE) - IF(FFMPEG_FOUND AND CMAKE_VERSION VERSION_LESS "2.8.8") - INCLUDE_DIRECTORIES(${FFMPEG_INCLUDE_DIRS}) - ENDIF() ENDIF() ENDIF() -IF(LIBTYPE STREQUAL "STATIC") - ADD_DEFINITIONS(-DAL_LIBTYPE_STATIC) - SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC ${PKG_CONFIG_CFLAGS}) +IF(NOT WIN32) + SET(LIBNAME "openal") +ELSE() + SET(LIBNAME "OpenAL32") ENDIF() # Needed for openal.pc.in @@ -1158,6 +1307,20 @@ SET(libdir "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") SET(bindir "\${exec_prefix}/${CMAKE_INSTALL_BINDIR}") SET(includedir "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") SET(PACKAGE_VERSION "${LIB_VERSION}") +SET(PKG_CONFIG_CFLAGS ) +SET(PKG_CONFIG_PRIVATE_LIBS ) +IF(LIBTYPE STREQUAL "STATIC") + SET(PKG_CONFIG_CFLAGS -DAL_LIBTYPE_STATIC) + FOREACH(FLAG ${LINKER_FLAGS} ${EXTRA_LIBS} ${MATH_LIB}) + # If this is already a linker flag, or is a full path+file, add it + # as-is. Otherwise, it's a name intended to be dressed as -lname. + IF(FLAG MATCHES "^-.*" OR EXISTS "${FLAG}") + SET(PKG_CONFIG_PRIVATE_LIBS "${PKG_CONFIG_PRIVATE_LIBS} ${FLAG}") + ELSE() + SET(PKG_CONFIG_PRIVATE_LIBS "${PKG_CONFIG_PRIVATE_LIBS} -l${FLAG}") + ENDIF() + ENDFOREACH() +ENDIF() # End configuration CONFIGURE_FILE( @@ -1168,89 +1331,113 @@ CONFIGURE_FILE( "${OpenAL_BINARY_DIR}/openal.pc" @ONLY) -# Build a common library with reusable helpers + +# Add a static library with common functions used by multiple targets ADD_LIBRARY(common STATIC ${COMMON_OBJS}) -SET_PROPERTY(TARGET common APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) -IF(NOT LIBTYPE STREQUAL "STATIC") - SET_PROPERTY(TARGET common PROPERTY POSITION_INDEPENDENT_CODE TRUE) -ENDIF() +TARGET_COMPILE_DEFINITIONS(common PRIVATE ${CPP_DEFS}) +TARGET_COMPILE_OPTIONS(common PRIVATE ${C_FLAGS}) + + +UNSET(HAS_ROUTER) +SET(IMPL_TARGET OpenAL) +SET(COMMON_LIB ) +SET(SUBSYS_FLAG ) # Build main library IF(LIBTYPE STREQUAL "STATIC") - ADD_LIBRARY(${LIBNAME} STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS}) + SET(CPP_DEFS ${CPP_DEFS} AL_LIBTYPE_STATIC) + IF(WIN32 AND ALSOFT_NO_UID_DEFS) + SET(CPP_DEFS ${CPP_DEFS} AL_NO_UID_DEFS) + ENDIF() + ADD_LIBRARY(OpenAL STATIC ${COMMON_OBJS} ${OPENAL_OBJS} ${ALC_OBJS}) ELSE() - ADD_LIBRARY(${LIBNAME} SHARED ${OPENAL_OBJS} ${ALC_OBJS}) -ENDIF() -SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) -SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_DEFINITIONS AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES) -IF(WIN32 AND ALSOFT_NO_UID_DEFS) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY COMPILE_DEFINITIONS AL_NO_UID_DEFS) -ENDIF() -SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES "${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc") -IF(HAVE_ALSA) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${ALSA_INCLUDE_DIRS}) -ENDIF() -IF(HAVE_OSS) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${OSS_INCLUDE_DIRS}) -ENDIF() -IF(HAVE_SOLARIS) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${AUDIOIO_INCLUDE_DIRS}) -ENDIF() -IF(HAVE_SNDIO) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${SOUNDIO_INCLUDE_DIRS}) -ENDIF() -IF(HAVE_QSA) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${QSA_INCLUDE_DIRS}) -ENDIF() -IF(HAVE_DSOUND) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${DSOUND_INCLUDE_DIRS}) -ENDIF() -IF(HAVE_PORTAUDIO) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${PORTAUDIO_INCLUDE_DIRS}) -ENDIF() -IF(HAVE_PULSEAUDIO) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${PULSEAUDIO_INCLUDE_DIRS}) -ENDIF() -IF(HAVE_JACK) - SET_PROPERTY(TARGET ${LIBNAME} APPEND PROPERTY INCLUDE_DIRECTORIES ${JACK_INCLUDE_DIRS}) -ENDIF() -SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES VERSION ${LIB_VERSION} - SOVERSION ${LIB_MAJOR_VERSION}) -IF(WIN32 AND NOT LIBTYPE STREQUAL "STATIC") - SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES PREFIX "") + # Make sure to compile the common code with PIC, since it'll be linked into + # shared libs that needs it. + SET_PROPERTY(TARGET common PROPERTY POSITION_INDEPENDENT_CODE TRUE) + SET(COMMON_LIB common) - IF(MINGW AND ALSOFT_BUILD_IMPORT_LIB) - FIND_PROGRAM(SED_EXECUTABLE NAMES sed DOC "sed executable") - FIND_PROGRAM(DLLTOOL_EXECUTABLE NAMES "${DLLTOOL}" DOC "dlltool executable") - IF(NOT SED_EXECUTABLE OR NOT DLLTOOL_EXECUTABLE) - MESSAGE(STATUS "") - IF(NOT SED_EXECUTABLE) - MESSAGE(STATUS "WARNING: Cannot find sed, disabling .def/.lib generation") - ENDIF() - IF(NOT DLLTOOL_EXECUTABLE) - MESSAGE(STATUS "WARNING: Cannot find dlltool, disabling .def/.lib generation") - ENDIF() - ELSE() - SET_TARGET_PROPERTIES(${LIBNAME} PROPERTIES LINK_FLAGS "-Wl,--output-def,${LIBNAME}.def") - ADD_CUSTOM_COMMAND(TARGET ${LIBNAME} POST_BUILD - COMMAND "${SED_EXECUTABLE}" -i -e "s/ @[^ ]*//" ${LIBNAME}.def - COMMAND "${DLLTOOL_EXECUTABLE}" -d ${LIBNAME}.def -l ${LIBNAME}.lib -D ${LIBNAME}.dll - COMMENT "Stripping ordinals from ${LIBNAME}.def and generating ${LIBNAME}.lib..." - VERBATIM - ) + IF(WIN32) + IF(MSVC) + SET(SUBSYS_FLAG ${SUBSYS_FLAG} "/SUBSYSTEM:WINDOWS") + ELSEIF(CMAKE_COMPILER_IS_GNUCC) + SET(SUBSYS_FLAG ${SUBSYS_FLAG} "-mwindows") ENDIF() ENDIF() + + IF(WIN32 AND ALSOFT_BUILD_ROUTER) + ADD_LIBRARY(OpenAL SHARED router/router.c router/router.h router/alc.c router/al.c) + TARGET_COMPILE_DEFINITIONS(OpenAL + PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS}) + TARGET_COMPILE_OPTIONS(OpenAL PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(OpenAL PRIVATE ${LINKER_FLAGS} ${COMMON_LIB}) + SET_TARGET_PROPERTIES(OpenAL PROPERTIES PREFIX "") + SET_TARGET_PROPERTIES(OpenAL PROPERTIES OUTPUT_NAME ${LIBNAME}) + IF(TARGET build_version) + ADD_DEPENDENCIES(OpenAL build_version) + ENDIF() + SET(HAS_ROUTER 1) + + SET(LIBNAME "soft_oal") + SET(IMPL_TARGET soft_oal) + ENDIF() + + ADD_LIBRARY(${IMPL_TARGET} SHARED ${OPENAL_OBJS} ${ALC_OBJS}) + IF(WIN32) + SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES PREFIX "") + ENDIF() +ENDIF() +SET_TARGET_PROPERTIES(${IMPL_TARGET} PROPERTIES OUTPUT_NAME ${LIBNAME} + VERSION ${LIB_VERSION} + SOVERSION ${LIB_MAJOR_VERSION} +) +TARGET_COMPILE_DEFINITIONS(${IMPL_TARGET} + PRIVATE AL_BUILD_LIBRARY AL_ALEXT_PROTOTYPES ${CPP_DEFS}) +TARGET_INCLUDE_DIRECTORIES(${IMPL_TARGET} + PRIVATE "${OpenAL_SOURCE_DIR}/OpenAL32/Include" "${OpenAL_SOURCE_DIR}/Alc" ${INC_PATHS}) +TARGET_COMPILE_OPTIONS(${IMPL_TARGET} PRIVATE ${C_FLAGS}) +TARGET_LINK_LIBRARIES(${IMPL_TARGET} + PRIVATE ${LINKER_FLAGS} ${COMMON_LIB} ${EXTRA_LIBS} ${MATH_LIB}) +IF(TARGET build_version) + ADD_DEPENDENCIES(${IMPL_TARGET} build_version) +ENDIF() + +IF(WIN32 AND MINGW AND ALSOFT_BUILD_IMPORT_LIB AND NOT LIBTYPE STREQUAL "STATIC") + FIND_PROGRAM(SED_EXECUTABLE NAMES sed DOC "sed executable") + FIND_PROGRAM(DLLTOOL_EXECUTABLE NAMES "${DLLTOOL}" DOC "dlltool executable") + IF(NOT SED_EXECUTABLE OR NOT DLLTOOL_EXECUTABLE) + MESSAGE(STATUS "") + IF(NOT SED_EXECUTABLE) + MESSAGE(STATUS "WARNING: Cannot find sed, disabling .def/.lib generation") + ENDIF() + IF(NOT DLLTOOL_EXECUTABLE) + MESSAGE(STATUS "WARNING: Cannot find dlltool, disabling .def/.lib generation") + ENDIF() + ELSE() + SET_PROPERTY(TARGET OpenAL APPEND_STRING PROPERTY LINK_FLAGS + " -Wl,--output-def,OpenAL32.def") + ADD_CUSTOM_COMMAND(TARGET OpenAL POST_BUILD + COMMAND "${SED_EXECUTABLE}" -i -e "s/ @[^ ]*//" OpenAL32.def + COMMAND "${DLLTOOL_EXECUTABLE}" -d OpenAL32.def -l OpenAL32.lib -D OpenAL32.dll + COMMENT "Stripping ordinals from OpenAL32.def and generating OpenAL32.lib..." + VERBATIM + ) + ENDIF() ENDIF() -TARGET_LINK_LIBRARIES(${LIBNAME} common ${EXTRA_LIBS}) - IF(ALSOFT_INSTALL) - # Add an install target here - INSTALL(TARGETS ${LIBNAME} + INSTALL(TARGETS OpenAL EXPORT OpenAL RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ${CMAKE_INSTALL_INCLUDEDIR}/AL ) + EXPORT(TARGETS OpenAL + NAMESPACE OpenAL:: + FILE OpenALConfig.cmake) + INSTALL(EXPORT OpenAL + DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/OpenAL + NAMESPACE OpenAL:: + FILE OpenALConfig.cmake) INSTALL(FILES include/AL/al.h include/AL/alc.h include/AL/alext.h @@ -1261,9 +1448,19 @@ IF(ALSOFT_INSTALL) ) INSTALL(FILES "${OpenAL_BINARY_DIR}/openal.pc" DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + IF(TARGET soft_oal) + INSTALL(TARGETS soft_oal + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ) + ENDIF() ENDIF() +if(HAS_ROUTER) + message(STATUS "") + message(STATUS "Building DLL router") +endif() + MESSAGE(STATUS "") MESSAGE(STATUS "Building OpenAL with support for the following backends:") MESSAGE(STATUS " ${BACKENDS}") @@ -1309,6 +1506,7 @@ IF(ALSOFT_AMBDEC_PRESETS) INSTALL(FILES presets/3D7.1.ambdec presets/hexagon.ambdec presets/itu5.1.ambdec + presets/itu5.1-nocenter.ambdec presets/rectangle.ambdec presets/square.ambdec presets/presets.txt @@ -1320,23 +1518,22 @@ ENDIF() IF(ALSOFT_UTILS) ADD_EXECUTABLE(openal-info utils/openal-info.c) - SET_PROPERTY(TARGET openal-info APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - TARGET_LINK_LIBRARIES(openal-info ${LIBNAME}) + TARGET_COMPILE_OPTIONS(openal-info PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(openal-info PRIVATE ${LINKER_FLAGS} OpenAL) - ADD_EXECUTABLE(makehrtf utils/makehrtf.c) - SET_PROPERTY(TARGET makehrtf APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - IF(HAVE_LIBM) - TARGET_LINK_LIBRARIES(makehrtf m) + SET(MAKEHRTF_SRCS utils/makehrtf.c) + IF(NOT HAVE_GETOPT) + SET(MAKEHRTF_SRCS ${MAKEHRTF_SRCS} utils/getopt.c utils/getopt.h) ENDIF() - - ADD_EXECUTABLE(bsincgen utils/bsincgen.c) - SET_PROPERTY(TARGET bsincgen APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) + ADD_EXECUTABLE(makehrtf ${MAKEHRTF_SRCS}) + TARGET_COMPILE_DEFINITIONS(makehrtf PRIVATE ${CPP_DEFS}) + TARGET_COMPILE_OPTIONS(makehrtf PRIVATE ${C_FLAGS}) IF(HAVE_LIBM) - TARGET_LINK_LIBRARIES(bsincgen m) + TARGET_LINK_LIBRARIES(makehrtf PRIVATE ${LINKER_FLAGS} m) ENDIF() IF(ALSOFT_INSTALL) - INSTALL(TARGETS openal-info makehrtf bsincgen + INSTALL(TARGETS openal-info makehrtf RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} @@ -1351,12 +1548,12 @@ IF(ALSOFT_UTILS) ENDIF() IF(ALSOFT_TESTS) - ADD_LIBRARY(test-common STATIC examples/common/alhelpers.c) - SET_PROPERTY(TARGET test-common APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) + SET(TEST_COMMON_OBJS examples/common/alhelpers.c) - ADD_EXECUTABLE(altonegen examples/altonegen.c) - TARGET_LINK_LIBRARIES(altonegen test-common ${LIBNAME}) - SET_PROPERTY(TARGET altonegen APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) + ADD_EXECUTABLE(altonegen examples/altonegen.c ${TEST_COMMON_OBJS}) + TARGET_COMPILE_DEFINITIONS(altonegen PRIVATE ${CPP_DEFS}) + TARGET_COMPILE_OPTIONS(altonegen PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(altonegen PRIVATE ${LINKER_FLAGS} common OpenAL ${MATH_LIB}) IF(ALSOFT_INSTALL) INSTALL(TARGETS altonegen @@ -1371,86 +1568,134 @@ IF(ALSOFT_TESTS) ENDIF() IF(ALSOFT_EXAMPLES) - IF(SDL2_FOUND AND SDL_SOUND_FOUND) - ADD_LIBRARY(ex-common STATIC examples/common/alhelpers.c - examples/common/sdl_sound.c) - SET_PROPERTY(TARGET ex-common APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - SET_PROPERTY(TARGET ex-common APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} - ${SDL_SOUND_INCLUDE_DIR}) + ADD_EXECUTABLE(alrecord examples/alrecord.c) + TARGET_COMPILE_DEFINITIONS(alrecord PRIVATE ${CPP_DEFS}) + TARGET_COMPILE_OPTIONS(alrecord PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(alrecord PRIVATE ${LINKER_FLAGS} common OpenAL) - ADD_EXECUTABLE(alstream examples/alstream.c) - TARGET_LINK_LIBRARIES(alstream ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common ${LIBNAME}) - SET_PROPERTY(TARGET alstream APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - SET_PROPERTY(TARGET alstream APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} - ${SDL_SOUND_INCLUDE_DIR}) + IF(ALSOFT_INSTALL) + INSTALL(TARGETS alrecord + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + ENDIF() - ADD_EXECUTABLE(alreverb examples/alreverb.c) - TARGET_LINK_LIBRARIES(alreverb ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common ${LIBNAME}) - SET_PROPERTY(TARGET alreverb APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - SET_PROPERTY(TARGET alreverb APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} - ${SDL_SOUND_INCLUDE_DIR}) + MESSAGE(STATUS "Building example programs") - ADD_EXECUTABLE(allatency examples/allatency.c) - TARGET_LINK_LIBRARIES(allatency ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common ${LIBNAME}) - SET_PROPERTY(TARGET allatency APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - SET_PROPERTY(TARGET allatency APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} - ${SDL_SOUND_INCLUDE_DIR}) + IF(SDL2_FOUND) + IF(SDL_SOUND_FOUND) + # Add a static library with common functions used by multiple targets + ADD_LIBRARY(ex-common STATIC examples/common/alhelpers.c) + TARGET_COMPILE_DEFINITIONS(ex-common PRIVATE ${CPP_DEFS}) + TARGET_COMPILE_OPTIONS(ex-common PRIVATE ${C_FLAGS}) - ADD_EXECUTABLE(alloopback examples/alloopback.c) - TARGET_LINK_LIBRARIES(alloopback ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common ${LIBNAME}) - SET_PROPERTY(TARGET alloopback APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - SET_PROPERTY(TARGET alloopback APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} - ${SDL_SOUND_INCLUDE_DIR}) + ADD_EXECUTABLE(alplay examples/alplay.c) + TARGET_COMPILE_DEFINITIONS(alplay PRIVATE ${CPP_DEFS}) + TARGET_INCLUDE_DIRECTORIES(alplay + PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) + TARGET_COMPILE_OPTIONS(alplay PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(alplay + PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common + OpenAL) - ADD_EXECUTABLE(alhrtf examples/alhrtf.c) - TARGET_LINK_LIBRARIES(alhrtf ex-common ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} - common ${LIBNAME}) - SET_PROPERTY(TARGET alhrtf APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - SET_PROPERTY(TARGET alhrtf APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} - ${SDL_SOUND_INCLUDE_DIR}) + ADD_EXECUTABLE(alstream examples/alstream.c) + TARGET_COMPILE_DEFINITIONS(alstream PRIVATE ${CPP_DEFS}) + TARGET_INCLUDE_DIRECTORIES(alstream + PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) + TARGET_COMPILE_OPTIONS(alstream PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(alstream + PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common + OpenAL) - IF(ALSOFT_INSTALL) - INSTALL(TARGETS alstream alreverb allatency alloopback alhrtf - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) + ADD_EXECUTABLE(alreverb examples/alreverb.c) + TARGET_COMPILE_DEFINITIONS(alreverb PRIVATE ${CPP_DEFS}) + TARGET_INCLUDE_DIRECTORIES(alreverb + PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) + TARGET_COMPILE_OPTIONS(alreverb PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(alreverb + PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common + OpenAL) + + ADD_EXECUTABLE(almultireverb examples/almultireverb.c) + TARGET_COMPILE_DEFINITIONS(almultireverb PRIVATE ${CPP_DEFS}) + TARGET_INCLUDE_DIRECTORIES(almultireverb + PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) + TARGET_COMPILE_OPTIONS(almultireverb PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(almultireverb + PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common + OpenAL ${MATH_LIB}) + + ADD_EXECUTABLE(allatency examples/allatency.c) + TARGET_COMPILE_DEFINITIONS(allatency PRIVATE ${CPP_DEFS}) + TARGET_INCLUDE_DIRECTORIES(allatency + PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) + TARGET_COMPILE_OPTIONS(allatency PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(allatency + PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common + OpenAL) + + ADD_EXECUTABLE(alloopback examples/alloopback.c) + TARGET_COMPILE_DEFINITIONS(alloopback PRIVATE ${CPP_DEFS}) + TARGET_INCLUDE_DIRECTORIES(alloopback + PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) + TARGET_COMPILE_OPTIONS(alloopback PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(alloopback + PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common + OpenAL ${MATH_LIB}) + + ADD_EXECUTABLE(alhrtf examples/alhrtf.c) + TARGET_COMPILE_DEFINITIONS(alhrtf PRIVATE ${CPP_DEFS}) + TARGET_INCLUDE_DIRECTORIES(alhrtf + PRIVATE ${SDL2_INCLUDE_DIR} ${SDL_SOUND_INCLUDE_DIR}) + TARGET_COMPILE_OPTIONS(alhrtf PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(alhrtf + PRIVATE ${LINKER_FLAGS} ${SDL_SOUND_LIBRARIES} ${SDL2_LIBRARY} ex-common common + OpenAL ${MATH_LIB}) + + IF(ALSOFT_INSTALL) + INSTALL(TARGETS alplay alstream alreverb almultireverb allatency alloopback alhrtf + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + ENDIF() + + MESSAGE(STATUS "Building SDL_sound example programs") ENDIF() SET(FFVER_OK FALSE) IF(FFMPEG_FOUND) SET(FFVER_OK TRUE) - IF(AVFORMAT_VERSION VERSION_LESS "55.33.100") - MESSAGE(STATUS "libavformat is too old! (${AVFORMAT_VERSION}, wanted 55.33.100)") + IF(AVFORMAT_VERSION VERSION_LESS "57.56.101") + MESSAGE(STATUS "libavformat is too old! (${AVFORMAT_VERSION}, wanted 57.56.101)") SET(FFVER_OK FALSE) ENDIF() - IF(AVCODEC_VERSION VERSION_LESS "55.52.102") - MESSAGE(STATUS "libavcodec is too old! (${AVCODEC_VERSION}, wanted 55.52.102)") + IF(AVCODEC_VERSION VERSION_LESS "57.64.101") + MESSAGE(STATUS "libavcodec is too old! (${AVCODEC_VERSION}, wanted 57.64.101)") SET(FFVER_OK FALSE) ENDIF() - IF(AVUTIL_VERSION VERSION_LESS "52.66.100") - MESSAGE(STATUS "libavutil is too old! (${AVUTIL_VERSION}, wanted 52.66.100)") + IF(AVUTIL_VERSION VERSION_LESS "55.34.101") + MESSAGE(STATUS "libavutil is too old! (${AVUTIL_VERSION}, wanted 55.34.101)") SET(FFVER_OK FALSE) ENDIF() - IF(SWSCALE_VERSION VERSION_LESS "2.5.102") - MESSAGE(STATUS "libswscale is too old! (${SWSCALE_VERSION}, wanted 2.5.102)") + IF(SWSCALE_VERSION VERSION_LESS "4.2.100") + MESSAGE(STATUS "libswscale is too old! (${SWSCALE_VERSION}, wanted 4.2.100)") SET(FFVER_OK FALSE) ENDIF() - IF(SWRESAMPLE_VERSION VERSION_LESS "0.18.100") - MESSAGE(STATUS "libswresample is too old! (${SWRESAMPLE_VERSION}, wanted 0.18.100)") + IF(SWRESAMPLE_VERSION VERSION_LESS "2.3.100") + MESSAGE(STATUS "libswresample is too old! (${SWRESAMPLE_VERSION}, wanted 2.3.100)") SET(FFVER_OK FALSE) ENDIF() ENDIF() - IF(FFVER_OK AND NOT MSVC) - ADD_EXECUTABLE(alffplay examples/alffplay.c) - TARGET_LINK_LIBRARIES(alffplay common ex-common ${SDL2_LIBRARY} ${LIBNAME} ${FFMPEG_LIBRARIES}) - SET_PROPERTY(TARGET alffplay APPEND PROPERTY COMPILE_FLAGS ${EXTRA_CFLAGS}) - SET_PROPERTY(TARGET alffplay APPEND PROPERTY INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIR} - ${FFMPEG_INCLUDE_DIRS}) + IF(FFVER_OK) + ADD_EXECUTABLE(alffplay examples/alffplay.cpp) + TARGET_COMPILE_DEFINITIONS(alffplay PRIVATE ${CPP_DEFS}) + TARGET_INCLUDE_DIRECTORIES(alffplay + PRIVATE ${SDL2_INCLUDE_DIR} ${FFMPEG_INCLUDE_DIRS}) + TARGET_COMPILE_OPTIONS(alffplay PRIVATE ${C_FLAGS}) + TARGET_LINK_LIBRARIES(alffplay + PRIVATE ${LINKER_FLAGS} ${SDL2_LIBRARY} ${FFMPEG_LIBRARIES} common OpenAL) IF(ALSOFT_INSTALL) INSTALL(TARGETS alffplay @@ -1459,9 +1704,7 @@ IF(ALSOFT_EXAMPLES) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) ENDIF() - MESSAGE(STATUS "Building SDL and FFmpeg example programs") - ELSE() - MESSAGE(STATUS "Building SDL example programs") + MESSAGE(STATUS "Building SDL+FFmpeg example programs") ENDIF() MESSAGE(STATUS "") ENDIF() diff --git a/Engine/lib/openal-soft/ChangeLog b/Engine/lib/openal-soft/ChangeLog index 189872cf7..a7aec6388 100644 --- a/Engine/lib/openal-soft/ChangeLog +++ b/Engine/lib/openal-soft/ChangeLog @@ -1,3 +1,168 @@ +openal-soft-1.19.0: + + Implemented the ALC_SOFT_device_clock extension. + + Implemented the Pitch Shifter effect. + + Fixed compiling on FreeBSD systems that use freebsd-lib 9.1. + + Fixed compiling on NetBSD. + + Fixed the reverb effect's density scale and panning parameters. + + Fixed use of the WASAPI backend with certain games, which caused odd COM + initialization errors. + + Increased the number of virtual channels for decoding Ambisonics to HRTF + output. + + Replaced the 4-point Sinc resampler with a more efficient cubic resampler. + + Renamed the MMDevAPI backend to WASAPI. + + Added support fot 24-bit, dual-ear HRTF data sets. The built-in data set + has been updated to 24-bit. + + Added a 24- to 48-point band-limited Sinc resampler. + + Added an SDL2 playback backend. Disabled by default to avoid a dependency + on SDL2. + + Improved the performance and quality of the Chorus and Flanger effects. + + Improved the efficiency of the band-limited Sinc resampler. + + Improved the Sinc resampler's transition band to avoid over-attenuating + higher frequencies. + + Improved the performance of some filter operations. + + Improved the efficiency of object ID lookups. + + Improved the efficienty of internal voice/source synchronization. + + Improved AL call error logging with contextualized messages. + + Removed the reverb effect's modulation stage. Due to the lack of reference + for its intended behavior and strength. + +openal-soft-1.18.2: + + Fixed resetting the FPU rounding mode after certain function calls on + Windows. + + Fixed use of SSE intrinsics when building with Clang on Windows. + + Fixed a crash with the JACK backend when using JACK1. + + Fixed use of pthread_setnane_np on NetBSD. + + Fixed building on FreeBSD with an older freebsd-lib. + + OSS now links with libossaudio if found at build time (for NetBSD). + +openal-soft-1.18.1: + + Fixed an issue where resuming a source might not restart playing it. + + Fixed PulseAudio playback when the configured stream length is much less + than the requested length. + + Fixed MMDevAPI capture with sample rates not matching the backing device. + + Fixed int32 output for the Wave Writer. + + Fixed enumeration of OSS devices that are missing device files. + + Added correct retrieval of the executable's path on FreeBSD. + + Added a config option to specify the dithering depth. + + Added a 5.1 decoder preset that excludes front-center output. + +openal-soft-1.18.0: + + Implemented the AL_EXT_STEREO_ANGLES and AL_EXT_SOURCE_RADIUS extensions. + + Implemented the AL_SOFT_gain_clamp_ex, AL_SOFT_source_resampler, + AL_SOFT_source_spatialize, and ALC_SOFT_output_limiter extensions. + + Implemented 3D processing for some effects. Currently implemented for + Reverb, Compressor, Equalizer, and Ring Modulator. + + Implemented 2-channel UHJ output encoding. This needs to be enabled with a + config option to be used. + + Implemented dual-band processing for high-quality ambisonic decoding. + + Implemented distance-compensation for surround sound output. + + Implemented near-field emulation and compensation with ambisonic rendering. + Currently only applies when using the high-quality ambisonic decoder or + ambisonic output, with appropriate config options. + + Implemented an output limiter to reduce the amount of distortion from + clipping. + + Implemented dithering for 8-bit and 16-bit output. + + Implemented a config option to select a preferred HRTF. + + Implemented a run-time check for NEON extensions using /proc/cpuinfo. + + Implemented experimental capture support for the OpenSL backend. + + Fixed building on compilers with NEON support but don't default to having + NEON enabled. + + Fixed support for JACK on Windows. + + Fixed starting a source while alcSuspendContext is in effect. + + Fixed detection of headsets as headphones, with MMDevAPI. + + Added support for AmbDec config files, for custom ambisonic decoder + configurations. Version 3 files only. + + Added backend-specific options to alsoft-config. + + Added first-, second-, and third-order ambisonic output formats. Currently + only works with backends that don't rely on channel labels, like JACK, + ALSA, and OSS. + + Added a build option to embed the default HRTFs into the lib. + + Added AmbDec presets to enable high-quality ambisonic decoding. + + Added an AmbDec preset for 3D7.1 speaker setups. + + Added documentation regarding Ambisonics, 3D7.1, AmbDec config files, and + the provided ambdec presets. + + Added the ability for MMDevAPI to open devices given a Device ID or GUID + string. + + Added an option to the example apps to open a specific device. + + Increased the maximum auxiliary send limit to 16 (up from 4). Requires + requesting them with the ALC_MAX_AUXILIARY_SENDS context creation + attribute. + + Increased the default auxiliary effect slot count to 64 (up from 4). + + Reduced the default period count to 3 (down from 4). + + Slightly improved automatic naming for enumerated HRTFs. + + Improved B-Format decoding with HRTF output. + + Improved internal property handling for better batching behavior. + + Improved performance of certain filter uses. + + Removed support for the AL_SOFT_buffer_samples and AL_SOFT_buffer_sub_data + extensions. Due to conflicts with AL_EXT_SOURCE_RADIUS. + openal-soft-1.17.2: Implemented device enumeration for OSSv4. diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alAuxEffectSlot.h b/Engine/lib/openal-soft/OpenAL32/Include/alAuxEffectSlot.h index 70fcac5c3..bb9aef590 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/alAuxEffectSlot.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/alAuxEffectSlot.h @@ -4,6 +4,7 @@ #include "alMain.h" #include "alEffect.h" +#include "atomic.h" #include "align.h" #ifdef __cplusplus @@ -18,7 +19,7 @@ typedef struct ALeffectState { const struct ALeffectStateVtable *vtbl; ALfloat (*OutBuffer)[BUFFERSIZE]; - ALuint OutChannels; + ALsizei OutChannels; } ALeffectState; void ALeffectState_Construct(ALeffectState *state); @@ -28,17 +29,22 @@ struct ALeffectStateVtable { void (*const Destruct)(ALeffectState *state); ALboolean (*const deviceUpdate)(ALeffectState *state, ALCdevice *device); - void (*const update)(ALeffectState *state, const ALCdevice *device, const struct ALeffectslot *slot, const union ALeffectProps *props); - void (*const process)(ALeffectState *state, ALuint samplesToDo, const ALfloat (*restrict samplesIn)[BUFFERSIZE], ALfloat (*restrict samplesOut)[BUFFERSIZE], ALuint numChannels); + void (*const update)(ALeffectState *state, const ALCcontext *context, const struct ALeffectslot *slot, const union ALeffectProps *props); + void (*const process)(ALeffectState *state, ALsizei samplesToDo, const ALfloat (*restrict samplesIn)[BUFFERSIZE], ALfloat (*restrict samplesOut)[BUFFERSIZE], ALsizei numChannels); void (*const Delete)(void *ptr); }; +/* Small hack to use a pointer-to-array types as a normal argument type. + * Shouldn't be used directly. + */ +typedef ALfloat ALfloatBUFFERSIZE[BUFFERSIZE]; + #define DEFINE_ALEFFECTSTATE_VTABLE(T) \ DECLARE_THUNK(T, ALeffectState, void, Destruct) \ DECLARE_THUNK1(T, ALeffectState, ALboolean, deviceUpdate, ALCdevice*) \ -DECLARE_THUNK3(T, ALeffectState, void, update, const ALCdevice*, const ALeffectslot*, const ALeffectProps*) \ -DECLARE_THUNK4(T, ALeffectState, void, process, ALuint, const ALfloatBUFFERSIZE*restrict, ALfloatBUFFERSIZE*restrict, ALuint) \ +DECLARE_THUNK3(T, ALeffectState, void, update, const ALCcontext*, const ALeffectslot*, const ALeffectProps*) \ +DECLARE_THUNK4(T, ALeffectState, void, process, ALsizei, const ALfloatBUFFERSIZE*restrict, ALfloatBUFFERSIZE*restrict, ALsizei) \ static void T##_ALeffectState_Delete(void *ptr) \ { return T##_Delete(STATIC_UPCAST(T, ALeffectState, (ALeffectState*)ptr)); } \ \ @@ -53,43 +59,48 @@ static const struct ALeffectStateVtable T##_ALeffectState_vtable = { \ } -struct ALeffectStateFactoryVtable; +struct EffectStateFactoryVtable; -typedef struct ALeffectStateFactory { - const struct ALeffectStateFactoryVtable *vtbl; -} ALeffectStateFactory; +typedef struct EffectStateFactory { + const struct EffectStateFactoryVtable *vtab; +} EffectStateFactory; -struct ALeffectStateFactoryVtable { - ALeffectState *(*const create)(ALeffectStateFactory *factory); +struct EffectStateFactoryVtable { + ALeffectState *(*const create)(EffectStateFactory *factory); }; +#define EffectStateFactory_create(x) ((x)->vtab->create((x))) -#define DEFINE_ALEFFECTSTATEFACTORY_VTABLE(T) \ -DECLARE_THUNK(T, ALeffectStateFactory, ALeffectState*, create) \ +#define DEFINE_EFFECTSTATEFACTORY_VTABLE(T) \ +DECLARE_THUNK(T, EffectStateFactory, ALeffectState*, create) \ \ -static const struct ALeffectStateFactoryVtable T##_ALeffectStateFactory_vtable = { \ - T##_ALeffectStateFactory_create, \ +static const struct EffectStateFactoryVtable T##_EffectStateFactory_vtable = { \ + T##_EffectStateFactory_create, \ } #define MAX_EFFECT_CHANNELS (4) -struct ALeffectslotProps { - ATOMIC(ALfloat) Gain; - ATOMIC(ALboolean) AuxSendAuto; +struct ALeffectslotArray { + ALsizei count; + struct ALeffectslot *slot[]; +}; - ATOMIC(ALenum) Type; + +struct ALeffectslotProps { + ALfloat Gain; + ALboolean AuxSendAuto; + + ALenum Type; ALeffectProps Props; - ATOMIC(ALeffectState*) State; + ALeffectState *State; ATOMIC(struct ALeffectslotProps*) next; }; typedef struct ALeffectslot { - ALboolean NeedsUpdate; - ALfloat Gain; ALboolean AuxSendAuto; @@ -100,81 +111,70 @@ typedef struct ALeffectslot { ALeffectState *State; } Effect; + ATOMIC_FLAG PropsClean; + RefCount ref; ATOMIC(struct ALeffectslotProps*) Update; - ATOMIC(struct ALeffectslotProps*) FreeList; struct { ALfloat Gain; ALboolean AuxSendAuto; ALenum EffectType; + ALeffectProps EffectProps; ALeffectState *EffectState; ALfloat RoomRolloff; /* Added to the source's room rolloff, not multiplied. */ ALfloat DecayTime; + ALfloat DecayLFRatio; + ALfloat DecayHFRatio; + ALboolean DecayHFLimit; ALfloat AirAbsorptionGainHF; } Params; /* Self ID */ ALuint id; - ALuint NumChannels; + ALsizei NumChannels; BFChannelConfig ChanMap[MAX_EFFECT_CHANNELS]; /* Wet buffer configuration is ACN channel order with N3D scaling: * * Channel 0 is the unattenuated mono signal. - * * Channel 1 is OpenAL -X - * * Channel 2 is OpenAL Y - * * Channel 3 is OpenAL -Z + * * Channel 1 is OpenAL -X * sqrt(3) + * * Channel 2 is OpenAL Y * sqrt(3) + * * Channel 3 is OpenAL -Z * sqrt(3) * Consequently, effects that only want to work with mono input can use * channel 0 by itself. Effects that want multichannel can process the * ambisonics signal and make a B-Format pan (ComputeFirstOrderGains) for * first-order device output (FOAOut). */ alignas(16) ALfloat WetBuffer[MAX_EFFECT_CHANNELS][BUFFERSIZE]; - - ATOMIC(struct ALeffectslot*) next; } ALeffectslot; -inline void LockEffectSlotsRead(ALCcontext *context) -{ LockUIntMapRead(&context->EffectSlotMap); } -inline void UnlockEffectSlotsRead(ALCcontext *context) -{ UnlockUIntMapRead(&context->EffectSlotMap); } -inline void LockEffectSlotsWrite(ALCcontext *context) -{ LockUIntMapWrite(&context->EffectSlotMap); } -inline void UnlockEffectSlotsWrite(ALCcontext *context) -{ UnlockUIntMapWrite(&context->EffectSlotMap); } - -inline struct ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id) -{ return (struct ALeffectslot*)LookupUIntMapKeyNoLock(&context->EffectSlotMap, id); } -inline struct ALeffectslot *RemoveEffectSlot(ALCcontext *context, ALuint id) -{ return (struct ALeffectslot*)RemoveUIntMapKeyNoLock(&context->EffectSlotMap, id); } - ALenum InitEffectSlot(ALeffectslot *slot); void DeinitEffectSlot(ALeffectslot *slot); -void UpdateEffectSlotProps(ALeffectslot *slot); +void UpdateEffectSlotProps(ALeffectslot *slot, ALCcontext *context); void UpdateAllEffectSlotProps(ALCcontext *context); ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context); -ALeffectStateFactory *ALnullStateFactory_getFactory(void); -ALeffectStateFactory *ALreverbStateFactory_getFactory(void); -ALeffectStateFactory *ALchorusStateFactory_getFactory(void); -ALeffectStateFactory *ALcompressorStateFactory_getFactory(void); -ALeffectStateFactory *ALdistortionStateFactory_getFactory(void); -ALeffectStateFactory *ALechoStateFactory_getFactory(void); -ALeffectStateFactory *ALequalizerStateFactory_getFactory(void); -ALeffectStateFactory *ALflangerStateFactory_getFactory(void); -ALeffectStateFactory *ALmodulatorStateFactory_getFactory(void); +EffectStateFactory *NullStateFactory_getFactory(void); +EffectStateFactory *ReverbStateFactory_getFactory(void); +EffectStateFactory *ChorusStateFactory_getFactory(void); +EffectStateFactory *CompressorStateFactory_getFactory(void); +EffectStateFactory *DistortionStateFactory_getFactory(void); +EffectStateFactory *EchoStateFactory_getFactory(void); +EffectStateFactory *EqualizerStateFactory_getFactory(void); +EffectStateFactory *FlangerStateFactory_getFactory(void); +EffectStateFactory *ModulatorStateFactory_getFactory(void); +EffectStateFactory *PshifterStateFactory_getFactory(void); -ALeffectStateFactory *ALdedicatedStateFactory_getFactory(void); +EffectStateFactory *DedicatedStateFactory_getFactory(void); -ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *effect); +ALenum InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect *effect); -void InitEffectFactoryMap(void); -void DeinitEffectFactoryMap(void); +void ALeffectState_DecRef(ALeffectState *state); #ifdef __cplusplus } diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alBuffer.h b/Engine/lib/openal-soft/OpenAL32/Include/alBuffer.h index e99af050a..fbe3e6e5e 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/alBuffer.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/alBuffer.h @@ -1,7 +1,13 @@ #ifndef _AL_BUFFER_H_ #define _AL_BUFFER_H_ -#include "alMain.h" +#include "AL/alc.h" +#include "AL/al.h" +#include "AL/alext.h" + +#include "inprogext.h" +#include "atomic.h" +#include "rwlock.h" #ifdef __cplusplus extern "C" { @@ -9,36 +15,30 @@ extern "C" { /* User formats */ enum UserFmtType { - UserFmtByte = AL_BYTE_SOFT, - UserFmtUByte = AL_UNSIGNED_BYTE_SOFT, - UserFmtShort = AL_SHORT_SOFT, - UserFmtUShort = AL_UNSIGNED_SHORT_SOFT, - UserFmtInt = AL_INT_SOFT, - UserFmtUInt = AL_UNSIGNED_INT_SOFT, - UserFmtFloat = AL_FLOAT_SOFT, - UserFmtDouble = AL_DOUBLE_SOFT, - UserFmtByte3 = AL_BYTE3_SOFT, - UserFmtUByte3 = AL_UNSIGNED_BYTE3_SOFT, - UserFmtMulaw = AL_MULAW_SOFT, - UserFmtAlaw = 0x10000000, + UserFmtUByte, + UserFmtShort, + UserFmtFloat, + UserFmtDouble, + UserFmtMulaw, + UserFmtAlaw, UserFmtIMA4, UserFmtMSADPCM, }; enum UserFmtChannels { - UserFmtMono = AL_MONO_SOFT, - UserFmtStereo = AL_STEREO_SOFT, - UserFmtRear = AL_REAR_SOFT, - UserFmtQuad = AL_QUAD_SOFT, - UserFmtX51 = AL_5POINT1_SOFT, /* (WFX order) */ - UserFmtX61 = AL_6POINT1_SOFT, /* (WFX order) */ - UserFmtX71 = AL_7POINT1_SOFT, /* (WFX order) */ - UserFmtBFormat2D = AL_BFORMAT2D_SOFT, /* WXY */ - UserFmtBFormat3D = AL_BFORMAT3D_SOFT, /* WXYZ */ + UserFmtMono, + UserFmtStereo, + UserFmtRear, + UserFmtQuad, + UserFmtX51, /* (WFX order) */ + UserFmtX61, /* (WFX order) */ + UserFmtX71, /* (WFX order) */ + UserFmtBFormat2D, /* WXY */ + UserFmtBFormat3D, /* WXYZ */ }; -ALuint BytesFromUserFmt(enum UserFmtType type); -ALuint ChannelsFromUserFmt(enum UserFmtChannels chans); -inline ALuint FrameSizeFromUserFmt(enum UserFmtChannels chans, enum UserFmtType type) +ALsizei BytesFromUserFmt(enum UserFmtType type); +ALsizei ChannelsFromUserFmt(enum UserFmtChannels chans); +inline ALsizei FrameSizeFromUserFmt(enum UserFmtChannels chans, enum UserFmtType type) { return ChannelsFromUserFmt(chans) * BytesFromUserFmt(type); } @@ -46,9 +46,12 @@ inline ALuint FrameSizeFromUserFmt(enum UserFmtChannels chans, enum UserFmtType /* Storable formats */ enum FmtType { - FmtByte = UserFmtByte, - FmtShort = UserFmtShort, - FmtFloat = UserFmtFloat, + FmtUByte = UserFmtUByte, + FmtShort = UserFmtShort, + FmtFloat = UserFmtFloat, + FmtDouble = UserFmtDouble, + FmtMulaw = UserFmtMulaw, + FmtAlaw = UserFmtAlaw, }; enum FmtChannels { FmtMono = UserFmtMono, @@ -63,9 +66,9 @@ enum FmtChannels { }; #define MAX_INPUT_CHANNELS (8) -ALuint BytesFromFmt(enum FmtType type); -ALuint ChannelsFromFmt(enum FmtChannels chans); -inline ALuint FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type) +ALsizei BytesFromFmt(enum FmtType type); +ALsizei ChannelsFromFmt(enum FmtChannels chans); +inline ALsizei FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type) { return ChannelsFromFmt(chans) * BytesFromFmt(type); } @@ -74,53 +77,35 @@ inline ALuint FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type) typedef struct ALbuffer { ALvoid *data; - ALsizei Frequency; - ALenum Format; - ALsizei SampleLen; + ALsizei Frequency; + ALbitfieldSOFT Access; + ALsizei SampleLen; enum FmtChannels FmtChannels; enum FmtType FmtType; - ALuint BytesAlloc; + ALsizei BytesAlloc; - enum UserFmtChannels OriginalChannels; - enum UserFmtType OriginalType; - ALsizei OriginalSize; - ALsizei OriginalAlign; + enum UserFmtType OriginalType; + ALsizei OriginalSize; + ALsizei OriginalAlign; - ALsizei LoopStart; - ALsizei LoopEnd; + ALsizei LoopStart; + ALsizei LoopEnd; ATOMIC(ALsizei) UnpackAlign; ATOMIC(ALsizei) PackAlign; + ALbitfieldSOFT MappedAccess; + ALsizei MappedOffset; + ALsizei MappedSize; + /* Number of times buffer was attached to a source (deletion can only occur when 0) */ RefCount ref; - RWLock lock; - /* Self ID */ ALuint id; } ALbuffer; -ALbuffer *NewBuffer(ALCcontext *context); -void DeleteBuffer(ALCdevice *device, ALbuffer *buffer); - -ALenum LoadData(ALbuffer *buffer, ALuint freq, ALenum NewFormat, ALsizei frames, enum UserFmtChannels SrcChannels, enum UserFmtType SrcType, const ALvoid *data, ALsizei align, ALboolean storesrc); - -inline void LockBuffersRead(ALCdevice *device) -{ LockUIntMapRead(&device->BufferMap); } -inline void UnlockBuffersRead(ALCdevice *device) -{ UnlockUIntMapRead(&device->BufferMap); } -inline void LockBuffersWrite(ALCdevice *device) -{ LockUIntMapWrite(&device->BufferMap); } -inline void UnlockBuffersWrite(ALCdevice *device) -{ UnlockUIntMapWrite(&device->BufferMap); } - -inline struct ALbuffer *LookupBuffer(ALCdevice *device, ALuint id) -{ return (struct ALbuffer*)LookupUIntMapKeyNoLock(&device->BufferMap, id); } -inline struct ALbuffer *RemoveBuffer(ALCdevice *device, ALuint id) -{ return (struct ALbuffer*)RemoveUIntMapKeyNoLock(&device->BufferMap, id); } - ALvoid ReleaseALBuffers(ALCdevice *device); #ifdef __cplusplus diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alEffect.h b/Engine/lib/openal-soft/OpenAL32/Include/alEffect.h index b97b01479..50b64ee1d 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/alEffect.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/alEffect.h @@ -10,23 +10,32 @@ extern "C" { struct ALeffect; enum { - EAXREVERB = 0, - REVERB, - CHORUS, - COMPRESSOR, - DISTORTION, - ECHO, - EQUALIZER, - FLANGER, - MODULATOR, - DEDICATED, + EAXREVERB_EFFECT = 0, + REVERB_EFFECT, + CHORUS_EFFECT, + COMPRESSOR_EFFECT, + DISTORTION_EFFECT, + ECHO_EFFECT, + EQUALIZER_EFFECT, + FLANGER_EFFECT, + MODULATOR_EFFECT, + PSHIFTER_EFFECT, + DEDICATED_EFFECT, MAX_EFFECTS }; extern ALboolean DisabledEffects[MAX_EFFECTS]; extern ALfloat ReverbBoost; -extern ALboolean EmulateEAXReverb; + +struct EffectList { + const char name[16]; + int type; + ALenum val; +}; +#define EFFECTLIST_SIZE 12 +extern const struct EffectList EffectList[EFFECTLIST_SIZE]; + struct ALeffectVtable { void (*const setParami)(struct ALeffect *effect, ALCcontext *context, ALenum param, ALint val); @@ -58,6 +67,7 @@ extern const struct ALeffectVtable ALequalizer_vtable; extern const struct ALeffectVtable ALflanger_vtable; extern const struct ALeffectVtable ALmodulator_vtable; extern const struct ALeffectVtable ALnull_vtable; +extern const struct ALeffectVtable ALpshifter_vtable; extern const struct ALeffectVtable ALdedicated_vtable; @@ -98,7 +108,7 @@ typedef union ALeffectProps { ALfloat Depth; ALfloat Feedback; ALfloat Delay; - } Chorus; + } Chorus; /* Also Flanger */ struct { ALboolean OnOff; @@ -135,21 +145,17 @@ typedef union ALeffectProps { ALfloat HighGain; } Equalizer; - struct { - ALint Waveform; - ALint Phase; - ALfloat Rate; - ALfloat Depth; - ALfloat Feedback; - ALfloat Delay; - } Flanger; - struct { ALfloat Frequency; ALfloat HighPassCutoff; ALint Waveform; } Modulator; + struct { + ALint CoarseTune; + ALint FineTune; + } Pshifter; + struct { ALfloat Gain; } Dedicated; @@ -161,33 +167,27 @@ typedef struct ALeffect { ALeffectProps Props; - const struct ALeffectVtable *vtbl; + const struct ALeffectVtable *vtab; /* Self ID */ ALuint id; } ALeffect; - -inline void LockEffectsRead(ALCdevice *device) -{ LockUIntMapRead(&device->EffectMap); } -inline void UnlockEffectsRead(ALCdevice *device) -{ UnlockUIntMapRead(&device->EffectMap); } -inline void LockEffectsWrite(ALCdevice *device) -{ LockUIntMapWrite(&device->EffectMap); } -inline void UnlockEffectsWrite(ALCdevice *device) -{ UnlockUIntMapWrite(&device->EffectMap); } - -inline struct ALeffect *LookupEffect(ALCdevice *device, ALuint id) -{ return (struct ALeffect*)LookupUIntMapKeyNoLock(&device->EffectMap, id); } -inline struct ALeffect *RemoveEffect(ALCdevice *device, ALuint id) -{ return (struct ALeffect*)RemoveUIntMapKeyNoLock(&device->EffectMap, id); } +#define ALeffect_setParami(o, c, p, v) ((o)->vtab->setParami(o, c, p, v)) +#define ALeffect_setParamf(o, c, p, v) ((o)->vtab->setParamf(o, c, p, v)) +#define ALeffect_setParamiv(o, c, p, v) ((o)->vtab->setParamiv(o, c, p, v)) +#define ALeffect_setParamfv(o, c, p, v) ((o)->vtab->setParamfv(o, c, p, v)) +#define ALeffect_getParami(o, c, p, v) ((o)->vtab->getParami(o, c, p, v)) +#define ALeffect_getParamf(o, c, p, v) ((o)->vtab->getParamf(o, c, p, v)) +#define ALeffect_getParamiv(o, c, p, v) ((o)->vtab->getParamiv(o, c, p, v)) +#define ALeffect_getParamfv(o, c, p, v) ((o)->vtab->getParamfv(o, c, p, v)) inline ALboolean IsReverbEffect(ALenum type) { return type == AL_EFFECT_REVERB || type == AL_EFFECT_EAXREVERB; } -ALenum InitEffect(ALeffect *effect); -ALvoid ReleaseALEffects(ALCdevice *device); +void InitEffect(ALeffect *effect); +void ReleaseALEffects(ALCdevice *device); -ALvoid LoadReverbPreset(const char *name, ALeffect *effect); +void LoadReverbPreset(const char *name, ALeffect *effect); #ifdef __cplusplus } diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alError.h b/Engine/lib/openal-soft/OpenAL32/Include/alError.h index ab91d27b2..858f81de5 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/alError.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/alError.h @@ -2,6 +2,7 @@ #define _AL_ERROR_H_ #include "alMain.h" +#include "logging.h" #ifdef __cplusplus extern "C" { @@ -9,23 +10,18 @@ extern "C" { extern ALboolean TrapALError; -ALvoid alSetError(ALCcontext *Context, ALenum errorCode); +void alSetError(ALCcontext *context, ALenum errorCode, const char *msg, ...) DECL_FORMAT(printf, 3, 4); -#define SET_ERROR_AND_RETURN(ctx, err) do { \ - alSetError((ctx), (err)); \ - return; \ -} while(0) - -#define SET_ERROR_AND_RETURN_VALUE(ctx, err, val) do { \ - alSetError((ctx), (err)); \ - return (val); \ -} while(0) - -#define SET_ERROR_AND_GOTO(ctx, err, lbl) do { \ - alSetError((ctx), (err)); \ +#define SETERR_GOTO(ctx, err, lbl, ...) do { \ + alSetError((ctx), (err), __VA_ARGS__); \ goto lbl; \ } while(0) +#define SETERR_RETURN(ctx, err, retval, ...) do { \ + alSetError((ctx), (err), __VA_ARGS__); \ + return retval; \ +} while(0) + #ifdef __cplusplus } #endif diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alFilter.h b/Engine/lib/openal-soft/OpenAL32/Include/alFilter.h index 1f7095bc6..2634d5e80 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/alFilter.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/alFilter.h @@ -1,9 +1,8 @@ #ifndef _AL_FILTER_H_ #define _AL_FILTER_H_ -#include "alMain.h" - -#include "math_defs.h" +#include "AL/alc.h" +#include "AL/al.h" #ifdef __cplusplus extern "C" { @@ -13,90 +12,27 @@ extern "C" { #define HIGHPASSFREQREF (250.0f) -/* Filters implementation is based on the "Cookbook formulae for audio - * EQ biquad filter coefficients" by Robert Bristow-Johnson - * http://www.musicdsp.org/files/Audio-EQ-Cookbook.txt - */ -/* Implementation note: For the shelf filters, the specified gain is for the - * reference frequency, which is the centerpoint of the transition band. This - * better matches EFX filter design. To set the gain for the shelf itself, use - * the square root of the desired linear gain (or halve the dB gain). - */ +struct ALfilter; -typedef enum ALfilterType { - /** EFX-style low-pass filter, specifying a gain and reference frequency. */ - ALfilterType_HighShelf, - /** EFX-style high-pass filter, specifying a gain and reference frequency. */ - ALfilterType_LowShelf, - /** Peaking filter, specifying a gain and reference frequency. */ - ALfilterType_Peaking, +typedef struct ALfilterVtable { + void (*const setParami)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint val); + void (*const setParamiv)(struct ALfilter *filter, ALCcontext *context, ALenum param, const ALint *vals); + void (*const setParamf)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val); + void (*const setParamfv)(struct ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals); - /** Low-pass cut-off filter, specifying a cut-off frequency. */ - ALfilterType_LowPass, - /** High-pass cut-off filter, specifying a cut-off frequency. */ - ALfilterType_HighPass, - /** Band-pass filter, specifying a center frequency. */ - ALfilterType_BandPass, -} ALfilterType; + void (*const getParami)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint *val); + void (*const getParamiv)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint *vals); + void (*const getParamf)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val); + void (*const getParamfv)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals); +} ALfilterVtable; -typedef struct ALfilterState { - ALfloat x[2]; /* History of two last input samples */ - ALfloat y[2]; /* History of two last output samples */ - ALfloat a1, a2; /* Transfer function coefficients "a" (a0 is pre-applied) */ - ALfloat b0, b1, b2; /* Transfer function coefficients "b" */ -} ALfilterState; -/* Currently only a C-based filter process method is implemented. */ -#define ALfilterState_process ALfilterState_processC - -/* Calculates the rcpQ (i.e. 1/Q) coefficient for shelving filters, using the - * reference gain and shelf slope parameter. - * 0 < gain - * 0 < slope <= 1 - */ -inline ALfloat calc_rcpQ_from_slope(ALfloat gain, ALfloat slope) -{ - return sqrtf((gain + 1.0f/gain)*(1.0f/slope - 1.0f) + 2.0f); +#define DEFINE_ALFILTER_VTABLE(T) \ +const struct ALfilterVtable T##_vtable = { \ + T##_setParami, T##_setParamiv, \ + T##_setParamf, T##_setParamfv, \ + T##_getParami, T##_getParamiv, \ + T##_getParamf, T##_getParamfv, \ } -/* Calculates the rcpQ (i.e. 1/Q) coefficient for filters, using the frequency - * multiple (i.e. ref_freq / sampling_freq) and bandwidth. - * 0 < freq_mult < 0.5. - */ -inline ALfloat calc_rcpQ_from_bandwidth(ALfloat freq_mult, ALfloat bandwidth) -{ - ALfloat w0 = F_TAU * freq_mult; - return 2.0f*sinhf(logf(2.0f)/2.0f*bandwidth*w0/sinf(w0)); -} - -inline void ALfilterState_clear(ALfilterState *filter) -{ - filter->x[0] = 0.0f; - filter->x[1] = 0.0f; - filter->y[0] = 0.0f; - filter->y[1] = 0.0f; -} - -void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat gain, ALfloat freq_mult, ALfloat rcpQ); - -void ALfilterState_processC(ALfilterState *filter, ALfloat *restrict dst, const ALfloat *restrict src, ALuint numsamples); - -inline void ALfilterState_processPassthru(ALfilterState *filter, const ALfloat *restrict src, ALuint numsamples) -{ - if(numsamples >= 2) - { - filter->x[1] = src[numsamples-2]; - filter->x[0] = src[numsamples-1]; - filter->y[1] = src[numsamples-2]; - filter->y[0] = src[numsamples-1]; - } - else if(numsamples == 1) - { - filter->x[1] = filter->x[0]; - filter->x[0] = src[0]; - filter->y[1] = filter->y[0]; - filter->y[0] = src[0]; - } -} - typedef struct ALfilter { // Filter type (AL_FILTER_NULL, ...) @@ -108,45 +44,21 @@ typedef struct ALfilter { ALfloat GainLF; ALfloat LFReference; - void (*SetParami)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint val); - void (*SetParamiv)(struct ALfilter *filter, ALCcontext *context, ALenum param, const ALint *vals); - void (*SetParamf)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val); - void (*SetParamfv)(struct ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals); - - void (*GetParami)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint *val); - void (*GetParamiv)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALint *vals); - void (*GetParamf)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val); - void (*GetParamfv)(struct ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals); + const struct ALfilterVtable *vtab; /* Self ID */ ALuint id; } ALfilter; +#define ALfilter_setParami(o, c, p, v) ((o)->vtab->setParami(o, c, p, v)) +#define ALfilter_setParamf(o, c, p, v) ((o)->vtab->setParamf(o, c, p, v)) +#define ALfilter_setParamiv(o, c, p, v) ((o)->vtab->setParamiv(o, c, p, v)) +#define ALfilter_setParamfv(o, c, p, v) ((o)->vtab->setParamfv(o, c, p, v)) +#define ALfilter_getParami(o, c, p, v) ((o)->vtab->getParami(o, c, p, v)) +#define ALfilter_getParamf(o, c, p, v) ((o)->vtab->getParamf(o, c, p, v)) +#define ALfilter_getParamiv(o, c, p, v) ((o)->vtab->getParamiv(o, c, p, v)) +#define ALfilter_getParamfv(o, c, p, v) ((o)->vtab->getParamfv(o, c, p, v)) -#define ALfilter_SetParami(x, c, p, v) ((x)->SetParami((x),(c),(p),(v))) -#define ALfilter_SetParamiv(x, c, p, v) ((x)->SetParamiv((x),(c),(p),(v))) -#define ALfilter_SetParamf(x, c, p, v) ((x)->SetParamf((x),(c),(p),(v))) -#define ALfilter_SetParamfv(x, c, p, v) ((x)->SetParamfv((x),(c),(p),(v))) - -#define ALfilter_GetParami(x, c, p, v) ((x)->GetParami((x),(c),(p),(v))) -#define ALfilter_GetParamiv(x, c, p, v) ((x)->GetParamiv((x),(c),(p),(v))) -#define ALfilter_GetParamf(x, c, p, v) ((x)->GetParamf((x),(c),(p),(v))) -#define ALfilter_GetParamfv(x, c, p, v) ((x)->GetParamfv((x),(c),(p),(v))) - -inline void LockFiltersRead(ALCdevice *device) -{ LockUIntMapRead(&device->FilterMap); } -inline void UnlockFiltersRead(ALCdevice *device) -{ UnlockUIntMapRead(&device->FilterMap); } -inline void LockFiltersWrite(ALCdevice *device) -{ LockUIntMapWrite(&device->FilterMap); } -inline void UnlockFiltersWrite(ALCdevice *device) -{ UnlockUIntMapWrite(&device->FilterMap); } - -inline struct ALfilter *LookupFilter(ALCdevice *device, ALuint id) -{ return (struct ALfilter*)LookupUIntMapKeyNoLock(&device->FilterMap, id); } -inline struct ALfilter *RemoveFilter(ALCdevice *device, ALuint id) -{ return (struct ALfilter*)RemoveUIntMapKeyNoLock(&device->FilterMap, id); } - -ALvoid ReleaseALFilters(ALCdevice *device); +void ReleaseALFilters(ALCdevice *device); #ifdef __cplusplus } diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alListener.h b/Engine/lib/openal-soft/OpenAL32/Include/alListener.h index b89a00e7a..0d80a8d72 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/alListener.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/alListener.h @@ -8,40 +8,40 @@ extern "C" { #endif -struct ALlistenerProps { - ATOMIC(ALfloat) Position[3]; - ATOMIC(ALfloat) Velocity[3]; - ATOMIC(ALfloat) Forward[3]; - ATOMIC(ALfloat) Up[3]; - ATOMIC(ALfloat) Gain; - ATOMIC(ALfloat) MetersPerUnit; +struct ALcontextProps { + ALfloat DopplerFactor; + ALfloat DopplerVelocity; + ALfloat SpeedOfSound; + ALboolean SourceDistanceModel; + enum DistanceModel DistanceModel; + ALfloat MetersPerUnit; - ATOMIC(ALfloat) DopplerFactor; - ATOMIC(ALfloat) DopplerVelocity; - ATOMIC(ALfloat) SpeedOfSound; - ATOMIC(ALboolean) SourceDistanceModel; - ATOMIC(enum DistanceModel) DistanceModel; + ATOMIC(struct ALcontextProps*) next; +}; + +struct ALlistenerProps { + ALfloat Position[3]; + ALfloat Velocity[3]; + ALfloat Forward[3]; + ALfloat Up[3]; + ALfloat Gain; ATOMIC(struct ALlistenerProps*) next; }; typedef struct ALlistener { - volatile ALfloat Position[3]; - volatile ALfloat Velocity[3]; - volatile ALfloat Forward[3]; - volatile ALfloat Up[3]; - volatile ALfloat Gain; - volatile ALfloat MetersPerUnit; + alignas(16) ALfloat Position[3]; + ALfloat Velocity[3]; + ALfloat Forward[3]; + ALfloat Up[3]; + ALfloat Gain; + + ATOMIC_FLAG PropsClean; /* Pointer to the most recent property values that are awaiting an update. */ ATOMIC(struct ALlistenerProps*) Update; - /* A linked list of unused property containers, free to use for future - * updates. - */ - ATOMIC(struct ALlistenerProps*) FreeList; - struct { aluMatrixf Matrix; aluVector Velocity; @@ -50,7 +50,8 @@ typedef struct ALlistener { ALfloat MetersPerUnit; ALfloat DopplerFactor; - ALfloat SpeedOfSound; + ALfloat SpeedOfSound; /* in units per sec! */ + ALfloat ReverbSpeedOfSound; /* in meters per sec! */ ALboolean SourceDistanceModel; enum DistanceModel DistanceModel; diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alMain.h b/Engine/lib/openal-soft/OpenAL32/Include/alMain.h index 837e1082b..e29d9c270 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/alMain.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/alMain.h @@ -3,6 +3,7 @@ #include #include +#include #include #include #include @@ -11,15 +12,25 @@ #ifdef HAVE_STRINGS_H #include #endif - -#ifdef HAVE_FENV_H -#include +#ifdef HAVE_INTRIN_H +#include #endif #include "AL/al.h" #include "AL/alc.h" #include "AL/alext.h" +#include "inprogext.h" +#include "logging.h" +#include "polymorphism.h" +#include "static_assert.h" +#include "align.h" +#include "atomic.h" +#include "vector.h" +#include "alstring.h" +#include "almalloc.h" +#include "threads.h" + #if defined(_WIN64) #define SZFMT "%I64u" @@ -29,157 +40,38 @@ #define SZFMT "%zu" #endif - -#include "static_assert.h" -#include "align.h" -#include "atomic.h" -#include "uintmap.h" -#include "vector.h" -#include "alstring.h" -#include "almalloc.h" -#include "threads.h" - -#include "hrtf.h" - -#ifndef ALC_SOFT_device_clock -#define ALC_SOFT_device_clock 1 -typedef int64_t ALCint64SOFT; -typedef uint64_t ALCuint64SOFT; -#define ALC_DEVICE_CLOCK_SOFT 0x1600 -#define ALC_DEVICE_LATENCY_SOFT 0x1601 -#define ALC_DEVICE_CLOCK_LATENCY_SOFT 0x1602 -typedef void (ALC_APIENTRY*LPALCGETINTEGER64VSOFT)(ALCdevice *device, ALCenum pname, ALsizei size, ALCint64SOFT *values); -#ifdef AL_ALEXT_PROTOTYPES -ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, ALsizei size, ALCint64SOFT *values); +#ifdef __has_builtin +#define HAS_BUILTIN __has_builtin +#else +#define HAS_BUILTIN(x) (0) #endif -#endif - -#ifndef AL_SOFT_buffer_samples2 -#define AL_SOFT_buffer_samples2 1 -/* Channel configurations */ -#define AL_MONO_SOFT 0x1500 -#define AL_STEREO_SOFT 0x1501 -#define AL_REAR_SOFT 0x1502 -#define AL_QUAD_SOFT 0x1503 -#define AL_5POINT1_SOFT 0x1504 -#define AL_6POINT1_SOFT 0x1505 -#define AL_7POINT1_SOFT 0x1506 -#define AL_BFORMAT2D_SOFT 0x1507 -#define AL_BFORMAT3D_SOFT 0x1508 - -/* Sample types */ -#define AL_BYTE_SOFT 0x1400 -#define AL_UNSIGNED_BYTE_SOFT 0x1401 -#define AL_SHORT_SOFT 0x1402 -#define AL_UNSIGNED_SHORT_SOFT 0x1403 -#define AL_INT_SOFT 0x1404 -#define AL_UNSIGNED_INT_SOFT 0x1405 -#define AL_FLOAT_SOFT 0x1406 -#define AL_DOUBLE_SOFT 0x1407 -#define AL_BYTE3_SOFT 0x1408 -#define AL_UNSIGNED_BYTE3_SOFT 0x1409 -#define AL_MULAW_SOFT 0x140A - -/* Storage formats */ -#define AL_MONO8_SOFT 0x1100 -#define AL_MONO16_SOFT 0x1101 -#define AL_MONO32F_SOFT 0x10010 -#define AL_STEREO8_SOFT 0x1102 -#define AL_STEREO16_SOFT 0x1103 -#define AL_STEREO32F_SOFT 0x10011 -#define AL_QUAD8_SOFT 0x1204 -#define AL_QUAD16_SOFT 0x1205 -#define AL_QUAD32F_SOFT 0x1206 -#define AL_REAR8_SOFT 0x1207 -#define AL_REAR16_SOFT 0x1208 -#define AL_REAR32F_SOFT 0x1209 -#define AL_5POINT1_8_SOFT 0x120A -#define AL_5POINT1_16_SOFT 0x120B -#define AL_5POINT1_32F_SOFT 0x120C -#define AL_6POINT1_8_SOFT 0x120D -#define AL_6POINT1_16_SOFT 0x120E -#define AL_6POINT1_32F_SOFT 0x120F -#define AL_7POINT1_8_SOFT 0x1210 -#define AL_7POINT1_16_SOFT 0x1211 -#define AL_7POINT1_32F_SOFT 0x1212 -#define AL_BFORMAT2D_8_SOFT 0x20021 -#define AL_BFORMAT2D_16_SOFT 0x20022 -#define AL_BFORMAT2D_32F_SOFT 0x20023 -#define AL_BFORMAT3D_8_SOFT 0x20031 -#define AL_BFORMAT3D_16_SOFT 0x20032 -#define AL_BFORMAT3D_32F_SOFT 0x20033 - -/* Buffer attributes */ -#define AL_INTERNAL_FORMAT_SOFT 0x2008 -#define AL_BYTE_LENGTH_SOFT 0x2009 -#define AL_SAMPLE_LENGTH_SOFT 0x200A -#define AL_SEC_LENGTH_SOFT 0x200B - -#if 0 -typedef void (AL_APIENTRY*LPALBUFFERSAMPLESSOFT)(ALuint,ALuint,ALenum,ALsizei,ALenum,ALenum,const ALvoid*); -typedef void (AL_APIENTRY*LPALGETBUFFERSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,ALvoid*); -typedef ALboolean (AL_APIENTRY*LPALISBUFFERFORMATSUPPORTEDSOFT)(ALenum); -#ifdef AL_ALEXT_PROTOTYPES -AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer, ALuint samplerate, ALenum internalformat, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data); -AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer, ALsizei offset, ALsizei samples, ALenum channels, ALenum type, ALvoid *data); -AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format); -#endif -#endif -#endif - #ifdef __GNUC__ -/* Because of a long-standing deficiency in C, you're not allowed to implicitly - * cast a pointer-to-type-array to a pointer-to-const-type-array. For example, - * - * int (*ptr)[10]; - * const int (*cptr)[10] = ptr; - * - * is not allowed and most compilers will generate noisy warnings about - * incompatible types, even though it just makes the array elements const. - * Clang will allow it if you make the array type a typedef, like this: - * - * typedef int int10[10]; - * int10 *ptr; - * const int10 *cptr = ptr; - * - * however GCC does not and still issues the incompatible type warning. The - * "proper" way to fix it is to add an explicit cast for the constified type, - * but that removes the vast majority of otherwise useful type-checking you'd - * get, and runs the risk of improper casts if types are later changed. Leaving - * it non-const can also be an issue if you use it as a function parameter, and - * happen to have a const type as input (and also reduce the capabilities of - * the compiler to better optimize the function). - * - * So to work around the problem, we use a macro. The macro first assigns the - * incoming variable to the specified non-const type to ensure it's the correct - * type, then casts the variable as the desired constified type. Very ugly, but - * I'd rather not have hundreds of lines of warnings because I want to tell the - * compiler that some array(s) can't be changed by the code, or have lots of - * error-prone casts. +/* LIKELY optimizes the case where the condition is true. The condition is not + * required to be true, but it can result in more optimal code for the true + * path at the expense of a less optimal false path. */ -#define SAFE_CONST(T, var) __extension__({ \ - T _tmp = (var); \ - (const T)_tmp; \ -}) +#define LIKELY(x) __builtin_expect(!!(x), !0) +/* The opposite of LIKELY, optimizing the case where the condition is false. */ +#define UNLIKELY(x) __builtin_expect(!!(x), 0) +/* Unlike LIKELY, ASSUME requires the condition to be true or else it invokes + * undefined behavior. It's essentially an assert without actually checking the + * condition at run-time, allowing for stronger optimizations than LIKELY. + */ +#if HAS_BUILTIN(__builtin_assume) +#define ASSUME __builtin_assume #else -/* Non-GNU-compatible compilers have to use a straight cast with no extra - * checks, due to the lack of multi-statement expressions. - */ -#define SAFE_CONST(T, var) ((const T)(var)) +#define ASSUME(x) do { if(!(x)) __builtin_unreachable(); } while(0) #endif +#else -typedef ALint64SOFT ALint64; -typedef ALuint64SOFT ALuint64; - -#ifndef U64 -#if defined(_MSC_VER) -#define U64(x) ((ALuint64)(x##ui64)) -#elif SIZEOF_LONG == 8 -#define U64(x) ((ALuint64)(x##ul)) -#elif SIZEOF_LONG_LONG == 8 -#define U64(x) ((ALuint64)(x##ull)) +#define LIKELY(x) (!!(x)) +#define UNLIKELY(x) (!!(x)) +#ifdef _MSC_VER +#define ASSUME __assume +#else +#define ASSUME(x) ((void)0) #endif #endif @@ -199,36 +91,88 @@ typedef ALuint64SOFT ALuint64; #endif #endif +/* Calculates the size of a struct with N elements of a flexible array member. + * GCC and Clang allow offsetof(Type, fam[N]) for this, but MSVC seems to have + * trouble, so a bit more verbose workaround is needed. + */ +#define FAM_SIZE(T, M, N) (offsetof(T, M) + sizeof(((T*)NULL)->M[0])*(N)) + + +#ifdef __cplusplus +extern "C" { +#endif + +typedef ALint64SOFT ALint64; +typedef ALuint64SOFT ALuint64; + +#ifndef U64 +#if defined(_MSC_VER) +#define U64(x) ((ALuint64)(x##ui64)) +#elif SIZEOF_LONG == 8 +#define U64(x) ((ALuint64)(x##ul)) +#elif SIZEOF_LONG_LONG == 8 +#define U64(x) ((ALuint64)(x##ull)) +#endif +#endif + +/* Define a CTZ64 macro (count trailing zeros, for 64-bit integers). The result + * is *UNDEFINED* if the value is 0. + */ #ifdef __GNUC__ -#define DECL_FORMAT(x, y, z) __attribute__((format(x, (y), (z)))) + +#if SIZEOF_LONG == 8 +#define CTZ64(x) __builtin_ctzl(x) #else -#define DECL_FORMAT(x, y, z) +#define CTZ64(x) __builtin_ctzll(x) #endif -#if defined(__GNUC__) && defined(__i386__) -/* force_align_arg_pointer is required for proper function arguments aligning - * when SSE code is used. Some systems (Windows, QNX) do not guarantee our - * thread functions will be properly aligned on the stack, even though GCC may - * generate code with the assumption that it is. */ -#define FORCE_ALIGN __attribute__((force_align_arg_pointer)) -#else -#define FORCE_ALIGN -#endif +#elif defined(HAVE_BITSCANFORWARD64_INTRINSIC) -#ifdef HAVE_C99_VLA -#define DECL_VLA(T, _name, _size) T _name[(_size)] -#else -#define DECL_VLA(T, _name, _size) T *_name = alloca((_size) * sizeof(T)) -#endif +inline int msvc64_ctz64(ALuint64 v) +{ + unsigned long idx = 64; + _BitScanForward64(&idx, v); + return (int)idx; +} +#define CTZ64(x) msvc64_ctz64(x) -#ifndef PATH_MAX -#ifdef MAX_PATH -#define PATH_MAX MAX_PATH -#else -#define PATH_MAX 4096 -#endif -#endif +#elif defined(HAVE_BITSCANFORWARD_INTRINSIC) +inline int msvc_ctz64(ALuint64 v) +{ + unsigned long idx = 64; + if(!_BitScanForward(&idx, v&0xffffffff)) + { + if(_BitScanForward(&idx, v>>32)) + idx += 32; + } + return (int)idx; +} +#define CTZ64(x) msvc_ctz64(x) + +#else + +/* There be black magics here. The popcnt64 method is derived from + * https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel + * while the ctz-utilizing-popcnt algorithm is shown here + * http://www.hackersdelight.org/hdcodetxt/ntz.c.txt + * as the ntz2 variant. These likely aren't the most efficient methods, but + * they're good enough if the GCC or MSVC intrinsics aren't available. + */ +inline int fallback_popcnt64(ALuint64 v) +{ + v = v - ((v >> 1) & U64(0x5555555555555555)); + v = (v & U64(0x3333333333333333)) + ((v >> 2) & U64(0x3333333333333333)); + v = (v + (v >> 4)) & U64(0x0f0f0f0f0f0f0f0f); + return (int)((v * U64(0x0101010101010101)) >> 56); +} + +inline int fallback_ctz64(ALuint64 value) +{ + return fallback_popcnt64(~value & (value - 1)); +} +#define CTZ64(x) fallback_ctz64(x) +#endif static const union { ALuint u; @@ -236,108 +180,24 @@ static const union { } EndianTest = { 1 }; #define IS_LITTLE_ENDIAN (EndianTest.b[0] == 1) -#define COUNTOF(x) (sizeof((x))/sizeof((x)[0])) +#define COUNTOF(x) (sizeof(x) / sizeof(0[x])) -#define DERIVE_FROM_TYPE(t) t t##_parent -#define STATIC_CAST(to, obj) (&(obj)->to##_parent) -#ifdef __GNUC__ -#define STATIC_UPCAST(to, from, obj) __extension__({ \ - static_assert(__builtin_types_compatible_p(from, __typeof(*(obj))), \ - "Invalid upcast object from type"); \ - (to*)((char*)(obj) - offsetof(to, from##_parent)); \ -}) -#else -#define STATIC_UPCAST(to, from, obj) ((to*)((char*)(obj) - offsetof(to, from##_parent))) -#endif - -#define DECLARE_FORWARD(T1, T2, rettype, func) \ -rettype T1##_##func(T1 *obj) \ -{ return T2##_##func(STATIC_CAST(T2, obj)); } - -#define DECLARE_FORWARD1(T1, T2, rettype, func, argtype1) \ -rettype T1##_##func(T1 *obj, argtype1 a) \ -{ return T2##_##func(STATIC_CAST(T2, obj), a); } - -#define DECLARE_FORWARD2(T1, T2, rettype, func, argtype1, argtype2) \ -rettype T1##_##func(T1 *obj, argtype1 a, argtype2 b) \ -{ return T2##_##func(STATIC_CAST(T2, obj), a, b); } - -#define DECLARE_FORWARD3(T1, T2, rettype, func, argtype1, argtype2, argtype3) \ -rettype T1##_##func(T1 *obj, argtype1 a, argtype2 b, argtype3 c) \ -{ return T2##_##func(STATIC_CAST(T2, obj), a, b, c); } - - -#define GET_VTABLE1(T1) (&(T1##_vtable)) -#define GET_VTABLE2(T1, T2) (&(T1##_##T2##_vtable)) - -#define SET_VTABLE1(T1, obj) ((obj)->vtbl = GET_VTABLE1(T1)) -#define SET_VTABLE2(T1, T2, obj) (STATIC_CAST(T2, obj)->vtbl = GET_VTABLE2(T1, T2)) - -#define DECLARE_THUNK(T1, T2, rettype, func) \ -static rettype T1##_##T2##_##func(T2 *obj) \ -{ return T1##_##func(STATIC_UPCAST(T1, T2, obj)); } - -#define DECLARE_THUNK1(T1, T2, rettype, func, argtype1) \ -static rettype T1##_##T2##_##func(T2 *obj, argtype1 a) \ -{ return T1##_##func(STATIC_UPCAST(T1, T2, obj), a); } - -#define DECLARE_THUNK2(T1, T2, rettype, func, argtype1, argtype2) \ -static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b) \ -{ return T1##_##func(STATIC_UPCAST(T1, T2, obj), a, b); } - -#define DECLARE_THUNK3(T1, T2, rettype, func, argtype1, argtype2, argtype3) \ -static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b, argtype3 c) \ -{ return T1##_##func(STATIC_UPCAST(T1, T2, obj), a, b, c); } - -#define DECLARE_THUNK4(T1, T2, rettype, func, argtype1, argtype2, argtype3, argtype4) \ -static rettype T1##_##T2##_##func(T2 *obj, argtype1 a, argtype2 b, argtype3 c, argtype4 d) \ -{ return T1##_##func(STATIC_UPCAST(T1, T2, obj), a, b, c, d); } - -#define DECLARE_DEFAULT_ALLOCATORS(T) \ -static void* T##_New(size_t size) { return al_malloc(16, size); } \ -static void T##_Delete(void *ptr) { al_free(ptr); } - -/* Helper to extract an argument list for VCALL. Not used directly. */ -#define EXTRACT_VCALL_ARGS(...) __VA_ARGS__)) - -/* Call a "virtual" method on an object, with arguments. */ -#define V(obj, func) ((obj)->vtbl->func((obj), EXTRACT_VCALL_ARGS -/* Call a "virtual" method on an object, with no arguments. */ -#define V0(obj, func) ((obj)->vtbl->func((obj) EXTRACT_VCALL_ARGS - -#define DELETE_OBJ(obj) do { \ - if((obj) != NULL) \ - { \ - V0((obj),Destruct)(); \ - V0((obj),Delete)(); \ - } \ -} while(0) - - -#define EXTRACT_NEW_ARGS(...) __VA_ARGS__); \ - } \ -} while(0) - -#define NEW_OBJ(_res, T) do { \ - _res = T##_New(sizeof(T)); \ - if(_res) \ - { \ - memset(_res, 0, sizeof(T)); \ - T##_Construct(_res, EXTRACT_NEW_ARGS -#define NEW_OBJ0(_res, T) do { \ - _res = T##_New(sizeof(T)); \ - if(_res) \ - { \ - memset(_res, 0, sizeof(T)); \ - T##_Construct(_res EXTRACT_NEW_ARGS - - -#ifdef __cplusplus -extern "C" { -#endif - +struct ll_ringbuffer; struct Hrtf; +struct HrtfEntry; +struct DirectHrtfState; +struct FrontStablizer; +struct Compressor; +struct ALCbackend; +struct ALbuffer; +struct ALeffect; +struct ALfilter; +struct ALsource; +struct ALcontextProps; +struct ALlistenerProps; +struct ALvoiceProps; +struct ALeffectslotProps; #define DEFAULT_OUTPUT_RATE (44100) @@ -359,26 +219,61 @@ inline ALuint NextPowerOf2(ALuint value) return value+1; } -/* Fast float-to-int conversion. Assumes the FPU is already in round-to-zero - * mode. */ +/** Round up a value to the next multiple. */ +inline size_t RoundUp(size_t value, size_t r) +{ + value += r-1; + return value - (value%r); +} + +/* Fast float-to-int conversion. No particular rounding mode is assumed; the + * IEEE-754 default is round-to-nearest with ties-to-even, though an app could + * change it on its own threads. On some systems, a truncating conversion may + * always be the fastest method. + */ inline ALint fastf2i(ALfloat f) { -#ifdef HAVE_LRINTF - return lrintf(f); -#elif defined(_MSC_VER) && defined(_M_IX86) +#if defined(HAVE_INTRIN_H) && ((defined(_M_IX86_FP) && (_M_IX86_FP > 0)) || defined(_M_X64)) + return _mm_cvt_ss2si(_mm_set1_ps(f)); + +#elif defined(_MSC_VER) && defined(_M_IX86_FP) + ALint i; __asm fld f __asm fistp i return i; + +#elif (defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__)) + + ALint i; +#ifdef __SSE_MATH__ + __asm__("cvtss2si %1, %0" : "=r"(i) : "x"(f)); #else + __asm__("flds %1\n fistps %0" : "=m"(i) : "m"(f)); +#endif + return i; + + /* On GCC when compiling with -fno-math-errno, lrintf can be inlined to + * some simple instructions. Clang does not inline it, always generating a + * libc call, while MSVC's implementation is horribly slow, so always fall + * back to a normal integer conversion for them. + */ +#elif defined(HAVE_LRINTF) && !defined(_MSC_VER) && !defined(__clang__) + + return lrintf(f); + +#else + return (ALint)f; #endif } -/* Fast float-to-uint conversion. Assumes the FPU is already in round-to-zero - * mode. */ -inline ALuint fastf2u(ALfloat f) -{ return fastf2i(f); } +/* Converts float-to-int using standard behavior (truncation). */ +inline int float2int(float f) +{ + /* TODO: Make a more efficient method for x87. */ + return (ALint)f; +} enum DevProbe { @@ -386,36 +281,6 @@ enum DevProbe { CAPTURE_DEVICE_PROBE }; -typedef struct { - ALCenum (*OpenPlayback)(ALCdevice*, const ALCchar*); - void (*ClosePlayback)(ALCdevice*); - ALCboolean (*ResetPlayback)(ALCdevice*); - ALCboolean (*StartPlayback)(ALCdevice*); - void (*StopPlayback)(ALCdevice*); - - ALCenum (*OpenCapture)(ALCdevice*, const ALCchar*); - void (*CloseCapture)(ALCdevice*); - void (*StartCapture)(ALCdevice*); - void (*StopCapture)(ALCdevice*); - ALCenum (*CaptureSamples)(ALCdevice*, void*, ALCuint); - ALCuint (*AvailableSamples)(ALCdevice*); -} BackendFuncs; - -ALCboolean alc_sndio_init(BackendFuncs *func_list); -void alc_sndio_deinit(void); -void alc_sndio_probe(enum DevProbe type); -ALCboolean alc_ca_init(BackendFuncs *func_list); -void alc_ca_deinit(void); -void alc_ca_probe(enum DevProbe type); -ALCboolean alc_opensl_init(BackendFuncs *func_list); -void alc_opensl_deinit(void); -void alc_opensl_probe(enum DevProbe type); -ALCboolean alc_qsa_init(BackendFuncs *func_list); -void alc_qsa_deinit(void); -void alc_qsa_probe(enum DevProbe type); - -struct ALCbackend; - enum DistanceModel { InverseDistanceClamped = AL_INVERSE_DISTANCE_CLAMPED, @@ -489,41 +354,36 @@ enum DevFmtChannels { DevFmtX51 = ALC_5POINT1_SOFT, DevFmtX61 = ALC_6POINT1_SOFT, DevFmtX71 = ALC_7POINT1_SOFT, + DevFmtAmbi3D = ALC_BFORMAT3D_SOFT, /* Similar to 5.1, except using rear channels instead of sides */ DevFmtX51Rear = 0x80000000, - /* Ambisonic formats should be kept together */ - DevFmtAmbi1, - DevFmtAmbi2, - DevFmtAmbi3, - DevFmtChannelsDefault = DevFmtStereo }; #define MAX_OUTPUT_CHANNELS (16) -ALuint BytesFromDevFmt(enum DevFmtType type); -ALuint ChannelsFromDevFmt(enum DevFmtChannels chans); -inline ALuint FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType type) +ALsizei BytesFromDevFmt(enum DevFmtType type); +ALsizei ChannelsFromDevFmt(enum DevFmtChannels chans, ALsizei ambiorder); +inline ALsizei FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType type, ALsizei ambiorder) { - return ChannelsFromDevFmt(chans) * BytesFromDevFmt(type); + return ChannelsFromDevFmt(chans, ambiorder) * BytesFromDevFmt(type); } -enum AmbiFormat { - AmbiFormat_FuMa, /* FuMa channel order and normalization */ - AmbiFormat_ACN_SN3D, /* ACN channel order and SN3D normalization */ - AmbiFormat_ACN_N3D, /* ACN channel order and N3D normalization */ +enum AmbiLayout { + AmbiLayout_FuMa = ALC_FUMA_SOFT, /* FuMa channel order */ + AmbiLayout_ACN = ALC_ACN_SOFT, /* ACN channel order */ - AmbiFormat_Default = AmbiFormat_ACN_SN3D + AmbiLayout_Default = AmbiLayout_ACN }; +enum AmbiNorm { + AmbiNorm_FuMa = ALC_FUMA_SOFT, /* FuMa normalization */ + AmbiNorm_SN3D = ALC_SN3D_SOFT, /* SN3D normalization */ + AmbiNorm_N3D = ALC_N3D_SOFT, /* N3D normalization */ -extern const struct EffectList { - const char *name; - int type; - const char *ename; - ALenum val; -} EffectList[]; + AmbiNorm_Default = AmbiNorm_SN3D +}; enum DeviceType { @@ -565,7 +425,7 @@ enum RenderMode { typedef ALfloat ChannelConfig[MAX_AMBI_COEFFS]; typedef struct BFChannelConfig { ALfloat Scale; - ALuint Index; + ALsizei Index; } BFChannelConfig; typedef union AmbiConfig { @@ -576,33 +436,96 @@ typedef union AmbiConfig { } AmbiConfig; -#define HRTF_HISTORY_BITS (6) -#define HRTF_HISTORY_LENGTH (1<Device); } - -inline void UnlockContext(ALCcontext *context) -{ ALCdevice_Unlock(context->Device); } - -enum { - DeferOff = AL_FALSE, - DeferAll, - DeferAllowPlay -}; - - -typedef struct { -#ifdef HAVE_FENV_H - DERIVE_FROM_TYPE(fenv_t); -#else - int state; -#endif -#ifdef HAVE_SSE - int sse_state; -#endif -} FPUCtl; -void SetMixerFPUMode(FPUCtl *ctl); -void RestoreFPUMode(const FPUCtl *ctl); - - -typedef struct ll_ringbuffer ll_ringbuffer_t; -typedef struct ll_ringbuffer_data { - char *buf; - size_t len; -} ll_ringbuffer_data_t; -ll_ringbuffer_t *ll_ringbuffer_create(size_t sz, size_t elem_sz); -void ll_ringbuffer_free(ll_ringbuffer_t *rb); -void ll_ringbuffer_get_read_vector(const ll_ringbuffer_t *rb, ll_ringbuffer_data_t *vec); -void ll_ringbuffer_get_write_vector(const ll_ringbuffer_t *rb, ll_ringbuffer_data_t *vec); -size_t ll_ringbuffer_read(ll_ringbuffer_t *rb, char *dest, size_t cnt); -size_t ll_ringbuffer_peek(ll_ringbuffer_t *rb, char *dest, size_t cnt); -void ll_ringbuffer_read_advance(ll_ringbuffer_t *rb, size_t cnt); -size_t ll_ringbuffer_read_space(const ll_ringbuffer_t *rb); -int ll_ringbuffer_mlock(ll_ringbuffer_t *rb); -void ll_ringbuffer_reset(ll_ringbuffer_t *rb); -size_t ll_ringbuffer_write(ll_ringbuffer_t *rb, const char *src, size_t cnt); -void ll_ringbuffer_write_advance(ll_ringbuffer_t *rb, size_t cnt); -size_t ll_ringbuffer_write_space(const ll_ringbuffer_t *rb); - -void ReadALConfig(void); -void FreeALConfig(void); -int ConfigValueExists(const char *devName, const char *blockName, const char *keyName); -const char *GetConfigValue(const char *devName, const char *blockName, const char *keyName, const char *def); -int GetConfigValueBool(const char *devName, const char *blockName, const char *keyName, int def); -int ConfigValueStr(const char *devName, const char *blockName, const char *keyName, const char **ret); -int ConfigValueInt(const char *devName, const char *blockName, const char *keyName, int *ret); -int ConfigValueUInt(const char *devName, const char *blockName, const char *keyName, unsigned int *ret); -int ConfigValueFloat(const char *devName, const char *blockName, const char *keyName, float *ret); -int ConfigValueBool(const char *devName, const char *blockName, const char *keyName, int *ret); +extern ALint RTPrioLevel; void SetRTPriority(void); void SetDefaultChannelOrder(ALCdevice *device); @@ -882,12 +778,6 @@ void SetDefaultWFXChannelOrder(ALCdevice *device); const ALCchar *DevFmtTypeString(enum DevFmtType type); const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans); -/** - * GetChannelIdxByName - * - * Returns the index for the given channel name (e.g. FrontCenter), or -1 if it - * doesn't exist. - */ inline ALint GetChannelIndex(const enum Channel names[MAX_OUTPUT_CHANNELS], enum Channel chan) { ALint i; @@ -898,68 +788,33 @@ inline ALint GetChannelIndex(const enum Channel names[MAX_OUTPUT_CHANNELS], enum } return -1; } -#define GetChannelIdxByName(x, c) GetChannelIndex((x).ChannelName, (c)) - -extern FILE *LogFile; - -#if defined(__GNUC__) && !defined(_WIN32) && !defined(IN_IDE_PARSER) -#define AL_PRINT(T, MSG, ...) fprintf(LogFile, "AL lib: %s %s: "MSG, T, __FUNCTION__ , ## __VA_ARGS__) -#else -void al_print(const char *type, const char *func, const char *fmt, ...) DECL_FORMAT(printf, 3,4); -#define AL_PRINT(T, ...) al_print((T), __FUNCTION__, __VA_ARGS__) -#endif - -enum LogLevel { - NoLog, - LogError, - LogWarning, - LogTrace, - LogRef -}; -extern enum LogLevel LogLevel; - -#define TRACEREF(...) do { \ - if(LogLevel >= LogRef) \ - AL_PRINT("(--)", __VA_ARGS__); \ -} while(0) - -#define TRACE(...) do { \ - if(LogLevel >= LogTrace) \ - AL_PRINT("(II)", __VA_ARGS__); \ -} while(0) - -#define WARN(...) do { \ - if(LogLevel >= LogWarning) \ - AL_PRINT("(WW)", __VA_ARGS__); \ -} while(0) - -#define ERR(...) do { \ - if(LogLevel >= LogError) \ - AL_PRINT("(EE)", __VA_ARGS__); \ -} while(0) +/** + * GetChannelIdxByName + * + * Returns the index for the given channel name (e.g. FrontCenter), or -1 if it + * doesn't exist. + */ +inline ALint GetChannelIdxByName(const RealMixParams *real, enum Channel chan) +{ return GetChannelIndex(real->ChannelName, chan); } -extern ALint RTPrioLevel; +inline void LockBufferList(ALCdevice *device) { almtx_lock(&device->BufferLock); } +inline void UnlockBufferList(ALCdevice *device) { almtx_unlock(&device->BufferLock); } +inline void LockEffectList(ALCdevice *device) { almtx_lock(&device->EffectLock); } +inline void UnlockEffectList(ALCdevice *device) { almtx_unlock(&device->EffectLock); } -extern ALuint CPUCapFlags; -enum { - CPU_CAP_SSE = 1<<0, - CPU_CAP_SSE2 = 1<<1, - CPU_CAP_SSE3 = 1<<2, - CPU_CAP_SSE4_1 = 1<<3, - CPU_CAP_NEON = 1<<4, -}; +inline void LockFilterList(ALCdevice *device) { almtx_lock(&device->FilterLock); } +inline void UnlockFilterList(ALCdevice *device) { almtx_unlock(&device->FilterLock); } + +inline void LockEffectSlotList(ALCcontext *context) +{ almtx_lock(&context->EffectSlotLock); } +inline void UnlockEffectSlotList(ALCcontext *context) +{ almtx_unlock(&context->EffectSlotLock); } -void FillCPUCaps(ALuint capfilter); vector_al_string SearchDataFiles(const char *match, const char *subdir); -/* Small hack to use a pointer-to-array type as a normal argument type. - * Shouldn't be used directly. */ -typedef ALfloat ALfloatBUFFERSIZE[BUFFERSIZE]; - - #ifdef __cplusplus } #endif diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alSource.h b/Engine/lib/openal-soft/OpenAL32/Include/alSource.h index b288937a3..5f07c09d7 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/alSource.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/alSource.h @@ -1,11 +1,14 @@ #ifndef _AL_SOURCE_H_ #define _AL_SOURCE_H_ -#define MAX_SENDS 4 - +#include "bool.h" #include "alMain.h" #include "alu.h" #include "hrtf.h" +#include "atomic.h" + +#define MAX_SENDS 16 +#define DEFAULT_SENDS 2 #ifdef __cplusplus extern "C" { @@ -13,104 +16,16 @@ extern "C" { struct ALbuffer; struct ALsource; -struct ALsourceProps; typedef struct ALbufferlistitem { - struct ALbuffer *buffer; - struct ALbufferlistitem *volatile next; + ATOMIC(struct ALbufferlistitem*) next; + ALsizei max_samples; + ALsizei num_buffers; + struct ALbuffer *buffers[]; } ALbufferlistitem; -struct ALsourceProps { - ATOMIC(ALfloat) Pitch; - ATOMIC(ALfloat) Gain; - ATOMIC(ALfloat) OuterGain; - ATOMIC(ALfloat) MinGain; - ATOMIC(ALfloat) MaxGain; - ATOMIC(ALfloat) InnerAngle; - ATOMIC(ALfloat) OuterAngle; - ATOMIC(ALfloat) RefDistance; - ATOMIC(ALfloat) MaxDistance; - ATOMIC(ALfloat) RollOffFactor; - ATOMIC(ALfloat) Position[3]; - ATOMIC(ALfloat) Velocity[3]; - ATOMIC(ALfloat) Direction[3]; - ATOMIC(ALfloat) Orientation[2][3]; - ATOMIC(ALboolean) HeadRelative; - ATOMIC(enum DistanceModel) DistanceModel; - ATOMIC(ALboolean) DirectChannels; - - ATOMIC(ALboolean) DryGainHFAuto; - ATOMIC(ALboolean) WetGainAuto; - ATOMIC(ALboolean) WetGainHFAuto; - ATOMIC(ALfloat) OuterGainHF; - - ATOMIC(ALfloat) AirAbsorptionFactor; - ATOMIC(ALfloat) RoomRolloffFactor; - ATOMIC(ALfloat) DopplerFactor; - - ATOMIC(ALfloat) StereoPan[2]; - - ATOMIC(ALfloat) Radius; - - /** Direct filter and auxiliary send info. */ - struct { - ATOMIC(ALfloat) Gain; - ATOMIC(ALfloat) GainHF; - ATOMIC(ALfloat) HFReference; - ATOMIC(ALfloat) GainLF; - ATOMIC(ALfloat) LFReference; - } Direct; - struct { - ATOMIC(struct ALeffectslot*) Slot; - ATOMIC(ALfloat) Gain; - ATOMIC(ALfloat) GainHF; - ATOMIC(ALfloat) HFReference; - ATOMIC(ALfloat) GainLF; - ATOMIC(ALfloat) LFReference; - } Send[MAX_SENDS]; - - ATOMIC(struct ALsourceProps*) next; -}; - - -typedef struct ALvoice { - struct ALsourceProps Props; - - struct ALsource *volatile Source; - - /** Current target parameters used for mixing. */ - ALint Step; - - /* If not 'moving', gain/coefficients are set directly without fading. */ - ALboolean Moving; - - ALboolean IsHrtf; - - ALuint Offset; /* Number of output samples mixed since starting. */ - - alignas(16) ALfloat PrevSamples[MAX_INPUT_CHANNELS][MAX_PRE_SAMPLES]; - - BsincState SincState; - - struct { - ALfloat (*Buffer)[BUFFERSIZE]; - ALuint Channels; - } DirectOut; - - struct { - ALfloat (*Buffer)[BUFFERSIZE]; - ALuint Channels; - } SendOut[MAX_SENDS]; - - struct { - DirectParams Direct; - SendParams Send[MAX_SENDS]; - } Chan[MAX_INPUT_CHANNELS]; -} ALvoice; - - typedef struct ALsource { /** Source properties. */ ALfloat Pitch; @@ -122,14 +37,17 @@ typedef struct ALsource { ALfloat OuterAngle; ALfloat RefDistance; ALfloat MaxDistance; - ALfloat RollOffFactor; + ALfloat RolloffFactor; ALfloat Position[3]; ALfloat Velocity[3]; ALfloat Direction[3]; ALfloat Orientation[2][3]; ALboolean HeadRelative; + ALboolean Looping; enum DistanceModel DistanceModel; + enum Resampler Resampler; ALboolean DirectChannels; + enum SpatializeMode Spatialize; ALboolean DryGainHFAuto; ALboolean WetGainAuto; @@ -162,7 +80,7 @@ typedef struct ALsource { ALfloat HFReference; ALfloat GainLF; ALfloat LFReference; - } Send[MAX_SENDS]; + } *Send; /** * Last user-specified offset, and the offset type (bytes, samples, or @@ -176,51 +94,22 @@ typedef struct ALsource { /** Source state (initial, playing, paused, or stopped) */ ALenum state; - ALenum new_state; - /** Source Buffer Queue info. */ - RWLock queue_lock; - ATOMIC(ALbufferlistitem*) queue; - ATOMIC(ALbufferlistitem*) current_buffer; + /** Source Buffer Queue head. */ + ALbufferlistitem *queue; - /** - * Source offset in samples, relative to the currently playing buffer, NOT - * the whole queue, and the fractional (fixed-point) offset to the next - * sample. + ATOMIC_FLAG PropsClean; + + /* Index into the context's Voices array. Lazily updated, only checked and + * reset when looking up the voice. */ - ATOMIC(ALuint) position; - ATOMIC(ALuint) position_fraction; - - ATOMIC(ALboolean) looping; - - /** Current buffer sample info. */ - ALuint NumChannels; - ALuint SampleSize; - - ATOMIC(struct ALsourceProps*) Update; - ATOMIC(struct ALsourceProps*) FreeList; + ALint VoiceIdx; /** Self ID */ ALuint id; } ALsource; -inline void LockSourcesRead(ALCcontext *context) -{ LockUIntMapRead(&context->SourceMap); } -inline void UnlockSourcesRead(ALCcontext *context) -{ UnlockUIntMapRead(&context->SourceMap); } -inline void LockSourcesWrite(ALCcontext *context) -{ LockUIntMapWrite(&context->SourceMap); } -inline void UnlockSourcesWrite(ALCcontext *context) -{ UnlockUIntMapWrite(&context->SourceMap); } - -inline struct ALsource *LookupSource(ALCcontext *context, ALuint id) -{ return (struct ALsource*)LookupUIntMapKeyNoLock(&context->SourceMap, id); } -inline struct ALsource *RemoveSource(ALCcontext *context, ALuint id) -{ return (struct ALsource*)RemoveUIntMapKeyNoLock(&context->SourceMap, id); } - void UpdateAllSourceProps(ALCcontext *context); -ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state); -ALboolean ApplyOffset(ALsource *Source); ALvoid ReleaseALSources(ALCcontext *Context); diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alThunk.h b/Engine/lib/openal-soft/OpenAL32/Include/alThunk.h deleted file mode 100644 index adc77dec9..000000000 --- a/Engine/lib/openal-soft/OpenAL32/Include/alThunk.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef ALTHUNK_H -#define ALTHUNK_H - -#include "alMain.h" - -#ifdef __cplusplus -extern "C" { -#endif - -void ThunkInit(void); -void ThunkExit(void); -ALenum NewThunkEntry(ALuint *index); -void FreeThunkEntry(ALuint index); - -#ifdef __cplusplus -} -#endif - -#endif //ALTHUNK_H - diff --git a/Engine/lib/openal-soft/OpenAL32/Include/alu.h b/Engine/lib/openal-soft/OpenAL32/Include/alu.h index ae8645fa7..b977613c0 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/alu.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/alu.h @@ -12,35 +12,56 @@ #include "alMain.h" #include "alBuffer.h" -#include "alFilter.h" -#include "alAuxEffectSlot.h" #include "hrtf.h" #include "align.h" #include "math_defs.h" +#include "filters/defs.h" +#include "filters/nfc.h" #define MAX_PITCH (255) -/* Maximum number of buffer samples before the current pos needed for resampling. */ -#define MAX_PRE_SAMPLES 12 - -/* Maximum number of buffer samples after the current pos needed for resampling. */ -#define MAX_POST_SAMPLES 12 +/* Maximum number of samples to pad on either end of a buffer for resampling. + * Note that both the beginning and end need padding! + */ +#define MAX_RESAMPLE_PADDING 24 #ifdef __cplusplus extern "C" { #endif +struct BSincTable; struct ALsource; -struct ALsourceProps; +struct ALbufferlistitem; struct ALvoice; struct ALeffectslot; -struct ALbuffer; -/* The number of distinct scale and phase intervals within the filter table. */ +#define DITHER_RNG_SEED 22222 + + +enum SpatializeMode { + SpatializeOff = AL_FALSE, + SpatializeOn = AL_TRUE, + SpatializeAuto = AL_AUTO_SOFT +}; + +enum Resampler { + PointResampler, + LinearResampler, + FIR4Resampler, + BSinc12Resampler, + BSinc24Resampler, + + ResamplerMax = BSinc24Resampler +}; +extern enum Resampler ResamplerDefault; + +/* The number of distinct scale and phase intervals within the bsinc filter + * table. + */ #define BSINC_SCALE_BITS 4 #define BSINC_SCALE_COUNT (1< b) ? b : a); } +inline size_t maxz(size_t a, size_t b) +{ return ((a > b) ? a : b); } +inline size_t clampz(size_t val, size_t min, size_t max) +{ return minz(max, maxz(min, val)); } inline ALfloat lerp(ALfloat val1, ALfloat val2, ALfloat mu) { return val1 + (val2-val1)*mu; } -inline ALfloat resample_fir4(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALuint frac) +inline ALfloat cubic(ALfloat val1, ALfloat val2, ALfloat val3, ALfloat val4, ALfloat mu) { - const ALfloat *k = ResampleCoeffs.FIR4[frac]; - return k[0]*val0 + k[1]*val1 + k[2]*val2 + k[3]*val3; -} -inline ALfloat resample_fir8(ALfloat val0, ALfloat val1, ALfloat val2, ALfloat val3, ALfloat val4, ALfloat val5, ALfloat val6, ALfloat val7, ALuint frac) -{ - const ALfloat *k = ResampleCoeffs.FIR8[frac]; - return k[0]*val0 + k[1]*val1 + k[2]*val2 + k[3]*val3 + - k[4]*val4 + k[5]*val5 + k[6]*val6 + k[7]*val7; + ALfloat mu2 = mu*mu, mu3 = mu2*mu; + ALfloat a0 = -0.5f*mu3 + mu2 + -0.5f*mu; + ALfloat a1 = 1.5f*mu3 + -2.5f*mu2 + 1.0f; + ALfloat a2 = -1.5f*mu3 + 2.0f*mu2 + 0.5f*mu; + ALfloat a3 = 0.5f*mu3 + -0.5f*mu2; + return val1*a0 + val2*a1 + val3*a2 + val4*a3; } @@ -256,11 +413,11 @@ enum HrtfRequestMode { Hrtf_Disable = 2, }; +void aluInit(void); void aluInitMixer(void); -MixerFunc SelectMixer(void); -RowMixerFunc SelectRowMixer(void); +ResamplerFunc SelectResampler(enum Resampler resampler); /* aluInitRenderer * @@ -271,6 +428,8 @@ void aluInitRenderer(ALCdevice *device, ALint hrtf_id, enum HrtfRequestMode hrtf void aluInitEffectPanning(struct ALeffectslot *slot); +void aluSelectPostProcess(ALCdevice *device); + /** * CalcDirectionCoeffs * @@ -280,18 +439,6 @@ void aluInitEffectPanning(struct ALeffectslot *slot); */ void CalcDirectionCoeffs(const ALfloat dir[3], ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]); -/** - * CalcXYZCoeffs - * - * Same as CalcDirectionCoeffs except the direction is specified as separate x, - * y, and z parameters instead of an array. - */ -inline void CalcXYZCoeffs(ALfloat x, ALfloat y, ALfloat z, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]) -{ - ALfloat dir[3] = { x, y, z }; - CalcDirectionCoeffs(dir, spread, coeffs); -} - /** * CalcAngleCoeffs * @@ -299,37 +446,46 @@ inline void CalcXYZCoeffs(ALfloat x, ALfloat y, ALfloat z, ALfloat spread, ALflo * azimuth and elevation parameters are in radians, going right and up * respectively. */ -void CalcAngleCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]); +inline void CalcAngleCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]) +{ + ALfloat dir[3] = { + sinf(azimuth) * cosf(elevation), + sinf(elevation), + -cosf(azimuth) * cosf(elevation) + }; + CalcDirectionCoeffs(dir, spread, coeffs); +} /** - * ComputeAmbientGains + * CalcAnglePairwiseCoeffs * - * Computes channel gains for ambient, omni-directional sounds. + * Calculates ambisonic coefficients based on azimuth and elevation. The + * azimuth and elevation parameters are in radians, going right and up + * respectively. This pairwise variant warps the result such that +30 azimuth + * is full right, and -30 azimuth is full left. */ -#define ComputeAmbientGains(b, g, o) do { \ - if((b).CoeffCount > 0) \ - ComputeAmbientGainsMC((b).Ambi.Coeffs, (b).NumChannels, g, o); \ - else \ - ComputeAmbientGainsBF((b).Ambi.Map, (b).NumChannels, g, o); \ -} while (0) -void ComputeAmbientGainsMC(const ChannelConfig *chancoeffs, ALuint numchans, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); -void ComputeAmbientGainsBF(const BFChannelConfig *chanmap, ALuint numchans, ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); +void CalcAnglePairwiseCoeffs(ALfloat azimuth, ALfloat elevation, ALfloat spread, ALfloat coeffs[MAX_AMBI_COEFFS]); + +void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, ALsizei numcoeffs, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); +void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); /** - * ComputePanningGains + * ComputeDryPanGains * * Computes panning gains using the given channel decoder coefficients and the * pre-calculated direction or angle coefficients. */ -#define ComputePanningGains(b, c, g, o) do { \ - if((b).CoeffCount > 0) \ - ComputePanningGainsMC((b).Ambi.Coeffs, (b).NumChannels, (b).CoeffCount, c, g, o);\ - else \ - ComputePanningGainsBF((b).Ambi.Map, (b).NumChannels, c, g, o); \ -} while (0) -void ComputePanningGainsMC(const ChannelConfig *chancoeffs, ALuint numchans, ALuint numcoeffs, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); -void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALuint numchans, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); +inline void ComputeDryPanGains(const DryMixParams *dry, const ALfloat coeffs[MAX_AMBI_COEFFS], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) +{ + if(dry->CoeffCount > 0) + ComputePanningGainsMC(dry->Ambi.Coeffs, dry->NumChannels, dry->CoeffCount, + coeffs, ingain, gains); + else + ComputePanningGainsBF(dry->Ambi.Map, dry->NumChannels, coeffs, ingain, gains); +} +void ComputeFirstOrderGainsMC(const ChannelConfig *chancoeffs, ALsizei numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); +void ComputeFirstOrderGainsBF(const BFChannelConfig *chanmap, ALsizei numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); /** * ComputeFirstOrderGains * @@ -337,24 +493,29 @@ void ComputePanningGainsBF(const BFChannelConfig *chanmap, ALuint numchans, cons * a 1x4 'slice' of a transform matrix for the input channel, used to scale and * orient the sound samples. */ -#define ComputeFirstOrderGains(b, m, g, o) do { \ - if((b).CoeffCount > 0) \ - ComputeFirstOrderGainsMC((b).Ambi.Coeffs, (b).NumChannels, m, g, o); \ - else \ - ComputeFirstOrderGainsBF((b).Ambi.Map, (b).NumChannels, m, g, o); \ -} while (0) -void ComputeFirstOrderGainsMC(const ChannelConfig *chancoeffs, ALuint numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); -void ComputeFirstOrderGainsBF(const BFChannelConfig *chanmap, ALuint numchans, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]); +inline void ComputeFirstOrderGains(const BFMixParams *foa, const ALfloat mtx[4], ALfloat ingain, ALfloat gains[MAX_OUTPUT_CHANNELS]) +{ + if(foa->CoeffCount > 0) + ComputeFirstOrderGainsMC(foa->Ambi.Coeffs, foa->NumChannels, mtx, ingain, gains); + else + ComputeFirstOrderGainsBF(foa->Ambi.Map, foa->NumChannels, mtx, ingain, gains); +} -ALvoid MixSource(struct ALvoice *voice, struct ALsource *source, ALCdevice *Device, ALuint SamplesToDo); +ALboolean MixSource(struct ALvoice *voice, ALuint SourceID, ALCcontext *Context, ALsizei SamplesToDo); -ALvoid aluMixData(ALCdevice *device, ALvoid *buffer, ALsizei size); -/* Caller must lock the device. */ -ALvoid aluHandleDisconnect(ALCdevice *device); +void aluMixData(ALCdevice *device, ALvoid *OutBuffer, ALsizei NumSamples); +/* Caller must lock the device, and the mixer must not be running. */ +void aluHandleDisconnect(ALCdevice *device, const char *msg, ...) DECL_FORMAT(printf, 2, 3); + +void UpdateContextProps(ALCcontext *context); + +extern MixerFunc MixSamples; +extern RowMixerFunc MixRowSamples; extern ALfloat ConeScale; extern ALfloat ZScale; +extern ALboolean OverrideReverbSpeedOfSound; #ifdef __cplusplus } diff --git a/Engine/lib/openal-soft/OpenAL32/Include/bs2b.h b/Engine/lib/openal-soft/OpenAL32/Include/bs2b.h index bfe5c274c..e845d906d 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/bs2b.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/bs2b.h @@ -85,7 +85,7 @@ int bs2b_get_srate(struct bs2b *bs2b); /* Clear buffer */ void bs2b_clear(struct bs2b *bs2b); -void bs2b_cross_feed(struct bs2b *bs2b, float *restrict Left, float *restrict Right, unsigned int SamplesToDo); +void bs2b_cross_feed(struct bs2b *bs2b, float *restrict Left, float *restrict Right, int SamplesToDo); #ifdef __cplusplus } /* extern "C" */ diff --git a/Engine/lib/openal-soft/OpenAL32/Include/sample_cvt.h b/Engine/lib/openal-soft/OpenAL32/Include/sample_cvt.h index 12bb1fa6c..c041760e6 100644 --- a/Engine/lib/openal-soft/OpenAL32/Include/sample_cvt.h +++ b/Engine/lib/openal-soft/OpenAL32/Include/sample_cvt.h @@ -4,6 +4,12 @@ #include "AL/al.h" #include "alBuffer.h" -void ConvertData(ALvoid *dst, enum UserFmtType dstType, const ALvoid *src, enum UserFmtType srcType, ALsizei numchans, ALsizei len, ALsizei align); +extern const ALshort muLawDecompressionTable[256]; +extern const ALshort aLawDecompressionTable[256]; + +void Convert_ALshort_ALima4(ALshort *dst, const ALubyte *src, ALsizei numchans, ALsizei len, + ALsizei align); +void Convert_ALshort_ALmsadpcm(ALshort *dst, const ALubyte *src, ALsizei numchans, ALsizei len, + ALsizei align); #endif /* SAMPLE_CVT_H */ diff --git a/Engine/lib/openal-soft/OpenAL32/alAuxEffectSlot.c b/Engine/lib/openal-soft/OpenAL32/alAuxEffectSlot.c index b860b2b0e..d04fc4a77 100644 --- a/Engine/lib/openal-soft/OpenAL32/alAuxEffectSlot.c +++ b/Engine/lib/openal-soft/OpenAL32/alAuxEffectSlot.c @@ -27,99 +27,140 @@ #include "AL/alc.h" #include "alMain.h" #include "alAuxEffectSlot.h" -#include "alThunk.h" #include "alError.h" #include "alListener.h" #include "alSource.h" +#include "fpu_modes.h" #include "almalloc.h" -extern inline void LockEffectSlotsRead(ALCcontext *context); -extern inline void UnlockEffectSlotsRead(ALCcontext *context); -extern inline void LockEffectSlotsWrite(ALCcontext *context); -extern inline void UnlockEffectSlotsWrite(ALCcontext *context); -extern inline struct ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id); -extern inline struct ALeffectslot *RemoveEffectSlot(ALCcontext *context, ALuint id); +extern inline void LockEffectSlotList(ALCcontext *context); +extern inline void UnlockEffectSlotList(ALCcontext *context); -static void RemoveEffectSlotList(ALCcontext *Context, ALeffectslot *slot); +static void AddActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *context); +static void RemoveActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *context); -static UIntMap EffectStateFactoryMap; -static inline ALeffectStateFactory *getFactoryByType(ALenum type) +static const struct { + ALenum Type; + EffectStateFactory* (*GetFactory)(void); +} FactoryList[] = { + { AL_EFFECT_NULL, NullStateFactory_getFactory }, + { AL_EFFECT_EAXREVERB, ReverbStateFactory_getFactory }, + { AL_EFFECT_REVERB, ReverbStateFactory_getFactory }, + { AL_EFFECT_CHORUS, ChorusStateFactory_getFactory }, + { AL_EFFECT_COMPRESSOR, CompressorStateFactory_getFactory }, + { AL_EFFECT_DISTORTION, DistortionStateFactory_getFactory }, + { AL_EFFECT_ECHO, EchoStateFactory_getFactory }, + { AL_EFFECT_EQUALIZER, EqualizerStateFactory_getFactory }, + { AL_EFFECT_FLANGER, FlangerStateFactory_getFactory }, + { AL_EFFECT_RING_MODULATOR, ModulatorStateFactory_getFactory }, + { AL_EFFECT_PITCH_SHIFTER, PshifterStateFactory_getFactory}, + { AL_EFFECT_DEDICATED_DIALOGUE, DedicatedStateFactory_getFactory }, + { AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT, DedicatedStateFactory_getFactory } +}; + +static inline EffectStateFactory *getFactoryByType(ALenum type) { - ALeffectStateFactory* (*getFactory)(void) = LookupUIntMapKey(&EffectStateFactoryMap, type); - if(getFactory != NULL) - return getFactory(); + size_t i; + for(i = 0;i < COUNTOF(FactoryList);i++) + { + if(FactoryList[i].Type == type) + return FactoryList[i].GetFactory(); + } return NULL; } static void ALeffectState_IncRef(ALeffectState *state); -static void ALeffectState_DecRef(ALeffectState *state); + + +static inline ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id) +{ + id--; + if(UNLIKELY(id >= VECTOR_SIZE(context->EffectSlotList))) + return NULL; + return VECTOR_ELEM(context->EffectSlotList, id); +} + +static inline ALeffect *LookupEffect(ALCdevice *device, ALuint id) +{ + EffectSubList *sublist; + ALuint lidx = (id-1) >> 6; + ALsizei slidx = (id-1) & 0x3f; + + if(UNLIKELY(lidx >= VECTOR_SIZE(device->EffectList))) + return NULL; + sublist = &VECTOR_ELEM(device->EffectList, lidx); + if(UNLIKELY(sublist->FreeMask & (U64(1)<Effects + slidx; +} + #define DO_UPDATEPROPS() do { \ if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) \ - UpdateEffectSlotProps(slot); \ + UpdateEffectSlotProps(slot, context); \ else \ - slot->NeedsUpdate = AL_TRUE; \ + ATOMIC_FLAG_CLEAR(&slot->PropsClean, almemory_order_release); \ } while(0) AL_API ALvoid AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots) { + ALCdevice *device; ALCcontext *context; - ALeffectslot *first, *last; ALsizei cur; - ALenum err; context = GetContextRef(); if(!context) return; if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Generating %d effect slots", n); + if(n == 0) goto done; - first = last = NULL; + LockEffectSlotList(context); + device = context->Device; + if(device->AuxiliaryEffectSlotMax - VECTOR_SIZE(context->EffectSlotList) < (ALuint)n) + { + UnlockEffectSlotList(context); + SETERR_GOTO(context, AL_OUT_OF_MEMORY, done, "Exceeding %u auxiliary effect slot limit", + device->AuxiliaryEffectSlotMax); + } for(cur = 0;cur < n;cur++) { - ALeffectslot *slot = al_calloc(16, sizeof(ALeffectslot)); - err = AL_OUT_OF_MEMORY; + ALeffectslotPtr *iter = VECTOR_BEGIN(context->EffectSlotList); + ALeffectslotPtr *end = VECTOR_END(context->EffectSlotList); + ALeffectslot *slot = NULL; + ALenum err = AL_OUT_OF_MEMORY; + + for(;iter != end;iter++) + { + if(!*iter) + break; + } + if(iter == end) + { + VECTOR_PUSH_BACK(context->EffectSlotList, NULL); + iter = &VECTOR_BACK(context->EffectSlotList); + } + slot = al_calloc(16, sizeof(ALeffectslot)); if(!slot || (err=InitEffectSlot(slot)) != AL_NO_ERROR) { al_free(slot); - alDeleteAuxiliaryEffectSlots(cur, effectslots); - SET_ERROR_AND_GOTO(context, err, done); - } - - err = NewThunkEntry(&slot->id); - if(err == AL_NO_ERROR) - err = InsertUIntMapEntry(&context->EffectSlotMap, slot->id, slot); - if(err != AL_NO_ERROR) - { - FreeThunkEntry(slot->id); - ALeffectState_DecRef(slot->Effect.State); - if(slot->Params.EffectState) - ALeffectState_DecRef(slot->Params.EffectState); - al_free(slot); + UnlockEffectSlotList(context); alDeleteAuxiliaryEffectSlots(cur, effectslots); - SET_ERROR_AND_GOTO(context, err, done); + SETERR_GOTO(context, err, done, "Effect slot object allocation failed"); } - aluInitEffectPanning(slot); - if(!first) first = slot; - if(last) ATOMIC_STORE(&last->next, slot, almemory_order_relaxed); - last = slot; + slot->id = (iter - VECTOR_BEGIN(context->EffectSlotList)) + 1; + *iter = slot; effectslots[cur] = slot->id; } - if(last != NULL) - { - ALeffectslot *root = ATOMIC_LOAD(&context->ActiveAuxSlotList); - do { - ATOMIC_STORE(&last->next, root, almemory_order_relaxed); - } while(!ATOMIC_COMPARE_EXCHANGE_WEAK(ALeffectslot*, &context->ActiveAuxSlotList, - &root, first)); - } + AddActiveEffectSlots(effectslots, n, context); + UnlockEffectSlotList(context); done: ALCcontext_DecRef(context); @@ -134,25 +175,29 @@ AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint * context = GetContextRef(); if(!context) return; - LockEffectSlotsWrite(context); + LockEffectSlotList(context); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Deleting %d effect slots", n); + if(n == 0) goto done; + for(i = 0;i < n;i++) { if((slot=LookupEffectSlot(context, effectslots[i])) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", + effectslots[i]); if(ReadRef(&slot->ref) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Deleting in-use effect slot %u", + effectslots[i]); } // All effectslots are valid + RemoveActiveEffectSlots(effectslots, n, context); for(i = 0;i < n;i++) { - if((slot=RemoveEffectSlot(context, effectslots[i])) == NULL) + if((slot=LookupEffectSlot(context, effectslots[i])) == NULL) continue; - FreeThunkEntry(slot->id); + VECTOR_ELEM(context->EffectSlotList, effectslots[i]-1) = NULL; - RemoveEffectSlotList(context, slot); DeinitEffectSlot(slot); memset(slot, 0, sizeof(*slot)); @@ -160,7 +205,7 @@ AL_API ALvoid AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint * } done: - UnlockEffectSlotsWrite(context); + UnlockEffectSlotList(context); ALCcontext_DecRef(context); } @@ -172,9 +217,9 @@ AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot) context = GetContextRef(); if(!context) return AL_FALSE; - LockEffectSlotsRead(context); + LockEffectSlotList(context); ret = (LookupEffectSlot(context, effectslot) ? AL_TRUE : AL_FALSE); - UnlockEffectSlotsRead(context); + UnlockEffectSlotList(context); ALCcontext_DecRef(context); @@ -192,43 +237,45 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); - LockEffectSlotsRead(context); + almtx_lock(&context->PropLock); + LockEffectSlotList(context); if((slot=LookupEffectSlot(context, effectslot)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot); switch(param) { case AL_EFFECTSLOT_EFFECT: device = context->Device; - LockEffectsRead(device); + LockEffectList(device); effect = (value ? LookupEffect(device, value) : NULL); if(!(value == 0 || effect != NULL)) { - UnlockEffectsRead(device); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + UnlockEffectList(device); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Invalid effect ID %u", value); } - err = InitializeEffect(device, slot, effect); - UnlockEffectsRead(device); + err = InitializeEffect(context, slot, effect); + UnlockEffectList(device); if(err != AL_NO_ERROR) - SET_ERROR_AND_GOTO(context, err, done); + SETERR_GOTO(context, err, done, "Effect initialization failed"); break; case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: if(!(value == AL_TRUE || value == AL_FALSE)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, + "Effect slot auxiliary send auto out of range"); slot->AuxSendAuto = value; break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + SETERR_GOTO(context, AL_INVALID_ENUM, done, "Invalid effect slot integer property 0x%04x", + param); } DO_UPDATEPROPS(); done: - UnlockEffectSlotsRead(context); - WriteUnlock(&context->PropLock); + UnlockEffectSlotList(context); + almtx_unlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -247,17 +294,18 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotiv(ALuint effectslot, ALenum para context = GetContextRef(); if(!context) return; - LockEffectSlotsRead(context); + LockEffectSlotList(context); if(LookupEffectSlot(context, effectslot) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid effect slot integer-vector property 0x%04x", + param); } done: - UnlockEffectSlotsRead(context); + UnlockEffectSlotList(context); ALCcontext_DecRef(context); } @@ -269,26 +317,27 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); - LockEffectSlotsRead(context); + almtx_lock(&context->PropLock); + LockEffectSlotList(context); if((slot=LookupEffectSlot(context, effectslot)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot); switch(param) { case AL_EFFECTSLOT_GAIN: if(!(value >= 0.0f && value <= 1.0f)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Effect slot gain out of range"); slot->Gain = value; break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + SETERR_GOTO(context, AL_INVALID_ENUM, done, "Invalid effect slot float property 0x%04x", + param); } DO_UPDATEPROPS(); done: - UnlockEffectSlotsRead(context); - WriteUnlock(&context->PropLock); + UnlockEffectSlotList(context); + almtx_unlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -306,17 +355,18 @@ AL_API ALvoid AL_APIENTRY alAuxiliaryEffectSlotfv(ALuint effectslot, ALenum para context = GetContextRef(); if(!context) return; - LockEffectSlotsRead(context); + LockEffectSlotList(context); if(LookupEffectSlot(context, effectslot) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid effect slot float-vector property 0x%04x", + param); } done: - UnlockEffectSlotsRead(context); + UnlockEffectSlotList(context); ALCcontext_DecRef(context); } @@ -328,9 +378,9 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum pa context = GetContextRef(); if(!context) return; - LockEffectSlotsRead(context); + LockEffectSlotList(context); if((slot=LookupEffectSlot(context, effectslot)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot); switch(param) { case AL_EFFECTSLOT_AUXILIARY_SEND_AUTO: @@ -338,11 +388,11 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum pa break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid effect slot integer property 0x%04x", param); } done: - UnlockEffectSlotsRead(context); + UnlockEffectSlotList(context); ALCcontext_DecRef(context); } @@ -361,17 +411,18 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotiv(ALuint effectslot, ALenum p context = GetContextRef(); if(!context) return; - LockEffectSlotsRead(context); + LockEffectSlotList(context); if(LookupEffectSlot(context, effectslot) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid effect slot integer-vector property 0x%04x", + param); } done: - UnlockEffectSlotsRead(context); + UnlockEffectSlotList(context); ALCcontext_DecRef(context); } @@ -383,9 +434,9 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum pa context = GetContextRef(); if(!context) return; - LockEffectSlotsRead(context); + LockEffectSlotList(context); if((slot=LookupEffectSlot(context, effectslot)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot); switch(param) { case AL_EFFECTSLOT_GAIN: @@ -393,11 +444,11 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum pa break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid effect slot float property 0x%04x", param); } done: - UnlockEffectSlotsRead(context); + UnlockEffectSlotList(context); ALCcontext_DecRef(context); } @@ -415,76 +466,32 @@ AL_API ALvoid AL_APIENTRY alGetAuxiliaryEffectSlotfv(ALuint effectslot, ALenum p context = GetContextRef(); if(!context) return; - LockEffectSlotsRead(context); + LockEffectSlotList(context); if(LookupEffectSlot(context, effectslot) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect slot ID %u", effectslot); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid effect slot float-vector property 0x%04x", + param); } done: - UnlockEffectSlotsRead(context); + UnlockEffectSlotList(context); ALCcontext_DecRef(context); } -static void RemoveEffectSlotList(ALCcontext *context, ALeffectslot *slot) -{ - ALCdevice *device = context->Device; - ALeffectslot *root, *next; - - root = slot; - next = ATOMIC_LOAD(&slot->next); - if(!ATOMIC_COMPARE_EXCHANGE_STRONG(ALeffectslot*, &context->ActiveAuxSlotList, &root, next)) - { - ALeffectslot *cur; - do { - cur = root; - root = slot; - } while(!ATOMIC_COMPARE_EXCHANGE_STRONG(ALeffectslot*, &cur->next, &root, next)); - } - /* Wait for any mix that may be using these effect slots to finish. */ - while((ReadRef(&device->MixCount)&1) != 0) - althrd_yield(); -} - - -void InitEffectFactoryMap(void) -{ - InitUIntMap(&EffectStateFactoryMap, ~0); - - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_NULL, ALnullStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_EAXREVERB, ALreverbStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_REVERB, ALreverbStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_CHORUS, ALchorusStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_COMPRESSOR, ALcompressorStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_DISTORTION, ALdistortionStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_ECHO, ALechoStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_EQUALIZER, ALequalizerStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_FLANGER, ALflangerStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_RING_MODULATOR, ALmodulatorStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_DEDICATED_DIALOGUE, ALdedicatedStateFactory_getFactory); - InsertUIntMapEntry(&EffectStateFactoryMap, AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT, ALdedicatedStateFactory_getFactory); -} - -void DeinitEffectFactoryMap(void) -{ - ResetUIntMap(&EffectStateFactoryMap); -} - - -ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *effect) +ALenum InitializeEffect(ALCcontext *Context, ALeffectslot *EffectSlot, ALeffect *effect) { + ALCdevice *Device = Context->Device; ALenum newtype = (effect ? effect->type : AL_EFFECT_NULL); struct ALeffectslotProps *props; ALeffectState *State; if(newtype != EffectSlot->Effect.Type) { - ALeffectStateFactory *factory; - FPUCtl oldMode; + EffectStateFactory *factory; factory = getFactoryByType(newtype); if(!factory) @@ -492,22 +499,22 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e ERR("Failed to find factory for effect type 0x%04x\n", newtype); return AL_INVALID_ENUM; } - State = V0(factory,create)(); + State = EffectStateFactory_create(factory); if(!State) return AL_OUT_OF_MEMORY; - SetMixerFPUMode(&oldMode); + START_MIXER_MODE(); almtx_lock(&Device->BackendLock); State->OutBuffer = Device->Dry.Buffer; State->OutChannels = Device->Dry.NumChannels; if(V(State,deviceUpdate)(Device) == AL_FALSE) { almtx_unlock(&Device->BackendLock); - RestoreFPUMode(&oldMode); + LEAVE_MIXER_MODE(); ALeffectState_DecRef(State); return AL_OUT_OF_MEMORY; } almtx_unlock(&Device->BackendLock); - RestoreFPUMode(&oldMode); + END_MIXER_MODE(); if(!effect) { @@ -527,11 +534,12 @@ ALenum InitializeEffect(ALCdevice *Device, ALeffectslot *EffectSlot, ALeffect *e EffectSlot->Effect.Props = effect->Props; /* Remove state references from old effect slot property updates. */ - props = ATOMIC_LOAD(&EffectSlot->FreeList); + props = ATOMIC_LOAD_SEQ(&Context->FreeEffectslotProps); while(props) { - State = ATOMIC_EXCHANGE(ALeffectState*, &props->State, NULL, almemory_order_relaxed); - if(State) ALeffectState_DecRef(State); + if(props->State) + ALeffectState_DecRef(props->State); + props->State = NULL; props = ATOMIC_LOAD(&props->next, almemory_order_relaxed); } @@ -546,7 +554,7 @@ static void ALeffectState_IncRef(ALeffectState *state) TRACEREF("%p increasing refcount to %u\n", state, ref); } -static void ALeffectState_DecRef(ALeffectState *state) +void ALeffectState_DecRef(ALeffectState *state) { uint ref; ref = DecrementRef(&state->Ref); @@ -568,23 +576,110 @@ void ALeffectState_Destruct(ALeffectState *UNUSED(state)) } +static void AddActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *context) +{ + struct ALeffectslotArray *curarray = ATOMIC_LOAD(&context->ActiveAuxSlots, + almemory_order_acquire); + struct ALeffectslotArray *newarray = NULL; + ALsizei newcount = curarray->count + count; + ALCdevice *device = context->Device; + ALsizei i, j; + + /* Insert the new effect slots into the head of the array, followed by the + * existing ones. + */ + newarray = al_calloc(DEF_ALIGN, FAM_SIZE(struct ALeffectslotArray, slot, newcount)); + newarray->count = newcount; + for(i = 0;i < count;i++) + newarray->slot[i] = LookupEffectSlot(context, slotids[i]); + for(j = 0;i < newcount;) + newarray->slot[i++] = curarray->slot[j++]; + /* Remove any duplicates (first instance of each will be kept). */ + for(i = 1;i < newcount;i++) + { + for(j = i;j != 0;) + { + if(UNLIKELY(newarray->slot[i] == newarray->slot[--j])) + { + newcount--; + for(j = i;j < newcount;j++) + newarray->slot[j] = newarray->slot[j+1]; + i--; + break; + } + } + } + + /* Reallocate newarray if the new size ended up smaller from duplicate + * removal. + */ + if(UNLIKELY(newcount < newarray->count)) + { + struct ALeffectslotArray *tmpnewarray = al_calloc(DEF_ALIGN, + FAM_SIZE(struct ALeffectslotArray, slot, newcount)); + memcpy(tmpnewarray, newarray, FAM_SIZE(struct ALeffectslotArray, slot, newcount)); + al_free(newarray); + newarray = tmpnewarray; + newarray->count = newcount; + } + + curarray = ATOMIC_EXCHANGE_PTR(&context->ActiveAuxSlots, newarray, almemory_order_acq_rel); + while((ATOMIC_LOAD(&device->MixCount, almemory_order_acquire)&1)) + althrd_yield(); + al_free(curarray); +} + +static void RemoveActiveEffectSlots(const ALuint *slotids, ALsizei count, ALCcontext *context) +{ + struct ALeffectslotArray *curarray = ATOMIC_LOAD(&context->ActiveAuxSlots, + almemory_order_acquire); + struct ALeffectslotArray *newarray = NULL; + ALCdevice *device = context->Device; + ALsizei i, j; + + /* Don't shrink the allocated array size since we don't know how many (if + * any) of the effect slots to remove are in the array. + */ + newarray = al_calloc(DEF_ALIGN, FAM_SIZE(struct ALeffectslotArray, slot, curarray->count)); + newarray->count = 0; + for(i = 0;i < curarray->count;i++) + { + /* Insert this slot into the new array only if it's not one to remove. */ + ALeffectslot *slot = curarray->slot[i]; + for(j = count;j != 0;) + { + if(slot->id == slotids[--j]) + goto skip_ins; + } + newarray->slot[newarray->count++] = slot; + skip_ins: ; + } + + /* TODO: Could reallocate newarray now that we know it's needed size. */ + + curarray = ATOMIC_EXCHANGE_PTR(&context->ActiveAuxSlots, newarray, almemory_order_acq_rel); + while((ATOMIC_LOAD(&device->MixCount, almemory_order_acquire)&1)) + althrd_yield(); + al_free(curarray); +} + + ALenum InitEffectSlot(ALeffectslot *slot) { - ALeffectStateFactory *factory; + EffectStateFactory *factory; slot->Effect.Type = AL_EFFECT_NULL; factory = getFactoryByType(AL_EFFECT_NULL); - if(!(slot->Effect.State=V0(factory,create)())) - return AL_OUT_OF_MEMORY; + slot->Effect.State = EffectStateFactory_create(factory); + if(!slot->Effect.State) return AL_OUT_OF_MEMORY; - slot->NeedsUpdate = AL_FALSE; slot->Gain = 1.0; slot->AuxSendAuto = AL_TRUE; + ATOMIC_FLAG_TEST_AND_SET(&slot->PropsClean, almemory_order_relaxed); InitRef(&slot->ref, 0); ATOMIC_INIT(&slot->Update, NULL); - ATOMIC_INIT(&slot->FreeList, NULL); slot->Params.Gain = 1.0f; slot->Params.AuxSendAuto = AL_TRUE; @@ -592,52 +687,38 @@ ALenum InitEffectSlot(ALeffectslot *slot) slot->Params.EffectState = slot->Effect.State; slot->Params.RoomRolloff = 0.0f; slot->Params.DecayTime = 0.0f; + slot->Params.DecayLFRatio = 0.0f; + slot->Params.DecayHFRatio = 0.0f; + slot->Params.DecayHFLimit = AL_FALSE; slot->Params.AirAbsorptionGainHF = 1.0f; - ATOMIC_INIT(&slot->next, NULL); - return AL_NO_ERROR; } void DeinitEffectSlot(ALeffectslot *slot) { struct ALeffectslotProps *props; - ALeffectState *state; - size_t count = 0; - props = ATOMIC_LOAD(&slot->Update); + props = ATOMIC_LOAD_SEQ(&slot->Update); if(props) { - state = ATOMIC_LOAD(&props->State, almemory_order_relaxed); - if(state) ALeffectState_DecRef(state); + if(props->State) ALeffectState_DecRef(props->State); TRACE("Freed unapplied AuxiliaryEffectSlot update %p\n", props); al_free(props); } - props = ATOMIC_LOAD(&slot->FreeList, almemory_order_relaxed); - while(props) - { - struct ALeffectslotProps *next; - state = ATOMIC_LOAD(&props->State, almemory_order_relaxed); - next = ATOMIC_LOAD(&props->next, almemory_order_relaxed); - if(state) ALeffectState_DecRef(state); - al_free(props); - props = next; - ++count; - } - TRACE("Freed "SZFMT" AuxiliaryEffectSlot property object%s\n", count, (count==1)?"":"s"); ALeffectState_DecRef(slot->Effect.State); if(slot->Params.EffectState) ALeffectState_DecRef(slot->Params.EffectState); } -void UpdateEffectSlotProps(ALeffectslot *slot) +void UpdateEffectSlotProps(ALeffectslot *slot, ALCcontext *context) { struct ALeffectslotProps *props; ALeffectState *oldstate; /* Get an unused property container, or allocate a new one as needed. */ - props = ATOMIC_LOAD(&slot->FreeList, almemory_order_relaxed); + props = ATOMIC_LOAD(&context->FreeEffectslotProps, almemory_order_relaxed); if(!props) props = al_calloc(16, sizeof(*props)); else @@ -645,37 +726,31 @@ void UpdateEffectSlotProps(ALeffectslot *slot) struct ALeffectslotProps *next; do { next = ATOMIC_LOAD(&props->next, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALeffectslotProps*, - &slot->FreeList, &props, next, almemory_order_seq_cst, - almemory_order_consume) == 0); + } while(ATOMIC_COMPARE_EXCHANGE_PTR_WEAK(&context->FreeEffectslotProps, &props, next, + almemory_order_seq_cst, almemory_order_acquire) == 0); } /* Copy in current property values. */ - ATOMIC_STORE(&props->Gain, slot->Gain, almemory_order_relaxed); - ATOMIC_STORE(&props->AuxSendAuto, slot->AuxSendAuto, almemory_order_relaxed); + props->Gain = slot->Gain; + props->AuxSendAuto = slot->AuxSendAuto; - ATOMIC_STORE(&props->Type, slot->Effect.Type, almemory_order_relaxed); + props->Type = slot->Effect.Type; props->Props = slot->Effect.Props; /* Swap out any stale effect state object there may be in the container, to * delete it. */ ALeffectState_IncRef(slot->Effect.State); - oldstate = ATOMIC_EXCHANGE(ALeffectState*, &props->State, slot->Effect.State, - almemory_order_relaxed); + oldstate = props->State; + props->State = slot->Effect.State; /* Set the new container for updating internal parameters. */ - props = ATOMIC_EXCHANGE(struct ALeffectslotProps*, &slot->Update, props, - almemory_order_acq_rel); + props = ATOMIC_EXCHANGE_PTR(&slot->Update, props, almemory_order_acq_rel); if(props) { /* If there was an unused update container, put it back in the * freelist. */ - struct ALeffectslotProps *first = ATOMIC_LOAD(&slot->FreeList); - do { - ATOMIC_STORE(&props->next, first, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALeffectslotProps*, - &slot->FreeList, &first, props) == 0); + ATOMIC_REPLACE_HEAD(struct ALeffectslotProps*, &context->FreeEffectslotProps, props); } if(oldstate) @@ -684,32 +759,38 @@ void UpdateEffectSlotProps(ALeffectslot *slot) void UpdateAllEffectSlotProps(ALCcontext *context) { - ALeffectslot *slot; + struct ALeffectslotArray *auxslots; + ALsizei i; - LockEffectSlotsRead(context); - slot = ATOMIC_LOAD(&context->ActiveAuxSlotList); - while(slot) + LockEffectSlotList(context); + auxslots = ATOMIC_LOAD(&context->ActiveAuxSlots, almemory_order_acquire); + for(i = 0;i < auxslots->count;i++) { - if(slot->NeedsUpdate) - UpdateEffectSlotProps(slot); - slot->NeedsUpdate = AL_FALSE; - slot = ATOMIC_LOAD(&slot->next, almemory_order_relaxed); + ALeffectslot *slot = auxslots->slot[i]; + if(!ATOMIC_FLAG_TEST_AND_SET(&slot->PropsClean, almemory_order_acq_rel)) + UpdateEffectSlotProps(slot, context); } - UnlockEffectSlotsRead(context); + UnlockEffectSlotList(context); } -ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *Context) +ALvoid ReleaseALAuxiliaryEffectSlots(ALCcontext *context) { - ALsizei pos; - for(pos = 0;pos < Context->EffectSlotMap.size;pos++) + ALeffectslotPtr *iter = VECTOR_BEGIN(context->EffectSlotList); + ALeffectslotPtr *end = VECTOR_END(context->EffectSlotList); + size_t leftover = 0; + + for(;iter != end;iter++) { - ALeffectslot *temp = Context->EffectSlotMap.values[pos]; - Context->EffectSlotMap.values[pos] = NULL; + ALeffectslot *slot = *iter; + if(!slot) continue; + *iter = NULL; - DeinitEffectSlot(temp); + DeinitEffectSlot(slot); - FreeThunkEntry(temp->id); - memset(temp, 0, sizeof(ALeffectslot)); - al_free(temp); + memset(slot, 0, sizeof(*slot)); + al_free(slot); + ++leftover; } + if(leftover > 0) + WARN("(%p) Deleted "SZFMT" AuxiliaryEffectSlot%s\n", context, leftover, (leftover==1)?"":"s"); } diff --git a/Engine/lib/openal-soft/OpenAL32/alBuffer.c b/Engine/lib/openal-soft/OpenAL32/alBuffer.c index 193cfeaa9..ed7124348 100644 --- a/Engine/lib/openal-soft/OpenAL32/alBuffer.c +++ b/Engine/lib/openal-soft/OpenAL32/alBuffer.c @@ -32,24 +32,41 @@ #include "alu.h" #include "alError.h" #include "alBuffer.h" -#include "alThunk.h" #include "sample_cvt.h" -extern inline void LockBuffersRead(ALCdevice *device); -extern inline void UnlockBuffersRead(ALCdevice *device); -extern inline void LockBuffersWrite(ALCdevice *device); -extern inline void UnlockBuffersWrite(ALCdevice *device); -extern inline struct ALbuffer *LookupBuffer(ALCdevice *device, ALuint id); -extern inline struct ALbuffer *RemoveBuffer(ALCdevice *device, ALuint id); -extern inline ALuint FrameSizeFromUserFmt(enum UserFmtChannels chans, enum UserFmtType type); -extern inline ALuint FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type); +extern inline void LockBufferList(ALCdevice *device); +extern inline void UnlockBufferList(ALCdevice *device); +extern inline ALsizei FrameSizeFromUserFmt(enum UserFmtChannels chans, enum UserFmtType type); +extern inline ALsizei FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type); -static ALboolean IsValidType(ALenum type); -static ALboolean IsValidChannels(ALenum channels); +static ALbuffer *AllocBuffer(ALCcontext *context); +static void FreeBuffer(ALCdevice *device, ALbuffer *buffer); +static const ALchar *NameFromUserFmtType(enum UserFmtType type); +static void LoadData(ALCcontext *context, ALbuffer *buffer, ALuint freq, ALsizei size, + enum UserFmtChannels SrcChannels, enum UserFmtType SrcType, + const ALvoid *data, ALbitfieldSOFT access); static ALboolean DecomposeUserFormat(ALenum format, enum UserFmtChannels *chans, enum UserFmtType *type); -static ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum FmtType *type); -static ALboolean SanitizeAlignment(enum UserFmtType type, ALsizei *align); +static ALsizei SanitizeAlignment(enum UserFmtType type, ALsizei align); + +static inline ALbuffer *LookupBuffer(ALCdevice *device, ALuint id) +{ + BufferSubList *sublist; + ALuint lidx = (id-1) >> 6; + ALsizei slidx = (id-1) & 0x3f; + + if(UNLIKELY(lidx >= VECTOR_SIZE(device->BufferList))) + return NULL; + sublist = &VECTOR_ELEM(device->BufferList, lidx); + if(UNLIKELY(sublist->FreeMask & (U64(1)<Buffers + slidx; +} + + +#define INVALID_STORAGE_MASK ~(AL_MAP_READ_BIT_SOFT | AL_MAP_WRITE_BIT_SOFT | AL_PRESERVE_DATA_BIT_SOFT | AL_MAP_PERSISTENT_BIT_SOFT) +#define MAP_READ_WRITE_FLAGS (AL_MAP_READ_BIT_SOFT | AL_MAP_WRITE_BIT_SOFT) +#define INVALID_MAP_FLAGS ~(AL_MAP_READ_BIT_SOFT | AL_MAP_WRITE_BIT_SOFT | AL_MAP_PERSISTENT_BIT_SOFT) AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers) @@ -61,11 +78,10 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers) if(!context) return; if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - for(cur = 0;cur < n;cur++) + alSetError(context, AL_INVALID_VALUE, "Generating %d buffers", n); + else for(cur = 0;cur < n;cur++) { - ALbuffer *buffer = NewBuffer(context); + ALbuffer *buffer = AllocBuffer(context); if(!buffer) { alDeleteBuffers(cur, buffers); @@ -75,7 +91,6 @@ AL_API ALvoid AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers) buffers[cur] = buffer->id; } -done: ALCcontext_DecRef(context); } @@ -91,30 +106,38 @@ AL_API ALvoid AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers) device = context->Device; - LockBuffersWrite(device); - if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + LockBufferList(device); + if(UNLIKELY(n < 0)) + { + alSetError(context, AL_INVALID_VALUE, "Deleting %d buffers", n); + goto done; + } for(i = 0;i < n;i++) { if(!buffers[i]) continue; - /* Check for valid Buffer ID */ + /* Check for valid Buffer ID, and make sure it's not in use. */ if((ALBuf=LookupBuffer(device, buffers[i])) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + { + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffers[i]); + goto done; + } if(ReadRef(&ALBuf->ref) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); + { + alSetError(context, AL_INVALID_OPERATION, "Deleting in-use buffer %u", buffers[i]); + goto done; + } } - for(i = 0;i < n;i++) { if((ALBuf=LookupBuffer(device, buffers[i])) != NULL) - DeleteBuffer(device, ALBuf); + FreeBuffer(device, ALBuf); } done: - UnlockBuffersWrite(device); + UnlockBufferList(device); ALCcontext_DecRef(context); } @@ -126,10 +149,10 @@ AL_API ALboolean AL_APIENTRY alIsBuffer(ALuint buffer) context = GetContextRef(); if(!context) return AL_FALSE; - LockBuffersRead(context->Device); + LockBufferList(context->Device); ret = ((!buffer || LookupBuffer(context->Device, buffer)) ? AL_TRUE : AL_FALSE); - UnlockBuffersRead(context->Device); + UnlockBufferList(context->Device); ALCcontext_DecRef(context); @@ -138,399 +161,297 @@ AL_API ALboolean AL_APIENTRY alIsBuffer(ALuint buffer) AL_API ALvoid AL_APIENTRY alBufferData(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei freq) +{ alBufferStorageSOFT(buffer, format, data, size, freq, 0); } + +AL_API void AL_APIENTRY alBufferStorageSOFT(ALuint buffer, ALenum format, const ALvoid *data, ALsizei size, ALsizei freq, ALbitfieldSOFT flags) { enum UserFmtChannels srcchannels = UserFmtMono; - enum UserFmtType srctype = UserFmtByte; + enum UserFmtType srctype = UserFmtUByte; ALCdevice *device; ALCcontext *context; ALbuffer *albuf; - ALenum newformat = AL_NONE; - ALuint framesize; - ALsizei align; - ALenum err; context = GetContextRef(); if(!context) return; device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - if(!(size >= 0 && freq > 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - if(DecomposeUserFormat(format, &srcchannels, &srctype) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + LockBufferList(device); + if(UNLIKELY((albuf=LookupBuffer(device, buffer)) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(size < 0)) + alSetError(context, AL_INVALID_VALUE, "Negative storage size %d", size); + else if(UNLIKELY(freq < 1)) + alSetError(context, AL_INVALID_VALUE, "Invalid sample rate %d", freq); + else if(UNLIKELY((flags&INVALID_STORAGE_MASK) != 0)) + alSetError(context, AL_INVALID_VALUE, "Invalid storage flags 0x%x", + flags&INVALID_STORAGE_MASK); + else if(UNLIKELY((flags&AL_MAP_PERSISTENT_BIT_SOFT) && !(flags&MAP_READ_WRITE_FLAGS))) + alSetError(context, AL_INVALID_VALUE, + "Declaring persistently mapped storage without read or write access"); + else if(UNLIKELY(DecomposeUserFormat(format, &srcchannels, &srctype) == AL_FALSE)) + alSetError(context, AL_INVALID_ENUM, "Invalid format 0x%04x", format); + else + LoadData(context, albuf, freq, size, srcchannels, srctype, data, flags); - align = ATOMIC_LOAD(&albuf->UnpackAlign); - if(SanitizeAlignment(srctype, &align) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(srctype) + UnlockBufferList(device); + ALCcontext_DecRef(context); +} + +AL_API void* AL_APIENTRY alMapBufferSOFT(ALuint buffer, ALsizei offset, ALsizei length, ALbitfieldSOFT access) +{ + void *retval = NULL; + ALCdevice *device; + ALCcontext *context; + ALbuffer *albuf; + + context = GetContextRef(); + if(!context) return retval; + + device = context->Device; + LockBufferList(device); + if(UNLIKELY((albuf=LookupBuffer(device, buffer)) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY((access&INVALID_MAP_FLAGS) != 0)) + alSetError(context, AL_INVALID_VALUE, "Invalid map flags 0x%x", access&INVALID_MAP_FLAGS); + else if(UNLIKELY(!(access&MAP_READ_WRITE_FLAGS))) + alSetError(context, AL_INVALID_VALUE, "Mapping buffer %u without read or write access", + buffer); + else { - case UserFmtByte: - case UserFmtUByte: - case UserFmtShort: - case UserFmtUShort: - case UserFmtFloat: - framesize = FrameSizeFromUserFmt(srcchannels, srctype) * align; - if((size%framesize) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - err = LoadData(albuf, freq, format, size/framesize*align, - srcchannels, srctype, data, align, AL_TRUE); - if(err != AL_NO_ERROR) - SET_ERROR_AND_GOTO(context, err, done); - break; - - case UserFmtInt: - case UserFmtUInt: - case UserFmtByte3: - case UserFmtUByte3: - case UserFmtDouble: - framesize = FrameSizeFromUserFmt(srcchannels, srctype) * align; - if((size%framesize) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - switch(srcchannels) - { - case UserFmtMono: newformat = AL_FORMAT_MONO_FLOAT32; break; - case UserFmtStereo: newformat = AL_FORMAT_STEREO_FLOAT32; break; - case UserFmtRear: newformat = AL_FORMAT_REAR32; break; - case UserFmtQuad: newformat = AL_FORMAT_QUAD32; break; - case UserFmtX51: newformat = AL_FORMAT_51CHN32; break; - case UserFmtX61: newformat = AL_FORMAT_61CHN32; break; - case UserFmtX71: newformat = AL_FORMAT_71CHN32; break; - case UserFmtBFormat2D: newformat = AL_FORMAT_BFORMAT2D_FLOAT32; break; - case UserFmtBFormat3D: newformat = AL_FORMAT_BFORMAT3D_FLOAT32; break; - } - err = LoadData(albuf, freq, newformat, size/framesize*align, - srcchannels, srctype, data, align, AL_TRUE); - if(err != AL_NO_ERROR) - SET_ERROR_AND_GOTO(context, err, done); - break; - - case UserFmtMulaw: - case UserFmtAlaw: - framesize = FrameSizeFromUserFmt(srcchannels, srctype) * align; - if((size%framesize) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - switch(srcchannels) - { - case UserFmtMono: newformat = AL_FORMAT_MONO16; break; - case UserFmtStereo: newformat = AL_FORMAT_STEREO16; break; - case UserFmtRear: newformat = AL_FORMAT_REAR16; break; - case UserFmtQuad: newformat = AL_FORMAT_QUAD16; break; - case UserFmtX51: newformat = AL_FORMAT_51CHN16; break; - case UserFmtX61: newformat = AL_FORMAT_61CHN16; break; - case UserFmtX71: newformat = AL_FORMAT_71CHN16; break; - case UserFmtBFormat2D: newformat = AL_FORMAT_BFORMAT2D_16; break; - case UserFmtBFormat3D: newformat = AL_FORMAT_BFORMAT3D_16; break; - } - err = LoadData(albuf, freq, newformat, size/framesize*align, - srcchannels, srctype, data, align, AL_TRUE); - if(err != AL_NO_ERROR) - SET_ERROR_AND_GOTO(context, err, done); - break; - - case UserFmtIMA4: - framesize = (align-1)/2 + 4; - framesize *= ChannelsFromUserFmt(srcchannels); - if((size%framesize) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - switch(srcchannels) - { - case UserFmtMono: newformat = AL_FORMAT_MONO16; break; - case UserFmtStereo: newformat = AL_FORMAT_STEREO16; break; - case UserFmtRear: newformat = AL_FORMAT_REAR16; break; - case UserFmtQuad: newformat = AL_FORMAT_QUAD16; break; - case UserFmtX51: newformat = AL_FORMAT_51CHN16; break; - case UserFmtX61: newformat = AL_FORMAT_61CHN16; break; - case UserFmtX71: newformat = AL_FORMAT_71CHN16; break; - case UserFmtBFormat2D: newformat = AL_FORMAT_BFORMAT2D_16; break; - case UserFmtBFormat3D: newformat = AL_FORMAT_BFORMAT3D_16; break; - } - err = LoadData(albuf, freq, newformat, size/framesize*align, - srcchannels, srctype, data, align, AL_TRUE); - if(err != AL_NO_ERROR) - SET_ERROR_AND_GOTO(context, err, done); - break; - - case UserFmtMSADPCM: - framesize = (align-2)/2 + 7; - framesize *= ChannelsFromUserFmt(srcchannels); - if((size%framesize) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - switch(srcchannels) - { - case UserFmtMono: newformat = AL_FORMAT_MONO16; break; - case UserFmtStereo: newformat = AL_FORMAT_STEREO16; break; - case UserFmtRear: newformat = AL_FORMAT_REAR16; break; - case UserFmtQuad: newformat = AL_FORMAT_QUAD16; break; - case UserFmtX51: newformat = AL_FORMAT_51CHN16; break; - case UserFmtX61: newformat = AL_FORMAT_61CHN16; break; - case UserFmtX71: newformat = AL_FORMAT_71CHN16; break; - case UserFmtBFormat2D: newformat = AL_FORMAT_BFORMAT2D_16; break; - case UserFmtBFormat3D: newformat = AL_FORMAT_BFORMAT3D_16; break; - } - err = LoadData(albuf, freq, newformat, size/framesize*align, - srcchannels, srctype, data, align, AL_TRUE); - if(err != AL_NO_ERROR) - SET_ERROR_AND_GOTO(context, err, done); - break; + ALbitfieldSOFT unavailable = (albuf->Access^access) & access; + if(UNLIKELY(ReadRef(&albuf->ref) != 0 && !(access&AL_MAP_PERSISTENT_BIT_SOFT))) + alSetError(context, AL_INVALID_OPERATION, + "Mapping in-use buffer %u without persistent mapping", buffer); + else if(UNLIKELY(albuf->MappedAccess != 0)) + alSetError(context, AL_INVALID_OPERATION, "Mapping already-mapped buffer %u", buffer); + else if(UNLIKELY((unavailable&AL_MAP_READ_BIT_SOFT))) + alSetError(context, AL_INVALID_VALUE, + "Mapping buffer %u for reading without read access", buffer); + else if(UNLIKELY((unavailable&AL_MAP_WRITE_BIT_SOFT))) + alSetError(context, AL_INVALID_VALUE, + "Mapping buffer %u for writing without write access", buffer); + else if(UNLIKELY((unavailable&AL_MAP_PERSISTENT_BIT_SOFT))) + alSetError(context, AL_INVALID_VALUE, + "Mapping buffer %u persistently without persistent access", buffer); + else if(UNLIKELY(offset < 0 || offset >= albuf->OriginalSize || + length <= 0 || length > albuf->OriginalSize - offset)) + alSetError(context, AL_INVALID_VALUE, "Mapping invalid range %d+%d for buffer %u", + offset, length, buffer); + else + { + retval = (ALbyte*)albuf->data + offset; + albuf->MappedAccess = access; + albuf->MappedOffset = offset; + albuf->MappedSize = length; + } } + UnlockBufferList(device); + + ALCcontext_DecRef(context); + return retval; +} + +AL_API void AL_APIENTRY alUnmapBufferSOFT(ALuint buffer) +{ + ALCdevice *device; + ALCcontext *context; + ALbuffer *albuf; + + context = GetContextRef(); + if(!context) return; + + device = context->Device; + LockBufferList(device); + if((albuf=LookupBuffer(device, buffer)) == NULL) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(albuf->MappedAccess == 0) + alSetError(context, AL_INVALID_OPERATION, "Unmapping unmapped buffer %u", buffer); + else + { + albuf->MappedAccess = 0; + albuf->MappedOffset = 0; + albuf->MappedSize = 0; + } + UnlockBufferList(device); + + ALCcontext_DecRef(context); +} + +AL_API void AL_APIENTRY alFlushMappedBufferSOFT(ALuint buffer, ALsizei offset, ALsizei length) +{ + ALCdevice *device; + ALCcontext *context; + ALbuffer *albuf; + + context = GetContextRef(); + if(!context) return; + + device = context->Device; + LockBufferList(device); + if(UNLIKELY((albuf=LookupBuffer(device, buffer)) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(!(albuf->MappedAccess&AL_MAP_WRITE_BIT_SOFT))) + alSetError(context, AL_INVALID_OPERATION, + "Flushing buffer %u while not mapped for writing", buffer); + else if(UNLIKELY(offset < albuf->MappedOffset || + offset >= albuf->MappedOffset+albuf->MappedSize || + length <= 0 || length > albuf->MappedOffset+albuf->MappedSize-offset)) + alSetError(context, AL_INVALID_VALUE, "Flushing invalid range %d+%d on buffer %u", + offset, length, buffer); + else + { + /* FIXME: Need to use some method of double-buffering for the mixer and + * app to hold separate memory, which can be safely transfered + * asynchronously. Currently we just say the app shouldn't write where + * OpenAL's reading, and hope for the best... + */ + ATOMIC_THREAD_FENCE(almemory_order_seq_cst); + } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } AL_API ALvoid AL_APIENTRY alBufferSubDataSOFT(ALuint buffer, ALenum format, const ALvoid *data, ALsizei offset, ALsizei length) { enum UserFmtChannels srcchannels = UserFmtMono; - enum UserFmtType srctype = UserFmtByte; + enum UserFmtType srctype = UserFmtUByte; ALCdevice *device; ALCcontext *context; ALbuffer *albuf; - ALuint byte_align; - ALuint channels; - ALuint bytes; - ALsizei align; context = GetContextRef(); if(!context) return; device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - if(!(length >= 0 && offset >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - if(DecomposeUserFormat(format, &srcchannels, &srctype) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); - - WriteLock(&albuf->lock); - align = ATOMIC_LOAD(&albuf->UnpackAlign); - if(SanitizeAlignment(srctype, &align) == AL_FALSE) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - if(srcchannels != albuf->OriginalChannels || srctype != albuf->OriginalType) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); - } - if(align != albuf->OriginalAlign) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); - } - - if(albuf->OriginalType == UserFmtIMA4) - { - byte_align = (albuf->OriginalAlign-1)/2 + 4; - byte_align *= ChannelsFromUserFmt(albuf->OriginalChannels); - } - else if(albuf->OriginalType == UserFmtMSADPCM) - { - byte_align = (albuf->OriginalAlign-2)/2 + 7; - byte_align *= ChannelsFromUserFmt(albuf->OriginalChannels); - } + LockBufferList(device); + if(UNLIKELY((albuf=LookupBuffer(device, buffer)) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(DecomposeUserFormat(format, &srcchannels, &srctype) == AL_FALSE)) + alSetError(context, AL_INVALID_ENUM, "Invalid format 0x%04x", format); else { - byte_align = albuf->OriginalAlign; - byte_align *= FrameSizeFromUserFmt(albuf->OriginalChannels, - albuf->OriginalType); + ALsizei unpack_align, align; + ALsizei byte_align; + ALsizei frame_size; + ALsizei num_chans; + void *dst; + + unpack_align = ATOMIC_LOAD_SEQ(&albuf->UnpackAlign); + align = SanitizeAlignment(srctype, unpack_align); + if(UNLIKELY(align < 1)) + alSetError(context, AL_INVALID_VALUE, "Invalid unpack alignment %d", unpack_align); + else if(UNLIKELY((long)srcchannels != (long)albuf->FmtChannels || + srctype != albuf->OriginalType)) + alSetError(context, AL_INVALID_ENUM, "Unpacking data with mismatched format"); + else if(UNLIKELY(align != albuf->OriginalAlign)) + alSetError(context, AL_INVALID_VALUE, + "Unpacking data with alignment %u does not match original alignment %u", + align, albuf->OriginalAlign); + else if(UNLIKELY(albuf->MappedAccess != 0)) + alSetError(context, AL_INVALID_OPERATION, "Unpacking data into mapped buffer %u", + buffer); + else + { + num_chans = ChannelsFromFmt(albuf->FmtChannels); + frame_size = num_chans * BytesFromFmt(albuf->FmtType); + if(albuf->OriginalType == UserFmtIMA4) + byte_align = ((align-1)/2 + 4) * num_chans; + else if(albuf->OriginalType == UserFmtMSADPCM) + byte_align = ((align-2)/2 + 7) * num_chans; + else + byte_align = align * frame_size; + + if(UNLIKELY(offset < 0 || length < 0 || offset > albuf->OriginalSize || + length > albuf->OriginalSize-offset)) + alSetError(context, AL_INVALID_VALUE, "Invalid data sub-range %d+%d on buffer %u", + offset, length, buffer); + else if(UNLIKELY((offset%byte_align) != 0)) + alSetError(context, AL_INVALID_VALUE, + "Sub-range offset %d is not a multiple of frame size %d (%d unpack alignment)", + offset, byte_align, align); + else if(UNLIKELY((length%byte_align) != 0)) + alSetError(context, AL_INVALID_VALUE, + "Sub-range length %d is not a multiple of frame size %d (%d unpack alignment)", + length, byte_align, align); + else + { + /* offset -> byte offset, length -> sample count */ + offset = offset/byte_align * align * frame_size; + length = length/byte_align * align; + + dst = (ALbyte*)albuf->data + offset; + if(srctype == UserFmtIMA4 && albuf->FmtType == FmtShort) + Convert_ALshort_ALima4(dst, data, num_chans, length, align); + else if(srctype == UserFmtMSADPCM && albuf->FmtType == FmtShort) + Convert_ALshort_ALmsadpcm(dst, data, num_chans, length, align); + else + { + assert((long)srctype == (long)albuf->FmtType); + memcpy(dst, data, length*frame_size); + } + } + } } + UnlockBufferList(device); - if(offset > albuf->OriginalSize || length > albuf->OriginalSize-offset || - (offset%byte_align) != 0 || (length%byte_align) != 0) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - - channels = ChannelsFromFmt(albuf->FmtChannels); - bytes = BytesFromFmt(albuf->FmtType); - /* offset -> byte offset, length -> sample count */ - offset = offset/byte_align * channels*bytes; - length = length/byte_align * albuf->OriginalAlign; - - ConvertData((char*)albuf->data+offset, (enum UserFmtType)albuf->FmtType, - data, srctype, channels, length, align); - WriteUnlock(&albuf->lock); - -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } -AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer, - ALuint samplerate, ALenum internalformat, ALsizei samples, - ALenum channels, ALenum type, const ALvoid *data) +AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint UNUSED(buffer), + ALuint UNUSED(samplerate), ALenum UNUSED(internalformat), ALsizei UNUSED(samples), + ALenum UNUSED(channels), ALenum UNUSED(type), const ALvoid *UNUSED(data)) { - ALCdevice *device; ALCcontext *context; - ALbuffer *albuf; - ALsizei align; - ALenum err; context = GetContextRef(); if(!context) return; - device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - if(!(samples >= 0 && samplerate != 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - if(IsValidType(type) == AL_FALSE || IsValidChannels(channels) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_OPERATION, "alBufferSamplesSOFT not supported"); - align = ATOMIC_LOAD(&albuf->UnpackAlign); - if(SanitizeAlignment(type, &align) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - if((samples%align) != 0) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - err = LoadData(albuf, samplerate, internalformat, samples, - channels, type, data, align, AL_FALSE); - if(err != AL_NO_ERROR) - SET_ERROR_AND_GOTO(context, err, done); - -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } -AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint buffer, - ALsizei offset, ALsizei samples, - ALenum channels, ALenum type, const ALvoid *data) +AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint UNUSED(buffer), + ALsizei UNUSED(offset), ALsizei UNUSED(samples), + ALenum UNUSED(channels), ALenum UNUSED(type), const ALvoid *UNUSED(data)) { - ALCdevice *device; ALCcontext *context; - ALbuffer *albuf; - ALsizei align; context = GetContextRef(); if(!context) return; - device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - if(!(samples >= 0 && offset >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - if(IsValidType(type) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_OPERATION, "alBufferSubSamplesSOFT not supported"); - WriteLock(&albuf->lock); - align = ATOMIC_LOAD(&albuf->UnpackAlign); - if(SanitizeAlignment(type, &align) == AL_FALSE) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - if(channels != (ALenum)albuf->FmtChannels) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); - } - if(offset > albuf->SampleLen || samples > albuf->SampleLen-offset) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - if((samples%align) != 0) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - - /* offset -> byte offset */ - offset *= FrameSizeFromFmt(albuf->FmtChannels, albuf->FmtType); - ConvertData((char*)albuf->data+offset, (enum UserFmtType)albuf->FmtType, - data, type, ChannelsFromFmt(albuf->FmtChannels), samples, align); - WriteUnlock(&albuf->lock); - -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } -AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer, - ALsizei offset, ALsizei samples, - ALenum channels, ALenum type, ALvoid *data) +AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint UNUSED(buffer), + ALsizei UNUSED(offset), ALsizei UNUSED(samples), + ALenum UNUSED(channels), ALenum UNUSED(type), ALvoid *UNUSED(data)) { - ALCdevice *device; ALCcontext *context; - ALbuffer *albuf; - ALsizei align; context = GetContextRef(); if(!context) return; - device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - if(!(samples >= 0 && offset >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - if(IsValidType(type) == AL_FALSE) - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_OPERATION, "alGetBufferSamplesSOFT not supported"); - ReadLock(&albuf->lock); - align = ATOMIC_LOAD(&albuf->PackAlign); - if(SanitizeAlignment(type, &align) == AL_FALSE) - { - ReadUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - if(channels != (ALenum)albuf->FmtChannels) - { - ReadUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); - } - if(offset > albuf->SampleLen || samples > albuf->SampleLen-offset) - { - ReadUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - if((samples%align) != 0) - { - ReadUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - - /* offset -> byte offset */ - offset *= FrameSizeFromFmt(albuf->FmtChannels, albuf->FmtType); - ConvertData(data, type, (char*)albuf->data+offset, (enum UserFmtType)albuf->FmtType, - ChannelsFromFmt(albuf->FmtChannels), samples, align); - ReadUnlock(&albuf->lock); - -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } -AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format) +AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum UNUSED(format)) { - enum FmtChannels dstchannels; - enum FmtType dsttype; ALCcontext *context; - ALboolean ret; context = GetContextRef(); if(!context) return AL_FALSE; - ret = DecomposeFormat(format, &dstchannels, &dsttype); + alSetError(context, AL_INVALID_OPERATION, "alIsBufferFormatSupportedSOFT not supported"); ALCcontext_DecRef(context); - - return ret; + return AL_FALSE; } @@ -543,18 +464,16 @@ AL_API void AL_APIENTRY alBufferf(ALuint buffer, ALenum param, ALfloat UNUSED(va if(!context) return; device = context->Device; - LockBuffersRead(device); - if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - switch(param) + LockBufferList(device); + if(UNLIKELY(LookupBuffer(device, buffer) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer float property 0x%04x", param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -568,18 +487,16 @@ AL_API void AL_APIENTRY alBuffer3f(ALuint buffer, ALenum param, ALfloat UNUSED(v if(!context) return; device = context->Device; - LockBuffersRead(device); - if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - switch(param) + LockBufferList(device); + if(UNLIKELY(LookupBuffer(device, buffer) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer 3-float property 0x%04x", param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -593,20 +510,18 @@ AL_API void AL_APIENTRY alBufferfv(ALuint buffer, ALenum param, const ALfloat *v if(!context) return; device = context->Device; - LockBuffersRead(device); - if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + LockBufferList(device); + if(UNLIKELY(LookupBuffer(device, buffer) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(!values)) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer float-vector property 0x%04x", param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -621,30 +536,30 @@ AL_API void AL_APIENTRY alBufferi(ALuint buffer, ALenum param, ALint value) if(!context) return; device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - switch(param) + LockBufferList(device); + if(UNLIKELY((albuf=LookupBuffer(device, buffer)) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else switch(param) { case AL_UNPACK_BLOCK_ALIGNMENT_SOFT: - if(!(value >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - ATOMIC_STORE(&albuf->UnpackAlign, value); + if(UNLIKELY(value < 0)) + alSetError(context, AL_INVALID_VALUE, "Invalid unpack block alignment %d", value); + else + ATOMIC_STORE_SEQ(&albuf->UnpackAlign, value); break; case AL_PACK_BLOCK_ALIGNMENT_SOFT: - if(!(value >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - ATOMIC_STORE(&albuf->PackAlign, value); + if(UNLIKELY(value < 0)) + alSetError(context, AL_INVALID_VALUE, "Invalid pack block alignment %d", value); + else + ATOMIC_STORE_SEQ(&albuf->PackAlign, value); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer integer property 0x%04x", param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -658,16 +573,16 @@ AL_API void AL_APIENTRY alBuffer3i(ALuint buffer, ALenum param, ALint UNUSED(val if(!context) return; device = context->Device; - if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - switch(param) + LockBufferList(device); + if(UNLIKELY(LookupBuffer(device, buffer) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer 3-integer property 0x%04x", param); } + UnlockBufferList(device); -done: ALCcontext_DecRef(context); } @@ -693,39 +608,33 @@ AL_API void AL_APIENTRY alBufferiv(ALuint buffer, ALenum param, const ALint *val if(!context) return; device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + LockBufferList(device); + if(UNLIKELY((albuf=LookupBuffer(device, buffer)) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(!values)) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { case AL_LOOP_POINTS_SOFT: - WriteLock(&albuf->lock); - if(ReadRef(&albuf->ref) != 0) + if(UNLIKELY(ReadRef(&albuf->ref) != 0)) + alSetError(context, AL_INVALID_OPERATION, "Modifying in-use buffer %u's loop points", + buffer); + else if(UNLIKELY(values[0] >= values[1] || values[0] < 0 || values[1] > albuf->SampleLen)) + alSetError(context, AL_INVALID_VALUE, "Invalid loop point range %d -> %d o buffer %u", + values[0], values[1], buffer); + else { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); + albuf->LoopStart = values[0]; + albuf->LoopEnd = values[1]; } - if(values[0] >= values[1] || values[0] < 0 || - values[1] > albuf->SampleLen) - { - WriteUnlock(&albuf->lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } - - albuf->LoopStart = values[0]; - albuf->LoopEnd = values[1]; - WriteUnlock(&albuf->lock); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer integer-vector property 0x%04x", + param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -740,29 +649,18 @@ AL_API ALvoid AL_APIENTRY alGetBufferf(ALuint buffer, ALenum param, ALfloat *val if(!context) return; device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - if(!(value)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + LockBufferList(device); + if(UNLIKELY((albuf=LookupBuffer(device, buffer)) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(!value)) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { - case AL_SEC_LENGTH_SOFT: - ReadLock(&albuf->lock); - if(albuf->SampleLen != 0) - *value = albuf->SampleLen / (ALfloat)albuf->Frequency; - else - *value = 0.0f; - ReadUnlock(&albuf->lock); - break; - default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer float property 0x%04x", param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -776,20 +674,18 @@ AL_API void AL_APIENTRY alGetBuffer3f(ALuint buffer, ALenum param, ALfloat *valu if(!context) return; device = context->Device; - LockBuffersRead(device); - if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - if(!(value1 && value2 && value3)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + LockBufferList(device); + if(UNLIKELY(LookupBuffer(device, buffer) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(!value1 || !value2 || !value3)) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer 3-float property 0x%04x", param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -810,20 +706,18 @@ AL_API void AL_APIENTRY alGetBufferfv(ALuint buffer, ALenum param, ALfloat *valu if(!context) return; device = context->Device; - LockBuffersRead(device); - if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + LockBufferList(device); + if(UNLIKELY(LookupBuffer(device, buffer) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(!values)) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer float-vector property 0x%04x", param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -838,13 +732,12 @@ AL_API ALvoid AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value if(!context) return; device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - if(!(value)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + LockBufferList(device); + if(UNLIKELY((albuf=LookupBuffer(device, buffer)) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(!value)) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { case AL_FREQUENCY: *value = albuf->Frequency; @@ -859,38 +752,23 @@ AL_API ALvoid AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value break; case AL_SIZE: - ReadLock(&albuf->lock); *value = albuf->SampleLen * FrameSizeFromFmt(albuf->FmtChannels, albuf->FmtType); - ReadUnlock(&albuf->lock); - break; - - case AL_INTERNAL_FORMAT_SOFT: - *value = albuf->Format; - break; - - case AL_BYTE_LENGTH_SOFT: - *value = albuf->OriginalSize; - break; - - case AL_SAMPLE_LENGTH_SOFT: - *value = albuf->SampleLen; break; case AL_UNPACK_BLOCK_ALIGNMENT_SOFT: - *value = ATOMIC_LOAD(&albuf->UnpackAlign); + *value = ATOMIC_LOAD_SEQ(&albuf->UnpackAlign); break; case AL_PACK_BLOCK_ALIGNMENT_SOFT: - *value = ATOMIC_LOAD(&albuf->PackAlign); + *value = ATOMIC_LOAD_SEQ(&albuf->PackAlign); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer integer property 0x%04x", param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -904,20 +782,18 @@ AL_API void AL_APIENTRY alGetBuffer3i(ALuint buffer, ALenum param, ALint *value1 if(!context) return; device = context->Device; - LockBuffersRead(device); - if(LookupBuffer(device, buffer) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - if(!(value1 && value2 && value3)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + LockBufferList(device); + if(UNLIKELY(LookupBuffer(device, buffer) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(!value1 || !value2 || !value3)) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer 3-integer property 0x%04x", param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } @@ -947,65 +823,146 @@ AL_API void AL_APIENTRY alGetBufferiv(ALuint buffer, ALenum param, ALint *values if(!context) return; device = context->Device; - LockBuffersRead(device); - if((albuf=LookupBuffer(device, buffer)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); - - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + LockBufferList(device); + if(UNLIKELY((albuf=LookupBuffer(device, buffer)) == NULL)) + alSetError(context, AL_INVALID_NAME, "Invalid buffer ID %u", buffer); + else if(UNLIKELY(!values)) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { case AL_LOOP_POINTS_SOFT: - ReadLock(&albuf->lock); values[0] = albuf->LoopStart; values[1] = albuf->LoopEnd; - ReadUnlock(&albuf->lock); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid buffer integer-vector property 0x%04x", + param); } + UnlockBufferList(device); -done: - UnlockBuffersRead(device); ALCcontext_DecRef(context); } +static const ALchar *NameFromUserFmtType(enum UserFmtType type) +{ + switch(type) + { + case UserFmtUByte: return "Unsigned Byte"; + case UserFmtShort: return "Signed Short"; + case UserFmtFloat: return "Float32"; + case UserFmtDouble: return "Float64"; + case UserFmtMulaw: return "muLaw"; + case UserFmtAlaw: return "aLaw"; + case UserFmtIMA4: return "IMA4 ADPCM"; + case UserFmtMSADPCM: return "MSADPCM"; + } + return ""; +} + /* * LoadData * - * Loads the specified data into the buffer, using the specified formats. - * Currently, the new format must have the same channel configuration as the - * original format. + * Loads the specified data into the buffer, using the specified format. */ -ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei frames, enum UserFmtChannels SrcChannels, enum UserFmtType SrcType, const ALvoid *data, ALsizei align, ALboolean storesrc) +static void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALuint freq, ALsizei size, enum UserFmtChannels SrcChannels, enum UserFmtType SrcType, const ALvoid *data, ALbitfieldSOFT access) { enum FmtChannels DstChannels = FmtMono; - enum FmtType DstType = FmtByte; - ALuint NewChannels, NewBytes; - ALuint64 newsize; + enum FmtType DstType = FmtUByte; + ALsizei NumChannels, FrameSize; + ALsizei SrcByteAlign; + ALsizei unpackalign; + ALsizei newsize; + ALsizei frames; + ALsizei align; - if(DecomposeFormat(NewFormat, &DstChannels, &DstType) == AL_FALSE) - return AL_INVALID_ENUM; - if((long)SrcChannels != (long)DstChannels) - return AL_INVALID_ENUM; + if(UNLIKELY(ReadRef(&ALBuf->ref) != 0 || ALBuf->MappedAccess != 0)) + SETERR_RETURN(context, AL_INVALID_OPERATION,, "Modifying storage for in-use buffer %u", + ALBuf->id); - NewChannels = ChannelsFromFmt(DstChannels); - NewBytes = BytesFromFmt(DstType); - - newsize = frames; - newsize *= NewBytes; - newsize *= NewChannels; - if(newsize > INT_MAX) - return AL_OUT_OF_MEMORY; - - WriteLock(&ALBuf->lock); - if(ReadRef(&ALBuf->ref) != 0) + /* Currently no channel configurations need to be converted. */ + switch(SrcChannels) { - WriteUnlock(&ALBuf->lock); - return AL_INVALID_OPERATION; + case UserFmtMono: DstChannels = FmtMono; break; + case UserFmtStereo: DstChannels = FmtStereo; break; + case UserFmtRear: DstChannels = FmtRear; break; + case UserFmtQuad: DstChannels = FmtQuad; break; + case UserFmtX51: DstChannels = FmtX51; break; + case UserFmtX61: DstChannels = FmtX61; break; + case UserFmtX71: DstChannels = FmtX71; break; + case UserFmtBFormat2D: DstChannels = FmtBFormat2D; break; + case UserFmtBFormat3D: DstChannels = FmtBFormat3D; break; } + if(UNLIKELY((long)SrcChannels != (long)DstChannels)) + SETERR_RETURN(context, AL_INVALID_ENUM,, "Invalid format"); + + /* IMA4 and MSADPCM convert to 16-bit short. */ + switch(SrcType) + { + case UserFmtUByte: DstType = FmtUByte; break; + case UserFmtShort: DstType = FmtShort; break; + case UserFmtFloat: DstType = FmtFloat; break; + case UserFmtDouble: DstType = FmtDouble; break; + case UserFmtAlaw: DstType = FmtAlaw; break; + case UserFmtMulaw: DstType = FmtMulaw; break; + case UserFmtIMA4: DstType = FmtShort; break; + case UserFmtMSADPCM: DstType = FmtShort; break; + } + + /* TODO: Currently we can only map samples when they're not converted. To + * allow it would need some kind of double-buffering to hold onto a copy of + * the original data. + */ + if((access&MAP_READ_WRITE_FLAGS)) + { + if(UNLIKELY((long)SrcType != (long)DstType)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "%s samples cannot be mapped", + NameFromUserFmtType(SrcType)); + } + + unpackalign = ATOMIC_LOAD_SEQ(&ALBuf->UnpackAlign); + if(UNLIKELY((align=SanitizeAlignment(SrcType, unpackalign)) < 1)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "Invalid unpack alignment %d for %s samples", + unpackalign, NameFromUserFmtType(SrcType)); + + if((access&AL_PRESERVE_DATA_BIT_SOFT)) + { + /* Can only preserve data with the same format and alignment. */ + if(UNLIKELY(ALBuf->FmtChannels != DstChannels || ALBuf->OriginalType != SrcType)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "Preserving data of mismatched format"); + if(UNLIKELY(ALBuf->OriginalAlign != align)) + SETERR_RETURN(context, AL_INVALID_VALUE,, "Preserving data of mismatched alignment"); + } + + /* Convert the input/source size in bytes to sample frames using the unpack + * block alignment. + */ + if(SrcType == UserFmtIMA4) + SrcByteAlign = ((align-1)/2 + 4) * ChannelsFromUserFmt(SrcChannels); + else if(SrcType == UserFmtMSADPCM) + SrcByteAlign = ((align-2)/2 + 7) * ChannelsFromUserFmt(SrcChannels); + else + SrcByteAlign = align * FrameSizeFromUserFmt(SrcChannels, SrcType); + if(UNLIKELY((size%SrcByteAlign) != 0)) + SETERR_RETURN(context, AL_INVALID_VALUE,, + "Data size %d is not a multiple of frame size %d (%d unpack alignment)", + size, SrcByteAlign, align); + + if(UNLIKELY(size / SrcByteAlign > INT_MAX / align)) + SETERR_RETURN(context, AL_OUT_OF_MEMORY,, + "Buffer size overflow, %d blocks x %d samples per block", size/SrcByteAlign, align); + frames = size / SrcByteAlign * align; + + /* Convert the sample frames to the number of bytes needed for internal + * storage. + */ + NumChannels = ChannelsFromFmt(DstChannels); + FrameSize = NumChannels * BytesFromFmt(DstType); + if(UNLIKELY(frames > INT_MAX/FrameSize)) + SETERR_RETURN(context, AL_OUT_OF_MEMORY,, + "Buffer size overflow, %d frames x %d bytes per frame", frames, FrameSize); + newsize = frames*FrameSize; /* Round up to the next 16-byte multiple. This could reallocate only when * increasing or the new size is less than half the current, but then the @@ -1013,81 +970,67 @@ ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALenum NewFormat, ALsizei frames, * usage, and reporting the real size could cause problems for apps that * use AL_SIZE to try to get the buffer's play length. */ - newsize = (newsize+15) & ~0xf; + if(LIKELY(newsize <= INT_MAX-15)) + newsize = (newsize+15) & ~0xf; if(newsize != ALBuf->BytesAlloc) { - void *temp = al_calloc(16, (size_t)newsize); - if(!temp && newsize) + void *temp = al_malloc(16, (size_t)newsize); + if(UNLIKELY(!temp && newsize)) + SETERR_RETURN(context, AL_OUT_OF_MEMORY,, "Failed to allocate %d bytes of storage", + newsize); + if((access&AL_PRESERVE_DATA_BIT_SOFT)) { - WriteUnlock(&ALBuf->lock); - return AL_OUT_OF_MEMORY; + ALsizei tocopy = mini(newsize, ALBuf->BytesAlloc); + if(tocopy > 0) memcpy(temp, ALBuf->data, tocopy); } al_free(ALBuf->data); ALBuf->data = temp; - ALBuf->BytesAlloc = (ALuint)newsize; + ALBuf->BytesAlloc = newsize; } - if(data != NULL) - ConvertData(ALBuf->data, (enum UserFmtType)DstType, data, SrcType, NewChannels, frames, align); - - if(storesrc) + if(SrcType == UserFmtIMA4) { - ALBuf->OriginalChannels = SrcChannels; - ALBuf->OriginalType = SrcType; - if(SrcType == UserFmtIMA4) - { - ALsizei byte_align = ((align-1)/2 + 4) * ChannelsFromUserFmt(SrcChannels); - ALBuf->OriginalSize = frames / align * byte_align; - ALBuf->OriginalAlign = align; - } - else if(SrcType == UserFmtMSADPCM) - { - ALsizei byte_align = ((align-2)/2 + 7) * ChannelsFromUserFmt(SrcChannels); - ALBuf->OriginalSize = frames / align * byte_align; - ALBuf->OriginalAlign = align; - } - else - { - ALBuf->OriginalSize = frames * FrameSizeFromUserFmt(SrcChannels, SrcType); - ALBuf->OriginalAlign = 1; - } + assert(DstType == FmtShort); + if(data != NULL && ALBuf->data != NULL) + Convert_ALshort_ALima4(ALBuf->data, data, NumChannels, frames, align); + ALBuf->OriginalAlign = align; + } + else if(SrcType == UserFmtMSADPCM) + { + assert(DstType == FmtShort); + if(data != NULL && ALBuf->data != NULL) + Convert_ALshort_ALmsadpcm(ALBuf->data, data, NumChannels, frames, align); + ALBuf->OriginalAlign = align; } else { - ALBuf->OriginalChannels = (enum UserFmtChannels)DstChannels; - ALBuf->OriginalType = (enum UserFmtType)DstType; - ALBuf->OriginalSize = frames * NewBytes * NewChannels; - ALBuf->OriginalAlign = 1; + assert((long)SrcType == (long)DstType); + if(data != NULL && ALBuf->data != NULL) + memcpy(ALBuf->data, data, frames*FrameSize); + ALBuf->OriginalAlign = 1; } + ALBuf->OriginalSize = size; + ALBuf->OriginalType = SrcType; ALBuf->Frequency = freq; ALBuf->FmtChannels = DstChannels; ALBuf->FmtType = DstType; - ALBuf->Format = NewFormat; + ALBuf->Access = access; ALBuf->SampleLen = frames; ALBuf->LoopStart = 0; ALBuf->LoopEnd = ALBuf->SampleLen; - - WriteUnlock(&ALBuf->lock); - return AL_NO_ERROR; } -ALuint BytesFromUserFmt(enum UserFmtType type) +ALsizei BytesFromUserFmt(enum UserFmtType type) { switch(type) { - case UserFmtByte: return sizeof(ALbyte); case UserFmtUByte: return sizeof(ALubyte); case UserFmtShort: return sizeof(ALshort); - case UserFmtUShort: return sizeof(ALushort); - case UserFmtInt: return sizeof(ALint); - case UserFmtUInt: return sizeof(ALuint); case UserFmtFloat: return sizeof(ALfloat); case UserFmtDouble: return sizeof(ALdouble); - case UserFmtByte3: return sizeof(ALbyte[3]); - case UserFmtUByte3: return sizeof(ALubyte[3]); case UserFmtMulaw: return sizeof(ALubyte); case UserFmtAlaw: return sizeof(ALubyte); case UserFmtIMA4: break; /* not handled here */ @@ -1095,7 +1038,7 @@ ALuint BytesFromUserFmt(enum UserFmtType type) } return 0; } -ALuint ChannelsFromUserFmt(enum UserFmtChannels chans) +ALsizei ChannelsFromUserFmt(enum UserFmtChannels chans) { switch(chans) { @@ -1190,17 +1133,20 @@ static ALboolean DecomposeUserFormat(ALenum format, enum UserFmtChannels *chans, return AL_FALSE; } -ALuint BytesFromFmt(enum FmtType type) +ALsizei BytesFromFmt(enum FmtType type) { switch(type) { - case FmtByte: return sizeof(ALbyte); + case FmtUByte: return sizeof(ALubyte); case FmtShort: return sizeof(ALshort); case FmtFloat: return sizeof(ALfloat); + case FmtDouble: return sizeof(ALdouble); + case FmtMulaw: return sizeof(ALubyte); + case FmtAlaw: return sizeof(ALubyte); } return 0; } -ALuint ChannelsFromFmt(enum FmtChannels chans) +ALsizei ChannelsFromFmt(enum FmtChannels chans) { switch(chans) { @@ -1216,73 +1162,13 @@ ALuint ChannelsFromFmt(enum FmtChannels chans) } return 0; } -static ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum FmtType *type) + +static ALsizei SanitizeAlignment(enum UserFmtType type, ALsizei align) { - static const struct { - ALenum format; - enum FmtChannels channels; - enum FmtType type; - } list[] = { - { AL_MONO8_SOFT, FmtMono, FmtByte }, - { AL_MONO16_SOFT, FmtMono, FmtShort }, - { AL_MONO32F_SOFT, FmtMono, FmtFloat }, + if(align < 0) + return 0; - { AL_STEREO8_SOFT, FmtStereo, FmtByte }, - { AL_STEREO16_SOFT, FmtStereo, FmtShort }, - { AL_STEREO32F_SOFT, FmtStereo, FmtFloat }, - - { AL_REAR8_SOFT, FmtRear, FmtByte }, - { AL_REAR16_SOFT, FmtRear, FmtShort }, - { AL_REAR32F_SOFT, FmtRear, FmtFloat }, - - { AL_FORMAT_QUAD8_LOKI, FmtQuad, FmtByte }, - { AL_FORMAT_QUAD16_LOKI, FmtQuad, FmtShort }, - - { AL_QUAD8_SOFT, FmtQuad, FmtByte }, - { AL_QUAD16_SOFT, FmtQuad, FmtShort }, - { AL_QUAD32F_SOFT, FmtQuad, FmtFloat }, - - { AL_5POINT1_8_SOFT, FmtX51, FmtByte }, - { AL_5POINT1_16_SOFT, FmtX51, FmtShort }, - { AL_5POINT1_32F_SOFT, FmtX51, FmtFloat }, - - { AL_6POINT1_8_SOFT, FmtX61, FmtByte }, - { AL_6POINT1_16_SOFT, FmtX61, FmtShort }, - { AL_6POINT1_32F_SOFT, FmtX61, FmtFloat }, - - { AL_7POINT1_8_SOFT, FmtX71, FmtByte }, - { AL_7POINT1_16_SOFT, FmtX71, FmtShort }, - { AL_7POINT1_32F_SOFT, FmtX71, FmtFloat }, - - { AL_BFORMAT2D_8_SOFT, FmtBFormat2D, FmtByte }, - { AL_BFORMAT2D_16_SOFT, FmtBFormat2D, FmtShort }, - { AL_BFORMAT2D_32F_SOFT, FmtBFormat2D, FmtFloat }, - - { AL_BFORMAT3D_8_SOFT, FmtBFormat3D, FmtByte }, - { AL_BFORMAT3D_16_SOFT, FmtBFormat3D, FmtShort }, - { AL_BFORMAT3D_32F_SOFT, FmtBFormat3D, FmtFloat }, - }; - ALuint i; - - for(i = 0;i < COUNTOF(list);i++) - { - if(list[i].format == format) - { - *chans = list[i].channels; - *type = list[i].type; - return AL_TRUE; - } - } - - return AL_FALSE; -} - -static ALboolean SanitizeAlignment(enum UserFmtType type, ALsizei *align) -{ - if(*align < 0) - return AL_FALSE; - - if(*align == 0) + if(align == 0) { if(type == UserFmtIMA4) { @@ -1290,106 +1176,101 @@ static ALboolean SanitizeAlignment(enum UserFmtType type, ALsizei *align) * nVidia and Apple use 64+1 sample frames per block -> block_size=36 bytes per channel * Most PC sound software uses 2040+1 sample frames per block -> block_size=1024 bytes per channel */ - *align = 65; + return 65; } - else if(type == UserFmtMSADPCM) - *align = 64; - else - *align = 1; - return AL_TRUE; + if(type == UserFmtMSADPCM) + return 64; + return 1; } if(type == UserFmtIMA4) { /* IMA4 block alignment must be a multiple of 8, plus 1. */ - return ((*align)&7) == 1; + if((align&7) == 1) return align; + return 0; } if(type == UserFmtMSADPCM) { /* MSADPCM block alignment must be a multiple of 2. */ - /* FIXME: Too strict? Might only require align*channels to be a - * multiple of 2. */ - return ((*align)&1) == 0; + if((align&1) == 0) return align; + return 0; } - return AL_TRUE; + return align; } -static ALboolean IsValidType(ALenum type) -{ - switch(type) - { - case AL_BYTE_SOFT: - case AL_UNSIGNED_BYTE_SOFT: - case AL_SHORT_SOFT: - case AL_UNSIGNED_SHORT_SOFT: - case AL_INT_SOFT: - case AL_UNSIGNED_INT_SOFT: - case AL_FLOAT_SOFT: - case AL_DOUBLE_SOFT: - case AL_BYTE3_SOFT: - case AL_UNSIGNED_BYTE3_SOFT: - case AL_MULAW_SOFT: - return AL_TRUE; - } - return AL_FALSE; -} - -static ALboolean IsValidChannels(ALenum channels) -{ - switch(channels) - { - case AL_MONO_SOFT: - case AL_STEREO_SOFT: - case AL_REAR_SOFT: - case AL_QUAD_SOFT: - case AL_5POINT1_SOFT: - case AL_6POINT1_SOFT: - case AL_7POINT1_SOFT: - case AL_BFORMAT2D_SOFT: - case AL_BFORMAT3D_SOFT: - return AL_TRUE; - } - return AL_FALSE; -} - - -ALbuffer *NewBuffer(ALCcontext *context) +static ALbuffer *AllocBuffer(ALCcontext *context) { ALCdevice *device = context->Device; - ALbuffer *buffer; - ALenum err; + BufferSubList *sublist, *subend; + ALbuffer *buffer = NULL; + ALsizei lidx = 0; + ALsizei slidx; - buffer = al_calloc(16, sizeof(ALbuffer)); - if(!buffer) - SET_ERROR_AND_RETURN_VALUE(context, AL_OUT_OF_MEMORY, NULL); - RWLockInit(&buffer->lock); - - err = NewThunkEntry(&buffer->id); - if(err == AL_NO_ERROR) - err = InsertUIntMapEntry(&device->BufferMap, buffer->id, buffer); - if(err != AL_NO_ERROR) + almtx_lock(&device->BufferLock); + sublist = VECTOR_BEGIN(device->BufferList); + subend = VECTOR_END(device->BufferList); + for(;sublist != subend;++sublist) { - FreeThunkEntry(buffer->id); - memset(buffer, 0, sizeof(ALbuffer)); - al_free(buffer); - - SET_ERROR_AND_RETURN_VALUE(context, err, NULL); + if(sublist->FreeMask) + { + slidx = CTZ64(sublist->FreeMask); + buffer = sublist->Buffers + slidx; + break; + } + ++lidx; } + if(UNLIKELY(!buffer)) + { + const BufferSubList empty_sublist = { 0, NULL }; + /* Don't allocate so many list entries that the 32-bit ID could + * overflow... + */ + if(UNLIKELY(VECTOR_SIZE(device->BufferList) >= 1<<25)) + { + almtx_unlock(&device->BufferLock); + alSetError(context, AL_OUT_OF_MEMORY, "Too many buffers allocated"); + return NULL; + } + lidx = (ALsizei)VECTOR_SIZE(device->BufferList); + VECTOR_PUSH_BACK(device->BufferList, empty_sublist); + sublist = &VECTOR_BACK(device->BufferList); + sublist->FreeMask = ~U64(0); + sublist->Buffers = al_calloc(16, sizeof(ALbuffer)*64); + if(UNLIKELY(!sublist->Buffers)) + { + VECTOR_POP_BACK(device->BufferList); + almtx_unlock(&device->BufferLock); + alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate buffer batch"); + return NULL; + } + + slidx = 0; + buffer = sublist->Buffers + slidx; + } + + memset(buffer, 0, sizeof(*buffer)); + + /* Add 1 to avoid buffer ID 0. */ + buffer->id = ((lidx<<6) | slidx) + 1; + + sublist->FreeMask &= ~(U64(1)<BufferLock); return buffer; } -void DeleteBuffer(ALCdevice *device, ALbuffer *buffer) +static void FreeBuffer(ALCdevice *device, ALbuffer *buffer) { - RemoveBuffer(device, buffer->id); - FreeThunkEntry(buffer->id); + ALuint id = buffer->id - 1; + ALsizei lidx = id >> 6; + ALsizei slidx = id & 0x3f; al_free(buffer->data); - memset(buffer, 0, sizeof(*buffer)); - al_free(buffer); + + VECTOR_ELEM(device->BufferList, lidx).FreeMask |= U64(1) << slidx; } @@ -1400,16 +1281,25 @@ void DeleteBuffer(ALCdevice *device, ALbuffer *buffer) */ ALvoid ReleaseALBuffers(ALCdevice *device) { - ALsizei i; - for(i = 0;i < device->BufferMap.size;i++) + BufferSubList *sublist = VECTOR_BEGIN(device->BufferList); + BufferSubList *subend = VECTOR_END(device->BufferList); + size_t leftover = 0; + for(;sublist != subend;++sublist) { - ALbuffer *temp = device->BufferMap.values[i]; - device->BufferMap.values[i] = NULL; + ALuint64 usemask = ~sublist->FreeMask; + while(usemask) + { + ALsizei idx = CTZ64(usemask); + ALbuffer *buffer = sublist->Buffers + idx; - al_free(temp->data); + al_free(buffer->data); + memset(buffer, 0, sizeof(*buffer)); + ++leftover; - FreeThunkEntry(temp->id); - memset(temp, 0, sizeof(ALbuffer)); - al_free(temp); + usemask &= ~(U64(1) << idx); + } + sublist->FreeMask = ~usemask; } + if(leftover > 0) + WARN("(%p) Deleted "SZFMT" Buffer%s\n", device, leftover, (leftover==1)?"":"s"); } diff --git a/Engine/lib/openal-soft/OpenAL32/alEffect.c b/Engine/lib/openal-soft/OpenAL32/alEffect.c index 65a4dcb68..e7dc6aced 100644 --- a/Engine/lib/openal-soft/OpenAL32/alEffect.c +++ b/Engine/lib/openal-soft/OpenAL32/alEffect.c @@ -28,26 +28,51 @@ #include "AL/alc.h" #include "alMain.h" #include "alEffect.h" -#include "alThunk.h" #include "alError.h" -ALboolean DisabledEffects[MAX_EFFECTS]; - -extern inline void LockEffectsRead(ALCdevice *device); -extern inline void UnlockEffectsRead(ALCdevice *device); -extern inline void LockEffectsWrite(ALCdevice *device); -extern inline void UnlockEffectsWrite(ALCdevice *device); -extern inline struct ALeffect *LookupEffect(ALCdevice *device, ALuint id); -extern inline struct ALeffect *RemoveEffect(ALCdevice *device, ALuint id); +extern inline void LockEffectList(ALCdevice *device); +extern inline void UnlockEffectList(ALCdevice *device); extern inline ALboolean IsReverbEffect(ALenum type); +const struct EffectList EffectList[EFFECTLIST_SIZE] = { + { "eaxreverb", EAXREVERB_EFFECT, AL_EFFECT_EAXREVERB }, + { "reverb", REVERB_EFFECT, AL_EFFECT_REVERB }, + { "chorus", CHORUS_EFFECT, AL_EFFECT_CHORUS }, + { "compressor", COMPRESSOR_EFFECT, AL_EFFECT_COMPRESSOR }, + { "distortion", DISTORTION_EFFECT, AL_EFFECT_DISTORTION }, + { "echo", ECHO_EFFECT, AL_EFFECT_ECHO }, + { "equalizer", EQUALIZER_EFFECT, AL_EFFECT_EQUALIZER }, + { "flanger", FLANGER_EFFECT, AL_EFFECT_FLANGER }, + { "modulator", MODULATOR_EFFECT, AL_EFFECT_RING_MODULATOR }, + { "pshifter", PSHIFTER_EFFECT, AL_EFFECT_PITCH_SHIFTER }, + { "dedicated", DEDICATED_EFFECT, AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT }, + { "dedicated", DEDICATED_EFFECT, AL_EFFECT_DEDICATED_DIALOGUE }, +}; + +ALboolean DisabledEffects[MAX_EFFECTS]; + +static ALeffect *AllocEffect(ALCcontext *context); +static void FreeEffect(ALCdevice *device, ALeffect *effect); static void InitEffectParams(ALeffect *effect, ALenum type); +static inline ALeffect *LookupEffect(ALCdevice *device, ALuint id) +{ + EffectSubList *sublist; + ALuint lidx = (id-1) >> 6; + ALsizei slidx = (id-1) & 0x3f; + + if(UNLIKELY(lidx >= VECTOR_SIZE(device->EffectList))) + return NULL; + sublist = &VECTOR_ELEM(device->EffectList, lidx); + if(UNLIKELY(sublist->FreeMask & (U64(1)<Effects + slidx; +} + AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) { - ALCdevice *device; ALCcontext *context; ALsizei cur; @@ -55,37 +80,18 @@ AL_API ALvoid AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) if(!context) return; if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - device = context->Device; - for(cur = 0;cur < n;cur++) + alSetError(context, AL_INVALID_VALUE, "Generating %d effects", n); + else for(cur = 0;cur < n;cur++) { - ALeffect *effect = al_calloc(16, sizeof(ALeffect)); - ALenum err = AL_OUT_OF_MEMORY; - if(!effect || (err=InitEffect(effect)) != AL_NO_ERROR) + ALeffect *effect = AllocEffect(context); + if(!effect) { - al_free(effect); alDeleteEffects(cur, effects); - SET_ERROR_AND_GOTO(context, err, done); + break; } - - err = NewThunkEntry(&effect->id); - if(err == AL_NO_ERROR) - err = InsertUIntMapEntry(&device->EffectMap, effect->id, effect); - if(err != AL_NO_ERROR) - { - FreeThunkEntry(effect->id); - memset(effect, 0, sizeof(ALeffect)); - al_free(effect); - - alDeleteEffects(cur, effects); - SET_ERROR_AND_GOTO(context, err, done); - } - effects[cur] = effect->id; } -done: ALCcontext_DecRef(context); } @@ -100,26 +106,22 @@ AL_API ALvoid AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects) if(!context) return; device = context->Device; - LockEffectsWrite(device); + LockEffectList(device); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Deleting %d effects", n); for(i = 0;i < n;i++) { if(effects[i] && LookupEffect(device, effects[i]) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid effect ID %u", effects[i]); } for(i = 0;i < n;i++) { - if((effect=RemoveEffect(device, effects[i])) == NULL) - continue; - FreeThunkEntry(effect->id); - - memset(effect, 0, sizeof(*effect)); - al_free(effect); + if((effect=LookupEffect(device, effects[i])) != NULL) + FreeEffect(device, effect); } done: - UnlockEffectsWrite(device); + UnlockEffectList(device); ALCcontext_DecRef(context); } @@ -131,10 +133,10 @@ AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect) Context = GetContextRef(); if(!Context) return AL_FALSE; - LockEffectsRead(Context->Device); + LockEffectList(Context->Device); result = ((!effect || LookupEffect(Context->Device, effect)) ? AL_TRUE : AL_FALSE); - UnlockEffectsRead(Context->Device); + UnlockEffectList(Context->Device); ALCcontext_DecRef(Context); @@ -151,16 +153,16 @@ AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint value) if(!Context) return; Device = Context->Device; - LockEffectsWrite(Device); + LockEffectList(Device); if((ALEffect=LookupEffect(Device, effect)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect); else { if(param == AL_EFFECT_TYPE) { ALboolean isOk = (value == AL_EFFECT_NULL); ALint i; - for(i = 0;!isOk && EffectList[i].val;i++) + for(i = 0;!isOk && i < EFFECTLIST_SIZE;i++) { if(value == EffectList[i].val && !DisabledEffects[EffectList[i].type]) @@ -170,15 +172,15 @@ AL_API ALvoid AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint value) if(isOk) InitEffectParams(ALEffect, value); else - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "Effect type 0x%04x not supported", value); } else { /* Call the appropriate handler */ - V(ALEffect,setParami)(Context, param, value); + ALeffect_setParami(ALEffect, Context, param, value); } } - UnlockEffectsWrite(Device); + UnlockEffectList(Device); ALCcontext_DecRef(Context); } @@ -200,15 +202,15 @@ AL_API ALvoid AL_APIENTRY alEffectiv(ALuint effect, ALenum param, const ALint *v if(!Context) return; Device = Context->Device; - LockEffectsWrite(Device); + LockEffectList(Device); if((ALEffect=LookupEffect(Device, effect)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect); else { /* Call the appropriate handler */ - V(ALEffect,setParamiv)(Context, param, values); + ALeffect_setParamiv(ALEffect, Context, param, values); } - UnlockEffectsWrite(Device); + UnlockEffectList(Device); ALCcontext_DecRef(Context); } @@ -223,15 +225,15 @@ AL_API ALvoid AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat value) if(!Context) return; Device = Context->Device; - LockEffectsWrite(Device); + LockEffectList(Device); if((ALEffect=LookupEffect(Device, effect)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect); else { /* Call the appropriate handler */ - V(ALEffect,setParamf)(Context, param, value); + ALeffect_setParamf(ALEffect, Context, param, value); } - UnlockEffectsWrite(Device); + UnlockEffectList(Device); ALCcontext_DecRef(Context); } @@ -246,15 +248,15 @@ AL_API ALvoid AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat if(!Context) return; Device = Context->Device; - LockEffectsWrite(Device); + LockEffectList(Device); if((ALEffect=LookupEffect(Device, effect)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect); else { /* Call the appropriate handler */ - V(ALEffect,setParamfv)(Context, param, values); + ALeffect_setParamfv(ALEffect, Context, param, values); } - UnlockEffectsWrite(Device); + UnlockEffectList(Device); ALCcontext_DecRef(Context); } @@ -269,9 +271,9 @@ AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *value if(!Context) return; Device = Context->Device; - LockEffectsRead(Device); + LockEffectList(Device); if((ALEffect=LookupEffect(Device, effect)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect); else { if(param == AL_EFFECT_TYPE) @@ -279,10 +281,10 @@ AL_API ALvoid AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *value else { /* Call the appropriate handler */ - V(ALEffect,getParami)(Context, param, value); + ALeffect_getParami(ALEffect, Context, param, value); } } - UnlockEffectsRead(Device); + UnlockEffectList(Device); ALCcontext_DecRef(Context); } @@ -304,15 +306,15 @@ AL_API ALvoid AL_APIENTRY alGetEffectiv(ALuint effect, ALenum param, ALint *valu if(!Context) return; Device = Context->Device; - LockEffectsRead(Device); + LockEffectList(Device); if((ALEffect=LookupEffect(Device, effect)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect); else { /* Call the appropriate handler */ - V(ALEffect,getParamiv)(Context, param, values); + ALeffect_getParamiv(ALEffect, Context, param, values); } - UnlockEffectsRead(Device); + UnlockEffectList(Device); ALCcontext_DecRef(Context); } @@ -327,15 +329,15 @@ AL_API ALvoid AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *val if(!Context) return; Device = Context->Device; - LockEffectsRead(Device); + LockEffectList(Device); if((ALEffect=LookupEffect(Device, effect)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect); else { /* Call the appropriate handler */ - V(ALEffect,getParamf)(Context, param, value); + ALeffect_getParamf(ALEffect, Context, param, value); } - UnlockEffectsRead(Device); + UnlockEffectList(Device); ALCcontext_DecRef(Context); } @@ -350,39 +352,120 @@ AL_API ALvoid AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *va if(!Context) return; Device = Context->Device; - LockEffectsRead(Device); + LockEffectList(Device); if((ALEffect=LookupEffect(Device, effect)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid effect ID %u", effect); else { /* Call the appropriate handler */ - V(ALEffect,getParamfv)(Context, param, values); + ALeffect_getParamfv(ALEffect, Context, param, values); } - UnlockEffectsRead(Device); + UnlockEffectList(Device); ALCcontext_DecRef(Context); } -ALenum InitEffect(ALeffect *effect) +void InitEffect(ALeffect *effect) { InitEffectParams(effect, AL_EFFECT_NULL); - return AL_NO_ERROR; } -ALvoid ReleaseALEffects(ALCdevice *device) +static ALeffect *AllocEffect(ALCcontext *context) { - ALsizei i; - for(i = 0;i < device->EffectMap.size;i++) - { - ALeffect *temp = device->EffectMap.values[i]; - device->EffectMap.values[i] = NULL; + ALCdevice *device = context->Device; + EffectSubList *sublist, *subend; + ALeffect *effect = NULL; + ALsizei lidx = 0; + ALsizei slidx; - // Release effect structure - FreeThunkEntry(temp->id); - memset(temp, 0, sizeof(ALeffect)); - al_free(temp); + almtx_lock(&device->EffectLock); + sublist = VECTOR_BEGIN(device->EffectList); + subend = VECTOR_END(device->EffectList); + for(;sublist != subend;++sublist) + { + if(sublist->FreeMask) + { + slidx = CTZ64(sublist->FreeMask); + effect = sublist->Effects + slidx; + break; + } + ++lidx; } + if(UNLIKELY(!effect)) + { + const EffectSubList empty_sublist = { 0, NULL }; + /* Don't allocate so many list entries that the 32-bit ID could + * overflow... + */ + if(UNLIKELY(VECTOR_SIZE(device->EffectList) >= 1<<25)) + { + almtx_unlock(&device->EffectLock); + alSetError(context, AL_OUT_OF_MEMORY, "Too many effects allocated"); + return NULL; + } + lidx = (ALsizei)VECTOR_SIZE(device->EffectList); + VECTOR_PUSH_BACK(device->EffectList, empty_sublist); + sublist = &VECTOR_BACK(device->EffectList); + sublist->FreeMask = ~U64(0); + sublist->Effects = al_calloc(16, sizeof(ALeffect)*64); + if(UNLIKELY(!sublist->Effects)) + { + VECTOR_POP_BACK(device->EffectList); + almtx_unlock(&device->EffectLock); + alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate effect batch"); + return NULL; + } + + slidx = 0; + effect = sublist->Effects + slidx; + } + + memset(effect, 0, sizeof(*effect)); + InitEffectParams(effect, AL_EFFECT_NULL); + + /* Add 1 to avoid effect ID 0. */ + effect->id = ((lidx<<6) | slidx) + 1; + + sublist->FreeMask &= ~(U64(1)<EffectLock); + + return effect; +} + +static void FreeEffect(ALCdevice *device, ALeffect *effect) +{ + ALuint id = effect->id - 1; + ALsizei lidx = id >> 6; + ALsizei slidx = id & 0x3f; + + memset(effect, 0, sizeof(*effect)); + + VECTOR_ELEM(device->EffectList, lidx).FreeMask |= U64(1) << slidx; +} + +void ReleaseALEffects(ALCdevice *device) +{ + EffectSubList *sublist = VECTOR_BEGIN(device->EffectList); + EffectSubList *subend = VECTOR_END(device->EffectList); + size_t leftover = 0; + for(;sublist != subend;++sublist) + { + ALuint64 usemask = ~sublist->FreeMask; + while(usemask) + { + ALsizei idx = CTZ64(usemask); + ALeffect *effect = sublist->Effects + idx; + + memset(effect, 0, sizeof(*effect)); + ++leftover; + + usemask &= ~(U64(1) << idx); + } + sublist->FreeMask = ~usemask; + } + if(leftover > 0) + WARN("(%p) Deleted "SZFMT" Effect%s\n", device, leftover, (leftover==1)?"":"s"); } @@ -418,7 +501,7 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Reverb.LFReference = AL_EAXREVERB_DEFAULT_LFREFERENCE; effect->Props.Reverb.RoomRolloffFactor = AL_EAXREVERB_DEFAULT_ROOM_ROLLOFF_FACTOR; effect->Props.Reverb.DecayHFLimit = AL_EAXREVERB_DEFAULT_DECAY_HFLIMIT; - SET_VTABLE1(ALeaxreverb, effect); + effect->vtab = &ALeaxreverb_vtable; break; case AL_EFFECT_REVERB: effect->Props.Reverb.Density = AL_REVERB_DEFAULT_DENSITY; @@ -448,7 +531,7 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Reverb.LFReference = 250.0f; effect->Props.Reverb.RoomRolloffFactor = AL_REVERB_DEFAULT_ROOM_ROLLOFF_FACTOR; effect->Props.Reverb.DecayHFLimit = AL_REVERB_DEFAULT_DECAY_HFLIMIT; - SET_VTABLE1(ALreverb, effect); + effect->vtab = &ALreverb_vtable; break; case AL_EFFECT_CHORUS: effect->Props.Chorus.Waveform = AL_CHORUS_DEFAULT_WAVEFORM; @@ -457,11 +540,11 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Chorus.Depth = AL_CHORUS_DEFAULT_DEPTH; effect->Props.Chorus.Feedback = AL_CHORUS_DEFAULT_FEEDBACK; effect->Props.Chorus.Delay = AL_CHORUS_DEFAULT_DELAY; - SET_VTABLE1(ALchorus, effect); + effect->vtab = &ALchorus_vtable; break; case AL_EFFECT_COMPRESSOR: effect->Props.Compressor.OnOff = AL_COMPRESSOR_DEFAULT_ONOFF; - SET_VTABLE1(ALcompressor, effect); + effect->vtab = &ALcompressor_vtable; break; case AL_EFFECT_DISTORTION: effect->Props.Distortion.Edge = AL_DISTORTION_DEFAULT_EDGE; @@ -469,7 +552,7 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Distortion.LowpassCutoff = AL_DISTORTION_DEFAULT_LOWPASS_CUTOFF; effect->Props.Distortion.EQCenter = AL_DISTORTION_DEFAULT_EQCENTER; effect->Props.Distortion.EQBandwidth = AL_DISTORTION_DEFAULT_EQBANDWIDTH; - SET_VTABLE1(ALdistortion, effect); + effect->vtab = &ALdistortion_vtable; break; case AL_EFFECT_ECHO: effect->Props.Echo.Delay = AL_ECHO_DEFAULT_DELAY; @@ -477,7 +560,7 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Echo.Damping = AL_ECHO_DEFAULT_DAMPING; effect->Props.Echo.Feedback = AL_ECHO_DEFAULT_FEEDBACK; effect->Props.Echo.Spread = AL_ECHO_DEFAULT_SPREAD; - SET_VTABLE1(ALecho, effect); + effect->vtab = &ALecho_vtable; break; case AL_EFFECT_EQUALIZER: effect->Props.Equalizer.LowCutoff = AL_EQUALIZER_DEFAULT_LOW_CUTOFF; @@ -490,30 +573,35 @@ static void InitEffectParams(ALeffect *effect, ALenum type) effect->Props.Equalizer.Mid2Width = AL_EQUALIZER_DEFAULT_MID2_WIDTH; effect->Props.Equalizer.HighCutoff = AL_EQUALIZER_DEFAULT_HIGH_CUTOFF; effect->Props.Equalizer.HighGain = AL_EQUALIZER_DEFAULT_HIGH_GAIN; - SET_VTABLE1(ALequalizer, effect); + effect->vtab = &ALequalizer_vtable; break; case AL_EFFECT_FLANGER: - effect->Props.Flanger.Waveform = AL_FLANGER_DEFAULT_WAVEFORM; - effect->Props.Flanger.Phase = AL_FLANGER_DEFAULT_PHASE; - effect->Props.Flanger.Rate = AL_FLANGER_DEFAULT_RATE; - effect->Props.Flanger.Depth = AL_FLANGER_DEFAULT_DEPTH; - effect->Props.Flanger.Feedback = AL_FLANGER_DEFAULT_FEEDBACK; - effect->Props.Flanger.Delay = AL_FLANGER_DEFAULT_DELAY; - SET_VTABLE1(ALflanger, effect); + effect->Props.Chorus.Waveform = AL_FLANGER_DEFAULT_WAVEFORM; + effect->Props.Chorus.Phase = AL_FLANGER_DEFAULT_PHASE; + effect->Props.Chorus.Rate = AL_FLANGER_DEFAULT_RATE; + effect->Props.Chorus.Depth = AL_FLANGER_DEFAULT_DEPTH; + effect->Props.Chorus.Feedback = AL_FLANGER_DEFAULT_FEEDBACK; + effect->Props.Chorus.Delay = AL_FLANGER_DEFAULT_DELAY; + effect->vtab = &ALflanger_vtable; break; case AL_EFFECT_RING_MODULATOR: effect->Props.Modulator.Frequency = AL_RING_MODULATOR_DEFAULT_FREQUENCY; effect->Props.Modulator.HighPassCutoff = AL_RING_MODULATOR_DEFAULT_HIGHPASS_CUTOFF; effect->Props.Modulator.Waveform = AL_RING_MODULATOR_DEFAULT_WAVEFORM; - SET_VTABLE1(ALmodulator, effect); + effect->vtab = &ALmodulator_vtable; + break; + case AL_EFFECT_PITCH_SHIFTER: + effect->Props.Pshifter.CoarseTune = AL_PITCH_SHIFTER_DEFAULT_COARSE_TUNE; + effect->Props.Pshifter.FineTune = AL_PITCH_SHIFTER_DEFAULT_FINE_TUNE; + effect->vtab = &ALpshifter_vtable; break; case AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT: case AL_EFFECT_DEDICATED_DIALOGUE: effect->Props.Dedicated.Gain = 1.0f; - SET_VTABLE1(ALdedicated, effect); + effect->vtab = &ALdedicated_vtable; break; default: - SET_VTABLE1(ALnull, effect); + effect->vtab = &ALnull_vtable; break; } effect->type = type; @@ -656,7 +744,7 @@ static const struct { }; #undef DECL -ALvoid LoadReverbPreset(const char *name, ALeffect *effect) +void LoadReverbPreset(const char *name, ALeffect *effect) { size_t i; @@ -667,9 +755,9 @@ ALvoid LoadReverbPreset(const char *name, ALeffect *effect) return; } - if(!DisabledEffects[EAXREVERB]) + if(!DisabledEffects[EAXREVERB_EFFECT]) InitEffectParams(effect, AL_EFFECT_EAXREVERB); - else if(!DisabledEffects[REVERB]) + else if(!DisabledEffects[REVERB_EFFECT]) InitEffectParams(effect, AL_EFFECT_REVERB); else InitEffectParams(effect, AL_EFFECT_NULL); diff --git a/Engine/lib/openal-soft/OpenAL32/alError.c b/Engine/lib/openal-soft/OpenAL32/alError.c index b38d8dfed..b6208f770 100644 --- a/Engine/lib/openal-soft/OpenAL32/alError.c +++ b/Engine/lib/openal-soft/OpenAL32/alError.c @@ -21,6 +21,7 @@ #include "config.h" #include +#include #ifdef HAVE_WINDOWS_H #define WIN32_LEAN_AND_MEAN @@ -33,9 +34,32 @@ ALboolean TrapALError = AL_FALSE; -ALvoid alSetError(ALCcontext *Context, ALenum errorCode) +void alSetError(ALCcontext *context, ALenum errorCode, const char *msg, ...) { ALenum curerr = AL_NO_ERROR; + char message[1024] = { 0 }; + va_list args; + int msglen; + + va_start(args, msg); + msglen = vsnprintf(message, sizeof(message), msg, args); + va_end(args); + + if(msglen < 0 || (size_t)msglen >= sizeof(message)) + { + message[sizeof(message)-1] = 0; + msglen = (int)strlen(message); + } + if(msglen > 0) + msg = message; + else + { + msg = ""; + msglen = (int)strlen(msg); + } + + WARN("Error generated on context %p, code 0x%04x, \"%s\"\n", + context, errorCode, message); if(TrapALError) { #ifdef _WIN32 @@ -46,17 +70,30 @@ ALvoid alSetError(ALCcontext *Context, ALenum errorCode) raise(SIGTRAP); #endif } - ATOMIC_COMPARE_EXCHANGE_STRONG(ALenum, &Context->LastError, &curerr, errorCode); + + ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(&context->LastError, &curerr, errorCode); + if((ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed)&EventType_Error)) + { + ALbitfieldSOFT enabledevts; + almtx_lock(&context->EventCbLock); + enabledevts = ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed); + if((enabledevts&EventType_Error) && context->EventCb) + (*context->EventCb)(AL_EVENT_TYPE_ERROR_SOFT, 0, errorCode, msglen, msg, + context->EventParam); + almtx_unlock(&context->EventCbLock); + } } AL_API ALenum AL_APIENTRY alGetError(void) { - ALCcontext *Context; + ALCcontext *context; ALenum errorCode; - Context = GetContextRef(); - if(!Context) + context = GetContextRef(); + if(!context) { + const ALenum deferror = AL_INVALID_OPERATION; + WARN("Querying error state on null context (implicitly 0x%04x)\n", deferror); if(TrapALError) { #ifdef _WIN32 @@ -66,12 +103,11 @@ AL_API ALenum AL_APIENTRY alGetError(void) raise(SIGTRAP); #endif } - return AL_INVALID_OPERATION; + return deferror; } - errorCode = ATOMIC_EXCHANGE(ALenum, &Context->LastError, AL_NO_ERROR); - - ALCcontext_DecRef(Context); + errorCode = ATOMIC_EXCHANGE_SEQ(&context->LastError, AL_NO_ERROR); + ALCcontext_DecRef(context); return errorCode; } diff --git a/Engine/lib/openal-soft/OpenAL32/alExtension.c b/Engine/lib/openal-soft/OpenAL32/alExtension.c index 1a559d9cb..f6378c706 100644 --- a/Engine/lib/openal-soft/OpenAL32/alExtension.c +++ b/Engine/lib/openal-soft/OpenAL32/alExtension.c @@ -35,22 +35,6 @@ #include "AL/alc.h" -const struct EffectList EffectList[] = { - { "eaxreverb", EAXREVERB, "AL_EFFECT_EAXREVERB", AL_EFFECT_EAXREVERB }, - { "reverb", REVERB, "AL_EFFECT_REVERB", AL_EFFECT_REVERB }, - { "chorus", CHORUS, "AL_EFFECT_CHORUS", AL_EFFECT_CHORUS }, - { "compressor", COMPRESSOR, "AL_EFFECT_COMPRESSOR", AL_EFFECT_COMPRESSOR }, - { "distortion", DISTORTION, "AL_EFFECT_DISTORTION", AL_EFFECT_DISTORTION }, - { "echo", ECHO, "AL_EFFECT_ECHO", AL_EFFECT_ECHO }, - { "equalizer", EQUALIZER, "AL_EFFECT_EQUALIZER", AL_EFFECT_EQUALIZER }, - { "flanger", FLANGER, "AL_EFFECT_FLANGER", AL_EFFECT_FLANGER }, - { "modulator", MODULATOR, "AL_EFFECT_RING_MODULATOR", AL_EFFECT_RING_MODULATOR }, - { "dedicated", DEDICATED, "AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT", AL_EFFECT_DEDICATED_LOW_FREQUENCY_EFFECT }, - { "dedicated", DEDICATED, "AL_EFFECT_DEDICATED_DIALOGUE", AL_EFFECT_DEDICATED_DIALOGUE }, - { NULL, 0, NULL, (ALenum)0 } -}; - - AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extName) { ALboolean ret = AL_FALSE; @@ -61,8 +45,8 @@ AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extName) context = GetContextRef(); if(!context) return AL_FALSE; - if(!(extName)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!extName) + SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer"); len = strlen(extName); ptr = context->ExtensionList; diff --git a/Engine/lib/openal-soft/OpenAL32/alFilter.c b/Engine/lib/openal-soft/OpenAL32/alFilter.c index c675d3448..7d8a886c5 100644 --- a/Engine/lib/openal-soft/OpenAL32/alFilter.c +++ b/Engine/lib/openal-soft/OpenAL32/alFilter.c @@ -25,65 +25,53 @@ #include "alMain.h" #include "alu.h" #include "alFilter.h" -#include "alThunk.h" #include "alError.h" -extern inline void LockFiltersRead(ALCdevice *device); -extern inline void UnlockFiltersRead(ALCdevice *device); -extern inline void LockFiltersWrite(ALCdevice *device); -extern inline void UnlockFiltersWrite(ALCdevice *device); -extern inline struct ALfilter *LookupFilter(ALCdevice *device, ALuint id); -extern inline struct ALfilter *RemoveFilter(ALCdevice *device, ALuint id); -extern inline void ALfilterState_clear(ALfilterState *filter); -extern inline void ALfilterState_processPassthru(ALfilterState *filter, const ALfloat *restrict src, ALuint numsamples); -extern inline ALfloat calc_rcpQ_from_slope(ALfloat gain, ALfloat slope); -extern inline ALfloat calc_rcpQ_from_bandwidth(ALfloat freq_mult, ALfloat bandwidth); +extern inline void LockFilterList(ALCdevice *device); +extern inline void UnlockFilterList(ALCdevice *device); +static ALfilter *AllocFilter(ALCcontext *context); +static void FreeFilter(ALCdevice *device, ALfilter *filter); static void InitFilterParams(ALfilter *filter, ALenum type); +static inline ALfilter *LookupFilter(ALCdevice *device, ALuint id) +{ + FilterSubList *sublist; + ALuint lidx = (id-1) >> 6; + ALsizei slidx = (id-1) & 0x3f; + + if(UNLIKELY(lidx >= VECTOR_SIZE(device->FilterList))) + return NULL; + sublist = &VECTOR_ELEM(device->FilterList, lidx); + if(UNLIKELY(sublist->FreeMask & (U64(1)<Filters + slidx; +} + AL_API ALvoid AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters) { - ALCdevice *device; ALCcontext *context; ALsizei cur = 0; - ALenum err; context = GetContextRef(); if(!context) return; if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - device = context->Device; - for(cur = 0;cur < n;cur++) + alSetError(context, AL_INVALID_VALUE, "Generating %d filters", n); + else for(cur = 0;cur < n;cur++) { - ALfilter *filter = al_calloc(16, sizeof(ALfilter)); + ALfilter *filter = AllocFilter(context); if(!filter) { alDeleteFilters(cur, filters); - SET_ERROR_AND_GOTO(context, AL_OUT_OF_MEMORY, done); - } - InitFilterParams(filter, AL_FILTER_NULL); - - err = NewThunkEntry(&filter->id); - if(err == AL_NO_ERROR) - err = InsertUIntMapEntry(&device->FilterMap, filter->id, filter); - if(err != AL_NO_ERROR) - { - FreeThunkEntry(filter->id); - memset(filter, 0, sizeof(ALfilter)); - al_free(filter); - - alDeleteFilters(cur, filters); - SET_ERROR_AND_GOTO(context, err, done); + break; } filters[cur] = filter->id; } -done: ALCcontext_DecRef(context); } @@ -98,26 +86,22 @@ AL_API ALvoid AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters) if(!context) return; device = context->Device; - LockFiltersWrite(device); + LockFilterList(device); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Deleting %d filters", n); for(i = 0;i < n;i++) { if(filters[i] && LookupFilter(device, filters[i]) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid filter ID %u", filters[i]); } for(i = 0;i < n;i++) { - if((filter=RemoveFilter(device, filters[i])) == NULL) - continue; - FreeThunkEntry(filter->id); - - memset(filter, 0, sizeof(*filter)); - al_free(filter); + if((filter=LookupFilter(device, filters[i])) != NULL) + FreeFilter(device, filter); } done: - UnlockFiltersWrite(device); + UnlockFilterList(device); ALCcontext_DecRef(context); } @@ -129,10 +113,10 @@ AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter) Context = GetContextRef(); if(!Context) return AL_FALSE; - LockFiltersRead(Context->Device); + LockFilterList(Context->Device); result = ((!filter || LookupFilter(Context->Device, filter)) ? AL_TRUE : AL_FALSE); - UnlockFiltersRead(Context->Device); + UnlockFilterList(Context->Device); ALCcontext_DecRef(Context); @@ -149,9 +133,9 @@ AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint value) if(!Context) return; Device = Context->Device; - LockFiltersWrite(Device); + LockFilterList(Device); if((ALFilter=LookupFilter(Device, filter)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter); else { if(param == AL_FILTER_TYPE) @@ -160,15 +144,15 @@ AL_API ALvoid AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint value) value == AL_FILTER_HIGHPASS || value == AL_FILTER_BANDPASS) InitFilterParams(ALFilter, value); else - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "Invalid filter type 0x%04x", value); } else { /* Call the appropriate handler */ - ALfilter_SetParami(ALFilter, Context, param, value); + ALfilter_setParami(ALFilter, Context, param, value); } } - UnlockFiltersWrite(Device); + UnlockFilterList(Device); ALCcontext_DecRef(Context); } @@ -190,15 +174,15 @@ AL_API ALvoid AL_APIENTRY alFilteriv(ALuint filter, ALenum param, const ALint *v if(!Context) return; Device = Context->Device; - LockFiltersWrite(Device); + LockFilterList(Device); if((ALFilter=LookupFilter(Device, filter)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter); else { /* Call the appropriate handler */ - ALfilter_SetParamiv(ALFilter, Context, param, values); + ALfilter_setParamiv(ALFilter, Context, param, values); } - UnlockFiltersWrite(Device); + UnlockFilterList(Device); ALCcontext_DecRef(Context); } @@ -213,15 +197,15 @@ AL_API ALvoid AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat value) if(!Context) return; Device = Context->Device; - LockFiltersWrite(Device); + LockFilterList(Device); if((ALFilter=LookupFilter(Device, filter)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter); else { /* Call the appropriate handler */ - ALfilter_SetParamf(ALFilter, Context, param, value); + ALfilter_setParamf(ALFilter, Context, param, value); } - UnlockFiltersWrite(Device); + UnlockFilterList(Device); ALCcontext_DecRef(Context); } @@ -236,15 +220,15 @@ AL_API ALvoid AL_APIENTRY alFilterfv(ALuint filter, ALenum param, const ALfloat if(!Context) return; Device = Context->Device; - LockFiltersWrite(Device); + LockFilterList(Device); if((ALFilter=LookupFilter(Device, filter)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter); else { /* Call the appropriate handler */ - ALfilter_SetParamfv(ALFilter, Context, param, values); + ALfilter_setParamfv(ALFilter, Context, param, values); } - UnlockFiltersWrite(Device); + UnlockFilterList(Device); ALCcontext_DecRef(Context); } @@ -259,9 +243,9 @@ AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *value if(!Context) return; Device = Context->Device; - LockFiltersRead(Device); + LockFilterList(Device); if((ALFilter=LookupFilter(Device, filter)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter); else { if(param == AL_FILTER_TYPE) @@ -269,10 +253,10 @@ AL_API ALvoid AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *value else { /* Call the appropriate handler */ - ALfilter_GetParami(ALFilter, Context, param, value); + ALfilter_getParami(ALFilter, Context, param, value); } } - UnlockFiltersRead(Device); + UnlockFilterList(Device); ALCcontext_DecRef(Context); } @@ -294,15 +278,15 @@ AL_API ALvoid AL_APIENTRY alGetFilteriv(ALuint filter, ALenum param, ALint *valu if(!Context) return; Device = Context->Device; - LockFiltersRead(Device); + LockFilterList(Device); if((ALFilter=LookupFilter(Device, filter)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter); else { /* Call the appropriate handler */ - ALfilter_GetParamiv(ALFilter, Context, param, values); + ALfilter_getParamiv(ALFilter, Context, param, values); } - UnlockFiltersRead(Device); + UnlockFilterList(Device); ALCcontext_DecRef(Context); } @@ -317,15 +301,15 @@ AL_API ALvoid AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *val if(!Context) return; Device = Context->Device; - LockFiltersRead(Device); + LockFilterList(Device); if((ALFilter=LookupFilter(Device, filter)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter); else { /* Call the appropriate handler */ - ALfilter_GetParamf(ALFilter, Context, param, value); + ALfilter_getParamf(ALFilter, Context, param, value); } - UnlockFiltersRead(Device); + UnlockFilterList(Device); ALCcontext_DecRef(Context); } @@ -340,134 +324,52 @@ AL_API ALvoid AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *va if(!Context) return; Device = Context->Device; - LockFiltersRead(Device); + LockFilterList(Device); if((ALFilter=LookupFilter(Device, filter)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid filter ID %u", filter); else { /* Call the appropriate handler */ - ALfilter_GetParamfv(ALFilter, Context, param, values); + ALfilter_getParamfv(ALFilter, Context, param, values); } - UnlockFiltersRead(Device); + UnlockFilterList(Device); ALCcontext_DecRef(Context); } -void ALfilterState_setParams(ALfilterState *filter, ALfilterType type, ALfloat gain, ALfloat freq_mult, ALfloat rcpQ) -{ - ALfloat alpha, sqrtgain_alpha_2; - ALfloat w0, sin_w0, cos_w0; - ALfloat a[3] = { 1.0f, 0.0f, 0.0f }; - ALfloat b[3] = { 1.0f, 0.0f, 0.0f }; - - // Limit gain to -100dB - gain = maxf(gain, 0.00001f); - - w0 = F_TAU * freq_mult; - sin_w0 = sinf(w0); - cos_w0 = cosf(w0); - alpha = sin_w0/2.0f * rcpQ; - - /* Calculate filter coefficients depending on filter type */ - switch(type) - { - case ALfilterType_HighShelf: - sqrtgain_alpha_2 = 2.0f * sqrtf(gain) * alpha; - b[0] = gain*((gain+1.0f) + (gain-1.0f)*cos_w0 + sqrtgain_alpha_2); - b[1] = -2.0f*gain*((gain-1.0f) + (gain+1.0f)*cos_w0 ); - b[2] = gain*((gain+1.0f) + (gain-1.0f)*cos_w0 - sqrtgain_alpha_2); - a[0] = (gain+1.0f) - (gain-1.0f)*cos_w0 + sqrtgain_alpha_2; - a[1] = 2.0f* ((gain-1.0f) - (gain+1.0f)*cos_w0 ); - a[2] = (gain+1.0f) - (gain-1.0f)*cos_w0 - sqrtgain_alpha_2; - break; - case ALfilterType_LowShelf: - sqrtgain_alpha_2 = 2.0f * sqrtf(gain) * alpha; - b[0] = gain*((gain+1.0f) - (gain-1.0f)*cos_w0 + sqrtgain_alpha_2); - b[1] = 2.0f*gain*((gain-1.0f) - (gain+1.0f)*cos_w0 ); - b[2] = gain*((gain+1.0f) - (gain-1.0f)*cos_w0 - sqrtgain_alpha_2); - a[0] = (gain+1.0f) + (gain-1.0f)*cos_w0 + sqrtgain_alpha_2; - a[1] = -2.0f* ((gain-1.0f) + (gain+1.0f)*cos_w0 ); - a[2] = (gain+1.0f) + (gain-1.0f)*cos_w0 - sqrtgain_alpha_2; - break; - case ALfilterType_Peaking: - gain = sqrtf(gain); - b[0] = 1.0f + alpha * gain; - b[1] = -2.0f * cos_w0; - b[2] = 1.0f - alpha * gain; - a[0] = 1.0f + alpha / gain; - a[1] = -2.0f * cos_w0; - a[2] = 1.0f - alpha / gain; - break; - - case ALfilterType_LowPass: - b[0] = (1.0f - cos_w0) / 2.0f; - b[1] = 1.0f - cos_w0; - b[2] = (1.0f - cos_w0) / 2.0f; - a[0] = 1.0f + alpha; - a[1] = -2.0f * cos_w0; - a[2] = 1.0f - alpha; - break; - case ALfilterType_HighPass: - b[0] = (1.0f + cos_w0) / 2.0f; - b[1] = -(1.0f + cos_w0); - b[2] = (1.0f + cos_w0) / 2.0f; - a[0] = 1.0f + alpha; - a[1] = -2.0f * cos_w0; - a[2] = 1.0f - alpha; - break; - case ALfilterType_BandPass: - b[0] = alpha; - b[1] = 0; - b[2] = -alpha; - a[0] = 1.0f + alpha; - a[1] = -2.0f * cos_w0; - a[2] = 1.0f - alpha; - break; - } - - filter->a1 = a[1] / a[0]; - filter->a2 = a[2] / a[0]; - filter->b0 = b[0] / a[0]; - filter->b1 = b[1] / a[0]; - filter->b2 = b[2] / a[0]; -} - - -static void lp_SetParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void lp_SetParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void lp_SetParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val) +static void ALlowpass_setParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid low-pass integer property 0x%04x", param); } +static void ALlowpass_setParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid low-pass integer-vector property 0x%04x", param); } +static void ALlowpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val) { switch(param) { case AL_LOWPASS_GAIN: if(!(val >= AL_LOWPASS_MIN_GAIN && val <= AL_LOWPASS_MAX_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Low-pass gain %f out of range", val); filter->Gain = val; break; case AL_LOWPASS_GAINHF: if(!(val >= AL_LOWPASS_MIN_GAINHF && val <= AL_LOWPASS_MAX_GAINHF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Low-pass gainhf %f out of range", val); filter->GainHF = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid low-pass float property 0x%04x", param); } } -static void lp_SetParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - lp_SetParamf(filter, context, param, vals[0]); -} +static void ALlowpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals) +{ ALlowpass_setParamf(filter, context, param, vals[0]); } -static void lp_GetParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void lp_GetParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void lp_GetParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val) +static void ALlowpass_getParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid low-pass integer property 0x%04x", param); } +static void ALlowpass_getParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid low-pass integer-vector property 0x%04x", param); } +static void ALlowpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val) { switch(param) { @@ -480,49 +382,47 @@ static void lp_GetParamf(ALfilter *filter, ALCcontext *context, ALenum param, AL break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid low-pass float property 0x%04x", param); } } -static void lp_GetParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals) -{ - lp_GetParamf(filter, context, param, vals); -} +static void ALlowpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals) +{ ALlowpass_getParamf(filter, context, param, vals); } + +DEFINE_ALFILTER_VTABLE(ALlowpass); -static void hp_SetParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void hp_SetParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void hp_SetParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val) +static void ALhighpass_setParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid high-pass integer property 0x%04x", param); } +static void ALhighpass_setParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid high-pass integer-vector property 0x%04x", param); } +static void ALhighpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val) { switch(param) { case AL_HIGHPASS_GAIN: if(!(val >= AL_HIGHPASS_MIN_GAIN && val <= AL_HIGHPASS_MAX_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "High-pass gain out of range"); filter->Gain = val; break; case AL_HIGHPASS_GAINLF: if(!(val >= AL_HIGHPASS_MIN_GAINLF && val <= AL_HIGHPASS_MAX_GAINLF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "High-pass gainlf out of range"); filter->GainLF = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid high-pass float property 0x%04x", param); } } -static void hp_SetParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - hp_SetParamf(filter, context, param, vals[0]); -} +static void ALhighpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals) +{ ALhighpass_setParamf(filter, context, param, vals[0]); } -static void hp_GetParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void hp_GetParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void hp_GetParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val) +static void ALhighpass_getParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid high-pass integer property 0x%04x", param); } +static void ALhighpass_getParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid high-pass integer-vector property 0x%04x", param); } +static void ALhighpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val) { switch(param) { @@ -535,55 +435,53 @@ static void hp_GetParamf(ALfilter *filter, ALCcontext *context, ALenum param, AL break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid high-pass float property 0x%04x", param); } } -static void hp_GetParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals) -{ - hp_GetParamf(filter, context, param, vals); -} +static void ALhighpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals) +{ ALhighpass_getParamf(filter, context, param, vals); } + +DEFINE_ALFILTER_VTABLE(ALhighpass); -static void bp_SetParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void bp_SetParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void bp_SetParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val) +static void ALbandpass_setParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid band-pass integer property 0x%04x", param); } +static void ALbandpass_setParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid band-pass integer-vector property 0x%04x", param); } +static void ALbandpass_setParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat val) { switch(param) { case AL_BANDPASS_GAIN: if(!(val >= AL_BANDPASS_MIN_GAIN && val <= AL_BANDPASS_MAX_GAIN)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Band-pass gain out of range"); filter->Gain = val; break; case AL_BANDPASS_GAINHF: if(!(val >= AL_BANDPASS_MIN_GAINHF && val <= AL_BANDPASS_MAX_GAINHF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Band-pass gainhf out of range"); filter->GainHF = val; break; case AL_BANDPASS_GAINLF: if(!(val >= AL_BANDPASS_MIN_GAINLF && val <= AL_BANDPASS_MAX_GAINLF)) - SET_ERROR_AND_RETURN(context, AL_INVALID_VALUE); + SETERR_RETURN(context, AL_INVALID_VALUE,, "Band-pass gainlf out of range"); filter->GainLF = val; break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid band-pass float property 0x%04x", param); } } -static void bp_SetParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals) -{ - bp_SetParamf(filter, context, param, vals[0]); -} +static void ALbandpass_setParamfv(ALfilter *filter, ALCcontext *context, ALenum param, const ALfloat *vals) +{ ALbandpass_setParamf(filter, context, param, vals[0]); } -static void bp_GetParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void bp_GetParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void bp_GetParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val) +static void ALbandpass_getParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid band-pass integer property 0x%04x", param); } +static void ALbandpass_getParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid band-pass integer-vector property 0x%04x", param); } +static void ALbandpass_getParamf(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *val) { switch(param) { @@ -600,47 +498,131 @@ static void bp_GetParamf(ALfilter *filter, ALCcontext *context, ALenum param, AL break; default: - SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); + alSetError(context, AL_INVALID_ENUM, "Invalid band-pass float property 0x%04x", param); } } -static void bp_GetParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals) +static void ALbandpass_getParamfv(ALfilter *filter, ALCcontext *context, ALenum param, ALfloat *vals) +{ ALbandpass_getParamf(filter, context, param, vals); } + +DEFINE_ALFILTER_VTABLE(ALbandpass); + + +static void ALnullfilter_setParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); } +static void ALnullfilter_setParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, const ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); } +static void ALnullfilter_setParamf(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALfloat UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); } +static void ALnullfilter_setParamfv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, const ALfloat *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); } + +static void ALnullfilter_getParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); } +static void ALnullfilter_getParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALint *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); } +static void ALnullfilter_getParamf(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALfloat *UNUSED(val)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); } +static void ALnullfilter_getParamfv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum param, ALfloat *UNUSED(vals)) +{ alSetError(context, AL_INVALID_ENUM, "Invalid null filter property 0x%04x", param); } + +DEFINE_ALFILTER_VTABLE(ALnullfilter); + + +static ALfilter *AllocFilter(ALCcontext *context) { - bp_GetParamf(filter, context, param, vals); -} + ALCdevice *device = context->Device; + FilterSubList *sublist, *subend; + ALfilter *filter = NULL; + ALsizei lidx = 0; + ALsizei slidx; - -static void null_SetParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void null_SetParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), const ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void null_SetParamf(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALfloat UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void null_SetParamfv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), const ALfloat *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } - -static void null_GetParami(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void null_GetParamiv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALint *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void null_GetParamf(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALfloat *UNUSED(val)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } -static void null_GetParamfv(ALfilter *UNUSED(filter), ALCcontext *context, ALenum UNUSED(param), ALfloat *UNUSED(vals)) -{ SET_ERROR_AND_RETURN(context, AL_INVALID_ENUM); } - - -ALvoid ReleaseALFilters(ALCdevice *device) -{ - ALsizei i; - for(i = 0;i < device->FilterMap.size;i++) + almtx_lock(&device->FilterLock); + sublist = VECTOR_BEGIN(device->FilterList); + subend = VECTOR_END(device->FilterList); + for(;sublist != subend;++sublist) { - ALfilter *temp = device->FilterMap.values[i]; - device->FilterMap.values[i] = NULL; - - // Release filter structure - FreeThunkEntry(temp->id); - memset(temp, 0, sizeof(ALfilter)); - al_free(temp); + if(sublist->FreeMask) + { + slidx = CTZ64(sublist->FreeMask); + filter = sublist->Filters + slidx; + break; + } + ++lidx; } + if(UNLIKELY(!filter)) + { + const FilterSubList empty_sublist = { 0, NULL }; + /* Don't allocate so many list entries that the 32-bit ID could + * overflow... + */ + if(UNLIKELY(VECTOR_SIZE(device->FilterList) >= 1<<25)) + { + almtx_unlock(&device->FilterLock); + alSetError(context, AL_OUT_OF_MEMORY, "Too many filters allocated"); + return NULL; + } + lidx = (ALsizei)VECTOR_SIZE(device->FilterList); + VECTOR_PUSH_BACK(device->FilterList, empty_sublist); + sublist = &VECTOR_BACK(device->FilterList); + sublist->FreeMask = ~U64(0); + sublist->Filters = al_calloc(16, sizeof(ALfilter)*64); + if(UNLIKELY(!sublist->Filters)) + { + VECTOR_POP_BACK(device->FilterList); + almtx_unlock(&device->FilterLock); + alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate filter batch"); + return NULL; + } + + slidx = 0; + filter = sublist->Filters + slidx; + } + + memset(filter, 0, sizeof(*filter)); + InitFilterParams(filter, AL_FILTER_NULL); + + /* Add 1 to avoid filter ID 0. */ + filter->id = ((lidx<<6) | slidx) + 1; + + sublist->FreeMask &= ~(U64(1)<FilterLock); + + return filter; +} + +static void FreeFilter(ALCdevice *device, ALfilter *filter) +{ + ALuint id = filter->id - 1; + ALsizei lidx = id >> 6; + ALsizei slidx = id & 0x3f; + + memset(filter, 0, sizeof(*filter)); + + VECTOR_ELEM(device->FilterList, lidx).FreeMask |= U64(1) << slidx; +} + +void ReleaseALFilters(ALCdevice *device) +{ + FilterSubList *sublist = VECTOR_BEGIN(device->FilterList); + FilterSubList *subend = VECTOR_END(device->FilterList); + size_t leftover = 0; + for(;sublist != subend;++sublist) + { + ALuint64 usemask = ~sublist->FreeMask; + while(usemask) + { + ALsizei idx = CTZ64(usemask); + ALfilter *filter = sublist->Filters + idx; + + memset(filter, 0, sizeof(*filter)); + ++leftover; + + usemask &= ~(U64(1) << idx); + } + sublist->FreeMask = ~usemask; + } + if(leftover > 0) + WARN("(%p) Deleted "SZFMT" Filter%s\n", device, leftover, (leftover==1)?"":"s"); } @@ -653,15 +635,7 @@ static void InitFilterParams(ALfilter *filter, ALenum type) filter->HFReference = LOWPASSFREQREF; filter->GainLF = 1.0f; filter->LFReference = HIGHPASSFREQREF; - - filter->SetParami = lp_SetParami; - filter->SetParamiv = lp_SetParamiv; - filter->SetParamf = lp_SetParamf; - filter->SetParamfv = lp_SetParamfv; - filter->GetParami = lp_GetParami; - filter->GetParamiv = lp_GetParamiv; - filter->GetParamf = lp_GetParamf; - filter->GetParamfv = lp_GetParamfv; + filter->vtab = &ALlowpass_vtable; } else if(type == AL_FILTER_HIGHPASS) { @@ -670,15 +644,7 @@ static void InitFilterParams(ALfilter *filter, ALenum type) filter->HFReference = LOWPASSFREQREF; filter->GainLF = AL_HIGHPASS_DEFAULT_GAINLF; filter->LFReference = HIGHPASSFREQREF; - - filter->SetParami = hp_SetParami; - filter->SetParamiv = hp_SetParamiv; - filter->SetParamf = hp_SetParamf; - filter->SetParamfv = hp_SetParamfv; - filter->GetParami = hp_GetParami; - filter->GetParamiv = hp_GetParamiv; - filter->GetParamf = hp_GetParamf; - filter->GetParamfv = hp_GetParamfv; + filter->vtab = &ALhighpass_vtable; } else if(type == AL_FILTER_BANDPASS) { @@ -687,15 +653,7 @@ static void InitFilterParams(ALfilter *filter, ALenum type) filter->HFReference = LOWPASSFREQREF; filter->GainLF = AL_BANDPASS_DEFAULT_GAINLF; filter->LFReference = HIGHPASSFREQREF; - - filter->SetParami = bp_SetParami; - filter->SetParamiv = bp_SetParamiv; - filter->SetParamf = bp_SetParamf; - filter->SetParamfv = bp_SetParamfv; - filter->GetParami = bp_GetParami; - filter->GetParamiv = bp_GetParamiv; - filter->GetParamf = bp_GetParamf; - filter->GetParamfv = bp_GetParamfv; + filter->vtab = &ALbandpass_vtable; } else { @@ -704,15 +662,7 @@ static void InitFilterParams(ALfilter *filter, ALenum type) filter->HFReference = LOWPASSFREQREF; filter->GainLF = 1.0f; filter->LFReference = HIGHPASSFREQREF; - - filter->SetParami = null_SetParami; - filter->SetParamiv = null_SetParamiv; - filter->SetParamf = null_SetParamf; - filter->SetParamfv = null_SetParamfv; - filter->GetParami = null_GetParami; - filter->GetParamiv = null_GetParamiv; - filter->GetParamf = null_GetParamf; - filter->GetParamfv = null_GetParamfv; + filter->vtab = &ALnullfilter_vtable; } filter->type = type; } diff --git a/Engine/lib/openal-soft/OpenAL32/alListener.c b/Engine/lib/openal-soft/OpenAL32/alListener.c index 08ece19db..f1ac3ff4a 100644 --- a/Engine/lib/openal-soft/OpenAL32/alListener.c +++ b/Engine/lib/openal-soft/OpenAL32/alListener.c @@ -21,85 +21,101 @@ #include "config.h" #include "alMain.h" -#include "AL/alc.h" +#include "alu.h" #include "alError.h" #include "alListener.h" #include "alSource.h" +#define DO_UPDATEPROPS() do { \ + if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) \ + UpdateListenerProps(context); \ + else \ + ATOMIC_FLAG_CLEAR(&listener->PropsClean, almemory_order_release); \ +} while(0) + + AL_API ALvoid AL_APIENTRY alListenerf(ALenum param, ALfloat value) { + ALlistener *listener; ALCcontext *context; context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); + listener = context->Listener; + almtx_lock(&context->PropLock); switch(param) { case AL_GAIN: if(!(value >= 0.0f && isfinite(value))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - context->Listener->Gain = value; + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Listener gain out of range"); + listener->Gain = value; + DO_UPDATEPROPS(); break; case AL_METERS_PER_UNIT: - if(!(value >= 0.0f && isfinite(value))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - context->Listener->MetersPerUnit = value; + if(!(value >= AL_MIN_METERS_PER_UNIT && value <= AL_MAX_METERS_PER_UNIT)) + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Listener meters per unit out of range"); + context->MetersPerUnit = value; + if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) + UpdateContextProps(context); + else + ATOMIC_FLAG_CLEAR(&context->PropsClean, almemory_order_release); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener float property"); } - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); done: - WriteUnlock(&context->PropLock); + almtx_unlock(&context->PropLock); ALCcontext_DecRef(context); } AL_API ALvoid AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat value2, ALfloat value3) { + ALlistener *listener; ALCcontext *context; context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); + listener = context->Listener; + almtx_lock(&context->PropLock); switch(param) { case AL_POSITION: if(!(isfinite(value1) && isfinite(value2) && isfinite(value3))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - context->Listener->Position[0] = value1; - context->Listener->Position[1] = value2; - context->Listener->Position[2] = value3; + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Listener position out of range"); + listener->Position[0] = value1; + listener->Position[1] = value2; + listener->Position[2] = value3; + DO_UPDATEPROPS(); break; case AL_VELOCITY: if(!(isfinite(value1) && isfinite(value2) && isfinite(value3))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - context->Listener->Velocity[0] = value1; - context->Listener->Velocity[1] = value2; - context->Listener->Velocity[2] = value3; + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Listener velocity out of range"); + listener->Velocity[0] = value1; + listener->Velocity[1] = value2; + listener->Velocity[2] = value3; + DO_UPDATEPROPS(); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener 3-float property"); } - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); done: - WriteUnlock(&context->PropLock); + almtx_unlock(&context->PropLock); ALCcontext_DecRef(context); } AL_API ALvoid AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values) { + ALlistener *listener; ALCcontext *context; if(values) @@ -121,32 +137,31 @@ AL_API ALvoid AL_APIENTRY alListenerfv(ALenum param, const ALfloat *values) context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + listener = context->Listener; + almtx_lock(&context->PropLock); + if(!values) SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer"); switch(param) { case AL_ORIENTATION: if(!(isfinite(values[0]) && isfinite(values[1]) && isfinite(values[2]) && isfinite(values[3]) && isfinite(values[4]) && isfinite(values[5]))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Listener orientation out of range"); /* AT then UP */ - context->Listener->Forward[0] = values[0]; - context->Listener->Forward[1] = values[1]; - context->Listener->Forward[2] = values[2]; - context->Listener->Up[0] = values[3]; - context->Listener->Up[1] = values[4]; - context->Listener->Up[2] = values[5]; + listener->Forward[0] = values[0]; + listener->Forward[1] = values[1]; + listener->Forward[2] = values[2]; + listener->Up[0] = values[3]; + listener->Up[1] = values[4]; + listener->Up[2] = values[5]; + DO_UPDATEPROPS(); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener float-vector property"); } - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); done: - WriteUnlock(&context->PropLock); + almtx_unlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -158,17 +173,14 @@ AL_API ALvoid AL_APIENTRY alListeneri(ALenum param, ALint UNUSED(value)) context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); + almtx_lock(&context->PropLock); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener integer property"); } - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); + almtx_unlock(&context->PropLock); -done: - WriteUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -188,17 +200,14 @@ AL_API void AL_APIENTRY alListener3i(ALenum param, ALint value1, ALint value2, A context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); + almtx_lock(&context->PropLock); switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener 3-integer property"); } - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); + almtx_unlock(&context->PropLock); -done: - WriteUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -232,19 +241,16 @@ AL_API void AL_APIENTRY alListeneriv(ALenum param, const ALint *values) context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + almtx_lock(&context->PropLock); + if(!values) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener integer-vector property"); } - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); + almtx_unlock(&context->PropLock); -done: - WriteUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -256,25 +262,24 @@ AL_API ALvoid AL_APIENTRY alGetListenerf(ALenum param, ALfloat *value) context = GetContextRef(); if(!context) return; - ReadLock(&context->PropLock); - if(!(value)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + almtx_lock(&context->PropLock); + if(!value) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { case AL_GAIN: *value = context->Listener->Gain; break; case AL_METERS_PER_UNIT: - *value = context->Listener->MetersPerUnit; + *value = context->MetersPerUnit; break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener float property"); } + almtx_unlock(&context->PropLock); -done: - ReadUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -286,10 +291,10 @@ AL_API ALvoid AL_APIENTRY alGetListener3f(ALenum param, ALfloat *value1, ALfloat context = GetContextRef(); if(!context) return; - ReadLock(&context->PropLock); - if(!(value1 && value2 && value3)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + almtx_lock(&context->PropLock); + if(!value1 || !value2 || !value3) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { case AL_POSITION: *value1 = context->Listener->Position[0]; @@ -304,11 +309,10 @@ AL_API ALvoid AL_APIENTRY alGetListener3f(ALenum param, ALfloat *value1, ALfloat break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener 3-float property"); } + almtx_unlock(&context->PropLock); -done: - ReadUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -333,10 +337,10 @@ AL_API ALvoid AL_APIENTRY alGetListenerfv(ALenum param, ALfloat *values) context = GetContextRef(); if(!context) return; - ReadLock(&context->PropLock); - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + almtx_lock(&context->PropLock); + if(!values) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { case AL_ORIENTATION: // AT then UP @@ -349,11 +353,10 @@ AL_API ALvoid AL_APIENTRY alGetListenerfv(ALenum param, ALfloat *values) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener float-vector property"); } + almtx_unlock(&context->PropLock); -done: - ReadUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -365,17 +368,16 @@ AL_API ALvoid AL_APIENTRY alGetListeneri(ALenum param, ALint *value) context = GetContextRef(); if(!context) return; - ReadLock(&context->PropLock); - if(!(value)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + almtx_lock(&context->PropLock); + if(!value) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener integer property"); } + almtx_unlock(&context->PropLock); -done: - ReadUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -387,10 +389,10 @@ AL_API void AL_APIENTRY alGetListener3i(ALenum param, ALint *value1, ALint *valu context = GetContextRef(); if(!context) return; - ReadLock(&context->PropLock); - if(!(value1 && value2 && value3)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch (param) + almtx_lock(&context->PropLock); + if(!value1 || !value2 || !value3) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { case AL_POSITION: *value1 = (ALint)context->Listener->Position[0]; @@ -405,11 +407,10 @@ AL_API void AL_APIENTRY alGetListener3i(ALenum param, ALint *value1, ALint *valu break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener 3-integer property"); } + almtx_unlock(&context->PropLock); -done: - ReadUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -429,10 +430,10 @@ AL_API void AL_APIENTRY alGetListeneriv(ALenum param, ALint* values) context = GetContextRef(); if(!context) return; - ReadLock(&context->PropLock); - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - switch(param) + almtx_lock(&context->PropLock); + if(!values) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + else switch(param) { case AL_ORIENTATION: // AT then UP @@ -445,11 +446,10 @@ AL_API void AL_APIENTRY alGetListeneriv(ALenum param, ALint* values) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_ENUM, "Invalid listener integer-vector property"); } + almtx_unlock(&context->PropLock); -done: - ReadUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -460,7 +460,7 @@ void UpdateListenerProps(ALCcontext *context) struct ALlistenerProps *props; /* Get an unused proprty container, or allocate a new one as needed. */ - props = ATOMIC_LOAD(&listener->FreeList, almemory_order_acquire); + props = ATOMIC_LOAD(&context->FreeListenerProps, almemory_order_acquire); if(!props) props = al_calloc(16, sizeof(*props)); else @@ -468,48 +468,35 @@ void UpdateListenerProps(ALCcontext *context) struct ALlistenerProps *next; do { next = ATOMIC_LOAD(&props->next, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALlistenerProps*, - &listener->FreeList, &props, next, almemory_order_seq_cst, - almemory_order_consume) == 0); + } while(ATOMIC_COMPARE_EXCHANGE_PTR_WEAK(&context->FreeListenerProps, &props, next, + almemory_order_seq_cst, almemory_order_acquire) == 0); } /* Copy in current property values. */ - ATOMIC_STORE(&props->Position[0], listener->Position[0], almemory_order_relaxed); - ATOMIC_STORE(&props->Position[1], listener->Position[1], almemory_order_relaxed); - ATOMIC_STORE(&props->Position[2], listener->Position[2], almemory_order_relaxed); + props->Position[0] = listener->Position[0]; + props->Position[1] = listener->Position[1]; + props->Position[2] = listener->Position[2]; - ATOMIC_STORE(&props->Velocity[0], listener->Velocity[0], almemory_order_relaxed); - ATOMIC_STORE(&props->Velocity[1], listener->Velocity[1], almemory_order_relaxed); - ATOMIC_STORE(&props->Velocity[2], listener->Velocity[2], almemory_order_relaxed); + props->Velocity[0] = listener->Velocity[0]; + props->Velocity[1] = listener->Velocity[1]; + props->Velocity[2] = listener->Velocity[2]; - ATOMIC_STORE(&props->Forward[0], listener->Forward[0], almemory_order_relaxed); - ATOMIC_STORE(&props->Forward[1], listener->Forward[1], almemory_order_relaxed); - ATOMIC_STORE(&props->Forward[2], listener->Forward[2], almemory_order_relaxed); - ATOMIC_STORE(&props->Up[0], listener->Up[0], almemory_order_relaxed); - ATOMIC_STORE(&props->Up[1], listener->Up[1], almemory_order_relaxed); - ATOMIC_STORE(&props->Up[2], listener->Up[2], almemory_order_relaxed); + props->Forward[0] = listener->Forward[0]; + props->Forward[1] = listener->Forward[1]; + props->Forward[2] = listener->Forward[2]; + props->Up[0] = listener->Up[0]; + props->Up[1] = listener->Up[1]; + props->Up[2] = listener->Up[2]; - ATOMIC_STORE(&props->Gain, listener->Gain, almemory_order_relaxed); - ATOMIC_STORE(&props->MetersPerUnit, listener->MetersPerUnit, almemory_order_relaxed); - - ATOMIC_STORE(&props->DopplerFactor, context->DopplerFactor, almemory_order_relaxed); - ATOMIC_STORE(&props->DopplerVelocity, context->DopplerVelocity, almemory_order_relaxed); - ATOMIC_STORE(&props->SpeedOfSound, context->SpeedOfSound, almemory_order_relaxed); - - ATOMIC_STORE(&props->SourceDistanceModel, context->SourceDistanceModel, almemory_order_relaxed); - ATOMIC_STORE(&props->DistanceModel, context->DistanceModel, almemory_order_relaxed); + props->Gain = listener->Gain; /* Set the new container for updating internal parameters. */ - props = ATOMIC_EXCHANGE(struct ALlistenerProps*, &listener->Update, props, almemory_order_acq_rel); + props = ATOMIC_EXCHANGE_PTR(&listener->Update, props, almemory_order_acq_rel); if(props) { /* If there was an unused update container, put it back in the * freelist. */ - struct ALlistenerProps *first = ATOMIC_LOAD(&listener->FreeList); - do { - ATOMIC_STORE(&props->next, first, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALlistenerProps*, - &listener->FreeList, &first, props) == 0); + ATOMIC_REPLACE_HEAD(struct ALlistenerProps*, &context->FreeListenerProps, props); } } diff --git a/Engine/lib/openal-soft/OpenAL32/alSource.c b/Engine/lib/openal-soft/OpenAL32/alSource.c index f20498f48..ed6bd8ee3 100644 --- a/Engine/lib/openal-soft/OpenAL32/alSource.c +++ b/Engine/lib/openal-soft/OpenAL32/alSource.c @@ -31,8 +31,9 @@ #include "alError.h" #include "alSource.h" #include "alBuffer.h" -#include "alThunk.h" +#include "alFilter.h" #include "alAuxEffectSlot.h" +#include "ringbuffer.h" #include "backends/base.h" @@ -40,20 +41,72 @@ #include "almalloc.h" -extern inline void LockSourcesRead(ALCcontext *context); -extern inline void UnlockSourcesRead(ALCcontext *context); -extern inline void LockSourcesWrite(ALCcontext *context); -extern inline void UnlockSourcesWrite(ALCcontext *context); -extern inline struct ALsource *LookupSource(ALCcontext *context, ALuint id); -extern inline struct ALsource *RemoveSource(ALCcontext *context, ALuint id); +static ALsource *AllocSource(ALCcontext *context); +static void FreeSource(ALCcontext *context, ALsource *source); +static void InitSourceParams(ALsource *Source, ALsizei num_sends); +static void DeinitSource(ALsource *source, ALsizei num_sends); +static void UpdateSourceProps(ALsource *source, ALvoice *voice, ALsizei num_sends, ALCcontext *context); +static ALint64 GetSourceSampleOffset(ALsource *Source, ALCcontext *context, ALuint64 *clocktime); +static ALdouble GetSourceSecOffset(ALsource *Source, ALCcontext *context, ALuint64 *clocktime); +static ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCcontext *context); +static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALsizei *frac); +static ALboolean ApplyOffset(ALsource *Source, ALvoice *voice); + +static inline void LockSourceList(ALCcontext *context) +{ almtx_lock(&context->SourceLock); } +static inline void UnlockSourceList(ALCcontext *context) +{ almtx_unlock(&context->SourceLock); } + +static inline ALsource *LookupSource(ALCcontext *context, ALuint id) +{ + SourceSubList *sublist; + ALuint lidx = (id-1) >> 6; + ALsizei slidx = (id-1) & 0x3f; + + if(UNLIKELY(lidx >= VECTOR_SIZE(context->SourceList))) + return NULL; + sublist = &VECTOR_ELEM(context->SourceList, lidx); + if(UNLIKELY(sublist->FreeMask & (U64(1)<Sources + slidx; +} + +static inline ALbuffer *LookupBuffer(ALCdevice *device, ALuint id) +{ + BufferSubList *sublist; + ALuint lidx = (id-1) >> 6; + ALsizei slidx = (id-1) & 0x3f; + + if(UNLIKELY(lidx >= VECTOR_SIZE(device->BufferList))) + return NULL; + sublist = &VECTOR_ELEM(device->BufferList, lidx); + if(UNLIKELY(sublist->FreeMask & (U64(1)<Buffers + slidx; +} + +static inline ALfilter *LookupFilter(ALCdevice *device, ALuint id) +{ + FilterSubList *sublist; + ALuint lidx = (id-1) >> 6; + ALsizei slidx = (id-1) & 0x3f; + + if(UNLIKELY(lidx >= VECTOR_SIZE(device->FilterList))) + return NULL; + sublist = &VECTOR_ELEM(device->FilterList, lidx); + if(UNLIKELY(sublist->FreeMask & (U64(1)<Filters + slidx; +} + +static inline ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id) +{ + id--; + if(UNLIKELY(id >= VECTOR_SIZE(context->EffectSlotList))) + return NULL; + return VECTOR_ELEM(context->EffectSlotList, id); +} -static void InitSourceParams(ALsource *Source); -static void DeinitSource(ALsource *source); -static void UpdateSourceProps(ALsource *source, ALuint num_sends); -static ALint64 GetSourceSampleOffset(ALsource *Source, ALCdevice *device, ALuint64 *clocktime); -static ALdouble GetSourceSecOffset(ALsource *Source, ALCdevice *device, ALuint64 *clocktime); -static ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCdevice *device); -static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALuint *frac); typedef enum SourceProp { srcPitch = AL_PITCH, @@ -99,10 +152,6 @@ typedef enum SourceProp { /* AL_EXT_source_distance_model */ srcDistanceModel = AL_DISTANCE_MODEL, - srcByteLengthSOFT = AL_BYTE_LENGTH_SOFT, - srcSampleLengthSOFT = AL_SAMPLE_LENGTH_SOFT, - srcSecLengthSOFT = AL_SEC_LENGTH_SOFT, - /* AL_SOFT_source_latency */ srcSampleOffsetLatencySOFT = AL_SAMPLE_OFFSET_LATENCY_SOFT, srcSecOffsetLatencySOFT = AL_SEC_OFFSET_LATENCY_SOFT, @@ -115,6 +164,16 @@ typedef enum SourceProp { /* AL_EXT_BFORMAT */ srcOrientation = AL_ORIENTATION, + + /* AL_SOFT_source_resampler */ + srcResampler = AL_SOURCE_RESAMPLER_SOFT, + + /* AL_SOFT_source_spatialize */ + srcSpatialize = AL_SOURCE_SPATIALIZE_SOFT, + + /* ALC_SOFT_device_clock */ + srcSampleOffsetClockSOFT = AL_SAMPLE_OFFSET_CLOCK_SOFT, + srcSecOffsetClockSOFT = AL_SEC_OFFSET_CLOCK_SOFT, } SourceProp; static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALfloat *values); @@ -125,12 +184,76 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint *values); static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint64 *values); -static inline bool SourceShouldUpdate(const ALsource *source, const ALCcontext *context) +static inline ALvoice *GetSourceVoice(ALsource *source, ALCcontext *context) { - return (source->state == AL_PLAYING || source->state == AL_PAUSED) && - !ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire); + ALint idx = source->VoiceIdx; + if(idx >= 0 && idx < context->VoiceCount) + { + ALvoice *voice = context->Voices[idx]; + if(ATOMIC_LOAD(&voice->Source, almemory_order_acquire) == source) + return voice; + } + source->VoiceIdx = -1; + return NULL; } +/** + * Returns if the last known state for the source was playing or paused. Does + * not sync with the mixer voice. + */ +static inline bool IsPlayingOrPaused(ALsource *source) +{ return source->state == AL_PLAYING || source->state == AL_PAUSED; } + +/** + * Returns an updated source state using the matching voice's status (or lack + * thereof). + */ +static inline ALenum GetSourceState(ALsource *source, ALvoice *voice) +{ + if(!voice && source->state == AL_PLAYING) + source->state = AL_STOPPED; + return source->state; +} + +/** + * Returns if the source should specify an update, given the context's + * deferring state and the source's last known state. + */ +static inline bool SourceShouldUpdate(ALsource *source, ALCcontext *context) +{ + return !ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) && + IsPlayingOrPaused(source); +} + + +/** Can only be called while the mixer is locked! */ +static void SendStateChangeEvent(ALCcontext *context, ALuint id, ALenum state) +{ + ALbitfieldSOFT enabledevt; + AsyncEvent evt; + + enabledevt = ATOMIC_LOAD(&context->EnabledEvts, almemory_order_acquire); + if(!(enabledevt&EventType_SourceStateChange)) return; + + evt.EnumType = EventType_SourceStateChange; + evt.Type = AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT; + evt.ObjectId = id; + evt.Param = state; + snprintf(evt.Message, sizeof(evt.Message), "Source ID %u state changed to %s", id, + (state==AL_INITIAL) ? "AL_INITIAL" : + (state==AL_PLAYING) ? "AL_PLAYING" : + (state==AL_PAUSED) ? "AL_PAUSED" : + (state==AL_STOPPED) ? "AL_STOPPED" : "" + ); + /* The mixer may have queued a state change that's not yet been processed, + * and we don't want state change messages to occur out of order, so send + * it through the async queue to ensure proper ordering. + */ + if(ll_ringbuffer_write(context->AsyncEvents, (const char*)&evt, 1) == 1) + alsem_post(&context->EventSem); +} + + static ALint FloatValsByProp(ALenum prop) { if(prop != (ALenum)((SourceProp)prop)) @@ -165,10 +288,9 @@ static ALint FloatValsByProp(ALenum prop) case AL_BUFFERS_QUEUED: case AL_BUFFERS_PROCESSED: case AL_SOURCE_TYPE: - case AL_BYTE_LENGTH_SOFT: - case AL_SAMPLE_LENGTH_SOFT: - case AL_SEC_LENGTH_SOFT: case AL_SOURCE_RADIUS: + case AL_SOURCE_RESAMPLER_SOFT: + case AL_SOURCE_SPATIALIZE_SOFT: return 1; case AL_STEREO_ANGLES: @@ -183,6 +305,7 @@ static ALint FloatValsByProp(ALenum prop) return 6; case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: break; /* Double only */ case AL_BUFFER: @@ -190,6 +313,7 @@ static ALint FloatValsByProp(ALenum prop) case AL_AUXILIARY_SEND_FILTER: break; /* i/i64 only */ case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: break; /* i64 only */ } return 0; @@ -228,13 +352,13 @@ static ALint DoubleValsByProp(ALenum prop) case AL_BUFFERS_QUEUED: case AL_BUFFERS_PROCESSED: case AL_SOURCE_TYPE: - case AL_BYTE_LENGTH_SOFT: - case AL_SAMPLE_LENGTH_SOFT: - case AL_SEC_LENGTH_SOFT: case AL_SOURCE_RADIUS: + case AL_SOURCE_RESAMPLER_SOFT: + case AL_SOURCE_SPATIALIZE_SOFT: return 1; case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: case AL_STEREO_ANGLES: return 2; @@ -251,6 +375,7 @@ static ALint DoubleValsByProp(ALenum prop) case AL_AUXILIARY_SEND_FILTER: break; /* i/i64 only */ case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: break; /* i64 only */ } return 0; @@ -292,10 +417,9 @@ static ALint IntValsByProp(ALenum prop) case AL_BUFFERS_PROCESSED: case AL_SOURCE_TYPE: case AL_DIRECT_FILTER: - case AL_BYTE_LENGTH_SOFT: - case AL_SAMPLE_LENGTH_SOFT: - case AL_SEC_LENGTH_SOFT: case AL_SOURCE_RADIUS: + case AL_SOURCE_RESAMPLER_SOFT: + case AL_SOURCE_SPATIALIZE_SOFT: return 1; case AL_POSITION: @@ -308,8 +432,10 @@ static ALint IntValsByProp(ALenum prop) return 6; case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: break; /* i64 only */ case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: break; /* Double only */ case AL_STEREO_ANGLES: break; /* Float/double only */ @@ -352,13 +478,13 @@ static ALint Int64ValsByProp(ALenum prop) case AL_BUFFERS_PROCESSED: case AL_SOURCE_TYPE: case AL_DIRECT_FILTER: - case AL_BYTE_LENGTH_SOFT: - case AL_SAMPLE_LENGTH_SOFT: - case AL_SEC_LENGTH_SOFT: case AL_SOURCE_RADIUS: + case AL_SOURCE_RESAMPLER_SOFT: + case AL_SOURCE_SPATIALIZE_SOFT: return 1; case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: return 2; case AL_POSITION: @@ -371,6 +497,7 @@ static ALint Int64ValsByProp(ALenum prop) return 6; case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: break; /* Double only */ case AL_STEREO_ANGLES: break; /* Float/double only */ @@ -381,12 +508,19 @@ static ALint Int64ValsByProp(ALenum prop) #define CHECKVAL(x) do { \ if(!(x)) \ - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE); \ + { \ + alSetError(Context, AL_INVALID_VALUE, "Value out of range"); \ + return AL_FALSE; \ + } \ } while(0) #define DO_UPDATEPROPS() do { \ - if(SourceShouldUpdate(Source, Context)) \ - UpdateSourceProps(Source, device->NumAuxSends); \ + ALvoice *voice; \ + if(SourceShouldUpdate(Source, Context) && \ + (voice=GetSourceVoice(Source, Context)) != NULL) \ + UpdateSourceProps(Source, voice, device->NumAuxSends, Context); \ + else \ + ATOMIC_FLAG_CLEAR(&Source->PropsClean, almemory_order_release); \ } while(0) static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALfloat *values) @@ -396,12 +530,11 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p switch(prop) { - case AL_BYTE_LENGTH_SOFT: - case AL_SAMPLE_LENGTH_SOFT: - case AL_SEC_LENGTH_SOFT: case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: /* Query only */ - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_OPERATION, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_OPERATION, AL_FALSE, + "Setting read-only source property 0x%04x", prop); case AL_PITCH: CHECKVAL(*values >= 0.0f); @@ -441,7 +574,7 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_ROLLOFF_FACTOR: CHECKVAL(*values >= 0.0f); - Source->RollOffFactor = *values; + Source->RolloffFactor = *values; DO_UPDATEPROPS(); return AL_TRUE; @@ -509,19 +642,24 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p Source->OffsetType = prop; Source->Offset = *values; - if((Source->state == AL_PLAYING || Source->state == AL_PAUSED) && - !ATOMIC_LOAD(&Context->DeferUpdates, almemory_order_acquire)) + if(IsPlayingOrPaused(Source)) { - LockContext(Context); - WriteLock(&Source->queue_lock); - if(ApplyOffset(Source) == AL_FALSE) + ALvoice *voice; + + ALCdevice_Lock(Context->Device); + /* Double-check that the source is still playing while we have + * the lock. + */ + voice = GetSourceVoice(Source, Context); + if(voice) { - WriteUnlock(&Source->queue_lock); - UnlockContext(Context); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE); + if(ApplyOffset(Source, voice) == AL_FALSE) + { + ALCdevice_Unlock(Context->Device); + SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid offset"); + } } - WriteUnlock(&Source->queue_lock); - UnlockContext(Context); + ALCdevice_Unlock(Context->Device); } return AL_TRUE; @@ -591,6 +729,8 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO: case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO: case AL_DIRECT_CHANNELS_SOFT: + case AL_SOURCE_RESAMPLER_SOFT: + case AL_SOURCE_SPATIALIZE_SOFT: ival = (ALint)values[0]; return SetSourceiv(Source, Context, prop, &ival); @@ -603,11 +743,12 @@ static ALboolean SetSourcefv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_DIRECT_FILTER: case AL_AUXILIARY_SEND_FILTER: case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: break; } ERR("Unexpected property: 0x%04x\n", prop); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_ENUM, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source float property 0x%04x", prop); } static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALint *values) @@ -617,7 +758,6 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p ALfilter *filter = NULL; ALeffectslot *slot = NULL; ALbufferlistitem *oldlist; - ALbufferlistitem *newlist; ALfloat fvals[6]; switch(prop) @@ -626,11 +766,9 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_SOURCE_TYPE: case AL_BUFFERS_QUEUED: case AL_BUFFERS_PROCESSED: - case AL_BYTE_LENGTH_SOFT: - case AL_SAMPLE_LENGTH_SOFT: - case AL_SEC_LENGTH_SOFT: /* Query only */ - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_OPERATION, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_OPERATION, AL_FALSE, + "Setting read-only source property 0x%04x", prop); case AL_SOURCE_RELATIVE: CHECKVAL(*values == AL_FALSE || *values == AL_TRUE); @@ -642,63 +780,91 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_LOOPING: CHECKVAL(*values == AL_FALSE || *values == AL_TRUE); - WriteLock(&Source->queue_lock); - ATOMIC_STORE(&Source->looping, *values); - WriteUnlock(&Source->queue_lock); + Source->Looping = (ALboolean)*values; + if(IsPlayingOrPaused(Source)) + { + ALvoice *voice = GetSourceVoice(Source, Context); + if(voice) + { + if(Source->Looping) + ATOMIC_STORE(&voice->loop_buffer, Source->queue, almemory_order_release); + else + ATOMIC_STORE(&voice->loop_buffer, NULL, almemory_order_release); + + /* If the source is playing, wait for the current mix to finish + * to ensure it isn't currently looping back or reaching the + * end. + */ + while((ATOMIC_LOAD(&device->MixCount, almemory_order_acquire)&1)) + althrd_yield(); + } + } return AL_TRUE; case AL_BUFFER: - LockBuffersRead(device); + LockBufferList(device); if(!(*values == 0 || (buffer=LookupBuffer(device, *values)) != NULL)) { - UnlockBuffersRead(device); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE); + UnlockBufferList(device); + SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid buffer ID %u", + *values); } - WriteLock(&Source->queue_lock); - if(!(Source->state == AL_STOPPED || Source->state == AL_INITIAL)) + if(buffer && buffer->MappedAccess != 0 && + !(buffer->MappedAccess&AL_MAP_PERSISTENT_BIT_SOFT)) { - WriteUnlock(&Source->queue_lock); - UnlockBuffersRead(device); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_OPERATION, AL_FALSE); + UnlockBufferList(device); + SETERR_RETURN(Context, AL_INVALID_OPERATION, AL_FALSE, + "Setting non-persistently mapped buffer %u", buffer->id); + } + else + { + ALenum state = GetSourceState(Source, GetSourceVoice(Source, Context)); + if(state == AL_PLAYING || state == AL_PAUSED) + { + UnlockBufferList(device); + SETERR_RETURN(Context, AL_INVALID_OPERATION, AL_FALSE, + "Setting buffer on playing or paused source %u", Source->id); + } } + oldlist = Source->queue; if(buffer != NULL) { /* Add the selected buffer to a one-item queue */ - newlist = malloc(sizeof(ALbufferlistitem)); - newlist->buffer = buffer; - newlist->next = NULL; + ALbufferlistitem *newlist = al_calloc(DEF_ALIGN, + FAM_SIZE(ALbufferlistitem, buffers, 1)); + ATOMIC_INIT(&newlist->next, NULL); + newlist->max_samples = buffer->SampleLen; + newlist->num_buffers = 1; + newlist->buffers[0] = buffer; IncrementRef(&buffer->ref); /* Source is now Static */ Source->SourceType = AL_STATIC; - - ReadLock(&buffer->lock); - Source->NumChannels = ChannelsFromFmt(buffer->FmtChannels); - Source->SampleSize = BytesFromFmt(buffer->FmtType); - ReadUnlock(&buffer->lock); + Source->queue = newlist; } else { /* Source is now Undetermined */ Source->SourceType = AL_UNDETERMINED; - newlist = NULL; + Source->queue = NULL; } - oldlist = ATOMIC_EXCHANGE(ALbufferlistitem*, &Source->queue, newlist); - ATOMIC_STORE(&Source->current_buffer, newlist); - WriteUnlock(&Source->queue_lock); - UnlockBuffersRead(device); + UnlockBufferList(device); /* Delete all elements in the previous queue */ while(oldlist != NULL) { + ALsizei i; ALbufferlistitem *temp = oldlist; - oldlist = temp->next; + oldlist = ATOMIC_LOAD(&temp->next, almemory_order_relaxed); - if(temp->buffer) - DecrementRef(&temp->buffer->ref); - free(temp); + for(i = 0;i < temp->num_buffers;i++) + { + if(temp->buffers[i]) + DecrementRef(&temp->buffers[i]->ref); + } + al_free(temp); } return AL_TRUE; @@ -710,28 +876,32 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p Source->OffsetType = prop; Source->Offset = *values; - if((Source->state == AL_PLAYING || Source->state == AL_PAUSED) && - !ATOMIC_LOAD(&Context->DeferUpdates, almemory_order_acquire)) + if(IsPlayingOrPaused(Source)) { - LockContext(Context); - WriteLock(&Source->queue_lock); - if(ApplyOffset(Source) == AL_FALSE) + ALvoice *voice; + + ALCdevice_Lock(Context->Device); + voice = GetSourceVoice(Source, Context); + if(voice) { - WriteUnlock(&Source->queue_lock); - UnlockContext(Context); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE); + if(ApplyOffset(Source, voice) == AL_FALSE) + { + ALCdevice_Unlock(Context->Device); + SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, + "Invalid source offset"); + } } - WriteUnlock(&Source->queue_lock); - UnlockContext(Context); + ALCdevice_Unlock(Context->Device); } return AL_TRUE; case AL_DIRECT_FILTER: - LockFiltersRead(device); + LockFilterList(device); if(!(*values == 0 || (filter=LookupFilter(device, *values)) != NULL)) { - UnlockFiltersRead(device); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE); + UnlockFilterList(device); + SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid filter ID %u", + *values); } if(!filter) @@ -750,7 +920,7 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p Source->Direct.GainLF = filter->GainLF; Source->Direct.LFReference = filter->LFReference; } - UnlockFiltersRead(device); + UnlockFilterList(device); DO_UPDATEPROPS(); return AL_TRUE; @@ -796,17 +966,41 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p DO_UPDATEPROPS(); return AL_TRUE; + case AL_SOURCE_RESAMPLER_SOFT: + CHECKVAL(*values >= 0 && *values <= ResamplerMax); + + Source->Resampler = *values; + DO_UPDATEPROPS(); + return AL_TRUE; + + case AL_SOURCE_SPATIALIZE_SOFT: + CHECKVAL(*values >= AL_FALSE && *values <= AL_AUTO_SOFT); + + Source->Spatialize = *values; + DO_UPDATEPROPS(); + return AL_TRUE; + case AL_AUXILIARY_SEND_FILTER: - LockEffectSlotsRead(Context); - LockFiltersRead(device); - if(!((ALuint)values[1] < device->NumAuxSends && - (values[0] == 0 || (slot=LookupEffectSlot(Context, values[0])) != NULL) && - (values[2] == 0 || (filter=LookupFilter(device, values[2])) != NULL))) + LockEffectSlotList(Context); + if(!(values[0] == 0 || (slot=LookupEffectSlot(Context, values[0])) != NULL)) { - UnlockFiltersRead(device); - UnlockEffectSlotsRead(Context); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_VALUE, AL_FALSE); + UnlockEffectSlotList(Context); + SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid effect ID %u", + values[0]); + } + if(!((ALuint)values[1] < (ALuint)device->NumAuxSends)) + { + UnlockEffectSlotList(Context); + SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid send %u", values[1]); + } + LockFilterList(device); + if(!(values[2] == 0 || (filter=LookupFilter(device, values[2])) != NULL)) + { + UnlockFilterList(device); + UnlockEffectSlotList(Context); + SETERR_RETURN(Context, AL_INVALID_VALUE, AL_FALSE, "Invalid filter ID %u", + values[2]); } if(!filter) @@ -826,21 +1020,24 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p Source->Send[values[1]].GainLF = filter->GainLF; Source->Send[values[1]].LFReference = filter->LFReference; } - UnlockFiltersRead(device); + UnlockFilterList(device); - if(slot != Source->Send[values[1]].Slot && - (Source->state == AL_PLAYING || Source->state == AL_PAUSED)) + if(slot != Source->Send[values[1]].Slot && IsPlayingOrPaused(Source)) { + ALvoice *voice; /* Add refcount on the new slot, and release the previous slot */ if(slot) IncrementRef(&slot->ref); if(Source->Send[values[1]].Slot) DecrementRef(&Source->Send[values[1]].Slot->ref); Source->Send[values[1]].Slot = slot; - /* We must force an update if the auxiliary slot changed on a - * playing source, in case the slot is about to be deleted. + /* We must force an update if the auxiliary slot changed on an + * active source, in case the slot is about to be deleted. */ - UpdateSourceProps(Source, device->NumAuxSends); + if((voice=GetSourceVoice(Source, Context)) != NULL) + UpdateSourceProps(Source, voice, device->NumAuxSends, Context); + else + ATOMIC_FLAG_CLEAR(&Source->PropsClean, almemory_order_release); } else { @@ -850,7 +1047,7 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p Source->Send[values[1]].Slot = slot; DO_UPDATEPROPS(); } - UnlockEffectSlotsRead(Context); + UnlockEffectSlotList(Context); return AL_TRUE; @@ -895,12 +1092,15 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_SAMPLE_OFFSET_LATENCY_SOFT: case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: case AL_STEREO_ANGLES: break; } ERR("Unexpected property: 0x%04x\n", prop); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_ENUM, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source integer property 0x%04x", + prop); } static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, const ALint64SOFT *values) @@ -915,12 +1115,10 @@ static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp case AL_BUFFERS_PROCESSED: case AL_SOURCE_STATE: case AL_SAMPLE_OFFSET_LATENCY_SOFT: - case AL_BYTE_LENGTH_SOFT: - case AL_SAMPLE_LENGTH_SOFT: - case AL_SEC_LENGTH_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: /* Query only */ - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_OPERATION, AL_FALSE); - + SETERR_RETURN(Context, AL_INVALID_OPERATION, AL_FALSE, + "Setting read-only source property 0x%04x", prop); /* 1x int */ case AL_SOURCE_RELATIVE: @@ -933,6 +1131,8 @@ static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO: case AL_DIRECT_CHANNELS_SOFT: case AL_DISTANCE_MODEL: + case AL_SOURCE_RESAMPLER_SOFT: + case AL_SOURCE_SPATIALIZE_SOFT: CHECKVAL(*values <= INT_MAX && *values >= INT_MIN); ivals[0] = (ALint)*values; @@ -996,12 +1196,14 @@ static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp return SetSourcefv(Source, Context, (int)prop, fvals); case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: case AL_STEREO_ANGLES: break; } ERR("Unexpected property: 0x%04x\n", prop); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_ENUM, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source integer64 property 0x%04x", + prop); } #undef CHECKVAL @@ -1010,7 +1212,6 @@ static ALboolean SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp prop, ALdouble *values) { ALCdevice *device = Context->Device; - ALbufferlistitem *BufferList; ClockLatency clocktime; ALuint64 srcclock; ALint ivals[3]; @@ -1031,7 +1232,7 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p return AL_TRUE; case AL_ROLLOFF_FACTOR: - *values = Source->RollOffFactor; + *values = Source->RolloffFactor; return AL_TRUE; case AL_REFERENCE_DISTANCE: @@ -1061,7 +1262,7 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_SEC_OFFSET: case AL_SAMPLE_OFFSET: case AL_BYTE_OFFSET: - *values = GetSourceOffset(Source, prop, device); + *values = GetSourceOffset(Source, prop, Context); return AL_TRUE; case AL_CONE_OUTER_GAINHF: @@ -1080,27 +1281,6 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p *values = Source->DopplerFactor; return AL_TRUE; - case AL_SEC_LENGTH_SOFT: - ReadLock(&Source->queue_lock); - if(!(BufferList=ATOMIC_LOAD(&Source->queue))) - *values = 0; - else - { - ALint length = 0; - ALsizei freq = 1; - do { - ALbuffer *buffer = BufferList->buffer; - if(buffer && buffer->SampleLen > 0) - { - freq = buffer->Frequency; - length += buffer->SampleLen; - } - } while((BufferList=BufferList->next) != NULL); - *values = (ALdouble)length / (ALdouble)freq; - } - ReadUnlock(&Source->queue_lock); - return AL_TRUE; - case AL_SOURCE_RADIUS: *values = Source->Radius; return AL_TRUE; @@ -1114,8 +1294,10 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p /* Get the source offset with the clock time first. Then get the * clock time with the device latency. Order is important. */ - values[0] = GetSourceSecOffset(Source, device, &srcclock); + values[0] = GetSourceSecOffset(Source, Context, &srcclock); + almtx_lock(&device->BackendLock); clocktime = V0(device->Backend,getClockLatency)(); + almtx_unlock(&device->BackendLock); if(srcclock == (ALuint64)clocktime.ClockTime) values[1] = (ALdouble)clocktime.Latency / 1000000000.0; else @@ -1130,6 +1312,11 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p } return AL_TRUE; + case AL_SEC_OFFSET_CLOCK_SOFT: + values[0] = GetSourceSecOffset(Source, Context, &srcclock); + values[1] = srcclock / 1000000000.0; + return AL_TRUE; + case AL_POSITION: values[0] = Source->Position[0]; values[1] = Source->Position[1]; @@ -1168,9 +1355,9 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO: case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO: case AL_DIRECT_CHANNELS_SOFT: - case AL_BYTE_LENGTH_SOFT: - case AL_SAMPLE_LENGTH_SOFT: case AL_DISTANCE_MODEL: + case AL_SOURCE_RESAMPLER_SOFT: + case AL_SOURCE_SPATIALIZE_SOFT: if((err=GetSourceiv(Source, Context, (int)prop, ivals)) != AL_FALSE) *values = (ALdouble)ivals[0]; return err; @@ -1179,11 +1366,13 @@ static ALboolean GetSourcedv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_DIRECT_FILTER: case AL_AUXILIARY_SEND_FILTER: case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: break; } ERR("Unexpected property: 0x%04x\n", prop); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_ENUM, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source double property 0x%04x", + prop); } static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint *values) @@ -1199,94 +1388,35 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p return AL_TRUE; case AL_LOOPING: - *values = ATOMIC_LOAD(&Source->looping); + *values = Source->Looping; return AL_TRUE; case AL_BUFFER: - ReadLock(&Source->queue_lock); - BufferList = (Source->SourceType == AL_STATIC) ? ATOMIC_LOAD(&Source->queue) : - ATOMIC_LOAD(&Source->current_buffer); - *values = (BufferList && BufferList->buffer) ? BufferList->buffer->id : 0; - ReadUnlock(&Source->queue_lock); + BufferList = (Source->SourceType == AL_STATIC) ? Source->queue : NULL; + *values = (BufferList && BufferList->num_buffers >= 1 && BufferList->buffers[0]) ? + BufferList->buffers[0]->id : 0; return AL_TRUE; case AL_SOURCE_STATE: - *values = Source->state; - return AL_TRUE; - - case AL_BYTE_LENGTH_SOFT: - ReadLock(&Source->queue_lock); - if(!(BufferList=ATOMIC_LOAD(&Source->queue))) - *values = 0; - else - { - ALint length = 0; - do { - ALbuffer *buffer = BufferList->buffer; - if(buffer && buffer->SampleLen > 0) - { - ALuint byte_align, sample_align; - if(buffer->OriginalType == UserFmtIMA4) - { - ALsizei align = (buffer->OriginalAlign-1)/2 + 4; - byte_align = align * ChannelsFromFmt(buffer->FmtChannels); - sample_align = buffer->OriginalAlign; - } - else if(buffer->OriginalType == UserFmtMSADPCM) - { - ALsizei align = (buffer->OriginalAlign-2)/2 + 7; - byte_align = align * ChannelsFromFmt(buffer->FmtChannels); - sample_align = buffer->OriginalAlign; - } - else - { - ALsizei align = buffer->OriginalAlign; - byte_align = align * ChannelsFromFmt(buffer->FmtChannels); - sample_align = buffer->OriginalAlign; - } - - length += buffer->SampleLen / sample_align * byte_align; - } - } while((BufferList=BufferList->next) != NULL); - *values = length; - } - ReadUnlock(&Source->queue_lock); - return AL_TRUE; - - case AL_SAMPLE_LENGTH_SOFT: - ReadLock(&Source->queue_lock); - if(!(BufferList=ATOMIC_LOAD(&Source->queue))) - *values = 0; - else - { - ALint length = 0; - do { - ALbuffer *buffer = BufferList->buffer; - if(buffer) length += buffer->SampleLen; - } while((BufferList=BufferList->next) != NULL); - *values = length; - } - ReadUnlock(&Source->queue_lock); + *values = GetSourceState(Source, GetSourceVoice(Source, Context)); return AL_TRUE; case AL_BUFFERS_QUEUED: - ReadLock(&Source->queue_lock); - if(!(BufferList=ATOMIC_LOAD(&Source->queue))) + if(!(BufferList=Source->queue)) *values = 0; else { ALsizei count = 0; do { - ++count; - } while((BufferList=BufferList->next) != NULL); + count += BufferList->num_buffers; + BufferList = ATOMIC_LOAD(&BufferList->next, almemory_order_relaxed); + } while(BufferList != NULL); *values = count; } - ReadUnlock(&Source->queue_lock); return AL_TRUE; case AL_BUFFERS_PROCESSED: - ReadLock(&Source->queue_lock); - if(ATOMIC_LOAD(&Source->looping) || Source->SourceType != AL_STREAMING) + if(Source->Looping || Source->SourceType != AL_STREAMING) { /* Buffers on a looping source are in a perpetual state of * PENDING, so don't report any as PROCESSED */ @@ -1294,17 +1424,24 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p } else { - const ALbufferlistitem *BufferList = ATOMIC_LOAD(&Source->queue); - const ALbufferlistitem *Current = ATOMIC_LOAD(&Source->current_buffer); + const ALbufferlistitem *BufferList = Source->queue; + const ALbufferlistitem *Current = NULL; ALsizei played = 0; + ALvoice *voice; + + if((voice=GetSourceVoice(Source, Context)) != NULL) + Current = ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed); + else if(Source->state == AL_INITIAL) + Current = BufferList; + while(BufferList && BufferList != Current) { - played++; - BufferList = BufferList->next; + played += BufferList->num_buffers; + BufferList = ATOMIC_LOAD(&CONST_CAST(ALbufferlistitem*,BufferList)->next, + almemory_order_relaxed); } *values = played; } - ReadUnlock(&Source->queue_lock); return AL_TRUE; case AL_SOURCE_TYPE: @@ -1331,6 +1468,14 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p *values = Source->DistanceModel; return AL_TRUE; + case AL_SOURCE_RESAMPLER_SOFT: + *values = Source->Resampler; + return AL_TRUE; + + case AL_SOURCE_SPATIALIZE_SOFT: + *values = Source->Spatialize; + return AL_TRUE; + /* 1x float/double */ case AL_CONE_INNER_ANGLE: case AL_CONE_OUTER_ANGLE: @@ -1349,7 +1494,6 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p case AL_AIR_ABSORPTION_FACTOR: case AL_ROOM_ROLLOFF_FACTOR: case AL_CONE_OUTER_GAINHF: - case AL_SEC_LENGTH_SOFT: case AL_SOURCE_RADIUS: if((err=GetSourcedv(Source, Context, prop, dvals)) != AL_FALSE) *values = (ALint)dvals[0]; @@ -1381,8 +1525,10 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p return err; case AL_SAMPLE_OFFSET_LATENCY_SOFT: + case AL_SAMPLE_OFFSET_CLOCK_SOFT: break; /* i64 only */ case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: break; /* Double only */ case AL_STEREO_ANGLES: break; /* Float/double only */ @@ -1393,7 +1539,8 @@ static ALboolean GetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p } ERR("Unexpected property: 0x%04x\n", prop); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_ENUM, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source integer property 0x%04x", + prop); } static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, ALint64 *values) @@ -1411,8 +1558,10 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp /* Get the source offset with the clock time first. Then get the * clock time with the device latency. Order is important. */ - values[0] = GetSourceSampleOffset(Source, device, &srcclock); + values[0] = GetSourceSampleOffset(Source, Context, &srcclock); + almtx_lock(&device->BackendLock); clocktime = V0(device->Backend,getClockLatency)(); + almtx_unlock(&device->BackendLock); if(srcclock == (ALuint64)clocktime.ClockTime) values[1] = clocktime.Latency; else @@ -1426,6 +1575,11 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp } return AL_TRUE; + case AL_SAMPLE_OFFSET_CLOCK_SOFT: + values[0] = GetSourceSampleOffset(Source, Context, &srcclock); + values[1] = srcclock; + return AL_TRUE; + /* 1x float/double */ case AL_CONE_INNER_ANGLE: case AL_CONE_OUTER_ANGLE: @@ -1444,7 +1598,6 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp case AL_AIR_ABSORPTION_FACTOR: case AL_ROOM_ROLLOFF_FACTOR: case AL_CONE_OUTER_GAINHF: - case AL_SEC_LENGTH_SOFT: case AL_SOURCE_RADIUS: if((err=GetSourcedv(Source, Context, prop, dvals)) != AL_FALSE) *values = (ALint64)dvals[0]; @@ -1481,14 +1634,14 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp case AL_SOURCE_STATE: case AL_BUFFERS_QUEUED: case AL_BUFFERS_PROCESSED: - case AL_BYTE_LENGTH_SOFT: - case AL_SAMPLE_LENGTH_SOFT: case AL_SOURCE_TYPE: case AL_DIRECT_FILTER_GAINHF_AUTO: case AL_AUXILIARY_SEND_FILTER_GAIN_AUTO: case AL_AUXILIARY_SEND_FILTER_GAINHF_AUTO: case AL_DIRECT_CHANNELS_SOFT: case AL_DISTANCE_MODEL: + case AL_SOURCE_RESAMPLER_SOFT: + case AL_SOURCE_SPATIALIZE_SOFT: if((err=GetSourceiv(Source, Context, prop, ivals)) != AL_FALSE) *values = ivals[0]; return err; @@ -1511,13 +1664,15 @@ static ALboolean GetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp return err; case AL_SEC_OFFSET_LATENCY_SOFT: + case AL_SEC_OFFSET_CLOCK_SOFT: break; /* Double only */ case AL_STEREO_ANGLES: break; /* Float/double only */ } ERR("Unexpected property: 0x%04x\n", prop); - SET_ERROR_AND_RETURN_VALUE(Context, AL_INVALID_ENUM, AL_FALSE); + SETERR_RETURN(Context, AL_INVALID_ENUM, AL_FALSE, "Invalid source integer64 property 0x%04x", + prop); } @@ -1525,40 +1680,23 @@ AL_API ALvoid AL_APIENTRY alGenSources(ALsizei n, ALuint *sources) { ALCcontext *context; ALsizei cur = 0; - ALenum err; context = GetContextRef(); if(!context) return; if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - for(cur = 0;cur < n;cur++) + alSetError(context, AL_INVALID_VALUE, "Generating %d sources", n); + else for(cur = 0;cur < n;cur++) { - ALsource *source = al_calloc(16, sizeof(ALsource)); + ALsource *source = AllocSource(context); if(!source) { alDeleteSources(cur, sources); - SET_ERROR_AND_GOTO(context, AL_OUT_OF_MEMORY, done); + break; } - InitSourceParams(source); - - err = NewThunkEntry(&source->id); - if(err == AL_NO_ERROR) - err = InsertUIntMapEntry(&context->SourceMap, source->id, source); - if(err != AL_NO_ERROR) - { - FreeThunkEntry(source->id); - memset(source, 0, sizeof(ALsource)); - al_free(source); - - alDeleteSources(cur, sources); - SET_ERROR_AND_GOTO(context, err, done); - } - sources[cur] = source->id; } -done: ALCcontext_DecRef(context); } @@ -1572,44 +1710,24 @@ AL_API ALvoid AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources) context = GetContextRef(); if(!context) return; - LockSourcesWrite(context); + LockSourceList(context); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Deleting %d sources", n); /* Check that all Sources are valid */ for(i = 0;i < n;i++) { if(LookupSource(context, sources[i]) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", sources[i]); } for(i = 0;i < n;i++) { - ALvoice *voice, *voice_end; - - if((Source=RemoveSource(context, sources[i])) == NULL) - continue; - FreeThunkEntry(Source->id); - - LockContext(context); - voice = context->Voices; - voice_end = voice + context->VoiceCount; - while(voice != voice_end) - { - ALsource *old = Source; - if(COMPARE_EXCHANGE(&voice->Source, &old, NULL)) - break; - voice++; - } - UnlockContext(context); - - DeinitSource(Source); - - memset(Source, 0, sizeof(*Source)); - al_free(Source); + if((Source=LookupSource(context, sources[i])) != NULL) + FreeSource(context, Source); } done: - UnlockSourcesWrite(context); + UnlockSourceList(context); ALCcontext_DecRef(context); } @@ -1622,9 +1740,9 @@ AL_API ALboolean AL_APIENTRY alIsSource(ALuint source) context = GetContextRef(); if(!context) return AL_FALSE; - LockSourcesRead(context); + LockSourceList(context); ret = (LookupSource(context, source) ? AL_TRUE : AL_FALSE); - UnlockSourcesRead(context); + UnlockSourceList(context); ALCcontext_DecRef(context); @@ -1640,16 +1758,16 @@ AL_API ALvoid AL_APIENTRY alSourcef(ALuint source, ALenum param, ALfloat value) Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(FloatValsByProp(param) == 1)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid float property 0x%04x", param); else SetSourcefv(Source, Context, param, &value); - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1662,19 +1780,19 @@ AL_API ALvoid AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1 Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(FloatValsByProp(param) == 3)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid 3-float property 0x%04x", param); else { ALfloat fvals[3] = { value1, value2, value3 }; SetSourcefv(Source, Context, param, fvals); } - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1687,18 +1805,18 @@ AL_API ALvoid AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!values) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(FloatValsByProp(param) > 0)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid float-vector property 0x%04x", param); else SetSourcefv(Source, Context, param, values); - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1712,19 +1830,19 @@ AL_API ALvoid AL_APIENTRY alSourcedSOFT(ALuint source, ALenum param, ALdouble va Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(DoubleValsByProp(param) == 1)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid double property 0x%04x", param); else { ALfloat fval = (ALfloat)value; SetSourcefv(Source, Context, param, &fval); } - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1737,19 +1855,19 @@ AL_API ALvoid AL_APIENTRY alSource3dSOFT(ALuint source, ALenum param, ALdouble v Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(DoubleValsByProp(param) == 3)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid 3-double property 0x%04x", param); else { ALfloat fvals[3] = { (ALfloat)value1, (ALfloat)value2, (ALfloat)value3 }; SetSourcefv(Source, Context, param, fvals); } - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1763,14 +1881,14 @@ AL_API ALvoid AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdo Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!values) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!((count=DoubleValsByProp(param)) > 0 && count <= 6)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid double-vector property 0x%04x", param); else { ALfloat fvals[6]; @@ -1780,8 +1898,8 @@ AL_API ALvoid AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdo fvals[i] = (ALfloat)values[i]; SetSourcefv(Source, Context, param, fvals); } - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1795,16 +1913,16 @@ AL_API ALvoid AL_APIENTRY alSourcei(ALuint source, ALenum param, ALint value) Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(IntValsByProp(param) == 1)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid integer property 0x%04x", param); else SetSourceiv(Source, Context, param, &value); - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1817,19 +1935,19 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, AL Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(IntValsByProp(param) == 3)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid 3-integer property 0x%04x", param); else { ALint ivals[3] = { value1, value2, value3 }; SetSourceiv(Source, Context, param, ivals); } - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1842,18 +1960,18 @@ AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *val Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!values) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(IntValsByProp(param) > 0)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid integer-vector property 0x%04x", param); else SetSourceiv(Source, Context, param, values); - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1867,16 +1985,16 @@ AL_API ALvoid AL_APIENTRY alSourcei64SOFT(ALuint source, ALenum param, ALint64SO Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(Int64ValsByProp(param) == 1)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid integer64 property 0x%04x", param); else SetSourcei64v(Source, Context, param, &value); - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1889,19 +2007,19 @@ AL_API void AL_APIENTRY alSource3i64SOFT(ALuint source, ALenum param, ALint64SOF Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(Int64ValsByProp(param) == 3)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid 3-integer64 property 0x%04x", param); else { ALint64SOFT i64vals[3] = { value1, value2, value3 }; SetSourcei64v(Source, Context, param, i64vals); } - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1914,18 +2032,18 @@ AL_API void AL_APIENTRY alSourcei64vSOFT(ALuint source, ALenum param, const ALin Context = GetContextRef(); if(!Context) return; - WriteLock(&Context->PropLock); - LockSourcesRead(Context); + almtx_lock(&Context->PropLock); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!values) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(Int64ValsByProp(param) > 0)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid integer64-vector property 0x%04x", param); else SetSourcei64v(Source, Context, param, values); - UnlockSourcesRead(Context); - WriteUnlock(&Context->PropLock); + UnlockSourceList(Context); + almtx_unlock(&Context->PropLock); ALCcontext_DecRef(Context); } @@ -1939,22 +2057,20 @@ AL_API ALvoid AL_APIENTRY alGetSourcef(ALuint source, ALenum param, ALfloat *val Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!value) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(FloatValsByProp(param) == 1)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid float property 0x%04x", param); else { ALdouble dval; if(GetSourcedv(Source, Context, param, &dval)) *value = (ALfloat)dval; } - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -1968,14 +2084,13 @@ AL_API ALvoid AL_APIENTRY alGetSource3f(ALuint source, ALenum param, ALfloat *va Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(value1 && value2 && value3)) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(FloatValsByProp(param) == 3)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid 3-float property 0x%04x", param); else { ALdouble dvals[3]; @@ -1986,8 +2101,7 @@ AL_API ALvoid AL_APIENTRY alGetSource3f(ALuint source, ALenum param, ALfloat *va *value3 = (ALfloat)dvals[2]; } } - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2002,14 +2116,13 @@ AL_API ALvoid AL_APIENTRY alGetSourcefv(ALuint source, ALenum param, ALfloat *va Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!values) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!((count=FloatValsByProp(param)) > 0 && count <= 6)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid float-vector property 0x%04x", param); else { ALdouble dvals[6]; @@ -2020,8 +2133,7 @@ AL_API ALvoid AL_APIENTRY alGetSourcefv(ALuint source, ALenum param, ALfloat *va values[i] = (ALfloat)dvals[i]; } } - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2035,18 +2147,16 @@ AL_API void AL_APIENTRY alGetSourcedSOFT(ALuint source, ALenum param, ALdouble * Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!value) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(DoubleValsByProp(param) == 1)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid double property 0x%04x", param); else GetSourcedv(Source, Context, param, value); - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2059,14 +2169,13 @@ AL_API void AL_APIENTRY alGetSource3dSOFT(ALuint source, ALenum param, ALdouble Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(value1 && value2 && value3)) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(DoubleValsByProp(param) == 3)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid 3-double property 0x%04x", param); else { ALdouble dvals[3]; @@ -2077,8 +2186,7 @@ AL_API void AL_APIENTRY alGetSource3dSOFT(ALuint source, ALenum param, ALdouble *value3 = dvals[2]; } } - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2091,18 +2199,16 @@ AL_API void AL_APIENTRY alGetSourcedvSOFT(ALuint source, ALenum param, ALdouble Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!values) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(DoubleValsByProp(param) > 0)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid double-vector property 0x%04x", param); else GetSourcedv(Source, Context, param, values); - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2116,18 +2222,16 @@ AL_API ALvoid AL_APIENTRY alGetSourcei(ALuint source, ALenum param, ALint *value Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!value) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(IntValsByProp(param) == 1)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid integer property 0x%04x", param); else GetSourceiv(Source, Context, param, value); - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2141,14 +2245,13 @@ AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum param, ALint *value1 Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(value1 && value2 && value3)) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(IntValsByProp(param) == 3)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid 3-integer property 0x%04x", param); else { ALint ivals[3]; @@ -2159,8 +2262,7 @@ AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum param, ALint *value1 *value3 = ivals[2]; } } - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2174,18 +2276,16 @@ AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum param, ALint *values Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!values) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(IntValsByProp(param) > 0)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid integer-vector property 0x%04x", param); else GetSourceiv(Source, Context, param, values); - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2199,18 +2299,16 @@ AL_API void AL_APIENTRY alGetSourcei64SOFT(ALuint source, ALenum param, ALint64S Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!value) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(Int64ValsByProp(param) == 1)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid integer64 property 0x%04x", param); else GetSourcei64v(Source, Context, param, value); - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2223,14 +2321,13 @@ AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64 Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!(value1 && value2 && value3)) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(Int64ValsByProp(param) == 3)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid 3-integer64 property 0x%04x", param); else { ALint64 i64vals[3]; @@ -2241,8 +2338,7 @@ AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64 *value3 = i64vals[2]; } } - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2255,18 +2351,16 @@ AL_API void AL_APIENTRY alGetSourcei64vSOFT(ALuint source, ALenum param, ALint64 Context = GetContextRef(); if(!Context) return; - ReadLock(&Context->PropLock); - LockSourcesRead(Context); + LockSourceList(Context); if((Source=LookupSource(Context, source)) == NULL) - alSetError(Context, AL_INVALID_NAME); + alSetError(Context, AL_INVALID_NAME, "Invalid source ID %u", source); else if(!values) - alSetError(Context, AL_INVALID_VALUE); + alSetError(Context, AL_INVALID_VALUE, "NULL pointer"); else if(!(Int64ValsByProp(param) > 0)) - alSetError(Context, AL_INVALID_ENUM); + alSetError(Context, AL_INVALID_ENUM, "Invalid integer64-vector property 0x%04x", param); else GetSourcei64v(Source, Context, param, values); - UnlockSourcesRead(Context); - ReadUnlock(&Context->PropLock); + UnlockSourceList(Context); ALCcontext_DecRef(Context); } @@ -2279,63 +2373,183 @@ AL_API ALvoid AL_APIENTRY alSourcePlay(ALuint source) AL_API ALvoid AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources) { ALCcontext *context; + ALCdevice *device; ALsource *source; - ALsizei i; + ALvoice *voice; + ALsizei i, j; context = GetContextRef(); if(!context) return; - LockSourcesRead(context); + LockSourceList(context); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Playing %d sources", n); for(i = 0;i < n;i++) { if(!LookupSource(context, sources[i])) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", sources[i]); + } + + device = context->Device; + ALCdevice_Lock(device); + /* If the device is disconnected, go right to stopped. */ + if(!ATOMIC_LOAD(&device->Connected, almemory_order_acquire)) + { + /* TODO: Send state change event? */ + for(i = 0;i < n;i++) + { + source = LookupSource(context, sources[i]); + source->OffsetType = AL_NONE; + source->Offset = 0.0; + source->state = AL_STOPPED; + } + ALCdevice_Unlock(device); + goto done; } - LockContext(context); while(n > context->MaxVoices-context->VoiceCount) { - ALvoice *temp = NULL; - ALsizei newcount; - - newcount = context->MaxVoices << 1; - if(newcount > 0) - temp = al_malloc(16, newcount * sizeof(context->Voices[0])); - if(!temp) + ALsizei newcount = context->MaxVoices << 1; + if(context->MaxVoices >= newcount) { - UnlockContext(context); - SET_ERROR_AND_GOTO(context, AL_OUT_OF_MEMORY, done); + ALCdevice_Unlock(device); + SETERR_GOTO(context, AL_OUT_OF_MEMORY, done, + "Overflow increasing voice count %d -> %d", context->MaxVoices, newcount); } - memcpy(temp, context->Voices, context->MaxVoices * sizeof(temp[0])); - memset(&temp[context->MaxVoices], 0, (newcount-context->MaxVoices) * sizeof(temp[0])); - - al_free(context->Voices); - context->Voices = temp; - context->MaxVoices = newcount; + AllocateVoices(context, newcount, device->NumAuxSends); } - if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll) + for(i = 0;i < n;i++) { - for(i = 0;i < n;i++) + ALbufferlistitem *BufferList; + bool start_fading = false; + ALint vidx = -1; + + source = LookupSource(context, sources[i]); + /* Check that there is a queue containing at least one valid, non zero + * length buffer. + */ + BufferList = source->queue; + while(BufferList && BufferList->max_samples == 0) + BufferList = ATOMIC_LOAD(&BufferList->next, almemory_order_relaxed); + + /* If there's nothing to play, go right to stopped. */ + if(UNLIKELY(!BufferList)) { - source = LookupSource(context, sources[i]); - source->new_state = AL_PLAYING; + /* NOTE: A source without any playable buffers should not have an + * ALvoice since it shouldn't be in a playing or paused state. So + * there's no need to look up its voice and clear the source. + */ + ALenum oldstate = GetSourceState(source, NULL); + source->OffsetType = AL_NONE; + source->Offset = 0.0; + if(oldstate != AL_STOPPED) + { + source->state = AL_STOPPED; + SendStateChangeEvent(context, source->id, AL_STOPPED); + } + continue; } - } - else - { - for(i = 0;i < n;i++) + + voice = GetSourceVoice(source, context); + switch(GetSourceState(source, voice)) { - source = LookupSource(context, sources[i]); - SetSourceState(source, context, AL_PLAYING); + case AL_PLAYING: + assert(voice != NULL); + /* A source that's already playing is restarted from the beginning. */ + ATOMIC_STORE(&voice->current_buffer, BufferList, almemory_order_relaxed); + ATOMIC_STORE(&voice->position, 0, almemory_order_relaxed); + ATOMIC_STORE(&voice->position_fraction, 0, almemory_order_release); + continue; + + case AL_PAUSED: + assert(voice != NULL); + /* A source that's paused simply resumes. */ + ATOMIC_STORE(&voice->Playing, true, almemory_order_release); + source->state = AL_PLAYING; + SendStateChangeEvent(context, source->id, AL_PLAYING); + continue; + + default: + break; } + + /* Look for an unused voice to play this source with. */ + assert(voice == NULL); + for(j = 0;j < context->VoiceCount;j++) + { + if(ATOMIC_LOAD(&context->Voices[j]->Source, almemory_order_acquire) == NULL) + { + vidx = j; + break; + } + } + if(vidx == -1) + vidx = context->VoiceCount++; + voice = context->Voices[vidx]; + ATOMIC_STORE(&voice->Playing, false, almemory_order_release); + + ATOMIC_FLAG_TEST_AND_SET(&source->PropsClean, almemory_order_acquire); + UpdateSourceProps(source, voice, device->NumAuxSends, context); + + /* A source that's not playing or paused has any offset applied when it + * starts playing. + */ + if(source->Looping) + ATOMIC_STORE(&voice->loop_buffer, source->queue, almemory_order_relaxed); + else + ATOMIC_STORE(&voice->loop_buffer, NULL, almemory_order_relaxed); + ATOMIC_STORE(&voice->current_buffer, BufferList, almemory_order_relaxed); + ATOMIC_STORE(&voice->position, 0, almemory_order_relaxed); + ATOMIC_STORE(&voice->position_fraction, 0, almemory_order_relaxed); + if(ApplyOffset(source, voice) != AL_FALSE) + start_fading = ATOMIC_LOAD(&voice->position, almemory_order_relaxed) != 0 || + ATOMIC_LOAD(&voice->position_fraction, almemory_order_relaxed) != 0 || + ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed) != BufferList; + + for(j = 0;j < BufferList->num_buffers;j++) + { + ALbuffer *buffer = BufferList->buffers[j]; + if(buffer) + { + voice->NumChannels = ChannelsFromFmt(buffer->FmtChannels); + voice->SampleSize = BytesFromFmt(buffer->FmtType); + break; + } + } + + /* Clear previous samples. */ + memset(voice->PrevSamples, 0, sizeof(voice->PrevSamples)); + + /* Clear the stepping value so the mixer knows not to mix this until + * the update gets applied. + */ + voice->Step = 0; + + voice->Flags = start_fading ? VOICE_IS_FADING : 0; + if(source->SourceType == AL_STATIC) voice->Flags |= VOICE_IS_STATIC; + memset(voice->Direct.Params, 0, sizeof(voice->Direct.Params[0])*voice->NumChannels); + for(j = 0;j < device->NumAuxSends;j++) + memset(voice->Send[j].Params, 0, sizeof(voice->Send[j].Params[0])*voice->NumChannels); + if(device->AvgSpeakerDist > 0.0f) + { + ALfloat w1 = SPEEDOFSOUNDMETRESPERSEC / + (device->AvgSpeakerDist * device->Frequency); + for(j = 0;j < voice->NumChannels;j++) + NfcFilterCreate(&voice->Direct.Params[j].NFCtrlFilter, 0.0f, w1); + } + + ATOMIC_STORE(&voice->Source, source, almemory_order_relaxed); + ATOMIC_STORE(&voice->Playing, true, almemory_order_release); + source->state = AL_PLAYING; + source->VoiceIdx = vidx; + + SendStateChangeEvent(context, source->id, AL_PLAYING); } - UnlockContext(context); + ALCdevice_Unlock(device); done: - UnlockSourcesRead(context); + UnlockSourceList(context); ALCcontext_DecRef(context); } @@ -2346,42 +2560,40 @@ AL_API ALvoid AL_APIENTRY alSourcePause(ALuint source) AL_API ALvoid AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources) { ALCcontext *context; + ALCdevice *device; ALsource *source; + ALvoice *voice; ALsizei i; context = GetContextRef(); if(!context) return; - LockSourcesRead(context); + LockSourceList(context); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Pausing %d sources", n); for(i = 0;i < n;i++) { if(!LookupSource(context, sources[i])) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", sources[i]); } - LockContext(context); - if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) + device = context->Device; + ALCdevice_Lock(device); + for(i = 0;i < n;i++) { - for(i = 0;i < n;i++) + source = LookupSource(context, sources[i]); + if((voice=GetSourceVoice(source, context)) != NULL) + ATOMIC_STORE(&voice->Playing, false, almemory_order_release); + if(GetSourceState(source, voice) == AL_PLAYING) { - source = LookupSource(context, sources[i]); - source->new_state = AL_PAUSED; + source->state = AL_PAUSED; + SendStateChangeEvent(context, source->id, AL_PAUSED); } } - else - { - for(i = 0;i < n;i++) - { - source = LookupSource(context, sources[i]); - SetSourceState(source, context, AL_PAUSED); - } - } - UnlockContext(context); + ALCdevice_Unlock(device); done: - UnlockSourcesRead(context); + UnlockSourceList(context); ALCcontext_DecRef(context); } @@ -2392,32 +2604,48 @@ AL_API ALvoid AL_APIENTRY alSourceStop(ALuint source) AL_API ALvoid AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources) { ALCcontext *context; + ALCdevice *device; ALsource *source; + ALvoice *voice; ALsizei i; context = GetContextRef(); if(!context) return; - LockSourcesRead(context); + LockSourceList(context); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Stopping %d sources", n); for(i = 0;i < n;i++) { if(!LookupSource(context, sources[i])) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", sources[i]); } - LockContext(context); + device = context->Device; + ALCdevice_Lock(device); for(i = 0;i < n;i++) { + ALenum oldstate; source = LookupSource(context, sources[i]); - source->new_state = AL_NONE; - SetSourceState(source, context, AL_STOPPED); + if((voice=GetSourceVoice(source, context)) != NULL) + { + ATOMIC_STORE(&voice->Source, NULL, almemory_order_relaxed); + ATOMIC_STORE(&voice->Playing, false, almemory_order_release); + voice = NULL; + } + oldstate = GetSourceState(source, voice); + if(oldstate != AL_INITIAL && oldstate != AL_STOPPED) + { + source->state = AL_STOPPED; + SendStateChangeEvent(context, source->id, AL_STOPPED); + } + source->OffsetType = AL_NONE; + source->Offset = 0.0; } - UnlockContext(context); + ALCdevice_Unlock(device); done: - UnlockSourcesRead(context); + UnlockSourceList(context); ALCcontext_DecRef(context); } @@ -2428,32 +2656,46 @@ AL_API ALvoid AL_APIENTRY alSourceRewind(ALuint source) AL_API ALvoid AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources) { ALCcontext *context; + ALCdevice *device; ALsource *source; + ALvoice *voice; ALsizei i; context = GetContextRef(); if(!context) return; - LockSourcesRead(context); + LockSourceList(context); if(!(n >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Rewinding %d sources", n); for(i = 0;i < n;i++) { if(!LookupSource(context, sources[i])) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", sources[i]); } - LockContext(context); + device = context->Device; + ALCdevice_Lock(device); for(i = 0;i < n;i++) { source = LookupSource(context, sources[i]); - source->new_state = AL_NONE; - SetSourceState(source, context, AL_INITIAL); + if((voice=GetSourceVoice(source, context)) != NULL) + { + ATOMIC_STORE(&voice->Source, NULL, almemory_order_relaxed); + ATOMIC_STORE(&voice->Playing, false, almemory_order_release); + voice = NULL; + } + if(GetSourceState(source, voice) != AL_INITIAL) + { + source->state = AL_INITIAL; + SendStateChangeEvent(context, source->id, AL_INITIAL); + } + source->OffsetType = AL_NONE; + source->Offset = 0.0; } - UnlockContext(context); + ALCdevice_Unlock(device); done: - UnlockSourcesRead(context); + UnlockSourceList(context); ALCcontext_DecRef(context); } @@ -2476,126 +2718,111 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALu device = context->Device; - LockSourcesRead(context); + LockSourceList(context); if(!(nb >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Queueing %d buffers", nb); if((source=LookupSource(context, src)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", src); - WriteLock(&source->queue_lock); if(source->SourceType == AL_STATIC) { - WriteUnlock(&source->queue_lock); /* Can't queue on a Static Source */ - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, done); + SETERR_GOTO(context, AL_INVALID_OPERATION, done, "Queueing onto static source %u", src); } /* Check for a valid Buffer, for its frequency and format */ - BufferList = ATOMIC_LOAD(&source->queue); + BufferList = source->queue; while(BufferList) { - if(BufferList->buffer) + for(i = 0;i < BufferList->num_buffers;i++) { - BufferFmt = BufferList->buffer; - break; + if((BufferFmt=BufferList->buffers[i]) != NULL) + break; } - BufferList = BufferList->next; + if(BufferFmt) break; + BufferList = ATOMIC_LOAD(&BufferList->next, almemory_order_relaxed); } - LockBuffersRead(device); + LockBufferList(device); BufferListStart = NULL; BufferList = NULL; for(i = 0;i < nb;i++) { ALbuffer *buffer = NULL; if(buffers[i] && (buffer=LookupBuffer(device, buffers[i])) == NULL) - { - WriteUnlock(&source->queue_lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, buffer_error); - } + SETERR_GOTO(context, AL_INVALID_NAME, buffer_error, "Queueing invalid buffer ID %u", + buffers[i]); if(!BufferListStart) { - BufferListStart = malloc(sizeof(ALbufferlistitem)); + BufferListStart = al_calloc(DEF_ALIGN, + FAM_SIZE(ALbufferlistitem, buffers, 1)); BufferList = BufferListStart; } else { - BufferList->next = malloc(sizeof(ALbufferlistitem)); - BufferList = BufferList->next; + ALbufferlistitem *item = al_calloc(DEF_ALIGN, + FAM_SIZE(ALbufferlistitem, buffers, 1)); + ATOMIC_STORE(&BufferList->next, item, almemory_order_relaxed); + BufferList = item; } - BufferList->buffer = buffer; - BufferList->next = NULL; + ATOMIC_INIT(&BufferList->next, NULL); + BufferList->max_samples = buffer ? buffer->SampleLen : 0; + BufferList->num_buffers = 1; + BufferList->buffers[0] = buffer; if(!buffer) continue; - /* Hold a read lock on each buffer being queued while checking all - * provided buffers. This is done so other threads don't see an extra - * reference on some buffers if this operation ends up failing. */ - ReadLock(&buffer->lock); IncrementRef(&buffer->ref); - if(BufferFmt == NULL) - { - BufferFmt = buffer; + if(buffer->MappedAccess != 0 && !(buffer->MappedAccess&AL_MAP_PERSISTENT_BIT_SOFT)) + SETERR_GOTO(context, AL_INVALID_OPERATION, buffer_error, + "Queueing non-persistently mapped buffer %u", buffer->id); - source->NumChannels = ChannelsFromFmt(buffer->FmtChannels); - source->SampleSize = BytesFromFmt(buffer->FmtType); - } + if(BufferFmt == NULL) + BufferFmt = buffer; else if(BufferFmt->Frequency != buffer->Frequency || - BufferFmt->OriginalChannels != buffer->OriginalChannels || + BufferFmt->FmtChannels != buffer->FmtChannels || BufferFmt->OriginalType != buffer->OriginalType) { - WriteUnlock(&source->queue_lock); - SET_ERROR_AND_GOTO(context, AL_INVALID_OPERATION, buffer_error); + alSetError(context, AL_INVALID_OPERATION, "Queueing buffer with mismatched format"); buffer_error: /* A buffer failed (invalid ID or format), so unlock and release * each buffer we had. */ while(BufferListStart) { - ALbufferlistitem *next = BufferListStart->next; - if((buffer=BufferListStart->buffer) != NULL) + ALbufferlistitem *next = ATOMIC_LOAD(&BufferListStart->next, + almemory_order_relaxed); + for(i = 0;i < BufferListStart->num_buffers;i++) { - DecrementRef(&buffer->ref); - ReadUnlock(&buffer->lock); + if((buffer=BufferListStart->buffers[i]) != NULL) + DecrementRef(&buffer->ref); } - free(BufferListStart); + al_free(BufferListStart); BufferListStart = next; } - UnlockBuffersRead(device); + UnlockBufferList(device); goto done; } } - /* All buffers good, unlock them now. */ - BufferList = BufferListStart; - while(BufferList != NULL) - { - ALbuffer *buffer = BufferList->buffer; - if(buffer) ReadUnlock(&buffer->lock); - BufferList = BufferList->next; - } - UnlockBuffersRead(device); + /* All buffers good. */ + UnlockBufferList(device); /* Source is now streaming */ source->SourceType = AL_STREAMING; - BufferList = NULL; - if(!ATOMIC_COMPARE_EXCHANGE_STRONG(ALbufferlistitem*, &source->queue, &BufferList, BufferListStart)) + if(!(BufferList=source->queue)) + source->queue = BufferListStart; + else { - /* Queue head is not NULL, append to the end of the queue */ - while(BufferList->next != NULL) - BufferList = BufferList->next; - BufferList->next = BufferListStart; + ALbufferlistitem *next; + while((next=ATOMIC_LOAD(&BufferList->next, almemory_order_relaxed)) != NULL) + BufferList = next; + ATOMIC_STORE(&BufferList->next, BufferListStart, almemory_order_release); } - /* If the current buffer was at the end (NULL), put it at the start of the newly queued - * buffers. - */ - BufferList = NULL; - ATOMIC_COMPARE_EXCHANGE_STRONG(ALbufferlistitem*, &source->current_buffer, &BufferList, BufferListStart); - WriteUnlock(&source->queue_lock); done: - UnlockSourcesRead(context); + UnlockSourceList(context); ALCcontext_DecRef(context); } @@ -2603,98 +2830,102 @@ AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers(ALuint src, ALsizei nb, ALuint { ALCcontext *context; ALsource *source; - ALbufferlistitem *OldHead; - ALbufferlistitem *OldTail; + ALbufferlistitem *BufferList; ALbufferlistitem *Current; - ALsizei i = 0; - - if(nb == 0) - return; + ALvoice *voice; + ALsizei i; context = GetContextRef(); if(!context) return; - LockSourcesRead(context); + LockSourceList(context); if(!(nb >= 0)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Unqueueing %d buffers", nb); if((source=LookupSource(context, src)) == NULL) - SET_ERROR_AND_GOTO(context, AL_INVALID_NAME, done); + SETERR_GOTO(context, AL_INVALID_NAME, done, "Invalid source ID %u", src); - WriteLock(&source->queue_lock); - if(ATOMIC_LOAD(&source->looping) || source->SourceType != AL_STREAMING) - { - WriteUnlock(&source->queue_lock); - /* Trying to unqueue buffers on a looping or non-streaming source. */ - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } + /* Nothing to unqueue. */ + if(nb == 0) goto done; - /* Find the new buffer queue head */ - OldTail = ATOMIC_LOAD(&source->queue); - Current = ATOMIC_LOAD(&source->current_buffer); - if(OldTail != Current) - { - for(i = 1;i < nb;i++) - { - ALbufferlistitem *next = OldTail->next; - if(!next || next == Current) break; - OldTail = next; - } - } - if(i != nb) - { - WriteUnlock(&source->queue_lock); - /* Trying to unqueue pending buffers. */ - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - } + if(source->Looping) + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Unqueueing from looping source %u", src); + if(source->SourceType != AL_STREAMING) + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Unqueueing from a non-streaming source %u", + src); - /* Swap it, and cut the new head from the old. */ - OldHead = ATOMIC_EXCHANGE(ALbufferlistitem*, &source->queue, OldTail->next); - if(OldTail->next) - { - ALCdevice *device = context->Device; - uint count; + /* Make sure enough buffers have been processed to unqueue. */ + BufferList = source->queue; + Current = NULL; + if((voice=GetSourceVoice(source, context)) != NULL) + Current = ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed); + else if(source->state == AL_INITIAL) + Current = BufferList; + if(BufferList == Current) + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Unqueueing pending buffers"); - /* Once the active mix (if any) is done, it's safe to cut the old tail - * from the new head. + i = BufferList->num_buffers; + while(i < nb) + { + /* If the next bufferlist to check is NULL or is the current one, it's + * trying to unqueue pending buffers. */ - if(((count=ReadRef(&device->MixCount))&1) != 0) - { - while(count == ReadRef(&device->MixCount)) - althrd_yield(); - } - OldTail->next = NULL; + ALbufferlistitem *next = ATOMIC_LOAD(&BufferList->next, almemory_order_relaxed); + if(!next || next == Current) + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Unqueueing pending buffers"); + BufferList = next; + + i += BufferList->num_buffers; } - WriteUnlock(&source->queue_lock); - while(OldHead != NULL) + while(nb > 0) { - ALbufferlistitem *next = OldHead->next; - ALbuffer *buffer = OldHead->buffer; - - if(!buffer) - *(buffers++) = 0; - else + ALbufferlistitem *head = source->queue; + ALbufferlistitem *next = ATOMIC_LOAD(&head->next, almemory_order_relaxed); + for(i = 0;i < head->num_buffers && nb > 0;i++,nb--) { - *(buffers++) = buffer->id; - DecrementRef(&buffer->ref); + ALbuffer *buffer = head->buffers[i]; + if(!buffer) + *(buffers++) = 0; + else + { + *(buffers++) = buffer->id; + DecrementRef(&buffer->ref); + } + } + if(i < head->num_buffers) + { + /* This head has some buffers left over, so move them to the front + * and update the sample and buffer count. + */ + ALsizei max_length = 0; + ALsizei j = 0; + while(i < head->num_buffers) + { + ALbuffer *buffer = head->buffers[i++]; + if(buffer) max_length = maxi(max_length, buffer->SampleLen); + head->buffers[j++] = buffer; + } + head->max_samples = max_length; + head->num_buffers = j; + break; } - free(OldHead); - OldHead = next; + /* Otherwise, free this item and set the source queue head to the next + * one. + */ + al_free(head); + source->queue = next; } done: - UnlockSourcesRead(context); + UnlockSourceList(context); ALCcontext_DecRef(context); } -static void InitSourceParams(ALsource *Source) +static void InitSourceParams(ALsource *Source, ALsizei num_sends) { - ALuint i; - - RWLockInit(&Source->queue_lock); + ALsizei i; Source->InnerAngle = 360.0f; Source->OuterAngle = 360.0f; @@ -2716,7 +2947,7 @@ static void InitSourceParams(ALsource *Source) Source->Orientation[1][2] = 0.0f; Source->RefDistance = 1.0f; Source->MaxDistance = FLT_MAX; - Source->RollOffFactor = 1.0f; + Source->RolloffFactor = 1.0f; Source->Gain = 1.0f; Source->MinGain = 0.0f; Source->MaxGain = 1.0f; @@ -2729,22 +2960,27 @@ static void InitSourceParams(ALsource *Source) Source->AirAbsorptionFactor = 0.0f; Source->RoomRolloffFactor = 0.0f; Source->DopplerFactor = 1.0f; + Source->HeadRelative = AL_FALSE; + Source->Looping = AL_FALSE; + Source->DistanceModel = DefaultDistanceModel; + Source->Resampler = ResamplerDefault; Source->DirectChannels = AL_FALSE; + Source->Spatialize = SpatializeAuto; Source->StereoPan[0] = DEG2RAD( 30.0f); Source->StereoPan[1] = DEG2RAD(-30.0f); Source->Radius = 0.0f; - Source->DistanceModel = DefaultDistanceModel; - Source->Direct.Gain = 1.0f; Source->Direct.GainHF = 1.0f; Source->Direct.HFReference = LOWPASSFREQREF; Source->Direct.GainLF = 1.0f; Source->Direct.LFReference = HIGHPASSFREQREF; - for(i = 0;i < MAX_SENDS;i++) + Source->Send = al_calloc(16, num_sends*sizeof(Source->Send[0])); + for(i = 0;i < num_sends;i++) { + Source->Send[i].Slot = NULL; Source->Send[i].Gain = 1.0f; Source->Send[i].GainHF = 1.0f; Source->Send[i].HFReference = LOWPASSFREQREF; @@ -2756,353 +2992,198 @@ static void InitSourceParams(ALsource *Source) Source->OffsetType = AL_NONE; Source->SourceType = AL_UNDETERMINED; Source->state = AL_INITIAL; - Source->new_state = AL_NONE; - ATOMIC_INIT(&Source->queue, NULL); - ATOMIC_INIT(&Source->current_buffer, NULL); + Source->queue = NULL; - ATOMIC_INIT(&Source->position, 0); - ATOMIC_INIT(&Source->position_fraction, 0); + /* No way to do an 'init' here, so just test+set with relaxed ordering and + * ignore the test. + */ + ATOMIC_FLAG_TEST_AND_SET(&Source->PropsClean, almemory_order_relaxed); - ATOMIC_INIT(&Source->looping, AL_FALSE); - - ATOMIC_INIT(&Source->Update, NULL); - ATOMIC_INIT(&Source->FreeList, NULL); + Source->VoiceIdx = -1; } -static void DeinitSource(ALsource *source) +static void DeinitSource(ALsource *source, ALsizei num_sends) { ALbufferlistitem *BufferList; - struct ALsourceProps *props; - size_t count = 0; - size_t i; + ALsizei i; - props = ATOMIC_LOAD(&source->Update); - if(props) al_free(props); - - props = ATOMIC_LOAD(&source->FreeList, almemory_order_relaxed); - while(props) - { - struct ALsourceProps *next; - next = ATOMIC_LOAD(&props->next, almemory_order_relaxed); - al_free(props); - props = next; - ++count; - } - /* This is excessively spammy if it traces every source destruction, so - * just warn if it was unexpectedly large. - */ - if(count > 3) - WARN("Freed "SZFMT" Source property objects\n", count); - - BufferList = ATOMIC_EXCHANGE(ALbufferlistitem*, &source->queue, NULL); + BufferList = source->queue; while(BufferList != NULL) { - ALbufferlistitem *next = BufferList->next; - if(BufferList->buffer != NULL) - DecrementRef(&BufferList->buffer->ref); - free(BufferList); + ALbufferlistitem *next = ATOMIC_LOAD(&BufferList->next, almemory_order_relaxed); + for(i = 0;i < BufferList->num_buffers;i++) + { + if(BufferList->buffers[i] != NULL) + DecrementRef(&BufferList->buffers[i]->ref); + } + al_free(BufferList); BufferList = next; } + source->queue = NULL; - for(i = 0;i < MAX_SENDS;++i) + if(source->Send) { - if(source->Send[i].Slot) - DecrementRef(&source->Send[i].Slot->ref); - source->Send[i].Slot = NULL; + for(i = 0;i < num_sends;i++) + { + if(source->Send[i].Slot) + DecrementRef(&source->Send[i].Slot->ref); + source->Send[i].Slot = NULL; + } + al_free(source->Send); + source->Send = NULL; } } -static void UpdateSourceProps(ALsource *source, ALuint num_sends) +static void UpdateSourceProps(ALsource *source, ALvoice *voice, ALsizei num_sends, ALCcontext *context) { - struct ALsourceProps *props; - size_t i; + struct ALvoiceProps *props; + ALsizei i; /* Get an unused property container, or allocate a new one as needed. */ - props = ATOMIC_LOAD(&source->FreeList, almemory_order_acquire); + props = ATOMIC_LOAD(&context->FreeVoiceProps, almemory_order_acquire); if(!props) - props = al_calloc(16, sizeof(*props)); + props = al_calloc(16, FAM_SIZE(struct ALvoiceProps, Send, num_sends)); else { - struct ALsourceProps *next; + struct ALvoiceProps *next; do { next = ATOMIC_LOAD(&props->next, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALsourceProps*, - &source->FreeList, &props, next, almemory_order_seq_cst, - almemory_order_consume) == 0); + } while(ATOMIC_COMPARE_EXCHANGE_PTR_WEAK(&context->FreeVoiceProps, &props, next, + almemory_order_acq_rel, almemory_order_acquire) == 0); } /* Copy in current property values. */ - ATOMIC_STORE(&props->Pitch, source->Pitch, almemory_order_relaxed); - ATOMIC_STORE(&props->Gain, source->Gain, almemory_order_relaxed); - ATOMIC_STORE(&props->OuterGain, source->OuterGain, almemory_order_relaxed); - ATOMIC_STORE(&props->MinGain, source->MinGain, almemory_order_relaxed); - ATOMIC_STORE(&props->MaxGain, source->MaxGain, almemory_order_relaxed); - ATOMIC_STORE(&props->InnerAngle, source->InnerAngle, almemory_order_relaxed); - ATOMIC_STORE(&props->OuterAngle, source->OuterAngle, almemory_order_relaxed); - ATOMIC_STORE(&props->RefDistance, source->RefDistance, almemory_order_relaxed); - ATOMIC_STORE(&props->MaxDistance, source->MaxDistance, almemory_order_relaxed); - ATOMIC_STORE(&props->RollOffFactor, source->RollOffFactor, almemory_order_relaxed); + props->Pitch = source->Pitch; + props->Gain = source->Gain; + props->OuterGain = source->OuterGain; + props->MinGain = source->MinGain; + props->MaxGain = source->MaxGain; + props->InnerAngle = source->InnerAngle; + props->OuterAngle = source->OuterAngle; + props->RefDistance = source->RefDistance; + props->MaxDistance = source->MaxDistance; + props->RolloffFactor = source->RolloffFactor; for(i = 0;i < 3;i++) - ATOMIC_STORE(&props->Position[i], source->Position[i], almemory_order_relaxed); + props->Position[i] = source->Position[i]; for(i = 0;i < 3;i++) - ATOMIC_STORE(&props->Velocity[i], source->Velocity[i], almemory_order_relaxed); + props->Velocity[i] = source->Velocity[i]; for(i = 0;i < 3;i++) - ATOMIC_STORE(&props->Direction[i], source->Direction[i], almemory_order_relaxed); + props->Direction[i] = source->Direction[i]; for(i = 0;i < 2;i++) { - size_t j; + ALsizei j; for(j = 0;j < 3;j++) - ATOMIC_STORE(&props->Orientation[i][j], source->Orientation[i][j], - almemory_order_relaxed); + props->Orientation[i][j] = source->Orientation[i][j]; } - ATOMIC_STORE(&props->HeadRelative, source->HeadRelative, almemory_order_relaxed); - ATOMIC_STORE(&props->DistanceModel, source->DistanceModel, almemory_order_relaxed); - ATOMIC_STORE(&props->DirectChannels, source->DirectChannels, almemory_order_relaxed); + props->HeadRelative = source->HeadRelative; + props->DistanceModel = source->DistanceModel; + props->Resampler = source->Resampler; + props->DirectChannels = source->DirectChannels; + props->SpatializeMode = source->Spatialize; - ATOMIC_STORE(&props->DryGainHFAuto, source->DryGainHFAuto, almemory_order_relaxed); - ATOMIC_STORE(&props->WetGainAuto, source->WetGainAuto, almemory_order_relaxed); - ATOMIC_STORE(&props->WetGainHFAuto, source->WetGainHFAuto, almemory_order_relaxed); - ATOMIC_STORE(&props->OuterGainHF, source->OuterGainHF, almemory_order_relaxed); + props->DryGainHFAuto = source->DryGainHFAuto; + props->WetGainAuto = source->WetGainAuto; + props->WetGainHFAuto = source->WetGainHFAuto; + props->OuterGainHF = source->OuterGainHF; - ATOMIC_STORE(&props->AirAbsorptionFactor, source->AirAbsorptionFactor, almemory_order_relaxed); - ATOMIC_STORE(&props->RoomRolloffFactor, source->RoomRolloffFactor, almemory_order_relaxed); - ATOMIC_STORE(&props->DopplerFactor, source->DopplerFactor, almemory_order_relaxed); + props->AirAbsorptionFactor = source->AirAbsorptionFactor; + props->RoomRolloffFactor = source->RoomRolloffFactor; + props->DopplerFactor = source->DopplerFactor; - ATOMIC_STORE(&props->StereoPan[0], source->StereoPan[0], almemory_order_relaxed); - ATOMIC_STORE(&props->StereoPan[1], source->StereoPan[1], almemory_order_relaxed); + props->StereoPan[0] = source->StereoPan[0]; + props->StereoPan[1] = source->StereoPan[1]; - ATOMIC_STORE(&props->Radius, source->Radius, almemory_order_relaxed); + props->Radius = source->Radius; - ATOMIC_STORE(&props->Direct.Gain, source->Direct.Gain, almemory_order_relaxed); - ATOMIC_STORE(&props->Direct.GainHF, source->Direct.GainHF, almemory_order_relaxed); - ATOMIC_STORE(&props->Direct.HFReference, source->Direct.HFReference, almemory_order_relaxed); - ATOMIC_STORE(&props->Direct.GainLF, source->Direct.GainLF, almemory_order_relaxed); - ATOMIC_STORE(&props->Direct.LFReference, source->Direct.LFReference, almemory_order_relaxed); + props->Direct.Gain = source->Direct.Gain; + props->Direct.GainHF = source->Direct.GainHF; + props->Direct.HFReference = source->Direct.HFReference; + props->Direct.GainLF = source->Direct.GainLF; + props->Direct.LFReference = source->Direct.LFReference; for(i = 0;i < num_sends;i++) { - ATOMIC_STORE(&props->Send[i].Slot, source->Send[i].Slot, almemory_order_relaxed); - ATOMIC_STORE(&props->Send[i].Gain, source->Send[i].Gain, almemory_order_relaxed); - ATOMIC_STORE(&props->Send[i].GainHF, source->Send[i].GainHF, almemory_order_relaxed); - ATOMIC_STORE(&props->Send[i].HFReference, source->Send[i].HFReference, - almemory_order_relaxed); - ATOMIC_STORE(&props->Send[i].GainLF, source->Send[i].GainLF, almemory_order_relaxed); - ATOMIC_STORE(&props->Send[i].LFReference, source->Send[i].LFReference, - almemory_order_relaxed); + props->Send[i].Slot = source->Send[i].Slot; + props->Send[i].Gain = source->Send[i].Gain; + props->Send[i].GainHF = source->Send[i].GainHF; + props->Send[i].HFReference = source->Send[i].HFReference; + props->Send[i].GainLF = source->Send[i].GainLF; + props->Send[i].LFReference = source->Send[i].LFReference; } /* Set the new container for updating internal parameters. */ - props = ATOMIC_EXCHANGE(struct ALsourceProps*, &source->Update, props, almemory_order_acq_rel); + props = ATOMIC_EXCHANGE_PTR(&voice->Update, props, almemory_order_acq_rel); if(props) { /* If there was an unused update container, put it back in the * freelist. */ - struct ALsourceProps *first = ATOMIC_LOAD(&source->FreeList); - do { - ATOMIC_STORE(&props->next, first, almemory_order_relaxed); - } while(ATOMIC_COMPARE_EXCHANGE_WEAK(struct ALsourceProps*, - &source->FreeList, &first, props) == 0); + ATOMIC_REPLACE_HEAD(struct ALvoiceProps*, &context->FreeVoiceProps, props); } } void UpdateAllSourceProps(ALCcontext *context) { - ALuint num_sends = context->Device->NumAuxSends; + ALsizei num_sends = context->Device->NumAuxSends; ALsizei pos; for(pos = 0;pos < context->VoiceCount;pos++) { - ALvoice *voice = &context->Voices[pos]; - ALsource *source = voice->Source; - if(source != NULL && (source->state == AL_PLAYING || - source->state == AL_PAUSED)) - UpdateSourceProps(source, num_sends); + ALvoice *voice = context->Voices[pos]; + ALsource *source = ATOMIC_LOAD(&voice->Source, almemory_order_acquire); + if(source && !ATOMIC_FLAG_TEST_AND_SET(&source->PropsClean, almemory_order_acq_rel)) + UpdateSourceProps(source, voice, num_sends, context); } } -/* SetSourceState - * - * Sets the source's new play state given its current state. - */ -ALvoid SetSourceState(ALsource *Source, ALCcontext *Context, ALenum state) -{ - WriteLock(&Source->queue_lock); - if(state == AL_PLAYING) - { - ALCdevice *device = Context->Device; - ALbufferlistitem *BufferList; - ALboolean discontinuity; - ALvoice *voice = NULL; - ALsizei i; - - /* Check that there is a queue containing at least one valid, non zero - * length Buffer. */ - BufferList = ATOMIC_LOAD(&Source->queue); - while(BufferList) - { - ALbuffer *buffer; - if((buffer=BufferList->buffer) != NULL && buffer->SampleLen > 0) - break; - BufferList = BufferList->next; - } - - if(Source->state != AL_PAUSED) - { - Source->state = AL_PLAYING; - ATOMIC_STORE(&Source->current_buffer, BufferList, almemory_order_relaxed); - ATOMIC_STORE(&Source->position, 0, almemory_order_relaxed); - ATOMIC_STORE(&Source->position_fraction, 0); - discontinuity = AL_TRUE; - } - else - { - Source->state = AL_PLAYING; - discontinuity = AL_FALSE; - } - - // Check if an Offset has been set - if(Source->OffsetType != AL_NONE) - { - ApplyOffset(Source); - /* discontinuity = AL_TRUE;??? */ - } - - /* If there's nothing to play, or device is disconnected, go right to - * stopped */ - if(!BufferList || !device->Connected) - goto do_stop; - - /* Make sure this source isn't already active, while looking for an - * unused active source slot to put it in. */ - for(i = 0;i < Context->VoiceCount;i++) - { - ALsource *old = Source; - if(COMPARE_EXCHANGE(&Context->Voices[i].Source, &old, NULL)) - { - if(voice == NULL) - { - voice = &Context->Voices[i]; - voice->Source = Source; - } - break; - } - old = NULL; - if(voice == NULL && COMPARE_EXCHANGE(&Context->Voices[i].Source, &old, Source)) - voice = &Context->Voices[i]; - } - if(voice == NULL) - { - voice = &Context->Voices[Context->VoiceCount++]; - voice->Source = Source; - } - - if(discontinuity) - { - /* Clear previous samples if playback is discontinuous. */ - memset(voice->PrevSamples, 0, sizeof(voice->PrevSamples)); - - /* Clear the stepping value so the mixer knows not to mix this - * until the update gets applied. - */ - voice->Step = 0; - } - - voice->Moving = AL_FALSE; - for(i = 0;i < MAX_INPUT_CHANNELS;i++) - { - ALsizei j; - for(j = 0;j < HRTF_HISTORY_LENGTH;j++) - voice->Chan[i].Direct.Hrtf.State.History[j] = 0.0f; - for(j = 0;j < HRIR_LENGTH;j++) - { - voice->Chan[i].Direct.Hrtf.State.Values[j][0] = 0.0f; - voice->Chan[i].Direct.Hrtf.State.Values[j][1] = 0.0f; - } - } - - UpdateSourceProps(Source, device->NumAuxSends); - } - else if(state == AL_PAUSED) - { - if(Source->state == AL_PLAYING) - Source->state = AL_PAUSED; - } - else if(state == AL_STOPPED) - { - do_stop: - if(Source->state != AL_INITIAL) - { - Source->state = AL_STOPPED; - ATOMIC_STORE(&Source->current_buffer, NULL); - } - Source->OffsetType = AL_NONE; - Source->Offset = 0.0; - } - else if(state == AL_INITIAL) - { - if(Source->state != AL_INITIAL) - { - Source->state = AL_INITIAL; - ATOMIC_STORE(&Source->current_buffer, ATOMIC_LOAD(&Source->queue), - almemory_order_relaxed); - ATOMIC_STORE(&Source->position, 0, almemory_order_relaxed); - ATOMIC_STORE(&Source->position_fraction, 0); - } - Source->OffsetType = AL_NONE; - Source->Offset = 0.0; - } - WriteUnlock(&Source->queue_lock); -} - /* GetSourceSampleOffset * * Gets the current read offset for the given Source, in 32.32 fixed-point * samples. The offset is relative to the start of the queue (not the start of * the current buffer). */ -static ALint64 GetSourceSampleOffset(ALsource *Source, ALCdevice *device, ALuint64 *clocktime) +static ALint64 GetSourceSampleOffset(ALsource *Source, ALCcontext *context, ALuint64 *clocktime) { - const ALbufferlistitem *BufferList; + ALCdevice *device = context->Device; const ALbufferlistitem *Current; ALuint64 readPos; ALuint refcount; - - ReadLock(&Source->queue_lock); - if(Source->state != AL_PLAYING && Source->state != AL_PAUSED) - { - ReadUnlock(&Source->queue_lock); - do { - while(((refcount=ReadRef(&device->MixCount))&1)) - althrd_yield(); - *clocktime = GetDeviceClockTime(device); - } while(refcount != ReadRef(&device->MixCount)); - return 0; - } + ALvoice *voice; do { - while(((refcount=ReadRef(&device->MixCount))&1)) + Current = NULL; + readPos = 0; + while(((refcount=ATOMIC_LOAD(&device->MixCount, almemory_order_acquire))&1)) althrd_yield(); *clocktime = GetDeviceClockTime(device); - BufferList = ATOMIC_LOAD(&Source->queue, almemory_order_relaxed); - Current = ATOMIC_LOAD(&Source->current_buffer, almemory_order_relaxed); + voice = GetSourceVoice(Source, context); + if(voice) + { + Current = ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed); - readPos = (ALuint64)ATOMIC_LOAD(&Source->position, almemory_order_relaxed) << 32; - readPos |= (ALuint64)ATOMIC_LOAD(&Source->position_fraction, almemory_order_relaxed) << - (32-FRACTIONBITS); - } while(refcount != ReadRef(&device->MixCount)); - while(BufferList && BufferList != Current) + readPos = (ALuint64)ATOMIC_LOAD(&voice->position, almemory_order_relaxed) << 32; + readPos |= (ALuint64)ATOMIC_LOAD(&voice->position_fraction, almemory_order_relaxed) << + (32-FRACTIONBITS); + } + ATOMIC_THREAD_FENCE(almemory_order_acquire); + } while(refcount != ATOMIC_LOAD(&device->MixCount, almemory_order_relaxed)); + + if(voice) { - if(BufferList->buffer) - readPos += (ALuint64)BufferList->buffer->SampleLen << 32; - BufferList = BufferList->next; + const ALbufferlistitem *BufferList = Source->queue; + while(BufferList && BufferList != Current) + { + readPos += (ALuint64)BufferList->max_samples << 32; + BufferList = ATOMIC_LOAD(&CONST_CAST(ALbufferlistitem*,BufferList)->next, + almemory_order_relaxed); + } + readPos = minu64(readPos, U64(0x7fffffffffffffff)); } - ReadUnlock(&Source->queue_lock); - return (ALint64)minu64(readPos, U64(0x7fffffffffffffff)); + return (ALint64)readPos; } /* GetSourceSecOffset @@ -3110,57 +3191,64 @@ static ALint64 GetSourceSampleOffset(ALsource *Source, ALCdevice *device, ALuint * Gets the current read offset for the given Source, in seconds. The offset is * relative to the start of the queue (not the start of the current buffer). */ -static ALdouble GetSourceSecOffset(ALsource *Source, ALCdevice *device, ALuint64 *clocktime) +static ALdouble GetSourceSecOffset(ALsource *Source, ALCcontext *context, ALuint64 *clocktime) { - const ALbufferlistitem *BufferList; + ALCdevice *device = context->Device; const ALbufferlistitem *Current; - const ALbuffer *Buffer = NULL; ALuint64 readPos; ALuint refcount; - - ReadLock(&Source->queue_lock); - if(Source->state != AL_PLAYING && Source->state != AL_PAUSED) - { - ReadUnlock(&Source->queue_lock); - do { - while(((refcount=ReadRef(&device->MixCount))&1)) - althrd_yield(); - *clocktime = GetDeviceClockTime(device); - } while(refcount != ReadRef(&device->MixCount)); - return 0.0; - } + ALdouble offset; + ALvoice *voice; do { - while(((refcount=ReadRef(&device->MixCount))&1)) + Current = NULL; + readPos = 0; + while(((refcount=ATOMIC_LOAD(&device->MixCount, almemory_order_acquire))&1)) althrd_yield(); *clocktime = GetDeviceClockTime(device); - BufferList = ATOMIC_LOAD(&Source->queue, almemory_order_relaxed); - Current = ATOMIC_LOAD(&Source->current_buffer, almemory_order_relaxed); - - readPos = (ALuint64)ATOMIC_LOAD(&Source->position, almemory_order_relaxed)<position_fraction, almemory_order_relaxed); - } while(refcount != ReadRef(&device->MixCount)); - while(BufferList && BufferList != Current) - { - const ALbuffer *buffer = BufferList->buffer; - if(buffer != NULL) + voice = GetSourceVoice(Source, context); + if(voice) { - if(!Buffer) Buffer = buffer; - readPos += (ALuint64)buffer->SampleLen << FRACTIONBITS; + Current = ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed); + + readPos = (ALuint64)ATOMIC_LOAD(&voice->position, almemory_order_relaxed) << + FRACTIONBITS; + readPos |= ATOMIC_LOAD(&voice->position_fraction, almemory_order_relaxed); } - BufferList = BufferList->next; - } + ATOMIC_THREAD_FENCE(almemory_order_acquire); + } while(refcount != ATOMIC_LOAD(&device->MixCount, almemory_order_relaxed)); - while(BufferList && !Buffer) + offset = 0.0; + if(voice) { - Buffer = BufferList->buffer; - BufferList = BufferList->next; - } - assert(Buffer != NULL); + const ALbufferlistitem *BufferList = Source->queue; + const ALbuffer *BufferFmt = NULL; + while(BufferList && BufferList != Current) + { + ALsizei i = 0; + while(!BufferFmt && i < BufferList->num_buffers) + BufferFmt = BufferList->buffers[i++]; + readPos += (ALuint64)BufferList->max_samples << FRACTIONBITS; + BufferList = ATOMIC_LOAD(&CONST_CAST(ALbufferlistitem*,BufferList)->next, + almemory_order_relaxed); + } - ReadUnlock(&Source->queue_lock); - return (ALdouble)readPos / (ALdouble)FRACTIONONE / (ALdouble)Buffer->Frequency; + while(BufferList && !BufferFmt) + { + ALsizei i = 0; + while(!BufferFmt && i < BufferList->num_buffers) + BufferFmt = BufferList->buffers[i++]; + BufferList = ATOMIC_LOAD(&CONST_CAST(ALbufferlistitem*,BufferList)->next, + almemory_order_relaxed); + } + assert(BufferFmt != NULL); + + offset = (ALdouble)readPos / (ALdouble)FRACTIONONE / + (ALdouble)BufferFmt->Frequency; + } + + return offset; } /* GetSourceOffset @@ -3169,99 +3257,104 @@ static ALdouble GetSourceSecOffset(ALsource *Source, ALCdevice *device, ALuint64 * (Bytes, Samples or Seconds). The offset is relative to the start of the * queue (not the start of the current buffer). */ -static ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCdevice *device) +static ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCcontext *context) { - const ALbufferlistitem *BufferList; + ALCdevice *device = context->Device; const ALbufferlistitem *Current; - const ALbuffer *Buffer = NULL; - ALboolean readFin = AL_FALSE; - ALuint readPos, readPosFrac; - ALuint totalBufferLen; - ALdouble offset = 0.0; - ALboolean looping; + ALuint readPos; + ALsizei readPosFrac; ALuint refcount; + ALdouble offset; + ALvoice *voice; - ReadLock(&Source->queue_lock); - if(Source->state != AL_PLAYING && Source->state != AL_PAUSED) - { - ReadUnlock(&Source->queue_lock); - return 0.0; - } - - totalBufferLen = 0; do { - while(((refcount=ReadRef(&device->MixCount))&1)) + Current = NULL; + readPos = readPosFrac = 0; + while(((refcount=ATOMIC_LOAD(&device->MixCount, almemory_order_acquire))&1)) althrd_yield(); - BufferList = ATOMIC_LOAD(&Source->queue, almemory_order_relaxed); - Current = ATOMIC_LOAD(&Source->current_buffer, almemory_order_relaxed); - - readPos = ATOMIC_LOAD(&Source->position, almemory_order_relaxed); - readPosFrac = ATOMIC_LOAD(&Source->position_fraction, almemory_order_relaxed); - - looping = ATOMIC_LOAD(&Source->looping, almemory_order_relaxed); - } while(refcount != ReadRef(&device->MixCount)); - - while(BufferList != NULL) - { - const ALbuffer *buffer; - readFin = readFin || (BufferList == Current); - if((buffer=BufferList->buffer) != NULL) + voice = GetSourceVoice(Source, context); + if(voice) { - if(!Buffer) Buffer = buffer; - totalBufferLen += buffer->SampleLen; - if(!readFin) readPos += buffer->SampleLen; + Current = ATOMIC_LOAD(&voice->current_buffer, almemory_order_relaxed); + + readPos = ATOMIC_LOAD(&voice->position, almemory_order_relaxed); + readPosFrac = ATOMIC_LOAD(&voice->position_fraction, almemory_order_relaxed); } - BufferList = BufferList->next; - } - assert(Buffer != NULL); + ATOMIC_THREAD_FENCE(almemory_order_acquire); + } while(refcount != ATOMIC_LOAD(&device->MixCount, almemory_order_relaxed)); - if(looping) - readPos %= totalBufferLen; - else + offset = 0.0; + if(voice) { - /* Wrap back to 0 */ - if(readPos >= totalBufferLen) - readPos = readPosFrac = 0; + const ALbufferlistitem *BufferList = Source->queue; + const ALbuffer *BufferFmt = NULL; + ALboolean readFin = AL_FALSE; + ALuint totalBufferLen = 0; + + while(BufferList != NULL) + { + ALsizei i = 0; + while(!BufferFmt && i < BufferList->num_buffers) + BufferFmt = BufferList->buffers[i++]; + + readFin |= (BufferList == Current); + totalBufferLen += BufferList->max_samples; + if(!readFin) readPos += BufferList->max_samples; + + BufferList = ATOMIC_LOAD(&CONST_CAST(ALbufferlistitem*,BufferList)->next, + almemory_order_relaxed); + } + assert(BufferFmt != NULL); + + if(Source->Looping) + readPos %= totalBufferLen; + else + { + /* Wrap back to 0 */ + if(readPos >= totalBufferLen) + readPos = readPosFrac = 0; + } + + offset = 0.0; + switch(name) + { + case AL_SEC_OFFSET: + offset = (readPos + (ALdouble)readPosFrac/FRACTIONONE) / BufferFmt->Frequency; + break; + + case AL_SAMPLE_OFFSET: + offset = readPos + (ALdouble)readPosFrac/FRACTIONONE; + break; + + case AL_BYTE_OFFSET: + if(BufferFmt->OriginalType == UserFmtIMA4) + { + ALsizei align = (BufferFmt->OriginalAlign-1)/2 + 4; + ALuint BlockSize = align * ChannelsFromFmt(BufferFmt->FmtChannels); + ALuint FrameBlockSize = BufferFmt->OriginalAlign; + + /* Round down to nearest ADPCM block */ + offset = (ALdouble)(readPos / FrameBlockSize * BlockSize); + } + else if(BufferFmt->OriginalType == UserFmtMSADPCM) + { + ALsizei align = (BufferFmt->OriginalAlign-2)/2 + 7; + ALuint BlockSize = align * ChannelsFromFmt(BufferFmt->FmtChannels); + ALuint FrameBlockSize = BufferFmt->OriginalAlign; + + /* Round down to nearest ADPCM block */ + offset = (ALdouble)(readPos / FrameBlockSize * BlockSize); + } + else + { + ALuint FrameSize = FrameSizeFromFmt(BufferFmt->FmtChannels, + BufferFmt->FmtType); + offset = (ALdouble)(readPos * FrameSize); + } + break; + } } - switch(name) - { - case AL_SEC_OFFSET: - offset = (readPos + (ALdouble)readPosFrac/FRACTIONONE)/Buffer->Frequency; - break; - - case AL_SAMPLE_OFFSET: - offset = readPos + (ALdouble)readPosFrac/FRACTIONONE; - break; - - case AL_BYTE_OFFSET: - if(Buffer->OriginalType == UserFmtIMA4) - { - ALsizei align = (Buffer->OriginalAlign-1)/2 + 4; - ALuint BlockSize = align * ChannelsFromFmt(Buffer->FmtChannels); - ALuint FrameBlockSize = Buffer->OriginalAlign; - - /* Round down to nearest ADPCM block */ - offset = (ALdouble)(readPos / FrameBlockSize * BlockSize); - } - else if(Buffer->OriginalType == UserFmtMSADPCM) - { - ALsizei align = (Buffer->OriginalAlign-2)/2 + 7; - ALuint BlockSize = align * ChannelsFromFmt(Buffer->FmtChannels); - ALuint FrameBlockSize = Buffer->OriginalAlign; - - /* Round down to nearest ADPCM block */ - offset = (ALdouble)(readPos / FrameBlockSize * BlockSize); - } - else - { - ALuint FrameSize = FrameSizeFromUserFmt(Buffer->OriginalChannels, Buffer->OriginalType); - offset = (ALdouble)(readPos * FrameSize); - } - break; - } - - ReadUnlock(&Source->queue_lock); return offset; } @@ -3271,37 +3364,32 @@ static ALdouble GetSourceOffset(ALsource *Source, ALenum name, ALCdevice *device * Apply the stored playback offset to the Source. This function will update * the number of buffers "played" given the stored offset. */ -ALboolean ApplyOffset(ALsource *Source) +static ALboolean ApplyOffset(ALsource *Source, ALvoice *voice) { ALbufferlistitem *BufferList; - const ALbuffer *Buffer; - ALuint bufferLen, totalBufferLen; - ALuint offset=0, frac=0; + ALuint totalBufferLen; + ALuint offset = 0; + ALsizei frac = 0; /* Get sample frame offset */ if(!GetSampleOffset(Source, &offset, &frac)) return AL_FALSE; totalBufferLen = 0; - BufferList = ATOMIC_LOAD(&Source->queue); + BufferList = Source->queue; while(BufferList && totalBufferLen <= offset) { - Buffer = BufferList->buffer; - bufferLen = Buffer ? Buffer->SampleLen : 0; - - if(bufferLen > offset-totalBufferLen) + if((ALuint)BufferList->max_samples > offset-totalBufferLen) { /* Offset is in this buffer */ - ATOMIC_STORE(&Source->current_buffer, BufferList, almemory_order_relaxed); - - ATOMIC_STORE(&Source->position, offset - totalBufferLen, almemory_order_relaxed); - ATOMIC_STORE(&Source->position_fraction, frac); + ATOMIC_STORE(&voice->position, offset - totalBufferLen, almemory_order_relaxed); + ATOMIC_STORE(&voice->position_fraction, frac, almemory_order_relaxed); + ATOMIC_STORE(&voice->current_buffer, BufferList, almemory_order_release); return AL_TRUE; } + totalBufferLen += BufferList->max_samples; - totalBufferLen += bufferLen; - - BufferList = BufferList->next; + BufferList = ATOMIC_LOAD(&BufferList->next, almemory_order_relaxed); } /* Offset is out of range of the queue */ @@ -3315,24 +3403,24 @@ ALboolean ApplyOffset(ALsource *Source) * or Second offset supplied by the application). This takes into account the * fact that the buffer format may have been modifed since. */ -static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALuint *frac) +static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALsizei *frac) { - const ALbuffer *Buffer = NULL; + const ALbuffer *BufferFmt = NULL; const ALbufferlistitem *BufferList; ALdouble dbloff, dblfrac; /* Find the first valid Buffer in the Queue */ - BufferList = ATOMIC_LOAD(&Source->queue); + BufferList = Source->queue; while(BufferList) { - if(BufferList->buffer) - { - Buffer = BufferList->buffer; - break; - } - BufferList = BufferList->next; + ALsizei i; + for(i = 0;i < BufferList->num_buffers && !BufferFmt;i++) + BufferFmt = BufferList->buffers[i]; + if(BufferFmt) break; + BufferList = ATOMIC_LOAD(&CONST_CAST(ALbufferlistitem*,BufferList)->next, + almemory_order_relaxed); } - if(!Buffer) + if(!BufferFmt) { Source->OffsetType = AL_NONE; Source->Offset = 0.0; @@ -3344,33 +3432,33 @@ static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALuint *frac) case AL_BYTE_OFFSET: /* Determine the ByteOffset (and ensure it is block aligned) */ *offset = (ALuint)Source->Offset; - if(Buffer->OriginalType == UserFmtIMA4) + if(BufferFmt->OriginalType == UserFmtIMA4) { - ALsizei align = (Buffer->OriginalAlign-1)/2 + 4; - *offset /= align * ChannelsFromUserFmt(Buffer->OriginalChannels); - *offset *= Buffer->OriginalAlign; + ALsizei align = (BufferFmt->OriginalAlign-1)/2 + 4; + *offset /= align * ChannelsFromFmt(BufferFmt->FmtChannels); + *offset *= BufferFmt->OriginalAlign; } - else if(Buffer->OriginalType == UserFmtMSADPCM) + else if(BufferFmt->OriginalType == UserFmtMSADPCM) { - ALsizei align = (Buffer->OriginalAlign-2)/2 + 7; - *offset /= align * ChannelsFromUserFmt(Buffer->OriginalChannels); - *offset *= Buffer->OriginalAlign; + ALsizei align = (BufferFmt->OriginalAlign-2)/2 + 7; + *offset /= align * ChannelsFromFmt(BufferFmt->FmtChannels); + *offset *= BufferFmt->OriginalAlign; } else - *offset /= FrameSizeFromUserFmt(Buffer->OriginalChannels, Buffer->OriginalType); + *offset /= FrameSizeFromFmt(BufferFmt->FmtChannels, BufferFmt->FmtType); *frac = 0; break; case AL_SAMPLE_OFFSET: dblfrac = modf(Source->Offset, &dbloff); *offset = (ALuint)mind(dbloff, UINT_MAX); - *frac = (ALuint)mind(dblfrac*FRACTIONONE, FRACTIONONE-1.0); + *frac = (ALsizei)mind(dblfrac*FRACTIONONE, FRACTIONONE-1.0); break; case AL_SEC_OFFSET: - dblfrac = modf(Source->Offset*Buffer->Frequency, &dbloff); + dblfrac = modf(Source->Offset*BufferFmt->Frequency, &dbloff); *offset = (ALuint)mind(dbloff, UINT_MAX); - *frac = (ALuint)mind(dblfrac*FRACTIONONE, FRACTIONONE-1.0); + *frac = (ALsizei)mind(dblfrac*FRACTIONONE, FRACTIONONE-1.0); break; } Source->OffsetType = AL_NONE; @@ -3380,22 +3468,124 @@ static ALboolean GetSampleOffset(ALsource *Source, ALuint *offset, ALuint *frac) } +static ALsource *AllocSource(ALCcontext *context) +{ + ALCdevice *device = context->Device; + SourceSubList *sublist, *subend; + ALsource *source = NULL; + ALsizei lidx = 0; + ALsizei slidx; + + almtx_lock(&context->SourceLock); + if(context->NumSources >= device->SourcesMax) + { + almtx_unlock(&context->SourceLock); + alSetError(context, AL_OUT_OF_MEMORY, "Exceeding %u source limit", device->SourcesMax); + return NULL; + } + sublist = VECTOR_BEGIN(context->SourceList); + subend = VECTOR_END(context->SourceList); + for(;sublist != subend;++sublist) + { + if(sublist->FreeMask) + { + slidx = CTZ64(sublist->FreeMask); + source = sublist->Sources + slidx; + break; + } + ++lidx; + } + if(UNLIKELY(!source)) + { + const SourceSubList empty_sublist = { 0, NULL }; + /* Don't allocate so many list entries that the 32-bit ID could + * overflow... + */ + if(UNLIKELY(VECTOR_SIZE(context->SourceList) >= 1<<25)) + { + almtx_unlock(&device->BufferLock); + alSetError(context, AL_OUT_OF_MEMORY, "Too many sources allocated"); + return NULL; + } + lidx = (ALsizei)VECTOR_SIZE(context->SourceList); + VECTOR_PUSH_BACK(context->SourceList, empty_sublist); + sublist = &VECTOR_BACK(context->SourceList); + sublist->FreeMask = ~U64(0); + sublist->Sources = al_calloc(16, sizeof(ALsource)*64); + if(UNLIKELY(!sublist->Sources)) + { + VECTOR_POP_BACK(context->SourceList); + almtx_unlock(&context->SourceLock); + alSetError(context, AL_OUT_OF_MEMORY, "Failed to allocate source batch"); + return NULL; + } + + slidx = 0; + source = sublist->Sources + slidx; + } + + memset(source, 0, sizeof(*source)); + InitSourceParams(source, device->NumAuxSends); + + /* Add 1 to avoid source ID 0. */ + source->id = ((lidx<<6) | slidx) + 1; + + context->NumSources++; + sublist->FreeMask &= ~(U64(1)<SourceLock); + + return source; +} + +static void FreeSource(ALCcontext *context, ALsource *source) +{ + ALCdevice *device = context->Device; + ALuint id = source->id - 1; + ALsizei lidx = id >> 6; + ALsizei slidx = id & 0x3f; + ALvoice *voice; + + ALCdevice_Lock(device); + if((voice=GetSourceVoice(source, context)) != NULL) + { + ATOMIC_STORE(&voice->Source, NULL, almemory_order_relaxed); + ATOMIC_STORE(&voice->Playing, false, almemory_order_release); + } + ALCdevice_Unlock(device); + + DeinitSource(source, device->NumAuxSends); + memset(source, 0, sizeof(*source)); + + VECTOR_ELEM(context->SourceList, lidx).FreeMask |= U64(1) << slidx; + context->NumSources--; +} + /* ReleaseALSources * * Destroys all sources in the source map. */ -ALvoid ReleaseALSources(ALCcontext *Context) +ALvoid ReleaseALSources(ALCcontext *context) { - ALsizei pos; - for(pos = 0;pos < Context->SourceMap.size;pos++) + ALCdevice *device = context->Device; + SourceSubList *sublist = VECTOR_BEGIN(context->SourceList); + SourceSubList *subend = VECTOR_END(context->SourceList); + size_t leftover = 0; + for(;sublist != subend;++sublist) { - ALsource *temp = Context->SourceMap.values[pos]; - Context->SourceMap.values[pos] = NULL; + ALuint64 usemask = ~sublist->FreeMask; + while(usemask) + { + ALsizei idx = CTZ64(usemask); + ALsource *source = sublist->Sources + idx; - DeinitSource(temp); + DeinitSource(source, device->NumAuxSends); + memset(source, 0, sizeof(*source)); + ++leftover; - FreeThunkEntry(temp->id); - memset(temp, 0, sizeof(*temp)); - al_free(temp); + usemask &= ~(U64(1) << idx); + } + sublist->FreeMask = ~usemask; } + if(leftover > 0) + WARN("(%p) Deleted "SZFMT" Source%s\n", device, leftover, (leftover==1)?"":"s"); } diff --git a/Engine/lib/openal-soft/OpenAL32/alState.c b/Engine/lib/openal-soft/OpenAL32/alState.c index 3d8e6c404..ce93e1438 100644 --- a/Engine/lib/openal-soft/OpenAL32/alState.c +++ b/Engine/lib/openal-soft/OpenAL32/alState.c @@ -20,6 +20,8 @@ #include "config.h" +#include "version.h" + #include #include "alMain.h" #include "AL/alc.h" @@ -45,6 +47,31 @@ static const ALchar alErrInvalidValue[] = "Invalid Value"; static const ALchar alErrInvalidOp[] = "Invalid Operation"; static const ALchar alErrOutOfMemory[] = "Out of Memory"; +/* Resampler strings */ +static const ALchar alPointResampler[] = "Nearest"; +static const ALchar alLinearResampler[] = "Linear"; +static const ALchar alCubicResampler[] = "Cubic"; +static const ALchar alBSinc12Resampler[] = "11th order Sinc"; +static const ALchar alBSinc24Resampler[] = "23rd order Sinc"; + +/* WARNING: Non-standard export! Not part of any extension, or exposed in the + * alcFunctions list. + */ +AL_API const ALchar* AL_APIENTRY alsoft_get_version(void) +{ + const char *spoof = getenv("ALSOFT_SPOOF_VERSION"); + if(spoof && spoof[0] != '\0') return spoof; + return ALSOFT_VERSION; +} + +#define DO_UPDATEPROPS() do { \ + if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) \ + UpdateContextProps(context); \ + else \ + ATOMIC_FLAG_CLEAR(&context->PropsClean, almemory_order_release); \ +} while(0) + + AL_API ALvoid AL_APIENTRY alEnable(ALenum capability) { ALCcontext *context; @@ -52,21 +79,19 @@ AL_API ALvoid AL_APIENTRY alEnable(ALenum capability) context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); + almtx_lock(&context->PropLock); switch(capability) { case AL_SOURCE_DISTANCE_MODEL: context->SourceDistanceModel = AL_TRUE; + DO_UPDATEPROPS(); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid enable property 0x%04x", capability); } - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); + almtx_unlock(&context->PropLock); -done: - WriteUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -77,21 +102,19 @@ AL_API ALvoid AL_APIENTRY alDisable(ALenum capability) context = GetContextRef(); if(!context) return; - WriteLock(&context->PropLock); + almtx_lock(&context->PropLock); switch(capability) { case AL_SOURCE_DISTANCE_MODEL: context->SourceDistanceModel = AL_FALSE; + DO_UPDATEPROPS(); break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid disable property 0x%04x", capability); } - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); + almtx_unlock(&context->PropLock); -done: - WriteUnlock(&context->PropLock); ALCcontext_DecRef(context); } @@ -103,6 +126,7 @@ AL_API ALboolean AL_APIENTRY alIsEnabled(ALenum capability) context = GetContextRef(); if(!context) return AL_FALSE; + almtx_lock(&context->PropLock); switch(capability) { case AL_SOURCE_DISTANCE_MODEL: @@ -110,12 +134,11 @@ AL_API ALboolean AL_APIENTRY alIsEnabled(ALenum capability) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid is enabled property 0x%04x", capability); } + almtx_unlock(&context->PropLock); -done: ALCcontext_DecRef(context); - return value; } @@ -127,6 +150,7 @@ AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum pname) context = GetContextRef(); if(!context) return AL_FALSE; + almtx_lock(&context->PropLock); switch(pname) { case AL_DOPPLER_FACTOR: @@ -150,7 +174,7 @@ AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum pname) break; case AL_DEFERRED_UPDATES_SOFT: - if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll) + if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) value = AL_TRUE; break; @@ -159,13 +183,21 @@ AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum pname) value = AL_TRUE; break; + case AL_NUM_RESAMPLERS_SOFT: + /* Always non-0. */ + value = AL_TRUE; + break; + + case AL_DEFAULT_RESAMPLER_SOFT: + value = ResamplerDefault ? AL_TRUE : AL_FALSE; + break; + default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid boolean property 0x%04x", pname); } + almtx_unlock(&context->PropLock); -done: ALCcontext_DecRef(context); - return value; } @@ -177,6 +209,7 @@ AL_API ALdouble AL_APIENTRY alGetDouble(ALenum pname) context = GetContextRef(); if(!context) return 0.0; + almtx_lock(&context->PropLock); switch(pname) { case AL_DOPPLER_FACTOR: @@ -196,7 +229,7 @@ AL_API ALdouble AL_APIENTRY alGetDouble(ALenum pname) break; case AL_DEFERRED_UPDATES_SOFT: - if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll) + if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) value = (ALdouble)AL_TRUE; break; @@ -204,13 +237,20 @@ AL_API ALdouble AL_APIENTRY alGetDouble(ALenum pname) value = (ALdouble)GAIN_MIX_MAX/context->GainBoost; break; + case AL_NUM_RESAMPLERS_SOFT: + value = (ALdouble)(ResamplerMax + 1); + break; + + case AL_DEFAULT_RESAMPLER_SOFT: + value = (ALdouble)ResamplerDefault; + break; + default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid double property 0x%04x", pname); } + almtx_unlock(&context->PropLock); -done: ALCcontext_DecRef(context); - return value; } @@ -222,6 +262,7 @@ AL_API ALfloat AL_APIENTRY alGetFloat(ALenum pname) context = GetContextRef(); if(!context) return 0.0f; + almtx_lock(&context->PropLock); switch(pname) { case AL_DOPPLER_FACTOR: @@ -241,7 +282,7 @@ AL_API ALfloat AL_APIENTRY alGetFloat(ALenum pname) break; case AL_DEFERRED_UPDATES_SOFT: - if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll) + if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) value = (ALfloat)AL_TRUE; break; @@ -249,13 +290,20 @@ AL_API ALfloat AL_APIENTRY alGetFloat(ALenum pname) value = GAIN_MIX_MAX/context->GainBoost; break; + case AL_NUM_RESAMPLERS_SOFT: + value = (ALfloat)(ResamplerMax + 1); + break; + + case AL_DEFAULT_RESAMPLER_SOFT: + value = (ALfloat)ResamplerDefault; + break; + default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid float property 0x%04x", pname); } + almtx_unlock(&context->PropLock); -done: ALCcontext_DecRef(context); - return value; } @@ -267,6 +315,7 @@ AL_API ALint AL_APIENTRY alGetInteger(ALenum pname) context = GetContextRef(); if(!context) return 0; + almtx_lock(&context->PropLock); switch(pname) { case AL_DOPPLER_FACTOR: @@ -286,7 +335,7 @@ AL_API ALint AL_APIENTRY alGetInteger(ALenum pname) break; case AL_DEFERRED_UPDATES_SOFT: - if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll) + if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) value = (ALint)AL_TRUE; break; @@ -294,13 +343,20 @@ AL_API ALint AL_APIENTRY alGetInteger(ALenum pname) value = (ALint)(GAIN_MIX_MAX/context->GainBoost); break; + case AL_NUM_RESAMPLERS_SOFT: + value = ResamplerMax + 1; + break; + + case AL_DEFAULT_RESAMPLER_SOFT: + value = ResamplerDefault; + break; + default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid integer property 0x%04x", pname); } + almtx_unlock(&context->PropLock); -done: ALCcontext_DecRef(context); - return value; } @@ -312,6 +368,7 @@ AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname) context = GetContextRef(); if(!context) return 0; + almtx_lock(&context->PropLock); switch(pname) { case AL_DOPPLER_FACTOR: @@ -331,7 +388,7 @@ AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname) break; case AL_DEFERRED_UPDATES_SOFT: - if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire) == DeferAll) + if(ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) value = (ALint64SOFT)AL_TRUE; break; @@ -339,13 +396,48 @@ AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname) value = (ALint64SOFT)(GAIN_MIX_MAX/context->GainBoost); break; + case AL_NUM_RESAMPLERS_SOFT: + value = (ALint64SOFT)(ResamplerMax + 1); + break; + + case AL_DEFAULT_RESAMPLER_SOFT: + value = (ALint64SOFT)ResamplerDefault; + break; + default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid integer64 property 0x%04x", pname); } + almtx_unlock(&context->PropLock); -done: ALCcontext_DecRef(context); + return value; +} +AL_API void* AL_APIENTRY alGetPointerSOFT(ALenum pname) +{ + ALCcontext *context; + void *value = NULL; + + context = GetContextRef(); + if(!context) return NULL; + + almtx_lock(&context->PropLock); + switch(pname) + { + case AL_EVENT_CALLBACK_FUNCTION_SOFT: + value = context->EventCb; + break; + + case AL_EVENT_CALLBACK_USER_PARAM_SOFT: + value = context->EventParam; + break; + + default: + alSetError(context, AL_INVALID_VALUE, "Invalid pointer property 0x%04x", pname); + } + almtx_unlock(&context->PropLock); + + ALCcontext_DecRef(context); return value; } @@ -363,6 +455,8 @@ AL_API ALvoid AL_APIENTRY alGetBooleanv(ALenum pname, ALboolean *values) case AL_SPEED_OF_SOUND: case AL_DEFERRED_UPDATES_SOFT: case AL_GAIN_LIMIT_SOFT: + case AL_NUM_RESAMPLERS_SOFT: + case AL_DEFAULT_RESAMPLER_SOFT: values[0] = alGetBoolean(pname); return; } @@ -371,15 +465,14 @@ AL_API ALvoid AL_APIENTRY alGetBooleanv(ALenum pname, ALboolean *values) context = GetContextRef(); if(!context) return; - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!values) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); switch(pname) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid boolean-vector property 0x%04x", pname); } -done: ALCcontext_DecRef(context); } @@ -397,6 +490,8 @@ AL_API ALvoid AL_APIENTRY alGetDoublev(ALenum pname, ALdouble *values) case AL_SPEED_OF_SOUND: case AL_DEFERRED_UPDATES_SOFT: case AL_GAIN_LIMIT_SOFT: + case AL_NUM_RESAMPLERS_SOFT: + case AL_DEFAULT_RESAMPLER_SOFT: values[0] = alGetDouble(pname); return; } @@ -405,15 +500,14 @@ AL_API ALvoid AL_APIENTRY alGetDoublev(ALenum pname, ALdouble *values) context = GetContextRef(); if(!context) return; - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!values) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); switch(pname) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid double-vector property 0x%04x", pname); } -done: ALCcontext_DecRef(context); } @@ -431,6 +525,8 @@ AL_API ALvoid AL_APIENTRY alGetFloatv(ALenum pname, ALfloat *values) case AL_SPEED_OF_SOUND: case AL_DEFERRED_UPDATES_SOFT: case AL_GAIN_LIMIT_SOFT: + case AL_NUM_RESAMPLERS_SOFT: + case AL_DEFAULT_RESAMPLER_SOFT: values[0] = alGetFloat(pname); return; } @@ -439,15 +535,14 @@ AL_API ALvoid AL_APIENTRY alGetFloatv(ALenum pname, ALfloat *values) context = GetContextRef(); if(!context) return; - if(!(values)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + if(!values) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); switch(pname) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid float-vector property 0x%04x", pname); } -done: ALCcontext_DecRef(context); } @@ -465,6 +560,8 @@ AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname, ALint *values) case AL_SPEED_OF_SOUND: case AL_DEFERRED_UPDATES_SOFT: case AL_GAIN_LIMIT_SOFT: + case AL_NUM_RESAMPLERS_SOFT: + case AL_DEFAULT_RESAMPLER_SOFT: values[0] = alGetInteger(pname); return; } @@ -473,13 +570,14 @@ AL_API ALvoid AL_APIENTRY alGetIntegerv(ALenum pname, ALint *values) context = GetContextRef(); if(!context) return; + if(!values) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); switch(pname) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid integer-vector property 0x%04x", pname); } -done: ALCcontext_DecRef(context); } @@ -497,6 +595,8 @@ AL_API void AL_APIENTRY alGetInteger64vSOFT(ALenum pname, ALint64SOFT *values) case AL_SPEED_OF_SOUND: case AL_DEFERRED_UPDATES_SOFT: case AL_GAIN_LIMIT_SOFT: + case AL_NUM_RESAMPLERS_SOFT: + case AL_DEFAULT_RESAMPLER_SOFT: values[0] = alGetInteger64SOFT(pname); return; } @@ -505,13 +605,43 @@ AL_API void AL_APIENTRY alGetInteger64vSOFT(ALenum pname, ALint64SOFT *values) context = GetContextRef(); if(!context) return; + if(!values) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); switch(pname) { default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid integer64-vector property 0x%04x", pname); + } + + ALCcontext_DecRef(context); +} + +AL_API void AL_APIENTRY alGetPointervSOFT(ALenum pname, void **values) +{ + ALCcontext *context; + + if(values) + { + switch(pname) + { + case AL_EVENT_CALLBACK_FUNCTION_SOFT: + case AL_EVENT_CALLBACK_USER_PARAM_SOFT: + values[0] = alGetPointerSOFT(pname); + return; + } + } + + context = GetContextRef(); + if(!context) return; + + if(!values) + alSetError(context, AL_INVALID_VALUE, "NULL pointer"); + switch(pname) + { + default: + alSetError(context, AL_INVALID_VALUE, "Invalid pointer-vector property 0x%04x", pname); } -done: ALCcontext_DecRef(context); } @@ -566,12 +696,10 @@ AL_API const ALchar* AL_APIENTRY alGetString(ALenum pname) break; default: - SET_ERROR_AND_GOTO(context, AL_INVALID_ENUM, done); + alSetError(context, AL_INVALID_VALUE, "Invalid string property 0x%04x", pname); } -done: ALCcontext_DecRef(context); - return value; } @@ -583,15 +711,15 @@ AL_API ALvoid AL_APIENTRY alDopplerFactor(ALfloat value) if(!context) return; if(!(value >= 0.0f && isfinite(value))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + alSetError(context, AL_INVALID_VALUE, "Doppler factor %f out of range", value); + else + { + almtx_lock(&context->PropLock); + context->DopplerFactor = value; + DO_UPDATEPROPS(); + almtx_unlock(&context->PropLock); + } - WriteLock(&context->PropLock); - context->DopplerFactor = value; - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); - WriteUnlock(&context->PropLock); - -done: ALCcontext_DecRef(context); } @@ -602,16 +730,30 @@ AL_API ALvoid AL_APIENTRY alDopplerVelocity(ALfloat value) context = GetContextRef(); if(!context) return; + if((ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed)&EventType_Deprecated)) + { + static const ALCchar msg[] = + "alDopplerVelocity is deprecated in AL1.1, use alSpeedOfSound"; + const ALsizei msglen = (ALsizei)strlen(msg); + ALbitfieldSOFT enabledevts; + almtx_lock(&context->EventCbLock); + enabledevts = ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed); + if((enabledevts&EventType_Deprecated) && context->EventCb) + (*context->EventCb)(AL_EVENT_TYPE_DEPRECATED_SOFT, 0, 0, msglen, msg, + context->EventParam); + almtx_unlock(&context->EventCbLock); + } + if(!(value >= 0.0f && isfinite(value))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + alSetError(context, AL_INVALID_VALUE, "Doppler velocity %f out of range", value); + else + { + almtx_lock(&context->PropLock); + context->DopplerVelocity = value; + DO_UPDATEPROPS(); + almtx_unlock(&context->PropLock); + } - WriteLock(&context->PropLock); - context->DopplerVelocity = value; - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); - WriteUnlock(&context->PropLock); - -done: ALCcontext_DecRef(context); } @@ -623,15 +765,15 @@ AL_API ALvoid AL_APIENTRY alSpeedOfSound(ALfloat value) if(!context) return; if(!(value > 0.0f && isfinite(value))) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); + alSetError(context, AL_INVALID_VALUE, "Speed of sound %f out of range", value); + else + { + almtx_lock(&context->PropLock); + context->SpeedOfSound = value; + DO_UPDATEPROPS(); + almtx_unlock(&context->PropLock); + } - WriteLock(&context->PropLock); - context->SpeedOfSound = value; - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); - WriteUnlock(&context->PropLock); - -done: ALCcontext_DecRef(context); } @@ -646,18 +788,16 @@ AL_API ALvoid AL_APIENTRY alDistanceModel(ALenum value) value == AL_LINEAR_DISTANCE || value == AL_LINEAR_DISTANCE_CLAMPED || value == AL_EXPONENT_DISTANCE || value == AL_EXPONENT_DISTANCE_CLAMPED || value == AL_NONE)) - SET_ERROR_AND_GOTO(context, AL_INVALID_VALUE, done); - - WriteLock(&context->PropLock); - context->DistanceModel = value; - if(!context->SourceDistanceModel) + alSetError(context, AL_INVALID_VALUE, "Distance model 0x%04x out of range", value); + else { - if(!ATOMIC_LOAD(&context->DeferUpdates, almemory_order_acquire)) - UpdateListenerProps(context); + almtx_lock(&context->PropLock); + context->DistanceModel = value; + if(!context->SourceDistanceModel) + DO_UPDATEPROPS(); + almtx_unlock(&context->PropLock); } - WriteUnlock(&context->PropLock); -done: ALCcontext_DecRef(context); } @@ -669,7 +809,7 @@ AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void) context = GetContextRef(); if(!context) return; - ALCcontext_DeferUpdates(context, DeferAll); + ALCcontext_DeferUpdates(context); ALCcontext_DecRef(context); } @@ -685,3 +825,76 @@ AL_API ALvoid AL_APIENTRY alProcessUpdatesSOFT(void) ALCcontext_DecRef(context); } + + +AL_API const ALchar* AL_APIENTRY alGetStringiSOFT(ALenum pname, ALsizei index) +{ + const char *ResamplerNames[] = { + alPointResampler, alLinearResampler, + alCubicResampler, alBSinc12Resampler, + alBSinc24Resampler, + }; + const ALchar *value = NULL; + ALCcontext *context; + + static_assert(COUNTOF(ResamplerNames) == ResamplerMax+1, "Incorrect ResamplerNames list"); + + context = GetContextRef(); + if(!context) return NULL; + + switch(pname) + { + case AL_RESAMPLER_NAME_SOFT: + if(index < 0 || (size_t)index >= COUNTOF(ResamplerNames)) + SETERR_GOTO(context, AL_INVALID_VALUE, done, "Resampler name index %d out of range", + index); + value = ResamplerNames[index]; + break; + + default: + alSetError(context, AL_INVALID_VALUE, "Invalid string indexed property"); + } + +done: + ALCcontext_DecRef(context); + return value; +} + + +void UpdateContextProps(ALCcontext *context) +{ + struct ALcontextProps *props; + + /* Get an unused proprty container, or allocate a new one as needed. */ + props = ATOMIC_LOAD(&context->FreeContextProps, almemory_order_acquire); + if(!props) + props = al_calloc(16, sizeof(*props)); + else + { + struct ALcontextProps *next; + do { + next = ATOMIC_LOAD(&props->next, almemory_order_relaxed); + } while(ATOMIC_COMPARE_EXCHANGE_PTR_WEAK(&context->FreeContextProps, &props, next, + almemory_order_seq_cst, almemory_order_acquire) == 0); + } + + /* Copy in current property values. */ + props->MetersPerUnit = context->MetersPerUnit; + + props->DopplerFactor = context->DopplerFactor; + props->DopplerVelocity = context->DopplerVelocity; + props->SpeedOfSound = context->SpeedOfSound; + + props->SourceDistanceModel = context->SourceDistanceModel; + props->DistanceModel = context->DistanceModel; + + /* Set the new container for updating internal parameters. */ + props = ATOMIC_EXCHANGE_PTR(&context->Update, props, almemory_order_acq_rel); + if(props) + { + /* If there was an unused update container, put it back in the + * freelist. + */ + ATOMIC_REPLACE_HEAD(struct ALcontextProps*, &context->FreeContextProps, props); + } +} diff --git a/Engine/lib/openal-soft/OpenAL32/alThunk.c b/Engine/lib/openal-soft/OpenAL32/alThunk.c deleted file mode 100644 index 72fc0dcbe..000000000 --- a/Engine/lib/openal-soft/OpenAL32/alThunk.c +++ /dev/null @@ -1,105 +0,0 @@ -/** - * OpenAL cross platform audio library - * Copyright (C) 1999-2007 by authors. - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - * Or go to http://www.gnu.org/copyleft/lgpl.html - */ - -#include "config.h" - -#include - -#include "alMain.h" -#include "alThunk.h" - -#include "almalloc.h" - - -static ATOMIC(ALenum) *ThunkArray; -static ALuint ThunkArraySize; -static RWLock ThunkLock; - -void ThunkInit(void) -{ - RWLockInit(&ThunkLock); - ThunkArraySize = 1024; - ThunkArray = al_calloc(16, ThunkArraySize * sizeof(*ThunkArray)); -} - -void ThunkExit(void) -{ - al_free(ThunkArray); - ThunkArray = NULL; - ThunkArraySize = 0; -} - -ALenum NewThunkEntry(ALuint *index) -{ - void *NewList; - ALuint i; - - ReadLock(&ThunkLock); - for(i = 0;i < ThunkArraySize;i++) - { - if(ATOMIC_EXCHANGE(ALenum, &ThunkArray[i], AL_TRUE) == AL_FALSE) - { - ReadUnlock(&ThunkLock); - *index = i+1; - return AL_NO_ERROR; - } - } - ReadUnlock(&ThunkLock); - - WriteLock(&ThunkLock); - /* Double-check that there's still no free entries, in case another - * invocation just came through and increased the size of the array. - */ - for(;i < ThunkArraySize;i++) - { - if(ATOMIC_EXCHANGE(ALenum, &ThunkArray[i], AL_TRUE) == AL_FALSE) - { - WriteUnlock(&ThunkLock); - *index = i+1; - return AL_NO_ERROR; - } - } - - NewList = al_calloc(16, ThunkArraySize*2 * sizeof(*ThunkArray)); - if(!NewList) - { - WriteUnlock(&ThunkLock); - ERR("Realloc failed to increase to %u entries!\n", ThunkArraySize*2); - return AL_OUT_OF_MEMORY; - } - memcpy(NewList, ThunkArray, ThunkArraySize*sizeof(*ThunkArray)); - al_free(ThunkArray); - ThunkArray = NewList; - ThunkArraySize *= 2; - - ATOMIC_STORE(&ThunkArray[i], AL_TRUE); - WriteUnlock(&ThunkLock); - - *index = i+1; - return AL_NO_ERROR; -} - -void FreeThunkEntry(ALuint index) -{ - ReadLock(&ThunkLock); - if(index > 0 && index <= ThunkArraySize) - ATOMIC_STORE(&ThunkArray[index-1], AL_FALSE); - ReadUnlock(&ThunkLock); -} diff --git a/Engine/lib/openal-soft/OpenAL32/event.c b/Engine/lib/openal-soft/OpenAL32/event.c new file mode 100644 index 000000000..12636489b --- /dev/null +++ b/Engine/lib/openal-soft/OpenAL32/event.c @@ -0,0 +1,140 @@ + +#include "config.h" + +#include "AL/alc.h" +#include "AL/al.h" +#include "AL/alext.h" +#include "alMain.h" +#include "alError.h" +#include "ringbuffer.h" + + +static int EventThread(void *arg) +{ + ALCcontext *context = arg; + + /* Clear all pending posts on the semaphore. */ + while(alsem_trywait(&context->EventSem) == althrd_success) + { + } + + while(1) + { + ALbitfieldSOFT enabledevts; + AsyncEvent evt; + + if(ll_ringbuffer_read(context->AsyncEvents, (char*)&evt, 1) == 0) + { + alsem_wait(&context->EventSem); + continue; + } + if(!evt.EnumType) + break; + + almtx_lock(&context->EventCbLock); + enabledevts = ATOMIC_LOAD(&context->EnabledEvts, almemory_order_acquire); + if(context->EventCb && (enabledevts&evt.EnumType) == evt.EnumType) + context->EventCb(evt.Type, evt.ObjectId, evt.Param, (ALsizei)strlen(evt.Message), + evt.Message, context->EventParam); + almtx_unlock(&context->EventCbLock); + } + return 0; +} + +AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, ALboolean enable) +{ + ALCcontext *context; + ALbitfieldSOFT enabledevts; + ALbitfieldSOFT flags = 0; + bool isrunning; + ALsizei i; + + context = GetContextRef(); + if(!context) return; + + if(count < 0) SETERR_GOTO(context, AL_INVALID_VALUE, done, "Controlling %d events", count); + if(count == 0) goto done; + if(!types) SETERR_GOTO(context, AL_INVALID_VALUE, done, "NULL pointer"); + + for(i = 0;i < count;i++) + { + if(types[i] == AL_EVENT_TYPE_BUFFER_COMPLETED_SOFT) + flags |= EventType_BufferCompleted; + else if(types[i] == AL_EVENT_TYPE_SOURCE_STATE_CHANGED_SOFT) + flags |= EventType_SourceStateChange; + else if(types[i] == AL_EVENT_TYPE_ERROR_SOFT) + flags |= EventType_Error; + else if(types[i] == AL_EVENT_TYPE_PERFORMANCE_SOFT) + flags |= EventType_Performance; + else if(types[i] == AL_EVENT_TYPE_DEPRECATED_SOFT) + flags |= EventType_Deprecated; + else if(types[i] == AL_EVENT_TYPE_DISCONNECTED_SOFT) + flags |= EventType_Disconnected; + else + SETERR_GOTO(context, AL_INVALID_ENUM, done, "Invalid event type 0x%04x", types[i]); + } + + almtx_lock(&context->EventThrdLock); + if(enable) + { + if(!context->AsyncEvents) + context->AsyncEvents = ll_ringbuffer_create(63, sizeof(AsyncEvent), false); + enabledevts = ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed); + isrunning = !!enabledevts; + while(ATOMIC_COMPARE_EXCHANGE_WEAK(&context->EnabledEvts, &enabledevts, enabledevts|flags, + almemory_order_acq_rel, almemory_order_acquire) == 0) + { + /* enabledevts is (re-)filled with the current value on failure, so + * just try again. + */ + } + if(!isrunning && flags) + althrd_create(&context->EventThread, EventThread, context); + } + else + { + enabledevts = ATOMIC_LOAD(&context->EnabledEvts, almemory_order_relaxed); + isrunning = !!enabledevts; + while(ATOMIC_COMPARE_EXCHANGE_WEAK(&context->EnabledEvts, &enabledevts, enabledevts&~flags, + almemory_order_acq_rel, almemory_order_acquire) == 0) + { + } + if(isrunning && !(enabledevts&~flags)) + { + static const AsyncEvent kill_evt = { 0 }; + while(ll_ringbuffer_write(context->AsyncEvents, (const char*)&kill_evt, 1) == 0) + althrd_yield(); + alsem_post(&context->EventSem); + althrd_join(context->EventThread, NULL); + } + else + { + /* Wait to ensure the event handler sees the changed flags before + * returning. + */ + almtx_lock(&context->EventCbLock); + almtx_unlock(&context->EventCbLock); + } + } + almtx_unlock(&context->EventThrdLock); + +done: + ALCcontext_DecRef(context); +} + +AL_API void AL_APIENTRY alEventCallbackSOFT(ALEVENTPROCSOFT callback, void *userParam) +{ + ALCcontext *context; + + context = GetContextRef(); + if(!context) return; + + almtx_lock(&context->PropLock); + almtx_lock(&context->EventCbLock); + context->EventCb = callback; + context->EventParam = userParam; + almtx_unlock(&context->EventCbLock); + almtx_unlock(&context->PropLock); + + ALCcontext_DecRef(context); +} diff --git a/Engine/lib/openal-soft/OpenAL32/sample_cvt.c b/Engine/lib/openal-soft/OpenAL32/sample_cvt.c index aff3de834..4a85f74af 100644 --- a/Engine/lib/openal-soft/OpenAL32/sample_cvt.c +++ b/Engine/lib/openal-soft/OpenAL32/sample_cvt.c @@ -3,13 +3,6 @@ #include "sample_cvt.h" -#ifdef HAVE_ALLOCA_H -#include -#endif -#ifdef HAVE_MALLOC_H -#include -#endif - #include "AL/al.h" #include "alu.h" #include "alBuffer.h" @@ -61,7 +54,7 @@ static const int MSADPCMAdaptionCoeff[7][2] = { /* A quick'n'dirty lookup table to decode a muLaw-encoded byte sample into a * signed 16-bit sample */ -static const ALshort muLawDecompressionTable[256] = { +const ALshort muLawDecompressionTable[256] = { -32124,-31100,-30076,-29052,-28028,-27004,-25980,-24956, -23932,-22908,-21884,-20860,-19836,-18812,-17788,-16764, -15996,-15484,-14972,-14460,-13948,-13436,-12924,-12412, @@ -96,32 +89,10 @@ static const ALshort muLawDecompressionTable[256] = { 56, 48, 40, 32, 24, 16, 8, 0 }; -/* Values used when encoding a muLaw sample */ -static const int muLawBias = 0x84; -static const int muLawClip = 32635; -static const char muLawCompressTable[256] = { - 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4, - 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 -}; - /* A quick'n'dirty lookup table to decode an aLaw-encoded byte sample into a * signed 16-bit sample */ -static const ALshort aLawDecompressionTable[256] = { +const ALshort aLawDecompressionTable[256] = { -5504, -5248, -6016, -5760, -4480, -4224, -4992, -4736, -7552, -7296, -8064, -7808, -6528, -6272, -7040, -6784, -2752, -2624, -3008, -2880, -2240, -2112, -2496, -2368, @@ -156,92 +127,13 @@ static const ALshort aLawDecompressionTable[256] = { 944, 912, 1008, 976, 816, 784, 880, 848 }; -/* Values used when encoding an aLaw sample */ -static const int aLawClip = 32635; -static const char aLawCompressTable[128] = { - 1,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4, - 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7 -}; - -typedef ALubyte ALmulaw; -typedef ALubyte ALalaw; -typedef ALubyte ALima4; -typedef ALubyte ALmsadpcm; -typedef struct { - ALbyte b[3]; -} ALbyte3; -static_assert(sizeof(ALbyte3)==sizeof(ALbyte[3]), "ALbyte3 size is not 3"); -typedef struct { - ALubyte b[3]; -} ALubyte3; -static_assert(sizeof(ALubyte3)==sizeof(ALubyte[3]), "ALubyte3 size is not 3"); - -static inline ALshort DecodeMuLaw(ALmulaw val) -{ return muLawDecompressionTable[val]; } - -static ALmulaw EncodeMuLaw(ALshort val) +static void DecodeIMA4Block(ALshort *dst, const ALubyte *src, ALint numchans, ALsizei align) { - ALint mant, exp, sign; - - sign = (val>>8) & 0x80; - if(sign) - { - /* -32768 doesn't properly negate on a short; it results in itself. - * So clamp to -32767 */ - val = maxi(val, -32767); - val = -val; - } - - val = mini(val, muLawClip); - val += muLawBias; - - exp = muLawCompressTable[(val>>7) & 0xff]; - mant = (val >> (exp+3)) & 0x0f; - - return ~(sign | (exp<<4) | mant); -} - -static inline ALshort DecodeALaw(ALalaw val) -{ return aLawDecompressionTable[val]; } - -static ALalaw EncodeALaw(ALshort val) -{ - ALint mant, exp, sign; - - sign = ((~val) >> 8) & 0x80; - if(!sign) - { - val = maxi(val, -32767); - val = -val; - } - val = mini(val, aLawClip); - - if(val >= 256) - { - exp = aLawCompressTable[(val>>8) & 0x7f]; - mant = (val >> (exp+3)) & 0x0f; - } - else - { - exp = 0; - mant = val >> 4; - } - - return ((exp<<4) | mant) ^ (sign^0x55); -} - -static void DecodeIMA4Block(ALshort *dst, const ALima4 *src, ALint numchans, ALsizei align) -{ - ALint sample[MAX_INPUT_CHANNELS], index[MAX_INPUT_CHANNELS]; - ALuint code[MAX_INPUT_CHANNELS]; - ALsizei j,k,c; + ALint sample[MAX_INPUT_CHANNELS] = { 0 }; + ALint index[MAX_INPUT_CHANNELS] = { 0 }; + ALuint code[MAX_INPUT_CHANNELS] = { 0 }; + ALsizei c, i; for(c = 0;c < numchans;c++) { @@ -257,143 +149,77 @@ static void DecodeIMA4Block(ALshort *dst, const ALima4 *src, ALint numchans, ALs dst[c] = sample[c]; } - for(j = 1;j < align;j += 8) + for(i = 1;i < align;i++) { - for(c = 0;c < numchans;c++) - { - code[c] = *(src++); - code[c] |= *(src++) << 8; - code[c] |= *(src++) << 16; - code[c] |= *(src++) << 24; - } - - for(k = 0;k < 8;k++) + if((i&7) == 1) { for(c = 0;c < numchans;c++) { - int nibble = code[c]&0xf; - code[c] >>= 4; - - sample[c] += IMA4Codeword[nibble] * IMAStep_size[index[c]] / 8; - sample[c] = clampi(sample[c], -32768, 32767); - - index[c] += IMA4Index_adjust[nibble]; - index[c] = clampi(index[c], 0, 88); - - dst[(j+k)*numchans + c] = sample[c]; + code[c] = *(src++); + code[c] |= *(src++) << 8; + code[c] |= *(src++) << 16; + code[c] |= *(src++) << 24; } } + + for(c = 0;c < numchans;c++) + { + int nibble = code[c]&0xf; + code[c] >>= 4; + + sample[c] += IMA4Codeword[nibble] * IMAStep_size[index[c]] / 8; + sample[c] = clampi(sample[c], -32768, 32767); + + index[c] += IMA4Index_adjust[nibble]; + index[c] = clampi(index[c], 0, 88); + + *(dst++) = sample[c]; + } } } -static void EncodeIMA4Block(ALima4 *dst, const ALshort *src, ALint *sample, ALint *index, ALint numchans, ALsizei align) +static void DecodeMSADPCMBlock(ALshort *dst, const ALubyte *src, ALint numchans, ALsizei align) { - ALsizei j,k,c; + ALubyte blockpred[MAX_INPUT_CHANNELS] = { 0 }; + ALint delta[MAX_INPUT_CHANNELS] = { 0 }; + ALshort samples[MAX_INPUT_CHANNELS][2] = { { 0, 0 } }; + ALint c, i; for(c = 0;c < numchans;c++) { - int diff = src[c] - sample[c]; - int step = IMAStep_size[index[c]]; - int nibble; - - nibble = 0; - if(diff < 0) - { - nibble = 0x8; - diff = -diff; - } - - diff = mini(step*2, diff); - nibble |= (diff*8/step - 1) / 2; - - sample[c] += IMA4Codeword[nibble] * step / 8; - sample[c] = clampi(sample[c], -32768, 32767); - - index[c] += IMA4Index_adjust[nibble]; - index[c] = clampi(index[c], 0, 88); - - *(dst++) = sample[c] & 0xff; - *(dst++) = (sample[c]>>8) & 0xff; - *(dst++) = index[c] & 0xff; - *(dst++) = (index[c]>>8) & 0xff; + blockpred[c] = *(src++); + blockpred[c] = minu(blockpred[c], 6); } - - for(j = 1;j < align;j += 8) + for(c = 0;c < numchans;c++) { - for(c = 0;c < numchans;c++) - { - for(k = 0;k < 8;k++) - { - int diff = src[(j+k)*numchans + c] - sample[c]; - int step = IMAStep_size[index[c]]; - int nibble; - - nibble = 0; - if(diff < 0) - { - nibble = 0x8; - diff = -diff; - } - - diff = mini(step*2, diff); - nibble |= (diff*8/step - 1) / 2; - - sample[c] += IMA4Codeword[nibble] * step / 8; - sample[c] = clampi(sample[c], -32768, 32767); - - index[c] += IMA4Index_adjust[nibble]; - index[c] = clampi(index[c], 0, 88); - - if(!(k&1)) *dst = nibble; - else *(dst++) |= nibble<<4; - } - } + delta[c] = *(src++); + delta[c] |= *(src++) << 8; + delta[c] = (delta[c]^0x8000) - 32768; } -} - - -static void DecodeMSADPCMBlock(ALshort *dst, const ALmsadpcm *src, ALint numchans, ALsizei align) -{ - ALubyte blockpred[MAX_INPUT_CHANNELS]; - ALint delta[MAX_INPUT_CHANNELS]; - ALshort samples[MAX_INPUT_CHANNELS][2]; - ALint i, j; - - for(i = 0;i < numchans;i++) + for(c = 0;c < numchans;c++) { - blockpred[i] = *(src++); - blockpred[i] = minu(blockpred[i], 6); + samples[c][0] = *(src++); + samples[c][0] |= *(src++) << 8; + samples[c][0] = (samples[c][0]^0x8000) - 32768; } - for(i = 0;i < numchans;i++) + for(c = 0;c < numchans;c++) { - delta[i] = *(src++); - delta[i] |= *(src++) << 8; - delta[i] = (delta[i]^0x8000) - 0x8000; - } - for(i = 0;i < numchans;i++) - { - samples[i][0] = *(src++); - samples[i][0] |= *(src++) << 8; - samples[i][0] = (samples[i][0]^0x8000) - 0x8000; - } - for(i = 0;i < numchans;i++) - { - samples[i][1] = *(src++); - samples[i][1] |= *(src++) << 8; - samples[i][1] = (samples[i][1]^0x8000) - 0x8000; + samples[c][1] = *(src++); + samples[c][1] |= *(src++) << 8; + samples[c][1] = (samples[c][1]^0x8000) - 0x8000; } /* Second sample is written first. */ - for(i = 0;i < numchans;i++) - *(dst++) = samples[i][1]; - for(i = 0;i < numchans;i++) - *(dst++) = samples[i][0]; + for(c = 0;c < numchans;c++) + *(dst++) = samples[c][1]; + for(c = 0;c < numchans;c++) + *(dst++) = samples[c][0]; - for(j = 2;j < align;j++) + for(i = 2;i < align;i++) { - for(i = 0;i < numchans;i++) + for(c = 0;c < numchans;c++) { - const ALint num = (j*numchans) + i; + const ALint num = (i*numchans) + c; ALint nibble, pred; /* Read the nibble (first is in the upper bits). */ @@ -402,388 +228,28 @@ static void DecodeMSADPCMBlock(ALshort *dst, const ALmsadpcm *src, ALint numchan else nibble = (*(src++))&0x0f; - pred = (samples[i][0]*MSADPCMAdaptionCoeff[blockpred[i]][0] + - samples[i][1]*MSADPCMAdaptionCoeff[blockpred[i]][1]) / 256; - pred += ((nibble^0x08) - 0x08) * delta[i]; + pred = (samples[c][0]*MSADPCMAdaptionCoeff[blockpred[c]][0] + + samples[c][1]*MSADPCMAdaptionCoeff[blockpred[c]][1]) / 256; + pred += ((nibble^0x08) - 0x08) * delta[c]; pred = clampi(pred, -32768, 32767); - samples[i][1] = samples[i][0]; - samples[i][0] = pred; + samples[c][1] = samples[c][0]; + samples[c][0] = pred; - delta[i] = (MSADPCMAdaption[nibble] * delta[i]) / 256; - delta[i] = maxi(16, delta[i]); + delta[c] = (MSADPCMAdaption[nibble] * delta[c]) / 256; + delta[c] = maxi(16, delta[c]); *(dst++) = pred; } } } -/* NOTE: This encoder is pretty dumb/simplistic. Some kind of pre-processing - * that tries to find the optimal block predictors would be nice, at least. A - * multi-pass method that can generate better deltas would be good, too. */ -static void EncodeMSADPCMBlock(ALmsadpcm *dst, const ALshort *src, ALint *sample, ALint numchans, ALsizei align) -{ - ALubyte blockpred[MAX_INPUT_CHANNELS]; - ALint delta[MAX_INPUT_CHANNELS]; - ALshort samples[MAX_INPUT_CHANNELS][2]; - ALint i, j; - /* Block predictor */ - for(i = 0;i < numchans;i++) - { - /* FIXME: Calculate something better. */ - blockpred[i] = 0; - *(dst++) = blockpred[i]; - } - /* Initial delta */ - for(i = 0;i < numchans;i++) - { - delta[i] = 16; - *(dst++) = (delta[i] ) & 0xff; - *(dst++) = (delta[i]>>8) & 0xff; - } - /* Initial sample 1 */ - for(i = 0;i < numchans;i++) - { - samples[i][0] = src[1*numchans + i]; - *(dst++) = (samples[i][0] ) & 0xff; - *(dst++) = (samples[i][0]>>8) & 0xff; - } - /* Initial sample 2 */ - for(i = 0;i < numchans;i++) - { - samples[i][1] = src[i]; - *(dst++) = (samples[i][1] ) & 0xff; - *(dst++) = (samples[i][1]>>8) & 0xff; - } - - for(j = 2;j < align;j++) - { - for(i = 0;i < numchans;i++) - { - const ALint num = (j*numchans) + i; - ALint nibble = 0; - ALint bias; - - sample[i] = (samples[i][0]*MSADPCMAdaptionCoeff[blockpred[i]][0] + - samples[i][1]*MSADPCMAdaptionCoeff[blockpred[i]][1]) / 256; - - nibble = src[num] - sample[i]; - if(nibble >= 0) - bias = delta[i] / 2; - else - bias = -delta[i] / 2; - - nibble = (nibble + bias) / delta[i]; - nibble = clampi(nibble, -8, 7)&0x0f; - - sample[i] += ((nibble^0x08)-0x08) * delta[i]; - sample[i] = clampi(sample[i], -32768, 32767); - - samples[i][1] = samples[i][0]; - samples[i][0] = sample[i]; - - delta[i] = (MSADPCMAdaption[nibble] * delta[i]) / 256; - delta[i] = maxi(16, delta[i]); - - if(!(num&1)) - *dst = nibble << 4; - else - { - *dst |= nibble; - dst++; - } - } - } -} - - -static inline ALint DecodeByte3(ALbyte3 val) -{ - if(IS_LITTLE_ENDIAN) - return (val.b[2]<<16) | (((ALubyte)val.b[1])<<8) | ((ALubyte)val.b[0]); - return (val.b[0]<<16) | (((ALubyte)val.b[1])<<8) | ((ALubyte)val.b[2]); -} - -static inline ALbyte3 EncodeByte3(ALint val) -{ - if(IS_LITTLE_ENDIAN) - { - ALbyte3 ret = {{ val, val>>8, val>>16 }}; - return ret; - } - else - { - ALbyte3 ret = {{ val>>16, val>>8, val }}; - return ret; - } -} - -static inline ALint DecodeUByte3(ALubyte3 val) -{ - if(IS_LITTLE_ENDIAN) - return (val.b[2]<<16) | (val.b[1]<<8) | (val.b[0]); - return (val.b[0]<<16) | (val.b[1]<<8) | val.b[2]; -} - -static inline ALubyte3 EncodeUByte3(ALint val) -{ - if(IS_LITTLE_ENDIAN) - { - ALubyte3 ret = {{ val, val>>8, val>>16 }}; - return ret; - } - else - { - ALubyte3 ret = {{ val>>16, val>>8, val }}; - return ret; - } -} - - -/* Define same-type pass-through sample conversion functions (excludes ADPCM, - * which are block-based). */ -#define DECL_TEMPLATE(T) \ -static inline T Conv_##T##_##T(T val) { return val; } - -DECL_TEMPLATE(ALbyte); -DECL_TEMPLATE(ALubyte); -DECL_TEMPLATE(ALshort); -DECL_TEMPLATE(ALushort); -DECL_TEMPLATE(ALint); -DECL_TEMPLATE(ALuint); -DECL_TEMPLATE(ALbyte3); -DECL_TEMPLATE(ALubyte3); -DECL_TEMPLATE(ALalaw); -DECL_TEMPLATE(ALmulaw); - -/* Slightly special handling for floats and doubles (converts NaN to 0, and - * allows float<->double pass-through). - */ -static inline ALfloat Conv_ALfloat_ALfloat(ALfloat val) -{ return (val==val) ? val : 0.0f; } -static inline ALfloat Conv_ALfloat_ALdouble(ALdouble val) -{ return (val==val) ? (ALfloat)val : 0.0f; } -static inline ALdouble Conv_ALdouble_ALfloat(ALfloat val) -{ return (val==val) ? (ALdouble)val : 0.0; } -static inline ALdouble Conv_ALdouble_ALdouble(ALdouble val) -{ return (val==val) ? val : 0.0; } - -#undef DECL_TEMPLATE - -/* Define alternate-sign functions. */ -#define DECL_TEMPLATE(T1, T2, O) \ -static inline T1 Conv_##T1##_##T2(T2 val) { return (T1)val - O; } \ -static inline T2 Conv_##T2##_##T1(T1 val) { return (T2)val + O; } - -DECL_TEMPLATE(ALbyte, ALubyte, 128); -DECL_TEMPLATE(ALshort, ALushort, 32768); -DECL_TEMPLATE(ALint, ALuint, 2147483648u); - -#undef DECL_TEMPLATE - -/* Define int-type to int-type functions */ -#define DECL_TEMPLATE(T, ST, UT, SH) \ -static inline T Conv_##T##_##ST(ST val){ return val >> SH; } \ -static inline T Conv_##T##_##UT(UT val){ return Conv_##ST##_##UT(val) >> SH; }\ -static inline ST Conv_##ST##_##T(T val){ return val << SH; } \ -static inline UT Conv_##UT##_##T(T val){ return Conv_##UT##_##ST(val << SH); } - -#define DECL_TEMPLATE2(T1, T2, SH) \ -DECL_TEMPLATE(AL##T1, AL##T2, ALu##T2, SH) \ -DECL_TEMPLATE(ALu##T1, ALu##T2, AL##T2, SH) - -DECL_TEMPLATE2(byte, short, 8) -DECL_TEMPLATE2(short, int, 16) -DECL_TEMPLATE2(byte, int, 24) - -#undef DECL_TEMPLATE2 -#undef DECL_TEMPLATE - -/* Define int-type to fp functions */ -#define DECL_TEMPLATE(T, ST, UT, OP) \ -static inline T Conv_##T##_##ST(ST val) { return (T)val * OP; } \ -static inline T Conv_##T##_##UT(UT val) { return (T)Conv_##ST##_##UT(val) * OP; } - -#define DECL_TEMPLATE2(T1, T2, OP) \ -DECL_TEMPLATE(T1, AL##T2, ALu##T2, OP) - -DECL_TEMPLATE2(ALfloat, byte, (1.0f/127.0f)) -DECL_TEMPLATE2(ALdouble, byte, (1.0/127.0)) -DECL_TEMPLATE2(ALfloat, short, (1.0f/32767.0f)) -DECL_TEMPLATE2(ALdouble, short, (1.0/32767.0)) -DECL_TEMPLATE2(ALdouble, int, (1.0/2147483647.0)) - -/* Special handling for int32 to float32, since it would overflow. */ -static inline ALfloat Conv_ALfloat_ALint(ALint val) -{ return (ALfloat)(val>>7) * (1.0f/16777215.0f); } -static inline ALfloat Conv_ALfloat_ALuint(ALuint val) -{ return (ALfloat)(Conv_ALint_ALuint(val)>>7) * (1.0f/16777215.0f); } - -#undef DECL_TEMPLATE2 -#undef DECL_TEMPLATE - -/* Define fp to int-type functions */ -#define DECL_TEMPLATE(FT, T, smin, smax) \ -static inline AL##T Conv_AL##T##_##FT(FT val) \ -{ \ - if(val > 1.0f) return smax; \ - if(val < -1.0f) return smin; \ - return (AL##T)(val * (FT)smax); \ -} \ -static inline ALu##T Conv_ALu##T##_##FT(FT val) \ -{ return Conv_ALu##T##_AL##T(Conv_AL##T##_##FT(val)); } - -DECL_TEMPLATE(ALfloat, byte, -128, 127) -DECL_TEMPLATE(ALdouble, byte, -128, 127) -DECL_TEMPLATE(ALfloat, short, -32768, 32767) -DECL_TEMPLATE(ALdouble, short, -32768, 32767) -DECL_TEMPLATE(ALdouble, int, -2147483647-1, 2147483647) - -/* Special handling for float32 to int32, since it would overflow. */ -static inline ALint Conv_ALint_ALfloat(ALfloat val) -{ - if(val > 1.0f) return 2147483647; - if(val < -1.0f) return -2147483647-1; - return (ALint)(val * 16777215.0f) << 7; -} -static inline ALuint Conv_ALuint_ALfloat(ALfloat val) -{ return Conv_ALuint_ALint(Conv_ALint_ALfloat(val)); } - -#undef DECL_TEMPLATE - -/* Define byte3 and ubyte3 functions (goes through int and uint functions). */ -#define DECL_TEMPLATE(T) \ -static inline ALbyte3 Conv_ALbyte3_##T(T val) \ -{ return EncodeByte3(Conv_ALint_##T(val)>>8); } \ -static inline T Conv_##T##_ALbyte3(ALbyte3 val) \ -{ return Conv_##T##_ALint(DecodeByte3(val)<<8); } \ - \ -static inline ALubyte3 Conv_ALubyte3_##T(T val) \ -{ return EncodeUByte3(Conv_ALuint_##T(val)>>8); } \ -static inline T Conv_##T##_ALubyte3(ALubyte3 val) \ -{ return Conv_##T##_ALuint(DecodeUByte3(val)<<8); } - -DECL_TEMPLATE(ALbyte) -DECL_TEMPLATE(ALubyte) -DECL_TEMPLATE(ALshort) -DECL_TEMPLATE(ALushort) -DECL_TEMPLATE(ALint) -DECL_TEMPLATE(ALuint) -DECL_TEMPLATE(ALfloat) -DECL_TEMPLATE(ALdouble) - -#undef DECL_TEMPLATE - -/* Define byte3 <-> ubyte3 functions. */ -static inline ALbyte3 Conv_ALbyte3_ALubyte3(ALubyte3 val) -{ return EncodeByte3(DecodeUByte3(val)-8388608); } -static inline ALubyte3 Conv_ALubyte3_ALbyte3(ALbyte3 val) -{ return EncodeUByte3(DecodeByte3(val)+8388608); } - -/* Define muLaw and aLaw functions (goes through short functions). */ -#define DECL_TEMPLATE(T) \ -static inline ALmulaw Conv_ALmulaw_##T(T val) \ -{ return EncodeMuLaw(Conv_ALshort_##T(val)); } \ -static inline T Conv_##T##_ALmulaw(ALmulaw val) \ -{ return Conv_##T##_ALshort(DecodeMuLaw(val)); } \ - \ -static inline ALalaw Conv_ALalaw_##T(T val) \ -{ return EncodeALaw(Conv_ALshort_##T(val)); } \ -static inline T Conv_##T##_ALalaw(ALalaw val) \ -{ return Conv_##T##_ALshort(DecodeALaw(val)); } - -DECL_TEMPLATE(ALbyte) -DECL_TEMPLATE(ALubyte) -DECL_TEMPLATE(ALshort) -DECL_TEMPLATE(ALushort) -DECL_TEMPLATE(ALint) -DECL_TEMPLATE(ALuint) -DECL_TEMPLATE(ALfloat) -DECL_TEMPLATE(ALdouble) -DECL_TEMPLATE(ALbyte3) -DECL_TEMPLATE(ALubyte3) - -#undef DECL_TEMPLATE - -/* Define muLaw <-> aLaw functions. */ -static inline ALalaw Conv_ALalaw_ALmulaw(ALmulaw val) -{ return EncodeALaw(DecodeMuLaw(val)); } -static inline ALmulaw Conv_ALmulaw_ALalaw(ALalaw val) -{ return EncodeMuLaw(DecodeALaw(val)); } - - -#define DECL_TEMPLATE(T1, T2) \ -static void Convert_##T1##_##T2(T1 *dst, const T2 *src, ALuint numchans, \ - ALuint len, ALsizei UNUSED(align)) \ -{ \ - ALuint i, j; \ - for(i = 0;i < len;i++) \ - { \ - for(j = 0;j < numchans;j++) \ - *(dst++) = Conv_##T1##_##T2(*(src++)); \ - } \ -} - -#define DECL_TEMPLATE2(T) \ -DECL_TEMPLATE(T, ALbyte) \ -DECL_TEMPLATE(T, ALubyte) \ -DECL_TEMPLATE(T, ALshort) \ -DECL_TEMPLATE(T, ALushort) \ -DECL_TEMPLATE(T, ALint) \ -DECL_TEMPLATE(T, ALuint) \ -DECL_TEMPLATE(T, ALfloat) \ -DECL_TEMPLATE(T, ALdouble) \ -DECL_TEMPLATE(T, ALmulaw) \ -DECL_TEMPLATE(T, ALalaw) \ -DECL_TEMPLATE(T, ALbyte3) \ -DECL_TEMPLATE(T, ALubyte3) - -DECL_TEMPLATE2(ALbyte) -DECL_TEMPLATE2(ALubyte) -DECL_TEMPLATE2(ALshort) -DECL_TEMPLATE2(ALushort) -DECL_TEMPLATE2(ALint) -DECL_TEMPLATE2(ALuint) -DECL_TEMPLATE2(ALfloat) -DECL_TEMPLATE2(ALdouble) -DECL_TEMPLATE2(ALmulaw) -DECL_TEMPLATE2(ALalaw) -DECL_TEMPLATE2(ALbyte3) -DECL_TEMPLATE2(ALubyte3) - -#undef DECL_TEMPLATE2 -#undef DECL_TEMPLATE - -#define DECL_TEMPLATE(T) \ -static void Convert_##T##_ALima4(T *dst, const ALima4 *src, ALuint numchans, \ - ALuint len, ALuint align) \ -{ \ - ALsizei byte_align = ((align-1)/2 + 4) * numchans; \ - DECL_VLA(ALshort, tmp, align*numchans); \ - ALuint i, j, k; \ - \ - assert(align > 0 && (len%align) == 0); \ - for(i = 0;i < len;i += align) \ - { \ - DecodeIMA4Block(tmp, src, numchans, align); \ - src += byte_align; \ - \ - for(j = 0;j < align;j++) \ - { \ - for(k = 0;k < numchans;k++) \ - *(dst++) = Conv_##T##_ALshort(tmp[j*numchans + k]); \ - } \ - } \ -} - -DECL_TEMPLATE(ALbyte) -DECL_TEMPLATE(ALubyte) -static void Convert_ALshort_ALima4(ALshort *dst, const ALima4 *src, ALuint numchans, - ALuint len, ALuint align) +void Convert_ALshort_ALima4(ALshort *dst, const ALubyte *src, ALsizei numchans, ALsizei len, + ALsizei align) { ALsizei byte_align = ((align-1)/2 + 4) * numchans; - ALuint i; + ALsizei i; assert(align > 0 && (len%align) == 0); for(i = 0;i < len;i += align) @@ -793,103 +259,12 @@ static void Convert_ALshort_ALima4(ALshort *dst, const ALima4 *src, ALuint numch dst += align*numchans; } } -DECL_TEMPLATE(ALushort) -DECL_TEMPLATE(ALint) -DECL_TEMPLATE(ALuint) -DECL_TEMPLATE(ALfloat) -DECL_TEMPLATE(ALdouble) -DECL_TEMPLATE(ALmulaw) -DECL_TEMPLATE(ALalaw) -DECL_TEMPLATE(ALbyte3) -DECL_TEMPLATE(ALubyte3) -#undef DECL_TEMPLATE - -#define DECL_TEMPLATE(T) \ -static void Convert_ALima4_##T(ALima4 *dst, const T *src, ALuint numchans, \ - ALuint len, ALuint align) \ -{ \ - ALint sample[MAX_INPUT_CHANNELS] = {0,0,0,0,0,0,0,0}; \ - ALint index[MAX_INPUT_CHANNELS] = {0,0,0,0,0,0,0,0}; \ - ALsizei byte_align = ((align-1)/2 + 4) * numchans; \ - DECL_VLA(ALshort, tmp, align*numchans); \ - ALuint i, j, k; \ - \ - assert(align > 0 && (len%align) == 0); \ - for(i = 0;i < len;i += align) \ - { \ - for(j = 0;j < align;j++) \ - { \ - for(k = 0;k < numchans;k++) \ - tmp[j*numchans + k] = Conv_ALshort_##T(*(src++)); \ - } \ - EncodeIMA4Block(dst, tmp, sample, index, numchans, align); \ - dst += byte_align; \ - } \ -} - -DECL_TEMPLATE(ALbyte) -DECL_TEMPLATE(ALubyte) -static void Convert_ALima4_ALshort(ALima4 *dst, const ALshort *src, - ALuint numchans, ALuint len, ALuint align) -{ - ALint sample[MAX_INPUT_CHANNELS] = {0,0,0,0,0,0,0,0}; - ALint index[MAX_INPUT_CHANNELS] = {0,0,0,0,0,0,0,0}; - ALsizei byte_align = ((align-1)/2 + 4) * numchans; - ALuint i; - - assert(align > 0 && (len%align) == 0); - for(i = 0;i < len;i += align) - { - EncodeIMA4Block(dst, src, sample, index, numchans, align); - src += align*numchans; - dst += byte_align; - } -} -DECL_TEMPLATE(ALushort) -DECL_TEMPLATE(ALint) -DECL_TEMPLATE(ALuint) -DECL_TEMPLATE(ALfloat) -DECL_TEMPLATE(ALdouble) -DECL_TEMPLATE(ALmulaw) -DECL_TEMPLATE(ALalaw) -DECL_TEMPLATE(ALbyte3) -DECL_TEMPLATE(ALubyte3) - -#undef DECL_TEMPLATE - - -#define DECL_TEMPLATE(T) \ -static void Convert_##T##_ALmsadpcm(T *dst, const ALmsadpcm *src, \ - ALuint numchans, ALuint len, \ - ALuint align) \ -{ \ - ALsizei byte_align = ((align-2)/2 + 7) * numchans; \ - DECL_VLA(ALshort, tmp, align*numchans); \ - ALuint i, j, k; \ - \ - assert(align > 1 && (len%align) == 0); \ - for(i = 0;i < len;i += align) \ - { \ - DecodeMSADPCMBlock(tmp, src, numchans, align); \ - src += byte_align; \ - \ - for(j = 0;j < align;j++) \ - { \ - for(k = 0;k < numchans;k++) \ - *(dst++) = Conv_##T##_ALshort(tmp[j*numchans + k]); \ - } \ - } \ -} - -DECL_TEMPLATE(ALbyte) -DECL_TEMPLATE(ALubyte) -static void Convert_ALshort_ALmsadpcm(ALshort *dst, const ALmsadpcm *src, - ALuint numchans, ALuint len, - ALuint align) +void Convert_ALshort_ALmsadpcm(ALshort *dst, const ALubyte *src, ALsizei numchans, ALsizei len, + ALsizei align) { ALsizei byte_align = ((align-2)/2 + 7) * numchans; - ALuint i; + ALsizei i; assert(align > 1 && (len%align) == 0); for(i = 0;i < len;i += align) @@ -899,214 +274,3 @@ static void Convert_ALshort_ALmsadpcm(ALshort *dst, const ALmsadpcm *src, dst += align*numchans; } } -DECL_TEMPLATE(ALushort) -DECL_TEMPLATE(ALint) -DECL_TEMPLATE(ALuint) -DECL_TEMPLATE(ALfloat) -DECL_TEMPLATE(ALdouble) -DECL_TEMPLATE(ALmulaw) -DECL_TEMPLATE(ALalaw) -DECL_TEMPLATE(ALbyte3) -DECL_TEMPLATE(ALubyte3) - -#undef DECL_TEMPLATE - -#define DECL_TEMPLATE(T) \ -static void Convert_ALmsadpcm_##T(ALmsadpcm *dst, const T *src, \ - ALuint numchans, ALuint len, ALuint align) \ -{ \ - ALint sample[MAX_INPUT_CHANNELS] = {0,0,0,0,0,0,0,0}; \ - ALsizei byte_align = ((align-2)/2 + 7) * numchans; \ - DECL_VLA(ALshort, tmp, align*numchans); \ - ALuint i, j, k; \ - \ - assert(align > 1 && (len%align) == 0); \ - for(i = 0;i < len;i += align) \ - { \ - for(j = 0;j < align;j++) \ - { \ - for(k = 0;k < numchans;k++) \ - tmp[j*numchans + k] = Conv_ALshort_##T(*(src++)); \ - } \ - EncodeMSADPCMBlock(dst, tmp, sample, numchans, align); \ - dst += byte_align; \ - } \ -} - -DECL_TEMPLATE(ALbyte) -DECL_TEMPLATE(ALubyte) -static void Convert_ALmsadpcm_ALshort(ALmsadpcm *dst, const ALshort *src, - ALuint numchans, ALuint len, ALuint align) -{ - ALint sample[MAX_INPUT_CHANNELS] = {0,0,0,0,0,0,0,0}; - ALsizei byte_align = ((align-2)/2 + 7) * numchans; - ALuint i; - - assert(align > 1 && (len%align) == 0); - for(i = 0;i < len;i += align) - { - EncodeMSADPCMBlock(dst, src, sample, numchans, align); - src += align*numchans; - dst += byte_align; - } -} -DECL_TEMPLATE(ALushort) -DECL_TEMPLATE(ALint) -DECL_TEMPLATE(ALuint) -DECL_TEMPLATE(ALfloat) -DECL_TEMPLATE(ALdouble) -DECL_TEMPLATE(ALmulaw) -DECL_TEMPLATE(ALalaw) -DECL_TEMPLATE(ALbyte3) -DECL_TEMPLATE(ALubyte3) - -#undef DECL_TEMPLATE - -/* NOTE: We don't store compressed samples internally, so these conversions - * should never happen. */ -static void Convert_ALima4_ALima4(ALima4* UNUSED(dst), const ALima4* UNUSED(src), - ALuint UNUSED(numchans), ALuint UNUSED(len), - ALuint UNUSED(align)) -{ - ERR("Unexpected IMA4-to-IMA4 conversion!\n"); -} - -static void Convert_ALmsadpcm_ALmsadpcm(ALmsadpcm* UNUSED(dst), const ALmsadpcm* UNUSED(src), - ALuint UNUSED(numchans), ALuint UNUSED(len), - ALuint UNUSED(align)) -{ - ERR("Unexpected MSADPCM-to-MSADPCM conversion!\n"); -} - -static void Convert_ALmsadpcm_ALima4(ALmsadpcm* UNUSED(dst), const ALima4* UNUSED(src), - ALuint UNUSED(numchans), ALuint UNUSED(len), - ALuint UNUSED(align)) -{ - ERR("Unexpected IMA4-to-MSADPCM conversion!\n"); -} - -static void Convert_ALima4_ALmsadpcm(ALima4* UNUSED(dst), const ALmsadpcm* UNUSED(src), - ALuint UNUSED(numchans), ALuint UNUSED(len), - ALuint UNUSED(align)) -{ - ERR("Unexpected MSADPCM-to-IMA4 conversion!\n"); -} - - -#define DECL_TEMPLATE(T) \ -static void Convert_##T(T *dst, const ALvoid *src, enum UserFmtType srcType, \ - ALsizei numchans, ALsizei len, ALsizei align) \ -{ \ - switch(srcType) \ - { \ - case UserFmtByte: \ - Convert_##T##_ALbyte(dst, src, numchans, len, align); \ - break; \ - case UserFmtUByte: \ - Convert_##T##_ALubyte(dst, src, numchans, len, align); \ - break; \ - case UserFmtShort: \ - Convert_##T##_ALshort(dst, src, numchans, len, align); \ - break; \ - case UserFmtUShort: \ - Convert_##T##_ALushort(dst, src, numchans, len, align); \ - break; \ - case UserFmtInt: \ - Convert_##T##_ALint(dst, src, numchans, len, align); \ - break; \ - case UserFmtUInt: \ - Convert_##T##_ALuint(dst, src, numchans, len, align); \ - break; \ - case UserFmtFloat: \ - Convert_##T##_ALfloat(dst, src, numchans, len, align); \ - break; \ - case UserFmtDouble: \ - Convert_##T##_ALdouble(dst, src, numchans, len, align); \ - break; \ - case UserFmtMulaw: \ - Convert_##T##_ALmulaw(dst, src, numchans, len, align); \ - break; \ - case UserFmtAlaw: \ - Convert_##T##_ALalaw(dst, src, numchans, len, align); \ - break; \ - case UserFmtIMA4: \ - Convert_##T##_ALima4(dst, src, numchans, len, align); \ - break; \ - case UserFmtMSADPCM: \ - Convert_##T##_ALmsadpcm(dst, src, numchans, len, align); \ - break; \ - case UserFmtByte3: \ - Convert_##T##_ALbyte3(dst, src, numchans, len, align); \ - break; \ - case UserFmtUByte3: \ - Convert_##T##_ALubyte3(dst, src, numchans, len, align); \ - break; \ - } \ -} - -DECL_TEMPLATE(ALbyte) -DECL_TEMPLATE(ALubyte) -DECL_TEMPLATE(ALshort) -DECL_TEMPLATE(ALushort) -DECL_TEMPLATE(ALint) -DECL_TEMPLATE(ALuint) -DECL_TEMPLATE(ALfloat) -DECL_TEMPLATE(ALdouble) -DECL_TEMPLATE(ALmulaw) -DECL_TEMPLATE(ALalaw) -DECL_TEMPLATE(ALima4) -DECL_TEMPLATE(ALmsadpcm) -DECL_TEMPLATE(ALbyte3) -DECL_TEMPLATE(ALubyte3) - -#undef DECL_TEMPLATE - - -void ConvertData(ALvoid *dst, enum UserFmtType dstType, const ALvoid *src, enum UserFmtType srcType, ALsizei numchans, ALsizei len, ALsizei align) -{ - switch(dstType) - { - case UserFmtByte: - Convert_ALbyte(dst, src, srcType, numchans, len, align); - break; - case UserFmtUByte: - Convert_ALubyte(dst, src, srcType, numchans, len, align); - break; - case UserFmtShort: - Convert_ALshort(dst, src, srcType, numchans, len, align); - break; - case UserFmtUShort: - Convert_ALushort(dst, src, srcType, numchans, len, align); - break; - case UserFmtInt: - Convert_ALint(dst, src, srcType, numchans, len, align); - break; - case UserFmtUInt: - Convert_ALuint(dst, src, srcType, numchans, len, align); - break; - case UserFmtFloat: - Convert_ALfloat(dst, src, srcType, numchans, len, align); - break; - case UserFmtDouble: - Convert_ALdouble(dst, src, srcType, numchans, len, align); - break; - case UserFmtMulaw: - Convert_ALmulaw(dst, src, srcType, numchans, len, align); - break; - case UserFmtAlaw: - Convert_ALalaw(dst, src, srcType, numchans, len, align); - break; - case UserFmtIMA4: - Convert_ALima4(dst, src, srcType, numchans, len, align); - break; - case UserFmtMSADPCM: - Convert_ALmsadpcm(dst, src, srcType, numchans, len, align); - break; - case UserFmtByte3: - Convert_ALbyte3(dst, src, srcType, numchans, len, align); - break; - case UserFmtUByte3: - Convert_ALubyte3(dst, src, srcType, numchans, len, align); - break; - } -} diff --git a/Engine/lib/openal-soft/README b/Engine/lib/openal-soft/README deleted file mode 100644 index a0178ae5e..000000000 --- a/Engine/lib/openal-soft/README +++ /dev/null @@ -1,55 +0,0 @@ -Source Install -============== - -To install OpenAL Soft, use your favorite shell to go into the build/ -directory, and run: - -cmake .. - -Assuming configuration went well, you can then build it, typically using GNU -Make (KDevelop, MSVC, and others are possible depending on your system setup -and CMake configuration). - -Please Note: Double check that the appropriate backends were detected. Often, -complaints of no sound, crashing, and missing devices can be solved by making -sure the correct backends are being used. CMake's output will identify which -backends were enabled. - -For most systems, you will likely want to make sure ALSA, OSS, and PulseAudio -were detected (if your target system uses them). For Windows, make sure -DirectSound was detected. - - -Utilities -========= - -The source package comes with an informational utility, openal-info, and is -built by default. It prints out information provided by the ALC and AL sub- -systems, including discovered devices, version information, and extensions. - - -Configuration -============= - -OpenAL Soft can be configured on a per-user and per-system basis. This allows -users and sysadmins to control information provided to applications, as well -as application-agnostic behavior of the library. See alsoftrc.sample for -available settings. - - -Acknowledgements -================ - -Special thanks go to: - -Creative Labs for the original source code this is based off of. - -Christopher Fitzgerald for the current reverb effect implementation, and -helping with the low-pass and HRTF filters. - -Christian Borss for the 3D panning code previous versions used as a base. - -Ben Davis for the idea behind a previous version of the click-removal code. - -Richard Furse for helping with my understanding of Ambisonics that is used by -the various parts of the library. diff --git a/Engine/lib/openal-soft/README.md b/Engine/lib/openal-soft/README.md new file mode 100644 index 000000000..0c9d30276 --- /dev/null +++ b/Engine/lib/openal-soft/README.md @@ -0,0 +1,61 @@ +OpenAL soft +=========== + +`master` branch CI status : [![Build Status](https://travis-ci.org/kcat/openal-soft.svg?branch=master)](https://travis-ci.org/kcat/openal-soft) [![Windows Build Status](https://ci.appveyor.com/api/projects/status/github/kcat/openal-soft?branch=master&svg=true)](https://ci.appveyor.com/api/projects/status/github/kcat/openal-soft?branch=master&svg=true) + +OpenAL Soft is an LGPL-licensed, cross-platform, software implementation of the OpenAL 3D audio API. It's forked from the open-sourced Windows version available originally from openal.org's SVN repository (now defunct). +OpenAL provides capabilities for playing audio in a virtual 3D environment. Distance attenuation, doppler shift, and directional sound emitters are among the features handled by the API. More advanced effects, including air absorption, occlusion, and environmental reverb, are available through the EFX extension. It also facilitates streaming audio, multi-channel buffers, and audio capture. + +More information is available on the [official website](http://openal-soft.org/) + +Source Install +------------- +To install OpenAL Soft, use your favorite shell to go into the build/ +directory, and run: + +```bash +cmake .. +``` + +Assuming configuration went well, you can then build it, typically using GNU +Make (KDevelop, MSVC, and others are possible depending on your system setup +and CMake configuration). + +Please Note: Double check that the appropriate backends were detected. Often, +complaints of no sound, crashing, and missing devices can be solved by making +sure the correct backends are being used. CMake's output will identify which +backends were enabled. + +For most systems, you will likely want to make sure ALSA, OSS, and PulseAudio +were detected (if your target system uses them). For Windows, make sure +DirectSound was detected. + + +Utilities +--------- +The source package comes with an informational utility, openal-info, and is +built by default. It prints out information provided by the ALC and AL sub- +systems, including discovered devices, version information, and extensions. + + +Configuration +------------- + +OpenAL Soft can be configured on a per-user and per-system basis. This allows +users and sysadmins to control information provided to applications, as well +as application-agnostic behavior of the library. See alsoftrc.sample for +available settings. + + +Acknowledgements +---------------- + +Special thanks go to: + + - Creative Labs for the original source code this is based off of. + - Christopher Fitzgerald for the current reverb effect implementation, and +helping with the low-pass and HRTF filters. + - Christian Borss for the 3D panning code previous versions used as a base. + - Ben Davis for the idea behind a previous version of the click-removal code. + - Richard Furse for helping with my understanding of Ambisonics that is used by +the various parts of the library. diff --git a/Engine/lib/openal-soft/alsoftrc.sample b/Engine/lib/openal-soft/alsoftrc.sample index d5913ff0e..2b7093a95 100644 --- a/Engine/lib/openal-soft/alsoftrc.sample +++ b/Engine/lib/openal-soft/alsoftrc.sample @@ -81,7 +81,7 @@ # which helps protect against skips when the CPU is under load, but increases # the delay between a sound getting mixed and being heard. Acceptable values # range between 2 and 16. -#periods = 4 +#periods = 3 ## stereo-mode: # Specifies if stereo output is treated as being headphones or speakers. With @@ -89,13 +89,14 @@ # Valid settings are auto, speakers, and headphones. #stereo-mode = auto -## stereo-panning: -# Specifies the panning method for non-HRTF stereo output. uhj (default) -# creates stereo-compatible two-channel UHJ output, which encodes some -# surround sound information, while paired uses standard pair-wise panning -# between -30 and +30 degrees. If crossfeed filters are used, uhj panning is -# disabled. -#stereo-panning = uhj +## stereo-encoding: +# Specifies the encoding method for non-HRTF stereo output. 'panpot' (default) +# uses standard amplitude panning (aka pair-wise, stereo pair, etc) between +# -30 and +30 degrees, while 'uhj' creates stereo-compatible two-channel UHJ +# output, which encodes some surround sound information into stereo output +# that can be decoded with a surround sound receiver. If crossfeed filters are +# used, UHJ is disabled. +#stereo-encoding = panpot ## ambi-format: # Specifies the channel order and normalization for the "ambi*" set of channel @@ -148,11 +149,11 @@ # Selects the resampler used when mixing sources. Valid values are: # point - nearest sample, no interpolation # linear - extrapolates samples using a linear slope between samples -# sinc4 - extrapolates samples using a 4-point Sinc filter -# sinc8 - extrapolates samples using an 8-point Sinc filter -# bsinc - extrapolates samples using a band-limited Sinc filter (varying -# between 12 and 24 points, with anti-aliasing) -# Specifying other values will result in using the default (linear). +# cubic - extrapolates samples using a Catmull-Rom spline +# bsinc12 - extrapolates samples using a band-limited Sinc filter (varying +# between 12 and 24 points, with anti-aliasing) +# bsinc24 - extrapolates samples using a band-limited Sinc filter (varying +# between 24 and 48 points, with anti-aliasing) #resampler = linear ## rt-prio: (global) @@ -174,13 +175,39 @@ # can use a non-negligible amount of CPU time if an effect is set on it even # if no sources are feeding it, so this may help when apps use more than the # system can handle. -#slots = 4 +#slots = 64 ## sends: -# Sets the number of auxiliary sends per source. When not specified (default), -# it allows the app to request how many it wants. The maximum value currently -# possible is 4. -#sends = +# Limits the number of auxiliary sends allowed per source. Setting this higher +# than the default has no effect. +#sends = 16 + +## front-stablizer: +# Applies filters to "stablize" front sound imaging. A psychoacoustic method +# is used to generate a front-center channel signal from the front-left and +# front-right channels, improving the front response by reducing the combing +# artifacts and phase errors. Consequently, it will only work with channel +# configurations that include front-left, front-right, and front-center. +#front-stablizer = false + +## output-limiter: +# Applies a gain limiter on the final mixed output. This reduces the volume +# when the output samples would otherwise clamp, avoiding excessive clipping +# noise. +#output-limiter = true + +## dither: +# Applies dithering on the final mix, for 8- and 16-bit output by default. +# This replaces the distortion created by nearest-value quantization with low- +# level whitenoise. +#dither = true + +## dither-depth: +# Quantization bit-depth for dithered output. A value of 0 (or less) will +# match the output sample depth. For int32, uint32, and float32 output, 0 will +# disable dithering because they're at or beyond the rendered precision. The +# maximum dither depth is 24. +#dither-depth = 0 ## volume-adjust: # A global volume adjustment for source output, expressed in decibels. The @@ -193,7 +220,7 @@ # Sets which effects to exclude, preventing apps from using them. This can # help for apps that try to use effects which are too CPU intensive for the # system to handle. Available effects are: eaxreverb,reverb,chorus,compressor, -# distortion,echo,equalizer,flanger,modulator,dedicated +# distortion,echo,equalizer,flanger,modulator,dedicated,pshifter #excludefx = ## default-reverb: (global) @@ -235,26 +262,39 @@ hq-mode = false # Enables compensation for the speakers' relative distances to the listener. # This applies the necessary delays and attenuation to make the speakers # behave as though they are all equidistant, which is important for proper -# playback of 3D sound rendering. Requires the high-quality ambisonic decoder, -# as well as the proper distances to be specified in the decoder configuration -# file. +# playback of 3D sound rendering. Requires the proper distances to be +# specified in the decoder configuration file. distance-comp = true +## nfc: +# Enables near-field control filters. This simulates and compensates for low- +# frequency effects caused by the curvature of nearby sound-waves, which +# creates a more realistic perception of sound distance. Note that the effect +# may be stronger or weaker than intended if the application doesn't use or +# specify an appropriate unit scale, or if incorrect speaker distances are set +# in the decoder configuration file. Requires hq-mode to be enabled. +nfc = true + +## nfc-ref-delay +# Specifies the reference delay value for ambisonic output. When channels is +# set to one of the ambi* formats, this option enables NFC-HOA output with the +# specified Reference Delay parameter. The specified value can then be shared +# with an appropriate NFC-HOA decoder to reproduce correct near-field effects. +# Keep in mind that despite being designed for higher-order ambisonics, this +# applies to first-order output all the same. When left unset, normal output +# is created with no near-field simulation. +nfc-ref-delay = + ## quad: -# Decoder configuration file for Quadrophonic channel output. See +# Decoder configuration file for Quadraphonic channel output. See # docs/ambdec.txt for a description of the file format. quad = ## surround51: -# Decoder configuration file for 5.1 Surround (Side) channel output. See -# docs/ambdec.txt for a description of the file format. +# Decoder configuration file for 5.1 Surround (Side and Rear) channel output. +# See docs/ambdec.txt for a description of the file format. surround51 = -## surround51rear: -# Decoder configuration file for 5.1 Surround (Rear) channel output. See -# docs/ambdec.txt for a description of the file format. -surround51rear = - ## surround61: # Decoder configuration file for 6.1 Surround channel output. See # docs/ambdec.txt for a description of the file format. @@ -279,12 +319,6 @@ surround71 = # value of 0 means no change. #boost = 0 -## emulate-eax: (global) -# Allows the standard reverb effect to be used in place of EAX reverb. EAX -# reverb processing is a bit more CPU intensive than standard, so this option -# allows a simpler effect to be used at the loss of some quality. -#emulate-eax = false - ## ## PulseAudio backend stuff ## @@ -410,9 +444,9 @@ surround71 = #buffer-size = 0 ## -## MMDevApi backend stuff +## WASAPI backend stuff ## -[mmdevapi] +[wasapi] ## ## DirectSound backend stuff diff --git a/Engine/lib/openal-soft/appveyor.yml b/Engine/lib/openal-soft/appveyor.yml index 4010f2ead..0e5b7ce40 100644 --- a/Engine/lib/openal-soft/appveyor.yml +++ b/Engine/lib/openal-soft/appveyor.yml @@ -1,4 +1,4 @@ -version: 1.17.2.{build} +version: 1.18.2.{build} environment: matrix: @@ -7,8 +7,13 @@ environment: - GEN: "Visual Studio 14 2015 Win64" CFG: Release +install: + # Remove the VS Xamarin targets to reduce AppVeyor specific noise in build + # logs. See also http://help.appveyor.com/discussions/problems/4569 + - del "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets" + build_script: - cd build - - cmake .. -G"%GEN%" + - cmake -G"%GEN%" -DALSOFT_REQUIRE_WINMM=ON -DALSOFT_REQUIRE_DSOUND=ON -DALSOFT_REQUIRE_WASAPI=ON -DALSOFT_EMBED_HRTF_DATA=YES .. - cmake --build . --config %CFG% --clean-first diff --git a/Engine/lib/openal-soft/cmake/CheckSharedFunctionExists.cmake b/Engine/lib/openal-soft/cmake/CheckSharedFunctionExists.cmake index 7975f2334..c691fa9c9 100644 --- a/Engine/lib/openal-soft/cmake/CheckSharedFunctionExists.cmake +++ b/Engine/lib/openal-soft/cmake/CheckSharedFunctionExists.cmake @@ -34,7 +34,7 @@ # License text for the above reference.) MACRO(CHECK_SHARED_FUNCTION_EXISTS SYMBOL FILES LIBRARY LOCATION VARIABLE) - IF("${VARIABLE}" MATCHES "^${VARIABLE}$") + IF(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") SET(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n") SET(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS}) IF(CMAKE_REQUIRED_LIBRARIES) @@ -88,5 +88,5 @@ MACRO(CHECK_SHARED_FUNCTION_EXISTS SYMBOL FILES LIBRARY LOCATION VARIABLE) "${OUTPUT}\nFile ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c:\n" "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n") ENDIF(${VARIABLE}) - ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$") + ENDIF(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") ENDMACRO(CHECK_SHARED_FUNCTION_EXISTS) diff --git a/Engine/lib/openal-soft/cmake/FindDSound.cmake b/Engine/lib/openal-soft/cmake/FindDSound.cmake index 0ddf98aad..4078deb5e 100644 --- a/Engine/lib/openal-soft/cmake/FindDSound.cmake +++ b/Engine/lib/openal-soft/cmake/FindDSound.cmake @@ -8,24 +8,30 @@ # DSOUND_LIBRARY - the dsound library # -find_path(DSOUND_INCLUDE_DIR - NAMES dsound.h - PATHS "${DXSDK_DIR}" - PATH_SUFFIXES include - DOC "The DirectSound include directory" -) +if (WIN32) + include(FindWindowsSDK) + if (WINDOWSSDK_FOUND) + get_windowssdk_library_dirs(${WINDOWSSDK_PREFERRED_DIR} WINSDK_LIB_DIRS) + get_windowssdk_include_dirs(${WINDOWSSDK_PREFERRED_DIR} WINSDK_INCLUDE_DIRS) + endif() +endif() +# DSOUND_INCLUDE_DIR +find_path(DSOUND_INCLUDE_DIR + NAMES "dsound.h" + PATHS "${DXSDK_DIR}" ${WINSDK_INCLUDE_DIRS} + PATH_SUFFIXES include + DOC "The DirectSound include directory") + +# DSOUND_LIBRARY find_library(DSOUND_LIBRARY NAMES dsound - PATHS "${DXSDK_DIR}" + PATHS "${DXSDK_DIR}" ${WINSDK_LIB_DIRS} PATH_SUFFIXES lib lib/x86 lib/x64 - DOC "The DirectSound library" -) + DOC "The DirectSound library") include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(DSound - REQUIRED_VARS DSOUND_LIBRARY DSOUND_INCLUDE_DIR -) +find_package_handle_standard_args(DSound REQUIRED_VARS DSOUND_LIBRARY DSOUND_INCLUDE_DIR) if(DSOUND_FOUND) set(DSOUND_LIBRARIES ${DSOUND_LIBRARY}) diff --git a/Engine/lib/openal-soft/cmake/FindFFmpeg.cmake b/Engine/lib/openal-soft/cmake/FindFFmpeg.cmake index 96cbb6ed0..c489c2c3c 100644 --- a/Engine/lib/openal-soft/cmake/FindFFmpeg.cmake +++ b/Engine/lib/openal-soft/cmake/FindFFmpeg.cmake @@ -142,6 +142,12 @@ foreach(_component ${FFmpeg_FIND_COMPONENTS}) endif() endforeach() +# Add libz if it exists (needed for static ffmpeg builds) +find_library(_FFmpeg_HAVE_LIBZ NAMES z) +if(_FFmpeg_HAVE_LIBZ) + set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${_FFmpeg_HAVE_LIBZ}) +endif() + # Build the include path and library list with duplicates removed. if(FFMPEG_INCLUDE_DIRS) list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS) diff --git a/Engine/lib/openal-soft/cmake/FindOSS.cmake b/Engine/lib/openal-soft/cmake/FindOSS.cmake index 88ee66ad2..feffb4516 100644 --- a/Engine/lib/openal-soft/cmake/FindOSS.cmake +++ b/Engine/lib/openal-soft/cmake/FindOSS.cmake @@ -2,8 +2,10 @@ # # OSS_FOUND - True if OSS_INCLUDE_DIR is found # OSS_INCLUDE_DIRS - Set when OSS_INCLUDE_DIR is found +# OSS_LIBRARIES - Set when OSS_LIBRARY is found # # OSS_INCLUDE_DIR - where to find sys/soundcard.h, etc. +# OSS_LIBRARY - where to find libossaudio (optional). # find_path(OSS_INCLUDE_DIR @@ -11,11 +13,21 @@ find_path(OSS_INCLUDE_DIR DOC "The OSS include directory" ) +find_library(OSS_LIBRARY + NAMES ossaudio + DOC "Optional OSS library" +) + include(FindPackageHandleStandardArgs) find_package_handle_standard_args(OSS REQUIRED_VARS OSS_INCLUDE_DIR) if(OSS_FOUND) set(OSS_INCLUDE_DIRS ${OSS_INCLUDE_DIR}) + if(OSS_LIBRARY) + set(OSS_LIBRARIES ${OSS_LIBRARY}) + else() + unset(OSS_LIBRARIES) + endif() endif() -mark_as_advanced(OSS_INCLUDE_DIR) +mark_as_advanced(OSS_INCLUDE_DIR OSS_LIBRARY) diff --git a/Engine/lib/openal-soft/cmake/FindSDL2.cmake b/Engine/lib/openal-soft/cmake/FindSDL2.cmake index 70e607a89..e808d0061 100644 --- a/Engine/lib/openal-soft/cmake/FindSDL2.cmake +++ b/Engine/lib/openal-soft/cmake/FindSDL2.cmake @@ -18,10 +18,10 @@ # module will automatically add the -framework Cocoa on your behalf. # # -# Additional Note: If you see an empty SDL2_LIBRARY_TEMP in your configuration +# Additional Note: If you see an empty SDL2_CORE_LIBRARY in your configuration # and no SDL2_LIBRARY, it means CMake did not find your SDL2 library # (SDL2.dll, libsdl2.so, SDL2.framework, etc). -# Set SDL2_LIBRARY_TEMP to point to your SDL2 library, and configure again. +# Set SDL2_CORE_LIBRARY to point to your SDL2 library, and configure again. # Similarly, if you see an empty SDL2MAIN_LIBRARY, you should set this value # as appropriate. These values are used to generate the final SDL2_LIBRARY # variable, but when these values are unset, SDL2_LIBRARY does not get created. @@ -87,7 +87,7 @@ FIND_PATH(SDL2_INCLUDE_DIR SDL.h ) #MESSAGE("SDL2_INCLUDE_DIR is ${SDL2_INCLUDE_DIR}") -FIND_LIBRARY(SDL2_LIBRARY_TEMP +FIND_LIBRARY(SDL2_CORE_LIBRARY NAMES SDL2 HINTS $ENV{SDL2DIR} @@ -98,8 +98,7 @@ FIND_LIBRARY(SDL2_LIBRARY_TEMP /opt/csw /opt ) - -#MESSAGE("SDL2_LIBRARY_TEMP is ${SDL2_LIBRARY_TEMP}") +#MESSAGE("SDL2_CORE_LIBRARY is ${SDL2_CORE_LIBRARY}") IF(NOT SDL2_BUILDING_LIBRARY) IF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework") @@ -137,7 +136,9 @@ IF(MINGW) ENDIF(MINGW) SET(SDL2_FOUND "NO") -IF(SDL2_LIBRARY_TEMP) +IF(SDL2_CORE_LIBRARY) + SET(SDL2_LIBRARY_TEMP ${SDL2_CORE_LIBRARY}) + # For SDL2main IF(NOT SDL2_BUILDING_LIBRARY) IF(SDL2MAIN_LIBRARY) @@ -172,15 +173,12 @@ IF(SDL2_LIBRARY_TEMP) ENDIF(WIN32) # Set the final string here so the GUI reflects the final state. - SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP} CACHE STRING "Where the SDL2 Library can be found") - # Set the temp variable to INTERNAL so it is not seen in the CMake GUI - SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "") + SET(SDL2_LIBRARY ${SDL2_LIBRARY_TEMP}) SET(SDL2_FOUND "YES") -ENDIF(SDL2_LIBRARY_TEMP) +ENDIF(SDL2_CORE_LIBRARY) INCLUDE(FindPackageHandleStandardArgs) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR) diff --git a/Engine/lib/openal-soft/cmake/FindWindowsSDK.cmake b/Engine/lib/openal-soft/cmake/FindWindowsSDK.cmake new file mode 100644 index 000000000..e136b8976 --- /dev/null +++ b/Engine/lib/openal-soft/cmake/FindWindowsSDK.cmake @@ -0,0 +1,626 @@ +# - Find the Windows SDK aka Platform SDK +# +# Relevant Wikipedia article: http://en.wikipedia.org/wiki/Microsoft_Windows_SDK +# +# Pass "COMPONENTS tools" to ignore Visual Studio version checks: in case +# you just want the tool binaries to run, rather than the libraries and headers +# for compiling. +# +# Variables: +# WINDOWSSDK_FOUND - if any version of the windows or platform SDK was found that is usable with the current version of visual studio +# WINDOWSSDK_LATEST_DIR +# WINDOWSSDK_LATEST_NAME +# WINDOWSSDK_FOUND_PREFERENCE - if we found an entry indicating a "preferred" SDK listed for this visual studio version +# WINDOWSSDK_PREFERRED_DIR +# WINDOWSSDK_PREFERRED_NAME +# +# WINDOWSSDK_DIRS - contains no duplicates, ordered most recent first. +# WINDOWSSDK_PREFERRED_FIRST_DIRS - contains no duplicates, ordered with preferred first, followed by the rest in descending recency +# +# Functions: +# windowssdk_name_lookup( ) - Find the name corresponding with the SDK directory you pass in, or +# NOTFOUND if not recognized. Your directory must be one of WINDOWSSDK_DIRS for this to work. +# +# windowssdk_build_lookup( ) - Find the build version number corresponding with the SDK directory you pass in, or +# NOTFOUND if not recognized. Your directory must be one of WINDOWSSDK_DIRS for this to work. +# +# get_windowssdk_from_component( ) - Given a library or include dir, +# find the Windows SDK root dir corresponding to it, or NOTFOUND if unrecognized. +# +# get_windowssdk_library_dirs( ) - Find the architecture-appropriate +# library directories corresponding to the SDK directory you pass in (or NOTFOUND if none) +# +# get_windowssdk_library_dirs_multiple( ...) - Find the architecture-appropriate +# library directories corresponding to the SDK directories you pass in, in order, skipping those not found. NOTFOUND if none at all. +# Good for passing WINDOWSSDK_DIRS or WINDOWSSDK_DIRS to if you really just want a file and don't care where from. +# +# get_windowssdk_include_dirs( ) - Find the +# include directories corresponding to the SDK directory you pass in (or NOTFOUND if none) +# +# get_windowssdk_include_dirs_multiple( ...) - Find the +# include directories corresponding to the SDK directories you pass in, in order, skipping those not found. NOTFOUND if none at all. +# Good for passing WINDOWSSDK_DIRS or WINDOWSSDK_DIRS to if you really just want a file and don't care where from. +# +# Requires these CMake modules: +# FindPackageHandleStandardArgs (known included with CMake >=2.6.2) +# +# Original Author: +# 2012 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2012. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(_preferred_sdk_dirs) # pre-output +set(_win_sdk_dirs) # pre-output +set(_win_sdk_versanddirs) # pre-output +set(_win_sdk_buildsanddirs) # pre-output +set(_winsdk_vistaonly) # search parameters +set(_winsdk_kits) # search parameters + + +set(_WINDOWSSDK_ANNOUNCE OFF) +if(NOT WINDOWSSDK_FOUND AND (NOT WindowsSDK_FIND_QUIETLY)) + set(_WINDOWSSDK_ANNOUNCE ON) +endif() +macro(_winsdk_announce) + if(_WINSDK_ANNOUNCE) + message(STATUS ${ARGN}) + endif() +endmacro() + +set(_winsdk_win10vers + 10.0.14393.0 # Redstone aka Win10 1607 "Anniversary Update" + 10.0.10586.0 # TH2 aka Win10 1511 + 10.0.10240.0 # Win10 RTM + 10.0.10150.0 # just ucrt + 10.0.10056.0 +) + +if(WindowsSDK_FIND_COMPONENTS MATCHES "tools") + set(_WINDOWSSDK_IGNOREMSVC ON) + _winsdk_announce("Checking for tools from Windows/Platform SDKs...") +else() + set(_WINDOWSSDK_IGNOREMSVC OFF) + _winsdk_announce("Checking for Windows/Platform SDKs...") +endif() + +# Appends to the three main pre-output lists used only if the path exists +# and is not already in the list. +function(_winsdk_conditional_append _vername _build _path) + if(("${_path}" MATCHES "registry") OR (NOT EXISTS "${_path}")) + # Path invalid - do not add + return() + endif() + list(FIND _win_sdk_dirs "${_path}" _win_sdk_idx) + if(_win_sdk_idx GREATER -1) + # Path already in list - do not add + return() + endif() + _winsdk_announce( " - ${_vername}, Build ${_build} @ ${_path}") + # Not yet in the list, so we'll add it + list(APPEND _win_sdk_dirs "${_path}") + set(_win_sdk_dirs "${_win_sdk_dirs}" CACHE INTERNAL "" FORCE) + list(APPEND + _win_sdk_versanddirs + "${_vername}" + "${_path}") + set(_win_sdk_versanddirs "${_win_sdk_versanddirs}" CACHE INTERNAL "" FORCE) + list(APPEND + _win_sdk_buildsanddirs + "${_build}" + "${_path}") + set(_win_sdk_buildsanddirs "${_win_sdk_buildsanddirs}" CACHE INTERNAL "" FORCE) +endfunction() + +# Appends to the "preferred SDK" lists only if the path exists +function(_winsdk_conditional_append_preferred _info _path) + if(("${_path}" MATCHES "registry") OR (NOT EXISTS "${_path}")) + # Path invalid - do not add + return() + endif() + + get_filename_component(_path "${_path}" ABSOLUTE) + + list(FIND _win_sdk_preferred_sdk_dirs "${_path}" _win_sdk_idx) + if(_win_sdk_idx GREATER -1) + # Path already in list - do not add + return() + endif() + _winsdk_announce( " - Found \"preferred\" SDK ${_info} @ ${_path}") + # Not yet in the list, so we'll add it + list(APPEND _win_sdk_preferred_sdk_dirs "${_path}") + set(_win_sdk_preferred_sdk_dirs "${_win_sdk_dirs}" CACHE INTERNAL "" FORCE) + + # Just in case we somehow missed it: + _winsdk_conditional_append("${_info}" "" "${_path}") +endfunction() + +# Given a version like v7.0A, looks for an SDK in the registry under "Microsoft SDKs". +# If the given version might be in both HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows +# and HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots aka "Windows Kits", +# use this macro first, since these registry keys usually have more information. +# +# Pass a "default" build number as an extra argument in case we can't find it. +function(_winsdk_check_microsoft_sdks_registry _winsdkver) + set(SDKKEY "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\${_winsdkver}") + get_filename_component(_sdkdir + "[${SDKKEY};InstallationFolder]" + ABSOLUTE) + + set(_sdkname "Windows SDK ${_winsdkver}") + + # Default build number passed as extra argument + set(_build ${ARGN}) + # See if the registry holds a Microsoft-mutilated, err, designated, product name + # (just using get_filename_component to execute the registry lookup) + get_filename_component(_sdkproductname + "[${SDKKEY};ProductName]" + NAME) + if(NOT "${_sdkproductname}" MATCHES "registry") + # Got a product name + set(_sdkname "${_sdkname} (${_sdkproductname})") + endif() + + # try for a version to augment our name + # (just using get_filename_component to execute the registry lookup) + get_filename_component(_sdkver + "[${SDKKEY};ProductVersion]" + NAME) + if(NOT "${_sdkver}" MATCHES "registry" AND NOT MATCHES) + # Got a version + if(NOT "${_sdkver}" MATCHES "\\.\\.") + # and it's not an invalid one with two dots in it: + # use to override the default build + set(_build ${_sdkver}) + if(NOT "${_sdkname}" MATCHES "${_sdkver}") + # Got a version that's not already in the name, let's use it to improve our name. + set(_sdkname "${_sdkname} (${_sdkver})") + endif() + endif() + endif() + _winsdk_conditional_append("${_sdkname}" "${_build}" "${_sdkdir}") +endfunction() + +# Given a name for identification purposes, the build number, and a key (technically a "value name") +# corresponding to a Windows SDK packaged as a "Windows Kit", look for it +# in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots +# Note that the key or "value name" tends to be something weird like KitsRoot81 - +# no easy way to predict, just have to observe them in the wild. +# Doesn't hurt to also try _winsdk_check_microsoft_sdks_registry for these: +# sometimes you get keys in both parts of the registry (in the wow64 portion especially), +# and the non-"Windows Kits" location is often more descriptive. +function(_winsdk_check_windows_kits_registry _winkit_name _winkit_build _winkit_key) + get_filename_component(_sdkdir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;${_winkit_key}]" + ABSOLUTE) + _winsdk_conditional_append("${_winkit_name}" "${_winkit_build}" "${_sdkdir}") +endfunction() + +# Given a name for identification purposes and the build number +# corresponding to a Windows 10 SDK packaged as a "Windows Kit", look for it +# in HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots +# Doesn't hurt to also try _winsdk_check_microsoft_sdks_registry for these: +# sometimes you get keys in both parts of the registry (in the wow64 portion especially), +# and the non-"Windows Kits" location is often more descriptive. +function(_winsdk_check_win10_kits _winkit_build) + get_filename_component(_sdkdir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows Kits\\Installed Roots;KitsRoot10]" + ABSOLUTE) + if(("${_sdkdir}" MATCHES "registry") OR (NOT EXISTS "${_sdkdir}")) + return() # not found + endif() + if(EXISTS "${_sdkdir}/Include/${_winkit_build}/um") + _winsdk_conditional_append("Windows Kits 10 (Build ${_winkit_build})" "${_winkit_build}" "${_sdkdir}") + endif() +endfunction() + +# Given a name for indentification purposes, the build number, and the associated package GUID, +# look in the registry under both HKLM and HKCU in \\SOFTWARE\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\ +# for that guid and the SDK it points to. +function(_winsdk_check_platformsdk_registry _platformsdkname _build _platformsdkguid) + foreach(_winsdk_hive HKEY_LOCAL_MACHINE HKEY_CURRENT_USER) + get_filename_component(_sdkdir + "[${_winsdk_hive}\\SOFTWARE\\Microsoft\\MicrosoftSDK\\InstalledSDKs\\${_platformsdkguid};Install Dir]" + ABSOLUTE) + _winsdk_conditional_append("${_platformsdkname} (${_build})" "${_build}" "${_sdkdir}") + endforeach() +endfunction() + +### +# Detect toolchain information: to know whether it's OK to use Vista+ only SDKs +### +set(_winsdk_vistaonly_ok OFF) +if(MSVC AND NOT _WINDOWSSDK_IGNOREMSVC) + # VC 10 and older has broad target support + if(MSVC_VERSION LESS 1700) + # VC 11 by default targets Vista and later only, so we can add a few more SDKs that (might?) only work on vista+ + elseif("${CMAKE_VS_PLATFORM_TOOLSET}" MATCHES "_xp") + # This is the XP-compatible v110+ toolset + elseif("${CMAKE_VS_PLATFORM_TOOLSET}" STREQUAL "v100" OR "${CMAKE_VS_PLATFORM_TOOLSET}" STREQUAL "v90") + # This is the VS2010/VS2008 toolset + else() + # OK, we're VC11 or newer and not using a backlevel or XP-compatible toolset. + # These versions have no XP (and possibly Vista pre-SP1) support + set(_winsdk_vistaonly_ok ON) + if(_WINDOWSSDK_ANNOUNCE AND NOT _WINDOWSSDK_VISTAONLY_PESTERED) + set(_WINDOWSSDK_VISTAONLY_PESTERED ON CACHE INTERNAL "" FORCE) + message(STATUS "FindWindowsSDK: Detected Visual Studio 2012 or newer, not using the _xp toolset variant: including SDK versions that drop XP support in search!") + endif() + endif() +endif() +if(_WINDOWSSDK_IGNOREMSVC) + set(_winsdk_vistaonly_ok ON) +endif() + +### +# MSVC version checks - keeps messy conditionals in one place +# (messy because of _WINDOWSSDK_IGNOREMSVC) +### +set(_winsdk_msvc_greater_1200 OFF) +if(_WINDOWSSDK_IGNOREMSVC OR (MSVC AND (MSVC_VERSION GREATER 1200))) + set(_winsdk_msvc_greater_1200 ON) +endif() +# Newer than VS .NET/VS Toolkit 2003 +set(_winsdk_msvc_greater_1310 OFF) +if(_WINDOWSSDK_IGNOREMSVC OR (MSVC AND (MSVC_VERSION GREATER 1310))) + set(_winsdk_msvc_greater_1310 ON) +endif() + +# VS2005/2008 +set(_winsdk_msvc_less_1600 OFF) +if(_WINDOWSSDK_IGNOREMSVC OR (MSVC AND (MSVC_VERSION LESS 1600))) + set(_winsdk_msvc_less_1600 ON) +endif() + +# VS2013+ +set(_winsdk_msvc_not_less_1800 OFF) +if(_WINDOWSSDK_IGNOREMSVC OR (MSVC AND (NOT MSVC_VERSION LESS 1800))) + set(_winsdk_msvc_not_less_1800 ON) +endif() + +### +# START body of find module +### +if(_winsdk_msvc_greater_1310) # Newer than VS .NET/VS Toolkit 2003 + ### + # Look for "preferred" SDKs + ### + + # Environment variable for SDK dir + if(EXISTS "$ENV{WindowsSDKDir}" AND (NOT "$ENV{WindowsSDKDir}" STREQUAL "")) + _winsdk_conditional_append_preferred("WindowsSDKDir environment variable" "$ENV{WindowsSDKDir}") + endif() + + if(_winsdk_msvc_less_1600) + # Per-user current Windows SDK for VS2005/2008 + get_filename_component(_sdkdir + "[HKEY_CURRENT_USER\\Software\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" + ABSOLUTE) + _winsdk_conditional_append_preferred("Per-user current Windows SDK" "${_sdkdir}") + + # System-wide current Windows SDK for VS2005/2008 + get_filename_component(_sdkdir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" + ABSOLUTE) + _winsdk_conditional_append_preferred("System-wide current Windows SDK" "${_sdkdir}") + endif() + + ### + # Begin the massive list of SDK searching! + ### + if(_winsdk_vistaonly_ok AND _winsdk_msvc_not_less_1800) + # These require at least Visual Studio 2013 (VC12) + + _winsdk_check_microsoft_sdks_registry(v10.0A) + + # Windows Software Development Kit (SDK) for Windows 10 + # Several different versions living in the same directory - if nothing else we can assume RTM (10240) + _winsdk_check_microsoft_sdks_registry(v10.0 10.0.10240.0) + foreach(_win10build ${_winsdk_win10vers}) + _winsdk_check_win10_kits(${_win10build}) + endforeach() + endif() # vista-only and 2013+ + + # Included in Visual Studio 2013 + # Includes the v120_xp toolset + _winsdk_check_microsoft_sdks_registry(v8.1A 8.1.51636) + + if(_winsdk_vistaonly_ok AND _winsdk_msvc_not_less_1800) + # Windows Software Development Kit (SDK) for Windows 8.1 + # http://msdn.microsoft.com/en-gb/windows/desktop/bg162891 + _winsdk_check_microsoft_sdks_registry(v8.1 8.1.25984.0) + _winsdk_check_windows_kits_registry("Windows Kits 8.1" 8.1.25984.0 KitsRoot81) + endif() # vista-only and 2013+ + + if(_winsdk_vistaonly_ok) + # Included in Visual Studio 2012 + _winsdk_check_microsoft_sdks_registry(v8.0A 8.0.50727) + + # Microsoft Windows SDK for Windows 8 and .NET Framework 4.5 + # This is the first version to also include the DirectX SDK + # http://msdn.microsoft.com/en-US/windows/desktop/hh852363.aspx + _winsdk_check_microsoft_sdks_registry(v8.0 6.2.9200.16384) + _winsdk_check_windows_kits_registry("Windows Kits 8.0" 6.2.9200.16384 KitsRoot) + endif() # vista-only + + # Included with VS 2012 Update 1 or later + # Introduces v110_xp toolset + _winsdk_check_microsoft_sdks_registry(v7.1A 7.1.51106) + if(_winsdk_vistaonly_ok) + # Microsoft Windows SDK for Windows 7 and .NET Framework 4 + # http://www.microsoft.com/downloads/en/details.aspx?FamilyID=6b6c21d2-2006-4afa-9702-529fa782d63b + _winsdk_check_microsoft_sdks_registry(v7.1 7.1.7600.0.30514) + endif() # vista-only + + # Included with VS 2010 + _winsdk_check_microsoft_sdks_registry(v7.0A 6.1.7600.16385) + + # Windows SDK for Windows 7 and .NET Framework 3.5 SP1 + # Works with VC9 + # http://www.microsoft.com/en-us/download/details.aspx?id=18950 + _winsdk_check_microsoft_sdks_registry(v7.0 6.1.7600.16385) + + # Two versions call themselves "v6.1": + # Older: + # Windows Vista Update & .NET 3.0 SDK + # http://www.microsoft.com/en-us/download/details.aspx?id=14477 + + # Newer: + # Windows Server 2008 & .NET 3.5 SDK + # may have broken VS9SP1? they recommend v7.0 instead, or a KB... + # http://www.microsoft.com/en-us/download/details.aspx?id=24826 + _winsdk_check_microsoft_sdks_registry(v6.1 6.1.6000.16384.10) + + # Included in VS 2008 + _winsdk_check_microsoft_sdks_registry(v6.0A 6.1.6723.1) + + # Microsoft Windows Software Development Kit for Windows Vista and .NET Framework 3.0 Runtime Components + # http://blogs.msdn.com/b/stanley/archive/2006/11/08/microsoft-windows-software-development-kit-for-windows-vista-and-net-framework-3-0-runtime-components.aspx + _winsdk_check_microsoft_sdks_registry(v6.0 6.0.6000.16384) +endif() + +# Let's not forget the Platform SDKs, which sometimes are useful! +if(_winsdk_msvc_greater_1200) + _winsdk_check_platformsdk_registry("Microsoft Platform SDK for Windows Server 2003 R2" "5.2.3790.2075.51" "D2FF9F89-8AA2-4373-8A31-C838BF4DBBE1") + _winsdk_check_platformsdk_registry("Microsoft Platform SDK for Windows Server 2003 SP1" "5.2.3790.1830.15" "8F9E5EF3-A9A5-491B-A889-C58EFFECE8B3") +endif() +### +# Finally, look for "preferred" SDKs +### +if(_winsdk_msvc_greater_1310) # Newer than VS .NET/VS Toolkit 2003 + + + # Environment variable for SDK dir + if(EXISTS "$ENV{WindowsSDKDir}" AND (NOT "$ENV{WindowsSDKDir}" STREQUAL "")) + _winsdk_conditional_append_preferred("WindowsSDKDir environment variable" "$ENV{WindowsSDKDir}") + endif() + + if(_winsdk_msvc_less_1600) + # Per-user current Windows SDK for VS2005/2008 + get_filename_component(_sdkdir + "[HKEY_CURRENT_USER\\Software\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" + ABSOLUTE) + _winsdk_conditional_append_preferred("Per-user current Windows SDK" "${_sdkdir}") + + # System-wide current Windows SDK for VS2005/2008 + get_filename_component(_sdkdir + "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows;CurrentInstallFolder]" + ABSOLUTE) + _winsdk_conditional_append_preferred("System-wide current Windows SDK" "${_sdkdir}") + endif() +endif() + + +function(windowssdk_name_lookup _dir _outvar) + list(FIND _win_sdk_versanddirs "${_dir}" _diridx) + math(EXPR _idx "${_diridx} - 1") + if(${_idx} GREATER -1) + list(GET _win_sdk_versanddirs ${_idx} _ret) + else() + set(_ret "NOTFOUND") + endif() + set(${_outvar} "${_ret}" PARENT_SCOPE) +endfunction() + +function(windowssdk_build_lookup _dir _outvar) + list(FIND _win_sdk_buildsanddirs "${_dir}" _diridx) + math(EXPR _idx "${_diridx} - 1") + if(${_idx} GREATER -1) + list(GET _win_sdk_buildsanddirs ${_idx} _ret) + else() + set(_ret "NOTFOUND") + endif() + set(${_outvar} "${_ret}" PARENT_SCOPE) +endfunction() + +# If we found something... +if(_win_sdk_dirs) + list(GET _win_sdk_dirs 0 WINDOWSSDK_LATEST_DIR) + windowssdk_name_lookup("${WINDOWSSDK_LATEST_DIR}" + WINDOWSSDK_LATEST_NAME) + set(WINDOWSSDK_DIRS ${_win_sdk_dirs}) + + # Fallback, in case no preference found. + set(WINDOWSSDK_PREFERRED_DIR "${WINDOWSSDK_LATEST_DIR}") + set(WINDOWSSDK_PREFERRED_NAME "${WINDOWSSDK_LATEST_NAME}") + set(WINDOWSSDK_PREFERRED_FIRST_DIRS ${WINDOWSSDK_DIRS}) + set(WINDOWSSDK_FOUND_PREFERENCE OFF) +endif() + +# If we found indications of a user preference... +if(_win_sdk_preferred_sdk_dirs) + list(GET _win_sdk_preferred_sdk_dirs 0 WINDOWSSDK_PREFERRED_DIR) + windowssdk_name_lookup("${WINDOWSSDK_PREFERRED_DIR}" + WINDOWSSDK_PREFERRED_NAME) + set(WINDOWSSDK_PREFERRED_FIRST_DIRS + ${_win_sdk_preferred_sdk_dirs} + ${_win_sdk_dirs}) + list(REMOVE_DUPLICATES WINDOWSSDK_PREFERRED_FIRST_DIRS) + set(WINDOWSSDK_FOUND_PREFERENCE ON) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WindowsSDK + "No compatible version of the Windows SDK or Platform SDK found." + WINDOWSSDK_DIRS) + +if(WINDOWSSDK_FOUND) + # Internal: Architecture-appropriate library directory names. + if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM") + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + # Only supported in Win10 SDK and up. + set(_winsdk_arch8 arm64) # what the WDK for Win8+ calls this architecture + else() + set(_winsdk_archbare /arm) # what the architecture used to be called in oldest SDKs + set(_winsdk_arch arm) # what the architecture used to be called + set(_winsdk_arch8 arm) # what the WDK for Win8+ calls this architecture + endif() + else() + if(CMAKE_SIZEOF_VOID_P MATCHES "8") + set(_winsdk_archbare /x64) # what the architecture used to be called in oldest SDKs + set(_winsdk_arch amd64) # what the architecture used to be called + set(_winsdk_arch8 x64) # what the WDK for Win8+ calls this architecture + else() + set(_winsdk_archbare ) # what the architecture used to be called in oldest SDKs + set(_winsdk_arch i386) # what the architecture used to be called + set(_winsdk_arch8 x86) # what the WDK for Win8+ calls this architecture + endif() + endif() + + function(get_windowssdk_from_component _component _var) + get_filename_component(_component "${_component}" ABSOLUTE) + file(TO_CMAKE_PATH "${_component}" _component) + foreach(_sdkdir ${WINDOWSSDK_DIRS}) + get_filename_component(_sdkdir "${_sdkdir}" ABSOLUTE) + string(LENGTH "${_sdkdir}" _sdklen) + file(RELATIVE_PATH _rel "${_sdkdir}" "${_component}") + # If we don't have any "parent directory" items... + if(NOT "${_rel}" MATCHES "[.][.]") + set(${_var} "${_sdkdir}" PARENT_SCOPE) + return() + endif() + endforeach() + # Fail. + set(${_var} "NOTFOUND" PARENT_SCOPE) + endfunction() + function(get_windowssdk_library_dirs _winsdk_dir _var) + set(_dirs) + set(_suffixes + "lib${_winsdk_archbare}" # SDKs like 7.1A + "lib/${_winsdk_arch}" # just because some SDKs have x86 dir and root dir + "lib/w2k/${_winsdk_arch}" # Win2k min requirement + "lib/wxp/${_winsdk_arch}" # WinXP min requirement + "lib/wnet/${_winsdk_arch}" # Win Server 2003 min requirement + "lib/wlh/${_winsdk_arch}" + "lib/wlh/um/${_winsdk_arch8}" # Win Vista ("Long Horn") min requirement + "lib/win7/${_winsdk_arch}" + "lib/win7/um/${_winsdk_arch8}" # Win 7 min requirement + ) + foreach(_ver + wlh # Win Vista ("Long Horn") min requirement + win7 # Win 7 min requirement + win8 # Win 8 min requirement + winv6.3 # Win 8.1 min requirement + ) + + list(APPEND _suffixes + "lib/${_ver}/${_winsdk_arch}" + "lib/${_ver}/um/${_winsdk_arch8}" + "lib/${_ver}/km/${_winsdk_arch8}" + ) + endforeach() + + # Look for WDF libraries in Win10+ SDK + foreach(_mode umdf kmdf) + file(GLOB _wdfdirs RELATIVE "${_winsdk_dir}" "${_winsdk_dir}/lib/wdf/${_mode}/${_winsdk_arch8}/*") + if(_wdfdirs) + list(APPEND _suffixes ${_wdfdirs}) + endif() + endforeach() + + # Look in each Win10+ SDK version for the components + foreach(_win10ver ${_winsdk_win10vers}) + foreach(_component um km ucrt mmos) + list(APPEND _suffixes "lib/${_win10ver}/${_component}/${_winsdk_arch8}") + endforeach() + endforeach() + + foreach(_suffix ${_suffixes}) + # Check to see if a library actually exists here. + file(GLOB _libs "${_winsdk_dir}/${_suffix}/*.lib") + if(_libs) + list(APPEND _dirs "${_winsdk_dir}/${_suffix}") + endif() + endforeach() + if("${_dirs}" STREQUAL "") + set(_dirs NOTFOUND) + else() + list(REMOVE_DUPLICATES _dirs) + endif() + set(${_var} ${_dirs} PARENT_SCOPE) + endfunction() + function(get_windowssdk_include_dirs _winsdk_dir _var) + set(_dirs) + + set(_subdirs shared um winrt km wdf mmos ucrt) + set(_suffixes Include) + + foreach(_dir ${_subdirs}) + list(APPEND _suffixes "Include/${_dir}") + endforeach() + + foreach(_ver ${_winsdk_win10vers}) + foreach(_dir ${_subdirs}) + list(APPEND _suffixes "Include/${_ver}/${_dir}") + endforeach() + endforeach() + + foreach(_suffix ${_suffixes}) + # Check to see if a header file actually exists here. + file(GLOB _headers "${_winsdk_dir}/${_suffix}/*.h") + if(_headers) + list(APPEND _dirs "${_winsdk_dir}/${_suffix}") + endif() + endforeach() + if("${_dirs}" STREQUAL "") + set(_dirs NOTFOUND) + else() + list(REMOVE_DUPLICATES _dirs) + endif() + set(${_var} ${_dirs} PARENT_SCOPE) + endfunction() + function(get_windowssdk_library_dirs_multiple _var) + set(_dirs) + foreach(_sdkdir ${ARGN}) + get_windowssdk_library_dirs("${_sdkdir}" _current_sdk_libdirs) + if(_current_sdk_libdirs) + list(APPEND _dirs ${_current_sdk_libdirs}) + endif() + endforeach() + if("${_dirs}" STREQUAL "") + set(_dirs NOTFOUND) + else() + list(REMOVE_DUPLICATES _dirs) + endif() + set(${_var} ${_dirs} PARENT_SCOPE) + endfunction() + function(get_windowssdk_include_dirs_multiple _var) + set(_dirs) + foreach(_sdkdir ${ARGN}) + get_windowssdk_include_dirs("${_sdkdir}" _current_sdk_incdirs) + if(_current_sdk_libdirs) + list(APPEND _dirs ${_current_sdk_incdirs}) + endif() + endforeach() + if("${_dirs}" STREQUAL "") + set(_dirs NOTFOUND) + else() + list(REMOVE_DUPLICATES _dirs) + endif() + set(${_var} ${_dirs} PARENT_SCOPE) + endfunction() +endif() diff --git a/Engine/lib/openal-soft/include/align.h b/Engine/lib/openal-soft/common/align.h similarity index 100% rename from Engine/lib/openal-soft/include/align.h rename to Engine/lib/openal-soft/common/align.h diff --git a/Engine/lib/openal-soft/common/almalloc.c b/Engine/lib/openal-soft/common/almalloc.c index 8c1c5794e..0d982ca19 100644 --- a/Engine/lib/openal-soft/common/almalloc.c +++ b/Engine/lib/openal-soft/common/almalloc.c @@ -10,8 +10,20 @@ #endif #ifdef HAVE_WINDOWS_H #include +#else +#include #endif + +#ifdef __GNUC__ +#define LIKELY(x) __builtin_expect(!!(x), !0) +#define UNLIKELY(x) __builtin_expect(!!(x), 0) +#else +#define LIKELY(x) (!!(x)) +#define UNLIKELY(x) (!!(x)) +#endif + + void *al_malloc(size_t alignment, size_t size) { #if defined(HAVE_ALIGNED_ALLOC) @@ -60,3 +72,39 @@ void al_free(void *ptr) } #endif } + +size_t al_get_page_size(void) +{ + static size_t psize = 0; + if(UNLIKELY(!psize)) + { +#ifdef HAVE_SYSCONF +#if defined(_SC_PAGESIZE) + if(!psize) psize = sysconf(_SC_PAGESIZE); +#elif defined(_SC_PAGE_SIZE) + if(!psize) psize = sysconf(_SC_PAGE_SIZE); +#endif +#endif /* HAVE_SYSCONF */ +#ifdef _WIN32 + if(!psize) + { + SYSTEM_INFO sysinfo; + memset(&sysinfo, 0, sizeof(sysinfo)); + + GetSystemInfo(&sysinfo); + psize = sysinfo.dwPageSize; + } +#endif + if(!psize) psize = DEF_ALIGN; + } + return psize; +} + +int al_is_sane_alignment_allocator(void) +{ +#if defined(HAVE_ALIGNED_ALLOC) || defined(HAVE_POSIX_MEMALIGN) || defined(HAVE__ALIGNED_MALLOC) + return 1; +#else + return 0; +#endif +} diff --git a/Engine/lib/openal-soft/common/almalloc.h b/Engine/lib/openal-soft/common/almalloc.h new file mode 100644 index 000000000..a4297cf50 --- /dev/null +++ b/Engine/lib/openal-soft/common/almalloc.h @@ -0,0 +1,30 @@ +#ifndef AL_MALLOC_H +#define AL_MALLOC_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* Minimum alignment required by posix_memalign. */ +#define DEF_ALIGN sizeof(void*) + +void *al_malloc(size_t alignment, size_t size); +void *al_calloc(size_t alignment, size_t size); +void al_free(void *ptr); + +size_t al_get_page_size(void); + +/** + * Returns non-0 if the allocation function has direct alignment handling. + * Otherwise, the standard malloc is used with an over-allocation and pointer + * offset strategy. + */ +int al_is_sane_alignment_allocator(void); + +#ifdef __cplusplus +} +#endif + +#endif /* AL_MALLOC_H */ diff --git a/Engine/lib/openal-soft/common/atomic.h b/Engine/lib/openal-soft/common/atomic.h new file mode 100644 index 000000000..39daa1dc4 --- /dev/null +++ b/Engine/lib/openal-soft/common/atomic.h @@ -0,0 +1,439 @@ +#ifndef AL_ATOMIC_H +#define AL_ATOMIC_H + +#include "static_assert.h" +#include "bool.h" + +#ifdef __GNUC__ +/* This helps cast away the const-ness of a pointer without accidentally + * changing the pointer type. This is necessary due to Clang's inability to use + * atomic_load on a const _Atomic variable. + */ +#define CONST_CAST(T, V) __extension__({ \ + const T _tmp = (V); \ + (T)_tmp; \ +}) +#else +#define CONST_CAST(T, V) ((T)(V)) +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* Atomics using C11 */ +#ifdef HAVE_C11_ATOMIC + +#include + +#define almemory_order memory_order +#define almemory_order_relaxed memory_order_relaxed +#define almemory_order_consume memory_order_consume +#define almemory_order_acquire memory_order_acquire +#define almemory_order_release memory_order_release +#define almemory_order_acq_rel memory_order_acq_rel +#define almemory_order_seq_cst memory_order_seq_cst + +#define ATOMIC(T) T _Atomic +#define ATOMIC_FLAG atomic_flag + +#define ATOMIC_INIT atomic_init +#define ATOMIC_INIT_STATIC ATOMIC_VAR_INIT +/*#define ATOMIC_FLAG_INIT ATOMIC_FLAG_INIT*/ + +#define ATOMIC_LOAD atomic_load_explicit +#define ATOMIC_STORE atomic_store_explicit + +#define ATOMIC_ADD atomic_fetch_add_explicit +#define ATOMIC_SUB atomic_fetch_sub_explicit + +#define ATOMIC_EXCHANGE atomic_exchange_explicit +#define ATOMIC_COMPARE_EXCHANGE_STRONG atomic_compare_exchange_strong_explicit +#define ATOMIC_COMPARE_EXCHANGE_WEAK atomic_compare_exchange_weak_explicit + +#define ATOMIC_FLAG_TEST_AND_SET atomic_flag_test_and_set_explicit +#define ATOMIC_FLAG_CLEAR atomic_flag_clear_explicit + +#define ATOMIC_THREAD_FENCE atomic_thread_fence + +/* Atomics using GCC intrinsics */ +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && !defined(__QNXNTO__) + +enum almemory_order { + almemory_order_relaxed, + almemory_order_consume, + almemory_order_acquire, + almemory_order_release, + almemory_order_acq_rel, + almemory_order_seq_cst +}; + +#define ATOMIC(T) struct { T volatile value; } +#define ATOMIC_FLAG ATOMIC(int) + +#define ATOMIC_INIT(_val, _newval) do { (_val)->value = (_newval); } while(0) +#define ATOMIC_INIT_STATIC(_newval) {(_newval)} +#define ATOMIC_FLAG_INIT ATOMIC_INIT_STATIC(0) + +#define ATOMIC_LOAD(_val, _MO) __extension__({ \ + __typeof((_val)->value) _r = (_val)->value; \ + __asm__ __volatile__("" ::: "memory"); \ + _r; \ +}) +#define ATOMIC_STORE(_val, _newval, _MO) do { \ + __asm__ __volatile__("" ::: "memory"); \ + (_val)->value = (_newval); \ +} while(0) + +#define ATOMIC_ADD(_val, _incr, _MO) __sync_fetch_and_add(&(_val)->value, (_incr)) +#define ATOMIC_SUB(_val, _decr, _MO) __sync_fetch_and_sub(&(_val)->value, (_decr)) + +#define ATOMIC_EXCHANGE(_val, _newval, _MO) __extension__({ \ + __asm__ __volatile__("" ::: "memory"); \ + __sync_lock_test_and_set(&(_val)->value, (_newval)); \ +}) +#define ATOMIC_COMPARE_EXCHANGE_STRONG(_val, _oldval, _newval, _MO1, _MO2) __extension__({ \ + __typeof(*(_oldval)) _o = *(_oldval); \ + *(_oldval) = __sync_val_compare_and_swap(&(_val)->value, _o, (_newval)); \ + *(_oldval) == _o; \ +}) + +#define ATOMIC_FLAG_TEST_AND_SET(_val, _MO) __extension__({ \ + __asm__ __volatile__("" ::: "memory"); \ + __sync_lock_test_and_set(&(_val)->value, 1); \ +}) +#define ATOMIC_FLAG_CLEAR(_val, _MO) __extension__({ \ + __sync_lock_release(&(_val)->value); \ + __asm__ __volatile__("" ::: "memory"); \ +}) + + +#define ATOMIC_THREAD_FENCE(order) do { \ + enum { must_be_constant = (order) }; \ + const int _o = must_be_constant; \ + if(_o > almemory_order_relaxed) \ + __asm__ __volatile__("" ::: "memory"); \ +} while(0) + +/* Atomics using x86/x86-64 GCC inline assembly */ +#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) + +#define WRAP_ADD(S, ret, dest, incr) __asm__ __volatile__( \ + "lock; xadd"S" %0,(%1)" \ + : "=r" (ret) \ + : "r" (dest), "0" (incr) \ + : "memory" \ +) +#define WRAP_SUB(S, ret, dest, decr) __asm__ __volatile__( \ + "lock; xadd"S" %0,(%1)" \ + : "=r" (ret) \ + : "r" (dest), "0" (-(decr)) \ + : "memory" \ +) + +#define WRAP_XCHG(S, ret, dest, newval) __asm__ __volatile__( \ + "lock; xchg"S" %0,(%1)" \ + : "=r" (ret) \ + : "r" (dest), "0" (newval) \ + : "memory" \ +) +#define WRAP_CMPXCHG(S, ret, dest, oldval, newval) __asm__ __volatile__( \ + "lock; cmpxchg"S" %2,(%1)" \ + : "=a" (ret) \ + : "r" (dest), "r" (newval), "0" (oldval) \ + : "memory" \ +) + + +enum almemory_order { + almemory_order_relaxed, + almemory_order_consume, + almemory_order_acquire, + almemory_order_release, + almemory_order_acq_rel, + almemory_order_seq_cst +}; + +#define ATOMIC(T) struct { T volatile value; } + +#define ATOMIC_INIT(_val, _newval) do { (_val)->value = (_newval); } while(0) +#define ATOMIC_INIT_STATIC(_newval) {(_newval)} + +#define ATOMIC_LOAD(_val, _MO) __extension__({ \ + __typeof((_val)->value) _r = (_val)->value; \ + __asm__ __volatile__("" ::: "memory"); \ + _r; \ +}) +#define ATOMIC_STORE(_val, _newval, _MO) do { \ + __asm__ __volatile__("" ::: "memory"); \ + (_val)->value = (_newval); \ +} while(0) + +#define ATOMIC_ADD(_val, _incr, _MO) __extension__({ \ + static_assert(sizeof((_val)->value)==4 || sizeof((_val)->value)==8, "Unsupported size!"); \ + __typeof((_val)->value) _r; \ + if(sizeof((_val)->value) == 4) WRAP_ADD("l", _r, &(_val)->value, _incr); \ + else if(sizeof((_val)->value) == 8) WRAP_ADD("q", _r, &(_val)->value, _incr); \ + _r; \ +}) +#define ATOMIC_SUB(_val, _decr, _MO) __extension__({ \ + static_assert(sizeof((_val)->value)==4 || sizeof((_val)->value)==8, "Unsupported size!"); \ + __typeof((_val)->value) _r; \ + if(sizeof((_val)->value) == 4) WRAP_SUB("l", _r, &(_val)->value, _decr); \ + else if(sizeof((_val)->value) == 8) WRAP_SUB("q", _r, &(_val)->value, _decr); \ + _r; \ +}) + +#define ATOMIC_EXCHANGE(_val, _newval, _MO) __extension__({ \ + __typeof((_val)->value) _r; \ + if(sizeof((_val)->value) == 4) WRAP_XCHG("l", _r, &(_val)->value, (_newval)); \ + else if(sizeof((_val)->value) == 8) WRAP_XCHG("q", _r, &(_val)->value, (_newval)); \ + _r; \ +}) +#define ATOMIC_COMPARE_EXCHANGE_STRONG(_val, _oldval, _newval, _MO1, _MO2) __extension__({ \ + __typeof(*(_oldval)) _old = *(_oldval); \ + if(sizeof((_val)->value) == 4) WRAP_CMPXCHG("l", *(_oldval), &(_val)->value, _old, (_newval)); \ + else if(sizeof((_val)->value) == 8) WRAP_CMPXCHG("q", *(_oldval), &(_val)->value, _old, (_newval)); \ + *(_oldval) == _old; \ +}) + +#define ATOMIC_EXCHANGE_PTR(_val, _newval, _MO) __extension__({ \ + void *_r; \ + if(sizeof(void*) == 4) WRAP_XCHG("l", _r, &(_val)->value, (_newval)); \ + else if(sizeof(void*) == 8) WRAP_XCHG("q", _r, &(_val)->value, (_newval));\ + _r; \ +}) +#define ATOMIC_COMPARE_EXCHANGE_PTR_STRONG(_val, _oldval, _newval, _MO1, _MO2) __extension__({ \ + void *_old = *(_oldval); \ + if(sizeof(void*) == 4) WRAP_CMPXCHG("l", *(_oldval), &(_val)->value, _old, (_newval)); \ + else if(sizeof(void*) == 8) WRAP_CMPXCHG("q", *(_oldval), &(_val)->value, _old, (_newval)); \ + *(_oldval) == _old; \ +}) + +#define ATOMIC_THREAD_FENCE(order) do { \ + enum { must_be_constant = (order) }; \ + const int _o = must_be_constant; \ + if(_o > almemory_order_relaxed) \ + __asm__ __volatile__("" ::: "memory"); \ +} while(0) + +/* Atomics using Windows methods */ +#elif defined(_WIN32) + +#define WIN32_LEAN_AND_MEAN +#include + +/* NOTE: This mess is *extremely* touchy. It lacks quite a bit of safety + * checking due to the lack of multi-statement expressions, typeof(), and C99 + * compound literals. It is incapable of properly exchanging floats, which get + * casted to LONG/int, and could cast away potential warnings. + * + * Unfortunately, it's the only semi-safe way that doesn't rely on C99 (because + * MSVC). + */ + +inline LONG AtomicAdd32(volatile LONG *dest, LONG incr) +{ + return InterlockedExchangeAdd(dest, incr); +} +inline LONGLONG AtomicAdd64(volatile LONGLONG *dest, LONGLONG incr) +{ + return InterlockedExchangeAdd64(dest, incr); +} +inline LONG AtomicSub32(volatile LONG *dest, LONG decr) +{ + return InterlockedExchangeAdd(dest, -decr); +} +inline LONGLONG AtomicSub64(volatile LONGLONG *dest, LONGLONG decr) +{ + return InterlockedExchangeAdd64(dest, -decr); +} + +inline LONG AtomicSwap32(volatile LONG *dest, LONG newval) +{ + return InterlockedExchange(dest, newval); +} +inline LONGLONG AtomicSwap64(volatile LONGLONG *dest, LONGLONG newval) +{ + return InterlockedExchange64(dest, newval); +} +inline void *AtomicSwapPtr(void *volatile *dest, void *newval) +{ + return InterlockedExchangePointer(dest, newval); +} + +inline bool CompareAndSwap32(volatile LONG *dest, LONG newval, LONG *oldval) +{ + LONG old = *oldval; + *oldval = InterlockedCompareExchange(dest, newval, *oldval); + return old == *oldval; +} +inline bool CompareAndSwap64(volatile LONGLONG *dest, LONGLONG newval, LONGLONG *oldval) +{ + LONGLONG old = *oldval; + *oldval = InterlockedCompareExchange64(dest, newval, *oldval); + return old == *oldval; +} +inline bool CompareAndSwapPtr(void *volatile *dest, void *newval, void **oldval) +{ + void *old = *oldval; + *oldval = InterlockedCompareExchangePointer(dest, newval, *oldval); + return old == *oldval; +} + +#define WRAP_ADDSUB(T, _func, _ptr, _amnt) _func((T volatile*)(_ptr), (_amnt)) +#define WRAP_XCHG(T, _func, _ptr, _newval) _func((T volatile*)(_ptr), (_newval)) +#define WRAP_CMPXCHG(T, _func, _ptr, _newval, _oldval) _func((T volatile*)(_ptr), (_newval), (T*)(_oldval)) + + +enum almemory_order { + almemory_order_relaxed, + almemory_order_consume, + almemory_order_acquire, + almemory_order_release, + almemory_order_acq_rel, + almemory_order_seq_cst +}; + +#define ATOMIC(T) struct { T volatile value; } + +#define ATOMIC_INIT(_val, _newval) do { (_val)->value = (_newval); } while(0) +#define ATOMIC_INIT_STATIC(_newval) {(_newval)} + +#define ATOMIC_LOAD(_val, _MO) ((_val)->value) +#define ATOMIC_STORE(_val, _newval, _MO) do { \ + (_val)->value = (_newval); \ +} while(0) + +int _al_invalid_atomic_size(); /* not defined */ +void *_al_invalid_atomic_ptr_size(); /* not defined */ + +#define ATOMIC_ADD(_val, _incr, _MO) \ + ((sizeof((_val)->value)==4) ? WRAP_ADDSUB(LONG, AtomicAdd32, &(_val)->value, (_incr)) : \ + (sizeof((_val)->value)==8) ? WRAP_ADDSUB(LONGLONG, AtomicAdd64, &(_val)->value, (_incr)) : \ + _al_invalid_atomic_size()) +#define ATOMIC_SUB(_val, _decr, _MO) \ + ((sizeof((_val)->value)==4) ? WRAP_ADDSUB(LONG, AtomicSub32, &(_val)->value, (_decr)) : \ + (sizeof((_val)->value)==8) ? WRAP_ADDSUB(LONGLONG, AtomicSub64, &(_val)->value, (_decr)) : \ + _al_invalid_atomic_size()) + +#define ATOMIC_EXCHANGE(_val, _newval, _MO) \ + ((sizeof((_val)->value)==4) ? WRAP_XCHG(LONG, AtomicSwap32, &(_val)->value, (_newval)) : \ + (sizeof((_val)->value)==8) ? WRAP_XCHG(LONGLONG, AtomicSwap64, &(_val)->value, (_newval)) : \ + (LONG)_al_invalid_atomic_size()) +#define ATOMIC_COMPARE_EXCHANGE_STRONG(_val, _oldval, _newval, _MO1, _MO2) \ + ((sizeof((_val)->value)==4) ? WRAP_CMPXCHG(LONG, CompareAndSwap32, &(_val)->value, (_newval), (_oldval)) : \ + (sizeof((_val)->value)==8) ? WRAP_CMPXCHG(LONGLONG, CompareAndSwap64, &(_val)->value, (_newval), (_oldval)) : \ + (bool)_al_invalid_atomic_size()) + +#define ATOMIC_EXCHANGE_PTR(_val, _newval, _MO) \ + ((sizeof((_val)->value)==sizeof(void*)) ? AtomicSwapPtr((void*volatile*)&(_val)->value, (_newval)) : \ + _al_invalid_atomic_ptr_size()) +#define ATOMIC_COMPARE_EXCHANGE_PTR_STRONG(_val, _oldval, _newval, _MO1, _MO2)\ + ((sizeof((_val)->value)==sizeof(void*)) ? CompareAndSwapPtr((void*volatile*)&(_val)->value, (_newval), (void**)(_oldval)) : \ + (bool)_al_invalid_atomic_size()) + +#define ATOMIC_THREAD_FENCE(order) do { \ + enum { must_be_constant = (order) }; \ + const int _o = must_be_constant; \ + if(_o > almemory_order_relaxed) \ + _ReadWriteBarrier(); \ +} while(0) + +#else + +#error "No atomic functions available on this platform!" + +#define ATOMIC(T) T + +#define ATOMIC_INIT(_val, _newval) ((void)0) +#define ATOMIC_INIT_STATIC(_newval) (0) + +#define ATOMIC_LOAD(...) (0) +#define ATOMIC_STORE(...) ((void)0) + +#define ATOMIC_ADD(...) (0) +#define ATOMIC_SUB(...) (0) + +#define ATOMIC_EXCHANGE(...) (0) +#define ATOMIC_COMPARE_EXCHANGE_STRONG(...) (0) + +#define ATOMIC_THREAD_FENCE(...) ((void)0) +#endif + +/* If no PTR xchg variants are provided, the normal ones can handle it. */ +#ifndef ATOMIC_EXCHANGE_PTR +#define ATOMIC_EXCHANGE_PTR ATOMIC_EXCHANGE +#define ATOMIC_COMPARE_EXCHANGE_PTR_STRONG ATOMIC_COMPARE_EXCHANGE_STRONG +#define ATOMIC_COMPARE_EXCHANGE_PTR_WEAK ATOMIC_COMPARE_EXCHANGE_WEAK +#endif + +/* If no weak cmpxchg is provided (not all systems will have one), substitute a + * strong cmpxchg. */ +#ifndef ATOMIC_COMPARE_EXCHANGE_WEAK +#define ATOMIC_COMPARE_EXCHANGE_WEAK ATOMIC_COMPARE_EXCHANGE_STRONG +#endif +#ifndef ATOMIC_COMPARE_EXCHANGE_PTR_WEAK +#define ATOMIC_COMPARE_EXCHANGE_PTR_WEAK ATOMIC_COMPARE_EXCHANGE_PTR_STRONG +#endif + +/* If no ATOMIC_FLAG is defined, simulate one with an atomic int using exchange + * and store ops. + */ +#ifndef ATOMIC_FLAG +#define ATOMIC_FLAG ATOMIC(int) +#define ATOMIC_FLAG_INIT ATOMIC_INIT_STATIC(0) +#define ATOMIC_FLAG_TEST_AND_SET(_val, _MO) ATOMIC_EXCHANGE(_val, 1, _MO) +#define ATOMIC_FLAG_CLEAR(_val, _MO) ATOMIC_STORE(_val, 0, _MO) +#endif + + +#define ATOMIC_LOAD_SEQ(_val) ATOMIC_LOAD(_val, almemory_order_seq_cst) +#define ATOMIC_STORE_SEQ(_val, _newval) ATOMIC_STORE(_val, _newval, almemory_order_seq_cst) + +#define ATOMIC_ADD_SEQ(_val, _incr) ATOMIC_ADD(_val, _incr, almemory_order_seq_cst) +#define ATOMIC_SUB_SEQ(_val, _decr) ATOMIC_SUB(_val, _decr, almemory_order_seq_cst) + +#define ATOMIC_EXCHANGE_SEQ(_val, _newval) ATOMIC_EXCHANGE(_val, _newval, almemory_order_seq_cst) +#define ATOMIC_COMPARE_EXCHANGE_STRONG_SEQ(_val, _oldval, _newval) \ + ATOMIC_COMPARE_EXCHANGE_STRONG(_val, _oldval, _newval, almemory_order_seq_cst, almemory_order_seq_cst) +#define ATOMIC_COMPARE_EXCHANGE_WEAK_SEQ(_val, _oldval, _newval) \ + ATOMIC_COMPARE_EXCHANGE_WEAK(_val, _oldval, _newval, almemory_order_seq_cst, almemory_order_seq_cst) + +#define ATOMIC_EXCHANGE_PTR_SEQ(_val, _newval) ATOMIC_EXCHANGE_PTR(_val, _newval, almemory_order_seq_cst) +#define ATOMIC_COMPARE_EXCHANGE_PTR_STRONG_SEQ(_val, _oldval, _newval) \ + ATOMIC_COMPARE_EXCHANGE_PTR_STRONG(_val, _oldval, _newval, almemory_order_seq_cst, almemory_order_seq_cst) +#define ATOMIC_COMPARE_EXCHANGE_PTR_WEAK_SEQ(_val, _oldval, _newval) \ + ATOMIC_COMPARE_EXCHANGE_PTR_WEAK(_val, _oldval, _newval, almemory_order_seq_cst, almemory_order_seq_cst) + + +typedef unsigned int uint; +typedef ATOMIC(uint) RefCount; + +inline void InitRef(RefCount *ptr, uint value) +{ ATOMIC_INIT(ptr, value); } +inline uint ReadRef(RefCount *ptr) +{ return ATOMIC_LOAD(ptr, almemory_order_acquire); } +inline uint IncrementRef(RefCount *ptr) +{ return ATOMIC_ADD(ptr, 1, almemory_order_acq_rel)+1; } +inline uint DecrementRef(RefCount *ptr) +{ return ATOMIC_SUB(ptr, 1, almemory_order_acq_rel)-1; } + + +/* WARNING: A livelock is theoretically possible if another thread keeps + * changing the head without giving this a chance to actually swap in the new + * one (practically impossible with this little code, but...). + */ +#define ATOMIC_REPLACE_HEAD(T, _head, _entry) do { \ + T _first = ATOMIC_LOAD(_head, almemory_order_acquire); \ + do { \ + ATOMIC_STORE(&(_entry)->next, _first, almemory_order_relaxed); \ + } while(ATOMIC_COMPARE_EXCHANGE_PTR_WEAK(_head, &_first, _entry, \ + almemory_order_acq_rel, almemory_order_acquire) == 0); \ +} while(0) + +#ifdef __cplusplus +} +#endif + +#endif /* AL_ATOMIC_H */ diff --git a/Engine/lib/openal-soft/include/bool.h b/Engine/lib/openal-soft/common/bool.h similarity index 100% rename from Engine/lib/openal-soft/include/bool.h rename to Engine/lib/openal-soft/common/bool.h diff --git a/Engine/lib/openal-soft/common/math_defs.h b/Engine/lib/openal-soft/common/math_defs.h new file mode 100644 index 000000000..8ce93d0a9 --- /dev/null +++ b/Engine/lib/openal-soft/common/math_defs.h @@ -0,0 +1,46 @@ +#ifndef AL_MATH_DEFS_H +#define AL_MATH_DEFS_H + +#include +#ifdef HAVE_FLOAT_H +#include +#endif + +#ifndef M_PI +#define M_PI (3.14159265358979323846) +#endif + +#define F_PI (3.14159265358979323846f) +#define F_PI_2 (1.57079632679489661923f) +#define F_TAU (6.28318530717958647692f) + +#ifndef FLT_EPSILON +#define FLT_EPSILON (1.19209290e-07f) +#endif + +#ifndef HUGE_VALF +static const union msvc_inf_hack { + unsigned char b[4]; + float f; +} msvc_inf_union = {{ 0x00, 0x00, 0x80, 0x7F }}; +#define HUGE_VALF (msvc_inf_union.f) +#endif + +#ifndef HAVE_LOG2F +static inline float log2f(float f) +{ + return logf(f) / logf(2.0f); +} +#endif + +#ifndef HAVE_CBRTF +static inline float cbrtf(float f) +{ + return powf(f, 1.0f/3.0f); +} +#endif + +#define DEG2RAD(x) ((float)(x) * (F_PI/180.0f)) +#define RAD2DEG(x) ((float)(x) * (180.0f/F_PI)) + +#endif /* AL_MATH_DEFS_H */ diff --git a/Engine/lib/openal-soft/common/rwlock.c b/Engine/lib/openal-soft/common/rwlock.c index cfa3aee4e..67cf3acf0 100644 --- a/Engine/lib/openal-soft/common/rwlock.c +++ b/Engine/lib/openal-soft/common/rwlock.c @@ -11,26 +11,27 @@ /* A simple spinlock. Yield the thread while the given integer is set by * another. Could probably be improved... */ #define LOCK(l) do { \ - while(ATOMIC_EXCHANGE(int, &(l), true) == true) \ + while(ATOMIC_FLAG_TEST_AND_SET(&(l), almemory_order_acq_rel) == true) \ althrd_yield(); \ } while(0) -#define UNLOCK(l) ATOMIC_STORE(&(l), false) +#define UNLOCK(l) ATOMIC_FLAG_CLEAR(&(l), almemory_order_release) void RWLockInit(RWLock *lock) { InitRef(&lock->read_count, 0); InitRef(&lock->write_count, 0); - ATOMIC_INIT(&lock->read_lock, false); - ATOMIC_INIT(&lock->read_entry_lock, false); - ATOMIC_INIT(&lock->write_lock, false); + ATOMIC_FLAG_CLEAR(&lock->read_lock, almemory_order_relaxed); + ATOMIC_FLAG_CLEAR(&lock->read_entry_lock, almemory_order_relaxed); + ATOMIC_FLAG_CLEAR(&lock->write_lock, almemory_order_relaxed); } void ReadLock(RWLock *lock) { LOCK(lock->read_entry_lock); LOCK(lock->read_lock); - if(IncrementRef(&lock->read_count) == 1) + /* NOTE: ATOMIC_ADD returns the *old* value! */ + if(ATOMIC_ADD(&lock->read_count, 1, almemory_order_acq_rel) == 0) LOCK(lock->write_lock); UNLOCK(lock->read_lock); UNLOCK(lock->read_entry_lock); @@ -38,13 +39,14 @@ void ReadLock(RWLock *lock) void ReadUnlock(RWLock *lock) { - if(DecrementRef(&lock->read_count) == 0) + /* NOTE: ATOMIC_SUB returns the *old* value! */ + if(ATOMIC_SUB(&lock->read_count, 1, almemory_order_acq_rel) == 1) UNLOCK(lock->write_lock); } void WriteLock(RWLock *lock) { - if(IncrementRef(&lock->write_count) == 1) + if(ATOMIC_ADD(&lock->write_count, 1, almemory_order_acq_rel) == 0) LOCK(lock->read_lock); LOCK(lock->write_lock); } @@ -52,6 +54,6 @@ void WriteLock(RWLock *lock) void WriteUnlock(RWLock *lock) { UNLOCK(lock->write_lock); - if(DecrementRef(&lock->write_count) == 0) + if(ATOMIC_SUB(&lock->write_count, 1, almemory_order_acq_rel) == 1) UNLOCK(lock->read_lock); } diff --git a/Engine/lib/openal-soft/include/rwlock.h b/Engine/lib/openal-soft/common/rwlock.h similarity index 67% rename from Engine/lib/openal-soft/include/rwlock.h rename to Engine/lib/openal-soft/common/rwlock.h index 158a06708..8e36fa1a7 100644 --- a/Engine/lib/openal-soft/include/rwlock.h +++ b/Engine/lib/openal-soft/common/rwlock.h @@ -11,13 +11,12 @@ extern "C" { typedef struct { RefCount read_count; RefCount write_count; - ATOMIC(int) read_lock; - ATOMIC(int) read_entry_lock; - ATOMIC(int) write_lock; + ATOMIC_FLAG read_lock; + ATOMIC_FLAG read_entry_lock; + ATOMIC_FLAG write_lock; } RWLock; #define RWLOCK_STATIC_INITIALIZE { ATOMIC_INIT_STATIC(0), ATOMIC_INIT_STATIC(0), \ - ATOMIC_INIT_STATIC(false), ATOMIC_INIT_STATIC(false), \ - ATOMIC_INIT_STATIC(false) } + ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT, ATOMIC_FLAG_INIT } void RWLockInit(RWLock *lock); void ReadLock(RWLock *lock); diff --git a/Engine/lib/openal-soft/include/static_assert.h b/Engine/lib/openal-soft/common/static_assert.h similarity index 100% rename from Engine/lib/openal-soft/include/static_assert.h rename to Engine/lib/openal-soft/common/static_assert.h diff --git a/Engine/lib/openal-soft/common/threads.c b/Engine/lib/openal-soft/common/threads.c index 0a019d036..2655a2445 100644 --- a/Engine/lib/openal-soft/common/threads.c +++ b/Engine/lib/openal-soft/common/threads.c @@ -64,6 +64,22 @@ extern inline int altss_set(altss_t tss_id, void *val); #include +/* An associative map of uint:void* pairs. The key is the unique Thread ID and + * the value is the thread HANDLE. The thread ID is passed around as the + * althrd_t since there is only one ID per thread, whereas a thread may be + * referenced by multiple different HANDLEs. This map allows retrieving the + * original handle which is needed to join the thread and get its return value. + */ +static UIntMap ThrdIdHandle = UINTMAP_STATIC_INITIALIZE; + +/* An associative map of uint:void* pairs. The key is the TLS index (given by + * TlsAlloc), and the value is the altss_dtor_t callback. When a thread exits, + * we iterate over the TLS indices for their thread-local value and call the + * destructor function with it if they're both not NULL. + */ +static UIntMap TlsDestructors = UINTMAP_STATIC_INITIALIZE; + + void althrd_setname(althrd_t thr, const char *name) { #if defined(_MSC_VER) @@ -94,23 +110,6 @@ void althrd_setname(althrd_t thr, const char *name) } -static UIntMap ThrdIdHandle = UINTMAP_STATIC_INITIALIZE; - -static void NTAPI althrd_callback(void* UNUSED(handle), DWORD reason, void* UNUSED(reserved)) -{ - if(reason == DLL_PROCESS_DETACH) - ResetUIntMap(&ThrdIdHandle); -} -#ifdef _MSC_VER -#pragma section(".CRT$XLC",read) -__declspec(allocate(".CRT$XLC")) PIMAGE_TLS_CALLBACK althrd_callback_ = althrd_callback; -#elif defined(__GNUC__) -PIMAGE_TLS_CALLBACK althrd_callback_ __attribute__((section(".CRT$XLC"))) = althrd_callback; -#else -PIMAGE_TLS_CALLBACK althrd_callback_ = althrd_callback; -#endif - - typedef struct thread_cntr { althrd_start_t func; void *arg; @@ -208,12 +207,6 @@ void almtx_destroy(almtx_t *mtx) DeleteCriticalSection(mtx); } -int almtx_timedlock(almtx_t* UNUSED(mtx), const struct timespec* UNUSED(ts)) -{ - /* Windows CRITICAL_SECTIONs don't seem to have a timedlock method. */ - return althrd_error; -} - #if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600 int alcnd_init(alcnd_t *cond) { @@ -240,30 +233,6 @@ int alcnd_wait(alcnd_t *cond, almtx_t *mtx) return althrd_error; } -int alcnd_timedwait(alcnd_t *cond, almtx_t *mtx, const struct timespec *time_point) -{ - struct timespec curtime; - DWORD sleeptime; - - if(altimespec_get(&curtime, AL_TIME_UTC) != AL_TIME_UTC) - return althrd_error; - - if(curtime.tv_sec > time_point->tv_sec || (curtime.tv_sec == time_point->tv_sec && - curtime.tv_nsec >= time_point->tv_nsec)) - { - if(SleepConditionVariableCS(cond, mtx, 0) != 0) - return althrd_success; - } - else - { - sleeptime = (time_point->tv_nsec - curtime.tv_nsec + 999999)/1000000; - sleeptime += (time_point->tv_sec - curtime.tv_sec)*1000; - if(SleepConditionVariableCS(cond, mtx, sleeptime) != 0) - return althrd_success; - } - return (GetLastError()==ERROR_TIMEOUT) ? althrd_timedout : althrd_error; -} - void alcnd_destroy(alcnd_t* UNUSED(cond)) { /* Nothing to delete? */ @@ -348,37 +317,6 @@ int alcnd_wait(alcnd_t *cond, almtx_t *mtx) return althrd_success; } -int alcnd_timedwait(alcnd_t *cond, almtx_t *mtx, const struct timespec *time_point) -{ - _int_alcnd_t *icond = cond->Ptr; - struct timespec curtime; - DWORD sleeptime; - int res; - - if(altimespec_get(&curtime, AL_TIME_UTC) != AL_TIME_UTC) - return althrd_error; - - if(curtime.tv_sec > time_point->tv_sec || (curtime.tv_sec == time_point->tv_sec && - curtime.tv_nsec >= time_point->tv_nsec)) - sleeptime = 0; - else - { - sleeptime = (time_point->tv_nsec - curtime.tv_nsec + 999999)/1000000; - sleeptime += (time_point->tv_sec - curtime.tv_sec)*1000; - } - - IncrementRef(&icond->wait_count); - LeaveCriticalSection(mtx); - - res = WaitForMultipleObjects(2, icond->events, FALSE, sleeptime); - - if(DecrementRef(&icond->wait_count) == 0 && res == WAIT_OBJECT_0+BROADCAST) - ResetEvent(icond->events[BROADCAST]); - EnterCriticalSection(mtx); - - return (res == WAIT_TIMEOUT) ? althrd_timedout : althrd_success; -} - void alcnd_destroy(alcnd_t *cond) { _int_alcnd_t *icond = cond->Ptr; @@ -389,46 +327,40 @@ void alcnd_destroy(alcnd_t *cond) #endif /* defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600 */ -/* An associative map of uint:void* pairs. The key is the TLS index (given by - * TlsAlloc), and the value is the altss_dtor_t callback. When a thread exits, - * we iterate over the TLS indices for their thread-local value and call the - * destructor function with it if they're both not NULL. To avoid using - * DllMain, a PIMAGE_TLS_CALLBACK function pointer is placed in a ".CRT$XLx" - * section (where x is a character A to Z) which will be called by the CRT. - */ -static UIntMap TlsDestructors = UINTMAP_STATIC_INITIALIZE; - -static void NTAPI altss_callback(void* UNUSED(handle), DWORD reason, void* UNUSED(reserved)) +int alsem_init(alsem_t *sem, unsigned int initial) { - ALsizei i; - - if(reason == DLL_PROCESS_DETACH) - { - ResetUIntMap(&TlsDestructors); - return; - } - if(reason != DLL_THREAD_DETACH) - return; - - LockUIntMapRead(&TlsDestructors); - for(i = 0;i < TlsDestructors.size;i++) - { - void *ptr = altss_get(TlsDestructors.keys[i]); - altss_dtor_t callback = (altss_dtor_t)TlsDestructors.values[i]; - if(ptr && callback) - callback(ptr); - } - UnlockUIntMapRead(&TlsDestructors); + *sem = CreateSemaphore(NULL, initial, INT_MAX, NULL); + if(*sem != NULL) return althrd_success; + return althrd_error; } -#ifdef _MSC_VER -#pragma section(".CRT$XLB",read) -__declspec(allocate(".CRT$XLB")) PIMAGE_TLS_CALLBACK altss_callback_ = altss_callback; -#elif defined(__GNUC__) -PIMAGE_TLS_CALLBACK altss_callback_ __attribute__((section(".CRT$XLB"))) = altss_callback; -#else -#warning "No TLS callback support, thread-local contexts may leak references on poorly written applications." -PIMAGE_TLS_CALLBACK altss_callback_ = altss_callback; -#endif + +void alsem_destroy(alsem_t *sem) +{ + CloseHandle(*sem); +} + +int alsem_post(alsem_t *sem) +{ + DWORD ret = ReleaseSemaphore(*sem, 1, NULL); + if(ret) return althrd_success; + return althrd_error; +} + +int alsem_wait(alsem_t *sem) +{ + DWORD ret = WaitForSingleObject(*sem, INFINITE); + if(ret == WAIT_OBJECT_0) return althrd_success; + return althrd_error; +} + +int alsem_trywait(alsem_t *sem) +{ + DWORD ret = WaitForSingleObject(*sem, 0); + if(ret == WAIT_OBJECT_0) return althrd_success; + if(ret == WAIT_TIMEOUT) return althrd_busy; + return althrd_error; +} + int altss_create(altss_t *tss_id, altss_dtor_t callback) { @@ -480,6 +412,27 @@ void alcall_once(alonce_flag *once, void (*callback)(void)) InterlockedExchange(once, 2); } + +void althrd_deinit(void) +{ + ResetUIntMap(&ThrdIdHandle); + ResetUIntMap(&TlsDestructors); +} + +void althrd_thread_detach(void) +{ + ALsizei i; + + LockUIntMapRead(&TlsDestructors); + for(i = 0;i < TlsDestructors.size;i++) + { + void *ptr = altss_get(TlsDestructors.keys[i]); + altss_dtor_t callback = (altss_dtor_t)TlsDestructors.values[i]; + if(ptr && callback) callback(ptr); + } + UnlockUIntMapRead(&TlsDestructors); +} + #else #include @@ -493,6 +446,8 @@ void alcall_once(alonce_flag *once, void (*callback)(void)) extern inline int althrd_sleep(const struct timespec *ts, struct timespec *rem); extern inline void alcall_once(alonce_flag *once, void (*callback)(void)); +extern inline void althrd_deinit(void); +extern inline void althrd_thread_detach(void); void althrd_setname(althrd_t thr, const char *name) { @@ -500,6 +455,8 @@ void althrd_setname(althrd_t thr, const char *name) #if defined(PTHREAD_SETNAME_NP_ONE_PARAM) if(althrd_equal(thr, althrd_current())) pthread_setname_np(name); +#elif defined(PTHREAD_SETNAME_NP_THREE_PARAMS) + pthread_setname_np(thr, "%s", (void*)name); #else pthread_setname_np(thr, name); #endif @@ -602,15 +559,9 @@ int almtx_init(almtx_t *mtx, int type) int ret; if(!mtx) return althrd_error; -#ifdef HAVE_PTHREAD_MUTEX_TIMEDLOCK - if((type&~(almtx_recursive|almtx_timed)) != 0) - return althrd_error; -#else if((type&~almtx_recursive) != 0) return althrd_error; -#endif - type &= ~almtx_timed; if(type == almtx_plain) ret = pthread_mutex_init(mtx, NULL); else @@ -642,20 +593,6 @@ void almtx_destroy(almtx_t *mtx) pthread_mutex_destroy(mtx); } -int almtx_timedlock(almtx_t *mtx, const struct timespec *ts) -{ -#ifdef HAVE_PTHREAD_MUTEX_TIMEDLOCK - int ret = pthread_mutex_timedlock(mtx, ts); - switch(ret) - { - case 0: return althrd_success; - case ETIMEDOUT: return althrd_timedout; - case EBUSY: return althrd_busy; - } -#endif - return althrd_error; -} - int alcnd_init(alcnd_t *cond) { if(pthread_cond_init(cond, NULL) == 0) @@ -684,16 +621,44 @@ int alcnd_wait(alcnd_t *cond, almtx_t *mtx) return althrd_error; } -int alcnd_timedwait(alcnd_t *cond, almtx_t *mtx, const struct timespec *time_point) +void alcnd_destroy(alcnd_t *cond) { - if(pthread_cond_timedwait(cond, mtx, time_point) == 0) + pthread_cond_destroy(cond); +} + + +int alsem_init(alsem_t *sem, unsigned int initial) +{ + if(sem_init(sem, 0, initial) == 0) return althrd_success; return althrd_error; } -void alcnd_destroy(alcnd_t *cond) +void alsem_destroy(alsem_t *sem) { - pthread_cond_destroy(cond); + sem_destroy(sem); +} + +int alsem_post(alsem_t *sem) +{ + if(sem_post(sem) == 0) + return althrd_success; + return althrd_error; +} + +int alsem_wait(alsem_t *sem) +{ + if(sem_wait(sem) == 0) return althrd_success; + if(errno == EINTR) return -2; + return althrd_error; +} + +int alsem_trywait(alsem_t *sem) +{ + if(sem_trywait(sem) == 0) return althrd_success; + if(errno == EWOULDBLOCK) return althrd_busy; + if(errno == EINTR) return -2; + return althrd_error; } diff --git a/Engine/lib/openal-soft/include/threads.h b/Engine/lib/openal-soft/common/threads.h similarity index 83% rename from Engine/lib/openal-soft/include/threads.h rename to Engine/lib/openal-soft/common/threads.h index c2848ee77..b0bebd8de 100644 --- a/Engine/lib/openal-soft/include/threads.h +++ b/Engine/lib/openal-soft/common/threads.h @@ -3,6 +3,16 @@ #include +#if defined(__GNUC__) && defined(__i386__) +/* force_align_arg_pointer is required for proper function arguments aligning + * when SSE code is used. Some systems (Windows, QNX) do not guarantee our + * thread functions will be properly aligned on the stack, even though GCC may + * generate code with the assumption that it is. */ +#define FORCE_ALIGN __attribute__((force_align_arg_pointer)) +#else +#define FORCE_ALIGN +#endif + #ifdef __cplusplus extern "C" { #endif @@ -18,7 +28,6 @@ enum { enum { almtx_plain = 0, almtx_recursive = 1, - almtx_timed = 2 }; typedef int (*althrd_start_t)(void*); @@ -47,6 +56,7 @@ typedef CONDITION_VARIABLE alcnd_t; #else typedef struct { void *Ptr; } alcnd_t; #endif +typedef HANDLE alsem_t; typedef DWORD altss_t; typedef LONG alonce_flag; @@ -55,6 +65,9 @@ typedef LONG alonce_flag; int althrd_sleep(const struct timespec *ts, struct timespec *rem); void alcall_once(alonce_flag *once, void (*callback)(void)); +void althrd_deinit(void); +void althrd_thread_detach(void); + inline althrd_t althrd_current(void) { @@ -117,11 +130,13 @@ inline int altss_set(altss_t tss_id, void *val) #include #include #include +#include typedef pthread_t althrd_t; typedef pthread_mutex_t almtx_t; typedef pthread_cond_t alcnd_t; +typedef sem_t alsem_t; typedef pthread_key_t altss_t; typedef pthread_once_t alonce_flag; @@ -204,6 +219,10 @@ inline void alcall_once(alonce_flag *once, void (*callback)(void)) pthread_once(once, callback); } + +inline void althrd_deinit(void) { } +inline void althrd_thread_detach(void) { } + #endif @@ -214,15 +233,19 @@ void althrd_setname(althrd_t thr, const char *name); int almtx_init(almtx_t *mtx, int type); void almtx_destroy(almtx_t *mtx); -int almtx_timedlock(almtx_t *mtx, const struct timespec *ts); int alcnd_init(alcnd_t *cond); int alcnd_signal(alcnd_t *cond); int alcnd_broadcast(alcnd_t *cond); int alcnd_wait(alcnd_t *cond, almtx_t *mtx); -int alcnd_timedwait(alcnd_t *cond, almtx_t *mtx, const struct timespec *time_point); void alcnd_destroy(alcnd_t *cond); +int alsem_init(alsem_t *sem, unsigned int initial); +void alsem_destroy(alsem_t *sem); +int alsem_post(alsem_t *sem); +int alsem_wait(alsem_t *sem); +int alsem_trywait(alsem_t *sem); + int altss_create(altss_t *tss_id, altss_dtor_t callback); void altss_delete(altss_t tss_id); diff --git a/Engine/lib/openal-soft/common/uintmap.c b/Engine/lib/openal-soft/common/uintmap.c index d3b519236..18d52d64b 100644 --- a/Engine/lib/openal-soft/common/uintmap.c +++ b/Engine/lib/openal-soft/common/uintmap.c @@ -43,24 +43,23 @@ ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value) WriteLock(&map->lock); if(map->size > 0) { - ALsizei low = 0; - ALsizei high = map->size - 1; - while(low < high) - { - ALsizei mid = low + (high-low)/2; - if(map->keys[mid] < key) - low = mid + 1; + ALsizei count = map->size; + do { + ALsizei step = count>>1; + ALsizei i = pos+step; + if(!(map->keys[i] < key)) + count = step; else - high = mid; - } - if(map->keys[low] < key) - low++; - pos = low; + { + pos = i+1; + count -= step+1; + } + } while(count > 0); } if(pos == map->size || map->keys[pos] != key) { - if(map->size == map->limit) + if(map->size >= map->limit) { WriteUnlock(&map->lock); return AL_OUT_OF_MEMORY; @@ -126,25 +125,28 @@ ALvoid *RemoveUIntMapKey(UIntMap *map, ALuint key) WriteLock(&map->lock); if(map->size > 0) { - ALsizei low = 0; - ALsizei high = map->size - 1; - while(low < high) - { - ALsizei mid = low + (high-low)/2; - if(map->keys[mid] < key) - low = mid + 1; + ALsizei pos = 0; + ALsizei count = map->size; + do { + ALsizei step = count>>1; + ALsizei i = pos+step; + if(!(map->keys[i] < key)) + count = step; else - high = mid; - } - if(map->keys[low] == key) - { - ptr = map->values[low]; - if(low < map->size-1) { - memmove(&map->keys[low], &map->keys[low+1], - (map->size-1-low)*sizeof(map->keys[0])); - memmove(&map->values[low], &map->values[low+1], - (map->size-1-low)*sizeof(map->values[0])); + pos = i+1; + count -= step+1; + } + } while(count > 0); + if(pos < map->size && map->keys[pos] == key) + { + ptr = map->values[pos]; + if(pos < map->size-1) + { + memmove(&map->keys[pos], &map->keys[pos+1], + (map->size-1-pos)*sizeof(map->keys[0])); + memmove(&map->values[pos], &map->values[pos+1], + (map->size-1-pos)*sizeof(map->values[0])); } map->size--; } @@ -153,76 +155,28 @@ ALvoid *RemoveUIntMapKey(UIntMap *map, ALuint key) return ptr; } -ALvoid *RemoveUIntMapKeyNoLock(UIntMap *map, ALuint key) -{ - if(map->size > 0) - { - ALsizei low = 0; - ALsizei high = map->size - 1; - while(low < high) - { - ALsizei mid = low + (high-low)/2; - if(map->keys[mid] < key) - low = mid + 1; - else - high = mid; - } - if(map->keys[low] == key) - { - ALvoid *ptr = map->values[low]; - if(low < map->size-1) - { - memmove(&map->keys[low], &map->keys[low+1], - (map->size-1-low)*sizeof(map->keys[0])); - memmove(&map->values[low], &map->values[low+1], - (map->size-1-low)*sizeof(map->values[0])); - } - map->size--; - return ptr; - } - } - return NULL; -} - ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key) { ALvoid *ptr = NULL; ReadLock(&map->lock); if(map->size > 0) { - ALsizei low = 0; - ALsizei high = map->size - 1; - while(low < high) - { - ALsizei mid = low + (high-low)/2; - if(map->keys[mid] < key) - low = mid + 1; + ALsizei pos = 0; + ALsizei count = map->size; + do { + ALsizei step = count>>1; + ALsizei i = pos+step; + if(!(map->keys[i] < key)) + count = step; else - high = mid; - } - if(map->keys[low] == key) - ptr = map->values[low]; + { + pos = i+1; + count -= step+1; + } + } while(count > 0); + if(pos < map->size && map->keys[pos] == key) + ptr = map->values[pos]; } ReadUnlock(&map->lock); return ptr; } - -ALvoid *LookupUIntMapKeyNoLock(UIntMap *map, ALuint key) -{ - if(map->size > 0) - { - ALsizei low = 0; - ALsizei high = map->size - 1; - while(low < high) - { - ALsizei mid = low + (high-low)/2; - if(map->keys[mid] < key) - low = mid + 1; - else - high = mid; - } - if(map->keys[low] == key) - return map->values[low]; - } - return NULL; -} diff --git a/Engine/lib/openal-soft/include/uintmap.h b/Engine/lib/openal-soft/common/uintmap.h similarity index 60% rename from Engine/lib/openal-soft/include/uintmap.h rename to Engine/lib/openal-soft/common/uintmap.h index acb2749af..32868653d 100644 --- a/Engine/lib/openal-soft/include/uintmap.h +++ b/Engine/lib/openal-soft/common/uintmap.h @@ -1,6 +1,8 @@ #ifndef AL_UINTMAP_H #define AL_UINTMAP_H +#include + #include "AL/al.h" #include "rwlock.h" @@ -19,24 +21,18 @@ typedef struct UIntMap { RWLock lock; } UIntMap; #define UINTMAP_STATIC_INITIALIZE_N(_n) { NULL, NULL, 0, 0, (_n), RWLOCK_STATIC_INITIALIZE } -#define UINTMAP_STATIC_INITIALIZE UINTMAP_STATIC_INITIALIZE_N(~0) +#define UINTMAP_STATIC_INITIALIZE UINTMAP_STATIC_INITIALIZE_N(INT_MAX) void InitUIntMap(UIntMap *map, ALsizei limit); void ResetUIntMap(UIntMap *map); ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value); ALvoid *RemoveUIntMapKey(UIntMap *map, ALuint key); -ALvoid *RemoveUIntMapKeyNoLock(UIntMap *map, ALuint key); ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key); -ALvoid *LookupUIntMapKeyNoLock(UIntMap *map, ALuint key); -inline void LockUIntMapRead(UIntMap *map) -{ ReadLock(&map->lock); } -inline void UnlockUIntMapRead(UIntMap *map) -{ ReadUnlock(&map->lock); } -inline void LockUIntMapWrite(UIntMap *map) -{ WriteLock(&map->lock); } -inline void UnlockUIntMapWrite(UIntMap *map) -{ WriteUnlock(&map->lock); } +inline void LockUIntMapRead(UIntMap *map) { ReadLock(&map->lock); } +inline void UnlockUIntMapRead(UIntMap *map) { ReadUnlock(&map->lock); } +inline void LockUIntMapWrite(UIntMap *map) { WriteLock(&map->lock); } +inline void UnlockUIntMapWrite(UIntMap *map) { WriteUnlock(&map->lock); } #ifdef __cplusplus } diff --git a/Engine/lib/openal-soft/common/win_main_utf8.h b/Engine/lib/openal-soft/common/win_main_utf8.h new file mode 100644 index 000000000..faddc2579 --- /dev/null +++ b/Engine/lib/openal-soft/common/win_main_utf8.h @@ -0,0 +1,97 @@ +#ifndef WIN_MAIN_UTF8_H +#define WIN_MAIN_UTF8_H + +/* For Windows systems this provides a way to get UTF-8 encoded argv strings, + * and also overrides fopen to accept UTF-8 filenames. Working with wmain + * directly complicates cross-platform compatibility, while normal main() in + * Windows uses the current codepage (which has limited availability of + * characters). + * + * For MinGW, you must link with -municode + */ +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#include + +static FILE *my_fopen(const char *fname, const char *mode) +{ + WCHAR *wname=NULL, *wmode=NULL; + int namelen, modelen; + FILE *file = NULL; + errno_t err; + + namelen = MultiByteToWideChar(CP_UTF8, 0, fname, -1, NULL, 0); + modelen = MultiByteToWideChar(CP_UTF8, 0, mode, -1, NULL, 0); + + if(namelen <= 0 || modelen <= 0) + { + fprintf(stderr, "Failed to convert UTF-8 fname \"%s\", mode \"%s\"\n", fname, mode); + return NULL; + } + + wname = calloc(sizeof(WCHAR), namelen+modelen); + wmode = wname + namelen; + MultiByteToWideChar(CP_UTF8, 0, fname, -1, wname, namelen); + MultiByteToWideChar(CP_UTF8, 0, mode, -1, wmode, modelen); + + err = _wfopen_s(&file, wname, wmode); + if(err) + { + errno = err; + file = NULL; + } + + free(wname); + + return file; +} +#define fopen my_fopen + + +static char **arglist; +static void cleanup_arglist(void) +{ + free(arglist); +} + +static void GetUnicodeArgs(int *argc, char ***argv) +{ + size_t total; + wchar_t **args; + int nargs, i; + + args = CommandLineToArgvW(GetCommandLineW(), &nargs); + if(!args) + { + fprintf(stderr, "Failed to get command line args: %ld\n", GetLastError()); + exit(EXIT_FAILURE); + } + + total = sizeof(**argv) * nargs; + for(i = 0;i < nargs;i++) + total += WideCharToMultiByte(CP_UTF8, 0, args[i], -1, NULL, 0, NULL, NULL); + + atexit(cleanup_arglist); + arglist = *argv = calloc(1, total); + (*argv)[0] = (char*)(*argv + nargs); + for(i = 0;i < nargs-1;i++) + { + int len = WideCharToMultiByte(CP_UTF8, 0, args[i], -1, (*argv)[i], 65535, NULL, NULL); + (*argv)[i+1] = (*argv)[i] + len; + } + WideCharToMultiByte(CP_UTF8, 0, args[i], -1, (*argv)[i], 65535, NULL, NULL); + *argc = nargs; + + LocalFree(args); +} +#define GET_UNICODE_ARGS(argc, argv) GetUnicodeArgs(argc, argv) + +#else + +/* Do nothing. */ +#define GET_UNICODE_ARGS(argc, argv) + +#endif + +#endif /* WIN_MAIN_UTF8_H */ diff --git a/Engine/lib/openal-soft/config.h.in b/Engine/lib/openal-soft/config.h.in index a06c2039a..1ff64fe47 100644 --- a/Engine/lib/openal-soft/config.h.in +++ b/Engine/lib/openal-soft/config.h.in @@ -2,18 +2,18 @@ #define AL_API ${EXPORT_DECL} #define ALC_API ${EXPORT_DECL} -/* Define to the library version */ -#define ALSOFT_VERSION "${LIB_VERSION}" - /* Define any available alignment declaration */ #define ALIGN(x) ${ALIGN_DECL} -/* Explicit hidden visibility attribute */ -#define HIDDEN_DECL ${HIDDEN_DECL} +/* Define a built-in call indicating an aligned data pointer */ +#define ASSUME_ALIGNED(x, y) ${ASSUME_ALIGNED_DECL} /* Define if HRTF data is embedded in the library */ #cmakedefine ALSOFT_EMBED_HRTF_DATA +/* Define if we have the sysconf function */ +#cmakedefine HAVE_SYSCONF + /* Define if we have the C11 aligned_alloc function */ #cmakedefine HAVE_ALIGNED_ALLOC @@ -23,6 +23,12 @@ /* Define if we have the _aligned_malloc function */ #cmakedefine HAVE__ALIGNED_MALLOC +/* Define if we have the proc_pidpath function */ +#cmakedefine HAVE_PROC_PIDPATH + +/* Define if we have the getopt function */ +#cmakedefine HAVE_GETOPT + /* Define if we have SSE CPU extensions */ #cmakedefine HAVE_SSE #cmakedefine HAVE_SSE2 @@ -47,8 +53,8 @@ /* Define if we have the QSA backend */ #cmakedefine HAVE_QSA -/* Define if we have the MMDevApi backend */ -#cmakedefine HAVE_MMDEVAPI +/* Define if we have the WASAPI backend */ +#cmakedefine HAVE_WASAPI /* Define if we have the DSound backend */ #cmakedefine HAVE_DSOUND @@ -74,6 +80,9 @@ /* Define if we have the Wave Writer backend */ #cmakedefine HAVE_WAVE +/* Define if we have the SDL2 backend */ +#cmakedefine HAVE_SDL2 + /* Define if we have the stat function */ #cmakedefine HAVE_STAT @@ -83,6 +92,12 @@ /* Define if we have the modff function */ #cmakedefine HAVE_MODFF +/* Define if we have the log2f function */ +#cmakedefine HAVE_LOG2F + +/* Define if we have the cbrtf function */ +#cmakedefine HAVE_CBRTF + /* Define if we have the strtof function */ #cmakedefine HAVE_STRTOF @@ -98,9 +113,6 @@ /* Define to the size of a long long int type */ #cmakedefine SIZEOF_LONG_LONG ${SIZEOF_LONG_LONG} -/* Define if we have C99 variable-length array support */ -#cmakedefine HAVE_C99_VLA - /* Define if we have C99 _Bool support */ #cmakedefine HAVE_C99_BOOL @@ -137,9 +149,6 @@ /* Define if we have pthread_np.h */ #cmakedefine HAVE_PTHREAD_NP_H -/* Define if we have alloca.h */ -#cmakedefine HAVE_ALLOCA_H - /* Define if we have malloc.h */ #cmakedefine HAVE_MALLOC_H @@ -179,6 +188,12 @@ /* Define if we have the __cpuid() intrinsic */ #cmakedefine HAVE_CPUID_INTRINSIC +/* Define if we have the _BitScanForward64() intrinsic */ +#cmakedefine HAVE_BITSCANFORWARD64_INTRINSIC + +/* Define if we have the _BitScanForward() intrinsic */ +#cmakedefine HAVE_BITSCANFORWARD_INTRINSIC + /* Define if we have _controlfp() */ #cmakedefine HAVE__CONTROLFP @@ -194,6 +209,9 @@ /* Define if pthread_setname_np() only accepts one parameter */ #cmakedefine PTHREAD_SETNAME_NP_ONE_PARAM +/* Define if pthread_setname_np() accepts three parameters */ +#cmakedefine PTHREAD_SETNAME_NP_THREE_PARAMS + /* Define if we have pthread_set_name_np() */ #cmakedefine HAVE_PTHREAD_SET_NAME_NP diff --git a/Engine/lib/openal-soft/include/AL/alext.h b/Engine/lib/openal-soft/include/AL/alext.h index 0090c8041..cd7f2750d 100644 --- a/Engine/lib/openal-soft/include/AL/alext.h +++ b/Engine/lib/openal-soft/include/AL/alext.h @@ -97,6 +97,31 @@ extern "C" { #ifndef AL_EXT_MCFORMATS #define AL_EXT_MCFORMATS 1 +/* Provides support for surround sound buffer formats with 8, 16, and 32-bit + * samples. + * + * QUAD8: Unsigned 8-bit, Quadraphonic (Front Left, Front Right, Rear Left, + * Rear Right). + * QUAD16: Signed 16-bit, Quadraphonic. + * QUAD32: 32-bit float, Quadraphonic. + * REAR8: Unsigned 8-bit, Rear Stereo (Rear Left, Rear Right). + * REAR16: Signed 16-bit, Rear Stereo. + * REAR32: 32-bit float, Rear Stereo. + * 51CHN8: Unsigned 8-bit, 5.1 Surround (Front Left, Front Right, Front Center, + * LFE, Side Left, Side Right). Note that some audio systems may label + * 5.1's Side channels as Rear or Surround; they are equivalent for the + * purposes of this extension. + * 51CHN16: Signed 16-bit, 5.1 Surround. + * 51CHN32: 32-bit float, 5.1 Surround. + * 61CHN8: Unsigned 8-bit, 6.1 Surround (Front Left, Front Right, Front Center, + * LFE, Rear Center, Side Left, Side Right). + * 61CHN16: Signed 16-bit, 6.1 Surround. + * 61CHN32: 32-bit float, 6.1 Surround. + * 71CHN8: Unsigned 8-bit, 7.1 Surround (Front Left, Front Right, Front Center, + * LFE, Rear Left, Rear Right, Side Left, Side Right). + * 71CHN16: Signed 16-bit, 7.1 Surround. + * 71CHN32: 32-bit float, 7.1 Surround. + */ #define AL_FORMAT_QUAD8 0x1204 #define AL_FORMAT_QUAD16 0x1205 #define AL_FORMAT_QUAD32 0x1206 @@ -395,6 +420,16 @@ ALC_API void ALC_APIENTRY alcDeviceResumeSOFT(ALCdevice *device); #ifndef AL_EXT_BFORMAT #define AL_EXT_BFORMAT 1 +/* Provides support for B-Format ambisonic buffers (first-order, FuMa scaling + * and layout). + * + * BFORMAT2D_8: Unsigned 8-bit, 3-channel non-periphonic (WXY). + * BFORMAT2D_16: Signed 16-bit, 3-channel non-periphonic (WXY). + * BFORMAT2D_FLOAT32: 32-bit float, 3-channel non-periphonic (WXY). + * BFORMAT3D_8: Unsigned 8-bit, 4-channel periphonic (WXYZ). + * BFORMAT3D_16: Signed 16-bit, 4-channel periphonic (WXYZ). + * BFORMAT3D_FLOAT32: 32-bit float, 4-channel periphonic (WXYZ). + */ #define AL_FORMAT_BFORMAT2D_8 0x20021 #define AL_FORMAT_BFORMAT2D_16 0x20022 #define AL_FORMAT_BFORMAT2D_FLOAT32 0x20023 @@ -436,6 +471,44 @@ ALC_API ALCboolean ALC_APIENTRY alcResetDeviceSOFT(ALCdevice *device, const ALCi #define AL_GAIN_LIMIT_SOFT 0x200E #endif +#ifndef AL_SOFT_source_resampler +#define AL_SOFT_source_resampler +#define AL_NUM_RESAMPLERS_SOFT 0x1210 +#define AL_DEFAULT_RESAMPLER_SOFT 0x1211 +#define AL_SOURCE_RESAMPLER_SOFT 0x1212 +#define AL_RESAMPLER_NAME_SOFT 0x1213 +typedef const ALchar* (AL_APIENTRY*LPALGETSTRINGISOFT)(ALenum pname, ALsizei index); +#ifdef AL_ALEXT_PROTOTYPES +AL_API const ALchar* AL_APIENTRY alGetStringiSOFT(ALenum pname, ALsizei index); +#endif +#endif + +#ifndef AL_SOFT_source_spatialize +#define AL_SOFT_source_spatialize +#define AL_SOURCE_SPATIALIZE_SOFT 0x1214 +#define AL_AUTO_SOFT 0x0002 +#endif + +#ifndef ALC_SOFT_output_limiter +#define ALC_SOFT_output_limiter +#define ALC_OUTPUT_LIMITER_SOFT 0x199A +#endif + +#ifndef ALC_SOFT_device_clock +#define ALC_SOFT_device_clock 1 +typedef int64_t ALCint64SOFT; +typedef uint64_t ALCuint64SOFT; +#define ALC_DEVICE_CLOCK_SOFT 0x1600 +#define ALC_DEVICE_LATENCY_SOFT 0x1601 +#define ALC_DEVICE_CLOCK_LATENCY_SOFT 0x1602 +#define AL_SAMPLE_OFFSET_CLOCK_SOFT 0x1202 +#define AL_SEC_OFFSET_CLOCK_SOFT 0x1203 +typedef void (ALC_APIENTRY*LPALCGETINTEGER64VSOFT)(ALCdevice *device, ALCenum pname, ALsizei size, ALCint64SOFT *values); +#ifdef AL_ALEXT_PROTOTYPES +ALC_API void ALC_APIENTRY alcGetInteger64vSOFT(ALCdevice *device, ALCenum pname, ALsizei size, ALCint64SOFT *values); +#endif +#endif + #ifdef __cplusplus } #endif diff --git a/Engine/lib/openal-soft/include/almalloc.h b/Engine/lib/openal-soft/include/almalloc.h deleted file mode 100644 index 355db7954..000000000 --- a/Engine/lib/openal-soft/include/almalloc.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef AL_MALLOC_H -#define AL_MALLOC_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -void *al_malloc(size_t alignment, size_t size); -void *al_calloc(size_t alignment, size_t size); -void al_free(void *ptr); - -#ifdef __cplusplus -} -#endif - -#endif /* AL_MALLOC_H */ diff --git a/Engine/lib/openal-soft/include/atomic.h b/Engine/lib/openal-soft/include/atomic.h deleted file mode 100644 index 2a996625a..000000000 --- a/Engine/lib/openal-soft/include/atomic.h +++ /dev/null @@ -1,317 +0,0 @@ -#ifndef AL_ATOMIC_H -#define AL_ATOMIC_H - -#include "static_assert.h" -#include "bool.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Atomics using C11 */ -#ifdef HAVE_C11_ATOMIC - -#include - -#define almemory_order memory_order -#define almemory_order_relaxed memory_order_relaxed -#define almemory_order_consume memory_order_consume -#define almemory_order_acquire memory_order_acquire -#define almemory_order_release memory_order_release -#define almemory_order_acq_rel memory_order_acq_rel -#define almemory_order_seq_cst memory_order_seq_cst - -#define ATOMIC(T) T _Atomic - -#define ATOMIC_INIT(_val, _newval) atomic_init((_val), (_newval)) -#define ATOMIC_INIT_STATIC(_newval) ATOMIC_VAR_INIT(_newval) - -#define PARAM2(f, a, b, ...) (f((a), (b))) -#define PARAM3(f, a, b, c, ...) (f((a), (b), (c))) -#define PARAM5(f, a, b, c, d, e, ...) (f((a), (b), (c), (d), (e))) - -#define ATOMIC_LOAD(...) PARAM2(atomic_load_explicit, __VA_ARGS__, memory_order_seq_cst) -#define ATOMIC_STORE(...) PARAM3(atomic_store_explicit, __VA_ARGS__, memory_order_seq_cst) - -#define ATOMIC_ADD(T, ...) PARAM3(atomic_fetch_add_explicit, __VA_ARGS__, memory_order_seq_cst) -#define ATOMIC_SUB(T, ...) PARAM3(atomic_fetch_sub_explicit, __VA_ARGS__, memory_order_seq_cst) - -#define ATOMIC_EXCHANGE(T, ...) PARAM3(atomic_exchange_explicit, __VA_ARGS__, memory_order_seq_cst) -#define ATOMIC_COMPARE_EXCHANGE_STRONG(T, ...) \ - PARAM5(atomic_compare_exchange_strong_explicit, __VA_ARGS__, memory_order_seq_cst, memory_order_seq_cst) -#define ATOMIC_COMPARE_EXCHANGE_WEAK(T, ...) \ - PARAM5(atomic_compare_exchange_weak_explicit, __VA_ARGS__, memory_order_seq_cst, memory_order_seq_cst) - -/* Atomics using GCC intrinsics */ -#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)) && !defined(__QNXNTO__) - -enum almemory_order { - almemory_order_relaxed, - almemory_order_consume, - almemory_order_acquire, - almemory_order_release, - almemory_order_acq_rel, - almemory_order_seq_cst -}; - -#define ATOMIC(T) struct { T volatile value; } - -#define ATOMIC_INIT(_val, _newval) do { (_val)->value = (_newval); } while(0) -#define ATOMIC_INIT_STATIC(_newval) {(_newval)} - -#define ATOMIC_LOAD(_val, ...) __extension__({ \ - __typeof((_val)->value) _r = (_val)->value; \ - __asm__ __volatile__("" ::: "memory"); \ - _r; \ -}) -#define ATOMIC_STORE(_val, _newval, ...) do { \ - __asm__ __volatile__("" ::: "memory"); \ - (_val)->value = (_newval); \ -} while(0) - -#define ATOMIC_ADD(T, _val, _incr, ...) __extension__({ \ - static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \ - __sync_fetch_and_add(&(_val)->value, (_incr)); \ -}) -#define ATOMIC_SUB(T, _val, _decr, ...) __extension__({ \ - static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \ - __sync_fetch_and_sub(&(_val)->value, (_decr)); \ -}) - -#define ATOMIC_EXCHANGE(T, _val, _newval, ...) __extension__({ \ - static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \ - __sync_lock_test_and_set(&(_val)->value, (_newval)); \ -}) -#define ATOMIC_COMPARE_EXCHANGE_STRONG(T, _val, _oldval, _newval, ...) __extension__({ \ - static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \ - T _o = *(_oldval); \ - *(_oldval) = __sync_val_compare_and_swap(&(_val)->value, _o, (_newval)); \ - *(_oldval) == _o; \ -}) - -/* Atomics using x86/x86-64 GCC inline assembly */ -#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) - -#define WRAP_ADD(ret, dest, incr) __asm__ __volatile__( \ - "lock; xaddl %0,(%1)" \ - : "=r" (ret) \ - : "r" (dest), "0" (incr) \ - : "memory" \ -) -#define WRAP_SUB(ret, dest, decr) __asm__ __volatile__( \ - "lock; xaddl %0,(%1)" \ - : "=r" (ret) \ - : "r" (dest), "0" (-(decr)) \ - : "memory" \ -) - -#define WRAP_XCHG(S, ret, dest, newval) __asm__ __volatile__( \ - "lock; xchg"S" %0,(%1)" \ - : "=r" (ret) \ - : "r" (dest), "0" (newval) \ - : "memory" \ -) -#define WRAP_CMPXCHG(S, ret, dest, oldval, newval) __asm__ __volatile__( \ - "lock; cmpxchg"S" %2,(%1)" \ - : "=a" (ret) \ - : "r" (dest), "r" (newval), "0" (oldval) \ - : "memory" \ -) - - -enum almemory_order { - almemory_order_relaxed, - almemory_order_consume, - almemory_order_acquire, - almemory_order_release, - almemory_order_acq_rel, - almemory_order_seq_cst -}; - -#define ATOMIC(T) struct { T volatile value; } - -#define ATOMIC_INIT(_val, _newval) do { (_val)->value = (_newval); } while(0) -#define ATOMIC_INIT_STATIC(_newval) {(_newval)} - -#define ATOMIC_LOAD(_val, ...) __extension__({ \ - __typeof((_val)->value) _r = (_val)->value; \ - __asm__ __volatile__("" ::: "memory"); \ - _r; \ -}) -#define ATOMIC_STORE(_val, _newval, ...) do { \ - __asm__ __volatile__("" ::: "memory"); \ - (_val)->value = (_newval); \ -} while(0) - -#define ATOMIC_ADD(T, _val, _incr, ...) __extension__({ \ - static_assert(sizeof(T)==4, "Type "#T" has incorrect size!"); \ - static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \ - T _r; \ - WRAP_ADD(_r, &(_val)->value, (T)(_incr)); \ - _r; \ -}) -#define ATOMIC_SUB(T, _val, _decr, ...) __extension__({ \ - static_assert(sizeof(T)==4, "Type "#T" has incorrect size!"); \ - static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \ - T _r; \ - WRAP_SUB(_r, &(_val)->value, (T)(_decr)); \ - _r; \ -}) - -#define ATOMIC_EXCHANGE(T, _val, _newval, ...) __extension__({ \ - static_assert(sizeof(T)==4 || sizeof(T)==8, "Type "#T" has incorrect size!"); \ - static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \ - T _r; \ - if(sizeof(T) == 4) WRAP_XCHG("l", _r, &(_val)->value, (T)(_newval)); \ - else if(sizeof(T) == 8) WRAP_XCHG("q", _r, &(_val)->value, (T)(_newval)); \ - _r; \ -}) -#define ATOMIC_COMPARE_EXCHANGE_STRONG(T, _val, _oldval, _newval, ...) __extension__({ \ - static_assert(sizeof(T)==4 || sizeof(T)==8, "Type "#T" has incorrect size!"); \ - static_assert(sizeof(T)==sizeof((_val)->value), "Type "#T" has incorrect size!"); \ - T _old = *(_oldval); \ - if(sizeof(T) == 4) WRAP_CMPXCHG("l", *(_oldval), &(_val)->value, _old, (T)(_newval)); \ - else if(sizeof(T) == 8) WRAP_CMPXCHG("q", *(_oldval), &(_val)->value, _old, (T)(_newval)); \ - *(_oldval) == _old; \ -}) - -/* Atomics using Windows methods */ -#elif defined(_WIN32) - -#define WIN32_LEAN_AND_MEAN -#include - -/* NOTE: This mess is *extremely* noisy, at least on GCC. It works by wrapping - * Windows' 32-bit and 64-bit atomic methods, which are then casted to use the - * given type based on its size (e.g. int and float use 32-bit atomics). This - * is fine for the swap and compare-and-swap methods, although the add and - * subtract methods only work properly for integer types. - * - * Despite how noisy it is, it's unfortunately the only way that doesn't rely - * on C99 (damn MSVC). - */ - -inline LONG AtomicAdd32(volatile LONG *dest, LONG incr) -{ - return InterlockedExchangeAdd(dest, incr); -} -inline LONG AtomicSub32(volatile LONG *dest, LONG decr) -{ - return InterlockedExchangeAdd(dest, -decr); -} - -inline LONG AtomicSwap32(volatile LONG *dest, LONG newval) -{ - return InterlockedExchange(dest, newval); -} -inline LONGLONG AtomicSwap64(volatile LONGLONG *dest, LONGLONG newval) -{ - return InterlockedExchange64(dest, newval); -} - -inline bool CompareAndSwap32(volatile LONG *dest, LONG newval, LONG *oldval) -{ - LONG old = *oldval; - *oldval = InterlockedCompareExchange(dest, newval, *oldval); - return old == *oldval; -} -inline bool CompareAndSwap64(volatile LONGLONG *dest, LONGLONG newval, LONGLONG *oldval) -{ - LONGLONG old = *oldval; - *oldval = InterlockedCompareExchange64(dest, newval, *oldval); - return old == *oldval; -} - -#define WRAP_ADDSUB(T, _func, _ptr, _amnt) ((T(*)(T volatile*,T))_func)((_ptr), (_amnt)) -#define WRAP_XCHG(T, _func, _ptr, _newval) ((T(*)(T volatile*,T))_func)((_ptr), (_newval)) -#define WRAP_CMPXCHG(T, _func, _ptr, _newval, _oldval) ((bool(*)(T volatile*,T,T*))_func)((_ptr), (_newval), (_oldval)) - - -enum almemory_order { - almemory_order_relaxed, - almemory_order_consume, - almemory_order_acquire, - almemory_order_release, - almemory_order_acq_rel, - almemory_order_seq_cst -}; - -#define ATOMIC(T) struct { T volatile value; } - -#define ATOMIC_INIT(_val, _newval) do { (_val)->value = (_newval); } while(0) -#define ATOMIC_INIT_STATIC(_newval) {(_newval)} - -#define ATOMIC_LOAD(_val, ...) ((_val)->value) -#define ATOMIC_STORE(_val, _newval, ...) do { \ - (_val)->value = (_newval); \ -} while(0) - -int _al_invalid_atomic_size(); /* not defined */ - -#define ATOMIC_ADD(T, _val, _incr, ...) \ - ((sizeof(T)==4) ? WRAP_ADDSUB(T, AtomicAdd32, &(_val)->value, (_incr)) : \ - (T)_al_invalid_atomic_size()) -#define ATOMIC_SUB(T, _val, _decr, ...) \ - ((sizeof(T)==4) ? WRAP_ADDSUB(T, AtomicSub32, &(_val)->value, (_decr)) : \ - (T)_al_invalid_atomic_size()) - -#define ATOMIC_EXCHANGE(T, _val, _newval, ...) \ - ((sizeof(T)==4) ? WRAP_XCHG(T, AtomicSwap32, &(_val)->value, (_newval)) : \ - (sizeof(T)==8) ? WRAP_XCHG(T, AtomicSwap64, &(_val)->value, (_newval)) : \ - (T)_al_invalid_atomic_size()) -#define ATOMIC_COMPARE_EXCHANGE_STRONG(T, _val, _oldval, _newval, ...) \ - ((sizeof(T)==4) ? WRAP_CMPXCHG(T, CompareAndSwap32, &(_val)->value, (_newval), (_oldval)) : \ - (sizeof(T)==8) ? WRAP_CMPXCHG(T, CompareAndSwap64, &(_val)->value, (_newval), (_oldval)) : \ - (bool)_al_invalid_atomic_size()) - -#else - -#error "No atomic functions available on this platform!" - -#define ATOMIC(T) T - -#define ATOMIC_INIT_STATIC(_newval) (0) - -#define ATOMIC_LOAD_UNSAFE(_val) (0) -#define ATOMIC_STORE_UNSAFE(_val, _newval) ((void)0) - -#define ATOMIC_LOAD(_val, ...) (0) -#define ATOMIC_STORE(_val, _newval, ...) ((void)0) - -#define ATOMIC_ADD(T, _val, _incr, ...) (0) -#define ATOMIC_SUB(T, _val, _decr, ...) (0) - -#define ATOMIC_EXCHANGE(T, _val, _newval, ...) (0) -#define ATOMIC_COMPARE_EXCHANGE_STRONG(T, _val, _oldval, _newval, ...) (0) -#endif - -/* If no weak cmpxchg is provided (not all systems will have one), substitute a - * strong cmpxchg. */ -#ifndef ATOMIC_COMPARE_EXCHANGE_WEAK -#define ATOMIC_COMPARE_EXCHANGE_WEAK ATOMIC_COMPARE_EXCHANGE_STRONG -#endif - - -typedef unsigned int uint; -typedef ATOMIC(uint) RefCount; - -inline void InitRef(RefCount *ptr, uint value) -{ ATOMIC_INIT(ptr, value); } -inline uint ReadRef(RefCount *ptr) -{ return ATOMIC_LOAD(ptr); } -inline uint IncrementRef(RefCount *ptr) -{ return ATOMIC_ADD(uint, ptr, 1)+1; } -inline uint DecrementRef(RefCount *ptr) -{ return ATOMIC_SUB(uint, ptr, 1)-1; } - - -/* This is *NOT* atomic, but is a handy utility macro to compare-and-swap non- - * atomic variables. */ -#define COMPARE_EXCHANGE(_val, _oldval, _newval) ((*(_val) == *(_oldval)) ? ((*(_val)=(_newval)),true) : ((*(_oldval)=*(_val)),false)) - - -#ifdef __cplusplus -} -#endif - -#endif /* AL_ATOMIC_H */ diff --git a/Engine/lib/openal-soft/include/math_defs.h b/Engine/lib/openal-soft/include/math_defs.h deleted file mode 100644 index 149cf80ba..000000000 --- a/Engine/lib/openal-soft/include/math_defs.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef AL_MATH_DEFS_H -#define AL_MATH_DEFS_H - -#ifdef HAVE_FLOAT_H -#include -#endif - -#define F_PI (3.14159265358979323846f) -#define F_PI_2 (1.57079632679489661923f) -#define F_TAU (6.28318530717958647692f) - -#ifndef FLT_EPSILON -#define FLT_EPSILON (1.19209290e-07f) -#endif - -#define DEG2RAD(x) ((ALfloat)(x) * (F_PI/180.0f)) -#define RAD2DEG(x) ((ALfloat)(x) * (180.0f/F_PI)) - -#endif /* AL_MATH_DEFS_H */ diff --git a/Engine/lib/openal-soft/native-tools/CMakeLists.txt b/Engine/lib/openal-soft/native-tools/CMakeLists.txt new file mode 100644 index 000000000..5e816bba7 --- /dev/null +++ b/Engine/lib/openal-soft/native-tools/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.0.2) + +project(native-tools) + +include(CheckLibraryExists) + +set(CPP_DEFS ) +if(WIN32) + set(CPP_DEFS ${CPP_DEFS} _WIN32) +endif(WIN32) + +check_library_exists(m pow "" HAVE_LIBM) + +add_executable(bin2h bin2h.c) +# Enforce no dressing for executable names, so the main script can find it +set_target_properties(bin2h PROPERTIES OUTPUT_NAME bin2h) +# Avoid configuration-dependent subdirectories while building with Visual Studio +set_target_properties(bin2h PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}") +set_target_properties(bin2h PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}") +target_compile_definitions(bin2h PRIVATE ${CPP_DEFS}) + +add_executable(bsincgen bsincgen.c) +set_target_properties(bsincgen PROPERTIES OUTPUT_NAME bsincgen) +set_target_properties(bsincgen PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_BINARY_DIR}") +set_target_properties(bsincgen PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_BINARY_DIR}") +target_compile_definitions(bsincgen PRIVATE ${CPP_DEFS}) +if(HAVE_LIBM) + target_link_libraries(bsincgen m) +endif(HAVE_LIBM) diff --git a/Engine/lib/openal-soft/native-tools/bin2h.c b/Engine/lib/openal-soft/native-tools/bin2h.c new file mode 100644 index 000000000..92f2b8a51 --- /dev/null +++ b/Engine/lib/openal-soft/native-tools/bin2h.c @@ -0,0 +1,100 @@ + +#ifdef _MSC_VER +#define _CRT_SECURE_NO_WARNINGS +#endif + +#include +#include +#include +#include + +int main (int argc, char *argv[]) +{ + char* input_name; + FILE* input_file; + + char* output_name; + FILE* output_file; + + char* variable_name; + + if (4 != argc) + { + puts("Usage: bin2h [input] [output] [variable]"); + return EXIT_FAILURE; + } + + input_name = argv[1]; + output_name = argv[2]; + variable_name = argv[3]; + + input_file = fopen(input_name, "rb"); + + if (NULL == input_file) + { + printf("Could not open input file '%s': %s\n", input_name, strerror(errno)); + return EXIT_FAILURE; + } + + output_file = fopen(output_name, "w"); + + if (NULL == output_file) + { + printf("Could not open output file '%s': %s\n", output_name, strerror(errno)); + return EXIT_FAILURE; + } + + if (fprintf(output_file, "static const unsigned char %s[] = {", variable_name) < 0) + { + printf("Could not write to output file '%s': %s\n", output_name, strerror(ferror(output_file))); + return EXIT_FAILURE; + } + + while (0 == feof(input_file)) + { + unsigned char buffer[4096]; + size_t i, count = fread(buffer, 1, sizeof(buffer), input_file); + + if (sizeof(buffer) != count) + { + if (0 == feof(input_file) || 0 != ferror(input_file)) + { + printf("Could not read from input file '%s': %s\n", input_name, strerror(ferror(input_file))); + return EXIT_FAILURE; + } + } + + for (i = 0; i < count; ++i) + { + if ((i & 15) == 0) + { + if (fprintf(output_file, "\n ") < 0) + { + printf("Could not write to output file '%s': %s\n", output_name, strerror(ferror(output_file))); + return EXIT_FAILURE; + } + } + + if (fprintf(output_file, "0x%2.2x, ", buffer[i]) < 0) + { + printf("Could not write to output file '%s': %s\n", output_name, strerror(ferror(output_file))); + return EXIT_FAILURE; + } + + } + } + + if (fprintf(output_file, "\n};\n") < 0) + { + printf("Could not write to output file '%s': %s\n", output_name, strerror(ferror(output_file))); + return EXIT_FAILURE; + } + + if (fclose(output_file) < 0) + { + printf("Could not close output file '%s': %s\n", output_name, strerror(ferror(output_file))); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/Engine/lib/openal-soft/native-tools/bsincgen.c b/Engine/lib/openal-soft/native-tools/bsincgen.c new file mode 100644 index 000000000..7edf37f14 --- /dev/null +++ b/Engine/lib/openal-soft/native-tools/bsincgen.c @@ -0,0 +1,367 @@ +/* + * Sinc interpolator coefficient and delta generator for the OpenAL Soft + * cross platform audio library. + * + * Copyright (C) 2015 by Christopher Fitzgerald. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + * + * Or visit: http://www.gnu.org/licenses/old-licenses/lgpl-2.0.html + * + * -------------------------------------------------------------------------- + * + * This is a modified version of the bandlimited windowed sinc interpolator + * algorithm presented here: + * + * Smith, J.O. "Windowed Sinc Interpolation", in + * Physical Audio Signal Processing, + * https://ccrma.stanford.edu/~jos/pasp/Windowed_Sinc_Interpolation.html, + * online book, + * accessed October 2012. + */ + +#define _UNICODE +#include +#include +#include +#include + +#include "../common/win_main_utf8.h" + + +#ifndef M_PI +#define M_PI (3.14159265358979323846) +#endif + +#if !(defined(_ISOC99_SOURCE) || (defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE >= 200112L)) +#define log2(x) (log(x) / log(2.0)) +#endif + +/* Same as in alu.h! */ +#define FRACTIONBITS (12) +#define FRACTIONONE (1<= b) ? a : b; } + +/* NOTE: This is the normalized (instead of just sin(x)/x) cardinal sine + * function. + * 2 f_t sinc(2 f_t x) + * f_t -- normalized transition frequency (0.5 is nyquist) + * x -- sample index (-N to N) + */ +static double Sinc(const double x) +{ + if(fabs(x) < 1e-15) + return 1.0; + return sin(M_PI * x) / (M_PI * x); +} + +static double BesselI_0(const double x) +{ + double term, sum, last_sum, x2, y; + int i; + + term = 1.0; + sum = 1.0; + x2 = x / 2.0; + i = 1; + + do { + y = x2 / i; + i++; + last_sum = sum; + term *= y * y; + sum += term; + } while(sum != last_sum); + + return sum; +} + +/* NOTE: k is assumed normalized (-1 to 1) + * beta is equivalent to 2 alpha + */ +static double Kaiser(const double b, const double k) +{ + if(!(k >= -1.0 && k <= 1.0)) + return 0.0; + return BesselI_0(b * sqrt(1.0 - k*k)) / BesselI_0(b); +} + +/* Calculates the (normalized frequency) transition width of the Kaiser window. + * Rejection is in dB. + */ +static double CalcKaiserWidth(const double rejection, const int order) +{ + double w_t = 2.0 * M_PI; + + if(rejection > 21.0) + return (rejection - 7.95) / (order * 2.285 * w_t); + /* This enforces a minimum rejection of just above 21.18dB */ + return 5.79 / (order * w_t); +} + +static double CalcKaiserBeta(const double rejection) +{ + if(rejection > 50.0) + return 0.1102 * (rejection - 8.7); + else if(rejection >= 21.0) + return (0.5842 * pow(rejection - 21.0, 0.4)) + + (0.07886 * (rejection - 21.0)); + return 0.0; +} + +/* Generates the coefficient, delta, and index tables required by the bsinc resampler */ +static void BsiGenerateTables(FILE *output, const char *tabname, const double rejection, const int order) +{ + static double filter[BSINC_SCALE_COUNT][BSINC_PHASE_COUNT + 1][BSINC_POINTS_MAX]; + static double scDeltas[BSINC_SCALE_COUNT][BSINC_PHASE_COUNT ][BSINC_POINTS_MAX]; + static double phDeltas[BSINC_SCALE_COUNT][BSINC_PHASE_COUNT + 1][BSINC_POINTS_MAX]; + static double spDeltas[BSINC_SCALE_COUNT][BSINC_PHASE_COUNT ][BSINC_POINTS_MAX]; + static int mt[BSINC_SCALE_COUNT]; + static double at[BSINC_SCALE_COUNT]; + const int num_points_min = order + 1; + double width, beta, scaleBase, scaleRange; + int si, pi, i; + + memset(filter, 0, sizeof(filter)); + memset(scDeltas, 0, sizeof(scDeltas)); + memset(phDeltas, 0, sizeof(phDeltas)); + memset(spDeltas, 0, sizeof(spDeltas)); + + /* Calculate windowing parameters. The width describes the transition + band, but it may vary due to the linear interpolation between scales + of the filter. + */ + width = CalcKaiserWidth(rejection, order); + beta = CalcKaiserBeta(rejection); + scaleBase = width / 2.0; + scaleRange = 1.0 - scaleBase; + + // Determine filter scaling. + for(si = 0; si < BSINC_SCALE_COUNT; si++) + { + const double scale = scaleBase + (scaleRange * si / (BSINC_SCALE_COUNT - 1)); + const double a = MinDouble(floor(num_points_min / (2.0 * scale)), num_points_min); + const int m = 2 * (int)a; + + mt[si] = m; + at[si] = a; + } + + /* Calculate the Kaiser-windowed Sinc filter coefficients for each scale + and phase. + */ + for(si = 0; si < BSINC_SCALE_COUNT; si++) + { + const int m = mt[si]; + const int o = num_points_min - (m / 2); + const int l = (m / 2) - 1; + const double a = at[si]; + const double scale = scaleBase + (scaleRange * si / (BSINC_SCALE_COUNT - 1)); + const double cutoff = (0.5 * scale) - (scaleBase * MaxDouble(0.5, scale)); + + for(pi = 0; pi <= BSINC_PHASE_COUNT; pi++) + { + const double phase = l + ((double)pi / BSINC_PHASE_COUNT); + + for(i = 0; i < m; i++) + { + const double x = i - phase; + filter[si][pi][o + i] = Kaiser(beta, x / a) * 2.0 * cutoff * Sinc(2.0 * cutoff * x); + } + } + } + + /* Linear interpolation between scales is simplified by pre-calculating + the delta (b - a) in: x = a + f (b - a) + + Given a difference in points between scales, the destination points + will be 0, thus: x = a + f (-a) + */ + for(si = 0; si < (BSINC_SCALE_COUNT - 1); si++) + { + const int m = mt[si]; + const int o = num_points_min - (m / 2); + + for(pi = 0; pi < BSINC_PHASE_COUNT; pi++) + { + for(i = 0; i < m; i++) + scDeltas[si][pi][o + i] = filter[si + 1][pi][o + i] - filter[si][pi][o + i]; + } + } + + // Linear interpolation between phases is also simplified. + for(si = 0; si < BSINC_SCALE_COUNT; si++) + { + const int m = mt[si]; + const int o = num_points_min - (m / 2); + + for(pi = 0; pi < BSINC_PHASE_COUNT; pi++) + { + for(i = 0; i < m; i++) + phDeltas[si][pi][o + i] = filter[si][pi + 1][o + i] - filter[si][pi][o + i]; + } + } + + /* This last simplification is done to complete the bilinear equation for + the combination of scale and phase. + */ + for(si = 0; si < (BSINC_SCALE_COUNT - 1); si++) + { + const int m = mt[si]; + const int o = num_points_min - (m / 2); + + for(pi = 0; pi < BSINC_PHASE_COUNT; pi++) + { + for(i = 0; i < m; i++) + spDeltas[si][pi][o + i] = phDeltas[si + 1][pi][o + i] - phDeltas[si][pi][o + i]; + } + } + + // Make sure the number of points is a multiple of 4 (for SIMD). + for(si = 0; si < BSINC_SCALE_COUNT; si++) + mt[si] = (mt[si]+3) & ~3; + + fprintf(output, +"/* This %d%s order filter has a rejection of -%.0fdB, yielding a transition width\n" +" * of ~%.3f (normalized frequency). Order increases when downsampling to a\n" +" * limit of one octave, after which the quality of the filter (transition\n" +" * width) suffers to reduce the CPU cost. The bandlimiting will cut all sound\n" +" * after downsampling by ~%.2f octaves.\n" +" */\n" +"const BSincTable %s = {\n", + order, (((order%100)/10) == 1) ? "th" : + ((order%10) == 1) ? "st" : + ((order%10) == 2) ? "nd" : + ((order%10) == 3) ? "rd" : "th", + rejection, width, log2(1.0/scaleBase), tabname); + + /* The scaleBase is calculated from the Kaiser window transition width. + It represents the absolute limit to the filter before it fully cuts + the signal. The limit in octaves can be calculated by taking the + base-2 logarithm of its inverse: log_2(1 / scaleBase) + */ + fprintf(output, " /* scaleBase */ %.9ef, /* scaleRange */ %.9ef,\n", scaleBase, 1.0 / scaleRange); + + fprintf(output, " /* m */ {"); + fprintf(output, " %d", mt[0]); + for(si = 1; si < BSINC_SCALE_COUNT; si++) + fprintf(output, ", %d", mt[si]); + fprintf(output, " },\n"); + + fprintf(output, " /* filterOffset */ {"); + fprintf(output, " %d", 0); + i = mt[0]*4*BSINC_PHASE_COUNT; + for(si = 1; si < BSINC_SCALE_COUNT; si++) + { + fprintf(output, ", %d", i); + i += mt[si]*4*BSINC_PHASE_COUNT; + } + + fprintf(output, " },\n"); + + // Calculate the table size. + i = 0; + for(si = 0; si < BSINC_SCALE_COUNT; si++) + i += 4 * BSINC_PHASE_COUNT * mt[si]; + + fprintf(output, "\n /* Tab (%d entries) */ {\n", i); + for(si = 0; si < BSINC_SCALE_COUNT; si++) + { + const int m = mt[si]; + const int o = num_points_min - (m / 2); + + for(pi = 0; pi < BSINC_PHASE_COUNT; pi++) + { + fprintf(output, " /* %2d,%2d (%d) */", si, pi, m); + fprintf(output, "\n "); + for(i = 0; i < m; i++) + fprintf(output, " %+14.9ef,", filter[si][pi][o + i]); + fprintf(output, "\n "); + for(i = 0; i < m; i++) + fprintf(output, " %+14.9ef,", scDeltas[si][pi][o + i]); + fprintf(output, "\n "); + for(i = 0; i < m; i++) + fprintf(output, " %+14.9ef,", phDeltas[si][pi][o + i]); + fprintf(output, "\n "); + for(i = 0; i < m; i++) + fprintf(output, " %+14.9ef,", spDeltas[si][pi][o + i]); + fprintf(output, "\n"); + } + } + fprintf(output, " }\n};\n\n"); +} + + +int main(int argc, char *argv[]) +{ + FILE *output; + + GET_UNICODE_ARGS(&argc, &argv); + + if(argc > 2) + { + fprintf(stderr, "Usage: %s [output file]\n", argv[0]); + return 1; + } + + if(argc == 2) + { + output = fopen(argv[1], "wb"); + if(!output) + { + fprintf(stderr, "Failed to open %s for writing\n", argv[1]); + return 1; + } + } + else + output = stdout; + + fprintf(output, "/* Generated by bsincgen, do not edit! */\n\n" +"static_assert(BSINC_SCALE_COUNT == %d, \"Unexpected BSINC_SCALE_COUNT value!\");\n" +"static_assert(BSINC_PHASE_COUNT == %d, \"Unexpected BSINC_PHASE_COUNT value!\");\n" +"static_assert(FRACTIONONE == %d, \"Unexpected FRACTIONONE value!\");\n\n" +"typedef struct BSincTable {\n" +" const float scaleBase, scaleRange;\n" +" const int m[BSINC_SCALE_COUNT];\n" +" const int filterOffset[BSINC_SCALE_COUNT];\n" +" alignas(16) const float Tab[];\n" +"} BSincTable;\n\n", BSINC_SCALE_COUNT, BSINC_PHASE_COUNT, FRACTIONONE); + /* A 23rd order filter with a -60dB drop at nyquist. */ + BsiGenerateTables(output, "bsinc24", 60.0, 23); + /* An 11th order filter with a -40dB drop at nyquist. */ + BsiGenerateTables(output, "bsinc12", 40.0, 11); + + if(output != stdout) + fclose(output); + output = NULL; + + return 0; +} diff --git a/Engine/lib/openal-soft/openal.pc.in b/Engine/lib/openal-soft/openal.pc.in index 8bdd4f3b1..dfa6f5738 100644 --- a/Engine/lib/openal-soft/openal.pc.in +++ b/Engine/lib/openal-soft/openal.pc.in @@ -8,4 +8,5 @@ Description: OpenAL is a cross-platform 3D audio API Requires: @PKG_CONFIG_REQUIRES@ Version: @PACKAGE_VERSION@ Libs: -L${libdir} -l@LIBNAME@ @PKG_CONFIG_LIBS@ +Libs.private:@PKG_CONFIG_PRIVATE_LIBS@ Cflags: -I${includedir} -I${includedir}/AL @PKG_CONFIG_CFLAGS@ diff --git a/Engine/lib/openal-soft/version.cmake b/Engine/lib/openal-soft/version.cmake new file mode 100644 index 000000000..af7ff0a67 --- /dev/null +++ b/Engine/lib/openal-soft/version.cmake @@ -0,0 +1,11 @@ +EXECUTE_PROCESS( + COMMAND ${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD + OUTPUT_VARIABLE GIT_BRANCH + OUTPUT_STRIP_TRAILING_WHITESPACE +) +EXECUTE_PROCESS( + COMMAND ${GIT_EXECUTABLE} log -1 --format=%h + OUTPUT_VARIABLE GIT_COMMIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE +) +CONFIGURE_FILE(${SRC} ${DST}) diff --git a/Engine/lib/openal-soft/version.h.in b/Engine/lib/openal-soft/version.h.in new file mode 100644 index 000000000..56f738a39 --- /dev/null +++ b/Engine/lib/openal-soft/version.h.in @@ -0,0 +1,8 @@ +/* Define to the library version */ +#define ALSOFT_VERSION "${LIB_VERSION}" + +/* Define the branch being built */ +#define ALSOFT_GIT_BRANCH "${GIT_BRANCH}" + +/* Define the hash of the head commit */ +#define ALSOFT_GIT_COMMIT_HASH "${GIT_COMMIT_HASH}" diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index d746913fb..07d56a9b9 100644 --- a/Tools/CMake/torque3d.cmake +++ b/Tools/CMake/torque3d.cmake @@ -118,6 +118,14 @@ if(TORQUE_SFX_OPENAL) mark_as_advanced(COREAUDIO_FRAMEWORK) mark_as_advanced(CMAKE_DEBUG_POSTFIX) mark_as_advanced(FORCE_STATIC_VCRT) + mark_as_advanced(ALSOFT_BACKEND_WASAPI) + mark_as_advanced(ALSOFT_BUILD_ROUTER) + mark_as_advanced(ALSOFT_REQUIRE_SDL2) + mark_as_advanced(ALSOFT_REQUIRE_WASAPI) + #the following is from openal-soft + mark_as_advanced(SDL2MAIN_LIBRARY) + mark_as_advanced(SDL2_CORE_LIBRARY) + mark_as_advanced(SDL2_INCLUDE_DIR) endif() mark_as_advanced(TORQUE_SFX_OPENAL) From 4a5d63dc9bc6f642e9f36448d01164e7ee6181b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Monta=C3=B1=C3=A9s=20Garc=C3=ADa?= Date: Wed, 9 May 2018 13:49:58 +0200 Subject: [PATCH 122/144] It's almost imposible to change direction of wind. Reseting mCurrentTarget will allow to rotate properly. --- Engine/source/forest/forestWindEmitter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/Engine/source/forest/forestWindEmitter.cpp b/Engine/source/forest/forestWindEmitter.cpp index 46b879214..5d710bfe6 100644 --- a/Engine/source/forest/forestWindEmitter.cpp +++ b/Engine/source/forest/forestWindEmitter.cpp @@ -179,6 +179,7 @@ void ForestWind::setStrengthAndDirection( F32 strength, const VectorF &direction { mStrength = strength; mDirection = direction; + mCurrentTarget.zero(); mIsDirty = true; } } From ec8f56b3b0c27088953d610edba6e41b3fc788e1 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 9 May 2018 23:09:05 +1000 Subject: [PATCH 123/144] sdl 2.0.8 update --- Engine/lib/sdl/Android.mk | 30 +- Engine/lib/sdl/BUGS.txt | 4 +- Engine/lib/sdl/CMakeLists.txt | 359 +- Engine/lib/sdl/COPYING.txt | 2 +- Engine/lib/sdl/INSTALL.txt | 6 +- Engine/lib/sdl/Makefile.in | 25 +- Engine/lib/sdl/Makefile.pandora | 4 +- Engine/lib/sdl/README-SDL.txt | 2 +- Engine/lib/sdl/README.txt | 2 +- Engine/lib/sdl/SDL2.spec | 2 +- Engine/lib/sdl/SDL2Config.cmake | 1 + Engine/lib/sdl/WhatsNew.txt | 131 + Engine/lib/sdl/Xcode/SDL/Info-Framework.plist | 28 - .../Xcode/SDL/SDL.xcodeproj/project.pbxproj | 3004 --- Engine/lib/sdl/Xcode/SDL/pkg-support/SDL.info | 15 - .../SDL/pkg-support/resources/License.txt | 19 - .../SDL/pkg-support/resources/ReadMe.txt | 32 - .../SDL/pkg-support/resources/SDL_DS_Store | Bin 15364 -> 0 bytes .../sdl/Xcode/SDL/pkg-support/sdl_logo.pdf | Bin 163800 -> 0 bytes .../SDLTest/SDLTest.xcodeproj/project.pbxproj | 4882 ----- .../sdl/Xcode/SDLTest/TestDropFile-Info.plist | 35 - Engine/lib/sdl/Xcode/XcodeDocSet/Doxyfile | 1558 -- Engine/lib/sdl/acinclude/libtool.m4 | 5 +- Engine/lib/sdl/autogen.sh | 4 +- Engine/lib/sdl/build-scripts/androidbuild.sh | 91 +- .../lib/sdl/build-scripts/androidbuildlibs.sh | 74 + .../lib/sdl/build-scripts/checker-buildbot.sh | 24 +- Engine/lib/sdl/build-scripts/config.guess | 514 +- Engine/lib/sdl/build-scripts/config.sub | 177 +- Engine/lib/sdl/build-scripts/config.sub.patch | 72 + .../sdl/build-scripts/emscripten-buildbot.sh | 8 +- Engine/lib/sdl/build-scripts/iosbuild.sh | 429 +- Engine/lib/sdl/build-scripts/ltmain.sh | 6 +- Engine/lib/sdl/build-scripts/nacl-buildbot.sh | 6 +- .../lib/sdl/build-scripts/update-copyright.sh | 5 +- .../build-scripts/windows-buildbot-zipper.bat | 13 +- Engine/lib/sdl/build-scripts/winrtbuild.ps1 | 20 +- Engine/lib/sdl/cmake/sdlchecks.cmake | 130 +- Engine/lib/sdl/cmake_uninstall.cmake.in | 8 +- Engine/lib/sdl/configure | 1191 +- Engine/lib/sdl/configure.in | 743 +- Engine/lib/sdl/debian/changelog | 24 + Engine/lib/sdl/debian/control | 2 +- Engine/lib/sdl/debian/copyright | 12 +- Engine/lib/sdl/debian/libsdl2-dev.install | 7 +- Engine/lib/sdl/include/SDL.h | 11 +- Engine/lib/sdl/include/SDL_assert.h | 20 +- Engine/lib/sdl/include/SDL_atomic.h | 25 +- Engine/lib/sdl/include/SDL_audio.h | 175 +- Engine/lib/sdl/include/SDL_bits.h | 25 +- Engine/lib/sdl/include/SDL_blendmode.h | 67 +- Engine/lib/sdl/include/SDL_clipboard.h | 8 +- Engine/lib/sdl/include/SDL_config.h | 12 +- Engine/lib/sdl/include/SDL_config.h.cmake | 135 +- Engine/lib/sdl/include/SDL_config.h.in | 132 +- Engine/lib/sdl/include/SDL_config_android.h | 55 +- Engine/lib/sdl/include/SDL_config_iphoneos.h | 61 +- Engine/lib/sdl/include/SDL_config_macosx.h | 76 +- Engine/lib/sdl/include/SDL_config_minimal.h | 9 +- Engine/lib/sdl/include/SDL_config_pandora.h | 37 +- Engine/lib/sdl/include/SDL_config_psp.h | 42 +- Engine/lib/sdl/include/SDL_config_windows.h | 87 +- Engine/lib/sdl/include/SDL_config_winrt.h | 88 +- Engine/lib/sdl/include/SDL_config_wiz.h | 82 +- Engine/lib/sdl/include/SDL_copying.h | 2 +- Engine/lib/sdl/include/SDL_cpuinfo.h | 42 +- Engine/lib/sdl/include/SDL_egl.h | 6 +- Engine/lib/sdl/include/SDL_endian.h | 29 +- Engine/lib/sdl/include/SDL_error.h | 8 +- Engine/lib/sdl/include/SDL_events.h | 62 +- Engine/lib/sdl/include/SDL_filesystem.h | 8 +- Engine/lib/sdl/include/SDL_gamecontroller.h | 65 +- Engine/lib/sdl/include/SDL_gesture.h | 8 +- Engine/lib/sdl/include/SDL_haptic.h | 44 +- Engine/lib/sdl/include/SDL_hints.h | 267 +- Engine/lib/sdl/include/SDL_joystick.h | 131 +- Engine/lib/sdl/include/SDL_keyboard.h | 8 +- Engine/lib/sdl/include/SDL_keycode.h | 18 +- Engine/lib/sdl/include/SDL_loadso.h | 8 +- Engine/lib/sdl/include/SDL_log.h | 10 +- Engine/lib/sdl/include/SDL_main.h | 19 +- Engine/lib/sdl/include/SDL_messagebox.h | 8 +- Engine/lib/sdl/include/SDL_mouse.h | 10 +- Engine/lib/sdl/include/SDL_mutex.h | 8 +- Engine/lib/sdl/include/SDL_name.h | 8 +- Engine/lib/sdl/include/SDL_opengl.h | 15 +- Engine/lib/sdl/include/SDL_opengles.h | 2 +- Engine/lib/sdl/include/SDL_opengles2.h | 2 +- Engine/lib/sdl/include/SDL_pixels.h | 12 +- Engine/lib/sdl/include/SDL_platform.h | 43 +- Engine/lib/sdl/include/SDL_power.h | 8 +- Engine/lib/sdl/include/SDL_quit.h | 8 +- Engine/lib/sdl/include/SDL_rect.h | 8 +- Engine/lib/sdl/include/SDL_render.h | 38 +- Engine/lib/sdl/include/SDL_revision.h | 4 +- Engine/lib/sdl/include/SDL_rwops.h | 43 +- Engine/lib/sdl/include/SDL_scancode.h | 22 +- Engine/lib/sdl/include/SDL_shape.h | 17 +- Engine/lib/sdl/include/SDL_stdinc.h | 94 +- Engine/lib/sdl/include/SDL_surface.h | 45 +- Engine/lib/sdl/include/SDL_system.h | 49 +- Engine/lib/sdl/include/SDL_syswm.h | 31 +- Engine/lib/sdl/include/SDL_test.h | 25 +- Engine/lib/sdl/include/SDL_test_assert.h | 14 +- Engine/lib/sdl/include/SDL_test_common.h | 8 +- Engine/lib/sdl/include/SDL_test_compare.h | 8 +- Engine/lib/sdl/include/SDL_test_crc32.h | 10 +- Engine/lib/sdl/include/SDL_test_font.h | 17 +- Engine/lib/sdl/include/SDL_test_fuzzer.h | 36 +- Engine/lib/sdl/include/SDL_test_harness.h | 19 +- Engine/lib/sdl/include/SDL_test_images.h | 30 +- Engine/lib/sdl/include/SDL_test_log.h | 8 +- Engine/lib/sdl/include/SDL_test_md5.h | 8 +- Engine/lib/sdl/include/SDL_test_memory.h | 63 + Engine/lib/sdl/include/SDL_test_random.h | 8 +- Engine/lib/sdl/include/SDL_thread.h | 51 +- Engine/lib/sdl/include/SDL_timer.h | 8 +- Engine/lib/sdl/include/SDL_touch.h | 8 +- Engine/lib/sdl/include/SDL_types.h | 2 +- Engine/lib/sdl/include/SDL_version.h | 10 +- Engine/lib/sdl/include/SDL_video.h | 63 +- Engine/lib/sdl/include/SDL_vulkan.h | 273 + Engine/lib/sdl/include/begin_code.h | 25 +- Engine/lib/sdl/include/close_code.h | 4 +- Engine/lib/sdl/src/SDL.c | 15 +- Engine/lib/sdl/src/SDL_assert.c | 85 +- Engine/lib/sdl/src/SDL_assert_c.h | 2 +- Engine/lib/sdl/src/SDL_dataqueue.c | 339 + Engine/lib/sdl/src/SDL_dataqueue.h | 55 + Engine/lib/sdl/src/SDL_error.c | 165 +- Engine/lib/sdl/src/SDL_error_c.h | 9 +- Engine/lib/sdl/src/SDL_hints.c | 4 +- Engine/lib/sdl/src/SDL_internal.h | 22 +- Engine/lib/sdl/src/SDL_log.c | 28 +- Engine/lib/sdl/src/atomic/SDL_atomic.c | 101 +- Engine/lib/sdl/src/atomic/SDL_spinlock.c | 19 +- Engine/lib/sdl/src/audio/SDL_audio.c | 651 +- Engine/lib/sdl/src/audio/SDL_audio_c.h | 65 +- Engine/lib/sdl/src/audio/SDL_audiocvt.c | 2308 ++- Engine/lib/sdl/src/audio/SDL_audiodev.c | 7 +- Engine/lib/sdl/src/audio/SDL_audiodev_c.h | 2 +- Engine/lib/sdl/src/audio/SDL_audiotypecvt.c | 16418 +--------------- Engine/lib/sdl/src/audio/SDL_mixer.c | 2 +- Engine/lib/sdl/src/audio/SDL_sysaudio.h | 86 +- Engine/lib/sdl/src/audio/SDL_wave.c | 72 +- Engine/lib/sdl/src/audio/SDL_wave.h | 12 +- .../lib/sdl/src/audio/alsa/SDL_alsa_audio.c | 143 +- .../lib/sdl/src/audio/alsa/SDL_alsa_audio.h | 11 +- .../sdl/src/audio/android/SDL_androidaudio.c | 6 +- .../sdl/src/audio/android/SDL_androidaudio.h | 11 +- Engine/lib/sdl/src/audio/arts/SDL_artsaudio.c | 2 +- Engine/lib/sdl/src/audio/arts/SDL_artsaudio.h | 11 +- .../sdl/src/audio/coreaudio/SDL_coreaudio.h | 11 +- .../sdl/src/audio/coreaudio/SDL_coreaudio.m | 108 +- .../src/audio/directsound/SDL_directsound.c | 7 +- .../src/audio/directsound/SDL_directsound.h | 8 +- Engine/lib/sdl/src/audio/disk/SDL_diskaudio.c | 14 +- Engine/lib/sdl/src/audio/disk/SDL_diskaudio.h | 8 +- Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.c | 2 +- Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.h | 8 +- .../lib/sdl/src/audio/dummy/SDL_dummyaudio.c | 2 +- .../lib/sdl/src/audio/dummy/SDL_dummyaudio.h | 8 +- .../audio/emscripten/SDL_emscriptenaudio.c | 212 +- .../audio/emscripten/SDL_emscriptenaudio.h | 16 +- Engine/lib/sdl/src/audio/esd/SDL_esdaudio.c | 2 +- Engine/lib/sdl/src/audio/esd/SDL_esdaudio.h | 9 +- .../sdl/src/audio/fusionsound/SDL_fsaudio.c | 2 +- .../sdl/src/audio/fusionsound/SDL_fsaudio.h | 9 +- .../lib/sdl/src/audio/haiku/SDL_haikuaudio.cc | 48 +- .../lib/sdl/src/audio/haiku/SDL_haikuaudio.h | 8 +- Engine/lib/sdl/src/audio/jack/SDL_jackaudio.c | 429 + Engine/lib/sdl/src/audio/jack/SDL_jackaudio.h | 42 + Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.c | 58 +- Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.h | 10 +- Engine/lib/sdl/src/audio/nas/SDL_nasaudio.c | 4 +- Engine/lib/sdl/src/audio/nas/SDL_nasaudio.h | 8 +- .../SDL_netbsdaudio.c} | 66 +- .../SDL_netbsdaudio.h} | 13 +- Engine/lib/sdl/src/audio/paudio/SDL_paudio.c | 43 +- Engine/lib/sdl/src/audio/paudio/SDL_paudio.h | 11 +- Engine/lib/sdl/src/audio/psp/SDL_pspaudio.c | 3 +- Engine/lib/sdl/src/audio/psp/SDL_pspaudio.h | 12 +- .../sdl/src/audio/pulseaudio/SDL_pulseaudio.c | 28 +- .../sdl/src/audio/pulseaudio/SDL_pulseaudio.h | 8 +- Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.c | 159 +- Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.h | 2 +- Engine/lib/sdl/src/audio/sdlgenaudiocvt.pl | 761 - .../lib/sdl/src/audio/sndio/SDL_sndioaudio.c | 75 +- .../lib/sdl/src/audio/sndio/SDL_sndioaudio.h | 12 +- Engine/lib/sdl/src/audio/sun/SDL_sunaudio.c | 18 +- Engine/lib/sdl/src/audio/sun/SDL_sunaudio.h | 8 +- Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.c | 779 + Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.h | 85 + .../sdl/src/audio/wasapi/SDL_wasapi_win32.c | 417 + .../sdl/src/audio/wasapi/SDL_wasapi_winrt.cpp | 276 + Engine/lib/sdl/src/audio/winmm/SDL_winmm.c | 36 +- Engine/lib/sdl/src/audio/winmm/SDL_winmm.h | 8 +- .../lib/sdl/src/audio/xaudio2/SDL_xaudio2.c | 503 - .../lib/sdl/src/audio/xaudio2/SDL_xaudio2.h | 386 - .../xaudio2/SDL_xaudio2_winrthelpers.cpp | 90 - .../audio/xaudio2/SDL_xaudio2_winrthelpers.h | 70 - Engine/lib/sdl/src/core/android/SDL_android.c | 925 +- Engine/lib/sdl/src/core/android/SDL_android.h | 24 +- .../lib/sdl/src/core/android/keyinfotable.h | 175 + Engine/lib/sdl/src/core/linux/SDL_dbus.c | 252 +- Engine/lib/sdl/src/core/linux/SDL_dbus.h | 23 +- Engine/lib/sdl/src/core/linux/SDL_evdev.c | 311 +- Engine/lib/sdl/src/core/linux/SDL_evdev.h | 8 +- Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.c | 677 + Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.h | 29 + .../linux/SDL_evdev_kbd_default_accents.h | 284 + .../core/linux/SDL_evdev_kbd_default_keymap.h | 4763 +++++ Engine/lib/sdl/src/core/linux/SDL_fcitx.c | 260 +- Engine/lib/sdl/src/core/linux/SDL_fcitx.h | 10 +- Engine/lib/sdl/src/core/linux/SDL_ibus.c | 164 +- Engine/lib/sdl/src/core/linux/SDL_ibus.h | 10 +- Engine/lib/sdl/src/core/linux/SDL_ime.c | 20 +- Engine/lib/sdl/src/core/linux/SDL_ime.h | 18 +- Engine/lib/sdl/src/core/linux/SDL_udev.c | 44 +- Engine/lib/sdl/src/core/linux/SDL_udev.h | 10 +- Engine/lib/sdl/src/core/unix/SDL_poll.c | 87 + Engine/lib/sdl/src/core/unix/SDL_poll.h | 34 + Engine/lib/sdl/src/core/windows/SDL_directx.h | 8 +- Engine/lib/sdl/src/core/windows/SDL_windows.c | 31 +- Engine/lib/sdl/src/core/windows/SDL_windows.h | 12 +- Engine/lib/sdl/src/core/windows/SDL_xinput.c | 2 +- Engine/lib/sdl/src/core/windows/SDL_xinput.h | 13 +- .../src/core/winrt/SDL_winrtapp_common.cpp | 31 +- .../sdl/src/core/winrt/SDL_winrtapp_common.h | 8 +- .../src/core/winrt/SDL_winrtapp_direct3d.cpp | 8 +- .../src/core/winrt/SDL_winrtapp_direct3d.h | 2 +- .../sdl/src/core/winrt/SDL_winrtapp_xaml.cpp | 2 +- .../sdl/src/core/winrt/SDL_winrtapp_xaml.h | 8 +- Engine/lib/sdl/src/cpuinfo/SDL_cpuinfo.c | 348 +- Engine/lib/sdl/src/dynapi/SDL_dynapi.c | 68 +- Engine/lib/sdl/src/dynapi/SDL_dynapi.h | 6 +- .../lib/sdl/src/dynapi/SDL_dynapi_overrides.h | 71 +- Engine/lib/sdl/src/dynapi/SDL_dynapi_procs.h | 81 +- Engine/lib/sdl/src/dynapi/gendynapi.pl | 2 +- .../lib/sdl/src/events/SDL_clipboardevents.c | 2 +- .../sdl/src/events/SDL_clipboardevents_c.h | 8 +- Engine/lib/sdl/src/events/SDL_dropevents.c | 2 +- Engine/lib/sdl/src/events/SDL_dropevents_c.h | 8 +- Engine/lib/sdl/src/events/SDL_events.c | 422 +- Engine/lib/sdl/src/events/SDL_events_c.h | 6 +- Engine/lib/sdl/src/events/SDL_gesture.c | 40 +- Engine/lib/sdl/src/events/SDL_gesture_c.h | 11 +- Engine/lib/sdl/src/events/SDL_keyboard.c | 39 +- Engine/lib/sdl/src/events/SDL_keyboard_c.h | 8 +- Engine/lib/sdl/src/events/SDL_mouse.c | 149 +- Engine/lib/sdl/src/events/SDL_mouse_c.h | 18 +- Engine/lib/sdl/src/events/SDL_quit.c | 6 +- Engine/lib/sdl/src/events/SDL_sysevents.h | 2 +- Engine/lib/sdl/src/events/SDL_touch.c | 18 +- Engine/lib/sdl/src/events/SDL_touch_c.h | 8 +- Engine/lib/sdl/src/events/SDL_windowevents.c | 10 +- .../lib/sdl/src/events/SDL_windowevents_c.h | 8 +- Engine/lib/sdl/src/events/blank_cursor.h | 2 +- Engine/lib/sdl/src/events/default_cursor.h | 2 +- Engine/lib/sdl/src/events/scancodes_darwin.h | 2 +- Engine/lib/sdl/src/events/scancodes_linux.h | 6 +- Engine/lib/sdl/src/events/scancodes_windows.h | 2 +- Engine/lib/sdl/src/events/scancodes_xfree86.h | 4 +- Engine/lib/sdl/src/file/SDL_rwops.c | 130 +- .../src/file/cocoa/SDL_rwopsbundlesupport.h | 2 +- .../src/file/cocoa/SDL_rwopsbundlesupport.m | 2 +- .../filesystem/android/SDL_sysfilesystem.c | 4 +- .../src/filesystem/cocoa/SDL_sysfilesystem.m | 17 +- .../src/filesystem/dummy/SDL_sysfilesystem.c | 2 +- .../filesystem/emscripten/SDL_sysfilesystem.c | 16 +- .../src/filesystem/haiku/SDL_sysfilesystem.cc | 33 +- .../src/filesystem/nacl/SDL_sysfilesystem.c | 3 +- .../src/filesystem/unix/SDL_sysfilesystem.c | 29 +- .../filesystem/windows/SDL_sysfilesystem.c | 16 +- .../filesystem/winrt/SDL_sysfilesystem.cpp | 20 +- Engine/lib/sdl/src/haptic/SDL_haptic.c | 5 +- Engine/lib/sdl/src/haptic/SDL_haptic_c.h | 2 +- Engine/lib/sdl/src/haptic/SDL_syshaptic.h | 10 +- .../sdl/src/haptic/android/SDL_syshaptic.c | 357 + .../sdl/src/haptic/android/SDL_syshaptic_c.h | 12 + .../lib/sdl/src/haptic/darwin/SDL_syshaptic.c | 4 +- .../sdl/src/haptic/darwin/SDL_syshaptic_c.h | 2 +- .../lib/sdl/src/haptic/dummy/SDL_syshaptic.c | 2 +- .../lib/sdl/src/haptic/linux/SDL_syshaptic.c | 8 +- .../sdl/src/haptic/windows/SDL_dinputhaptic.c | 42 +- .../src/haptic/windows/SDL_dinputhaptic_c.h | 2 +- .../src/haptic/windows/SDL_windowshaptic.c | 4 +- .../src/haptic/windows/SDL_windowshaptic_c.h | 8 +- .../sdl/src/haptic/windows/SDL_xinputhaptic.c | 7 +- .../src/haptic/windows/SDL_xinputhaptic_c.h | 2 +- .../lib/sdl/src/joystick/SDL_gamecontroller.c | 1199 +- .../sdl/src/joystick/SDL_gamecontrollerdb.h | 176 +- Engine/lib/sdl/src/joystick/SDL_joystick.c | 497 +- Engine/lib/sdl/src/joystick/SDL_joystick_c.h | 12 +- Engine/lib/sdl/src/joystick/SDL_sysjoystick.h | 33 +- .../src/joystick/android/SDL_sysjoystick.c | 212 +- .../src/joystick/android/SDL_sysjoystick_c.h | 13 +- .../sdl/src/joystick/bsd/SDL_sysjoystick.c | 24 +- .../sdl/src/joystick/darwin/SDL_sysjoystick.c | 191 +- .../src/joystick/darwin/SDL_sysjoystick_c.h | 5 +- .../sdl/src/joystick/dummy/SDL_sysjoystick.c | 8 +- .../src/joystick/emscripten/SDL_sysjoystick.c | 17 +- .../joystick/emscripten/SDL_sysjoystick_c.h | 2 +- .../src/joystick/haiku/SDL_haikujoystick.cc | 30 +- .../src/joystick/iphoneos/SDL_sysjoystick.m | 100 +- .../src/joystick/iphoneos/SDL_sysjoystick_c.h | 6 +- .../sdl/src/joystick/linux/SDL_sysjoystick.c | 310 +- .../src/joystick/linux/SDL_sysjoystick_c.h | 7 +- .../sdl/src/joystick/psp/SDL_sysjoystick.c | 6 +- .../lib/sdl/src/joystick/sort_controllers.py | 1 + .../src/joystick/steam/SDL_steamcontroller.c | 52 + .../src/joystick/steam/SDL_steamcontroller.h | 33 + .../src/joystick/windows/SDL_dinputjoystick.c | 92 +- .../joystick/windows/SDL_dinputjoystick_c.h | 2 +- .../sdl/src/joystick/windows/SDL_mmjoystick.c | 58 +- .../joystick/windows/SDL_windowsjoystick.c | 82 +- .../joystick/windows/SDL_windowsjoystick_c.h | 3 +- .../src/joystick/windows/SDL_xinputjoystick.c | 141 +- .../joystick/windows/SDL_xinputjoystick_c.h | 2 +- Engine/lib/sdl/src/libm/e_atan2.c | 22 +- Engine/lib/sdl/src/libm/e_fmod.c | 144 + Engine/lib/sdl/src/libm/e_log.c | 171 +- Engine/lib/sdl/src/libm/e_log10.c | 106 + Engine/lib/sdl/src/libm/e_pow.c | 593 +- Engine/lib/sdl/src/libm/e_rem_pio2.c | 270 +- Engine/lib/sdl/src/libm/e_sqrt.c | 209 +- Engine/lib/sdl/src/libm/k_cos.c | 76 +- Engine/lib/sdl/src/libm/k_rem_pio2.c | 340 +- Engine/lib/sdl/src/libm/k_sin.c | 60 +- Engine/lib/sdl/src/libm/k_tan.c | 2 +- Engine/lib/sdl/src/libm/math_libm.h | 4 +- Engine/lib/sdl/src/libm/math_private.h | 5 + Engine/lib/sdl/src/libm/s_atan.c | 1 - Engine/lib/sdl/src/libm/s_copysign.c | 25 +- Engine/lib/sdl/src/libm/s_cos.c | 52 +- Engine/lib/sdl/src/libm/s_fabs.c | 26 +- Engine/lib/sdl/src/libm/s_floor.c | 113 +- Engine/lib/sdl/src/libm/s_scalbn.c | 102 +- Engine/lib/sdl/src/libm/s_sin.c | 52 +- .../lib/sdl/src/loadso/dlopen/SDL_sysloadso.c | 2 +- .../lib/sdl/src/loadso/dummy/SDL_sysloadso.c | 2 +- .../lib/sdl/src/loadso/haiku/SDL_sysloadso.c | 71 - .../sdl/src/loadso/windows/SDL_sysloadso.c | 2 +- .../sdl/src/main/android/SDL_android_main.c | 80 +- Engine/lib/sdl/src/main/haiku/SDL_BApp.h | 13 +- Engine/lib/sdl/src/main/haiku/SDL_BeApp.cc | 25 +- Engine/lib/sdl/src/main/haiku/SDL_BeApp.h | 4 +- Engine/lib/sdl/src/main/nacl/SDL_nacl_main.c | 2 +- .../sdl/src/main/windows/SDL_windows_main.c | 4 +- Engine/lib/sdl/src/main/windows/version.rc | 10 +- .../src/main/winrt/SDL_winrt_main_NonXAML.cpp | 7 +- Engine/lib/sdl/src/power/SDL_power.c | 16 +- Engine/lib/sdl/src/power/SDL_syspower.h | 47 + .../lib/sdl/src/power/android/SDL_syspower.c | 3 +- .../sdl/src/power/emscripten/SDL_syspower.c | 2 +- Engine/lib/sdl/src/power/haiku/SDL_syspower.c | 4 +- Engine/lib/sdl/src/power/linux/SDL_syspower.c | 129 +- .../lib/sdl/src/power/macosx/SDL_syspower.c | 2 +- Engine/lib/sdl/src/power/psp/SDL_syspower.c | 2 +- Engine/lib/sdl/src/power/uikit/SDL_syspower.h | 2 +- Engine/lib/sdl/src/power/uikit/SDL_syspower.m | 2 +- .../lib/sdl/src/power/windows/SDL_syspower.c | 2 +- .../lib/sdl/src/power/winrt/SDL_syspower.cpp | 2 +- Engine/lib/sdl/src/render/SDL_d3dmath.c | 100 +- Engine/lib/sdl/src/render/SDL_d3dmath.h | 4 +- Engine/lib/sdl/src/render/SDL_render.c | 397 +- Engine/lib/sdl/src/render/SDL_sysrender.h | 41 +- Engine/lib/sdl/src/render/SDL_yuv_mmx.c | 431 - Engine/lib/sdl/src/render/SDL_yuv_sw.c | 1235 +- Engine/lib/sdl/src/render/SDL_yuv_sw_c.h | 17 +- .../sdl/src/render/direct3d/SDL_render_d3d.c | 565 +- .../sdl/src/render/direct3d/SDL_shaders_d3d.c | 274 + .../sdl/src/render/direct3d/SDL_shaders_d3d.h | 34 + .../src/render/direct3d11/SDL_render_d3d11.c | 1070 +- .../render/direct3d11/SDL_render_winrt.cpp | 2 +- .../src/render/direct3d11/SDL_render_winrt.h | 2 +- .../src/render/direct3d11/SDL_shaders_d3d11.c | 1957 ++ .../src/render/direct3d11/SDL_shaders_d3d11.h | 43 + .../sdl/src/render/metal/SDL_render_metal.m | 1429 ++ .../src/render/metal/SDL_shaders_metal.metal | 109 + .../src/render/metal/SDL_shaders_metal_ios.h | 1899 ++ .../src/render/metal/SDL_shaders_metal_osx.h | 1903 ++ .../src/render/metal/build-metal-shaders.sh | 18 + Engine/lib/sdl/src/render/mmx.h | 642 - .../lib/sdl/src/render/opengl/SDL_glfuncs.h | 5 +- .../lib/sdl/src/render/opengl/SDL_render_gl.c | 199 +- .../sdl/src/render/opengl/SDL_shaders_gl.c | 375 +- .../sdl/src/render/opengl/SDL_shaders_gl.h | 16 +- .../sdl/src/render/opengles/SDL_glesfuncs.h | 4 +- .../sdl/src/render/opengles/SDL_render_gles.c | 136 +- .../sdl/src/render/opengles2/SDL_gles2funcs.h | 7 +- .../src/render/opengles2/SDL_render_gles2.c | 315 +- .../src/render/opengles2/SDL_shaders_gles2.c | 853 +- .../src/render/opengles2/SDL_shaders_gles2.h | 27 +- .../lib/sdl/src/render/psp/SDL_render_psp.c | 6 +- .../src/render/software/SDL_blendfillrect.c | 4 +- .../src/render/software/SDL_blendfillrect.h | 2 +- .../sdl/src/render/software/SDL_blendline.c | 4 +- .../sdl/src/render/software/SDL_blendline.h | 2 +- .../sdl/src/render/software/SDL_blendpoint.c | 10 +- .../sdl/src/render/software/SDL_blendpoint.h | 2 +- Engine/lib/sdl/src/render/software/SDL_draw.h | 10 +- .../sdl/src/render/software/SDL_drawline.c | 2 +- .../sdl/src/render/software/SDL_drawline.h | 2 +- .../sdl/src/render/software/SDL_drawpoint.c | 2 +- .../sdl/src/render/software/SDL_drawpoint.h | 2 +- .../sdl/src/render/software/SDL_render_sw.c | 234 +- .../sdl/src/render/software/SDL_render_sw_c.h | 2 +- .../lib/sdl/src/render/software/SDL_rotate.c | 203 +- .../lib/sdl/src/render/software/SDL_rotate.h | 2 +- Engine/lib/sdl/src/stdlib/SDL_getenv.c | 17 +- Engine/lib/sdl/src/stdlib/SDL_iconv.c | 5 +- Engine/lib/sdl/src/stdlib/SDL_malloc.c | 172 +- Engine/lib/sdl/src/stdlib/SDL_qsort.c | 12 +- Engine/lib/sdl/src/stdlib/SDL_stdlib.c | 194 +- Engine/lib/sdl/src/stdlib/SDL_string.c | 143 +- Engine/lib/sdl/src/test/SDL_test_assert.c | 4 +- Engine/lib/sdl/src/test/SDL_test_common.c | 412 +- Engine/lib/sdl/src/test/SDL_test_compare.c | 4 +- Engine/lib/sdl/src/test/SDL_test_crc32.c | 5 +- Engine/lib/sdl/src/test/SDL_test_font.c | 54 +- Engine/lib/sdl/src/test/SDL_test_fuzzer.c | 55 +- Engine/lib/sdl/src/test/SDL_test_harness.c | 56 +- Engine/lib/sdl/src/test/SDL_test_imageBlit.c | 10 +- .../sdl/src/test/SDL_test_imageBlitBlend.c | 14 +- Engine/lib/sdl/src/test/SDL_test_imageFace.c | 5 +- .../sdl/src/test/SDL_test_imagePrimitives.c | 6 +- .../src/test/SDL_test_imagePrimitivesBlend.c | 6 +- Engine/lib/sdl/src/test/SDL_test_log.c | 23 +- Engine/lib/sdl/src/test/SDL_test_md5.c | 4 +- Engine/lib/sdl/src/test/SDL_test_memory.c | 274 + Engine/lib/sdl/src/test/SDL_test_random.c | 6 +- Engine/lib/sdl/src/thread/SDL_systhread.h | 10 +- Engine/lib/sdl/src/thread/SDL_thread.c | 6 +- Engine/lib/sdl/src/thread/SDL_thread_c.h | 12 +- .../lib/sdl/src/thread/generic/SDL_syscond.c | 2 +- .../lib/sdl/src/thread/generic/SDL_sysmutex.c | 2 +- .../sdl/src/thread/generic/SDL_sysmutex_c.h | 2 +- .../lib/sdl/src/thread/generic/SDL_syssem.c | 2 +- .../sdl/src/thread/generic/SDL_systhread.c | 2 +- .../sdl/src/thread/generic/SDL_systhread_c.h | 2 +- .../lib/sdl/src/thread/generic/SDL_systls.c | 4 +- Engine/lib/sdl/src/thread/psp/SDL_syscond.c | 2 +- Engine/lib/sdl/src/thread/psp/SDL_sysmutex.c | 2 +- .../lib/sdl/src/thread/psp/SDL_sysmutex_c.h | 2 +- Engine/lib/sdl/src/thread/psp/SDL_syssem.c | 4 +- Engine/lib/sdl/src/thread/psp/SDL_systhread.c | 2 +- .../lib/sdl/src/thread/psp/SDL_systhread_c.h | 2 +- .../lib/sdl/src/thread/pthread/SDL_syscond.c | 6 +- .../lib/sdl/src/thread/pthread/SDL_sysmutex.c | 11 +- .../sdl/src/thread/pthread/SDL_sysmutex_c.h | 8 +- .../lib/sdl/src/thread/pthread/SDL_syssem.c | 10 +- .../sdl/src/thread/pthread/SDL_systhread.c | 8 +- .../sdl/src/thread/pthread/SDL_systhread_c.h | 2 +- .../lib/sdl/src/thread/pthread/SDL_systls.c | 5 +- .../lib/sdl/src/thread/stdcpp/SDL_syscond.cpp | 2 +- .../sdl/src/thread/stdcpp/SDL_sysmutex.cpp | 2 +- .../sdl/src/thread/stdcpp/SDL_sysmutex_c.h | 2 +- .../sdl/src/thread/stdcpp/SDL_systhread.cpp | 4 +- .../sdl/src/thread/stdcpp/SDL_systhread_c.h | 2 +- .../lib/sdl/src/thread/windows/SDL_sysmutex.c | 2 +- .../lib/sdl/src/thread/windows/SDL_syssem.c | 6 +- .../sdl/src/thread/windows/SDL_systhread.c | 57 +- .../sdl/src/thread/windows/SDL_systhread_c.h | 8 +- .../lib/sdl/src/thread/windows/SDL_systls.c | 4 +- Engine/lib/sdl/src/timer/SDL_timer.c | 5 +- Engine/lib/sdl/src/timer/SDL_timer_c.h | 2 +- Engine/lib/sdl/src/timer/dummy/SDL_systimer.c | 2 +- Engine/lib/sdl/src/timer/haiku/SDL_systimer.c | 4 +- Engine/lib/sdl/src/timer/psp/SDL_systimer.c | 2 +- Engine/lib/sdl/src/timer/unix/SDL_systimer.c | 3 +- .../lib/sdl/src/timer/windows/SDL_systimer.c | 4 +- Engine/lib/sdl/src/video/SDL_RLEaccel.c | 16 +- Engine/lib/sdl/src/video/SDL_RLEaccel_c.h | 10 +- Engine/lib/sdl/src/video/SDL_blit.c | 14 +- Engine/lib/sdl/src/video/SDL_blit.h | 49 +- Engine/lib/sdl/src/video/SDL_blit_0.c | 2 +- Engine/lib/sdl/src/video/SDL_blit_1.c | 16 +- Engine/lib/sdl/src/video/SDL_blit_A.c | 6 +- Engine/lib/sdl/src/video/SDL_blit_N.c | 36 +- Engine/lib/sdl/src/video/SDL_blit_auto.c | 2 +- Engine/lib/sdl/src/video/SDL_blit_auto.h | 2 +- Engine/lib/sdl/src/video/SDL_blit_copy.c | 2 +- Engine/lib/sdl/src/video/SDL_blit_copy.h | 2 +- Engine/lib/sdl/src/video/SDL_blit_slow.c | 2 +- Engine/lib/sdl/src/video/SDL_blit_slow.h | 2 +- Engine/lib/sdl/src/video/SDL_bmp.c | 5 +- Engine/lib/sdl/src/video/SDL_clipboard.c | 2 +- Engine/lib/sdl/src/video/SDL_egl.c | 331 +- Engine/lib/sdl/src/video/SDL_egl_c.h | 35 +- Engine/lib/sdl/src/video/SDL_fillrect.c | 14 +- Engine/lib/sdl/src/video/SDL_pixels.c | 52 +- Engine/lib/sdl/src/video/SDL_pixels_c.h | 3 +- Engine/lib/sdl/src/video/SDL_rect.c | 10 +- Engine/lib/sdl/src/video/SDL_rect_c.h | 2 +- Engine/lib/sdl/src/video/SDL_shape.c | 30 +- .../lib/sdl/src/video/SDL_shape_internals.h | 6 +- Engine/lib/sdl/src/video/SDL_stretch.c | 10 +- Engine/lib/sdl/src/video/SDL_surface.c | 173 +- Engine/lib/sdl/src/video/SDL_sysvideo.h | 95 +- Engine/lib/sdl/src/video/SDL_video.c | 497 +- .../lib/sdl/src/video/SDL_vulkan_internal.h | 91 + Engine/lib/sdl/src/video/SDL_vulkan_utils.c | 172 + Engine/lib/sdl/src/video/SDL_yuv.c | 1834 ++ Engine/lib/sdl/src/video/SDL_yuv_c.h | 30 + .../src/video/android/SDL_androidclipboard.c | 4 +- .../src/video/android/SDL_androidclipboard.h | 8 +- .../sdl/src/video/android/SDL_androidevents.c | 18 +- .../sdl/src/video/android/SDL_androidevents.h | 2 +- .../lib/sdl/src/video/android/SDL_androidgl.c | 9 +- .../lib/sdl/src/video/android/SDL_androidgl.h | 34 + .../src/video/android/SDL_androidkeyboard.c | 8 +- .../src/video/android/SDL_androidkeyboard.h | 2 +- .../src/video/android/SDL_androidmessagebox.c | 6 +- .../src/video/android/SDL_androidmessagebox.h | 2 +- .../sdl/src/video/android/SDL_androidmouse.c | 57 +- .../sdl/src/video/android/SDL_androidmouse.h | 8 +- .../sdl/src/video/android/SDL_androidtouch.c | 11 +- .../sdl/src/video/android/SDL_androidtouch.h | 2 +- .../sdl/src/video/android/SDL_androidvideo.c | 53 +- .../sdl/src/video/android/SDL_androidvideo.h | 8 +- .../sdl/src/video/android/SDL_androidvulkan.c | 175 + .../sdl/src/video/android/SDL_androidvulkan.h | 52 + .../sdl/src/video/android/SDL_androidwindow.c | 31 +- .../sdl/src/video/android/SDL_androidwindow.h | 9 +- .../sdl/src/video/cocoa/SDL_cocoaclipboard.h | 8 +- .../sdl/src/video/cocoa/SDL_cocoaclipboard.m | 2 +- .../lib/sdl/src/video/cocoa/SDL_cocoaevents.h | 8 +- .../lib/sdl/src/video/cocoa/SDL_cocoaevents.m | 81 +- .../sdl/src/video/cocoa/SDL_cocoakeyboard.h | 8 +- .../sdl/src/video/cocoa/SDL_cocoakeyboard.m | 31 +- .../sdl/src/video/cocoa/SDL_cocoamessagebox.h | 2 +- .../sdl/src/video/cocoa/SDL_cocoamessagebox.m | 23 +- .../sdl/src/video/cocoa/SDL_cocoametalview.h | 63 + .../sdl/src/video/cocoa/SDL_cocoametalview.m | 135 + .../lib/sdl/src/video/cocoa/SDL_cocoamodes.h | 8 +- .../lib/sdl/src/video/cocoa/SDL_cocoamodes.m | 44 +- .../lib/sdl/src/video/cocoa/SDL_cocoamouse.h | 8 +- .../lib/sdl/src/video/cocoa/SDL_cocoamouse.m | 23 +- .../sdl/src/video/cocoa/SDL_cocoamousetap.h | 9 +- .../sdl/src/video/cocoa/SDL_cocoamousetap.m | 48 +- .../lib/sdl/src/video/cocoa/SDL_cocoaopengl.h | 10 +- .../lib/sdl/src/video/cocoa/SDL_cocoaopengl.m | 27 +- .../sdl/src/video/cocoa/SDL_cocoaopengles.h | 49 + .../sdl/src/video/cocoa/SDL_cocoaopengles.m | 132 + .../lib/sdl/src/video/cocoa/SDL_cocoashape.h | 10 +- .../lib/sdl/src/video/cocoa/SDL_cocoashape.m | 4 +- .../lib/sdl/src/video/cocoa/SDL_cocoavideo.h | 61 +- .../lib/sdl/src/video/cocoa/SDL_cocoavideo.m | 25 +- .../lib/sdl/src/video/cocoa/SDL_cocoavulkan.h | 55 + .../lib/sdl/src/video/cocoa/SDL_cocoavulkan.m | 231 + .../lib/sdl/src/video/cocoa/SDL_cocoawindow.h | 15 +- .../lib/sdl/src/video/cocoa/SDL_cocoawindow.m | 171 +- .../sdl/src/video/directfb/SDL_DirectFB_WM.c | 2 +- .../sdl/src/video/directfb/SDL_DirectFB_WM.h | 8 +- .../sdl/src/video/directfb/SDL_DirectFB_dyn.c | 2 +- .../sdl/src/video/directfb/SDL_DirectFB_dyn.h | 10 +- .../src/video/directfb/SDL_DirectFB_events.c | 5 +- .../src/video/directfb/SDL_DirectFB_events.h | 10 +- .../src/video/directfb/SDL_DirectFB_modes.c | 2 +- .../src/video/directfb/SDL_DirectFB_modes.h | 8 +- .../src/video/directfb/SDL_DirectFB_mouse.c | 11 +- .../src/video/directfb/SDL_DirectFB_mouse.h | 8 +- .../src/video/directfb/SDL_DirectFB_opengl.c | 33 +- .../src/video/directfb/SDL_DirectFB_opengl.h | 10 +- .../src/video/directfb/SDL_DirectFB_render.c | 23 +- .../src/video/directfb/SDL_DirectFB_render.h | 2 +- .../src/video/directfb/SDL_DirectFB_shape.c | 13 +- .../src/video/directfb/SDL_DirectFB_shape.h | 9 +- .../src/video/directfb/SDL_DirectFB_video.c | 17 +- .../src/video/directfb/SDL_DirectFB_video.h | 8 +- .../src/video/directfb/SDL_DirectFB_window.c | 24 +- .../src/video/directfb/SDL_DirectFB_window.h | 8 +- .../lib/sdl/src/video/dummy/SDL_nullevents.c | 2 +- .../sdl/src/video/dummy/SDL_nullevents_c.h | 2 +- .../sdl/src/video/dummy/SDL_nullframebuffer.c | 2 +- .../src/video/dummy/SDL_nullframebuffer_c.h | 2 +- .../lib/sdl/src/video/dummy/SDL_nullvideo.c | 3 +- .../lib/sdl/src/video/dummy/SDL_nullvideo.h | 8 +- .../video/emscripten/SDL_emscriptenevents.c | 106 +- .../video/emscripten/SDL_emscriptenevents.h | 11 +- .../emscripten/SDL_emscriptenframebuffer.c | 2 +- .../emscripten/SDL_emscriptenframebuffer.h | 8 +- .../video/emscripten/SDL_emscriptenmouse.c | 116 +- .../video/emscripten/SDL_emscriptenmouse.h | 11 +- .../video/emscripten/SDL_emscriptenopengles.c | 12 +- .../video/emscripten/SDL_emscriptenopengles.h | 10 +- .../video/emscripten/SDL_emscriptenvideo.c | 15 +- .../video/emscripten/SDL_emscriptenvideo.h | 12 +- Engine/lib/sdl/src/video/haiku/SDL_BWin.h | 23 +- .../lib/sdl/src/video/haiku/SDL_bclipboard.cc | 14 +- .../lib/sdl/src/video/haiku/SDL_bclipboard.h | 4 +- Engine/lib/sdl/src/video/haiku/SDL_bevents.cc | 4 +- Engine/lib/sdl/src/video/haiku/SDL_bevents.h | 4 +- .../sdl/src/video/haiku/SDL_bframebuffer.cc | 17 +- .../sdl/src/video/haiku/SDL_bframebuffer.h | 4 +- .../lib/sdl/src/video/haiku/SDL_bkeyboard.cc | 6 +- .../lib/sdl/src/video/haiku/SDL_bkeyboard.h | 6 +- Engine/lib/sdl/src/video/haiku/SDL_bmodes.cc | 8 +- Engine/lib/sdl/src/video/haiku/SDL_bmodes.h | 4 +- Engine/lib/sdl/src/video/haiku/SDL_bopengl.cc | 197 +- Engine/lib/sdl/src/video/haiku/SDL_bopengl.h | 10 +- Engine/lib/sdl/src/video/haiku/SDL_bvideo.cc | 11 +- Engine/lib/sdl/src/video/haiku/SDL_bvideo.h | 4 +- Engine/lib/sdl/src/video/haiku/SDL_bwindow.cc | 18 +- Engine/lib/sdl/src/video/haiku/SDL_bwindow.h | 3 +- Engine/lib/sdl/src/video/khronos/EGL/egl.h | 303 + Engine/lib/sdl/src/video/khronos/EGL/eglext.h | 1241 ++ .../sdl/src/video/khronos/EGL/eglplatform.h | 132 + Engine/lib/sdl/src/video/khronos/GLES2/gl2.h | 675 + .../lib/sdl/src/video/khronos/GLES2/gl2ext.h | 3505 ++++ .../sdl/src/video/khronos/GLES2/gl2platform.h | 38 + .../sdl/src/video/khronos/KHR/khrplatform.h | 284 + .../src/video/khronos/vulkan/vk_platform.h | 120 + .../lib/sdl/src/video/khronos/vulkan/vulkan.h | 6458 ++++++ .../lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.c | 171 + .../lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.h | 53 + .../sdl/src/video/kmsdrm/SDL_kmsdrmevents.c | 42 + .../sdl/src/video/kmsdrm/SDL_kmsdrmevents.h | 31 + .../sdl/src/video/kmsdrm/SDL_kmsdrmmouse.c | 501 + .../sdl/src/video/kmsdrm/SDL_kmsdrmmouse.h | 45 + .../sdl/src/video/kmsdrm/SDL_kmsdrmopengles.c | 189 + .../sdl/src/video/kmsdrm/SDL_kmsdrmopengles.h | 48 + .../lib/sdl/src/video/kmsdrm/SDL_kmsdrmsym.h | 99 + .../sdl/src/video/kmsdrm/SDL_kmsdrmvideo.c | 664 + .../sdl/src/video/kmsdrm/SDL_kmsdrmvideo.h | 124 + Engine/lib/sdl/src/video/mir/SDL_mirdyn.c | 2 +- Engine/lib/sdl/src/video/mir/SDL_mirdyn.h | 8 +- Engine/lib/sdl/src/video/mir/SDL_mirevents.c | 40 +- Engine/lib/sdl/src/video/mir/SDL_mirevents.h | 10 +- .../sdl/src/video/mir/SDL_mirframebuffer.c | 6 +- .../sdl/src/video/mir/SDL_mirframebuffer.h | 8 +- Engine/lib/sdl/src/video/mir/SDL_mirmouse.c | 48 +- Engine/lib/sdl/src/video/mir/SDL_mirmouse.h | 8 +- Engine/lib/sdl/src/video/mir/SDL_miropengl.c | 26 +- Engine/lib/sdl/src/video/mir/SDL_miropengl.h | 19 +- Engine/lib/sdl/src/video/mir/SDL_mirsym.h | 63 +- Engine/lib/sdl/src/video/mir/SDL_mirvideo.c | 35 +- Engine/lib/sdl/src/video/mir/SDL_mirvideo.h | 9 +- Engine/lib/sdl/src/video/mir/SDL_mirvulkan.c | 176 + Engine/lib/sdl/src/video/mir/SDL_mirvulkan.h | 52 + Engine/lib/sdl/src/video/mir/SDL_mirwindow.c | 216 +- Engine/lib/sdl/src/video/mir/SDL_mirwindow.h | 10 +- .../lib/sdl/src/video/nacl/SDL_naclevents.c | 46 +- .../lib/sdl/src/video/nacl/SDL_naclevents_c.h | 8 +- Engine/lib/sdl/src/video/nacl/SDL_naclglue.c | 2 +- .../lib/sdl/src/video/nacl/SDL_naclopengles.c | 11 +- .../lib/sdl/src/video/nacl/SDL_naclopengles.h | 10 +- Engine/lib/sdl/src/video/nacl/SDL_naclvideo.c | 6 +- Engine/lib/sdl/src/video/nacl/SDL_naclvideo.h | 8 +- .../lib/sdl/src/video/nacl/SDL_naclwindow.c | 2 +- .../lib/sdl/src/video/nacl/SDL_naclwindow.h | 8 +- .../lib/sdl/src/video/pandora/SDL_pandora.c | 20 +- .../lib/sdl/src/video/pandora/SDL_pandora.h | 4 +- .../src/video/pandora/SDL_pandora_events.c | 2 +- .../src/video/pandora/SDL_pandora_events.h | 2 +- Engine/lib/sdl/src/video/psp/SDL_pspevents.c | 6 +- .../lib/sdl/src/video/psp/SDL_pspevents_c.h | 2 +- Engine/lib/sdl/src/video/psp/SDL_pspgl.c | 13 +- Engine/lib/sdl/src/video/psp/SDL_pspgl_c.h | 12 +- Engine/lib/sdl/src/video/psp/SDL_pspmouse.c | 2 +- Engine/lib/sdl/src/video/psp/SDL_pspmouse_c.h | 2 +- Engine/lib/sdl/src/video/psp/SDL_pspvideo.c | 12 +- Engine/lib/sdl/src/video/psp/SDL_pspvideo.h | 10 +- Engine/lib/sdl/src/video/qnx/gl.c | 285 + Engine/lib/sdl/src/video/qnx/keyboard.c | 133 + Engine/lib/sdl/src/video/qnx/sdl_qnx.h | 48 + Engine/lib/sdl/src/video/qnx/video.c | 364 + .../sdl/src/video/raspberry/SDL_rpievents.c | 2 +- .../sdl/src/video/raspberry/SDL_rpievents_c.h | 8 +- .../sdl/src/video/raspberry/SDL_rpimouse.c | 67 +- .../sdl/src/video/raspberry/SDL_rpimouse.h | 8 +- .../sdl/src/video/raspberry/SDL_rpiopengles.c | 35 +- .../sdl/src/video/raspberry/SDL_rpiopengles.h | 11 +- .../sdl/src/video/raspberry/SDL_rpivideo.c | 78 +- .../sdl/src/video/raspberry/SDL_rpivideo.h | 12 +- Engine/lib/sdl/src/video/sdlgenblit.pl | 2 +- .../src/video/uikit/SDL_uikitappdelegate.h | 8 +- .../src/video/uikit/SDL_uikitappdelegate.m | 68 +- .../sdl/src/video/uikit/SDL_uikitclipboard.h | 8 +- .../sdl/src/video/uikit/SDL_uikitclipboard.m | 2 +- .../lib/sdl/src/video/uikit/SDL_uikitevents.h | 8 +- .../lib/sdl/src/video/uikit/SDL_uikitevents.m | 2 +- .../sdl/src/video/uikit/SDL_uikitmessagebox.h | 4 +- .../sdl/src/video/uikit/SDL_uikitmessagebox.m | 16 +- .../sdl/src/video/uikit/SDL_uikitmetalview.h | 58 + .../sdl/src/video/uikit/SDL_uikitmetalview.m | 124 + .../lib/sdl/src/video/uikit/SDL_uikitmodes.h | 8 +- .../lib/sdl/src/video/uikit/SDL_uikitmodes.m | 43 +- .../sdl/src/video/uikit/SDL_uikitopengles.h | 12 +- .../sdl/src/video/uikit/SDL_uikitopengles.m | 7 +- .../sdl/src/video/uikit/SDL_uikitopenglview.h | 2 +- .../sdl/src/video/uikit/SDL_uikitopenglview.m | 2 +- .../lib/sdl/src/video/uikit/SDL_uikitvideo.h | 10 +- .../lib/sdl/src/video/uikit/SDL_uikitvideo.m | 53 +- .../lib/sdl/src/video/uikit/SDL_uikitview.h | 2 +- .../lib/sdl/src/video/uikit/SDL_uikitview.m | 93 +- .../src/video/uikit/SDL_uikitviewcontroller.h | 6 +- .../src/video/uikit/SDL_uikitviewcontroller.m | 115 +- .../lib/sdl/src/video/uikit/SDL_uikitvulkan.h | 54 + .../lib/sdl/src/video/uikit/SDL_uikitvulkan.m | 222 + .../lib/sdl/src/video/uikit/SDL_uikitwindow.h | 8 +- .../lib/sdl/src/video/uikit/SDL_uikitwindow.m | 12 +- Engine/lib/sdl/src/video/uikit/keyinfotable.h | 2 +- .../src/video/vivante/SDL_vivanteopengles.c | 4 +- .../src/video/vivante/SDL_vivanteopengles.h | 10 +- .../src/video/vivante/SDL_vivanteplatform.c | 12 +- .../src/video/vivante/SDL_vivanteplatform.h | 10 +- .../sdl/src/video/vivante/SDL_vivantevideo.c | 18 +- .../sdl/src/video/vivante/SDL_vivantevideo.h | 8 +- .../src/video/wayland/SDL_waylandclipboard.c | 123 + .../src/video/wayland/SDL_waylandclipboard.h | 32 + .../video/wayland/SDL_waylanddatamanager.c | 468 + .../video/wayland/SDL_waylanddatamanager.h | 103 + .../sdl/src/video/wayland/SDL_waylanddyn.c | 2 +- .../sdl/src/video/wayland/SDL_waylanddyn.h | 12 +- .../sdl/src/video/wayland/SDL_waylandevents.c | 523 +- .../src/video/wayland/SDL_waylandevents_c.h | 13 +- .../sdl/src/video/wayland/SDL_waylandmouse.c | 24 +- .../sdl/src/video/wayland/SDL_waylandmouse.h | 2 +- .../src/video/wayland/SDL_waylandopengles.c | 12 +- .../src/video/wayland/SDL_waylandopengles.h | 13 +- .../sdl/src/video/wayland/SDL_waylandsym.h | 6 +- .../sdl/src/video/wayland/SDL_waylandtouch.c | 2 +- .../sdl/src/video/wayland/SDL_waylandtouch.h | 8 +- .../sdl/src/video/wayland/SDL_waylandvideo.c | 67 +- .../sdl/src/video/wayland/SDL_waylandvideo.h | 15 +- .../sdl/src/video/wayland/SDL_waylandvulkan.c | 176 + .../sdl/src/video/wayland/SDL_waylandvulkan.h | 52 + .../sdl/src/video/wayland/SDL_waylandwindow.c | 308 +- .../sdl/src/video/wayland/SDL_waylandwindow.h | 22 +- Engine/lib/sdl/src/video/windows/SDL_msctf.h | 8 +- Engine/lib/sdl/src/video/windows/SDL_vkeys.h | 2 +- .../src/video/windows/SDL_windowsclipboard.c | 2 +- .../src/video/windows/SDL_windowsclipboard.h | 8 +- .../sdl/src/video/windows/SDL_windowsevents.c | 427 +- .../sdl/src/video/windows/SDL_windowsevents.h | 8 +- .../video/windows/SDL_windowsframebuffer.c | 2 +- .../video/windows/SDL_windowsframebuffer.h | 2 +- .../src/video/windows/SDL_windowskeyboard.c | 49 +- .../src/video/windows/SDL_windowskeyboard.h | 8 +- .../src/video/windows/SDL_windowsmessagebox.c | 30 +- .../src/video/windows/SDL_windowsmessagebox.h | 2 +- .../sdl/src/video/windows/SDL_windowsmodes.c | 335 +- .../sdl/src/video/windows/SDL_windowsmodes.h | 14 +- .../sdl/src/video/windows/SDL_windowsmouse.c | 9 +- .../sdl/src/video/windows/SDL_windowsmouse.h | 8 +- .../sdl/src/video/windows/SDL_windowsopengl.c | 115 +- .../sdl/src/video/windows/SDL_windowsopengl.h | 25 +- .../src/video/windows/SDL_windowsopengles.c | 17 +- .../src/video/windows/SDL_windowsopengles.h | 14 +- .../sdl/src/video/windows/SDL_windowsshape.c | 4 +- .../sdl/src/video/windows/SDL_windowsshape.h | 8 +- .../sdl/src/video/windows/SDL_windowsvideo.c | 26 +- .../sdl/src/video/windows/SDL_windowsvideo.h | 8 +- .../sdl/src/video/windows/SDL_windowsvulkan.c | 176 + .../sdl/src/video/windows/SDL_windowsvulkan.h | 52 + .../sdl/src/video/windows/SDL_windowswindow.c | 311 +- .../sdl/src/video/windows/SDL_windowswindow.h | 11 +- Engine/lib/sdl/src/video/windows/wmmsg.h | 2 +- .../sdl/src/video/winrt/SDL_winrtevents.cpp | 4 +- .../sdl/src/video/winrt/SDL_winrtevents_c.h | 4 +- .../sdl/src/video/winrt/SDL_winrtgamebar.cpp | 2 +- .../src/video/winrt/SDL_winrtgamebar_cpp.h | 8 +- .../sdl/src/video/winrt/SDL_winrtkeyboard.cpp | 4 +- .../src/video/winrt/SDL_winrtmessagebox.cpp | 2 +- .../sdl/src/video/winrt/SDL_winrtmessagebox.h | 2 +- .../sdl/src/video/winrt/SDL_winrtmouse.cpp | 2 +- .../sdl/src/video/winrt/SDL_winrtmouse_c.h | 8 +- .../sdl/src/video/winrt/SDL_winrtopengles.cpp | 19 +- .../sdl/src/video/winrt/SDL_winrtopengles.h | 10 +- .../src/video/winrt/SDL_winrtpointerinput.cpp | 11 +- .../sdl/src/video/winrt/SDL_winrtvideo.cpp | 10 +- .../sdl/src/video/winrt/SDL_winrtvideo_cpp.h | 2 +- .../lib/sdl/src/video/x11/SDL_x11clipboard.c | 22 +- .../lib/sdl/src/video/x11/SDL_x11clipboard.h | 8 +- Engine/lib/sdl/src/video/x11/SDL_x11dyn.c | 2 +- Engine/lib/sdl/src/video/x11/SDL_x11dyn.h | 8 +- Engine/lib/sdl/src/video/x11/SDL_x11events.c | 220 +- Engine/lib/sdl/src/video/x11/SDL_x11events.h | 8 +- .../sdl/src/video/x11/SDL_x11framebuffer.c | 4 +- .../sdl/src/video/x11/SDL_x11framebuffer.h | 2 +- .../lib/sdl/src/video/x11/SDL_x11keyboard.c | 89 +- .../lib/sdl/src/video/x11/SDL_x11keyboard.h | 8 +- .../lib/sdl/src/video/x11/SDL_x11messagebox.c | 36 +- .../lib/sdl/src/video/x11/SDL_x11messagebox.h | 2 +- Engine/lib/sdl/src/video/x11/SDL_x11modes.c | 54 +- Engine/lib/sdl/src/video/x11/SDL_x11modes.h | 8 +- Engine/lib/sdl/src/video/x11/SDL_x11mouse.c | 22 +- Engine/lib/sdl/src/video/x11/SDL_x11mouse.h | 8 +- Engine/lib/sdl/src/video/x11/SDL_x11opengl.c | 184 +- Engine/lib/sdl/src/video/x11/SDL_x11opengl.h | 23 +- .../lib/sdl/src/video/x11/SDL_x11opengles.c | 4 +- .../lib/sdl/src/video/x11/SDL_x11opengles.h | 13 +- Engine/lib/sdl/src/video/x11/SDL_x11shape.c | 8 +- Engine/lib/sdl/src/video/x11/SDL_x11shape.h | 9 +- Engine/lib/sdl/src/video/x11/SDL_x11sym.h | 5 +- Engine/lib/sdl/src/video/x11/SDL_x11touch.c | 9 +- Engine/lib/sdl/src/video/x11/SDL_x11touch.h | 9 +- Engine/lib/sdl/src/video/x11/SDL_x11video.c | 91 +- Engine/lib/sdl/src/video/x11/SDL_x11video.h | 22 +- Engine/lib/sdl/src/video/x11/SDL_x11vulkan.c | 243 + Engine/lib/sdl/src/video/x11/SDL_x11vulkan.h | 48 + Engine/lib/sdl/src/video/x11/SDL_x11window.c | 70 +- Engine/lib/sdl/src/video/x11/SDL_x11window.h | 8 +- Engine/lib/sdl/src/video/x11/SDL_x11xinput2.c | 49 +- Engine/lib/sdl/src/video/x11/SDL_x11xinput2.h | 8 +- Engine/lib/sdl/src/video/x11/edid-parse.c | 92 +- Engine/lib/sdl/src/video/x11/edid.h | 4 +- Engine/lib/sdl/src/video/yuv2rgb/LICENSE | 27 + Engine/lib/sdl/src/video/yuv2rgb/README.md | 63 + Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb.c | 687 + Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb.h | 381 + .../sdl/src/video/yuv2rgb/yuv_rgb_sse_func.h | 498 + .../sdl/src/video/yuv2rgb/yuv_rgb_std_func.h | 220 + Engine/lib/sdl/test/CMakeLists.txt | 122 + Engine/lib/sdl/test/Makefile.in | 51 +- Engine/lib/sdl/test/axis.bmp | Bin 3746 -> 10138 bytes Engine/lib/sdl/test/checkkeys.c | 16 +- Engine/lib/sdl/test/controllermap.c | 774 +- Engine/lib/sdl/test/loopwave.c | 90 +- Engine/lib/sdl/test/loopwavequeue.c | 5 +- Engine/lib/sdl/test/nacl/common.js | 7 +- Engine/lib/sdl/test/testatomic.c | 17 +- Engine/lib/sdl/test/testaudiocapture.c | 2 +- Engine/lib/sdl/test/testaudiohotplug.c | 2 +- Engine/lib/sdl/test/testaudioinfo.c | 2 +- Engine/lib/sdl/test/testautomation.c | 2 +- Engine/lib/sdl/test/testautomation_audio.c | 2 +- .../lib/sdl/test/testautomation_clipboard.c | 2 +- Engine/lib/sdl/test/testautomation_events.c | 2 +- Engine/lib/sdl/test/testautomation_keyboard.c | 2 +- Engine/lib/sdl/test/testautomation_mouse.c | 16 +- Engine/lib/sdl/test/testautomation_platform.c | 36 +- Engine/lib/sdl/test/testautomation_rwops.c | 54 +- Engine/lib/sdl/test/testautomation_sdltest.c | 72 +- Engine/lib/sdl/test/testautomation_stdlib.c | 24 +- Engine/lib/sdl/test/testautomation_timer.c | 2 +- Engine/lib/sdl/test/testbounds.c | 2 +- Engine/lib/sdl/test/testcustomcursor.c | 2 +- Engine/lib/sdl/test/testdisplayinfo.c | 2 +- Engine/lib/sdl/test/testdraw2.c | 2 +- Engine/lib/sdl/test/testdrawchessboard.c | 22 +- Engine/lib/sdl/test/testdropfile.c | 2 +- Engine/lib/sdl/test/testerror.c | 3 +- Engine/lib/sdl/test/testfile.c | 2 +- Engine/lib/sdl/test/testfilesystem.c | 11 +- Engine/lib/sdl/test/testgamecontroller.c | 44 +- Engine/lib/sdl/test/testgesture.c | 3 +- Engine/lib/sdl/test/testgl2.c | 4 +- Engine/lib/sdl/test/testgles.c | 2 +- Engine/lib/sdl/test/testgles2.c | 7 +- Engine/lib/sdl/test/testhittesting.c | 2 +- Engine/lib/sdl/test/testhotplug.c | 2 +- Engine/lib/sdl/test/testiconv.c | 2 +- Engine/lib/sdl/test/testime.c | 62 +- Engine/lib/sdl/test/testintersections.c | 2 +- Engine/lib/sdl/test/testjoystick.c | 41 +- Engine/lib/sdl/test/testkeys.c | 2 +- Engine/lib/sdl/test/testloadso.c | 2 +- Engine/lib/sdl/test/testlock.c | 2 +- Engine/lib/sdl/test/testmessage.c | 8 +- Engine/lib/sdl/test/testmultiaudio.c | 2 +- Engine/lib/sdl/test/testnative.c | 2 +- Engine/lib/sdl/test/testnative.h | 2 +- Engine/lib/sdl/test/testnativew32.c | 2 +- Engine/lib/sdl/test/testnativex11.c | 2 +- Engine/lib/sdl/test/testoverlay2.c | 293 +- Engine/lib/sdl/test/testplatform.c | 239 +- Engine/lib/sdl/test/testpower.c | 2 +- Engine/lib/sdl/test/testqsort.c | 2 +- Engine/lib/sdl/test/testrelative.c | 2 +- Engine/lib/sdl/test/testrendercopyex.c | 2 +- Engine/lib/sdl/test/testrendertarget.c | 2 +- Engine/lib/sdl/test/testresample.c | 16 +- Engine/lib/sdl/test/testrumble.c | 9 +- Engine/lib/sdl/test/testscale.c | 2 +- Engine/lib/sdl/test/testsem.c | 2 +- Engine/lib/sdl/test/testshader.c | 2 +- Engine/lib/sdl/test/testshape.c | 17 +- Engine/lib/sdl/test/testsprite2.c | 12 +- Engine/lib/sdl/test/testspriteminimal.c | 2 +- Engine/lib/sdl/test/teststreaming.c | 2 +- Engine/lib/sdl/test/testthread.c | 2 +- Engine/lib/sdl/test/testtimer.c | 2 +- Engine/lib/sdl/test/testver.c | 2 +- Engine/lib/sdl/test/testviewport.c | 2 +- Engine/lib/sdl/test/testvulkan.c | 1201 ++ Engine/lib/sdl/test/testwm2.c | 2 +- Engine/lib/sdl/test/testyuv.bmp | Bin 0 -> 739398 bytes Engine/lib/sdl/test/testyuv.c | 455 + Engine/lib/sdl/test/testyuv_cvt.c | 300 + Engine/lib/sdl/test/testyuv_cvt.h | 16 + Engine/lib/sdl/test/torturethread.c | 2 +- 894 files changed, 66879 insertions(+), 43299 deletions(-) create mode 100644 Engine/lib/sdl/SDL2Config.cmake delete mode 100644 Engine/lib/sdl/Xcode/SDL/Info-Framework.plist delete mode 100755 Engine/lib/sdl/Xcode/SDL/SDL.xcodeproj/project.pbxproj delete mode 100755 Engine/lib/sdl/Xcode/SDL/pkg-support/SDL.info delete mode 100644 Engine/lib/sdl/Xcode/SDL/pkg-support/resources/License.txt delete mode 100755 Engine/lib/sdl/Xcode/SDL/pkg-support/resources/ReadMe.txt delete mode 100644 Engine/lib/sdl/Xcode/SDL/pkg-support/resources/SDL_DS_Store delete mode 100644 Engine/lib/sdl/Xcode/SDL/pkg-support/sdl_logo.pdf delete mode 100755 Engine/lib/sdl/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj delete mode 100644 Engine/lib/sdl/Xcode/SDLTest/TestDropFile-Info.plist delete mode 100644 Engine/lib/sdl/Xcode/XcodeDocSet/Doxyfile create mode 100755 Engine/lib/sdl/build-scripts/androidbuildlibs.sh create mode 100644 Engine/lib/sdl/build-scripts/config.sub.patch create mode 100644 Engine/lib/sdl/include/SDL_test_memory.h create mode 100644 Engine/lib/sdl/include/SDL_vulkan.h create mode 100644 Engine/lib/sdl/src/SDL_dataqueue.c create mode 100644 Engine/lib/sdl/src/SDL_dataqueue.h create mode 100644 Engine/lib/sdl/src/audio/jack/SDL_jackaudio.c create mode 100644 Engine/lib/sdl/src/audio/jack/SDL_jackaudio.h rename Engine/lib/sdl/src/audio/{bsd/SDL_bsdaudio.c => netbsd/SDL_netbsdaudio.c} (88%) rename Engine/lib/sdl/src/audio/{bsd/SDL_bsdaudio.h => netbsd/SDL_netbsdaudio.h} (81%) delete mode 100755 Engine/lib/sdl/src/audio/sdlgenaudiocvt.pl create mode 100644 Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.c create mode 100644 Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.h create mode 100644 Engine/lib/sdl/src/audio/wasapi/SDL_wasapi_win32.c create mode 100644 Engine/lib/sdl/src/audio/wasapi/SDL_wasapi_winrt.cpp delete mode 100644 Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2.c delete mode 100644 Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2.h delete mode 100644 Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp delete mode 100644 Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h create mode 100644 Engine/lib/sdl/src/core/android/keyinfotable.h create mode 100644 Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.c create mode 100644 Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.h create mode 100644 Engine/lib/sdl/src/core/linux/SDL_evdev_kbd_default_accents.h create mode 100644 Engine/lib/sdl/src/core/linux/SDL_evdev_kbd_default_keymap.h create mode 100644 Engine/lib/sdl/src/core/unix/SDL_poll.c create mode 100644 Engine/lib/sdl/src/core/unix/SDL_poll.h create mode 100644 Engine/lib/sdl/src/haptic/android/SDL_syshaptic.c create mode 100644 Engine/lib/sdl/src/haptic/android/SDL_syshaptic_c.h create mode 100644 Engine/lib/sdl/src/joystick/steam/SDL_steamcontroller.c create mode 100644 Engine/lib/sdl/src/joystick/steam/SDL_steamcontroller.h create mode 100644 Engine/lib/sdl/src/libm/e_fmod.c create mode 100644 Engine/lib/sdl/src/libm/e_log10.c delete mode 100644 Engine/lib/sdl/src/loadso/haiku/SDL_sysloadso.c create mode 100644 Engine/lib/sdl/src/power/SDL_syspower.h delete mode 100644 Engine/lib/sdl/src/render/SDL_yuv_mmx.c create mode 100644 Engine/lib/sdl/src/render/direct3d/SDL_shaders_d3d.c create mode 100644 Engine/lib/sdl/src/render/direct3d/SDL_shaders_d3d.h create mode 100644 Engine/lib/sdl/src/render/direct3d11/SDL_shaders_d3d11.c create mode 100644 Engine/lib/sdl/src/render/direct3d11/SDL_shaders_d3d11.h create mode 100644 Engine/lib/sdl/src/render/metal/SDL_render_metal.m create mode 100644 Engine/lib/sdl/src/render/metal/SDL_shaders_metal.metal create mode 100644 Engine/lib/sdl/src/render/metal/SDL_shaders_metal_ios.h create mode 100644 Engine/lib/sdl/src/render/metal/SDL_shaders_metal_osx.h create mode 100755 Engine/lib/sdl/src/render/metal/build-metal-shaders.sh delete mode 100644 Engine/lib/sdl/src/render/mmx.h create mode 100644 Engine/lib/sdl/src/test/SDL_test_memory.c create mode 100644 Engine/lib/sdl/src/video/SDL_vulkan_internal.h create mode 100644 Engine/lib/sdl/src/video/SDL_vulkan_utils.c create mode 100644 Engine/lib/sdl/src/video/SDL_yuv.c create mode 100644 Engine/lib/sdl/src/video/SDL_yuv_c.h create mode 100644 Engine/lib/sdl/src/video/android/SDL_androidgl.h create mode 100644 Engine/lib/sdl/src/video/android/SDL_androidvulkan.c create mode 100644 Engine/lib/sdl/src/video/android/SDL_androidvulkan.h create mode 100644 Engine/lib/sdl/src/video/cocoa/SDL_cocoametalview.h create mode 100644 Engine/lib/sdl/src/video/cocoa/SDL_cocoametalview.m create mode 100644 Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengles.h create mode 100644 Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengles.m create mode 100644 Engine/lib/sdl/src/video/cocoa/SDL_cocoavulkan.h create mode 100644 Engine/lib/sdl/src/video/cocoa/SDL_cocoavulkan.m create mode 100644 Engine/lib/sdl/src/video/khronos/EGL/egl.h create mode 100644 Engine/lib/sdl/src/video/khronos/EGL/eglext.h create mode 100644 Engine/lib/sdl/src/video/khronos/EGL/eglplatform.h create mode 100644 Engine/lib/sdl/src/video/khronos/GLES2/gl2.h create mode 100644 Engine/lib/sdl/src/video/khronos/GLES2/gl2ext.h create mode 100644 Engine/lib/sdl/src/video/khronos/GLES2/gl2platform.h create mode 100644 Engine/lib/sdl/src/video/khronos/KHR/khrplatform.h create mode 100644 Engine/lib/sdl/src/video/khronos/vulkan/vk_platform.h create mode 100644 Engine/lib/sdl/src/video/khronos/vulkan/vulkan.h create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.c create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.h create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmevents.c create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmevents.h create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmmouse.c create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmmouse.h create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmopengles.c create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmopengles.h create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmsym.h create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmvideo.c create mode 100644 Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmvideo.h create mode 100644 Engine/lib/sdl/src/video/mir/SDL_mirvulkan.c create mode 100644 Engine/lib/sdl/src/video/mir/SDL_mirvulkan.h create mode 100644 Engine/lib/sdl/src/video/qnx/gl.c create mode 100644 Engine/lib/sdl/src/video/qnx/keyboard.c create mode 100644 Engine/lib/sdl/src/video/qnx/sdl_qnx.h create mode 100644 Engine/lib/sdl/src/video/qnx/video.c create mode 100644 Engine/lib/sdl/src/video/uikit/SDL_uikitmetalview.h create mode 100644 Engine/lib/sdl/src/video/uikit/SDL_uikitmetalview.m create mode 100644 Engine/lib/sdl/src/video/uikit/SDL_uikitvulkan.h create mode 100644 Engine/lib/sdl/src/video/uikit/SDL_uikitvulkan.m create mode 100644 Engine/lib/sdl/src/video/wayland/SDL_waylandclipboard.c create mode 100644 Engine/lib/sdl/src/video/wayland/SDL_waylandclipboard.h create mode 100644 Engine/lib/sdl/src/video/wayland/SDL_waylanddatamanager.c create mode 100644 Engine/lib/sdl/src/video/wayland/SDL_waylanddatamanager.h create mode 100644 Engine/lib/sdl/src/video/wayland/SDL_waylandvulkan.c create mode 100644 Engine/lib/sdl/src/video/wayland/SDL_waylandvulkan.h create mode 100644 Engine/lib/sdl/src/video/windows/SDL_windowsvulkan.c create mode 100644 Engine/lib/sdl/src/video/windows/SDL_windowsvulkan.h create mode 100644 Engine/lib/sdl/src/video/x11/SDL_x11vulkan.c create mode 100644 Engine/lib/sdl/src/video/x11/SDL_x11vulkan.h create mode 100644 Engine/lib/sdl/src/video/yuv2rgb/LICENSE create mode 100644 Engine/lib/sdl/src/video/yuv2rgb/README.md create mode 100644 Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb.c create mode 100644 Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb.h create mode 100644 Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb_sse_func.h create mode 100644 Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb_std_func.h create mode 100644 Engine/lib/sdl/test/CMakeLists.txt create mode 100644 Engine/lib/sdl/test/testvulkan.c create mode 100644 Engine/lib/sdl/test/testyuv.bmp create mode 100644 Engine/lib/sdl/test/testyuv.c create mode 100644 Engine/lib/sdl/test/testyuv_cvt.c create mode 100644 Engine/lib/sdl/test/testyuv_cvt.h diff --git a/Engine/lib/sdl/Android.mk b/Engine/lib/sdl/Android.mk index 13d765f57..d56b5c00c 100755 --- a/Engine/lib/sdl/Android.mk +++ b/Engine/lib/sdl/Android.mk @@ -20,7 +20,7 @@ LOCAL_SRC_FILES := \ $(wildcard $(LOCAL_PATH)/src/audio/*.c) \ $(wildcard $(LOCAL_PATH)/src/audio/android/*.c) \ $(wildcard $(LOCAL_PATH)/src/audio/dummy/*.c) \ - $(LOCAL_PATH)/src/atomic/SDL_atomic.c \ + $(LOCAL_PATH)/src/atomic/SDL_atomic.c.arm \ $(LOCAL_PATH)/src/atomic/SDL_spinlock.c.arm \ $(wildcard $(LOCAL_PATH)/src/core/android/*.c) \ $(wildcard $(LOCAL_PATH)/src/cpuinfo/*.c) \ @@ -28,9 +28,10 @@ LOCAL_SRC_FILES := \ $(wildcard $(LOCAL_PATH)/src/events/*.c) \ $(wildcard $(LOCAL_PATH)/src/file/*.c) \ $(wildcard $(LOCAL_PATH)/src/haptic/*.c) \ - $(wildcard $(LOCAL_PATH)/src/haptic/dummy/*.c) \ + $(wildcard $(LOCAL_PATH)/src/haptic/android/*.c) \ $(wildcard $(LOCAL_PATH)/src/joystick/*.c) \ $(wildcard $(LOCAL_PATH)/src/joystick/android/*.c) \ + $(LOCAL_PATH)/src/joystick/steam/SDL_steamcontroller.c \ $(wildcard $(LOCAL_PATH)/src/loadso/dlopen/*.c) \ $(wildcard $(LOCAL_PATH)/src/power/*.c) \ $(wildcard $(LOCAL_PATH)/src/power/android/*.c) \ @@ -44,11 +45,14 @@ LOCAL_SRC_FILES := \ $(wildcard $(LOCAL_PATH)/src/timer/unix/*.c) \ $(wildcard $(LOCAL_PATH)/src/video/*.c) \ $(wildcard $(LOCAL_PATH)/src/video/android/*.c) \ + $(wildcard $(LOCAL_PATH)/src/video/yuv2rgb/*.c) \ $(wildcard $(LOCAL_PATH)/src/test/*.c)) LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES LOCAL_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid +cmd-strip := + include $(BUILD_SHARED_LIBRARY) ########################### @@ -61,9 +65,25 @@ LOCAL_MODULE := SDL2_static LOCAL_MODULE_FILENAME := libSDL2 -LOCAL_SRC_FILES += $(subst $(LOCAL_PATH)/,,$(LOCAL_PATH)/src/main/android/SDL_android_main.c) - LOCAL_LDLIBS := -LOCAL_EXPORT_LDLIBS := -Wl,--undefined=Java_org_libsdl_app_SDLActivity_nativeInit -ldl -lGLESv1_CM -lGLESv2 -llog -landroid +LOCAL_EXPORT_LDLIBS := -ldl -lGLESv1_CM -lGLESv2 -llog -landroid include $(BUILD_STATIC_LIBRARY) + +########################### +# +# SDL main static library +# +########################### + +include $(CLEAR_VARS) + +LOCAL_C_INCLUDES := $(LOCAL_PATH)/include + +LOCAL_MODULE := SDL2_main + +LOCAL_MODULE_FILENAME := libSDL2main + +include $(BUILD_STATIC_LIBRARY) + + diff --git a/Engine/lib/sdl/BUGS.txt b/Engine/lib/sdl/BUGS.txt index 6a4cbb7ad..a8e6b952e 100644 --- a/Engine/lib/sdl/BUGS.txt +++ b/Engine/lib/sdl/BUGS.txt @@ -7,9 +7,9 @@ You may report bugs there, and search to see if a given issue has already been reported, discussed, and maybe even fixed. -You may also find help on the SDL mailing list. Subscription information: +You may also find help at the SDL forums/mailing list: - http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org + https://discourse.libsdl.org/ Bug reports are welcome here, but we really appreciate if you use Bugzilla, as bugs discussed on the mailing list may be forgotten or missed. diff --git a/Engine/lib/sdl/CMakeLists.txt b/Engine/lib/sdl/CMakeLists.txt index ef82e73a0..8f1e828d1 100644 --- a/Engine/lib/sdl/CMakeLists.txt +++ b/Engine/lib/sdl/CMakeLists.txt @@ -2,7 +2,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the SDL source code and call cmake from there") endif() -cmake_minimum_required(VERSION 2.8.5) +cmake_minimum_required(VERSION 2.8.11) project(SDL2 C) # !!! FIXME: this should probably do "MACOSX_RPATH ON" as a target property @@ -20,6 +20,7 @@ include(CheckLibraryExists) include(CheckIncludeFiles) include(CheckIncludeFile) include(CheckSymbolExists) +include(CheckCSourceCompiles) include(CheckCSourceRuns) include(CheckCCompilerFlag) include(CheckTypeSize) @@ -41,11 +42,17 @@ include(${SDL2_SOURCE_DIR}/cmake/sdlchecks.cmake) # set SDL_BINARY_AGE and SDL_INTERFACE_AGE to 0. set(SDL_MAJOR_VERSION 2) set(SDL_MINOR_VERSION 0) -set(SDL_MICRO_VERSION 5) -set(SDL_INTERFACE_AGE 1) -set(SDL_BINARY_AGE 5) +set(SDL_MICRO_VERSION 8) +set(SDL_INTERFACE_AGE 0) +set(SDL_BINARY_AGE 8) set(SDL_VERSION "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}.${SDL_MICRO_VERSION}") +# Set defaults preventing destination file conflicts +set(SDL_CMAKE_DEBUG_POSTFIX "d" + CACHE STRING "Name suffix for debug builds") + +mark_as_advanced(CMAKE_IMPORT_LIBRARY_SUFFIX SDL_CMAKE_DEBUG_POSTFIX) + # Calculate a libtool-like version number math(EXPR LT_CURRENT "${SDL_MICRO_VERSION} - ${SDL_INTERFACE_AGE}") math(EXPR LT_AGE "${SDL_BINARY_AGE} - ${SDL_INTERFACE_AGE}") @@ -137,7 +144,9 @@ endif() # Default option knobs if(APPLE OR ARCH_64) - set(OPT_DEF_SSEMATH ON) + if(NOT "${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm") + set(OPT_DEF_SSEMATH ON) + endif() endif() if(UNIX OR MINGW OR MSYS) set(OPT_DEF_LIBC ON) @@ -157,6 +166,10 @@ else() set(OPT_DEF_ASM FALSE) endif() +if(USE_GCC OR USE_CLANG) + set(OPT_DEF_GCC_ATOMICS ON) +endif() + # Default flags, if not set otherwise if("$ENV{CFLAGS}" STREQUAL "") if(CMAKE_BUILD_TYPE STREQUAL "") @@ -220,6 +233,11 @@ endif() add_definitions(-DUSING_GENERATED_CONFIG_H) # General includes include_directories(${SDL2_BINARY_DIR}/include ${SDL2_SOURCE_DIR}/include) +if(USE_GCC OR USE_CLANG) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -idirafter ${SDL2_SOURCE_DIR}/src/video/khronos") +else() + include_directories(${SDL2_SOURCE_DIR}/src/video/khronos) +endif() # All these ENABLED_BY_DEFAULT vars will default to ON if not specified, so # you only need to have a platform override them if they are disabling. @@ -255,20 +273,19 @@ endforeach() option_string(ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto") #set_option(DEPENDENCY_TRACKING "Use gcc -MMD -MT dependency tracking" ON) set_option(LIBC "Use the system C library" ${OPT_DEF_LIBC}) -set_option(GCC_ATOMICS "Use gcc builtin atomics" ${USE_GCC}) +set_option(GCC_ATOMICS "Use gcc builtin atomics" ${OPT_DEF_GCC_ATOMICS}) set_option(ASSEMBLY "Enable assembly routines" ${OPT_DEF_ASM}) set_option(SSEMATH "Allow GCC to use SSE floating point math" ${OPT_DEF_SSEMATH}) set_option(MMX "Use MMX assembly routines" ${OPT_DEF_ASM}) set_option(3DNOW "Use 3Dnow! MMX assembly routines" ${OPT_DEF_ASM}) set_option(SSE "Use SSE assembly routines" ${OPT_DEF_ASM}) set_option(SSE2 "Use SSE2 assembly routines" ${OPT_DEF_SSEMATH}) +set_option(SSE3 "Use SSE3 assembly routines" ${OPT_DEF_SSEMATH}) set_option(ALTIVEC "Use Altivec assembly routines" ${OPT_DEF_ASM}) set_option(DISKAUDIO "Support the disk writer audio driver" ON) set_option(DUMMYAUDIO "Support the dummy audio driver" ON) set_option(VIDEO_DIRECTFB "Use DirectFB video driver" OFF) dep_option(DIRECTFB_SHARED "Dynamically load directfb support" ON "VIDEO_DIRECTFB" OFF) -set_option(FUSIONSOUND "Use FusionSound audio driver" OFF) -dep_option(FUSIONSOUND_SHARED "Dynamically load fusionsound audio support" ON "FUSIONSOUND" OFF) set_option(VIDEO_DUMMY "Use dummy video driver" ON) set_option(VIDEO_OPENGL "Include OpenGL support" ON) set_option(VIDEO_OPENGLES "Include OpenGL ES support" ON) @@ -278,6 +295,8 @@ set_option(SDL_DLOPEN "Use dlopen for shared object loading" ${SDL_DLOP set_option(OSS "Support the OSS audio API" ${UNIX_SYS}) set_option(ALSA "Support the ALSA audio API" ${UNIX_SYS}) dep_option(ALSA_SHARED "Dynamically load ALSA audio support" ON "ALSA" OFF) +set_option(JACK "Support the JACK audio API" ${UNIX_SYS}) +dep_option(JACK_SHARED "Dynamically load JACK audio support" ON "JACK" OFF) set_option(ESD "Support the Enlightened Sound Daemon" ${UNIX_SYS}) dep_option(ESD_SHARED "Dynamically load ESD audio support" ON "ESD" OFF) set_option(PULSEAUDIO "Use PulseAudio" ${UNIX_SYS}) @@ -287,6 +306,10 @@ dep_option(ARTS_SHARED "Dynamically load aRts audio support" ON "ARTS" O set_option(NAS "Support the NAS audio API" ${UNIX_SYS}) set_option(NAS_SHARED "Dynamically load NAS audio API" ${UNIX_SYS}) set_option(SNDIO "Support the sndio audio API" ${UNIX_SYS}) +set_option(FUSIONSOUND "Use FusionSound audio driver" OFF) +dep_option(FUSIONSOUND_SHARED "Dynamically load fusionsound audio support" ON "FUSIONSOUND" OFF) +set_option(LIBSAMPLERATE "Use libsamplerate for audio rate conversion" ${UNIX_SYS}) +dep_option(LIBSAMPLERATE_SHARED "Dynamically load libsamplerate" ON "LIBSAMPLERATE" OFF) set_option(RPATH "Use an rpath when linking SDL" ${UNIX_SYS}) set_option(CLOCK_GETTIME "Use clock_gettime() instead of gettimeofday()" OFF) set_option(INPUT_TSLIB "Use the Touchscreen library for input" ${UNIX_SYS}) @@ -307,6 +330,9 @@ set_option(VIDEO_COCOA "Use Cocoa video driver" ${APPLE}) set_option(DIRECTX "Use DirectX for Windows audio/video" ${WINDOWS}) set_option(RENDER_D3D "Enable the Direct3D render driver" ${WINDOWS}) set_option(VIDEO_VIVANTE "Use Vivante EGL video driver" ${UNIX_SYS}) +dep_option(VIDEO_VULKAN "Enable Vulkan support" ON "ANDROID OR APPLE OR LINUX OR WINDOWS" OFF) +set_option(VIDEO_KMSDRM "Use KMS DRM video driver" ${UNIX_SYS}) +dep_option(KMSDRM_SHARED "Dynamically load KMS DRM support" ON "VIDEO_KMSDRM" OFF) # TODO: We should (should we?) respect cmake's ${BUILD_SHARED_LIBS} flag here # The options below are for compatibility to configure's default behaviour. @@ -314,6 +340,7 @@ set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared versi set(SDL_STATIC ON CACHE BOOL "Build a static version of the library") dep_option(SDL_STATIC_PIC "Static version of the library should be built with Position Independent Code" OFF "SDL_STATIC" OFF) +set_option(SDL_TEST "Build the test directory" OFF) # General source files file(GLOB SOURCE_FILES @@ -330,7 +357,8 @@ file(GLOB SOURCE_FILES ${SDL2_SOURCE_DIR}/src/stdlib/*.c ${SDL2_SOURCE_DIR}/src/thread/*.c ${SDL2_SOURCE_DIR}/src/timer/*.c - ${SDL2_SOURCE_DIR}/src/video/*.c) + ${SDL2_SOURCE_DIR}/src/video/*.c + ${SDL2_SOURCE_DIR}/src/video/yuv2rgb/*.c) if(ASSERTIONS STREQUAL "auto") @@ -414,11 +442,15 @@ if(USE_GCC OR USE_CLANG) list(APPEND EXTRA_CFLAGS "-Wshadow") endif() - set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined") - check_c_compiler_flag("" HAVE_NO_UNDEFINED) - set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) - if(HAVE_NO_UNDEFINED) - list(APPEND EXTRA_LDFLAGS "-Wl,--no-undefined") + if(APPLE) + list(APPEND EXTRA_LDFLAGS "-Wl,-undefined,error") + else() + set(CMAKE_REQUIRED_FLAGS "-Wl,--no-undefined") + check_c_compiler_flag("" HAVE_NO_UNDEFINED) + set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) + if(HAVE_NO_UNDEFINED) + list(APPEND EXTRA_LDFLAGS "-Wl,--no-undefined") + endif() endif() endif() @@ -514,15 +546,43 @@ if(ASSEMBLY) set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) endif() - if(SSEMATH) - if(SSE OR SSE2) + if(SSE3) + set(CMAKE_REQUIRED_FLAGS "-msse3") + check_c_source_compiles(" + #ifdef __MINGW32__ + #include <_mingw.h> + #ifdef __MINGW64_VERSION_MAJOR + #include + #else + #include + #endif + #else + #include + #endif + #ifndef __SSE3__ + #error Assembler CPP flag not enabled + #endif + int main(int argc, char **argv) { }" HAVE_SSE3) + if(HAVE_SSE3) + list(APPEND EXTRA_CFLAGS "-msse3") + endif() + set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) + endif() + + if(NOT SSEMATH) + if(SSE OR SSE2 OR SSE3) if(USE_GCC) - list(APPEND EXTRA_CFLAGS "-mfpmath=387") + check_c_compiler_flag(-mfpmath=387 HAVE_FP_387) + if(HAVE_FP_387) + list(APPEND EXTRA_CFLAGS "-mfpmath=387") + endif() endif() set(HAVE_SSEMATH TRUE) endif() endif() + check_include_file("immintrin.h" HAVE_IMMINTRIN_H) + if(ALTIVEC) set(CMAKE_REQUIRED_FLAGS "-maltivec") check_c_source_compiles(" @@ -555,12 +615,13 @@ if(ASSEMBLY) endif() set(HAVE_SSE TRUE) set(HAVE_SSE2 TRUE) + set(HAVE_SSE3 TRUE) set(SDL_ASSEMBLY_ROUTINES 1) endif() # TODO: #else() # if(USE_GCC OR USE_CLANG) -# list(APPEND EXTRA_CFLAGS "-mno-sse" "-mno-sse2" "-mno-mmx") +# list(APPEND EXTRA_CFLAGS "-mno-sse" "-mno-sse2" "-mno-sse3" "-mno-mmx") # endif() endif() @@ -569,7 +630,7 @@ endif() if(LIBC) if(WINDOWS AND NOT MINGW) set(HAVE_LIBC TRUE) - foreach(_HEADER stdio.h string.h ctype.h math.h) + foreach(_HEADER stdio.h string.h wchar.h ctype.h math.h limits.h) string(TOUPPER "HAVE_${_HEADER}" _UPPER) string(REPLACE "." "_" _HAVE_H ${_UPPER}) set(${_HAVE_H} 1) @@ -577,10 +638,13 @@ if(LIBC) set(HAVE_SIGNAL_H 1) foreach(_FN malloc calloc realloc free qsort abs memset memcpy memmove memcmp + wcslen wcscmp strlen _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _ultoa strtol strtoul strtoll strtod atoi atof strcmp strncmp - _stricmp _strnicmp sscanf atan atan2 acos asin ceil copysign cos - cosf fabs floor log pow scalbn sin sinf sqrt sqrtf tan tanf) + _stricmp _strnicmp sscanf + acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf + copysign copysignf cos cosf fabs fabsf floor floorf fmod fmodf + log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf) string(TOUPPER ${_FN} _UPPER) set(HAVE_${_UPPER} 1) endforeach() @@ -594,8 +658,8 @@ if(LIBC) set(HAVE_LIBC TRUE) check_include_file(sys/types.h HAVE_SYS_TYPES_H) foreach(_HEADER - stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h - strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h) + stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h limits.h + strings.h wchar.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h libunwind.h) string(TOUPPER "HAVE_${_HEADER}" _UPPER) string(REPLACE "." "_" _HAVE_H ${_UPPER}) check_include_file("${_HEADER}" ${_HAVE_H}) @@ -611,11 +675,11 @@ if(LIBC) foreach(_FN strtod malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove memcmp strlen strlcpy strlcat - strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa + _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp - vsscanf vsnprintf fseeko fseeko64 sigaction setjmp - nanosleep sysconf sysctlbyname + vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp + nanosleep sysconf sysctlbyname getauxval poll ) string(TOUPPER ${_FN} _UPPER) set(_HAVEVAR "HAVE_${_UPPER}") @@ -725,8 +789,19 @@ endif() if(ANDROID) file(GLOB ANDROID_CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/android/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_CORE_SOURCES}) + + # SDL_spinlock.c Needs to be compiled in ARM mode. + # There seems to be no better way currently to set the ARM mode. + # see: https://issuetracker.google.com/issues/62264618 + # Another option would be to set ARM mode to all compiled files + check_c_compiler_flag(-marm HAVE_ARM_MODE) + if(HAVE_ARM_MODE) + set_source_files_properties(${SDL2_SOURCE_DIR}/src/atomic/SDL_spinlock.c PROPERTIES COMPILE_FLAGS -marm) + endif() + file(GLOB ANDROID_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/android/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_MAIN_SOURCES}) + set(SDLMAIN_SOURCES ${SDLMAIN_SOURCES} ${ANDROID_MAIN_SOURCES}) + if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_ANDROID 1) file(GLOB ANDROID_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/android/*.c) @@ -739,33 +814,78 @@ if(ANDROID) set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) endif() + if(SDL_HAPTIC) + set(SDL_HAPTIC_ANDROID 1) + file(GLOB ANDROID_HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/android/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_HAPTIC_SOURCES}) + set(HAVE_SDL_HAPTIC TRUE) + endif() if(SDL_JOYSTICK) set(SDL_JOYSTICK_ANDROID 1) - file(GLOB ANDROID_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/android/*.c) + file(GLOB ANDROID_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/android/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() + if(SDL_LOADSO) + set(SDL_LOADSO_DLOPEN 1) + file(GLOB LOADSO_SOURCES ${SDL2_SOURCE_DIR}/src/loadso/dlopen/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${LOADSO_SOURCES}) + set(HAVE_SDL_LOADSO TRUE) + endif() if(SDL_POWER) set(SDL_POWER_ANDROID 1) file(GLOB ANDROID_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/android/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) endif() + if(SDL_TIMERS) + set(SDL_TIMER_UNIX 1) + file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES}) + set(HAVE_SDL_TIMERS TRUE) + endif() if(SDL_VIDEO) set(SDL_VIDEO_DRIVER_ANDROID 1) file(GLOB ANDROID_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/android/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_VIDEO_SOURCES}) set(HAVE_SDL_VIDEO TRUE) + # Core stuff + find_library(ANDROID_DL_LIBRARY dl) + find_library(ANDROID_LOG_LIBRARY log) + find_library(ANDROID_LIBRARY_LIBRARY android) + list(APPEND EXTRA_LIBS ${ANDROID_DL_LIBRARY} ${ANDROID_LOG_LIBRARY} ${ANDROID_LIBRARY_LIBRARY}) + add_definitions(-DGL_GLEXT_PROTOTYPES) + #enable gles if(VIDEO_OPENGLES) set(SDL_VIDEO_OPENGL_EGL 1) set(HAVE_VIDEO_OPENGLES TRUE) set(SDL_VIDEO_OPENGL_ES2 1) set(SDL_VIDEO_RENDER_OGL_ES2 1) + + find_library(OpenGLES1_LIBRARY GLESv1_CM) + find_library(OpenGLES2_LIBRARY GLESv2) + list(APPEND EXTRA_LIBS ${OpenGLES1_LIBRARY} ${OpenGLES2_LIBRARY}) + endif() + + CHECK_C_SOURCE_COMPILES(" + #if defined(__ARM_ARCH) && __ARM_ARCH < 7 + #error Vulkan doesn't work on this configuration + #endif + int main() + { + return 0; + } + " VULKAN_PASSED_ANDROID_CHECKS) + if(NOT VULKAN_PASSED_ANDROID_CHECKS) + set(VIDEO_VULKAN OFF) + message(STATUS "Vulkan doesn't work on this configuration") endif() endif() - list(APPEND EXTRA_LDFLAGS "-Wl,--undefined=Java_org_libsdl_app_SDLActivity_nativeInit") + + CheckPTHREAD() + endif() # Platform-specific options and settings @@ -821,17 +941,17 @@ if(EMSCRIPTEN) set(SDL_VIDEO_RENDER_OGL_ES2 1) endif() endif() -elseif(UNIX AND NOT APPLE) +elseif(UNIX AND NOT APPLE AND NOT ANDROID) if(SDL_AUDIO) if(SYSV5 OR SOLARIS OR HPUX) set(SDL_AUDIO_DRIVER_SUNAUDIO 1) file(GLOB SUN_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sun/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${SUN_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) - elseif(NETBSD OR OPENBSD) - set(SDL_AUDIO_DRIVER_BSD 1) - file(GLOB BSD_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/bsd/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${BSD_AUDIO_SOURCES}) + elseif(NETBSD) + set(SDL_AUDIO_DRIVER_NETBSD 1) + file(GLOB NETBSD_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/netbsd/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${NETBSD_AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) elseif(AIX) set(SDL_AUDIO_DRIVER_PAUDIO 1) @@ -841,12 +961,14 @@ elseif(UNIX AND NOT APPLE) endif() CheckOSS() CheckALSA() + CheckJACK() CheckPulseAudio() CheckESD() CheckARTS() CheckNAS() CheckSNDIO() CheckFusionSound() + CheckLibSampleRate() endif() if(SDL_VIDEO) @@ -859,6 +981,12 @@ elseif(UNIX AND NOT APPLE) CheckOpenGLESX11() CheckWayland() CheckVivante() + CheckKMSDRM() + endif() + + if(UNIX) + file(GLOB CORE_UNIX_SOURCES ${SDL2_SOURCE_DIR}/src/core/unix/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${CORE_UNIX_SOURCES}) endif() if(LINUX) @@ -880,8 +1008,8 @@ elseif(UNIX AND NOT APPLE) ioctl(0, KDGKBENT, &kbe); }" HAVE_INPUT_KD) - file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/linux/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES}) + file(GLOB CORE_LINUX_SOURCES ${SDL2_SOURCE_DIR}/src/core/linux/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${CORE_LINUX_SOURCES}) if(HAVE_INPUT_EVENTS) set(SDL_INPUT_LINUXEV 1) @@ -917,7 +1045,6 @@ elseif(UNIX AND NOT APPLE) endif() check_include_file("fcitx/frontend.h" HAVE_FCITX_FRONTEND_H) - endif() if(INPUT_TSLIB) @@ -934,7 +1061,7 @@ elseif(UNIX AND NOT APPLE) CheckUSBHID() # seems to be BSD specific - limit the test to BSD only? if(LINUX AND NOT ANDROID) set(SDL_JOYSTICK_LINUX 1) - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c) + file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/linux/*.c ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${JOYSTICK_SOURCES}) set(HAVE_SDL_JOYSTICK TRUE) endif() @@ -1013,9 +1140,9 @@ elseif(WINDOWS) if(MSVC) # Prevent codegen that would use the VC runtime libraries. - add_definitions(/GS-) + set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/GS-") if(NOT ARCH_64) - add_definitions(/arch:SSE) + set_property(DIRECTORY . APPEND PROPERTY COMPILE_OPTIONS "/arch:SSE") endif() endif() @@ -1037,6 +1164,16 @@ elseif(WINDOWS) #include #include int main(int argc, char **argv) { }" HAVE_XINPUT_H) + check_c_source_compiles(" + #include + #include + XINPUT_GAMEPAD_EX x1; + int main(int argc, char **argv) { }" HAVE_XINPUT_GAMEPAD_EX) + check_c_source_compiles(" + #include + #include + XINPUT_STATE_EX s1; + int main(int argc, char **argv) { }" HAVE_XINPUT_STATE_EX) else() check_include_file(xinput.h HAVE_XINPUT_H) endif() @@ -1046,9 +1183,10 @@ elseif(WINDOWS) check_include_file(ddraw.h HAVE_DDRAW_H) check_include_file(dsound.h HAVE_DSOUND_H) check_include_file(dinput.h HAVE_DINPUT_H) - check_include_file(xaudio2.h HAVE_XAUDIO2_H) + check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H) + check_include_file(audioclient.h HAVE_AUDIOCLIENT_H) check_include_file(dxgi.h HAVE_DXGI_H) - if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H OR HAVE_XAUDIO2_H) + if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H) set(HAVE_DIRECTX TRUE) if(NOT CMAKE_COMPILER_IS_MINGW AND NOT USE_WINSDK_DIRECTX) # TODO: change $ENV{DXSDL_DIR} to get the path from the include checks @@ -1071,10 +1209,10 @@ elseif(WINDOWS) set(SOURCE_FILES ${SOURCE_FILES} ${DSOUND_AUDIO_SOURCES}) endif() - if(HAVE_XAUDIO2_H) - set(SDL_AUDIO_DRIVER_XAUDIO2 1) - file(GLOB XAUDIO2_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/xaudio2/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${XAUDIO2_AUDIO_SOURCES}) + if(HAVE_AUDIOCLIENT_H AND HAVE_MMDEVICEAPI_H) + set(SDL_AUDIO_DRIVER_WASAPI 1) + file(GLOB WASAPI_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/wasapi/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${WASAPI_AUDIO_SOURCES}) endif() endif() @@ -1166,6 +1304,11 @@ elseif(WINDOWS) if(HAVE_DINPUT_H) set(SDL_JOYSTICK_DINPUT 1) list(APPEND EXTRA_LIBS dinput8) + if(CMAKE_COMPILER_IS_MINGW) + list(APPEND EXTRA_LIBS dxerr8) + elseif (NOT USE_WINSDK_DIRECTX) + list(APPEND EXTRA_LIBS dxerr) + endif() endif() if(HAVE_XINPUT_H) set(SDL_JOYSTICK_XINPUT 1) @@ -1202,15 +1345,25 @@ elseif(WINDOWS) list(APPEND SDL_LIBS "-lmingw32" "-lSDL2main" "-mwindows") endif() elseif(APPLE) - # TODO: rework this for proper MacOS X, iOS and Darwin support + # TODO: rework this all for proper MacOS X, iOS and Darwin support + + # We always need these libs on macOS at the moment. + # !!! FIXME: we need Carbon for some very old API calls in + # !!! FIXME: src/video/cocoa/SDL_cocoakeyboard.c, but we should figure out + # !!! FIXME: how to dump those. + if(NOT IOS) + set(SDL_FRAMEWORK_COCOA 1) + set(SDL_FRAMEWORK_CARBON 1) + endif() # Requires the darwin file implementation if(SDL_FILE) file(GLOB EXTRA_SOURCES ${SDL2_SOURCE_DIR}/src/file/cocoa/*.m) set(SOURCE_FILES ${EXTRA_SOURCES} ${SOURCE_FILES}) + # !!! FIXME: modern CMake doesn't need "LANGUAGE C" for Objective-C. set_source_files_properties(${EXTRA_SOURCES} PROPERTIES LANGUAGE C) set(HAVE_SDL_FILE TRUE) - set(SDL_FRAMEWORK_COCOA 1) + # !!! FIXME: why is COREVIDEO inside this if() block? set(SDL_FRAMEWORK_COREVIDEO 1) else() message_error("SDL_FILE must be enabled to build on MacOS X") @@ -1219,6 +1372,8 @@ elseif(APPLE) if(SDL_AUDIO) set(SDL_AUDIO_DRIVER_COREAUDIO 1) file(GLOB AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/coreaudio/*.m) + # !!! FIXME: modern CMake doesn't need "LANGUAGE C" for Objective-C. + set_source_files_properties(${AUDIO_SOURCES} PROPERTIES LANGUAGE C) set(SOURCE_FILES ${SOURCE_FILES} ${AUDIO_SOURCES}) set(HAVE_SDL_AUDIO TRUE) set(SDL_FRAMEWORK_COREAUDIO 1) @@ -1228,7 +1383,7 @@ elseif(APPLE) if(SDL_JOYSTICK) set(SDL_JOYSTICK_IOKIT 1) if (IOS) - file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m) + file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/iphoneos/*.m ${SDL2_SOURCE_DIR}/src/joystick/steam/*.c) else() file(GLOB JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/darwin/*.c) endif() @@ -1241,7 +1396,7 @@ elseif(APPLE) if(SDL_HAPTIC) set(SDL_HAPTIC_IOKIT 1) if (IOS) - file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/dummy/*.c) + file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/dummy/*.c) set(SDL_HAPTIC_DUMMY 1) else() file(GLOB HAPTIC_SOURCES ${SDL2_SOURCE_DIR}/src/haptic/darwin/*.c) @@ -1264,7 +1419,6 @@ elseif(APPLE) endif() set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES}) set(HAVE_SDL_POWER TRUE) - set(SDL_FRAMEWORK_CARBON 1) set(SDL_FRAMEWORK_IOKIT 1) endif() @@ -1278,6 +1432,7 @@ elseif(APPLE) if(SDL_FILESYSTEM) set(SDL_FILESYSTEM_COCOA 1) file(GLOB FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/cocoa/*.m) + # !!! FIXME: modern CMake doesn't need "LANGUAGE C" for Objective-C. set_source_files_properties(${FILESYSTEM_SOURCES} PROPERTIES LANGUAGE C) set(SOURCE_FILES ${SOURCE_FILES} ${FILESYSTEM_SOURCES}) set(HAVE_SDL_FILESYSTEM TRUE) @@ -1327,6 +1482,13 @@ elseif(APPLE) set(SDL_VIDEO_RENDER_OGL 1) set(HAVE_VIDEO_OPENGL TRUE) endif() + + if(VIDEO_OPENGLES) + set(SDL_VIDEO_OPENGL_EGL 1) + set(SDL_VIDEO_OPENGL_ES2 1) + set(SDL_VIDEO_RENDER_OGL_ES2 1) + set(HAVE_VIDEO_OPENGLES TRUE) + endif() endif() endif() @@ -1363,6 +1525,10 @@ elseif(HAIKU) CheckPTHREAD() endif() +if(VIDEO_VULKAN) + set(SDL_VIDEO_VULKAN 1) +endif() + # Dummies # configure.in does it differently: # if not have X @@ -1529,11 +1695,17 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}") # Always build SDLmain add_library(SDL2main STATIC ${SDLMAIN_SOURCES}) +target_include_directories(SDL2main PUBLIC $) set(_INSTALL_LIBS "SDL2main") +if (NOT ANDROID) + set_target_properties(SDL2main PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX}) +endif() if(SDL_SHARED) add_library(SDL2 SHARED ${SOURCE_FILES} ${VERSION_SOURCES}) - if(UNIX) + if(APPLE) + set_target_properties(SDL2 PROPERTIES MACOSX_RPATH 1) + elseif(UNIX AND NOT ANDROID) set_target_properties(SDL2 PROPERTIES VERSION ${LT_VERSION} SOVERSION ${LT_REVISION} @@ -1544,7 +1716,7 @@ if(SDL_SHARED) SOVERSION ${LT_REVISION} OUTPUT_NAME "SDL2") endif() - if(MSVC) + if(MSVC AND NOT LIBC) # Don't try to link with the default set of libraries. set_target_properties(SDL2 PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") set_target_properties(SDL2 PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") @@ -1552,14 +1724,24 @@ if(SDL_SHARED) endif() set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS}) target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) + target_include_directories(SDL2 PUBLIC $) + if (NOT ANDROID) + set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX}) + endif() endif() if(SDL_STATIC) set (BUILD_SHARED_LIBS FALSE) add_library(SDL2-static STATIC ${SOURCE_FILES}) - set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2") + if (NOT SDL_SHARED OR NOT WIN32) + set_target_properties(SDL2-static PROPERTIES OUTPUT_NAME "SDL2") + # Note: Apparently, OUTPUT_NAME must really be unique; even when + # CMAKE_IMPORT_LIBRARY_SUFFIX or the like are given. Otherwise + # the static build may race with the import lib and one will get + # clobbered, when the suffix is realized via subsequent rename. + endif() set_target_properties(SDL2-static PROPERTIES POSITION_INDEPENDENT_CODE ${SDL_STATIC_PIC}) - if(MSVC) + if(MSVC AND NOT LIBC) set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_RELEASE "/NODEFAULTLIB") set_target_properties(SDL2-static PROPERTIES LINK_FLAGS_DEBUG "/NODEFAULTLIB") set_target_properties(SDL2-static PROPERTIES STATIC_LIBRARY_FLAGS "/NODEFAULTLIB") @@ -1568,14 +1750,55 @@ if(SDL_STATIC) # libraries - do we need to consider this? set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS}) target_link_libraries(SDL2-static ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) + target_include_directories(SDL2-static PUBLIC $) + if (NOT ANDROID) + set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX ${SDL_CMAKE_DEBUG_POSTFIX}) + endif() +endif() + +##### Tests ##### + +if(SDL_TEST) + file(GLOB TEST_SOURCES ${SDL2_SOURCE_DIR}/src/test/*.c) + add_library(SDL2_test STATIC ${TEST_SOURCES}) + + add_subdirectory(test) endif() ##### Installation targets ##### -install(TARGETS ${_INSTALL_LIBS} +install(TARGETS ${_INSTALL_LIBS} EXPORT SDL2Targets LIBRARY DESTINATION "lib${LIB_SUFFIX}" ARCHIVE DESTINATION "lib${LIB_SUFFIX}" RUNTIME DESTINATION bin) +##### Export files ##### +if (APPLE) + set(PKG_PREFIX "SDL2.framework/Resources") +elseif (WINDOWS) + set(PKG_PREFIX "cmake") +else () + set(PKG_PREFIX "lib/cmake/SDL2") +endif () + +include(CMakePackageConfigHelpers) +write_basic_package_version_file("${CMAKE_BINARY_DIR}/SDL2ConfigVersion.cmake" + VERSION ${SDL_VERSION} + COMPATIBILITY AnyNewerVersion +) + +install(EXPORT SDL2Targets + FILE SDL2Targets.cmake + NAMESPACE SDL2:: + DESTINATION ${PKG_PREFIX} +) +install( + FILES + ${CMAKE_CURRENT_SOURCE_DIR}/SDL2Config.cmake + ${CMAKE_BINARY_DIR}/SDL2ConfigVersion.cmake + DESTINATION ${PKG_PREFIX} + COMPONENT Devel +) + file(GLOB INCLUDE_FILES ${SDL2_SOURCE_DIR}/include/*.h) file(GLOB BIN_INCLUDE_FILES ${SDL2_BINARY_DIR}/include/*.h) foreach(_FNAME ${BIN_INCLUDE_FILES}) @@ -1592,10 +1815,12 @@ if(NOT (WINDOWS OR CYGWIN)) else() set(SOEXT "so") endif() - install(CODE " - execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink - \"libSDL2-2.0.${SOEXT}\" \"libSDL2.${SOEXT}\")") - install(FILES ${SDL2_BINARY_DIR}/libSDL2.${SOEXT} DESTINATION "lib${LIB_SUFFIX}") + if(NOT ANDROID) + install(CODE " + execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink + \"libSDL2-2.0.${SOEXT}\" \"libSDL2.${SOEXT}\")") + install(FILES ${SDL2_BINARY_DIR}/libSDL2.${SOEXT} DESTINATION "lib${LIB_SUFFIX}") + endif() endif() if(FREEBSD) # FreeBSD uses ${PREFIX}/libdata/pkgconfig @@ -1611,10 +1836,12 @@ endif() ##### Uninstall target ##### -configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" - "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" - IMMEDIATE @ONLY) +if(NOT TARGET uninstall) + configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY) -add_custom_target(uninstall - COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) + add_custom_target(uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake) +endif() diff --git a/Engine/lib/sdl/COPYING.txt b/Engine/lib/sdl/COPYING.txt index dd9574e06..694e58a09 100644 --- a/Engine/lib/sdl/COPYING.txt +++ b/Engine/lib/sdl/COPYING.txt @@ -1,6 +1,6 @@ Simple DirectMedia Layer -Copyright (C) 1997-2016 Sam Lantinga +Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/INSTALL.txt b/Engine/lib/sdl/INSTALL.txt index 66e5706f7..9ee4ef538 100644 --- a/Engine/lib/sdl/INSTALL.txt +++ b/Engine/lib/sdl/INSTALL.txt @@ -5,7 +5,7 @@ To compile and install SDL: * Read VisualC.html Windows with gcc, either native or cross-compiling: - * Read the FAQ at http://wiki.libsdl.org/moin.fcg/FAQWindows + * Read the FAQ at https://wiki.libsdl.org/moin.fcg/FAQWindows * Run './configure; make; make install' Mac OS X with Xcode: @@ -27,14 +27,14 @@ To compile and install SDL: * Read docs/README-cmake.md 2. Look at the example programs in ./test, and check out the online - documentation at http://wiki.libsdl.org/ + documentation at https://wiki.libsdl.org/ 3. Join the SDL developer mailing list by sending E-mail to sdl-request@libsdl.org and put "subscribe" in the subject of the message. Or alternatively you can use the web interface: - http://www.libsdl.org/mailing-list.php + https://www.libsdl.org/mailing-list.php That's it! Sam Lantinga diff --git a/Engine/lib/sdl/Makefile.in b/Engine/lib/sdl/Makefile.in index a7cbddf26..fe566523d 100644 --- a/Engine/lib/sdl/Makefile.in +++ b/Engine/lib/sdl/Makefile.in @@ -36,15 +36,15 @@ GEN_HEADERS = @GEN_HEADERS@ GEN_OBJECTS = @GEN_OBJECTS@ VERSION_OBJECTS = @VERSION_OBJECTS@ -SDLMAIN_TARGET = libSDL2main.a +SDLMAIN_TARGET = libSDL2main.la SDLMAIN_OBJECTS = @SDLMAIN_OBJECTS@ -SDLTEST_TARGET = libSDL2_test.a +SDLTEST_TARGET = libSDL2_test.la SDLTEST_OBJECTS = @SDLTEST_OBJECTS@ WAYLAND_SCANNER = @WAYLAND_SCANNER@ -SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.in debian docs include Makefile.* sdl2-config.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in src test VisualC.html VisualC VisualC-WinRT Xcode Xcode-iOS +SRC_DIST = *.txt acinclude Android.mk autogen.sh android-project build-scripts cmake cmake_uninstall.cmake.in configure configure.in debian docs include Makefile.* sdl2-config.cmake.in sdl2-config.in sdl2.m4 sdl2.pc.in SDL2.spec.in SDL2Config.cmake src test VisualC.html VisualC VisualC-WinRT Xcode Xcode-iOS GEN_DIST = SDL2.spec ifneq ($V,1) @@ -112,6 +112,7 @@ HDRS = \ SDL_types.h \ SDL_version.h \ SDL_video.h \ + SDL_vulkan.h \ begin_code.h \ close_code.h @@ -121,14 +122,12 @@ LT_AGE = @LT_AGE@ LT_CURRENT = @LT_CURRENT@ LT_RELEASE = @LT_RELEASE@ LT_REVISION = @LT_REVISION@ -LT_LDFLAGS = -no-undefined -rpath $(DESTDIR)$(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) +LT_LDFLAGS = -no-undefined -rpath $(libdir) -release $(LT_RELEASE) -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) all: $(srcdir)/configure Makefile $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET) $(srcdir)/configure: $(srcdir)/configure.in - @echo "Warning, configure.in is out of date" - #(cd $(srcdir) && sh autogen.sh && sh configure) - @sleep 3 + @echo "Warning, configure is out of date, please re-run autogen.sh" Makefile: $(srcdir)/Makefile.in $(SHELL) config.status $@ @@ -147,12 +146,10 @@ $(objects)/$(TARGET): $(GEN_HEADERS) $(GEN_OBJECTS) $(OBJECTS) $(VERSION_OBJECTS $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -o $@ $(OBJECTS) $(GEN_OBJECTS) $(VERSION_OBJECTS) $(LDFLAGS) $(EXTRA_LDFLAGS) $(LT_LDFLAGS) $(objects)/$(SDLMAIN_TARGET): $(SDLMAIN_OBJECTS) - $(RUN_CMD_AR)$(AR) cru $@ $(SDLMAIN_OBJECTS) - $(RUN_CMD_RANLIB)$(RANLIB) $@ + $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -static -o $@ $(SDLMAIN_OBJECTS) -rpath $(libdir) $(objects)/$(SDLTEST_TARGET): $(SDLTEST_OBJECTS) - $(RUN_CMD_AR)$(AR) cru $@ $(SDLTEST_OBJECTS) - $(RUN_CMD_RANLIB)$(RANLIB) $@ + $(RUN_CMD_LTLINK)$(LIBTOOL) --tag=CC --mode=link $(CC) -static -o $@ $(SDLTEST_OBJECTS) -rpath $(libdir) install: all install-bin install-hdrs install-lib install-data install-bin: @@ -173,10 +170,8 @@ install-hdrs: update-revision install-lib: $(objects) $(objects)/$(TARGET) $(objects)/$(SDLMAIN_TARGET) $(objects)/$(SDLTEST_TARGET) $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(libdir) $(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(TARGET) $(DESTDIR)$(libdir)/$(TARGET) - $(INSTALL) -m 644 $(objects)/$(SDLMAIN_TARGET) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET) - $(RANLIB) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET) - $(INSTALL) -m 644 $(objects)/$(SDLTEST_TARGET) $(DESTDIR)$(libdir)/$(SDLTEST_TARGET) - $(RANLIB) $(DESTDIR)$(libdir)/$(SDLTEST_TARGET) + $(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(SDLMAIN_TARGET) $(DESTDIR)$(libdir)/$(SDLMAIN_TARGET) + $(LIBTOOL) --mode=install $(INSTALL) $(objects)/$(SDLTEST_TARGET) $(DESTDIR)$(libdir)/$(SDLTEST_TARGET) install-data: $(SHELL) $(auxdir)/mkinstalldirs $(DESTDIR)$(datadir)/aclocal $(INSTALL) -m 644 $(srcdir)/sdl2.m4 $(DESTDIR)$(datadir)/aclocal/sdl2.m4 diff --git a/Engine/lib/sdl/Makefile.pandora b/Engine/lib/sdl/Makefile.pandora index 8b78f2734..56f171b4e 100644 --- a/Engine/lib/sdl/Makefile.pandora +++ b/Engine/lib/sdl/Makefile.pandora @@ -8,7 +8,7 @@ STRIP = arm-none-linux-gnueabi-strip CFLAGS = -O3 -march=armv7-a -mcpu=cortex-a8 -mtune=cortex-a8 -mfloat-abi=softfp \ -mfpu=neon -ftree-vectorize -ffast-math -fomit-frame-pointer -fno-strict-aliasing -fsingle-precision-constant \ - -I./include -I$(PNDSDK)/usr/include -DSDL_REVISION=0 + -I./include -I$(PNDSDK)/usr/include TARGET = libSDL.a @@ -25,7 +25,7 @@ SOURCES = ./src/*.c ./src/audio/*.c ./src/cpuinfo/*.c ./src/events/*.c \ OBJECTS = $(shell echo $(SOURCES) | sed -e 's,\.c,\.o,g') -CONFIG_H = $(shell cp include/SDL_config_pandora.h include/SDL_config.h && touch include/SDL_revision.h) +CONFIG_H = $(shell cp include/SDL_config_pandora.h include/SDL_config.h) all: $(TARGET) diff --git a/Engine/lib/sdl/README-SDL.txt b/Engine/lib/sdl/README-SDL.txt index 8eaf051f7..8d92955a9 100644 --- a/Engine/lib/sdl/README-SDL.txt +++ b/Engine/lib/sdl/README-SDL.txt @@ -6,7 +6,7 @@ designed to make it easy to write multi-media software, such as games and emulators. The Simple DirectMedia Layer library source code is available from: -http://www.libsdl.org/ +https://www.libsdl.org/ This library is distributed under the terms of the zlib license: http://www.zlib.net/zlib_license.html diff --git a/Engine/lib/sdl/README.txt b/Engine/lib/sdl/README.txt index f76a633ba..431ba0e74 100644 --- a/Engine/lib/sdl/README.txt +++ b/Engine/lib/sdl/README.txt @@ -6,7 +6,7 @@ Version 2.0 --- -http://www.libsdl.org/ +https://www.libsdl.org/ Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics diff --git a/Engine/lib/sdl/SDL2.spec b/Engine/lib/sdl/SDL2.spec index 5dfda5802..26454b74a 100644 --- a/Engine/lib/sdl/SDL2.spec +++ b/Engine/lib/sdl/SDL2.spec @@ -1,6 +1,6 @@ Summary: Simple DirectMedia Layer Name: SDL2 -Version: 2.0.5 +Version: 2.0.8 Release: 2 Source: http://www.libsdl.org/release/%{name}-%{version}.tar.gz URL: http://www.libsdl.org/ diff --git a/Engine/lib/sdl/SDL2Config.cmake b/Engine/lib/sdl/SDL2Config.cmake new file mode 100644 index 000000000..4a5f64602 --- /dev/null +++ b/Engine/lib/sdl/SDL2Config.cmake @@ -0,0 +1 @@ +include("${CMAKE_CURRENT_LIST_DIR}/SDL2Targets.cmake") diff --git a/Engine/lib/sdl/WhatsNew.txt b/Engine/lib/sdl/WhatsNew.txt index 1979ac2b3..48fe2510a 100644 --- a/Engine/lib/sdl/WhatsNew.txt +++ b/Engine/lib/sdl/WhatsNew.txt @@ -1,6 +1,137 @@ This is a list of major changes in SDL's version history. +--------------------------------------------------------------------------- +2.0.8: +--------------------------------------------------------------------------- + +General: +* Added SDL_fmod() and SDL_log10() +* Each of the SDL math functions now has the corresponding float version +* Added SDL_SetYUVConversionMode() and SDL_GetYUVConversionMode() to control the formula used when converting to and from YUV colorspace. The options are JPEG, BT.601, and BT.709 + +Windows: +* Implemented WASAPI support on Windows UWP and removed the deprecated XAudio2 implementation +* Added resampling support on WASAPI on Windows 7 and above + +Windows UWP: +* Added SDL_WinRTGetDeviceFamily() to find out what type of device your application is running on + +Mac OS X: +* Added support for the Vulkan SDK for Mac: + https://www.lunarg.com/lunarg-releases-vulkan-sdk-1-0-69-0-for-mac/ +* Added support for OpenGL ES using ANGLE when it's available + +Mac OS X / iOS / tvOS: +* Added a Metal 2D render implementation +* Added SDL_RenderGetMetalLayer() and SDL_RenderGetMetalCommandEncoder() to insert your own drawing into SDL rendering when using the Metal implementation + +iOS: +* Added the hint SDL_HINT_IOS_HIDE_HOME_INDICATOR to control whether the home indicator bar on iPhone X should be hidden. This defaults to dimming the indicator for fullscreen applications and showing the indicator for windowed applications. + +iOS / Android: +* Added the hint SDL_HINT_RETURN_KEY_HIDES_IME to control whether the return key on the software keyboard should hide the keyboard or send a key event (the default) + +Android: +* SDL now supports building with Android Studio and Gradle by default, and the old Ant project is available in android-project-ant +* SDL now requires the API 19 SDK to build, but can still target devices down to API 14 (Android 4.0.1) +* Added SDL_IsAndroidTV() to tell whether the application is running on Android TV + +Android / tvOS: +* Added the hint SDL_HINT_TV_REMOTE_AS_JOYSTICK to control whether TV remotes should be listed as joystick devices (the default) or send keyboard events. + +Linux: +* Added the hint SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR to control whether the X server should skip the compositor for the SDL application. This defaults to "1" +* Added the hint SDL_HINT_VIDEO_DOUBLE_BUFFER to control whether the Raspberry Pi and KMSDRM video drivers should use double or triple buffering (the default) + + +--------------------------------------------------------------------------- +2.0.7: +--------------------------------------------------------------------------- + +General: +* Added audio stream conversion functions: + SDL_NewAudioStream + SDL_AudioStreamPut + SDL_AudioStreamGet + SDL_AudioStreamAvailable + SDL_AudioStreamFlush + SDL_AudioStreamClear + SDL_FreeAudioStream +* Added functions to query and set the SDL memory allocation functions: + SDL_GetMemoryFunctions() + SDL_SetMemoryFunctions() + SDL_GetNumAllocations() +* Added locking functions for multi-threaded access to the joystick and game controller APIs: + SDL_LockJoysticks() + SDL_UnlockJoysticks() +* The following functions are now thread-safe: + SDL_SetEventFilter() + SDL_GetEventFilter() + SDL_AddEventWatch() + SDL_DelEventWatch() + + +General: +--------------------------------------------------------------------------- +2.0.6: +--------------------------------------------------------------------------- + +General: +* Added cross-platform Vulkan graphics support in SDL_vulkan.h + SDL_Vulkan_LoadLibrary() + SDL_Vulkan_GetVkGetInstanceProcAddr() + SDL_Vulkan_GetInstanceExtensions() + SDL_Vulkan_CreateSurface() + SDL_Vulkan_GetDrawableSize() + SDL_Vulkan_UnloadLibrary() + This is all the platform-specific code you need to bring up Vulkan on all SDL platforms. You can look at an example in test/testvulkan.c +* Added SDL_ComposeCustomBlendMode() to create custom blend modes for 2D rendering +* Added SDL_HasNEON() which returns whether the CPU has NEON instruction support +* Added support for many game controllers, including the Nintendo Switch Pro Controller +* Added support for inverted axes and separate axis directions in game controller mappings +* Added functions to return information about a joystick before it's opened: + SDL_JoystickGetDeviceVendor() + SDL_JoystickGetDeviceProduct() + SDL_JoystickGetDeviceProductVersion() + SDL_JoystickGetDeviceType() + SDL_JoystickGetDeviceInstanceID() +* Added functions to return information about an open joystick: + SDL_JoystickGetVendor() + SDL_JoystickGetProduct() + SDL_JoystickGetProductVersion() + SDL_JoystickGetType() + SDL_JoystickGetAxisInitialState() +* Added functions to return information about an open game controller: + SDL_GameControllerGetVendor() + SDL_GameControllerGetProduct() + SDL_GameControllerGetProductVersion() +* Added SDL_GameControllerNumMappings() and SDL_GameControllerMappingForIndex() to be able to enumerate the built-in game controller mappings +* Added SDL_LoadFile() and SDL_LoadFile_RW() to load a file into memory +* Added SDL_DuplicateSurface() to make a copy of a surface +* Added an experimental JACK audio driver +* Implemented non-power-of-two audio resampling, optionally using libsamplerate to perform the resampling +* Added the hint SDL_HINT_AUDIO_RESAMPLING_MODE to control the quality of resampling +* Added the hint SDL_HINT_RENDER_LOGICAL_SIZE_MODE to control the scaling policy for SDL_RenderSetLogicalSize(): + "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen (the default) + "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen +* Added the hints SDL_HINT_MOUSE_NORMAL_SPEED_SCALE and SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE to scale the mouse speed when being read from raw mouse input +* Added the hint SDL_HINT_TOUCH_MOUSE_EVENTS to control whether SDL will synthesize mouse events from touch events + +Windows: +* The new default audio driver on Windows is WASAPI and supports hot-plugging devices and changing the default audio device +* The old XAudio2 audio driver is deprecated and will be removed in the next release +* Added hints SDL_HINT_WINDOWS_INTRESOURCE_ICON and SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL to specify a custom icon resource ID for SDL windows +* The hint SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING is now on by default for compatibility with .NET languages and various Windows debuggers +* Updated the GUID format for game controller mappings, older mappings will be automatically converted on load +* Implemented the SDL_WINDOW_ALWAYS_ON_TOP flag on Windows + +Linux: +* Added an experimental KMS/DRM video driver for embedded development + +iOS: +* Added a hint SDL_HINT_AUDIO_CATEGORY to control the audio category, determining whether the phone mute switch affects the audio + --------------------------------------------------------------------------- 2.0.5: --------------------------------------------------------------------------- diff --git a/Engine/lib/sdl/Xcode/SDL/Info-Framework.plist b/Engine/lib/sdl/Xcode/SDL/Info-Framework.plist deleted file mode 100644 index da4183466..000000000 --- a/Engine/lib/sdl/Xcode/SDL/Info-Framework.plist +++ /dev/null @@ -1,28 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleGetInfoString - http://www.libsdl.org - CFBundleIconFile - - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - Simple DirectMedia Layer - CFBundlePackageType - FMWK - CFBundleShortVersionString - 2.0.5 - CFBundleSignature - SDLX - CFBundleVersion - 2.0.5 - - diff --git a/Engine/lib/sdl/Xcode/SDL/SDL.xcodeproj/project.pbxproj b/Engine/lib/sdl/Xcode/SDL/SDL.xcodeproj/project.pbxproj deleted file mode 100755 index 1f16953cf..000000000 --- a/Engine/lib/sdl/Xcode/SDL/SDL.xcodeproj/project.pbxproj +++ /dev/null @@ -1,3004 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 007317A40858DECD00B2BC32 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; }; - 007317A60858DECD00B2BC32 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; }; - 007317AB0858DECD00B2BC32 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; }; - 007317AD0858DECD00B2BC32 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; }; - 007317C30858E15000B2BC32 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; }; - 00CFA89D106B4BA100758660 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; }; - 00D0D08410675DD9004B05EF /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D0D08310675DD9004B05EF /* CoreFoundation.framework */; }; - 00D0D0D810675E46004B05EF /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; }; - 04043BBB12FEB1BE0076DB1F /* SDL_glfuncs.h in Headers */ = {isa = PBXBuildFile; fileRef = 04043BBA12FEB1BE0076DB1F /* SDL_glfuncs.h */; }; - 04043BBC12FEB1BE0076DB1F /* SDL_glfuncs.h in Headers */ = {isa = PBXBuildFile; fileRef = 04043BBA12FEB1BE0076DB1F /* SDL_glfuncs.h */; }; - 041B2CA512FA0D680087D585 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2C9E12FA0D680087D585 /* SDL_render.c */; }; - 041B2CA612FA0D680087D585 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */; }; - 041B2CAB12FA0D680087D585 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2C9E12FA0D680087D585 /* SDL_render.c */; }; - 041B2CAC12FA0D680087D585 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */; }; - 0435673E1303160F00BA5428 /* SDL_shaders_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0435673C1303160F00BA5428 /* SDL_shaders_gl.c */; }; - 0435673F1303160F00BA5428 /* SDL_shaders_gl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */; }; - 043567401303160F00BA5428 /* SDL_shaders_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0435673C1303160F00BA5428 /* SDL_shaders_gl.c */; }; - 043567411303160F00BA5428 /* SDL_shaders_gl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */; }; - 04409B9112FA97ED00FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; }; - 04409B9212FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; }; - 04409B9312FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; }; - 04409B9412FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; }; - 04409B9512FA97ED00FB9AA8 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; }; - 04409B9612FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; }; - 04409B9712FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; }; - 04409B9812FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; }; - 0442EC1812FE1BBA004C9285 /* SDL_render_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC1712FE1BBA004C9285 /* SDL_render_gl.c */; }; - 0442EC1912FE1BBA004C9285 /* SDL_render_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC1712FE1BBA004C9285 /* SDL_render_gl.c */; }; - 0442EC1C12FE1BCB004C9285 /* SDL_render_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC1A12FE1BCB004C9285 /* SDL_render_sw_c.h */; }; - 0442EC1D12FE1BCB004C9285 /* SDL_render_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC1B12FE1BCB004C9285 /* SDL_render_sw.c */; }; - 0442EC1E12FE1BCB004C9285 /* SDL_render_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC1A12FE1BCB004C9285 /* SDL_render_sw_c.h */; }; - 0442EC1F12FE1BCB004C9285 /* SDL_render_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC1B12FE1BCB004C9285 /* SDL_render_sw.c */; }; - 0442EC5A12FE1C60004C9285 /* SDL_x11framebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5812FE1C60004C9285 /* SDL_x11framebuffer.c */; }; - 0442EC5B12FE1C60004C9285 /* SDL_x11framebuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC5912FE1C60004C9285 /* SDL_x11framebuffer.h */; }; - 0442EC5C12FE1C60004C9285 /* SDL_x11framebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5812FE1C60004C9285 /* SDL_x11framebuffer.c */; }; - 0442EC5D12FE1C60004C9285 /* SDL_x11framebuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC5912FE1C60004C9285 /* SDL_x11framebuffer.h */; }; - 0442EC5F12FE1C75004C9285 /* SDL_hints.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5E12FE1C75004C9285 /* SDL_hints.c */; }; - 0442EC6012FE1C75004C9285 /* SDL_hints.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5E12FE1C75004C9285 /* SDL_hints.c */; }; - 04BAC0C81300C2160055DE28 /* SDL_log.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BAC0C71300C2160055DE28 /* SDL_log.c */; }; - 04BAC0C91300C2160055DE28 /* SDL_log.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BAC0C71300C2160055DE28 /* SDL_log.c */; }; - 04BD000812E6671800899322 /* SDL_diskaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD8812E6671700899322 /* SDL_diskaudio.c */; }; - 04BD000912E6671800899322 /* SDL_diskaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD8912E6671700899322 /* SDL_diskaudio.h */; }; - 04BD001012E6671800899322 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; }; - 04BD001112E6671800899322 /* SDL_dummyaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */; }; - 04BD001912E6671800899322 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDA112E6671700899322 /* SDL_coreaudio.h */; }; - 04BD002612E6671800899322 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB412E6671700899322 /* SDL_audio.c */; }; - 04BD002712E6671800899322 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB512E6671700899322 /* SDL_audio_c.h */; }; - 04BD002812E6671800899322 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB612E6671700899322 /* SDL_audiocvt.c */; }; - 04BD002912E6671800899322 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB712E6671700899322 /* SDL_audiodev.c */; }; - 04BD002A12E6671800899322 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */; }; - 04BD002C12E6671800899322 /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */; }; - 04BD002D12E6671800899322 /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBB12E6671700899322 /* SDL_mixer.c */; }; - 04BD003412E6671800899322 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC212E6671700899322 /* SDL_sysaudio.h */; }; - 04BD003512E6671800899322 /* SDL_wave.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDC312E6671700899322 /* SDL_wave.c */; }; - 04BD003612E6671800899322 /* SDL_wave.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC412E6671700899322 /* SDL_wave.h */; }; - 04BD004112E6671800899322 /* SDL_cpuinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDD412E6671700899322 /* SDL_cpuinfo.c */; }; - 04BD004212E6671800899322 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD612E6671700899322 /* blank_cursor.h */; }; - 04BD004312E6671800899322 /* default_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD712E6671700899322 /* default_cursor.h */; }; - 04BD004412E6671800899322 /* scancodes_darwin.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD812E6671700899322 /* scancodes_darwin.h */; }; - 04BD004512E6671800899322 /* scancodes_linux.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD912E6671700899322 /* scancodes_linux.h */; }; - 04BD004712E6671800899322 /* scancodes_xfree86.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDDB12E6671700899322 /* scancodes_xfree86.h */; }; - 04BD004812E6671800899322 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDDC12E6671700899322 /* SDL_clipboardevents.c */; }; - 04BD004912E6671800899322 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDDD12E6671700899322 /* SDL_clipboardevents_c.h */; }; - 04BD004A12E6671800899322 /* SDL_events.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDDE12E6671700899322 /* SDL_events.c */; }; - 04BD004B12E6671800899322 /* SDL_events_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDDF12E6671700899322 /* SDL_events_c.h */; }; - 04BD004C12E6671800899322 /* SDL_gesture.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE012E6671700899322 /* SDL_gesture.c */; }; - 04BD004D12E6671800899322 /* SDL_gesture_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE112E6671700899322 /* SDL_gesture_c.h */; }; - 04BD004E12E6671800899322 /* SDL_keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE212E6671700899322 /* SDL_keyboard.c */; }; - 04BD004F12E6671800899322 /* SDL_keyboard_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE312E6671700899322 /* SDL_keyboard_c.h */; }; - 04BD005012E6671800899322 /* SDL_mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE412E6671700899322 /* SDL_mouse.c */; }; - 04BD005112E6671800899322 /* SDL_mouse_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE512E6671700899322 /* SDL_mouse_c.h */; }; - 04BD005212E6671800899322 /* SDL_quit.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE612E6671700899322 /* SDL_quit.c */; }; - 04BD005312E6671800899322 /* SDL_sysevents.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE712E6671700899322 /* SDL_sysevents.h */; }; - 04BD005412E6671800899322 /* SDL_touch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE812E6671700899322 /* SDL_touch.c */; }; - 04BD005512E6671800899322 /* SDL_touch_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE912E6671700899322 /* SDL_touch_c.h */; }; - 04BD005612E6671800899322 /* SDL_windowevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDEA12E6671700899322 /* SDL_windowevents.c */; }; - 04BD005712E6671800899322 /* SDL_windowevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDEB12E6671700899322 /* SDL_windowevents_c.h */; }; - 04BD005812E6671800899322 /* SDL_rwopsbundlesupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDEE12E6671700899322 /* SDL_rwopsbundlesupport.h */; }; - 04BD005912E6671800899322 /* SDL_rwopsbundlesupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDEF12E6671700899322 /* SDL_rwopsbundlesupport.m */; }; - 04BD005A12E6671800899322 /* SDL_rwops.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDF012E6671700899322 /* SDL_rwops.c */; }; - 04BD005B12E6671800899322 /* SDL_syshaptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDF312E6671700899322 /* SDL_syshaptic.c */; }; - 04BD005F12E6671800899322 /* SDL_haptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDFA12E6671700899322 /* SDL_haptic.c */; }; - 04BD006012E6671800899322 /* SDL_haptic_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDFB12E6671700899322 /* SDL_haptic_c.h */; }; - 04BD006112E6671800899322 /* SDL_syshaptic.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDFC12E6671700899322 /* SDL_syshaptic.h */; }; - 04BD006612E6671800899322 /* SDL_sysjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE0712E6671700899322 /* SDL_sysjoystick.c */; }; - 04BD006712E6671800899322 /* SDL_sysjoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE0812E6671700899322 /* SDL_sysjoystick_c.h */; }; - 04BD007012E6671800899322 /* SDL_joystick.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE1612E6671700899322 /* SDL_joystick.c */; }; - 04BD007112E6671800899322 /* SDL_joystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1712E6671700899322 /* SDL_joystick_c.h */; }; - 04BD007212E6671800899322 /* SDL_sysjoystick.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1812E6671700899322 /* SDL_sysjoystick.h */; }; - 04BD008812E6671800899322 /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE3312E6671700899322 /* SDL_sysloadso.c */; }; - 04BD009412E6671800899322 /* SDL_syspower.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4B12E6671700899322 /* SDL_syspower.c */; }; - 04BD009612E6671800899322 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4E12E6671700899322 /* SDL_power.c */; }; - 04BD009B12E6671800899322 /* SDL_assert_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE5512E6671700899322 /* SDL_assert_c.h */; }; - 04BD009C12E6671800899322 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5612E6671700899322 /* SDL_assert.c */; }; - 04BD009E12E6671800899322 /* SDL_error_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE5812E6671700899322 /* SDL_error_c.h */; }; - 04BD009F12E6671800899322 /* SDL_error.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5912E6671700899322 /* SDL_error.c */; }; - 04BD00A212E6671800899322 /* SDL.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5C12E6671700899322 /* SDL.c */; }; - 04BD00A312E6671800899322 /* SDL_getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5E12E6671700899322 /* SDL_getenv.c */; }; - 04BD00A412E6671800899322 /* SDL_iconv.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5F12E6671700899322 /* SDL_iconv.c */; }; - 04BD00A512E6671800899322 /* SDL_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6012E6671700899322 /* SDL_malloc.c */; }; - 04BD00A612E6671800899322 /* SDL_qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6112E6671700899322 /* SDL_qsort.c */; }; - 04BD00A712E6671800899322 /* SDL_stdlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6212E6671700899322 /* SDL_stdlib.c */; }; - 04BD00A812E6671800899322 /* SDL_string.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6312E6671700899322 /* SDL_string.c */; }; - 04BD00BD12E6671800899322 /* SDL_syscond.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE7E12E6671800899322 /* SDL_syscond.c */; }; - 04BD00BE12E6671800899322 /* SDL_sysmutex.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE7F12E6671800899322 /* SDL_sysmutex.c */; }; - 04BD00BF12E6671800899322 /* SDL_sysmutex_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8012E6671800899322 /* SDL_sysmutex_c.h */; }; - 04BD00C012E6671800899322 /* SDL_syssem.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE8112E6671800899322 /* SDL_syssem.c */; }; - 04BD00C112E6671800899322 /* SDL_systhread.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE8212E6671800899322 /* SDL_systhread.c */; }; - 04BD00C212E6671800899322 /* SDL_systhread_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8312E6671800899322 /* SDL_systhread_c.h */; }; - 04BD00C912E6671800899322 /* SDL_systhread.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8B12E6671800899322 /* SDL_systhread.h */; }; - 04BD00CA12E6671800899322 /* SDL_thread.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE8C12E6671800899322 /* SDL_thread.c */; }; - 04BD00CB12E6671800899322 /* SDL_thread_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8D12E6671800899322 /* SDL_thread_c.h */; }; - 04BD00D712E6671800899322 /* SDL_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE9F12E6671800899322 /* SDL_timer.c */; }; - 04BD00D812E6671800899322 /* SDL_timer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEA012E6671800899322 /* SDL_timer_c.h */; }; - 04BD00D912E6671800899322 /* SDL_systimer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEA212E6671800899322 /* SDL_systimer.c */; }; - 04BD00F312E6671800899322 /* SDL_cocoaclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC212E6671800899322 /* SDL_cocoaclipboard.h */; }; - 04BD00F412E6671800899322 /* SDL_cocoaclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC312E6671800899322 /* SDL_cocoaclipboard.m */; }; - 04BD00F512E6671800899322 /* SDL_cocoaevents.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC412E6671800899322 /* SDL_cocoaevents.h */; }; - 04BD00F612E6671800899322 /* SDL_cocoaevents.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC512E6671800899322 /* SDL_cocoaevents.m */; }; - 04BD00F712E6671800899322 /* SDL_cocoakeyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC612E6671800899322 /* SDL_cocoakeyboard.h */; }; - 04BD00F812E6671800899322 /* SDL_cocoakeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC712E6671800899322 /* SDL_cocoakeyboard.m */; }; - 04BD00F912E6671800899322 /* SDL_cocoamodes.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC812E6671800899322 /* SDL_cocoamodes.h */; }; - 04BD00FA12E6671800899322 /* SDL_cocoamodes.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC912E6671800899322 /* SDL_cocoamodes.m */; }; - 04BD00FB12E6671800899322 /* SDL_cocoamouse.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFECA12E6671800899322 /* SDL_cocoamouse.h */; }; - 04BD00FC12E6671800899322 /* SDL_cocoamouse.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFECB12E6671800899322 /* SDL_cocoamouse.m */; }; - 04BD00FD12E6671800899322 /* SDL_cocoaopengl.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFECC12E6671800899322 /* SDL_cocoaopengl.h */; }; - 04BD00FE12E6671800899322 /* SDL_cocoaopengl.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFECD12E6671800899322 /* SDL_cocoaopengl.m */; }; - 04BD00FF12E6671800899322 /* SDL_cocoashape.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFECE12E6671800899322 /* SDL_cocoashape.h */; }; - 04BD010012E6671800899322 /* SDL_cocoashape.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFECF12E6671800899322 /* SDL_cocoashape.m */; }; - 04BD010112E6671800899322 /* SDL_cocoavideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFED012E6671800899322 /* SDL_cocoavideo.h */; }; - 04BD010212E6671800899322 /* SDL_cocoavideo.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFED112E6671800899322 /* SDL_cocoavideo.m */; }; - 04BD010312E6671800899322 /* SDL_cocoawindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFED212E6671800899322 /* SDL_cocoawindow.h */; }; - 04BD010412E6671800899322 /* SDL_cocoawindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFED312E6671800899322 /* SDL_cocoawindow.m */; }; - 04BD011712E6671800899322 /* SDL_nullevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEE812E6671800899322 /* SDL_nullevents.c */; }; - 04BD011812E6671800899322 /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEE912E6671800899322 /* SDL_nullevents_c.h */; }; - 04BD011B12E6671800899322 /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEEC12E6671800899322 /* SDL_nullvideo.c */; }; - 04BD011C12E6671800899322 /* SDL_nullvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEED12E6671800899322 /* SDL_nullvideo.h */; }; - 04BD017512E6671800899322 /* SDL_blit.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF4E12E6671800899322 /* SDL_blit.c */; }; - 04BD017612E6671800899322 /* SDL_blit.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF4F12E6671800899322 /* SDL_blit.h */; }; - 04BD017712E6671800899322 /* SDL_blit_0.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5012E6671800899322 /* SDL_blit_0.c */; }; - 04BD017812E6671800899322 /* SDL_blit_1.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5112E6671800899322 /* SDL_blit_1.c */; }; - 04BD017912E6671800899322 /* SDL_blit_A.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5212E6671800899322 /* SDL_blit_A.c */; }; - 04BD017A12E6671800899322 /* SDL_blit_auto.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5312E6671800899322 /* SDL_blit_auto.c */; }; - 04BD017B12E6671800899322 /* SDL_blit_auto.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF5412E6671800899322 /* SDL_blit_auto.h */; }; - 04BD017C12E6671800899322 /* SDL_blit_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5512E6671800899322 /* SDL_blit_copy.c */; }; - 04BD017D12E6671800899322 /* SDL_blit_copy.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF5612E6671800899322 /* SDL_blit_copy.h */; }; - 04BD017E12E6671800899322 /* SDL_blit_N.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5712E6671800899322 /* SDL_blit_N.c */; }; - 04BD017F12E6671800899322 /* SDL_blit_slow.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5812E6671800899322 /* SDL_blit_slow.c */; }; - 04BD018012E6671800899322 /* SDL_blit_slow.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF5912E6671800899322 /* SDL_blit_slow.h */; }; - 04BD018112E6671800899322 /* SDL_bmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5A12E6671800899322 /* SDL_bmp.c */; }; - 04BD018212E6671800899322 /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5B12E6671800899322 /* SDL_clipboard.c */; }; - 04BD018712E6671800899322 /* SDL_fillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6012E6671800899322 /* SDL_fillrect.c */; }; - 04BD018C12E6671800899322 /* SDL_pixels.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6512E6671800899322 /* SDL_pixels.c */; }; - 04BD018D12E6671800899322 /* SDL_pixels_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF6612E6671800899322 /* SDL_pixels_c.h */; }; - 04BD018E12E6671800899322 /* SDL_rect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6712E6671800899322 /* SDL_rect.c */; }; - 04BD019612E6671800899322 /* SDL_RLEaccel.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6F12E6671800899322 /* SDL_RLEaccel.c */; }; - 04BD019712E6671800899322 /* SDL_RLEaccel_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7012E6671800899322 /* SDL_RLEaccel_c.h */; }; - 04BD019812E6671800899322 /* SDL_shape.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7112E6671800899322 /* SDL_shape.c */; }; - 04BD019912E6671800899322 /* SDL_shape_internals.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7212E6671800899322 /* SDL_shape_internals.h */; }; - 04BD019A12E6671800899322 /* SDL_stretch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7312E6671800899322 /* SDL_stretch.c */; }; - 04BD019B12E6671800899322 /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7412E6671800899322 /* SDL_surface.c */; }; - 04BD019C12E6671800899322 /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7512E6671800899322 /* SDL_sysvideo.h */; }; - 04BD019D12E6671800899322 /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7612E6671800899322 /* SDL_video.c */; }; - 04BD01DB12E6671800899322 /* imKStoUCS.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFB812E6671800899322 /* imKStoUCS.c */; }; - 04BD01DC12E6671800899322 /* imKStoUCS.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFB912E6671800899322 /* imKStoUCS.h */; }; - 04BD01DD12E6671800899322 /* SDL_x11clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */; }; - 04BD01DE12E6671800899322 /* SDL_x11clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBB12E6671800899322 /* SDL_x11clipboard.h */; }; - 04BD01DF12E6671800899322 /* SDL_x11dyn.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBC12E6671800899322 /* SDL_x11dyn.c */; }; - 04BD01E012E6671800899322 /* SDL_x11dyn.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBD12E6671800899322 /* SDL_x11dyn.h */; }; - 04BD01E112E6671800899322 /* SDL_x11events.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBE12E6671800899322 /* SDL_x11events.c */; }; - 04BD01E212E6671800899322 /* SDL_x11events.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBF12E6671800899322 /* SDL_x11events.h */; }; - 04BD01E512E6671800899322 /* SDL_x11keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC212E6671800899322 /* SDL_x11keyboard.c */; }; - 04BD01E612E6671800899322 /* SDL_x11keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC312E6671800899322 /* SDL_x11keyboard.h */; }; - 04BD01E712E6671800899322 /* SDL_x11modes.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC412E6671800899322 /* SDL_x11modes.c */; }; - 04BD01E812E6671800899322 /* SDL_x11modes.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC512E6671800899322 /* SDL_x11modes.h */; }; - 04BD01E912E6671800899322 /* SDL_x11mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC612E6671800899322 /* SDL_x11mouse.c */; }; - 04BD01EA12E6671800899322 /* SDL_x11mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC712E6671800899322 /* SDL_x11mouse.h */; }; - 04BD01EB12E6671800899322 /* SDL_x11opengl.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC812E6671800899322 /* SDL_x11opengl.c */; }; - 04BD01EC12E6671800899322 /* SDL_x11opengl.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC912E6671800899322 /* SDL_x11opengl.h */; }; - 04BD01ED12E6671800899322 /* SDL_x11opengles.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFCA12E6671800899322 /* SDL_x11opengles.c */; }; - 04BD01EE12E6671800899322 /* SDL_x11opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFCB12E6671800899322 /* SDL_x11opengles.h */; }; - 04BD01F112E6671800899322 /* SDL_x11shape.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFCE12E6671800899322 /* SDL_x11shape.c */; }; - 04BD01F212E6671800899322 /* SDL_x11shape.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFCF12E6671800899322 /* SDL_x11shape.h */; }; - 04BD01F312E6671800899322 /* SDL_x11sym.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD012E6671800899322 /* SDL_x11sym.h */; }; - 04BD01F412E6671800899322 /* SDL_x11touch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD112E6671800899322 /* SDL_x11touch.c */; }; - 04BD01F512E6671800899322 /* SDL_x11touch.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD212E6671800899322 /* SDL_x11touch.h */; }; - 04BD01F612E6671800899322 /* SDL_x11video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD312E6671800899322 /* SDL_x11video.c */; }; - 04BD01F712E6671800899322 /* SDL_x11video.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD412E6671800899322 /* SDL_x11video.h */; }; - 04BD01F812E6671800899322 /* SDL_x11window.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD512E6671800899322 /* SDL_x11window.c */; }; - 04BD01F912E6671800899322 /* SDL_x11window.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD612E6671800899322 /* SDL_x11window.h */; }; - 04BD021712E6671800899322 /* SDL_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD7412E6671700899322 /* SDL_atomic.c */; }; - 04BD021812E6671800899322 /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD7512E6671700899322 /* SDL_spinlock.c */; }; - 04BD022412E6671800899322 /* SDL_diskaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD8812E6671700899322 /* SDL_diskaudio.c */; }; - 04BD022512E6671800899322 /* SDL_diskaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD8912E6671700899322 /* SDL_diskaudio.h */; }; - 04BD022C12E6671800899322 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; }; - 04BD022D12E6671800899322 /* SDL_dummyaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */; }; - 04BD023512E6671800899322 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDA112E6671700899322 /* SDL_coreaudio.h */; }; - 04BD024212E6671800899322 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB412E6671700899322 /* SDL_audio.c */; }; - 04BD024312E6671800899322 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB512E6671700899322 /* SDL_audio_c.h */; }; - 04BD024412E6671800899322 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB612E6671700899322 /* SDL_audiocvt.c */; }; - 04BD024512E6671800899322 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB712E6671700899322 /* SDL_audiodev.c */; }; - 04BD024612E6671800899322 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */; }; - 04BD024812E6671800899322 /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */; }; - 04BD024912E6671800899322 /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBB12E6671700899322 /* SDL_mixer.c */; }; - 04BD025012E6671800899322 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC212E6671700899322 /* SDL_sysaudio.h */; }; - 04BD025112E6671800899322 /* SDL_wave.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDC312E6671700899322 /* SDL_wave.c */; }; - 04BD025212E6671800899322 /* SDL_wave.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC412E6671700899322 /* SDL_wave.h */; }; - 04BD025C12E6671800899322 /* SDL_cpuinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDD412E6671700899322 /* SDL_cpuinfo.c */; }; - 04BD025D12E6671800899322 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD612E6671700899322 /* blank_cursor.h */; }; - 04BD025E12E6671800899322 /* default_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD712E6671700899322 /* default_cursor.h */; }; - 04BD025F12E6671800899322 /* scancodes_darwin.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD812E6671700899322 /* scancodes_darwin.h */; }; - 04BD026012E6671800899322 /* scancodes_linux.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD912E6671700899322 /* scancodes_linux.h */; }; - 04BD026212E6671800899322 /* scancodes_xfree86.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDDB12E6671700899322 /* scancodes_xfree86.h */; }; - 04BD026312E6671800899322 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDDC12E6671700899322 /* SDL_clipboardevents.c */; }; - 04BD026412E6671800899322 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDDD12E6671700899322 /* SDL_clipboardevents_c.h */; }; - 04BD026512E6671800899322 /* SDL_events.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDDE12E6671700899322 /* SDL_events.c */; }; - 04BD026612E6671800899322 /* SDL_events_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDDF12E6671700899322 /* SDL_events_c.h */; }; - 04BD026712E6671800899322 /* SDL_gesture.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE012E6671700899322 /* SDL_gesture.c */; }; - 04BD026812E6671800899322 /* SDL_gesture_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE112E6671700899322 /* SDL_gesture_c.h */; }; - 04BD026912E6671800899322 /* SDL_keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE212E6671700899322 /* SDL_keyboard.c */; }; - 04BD026A12E6671800899322 /* SDL_keyboard_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE312E6671700899322 /* SDL_keyboard_c.h */; }; - 04BD026B12E6671800899322 /* SDL_mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE412E6671700899322 /* SDL_mouse.c */; }; - 04BD026C12E6671800899322 /* SDL_mouse_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE512E6671700899322 /* SDL_mouse_c.h */; }; - 04BD026D12E6671800899322 /* SDL_quit.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE612E6671700899322 /* SDL_quit.c */; }; - 04BD026E12E6671800899322 /* SDL_sysevents.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE712E6671700899322 /* SDL_sysevents.h */; }; - 04BD026F12E6671800899322 /* SDL_touch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE812E6671700899322 /* SDL_touch.c */; }; - 04BD027012E6671800899322 /* SDL_touch_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE912E6671700899322 /* SDL_touch_c.h */; }; - 04BD027112E6671800899322 /* SDL_windowevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDEA12E6671700899322 /* SDL_windowevents.c */; }; - 04BD027212E6671800899322 /* SDL_windowevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDEB12E6671700899322 /* SDL_windowevents_c.h */; }; - 04BD027312E6671800899322 /* SDL_rwopsbundlesupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDEE12E6671700899322 /* SDL_rwopsbundlesupport.h */; }; - 04BD027412E6671800899322 /* SDL_rwopsbundlesupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDEF12E6671700899322 /* SDL_rwopsbundlesupport.m */; }; - 04BD027512E6671800899322 /* SDL_rwops.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDF012E6671700899322 /* SDL_rwops.c */; }; - 04BD027612E6671800899322 /* SDL_syshaptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDF312E6671700899322 /* SDL_syshaptic.c */; }; - 04BD027A12E6671800899322 /* SDL_haptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDFA12E6671700899322 /* SDL_haptic.c */; }; - 04BD027B12E6671800899322 /* SDL_haptic_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDFB12E6671700899322 /* SDL_haptic_c.h */; }; - 04BD027C12E6671800899322 /* SDL_syshaptic.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDFC12E6671700899322 /* SDL_syshaptic.h */; }; - 04BD028112E6671800899322 /* SDL_sysjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE0712E6671700899322 /* SDL_sysjoystick.c */; }; - 04BD028212E6671800899322 /* SDL_sysjoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE0812E6671700899322 /* SDL_sysjoystick_c.h */; }; - 04BD028B12E6671800899322 /* SDL_joystick.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE1612E6671700899322 /* SDL_joystick.c */; }; - 04BD028C12E6671800899322 /* SDL_joystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1712E6671700899322 /* SDL_joystick_c.h */; }; - 04BD028D12E6671800899322 /* SDL_sysjoystick.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1812E6671700899322 /* SDL_sysjoystick.h */; }; - 04BD02A312E6671800899322 /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE3312E6671700899322 /* SDL_sysloadso.c */; }; - 04BD02AE12E6671800899322 /* SDL_syspower.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4B12E6671700899322 /* SDL_syspower.c */; }; - 04BD02B012E6671800899322 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4E12E6671700899322 /* SDL_power.c */; }; - 04BD02B512E6671800899322 /* SDL_assert_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE5512E6671700899322 /* SDL_assert_c.h */; }; - 04BD02B612E6671800899322 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5612E6671700899322 /* SDL_assert.c */; }; - 04BD02B812E6671800899322 /* SDL_error_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE5812E6671700899322 /* SDL_error_c.h */; }; - 04BD02B912E6671800899322 /* SDL_error.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5912E6671700899322 /* SDL_error.c */; }; - 04BD02BC12E6671800899322 /* SDL.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5C12E6671700899322 /* SDL.c */; }; - 04BD02BD12E6671800899322 /* SDL_getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5E12E6671700899322 /* SDL_getenv.c */; }; - 04BD02BE12E6671800899322 /* SDL_iconv.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5F12E6671700899322 /* SDL_iconv.c */; }; - 04BD02BF12E6671800899322 /* SDL_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6012E6671700899322 /* SDL_malloc.c */; }; - 04BD02C012E6671800899322 /* SDL_qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6112E6671700899322 /* SDL_qsort.c */; }; - 04BD02C112E6671800899322 /* SDL_stdlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6212E6671700899322 /* SDL_stdlib.c */; }; - 04BD02C212E6671800899322 /* SDL_string.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6312E6671700899322 /* SDL_string.c */; }; - 04BD02D712E6671800899322 /* SDL_syscond.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE7E12E6671800899322 /* SDL_syscond.c */; }; - 04BD02D812E6671800899322 /* SDL_sysmutex.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE7F12E6671800899322 /* SDL_sysmutex.c */; }; - 04BD02D912E6671800899322 /* SDL_sysmutex_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8012E6671800899322 /* SDL_sysmutex_c.h */; }; - 04BD02DA12E6671800899322 /* SDL_syssem.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE8112E6671800899322 /* SDL_syssem.c */; }; - 04BD02DB12E6671800899322 /* SDL_systhread.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE8212E6671800899322 /* SDL_systhread.c */; }; - 04BD02DC12E6671800899322 /* SDL_systhread_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8312E6671800899322 /* SDL_systhread_c.h */; }; - 04BD02E312E6671800899322 /* SDL_systhread.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8B12E6671800899322 /* SDL_systhread.h */; }; - 04BD02E412E6671800899322 /* SDL_thread.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE8C12E6671800899322 /* SDL_thread.c */; }; - 04BD02E512E6671800899322 /* SDL_thread_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8D12E6671800899322 /* SDL_thread_c.h */; }; - 04BD02F112E6671800899322 /* SDL_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE9F12E6671800899322 /* SDL_timer.c */; }; - 04BD02F212E6671800899322 /* SDL_timer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEA012E6671800899322 /* SDL_timer_c.h */; }; - 04BD02F312E6671800899322 /* SDL_systimer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEA212E6671800899322 /* SDL_systimer.c */; }; - 04BD030D12E6671800899322 /* SDL_cocoaclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC212E6671800899322 /* SDL_cocoaclipboard.h */; }; - 04BD030E12E6671800899322 /* SDL_cocoaclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC312E6671800899322 /* SDL_cocoaclipboard.m */; }; - 04BD030F12E6671800899322 /* SDL_cocoaevents.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC412E6671800899322 /* SDL_cocoaevents.h */; }; - 04BD031012E6671800899322 /* SDL_cocoaevents.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC512E6671800899322 /* SDL_cocoaevents.m */; }; - 04BD031112E6671800899322 /* SDL_cocoakeyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC612E6671800899322 /* SDL_cocoakeyboard.h */; }; - 04BD031212E6671800899322 /* SDL_cocoakeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC712E6671800899322 /* SDL_cocoakeyboard.m */; }; - 04BD031312E6671800899322 /* SDL_cocoamodes.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC812E6671800899322 /* SDL_cocoamodes.h */; }; - 04BD031412E6671800899322 /* SDL_cocoamodes.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC912E6671800899322 /* SDL_cocoamodes.m */; }; - 04BD031512E6671800899322 /* SDL_cocoamouse.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFECA12E6671800899322 /* SDL_cocoamouse.h */; }; - 04BD031612E6671800899322 /* SDL_cocoamouse.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFECB12E6671800899322 /* SDL_cocoamouse.m */; }; - 04BD031712E6671800899322 /* SDL_cocoaopengl.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFECC12E6671800899322 /* SDL_cocoaopengl.h */; }; - 04BD031812E6671800899322 /* SDL_cocoaopengl.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFECD12E6671800899322 /* SDL_cocoaopengl.m */; }; - 04BD031912E6671800899322 /* SDL_cocoashape.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFECE12E6671800899322 /* SDL_cocoashape.h */; }; - 04BD031A12E6671800899322 /* SDL_cocoashape.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFECF12E6671800899322 /* SDL_cocoashape.m */; }; - 04BD031B12E6671800899322 /* SDL_cocoavideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFED012E6671800899322 /* SDL_cocoavideo.h */; }; - 04BD031C12E6671800899322 /* SDL_cocoavideo.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFED112E6671800899322 /* SDL_cocoavideo.m */; }; - 04BD031D12E6671800899322 /* SDL_cocoawindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFED212E6671800899322 /* SDL_cocoawindow.h */; }; - 04BD031E12E6671800899322 /* SDL_cocoawindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFED312E6671800899322 /* SDL_cocoawindow.m */; }; - 04BD033112E6671800899322 /* SDL_nullevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEE812E6671800899322 /* SDL_nullevents.c */; }; - 04BD033212E6671800899322 /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEE912E6671800899322 /* SDL_nullevents_c.h */; }; - 04BD033512E6671800899322 /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEEC12E6671800899322 /* SDL_nullvideo.c */; }; - 04BD033612E6671800899322 /* SDL_nullvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEED12E6671800899322 /* SDL_nullvideo.h */; }; - 04BD038F12E6671800899322 /* SDL_blit.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF4E12E6671800899322 /* SDL_blit.c */; }; - 04BD039012E6671800899322 /* SDL_blit.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF4F12E6671800899322 /* SDL_blit.h */; }; - 04BD039112E6671800899322 /* SDL_blit_0.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5012E6671800899322 /* SDL_blit_0.c */; }; - 04BD039212E6671800899322 /* SDL_blit_1.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5112E6671800899322 /* SDL_blit_1.c */; }; - 04BD039312E6671800899322 /* SDL_blit_A.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5212E6671800899322 /* SDL_blit_A.c */; }; - 04BD039412E6671800899322 /* SDL_blit_auto.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5312E6671800899322 /* SDL_blit_auto.c */; }; - 04BD039512E6671800899322 /* SDL_blit_auto.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF5412E6671800899322 /* SDL_blit_auto.h */; }; - 04BD039612E6671800899322 /* SDL_blit_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5512E6671800899322 /* SDL_blit_copy.c */; }; - 04BD039712E6671800899322 /* SDL_blit_copy.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF5612E6671800899322 /* SDL_blit_copy.h */; }; - 04BD039812E6671800899322 /* SDL_blit_N.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5712E6671800899322 /* SDL_blit_N.c */; }; - 04BD039912E6671800899322 /* SDL_blit_slow.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5812E6671800899322 /* SDL_blit_slow.c */; }; - 04BD039A12E6671800899322 /* SDL_blit_slow.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF5912E6671800899322 /* SDL_blit_slow.h */; }; - 04BD039B12E6671800899322 /* SDL_bmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5A12E6671800899322 /* SDL_bmp.c */; }; - 04BD039C12E6671800899322 /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5B12E6671800899322 /* SDL_clipboard.c */; }; - 04BD03A112E6671800899322 /* SDL_fillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6012E6671800899322 /* SDL_fillrect.c */; }; - 04BD03A612E6671800899322 /* SDL_pixels.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6512E6671800899322 /* SDL_pixels.c */; }; - 04BD03A712E6671800899322 /* SDL_pixels_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF6612E6671800899322 /* SDL_pixels_c.h */; }; - 04BD03A812E6671800899322 /* SDL_rect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6712E6671800899322 /* SDL_rect.c */; }; - 04BD03B012E6671800899322 /* SDL_RLEaccel.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6F12E6671800899322 /* SDL_RLEaccel.c */; }; - 04BD03B112E6671800899322 /* SDL_RLEaccel_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7012E6671800899322 /* SDL_RLEaccel_c.h */; }; - 04BD03B212E6671800899322 /* SDL_shape.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7112E6671800899322 /* SDL_shape.c */; }; - 04BD03B312E6671800899322 /* SDL_shape_internals.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7212E6671800899322 /* SDL_shape_internals.h */; }; - 04BD03B412E6671800899322 /* SDL_stretch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7312E6671800899322 /* SDL_stretch.c */; }; - 04BD03B512E6671800899322 /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7412E6671800899322 /* SDL_surface.c */; }; - 04BD03B612E6671800899322 /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7512E6671800899322 /* SDL_sysvideo.h */; }; - 04BD03B712E6671800899322 /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7612E6671800899322 /* SDL_video.c */; }; - 04BD03F312E6671800899322 /* imKStoUCS.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFB812E6671800899322 /* imKStoUCS.c */; }; - 04BD03F412E6671800899322 /* imKStoUCS.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFB912E6671800899322 /* imKStoUCS.h */; }; - 04BD03F512E6671800899322 /* SDL_x11clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */; }; - 04BD03F612E6671800899322 /* SDL_x11clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBB12E6671800899322 /* SDL_x11clipboard.h */; }; - 04BD03F712E6671800899322 /* SDL_x11dyn.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBC12E6671800899322 /* SDL_x11dyn.c */; }; - 04BD03F812E6671800899322 /* SDL_x11dyn.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBD12E6671800899322 /* SDL_x11dyn.h */; }; - 04BD03F912E6671800899322 /* SDL_x11events.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBE12E6671800899322 /* SDL_x11events.c */; }; - 04BD03FA12E6671800899322 /* SDL_x11events.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBF12E6671800899322 /* SDL_x11events.h */; }; - 04BD03FD12E6671800899322 /* SDL_x11keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC212E6671800899322 /* SDL_x11keyboard.c */; }; - 04BD03FE12E6671800899322 /* SDL_x11keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC312E6671800899322 /* SDL_x11keyboard.h */; }; - 04BD03FF12E6671800899322 /* SDL_x11modes.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC412E6671800899322 /* SDL_x11modes.c */; }; - 04BD040012E6671800899322 /* SDL_x11modes.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC512E6671800899322 /* SDL_x11modes.h */; }; - 04BD040112E6671800899322 /* SDL_x11mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC612E6671800899322 /* SDL_x11mouse.c */; }; - 04BD040212E6671800899322 /* SDL_x11mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC712E6671800899322 /* SDL_x11mouse.h */; }; - 04BD040312E6671800899322 /* SDL_x11opengl.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC812E6671800899322 /* SDL_x11opengl.c */; }; - 04BD040412E6671800899322 /* SDL_x11opengl.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC912E6671800899322 /* SDL_x11opengl.h */; }; - 04BD040512E6671800899322 /* SDL_x11opengles.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFCA12E6671800899322 /* SDL_x11opengles.c */; }; - 04BD040612E6671800899322 /* SDL_x11opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFCB12E6671800899322 /* SDL_x11opengles.h */; }; - 04BD040912E6671800899322 /* SDL_x11shape.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFCE12E6671800899322 /* SDL_x11shape.c */; }; - 04BD040A12E6671800899322 /* SDL_x11shape.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFCF12E6671800899322 /* SDL_x11shape.h */; }; - 04BD040B12E6671800899322 /* SDL_x11sym.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD012E6671800899322 /* SDL_x11sym.h */; }; - 04BD040C12E6671800899322 /* SDL_x11touch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD112E6671800899322 /* SDL_x11touch.c */; }; - 04BD040D12E6671800899322 /* SDL_x11touch.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD212E6671800899322 /* SDL_x11touch.h */; }; - 04BD040E12E6671800899322 /* SDL_x11video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD312E6671800899322 /* SDL_x11video.c */; }; - 04BD040F12E6671800899322 /* SDL_x11video.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD412E6671800899322 /* SDL_x11video.h */; }; - 04BD041012E6671800899322 /* SDL_x11window.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD512E6671800899322 /* SDL_x11window.c */; }; - 04BD041112E6671800899322 /* SDL_x11window.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD612E6671800899322 /* SDL_x11window.h */; }; - 04BDFFFB12E6671800899322 /* SDL_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD7412E6671700899322 /* SDL_atomic.c */; }; - 04BDFFFC12E6671800899322 /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD7512E6671700899322 /* SDL_spinlock.c */; }; - 04F7803912FB748500FC43C0 /* SDL_nullframebuffer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7803712FB748500FC43C0 /* SDL_nullframebuffer_c.h */; }; - 04F7803A12FB748500FC43C0 /* SDL_nullframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803812FB748500FC43C0 /* SDL_nullframebuffer.c */; }; - 04F7803B12FB748500FC43C0 /* SDL_nullframebuffer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7803712FB748500FC43C0 /* SDL_nullframebuffer_c.h */; }; - 04F7803C12FB748500FC43C0 /* SDL_nullframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803812FB748500FC43C0 /* SDL_nullframebuffer.c */; }; - 04F7804912FB74A200FC43C0 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803D12FB74A200FC43C0 /* SDL_blendfillrect.c */; }; - 04F7804A12FB74A200FC43C0 /* SDL_blendfillrect.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7803E12FB74A200FC43C0 /* SDL_blendfillrect.h */; }; - 04F7804B12FB74A200FC43C0 /* SDL_blendline.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803F12FB74A200FC43C0 /* SDL_blendline.c */; }; - 04F7804C12FB74A200FC43C0 /* SDL_blendline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804012FB74A200FC43C0 /* SDL_blendline.h */; }; - 04F7804D12FB74A200FC43C0 /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804112FB74A200FC43C0 /* SDL_blendpoint.c */; }; - 04F7804E12FB74A200FC43C0 /* SDL_blendpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804212FB74A200FC43C0 /* SDL_blendpoint.h */; }; - 04F7804F12FB74A200FC43C0 /* SDL_draw.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804312FB74A200FC43C0 /* SDL_draw.h */; }; - 04F7805012FB74A200FC43C0 /* SDL_drawline.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804412FB74A200FC43C0 /* SDL_drawline.c */; }; - 04F7805112FB74A200FC43C0 /* SDL_drawline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804512FB74A200FC43C0 /* SDL_drawline.h */; }; - 04F7805212FB74A200FC43C0 /* SDL_drawpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804612FB74A200FC43C0 /* SDL_drawpoint.c */; }; - 04F7805312FB74A200FC43C0 /* SDL_drawpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804712FB74A200FC43C0 /* SDL_drawpoint.h */; }; - 04F7805512FB74A200FC43C0 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803D12FB74A200FC43C0 /* SDL_blendfillrect.c */; }; - 04F7805612FB74A200FC43C0 /* SDL_blendfillrect.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7803E12FB74A200FC43C0 /* SDL_blendfillrect.h */; }; - 04F7805712FB74A200FC43C0 /* SDL_blendline.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803F12FB74A200FC43C0 /* SDL_blendline.c */; }; - 04F7805812FB74A200FC43C0 /* SDL_blendline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804012FB74A200FC43C0 /* SDL_blendline.h */; }; - 04F7805912FB74A200FC43C0 /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804112FB74A200FC43C0 /* SDL_blendpoint.c */; }; - 04F7805A12FB74A200FC43C0 /* SDL_blendpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804212FB74A200FC43C0 /* SDL_blendpoint.h */; }; - 04F7805B12FB74A200FC43C0 /* SDL_draw.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804312FB74A200FC43C0 /* SDL_draw.h */; }; - 04F7805C12FB74A200FC43C0 /* SDL_drawline.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804412FB74A200FC43C0 /* SDL_drawline.c */; }; - 04F7805D12FB74A200FC43C0 /* SDL_drawline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804512FB74A200FC43C0 /* SDL_drawline.h */; }; - 04F7805E12FB74A200FC43C0 /* SDL_drawpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804612FB74A200FC43C0 /* SDL_drawpoint.c */; }; - 04F7805F12FB74A200FC43C0 /* SDL_drawpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804712FB74A200FC43C0 /* SDL_drawpoint.h */; }; - 562C4AE91D8F496200AF9EBE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; }; - 562C4AEA1D8F496300AF9EBE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; }; - 562D3C7C1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */; }; - 562D3C7D1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */; }; - 566CDE8F148F0AC200C5A9BB /* SDL_dropevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 566CDE8D148F0AC200C5A9BB /* SDL_dropevents_c.h */; }; - 566CDE90148F0AC200C5A9BB /* SDL_dropevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 566CDE8E148F0AC200C5A9BB /* SDL_dropevents.c */; }; - 567E2F1C17C44BB2005F1892 /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */; }; - 567E2F2117C44C35005F1892 /* SDL_filesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 567E2F2017C44C35005F1892 /* SDL_filesystem.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 56A670091856545C0007D20F /* SDL_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A670081856545C0007D20F /* SDL_internal.h */; }; - 56A6700A1856545C0007D20F /* SDL_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A670081856545C0007D20F /* SDL_internal.h */; }; - 56A6700B1856545C0007D20F /* SDL_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A670081856545C0007D20F /* SDL_internal.h */; }; - 56A67021185654B40007D20F /* SDL_dynapi_procs.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6701D185654B40007D20F /* SDL_dynapi_procs.h */; }; - 56A67022185654B40007D20F /* SDL_dynapi_procs.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6701D185654B40007D20F /* SDL_dynapi_procs.h */; }; - 56A67023185654B40007D20F /* SDL_dynapi_procs.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6701D185654B40007D20F /* SDL_dynapi_procs.h */; }; - 56A67024185654B40007D20F /* SDL_dynapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 56A6701E185654B40007D20F /* SDL_dynapi.c */; }; - 56A67025185654B40007D20F /* SDL_dynapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 56A6701E185654B40007D20F /* SDL_dynapi.c */; }; - 56A67026185654B40007D20F /* SDL_dynapi.c in Sources */ = {isa = PBXBuildFile; fileRef = 56A6701E185654B40007D20F /* SDL_dynapi.c */; }; - 56A67027185654B40007D20F /* SDL_dynapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6701F185654B40007D20F /* SDL_dynapi.h */; }; - 56A67028185654B40007D20F /* SDL_dynapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6701F185654B40007D20F /* SDL_dynapi.h */; }; - 56A67029185654B40007D20F /* SDL_dynapi.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A6701F185654B40007D20F /* SDL_dynapi.h */; }; - 56A6702A185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; }; - 56A6702B185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; }; - 56A6702C185654B40007D20F /* SDL_dynapi_overrides.h in Headers */ = {isa = PBXBuildFile; fileRef = 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */; }; - 56C5237E1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; }; - 56C5237F1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; }; - 56C523801D8F498B001F2F30 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D0D08310675DD9004B05EF /* CoreFoundation.framework */; }; - 56C523811D8F498C001F2F30 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00D0D08310675DD9004B05EF /* CoreFoundation.framework */; }; - A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E951D8B69D600B177DD /* CoreAudio.framework */; }; - A7381E971D8B6A0300B177DD /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A7381E931D8B69C300B177DD /* AudioToolbox.framework */; }; - A77E6EB4167AB0A90010E40B /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; }; - A77E6EB5167AB0A90010E40B /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA0AD09D16648D1700CE5896 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = BBFC088A164C6514003E6A99 /* SDL_gamecontroller.c */; }; - AA0F8491178D5ECC00823F9D /* SDL_systls.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0F8490178D5ECC00823F9D /* SDL_systls.c */; }; - AA0F8492178D5ECC00823F9D /* SDL_systls.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0F8490178D5ECC00823F9D /* SDL_systls.c */; }; - AA0F8493178D5ECC00823F9D /* SDL_systls.c in Sources */ = {isa = PBXBuildFile; fileRef = AA0F8490178D5ECC00823F9D /* SDL_systls.c */; }; - AA41F88014B8F1F500993C4F /* SDL_dropevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 566CDE8E148F0AC200C5A9BB /* SDL_dropevents.c */; }; - AA628ACA159367B7005138DD /* SDL_rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628AC8159367B7005138DD /* SDL_rotate.c */; }; - AA628ACB159367B7005138DD /* SDL_rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628AC8159367B7005138DD /* SDL_rotate.c */; }; - AA628ACC159367B7005138DD /* SDL_rotate.h in Headers */ = {isa = PBXBuildFile; fileRef = AA628AC9159367B7005138DD /* SDL_rotate.h */; }; - AA628ACD159367B7005138DD /* SDL_rotate.h in Headers */ = {isa = PBXBuildFile; fileRef = AA628AC9159367B7005138DD /* SDL_rotate.h */; }; - AA628AD1159367F2005138DD /* SDL_x11xinput2.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628ACF159367F2005138DD /* SDL_x11xinput2.c */; }; - AA628AD2159367F2005138DD /* SDL_x11xinput2.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628ACF159367F2005138DD /* SDL_x11xinput2.c */; }; - AA628AD3159367F2005138DD /* SDL_x11xinput2.h in Headers */ = {isa = PBXBuildFile; fileRef = AA628AD0159367F2005138DD /* SDL_x11xinput2.h */; }; - AA628AD4159367F2005138DD /* SDL_x11xinput2.h in Headers */ = {isa = PBXBuildFile; fileRef = AA628AD0159367F2005138DD /* SDL_x11xinput2.h */; }; - AA7557FA1595D4D800BBD41B /* begin_code.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557C71595D4D800BBD41B /* begin_code.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7557FB1595D4D800BBD41B /* begin_code.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557C71595D4D800BBD41B /* begin_code.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7557FC1595D4D800BBD41B /* close_code.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557C81595D4D800BBD41B /* close_code.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7557FD1595D4D800BBD41B /* close_code.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557C81595D4D800BBD41B /* close_code.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7557FE1595D4D800BBD41B /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557C91595D4D800BBD41B /* SDL_assert.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7557FF1595D4D800BBD41B /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557C91595D4D800BBD41B /* SDL_assert.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558001595D4D800BBD41B /* SDL_atomic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CA1595D4D800BBD41B /* SDL_atomic.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558011595D4D800BBD41B /* SDL_atomic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CA1595D4D800BBD41B /* SDL_atomic.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558021595D4D800BBD41B /* SDL_audio.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CB1595D4D800BBD41B /* SDL_audio.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558031595D4D800BBD41B /* SDL_audio.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CB1595D4D800BBD41B /* SDL_audio.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558041595D4D800BBD41B /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558051595D4D800BBD41B /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558061595D4D800BBD41B /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558071595D4D800BBD41B /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558081595D4D800BBD41B /* SDL_config_macosx.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CE1595D4D800BBD41B /* SDL_config_macosx.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558091595D4D800BBD41B /* SDL_config_macosx.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CE1595D4D800BBD41B /* SDL_config_macosx.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75580A1595D4D800BBD41B /* SDL_config.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CF1595D4D800BBD41B /* SDL_config.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75580B1595D4D800BBD41B /* SDL_config.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CF1595D4D800BBD41B /* SDL_config.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75580C1595D4D800BBD41B /* SDL_copying.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D01595D4D800BBD41B /* SDL_copying.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75580D1595D4D800BBD41B /* SDL_copying.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D01595D4D800BBD41B /* SDL_copying.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75580E1595D4D800BBD41B /* SDL_cpuinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D11595D4D800BBD41B /* SDL_cpuinfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75580F1595D4D800BBD41B /* SDL_cpuinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D11595D4D800BBD41B /* SDL_cpuinfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558101595D4D800BBD41B /* SDL_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D21595D4D800BBD41B /* SDL_endian.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558111595D4D800BBD41B /* SDL_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D21595D4D800BBD41B /* SDL_endian.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558121595D4D800BBD41B /* SDL_error.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D31595D4D800BBD41B /* SDL_error.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558131595D4D800BBD41B /* SDL_error.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D31595D4D800BBD41B /* SDL_error.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558141595D4D800BBD41B /* SDL_events.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D41595D4D800BBD41B /* SDL_events.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558151595D4D800BBD41B /* SDL_events.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D41595D4D800BBD41B /* SDL_events.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558161595D4D800BBD41B /* SDL_gesture.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D51595D4D800BBD41B /* SDL_gesture.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558171595D4D800BBD41B /* SDL_gesture.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D51595D4D800BBD41B /* SDL_gesture.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558181595D4D800BBD41B /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D61595D4D800BBD41B /* SDL_haptic.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558191595D4D800BBD41B /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D61595D4D800BBD41B /* SDL_haptic.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75581A1595D4D800BBD41B /* SDL_hints.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D71595D4D800BBD41B /* SDL_hints.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75581B1595D4D800BBD41B /* SDL_hints.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D71595D4D800BBD41B /* SDL_hints.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75581E1595D4D800BBD41B /* SDL_joystick.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D91595D4D800BBD41B /* SDL_joystick.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75581F1595D4D800BBD41B /* SDL_joystick.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D91595D4D800BBD41B /* SDL_joystick.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558201595D4D800BBD41B /* SDL_keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DA1595D4D800BBD41B /* SDL_keyboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558211595D4D800BBD41B /* SDL_keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DA1595D4D800BBD41B /* SDL_keyboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558221595D4D800BBD41B /* SDL_keycode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DB1595D4D800BBD41B /* SDL_keycode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558231595D4D800BBD41B /* SDL_keycode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DB1595D4D800BBD41B /* SDL_keycode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558241595D4D800BBD41B /* SDL_loadso.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DC1595D4D800BBD41B /* SDL_loadso.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558251595D4D800BBD41B /* SDL_loadso.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DC1595D4D800BBD41B /* SDL_loadso.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558261595D4D800BBD41B /* SDL_log.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DD1595D4D800BBD41B /* SDL_log.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558271595D4D800BBD41B /* SDL_log.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DD1595D4D800BBD41B /* SDL_log.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558281595D4D800BBD41B /* SDL_main.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DE1595D4D800BBD41B /* SDL_main.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558291595D4D800BBD41B /* SDL_main.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DE1595D4D800BBD41B /* SDL_main.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75582A1595D4D800BBD41B /* SDL_mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DF1595D4D800BBD41B /* SDL_mouse.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75582B1595D4D800BBD41B /* SDL_mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DF1595D4D800BBD41B /* SDL_mouse.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75582C1595D4D800BBD41B /* SDL_mutex.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E01595D4D800BBD41B /* SDL_mutex.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75582D1595D4D800BBD41B /* SDL_mutex.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E01595D4D800BBD41B /* SDL_mutex.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75582E1595D4D800BBD41B /* SDL_name.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E11595D4D800BBD41B /* SDL_name.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75582F1595D4D800BBD41B /* SDL_name.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E11595D4D800BBD41B /* SDL_name.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558301595D4D800BBD41B /* SDL_opengl.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E21595D4D800BBD41B /* SDL_opengl.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558311595D4D800BBD41B /* SDL_opengl.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E21595D4D800BBD41B /* SDL_opengl.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558321595D4D800BBD41B /* SDL_opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E31595D4D800BBD41B /* SDL_opengles.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558331595D4D800BBD41B /* SDL_opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E31595D4D800BBD41B /* SDL_opengles.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558341595D4D800BBD41B /* SDL_opengles2.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E41595D4D800BBD41B /* SDL_opengles2.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558351595D4D800BBD41B /* SDL_opengles2.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E41595D4D800BBD41B /* SDL_opengles2.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558361595D4D800BBD41B /* SDL_pixels.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E51595D4D800BBD41B /* SDL_pixels.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558371595D4D800BBD41B /* SDL_pixels.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E51595D4D800BBD41B /* SDL_pixels.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558381595D4D800BBD41B /* SDL_platform.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E61595D4D800BBD41B /* SDL_platform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558391595D4D800BBD41B /* SDL_platform.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E61595D4D800BBD41B /* SDL_platform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75583A1595D4D800BBD41B /* SDL_power.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E71595D4D800BBD41B /* SDL_power.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75583B1595D4D800BBD41B /* SDL_power.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E71595D4D800BBD41B /* SDL_power.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75583C1595D4D800BBD41B /* SDL_quit.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E81595D4D800BBD41B /* SDL_quit.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75583D1595D4D800BBD41B /* SDL_quit.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E81595D4D800BBD41B /* SDL_quit.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75583E1595D4D800BBD41B /* SDL_rect.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E91595D4D800BBD41B /* SDL_rect.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75583F1595D4D800BBD41B /* SDL_rect.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E91595D4D800BBD41B /* SDL_rect.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558401595D4D800BBD41B /* SDL_render.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EA1595D4D800BBD41B /* SDL_render.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558411595D4D800BBD41B /* SDL_render.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EA1595D4D800BBD41B /* SDL_render.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558421595D4D800BBD41B /* SDL_revision.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EB1595D4D800BBD41B /* SDL_revision.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558431595D4D800BBD41B /* SDL_revision.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EB1595D4D800BBD41B /* SDL_revision.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558441595D4D800BBD41B /* SDL_rwops.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EC1595D4D800BBD41B /* SDL_rwops.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558451595D4D800BBD41B /* SDL_rwops.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EC1595D4D800BBD41B /* SDL_rwops.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558461595D4D800BBD41B /* SDL_scancode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557ED1595D4D800BBD41B /* SDL_scancode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558471595D4D800BBD41B /* SDL_scancode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557ED1595D4D800BBD41B /* SDL_scancode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558481595D4D800BBD41B /* SDL_shape.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EE1595D4D800BBD41B /* SDL_shape.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558491595D4D800BBD41B /* SDL_shape.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EE1595D4D800BBD41B /* SDL_shape.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75584A1595D4D800BBD41B /* SDL_stdinc.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EF1595D4D800BBD41B /* SDL_stdinc.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75584B1595D4D800BBD41B /* SDL_stdinc.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EF1595D4D800BBD41B /* SDL_stdinc.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75584C1595D4D800BBD41B /* SDL_surface.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F01595D4D800BBD41B /* SDL_surface.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75584D1595D4D800BBD41B /* SDL_surface.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F01595D4D800BBD41B /* SDL_surface.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75584E1595D4D800BBD41B /* SDL_system.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F11595D4D800BBD41B /* SDL_system.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75584F1595D4D800BBD41B /* SDL_system.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F11595D4D800BBD41B /* SDL_system.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558501595D4D800BBD41B /* SDL_syswm.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F21595D4D800BBD41B /* SDL_syswm.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558511595D4D800BBD41B /* SDL_syswm.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F21595D4D800BBD41B /* SDL_syswm.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558521595D4D800BBD41B /* SDL_thread.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F31595D4D800BBD41B /* SDL_thread.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558531595D4D800BBD41B /* SDL_thread.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F31595D4D800BBD41B /* SDL_thread.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558541595D4D800BBD41B /* SDL_timer.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F41595D4D800BBD41B /* SDL_timer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558551595D4D800BBD41B /* SDL_timer.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F41595D4D800BBD41B /* SDL_timer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558561595D4D800BBD41B /* SDL_touch.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F51595D4D800BBD41B /* SDL_touch.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558571595D4D800BBD41B /* SDL_touch.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F51595D4D800BBD41B /* SDL_touch.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558581595D4D800BBD41B /* SDL_types.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F61595D4D800BBD41B /* SDL_types.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA7558591595D4D800BBD41B /* SDL_types.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F61595D4D800BBD41B /* SDL_types.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75585A1595D4D800BBD41B /* SDL_version.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F71595D4D800BBD41B /* SDL_version.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75585B1595D4D800BBD41B /* SDL_version.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F71595D4D800BBD41B /* SDL_version.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75585C1595D4D800BBD41B /* SDL_video.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F81595D4D800BBD41B /* SDL_video.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75585D1595D4D800BBD41B /* SDL_video.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F81595D4D800BBD41B /* SDL_video.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75585E1595D4D800BBD41B /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F91595D4D800BBD41B /* SDL.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA75585F1595D4D800BBD41B /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F91595D4D800BBD41B /* SDL.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AA9E4093163BE51E007A2AD0 /* SDL_x11messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */; }; - AA9E4094163BE51E007A2AD0 /* SDL_x11messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */; }; - AA9FF95A1637CBF9000DF050 /* SDL_messagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9FF9591637CBF9000DF050 /* SDL_messagebox.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AABCC38D164063D200AB8930 /* SDL_cocoamessagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AABCC38B164063D200AB8930 /* SDL_cocoamessagebox.h */; }; - AABCC38E164063D200AB8930 /* SDL_cocoamessagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AABCC38B164063D200AB8930 /* SDL_cocoamessagebox.h */; }; - AABCC38F164063D200AB8930 /* SDL_cocoamessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = AABCC38C164063D200AB8930 /* SDL_cocoamessagebox.m */; }; - AABCC390164063D200AB8930 /* SDL_cocoamessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = AABCC38C164063D200AB8930 /* SDL_cocoamessagebox.m */; }; - AAC070F9195606770073DCDF /* SDL_opengl_glext.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F4195606770073DCDF /* SDL_opengl_glext.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC070FA195606770073DCDF /* SDL_opengl_glext.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F4195606770073DCDF /* SDL_opengl_glext.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC070FB195606770073DCDF /* SDL_opengl_glext.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F4195606770073DCDF /* SDL_opengl_glext.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC070FC195606770073DCDF /* SDL_opengles2_gl2.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F5195606770073DCDF /* SDL_opengles2_gl2.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC070FD195606770073DCDF /* SDL_opengles2_gl2.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F5195606770073DCDF /* SDL_opengles2_gl2.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC070FE195606770073DCDF /* SDL_opengles2_gl2.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F5195606770073DCDF /* SDL_opengles2_gl2.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC070FF195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F6195606770073DCDF /* SDL_opengles2_gl2ext.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC07100195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F6195606770073DCDF /* SDL_opengles2_gl2ext.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC07101195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F6195606770073DCDF /* SDL_opengles2_gl2ext.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC07102195606770073DCDF /* SDL_opengles2_gl2platform.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F7195606770073DCDF /* SDL_opengles2_gl2platform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC07103195606770073DCDF /* SDL_opengles2_gl2platform.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F7195606770073DCDF /* SDL_opengles2_gl2platform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC07104195606770073DCDF /* SDL_opengles2_gl2platform.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F7195606770073DCDF /* SDL_opengles2_gl2platform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC07105195606770073DCDF /* SDL_opengles2_khrplatform.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F8195606770073DCDF /* SDL_opengles2_khrplatform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC07106195606770073DCDF /* SDL_opengles2_khrplatform.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F8195606770073DCDF /* SDL_opengles2_khrplatform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AAC07107195606770073DCDF /* SDL_opengles2_khrplatform.h in Headers */ = {isa = PBXBuildFile; fileRef = AAC070F8195606770073DCDF /* SDL_opengles2_khrplatform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AADA5B8716CCAB3000107CF7 /* SDL_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = AADA5B8616CCAB3000107CF7 /* SDL_bits.h */; settings = {ATTRIBUTES = (Public, ); }; }; - AADA5B8816CCAB3000107CF7 /* SDL_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = AADA5B8616CCAB3000107CF7 /* SDL_bits.h */; settings = {ATTRIBUTES = (Public, ); }; }; - BBFC088D164C6647003E6A99 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = BBFC088A164C6514003E6A99 /* SDL_gamecontroller.c */; }; - D55A1B81179F262300625D7C /* SDL_cocoamousetap.h in Headers */ = {isa = PBXBuildFile; fileRef = D55A1B7F179F262300625D7C /* SDL_cocoamousetap.h */; }; - D55A1B82179F262300625D7C /* SDL_cocoamousetap.m in Sources */ = {isa = PBXBuildFile; fileRef = D55A1B80179F262300625D7C /* SDL_cocoamousetap.m */; }; - D55A1B83179F263500625D7C /* SDL_cocoamousetap.m in Sources */ = {isa = PBXBuildFile; fileRef = D55A1B80179F262300625D7C /* SDL_cocoamousetap.m */; }; - D55A1B84179F263600625D7C /* SDL_cocoamousetap.m in Sources */ = {isa = PBXBuildFile; fileRef = D55A1B80179F262300625D7C /* SDL_cocoamousetap.m */; }; - D55A1B85179F278E00625D7C /* SDL_cocoamousetap.h in Headers */ = {isa = PBXBuildFile; fileRef = D55A1B7F179F262300625D7C /* SDL_cocoamousetap.h */; }; - D55A1B86179F278F00625D7C /* SDL_cocoamousetap.h in Headers */ = {isa = PBXBuildFile; fileRef = D55A1B7F179F262300625D7C /* SDL_cocoamousetap.h */; }; - DB0F489317C400E6008798C5 /* SDL_messagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9FF9591637CBF9000DF050 /* SDL_messagebox.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB0F489417C400ED008798C5 /* SDL_messagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AA9FF9591637CBF9000DF050 /* SDL_messagebox.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB0F490817CA5292008798C5 /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */; }; - DB0F490A17CA5293008798C5 /* SDL_sysfilesystem.m in Sources */ = {isa = PBXBuildFile; fileRef = 567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */; }; - DB0F490B17CA57ED008798C5 /* SDL_filesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 567E2F2017C44C35005F1892 /* SDL_filesystem.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB0F490C17CA57ED008798C5 /* SDL_filesystem.h in Headers */ = {isa = PBXBuildFile; fileRef = 567E2F2017C44C35005F1892 /* SDL_filesystem.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313F7417554B71006C0E22 /* SDL_diskaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD8912E6671700899322 /* SDL_diskaudio.h */; }; - DB313F7517554B71006C0E22 /* SDL_dummyaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */; }; - DB313F7617554B71006C0E22 /* SDL_coreaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDA112E6671700899322 /* SDL_coreaudio.h */; }; - DB313F7717554B71006C0E22 /* SDL_audio_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB512E6671700899322 /* SDL_audio_c.h */; }; - DB313F7817554B71006C0E22 /* SDL_audiodev_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */; }; - DB313F7A17554B71006C0E22 /* SDL_sysaudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC212E6671700899322 /* SDL_sysaudio.h */; }; - DB313F7B17554B71006C0E22 /* SDL_wave.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDC412E6671700899322 /* SDL_wave.h */; }; - DB313F7C17554B71006C0E22 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD612E6671700899322 /* blank_cursor.h */; }; - DB313F7D17554B71006C0E22 /* default_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD712E6671700899322 /* default_cursor.h */; }; - DB313F7E17554B71006C0E22 /* scancodes_darwin.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD812E6671700899322 /* scancodes_darwin.h */; }; - DB313F7F17554B71006C0E22 /* scancodes_linux.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDD912E6671700899322 /* scancodes_linux.h */; }; - DB313F8017554B71006C0E22 /* scancodes_xfree86.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDDB12E6671700899322 /* scancodes_xfree86.h */; }; - DB313F8117554B71006C0E22 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDDD12E6671700899322 /* SDL_clipboardevents_c.h */; }; - DB313F8217554B71006C0E22 /* SDL_events_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDDF12E6671700899322 /* SDL_events_c.h */; }; - DB313F8317554B71006C0E22 /* SDL_gesture_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE112E6671700899322 /* SDL_gesture_c.h */; }; - DB313F8417554B71006C0E22 /* SDL_keyboard_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE312E6671700899322 /* SDL_keyboard_c.h */; }; - DB313F8517554B71006C0E22 /* SDL_mouse_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE512E6671700899322 /* SDL_mouse_c.h */; }; - DB313F8617554B71006C0E22 /* SDL_sysevents.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE712E6671700899322 /* SDL_sysevents.h */; }; - DB313F8717554B71006C0E22 /* SDL_touch_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDE912E6671700899322 /* SDL_touch_c.h */; }; - DB313F8817554B71006C0E22 /* SDL_windowevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDEB12E6671700899322 /* SDL_windowevents_c.h */; }; - DB313F8917554B71006C0E22 /* SDL_rwopsbundlesupport.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDEE12E6671700899322 /* SDL_rwopsbundlesupport.h */; }; - DB313F8A17554B71006C0E22 /* SDL_haptic_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDFB12E6671700899322 /* SDL_haptic_c.h */; }; - DB313F8B17554B71006C0E22 /* SDL_syshaptic.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFDFC12E6671700899322 /* SDL_syshaptic.h */; }; - DB313F8C17554B71006C0E22 /* SDL_sysjoystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE0812E6671700899322 /* SDL_sysjoystick_c.h */; }; - DB313F8D17554B71006C0E22 /* SDL_joystick_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1712E6671700899322 /* SDL_joystick_c.h */; }; - DB313F8E17554B71006C0E22 /* SDL_sysjoystick.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE1812E6671700899322 /* SDL_sysjoystick.h */; }; - DB313F8F17554B71006C0E22 /* SDL_assert_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE5512E6671700899322 /* SDL_assert_c.h */; }; - DB313F9017554B71006C0E22 /* SDL_error_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE5812E6671700899322 /* SDL_error_c.h */; }; - DB313F9217554B71006C0E22 /* SDL_sysmutex_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8012E6671800899322 /* SDL_sysmutex_c.h */; }; - DB313F9317554B71006C0E22 /* SDL_systhread_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8312E6671800899322 /* SDL_systhread_c.h */; }; - DB313F9417554B71006C0E22 /* SDL_systhread.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8B12E6671800899322 /* SDL_systhread.h */; }; - DB313F9517554B71006C0E22 /* SDL_thread_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFE8D12E6671800899322 /* SDL_thread_c.h */; }; - DB313F9617554B71006C0E22 /* SDL_timer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEA012E6671800899322 /* SDL_timer_c.h */; }; - DB313F9717554B71006C0E22 /* SDL_cocoaclipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC212E6671800899322 /* SDL_cocoaclipboard.h */; }; - DB313F9817554B71006C0E22 /* SDL_cocoaevents.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC412E6671800899322 /* SDL_cocoaevents.h */; }; - DB313F9917554B71006C0E22 /* SDL_cocoakeyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC612E6671800899322 /* SDL_cocoakeyboard.h */; }; - DB313F9A17554B71006C0E22 /* SDL_cocoamodes.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEC812E6671800899322 /* SDL_cocoamodes.h */; }; - DB313F9B17554B71006C0E22 /* SDL_cocoamouse.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFECA12E6671800899322 /* SDL_cocoamouse.h */; }; - DB313F9C17554B71006C0E22 /* SDL_cocoaopengl.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFECC12E6671800899322 /* SDL_cocoaopengl.h */; }; - DB313F9D17554B71006C0E22 /* SDL_cocoashape.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFECE12E6671800899322 /* SDL_cocoashape.h */; }; - DB313F9E17554B71006C0E22 /* SDL_cocoavideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFED012E6671800899322 /* SDL_cocoavideo.h */; }; - DB313F9F17554B71006C0E22 /* SDL_cocoawindow.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFED212E6671800899322 /* SDL_cocoawindow.h */; }; - DB313FA017554B71006C0E22 /* SDL_nullevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEE912E6671800899322 /* SDL_nullevents_c.h */; }; - DB313FA117554B71006C0E22 /* SDL_nullvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFEED12E6671800899322 /* SDL_nullvideo.h */; }; - DB313FA217554B71006C0E22 /* SDL_blit.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF4F12E6671800899322 /* SDL_blit.h */; }; - DB313FA317554B71006C0E22 /* SDL_blit_auto.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF5412E6671800899322 /* SDL_blit_auto.h */; }; - DB313FA417554B71006C0E22 /* SDL_blit_copy.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF5612E6671800899322 /* SDL_blit_copy.h */; }; - DB313FA517554B71006C0E22 /* SDL_blit_slow.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF5912E6671800899322 /* SDL_blit_slow.h */; }; - DB313FA617554B71006C0E22 /* SDL_pixels_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF6612E6671800899322 /* SDL_pixels_c.h */; }; - DB313FA717554B71006C0E22 /* SDL_RLEaccel_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7012E6671800899322 /* SDL_RLEaccel_c.h */; }; - DB313FA817554B71006C0E22 /* SDL_shape_internals.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7212E6671800899322 /* SDL_shape_internals.h */; }; - DB313FA917554B71006C0E22 /* SDL_sysvideo.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFF7512E6671800899322 /* SDL_sysvideo.h */; }; - DB313FAA17554B71006C0E22 /* imKStoUCS.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFB912E6671800899322 /* imKStoUCS.h */; }; - DB313FAB17554B71006C0E22 /* SDL_x11clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBB12E6671800899322 /* SDL_x11clipboard.h */; }; - DB313FAC17554B71006C0E22 /* SDL_x11dyn.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBD12E6671800899322 /* SDL_x11dyn.h */; }; - DB313FAD17554B71006C0E22 /* SDL_x11events.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFBF12E6671800899322 /* SDL_x11events.h */; }; - DB313FAE17554B71006C0E22 /* SDL_x11keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC312E6671800899322 /* SDL_x11keyboard.h */; }; - DB313FAF17554B71006C0E22 /* SDL_x11modes.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC512E6671800899322 /* SDL_x11modes.h */; }; - DB313FB017554B71006C0E22 /* SDL_x11mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC712E6671800899322 /* SDL_x11mouse.h */; }; - DB313FB117554B71006C0E22 /* SDL_x11opengl.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFC912E6671800899322 /* SDL_x11opengl.h */; }; - DB313FB217554B71006C0E22 /* SDL_x11opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFCB12E6671800899322 /* SDL_x11opengles.h */; }; - DB313FB317554B71006C0E22 /* SDL_x11shape.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFCF12E6671800899322 /* SDL_x11shape.h */; }; - DB313FB417554B71006C0E22 /* SDL_x11sym.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD012E6671800899322 /* SDL_x11sym.h */; }; - DB313FB517554B71006C0E22 /* SDL_x11touch.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD212E6671800899322 /* SDL_x11touch.h */; }; - DB313FB617554B71006C0E22 /* SDL_x11video.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD412E6671800899322 /* SDL_x11video.h */; }; - DB313FB717554B71006C0E22 /* SDL_x11window.h in Headers */ = {isa = PBXBuildFile; fileRef = 04BDFFD612E6671800899322 /* SDL_x11window.h */; }; - DB313FB817554B71006C0E22 /* SDL_sysrender.h in Headers */ = {isa = PBXBuildFile; fileRef = 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */; }; - DB313FB917554B71006C0E22 /* mmx.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8D12FA97ED00FB9AA8 /* mmx.h */; }; - DB313FBA17554B71006C0E22 /* SDL_yuv_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */; }; - DB313FBB17554B71006C0E22 /* SDL_nullframebuffer_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7803712FB748500FC43C0 /* SDL_nullframebuffer_c.h */; }; - DB313FBC17554B71006C0E22 /* SDL_blendfillrect.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7803E12FB74A200FC43C0 /* SDL_blendfillrect.h */; }; - DB313FBD17554B71006C0E22 /* SDL_blendline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804012FB74A200FC43C0 /* SDL_blendline.h */; }; - DB313FBE17554B71006C0E22 /* SDL_blendpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804212FB74A200FC43C0 /* SDL_blendpoint.h */; }; - DB313FBF17554B71006C0E22 /* SDL_draw.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804312FB74A200FC43C0 /* SDL_draw.h */; }; - DB313FC017554B71006C0E22 /* SDL_drawline.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804512FB74A200FC43C0 /* SDL_drawline.h */; }; - DB313FC117554B71006C0E22 /* SDL_drawpoint.h in Headers */ = {isa = PBXBuildFile; fileRef = 04F7804712FB74A200FC43C0 /* SDL_drawpoint.h */; }; - DB313FC217554B71006C0E22 /* SDL_render_sw_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC1A12FE1BCB004C9285 /* SDL_render_sw_c.h */; }; - DB313FC317554B71006C0E22 /* SDL_x11framebuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0442EC5912FE1C60004C9285 /* SDL_x11framebuffer.h */; }; - DB313FC417554B71006C0E22 /* SDL_glfuncs.h in Headers */ = {isa = PBXBuildFile; fileRef = 04043BBA12FEB1BE0076DB1F /* SDL_glfuncs.h */; }; - DB313FC517554B71006C0E22 /* SDL_shaders_gl.h in Headers */ = {isa = PBXBuildFile; fileRef = 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */; }; - DB313FC617554B71006C0E22 /* SDL_rotate.h in Headers */ = {isa = PBXBuildFile; fileRef = AA628AC9159367B7005138DD /* SDL_rotate.h */; }; - DB313FC717554B71006C0E22 /* SDL_x11xinput2.h in Headers */ = {isa = PBXBuildFile; fileRef = AA628AD0159367F2005138DD /* SDL_x11xinput2.h */; }; - DB313FC817554B71006C0E22 /* begin_code.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557C71595D4D800BBD41B /* begin_code.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FC917554B71006C0E22 /* close_code.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557C81595D4D800BBD41B /* close_code.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FCA17554B71006C0E22 /* SDL_assert.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557C91595D4D800BBD41B /* SDL_assert.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FCB17554B71006C0E22 /* SDL_atomic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CA1595D4D800BBD41B /* SDL_atomic.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FCC17554B71006C0E22 /* SDL_audio.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CB1595D4D800BBD41B /* SDL_audio.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FCD17554B71006C0E22 /* SDL_blendmode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FCE17554B71006C0E22 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FCF17554B71006C0E22 /* SDL_config_macosx.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CE1595D4D800BBD41B /* SDL_config_macosx.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD017554B71006C0E22 /* SDL_config.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557CF1595D4D800BBD41B /* SDL_config.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD117554B71006C0E22 /* SDL_copying.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D01595D4D800BBD41B /* SDL_copying.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD217554B71006C0E22 /* SDL_cpuinfo.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D11595D4D800BBD41B /* SDL_cpuinfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD317554B71006C0E22 /* SDL_endian.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D21595D4D800BBD41B /* SDL_endian.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD417554B71006C0E22 /* SDL_error.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D31595D4D800BBD41B /* SDL_error.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD517554B71006C0E22 /* SDL_events.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D41595D4D800BBD41B /* SDL_events.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD617554B71006C0E22 /* SDL_gesture.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D51595D4D800BBD41B /* SDL_gesture.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD717554B71006C0E22 /* SDL_haptic.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D61595D4D800BBD41B /* SDL_haptic.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD817554B71006C0E22 /* SDL_hints.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D71595D4D800BBD41B /* SDL_hints.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FD917554B71006C0E22 /* SDL_joystick.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557D91595D4D800BBD41B /* SDL_joystick.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FDA17554B71006C0E22 /* SDL_keyboard.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DA1595D4D800BBD41B /* SDL_keyboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FDB17554B71006C0E22 /* SDL_keycode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DB1595D4D800BBD41B /* SDL_keycode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FDC17554B71006C0E22 /* SDL_loadso.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DC1595D4D800BBD41B /* SDL_loadso.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FDD17554B71006C0E22 /* SDL_log.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DD1595D4D800BBD41B /* SDL_log.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FDE17554B71006C0E22 /* SDL_main.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DE1595D4D800BBD41B /* SDL_main.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FDF17554B71006C0E22 /* SDL_mouse.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557DF1595D4D800BBD41B /* SDL_mouse.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE017554B71006C0E22 /* SDL_mutex.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E01595D4D800BBD41B /* SDL_mutex.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE117554B71006C0E22 /* SDL_name.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E11595D4D800BBD41B /* SDL_name.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE217554B71006C0E22 /* SDL_opengl.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E21595D4D800BBD41B /* SDL_opengl.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE317554B71006C0E22 /* SDL_opengles.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E31595D4D800BBD41B /* SDL_opengles.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE417554B71006C0E22 /* SDL_opengles2.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E41595D4D800BBD41B /* SDL_opengles2.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE517554B71006C0E22 /* SDL_pixels.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E51595D4D800BBD41B /* SDL_pixels.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE617554B71006C0E22 /* SDL_platform.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E61595D4D800BBD41B /* SDL_platform.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE717554B71006C0E22 /* SDL_power.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E71595D4D800BBD41B /* SDL_power.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE817554B71006C0E22 /* SDL_quit.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E81595D4D800BBD41B /* SDL_quit.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FE917554B71006C0E22 /* SDL_rect.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557E91595D4D800BBD41B /* SDL_rect.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FEA17554B71006C0E22 /* SDL_render.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EA1595D4D800BBD41B /* SDL_render.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FEB17554B71006C0E22 /* SDL_revision.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EB1595D4D800BBD41B /* SDL_revision.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FEC17554B71006C0E22 /* SDL_rwops.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EC1595D4D800BBD41B /* SDL_rwops.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FED17554B71006C0E22 /* SDL_scancode.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557ED1595D4D800BBD41B /* SDL_scancode.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FEE17554B71006C0E22 /* SDL_shape.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EE1595D4D800BBD41B /* SDL_shape.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FEF17554B71006C0E22 /* SDL_stdinc.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557EF1595D4D800BBD41B /* SDL_stdinc.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF017554B71006C0E22 /* SDL_surface.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F01595D4D800BBD41B /* SDL_surface.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF117554B71006C0E22 /* SDL_system.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F11595D4D800BBD41B /* SDL_system.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF217554B71006C0E22 /* SDL_syswm.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F21595D4D800BBD41B /* SDL_syswm.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF317554B71006C0E22 /* SDL_thread.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F31595D4D800BBD41B /* SDL_thread.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF417554B71006C0E22 /* SDL_timer.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F41595D4D800BBD41B /* SDL_timer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF517554B71006C0E22 /* SDL_touch.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F51595D4D800BBD41B /* SDL_touch.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF617554B71006C0E22 /* SDL_types.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F61595D4D800BBD41B /* SDL_types.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF717554B71006C0E22 /* SDL_version.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F71595D4D800BBD41B /* SDL_version.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF817554B71006C0E22 /* SDL_video.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F81595D4D800BBD41B /* SDL_video.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FF917554B71006C0E22 /* SDL.h in Headers */ = {isa = PBXBuildFile; fileRef = AA7557F91595D4D800BBD41B /* SDL.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FFA17554B71006C0E22 /* SDL_cocoamessagebox.h in Headers */ = {isa = PBXBuildFile; fileRef = AABCC38B164063D200AB8930 /* SDL_cocoamessagebox.h */; }; - DB313FFB17554B71006C0E22 /* SDL_gamecontroller.h in Headers */ = {isa = PBXBuildFile; fileRef = A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FFC17554B71006C0E22 /* SDL_bits.h in Headers */ = {isa = PBXBuildFile; fileRef = AADA5B8616CCAB3000107CF7 /* SDL_bits.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DB313FFE17554B71006C0E22 /* SDL_atomic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD7412E6671700899322 /* SDL_atomic.c */; }; - DB313FFF17554B71006C0E22 /* SDL_spinlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD7512E6671700899322 /* SDL_spinlock.c */; }; - DB31400017554B71006C0E22 /* SDL_diskaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD8812E6671700899322 /* SDL_diskaudio.c */; }; - DB31400117554B71006C0E22 /* SDL_dummyaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */; }; - DB31400317554B71006C0E22 /* SDL_audio.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB412E6671700899322 /* SDL_audio.c */; }; - DB31400417554B71006C0E22 /* SDL_audiocvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB612E6671700899322 /* SDL_audiocvt.c */; }; - DB31400517554B71006C0E22 /* SDL_audiodev.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDB712E6671700899322 /* SDL_audiodev.c */; }; - DB31400617554B71006C0E22 /* SDL_audiotypecvt.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */; }; - DB31400717554B71006C0E22 /* SDL_mixer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDBB12E6671700899322 /* SDL_mixer.c */; }; - DB31400817554B71006C0E22 /* SDL_wave.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDC312E6671700899322 /* SDL_wave.c */; }; - DB31400917554B71006C0E22 /* SDL_cpuinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDD412E6671700899322 /* SDL_cpuinfo.c */; }; - DB31400A17554B71006C0E22 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDDC12E6671700899322 /* SDL_clipboardevents.c */; }; - DB31400B17554B71006C0E22 /* SDL_events.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDDE12E6671700899322 /* SDL_events.c */; }; - DB31400C17554B71006C0E22 /* SDL_dropevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 566CDE8E148F0AC200C5A9BB /* SDL_dropevents.c */; }; - DB31400D17554B71006C0E22 /* SDL_gesture.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE012E6671700899322 /* SDL_gesture.c */; }; - DB31400E17554B71006C0E22 /* SDL_keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE212E6671700899322 /* SDL_keyboard.c */; }; - DB31400F17554B71006C0E22 /* SDL_mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE412E6671700899322 /* SDL_mouse.c */; }; - DB31401017554B71006C0E22 /* SDL_quit.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE612E6671700899322 /* SDL_quit.c */; }; - DB31401117554B71006C0E22 /* SDL_touch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDE812E6671700899322 /* SDL_touch.c */; }; - DB31401217554B71006C0E22 /* SDL_windowevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDEA12E6671700899322 /* SDL_windowevents.c */; }; - DB31401317554B71006C0E22 /* SDL_rwopsbundlesupport.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDEF12E6671700899322 /* SDL_rwopsbundlesupport.m */; }; - DB31401417554B71006C0E22 /* SDL_rwops.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDF012E6671700899322 /* SDL_rwops.c */; }; - DB31401517554B71006C0E22 /* SDL_syshaptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDF312E6671700899322 /* SDL_syshaptic.c */; }; - DB31401617554B71006C0E22 /* SDL_haptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFDFA12E6671700899322 /* SDL_haptic.c */; }; - DB31401717554B71006C0E22 /* SDL_sysjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE0712E6671700899322 /* SDL_sysjoystick.c */; }; - DB31401817554B71006C0E22 /* SDL_gamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = BBFC088A164C6514003E6A99 /* SDL_gamecontroller.c */; }; - DB31401917554B71006C0E22 /* SDL_joystick.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE1612E6671700899322 /* SDL_joystick.c */; }; - DB31401A17554B71006C0E22 /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE3312E6671700899322 /* SDL_sysloadso.c */; }; - DB31401B17554B71006C0E22 /* SDL_syspower.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4B12E6671700899322 /* SDL_syspower.c */; }; - DB31401C17554B71006C0E22 /* SDL_power.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE4E12E6671700899322 /* SDL_power.c */; }; - DB31401D17554B71006C0E22 /* SDL_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5612E6671700899322 /* SDL_assert.c */; }; - DB31401E17554B71006C0E22 /* SDL_error.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5912E6671700899322 /* SDL_error.c */; }; - DB31402017554B71006C0E22 /* SDL.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5C12E6671700899322 /* SDL.c */; }; - DB31402117554B71006C0E22 /* SDL_getenv.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5E12E6671700899322 /* SDL_getenv.c */; }; - DB31402217554B71006C0E22 /* SDL_iconv.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE5F12E6671700899322 /* SDL_iconv.c */; }; - DB31402317554B71006C0E22 /* SDL_malloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6012E6671700899322 /* SDL_malloc.c */; }; - DB31402417554B71006C0E22 /* SDL_qsort.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6112E6671700899322 /* SDL_qsort.c */; }; - DB31402517554B71006C0E22 /* SDL_stdlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6212E6671700899322 /* SDL_stdlib.c */; }; - DB31402617554B71006C0E22 /* SDL_string.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE6312E6671700899322 /* SDL_string.c */; }; - DB31402717554B71006C0E22 /* SDL_syscond.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE7E12E6671800899322 /* SDL_syscond.c */; }; - DB31402817554B71006C0E22 /* SDL_sysmutex.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE7F12E6671800899322 /* SDL_sysmutex.c */; }; - DB31402917554B71006C0E22 /* SDL_syssem.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE8112E6671800899322 /* SDL_syssem.c */; }; - DB31402A17554B71006C0E22 /* SDL_systhread.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE8212E6671800899322 /* SDL_systhread.c */; }; - DB31402B17554B71006C0E22 /* SDL_thread.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE8C12E6671800899322 /* SDL_thread.c */; }; - DB31402C17554B71006C0E22 /* SDL_timer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFE9F12E6671800899322 /* SDL_timer.c */; }; - DB31402D17554B71006C0E22 /* SDL_systimer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEA212E6671800899322 /* SDL_systimer.c */; }; - DB31402E17554B71006C0E22 /* SDL_cocoaclipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC312E6671800899322 /* SDL_cocoaclipboard.m */; }; - DB31402F17554B71006C0E22 /* SDL_cocoaevents.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC512E6671800899322 /* SDL_cocoaevents.m */; }; - DB31403017554B71006C0E22 /* SDL_cocoakeyboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC712E6671800899322 /* SDL_cocoakeyboard.m */; }; - DB31403117554B71006C0E22 /* SDL_cocoamodes.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEC912E6671800899322 /* SDL_cocoamodes.m */; }; - DB31403217554B71006C0E22 /* SDL_cocoamouse.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFECB12E6671800899322 /* SDL_cocoamouse.m */; }; - DB31403317554B71006C0E22 /* SDL_cocoaopengl.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFECD12E6671800899322 /* SDL_cocoaopengl.m */; }; - DB31403417554B71006C0E22 /* SDL_cocoashape.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFECF12E6671800899322 /* SDL_cocoashape.m */; }; - DB31403517554B71006C0E22 /* SDL_cocoavideo.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFED112E6671800899322 /* SDL_cocoavideo.m */; }; - DB31403617554B71006C0E22 /* SDL_cocoawindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFED312E6671800899322 /* SDL_cocoawindow.m */; }; - DB31403717554B71006C0E22 /* SDL_nullevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEE812E6671800899322 /* SDL_nullevents.c */; }; - DB31403817554B71006C0E22 /* SDL_nullvideo.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFEEC12E6671800899322 /* SDL_nullvideo.c */; }; - DB31403917554B71006C0E22 /* SDL_blit.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF4E12E6671800899322 /* SDL_blit.c */; }; - DB31403A17554B71006C0E22 /* SDL_blit_0.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5012E6671800899322 /* SDL_blit_0.c */; }; - DB31403B17554B71006C0E22 /* SDL_blit_1.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5112E6671800899322 /* SDL_blit_1.c */; }; - DB31403C17554B71006C0E22 /* SDL_blit_A.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5212E6671800899322 /* SDL_blit_A.c */; }; - DB31403D17554B71006C0E22 /* SDL_blit_auto.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5312E6671800899322 /* SDL_blit_auto.c */; }; - DB31403E17554B71006C0E22 /* SDL_blit_copy.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5512E6671800899322 /* SDL_blit_copy.c */; }; - DB31403F17554B71006C0E22 /* SDL_blit_N.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5712E6671800899322 /* SDL_blit_N.c */; }; - DB31404017554B71006C0E22 /* SDL_blit_slow.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5812E6671800899322 /* SDL_blit_slow.c */; }; - DB31404117554B71006C0E22 /* SDL_bmp.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5A12E6671800899322 /* SDL_bmp.c */; }; - DB31404217554B71006C0E22 /* SDL_clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF5B12E6671800899322 /* SDL_clipboard.c */; }; - DB31404317554B71006C0E22 /* SDL_fillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6012E6671800899322 /* SDL_fillrect.c */; }; - DB31404417554B71006C0E22 /* SDL_pixels.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6512E6671800899322 /* SDL_pixels.c */; }; - DB31404517554B71006C0E22 /* SDL_rect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6712E6671800899322 /* SDL_rect.c */; }; - DB31404617554B71006C0E22 /* SDL_RLEaccel.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF6F12E6671800899322 /* SDL_RLEaccel.c */; }; - DB31404717554B71006C0E22 /* SDL_shape.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7112E6671800899322 /* SDL_shape.c */; }; - DB31404817554B71006C0E22 /* SDL_stretch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7312E6671800899322 /* SDL_stretch.c */; }; - DB31404917554B71006C0E22 /* SDL_surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7412E6671800899322 /* SDL_surface.c */; }; - DB31404A17554B71006C0E22 /* SDL_video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFF7612E6671800899322 /* SDL_video.c */; }; - DB31404B17554B71006C0E22 /* imKStoUCS.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFB812E6671800899322 /* imKStoUCS.c */; }; - DB31404C17554B71006C0E22 /* SDL_x11clipboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */; }; - DB31404D17554B71006C0E22 /* SDL_x11dyn.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBC12E6671800899322 /* SDL_x11dyn.c */; }; - DB31404E17554B71006C0E22 /* SDL_x11events.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFBE12E6671800899322 /* SDL_x11events.c */; }; - DB31404F17554B71006C0E22 /* SDL_x11keyboard.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC212E6671800899322 /* SDL_x11keyboard.c */; }; - DB31405017554B71006C0E22 /* SDL_x11modes.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC412E6671800899322 /* SDL_x11modes.c */; }; - DB31405117554B71006C0E22 /* SDL_x11mouse.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC612E6671800899322 /* SDL_x11mouse.c */; }; - DB31405217554B71006C0E22 /* SDL_x11opengl.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFC812E6671800899322 /* SDL_x11opengl.c */; }; - DB31405317554B71006C0E22 /* SDL_x11opengles.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFCA12E6671800899322 /* SDL_x11opengles.c */; }; - DB31405417554B71006C0E22 /* SDL_x11shape.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFCE12E6671800899322 /* SDL_x11shape.c */; }; - DB31405517554B71006C0E22 /* SDL_x11touch.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD112E6671800899322 /* SDL_x11touch.c */; }; - DB31405617554B71006C0E22 /* SDL_x11video.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD312E6671800899322 /* SDL_x11video.c */; }; - DB31405717554B71006C0E22 /* SDL_x11window.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BDFFD512E6671800899322 /* SDL_x11window.c */; }; - DB31405817554B71006C0E22 /* SDL_render.c in Sources */ = {isa = PBXBuildFile; fileRef = 041B2C9E12FA0D680087D585 /* SDL_render.c */; }; - DB31405917554B71006C0E22 /* SDL_yuv_mmx.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */; }; - DB31405A17554B71006C0E22 /* SDL_yuv_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */; }; - DB31405B17554B71006C0E22 /* SDL_nullframebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803812FB748500FC43C0 /* SDL_nullframebuffer.c */; }; - DB31405C17554B71006C0E22 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803D12FB74A200FC43C0 /* SDL_blendfillrect.c */; }; - DB31405D17554B71006C0E22 /* SDL_blendline.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7803F12FB74A200FC43C0 /* SDL_blendline.c */; }; - DB31405E17554B71006C0E22 /* SDL_blendpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804112FB74A200FC43C0 /* SDL_blendpoint.c */; }; - DB31405F17554B71006C0E22 /* SDL_drawline.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804412FB74A200FC43C0 /* SDL_drawline.c */; }; - DB31406017554B71006C0E22 /* SDL_drawpoint.c in Sources */ = {isa = PBXBuildFile; fileRef = 04F7804612FB74A200FC43C0 /* SDL_drawpoint.c */; }; - DB31406117554B71006C0E22 /* SDL_render_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC1712FE1BBA004C9285 /* SDL_render_gl.c */; }; - DB31406217554B71006C0E22 /* SDL_render_sw.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC1B12FE1BCB004C9285 /* SDL_render_sw.c */; }; - DB31406317554B71006C0E22 /* SDL_x11framebuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5812FE1C60004C9285 /* SDL_x11framebuffer.c */; }; - DB31406417554B71006C0E22 /* SDL_hints.c in Sources */ = {isa = PBXBuildFile; fileRef = 0442EC5E12FE1C75004C9285 /* SDL_hints.c */; }; - DB31406517554B71006C0E22 /* SDL_log.c in Sources */ = {isa = PBXBuildFile; fileRef = 04BAC0C71300C2160055DE28 /* SDL_log.c */; }; - DB31406617554B71006C0E22 /* SDL_shaders_gl.c in Sources */ = {isa = PBXBuildFile; fileRef = 0435673C1303160F00BA5428 /* SDL_shaders_gl.c */; }; - DB31406717554B71006C0E22 /* SDL_rotate.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628AC8159367B7005138DD /* SDL_rotate.c */; }; - DB31406817554B71006C0E22 /* SDL_x11xinput2.c in Sources */ = {isa = PBXBuildFile; fileRef = AA628ACF159367F2005138DD /* SDL_x11xinput2.c */; }; - DB31406917554B71006C0E22 /* SDL_x11messagebox.c in Sources */ = {isa = PBXBuildFile; fileRef = AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */; }; - DB31406A17554B71006C0E22 /* SDL_cocoamessagebox.m in Sources */ = {isa = PBXBuildFile; fileRef = AABCC38C164063D200AB8930 /* SDL_cocoamessagebox.m */; }; - DB31406E17554B71006C0E22 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179D0858DECD00B2BC32 /* Cocoa.framework */; }; - DB31407017554B71006C0E22 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0073179F0858DECD00B2BC32 /* IOKit.framework */; }; - DB31407217554B71006C0E22 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 007317C10858E15000B2BC32 /* Carbon.framework */; }; - DB31408B17554D37006C0E22 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; }; - DB31408D17554D3C006C0E22 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00CFA89C106B4BA100758660 /* ForceFeedback.framework */; }; - FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; }; - FA73671E19A54140004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; }; - FA73671F19A54144004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73671C19A540EF004122E4 /* CoreVideo.framework */; }; - FABA34C71D8B5DB100915323 /* SDL_coreaudio.m in Sources */ = {isa = PBXBuildFile; fileRef = FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - BECDF6C50761BA81005FE872 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BECDF5FE0761BA81005FE872; - remoteInfo = "Framework (Upgraded)"; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 0073179D0858DECD00B2BC32 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; - 0073179F0858DECD00B2BC32 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; - 007317C10858E15000B2BC32 /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; - 00794D3F09D0C461003FC8A1 /* License.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = License.txt; sourceTree = ""; }; - 00CFA89C106B4BA100758660 /* ForceFeedback.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ForceFeedback.framework; path = /System/Library/Frameworks/ForceFeedback.framework; sourceTree = ""; }; - 00D0D08310675DD9004B05EF /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; - 04043BBA12FEB1BE0076DB1F /* SDL_glfuncs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_glfuncs.h; sourceTree = ""; }; - 041B2C9E12FA0D680087D585 /* SDL_render.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render.c; sourceTree = ""; }; - 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysrender.h; sourceTree = ""; }; - 0435673C1303160F00BA5428 /* SDL_shaders_gl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_shaders_gl.c; sourceTree = ""; }; - 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shaders_gl.h; sourceTree = ""; }; - 04409B8D12FA97ED00FB9AA8 /* mmx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mmx.h; sourceTree = ""; }; - 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_mmx.c; sourceTree = ""; }; - 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_yuv_sw_c.h; sourceTree = ""; }; - 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_yuv_sw.c; sourceTree = ""; }; - 0442EC1712FE1BBA004C9285 /* SDL_render_gl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render_gl.c; sourceTree = ""; }; - 0442EC1A12FE1BCB004C9285 /* SDL_render_sw_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_render_sw_c.h; sourceTree = ""; }; - 0442EC1B12FE1BCB004C9285 /* SDL_render_sw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_render_sw.c; sourceTree = ""; }; - 0442EC5812FE1C60004C9285 /* SDL_x11framebuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11framebuffer.c; sourceTree = ""; }; - 0442EC5912FE1C60004C9285 /* SDL_x11framebuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11framebuffer.h; sourceTree = ""; }; - 0442EC5E12FE1C75004C9285 /* SDL_hints.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_hints.c; path = ../../src/SDL_hints.c; sourceTree = SOURCE_ROOT; }; - 04BAC0C71300C2160055DE28 /* SDL_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_log.c; path = ../../src/SDL_log.c; sourceTree = SOURCE_ROOT; }; - 04BDFD7412E6671700899322 /* SDL_atomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_atomic.c; sourceTree = ""; }; - 04BDFD7512E6671700899322 /* SDL_spinlock.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_spinlock.c; sourceTree = ""; }; - 04BDFD8812E6671700899322 /* SDL_diskaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_diskaudio.c; sourceTree = ""; }; - 04BDFD8912E6671700899322 /* SDL_diskaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_diskaudio.h; sourceTree = ""; }; - 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dummyaudio.c; sourceTree = ""; }; - 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dummyaudio.h; sourceTree = ""; }; - 04BDFDA112E6671700899322 /* SDL_coreaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_coreaudio.h; sourceTree = ""; }; - 04BDFDB412E6671700899322 /* SDL_audio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audio.c; sourceTree = ""; }; - 04BDFDB512E6671700899322 /* SDL_audio_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audio_c.h; sourceTree = ""; }; - 04BDFDB612E6671700899322 /* SDL_audiocvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiocvt.c; sourceTree = ""; }; - 04BDFDB712E6671700899322 /* SDL_audiodev.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiodev.c; sourceTree = ""; }; - 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audiodev_c.h; sourceTree = ""; }; - 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_audiotypecvt.c; sourceTree = ""; }; - 04BDFDBB12E6671700899322 /* SDL_mixer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_mixer.c; sourceTree = ""; }; - 04BDFDC212E6671700899322 /* SDL_sysaudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysaudio.h; sourceTree = ""; }; - 04BDFDC312E6671700899322 /* SDL_wave.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_wave.c; sourceTree = ""; }; - 04BDFDC412E6671700899322 /* SDL_wave.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_wave.h; sourceTree = ""; }; - 04BDFDD412E6671700899322 /* SDL_cpuinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_cpuinfo.c; sourceTree = ""; }; - 04BDFDD612E6671700899322 /* blank_cursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = blank_cursor.h; sourceTree = ""; }; - 04BDFDD712E6671700899322 /* default_cursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = default_cursor.h; sourceTree = ""; }; - 04BDFDD812E6671700899322 /* scancodes_darwin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_darwin.h; sourceTree = ""; }; - 04BDFDD912E6671700899322 /* scancodes_linux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_linux.h; sourceTree = ""; }; - 04BDFDDB12E6671700899322 /* scancodes_xfree86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_xfree86.h; sourceTree = ""; }; - 04BDFDDC12E6671700899322 /* SDL_clipboardevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboardevents.c; sourceTree = ""; }; - 04BDFDDD12E6671700899322 /* SDL_clipboardevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_clipboardevents_c.h; sourceTree = ""; }; - 04BDFDDE12E6671700899322 /* SDL_events.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_events.c; sourceTree = ""; }; - 04BDFDDF12E6671700899322 /* SDL_events_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_events_c.h; sourceTree = ""; }; - 04BDFDE012E6671700899322 /* SDL_gesture.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_gesture.c; sourceTree = ""; }; - 04BDFDE112E6671700899322 /* SDL_gesture_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gesture_c.h; sourceTree = ""; }; - 04BDFDE212E6671700899322 /* SDL_keyboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_keyboard.c; sourceTree = ""; }; - 04BDFDE312E6671700899322 /* SDL_keyboard_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_keyboard_c.h; sourceTree = ""; }; - 04BDFDE412E6671700899322 /* SDL_mouse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_mouse.c; sourceTree = ""; }; - 04BDFDE512E6671700899322 /* SDL_mouse_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_mouse_c.h; sourceTree = ""; }; - 04BDFDE612E6671700899322 /* SDL_quit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_quit.c; sourceTree = ""; }; - 04BDFDE712E6671700899322 /* SDL_sysevents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysevents.h; sourceTree = ""; }; - 04BDFDE812E6671700899322 /* SDL_touch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_touch.c; sourceTree = ""; }; - 04BDFDE912E6671700899322 /* SDL_touch_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_touch_c.h; sourceTree = ""; }; - 04BDFDEA12E6671700899322 /* SDL_windowevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_windowevents.c; sourceTree = ""; }; - 04BDFDEB12E6671700899322 /* SDL_windowevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_windowevents_c.h; sourceTree = ""; }; - 04BDFDEE12E6671700899322 /* SDL_rwopsbundlesupport.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_rwopsbundlesupport.h; sourceTree = ""; }; - 04BDFDEF12E6671700899322 /* SDL_rwopsbundlesupport.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_rwopsbundlesupport.m; sourceTree = ""; }; - 04BDFDF012E6671700899322 /* SDL_rwops.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_rwops.c; sourceTree = ""; }; - 04BDFDF312E6671700899322 /* SDL_syshaptic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_syshaptic.c; sourceTree = ""; }; - 04BDFDFA12E6671700899322 /* SDL_haptic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_haptic.c; sourceTree = ""; }; - 04BDFDFB12E6671700899322 /* SDL_haptic_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_haptic_c.h; sourceTree = ""; }; - 04BDFDFC12E6671700899322 /* SDL_syshaptic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_syshaptic.h; sourceTree = ""; }; - 04BDFE0712E6671700899322 /* SDL_sysjoystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_sysjoystick.c; sourceTree = ""; }; - 04BDFE0812E6671700899322 /* SDL_sysjoystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysjoystick_c.h; sourceTree = ""; }; - 04BDFE1612E6671700899322 /* SDL_joystick.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_joystick.c; sourceTree = ""; }; - 04BDFE1712E6671700899322 /* SDL_joystick_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_joystick_c.h; sourceTree = ""; }; - 04BDFE1812E6671700899322 /* SDL_sysjoystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysjoystick.h; sourceTree = ""; }; - 04BDFE3312E6671700899322 /* SDL_sysloadso.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_sysloadso.c; sourceTree = ""; }; - 04BDFE4B12E6671700899322 /* SDL_syspower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_syspower.c; sourceTree = ""; }; - 04BDFE4E12E6671700899322 /* SDL_power.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_power.c; sourceTree = ""; }; - 04BDFE5512E6671700899322 /* SDL_assert_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_assert_c.h; path = ../../src/SDL_assert_c.h; sourceTree = SOURCE_ROOT; }; - 04BDFE5612E6671700899322 /* SDL_assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_assert.c; path = ../../src/SDL_assert.c; sourceTree = SOURCE_ROOT; }; - 04BDFE5812E6671700899322 /* SDL_error_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_error_c.h; path = ../../src/SDL_error_c.h; sourceTree = SOURCE_ROOT; }; - 04BDFE5912E6671700899322 /* SDL_error.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_error.c; path = ../../src/SDL_error.c; sourceTree = SOURCE_ROOT; }; - 04BDFE5C12E6671700899322 /* SDL.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL.c; path = ../../src/SDL.c; sourceTree = SOURCE_ROOT; }; - 04BDFE5E12E6671700899322 /* SDL_getenv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_getenv.c; sourceTree = ""; }; - 04BDFE5F12E6671700899322 /* SDL_iconv.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_iconv.c; sourceTree = ""; }; - 04BDFE6012E6671700899322 /* SDL_malloc.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_malloc.c; sourceTree = ""; }; - 04BDFE6112E6671700899322 /* SDL_qsort.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_qsort.c; sourceTree = ""; }; - 04BDFE6212E6671700899322 /* SDL_stdlib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_stdlib.c; sourceTree = ""; }; - 04BDFE6312E6671700899322 /* SDL_string.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_string.c; sourceTree = ""; }; - 04BDFE7E12E6671800899322 /* SDL_syscond.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_syscond.c; sourceTree = ""; }; - 04BDFE7F12E6671800899322 /* SDL_sysmutex.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_sysmutex.c; sourceTree = ""; }; - 04BDFE8012E6671800899322 /* SDL_sysmutex_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysmutex_c.h; sourceTree = ""; }; - 04BDFE8112E6671800899322 /* SDL_syssem.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_syssem.c; sourceTree = ""; }; - 04BDFE8212E6671800899322 /* SDL_systhread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systhread.c; sourceTree = ""; }; - 04BDFE8312E6671800899322 /* SDL_systhread_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_systhread_c.h; sourceTree = ""; }; - 04BDFE8B12E6671800899322 /* SDL_systhread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_systhread.h; sourceTree = ""; }; - 04BDFE8C12E6671800899322 /* SDL_thread.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_thread.c; sourceTree = ""; }; - 04BDFE8D12E6671800899322 /* SDL_thread_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_thread_c.h; sourceTree = ""; }; - 04BDFE9F12E6671800899322 /* SDL_timer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_timer.c; sourceTree = ""; }; - 04BDFEA012E6671800899322 /* SDL_timer_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_timer_c.h; sourceTree = ""; }; - 04BDFEA212E6671800899322 /* SDL_systimer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systimer.c; sourceTree = ""; }; - 04BDFEC212E6671800899322 /* SDL_cocoaclipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoaclipboard.h; sourceTree = ""; }; - 04BDFEC312E6671800899322 /* SDL_cocoaclipboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoaclipboard.m; sourceTree = ""; }; - 04BDFEC412E6671800899322 /* SDL_cocoaevents.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoaevents.h; sourceTree = ""; }; - 04BDFEC512E6671800899322 /* SDL_cocoaevents.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoaevents.m; sourceTree = ""; }; - 04BDFEC612E6671800899322 /* SDL_cocoakeyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoakeyboard.h; sourceTree = ""; }; - 04BDFEC712E6671800899322 /* SDL_cocoakeyboard.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoakeyboard.m; sourceTree = ""; }; - 04BDFEC812E6671800899322 /* SDL_cocoamodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoamodes.h; sourceTree = ""; }; - 04BDFEC912E6671800899322 /* SDL_cocoamodes.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoamodes.m; sourceTree = ""; }; - 04BDFECA12E6671800899322 /* SDL_cocoamouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoamouse.h; sourceTree = ""; }; - 04BDFECB12E6671800899322 /* SDL_cocoamouse.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoamouse.m; sourceTree = ""; }; - 04BDFECC12E6671800899322 /* SDL_cocoaopengl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoaopengl.h; sourceTree = ""; }; - 04BDFECD12E6671800899322 /* SDL_cocoaopengl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoaopengl.m; sourceTree = ""; }; - 04BDFECE12E6671800899322 /* SDL_cocoashape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoashape.h; sourceTree = ""; }; - 04BDFECF12E6671800899322 /* SDL_cocoashape.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoashape.m; sourceTree = ""; }; - 04BDFED012E6671800899322 /* SDL_cocoavideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoavideo.h; sourceTree = ""; }; - 04BDFED112E6671800899322 /* SDL_cocoavideo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoavideo.m; sourceTree = ""; }; - 04BDFED212E6671800899322 /* SDL_cocoawindow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoawindow.h; sourceTree = ""; }; - 04BDFED312E6671800899322 /* SDL_cocoawindow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoawindow.m; sourceTree = ""; }; - 04BDFEE812E6671800899322 /* SDL_nullevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_nullevents.c; sourceTree = ""; }; - 04BDFEE912E6671800899322 /* SDL_nullevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_nullevents_c.h; sourceTree = ""; }; - 04BDFEEC12E6671800899322 /* SDL_nullvideo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_nullvideo.c; sourceTree = ""; }; - 04BDFEED12E6671800899322 /* SDL_nullvideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_nullvideo.h; sourceTree = ""; }; - 04BDFF4E12E6671800899322 /* SDL_blit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blit.c; sourceTree = ""; }; - 04BDFF4F12E6671800899322 /* SDL_blit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blit.h; sourceTree = ""; }; - 04BDFF5012E6671800899322 /* SDL_blit_0.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blit_0.c; sourceTree = ""; }; - 04BDFF5112E6671800899322 /* SDL_blit_1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blit_1.c; sourceTree = ""; }; - 04BDFF5212E6671800899322 /* SDL_blit_A.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blit_A.c; sourceTree = ""; }; - 04BDFF5312E6671800899322 /* SDL_blit_auto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blit_auto.c; sourceTree = ""; }; - 04BDFF5412E6671800899322 /* SDL_blit_auto.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blit_auto.h; sourceTree = ""; }; - 04BDFF5512E6671800899322 /* SDL_blit_copy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blit_copy.c; sourceTree = ""; }; - 04BDFF5612E6671800899322 /* SDL_blit_copy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blit_copy.h; sourceTree = ""; }; - 04BDFF5712E6671800899322 /* SDL_blit_N.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blit_N.c; sourceTree = ""; }; - 04BDFF5812E6671800899322 /* SDL_blit_slow.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blit_slow.c; sourceTree = ""; }; - 04BDFF5912E6671800899322 /* SDL_blit_slow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blit_slow.h; sourceTree = ""; }; - 04BDFF5A12E6671800899322 /* SDL_bmp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_bmp.c; sourceTree = ""; }; - 04BDFF5B12E6671800899322 /* SDL_clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboard.c; sourceTree = ""; }; - 04BDFF6012E6671800899322 /* SDL_fillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_fillrect.c; sourceTree = ""; }; - 04BDFF6512E6671800899322 /* SDL_pixels.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_pixels.c; sourceTree = ""; }; - 04BDFF6612E6671800899322 /* SDL_pixels_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_pixels_c.h; sourceTree = ""; }; - 04BDFF6712E6671800899322 /* SDL_rect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_rect.c; sourceTree = ""; }; - 04BDFF6F12E6671800899322 /* SDL_RLEaccel.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_RLEaccel.c; sourceTree = ""; }; - 04BDFF7012E6671800899322 /* SDL_RLEaccel_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_RLEaccel_c.h; sourceTree = ""; }; - 04BDFF7112E6671800899322 /* SDL_shape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_shape.c; sourceTree = ""; }; - 04BDFF7212E6671800899322 /* SDL_shape_internals.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shape_internals.h; sourceTree = ""; }; - 04BDFF7312E6671800899322 /* SDL_stretch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_stretch.c; sourceTree = ""; }; - 04BDFF7412E6671800899322 /* SDL_surface.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_surface.c; sourceTree = ""; }; - 04BDFF7512E6671800899322 /* SDL_sysvideo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_sysvideo.h; sourceTree = ""; }; - 04BDFF7612E6671800899322 /* SDL_video.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_video.c; sourceTree = ""; }; - 04BDFFB812E6671800899322 /* imKStoUCS.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = imKStoUCS.c; sourceTree = ""; }; - 04BDFFB912E6671800899322 /* imKStoUCS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = imKStoUCS.h; sourceTree = ""; }; - 04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11clipboard.c; sourceTree = ""; }; - 04BDFFBB12E6671800899322 /* SDL_x11clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11clipboard.h; sourceTree = ""; }; - 04BDFFBC12E6671800899322 /* SDL_x11dyn.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11dyn.c; sourceTree = ""; }; - 04BDFFBD12E6671800899322 /* SDL_x11dyn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11dyn.h; sourceTree = ""; }; - 04BDFFBE12E6671800899322 /* SDL_x11events.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11events.c; sourceTree = ""; }; - 04BDFFBF12E6671800899322 /* SDL_x11events.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11events.h; sourceTree = ""; }; - 04BDFFC212E6671800899322 /* SDL_x11keyboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11keyboard.c; sourceTree = ""; }; - 04BDFFC312E6671800899322 /* SDL_x11keyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11keyboard.h; sourceTree = ""; }; - 04BDFFC412E6671800899322 /* SDL_x11modes.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11modes.c; sourceTree = ""; }; - 04BDFFC512E6671800899322 /* SDL_x11modes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11modes.h; sourceTree = ""; }; - 04BDFFC612E6671800899322 /* SDL_x11mouse.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11mouse.c; sourceTree = ""; }; - 04BDFFC712E6671800899322 /* SDL_x11mouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11mouse.h; sourceTree = ""; }; - 04BDFFC812E6671800899322 /* SDL_x11opengl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11opengl.c; sourceTree = ""; }; - 04BDFFC912E6671800899322 /* SDL_x11opengl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11opengl.h; sourceTree = ""; }; - 04BDFFCA12E6671800899322 /* SDL_x11opengles.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11opengles.c; sourceTree = ""; }; - 04BDFFCB12E6671800899322 /* SDL_x11opengles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11opengles.h; sourceTree = ""; }; - 04BDFFCE12E6671800899322 /* SDL_x11shape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11shape.c; sourceTree = ""; }; - 04BDFFCF12E6671800899322 /* SDL_x11shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11shape.h; sourceTree = ""; }; - 04BDFFD012E6671800899322 /* SDL_x11sym.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11sym.h; sourceTree = ""; }; - 04BDFFD112E6671800899322 /* SDL_x11touch.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11touch.c; sourceTree = ""; }; - 04BDFFD212E6671800899322 /* SDL_x11touch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11touch.h; sourceTree = ""; }; - 04BDFFD312E6671800899322 /* SDL_x11video.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11video.c; sourceTree = ""; }; - 04BDFFD412E6671800899322 /* SDL_x11video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11video.h; sourceTree = ""; }; - 04BDFFD512E6671800899322 /* SDL_x11window.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11window.c; sourceTree = ""; }; - 04BDFFD612E6671800899322 /* SDL_x11window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11window.h; sourceTree = ""; }; - 04F7803712FB748500FC43C0 /* SDL_nullframebuffer_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_nullframebuffer_c.h; sourceTree = ""; }; - 04F7803812FB748500FC43C0 /* SDL_nullframebuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_nullframebuffer.c; sourceTree = ""; }; - 04F7803D12FB74A200FC43C0 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = ""; }; - 04F7803E12FB74A200FC43C0 /* SDL_blendfillrect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blendfillrect.h; sourceTree = ""; }; - 04F7803F12FB74A200FC43C0 /* SDL_blendline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendline.c; sourceTree = ""; }; - 04F7804012FB74A200FC43C0 /* SDL_blendline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blendline.h; sourceTree = ""; }; - 04F7804112FB74A200FC43C0 /* SDL_blendpoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendpoint.c; sourceTree = ""; }; - 04F7804212FB74A200FC43C0 /* SDL_blendpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blendpoint.h; sourceTree = ""; }; - 04F7804312FB74A200FC43C0 /* SDL_draw.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_draw.h; sourceTree = ""; }; - 04F7804412FB74A200FC43C0 /* SDL_drawline.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_drawline.c; sourceTree = ""; }; - 04F7804512FB74A200FC43C0 /* SDL_drawline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_drawline.h; sourceTree = ""; }; - 04F7804612FB74A200FC43C0 /* SDL_drawpoint.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_drawpoint.c; sourceTree = ""; }; - 04F7804712FB74A200FC43C0 /* SDL_drawpoint.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_drawpoint.h; sourceTree = ""; }; - 566CDE8D148F0AC200C5A9BB /* SDL_dropevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_dropevents_c.h; sourceTree = ""; }; - 566CDE8E148F0AC200C5A9BB /* SDL_dropevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_dropevents.c; sourceTree = ""; }; - 567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SDL_sysfilesystem.m; path = ../../src/filesystem/cocoa/SDL_sysfilesystem.m; sourceTree = ""; }; - 567E2F2017C44C35005F1892 /* SDL_filesystem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_filesystem.h; sourceTree = ""; }; - 56A670081856545C0007D20F /* SDL_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_internal.h; path = ../../src/SDL_internal.h; sourceTree = ""; }; - 56A6701D185654B40007D20F /* SDL_dynapi_procs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_procs.h; path = ../../src/dynapi/SDL_dynapi_procs.h; sourceTree = ""; }; - 56A6701E185654B40007D20F /* SDL_dynapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_dynapi.c; path = ../../src/dynapi/SDL_dynapi.c; sourceTree = ""; }; - 56A6701F185654B40007D20F /* SDL_dynapi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi.h; path = ../../src/dynapi/SDL_dynapi.h; sourceTree = ""; }; - 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_dynapi_overrides.h; path = ../../src/dynapi/SDL_dynapi_overrides.h; sourceTree = ""; }; - A7381E931D8B69C300B177DD /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; - A7381E951D8B69D600B177DD /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; - A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gamecontroller.h; sourceTree = ""; }; - AA0F8490178D5ECC00823F9D /* SDL_systls.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_systls.c; sourceTree = ""; }; - AA628AC8159367B7005138DD /* SDL_rotate.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_rotate.c; sourceTree = ""; }; - AA628AC9159367B7005138DD /* SDL_rotate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_rotate.h; sourceTree = ""; }; - AA628ACF159367F2005138DD /* SDL_x11xinput2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11xinput2.c; sourceTree = ""; }; - AA628AD0159367F2005138DD /* SDL_x11xinput2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_x11xinput2.h; sourceTree = ""; }; - AA7557C71595D4D800BBD41B /* begin_code.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = begin_code.h; sourceTree = ""; }; - AA7557C81595D4D800BBD41B /* close_code.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = close_code.h; sourceTree = ""; }; - AA7557C91595D4D800BBD41B /* SDL_assert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_assert.h; sourceTree = ""; }; - AA7557CA1595D4D800BBD41B /* SDL_atomic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_atomic.h; sourceTree = ""; }; - AA7557CB1595D4D800BBD41B /* SDL_audio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_audio.h; sourceTree = ""; }; - AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_blendmode.h; sourceTree = ""; }; - AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_clipboard.h; sourceTree = ""; }; - AA7557CE1595D4D800BBD41B /* SDL_config_macosx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config_macosx.h; sourceTree = ""; }; - AA7557CF1595D4D800BBD41B /* SDL_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_config.h; sourceTree = ""; }; - AA7557D01595D4D800BBD41B /* SDL_copying.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_copying.h; sourceTree = ""; }; - AA7557D11595D4D800BBD41B /* SDL_cpuinfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cpuinfo.h; sourceTree = ""; }; - AA7557D21595D4D800BBD41B /* SDL_endian.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_endian.h; sourceTree = ""; }; - AA7557D31595D4D800BBD41B /* SDL_error.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_error.h; sourceTree = ""; }; - AA7557D41595D4D800BBD41B /* SDL_events.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_events.h; sourceTree = ""; }; - AA7557D51595D4D800BBD41B /* SDL_gesture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_gesture.h; sourceTree = ""; }; - AA7557D61595D4D800BBD41B /* SDL_haptic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_haptic.h; sourceTree = ""; }; - AA7557D71595D4D800BBD41B /* SDL_hints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_hints.h; sourceTree = ""; }; - AA7557D91595D4D800BBD41B /* SDL_joystick.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_joystick.h; sourceTree = ""; }; - AA7557DA1595D4D800BBD41B /* SDL_keyboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_keyboard.h; sourceTree = ""; }; - AA7557DB1595D4D800BBD41B /* SDL_keycode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_keycode.h; sourceTree = ""; }; - AA7557DC1595D4D800BBD41B /* SDL_loadso.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_loadso.h; sourceTree = ""; }; - AA7557DD1595D4D800BBD41B /* SDL_log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_log.h; sourceTree = ""; }; - AA7557DE1595D4D800BBD41B /* SDL_main.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_main.h; sourceTree = ""; }; - AA7557DF1595D4D800BBD41B /* SDL_mouse.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_mouse.h; sourceTree = ""; }; - AA7557E01595D4D800BBD41B /* SDL_mutex.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_mutex.h; sourceTree = ""; }; - AA7557E11595D4D800BBD41B /* SDL_name.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_name.h; sourceTree = ""; }; - AA7557E21595D4D800BBD41B /* SDL_opengl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengl.h; sourceTree = ""; }; - AA7557E31595D4D800BBD41B /* SDL_opengles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengles.h; sourceTree = ""; }; - AA7557E41595D4D800BBD41B /* SDL_opengles2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengles2.h; sourceTree = ""; }; - AA7557E51595D4D800BBD41B /* SDL_pixels.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_pixels.h; sourceTree = ""; }; - AA7557E61595D4D800BBD41B /* SDL_platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_platform.h; sourceTree = ""; }; - AA7557E71595D4D800BBD41B /* SDL_power.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_power.h; sourceTree = ""; }; - AA7557E81595D4D800BBD41B /* SDL_quit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_quit.h; sourceTree = ""; }; - AA7557E91595D4D800BBD41B /* SDL_rect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_rect.h; sourceTree = ""; }; - AA7557EA1595D4D800BBD41B /* SDL_render.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_render.h; sourceTree = ""; }; - AA7557EB1595D4D800BBD41B /* SDL_revision.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_revision.h; sourceTree = ""; }; - AA7557EC1595D4D800BBD41B /* SDL_rwops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_rwops.h; sourceTree = ""; }; - AA7557ED1595D4D800BBD41B /* SDL_scancode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_scancode.h; sourceTree = ""; }; - AA7557EE1595D4D800BBD41B /* SDL_shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_shape.h; sourceTree = ""; }; - AA7557EF1595D4D800BBD41B /* SDL_stdinc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_stdinc.h; sourceTree = ""; }; - AA7557F01595D4D800BBD41B /* SDL_surface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_surface.h; sourceTree = ""; }; - AA7557F11595D4D800BBD41B /* SDL_system.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_system.h; sourceTree = ""; }; - AA7557F21595D4D800BBD41B /* SDL_syswm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_syswm.h; sourceTree = ""; }; - AA7557F31595D4D800BBD41B /* SDL_thread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_thread.h; sourceTree = ""; }; - AA7557F41595D4D800BBD41B /* SDL_timer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_timer.h; sourceTree = ""; }; - AA7557F51595D4D800BBD41B /* SDL_touch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_touch.h; sourceTree = ""; }; - AA7557F61595D4D800BBD41B /* SDL_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_types.h; sourceTree = ""; }; - AA7557F71595D4D800BBD41B /* SDL_version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_version.h; sourceTree = ""; }; - AA7557F81595D4D800BBD41B /* SDL_video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_video.h; sourceTree = ""; }; - AA7557F91595D4D800BBD41B /* SDL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL.h; sourceTree = ""; }; - AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_x11messagebox.c; sourceTree = ""; }; - AA9FF9591637CBF9000DF050 /* SDL_messagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_messagebox.h; sourceTree = ""; }; - AABCC38B164063D200AB8930 /* SDL_cocoamessagebox.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoamessagebox.h; sourceTree = ""; }; - AABCC38C164063D200AB8930 /* SDL_cocoamessagebox.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoamessagebox.m; sourceTree = ""; }; - AAC070F4195606770073DCDF /* SDL_opengl_glext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengl_glext.h; sourceTree = ""; }; - AAC070F5195606770073DCDF /* SDL_opengles2_gl2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengles2_gl2.h; sourceTree = ""; }; - AAC070F6195606770073DCDF /* SDL_opengles2_gl2ext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengles2_gl2ext.h; sourceTree = ""; }; - AAC070F7195606770073DCDF /* SDL_opengles2_gl2platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengles2_gl2platform.h; sourceTree = ""; }; - AAC070F8195606770073DCDF /* SDL_opengles2_khrplatform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_opengles2_khrplatform.h; sourceTree = ""; }; - AADA5B8616CCAB3000107CF7 /* SDL_bits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_bits.h; sourceTree = ""; }; - BBFC088A164C6514003E6A99 /* SDL_gamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_gamecontroller.c; sourceTree = ""; }; - BECDF66B0761BA81005FE872 /* Info-Framework.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "Info-Framework.plist"; sourceTree = ""; }; - BECDF66C0761BA81005FE872 /* SDL2.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SDL2.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - BECDF6B30761BA81005FE872 /* libSDL2.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL2.a; sourceTree = BUILT_PRODUCTS_DIR; }; - BECDF6BE0761BA81005FE872 /* Standard DMG */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "Standard DMG"; sourceTree = BUILT_PRODUCTS_DIR; }; - D55A1B7F179F262300625D7C /* SDL_cocoamousetap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_cocoamousetap.h; sourceTree = ""; }; - D55A1B80179F262300625D7C /* SDL_cocoamousetap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_cocoamousetap.m; sourceTree = ""; }; - DB31407717554B71006C0E22 /* libSDL2.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libSDL2.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - DB89958518A1A5C50092407C /* SDL_syshaptic_c.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SDL_syshaptic_c.h; sourceTree = ""; }; - F59C710300D5CB5801000001 /* ReadMe.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = ReadMe.txt; sourceTree = ""; }; - F59C710600D5CB5801000001 /* SDL.info */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; path = SDL.info; sourceTree = ""; }; - F5A2EF3900C6A39A01000001 /* BUGS.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = BUGS.txt; path = ../../BUGS.txt; sourceTree = SOURCE_ROOT; }; - FA73671C19A540EF004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = /System/Library/Frameworks/CoreVideo.framework; sourceTree = ""; }; - FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDL_coreaudio.m; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - BECDF6680761BA81005FE872 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - A7381E971D8B6A0300B177DD /* AudioToolbox.framework in Frameworks */, - A7381E961D8B69D600B177DD /* CoreAudio.framework in Frameworks */, - FA73671D19A540EF004122E4 /* CoreVideo.framework in Frameworks */, - 007317A40858DECD00B2BC32 /* Cocoa.framework in Frameworks */, - 007317A60858DECD00B2BC32 /* IOKit.framework in Frameworks */, - 00D0D08410675DD9004B05EF /* CoreFoundation.framework in Frameworks */, - 00D0D0D810675E46004B05EF /* Carbon.framework in Frameworks */, - 00CFA89D106B4BA100758660 /* ForceFeedback.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BECDF6B10761BA81005FE872 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 56C5237E1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */, - FA73671E19A54140004122E4 /* CoreVideo.framework in Frameworks */, - 007317AB0858DECD00B2BC32 /* Cocoa.framework in Frameworks */, - 007317AD0858DECD00B2BC32 /* IOKit.framework in Frameworks */, - 56C523801D8F498B001F2F30 /* CoreFoundation.framework in Frameworks */, - 007317C30858E15000B2BC32 /* Carbon.framework in Frameworks */, - DB31408B17554D37006C0E22 /* ForceFeedback.framework in Frameworks */, - 562C4AE91D8F496200AF9EBE /* AudioToolbox.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB31406B17554B71006C0E22 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 56C5237F1D8F4985001F2F30 /* CoreAudio.framework in Frameworks */, - FA73671F19A54144004122E4 /* CoreVideo.framework in Frameworks */, - DB31406E17554B71006C0E22 /* Cocoa.framework in Frameworks */, - DB31407017554B71006C0E22 /* IOKit.framework in Frameworks */, - 56C523811D8F498C001F2F30 /* CoreFoundation.framework in Frameworks */, - DB31407217554B71006C0E22 /* Carbon.framework in Frameworks */, - DB31408D17554D3C006C0E22 /* ForceFeedback.framework in Frameworks */, - 562C4AEA1D8F496300AF9EBE /* AudioToolbox.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 0153844A006D81B07F000001 /* Public Headers */ = { - isa = PBXGroup; - children = ( - AA7557C71595D4D800BBD41B /* begin_code.h */, - AA7557C81595D4D800BBD41B /* close_code.h */, - AA7557F91595D4D800BBD41B /* SDL.h */, - AA7557C91595D4D800BBD41B /* SDL_assert.h */, - AA7557CA1595D4D800BBD41B /* SDL_atomic.h */, - AA7557CB1595D4D800BBD41B /* SDL_audio.h */, - AADA5B8616CCAB3000107CF7 /* SDL_bits.h */, - AA7557CC1595D4D800BBD41B /* SDL_blendmode.h */, - AA7557CD1595D4D800BBD41B /* SDL_clipboard.h */, - AA7557CF1595D4D800BBD41B /* SDL_config.h */, - AA7557CE1595D4D800BBD41B /* SDL_config_macosx.h */, - AA7557D01595D4D800BBD41B /* SDL_copying.h */, - AA7557D11595D4D800BBD41B /* SDL_cpuinfo.h */, - AA7557D21595D4D800BBD41B /* SDL_endian.h */, - AA7557D31595D4D800BBD41B /* SDL_error.h */, - AA7557D41595D4D800BBD41B /* SDL_events.h */, - 567E2F2017C44C35005F1892 /* SDL_filesystem.h */, - A77E6EB3167AB0A90010E40B /* SDL_gamecontroller.h */, - AA7557D51595D4D800BBD41B /* SDL_gesture.h */, - AA7557D61595D4D800BBD41B /* SDL_haptic.h */, - AA7557D71595D4D800BBD41B /* SDL_hints.h */, - AA7557D91595D4D800BBD41B /* SDL_joystick.h */, - AA7557DA1595D4D800BBD41B /* SDL_keyboard.h */, - AA7557DB1595D4D800BBD41B /* SDL_keycode.h */, - AA7557DC1595D4D800BBD41B /* SDL_loadso.h */, - AA7557DD1595D4D800BBD41B /* SDL_log.h */, - AA7557DE1595D4D800BBD41B /* SDL_main.h */, - AA9FF9591637CBF9000DF050 /* SDL_messagebox.h */, - AA7557DF1595D4D800BBD41B /* SDL_mouse.h */, - AA7557E01595D4D800BBD41B /* SDL_mutex.h */, - AA7557E11595D4D800BBD41B /* SDL_name.h */, - AA7557E21595D4D800BBD41B /* SDL_opengl.h */, - AAC070F4195606770073DCDF /* SDL_opengl_glext.h */, - AA7557E31595D4D800BBD41B /* SDL_opengles.h */, - AA7557E41595D4D800BBD41B /* SDL_opengles2.h */, - AAC070F5195606770073DCDF /* SDL_opengles2_gl2.h */, - AAC070F6195606770073DCDF /* SDL_opengles2_gl2ext.h */, - AAC070F7195606770073DCDF /* SDL_opengles2_gl2platform.h */, - AAC070F8195606770073DCDF /* SDL_opengles2_khrplatform.h */, - AA7557E51595D4D800BBD41B /* SDL_pixels.h */, - AA7557E61595D4D800BBD41B /* SDL_platform.h */, - AA7557E71595D4D800BBD41B /* SDL_power.h */, - AA7557E81595D4D800BBD41B /* SDL_quit.h */, - AA7557E91595D4D800BBD41B /* SDL_rect.h */, - AA7557EA1595D4D800BBD41B /* SDL_render.h */, - AA7557EB1595D4D800BBD41B /* SDL_revision.h */, - AA7557EC1595D4D800BBD41B /* SDL_rwops.h */, - AA7557ED1595D4D800BBD41B /* SDL_scancode.h */, - AA7557EE1595D4D800BBD41B /* SDL_shape.h */, - AA7557EF1595D4D800BBD41B /* SDL_stdinc.h */, - AA7557F01595D4D800BBD41B /* SDL_surface.h */, - AA7557F11595D4D800BBD41B /* SDL_system.h */, - AA7557F21595D4D800BBD41B /* SDL_syswm.h */, - AA7557F31595D4D800BBD41B /* SDL_thread.h */, - AA7557F41595D4D800BBD41B /* SDL_timer.h */, - AA7557F51595D4D800BBD41B /* SDL_touch.h */, - AA7557F61595D4D800BBD41B /* SDL_types.h */, - AA7557F71595D4D800BBD41B /* SDL_version.h */, - AA7557F81595D4D800BBD41B /* SDL_video.h */, - ); - name = "Public Headers"; - path = ../../include; - sourceTree = ""; - }; - 034768DDFF38A45A11DB9C8B /* Products */ = { - isa = PBXGroup; - children = ( - 089C1665FE841158C02AAC07 /* Resources */, - BECDF66C0761BA81005FE872 /* SDL2.framework */, - BECDF6B30761BA81005FE872 /* libSDL2.a */, - BECDF6BE0761BA81005FE872 /* Standard DMG */, - DB31407717554B71006C0E22 /* libSDL2.dylib */, - ); - name = Products; - sourceTree = ""; - }; - 041B2C9712FA0D680087D585 /* render */ = { - isa = PBXGroup; - children = ( - 041B2C9A12FA0D680087D585 /* opengl */, - 041B2CA012FA0D680087D585 /* software */, - 04409B8D12FA97ED00FB9AA8 /* mmx.h */, - 041B2C9E12FA0D680087D585 /* SDL_render.c */, - 041B2C9F12FA0D680087D585 /* SDL_sysrender.h */, - 04409B8E12FA97ED00FB9AA8 /* SDL_yuv_mmx.c */, - 04409B8F12FA97ED00FB9AA8 /* SDL_yuv_sw_c.h */, - 04409B9012FA97ED00FB9AA8 /* SDL_yuv_sw.c */, - ); - name = render; - path = ../../src/render; - sourceTree = SOURCE_ROOT; - }; - 041B2C9A12FA0D680087D585 /* opengl */ = { - isa = PBXGroup; - children = ( - 04043BBA12FEB1BE0076DB1F /* SDL_glfuncs.h */, - 0442EC1712FE1BBA004C9285 /* SDL_render_gl.c */, - 0435673C1303160F00BA5428 /* SDL_shaders_gl.c */, - 0435673D1303160F00BA5428 /* SDL_shaders_gl.h */, - ); - path = opengl; - sourceTree = ""; - }; - 041B2CA012FA0D680087D585 /* software */ = { - isa = PBXGroup; - children = ( - 04F7803D12FB74A200FC43C0 /* SDL_blendfillrect.c */, - 04F7803E12FB74A200FC43C0 /* SDL_blendfillrect.h */, - 04F7803F12FB74A200FC43C0 /* SDL_blendline.c */, - 04F7804012FB74A200FC43C0 /* SDL_blendline.h */, - 04F7804112FB74A200FC43C0 /* SDL_blendpoint.c */, - 04F7804212FB74A200FC43C0 /* SDL_blendpoint.h */, - 04F7804312FB74A200FC43C0 /* SDL_draw.h */, - 04F7804412FB74A200FC43C0 /* SDL_drawline.c */, - 04F7804512FB74A200FC43C0 /* SDL_drawline.h */, - 04F7804612FB74A200FC43C0 /* SDL_drawpoint.c */, - 04F7804712FB74A200FC43C0 /* SDL_drawpoint.h */, - 0442EC1B12FE1BCB004C9285 /* SDL_render_sw.c */, - 0442EC1A12FE1BCB004C9285 /* SDL_render_sw_c.h */, - AA628AC8159367B7005138DD /* SDL_rotate.c */, - AA628AC9159367B7005138DD /* SDL_rotate.h */, - ); - path = software; - sourceTree = ""; - }; - 04BDFD7312E6671700899322 /* atomic */ = { - isa = PBXGroup; - children = ( - 04BDFD7412E6671700899322 /* SDL_atomic.c */, - 04BDFD7512E6671700899322 /* SDL_spinlock.c */, - ); - name = atomic; - path = ../../src/atomic; - sourceTree = SOURCE_ROOT; - }; - 04BDFD7612E6671700899322 /* audio */ = { - isa = PBXGroup; - children = ( - 04BDFD8712E6671700899322 /* disk */, - 04BDFD9312E6671700899322 /* dummy */, - 04BDFD9F12E6671700899322 /* coreaudio */, - 04BDFDB412E6671700899322 /* SDL_audio.c */, - 04BDFDB512E6671700899322 /* SDL_audio_c.h */, - 04BDFDB612E6671700899322 /* SDL_audiocvt.c */, - 04BDFDB712E6671700899322 /* SDL_audiodev.c */, - 04BDFDB812E6671700899322 /* SDL_audiodev_c.h */, - 04BDFDBA12E6671700899322 /* SDL_audiotypecvt.c */, - 04BDFDBB12E6671700899322 /* SDL_mixer.c */, - 04BDFDC212E6671700899322 /* SDL_sysaudio.h */, - 04BDFDC312E6671700899322 /* SDL_wave.c */, - 04BDFDC412E6671700899322 /* SDL_wave.h */, - ); - name = audio; - path = ../../src/audio; - sourceTree = SOURCE_ROOT; - }; - 04BDFD8712E6671700899322 /* disk */ = { - isa = PBXGroup; - children = ( - 04BDFD8812E6671700899322 /* SDL_diskaudio.c */, - 04BDFD8912E6671700899322 /* SDL_diskaudio.h */, - ); - path = disk; - sourceTree = ""; - }; - 04BDFD9312E6671700899322 /* dummy */ = { - isa = PBXGroup; - children = ( - 04BDFD9412E6671700899322 /* SDL_dummyaudio.c */, - 04BDFD9512E6671700899322 /* SDL_dummyaudio.h */, - ); - path = dummy; - sourceTree = ""; - }; - 04BDFD9F12E6671700899322 /* coreaudio */ = { - isa = PBXGroup; - children = ( - 04BDFDA112E6671700899322 /* SDL_coreaudio.h */, - FABA34C61D8B5DB100915323 /* SDL_coreaudio.m */, - ); - path = coreaudio; - sourceTree = ""; - }; - 04BDFDD312E6671700899322 /* cpuinfo */ = { - isa = PBXGroup; - children = ( - 04BDFDD412E6671700899322 /* SDL_cpuinfo.c */, - ); - name = cpuinfo; - path = ../../src/cpuinfo; - sourceTree = SOURCE_ROOT; - }; - 04BDFDD512E6671700899322 /* events */ = { - isa = PBXGroup; - children = ( - 04BDFDD612E6671700899322 /* blank_cursor.h */, - 04BDFDD712E6671700899322 /* default_cursor.h */, - 04BDFDD812E6671700899322 /* scancodes_darwin.h */, - 04BDFDD912E6671700899322 /* scancodes_linux.h */, - 04BDFDDB12E6671700899322 /* scancodes_xfree86.h */, - 04BDFDDC12E6671700899322 /* SDL_clipboardevents.c */, - 04BDFDDD12E6671700899322 /* SDL_clipboardevents_c.h */, - 566CDE8D148F0AC200C5A9BB /* SDL_dropevents_c.h */, - 566CDE8E148F0AC200C5A9BB /* SDL_dropevents.c */, - 04BDFDDE12E6671700899322 /* SDL_events.c */, - 04BDFDDF12E6671700899322 /* SDL_events_c.h */, - 04BDFDE012E6671700899322 /* SDL_gesture.c */, - 04BDFDE112E6671700899322 /* SDL_gesture_c.h */, - 04BDFDE212E6671700899322 /* SDL_keyboard.c */, - 04BDFDE312E6671700899322 /* SDL_keyboard_c.h */, - 04BDFDE412E6671700899322 /* SDL_mouse.c */, - 04BDFDE512E6671700899322 /* SDL_mouse_c.h */, - 04BDFDE612E6671700899322 /* SDL_quit.c */, - 04BDFDE712E6671700899322 /* SDL_sysevents.h */, - 04BDFDE812E6671700899322 /* SDL_touch.c */, - 04BDFDE912E6671700899322 /* SDL_touch_c.h */, - 04BDFDEA12E6671700899322 /* SDL_windowevents.c */, - 04BDFDEB12E6671700899322 /* SDL_windowevents_c.h */, - ); - name = events; - path = ../../src/events; - sourceTree = SOURCE_ROOT; - }; - 04BDFDEC12E6671700899322 /* file */ = { - isa = PBXGroup; - children = ( - 04BDFDED12E6671700899322 /* cocoa */, - 04BDFDF012E6671700899322 /* SDL_rwops.c */, - ); - name = file; - path = ../../src/file; - sourceTree = SOURCE_ROOT; - }; - 04BDFDED12E6671700899322 /* cocoa */ = { - isa = PBXGroup; - children = ( - 04BDFDEE12E6671700899322 /* SDL_rwopsbundlesupport.h */, - 04BDFDEF12E6671700899322 /* SDL_rwopsbundlesupport.m */, - ); - path = cocoa; - sourceTree = ""; - }; - 04BDFDF112E6671700899322 /* haptic */ = { - isa = PBXGroup; - children = ( - 04BDFDF212E6671700899322 /* darwin */, - 04BDFDFA12E6671700899322 /* SDL_haptic.c */, - 04BDFDFB12E6671700899322 /* SDL_haptic_c.h */, - 04BDFDFC12E6671700899322 /* SDL_syshaptic.h */, - ); - name = haptic; - path = ../../src/haptic; - sourceTree = SOURCE_ROOT; - }; - 04BDFDF212E6671700899322 /* darwin */ = { - isa = PBXGroup; - children = ( - 04BDFDF312E6671700899322 /* SDL_syshaptic.c */, - DB89958518A1A5C50092407C /* SDL_syshaptic_c.h */, - ); - path = darwin; - sourceTree = ""; - }; - 04BDFDFF12E6671700899322 /* joystick */ = { - isa = PBXGroup; - children = ( - 04BDFE0612E6671700899322 /* darwin */, - 04BDFE1612E6671700899322 /* SDL_joystick.c */, - 04BDFE1712E6671700899322 /* SDL_joystick_c.h */, - BBFC088A164C6514003E6A99 /* SDL_gamecontroller.c */, - 04BDFE1812E6671700899322 /* SDL_sysjoystick.h */, - ); - name = joystick; - path = ../../src/joystick; - sourceTree = SOURCE_ROOT; - }; - 04BDFE0612E6671700899322 /* darwin */ = { - isa = PBXGroup; - children = ( - 04BDFE0712E6671700899322 /* SDL_sysjoystick.c */, - 04BDFE0812E6671700899322 /* SDL_sysjoystick_c.h */, - ); - path = darwin; - sourceTree = ""; - }; - 04BDFE2F12E6671700899322 /* loadso */ = { - isa = PBXGroup; - children = ( - 04BDFE3212E6671700899322 /* dlopen */, - ); - name = loadso; - path = ../../src/loadso; - sourceTree = SOURCE_ROOT; - }; - 04BDFE3212E6671700899322 /* dlopen */ = { - isa = PBXGroup; - children = ( - 04BDFE3312E6671700899322 /* SDL_sysloadso.c */, - ); - path = dlopen; - sourceTree = ""; - }; - 04BDFE4512E6671700899322 /* power */ = { - isa = PBXGroup; - children = ( - 04BDFE4A12E6671700899322 /* macosx */, - 04BDFE4E12E6671700899322 /* SDL_power.c */, - ); - name = power; - path = ../../src/power; - sourceTree = SOURCE_ROOT; - }; - 04BDFE4A12E6671700899322 /* macosx */ = { - isa = PBXGroup; - children = ( - 04BDFE4B12E6671700899322 /* SDL_syspower.c */, - ); - path = macosx; - sourceTree = ""; - }; - 04BDFE5D12E6671700899322 /* stdlib */ = { - isa = PBXGroup; - children = ( - 04BDFE5E12E6671700899322 /* SDL_getenv.c */, - 04BDFE5F12E6671700899322 /* SDL_iconv.c */, - 04BDFE6012E6671700899322 /* SDL_malloc.c */, - 04BDFE6112E6671700899322 /* SDL_qsort.c */, - 04BDFE6212E6671700899322 /* SDL_stdlib.c */, - 04BDFE6312E6671700899322 /* SDL_string.c */, - ); - name = stdlib; - path = ../../src/stdlib; - sourceTree = SOURCE_ROOT; - }; - 04BDFE6412E6671800899322 /* thread */ = { - isa = PBXGroup; - children = ( - 04BDFE7D12E6671800899322 /* pthread */, - 04BDFE8B12E6671800899322 /* SDL_systhread.h */, - 04BDFE8C12E6671800899322 /* SDL_thread.c */, - 04BDFE8D12E6671800899322 /* SDL_thread_c.h */, - ); - name = thread; - path = ../../src/thread; - sourceTree = SOURCE_ROOT; - }; - 04BDFE7D12E6671800899322 /* pthread */ = { - isa = PBXGroup; - children = ( - 04BDFE7E12E6671800899322 /* SDL_syscond.c */, - 04BDFE7F12E6671800899322 /* SDL_sysmutex.c */, - 04BDFE8012E6671800899322 /* SDL_sysmutex_c.h */, - 04BDFE8112E6671800899322 /* SDL_syssem.c */, - 04BDFE8212E6671800899322 /* SDL_systhread.c */, - 04BDFE8312E6671800899322 /* SDL_systhread_c.h */, - AA0F8490178D5ECC00823F9D /* SDL_systls.c */, - ); - path = pthread; - sourceTree = ""; - }; - 04BDFE9512E6671800899322 /* timer */ = { - isa = PBXGroup; - children = ( - 04BDFEA112E6671800899322 /* unix */, - 04BDFE9F12E6671800899322 /* SDL_timer.c */, - 04BDFEA012E6671800899322 /* SDL_timer_c.h */, - ); - name = timer; - path = ../../src/timer; - sourceTree = SOURCE_ROOT; - }; - 04BDFEA112E6671800899322 /* unix */ = { - isa = PBXGroup; - children = ( - 04BDFEA212E6671800899322 /* SDL_systimer.c */, - ); - path = unix; - sourceTree = ""; - }; - 04BDFEA712E6671800899322 /* video */ = { - isa = PBXGroup; - children = ( - 04BDFEC112E6671800899322 /* cocoa */, - 04BDFEE712E6671800899322 /* dummy */, - 04BDFFB712E6671800899322 /* x11 */, - 04BDFF4E12E6671800899322 /* SDL_blit.c */, - 04BDFF4F12E6671800899322 /* SDL_blit.h */, - 04BDFF5012E6671800899322 /* SDL_blit_0.c */, - 04BDFF5112E6671800899322 /* SDL_blit_1.c */, - 04BDFF5212E6671800899322 /* SDL_blit_A.c */, - 04BDFF5312E6671800899322 /* SDL_blit_auto.c */, - 04BDFF5412E6671800899322 /* SDL_blit_auto.h */, - 04BDFF5512E6671800899322 /* SDL_blit_copy.c */, - 04BDFF5612E6671800899322 /* SDL_blit_copy.h */, - 04BDFF5712E6671800899322 /* SDL_blit_N.c */, - 04BDFF5812E6671800899322 /* SDL_blit_slow.c */, - 04BDFF5912E6671800899322 /* SDL_blit_slow.h */, - 04BDFF5A12E6671800899322 /* SDL_bmp.c */, - 04BDFF5B12E6671800899322 /* SDL_clipboard.c */, - 04BDFF6012E6671800899322 /* SDL_fillrect.c */, - 04BDFF6512E6671800899322 /* SDL_pixels.c */, - 04BDFF6612E6671800899322 /* SDL_pixels_c.h */, - 04BDFF6712E6671800899322 /* SDL_rect.c */, - 04BDFF6F12E6671800899322 /* SDL_RLEaccel.c */, - 04BDFF7012E6671800899322 /* SDL_RLEaccel_c.h */, - 04BDFF7112E6671800899322 /* SDL_shape.c */, - 04BDFF7212E6671800899322 /* SDL_shape_internals.h */, - 04BDFF7312E6671800899322 /* SDL_stretch.c */, - 04BDFF7412E6671800899322 /* SDL_surface.c */, - 04BDFF7512E6671800899322 /* SDL_sysvideo.h */, - 04BDFF7612E6671800899322 /* SDL_video.c */, - ); - name = video; - path = ../../src/video; - sourceTree = SOURCE_ROOT; - }; - 04BDFEC112E6671800899322 /* cocoa */ = { - isa = PBXGroup; - children = ( - 04BDFEC212E6671800899322 /* SDL_cocoaclipboard.h */, - 04BDFEC312E6671800899322 /* SDL_cocoaclipboard.m */, - 04BDFEC412E6671800899322 /* SDL_cocoaevents.h */, - 04BDFEC512E6671800899322 /* SDL_cocoaevents.m */, - 04BDFEC612E6671800899322 /* SDL_cocoakeyboard.h */, - 04BDFEC712E6671800899322 /* SDL_cocoakeyboard.m */, - AABCC38B164063D200AB8930 /* SDL_cocoamessagebox.h */, - AABCC38C164063D200AB8930 /* SDL_cocoamessagebox.m */, - 04BDFEC812E6671800899322 /* SDL_cocoamodes.h */, - 04BDFEC912E6671800899322 /* SDL_cocoamodes.m */, - 04BDFECA12E6671800899322 /* SDL_cocoamouse.h */, - 04BDFECB12E6671800899322 /* SDL_cocoamouse.m */, - D55A1B7F179F262300625D7C /* SDL_cocoamousetap.h */, - D55A1B80179F262300625D7C /* SDL_cocoamousetap.m */, - 04BDFECC12E6671800899322 /* SDL_cocoaopengl.h */, - 04BDFECD12E6671800899322 /* SDL_cocoaopengl.m */, - 04BDFECE12E6671800899322 /* SDL_cocoashape.h */, - 04BDFECF12E6671800899322 /* SDL_cocoashape.m */, - 04BDFED012E6671800899322 /* SDL_cocoavideo.h */, - 04BDFED112E6671800899322 /* SDL_cocoavideo.m */, - 04BDFED212E6671800899322 /* SDL_cocoawindow.h */, - 04BDFED312E6671800899322 /* SDL_cocoawindow.m */, - ); - path = cocoa; - sourceTree = ""; - }; - 04BDFEE712E6671800899322 /* dummy */ = { - isa = PBXGroup; - children = ( - 04BDFEE812E6671800899322 /* SDL_nullevents.c */, - 04BDFEE912E6671800899322 /* SDL_nullevents_c.h */, - 04F7803712FB748500FC43C0 /* SDL_nullframebuffer_c.h */, - 04F7803812FB748500FC43C0 /* SDL_nullframebuffer.c */, - 04BDFEEC12E6671800899322 /* SDL_nullvideo.c */, - 04BDFEED12E6671800899322 /* SDL_nullvideo.h */, - ); - path = dummy; - sourceTree = ""; - }; - 04BDFFB712E6671800899322 /* x11 */ = { - isa = PBXGroup; - children = ( - 04BDFFB812E6671800899322 /* imKStoUCS.c */, - 04BDFFB912E6671800899322 /* imKStoUCS.h */, - 04BDFFBA12E6671800899322 /* SDL_x11clipboard.c */, - 04BDFFBB12E6671800899322 /* SDL_x11clipboard.h */, - 04BDFFBC12E6671800899322 /* SDL_x11dyn.c */, - 04BDFFBD12E6671800899322 /* SDL_x11dyn.h */, - 04BDFFBE12E6671800899322 /* SDL_x11events.c */, - 04BDFFBF12E6671800899322 /* SDL_x11events.h */, - 0442EC5812FE1C60004C9285 /* SDL_x11framebuffer.c */, - 0442EC5912FE1C60004C9285 /* SDL_x11framebuffer.h */, - 04BDFFC212E6671800899322 /* SDL_x11keyboard.c */, - 04BDFFC312E6671800899322 /* SDL_x11keyboard.h */, - AA9E4092163BE51E007A2AD0 /* SDL_x11messagebox.c */, - 04BDFFC412E6671800899322 /* SDL_x11modes.c */, - 04BDFFC512E6671800899322 /* SDL_x11modes.h */, - 04BDFFC612E6671800899322 /* SDL_x11mouse.c */, - 04BDFFC712E6671800899322 /* SDL_x11mouse.h */, - 04BDFFC812E6671800899322 /* SDL_x11opengl.c */, - 04BDFFC912E6671800899322 /* SDL_x11opengl.h */, - 04BDFFCA12E6671800899322 /* SDL_x11opengles.c */, - 04BDFFCB12E6671800899322 /* SDL_x11opengles.h */, - 04BDFFCE12E6671800899322 /* SDL_x11shape.c */, - 04BDFFCF12E6671800899322 /* SDL_x11shape.h */, - 04BDFFD012E6671800899322 /* SDL_x11sym.h */, - 04BDFFD112E6671800899322 /* SDL_x11touch.c */, - 04BDFFD212E6671800899322 /* SDL_x11touch.h */, - 04BDFFD312E6671800899322 /* SDL_x11video.c */, - 04BDFFD412E6671800899322 /* SDL_x11video.h */, - 04BDFFD512E6671800899322 /* SDL_x11window.c */, - 04BDFFD612E6671800899322 /* SDL_x11window.h */, - AA628ACF159367F2005138DD /* SDL_x11xinput2.c */, - AA628AD0159367F2005138DD /* SDL_x11xinput2.h */, - ); - path = x11; - sourceTree = ""; - }; - 0867D691FE84028FC02AAC07 /* SDLFramework */ = { - isa = PBXGroup; - children = ( - F5A2EF3900C6A39A01000001 /* BUGS.txt */, - F59C70FC00D5CB5801000001 /* pkg-support */, - 0153844A006D81B07F000001 /* Public Headers */, - 08FB77ACFE841707C02AAC07 /* Library Source */, - 034768DDFF38A45A11DB9C8B /* Products */, - BECDF66B0761BA81005FE872 /* Info-Framework.plist */, - BEC562FE0761C0E800A33029 /* Linked Frameworks */, - ); - comments = "To build Universal Binaries, we have experimented with a variety of different options.\nThe complication is that we must retain compatibility with at least 10.2. \nThe Universal Binary defaults only work for > 10.3.9\n\nSo far, we have found:\ngcc 4.0.0 with Xcode 2.1 always links against libgcc_s. gcc 4.0.1 from Xcode 2.2 fixes this problem.\n\nBut gcc 4.0 will not work with < 10.3.9 because we continue to get an undefined symbol to _fprintf$LDBL128.\nSo we must use gcc 3.3 on PPC to accomplish 10.2 support. (But 4.0 is required for i386.)\n\nSetting the deployment target to 10.4 will disable prebinding, so for PPC, we set it less than 10.4 to preserve prebinding for legacy support.\n\nSetting the PPC SDKROOT to /Developers/SDKs/MacOSX10.2.8.sdk will link to 63.0.0 libSystem.B.dylib. Leaving it at current or 10.4u links to 88.1.2. However, as long as we are using gcc 3.3, it doesn't seem to matter as testing has demonstrated both will run. We have decided not to invoke the 10.2.8 SDK because it is not a default installed component with Xcode which will probably cause most people problems. However, rather than deleting the SDKROOT_ppc entry entirely, we have mapped it to 10.4u in case we decide we need to change this setting.\n\nTo use Altivec or SSE, we needed architecture specific flags:\nOTHER_CFLAGS_ppc\nOTHER_CFLAGS_i386\nOTHER_CFLAGS=$(OTHER_CFLAGS_($CURRENT_ARCH))\n\nThe general OTHER_CFLAGS needed to be manually mapped to architecture specific options because Xcode didn't do this automatically for us.\n\n\n"; - indentWidth = 4; - name = SDLFramework; - sourceTree = ""; - tabWidth = 4; - usesTabs = 0; - }; - 089C1665FE841158C02AAC07 /* Resources */ = { - isa = PBXGroup; - children = ( - ); - name = Resources; - sourceTree = ""; - }; - 08FB77ACFE841707C02AAC07 /* Library Source */ = { - isa = PBXGroup; - children = ( - 04BDFD7312E6671700899322 /* atomic */, - 04BDFD7612E6671700899322 /* audio */, - 04BDFDD312E6671700899322 /* cpuinfo */, - 56A6701C1856549B0007D20F /* dynapi */, - 04BDFDD512E6671700899322 /* events */, - 567E2F1F17C44BBB005F1892 /* filesystem */, - 04BDFDEC12E6671700899322 /* file */, - 04BDFDF112E6671700899322 /* haptic */, - 04BDFDFF12E6671700899322 /* joystick */, - 04BDFE2F12E6671700899322 /* loadso */, - 04BDFE4512E6671700899322 /* power */, - 041B2C9712FA0D680087D585 /* render */, - 04BDFE5D12E6671700899322 /* stdlib */, - 04BDFE6412E6671800899322 /* thread */, - 04BDFE9512E6671800899322 /* timer */, - 04BDFEA712E6671800899322 /* video */, - 56A670081856545C0007D20F /* SDL_internal.h */, - 04BDFE5512E6671700899322 /* SDL_assert_c.h */, - 04BDFE5612E6671700899322 /* SDL_assert.c */, - 04BDFE5812E6671700899322 /* SDL_error_c.h */, - 04BDFE5912E6671700899322 /* SDL_error.c */, - 0442EC5E12FE1C75004C9285 /* SDL_hints.c */, - 04BAC0C71300C2160055DE28 /* SDL_log.c */, - 04BDFE5C12E6671700899322 /* SDL.c */, - ); - name = "Library Source"; - sourceTree = ""; - }; - 567E2F1F17C44BBB005F1892 /* filesystem */ = { - isa = PBXGroup; - children = ( - 567E2F1B17C44BB2005F1892 /* SDL_sysfilesystem.m */, - ); - name = filesystem; - sourceTree = ""; - }; - 56A6701C1856549B0007D20F /* dynapi */ = { - isa = PBXGroup; - children = ( - 56A6701D185654B40007D20F /* SDL_dynapi_procs.h */, - 56A6701E185654B40007D20F /* SDL_dynapi.c */, - 56A6701F185654B40007D20F /* SDL_dynapi.h */, - 56A67020185654B40007D20F /* SDL_dynapi_overrides.h */, - ); - name = dynapi; - sourceTree = ""; - }; - BEC562FE0761C0E800A33029 /* Linked Frameworks */ = { - isa = PBXGroup; - children = ( - A7381E931D8B69C300B177DD /* AudioToolbox.framework */, - A7381E951D8B69D600B177DD /* CoreAudio.framework */, - FA73671C19A540EF004122E4 /* CoreVideo.framework */, - 00D0D08310675DD9004B05EF /* CoreFoundation.framework */, - 007317C10858E15000B2BC32 /* Carbon.framework */, - 0073179D0858DECD00B2BC32 /* Cocoa.framework */, - 0073179F0858DECD00B2BC32 /* IOKit.framework */, - 00CFA89C106B4BA100758660 /* ForceFeedback.framework */, - ); - name = "Linked Frameworks"; - sourceTree = ""; - }; - F59C70FC00D5CB5801000001 /* pkg-support */ = { - isa = PBXGroup; - children = ( - F59C710100D5CB5801000001 /* resources */, - F59C710600D5CB5801000001 /* SDL.info */, - ); - path = "pkg-support"; - sourceTree = SOURCE_ROOT; - }; - F59C710100D5CB5801000001 /* resources */ = { - isa = PBXGroup; - children = ( - 00794D3F09D0C461003FC8A1 /* License.txt */, - F59C710300D5CB5801000001 /* ReadMe.txt */, - ); - path = resources; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - BECDF5FF0761BA81005FE872 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - AA7557FA1595D4D800BBD41B /* begin_code.h in Headers */, - AA7557FC1595D4D800BBD41B /* close_code.h in Headers */, - AA75585E1595D4D800BBD41B /* SDL.h in Headers */, - AA7557FE1595D4D800BBD41B /* SDL_assert.h in Headers */, - AA7558001595D4D800BBD41B /* SDL_atomic.h in Headers */, - AA7558021595D4D800BBD41B /* SDL_audio.h in Headers */, - AADA5B8716CCAB3000107CF7 /* SDL_bits.h in Headers */, - AA7558041595D4D800BBD41B /* SDL_blendmode.h in Headers */, - AA7558061595D4D800BBD41B /* SDL_clipboard.h in Headers */, - AA7558081595D4D800BBD41B /* SDL_config_macosx.h in Headers */, - AA75580A1595D4D800BBD41B /* SDL_config.h in Headers */, - 56A670091856545C0007D20F /* SDL_internal.h in Headers */, - AA75580C1595D4D800BBD41B /* SDL_copying.h in Headers */, - AA75580E1595D4D800BBD41B /* SDL_cpuinfo.h in Headers */, - AA7558101595D4D800BBD41B /* SDL_endian.h in Headers */, - AA7558121595D4D800BBD41B /* SDL_error.h in Headers */, - AA7558141595D4D800BBD41B /* SDL_events.h in Headers */, - 567E2F2117C44C35005F1892 /* SDL_filesystem.h in Headers */, - A77E6EB4167AB0A90010E40B /* SDL_gamecontroller.h in Headers */, - AA7558161595D4D800BBD41B /* SDL_gesture.h in Headers */, - AA7558181595D4D800BBD41B /* SDL_haptic.h in Headers */, - AA75581A1595D4D800BBD41B /* SDL_hints.h in Headers */, - AA75581E1595D4D800BBD41B /* SDL_joystick.h in Headers */, - AA7558201595D4D800BBD41B /* SDL_keyboard.h in Headers */, - AA7558221595D4D800BBD41B /* SDL_keycode.h in Headers */, - AA7558241595D4D800BBD41B /* SDL_loadso.h in Headers */, - AA7558261595D4D800BBD41B /* SDL_log.h in Headers */, - AA7558281595D4D800BBD41B /* SDL_main.h in Headers */, - AA9FF95A1637CBF9000DF050 /* SDL_messagebox.h in Headers */, - AA75582A1595D4D800BBD41B /* SDL_mouse.h in Headers */, - AA75582C1595D4D800BBD41B /* SDL_mutex.h in Headers */, - AA75582E1595D4D800BBD41B /* SDL_name.h in Headers */, - AA7558301595D4D800BBD41B /* SDL_opengl.h in Headers */, - AAC070F9195606770073DCDF /* SDL_opengl_glext.h in Headers */, - AA7558321595D4D800BBD41B /* SDL_opengles.h in Headers */, - AA7558341595D4D800BBD41B /* SDL_opengles2.h in Headers */, - AAC070FC195606770073DCDF /* SDL_opengles2_gl2.h in Headers */, - AAC070FF195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */, - AAC07102195606770073DCDF /* SDL_opengles2_gl2platform.h in Headers */, - AAC07105195606770073DCDF /* SDL_opengles2_khrplatform.h in Headers */, - AA7558361595D4D800BBD41B /* SDL_pixels.h in Headers */, - AA7558381595D4D800BBD41B /* SDL_platform.h in Headers */, - AA75583A1595D4D800BBD41B /* SDL_power.h in Headers */, - AA75583C1595D4D800BBD41B /* SDL_quit.h in Headers */, - AA75583E1595D4D800BBD41B /* SDL_rect.h in Headers */, - AA7558401595D4D800BBD41B /* SDL_render.h in Headers */, - AA7558421595D4D800BBD41B /* SDL_revision.h in Headers */, - AA7558441595D4D800BBD41B /* SDL_rwops.h in Headers */, - AA7558461595D4D800BBD41B /* SDL_scancode.h in Headers */, - AA7558481595D4D800BBD41B /* SDL_shape.h in Headers */, - AA75584A1595D4D800BBD41B /* SDL_stdinc.h in Headers */, - AA75584C1595D4D800BBD41B /* SDL_surface.h in Headers */, - AA75584E1595D4D800BBD41B /* SDL_system.h in Headers */, - AA7558501595D4D800BBD41B /* SDL_syswm.h in Headers */, - AA7558521595D4D800BBD41B /* SDL_thread.h in Headers */, - AA7558541595D4D800BBD41B /* SDL_timer.h in Headers */, - AA7558561595D4D800BBD41B /* SDL_touch.h in Headers */, - AA7558581595D4D800BBD41B /* SDL_types.h in Headers */, - AA75585A1595D4D800BBD41B /* SDL_version.h in Headers */, - AA75585C1595D4D800BBD41B /* SDL_video.h in Headers */, - 04BD000912E6671800899322 /* SDL_diskaudio.h in Headers */, - 04BD001112E6671800899322 /* SDL_dummyaudio.h in Headers */, - 04BD001912E6671800899322 /* SDL_coreaudio.h in Headers */, - 04BD002712E6671800899322 /* SDL_audio_c.h in Headers */, - 04BD002A12E6671800899322 /* SDL_audiodev_c.h in Headers */, - 04BD003412E6671800899322 /* SDL_sysaudio.h in Headers */, - 04BD003612E6671800899322 /* SDL_wave.h in Headers */, - 04BD004212E6671800899322 /* blank_cursor.h in Headers */, - 04BD004312E6671800899322 /* default_cursor.h in Headers */, - 04BD004412E6671800899322 /* scancodes_darwin.h in Headers */, - 04BD004512E6671800899322 /* scancodes_linux.h in Headers */, - 04BD004712E6671800899322 /* scancodes_xfree86.h in Headers */, - 04BD004912E6671800899322 /* SDL_clipboardevents_c.h in Headers */, - 56A6702A185654B40007D20F /* SDL_dynapi_overrides.h in Headers */, - 04BD004B12E6671800899322 /* SDL_events_c.h in Headers */, - 04BD004D12E6671800899322 /* SDL_gesture_c.h in Headers */, - 04BD004F12E6671800899322 /* SDL_keyboard_c.h in Headers */, - 04BD005112E6671800899322 /* SDL_mouse_c.h in Headers */, - 04BD005312E6671800899322 /* SDL_sysevents.h in Headers */, - 04BD005512E6671800899322 /* SDL_touch_c.h in Headers */, - 04BD005712E6671800899322 /* SDL_windowevents_c.h in Headers */, - 04BD005812E6671800899322 /* SDL_rwopsbundlesupport.h in Headers */, - 04BD006012E6671800899322 /* SDL_haptic_c.h in Headers */, - 04BD006112E6671800899322 /* SDL_syshaptic.h in Headers */, - 04BD006712E6671800899322 /* SDL_sysjoystick_c.h in Headers */, - 04BD007112E6671800899322 /* SDL_joystick_c.h in Headers */, - 04BD007212E6671800899322 /* SDL_sysjoystick.h in Headers */, - 04BD009B12E6671800899322 /* SDL_assert_c.h in Headers */, - 04BD009E12E6671800899322 /* SDL_error_c.h in Headers */, - 04BD00BF12E6671800899322 /* SDL_sysmutex_c.h in Headers */, - 04BD00C212E6671800899322 /* SDL_systhread_c.h in Headers */, - 04BD00C912E6671800899322 /* SDL_systhread.h in Headers */, - 04BD00CB12E6671800899322 /* SDL_thread_c.h in Headers */, - 04BD00D812E6671800899322 /* SDL_timer_c.h in Headers */, - 04BD00F312E6671800899322 /* SDL_cocoaclipboard.h in Headers */, - 04BD00F512E6671800899322 /* SDL_cocoaevents.h in Headers */, - 04BD00F712E6671800899322 /* SDL_cocoakeyboard.h in Headers */, - 04BD00F912E6671800899322 /* SDL_cocoamodes.h in Headers */, - 04BD00FB12E6671800899322 /* SDL_cocoamouse.h in Headers */, - 04BD00FD12E6671800899322 /* SDL_cocoaopengl.h in Headers */, - 04BD00FF12E6671800899322 /* SDL_cocoashape.h in Headers */, - 04BD010112E6671800899322 /* SDL_cocoavideo.h in Headers */, - 04BD010312E6671800899322 /* SDL_cocoawindow.h in Headers */, - 04BD011812E6671800899322 /* SDL_nullevents_c.h in Headers */, - 04BD011C12E6671800899322 /* SDL_nullvideo.h in Headers */, - 04BD017612E6671800899322 /* SDL_blit.h in Headers */, - 04BD017B12E6671800899322 /* SDL_blit_auto.h in Headers */, - 04BD017D12E6671800899322 /* SDL_blit_copy.h in Headers */, - 04BD018012E6671800899322 /* SDL_blit_slow.h in Headers */, - 04BD018D12E6671800899322 /* SDL_pixels_c.h in Headers */, - 04BD019712E6671800899322 /* SDL_RLEaccel_c.h in Headers */, - 04BD019912E6671800899322 /* SDL_shape_internals.h in Headers */, - 04BD019C12E6671800899322 /* SDL_sysvideo.h in Headers */, - 04BD01DC12E6671800899322 /* imKStoUCS.h in Headers */, - 04BD01DE12E6671800899322 /* SDL_x11clipboard.h in Headers */, - 04BD01E012E6671800899322 /* SDL_x11dyn.h in Headers */, - 04BD01E212E6671800899322 /* SDL_x11events.h in Headers */, - 04BD01E612E6671800899322 /* SDL_x11keyboard.h in Headers */, - 04BD01E812E6671800899322 /* SDL_x11modes.h in Headers */, - 04BD01EA12E6671800899322 /* SDL_x11mouse.h in Headers */, - 04BD01EC12E6671800899322 /* SDL_x11opengl.h in Headers */, - 04BD01EE12E6671800899322 /* SDL_x11opengles.h in Headers */, - 04BD01F212E6671800899322 /* SDL_x11shape.h in Headers */, - 04BD01F312E6671800899322 /* SDL_x11sym.h in Headers */, - 56A67021185654B40007D20F /* SDL_dynapi_procs.h in Headers */, - 04BD01F512E6671800899322 /* SDL_x11touch.h in Headers */, - 04BD01F712E6671800899322 /* SDL_x11video.h in Headers */, - 04BD01F912E6671800899322 /* SDL_x11window.h in Headers */, - 041B2CA612FA0D680087D585 /* SDL_sysrender.h in Headers */, - 04409B9112FA97ED00FB9AA8 /* mmx.h in Headers */, - 04409B9312FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */, - 04F7803912FB748500FC43C0 /* SDL_nullframebuffer_c.h in Headers */, - 04F7804A12FB74A200FC43C0 /* SDL_blendfillrect.h in Headers */, - 04F7804C12FB74A200FC43C0 /* SDL_blendline.h in Headers */, - 04F7804E12FB74A200FC43C0 /* SDL_blendpoint.h in Headers */, - 56A67027185654B40007D20F /* SDL_dynapi.h in Headers */, - 04F7804F12FB74A200FC43C0 /* SDL_draw.h in Headers */, - 04F7805112FB74A200FC43C0 /* SDL_drawline.h in Headers */, - 04F7805312FB74A200FC43C0 /* SDL_drawpoint.h in Headers */, - 0442EC1C12FE1BCB004C9285 /* SDL_render_sw_c.h in Headers */, - 0442EC5B12FE1C60004C9285 /* SDL_x11framebuffer.h in Headers */, - 04043BBB12FEB1BE0076DB1F /* SDL_glfuncs.h in Headers */, - 0435673F1303160F00BA5428 /* SDL_shaders_gl.h in Headers */, - 566CDE8F148F0AC200C5A9BB /* SDL_dropevents_c.h in Headers */, - AA628ACC159367B7005138DD /* SDL_rotate.h in Headers */, - AA628AD3159367F2005138DD /* SDL_x11xinput2.h in Headers */, - AABCC38D164063D200AB8930 /* SDL_cocoamessagebox.h in Headers */, - D55A1B81179F262300625D7C /* SDL_cocoamousetap.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BECDF66E0761BA81005FE872 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - DB0F490B17CA57ED008798C5 /* SDL_filesystem.h in Headers */, - AA7557FB1595D4D800BBD41B /* begin_code.h in Headers */, - AA7557FD1595D4D800BBD41B /* close_code.h in Headers */, - AA75585F1595D4D800BBD41B /* SDL.h in Headers */, - AA7557FF1595D4D800BBD41B /* SDL_assert.h in Headers */, - AA7558011595D4D800BBD41B /* SDL_atomic.h in Headers */, - AA7558031595D4D800BBD41B /* SDL_audio.h in Headers */, - AADA5B8816CCAB3000107CF7 /* SDL_bits.h in Headers */, - AA7558051595D4D800BBD41B /* SDL_blendmode.h in Headers */, - AA7558071595D4D800BBD41B /* SDL_clipboard.h in Headers */, - AA75580B1595D4D800BBD41B /* SDL_config.h in Headers */, - AA7558091595D4D800BBD41B /* SDL_config_macosx.h in Headers */, - AA75580D1595D4D800BBD41B /* SDL_copying.h in Headers */, - AA75580F1595D4D800BBD41B /* SDL_cpuinfo.h in Headers */, - AA7558111595D4D800BBD41B /* SDL_endian.h in Headers */, - AA7558131595D4D800BBD41B /* SDL_error.h in Headers */, - AA7558151595D4D800BBD41B /* SDL_events.h in Headers */, - A77E6EB5167AB0A90010E40B /* SDL_gamecontroller.h in Headers */, - AA7558171595D4D800BBD41B /* SDL_gesture.h in Headers */, - AA7558191595D4D800BBD41B /* SDL_haptic.h in Headers */, - AA75581B1595D4D800BBD41B /* SDL_hints.h in Headers */, - AA75581F1595D4D800BBD41B /* SDL_joystick.h in Headers */, - AA7558211595D4D800BBD41B /* SDL_keyboard.h in Headers */, - AA7558231595D4D800BBD41B /* SDL_keycode.h in Headers */, - AA7558251595D4D800BBD41B /* SDL_loadso.h in Headers */, - AA7558271595D4D800BBD41B /* SDL_log.h in Headers */, - AA7558291595D4D800BBD41B /* SDL_main.h in Headers */, - AAC07106195606770073DCDF /* SDL_opengles2_khrplatform.h in Headers */, - DB0F489417C400ED008798C5 /* SDL_messagebox.h in Headers */, - AA75582B1595D4D800BBD41B /* SDL_mouse.h in Headers */, - AA75582D1595D4D800BBD41B /* SDL_mutex.h in Headers */, - AA75582F1595D4D800BBD41B /* SDL_name.h in Headers */, - AA7558311595D4D800BBD41B /* SDL_opengl.h in Headers */, - AA7558331595D4D800BBD41B /* SDL_opengles.h in Headers */, - 56A67028185654B40007D20F /* SDL_dynapi.h in Headers */, - AA7558351595D4D800BBD41B /* SDL_opengles2.h in Headers */, - AA7558371595D4D800BBD41B /* SDL_pixels.h in Headers */, - AA7558391595D4D800BBD41B /* SDL_platform.h in Headers */, - AA75583B1595D4D800BBD41B /* SDL_power.h in Headers */, - AA75583D1595D4D800BBD41B /* SDL_quit.h in Headers */, - AA75583F1595D4D800BBD41B /* SDL_rect.h in Headers */, - AA7558411595D4D800BBD41B /* SDL_render.h in Headers */, - AA7558431595D4D800BBD41B /* SDL_revision.h in Headers */, - AA7558451595D4D800BBD41B /* SDL_rwops.h in Headers */, - AA7558471595D4D800BBD41B /* SDL_scancode.h in Headers */, - AA7558491595D4D800BBD41B /* SDL_shape.h in Headers */, - 56A6702B185654B40007D20F /* SDL_dynapi_overrides.h in Headers */, - AA75584B1595D4D800BBD41B /* SDL_stdinc.h in Headers */, - AA75584D1595D4D800BBD41B /* SDL_surface.h in Headers */, - AA75584F1595D4D800BBD41B /* SDL_system.h in Headers */, - AA7558511595D4D800BBD41B /* SDL_syswm.h in Headers */, - AAC070FA195606770073DCDF /* SDL_opengl_glext.h in Headers */, - AA7558531595D4D800BBD41B /* SDL_thread.h in Headers */, - AA7558551595D4D800BBD41B /* SDL_timer.h in Headers */, - AA7558571595D4D800BBD41B /* SDL_touch.h in Headers */, - AA7558591595D4D800BBD41B /* SDL_types.h in Headers */, - AA75585B1595D4D800BBD41B /* SDL_version.h in Headers */, - AA75585D1595D4D800BBD41B /* SDL_video.h in Headers */, - 04BD022512E6671800899322 /* SDL_diskaudio.h in Headers */, - 56A6700A1856545C0007D20F /* SDL_internal.h in Headers */, - 04BD022D12E6671800899322 /* SDL_dummyaudio.h in Headers */, - 04BD023512E6671800899322 /* SDL_coreaudio.h in Headers */, - 04BD024312E6671800899322 /* SDL_audio_c.h in Headers */, - 04BD024612E6671800899322 /* SDL_audiodev_c.h in Headers */, - AAC070FD195606770073DCDF /* SDL_opengles2_gl2.h in Headers */, - 04BD025012E6671800899322 /* SDL_sysaudio.h in Headers */, - 04BD025212E6671800899322 /* SDL_wave.h in Headers */, - 04BD025D12E6671800899322 /* blank_cursor.h in Headers */, - 04BD025E12E6671800899322 /* default_cursor.h in Headers */, - 04BD025F12E6671800899322 /* scancodes_darwin.h in Headers */, - 04BD026012E6671800899322 /* scancodes_linux.h in Headers */, - 04BD026212E6671800899322 /* scancodes_xfree86.h in Headers */, - 04BD026412E6671800899322 /* SDL_clipboardevents_c.h in Headers */, - 04BD026612E6671800899322 /* SDL_events_c.h in Headers */, - 56A67022185654B40007D20F /* SDL_dynapi_procs.h in Headers */, - 04BD026812E6671800899322 /* SDL_gesture_c.h in Headers */, - 04BD026A12E6671800899322 /* SDL_keyboard_c.h in Headers */, - 04BD026C12E6671800899322 /* SDL_mouse_c.h in Headers */, - 04BD026E12E6671800899322 /* SDL_sysevents.h in Headers */, - 04BD027012E6671800899322 /* SDL_touch_c.h in Headers */, - 04BD027212E6671800899322 /* SDL_windowevents_c.h in Headers */, - 04BD027312E6671800899322 /* SDL_rwopsbundlesupport.h in Headers */, - 04BD027B12E6671800899322 /* SDL_haptic_c.h in Headers */, - 04BD027C12E6671800899322 /* SDL_syshaptic.h in Headers */, - 04BD028212E6671800899322 /* SDL_sysjoystick_c.h in Headers */, - 04BD028C12E6671800899322 /* SDL_joystick_c.h in Headers */, - 04BD028D12E6671800899322 /* SDL_sysjoystick.h in Headers */, - 04BD02B512E6671800899322 /* SDL_assert_c.h in Headers */, - 04BD02B812E6671800899322 /* SDL_error_c.h in Headers */, - 04BD02D912E6671800899322 /* SDL_sysmutex_c.h in Headers */, - 04BD02DC12E6671800899322 /* SDL_systhread_c.h in Headers */, - 04BD02E312E6671800899322 /* SDL_systhread.h in Headers */, - 04BD02E512E6671800899322 /* SDL_thread_c.h in Headers */, - 04BD02F212E6671800899322 /* SDL_timer_c.h in Headers */, - 04BD030D12E6671800899322 /* SDL_cocoaclipboard.h in Headers */, - 04BD030F12E6671800899322 /* SDL_cocoaevents.h in Headers */, - 04BD031112E6671800899322 /* SDL_cocoakeyboard.h in Headers */, - 04BD031312E6671800899322 /* SDL_cocoamodes.h in Headers */, - 04BD031512E6671800899322 /* SDL_cocoamouse.h in Headers */, - 04BD031712E6671800899322 /* SDL_cocoaopengl.h in Headers */, - 04BD031912E6671800899322 /* SDL_cocoashape.h in Headers */, - AAC07103195606770073DCDF /* SDL_opengles2_gl2platform.h in Headers */, - 04BD031B12E6671800899322 /* SDL_cocoavideo.h in Headers */, - 04BD031D12E6671800899322 /* SDL_cocoawindow.h in Headers */, - 04BD033212E6671800899322 /* SDL_nullevents_c.h in Headers */, - 04BD033612E6671800899322 /* SDL_nullvideo.h in Headers */, - 04BD039012E6671800899322 /* SDL_blit.h in Headers */, - 04BD039512E6671800899322 /* SDL_blit_auto.h in Headers */, - 04BD039712E6671800899322 /* SDL_blit_copy.h in Headers */, - 04BD039A12E6671800899322 /* SDL_blit_slow.h in Headers */, - 04BD03A712E6671800899322 /* SDL_pixels_c.h in Headers */, - 04BD03B112E6671800899322 /* SDL_RLEaccel_c.h in Headers */, - 04BD03B312E6671800899322 /* SDL_shape_internals.h in Headers */, - 04BD03B612E6671800899322 /* SDL_sysvideo.h in Headers */, - 04BD03F412E6671800899322 /* imKStoUCS.h in Headers */, - 04BD03F612E6671800899322 /* SDL_x11clipboard.h in Headers */, - 04BD03F812E6671800899322 /* SDL_x11dyn.h in Headers */, - 04BD03FA12E6671800899322 /* SDL_x11events.h in Headers */, - 04BD03FE12E6671800899322 /* SDL_x11keyboard.h in Headers */, - 04BD040012E6671800899322 /* SDL_x11modes.h in Headers */, - 04BD040212E6671800899322 /* SDL_x11mouse.h in Headers */, - 04BD040412E6671800899322 /* SDL_x11opengl.h in Headers */, - 04BD040612E6671800899322 /* SDL_x11opengles.h in Headers */, - 04BD040A12E6671800899322 /* SDL_x11shape.h in Headers */, - 04BD040B12E6671800899322 /* SDL_x11sym.h in Headers */, - 04BD040D12E6671800899322 /* SDL_x11touch.h in Headers */, - 04BD040F12E6671800899322 /* SDL_x11video.h in Headers */, - AAC07100195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */, - 04BD041112E6671800899322 /* SDL_x11window.h in Headers */, - 041B2CAC12FA0D680087D585 /* SDL_sysrender.h in Headers */, - 04409B9512FA97ED00FB9AA8 /* mmx.h in Headers */, - 04409B9712FA97ED00FB9AA8 /* SDL_yuv_sw_c.h in Headers */, - 04F7803B12FB748500FC43C0 /* SDL_nullframebuffer_c.h in Headers */, - 04F7805612FB74A200FC43C0 /* SDL_blendfillrect.h in Headers */, - 04F7805812FB74A200FC43C0 /* SDL_blendline.h in Headers */, - 04F7805A12FB74A200FC43C0 /* SDL_blendpoint.h in Headers */, - 04F7805B12FB74A200FC43C0 /* SDL_draw.h in Headers */, - 04F7805D12FB74A200FC43C0 /* SDL_drawline.h in Headers */, - 04F7805F12FB74A200FC43C0 /* SDL_drawpoint.h in Headers */, - 0442EC1E12FE1BCB004C9285 /* SDL_render_sw_c.h in Headers */, - 0442EC5D12FE1C60004C9285 /* SDL_x11framebuffer.h in Headers */, - 04043BBC12FEB1BE0076DB1F /* SDL_glfuncs.h in Headers */, - 043567411303160F00BA5428 /* SDL_shaders_gl.h in Headers */, - AA628ACD159367B7005138DD /* SDL_rotate.h in Headers */, - AA628AD4159367F2005138DD /* SDL_x11xinput2.h in Headers */, - AABCC38E164063D200AB8930 /* SDL_cocoamessagebox.h in Headers */, - D55A1B85179F278E00625D7C /* SDL_cocoamousetap.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB313F7317554B71006C0E22 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - DB0F490C17CA57ED008798C5 /* SDL_filesystem.h in Headers */, - DB313FC817554B71006C0E22 /* begin_code.h in Headers */, - DB313FC917554B71006C0E22 /* close_code.h in Headers */, - DB313FF917554B71006C0E22 /* SDL.h in Headers */, - DB313FCA17554B71006C0E22 /* SDL_assert.h in Headers */, - DB313FCB17554B71006C0E22 /* SDL_atomic.h in Headers */, - DB313FCC17554B71006C0E22 /* SDL_audio.h in Headers */, - DB313FFC17554B71006C0E22 /* SDL_bits.h in Headers */, - DB313FCD17554B71006C0E22 /* SDL_blendmode.h in Headers */, - DB313FCE17554B71006C0E22 /* SDL_clipboard.h in Headers */, - DB313FD017554B71006C0E22 /* SDL_config.h in Headers */, - DB313FCF17554B71006C0E22 /* SDL_config_macosx.h in Headers */, - DB313FD117554B71006C0E22 /* SDL_copying.h in Headers */, - DB313FD217554B71006C0E22 /* SDL_cpuinfo.h in Headers */, - DB313FD317554B71006C0E22 /* SDL_endian.h in Headers */, - DB313FD417554B71006C0E22 /* SDL_error.h in Headers */, - DB313FD517554B71006C0E22 /* SDL_events.h in Headers */, - DB313FFB17554B71006C0E22 /* SDL_gamecontroller.h in Headers */, - DB313FD617554B71006C0E22 /* SDL_gesture.h in Headers */, - DB313FD717554B71006C0E22 /* SDL_haptic.h in Headers */, - DB313FD817554B71006C0E22 /* SDL_hints.h in Headers */, - DB313FD917554B71006C0E22 /* SDL_joystick.h in Headers */, - DB313FDA17554B71006C0E22 /* SDL_keyboard.h in Headers */, - DB313FDB17554B71006C0E22 /* SDL_keycode.h in Headers */, - DB313FDC17554B71006C0E22 /* SDL_loadso.h in Headers */, - DB313FDD17554B71006C0E22 /* SDL_log.h in Headers */, - DB313FDE17554B71006C0E22 /* SDL_main.h in Headers */, - AAC07107195606770073DCDF /* SDL_opengles2_khrplatform.h in Headers */, - DB0F489317C400E6008798C5 /* SDL_messagebox.h in Headers */, - DB313FDF17554B71006C0E22 /* SDL_mouse.h in Headers */, - DB313FE017554B71006C0E22 /* SDL_mutex.h in Headers */, - DB313FE117554B71006C0E22 /* SDL_name.h in Headers */, - DB313FE217554B71006C0E22 /* SDL_opengl.h in Headers */, - DB313FE317554B71006C0E22 /* SDL_opengles.h in Headers */, - 56A67029185654B40007D20F /* SDL_dynapi.h in Headers */, - DB313FE417554B71006C0E22 /* SDL_opengles2.h in Headers */, - DB313FE517554B71006C0E22 /* SDL_pixels.h in Headers */, - DB313FE617554B71006C0E22 /* SDL_platform.h in Headers */, - DB313FE717554B71006C0E22 /* SDL_power.h in Headers */, - DB313FE817554B71006C0E22 /* SDL_quit.h in Headers */, - DB313FE917554B71006C0E22 /* SDL_rect.h in Headers */, - DB313FEA17554B71006C0E22 /* SDL_render.h in Headers */, - DB313FEB17554B71006C0E22 /* SDL_revision.h in Headers */, - DB313FEC17554B71006C0E22 /* SDL_rwops.h in Headers */, - DB313FED17554B71006C0E22 /* SDL_scancode.h in Headers */, - DB313FEE17554B71006C0E22 /* SDL_shape.h in Headers */, - 56A6702C185654B40007D20F /* SDL_dynapi_overrides.h in Headers */, - DB313FEF17554B71006C0E22 /* SDL_stdinc.h in Headers */, - DB313FF017554B71006C0E22 /* SDL_surface.h in Headers */, - DB313FF117554B71006C0E22 /* SDL_system.h in Headers */, - DB313FF217554B71006C0E22 /* SDL_syswm.h in Headers */, - AAC070FB195606770073DCDF /* SDL_opengl_glext.h in Headers */, - DB313FF317554B71006C0E22 /* SDL_thread.h in Headers */, - DB313FF417554B71006C0E22 /* SDL_timer.h in Headers */, - DB313FF517554B71006C0E22 /* SDL_touch.h in Headers */, - DB313FF617554B71006C0E22 /* SDL_types.h in Headers */, - DB313FF717554B71006C0E22 /* SDL_version.h in Headers */, - DB313FF817554B71006C0E22 /* SDL_video.h in Headers */, - DB313F7417554B71006C0E22 /* SDL_diskaudio.h in Headers */, - 56A6700B1856545C0007D20F /* SDL_internal.h in Headers */, - DB313F7517554B71006C0E22 /* SDL_dummyaudio.h in Headers */, - DB313F7617554B71006C0E22 /* SDL_coreaudio.h in Headers */, - DB313F7717554B71006C0E22 /* SDL_audio_c.h in Headers */, - DB313F7817554B71006C0E22 /* SDL_audiodev_c.h in Headers */, - AAC070FE195606770073DCDF /* SDL_opengles2_gl2.h in Headers */, - DB313F7A17554B71006C0E22 /* SDL_sysaudio.h in Headers */, - DB313F7B17554B71006C0E22 /* SDL_wave.h in Headers */, - DB313F7C17554B71006C0E22 /* blank_cursor.h in Headers */, - DB313F7D17554B71006C0E22 /* default_cursor.h in Headers */, - DB313F7E17554B71006C0E22 /* scancodes_darwin.h in Headers */, - DB313F7F17554B71006C0E22 /* scancodes_linux.h in Headers */, - DB313F8017554B71006C0E22 /* scancodes_xfree86.h in Headers */, - DB313F8117554B71006C0E22 /* SDL_clipboardevents_c.h in Headers */, - DB313F8217554B71006C0E22 /* SDL_events_c.h in Headers */, - 56A67023185654B40007D20F /* SDL_dynapi_procs.h in Headers */, - DB313F8317554B71006C0E22 /* SDL_gesture_c.h in Headers */, - DB313F8417554B71006C0E22 /* SDL_keyboard_c.h in Headers */, - DB313F8517554B71006C0E22 /* SDL_mouse_c.h in Headers */, - DB313F8617554B71006C0E22 /* SDL_sysevents.h in Headers */, - DB313F8717554B71006C0E22 /* SDL_touch_c.h in Headers */, - DB313F8817554B71006C0E22 /* SDL_windowevents_c.h in Headers */, - DB313F8917554B71006C0E22 /* SDL_rwopsbundlesupport.h in Headers */, - DB313F8A17554B71006C0E22 /* SDL_haptic_c.h in Headers */, - DB313F8B17554B71006C0E22 /* SDL_syshaptic.h in Headers */, - DB313F8C17554B71006C0E22 /* SDL_sysjoystick_c.h in Headers */, - DB313F8D17554B71006C0E22 /* SDL_joystick_c.h in Headers */, - DB313F8E17554B71006C0E22 /* SDL_sysjoystick.h in Headers */, - DB313F8F17554B71006C0E22 /* SDL_assert_c.h in Headers */, - DB313F9017554B71006C0E22 /* SDL_error_c.h in Headers */, - DB313F9217554B71006C0E22 /* SDL_sysmutex_c.h in Headers */, - DB313F9317554B71006C0E22 /* SDL_systhread_c.h in Headers */, - DB313F9417554B71006C0E22 /* SDL_systhread.h in Headers */, - DB313F9517554B71006C0E22 /* SDL_thread_c.h in Headers */, - DB313F9617554B71006C0E22 /* SDL_timer_c.h in Headers */, - DB313F9717554B71006C0E22 /* SDL_cocoaclipboard.h in Headers */, - DB313F9817554B71006C0E22 /* SDL_cocoaevents.h in Headers */, - DB313F9917554B71006C0E22 /* SDL_cocoakeyboard.h in Headers */, - DB313F9A17554B71006C0E22 /* SDL_cocoamodes.h in Headers */, - DB313F9B17554B71006C0E22 /* SDL_cocoamouse.h in Headers */, - DB313F9C17554B71006C0E22 /* SDL_cocoaopengl.h in Headers */, - DB313F9D17554B71006C0E22 /* SDL_cocoashape.h in Headers */, - AAC07104195606770073DCDF /* SDL_opengles2_gl2platform.h in Headers */, - DB313F9E17554B71006C0E22 /* SDL_cocoavideo.h in Headers */, - DB313F9F17554B71006C0E22 /* SDL_cocoawindow.h in Headers */, - DB313FA017554B71006C0E22 /* SDL_nullevents_c.h in Headers */, - DB313FA117554B71006C0E22 /* SDL_nullvideo.h in Headers */, - DB313FA217554B71006C0E22 /* SDL_blit.h in Headers */, - DB313FA317554B71006C0E22 /* SDL_blit_auto.h in Headers */, - DB313FA417554B71006C0E22 /* SDL_blit_copy.h in Headers */, - DB313FA517554B71006C0E22 /* SDL_blit_slow.h in Headers */, - DB313FA617554B71006C0E22 /* SDL_pixels_c.h in Headers */, - DB313FA717554B71006C0E22 /* SDL_RLEaccel_c.h in Headers */, - DB313FA817554B71006C0E22 /* SDL_shape_internals.h in Headers */, - DB313FA917554B71006C0E22 /* SDL_sysvideo.h in Headers */, - DB313FAA17554B71006C0E22 /* imKStoUCS.h in Headers */, - DB313FAB17554B71006C0E22 /* SDL_x11clipboard.h in Headers */, - DB313FAC17554B71006C0E22 /* SDL_x11dyn.h in Headers */, - DB313FAD17554B71006C0E22 /* SDL_x11events.h in Headers */, - DB313FAE17554B71006C0E22 /* SDL_x11keyboard.h in Headers */, - DB313FAF17554B71006C0E22 /* SDL_x11modes.h in Headers */, - DB313FB017554B71006C0E22 /* SDL_x11mouse.h in Headers */, - DB313FB117554B71006C0E22 /* SDL_x11opengl.h in Headers */, - DB313FB217554B71006C0E22 /* SDL_x11opengles.h in Headers */, - DB313FB317554B71006C0E22 /* SDL_x11shape.h in Headers */, - DB313FB417554B71006C0E22 /* SDL_x11sym.h in Headers */, - DB313FB517554B71006C0E22 /* SDL_x11touch.h in Headers */, - DB313FB617554B71006C0E22 /* SDL_x11video.h in Headers */, - AAC07101195606770073DCDF /* SDL_opengles2_gl2ext.h in Headers */, - DB313FB717554B71006C0E22 /* SDL_x11window.h in Headers */, - DB313FB817554B71006C0E22 /* SDL_sysrender.h in Headers */, - DB313FB917554B71006C0E22 /* mmx.h in Headers */, - DB313FBA17554B71006C0E22 /* SDL_yuv_sw_c.h in Headers */, - DB313FBB17554B71006C0E22 /* SDL_nullframebuffer_c.h in Headers */, - DB313FBC17554B71006C0E22 /* SDL_blendfillrect.h in Headers */, - DB313FBD17554B71006C0E22 /* SDL_blendline.h in Headers */, - DB313FBE17554B71006C0E22 /* SDL_blendpoint.h in Headers */, - DB313FBF17554B71006C0E22 /* SDL_draw.h in Headers */, - DB313FC017554B71006C0E22 /* SDL_drawline.h in Headers */, - DB313FC117554B71006C0E22 /* SDL_drawpoint.h in Headers */, - DB313FC217554B71006C0E22 /* SDL_render_sw_c.h in Headers */, - DB313FC317554B71006C0E22 /* SDL_x11framebuffer.h in Headers */, - DB313FC417554B71006C0E22 /* SDL_glfuncs.h in Headers */, - DB313FC517554B71006C0E22 /* SDL_shaders_gl.h in Headers */, - DB313FC617554B71006C0E22 /* SDL_rotate.h in Headers */, - DB313FC717554B71006C0E22 /* SDL_x11xinput2.h in Headers */, - DB313FFA17554B71006C0E22 /* SDL_cocoamessagebox.h in Headers */, - D55A1B86179F278F00625D7C /* SDL_cocoamousetap.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - BECDF5FE0761BA81005FE872 /* Framework */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0073177A0858DB0500B2BC32 /* Build configuration list for PBXNativeTarget "Framework" */; - buildPhases = ( - BECDF5FF0761BA81005FE872 /* Headers */, - BECDF62A0761BA81005FE872 /* Resources */, - BECDF62C0761BA81005FE872 /* Sources */, - BECDF6680761BA81005FE872 /* Frameworks */, - ); - buildRules = ( - ); - comments = "We recommend installing to /Library/Frameworks\nAn alternative is $(HOME)/Library/Frameworks for per-user if permissions are an issue.\n\nAdd the framework to the Groups & Files panel (under Linked Frameworks is a good place) and enable the check box for the targets that need to link to it. You can also manually add \"-framework SDL\" to your linker flags if you don't like the check box system.\n\nAdd /Library/Frameworks/SDL.framework/Headers to your header search path\nAdd /Library/Frameworks to your library search path\n(Adjust the two above if installed in $(HOME)/Library/Frameworks. You can also list both paths if you want robustness.)\n\nWe used to use an exports file. It was becoming a maintenance issue we kept neglecting, so we have removed it. If you need it back, set the \"Exported Symbols File\" option to:\n../../src/main/macosx/exports/SDL.x\n(You may need to regenerate the exports list. There is a Makefile in that directory that you can run from the command line to rebuild it.)\nLong term, we want to utilize gcc 4.0's new visibility feature (analogous to declspec on Windows). Other platforms would benefit from this change too. The downside is that we still use gcc 3.3 for the PowerPC build here so only our x86 builds will cull the symbols if we go down this route (and don't use the exports file).\n\n"; - dependencies = ( - ); - name = Framework; - productInstallPath = "@executable_path/../Frameworks"; - productName = SDL; - productReference = BECDF66C0761BA81005FE872 /* SDL2.framework */; - productType = "com.apple.product-type.framework"; - }; - BECDF66D0761BA81005FE872 /* Static Library */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0073177E0858DB0500B2BC32 /* Build configuration list for PBXNativeTarget "Static Library" */; - buildPhases = ( - BECDF66E0761BA81005FE872 /* Headers */, - BECDF6790761BA81005FE872 /* Sources */, - BECDF6B10761BA81005FE872 /* Frameworks */, - BECDF6B20761BA81005FE872 /* Rez */, - ); - buildRules = ( - ); - comments = "This produces libsdl.a, which is the static build of SDL. You will have to link to the Cocoa and OpenGL frameworks in your application."; - dependencies = ( - ); - name = "Static Library"; - productInstallPath = /usr/local/lib; - productName = "Static Library"; - productReference = BECDF6B30761BA81005FE872 /* libSDL2.a */; - productType = "com.apple.product-type.library.static"; - }; - BECDF6BB0761BA81005FE872 /* Standard DMG */ = { - isa = PBXNativeTarget; - buildConfigurationList = 007317860858DB0500B2BC32 /* Build configuration list for PBXNativeTarget "Standard DMG" */; - buildPhases = ( - BECDF6BD0761BA81005FE872 /* ShellScript */, - ); - buildRules = ( - ); - dependencies = ( - BECDF6C60761BA81005FE872 /* PBXTargetDependency */, - ); - name = "Standard DMG"; - productInstallPath = /usr/local/bin; - productName = "Standard Package"; - productReference = BECDF6BE0761BA81005FE872 /* Standard DMG */; - productType = "com.apple.product-type.tool"; - }; - DB313F7217554B71006C0E22 /* Shared Library */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB31407417554B71006C0E22 /* Build configuration list for PBXNativeTarget "Shared Library" */; - buildPhases = ( - DB313F7317554B71006C0E22 /* Headers */, - DB313FFD17554B71006C0E22 /* Sources */, - DB31406B17554B71006C0E22 /* Frameworks */, - DB31407317554B71006C0E22 /* Rez */, - ); - buildRules = ( - ); - comments = "This produces libSDL2.dylib, which is the shared build of SDL."; - dependencies = ( - ); - name = "Shared Library"; - productInstallPath = /usr/local/lib; - productName = "Shared Library"; - productReference = DB31407717554B71006C0E22 /* libSDL2.dylib */; - productType = "com.apple.product-type.library.dynamic"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 0867D690FE84028FC02AAC07 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0730; - TargetAttributes = { - BECDF5FE0761BA81005FE872 = { - DevelopmentTeam = EH385AYQ6F; - }; - BECDF6BB0761BA81005FE872 = { - DevelopmentTeam = EH385AYQ6F; - }; - }; - }; - buildConfigurationList = 0073178E0858DB0500B2BC32 /* Build configuration list for PBXProject "SDL" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 0867D691FE84028FC02AAC07 /* SDLFramework */; - productRefGroup = 034768DDFF38A45A11DB9C8B /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - BECDF5FE0761BA81005FE872 /* Framework */, - BECDF66D0761BA81005FE872 /* Static Library */, - DB313F7217554B71006C0E22 /* Shared Library */, - BECDF6BB0761BA81005FE872 /* Standard DMG */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - BECDF62A0761BA81005FE872 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXRezBuildPhase section */ - BECDF6B20761BA81005FE872 /* Rez */ = { - isa = PBXRezBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB31407317554B71006C0E22 /* Rez */ = { - isa = PBXRezBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXRezBuildPhase section */ - -/* Begin PBXShellScriptBuildPhase section */ - BECDF6BD0761BA81005FE872 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 12; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "# Sign framework\nif [ \"$SDL_CODESIGN_IDENTITY\" != \"\" ]; then\n codesign --force --deep --sign \"$SDL_CODESIGN_IDENTITY\" $TARGET_BUILD_DIR/SDL2.framework/Versions/A\nfi\n\n# clean up the framework, remove headers, extra files\nmkdir -p build/dmg-tmp\nxcrun CpMac -r $TARGET_BUILD_DIR/SDL2.framework build/dmg-tmp/\n\ncp pkg-support/resources/License.txt build/dmg-tmp\ncp pkg-support/resources/ReadMe.txt build/dmg-tmp\n\n# remove the .DS_Store files if any (we may want to provide one in the future for fancy .dmgs)\nfind build/dmg-tmp -name .DS_Store -exec rm -f \"{}\" \\;\n\n# for fancy .dmg\nmkdir -p build/dmg-tmp/.logo\ncp pkg-support/resources/SDL_DS_Store build/dmg-tmp/.DS_Store\ncp pkg-support/sdl_logo.pdf build/dmg-tmp/.logo\n\n# create the dmg\nhdiutil create -ov -fs HFS+ -volname SDL2 -srcfolder build/dmg-tmp build/SDL2.dmg\n\n# clean up\nrm -rf build/dmg-tmp"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - BECDF62C0761BA81005FE872 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 04BDFFFB12E6671800899322 /* SDL_atomic.c in Sources */, - 04BDFFFC12E6671800899322 /* SDL_spinlock.c in Sources */, - 04BD000812E6671800899322 /* SDL_diskaudio.c in Sources */, - 04BD001012E6671800899322 /* SDL_dummyaudio.c in Sources */, - 04BD002612E6671800899322 /* SDL_audio.c in Sources */, - 04BD002812E6671800899322 /* SDL_audiocvt.c in Sources */, - 04BD002912E6671800899322 /* SDL_audiodev.c in Sources */, - 04BD002C12E6671800899322 /* SDL_audiotypecvt.c in Sources */, - 04BD002D12E6671800899322 /* SDL_mixer.c in Sources */, - 04BD003512E6671800899322 /* SDL_wave.c in Sources */, - 04BD004112E6671800899322 /* SDL_cpuinfo.c in Sources */, - 04BD004812E6671800899322 /* SDL_clipboardevents.c in Sources */, - 04BD004A12E6671800899322 /* SDL_events.c in Sources */, - 04BD004C12E6671800899322 /* SDL_gesture.c in Sources */, - 04BD004E12E6671800899322 /* SDL_keyboard.c in Sources */, - 04BD005012E6671800899322 /* SDL_mouse.c in Sources */, - 04BD005212E6671800899322 /* SDL_quit.c in Sources */, - 04BD005412E6671800899322 /* SDL_touch.c in Sources */, - 04BD005612E6671800899322 /* SDL_windowevents.c in Sources */, - 04BD005912E6671800899322 /* SDL_rwopsbundlesupport.m in Sources */, - 04BD005A12E6671800899322 /* SDL_rwops.c in Sources */, - 04BD005B12E6671800899322 /* SDL_syshaptic.c in Sources */, - 04BD005F12E6671800899322 /* SDL_haptic.c in Sources */, - 04BD006612E6671800899322 /* SDL_sysjoystick.c in Sources */, - 04BD007012E6671800899322 /* SDL_joystick.c in Sources */, - 04BD008812E6671800899322 /* SDL_sysloadso.c in Sources */, - 04BD009412E6671800899322 /* SDL_syspower.c in Sources */, - 04BD009612E6671800899322 /* SDL_power.c in Sources */, - 04BD009C12E6671800899322 /* SDL_assert.c in Sources */, - 04BD009F12E6671800899322 /* SDL_error.c in Sources */, - 04BD00A212E6671800899322 /* SDL.c in Sources */, - 04BD00A312E6671800899322 /* SDL_getenv.c in Sources */, - 04BD00A412E6671800899322 /* SDL_iconv.c in Sources */, - 04BD00A512E6671800899322 /* SDL_malloc.c in Sources */, - 04BD00A612E6671800899322 /* SDL_qsort.c in Sources */, - 04BD00A712E6671800899322 /* SDL_stdlib.c in Sources */, - 04BD00A812E6671800899322 /* SDL_string.c in Sources */, - 04BD00BD12E6671800899322 /* SDL_syscond.c in Sources */, - 04BD00BE12E6671800899322 /* SDL_sysmutex.c in Sources */, - FABA34C71D8B5DB100915323 /* SDL_coreaudio.m in Sources */, - 04BD00C012E6671800899322 /* SDL_syssem.c in Sources */, - 04BD00C112E6671800899322 /* SDL_systhread.c in Sources */, - 04BD00CA12E6671800899322 /* SDL_thread.c in Sources */, - 04BD00D712E6671800899322 /* SDL_timer.c in Sources */, - 04BD00D912E6671800899322 /* SDL_systimer.c in Sources */, - 04BD00F412E6671800899322 /* SDL_cocoaclipboard.m in Sources */, - 04BD00F612E6671800899322 /* SDL_cocoaevents.m in Sources */, - 04BD00F812E6671800899322 /* SDL_cocoakeyboard.m in Sources */, - 04BD00FA12E6671800899322 /* SDL_cocoamodes.m in Sources */, - 04BD00FC12E6671800899322 /* SDL_cocoamouse.m in Sources */, - 04BD00FE12E6671800899322 /* SDL_cocoaopengl.m in Sources */, - 04BD010012E6671800899322 /* SDL_cocoashape.m in Sources */, - 04BD010212E6671800899322 /* SDL_cocoavideo.m in Sources */, - 04BD010412E6671800899322 /* SDL_cocoawindow.m in Sources */, - 04BD011712E6671800899322 /* SDL_nullevents.c in Sources */, - 04BD011B12E6671800899322 /* SDL_nullvideo.c in Sources */, - 04BD017512E6671800899322 /* SDL_blit.c in Sources */, - 04BD017712E6671800899322 /* SDL_blit_0.c in Sources */, - 04BD017812E6671800899322 /* SDL_blit_1.c in Sources */, - 04BD017912E6671800899322 /* SDL_blit_A.c in Sources */, - 04BD017A12E6671800899322 /* SDL_blit_auto.c in Sources */, - 04BD017C12E6671800899322 /* SDL_blit_copy.c in Sources */, - 04BD017E12E6671800899322 /* SDL_blit_N.c in Sources */, - 04BD017F12E6671800899322 /* SDL_blit_slow.c in Sources */, - 04BD018112E6671800899322 /* SDL_bmp.c in Sources */, - 04BD018212E6671800899322 /* SDL_clipboard.c in Sources */, - 04BD018712E6671800899322 /* SDL_fillrect.c in Sources */, - 04BD018C12E6671800899322 /* SDL_pixels.c in Sources */, - 04BD018E12E6671800899322 /* SDL_rect.c in Sources */, - 04BD019612E6671800899322 /* SDL_RLEaccel.c in Sources */, - 04BD019812E6671800899322 /* SDL_shape.c in Sources */, - 04BD019A12E6671800899322 /* SDL_stretch.c in Sources */, - 04BD019B12E6671800899322 /* SDL_surface.c in Sources */, - 04BD019D12E6671800899322 /* SDL_video.c in Sources */, - 04BD01DB12E6671800899322 /* imKStoUCS.c in Sources */, - 04BD01DD12E6671800899322 /* SDL_x11clipboard.c in Sources */, - 04BD01DF12E6671800899322 /* SDL_x11dyn.c in Sources */, - 04BD01E112E6671800899322 /* SDL_x11events.c in Sources */, - 04BD01E512E6671800899322 /* SDL_x11keyboard.c in Sources */, - 04BD01E712E6671800899322 /* SDL_x11modes.c in Sources */, - 04BD01E912E6671800899322 /* SDL_x11mouse.c in Sources */, - 04BD01EB12E6671800899322 /* SDL_x11opengl.c in Sources */, - 04BD01ED12E6671800899322 /* SDL_x11opengles.c in Sources */, - 04BD01F112E6671800899322 /* SDL_x11shape.c in Sources */, - 04BD01F412E6671800899322 /* SDL_x11touch.c in Sources */, - 04BD01F612E6671800899322 /* SDL_x11video.c in Sources */, - 04BD01F812E6671800899322 /* SDL_x11window.c in Sources */, - 041B2CA512FA0D680087D585 /* SDL_render.c in Sources */, - 04409B9212FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */, - 04409B9412FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */, - 04F7803A12FB748500FC43C0 /* SDL_nullframebuffer.c in Sources */, - 04F7804912FB74A200FC43C0 /* SDL_blendfillrect.c in Sources */, - 04F7804B12FB74A200FC43C0 /* SDL_blendline.c in Sources */, - 04F7804D12FB74A200FC43C0 /* SDL_blendpoint.c in Sources */, - 04F7805012FB74A200FC43C0 /* SDL_drawline.c in Sources */, - 04F7805212FB74A200FC43C0 /* SDL_drawpoint.c in Sources */, - 0442EC1812FE1BBA004C9285 /* SDL_render_gl.c in Sources */, - 0442EC1D12FE1BCB004C9285 /* SDL_render_sw.c in Sources */, - 0442EC5A12FE1C60004C9285 /* SDL_x11framebuffer.c in Sources */, - 0442EC5F12FE1C75004C9285 /* SDL_hints.c in Sources */, - 56A67024185654B40007D20F /* SDL_dynapi.c in Sources */, - 04BAC0C81300C2160055DE28 /* SDL_log.c in Sources */, - 0435673E1303160F00BA5428 /* SDL_shaders_gl.c in Sources */, - 566CDE90148F0AC200C5A9BB /* SDL_dropevents.c in Sources */, - AA628ACA159367B7005138DD /* SDL_rotate.c in Sources */, - AA628AD1159367F2005138DD /* SDL_x11xinput2.c in Sources */, - AA9E4093163BE51E007A2AD0 /* SDL_x11messagebox.c in Sources */, - AABCC38F164063D200AB8930 /* SDL_cocoamessagebox.m in Sources */, - AA0AD09D16648D1700CE5896 /* SDL_gamecontroller.c in Sources */, - AA0F8491178D5ECC00823F9D /* SDL_systls.c in Sources */, - D55A1B82179F262300625D7C /* SDL_cocoamousetap.m in Sources */, - 567E2F1C17C44BB2005F1892 /* SDL_sysfilesystem.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BECDF6790761BA81005FE872 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 04BD021712E6671800899322 /* SDL_atomic.c in Sources */, - 04BD021812E6671800899322 /* SDL_spinlock.c in Sources */, - 04BD022412E6671800899322 /* SDL_diskaudio.c in Sources */, - 04BD022C12E6671800899322 /* SDL_dummyaudio.c in Sources */, - 04BD024212E6671800899322 /* SDL_audio.c in Sources */, - 04BD024412E6671800899322 /* SDL_audiocvt.c in Sources */, - 04BD024512E6671800899322 /* SDL_audiodev.c in Sources */, - 04BD024812E6671800899322 /* SDL_audiotypecvt.c in Sources */, - 04BD024912E6671800899322 /* SDL_mixer.c in Sources */, - 04BD025112E6671800899322 /* SDL_wave.c in Sources */, - 04BD025C12E6671800899322 /* SDL_cpuinfo.c in Sources */, - 04BD026312E6671800899322 /* SDL_clipboardevents.c in Sources */, - 04BD026512E6671800899322 /* SDL_events.c in Sources */, - AA41F88014B8F1F500993C4F /* SDL_dropevents.c in Sources */, - 04BD026712E6671800899322 /* SDL_gesture.c in Sources */, - 04BD026912E6671800899322 /* SDL_keyboard.c in Sources */, - 04BD026B12E6671800899322 /* SDL_mouse.c in Sources */, - 04BD026D12E6671800899322 /* SDL_quit.c in Sources */, - 04BD026F12E6671800899322 /* SDL_touch.c in Sources */, - 04BD027112E6671800899322 /* SDL_windowevents.c in Sources */, - 04BD027412E6671800899322 /* SDL_rwopsbundlesupport.m in Sources */, - 04BD027512E6671800899322 /* SDL_rwops.c in Sources */, - 04BD027612E6671800899322 /* SDL_syshaptic.c in Sources */, - 04BD027A12E6671800899322 /* SDL_haptic.c in Sources */, - 04BD028112E6671800899322 /* SDL_sysjoystick.c in Sources */, - BBFC088D164C6647003E6A99 /* SDL_gamecontroller.c in Sources */, - 04BD028B12E6671800899322 /* SDL_joystick.c in Sources */, - 04BD02A312E6671800899322 /* SDL_sysloadso.c in Sources */, - 04BD02AE12E6671800899322 /* SDL_syspower.c in Sources */, - 04BD02B012E6671800899322 /* SDL_power.c in Sources */, - 04BD02B612E6671800899322 /* SDL_assert.c in Sources */, - 04BD02B912E6671800899322 /* SDL_error.c in Sources */, - 04BD02BC12E6671800899322 /* SDL.c in Sources */, - 04BD02BD12E6671800899322 /* SDL_getenv.c in Sources */, - 04BD02BE12E6671800899322 /* SDL_iconv.c in Sources */, - 04BD02BF12E6671800899322 /* SDL_malloc.c in Sources */, - 04BD02C012E6671800899322 /* SDL_qsort.c in Sources */, - 04BD02C112E6671800899322 /* SDL_stdlib.c in Sources */, - 04BD02C212E6671800899322 /* SDL_string.c in Sources */, - 562D3C7C1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */, - 04BD02D712E6671800899322 /* SDL_syscond.c in Sources */, - 04BD02D812E6671800899322 /* SDL_sysmutex.c in Sources */, - 04BD02DA12E6671800899322 /* SDL_syssem.c in Sources */, - 04BD02DB12E6671800899322 /* SDL_systhread.c in Sources */, - 04BD02E412E6671800899322 /* SDL_thread.c in Sources */, - 04BD02F112E6671800899322 /* SDL_timer.c in Sources */, - 04BD02F312E6671800899322 /* SDL_systimer.c in Sources */, - 04BD030E12E6671800899322 /* SDL_cocoaclipboard.m in Sources */, - 04BD031012E6671800899322 /* SDL_cocoaevents.m in Sources */, - 04BD031212E6671800899322 /* SDL_cocoakeyboard.m in Sources */, - 04BD031412E6671800899322 /* SDL_cocoamodes.m in Sources */, - 04BD031612E6671800899322 /* SDL_cocoamouse.m in Sources */, - 04BD031812E6671800899322 /* SDL_cocoaopengl.m in Sources */, - 04BD031A12E6671800899322 /* SDL_cocoashape.m in Sources */, - 04BD031C12E6671800899322 /* SDL_cocoavideo.m in Sources */, - 04BD031E12E6671800899322 /* SDL_cocoawindow.m in Sources */, - 04BD033112E6671800899322 /* SDL_nullevents.c in Sources */, - 04BD033512E6671800899322 /* SDL_nullvideo.c in Sources */, - 04BD038F12E6671800899322 /* SDL_blit.c in Sources */, - 04BD039112E6671800899322 /* SDL_blit_0.c in Sources */, - 04BD039212E6671800899322 /* SDL_blit_1.c in Sources */, - 04BD039312E6671800899322 /* SDL_blit_A.c in Sources */, - 04BD039412E6671800899322 /* SDL_blit_auto.c in Sources */, - 04BD039612E6671800899322 /* SDL_blit_copy.c in Sources */, - 04BD039812E6671800899322 /* SDL_blit_N.c in Sources */, - 04BD039912E6671800899322 /* SDL_blit_slow.c in Sources */, - 04BD039B12E6671800899322 /* SDL_bmp.c in Sources */, - 04BD039C12E6671800899322 /* SDL_clipboard.c in Sources */, - 04BD03A112E6671800899322 /* SDL_fillrect.c in Sources */, - 04BD03A612E6671800899322 /* SDL_pixels.c in Sources */, - 04BD03A812E6671800899322 /* SDL_rect.c in Sources */, - 04BD03B012E6671800899322 /* SDL_RLEaccel.c in Sources */, - 04BD03B212E6671800899322 /* SDL_shape.c in Sources */, - 04BD03B412E6671800899322 /* SDL_stretch.c in Sources */, - 04BD03B512E6671800899322 /* SDL_surface.c in Sources */, - 04BD03B712E6671800899322 /* SDL_video.c in Sources */, - 04BD03F312E6671800899322 /* imKStoUCS.c in Sources */, - 04BD03F512E6671800899322 /* SDL_x11clipboard.c in Sources */, - 04BD03F712E6671800899322 /* SDL_x11dyn.c in Sources */, - 04BD03F912E6671800899322 /* SDL_x11events.c in Sources */, - 04BD03FD12E6671800899322 /* SDL_x11keyboard.c in Sources */, - 04BD03FF12E6671800899322 /* SDL_x11modes.c in Sources */, - 04BD040112E6671800899322 /* SDL_x11mouse.c in Sources */, - 04BD040312E6671800899322 /* SDL_x11opengl.c in Sources */, - 04BD040512E6671800899322 /* SDL_x11opengles.c in Sources */, - 04BD040912E6671800899322 /* SDL_x11shape.c in Sources */, - 04BD040C12E6671800899322 /* SDL_x11touch.c in Sources */, - 04BD040E12E6671800899322 /* SDL_x11video.c in Sources */, - 04BD041012E6671800899322 /* SDL_x11window.c in Sources */, - 041B2CAB12FA0D680087D585 /* SDL_render.c in Sources */, - 04409B9612FA97ED00FB9AA8 /* SDL_yuv_mmx.c in Sources */, - 04409B9812FA97ED00FB9AA8 /* SDL_yuv_sw.c in Sources */, - 04F7803C12FB748500FC43C0 /* SDL_nullframebuffer.c in Sources */, - 04F7805512FB74A200FC43C0 /* SDL_blendfillrect.c in Sources */, - 04F7805712FB74A200FC43C0 /* SDL_blendline.c in Sources */, - 04F7805912FB74A200FC43C0 /* SDL_blendpoint.c in Sources */, - 04F7805C12FB74A200FC43C0 /* SDL_drawline.c in Sources */, - 04F7805E12FB74A200FC43C0 /* SDL_drawpoint.c in Sources */, - 0442EC1912FE1BBA004C9285 /* SDL_render_gl.c in Sources */, - 0442EC1F12FE1BCB004C9285 /* SDL_render_sw.c in Sources */, - 56A67025185654B40007D20F /* SDL_dynapi.c in Sources */, - 0442EC5C12FE1C60004C9285 /* SDL_x11framebuffer.c in Sources */, - 0442EC6012FE1C75004C9285 /* SDL_hints.c in Sources */, - 04BAC0C91300C2160055DE28 /* SDL_log.c in Sources */, - 043567401303160F00BA5428 /* SDL_shaders_gl.c in Sources */, - AA628ACB159367B7005138DD /* SDL_rotate.c in Sources */, - AA628AD2159367F2005138DD /* SDL_x11xinput2.c in Sources */, - AA9E4094163BE51E007A2AD0 /* SDL_x11messagebox.c in Sources */, - AABCC390164063D200AB8930 /* SDL_cocoamessagebox.m in Sources */, - AA0F8492178D5ECC00823F9D /* SDL_systls.c in Sources */, - D55A1B84179F263600625D7C /* SDL_cocoamousetap.m in Sources */, - DB0F490817CA5292008798C5 /* SDL_sysfilesystem.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB313FFD17554B71006C0E22 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB313FFE17554B71006C0E22 /* SDL_atomic.c in Sources */, - DB313FFF17554B71006C0E22 /* SDL_spinlock.c in Sources */, - DB31400017554B71006C0E22 /* SDL_diskaudio.c in Sources */, - DB31400117554B71006C0E22 /* SDL_dummyaudio.c in Sources */, - DB31400317554B71006C0E22 /* SDL_audio.c in Sources */, - DB31400417554B71006C0E22 /* SDL_audiocvt.c in Sources */, - DB31400517554B71006C0E22 /* SDL_audiodev.c in Sources */, - DB31400617554B71006C0E22 /* SDL_audiotypecvt.c in Sources */, - DB31400717554B71006C0E22 /* SDL_mixer.c in Sources */, - DB31400817554B71006C0E22 /* SDL_wave.c in Sources */, - DB31400917554B71006C0E22 /* SDL_cpuinfo.c in Sources */, - DB31400A17554B71006C0E22 /* SDL_clipboardevents.c in Sources */, - DB31400B17554B71006C0E22 /* SDL_events.c in Sources */, - DB31400C17554B71006C0E22 /* SDL_dropevents.c in Sources */, - DB31400D17554B71006C0E22 /* SDL_gesture.c in Sources */, - DB31400E17554B71006C0E22 /* SDL_keyboard.c in Sources */, - DB31400F17554B71006C0E22 /* SDL_mouse.c in Sources */, - DB31401017554B71006C0E22 /* SDL_quit.c in Sources */, - DB31401117554B71006C0E22 /* SDL_touch.c in Sources */, - DB31401217554B71006C0E22 /* SDL_windowevents.c in Sources */, - DB31401317554B71006C0E22 /* SDL_rwopsbundlesupport.m in Sources */, - DB31401417554B71006C0E22 /* SDL_rwops.c in Sources */, - DB31401517554B71006C0E22 /* SDL_syshaptic.c in Sources */, - DB31401617554B71006C0E22 /* SDL_haptic.c in Sources */, - DB31401717554B71006C0E22 /* SDL_sysjoystick.c in Sources */, - DB31401817554B71006C0E22 /* SDL_gamecontroller.c in Sources */, - DB31401917554B71006C0E22 /* SDL_joystick.c in Sources */, - DB31401A17554B71006C0E22 /* SDL_sysloadso.c in Sources */, - DB31401B17554B71006C0E22 /* SDL_syspower.c in Sources */, - DB31401C17554B71006C0E22 /* SDL_power.c in Sources */, - DB31401D17554B71006C0E22 /* SDL_assert.c in Sources */, - DB31401E17554B71006C0E22 /* SDL_error.c in Sources */, - DB31402017554B71006C0E22 /* SDL.c in Sources */, - DB31402117554B71006C0E22 /* SDL_getenv.c in Sources */, - DB31402217554B71006C0E22 /* SDL_iconv.c in Sources */, - DB31402317554B71006C0E22 /* SDL_malloc.c in Sources */, - DB31402417554B71006C0E22 /* SDL_qsort.c in Sources */, - DB31402517554B71006C0E22 /* SDL_stdlib.c in Sources */, - DB31402617554B71006C0E22 /* SDL_string.c in Sources */, - 562D3C7D1D8F4933003FEEE6 /* SDL_coreaudio.m in Sources */, - DB31402717554B71006C0E22 /* SDL_syscond.c in Sources */, - DB31402817554B71006C0E22 /* SDL_sysmutex.c in Sources */, - DB31402917554B71006C0E22 /* SDL_syssem.c in Sources */, - DB31402A17554B71006C0E22 /* SDL_systhread.c in Sources */, - DB31402B17554B71006C0E22 /* SDL_thread.c in Sources */, - DB31402C17554B71006C0E22 /* SDL_timer.c in Sources */, - DB31402D17554B71006C0E22 /* SDL_systimer.c in Sources */, - DB31402E17554B71006C0E22 /* SDL_cocoaclipboard.m in Sources */, - DB31402F17554B71006C0E22 /* SDL_cocoaevents.m in Sources */, - DB31403017554B71006C0E22 /* SDL_cocoakeyboard.m in Sources */, - DB31403117554B71006C0E22 /* SDL_cocoamodes.m in Sources */, - DB31403217554B71006C0E22 /* SDL_cocoamouse.m in Sources */, - DB31403317554B71006C0E22 /* SDL_cocoaopengl.m in Sources */, - DB31403417554B71006C0E22 /* SDL_cocoashape.m in Sources */, - DB31403517554B71006C0E22 /* SDL_cocoavideo.m in Sources */, - DB31403617554B71006C0E22 /* SDL_cocoawindow.m in Sources */, - DB31403717554B71006C0E22 /* SDL_nullevents.c in Sources */, - DB31403817554B71006C0E22 /* SDL_nullvideo.c in Sources */, - DB31403917554B71006C0E22 /* SDL_blit.c in Sources */, - DB31403A17554B71006C0E22 /* SDL_blit_0.c in Sources */, - DB31403B17554B71006C0E22 /* SDL_blit_1.c in Sources */, - DB31403C17554B71006C0E22 /* SDL_blit_A.c in Sources */, - DB31403D17554B71006C0E22 /* SDL_blit_auto.c in Sources */, - DB31403E17554B71006C0E22 /* SDL_blit_copy.c in Sources */, - DB31403F17554B71006C0E22 /* SDL_blit_N.c in Sources */, - DB31404017554B71006C0E22 /* SDL_blit_slow.c in Sources */, - DB31404117554B71006C0E22 /* SDL_bmp.c in Sources */, - DB31404217554B71006C0E22 /* SDL_clipboard.c in Sources */, - DB31404317554B71006C0E22 /* SDL_fillrect.c in Sources */, - DB31404417554B71006C0E22 /* SDL_pixels.c in Sources */, - DB31404517554B71006C0E22 /* SDL_rect.c in Sources */, - DB31404617554B71006C0E22 /* SDL_RLEaccel.c in Sources */, - DB31404717554B71006C0E22 /* SDL_shape.c in Sources */, - DB31404817554B71006C0E22 /* SDL_stretch.c in Sources */, - DB31404917554B71006C0E22 /* SDL_surface.c in Sources */, - DB31404A17554B71006C0E22 /* SDL_video.c in Sources */, - DB31404B17554B71006C0E22 /* imKStoUCS.c in Sources */, - DB31404C17554B71006C0E22 /* SDL_x11clipboard.c in Sources */, - DB31404D17554B71006C0E22 /* SDL_x11dyn.c in Sources */, - DB31404E17554B71006C0E22 /* SDL_x11events.c in Sources */, - DB31404F17554B71006C0E22 /* SDL_x11keyboard.c in Sources */, - DB31405017554B71006C0E22 /* SDL_x11modes.c in Sources */, - DB31405117554B71006C0E22 /* SDL_x11mouse.c in Sources */, - DB31405217554B71006C0E22 /* SDL_x11opengl.c in Sources */, - DB31405317554B71006C0E22 /* SDL_x11opengles.c in Sources */, - DB31405417554B71006C0E22 /* SDL_x11shape.c in Sources */, - DB31405517554B71006C0E22 /* SDL_x11touch.c in Sources */, - DB31405617554B71006C0E22 /* SDL_x11video.c in Sources */, - DB31405717554B71006C0E22 /* SDL_x11window.c in Sources */, - DB31405817554B71006C0E22 /* SDL_render.c in Sources */, - DB31405917554B71006C0E22 /* SDL_yuv_mmx.c in Sources */, - DB31405A17554B71006C0E22 /* SDL_yuv_sw.c in Sources */, - DB31405B17554B71006C0E22 /* SDL_nullframebuffer.c in Sources */, - DB31405C17554B71006C0E22 /* SDL_blendfillrect.c in Sources */, - DB31405D17554B71006C0E22 /* SDL_blendline.c in Sources */, - DB31405E17554B71006C0E22 /* SDL_blendpoint.c in Sources */, - DB31405F17554B71006C0E22 /* SDL_drawline.c in Sources */, - DB31406017554B71006C0E22 /* SDL_drawpoint.c in Sources */, - DB31406117554B71006C0E22 /* SDL_render_gl.c in Sources */, - DB31406217554B71006C0E22 /* SDL_render_sw.c in Sources */, - 56A67026185654B40007D20F /* SDL_dynapi.c in Sources */, - DB31406317554B71006C0E22 /* SDL_x11framebuffer.c in Sources */, - DB31406417554B71006C0E22 /* SDL_hints.c in Sources */, - DB31406517554B71006C0E22 /* SDL_log.c in Sources */, - DB31406617554B71006C0E22 /* SDL_shaders_gl.c in Sources */, - DB31406717554B71006C0E22 /* SDL_rotate.c in Sources */, - DB31406817554B71006C0E22 /* SDL_x11xinput2.c in Sources */, - DB31406917554B71006C0E22 /* SDL_x11messagebox.c in Sources */, - DB31406A17554B71006C0E22 /* SDL_cocoamessagebox.m in Sources */, - AA0F8493178D5ECC00823F9D /* SDL_systls.c in Sources */, - D55A1B83179F263500625D7C /* SDL_cocoamousetap.m in Sources */, - DB0F490A17CA5293008798C5 /* SDL_sysfilesystem.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - BECDF6C60761BA81005FE872 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BECDF5FE0761BA81005FE872 /* Framework */; - targetProxy = BECDF6C50761BA81005FE872 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 00CFA621106A567900758660 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - DEPLOYMENT_POSTPROCESSING = YES; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_ALTIVEC_EXTENSIONS = YES; - GCC_AUTO_VECTORIZATION = YES; - GCC_ENABLE_SSE3_EXTENSIONS = YES; - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 3; - GCC_SYMBOLS_PRIVATE_EXTERN = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.6; - SDKROOT = macosx; - STRIP_STYLE = "non-global"; - }; - name = Release; - }; - 00CFA622106A567900758660 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CLANG_LINK_OBJC_RUNTIME = NO; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1.0.0; - DYLIB_CURRENT_VERSION = 5.1.0; - FRAMEWORK_VERSION = A; - HEADER_SEARCH_PATHS = /usr/X11R6/include; - INFOPLIST_FILE = "Info-Framework.plist"; - INSTALL_PATH = "@rpath"; - OTHER_LDFLAGS = "-liconv"; - PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2; - PRODUCT_NAME = SDL2; - PROVISIONING_PROFILE = ""; - WRAPPER_EXTENSION = framework; - }; - name = Release; - }; - 00CFA623106A567900758660 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - COMBINE_HIDPI_IMAGES = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(GCC_PREPROCESSOR_DEFINITIONS)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_1)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_2)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_3)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_4)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = YES; - HEADER_SEARCH_PATHS = /usr/X11R6/include; - PRODUCT_NAME = SDL2; - SKIP_INSTALL = YES; - }; - name = Release; - }; - 00CFA625106A567900758660 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "Standard DMG"; - PROVISIONING_PROFILE = ""; - }; - name = Release; - }; - 00CFA627106A568900758660 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_ALTIVEC_EXTENSIONS = YES; - GCC_AUTO_VECTORIZATION = YES; - GCC_ENABLE_SSE3_EXTENSIONS = YES; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_SYMBOLS_PRIVATE_EXTERN = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.6; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - STRIP_INSTALLED_PRODUCT = NO; - }; - name = Debug; - }; - 00CFA628106A568900758660 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; - CLANG_LINK_OBJC_RUNTIME = NO; - COMBINE_HIDPI_IMAGES = YES; - DYLIB_COMPATIBILITY_VERSION = 1.0.0; - DYLIB_CURRENT_VERSION = 5.1.0; - FRAMEWORK_VERSION = A; - HEADER_SEARCH_PATHS = /usr/X11R6/include; - INFOPLIST_FILE = "Info-Framework.plist"; - INSTALL_PATH = "@rpath"; - OTHER_LDFLAGS = "-liconv"; - PRODUCT_BUNDLE_IDENTIFIER = org.libsdl.SDL2; - PRODUCT_NAME = SDL2; - PROVISIONING_PROFILE = ""; - WRAPPER_EXTENSION = framework; - }; - name = Debug; - }; - 00CFA629106A568900758660 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COMBINE_HIDPI_IMAGES = YES; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(GCC_PREPROCESSOR_DEFINITIONS)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_1)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_2)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_3)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_4)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = YES; - HEADER_SEARCH_PATHS = /usr/X11R6/include; - PRODUCT_NAME = SDL2; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 00CFA62B106A568900758660 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "Standard DMG"; - PROVISIONING_PROFILE = ""; - }; - name = Debug; - }; - DB31407517554B71006C0E22 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COMBINE_HIDPI_IMAGES = YES; - EXECUTABLE_PREFIX = lib; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(GCC_PREPROCESSOR_DEFINITIONS)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_1)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_2)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_3)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_4)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = YES; - HEADER_SEARCH_PATHS = /usr/X11R6/include; - INSTALL_PATH = "@rpath"; - PRODUCT_NAME = SDL2; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - DB31407617554B71006C0E22 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - COMBINE_HIDPI_IMAGES = YES; - EXECUTABLE_PREFIX = lib; - GCC_PREPROCESSOR_DEFINITIONS = ( - "$(GCC_PREPROCESSOR_DEFINITIONS)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_1)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_2)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_3)", - "$(GCC_PREPROCESSOR_DEFINITIONS_QUOTED_4)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = YES; - HEADER_SEARCH_PATHS = /usr/X11R6/include; - INSTALL_PATH = "@rpath"; - PRODUCT_NAME = SDL2; - SKIP_INSTALL = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 0073177A0858DB0500B2BC32 /* Build configuration list for PBXNativeTarget "Framework" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 00CFA628106A568900758660 /* Debug */, - 00CFA622106A567900758660 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 0073177E0858DB0500B2BC32 /* Build configuration list for PBXNativeTarget "Static Library" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 00CFA629106A568900758660 /* Debug */, - 00CFA623106A567900758660 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 007317860858DB0500B2BC32 /* Build configuration list for PBXNativeTarget "Standard DMG" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 00CFA62B106A568900758660 /* Debug */, - 00CFA625106A567900758660 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 0073178E0858DB0500B2BC32 /* Build configuration list for PBXProject "SDL" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 00CFA627106A568900758660 /* Debug */, - 00CFA621106A567900758660 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB31407417554B71006C0E22 /* Build configuration list for PBXNativeTarget "Shared Library" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB31407517554B71006C0E22 /* Debug */, - DB31407617554B71006C0E22 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; -/* End XCConfigurationList section */ - }; - rootObject = 0867D690FE84028FC02AAC07 /* Project object */; -} diff --git a/Engine/lib/sdl/Xcode/SDL/pkg-support/SDL.info b/Engine/lib/sdl/Xcode/SDL/pkg-support/SDL.info deleted file mode 100755 index f08facd23..000000000 --- a/Engine/lib/sdl/Xcode/SDL/pkg-support/SDL.info +++ /dev/null @@ -1,15 +0,0 @@ -Title SDL 2.0.0 -Version 1 -Description SDL Library for Mac OS X (http://www.libsdl.org) -DefaultLocation /Library/Frameworks -Diskname (null) -DeleteWarning -NeedsAuthorization NO -DisableStop NO -UseUserMask NO -Application NO -Relocatable YES -Required NO -InstallOnly NO -RequiresReboot NO -InstallFat NO diff --git a/Engine/lib/sdl/Xcode/SDL/pkg-support/resources/License.txt b/Engine/lib/sdl/Xcode/SDL/pkg-support/resources/License.txt deleted file mode 100644 index 3c7724df1..000000000 --- a/Engine/lib/sdl/Xcode/SDL/pkg-support/resources/License.txt +++ /dev/null @@ -1,19 +0,0 @@ - -Simple DirectMedia Layer -Copyright (C) 1997-2016 Sam Lantinga - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. -2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. -3. This notice may not be removed or altered from any source distribution. diff --git a/Engine/lib/sdl/Xcode/SDL/pkg-support/resources/ReadMe.txt b/Engine/lib/sdl/Xcode/SDL/pkg-support/resources/ReadMe.txt deleted file mode 100755 index 40ac3a14c..000000000 --- a/Engine/lib/sdl/Xcode/SDL/pkg-support/resources/ReadMe.txt +++ /dev/null @@ -1,32 +0,0 @@ -The Simple DirectMedia Layer (SDL for short) is a cross-platform -library designed to make it easy to write multi-media software, -such as games and emulators. - -The Simple DirectMedia Layer library source code is available from: -http://www.libsdl.org/ - -This library is distributed under the terms of the zlib license: -http://zlib.net/zlib_license.html - - -This packages contains the SDL framework for OS X. -Conforming with Apple guidelines, this framework -contains both the SDL runtime component and development header files. - - -To Install: -Copy the SDL2.framework to /Library/Frameworks - -You may alternatively install it in /Library/Frameworks -if your access privileges are not high enough. - - -Additional References: - - - Screencast tutorials for getting started with OpenSceneGraph/Mac OS X are - available at: - http://www.openscenegraph.org/projects/osg/wiki/Support/Tutorials/MacOSXTips - Though these are OpenSceneGraph centric, the same exact concepts apply to - SDL, thus the videos are recommended for everybody getting started with - developing on Mac OS X. (You can skim over the PlugIns stuff since SDL - doesn't have any PlugIns to worry about.) diff --git a/Engine/lib/sdl/Xcode/SDL/pkg-support/resources/SDL_DS_Store b/Engine/lib/sdl/Xcode/SDL/pkg-support/resources/SDL_DS_Store deleted file mode 100644 index 5658d15e4f13fbfd8a786e55c8b7a04cd1229cf8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15364 zcmeHMU2Ggz6+Yvvo3-QE>p!qcT1L1nsqn66cf8|Wr&8AA9}+3SQS8=^>f+AsjGb-9 zJKNoHoHjKWgv0|8O(mWx6tybv%|qW1k{@`0hKD>y)5NIL5`9TM>EJ?W?Ns&76 z5LW=m1gZr=Pq6~2OIea~JCb+<(jr&L$W@b93@vg;y)NxaQf@~wawkn*J~Y{~CT}R3 zXdUr&VNO~plIp1tPzW4FAiBF}%A3u4+24PEH;i9uZO0Prj~q{ex|SEKH8To ze186FusL6Ky|UAILFl0qZZvJDA>Lea!mD^A^o1bsp)X78#i|=#T}chyyjd{J5q;dW zwnp@umXRCL&4RhL#cid&n;iU7=9zN~&TCuW_~v%hXHD*VI(cXe-$q%ZOto@d4j}P% z^aF%p{3g{C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X85-p>#5D@Bqx`D^jZ|M)h9Qop|c z`D_3C*x~0f;2Hk>+}9ZT9X;#-I?P``-_gUEpT{T~+=%qUa|Z@oG4aC~gMf=DejIyU z|MbT(65L(!^B4o}llsGRD2AYaVGRF~mji?1;N1j&_$(Nse)ueklho_ptM8u!V+Ru4 z?eyc=k86tJ6!PQTUSo$JcmZQSt?6s*$GM^Sf%$PwLEAUzhW#TiFTTL-Vz2*vzi;5z zKaQaUb)bJ(129G-KaCyG!*^q#?G;?nHT?oEVzaAf4#W=z5FEHa>wSC3`(iOLLvWFZ z#Qm>-BWXNOQ#60|#=lzQU!C!QliwQS{{uXc<4l2LfAxv~4Xz*qQO>ly#T}(^1PJ^; K{S$ATfB8RpYXpJ- diff --git a/Engine/lib/sdl/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj b/Engine/lib/sdl/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj deleted file mode 100755 index 144d24ca5..000000000 --- a/Engine/lib/sdl/Xcode/SDLTest/SDLTest.xcodeproj/project.pbxproj +++ /dev/null @@ -1,4882 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXAggregateTarget section */ - BEC566920761D90300A33029 /* All */ = { - isa = PBXAggregateTarget; - buildConfigurationList = 001B599808BDB826006539E9 /* Build configuration list for PBXAggregateTarget "All" */; - buildPhases = ( - ); - dependencies = ( - DB0F490517CA5249008798C5 /* PBXTargetDependency */, - DB0F490717CA5249008798C5 /* PBXTargetDependency */, - DB166E9816A1D7CF00A1396C /* PBXTargetDependency */, - DB166E9616A1D7CD00A1396C /* PBXTargetDependency */, - DB166E6C16A1D72000A1396C /* PBXTargetDependency */, - DB166E5616A1D6B800A1396C /* PBXTargetDependency */, - DB166E3B16A1D65A00A1396C /* PBXTargetDependency */, - DB166E2016A1D5D000A1396C /* PBXTargetDependency */, - DB166E0916A1D5A400A1396C /* PBXTargetDependency */, - DB166DF216A1D53700A1396C /* PBXTargetDependency */, - DB166DD916A1D38900A1396C /* PBXTargetDependency */, - 001799481074403E00F5D044 /* PBXTargetDependency */, - 0017994C1074403E00F5D044 /* PBXTargetDependency */, - 001799501074403E00F5D044 /* PBXTargetDependency */, - 001799521074403E00F5D044 /* PBXTargetDependency */, - 0017995A1074403E00F5D044 /* PBXTargetDependency */, - 0017995E1074403E00F5D044 /* PBXTargetDependency */, - 001799601074403E00F5D044 /* PBXTargetDependency */, - 001799661074403E00F5D044 /* PBXTargetDependency */, - 001799681074403E00F5D044 /* PBXTargetDependency */, - 0017996A1074403E00F5D044 /* PBXTargetDependency */, - 0017996C1074403E00F5D044 /* PBXTargetDependency */, - 0017996E1074403E00F5D044 /* PBXTargetDependency */, - 001799701074403E00F5D044 /* PBXTargetDependency */, - 001799721074403E00F5D044 /* PBXTargetDependency */, - 001799741074403E00F5D044 /* PBXTargetDependency */, - 001799761074403E00F5D044 /* PBXTargetDependency */, - 001799781074403E00F5D044 /* PBXTargetDependency */, - 0017997C1074403E00F5D044 /* PBXTargetDependency */, - 001799801074403E00F5D044 /* PBXTargetDependency */, - 001799841074403E00F5D044 /* PBXTargetDependency */, - 001799881074403E00F5D044 /* PBXTargetDependency */, - 0017998A1074403E00F5D044 /* PBXTargetDependency */, - 0017998C1074403E00F5D044 /* PBXTargetDependency */, - 0017998E1074403E00F5D044 /* PBXTargetDependency */, - 001799921074403E00F5D044 /* PBXTargetDependency */, - 001799941074403E00F5D044 /* PBXTargetDependency */, - 001799961074403E00F5D044 /* PBXTargetDependency */, - 0017999E1074403E00F5D044 /* PBXTargetDependency */, - 001799A21074403E00F5D044 /* PBXTargetDependency */, - DB166D7016A1CEAF00A1396C /* PBXTargetDependency */, - DB166D6E16A1CEAA00A1396C /* PBXTargetDependency */, - DB166DC316A1D32C00A1396C /* PBXTargetDependency */, - ); - name = All; - productName = "Build All"; - }; -/* End PBXAggregateTarget section */ - -/* Begin PBXBuildFile section */ - 001794D01073667700F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794D11073667B00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794D41073668800F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794D51073668D00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794D61073669200F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794D71073669700F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794D91073669E00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794DB107366A700F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794DC107366AC00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794DE107366B900F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794DF107366BD00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794E0107366C100F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001794E5107366D900F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 0017957C10741F7900F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 0017957D10741F7900F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 0017957E10741F7900F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 0017957F10741F7900F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 0017958010741F7900F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 0017958110741F7900F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 0017958310741F7900F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 0017958410741F7900F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 0017958510741F7900F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001795901074216E00F5D044 /* testatomic.c in Sources */ = {isa = PBXBuildFile; fileRef = 0017958F1074216E00F5D044 /* testatomic.c */; }; - 0017959D107421BF00F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 0017959E107421BF00F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 0017959F107421BF00F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 001795A0107421BF00F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 001795A1107421BF00F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 001795A2107421BF00F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 001795A4107421BF00F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 001795A5107421BF00F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 001795A6107421BF00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001795B11074222D00F5D044 /* testaudioinfo.c in Sources */ = {isa = PBXBuildFile; fileRef = 001795B01074222D00F5D044 /* testaudioinfo.c */; }; - 0017971110742F3200F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 0017971210742F3200F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 0017971310742F3200F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 0017971410742F3200F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 0017971510742F3200F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 0017971610742F3200F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 0017971810742F3200F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 0017971910742F3200F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 0017971A10742F3200F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 0017972810742FB900F5D044 /* testgl2.c in Sources */ = {isa = PBXBuildFile; fileRef = 0017972710742FB900F5D044 /* testgl2.c */; }; - 00179738107430D600F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 00179739107430D600F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 0017973A107430D600F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 0017973B107430D600F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 0017973C107430D600F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 0017973D107430D600F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 0017973F107430D600F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 00179740107430D600F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 00179741107430D600F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 0017974F1074315700F5D044 /* testhaptic.c in Sources */ = {isa = PBXBuildFile; fileRef = 0017974E1074315700F5D044 /* testhaptic.c */; }; - 0017975E107431B300F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 0017975F107431B300F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 00179760107431B300F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 00179761107431B300F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 00179762107431B300F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 00179763107431B300F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 00179765107431B300F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 00179766107431B300F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 00179767107431B300F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001797721074320D00F5D044 /* testdraw2.c in Sources */ = {isa = PBXBuildFile; fileRef = 001797711074320D00F5D044 /* testdraw2.c */; }; - 0017977E107432AE00F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 0017977F107432AE00F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 00179780107432AE00F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 00179781107432AE00F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 00179782107432AE00F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 00179783107432AE00F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 00179785107432AE00F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 00179786107432AE00F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 00179787107432AE00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 00179792107432FA00F5D044 /* testime.c in Sources */ = {isa = PBXBuildFile; fileRef = 00179791107432FA00F5D044 /* testime.c */; }; - 0017979E1074334C00F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 0017979F1074334C00F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 001797A01074334C00F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 001797A11074334C00F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 001797A21074334C00F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 001797A31074334C00F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 001797A51074334C00F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 001797A61074334C00F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 001797A71074334C00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001797B41074339C00F5D044 /* testintersections.c in Sources */ = {isa = PBXBuildFile; fileRef = 001797B31074339C00F5D044 /* testintersections.c */; }; - 001797C0107433C600F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 001797C1107433C600F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 001797C2107433C600F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 001797C3107433C600F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 001797C4107433C600F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 001797C5107433C600F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 001797C7107433C600F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 001797C8107433C600F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 001797C9107433C600F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001797D41074343E00F5D044 /* testloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 001797D31074343E00F5D044 /* testloadso.c */; }; - 001798021074355200F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 001798031074355200F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 001798041074355200F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 001798051074355200F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 001798061074355200F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 001798071074355200F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 001798091074355200F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 0017980A1074355200F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 0017980B1074355200F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001798161074359B00F5D044 /* testmultiaudio.c in Sources */ = {isa = PBXBuildFile; fileRef = 001798151074359B00F5D044 /* testmultiaudio.c */; }; - 0017987F1074392D00F5D044 /* testnative.c in Sources */ = {isa = PBXBuildFile; fileRef = 0017985A107436ED00F5D044 /* testnative.c */; }; - 001798801074392D00F5D044 /* testnativecocoa.m in Sources */ = {isa = PBXBuildFile; fileRef = 0017985C107436ED00F5D044 /* testnativecocoa.m */; }; - 001798811074392D00F5D044 /* testnativex11.c in Sources */ = {isa = PBXBuildFile; fileRef = 00179872107438D000F5D044 /* testnativex11.c */; }; - 001798841074392D00F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 001798851074392D00F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 001798861074392D00F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 001798871074392D00F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 001798881074392D00F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 001798891074392D00F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 0017988B1074392D00F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 0017988C1074392D00F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 0017988D1074392D00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001798A5107439DF00F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 001798A6107439DF00F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 001798A7107439DF00F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 001798A8107439DF00F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 001798A9107439DF00F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 001798AA107439DF00F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 001798AC107439DF00F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 001798AD107439DF00F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 001798AE107439DF00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001798BA10743A4900F5D044 /* testpower.c in Sources */ = {isa = PBXBuildFile; fileRef = 001798B910743A4900F5D044 /* testpower.c */; }; - 001798E210743BEC00F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 001798E310743BEC00F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 001798E410743BEC00F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 001798E510743BEC00F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 001798E610743BEC00F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 001798E710743BEC00F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 001798E910743BEC00F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 001798EA10743BEC00F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 001798EB10743BEC00F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 001798FA10743E9200F5D044 /* testresample.c in Sources */ = {isa = PBXBuildFile; fileRef = 001798F910743E9200F5D044 /* testresample.c */; }; - 0017990610743F1000F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 0017990710743F1000F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 0017990810743F1000F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 0017990910743F1000F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 0017990A10743F1000F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 0017990B10743F1000F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 0017990D10743F1000F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 0017990E10743F1000F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 0017990F10743F1000F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 0017991A10743F5300F5D044 /* testsprite2.c in Sources */ = {isa = PBXBuildFile; fileRef = 0017991910743F5300F5D044 /* testsprite2.c */; }; - 0017992810743FB700F5D044 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 0017992910743FB700F5D044 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 0017992A10743FB700F5D044 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 0017992B10743FB700F5D044 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 0017992C10743FB700F5D044 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 0017992D10743FB700F5D044 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 0017992F10743FB700F5D044 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 0017993010743FB700F5D044 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 0017993110743FB700F5D044 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 0017993C10743FEF00F5D044 /* testwm2.c in Sources */ = {isa = PBXBuildFile; fileRef = 0017993B10743FEF00F5D044 /* testwm2.c */; }; - 002A863010730405007319AE /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 002A864110730546007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A864210730546007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A864310730546007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A864D10730546007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A864E10730546007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A864F10730546007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A865310730547007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A865410730547007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A865510730547007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A866210730547007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A866310730547007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A866410730547007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A866B10730548007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A866C10730548007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A866D10730548007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A866E10730548007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A866F10730548007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A867010730548007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A867410730548007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A867510730548007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A867610730548007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A867710730548007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A867810730548007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A867910730549007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A867A10730549007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A867B10730549007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A867C10730549007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A868010730549007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A868110730549007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A868210730549007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A868610730549007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A868710730549007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A868810730549007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A868910730549007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A868A10730549007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A868B1073054A007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A868F1073054A007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A86901073054A007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A86911073054A007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A86951073054A007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A86961073054A007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A86971073054A007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A86981073054A007319AE /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - 002A86991073054A007319AE /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - 002A869A1073054A007319AE /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - 002A86A310730593007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86A410730593007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86AB10730594007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86AC10730594007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86AF10730594007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86B010730594007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86B910730594007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86BA10730594007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86BF10730595007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86C010730595007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86C110730595007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86C210730595007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86C510730595007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86C610730595007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86C710730595007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86C810730595007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86C910730595007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86CA10730595007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86CD10730595007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86CE10730596007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86D110730596007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86D210730596007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86D310730596007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86D410730596007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86D710730596007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86D810730596007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86DB10730596007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86DC10730596007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A86DD10730596007319AE /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - 002A86DE10730596007319AE /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - 002A871610730623007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A871A10730623007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A871C10730623007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A872110730624007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A872410730624007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A872510730624007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A872710730624007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A872810730624007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A872910730624007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A872B10730624007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A872D10730624007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A872E10730624007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A873010730625007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A873210730625007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A873310730625007319AE /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - 002A873B10730675007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A873F10730675007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A874110730676007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A874610730676007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A874910730676007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A874A10730676007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A874C10730676007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A874D10730677007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A874E10730677007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A875010730677007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A875210730677007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A875310730677007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A875510730677007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A875710730678007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A875810730678007319AE /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - 002A875E10730745007319AE /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - 002F33AA09CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33AF09CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33B009CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33B209CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33B509CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33B609CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33B709CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33B809CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33BC09CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33BF09CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F33C109CA188600EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F340B09CA1BFF00EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F341809CA1C5B00EBEB88 /* testfile.c in Sources */ = {isa = PBXBuildFile; fileRef = 002F341709CA1C5B00EBEB88 /* testfile.c */; }; - 002F342A09CA1F0300EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F343709CA1F6F00EBEB88 /* testiconv.c in Sources */ = {isa = PBXBuildFile; fileRef = 002F343609CA1F6F00EBEB88 /* testiconv.c */; }; - 002F344609CA1FB300EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F345409CA202000EBEB88 /* testoverlay2.c in Sources */ = {isa = PBXBuildFile; fileRef = 002F345209CA201C00EBEB88 /* testoverlay2.c */; }; - 002F346309CA204F00EBEB88 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - 002F347009CA20A600EBEB88 /* testplatform.c in Sources */ = {isa = PBXBuildFile; fileRef = 002F346F09CA20A600EBEB88 /* testplatform.c */; }; - 00794E6609D20865003FC8A1 /* sample.wav in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E6209D20839003FC8A1 /* sample.wav */; }; - 00794EF009D23739003FC8A1 /* utf8.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E6309D20839003FC8A1 /* utf8.txt */; }; - 00794EF709D237DE003FC8A1 /* moose.dat in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E5E09D20839003FC8A1 /* moose.dat */; }; - 453774A5120915E3002F0F45 /* testshape.c in Sources */ = {isa = PBXBuildFile; fileRef = 453774A4120915E3002F0F45 /* testshape.c */; }; - BBFC08C0164C6862003E6A99 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - BBFC08C1164C6862003E6A99 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - BBFC08C2164C6862003E6A99 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - BBFC08C3164C6862003E6A99 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - BBFC08C4164C6862003E6A99 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - BBFC08C5164C6862003E6A99 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - BBFC08C7164C6862003E6A99 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - BBFC08C8164C6862003E6A99 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - BBFC08C9164C6862003E6A99 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - BBFC08D0164C6876003E6A99 /* testgamecontroller.c in Sources */ = {isa = PBXBuildFile; fileRef = BBFC088E164C6820003E6A99 /* testgamecontroller.c */; }; - BEC566B10761D90300A33029 /* checkkeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 092D6D10FFB30A2C7F000001 /* checkkeys.c */; }; - BEC566CB0761D90300A33029 /* loopwave.c in Sources */ = {isa = PBXBuildFile; fileRef = 083E4872006D84C97F000001 /* loopwave.c */; }; - BEC567010761D90300A33029 /* testerror.c in Sources */ = {isa = PBXBuildFile; fileRef = 083E4878006D85357F000001 /* testerror.c */; }; - BEC567290761D90400A33029 /* testthread.c in Sources */ = {isa = PBXBuildFile; fileRef = 092D6D58FFB311A97F000001 /* testthread.c */; }; - BEC567360761D90400A33029 /* testjoystick.c in Sources */ = {isa = PBXBuildFile; fileRef = 092D6D62FFB312AA7F000001 /* testjoystick.c */; }; - BEC567430761D90400A33029 /* testkeys.c in Sources */ = {isa = PBXBuildFile; fileRef = 092D6D6CFFB313437F000001 /* testkeys.c */; }; - BEC567500761D90400A33029 /* testlock.c in Sources */ = {isa = PBXBuildFile; fileRef = 092D6D75FFB313BB7F000001 /* testlock.c */; }; - BEC567780761D90500A33029 /* testsem.c in Sources */ = {isa = PBXBuildFile; fileRef = 083E487E006D86A17F000001 /* testsem.c */; }; - BEC567930761D90500A33029 /* testtimer.c in Sources */ = {isa = PBXBuildFile; fileRef = 083E4880006D86A17F000001 /* testtimer.c */; }; - BEC567AD0761D90500A33029 /* testver.c in Sources */ = {isa = PBXBuildFile; fileRef = 083E4882006D86A17F000001 /* testver.c */; }; - BEC567F00761D90600A33029 /* torturethread.c in Sources */ = {isa = PBXBuildFile; fileRef = 083E4887006D86A17F000001 /* torturethread.c */; }; - DB0F48DD17CA51E5008798C5 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB0F48DE17CA51E5008798C5 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB0F48DF17CA51E5008798C5 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB0F48E017CA51E5008798C5 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB0F48E117CA51E5008798C5 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB0F48E217CA51E5008798C5 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB0F48E417CA51E5008798C5 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB0F48E517CA51E5008798C5 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB0F48E617CA51E5008798C5 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB0F48EE17CA51F8008798C5 /* testdrawchessboard.c in Sources */ = {isa = PBXBuildFile; fileRef = DB0F48D717CA51D2008798C5 /* testdrawchessboard.c */; }; - DB0F48F317CA5212008798C5 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB0F48F417CA5212008798C5 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB0F48F517CA5212008798C5 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB0F48F617CA5212008798C5 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB0F48F717CA5212008798C5 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB0F48F817CA5212008798C5 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB0F48FA17CA5212008798C5 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB0F48FB17CA5212008798C5 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB0F48FC17CA5212008798C5 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB0F490317CA5225008798C5 /* testfilesystem.c in Sources */ = {isa = PBXBuildFile; fileRef = DB0F48D817CA51D2008798C5 /* testfilesystem.c */; }; - DB166D7116A1CFB200A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166D7216A1CFB200A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166D7316A1CFB200A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166D7416A1CFB200A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166D7516A1CFB200A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166D7616A1CFB200A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166D7716A1CFB200A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166D7816A1CFB200A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166D7A16A1CFD500A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166D9316A1D1A500A1396C /* SDL_test_assert.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8416A1D1A500A1396C /* SDL_test_assert.c */; }; - DB166D9416A1D1A500A1396C /* SDL_test_common.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8516A1D1A500A1396C /* SDL_test_common.c */; }; - DB166D9516A1D1A500A1396C /* SDL_test_compare.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8616A1D1A500A1396C /* SDL_test_compare.c */; }; - DB166D9616A1D1A500A1396C /* SDL_test_crc32.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8716A1D1A500A1396C /* SDL_test_crc32.c */; }; - DB166D9716A1D1A500A1396C /* SDL_test_font.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8816A1D1A500A1396C /* SDL_test_font.c */; }; - DB166D9816A1D1A500A1396C /* SDL_test_fuzzer.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8916A1D1A500A1396C /* SDL_test_fuzzer.c */; }; - DB166D9916A1D1A500A1396C /* SDL_test_harness.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8A16A1D1A500A1396C /* SDL_test_harness.c */; }; - DB166D9A16A1D1A500A1396C /* SDL_test_imageBlit.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8B16A1D1A500A1396C /* SDL_test_imageBlit.c */; }; - DB166D9B16A1D1A500A1396C /* SDL_test_imageBlitBlend.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8C16A1D1A500A1396C /* SDL_test_imageBlitBlend.c */; }; - DB166D9C16A1D1A500A1396C /* SDL_test_imageFace.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8D16A1D1A500A1396C /* SDL_test_imageFace.c */; }; - DB166D9D16A1D1A500A1396C /* SDL_test_imagePrimitives.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8E16A1D1A500A1396C /* SDL_test_imagePrimitives.c */; }; - DB166D9E16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D8F16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c */; }; - DB166D9F16A1D1A500A1396C /* SDL_test_log.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D9016A1D1A500A1396C /* SDL_test_log.c */; }; - DB166DA016A1D1A500A1396C /* SDL_test_md5.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D9116A1D1A500A1396C /* SDL_test_md5.c */; }; - DB166DA116A1D1A500A1396C /* SDL_test_random.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166D9216A1D1A500A1396C /* SDL_test_random.c */; }; - DB166DA216A1D1E900A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166DA316A1D1FA00A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166DA416A1D21700A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166DA716A1D24D00A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166DAA16A1D27700A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166DAB16A1D27C00A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166DAC16A1D29000A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166DB116A1D2F600A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166DB216A1D2F600A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166DB316A1D2F600A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166DB416A1D2F600A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166DB516A1D2F600A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166DB616A1D2F600A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166DB816A1D2F600A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166DB916A1D2F600A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166DBA16A1D2F600A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166DC116A1D31E00A1396C /* testgesture.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CBB16A1C74100A1396C /* testgesture.c */; }; - DB166DC816A1D36A00A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166DC916A1D36A00A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166DCA16A1D36A00A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166DCB16A1D36A00A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166DCC16A1D36A00A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166DCD16A1D36A00A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166DCF16A1D36A00A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166DD016A1D36A00A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166DD116A1D36A00A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166DD716A1D37800A1396C /* testmessage.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CBD16A1C74100A1396C /* testmessage.c */; }; - DB166DDB16A1D42F00A1396C /* icon.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E5D09D20839003FC8A1 /* icon.bmp */; }; - DB166DE016A1D50C00A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166DE116A1D50C00A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166DE216A1D50C00A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166DE316A1D50C00A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166DE416A1D50C00A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166DE516A1D50C00A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166DE716A1D50C00A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166DE816A1D50C00A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166DE916A1D50C00A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166DEA16A1D50C00A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166DF016A1D52500A1396C /* testrelative.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CBF16A1C74100A1396C /* testrelative.c */; }; - DB166DF716A1D57C00A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166DF816A1D57C00A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166DF916A1D57C00A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166DFA16A1D57C00A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166DFB16A1D57C00A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166DFC16A1D57C00A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166DFE16A1D57C00A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166DFF16A1D57C00A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166E0016A1D57C00A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166E0116A1D57C00A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166E0716A1D59400A1396C /* testrendercopyex.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CC016A1C74100A1396C /* testrendercopyex.c */; }; - DB166E0E16A1D5AD00A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166E0F16A1D5AD00A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166E1016A1D5AD00A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166E1116A1D5AD00A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166E1216A1D5AD00A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166E1316A1D5AD00A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166E1516A1D5AD00A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166E1616A1D5AD00A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166E1716A1D5AD00A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166E1816A1D5AD00A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166E1E16A1D5C300A1396C /* testrendertarget.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CC116A1C74100A1396C /* testrendertarget.c */; }; - DB166E2216A1D5EC00A1396C /* sample.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E6109D20839003FC8A1 /* sample.bmp */; }; - DB166E2316A1D60B00A1396C /* icon.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E5D09D20839003FC8A1 /* icon.bmp */; }; - DB166E2516A1D61900A1396C /* icon.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E5D09D20839003FC8A1 /* icon.bmp */; }; - DB166E2616A1D61900A1396C /* sample.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E6109D20839003FC8A1 /* sample.bmp */; }; - DB166E2B16A1D64D00A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166E2C16A1D64D00A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166E2D16A1D64D00A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166E2E16A1D64D00A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166E2F16A1D64D00A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166E3016A1D64D00A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166E3216A1D64D00A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166E3316A1D64D00A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166E3416A1D64D00A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166E3C16A1D66500A1396C /* testrumble.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CC216A1C74100A1396C /* testrumble.c */; }; - DB166E4116A1D69000A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166E4216A1D69000A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166E4316A1D69000A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166E4416A1D69000A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166E4516A1D69000A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166E4616A1D69000A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166E4816A1D69000A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166E4916A1D69000A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166E4A16A1D69000A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166E4B16A1D69000A1396C /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB166E4D16A1D69000A1396C /* icon.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E5D09D20839003FC8A1 /* icon.bmp */; }; - DB166E4E16A1D69000A1396C /* sample.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E6109D20839003FC8A1 /* sample.bmp */; }; - DB166E5416A1D6A300A1396C /* testscale.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CC316A1C74100A1396C /* testscale.c */; }; - DB166E5B16A1D6F300A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166E5C16A1D6F300A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166E5D16A1D6F300A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166E5E16A1D6F300A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166E5F16A1D6F300A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166E6016A1D6F300A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166E6216A1D6F300A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166E6316A1D6F300A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166E6416A1D6F300A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166E6A16A1D70C00A1396C /* testshader.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CC416A1C74100A1396C /* testshader.c */; }; - DB166E7116A1D78400A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166E7216A1D78400A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166E7316A1D78400A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166E7416A1D78400A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166E7516A1D78400A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166E7616A1D78400A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166E7816A1D78400A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166E7916A1D78400A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166E7A16A1D78400A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166E8416A1D78C00A1396C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB166E8516A1D78C00A1396C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB166E8616A1D78C00A1396C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB166E8716A1D78C00A1396C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB166E8816A1D78C00A1396C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB166E8916A1D78C00A1396C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB166E8B16A1D78C00A1396C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB166E8C16A1D78C00A1396C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB166E8D16A1D78C00A1396C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB166E9316A1D7BC00A1396C /* testspriteminimal.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CC516A1C74100A1396C /* testspriteminimal.c */; }; - DB166E9416A1D7C700A1396C /* teststreaming.c in Sources */ = {isa = PBXBuildFile; fileRef = DB166CC616A1C74100A1396C /* teststreaming.c */; }; - DB166E9A16A1D7F700A1396C /* moose.dat in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E5E09D20839003FC8A1 /* moose.dat */; }; - DB166E9C16A1D80900A1396C /* icon.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = 00794E5D09D20839003FC8A1 /* icon.bmp */; }; - DB166ED016A1D88100A1396C /* shapes in CopyFiles */ = {isa = PBXBuildFile; fileRef = DB166ECF16A1D87000A1396C /* shapes */; }; - DB445EEA18184B7000B306B0 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB445EEB18184B7000B306B0 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB445EEC18184B7000B306B0 /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB445EED18184B7000B306B0 /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB445EEE18184B7000B306B0 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB445EEF18184B7000B306B0 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB445EF118184B7000B306B0 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB445EF218184B7000B306B0 /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB445EF318184B7000B306B0 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB445EF418184B7000B306B0 /* libSDL_test.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DB166D7F16A1D12400A1396C /* libSDL_test.a */; }; - DB445EFB18184BB600B306B0 /* testdropfile.c in Sources */ = {isa = PBXBuildFile; fileRef = DB445EFA18184BB600B306B0 /* testdropfile.c */; }; - DB89957118A19ABA0092407C /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DB89957218A19ABA0092407C /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DB89957318A19ABA0092407C /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DB89957418A19ABA0092407C /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DB89957518A19ABA0092407C /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DB89957618A19ABA0092407C /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DB89957818A19ABA0092407C /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DB89957918A19ABA0092407C /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DB89957A18A19ABA0092407C /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DB89958418A19B130092407C /* testhotplug.c in Sources */ = {isa = PBXBuildFile; fileRef = DB89958318A19B130092407C /* testhotplug.c */; }; - DBEC54DD1A1A81C3005B1EAB /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - DBEC54DE1A1A81C3005B1EAB /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002F33A709CA188600EBEB88 /* Cocoa.framework */; }; - DBEC54DF1A1A81C3005B1EAB /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 003FA645093FFD41000C53B3 /* libSDL2.a */; }; - DBEC54E01A1A81C3005B1EAB /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863B10730545007319AE /* CoreAudio.framework */; }; - DBEC54E11A1A81C3005B1EAB /* ForceFeedback.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863C10730545007319AE /* ForceFeedback.framework */; }; - DBEC54E21A1A81C3005B1EAB /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A863D10730545007319AE /* IOKit.framework */; }; - DBEC54E31A1A81C3005B1EAB /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A869F10730593007319AE /* AudioToolbox.framework */; }; - DBEC54E41A1A81C3005B1EAB /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A86A010730593007319AE /* CoreFoundation.framework */; }; - DBEC54E51A1A81C3005B1EAB /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A871410730623007319AE /* AudioUnit.framework */; }; - DBEC54E61A1A81C3005B1EAB /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 002A873910730675007319AE /* Carbon.framework */; }; - DBEC54EB1A1A8205005B1EAB /* controllermap.c in Sources */ = {isa = PBXBuildFile; fileRef = DBEC54D11A1A811D005B1EAB /* controllermap.c */; }; - DBEC54ED1A1A828A005B1EAB /* axis.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = DBEC54D61A1A8145005B1EAB /* axis.bmp */; }; - DBEC54EE1A1A828D005B1EAB /* button.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = DBEC54D71A1A8145005B1EAB /* button.bmp */; }; - DBEC54EF1A1A828F005B1EAB /* controllermap.bmp in CopyFiles */ = {isa = PBXBuildFile; fileRef = DBEC54D81A1A8145005B1EAB /* controllermap.bmp */; }; - FA73672319A54A90004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73672819A54AB6004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73672919A54AB9004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73672A19A54AC0004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73672B19A54AC2004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73672C19A54AC5004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73672D19A54AC7004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73672E19A54ACA004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73672F19A54ACC004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673019A54AD0004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673119A54AD3004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673219A54AD5004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673319A54AD8004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673419A54ADB004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673519A54ADE004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673619A54AE1004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673719A54AE3004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673819A54AE6004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673919A54AE8004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673A19A54AEB004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673B19A54AED004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673C19A54AF0004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673D19A54AF3004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673E19A54AF6004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73673F19A54AF8004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674019A54AFB004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674119A54AFE004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674219A54B01004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674319A54B04004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674419A54B06004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674519A54B09004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674619A54B0B004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674719A54B0F004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674819A54B13004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674919A54B16004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674A19A54B19004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674B19A54B1B004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674C19A54B1F004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674D19A54B22004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674E19A54B25004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73674F19A54B28004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73675019A54B2B004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73675119A54B2F004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73675219A54B32004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; - FA73675319A54B35004122E4 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA73672219A54A90004122E4 /* CoreVideo.framework */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 001799471074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC566AB0761D90300A33029; - remoteInfo = checkkeys; - }; - 0017994B1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC566C50761D90300A33029; - remoteInfo = loopwave; - }; - 0017994F1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0017957410741F7900F5D044; - remoteInfo = testatomic; - }; - 001799511074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 00179595107421BF00F5D044; - remoteInfo = testaudioinfo; - }; - 001799591074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 00179756107431B300F5D044; - remoteInfo = testdraw2; - }; - 0017995D1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC566FB0761D90300A33029; - remoteInfo = testerror; - }; - 0017995F1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 002F340109CA1BFF00EBEB88; - remoteInfo = testfile; - }; - 001799651074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0017970910742F3200F5D044; - remoteInfo = testgl2; - }; - 001799671074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 00179730107430D600F5D044; - remoteInfo = testhaptic; - }; - 001799691074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC567230761D90400A33029; - remoteInfo = testthread; - }; - 0017996B1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 002F342009CA1F0300EBEB88; - remoteInfo = testiconv; - }; - 0017996D1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 00179776107432AE00F5D044; - remoteInfo = testime; - }; - 0017996F1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 001797961074334C00F5D044; - remoteInfo = testintersections; - }; - 001799711074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC567300761D90400A33029; - remoteInfo = testjoystick; - }; - 001799731074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC5673D0761D90400A33029; - remoteInfo = testkeys; - }; - 001799751074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 001797B8107433C600F5D044; - remoteInfo = testloadso; - }; - 001799771074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC5674A0761D90400A33029; - remoteInfo = testlock; - }; - 0017997B1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 001797FA1074355200F5D044; - remoteInfo = testmultiaudio; - }; - 0017997F1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 001798781074392D00F5D044; - remoteInfo = testnativex11; - }; - 001799831074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 002F343C09CA1FB300EBEB88; - remoteInfo = testoverlay2; - }; - 001799871074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 002F345909CA204F00EBEB88; - remoteInfo = testplatform; - }; - 001799891074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0017989D107439DF00F5D044; - remoteInfo = testpower; - }; - 0017998B1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 001798DA10743BEC00F5D044; - remoteInfo = testresample; - }; - 0017998D1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC567720761D90500A33029; - remoteInfo = testsem; - }; - 001799911074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 001798FE10743F1000F5D044; - remoteInfo = testsprite2; - }; - 001799931074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC5678D0761D90500A33029; - remoteInfo = testtimer; - }; - 001799951074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC567A70761D90500A33029; - remoteInfo = testversion; - }; - 0017999D1074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 0017992010743FB700F5D044; - remoteInfo = testwm2; - }; - 001799A11074403E00F5D044 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BEC567EA0761D90600A33029; - remoteInfo = torturethread; - }; - 003FA642093FFD41000C53B3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = BECDF66C0761BA81005FE872; - remoteInfo = Framework; - }; - 003FA644093FFD41000C53B3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = BECDF6B30761BA81005FE872; - remoteInfo = "Static Library"; - }; - 003FA648093FFD41000C53B3 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = BECDF6BE0761BA81005FE872; - remoteInfo = "Standard DMG"; - }; - DB0F490417CA5249008798C5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB0F48D917CA51E5008798C5; - remoteInfo = testdrawchessboard; - }; - DB0F490617CA5249008798C5 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB0F48EF17CA5212008798C5; - remoteInfo = testfilesystem; - }; - DB166D6D16A1CEAA00A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = BBFC08B7164C6862003E6A99; - remoteInfo = testgamecontroller; - }; - DB166D6F16A1CEAF00A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = 4537749112091504002F0F45; - remoteInfo = testshape; - }; - DB166DC216A1D32C00A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166DAD16A1D2F600A1396C; - remoteInfo = testgesture; - }; - DB166DD816A1D38900A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166DC416A1D36A00A1396C; - remoteInfo = testmessage; - }; - DB166DF116A1D53700A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166DDC16A1D50C00A1396C; - remoteInfo = testrelative; - }; - DB166E0816A1D5A400A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166DF316A1D57C00A1396C; - remoteInfo = testrendercopyex; - }; - DB166E1F16A1D5D000A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166E0A16A1D5AD00A1396C; - remoteInfo = testrendertarget; - }; - DB166E3A16A1D65A00A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166E2716A1D64D00A1396C; - remoteInfo = testrumble; - }; - DB166E5516A1D6B800A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166E3D16A1D69000A1396C; - remoteInfo = testscale; - }; - DB166E6B16A1D72000A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166E5716A1D6F300A1396C; - remoteInfo = testshader; - }; - DB166E9516A1D7CD00A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166E6D16A1D78400A1396C; - remoteInfo = testspriteminimal; - }; - DB166E9716A1D7CF00A1396C /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; - proxyType = 1; - remoteGlobalIDString = DB166E8016A1D78C00A1396C; - remoteInfo = teststreaming; - }; - DB1D40D617B3F30D00D74CFC /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = DB31407717554B71006C0E22; - remoteInfo = "Shared Library"; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXCopyFilesBuildPhase section */ - 00794E6409D2084F003FC8A1 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - 00794E6609D20865003FC8A1 /* sample.wav in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 00794EEC09D2371F003FC8A1 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - 00794EF009D23739003FC8A1 /* utf8.txt in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 00794EF409D237C7003FC8A1 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - 00794EF709D237DE003FC8A1 /* moose.dat in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB0F48E717CA51E5008798C5 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB0F48FD17CA5212008798C5 /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166DDA16A1D40F00A1396C /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - DB166DDB16A1D42F00A1396C /* icon.bmp in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E2116A1D5DF00A1396C /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - DB166E2316A1D60B00A1396C /* icon.bmp in CopyFiles */, - DB166E2216A1D5EC00A1396C /* sample.bmp in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E2416A1D61000A1396C /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - DB166E2516A1D61900A1396C /* icon.bmp in CopyFiles */, - DB166E2616A1D61900A1396C /* sample.bmp in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E4C16A1D69000A1396C /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - DB166E4D16A1D69000A1396C /* icon.bmp in CopyFiles */, - DB166E4E16A1D69000A1396C /* sample.bmp in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E9916A1D7EE00A1396C /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - DB166E9A16A1D7F700A1396C /* moose.dat in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E9B16A1D7FC00A1396C /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - DB166E9C16A1D80900A1396C /* icon.bmp in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166ECE16A1D85400A1396C /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - DB166ED016A1D88100A1396C /* shapes in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DBEC54EC1A1A827C005B1EAB /* CopyFiles */ = { - isa = PBXCopyFilesBuildPhase; - buildActionMask = 2147483647; - dstPath = ""; - dstSubfolderSpec = 16; - files = ( - DBEC54ED1A1A828A005B1EAB /* axis.bmp in CopyFiles */, - DBEC54EE1A1A828D005B1EAB /* button.bmp in CopyFiles */, - DBEC54EF1A1A828F005B1EAB /* controllermap.bmp in CopyFiles */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXCopyFilesBuildPhase section */ - -/* Begin PBXFileReference section */ - 0017958C10741F7900F5D044 /* testatomic */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testatomic; sourceTree = BUILT_PRODUCTS_DIR; }; - 0017958F1074216E00F5D044 /* testatomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testatomic.c; path = ../../test/testatomic.c; sourceTree = SOURCE_ROOT; }; - 001795AD107421BF00F5D044 /* testaudioinfo */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testaudioinfo; sourceTree = BUILT_PRODUCTS_DIR; }; - 001795B01074222D00F5D044 /* testaudioinfo.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testaudioinfo.c; path = ../../test/testaudioinfo.c; sourceTree = SOURCE_ROOT; }; - 0017972110742F3200F5D044 /* testgl2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testgl2; sourceTree = BUILT_PRODUCTS_DIR; }; - 0017972710742FB900F5D044 /* testgl2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testgl2.c; path = ../../test/testgl2.c; sourceTree = SOURCE_ROOT; }; - 00179748107430D600F5D044 /* testhaptic */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testhaptic; sourceTree = BUILT_PRODUCTS_DIR; }; - 0017974E1074315700F5D044 /* testhaptic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testhaptic.c; path = ../../test/testhaptic.c; sourceTree = SOURCE_ROOT; }; - 0017976E107431B300F5D044 /* testdraw2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testdraw2; sourceTree = BUILT_PRODUCTS_DIR; }; - 001797711074320D00F5D044 /* testdraw2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testdraw2.c; path = ../../test/testdraw2.c; sourceTree = SOURCE_ROOT; }; - 0017978E107432AE00F5D044 /* testime */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testime; sourceTree = BUILT_PRODUCTS_DIR; }; - 00179791107432FA00F5D044 /* testime.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testime.c; path = ../../test/testime.c; sourceTree = SOURCE_ROOT; }; - 001797AE1074334C00F5D044 /* testintersections */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testintersections; sourceTree = BUILT_PRODUCTS_DIR; }; - 001797B31074339C00F5D044 /* testintersections.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testintersections.c; path = ../../test/testintersections.c; sourceTree = SOURCE_ROOT; }; - 001797D0107433C600F5D044 /* testloadso */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testloadso; sourceTree = BUILT_PRODUCTS_DIR; }; - 001797D31074343E00F5D044 /* testloadso.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testloadso.c; path = ../../test/testloadso.c; sourceTree = SOURCE_ROOT; }; - 001798121074355200F5D044 /* testmultiaudio */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testmultiaudio; sourceTree = BUILT_PRODUCTS_DIR; }; - 001798151074359B00F5D044 /* testmultiaudio.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testmultiaudio.c; path = ../../test/testmultiaudio.c; sourceTree = SOURCE_ROOT; }; - 0017985A107436ED00F5D044 /* testnative.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testnative.c; path = ../../test/testnative.c; sourceTree = SOURCE_ROOT; }; - 0017985B107436ED00F5D044 /* testnative.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = testnative.h; path = ../../test/testnative.h; sourceTree = SOURCE_ROOT; }; - 0017985C107436ED00F5D044 /* testnativecocoa.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = testnativecocoa.m; path = ../../test/testnativecocoa.m; sourceTree = SOURCE_ROOT; }; - 00179872107438D000F5D044 /* testnativex11.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testnativex11.c; path = ../../test/testnativex11.c; sourceTree = SOURCE_ROOT; }; - 001798941074392D00F5D044 /* testnative */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testnative; sourceTree = BUILT_PRODUCTS_DIR; }; - 001798B5107439DF00F5D044 /* testpower */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testpower; sourceTree = BUILT_PRODUCTS_DIR; }; - 001798B910743A4900F5D044 /* testpower.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testpower.c; path = ../../test/testpower.c; sourceTree = SOURCE_ROOT; }; - 001798F210743BEC00F5D044 /* testresample */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testresample; sourceTree = BUILT_PRODUCTS_DIR; }; - 001798F910743E9200F5D044 /* testresample.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testresample.c; path = ../../test/testresample.c; sourceTree = SOURCE_ROOT; }; - 0017991610743F1000F5D044 /* testsprite2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testsprite2; sourceTree = BUILT_PRODUCTS_DIR; }; - 0017991910743F5300F5D044 /* testsprite2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testsprite2.c; path = ../../test/testsprite2.c; sourceTree = SOURCE_ROOT; }; - 0017993810743FB700F5D044 /* testwm2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testwm2; sourceTree = BUILT_PRODUCTS_DIR; }; - 0017993B10743FEF00F5D044 /* testwm2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testwm2.c; path = ../../test/testwm2.c; sourceTree = SOURCE_ROOT; }; - 002A863B10730545007319AE /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = /System/Library/Frameworks/CoreAudio.framework; sourceTree = ""; }; - 002A863C10730545007319AE /* ForceFeedback.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ForceFeedback.framework; path = /System/Library/Frameworks/ForceFeedback.framework; sourceTree = ""; }; - 002A863D10730545007319AE /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = /System/Library/Frameworks/IOKit.framework; sourceTree = ""; }; - 002A869F10730593007319AE /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = /System/Library/Frameworks/AudioToolbox.framework; sourceTree = ""; }; - 002A86A010730593007319AE /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = /System/Library/Frameworks/CoreFoundation.framework; sourceTree = ""; }; - 002A871410730623007319AE /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = /System/Library/Frameworks/AudioUnit.framework; sourceTree = ""; }; - 002A873910730675007319AE /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = ""; }; - 002F33A709CA188600EBEB88 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; - 002F341209CA1BFF00EBEB88 /* testfile */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testfile; sourceTree = BUILT_PRODUCTS_DIR; }; - 002F341709CA1C5B00EBEB88 /* testfile.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testfile.c; path = ../../test/testfile.c; sourceTree = SOURCE_ROOT; }; - 002F343109CA1F0300EBEB88 /* testiconv */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testiconv; sourceTree = BUILT_PRODUCTS_DIR; }; - 002F343609CA1F6F00EBEB88 /* testiconv.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testiconv.c; path = ../../test/testiconv.c; sourceTree = SOURCE_ROOT; }; - 002F344D09CA1FB300EBEB88 /* testoverlay2 */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testoverlay2; sourceTree = BUILT_PRODUCTS_DIR; }; - 002F345209CA201C00EBEB88 /* testoverlay2.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testoverlay2.c; path = ../../test/testoverlay2.c; sourceTree = SOURCE_ROOT; }; - 002F346A09CA204F00EBEB88 /* testplatform */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testplatform; sourceTree = BUILT_PRODUCTS_DIR; }; - 002F346F09CA20A600EBEB88 /* testplatform.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testplatform.c; path = ../../test/testplatform.c; sourceTree = SOURCE_ROOT; }; - 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = SDL.xcodeproj; path = ../SDL/SDL.xcodeproj; sourceTree = SOURCE_ROOT; }; - 00794E5D09D20839003FC8A1 /* icon.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = icon.bmp; path = ../../test/icon.bmp; sourceTree = SOURCE_ROOT; }; - 00794E5E09D20839003FC8A1 /* moose.dat */ = {isa = PBXFileReference; lastKnownFileType = file; name = moose.dat; path = ../../test/moose.dat; sourceTree = SOURCE_ROOT; }; - 00794E5F09D20839003FC8A1 /* picture.xbm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = picture.xbm; path = ../../test/picture.xbm; sourceTree = SOURCE_ROOT; }; - 00794E6109D20839003FC8A1 /* sample.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = sample.bmp; path = ../../test/sample.bmp; sourceTree = SOURCE_ROOT; }; - 00794E6209D20839003FC8A1 /* sample.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = sample.wav; path = ../../test/sample.wav; sourceTree = SOURCE_ROOT; }; - 00794E6309D20839003FC8A1 /* utf8.txt */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text; name = utf8.txt; path = ../../test/utf8.txt; sourceTree = SOURCE_ROOT; }; - 083E4872006D84C97F000001 /* loopwave.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = loopwave.c; path = ../../test/loopwave.c; sourceTree = SOURCE_ROOT; }; - 083E4878006D85357F000001 /* testerror.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testerror.c; path = ../../test/testerror.c; sourceTree = SOURCE_ROOT; }; - 083E487E006D86A17F000001 /* testsem.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testsem.c; path = ../../test/testsem.c; sourceTree = SOURCE_ROOT; }; - 083E4880006D86A17F000001 /* testtimer.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testtimer.c; path = ../../test/testtimer.c; sourceTree = SOURCE_ROOT; }; - 083E4882006D86A17F000001 /* testver.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testver.c; path = ../../test/testver.c; sourceTree = SOURCE_ROOT; }; - 083E4887006D86A17F000001 /* torturethread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = torturethread.c; path = ../../test/torturethread.c; sourceTree = SOURCE_ROOT; }; - 092D6D10FFB30A2C7F000001 /* checkkeys.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = checkkeys.c; path = ../../test/checkkeys.c; sourceTree = SOURCE_ROOT; }; - 092D6D58FFB311A97F000001 /* testthread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testthread.c; path = ../../test/testthread.c; sourceTree = SOURCE_ROOT; }; - 092D6D62FFB312AA7F000001 /* testjoystick.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testjoystick.c; path = ../../test/testjoystick.c; sourceTree = SOURCE_ROOT; }; - 092D6D6CFFB313437F000001 /* testkeys.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testkeys.c; path = ../../test/testkeys.c; sourceTree = SOURCE_ROOT; }; - 092D6D75FFB313BB7F000001 /* testlock.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = testlock.c; path = ../../test/testlock.c; sourceTree = SOURCE_ROOT; }; - 4537749212091504002F0F45 /* testshape */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testshape; sourceTree = BUILT_PRODUCTS_DIR; }; - 453774A4120915E3002F0F45 /* testshape.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testshape.c; path = ../../test/testshape.c; sourceTree = SOURCE_ROOT; }; - BBFC088E164C6820003E6A99 /* testgamecontroller.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testgamecontroller.c; path = ../../test/testgamecontroller.c; sourceTree = ""; }; - BBFC08CD164C6862003E6A99 /* testgamecontroller */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testgamecontroller; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC566B60761D90300A33029 /* checkkeys */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = checkkeys; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC566D10761D90300A33029 /* loopwave */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = loopwave; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC567060761D90400A33029 /* testerror */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testerror; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC5672E0761D90400A33029 /* testthread */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testthread; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC5673B0761D90400A33029 /* testjoystick */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testjoystick; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC567480761D90400A33029 /* testkeys */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testkeys; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC567550761D90400A33029 /* testlock */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testlock; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC5677D0761D90500A33029 /* testsem */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testsem; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC567980761D90500A33029 /* testtimer */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testtimer; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC567B20761D90500A33029 /* testversion */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testversion; sourceTree = BUILT_PRODUCTS_DIR; }; - BEC567F50761D90600A33029 /* torturethread */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = torturethread; sourceTree = BUILT_PRODUCTS_DIR; }; - DB0F48D717CA51D2008798C5 /* testdrawchessboard.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testdrawchessboard.c; path = ../../test/testdrawchessboard.c; sourceTree = ""; }; - DB0F48D817CA51D2008798C5 /* testfilesystem.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testfilesystem.c; path = ../../test/testfilesystem.c; sourceTree = ""; }; - DB0F48EC17CA51E5008798C5 /* testdrawchessboard */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testdrawchessboard; sourceTree = BUILT_PRODUCTS_DIR; }; - DB0F490117CA5212008798C5 /* testfilesystem */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testfilesystem; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166CBB16A1C74100A1396C /* testgesture.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testgesture.c; path = ../../test/testgesture.c; sourceTree = ""; }; - DB166CBC16A1C74100A1396C /* testgles.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testgles.c; path = ../../test/testgles.c; sourceTree = ""; }; - DB166CBD16A1C74100A1396C /* testmessage.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testmessage.c; path = ../../test/testmessage.c; sourceTree = ""; }; - DB166CBF16A1C74100A1396C /* testrelative.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testrelative.c; path = ../../test/testrelative.c; sourceTree = ""; }; - DB166CC016A1C74100A1396C /* testrendercopyex.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testrendercopyex.c; path = ../../test/testrendercopyex.c; sourceTree = ""; }; - DB166CC116A1C74100A1396C /* testrendertarget.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testrendertarget.c; path = ../../test/testrendertarget.c; sourceTree = ""; }; - DB166CC216A1C74100A1396C /* testrumble.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testrumble.c; path = ../../test/testrumble.c; sourceTree = ""; }; - DB166CC316A1C74100A1396C /* testscale.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testscale.c; path = ../../test/testscale.c; sourceTree = ""; }; - DB166CC416A1C74100A1396C /* testshader.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testshader.c; path = ../../test/testshader.c; sourceTree = ""; }; - DB166CC516A1C74100A1396C /* testspriteminimal.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = testspriteminimal.c; path = ../../test/testspriteminimal.c; sourceTree = ""; }; - DB166CC616A1C74100A1396C /* teststreaming.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = teststreaming.c; path = ../../test/teststreaming.c; sourceTree = ""; }; - DB166D7F16A1D12400A1396C /* libSDL_test.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSDL_test.a; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166D8416A1D1A500A1396C /* SDL_test_assert.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_assert.c; path = ../../src/test/SDL_test_assert.c; sourceTree = ""; }; - DB166D8516A1D1A500A1396C /* SDL_test_common.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_common.c; path = ../../src/test/SDL_test_common.c; sourceTree = ""; }; - DB166D8616A1D1A500A1396C /* SDL_test_compare.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_compare.c; path = ../../src/test/SDL_test_compare.c; sourceTree = ""; }; - DB166D8716A1D1A500A1396C /* SDL_test_crc32.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_crc32.c; path = ../../src/test/SDL_test_crc32.c; sourceTree = ""; }; - DB166D8816A1D1A500A1396C /* SDL_test_font.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_font.c; path = ../../src/test/SDL_test_font.c; sourceTree = ""; }; - DB166D8916A1D1A500A1396C /* SDL_test_fuzzer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_fuzzer.c; path = ../../src/test/SDL_test_fuzzer.c; sourceTree = ""; }; - DB166D8A16A1D1A500A1396C /* SDL_test_harness.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_harness.c; path = ../../src/test/SDL_test_harness.c; sourceTree = ""; }; - DB166D8B16A1D1A500A1396C /* SDL_test_imageBlit.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imageBlit.c; path = ../../src/test/SDL_test_imageBlit.c; sourceTree = ""; }; - DB166D8C16A1D1A500A1396C /* SDL_test_imageBlitBlend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imageBlitBlend.c; path = ../../src/test/SDL_test_imageBlitBlend.c; sourceTree = ""; }; - DB166D8D16A1D1A500A1396C /* SDL_test_imageFace.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imageFace.c; path = ../../src/test/SDL_test_imageFace.c; sourceTree = ""; }; - DB166D8E16A1D1A500A1396C /* SDL_test_imagePrimitives.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imagePrimitives.c; path = ../../src/test/SDL_test_imagePrimitives.c; sourceTree = ""; }; - DB166D8F16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_imagePrimitivesBlend.c; path = ../../src/test/SDL_test_imagePrimitivesBlend.c; sourceTree = ""; }; - DB166D9016A1D1A500A1396C /* SDL_test_log.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_log.c; path = ../../src/test/SDL_test_log.c; sourceTree = ""; }; - DB166D9116A1D1A500A1396C /* SDL_test_md5.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_md5.c; path = ../../src/test/SDL_test_md5.c; sourceTree = ""; }; - DB166D9216A1D1A500A1396C /* SDL_test_random.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = SDL_test_random.c; path = ../../src/test/SDL_test_random.c; sourceTree = ""; }; - DB166DBF16A1D2F600A1396C /* testgesture */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testgesture; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166DD516A1D36A00A1396C /* testmessage */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testmessage; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166DEE16A1D50C00A1396C /* testrelative */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testrelative; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E0516A1D57C00A1396C /* testrendercopyex */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testrendercopyex; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E1C16A1D5AD00A1396C /* testrendertarget */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testrendertarget; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E3816A1D64D00A1396C /* testrumble */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testrumble; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E5216A1D69000A1396C /* testscale */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testscale; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E6816A1D6F300A1396C /* testshader */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testshader; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E7E16A1D78400A1396C /* testspriteminimal */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testspriteminimal; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166E9116A1D78C00A1396C /* teststreaming */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = teststreaming; sourceTree = BUILT_PRODUCTS_DIR; }; - DB166ECF16A1D87000A1396C /* shapes */ = {isa = PBXFileReference; lastKnownFileType = folder; name = shapes; path = ../../test/shapes; sourceTree = ""; }; - DB445EF818184B7000B306B0 /* testdropfile.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = testdropfile.app; sourceTree = BUILT_PRODUCTS_DIR; }; - DB445EFA18184BB600B306B0 /* testdropfile.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testdropfile.c; path = ../../test/testdropfile.c; sourceTree = ""; }; - DB89957E18A19ABA0092407C /* testhotplug */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = testhotplug; sourceTree = BUILT_PRODUCTS_DIR; }; - DB89958318A19B130092407C /* testhotplug.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = testhotplug.c; path = ../../test/testhotplug.c; sourceTree = ""; }; - DBBC552C182831D700F3CA8D /* TestDropFile-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist; path = "TestDropFile-Info.plist"; sourceTree = ""; }; - DBEC54D11A1A811D005B1EAB /* controllermap.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = controllermap.c; path = ../../test/controllermap.c; sourceTree = ""; }; - DBEC54D61A1A8145005B1EAB /* axis.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = axis.bmp; path = ../../test/axis.bmp; sourceTree = ""; }; - DBEC54D71A1A8145005B1EAB /* button.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = button.bmp; path = ../../test/button.bmp; sourceTree = ""; }; - DBEC54D81A1A8145005B1EAB /* controllermap.bmp */ = {isa = PBXFileReference; lastKnownFileType = image.bmp; name = controllermap.bmp; path = ../../test/controllermap.bmp; sourceTree = ""; }; - DBEC54EA1A1A81C3005B1EAB /* controllermap */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = controllermap; sourceTree = BUILT_PRODUCTS_DIR; }; - FA73672219A54A90004122E4 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = /System/Library/Frameworks/CoreVideo.framework; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 0017957A10741F7900F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73672919A54AB9004122E4 /* CoreVideo.framework in Frameworks */, - 0017957C10741F7900F5D044 /* Cocoa.framework in Frameworks */, - 0017957D10741F7900F5D044 /* CoreAudio.framework in Frameworks */, - 0017957E10741F7900F5D044 /* ForceFeedback.framework in Frameworks */, - 0017957F10741F7900F5D044 /* IOKit.framework in Frameworks */, - 0017958010741F7900F5D044 /* AudioToolbox.framework in Frameworks */, - 0017958110741F7900F5D044 /* CoreFoundation.framework in Frameworks */, - 0017958310741F7900F5D044 /* AudioUnit.framework in Frameworks */, - 0017958410741F7900F5D044 /* Carbon.framework in Frameworks */, - 0017958510741F7900F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017959B107421BF00F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73672A19A54AC0004122E4 /* CoreVideo.framework in Frameworks */, - 0017959D107421BF00F5D044 /* Cocoa.framework in Frameworks */, - 0017959E107421BF00F5D044 /* CoreAudio.framework in Frameworks */, - 0017959F107421BF00F5D044 /* ForceFeedback.framework in Frameworks */, - 001795A0107421BF00F5D044 /* IOKit.framework in Frameworks */, - 001795A1107421BF00F5D044 /* AudioToolbox.framework in Frameworks */, - 001795A2107421BF00F5D044 /* CoreFoundation.framework in Frameworks */, - 001795A4107421BF00F5D044 /* AudioUnit.framework in Frameworks */, - 001795A5107421BF00F5D044 /* Carbon.framework in Frameworks */, - 001795A6107421BF00F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017970F10742F3200F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673319A54AD8004122E4 /* CoreVideo.framework in Frameworks */, - 0017971110742F3200F5D044 /* Cocoa.framework in Frameworks */, - 0017971210742F3200F5D044 /* CoreAudio.framework in Frameworks */, - 0017971310742F3200F5D044 /* ForceFeedback.framework in Frameworks */, - 0017971410742F3200F5D044 /* IOKit.framework in Frameworks */, - 0017971510742F3200F5D044 /* AudioToolbox.framework in Frameworks */, - 0017971610742F3200F5D044 /* CoreFoundation.framework in Frameworks */, - 0017971810742F3200F5D044 /* AudioUnit.framework in Frameworks */, - 0017971910742F3200F5D044 /* Carbon.framework in Frameworks */, - 0017971A10742F3200F5D044 /* libSDL2.a in Frameworks */, - DB166DA316A1D1FA00A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 00179736107430D600F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673419A54ADB004122E4 /* CoreVideo.framework in Frameworks */, - 00179738107430D600F5D044 /* Cocoa.framework in Frameworks */, - 00179739107430D600F5D044 /* CoreAudio.framework in Frameworks */, - 0017973A107430D600F5D044 /* ForceFeedback.framework in Frameworks */, - 0017973B107430D600F5D044 /* IOKit.framework in Frameworks */, - 0017973C107430D600F5D044 /* AudioToolbox.framework in Frameworks */, - 0017973D107430D600F5D044 /* CoreFoundation.framework in Frameworks */, - 0017973F107430D600F5D044 /* AudioUnit.framework in Frameworks */, - 00179740107430D600F5D044 /* Carbon.framework in Frameworks */, - 00179741107430D600F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017975C107431B300F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73672B19A54AC2004122E4 /* CoreVideo.framework in Frameworks */, - 0017975E107431B300F5D044 /* Cocoa.framework in Frameworks */, - 0017975F107431B300F5D044 /* CoreAudio.framework in Frameworks */, - 00179760107431B300F5D044 /* ForceFeedback.framework in Frameworks */, - 00179761107431B300F5D044 /* IOKit.framework in Frameworks */, - 00179762107431B300F5D044 /* AudioToolbox.framework in Frameworks */, - 00179763107431B300F5D044 /* CoreFoundation.framework in Frameworks */, - 00179765107431B300F5D044 /* AudioUnit.framework in Frameworks */, - 00179766107431B300F5D044 /* Carbon.framework in Frameworks */, - 00179767107431B300F5D044 /* libSDL2.a in Frameworks */, - DB166DA216A1D1E900A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017977C107432AE00F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673719A54AE3004122E4 /* CoreVideo.framework in Frameworks */, - 0017977E107432AE00F5D044 /* Cocoa.framework in Frameworks */, - 0017977F107432AE00F5D044 /* CoreAudio.framework in Frameworks */, - 00179780107432AE00F5D044 /* ForceFeedback.framework in Frameworks */, - 00179781107432AE00F5D044 /* IOKit.framework in Frameworks */, - 00179782107432AE00F5D044 /* AudioToolbox.framework in Frameworks */, - 00179783107432AE00F5D044 /* CoreFoundation.framework in Frameworks */, - 00179785107432AE00F5D044 /* AudioUnit.framework in Frameworks */, - 00179786107432AE00F5D044 /* Carbon.framework in Frameworks */, - 00179787107432AE00F5D044 /* libSDL2.a in Frameworks */, - DB166DA716A1D24D00A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017979C1074334C00F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673819A54AE6004122E4 /* CoreVideo.framework in Frameworks */, - 0017979E1074334C00F5D044 /* Cocoa.framework in Frameworks */, - 0017979F1074334C00F5D044 /* CoreAudio.framework in Frameworks */, - 001797A01074334C00F5D044 /* ForceFeedback.framework in Frameworks */, - 001797A11074334C00F5D044 /* IOKit.framework in Frameworks */, - 001797A21074334C00F5D044 /* AudioToolbox.framework in Frameworks */, - 001797A31074334C00F5D044 /* CoreFoundation.framework in Frameworks */, - 001797A51074334C00F5D044 /* AudioUnit.framework in Frameworks */, - 001797A61074334C00F5D044 /* Carbon.framework in Frameworks */, - 001797A71074334C00F5D044 /* libSDL2.a in Frameworks */, - DB166DAA16A1D27700A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 001797BE107433C600F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673B19A54AED004122E4 /* CoreVideo.framework in Frameworks */, - 001797C0107433C600F5D044 /* Cocoa.framework in Frameworks */, - 001797C1107433C600F5D044 /* CoreAudio.framework in Frameworks */, - 001797C2107433C600F5D044 /* ForceFeedback.framework in Frameworks */, - 001797C3107433C600F5D044 /* IOKit.framework in Frameworks */, - 001797C4107433C600F5D044 /* AudioToolbox.framework in Frameworks */, - 001797C5107433C600F5D044 /* CoreFoundation.framework in Frameworks */, - 001797C7107433C600F5D044 /* AudioUnit.framework in Frameworks */, - 001797C8107433C600F5D044 /* Carbon.framework in Frameworks */, - 001797C9107433C600F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 001798001074355200F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673E19A54AF6004122E4 /* CoreVideo.framework in Frameworks */, - 001798021074355200F5D044 /* Cocoa.framework in Frameworks */, - 001798031074355200F5D044 /* CoreAudio.framework in Frameworks */, - 001798041074355200F5D044 /* ForceFeedback.framework in Frameworks */, - 001798051074355200F5D044 /* IOKit.framework in Frameworks */, - 001798061074355200F5D044 /* AudioToolbox.framework in Frameworks */, - 001798071074355200F5D044 /* CoreFoundation.framework in Frameworks */, - 001798091074355200F5D044 /* AudioUnit.framework in Frameworks */, - 0017980A1074355200F5D044 /* Carbon.framework in Frameworks */, - 0017980B1074355200F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 001798821074392D00F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673F19A54AF8004122E4 /* CoreVideo.framework in Frameworks */, - 001798841074392D00F5D044 /* Cocoa.framework in Frameworks */, - 001798851074392D00F5D044 /* CoreAudio.framework in Frameworks */, - 001798861074392D00F5D044 /* ForceFeedback.framework in Frameworks */, - 001798871074392D00F5D044 /* IOKit.framework in Frameworks */, - 001798881074392D00F5D044 /* AudioToolbox.framework in Frameworks */, - 001798891074392D00F5D044 /* CoreFoundation.framework in Frameworks */, - 0017988B1074392D00F5D044 /* AudioUnit.framework in Frameworks */, - 0017988C1074392D00F5D044 /* Carbon.framework in Frameworks */, - 0017988D1074392D00F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 001798A3107439DF00F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674219A54B01004122E4 /* CoreVideo.framework in Frameworks */, - 001798A5107439DF00F5D044 /* Cocoa.framework in Frameworks */, - 001798A6107439DF00F5D044 /* CoreAudio.framework in Frameworks */, - 001798A7107439DF00F5D044 /* ForceFeedback.framework in Frameworks */, - 001798A8107439DF00F5D044 /* IOKit.framework in Frameworks */, - 001798A9107439DF00F5D044 /* AudioToolbox.framework in Frameworks */, - 001798AA107439DF00F5D044 /* CoreFoundation.framework in Frameworks */, - 001798AC107439DF00F5D044 /* AudioUnit.framework in Frameworks */, - 001798AD107439DF00F5D044 /* Carbon.framework in Frameworks */, - 001798AE107439DF00F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 001798E010743BEC00F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674619A54B0B004122E4 /* CoreVideo.framework in Frameworks */, - 001798E210743BEC00F5D044 /* Cocoa.framework in Frameworks */, - 001798E310743BEC00F5D044 /* CoreAudio.framework in Frameworks */, - 001798E410743BEC00F5D044 /* ForceFeedback.framework in Frameworks */, - 001798E510743BEC00F5D044 /* IOKit.framework in Frameworks */, - 001798E610743BEC00F5D044 /* AudioToolbox.framework in Frameworks */, - 001798E710743BEC00F5D044 /* CoreFoundation.framework in Frameworks */, - 001798E910743BEC00F5D044 /* AudioUnit.framework in Frameworks */, - 001798EA10743BEC00F5D044 /* Carbon.framework in Frameworks */, - 001798EB10743BEC00F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017990410743F1000F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674C19A54B1F004122E4 /* CoreVideo.framework in Frameworks */, - 0017990610743F1000F5D044 /* Cocoa.framework in Frameworks */, - 0017990710743F1000F5D044 /* CoreAudio.framework in Frameworks */, - 0017990810743F1000F5D044 /* ForceFeedback.framework in Frameworks */, - 0017990910743F1000F5D044 /* IOKit.framework in Frameworks */, - 0017990A10743F1000F5D044 /* AudioToolbox.framework in Frameworks */, - 0017990B10743F1000F5D044 /* CoreFoundation.framework in Frameworks */, - 0017990D10743F1000F5D044 /* AudioUnit.framework in Frameworks */, - 0017990E10743F1000F5D044 /* Carbon.framework in Frameworks */, - 0017990F10743F1000F5D044 /* libSDL2.a in Frameworks */, - DB166DAB16A1D27C00A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017992610743FB700F5D044 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73675219A54B32004122E4 /* CoreVideo.framework in Frameworks */, - 0017992810743FB700F5D044 /* Cocoa.framework in Frameworks */, - 0017992910743FB700F5D044 /* CoreAudio.framework in Frameworks */, - 0017992A10743FB700F5D044 /* ForceFeedback.framework in Frameworks */, - 0017992B10743FB700F5D044 /* IOKit.framework in Frameworks */, - 0017992C10743FB700F5D044 /* AudioToolbox.framework in Frameworks */, - 0017992D10743FB700F5D044 /* CoreFoundation.framework in Frameworks */, - 0017992F10743FB700F5D044 /* AudioUnit.framework in Frameworks */, - 0017993010743FB700F5D044 /* Carbon.framework in Frameworks */, - 0017993110743FB700F5D044 /* libSDL2.a in Frameworks */, - DB166DAC16A1D29000A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 002F340809CA1BFF00EBEB88 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73672F19A54ACC004122E4 /* CoreVideo.framework in Frameworks */, - 002F340B09CA1BFF00EBEB88 /* Cocoa.framework in Frameworks */, - 002A866B10730548007319AE /* CoreAudio.framework in Frameworks */, - 002A866C10730548007319AE /* ForceFeedback.framework in Frameworks */, - 002A866D10730548007319AE /* IOKit.framework in Frameworks */, - 002A86BF10730595007319AE /* AudioToolbox.framework in Frameworks */, - 002A86C010730595007319AE /* CoreFoundation.framework in Frameworks */, - 002A872410730624007319AE /* AudioUnit.framework in Frameworks */, - 002A874910730676007319AE /* Carbon.framework in Frameworks */, - 001794D11073667B00F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 002F342709CA1F0300EBEB88 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673619A54AE1004122E4 /* CoreVideo.framework in Frameworks */, - 002F342A09CA1F0300EBEB88 /* Cocoa.framework in Frameworks */, - 002A866210730547007319AE /* CoreAudio.framework in Frameworks */, - 002A866310730547007319AE /* ForceFeedback.framework in Frameworks */, - 002A866410730547007319AE /* IOKit.framework in Frameworks */, - 002A86B910730594007319AE /* AudioToolbox.framework in Frameworks */, - 002A86BA10730594007319AE /* CoreFoundation.framework in Frameworks */, - 002A872110730624007319AE /* AudioUnit.framework in Frameworks */, - 002A874610730676007319AE /* Carbon.framework in Frameworks */, - 001794D41073668800F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 002F344309CA1FB300EBEB88 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674019A54AFB004122E4 /* CoreVideo.framework in Frameworks */, - 002F344609CA1FB300EBEB88 /* Cocoa.framework in Frameworks */, - 002A868010730549007319AE /* CoreAudio.framework in Frameworks */, - 002A868110730549007319AE /* ForceFeedback.framework in Frameworks */, - 002A868210730549007319AE /* IOKit.framework in Frameworks */, - 002A86CD10730595007319AE /* AudioToolbox.framework in Frameworks */, - 002A86CE10730596007319AE /* CoreFoundation.framework in Frameworks */, - 002A872B10730624007319AE /* AudioUnit.framework in Frameworks */, - 002A875010730677007319AE /* Carbon.framework in Frameworks */, - 001794D91073669E00F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 002F346009CA204F00EBEB88 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674119A54AFE004122E4 /* CoreVideo.framework in Frameworks */, - 002F346309CA204F00EBEB88 /* Cocoa.framework in Frameworks */, - 002A868610730549007319AE /* CoreAudio.framework in Frameworks */, - 002A868710730549007319AE /* ForceFeedback.framework in Frameworks */, - 002A868810730549007319AE /* IOKit.framework in Frameworks */, - 002A86D110730596007319AE /* AudioToolbox.framework in Frameworks */, - 002A86D210730596007319AE /* CoreFoundation.framework in Frameworks */, - 002A872D10730624007319AE /* AudioUnit.framework in Frameworks */, - 002A875210730677007319AE /* Carbon.framework in Frameworks */, - 001794DB107366A700F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 4537749012091504002F0F45 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674B19A54B1B004122E4 /* CoreVideo.framework in Frameworks */, - DB166D7116A1CFB200A1396C /* AudioToolbox.framework in Frameworks */, - DB166D7216A1CFB200A1396C /* AudioUnit.framework in Frameworks */, - DB166D7316A1CFB200A1396C /* Carbon.framework in Frameworks */, - DB166D7416A1CFB200A1396C /* Cocoa.framework in Frameworks */, - DB166D7516A1CFB200A1396C /* CoreAudio.framework in Frameworks */, - DB166D7616A1CFB200A1396C /* CoreFoundation.framework in Frameworks */, - DB166D7716A1CFB200A1396C /* ForceFeedback.framework in Frameworks */, - DB166D7816A1CFB200A1396C /* IOKit.framework in Frameworks */, - DB166D7A16A1CFD500A1396C /* libSDL2.a in Frameworks */, - DB166DA416A1D21700A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BBFC08BE164C6862003E6A99 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673119A54AD3004122E4 /* CoreVideo.framework in Frameworks */, - BBFC08C0164C6862003E6A99 /* Cocoa.framework in Frameworks */, - BBFC08C1164C6862003E6A99 /* CoreAudio.framework in Frameworks */, - BBFC08C2164C6862003E6A99 /* ForceFeedback.framework in Frameworks */, - BBFC08C3164C6862003E6A99 /* IOKit.framework in Frameworks */, - BBFC08C4164C6862003E6A99 /* AudioToolbox.framework in Frameworks */, - BBFC08C5164C6862003E6A99 /* CoreFoundation.framework in Frameworks */, - BBFC08C7164C6862003E6A99 /* AudioUnit.framework in Frameworks */, - BBFC08C8164C6862003E6A99 /* Carbon.framework in Frameworks */, - BBFC08C9164C6862003E6A99 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC566B20761D90300A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73672319A54A90004122E4 /* CoreVideo.framework in Frameworks */, - 002F33C109CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A863010730405007319AE /* libSDL2.a in Frameworks */, - 002A864D10730546007319AE /* CoreAudio.framework in Frameworks */, - 002A864E10730546007319AE /* ForceFeedback.framework in Frameworks */, - 002A864F10730546007319AE /* IOKit.framework in Frameworks */, - 002A86AB10730594007319AE /* AudioToolbox.framework in Frameworks */, - 002A86AC10730594007319AE /* CoreFoundation.framework in Frameworks */, - 002A871A10730623007319AE /* AudioUnit.framework in Frameworks */, - 002A873F10730675007319AE /* Carbon.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC566CC0761D90300A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73672819A54AB6004122E4 /* CoreVideo.framework in Frameworks */, - 002F33BF09CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A865310730547007319AE /* CoreAudio.framework in Frameworks */, - 002A865410730547007319AE /* ForceFeedback.framework in Frameworks */, - 002A865510730547007319AE /* IOKit.framework in Frameworks */, - 002A86AF10730594007319AE /* AudioToolbox.framework in Frameworks */, - 002A86B010730594007319AE /* CoreFoundation.framework in Frameworks */, - 002A871C10730623007319AE /* AudioUnit.framework in Frameworks */, - 002A874110730676007319AE /* Carbon.framework in Frameworks */, - 002A875E10730745007319AE /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567020761D90300A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73672E19A54ACA004122E4 /* CoreVideo.framework in Frameworks */, - 002F33BC09CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A866E10730548007319AE /* CoreAudio.framework in Frameworks */, - 002A866F10730548007319AE /* ForceFeedback.framework in Frameworks */, - 002A867010730548007319AE /* IOKit.framework in Frameworks */, - 002A86C110730595007319AE /* AudioToolbox.framework in Frameworks */, - 002A86C210730595007319AE /* CoreFoundation.framework in Frameworks */, - 002A872510730624007319AE /* AudioUnit.framework in Frameworks */, - 002A874A10730676007319AE /* Carbon.framework in Frameworks */, - 001794D01073667700F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC5672A0761D90400A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674F19A54B28004122E4 /* CoreVideo.framework in Frameworks */, - 002F33B809CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A868F1073054A007319AE /* CoreAudio.framework in Frameworks */, - 002A86901073054A007319AE /* ForceFeedback.framework in Frameworks */, - 002A86911073054A007319AE /* IOKit.framework in Frameworks */, - 002A86D710730596007319AE /* AudioToolbox.framework in Frameworks */, - 002A86D810730596007319AE /* CoreFoundation.framework in Frameworks */, - 002A873010730625007319AE /* AudioUnit.framework in Frameworks */, - 002A875510730677007319AE /* Carbon.framework in Frameworks */, - 001794DE107366B900F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567370761D90400A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673919A54AE8004122E4 /* CoreVideo.framework in Frameworks */, - 002F33B709CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A867410730548007319AE /* CoreAudio.framework in Frameworks */, - 002A867510730548007319AE /* ForceFeedback.framework in Frameworks */, - 002A867610730548007319AE /* IOKit.framework in Frameworks */, - 002A86C510730595007319AE /* AudioToolbox.framework in Frameworks */, - 002A86C610730595007319AE /* CoreFoundation.framework in Frameworks */, - 002A872710730624007319AE /* AudioUnit.framework in Frameworks */, - 002A874C10730676007319AE /* Carbon.framework in Frameworks */, - 001794D51073668D00F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567440761D90400A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673A19A54AEB004122E4 /* CoreVideo.framework in Frameworks */, - 002F33B509CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A867710730548007319AE /* CoreAudio.framework in Frameworks */, - 002A867810730548007319AE /* ForceFeedback.framework in Frameworks */, - 002A867910730549007319AE /* IOKit.framework in Frameworks */, - 002A86C710730595007319AE /* AudioToolbox.framework in Frameworks */, - 002A86C810730595007319AE /* CoreFoundation.framework in Frameworks */, - 002A872810730624007319AE /* AudioUnit.framework in Frameworks */, - 002A874D10730677007319AE /* Carbon.framework in Frameworks */, - 001794D61073669200F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567510761D90400A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673C19A54AF0004122E4 /* CoreVideo.framework in Frameworks */, - 002F33B609CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A867A10730549007319AE /* CoreAudio.framework in Frameworks */, - 002A867B10730549007319AE /* ForceFeedback.framework in Frameworks */, - 002A867C10730549007319AE /* IOKit.framework in Frameworks */, - 002A86C910730595007319AE /* AudioToolbox.framework in Frameworks */, - 002A86CA10730595007319AE /* CoreFoundation.framework in Frameworks */, - 002A872910730624007319AE /* AudioUnit.framework in Frameworks */, - 002A874E10730677007319AE /* Carbon.framework in Frameworks */, - 001794D71073669700F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567790761D90500A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674919A54B16004122E4 /* CoreVideo.framework in Frameworks */, - 002F33B209CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A868910730549007319AE /* CoreAudio.framework in Frameworks */, - 002A868A10730549007319AE /* ForceFeedback.framework in Frameworks */, - 002A868B1073054A007319AE /* IOKit.framework in Frameworks */, - 002A86D310730596007319AE /* AudioToolbox.framework in Frameworks */, - 002A86D410730596007319AE /* CoreFoundation.framework in Frameworks */, - 002A872E10730624007319AE /* AudioUnit.framework in Frameworks */, - 002A875310730677007319AE /* Carbon.framework in Frameworks */, - 001794DC107366AC00F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567940761D90500A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73675019A54B2B004122E4 /* CoreVideo.framework in Frameworks */, - 002F33B009CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A86981073054A007319AE /* CoreAudio.framework in Frameworks */, - 002A86991073054A007319AE /* ForceFeedback.framework in Frameworks */, - 002A869A1073054A007319AE /* IOKit.framework in Frameworks */, - 002A86DD10730596007319AE /* AudioToolbox.framework in Frameworks */, - 002A86DE10730596007319AE /* CoreFoundation.framework in Frameworks */, - 002A873310730625007319AE /* AudioUnit.framework in Frameworks */, - 002A875810730678007319AE /* Carbon.framework in Frameworks */, - 001794DF107366BD00F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567AE0761D90500A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73675119A54B2F004122E4 /* CoreVideo.framework in Frameworks */, - 002F33AF09CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A86951073054A007319AE /* CoreAudio.framework in Frameworks */, - 002A86961073054A007319AE /* ForceFeedback.framework in Frameworks */, - 002A86971073054A007319AE /* IOKit.framework in Frameworks */, - 002A86DB10730596007319AE /* AudioToolbox.framework in Frameworks */, - 002A86DC10730596007319AE /* CoreFoundation.framework in Frameworks */, - 002A873210730625007319AE /* AudioUnit.framework in Frameworks */, - 002A875710730678007319AE /* Carbon.framework in Frameworks */, - 001794E0107366C100F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567F10761D90600A33029 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73675319A54B35004122E4 /* CoreVideo.framework in Frameworks */, - 002F33AA09CA188600EBEB88 /* Cocoa.framework in Frameworks */, - 002A864110730546007319AE /* CoreAudio.framework in Frameworks */, - 002A864210730546007319AE /* ForceFeedback.framework in Frameworks */, - 002A864310730546007319AE /* IOKit.framework in Frameworks */, - 002A86A310730593007319AE /* AudioToolbox.framework in Frameworks */, - 002A86A410730593007319AE /* CoreFoundation.framework in Frameworks */, - 002A871610730623007319AE /* AudioUnit.framework in Frameworks */, - 002A873B10730675007319AE /* Carbon.framework in Frameworks */, - 001794E5107366D900F5D044 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB0F48DC17CA51E5008798C5 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73672C19A54AC5004122E4 /* CoreVideo.framework in Frameworks */, - DB0F48DD17CA51E5008798C5 /* Cocoa.framework in Frameworks */, - DB0F48DE17CA51E5008798C5 /* CoreAudio.framework in Frameworks */, - DB0F48DF17CA51E5008798C5 /* ForceFeedback.framework in Frameworks */, - DB0F48E017CA51E5008798C5 /* IOKit.framework in Frameworks */, - DB0F48E117CA51E5008798C5 /* AudioToolbox.framework in Frameworks */, - DB0F48E217CA51E5008798C5 /* CoreFoundation.framework in Frameworks */, - DB0F48E417CA51E5008798C5 /* AudioUnit.framework in Frameworks */, - DB0F48E517CA51E5008798C5 /* Carbon.framework in Frameworks */, - DB0F48E617CA51E5008798C5 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB0F48F217CA5212008798C5 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673019A54AD0004122E4 /* CoreVideo.framework in Frameworks */, - DB0F48F317CA5212008798C5 /* Cocoa.framework in Frameworks */, - DB0F48F417CA5212008798C5 /* CoreAudio.framework in Frameworks */, - DB0F48F517CA5212008798C5 /* ForceFeedback.framework in Frameworks */, - DB0F48F617CA5212008798C5 /* IOKit.framework in Frameworks */, - DB0F48F717CA5212008798C5 /* AudioToolbox.framework in Frameworks */, - DB0F48F817CA5212008798C5 /* CoreFoundation.framework in Frameworks */, - DB0F48FA17CA5212008798C5 /* AudioUnit.framework in Frameworks */, - DB0F48FB17CA5212008798C5 /* Carbon.framework in Frameworks */, - DB0F48FC17CA5212008798C5 /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166D7C16A1D12400A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166DB016A1D2F600A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673219A54AD5004122E4 /* CoreVideo.framework in Frameworks */, - DB166DB116A1D2F600A1396C /* Cocoa.framework in Frameworks */, - DB166DB216A1D2F600A1396C /* CoreAudio.framework in Frameworks */, - DB166DB316A1D2F600A1396C /* ForceFeedback.framework in Frameworks */, - DB166DB416A1D2F600A1396C /* IOKit.framework in Frameworks */, - DB166DB516A1D2F600A1396C /* AudioToolbox.framework in Frameworks */, - DB166DB616A1D2F600A1396C /* CoreFoundation.framework in Frameworks */, - DB166DB816A1D2F600A1396C /* AudioUnit.framework in Frameworks */, - DB166DB916A1D2F600A1396C /* Carbon.framework in Frameworks */, - DB166DBA16A1D2F600A1396C /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166DC716A1D36A00A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673D19A54AF3004122E4 /* CoreVideo.framework in Frameworks */, - DB166DC816A1D36A00A1396C /* Cocoa.framework in Frameworks */, - DB166DC916A1D36A00A1396C /* CoreAudio.framework in Frameworks */, - DB166DCA16A1D36A00A1396C /* ForceFeedback.framework in Frameworks */, - DB166DCB16A1D36A00A1396C /* IOKit.framework in Frameworks */, - DB166DCC16A1D36A00A1396C /* AudioToolbox.framework in Frameworks */, - DB166DCD16A1D36A00A1396C /* CoreFoundation.framework in Frameworks */, - DB166DCF16A1D36A00A1396C /* AudioUnit.framework in Frameworks */, - DB166DD016A1D36A00A1396C /* Carbon.framework in Frameworks */, - DB166DD116A1D36A00A1396C /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166DDF16A1D50C00A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674319A54B04004122E4 /* CoreVideo.framework in Frameworks */, - DB166DE016A1D50C00A1396C /* Cocoa.framework in Frameworks */, - DB166DE116A1D50C00A1396C /* CoreAudio.framework in Frameworks */, - DB166DE216A1D50C00A1396C /* ForceFeedback.framework in Frameworks */, - DB166DE316A1D50C00A1396C /* IOKit.framework in Frameworks */, - DB166DE416A1D50C00A1396C /* AudioToolbox.framework in Frameworks */, - DB166DE516A1D50C00A1396C /* CoreFoundation.framework in Frameworks */, - DB166DE716A1D50C00A1396C /* AudioUnit.framework in Frameworks */, - DB166DE816A1D50C00A1396C /* Carbon.framework in Frameworks */, - DB166DE916A1D50C00A1396C /* libSDL2.a in Frameworks */, - DB166DEA16A1D50C00A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166DF616A1D57C00A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674419A54B06004122E4 /* CoreVideo.framework in Frameworks */, - DB166DF716A1D57C00A1396C /* Cocoa.framework in Frameworks */, - DB166DF816A1D57C00A1396C /* CoreAudio.framework in Frameworks */, - DB166DF916A1D57C00A1396C /* ForceFeedback.framework in Frameworks */, - DB166DFA16A1D57C00A1396C /* IOKit.framework in Frameworks */, - DB166DFB16A1D57C00A1396C /* AudioToolbox.framework in Frameworks */, - DB166DFC16A1D57C00A1396C /* CoreFoundation.framework in Frameworks */, - DB166DFE16A1D57C00A1396C /* AudioUnit.framework in Frameworks */, - DB166DFF16A1D57C00A1396C /* Carbon.framework in Frameworks */, - DB166E0016A1D57C00A1396C /* libSDL2.a in Frameworks */, - DB166E0116A1D57C00A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E0D16A1D5AD00A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674519A54B09004122E4 /* CoreVideo.framework in Frameworks */, - DB166E0E16A1D5AD00A1396C /* Cocoa.framework in Frameworks */, - DB166E0F16A1D5AD00A1396C /* CoreAudio.framework in Frameworks */, - DB166E1016A1D5AD00A1396C /* ForceFeedback.framework in Frameworks */, - DB166E1116A1D5AD00A1396C /* IOKit.framework in Frameworks */, - DB166E1216A1D5AD00A1396C /* AudioToolbox.framework in Frameworks */, - DB166E1316A1D5AD00A1396C /* CoreFoundation.framework in Frameworks */, - DB166E1516A1D5AD00A1396C /* AudioUnit.framework in Frameworks */, - DB166E1616A1D5AD00A1396C /* Carbon.framework in Frameworks */, - DB166E1716A1D5AD00A1396C /* libSDL2.a in Frameworks */, - DB166E1816A1D5AD00A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E2A16A1D64D00A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674719A54B0F004122E4 /* CoreVideo.framework in Frameworks */, - DB166E2B16A1D64D00A1396C /* Cocoa.framework in Frameworks */, - DB166E2C16A1D64D00A1396C /* CoreAudio.framework in Frameworks */, - DB166E2D16A1D64D00A1396C /* ForceFeedback.framework in Frameworks */, - DB166E2E16A1D64D00A1396C /* IOKit.framework in Frameworks */, - DB166E2F16A1D64D00A1396C /* AudioToolbox.framework in Frameworks */, - DB166E3016A1D64D00A1396C /* CoreFoundation.framework in Frameworks */, - DB166E3216A1D64D00A1396C /* AudioUnit.framework in Frameworks */, - DB166E3316A1D64D00A1396C /* Carbon.framework in Frameworks */, - DB166E3416A1D64D00A1396C /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E4016A1D69000A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674819A54B13004122E4 /* CoreVideo.framework in Frameworks */, - DB166E4116A1D69000A1396C /* Cocoa.framework in Frameworks */, - DB166E4216A1D69000A1396C /* CoreAudio.framework in Frameworks */, - DB166E4316A1D69000A1396C /* ForceFeedback.framework in Frameworks */, - DB166E4416A1D69000A1396C /* IOKit.framework in Frameworks */, - DB166E4516A1D69000A1396C /* AudioToolbox.framework in Frameworks */, - DB166E4616A1D69000A1396C /* CoreFoundation.framework in Frameworks */, - DB166E4816A1D69000A1396C /* AudioUnit.framework in Frameworks */, - DB166E4916A1D69000A1396C /* Carbon.framework in Frameworks */, - DB166E4A16A1D69000A1396C /* libSDL2.a in Frameworks */, - DB166E4B16A1D69000A1396C /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E5A16A1D6F300A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674A19A54B19004122E4 /* CoreVideo.framework in Frameworks */, - DB166E5B16A1D6F300A1396C /* Cocoa.framework in Frameworks */, - DB166E5C16A1D6F300A1396C /* CoreAudio.framework in Frameworks */, - DB166E5D16A1D6F300A1396C /* ForceFeedback.framework in Frameworks */, - DB166E5E16A1D6F300A1396C /* IOKit.framework in Frameworks */, - DB166E5F16A1D6F300A1396C /* AudioToolbox.framework in Frameworks */, - DB166E6016A1D6F300A1396C /* CoreFoundation.framework in Frameworks */, - DB166E6216A1D6F300A1396C /* AudioUnit.framework in Frameworks */, - DB166E6316A1D6F300A1396C /* Carbon.framework in Frameworks */, - DB166E6416A1D6F300A1396C /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E7016A1D78400A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674D19A54B22004122E4 /* CoreVideo.framework in Frameworks */, - DB166E7116A1D78400A1396C /* Cocoa.framework in Frameworks */, - DB166E7216A1D78400A1396C /* CoreAudio.framework in Frameworks */, - DB166E7316A1D78400A1396C /* ForceFeedback.framework in Frameworks */, - DB166E7416A1D78400A1396C /* IOKit.framework in Frameworks */, - DB166E7516A1D78400A1396C /* AudioToolbox.framework in Frameworks */, - DB166E7616A1D78400A1396C /* CoreFoundation.framework in Frameworks */, - DB166E7816A1D78400A1396C /* AudioUnit.framework in Frameworks */, - DB166E7916A1D78400A1396C /* Carbon.framework in Frameworks */, - DB166E7A16A1D78400A1396C /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E8316A1D78C00A1396C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73674E19A54B25004122E4 /* CoreVideo.framework in Frameworks */, - DB166E8416A1D78C00A1396C /* Cocoa.framework in Frameworks */, - DB166E8516A1D78C00A1396C /* CoreAudio.framework in Frameworks */, - DB166E8616A1D78C00A1396C /* ForceFeedback.framework in Frameworks */, - DB166E8716A1D78C00A1396C /* IOKit.framework in Frameworks */, - DB166E8816A1D78C00A1396C /* AudioToolbox.framework in Frameworks */, - DB166E8916A1D78C00A1396C /* CoreFoundation.framework in Frameworks */, - DB166E8B16A1D78C00A1396C /* AudioUnit.framework in Frameworks */, - DB166E8C16A1D78C00A1396C /* Carbon.framework in Frameworks */, - DB166E8D16A1D78C00A1396C /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB445EE918184B7000B306B0 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73672D19A54AC7004122E4 /* CoreVideo.framework in Frameworks */, - DB445EEA18184B7000B306B0 /* Cocoa.framework in Frameworks */, - DB445EEB18184B7000B306B0 /* CoreAudio.framework in Frameworks */, - DB445EEC18184B7000B306B0 /* ForceFeedback.framework in Frameworks */, - DB445EED18184B7000B306B0 /* IOKit.framework in Frameworks */, - DB445EEE18184B7000B306B0 /* AudioToolbox.framework in Frameworks */, - DB445EEF18184B7000B306B0 /* CoreFoundation.framework in Frameworks */, - DB445EF118184B7000B306B0 /* AudioUnit.framework in Frameworks */, - DB445EF218184B7000B306B0 /* Carbon.framework in Frameworks */, - DB445EF318184B7000B306B0 /* libSDL2.a in Frameworks */, - DB445EF418184B7000B306B0 /* libSDL_test.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB89957018A19ABA0092407C /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - FA73673519A54ADE004122E4 /* CoreVideo.framework in Frameworks */, - DB89957118A19ABA0092407C /* Cocoa.framework in Frameworks */, - DB89957218A19ABA0092407C /* CoreAudio.framework in Frameworks */, - DB89957318A19ABA0092407C /* ForceFeedback.framework in Frameworks */, - DB89957418A19ABA0092407C /* IOKit.framework in Frameworks */, - DB89957518A19ABA0092407C /* AudioToolbox.framework in Frameworks */, - DB89957618A19ABA0092407C /* CoreFoundation.framework in Frameworks */, - DB89957818A19ABA0092407C /* AudioUnit.framework in Frameworks */, - DB89957918A19ABA0092407C /* Carbon.framework in Frameworks */, - DB89957A18A19ABA0092407C /* libSDL2.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DBEC54DC1A1A81C3005B1EAB /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - DBEC54DD1A1A81C3005B1EAB /* CoreVideo.framework in Frameworks */, - DBEC54DE1A1A81C3005B1EAB /* Cocoa.framework in Frameworks */, - DBEC54DF1A1A81C3005B1EAB /* libSDL2.a in Frameworks */, - DBEC54E01A1A81C3005B1EAB /* CoreAudio.framework in Frameworks */, - DBEC54E11A1A81C3005B1EAB /* ForceFeedback.framework in Frameworks */, - DBEC54E21A1A81C3005B1EAB /* IOKit.framework in Frameworks */, - DBEC54E31A1A81C3005B1EAB /* AudioToolbox.framework in Frameworks */, - DBEC54E41A1A81C3005B1EAB /* CoreFoundation.framework in Frameworks */, - DBEC54E51A1A81C3005B1EAB /* AudioUnit.framework in Frameworks */, - DBEC54E61A1A81C3005B1EAB /* Carbon.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 002F33A209CA183B00EBEB88 /* Linked Frameworks */ = { - isa = PBXGroup; - children = ( - FA73672219A54A90004122E4 /* CoreVideo.framework */, - 002A869F10730593007319AE /* AudioToolbox.framework */, - 002A871410730623007319AE /* AudioUnit.framework */, - 002A873910730675007319AE /* Carbon.framework */, - 002F33A709CA188600EBEB88 /* Cocoa.framework */, - 002A863B10730545007319AE /* CoreAudio.framework */, - 002A86A010730593007319AE /* CoreFoundation.framework */, - 002A863C10730545007319AE /* ForceFeedback.framework */, - 002A863D10730545007319AE /* IOKit.framework */, - ); - name = "Linked Frameworks"; - sourceTree = ""; - }; - 003FA63B093FFD41000C53B3 /* Products */ = { - isa = PBXGroup; - children = ( - 003FA643093FFD41000C53B3 /* SDL2.framework */, - 003FA645093FFD41000C53B3 /* libSDL2.a */, - DB1D40D717B3F30D00D74CFC /* libSDL2.dylib */, - 003FA649093FFD41000C53B3 /* Standard DMG */, - ); - name = Products; - sourceTree = ""; - }; - 00794E4609D207B4003FC8A1 /* Resources */ = { - isa = PBXGroup; - children = ( - DBEC54D61A1A8145005B1EAB /* axis.bmp */, - DBEC54D71A1A8145005B1EAB /* button.bmp */, - DBEC54D81A1A8145005B1EAB /* controllermap.bmp */, - 00794E5D09D20839003FC8A1 /* icon.bmp */, - 00794E5E09D20839003FC8A1 /* moose.dat */, - 00794E5F09D20839003FC8A1 /* picture.xbm */, - 00794E6109D20839003FC8A1 /* sample.bmp */, - 00794E6209D20839003FC8A1 /* sample.wav */, - DB166ECF16A1D87000A1396C /* shapes */, - DBBC552C182831D700F3CA8D /* TestDropFile-Info.plist */, - 00794E6309D20839003FC8A1 /* utf8.txt */, - ); - name = Resources; - sourceTree = ""; - }; - 08FB7794FE84155DC02AAC07 /* SDLTest */ = { - isa = PBXGroup; - children = ( - 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */, - 08FB7795FE84155DC02AAC07 /* Source */, - DB166D8316A1D17E00A1396C /* SDL_Test */, - 002F33A209CA183B00EBEB88 /* Linked Frameworks */, - 00794E4609D207B4003FC8A1 /* Resources */, - 1AB674ADFE9D54B511CA2CBB /* Products */, - ); - comments = "I made these tests link against our \"default\" framework which includes X11 stuff. If you didn't install the X11 headers with Xcode, you might have problems building the SDL.framework (which is a dependency). You can swap the dependencies around to get around this, or you can modify the default SDL.framework target to not include X11 stuff. (Go into its target build options and remove all the Preprocessor macros.)\n\n\n\nWe are sort of in a half-way state at the moment. Going \"all-the-way\" means we copy the SDL.framework inside the app bundle so we can run the test without the step of the user \"installing\" the framework. But there is an oversight/bug in Xcode that doesn't correctly find the location of the framework when in an embedded/nested Xcode project. We could probably try to hack this with a shell script that checks multiple directories for existence, but this is messier and more work than I prefer, so I rather just wait for Apple to fix this. In the meantime...\n\nThe \"All\" target will build the SDL framework from the Xcode project. The other targets do not have this dependency set (for flexibility reasons in case we make changes). If you have not built the framework, you will probably be unable to link. You will either need to build the framework, or you need to add \"-framework SDL\" to the link options and make sure you have the SDL.framework installed somewhere where it can be seen (like /Library/Frameworks...I think we already set this one up.) \n\nTo run though, you should have a copy of the SDL.framework in /Library/Frameworks or ~/Library/Frameworks.\n\n\n\n\ntestgl and testdyngl need -DHAVE_OPENGL\ntestgl needs to link against OpenGL.framework\n\n"; - name = SDLTest; - sourceTree = ""; - }; - 08FB7795FE84155DC02AAC07 /* Source */ = { - isa = PBXGroup; - children = ( - 092D6D10FFB30A2C7F000001 /* checkkeys.c */, - DBEC54D11A1A811D005B1EAB /* controllermap.c */, - 083E4872006D84C97F000001 /* loopwave.c */, - 0017958F1074216E00F5D044 /* testatomic.c */, - 001795B01074222D00F5D044 /* testaudioinfo.c */, - 001797711074320D00F5D044 /* testdraw2.c */, - DB0F48D717CA51D2008798C5 /* testdrawchessboard.c */, - DB445EFA18184BB600B306B0 /* testdropfile.c */, - 083E4878006D85357F000001 /* testerror.c */, - 002F341709CA1C5B00EBEB88 /* testfile.c */, - DB0F48D817CA51D2008798C5 /* testfilesystem.c */, - BBFC088E164C6820003E6A99 /* testgamecontroller.c */, - DB166CBB16A1C74100A1396C /* testgesture.c */, - 0017972710742FB900F5D044 /* testgl2.c */, - DB166CBC16A1C74100A1396C /* testgles.c */, - 0017974E1074315700F5D044 /* testhaptic.c */, - DB89958318A19B130092407C /* testhotplug.c */, - 002F343609CA1F6F00EBEB88 /* testiconv.c */, - 00179791107432FA00F5D044 /* testime.c */, - 001797B31074339C00F5D044 /* testintersections.c */, - 092D6D62FFB312AA7F000001 /* testjoystick.c */, - 092D6D6CFFB313437F000001 /* testkeys.c */, - 001797D31074343E00F5D044 /* testloadso.c */, - 092D6D75FFB313BB7F000001 /* testlock.c */, - DB166CBD16A1C74100A1396C /* testmessage.c */, - 001798151074359B00F5D044 /* testmultiaudio.c */, - 0017985A107436ED00F5D044 /* testnative.c */, - 0017985B107436ED00F5D044 /* testnative.h */, - 0017985C107436ED00F5D044 /* testnativecocoa.m */, - 00179872107438D000F5D044 /* testnativex11.c */, - 002F345209CA201C00EBEB88 /* testoverlay2.c */, - 002F346F09CA20A600EBEB88 /* testplatform.c */, - 001798B910743A4900F5D044 /* testpower.c */, - DB166CBF16A1C74100A1396C /* testrelative.c */, - DB166CC016A1C74100A1396C /* testrendercopyex.c */, - DB166CC116A1C74100A1396C /* testrendertarget.c */, - 001798F910743E9200F5D044 /* testresample.c */, - DB166CC216A1C74100A1396C /* testrumble.c */, - DB166CC316A1C74100A1396C /* testscale.c */, - 083E487E006D86A17F000001 /* testsem.c */, - DB166CC416A1C74100A1396C /* testshader.c */, - 453774A4120915E3002F0F45 /* testshape.c */, - 0017991910743F5300F5D044 /* testsprite2.c */, - DB166CC516A1C74100A1396C /* testspriteminimal.c */, - DB166CC616A1C74100A1396C /* teststreaming.c */, - 092D6D58FFB311A97F000001 /* testthread.c */, - 083E4880006D86A17F000001 /* testtimer.c */, - 083E4882006D86A17F000001 /* testver.c */, - 0017993B10743FEF00F5D044 /* testwm2.c */, - 083E4887006D86A17F000001 /* torturethread.c */, - ); - name = Source; - sourceTree = ""; - }; - 1AB674ADFE9D54B511CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - BEC566B60761D90300A33029 /* checkkeys */, - BEC566D10761D90300A33029 /* loopwave */, - BEC567060761D90400A33029 /* testerror */, - BEC5672E0761D90400A33029 /* testthread */, - BEC5673B0761D90400A33029 /* testjoystick */, - BEC567480761D90400A33029 /* testkeys */, - BEC567550761D90400A33029 /* testlock */, - BEC5677D0761D90500A33029 /* testsem */, - BEC567980761D90500A33029 /* testtimer */, - BEC567B20761D90500A33029 /* testversion */, - BEC567F50761D90600A33029 /* torturethread */, - 002F341209CA1BFF00EBEB88 /* testfile */, - 002F343109CA1F0300EBEB88 /* testiconv */, - 002F344D09CA1FB300EBEB88 /* testoverlay2 */, - 002F346A09CA204F00EBEB88 /* testplatform */, - 0017958C10741F7900F5D044 /* testatomic */, - 001795AD107421BF00F5D044 /* testaudioinfo */, - 0017972110742F3200F5D044 /* testgl2 */, - 00179748107430D600F5D044 /* testhaptic */, - 0017976E107431B300F5D044 /* testdraw2 */, - 0017978E107432AE00F5D044 /* testime */, - 001797AE1074334C00F5D044 /* testintersections */, - 001797D0107433C600F5D044 /* testloadso */, - 001798121074355200F5D044 /* testmultiaudio */, - 001798941074392D00F5D044 /* testnative */, - 001798B5107439DF00F5D044 /* testpower */, - 001798F210743BEC00F5D044 /* testresample */, - 0017991610743F1000F5D044 /* testsprite2 */, - 0017993810743FB700F5D044 /* testwm2 */, - 4537749212091504002F0F45 /* testshape */, - BBFC08CD164C6862003E6A99 /* testgamecontroller */, - DB166D7F16A1D12400A1396C /* libSDL_test.a */, - DB166DBF16A1D2F600A1396C /* testgesture */, - DB166DD516A1D36A00A1396C /* testmessage */, - DB166DEE16A1D50C00A1396C /* testrelative */, - DB166E0516A1D57C00A1396C /* testrendercopyex */, - DB166E1C16A1D5AD00A1396C /* testrendertarget */, - DB166E3816A1D64D00A1396C /* testrumble */, - DB166E5216A1D69000A1396C /* testscale */, - DB166E6816A1D6F300A1396C /* testshader */, - DB166E7E16A1D78400A1396C /* testspriteminimal */, - DB166E9116A1D78C00A1396C /* teststreaming */, - DB0F48EC17CA51E5008798C5 /* testdrawchessboard */, - DB0F490117CA5212008798C5 /* testfilesystem */, - DB89957E18A19ABA0092407C /* testhotplug */, - DB445EF818184B7000B306B0 /* testdropfile.app */, - DBEC54EA1A1A81C3005B1EAB /* controllermap */, - ); - name = Products; - sourceTree = ""; - }; - DB166D8316A1D17E00A1396C /* SDL_Test */ = { - isa = PBXGroup; - children = ( - DB166D8416A1D1A500A1396C /* SDL_test_assert.c */, - DB166D8516A1D1A500A1396C /* SDL_test_common.c */, - DB166D8616A1D1A500A1396C /* SDL_test_compare.c */, - DB166D8716A1D1A500A1396C /* SDL_test_crc32.c */, - DB166D8816A1D1A500A1396C /* SDL_test_font.c */, - DB166D8916A1D1A500A1396C /* SDL_test_fuzzer.c */, - DB166D8A16A1D1A500A1396C /* SDL_test_harness.c */, - DB166D8B16A1D1A500A1396C /* SDL_test_imageBlit.c */, - DB166D8C16A1D1A500A1396C /* SDL_test_imageBlitBlend.c */, - DB166D8D16A1D1A500A1396C /* SDL_test_imageFace.c */, - DB166D8E16A1D1A500A1396C /* SDL_test_imagePrimitives.c */, - DB166D8F16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c */, - DB166D9016A1D1A500A1396C /* SDL_test_log.c */, - DB166D9116A1D1A500A1396C /* SDL_test_md5.c */, - DB166D9216A1D1A500A1396C /* SDL_test_random.c */, - ); - name = SDL_Test; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - DB166D7D16A1D12400A1396C /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 0017957410741F7900F5D044 /* testatomic */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0017958610741F7900F5D044 /* Build configuration list for PBXNativeTarget "testatomic" */; - buildPhases = ( - 0017957910741F7900F5D044 /* Sources */, - 0017957A10741F7900F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testatomic; - productName = testalpha; - productReference = 0017958C10741F7900F5D044 /* testatomic */; - productType = "com.apple.product-type.tool"; - }; - 00179595107421BF00F5D044 /* testaudioinfo */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001795A7107421BF00F5D044 /* Build configuration list for PBXNativeTarget "testaudioinfo" */; - buildPhases = ( - 0017959A107421BF00F5D044 /* Sources */, - 0017959B107421BF00F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testaudioinfo; - productName = testalpha; - productReference = 001795AD107421BF00F5D044 /* testaudioinfo */; - productType = "com.apple.product-type.tool"; - }; - 0017970910742F3200F5D044 /* testgl2 */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0017971B10742F3200F5D044 /* Build configuration list for PBXNativeTarget "testgl2" */; - buildPhases = ( - 0017970E10742F3200F5D044 /* Sources */, - 0017970F10742F3200F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testgl2; - productName = testalpha; - productReference = 0017972110742F3200F5D044 /* testgl2 */; - productType = "com.apple.product-type.tool"; - }; - 00179730107430D600F5D044 /* testhaptic */ = { - isa = PBXNativeTarget; - buildConfigurationList = 00179742107430D600F5D044 /* Build configuration list for PBXNativeTarget "testhaptic" */; - buildPhases = ( - 00179735107430D600F5D044 /* Sources */, - 00179736107430D600F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testhaptic; - productName = testalpha; - productReference = 00179748107430D600F5D044 /* testhaptic */; - productType = "com.apple.product-type.tool"; - }; - 00179756107431B300F5D044 /* testdraw2 */ = { - isa = PBXNativeTarget; - buildConfigurationList = 00179768107431B300F5D044 /* Build configuration list for PBXNativeTarget "testdraw2" */; - buildPhases = ( - 0017975B107431B300F5D044 /* Sources */, - 0017975C107431B300F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testdraw2; - productName = testalpha; - productReference = 0017976E107431B300F5D044 /* testdraw2 */; - productType = "com.apple.product-type.tool"; - }; - 00179776107432AE00F5D044 /* testime */ = { - isa = PBXNativeTarget; - buildConfigurationList = 00179788107432AE00F5D044 /* Build configuration list for PBXNativeTarget "testime" */; - buildPhases = ( - 0017977B107432AE00F5D044 /* Sources */, - 0017977C107432AE00F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testime; - productName = testalpha; - productReference = 0017978E107432AE00F5D044 /* testime */; - productType = "com.apple.product-type.tool"; - }; - 001797961074334C00F5D044 /* testintersections */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001797A81074334C00F5D044 /* Build configuration list for PBXNativeTarget "testintersections" */; - buildPhases = ( - 0017979B1074334C00F5D044 /* Sources */, - 0017979C1074334C00F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testintersections; - productName = testalpha; - productReference = 001797AE1074334C00F5D044 /* testintersections */; - productType = "com.apple.product-type.tool"; - }; - 001797B8107433C600F5D044 /* testloadso */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001797CA107433C600F5D044 /* Build configuration list for PBXNativeTarget "testloadso" */; - buildPhases = ( - 001797BD107433C600F5D044 /* Sources */, - 001797BE107433C600F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testloadso; - productName = testalpha; - productReference = 001797D0107433C600F5D044 /* testloadso */; - productType = "com.apple.product-type.tool"; - }; - 001797FA1074355200F5D044 /* testmultiaudio */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0017980C1074355200F5D044 /* Build configuration list for PBXNativeTarget "testmultiaudio" */; - buildPhases = ( - 001797FF1074355200F5D044 /* Sources */, - 001798001074355200F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testmultiaudio; - productName = testalpha; - productReference = 001798121074355200F5D044 /* testmultiaudio */; - productType = "com.apple.product-type.tool"; - }; - 001798781074392D00F5D044 /* testnative */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0017988E1074392D00F5D044 /* Build configuration list for PBXNativeTarget "testnative" */; - buildPhases = ( - 0017987E1074392D00F5D044 /* Sources */, - 001798821074392D00F5D044 /* Frameworks */, - DB166DDA16A1D40F00A1396C /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testnative; - productName = testalpha; - productReference = 001798941074392D00F5D044 /* testnative */; - productType = "com.apple.product-type.tool"; - }; - 0017989D107439DF00F5D044 /* testpower */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001798AF107439DF00F5D044 /* Build configuration list for PBXNativeTarget "testpower" */; - buildPhases = ( - 001798A2107439DF00F5D044 /* Sources */, - 001798A3107439DF00F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testpower; - productName = testalpha; - productReference = 001798B5107439DF00F5D044 /* testpower */; - productType = "com.apple.product-type.tool"; - }; - 001798DA10743BEC00F5D044 /* testresample */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001798EC10743BEC00F5D044 /* Build configuration list for PBXNativeTarget "testresample" */; - buildPhases = ( - 001798DF10743BEC00F5D044 /* Sources */, - 001798E010743BEC00F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testresample; - productName = testalpha; - productReference = 001798F210743BEC00F5D044 /* testresample */; - productType = "com.apple.product-type.tool"; - }; - 001798FE10743F1000F5D044 /* testsprite2 */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0017991010743F1000F5D044 /* Build configuration list for PBXNativeTarget "testsprite2" */; - buildPhases = ( - 0017990310743F1000F5D044 /* Sources */, - 0017990410743F1000F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testsprite2; - productName = testalpha; - productReference = 0017991610743F1000F5D044 /* testsprite2 */; - productType = "com.apple.product-type.tool"; - }; - 0017992010743FB700F5D044 /* testwm2 */ = { - isa = PBXNativeTarget; - buildConfigurationList = 0017993210743FB700F5D044 /* Build configuration list for PBXNativeTarget "testwm2" */; - buildPhases = ( - 0017992510743FB700F5D044 /* Sources */, - 0017992610743FB700F5D044 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testwm2; - productName = testalpha; - productReference = 0017993810743FB700F5D044 /* testwm2 */; - productType = "com.apple.product-type.tool"; - }; - 002F340109CA1BFF00EBEB88 /* testfile */ = { - isa = PBXNativeTarget; - buildConfigurationList = 002F340E09CA1BFF00EBEB88 /* Build configuration list for PBXNativeTarget "testfile" */; - buildPhases = ( - 002F340709CA1BFF00EBEB88 /* Sources */, - 002F340809CA1BFF00EBEB88 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testfile; - productName = testalpha; - productReference = 002F341209CA1BFF00EBEB88 /* testfile */; - productType = "com.apple.product-type.tool"; - }; - 002F342009CA1F0300EBEB88 /* testiconv */ = { - isa = PBXNativeTarget; - buildConfigurationList = 002F342D09CA1F0300EBEB88 /* Build configuration list for PBXNativeTarget "testiconv" */; - buildPhases = ( - 002F342609CA1F0300EBEB88 /* Sources */, - 002F342709CA1F0300EBEB88 /* Frameworks */, - 00794EEC09D2371F003FC8A1 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testiconv; - productName = testalpha; - productReference = 002F343109CA1F0300EBEB88 /* testiconv */; - productType = "com.apple.product-type.tool"; - }; - 002F343C09CA1FB300EBEB88 /* testoverlay2 */ = { - isa = PBXNativeTarget; - buildConfigurationList = 002F344909CA1FB300EBEB88 /* Build configuration list for PBXNativeTarget "testoverlay2" */; - buildPhases = ( - 002F344209CA1FB300EBEB88 /* Sources */, - 002F344309CA1FB300EBEB88 /* Frameworks */, - 00794EF409D237C7003FC8A1 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testoverlay2; - productName = testalpha; - productReference = 002F344D09CA1FB300EBEB88 /* testoverlay2 */; - productType = "com.apple.product-type.tool"; - }; - 002F345909CA204F00EBEB88 /* testplatform */ = { - isa = PBXNativeTarget; - buildConfigurationList = 002F346609CA204F00EBEB88 /* Build configuration list for PBXNativeTarget "testplatform" */; - buildPhases = ( - 002F345F09CA204F00EBEB88 /* Sources */, - 002F346009CA204F00EBEB88 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testplatform; - productName = testalpha; - productReference = 002F346A09CA204F00EBEB88 /* testplatform */; - productType = "com.apple.product-type.tool"; - }; - 4537749112091504002F0F45 /* testshape */ = { - isa = PBXNativeTarget; - buildConfigurationList = 4537749A1209150C002F0F45 /* Build configuration list for PBXNativeTarget "testshape" */; - buildPhases = ( - 4537748F12091504002F0F45 /* Sources */, - 4537749012091504002F0F45 /* Frameworks */, - DB166ECE16A1D85400A1396C /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testshape; - productName = testshape; - productReference = 4537749212091504002F0F45 /* testshape */; - productType = "com.apple.product-type.tool"; - }; - BBFC08B7164C6862003E6A99 /* testgamecontroller */ = { - isa = PBXNativeTarget; - buildConfigurationList = BBFC08CA164C6862003E6A99 /* Build configuration list for PBXNativeTarget "testgamecontroller" */; - buildPhases = ( - BBFC08BC164C6862003E6A99 /* Sources */, - BBFC08BE164C6862003E6A99 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testgamecontroller; - productName = testjoystick; - productReference = BBFC08CD164C6862003E6A99 /* testgamecontroller */; - productType = "com.apple.product-type.tool"; - }; - BEC566AB0761D90300A33029 /* checkkeys */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B593808BDB826006539E9 /* Build configuration list for PBXNativeTarget "checkkeys" */; - buildPhases = ( - BEC566B00761D90300A33029 /* Sources */, - BEC566B20761D90300A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = checkkeys; - productName = checkkeys; - productReference = BEC566B60761D90300A33029 /* checkkeys */; - productType = "com.apple.product-type.tool"; - }; - BEC566C50761D90300A33029 /* loopwave */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B594008BDB826006539E9 /* Build configuration list for PBXNativeTarget "loopwave" */; - buildPhases = ( - BEC566CA0761D90300A33029 /* Sources */, - BEC566CC0761D90300A33029 /* Frameworks */, - 00794E6409D2084F003FC8A1 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = loopwave; - productName = loopwave; - productReference = BEC566D10761D90300A33029 /* loopwave */; - productType = "com.apple.product-type.tool"; - }; - BEC566FB0761D90300A33029 /* testerror */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B595008BDB826006539E9 /* Build configuration list for PBXNativeTarget "testerror" */; - buildPhases = ( - BEC567000761D90300A33029 /* Sources */, - BEC567020761D90300A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testerror; - productName = testerror; - productReference = BEC567060761D90400A33029 /* testerror */; - productType = "com.apple.product-type.tool"; - }; - BEC567230761D90400A33029 /* testthread */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B595C08BDB826006539E9 /* Build configuration list for PBXNativeTarget "testthread" */; - buildPhases = ( - BEC567280761D90400A33029 /* Sources */, - BEC5672A0761D90400A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testthread; - productName = testthread; - productReference = BEC5672E0761D90400A33029 /* testthread */; - productType = "com.apple.product-type.tool"; - }; - BEC567300761D90400A33029 /* testjoystick */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B596008BDB826006539E9 /* Build configuration list for PBXNativeTarget "testjoystick" */; - buildPhases = ( - BEC567350761D90400A33029 /* Sources */, - BEC567370761D90400A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testjoystick; - productName = testjoystick; - productReference = BEC5673B0761D90400A33029 /* testjoystick */; - productType = "com.apple.product-type.tool"; - }; - BEC5673D0761D90400A33029 /* testkeys */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B596408BDB826006539E9 /* Build configuration list for PBXNativeTarget "testkeys" */; - buildPhases = ( - BEC567420761D90400A33029 /* Sources */, - BEC567440761D90400A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testkeys; - productName = testkeys; - productReference = BEC567480761D90400A33029 /* testkeys */; - productType = "com.apple.product-type.tool"; - }; - BEC5674A0761D90400A33029 /* testlock */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B596808BDB826006539E9 /* Build configuration list for PBXNativeTarget "testlock" */; - buildPhases = ( - BEC5674F0761D90400A33029 /* Sources */, - BEC567510761D90400A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testlock; - productName = testlock; - productReference = BEC567550761D90400A33029 /* testlock */; - productType = "com.apple.product-type.tool"; - }; - BEC567720761D90500A33029 /* testsem */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B597008BDB826006539E9 /* Build configuration list for PBXNativeTarget "testsem" */; - buildPhases = ( - BEC567770761D90500A33029 /* Sources */, - BEC567790761D90500A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testsem; - productName = testsem; - productReference = BEC5677D0761D90500A33029 /* testsem */; - productType = "com.apple.product-type.tool"; - }; - BEC5678D0761D90500A33029 /* testtimer */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B597808BDB826006539E9 /* Build configuration list for PBXNativeTarget "testtimer" */; - buildPhases = ( - BEC567920761D90500A33029 /* Sources */, - BEC567940761D90500A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testtimer; - productName = testtimer; - productReference = BEC567980761D90500A33029 /* testtimer */; - productType = "com.apple.product-type.tool"; - }; - BEC567A70761D90500A33029 /* testversion */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B598008BDB826006539E9 /* Build configuration list for PBXNativeTarget "testversion" */; - buildPhases = ( - BEC567AC0761D90500A33029 /* Sources */, - BEC567AE0761D90500A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testversion; - productName = testversion; - productReference = BEC567B20761D90500A33029 /* testversion */; - productType = "com.apple.product-type.tool"; - }; - BEC567EA0761D90600A33029 /* torturethread */ = { - isa = PBXNativeTarget; - buildConfigurationList = 001B599408BDB826006539E9 /* Build configuration list for PBXNativeTarget "torturethread" */; - buildPhases = ( - BEC567EF0761D90600A33029 /* Sources */, - BEC567F10761D90600A33029 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = torturethread; - productName = torturethread; - productReference = BEC567F50761D90600A33029 /* torturethread */; - productType = "com.apple.product-type.tool"; - }; - DB0F48D917CA51E5008798C5 /* testdrawchessboard */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB0F48E917CA51E5008798C5 /* Build configuration list for PBXNativeTarget "testdrawchessboard" */; - buildPhases = ( - DB0F48DA17CA51E5008798C5 /* Sources */, - DB0F48DC17CA51E5008798C5 /* Frameworks */, - DB0F48E717CA51E5008798C5 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testdrawchessboard; - productName = testalpha; - productReference = DB0F48EC17CA51E5008798C5 /* testdrawchessboard */; - productType = "com.apple.product-type.tool"; - }; - DB0F48EF17CA5212008798C5 /* testfilesystem */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB0F48FE17CA5212008798C5 /* Build configuration list for PBXNativeTarget "testfilesystem" */; - buildPhases = ( - DB0F48F017CA5212008798C5 /* Sources */, - DB0F48F217CA5212008798C5 /* Frameworks */, - DB0F48FD17CA5212008798C5 /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testfilesystem; - productName = testalpha; - productReference = DB0F490117CA5212008798C5 /* testfilesystem */; - productType = "com.apple.product-type.tool"; - }; - DB166D7E16A1D12400A1396C /* SDL_test */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166D8016A1D12400A1396C /* Build configuration list for PBXNativeTarget "SDL_test" */; - buildPhases = ( - DB166D7B16A1D12400A1396C /* Sources */, - DB166D7C16A1D12400A1396C /* Frameworks */, - DB166D7D16A1D12400A1396C /* Headers */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = SDL_test; - productName = SDL_test; - productReference = DB166D7F16A1D12400A1396C /* libSDL_test.a */; - productType = "com.apple.product-type.library.static"; - }; - DB166DAD16A1D2F600A1396C /* testgesture */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166DBC16A1D2F600A1396C /* Build configuration list for PBXNativeTarget "testgesture" */; - buildPhases = ( - DB166DAE16A1D2F600A1396C /* Sources */, - DB166DB016A1D2F600A1396C /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testgesture; - productName = testalpha; - productReference = DB166DBF16A1D2F600A1396C /* testgesture */; - productType = "com.apple.product-type.tool"; - }; - DB166DC416A1D36A00A1396C /* testmessage */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166DD216A1D36A00A1396C /* Build configuration list for PBXNativeTarget "testmessage" */; - buildPhases = ( - DB166DC516A1D36A00A1396C /* Sources */, - DB166DC716A1D36A00A1396C /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testmessage; - productName = testalpha; - productReference = DB166DD516A1D36A00A1396C /* testmessage */; - productType = "com.apple.product-type.tool"; - }; - DB166DDC16A1D50C00A1396C /* testrelative */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166DEB16A1D50C00A1396C /* Build configuration list for PBXNativeTarget "testrelative" */; - buildPhases = ( - DB166DDD16A1D50C00A1396C /* Sources */, - DB166DDF16A1D50C00A1396C /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testrelative; - productName = testalpha; - productReference = DB166DEE16A1D50C00A1396C /* testrelative */; - productType = "com.apple.product-type.tool"; - }; - DB166DF316A1D57C00A1396C /* testrendercopyex */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166E0216A1D57C00A1396C /* Build configuration list for PBXNativeTarget "testrendercopyex" */; - buildPhases = ( - DB166DF416A1D57C00A1396C /* Sources */, - DB166DF616A1D57C00A1396C /* Frameworks */, - DB166E2116A1D5DF00A1396C /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testrendercopyex; - productName = testalpha; - productReference = DB166E0516A1D57C00A1396C /* testrendercopyex */; - productType = "com.apple.product-type.tool"; - }; - DB166E0A16A1D5AD00A1396C /* testrendertarget */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166E1916A1D5AD00A1396C /* Build configuration list for PBXNativeTarget "testrendertarget" */; - buildPhases = ( - DB166E0B16A1D5AD00A1396C /* Sources */, - DB166E0D16A1D5AD00A1396C /* Frameworks */, - DB166E2416A1D61000A1396C /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testrendertarget; - productName = testalpha; - productReference = DB166E1C16A1D5AD00A1396C /* testrendertarget */; - productType = "com.apple.product-type.tool"; - }; - DB166E2716A1D64D00A1396C /* testrumble */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166E3516A1D64D00A1396C /* Build configuration list for PBXNativeTarget "testrumble" */; - buildPhases = ( - DB166E2816A1D64D00A1396C /* Sources */, - DB166E2A16A1D64D00A1396C /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testrumble; - productName = testalpha; - productReference = DB166E3816A1D64D00A1396C /* testrumble */; - productType = "com.apple.product-type.tool"; - }; - DB166E3D16A1D69000A1396C /* testscale */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166E4F16A1D69000A1396C /* Build configuration list for PBXNativeTarget "testscale" */; - buildPhases = ( - DB166E3E16A1D69000A1396C /* Sources */, - DB166E4016A1D69000A1396C /* Frameworks */, - DB166E4C16A1D69000A1396C /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testscale; - productName = testalpha; - productReference = DB166E5216A1D69000A1396C /* testscale */; - productType = "com.apple.product-type.tool"; - }; - DB166E5716A1D6F300A1396C /* testshader */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166E6516A1D6F300A1396C /* Build configuration list for PBXNativeTarget "testshader" */; - buildPhases = ( - DB166E5816A1D6F300A1396C /* Sources */, - DB166E5A16A1D6F300A1396C /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testshader; - productName = testsem; - productReference = DB166E6816A1D6F300A1396C /* testshader */; - productType = "com.apple.product-type.tool"; - }; - DB166E6D16A1D78400A1396C /* testspriteminimal */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166E7B16A1D78400A1396C /* Build configuration list for PBXNativeTarget "testspriteminimal" */; - buildPhases = ( - DB166E6E16A1D78400A1396C /* Sources */, - DB166E7016A1D78400A1396C /* Frameworks */, - DB166E9B16A1D7FC00A1396C /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testspriteminimal; - productName = testspriteminimal; - productReference = DB166E7E16A1D78400A1396C /* testspriteminimal */; - productType = "com.apple.product-type.tool"; - }; - DB166E8016A1D78C00A1396C /* teststreaming */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB166E8E16A1D78C00A1396C /* Build configuration list for PBXNativeTarget "teststreaming" */; - buildPhases = ( - DB166E8116A1D78C00A1396C /* Sources */, - DB166E8316A1D78C00A1396C /* Frameworks */, - DB166E9916A1D7EE00A1396C /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = teststreaming; - productName = teststreaming; - productReference = DB166E9116A1D78C00A1396C /* teststreaming */; - productType = "com.apple.product-type.tool"; - }; - DB445EE618184B7000B306B0 /* testdropfile */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB445EF518184B7000B306B0 /* Build configuration list for PBXNativeTarget "testdropfile" */; - buildPhases = ( - DB445EE718184B7000B306B0 /* Sources */, - DB445EE918184B7000B306B0 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testdropfile; - productName = testdropfile; - productReference = DB445EF818184B7000B306B0 /* testdropfile.app */; - productType = "com.apple.product-type.application"; - }; - DB89956D18A19ABA0092407C /* testhotplug */ = { - isa = PBXNativeTarget; - buildConfigurationList = DB89957B18A19ABA0092407C /* Build configuration list for PBXNativeTarget "testhotplug" */; - buildPhases = ( - DB89956E18A19ABA0092407C /* Sources */, - DB89957018A19ABA0092407C /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = testhotplug; - productName = testalpha; - productReference = DB89957E18A19ABA0092407C /* testhotplug */; - productType = "com.apple.product-type.tool"; - }; - DBEC54D91A1A81C3005B1EAB /* controllermap */ = { - isa = PBXNativeTarget; - buildConfigurationList = DBEC54E71A1A81C3005B1EAB /* Build configuration list for PBXNativeTarget "controllermap" */; - buildPhases = ( - DBEC54DA1A1A81C3005B1EAB /* Sources */, - DBEC54DC1A1A81C3005B1EAB /* Frameworks */, - DBEC54EC1A1A827C005B1EAB /* CopyFiles */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = controllermap; - productName = checkkeys; - productReference = DBEC54EA1A1A81C3005B1EAB /* controllermap */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 08FB7793FE84155DC02AAC07 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0420; - }; - buildConfigurationList = 001B5A0C08BDB826006539E9 /* Build configuration list for PBXProject "SDLTest" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - en, - ); - mainGroup = 08FB7794FE84155DC02AAC07 /* SDLTest */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 003FA63B093FFD41000C53B3 /* Products */; - ProjectRef = 003FA63A093FFD41000C53B3 /* SDL.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - BEC566920761D90300A33029 /* All */, - DB166D7E16A1D12400A1396C /* SDL_test */, - BEC566AB0761D90300A33029 /* checkkeys */, - DBEC54D91A1A81C3005B1EAB /* controllermap */, - BEC566C50761D90300A33029 /* loopwave */, - 0017957410741F7900F5D044 /* testatomic */, - 00179595107421BF00F5D044 /* testaudioinfo */, - 00179756107431B300F5D044 /* testdraw2 */, - DB0F48D917CA51E5008798C5 /* testdrawchessboard */, - DB445EE618184B7000B306B0 /* testdropfile */, - BEC566FB0761D90300A33029 /* testerror */, - 002F340109CA1BFF00EBEB88 /* testfile */, - DB0F48EF17CA5212008798C5 /* testfilesystem */, - BBFC08B7164C6862003E6A99 /* testgamecontroller */, - DB166DAD16A1D2F600A1396C /* testgesture */, - 0017970910742F3200F5D044 /* testgl2 */, - 00179730107430D600F5D044 /* testhaptic */, - DB89956D18A19ABA0092407C /* testhotplug */, - 002F342009CA1F0300EBEB88 /* testiconv */, - 00179776107432AE00F5D044 /* testime */, - 001797961074334C00F5D044 /* testintersections */, - BEC567300761D90400A33029 /* testjoystick */, - BEC5673D0761D90400A33029 /* testkeys */, - 001797B8107433C600F5D044 /* testloadso */, - BEC5674A0761D90400A33029 /* testlock */, - DB166DC416A1D36A00A1396C /* testmessage */, - 001797FA1074355200F5D044 /* testmultiaudio */, - 001798781074392D00F5D044 /* testnative */, - 002F343C09CA1FB300EBEB88 /* testoverlay2 */, - 002F345909CA204F00EBEB88 /* testplatform */, - 0017989D107439DF00F5D044 /* testpower */, - DB166DDC16A1D50C00A1396C /* testrelative */, - DB166DF316A1D57C00A1396C /* testrendercopyex */, - DB166E0A16A1D5AD00A1396C /* testrendertarget */, - 001798DA10743BEC00F5D044 /* testresample */, - DB166E2716A1D64D00A1396C /* testrumble */, - DB166E3D16A1D69000A1396C /* testscale */, - BEC567720761D90500A33029 /* testsem */, - DB166E5716A1D6F300A1396C /* testshader */, - 4537749112091504002F0F45 /* testshape */, - 001798FE10743F1000F5D044 /* testsprite2 */, - DB166E6D16A1D78400A1396C /* testspriteminimal */, - DB166E8016A1D78C00A1396C /* teststreaming */, - BEC567230761D90400A33029 /* testthread */, - BEC5678D0761D90500A33029 /* testtimer */, - BEC567A70761D90500A33029 /* testversion */, - 0017992010743FB700F5D044 /* testwm2 */, - BEC567EA0761D90600A33029 /* torturethread */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - 003FA643093FFD41000C53B3 /* SDL2.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = SDL2.framework; - remoteRef = 003FA642093FFD41000C53B3 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 003FA645093FFD41000C53B3 /* libSDL2.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libSDL2.a; - remoteRef = 003FA644093FFD41000C53B3 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - 003FA649093FFD41000C53B3 /* Standard DMG */ = { - isa = PBXReferenceProxy; - fileType = "compiled.mach-o.executable"; - path = "Standard DMG"; - remoteRef = 003FA648093FFD41000C53B3 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - DB1D40D717B3F30D00D74CFC /* libSDL2.dylib */ = { - isa = PBXReferenceProxy; - fileType = "compiled.mach-o.dylib"; - path = libSDL2.dylib; - remoteRef = DB1D40D617B3F30D00D74CFC /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXSourcesBuildPhase section */ - 0017957910741F7900F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 001795901074216E00F5D044 /* testatomic.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017959A107421BF00F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 001795B11074222D00F5D044 /* testaudioinfo.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017970E10742F3200F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0017972810742FB900F5D044 /* testgl2.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 00179735107430D600F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0017974F1074315700F5D044 /* testhaptic.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017975B107431B300F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 001797721074320D00F5D044 /* testdraw2.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017977B107432AE00F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 00179792107432FA00F5D044 /* testime.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017979B1074334C00F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 001797B41074339C00F5D044 /* testintersections.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 001797BD107433C600F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 001797D41074343E00F5D044 /* testloadso.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 001797FF1074355200F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 001798161074359B00F5D044 /* testmultiaudio.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017987E1074392D00F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0017987F1074392D00F5D044 /* testnative.c in Sources */, - 001798801074392D00F5D044 /* testnativecocoa.m in Sources */, - 001798811074392D00F5D044 /* testnativex11.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 001798A2107439DF00F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 001798BA10743A4900F5D044 /* testpower.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 001798DF10743BEC00F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 001798FA10743E9200F5D044 /* testresample.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017990310743F1000F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0017991A10743F5300F5D044 /* testsprite2.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 0017992510743FB700F5D044 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 0017993C10743FEF00F5D044 /* testwm2.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 002F340709CA1BFF00EBEB88 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 002F341809CA1C5B00EBEB88 /* testfile.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 002F342609CA1F0300EBEB88 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 002F343709CA1F6F00EBEB88 /* testiconv.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 002F344209CA1FB300EBEB88 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 002F345409CA202000EBEB88 /* testoverlay2.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 002F345F09CA204F00EBEB88 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 002F347009CA20A600EBEB88 /* testplatform.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - 4537748F12091504002F0F45 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 453774A5120915E3002F0F45 /* testshape.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BBFC08BC164C6862003E6A99 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BBFC08D0164C6876003E6A99 /* testgamecontroller.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC566B00761D90300A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC566B10761D90300A33029 /* checkkeys.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC566CA0761D90300A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC566CB0761D90300A33029 /* loopwave.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567000761D90300A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC567010761D90300A33029 /* testerror.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567280761D90400A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC567290761D90400A33029 /* testthread.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567350761D90400A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC567360761D90400A33029 /* testjoystick.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567420761D90400A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC567430761D90400A33029 /* testkeys.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC5674F0761D90400A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC567500761D90400A33029 /* testlock.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567770761D90500A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC567780761D90500A33029 /* testsem.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567920761D90500A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC567930761D90500A33029 /* testtimer.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567AC0761D90500A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC567AD0761D90500A33029 /* testver.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - BEC567EF0761D90600A33029 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BEC567F00761D90600A33029 /* torturethread.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB0F48DA17CA51E5008798C5 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB0F48EE17CA51F8008798C5 /* testdrawchessboard.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB0F48F017CA5212008798C5 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB0F490317CA5225008798C5 /* testfilesystem.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166D7B16A1D12400A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166D9316A1D1A500A1396C /* SDL_test_assert.c in Sources */, - DB166D9416A1D1A500A1396C /* SDL_test_common.c in Sources */, - DB166D9516A1D1A500A1396C /* SDL_test_compare.c in Sources */, - DB166D9616A1D1A500A1396C /* SDL_test_crc32.c in Sources */, - DB166D9716A1D1A500A1396C /* SDL_test_font.c in Sources */, - DB166D9816A1D1A500A1396C /* SDL_test_fuzzer.c in Sources */, - DB166D9916A1D1A500A1396C /* SDL_test_harness.c in Sources */, - DB166D9A16A1D1A500A1396C /* SDL_test_imageBlit.c in Sources */, - DB166D9B16A1D1A500A1396C /* SDL_test_imageBlitBlend.c in Sources */, - DB166D9C16A1D1A500A1396C /* SDL_test_imageFace.c in Sources */, - DB166D9D16A1D1A500A1396C /* SDL_test_imagePrimitives.c in Sources */, - DB166D9E16A1D1A500A1396C /* SDL_test_imagePrimitivesBlend.c in Sources */, - DB166D9F16A1D1A500A1396C /* SDL_test_log.c in Sources */, - DB166DA016A1D1A500A1396C /* SDL_test_md5.c in Sources */, - DB166DA116A1D1A500A1396C /* SDL_test_random.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166DAE16A1D2F600A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166DC116A1D31E00A1396C /* testgesture.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166DC516A1D36A00A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166DD716A1D37800A1396C /* testmessage.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166DDD16A1D50C00A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166DF016A1D52500A1396C /* testrelative.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166DF416A1D57C00A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166E0716A1D59400A1396C /* testrendercopyex.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E0B16A1D5AD00A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166E1E16A1D5C300A1396C /* testrendertarget.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E2816A1D64D00A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166E3C16A1D66500A1396C /* testrumble.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E3E16A1D69000A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166E5416A1D6A300A1396C /* testscale.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E5816A1D6F300A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166E6A16A1D70C00A1396C /* testshader.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E6E16A1D78400A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166E9316A1D7BC00A1396C /* testspriteminimal.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB166E8116A1D78C00A1396C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB166E9416A1D7C700A1396C /* teststreaming.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB445EE718184B7000B306B0 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB445EFB18184BB600B306B0 /* testdropfile.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DB89956E18A19ABA0092407C /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DB89958418A19B130092407C /* testhotplug.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; - DBEC54DA1A1A81C3005B1EAB /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - DBEC54EB1A1A8205005B1EAB /* controllermap.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 001799481074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC566AB0761D90300A33029 /* checkkeys */; - targetProxy = 001799471074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017994C1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC566C50761D90300A33029 /* loopwave */; - targetProxy = 0017994B1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799501074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 0017957410741F7900F5D044 /* testatomic */; - targetProxy = 0017994F1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799521074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 00179595107421BF00F5D044 /* testaudioinfo */; - targetProxy = 001799511074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017995A1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 00179756107431B300F5D044 /* testdraw2 */; - targetProxy = 001799591074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017995E1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC566FB0761D90300A33029 /* testerror */; - targetProxy = 0017995D1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799601074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 002F340109CA1BFF00EBEB88 /* testfile */; - targetProxy = 0017995F1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799661074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 0017970910742F3200F5D044 /* testgl2 */; - targetProxy = 001799651074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799681074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 00179730107430D600F5D044 /* testhaptic */; - targetProxy = 001799671074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017996A1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC567230761D90400A33029 /* testthread */; - targetProxy = 001799691074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017996C1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 002F342009CA1F0300EBEB88 /* testiconv */; - targetProxy = 0017996B1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017996E1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 00179776107432AE00F5D044 /* testime */; - targetProxy = 0017996D1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799701074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 001797961074334C00F5D044 /* testintersections */; - targetProxy = 0017996F1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799721074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC567300761D90400A33029 /* testjoystick */; - targetProxy = 001799711074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799741074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC5673D0761D90400A33029 /* testkeys */; - targetProxy = 001799731074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799761074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 001797B8107433C600F5D044 /* testloadso */; - targetProxy = 001799751074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799781074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC5674A0761D90400A33029 /* testlock */; - targetProxy = 001799771074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017997C1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 001797FA1074355200F5D044 /* testmultiaudio */; - targetProxy = 0017997B1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799801074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 001798781074392D00F5D044 /* testnative */; - targetProxy = 0017997F1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799841074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 002F343C09CA1FB300EBEB88 /* testoverlay2 */; - targetProxy = 001799831074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799881074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 002F345909CA204F00EBEB88 /* testplatform */; - targetProxy = 001799871074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017998A1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 0017989D107439DF00F5D044 /* testpower */; - targetProxy = 001799891074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017998C1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 001798DA10743BEC00F5D044 /* testresample */; - targetProxy = 0017998B1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017998E1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC567720761D90500A33029 /* testsem */; - targetProxy = 0017998D1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799921074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 001798FE10743F1000F5D044 /* testsprite2 */; - targetProxy = 001799911074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799941074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC5678D0761D90500A33029 /* testtimer */; - targetProxy = 001799931074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799961074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC567A70761D90500A33029 /* testversion */; - targetProxy = 001799951074403E00F5D044 /* PBXContainerItemProxy */; - }; - 0017999E1074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 0017992010743FB700F5D044 /* testwm2 */; - targetProxy = 0017999D1074403E00F5D044 /* PBXContainerItemProxy */; - }; - 001799A21074403E00F5D044 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BEC567EA0761D90600A33029 /* torturethread */; - targetProxy = 001799A11074403E00F5D044 /* PBXContainerItemProxy */; - }; - DB0F490517CA5249008798C5 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB0F48D917CA51E5008798C5 /* testdrawchessboard */; - targetProxy = DB0F490417CA5249008798C5 /* PBXContainerItemProxy */; - }; - DB0F490717CA5249008798C5 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB0F48EF17CA5212008798C5 /* testfilesystem */; - targetProxy = DB0F490617CA5249008798C5 /* PBXContainerItemProxy */; - }; - DB166D6E16A1CEAA00A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = BBFC08B7164C6862003E6A99 /* testgamecontroller */; - targetProxy = DB166D6D16A1CEAA00A1396C /* PBXContainerItemProxy */; - }; - DB166D7016A1CEAF00A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = 4537749112091504002F0F45 /* testshape */; - targetProxy = DB166D6F16A1CEAF00A1396C /* PBXContainerItemProxy */; - }; - DB166DC316A1D32C00A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166DAD16A1D2F600A1396C /* testgesture */; - targetProxy = DB166DC216A1D32C00A1396C /* PBXContainerItemProxy */; - }; - DB166DD916A1D38900A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166DC416A1D36A00A1396C /* testmessage */; - targetProxy = DB166DD816A1D38900A1396C /* PBXContainerItemProxy */; - }; - DB166DF216A1D53700A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166DDC16A1D50C00A1396C /* testrelative */; - targetProxy = DB166DF116A1D53700A1396C /* PBXContainerItemProxy */; - }; - DB166E0916A1D5A400A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166DF316A1D57C00A1396C /* testrendercopyex */; - targetProxy = DB166E0816A1D5A400A1396C /* PBXContainerItemProxy */; - }; - DB166E2016A1D5D000A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166E0A16A1D5AD00A1396C /* testrendertarget */; - targetProxy = DB166E1F16A1D5D000A1396C /* PBXContainerItemProxy */; - }; - DB166E3B16A1D65A00A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166E2716A1D64D00A1396C /* testrumble */; - targetProxy = DB166E3A16A1D65A00A1396C /* PBXContainerItemProxy */; - }; - DB166E5616A1D6B800A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166E3D16A1D69000A1396C /* testscale */; - targetProxy = DB166E5516A1D6B800A1396C /* PBXContainerItemProxy */; - }; - DB166E6C16A1D72000A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166E5716A1D6F300A1396C /* testshader */; - targetProxy = DB166E6B16A1D72000A1396C /* PBXContainerItemProxy */; - }; - DB166E9616A1D7CD00A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166E6D16A1D78400A1396C /* testspriteminimal */; - targetProxy = DB166E9516A1D7CD00A1396C /* PBXContainerItemProxy */; - }; - DB166E9816A1D7CF00A1396C /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - target = DB166E8016A1D78C00A1396C /* teststreaming */; - targetProxy = DB166E9716A1D7CF00A1396C /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 0017958910741F7900F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testatomic; - }; - name = Debug; - }; - 0017958A10741F7900F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testatomic; - }; - name = Release; - }; - 001795AA107421BF00F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testaudioinfo; - }; - name = Debug; - }; - 001795AB107421BF00F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testaudioinfo; - }; - name = Release; - }; - 0017971E10742F3200F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_PREPROCESSOR_DEFINITIONS = HAVE_OPENGL; - PRODUCT_NAME = testgl2; - }; - name = Debug; - }; - 0017971F10742F3200F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_PREPROCESSOR_DEFINITIONS = HAVE_OPENGL; - PRODUCT_NAME = testgl2; - }; - name = Release; - }; - 00179745107430D600F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testhaptic; - }; - name = Debug; - }; - 00179746107430D600F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testhaptic; - }; - name = Release; - }; - 0017976B107431B300F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testdraw2; - }; - name = Debug; - }; - 0017976C107431B300F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testdraw2; - }; - name = Release; - }; - 0017978B107432AE00F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testime; - }; - name = Debug; - }; - 0017978C107432AE00F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testime; - }; - name = Release; - }; - 001797AB1074334C00F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testintersections; - }; - name = Debug; - }; - 001797AC1074334C00F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testintersections; - }; - name = Release; - }; - 001797CD107433C600F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testloadso; - }; - name = Debug; - }; - 001797CE107433C600F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testloadso; - }; - name = Release; - }; - 0017980F1074355200F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testmultiaudio; - }; - name = Debug; - }; - 001798101074355200F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testmultiaudio; - }; - name = Release; - }; - 001798911074392D00F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - LIBRARY_SEARCH_PATHS = /usr/X11/lib; - OTHER_LDFLAGS = "-lX11"; - PRODUCT_NAME = testnative; - }; - name = Debug; - }; - 001798921074392D00F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - LIBRARY_SEARCH_PATHS = /usr/X11/lib; - OTHER_LDFLAGS = "-lX11"; - PRODUCT_NAME = testnative; - }; - name = Release; - }; - 001798B2107439DF00F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testpower; - }; - name = Debug; - }; - 001798B3107439DF00F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testpower; - }; - name = Release; - }; - 001798EF10743BEC00F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testresample; - }; - name = Debug; - }; - 001798F010743BEC00F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testresample; - }; - name = Release; - }; - 0017991310743F1000F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testsprite2; - }; - name = Debug; - }; - 0017991410743F1000F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testsprite2; - }; - name = Release; - }; - 0017993510743FB700F5D044 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testwm2; - }; - name = Debug; - }; - 0017993610743FB700F5D044 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testwm2; - }; - name = Release; - }; - 002A85B21073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(SRCROOT)/../SDL/build/$(CONFIGURATION)", - "$(HOME)/Library/Frameworks", - /Library/Frameworks, - ); - GCC_OPTIMIZATION_LEVEL = 0; - HEADER_SEARCH_PATHS = ../../include; - MACOSX_DEPLOYMENT_TARGET = 10.6; - }; - name = Debug; - }; - 002A85B31073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "Build All"; - }; - name = Debug; - }; - 002A85B41073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = checkkeys; - }; - name = Debug; - }; - 002A85B61073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = loopwave; - }; - name = Debug; - }; - 002A85BC1073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testerror; - }; - name = Debug; - }; - 002A85BD1073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testfile; - }; - name = Debug; - }; - 002A85C01073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testiconv; - }; - name = Debug; - }; - 002A85C11073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testjoystick; - }; - name = Debug; - }; - 002A85C21073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testkeys; - }; - name = Debug; - }; - 002A85C31073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testlock; - }; - name = Debug; - }; - 002A85C51073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testoverlay2; - }; - name = Debug; - }; - 002A85C71073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testplatform; - }; - name = Debug; - }; - 002A85C81073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testsem; - }; - name = Debug; - }; - 002A85CA1073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testthread; - }; - name = Debug; - }; - 002A85CB1073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testtimer; - }; - name = Debug; - }; - 002A85CC1073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testversion; - }; - name = Debug; - }; - 002A85D11073008E007319AE /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = torturethread; - }; - name = Debug; - }; - 002A85D41073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - FRAMEWORK_SEARCH_PATHS = ( - "$(SRCROOT)/../SDL/build/$(CONFIGURATION)", - "$(HOME)/Library/Frameworks", - /Library/Frameworks, - ); - GCC_GENERATE_DEBUGGING_SYMBOLS = NO; - HEADER_SEARCH_PATHS = ../../include; - MACOSX_DEPLOYMENT_TARGET = 10.6; - }; - name = Release; - }; - 002A85D51073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = "Build All"; - }; - name = Release; - }; - 002A85D61073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = checkkeys; - }; - name = Release; - }; - 002A85D81073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = loopwave; - }; - name = Release; - }; - 002A85DE1073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testerror; - }; - name = Release; - }; - 002A85DF1073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testfile; - }; - name = Release; - }; - 002A85E21073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testiconv; - }; - name = Release; - }; - 002A85E31073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testjoystick; - }; - name = Release; - }; - 002A85E41073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testkeys; - }; - name = Release; - }; - 002A85E51073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testlock; - }; - name = Release; - }; - 002A85E71073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testoverlay2; - }; - name = Release; - }; - 002A85E91073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testplatform; - }; - name = Release; - }; - 002A85EA1073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testsem; - }; - name = Release; - }; - 002A85EC1073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testthread; - }; - name = Release; - }; - 002A85ED1073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testtimer; - }; - name = Release; - }; - 002A85EE1073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testversion; - }; - name = Release; - }; - 002A85F31073009D007319AE /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = torturethread; - }; - name = Release; - }; - 4537749712091509002F0F45 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testshape; - }; - name = Debug; - }; - 4537749812091509002F0F45 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testshape; - }; - name = Release; - }; - BBFC08CB164C6862003E6A99 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testgamecontroller; - }; - name = Debug; - }; - BBFC08CC164C6862003E6A99 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testgamecontroller; - }; - name = Release; - }; - DB0F48EA17CA51E5008798C5 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testdrawchessboard; - }; - name = Debug; - }; - DB0F48EB17CA51E5008798C5 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testdrawchessboard; - }; - name = Release; - }; - DB0F48FF17CA5212008798C5 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testfilesystem; - }; - name = Debug; - }; - DB0F490017CA5212008798C5 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testfilesystem; - }; - name = Release; - }; - DB166D8116A1D12400A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = lib; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Debug; - }; - DB166D8216A1D12400A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - EXECUTABLE_PREFIX = lib; - PRODUCT_NAME = "$(TARGET_NAME)"; - }; - name = Release; - }; - DB166DBD16A1D2F600A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testgesture; - }; - name = Debug; - }; - DB166DBE16A1D2F600A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testgesture; - }; - name = Release; - }; - DB166DD316A1D36A00A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testmessage; - }; - name = Debug; - }; - DB166DD416A1D36A00A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testmessage; - }; - name = Release; - }; - DB166DEC16A1D50C00A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testrelative; - }; - name = Debug; - }; - DB166DED16A1D50C00A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testrelative; - }; - name = Release; - }; - DB166E0316A1D57C00A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testrendercopyex; - }; - name = Debug; - }; - DB166E0416A1D57C00A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testrendercopyex; - }; - name = Release; - }; - DB166E1A16A1D5AD00A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testrendertarget; - }; - name = Debug; - }; - DB166E1B16A1D5AD00A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testrendertarget; - }; - name = Release; - }; - DB166E3616A1D64D00A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testrumble; - }; - name = Debug; - }; - DB166E3716A1D64D00A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testrumble; - }; - name = Release; - }; - DB166E5016A1D69000A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testscale; - }; - name = Debug; - }; - DB166E5116A1D69000A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testscale; - }; - name = Release; - }; - DB166E6616A1D6F300A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testshader; - }; - name = Debug; - }; - DB166E6716A1D6F300A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testshader; - }; - name = Release; - }; - DB166E7C16A1D78400A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testspriteminimal; - }; - name = Debug; - }; - DB166E7D16A1D78400A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testspriteminimal; - }; - name = Release; - }; - DB166E8F16A1D78C00A1396C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = teststreaming; - }; - name = Debug; - }; - DB166E9016A1D78C00A1396C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = teststreaming; - }; - name = Release; - }; - DB445EF618184B7000B306B0 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = "TestDropFile-Info.plist"; - PRODUCT_NAME = testdropfile; - }; - name = Debug; - }; - DB445EF718184B7000B306B0 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - INFOPLIST_FILE = "TestDropFile-Info.plist"; - PRODUCT_NAME = testdropfile; - }; - name = Release; - }; - DB89957C18A19ABA0092407C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testhotplug; - }; - name = Debug; - }; - DB89957D18A19ABA0092407C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = testhotplug; - }; - name = Release; - }; - DBEC54E81A1A81C3005B1EAB /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = controllermap; - }; - name = Debug; - }; - DBEC54E91A1A81C3005B1EAB /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = controllermap; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 0017958610741F7900F5D044 /* Build configuration list for PBXNativeTarget "testatomic" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0017958910741F7900F5D044 /* Debug */, - 0017958A10741F7900F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001795A7107421BF00F5D044 /* Build configuration list for PBXNativeTarget "testaudioinfo" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 001795AA107421BF00F5D044 /* Debug */, - 001795AB107421BF00F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 0017971B10742F3200F5D044 /* Build configuration list for PBXNativeTarget "testgl2" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0017971E10742F3200F5D044 /* Debug */, - 0017971F10742F3200F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 00179742107430D600F5D044 /* Build configuration list for PBXNativeTarget "testhaptic" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 00179745107430D600F5D044 /* Debug */, - 00179746107430D600F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 00179768107431B300F5D044 /* Build configuration list for PBXNativeTarget "testdraw2" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0017976B107431B300F5D044 /* Debug */, - 0017976C107431B300F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 00179788107432AE00F5D044 /* Build configuration list for PBXNativeTarget "testime" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0017978B107432AE00F5D044 /* Debug */, - 0017978C107432AE00F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001797A81074334C00F5D044 /* Build configuration list for PBXNativeTarget "testintersections" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 001797AB1074334C00F5D044 /* Debug */, - 001797AC1074334C00F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001797CA107433C600F5D044 /* Build configuration list for PBXNativeTarget "testloadso" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 001797CD107433C600F5D044 /* Debug */, - 001797CE107433C600F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 0017980C1074355200F5D044 /* Build configuration list for PBXNativeTarget "testmultiaudio" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0017980F1074355200F5D044 /* Debug */, - 001798101074355200F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 0017988E1074392D00F5D044 /* Build configuration list for PBXNativeTarget "testnative" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 001798911074392D00F5D044 /* Debug */, - 001798921074392D00F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001798AF107439DF00F5D044 /* Build configuration list for PBXNativeTarget "testpower" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 001798B2107439DF00F5D044 /* Debug */, - 001798B3107439DF00F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001798EC10743BEC00F5D044 /* Build configuration list for PBXNativeTarget "testresample" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 001798EF10743BEC00F5D044 /* Debug */, - 001798F010743BEC00F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 0017991010743F1000F5D044 /* Build configuration list for PBXNativeTarget "testsprite2" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0017991310743F1000F5D044 /* Debug */, - 0017991410743F1000F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 0017993210743FB700F5D044 /* Build configuration list for PBXNativeTarget "testwm2" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0017993510743FB700F5D044 /* Debug */, - 0017993610743FB700F5D044 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B593808BDB826006539E9 /* Build configuration list for PBXNativeTarget "checkkeys" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85B41073008E007319AE /* Debug */, - 002A85D61073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B594008BDB826006539E9 /* Build configuration list for PBXNativeTarget "loopwave" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85B61073008E007319AE /* Debug */, - 002A85D81073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B595008BDB826006539E9 /* Build configuration list for PBXNativeTarget "testerror" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85BC1073008E007319AE /* Debug */, - 002A85DE1073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B595C08BDB826006539E9 /* Build configuration list for PBXNativeTarget "testthread" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85CA1073008E007319AE /* Debug */, - 002A85EC1073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B596008BDB826006539E9 /* Build configuration list for PBXNativeTarget "testjoystick" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85C11073008E007319AE /* Debug */, - 002A85E31073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B596408BDB826006539E9 /* Build configuration list for PBXNativeTarget "testkeys" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85C21073008E007319AE /* Debug */, - 002A85E41073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B596808BDB826006539E9 /* Build configuration list for PBXNativeTarget "testlock" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85C31073008E007319AE /* Debug */, - 002A85E51073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B597008BDB826006539E9 /* Build configuration list for PBXNativeTarget "testsem" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85C81073008E007319AE /* Debug */, - 002A85EA1073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B597808BDB826006539E9 /* Build configuration list for PBXNativeTarget "testtimer" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85CB1073008E007319AE /* Debug */, - 002A85ED1073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B598008BDB826006539E9 /* Build configuration list for PBXNativeTarget "testversion" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85CC1073008E007319AE /* Debug */, - 002A85EE1073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B599408BDB826006539E9 /* Build configuration list for PBXNativeTarget "torturethread" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85D11073008E007319AE /* Debug */, - 002A85F31073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B599808BDB826006539E9 /* Build configuration list for PBXAggregateTarget "All" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85B31073008E007319AE /* Debug */, - 002A85D51073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 001B5A0C08BDB826006539E9 /* Build configuration list for PBXProject "SDLTest" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85B21073008E007319AE /* Debug */, - 002A85D41073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 002F340E09CA1BFF00EBEB88 /* Build configuration list for PBXNativeTarget "testfile" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85BD1073008E007319AE /* Debug */, - 002A85DF1073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 002F342D09CA1F0300EBEB88 /* Build configuration list for PBXNativeTarget "testiconv" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85C01073008E007319AE /* Debug */, - 002A85E21073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 002F344909CA1FB300EBEB88 /* Build configuration list for PBXNativeTarget "testoverlay2" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85C51073008E007319AE /* Debug */, - 002A85E71073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 002F346609CA204F00EBEB88 /* Build configuration list for PBXNativeTarget "testplatform" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 002A85C71073008E007319AE /* Debug */, - 002A85E91073009D007319AE /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - 4537749A1209150C002F0F45 /* Build configuration list for PBXNativeTarget "testshape" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 4537749712091509002F0F45 /* Debug */, - 4537749812091509002F0F45 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - BBFC08CA164C6862003E6A99 /* Build configuration list for PBXNativeTarget "testgamecontroller" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - BBFC08CB164C6862003E6A99 /* Debug */, - BBFC08CC164C6862003E6A99 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB0F48E917CA51E5008798C5 /* Build configuration list for PBXNativeTarget "testdrawchessboard" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB0F48EA17CA51E5008798C5 /* Debug */, - DB0F48EB17CA51E5008798C5 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB0F48FE17CA5212008798C5 /* Build configuration list for PBXNativeTarget "testfilesystem" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB0F48FF17CA5212008798C5 /* Debug */, - DB0F490017CA5212008798C5 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166D8016A1D12400A1396C /* Build configuration list for PBXNativeTarget "SDL_test" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166D8116A1D12400A1396C /* Debug */, - DB166D8216A1D12400A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166DBC16A1D2F600A1396C /* Build configuration list for PBXNativeTarget "testgesture" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166DBD16A1D2F600A1396C /* Debug */, - DB166DBE16A1D2F600A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166DD216A1D36A00A1396C /* Build configuration list for PBXNativeTarget "testmessage" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166DD316A1D36A00A1396C /* Debug */, - DB166DD416A1D36A00A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166DEB16A1D50C00A1396C /* Build configuration list for PBXNativeTarget "testrelative" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166DEC16A1D50C00A1396C /* Debug */, - DB166DED16A1D50C00A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166E0216A1D57C00A1396C /* Build configuration list for PBXNativeTarget "testrendercopyex" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166E0316A1D57C00A1396C /* Debug */, - DB166E0416A1D57C00A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166E1916A1D5AD00A1396C /* Build configuration list for PBXNativeTarget "testrendertarget" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166E1A16A1D5AD00A1396C /* Debug */, - DB166E1B16A1D5AD00A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166E3516A1D64D00A1396C /* Build configuration list for PBXNativeTarget "testrumble" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166E3616A1D64D00A1396C /* Debug */, - DB166E3716A1D64D00A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166E4F16A1D69000A1396C /* Build configuration list for PBXNativeTarget "testscale" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166E5016A1D69000A1396C /* Debug */, - DB166E5116A1D69000A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166E6516A1D6F300A1396C /* Build configuration list for PBXNativeTarget "testshader" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166E6616A1D6F300A1396C /* Debug */, - DB166E6716A1D6F300A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166E7B16A1D78400A1396C /* Build configuration list for PBXNativeTarget "testspriteminimal" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166E7C16A1D78400A1396C /* Debug */, - DB166E7D16A1D78400A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB166E8E16A1D78C00A1396C /* Build configuration list for PBXNativeTarget "teststreaming" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB166E8F16A1D78C00A1396C /* Debug */, - DB166E9016A1D78C00A1396C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB445EF518184B7000B306B0 /* Build configuration list for PBXNativeTarget "testdropfile" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB445EF618184B7000B306B0 /* Debug */, - DB445EF718184B7000B306B0 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DB89957B18A19ABA0092407C /* Build configuration list for PBXNativeTarget "testhotplug" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DB89957C18A19ABA0092407C /* Debug */, - DB89957D18A19ABA0092407C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; - DBEC54E71A1A81C3005B1EAB /* Build configuration list for PBXNativeTarget "controllermap" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - DBEC54E81A1A81C3005B1EAB /* Debug */, - DBEC54E91A1A81C3005B1EAB /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Debug; - }; -/* End XCConfigurationList section */ - }; - rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; -} diff --git a/Engine/lib/sdl/Xcode/SDLTest/TestDropFile-Info.plist b/Engine/lib/sdl/Xcode/SDLTest/TestDropFile-Info.plist deleted file mode 100644 index 03e46b33b..000000000 --- a/Engine/lib/sdl/Xcode/SDLTest/TestDropFile-Info.plist +++ /dev/null @@ -1,35 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleDocumentTypes - - - CFBundleTypeRole - Viewer - LSHandlerRank - Alternate - LSItemContentTypes - - public.data - - - - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIdentifier - org.libsdl.test-dropfile - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - APPL - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1.0 - LSMinimumSystemVersion - 10.6 - - diff --git a/Engine/lib/sdl/Xcode/XcodeDocSet/Doxyfile b/Engine/lib/sdl/Xcode/XcodeDocSet/Doxyfile deleted file mode 100644 index 961ac98ef..000000000 --- a/Engine/lib/sdl/Xcode/XcodeDocSet/Doxyfile +++ /dev/null @@ -1,1558 +0,0 @@ -# Doxyfile 1.6.1 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded -# by quotes) that should identify the project. - -PROJECT_NAME = SDL - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = 1.3.0 - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrilic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = NO - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful is your file systems -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = YES - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = YES - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it parses. -# With this tag you can assign which parser to use for a given extension. -# Doxygen has a built-in mapping, but you can override or extend it using this tag. -# The format is ext=language, where ext is a file extension, and language is one of -# the parsers supported by doxygen: IDL, Java, Javascript, C#, C, C++, D, PHP, -# Objective-C, Python, Fortran, VHDL, C, C++. For instance to make doxygen treat -# .inc files as Fortran files (default is PHP), and .f files as C (default is Fortran), -# use: inc=Fortran f=C. Note that for custom extensions you also need to set -# FILE_PATTERNS otherwise the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate getter -# and setter methods for a property. Setting this option to YES (the default) -# will make doxygen to replace the get and set methods by a property in the -# documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = YES - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penality. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will rougly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols - -SYMBOL_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = NO - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespace are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = YES - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = NO - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if sectionname ... \endif. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or define consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and defines in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# If the sources in your project are distributed over multiple directories -# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy -# in the documentation. The default is NO. - -SHOW_DIRECTORIES = NO - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = NO - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed by -# doxygen. The layout file controls the global structure of the generated output files -# in an output format independent way. The create the layout file that represents -# doxygen's defaults, run doxygen with the -l option. You can optionally specify a -# file name after the option, if omitted DoxygenLayout.xml will be used as the name -# of the layout file. - -LAYOUT_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = YES - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be abled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = YES - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = ../../include - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx -# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90 - -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.d \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.idl \ - *.odl \ - *.cs \ - *.php \ - *.php3 \ - *.inc \ - *.m \ - *.mm \ - *.dox \ - *.py \ - *.f90 \ - *.f \ - *.vhd \ - *.vhdl - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used select whether or not files or -# directories that are symbolic links (a Unix filesystem feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER -# is applied to all files. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C and C++ comments will always remain visible. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = YES - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If the tag is left blank doxygen -# will generate a default style sheet. Note that doxygen will try to copy -# the style sheet file to the HTML output directory, so don't put your own -# stylesheet in the HTML output directory as well, or it will be erased! - -HTML_STYLESHEET = - -# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, -# files or namespaces will be aligned in HTML using tables. If set to -# NO a bullet list will be used. - -HTML_ALIGN_MEMBERS = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. For this to work a browser that supports -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari). - -HTML_DYNAMIC_SECTIONS = NO - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html for more information. - -GENERATE_DOCSET = YES - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs for SDL" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.libsdl.sdl - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = SDL.chm - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = "C:/Program Files/HTML Help Workshop/hhc.exe" - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = YES - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and QHP_VIRTUAL_FOLDER -# are set, an additional index file will be generated that can be used as input for -# Qt's qhelpgenerator to generate a Qt Compressed Help (.qch) of the generated -# HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to add. -# For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the custom filter to add.For more information please see -# Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this project's -# filter section matches. -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index at -# top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. - -DISABLE_INDEX = NO - -# This tag can be used to set the number of enum values (range [1..20]) -# that doxygen will group on one line in the generated HTML documentation. - -ENUM_VALUES_PER_LINE = 4 - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. - -GENERATE_TREEVIEW = NO - -# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories, -# and Class Hierarchy pages using a tree view instead of an ordered list. - -USE_INLINE_TREES = NO - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -# When the SEARCHENGINE tag is enable doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP) or Qt help (GENERATE_QHP) -# there is already a search function so this one should typically -# be disabled. - -SEARCHENGINE = NO - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, a4wide, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = YES - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = YES - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# in the INCLUDE_PATH (see below) will be search if a #include is found. - -SEARCH_INCLUDES = NO - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition. - -EXPAND_AS_DEFINED = DECLSPEC \ - SDLCALL - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all function-like macros that are alone -# on a line, have an all uppercase name, and do not end with a semicolon. Such -# function macros are typically used for boiler-plate code, and will confuse -# the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. -# Optionally an initial location of the external documentation -# can be added for each tagfile. The format of a tag file without -# this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths or -# URLs. If a location is present for each tag, the installdox tool -# does not have to be run to correct the links. -# Note that each tag file must have a unique name -# (where the name does NOT include the path) -# If a tag file is not located in the directory in which doxygen -# is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option is superseded by the HAVE_DOT option below. This is only a -# fallback. It is recommended to install and use dot, since it yields more -# powerful graphs. - -CLASS_DIAGRAMS = NO - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# By default doxygen will write a font called FreeSans.ttf to the output -# directory and reference it in all dot files that doxygen generates. This -# font does not include all possible unicode characters however, so when you need -# these (or just want a differently looking font) you can specify the font name -# using DOT_FONTNAME. You need need to make sure dot is able to find the font, -# which can be done by putting it in a standard location or by setting the -# DOTFONTPATH environment variable or by setting DOT_FONTPATH to the directory -# containing the font. - -DOT_FONTNAME = FreeSans - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the output directory to look for the -# FreeSans.ttf font (which doxygen will put there itself). If you specify a -# different font using DOT_FONTNAME you can set the path where dot -# can find it using this tag. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# the CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are png, jpg, or gif -# If left blank png will be used. - -DOT_IMAGE_FORMAT = png - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = /Applications/Graphviz.app/Contents/MacOS - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 67 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 2 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES diff --git a/Engine/lib/sdl/acinclude/libtool.m4 b/Engine/lib/sdl/acinclude/libtool.m4 index 0eb07c8af..b8ba0324f 100644 --- a/Engine/lib/sdl/acinclude/libtool.m4 +++ b/Engine/lib/sdl/acinclude/libtool.m4 @@ -1347,7 +1347,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; - ppc*-*linux*|powerpc*-*linux*) + powerpc64le-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc64-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) diff --git a/Engine/lib/sdl/autogen.sh b/Engine/lib/sdl/autogen.sh index 3e958e195..9edfb8a7d 100755 --- a/Engine/lib/sdl/autogen.sh +++ b/Engine/lib/sdl/autogen.sh @@ -5,7 +5,7 @@ echo "This may take a while ..." srcdir=`dirname $0` test -z "$srcdir" && srcdir=. -pushd $srcdir +cd "$srcdir" # Regenerate configuration files cat acinclude/* >aclocal.m4 @@ -19,7 +19,5 @@ if test x$found = xfalse; then fi (cd test; sh autogen.sh) -popd - # Run configure for this platform echo "Now you are ready to run ./configure" diff --git a/Engine/lib/sdl/build-scripts/androidbuild.sh b/Engine/lib/sdl/build-scripts/androidbuild.sh index fb48e2e5b..814578182 100755 --- a/Engine/lib/sdl/build-scripts/androidbuild.sh +++ b/Engine/lib/sdl/build-scripts/androidbuild.sh @@ -25,46 +25,21 @@ if [ -z "$1" ] || [ -z "$SOURCES" ]; then echo "Usage: androidbuild.sh com.yourcompany.yourapp < sources.list" echo "Usage: androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c" echo "To copy SDL source instead of symlinking: COPYSOURCE=1 androidbuild.sh ... " - echo "You can pass additional arguments to ndk-build with the NDKARGS variable: NDKARGS=\"-s\" androidbuild.sh ..." exit 1 fi - - SDLPATH="$( cd "$(dirname "$0")/.." ; pwd -P )" -NDKBUILD=`which ndk-build` -if [ -z "$NDKBUILD" ];then - echo "Could not find the ndk-build utility, install Android's NDK and add it to the path" +if [ -z "$ANDROID_HOME" ];then + echo "Please set the ANDROID_HOME directory to the path of the Android SDK" exit 1 fi -ANDROID=`which android` -if [ -z "$ANDROID" ];then - echo "Could not find the android utility, install Android's SDK and add it to the path" +if [ ! -d "$ANDROID_HOME/ndk-bundle" -a -z "$ANDROID_NDK_HOME" ]; then + echo "Please set the ANDROID_NDK_HOME directory to the path of the Android NDK" exit 1 fi -ANT=`which ant` - -if [ -z "$ANT" ];then - echo "Could not find the ant utility, install Android's SDK and add it to the path" - exit 1 -fi - -NCPUS="1" -case "$OSTYPE" in - darwin*) - NCPU=`sysctl -n hw.ncpu` - ;; - linux*) - if [ -n `which nproc` ]; then - NCPUS=`nproc` - fi - ;; - *);; -esac - APP="$1" APPARR=(${APP//./ }) BUILDPATH="$SDLPATH/build/$APP" @@ -77,27 +52,28 @@ mkdir -p $BUILDPATH cp -r $SDLPATH/android-project/* $BUILDPATH # Copy SDL sources -mkdir -p $BUILDPATH/jni/SDL +mkdir -p $BUILDPATH/app/jni/SDL if [ -z "$COPYSOURCE" ]; then - ln -s $SDLPATH/src $BUILDPATH/jni/SDL - ln -s $SDLPATH/include $BUILDPATH/jni/SDL + ln -s $SDLPATH/src $BUILDPATH/app/jni/SDL + ln -s $SDLPATH/include $BUILDPATH/app/jni/SDL else - cp -r $SDLPATH/src $BUILDPATH/jni/SDL - cp -r $SDLPATH/include $BUILDPATH/jni/SDL + cp -r $SDLPATH/src $BUILDPATH/app/jni/SDL + cp -r $SDLPATH/include $BUILDPATH/app/jni/SDL fi -cp -r $SDLPATH/Android.mk $BUILDPATH/jni/SDL -sed -i -e "s|YourSourceHere.c|$MKSOURCES|g" $BUILDPATH/jni/src/Android.mk -sed -i -e "s|org\.libsdl\.app|$APP|g" $BUILDPATH/AndroidManifest.xml +cp -r $SDLPATH/Android.mk $BUILDPATH/app/jni/SDL +sed -i -e "s|YourSourceHere.c|$MKSOURCES|g" $BUILDPATH/app/jni/src/Android.mk +sed -i -e "s|org\.libsdl\.app|$APP|g" $BUILDPATH/app/build.gradle +sed -i -e "s|org\.libsdl\.app|$APP|g" $BUILDPATH/app/src/main/AndroidManifest.xml # Copy user sources for src in "${SOURCES[@]}" do - cp $src $BUILDPATH/jni/src + cp $src $BUILDPATH/app/jni/src done # Create an inherited Activity -cd $BUILDPATH/src +cd $BUILDPATH/app/src/main/java for folder in "${APPARR[@]}" do mkdir -p $folder @@ -105,31 +81,20 @@ do done ACTIVITY="${folder}Activity" -sed -i -e "s|SDLActivity|$ACTIVITY|g" $BUILDPATH/AndroidManifest.xml -sed -i -e "s|SDLActivity|$APP|g" $BUILDPATH/build.xml +sed -i -e "s|\"SDLActivity\"|\"$ACTIVITY\"|g" $BUILDPATH/app/src/main/AndroidManifest.xml # Fill in a default Activity -echo "package $APP;" > "$ACTIVITY.java" -echo "import org.libsdl.app.SDLActivity;" >> "$ACTIVITY.java" -echo "public class $ACTIVITY extends SDLActivity {}" >> "$ACTIVITY.java" +cat >"$ACTIVITY.java" <<__EOF__ +package $APP; + +import org.libsdl.app.SDLActivity; + +public class $ACTIVITY extends SDLActivity +{ +} +__EOF__ # Update project and build -cd $BUILDPATH -$ANDROID update project --path $BUILDPATH -$NDKBUILD -j $NCPUS $NDKARGS -$ANT debug - -cd $CURDIR - -APK="$BUILDPATH/bin/$APP-debug.apk" - -if [ -f "$APK" ]; then - echo "Your APK is ready at $APK" - echo "To install to your device: " - echo "cd $BUILDPATH" - echo "ant debug install" - exit 0 -fi - -echo "There was an error building the APK" -exit 1 \ No newline at end of file +echo "To build and install to a device for testing, run the following:" +echo "cd $BUILDPATH" +echo "./gradlew installDebug" diff --git a/Engine/lib/sdl/build-scripts/androidbuildlibs.sh b/Engine/lib/sdl/build-scripts/androidbuildlibs.sh new file mode 100755 index 000000000..934becc68 --- /dev/null +++ b/Engine/lib/sdl/build-scripts/androidbuildlibs.sh @@ -0,0 +1,74 @@ +#!/bin/sh +# +# Build the Android libraries without needing a project +# (AndroidManifest.xml, jni/{Application,Android}.mk, etc.) +# +# Usage: androidbuildlibs.sh [arg for ndk-build ...]" +# +# Useful NDK arguments: +# +# NDK_DEBUG=1 - build debug version +# NDK_LIBS_OUT= - specify alternate destination for installable +# modules. +# +# Note that SDLmain is not an installable module (.so) so libSDLmain.a +# can be found in $obj/local/ along with the unstripped libSDL.so. +# + + +# Android.mk is in srcdir +srcdir=`dirname $0`/.. +srcdir=`cd $srcdir && pwd` +cd $srcdir + + +# +# Create the build directories +# + +build=build +buildandroid=$build/android +obj= +lib= +ndk_args= + +# Allow an external caller to specify locations. +for arg in $* +do + if [ "${arg:0:8}" == "NDK_OUT=" ]; then + obj=${arg#NDK_OUT=} + elif [ "${arg:0:13}" == "NDK_LIBS_OUT=" ]; then + lib=${arg#NDK_LIBS_OUT=} + else + ndk_args="$ndk_args $arg" + fi +done + +if [ -z $obj ]; then + obj=$buildandroid/obj +fi +if [ -z $lib ]; then + lib=$buildandroid/lib +fi + +for dir in $build $buildandroid $obj $lib; do + if test -d $dir; then + : + else + mkdir $dir || exit 1 + fi +done + + +# APP_* variables set in the environment here will not be seen by the +# ndk-build makefile segments that use them, e.g., default-application.mk. +# For consistency, pass all values on the command line. +ndk-build \ + NDK_PROJECT_PATH=null \ + NDK_OUT=$obj \ + NDK_LIBS_OUT=$lib \ + APP_BUILD_SCRIPT=Android.mk \ + APP_ABI="armeabi-v7a arm64-v8a x86 x86_64" \ + APP_PLATFORM=android-14 \ + APP_MODULES="SDL2 SDL2_main" \ + $ndk_args diff --git a/Engine/lib/sdl/build-scripts/checker-buildbot.sh b/Engine/lib/sdl/build-scripts/checker-buildbot.sh index eb014311a..cc16a50a2 100755 --- a/Engine/lib/sdl/build-scripts/checker-buildbot.sh +++ b/Engine/lib/sdl/build-scripts/checker-buildbot.sh @@ -11,7 +11,7 @@ FINALDIR="$1" -CHECKERDIR="/usr/local/checker-276" +CHECKERDIR="/usr/local/checker-279" if [ ! -d "$CHECKERDIR" ]; then echo "$CHECKERDIR not found. Trying /usr/share/clang ..." 1>&2 CHECKERDIR="/usr/share/clang/scan-build" @@ -46,6 +46,10 @@ fi echo "\$MAKE is '$MAKE'" +# Unset $MAKE so submakes don't use it. +MAKECOMMAND="$MAKE" +unset MAKE + set -x set -e @@ -60,17 +64,23 @@ fi mkdir checker-buildbot cd checker-buildbot +# We turn off deprecated declarations, because we don't care about these warnings during static analysis. +# The -Wno-liblto is new since our checker-279 upgrade, I think; checker otherwise warns "libLTO.dylib relative to clang installed dir not found" + # You might want to do this for CMake-backed builds instead... -PATH="$CHECKERDIR:$PATH" scan-build -o analysis cmake -DCMAKE_BUILD_TYPE=Debug -DASSERTIONS=enabled .. +PATH="$CHECKERDIR/bin:$PATH" scan-build -o analysis cmake -Wno-dev -DSDL_STATIC=OFF -DCMAKE_BUILD_TYPE=Debug -DASSERTIONS=enabled -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_SHARED_LINKER_FLAGS="-Wno-liblto" .. # ...or run configure without the scan-build wrapper... -#CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0" ../configure --enable-assertions=enabled - -# ...but this works for our buildbots just fine (EXCEPT ON LATEST MAC OS X). -#CFLAGS="-O0" PATH="$CHECKERDIR:$PATH" scan-build -o analysis ../configure --enable-assertions=enabled +#CC="$CHECKERDIR/libexec/ccc-analyzer" CFLAGS="-O0 -Wno-deprecated-declarations" LDFLAGS="-Wno-liblto" ../configure --enable-assertions=enabled rm -rf analysis -PATH="$CHECKERDIR:$PATH" scan-build -o analysis $MAKE +PATH="$CHECKERDIR/bin:$PATH" scan-build -o analysis $MAKECOMMAND + +if [ `ls -A analysis |wc -l` == 0 ] ; then + mkdir analysis/zarro + echo 'Zarro boogsStatic analysis: no issues to report.' >analysis/zarro/index.html +fi + mv analysis/* ../analysis rmdir analysis # Make sure this is empty. cd .. diff --git a/Engine/lib/sdl/build-scripts/config.guess b/Engine/lib/sdl/build-scripts/config.guess index 68c1be32a..a74484427 100644 --- a/Engine/lib/sdl/build-scripts/config.guess +++ b/Engine/lib/sdl/build-scripts/config.guess @@ -1,14 +1,12 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2012-08-14' +timestamp='2017-08-08' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but @@ -22,19 +20,17 @@ timestamp='2012-08-14' # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). # -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. +# Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess +# +# Please send patches to . + me=`echo "$0" | sed -e 's,.*/,,'` @@ -54,9 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +Copyright 1992-2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -138,6 +132,27 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown +case "${UNAME_SYSTEM}" in +Linux|GNU|GNU/*) + # If the system lacks a compiler, then just pick glibc. + # We could probably try harder. + LIBC=gnu + + eval $set_cc_for_build + cat <<-EOF > $dummy.c + #include + #if defined(__UCLIBC__) + LIBC=uclibc + #elif defined(__dietlibc__) + LIBC=dietlibc + #else + LIBC=gnu + #endif + EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` + ;; +esac + # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in @@ -153,19 +168,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || \ + echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. + # to ELF recently (or will in the future) and ABI. case "${UNAME_MACHINE_ARCH}" in + earm*) + os=netbsdelf + ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -182,6 +207,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in os=netbsd ;; esac + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + ;; + esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -192,13 +224,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" + echo "${machine}-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -208,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; @@ -220,6 +256,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; + *:Sortix:*:*) + echo ${UNAME_MACHINE}-unknown-sortix + exit ;; + *:Redox:*:*) + echo ${UNAME_MACHINE}-unknown-redox + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -236,42 +278,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; + UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; + UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; + UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; + UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; + UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; + UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; + UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; + UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; + UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 @@ -306,7 +348,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) + arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-unknown-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) @@ -344,16 +386,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build - SUN_ARCH="i386" + SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH="x86_64" + SUN_ARCH=x86_64 fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -378,7 +420,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} @@ -564,8 +606,9 @@ EOF else IBM_ARCH=powerpc fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` + if [ -x /usr/bin/lslpp ] ; then + IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc | + awk -F: '{ print $3 }' | sed s/[0-9]*$/0/` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi @@ -602,13 +645,13 @@ EOF sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi @@ -647,11 +690,11 @@ EOF exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = "hppa2.0w" ] + if [ ${HP_ARCH} = hppa2.0w ] then eval $set_cc_for_build @@ -664,12 +707,12 @@ EOF # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH="hppa2.0w" + HP_ARCH=hppa2.0w else - HP_ARCH="hppa64" + HP_ARCH=hppa64 fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} @@ -774,14 +817,14 @@ EOF echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) @@ -797,10 +840,11 @@ EOF UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + UNAME_PROCESSOR=x86_64 ;; + i386) + UNAME_PROCESSOR=i586 ;; esac + echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin @@ -811,7 +855,7 @@ EOF *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; - i*:MSYS*:*) + *:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) @@ -859,21 +903,21 @@ EOF exit ;; *:GNU:*:*) # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit ;; aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in @@ -886,64 +930,60 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + arc:Linux:*:* | arceb:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arm*:Linux:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} else - case `sed -n '/^Hardware/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - BCM2708) MANUFACTURER=raspberry;; - BCM2709) MANUFACTURER=raspberry;; - *) MANUFACTURER=unknown;; - esac if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then - echo ${UNAME_MACHINE}-${MANUFACTURER}-linux-gnueabi + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi else - echo ${UNAME_MACHINE}-${MANUFACTURER}-linux-gnueabihf + echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf fi fi exit ;; avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-gnu + echo ${UNAME_MACHINE}-axis-linux-${LIBC} + exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + k1om:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; mips:Linux:*:* | mips64:Linux:*:*) eval $set_cc_for_build @@ -962,54 +1002,69 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } ;; - or32:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + mips64el:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; + openrisc*:Linux:*:*) + echo or1k-unknown-linux-${LIBC} + exit ;; + or32:Linux:*:* | or1k*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; padre:Linux:*:*) - echo sparc-unknown-linux-gnu + echo sparc-unknown-linux-${LIBC} exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu + echo hppa64-unknown-linux-${LIBC} exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; + PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; + PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; + *) echo hppa-unknown-linux-${LIBC} ;; esac exit ;; ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu + echo powerpc64-unknown-linux-${LIBC} exit ;; ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu + echo powerpc-unknown-linux-${LIBC} + exit ;; + ppc64le:Linux:*:*) + echo powerpc64le-unknown-linux-${LIBC} + exit ;; + ppcle:Linux:*:*) + echo powerpcle-unknown-linux-${LIBC} + exit ;; + riscv32:Linux:*:* | riscv64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux + echo ${UNAME_MACHINE}-ibm-linux-${LIBC} exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu + echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. @@ -1085,7 +1140,7 @@ EOF # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that + # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; @@ -1234,6 +1289,9 @@ EOF SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1242,24 +1300,43 @@ EOF exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac + eval $set_cc_for_build + if test "$UNAME_PROCESSOR" = unknown ; then + UNAME_PROCESSOR=powerpc + fi + if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + case $UNAME_PROCESSOR in + i386) UNAME_PROCESSOR=x86_64 ;; + powerpc) UNAME_PROCESSOR=powerpc64 ;; + esac + fi + # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc + if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_PPC >/dev/null + then + UNAME_PROCESSOR=powerpc + fi + fi + elif test "$UNAME_PROCESSOR" = i386 ; then + # Avoid executing cc on OS X 10.9, as it ships with a stub + # that puts up a graphical alert prompting to install + # developer tools. Any system running Mac OS X 10.7 or + # later (Darwin 11 and later) is required to have a 64-bit + # processor. This is not true of the ARM version of Darwin + # that Apple uses in portable devices. + UNAME_PROCESSOR=x86_64 + fi echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then + if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi @@ -1268,15 +1345,18 @@ EOF *:QNX:*:4*) echo i386-pc-qnx exit ;; - NEO-?:NONSTOP_KERNEL:*:*) + NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk${UNAME_RELEASE} exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk${UNAME_RELEASE} exit ;; - NSR-?:NONSTOP_KERNEL:*:*) + NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} exit ;; + NSX-*:NONSTOP_KERNEL:*:*) + echo nsx-tandem-nsk${UNAME_RELEASE} + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; @@ -1290,7 +1370,7 @@ EOF # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = "386"; then + if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" @@ -1332,7 +1412,7 @@ EOF echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos @@ -1343,171 +1423,25 @@ EOF x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; esac -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - cat >&2 < in order to provide the needed -information to handle your system. +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches@gnu.org to +provide the necessary information to handle your system. config.guess timestamp = $timestamp diff --git a/Engine/lib/sdl/build-scripts/config.sub b/Engine/lib/sdl/build-scripts/config.sub index 53273f2bb..dcf41330c 100644 --- a/Engine/lib/sdl/build-scripts/config.sub +++ b/Engine/lib/sdl/build-scripts/config.sub @@ -1,24 +1,18 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011, 2012 Free Software Foundation, Inc. +# Copyright 1992-2017 Free Software Foundation, Inc. -timestamp='2012-08-18' +timestamp='2017-04-02' -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . @@ -26,11 +20,12 @@ timestamp='2012-08-18' # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. +# the same distribution terms that you use for the rest of that +# program. This Exception is an additional permission under section 7 +# of the GNU General Public License, version 3 ("GPLv3"). -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. +# Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. @@ -38,7 +33,7 @@ timestamp='2012-08-18' # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -58,8 +53,7 @@ timestamp='2012-08-18' me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. @@ -73,9 +67,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 -Free Software Foundation, Inc. +Copyright 1992-2017 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -124,8 +116,8 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ + kopensolaris*-gnu* | cloudabi*-eabi* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` @@ -156,7 +148,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) + -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; @@ -259,21 +251,25 @@ case $basic_machine in | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | be32 | be64 \ + | arc | arceb \ + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ + | avr | avr32 \ + | ba \ + | be32 | be64 \ | bfin \ - | c4x | clipper \ + | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ + | e2k | epiphany \ + | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ - | i370 | i860 | i960 | ia64 \ + | i370 | i860 | i960 | ia16 | ia64 \ | ip2k | iq2000 \ + | k1om \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ + | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -287,26 +283,30 @@ case $basic_machine in | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ + | mipsisa32r6 | mipsisa32r6el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64r6 | mipsisa64r6el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ + | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ - | nios | nios2 \ + | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ - | open8 \ - | or32 \ + | open8 | or1k | or1knd | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ + | pru \ | pyramid \ + | riscv32 | riscv64 \ | rl78 | rx \ | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ @@ -314,6 +314,8 @@ case $basic_machine in | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ + | visium \ + | wasm32 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) @@ -328,7 +330,10 @@ case $basic_machine in c6x) basic_machine=tic6x-unknown ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) + leon|leon[3-9]) + basic_machine=sparc-$basic_machine + ;; + m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) basic_machine=$basic_machine-unknown os=-none ;; @@ -383,26 +388,29 @@ case $basic_machine in | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | clipper-* | craynv-* | cydra-* \ + | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ + | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ + | i*86-* | i860-* | i960-* | ia16-* | ia64-* \ | ip2k-* | iq2000-* \ + | k1om-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ + | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -416,28 +424,34 @@ case $basic_machine in | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa32r6-* | mipsisa32r6el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64r6-* | mipsisa64r6el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* \ + | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ + | or1k*-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ + | pru-* \ | pyramid-* \ + | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ @@ -445,6 +459,8 @@ case $basic_machine in | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ + | visium-* \ + | wasm32-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ @@ -521,6 +537,9 @@ case $basic_machine in basic_machine=i386-pc os=-aros ;; + asmjs) + basic_machine=asmjs-unknown + ;; aux) basic_machine=m68k-apple os=-aux @@ -641,6 +660,14 @@ case $basic_machine in basic_machine=m68k-bull os=-sysv3 ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + os=$os"spe" + ;; ebmon29k) basic_machine=a29k-amd os=-ebmon @@ -782,6 +809,9 @@ case $basic_machine in basic_machine=m68k-isi os=-sysv ;; + leon-*|leon[3-9]-*) + basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'` + ;; m68knommu) basic_machine=m68k-unknown os=-linux @@ -801,7 +831,7 @@ case $basic_machine in basic_machine=ns32k-utek os=-sysv ;; - microblaze) + microblaze*) basic_machine=microblaze-xilinx ;; mingw64) @@ -809,7 +839,7 @@ case $basic_machine in os=-mingw64 ;; mingw32) - basic_machine=i386-pc + basic_machine=i686-pc os=-mingw32 ;; mingw32ce) @@ -837,6 +867,10 @@ case $basic_machine in basic_machine=powerpc-unknown os=-morphos ;; + moxiebox) + basic_machine=moxie-unknown + os=-moxiebox + ;; msdos) basic_machine=i386-pc os=-msdos @@ -845,7 +879,7 @@ case $basic_machine in basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) - basic_machine=i386-pc + basic_machine=i686-pc os=-msys ;; mvs) @@ -933,6 +967,9 @@ case $basic_machine in nsr-tandem) basic_machine=nsr-tandem ;; + nsx-tandem) + basic_machine=nsx-tandem + ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf @@ -1017,7 +1054,7 @@ case $basic_machine in ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppcle | powerpclittle | ppc-le | powerpc-little) + ppcle | powerpclittle) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) @@ -1027,7 +1064,7 @@ case $basic_machine in ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) + ppc64le | powerpc64little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) @@ -1040,7 +1077,11 @@ case $basic_machine in basic_machine=i586-unknown os=-pw32 ;; - rdos) + rdos | rdos64) + basic_machine=x86_64-pc + os=-rdos + ;; + rdos32) basic_machine=i386-pc os=-rdos ;; @@ -1224,6 +1265,9 @@ case $basic_machine in basic_machine=a29k-wrs os=-vxworks ;; + wasm32) + basic_machine=wasm32-unknown + ;; w65*) basic_machine=w65-wdc os=-none @@ -1367,29 +1411,30 @@ case $os in -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ + | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ + | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ + | -chorusos* | -chorusrdb* | -cegcc* | -glidix* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ + | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ + | -onefs* | -tirtos* | -phoenix* | -fuchsia* | -redox*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1437,6 +1482,9 @@ case $os in -os400*) os=-os400 ;; + -cegcc*) + os=-cegcc + ;; -wince*) os=-wince ;; @@ -1519,9 +1567,6 @@ case $os in -aros*) os=-aros ;; - -kaos*) - os=-kaos - ;; -zvmoe) os=-zvmoe ;; @@ -1534,6 +1579,8 @@ case $os in -pnacl*) os=-pnacl ;; + -ios) + ;; -emscripten*) ;; -none) @@ -1576,6 +1623,9 @@ case $basic_machine in c4x-* | tic4x-*) os=-coff ;; + c8051-*) + os=-elf + ;; hexagon-*) os=-elf ;; @@ -1628,6 +1678,9 @@ case $basic_machine in sparc-* | *-sun) os=-sunos4.1.1 ;; + pru-*) + os=-elf + ;; *-be) os=-beos ;; diff --git a/Engine/lib/sdl/build-scripts/config.sub.patch b/Engine/lib/sdl/build-scripts/config.sub.patch new file mode 100644 index 000000000..8c09e0046 --- /dev/null +++ b/Engine/lib/sdl/build-scripts/config.sub.patch @@ -0,0 +1,72 @@ +--- config.sub.orig 2017-09-09 08:01:02.139023205 -0700 ++++ config.sub 2017-09-09 07:59:35.798264474 -0700 +@@ -364,6 +364,19 @@ + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; ++ nacl64*) ++ basic_machine=x86_64-pc ++ os=-nacl ++ ;; ++ nacl*) ++ basic_machine=i686-pc ++ os=-nacl ++ ;; ++ pnacl*) ++ # le32-unknown-pnacl comes from http://www.chromium.org/nativeclient/pnacl/stability-of-the-pnacl-bitcode-abi ++ basic_machine=le32-unknown ++ os=-pnacl ++ ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 +@@ -877,6 +890,10 @@ + basic_machine=le32-unknown + os=-nacl + ;; ++ pnacl) ++ basic_machine=le32-unknown ++ os=-pnacl ++ ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 +@@ -1429,6 +1446,12 @@ + ;; + esac + ;; ++ -nacl*) ++ os=-nacl ++ ;; ++ -pnacl*) ++ os=-pnacl ++ ;; + -nto-qnx*) + ;; + -nto*) +@@ -1459,6 +1482,9 @@ + -os400*) + os=-os400 + ;; ++ -cegcc*) ++ os=-cegcc ++ ;; + -wince*) + os=-wince + ;; +@@ -1548,9 +1574,15 @@ + os=-dicos + ;; + -nacl*) ++ os=-nacl ++ ;; ++ -pnacl*) ++ os=-pnacl + ;; + -ios) + ;; ++ -emscripten*) ++ ;; + -none) + ;; + *) diff --git a/Engine/lib/sdl/build-scripts/emscripten-buildbot.sh b/Engine/lib/sdl/build-scripts/emscripten-buildbot.sh index 42eebb697..65b43e83e 100755 --- a/Engine/lib/sdl/build-scripts/emscripten-buildbot.sh +++ b/Engine/lib/sdl/build-scripts/emscripten-buildbot.sh @@ -1,9 +1,13 @@ #!/bin/bash -SDKDIR="/emsdk_portable" +if [ -z "$SDKDIR" ]; then + SDKDIR="/emsdk_portable" +fi + ENVSCRIPT="$SDKDIR/emsdk_env.sh" if [ ! -f "$ENVSCRIPT" ]; then echo "ERROR: This script expects the Emscripten SDK to be in '$SDKDIR'." 1>&2 + echo "ERROR: Set the \$SDKDIR environment variable to override this." 1>&2 exit 1 fi @@ -51,7 +55,7 @@ mkdir buildbot pushd buildbot echo "Configuring..." -emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --enable-cpuinfo=false CFLAGS="-O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$PWD/emscripten-sdl2-installed" || exit $? +emconfigure ../configure --host=asmjs-unknown-emscripten --disable-assembly --disable-threads --disable-cpuinfo CFLAGS="-O2 -Wno-warn-absolute-paths -Wdeclaration-after-statement -Werror=declaration-after-statement" --prefix="$PWD/emscripten-sdl2-installed" || exit $? echo "Building..." emmake $MAKE || exit $? diff --git a/Engine/lib/sdl/build-scripts/iosbuild.sh b/Engine/lib/sdl/build-scripts/iosbuild.sh index eeb571624..bb0e6319c 100755 --- a/Engine/lib/sdl/build-scripts/iosbuild.sh +++ b/Engine/lib/sdl/build-scripts/iosbuild.sh @@ -1,7 +1,6 @@ #!/bin/sh # # Build a fat binary for iOS -# Based on fatbuild.sh and code from the Ignifuga Game Engine # Number of CPUs (for make -j) NCPU=`sysctl -n hw.ncpu` @@ -9,269 +8,181 @@ if test x$NJOB = x; then NJOB=$NCPU fi -# SDK path -XCODE_PATH=`xcode-select --print-path` -if [ -z "$XCODE_PATH" ]; then - echo "Could not find XCode location (use xcode-select -switch to set the correct path)" - exit 1 -fi - -prepare_environment() { - ARCH=$1 - - if test x$SDK_VERSION = x; then - export SDK_VERSION=`xcodebuild -showsdks | grep iphoneos | sed "s|.*iphoneos||"` - if [ -z "$XCODE_PATH" ]; then - echo "Could not find a valid iOS SDK" - exit 1 - fi - fi - - case $ARCH in - armv6) - DEV_PATH="$XCODE_PATH/Platforms/iPhoneOS.platform/Developer" - SDK_PATH="$DEV_PATH/SDKs/iPhoneOS$SDK_VERSION.sdk" - ;; - armv7) - DEV_PATH="$XCODE_PATH/Platforms/iPhoneOS.platform/Developer" - SDK_PATH="$DEV_PATH/SDKs/iPhoneOS$SDK_VERSION.sdk" - ;; - i386) - DEV_PATH="$XCODE_PATH/Platforms/iPhoneSimulator.platform/Developer" - SDK_PATH="$DEV_PATH/SDKs/iPhoneSimulator$SDK_VERSION.sdk" - ;; - *) - echo "Unknown Architecture $ARCH" - exit 1 - ;; - esac - - if [ ! -d "$SDK_PATH" ]; then - echo "Could not find iOS SDK at $SDK_PATH" - exit 1 - fi - - if test x$MIN_OS_VERSION = x; then - export MIN_OS_VERSION="3.0" - fi - - # Environment flags - CFLAGS="-g -O2 -pipe -no-cpp-precomp -isysroot $SDK_PATH \ - -miphoneos-version-min=$MIN_OS_VERSION -I$SDK_PATH/usr/include/" - LDFLAGS="-L$SDK_PATH/usr/lib/ -isysroot $SDK_PATH \ - -miphoneos-version-min=$MIN_OS_VERSION -static-libgcc" - export CXXFLAGS="$CFLAGS" - export CXXCPP="$DEV_PATH/usr/bin/llvm-cpp-4.2" - export CPP="$CXXCPP" - export CXX="$DEV_PATH/usr/bin/llvm-g++-4.2" - export CC="$DEV_PATH/usr/bin/llvm-gcc-4.2" - export LD="$DEV_PATH/usr/bin/ld" - export AR="$DEV_PATH/usr/bin/ar" - export AS="$DEV_PATH/usr/bin/ls" - export NM="$DEV_PATH/usr/bin/nm" - export RANLIB="$DEV_PATH/usr/bin/ranlib" - export STRIP="$DEV_PATH/usr/bin/strip" - - # We dynamically load X11, so using the system X11 headers is fine. - CONFIG_FLAGS="--disable-shared --enable-static" - - case $ARCH in - armv6) - export CONFIG_FLAGS="$CONFIG_FLAGS --host=armv6-apple-darwin" - export CFLAGS="$CFLAGS -arch armv6" - export LDFLAGS="$LDFLAGS -arch armv6" - ;; - armv7) - export CONFIG_FLAGS="$CONFIG_FLAGS --host=armv7-apple-darwin" - export CFLAGS="$CFLAGS -arch armv7" - export LDFLAGS="$LDFLAGS -arch armv7" - ;; - i386) - export CONFIG_FLAGS="$CONFIG_FLAGS --host=i386-apple-darwin" - export CFLAGS="$CFLAGS -arch i386" - export LDFLAGS="$LDFLAGS -arch i386" - ;; - *) - echo "Unknown Architecture $ARCH" - exit 1 - ;; - esac -} - -prepare_environment "armv6" -echo "Building with iOS SDK v$SDK_VERSION for iOS >= $MIN_OS_VERSION" - -# -# Find the configure script -# -srcdir=`dirname $0`/.. -srcdir=`cd $srcdir && pwd` -auxdir=$srcdir/build-scripts -cd $srcdir - -# -# Figure out which phase to build: -# all, -# configure, configure-armv6, configure-armv7, configure-i386 -# make, make-armv6, make-armv7, make-i386, merge -# clean -if test x"$1" = x; then - phase=all +SRC_DIR=$(cd `dirname $0`/..; pwd) +if [ "$PWD" = "$SRC_DIR" ]; then + PREFIX=$SRC_DIR/ios-build + mkdir $PREFIX else - phase="$1" -fi -case $phase in - all) - configure_armv6="yes" - configure_armv7="yes" - configure_i386="yes" - make_armv6="yes" - make_armv7="yes" - make_i386="yes" - merge="yes" - ;; - configure) - configure_armv6="yes" - configure_armv7="yes" - configure_i386="yes" - ;; - configure-armv6) - configure_armv6="yes" - ;; - configure-armv7) - configure_armv7="yes" - ;; - configure-i386) - configure_i386="yes" - ;; - make) - make_armv6="yes" - make_armv7="yes" - make_i386="yes" - merge="yes" - ;; - make-armv6) - make_armv6="yes" - ;; - make-armv7) - make_armv7="yes" - ;; - make-i386) - make_i386="yes" - ;; - merge) - merge="yes" - ;; - clean) - clean_armv6="yes" - clean_armv7="yes" - clean_i386="yes" - ;; - clean-armv6) - clean_armv6="yes" - ;; - clean-armv7) - clean_armv7="yes" - ;; - clean-i386) - clean_i386="yes" - ;; - *) - echo "Usage: $0 [all|configure[-armv6|-armv7|-i386]|make[-armv6|-armv7|-i386]|merge|clean[-armv6|-armv7|-i386]]" - exit 1 - ;; -esac - -# -# Create the build directories -# -for dir in build build/armv6 build/armv7 build/i386; do - if test -d $dir; then - : - else - mkdir $dir || exit 1 - fi -done - -# -# Build the armv6 binary -# -prepare_environment "armv6" -if test x$configure_armv6 = xyes; then - (cd build/armv6 && \ - sh ../../configure $CONFIG_FLAGS CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS") || exit 2 - # configure is not yet fully ready for iOS, some manual patching is required - cp include/* build/armv6/include - cp include/SDL_config_iphoneos.h build/armv6/include/SDL_config.h || exit 2 - sed -i "" -e "s|^EXTRA_CFLAGS.*|EXTRA_CFLAGS=-I./include|g" build/armv6/Makefile || exit 2 - sed -i "" -e "s|^EXTRA_LDFLAGS.*|EXTRA_LDFLAGS=-lm|g" build/armv6/Makefile || exit 2 -fi -if test x$make_armv6 = xyes; then - (cd build/armv6 && make -j$NJOB) || exit 3 -fi -# -# Build the armv7 binary -# -prepare_environment "armv7" -if test x$configure_armv7 = xyes; then - (cd build/armv7 && \ - sh ../../configure $CONFIG_FLAGS CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS") || exit 2 - # configure is not yet fully ready for iOS, some manual patching is required - cp include/* build/armv7/include - cp include/SDL_config_iphoneos.h build/armv7/include/SDL_config.h || exit 2 - sed -i "" -e "s|^EXTRA_CFLAGS.*|EXTRA_CFLAGS=-I./include|g" build/armv7/Makefile || exit 2 - sed -i "" -e "s|^EXTRA_LDFLAGS.*|EXTRA_LDFLAGS=-lm|g" build/armv7/Makefile || exit 2 -fi -if test x$make_armv7 = xyes; then - (cd build/armv7 && make -j$NJOB) || exit 3 -fi -# -# Build the i386 binary -# -prepare_environment "i386" -if test x$configure_i386 = xyes; then - (cd build/i386 && \ - sh ../../configure $CONFIG_FLAGS CC="$CC" CXX="$CXX" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS") || exit 2 - # configure is not yet fully ready for iOS, some manual patching is required - cp include/* build/i386/include - cp include/SDL_config_iphoneos.h build/i386/include/SDL_config.h || exit 2 - sed -i "" -e "s|^EXTRA_CFLAGS.*|EXTRA_CFLAGS=-I./include|g" build/i386/Makefile || exit 2 - sed -i "" -e "s|^EXTRA_LDFLAGS.*|EXTRA_LDFLAGS=-lm|g" build/i386/Makefile || exit 2 -fi -if test x$make_i386 = xyes; then - (cd build/i386 && make -j$NJOB) || exit 3 + PREFIX=$PWD fi -# -# Combine into fat binary -# -if test x$merge = xyes; then - output=ios/lib - sh $auxdir/mkinstalldirs build/$output - cd build - target=`find . -mindepth 4 -maxdepth 4 -type f -name '*.dylib' | head -1 | sed 's|.*/||'` - (lipo -create -o $output/libSDL2.a armv6/build/.libs/libSDL2.a armv7/build/.libs/libSDL2.a i386/build/.libs/libSDL2.a && - lipo -create -o $output/libSDL2main.a armv6/build/libSDL2main.a armv7/build/libSDL2main.a i386/build/libSDL2main.a && - cp -r armv6/include ios - echo "Build complete!" && - echo "Files can be found under the build/ios directory.") || exit 4 - cd .. +BUILD_I386_IOSSIM=YES +BUILD_X86_64_IOSSIM=YES + +BUILD_IOS_ARMV7=YES +BUILD_IOS_ARMV7S=YES +BUILD_IOS_ARM64=YES + +# 13.4.0 - Mavericks +# 14.0.0 - Yosemite +# 15.0.0 - El Capitan +DARWIN=darwin15.0.0 + +XCODEDIR=`xcode-select --print-path` +IOS_SDK_VERSION=`xcrun --sdk iphoneos --show-sdk-version` +MIN_SDK_VERSION=6.0 + +IPHONEOS_PLATFORM=`xcrun --sdk iphoneos --show-sdk-platform-path` +IPHONEOS_SYSROOT=`xcrun --sdk iphoneos --show-sdk-path` + +IPHONESIMULATOR_PLATFORM=`xcrun --sdk iphonesimulator --show-sdk-platform-path` +IPHONESIMULATOR_SYSROOT=`xcrun --sdk iphonesimulator --show-sdk-path` + +# Uncomment if you want to see more information about each invocation +# of clang as the builds proceed. +# CLANG_VERBOSE="--verbose" + +CC=clang +CXX=clang + +SILENCED_WARNINGS="-Wno-unused-local-typedef -Wno-unused-function" + +CFLAGS="${CLANG_VERBOSE} ${SILENCED_WARNINGS} -DNDEBUG -g -O0 -pipe -fPIC -fobjc-arc" + +echo "PREFIX ..................... ${PREFIX}" +echo "BUILD_MACOSX_X86_64 ........ ${BUILD_MACOSX_X86_64}" +echo "BUILD_I386_IOSSIM .......... ${BUILD_I386_IOSSIM}" +echo "BUILD_X86_64_IOSSIM ........ ${BUILD_X86_64_IOSSIM}" +echo "BUILD_IOS_ARMV7 ............ ${BUILD_IOS_ARMV7}" +echo "BUILD_IOS_ARMV7S ........... ${BUILD_IOS_ARMV7S}" +echo "BUILD_IOS_ARM64 ............ ${BUILD_IOS_ARM64}" +echo "DARWIN ..................... ${DARWIN}" +echo "XCODEDIR ................... ${XCODEDIR}" +echo "IOS_SDK_VERSION ............ ${IOS_SDK_VERSION}" +echo "MIN_SDK_VERSION ............ ${MIN_SDK_VERSION}" +echo "IPHONEOS_PLATFORM .......... ${IPHONEOS_PLATFORM}" +echo "IPHONEOS_SYSROOT ........... ${IPHONEOS_SYSROOT}" +echo "IPHONESIMULATOR_PLATFORM ... ${IPHONESIMULATOR_PLATFORM}" +echo "IPHONESIMULATOR_SYSROOT .... ${IPHONESIMULATOR_SYSROOT}" +echo "CC ......................... ${CC}" +echo "CFLAGS ..................... ${CFLAGS}" +echo "CXX ........................ ${CXX}" +echo "CXXFLAGS ................... ${CXXFLAGS}" +echo "LDFLAGS .................... ${LDFLAGS}" + +################################################################### +# This section contains the build commands for each of the +# architectures that will be included in the universal binaries. +################################################################### + +echo "$(tput setaf 2)" +echo "###########################" +echo "# i386 for iPhone Simulator" +echo "###########################" +echo "$(tput sgr0)" + +if [ "${BUILD_I386_IOSSIM}" == "YES" ] +then + ( + cd ${PREFIX} + make clean + ../configure --build=x86_64-apple-${DARWIN} --host=i386-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/i386-sim "CC=${CC}" "CFLAGS=${CFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch i386 -isysroot ${IPHONESIMULATOR_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch i386 -isysroot ${IPHONESIMULATOR_SYSROOT}" LDFLAGS="-arch i386 -mios-simulator-version-min=${MIN_SDK_VERSION} ${LDFLAGS} -L${IPHONESIMULATOR_SYSROOT}/usr/lib/ -L${IPHONESIMULATOR_SYSROOT}/usr/lib/system" || exit 2 + cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h + make -j10 || exit 3 + make install + ) || exit $? fi -# -# Clean up -# -do_clean() -{ - echo $* - $* || exit 6 -} -if test x$clean_armv6 = xyes; then - do_clean rm -r build/armv6 +echo "$(tput setaf 2)" +echo "#############################" +echo "# x86_64 for iPhone Simulator" +echo "#############################" +echo "$(tput sgr0)" + +if [ "${BUILD_X86_64_IOSSIM}" == "YES" ] +then + ( + cd ${PREFIX} + make clean + ../configure --build=x86_64-apple-${DARWIN} --host=x86_64-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/x86_64-sim "CC=${CC}" "CFLAGS=${CFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch x86_64 -isysroot ${IPHONESIMULATOR_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -mios-simulator-version-min=${MIN_SDK_VERSION} -arch x86_64 -isysroot ${IPHONESIMULATOR_SYSROOT}" LDFLAGS="-arch x86_64 -mios-simulator-version-min=${MIN_SDK_VERSION} ${LDFLAGS} -L${IPHONESIMULATOR_SYSROOT}/usr/lib/ -L${IPHONESIMULATOR_SYSROOT}/usr/lib/system" || exit 2 + cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h + make -j$NJOB || exit 3 + make install + ) || exit $? fi -if test x$clean_armv7 = xyes; then - do_clean rm -r build/armv7 + +echo "$(tput setaf 2)" +echo "##################" +echo "# armv7 for iPhone" +echo "##################" +echo "$(tput sgr0)" + +if [ "${BUILD_IOS_ARMV7}" == "YES" ] +then + ( + cd ${PREFIX} + make clean + ../configure --build=x86_64-apple-${DARWIN} --host=armv7-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/armv7-ios "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch armv7 -isysroot ${IPHONEOS_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -arch armv7 -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS="-arch armv7 -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" || exit 2 + cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h + make -j$NJOB || exit 3 + make install + ) || exit $? fi -if test x$clean_i386 = xyes; then - do_clean rm -r build/i386 + +echo "$(tput setaf 2)" +echo "###################" +echo "# armv7s for iPhone" +echo "###################" +echo "$(tput sgr0)" + +if [ "${BUILD_IOS_ARMV7S}" == "YES" ] +then + ( + cd ${PREFIX} + make clean + ../configure --build=x86_64-apple-${DARWIN} --host=armv7s-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/armv7s-ios "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch armv7s -isysroot ${IPHONEOS_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch armv7s -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS="-arch armv7s -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" || exit 2 + cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h + make -j$NJOB || exit 3 + make install + ) || exit $? fi + +echo "$(tput setaf 2)" +echo "##################" +echo "# arm64 for iPhone" +echo "##################" +echo "$(tput sgr0)" + +if [ "${BUILD_IOS_ARM64}" == "YES" ] +then + ( + cd ${PREFIX} + make clean + ../configure --build=x86_64-apple-${DARWIN} --host=arm-ios-${DARWIN} --disable-shared --prefix=${PREFIX}/platform/arm64-ios "CC=${CC}" "CFLAGS=${CFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch arm64 -isysroot ${IPHONEOS_SYSROOT}" "CXX=${CXX}" "CXXFLAGS=${CXXFLAGS} -miphoneos-version-min=${MIN_SDK_VERSION} -arch arm64 -isysroot ${IPHONEOS_SYSROOT}" LDFLAGS="-arch arm64 -miphoneos-version-min=${MIN_SDK_VERSION} ${LDFLAGS}" || exit 2 + cp $SRC_DIR/include/SDL_config_iphoneos.h include/SDL_config.h + make -j$NJOB || exit 3 + make install + ) || exit $? +fi + +echo "$(tput setaf 2)" +echo "###################################################################" +echo "# Create Universal Libraries and Finalize the packaging" +echo "###################################################################" +echo "$(tput sgr0)" + +( + cd ${PREFIX}/platform + mkdir -p universal + lipo x86_64-sim/lib/libSDL2.a i386-sim/lib/libSDL2.a arm64-ios/lib/libSDL2.a armv7s-ios/lib/libSDL2.a armv7-ios/lib/libSDL2.a -create -output universal/libSDL2.a +) + +( + cd ${PREFIX} + mkdir -p lib + cp -r platform/universal/* lib + #rm -rf platform + lipo -info lib/libSDL2.a +) + +echo Done! diff --git a/Engine/lib/sdl/build-scripts/ltmain.sh b/Engine/lib/sdl/build-scripts/ltmain.sh index 63ae69dc6..6635343b2 100755 --- a/Engine/lib/sdl/build-scripts/ltmain.sh +++ b/Engine/lib/sdl/build-scripts/ltmain.sh @@ -189,7 +189,7 @@ func_basename () # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. -# value retuned in "$func_basename_result" +# value returned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. @@ -3276,7 +3276,7 @@ extern \"C\" { /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime +/* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined(__osf__) @@ -4394,7 +4394,7 @@ EOF { /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX namespace, but it is not one of the ones we know about and - have already dealt with, above (inluding dump-script), then + have already dealt with, above (including dump-script), then report an error. Otherwise, targets might begin to believe they are allowed to use options in the LTWRAPPER_OPTION_PREFIX namespace. The first time any user complains about this, we'll diff --git a/Engine/lib/sdl/build-scripts/nacl-buildbot.sh b/Engine/lib/sdl/build-scripts/nacl-buildbot.sh index a72333bb7..73aae9eaf 100755 --- a/Engine/lib/sdl/build-scripts/nacl-buildbot.sh +++ b/Engine/lib/sdl/build-scripts/nacl-buildbot.sh @@ -3,7 +3,11 @@ # This is the script buildbot.libsdl.org uses to cross-compile SDL2 from # amd64 Linux to NaCl. -export NACL_SDK_ROOT="/nacl_sdk/pepper_35" +# PLEASE NOTE that we have reports that SDL built with pepper_49 (current +# stable release as of November 10th, 2016) is broken. Please retest +# when something newer becomes stable and then decide if this was SDL's +# bug or NaCl's bug. --ryan. +export NACL_SDK_ROOT="/nacl_sdk/pepper_47" TARBALL="$1" if [ -z $1 ]; then diff --git a/Engine/lib/sdl/build-scripts/update-copyright.sh b/Engine/lib/sdl/build-scripts/update-copyright.sh index 34864bc91..5955b09fa 100755 --- a/Engine/lib/sdl/build-scripts/update-copyright.sh +++ b/Engine/lib/sdl/build-scripts/update-copyright.sh @@ -2,8 +2,7 @@ find . -type f -exec grep -Il "Copyright" {} \; \ | grep -v \.hg \ -| while read i; \ +| while read file; \ do \ - LC_ALL=C sed -ie "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$i"; \ - rm "${i}e"; \ + LC_ALL=C sed -b -i "s/\(.*Copyright.*\)[0-9]\{4\}\( *Sam Lantinga\)/\1`date +%Y`\2/" "$file"; \ done diff --git a/Engine/lib/sdl/build-scripts/windows-buildbot-zipper.bat b/Engine/lib/sdl/build-scripts/windows-buildbot-zipper.bat index 7548cdd83..65adfeb1b 100644 --- a/Engine/lib/sdl/build-scripts/windows-buildbot-zipper.bat +++ b/Engine/lib/sdl/build-scripts/windows-buildbot-zipper.bat @@ -3,11 +3,16 @@ rem just a helper batch file for collecting up files and zipping them. rem usage: windows-buildbot-zipper.bat rem must be run from root of SDL source tree. -IF EXIST VisualC\Win32\Release GOTO okaydir +IF EXIST VisualC\Win32\Release GOTO okaywin32dir echo Please run from root of source tree after doing a Release build. GOTO done -:okaydir +:okaywin32dir +IF EXIST VisualC\x64\Release GOTO okaydirs +echo Please run from root of source tree after doing a Release build. +GOTO done + +:okaydirs erase /q /f /s zipper IF EXIST zipper GOTO zippermade mkdir zipper @@ -18,10 +23,14 @@ cd SDL mkdir include mkdir lib mkdir lib\win32 +mkdir lib\win64 copy ..\..\include\*.h include\ copy ..\..\VisualC\Win32\Release\SDL2.dll lib\win32\ copy ..\..\VisualC\Win32\Release\SDL2.lib lib\win32\ copy ..\..\VisualC\Win32\Release\SDL2main.lib lib\win32\ +copy ..\..\VisualC\x64\Release\SDL2.dll lib\win64\ +copy ..\..\VisualC\x64\Release\SDL2.lib lib\win64\ +copy ..\..\VisualC\x64\Release\SDL2main.lib lib\win64\ cd .. zip -9r ..\%1 SDL cd .. diff --git a/Engine/lib/sdl/build-scripts/winrtbuild.ps1 b/Engine/lib/sdl/build-scripts/winrtbuild.ps1 index 1bfa4da81..7ce050e48 100644 --- a/Engine/lib/sdl/build-scripts/winrtbuild.ps1 +++ b/Engine/lib/sdl/build-scripts/winrtbuild.ps1 @@ -39,7 +39,7 @@ # # Base version of SDL, used for packaging purposes -$SDLVersion = "2.0.4" +$SDLVersion = "2.0.7" # Gets the .bat file that sets up an MSBuild environment, given one of # Visual Studio's, "PlatformToolset"s. @@ -211,18 +211,26 @@ function Build-SDL-WinRT-Variant $DidAnyDLLBuildFail = $false $DidAnyNugetBuildFail = $false +# Ryan disabled WP8.0, because it doesn't appear to have mmdeviceapi.h that SDL_wasapi needs. +# My assumption is that no one will miss this, but send patches otherwise! --ryan. # Build for Windows Phone 8.0, via VC++ 2012: -if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "ARM")) { $DidAnyDLLBuildFail = $true } -if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "Win32")) { $DidAnyDLLBuildFail = $true } +#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "ARM")) { $DidAnyDLLBuildFail = $true } +#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110_wp80" "Win32")) { $DidAnyDLLBuildFail = $true } # Build for Windows Phone 8.1, via VC++ 2013: if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "ARM")) { $DidAnyDLLBuildFail = $true } if ( ! (Build-SDL-WinRT-Variant "SDL" "v120_wp81" "Win32")) { $DidAnyDLLBuildFail = $true } # Build for Windows 8.0 and Windows RT 8.0, via VC++ 2012: -if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "ARM")) { $DidAnyDLLBuildFail = $true } -if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "Win32")) { $DidAnyDLLBuildFail = $true } -if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "x64")) { $DidAnyDLLBuildFail = $true } +# +# Win 8.0 auto-building was disabled on 2017-Feb-25, by David Ludwig . +# Steam's OS-usage surveys indicate that Windows 8.0 use is pretty much nil, plus +# Microsoft hasn't supported Windows 8.0 development for a few years now. +# The commented-out lines below may still work on some systems, though. +# +#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "ARM")) { $DidAnyDLLBuildFail = $true } +#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "Win32")) { $DidAnyDLLBuildFail = $true } +#if ( ! (Build-SDL-WinRT-Variant "SDL" "v110" "x64")) { $DidAnyDLLBuildFail = $true } # Build for Windows 8.1 and Windows RT 8.1, via VC++ 2013: if ( ! (Build-SDL-WinRT-Variant "SDL" "v120" "ARM")) { $DidAnyDLLBuildFail = $true } diff --git a/Engine/lib/sdl/cmake/sdlchecks.cmake b/Engine/lib/sdl/cmake/sdlchecks.cmake index b10078192..b822c7a56 100644 --- a/Engine/lib/sdl/cmake/sdlchecks.cmake +++ b/Engine/lib/sdl/cmake/sdlchecks.cmake @@ -158,6 +158,36 @@ macro(CheckPulseAudio) endif() endmacro() +# Requires: +# - PkgCheckModules +# Optional: +# - JACK_SHARED opt +# - HAVE_DLOPEN opt +macro(CheckJACK) + if(JACK) + pkg_check_modules(PKG_JACK jack) + if(PKG_JACK_FOUND) + set(HAVE_JACK TRUE) + file(GLOB JACK_SOURCES ${SDL2_SOURCE_DIR}/src/audio/jack/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${JACK_SOURCES}) + set(SDL_AUDIO_DRIVER_JACK 1) + list(APPEND EXTRA_CFLAGS ${PKG_JACK_CFLAGS}) + if(JACK_SHARED) + if(NOT HAVE_DLOPEN) + message_warn("You must have SDL_LoadObject() support for dynamic JACK audio loading") + else() + FindLibraryAndSONAME("jack") + set(SDL_AUDIO_DRIVER_JACK_DYNAMIC "\"${JACK_LIB_SONAME}\"") + set(HAVE_JACK_SHARED TRUE) + endif() + else() + list(APPEND EXTRA_LDFLAGS ${PKG_JACK_LDFLAGS}) + endif() + set(HAVE_SDL_AUDIO TRUE) + endif() + endif() +endmacro() + # Requires: # - PkgCheckModules # Optional: @@ -315,6 +345,31 @@ macro(CheckFusionSound) endif() endmacro() +# Requires: +# - LIBSAMPLERATE +# Optional: +# - LIBSAMPLERATE_SHARED opt +# - HAVE_DLOPEN opt +macro(CheckLibSampleRate) + if(LIBSAMPLERATE) + check_include_file(samplerate.h HAVE_LIBSAMPLERATE_H) + if(HAVE_LIBSAMPLERATE_H) + set(HAVE_LIBSAMPLERATE TRUE) + if(LIBSAMPLERATE_SHARED) + if(NOT HAVE_DLOPEN) + message_warn("You must have SDL_LoadObject() support for dynamic libsamplerate loading") + else() + FindLibraryAndSONAME("samplerate") + set(SDL_LIBSAMPLERATE_DYNAMIC "\"${SAMPLERATE_LIB_SONAME}\"") + set(HAVE_LIBSAMPLERATE_SHARED TRUE) + endif() + else() + list(APPEND EXTRA_LDFLAGS -lsamplerate) + endif() + endif() + endif() +endmacro() + # Requires: # - n/a # Optional: @@ -508,7 +563,7 @@ endmacro() macro(CheckMir) if(VIDEO_MIR) find_library(MIR_LIB mirclient mircommon egl) - pkg_check_modules(MIR_TOOLKIT mirclient mircommon) + pkg_check_modules(MIR_TOOLKIT mirclient>=0.26 mircommon) pkg_check_modules(EGL egl) pkg_check_modules(XKB xkbcommon) @@ -520,7 +575,7 @@ macro(CheckMir) set(SOURCE_FILES ${SOURCE_FILES} ${MIR_SOURCES}) set(SDL_VIDEO_DRIVER_MIR 1) - list(APPEND EXTRA_CFLAGS ${MIR_TOOLKIT_CFLAGS} ${EGL_CLFAGS} ${XKB_CLFLAGS}) + list(APPEND EXTRA_CFLAGS ${MIR_TOOLKIT_CFLAGS} ${EGL_CFLAGS} ${XKB_CFLAGS}) if(MIR_SHARED) if(NOT HAVE_DLOPEN) @@ -557,7 +612,7 @@ macro(WaylandProtocolGen _SCANNER _XML _PROTL) ARGS code "${_XML}" "${_WAYLAND_PROT_C_CODE}" ) - set(SOURCE_FILES ${SOURCE_FILES} "${CMAKE_CURRENT_BINARY_DIR}/wayland-generated-protocols/${_PROTL}-protocol.c") + set(SOURCE_FILES ${SOURCE_FILES} "${_WAYLAND_PROT_C_CODE}") endmacro() # Requires: @@ -632,7 +687,7 @@ macro(CheckWayland) WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_CORE_PROTOCOL_DIR}/wayland.xml" "wayland") - foreach(_PROTL relative-pointer-unstable-v1 pointer-constraints-unstable-v1) + foreach(_PROTL relative-pointer-unstable-v1 pointer-constraints-unstable-v1 xdg-shell-unstable-v6) string(REGEX REPLACE "\\-unstable\\-.*$" "" PROTSUBDIR ${_PROTL}) WaylandProtocolGen("${WAYLAND_SCANNER}" "${WAYLAND_PROTOCOLS_DIR}/unstable/${PROTSUBDIR}/${_PROTL}.xml" "${_PROTL}") endforeach() @@ -803,7 +858,10 @@ endmacro() # PTHREAD_LIBS macro(CheckPTHREAD) if(PTHREADS) - if(LINUX) + if(ANDROID) + # the android libc provides built-in support for pthreads, so no + # additional linking or compile flags are necessary + elseif(LINUX) set(PTHREAD_CFLAGS "-D_REENTRANT") set(PTHREAD_LDFLAGS "-pthread") elseif(BSDI) @@ -878,7 +936,7 @@ macro(CheckPTHREAD) #include int main(int argc, char **argv) { pthread_mutexattr_t attr; - pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); return 0; }" HAVE_RECURSIVE_MUTEXES_NP) if(HAVE_RECURSIVE_MUTEXES_NP) @@ -907,7 +965,6 @@ macro(CheckPTHREAD) int main(int argc, char** argv) { return 0; }" HAVE_PTHREAD_NP_H) check_function_exists(pthread_setname_np HAVE_PTHREAD_SETNAME_NP) check_function_exists(pthread_set_name_np HAVE_PTHREAD_SET_NAME_NP) - set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}") set(SOURCE_FILES ${SOURCE_FILES} ${SDL2_SOURCE_DIR}/src/thread/pthread/SDL_systhread.c @@ -924,6 +981,7 @@ macro(CheckPTHREAD) endif() set(HAVE_SDL_THREADS TRUE) endif() + set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}") endif() endmacro() @@ -1071,15 +1129,19 @@ endmacro() # - n/a macro(CheckRPI) if(VIDEO_RPI) - set(VIDEO_RPI_INCLUDE_DIRS "/opt/vc/include" "/opt/vc/include/interface/vcos/pthreads" "/opt/vc/include/interface/vmcs_host/linux/" ) - set(VIDEO_RPI_LIBRARY_DIRS "/opt/vc/lib" ) - set(VIDEO_RPI_LIBS bcm_host ) + pkg_check_modules(VIDEO_RPI bcm_host brcmegl) + if (NOT VIDEO_RPI_FOUND) + set(VIDEO_RPI_INCLUDE_DIRS "/opt/vc/include" "/opt/vc/include/interface/vcos/pthreads" "/opt/vc/include/interface/vmcs_host/linux/" ) + set(VIDEO_RPI_LIBRARY_DIRS "/opt/vc/lib" ) + set(VIDEO_RPI_LIBRARIES bcm_host ) + set(VIDEO_RPI_LDFLAGS "-Wl,-rpath,/opt/vc/lib") + endif() listtostr(VIDEO_RPI_INCLUDE_DIRS VIDEO_RPI_INCLUDE_FLAGS "-I") listtostr(VIDEO_RPI_LIBRARY_DIRS VIDEO_RPI_LIBRARY_FLAGS "-L") set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}") set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}") - set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBS}") + set(CMAKE_REQUIRED_LIBRARIES "${VIDEO_RPI_LIBRARIES}") check_c_source_compiles(" #include int main(int argc, char **argv) {}" HAVE_VIDEO_RPI) @@ -1091,8 +1153,52 @@ macro(CheckRPI) set(SDL_VIDEO_DRIVER_RPI 1) file(GLOB VIDEO_RPI_SOURCES ${SDL2_SOURCE_DIR}/src/video/raspberry/*.c) set(SOURCE_FILES ${SOURCE_FILES} ${VIDEO_RPI_SOURCES}) - list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBS}) + list(APPEND EXTRA_LIBS ${VIDEO_RPI_LIBRARIES}) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${VIDEO_RPI_INCLUDE_FLAGS} ${VIDEO_RPI_LIBRARY_FLAGS}") + list(APPEND EXTRA_LDFLAGS ${VIDEO_RPI_LDFLAGS}) endif(SDL_VIDEO AND HAVE_VIDEO_RPI) endif(VIDEO_RPI) endmacro(CheckRPI) + +# Requires: +# - EGL +# - PkgCheckModules +# Optional: +# - KMSDRM_SHARED opt +# - HAVE_DLOPEN opt +macro(CheckKMSDRM) + if(VIDEO_KMSDRM) + pkg_check_modules(KMSDRM libdrm gbm egl) + if(KMSDRM_FOUND) + link_directories( + ${KMSDRM_LIBRARY_DIRS} + ) + include_directories( + ${KMSDRM_INCLUDE_DIRS} + ) + set(HAVE_VIDEO_KMSDRM TRUE) + set(HAVE_SDL_VIDEO TRUE) + + file(GLOB KMSDRM_SOURCES ${SDL2_SOURCE_DIR}/src/video/kmsdrm/*.c) + set(SOURCE_FILES ${SOURCE_FILES} ${KMSDRM_SOURCES}) + + list(APPEND EXTRA_CFLAGS ${KMSDRM_CFLAGS}) + + set(SDL_VIDEO_DRIVER_KMSDRM 1) + + if(KMSDRM_SHARED) + if(NOT HAVE_DLOPEN) + message_warn("You must have SDL_LoadObject() support for dynamic KMS/DRM loading") + else() + FindLibraryAndSONAME(drm) + FindLibraryAndSONAME(gbm) + set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "\"${DRM_LIB_SONAME}\"") + set(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM "\"${GBM_LIB_SONAME}\"") + set(HAVE_KMSDRM_SHARED TRUE) + endif() + else() + set(EXTRA_LIBS ${KMSDRM_LIBRARIES} ${EXTRA_LIBS}) + endif() + endif() + endif() +endmacro() diff --git a/Engine/lib/sdl/cmake_uninstall.cmake.in b/Engine/lib/sdl/cmake_uninstall.cmake.in index e3a5a4be9..1761561b3 100644 --- a/Engine/lib/sdl/cmake_uninstall.cmake.in +++ b/Engine/lib/sdl/cmake_uninstall.cmake.in @@ -1,8 +1,8 @@ -if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") - message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") -endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") +if (NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_BINARY_DIR@/install_manifest.txt\"") +endif(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") -file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) string(REGEX REPLACE "\n" ";" files "${files}") foreach (file ${files}) message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") diff --git a/Engine/lib/sdl/configure b/Engine/lib/sdl/configure index 5070f6e6a..1c7f87eb0 100755 --- a/Engine/lib/sdl/configure +++ b/Engine/lib/sdl/configure @@ -658,10 +658,10 @@ X_PRE_LIBS X_CFLAGS XMKMF ARTSCONFIG -PKG_CONFIG ESD_LIBS ESD_CFLAGS ESD_CONFIG +PKG_CONFIG ALSA_LIBS ALSA_CFLAGS POW_LIB @@ -798,6 +798,7 @@ enable_mmx enable_3dnow enable_sse enable_sse2 +enable_sse3 enable_altivec enable_oss enable_alsa @@ -805,6 +806,8 @@ with_alsa_prefix with_alsa_inc_prefix enable_alsatest enable_alsa_shared +enable_jack +enable_jack_shared enable_esd with_esd_prefix with_esd_exec_prefix @@ -818,13 +821,18 @@ enable_nas enable_nas_shared enable_sndio enable_sndio_shared +enable_fusionsound +enable_fusionsound_shared enable_diskaudio enable_dummyaudio +enable_libsamplerate +enable_libsamplerate_shared enable_video_wayland enable_video_wayland_qt_touch enable_wayland_shared enable_video_mir enable_mir_shared +enable_video_rpi enable_video_x11 with_x enable_x11_shared @@ -838,15 +846,17 @@ enable_video_x11_xshape enable_video_x11_vm enable_video_vivante enable_video_cocoa +enable_render_metal enable_video_directfb enable_directfb_shared -enable_fusionsound -enable_fusionsound_shared +enable_video_kmsdrm +enable_kmsdrm_shared enable_video_dummy enable_video_opengl enable_video_opengles enable_video_opengles1 enable_video_opengles2 +enable_video_vulkan enable_libudev enable_dbus enable_ime @@ -1521,16 +1531,19 @@ Optional Features: --enable-cpuinfo Enable the cpuinfo subsystem [[default=yes]] --enable-assembly Enable assembly routines [[default=yes]] --enable-ssemath Allow GCC to use SSE floating point math - [[default=no]] + [[default=maybe]] --enable-mmx use MMX assembly routines [[default=yes]] --enable-3dnow use 3DNow! assembly routines [[default=yes]] --enable-sse use SSE assembly routines [[default=yes]] - --enable-sse2 use SSE2 assembly routines [[default=no]] + --enable-sse2 use SSE2 assembly routines [[default=maybe]] + --enable-sse3 use SSE3 assembly routines [[default=maybe]] --enable-altivec use Altivec assembly routines [[default=yes]] --enable-oss support the OSS audio API [[default=maybe]] --enable-alsa support the ALSA audio API [[default=yes]] --disable-alsatest Do not try to compile and run a test Alsa program --enable-alsa-shared dynamically load ALSA audio support [[default=yes]] + --enable-jack use JACK audio [[default=yes]] + --enable-jack-shared dynamically load JACK audio support [[default=yes]] --enable-esd support the Enlightened Sound Daemon [[default=yes]] --disable-esdtest Do not try to compile and run a test ESD program --enable-esd-shared dynamically load ESD audio support [[default=yes]] @@ -1544,8 +1557,16 @@ Optional Features: --enable-nas-shared dynamically load NAS audio support [[default=yes]] --enable-sndio support the sndio audio API [[default=yes]] --enable-sndio-shared dynamically load sndio audio support [[default=yes]] + --enable-fusionsound use FusionSound audio driver [[default=no]] + --enable-fusionsound-shared + dynamically load fusionsound audio support + [[default=yes]] --enable-diskaudio support the disk writer audio driver [[default=yes]] --enable-dummyaudio support the dummy audio driver [[default=yes]] + --enable-libsamplerate use libsamplerate for audio rate conversion + [[default=yes]] + --enable-libsamplerate-shared + dynamically load libsamplerate [[default=yes]] --enable-video-wayland use Wayland video driver [[default=yes]] --enable-video-wayland-qt-touch QtWayland server support for Wayland video driver @@ -1553,6 +1574,7 @@ Optional Features: --enable-wayland-shared dynamically load Wayland support [[default=maybe]] --enable-video-mir use Mir video driver [[default=yes]] --enable-mir-shared dynamically load Mir support [[default=maybe]] + --enable-video-rpi use Raspberry Pi video driver [[default=yes]] --enable-video-x11 use X11 video driver [[default=yes]] --enable-x11-shared dynamically load X11 support [[default=maybe]] --enable-video-x11-xcursor @@ -1573,13 +1595,12 @@ Optional Features: --enable-video-x11-vm use X11 VM extension for fullscreen [[default=yes]] --enable-video-vivante use Vivante EGL video driver [[default=yes]] --enable-video-cocoa use Cocoa video driver [[default=yes]] + --enable-render-metal enable the Metal render driver [[default=yes]] --enable-video-directfb use DirectFB video driver [[default=no]] --enable-directfb-shared dynamically load directfb support [[default=yes]] - --enable-fusionsound use FusionSound audio driver [[default=no]] - --enable-fusionsound-shared - dynamically load fusionsound audio support - [[default=yes]] + --enable-video-kmsdrm use KMSDRM video driver [[default=no]] + --enable-kmsdrm-shared dynamically load kmsdrm support [[default=yes]] --enable-video-dummy use dummy video driver [[default=yes]] --enable-video-opengl include OpenGL support [[default=yes]] --enable-video-opengles include OpenGL ES support [[default=yes]] @@ -1587,6 +1608,7 @@ Optional Features: include OpenGL ES 1.1 support [[default=yes]] --enable-video-opengles2 include OpenGL ES 2.0 support [[default=yes]] + --enable-video-vulkan include Vulkan support [[default=yes]] --enable-libudev enable libudev support [[default=yes]] --enable-dbus enable D-Bus support [[default=yes]] --enable-ime enable IME support [[default=yes]] @@ -2690,9 +2712,9 @@ orig_CFLAGS="$CFLAGS" # SDL_MAJOR_VERSION=2 SDL_MINOR_VERSION=0 -SDL_MICRO_VERSION=5 -SDL_INTERFACE_AGE=1 -SDL_BINARY_AGE=5 +SDL_MICRO_VERSION=8 +SDL_INTERFACE_AGE=0 +SDL_BINARY_AGE=8 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION @@ -5977,7 +5999,10 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; - ppc*-*linux*|powerpc*-*linux*) + powerpc64le-*linux*) + LD="${LD-ld} -m elf64lppc" + ;; + powerpc64-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) @@ -15656,7 +15681,7 @@ case "$host" in ;; esac -INCLUDE="-I$srcdir/include" +INCLUDE="-I$srcdir/include -idirafter $srcdir/src/video/khronos" if test x$srcdir != x.; then INCLUDE="-Iinclude $INCLUDE" elif test -d .hg; then @@ -16148,7 +16173,7 @@ $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi - for ac_header in sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h + for ac_header in sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" @@ -16612,7 +16637,7 @@ fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi - for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname + for ac_func in malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -16665,7 +16690,7 @@ if test "x$ac_cv_lib_m_pow" = xyes; then : LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm" fi - for ac_func in atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt sqrtf tan tanf + for ac_func in acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf fabs fabsf floor floorf fmod fmodf log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" @@ -16733,10 +16758,24 @@ done ac_fn_c_check_member "$LINENO" "struct sigaction" "sa_sigaction" "ac_cv_member_struct_sigaction_sa_sigaction" "#include " if test "x$ac_cv_member_struct_sigaction_sa_sigaction" = xyes; then : - $as_echo "#define HAVE_SA_SIGACTION 1" >>confdefs.h + +$as_echo "#define HAVE_SA_SIGACTION 1" >>confdefs.h fi + + for ac_header in libunwind.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "libunwind.h" "ac_cv_header_libunwind_h" "$ac_includes_default" +if test "x$ac_cv_header_libunwind_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBUNWIND_H 1 +_ACEOF + +fi + +done + fi @@ -16837,6 +16876,7 @@ SOURCES="$SOURCES $srcdir/src/stdlib/*.c" SOURCES="$SOURCES $srcdir/src/thread/*.c" SOURCES="$SOURCES $srcdir/src/timer/*.c" SOURCES="$SOURCES $srcdir/src/video/*.c" +SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c" # Check whether --enable-atomic was given. @@ -17072,7 +17112,7 @@ else fi if test x$enable_ssemath = xno; then - if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then + if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes -o x$have_gcc_sse3 = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387" fi fi @@ -17299,6 +17339,77 @@ $as_echo "$have_gcc_sse2" >&6; } fi fi + # Check whether --enable-sse3 was given. +if test "${enable_sse3+set}" = set; then : + enableval=$enable_sse3; +else + enable_sse3=$default_ssemath +fi + + if test x$enable_sse3 = xyes; then + save_CFLAGS="$CFLAGS" + have_gcc_sse3=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -msse3 option" >&5 +$as_echo_n "checking for GCC -msse3 option... " >&6; } + sse3_CFLAGS="-msse3" + CFLAGS="$save_CFLAGS $sse3_CFLAGS" + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #ifdef __MINGW32__ + #include <_mingw.h> + #ifdef __MINGW64_VERSION_MAJOR + #include + #else + #include + #endif + #else + #include + #endif + #ifndef __SSE2__ + #error Assembler CPP flag not enabled + #endif + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + have_gcc_sse3=yes + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_gcc_sse3" >&5 +$as_echo "$have_gcc_sse3" >&6; } + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_sse3 = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS $sse3_CFLAGS" + SUMMARY_math="${SUMMARY_math} sse3" + fi + fi + + ac_fn_c_check_header_mongrel "$LINENO" "immintrin.h" "ac_cv_header_immintrin_h" "$ac_includes_default" +if test "x$ac_cv_header_immintrin_h" = xyes; then : + have_immintrin_h_hdr=yes +else + have_immintrin_h_hdr=no +fi + + + if test x$have_immintrin_h_hdr = xyes; then + +$as_echo "#define HAVE_IMMINTRIN_H 1" >>confdefs.h + + fi + # Check whether --enable-altivec was given. if test "${enable_altivec+set}" = set; then : enableval=$enable_altivec; @@ -17801,6 +17912,119 @@ _ACEOF fi } +CheckJACK() +{ + # Check whether --enable-jack was given. +if test "${enable_jack+set}" = set; then : + enableval=$enable_jack; +else + enable_jack=yes +fi + + if test x$enable_audio = xyes -a x$enable_jack = xyes; then + audio_jack=no + + JACK_REQUIRED_VERSION=0.125 + + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JACK $JACK_REQUIRED_VERSION support" >&5 +$as_echo_n "checking for JACK $JACK_REQUIRED_VERSION support... " >&6; } + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $JACK_REQUIRED_VERSION jack; then + JACK_CFLAGS=`$PKG_CONFIG --cflags jack` + JACK_LIBS=`$PKG_CONFIG --libs jack` + audio_jack=yes + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $audio_jack" >&5 +$as_echo "$audio_jack" >&6; } + + if test x$audio_jack = xyes; then + # Check whether --enable-jack-shared was given. +if test "${enable_jack_shared+set}" = set; then : + enableval=$enable_jack_shared; +else + enable_jack_shared=yes +fi + + jack_lib=`find_lib "libjack.so.*" "$JACK_LIBS" | sed 's/.*\/\(.*\)/\1/; q'` + + +$as_echo "#define SDL_AUDIO_DRIVER_JACK 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/audio/jack/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $JACK_CFLAGS" + if test x$have_loadso != xyes && \ + test x$enable_jack_shared = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic JACK audio loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic JACK audio loading" >&2;} + fi + if test x$have_loadso = xyes && \ + test x$enable_jack_shared = xyes && test x$jack_lib != x; then + echo "-- dynamic libjack -> $jack_lib" + +cat >>confdefs.h <<_ACEOF +#define SDL_AUDIO_DRIVER_JACK_DYNAMIC "$jack_lib" +_ACEOF + + SUMMARY_audio="${SUMMARY_audio} jack(dynamic)" + + case "$host" in + # On Solaris, jack must be linked deferred explicitly + # to prevent undefined symbol failures. + *-*-solaris*) + JACK_LIBS=`echo $JACK_LIBS | sed 's/\-l/-Wl,-l/g'` + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $JACK_LIBS -Wl,-znodeferred" + esac + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $JACK_LIBS" + SUMMARY_audio="${SUMMARY_audio} jack" + fi + have_audio=yes + fi + fi +} + CheckESD() { # Check whether --enable-esd was given. @@ -18544,6 +18768,116 @@ $as_echo "#define SDL_AUDIO_DRIVER_SNDIO 1" >>confdefs.h fi } +CheckFusionSound() +{ + # Check whether --enable-fusionsound was given. +if test "${enable_fusionsound+set}" = set; then : + enableval=$enable_fusionsound; +else + enable_fusionsound=no +fi + + if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then + fusionsound=no + + FUSIONSOUND_REQUIRED_VERSION=1.1.1 + + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound $FUSIONSOUND_REQUIRED_VERSION support" >&5 +$as_echo_n "checking for FusionSound $FUSIONSOUND_REQUIRED_VERSION support... " >&6; } + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then + FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound` + FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound` + fusionsound=yes + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound" >&5 +$as_echo "$fusionsound" >&6; } + + if test x$fusionsound = xyes; then + +$as_echo "#define SDL_AUDIO_DRIVER_FUSIONSOUND 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" + + # Check whether --enable-fusionsound-shared was given. +if test "${enable_fusionsound_shared+set}" = set; then : + enableval=$enable_fusionsound_shared; +else + enable_fusionsound_shared=yes +fi + + fusionsound_shared=no + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound dynamic loading support" >&5 +$as_echo_n "checking for FusionSound dynamic loading support... " >&6; } + if test x$have_loadso != xyes && \ + test x$enable_fusionsound_shared = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&2;} + fi + if test x$have_loadso = xyes && \ + test x$enable_fusionsound_shared = xyes; then + +cat >>confdefs.h <<_ACEOF +#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so" +_ACEOF + + fusionsound_shared=yes + SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" + SUMMARY_audio="${SUMMARY_audio} fusionsound" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound_shared" >&5 +$as_echo "$fusionsound_shared" >&6; } + + have_audio=yes + fi + fi +} + CheckDiskAudio() { # Check whether --enable-diskaudio was given. @@ -18580,6 +18914,59 @@ $as_echo "#define SDL_AUDIO_DRIVER_DUMMY 1" >>confdefs.h fi } +CheckLibSampleRate() +{ + # Check whether --enable-libsamplerate was given. +if test "${enable_libsamplerate+set}" = set; then : + enableval=$enable_libsamplerate; +else + enable_libsamplerate=yes +fi + + if test x$enable_libsamplerate = xyes; then + ac_fn_c_check_header_mongrel "$LINENO" "samplerate.h" "ac_cv_header_samplerate_h" "$ac_includes_default" +if test "x$ac_cv_header_samplerate_h" = xyes; then : + have_samplerate_h_hdr=yes +else + have_samplerate_h_hdr=no +fi + + + if test x$have_samplerate_h_hdr = xyes; then + +$as_echo "#define HAVE_LIBSAMPLERATE_H 1" >>confdefs.h + + + # Check whether --enable-libsamplerate-shared was given. +if test "${enable_libsamplerate_shared+set}" = set; then : + enableval=$enable_libsamplerate_shared; +else + enable_libsamplerate_shared=yes +fi + + + samplerate_lib=`find_lib "libsamplerate.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'` + + if test x$have_loadso != xyes && \ + test x$enable_libsamplerate_shared = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic libsamplerate loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic libsamplerate loading" >&2;} + fi + if test x$have_loadso = xyes && \ + test x$enable_libsamplerate_shared = xyes && test x$samplerate_lib != x; then + echo "-- dynamic libsamplerate -> $samplerate_lib" + +cat >>confdefs.h <<_ACEOF +#define SDL_LIBSAMPLERATE_DYNAMIC "$samplerate_lib" +_ACEOF + + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lsamplerate" + fi + fi + fi +} + CheckVisibilityHidden() { { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GCC -fvisibility=hidden option" >&5 @@ -18833,7 +19220,7 @@ $as_echo "#define SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH 1" >>confdefs.h fi - WAYLAND_PROTOCOLS_UNSTABLE="relative-pointer-unstable-v1 pointer-constraints-unstable-v1" + WAYLAND_PROTOCOLS_UNSTABLE="relative-pointer-unstable-v1 pointer-constraints-unstable-v1 xdg-shell-unstable-v6" SOURCES="$SOURCES $srcdir/src/video/wayland/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)" @@ -18978,7 +19365,7 @@ int main () { - MirTouchAction actions = mir_touch_actions + MirWindowAttrib attrib = mir_window_attrib_state ; return 0; @@ -19073,9 +19460,11 @@ main () _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - $as_echo "#define SDL_VIDEO_DRIVER_NACL 1" >>confdefs.h - $as_echo "#define SDL_AUDIO_DRIVER_NACL 1" >>confdefs.h +$as_echo "#define SDL_VIDEO_DRIVER_NACL 1" >>confdefs.h + + +$as_echo "#define SDL_AUDIO_DRIVER_NACL 1" >>confdefs.h $as_echo "#define HAVE_POW 1" >>confdefs.h @@ -19103,10 +19492,121 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext } -CheckX11() +CheckRPI() +{ + # Check whether --enable-video-rpi was given. +if test "${enable_video_rpi+set}" = set; then : + enableval=$enable_video_rpi; +else + enable_video_rpi=yes +fi + + if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PKG_CONFIG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no" + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + if test x$PKG_CONFIG != xno && $PKG_CONFIG --exists bcm_host; then + RPI_CFLAGS=`$PKG_CONFIG --cflags bcm_host brcmegl` + RPI_LDFLAGS=`$PKG_CONFIG --libs bcm_host brcmegl` + elif test x$ARCH = xnetbsd; then + RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" + RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host" + else + RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" + RPI_LDFLAGS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host" + fi + + # Save the original compiler flags and libraries + ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS" + + # Add the Raspberry Pi compiler flags and libraries + CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LDFLAGS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Raspberry Pi" >&5 +$as_echo_n "checking for Raspberry Pi... " >&6; } + have_video_rpi=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + +int +main () { + bcm_host_init(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + have_video_rpi=yes + +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_video_rpi" >&5 +$as_echo "$have_video_rpi" >&6; } + + # Restore the compiler flags and libraries + CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" + + if test x$have_video_rpi = xyes; then + CFLAGS="$CFLAGS $RPI_CFLAGS" + SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" + EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LDFLAGS" + SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" + +$as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h + + SUMMARY_video="${SUMMARY_video} rpi" + fi + fi +} + +CheckX11() +{ # Check whether --enable-video-x11 was given. if test "${enable_video_x11+set}" = set; then : enableval=$enable_video_x11; @@ -19942,7 +20442,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO"; then : have_const_param_XextAddDisplay=yes - $as_echo "#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1" >>confdefs.h + +$as_echo "#define SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY 1" >>confdefs.h fi @@ -19976,7 +20477,8 @@ _ACEOF if ac_fn_c_try_compile "$LINENO"; then : have_XGenericEvent=yes - $as_echo "#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1" >>confdefs.h + +$as_echo "#define SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS 1" >>confdefs.h fi @@ -20762,6 +21264,63 @@ $as_echo "#define SDL_VIDEO_DRIVER_COCOA 1" >>confdefs.h fi } +CheckMETAL() +{ + # Check whether --enable-render-metal was given. +if test "${enable_render_metal+set}" = set; then : + enableval=$enable_render_metal; +else + enable_render_metal=yes +fi + + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -x objective-c" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Metal framework" >&5 +$as_echo_n "checking for Metal framework... " >&6; } + have_metal=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #import + #import + #import + + #if !TARGET_CPU_X86_64 + #error Metal doesn't work on this configuration + #endif + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + have_metal=yes + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_metal" >&5 +$as_echo "$have_metal" >&6; } + if test x$have_metal = xyes; then + +$as_echo "#define SDL_VIDEO_RENDER_METAL 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/render/metal/*.m" + SUMMARY_video="${SUMMARY_video} metal" + else + enable_render_metal=no + fi + fi +} + + CheckDirectFB() { # Check whether --enable-video-directfb was given. @@ -20916,16 +21475,13 @@ fi $as_echo "#define SDL_VIDEO_DRIVER_DIRECTFB 1" >>confdefs.h - -$as_echo "#define SDL_VIDEO_RENDER_DIRECTFB 1" >>confdefs.h - SOURCES="$SOURCES $srcdir/src/video/directfb/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for directfb dynamic loading support" >&5 $as_echo_n "checking for directfb dynamic loading support... " >&6; } directfb_shared=no - directfb_lib=`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS"` + directfb_lib=`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS"` # | sed 's/.*\/\(.*\)/\1/; q'`] { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"directfb $directfb_lib\"" >&5 $as_echo "$as_me: WARNING: \"directfb $directfb_lib\"" >&2;} @@ -20956,19 +21512,23 @@ $as_echo "$directfb_shared" >&6; } fi } -CheckFusionSound() +CheckKMSDRM() { - # Check whether --enable-fusionsound was given. -if test "${enable_fusionsound+set}" = set; then : - enableval=$enable_fusionsound; + # Check whether --enable-video-kmsdrm was given. +if test "${enable_video_kmsdrm+set}" = set; then : + enableval=$enable_video_kmsdrm; else - enable_fusionsound=no + enable_video_kmsdrm=no fi - if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then - fusionsound=no - FUSIONSOUND_REQUIRED_VERSION=1.1.1 + if test x$enable_video = xyes -a x$enable_video_kmsdrm = xyes; then + video_kmsdrm=no + libdrm_avail=no + libgbm_avail=no + + LIBDRM_REQUIRED_VERSION=2.4.46 + LIBGBM_REQUIRED_VERSION=9.0.0 # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 @@ -21011,57 +21571,86 @@ $as_echo "no" >&6; } fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound $FUSIONSOUND_REQUIRED_VERSION support" >&5 -$as_echo_n "checking for FusionSound $FUSIONSOUND_REQUIRED_VERSION support... " >&6; } if test x$PKG_CONFIG != xno; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then - FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound` - FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound` - fusionsound=yes - fi - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound" >&5 -$as_echo "$fusionsound" >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version 0.7; then + if $PKG_CONFIG --atleast-version $LIBDRM_REQUIRED_VERSION libdrm; then + LIBDRM_CFLAGS=`$PKG_CONFIG --cflags libdrm` + LIBDRM_LIBS=`$PKG_CONFIG --libs libdrm` + LIBDRM_PREFIX=`$PKG_CONFIG --variable=prefix libdrm` + libdrm_avail=yes + fi + if $PKG_CONFIG --atleast-version $LIBGBM_REQUIRED_VERSION gbm; then + LIBGBM_CFLAGS=`$PKG_CONFIG --cflags gbm` + LIBGBM_LIBS=`$PKG_CONFIG --libs gbm` + LIBGBM_PREFIX=`$PKG_CONFIG --variable=prefix gbm` + libgbm_avail=yes + fi + if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then + video_kmsdrm=yes + fi - if test x$fusionsound = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support" >&5 +$as_echo_n "checking for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libdrm_avail" >&5 +$as_echo "$libdrm_avail" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support" >&5 +$as_echo_n "checking for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $libgbm_avail" >&5 +$as_echo "$libgbm_avail" >&6; } -$as_echo "#define SDL_AUDIO_DRIVER_FUSIONSOUND 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" - - # Check whether --enable-fusionsound-shared was given. -if test "${enable_fusionsound_shared+set}" = set; then : - enableval=$enable_fusionsound_shared; + if test x$video_kmsdrm = xyes; then + # Check whether --enable-kmsdrm-shared was given. +if test "${enable_kmsdrm_shared+set}" = set; then : + enableval=$enable_kmsdrm_shared; else - enable_fusionsound_shared=yes + enable_kmsdrm_shared=yes fi - fusionsound_shared=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FusionSound dynamic loading support" >&5 -$as_echo_n "checking for FusionSound dynamic loading support... " >&6; } - if test x$have_loadso != xyes && \ - test x$enable_fusionsound_shared = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&5 -$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic fusionsound loading" >&2;} - fi - if test x$have_loadso = xyes && \ - test x$enable_fusionsound_shared = xyes; then + + +$as_echo "#define SDL_VIDEO_DRIVER_KMSDRM 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for kmsdrm dynamic loading support" >&5 +$as_echo_n "checking for kmsdrm dynamic loading support... " >&6; } + kmsdrm_shared=no + drm_lib=`find_lib "libdrm.so.*" "$DRM_LIBS"` + gbm_lib=`find_lib "libgbm.so.*" "$DRM_LIBS"` + if test x$have_loadso != xyes && \ + test x$enable_kmsdrm_shared = xyes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: You must have SDL_LoadObject() support for dynamic kmsdrm loading" >&5 +$as_echo "$as_me: WARNING: You must have SDL_LoadObject() support for dynamic kmsdrm loading" >&2;} + fi + if test x$have_loadso = xyes && \ + test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then + kmsdrm_shared=yes cat >>confdefs.h <<_ACEOF -#define SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC "libfusionsound.so" +#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC "$drm_lib" _ACEOF - fusionsound_shared=yes - SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" - SUMMARY_audio="${SUMMARY_audio} fusionsound" - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $fusionsound_shared" >&5 -$as_echo "$fusionsound_shared" >&6; } - have_audio=yes +cat >>confdefs.h <<_ACEOF +#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM "$gbm_lib" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define HAVE_KMSDRM_SHARED "TRUE" +_ACEOF + + SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS" + SUMMARY_video="${SUMMARY_video} kmsdrm" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $kmsdrm_shared" >&5 +$as_echo "$kmsdrm_shared" >&6; } + have_video=yes + fi + fi fi fi } @@ -21085,6 +21674,32 @@ $as_echo "#define SDL_VIDEO_DRIVER_DUMMY 1" >>confdefs.h fi } +CheckQNXVideo() +{ + if test x$enable_video = xyes; then + +$as_echo "#define SDL_VIDEO_DRIVER_QNX 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/video/qnx/*.c" + have_video=yes + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2" + SUMMARY_video="${SUMMARY_video} qnx" + fi +} + +CheckQNXAudio() +{ + if test x$enable_audio = xyes; then + +$as_echo "#define SDL_AUDIO_DRIVER_QSA 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c" + have_audio=yes + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound" + SUMMARY_audio="${SUMMARY_audio} qsa" + fi +} + # Check whether --enable-video-opengl was given. if test "${enable_video_opengl+set}" = set; then : enableval=$enable_video_opengl; @@ -21475,6 +22090,97 @@ $as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h fi } +# Check whether --enable-video-vulkan was given. +if test "${enable_video_vulkan+set}" = set; then : + enableval=$enable_video_vulkan; +else + enable_video_vulkan=yes +fi + + +CheckVulkan() +{ + if test x$enable_video = xyes -a x$enable_video_vulkan = xyes; then + case "$host" in + *-*-android*) + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #if defined(__ARM_ARCH) && __ARM_ARCH < 7 + #error Vulkan doesn't work on this configuration + #endif + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + +else + + enable_video_vulkan=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ;; + *-*-darwin*) + save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -x objective-c" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + + #include + #include + #include + + #if !TARGET_CPU_X86_64 + #error Vulkan doesn't work on this configuration + #endif + +int +main () +{ + + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + +else + + enable_video_vulkan=no + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + ;; + *) + ;; + esac + if test x$enable_video_vulkan = xno; then + # For reasons I am totally unable to see, I get an undefined macro error if + # I put this in the AC_TRY_COMPILE. + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Vulkan does not work on this configuration." >&5 +$as_echo "$as_me: WARNING: Vulkan does not work on this configuration." >&2;} + fi + fi + if test x$enable_video_vulkan = xyes; then + +$as_echo "#define SDL_VIDEO_VULKAN 1" >>confdefs.h + + SUMMARY_video="${SUMMARY_video} vulkan" + fi +} + CheckInputEvents() { { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Linux 2.4 unified input interface" >&5 @@ -21575,6 +22281,16 @@ fi $as_echo "#define HAVE_LIBUDEV_H 1" >>confdefs.h + + udev_lib=`find_lib "libudev.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'` + if test x$udev_lib != x; then + echo "-- dynamic udev -> $udev_lib" + +cat >>confdefs.h <<_ACEOF +#define SDL_UDEV_DYNAMIC "$udev_lib" +_ACEOF + + fi fi fi } @@ -21914,7 +22630,7 @@ else fi case "$host" in - *-*-androideabi*) + *-*-android*) pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" pthread_lib="" ;; @@ -21974,6 +22690,10 @@ fi pthread_cflags="-D_REENTRANT" pthread_lib="" ;; + *-*-nto*) + pthread_cflags="-D_REENTRANT" + pthread_lib="" + ;; *) pthread_cflags="-D_REENTRANT" pthread_lib="-lpthread" @@ -22147,7 +22867,8 @@ _ACEOF if ac_fn_c_try_link "$LINENO"; then : have_sem_timedwait=yes - $as_echo "#define HAVE_SEM_TIMEDWAIT 1" >>confdefs.h + +$as_echo "#define HAVE_SEM_TIMEDWAIT 1" >>confdefs.h fi @@ -22391,18 +23112,64 @@ if test "x$ac_cv_header_dxgi_h" = xyes; then : fi - ac_fn_c_check_header_mongrel "$LINENO" "xaudio2.h" "ac_cv_header_xaudio2_h" "$ac_includes_default" -if test "x$ac_cv_header_xaudio2_h" = xyes; then : - have_xaudio2=yes -fi - - ac_fn_c_check_header_mongrel "$LINENO" "xinput.h" "ac_cv_header_xinput_h" "$ac_includes_default" if test "x$ac_cv_header_xinput_h" = xyes; then : have_xinput=yes fi + ac_fn_c_check_header_mongrel "$LINENO" "mmdeviceapi.h" "ac_cv_header_mmdeviceapi_h" "$ac_includes_default" +if test "x$ac_cv_header_mmdeviceapi_h" = xyes; then : + have_wasapi=yes +fi + + + ac_fn_c_check_header_mongrel "$LINENO" "audioclient.h" "ac_cv_header_audioclient_h" "$ac_includes_default" +if test "x$ac_cv_header_audioclient_h" = xyes; then : + +else + have_wasapi=no +fi + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +XINPUT_GAMEPAD_EX x1; + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + have_xinput_gamepadex=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +XINPUT_STATE_EX s1; + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + have_xinput_stateex=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test x$have_ddraw = xyes; then @@ -22428,6 +23195,16 @@ $as_echo "#define HAVE_DXGI_H 1" >>confdefs.h $as_echo "#define HAVE_XINPUT_H 1" >>confdefs.h + fi + if test x$have_xinput_gamepadex = xyes; then + +$as_echo "#define HAVE_XINPUT_GAMEPAD_EX 1" >>confdefs.h + + fi + if test x$have_xinput_stateex = xyes; then + +$as_echo "#define HAVE_XINPUT_STATE_EX 1" >>confdefs.h + fi SUMMARY_video="${SUMMARY_video} directx" @@ -23052,25 +23829,9 @@ fi CheckWarnAll case "$host" in - *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*) + *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*) case "$host" in - *-raspberry-linux*) - # Raspberry Pi - ARCH=linux - RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" - CFLAGS="$CFLAGS $RPI_CFLAGS" - SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" - EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/vc/lib -lbcm_host -ldl" - - if test x$enable_video = xyes; then - SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" - # FIXME: confdefs? Not AC_DEFINE? - $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h - SUMMARY_video="${SUMMARY_video} rpi" - fi - ;; - *-*-androideabi*) + *-*-android*) # Android ARCH=android ANDROID_CFLAGS="-DGL_GLEXT_PROTOTYPES" @@ -23078,6 +23839,7 @@ case "$host" in SDL_CFLAGS="$SDL_CFLAGS $ANDROID_CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS $ANDROID_CFLAGS" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl -lGLESv1_CM -lGLESv2 -llog -landroid" + SDLMAIN_SOURCES="$srcdir/src/main/android/*.c" if test x$enable_video = xyes; then SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c" @@ -23095,21 +23857,6 @@ case "$host" in *-*-bsdi*) ARCH=bsdi ;; *-*-freebsd*) ARCH=freebsd ;; *-*-dragonfly*) ARCH=freebsd ;; - *-raspberry-netbsd*) - # Raspberry Pi - ARCH=netbsd - RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" - CFLAGS="$CFLAGS $RPI_CFLAGS" - SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" - EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host -ldl" - - if test x$enable_video = xyes; then - SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" - $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h - SUMMARY_video="${SUMMARY_video} raspberry" - fi - ;; *-*-netbsd*) ARCH=netbsd ;; *-*-openbsd*) ARCH=openbsd ;; *-*-sysv5*) ARCH=sysv5 ;; @@ -23117,6 +23864,9 @@ case "$host" in *-*-hpux*) ARCH=hpux ;; *-*-aix*) ARCH=aix ;; *-*-minix*) ARCH=minix ;; + *-*-nto*) ARCH=nto + CheckQNXVideo + ;; esac CheckVisibilityHidden CheckDeclarationAfterStatement @@ -23127,15 +23877,21 @@ case "$host" in CheckOSS CheckALSA CheckPulseAudio + CheckJACK CheckARTSC CheckESD CheckNAS CheckSNDIO + CheckFusionSound + CheckLibSampleRate + # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails! + CheckRPI CheckX11 CheckDirectFB - CheckFusionSound + CheckKMSDRM CheckOpenGLX11 CheckOpenGLESX11 + CheckVulkan CheckMir CheckWayland CheckLibUDev @@ -23156,6 +23912,7 @@ case "$host" in CheckLinuxVersion CheckRPATH CheckVivanteVideo + # Set up files for the audio library if test x$enable_audio = xyes; then case $ARCH in @@ -23164,13 +23921,15 @@ case "$host" in $as_echo "#define SDL_AUDIO_DRIVER_SUNAUDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" + SUMMARY_audio="${SUMMARY_audio} sun" have_audio=yes ;; netbsd) # Don't use this on OpenBSD, it's busted. -$as_echo "#define SDL_AUDIO_DRIVER_BSD 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_NETBSD 1" >>confdefs.h - SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c" + SOURCES="$SOURCES $srcdir/src/audio/netbsd/*.c" + SUMMARY_audio="${SUMMARY_audio} netbsd" have_audio=yes ;; aix) @@ -23178,6 +23937,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_BSD 1" >>confdefs.h $as_echo "#define SDL_AUDIO_DRIVER_PAUDIO 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c" + SUMMARY_audio="${SUMMARY_audio} paudio" have_audio=yes ;; android) @@ -23188,6 +23948,9 @@ $as_echo "#define SDL_AUDIO_DRIVER_ANDROID 1" >>confdefs.h SUMMARY_audio="${SUMMARY_audio} android" have_audio=yes ;; + nto) + CheckQNXAudio + ;; esac fi # Set up files for the joystick library @@ -23198,6 +23961,7 @@ $as_echo "#define SDL_AUDIO_DRIVER_ANDROID 1" >>confdefs.h $as_echo "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" have_joystick=yes ;; android) @@ -23205,23 +23969,31 @@ $as_echo "#define SDL_JOYSTICK_LINUX 1" >>confdefs.h $as_echo "#define SDL_JOYSTICK_ANDROID 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/joystick/android/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" have_joystick=yes ;; esac fi # Set up files for the haptic library if test x$enable_haptic = xyes; then - if test x$use_input_events = xyes; then - case $ARCH in - linux) + case $ARCH in + linux) + if test x$use_input_events = xyes; then $as_echo "#define SDL_HAPTIC_LINUX 1" >>confdefs.h - SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c" - have_haptic=yes - ;; - esac - fi + SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c" + have_haptic=yes + fi + ;; + android) + +$as_echo "#define SDL_HAPTIC_ANDROID 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/haptic/android/*.c" + have_haptic=yes + ;; + esac fi # Set up files for the power library if test x$enable_power = xyes; then @@ -23275,8 +24047,10 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h fi # Set up files for evdev input if test x$use_input_events = xyes; then - SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev.c" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev*.c" fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" ;; *-*-cygwin* | *-*-mingw32*) ARCH=win32 @@ -23289,12 +24063,14 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h ac_default_prefix=$BUILD_PREFIX fi fi + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio CheckWINDOWS CheckWINDOWSGL CheckWINDOWSGLES + CheckVulkan CheckDIRECTX # Set up the core platform files @@ -23337,11 +24113,11 @@ $as_echo "#define SDL_AUDIO_DRIVER_DSOUND 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c" fi - if test x$have_xaudio2 = xyes; then + if test x$have_wasapi = xyes; then -$as_echo "#define SDL_AUDIO_DRIVER_XAUDIO2 1" >>confdefs.h +$as_echo "#define SDL_AUDIO_DRIVER_WASAPI 1" >>confdefs.h - SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c" + SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c" fi have_audio=yes fi @@ -23490,6 +24266,7 @@ fi CheckDummyVideo CheckDiskAudio CheckDummyAudio + CheckDLOPEN CheckHaikuVideo CheckHaikuGL CheckPTHREAD @@ -23500,6 +24277,7 @@ fi $as_echo "#define SDL_AUDIO_DRIVER_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/audio/haiku/*.cc" + SUMMARY_audio="${SUMMARY_audio} haiku" have_audio=yes fi # Set up files for the joystick library @@ -23518,14 +24296,6 @@ $as_echo "#define SDL_TIMER_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c" have_timers=yes fi - # Set up files for the shared object loading library - if test x$enable_loadso = xyes; then - -$as_echo "#define SDL_LOADSO_HAIKU 1" >>confdefs.h - - SOURCES="$SOURCES $srcdir/src/loadso/haiku/*.c" - have_loadso=yes - fi # Set up files for the system power library if test x$enable_power = xyes; then @@ -23545,10 +24315,33 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h # The Haiku platform requires special setup. SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding" + # Haiku's x86 spins use libstdc++.r4.so (for binary compat?), but + # other spins, like x86-64, use a more standard "libstdc++.so.*" + as_ac_File=`$as_echo "ac_cv_file_"/boot/system/lib/libstdc++.r4.so"" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for \"/boot/system/lib/libstdc++.r4.so\"" >&5 +$as_echo_n "checking for \"/boot/system/lib/libstdc++.r4.so\"... " >&6; } +if eval \${$as_ac_File+:} false; then : + $as_echo_n "(cached) " >&6 +else + test "$cross_compiling" = yes && + as_fn_error $? "cannot check for file existence when cross compiling" "$LINENO" 5 +if test -r ""/boot/system/lib/libstdc++.r4.so""; then + eval "$as_ac_File=yes" +else + eval "$as_ac_File=no" +fi +fi +eval ac_res=\$$as_ac_File + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_ac_File"\" = x"yes"; then : + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++.r4" +else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++" +fi + ;; - arm*-apple-darwin*) - # iOS - We are not writing anything to confdefs.h because you have to replace - # SDL_config.h for SDL_config_iphoneos.h anyway + arm*-apple-darwin*|*-ios-*) ARCH=ios CheckVisibilityHidden @@ -23557,19 +24350,26 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h CheckDiskAudio CheckDummyAudio CheckDLOPEN - CheckCOCOA + CheckMETAL + CheckVulkan CheckPTHREAD - # Set up files for the audio library if test x$enable_audio = xyes; then + +$as_echo "#define SDL_AUDIO_DRIVER_COREAUDIO 1" >>confdefs.h + SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m" SUMMARY_audio="${SUMMARY_audio} coreaudio" have_audio=yes fi # Set up files for the joystick library if test x$enable_joystick = xyes; then + +$as_echo "#define SDL_JOYSTICK_MFI 1" >>confdefs.h + SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" have_joystick=yes fi # Set up files for the haptic library @@ -23580,6 +24380,9 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h #fi # Set up files for the power library if test x$enable_power = xyes; then + +$as_echo "#define SDL_POWER_UIKIT 1" >>confdefs.h + SOURCES="$SOURCES $srcdir/src/power/uikit/*.m" have_power=yes fi @@ -23588,28 +24391,55 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m" have_filesystem=yes fi + # Set up additional files for the file library + if test x$enable_file = xyes; then + +$as_echo "#define SDL_FILESYSTEM_COCOA 1" >>confdefs.h + + SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" + fi # Set up files for the timer library if test x$enable_timers = xyes; then + +$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h + SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes fi - # Set up additional files for the file library - if test x$enable_file = xyes; then - SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" - fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" # The iOS platform requires special setup. + +$as_echo "#define SDL_VIDEO_DRIVER_UIKIT 1" >>confdefs.h + + +$as_echo "#define SDL_VIDEO_OPENGL_ES2 1" >>confdefs.h + + +$as_echo "#define SDL_VIDEO_OPENGL_ES 1" >>confdefs.h + + +$as_echo "#define SDL_VIDEO_RENDER_OGL_ES 1" >>confdefs.h + + +$as_echo "#define SDL_VIDEO_RENDER_OGL_ES2 1" >>confdefs.h + SOURCES="$SOURCES $srcdir/src/video/uikit/*.m" - EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreMotion" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,GameController" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit" + + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Metal" + fi ;; *-*-darwin* ) # This could be either full "Mac OS X", or plain "Darwin" which is @@ -23628,9 +24458,11 @@ $as_echo "#define SDL_FILESYSTEM_HAIKU 1" >>confdefs.h CheckDummyAudio CheckDLOPEN CheckCOCOA + CheckMETAL CheckX11 CheckMacGL CheckOpenGLX11 + CheckVulkan CheckPTHREAD # Set up files for the audio library @@ -23688,13 +24520,18 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h if test x$enable_file = xyes; then SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" # The Mac OS X platform requires special setup. - EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreVideo" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit" + + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal" + fi ;; *-nacl|*-pnacl) ARCH=nacl @@ -23706,7 +24543,8 @@ $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h # Set up files for the timer library if test x$enable_timers = xyes; then - $as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h + +$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes @@ -23916,16 +24754,16 @@ VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([^ ]*\\)/\\([^ ]*\\)\\.rc,\ SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES` SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES` -SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.c,$(objects)/\1.o,g'` +SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.c,$(objects)/\1.lo,g'` SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([^ ]*\\)/\\([^ ]*\\)\\.c,\\\\ -\\$(objects)/\\2.o: \\1/\\2.c\\\\ +\\$(objects)/\\2.lo: \\1/\\2.c\\\\ \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES` SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES` -SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.c,$(objects)/\1.o,g'` +SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[^ ]*/\([^ ]*\)\.c,$(objects)/\1.lo,g'` SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([^ ]*\\)/\\([^ ]*\\)\\.c,\\\\ -\\$(objects)/\\2.o: \\1/\\2.c\\\\ +\\$(objects)/\\2.lo: \\1/\\2.c\\\\ \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` # Set runtime shared library paths as needed @@ -24045,30 +24883,35 @@ if test x$have_x = xyes; then SUMMARY="${SUMMARY}X11 libraries :${SUMMARY_video_x11}\n" fi SUMMARY="${SUMMARY}Input drivers :${SUMMARY_input}\n" -if test x$enable_libudev = xyes; then - SUMMARY="${SUMMARY}Using libudev : YES\n" +if test x$have_samplerate_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using libsamplerate : YES\n" else - SUMMARY="${SUMMARY}Using libudev : NO\n" + SUMMARY="${SUMMARY}Using libsamplerate : NO\n" +fi +if test x$have_libudev_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using libudev : YES\n" +else + SUMMARY="${SUMMARY}Using libudev : NO\n" fi if test x$have_dbus_dbus_h_hdr = xyes; then - SUMMARY="${SUMMARY}Using dbus : YES\n" + SUMMARY="${SUMMARY}Using dbus : YES\n" else - SUMMARY="${SUMMARY}Using dbus : NO\n" + SUMMARY="${SUMMARY}Using dbus : NO\n" fi if test x$enable_ime = xyes; then - SUMMARY="${SUMMARY}Using ime : YES\n" + SUMMARY="${SUMMARY}Using ime : YES\n" else - SUMMARY="${SUMMARY}Using ime : NO\n" + SUMMARY="${SUMMARY}Using ime : NO\n" fi if test x$have_ibus_ibus_h_hdr = xyes; then - SUMMARY="${SUMMARY}Using ibus : YES\n" + SUMMARY="${SUMMARY}Using ibus : YES\n" else - SUMMARY="${SUMMARY}Using ibus : NO\n" + SUMMARY="${SUMMARY}Using ibus : NO\n" fi if test x$have_fcitx_frontend_h_hdr = xyes; then - SUMMARY="${SUMMARY}Using fcitx : YES\n" + SUMMARY="${SUMMARY}Using fcitx : YES\n" else - SUMMARY="${SUMMARY}Using fcitx : NO\n" + SUMMARY="${SUMMARY}Using fcitx : NO\n" fi ac_config_commands="$ac_config_commands summary" diff --git a/Engine/lib/sdl/configure.in b/Engine/lib/sdl/configure.in index f38f02e34..1c7e79338 100644 --- a/Engine/lib/sdl/configure.in +++ b/Engine/lib/sdl/configure.in @@ -20,9 +20,9 @@ dnl Set various version strings - taken gratefully from the GTk sources # SDL_MAJOR_VERSION=2 SDL_MINOR_VERSION=0 -SDL_MICRO_VERSION=5 -SDL_INTERFACE_AGE=1 -SDL_BINARY_AGE=5 +SDL_MICRO_VERSION=8 +SDL_INTERFACE_AGE=0 +SDL_BINARY_AGE=8 SDL_VERSION=$SDL_MAJOR_VERSION.$SDL_MINOR_VERSION.$SDL_MICRO_VERSION AC_SUBST(SDL_MAJOR_VERSION) @@ -68,7 +68,7 @@ case "$host" in esac dnl Set up the compiler and linker flags -INCLUDE="-I$srcdir/include" +INCLUDE="-I$srcdir/include -idirafter $srcdir/src/video/khronos" if test x$srcdir != x.; then INCLUDE="-Iinclude $INCLUDE" elif test -d .hg; then @@ -234,7 +234,7 @@ if test x$enable_libc = xyes; then dnl Check for C library headers AC_HEADER_STDC - AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h) + AC_CHECK_HEADERS(sys/types.h stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h strings.h wchar.h inttypes.h stdint.h limits.h ctype.h math.h float.h iconv.h signal.h) dnl Check for typedefs, structures, etc. AC_TYPE_SIZE_T @@ -268,15 +268,18 @@ if test x$enable_libc = xyes; then AC_DEFINE(HAVE_MPROTECT, 1, [ ]) ]), ) - AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove strlen strlcpy strlcat strdup _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname) + AC_CHECK_FUNCS(malloc calloc realloc free getenv setenv putenv unsetenv qsort abs bcopy memset memcpy memmove wcslen wcscmp strlen strlcpy strlcat _strrev _strupr _strlwr strchr strrchr strstr itoa _ltoa _uitoa _ultoa strtol strtoul _i64toa _ui64toa strtoll strtoull atoi atof strcmp strncmp _stricmp strcasecmp _strnicmp strncasecmp vsscanf vsnprintf fopen64 fseeko fseeko64 sigaction setjmp nanosleep sysconf sysctlbyname getauxval poll) AC_CHECK_LIB(m, pow, [LIBS="$LIBS -lm"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm"]) - AC_CHECK_FUNCS(atan atan2 acos asin ceil copysign cos cosf fabs floor log pow scalbn sin sinf sqrt sqrtf tan tanf) + AC_CHECK_FUNCS(acos acosf asin asinf atan atanf atan2 atan2f ceil ceilf copysign copysignf cos cosf fabs fabsf floor floorf fmod fmodf log logf log10 log10f pow powf scalbn scalbnf sin sinf sqrt sqrtf tan tanf) AC_CHECK_LIB(iconv, iconv_open, [LIBS="$LIBS -liconv"; EXTRA_LDFLAGS="$EXTRA_LDFLAGS -liconv"]) AC_CHECK_FUNCS(iconv) - AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE(HAVE_SA_SIGACTION)], ,[#include ]) + AC_CHECK_MEMBER(struct sigaction.sa_sigaction,[AC_DEFINE([HAVE_SA_SIGACTION], 1, [ ])], ,[#include ]) + + dnl Check for additional non-standard headers + AC_CHECK_HEADERS(libunwind.h) fi dnl AC_CHECK_SIZEOF(void*) @@ -340,6 +343,7 @@ SOURCES="$SOURCES $srcdir/src/stdlib/*.c" SOURCES="$SOURCES $srcdir/src/thread/*.c" SOURCES="$SOURCES $srcdir/src/timer/*.c" SOURCES="$SOURCES $srcdir/src/video/*.c" +SOURCES="$SOURCES $srcdir/src/video/yuv2rgb/*.c" dnl Enable/disable various subsystems of the SDL library @@ -479,10 +483,10 @@ if test x$enable_assembly = xyes; then ;; esac AC_ARG_ENABLE(ssemath, -AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=no]]]), +AC_HELP_STRING([--enable-ssemath], [Allow GCC to use SSE floating point math [[default=maybe]]]), , enable_ssemath=$default_ssemath) if test x$enable_ssemath = xno; then - if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes; then + if test x$have_gcc_sse = xyes -o x$have_gcc_sse2 = xyes -o x$have_gcc_sse3 = xyes; then EXTRA_CFLAGS="$EXTRA_CFLAGS -mfpmath=387" fi fi @@ -593,7 +597,7 @@ AC_HELP_STRING([--enable-sse], [use SSE assembly routines [[default=yes]]]), fi AC_ARG_ENABLE(sse2, -AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]), +AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=maybe]]]), , enable_sse2=$default_ssemath) if test x$enable_sse2 = xyes; then save_CFLAGS="$CFLAGS" @@ -629,6 +633,50 @@ AC_HELP_STRING([--enable-sse2], [use SSE2 assembly routines [[default=no]]]), fi fi + AC_ARG_ENABLE(sse3, +AC_HELP_STRING([--enable-sse3], [use SSE3 assembly routines [[default=maybe]]]), + , enable_sse3=$default_ssemath) + if test x$enable_sse3 = xyes; then + save_CFLAGS="$CFLAGS" + have_gcc_sse3=no + AC_MSG_CHECKING(for GCC -msse3 option) + sse3_CFLAGS="-msse3" + CFLAGS="$save_CFLAGS $sse3_CFLAGS" + + AC_TRY_COMPILE([ + #ifdef __MINGW32__ + #include <_mingw.h> + #ifdef __MINGW64_VERSION_MAJOR + #include + #else + #include + #endif + #else + #include + #endif + #ifndef __SSE2__ + #error Assembler CPP flag not enabled + #endif + ],[ + ],[ + have_gcc_sse3=yes + ]) + AC_MSG_RESULT($have_gcc_sse3) + CFLAGS="$save_CFLAGS" + + if test x$have_gcc_sse3 = xyes; then + EXTRA_CFLAGS="$EXTRA_CFLAGS $sse3_CFLAGS" + SUMMARY_math="${SUMMARY_math} sse3" + fi + fi + + AC_CHECK_HEADER(immintrin.h, + have_immintrin_h_hdr=yes, + have_immintrin_h_hdr=no) + if test x$have_immintrin_h_hdr = xyes; then + AC_DEFINE(HAVE_IMMINTRIN_H, 1, [ ]) + fi + AC_ARG_ENABLE(altivec, AC_HELP_STRING([--enable-altivec], [use Altivec assembly routines [[default=yes]]]), , enable_altivec=yes) @@ -802,6 +850,63 @@ AC_HELP_STRING([--enable-alsa-shared], [dynamically load ALSA audio support [[de fi } +dnl Find JACK Audio +CheckJACK() +{ + AC_ARG_ENABLE(jack, +AC_HELP_STRING([--enable-jack], [use JACK audio [[default=yes]]]), + , enable_jack=yes) + if test x$enable_audio = xyes -a x$enable_jack = xyes; then + audio_jack=no + + JACK_REQUIRED_VERSION=0.125 + + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + AC_MSG_CHECKING(for JACK $JACK_REQUIRED_VERSION support) + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $JACK_REQUIRED_VERSION jack; then + JACK_CFLAGS=`$PKG_CONFIG --cflags jack` + JACK_LIBS=`$PKG_CONFIG --libs jack` + audio_jack=yes + fi + fi + AC_MSG_RESULT($audio_jack) + + if test x$audio_jack = xyes; then + AC_ARG_ENABLE(jack-shared, +AC_HELP_STRING([--enable-jack-shared], [dynamically load JACK audio support [[default=yes]]]), + , enable_jack_shared=yes) + jack_lib=[`find_lib "libjack.so.*" "$JACK_LIBS" | sed 's/.*\/\(.*\)/\1/; q'`] + + AC_DEFINE(SDL_AUDIO_DRIVER_JACK, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/jack/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $JACK_CFLAGS" + if test x$have_loadso != xyes && \ + test x$enable_jack_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic JACK audio loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_jack_shared = xyes && test x$jack_lib != x; then + echo "-- dynamic libjack -> $jack_lib" + AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_JACK_DYNAMIC, "$jack_lib", [ ]) + SUMMARY_audio="${SUMMARY_audio} jack(dynamic)" + + case "$host" in + # On Solaris, jack must be linked deferred explicitly + # to prevent undefined symbol failures. + *-*-solaris*) + JACK_LIBS=`echo $JACK_LIBS | sed 's/\-l/-Wl,-l/g'` + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-zdeferred $JACK_LIBS -Wl,-znodeferred" + esac + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $JACK_LIBS" + SUMMARY_audio="${SUMMARY_audio} jack" + fi + have_audio=yes + fi + fi +} + dnl Find the ESD includes and libraries CheckESD() { @@ -1049,6 +1154,58 @@ AC_HELP_STRING([--enable-sndio-shared], [dynamically load sndio audio support [[ fi } +dnl Find FusionSound +CheckFusionSound() +{ + AC_ARG_ENABLE(fusionsound, +AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]), + , enable_fusionsound=no) + if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then + fusionsound=no + + FUSIONSOUND_REQUIRED_VERSION=1.1.1 + + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support) + if test x$PKG_CONFIG != xno; then + if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then + FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound` + FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound` + fusionsound=yes + fi + fi + AC_MSG_RESULT($fusionsound) + + if test x$fusionsound = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" + + AC_ARG_ENABLE(fusionsound-shared, +AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]), + , enable_fusionsound_shared=yes) + fusionsound_shared=no + AC_MSG_CHECKING(for FusionSound dynamic loading support) + if test x$have_loadso != xyes && \ + test x$enable_fusionsound_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_fusionsound_shared = xyes; then + AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ]) + fusionsound_shared=yes + SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" + SUMMARY_audio="${SUMMARY_audio} fusionsound" + fi + AC_MSG_RESULT($fusionsound_shared) + + have_audio=yes + fi + fi +} + dnl rcg07142001 See if the user wants the disk writer audio driver... CheckDiskAudio() { @@ -1075,6 +1232,40 @@ AC_HELP_STRING([--enable-dummyaudio], [support the dummy audio driver [[default= fi } +dnl See if libsamplerate is available +CheckLibSampleRate() +{ + AC_ARG_ENABLE(libsamplerate, +AC_HELP_STRING([--enable-libsamplerate], [use libsamplerate for audio rate conversion [[default=yes]]]), + , enable_libsamplerate=yes) + if test x$enable_libsamplerate = xyes; then + AC_CHECK_HEADER(samplerate.h, + have_samplerate_h_hdr=yes, + have_samplerate_h_hdr=no) + if test x$have_samplerate_h_hdr = xyes; then + AC_DEFINE(HAVE_LIBSAMPLERATE_H, 1, [ ]) + + AC_ARG_ENABLE(libsamplerate-shared, +AC_HELP_STRING([--enable-libsamplerate-shared], [dynamically load libsamplerate [[default=yes]]]), + , enable_libsamplerate_shared=yes) + + samplerate_lib=[`find_lib "libsamplerate.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`] + + if test x$have_loadso != xyes && \ + test x$enable_libsamplerate_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic libsamplerate loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_libsamplerate_shared = xyes && test x$samplerate_lib != x; then + echo "-- dynamic libsamplerate -> $samplerate_lib" + AC_DEFINE_UNQUOTED(SDL_LIBSAMPLERATE_DYNAMIC, "$samplerate_lib", [ ]) + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lsamplerate" + fi + fi + fi +} + dnl See if GCC's -fvisibility=hidden is supported (gcc4 and later, usually). dnl Details of this flag are here: http://gcc.gnu.org/wiki/Visibility CheckVisibilityHidden() @@ -1218,7 +1409,7 @@ AC_HELP_STRING([--enable-video-wayland-qt-touch], [QtWayland server support for AC_DEFINE(SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH, 1, [ ]) fi - WAYLAND_PROTOCOLS_UNSTABLE="relative-pointer-unstable-v1 pointer-constraints-unstable-v1" + WAYLAND_PROTOCOLS_UNSTABLE="relative-pointer-unstable-v1 pointer-constraints-unstable-v1 xdg-shell-unstable-v6" SOURCES="$SOURCES $srcdir/src/video/wayland/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $WAYLAND_CFLAGS -I\$(gen)" @@ -1277,8 +1468,8 @@ dnl Check for Mir CheckMir() { AC_ARG_ENABLE(video-mir, -AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=yes]]]), - ,enable_video_mir=yes) +AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=no]]]), + ,enable_video_mir=no) if test x$enable_video = xyes -a x$enable_video_mir = xyes; then AC_PATH_PROG(PKG_CONFIG, pkg-config, no) @@ -1291,11 +1482,11 @@ AC_HELP_STRING([--enable-video-mir], [use Mir video driver [[default=yes]]]), save_CFLAGS="$CFLAGS" CFLAGS="$save_CFLAGS $MIR_CFLAGS" - dnl This will disable Mir if >= v0.25 is not available + dnl This will disable Mir if >= v0.26 is not available AC_TRY_COMPILE([ #include ],[ - MirTouchAction actions = mir_touch_actions + MirWindowAttrib attrib = mir_window_attrib_state ],[ video_mir=yes ]) @@ -1356,8 +1547,8 @@ CheckNativeClient() #endif ],[ ],[ - AC_DEFINE(SDL_VIDEO_DRIVER_NACL) - AC_DEFINE(SDL_AUDIO_DRIVER_NACL) + AC_DEFINE(SDL_VIDEO_DRIVER_NACL, 1, [ ]) + AC_DEFINE(SDL_AUDIO_DRIVER_NACL, 1, [ ]) AC_DEFINE(HAVE_POW, 1, [ ]) AC_DEFINE(HAVE_OPENGLES2, 1, [ ]) AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ]) @@ -1374,11 +1565,60 @@ CheckNativeClient() } +CheckRPI() +{ + AC_ARG_ENABLE(video-rpi, +AC_HELP_STRING([--enable-video-rpi], [use Raspberry Pi video driver [[default=yes]]]), + , enable_video_rpi=yes) + if test x$enable_video = xyes -a x$enable_video_rpi = xyes; then + AC_PATH_PROG(PKG_CONFIG, pkg-config, no) + if test x$PKG_CONFIG != xno && $PKG_CONFIG --exists bcm_host; then + RPI_CFLAGS=`$PKG_CONFIG --cflags bcm_host brcmegl` + RPI_LDFLAGS=`$PKG_CONFIG --libs bcm_host brcmegl` + elif test x$ARCH = xnetbsd; then + RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" + RPI_LDFLAGS="-Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host" + else + RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" + RPI_LDFLAGS="-Wl,-rpath,/opt/vc/lib -L/opt/vc/lib -lbcm_host" + fi + + # Save the original compiler flags and libraries + ac_save_cflags="$CFLAGS"; ac_save_libs="$LIBS" + + # Add the Raspberry Pi compiler flags and libraries + CFLAGS="$CFLAGS $RPI_CFLAGS"; LIBS="$LIBS $RPI_LDFLAGS" + + AC_MSG_CHECKING(for Raspberry Pi) + have_video_rpi=no + AC_TRY_LINK([ + #include + ],[ + bcm_host_init(); + ],[ + have_video_rpi=yes + ],[ + ]) + AC_MSG_RESULT($have_video_rpi) + + # Restore the compiler flags and libraries + CFLAGS="$ac_save_cflags"; LIBS="$ac_save_libs" + + if test x$have_video_rpi = xyes; then + CFLAGS="$CFLAGS $RPI_CFLAGS" + SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" + EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $RPI_LDFLAGS" + SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" + AC_DEFINE(SDL_VIDEO_DRIVER_RPI, 1, [ ]) + SUMMARY_video="${SUMMARY_video} rpi" + fi + fi +} + dnl Find the X11 include and library directories CheckX11() { - - AC_ARG_ENABLE(video-x11, AC_HELP_STRING([--enable-video-x11], [use X11 video driver [[default=yes]]]), , enable_video_x11=yes) @@ -1496,7 +1736,7 @@ AC_HELP_STRING([--enable-x11-shared], [dynamically load X11 support [[default=ma ],[ ],[ have_const_param_XextAddDisplay=yes - AC_DEFINE(SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY) + AC_DEFINE([SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY], 1, [ ]) ]) AC_MSG_RESULT($have_const_param_XextAddDisplay) @@ -1514,7 +1754,7 @@ XGetEventData(display, cookie); XFreeEventData(display, cookie); ],[ have_XGenericEvent=yes - AC_DEFINE(SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS) + AC_DEFINE([SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS], 1, [ ]) ]) AC_MSG_RESULT($have_XGenericEvent) @@ -1628,7 +1868,7 @@ int event_type = XI_TouchBegin; XITouchClassInfo *t; ],[ have_xinput2_multitouch=yes - AC_DEFINE(SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH) + AC_DEFINE([SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH], 1, []) SUMMARY_video_x11="${SUMMARY_video_x11} xinput2_multitouch" ]) AC_MSG_RESULT($have_xinput2_multitouch) @@ -1803,7 +2043,7 @@ AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]) , enable_video_cocoa=yes) if test x$enable_video = xyes -a x$enable_video_cocoa = xyes; then save_CFLAGS="$CFLAGS" - dnl work around that we don't have Objective-C support in autoconf + dnl Work around that we don't have Objective-C support in autoconf CFLAGS="$CFLAGS -x objective-c" AC_MSG_CHECKING(for Cocoa framework) have_cocoa=no @@ -1824,6 +2064,42 @@ AC_HELP_STRING([--enable-video-cocoa], [use Cocoa video driver [[default=yes]]]) fi } +CheckMETAL() +{ + AC_ARG_ENABLE(render-metal, +AC_HELP_STRING([--enable-render-metal], [enable the Metal render driver [[default=yes]]]), + , enable_render_metal=yes) + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + save_CFLAGS="$CFLAGS" + dnl Work around that we don't have Objective-C support in autoconf + CFLAGS="$CFLAGS -x objective-c" + AC_MSG_CHECKING(for Metal framework) + have_metal=no + AC_TRY_COMPILE([ + #import + #import + #import + + #if !TARGET_CPU_X86_64 + #error Metal doesn't work on this configuration + #endif + ],[ + ],[ + have_metal=yes + ]) + CFLAGS="$save_CFLAGS" + AC_MSG_RESULT($have_metal) + if test x$have_metal = xyes; then + AC_DEFINE(SDL_VIDEO_RENDER_METAL, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/render/metal/*.m" + SUMMARY_video="${SUMMARY_video} metal" + else + enable_render_metal=no + fi + fi +} + + dnl Find DirectFB CheckDirectFB() { @@ -1874,13 +2150,12 @@ AC_HELP_STRING([--enable-directfb-shared], [dynamically load directfb support [[ , enable_directfb_shared=yes) AC_DEFINE(SDL_VIDEO_DRIVER_DIRECTFB, 1, [ ]) - AC_DEFINE(SDL_VIDEO_RENDER_DIRECTFB, 1, [ ]) SOURCES="$SOURCES $srcdir/src/video/directfb/*.c" EXTRA_CFLAGS="$EXTRA_CFLAGS $DIRECTFB_CFLAGS" AC_MSG_CHECKING(for directfb dynamic loading support) directfb_shared=no - directfb_lib=[`find_lib "libdirectfb.so.*" "$DIRECTFB_LIBS"`] + directfb_lib=[`find_lib "libdirectfb*.so.*" "$DIRECTFB_LIBS"`] # | sed 's/.*\/\(.*\)/\1/; q'`] AC_MSG_WARN("directfb $directfb_lib") if test x$have_loadso != xyes && \ @@ -1904,54 +2179,77 @@ AC_MSG_WARN("directfb $directfb_lib") fi } -dnl Find FusionSound -CheckFusionSound() +dnl Find KMSDRM +CheckKMSDRM() { - AC_ARG_ENABLE(fusionsound, -AC_HELP_STRING([--enable-fusionsound], [use FusionSound audio driver [[default=no]]]), - , enable_fusionsound=no) - if test x$enable_audio = xyes -a x$enable_fusionsound = xyes; then - fusionsound=no + AC_ARG_ENABLE(video-kmsdrm, +AC_HELP_STRING([--enable-video-kmsdrm], [use KMSDRM video driver [[default=no]]]), + , enable_video_kmsdrm=no) - FUSIONSOUND_REQUIRED_VERSION=1.1.1 + if test x$enable_video = xyes -a x$enable_video_kmsdrm = xyes; then + video_kmsdrm=no + libdrm_avail=no + libgbm_avail=no + + LIBDRM_REQUIRED_VERSION=2.4.46 + LIBGBM_REQUIRED_VERSION=9.0.0 AC_PATH_PROG(PKG_CONFIG, pkg-config, no) - AC_MSG_CHECKING(for FusionSound $FUSIONSOUND_REQUIRED_VERSION support) if test x$PKG_CONFIG != xno; then - if $PKG_CONFIG --atleast-pkgconfig-version 0.7 && $PKG_CONFIG --atleast-version $FUSIONSOUND_REQUIRED_VERSION fusionsound; then - FUSIONSOUND_CFLAGS=`$PKG_CONFIG --cflags fusionsound` - FUSIONSOUND_LIBS=`$PKG_CONFIG --libs fusionsound` - fusionsound=yes - fi - fi - AC_MSG_RESULT($fusionsound) + if $PKG_CONFIG --atleast-pkgconfig-version 0.7; then + if $PKG_CONFIG --atleast-version $LIBDRM_REQUIRED_VERSION libdrm; then + LIBDRM_CFLAGS=`$PKG_CONFIG --cflags libdrm` + LIBDRM_LIBS=`$PKG_CONFIG --libs libdrm` + LIBDRM_PREFIX=`$PKG_CONFIG --variable=prefix libdrm` + libdrm_avail=yes + fi + if $PKG_CONFIG --atleast-version $LIBGBM_REQUIRED_VERSION gbm; then + LIBGBM_CFLAGS=`$PKG_CONFIG --cflags gbm` + LIBGBM_LIBS=`$PKG_CONFIG --libs gbm` + LIBGBM_PREFIX=`$PKG_CONFIG --variable=prefix gbm` + libgbm_avail=yes + fi + if test x$libdrm_avail = xyes -a x$libgbm_avail = xyes; then + video_kmsdrm=yes + fi + + AC_MSG_CHECKING(for libdrm $LIBDRM_REQUIRED_VERSION library for kmsdrm support) + AC_MSG_RESULT($libdrm_avail) + AC_MSG_CHECKING(for libgbm $LIBGBM_REQUIRED_VERSION library for kmsdrm support) + AC_MSG_RESULT($libgbm_avail) - if test x$fusionsound = xyes; then - AC_DEFINE(SDL_AUDIO_DRIVER_FUSIONSOUND, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/fusionsound/*.c" - EXTRA_CFLAGS="$EXTRA_CFLAGS $FUSIONSOUND_CFLAGS" - - AC_ARG_ENABLE(fusionsound-shared, -AC_HELP_STRING([--enable-fusionsound-shared], [dynamically load fusionsound audio support [[default=yes]]]), - , enable_fusionsound_shared=yes) - fusionsound_shared=no - AC_MSG_CHECKING(for FusionSound dynamic loading support) - if test x$have_loadso != xyes && \ - test x$enable_fusionsound_shared = xyes; then - AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic fusionsound loading]) + if test x$video_kmsdrm = xyes; then + AC_ARG_ENABLE(kmsdrm-shared, +AC_HELP_STRING([--enable-kmsdrm-shared], [dynamically load kmsdrm support [[default=yes]]]), + , enable_kmsdrm_shared=yes) + + AC_DEFINE(SDL_VIDEO_DRIVER_KMSDRM, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/video/kmsdrm/*.c" + EXTRA_CFLAGS="$EXTRA_CFLAGS $LIBDRM_CFLAGS $LIBGBM_CFLAGS" + + AC_MSG_CHECKING(for kmsdrm dynamic loading support) + kmsdrm_shared=no + drm_lib=[`find_lib "libdrm.so.*" "$DRM_LIBS"`] + gbm_lib=[`find_lib "libgbm.so.*" "$DRM_LIBS"`] + if test x$have_loadso != xyes && \ + test x$enable_kmsdrm_shared = xyes; then + AC_MSG_WARN([You must have SDL_LoadObject() support for dynamic kmsdrm loading]) + fi + if test x$have_loadso = xyes && \ + test x$enable_kmsdrm_shared = xyes && test x$drm_lib != x && test x$gbm_lib != x; then + kmsdrm_shared=yes + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC, "$drm_lib", [ ]) + AC_DEFINE_UNQUOTED(SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM, "$gbm_lib", [ ]) + AC_DEFINE_UNQUOTED(HAVE_KMSDRM_SHARED, "TRUE", [ ]) + SUMMARY_video="${SUMMARY_video} kmsdrm(dynamic)" + else + EXTRA_LDFLAGS="$EXTRA_LDFLAGS $LIBDRM_LIBS $LIBGBM_LIBS" + SUMMARY_video="${SUMMARY_video} kmsdrm" + fi + AC_MSG_RESULT($kmsdrm_shared) + have_video=yes + fi fi - if test x$have_loadso = xyes && \ - test x$enable_fusionsound_shared = xyes; then - AC_DEFINE_UNQUOTED(SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC, "libfusionsound.so", [ ]) - fusionsound_shared=yes - SUMMARY_audio="${SUMMARY_audio} fusionsound(dynamic)" - else - EXTRA_LDFLAGS="$EXTRA_LDFLAGS $FUSIONSOUND_LIBS" - SUMMARY_audio="${SUMMARY_audio} fusionsound" - fi - AC_MSG_RESULT($fusionsound_shared) - - have_audio=yes fi fi } @@ -1970,6 +2268,30 @@ AC_HELP_STRING([--enable-video-dummy], [use dummy video driver [[default=yes]]]) fi } +dnl Set up the QNX video driver if enabled +CheckQNXVideo() +{ + if test x$enable_video = xyes; then + AC_DEFINE(SDL_VIDEO_DRIVER_QNX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/video/qnx/*.c" + have_video=yes + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lscreen -lEGL -lGLESv2" + SUMMARY_video="${SUMMARY_video} qnx" + fi +} + +dnl Set up the QNX audio driver if enabled +CheckQNXAudio() +{ + if test x$enable_audio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_QSA, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/qsa/*.c" + have_audio=yes + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lasound" + SUMMARY_audio="${SUMMARY_audio} qsa" + fi +} + dnl Check to see if OpenGL support is desired AC_ARG_ENABLE(video-opengl, AC_HELP_STRING([--enable-video-opengl], [include OpenGL support [[default=yes]]]), @@ -2174,6 +2496,61 @@ CheckEmscriptenGLES() fi } +dnl Check to see if Vulkan support is desired +AC_ARG_ENABLE(video-vulkan, +AC_HELP_STRING([--enable-video-vulkan], [include Vulkan support [[default=yes]]]), + , enable_video_vulkan=yes) + +dnl Find Vulkan Header +CheckVulkan() +{ + if test x$enable_video = xyes -a x$enable_video_vulkan = xyes; then + case "$host" in + *-*-android*) + AC_TRY_COMPILE([ + #if defined(__ARM_ARCH) && __ARM_ARCH < 7 + #error Vulkan doesn't work on this configuration + #endif + ],[ + ],[ + ],[ + enable_video_vulkan=no + ]) + ;; + *-*-darwin*) + save_CFLAGS="$CFLAGS" + dnl Work around that we don't have Objective-C support in autoconf + CFLAGS="$CFLAGS -x objective-c" + AC_TRY_COMPILE([ + #include + #include + #include + + #if !TARGET_CPU_X86_64 + #error Vulkan doesn't work on this configuration + #endif + ],[ + ],[ + ],[ + enable_video_vulkan=no + ]) + CFLAGS="$save_CFLAGS" + ;; + *) + ;; + esac + if test x$enable_video_vulkan = xno; then + # For reasons I am totally unable to see, I get an undefined macro error if + # I put this in the AC_TRY_COMPILE. + AC_MSG_WARN([Vulkan does not work on this configuration.]) + fi + fi + if test x$enable_video_vulkan = xyes; then + AC_DEFINE(SDL_VIDEO_VULKAN, 1, [ ]) + SUMMARY_video="${SUMMARY_video} vulkan" + fi +} + dnl See if we can use the new unified event interface in Linux 2.4 CheckInputEvents() { @@ -2231,6 +2608,12 @@ AC_HELP_STRING([--enable-libudev], [enable libudev support [[default=yes]]]), have_libudev_h_hdr=no) if test x$have_libudev_h_hdr = xyes; then AC_DEFINE(HAVE_LIBUDEV_H, 1, [ ]) + + udev_lib=[`find_lib "libudev.so.*" "" | sed 's/.*\/\(.*\)/\1/; q'`] + if test x$udev_lib != x; then + echo "-- dynamic udev -> $udev_lib" + AC_DEFINE_UNQUOTED(SDL_UDEV_DYNAMIC, "$udev_lib", [ ]) + fi fi fi } @@ -2379,7 +2762,7 @@ AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[def AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]), , enable_pthread_sem=yes) case "$host" in - *-*-androideabi*) + *-*-android*) pthread_cflags="-D_REENTRANT -D_THREAD_SAFE" pthread_lib="" ;; @@ -2439,6 +2822,10 @@ AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]) pthread_cflags="-D_REENTRANT" pthread_lib="" ;; + *-*-nto*) + pthread_cflags="-D_REENTRANT" + pthread_lib="" + ;; *) pthread_cflags="-D_REENTRANT" pthread_lib="-lpthread" @@ -2528,7 +2915,7 @@ AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]) sem_timedwait(NULL, NULL); ],[ have_sem_timedwait=yes - AC_DEFINE(HAVE_SEM_TIMEDWAIT) + AC_DEFINE([HAVE_SEM_TIMEDWAIT], 1, [ ]) ]) AC_MSG_RESULT($have_sem_timedwait) fi @@ -2637,8 +3024,19 @@ AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[defaul AC_CHECK_HEADER(dsound.h, have_dsound=yes) AC_CHECK_HEADER(dinput.h, have_dinput=yes) AC_CHECK_HEADER(dxgi.h, have_dxgi=yes) - AC_CHECK_HEADER(xaudio2.h, have_xaudio2=yes) AC_CHECK_HEADER(xinput.h, have_xinput=yes) + AC_CHECK_HEADER(mmdeviceapi.h, have_wasapi=yes) + AC_CHECK_HEADER(audioclient.h,,have_wasapi=no) + AC_TRY_COMPILE([ +#include +#include +XINPUT_GAMEPAD_EX x1; + ],[],[have_xinput_gamepadex=yes]) + AC_TRY_COMPILE([ +#include +#include +XINPUT_STATE_EX s1; + ],[],[have_xinput_stateex=yes]) if test x$have_ddraw = xyes; then AC_DEFINE(HAVE_DDRAW_H, 1, [ ]) @@ -2655,6 +3053,12 @@ AC_HELP_STRING([--enable-directx], [use DirectX for Windows audio/video [[defaul if test x$have_xinput = xyes; then AC_DEFINE(HAVE_XINPUT_H, 1, [ ]) fi + if test x$have_xinput_gamepadex = xyes; then + AC_DEFINE(HAVE_XINPUT_GAMEPAD_EX, 1, [ ]) + fi + if test x$have_xinput_stateex = xyes; then + AC_DEFINE(HAVE_XINPUT_STATE_EX, 1, [ ]) + fi SUMMARY_video="${SUMMARY_video} directx" SUMMARY_audio="${SUMMARY_audio} directx" @@ -2883,25 +3287,9 @@ CheckWarnAll dnl Set up the configuration based on the host platform! case "$host" in - *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*) + *-*-linux*|*-*-uclinux*|*-*-gnu*|*-*-k*bsd*-gnu|*-*-bsdi*|*-*-freebsd*|*-*-dragonfly*|*-*-netbsd*|*-*-openbsd*|*-*-sysv5*|*-*-solaris*|*-*-hpux*|*-*-aix*|*-*-minix*|*-*-nto*) case "$host" in - *-raspberry-linux*) - # Raspberry Pi - ARCH=linux - RPI_CFLAGS="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux" - CFLAGS="$CFLAGS $RPI_CFLAGS" - SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" - EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -L/opt/vc/lib -lbcm_host -ldl" - - if test x$enable_video = xyes; then - SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" - # FIXME: confdefs? Not AC_DEFINE? - $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h - SUMMARY_video="${SUMMARY_video} rpi" - fi - ;; - *-*-androideabi*) + *-*-android*) # Android ARCH=android ANDROID_CFLAGS="-DGL_GLEXT_PROTOTYPES" @@ -2909,6 +3297,7 @@ case "$host" in SDL_CFLAGS="$SDL_CFLAGS $ANDROID_CFLAGS" EXTRA_CFLAGS="$EXTRA_CFLAGS $ANDROID_CFLAGS" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl -lGLESv1_CM -lGLESv2 -llog -landroid" + SDLMAIN_SOURCES="$srcdir/src/main/android/*.c" if test x$enable_video = xyes; then SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c" @@ -2926,21 +3315,6 @@ case "$host" in *-*-bsdi*) ARCH=bsdi ;; *-*-freebsd*) ARCH=freebsd ;; *-*-dragonfly*) ARCH=freebsd ;; - *-raspberry-netbsd*) - # Raspberry Pi - ARCH=netbsd - RPI_CFLAGS="-I/usr/pkg/include -I/usr/pkg/include/interface/vcos/pthreads -I/usr/pkg/include/interface/vmcs_host/linux" - CFLAGS="$CFLAGS $RPI_CFLAGS" - SDL_CFLAGS="$SDL_CFLAGS $RPI_CFLAGS" - EXTRA_CFLAGS="$EXTRA_CFLAGS $RPI_CFLAGS" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-R/usr/pkg/lib -L/usr/pkg/lib -lbcm_host -ldl" - - if test x$enable_video = xyes; then - SOURCES="$SOURCES $srcdir/src/video/raspberry/*.c" - $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h - SUMMARY_video="${SUMMARY_video} raspberry" - fi - ;; *-*-netbsd*) ARCH=netbsd ;; *-*-openbsd*) ARCH=openbsd ;; *-*-sysv5*) ARCH=sysv5 ;; @@ -2948,6 +3322,9 @@ case "$host" in *-*-hpux*) ARCH=hpux ;; *-*-aix*) ARCH=aix ;; *-*-minix*) ARCH=minix ;; + *-*-nto*) ARCH=nto + CheckQNXVideo + ;; esac CheckVisibilityHidden CheckDeclarationAfterStatement @@ -2958,15 +3335,21 @@ case "$host" in CheckOSS CheckALSA CheckPulseAudio + CheckJACK CheckARTSC CheckESD CheckNAS CheckSNDIO + CheckFusionSound + CheckLibSampleRate + # Need to check for Raspberry PI first and add platform specific compiler flags, otherwise the test for GLES fails! + CheckRPI CheckX11 CheckDirectFB - CheckFusionSound + CheckKMSDRM CheckOpenGLX11 CheckOpenGLESX11 + CheckVulkan CheckMir CheckWayland CheckLibUDev @@ -2987,22 +3370,26 @@ case "$host" in CheckLinuxVersion CheckRPATH CheckVivanteVideo + # Set up files for the audio library if test x$enable_audio = xyes; then case $ARCH in sysv5|solaris|hpux) AC_DEFINE(SDL_AUDIO_DRIVER_SUNAUDIO, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/sun/*.c" + SUMMARY_audio="${SUMMARY_audio} sun" have_audio=yes ;; netbsd) # Don't use this on OpenBSD, it's busted. - AC_DEFINE(SDL_AUDIO_DRIVER_BSD, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/bsd/*.c" + AC_DEFINE(SDL_AUDIO_DRIVER_NETBSD, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/netbsd/*.c" + SUMMARY_audio="${SUMMARY_audio} netbsd" have_audio=yes ;; aix) AC_DEFINE(SDL_AUDIO_DRIVER_PAUDIO, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c" + SUMMARY_audio="${SUMMARY_audio} paudio" have_audio=yes ;; android) @@ -3011,6 +3398,9 @@ case "$host" in SUMMARY_audio="${SUMMARY_audio} android" have_audio=yes ;; + nto) + CheckQNXAudio + ;; esac fi # Set up files for the joystick library @@ -3019,26 +3409,33 @@ case "$host" in linux) AC_DEFINE(SDL_JOYSTICK_LINUX, 1, [ ]) SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" have_joystick=yes ;; android) AC_DEFINE(SDL_JOYSTICK_ANDROID, 1, [ ]) SOURCES="$SOURCES $srcdir/src/joystick/android/*.c" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" have_joystick=yes ;; esac fi # Set up files for the haptic library if test x$enable_haptic = xyes; then - if test x$use_input_events = xyes; then - case $ARCH in - linux) - AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c" - have_haptic=yes - ;; - esac - fi + case $ARCH in + linux) + if test x$use_input_events = xyes; then + AC_DEFINE(SDL_HAPTIC_LINUX, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/haptic/linux/*.c" + have_haptic=yes + fi + ;; + android) + AC_DEFINE(SDL_HAPTIC_ANDROID, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/haptic/android/*.c" + have_haptic=yes + ;; + esac fi # Set up files for the power library if test x$enable_power = xyes; then @@ -3082,8 +3479,10 @@ case "$host" in fi # Set up files for evdev input if test x$use_input_events = xyes; then - SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev.c" + SOURCES="$SOURCES $srcdir/src/core/linux/SDL_evdev*.c" fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" ;; *-*-cygwin* | *-*-mingw32*) ARCH=win32 @@ -3096,12 +3495,14 @@ case "$host" in ac_default_prefix=$BUILD_PREFIX fi fi + CheckDeclarationAfterStatement CheckDummyVideo CheckDiskAudio CheckDummyAudio CheckWINDOWS CheckWINDOWSGL CheckWINDOWSGLES + CheckVulkan CheckDIRECTX # Set up the core platform files @@ -3130,9 +3531,9 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau AC_DEFINE(SDL_AUDIO_DRIVER_DSOUND, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/directsound/*.c" fi - if test x$have_xaudio2 = xyes; then - AC_DEFINE(SDL_AUDIO_DRIVER_XAUDIO2, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/audio/xaudio2/*.c" + if test x$have_wasapi = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_WASAPI, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/audio/wasapi/*.c" fi have_audio=yes fi @@ -3144,7 +3545,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau fi if test x$have_dinput = xyes; then AC_DEFINE(SDL_JOYSTICK_DINPUT, 1, [ ]) - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldinput8 -ldxguid -ldxerr8" fi else AC_DEFINE(SDL_JOYSTICK_WINMM, 1, [ ]) @@ -3229,6 +3630,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau CheckDummyVideo CheckDiskAudio CheckDummyAudio + CheckDLOPEN CheckHaikuVideo CheckHaikuGL CheckPTHREAD @@ -3237,6 +3639,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau if test x$enable_audio = xyes; then AC_DEFINE(SDL_AUDIO_DRIVER_HAIKU, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/haiku/*.cc" + SUMMARY_audio="${SUMMARY_audio} haiku" have_audio=yes fi # Set up files for the joystick library @@ -3251,12 +3654,6 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau SOURCES="$SOURCES $srcdir/src/timer/haiku/*.c" have_timers=yes fi - # Set up files for the shared object loading library - if test x$enable_loadso = xyes; then - AC_DEFINE(SDL_LOADSO_HAIKU, 1, [ ]) - SOURCES="$SOURCES $srcdir/src/loadso/haiku/*.c" - have_loadso=yes - fi # Set up files for the system power library if test x$enable_power = xyes; then AC_DEFINE(SDL_POWER_HAIKU, 1, [ ]) @@ -3272,10 +3669,11 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau # The Haiku platform requires special setup. SOURCES="$srcdir/src/main/haiku/*.cc $SOURCES" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lroot -lbe -lmedia -lgame -ldevice -ltextencoding" + # Haiku's x86 spins use libstdc++.r4.so (for binary compat?), but + # other spins, like x86-64, use a more standard "libstdc++.so.*" + AC_CHECK_FILE("/boot/system/lib/libstdc++.r4.so", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++.r4", EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lstdc++") ;; - arm*-apple-darwin*) - # iOS - We are not writing anything to confdefs.h because you have to replace - # SDL_config.h for SDL_config_iphoneos.h anyway + arm*-apple-darwin*|*-ios-*) ARCH=ios CheckVisibilityHidden @@ -3284,19 +3682,22 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau CheckDiskAudio CheckDummyAudio CheckDLOPEN - CheckCOCOA + CheckMETAL + CheckVulkan CheckPTHREAD - # Set up files for the audio library if test x$enable_audio = xyes; then + AC_DEFINE(SDL_AUDIO_DRIVER_COREAUDIO, 1, [ ]) SOURCES="$SOURCES $srcdir/src/audio/coreaudio/*.m" SUMMARY_audio="${SUMMARY_audio} coreaudio" have_audio=yes fi # Set up files for the joystick library if test x$enable_joystick = xyes; then + AC_DEFINE(SDL_JOYSTICK_MFI, 1, [ ]) SOURCES="$SOURCES $srcdir/src/joystick/iphoneos/*.m" + SOURCES="$SOURCES $srcdir/src/joystick/steam/*.c" have_joystick=yes fi # Set up files for the haptic library @@ -3307,6 +3708,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau #fi # Set up files for the power library if test x$enable_power = xyes; then + AC_DEFINE(SDL_POWER_UIKIT, 1, [ ]) SOURCES="$SOURCES $srcdir/src/power/uikit/*.m" have_power=yes fi @@ -3315,28 +3717,41 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau SOURCES="$SOURCES $srcdir/src/filesystem/cocoa/*.m" have_filesystem=yes fi + # Set up additional files for the file library + if test x$enable_file = xyes; then + AC_DEFINE(SDL_FILESYSTEM_COCOA, 1, [ ]) + SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" + fi # Set up files for the timer library if test x$enable_timers = xyes; then + AC_DEFINE(SDL_TIMER_UNIX, 1, [ ]) SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes fi - # Set up additional files for the file library - if test x$enable_file = xyes; then - SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" - fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" # The iOS platform requires special setup. + AC_DEFINE(SDL_VIDEO_DRIVER_UIKIT, 1, [ ]) + AC_DEFINE(SDL_VIDEO_OPENGL_ES2, 1, [ ]) + AC_DEFINE(SDL_VIDEO_OPENGL_ES, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES, 1, [ ]) + AC_DEFINE(SDL_VIDEO_RENDER_OGL_ES2, 1, [ ]) SOURCES="$SOURCES $srcdir/src/video/uikit/*.m" - EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -liconv -lobjc" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore" - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AVFoundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,AudioToolbox" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreAudio" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreGraphics" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreMotion" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Foundation" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,GameController" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,OpenGLES" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,QuartzCore" + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,UIKit" + + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Metal" + fi ;; *-*-darwin* ) # This could be either full "Mac OS X", or plain "Darwin" which is @@ -3355,9 +3770,11 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau CheckDummyAudio CheckDLOPEN CheckCOCOA + CheckMETAL CheckX11 CheckMacGL CheckOpenGLX11 + CheckVulkan CheckPTHREAD # Set up files for the audio library @@ -3403,13 +3820,18 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau if test x$enable_file = xyes; then SOURCES="$SOURCES $srcdir/src/file/cocoa/*.m" fi + # Set up other core UNIX files + SOURCES="$SOURCES $srcdir/src/core/unix/*.c" # The Mac OS X platform requires special setup. - EXTRA_CFLAGS="$EXTRA_CFLAGS -fpascal-strings" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lobjc" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,CoreVideo" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Cocoa" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,Carbon" EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-framework,IOKit" + + if test x$enable_render = xyes -a x$enable_render_metal = xyes; then + EXTRA_LDFLAGS="$EXTRA_LDFLAGS -Wl,-weak_framework,QuartzCore -Wl,-weak_framework,Metal" + fi ;; *-nacl|*-pnacl) ARCH=nacl @@ -3421,7 +3843,7 @@ AC_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau # Set up files for the timer library if test x$enable_timers = xyes; then - AC_DEFINE(SDL_TIMER_UNIX) + AC_DEFINE(SDL_TIMER_UNIX, 1, [ ]) SOURCES="$SOURCES $srcdir/src/timer/unix/*.c" have_timers=yes fi @@ -3604,16 +4026,16 @@ VERSION_DEPENDS=`echo "$VERSION_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\. SDLMAIN_OBJECTS=`echo $SDLMAIN_SOURCES` SDLMAIN_DEPENDS=`echo $SDLMAIN_SOURCES` -SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'` +SDLMAIN_OBJECTS=`echo "$SDLMAIN_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'` SDLMAIN_DEPENDS=`echo "$SDLMAIN_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\ -\\$(objects)/\\2.o: \\1/\\2.c\\\\ +\\$(objects)/\\2.lo: \\1/\\2.c\\\\ \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` SDLTEST_OBJECTS=`echo $SDLTEST_SOURCES` SDLTEST_DEPENDS=`echo $SDLTEST_SOURCES` -SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.o,g'` +SDLTEST_OBJECTS=`echo "$SDLTEST_OBJECTS" | sed 's,[[^ ]]*/\([[^ ]]*\)\.c,$(objects)/\1.lo,g'` SDLTEST_DEPENDS=`echo "$SDLTEST_DEPENDS" | sed "s,\\([[^ ]]*\\)/\\([[^ ]]*\\)\\.c,\\\\ -\\$(objects)/\\2.o: \\1/\\2.c\\\\ +\\$(objects)/\\2.lo: \\1/\\2.c\\\\ \\$(RUN_CMD_CC)\\$(LIBTOOL) --tag=CC --mode=compile \\$(CC) \\$(CFLAGS) \\$(EXTRA_CFLAGS) $DEPENDENCY_TRACKING_OPTIONS -c \\$< -o \\$@,g"` # Set runtime shared library paths as needed @@ -3718,30 +4140,35 @@ if test x$have_x = xyes; then SUMMARY="${SUMMARY}X11 libraries :${SUMMARY_video_x11}\n" fi SUMMARY="${SUMMARY}Input drivers :${SUMMARY_input}\n" -if test x$enable_libudev = xyes; then - SUMMARY="${SUMMARY}Using libudev : YES\n" +if test x$have_samplerate_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using libsamplerate : YES\n" else - SUMMARY="${SUMMARY}Using libudev : NO\n" + SUMMARY="${SUMMARY}Using libsamplerate : NO\n" +fi +if test x$have_libudev_h_hdr = xyes; then + SUMMARY="${SUMMARY}Using libudev : YES\n" +else + SUMMARY="${SUMMARY}Using libudev : NO\n" fi if test x$have_dbus_dbus_h_hdr = xyes; then - SUMMARY="${SUMMARY}Using dbus : YES\n" + SUMMARY="${SUMMARY}Using dbus : YES\n" else - SUMMARY="${SUMMARY}Using dbus : NO\n" + SUMMARY="${SUMMARY}Using dbus : NO\n" fi if test x$enable_ime = xyes; then - SUMMARY="${SUMMARY}Using ime : YES\n" + SUMMARY="${SUMMARY}Using ime : YES\n" else - SUMMARY="${SUMMARY}Using ime : NO\n" + SUMMARY="${SUMMARY}Using ime : NO\n" fi if test x$have_ibus_ibus_h_hdr = xyes; then - SUMMARY="${SUMMARY}Using ibus : YES\n" + SUMMARY="${SUMMARY}Using ibus : YES\n" else - SUMMARY="${SUMMARY}Using ibus : NO\n" + SUMMARY="${SUMMARY}Using ibus : NO\n" fi if test x$have_fcitx_frontend_h_hdr = xyes; then - SUMMARY="${SUMMARY}Using fcitx : YES\n" + SUMMARY="${SUMMARY}Using fcitx : YES\n" else - SUMMARY="${SUMMARY}Using fcitx : NO\n" + SUMMARY="${SUMMARY}Using fcitx : NO\n" fi AC_CONFIG_COMMANDS([summary], [echo -en "$SUMMARY"], [SUMMARY="$SUMMARY"]) diff --git a/Engine/lib/sdl/debian/changelog b/Engine/lib/sdl/debian/changelog index 6a88d2473..54f43972d 100644 --- a/Engine/lib/sdl/debian/changelog +++ b/Engine/lib/sdl/debian/changelog @@ -1,3 +1,27 @@ +libsdl2 (2.0.8) UNRELEASED; urgency=low + + * Updated SDL to version 2.0.8 + + -- Sam Lantinga Sat, 4 Nov 2017 21:21:53 -0800 + +libsdl2 (2.0.7) UNRELEASED; urgency=low + + * Updated SDL to version 2.0.7 + + -- Sam Lantinga Thu, 12 Oct 2017 08:01:16 -0800 + +libsdl2 (2.0.6) UNRELEASED; urgency=low + + * Updated SDL to version 2.0.6 + + -- Sam Lantinga Sat, 9 Sep 2017 07:29:36 -0800 + +libsdl2 (2.0.5) UNRELEASED; urgency=low + + * Updated SDL to version 2.0.5 + + -- Sam Lantinga Mon, 28 Nov 2016 07:32:52 -0800 + libsdl2 (2.0.4) UNRELEASED; urgency=low * Updated SDL to version 2.0.4 diff --git a/Engine/lib/sdl/debian/control b/Engine/lib/sdl/debian/control index e61995df4..a3411335a 100644 --- a/Engine/lib/sdl/debian/control +++ b/Engine/lib/sdl/debian/control @@ -11,6 +11,7 @@ Standards-Version: 3.9.3 Build-Depends: debhelper (>= 9), dh-autoreconf, dpkg-dev (>= 1.16.1~), + fcitx-libs-dev [linux-any], libasound2-dev [linux-any], libgl1-mesa-dev, libpulse-dev, @@ -26,7 +27,6 @@ Build-Depends: debhelper (>= 9), libxinerama-dev, libxrandr-dev, libxss-dev, - libxt-dev, libxxf86vm-dev Homepage: http://www.libsdl.org/ diff --git a/Engine/lib/sdl/debian/copyright b/Engine/lib/sdl/debian/copyright index 99c3d4496..4ccbf0fbd 100644 --- a/Engine/lib/sdl/debian/copyright +++ b/Engine/lib/sdl/debian/copyright @@ -4,7 +4,7 @@ Upstream-Contact: Sam Lantinga Source: http://www.libsdl.org/ Files: * -Copyright: 1997-2016 Sam Lantinga +Copyright: 1997-2018 Sam Lantinga License: zlib/libpng Files: src/libm/* @@ -12,7 +12,7 @@ Copyright: 1993 by Sun Microsystems, Inc. All rights reserved. License: SunPro Files: src/main/windows/SDL_windows_main.c -Copyright: 2016 Sam Lantinga +Copyright: 2018 Sam Lantinga License: PublicDomain_Sam_Lantinga Comment: SDL_main.c, placed in the public domain by Sam Lantinga 4/13/98 @@ -32,7 +32,7 @@ Copyright: 1995 Erik Corry License: BrownUn_UnCalifornia_ErikCorry Files: src/test/SDL_test_md5.c -Copyright: 1997-2016 Sam Lantinga +Copyright: 1997-2018 Sam Lantinga 1990 RSA Data Security, Inc. License: zlib/libpng and RSA_Data_Security @@ -46,12 +46,12 @@ Copyright: 1994-2003 The XFree86 Project, Inc. License: MIT/X11 Files: test/testhaptic.c -Copyright: 1997-2016 Sam Lantinga +Copyright: 1997-2018 Sam Lantinga 2008 Edgar Simo Serra License: BSD_3_clause Files: test/testrumble.c -Copyright: 1997-2016 Sam Lantinga +Copyright: 1997-2018 Sam Lantinga 2011 Edgar Simo Serra License: BSD_3_clause @@ -169,7 +169,7 @@ License: BSD_3_clause (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Comment: - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga . This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/debian/libsdl2-dev.install b/Engine/lib/sdl/debian/libsdl2-dev.install index af2c5b19d..a1f02d8cd 100644 --- a/Engine/lib/sdl/debian/libsdl2-dev.install +++ b/Engine/lib/sdl/debian/libsdl2-dev.install @@ -1,9 +1,8 @@ usr/bin/sdl2-config usr/include/SDL2 -usr/lib/*/libSDL2*.so -usr/lib/*/libSDL2.a -usr/lib/*/libSDL2main.a -usr/lib/*/libSDL2_test.a +usr/lib/*/*.a +usr/lib/*/*.la +usr/lib/*/*.so usr/lib/*/pkgconfig/sdl2.pc usr/lib/*/cmake/SDL2/sdl2-config.cmake usr/share/aclocal/sdl2.m4 diff --git a/Engine/lib/sdl/include/SDL.h b/Engine/lib/sdl/include/SDL.h index 1a3fa285c..d48d9d4a0 100644 --- a/Engine/lib/sdl/include/SDL.h +++ b/Engine/lib/sdl/include/SDL.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,8 +26,8 @@ */ -#ifndef _SDL_H -#define _SDL_H +#ifndef SDL_h_ +#define SDL_h_ #include "SDL_main.h" #include "SDL_stdinc.h" @@ -40,10 +40,10 @@ #include "SDL_error.h" #include "SDL_events.h" #include "SDL_filesystem.h" -#include "SDL_joystick.h" #include "SDL_gamecontroller.h" #include "SDL_haptic.h" #include "SDL_hints.h" +#include "SDL_joystick.h" #include "SDL_loadso.h" #include "SDL_log.h" #include "SDL_messagebox.h" @@ -51,6 +51,7 @@ #include "SDL_power.h" #include "SDL_render.h" #include "SDL_rwops.h" +#include "SDL_shape.h" #include "SDL_system.h" #include "SDL_thread.h" #include "SDL_timer.h" @@ -127,6 +128,6 @@ extern DECLSPEC void SDLCALL SDL_Quit(void); #endif #include "close_code.h" -#endif /* _SDL_H */ +#endif /* SDL_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_assert.h b/Engine/lib/sdl/include/SDL_assert.h index 402981f96..b38f928ae 100644 --- a/Engine/lib/sdl/include/SDL_assert.h +++ b/Engine/lib/sdl/include/SDL_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_assert_h -#define _SDL_assert_h +#ifndef SDL_assert_h_ +#define SDL_assert_h_ #include "SDL_config.h" @@ -51,9 +51,11 @@ assert can have unique static variables associated with it. /* Don't include intrin.h here because it contains C++ code */ extern void __cdecl __debugbreak(void); #define SDL_TriggerBreakpoint() __debugbreak() -#elif (!defined(__NACL__) && defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) +#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) ) #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" ) -#elif defined(HAVE_SIGNAL_H) +#elif defined(__386__) && defined(__WATCOMC__) + #define SDL_TriggerBreakpoint() { _asm { int 0x03 } } +#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__) #include #define SDL_TriggerBreakpoint() raise(SIGTRAP) #else @@ -63,7 +65,7 @@ assert can have unique static variables associated with it. #if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 supports __func__ as a standard. */ # define SDL_FUNCTION __func__ -#elif ((__GNUC__ >= 2) || defined(_MSC_VER)) +#elif ((__GNUC__ >= 2) || defined(_MSC_VER) || defined (__WATCOMC__)) # define SDL_FUNCTION __FUNCTION__ #else # define SDL_FUNCTION "???" @@ -201,7 +203,7 @@ typedef SDL_AssertState (SDLCALL *SDL_AssertionHandler)( * * This callback is NOT reset to SDL's internal handler upon SDL_Quit()! * - * \return SDL_AssertState value of how to handle the assertion failure. + * Return SDL_AssertState value of how to handle the assertion failure. * * \param handler Callback function, called when an assertion fails. * \param userdata A pointer passed to the callback as-is. @@ -250,7 +252,7 @@ extern DECLSPEC SDL_AssertionHandler SDLCALL SDL_GetAssertionHandler(void **puse * * const SDL_AssertData *item = SDL_GetAssertionReport(); * while (item) { - * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\n", + * printf("'%s', %s (%s:%d), triggered %u times, always ignore: %s.\\n", * item->condition, item->function, item->filename, * item->linenum, item->trigger_count, * item->always_ignore ? "yes" : "no"); @@ -284,6 +286,6 @@ extern DECLSPEC void SDLCALL SDL_ResetAssertionReport(void); #endif #include "close_code.h" -#endif /* _SDL_assert_h */ +#endif /* SDL_assert_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_atomic.h b/Engine/lib/sdl/include/SDL_atomic.h index 56aa81df9..b2287748c 100644 --- a/Engine/lib/sdl/include/SDL_atomic.h +++ b/Engine/lib/sdl/include/SDL_atomic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -56,8 +56,8 @@ * All of the atomic operations that modify memory are full memory barriers. */ -#ifndef _SDL_atomic_h_ -#define _SDL_atomic_h_ +#ifndef SDL_atomic_h_ +#define SDL_atomic_h_ #include "SDL_stdinc.h" #include "SDL_platform.h" @@ -118,13 +118,16 @@ extern DECLSPEC void SDLCALL SDL_AtomicUnlock(SDL_SpinLock *lock); * The compiler barrier prevents the compiler from reordering * reads and writes to globally visible variables across the call. */ -#if defined(_MSC_VER) && (_MSC_VER > 1200) +#if defined(_MSC_VER) && (_MSC_VER > 1200) && !defined(__clang__) void _ReadWriteBarrier(void); #pragma intrinsic(_ReadWriteBarrier) #define SDL_CompilerBarrier() _ReadWriteBarrier() #elif (defined(__GNUC__) && !defined(__EMSCRIPTEN__)) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x5120)) /* This is correct for all CPUs when using GCC or Solaris Studio 12.1+. */ #define SDL_CompilerBarrier() __asm__ __volatile__ ("" : : : "memory") +#elif defined(__WATCOMC__) +extern _inline void SDL_CompilerBarrier (void); +#pragma aux SDL_CompilerBarrier = "" parm [] modify exact []; #else #define SDL_CompilerBarrier() \ { SDL_SpinLock _tmp = 0; SDL_AtomicLock(&_tmp); SDL_AtomicUnlock(&_tmp); } @@ -149,18 +152,24 @@ void _ReadWriteBarrier(void); * For more information on these semantics, take a look at the blog post: * http://preshing.com/20120913/acquire-and-release-semantics */ +extern DECLSPEC void SDLCALL SDL_MemoryBarrierReleaseFunction(void); +extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquireFunction(void); + #if defined(__GNUC__) && (defined(__powerpc__) || defined(__ppc__)) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("lwsync" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("lwsync" : : : "memory") +#elif defined(__GNUC__) && defined(__aarch64__) +#define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") +#define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") #elif defined(__GNUC__) && defined(__arm__) #if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7EM__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("dmb ish" : : : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("dmb ish" : : : "memory") -#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) +#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_5TE__) #ifdef __thumb__ /* The mcr instruction isn't available in thumb mode, use real functions */ -extern DECLSPEC void SDLCALL SDL_MemoryBarrierRelease(); -extern DECLSPEC void SDLCALL SDL_MemoryBarrierAcquire(); +#define SDL_MemoryBarrierRelease() SDL_MemoryBarrierReleaseFunction() +#define SDL_MemoryBarrierAcquire() SDL_MemoryBarrierAcquireFunction() #else #define SDL_MemoryBarrierRelease() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") #define SDL_MemoryBarrierAcquire() __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r"(0) : "memory") @@ -263,6 +272,6 @@ extern DECLSPEC void* SDLCALL SDL_AtomicGetPtr(void **a); #include "close_code.h" -#endif /* _SDL_atomic_h_ */ +#endif /* SDL_atomic_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_audio.h b/Engine/lib/sdl/include/SDL_audio.h index d51f0d1ce..d6ea68954 100644 --- a/Engine/lib/sdl/include/SDL_audio.h +++ b/Engine/lib/sdl/include/SDL_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Access to the raw audio mixing buffer for the SDL library. */ -#ifndef _SDL_audio_h -#define _SDL_audio_h +#ifndef SDL_audio_h_ +#define SDL_audio_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -164,6 +164,15 @@ typedef void (SDLCALL * SDL_AudioCallback) (void *userdata, Uint8 * stream, /** * The calculated values in this structure are calculated by SDL_OpenAudio(). + * + * For multi-channel audio, the default SDL channel mapping is: + * 2: FL FR (stereo) + * 3: FL FR LFE (2.1 surround) + * 4: FL FR BL BR (quad) + * 5: FL FR FC BL BR (quad + center) + * 6: FL FR FC LFE SL SR (5.1 surround - last two can also be BL BR) + * 7: FL FR FC LFE BC SL SR (6.1 surround) + * 8: FL FR FC LFE BL BR SL SR (7.1 surround) */ typedef struct SDL_AudioSpec { @@ -171,7 +180,7 @@ typedef struct SDL_AudioSpec SDL_AudioFormat format; /**< Audio data format */ Uint8 channels; /**< Number of channels: 1 mono, 2 stereo */ Uint8 silence; /**< Audio buffer silence value (calculated) */ - Uint16 samples; /**< Audio buffer size in samples (power of 2) */ + Uint16 samples; /**< Audio buffer size in sample FRAMES (total samples divided by channel count) */ Uint16 padding; /**< Necessary for some compile environments */ Uint32 size; /**< Audio buffer size in bytes (calculated) */ SDL_AudioCallback callback; /**< Callback that feeds the audio device (NULL to use SDL_QueueAudio()). */ @@ -184,7 +193,23 @@ typedef void (SDLCALL * SDL_AudioFilter) (struct SDL_AudioCVT * cvt, SDL_AudioFormat format); /** - * A structure to hold a set of audio conversion filters and buffers. + * \brief Upper limit of filters in SDL_AudioCVT + * + * The maximum number of SDL_AudioFilter functions in SDL_AudioCVT is + * currently limited to 9. The SDL_AudioCVT.filters array has 10 pointers, + * one of which is the terminating NULL pointer. + */ +#define SDL_AUDIOCVT_MAX_FILTERS 9 + +/** + * \struct SDL_AudioCVT + * \brief A structure to hold a set of audio conversion filters and buffers. + * + * Note that various parts of the conversion pipeline can take advantage + * of SIMD operations (like SSE2, for example). SDL_AudioCVT doesn't require + * you to pass it aligned data, but can possibly run much faster if you + * set both its (buf) field to a pointer that is aligned to 16 bytes, and its + * (len) field to something that's a multiple of 16, if possible. */ #ifdef __GNUC__ /* This structure is 84 bytes on 32-bit architectures, make sure GCC doesn't @@ -208,7 +233,7 @@ typedef struct SDL_AudioCVT int len_cvt; /**< Length of converted audio buffer */ int len_mult; /**< buffer must be len*len_mult big */ double len_ratio; /**< Given len, final size is len*len_ratio */ - SDL_AudioFilter filters[10]; /**< Filter list */ + SDL_AudioFilter filters[SDL_AUDIOCVT_MAX_FILTERS + 1]; /**< NULL-terminated list of filter functions */ int filter_index; /**< Current audio conversion function */ } SDL_AUDIOCVT_PACKED SDL_AudioCVT; @@ -434,10 +459,10 @@ extern DECLSPEC void SDLCALL SDL_FreeWAV(Uint8 * audio_buf); * This function takes a source format and rate and a destination format * and rate, and initializes the \c cvt structure with information needed * by SDL_ConvertAudio() to convert a buffer of audio data from one format - * to the other. + * to the other. An unsupported format causes an error and -1 will be returned. * - * \return -1 if the format conversion is not supported, 0 if there's - * no conversion needed, or 1 if the audio filter is set up. + * \return 0 if no conversion is needed, 1 if the audio filter is set up, + * or -1 on error. */ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt, SDL_AudioFormat src_format, @@ -456,9 +481,137 @@ extern DECLSPEC int SDLCALL SDL_BuildAudioCVT(SDL_AudioCVT * cvt, * The data conversion may expand the size of the audio data, so the buffer * \c cvt->buf should be allocated after the \c cvt structure is initialized by * SDL_BuildAudioCVT(), and should be \c cvt->len*cvt->len_mult bytes long. + * + * \return 0 on success or -1 if \c cvt->buf is NULL. */ extern DECLSPEC int SDLCALL SDL_ConvertAudio(SDL_AudioCVT * cvt); +/* SDL_AudioStream is a new audio conversion interface. + The benefits vs SDL_AudioCVT: + - it can handle resampling data in chunks without generating + artifacts, when it doesn't have the complete buffer available. + - it can handle incoming data in any variable size. + - You push data as you have it, and pull it when you need it + */ +/* this is opaque to the outside world. */ +struct _SDL_AudioStream; +typedef struct _SDL_AudioStream SDL_AudioStream; + +/** + * Create a new audio stream + * + * \param src_format The format of the source audio + * \param src_channels The number of channels of the source audio + * \param src_rate The sampling rate of the source audio + * \param dst_format The format of the desired audio output + * \param dst_channels The number of channels of the desired audio output + * \param dst_rate The sampling rate of the desired audio output + * \return 0 on success, or -1 on error. + * + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC SDL_AudioStream * SDLCALL SDL_NewAudioStream(const SDL_AudioFormat src_format, + const Uint8 src_channels, + const int src_rate, + const SDL_AudioFormat dst_format, + const Uint8 dst_channels, + const int dst_rate); + +/** + * Add data to be converted/resampled to the stream + * + * \param stream The stream the audio data is being added to + * \param buf A pointer to the audio data to add + * \param len The number of bytes to write to the stream + * \return 0 on success, or -1 on error. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len); + +/** + * Get converted/resampled data from the stream + * + * \param stream The stream the audio is being requested from + * \param buf A buffer to fill with audio data + * \param len The maximum number of bytes to fill + * \return The number of bytes read from the stream, or -1 on error + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len); + +/** + * Get the number of converted/resampled bytes available. The stream may be + * buffering data behind the scenes until it has enough to resample + * correctly, so this number might be lower than what you expect, or even + * be zero. Add more data or flush the stream if you need the data now. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamAvailable(SDL_AudioStream *stream); + +/** + * Tell the stream that you're done sending data, and anything being buffered + * should be converted/resampled and made available immediately. + * + * It is legal to add more data to a stream after flushing, but there will + * be audio gaps in the output. Generally this is intended to signal the + * end of input, so the complete output becomes available. + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamClear + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC int SDLCALL SDL_AudioStreamFlush(SDL_AudioStream *stream); + +/** + * Clear any pending data in the stream without converting it + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_FreeAudioStream + */ +extern DECLSPEC void SDLCALL SDL_AudioStreamClear(SDL_AudioStream *stream); + +/** + * Free an audio stream + * + * \sa SDL_NewAudioStream + * \sa SDL_AudioStreamPut + * \sa SDL_AudioStreamGet + * \sa SDL_AudioStreamAvailable + * \sa SDL_AudioStreamFlush + * \sa SDL_AudioStreamClear + */ +extern DECLSPEC void SDLCALL SDL_FreeAudioStream(SDL_AudioStream *stream); + #define SDL_MIX_MAXVOLUME 128 /** * This takes two audio buffers of the playing audio format and mixes @@ -514,7 +667,7 @@ extern DECLSPEC void SDLCALL SDL_MixAudioFormat(Uint8 * dst, * \param dev The device ID to which we will queue audio. * \param data The data to queue to the device for later playback. * \param len The number of bytes (not samples!) to which (data) points. - * \return zero on success, -1 on error. + * \return 0 on success, or -1 on error. * * \sa SDL_GetQueuedAudioSize * \sa SDL_ClearQueuedAudio @@ -667,6 +820,6 @@ extern DECLSPEC void SDLCALL SDL_CloseAudioDevice(SDL_AudioDeviceID dev); #endif #include "close_code.h" -#endif /* _SDL_audio_h */ +#endif /* SDL_audio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_bits.h b/Engine/lib/sdl/include/SDL_bits.h index 528da2eac..eb8322f0d 100644 --- a/Engine/lib/sdl/include/SDL_bits.h +++ b/Engine/lib/sdl/include/SDL_bits.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Functions for fiddling with bits and bitmasks. */ -#ifndef _SDL_bits_h -#define _SDL_bits_h +#ifndef SDL_bits_h_ +#define SDL_bits_h_ #include "SDL_stdinc.h" @@ -47,10 +47,20 @@ extern "C" { * * \return Index of the most significant bit, or -1 if the value is 0. */ +#if defined(__WATCOMC__) && defined(__386__) +extern _inline int _SDL_clz_watcom (Uint32); +#pragma aux _SDL_clz_watcom = \ + "bsr eax, eax" \ + "xor eax, 31" \ + parm [eax] nomemory \ + value [eax] \ + modify exact [eax] nomemory; +#endif + SDL_FORCE_INLINE int SDL_MostSignificantBitIndex32(Uint32 x) { -#if defined(__GNUC__) && __GNUC__ >= 4 +#if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) /* Count Leading Zeroes builtin in GCC. * http://gcc.gnu.org/onlinedocs/gcc-4.3.4/gcc/Other-Builtins.html */ @@ -58,6 +68,11 @@ SDL_MostSignificantBitIndex32(Uint32 x) return -1; } return 31 - __builtin_clz(x); +#elif defined(__WATCOMC__) && defined(__386__) + if (x == 0) { + return -1; + } + return 31 - _SDL_clz_watcom(x); #else /* Based off of Bit Twiddling Hacks by Sean Eron Anderson * , released in the public domain. @@ -92,6 +107,6 @@ SDL_MostSignificantBitIndex32(Uint32 x) #endif #include "close_code.h" -#endif /* _SDL_bits_h */ +#endif /* SDL_bits_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_blendmode.h b/Engine/lib/sdl/include/SDL_blendmode.h index 56d8ad66e..36a5ea76f 100644 --- a/Engine/lib/sdl/include/SDL_blendmode.h +++ b/Engine/lib/sdl/include/SDL_blendmode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Header file declaring the SDL_BlendMode enumeration */ -#ifndef _SDL_blendmode_h -#define _SDL_blendmode_h +#ifndef SDL_blendmode_h_ +#define SDL_blendmode_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -47,17 +47,74 @@ typedef enum SDL_BLENDMODE_ADD = 0x00000002, /**< additive blending dstRGB = (srcRGB * srcA) + dstRGB dstA = dstA */ - SDL_BLENDMODE_MOD = 0x00000004 /**< color modulate + SDL_BLENDMODE_MOD = 0x00000004, /**< color modulate dstRGB = srcRGB * dstRGB dstA = dstA */ + SDL_BLENDMODE_INVALID = 0x7FFFFFFF + + /* Additional custom blend modes can be returned by SDL_ComposeCustomBlendMode() */ + } SDL_BlendMode; +/** + * \brief The blend operation used when combining source and destination pixel components + */ +typedef enum +{ + SDL_BLENDOPERATION_ADD = 0x1, /**< dst + src: supported by all renderers */ + SDL_BLENDOPERATION_SUBTRACT = 0x2, /**< dst - src : supported by D3D9, D3D11, OpenGL, OpenGLES */ + SDL_BLENDOPERATION_REV_SUBTRACT = 0x3, /**< src - dst : supported by D3D9, D3D11, OpenGL, OpenGLES */ + SDL_BLENDOPERATION_MINIMUM = 0x4, /**< min(dst, src) : supported by D3D11 */ + SDL_BLENDOPERATION_MAXIMUM = 0x5 /**< max(dst, src) : supported by D3D11 */ + +} SDL_BlendOperation; + +/** + * \brief The normalized factor used to multiply pixel components + */ +typedef enum +{ + SDL_BLENDFACTOR_ZERO = 0x1, /**< 0, 0, 0, 0 */ + SDL_BLENDFACTOR_ONE = 0x2, /**< 1, 1, 1, 1 */ + SDL_BLENDFACTOR_SRC_COLOR = 0x3, /**< srcR, srcG, srcB, srcA */ + SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR = 0x4, /**< 1-srcR, 1-srcG, 1-srcB, 1-srcA */ + SDL_BLENDFACTOR_SRC_ALPHA = 0x5, /**< srcA, srcA, srcA, srcA */ + SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA = 0x6, /**< 1-srcA, 1-srcA, 1-srcA, 1-srcA */ + SDL_BLENDFACTOR_DST_COLOR = 0x7, /**< dstR, dstG, dstB, dstA */ + SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR = 0x8, /**< 1-dstR, 1-dstG, 1-dstB, 1-dstA */ + SDL_BLENDFACTOR_DST_ALPHA = 0x9, /**< dstA, dstA, dstA, dstA */ + SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA = 0xA /**< 1-dstA, 1-dstA, 1-dstA, 1-dstA */ + +} SDL_BlendFactor; + +/** + * \brief Create a custom blend mode, which may or may not be supported by a given renderer + * + * \param srcColorFactor + * \param dstColorFactor + * \param colorOperation + * \param srcAlphaFactor + * \param dstAlphaFactor + * \param alphaOperation + * + * The result of the blend mode operation will be: + * dstRGB = dstRGB * dstColorFactor colorOperation srcRGB * srcColorFactor + * and + * dstA = dstA * dstAlphaFactor alphaOperation srcA * srcAlphaFactor + */ +extern DECLSPEC SDL_BlendMode SDLCALL SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor, + SDL_BlendFactor dstColorFactor, + SDL_BlendOperation colorOperation, + SDL_BlendFactor srcAlphaFactor, + SDL_BlendFactor dstAlphaFactor, + SDL_BlendOperation alphaOperation); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" -#endif /* _SDL_blendmode_h */ +#endif /* SDL_blendmode_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_clipboard.h b/Engine/lib/sdl/include/SDL_clipboard.h index a5556f21c..f28751ebb 100644 --- a/Engine/lib/sdl/include/SDL_clipboard.h +++ b/Engine/lib/sdl/include/SDL_clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL clipboard handling */ -#ifndef _SDL_clipboard_h -#define _SDL_clipboard_h +#ifndef SDL_clipboard_h_ +#define SDL_clipboard_h_ #include "SDL_stdinc.h" @@ -66,6 +66,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasClipboardText(void); #endif #include "close_code.h" -#endif /* _SDL_clipboard_h */ +#endif /* SDL_clipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_config.h b/Engine/lib/sdl/include/SDL_config.h index 4270c78bf..7e0340cdf 100644 --- a/Engine/lib/sdl/include/SDL_config.h +++ b/Engine/lib/sdl/include/SDL_config.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_h -#define _SDL_config_h +#ifndef SDL_config_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -29,9 +29,7 @@ */ /* Add any platform that doesn't build using the configure system. */ -#ifdef USING_PREMAKE_CONFIG_H -#include "SDL_config_premake.h" -#elif defined(__WIN32__) +#if defined(__WIN32__) #include "SDL_config_windows.h" #elif defined(__WINRT__) #include "SDL_config_winrt.h" @@ -52,4 +50,4 @@ #error Wrong SDL_config.h, check your include path? #endif -#endif /* _SDL_config_h */ +#endif /* SDL_config_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config.h.cmake b/Engine/lib/sdl/include/SDL_config.h.cmake index 98c62a994..a8d230c46 100644 --- a/Engine/lib/sdl/include/SDL_config.h.cmake +++ b/Engine/lib/sdl/include/SDL_config.h.cmake @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_h -#define _SDL_config_h +#ifndef SDL_config_h_ +#define SDL_config_h_ /** * \file SDL_config.h.in @@ -47,42 +47,32 @@ #cmakedefine HAVE_GCC_ATOMICS @HAVE_GCC_ATOMICS@ #cmakedefine HAVE_GCC_SYNC_LOCK_TEST_AND_SET @HAVE_GCC_SYNC_LOCK_TEST_AND_SET@ -#cmakedefine HAVE_D3D_H @HAVE_D3D_H@ -#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@ -#cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@ -#cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@ -#cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@ -#cmakedefine HAVE_XAUDIO2_H @HAVE_XAUDIO2_H@ -#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@ -#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@ - /* Comment this if you want to build without any C library requirements */ #cmakedefine HAVE_LIBC 1 #if HAVE_LIBC /* Useful headers */ -#cmakedefine HAVE_ALLOCA_H 1 -#cmakedefine HAVE_SYS_TYPES_H 1 -#cmakedefine HAVE_STDIO_H 1 #cmakedefine STDC_HEADERS 1 -#cmakedefine HAVE_STDLIB_H 1 -#cmakedefine HAVE_STDARG_H 1 -#cmakedefine HAVE_MALLOC_H 1 -#cmakedefine HAVE_MEMORY_H 1 -#cmakedefine HAVE_STRING_H 1 -#cmakedefine HAVE_STRINGS_H 1 -#cmakedefine HAVE_INTTYPES_H 1 -#cmakedefine HAVE_STDINT_H 1 +#cmakedefine HAVE_ALLOCA_H 1 #cmakedefine HAVE_CTYPE_H 1 -#cmakedefine HAVE_MATH_H 1 +#cmakedefine HAVE_FLOAT_H 1 #cmakedefine HAVE_ICONV_H 1 +#cmakedefine HAVE_INTTYPES_H 1 +#cmakedefine HAVE_LIMITS_H 1 +#cmakedefine HAVE_MALLOC_H 1 +#cmakedefine HAVE_MATH_H 1 +#cmakedefine HAVE_MEMORY_H 1 #cmakedefine HAVE_SIGNAL_H 1 -#cmakedefine HAVE_ALTIVEC_H 1 +#cmakedefine HAVE_STDARG_H 1 +#cmakedefine HAVE_STDINT_H 1 +#cmakedefine HAVE_STDIO_H 1 +#cmakedefine HAVE_STDLIB_H 1 +#cmakedefine HAVE_STRINGS_H 1 +#cmakedefine HAVE_STRING_H 1 +#cmakedefine HAVE_SYS_TYPES_H 1 +#cmakedefine HAVE_WCHAR_H 1 #cmakedefine HAVE_PTHREAD_NP_H 1 -#cmakedefine HAVE_LIBUDEV_H 1 -#cmakedefine HAVE_DBUS_DBUS_H 1 -#cmakedefine HAVE_IBUS_IBUS_H 1 -#cmakedefine HAVE_FCITX_FRONTEND_H 1 +#cmakedefine HAVE_LIBUNWIND_H 1 /* C library functions */ #cmakedefine HAVE_MALLOC 1 @@ -103,10 +93,13 @@ #cmakedefine HAVE_MEMCPY 1 #cmakedefine HAVE_MEMMOVE 1 #cmakedefine HAVE_MEMCMP 1 +#cmakedefine HAVE_WCSLEN 1 +#cmakedefine HAVE_WCSLCPY 1 +#cmakedefine HAVE_WCSLCAT 1 +#cmakedefine HAVE_WCSCMP 1 #cmakedefine HAVE_STRLEN 1 #cmakedefine HAVE_STRLCPY 1 #cmakedefine HAVE_STRLCAT 1 -#cmakedefine HAVE_STRDUP 1 #cmakedefine HAVE__STRREV 1 #cmakedefine HAVE__STRUPR 1 #cmakedefine HAVE__STRLWR 1 @@ -137,25 +130,41 @@ #cmakedefine HAVE_VSSCANF 1 #cmakedefine HAVE_VSNPRINTF 1 #cmakedefine HAVE_M_PI 1 -#cmakedefine HAVE_ATAN 1 -#cmakedefine HAVE_ATAN2 1 #cmakedefine HAVE_ACOS 1 +#cmakedefine HAVE_ACOSF 1 #cmakedefine HAVE_ASIN 1 +#cmakedefine HAVE_ASINF 1 +#cmakedefine HAVE_ATAN 1 +#cmakedefine HAVE_ATANF 1 +#cmakedefine HAVE_ATAN2 1 +#cmakedefine HAVE_ATAN2F 1 #cmakedefine HAVE_CEIL 1 +#cmakedefine HAVE_CEILF 1 #cmakedefine HAVE_COPYSIGN 1 +#cmakedefine HAVE_COPYSIGNF 1 #cmakedefine HAVE_COS 1 #cmakedefine HAVE_COSF 1 #cmakedefine HAVE_FABS 1 +#cmakedefine HAVE_FABSF 1 #cmakedefine HAVE_FLOOR 1 +#cmakedefine HAVE_FLOORF 1 +#cmakedefine HAVE_FMOD 1 +#cmakedefine HAVE_FMODF 1 #cmakedefine HAVE_LOG 1 +#cmakedefine HAVE_LOGF 1 +#cmakedefine HAVE_LOG10 1 +#cmakedefine HAVE_LOG10F 1 #cmakedefine HAVE_POW 1 +#cmakedefine HAVE_POWF 1 #cmakedefine HAVE_SCALBN 1 +#cmakedefine HAVE_SCALBNF 1 #cmakedefine HAVE_SIN 1 #cmakedefine HAVE_SINF 1 #cmakedefine HAVE_SQRT 1 #cmakedefine HAVE_SQRTF 1 #cmakedefine HAVE_TAN 1 #cmakedefine HAVE_TANF 1 +#cmakedefine HAVE_FOPEN64 1 #cmakedefine HAVE_FSEEKO 1 #cmakedefine HAVE_FSEEKO64 1 #cmakedefine HAVE_SIGACTION 1 @@ -171,14 +180,36 @@ #cmakedefine HAVE_PTHREAD_SETNAME_NP 1 #cmakedefine HAVE_PTHREAD_SET_NAME_NP 1 #cmakedefine HAVE_SEM_TIMEDWAIT 1 +#cmakedefine HAVE_GETAUXVAL 1 +#cmakedefine HAVE_POLL 1 + #elif __WIN32__ #cmakedefine HAVE_STDARG_H 1 #cmakedefine HAVE_STDDEF_H 1 +#cmakedefine HAVE_FLOAT_H 1 #else /* We may need some replacement for stdarg.h here */ #include #endif /* HAVE_LIBC */ +#cmakedefine HAVE_ALTIVEC_H 1 +#cmakedefine HAVE_DBUS_DBUS_H 1 +#cmakedefine HAVE_FCITX_FRONTEND_H 1 +#cmakedefine HAVE_IBUS_IBUS_H 1 +#cmakedefine HAVE_IMMINTRIN_H 1 +#cmakedefine HAVE_LIBSAMPLERATE_H 1 +#cmakedefine HAVE_LIBUDEV_H 1 + +#cmakedefine HAVE_D3D_H @HAVE_D3D_H@ +#cmakedefine HAVE_D3D11_H @HAVE_D3D11_H@ +#cmakedefine HAVE_DDRAW_H @HAVE_DDRAW_H@ +#cmakedefine HAVE_DSOUND_H @HAVE_DSOUND_H@ +#cmakedefine HAVE_DINPUT_H @HAVE_DINPUT_H@ +#cmakedefine HAVE_XINPUT_H @HAVE_XINPUT_H@ +#cmakedefine HAVE_DXGI_H @HAVE_DXGI_H@ +#cmakedefine HAVE_XINPUT_GAMEPAD_EX @HAVE_XINPUT_GAMEPAD_EX@ +#cmakedefine HAVE_XINPUT_STATE_EX @HAVE_XINPUT_STATE_EX@ + /* SDL internal assertion support */ #cmakedefine SDL_DEFAULT_ASSERT_LEVEL @SDL_DEFAULT_ASSERT_LEVEL@ @@ -199,35 +230,37 @@ #cmakedefine SDL_FILESYSTEM_DISABLED @SDL_FILESYSTEM_DISABLED@ /* Enable various audio drivers */ -#cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@ #cmakedefine SDL_AUDIO_DRIVER_ALSA @SDL_AUDIO_DRIVER_ALSA@ #cmakedefine SDL_AUDIO_DRIVER_ALSA_DYNAMIC @SDL_AUDIO_DRIVER_ALSA_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_ANDROID @SDL_AUDIO_DRIVER_ANDROID@ #cmakedefine SDL_AUDIO_DRIVER_ARTS @SDL_AUDIO_DRIVER_ARTS@ #cmakedefine SDL_AUDIO_DRIVER_ARTS_DYNAMIC @SDL_AUDIO_DRIVER_ARTS_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@ -#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@ -#cmakedefine SDL_AUDIO_DRIVER_BSD @SDL_AUDIO_DRIVER_BSD@ #cmakedefine SDL_AUDIO_DRIVER_COREAUDIO @SDL_AUDIO_DRIVER_COREAUDIO@ #cmakedefine SDL_AUDIO_DRIVER_DISK @SDL_AUDIO_DRIVER_DISK@ -#cmakedefine SDL_AUDIO_DRIVER_DUMMY @SDL_AUDIO_DRIVER_DUMMY@ -#cmakedefine SDL_AUDIO_DRIVER_XAUDIO2 @SDL_AUDIO_DRIVER_XAUDIO2@ #cmakedefine SDL_AUDIO_DRIVER_DSOUND @SDL_AUDIO_DRIVER_DSOUND@ +#cmakedefine SDL_AUDIO_DRIVER_DUMMY @SDL_AUDIO_DRIVER_DUMMY@ +#cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@ #cmakedefine SDL_AUDIO_DRIVER_ESD @SDL_AUDIO_DRIVER_ESD@ #cmakedefine SDL_AUDIO_DRIVER_ESD_DYNAMIC @SDL_AUDIO_DRIVER_ESD_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@ +#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_HAIKU @SDL_AUDIO_DRIVER_HAIKU@ +#cmakedefine SDL_AUDIO_DRIVER_JACK @SDL_AUDIO_DRIVER_JACK@ +#cmakedefine SDL_AUDIO_DRIVER_JACK_DYNAMIC @SDL_AUDIO_DRIVER_JACK_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_NAS @SDL_AUDIO_DRIVER_NAS@ #cmakedefine SDL_AUDIO_DRIVER_NAS_DYNAMIC @SDL_AUDIO_DRIVER_NAS_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@ -#cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@ +#cmakedefine SDL_AUDIO_DRIVER_NETBSD @SDL_AUDIO_DRIVER_NETBSD@ #cmakedefine SDL_AUDIO_DRIVER_OSS @SDL_AUDIO_DRIVER_OSS@ #cmakedefine SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H @SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H@ #cmakedefine SDL_AUDIO_DRIVER_PAUDIO @SDL_AUDIO_DRIVER_PAUDIO@ +#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO @SDL_AUDIO_DRIVER_PULSEAUDIO@ +#cmakedefine SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC @SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_QSA @SDL_AUDIO_DRIVER_QSA@ +#cmakedefine SDL_AUDIO_DRIVER_SNDIO @SDL_AUDIO_DRIVER_SNDIO@ +#cmakedefine SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @SDL_AUDIO_DRIVER_SNDIO_DYNAMIC@ #cmakedefine SDL_AUDIO_DRIVER_SUNAUDIO @SDL_AUDIO_DRIVER_SUNAUDIO@ +#cmakedefine SDL_AUDIO_DRIVER_WASAPI @SDL_AUDIO_DRIVER_WASAPI@ #cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@ -#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND @SDL_AUDIO_DRIVER_FUSIONSOUND@ -#cmakedefine SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC @SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC@ -#cmakedefine SDL_AUDIO_DRIVER_EMSCRIPTEN @SDL_AUDIO_DRIVER_EMSCRIPTEN@ /* Enable various input drivers */ #cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@ @@ -250,9 +283,9 @@ #cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@ #cmakedefine SDL_HAPTIC_DINPUT @SDL_HAPTIC_DINPUT@ #cmakedefine SDL_HAPTIC_XINPUT @SDL_HAPTIC_XINPUT@ +#cmakedefine SDL_HAPTIC_ANDROID @SDL_HAPTIC_ANDROID@ /* Enable various shared object loading systems */ -#cmakedefine SDL_LOADSO_HAIKU @SDL_LOADSO_HAIKU@ #cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@ #cmakedefine SDL_LOADSO_DUMMY @SDL_LOADSO_DUMMY@ #cmakedefine SDL_LOADSO_LDG @SDL_LOADSO_LDG@ @@ -284,6 +317,10 @@ #cmakedefine SDL_VIDEO_DRIVER_VIVANTE @SDL_VIDEO_DRIVER_VIVANTE@ #cmakedefine SDL_VIDEO_DRIVER_VIVANTE_VDK @SDL_VIDEO_DRIVER_VIVANTE_VDK@ +#cmakedefine SDL_VIDEO_DRIVER_KMSDRM @SDL_VIDEO_DRIVER_KMSDRM@ +#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC@ +#cmakedefine SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM @SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM@ + #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH@ #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC@ #cmakedefine SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL @SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC_EGL@ @@ -322,6 +359,7 @@ #cmakedefine SDL_VIDEO_RENDER_OGL_ES @SDL_VIDEO_RENDER_OGL_ES@ #cmakedefine SDL_VIDEO_RENDER_OGL_ES2 @SDL_VIDEO_RENDER_OGL_ES2@ #cmakedefine SDL_VIDEO_RENDER_DIRECTFB @SDL_VIDEO_RENDER_DIRECTFB@ +#cmakedefine SDL_VIDEO_RENDER_METAL @SDL_VIDEO_RENDER_METAL@ /* Enable OpenGL support */ #cmakedefine SDL_VIDEO_OPENGL @SDL_VIDEO_OPENGL@ @@ -335,6 +373,9 @@ #cmakedefine SDL_VIDEO_OPENGL_OSMESA @SDL_VIDEO_OPENGL_OSMESA@ #cmakedefine SDL_VIDEO_OPENGL_OSMESA_DYNAMIC @SDL_VIDEO_OPENGL_OSMESA_DYNAMIC@ +/* Enable Vulkan support */ +#cmakedefine SDL_VIDEO_VULKAN @SDL_VIDEO_VULKAN@ + /* Enable system power support */ #cmakedefine SDL_POWER_ANDROID @SDL_POWER_ANDROID@ #cmakedefine SDL_POWER_LINUX @SDL_POWER_LINUX@ @@ -357,6 +398,8 @@ #cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@ #cmakedefine SDL_ALTIVEC_BLITTERS @SDL_ALTIVEC_BLITTERS@ +/* Enable dynamic libsamplerate support */ +#cmakedefine SDL_LIBSAMPLERATE_DYNAMIC @SDL_LIBSAMPLERATE_DYNAMIC@ /* Platform specific definitions */ #if !defined(__WIN32__) @@ -418,4 +461,4 @@ typedef unsigned int uintptr_t; # endif /* !_STDINT_H_ && !HAVE_STDINT_H */ #endif /* __WIN32__ */ -#endif /* _SDL_config_h */ +#endif /* SDL_config_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config.h.in b/Engine/lib/sdl/include/SDL_config.h.in index d610cd6ba..422f47f78 100644 --- a/Engine/lib/sdl/include/SDL_config.h.in +++ b/Engine/lib/sdl/include/SDL_config.h.in @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_h -#define _SDL_config_h +#ifndef SDL_config_h_ +#define SDL_config_h_ /** * \file SDL_config.h.in @@ -50,39 +50,32 @@ #undef HAVE_GCC_ATOMICS #undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET -#undef HAVE_DDRAW_H -#undef HAVE_DINPUT_H -#undef HAVE_DSOUND_H -#undef HAVE_DXGI_H -#undef HAVE_XINPUT_H - /* Comment this if you want to build without any C library requirements */ #undef HAVE_LIBC #if HAVE_LIBC /* Useful headers */ -#undef HAVE_ALLOCA_H -#undef HAVE_SYS_TYPES_H -#undef HAVE_STDIO_H #undef STDC_HEADERS -#undef HAVE_STDLIB_H -#undef HAVE_STDARG_H -#undef HAVE_MALLOC_H -#undef HAVE_MEMORY_H -#undef HAVE_STRING_H -#undef HAVE_STRINGS_H -#undef HAVE_INTTYPES_H -#undef HAVE_STDINT_H +#undef HAVE_ALLOCA_H #undef HAVE_CTYPE_H -#undef HAVE_MATH_H +#undef HAVE_FLOAT_H #undef HAVE_ICONV_H +#undef HAVE_INTTYPES_H +#undef HAVE_LIMITS_H +#undef HAVE_MALLOC_H +#undef HAVE_MATH_H +#undef HAVE_MEMORY_H #undef HAVE_SIGNAL_H -#undef HAVE_ALTIVEC_H +#undef HAVE_STDARG_H +#undef HAVE_STDINT_H +#undef HAVE_STDIO_H +#undef HAVE_STDLIB_H +#undef HAVE_STRINGS_H +#undef HAVE_STRING_H +#undef HAVE_SYS_TYPES_H +#undef HAVE_WCHAR_H #undef HAVE_PTHREAD_NP_H -#undef HAVE_LIBUDEV_H -#undef HAVE_DBUS_DBUS_H -#undef HAVE_IBUS_IBUS_H -#undef HAVE_FCITX_FRONTEND_H +#undef HAVE_LIBUNWIND_H /* C library functions */ #undef HAVE_MALLOC @@ -103,10 +96,13 @@ #undef HAVE_MEMCPY #undef HAVE_MEMMOVE #undef HAVE_MEMCMP +#undef HAVE_WCSLEN +#undef HAVE_WCSLCPY +#undef HAVE_WCSLCAT +#undef HAVE_WCSCMP #undef HAVE_STRLEN #undef HAVE_STRLCPY #undef HAVE_STRLCAT -#undef HAVE_STRDUP #undef HAVE__STRREV #undef HAVE__STRUPR #undef HAVE__STRLWR @@ -139,25 +135,41 @@ #undef HAVE_SNPRINTF #undef HAVE_VSNPRINTF #undef HAVE_M_PI -#undef HAVE_ATAN -#undef HAVE_ATAN2 #undef HAVE_ACOS +#undef HAVE_ACOSF #undef HAVE_ASIN +#undef HAVE_ASINF +#undef HAVE_ATAN +#undef HAVE_ATANF +#undef HAVE_ATAN2 +#undef HAVE_ATAN2F #undef HAVE_CEIL +#undef HAVE_CEILF #undef HAVE_COPYSIGN +#undef HAVE_COPYSIGNF #undef HAVE_COS #undef HAVE_COSF #undef HAVE_FABS +#undef HAVE_FABSF #undef HAVE_FLOOR +#undef HAVE_FLOORF +#undef HAVE_FMOD +#undef HAVE_FMODF #undef HAVE_LOG +#undef HAVE_LOGF +#undef HAVE_LOG10 +#undef HAVE_LOG10F #undef HAVE_POW +#undef HAVE_POWF #undef HAVE_SCALBN +#undef HAVE_SCALBNF #undef HAVE_SIN #undef HAVE_SINF #undef HAVE_SQRT #undef HAVE_SQRTF #undef HAVE_TAN #undef HAVE_TANF +#undef HAVE_FOPEN64 #undef HAVE_FSEEKO #undef HAVE_FSEEKO64 #undef HAVE_SIGACTION @@ -173,6 +185,8 @@ #undef HAVE_PTHREAD_SETNAME_NP #undef HAVE_PTHREAD_SET_NAME_NP #undef HAVE_SEM_TIMEDWAIT +#undef HAVE_GETAUXVAL +#undef HAVE_POLL #else #define HAVE_STDARG_H 1 @@ -180,6 +194,22 @@ #define HAVE_STDINT_H 1 #endif /* HAVE_LIBC */ +#undef HAVE_ALTIVEC_H +#undef HAVE_DBUS_DBUS_H +#undef HAVE_FCITX_FRONTEND_H +#undef HAVE_IBUS_IBUS_H +#undef HAVE_IMMINTRIN_H +#undef HAVE_LIBSAMPLERATE_H +#undef HAVE_LIBUDEV_H + +#undef HAVE_DDRAW_H +#undef HAVE_DINPUT_H +#undef HAVE_DSOUND_H +#undef HAVE_DXGI_H +#undef HAVE_XINPUT_H +#undef HAVE_XINPUT_GAMEPAD_EX +#undef HAVE_XINPUT_STATE_EX + /* SDL internal assertion support */ #undef SDL_DEFAULT_ASSERT_LEVEL @@ -202,34 +232,36 @@ /* Enable various audio drivers */ #undef SDL_AUDIO_DRIVER_ALSA #undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC +#undef SDL_AUDIO_DRIVER_ANDROID #undef SDL_AUDIO_DRIVER_ARTS #undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC -#undef SDL_AUDIO_DRIVER_PULSEAUDIO -#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC -#undef SDL_AUDIO_DRIVER_HAIKU -#undef SDL_AUDIO_DRIVER_BSD #undef SDL_AUDIO_DRIVER_COREAUDIO #undef SDL_AUDIO_DRIVER_DISK -#undef SDL_AUDIO_DRIVER_DUMMY -#undef SDL_AUDIO_DRIVER_ANDROID -#undef SDL_AUDIO_DRIVER_XAUDIO2 #undef SDL_AUDIO_DRIVER_DSOUND +#undef SDL_AUDIO_DRIVER_DUMMY +#undef SDL_AUDIO_DRIVER_EMSCRIPTEN #undef SDL_AUDIO_DRIVER_ESD #undef SDL_AUDIO_DRIVER_ESD_DYNAMIC +#undef SDL_AUDIO_DRIVER_FUSIONSOUND +#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC +#undef SDL_AUDIO_DRIVER_HAIKU +#undef SDL_AUDIO_DRIVER_JACK +#undef SDL_AUDIO_DRIVER_JACK_DYNAMIC #undef SDL_AUDIO_DRIVER_NACL #undef SDL_AUDIO_DRIVER_NAS #undef SDL_AUDIO_DRIVER_NAS_DYNAMIC -#undef SDL_AUDIO_DRIVER_SNDIO -#undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC +#undef SDL_AUDIO_DRIVER_NETBSD #undef SDL_AUDIO_DRIVER_OSS #undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H #undef SDL_AUDIO_DRIVER_PAUDIO +#undef SDL_AUDIO_DRIVER_PULSEAUDIO +#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC #undef SDL_AUDIO_DRIVER_QSA +#undef SDL_AUDIO_DRIVER_SNDIO +#undef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC #undef SDL_AUDIO_DRIVER_SUNAUDIO +#undef SDL_AUDIO_DRIVER_WASAPI #undef SDL_AUDIO_DRIVER_WINMM -#undef SDL_AUDIO_DRIVER_FUSIONSOUND -#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC -#undef SDL_AUDIO_DRIVER_EMSCRIPTEN /* Enable various input drivers */ #undef SDL_INPUT_LINUXEV @@ -247,13 +279,13 @@ #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H #undef SDL_JOYSTICK_EMSCRIPTEN #undef SDL_HAPTIC_DUMMY +#undef SDL_HAPTIC_ANDROID #undef SDL_HAPTIC_LINUX #undef SDL_HAPTIC_IOKIT #undef SDL_HAPTIC_DINPUT #undef SDL_HAPTIC_XINPUT /* Enable various shared object loading systems */ -#undef SDL_LOADSO_HAIKU #undef SDL_LOADSO_DLOPEN #undef SDL_LOADSO_DUMMY #undef SDL_LOADSO_LDG @@ -289,6 +321,9 @@ #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON #undef SDL_VIDEO_DRIVER_X11 #undef SDL_VIDEO_DRIVER_RPI +#undef SDL_VIDEO_DRIVER_KMSDRM +#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC +#undef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM #undef SDL_VIDEO_DRIVER_ANDROID #undef SDL_VIDEO_DRIVER_EMSCRIPTEN #undef SDL_VIDEO_DRIVER_X11_DYNAMIC @@ -314,6 +349,7 @@ #undef SDL_VIDEO_DRIVER_NACL #undef SDL_VIDEO_DRIVER_VIVANTE #undef SDL_VIDEO_DRIVER_VIVANTE_VDK +#undef SDL_VIDEO_DRIVER_QNX #undef SDL_VIDEO_RENDER_D3D #undef SDL_VIDEO_RENDER_D3D11 @@ -321,6 +357,7 @@ #undef SDL_VIDEO_RENDER_OGL_ES #undef SDL_VIDEO_RENDER_OGL_ES2 #undef SDL_VIDEO_RENDER_DIRECTFB +#undef SDL_VIDEO_RENDER_METAL /* Enable OpenGL support */ #undef SDL_VIDEO_OPENGL @@ -334,6 +371,9 @@ #undef SDL_VIDEO_OPENGL_OSMESA #undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC +/* Enable Vulkan support */ +#undef SDL_VIDEO_VULKAN + /* Enable system power support */ #undef SDL_POWER_LINUX #undef SDL_POWER_WINDOWS @@ -360,4 +400,10 @@ /* Enable ime support */ #undef SDL_USE_IME -#endif /* _SDL_config_h */ +/* Enable dynamic udev support */ +#undef SDL_UDEV_DYNAMIC + +/* Enable dynamic libsamplerate support */ +#undef SDL_LIBSAMPLERATE_DYNAMIC + +#endif /* SDL_config_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config_android.h b/Engine/lib/sdl/include/SDL_config_android.h index 996cf76c9..4c4da37ec 100644 --- a/Engine/lib/sdl/include/SDL_config_android.h +++ b/Engine/lib/sdl/include/SDL_config_android.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_android_h -#define _SDL_config_android_h +#ifndef SDL_config_android_h_ +#define SDL_config_android_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -34,16 +35,17 @@ #define HAVE_GCC_ATOMICS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 #define HAVE_MATH_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 /* C library functions */ #define HAVE_MALLOC 1 @@ -66,7 +68,6 @@ #define HAVE_STRLEN 1 #define HAVE_STRLCPY 1 #define HAVE_STRLCAT 1 -#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -83,20 +84,34 @@ #define HAVE_STRNCASECMP 1 #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 -#define HAVE_M_PI 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 #define HAVE_ATAN 1 +#define HAVE_ATANF 1 #define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 +#define HAVE_ATAN2F 1 #define HAVE_CEIL 1 +#define HAVE_CEILF 1 #define HAVE_COPYSIGN 1 +#define HAVE_COPYSIGNF 1 #define HAVE_COS 1 #define HAVE_COSF 1 #define HAVE_FABS 1 +#define HAVE_FABSF 1 #define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 #define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 #define HAVE_POW 1 +#define HAVE_POWF 1 #define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 #define HAVE_SIN 1 #define HAVE_SINF 1 #define HAVE_SQRT 1 @@ -107,7 +122,7 @@ #define HAVE_SETJMP 1 #define HAVE_NANOSLEEP 1 #define HAVE_SYSCONF 1 -#define HAVE_CLOCK_GETTIME 1 +#define HAVE_CLOCK_GETTIME 1 #define SIZEOF_VOIDP 4 @@ -117,7 +132,7 @@ /* Enable various input drivers */ #define SDL_JOYSTICK_ANDROID 1 -#define SDL_HAPTIC_DUMMY 1 +#define SDL_HAPTIC_ANDROID 1 /* Enable various shared object loading systems */ #define SDL_LOADSO_DLOPEN 1 @@ -139,10 +154,18 @@ #define SDL_VIDEO_RENDER_OGL_ES 1 #define SDL_VIDEO_RENDER_OGL_ES2 1 +/* Enable Vulkan support */ +/* Android does not support Vulkan in native code using the "armeabi" ABI. */ +#if defined(__ARM_ARCH) && __ARM_ARCH < 7 +#define SDL_VIDEO_VULKAN 0 +#else +#define SDL_VIDEO_VULKAN 1 +#endif + /* Enable system power support */ #define SDL_POWER_ANDROID 1 /* Enable the filesystem driver */ #define SDL_FILESYSTEM_ANDROID 1 -#endif /* _SDL_config_android_h */ +#endif /* SDL_config_android_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config_iphoneos.h b/Engine/lib/sdl/include/SDL_config_iphoneos.h index 470985f80..7b0a6ca2d 100644 --- a/Engine/lib/sdl/include/SDL_config_iphoneos.h +++ b/Engine/lib/sdl/include/SDL_config_iphoneos.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_iphoneos_h -#define _SDL_config_iphoneos_h +#ifndef SDL_config_iphoneos_h_ +#define SDL_config_iphoneos_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -32,16 +33,19 @@ #define HAVE_GCC_ATOMICS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 #define HAVE_MATH_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 +/* The libunwind functions are only available on x86 */ +/* #undef HAVE_LIBUNWIND_H */ /* C library functions */ #define HAVE_MALLOC 1 @@ -64,7 +68,6 @@ #define HAVE_STRLEN 1 #define HAVE_STRLCPY 1 #define HAVE_STRLCAT 1 -#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -82,19 +85,34 @@ #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 #define HAVE_M_PI 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 #define HAVE_ATAN 1 +#define HAVE_ATANF 1 #define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 +#define HAVE_ATAN2F 1 #define HAVE_CEIL 1 +#define HAVE_CEILF 1 #define HAVE_COPYSIGN 1 +#define HAVE_COPYSIGNF 1 #define HAVE_COS 1 #define HAVE_COSF 1 #define HAVE_FABS 1 +#define HAVE_FABSF 1 #define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 #define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 #define HAVE_POW 1 +#define HAVE_POWF 1 #define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 #define HAVE_SIN 1 #define HAVE_SINF 1 #define HAVE_SQRT 1 @@ -132,12 +150,27 @@ #define SDL_VIDEO_DRIVER_UIKIT 1 #define SDL_VIDEO_DRIVER_DUMMY 1 -/* enable OpenGL ES */ +/* Enable OpenGL ES */ #define SDL_VIDEO_OPENGL_ES2 1 #define SDL_VIDEO_OPENGL_ES 1 #define SDL_VIDEO_RENDER_OGL_ES 1 #define SDL_VIDEO_RENDER_OGL_ES2 1 +/* Metal supported on 64-bit devices running iOS 8.0 and tvOS 9.0 and newer */ +#if !TARGET_OS_SIMULATOR && !TARGET_CPU_ARM && ((__IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (__TV_OS_VERSION_MIN_REQUIRED >= 90000)) +#define SDL_PLATFORM_SUPPORTS_METAL 1 +#else +#define SDL_PLATFORM_SUPPORTS_METAL 0 +#endif + +#if SDL_PLATFORM_SUPPORTS_METAL +#define SDL_VIDEO_RENDER_METAL 1 +#endif + +#if SDL_PLATFORM_SUPPORTS_METAL +#define SDL_VIDEO_VULKAN 1 +#endif + /* Enable system power support */ #define SDL_POWER_UIKIT 1 @@ -155,4 +188,4 @@ /* enable filesystem support */ #define SDL_FILESYSTEM_COCOA 1 -#endif /* _SDL_config_iphoneos_h */ +#endif /* SDL_config_iphoneos_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config_macosx.h b/Engine/lib/sdl/include/SDL_config_macosx.h index 5c8b7e033..29f583e10 100644 --- a/Engine/lib/sdl/include/SDL_config_macosx.h +++ b/Engine/lib/sdl/include/SDL_config_macosx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_macosx_h -#define _SDL_config_macosx_h +#ifndef SDL_config_macosx_h_ +#define SDL_config_macosx_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -36,16 +37,19 @@ #endif /* Useful headers */ -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 #define HAVE_MATH_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 +#define HAVE_LIBUNWIND_H 1 /* C library functions */ #define HAVE_MALLOC 1 @@ -67,7 +71,6 @@ #define HAVE_STRLEN 1 #define HAVE_STRLCPY 1 #define HAVE_STRLCAT 1 -#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -84,15 +87,35 @@ #define HAVE_STRNCASECMP 1 #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 +#define HAVE_M_PI 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 +#define HAVE_ATAN 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2 1 +#define HAVE_ATAN2F 1 #define HAVE_CEIL 1 +#define HAVE_CEILF 1 #define HAVE_COPYSIGN 1 +#define HAVE_COPYSIGNF 1 #define HAVE_COS 1 #define HAVE_COSF 1 #define HAVE_FABS 1 +#define HAVE_FABSF 1 #define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 #define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 #define HAVE_POW 1 +#define HAVE_POWF 1 #define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 #define HAVE_SIN 1 #define HAVE_SINF 1 #define HAVE_SQRT 1 @@ -104,10 +127,6 @@ #define HAVE_NANOSLEEP 1 #define HAVE_SYSCONF 1 #define HAVE_SYSCTLBYNAME 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 /* Enable various audio drivers */ #define SDL_AUDIO_DRIVER_COREAUDIO 1 @@ -162,10 +181,29 @@ #define SDL_VIDEO_RENDER_OGL 1 #endif +#ifndef SDL_VIDEO_RENDER_OGL_ES2 +#define SDL_VIDEO_RENDER_OGL_ES2 1 +#endif + +#ifndef SDL_VIDEO_RENDER_METAL +/* Metal only supported on 64-bit architectures with 10.11+ */ +#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100) +#define SDL_VIDEO_RENDER_METAL 1 +#else +#define SDL_VIDEO_RENDER_METAL 0 +#endif +#endif + /* Enable OpenGL support */ #ifndef SDL_VIDEO_OPENGL #define SDL_VIDEO_OPENGL 1 #endif +#ifndef SDL_VIDEO_OPENGL_ES2 +#define SDL_VIDEO_OPENGL_ES2 1 +#endif +#ifndef SDL_VIDEO_OPENGL_EGL +#define SDL_VIDEO_OPENGL_EGL 1 +#endif #ifndef SDL_VIDEO_OPENGL_CGL #define SDL_VIDEO_OPENGL_CGL 1 #endif @@ -173,6 +211,14 @@ #define SDL_VIDEO_OPENGL_GLX 1 #endif +/* Enable Vulkan support */ +/* Metal/MoltenVK/Vulkan only supported on 64-bit architectures with 10.11+ */ +#if TARGET_CPU_X86_64 && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101100) +#define SDL_VIDEO_VULKAN 1 +#else +#define SDL_VIDEO_VULKAN 0 +#endif + /* Enable system power support */ #define SDL_POWER_MACOSX 1 @@ -185,4 +231,4 @@ #define SDL_ALTIVEC_BLITTERS 1 #endif -#endif /* _SDL_config_macosx_h */ +#endif /* SDL_config_macosx_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config_minimal.h b/Engine/lib/sdl/include/SDL_config_minimal.h index 3c9d09afc..5b03d8b69 100644 --- a/Engine/lib/sdl/include/SDL_config_minimal.h +++ b/Engine/lib/sdl/include/SDL_config_minimal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_minimal_h -#define _SDL_config_minimal_h +#ifndef SDL_config_minimal_h_ +#define SDL_config_minimal_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -78,4 +79,4 @@ typedef unsigned long uintptr_t; /* Enable the dummy filesystem driver (src/filesystem/dummy/\*.c) */ #define SDL_FILESYSTEM_DUMMY 1 -#endif /* _SDL_config_minimal_h */ +#endif /* SDL_config_minimal_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config_pandora.h b/Engine/lib/sdl/include/SDL_config_pandora.h index 7b51e571f..be5a85c19 100644 --- a/Engine/lib/sdl/include/SDL_config_pandora.h +++ b/Engine/lib/sdl/include/SDL_config_pandora.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_h -#define _SDL_config_h +#ifndef SDL_config_pandora_h_ +#define SDL_config_pandora_h_ +#define SDL_config_h_ /* This is a set of defines to configure the SDL features */ @@ -35,22 +36,24 @@ #define SDL_BYTEORDER 1234 -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STDARG_H 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_STRING_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 #define HAVE_ICONV_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MATH_H 1 +#define HAVE_MEMORY_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 + #define HAVE_MALLOC 1 #define HAVE_CALLOC 1 #define HAVE_REALLOC 1 @@ -67,7 +70,6 @@ #define HAVE_MEMCPY 1 #define HAVE_MEMMOVE 1 #define HAVE_STRLEN 1 -#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -91,6 +93,7 @@ #define HAVE_FABS 1 #define HAVE_FLOOR 1 #define HAVE_LOG 1 +#define HAVE_LOG10 1 #define HAVE_SCALBN 1 #define HAVE_SIN 1 #define HAVE_SINF 1 @@ -124,4 +127,4 @@ #define SDL_VIDEO_RENDER_OGL_ES 1 #define SDL_VIDEO_OPENGL_ES 1 -#endif /* _SDL_config_h */ +#endif /* SDL_config_pandora_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config_psp.h b/Engine/lib/sdl/include/SDL_config_psp.h index a6e49609a..61c334978 100644 --- a/Engine/lib/sdl/include/SDL_config_psp.h +++ b/Engine/lib/sdl/include/SDL_config_psp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_psp_h -#define _SDL_config_psp_h +#ifndef SDL_config_psp_h_ +#define SDL_config_psp_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -32,16 +33,17 @@ #define HAVE_GCC_ATOMICS 1 -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 #define HAVE_MATH_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 /* C library functions */ #define HAVE_MALLOC 1 @@ -64,7 +66,6 @@ #define HAVE_STRLEN 1 #define HAVE_STRLCPY 1 #define HAVE_STRLCAT 1 -#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -82,19 +83,34 @@ #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 #define HAVE_M_PI 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 #define HAVE_ATAN 1 +#define HAVE_ATANF 1 #define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 +#define HAVE_ATAN2F 1 #define HAVE_CEIL 1 +#define HAVE_CEILF 1 #define HAVE_COPYSIGN 1 +#define HAVE_COPYSIGNF 1 #define HAVE_COS 1 #define HAVE_COSF 1 #define HAVE_FABS 1 +#define HAVE_FABSF 1 #define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 #define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 #define HAVE_POW 1 +#define HAVE_POWF 1 #define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 #define HAVE_SIN 1 #define HAVE_SINF 1 #define HAVE_SQRT 1 @@ -140,4 +156,4 @@ #define SDL_LOADSO_DISABLED 1 -#endif /* _SDL_config_psp_h */ +#endif /* SDL_config_psp_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config_windows.h b/Engine/lib/sdl/include/SDL_config_windows.h index 890986cc4..52a9ece16 100644 --- a/Engine/lib/sdl/include/SDL_config_windows.h +++ b/Engine/lib/sdl/include/SDL_config_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_windows_h -#define _SDL_config_windows_h +#ifndef SDL_config_windows_h_ +#define SDL_config_windows_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -85,12 +86,14 @@ typedef unsigned int uintptr_t; /* This is disabled by default to avoid C runtime dependencies and manifest requirements */ #ifdef HAVE_LIBC /* Useful headers */ -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 #define HAVE_CTYPE_H 1 +#define HAVE_FLOAT_H 1 +#define HAVE_LIMITS_H 1 #define HAVE_MATH_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 /* C library functions */ #define HAVE_MALLOC 1 @@ -106,13 +109,15 @@ typedef unsigned int uintptr_t; #define HAVE_MEMCMP 1 #define HAVE_STRLEN 1 #define HAVE__STRREV 1 -#define HAVE__STRUPR 1 -#define HAVE__STRLWR 1 +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__STRUPR */ +/* #undef HAVE__STRLWR */ #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 -#define HAVE__LTOA 1 -#define HAVE__ULTOA 1 +/* These functions have security warnings, so we won't use them */ +/* #undef HAVE__LTOA */ +/* #undef HAVE__ULTOA */ #define HAVE_STRTOL 1 #define HAVE_STRTOUL 1 #define HAVE_STRTOD 1 @@ -122,28 +127,48 @@ typedef unsigned int uintptr_t; #define HAVE_STRNCMP 1 #define HAVE__STRICMP 1 #define HAVE__STRNICMP 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_ACOS 1 -#define HAVE_ASIN 1 -#define HAVE_CEIL 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 -#define HAVE_POW 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 +#define HAVE_ATAN 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2 1 +#define HAVE_ATAN2F 1 +#define HAVE_CEILF 1 +#define HAVE__COPYSIGN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FABSF 1 +#define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 +#define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 +#define HAVE_POW 1 +#define HAVE_POWF 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 +#if defined(_MSC_VER) +/* These functions were added with the VC++ 2013 C runtime library */ #if _MSC_VER >= 1800 #define HAVE_STRTOLL 1 #define HAVE_VSSCANF 1 -#define HAVE_COPYSIGN 1 #define HAVE_SCALBN 1 +#define HAVE_SCALBNF 1 +#endif +/* This function is available with at least the VC++ 2008 C runtime library */ +#if _MSC_VER >= 1400 +#define HAVE__FSEEKI64 1 +#endif #endif #if !defined(_MSC_VER) || defined(_USE_MATH_DEFINES) #define HAVE_M_PI 1 @@ -154,8 +179,8 @@ typedef unsigned int uintptr_t; #endif /* Enable various audio drivers */ +#define SDL_AUDIO_DRIVER_WASAPI 1 #define SDL_AUDIO_DRIVER_DSOUND 1 -#define SDL_AUDIO_DRIVER_XAUDIO2 1 #define SDL_AUDIO_DRIVER_WINMM 1 #define SDL_AUDIO_DRIVER_DISK 1 #define SDL_AUDIO_DRIVER_DUMMY 1 @@ -183,7 +208,7 @@ typedef unsigned int uintptr_t; #define SDL_VIDEO_RENDER_D3D 1 #endif #ifndef SDL_VIDEO_RENDER_D3D11 -#define SDL_VIDEO_RENDER_D3D11 0 +#define SDL_VIDEO_RENDER_D3D11 0 #endif /* Enable OpenGL support */ @@ -206,6 +231,8 @@ typedef unsigned int uintptr_t; #define SDL_VIDEO_OPENGL_EGL 1 #endif +/* Enable Vulkan support */ +#define SDL_VIDEO_VULKAN 1 /* Enable system power support */ #define SDL_POWER_WINDOWS 1 @@ -218,4 +245,4 @@ typedef unsigned int uintptr_t; #define SDL_ASSEMBLY_ROUTINES 1 #endif -#endif /* _SDL_config_windows_h */ +#endif /* SDL_config_windows_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config_winrt.h b/Engine/lib/sdl/include/SDL_config_winrt.h index e392f773e..aac0e6014 100644 --- a/Engine/lib/sdl/include/SDL_config_winrt.h +++ b/Engine/lib/sdl/include/SDL_config_winrt.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_winrt_h -#define _SDL_config_winrt_h +#ifndef SDL_config_winrt_h_ +#define SDL_config_winrt_h_ +#define SDL_config_h_ #include "SDL_platform.h" @@ -43,7 +44,7 @@ #if !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H) #if defined(__GNUC__) || defined(__DMC__) || defined(__WATCOMC__) -#define HAVE_STDINT_H 1 +#define HAVE_STDINT_H 1 #elif defined(_MSC_VER) typedef signed __int8 int8_t; typedef unsigned __int8 uint8_t; @@ -97,13 +98,14 @@ typedef unsigned int uintptr_t; #define HAVE_XINPUT_H 1 #endif #define HAVE_LIBC 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STRING_H 1 #define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 #define HAVE_FLOAT_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MATH_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STRING_H 1 /* C library functions */ #define HAVE_MALLOC 1 @@ -120,13 +122,13 @@ typedef unsigned int uintptr_t; #define HAVE_STRLEN 1 #define HAVE__STRREV 1 #define HAVE__STRUPR 1 -//#define HAVE__STRLWR 1 // TODO, WinRT: consider using _strlwr_s instead +//#define HAVE__STRLWR 1 // TODO, WinRT: consider using _strlwr_s instead #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 //#define HAVE_ITOA 1 // TODO, WinRT: consider using _itoa_s instead -//#define HAVE__LTOA 1 // TODO, WinRT: consider using _ltoa_s instead -//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead +//#define HAVE__LTOA 1 // TODO, WinRT: consider using _ltoa_s instead +//#define HAVE__ULTOA 1 // TODO, WinRT: consider using _ultoa_s instead #define HAVE_STRTOL 1 #define HAVE_STRTOUL 1 //#define HAVE_STRTOLL 1 @@ -138,44 +140,58 @@ typedef unsigned int uintptr_t; #define HAVE__STRICMP 1 #define HAVE__STRNICMP 1 #define HAVE_VSNPRINTF 1 -//#define HAVE_SSCANF 1 // TODO, WinRT: consider using sscanf_s instead +//#define HAVE_SSCANF 1 // TODO, WinRT: consider using sscanf_s instead #define HAVE_M_PI 1 -#define HAVE_ATAN 1 -#define HAVE_ATAN2 1 -#define HAVE_CEIL 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 +#define HAVE_ATAN 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2 1 +#define HAVE_ATAN2F 1 +#define HAVE_CEIL 1 +#define HAVE_CEILF 1 #define HAVE__COPYSIGN 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 -#define HAVE_POW 1 -//#define HAVE_SCALBN 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FABSF 1 +#define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 +#define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 +#define HAVE_POW 1 +#define HAVE_POWF 1 #define HAVE__SCALB 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 #define HAVE__FSEEKI64 1 /* Enable various audio drivers */ -#define SDL_AUDIO_DRIVER_XAUDIO2 1 -#define SDL_AUDIO_DRIVER_DISK 1 -#define SDL_AUDIO_DRIVER_DUMMY 1 +#define SDL_AUDIO_DRIVER_WASAPI 1 +#define SDL_AUDIO_DRIVER_DISK 1 +#define SDL_AUDIO_DRIVER_DUMMY 1 /* Enable various input drivers */ #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP #define SDL_JOYSTICK_DISABLED 1 -#define SDL_HAPTIC_DISABLED 1 +#define SDL_HAPTIC_DISABLED 1 #else #define SDL_JOYSTICK_XINPUT 1 #define SDL_HAPTIC_XINPUT 1 #endif /* Enable various shared object loading systems */ -#define SDL_LOADSO_WINDOWS 1 +#define SDL_LOADSO_WINDOWS 1 /* Enable various threading systems */ #if (NTDDI_VERSION >= NTDDI_WINBLUE) @@ -186,10 +202,10 @@ typedef unsigned int uintptr_t; #endif /* Enable various timer systems */ -#define SDL_TIMER_WINDOWS 1 +#define SDL_TIMER_WINDOWS 1 /* Enable various video drivers */ -#define SDL_VIDEO_DRIVER_WINRT 1 +#define SDL_VIDEO_DRIVER_WINRT 1 #define SDL_VIDEO_DRIVER_DUMMY 1 /* Enable OpenGL ES 2.0 (via a modified ANGLE library) */ @@ -208,7 +224,7 @@ typedef unsigned int uintptr_t; /* Enable assembly routines (Win64 doesn't have inline asm) */ #ifndef _WIN64 -#define SDL_ASSEMBLY_ROUTINES 1 +#define SDL_ASSEMBLY_ROUTINES 1 #endif -#endif /* _SDL_config_winrt_h */ +#endif /* SDL_config_winrt_h_ */ diff --git a/Engine/lib/sdl/include/SDL_config_wiz.h b/Engine/lib/sdl/include/SDL_config_wiz.h index e090a1a90..fe86d5ec3 100644 --- a/Engine/lib/sdl/include/SDL_config_wiz.h +++ b/Engine/lib/sdl/include/SDL_config_wiz.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,9 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_config_h -#define _SDL_config_h +#ifndef SDL_config_wiz_h_ +#define SDL_config_wiz_h_ +#define SDL_config_h_ /* This is a set of defines to configure the SDL features */ @@ -29,22 +30,24 @@ #define SDL_BYTEORDER 1234 -#define HAVE_ALLOCA_H 1 -#define HAVE_SYS_TYPES_H 1 -#define HAVE_STDIO_H 1 #define STDC_HEADERS 1 -#define HAVE_STDLIB_H 1 -#define HAVE_STDARG_H 1 -#define HAVE_MALLOC_H 1 -#define HAVE_MEMORY_H 1 -#define HAVE_STRING_H 1 -#define HAVE_STRINGS_H 1 -#define HAVE_INTTYPES_H 1 -#define HAVE_STDINT_H 1 +#define HAVE_ALLOCA_H 1 #define HAVE_CTYPE_H 1 -#define HAVE_MATH_H 1 #define HAVE_ICONV_H 1 +#define HAVE_INTTYPES_H 1 +#define HAVE_LIMITS_H 1 +#define HAVE_MALLOC_H 1 +#define HAVE_MATH_H 1 +#define HAVE_MEMORY_H 1 #define HAVE_SIGNAL_H 1 +#define HAVE_STDARG_H 1 +#define HAVE_STDINT_H 1 +#define HAVE_STDIO_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRINGS_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_TYPES_H 1 + #define HAVE_MALLOC 1 #define HAVE_CALLOC 1 #define HAVE_REALLOC 1 @@ -61,7 +64,6 @@ #define HAVE_MEMCPY 1 #define HAVE_MEMMOVE 1 #define HAVE_STRLEN 1 -#define HAVE_STRDUP 1 #define HAVE_STRCHR 1 #define HAVE_STRRCHR 1 #define HAVE_STRSTR 1 @@ -78,20 +80,40 @@ #define HAVE_VSSCANF 1 #define HAVE_VSNPRINTF 1 #define HAVE_M_PI 1 -#define HAVE_CEIL 1 -#define HAVE_COPYSIGN 1 -#define HAVE_COS 1 -#define HAVE_COSF 1 -#define HAVE_FABS 1 -#define HAVE_FLOOR 1 -#define HAVE_LOG 1 +#define HAVE_ACOS 1 +#define HAVE_ACOSF 1 +#define HAVE_ASIN 1 +#define HAVE_ASINF 1 +#define HAVE_ATAN 1 +#define HAVE_ATANF 1 +#define HAVE_ATAN2 1 +#define HAVE_ATAN2F 1 +#define HAVE_CEIL 1 +#define HAVE_CEILF 1 +#define HAVE_COPYSIGN 1 +#define HAVE_COPYSIGNF 1 +#define HAVE_COS 1 +#define HAVE_COSF 1 +#define HAVE_FABS 1 +#define HAVE_FABSF 1 +#define HAVE_FLOOR 1 +#define HAVE_FLOORF 1 +#define HAVE_FMOD 1 +#define HAVE_FMODF 1 +#define HAVE_LOG 1 +#define HAVE_LOGF 1 +#define HAVE_LOG10 1 +#define HAVE_LOG10F 1 +#define HAVE_POW 1 +#define HAVE_POWF 1 #define HAVE_SCALBN 1 -#define HAVE_SIN 1 -#define HAVE_SINF 1 -#define HAVE_SQRT 1 -#define HAVE_SQRTF 1 -#define HAVE_TAN 1 -#define HAVE_TANF 1 +#define HAVE_SCALBNF 1 +#define HAVE_SIN 1 +#define HAVE_SINF 1 +#define HAVE_SQRT 1 +#define HAVE_SQRTF 1 +#define HAVE_TAN 1 +#define HAVE_TANF 1 #define HAVE_SIGACTION 1 #define HAVE_SETJMP 1 #define HAVE_NANOSLEEP 1 @@ -117,4 +139,4 @@ #define SDL_VIDEO_RENDER_OGL_ES 1 #define SDL_VIDEO_OPENGL_ES 1 -#endif /* _SDL_config_h */ +#endif /* SDL_config_wiz_h_ */ diff --git a/Engine/lib/sdl/include/SDL_copying.h b/Engine/lib/sdl/include/SDL_copying.h index 212da0ee0..15616ace5 100644 --- a/Engine/lib/sdl/include/SDL_copying.h +++ b/Engine/lib/sdl/include/SDL_copying.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/include/SDL_cpuinfo.h b/Engine/lib/sdl/include/SDL_cpuinfo.h index d0ba47bf7..081270530 100644 --- a/Engine/lib/sdl/include/SDL_cpuinfo.h +++ b/Engine/lib/sdl/include/SDL_cpuinfo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,14 +25,20 @@ * CPU feature detection for SDL. */ -#ifndef _SDL_cpuinfo_h -#define _SDL_cpuinfo_h +#ifndef SDL_cpuinfo_h_ +#define SDL_cpuinfo_h_ #include "SDL_stdinc.h" /* Need to do this here because intrin.h has C++ code in it */ /* Visual Studio 2005 has a bug where intrin.h conflicts with winnt.h */ #if defined(_MSC_VER) && (_MSC_VER >= 1500) && (defined(_M_IX86) || defined(_M_X64)) +#ifdef __clang__ +/* Many of the intrinsics SDL uses are not implemented by clang with Visual Studio */ +#undef __MMX__ +#undef __SSE__ +#undef __SSE2__ +#else #include #ifndef _WIN64 #define __MMX__ @@ -40,28 +46,37 @@ #endif #define __SSE__ #define __SSE2__ +#endif /* __clang__ */ #elif defined(__MINGW64_VERSION_MAJOR) #include #else #ifdef __ALTIVEC__ -#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__) +#if HAVE_ALTIVEC_H && !defined(__APPLE_ALTIVEC__) && !defined(SDL_DISABLE_ALTIVEC_H) #include #undef pixel +#undef bool #endif #endif -#ifdef __MMX__ -#include -#endif -#ifdef __3dNOW__ +#if defined(__3dNOW__) && !defined(SDL_DISABLE_MM3DNOW_H) #include #endif -#ifdef __SSE__ +#if HAVE_IMMINTRIN_H && !defined(SDL_DISABLE_IMMINTRIN_H) +#include +#else +#if defined(__MMX__) && !defined(SDL_DISABLE_MMINTRIN_H) +#include +#endif +#if defined(__SSE__) && !defined(SDL_DISABLE_XMMINTRIN_H) #include #endif -#ifdef __SSE2__ +#if defined(__SSE2__) && !defined(SDL_DISABLE_EMMINTRIN_H) #include #endif +#if defined(__SSE3__) && !defined(SDL_DISABLE_PMMINTRIN_H) +#include #endif +#endif /* HAVE_IMMINTRIN_H */ +#endif /* compiler version */ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -144,6 +159,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX(void); */ extern DECLSPEC SDL_bool SDLCALL SDL_HasAVX2(void); +/** + * This function returns true if the CPU has NEON (ARM SIMD) features. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_HasNEON(void); + /** * This function returns the amount of RAM configured in the system, in MB. */ @@ -156,6 +176,6 @@ extern DECLSPEC int SDLCALL SDL_GetSystemRAM(void); #endif #include "close_code.h" -#endif /* _SDL_cpuinfo_h */ +#endif /* SDL_cpuinfo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_egl.h b/Engine/lib/sdl/include/SDL_egl.h index bea2a6c0e..d65ed437c 100644 --- a/Engine/lib/sdl/include/SDL_egl.h +++ b/Engine/lib/sdl/include/SDL_egl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ * * This is a simple file to encapsulate the EGL API headers. */ -#ifndef _MSC_VER +#if !defined(_MSC_VER) && !defined(__ANDROID__) #include #include @@ -132,7 +132,7 @@ *------------------------------------------------------------------------- * This precedes the return type of the function in the function prototype. */ -#if defined(_WIN32) && !defined(__SCITECH_SNAP__) +#if defined(_WIN32) && !defined(__SCITECH_SNAP__) && !defined(SDL_VIDEO_STATIC_ANGLE) # define KHRONOS_APICALL __declspec(dllimport) #elif defined (__SYMBIAN32__) # define KHRONOS_APICALL IMPORT_C diff --git a/Engine/lib/sdl/include/SDL_endian.h b/Engine/lib/sdl/include/SDL_endian.h index 9100b103d..ed0bf5ba8 100644 --- a/Engine/lib/sdl/include/SDL_endian.h +++ b/Engine/lib/sdl/include/SDL_endian.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Functions for reading and writing endian-specific values */ -#ifndef _SDL_endian_h -#define _SDL_endian_h +#ifndef SDL_endian_h_ +#define SDL_endian_h_ #include "SDL_stdinc.h" @@ -96,6 +96,12 @@ SDL_Swap16(Uint16 x) __asm__("rorw #8,%0": "=d"(x): "0"(x):"cc"); return x; } +#elif defined(__WATCOMC__) && defined(__386__) +extern _inline Uint16 SDL_Swap16(Uint16); +#pragma aux SDL_Swap16 = \ + "xchg al, ah" \ + parm [ax] \ + modify [ax]; #else SDL_FORCE_INLINE Uint16 SDL_Swap16(Uint16 x) @@ -136,6 +142,21 @@ SDL_Swap32(Uint32 x) __asm__("rorw #8,%0\n\tswap %0\n\trorw #8,%0": "=d"(x): "0"(x):"cc"); return x; } +#elif defined(__WATCOMC__) && defined(__386__) +extern _inline Uint32 SDL_Swap32(Uint32); +#ifndef __SW_3 /* 486+ */ +#pragma aux SDL_Swap32 = \ + "bswap eax" \ + parm [eax] \ + modify [eax]; +#else /* 386-only */ +#pragma aux SDL_Swap32 = \ + "xchg al, ah" \ + "ror eax, 16" \ + "xchg al, ah" \ + parm [eax] \ + modify [eax]; +#endif #else SDL_FORCE_INLINE Uint32 SDL_Swap32(Uint32 x) @@ -234,6 +255,6 @@ SDL_SwapFloat(float x) #endif #include "close_code.h" -#endif /* _SDL_endian_h */ +#endif /* SDL_endian_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_error.h b/Engine/lib/sdl/include/SDL_error.h index 2f3b4b500..c0e46298e 100644 --- a/Engine/lib/sdl/include/SDL_error.h +++ b/Engine/lib/sdl/include/SDL_error.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Simple error message routines for SDL. */ -#ifndef _SDL_error_h -#define _SDL_error_h +#ifndef SDL_error_h_ +#define SDL_error_h_ #include "SDL_stdinc.h" @@ -71,6 +71,6 @@ extern DECLSPEC int SDLCALL SDL_Error(SDL_errorcode code); #endif #include "close_code.h" -#endif /* _SDL_error_h */ +#endif /* SDL_error_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_events.h b/Engine/lib/sdl/include/SDL_events.h index edb89ef49..3d39e6a73 100644 --- a/Engine/lib/sdl/include/SDL_events.h +++ b/Engine/lib/sdl/include/SDL_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL event handling. */ -#ifndef _SDL_events_h -#define _SDL_events_h +#ifndef SDL_events_h_ +#define SDL_events_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -165,7 +165,7 @@ typedef enum typedef struct SDL_CommonEvent { Uint32 type; - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ } SDL_CommonEvent; /** @@ -174,7 +174,7 @@ typedef struct SDL_CommonEvent typedef struct SDL_WindowEvent { Uint32 type; /**< ::SDL_WINDOWEVENT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The associated window */ Uint8 event; /**< ::SDL_WindowEventID */ Uint8 padding1; @@ -190,7 +190,7 @@ typedef struct SDL_WindowEvent typedef struct SDL_KeyboardEvent { Uint32 type; /**< ::SDL_KEYDOWN or ::SDL_KEYUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with keyboard focus, if any */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ Uint8 repeat; /**< Non-zero if this is a key repeat */ @@ -206,7 +206,7 @@ typedef struct SDL_KeyboardEvent typedef struct SDL_TextEditingEvent { Uint32 type; /**< ::SDL_TEXTEDITING */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with keyboard focus, if any */ char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; /**< The editing text */ Sint32 start; /**< The start cursor of selected editing text */ @@ -221,7 +221,7 @@ typedef struct SDL_TextEditingEvent typedef struct SDL_TextInputEvent { Uint32 type; /**< ::SDL_TEXTINPUT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with keyboard focus, if any */ char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; /**< The input text */ } SDL_TextInputEvent; @@ -232,7 +232,7 @@ typedef struct SDL_TextInputEvent typedef struct SDL_MouseMotionEvent { Uint32 type; /**< ::SDL_MOUSEMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint32 state; /**< The current button state */ @@ -248,7 +248,7 @@ typedef struct SDL_MouseMotionEvent typedef struct SDL_MouseButtonEvent { Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Uint8 button; /**< The mouse button index */ @@ -265,7 +265,7 @@ typedef struct SDL_MouseButtonEvent typedef struct SDL_MouseWheelEvent { Uint32 type; /**< ::SDL_MOUSEWHEEL */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with mouse focus, if any */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ Sint32 x; /**< The amount scrolled horizontally, positive to the right and negative to the left */ @@ -279,7 +279,7 @@ typedef struct SDL_MouseWheelEvent typedef struct SDL_JoyAxisEvent { Uint32 type; /**< ::SDL_JOYAXISMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 axis; /**< The joystick axis index */ Uint8 padding1; @@ -295,7 +295,7 @@ typedef struct SDL_JoyAxisEvent typedef struct SDL_JoyBallEvent { Uint32 type; /**< ::SDL_JOYBALLMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 ball; /**< The joystick trackball index */ Uint8 padding1; @@ -311,7 +311,7 @@ typedef struct SDL_JoyBallEvent typedef struct SDL_JoyHatEvent { Uint32 type; /**< ::SDL_JOYHATMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 hat; /**< The joystick hat index */ Uint8 value; /**< The hat position value. @@ -331,7 +331,7 @@ typedef struct SDL_JoyHatEvent typedef struct SDL_JoyButtonEvent { Uint32 type; /**< ::SDL_JOYBUTTONDOWN or ::SDL_JOYBUTTONUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 button; /**< The joystick button index */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ @@ -345,7 +345,7 @@ typedef struct SDL_JoyButtonEvent typedef struct SDL_JoyDeviceEvent { Uint32 type; /**< ::SDL_JOYDEVICEADDED or ::SDL_JOYDEVICEREMOVED */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED event */ } SDL_JoyDeviceEvent; @@ -356,7 +356,7 @@ typedef struct SDL_JoyDeviceEvent typedef struct SDL_ControllerAxisEvent { Uint32 type; /**< ::SDL_CONTROLLERAXISMOTION */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 axis; /**< The controller axis (SDL_GameControllerAxis) */ Uint8 padding1; @@ -373,7 +373,7 @@ typedef struct SDL_ControllerAxisEvent typedef struct SDL_ControllerButtonEvent { Uint32 type; /**< ::SDL_CONTROLLERBUTTONDOWN or ::SDL_CONTROLLERBUTTONUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_JoystickID which; /**< The joystick instance id */ Uint8 button; /**< The controller button (SDL_GameControllerButton) */ Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */ @@ -388,7 +388,7 @@ typedef struct SDL_ControllerButtonEvent typedef struct SDL_ControllerDeviceEvent { Uint32 type; /**< ::SDL_CONTROLLERDEVICEADDED, ::SDL_CONTROLLERDEVICEREMOVED, or ::SDL_CONTROLLERDEVICEREMAPPED */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Sint32 which; /**< The joystick device index for the ADDED event, instance id for the REMOVED or REMAPPED event */ } SDL_ControllerDeviceEvent; @@ -398,7 +398,7 @@ typedef struct SDL_ControllerDeviceEvent typedef struct SDL_AudioDeviceEvent { Uint32 type; /**< ::SDL_AUDIODEVICEADDED, or ::SDL_AUDIODEVICEREMOVED */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 which; /**< The audio device index for the ADDED event (valid until next SDL_GetNumAudioDevices() call), SDL_AudioDeviceID for the REMOVED event */ Uint8 iscapture; /**< zero if an output device, non-zero if a capture device. */ Uint8 padding1; @@ -413,7 +413,7 @@ typedef struct SDL_AudioDeviceEvent typedef struct SDL_TouchFingerEvent { Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_TouchID touchId; /**< The touch device id */ SDL_FingerID fingerId; float x; /**< Normalized in the range 0...1 */ @@ -430,8 +430,8 @@ typedef struct SDL_TouchFingerEvent typedef struct SDL_MultiGestureEvent { Uint32 type; /**< ::SDL_MULTIGESTURE */ - Uint32 timestamp; - SDL_TouchID touchId; /**< The touch device index */ + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ + SDL_TouchID touchId; /**< The touch device id */ float dTheta; float dDist; float x; @@ -447,7 +447,7 @@ typedef struct SDL_MultiGestureEvent typedef struct SDL_DollarGestureEvent { Uint32 type; /**< ::SDL_DOLLARGESTURE or ::SDL_DOLLARRECORD */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_TouchID touchId; /**< The touch device id */ SDL_GestureID gestureId; Uint32 numFingers; @@ -465,7 +465,7 @@ typedef struct SDL_DollarGestureEvent typedef struct SDL_DropEvent { Uint32 type; /**< ::SDL_DROPBEGIN or ::SDL_DROPFILE or ::SDL_DROPTEXT or ::SDL_DROPCOMPLETE */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ char *file; /**< The file name, which should be freed with SDL_free(), is NULL on begin/complete */ Uint32 windowID; /**< The window that was dropped on, if any */ } SDL_DropEvent; @@ -477,7 +477,7 @@ typedef struct SDL_DropEvent typedef struct SDL_QuitEvent { Uint32 type; /**< ::SDL_QUIT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ } SDL_QuitEvent; /** @@ -486,7 +486,7 @@ typedef struct SDL_QuitEvent typedef struct SDL_OSEvent { Uint32 type; /**< ::SDL_QUIT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ } SDL_OSEvent; /** @@ -495,7 +495,7 @@ typedef struct SDL_OSEvent typedef struct SDL_UserEvent { Uint32 type; /**< ::SDL_USEREVENT through ::SDL_LASTEVENT-1 */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The associated window if any */ Sint32 code; /**< User defined event code */ void *data1; /**< User defined data pointer */ @@ -515,7 +515,7 @@ typedef struct SDL_SysWMmsg SDL_SysWMmsg; typedef struct SDL_SysWMEvent { Uint32 type; /**< ::SDL_SYSWMEVENT */ - Uint32 timestamp; + Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ SDL_SysWMmsg *msg; /**< driver dependent data, defined in SDL_syswm.h */ } SDL_SysWMEvent; @@ -724,7 +724,7 @@ extern DECLSPEC void SDLCALL SDL_FilterEvents(SDL_EventFilter filter, /** * This function allows you to set the state of processing certain events. * - If \c state is set to ::SDL_IGNORE, that event will be automatically - * dropped from the event queue and will not event be filtered. + * dropped from the event queue and will not be filtered. * - If \c state is set to ::SDL_ENABLE, that event will be processed * normally. * - If \c state is set to ::SDL_QUERY, SDL_EventState() will return the @@ -749,6 +749,6 @@ extern DECLSPEC Uint32 SDLCALL SDL_RegisterEvents(int numevents); #endif #include "close_code.h" -#endif /* _SDL_events_h */ +#endif /* SDL_events_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_filesystem.h b/Engine/lib/sdl/include/SDL_filesystem.h index 02999ed27..fa6a1fa6e 100644 --- a/Engine/lib/sdl/include/SDL_filesystem.h +++ b/Engine/lib/sdl/include/SDL_filesystem.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * \brief Include file for filesystem SDL API functions */ -#ifndef _SDL_filesystem_h -#define _SDL_filesystem_h +#ifndef SDL_filesystem_h_ +#define SDL_filesystem_h_ #include "SDL_stdinc.h" @@ -131,6 +131,6 @@ extern DECLSPEC char *SDLCALL SDL_GetPrefPath(const char *org, const char *app); #endif #include "close_code.h" -#endif /* _SDL_filesystem_h */ +#endif /* SDL_filesystem_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_gamecontroller.h b/Engine/lib/sdl/include/SDL_gamecontroller.h index e67fd9fd0..2e024be65 100644 --- a/Engine/lib/sdl/include/SDL_gamecontroller.h +++ b/Engine/lib/sdl/include/SDL_gamecontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL game controller event handling */ -#ifndef _SDL_gamecontroller_h -#define _SDL_gamecontroller_h +#ifndef SDL_gamecontroller_h_ +#define SDL_gamecontroller_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -51,7 +51,9 @@ extern "C" { * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS */ -/* The gamecontroller structure used to identify an SDL game controller */ +/** + * The gamecontroller structure used to identify an SDL game controller + */ struct _SDL_GameController; typedef struct _SDL_GameController SDL_GameController; @@ -87,8 +89,8 @@ typedef struct SDL_GameControllerButtonBind * To count the number of game controllers in the system for the following: * int nJoysticks = SDL_NumJoysticks(); * int nGameControllers = 0; - * for ( int i = 0; i < nJoysticks; i++ ) { - * if ( SDL_IsGameController(i) ) { + * for (int i = 0; i < nJoysticks; i++) { + * if (SDL_IsGameController(i)) { * nGameControllers++; * } * } @@ -105,7 +107,7 @@ typedef struct SDL_GameControllerButtonBind * Buttons can be used as a controller axis and vice versa. * * This string shows an example of a valid mapping for a controller - * "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7", + * "03000000341a00003608000000000000,PS3 Controller,a:b1,b:b2,y:b3,x:b0,start:b9,guide:b12,back:b8,dpup:h0.1,dpleft:h0.8,dpdown:h0.4,dpright:h0.2,leftshoulder:b4,rightshoulder:b5,leftstick:b10,rightstick:b11,leftx:a0,lefty:a1,rightx:a2,righty:a3,lefttrigger:b6,righttrigger:b7", * */ @@ -117,7 +119,7 @@ typedef struct SDL_GameControllerButtonBind * * \return number of mappings added, -1 on error */ -extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW( SDL_RWops * rw, int freerw ); +extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw); /** * Load a set of mappings from a file, filtered by the current SDL_GetPlatform() @@ -131,28 +133,41 @@ extern DECLSPEC int SDLCALL SDL_GameControllerAddMappingsFromRW( SDL_RWops * rw, * * \return 1 if mapping is added, 0 if updated, -1 on error */ -extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping( const char* mappingString ); +extern DECLSPEC int SDLCALL SDL_GameControllerAddMapping(const char* mappingString); + +/** + * Get the number of mappings installed + * + * \return the number of mappings + */ +extern DECLSPEC int SDLCALL SDL_GameControllerNumMappings(void); + +/** + * Get the mapping at a particular index. + * + * \return the mapping string. Must be freed with SDL_free(). Returns NULL if the index is out of range. + */ +extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForIndex(int mapping_index); /** * Get a mapping string for a GUID * * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available */ -extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID( SDL_JoystickGUID guid ); +extern DECLSPEC char * SDLCALL SDL_GameControllerMappingForGUID(SDL_JoystickGUID guid); /** * Get a mapping string for an open GameController * * \return the mapping string. Must be freed with SDL_free(). Returns NULL if no mapping is available */ -extern DECLSPEC char * SDLCALL SDL_GameControllerMapping( SDL_GameController * gamecontroller ); +extern DECLSPEC char * SDLCALL SDL_GameControllerMapping(SDL_GameController * gamecontroller); /** * Is the joystick on this index supported by the game controller interface? */ extern DECLSPEC SDL_bool SDLCALL SDL_IsGameController(int joystick_index); - /** * Get the implementation dependent name of a game controller. * This can be called before any controllers are opened. @@ -181,6 +196,24 @@ extern DECLSPEC SDL_GameController *SDLCALL SDL_GameControllerFromInstanceID(SDL */ extern DECLSPEC const char *SDLCALL SDL_GameControllerName(SDL_GameController *gamecontroller); +/** + * Get the USB vendor ID of an opened controller, if available. + * If the vendor ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetVendor(SDL_GameController * gamecontroller); + +/** + * Get the USB product ID of an opened controller, if available. + * If the product ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProduct(SDL_GameController * gamecontroller); + +/** + * Get the product version of an opened controller, if available. + * If the product version isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller); + /** * Returns SDL_TRUE if the controller has been opened and currently connected, * or SDL_FALSE if it has not. @@ -214,6 +247,12 @@ extern DECLSPEC void SDLCALL SDL_GameControllerUpdate(void); /** * The list of axes available from a controller + * + * Thumbstick axis values range from SDL_JOYSTICK_AXIS_MIN to SDL_JOYSTICK_AXIS_MAX, + * and are centered within ~8000 of zero, though advanced UI will allow users to set + * or autodetect the dead zone, which varies between controllers. + * + * Trigger axis values range from 0 to SDL_JOYSTICK_AXIS_MAX. */ typedef enum { @@ -318,6 +357,6 @@ extern DECLSPEC void SDLCALL SDL_GameControllerClose(SDL_GameController *gamecon #endif #include "close_code.h" -#endif /* _SDL_gamecontroller_h */ +#endif /* SDL_gamecontroller_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_gesture.h b/Engine/lib/sdl/include/SDL_gesture.h index 3c29ca7ac..b223d80d4 100644 --- a/Engine/lib/sdl/include/SDL_gesture.h +++ b/Engine/lib/sdl/include/SDL_gesture.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL gesture event handling. */ -#ifndef _SDL_gesture_h -#define _SDL_gesture_h +#ifndef SDL_gesture_h_ +#define SDL_gesture_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -82,6 +82,6 @@ extern DECLSPEC int SDLCALL SDL_LoadDollarTemplates(SDL_TouchID touchId, SDL_RWo #endif #include "close_code.h" -#endif /* _SDL_gesture_h */ +#endif /* SDL_gesture_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_haptic.h b/Engine/lib/sdl/include/SDL_haptic.h index 9421c8f17..e3a2bca5f 100644 --- a/Engine/lib/sdl/include/SDL_haptic.h +++ b/Engine/lib/sdl/include/SDL_haptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,12 +22,12 @@ /** * \file SDL_haptic.h * - * \brief The SDL Haptic subsystem allows you to control haptic (force feedback) + * \brief The SDL haptic subsystem allows you to control haptic (force feedback) * devices. * * The basic usage is as follows: - * - Initialize the Subsystem (::SDL_INIT_HAPTIC). - * - Open a Haptic Device. + * - Initialize the subsystem (::SDL_INIT_HAPTIC). + * - Open a haptic device. * - SDL_HapticOpen() to open from index. * - SDL_HapticOpenFromJoystick() to open from an existing joystick. * - Create an effect (::SDL_HapticEffect). @@ -104,8 +104,8 @@ * \endcode */ -#ifndef _SDL_haptic_h -#define _SDL_haptic_h +#ifndef SDL_haptic_h_ +#define SDL_haptic_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -282,7 +282,7 @@ typedef struct _SDL_Haptic SDL_Haptic; /** * \brief Device can be queried for effect status. * - * Device can be queried for effect status. + * Device supports querying effect status. * * \sa SDL_HapticGetEffectStatus */ @@ -291,6 +291,8 @@ typedef struct _SDL_Haptic SDL_Haptic; /** * \brief Device can be paused. * + * Devices supports being paused. + * * \sa SDL_HapticPause * \sa SDL_HapticUnpause */ @@ -444,7 +446,7 @@ typedef struct SDL_HapticDirection /** * \brief A structure containing a template for a Constant effect. * - * The struct is exclusive to the ::SDL_HAPTIC_CONSTANT effect. + * This struct is exclusively for the ::SDL_HAPTIC_CONSTANT effect. * * A constant effect applies a constant force in the specified direction * to the joystick. @@ -676,6 +678,8 @@ typedef struct SDL_HapticLeftRight /** * \brief A structure containing a template for the ::SDL_HAPTIC_CUSTOM effect. * + * This struct is exclusively for the ::SDL_HAPTIC_CUSTOM effect. + * * A custom force feedback effect is much like a periodic effect, where the * application can define its exact shape. You will have to allocate the * data yourself. Data should consist of channels * samples Uint16 samples. @@ -804,7 +808,7 @@ typedef union SDL_HapticEffect extern DECLSPEC int SDLCALL SDL_NumHaptics(void); /** - * \brief Get the implementation dependent name of a Haptic device. + * \brief Get the implementation dependent name of a haptic device. * * This can be called before any joysticks are opened. * If no name can be found, this function returns NULL. @@ -817,9 +821,9 @@ extern DECLSPEC int SDLCALL SDL_NumHaptics(void); extern DECLSPEC const char *SDLCALL SDL_HapticName(int device_index); /** - * \brief Opens a Haptic device for usage. + * \brief Opens a haptic device for use. * - * The index passed as an argument refers to the N'th Haptic device on this + * The index passed as an argument refers to the N'th haptic device on this * system. * * When opening a haptic device, its gain will be set to maximum and @@ -885,15 +889,15 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromMouse(void); * \brief Checks to see if a joystick has haptic features. * * \param joystick Joystick to test for haptic capabilities. - * \return 1 if the joystick is haptic, 0 if it isn't - * or -1 if an error ocurred. + * \return SDL_TRUE if the joystick is haptic, SDL_FALSE if it isn't + * or -1 if an error occurred. * * \sa SDL_HapticOpenFromJoystick */ extern DECLSPEC int SDLCALL SDL_JoystickIsHaptic(SDL_Joystick * joystick); /** - * \brief Opens a Haptic device for usage from a Joystick device. + * \brief Opens a haptic device for use from a joystick device. * * You must still close the haptic device separately. It will not be closed * with the joystick. @@ -913,7 +917,7 @@ extern DECLSPEC SDL_Haptic *SDLCALL SDL_HapticOpenFromJoystick(SDL_Joystick * joystick); /** - * \brief Closes a Haptic device previously opened with SDL_HapticOpen(). + * \brief Closes a haptic device previously opened with SDL_HapticOpen(). * * \param haptic Haptic device to close. */ @@ -957,7 +961,7 @@ extern DECLSPEC int SDLCALL SDL_HapticNumEffectsPlaying(SDL_Haptic * haptic); * Example: * \code * if (SDL_HapticQuery(haptic) & SDL_HAPTIC_CONSTANT) { - * printf("We have constant haptic effect!"); + * printf("We have constant haptic effect!\n"); * } * \endcode * @@ -996,7 +1000,7 @@ extern DECLSPEC int SDLCALL SDL_HapticEffectSupported(SDL_Haptic * haptic, * * \param haptic Haptic device to create the effect on. * \param effect Properties of the effect to create. - * \return The id of the effect on success or -1 on error. + * \return The identifier of the effect on success or -1 on error. * * \sa SDL_HapticUpdateEffect * \sa SDL_HapticRunEffect @@ -1008,13 +1012,13 @@ extern DECLSPEC int SDLCALL SDL_HapticNewEffect(SDL_Haptic * haptic, /** * \brief Updates the properties of an effect. * - * Can be used dynamically, although behaviour when dynamically changing + * Can be used dynamically, although behavior when dynamically changing * direction may be strange. Specifically the effect may reupload itself * and start playing from the start. You cannot change the type either when * running SDL_HapticUpdateEffect(). * * \param haptic Haptic device that has the effect. - * \param effect Effect to update. + * \param effect Identifier of the effect to update. * \param data New effect properties to use. * \return 0 on success or -1 on error. * @@ -1218,6 +1222,6 @@ extern DECLSPEC int SDLCALL SDL_HapticRumbleStop(SDL_Haptic * haptic); #endif #include "close_code.h" -#endif /* _SDL_haptic_h */ +#endif /* SDL_haptic_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_hints.h b/Engine/lib/sdl/include/SDL_hints.h index dd1546431..3834640f2 100644 --- a/Engine/lib/sdl/include/SDL_hints.h +++ b/Engine/lib/sdl/include/SDL_hints.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,8 +36,8 @@ * to how they would like the library to work. */ -#ifndef _SDL_hints_h -#define _SDL_hints_h +#ifndef SDL_hints_h_ +#define SDL_hints_h_ #include "SDL_stdinc.h" @@ -76,6 +76,7 @@ extern "C" { * "opengl" * "opengles2" * "opengles" + * "metal" * "software" * * The default varies by platform, but it's the first one in the list that @@ -118,6 +119,17 @@ extern "C" { */ #define SDL_HINT_RENDER_DIRECT3D11_DEBUG "SDL_RENDER_DIRECT3D11_DEBUG" +/** + * \brief A variable controlling the scaling policy for SDL_RenderSetLogicalSize. + * + * This variable can be set to the following values: + * "0" or "letterbox" - Uses letterbox/sidebars to fit the entire rendering on screen + * "1" or "overscan" - Will zoom the rendering so it fills the entire screen, allowing edges to be drawn offscreen + * + * By default letterbox is used + */ +#define SDL_HINT_RENDER_LOGICAL_SIZE_MODE "SDL_RENDER_LOGICAL_SIZE_MODE" + /** * \brief A variable controlling the scaling quality * @@ -199,6 +211,18 @@ extern "C" { */ #define SDL_HINT_VIDEO_X11_NET_WM_PING "SDL_VIDEO_X11_NET_WM_PING" +/** + * \brief A variable controlling whether the X11 _NET_WM_BYPASS_COMPOSITOR hint should be used. + * + * This variable can be set to the following values: + * "0" - Disable _NET_WM_BYPASS_COMPOSITOR + * "1" - Enable _NET_WM_BYPASS_COMPOSITOR + * + * By default SDL will use _NET_WM_BYPASS_COMPOSITOR + * + */ +#define SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR "SDL_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR" + /** * \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden * @@ -210,6 +234,12 @@ extern "C" { */ #define SDL_HINT_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN "SDL_WINDOW_FRAME_USABLE_WHILE_CURSOR_HIDDEN" +/** + * \brief A variable to specify custom icon resource id from RC file on Windows platform + */ +#define SDL_HINT_WINDOWS_INTRESOURCE_ICON "SDL_WINDOWS_INTRESOURCE_ICON" +#define SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL "SDL_WINDOWS_INTRESOURCE_ICON_SMALL" + /** * \brief A variable controlling whether the windows message loop is processed by SDL * @@ -232,6 +262,16 @@ extern "C" { */ #define SDL_HINT_GRAB_KEYBOARD "SDL_GRAB_KEYBOARD" +/** + * \brief A variable setting the speed scale for mouse motion, in floating point, when the mouse is not in relative mode + */ +#define SDL_HINT_MOUSE_NORMAL_SPEED_SCALE "SDL_MOUSE_NORMAL_SPEED_SCALE" + +/** + * \brief A variable setting the scale for mouse motion, in floating point, when the mouse is in relative mode + */ +#define SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE "SDL_MOUSE_RELATIVE_SPEED_SCALE" + /** * \brief A variable controlling whether relative mouse mode is implemented using mouse warping * @@ -254,6 +294,17 @@ extern "C" { */ #define SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH "SDL_MOUSE_FOCUS_CLICKTHROUGH" +/** + * \brief A variable controlling whether touch events should generate synthetic mouse events + * + * This variable can be set to the following values: + * "0" - Touch events will not generate mouse events + * "1" - Touch events will generate mouse events + * + * By default SDL will generate mouse events for touch events + */ +#define SDL_HINT_TOUCH_MOUSE_EVENTS "SDL_TOUCH_MOUSE_EVENTS" + /** * \brief Minimize your SDL_Window if it loses key focus when in fullscreen mode. Defaults to true. * @@ -317,16 +368,35 @@ extern "C" { #define SDL_HINT_APPLE_TV_REMOTE_ALLOW_ROTATION "SDL_APPLE_TV_REMOTE_ALLOW_ROTATION" /** - * \brief A variable controlling whether the Android / iOS built-in - * accelerometer should be listed as a joystick device, rather than listing - * actual joysticks only. + * \brief A variable controlling whether the home indicator bar on iPhone X + * should be hidden. * * This variable can be set to the following values: - * "0" - List only real joysticks and accept input from them - * "1" - List real joysticks along with the accelerometer as if it were a 3 axis joystick (the default). + * "0" - The indicator bar is not hidden (default for windowed applications) + * "1" - The indicator bar is hidden and is shown when the screen is touched (useful for movie playback applications) + * "2" - The indicator bar is dim and the first swipe makes it visible and the second swipe performs the "home" action (default for fullscreen applications) + */ +#define SDL_HINT_IOS_HIDE_HOME_INDICATOR "SDL_IOS_HIDE_HOME_INDICATOR" + +/** + * \brief A variable controlling whether the Android / iOS built-in + * accelerometer should be listed as a joystick device. + * + * This variable can be set to the following values: + * "0" - The accelerometer is not listed as a joystick + * "1" - The accelerometer is available as a 3 axis joystick (the default). */ #define SDL_HINT_ACCELEROMETER_AS_JOYSTICK "SDL_ACCELEROMETER_AS_JOYSTICK" +/** + * \brief A variable controlling whether the Android / tvOS remotes + * should be listed as joystick devices, instead of sending keyboard events. + * + * This variable can be set to the following values: + * "0" - Remotes send enter/escape/arrow key events + * "1" - Remotes are available as 2 axis, 2 button joysticks (the default). + */ +#define SDL_HINT_TV_REMOTE_AS_JOYSTICK "SDL_TV_REMOTE_AS_JOYSTICK" /** * \brief A variable that lets you disable the detection and use of Xinput gamepad devices @@ -337,7 +407,6 @@ extern "C" { */ #define SDL_HINT_XINPUT_ENABLED "SDL_XINPUT_ENABLED" - /** * \brief A variable that causes SDL to use the old axis and button mapping for XInput devices. * @@ -347,9 +416,8 @@ extern "C" { */ #define SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING "SDL_XINPUT_USE_OLD_JOYSTICK_MAPPING" - /** - * \brief A variable that lets you manually hint extra gamecontroller db entries + * \brief A variable that lets you manually hint extra gamecontroller db entries. * * The variable should be newline delimited rows of gamecontroller config data, see SDL_gamecontroller.h * @@ -358,6 +426,31 @@ extern "C" { */ #define SDL_HINT_GAMECONTROLLERCONFIG "SDL_GAMECONTROLLERCONFIG" +/** + * \brief A variable containing a list of devices to skip when scanning for game controllers. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES "SDL_GAMECONTROLLER_IGNORE_DEVICES" + +/** + * \brief If set, all devices will be skipped when scanning for game controllers except for the ones listed in this variable. + * + * The format of the string is a comma separated list of USB VID/PID pairs + * in hexadecimal form, e.g. + * + * 0xAAAA/0xBBBB,0xCCCC/0xDDDD + * + * The variable can also take the form of @file, in which case the named + * file will be loaded and interpreted as the value of the variable. + */ +#define SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT "SDL_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT" /** * \brief A variable that lets you enable joystick (and gamecontroller) events even when your app is in the background. @@ -372,7 +465,6 @@ extern "C" { */ #define SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS "SDL_JOYSTICK_ALLOW_BACKGROUND_EVENTS" - /** * \brief If set to "0" then never set the top most bit on a SDL Window, even if the video mode expects it. * This is a debugging aid for developers and not expected to be used by end users. The default is "1" @@ -383,7 +475,6 @@ extern "C" { */ #define SDL_HINT_ALLOW_TOPMOST "SDL_ALLOW_TOPMOST" - /** * \brief A variable that controls the timer resolution, in milliseconds. * @@ -401,6 +492,33 @@ extern "C" { #define SDL_HINT_TIMER_RESOLUTION "SDL_TIMER_RESOLUTION" +/** + * \brief A variable describing the content orientation on QtWayland-based platforms. + * + * On QtWayland platforms, windows are rotated client-side to allow for custom + * transitions. In order to correctly position overlays (e.g. volume bar) and + * gestures (e.g. events view, close/minimize gestures), the system needs to + * know in which orientation the application is currently drawing its contents. + * + * This does not cause the window to be rotated or resized, the application + * needs to take care of drawing the content in the right orientation (the + * framebuffer is always in portrait mode). + * + * This variable can be one of the following values: + * "primary" (default), "portrait", "landscape", "inverted-portrait", "inverted-landscape" + */ +#define SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION "SDL_QTWAYLAND_CONTENT_ORIENTATION" + +/** + * \brief Flags to set on QtWayland windows to integrate with the native window manager. + * + * On QtWayland platforms, this hint controls the flags to set on the windows. + * For example, on Sailfish OS "OverridesSystemGestures" disables swipe gestures. + * + * This variable is a space-separated list of the following values (empty = no flags): + * "OverridesSystemGestures", "StaysOnTop", "BypassWindowManager" + */ +#define SDL_HINT_QTWAYLAND_WINDOW_FLAGS "SDL_QTWAYLAND_WINDOW_FLAGS" /** * \brief A string specifying SDL's threads stack size in bytes or "0" for the backend's default size @@ -634,6 +752,18 @@ extern "C" { */ #define SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH "SDL_ANDROID_SEPARATE_MOUSE_AND_TOUCH" + /** + * \brief A variable to control whether the return key on the soft keyboard + * should hide the soft keyboard on Android and iOS. + * + * The variable can be set to the following values: + * "0" - The return key will be handled as a key event. This is the behaviour of SDL <= 2.0.3. (default) + * "1" - The return key will hide the keyboard. + * + * The value of this hint is used at runtime, so it can be changed at any time. + */ +#define SDL_HINT_RETURN_KEY_HIDES_IME "SDL_RETURN_KEY_HIDES_IME" + /** * \brief override the binding element for keyboard inputs for Emscripten builds * @@ -667,7 +797,7 @@ extern "C" { * "0" - SDL will generate a window-close event when it sees Alt+F4. * "1" - SDL will only do normal key handling for Alt+F4. */ -#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4" +#define SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4 "SDL_WINDOWS_NO_CLOSE_ON_ALT_F4" /** * \brief Prevent SDL from using version 4 of the bitmap header when saving BMPs. @@ -689,13 +819,18 @@ extern "C" { #define SDL_HINT_BMP_SAVE_LEGACY_FORMAT "SDL_BMP_SAVE_LEGACY_FORMAT" /** - * \brief Tell SDL not to name threads on Windows. + * \brief Tell SDL not to name threads on Windows with the 0x406D1388 Exception. + * The 0x406D1388 Exception is a trick used to inform Visual Studio of a + * thread's name, but it tends to cause problems with other debuggers, + * and the .NET runtime. Note that SDL 2.0.6 and later will still use + * the (safer) SetThreadDescription API, introduced in the Windows 10 + * Creators Update, if available. * * The variable can be set to the following values: * "0" - SDL will raise the 0x406D1388 Exception to name threads. - * This is the default behavior of SDL <= 2.0.4. (default) - * "1" - SDL will not raise this exception, and threads will be unnamed. - * For .NET languages this is required when running under a debugger. + * This is the default behavior of SDL <= 2.0.4. + * "1" - SDL will not raise this exception, and threads will be unnamed. (default) + * This is necessary with .NET languages or debuggers that aren't Visual Studio. */ #define SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING "SDL_WINDOWS_DISABLE_THREAD_NAMING" @@ -707,6 +842,94 @@ extern "C" { */ #define SDL_HINT_RPI_VIDEO_LAYER "SDL_RPI_VIDEO_LAYER" +/** + * \brief Tell the video driver that we only want a double buffer. + * + * By default, most lowlevel 2D APIs will use a triple buffer scheme that + * wastes no CPU time on waiting for vsync after issuing a flip, but + * introduces a frame of latency. On the other hand, using a double buffer + * scheme instead is recommended for cases where low latency is an important + * factor because we save a whole frame of latency. + * We do so by waiting for vsync immediately after issuing a flip, usually just + * after eglSwapBuffers call in the backend's *_SwapWindow function. + * + * Since it's driver-specific, it's only supported where possible and + * implemented. Currently supported the following drivers: + * - KMSDRM (kmsdrm) + * - Raspberry Pi (raspberrypi) + */ +#define SDL_HINT_VIDEO_DOUBLE_BUFFER "SDL_VIDEO_DOUBLE_BUFFER" + +/** + * \brief A variable controlling what driver to use for OpenGL ES contexts. + * + * On some platforms, currently Windows and X11, OpenGL drivers may support + * creating contexts with an OpenGL ES profile. By default SDL uses these + * profiles, when available, otherwise it attempts to load an OpenGL ES + * library, e.g. that provided by the ANGLE project. This variable controls + * whether SDL follows this default behaviour or will always load an + * OpenGL ES library. + * + * Circumstances where this is useful include + * - Testing an app with a particular OpenGL ES implementation, e.g ANGLE, + * or emulator, e.g. those from ARM, Imagination or Qualcomm. + * - Resolving OpenGL ES function addresses at link time by linking with + * the OpenGL ES library instead of querying them at run time with + * SDL_GL_GetProcAddress(). + * + * Caution: for an application to work with the default behaviour across + * different OpenGL drivers it must query the OpenGL ES function + * addresses at run time using SDL_GL_GetProcAddress(). + * + * This variable is ignored on most platforms because OpenGL ES is native + * or not supported. + * + * This variable can be set to the following values: + * "0" - Use ES profile of OpenGL, if available. (Default when not set.) + * "1" - Load OpenGL ES library using the default library names. + * + */ +#define SDL_HINT_OPENGL_ES_DRIVER "SDL_OPENGL_ES_DRIVER" + +/** + * \brief A variable controlling speed/quality tradeoff of audio resampling. + * + * If available, SDL can use libsamplerate ( http://www.mega-nerd.com/SRC/ ) + * to handle audio resampling. There are different resampling modes available + * that produce different levels of quality, using more CPU. + * + * If this hint isn't specified to a valid setting, or libsamplerate isn't + * available, SDL will use the default, internal resampling algorithm. + * + * Note that this is currently only applicable to resampling audio that is + * being written to a device for playback or audio being read from a device + * for capture. SDL_AudioCVT always uses the default resampler (although this + * might change for SDL 2.1). + * + * This hint is currently only checked at audio subsystem initialization. + * + * This variable can be set to the following values: + * + * "0" or "default" - Use SDL's internal resampling (Default when not set - low quality, fast) + * "1" or "fast" - Use fast, slightly higher quality resampling, if available + * "2" or "medium" - Use medium quality resampling, if available + * "3" or "best" - Use high quality resampling, if available + */ +#define SDL_HINT_AUDIO_RESAMPLING_MODE "SDL_AUDIO_RESAMPLING_MODE" + +/** + * \brief A variable controlling the audio category on iOS and Mac OS X + * + * This variable can be set to the following values: + * + * "ambient" - Use the AVAudioSessionCategoryAmbient audio category, will be muted by the phone mute switch (default) + * "playback" - Use the AVAudioSessionCategoryPlayback category + * + * For more information, see Apple's documentation: + * https://developer.apple.com/library/content/documentation/Audio/Conceptual/AudioSessionProgrammingGuide/AudioSessionCategoriesandModes/AudioSessionCategoriesandModes.html + */ +#define SDL_HINT_AUDIO_CATEGORY "SDL_AUDIO_CATEGORY" + /** * \brief An enumeration of hint priorities */ @@ -753,6 +976,11 @@ extern DECLSPEC const char * SDLCALL SDL_GetHint(const char *name); */ extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool default_value); +/** + * \brief type definition of the hint callback function. + */ +typedef void (SDLCALL *SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue); + /** * \brief Add a function to watch a particular hint * @@ -760,7 +988,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetHintBoolean(const char *name, SDL_bool d * \param callback The function to call when the hint value changes * \param userdata A pointer to pass to the callback function */ -typedef void (*SDL_HintCallback)(void *userdata, const char *name, const char *oldValue, const char *newValue); extern DECLSPEC void SDLCALL SDL_AddHintCallback(const char *name, SDL_HintCallback callback, void *userdata); @@ -790,6 +1017,6 @@ extern DECLSPEC void SDLCALL SDL_ClearHints(void); #endif #include "close_code.h" -#endif /* _SDL_hints_h */ +#endif /* SDL_hints_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_joystick.h b/Engine/lib/sdl/include/SDL_joystick.h index f5dbc9487..f67772d71 100644 --- a/Engine/lib/sdl/include/SDL_joystick.h +++ b/Engine/lib/sdl/include/SDL_joystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,8 +36,8 @@ * */ -#ifndef _SDL_joystick_h -#define _SDL_joystick_h +#ifndef SDL_joystick_h_ +#define SDL_joystick_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -60,7 +60,9 @@ extern "C" { * SDL_Init(): SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS */ -/* The joystick structure used to identify an SDL joystick */ +/** + * The joystick structure used to identify an SDL joystick + */ struct _SDL_Joystick; typedef struct _SDL_Joystick SDL_Joystick; @@ -69,8 +71,29 @@ typedef struct { Uint8 data[16]; } SDL_JoystickGUID; +/** + * This is a unique ID for a joystick for the time it is connected to the system, + * and is never reused for the lifetime of the application. If the joystick is + * disconnected and reconnected, it will get a new ID. + * + * The ID value starts at 0 and increments from there. The value -1 is an invalid ID. + */ typedef Sint32 SDL_JoystickID; +typedef enum +{ + SDL_JOYSTICK_TYPE_UNKNOWN, + SDL_JOYSTICK_TYPE_GAMECONTROLLER, + SDL_JOYSTICK_TYPE_WHEEL, + SDL_JOYSTICK_TYPE_ARCADE_STICK, + SDL_JOYSTICK_TYPE_FLIGHT_STICK, + SDL_JOYSTICK_TYPE_DANCE_PAD, + SDL_JOYSTICK_TYPE_GUITAR, + SDL_JOYSTICK_TYPE_DRUM_KIT, + SDL_JOYSTICK_TYPE_ARCADE_PAD, + SDL_JOYSTICK_TYPE_THROTTLE +} SDL_JoystickType; + typedef enum { SDL_JOYSTICK_POWER_UNKNOWN = -1, @@ -83,6 +106,20 @@ typedef enum } SDL_JoystickPowerLevel; /* Function prototypes */ + +/** + * Locking for multi-threaded access to the joystick API + * + * If you are using the joystick API or handling events from multiple threads + * you should use these locking functions to protect access to the joysticks. + * + * In particular, you are guaranteed that the joystick list won't change, so + * the API functions that take a joystick index will be valid, and joystick + * and game controller events will not be delivered. + */ +extern DECLSPEC void SDLCALL SDL_LockJoysticks(void); +extern DECLSPEC void SDLCALL SDL_UnlockJoysticks(void); + /** * Count the number of joysticks attached to the system right now */ @@ -95,6 +132,46 @@ extern DECLSPEC int SDLCALL SDL_NumJoysticks(void); */ extern DECLSPEC const char *SDLCALL SDL_JoystickNameForIndex(int device_index); +/** + * Return the GUID for the joystick at this index + * This can be called before any joysticks are opened. + */ +extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index); + +/** + * Get the USB vendor ID of a joystick, if available. + * This can be called before any joysticks are opened. + * If the vendor ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceVendor(int device_index); + +/** + * Get the USB product ID of a joystick, if available. + * This can be called before any joysticks are opened. + * If the product ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProduct(int device_index); + +/** + * Get the product version of a joystick, if available. + * This can be called before any joysticks are opened. + * If the product version isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetDeviceProductVersion(int device_index); + +/** + * Get the type of a joystick, if available. + * This can be called before any joysticks are opened. + */ +extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetDeviceType(int device_index); + +/** + * Get the instance ID of a joystick. + * This can be called before any joysticks are opened. + * If the index is out of range, this function will return -1. + */ +extern DECLSPEC SDL_JoystickID SDLCALL SDL_JoystickGetDeviceInstanceID(int device_index); + /** * Open a joystick for use. * The index passed as an argument refers to the N'th joystick on the system. @@ -117,16 +194,34 @@ extern DECLSPEC SDL_Joystick *SDLCALL SDL_JoystickFromInstanceID(SDL_JoystickID */ extern DECLSPEC const char *SDLCALL SDL_JoystickName(SDL_Joystick * joystick); -/** - * Return the GUID for the joystick at this index - */ -extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetDeviceGUID(int device_index); - /** * Return the GUID for this opened joystick */ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joystick); +/** + * Get the USB vendor ID of an opened joystick, if available. + * If the vendor ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetVendor(SDL_Joystick * joystick); + +/** + * Get the USB product ID of an opened joystick, if available. + * If the product ID isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProduct(SDL_Joystick * joystick); + +/** + * Get the product version of an opened joystick, if available. + * If the product version isn't available this function returns 0. + */ +extern DECLSPEC Uint16 SDLCALL SDL_JoystickGetProductVersion(SDL_Joystick * joystick); + +/** + * Get the type of an opened joystick. + */ +extern DECLSPEC SDL_JoystickType SDLCALL SDL_JoystickGetType(SDL_Joystick * joystick); + /** * Return a string representation for this guid. pszGUID must point to at least 33 bytes * (32 for the string plus a NULL terminator). @@ -134,7 +229,7 @@ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUID(SDL_Joystick * joys extern DECLSPEC void SDLCALL SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID); /** - * convert a string into a joystick formatted guid + * Convert a string into a joystick guid */ extern DECLSPEC SDL_JoystickGUID SDLCALL SDL_JoystickGetGUIDFromString(const char *pchGUID); @@ -190,6 +285,8 @@ extern DECLSPEC void SDLCALL SDL_JoystickUpdate(void); */ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); +#define SDL_JOYSTICK_AXIS_MAX 32767 +#define SDL_JOYSTICK_AXIS_MIN -32768 /** * Get the current state of an axis control on a joystick. * @@ -200,6 +297,18 @@ extern DECLSPEC int SDLCALL SDL_JoystickEventState(int state); extern DECLSPEC Sint16 SDLCALL SDL_JoystickGetAxis(SDL_Joystick * joystick, int axis); +/** + * Get the initial state of an axis control on a joystick. + * + * The state is a value ranging from -32768 to 32767. + * + * The axis indices start at index 0. + * + * \return SDL_TRUE if this axis has any initial value, or SDL_FALSE if not. + */ +extern DECLSPEC SDL_bool SDLCALL SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick, + int axis, Sint16 *state); + /** * \name Hat positions */ @@ -268,6 +377,6 @@ extern DECLSPEC SDL_JoystickPowerLevel SDLCALL SDL_JoystickCurrentPowerLevel(SDL #endif #include "close_code.h" -#endif /* _SDL_joystick_h */ +#endif /* SDL_joystick_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_keyboard.h b/Engine/lib/sdl/include/SDL_keyboard.h index f80b6d2de..874823171 100644 --- a/Engine/lib/sdl/include/SDL_keyboard.h +++ b/Engine/lib/sdl/include/SDL_keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL keyboard event handling */ -#ifndef _SDL_keyboard_h -#define _SDL_keyboard_h +#ifndef SDL_keyboard_h_ +#define SDL_keyboard_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -212,6 +212,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IsScreenKeyboardShown(SDL_Window *window); #endif #include "close_code.h" -#endif /* _SDL_keyboard_h */ +#endif /* SDL_keyboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_keycode.h b/Engine/lib/sdl/include/SDL_keycode.h index 7be963571..d7d5b1dbc 100644 --- a/Engine/lib/sdl/include/SDL_keycode.h +++ b/Engine/lib/sdl/include/SDL_keycode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Defines constants which identify keyboard keys and modifiers. */ -#ifndef _SDL_keycode_h -#define _SDL_keycode_h +#ifndef SDL_keycode_h_ +#define SDL_keycode_h_ #include "SDL_stdinc.h" #include "SDL_scancode.h" @@ -38,6 +38,9 @@ * layout of the keyboard. These values include Unicode values representing * the unmodified character that would be generated by pressing the key, or * an SDLK_* constant for those keys that do not generate characters. + * + * A special exception is the number keys at the top of the keyboard which + * always map to SDLK_0...SDLK_9, regardless of layout. */ typedef Sint32 SDL_Keycode; @@ -308,7 +311,12 @@ enum SDLK_KBDILLUMDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMDOWN), SDLK_KBDILLUMUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_KBDILLUMUP), SDLK_EJECT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_EJECT), - SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP) + SDLK_SLEEP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_SLEEP), + SDLK_APP1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP1), + SDLK_APP2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_APP2), + + SDLK_AUDIOREWIND = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOREWIND), + SDLK_AUDIOFASTFORWARD = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_AUDIOFASTFORWARD) }; /** @@ -336,6 +344,6 @@ typedef enum #define KMOD_ALT (KMOD_LALT|KMOD_RALT) #define KMOD_GUI (KMOD_LGUI|KMOD_RGUI) -#endif /* _SDL_keycode_h */ +#endif /* SDL_keycode_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_loadso.h b/Engine/lib/sdl/include/SDL_loadso.h index 3d540bd7d..da56fb452 100644 --- a/Engine/lib/sdl/include/SDL_loadso.h +++ b/Engine/lib/sdl/include/SDL_loadso.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,8 +38,8 @@ * the results you expect. :) */ -#ifndef _SDL_loadso_h -#define _SDL_loadso_h +#ifndef SDL_loadso_h_ +#define SDL_loadso_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -76,6 +76,6 @@ extern DECLSPEC void SDLCALL SDL_UnloadObject(void *handle); #endif #include "close_code.h" -#endif /* _SDL_loadso_h */ +#endif /* SDL_loadso_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_log.h b/Engine/lib/sdl/include/SDL_log.h index 09be1104d..e12b65886 100644 --- a/Engine/lib/sdl/include/SDL_log.h +++ b/Engine/lib/sdl/include/SDL_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,8 +34,8 @@ * Others: standard error output (stderr) */ -#ifndef _SDL_log_h -#define _SDL_log_h +#ifndef SDL_log_h_ +#define SDL_log_h_ #include "SDL_stdinc.h" @@ -186,7 +186,7 @@ extern DECLSPEC void SDLCALL SDL_LogMessageV(int category, /** * \brief The prototype for the log output function */ -typedef void (*SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); +typedef void (SDLCALL *SDL_LogOutputFunction)(void *userdata, int category, SDL_LogPriority priority, const char *message); /** * \brief Get the current log output function. @@ -206,6 +206,6 @@ extern DECLSPEC void SDLCALL SDL_LogSetOutputFunction(SDL_LogOutputFunction call #endif #include "close_code.h" -#endif /* _SDL_log_h */ +#endif /* SDL_log_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_main.h b/Engine/lib/sdl/include/SDL_main.h index 67afea5e7..98558217f 100644 --- a/Engine/lib/sdl/include/SDL_main.h +++ b/Engine/lib/sdl/include/SDL_main.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_main_h -#define _SDL_main_h +#ifndef SDL_main_h_ +#define SDL_main_h_ #include "SDL_stdinc.h" @@ -63,10 +63,13 @@ /* On Android SDL provides a Java class in SDLActivity.java that is the main activity entry point. - See README-android.md for more details on extending that class. + See docs/README-android.md for more details on extending that class. */ #define SDL_MAIN_NEEDED +/* We need to export SDL_main so it can be launched from Java */ +#define SDLMAIN_DECLSPEC DECLSPEC + #elif defined(__NACL__) /* On NACL we use ppapi_simple to set up the application helper code, then wait for the first PSE_INSTANCE_DIDCHANGEVIEW event before @@ -85,6 +88,10 @@ #define C_LINKAGE #endif /* __cplusplus */ +#ifndef SDLMAIN_DECLSPEC +#define SDLMAIN_DECLSPEC +#endif + /** * \file SDL_main.h * @@ -107,7 +114,7 @@ /** * The prototype for the application's main() function */ -extern C_LINKAGE int SDL_main(int argc, char *argv[]); +extern C_LINKAGE SDLMAIN_DECLSPEC int SDL_main(int argc, char *argv[]); #include "begin_code.h" @@ -156,6 +163,6 @@ extern DECLSPEC int SDLCALL SDL_WinRTRunApp(int (*mainFunction)(int, char **), v #endif #include "close_code.h" -#endif /* _SDL_main_h */ +#endif /* SDL_main_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_messagebox.h b/Engine/lib/sdl/include/SDL_messagebox.h index ec370dbbe..b7be59d88 100644 --- a/Engine/lib/sdl/include/SDL_messagebox.h +++ b/Engine/lib/sdl/include/SDL_messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_messagebox_h -#define _SDL_messagebox_h +#ifndef SDL_messagebox_h_ +#define SDL_messagebox_h_ #include "SDL_stdinc.h" #include "SDL_video.h" /* For SDL_Window */ @@ -139,6 +139,6 @@ extern DECLSPEC int SDLCALL SDL_ShowSimpleMessageBox(Uint32 flags, const char *t #endif #include "close_code.h" -#endif /* _SDL_messagebox_h */ +#endif /* SDL_messagebox_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_mouse.h b/Engine/lib/sdl/include/SDL_mouse.h index 46f046d0c..d3c9f6156 100644 --- a/Engine/lib/sdl/include/SDL_mouse.h +++ b/Engine/lib/sdl/include/SDL_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL mouse event handling. */ -#ifndef _SDL_mouse_h -#define _SDL_mouse_h +#ifndef SDL_mouse_h_ +#define SDL_mouse_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -38,7 +38,7 @@ extern "C" { #endif -typedef struct SDL_Cursor SDL_Cursor; /* Implementation dependent */ +typedef struct SDL_Cursor SDL_Cursor; /**< Implementation dependent */ /** * \brief Cursor types for SDL_CreateSystemCursor(). @@ -297,6 +297,6 @@ extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle); #endif #include "close_code.h" -#endif /* _SDL_mouse_h */ +#endif /* SDL_mouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_mutex.h b/Engine/lib/sdl/include/SDL_mutex.h index b7e39734e..ba4247ced 100644 --- a/Engine/lib/sdl/include/SDL_mutex.h +++ b/Engine/lib/sdl/include/SDL_mutex.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_mutex_h -#define _SDL_mutex_h +#ifndef SDL_mutex_h_ +#define SDL_mutex_h_ /** * \file SDL_mutex.h @@ -246,6 +246,6 @@ extern DECLSPEC int SDLCALL SDL_CondWaitTimeout(SDL_cond * cond, #endif #include "close_code.h" -#endif /* _SDL_mutex_h */ +#endif /* SDL_mutex_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_name.h b/Engine/lib/sdl/include/SDL_name.h index 06cd4a5e2..ecd863f4c 100644 --- a/Engine/lib/sdl/include/SDL_name.h +++ b/Engine/lib/sdl/include/SDL_name.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDLname_h_ -#define _SDLname_h_ +#ifndef SDLname_h_ +#define SDLname_h_ #if defined(__STDC__) || defined(__cplusplus) #define NeedFunctionPrototypes 1 @@ -28,6 +28,6 @@ #define SDL_NAME(X) SDL_##X -#endif /* _SDLname_h_ */ +#endif /* SDLname_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_opengl.h b/Engine/lib/sdl/include/SDL_opengl.h index 780919bc4..253d9c93a 100644 --- a/Engine/lib/sdl/include/SDL_opengl.h +++ b/Engine/lib/sdl/include/SDL_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,8 +32,8 @@ * version included in SDL_opengl.h. */ -#ifndef _SDL_opengl_h -#define _SDL_opengl_h +#ifndef SDL_opengl_h_ +#define SDL_opengl_h_ #include "SDL_config.h" @@ -97,6 +97,13 @@ #elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */ # define GLAPI extern # define GLAPIENTRY __stdcall +#elif defined(__OS2__) || defined(__EMX__) /* native os/2 opengl */ +# define GLAPI extern +# define GLAPIENTRY _System +# define APIENTRY _System +# if defined(__GNUC__) && !defined(_System) +# define _System +# endif #elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)) # define GLAPI __attribute__((visibility("default"))) # define GLAPIENTRY @@ -2171,6 +2178,6 @@ typedef void (APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum t #endif /* !__IPHONEOS__ */ -#endif /* _SDL_opengl_h */ +#endif /* SDL_opengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_opengles.h b/Engine/lib/sdl/include/SDL_opengles.h index 15abee796..18dd984b3 100644 --- a/Engine/lib/sdl/include/SDL_opengles.h +++ b/Engine/lib/sdl/include/SDL_opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/include/SDL_opengles2.h b/Engine/lib/sdl/include/SDL_opengles2.h index c961f0f7d..6ccecf216 100644 --- a/Engine/lib/sdl/include/SDL_opengles2.h +++ b/Engine/lib/sdl/include/SDL_opengles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/include/SDL_pixels.h b/Engine/lib/sdl/include/SDL_pixels.h index cf6a33f08..0b4364b18 100644 --- a/Engine/lib/sdl/include/SDL_pixels.h +++ b/Engine/lib/sdl/include/SDL_pixels.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Header for the enumerated pixel format definitions. */ -#ifndef _SDL_pixels_h -#define _SDL_pixels_h +#ifndef SDL_pixels_h_ +#define SDL_pixels_h_ #include "SDL_stdinc.h" #include "SDL_endian.h" @@ -287,7 +287,9 @@ enum SDL_PIXELFORMAT_NV12 = /**< Planar mode: Y + U/V interleaved (2 planes) */ SDL_DEFINE_PIXELFOURCC('N', 'V', '1', '2'), SDL_PIXELFORMAT_NV21 = /**< Planar mode: Y + V/U interleaved (2 planes) */ - SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1') + SDL_DEFINE_PIXELFOURCC('N', 'V', '2', '1'), + SDL_PIXELFORMAT_EXTERNAL_OES = /**< Android video texture format */ + SDL_DEFINE_PIXELFOURCC('O', 'E', 'S', ' ') }; typedef struct SDL_Color @@ -463,6 +465,6 @@ extern DECLSPEC void SDLCALL SDL_CalculateGammaRamp(float gamma, Uint16 * ramp); #endif #include "close_code.h" -#endif /* _SDL_pixels_h */ +#endif /* SDL_pixels_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_platform.h b/Engine/lib/sdl/include/SDL_platform.h index 03cf17061..7dea4ce94 100644 --- a/Engine/lib/sdl/include/SDL_platform.h +++ b/Engine/lib/sdl/include/SDL_platform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Try to get a standard set of platform defines. */ -#ifndef _SDL_platform_h -#define _SDL_platform_h +#ifndef SDL_platform_h_ +#define SDL_platform_h_ #if defined(_AIX) #undef __AIX__ @@ -97,7 +97,7 @@ #undef __OPENBSD__ #define __OPENBSD__ 1 #endif -#if defined(__OS2__) +#if defined(__OS2__) || defined(__EMX__) #undef __OS2__ #define __OS2__ 1 #endif @@ -120,21 +120,34 @@ #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) /* Try to find out if we're compiling for WinRT or non-WinRT */ -/* If _USING_V110_SDK71_ is defined it means we are using the v110_xp or v120_xp toolset. */ -#if (defined(_MSC_VER) && (_MSC_VER >= 1700) && !_USING_V110_SDK71_) /* _MSC_VER==1700 for MSVC 2012 */ +#if defined(_MSC_VER) && defined(__has_include) +#if __has_include() +#define HAVE_WINAPIFAMILY_H 1 +#else +#define HAVE_WINAPIFAMILY_H 0 +#endif + +/* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */ +#elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */ +#define HAVE_WINAPIFAMILY_H 1 +#else +#define HAVE_WINAPIFAMILY_H 0 +#endif + +#if HAVE_WINAPIFAMILY_H #include -#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) -#undef __WINDOWS__ -#define __WINDOWS__ 1 -/* See if we're compiling for WinRT: */ -#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) +#define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)) +#else +#define WINAPI_FAMILY_WINRT 0 +#endif /* HAVE_WINAPIFAMILY_H */ + +#if WINAPI_FAMILY_WINRT #undef __WINRT__ #define __WINRT__ 1 -#endif #else #undef __WINDOWS__ -#define __WINDOWS__ 1 -#endif /* _MSC_VER < 1700 */ +#define __WINDOWS__ 1 +#endif #endif /* defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) */ #if defined(__WINDOWS__) @@ -180,6 +193,6 @@ extern DECLSPEC const char * SDLCALL SDL_GetPlatform (void); #endif #include "close_code.h" -#endif /* _SDL_platform_h */ +#endif /* SDL_platform_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_power.h b/Engine/lib/sdl/include/SDL_power.h index 24c050114..a4fe8a935 100644 --- a/Engine/lib/sdl/include/SDL_power.h +++ b/Engine/lib/sdl/include/SDL_power.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_power_h -#define _SDL_power_h +#ifndef SDL_power_h_ +#define SDL_power_h_ /** * \file SDL_power.h @@ -70,6 +70,6 @@ extern DECLSPEC SDL_PowerState SDLCALL SDL_GetPowerInfo(int *secs, int *pct); #endif #include "close_code.h" -#endif /* _SDL_power_h */ +#endif /* SDL_power_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_quit.h b/Engine/lib/sdl/include/SDL_quit.h index cc06f28d8..fea56a8d8 100644 --- a/Engine/lib/sdl/include/SDL_quit.h +++ b/Engine/lib/sdl/include/SDL_quit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL quit event handling. */ -#ifndef _SDL_quit_h -#define _SDL_quit_h +#ifndef SDL_quit_h_ +#define SDL_quit_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -55,4 +55,4 @@ #define SDL_QuitRequested() \ (SDL_PumpEvents(), (SDL_PeepEvents(NULL,0,SDL_PEEKEVENT,SDL_QUIT,SDL_QUIT) > 0)) -#endif /* _SDL_quit_h */ +#endif /* SDL_quit_h_ */ diff --git a/Engine/lib/sdl/include/SDL_rect.h b/Engine/lib/sdl/include/SDL_rect.h index bbcb9a3b8..543bb6186 100644 --- a/Engine/lib/sdl/include/SDL_rect.h +++ b/Engine/lib/sdl/include/SDL_rect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Header file for SDL_rect definition and management functions. */ -#ifndef _SDL_rect_h -#define _SDL_rect_h +#ifndef SDL_rect_h_ +#define SDL_rect_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -143,6 +143,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_IntersectRectAndLine(const SDL_Rect * #endif #include "close_code.h" -#endif /* _SDL_rect_h */ +#endif /* SDL_rect_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_render.h b/Engine/lib/sdl/include/SDL_render.h index 60c87b66a..d33619297 100644 --- a/Engine/lib/sdl/include/SDL_render.h +++ b/Engine/lib/sdl/include/SDL_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,8 +45,8 @@ * See this bug for details: http://bugzilla.libsdl.org/show_bug.cgi?id=1995 */ -#ifndef _SDL_render_h -#define _SDL_render_h +#ifndef SDL_render_h_ +#define SDL_render_h_ #include "SDL_stdinc.h" #include "SDL_rect.h" @@ -233,6 +233,8 @@ extern DECLSPEC int SDLCALL SDL_GetRendererOutputSize(SDL_Renderer * renderer, * active, the format was unsupported, or the width or height were out * of range. * + * \note The contents of the texture are not defined at creation. + * * \sa SDL_QueryTexture() * \sa SDL_UpdateTexture() * \sa SDL_DestroyTexture() @@ -370,9 +372,12 @@ extern DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture * texture, * \param texture The texture to update * \param rect A pointer to the rectangle of pixels to update, or NULL to * update the entire texture. - * \param pixels The raw pixel data. + * \param pixels The raw pixel data in the format of the texture. * \param pitch The number of bytes in a row of pixel data, including padding between lines. * + * The pixel data must be in the format of the texture. The pixel format can be + * queried with SDL_QueryTexture. + * * \return 0 on success, or -1 if the texture is not valid. * * \note This is a fairly slow function. @@ -816,7 +821,7 @@ extern DECLSPEC int SDLCALL SDL_RenderCopy(SDL_Renderer * renderer, * texture. * \param dstrect A pointer to the destination rectangle, or NULL for the * entire rendering target. - * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect + * \param angle An angle in degrees that indicates the rotation that will be applied to dstrect, rotating it in a clockwise direction * \param center A pointer to a point indicating the point around which dstrect will be rotated (if NULL, rotation will be done around dstrect.w/2, dstrect.h/2). * \param flip An SDL_RendererFlip value stating which flipping actions should be performed on the texture * @@ -893,6 +898,27 @@ extern DECLSPEC int SDLCALL SDL_GL_BindTexture(SDL_Texture *texture, float *texw */ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture); +/** + * \brief Get the CAMetalLayer associated with the given Metal renderer + * + * \param renderer The renderer to query + * + * \return CAMetalLayer* on success, or NULL if the renderer isn't a Metal renderer + * + * \sa SDL_RenderGetMetalCommandEncoder() + */ +extern DECLSPEC void *SDLCALL SDL_RenderGetMetalLayer(SDL_Renderer * renderer); + +/** + * \brief Get the Metal command encoder for the current frame + * + * \param renderer The renderer to query + * + * \return id on success, or NULL if the renderer isn't a Metal renderer + * + * \sa SDL_RenderGetMetalLayer() + */ +extern DECLSPEC void *SDLCALL SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer); /* Ends C function definitions when using C++ */ #ifdef __cplusplus @@ -900,6 +926,6 @@ extern DECLSPEC int SDLCALL SDL_GL_UnbindTexture(SDL_Texture *texture); #endif #include "close_code.h" -#endif /* _SDL_render_h */ +#endif /* SDL_render_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_revision.h b/Engine/lib/sdl/include/SDL_revision.h index 341dc5cce..dbe9b97d5 100644 --- a/Engine/lib/sdl/include/SDL_revision.h +++ b/Engine/lib/sdl/include/SDL_revision.h @@ -1,2 +1,2 @@ -#define SDL_REVISION "hg-10556:007dfe83abf8" -#define SDL_REVISION_NUMBER 10556 +#define SDL_REVISION "hg-11914:f1084c419f33" +#define SDL_REVISION_NUMBER 11914 diff --git a/Engine/lib/sdl/include/SDL_rwops.h b/Engine/lib/sdl/include/SDL_rwops.h index 1ad3ac406..0960699d4 100644 --- a/Engine/lib/sdl/include/SDL_rwops.h +++ b/Engine/lib/sdl/include/SDL_rwops.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,8 +26,8 @@ * data streams. It can easily be extended to files, memory, etc. */ -#ifndef _SDL_rwops_h -#define _SDL_rwops_h +#ifndef SDL_rwops_h_ +#define SDL_rwops_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -39,12 +39,12 @@ extern "C" { #endif /* RWops Types */ -#define SDL_RWOPS_UNKNOWN 0U /* Unknown stream type */ -#define SDL_RWOPS_WINFILE 1U /* Win32 file */ -#define SDL_RWOPS_STDFILE 2U /* Stdio file */ -#define SDL_RWOPS_JNIFILE 3U /* Android asset */ -#define SDL_RWOPS_MEMORY 4U /* Memory stream */ -#define SDL_RWOPS_MEMORY_RO 5U /* Read-Only memory stream */ +#define SDL_RWOPS_UNKNOWN 0U /**< Unknown stream type */ +#define SDL_RWOPS_WINFILE 1U /**< Win32 file */ +#define SDL_RWOPS_STDFILE 2U /**< Stdio file */ +#define SDL_RWOPS_JNIFILE 3U /**< Android asset */ +#define SDL_RWOPS_MEMORY 4U /**< Memory stream */ +#define SDL_RWOPS_MEMORY_RO 5U /**< Read-Only memory stream */ /** * This is the read/write operation structure -- very basic. @@ -190,6 +190,29 @@ extern DECLSPEC void SDLCALL SDL_FreeRW(SDL_RWops * area); /* @} *//* Read/write macros */ +/** + * Load all the data from an SDL data stream. + * + * The data is allocated with a zero byte at the end (null terminated) + * + * If \c datasize is not NULL, it is filled with the size of the data read. + * + * If \c freesrc is non-zero, the stream will be closed after being read. + * + * The data should be freed with SDL_free(). + * + * \return the data, or NULL if there was an error. + */ +extern DECLSPEC void *SDLCALL SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize, + int freesrc); + +/** + * Load an entire file. + * + * Convenience macro. + */ +#define SDL_LoadFile(file, datasize) SDL_LoadFile_RW(SDL_RWFromFile(file, "rb"), datasize, 1) + /** * \name Read endian functions * @@ -226,6 +249,6 @@ extern DECLSPEC size_t SDLCALL SDL_WriteBE64(SDL_RWops * dst, Uint64 value); #endif #include "close_code.h" -#endif /* _SDL_rwops_h */ +#endif /* SDL_rwops_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_scancode.h b/Engine/lib/sdl/include/SDL_scancode.h index 0af1dd59f..63871aa3b 100644 --- a/Engine/lib/sdl/include/SDL_scancode.h +++ b/Engine/lib/sdl/include/SDL_scancode.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Defines keyboard scancodes. */ -#ifndef _SDL_scancode_h -#define _SDL_scancode_h +#ifndef SDL_scancode_h_ +#define SDL_scancode_h_ #include "SDL_stdinc.h" @@ -38,7 +38,7 @@ * SDL_Event structure. * * The values in this enumeration are based on the USB usage page standard: - * http://www.usb.org/developers/devclass_docs/Hut1_12v2.pdf + * http://www.usb.org/developers/hidpage/Hut1_12v2.pdf */ typedef enum { @@ -390,12 +390,24 @@ typedef enum /* @} *//* Walther keys */ + /** + * \name Usage page 0x0C (additional media keys) + * + * These values are mapped from usage page 0x0C (USB consumer page). + */ + /* @{ */ + + SDL_SCANCODE_AUDIOREWIND = 285, + SDL_SCANCODE_AUDIOFASTFORWARD = 286, + + /* @} *//* Usage page 0x0C (additional media keys) */ + /* Add any other keys here. */ SDL_NUM_SCANCODES = 512 /**< not a key, just marks the number of scancodes for array bounds */ } SDL_Scancode; -#endif /* _SDL_scancode_h */ +#endif /* SDL_scancode_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_shape.h b/Engine/lib/sdl/include/SDL_shape.h index db10a8f01..40a6baaae 100644 --- a/Engine/lib/sdl/include/SDL_shape.h +++ b/Engine/lib/sdl/include/SDL_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_shape_h -#define _SDL_shape_h +#ifndef SDL_shape_h_ +#define SDL_shape_h_ #include "SDL_stdinc.h" #include "SDL_pixels.h" @@ -71,6 +71,7 @@ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateShapedWindow(const char *title,un * \param window The window to query for being shaped. * * \return SDL_TRUE if the window is a window that can be shaped, SDL_FALSE if the window is unshaped or NULL. + * * \sa SDL_CreateShapedWindow */ extern DECLSPEC SDL_bool SDLCALL SDL_IsShapedWindow(const SDL_Window *window); @@ -91,7 +92,7 @@ typedef enum { /** \brief A union containing parameters for shaped windows. */ typedef union { - /** \brief a cutoff alpha value for binarization of the window shape's alpha channel. */ + /** \brief A cutoff alpha value for binarization of the window shape's alpha channel. */ Uint8 binarizationCutoff; SDL_Color colorKey; } SDL_WindowShapeParams; @@ -111,8 +112,8 @@ typedef struct SDL_WindowShapeMode { * \param shape A surface encoding the desired shape for the window. * \param shape_mode The parameters to set for the shaped window. * - * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on invalid an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW - * if the SDL_Window* given does not reference a valid shaped window. + * \return 0 on success, SDL_INVALID_SHAPE_ARGUMENT on an invalid shape argument, or SDL_NONSHAPEABLE_WINDOW + * if the SDL_Window given does not reference a valid shaped window. * * \sa SDL_WindowShapeMode * \sa SDL_GetShapedWindowMode. @@ -127,7 +128,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowShape(SDL_Window *window,SDL_Surface *s * * \return 0 if the window has a shape and, provided shape_mode was not NULL, shape_mode has been filled with the mode * data, SDL_NONSHAPEABLE_WINDOW if the SDL_Window given is not a shaped window, or SDL_WINDOW_LACKS_SHAPE if - * the SDL_Window* given is a shapeable window currently lacking a shape. + * the SDL_Window given is a shapeable window currently lacking a shape. * * \sa SDL_WindowShapeMode * \sa SDL_SetWindowShape @@ -140,4 +141,4 @@ extern DECLSPEC int SDLCALL SDL_GetShapedWindowMode(SDL_Window *window,SDL_Windo #endif #include "close_code.h" -#endif /* _SDL_shape_h */ +#endif /* SDL_shape_h_ */ diff --git a/Engine/lib/sdl/include/SDL_stdinc.h b/Engine/lib/sdl/include/SDL_stdinc.h index fdf96415f..111a0645e 100644 --- a/Engine/lib/sdl/include/SDL_stdinc.h +++ b/Engine/lib/sdl/include/SDL_stdinc.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * This is a general header that includes C language support. */ -#ifndef _SDL_stdinc_h -#define _SDL_stdinc_h +#ifndef SDL_stdinc_h_ +#define SDL_stdinc_h_ #include "SDL_config.h" @@ -62,6 +62,9 @@ #ifdef HAVE_STRINGS_H # include #endif +#ifdef HAVE_WCHAR_H +# include +#endif #if defined(HAVE_INTTYPES_H) # include #elif defined(HAVE_STDINT_H) @@ -127,44 +130,67 @@ */ /* @{ */ +#ifdef __CC_ARM +/* ARM's compiler throws warnings if we use an enum: like "SDL_bool x = a < b;" */ +#define SDL_FALSE 0 +#define SDL_TRUE 1 +typedef int SDL_bool; +#else typedef enum { SDL_FALSE = 0, SDL_TRUE = 1 } SDL_bool; +#endif /** * \brief A signed 8-bit integer type. */ +#define SDL_MAX_SINT8 ((Sint8)0x7F) /* 127 */ +#define SDL_MIN_SINT8 ((Sint8)(~0x7F)) /* -128 */ typedef int8_t Sint8; /** * \brief An unsigned 8-bit integer type. */ +#define SDL_MAX_UINT8 ((Uint8)0xFF) /* 255 */ +#define SDL_MIN_UINT8 ((Uint8)0x00) /* 0 */ typedef uint8_t Uint8; /** * \brief A signed 16-bit integer type. */ +#define SDL_MAX_SINT16 ((Sint16)0x7FFF) /* 32767 */ +#define SDL_MIN_SINT16 ((Sint16)(~0x7FFF)) /* -32768 */ typedef int16_t Sint16; /** * \brief An unsigned 16-bit integer type. */ +#define SDL_MAX_UINT16 ((Uint16)0xFFFF) /* 65535 */ +#define SDL_MIN_UINT16 ((Uint16)0x0000) /* 0 */ typedef uint16_t Uint16; /** * \brief A signed 32-bit integer type. */ +#define SDL_MAX_SINT32 ((Sint32)0x7FFFFFFF) /* 2147483647 */ +#define SDL_MIN_SINT32 ((Sint32)(~0x7FFFFFFF)) /* -2147483648 */ typedef int32_t Sint32; /** * \brief An unsigned 32-bit integer type. */ +#define SDL_MAX_UINT32 ((Uint32)0xFFFFFFFFu) /* 4294967295 */ +#define SDL_MIN_UINT32 ((Uint32)0x00000000) /* 0 */ typedef uint32_t Uint32; /** * \brief A signed 64-bit integer type. */ +#define SDL_MAX_SINT64 ((Sint64)0x7FFFFFFFFFFFFFFFll) /* 9223372036854775807 */ +#define SDL_MIN_SINT64 ((Sint64)(~0x7FFFFFFFFFFFFFFFll)) /* -9223372036854775808 */ typedef int64_t Sint64; /** * \brief An unsigned 64-bit integer type. */ +#define SDL_MAX_UINT64 ((Uint64)0xFFFFFFFFFFFFFFFFull) /* 18446744073709551615 */ +#define SDL_MIN_UINT64 ((Uint64)(0x0000000000000000ull)) /* 0 */ typedef uint64_t Uint64; /* @} *//* Basic data types */ @@ -262,7 +288,7 @@ typedef uint64_t Uint64; #endif /* SDL_DISABLE_ANALYZE_MACROS */ #define SDL_COMPILE_TIME_ASSERT(name, x) \ - typedef int SDL_dummy_ ## name[(x) * 2 - 1] + typedef int SDL_compile_time_assert_ ## name[(x) * 2 - 1] /** \cond */ #ifndef DOXYGEN_SHOULD_IGNORE_THIS SDL_COMPILE_TIME_ASSERT(uint8, sizeof(Uint8) == 1); @@ -337,6 +363,37 @@ extern DECLSPEC void *SDLCALL SDL_calloc(size_t nmemb, size_t size); extern DECLSPEC void *SDLCALL SDL_realloc(void *mem, size_t size); extern DECLSPEC void SDLCALL SDL_free(void *mem); +typedef void *(SDLCALL *SDL_malloc_func)(size_t size); +typedef void *(SDLCALL *SDL_calloc_func)(size_t nmemb, size_t size); +typedef void *(SDLCALL *SDL_realloc_func)(void *mem, size_t size); +typedef void (SDLCALL *SDL_free_func)(void *mem); + +/** + * \brief Get the current set of SDL memory functions + */ +extern DECLSPEC void SDLCALL SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func, + SDL_calloc_func *calloc_func, + SDL_realloc_func *realloc_func, + SDL_free_func *free_func); + +/** + * \brief Replace SDL's memory allocation functions with a custom set + * + * \note If you are replacing SDL's memory functions, you should call + * SDL_GetNumAllocations() and be very careful if it returns non-zero. + * That means that your free function will be called with memory + * allocated by the previous memory allocation functions. + */ +extern DECLSPEC int SDLCALL SDL_SetMemoryFunctions(SDL_malloc_func malloc_func, + SDL_calloc_func calloc_func, + SDL_realloc_func realloc_func, + SDL_free_func free_func); + +/** + * \brief Get the number of outstanding (unfreed) allocations + */ +extern DECLSPEC int SDLCALL SDL_GetNumAllocations(void); + extern DECLSPEC char *SDLCALL SDL_getenv(const char *name); extern DECLSPEC int SDLCALL SDL_setenv(const char *name, const char *value, int overwrite); @@ -379,10 +436,10 @@ SDL_FORCE_INLINE void SDL_memset4(void *dst, Uint32 val, size_t dwords) return; switch (dwords % 4) { - case 0: do { *_p++ = _val; - case 3: *_p++ = _val; - case 2: *_p++ = _val; - case 1: *_p++ = _val; + case 0: do { *_p++ = _val; /* fallthrough */ + case 3: *_p++ = _val; /* fallthrough */ + case 2: *_p++ = _val; /* fallthrough */ + case 1: *_p++ = _val; /* fallthrough */ } while ( --_n ); } #endif @@ -397,6 +454,7 @@ extern DECLSPEC int SDLCALL SDL_memcmp(const void *s1, const void *s2, size_t le extern DECLSPEC size_t SDLCALL SDL_wcslen(const wchar_t *wstr); extern DECLSPEC size_t SDLCALL SDL_wcslcpy(SDL_OUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); extern DECLSPEC size_t SDLCALL SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t maxlen); +extern DECLSPEC int SDLCALL SDL_wcscmp(const wchar_t *str1, const wchar_t *str2); extern DECLSPEC size_t SDLCALL SDL_strlen(const char *str); extern DECLSPEC size_t SDLCALL SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen); @@ -409,6 +467,7 @@ extern DECLSPEC char *SDLCALL SDL_strlwr(char *str); extern DECLSPEC char *SDLCALL SDL_strchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strrchr(const char *str, int c); extern DECLSPEC char *SDLCALL SDL_strstr(const char *haystack, const char *needle); +extern DECLSPEC size_t SDLCALL SDL_utf8strlen(const char *str); extern DECLSPEC char *SDLCALL SDL_itoa(int value, char *str, int radix); extern DECLSPEC char *SDLCALL SDL_uitoa(unsigned int value, char *str, int radix); @@ -437,23 +496,38 @@ extern DECLSPEC int SDLCALL SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size #ifndef HAVE_M_PI #ifndef M_PI -#define M_PI 3.14159265358979323846264338327950288 /* pi */ +#define M_PI 3.14159265358979323846264338327950288 /**< pi */ #endif #endif extern DECLSPEC double SDLCALL SDL_acos(double x); +extern DECLSPEC float SDLCALL SDL_acosf(float x); extern DECLSPEC double SDLCALL SDL_asin(double x); +extern DECLSPEC float SDLCALL SDL_asinf(float x); extern DECLSPEC double SDLCALL SDL_atan(double x); +extern DECLSPEC float SDLCALL SDL_atanf(float x); extern DECLSPEC double SDLCALL SDL_atan2(double x, double y); +extern DECLSPEC float SDLCALL SDL_atan2f(float x, float y); extern DECLSPEC double SDLCALL SDL_ceil(double x); +extern DECLSPEC float SDLCALL SDL_ceilf(float x); extern DECLSPEC double SDLCALL SDL_copysign(double x, double y); +extern DECLSPEC float SDLCALL SDL_copysignf(float x, float y); extern DECLSPEC double SDLCALL SDL_cos(double x); extern DECLSPEC float SDLCALL SDL_cosf(float x); extern DECLSPEC double SDLCALL SDL_fabs(double x); +extern DECLSPEC float SDLCALL SDL_fabsf(float x); extern DECLSPEC double SDLCALL SDL_floor(double x); +extern DECLSPEC float SDLCALL SDL_floorf(float x); +extern DECLSPEC double SDLCALL SDL_fmod(double x, double y); +extern DECLSPEC float SDLCALL SDL_fmodf(float x, float y); extern DECLSPEC double SDLCALL SDL_log(double x); +extern DECLSPEC float SDLCALL SDL_logf(float x); +extern DECLSPEC double SDLCALL SDL_log10(double x); +extern DECLSPEC float SDLCALL SDL_log10f(float x); extern DECLSPEC double SDLCALL SDL_pow(double x, double y); +extern DECLSPEC float SDLCALL SDL_powf(float x, float y); extern DECLSPEC double SDLCALL SDL_scalbn(double x, int n); +extern DECLSPEC float SDLCALL SDL_scalbnf(float x, int n); extern DECLSPEC double SDLCALL SDL_sin(double x); extern DECLSPEC float SDLCALL SDL_sinf(float x); extern DECLSPEC double SDLCALL SDL_sqrt(double x); @@ -526,6 +600,6 @@ SDL_FORCE_INLINE void *SDL_memcpy4(SDL_OUT_BYTECAP(dwords*4) void *dst, SDL_IN_B #endif #include "close_code.h" -#endif /* _SDL_stdinc_h */ +#endif /* SDL_stdinc_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_surface.h b/Engine/lib/sdl/include/SDL_surface.h index e4a06a204..45e5366fe 100644 --- a/Engine/lib/sdl/include/SDL_surface.h +++ b/Engine/lib/sdl/include/SDL_surface.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Header file for ::SDL_Surface definition and management functions. */ -#ifndef _SDL_surface_h -#define _SDL_surface_h +#ifndef SDL_surface_h_ +#define SDL_surface_h_ #include "SDL_stdinc.h" #include "SDL_pixels.h" @@ -94,8 +94,19 @@ typedef struct SDL_Surface /** * \brief The type of function used for surface blitting functions. */ -typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, - struct SDL_Surface * dst, SDL_Rect * dstrect); +typedef int (SDLCALL *SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, + struct SDL_Surface * dst, SDL_Rect * dstrect); + +/** + * \brief The formula used for converting between YUV and RGB + */ +typedef enum +{ + SDL_YUV_CONVERSION_JPEG, /**< Full range JPEG */ + SDL_YUV_CONVERSION_BT601, /**< BT.601 (the default) */ + SDL_YUV_CONVERSION_BT709, /**< BT.709 */ + SDL_YUV_CONVERSION_AUTOMATIC /**< BT.601 for SD content, BT.709 for HD content */ +} SDL_YUV_CONVERSION_MODE; /** * Allocate and free an RGB surface. @@ -118,8 +129,11 @@ typedef int (*SDL_blit) (struct SDL_Surface * src, SDL_Rect * srcrect, extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface (Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask); + +/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat (Uint32 flags, int width, int height, int depth, Uint32 format); + extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels, int width, int height, @@ -356,6 +370,11 @@ extern DECLSPEC SDL_bool SDLCALL SDL_SetClipRect(SDL_Surface * surface, extern DECLSPEC void SDLCALL SDL_GetClipRect(SDL_Surface * surface, SDL_Rect * rect); +/* + * Creates a new surface identical to the existing surface + */ +extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface); + /** * Creates a new surface of the specified format, and then copies and maps * the given surface to it so the blit of the converted surface will be as @@ -501,6 +520,20 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled (SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect); +/** + * \brief Set the YUV conversion mode + */ +extern DECLSPEC void SDLCALL SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode); + +/** + * \brief Get the YUV conversion mode + */ +extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionMode(void); + +/** + * \brief Get the YUV conversion mode, returning the correct mode for the resolution when the current conversion mode is SDL_YUV_CONVERSION_AUTOMATIC + */ +extern DECLSPEC SDL_YUV_CONVERSION_MODE SDLCALL SDL_GetYUVConversionModeForResolution(int width, int height); /* Ends C function definitions when using C++ */ #ifdef __cplusplus @@ -508,6 +541,6 @@ extern DECLSPEC int SDLCALL SDL_LowerBlitScaled #endif #include "close_code.h" -#endif /* _SDL_surface_h */ +#endif /* SDL_surface_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_system.h b/Engine/lib/sdl/include/SDL_system.h index 5da9adb45..7b776fdf1 100644 --- a/Engine/lib/sdl/include/SDL_system.h +++ b/Engine/lib/sdl/include/SDL_system.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for platform specific SDL API functions */ -#ifndef _SDL_system_h -#define _SDL_system_h +#ifndef SDL_system_h_ +#define SDL_system_h_ #include "SDL_stdinc.h" #include "SDL_keyboard.h" @@ -96,7 +96,7 @@ extern DECLSPEC void SDLCALL SDL_iPhoneSetEventPump(SDL_bool enabled); This returns JNIEnv*, but the prototype is void* so we don't need jni.h */ -extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(); +extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(void); /** \brief Get the SDL Activity object for the application @@ -106,7 +106,12 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetJNIEnv(); It is the caller's responsibility to properly release it (using env->Push/PopLocalFrame or manually with env->DeleteLocalRef) */ -extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(); +extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(void); + +/** + \brief Return true if the application is running on Android TV + */ +extern DECLSPEC SDL_bool SDLCALL SDL_IsAndroidTV(void); /** See the official Android developer guide for more information: @@ -121,7 +126,7 @@ extern DECLSPEC void * SDLCALL SDL_AndroidGetActivity(); This path is unique to your application and cannot be written to by other applications. */ -extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(); +extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(void); /** \brief Get the current state of external storage, a bitmask of these values: @@ -130,7 +135,7 @@ extern DECLSPEC const char * SDLCALL SDL_AndroidGetInternalStoragePath(); If external storage is currently unavailable, this will return 0. */ -extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(); +extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(void); /** \brief Get the path used for external storage for this application. @@ -138,7 +143,7 @@ extern DECLSPEC int SDLCALL SDL_AndroidGetExternalStorageState(); This path is unique to your application, but is public and can be written to by other applications. */ -extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(); +extern DECLSPEC const char * SDLCALL SDL_AndroidGetExternalStoragePath(void); #endif /* __ANDROID__ */ @@ -169,6 +174,25 @@ typedef enum } SDL_WinRT_Path; +/** + * \brief WinRT Device Family + */ +typedef enum +{ + /** \brief Unknown family */ + SDL_WINRT_DEVICEFAMILY_UNKNOWN, + + /** \brief Desktop family*/ + SDL_WINRT_DEVICEFAMILY_DESKTOP, + + /** \brief Mobile family (for example smartphone) */ + SDL_WINRT_DEVICEFAMILY_MOBILE, + + /** \brief XBox family */ + SDL_WINRT_DEVICEFAMILY_XBOX, +} SDL_WinRT_DeviceFamily; + + /** * \brief Retrieves a WinRT defined path on the local file system * @@ -203,6 +227,13 @@ extern DECLSPEC const wchar_t * SDLCALL SDL_WinRTGetFSPathUNICODE(SDL_WinRT_Path */ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathType); +/** + * \brief Detects the device family of WinRT plattform on runtime + * + * \return Device family + */ +extern DECLSPEC SDL_WinRT_DeviceFamily SDLCALL SDL_WinRTGetDeviceFamily(); + #endif /* __WINRT__ */ /* Ends C function definitions when using C++ */ @@ -211,6 +242,6 @@ extern DECLSPEC const char * SDLCALL SDL_WinRTGetFSPathUTF8(SDL_WinRT_Path pathT #endif #include "close_code.h" -#endif /* _SDL_system_h */ +#endif /* SDL_system_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_syswm.h b/Engine/lib/sdl/include/SDL_syswm.h index 71ba5f1f3..8aa4a39ec 100644 --- a/Engine/lib/sdl/include/SDL_syswm.h +++ b/Engine/lib/sdl/include/SDL_syswm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL custom system window manager hooks. */ -#ifndef _SDL_syswm_h -#define _SDL_syswm_h +#ifndef SDL_syswm_h_ +#define SDL_syswm_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -125,7 +125,8 @@ typedef enum SDL_SYSWM_MIR, SDL_SYSWM_WINRT, SDL_SYSWM_ANDROID, - SDL_SYSWM_VIVANTE + SDL_SYSWM_VIVANTE, + SDL_SYSWM_OS2 } SDL_SYSWM_TYPE; /** @@ -201,6 +202,7 @@ struct SDL_SysWMinfo { HWND window; /**< The window handle */ HDC hdc; /**< The window device context */ + HINSTANCE hinstance; /**< The instance handle */ } win; #endif #if defined(SDL_VIDEO_DRIVER_WINRT) @@ -228,9 +230,9 @@ struct SDL_SysWMinfo struct { #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc) - NSWindow __unsafe_unretained *window; /* The Cocoa window */ + NSWindow __unsafe_unretained *window; /**< The Cocoa window */ #else - NSWindow *window; /* The Cocoa window */ + NSWindow *window; /**< The Cocoa window */ #endif } cocoa; #endif @@ -238,13 +240,13 @@ struct SDL_SysWMinfo struct { #if defined(__OBJC__) && defined(__has_feature) && __has_feature(objc_arc) - UIWindow __unsafe_unretained *window; /* The UIKit window */ + UIWindow __unsafe_unretained *window; /**< The UIKit window */ #else - UIWindow *window; /* The UIKit window */ + UIWindow *window; /**< The UIKit window */ #endif - GLuint framebuffer; /* The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */ - GLuint colorbuffer; /* The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */ - GLuint resolveFramebuffer; /* The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */ + GLuint framebuffer; /**< The GL view's Framebuffer Object. It must be bound when rendering to the screen using GL. */ + GLuint colorbuffer; /**< The GL view's color Renderbuffer Object. It must be bound when SDL_GL_SwapWindow is called. */ + GLuint resolveFramebuffer; /**< The Framebuffer Object which holds the resolve color Renderbuffer, when MSAA is used. */ } uikit; #endif #if defined(SDL_VIDEO_DRIVER_WAYLAND) @@ -279,8 +281,9 @@ struct SDL_SysWMinfo } vivante; #endif - /* Can't have an empty union */ - int dummy; + /* Make sure this union is always 64 bytes (8 64-bit pointers). */ + /* Be careful not to overflow this if you add a new target! */ + Uint8 dummy[64]; } info; }; @@ -316,6 +319,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_GetWindowWMInfo(SDL_Window * window, #endif #include "close_code.h" -#endif /* _SDL_syswm_h */ +#endif /* SDL_syswm_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test.h b/Engine/lib/sdl/include/SDL_test.h index 217847bfc..6cc373bf8 100644 --- a/Engine/lib/sdl/include/SDL_test.h +++ b/Engine/lib/sdl/include/SDL_test.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,21 +27,22 @@ * This code is a part of the SDL2_test library, not the main SDL library. */ -#ifndef _SDL_test_h -#define _SDL_test_h +#ifndef SDL_test_h_ +#define SDL_test_h_ #include "SDL.h" -#include "SDL_test_common.h" -#include "SDL_test_font.h" -#include "SDL_test_random.h" -#include "SDL_test_fuzzer.h" -#include "SDL_test_crc32.h" -#include "SDL_test_md5.h" -#include "SDL_test_log.h" #include "SDL_test_assert.h" +#include "SDL_test_common.h" +#include "SDL_test_compare.h" +#include "SDL_test_crc32.h" +#include "SDL_test_font.h" +#include "SDL_test_fuzzer.h" #include "SDL_test_harness.h" #include "SDL_test_images.h" -#include "SDL_test_compare.h" +#include "SDL_test_log.h" +#include "SDL_test_md5.h" +#include "SDL_test_memory.h" +#include "SDL_test_random.h" #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -63,6 +64,6 @@ extern "C" { #endif #include "close_code.h" -#endif /* _SDL_test_h */ +#endif /* SDL_test_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_assert.h b/Engine/lib/sdl/include/SDL_test_assert.h index 29277e122..1788d7a20 100644 --- a/Engine/lib/sdl/include/SDL_test_assert.h +++ b/Engine/lib/sdl/include/SDL_test_assert.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ * */ -#ifndef _SDL_test_assert_h -#define _SDL_test_assert_h +#ifndef SDL_test_assert_h_ +#define SDL_test_assert_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -80,12 +80,12 @@ void SDLTest_AssertPass(SDL_PRINTF_FORMAT_STRING const char *assertDescription, /** * \brief Resets the assert summary counters to zero. */ -void SDLTest_ResetAssertSummary(); +void SDLTest_ResetAssertSummary(void); /** * \brief Logs summary of all assertions (total, pass, fail) since last reset as INFO or ERROR. */ -void SDLTest_LogAssertSummary(); +void SDLTest_LogAssertSummary(void); /** @@ -93,13 +93,13 @@ void SDLTest_LogAssertSummary(); * * \returns TEST_RESULT_PASSED, TEST_RESULT_FAILED, or TEST_RESULT_NO_ASSERT */ -int SDLTest_AssertSummaryToTestResult(); +int SDLTest_AssertSummaryToTestResult(void); #ifdef __cplusplus } #endif #include "close_code.h" -#endif /* _SDL_test_assert_h */ +#endif /* SDL_test_assert_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_common.h b/Engine/lib/sdl/include/SDL_test_common.h index 0ebf31cb6..be2e6b2aa 100644 --- a/Engine/lib/sdl/include/SDL_test_common.h +++ b/Engine/lib/sdl/include/SDL_test_common.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,8 +29,8 @@ /* Ported from original test\common.h file. */ -#ifndef _SDL_test_common_h -#define _SDL_test_common_h +#ifndef SDL_test_common_h_ +#define SDL_test_common_h_ #include "SDL.h" @@ -183,6 +183,6 @@ void SDLTest_CommonQuit(SDLTest_CommonState * state); #endif #include "close_code.h" -#endif /* _SDL_test_common_h */ +#endif /* SDL_test_common_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_compare.h b/Engine/lib/sdl/include/SDL_test_compare.h index 772cf9fbd..c22e447d8 100644 --- a/Engine/lib/sdl/include/SDL_test_compare.h +++ b/Engine/lib/sdl/include/SDL_test_compare.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ */ -#ifndef _SDL_test_compare_h -#define _SDL_test_compare_h +#ifndef SDL_test_compare_h_ +#define SDL_test_compare_h_ #include "SDL.h" @@ -64,6 +64,6 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, #endif #include "close_code.h" -#endif /* _SDL_test_compare_h */ +#endif /* SDL_test_compare_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_crc32.h b/Engine/lib/sdl/include/SDL_test_crc32.h index 572a3d955..3d235d074 100644 --- a/Engine/lib/sdl/include/SDL_test_crc32.h +++ b/Engine/lib/sdl/include/SDL_test_crc32.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ */ -#ifndef _SDL_test_crc32_h -#define _SDL_test_crc32_h +#ifndef SDL_test_crc32_h_ +#define SDL_test_crc32_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -93,7 +93,7 @@ extern "C" { * \returns 0 for OK, -1 on error * */ -int SDLTest_crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); +int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32); /* Same routine broken down into three steps */ int SDLTest_Crc32CalcStart(SDLTest_Crc32Context * crcContext, CrcUint32 *crc32); @@ -119,6 +119,6 @@ int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext); #endif #include "close_code.h" -#endif /* _SDL_test_crc32_h */ +#endif /* SDL_test_crc32_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_font.h b/Engine/lib/sdl/include/SDL_test_font.h index 3378ea85b..59cbdcad6 100644 --- a/Engine/lib/sdl/include/SDL_test_font.h +++ b/Engine/lib/sdl/include/SDL_test_font.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,8 +27,8 @@ * This code is a part of the SDL2_test library, not the main SDL library. */ -#ifndef _SDL_test_font_h -#define _SDL_test_font_h +#ifndef SDL_test_font_h_ +#define SDL_test_font_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -50,7 +50,7 @@ extern "C" { * * \returns Returns 0 on success, -1 on failure. */ -int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c ); +int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c); /** * \brief Draw a string in the currently set font. @@ -62,15 +62,20 @@ int SDLTest_DrawCharacter( SDL_Renderer *renderer, int x, int y, char c ); * * \returns Returns 0 on success, -1 on failure. */ -int SDLTest_DrawString( SDL_Renderer * renderer, int x, int y, const char *s ); +int SDLTest_DrawString(SDL_Renderer *renderer, int x, int y, const char *s); +/** + * \brief Cleanup textures used by font drawing functions. + */ +void SDLTest_CleanupTextDrawing(void); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus } #endif #include "close_code.h" -#endif /* _SDL_test_font_h */ +#endif /* SDL_test_font_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_fuzzer.h b/Engine/lib/sdl/include/SDL_test_fuzzer.h index 9603652b2..8fcb9ebbf 100644 --- a/Engine/lib/sdl/include/SDL_test_fuzzer.h +++ b/Engine/lib/sdl/include/SDL_test_fuzzer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ */ -#ifndef _SDL_test_fuzzer_h -#define _SDL_test_fuzzer_h +#ifndef SDL_test_fuzzer_h_ +#define SDL_test_fuzzer_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -68,14 +68,14 @@ void SDLTest_FuzzerInit(Uint64 execKey); * * \returns Generated integer */ -Uint8 SDLTest_RandomUint8(); +Uint8 SDLTest_RandomUint8(void); /** * Returns a random Sint8 * * \returns Generated signed integer */ -Sint8 SDLTest_RandomSint8(); +Sint8 SDLTest_RandomSint8(void); /** @@ -83,14 +83,14 @@ Sint8 SDLTest_RandomSint8(); * * \returns Generated integer */ -Uint16 SDLTest_RandomUint16(); +Uint16 SDLTest_RandomUint16(void); /** * Returns a random Sint16 * * \returns Generated signed integer */ -Sint16 SDLTest_RandomSint16(); +Sint16 SDLTest_RandomSint16(void); /** @@ -98,7 +98,7 @@ Sint16 SDLTest_RandomSint16(); * * \returns Generated integer */ -Sint32 SDLTest_RandomSint32(); +Sint32 SDLTest_RandomSint32(void); /** @@ -106,14 +106,14 @@ Sint32 SDLTest_RandomSint32(); * * \returns Generated integer */ -Uint32 SDLTest_RandomUint32(); +Uint32 SDLTest_RandomUint32(void); /** * Returns random Uint64. * * \returns Generated integer */ -Uint64 SDLTest_RandomUint64(); +Uint64 SDLTest_RandomUint64(void); /** @@ -121,29 +121,29 @@ Uint64 SDLTest_RandomUint64(); * * \returns Generated signed integer */ -Sint64 SDLTest_RandomSint64(); +Sint64 SDLTest_RandomSint64(void); /** * \returns random float in range [0.0 - 1.0[ */ -float SDLTest_RandomUnitFloat(); +float SDLTest_RandomUnitFloat(void); /** * \returns random double in range [0.0 - 1.0[ */ -double SDLTest_RandomUnitDouble(); +double SDLTest_RandomUnitDouble(void); /** * \returns random float. * */ -float SDLTest_RandomFloat(); +float SDLTest_RandomFloat(void); /** * \returns random double. * */ -double SDLTest_RandomDouble(); +double SDLTest_RandomDouble(void); /** * Returns a random boundary value for Uint8 within the given boundaries. @@ -338,7 +338,7 @@ Sint32 SDLTest_RandomIntegerInRange(Sint32 min, Sint32 max); * * \returns Newly allocated random string; or NULL if length was invalid or string could not be allocated. */ -char * SDLTest_RandomAsciiString(); +char * SDLTest_RandomAsciiString(void); /** @@ -371,7 +371,7 @@ char * SDLTest_RandomAsciiStringOfSize(int size); /** * Returns the invocation count for the fuzzer since last ...FuzzerInit. */ -int SDLTest_GetFuzzerInvocationCount(); +int SDLTest_GetFuzzerInvocationCount(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus @@ -379,6 +379,6 @@ int SDLTest_GetFuzzerInvocationCount(); #endif #include "close_code.h" -#endif /* _SDL_test_fuzzer_h */ +#endif /* SDL_test_fuzzer_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_harness.h b/Engine/lib/sdl/include/SDL_test_harness.h index 74c0950cd..8641e0a7e 100644 --- a/Engine/lib/sdl/include/SDL_test_harness.h +++ b/Engine/lib/sdl/include/SDL_test_harness.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ Based on original GSOC code by Markus Kauppila */ -#ifndef _SDL_test_harness_h -#define _SDL_test_harness_h +#ifndef SDL_test_h_arness_h +#define SDL_test_h_arness_h #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -98,6 +98,17 @@ typedef struct SDLTest_TestSuiteReference { } SDLTest_TestSuiteReference; +/** + * \brief Generates a random run seed string for the harness. The generated seed will contain alphanumeric characters (0-9A-Z). + * + * Note: The returned string needs to be deallocated by the caller. + * + * \param length The length of the seed string to generate + * + * \returns The generated seed string + */ +char *SDLTest_GenerateRunSeed(const int length); + /** * \brief Execute a test suite using the given run seed and execution key. * @@ -118,6 +129,6 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user #endif #include "close_code.h" -#endif /* _SDL_test_harness_h */ +#endif /* SDL_test_h_arness_h */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_images.h b/Engine/lib/sdl/include/SDL_test_images.h index 8c64b4feb..9c4dd5b82 100644 --- a/Engine/lib/sdl/include/SDL_test_images.h +++ b/Engine/lib/sdl/include/SDL_test_images.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ */ -#ifndef _SDL_test_images_h -#define _SDL_test_images_h +#ifndef SDL_test_images_h_ +#define SDL_test_images_h_ #include "SDL.h" @@ -55,17 +55,17 @@ typedef struct SDLTest_SurfaceImage_s { } SDLTest_SurfaceImage_t; /* Test images */ -SDL_Surface *SDLTest_ImageBlit(); -SDL_Surface *SDLTest_ImageBlitColor(); -SDL_Surface *SDLTest_ImageBlitAlpha(); -SDL_Surface *SDLTest_ImageBlitBlendAdd(); -SDL_Surface *SDLTest_ImageBlitBlend(); -SDL_Surface *SDLTest_ImageBlitBlendMod(); -SDL_Surface *SDLTest_ImageBlitBlendNone(); -SDL_Surface *SDLTest_ImageBlitBlendAll(); -SDL_Surface *SDLTest_ImageFace(); -SDL_Surface *SDLTest_ImagePrimitives(); -SDL_Surface *SDLTest_ImagePrimitivesBlend(); +SDL_Surface *SDLTest_ImageBlit(void); +SDL_Surface *SDLTest_ImageBlitColor(void); +SDL_Surface *SDLTest_ImageBlitAlpha(void); +SDL_Surface *SDLTest_ImageBlitBlendAdd(void); +SDL_Surface *SDLTest_ImageBlitBlend(void); +SDL_Surface *SDLTest_ImageBlitBlendMod(void); +SDL_Surface *SDLTest_ImageBlitBlendNone(void); +SDL_Surface *SDLTest_ImageBlitBlendAll(void); +SDL_Surface *SDLTest_ImageFace(void); +SDL_Surface *SDLTest_ImagePrimitives(void); +SDL_Surface *SDLTest_ImagePrimitivesBlend(void); /* Ends C function definitions when using C++ */ #ifdef __cplusplus @@ -73,6 +73,6 @@ SDL_Surface *SDLTest_ImagePrimitivesBlend(); #endif #include "close_code.h" -#endif /* _SDL_test_images_h */ +#endif /* SDL_test_images_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_log.h b/Engine/lib/sdl/include/SDL_test_log.h index 73a5c016f..ebd44fb50 100644 --- a/Engine/lib/sdl/include/SDL_test_log.h +++ b/Engine/lib/sdl/include/SDL_test_log.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ * */ -#ifndef _SDL_test_log_h -#define _SDL_test_log_h +#ifndef SDL_test_log_h_ +#define SDL_test_log_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -62,6 +62,6 @@ void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_ #endif #include "close_code.h" -#endif /* _SDL_test_log_h */ +#endif /* SDL_test_log_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_md5.h b/Engine/lib/sdl/include/SDL_test_md5.h index f2d9a7d7e..0e4105768 100644 --- a/Engine/lib/sdl/include/SDL_test_md5.h +++ b/Engine/lib/sdl/include/SDL_test_md5.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,8 +53,8 @@ *********************************************************************** */ -#ifndef _SDL_test_md5_h -#define _SDL_test_md5_h +#ifndef SDL_test_md5_h_ +#define SDL_test_md5_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -124,6 +124,6 @@ extern "C" { #endif #include "close_code.h" -#endif /* _SDL_test_md5_h */ +#endif /* SDL_test_md5_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_memory.h b/Engine/lib/sdl/include/SDL_test_memory.h new file mode 100644 index 000000000..4827ae6f2 --- /dev/null +++ b/Engine/lib/sdl/include/SDL_test_memory.h @@ -0,0 +1,63 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_test_memory.h + * + * Include file for SDL test framework. + * + * This code is a part of the SDL2_test library, not the main SDL library. + */ + +#ifndef SDL_test_memory_h_ +#define SDL_test_memory_h_ + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + + +/** + * \brief Start tracking SDL memory allocations + * + * \note This should be called before any other SDL functions for complete tracking coverage + */ +int SDLTest_TrackAllocations(); + +/** + * \brief Print a log of any outstanding allocations + * + * \note This can be called after SDL_Quit() + */ +void SDLTest_LogAllocations(); + + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_test_memory_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_test_random.h b/Engine/lib/sdl/include/SDL_test_random.h index 91c36526c..0eb414ff2 100644 --- a/Engine/lib/sdl/include/SDL_test_random.h +++ b/Engine/lib/sdl/include/SDL_test_random.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,8 +37,8 @@ */ -#ifndef _SDL_test_random_h -#define _SDL_test_random_h +#ifndef SDL_test_random_h_ +#define SDL_test_random_h_ #include "begin_code.h" /* Set up for C function definitions, even when using C++ */ @@ -110,6 +110,6 @@ extern "C" { #endif #include "close_code.h" -#endif /* _SDL_test_random_h */ +#endif /* SDL_test_random_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_thread.h b/Engine/lib/sdl/include/SDL_thread.h index 377e6c73d..82a43fc03 100644 --- a/Engine/lib/sdl/include/SDL_thread.h +++ b/Engine/lib/sdl/include/SDL_thread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_thread_h -#define _SDL_thread_h +#ifndef SDL_thread_h_ +#define SDL_thread_h_ /** * \file SDL_thread.h @@ -74,15 +74,15 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data); * * We compile SDL into a DLL. This means, that it's the DLL which * creates a new thread for the calling process with the SDL_CreateThread() - * API. There is a problem with this, that only the RTL of the SDL.DLL will + * API. There is a problem with this, that only the RTL of the SDL2.DLL will * be initialized for those threads, and not the RTL of the calling * application! * * To solve this, we make a little hack here. * * We'll always use the caller's _beginthread() and _endthread() APIs to - * start a new thread. This way, if it's the SDL.DLL which uses this API, - * then the RTL of SDL.DLL will be used to create the new thread, and if it's + * start a new thread. This way, if it's the SDL2.DLL which uses this API, + * then the RTL of SDL2.DLL will be used to create the new thread, and if it's * the application, then the RTL of the application will be used. * * So, in short: @@ -90,14 +90,11 @@ typedef int (SDLCALL * SDL_ThreadFunction) (void *data); * library! */ #define SDL_PASSED_BEGINTHREAD_ENDTHREAD -#include /* This has _beginthread() and _endthread() defined! */ +#include /* _beginthreadex() and _endthreadex() */ -typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) (void *, unsigned, - unsigned (__stdcall * - func) (void - *), - void *arg, unsigned, - unsigned *threadID); +typedef uintptr_t(__cdecl * pfnSDL_CurrentBeginThread) + (void *, unsigned, unsigned (__stdcall *func)(void *), + void * /*arg*/, unsigned, unsigned * /* threadID */); typedef void (__cdecl * pfnSDL_CurrentEndThread) (unsigned code); /** @@ -118,6 +115,30 @@ SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, #define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthreadex, (pfnSDL_CurrentEndThread)_endthreadex) #endif +#elif defined(__OS2__) +/* + * just like the windows case above: We compile SDL2 + * into a dll with Watcom's runtime statically linked. + */ +#define SDL_PASSED_BEGINTHREAD_ENDTHREAD +#ifndef __EMX__ +#include +#else +#include +#endif +typedef int (*pfnSDL_CurrentBeginThread)(void (*func)(void *), void *, unsigned, void * /*arg*/); +typedef void (*pfnSDL_CurrentEndThread)(void); +extern DECLSPEC SDL_Thread *SDLCALL +SDL_CreateThread(SDL_ThreadFunction fn, const char *name, void *data, + pfnSDL_CurrentBeginThread pfnBeginThread, + pfnSDL_CurrentEndThread pfnEndThread); +#if defined(SDL_CreateThread) && SDL_DYNAMIC_API +#undef SDL_CreateThread +#define SDL_CreateThread(fn, name, data) SDL_CreateThread_REAL(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) +#else +#define SDL_CreateThread(fn, name, data) SDL_CreateThread(fn, name, data, (pfnSDL_CurrentBeginThread)_beginthread, (pfnSDL_CurrentEndThread)_endthread) +#endif + #else /** @@ -273,7 +294,7 @@ extern DECLSPEC void * SDLCALL SDL_TLSGet(SDL_TLSID id); * \sa SDL_TLSCreate() * \sa SDL_TLSGet() */ -extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void*)); +extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void*)); /* Ends C function definitions when using C++ */ @@ -282,6 +303,6 @@ extern DECLSPEC int SDLCALL SDL_TLSSet(SDL_TLSID id, const void *value, void (*d #endif #include "close_code.h" -#endif /* _SDL_thread_h */ +#endif /* SDL_thread_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_timer.h b/Engine/lib/sdl/include/SDL_timer.h index e0d3785ee..5600618ff 100644 --- a/Engine/lib/sdl/include/SDL_timer.h +++ b/Engine/lib/sdl/include/SDL_timer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_timer_h -#define _SDL_timer_h +#ifndef SDL_timer_h_ +#define SDL_timer_h_ /** * \file SDL_timer.h @@ -110,6 +110,6 @@ extern DECLSPEC SDL_bool SDLCALL SDL_RemoveTimer(SDL_TimerID id); #endif #include "close_code.h" -#endif /* _SDL_timer_h */ +#endif /* SDL_timer_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_touch.h b/Engine/lib/sdl/include/SDL_touch.h index 2643e3679..f4075e79a 100644 --- a/Engine/lib/sdl/include/SDL_touch.h +++ b/Engine/lib/sdl/include/SDL_touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Include file for SDL touch event handling. */ -#ifndef _SDL_touch_h -#define _SDL_touch_h +#ifndef SDL_touch_h_ +#define SDL_touch_h_ #include "SDL_stdinc.h" #include "SDL_error.h" @@ -81,6 +81,6 @@ extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int #endif #include "close_code.h" -#endif /* _SDL_touch_h */ +#endif /* SDL_touch_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_types.h b/Engine/lib/sdl/include/SDL_types.h index 5118af219..4ac248c8c 100644 --- a/Engine/lib/sdl/include/SDL_types.h +++ b/Engine/lib/sdl/include/SDL_types.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/include/SDL_version.h b/Engine/lib/sdl/include/SDL_version.h index 1700efdd1..584b48c7a 100644 --- a/Engine/lib/sdl/include/SDL_version.h +++ b/Engine/lib/sdl/include/SDL_version.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * This header defines the current SDL version. */ -#ifndef _SDL_version_h -#define _SDL_version_h +#ifndef SDL_version_h_ +#define SDL_version_h_ #include "SDL_stdinc.h" @@ -59,7 +59,7 @@ typedef struct SDL_version */ #define SDL_MAJOR_VERSION 2 #define SDL_MINOR_VERSION 0 -#define SDL_PATCHLEVEL 5 +#define SDL_PATCHLEVEL 8 /** * \brief Macro to determine SDL version program was compiled against. @@ -157,6 +157,6 @@ extern DECLSPEC int SDLCALL SDL_GetRevisionNumber(void); #endif #include "close_code.h" -#endif /* _SDL_version_h */ +#endif /* SDL_version_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_video.h b/Engine/lib/sdl/include/SDL_video.h index 73c33eb32..83f49faae 100644 --- a/Engine/lib/sdl/include/SDL_video.h +++ b/Engine/lib/sdl/include/SDL_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,8 @@ * Header file for SDL video functions. */ -#ifndef _SDL_video_h -#define _SDL_video_h +#ifndef SDL_video_h_ +#define SDL_video_h_ #include "SDL_stdinc.h" #include "SDL_pixels.h" @@ -110,13 +110,16 @@ typedef enum SDL_WINDOW_MOUSE_FOCUS = 0x00000400, /**< window has mouse focus */ SDL_WINDOW_FULLSCREEN_DESKTOP = ( SDL_WINDOW_FULLSCREEN | 0x00001000 ), SDL_WINDOW_FOREIGN = 0x00000800, /**< window not created by SDL */ - SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported */ + SDL_WINDOW_ALLOW_HIGHDPI = 0x00002000, /**< window should be created in high-DPI mode if supported. + On macOS NSHighResolutionCapable must be set true in the + application's Info.plist for this to have any effect. */ SDL_WINDOW_MOUSE_CAPTURE = 0x00004000, /**< window has mouse captured (unrelated to INPUT_GRABBED) */ SDL_WINDOW_ALWAYS_ON_TOP = 0x00008000, /**< window should always be above others */ SDL_WINDOW_SKIP_TASKBAR = 0x00010000, /**< window should not be added to the taskbar */ SDL_WINDOW_UTILITY = 0x00020000, /**< window should be treated as a utility window */ SDL_WINDOW_TOOLTIP = 0x00040000, /**< window should be treated as a tooltip */ - SDL_WINDOW_POPUP_MENU = 0x00080000 /**< window should be treated as a popup menu */ + SDL_WINDOW_POPUP_MENU = 0x00080000, /**< window should be treated as a popup menu */ + SDL_WINDOW_VULKAN = 0x10000000 /**< window usable for Vulkan surface */ } SDL_WindowFlags; /** @@ -200,14 +203,16 @@ typedef enum SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_SHARE_WITH_CURRENT_CONTEXT, SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, - SDL_GL_CONTEXT_RELEASE_BEHAVIOR + SDL_GL_CONTEXT_RELEASE_BEHAVIOR, + SDL_GL_CONTEXT_RESET_NOTIFICATION, + SDL_GL_CONTEXT_NO_ERROR } SDL_GLattr; typedef enum { SDL_GL_CONTEXT_PROFILE_CORE = 0x0001, SDL_GL_CONTEXT_PROFILE_COMPATIBILITY = 0x0002, - SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /* GLX_CONTEXT_ES2_PROFILE_BIT_EXT */ + SDL_GL_CONTEXT_PROFILE_ES = 0x0004 /**< GLX_CONTEXT_ES2_PROFILE_BIT_EXT */ } SDL_GLprofile; typedef enum @@ -224,6 +229,11 @@ typedef enum SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH = 0x0001 } SDL_GLcontextReleaseFlag; +typedef enum +{ + SDL_GL_CONTEXT_RESET_NO_NOTIFICATION = 0x0000, + SDL_GL_CONTEXT_RESET_LOSE_CONTEXT = 0x0001 +} SDL_GLContextResetNotification; /* Function prototypes */ @@ -448,17 +458,32 @@ extern DECLSPEC Uint32 SDLCALL SDL_GetWindowPixelFormat(SDL_Window * window); * ::SDL_WINDOW_HIDDEN, ::SDL_WINDOW_BORDERLESS, * ::SDL_WINDOW_RESIZABLE, ::SDL_WINDOW_MAXIMIZED, * ::SDL_WINDOW_MINIMIZED, ::SDL_WINDOW_INPUT_GRABBED, - * ::SDL_WINDOW_ALLOW_HIGHDPI. + * ::SDL_WINDOW_ALLOW_HIGHDPI, ::SDL_WINDOW_VULKAN. * * \return The created window, or NULL if window creation failed. * * If the window is created with the SDL_WINDOW_ALLOW_HIGHDPI flag, its size * in pixels may differ from its size in screen coordinates on platforms with * high-DPI support (e.g. iOS and Mac OS X). Use SDL_GetWindowSize() to query - * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize() - * or SDL_GetRendererOutputSize() to query the drawable size in pixels. + * the client area's size in screen coordinates, and SDL_GL_GetDrawableSize(), + * SDL_Vulkan_GetDrawableSize(), or SDL_GetRendererOutputSize() to query the + * drawable size in pixels. + * + * If the window is created with any of the SDL_WINDOW_OPENGL or + * SDL_WINDOW_VULKAN flags, then the corresponding LoadLibrary function + * (SDL_GL_LoadLibrary or SDL_Vulkan_LoadLibrary) is called and the + * corresponding UnloadLibrary function is called by SDL_DestroyWindow(). + * + * If SDL_WINDOW_VULKAN is specified and there isn't a working Vulkan driver, + * SDL_CreateWindow() will fail because SDL_Vulkan_LoadLibrary() will fail. + * + * \note On non-Apple devices, SDL requires you to either not link to the + * Vulkan loader or link to a dynamic library version. This limitation + * may be removed in a future version of SDL. * * \sa SDL_DestroyWindow() + * \sa SDL_GL_LoadLibrary() + * \sa SDL_Vulkan_LoadLibrary() */ extern DECLSPEC SDL_Window * SDLCALL SDL_CreateWindow(const char *title, int x, int y, int w, @@ -581,8 +606,8 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window, * \param w The width of the window, in screen coordinates. Must be >0. * \param h The height of the window, in screen coordinates. Must be >0. * - * \note You can't change the size of a fullscreen window, it automatically - * matches the size of the display mode. + * \note Fullscreen windows automatically match the size of the display mode, + * and you should use SDL_SetWindowDisplayMode() to change their size. * * The window size in screen coordinates may differ from the size in pixels, if * the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a platform with @@ -590,6 +615,7 @@ extern DECLSPEC void SDLCALL SDL_GetWindowPosition(SDL_Window * window, * SDL_GetRendererOutputSize() to get the real client area size in pixels. * * \sa SDL_GetWindowSize() + * \sa SDL_SetWindowDisplayMode() */ extern DECLSPEC void SDLCALL SDL_SetWindowSize(SDL_Window * window, int w, int h); @@ -870,7 +896,7 @@ extern DECLSPEC float SDLCALL SDL_GetWindowBrightness(SDL_Window * window); * \param window The window which will be made transparent or opaque * \param opacity Opacity (0.0f - transparent, 1.0f - opaque) This will be * clamped internally between 0.0f and 1.0f. - * + * * \return 0 on success, or -1 if setting the opacity isn't supported. * * \sa SDL_GetWindowOpacity() @@ -897,7 +923,7 @@ extern DECLSPEC int SDLCALL SDL_GetWindowOpacity(SDL_Window * window, float * ou * * \param modal_window The window that should be modal * \param parent_window The parent window - * + * * \return 0 on success, or -1 otherwise. */ extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL_Window * parent_window); @@ -910,7 +936,7 @@ extern DECLSPEC int SDLCALL SDL_SetWindowModalFor(SDL_Window * modal_window, SDL * obscured by other windows. * * \param window The window that should get the input focus - * + * * \return 0 on success, or -1 otherwise. * \sa SDL_RaiseWindow() */ @@ -1110,11 +1136,16 @@ extern DECLSPEC void SDLCALL SDL_GL_ResetAttributes(void); /** * \brief Set an OpenGL window attribute before window creation. + * + * \return 0 on success, or -1 if the attribute could not be set. */ extern DECLSPEC int SDLCALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); /** * \brief Get the actual value for an attribute from the current context. + * + * \return 0 on success, or -1 if the attribute could not be retrieved. + * The integer at \c value will be modified in either case. */ extern DECLSPEC int SDLCALL SDL_GL_GetAttribute(SDL_GLattr attr, int *value); @@ -1213,6 +1244,6 @@ extern DECLSPEC void SDLCALL SDL_GL_DeleteContext(SDL_GLContext context); #endif #include "close_code.h" -#endif /* _SDL_video_h */ +#endif /* SDL_video_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/include/SDL_vulkan.h b/Engine/lib/sdl/include/SDL_vulkan.h new file mode 100644 index 000000000..f04c21adb --- /dev/null +++ b/Engine/lib/sdl/include/SDL_vulkan.h @@ -0,0 +1,273 @@ +/* + Simple DirectMedia Layer + Copyright (C) 2017, Mark Callow + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/** + * \file SDL_vulkan.h + * + * Header file for functions to creating Vulkan surfaces on SDL windows. + */ + +#ifndef SDL_vulkan_h_ +#define SDL_vulkan_h_ + +#include "SDL_video.h" + +#include "begin_code.h" +/* Set up for C function definitions, even when using C++ */ +#ifdef __cplusplus +extern "C" { +#endif + +/* Avoid including vulkan.h, don't define VkInstance if it's already included */ +#ifdef VULKAN_H_ +#define NO_SDL_VULKAN_TYPEDEFS +#endif +#ifndef NO_SDL_VULKAN_TYPEDEFS +#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; + +#if defined(__LP64__) || defined(_WIN64) || defined(__x86_64__) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) +#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object; +#else +#define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object; +#endif + +VK_DEFINE_HANDLE(VkInstance) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) + +#endif /* !NO_SDL_VULKAN_TYPEDEFS */ + +typedef VkInstance SDL_vulkanInstance; +typedef VkSurfaceKHR SDL_vulkanSurface; /* for compatibility with Tizen */ + +/** + * \name Vulkan support functions + * + * \note SDL_Vulkan_GetInstanceExtensions & SDL_Vulkan_CreateSurface API + * is compatable with Tizen's implementation of Vulkan in SDL. + */ +/* @{ */ + +/** + * \brief Dynamically load a Vulkan loader library. + * + * \param [in] path The platform dependent Vulkan loader library name, or + * \c NULL. + * + * \return \c 0 on success, or \c -1 if the library couldn't be loaded. + * + * If \a path is NULL SDL will use the value of the environment variable + * \c SDL_VULKAN_LIBRARY, if set, otherwise it loads the default Vulkan + * loader library. + * + * This should be called after initializing the video driver, but before + * creating any Vulkan windows. If no Vulkan loader library is loaded, the + * default library will be loaded upon creation of the first Vulkan window. + * + * \note It is fairly common for Vulkan applications to link with \a libvulkan + * instead of explicitly loading it at run time. This will work with + * SDL provided the application links to a dynamic library and both it + * and SDL use the same search path. + * + * \note If you specify a non-NULL \c path, an application should retrieve all + * of the Vulkan functions it uses from the dynamic library using + * \c SDL_Vulkan_GetVkGetInstanceProcAddr() unless you can guarantee + * \c path points to the same vulkan loader library the application + * linked to. + * + * \note On Apple devices, if \a path is NULL, SDL will attempt to find + * the vkGetInstanceProcAddr address within all the mach-o images of + * the current process. This is because it is fairly common for Vulkan + * applications to link with libvulkan (and historically MoltenVK was + * provided as a static library). If it is not found then, on macOS, SDL + * will attempt to load \c vulkan.framework/vulkan, \c libvulkan.1.dylib, + * \c MoltenVK.framework/MoltenVK and \c libMoltenVK.dylib in that order. + * On iOS SDL will attempt to load \c libMoltenVK.dylib. Applications + * using a dynamic framework or .dylib must ensure it is included in its + * application bundle. + * + * \note On non-Apple devices, application linking with a static libvulkan is + * not supported. Either do not link to the Vulkan loader or link to a + * dynamic library version. + * + * \note This function will fail if there are no working Vulkan drivers + * installed. + * + * \sa SDL_Vulkan_GetVkGetInstanceProcAddr() + * \sa SDL_Vulkan_UnloadLibrary() + */ +extern DECLSPEC int SDLCALL SDL_Vulkan_LoadLibrary(const char *path); + +/** + * \brief Get the address of the \c vkGetInstanceProcAddr function. + * + * \note This should be called after either calling SDL_Vulkan_LoadLibrary + * or creating an SDL_Window with the SDL_WINDOW_VULKAN flag. + */ +extern DECLSPEC void *SDLCALL SDL_Vulkan_GetVkGetInstanceProcAddr(void); + +/** + * \brief Unload the Vulkan loader library previously loaded by + * \c SDL_Vulkan_LoadLibrary(). + * + * \sa SDL_Vulkan_LoadLibrary() + */ +extern DECLSPEC void SDLCALL SDL_Vulkan_UnloadLibrary(void); + +/** + * \brief Get the names of the Vulkan instance extensions needed to create + * a surface with \c SDL_Vulkan_CreateSurface(). + * + * \param [in] window Window for which the required Vulkan instance + * extensions should be retrieved + * \param [in,out] count pointer to an \c unsigned related to the number of + * required Vulkan instance extensions + * \param [out] names \c NULL or a pointer to an array to be filled with the + * required Vulkan instance extensions + * + * \return \c SDL_TRUE on success, \c SDL_FALSE on error. + * + * If \a pNames is \c NULL, then the number of required Vulkan instance + * extensions is returned in pCount. Otherwise, \a pCount must point to a + * variable set to the number of elements in the \a pNames array, and on + * return the variable is overwritten with the number of names actually + * written to \a pNames. If \a pCount is less than the number of required + * extensions, at most \a pCount structures will be written. If \a pCount + * is smaller than the number of required extensions, \c SDL_FALSE will be + * returned instead of \c SDL_TRUE, to indicate that not all the required + * extensions were returned. + * + * \note The returned list of extensions will contain \c VK_KHR_surface + * and zero or more platform specific extensions + * + * \note The extension names queried here must be enabled when calling + * VkCreateInstance, otherwise surface creation will fail. + * + * \note \c window should have been created with the \c SDL_WINDOW_VULKAN flag. + * + * \code + * unsigned int count; + * // get count of required extensions + * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, NULL)) + * handle_error(); + * + * static const char *const additionalExtensions[] = + * { + * VK_EXT_DEBUG_REPORT_EXTENSION_NAME, // example additional extension + * }; + * size_t additionalExtensionsCount = sizeof(additionalExtensions) / sizeof(additionalExtensions[0]); + * size_t extensionCount = count + additionalExtensionsCount; + * const char **names = malloc(sizeof(const char *) * extensionCount); + * if(!names) + * handle_error(); + * + * // get names of required extensions + * if(!SDL_Vulkan_GetInstanceExtensions(window, &count, names)) + * handle_error(); + * + * // copy additional extensions after required extensions + * for(size_t i = 0; i < additionalExtensionsCount; i++) + * names[i + count] = additionalExtensions[i]; + * + * VkInstanceCreateInfo instanceCreateInfo = {}; + * instanceCreateInfo.enabledExtensionCount = extensionCount; + * instanceCreateInfo.ppEnabledExtensionNames = names; + * // fill in rest of instanceCreateInfo + * + * VkInstance instance; + * // create the Vulkan instance + * VkResult result = vkCreateInstance(&instanceCreateInfo, NULL, &instance); + * free(names); + * \endcode + * + * \sa SDL_Vulkan_CreateSurface() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_GetInstanceExtensions( + SDL_Window *window, + unsigned int *pCount, + const char **pNames); + +/** + * \brief Create a Vulkan rendering surface for a window. + * + * \param [in] window SDL_Window to which to attach the rendering surface. + * \param [in] instance handle to the Vulkan instance to use. + * \param [out] surface pointer to a VkSurfaceKHR handle to receive the + * handle of the newly created surface. + * + * \return \c SDL_TRUE on success, \c SDL_FALSE on error. + * + * \code + * VkInstance instance; + * SDL_Window *window; + * + * // create instance and window + * + * // create the Vulkan surface + * VkSurfaceKHR surface; + * if(!SDL_Vulkan_CreateSurface(window, instance, &surface)) + * handle_error(); + * \endcode + * + * \note \a window should have been created with the \c SDL_WINDOW_VULKAN flag. + * + * \note \a instance should have been created with the extensions returned + * by \c SDL_Vulkan_CreateSurface() enabled. + * + * \sa SDL_Vulkan_GetInstanceExtensions() + */ +extern DECLSPEC SDL_bool SDLCALL SDL_Vulkan_CreateSurface( + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR* surface); + +/** + * \brief Get the size of a window's underlying drawable in pixels (for use + * with setting viewport, scissor & etc). + * + * \param window SDL_Window from which the drawable size should be queried + * \param w Pointer to variable for storing the width in pixels, + * may be NULL + * \param h Pointer to variable for storing the height in pixels, + * may be NULL + * + * This may differ from SDL_GetWindowSize() if we're rendering to a high-DPI + * drawable, i.e. the window was created with SDL_WINDOW_ALLOW_HIGHDPI on a + * platform with high-DPI support (Apple calls this "Retina"), and not disabled + * by the \c SDL_HINT_VIDEO_HIGHDPI_DISABLED hint. + * + * \note On macOS high-DPI support must be enabled for an application by + * setting NSHighResolutionCapable to true in its Info.plist. + * + * \sa SDL_GetWindowSize() + * \sa SDL_CreateWindow() + */ +extern DECLSPEC void SDLCALL SDL_Vulkan_GetDrawableSize(SDL_Window * window, + int *w, int *h); + +/* @} *//* Vulkan support functions */ + +/* Ends C function definitions when using C++ */ +#ifdef __cplusplus +} +#endif +#include "close_code.h" + +#endif /* SDL_vulkan_h_ */ diff --git a/Engine/lib/sdl/include/begin_code.h b/Engine/lib/sdl/include/begin_code.h index 04e78c64d..6c2106246 100644 --- a/Engine/lib/sdl/include/begin_code.h +++ b/Engine/lib/sdl/include/begin_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -61,6 +61,12 @@ # else # define DECLSPEC __declspec(dllexport) # endif +# elif defined(__OS2__) +# ifdef BUILD_SDL +# define DECLSPEC __declspec(dllexport) +# else +# define DECLSPEC +# endif # else # if defined(__GNUC__) && __GNUC__ >= 4 # define DECLSPEC __attribute__ ((visibility("default"))) @@ -74,6 +80,11 @@ #ifndef SDLCALL #if (defined(__WIN32__) || defined(__WINRT__)) && !defined(__GNUC__) #define SDLCALL __cdecl +#elif defined(__OS2__) || defined(__EMX__) +#define SDLCALL _System +# if defined (__GNUC__) && !defined(_System) +# define _System /* for old EMX/GCC compat. */ +# endif #else #define SDLCALL #endif @@ -111,7 +122,7 @@ #elif defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) || \ - defined(__DECC) + defined(__DECC) || defined(__CC_ARM) #define SDL_INLINE __inline #ifndef __inline__ #define __inline__ __inline @@ -134,6 +145,16 @@ #endif #endif /* SDL_FORCE_INLINE not defined */ +#ifndef SDL_NORETURN +#if defined(__GNUC__) +#define SDL_NORETURN __attribute__((noreturn)) +#elif defined(_MSC_VER) +#define SDL_NORETURN __declspec(noreturn) +#else +#define SDL_NORETURN +#endif +#endif /* SDL_NORETURN not defined */ + /* Apparently this is needed by several Windows compilers */ #if !defined(__MACH__) #ifndef NULL diff --git a/Engine/lib/sdl/include/close_code.h b/Engine/lib/sdl/include/close_code.h index d908b00eb..b3b70a4c8 100644 --- a/Engine/lib/sdl/include/close_code.h +++ b/Engine/lib/sdl/include/close_code.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,7 +29,7 @@ #undef _begin_code_h /* Reset structure packing at previous byte alignment */ -#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__WATCOMC__) || defined(__BORLANDC__) +#if defined(_MSC_VER) || defined(__MWERKS__) || defined(__BORLANDC__) #ifdef __BORLANDC__ #pragma nopackwarning #endif diff --git a/Engine/lib/sdl/src/SDL.c b/Engine/lib/sdl/src/SDL.c index 9eef00cd3..0e552791f 100644 --- a/Engine/lib/sdl/src/SDL.c +++ b/Engine/lib/sdl/src/SDL.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,10 +36,7 @@ /* Initialization/Cleanup routines */ #if !SDL_TIMERS_DISABLED -extern int SDL_TimerInit(void); -extern void SDL_TimerQuit(void); -extern void SDL_TicksInit(void); -extern void SDL_TicksQuit(void); +# include "timer/SDL_timer_c.h" #endif #if SDL_VIDEO_DRIVER_WINDOWS extern int SDL_HelperWindowCreate(void); @@ -81,7 +78,7 @@ SDL_PrivateShouldInitSubsystem(Uint32 subsystem) { int subsystem_index = SDL_MostSignificantBitIndex32(subsystem); SDL_assert(SDL_SubsystemRefCount[subsystem_index] < 255); - return (SDL_SubsystemRefCount[subsystem_index] == 0); + return (SDL_SubsystemRefCount[subsystem_index] == 0) ? SDL_TRUE : SDL_FALSE; } /* Private helper to check if a system needs to be quit. */ @@ -95,7 +92,7 @@ SDL_PrivateShouldQuitSubsystem(Uint32 subsystem) { /* If we're in SDL_Quit, we shut down every subsystem, even if refcount * isn't zero. */ - return SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit; + return (SDL_SubsystemRefCount[subsystem_index] == 1 || SDL_bInMainQuit) ? SDL_TRUE : SDL_FALSE; } void @@ -456,7 +453,7 @@ SDL_GetPlatform() #if defined(__WIN32__) -#if !defined(HAVE_LIBC) || (defined(__WATCOMC__) && defined(BUILD_DLL)) +#if (!defined(HAVE_LIBC) || defined(__WATCOMC__)) && !defined(SDL_STATIC_LIB) /* Need to include DllMain() on Watcom C for some reason.. */ BOOL APIENTRY @@ -472,7 +469,7 @@ _DllMainCRTStartup(HANDLE hModule, } return TRUE; } -#endif /* building DLL with Watcom C */ +#endif /* Building DLL */ #endif /* __WIN32__ */ diff --git a/Engine/lib/sdl/src/SDL_assert.c b/Engine/lib/sdl/src/SDL_assert.c index a21f70b68..76f5d604d 100644 --- a/Engine/lib/sdl/src/SDL_assert.c +++ b/Engine/lib/sdl/src/SDL_assert.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -44,7 +44,12 @@ #endif #endif -static SDL_assert_state +#if defined(__EMSCRIPTEN__) +#include +#endif + + +static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data, void *userdata); /* @@ -53,7 +58,10 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata); */ static SDL_assert_data *triggered_assertions = NULL; +#ifndef SDL_THREADS_DISABLED static SDL_mutex *assertion_mutex = NULL; +#endif + static SDL_AssertionHandler assertion_handler = SDL_PromptAssertion; static void *assertion_userdata = NULL; @@ -111,23 +119,29 @@ static void SDL_GenerateAssertionReport(void) } } -static void SDL_ExitProcess(int exitcode) + +static SDL_NORETURN void SDL_ExitProcess(int exitcode) { #ifdef __WIN32__ ExitProcess(exitcode); +#elif defined(__EMSCRIPTEN__) + emscripten_cancel_main_loop(); /* this should "kill" the app. */ + emscripten_force_exit(exitcode); /* this should "kill" the app. */ + exit(exitcode); #else _exit(exitcode); #endif } -static void SDL_AbortAssertion(void) + +static SDL_NORETURN void SDL_AbortAssertion(void) { SDL_Quit(); SDL_ExitProcess(42); } -static SDL_assert_state +static SDL_assert_state SDLCALL SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) { #ifdef __WIN32__ @@ -216,9 +230,45 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) state = (SDL_assert_state)selected; } } -#ifdef HAVE_STDIO_H + else { +#if defined(__EMSCRIPTEN__) + /* This is nasty, but we can't block on a custom UI. */ + for ( ; ; ) { + SDL_bool okay = SDL_TRUE; + char *buf = (char *) EM_ASM_INT({ + var str = + Pointer_stringify($0) + '\n\n' + + 'Abort/Retry/Ignore/AlwaysIgnore? [ariA] :'; + var reply = window.prompt(str, "i"); + if (reply === null) { + reply = "i"; + } + return allocate(intArrayFromString(reply), 'i8', ALLOC_NORMAL); + }, message); + + if (SDL_strcmp(buf, "a") == 0) { + state = SDL_ASSERTION_ABORT; + /* (currently) no break functionality on Emscripten + } else if (SDL_strcmp(buf, "b") == 0) { + state = SDL_ASSERTION_BREAK; */ + } else if (SDL_strcmp(buf, "r") == 0) { + state = SDL_ASSERTION_RETRY; + } else if (SDL_strcmp(buf, "i") == 0) { + state = SDL_ASSERTION_IGNORE; + } else if (SDL_strcmp(buf, "A") == 0) { + state = SDL_ASSERTION_ALWAYS_IGNORE; + } else { + okay = SDL_FALSE; + } + free(buf); + + if (okay) { + break; + } + } +#elif defined(HAVE_STDIO_H) /* this is a little hacky. */ for ( ; ; ) { char buf[32]; @@ -228,25 +278,25 @@ SDL_PromptAssertion(const SDL_assert_data *data, void *userdata) break; } - if (SDL_strcmp(buf, "a") == 0) { + if (SDL_strncmp(buf, "a", 1) == 0) { state = SDL_ASSERTION_ABORT; break; - } else if (SDL_strcmp(buf, "b") == 0) { + } else if (SDL_strncmp(buf, "b", 1) == 0) { state = SDL_ASSERTION_BREAK; break; - } else if (SDL_strcmp(buf, "r") == 0) { + } else if (SDL_strncmp(buf, "r", 1) == 0) { state = SDL_ASSERTION_RETRY; break; - } else if (SDL_strcmp(buf, "i") == 0) { + } else if (SDL_strncmp(buf, "i", 1) == 0) { state = SDL_ASSERTION_IGNORE; break; - } else if (SDL_strcmp(buf, "A") == 0) { + } else if (SDL_strncmp(buf, "A", 1) == 0) { state = SDL_ASSERTION_ALWAYS_IGNORE; break; } } - } #endif /* HAVE_STDIO_H */ + } /* Re-enter fullscreen mode */ if (window) { @@ -263,10 +313,11 @@ SDL_assert_state SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, int line) { - static int assertion_running = 0; - static SDL_SpinLock spinlock = 0; SDL_assert_state state = SDL_ASSERTION_IGNORE; + static int assertion_running = 0; +#ifndef SDL_THREADS_DISABLED + static SDL_SpinLock spinlock = 0; SDL_AtomicLock(&spinlock); if (assertion_mutex == NULL) { /* never called SDL_Init()? */ assertion_mutex = SDL_CreateMutex(); @@ -280,6 +331,7 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, if (SDL_LockMutex(assertion_mutex) < 0) { return SDL_ASSERTION_IGNORE; /* oh well, I guess. */ } +#endif /* doing this because Visual C is upset over assigning in the macro. */ if (data->trigger_count == 0) { @@ -323,7 +375,10 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, } assertion_running--; + +#ifndef SDL_THREADS_DISABLED SDL_UnlockMutex(assertion_mutex); +#endif return state; } @@ -332,10 +387,12 @@ SDL_ReportAssertion(SDL_assert_data *data, const char *func, const char *file, void SDL_AssertionsQuit(void) { SDL_GenerateAssertionReport(); +#ifndef SDL_THREADS_DISABLED if (assertion_mutex != NULL) { SDL_DestroyMutex(assertion_mutex); assertion_mutex = NULL; } +#endif } void SDL_SetAssertionHandler(SDL_AssertionHandler handler, void *userdata) diff --git a/Engine/lib/sdl/src/SDL_assert_c.h b/Engine/lib/sdl/src/SDL_assert_c.h index bc3b631e0..aa690a308 100644 --- a/Engine/lib/sdl/src/SDL_assert_c.h +++ b/Engine/lib/sdl/src/SDL_assert_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/SDL_dataqueue.c b/Engine/lib/sdl/src/SDL_dataqueue.c new file mode 100644 index 000000000..97916f43f --- /dev/null +++ b/Engine/lib/sdl/src/SDL_dataqueue.c @@ -0,0 +1,339 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "./SDL_internal.h" +#include "SDL.h" +#include "./SDL_dataqueue.h" +#include "SDL_assert.h" + +typedef struct SDL_DataQueuePacket +{ + size_t datalen; /* bytes currently in use in this packet. */ + size_t startpos; /* bytes currently consumed in this packet. */ + struct SDL_DataQueuePacket *next; /* next item in linked list. */ + Uint8 data[SDL_VARIABLE_LENGTH_ARRAY]; /* packet data */ +} SDL_DataQueuePacket; + +struct SDL_DataQueue +{ + SDL_DataQueuePacket *head; /* device fed from here. */ + SDL_DataQueuePacket *tail; /* queue fills to here. */ + SDL_DataQueuePacket *pool; /* these are unused packets. */ + size_t packet_size; /* size of new packets */ + size_t queued_bytes; /* number of bytes of data in the queue. */ +}; + +static void +SDL_FreeDataQueueList(SDL_DataQueuePacket *packet) +{ + while (packet) { + SDL_DataQueuePacket *next = packet->next; + SDL_free(packet); + packet = next; + } +} + + +/* this all expects that you managed thread safety elsewhere. */ + +SDL_DataQueue * +SDL_NewDataQueue(const size_t _packetlen, const size_t initialslack) +{ + SDL_DataQueue *queue = (SDL_DataQueue *) SDL_malloc(sizeof (SDL_DataQueue)); + + if (!queue) { + SDL_OutOfMemory(); + return NULL; + } else { + const size_t packetlen = _packetlen ? _packetlen : 1024; + const size_t wantpackets = (initialslack + (packetlen - 1)) / packetlen; + size_t i; + + SDL_zerop(queue); + queue->packet_size = packetlen; + + for (i = 0; i < wantpackets; i++) { + SDL_DataQueuePacket *packet = (SDL_DataQueuePacket *) SDL_malloc(sizeof (SDL_DataQueuePacket) + packetlen); + if (packet) { /* don't care if this fails, we'll deal later. */ + packet->datalen = 0; + packet->startpos = 0; + packet->next = queue->pool; + queue->pool = packet; + } + } + } + + return queue; +} + +void +SDL_FreeDataQueue(SDL_DataQueue *queue) +{ + if (queue) { + SDL_FreeDataQueueList(queue->head); + SDL_FreeDataQueueList(queue->pool); + SDL_free(queue); + } +} + +void +SDL_ClearDataQueue(SDL_DataQueue *queue, const size_t slack) +{ + const size_t packet_size = queue ? queue->packet_size : 1; + const size_t slackpackets = (slack + (packet_size-1)) / packet_size; + SDL_DataQueuePacket *packet; + SDL_DataQueuePacket *prev = NULL; + size_t i; + + if (!queue) { + return; + } + + packet = queue->head; + + /* merge the available pool and the current queue into one list. */ + if (packet) { + queue->tail->next = queue->pool; + } else { + packet = queue->pool; + } + + /* Remove the queued packets from the device. */ + queue->tail = NULL; + queue->head = NULL; + queue->queued_bytes = 0; + queue->pool = packet; + + /* Optionally keep some slack in the pool to reduce malloc pressure. */ + for (i = 0; packet && (i < slackpackets); i++) { + prev = packet; + packet = packet->next; + } + + if (prev) { + prev->next = NULL; + } else { + queue->pool = NULL; + } + + SDL_FreeDataQueueList(packet); /* free extra packets */ +} + +static SDL_DataQueuePacket * +AllocateDataQueuePacket(SDL_DataQueue *queue) +{ + SDL_DataQueuePacket *packet; + + SDL_assert(queue != NULL); + + packet = queue->pool; + if (packet != NULL) { + /* we have one available in the pool. */ + queue->pool = packet->next; + } else { + /* Have to allocate a new one! */ + packet = (SDL_DataQueuePacket *) SDL_malloc(sizeof (SDL_DataQueuePacket) + queue->packet_size); + if (packet == NULL) { + return NULL; + } + } + + packet->datalen = 0; + packet->startpos = 0; + packet->next = NULL; + + SDL_assert((queue->head != NULL) == (queue->queued_bytes != 0)); + if (queue->tail == NULL) { + queue->head = packet; + } else { + queue->tail->next = packet; + } + queue->tail = packet; + return packet; +} + + +int +SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *_data, const size_t _len) +{ + size_t len = _len; + const Uint8 *data = (const Uint8 *) _data; + const size_t packet_size = queue ? queue->packet_size : 0; + SDL_DataQueuePacket *orighead; + SDL_DataQueuePacket *origtail; + size_t origlen; + size_t datalen; + + if (!queue) { + return SDL_InvalidParamError("queue"); + } + + orighead = queue->head; + origtail = queue->tail; + origlen = origtail ? origtail->datalen : 0; + + while (len > 0) { + SDL_DataQueuePacket *packet = queue->tail; + SDL_assert(!packet || (packet->datalen <= packet_size)); + if (!packet || (packet->datalen >= packet_size)) { + /* tail packet missing or completely full; we need a new packet. */ + packet = AllocateDataQueuePacket(queue); + if (!packet) { + /* uhoh, reset so we've queued nothing new, free what we can. */ + if (!origtail) { + packet = queue->head; /* whole queue. */ + } else { + packet = origtail->next; /* what we added to existing queue. */ + origtail->next = NULL; + origtail->datalen = origlen; + } + queue->head = orighead; + queue->tail = origtail; + queue->pool = NULL; + + SDL_FreeDataQueueList(packet); /* give back what we can. */ + return SDL_OutOfMemory(); + } + } + + datalen = SDL_min(len, packet_size - packet->datalen); + SDL_memcpy(packet->data + packet->datalen, data, datalen); + data += datalen; + len -= datalen; + packet->datalen += datalen; + queue->queued_bytes += datalen; + } + + return 0; +} + +size_t +SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len) +{ + size_t len = _len; + Uint8 *buf = (Uint8 *) _buf; + Uint8 *ptr = buf; + SDL_DataQueuePacket *packet; + + if (!queue) { + return 0; + } + + for (packet = queue->head; len && packet; packet = packet->next) { + const size_t avail = packet->datalen - packet->startpos; + const size_t cpy = SDL_min(len, avail); + SDL_assert(queue->queued_bytes >= avail); + + SDL_memcpy(ptr, packet->data + packet->startpos, cpy); + ptr += cpy; + len -= cpy; + } + + return (size_t) (ptr - buf); +} + +size_t +SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *_buf, const size_t _len) +{ + size_t len = _len; + Uint8 *buf = (Uint8 *) _buf; + Uint8 *ptr = buf; + SDL_DataQueuePacket *packet; + + if (!queue) { + return 0; + } + + while ((len > 0) && ((packet = queue->head) != NULL)) { + const size_t avail = packet->datalen - packet->startpos; + const size_t cpy = SDL_min(len, avail); + SDL_assert(queue->queued_bytes >= avail); + + SDL_memcpy(ptr, packet->data + packet->startpos, cpy); + packet->startpos += cpy; + ptr += cpy; + queue->queued_bytes -= cpy; + len -= cpy; + + if (packet->startpos == packet->datalen) { /* packet is done, put it in the pool. */ + queue->head = packet->next; + SDL_assert((packet->next != NULL) || (packet == queue->tail)); + packet->next = queue->pool; + queue->pool = packet; + } + } + + SDL_assert((queue->head != NULL) == (queue->queued_bytes != 0)); + + if (queue->head == NULL) { + queue->tail = NULL; /* in case we drained the queue entirely. */ + } + + return (size_t) (ptr - buf); +} + +size_t +SDL_CountDataQueue(SDL_DataQueue *queue) +{ + return queue ? queue->queued_bytes : 0; +} + +void * +SDL_ReserveSpaceInDataQueue(SDL_DataQueue *queue, const size_t len) +{ + SDL_DataQueuePacket *packet; + + if (!queue) { + SDL_InvalidParamError("queue"); + return NULL; + } else if (len == 0) { + SDL_InvalidParamError("len"); + return NULL; + } else if (len > queue->packet_size) { + SDL_SetError("len is larger than packet size"); + return NULL; + } + + packet = queue->head; + if (packet) { + const size_t avail = queue->packet_size - packet->datalen; + if (len <= avail) { /* we can use the space at end of this packet. */ + void *retval = packet->data + packet->datalen; + packet->datalen += len; + queue->queued_bytes += len; + return retval; + } + } + + /* Need a fresh packet. */ + packet = AllocateDataQueuePacket(queue); + if (!packet) { + SDL_OutOfMemory(); + return NULL; + } + + packet->datalen = len; + queue->queued_bytes += len; + return packet->data; +} + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/Engine/lib/sdl/src/SDL_dataqueue.h b/Engine/lib/sdl/src/SDL_dataqueue.h new file mode 100644 index 000000000..d44f58db1 --- /dev/null +++ b/Engine/lib/sdl/src/SDL_dataqueue.h @@ -0,0 +1,55 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#ifndef SDL_dataqueue_h_ +#define SDL_dataqueue_h_ + +/* this is not (currently) a public API. But maybe it should be! */ + +struct SDL_DataQueue; +typedef struct SDL_DataQueue SDL_DataQueue; + +SDL_DataQueue *SDL_NewDataQueue(const size_t packetlen, const size_t initialslack); +void SDL_FreeDataQueue(SDL_DataQueue *queue); +void SDL_ClearDataQueue(SDL_DataQueue *queue, const size_t slack); +int SDL_WriteToDataQueue(SDL_DataQueue *queue, const void *data, const size_t len); +size_t SDL_ReadFromDataQueue(SDL_DataQueue *queue, void *buf, const size_t len); +size_t SDL_PeekIntoDataQueue(SDL_DataQueue *queue, void *buf, const size_t len); +size_t SDL_CountDataQueue(SDL_DataQueue *queue); + +/* this sets a section of the data queue aside (possibly allocating memory for it) + as if it's been written to, but returns a pointer to that space. You may write + to this space until a read would consume it. Writes (and other calls to this + function) will safely append their data after this reserved space and can + be in flight at the same time. There is no thread safety. + If there isn't an existing block of memory that can contain the reserved + space, one will be allocated for it. You can not (currently) allocate + a space larger than the packetlen requested in SDL_NewDataQueue. + Returned buffer is uninitialized. + This lets you avoid an extra copy in some cases, but it's safer to use + SDL_WriteToDataQueue() unless you know what you're doing. + Returns pointer to buffer of at least (len) bytes, NULL on error. +*/ +void *SDL_ReserveSpaceInDataQueue(SDL_DataQueue *queue, const size_t len); + +#endif /* SDL_dataqueue_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/Engine/lib/sdl/src/SDL_error.c b/Engine/lib/sdl/src/SDL_error.c index 804a1eb38..14761c544 100644 --- a/Engine/lib/sdl/src/SDL_error.c +++ b/Engine/lib/sdl/src/SDL_error.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -49,6 +49,8 @@ SDL_LookupString(const char *key) /* Public functions */ +static char *SDL_GetErrorMsg(char *errstr, int maxlen); + int SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { @@ -74,6 +76,16 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) case 0: /* Malformed format string.. */ --fmt; break; + case 'l': + switch (*fmt++) { + case 0: /* Malformed format string.. */ + --fmt; + break; + case 'i': case 'd': case 'u': + error->args[error->argc++].value_l = va_arg(ap, long); + break; + } + break; case 'c': case 'i': case 'd': @@ -110,16 +122,83 @@ SDL_SetError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) } va_end(ap); - /* If we are in debug mode, print out an error message */ - SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", SDL_GetError()); - + if (SDL_LogGetPriority(SDL_LOG_CATEGORY_ERROR) <= SDL_LOG_PRIORITY_DEBUG) { + /* If we are in debug mode, print out an error message + * Avoid stomping on the static buffer in GetError, just + * in case this is called while processing a ShowMessageBox to + * show an error already in that static buffer. + */ + char errmsg[SDL_ERRBUFIZE]; + SDL_GetErrorMsg(errmsg, sizeof(errmsg)); + SDL_LogDebug(SDL_LOG_CATEGORY_ERROR, "%s", errmsg); + } return -1; } -#ifdef __GNUC__ -#pragma GCC diagnostic push +/* Available for backwards compatibility */ +const char * +SDL_GetError(void) +{ + static char errmsg[SDL_ERRBUFIZE]; + + return SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE); +} + +void +SDL_ClearError(void) +{ + SDL_error *error; + + error = SDL_GetErrBuf(); + error->error = 0; +} + +/* Very common errors go here */ +int +SDL_Error(SDL_errorcode code) +{ + switch (code) { + case SDL_ENOMEM: + return SDL_SetError("Out of memory"); + case SDL_EFREAD: + return SDL_SetError("Error reading from datastream"); + case SDL_EFWRITE: + return SDL_SetError("Error writing to datastream"); + case SDL_EFSEEK: + return SDL_SetError("Error seeking in datastream"); + case SDL_UNSUPPORTED: + return SDL_SetError("That operation is not supported"); + default: + return SDL_SetError("Unknown SDL error"); + } +} + +#ifdef TEST_ERROR +int +main(int argc, char *argv[]) +{ + char buffer[BUFSIZ + 1]; + + SDL_SetError("Hi there!"); + printf("Error 1: %s\n", SDL_GetError()); + SDL_ClearError(); + SDL_memset(buffer, '1', BUFSIZ); + buffer[BUFSIZ] = 0; + SDL_SetError("This is the error: %s (%f)", buffer, 1.0); + printf("Error 2: %s\n", SDL_GetError()); + exit(0); +} +#endif + + +/* keep this at the end of the file so it works with GCC builds that don't + support "#pragma GCC diagnostic push" ... we'll just leave the warning + disabled after this. */ +/* this pragma arrived in GCC 4.2 and causes a warning on older GCCs! Sigh. */ +#if defined(__clang__) || (defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ >= 2)))) #pragma GCC diagnostic ignored "-Wformat-nonliteral" #endif + /* This function has a bit more overhead than most error functions so that it supports internationalization and thread-safe errors. */ @@ -150,6 +229,22 @@ SDL_GetErrorMsg(char *errstr, int maxlen) && spot < (tmp + SDL_arraysize(tmp) - 2)) { *spot++ = *fmt++; } + if (*fmt == 'l') { + *spot++ = *fmt++; + *spot++ = *fmt++; + *spot++ = '\0'; + switch (spot[-2]) { + case 'i': case 'd': case 'u': + len = SDL_snprintf(msg, maxlen, tmp, + error->args[argi++].value_l); + if (len > 0) { + msg += len; + maxlen -= len; + } + break; + } + continue; + } *spot++ = *fmt++; *spot++ = '\0'; switch (spot[-2]) { @@ -220,63 +315,5 @@ SDL_GetErrorMsg(char *errstr, int maxlen) } return (errstr); } -#ifdef __GNUC__ -#pragma GCC diagnostic pop -#endif - -/* Available for backwards compatibility */ -const char * -SDL_GetError(void) -{ - static char errmsg[SDL_ERRBUFIZE]; - - return SDL_GetErrorMsg(errmsg, SDL_ERRBUFIZE); -} - -void -SDL_ClearError(void) -{ - SDL_error *error; - - error = SDL_GetErrBuf(); - error->error = 0; -} - -/* Very common errors go here */ -int -SDL_Error(SDL_errorcode code) -{ - switch (code) { - case SDL_ENOMEM: - return SDL_SetError("Out of memory"); - case SDL_EFREAD: - return SDL_SetError("Error reading from datastream"); - case SDL_EFWRITE: - return SDL_SetError("Error writing to datastream"); - case SDL_EFSEEK: - return SDL_SetError("Error seeking in datastream"); - case SDL_UNSUPPORTED: - return SDL_SetError("That operation is not supported"); - default: - return SDL_SetError("Unknown SDL error"); - } -} - -#ifdef TEST_ERROR -int -main(int argc, char *argv[]) -{ - char buffer[BUFSIZ + 1]; - - SDL_SetError("Hi there!"); - printf("Error 1: %s\n", SDL_GetError()); - SDL_ClearError(); - SDL_memset(buffer, '1', BUFSIZ); - buffer[BUFSIZ] = 0; - SDL_SetError("This is the error: %s (%f)", buffer, 1.0); - printf("Error 2: %s\n", SDL_GetError()); - exit(0); -} -#endif /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/SDL_error_c.h b/Engine/lib/sdl/src/SDL_error_c.h index 76ccf2b94..6bb9caaf8 100644 --- a/Engine/lib/sdl/src/SDL_error_c.h +++ b/Engine/lib/sdl/src/SDL_error_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,8 +24,8 @@ error messages */ -#ifndef _SDL_error_c_h -#define _SDL_error_c_h +#ifndef SDL_error_c_h_ +#define SDL_error_c_h_ #define ERR_MAX_STRLEN 128 #define ERR_MAX_ARGS 5 @@ -51,6 +51,7 @@ typedef struct SDL_error unsigned char value_c; #endif int value_i; + long value_l; double value_f; char buf[ERR_MAX_STRLEN]; } args[ERR_MAX_ARGS]; @@ -59,6 +60,6 @@ typedef struct SDL_error /* Defined in SDL_thread.c */ extern SDL_error *SDL_GetErrBuf(void); -#endif /* _SDL_error_c_h */ +#endif /* SDL_error_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/SDL_hints.c b/Engine/lib/sdl/src/SDL_hints.c index 390d94f9f..09689aa14 100644 --- a/Engine/lib/sdl/src/SDL_hints.c +++ b/Engine/lib/sdl/src/SDL_hints.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -122,7 +122,7 @@ SDL_bool SDL_GetHintBoolean(const char *name, SDL_bool default_value) { const char *hint = SDL_GetHint(name); - if (!hint) { + if (!hint || !*hint) { return default_value; } if (*hint == '0' || SDL_strcasecmp(hint, "false") == 0) { diff --git a/Engine/lib/sdl/src/SDL_internal.h b/Engine/lib/sdl/src/SDL_internal.h index 7e928501a..e0ba2a82c 100644 --- a/Engine/lib/sdl/src/SDL_internal.h +++ b/Engine/lib/sdl/src/SDL_internal.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,8 +18,22 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_internal_h -#define _SDL_internal_h +#ifndef SDL_internal_h_ +#define SDL_internal_h_ + +/* Many of SDL's features require _GNU_SOURCE on various platforms */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE +#endif + +/* This is for a variable-length array at the end of a struct: + struct x { int y; char z[SDL_VARIABLE_LENGTH_ARRAY]; }; + Use this because GCC 2 needs different magic than other compilers. */ +#if (defined(__GNUC__) && (__GNUC__ <= 2)) || defined(__CC_ARM) || defined(__cplusplus) +#define SDL_VARIABLE_LENGTH_ARRAY 1 +#else +#define SDL_VARIABLE_LENGTH_ARRAY +#endif #include "dynapi/SDL_dynapi.h" @@ -33,6 +47,6 @@ #include "SDL_config.h" -#endif +#endif /* SDL_internal_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/SDL_log.c b/Engine/lib/sdl/src/SDL_log.c index 760cb13de..b1bf27d7a 100644 --- a/Engine/lib/sdl/src/SDL_log.c +++ b/Engine/lib/sdl/src/SDL_log.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -50,9 +50,7 @@ typedef struct SDL_LogLevel } SDL_LogLevel; /* The default log output function */ -static void SDL_LogOutput(void *userdata, - int category, SDL_LogPriority priority, - const char *message); +static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message); static SDL_LogLevel *SDL_loglevels; static SDL_LogPriority SDL_default_priority = DEFAULT_PRIORITY; @@ -304,15 +302,15 @@ SDL_LogMessageV(int category, SDL_LogPriority priority, const char *fmt, va_list SDL_stack_free(message); } -#if defined(__WIN32__) -/* Flag tracking the attachment of the console: 0=unattached, 1=attached, -1=error */ +#if defined(__WIN32__) && !defined(HAVE_STDIO_H) && !defined(__WINRT__) +/* Flag tracking the attachment of the console: 0=unattached, 1=attached to a console, 2=attached to a file, -1=error */ static int consoleAttached = 0; /* Handle to stderr output of console. */ static HANDLE stderrHandle = NULL; #endif -static void +static void SDLCALL SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, const char *message) { @@ -328,6 +326,7 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, BOOL attachResult; DWORD attachError; unsigned long charsWritten; + DWORD consoleMode; /* Maybe attach console and get stderr handle */ if (consoleAttached == 0) { @@ -335,7 +334,8 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, if (!attachResult) { attachError = GetLastError(); if (attachError == ERROR_INVALID_HANDLE) { - OutputDebugString(TEXT("Parent process has no console\r\n")); + /* This is expected when running from Visual Studio */ + /*OutputDebugString(TEXT("Parent process has no console\r\n"));*/ consoleAttached = -1; } else if (attachError == ERROR_GEN_FAILURE) { OutputDebugString(TEXT("Could not attach to console of parent process\r\n")); @@ -351,9 +351,14 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, /* Newly attached */ consoleAttached = 1; } - + if (consoleAttached == 1) { stderrHandle = GetStdHandle(STD_ERROR_HANDLE); + + if (GetConsoleMode(stderrHandle, &consoleMode) == 0) { + /* WriteConsole fails if the output is redirected to a file. Must use WriteFile instead. */ + consoleAttached = 2; + } } } #endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) */ @@ -375,6 +380,11 @@ SDL_LogOutput(void *userdata, int category, SDL_LogPriority priority, OutputDebugString(TEXT("Insufficient heap memory to write message\r\n")); } } + + } else if (consoleAttached == 2) { + if (!WriteFile(stderrHandle, output, lstrlenA(output), &charsWritten, NULL)) { + OutputDebugString(TEXT("Error calling WriteFile\r\n")); + } } #endif /* !defined(HAVE_STDIO_H) && !defined(__WINRT__) */ diff --git a/Engine/lib/sdl/src/atomic/SDL_atomic.c b/Engine/lib/sdl/src/atomic/SDL_atomic.c index db86d6eda..df4920139 100644 --- a/Engine/lib/sdl/src/atomic/SDL_atomic.c +++ b/Engine/lib/sdl/src/atomic/SDL_atomic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,6 +35,48 @@ #include #endif +/* The __atomic_load_n() intrinsic showed up in different times for different compilers. */ +#if defined(HAVE_GCC_ATOMICS) +# if defined(__clang__) +# if __has_builtin(__atomic_load_n) + /* !!! FIXME: this advertises as available in the NDK but uses an external symbol we don't have. + It might be in a later NDK or we might need an extra library? --ryan. */ +# if !defined(__ANDROID__) +# define HAVE_ATOMIC_LOAD_N 1 +# endif +# endif +# elif defined(__GNUC__) +# if (__GNUC__ >= 5) +# define HAVE_ATOMIC_LOAD_N 1 +# endif +# endif +#endif + +#if defined(__WATCOMC__) && defined(__386__) +#define HAVE_WATCOM_ATOMICS +extern _inline int _SDL_xchg_watcom(volatile int *a, int v); +#pragma aux _SDL_xchg_watcom = \ + "xchg [ecx], eax" \ + parm [ecx] [eax] \ + value [eax] \ + modify exact [eax]; + +extern _inline unsigned char _SDL_cmpxchg_watcom(volatile int *a, int newval, int oldval); +#pragma aux _SDL_cmpxchg_watcom = \ + "lock cmpxchg [edx], ecx" \ + "setz al" \ + parm [edx] [ecx] [eax] \ + value [al] \ + modify exact [eax]; + +extern _inline int _SDL_xadd_watcom(volatile int *a, int v); +#pragma aux _SDL_xadd_watcom = \ + "lock xadd [ecx], eax" \ + parm [ecx] [eax] \ + value [eax] \ + modify exact [eax]; +#endif /* __WATCOMC__ && __386__ */ + /* If any of the operations are not provided then we must emulate some of them. That means we need a nice implementation of spin locks @@ -58,7 +100,7 @@ Contributed by Bob Pendleton, bob@pendleton.com */ -#if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOSX__) && !defined(__SOLARIS__) +#if !defined(HAVE_MSC_ATOMICS) && !defined(HAVE_GCC_ATOMICS) && !defined(__MACOSX__) && !defined(__SOLARIS__) && !defined(HAVE_WATCOM_ATOMICS) #define EMULATE_CAS 1 #endif @@ -88,10 +130,12 @@ SDL_AtomicCAS(SDL_atomic_t *a, int oldval, int newval) { #ifdef HAVE_MSC_ATOMICS return (_InterlockedCompareExchange((long*)&a->value, (long)newval, (long)oldval) == (long)oldval); -#elif defined(__MACOSX__) /* !!! FIXME: should we favor gcc atomics? */ - return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value); +#elif defined(HAVE_WATCOM_ATOMICS) + return (SDL_bool) _SDL_cmpxchg_watcom(&a->value, newval, oldval); #elif defined(HAVE_GCC_ATOMICS) return (SDL_bool) __sync_bool_compare_and_swap(&a->value, oldval, newval); +#elif defined(__MACOSX__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ + return (SDL_bool) OSAtomicCompareAndSwap32Barrier(oldval, newval, &a->value); #elif defined(__SOLARIS__) && defined(_LP64) return (SDL_bool) ((int) atomic_cas_64((volatile uint64_t*)&a->value, (uint64_t)oldval, (uint64_t)newval) == oldval); #elif defined(__SOLARIS__) && !defined(_LP64) @@ -119,12 +163,14 @@ SDL_AtomicCASPtr(void **a, void *oldval, void *newval) return (_InterlockedCompareExchange((long*)a, (long)newval, (long)oldval) == (long)oldval); #elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86) return (_InterlockedCompareExchangePointer(a, newval, oldval) == oldval); -#elif defined(__MACOSX__) && defined(__LP64__) /* !!! FIXME: should we favor gcc atomics? */ - return (SDL_bool) OSAtomicCompareAndSwap64Barrier((int64_t)oldval, (int64_t)newval, (int64_t*) a); -#elif defined(__MACOSX__) && !defined(__LP64__) /* !!! FIXME: should we favor gcc atomics? */ - return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a); +#elif defined(HAVE_WATCOM_ATOMICS) + return (SDL_bool) _SDL_cmpxchg_watcom((int *)a, (long)newval, (long)oldval); #elif defined(HAVE_GCC_ATOMICS) return __sync_bool_compare_and_swap(a, oldval, newval); +#elif defined(__MACOSX__) && defined(__LP64__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ + return (SDL_bool) OSAtomicCompareAndSwap64Barrier((int64_t)oldval, (int64_t)newval, (int64_t*) a); +#elif defined(__MACOSX__) && !defined(__LP64__) /* this is deprecated in 10.12 sdk; favor gcc atomics. */ + return (SDL_bool) OSAtomicCompareAndSwap32Barrier((int32_t)oldval, (int32_t)newval, (int32_t*) a); #elif defined(__SOLARIS__) return (SDL_bool) (atomic_cas_ptr(a, oldval, newval) == oldval); #elif EMULATE_CAS @@ -148,6 +194,8 @@ SDL_AtomicSet(SDL_atomic_t *a, int v) { #ifdef HAVE_MSC_ATOMICS return _InterlockedExchange((long*)&a->value, v); +#elif defined(HAVE_WATCOM_ATOMICS) + return _SDL_xchg_watcom(&a->value, v); #elif defined(HAVE_GCC_ATOMICS) return __sync_lock_test_and_set(&a->value, v); #elif defined(__SOLARIS__) && defined(_LP64) @@ -170,6 +218,8 @@ SDL_AtomicSetPtr(void **a, void *v) return (void *) _InterlockedExchange((long *)a, (long) v); #elif defined(HAVE_MSC_ATOMICS) && (!_M_IX86) return _InterlockedExchangePointer(a, v); +#elif defined(HAVE_WATCOM_ATOMICS) + return (void *) _SDL_xchg_watcom((int *)a, (long)v); #elif defined(HAVE_GCC_ATOMICS) return __sync_lock_test_and_set(a, v); #elif defined(__SOLARIS__) @@ -188,6 +238,8 @@ SDL_AtomicAdd(SDL_atomic_t *a, int v) { #ifdef HAVE_MSC_ATOMICS return _InterlockedExchangeAdd((long*)&a->value, v); +#elif defined(HAVE_WATCOM_ATOMICS) + return _SDL_xadd_watcom(&a->value, v); #elif defined(HAVE_GCC_ATOMICS) return __sync_fetch_and_add(&a->value, v); #elif defined(__SOLARIS__) @@ -211,36 +263,41 @@ SDL_AtomicAdd(SDL_atomic_t *a, int v) int SDL_AtomicGet(SDL_atomic_t *a) { +#ifdef HAVE_ATOMIC_LOAD_N + return __atomic_load_n(&a->value, __ATOMIC_SEQ_CST); +#else int value; do { value = a->value; } while (!SDL_AtomicCAS(a, value, value)); return value; +#endif } void * SDL_AtomicGetPtr(void **a) { +#ifdef HAVE_ATOMIC_LOAD_N + return __atomic_load_n(a, __ATOMIC_SEQ_CST); +#else void *value; do { value = *a; } while (!SDL_AtomicCASPtr(a, value, value)); return value; +#endif } -#ifdef __thumb__ -#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) -__asm__( -" .align 2\n" -" .globl _SDL_MemoryBarrierRelease\n" -" .globl _SDL_MemoryBarrierAcquire\n" -"_SDL_MemoryBarrierRelease:\n" -"_SDL_MemoryBarrierAcquire:\n" -" mov r0, #0\n" -" mcr p15, 0, r0, c7, c10, 5\n" -" bx lr\n" -); -#endif -#endif +void +SDL_MemoryBarrierReleaseFunction(void) +{ + SDL_MemoryBarrierRelease(); +} + +void +SDL_MemoryBarrierAcquireFunction(void) +{ + SDL_MemoryBarrierAcquire(); +} /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/atomic/SDL_spinlock.c b/Engine/lib/sdl/src/atomic/SDL_spinlock.c index f582afb4e..1ebc71887 100644 --- a/Engine/lib/sdl/src/atomic/SDL_spinlock.c +++ b/Engine/lib/sdl/src/atomic/SDL_spinlock.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,6 +32,16 @@ #include #endif +#if defined(__WATCOMC__) && defined(__386__) +SDL_COMPILE_TIME_ASSERT(locksize, 4==sizeof(SDL_SpinLock)); +extern _inline int _SDL_xchg_watcom(volatile int *a, int v); +#pragma aux _SDL_xchg_watcom = \ + "xchg [ecx], eax" \ + parm [ecx] [eax] \ + value [eax] \ + modify exact [eax]; +#endif /* __WATCOMC__ && __386__ */ + /* This function is where all the magic happens... */ SDL_bool SDL_AtomicTryLock(SDL_SpinLock *lock) @@ -58,6 +68,9 @@ SDL_AtomicTryLock(SDL_SpinLock *lock) SDL_COMPILE_TIME_ASSERT(locksize, sizeof(*lock) == sizeof(long)); return (InterlockedExchange((long*)lock, 1) == 0); +#elif defined(__WATCOMC__) && defined(__386__) + return _SDL_xchg_watcom(lock, 1) == 0; + #elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET return (__sync_lock_test_and_set(lock, 1) == 0); @@ -119,6 +132,10 @@ SDL_AtomicUnlock(SDL_SpinLock *lock) _ReadWriteBarrier(); *lock = 0; +#elif defined(__WATCOMC__) && defined(__386__) + SDL_CompilerBarrier (); + *lock = 0; + #elif HAVE_GCC_ATOMICS || HAVE_GCC_SYNC_LOCK_TEST_AND_SET __sync_lock_release(lock); diff --git a/Engine/lib/sdl/src/audio/SDL_audio.c b/Engine/lib/sdl/src/audio/SDL_audio.c index 460852d7f..dcaebea6d 100644 --- a/Engine/lib/sdl/src/audio/SDL_audio.c +++ b/Engine/lib/sdl/src/audio/SDL_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,36 +33,6 @@ static SDL_AudioDriver current_audio; static SDL_AudioDevice *open_devices[16]; -/* - * Not all of these will be compiled and linked in, but it's convenient - * to have a complete list here and saves yet-another block of #ifdefs... - * Please see bootstrap[], below, for the actual #ifdef mess. - */ -extern AudioBootStrap PULSEAUDIO_bootstrap; -extern AudioBootStrap ALSA_bootstrap; -extern AudioBootStrap SNDIO_bootstrap; -extern AudioBootStrap BSD_AUDIO_bootstrap; -extern AudioBootStrap DSP_bootstrap; -extern AudioBootStrap QSAAUDIO_bootstrap; -extern AudioBootStrap SUNAUDIO_bootstrap; -extern AudioBootStrap ARTS_bootstrap; -extern AudioBootStrap ESD_bootstrap; -extern AudioBootStrap NACLAUDIO_bootstrap; -extern AudioBootStrap NAS_bootstrap; -extern AudioBootStrap XAUDIO2_bootstrap; -extern AudioBootStrap DSOUND_bootstrap; -extern AudioBootStrap WINMM_bootstrap; -extern AudioBootStrap PAUDIO_bootstrap; -extern AudioBootStrap HAIKUAUDIO_bootstrap; -extern AudioBootStrap COREAUDIO_bootstrap; -extern AudioBootStrap DISKAUDIO_bootstrap; -extern AudioBootStrap DUMMYAUDIO_bootstrap; -extern AudioBootStrap FUSIONSOUND_bootstrap; -extern AudioBootStrap ANDROIDAUDIO_bootstrap; -extern AudioBootStrap PSPAUDIO_bootstrap; -extern AudioBootStrap SNDIO_bootstrap; -extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap; - /* Available audio drivers */ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_PULSEAUDIO @@ -74,8 +44,8 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_SNDIO &SNDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_BSD - &BSD_AUDIO_bootstrap, +#if SDL_AUDIO_DRIVER_NETBSD + &NETBSDAUDIO_bootstrap, #endif #if SDL_AUDIO_DRIVER_OSS &DSP_bootstrap, @@ -98,8 +68,8 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_NAS &NAS_bootstrap, #endif -#if SDL_AUDIO_DRIVER_XAUDIO2 - &XAUDIO2_bootstrap, +#if SDL_AUDIO_DRIVER_WASAPI + &WASAPI_bootstrap, #endif #if SDL_AUDIO_DRIVER_DSOUND &DSOUND_bootstrap, @@ -116,12 +86,6 @@ static const AudioBootStrap *const bootstrap[] = { #if SDL_AUDIO_DRIVER_COREAUDIO &COREAUDIO_bootstrap, #endif -#if SDL_AUDIO_DRIVER_DISK - &DISKAUDIO_bootstrap, -#endif -#if SDL_AUDIO_DRIVER_DUMMY - &DUMMYAUDIO_bootstrap, -#endif #if SDL_AUDIO_DRIVER_FUSIONSOUND &FUSIONSOUND_bootstrap, #endif @@ -133,10 +97,102 @@ static const AudioBootStrap *const bootstrap[] = { #endif #if SDL_AUDIO_DRIVER_EMSCRIPTEN &EMSCRIPTENAUDIO_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_JACK + &JACK_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_DISK + &DISKAUDIO_bootstrap, +#endif +#if SDL_AUDIO_DRIVER_DUMMY + &DUMMYAUDIO_bootstrap, #endif NULL }; + +#ifdef HAVE_LIBSAMPLERATE_H +#ifdef SDL_LIBSAMPLERATE_DYNAMIC +static void *SRC_lib = NULL; +#endif +SDL_bool SRC_available = SDL_FALSE; +int SRC_converter = 0; +SRC_STATE* (*SRC_src_new)(int converter_type, int channels, int *error) = NULL; +int (*SRC_src_process)(SRC_STATE *state, SRC_DATA *data) = NULL; +int (*SRC_src_reset)(SRC_STATE *state) = NULL; +SRC_STATE* (*SRC_src_delete)(SRC_STATE *state) = NULL; +const char* (*SRC_src_strerror)(int error) = NULL; + +static SDL_bool +LoadLibSampleRate(void) +{ + const char *hint = SDL_GetHint(SDL_HINT_AUDIO_RESAMPLING_MODE); + + SRC_available = SDL_FALSE; + SRC_converter = 0; + + if (!hint || *hint == '0' || SDL_strcasecmp(hint, "default") == 0) { + return SDL_FALSE; /* don't load anything. */ + } else if (*hint == '1' || SDL_strcasecmp(hint, "fast") == 0) { + SRC_converter = SRC_SINC_FASTEST; + } else if (*hint == '2' || SDL_strcasecmp(hint, "medium") == 0) { + SRC_converter = SRC_SINC_MEDIUM_QUALITY; + } else if (*hint == '3' || SDL_strcasecmp(hint, "best") == 0) { + SRC_converter = SRC_SINC_BEST_QUALITY; + } else { + return SDL_FALSE; /* treat it like "default", don't load anything. */ + } + +#ifdef SDL_LIBSAMPLERATE_DYNAMIC + SDL_assert(SRC_lib == NULL); + SRC_lib = SDL_LoadObject(SDL_LIBSAMPLERATE_DYNAMIC); + if (!SRC_lib) { + SDL_ClearError(); + return SDL_FALSE; + } + + SRC_src_new = (SRC_STATE* (*)(int converter_type, int channels, int *error))SDL_LoadFunction(SRC_lib, "src_new"); + SRC_src_process = (int (*)(SRC_STATE *state, SRC_DATA *data))SDL_LoadFunction(SRC_lib, "src_process"); + SRC_src_reset = (int(*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_reset"); + SRC_src_delete = (SRC_STATE* (*)(SRC_STATE *state))SDL_LoadFunction(SRC_lib, "src_delete"); + SRC_src_strerror = (const char* (*)(int error))SDL_LoadFunction(SRC_lib, "src_strerror"); + + if (!SRC_src_new || !SRC_src_process || !SRC_src_reset || !SRC_src_delete || !SRC_src_strerror) { + SDL_UnloadObject(SRC_lib); + SRC_lib = NULL; + return SDL_FALSE; + } +#else + SRC_src_new = src_new; + SRC_src_process = src_process; + SRC_src_reset = src_reset; + SRC_src_delete = src_delete; + SRC_src_strerror = src_strerror; +#endif + + SRC_available = SDL_TRUE; + return SDL_TRUE; +} + +static void +UnloadLibSampleRate(void) +{ +#ifdef SDL_LIBSAMPLERATE_DYNAMIC + if (SRC_lib != NULL) { + SDL_UnloadObject(SRC_lib); + } + SRC_lib = NULL; +#endif + + SRC_available = SDL_FALSE; + SRC_src_new = NULL; + SRC_src_process = NULL; + SRC_src_reset = NULL; + SRC_src_delete = NULL; + SRC_src_strerror = NULL; +} +#endif + static SDL_AudioDevice * get_audio_device(SDL_AudioDeviceID id) { @@ -169,6 +225,16 @@ SDL_AudioThreadInit_Default(_THIS) { /* no-op. */ } +static void +SDL_AudioThreadDeinit_Default(_THIS) +{ /* no-op. */ +} + +static void +SDL_AudioBeginLoopIteration_Default(_THIS) +{ /* no-op. */ +} + static void SDL_AudioWaitDevice_Default(_THIS) { /* no-op. */ @@ -288,6 +354,8 @@ finish_audio_entry_points_init(void) FILL_STUB(DetectDevices); FILL_STUB(OpenDevice); FILL_STUB(ThreadInit); + FILL_STUB(ThreadDeinit); + FILL_STUB(BeginLoopIteration); FILL_STUB(WaitDevice); FILL_STUB(PlayDevice); FILL_STUB(GetPendingBytes); @@ -448,136 +516,23 @@ SDL_RemoveAudioDevice(const int iscapture, void *handle) /* buffer queueing support... */ -/* this expects that you managed thread safety elsewhere. */ -static void -free_audio_queue(SDL_AudioBufferQueue *packet) -{ - while (packet) { - SDL_AudioBufferQueue *next = packet->next; - SDL_free(packet); - packet = next; - } -} - -/* NOTE: This assumes you'll hold the mixer lock before calling! */ -static int -queue_audio_to_device(SDL_AudioDevice *device, const Uint8 *data, Uint32 len) -{ - SDL_AudioBufferQueue *orighead; - SDL_AudioBufferQueue *origtail; - Uint32 origlen; - Uint32 datalen; - - orighead = device->buffer_queue_head; - origtail = device->buffer_queue_tail; - origlen = origtail ? origtail->datalen : 0; - - while (len > 0) { - SDL_AudioBufferQueue *packet = device->buffer_queue_tail; - SDL_assert(!packet || (packet->datalen <= SDL_AUDIOBUFFERQUEUE_PACKETLEN)); - if (!packet || (packet->datalen >= SDL_AUDIOBUFFERQUEUE_PACKETLEN)) { - /* tail packet missing or completely full; we need a new packet. */ - packet = device->buffer_queue_pool; - if (packet != NULL) { - /* we have one available in the pool. */ - device->buffer_queue_pool = packet->next; - } else { - /* Have to allocate a new one! */ - packet = (SDL_AudioBufferQueue *) SDL_malloc(sizeof (SDL_AudioBufferQueue)); - if (packet == NULL) { - /* uhoh, reset so we've queued nothing new, free what we can. */ - if (!origtail) { - packet = device->buffer_queue_head; /* whole queue. */ - } else { - packet = origtail->next; /* what we added to existing queue. */ - origtail->next = NULL; - origtail->datalen = origlen; - } - device->buffer_queue_head = orighead; - device->buffer_queue_tail = origtail; - device->buffer_queue_pool = NULL; - - free_audio_queue(packet); /* give back what we can. */ - - return SDL_OutOfMemory(); - } - } - packet->datalen = 0; - packet->startpos = 0; - packet->next = NULL; - - SDL_assert((device->buffer_queue_head != NULL) == (device->queued_bytes != 0)); - if (device->buffer_queue_tail == NULL) { - device->buffer_queue_head = packet; - } else { - device->buffer_queue_tail->next = packet; - } - device->buffer_queue_tail = packet; - } - - datalen = SDL_min(len, SDL_AUDIOBUFFERQUEUE_PACKETLEN - packet->datalen); - SDL_memcpy(packet->data + packet->datalen, data, datalen); - data += datalen; - len -= datalen; - packet->datalen += datalen; - device->queued_bytes += datalen; - } - - return 0; -} - -/* NOTE: This assumes you'll hold the mixer lock before calling! */ -static Uint32 -dequeue_audio_from_device(SDL_AudioDevice *device, Uint8 *stream, Uint32 len) -{ - SDL_AudioBufferQueue *packet; - Uint8 *ptr = stream; - - while ((len > 0) && ((packet = device->buffer_queue_head) != NULL)) { - const Uint32 avail = packet->datalen - packet->startpos; - const Uint32 cpy = SDL_min(len, avail); - SDL_assert(device->queued_bytes >= avail); - - SDL_memcpy(ptr, packet->data + packet->startpos, cpy); - packet->startpos += cpy; - ptr += cpy; - device->queued_bytes -= cpy; - len -= cpy; - - if (packet->startpos == packet->datalen) { /* packet is done, put it in the pool. */ - device->buffer_queue_head = packet->next; - SDL_assert((packet->next != NULL) || (packet == device->buffer_queue_tail)); - packet->next = device->buffer_queue_pool; - device->buffer_queue_pool = packet; - } - } - - SDL_assert((device->buffer_queue_head != NULL) == (device->queued_bytes != 0)); - - if (device->buffer_queue_head == NULL) { - device->buffer_queue_tail = NULL; /* in case we drained the queue entirely. */ - } - - return (Uint32) (ptr - stream); -} - static void SDLCALL SDL_BufferQueueDrainCallback(void *userdata, Uint8 *stream, int len) { /* this function always holds the mixer lock before being called. */ SDL_AudioDevice *device = (SDL_AudioDevice *) userdata; - Uint32 written; + size_t dequeued; SDL_assert(device != NULL); /* this shouldn't ever happen, right?! */ SDL_assert(!device->iscapture); /* this shouldn't ever happen, right?! */ SDL_assert(len >= 0); /* this shouldn't ever happen, right?! */ - written = dequeue_audio_from_device(device, stream, (Uint32) len); - stream += written; - len -= (int) written; + dequeued = SDL_ReadFromDataQueue(device->buffer_queue, stream, len); + stream += dequeued; + len -= (int) dequeued; if (len > 0) { /* fill any remaining space in the stream with silence. */ - SDL_assert(device->buffer_queue_head == NULL); + SDL_assert(SDL_CountDataQueue(device->buffer_queue) == 0); SDL_memset(stream, device->spec.silence, len); } } @@ -595,7 +550,7 @@ SDL_BufferQueueFillCallback(void *userdata, Uint8 *stream, int len) /* note that if this needs to allocate more space and run out of memory, we have no choice but to quietly drop the data and hope it works out later, but you probably have bigger problems in this case anyhow. */ - queue_audio_to_device(device, stream, (Uint32) len); + SDL_WriteToDataQueue(device->buffer_queue, stream, len); } int @@ -608,13 +563,13 @@ SDL_QueueAudio(SDL_AudioDeviceID devid, const void *data, Uint32 len) return -1; /* get_audio_device() will have set the error state */ } else if (device->iscapture) { return SDL_SetError("This is a capture device, queueing not allowed"); - } else if (device->spec.callback != SDL_BufferQueueDrainCallback) { + } else if (device->callbackspec.callback != SDL_BufferQueueDrainCallback) { return SDL_SetError("Audio device has a callback, queueing not allowed"); } if (len > 0) { current_audio.impl.LockDevice(device); - rc = queue_audio_to_device(device, data, len); + rc = SDL_WriteToDataQueue(device->buffer_queue, data, len); current_audio.impl.UnlockDevice(device); } @@ -630,12 +585,12 @@ SDL_DequeueAudio(SDL_AudioDeviceID devid, void *data, Uint32 len) if ( (len == 0) || /* nothing to do? */ (!device) || /* called with bogus device id */ (!device->iscapture) || /* playback devices can't dequeue */ - (device->spec.callback != SDL_BufferQueueFillCallback) ) { /* not set for queueing */ + (device->callbackspec.callback != SDL_BufferQueueFillCallback) ) { /* not set for queueing */ return 0; /* just report zero bytes dequeued. */ } current_audio.impl.LockDevice(device); - rc = dequeue_audio_from_device(device, data, len); + rc = (Uint32) SDL_ReadFromDataQueue(device->buffer_queue, data, len); current_audio.impl.UnlockDevice(device); return rc; } @@ -651,13 +606,13 @@ SDL_GetQueuedAudioSize(SDL_AudioDeviceID devid) } /* Nothing to do unless we're set up for queueing. */ - if (device->spec.callback == SDL_BufferQueueDrainCallback) { + if (device->callbackspec.callback == SDL_BufferQueueDrainCallback) { current_audio.impl.LockDevice(device); - retval = device->queued_bytes + current_audio.impl.GetPendingBytes(device); + retval = ((Uint32) SDL_CountDataQueue(device->buffer_queue)) + current_audio.impl.GetPendingBytes(device); current_audio.impl.UnlockDevice(device); - } else if (device->spec.callback == SDL_BufferQueueFillCallback) { + } else if (device->callbackspec.callback == SDL_BufferQueueFillCallback) { current_audio.impl.LockDevice(device); - retval = device->queued_bytes; + retval = (Uint32) SDL_CountDataQueue(device->buffer_queue); current_audio.impl.UnlockDevice(device); } @@ -668,7 +623,6 @@ void SDL_ClearQueuedAudio(SDL_AudioDeviceID devid) { SDL_AudioDevice *device = get_audio_device(devid); - SDL_AudioBufferQueue *packet; if (!device) { return; /* nothing to do. */ @@ -677,35 +631,10 @@ SDL_ClearQueuedAudio(SDL_AudioDeviceID devid) /* Blank out the device and release the mutex. Free it afterwards. */ current_audio.impl.LockDevice(device); - /* merge the available pool and the current queue into one list. */ - packet = device->buffer_queue_head; - if (packet) { - device->buffer_queue_tail->next = device->buffer_queue_pool; - } else { - packet = device->buffer_queue_pool; - } - - /* Remove the queued packets from the device. */ - device->buffer_queue_tail = NULL; - device->buffer_queue_head = NULL; - device->queued_bytes = 0; - device->buffer_queue_pool = packet; - /* Keep up to two packets in the pool to reduce future malloc pressure. */ - if (packet) { - if (!packet->next) { - packet = NULL; /* one packet (the only one) for the pool. */ - } else { - SDL_AudioBufferQueue *next = packet->next->next; - packet->next->next = NULL; /* two packets for the pool. */ - packet = next; /* rest will be freed. */ - } - } + SDL_ClearDataQueue(device->buffer_queue, SDL_AUDIOBUFFERQUEUE_PACKETLEN * 2); current_audio.impl.UnlockDevice(device); - - /* free any extra packets we didn't keep in the pool. */ - free_audio_queue(packet); } @@ -714,12 +643,10 @@ static int SDLCALL SDL_RunAudio(void *devicep) { SDL_AudioDevice *device = (SDL_AudioDevice *) devicep; - const int silence = (int) device->spec.silence; - const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq); - const int stream_len = (device->convert.needed) ? device->convert.len : device->spec.size; - Uint8 *stream; - void *udata = device->spec.userdata; - void (SDLCALL *callback) (void *, Uint8 *, int) = device->spec.callback; + void *udata = device->callbackspec.userdata; + SDL_AudioCallback callback = device->callbackspec.callback; + int data_len = 0; + Uint8 *data; SDL_assert(!device->iscapture); @@ -732,51 +659,64 @@ SDL_RunAudio(void *devicep) /* Loop, filling the audio buffers */ while (!SDL_AtomicGet(&device->shutdown)) { + current_audio.impl.BeginLoopIteration(device); + data_len = device->callbackspec.size; + /* Fill the current buffer with sound */ - if (device->convert.needed) { - stream = device->convert.buf; - } else if (SDL_AtomicGet(&device->enabled)) { - stream = current_audio.impl.GetDeviceBuf(device); + if (!device->stream && SDL_AtomicGet(&device->enabled)) { + SDL_assert(data_len == device->spec.size); + data = current_audio.impl.GetDeviceBuf(device); } else { /* if the device isn't enabled, we still write to the - fake_stream, so the app's callback will fire with + work_buffer, so the app's callback will fire with a regular frequency, in case they depend on that for timing or progress. They can use hotplug - now to know if the device failed. */ - stream = NULL; + now to know if the device failed. + Streaming playback uses work_buffer, too. */ + data = NULL; } - if (stream == NULL) { - stream = device->fake_stream; + if (data == NULL) { + data = device->work_buffer; } /* !!! FIXME: this should be LockDevice. */ - if ( SDL_AtomicGet(&device->enabled) ) { - SDL_LockMutex(device->mixer_lock); - if (SDL_AtomicGet(&device->paused)) { - SDL_memset(stream, silence, stream_len); - } else { - (*callback) (udata, stream, stream_len); - } - SDL_UnlockMutex(device->mixer_lock); - } - - /* Convert the audio if necessary */ - if (device->convert.needed && SDL_AtomicGet(&device->enabled)) { - SDL_ConvertAudio(&device->convert); - stream = current_audio.impl.GetDeviceBuf(device); - if (stream == NULL) { - stream = device->fake_stream; - } else { - SDL_memcpy(stream, device->convert.buf, - device->convert.len_cvt); - } - } - - /* Ready current buffer for play and change current buffer */ - if (stream == device->fake_stream) { - SDL_Delay(delay); + SDL_LockMutex(device->mixer_lock); + if (SDL_AtomicGet(&device->paused)) { + SDL_memset(data, device->spec.silence, data_len); } else { + callback(udata, data, data_len); + } + SDL_UnlockMutex(device->mixer_lock); + + if (device->stream) { + /* Stream available audio to device, converting/resampling. */ + /* if this fails...oh well. We'll play silence here. */ + SDL_AudioStreamPut(device->stream, data, data_len); + + while (SDL_AudioStreamAvailable(device->stream) >= ((int) device->spec.size)) { + int got; + data = SDL_AtomicGet(&device->enabled) ? current_audio.impl.GetDeviceBuf(device) : NULL; + got = SDL_AudioStreamGet(device->stream, data ? data : device->work_buffer, device->spec.size); + SDL_assert((got < 0) || (got == device->spec.size)); + + if (data == NULL) { /* device is having issues... */ + const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq); + SDL_Delay(delay); /* wait for as long as this buffer would have played. Maybe device recovers later? */ + } else { + if (got != device->spec.size) { + SDL_memset(data, device->spec.silence, device->spec.size); + } + current_audio.impl.PlayDevice(device); + current_audio.impl.WaitDevice(device); + } + } + } else if (data == device->work_buffer) { + /* nothing to do; pause like we queued a buffer to play. */ + const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq); + SDL_Delay(delay); + } else { /* writing directly to the device. */ + /* queue this buffer and wait for it to finish playing. */ current_audio.impl.PlayDevice(device); current_audio.impl.WaitDevice(device); } @@ -787,9 +727,12 @@ SDL_RunAudio(void *devicep) /* Wait for the audio to drain. */ SDL_Delay(((device->spec.samples * 1000) / device->spec.freq) * 2); + current_audio.impl.ThreadDeinit(device); + return 0; } +/* !!! FIXME: this needs to deal with device spec changes. */ /* The general capture thread function */ static int SDLCALL SDL_CaptureAudio(void *devicep) @@ -797,10 +740,10 @@ SDL_CaptureAudio(void *devicep) SDL_AudioDevice *device = (SDL_AudioDevice *) devicep; const int silence = (int) device->spec.silence; const Uint32 delay = ((device->spec.samples * 1000) / device->spec.freq); - const int stream_len = (device->convert.needed) ? device->convert.len : device->spec.size; - Uint8 *stream; - void *udata = device->spec.userdata; - void (SDLCALL *callback) (void *, Uint8 *, int) = device->spec.callback; + const int data_len = device->spec.size; + Uint8 *data; + void *udata = device->callbackspec.userdata; + SDL_AudioCallback callback = device->callbackspec.callback; SDL_assert(device->iscapture); @@ -816,34 +759,43 @@ SDL_CaptureAudio(void *devicep) int still_need; Uint8 *ptr; - if (!SDL_AtomicGet(&device->enabled) || SDL_AtomicGet(&device->paused)) { + current_audio.impl.BeginLoopIteration(device); + + if (SDL_AtomicGet(&device->paused)) { SDL_Delay(delay); /* just so we don't cook the CPU. */ + if (device->stream) { + SDL_AudioStreamClear(device->stream); + } current_audio.impl.FlushCapture(device); /* dump anything pending. */ continue; } /* Fill the current buffer with sound */ - still_need = stream_len; - if (device->convert.needed) { - ptr = stream = device->convert.buf; - } else { - /* just use the "fake" stream to hold data read from the device. */ - ptr = stream = device->fake_stream; - } + still_need = data_len; + + /* Use the work_buffer to hold data read from the device. */ + data = device->work_buffer; + SDL_assert(data != NULL); + + ptr = data; /* We still read from the device when "paused" to keep the state sane, and block when there isn't data so this thread isn't eating CPU. But we don't process it further or call the app's callback. */ - while (still_need > 0) { - const int rc = current_audio.impl.CaptureFromDevice(device, ptr, still_need); - SDL_assert(rc <= still_need); /* device should not overflow buffer. :) */ - if (rc > 0) { - still_need -= rc; - ptr += rc; - } else { /* uhoh, device failed for some reason! */ - SDL_OpenedAudioDeviceDisconnected(device); - break; + if (!SDL_AtomicGet(&device->enabled)) { + SDL_Delay(delay); /* try to keep callback firing at normal pace. */ + } else { + while (still_need > 0) { + const int rc = current_audio.impl.CaptureFromDevice(device, ptr, still_need); + SDL_assert(rc <= still_need); /* device should not overflow buffer. :) */ + if (rc > 0) { + still_need -= rc; + ptr += rc; + } else { /* uhoh, device failed for some reason! */ + SDL_OpenedAudioDeviceDisconnected(device); + break; + } } } @@ -852,22 +804,38 @@ SDL_CaptureAudio(void *devicep) SDL_memset(ptr, silence, still_need); } - if (device->convert.needed) { - SDL_ConvertAudio(&device->convert); - } + if (device->stream) { + /* if this fails...oh well. */ + SDL_AudioStreamPut(device->stream, data, data_len); - /* !!! FIXME: this should be LockDevice. */ - SDL_LockMutex(device->mixer_lock); - if (SDL_AtomicGet(&device->paused)) { - current_audio.impl.FlushCapture(device); /* one snuck in! */ - } else { - (*callback)(udata, stream, stream_len); + while (SDL_AudioStreamAvailable(device->stream) >= ((int) device->callbackspec.size)) { + const int got = SDL_AudioStreamGet(device->stream, device->work_buffer, device->callbackspec.size); + SDL_assert((got < 0) || (got == device->callbackspec.size)); + if (got != device->callbackspec.size) { + SDL_memset(device->work_buffer, device->spec.silence, device->callbackspec.size); + } + + /* !!! FIXME: this should be LockDevice. */ + SDL_LockMutex(device->mixer_lock); + if (!SDL_AtomicGet(&device->paused)) { + callback(udata, device->work_buffer, device->callbackspec.size); + } + SDL_UnlockMutex(device->mixer_lock); + } + } else { /* feeding user callback directly without streaming. */ + /* !!! FIXME: this should be LockDevice. */ + SDL_LockMutex(device->mixer_lock); + if (!SDL_AtomicGet(&device->paused)) { + callback(udata, data, device->callbackspec.size); + } + SDL_UnlockMutex(device->mixer_lock); } - SDL_UnlockMutex(device->mixer_lock); } current_audio.impl.FlushCapture(device); + current_audio.impl.ThreadDeinit(device); + return 0; } @@ -968,6 +936,10 @@ SDL_AudioInit(const char *driver_name) /* Make sure we have a list of devices available at startup. */ current_audio.impl.DetectDevices(); +#ifdef HAVE_LIBSAMPLERATE_H + LoadLibSampleRate(); +#endif + return 0; } @@ -1098,16 +1070,15 @@ close_audio_device(SDL_AudioDevice * device) if (device->mixer_lock != NULL) { SDL_DestroyMutex(device->mixer_lock); } - SDL_free(device->fake_stream); - if (device->convert.needed) { - SDL_free(device->convert.buf); - } + + SDL_free(device->work_buffer); + SDL_FreeAudioStream(device->stream); + if (device->hidden != NULL) { current_audio.impl.CloseDevice(device); } - free_audio_queue(device->buffer_queue_head); - free_audio_queue(device->buffer_queue_pool); + SDL_FreeDataQueue(device->buffer_queue); SDL_free(device); } @@ -1180,11 +1151,11 @@ open_audio_device(const char *devname, int iscapture, const SDL_AudioSpec * desired, SDL_AudioSpec * obtained, int allowed_changes, int min_id) { - const SDL_bool is_internal_thread = (desired->callback != NULL); + const SDL_bool is_internal_thread = (desired->callback == NULL); SDL_AudioDeviceID id = 0; SDL_AudioSpec _obtained; SDL_AudioDevice *device; - SDL_bool build_cvt; + SDL_bool build_stream; void *handle = NULL; int i = 0; @@ -1319,84 +1290,87 @@ open_audio_device(const char *devname, int iscapture, SDL_assert(device->hidden != NULL); /* See if we need to do any conversion */ - build_cvt = SDL_FALSE; + build_stream = SDL_FALSE; if (obtained->freq != device->spec.freq) { if (allowed_changes & SDL_AUDIO_ALLOW_FREQUENCY_CHANGE) { obtained->freq = device->spec.freq; } else { - build_cvt = SDL_TRUE; + build_stream = SDL_TRUE; } } if (obtained->format != device->spec.format) { if (allowed_changes & SDL_AUDIO_ALLOW_FORMAT_CHANGE) { obtained->format = device->spec.format; } else { - build_cvt = SDL_TRUE; + build_stream = SDL_TRUE; } } if (obtained->channels != device->spec.channels) { if (allowed_changes & SDL_AUDIO_ALLOW_CHANNELS_CHANGE) { obtained->channels = device->spec.channels; } else { - build_cvt = SDL_TRUE; + build_stream = SDL_TRUE; } } - /* If the audio driver changes the buffer size, accept it. - This needs to be done after the format is modified above, - otherwise it might not have the correct buffer size. + /* !!! FIXME in 2.1: add SDL_AUDIO_ALLOW_SAMPLES_CHANGE flag? + As of 2.0.6, we will build a stream to buffer the difference between + what the app wants to feed and the device wants to eat, so everyone + gets their way. In prior releases, SDL would force the callback to + feed at the rate the device requested, adjusted for resampling. */ if (device->spec.samples != obtained->samples) { - obtained->samples = device->spec.samples; - SDL_CalculateAudioSpec(obtained); + build_stream = SDL_TRUE; } - if (build_cvt) { - /* Build an audio conversion block */ - if (SDL_BuildAudioCVT(&device->convert, - obtained->format, obtained->channels, - obtained->freq, - device->spec.format, device->spec.channels, - device->spec.freq) < 0) { + SDL_CalculateAudioSpec(obtained); /* recalc after possible changes. */ + + device->callbackspec = *obtained; + + if (build_stream) { + if (iscapture) { + device->stream = SDL_NewAudioStream(device->spec.format, + device->spec.channels, device->spec.freq, + obtained->format, obtained->channels, obtained->freq); + } else { + device->stream = SDL_NewAudioStream(obtained->format, obtained->channels, + obtained->freq, device->spec.format, + device->spec.channels, device->spec.freq); + } + + if (!device->stream) { close_audio_device(device); return 0; } - if (device->convert.needed) { - device->convert.len = (int) (((double) device->spec.size) / - device->convert.len_ratio); - - device->convert.buf = - (Uint8 *) SDL_malloc(device->convert.len * - device->convert.len_mult); - if (device->convert.buf == NULL) { - close_audio_device(device); - SDL_OutOfMemory(); - return 0; - } - } } if (device->spec.callback == NULL) { /* use buffer queueing? */ /* pool a few packets to start. Enough for two callbacks. */ - const int packetlen = SDL_AUDIOBUFFERQUEUE_PACKETLEN; - const int wantbytes = ((device->convert.needed) ? device->convert.len : device->spec.size) * 2; - const int wantpackets = (wantbytes / packetlen) + ((wantbytes % packetlen) ? packetlen : 0); - for (i = 0; i < wantpackets; i++) { - SDL_AudioBufferQueue *packet = (SDL_AudioBufferQueue *) SDL_malloc(sizeof (SDL_AudioBufferQueue)); - if (packet) { /* don't care if this fails, we'll deal later. */ - packet->datalen = 0; - packet->startpos = 0; - packet->next = device->buffer_queue_pool; - device->buffer_queue_pool = packet; - } + device->buffer_queue = SDL_NewDataQueue(SDL_AUDIOBUFFERQUEUE_PACKETLEN, obtained->size * 2); + if (!device->buffer_queue) { + close_audio_device(device); + SDL_SetError("Couldn't create audio buffer queue"); + return 0; } - - device->spec.callback = iscapture ? SDL_BufferQueueFillCallback : SDL_BufferQueueDrainCallback; - device->spec.userdata = device; + device->callbackspec.callback = iscapture ? SDL_BufferQueueFillCallback : SDL_BufferQueueDrainCallback; + device->callbackspec.userdata = device; } - /* add it to our list of open devices. */ - open_devices[id] = device; + /* Allocate a scratch audio buffer */ + device->work_buffer_len = build_stream ? device->callbackspec.size : 0; + if (device->spec.size > device->work_buffer_len) { + device->work_buffer_len = device->spec.size; + } + SDL_assert(device->work_buffer_len > 0); + + device->work_buffer = (Uint8 *) SDL_malloc(device->work_buffer_len); + if (device->work_buffer == NULL) { + close_audio_device(device); + SDL_OutOfMemory(); + return 0; + } + + open_devices[id] = device; /* add it to our list of open devices. */ /* Start the audio thread if necessary */ if (!current_audio.impl.ProvidesOwnCallbackThread) { @@ -1406,21 +1380,7 @@ open_audio_device(const char *devname, int iscapture, const size_t stacksize = is_internal_thread ? 64 * 1024 : 0; char threadname[64]; - /* Allocate a fake audio buffer; only used by our internal threads. */ - Uint32 stream_len = (device->convert.needed) ? device->convert.len_cvt : 0; - if (device->spec.size > stream_len) { - stream_len = device->spec.size; - } - SDL_assert(stream_len > 0); - - device->fake_stream = (Uint8 *) SDL_malloc(stream_len); - if (device->fake_stream == NULL) { - close_audio_device(device); - SDL_OutOfMemory(); - return 0; - } - - SDL_snprintf(threadname, sizeof (threadname), "SDLAudioDev%d", (int) device->id); + SDL_snprintf(threadname, sizeof (threadname), "SDLAudio%c%d", (iscapture) ? 'C' : 'P', (int) device->id); device->thread = SDL_CreateThreadInternal(iscapture ? SDL_CaptureAudio : SDL_RunAudio, threadname, stacksize, device); if (device->thread == NULL) { @@ -1456,7 +1416,14 @@ SDL_OpenAudio(SDL_AudioSpec * desired, SDL_AudioSpec * obtained) id = open_audio_device(NULL, 0, desired, obtained, SDL_AUDIO_ALLOW_ANY_CHANGE, 1); } else { - id = open_audio_device(NULL, 0, desired, NULL, 0, 1); + SDL_AudioSpec _obtained; + SDL_zero(_obtained); + id = open_audio_device(NULL, 0, desired, &_obtained, 0, 1); + /* On successful open, copy calculated values into 'desired'. */ + if (id > 0) { + desired->size = _obtained.size; + desired->silence = _obtained.silence; + } } SDL_assert((id == 0) || (id == 1)); @@ -1579,6 +1546,12 @@ SDL_AudioQuit(void) SDL_zero(current_audio); SDL_zero(open_devices); + +#ifdef HAVE_LIBSAMPLERATE_H + UnloadLibSampleRate(); +#endif + + SDL_FreeResampleFilter(); } #define NUM_FORMATS 10 @@ -1655,13 +1628,7 @@ SDL_MixAudio(Uint8 * dst, const Uint8 * src, Uint32 len, int volume) /* Mix the user-level audio format */ SDL_AudioDevice *device = get_audio_device(1); if (device != NULL) { - SDL_AudioFormat format; - if (device->convert.needed) { - format = device->convert.src_format; - } else { - format = device->spec.format; - } - SDL_MixAudioFormat(dst, src, format, len, volume); + SDL_MixAudioFormat(dst, src, device->callbackspec.format, len, volume); } } diff --git a/Engine/lib/sdl/src/audio/SDL_audio_c.h b/Engine/lib/sdl/src/audio/SDL_audio_c.h index 7cde3a662..d47ebb130 100644 --- a/Engine/lib/sdl/src/audio/SDL_audio_c.h +++ b/Engine/lib/sdl/src/audio/SDL_audio_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,10 +18,35 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +#ifndef SDL_audio_c_h_ +#define SDL_audio_c_h_ + #include "../SDL_internal.h" +#ifndef DEBUG_CONVERT +#define DEBUG_CONVERT 0 +#endif + +#if DEBUG_CONVERT +#define LOG_DEBUG_CONVERT(from, to) fprintf(stderr, "Converting %s to %s.\n", from, to); +#else +#define LOG_DEBUG_CONVERT(from, to) +#endif + /* Functions and variables exported from SDL_audio.c for SDL_sysaudio.c */ +#ifdef HAVE_LIBSAMPLERATE_H +#include "samplerate.h" +extern SDL_bool SRC_available; +extern int SRC_converter; +extern SRC_STATE* (*SRC_src_new)(int converter_type, int channels, int *error); +extern int (*SRC_src_process)(SRC_STATE *state, SRC_DATA *data); +extern int (*SRC_src_reset)(SRC_STATE *state); +extern SRC_STATE* (*SRC_src_delete)(SRC_STATE *state); +extern const char* (*SRC_src_strerror)(int error); +#endif + /* Functions to get a list of "close" audio formats */ extern SDL_AudioFormat SDL_FirstAudioFormat(SDL_AudioFormat format); extern SDL_AudioFormat SDL_NextAudioFormat(void); @@ -29,24 +54,26 @@ extern SDL_AudioFormat SDL_NextAudioFormat(void); /* Function to calculate the size and silence for a SDL_AudioSpec */ extern void SDL_CalculateAudioSpec(SDL_AudioSpec * spec); -/* this is used internally to access some autogenerated code. */ -typedef struct -{ - SDL_AudioFormat src_fmt; - SDL_AudioFormat dst_fmt; - SDL_AudioFilter filter; -} SDL_AudioTypeFilters; -extern const SDL_AudioTypeFilters sdl_audio_type_filters[]; +/* Choose the audio filter functions below */ +extern void SDL_ChooseAudioConverters(void); -/* this is used internally to access some autogenerated code. */ -typedef struct -{ - SDL_AudioFormat fmt; - int channels; - int upsample; - int multiple; - SDL_AudioFilter filter; -} SDL_AudioRateFilters; -extern const SDL_AudioRateFilters sdl_audio_rate_filters[]; +/* These pointers get set during SDL_ChooseAudioConverters() to various SIMD implementations. */ +extern SDL_AudioFilter SDL_Convert_S8_to_F32; +extern SDL_AudioFilter SDL_Convert_U8_to_F32; +extern SDL_AudioFilter SDL_Convert_S16_to_F32; +extern SDL_AudioFilter SDL_Convert_U16_to_F32; +extern SDL_AudioFilter SDL_Convert_S32_to_F32; +extern SDL_AudioFilter SDL_Convert_F32_to_S8; +extern SDL_AudioFilter SDL_Convert_F32_to_U8; +extern SDL_AudioFilter SDL_Convert_F32_to_S16; +extern SDL_AudioFilter SDL_Convert_F32_to_U16; +extern SDL_AudioFilter SDL_Convert_F32_to_S32; + +/* You need to call SDL_PrepareResampleFilter() before using the internal resampler. + SDL_AudioQuit() calls SDL_FreeResamplerFilter(), you should never call it yourself. */ +extern int SDL_PrepareResampleFilter(void); +extern void SDL_FreeResampleFilter(void); + +#endif /* SDL_audio_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/SDL_audiocvt.c b/Engine/lib/sdl/src/audio/SDL_audiocvt.c index 3b47c4cbc..7fde2b93c 100644 --- a/Engine/lib/sdl/src/audio/SDL_audiocvt.c +++ b/Engine/lib/sdl/src/audio/SDL_audiocvt.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,165 +22,73 @@ /* Functions for audio drivers to perform runtime conversion of audio format */ +/* FIXME: Channel weights when converting from more channels to fewer may need to be adjusted, see https://msdn.microsoft.com/en-us/library/windows/desktop/ff819070(v=vs.85).aspx +*/ + +#include "SDL.h" #include "SDL_audio.h" #include "SDL_audio_c.h" +#include "SDL_loadso.h" #include "SDL_assert.h" +#include "../SDL_dataqueue.h" +#include "SDL_cpuinfo.h" -/* #define DEBUG_CONVERT */ +#define DEBUG_AUDIOSTREAM 0 -/* Effectively mix right and left channels into a single channel */ -static void SDLCALL -SDL_ConvertMono(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - Sint32 sample; - -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting to mono\n"); +#ifdef __SSE3__ +#define HAVE_SSE3_INTRINSICS 1 #endif - switch (format & (SDL_AUDIO_MASK_SIGNED | - SDL_AUDIO_MASK_BITSIZE | - SDL_AUDIO_MASK_DATATYPE)) { - case AUDIO_U8: - { - Uint8 *src, *dst; - src = cvt->buf; - dst = cvt->buf; - for (i = cvt->len_cvt / 2; i; --i) { - sample = src[0] + src[1]; - *dst = (Uint8) (sample / 2); - src += 2; - dst += 1; - } +#if HAVE_SSE3_INTRINSICS +/* Convert from stereo to mono. Average left and right. */ +static void SDLCALL +SDL_ConvertStereoToMono_SSE3(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i = cvt->len_cvt / 8; + + LOG_DEBUG_CONVERT("stereo", "mono (using SSE3)"); + SDL_assert(format == AUDIO_F32SYS); + + /* We can only do this if dst is aligned to 16 bytes; since src is the + same pointer and it moves by 2, it can't be forcibly aligned. */ + if ((((size_t) dst) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 divby2 = _mm_set1_ps(0.5f); + while (i >= 4) { /* 4 * float32 */ + _mm_store_ps(dst, _mm_mul_ps(_mm_hadd_ps(_mm_load_ps(src), _mm_load_ps(src+4)), divby2)); + i -= 4; src += 8; dst += 4; } - break; + } - case AUDIO_S8: - { - Sint8 *src, *dst; + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (src[0] + src[1]) * 0.5f; + dst++; i--; src += 2; + } - src = (Sint8 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / 2; i; --i) { - sample = src[0] + src[1]; - *dst = (Sint8) (sample / 2); - src += 2; - dst += 1; - } - } - break; + cvt->len_cvt /= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} +#endif - case AUDIO_U16: - { - Uint8 *src, *dst; +/* Convert from stereo to mono. Average left and right. */ +static void SDLCALL +SDL_ConvertStereoToMono(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; - src = cvt->buf; - dst = cvt->buf; - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - sample = (Uint16) ((src[0] << 8) | src[1]) + - (Uint16) ((src[2] << 8) | src[3]); - sample /= 2; - dst[1] = (sample & 0xFF); - sample >>= 8; - dst[0] = (sample & 0xFF); - src += 4; - dst += 2; - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - sample = (Uint16) ((src[1] << 8) | src[0]) + - (Uint16) ((src[3] << 8) | src[2]); - sample /= 2; - dst[0] = (sample & 0xFF); - sample >>= 8; - dst[1] = (sample & 0xFF); - src += 4; - dst += 2; - } - } - } - break; + LOG_DEBUG_CONVERT("stereo", "mono"); + SDL_assert(format == AUDIO_F32SYS); - case AUDIO_S16: - { - Uint8 *src, *dst; - - src = cvt->buf; - dst = cvt->buf; - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - sample = (Sint16) ((src[0] << 8) | src[1]) + - (Sint16) ((src[2] << 8) | src[3]); - sample /= 2; - dst[1] = (sample & 0xFF); - sample >>= 8; - dst[0] = (sample & 0xFF); - src += 4; - dst += 2; - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - sample = (Sint16) ((src[1] << 8) | src[0]) + - (Sint16) ((src[3] << 8) | src[2]); - sample /= 2; - dst[0] = (sample & 0xFF); - sample >>= 8; - dst[1] = (sample & 0xFF); - src += 4; - dst += 2; - } - } - } - break; - - case AUDIO_S32: - { - const Uint32 *src = (const Uint32 *) cvt->buf; - Uint32 *dst = (Uint32 *) cvt->buf; - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i, src += 2) { - const Sint64 added = - (((Sint64) (Sint32) SDL_SwapBE32(src[0])) + - ((Sint64) (Sint32) SDL_SwapBE32(src[1]))); - *(dst++) = SDL_SwapBE32((Uint32) ((Sint32) (added / 2))); - } - } else { - for (i = cvt->len_cvt / 8; i; --i, src += 2) { - const Sint64 added = - (((Sint64) (Sint32) SDL_SwapLE32(src[0])) + - ((Sint64) (Sint32) SDL_SwapLE32(src[1]))); - *(dst++) = SDL_SwapLE32((Uint32) ((Sint32) (added / 2))); - } - } - } - break; - - case AUDIO_F32: - { - const float *src = (const float *) cvt->buf; - float *dst = (float *) cvt->buf; - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i, src += 2) { - const float src1 = SDL_SwapFloatBE(src[0]); - const float src2 = SDL_SwapFloatBE(src[1]); - const double added = ((double) src1) + ((double) src2); - const float halved = (float) (added * 0.5); - *(dst++) = SDL_SwapFloatBE(halved); - } - } else { - for (i = cvt->len_cvt / 8; i; --i, src += 2) { - const float src1 = SDL_SwapFloatLE(src[0]); - const float src2 = SDL_SwapFloatLE(src[1]); - const double added = ((double) src1) + ((double) src2); - const float halved = (float) (added * 0.5); - *(dst++) = SDL_SwapFloatLE(halved); - } - } - } - break; + for (i = cvt->len_cvt / 8; i; --i, src += 2) { + *(dst++) = (src[0] + src[1]) * 0.5f; } cvt->len_cvt /= 2; @@ -190,43 +98,24 @@ SDL_ConvertMono(SDL_AudioCVT * cvt, SDL_AudioFormat format) } -/* Discard top 4 channels */ +/* Convert from 5.1 to stereo. Average left and right, distribute center, discard LFE. */ static void SDLCALL -SDL_ConvertStrip(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert51ToStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) { + float *dst = (float *) cvt->buf; + const float *src = dst; int i; -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting down from 6 channels to stereo\n"); -#endif + LOG_DEBUG_CONVERT("5.1", "stereo"); + SDL_assert(format == AUDIO_F32SYS); -#define strip_chans_6_to_2(type) \ - { \ - const type *src = (const type *) cvt->buf; \ - type *dst = (type *) cvt->buf; \ - for (i = cvt->len_cvt / (sizeof (type) * 6); i; --i) { \ - dst[0] = src[0]; \ - dst[1] = src[1]; \ - src += 6; \ - dst += 2; \ - } \ + /* SDL's 5.1 layout: FL+FR+FC+LFE+BL+BR */ + for (i = cvt->len_cvt / (sizeof (float) * 6); i; --i, src += 6, dst += 2) { + const float front_center_distributed = src[2] * 0.5f; + dst[0] = (src[0] + front_center_distributed + src[4]) / 2.5f; /* left */ + dst[1] = (src[1] + front_center_distributed + src[5]) / 2.5f; /* right */ } - /* this function only cares about typesize, and data as a block of bits. */ - switch (SDL_AUDIO_BITSIZE(format)) { - case 8: - strip_chans_6_to_2(Uint8); - break; - case 16: - strip_chans_6_to_2(Uint16); - break; - case 32: - strip_chans_6_to_2(Uint32); - break; - } - -#undef strip_chans_6_to_2 - cvt->len_cvt /= 3; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); @@ -234,44 +123,79 @@ SDL_ConvertStrip(SDL_AudioCVT * cvt, SDL_AudioFormat format) } -/* Discard top 2 channels of 6 */ +/* Convert from quad to stereo. Average left and right. */ static void SDLCALL -SDL_ConvertStrip_2(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_ConvertQuadToStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) { + float *dst = (float *) cvt->buf; + const float *src = dst; int i; -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting 6 down to quad\n"); -#endif + LOG_DEBUG_CONVERT("quad", "stereo"); + SDL_assert(format == AUDIO_F32SYS); -#define strip_chans_6_to_4(type) \ - { \ - const type *src = (const type *) cvt->buf; \ - type *dst = (type *) cvt->buf; \ - for (i = cvt->len_cvt / (sizeof (type) * 6); i; --i) { \ - dst[0] = src[0]; \ - dst[1] = src[1]; \ - dst[2] = src[2]; \ - dst[3] = src[3]; \ - src += 6; \ - dst += 4; \ - } \ + for (i = cvt->len_cvt / (sizeof (float) * 4); i; --i, src += 4, dst += 2) { + dst[0] = (src[0] + src[2]) * 0.5f; /* left */ + dst[1] = (src[1] + src[3]) * 0.5f; /* right */ } - /* this function only cares about typesize, and data as a block of bits. */ - switch (SDL_AUDIO_BITSIZE(format)) { - case 8: - strip_chans_6_to_4(Uint8); - break; - case 16: - strip_chans_6_to_4(Uint16); - break; - case 32: - strip_chans_6_to_4(Uint32); - break; + cvt->len_cvt /= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + + +/* Convert from 7.1 to 5.1. Distribute sides across front and back. */ +static void SDLCALL +SDL_Convert71To51(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("7.1", "5.1"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof (float) * 8); i; --i, src += 8, dst += 6) { + const float surround_left_distributed = src[6] * 0.5f; + const float surround_right_distributed = src[7] * 0.5f; + dst[0] = (src[0] + surround_left_distributed) / 1.5f; /* FL */ + dst[1] = (src[1] + surround_right_distributed) / 1.5f; /* FR */ + dst[2] = src[2] / 1.5f; /* CC */ + dst[3] = src[3] / 1.5f; /* LFE */ + dst[4] = (src[4] + surround_left_distributed) / 1.5f; /* BL */ + dst[5] = (src[5] + surround_right_distributed) / 1.5f; /* BR */ } -#undef strip_chans_6_to_4 + cvt->len_cvt /= 8; + cvt->len_cvt *= 6; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + + +/* Convert from 5.1 to quad. Distribute center across front, discard LFE. */ +static void SDLCALL +SDL_Convert51ToQuad(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + float *dst = (float *) cvt->buf; + const float *src = dst; + int i; + + LOG_DEBUG_CONVERT("5.1", "quad"); + SDL_assert(format == AUDIO_F32SYS); + + /* SDL's 4.0 layout: FL+FR+BL+BR */ + /* SDL's 5.1 layout: FL+FR+FC+LFE+BL+BR */ + for (i = cvt->len_cvt / (sizeof (float) * 6); i; --i, src += 6, dst += 4) { + const float front_center_distributed = src[2] * 0.5f; + dst[0] = (src[0] + front_center_distributed) / 1.5f; /* FL */ + dst[1] = (src[1] + front_center_distributed) / 1.5f; /* FR */ + dst[2] = src[4] / 1.5f; /* BL */ + dst[3] = src[5] / 1.5f; /* BR */ + } cvt->len_cvt /= 6; cvt->len_cvt *= 4; @@ -280,42 +204,24 @@ SDL_ConvertStrip_2(SDL_AudioCVT * cvt, SDL_AudioFormat format) } } -/* Duplicate a mono channel to both stereo channels */ + +/* Upmix mono to stereo (by duplication) */ static void SDLCALL -SDL_ConvertStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_ConvertMonoToStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) { + const float *src = (const float *) (cvt->buf + cvt->len_cvt); + float *dst = (float *) (cvt->buf + cvt->len_cvt * 2); int i; -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting to stereo\n"); -#endif + LOG_DEBUG_CONVERT("mono", "stereo"); + SDL_assert(format == AUDIO_F32SYS); -#define dup_chans_1_to_2(type) \ - { \ - const type *src = (const type *) (cvt->buf + cvt->len_cvt); \ - type *dst = (type *) (cvt->buf + cvt->len_cvt * 2); \ - for (i = cvt->len_cvt / sizeof(type); i; --i) { \ - src -= 1; \ - dst -= 2; \ - dst[0] = dst[1] = *src; \ - } \ + for (i = cvt->len_cvt / sizeof (float); i; --i) { + src--; + dst -= 2; + dst[0] = dst[1] = *src; } - /* this function only cares about typesize, and data as a block of bits. */ - switch (SDL_AUDIO_BITSIZE(format)) { - case 8: - dup_chans_1_to_2(Uint8); - break; - case 16: - dup_chans_1_to_2(Uint16); - break; - case 32: - dup_chans_1_to_2(Uint32); - break; - } - -#undef dup_chans_1_to_2 - cvt->len_cvt *= 2; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); @@ -323,258 +229,33 @@ SDL_ConvertStereo(SDL_AudioCVT * cvt, SDL_AudioFormat format) } -/* Duplicate a stereo channel to a pseudo-5.1 stream */ +/* Upmix stereo to a pseudo-5.1 stream */ static void SDLCALL -SDL_ConvertSurround(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_ConvertStereoTo51(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; + float lf, rf, ce; + const float *src = (const float *) (cvt->buf + cvt->len_cvt); + float *dst = (float *) (cvt->buf + cvt->len_cvt * 3); -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting stereo to surround\n"); -#endif - - switch (format & (SDL_AUDIO_MASK_SIGNED | - SDL_AUDIO_MASK_BITSIZE | - SDL_AUDIO_MASK_DATATYPE)) { - case AUDIO_U8: - { - Uint8 *src, *dst, lf, rf, ce; - - src = (Uint8 *) (cvt->buf + cvt->len_cvt); - dst = (Uint8 *) (cvt->buf + cvt->len_cvt * 3); - for (i = cvt->len_cvt; i; --i) { - dst -= 6; - src -= 2; - lf = src[0]; - rf = src[1]; - ce = (lf / 2) + (rf / 2); - dst[0] = lf; - dst[1] = rf; - dst[2] = lf - ce; - dst[3] = rf - ce; - dst[4] = ce; - dst[5] = ce; - } - } - break; - - case AUDIO_S8: - { - Sint8 *src, *dst, lf, rf, ce; - - src = (Sint8 *) cvt->buf + cvt->len_cvt; - dst = (Sint8 *) cvt->buf + cvt->len_cvt * 3; - for (i = cvt->len_cvt; i; --i) { - dst -= 6; - src -= 2; - lf = src[0]; - rf = src[1]; - ce = (lf / 2) + (rf / 2); - dst[0] = lf; - dst[1] = rf; - dst[2] = lf - ce; - dst[3] = rf - ce; - dst[4] = ce; - dst[5] = ce; - } - } - break; - - case AUDIO_U16: - { - Uint8 *src, *dst; - Uint16 lf, rf, ce, lr, rr; - - src = cvt->buf + cvt->len_cvt; - dst = cvt->buf + cvt->len_cvt * 3; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 12; - src -= 4; - lf = (Uint16) ((src[0] << 8) | src[1]); - rf = (Uint16) ((src[2] << 8) | src[3]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[1] = (lf & 0xFF); - dst[0] = ((lf >> 8) & 0xFF); - dst[3] = (rf & 0xFF); - dst[2] = ((rf >> 8) & 0xFF); - - dst[1 + 4] = (lr & 0xFF); - dst[0 + 4] = ((lr >> 8) & 0xFF); - dst[3 + 4] = (rr & 0xFF); - dst[2 + 4] = ((rr >> 8) & 0xFF); - - dst[1 + 8] = (ce & 0xFF); - dst[0 + 8] = ((ce >> 8) & 0xFF); - dst[3 + 8] = (ce & 0xFF); - dst[2 + 8] = ((ce >> 8) & 0xFF); - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 12; - src -= 4; - lf = (Uint16) ((src[1] << 8) | src[0]); - rf = (Uint16) ((src[3] << 8) | src[2]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[0] = (lf & 0xFF); - dst[1] = ((lf >> 8) & 0xFF); - dst[2] = (rf & 0xFF); - dst[3] = ((rf >> 8) & 0xFF); - - dst[0 + 4] = (lr & 0xFF); - dst[1 + 4] = ((lr >> 8) & 0xFF); - dst[2 + 4] = (rr & 0xFF); - dst[3 + 4] = ((rr >> 8) & 0xFF); - - dst[0 + 8] = (ce & 0xFF); - dst[1 + 8] = ((ce >> 8) & 0xFF); - dst[2 + 8] = (ce & 0xFF); - dst[3 + 8] = ((ce >> 8) & 0xFF); - } - } - } - break; - - case AUDIO_S16: - { - Uint8 *src, *dst; - Sint16 lf, rf, ce, lr, rr; - - src = cvt->buf + cvt->len_cvt; - dst = cvt->buf + cvt->len_cvt * 3; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 12; - src -= 4; - lf = (Sint16) ((src[0] << 8) | src[1]); - rf = (Sint16) ((src[2] << 8) | src[3]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[1] = (lf & 0xFF); - dst[0] = ((lf >> 8) & 0xFF); - dst[3] = (rf & 0xFF); - dst[2] = ((rf >> 8) & 0xFF); - - dst[1 + 4] = (lr & 0xFF); - dst[0 + 4] = ((lr >> 8) & 0xFF); - dst[3 + 4] = (rr & 0xFF); - dst[2 + 4] = ((rr >> 8) & 0xFF); - - dst[1 + 8] = (ce & 0xFF); - dst[0 + 8] = ((ce >> 8) & 0xFF); - dst[3 + 8] = (ce & 0xFF); - dst[2 + 8] = ((ce >> 8) & 0xFF); - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 12; - src -= 4; - lf = (Sint16) ((src[1] << 8) | src[0]); - rf = (Sint16) ((src[3] << 8) | src[2]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[0] = (lf & 0xFF); - dst[1] = ((lf >> 8) & 0xFF); - dst[2] = (rf & 0xFF); - dst[3] = ((rf >> 8) & 0xFF); - - dst[0 + 4] = (lr & 0xFF); - dst[1 + 4] = ((lr >> 8) & 0xFF); - dst[2 + 4] = (rr & 0xFF); - dst[3 + 4] = ((rr >> 8) & 0xFF); - - dst[0 + 8] = (ce & 0xFF); - dst[1 + 8] = ((ce >> 8) & 0xFF); - dst[2 + 8] = (ce & 0xFF); - dst[3 + 8] = ((ce >> 8) & 0xFF); - } - } - } - break; - - case AUDIO_S32: - { - Sint32 lf, rf, ce; - const Uint32 *src = (const Uint32 *) (cvt->buf + cvt->len_cvt); - Uint32 *dst = (Uint32 *) (cvt->buf + cvt->len_cvt * 3); - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 6; - src -= 2; - lf = (Sint32) SDL_SwapBE32(src[0]); - rf = (Sint32) SDL_SwapBE32(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = SDL_SwapBE32((Uint32) lf); - dst[1] = SDL_SwapBE32((Uint32) rf); - dst[2] = SDL_SwapBE32((Uint32) (lf - ce)); - dst[3] = SDL_SwapBE32((Uint32) (rf - ce)); - dst[4] = SDL_SwapBE32((Uint32) ce); - dst[5] = SDL_SwapBE32((Uint32) ce); - } - } else { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 6; - src -= 2; - lf = (Sint32) SDL_SwapLE32(src[0]); - rf = (Sint32) SDL_SwapLE32(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapLE32((Uint32) (lf - ce)); - dst[3] = SDL_SwapLE32((Uint32) (rf - ce)); - dst[4] = SDL_SwapLE32((Uint32) ce); - dst[5] = SDL_SwapLE32((Uint32) ce); - } - } - } - break; - - case AUDIO_F32: - { - float lf, rf, ce; - const float *src = (const float *) (cvt->buf + cvt->len_cvt); - float *dst = (float *) (cvt->buf + cvt->len_cvt * 3); - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 6; - src -= 2; - lf = SDL_SwapFloatBE(src[0]); - rf = SDL_SwapFloatBE(src[1]); - ce = (lf * 0.5f) + (rf * 0.5f); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapFloatBE(lf - ce); - dst[3] = SDL_SwapFloatBE(rf - ce); - dst[4] = dst[5] = SDL_SwapFloatBE(ce); - } - } else { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 6; - src -= 2; - lf = SDL_SwapFloatLE(src[0]); - rf = SDL_SwapFloatLE(src[1]); - ce = (lf * 0.5f) + (rf * 0.5f); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapFloatLE(lf - ce); - dst[3] = SDL_SwapFloatLE(rf - ce); - dst[4] = dst[5] = SDL_SwapFloatLE(ce); - } - } - } - break; + LOG_DEBUG_CONVERT("stereo", "5.1"); + SDL_assert(format == AUDIO_F32SYS); + for (i = cvt->len_cvt / (sizeof(float) * 2); i; --i) { + dst -= 6; + src -= 2; + lf = src[0]; + rf = src[1]; + ce = (lf + rf) * 0.5f; + /* !!! FIXME: FL and FR may clip */ + dst[0] = lf + (lf - ce); /* FL */ + dst[1] = rf + (rf - ce); /* FR */ + dst[2] = ce; /* FC */ + dst[3] = 0; /* LFE (only meant for special LFE effects) */ + dst[4] = lf; /* BL */ + dst[5] = rf; /* BR */ } + cvt->len_cvt *= 3; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); @@ -582,227 +263,66 @@ SDL_ConvertSurround(SDL_AudioCVT * cvt, SDL_AudioFormat format) } -/* Duplicate a stereo channel to a pseudo-4.0 stream */ +/* Upmix quad to a pseudo-5.1 stream */ static void SDLCALL -SDL_ConvertSurround_4(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_ConvertQuadTo51(SDL_AudioCVT * cvt, SDL_AudioFormat format) { int i; + float lf, rf, lb, rb, ce; + const float *src = (const float *) (cvt->buf + cvt->len_cvt); + float *dst = (float *) (cvt->buf + cvt->len_cvt * 3 / 2); -#ifdef DEBUG_CONVERT - fprintf(stderr, "Converting stereo to quad\n"); -#endif + LOG_DEBUG_CONVERT("quad", "5.1"); + SDL_assert(format == AUDIO_F32SYS); + SDL_assert(cvt->len_cvt % (sizeof(float) * 4) == 0); - switch (format & (SDL_AUDIO_MASK_SIGNED | - SDL_AUDIO_MASK_BITSIZE | - SDL_AUDIO_MASK_DATATYPE)) { - case AUDIO_U8: - { - Uint8 *src, *dst, lf, rf, ce; - - src = (Uint8 *) (cvt->buf + cvt->len_cvt); - dst = (Uint8 *) (cvt->buf + cvt->len_cvt * 2); - for (i = cvt->len_cvt; i; --i) { - dst -= 4; - src -= 2; - lf = src[0]; - rf = src[1]; - ce = (lf / 2) + (rf / 2); - dst[0] = lf; - dst[1] = rf; - dst[2] = lf - ce; - dst[3] = rf - ce; - } - } - break; - - case AUDIO_S8: - { - Sint8 *src, *dst, lf, rf, ce; - - src = (Sint8 *) cvt->buf + cvt->len_cvt; - dst = (Sint8 *) cvt->buf + cvt->len_cvt * 2; - for (i = cvt->len_cvt; i; --i) { - dst -= 4; - src -= 2; - lf = src[0]; - rf = src[1]; - ce = (lf / 2) + (rf / 2); - dst[0] = lf; - dst[1] = rf; - dst[2] = lf - ce; - dst[3] = rf - ce; - } - } - break; - - case AUDIO_U16: - { - Uint8 *src, *dst; - Uint16 lf, rf, ce, lr, rr; - - src = cvt->buf + cvt->len_cvt; - dst = cvt->buf + cvt->len_cvt * 2; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 8; - src -= 4; - lf = (Uint16) ((src[0] << 8) | src[1]); - rf = (Uint16) ((src[2] << 8) | src[3]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[1] = (lf & 0xFF); - dst[0] = ((lf >> 8) & 0xFF); - dst[3] = (rf & 0xFF); - dst[2] = ((rf >> 8) & 0xFF); - - dst[1 + 4] = (lr & 0xFF); - dst[0 + 4] = ((lr >> 8) & 0xFF); - dst[3 + 4] = (rr & 0xFF); - dst[2 + 4] = ((rr >> 8) & 0xFF); - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 8; - src -= 4; - lf = (Uint16) ((src[1] << 8) | src[0]); - rf = (Uint16) ((src[3] << 8) | src[2]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[0] = (lf & 0xFF); - dst[1] = ((lf >> 8) & 0xFF); - dst[2] = (rf & 0xFF); - dst[3] = ((rf >> 8) & 0xFF); - - dst[0 + 4] = (lr & 0xFF); - dst[1 + 4] = ((lr >> 8) & 0xFF); - dst[2 + 4] = (rr & 0xFF); - dst[3 + 4] = ((rr >> 8) & 0xFF); - } - } - } - break; - - case AUDIO_S16: - { - Uint8 *src, *dst; - Sint16 lf, rf, ce, lr, rr; - - src = cvt->buf + cvt->len_cvt; - dst = cvt->buf + cvt->len_cvt * 2; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 8; - src -= 4; - lf = (Sint16) ((src[0] << 8) | src[1]); - rf = (Sint16) ((src[2] << 8) | src[3]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[1] = (lf & 0xFF); - dst[0] = ((lf >> 8) & 0xFF); - dst[3] = (rf & 0xFF); - dst[2] = ((rf >> 8) & 0xFF); - - dst[1 + 4] = (lr & 0xFF); - dst[0 + 4] = ((lr >> 8) & 0xFF); - dst[3 + 4] = (rr & 0xFF); - dst[2 + 4] = ((rr >> 8) & 0xFF); - } - } else { - for (i = cvt->len_cvt / 4; i; --i) { - dst -= 8; - src -= 4; - lf = (Sint16) ((src[1] << 8) | src[0]); - rf = (Sint16) ((src[3] << 8) | src[2]); - ce = (lf / 2) + (rf / 2); - rr = lf - ce; - lr = rf - ce; - dst[0] = (lf & 0xFF); - dst[1] = ((lf >> 8) & 0xFF); - dst[2] = (rf & 0xFF); - dst[3] = ((rf >> 8) & 0xFF); - - dst[0 + 4] = (lr & 0xFF); - dst[1 + 4] = ((lr >> 8) & 0xFF); - dst[2 + 4] = (rr & 0xFF); - dst[3 + 4] = ((rr >> 8) & 0xFF); - } - } - } - break; - - case AUDIO_S32: - { - const Uint32 *src = (const Uint32 *) (cvt->buf + cvt->len_cvt); - Uint32 *dst = (Uint32 *) (cvt->buf + cvt->len_cvt * 2); - Sint32 lf, rf, ce; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 4; - src -= 2; - lf = (Sint32) SDL_SwapBE32(src[0]); - rf = (Sint32) SDL_SwapBE32(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapBE32((Uint32) (lf - ce)); - dst[3] = SDL_SwapBE32((Uint32) (rf - ce)); - } - } else { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 4; - src -= 2; - lf = (Sint32) SDL_SwapLE32(src[0]); - rf = (Sint32) SDL_SwapLE32(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapLE32((Uint32) (lf - ce)); - dst[3] = SDL_SwapLE32((Uint32) (rf - ce)); - } - } - } - break; - - case AUDIO_F32: - { - const float *src = (const float *) (cvt->buf + cvt->len_cvt); - float *dst = (float *) (cvt->buf + cvt->len_cvt * 2); - float lf, rf, ce; - - if (SDL_AUDIO_ISBIGENDIAN(format)) { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 4; - src -= 2; - lf = SDL_SwapFloatBE(src[0]); - rf = SDL_SwapFloatBE(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapFloatBE(lf - ce); - dst[3] = SDL_SwapFloatBE(rf - ce); - } - } else { - for (i = cvt->len_cvt / 8; i; --i) { - dst -= 4; - src -= 2; - lf = SDL_SwapFloatLE(src[0]); - rf = SDL_SwapFloatLE(src[1]); - ce = (lf / 2) + (rf / 2); - dst[0] = src[0]; - dst[1] = src[1]; - dst[2] = SDL_SwapFloatLE(lf - ce); - dst[3] = SDL_SwapFloatLE(rf - ce); - } - } - } - break; + for (i = cvt->len_cvt / (sizeof(float) * 4); i; --i) { + dst -= 6; + src -= 4; + lf = src[0]; + rf = src[1]; + lb = src[2]; + rb = src[3]; + ce = (lf + rf) * 0.5f; + /* !!! FIXME: FL and FR may clip */ + dst[0] = lf + (lf - ce); /* FL */ + dst[1] = rf + (rf - ce); /* FR */ + dst[2] = ce; /* FC */ + dst[3] = 0; /* LFE (only meant for special LFE effects) */ + dst[4] = lb; /* BL */ + dst[5] = rb; /* BR */ } + + cvt->len_cvt = cvt->len_cvt * 3 / 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + + +/* Upmix stereo to a pseudo-4.0 stream (by duplication) */ +static void SDLCALL +SDL_ConvertStereoToQuad(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) (cvt->buf + cvt->len_cvt); + float *dst = (float *) (cvt->buf + cvt->len_cvt * 2); + float lf, rf; + int i; + + LOG_DEBUG_CONVERT("stereo", "quad"); + SDL_assert(format == AUDIO_F32SYS); + + for (i = cvt->len_cvt / (sizeof(float) * 2); i; --i) { + dst -= 4; + src -= 2; + lf = src[0]; + rf = src[1]; + dst[0] = lf; /* FL */ + dst[1] = rf; /* FR */ + dst[2] = lf; /* BL */ + dst[3] = rf; /* BR */ + } + cvt->len_cvt *= 2; if (cvt->filters[++cvt->filter_index]) { cvt->filters[cvt->filter_index] (cvt, format); @@ -810,6 +330,212 @@ SDL_ConvertSurround_4(SDL_AudioCVT * cvt, SDL_AudioFormat format) } +/* Upmix 5.1 to 7.1 */ +static void SDLCALL +SDL_Convert51To71(SDL_AudioCVT * cvt, SDL_AudioFormat format) +{ + float lf, rf, lb, rb, ls, rs; + int i; + const float *src = (const float *) (cvt->buf + cvt->len_cvt); + float *dst = (float *) (cvt->buf + cvt->len_cvt * 4 / 3); + + LOG_DEBUG_CONVERT("5.1", "7.1"); + SDL_assert(format == AUDIO_F32SYS); + SDL_assert(cvt->len_cvt % (sizeof(float) * 6) == 0); + + for (i = cvt->len_cvt / (sizeof(float) * 6); i; --i) { + dst -= 8; + src -= 6; + lf = src[0]; + rf = src[1]; + lb = src[4]; + rb = src[5]; + ls = (lf + lb) * 0.5f; + rs = (rf + rb) * 0.5f; + /* !!! FIXME: these four may clip */ + lf += lf - ls; + rf += rf - ls; + lb += lb - ls; + rb += rb - ls; + dst[3] = src[3]; /* LFE */ + dst[2] = src[2]; /* FC */ + dst[7] = rs; /* SR */ + dst[6] = ls; /* SL */ + dst[5] = rb; /* BR */ + dst[4] = lb; /* BL */ + dst[1] = rf; /* FR */ + dst[0] = lf; /* FL */ + } + + cvt->len_cvt = cvt->len_cvt * 4 / 3; + + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index] (cvt, format); + } +} + +/* SDL's resampler uses a "bandlimited interpolation" algorithm: + https://ccrma.stanford.edu/~jos/resample/ */ + +#define RESAMPLER_ZERO_CROSSINGS 5 +#define RESAMPLER_BITS_PER_SAMPLE 16 +#define RESAMPLER_SAMPLES_PER_ZERO_CROSSING (1 << ((RESAMPLER_BITS_PER_SAMPLE / 2) + 1)) +#define RESAMPLER_FILTER_SIZE ((RESAMPLER_SAMPLES_PER_ZERO_CROSSING * RESAMPLER_ZERO_CROSSINGS) + 1) + +/* This is a "modified" bessel function, so you can't use POSIX j0() */ +static double +bessel(const double x) +{ + const double xdiv2 = x / 2.0; + double i0 = 1.0f; + double f = 1.0f; + int i = 1; + + while (SDL_TRUE) { + const double diff = SDL_pow(xdiv2, i * 2) / SDL_pow(f, 2); + if (diff < 1.0e-21f) { + break; + } + i0 += diff; + i++; + f *= (double) i; + } + + return i0; +} + +/* build kaiser table with cardinal sine applied to it, and array of differences between elements. */ +static void +kaiser_and_sinc(float *table, float *diffs, const int tablelen, const double beta) +{ + const int lenm1 = tablelen - 1; + const int lenm1div2 = lenm1 / 2; + int i; + + table[0] = 1.0f; + for (i = 1; i < tablelen; i++) { + const double kaiser = bessel(beta * SDL_sqrt(1.0 - SDL_pow(((i - lenm1) / 2.0) / lenm1div2, 2.0))) / bessel(beta); + table[tablelen - i] = (float) kaiser; + } + + for (i = 1; i < tablelen; i++) { + const float x = (((float) i) / ((float) RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) * ((float) M_PI); + table[i] *= SDL_sinf(x) / x; + diffs[i - 1] = table[i] - table[i - 1]; + } + diffs[lenm1] = 0.0f; +} + + +static SDL_SpinLock ResampleFilterSpinlock = 0; +static float *ResamplerFilter = NULL; +static float *ResamplerFilterDifference = NULL; + +int +SDL_PrepareResampleFilter(void) +{ + SDL_AtomicLock(&ResampleFilterSpinlock); + if (!ResamplerFilter) { + /* if dB > 50, beta=(0.1102 * (dB - 8.7)), according to Matlab. */ + const double dB = 80.0; + const double beta = 0.1102 * (dB - 8.7); + const size_t alloclen = RESAMPLER_FILTER_SIZE * sizeof (float); + + ResamplerFilter = (float *) SDL_malloc(alloclen); + if (!ResamplerFilter) { + SDL_AtomicUnlock(&ResampleFilterSpinlock); + return SDL_OutOfMemory(); + } + + ResamplerFilterDifference = (float *) SDL_malloc(alloclen); + if (!ResamplerFilterDifference) { + SDL_free(ResamplerFilter); + ResamplerFilter = NULL; + SDL_AtomicUnlock(&ResampleFilterSpinlock); + return SDL_OutOfMemory(); + } + kaiser_and_sinc(ResamplerFilter, ResamplerFilterDifference, RESAMPLER_FILTER_SIZE, beta); + } + SDL_AtomicUnlock(&ResampleFilterSpinlock); + return 0; +} + +void +SDL_FreeResampleFilter(void) +{ + SDL_free(ResamplerFilter); + SDL_free(ResamplerFilterDifference); + ResamplerFilter = NULL; + ResamplerFilterDifference = NULL; +} + +static int +ResamplerPadding(const int inrate, const int outrate) +{ + if (inrate == outrate) { + return 0; + } else if (inrate > outrate) { + return (int) SDL_ceil(((float) (RESAMPLER_SAMPLES_PER_ZERO_CROSSING * inrate) / ((float) outrate))); + } + return RESAMPLER_SAMPLES_PER_ZERO_CROSSING; +} + +/* lpadding and rpadding are expected to be buffers of (ResamplePadding(inrate, outrate) * chans * sizeof (float)) bytes. */ +static int +SDL_ResampleAudio(const int chans, const int inrate, const int outrate, + const float *lpadding, const float *rpadding, + const float *inbuf, const int inbuflen, + float *outbuf, const int outbuflen) +{ + const double finrate = (double) inrate; + const double outtimeincr = 1.0 / ((float) outrate); + const double ratio = ((float) outrate) / ((float) inrate); + const int paddinglen = ResamplerPadding(inrate, outrate); + const int framelen = chans * (int)sizeof (float); + const int inframes = inbuflen / framelen; + const int wantedoutframes = (int) ((inbuflen / framelen) * ratio); /* outbuflen isn't total to write, it's total available. */ + const int maxoutframes = outbuflen / framelen; + const int outframes = SDL_min(wantedoutframes, maxoutframes); + float *dst = outbuf; + double outtime = 0.0; + int i, j, chan; + + for (i = 0; i < outframes; i++) { + const int srcindex = (int) (outtime * inrate); + const double intime = ((double) srcindex) / finrate; + const double innexttime = ((double) (srcindex + 1)) / finrate; + const double interpolation1 = 1.0 - ((innexttime - outtime) / (innexttime - intime)); + const int filterindex1 = (int) (interpolation1 * RESAMPLER_SAMPLES_PER_ZERO_CROSSING); + const double interpolation2 = 1.0 - interpolation1; + const int filterindex2 = (int) (interpolation2 * RESAMPLER_SAMPLES_PER_ZERO_CROSSING); + + for (chan = 0; chan < chans; chan++) { + float outsample = 0.0f; + + /* do this twice to calculate the sample, once for the "left wing" and then same for the right. */ + /* !!! FIXME: do both wings in one loop */ + for (j = 0; (filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) < RESAMPLER_FILTER_SIZE; j++) { + const int srcframe = srcindex - j; + /* !!! FIXME: we can bubble this conditional out of here by doing a pre loop. */ + const float insample = (srcframe < 0) ? lpadding[((paddinglen + srcframe) * chans) + chan] : inbuf[(srcframe * chans) + chan]; + outsample += (float)(insample * (ResamplerFilter[filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)] + (interpolation1 * ResamplerFilterDifference[filterindex1 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)]))); + } + + for (j = 0; (filterindex2 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)) < RESAMPLER_FILTER_SIZE; j++) { + const int srcframe = srcindex + 1 + j; + /* !!! FIXME: we can bubble this conditional out of here by doing a post loop. */ + const float insample = (srcframe >= inframes) ? rpadding[((srcframe - inframes) * chans) + chan] : inbuf[(srcframe * chans) + chan]; + outsample += (float)(insample * (ResamplerFilter[filterindex2 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)] + (interpolation2 * ResamplerFilterDifference[filterindex2 + (j * RESAMPLER_SAMPLES_PER_ZERO_CROSSING)]))); + } + *(dst++) = outsample; + } + + outtime += outtimeincr; + } + + return outframes * chans * sizeof (float); +} + int SDL_ConvertAudio(SDL_AudioCVT * cvt) { @@ -818,68 +544,106 @@ SDL_ConvertAudio(SDL_AudioCVT * cvt) /* Make sure there's data to convert */ if (cvt->buf == NULL) { - SDL_SetError("No buffer allocated for conversion"); - return (-1); + return SDL_SetError("No buffer allocated for conversion"); } + /* Return okay if no conversion is necessary */ cvt->len_cvt = cvt->len; if (cvt->filters[0] == NULL) { - return (0); + return 0; } /* Set up the conversion and go! */ cvt->filter_index = 0; cvt->filters[0] (cvt, cvt->src_format); - return (0); + return 0; } - -static SDL_AudioFilter -SDL_HandTunedTypeCVT(SDL_AudioFormat src_fmt, SDL_AudioFormat dst_fmt) +static void SDLCALL +SDL_Convert_Byteswap(SDL_AudioCVT *cvt, SDL_AudioFormat format) { - /* - * Fill in any future conversions that are specialized to a - * processor, platform, compiler, or library here. - */ +#if DEBUG_CONVERT + printf("Converting byte order\n"); +#endif - return NULL; /* no specialized converter code available. */ + switch (SDL_AUDIO_BITSIZE(format)) { + #define CASESWAP(b) \ + case b: { \ + Uint##b *ptr = (Uint##b *) cvt->buf; \ + int i; \ + for (i = cvt->len_cvt / sizeof (*ptr); i; --i, ++ptr) { \ + *ptr = SDL_Swap##b(*ptr); \ + } \ + break; \ + } + + CASESWAP(16); + CASESWAP(32); + CASESWAP(64); + + #undef CASESWAP + + default: SDL_assert(!"unhandled byteswap datatype!"); break; + } + + if (cvt->filters[++cvt->filter_index]) { + /* flip endian flag for data. */ + if (format & SDL_AUDIO_MASK_ENDIAN) { + format &= ~SDL_AUDIO_MASK_ENDIAN; + } else { + format |= SDL_AUDIO_MASK_ENDIAN; + } + cvt->filters[cvt->filter_index](cvt, format); + } } - -/* - * Find a converter between two data types. We try to select a hand-tuned - * asm/vectorized/optimized function first, and then fallback to an - * autogenerated function that is customized to convert between two - * specific data types. - */ static int -SDL_BuildAudioTypeCVT(SDL_AudioCVT * cvt, - SDL_AudioFormat src_fmt, SDL_AudioFormat dst_fmt) +SDL_AddAudioCVTFilter(SDL_AudioCVT *cvt, const SDL_AudioFilter filter) { - if (src_fmt != dst_fmt) { + if (cvt->filter_index >= SDL_AUDIOCVT_MAX_FILTERS) { + return SDL_SetError("Too many filters needed for conversion, exceeded maximum of %d", SDL_AUDIOCVT_MAX_FILTERS); + } + if (filter == NULL) { + return SDL_SetError("Audio filter pointer is NULL"); + } + cvt->filters[cvt->filter_index++] = filter; + cvt->filters[cvt->filter_index] = NULL; /* Moving terminator */ + return 0; +} + +static int +SDL_BuildAudioTypeCVTToFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat src_fmt) +{ + int retval = 0; /* 0 == no conversion necessary. */ + + if ((SDL_AUDIO_ISBIGENDIAN(src_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) { + return -1; + } + retval = 1; /* added a converter. */ + } + + if (!SDL_AUDIO_ISFLOAT(src_fmt)) { const Uint16 src_bitsize = SDL_AUDIO_BITSIZE(src_fmt); - const Uint16 dst_bitsize = SDL_AUDIO_BITSIZE(dst_fmt); - SDL_AudioFilter filter = SDL_HandTunedTypeCVT(src_fmt, dst_fmt); + const Uint16 dst_bitsize = 32; + SDL_AudioFilter filter = NULL; - /* No hand-tuned converter? Try the autogenerated ones. */ - if (filter == NULL) { - int i; - for (i = 0; sdl_audio_type_filters[i].filter != NULL; i++) { - const SDL_AudioTypeFilters *filt = &sdl_audio_type_filters[i]; - if ((filt->src_fmt == src_fmt) && (filt->dst_fmt == dst_fmt)) { - filter = filt->filter; - break; - } - } - - if (filter == NULL) { - SDL_SetError("No conversion available for these formats"); - return -1; - } + switch (src_fmt & ~SDL_AUDIO_MASK_ENDIAN) { + case AUDIO_S8: filter = SDL_Convert_S8_to_F32; break; + case AUDIO_U8: filter = SDL_Convert_U8_to_F32; break; + case AUDIO_S16: filter = SDL_Convert_S16_to_F32; break; + case AUDIO_U16: filter = SDL_Convert_U16_to_F32; break; + case AUDIO_S32: filter = SDL_Convert_S32_to_F32; break; + default: SDL_assert(!"Unexpected audio format!"); break; } - /* Update (cvt) with filter details... */ - cvt->filters[cvt->filter_index++] = filter; + if (!filter) { + return SDL_SetError("No conversion from source format to float available"); + } + + if (SDL_AddAudioCVTFilter(cvt, filter) < 0) { + return -1; + } if (src_bitsize < dst_bitsize) { const int mult = (dst_bitsize / src_bitsize); cvt->len_mult *= mult; @@ -888,110 +652,220 @@ SDL_BuildAudioTypeCVT(SDL_AudioCVT * cvt, cvt->len_ratio /= (src_bitsize / dst_bitsize); } - return 1; /* added a converter. */ + retval = 1; /* added a converter. */ } - return 0; /* no conversion necessary. */ -} - - -static SDL_AudioFilter -SDL_HandTunedResampleCVT(SDL_AudioCVT * cvt, int dst_channels, - int src_rate, int dst_rate) -{ - /* - * Fill in any future conversions that are specialized to a - * processor, platform, compiler, or library here. - */ - - return NULL; /* no specialized converter code available. */ -} - -static int -SDL_FindFrequencyMultiple(const int src_rate, const int dst_rate) -{ - int retval = 0; - - /* If we only built with the arbitrary resamplers, ignore multiples. */ -#if !LESS_RESAMPLERS - int lo, hi; - int div; - - SDL_assert(src_rate != 0); - SDL_assert(dst_rate != 0); - SDL_assert(src_rate != dst_rate); - - if (src_rate < dst_rate) { - lo = src_rate; - hi = dst_rate; - } else { - lo = dst_rate; - hi = src_rate; - } - - /* zero means "not a supported multiple" ... we only do 2x and 4x. */ - if ((hi % lo) != 0) - return 0; /* not a multiple. */ - - div = hi / lo; - retval = ((div == 2) || (div == 4)) ? div : 0; -#endif - return retval; } static int -SDL_BuildAudioResampleCVT(SDL_AudioCVT * cvt, int dst_channels, - int src_rate, int dst_rate) +SDL_BuildAudioTypeCVTFromFloat(SDL_AudioCVT *cvt, const SDL_AudioFormat dst_fmt) { - if (src_rate != dst_rate) { - SDL_AudioFilter filter = SDL_HandTunedResampleCVT(cvt, dst_channels, - src_rate, dst_rate); + int retval = 0; /* 0 == no conversion necessary. */ - /* No hand-tuned converter? Try the autogenerated ones. */ - if (filter == NULL) { - int i; - const int upsample = (src_rate < dst_rate) ? 1 : 0; - const int multiple = - SDL_FindFrequencyMultiple(src_rate, dst_rate); - - for (i = 0; sdl_audio_rate_filters[i].filter != NULL; i++) { - const SDL_AudioRateFilters *filt = &sdl_audio_rate_filters[i]; - if ((filt->fmt == cvt->dst_format) && - (filt->channels == dst_channels) && - (filt->upsample == upsample) && - (filt->multiple == multiple)) { - filter = filt->filter; - break; - } - } - - if (filter == NULL) { - SDL_SetError("No conversion available for these rates"); - return -1; - } + if (!SDL_AUDIO_ISFLOAT(dst_fmt)) { + const Uint16 dst_bitsize = SDL_AUDIO_BITSIZE(dst_fmt); + const Uint16 src_bitsize = 32; + SDL_AudioFilter filter = NULL; + switch (dst_fmt & ~SDL_AUDIO_MASK_ENDIAN) { + case AUDIO_S8: filter = SDL_Convert_F32_to_S8; break; + case AUDIO_U8: filter = SDL_Convert_F32_to_U8; break; + case AUDIO_S16: filter = SDL_Convert_F32_to_S16; break; + case AUDIO_U16: filter = SDL_Convert_F32_to_U16; break; + case AUDIO_S32: filter = SDL_Convert_F32_to_S32; break; + default: SDL_assert(!"Unexpected audio format!"); break; } - /* Update (cvt) with filter details... */ - cvt->filters[cvt->filter_index++] = filter; - if (src_rate < dst_rate) { - const double mult = ((double) dst_rate) / ((double) src_rate); - cvt->len_mult *= (int) SDL_ceil(mult); + if (!filter) { + return SDL_SetError("No conversion from float to destination format available"); + } + + if (SDL_AddAudioCVTFilter(cvt, filter) < 0) { + return -1; + } + if (src_bitsize < dst_bitsize) { + const int mult = (dst_bitsize / src_bitsize); + cvt->len_mult *= mult; cvt->len_ratio *= mult; - } else { - cvt->len_ratio /= ((double) src_rate) / ((double) dst_rate); + } else if (src_bitsize > dst_bitsize) { + cvt->len_ratio /= (src_bitsize / dst_bitsize); } - - return 1; /* added a converter. */ + retval = 1; /* added a converter. */ } - return 0; /* no conversion necessary. */ + if ((SDL_AUDIO_ISBIGENDIAN(dst_fmt) != 0) == (SDL_BYTEORDER == SDL_LIL_ENDIAN)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) { + return -1; + } + retval = 1; /* added a converter. */ + } + + return retval; +} + +static void +SDL_ResampleCVT(SDL_AudioCVT *cvt, const int chans, const SDL_AudioFormat format) +{ + /* !!! FIXME in 2.1: there are ten slots in the filter list, and the theoretical maximum we use is six (seven with NULL terminator). + !!! FIXME in 2.1: We need to store data for this resampler, because the cvt structure doesn't store the original sample rates, + !!! FIXME in 2.1: so we steal the ninth and tenth slot. :( */ + const int inrate = (int) (size_t) cvt->filters[SDL_AUDIOCVT_MAX_FILTERS-1]; + const int outrate = (int) (size_t) cvt->filters[SDL_AUDIOCVT_MAX_FILTERS]; + const float *src = (const float *) cvt->buf; + const int srclen = cvt->len_cvt; + /*float *dst = (float *) cvt->buf; + const int dstlen = (cvt->len * cvt->len_mult);*/ + /* !!! FIXME: remove this if we can get the resampler to work in-place again. */ + float *dst = (float *) (cvt->buf + srclen); + const int dstlen = (cvt->len * cvt->len_mult) - srclen; + const int paddingsamples = (ResamplerPadding(inrate, outrate) * chans); + float *padding; + + SDL_assert(format == AUDIO_F32SYS); + + /* we keep no streaming state here, so pad with silence on both ends. */ + padding = (float *) SDL_calloc(paddingsamples, sizeof (float)); + if (!padding) { + SDL_OutOfMemory(); + return; + } + + cvt->len_cvt = SDL_ResampleAudio(chans, inrate, outrate, padding, padding, src, srclen, dst, dstlen); + + SDL_free(padding); + + SDL_memmove(cvt->buf, dst, cvt->len_cvt); /* !!! FIXME: remove this if we can get the resampler to work in-place again. */ + + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, format); + } +} + +/* !!! FIXME: We only have this macro salsa because SDL_AudioCVT doesn't + !!! FIXME: store channel info, so we have to have function entry + !!! FIXME: points for each supported channel count and multiple + !!! FIXME: vs arbitrary. When we rev the ABI, clean this up. */ +#define RESAMPLER_FUNCS(chans) \ + static void SDLCALL \ + SDL_ResampleCVT_c##chans(SDL_AudioCVT *cvt, SDL_AudioFormat format) { \ + SDL_ResampleCVT(cvt, chans, format); \ + } +RESAMPLER_FUNCS(1) +RESAMPLER_FUNCS(2) +RESAMPLER_FUNCS(4) +RESAMPLER_FUNCS(6) +RESAMPLER_FUNCS(8) +#undef RESAMPLER_FUNCS + +static SDL_AudioFilter +ChooseCVTResampler(const int dst_channels) +{ + switch (dst_channels) { + case 1: return SDL_ResampleCVT_c1; + case 2: return SDL_ResampleCVT_c2; + case 4: return SDL_ResampleCVT_c4; + case 6: return SDL_ResampleCVT_c6; + case 8: return SDL_ResampleCVT_c8; + default: break; + } + + return NULL; +} + +static int +SDL_BuildAudioResampleCVT(SDL_AudioCVT * cvt, const int dst_channels, + const int src_rate, const int dst_rate) +{ + SDL_AudioFilter filter; + + if (src_rate == dst_rate) { + return 0; /* no conversion necessary. */ + } + + filter = ChooseCVTResampler(dst_channels); + if (filter == NULL) { + return SDL_SetError("No conversion available for these rates"); + } + + if (SDL_PrepareResampleFilter() < 0) { + return -1; + } + + /* Update (cvt) with filter details... */ + if (SDL_AddAudioCVTFilter(cvt, filter) < 0) { + return -1; + } + + /* !!! FIXME in 2.1: there are ten slots in the filter list, and the theoretical maximum we use is six (seven with NULL terminator). + !!! FIXME in 2.1: We need to store data for this resampler, because the cvt structure doesn't store the original sample rates, + !!! FIXME in 2.1: so we steal the ninth and tenth slot. :( */ + if (cvt->filter_index >= (SDL_AUDIOCVT_MAX_FILTERS-2)) { + return SDL_SetError("Too many filters needed for conversion, exceeded maximum of %d", SDL_AUDIOCVT_MAX_FILTERS-2); + } + cvt->filters[SDL_AUDIOCVT_MAX_FILTERS-1] = (SDL_AudioFilter) (size_t) src_rate; + cvt->filters[SDL_AUDIOCVT_MAX_FILTERS] = (SDL_AudioFilter) (size_t) dst_rate; + + if (src_rate < dst_rate) { + const double mult = ((double) dst_rate) / ((double) src_rate); + cvt->len_mult *= (int) SDL_ceil(mult); + cvt->len_ratio *= mult; + } else { + cvt->len_ratio /= ((double) src_rate) / ((double) dst_rate); + } + + /* !!! FIXME: remove this if we can get the resampler to work in-place again. */ + /* the buffer is big enough to hold the destination now, but + we need it large enough to hold a separate scratch buffer. */ + cvt->len_mult *= 2; + + return 1; /* added a converter. */ +} + +static SDL_bool +SDL_SupportedAudioFormat(const SDL_AudioFormat fmt) +{ + switch (fmt) { + case AUDIO_U8: + case AUDIO_S8: + case AUDIO_U16LSB: + case AUDIO_S16LSB: + case AUDIO_U16MSB: + case AUDIO_S16MSB: + case AUDIO_S32LSB: + case AUDIO_S32MSB: + case AUDIO_F32LSB: + case AUDIO_F32MSB: + return SDL_TRUE; /* supported. */ + + default: + break; + } + + return SDL_FALSE; /* unsupported. */ +} + +static SDL_bool +SDL_SupportedChannelCount(const int channels) +{ + switch (channels) { + case 1: /* mono */ + case 2: /* stereo */ + case 4: /* quad */ + case 6: /* 5.1 */ + case 8: /* 7.1 */ + return SDL_TRUE; /* supported. */ + + default: + break; + } + + return SDL_FALSE; /* unsupported. */ } /* Creates a set of audio filters to convert from one format to another. - Returns -1 if the format conversion is not supported, 0 if there's - no conversion needed, or 1 if the audio filter is set up. + Returns 0 if no conversion is needed, 1 if the audio filter is set up, + or -1 if an error like invalid parameter, unsupported format, etc. occurred. */ int @@ -999,123 +873,801 @@ SDL_BuildAudioCVT(SDL_AudioCVT * cvt, SDL_AudioFormat src_fmt, Uint8 src_channels, int src_rate, SDL_AudioFormat dst_fmt, Uint8 dst_channels, int dst_rate) { - /* - * !!! FIXME: reorder filters based on which grow/shrink the buffer. - * !!! FIXME: ideally, we should do everything that shrinks the buffer - * !!! FIXME: first, so we don't have to process as many bytes in a given - * !!! FIXME: filter and abuse the CPU cache less. This might not be as - * !!! FIXME: good in practice as it sounds in theory, though. - */ - /* Sanity check target pointer */ if (cvt == NULL) { return SDL_InvalidParamError("cvt"); } - /* there are no unsigned types over 16 bits, so catch this up front. */ - if ((SDL_AUDIO_BITSIZE(src_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(src_fmt))) { + /* Make sure we zero out the audio conversion before error checking */ + SDL_zerop(cvt); + + if (!SDL_SupportedAudioFormat(src_fmt)) { return SDL_SetError("Invalid source format"); - } - if ((SDL_AUDIO_BITSIZE(dst_fmt) > 16) && (!SDL_AUDIO_ISSIGNED(dst_fmt))) { + } else if (!SDL_SupportedAudioFormat(dst_fmt)) { return SDL_SetError("Invalid destination format"); + } else if (!SDL_SupportedChannelCount(src_channels)) { + return SDL_SetError("Invalid source channels"); + } else if (!SDL_SupportedChannelCount(dst_channels)) { + return SDL_SetError("Invalid destination channels"); + } else if (src_rate == 0) { + return SDL_SetError("Source rate is zero"); + } else if (dst_rate == 0) { + return SDL_SetError("Destination rate is zero"); } - /* prevent possible divisions by zero, etc. */ - if ((src_channels == 0) || (dst_channels == 0)) { - return SDL_SetError("Source or destination channels is zero"); - } - if ((src_rate == 0) || (dst_rate == 0)) { - return SDL_SetError("Source or destination rate is zero"); - } -#ifdef DEBUG_CONVERT +#if DEBUG_CONVERT printf("Build format %04x->%04x, channels %u->%u, rate %d->%d\n", src_fmt, dst_fmt, src_channels, dst_channels, src_rate, dst_rate); #endif /* Start off with no conversion necessary */ - SDL_zerop(cvt); cvt->src_format = src_fmt; cvt->dst_format = dst_fmt; cvt->needed = 0; cvt->filter_index = 0; - cvt->filters[0] = NULL; + SDL_zero(cvt->filters); cvt->len_mult = 1; cvt->len_ratio = 1.0; cvt->rate_incr = ((double) dst_rate) / ((double) src_rate); + /* Make sure we've chosen audio conversion functions (MMX, scalar, etc.) */ + SDL_ChooseAudioConverters(); + + /* Type conversion goes like this now: + - byteswap to CPU native format first if necessary. + - convert to native Float32 if necessary. + - resample and change channel count if necessary. + - convert back to native format. + - byteswap back to foreign format if necessary. + + The expectation is we can process data faster in float32 + (possibly with SIMD), and making several passes over the same + buffer is likely to be CPU cache-friendly, avoiding the + biggest performance hit in modern times. Previously we had + (script-generated) custom converters for every data type and + it was a bloat on SDL compile times and final library size. */ + + /* see if we can skip float conversion entirely. */ + if (src_rate == dst_rate && src_channels == dst_channels) { + if (src_fmt == dst_fmt) { + return 0; + } + + /* just a byteswap needed? */ + if ((src_fmt & ~SDL_AUDIO_MASK_ENDIAN) == (dst_fmt & ~SDL_AUDIO_MASK_ENDIAN)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert_Byteswap) < 0) { + return -1; + } + cvt->needed = 1; + return 1; + } + } + /* Convert data types, if necessary. Updates (cvt). */ - if (SDL_BuildAudioTypeCVT(cvt, src_fmt, dst_fmt) == -1) { + if (SDL_BuildAudioTypeCVTToFloat(cvt, src_fmt) < 0) { return -1; /* shouldn't happen, but just in case... */ } /* Channel conversion */ - if (src_channels != dst_channels) { + if (src_channels < dst_channels) { + /* Upmixing */ + /* Mono -> Stereo [-> ...] */ if ((src_channels == 1) && (dst_channels > 1)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertStereo; + if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertMonoToStereo) < 0) { + return -1; + } cvt->len_mult *= 2; src_channels = 2; cvt->len_ratio *= 2; } - if ((src_channels == 2) && (dst_channels == 6)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertSurround; + /* [Mono ->] Stereo -> 5.1 [-> 7.1] */ + if ((src_channels == 2) && (dst_channels >= 6)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertStereoTo51) < 0) { + return -1; + } src_channels = 6; cvt->len_mult *= 3; cvt->len_ratio *= 3; } + /* Quad -> 5.1 [-> 7.1] */ + if ((src_channels == 4) && (dst_channels >= 6)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertQuadTo51) < 0) { + return -1; + } + src_channels = 6; + cvt->len_mult = (cvt->len_mult * 3 + 1) / 2; + cvt->len_ratio *= 1.5; + } + /* [[Mono ->] Stereo ->] 5.1 -> 7.1 */ + if ((src_channels == 6) && (dst_channels == 8)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert51To71) < 0) { + return -1; + } + src_channels = 8; + cvt->len_mult = (cvt->len_mult * 4 + 2) / 3; + /* Should be numerically exact with every valid input to this + function */ + cvt->len_ratio = cvt->len_ratio * 4 / 3; + } + /* [Mono ->] Stereo -> Quad */ if ((src_channels == 2) && (dst_channels == 4)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertSurround_4; + if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertStereoToQuad) < 0) { + return -1; + } src_channels = 4; cvt->len_mult *= 2; cvt->len_ratio *= 2; } - while ((src_channels * 2) <= dst_channels) { - cvt->filters[cvt->filter_index++] = SDL_ConvertStereo; - cvt->len_mult *= 2; - src_channels *= 2; - cvt->len_ratio *= 2; + } else if (src_channels > dst_channels) { + /* Downmixing */ + /* 7.1 -> 5.1 [-> Stereo [-> Mono]] */ + /* 7.1 -> 5.1 [-> Quad] */ + if ((src_channels == 8) && (dst_channels <= 6)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert71To51) < 0) { + return -1; + } + src_channels = 6; + cvt->len_ratio *= 0.75; } + /* [7.1 ->] 5.1 -> Stereo [-> Mono] */ if ((src_channels == 6) && (dst_channels <= 2)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertStrip; + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert51ToStereo) < 0) { + return -1; + } src_channels = 2; cvt->len_ratio /= 3; } + /* 5.1 -> Quad */ if ((src_channels == 6) && (dst_channels == 4)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertStrip_2; + if (SDL_AddAudioCVTFilter(cvt, SDL_Convert51ToQuad) < 0) { + return -1; + } src_channels = 4; + cvt->len_ratio = cvt->len_ratio * 2 / 3; + } + /* Quad -> Stereo [-> Mono] */ + if ((src_channels == 4) && (dst_channels <= 2)) { + if (SDL_AddAudioCVTFilter(cvt, SDL_ConvertQuadToStereo) < 0) { + return -1; + } + src_channels = 2; cvt->len_ratio /= 2; } - /* This assumes that 4 channel audio is in the format: - Left {front/back} + Right {front/back} - so converting to L/R stereo works properly. - */ - while (((src_channels % 2) == 0) && - ((src_channels / 2) >= dst_channels)) { - cvt->filters[cvt->filter_index++] = SDL_ConvertMono; - src_channels /= 2; + /* [... ->] Stereo -> Mono */ + if ((src_channels == 2) && (dst_channels == 1)) { + SDL_AudioFilter filter = NULL; + + #if HAVE_SSE3_INTRINSICS + if (SDL_HasSSE3()) { + filter = SDL_ConvertStereoToMono_SSE3; + } + #endif + + if (!filter) { + filter = SDL_ConvertStereoToMono; + } + + if (SDL_AddAudioCVTFilter(cvt, filter) < 0) { + return -1; + } + + src_channels = 1; cvt->len_ratio /= 2; } - if (src_channels != dst_channels) { - /* Uh oh.. */ ; - } } + if (src_channels != dst_channels) { + /* All combinations of supported channel counts should have been + handled by now, but let's be defensive */ + return SDL_SetError("Invalid channel combination"); + } + /* Do rate conversion, if necessary. Updates (cvt). */ - if (SDL_BuildAudioResampleCVT(cvt, dst_channels, src_rate, dst_rate) == - -1) { + if (SDL_BuildAudioResampleCVT(cvt, dst_channels, src_rate, dst_rate) < 0) { return -1; /* shouldn't happen, but just in case... */ } - /* Set up the filter information */ - if (cvt->filter_index != 0) { - cvt->needed = 1; - cvt->src_format = src_fmt; - cvt->dst_format = dst_fmt; - cvt->len = 0; - cvt->buf = NULL; - cvt->filters[cvt->filter_index] = NULL; + /* Move to final data type. */ + if (SDL_BuildAudioTypeCVTFromFloat(cvt, dst_fmt) < 0) { + return -1; /* shouldn't happen, but just in case... */ } + + cvt->needed = (cvt->filter_index != 0); return (cvt->needed); } +typedef int (*SDL_ResampleAudioStreamFunc)(SDL_AudioStream *stream, const void *inbuf, const int inbuflen, void *outbuf, const int outbuflen); +typedef void (*SDL_ResetAudioStreamResamplerFunc)(SDL_AudioStream *stream); +typedef void (*SDL_CleanupAudioStreamResamplerFunc)(SDL_AudioStream *stream); + +struct _SDL_AudioStream +{ + SDL_AudioCVT cvt_before_resampling; + SDL_AudioCVT cvt_after_resampling; + SDL_DataQueue *queue; + SDL_bool first_run; + Uint8 *staging_buffer; + int staging_buffer_size; + int staging_buffer_filled; + Uint8 *work_buffer_base; /* maybe unaligned pointer from SDL_realloc(). */ + int work_buffer_len; + int src_sample_frame_size; + SDL_AudioFormat src_format; + Uint8 src_channels; + int src_rate; + int dst_sample_frame_size; + SDL_AudioFormat dst_format; + Uint8 dst_channels; + int dst_rate; + double rate_incr; + Uint8 pre_resample_channels; + int packetlen; + int resampler_padding_samples; + float *resampler_padding; + void *resampler_state; + SDL_ResampleAudioStreamFunc resampler_func; + SDL_ResetAudioStreamResamplerFunc reset_resampler_func; + SDL_CleanupAudioStreamResamplerFunc cleanup_resampler_func; +}; + +static Uint8 * +EnsureStreamBufferSize(SDL_AudioStream *stream, const int newlen) +{ + Uint8 *ptr; + size_t offset; + + if (stream->work_buffer_len >= newlen) { + ptr = stream->work_buffer_base; + } else { + ptr = (Uint8 *) SDL_realloc(stream->work_buffer_base, newlen + 32); + if (!ptr) { + SDL_OutOfMemory(); + return NULL; + } + /* Make sure we're aligned to 16 bytes for SIMD code. */ + stream->work_buffer_base = ptr; + stream->work_buffer_len = newlen; + } + + offset = ((size_t) ptr) & 15; + return offset ? ptr + (16 - offset) : ptr; +} + +#ifdef HAVE_LIBSAMPLERATE_H +static int +SDL_ResampleAudioStream_SRC(SDL_AudioStream *stream, const void *_inbuf, const int inbuflen, void *_outbuf, const int outbuflen) +{ + const float *inbuf = (const float *) _inbuf; + float *outbuf = (float *) _outbuf; + const int framelen = sizeof(float) * stream->pre_resample_channels; + SRC_STATE *state = (SRC_STATE *)stream->resampler_state; + SRC_DATA data; + int result; + + SDL_assert(inbuf != ((const float *) outbuf)); /* SDL_AudioStreamPut() shouldn't allow in-place resamples. */ + + data.data_in = (float *)inbuf; /* Older versions of libsamplerate had a non-const pointer, but didn't write to it */ + data.input_frames = inbuflen / framelen; + data.input_frames_used = 0; + + data.data_out = outbuf; + data.output_frames = outbuflen / framelen; + + data.end_of_input = 0; + data.src_ratio = stream->rate_incr; + + result = SRC_src_process(state, &data); + if (result != 0) { + SDL_SetError("src_process() failed: %s", SRC_src_strerror(result)); + return 0; + } + + /* If this fails, we need to store them off somewhere */ + SDL_assert(data.input_frames_used == data.input_frames); + + return data.output_frames_gen * (sizeof(float) * stream->pre_resample_channels); +} + +static void +SDL_ResetAudioStreamResampler_SRC(SDL_AudioStream *stream) +{ + SRC_src_reset((SRC_STATE *)stream->resampler_state); +} + +static void +SDL_CleanupAudioStreamResampler_SRC(SDL_AudioStream *stream) +{ + SRC_STATE *state = (SRC_STATE *)stream->resampler_state; + if (state) { + SRC_src_delete(state); + } + + stream->resampler_state = NULL; + stream->resampler_func = NULL; + stream->reset_resampler_func = NULL; + stream->cleanup_resampler_func = NULL; +} + +static SDL_bool +SetupLibSampleRateResampling(SDL_AudioStream *stream) +{ + int result = 0; + SRC_STATE *state = NULL; + + if (SRC_available) { + state = SRC_src_new(SRC_converter, stream->pre_resample_channels, &result); + if (!state) { + SDL_SetError("src_new() failed: %s", SRC_src_strerror(result)); + } + } + + if (!state) { + SDL_CleanupAudioStreamResampler_SRC(stream); + return SDL_FALSE; + } + + stream->resampler_state = state; + stream->resampler_func = SDL_ResampleAudioStream_SRC; + stream->reset_resampler_func = SDL_ResetAudioStreamResampler_SRC; + stream->cleanup_resampler_func = SDL_CleanupAudioStreamResampler_SRC; + + return SDL_TRUE; +} +#endif /* HAVE_LIBSAMPLERATE_H */ + + +static int +SDL_ResampleAudioStream(SDL_AudioStream *stream, const void *_inbuf, const int inbuflen, void *_outbuf, const int outbuflen) +{ + const Uint8 *inbufend = ((const Uint8 *) _inbuf) + inbuflen; + const float *inbuf = (const float *) _inbuf; + float *outbuf = (float *) _outbuf; + const int chans = (int) stream->pre_resample_channels; + const int inrate = stream->src_rate; + const int outrate = stream->dst_rate; + const int paddingsamples = stream->resampler_padding_samples; + const int paddingbytes = paddingsamples * sizeof (float); + float *lpadding = (float *) stream->resampler_state; + const float *rpadding = (const float *) inbufend; /* we set this up so there are valid padding samples at the end of the input buffer. */ + const int cpy = SDL_min(inbuflen, paddingbytes); + int retval; + + SDL_assert(inbuf != ((const float *) outbuf)); /* SDL_AudioStreamPut() shouldn't allow in-place resamples. */ + + retval = SDL_ResampleAudio(chans, inrate, outrate, lpadding, rpadding, inbuf, inbuflen, outbuf, outbuflen); + + /* update our left padding with end of current input, for next run. */ + SDL_memcpy((lpadding + paddingsamples) - (cpy / sizeof (float)), inbufend - cpy, cpy); + return retval; +} + +static void +SDL_ResetAudioStreamResampler(SDL_AudioStream *stream) +{ + /* set all the padding to silence. */ + const int len = stream->resampler_padding_samples; + SDL_memset(stream->resampler_state, '\0', len * sizeof (float)); +} + +static void +SDL_CleanupAudioStreamResampler(SDL_AudioStream *stream) +{ + SDL_free(stream->resampler_state); +} + +SDL_AudioStream * +SDL_NewAudioStream(const SDL_AudioFormat src_format, + const Uint8 src_channels, + const int src_rate, + const SDL_AudioFormat dst_format, + const Uint8 dst_channels, + const int dst_rate) +{ + const int packetlen = 4096; /* !!! FIXME: good enough for now. */ + Uint8 pre_resample_channels; + SDL_AudioStream *retval; + + retval = (SDL_AudioStream *) SDL_calloc(1, sizeof (SDL_AudioStream)); + if (!retval) { + return NULL; + } + + /* If increasing channels, do it after resampling, since we'd just + do more work to resample duplicate channels. If we're decreasing, do + it first so we resample the interpolated data instead of interpolating + the resampled data (!!! FIXME: decide if that works in practice, though!). */ + pre_resample_channels = SDL_min(src_channels, dst_channels); + + retval->first_run = SDL_TRUE; + retval->src_sample_frame_size = (SDL_AUDIO_BITSIZE(src_format) / 8) * src_channels; + retval->src_format = src_format; + retval->src_channels = src_channels; + retval->src_rate = src_rate; + retval->dst_sample_frame_size = (SDL_AUDIO_BITSIZE(dst_format) / 8) * dst_channels; + retval->dst_format = dst_format; + retval->dst_channels = dst_channels; + retval->dst_rate = dst_rate; + retval->pre_resample_channels = pre_resample_channels; + retval->packetlen = packetlen; + retval->rate_incr = ((double) dst_rate) / ((double) src_rate); + retval->resampler_padding_samples = ResamplerPadding(retval->src_rate, retval->dst_rate) * pre_resample_channels; + retval->resampler_padding = (float *) SDL_calloc(retval->resampler_padding_samples, sizeof (float)); + + if (retval->resampler_padding == NULL) { + SDL_FreeAudioStream(retval); + SDL_OutOfMemory(); + return NULL; + } + + retval->staging_buffer_size = ((retval->resampler_padding_samples / retval->pre_resample_channels) * retval->src_sample_frame_size); + if (retval->staging_buffer_size > 0) { + retval->staging_buffer = (Uint8 *) SDL_malloc(retval->staging_buffer_size); + if (retval->staging_buffer == NULL) { + SDL_FreeAudioStream(retval); + SDL_OutOfMemory(); + return NULL; + } + } + + /* Not resampling? It's an easy conversion (and maybe not even that!) */ + if (src_rate == dst_rate) { + retval->cvt_before_resampling.needed = SDL_FALSE; + if (SDL_BuildAudioCVT(&retval->cvt_after_resampling, src_format, src_channels, dst_rate, dst_format, dst_channels, dst_rate) < 0) { + SDL_FreeAudioStream(retval); + return NULL; /* SDL_BuildAudioCVT should have called SDL_SetError. */ + } + } else { + /* Don't resample at first. Just get us to Float32 format. */ + /* !!! FIXME: convert to int32 on devices without hardware float. */ + if (SDL_BuildAudioCVT(&retval->cvt_before_resampling, src_format, src_channels, src_rate, AUDIO_F32SYS, pre_resample_channels, src_rate) < 0) { + SDL_FreeAudioStream(retval); + return NULL; /* SDL_BuildAudioCVT should have called SDL_SetError. */ + } + +#ifdef HAVE_LIBSAMPLERATE_H + SetupLibSampleRateResampling(retval); +#endif + + if (!retval->resampler_func) { + retval->resampler_state = SDL_calloc(retval->resampler_padding_samples, sizeof (float)); + if (!retval->resampler_state) { + SDL_FreeAudioStream(retval); + SDL_OutOfMemory(); + return NULL; + } + + if (SDL_PrepareResampleFilter() < 0) { + SDL_free(retval->resampler_state); + retval->resampler_state = NULL; + SDL_FreeAudioStream(retval); + return NULL; + } + + retval->resampler_func = SDL_ResampleAudioStream; + retval->reset_resampler_func = SDL_ResetAudioStreamResampler; + retval->cleanup_resampler_func = SDL_CleanupAudioStreamResampler; + } + + /* Convert us to the final format after resampling. */ + if (SDL_BuildAudioCVT(&retval->cvt_after_resampling, AUDIO_F32SYS, pre_resample_channels, dst_rate, dst_format, dst_channels, dst_rate) < 0) { + SDL_FreeAudioStream(retval); + return NULL; /* SDL_BuildAudioCVT should have called SDL_SetError. */ + } + } + + retval->queue = SDL_NewDataQueue(packetlen, packetlen * 2); + if (!retval->queue) { + SDL_FreeAudioStream(retval); + return NULL; /* SDL_NewDataQueue should have called SDL_SetError. */ + } + + return retval; +} + +static int +SDL_AudioStreamPutInternal(SDL_AudioStream *stream, const void *buf, int len, int *maxputbytes) +{ + int buflen = len; + int workbuflen; + Uint8 *workbuf; + Uint8 *resamplebuf = NULL; + int resamplebuflen = 0; + int neededpaddingbytes; + int paddingbytes; + + /* !!! FIXME: several converters can take advantage of SIMD, but only + !!! FIXME: if the data is aligned to 16 bytes. EnsureStreamBufferSize() + !!! FIXME: guarantees the buffer will align, but the + !!! FIXME: converters will iterate over the data backwards if + !!! FIXME: the output grows, and this means we won't align if buflen + !!! FIXME: isn't a multiple of 16. In these cases, we should chop off + !!! FIXME: a few samples at the end and convert them separately. */ + + /* no padding prepended on first run. */ + neededpaddingbytes = stream->resampler_padding_samples * sizeof (float); + paddingbytes = stream->first_run ? 0 : neededpaddingbytes; + stream->first_run = SDL_FALSE; + + /* Make sure the work buffer can hold all the data we need at once... */ + workbuflen = buflen; + if (stream->cvt_before_resampling.needed) { + workbuflen *= stream->cvt_before_resampling.len_mult; + } + + if (stream->dst_rate != stream->src_rate) { + /* resamples can't happen in place, so make space for second buf. */ + const int framesize = stream->pre_resample_channels * sizeof (float); + const int frames = workbuflen / framesize; + resamplebuflen = ((int) SDL_ceil(frames * stream->rate_incr)) * framesize; + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: will resample %d bytes to %d (ratio=%.6f)\n", workbuflen, resamplebuflen, stream->rate_incr); + #endif + workbuflen += resamplebuflen; + } + + if (stream->cvt_after_resampling.needed) { + /* !!! FIXME: buffer might be big enough already? */ + workbuflen *= stream->cvt_after_resampling.len_mult; + } + + workbuflen += neededpaddingbytes; + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: Putting %d bytes of preconverted audio, need %d byte work buffer\n", buflen, workbuflen); + #endif + + workbuf = EnsureStreamBufferSize(stream, workbuflen); + if (!workbuf) { + return -1; /* probably out of memory. */ + } + + resamplebuf = workbuf; /* default if not resampling. */ + + SDL_memcpy(workbuf + paddingbytes, buf, buflen); + + if (stream->cvt_before_resampling.needed) { + stream->cvt_before_resampling.buf = workbuf + paddingbytes; + stream->cvt_before_resampling.len = buflen; + if (SDL_ConvertAudio(&stream->cvt_before_resampling) == -1) { + return -1; /* uhoh! */ + } + buflen = stream->cvt_before_resampling.len_cvt; + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: After initial conversion we have %d bytes\n", buflen); + #endif + } + + if (stream->dst_rate != stream->src_rate) { + /* save off some samples at the end; they are used for padding now so + the resampler is coherent and then used at the start of the next + put operation. Prepend last put operation's padding, too. */ + + /* prepend prior put's padding. :P */ + if (paddingbytes) { + SDL_memcpy(workbuf, stream->resampler_padding, paddingbytes); + buflen += paddingbytes; + } + + /* save off the data at the end for the next run. */ + SDL_memcpy(stream->resampler_padding, workbuf + (buflen - neededpaddingbytes), neededpaddingbytes); + + resamplebuf = workbuf + buflen; /* skip to second piece of workbuf. */ + SDL_assert(buflen >= neededpaddingbytes); + if (buflen > neededpaddingbytes) { + buflen = stream->resampler_func(stream, workbuf, buflen - neededpaddingbytes, resamplebuf, resamplebuflen); + } else { + buflen = 0; + } + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: After resampling we have %d bytes\n", buflen); + #endif + } + + if (stream->cvt_after_resampling.needed && (buflen > 0)) { + stream->cvt_after_resampling.buf = resamplebuf; + stream->cvt_after_resampling.len = buflen; + if (SDL_ConvertAudio(&stream->cvt_after_resampling) == -1) { + return -1; /* uhoh! */ + } + buflen = stream->cvt_after_resampling.len_cvt; + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: After final conversion we have %d bytes\n", buflen); + #endif + } + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: Final output is %d bytes\n", buflen); + #endif + + if (maxputbytes) { + const int maxbytes = *maxputbytes; + if (buflen > maxbytes) + buflen = maxbytes; + *maxputbytes -= buflen; + } + + /* resamplebuf holds the final output, even if we didn't resample. */ + return buflen ? SDL_WriteToDataQueue(stream->queue, resamplebuf, buflen) : 0; +} + +int +SDL_AudioStreamPut(SDL_AudioStream *stream, const void *buf, int len) +{ + /* !!! FIXME: several converters can take advantage of SIMD, but only + !!! FIXME: if the data is aligned to 16 bytes. EnsureStreamBufferSize() + !!! FIXME: guarantees the buffer will align, but the + !!! FIXME: converters will iterate over the data backwards if + !!! FIXME: the output grows, and this means we won't align if buflen + !!! FIXME: isn't a multiple of 16. In these cases, we should chop off + !!! FIXME: a few samples at the end and convert them separately. */ + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: wants to put %d preconverted bytes\n", buflen); + #endif + + if (!stream) { + return SDL_InvalidParamError("stream"); + } else if (!buf) { + return SDL_InvalidParamError("buf"); + } else if (len == 0) { + return 0; /* nothing to do. */ + } else if ((len % stream->src_sample_frame_size) != 0) { + return SDL_SetError("Can't add partial sample frames"); + } + + if (!stream->cvt_before_resampling.needed && + (stream->dst_rate == stream->src_rate) && + !stream->cvt_after_resampling.needed) { + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: no conversion needed at all, queueing %d bytes.\n", len); + #endif + return SDL_WriteToDataQueue(stream->queue, buf, len); + } + + while (len > 0) { + int amount; + + /* If we don't have a staging buffer or we're given enough data that + we don't need to store it for later, skip the staging process. + */ + if (!stream->staging_buffer_filled && len >= stream->staging_buffer_size) { + return SDL_AudioStreamPutInternal(stream, buf, len, NULL); + } + + /* If there's not enough data to fill the staging buffer, just save it */ + if ((stream->staging_buffer_filled + len) < stream->staging_buffer_size) { + SDL_memcpy(stream->staging_buffer + stream->staging_buffer_filled, buf, len); + stream->staging_buffer_filled += len; + return 0; + } + + /* Fill the staging buffer, process it, and continue */ + amount = (stream->staging_buffer_size - stream->staging_buffer_filled); + SDL_assert(amount > 0); + SDL_memcpy(stream->staging_buffer + stream->staging_buffer_filled, buf, amount); + stream->staging_buffer_filled = 0; + if (SDL_AudioStreamPutInternal(stream, stream->staging_buffer, stream->staging_buffer_size, NULL) < 0) { + return -1; + } + buf = (void *)((Uint8 *)buf + amount); + len -= amount; + } + return 0; +} + +int SDL_AudioStreamFlush(SDL_AudioStream *stream) +{ + if (!stream) { + return SDL_InvalidParamError("stream"); + } + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: flushing! staging_buffer_filled=%d bytes\n", stream->staging_buffer_filled); + #endif + + /* shouldn't use a staging buffer if we're not resampling. */ + SDL_assert((stream->dst_rate != stream->src_rate) || (stream->staging_buffer_filled == 0)); + + if (stream->staging_buffer_filled > 0) { + /* push the staging buffer + silence. We need to flush out not just + the staging buffer, but the piece that the stream was saving off + for right-side resampler padding. */ + const SDL_bool first_run = stream->first_run; + const int filled = stream->staging_buffer_filled; + int actual_input_frames = filled / stream->src_sample_frame_size; + if (!first_run) + actual_input_frames += stream->resampler_padding_samples / stream->pre_resample_channels; + + if (actual_input_frames > 0) { /* don't bother if nothing to flush. */ + /* This is how many bytes we're expecting without silence appended. */ + int flush_remaining = ((int) SDL_ceil(actual_input_frames * stream->rate_incr)) * stream->dst_sample_frame_size; + + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: flushing with padding to get max %d bytes!\n", flush_remaining); + #endif + + SDL_memset(stream->staging_buffer + filled, '\0', stream->staging_buffer_size - filled); + if (SDL_AudioStreamPutInternal(stream, stream->staging_buffer, stream->staging_buffer_size, &flush_remaining) < 0) { + return -1; + } + + /* we have flushed out (or initially filled) the pending right-side + resampler padding, but we need to push more silence to guarantee + the staging buffer is fully flushed out, too. */ + SDL_memset(stream->staging_buffer, '\0', filled); + if (SDL_AudioStreamPutInternal(stream, stream->staging_buffer, stream->staging_buffer_size, &flush_remaining) < 0) { + return -1; + } + } + } + + stream->staging_buffer_filled = 0; + stream->first_run = SDL_TRUE; + + return 0; +} + +/* get converted/resampled data from the stream */ +int +SDL_AudioStreamGet(SDL_AudioStream *stream, void *buf, int len) +{ + #if DEBUG_AUDIOSTREAM + printf("AUDIOSTREAM: want to get %d converted bytes\n", len); + #endif + + if (!stream) { + return SDL_InvalidParamError("stream"); + } else if (!buf) { + return SDL_InvalidParamError("buf"); + } else if (len <= 0) { + return 0; /* nothing to do. */ + } else if ((len % stream->dst_sample_frame_size) != 0) { + return SDL_SetError("Can't request partial sample frames"); + } + + return (int) SDL_ReadFromDataQueue(stream->queue, buf, len); +} + +/* number of converted/resampled bytes available */ +int +SDL_AudioStreamAvailable(SDL_AudioStream *stream) +{ + return stream ? (int) SDL_CountDataQueue(stream->queue) : 0; +} + +void +SDL_AudioStreamClear(SDL_AudioStream *stream) +{ + if (!stream) { + SDL_InvalidParamError("stream"); + } else { + SDL_ClearDataQueue(stream->queue, stream->packetlen * 2); + if (stream->reset_resampler_func) { + stream->reset_resampler_func(stream); + } + stream->first_run = SDL_TRUE; + stream->staging_buffer_filled = 0; + } +} + +/* dispose of a stream */ +void +SDL_FreeAudioStream(SDL_AudioStream *stream) +{ + if (stream) { + if (stream->cleanup_resampler_func) { + stream->cleanup_resampler_func(stream); + } + SDL_FreeDataQueue(stream->queue); + SDL_free(stream->staging_buffer); + SDL_free(stream->work_buffer_base); + SDL_free(stream->resampler_padding); + SDL_free(stream); + } +} /* vi: set ts=4 sw=4 expandtab: */ + diff --git a/Engine/lib/sdl/src/audio/SDL_audiodev.c b/Engine/lib/sdl/src/audio/SDL_audiodev.c index 5c392cfb7..d0b94a055 100644 --- a/Engine/lib/sdl/src/audio/SDL_audiodev.c +++ b/Engine/lib/sdl/src/audio/SDL_audiodev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ /* Get the name of the audio device we use for output */ -#if SDL_AUDIO_DRIVER_BSD || SDL_AUDIO_DRIVER_OSS || SDL_AUDIO_DRIVER_SUNAUDIO +#if SDL_AUDIO_DRIVER_NETBSD || SDL_AUDIO_DRIVER_OSS || SDL_AUDIO_DRIVER_SUNAUDIO #include #include @@ -103,9 +103,10 @@ SDL_EnumUnixAudioDevices_Internal(const int iscapture, const int classic, int (* if (SDL_strlen(audiodev) < (sizeof(audiopath) - 3)) { int instance = 0; - while (instance++ <= 64) { + while (instance <= 64) { SDL_snprintf(audiopath, SDL_arraysize(audiopath), "%s%d", audiodev, instance); + instance++; test_device(iscapture, audiopath, flags, test); } } diff --git a/Engine/lib/sdl/src/audio/SDL_audiodev_c.h b/Engine/lib/sdl/src/audio/SDL_audiodev_c.h index fa60bcdb1..15928d10a 100644 --- a/Engine/lib/sdl/src/audio/SDL_audiodev_c.h +++ b/Engine/lib/sdl/src/audio/SDL_audiodev_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/audio/SDL_audiotypecvt.c b/Engine/lib/sdl/src/audio/SDL_audiotypecvt.c index be3b7430a..2fbd916e5 100644 --- a/Engine/lib/sdl/src/audio/SDL_audiotypecvt.c +++ b/Engine/lib/sdl/src/audio/SDL_audiotypecvt.c @@ -1,7 +1,6 @@ -/* DO NOT EDIT! This file is generated by sdlgenaudiocvt.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,15993 +22,808 @@ #include "../SDL_internal.h" #include "SDL_audio.h" #include "SDL_audio_c.h" +#include "SDL_cpuinfo.h" +#include "SDL_assert.h" -#ifndef DEBUG_CONVERT -#define DEBUG_CONVERT 0 +/* !!! FIXME: write NEON code. */ +#define HAVE_NEON_INTRINSICS 0 + +#ifdef __SSE2__ +#define HAVE_SSE2_INTRINSICS 1 #endif - -/* If you can guarantee your data and need space, you can eliminate code... */ - -/* Just build the arbitrary resamplers if you're saving code space. */ -#ifndef LESS_RESAMPLERS -#define LESS_RESAMPLERS 0 +#if defined(__x86_64__) && HAVE_SSE2_INTRINSICS +#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* x86_64 guarantees SSE2. */ +#elif __MACOSX__ && HAVE_SSE2_INTRINSICS +#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* Mac OS X/Intel guarantees SSE2. */ +#elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8) && HAVE_NEON_INTRINSICS +#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* ARMv8+ promise NEON. */ +#elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7) && HAVE_NEON_INTRINSICS +#define NEED_SCALAR_CONVERTER_FALLBACKS 0 /* All Apple ARMv7 chips promise NEON support. */ #endif -/* Don't build any resamplers if you're REALLY saving code space. */ -#ifndef NO_RESAMPLERS -#define NO_RESAMPLERS 0 +/* Set to zero if platform is guaranteed to use a SIMD codepath here. */ +#ifndef NEED_SCALAR_CONVERTER_FALLBACKS +#define NEED_SCALAR_CONVERTER_FALLBACKS 1 #endif -/* Don't build any type converters if you're saving code space. */ -#ifndef NO_CONVERTERS -#define NO_CONVERTERS 0 -#endif +/* Function pointers set to a CPU-specific implementation. */ +SDL_AudioFilter SDL_Convert_S8_to_F32 = NULL; +SDL_AudioFilter SDL_Convert_U8_to_F32 = NULL; +SDL_AudioFilter SDL_Convert_S16_to_F32 = NULL; +SDL_AudioFilter SDL_Convert_U16_to_F32 = NULL; +SDL_AudioFilter SDL_Convert_S32_to_F32 = NULL; +SDL_AudioFilter SDL_Convert_F32_to_S8 = NULL; +SDL_AudioFilter SDL_Convert_F32_to_U8 = NULL; +SDL_AudioFilter SDL_Convert_F32_to_S16 = NULL; +SDL_AudioFilter SDL_Convert_F32_to_U16 = NULL; +SDL_AudioFilter SDL_Convert_F32_to_S32 = NULL; -/* *INDENT-OFF* */ +#define DIVBY128 0.0078125f +#define DIVBY32768 0.000030517578125f +#define DIVBY2147483648 0.00000000046566128730773926 -#define DIVBY127 0.0078740157480315f -#define DIVBY32767 3.05185094759972e-05f -#define DIVBY2147483647 4.6566128752458e-10f - -#if !NO_CONVERTERS +#if NEED_SCALAR_CONVERTER_FALLBACKS static void SDLCALL -SDL_Convert_U8_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_S8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const Sint8 *src = ((const Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; int i; - const Uint8 *src; - Sint8 *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S8.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32"); - src = (const Uint8 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) { - const Sint8 val = ((*src) ^ 0x80); - *dst = ((Sint8) val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_U8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Uint16 val = (((Uint16) *src) << 8); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_U16MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Uint16 val = (((Uint16) *src) << 8); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S16MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint16 val = (((Sint16) ((*src) ^ 0x80)) << 8); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_U8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24); - *dst = ((Sint32) SDL_SwapLE32(val)); + for (i = cvt->len_cvt; i; --i, --src, --dst) { + *dst = ((float) *src) * DIVBY128; } cvt->len_cvt *= 4; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); } } static void SDLCALL -SDL_Convert_U8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_U8_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const Uint8 *src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; int i; - const Uint8 *src; - Sint32 *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_S32MSB.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_U8", "AUDIO_F32"); - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((*src) ^ 0x80)) << 24); - *dst = ((Sint32) SDL_SwapBE32(val)); + for (i = cvt->len_cvt; i; --i, --src, --dst) { + *dst = (((float) *src) * DIVBY128) - 1.0f; } cvt->len_cvt *= 4; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); } } static void SDLCALL -SDL_Convert_U8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_S16_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const Sint16 *src = ((const Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; int i; - const Uint8 *src; - float *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32LSB.\n"); + LOG_DEBUG_CONVERT("AUDIO_S16", "AUDIO_F32"); + + for (i = cvt->len_cvt / sizeof (Sint16); i; --i, --src, --dst) { + *dst = ((float) *src) * DIVBY32768; + } + + cvt->len_cvt *= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_U16_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Uint16 *src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; + int i; + + LOG_DEBUG_CONVERT("AUDIO_U16", "AUDIO_F32"); + + for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { + *dst = (((float) *src) * DIVBY32768) - 1.0f; + } + + cvt->len_cvt *= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_S32_to_F32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Sint32 *src = (const Sint32 *) cvt->buf; + float *dst = (float *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_S32", "AUDIO_F32"); + + for (i = cvt->len_cvt / sizeof (Sint32); i; --i, ++src, ++dst) { + *dst = (float) (((double) *src) * DIVBY2147483648); + } + + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); + } +} + +static void SDLCALL +SDL_Convert_F32_to_S8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Sint8 *dst = (Sint8 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8"); + + for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { + const float sample = *src; + if (sample > 1.0f) { + *dst = 127; + } else if (sample < -1.0f) { + *dst = -127; + } else { + *dst = (Sint8)(sample * 127.0f); + } + } + + cvt->len_cvt /= 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_S8); + } +} + +static void SDLCALL +SDL_Convert_F32_to_U8_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Uint8 *dst = (Uint8 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8"); + + for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { + const float sample = *src; + if (sample > 1.0f) { + *dst = 255; + } else if (sample < -1.0f) { + *dst = 0; + } else { + *dst = (Uint8)((sample + 1.0f) * 127.0f); + } + } + + cvt->len_cvt /= 4; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_U8); + } +} + +static void SDLCALL +SDL_Convert_F32_to_S16_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Sint16 *dst = (Sint16 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16"); + + for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { + const float sample = *src; + if (sample > 1.0f) { + *dst = 32767; + } else if (sample < -1.0f) { + *dst = -32767; + } else { + *dst = (Sint16)(sample * 32767.0f); + } + } + + cvt->len_cvt /= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_S16SYS); + } +} + +static void SDLCALL +SDL_Convert_F32_to_U16_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Uint16 *dst = (Uint16 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U16"); + + for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { + const float sample = *src; + if (sample > 1.0f) { + *dst = 65534; + } else if (sample < -1.0f) { + *dst = 0; + } else { + *dst = (Uint16)((sample + 1.0f) * 32767.0f); + } + } + + cvt->len_cvt /= 2; + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_U16SYS); + } +} + +static void SDLCALL +SDL_Convert_F32_to_S32_Scalar(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const float *src = (const float *) cvt->buf; + Sint32 *dst = (Sint32 *) cvt->buf; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32"); + + for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { + const float sample = *src; + if (sample > 1.0f) { + *dst = 2147483647; + } else if (sample < -1.0f) { + *dst = -2147483647; + } else { + *dst = (Sint32)((double)sample * 2147483647.0); + } + } + + if (cvt->filters[++cvt->filter_index]) { + cvt->filters[cvt->filter_index](cvt, AUDIO_S32SYS); + } +} #endif - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const float val = ((((float) *src) * DIVBY127) - 1.0f); - *dst = SDL_SwapFloatLE(val); + +#if HAVE_SSE2_INTRINSICS +static void SDLCALL +SDL_Convert_S8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) +{ + const Sint8 *src = ((const Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; + int i; + + LOG_DEBUG_CONVERT("AUDIO_S8", "AUDIO_F32 (using SSE2)"); + + /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ + for (i = cvt->len_cvt; i && (((size_t) (dst-15)) & 15); --i, --src, --dst) { + *dst = ((float) *src) * DIVBY128; + } + + src -= 15; dst -= 15; /* adjust to read SSE blocks from the start. */ + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128i *mmsrc = (const __m128i *) src; + const __m128i zero = _mm_setzero_si128(); + const __m128 divby128 = _mm_set1_ps(DIVBY128); + while (i >= 16) { /* 16 * 8-bit */ + const __m128i bytes = _mm_load_si128(mmsrc); /* get 16 sint8 into an XMM register. */ + /* treat as int16, shift left to clear every other sint16, then back right with sign-extend. Now sint16. */ + const __m128i shorts1 = _mm_srai_epi16(_mm_slli_epi16(bytes, 8), 8); + /* right-shift-sign-extend gets us sint16 with the other set of values. */ + const __m128i shorts2 = _mm_srai_epi16(bytes, 8); + /* unpack against zero to make these int32, shift to make them sign-extend, convert to float, multiply. Whew! */ + const __m128 floats1 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpacklo_epi16(shorts1, zero), 16), 16)), divby128); + const __m128 floats2 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpacklo_epi16(shorts2, zero), 16), 16)), divby128); + const __m128 floats3 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpackhi_epi16(shorts1, zero), 16), 16)), divby128); + const __m128 floats4 = _mm_mul_ps(_mm_cvtepi32_ps(_mm_srai_epi32(_mm_slli_epi32(_mm_unpackhi_epi16(shorts2, zero), 16), 16)), divby128); + /* Interleave back into correct order, store. */ + _mm_store_ps(dst, _mm_unpacklo_ps(floats1, floats2)); + _mm_store_ps(dst+4, _mm_unpackhi_ps(floats1, floats2)); + _mm_store_ps(dst+8, _mm_unpacklo_ps(floats3, floats4)); + _mm_store_ps(dst+12, _mm_unpackhi_ps(floats3, floats4)); + i -= 16; mmsrc--; dst -= 16; + } + + src = (const Sint8 *) mmsrc; + } + + src += 15; dst += 15; /* adjust for any scalar finishing. */ + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = ((float) *src) * DIVBY128; + i--; src--; dst--; } cvt->len_cvt *= 4; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); } } static void SDLCALL -SDL_Convert_U8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_U8_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const Uint8 *src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; int i; - const Uint8 *src; - float *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U8 to AUDIO_F32MSB.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_U8", "AUDIO_F32 (using SSE2)"); - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const float val = ((((float) *src) * DIVBY127) - 1.0f); - *dst = SDL_SwapFloatBE(val); + /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ + for (i = cvt->len_cvt; i && (((size_t) (dst-15)) & 15); --i, --src, --dst) { + *dst = (((float) *src) * DIVBY128) - 1.0f; + } + + src -= 15; dst -= 15; /* adjust to read SSE blocks from the start. */ + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128i *mmsrc = (const __m128i *) src; + const __m128i zero = _mm_setzero_si128(); + const __m128 divby128 = _mm_set1_ps(DIVBY128); + const __m128 minus1 = _mm_set1_ps(-1.0f); + while (i >= 16) { /* 16 * 8-bit */ + const __m128i bytes = _mm_load_si128(mmsrc); /* get 16 uint8 into an XMM register. */ + /* treat as int16, shift left to clear every other sint16, then back right with zero-extend. Now uint16. */ + const __m128i shorts1 = _mm_srli_epi16(_mm_slli_epi16(bytes, 8), 8); + /* right-shift-zero-extend gets us uint16 with the other set of values. */ + const __m128i shorts2 = _mm_srli_epi16(bytes, 8); + /* unpack against zero to make these int32, convert to float, multiply, add. Whew! */ + /* Note that AVX2 can do floating point multiply+add in one instruction, fwiw. SSE2 cannot. */ + const __m128 floats1 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi16(shorts1, zero)), divby128), minus1); + const __m128 floats2 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi16(shorts2, zero)), divby128), minus1); + const __m128 floats3 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi16(shorts1, zero)), divby128), minus1); + const __m128 floats4 = _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi16(shorts2, zero)), divby128), minus1); + /* Interleave back into correct order, store. */ + _mm_store_ps(dst, _mm_unpacklo_ps(floats1, floats2)); + _mm_store_ps(dst+4, _mm_unpackhi_ps(floats1, floats2)); + _mm_store_ps(dst+8, _mm_unpacklo_ps(floats3, floats4)); + _mm_store_ps(dst+12, _mm_unpackhi_ps(floats3, floats4)); + i -= 16; mmsrc--; dst -= 16; + } + + src = (const Uint8 *) mmsrc; + } + + src += 15; dst += 15; /* adjust for any scalar finishing. */ + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (((float) *src) * DIVBY128) - 1.0f; + i--; src--; dst--; } cvt->len_cvt *= 4; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); } } static void SDLCALL -SDL_Convert_S8_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_S16_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const Sint16 *src = ((const Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; int i; - const Uint8 *src; - Uint8 *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U8.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_S16", "AUDIO_F32 (using SSE2)"); - src = (const Uint8 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, ++src, ++dst) { - const Uint8 val = ((((Sint8) *src)) ^ 0x80); - *dst = val; + /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ + for (i = cvt->len_cvt / sizeof (Sint16); i && (((size_t) (dst-7)) & 15); --i, --src, --dst) { + *dst = ((float) *src) * DIVBY32768; } - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); + src -= 7; dst -= 7; /* adjust to read SSE blocks from the start. */ + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 divby32768 = _mm_set1_ps(DIVBY32768); + while (i >= 8) { /* 8 * 16-bit */ + const __m128i ints = _mm_load_si128((__m128i const *) src); /* get 8 sint16 into an XMM register. */ + /* treat as int32, shift left to clear every other sint16, then back right with sign-extend. Now sint32. */ + const __m128i a = _mm_srai_epi32(_mm_slli_epi32(ints, 16), 16); + /* right-shift-sign-extend gets us sint32 with the other set of values. */ + const __m128i b = _mm_srai_epi32(ints, 16); + /* Interleave these back into the right order, convert to float, multiply, store. */ + _mm_store_ps(dst, _mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi32(a, b)), divby32768)); + _mm_store_ps(dst+4, _mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi32(a, b)), divby32768)); + i -= 8; src -= 8; dst -= 8; + } } -} -static void SDLCALL -SDL_Convert_S8_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Uint16 *dst; + src += 7; dst += 7; /* adjust for any scalar finishing. */ -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8); - *dst = SDL_SwapLE16(val); + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = ((float) *src) * DIVBY32768; + i--; src--; dst--; } cvt->len_cvt *= 2; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); } } static void SDLCALL -SDL_Convert_S8_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_U16_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const Uint16 *src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; + float *dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; int i; - const Uint8 *src; - Sint16 *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16LSB.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_U16", "AUDIO_F32 (using SSE2)"); - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint16 val = (((Sint16) ((Sint8) *src)) << 8); - *dst = ((Sint16) SDL_SwapLE16(val)); + /* Get dst aligned to 16 bytes (since buffer is growing, we don't have to worry about overreading from src) */ + for (i = cvt->len_cvt / sizeof (Sint16); i && (((size_t) (dst-7)) & 15); --i, --src, --dst) { + *dst = (((float) *src) * DIVBY32768) - 1.0f; + } + + src -= 7; dst -= 7; /* adjust to read SSE blocks from the start. */ + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 divby32768 = _mm_set1_ps(DIVBY32768); + const __m128 minus1 = _mm_set1_ps(1.0f); + while (i >= 8) { /* 8 * 16-bit */ + const __m128i ints = _mm_load_si128((__m128i const *) src); /* get 8 sint16 into an XMM register. */ + /* treat as int32, shift left to clear every other sint16, then back right with zero-extend. Now sint32. */ + const __m128i a = _mm_srli_epi32(_mm_slli_epi32(ints, 16), 16); + /* right-shift-sign-extend gets us sint32 with the other set of values. */ + const __m128i b = _mm_srli_epi32(ints, 16); + /* Interleave these back into the right order, convert to float, multiply, store. */ + _mm_store_ps(dst, _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpacklo_epi32(a, b)), divby32768), minus1)); + _mm_store_ps(dst+4, _mm_add_ps(_mm_mul_ps(_mm_cvtepi32_ps(_mm_unpackhi_epi32(a, b)), divby32768), minus1)); + i -= 8; src -= 8; dst -= 8; + } + } + + src += 7; dst += 7; /* adjust for any scalar finishing. */ + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (((float) *src) * DIVBY32768) - 1.0f; + i--; src--; dst--; } cvt->len_cvt *= 2; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); } } -static void SDLCALL -SDL_Convert_S8_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_U16MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Uint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Uint16 val = (((Uint16) ((((Sint8) *src)) ^ 0x80)) << 8); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } +#if defined(__GNUC__) && (__GNUC__ < 4) +/* these were added as of gcc-4.0: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19418 */ +static inline __m128 _mm_castsi128_ps(__m128i __A) { + return (__m128) __A; } - -static void SDLCALL -SDL_Convert_S8_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S16MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint16 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint16 val = (((Sint16) ((Sint8) *src)) << 8); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } +static inline __m128i _mm_castps_si128(__m128 __A) { + return (__m128i) __A; } - -static void SDLCALL -SDL_Convert_S8_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32LSB.\n"); #endif - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint8) *src)) << 24); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - static void SDLCALL -SDL_Convert_S8_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_S32_to_F32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const Sint32 *src = (const Sint32 *) cvt->buf; + float *dst = (float *) cvt->buf; int i; - const Uint8 *src; - Sint32 *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_S32MSB.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_S32", "AUDIO_F32 (using SSE2)"); - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint8) *src)) << 24); - *dst = ((Sint32) SDL_SwapBE32(val)); + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (Sint32); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + *dst = (float) (((double) *src) * DIVBY2147483648); } - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + SDL_assert(!i || ((((size_t) src) & 15) == 0)); -static void SDLCALL -SDL_Convert_S8_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const float val = (((float) ((Sint8) *src)) * DIVBY127); - *dst = SDL_SwapFloatLE(val); + { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128d divby2147483648 = _mm_set1_pd(DIVBY2147483648); + const __m128i *mmsrc = (const __m128i *) src; + while (i >= 4) { /* 4 * sint32 */ + const __m128i ints = _mm_load_si128(mmsrc); + /* bitshift the whole register over, so _mm_cvtepi32_pd can read the top ints in the bottom of the vector. */ + const __m128d doubles1 = _mm_mul_pd(_mm_cvtepi32_pd(_mm_srli_si128(ints, 8)), divby2147483648); + const __m128d doubles2 = _mm_mul_pd(_mm_cvtepi32_pd(ints), divby2147483648); + /* convert to float32, bitshift/or to get these into a vector to store. */ + _mm_store_ps(dst, _mm_castsi128_ps(_mm_or_si128(_mm_slli_si128(_mm_castps_si128(_mm_cvtpd_ps(doubles1)), 8), _mm_castps_si128(_mm_cvtpd_ps(doubles2))))); + i -= 4; mmsrc++; dst += 4; + } + src = (const Sint32 *) mmsrc; } - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S8_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint8 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S8 to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 4)) - 1; - for (i = cvt->len_cvt / sizeof (Uint8); i; --i, --src, --dst) { - const float val = (((float) ((Sint8) *src)) * DIVBY127); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (SDL_SwapLE16(*src) >> 8)); - *dst = val; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((SDL_SwapLE16(*src)) ^ 0x8000) >> 8)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000); - *dst = ((Sint16) SDL_SwapLE16(val)); + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (float) (((double) *src) * DIVBY2147483648); + i--; src++; dst++; } if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); + cvt->filters[cvt->filter_index](cvt, AUDIO_F32SYS); } } static void SDLCALL -SDL_Convert_U16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_F32_to_S8_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const float *src = (const float *) cvt->buf; + Sint8 *dst = (Sint8 *) cvt->buf; int i; - const Uint16 *src; - Uint16 *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_U16MSB.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S8 (using SSE2)"); - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = SDL_SwapLE16(*src); - *dst = SDL_SwapBE16(val); + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + *dst = (Sint8) (*src * 127.0f); } - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((SDL_SwapLE16(*src)) ^ 0x8000); - *dst = ((Sint16) SDL_SwapBE16(val)); + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 mulby127 = _mm_set1_ps(127.0f); + __m128i *mmdst = (__m128i *) dst; + while (i >= 16) { /* 16 * float32 */ + const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src), mulby127)); /* load 4 floats, convert to sint32 */ + const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+4), mulby127)); /* load 4 floats, convert to sint32 */ + const __m128i ints3 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+8), mulby127)); /* load 4 floats, convert to sint32 */ + const __m128i ints4 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+12), mulby127)); /* load 4 floats, convert to sint32 */ + _mm_store_si128(mmdst, _mm_packs_epi16(_mm_packs_epi32(ints1, ints2), _mm_packs_epi32(ints3, ints4))); /* pack down, store out. */ + i -= 16; src += 16; mmdst++; + } + dst = (Sint8 *) mmdst; } - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((SDL_SwapLE16(*src)) ^ 0x8000)) << 16); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_U16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16LSB to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = ((((float) SDL_SwapLE16(*src)) * DIVBY32767) - 1.0f); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000) >> 8)); - *dst = val; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((Sint16) SDL_SwapLE16(*src)) >> 8)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000); - *dst = SDL_SwapLE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_U16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = ((((Sint16) SDL_SwapLE16(*src))) ^ 0x8000); - *dst = SDL_SwapBE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) SDL_SwapLE16(*src)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint16) SDL_SwapLE16(*src))) << 16); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S16LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16LSB to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = (((float) ((Sint16) SDL_SwapLE16(*src))) * DIVBY32767); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (SDL_SwapBE16(*src) >> 8)); - *dst = val; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((SDL_SwapBE16(*src)) ^ 0x8000) >> 8)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_U16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = SDL_SwapBE16(*src); - *dst = SDL_SwapLE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((SDL_SwapBE16(*src)) ^ 0x8000); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((SDL_SwapBE16(*src)) ^ 0x8000)) << 16); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_U16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_U16MSB to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = ((((float) SDL_SwapBE16(*src)) * DIVBY32767) - 1.0f); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000) >> 8)); - *dst = val; - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S8.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((Sint16) SDL_SwapBE16(*src)) >> 8)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000); - *dst = SDL_SwapLE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S16LSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) SDL_SwapBE16(*src)); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_U16MSB.\n"); -#endif - - src = (const Uint16 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, ++src, ++dst) { - const Uint16 val = ((((Sint16) SDL_SwapBE16(*src))) ^ 0x8000); - *dst = SDL_SwapBE16(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_S32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((Sint32 *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const Sint32 val = (((Sint32) ((Sint16) SDL_SwapBE16(*src))) << 16); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32LSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767); - *dst = SDL_SwapFloatLE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S16MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint16 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S16MSB to AUDIO_F32MSB.\n"); -#endif - - src = ((const Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - dst = ((float *) (cvt->buf + cvt->len_cvt * 2)) - 1; - for (i = cvt->len_cvt / sizeof (Uint16); i; --i, --src, --dst) { - const float val = (((float) ((Sint16) SDL_SwapBE16(*src))) * DIVBY32767); - *dst = SDL_SwapFloatBE(val); - } - - cvt->len_cvt *= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U8.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 24)); - *dst = val; + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (Sint8) (*src * 127.0f); + i--; src++; dst++; } cvt->len_cvt /= 4; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); + cvt->filters[cvt->filter_index](cvt, AUDIO_S8); } } static void SDLCALL -SDL_Convert_S32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_F32_to_U8_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const float *src = (const float *) cvt->buf; + Uint8 *dst = (Uint8 *) cvt->buf; int i; - const Uint32 *src; - Sint8 *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S8.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U8 (using SSE2)"); - src = (const Uint32 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((Sint32) SDL_SwapLE32(*src)) >> 24)); - *dst = ((Sint8) val); + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + *dst = (Uint8) ((*src + 1.0f) * 127.0f); + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 add1 = _mm_set1_ps(1.0f); + const __m128 mulby127 = _mm_set1_ps(127.0f); + __m128i *mmdst = (__m128i *) dst; + while (i >= 16) { /* 16 * float32 */ + const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src), add1), mulby127)); /* load 4 floats, convert to sint32 */ + const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src+4), add1), mulby127)); /* load 4 floats, convert to sint32 */ + const __m128i ints3 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src+8), add1), mulby127)); /* load 4 floats, convert to sint32 */ + const __m128i ints4 = _mm_cvtps_epi32(_mm_mul_ps(_mm_add_ps(_mm_load_ps(src+12), add1), mulby127)); /* load 4 floats, convert to sint32 */ + _mm_store_si128(mmdst, _mm_packus_epi16(_mm_packs_epi32(ints1, ints2), _mm_packs_epi32(ints3, ints4))); /* pack down, store out. */ + i -= 16; src += 16; mmdst++; + } + dst = (Uint8 *) mmdst; + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (Uint8) ((*src + 1.0f) * 127.0f); + i--; src++; dst++; } cvt->len_cvt /= 4; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); + cvt->filters[cvt->filter_index](cvt, AUDIO_U8); } } static void SDLCALL -SDL_Convert_S32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_F32_to_S16_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const float *src = (const float *) cvt->buf; + Sint16 *dst = (Sint16 *) cvt->buf; int i; - const Uint32 *src; - Uint16 *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16LSB.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S16 (using SSE2)"); - src = (const Uint32 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16)); - *dst = SDL_SwapLE16(val); + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + *dst = (Sint16) (*src * 32767.0f); + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128 mulby32767 = _mm_set1_ps(32767.0f); + __m128i *mmdst = (__m128i *) dst; + while (i >= 8) { /* 8 * float32 */ + const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src), mulby32767)); /* load 4 floats, convert to sint32 */ + const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+4), mulby32767)); /* load 4 floats, convert to sint32 */ + _mm_store_si128(mmdst, _mm_packs_epi32(ints1, ints2)); /* pack to sint16, store out. */ + i -= 8; src += 8; mmdst++; + } + dst = (Sint16 *) mmdst; + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (Sint16) (*src * 32767.0f); + i--; src++; dst++; } cvt->len_cvt /= 2; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); + cvt->filters[cvt->filter_index](cvt, AUDIO_S16SYS); } } static void SDLCALL -SDL_Convert_S32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_F32_to_U16_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { + const float *src = (const float *) cvt->buf; + Uint16 *dst = (Uint16 *) cvt->buf; int i; - const Uint32 *src; - Sint16 *dst; -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16LSB.\n"); -#endif + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_U16 (using SSE2)"); - src = (const Uint32 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16)); - *dst = ((Sint16) SDL_SwapLE16(val)); + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + *dst = (Uint16) ((*src + 1.0f) * 32767.0f); + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + + /* Make sure src is aligned too. */ + if ((((size_t) src) & 15) == 0) { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + /* This calculates differently than the scalar path because SSE2 can't + pack int32 data down to unsigned int16. _mm_packs_epi32 does signed + saturation, so that would corrupt our data. _mm_packus_epi32 exists, + but not before SSE 4.1. So we convert from float to sint16, packing + that down with legit signed saturation, and then xor the top bit + against 1. This results in the correct unsigned 16-bit value, even + though it looks like dark magic. */ + const __m128 mulby32767 = _mm_set1_ps(32767.0f); + const __m128i topbit = _mm_set1_epi16(-32768); + __m128i *mmdst = (__m128i *) dst; + while (i >= 8) { /* 8 * float32 */ + const __m128i ints1 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src), mulby32767)); /* load 4 floats, convert to sint32 */ + const __m128i ints2 = _mm_cvtps_epi32(_mm_mul_ps(_mm_load_ps(src+4), mulby32767)); /* load 4 floats, convert to sint32 */ + _mm_store_si128(mmdst, _mm_xor_si128(_mm_packs_epi32(ints1, ints2), topbit)); /* pack to sint16, xor top bit, store out. */ + i -= 8; src += 8; mmdst++; + } + dst = (Uint16 *) mmdst; + } + + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (Uint16) ((*src + 1.0f) * 32767.0f); + i--; src++; dst++; } cvt->len_cvt /= 2; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); + cvt->filters[cvt->filter_index](cvt, AUDIO_U16SYS); } } static void SDLCALL -SDL_Convert_S32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) +SDL_Convert_F32_to_S32_SSE2(SDL_AudioCVT *cvt, SDL_AudioFormat format) { - int i; - const Uint32 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_U16MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapLE32(*src))) ^ 0x80000000) >> 16)); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (((Sint32) SDL_SwapLE32(*src)) >> 16)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_S32MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) SDL_SwapLE32(*src)); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647); - *dst = SDL_SwapFloatLE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32LSB to AUDIO_F32MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const float val = (((float) ((Sint32) SDL_SwapLE32(*src))) * DIVBY2147483647); - *dst = SDL_SwapFloatBE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U8.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 24)); - *dst = val; - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S8.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (((Sint32) SDL_SwapBE32(*src)) >> 24)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16)); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16)); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_U16MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) (((((Sint32) SDL_SwapBE32(*src))) ^ 0x80000000) >> 16)); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S16MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (((Sint32) SDL_SwapBE32(*src)) >> 16)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_S32LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) SDL_SwapBE32(*src)); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32LSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647); - *dst = SDL_SwapFloatLE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -static void SDLCALL -SDL_Convert_S32MSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const Uint32 *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_S32MSB to AUDIO_F32MSB.\n"); -#endif - - src = (const Uint32 *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (Uint32); i; --i, ++src, ++dst) { - const float val = (((float) ((Sint32) SDL_SwapBE32(*src))) * DIVBY2147483647); - *dst = SDL_SwapFloatBE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U8.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) ((SDL_SwapFloatLE(*src) + 1.0f) * 127.0f)); - *dst = val; - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S8.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (SDL_SwapFloatLE(*src) * 127.0f)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f)); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f)); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_U16MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) ((SDL_SwapFloatLE(*src) + 1.0f) * 32767.0f)); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S16MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (SDL_SwapFloatLE(*src) * 32767.0f)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0)); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_S32MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) (SDL_SwapFloatLE(*src) * 2147483647.0)); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_F32LSB_to_F32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32LSB to AUDIO_F32MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const float val = SDL_SwapFloatLE(*src); - *dst = SDL_SwapFloatBE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32MSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_U8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U8.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint8 val = ((Uint8) ((SDL_SwapFloatBE(*src) + 1.0f) * 127.0f)); - *dst = val; - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U8); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S8(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint8 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S8.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint8 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint8 val = ((Sint8) (SDL_SwapFloatBE(*src) * 127.0f)); - *dst = ((Sint8) val); - } - - cvt->len_cvt /= 4; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S8); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_U16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f)); - *dst = SDL_SwapLE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16LSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S16LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f)); - *dst = ((Sint16) SDL_SwapLE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16LSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_U16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Uint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_U16MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Uint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Uint16 val = ((Uint16) ((SDL_SwapFloatBE(*src) + 1.0f) * 32767.0f)); - *dst = SDL_SwapBE16(val); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_U16MSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S16MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint16 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S16MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint16 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint16 val = ((Sint16) (SDL_SwapFloatBE(*src) * 32767.0f)); - *dst = ((Sint16) SDL_SwapBE16(val)); - } - - cvt->len_cvt /= 2; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S16MSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0)); - *dst = ((Sint32) SDL_SwapLE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32LSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_S32MSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - Sint32 *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_S32MSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (Sint32 *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const Sint32 val = ((Sint32) (SDL_SwapFloatBE(*src) * 2147483647.0)); - *dst = ((Sint32) SDL_SwapBE32(val)); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_S32MSB); - } -} - -static void SDLCALL -SDL_Convert_F32MSB_to_F32LSB(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ - int i; - const float *src; - float *dst; - -#if DEBUG_CONVERT - fprintf(stderr, "Converting AUDIO_F32MSB to AUDIO_F32LSB.\n"); -#endif - - src = (const float *) cvt->buf; - dst = (float *) cvt->buf; - for (i = cvt->len_cvt / sizeof (float); i; --i, ++src, ++dst) { - const float val = SDL_SwapFloatBE(*src); - *dst = SDL_SwapFloatLE(val); - } - - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_F32LSB); - } -} - -#endif /* !NO_CONVERTERS */ - - -const SDL_AudioTypeFilters sdl_audio_type_filters[] = -{ -#if !NO_CONVERTERS - { AUDIO_U8, AUDIO_S8, SDL_Convert_U8_to_S8 }, - { AUDIO_U8, AUDIO_U16LSB, SDL_Convert_U8_to_U16LSB }, - { AUDIO_U8, AUDIO_S16LSB, SDL_Convert_U8_to_S16LSB }, - { AUDIO_U8, AUDIO_U16MSB, SDL_Convert_U8_to_U16MSB }, - { AUDIO_U8, AUDIO_S16MSB, SDL_Convert_U8_to_S16MSB }, - { AUDIO_U8, AUDIO_S32LSB, SDL_Convert_U8_to_S32LSB }, - { AUDIO_U8, AUDIO_S32MSB, SDL_Convert_U8_to_S32MSB }, - { AUDIO_U8, AUDIO_F32LSB, SDL_Convert_U8_to_F32LSB }, - { AUDIO_U8, AUDIO_F32MSB, SDL_Convert_U8_to_F32MSB }, - { AUDIO_S8, AUDIO_U8, SDL_Convert_S8_to_U8 }, - { AUDIO_S8, AUDIO_U16LSB, SDL_Convert_S8_to_U16LSB }, - { AUDIO_S8, AUDIO_S16LSB, SDL_Convert_S8_to_S16LSB }, - { AUDIO_S8, AUDIO_U16MSB, SDL_Convert_S8_to_U16MSB }, - { AUDIO_S8, AUDIO_S16MSB, SDL_Convert_S8_to_S16MSB }, - { AUDIO_S8, AUDIO_S32LSB, SDL_Convert_S8_to_S32LSB }, - { AUDIO_S8, AUDIO_S32MSB, SDL_Convert_S8_to_S32MSB }, - { AUDIO_S8, AUDIO_F32LSB, SDL_Convert_S8_to_F32LSB }, - { AUDIO_S8, AUDIO_F32MSB, SDL_Convert_S8_to_F32MSB }, - { AUDIO_U16LSB, AUDIO_U8, SDL_Convert_U16LSB_to_U8 }, - { AUDIO_U16LSB, AUDIO_S8, SDL_Convert_U16LSB_to_S8 }, - { AUDIO_U16LSB, AUDIO_S16LSB, SDL_Convert_U16LSB_to_S16LSB }, - { AUDIO_U16LSB, AUDIO_U16MSB, SDL_Convert_U16LSB_to_U16MSB }, - { AUDIO_U16LSB, AUDIO_S16MSB, SDL_Convert_U16LSB_to_S16MSB }, - { AUDIO_U16LSB, AUDIO_S32LSB, SDL_Convert_U16LSB_to_S32LSB }, - { AUDIO_U16LSB, AUDIO_S32MSB, SDL_Convert_U16LSB_to_S32MSB }, - { AUDIO_U16LSB, AUDIO_F32LSB, SDL_Convert_U16LSB_to_F32LSB }, - { AUDIO_U16LSB, AUDIO_F32MSB, SDL_Convert_U16LSB_to_F32MSB }, - { AUDIO_S16LSB, AUDIO_U8, SDL_Convert_S16LSB_to_U8 }, - { AUDIO_S16LSB, AUDIO_S8, SDL_Convert_S16LSB_to_S8 }, - { AUDIO_S16LSB, AUDIO_U16LSB, SDL_Convert_S16LSB_to_U16LSB }, - { AUDIO_S16LSB, AUDIO_U16MSB, SDL_Convert_S16LSB_to_U16MSB }, - { AUDIO_S16LSB, AUDIO_S16MSB, SDL_Convert_S16LSB_to_S16MSB }, - { AUDIO_S16LSB, AUDIO_S32LSB, SDL_Convert_S16LSB_to_S32LSB }, - { AUDIO_S16LSB, AUDIO_S32MSB, SDL_Convert_S16LSB_to_S32MSB }, - { AUDIO_S16LSB, AUDIO_F32LSB, SDL_Convert_S16LSB_to_F32LSB }, - { AUDIO_S16LSB, AUDIO_F32MSB, SDL_Convert_S16LSB_to_F32MSB }, - { AUDIO_U16MSB, AUDIO_U8, SDL_Convert_U16MSB_to_U8 }, - { AUDIO_U16MSB, AUDIO_S8, SDL_Convert_U16MSB_to_S8 }, - { AUDIO_U16MSB, AUDIO_U16LSB, SDL_Convert_U16MSB_to_U16LSB }, - { AUDIO_U16MSB, AUDIO_S16LSB, SDL_Convert_U16MSB_to_S16LSB }, - { AUDIO_U16MSB, AUDIO_S16MSB, SDL_Convert_U16MSB_to_S16MSB }, - { AUDIO_U16MSB, AUDIO_S32LSB, SDL_Convert_U16MSB_to_S32LSB }, - { AUDIO_U16MSB, AUDIO_S32MSB, SDL_Convert_U16MSB_to_S32MSB }, - { AUDIO_U16MSB, AUDIO_F32LSB, SDL_Convert_U16MSB_to_F32LSB }, - { AUDIO_U16MSB, AUDIO_F32MSB, SDL_Convert_U16MSB_to_F32MSB }, - { AUDIO_S16MSB, AUDIO_U8, SDL_Convert_S16MSB_to_U8 }, - { AUDIO_S16MSB, AUDIO_S8, SDL_Convert_S16MSB_to_S8 }, - { AUDIO_S16MSB, AUDIO_U16LSB, SDL_Convert_S16MSB_to_U16LSB }, - { AUDIO_S16MSB, AUDIO_S16LSB, SDL_Convert_S16MSB_to_S16LSB }, - { AUDIO_S16MSB, AUDIO_U16MSB, SDL_Convert_S16MSB_to_U16MSB }, - { AUDIO_S16MSB, AUDIO_S32LSB, SDL_Convert_S16MSB_to_S32LSB }, - { AUDIO_S16MSB, AUDIO_S32MSB, SDL_Convert_S16MSB_to_S32MSB }, - { AUDIO_S16MSB, AUDIO_F32LSB, SDL_Convert_S16MSB_to_F32LSB }, - { AUDIO_S16MSB, AUDIO_F32MSB, SDL_Convert_S16MSB_to_F32MSB }, - { AUDIO_S32LSB, AUDIO_U8, SDL_Convert_S32LSB_to_U8 }, - { AUDIO_S32LSB, AUDIO_S8, SDL_Convert_S32LSB_to_S8 }, - { AUDIO_S32LSB, AUDIO_U16LSB, SDL_Convert_S32LSB_to_U16LSB }, - { AUDIO_S32LSB, AUDIO_S16LSB, SDL_Convert_S32LSB_to_S16LSB }, - { AUDIO_S32LSB, AUDIO_U16MSB, SDL_Convert_S32LSB_to_U16MSB }, - { AUDIO_S32LSB, AUDIO_S16MSB, SDL_Convert_S32LSB_to_S16MSB }, - { AUDIO_S32LSB, AUDIO_S32MSB, SDL_Convert_S32LSB_to_S32MSB }, - { AUDIO_S32LSB, AUDIO_F32LSB, SDL_Convert_S32LSB_to_F32LSB }, - { AUDIO_S32LSB, AUDIO_F32MSB, SDL_Convert_S32LSB_to_F32MSB }, - { AUDIO_S32MSB, AUDIO_U8, SDL_Convert_S32MSB_to_U8 }, - { AUDIO_S32MSB, AUDIO_S8, SDL_Convert_S32MSB_to_S8 }, - { AUDIO_S32MSB, AUDIO_U16LSB, SDL_Convert_S32MSB_to_U16LSB }, - { AUDIO_S32MSB, AUDIO_S16LSB, SDL_Convert_S32MSB_to_S16LSB }, - { AUDIO_S32MSB, AUDIO_U16MSB, SDL_Convert_S32MSB_to_U16MSB }, - { AUDIO_S32MSB, AUDIO_S16MSB, SDL_Convert_S32MSB_to_S16MSB }, - { AUDIO_S32MSB, AUDIO_S32LSB, SDL_Convert_S32MSB_to_S32LSB }, - { AUDIO_S32MSB, AUDIO_F32LSB, SDL_Convert_S32MSB_to_F32LSB }, - { AUDIO_S32MSB, AUDIO_F32MSB, SDL_Convert_S32MSB_to_F32MSB }, - { AUDIO_F32LSB, AUDIO_U8, SDL_Convert_F32LSB_to_U8 }, - { AUDIO_F32LSB, AUDIO_S8, SDL_Convert_F32LSB_to_S8 }, - { AUDIO_F32LSB, AUDIO_U16LSB, SDL_Convert_F32LSB_to_U16LSB }, - { AUDIO_F32LSB, AUDIO_S16LSB, SDL_Convert_F32LSB_to_S16LSB }, - { AUDIO_F32LSB, AUDIO_U16MSB, SDL_Convert_F32LSB_to_U16MSB }, - { AUDIO_F32LSB, AUDIO_S16MSB, SDL_Convert_F32LSB_to_S16MSB }, - { AUDIO_F32LSB, AUDIO_S32LSB, SDL_Convert_F32LSB_to_S32LSB }, - { AUDIO_F32LSB, AUDIO_S32MSB, SDL_Convert_F32LSB_to_S32MSB }, - { AUDIO_F32LSB, AUDIO_F32MSB, SDL_Convert_F32LSB_to_F32MSB }, - { AUDIO_F32MSB, AUDIO_U8, SDL_Convert_F32MSB_to_U8 }, - { AUDIO_F32MSB, AUDIO_S8, SDL_Convert_F32MSB_to_S8 }, - { AUDIO_F32MSB, AUDIO_U16LSB, SDL_Convert_F32MSB_to_U16LSB }, - { AUDIO_F32MSB, AUDIO_S16LSB, SDL_Convert_F32MSB_to_S16LSB }, - { AUDIO_F32MSB, AUDIO_U16MSB, SDL_Convert_F32MSB_to_U16MSB }, - { AUDIO_F32MSB, AUDIO_S16MSB, SDL_Convert_F32MSB_to_S16MSB }, - { AUDIO_F32MSB, AUDIO_S32LSB, SDL_Convert_F32MSB_to_S32LSB }, - { AUDIO_F32MSB, AUDIO_S32MSB, SDL_Convert_F32MSB_to_S32MSB }, - { AUDIO_F32MSB, AUDIO_F32LSB, SDL_Convert_F32MSB_to_F32LSB }, -#endif /* !NO_CONVERTERS */ - { 0, 0, NULL } -}; - - -#if !NO_RESAMPLERS - -static void SDLCALL -SDL_Upsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 16; - const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1; - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample0 = src[0]; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[0] = sample0; - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 16; - const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1; - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst++; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample1 = src[1]; - Uint8 sample0 = src[0]; - Uint8 last_sample1 = sample1; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[1] = sample1; - dst[0] = sample0; - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 sample1 = src[1]; - Uint8 last_sample0 = sample0; - Uint8 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst[1] = sample1; - dst += 2; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample3 = src[3]; - Uint8 sample2 = src[2]; - Uint8 sample1 = src[1]; - Uint8 sample0 = src[0]; - Uint8 last_sample3 = sample3; - Uint8 last_sample2 = sample2; - Uint8 last_sample1 = sample1; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[3] = sample3; - dst[2] = sample2; - dst[1] = sample1; - dst[0] = sample0; - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 sample1 = src[1]; - Uint8 sample2 = src[2]; - Uint8 sample3 = src[3]; - Uint8 last_sample0 = sample0; - Uint8 last_sample1 = sample1; - Uint8 last_sample2 = sample2; - Uint8 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst[1] = sample1; - dst[2] = sample2; - dst[3] = sample3; - dst += 4; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 96; - const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6; - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample5 = src[5]; - Uint8 sample4 = src[4]; - Uint8 sample3 = src[3]; - Uint8 sample2 = src[2]; - Uint8 sample1 = src[1]; - Uint8 sample0 = src[0]; - Uint8 last_sample5 = sample5; - Uint8 last_sample4 = sample4; - Uint8 last_sample3 = sample3; - Uint8 last_sample2 = sample2; - Uint8 last_sample1 = sample1; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[5] = sample5; - dst[4] = sample4; - dst[3] = sample3; - dst[2] = sample2; - dst[1] = sample1; - dst[0] = sample0; - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1); - sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 96; - const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6; - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 sample1 = src[1]; - Uint8 sample2 = src[2]; - Uint8 sample3 = src[3]; - Uint8 sample4 = src[4]; - Uint8 sample5 = src[5]; - Uint8 last_sample0 = sample0; - Uint8 last_sample1 = sample1; - Uint8 last_sample2 = sample2; - Uint8 last_sample3 = sample3; - Uint8 last_sample4 = sample4; - Uint8 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst[1] = sample1; - dst[2] = sample2; - dst[3] = sample3; - dst[4] = sample4; - dst[5] = sample5; - dst += 6; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1); - sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U8, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Uint8 sample7 = src[7]; - Uint8 sample6 = src[6]; - Uint8 sample5 = src[5]; - Uint8 sample4 = src[4]; - Uint8 sample3 = src[3]; - Uint8 sample2 = src[2]; - Uint8 sample1 = src[1]; - Uint8 sample0 = src[0]; - Uint8 last_sample7 = sample7; - Uint8 last_sample6 = sample6; - Uint8 last_sample5 = sample5; - Uint8 last_sample4 = sample4; - Uint8 last_sample3 = sample3; - Uint8 last_sample2 = sample2; - Uint8 last_sample1 = sample1; - Uint8 last_sample0 = sample0; - while (dst >= target) { - dst[7] = sample7; - dst[6] = sample6; - dst[5] = sample5; - dst[4] = sample4; - dst[3] = sample3; - dst[2] = sample2; - dst[1] = sample1; - dst[0] = sample0; - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Uint8) ((((Sint16) src[7]) + ((Sint16) last_sample7)) >> 1); - sample6 = (Uint8) ((((Sint16) src[6]) + ((Sint16) last_sample6)) >> 1); - sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1); - sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U8, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Uint8 sample0 = src[0]; - Uint8 sample1 = src[1]; - Uint8 sample2 = src[2]; - Uint8 sample3 = src[3]; - Uint8 sample4 = src[4]; - Uint8 sample5 = src[5]; - Uint8 sample6 = src[6]; - Uint8 sample7 = src[7]; - Uint8 last_sample0 = sample0; - Uint8 last_sample1 = sample1; - Uint8 last_sample2 = sample2; - Uint8 last_sample3 = sample3; - Uint8 last_sample4 = sample4; - Uint8 last_sample5 = sample5; - Uint8 last_sample6 = sample6; - Uint8 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = sample0; - dst[1] = sample1; - dst[2] = sample2; - dst[3] = sample3; - dst[4] = sample4; - dst[5] = sample5; - dst[6] = sample6; - dst[7] = sample7; - dst += 8; - sample0 = (Uint8) ((((Sint16) src[0]) + ((Sint16) last_sample0)) >> 1); - sample1 = (Uint8) ((((Sint16) src[1]) + ((Sint16) last_sample1)) >> 1); - sample2 = (Uint8) ((((Sint16) src[2]) + ((Sint16) last_sample2)) >> 1); - sample3 = (Uint8) ((((Sint16) src[3]) + ((Sint16) last_sample3)) >> 1); - sample4 = (Uint8) ((((Sint16) src[4]) + ((Sint16) last_sample4)) >> 1); - sample5 = (Uint8) ((((Sint16) src[5]) + ((Sint16) last_sample5)) >> 1); - sample6 = (Uint8) ((((Sint16) src[6]) + ((Sint16) last_sample6)) >> 1); - sample7 = (Uint8) ((((Sint16) src[7]) + ((Sint16) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 16; - const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1; - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint8) sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 16; - const int dstsize = (int) (((double)(cvt->len_cvt/1)) * cvt->rate_incr) * 1; - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst++; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample1 = sample1; - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint8) sample1); - dst[0] = ((Sint8) sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 last_sample0 = sample0; - Sint8 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst[1] = ((Sint8) sample1); - dst += 2; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample3 = sample3; - Sint8 last_sample2 = sample2; - Sint8 last_sample1 = sample1; - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint8) sample3); - dst[2] = ((Sint8) sample2); - dst[1] = ((Sint8) sample1); - dst[0] = ((Sint8) sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 last_sample0 = sample0; - Sint8 last_sample1 = sample1; - Sint8 last_sample2 = sample2; - Sint8 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst[1] = ((Sint8) sample1); - dst[2] = ((Sint8) sample2); - dst[3] = ((Sint8) sample3); - dst += 4; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 96; - const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6; - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample5 = ((Sint8) src[5]); - Sint8 sample4 = ((Sint8) src[4]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample5 = sample5; - Sint8 last_sample4 = sample4; - Sint8 last_sample3 = sample3; - Sint8 last_sample2 = sample2; - Sint8 last_sample1 = sample1; - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint8) sample5); - dst[4] = ((Sint8) sample4); - dst[3] = ((Sint8) sample3); - dst[2] = ((Sint8) sample2); - dst[1] = ((Sint8) sample1); - dst[0] = ((Sint8) sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1); - sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 96; - const int dstsize = (int) (((double)(cvt->len_cvt/6)) * cvt->rate_incr) * 6; - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample4 = ((Sint8) src[4]); - Sint8 sample5 = ((Sint8) src[5]); - Sint8 last_sample0 = sample0; - Sint8 last_sample1 = sample1; - Sint8 last_sample2 = sample2; - Sint8 last_sample3 = sample3; - Sint8 last_sample4 = sample4; - Sint8 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst[1] = ((Sint8) sample1); - dst[2] = ((Sint8) sample2); - dst[3] = ((Sint8) sample3); - dst[4] = ((Sint8) sample4); - dst[5] = ((Sint8) sample5); - dst += 6; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1); - sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S8, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint8 sample7 = ((Sint8) src[7]); - Sint8 sample6 = ((Sint8) src[6]); - Sint8 sample5 = ((Sint8) src[5]); - Sint8 sample4 = ((Sint8) src[4]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 last_sample7 = sample7; - Sint8 last_sample6 = sample6; - Sint8 last_sample5 = sample5; - Sint8 last_sample4 = sample4; - Sint8 last_sample3 = sample3; - Sint8 last_sample2 = sample2; - Sint8 last_sample1 = sample1; - Sint8 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint8) sample7); - dst[6] = ((Sint8) sample6); - dst[5] = ((Sint8) sample5); - dst[4] = ((Sint8) sample4); - dst[3] = ((Sint8) sample3); - dst[2] = ((Sint8) sample2); - dst[1] = ((Sint8) sample1); - dst[0] = ((Sint8) sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint8) ((((Sint16) ((Sint8) src[7])) + ((Sint16) last_sample7)) >> 1); - sample6 = (Sint8) ((((Sint16) ((Sint8) src[6])) + ((Sint16) last_sample6)) >> 1); - sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1); - sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S8, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint8 sample0 = ((Sint8) src[0]); - Sint8 sample1 = ((Sint8) src[1]); - Sint8 sample2 = ((Sint8) src[2]); - Sint8 sample3 = ((Sint8) src[3]); - Sint8 sample4 = ((Sint8) src[4]); - Sint8 sample5 = ((Sint8) src[5]); - Sint8 sample6 = ((Sint8) src[6]); - Sint8 sample7 = ((Sint8) src[7]); - Sint8 last_sample0 = sample0; - Sint8 last_sample1 = sample1; - Sint8 last_sample2 = sample2; - Sint8 last_sample3 = sample3; - Sint8 last_sample4 = sample4; - Sint8 last_sample5 = sample5; - Sint8 last_sample6 = sample6; - Sint8 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint8) sample0); - dst[1] = ((Sint8) sample1); - dst[2] = ((Sint8) sample2); - dst[3] = ((Sint8) sample3); - dst[4] = ((Sint8) sample4); - dst[5] = ((Sint8) sample5); - dst[6] = ((Sint8) sample6); - dst[7] = ((Sint8) sample7); - dst += 8; - sample0 = (Sint8) ((((Sint16) ((Sint8) src[0])) + ((Sint16) last_sample0)) >> 1); - sample1 = (Sint8) ((((Sint16) ((Sint8) src[1])) + ((Sint16) last_sample1)) >> 1); - sample2 = (Sint8) ((((Sint16) ((Sint8) src[2])) + ((Sint16) last_sample2)) >> 1); - sample3 = (Sint8) ((((Sint16) ((Sint8) src[3])) + ((Sint16) last_sample3)) >> 1); - sample4 = (Sint8) ((((Sint16) ((Sint8) src[4])) + ((Sint16) last_sample4)) >> 1); - sample5 = (Sint8) ((((Sint16) ((Sint8) src[5])) + ((Sint16) last_sample5)) >> 1); - sample6 = (Sint8) ((((Sint16) ((Sint8) src[6])) + ((Sint16) last_sample6)) >> 1); - sample7 = (Sint8) ((((Sint16) ((Sint8) src[7])) + ((Sint16) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[0] = SDL_SwapLE16(sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst++; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[1] = SDL_SwapLE16(sample1); - dst[0] = SDL_SwapLE16(sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst[1] = SDL_SwapLE16(sample1); - dst += 2; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[3] = SDL_SwapLE16(sample3); - dst[2] = SDL_SwapLE16(sample2); - dst[1] = SDL_SwapLE16(sample1); - dst[0] = SDL_SwapLE16(sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst[1] = SDL_SwapLE16(sample1); - dst[2] = SDL_SwapLE16(sample2); - dst[3] = SDL_SwapLE16(sample3); - dst += 4; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample5 = SDL_SwapLE16(src[5]); - Uint16 sample4 = SDL_SwapLE16(src[4]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample5 = sample5; - Uint16 last_sample4 = sample4; - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[5] = SDL_SwapLE16(sample5); - dst[4] = SDL_SwapLE16(sample4); - dst[3] = SDL_SwapLE16(sample3); - dst[2] = SDL_SwapLE16(sample2); - dst[1] = SDL_SwapLE16(sample1); - dst[0] = SDL_SwapLE16(sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample4 = SDL_SwapLE16(src[4]); - Uint16 sample5 = SDL_SwapLE16(src[5]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - Uint16 last_sample4 = sample4; - Uint16 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst[1] = SDL_SwapLE16(sample1); - dst[2] = SDL_SwapLE16(sample2); - dst[3] = SDL_SwapLE16(sample3); - dst[4] = SDL_SwapLE16(sample4); - dst[5] = SDL_SwapLE16(sample5); - dst += 6; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample7 = SDL_SwapLE16(src[7]); - Uint16 sample6 = SDL_SwapLE16(src[6]); - Uint16 sample5 = SDL_SwapLE16(src[5]); - Uint16 sample4 = SDL_SwapLE16(src[4]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 last_sample7 = sample7; - Uint16 last_sample6 = sample6; - Uint16 last_sample5 = sample5; - Uint16 last_sample4 = sample4; - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[7] = SDL_SwapLE16(sample7); - dst[6] = SDL_SwapLE16(sample6); - dst[5] = SDL_SwapLE16(sample5); - dst[4] = SDL_SwapLE16(sample4); - dst[3] = SDL_SwapLE16(sample3); - dst[2] = SDL_SwapLE16(sample2); - dst[1] = SDL_SwapLE16(sample1); - dst[0] = SDL_SwapLE16(sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Uint16) ((((Sint32) SDL_SwapLE16(src[7])) + ((Sint32) last_sample7)) >> 1); - sample6 = (Uint16) ((((Sint32) SDL_SwapLE16(src[6])) + ((Sint32) last_sample6)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapLE16(src[0]); - Uint16 sample1 = SDL_SwapLE16(src[1]); - Uint16 sample2 = SDL_SwapLE16(src[2]); - Uint16 sample3 = SDL_SwapLE16(src[3]); - Uint16 sample4 = SDL_SwapLE16(src[4]); - Uint16 sample5 = SDL_SwapLE16(src[5]); - Uint16 sample6 = SDL_SwapLE16(src[6]); - Uint16 sample7 = SDL_SwapLE16(src[7]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - Uint16 last_sample4 = sample4; - Uint16 last_sample5 = sample5; - Uint16 last_sample6 = sample6; - Uint16 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapLE16(sample0); - dst[1] = SDL_SwapLE16(sample1); - dst[2] = SDL_SwapLE16(sample2); - dst[3] = SDL_SwapLE16(sample3); - dst[4] = SDL_SwapLE16(sample4); - dst[5] = SDL_SwapLE16(sample5); - dst[6] = SDL_SwapLE16(sample6); - dst[7] = SDL_SwapLE16(sample7); - dst += 8; - sample0 = (Uint16) ((((Sint32) SDL_SwapLE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapLE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapLE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapLE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapLE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapLE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample6 = (Uint16) ((((Sint32) SDL_SwapLE16(src[6])) + ((Sint32) last_sample6)) >> 1); - sample7 = (Uint16) ((((Sint32) SDL_SwapLE16(src[7])) + ((Sint32) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst++; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst += 2; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst += 4; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5])); - Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample5 = sample5; - Sint16 last_sample4 = sample4; - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint16) SDL_SwapLE16(sample5)); - dst[4] = ((Sint16) SDL_SwapLE16(sample4)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4])); - Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - Sint16 last_sample4 = sample4; - Sint16 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[4] = ((Sint16) SDL_SwapLE16(sample4)); - dst[5] = ((Sint16) SDL_SwapLE16(sample5)); - dst += 6; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7])); - Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6])); - Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5])); - Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 last_sample7 = sample7; - Sint16 last_sample6 = sample6; - Sint16 last_sample5 = sample5; - Sint16 last_sample4 = sample4; - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint16) SDL_SwapLE16(sample7)); - dst[6] = ((Sint16) SDL_SwapLE16(sample6)); - dst[5] = ((Sint16) SDL_SwapLE16(sample5)); - dst[4] = ((Sint16) SDL_SwapLE16(sample4)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[7]))) + ((Sint32) last_sample7)) >> 1); - sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[6]))) + ((Sint32) last_sample6)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapLE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapLE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapLE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapLE16(src[3])); - Sint16 sample4 = ((Sint16) SDL_SwapLE16(src[4])); - Sint16 sample5 = ((Sint16) SDL_SwapLE16(src[5])); - Sint16 sample6 = ((Sint16) SDL_SwapLE16(src[6])); - Sint16 sample7 = ((Sint16) SDL_SwapLE16(src[7])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - Sint16 last_sample4 = sample4; - Sint16 last_sample5 = sample5; - Sint16 last_sample6 = sample6; - Sint16 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapLE16(sample0)); - dst[1] = ((Sint16) SDL_SwapLE16(sample1)); - dst[2] = ((Sint16) SDL_SwapLE16(sample2)); - dst[3] = ((Sint16) SDL_SwapLE16(sample3)); - dst[4] = ((Sint16) SDL_SwapLE16(sample4)); - dst[5] = ((Sint16) SDL_SwapLE16(sample5)); - dst[6] = ((Sint16) SDL_SwapLE16(sample6)); - dst[7] = ((Sint16) SDL_SwapLE16(sample7)); - dst += 8; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[6]))) + ((Sint32) last_sample6)) >> 1); - sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapLE16(src[7]))) + ((Sint32) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[0] = SDL_SwapBE16(sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst++; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[1] = SDL_SwapBE16(sample1); - dst[0] = SDL_SwapBE16(sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst[1] = SDL_SwapBE16(sample1); - dst += 2; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[3] = SDL_SwapBE16(sample3); - dst[2] = SDL_SwapBE16(sample2); - dst[1] = SDL_SwapBE16(sample1); - dst[0] = SDL_SwapBE16(sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst[1] = SDL_SwapBE16(sample1); - dst[2] = SDL_SwapBE16(sample2); - dst[3] = SDL_SwapBE16(sample3); - dst += 4; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample5 = SDL_SwapBE16(src[5]); - Uint16 sample4 = SDL_SwapBE16(src[4]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample5 = sample5; - Uint16 last_sample4 = sample4; - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[5] = SDL_SwapBE16(sample5); - dst[4] = SDL_SwapBE16(sample4); - dst[3] = SDL_SwapBE16(sample3); - dst[2] = SDL_SwapBE16(sample2); - dst[1] = SDL_SwapBE16(sample1); - dst[0] = SDL_SwapBE16(sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample4 = SDL_SwapBE16(src[4]); - Uint16 sample5 = SDL_SwapBE16(src[5]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - Uint16 last_sample4 = sample4; - Uint16 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst[1] = SDL_SwapBE16(sample1); - dst[2] = SDL_SwapBE16(sample2); - dst[3] = SDL_SwapBE16(sample3); - dst[4] = SDL_SwapBE16(sample4); - dst[5] = SDL_SwapBE16(sample5); - dst += 6; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_U16MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Uint16 sample7 = SDL_SwapBE16(src[7]); - Uint16 sample6 = SDL_SwapBE16(src[6]); - Uint16 sample5 = SDL_SwapBE16(src[5]); - Uint16 sample4 = SDL_SwapBE16(src[4]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 last_sample7 = sample7; - Uint16 last_sample6 = sample6; - Uint16 last_sample5 = sample5; - Uint16 last_sample4 = sample4; - Uint16 last_sample3 = sample3; - Uint16 last_sample2 = sample2; - Uint16 last_sample1 = sample1; - Uint16 last_sample0 = sample0; - while (dst >= target) { - dst[7] = SDL_SwapBE16(sample7); - dst[6] = SDL_SwapBE16(sample6); - dst[5] = SDL_SwapBE16(sample5); - dst[4] = SDL_SwapBE16(sample4); - dst[3] = SDL_SwapBE16(sample3); - dst[2] = SDL_SwapBE16(sample2); - dst[1] = SDL_SwapBE16(sample1); - dst[0] = SDL_SwapBE16(sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Uint16) ((((Sint32) SDL_SwapBE16(src[7])) + ((Sint32) last_sample7)) >> 1); - sample6 = (Uint16) ((((Sint32) SDL_SwapBE16(src[6])) + ((Sint32) last_sample6)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_U16MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Uint16 sample0 = SDL_SwapBE16(src[0]); - Uint16 sample1 = SDL_SwapBE16(src[1]); - Uint16 sample2 = SDL_SwapBE16(src[2]); - Uint16 sample3 = SDL_SwapBE16(src[3]); - Uint16 sample4 = SDL_SwapBE16(src[4]); - Uint16 sample5 = SDL_SwapBE16(src[5]); - Uint16 sample6 = SDL_SwapBE16(src[6]); - Uint16 sample7 = SDL_SwapBE16(src[7]); - Uint16 last_sample0 = sample0; - Uint16 last_sample1 = sample1; - Uint16 last_sample2 = sample2; - Uint16 last_sample3 = sample3; - Uint16 last_sample4 = sample4; - Uint16 last_sample5 = sample5; - Uint16 last_sample6 = sample6; - Uint16 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapBE16(sample0); - dst[1] = SDL_SwapBE16(sample1); - dst[2] = SDL_SwapBE16(sample2); - dst[3] = SDL_SwapBE16(sample3); - dst[4] = SDL_SwapBE16(sample4); - dst[5] = SDL_SwapBE16(sample5); - dst[6] = SDL_SwapBE16(sample6); - dst[7] = SDL_SwapBE16(sample7); - dst += 8; - sample0 = (Uint16) ((((Sint32) SDL_SwapBE16(src[0])) + ((Sint32) last_sample0)) >> 1); - sample1 = (Uint16) ((((Sint32) SDL_SwapBE16(src[1])) + ((Sint32) last_sample1)) >> 1); - sample2 = (Uint16) ((((Sint32) SDL_SwapBE16(src[2])) + ((Sint32) last_sample2)) >> 1); - sample3 = (Uint16) ((((Sint32) SDL_SwapBE16(src[3])) + ((Sint32) last_sample3)) >> 1); - sample4 = (Uint16) ((((Sint32) SDL_SwapBE16(src[4])) + ((Sint32) last_sample4)) >> 1); - sample5 = (Uint16) ((((Sint32) SDL_SwapBE16(src[5])) + ((Sint32) last_sample5)) >> 1); - sample6 = (Uint16) ((((Sint32) SDL_SwapBE16(src[6])) + ((Sint32) last_sample6)) >> 1); - sample7 = (Uint16) ((((Sint32) SDL_SwapBE16(src[7])) + ((Sint32) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 32; - const int dstsize = (int) (((double)(cvt->len_cvt/2)) * cvt->rate_incr) * 2; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst++; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst += 2; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst += 4; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5])); - Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample5 = sample5; - Sint16 last_sample4 = sample4; - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint16) SDL_SwapBE16(sample5)); - dst[4] = ((Sint16) SDL_SwapBE16(sample4)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 192; - const int dstsize = (int) (((double)(cvt->len_cvt/12)) * cvt->rate_incr) * 12; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4])); - Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - Sint16 last_sample4 = sample4; - Sint16 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[4] = ((Sint16) SDL_SwapBE16(sample4)); - dst[5] = ((Sint16) SDL_SwapBE16(sample5)); - dst += 6; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S16MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7])); - Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6])); - Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5])); - Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 last_sample7 = sample7; - Sint16 last_sample6 = sample6; - Sint16 last_sample5 = sample5; - Sint16 last_sample4 = sample4; - Sint16 last_sample3 = sample3; - Sint16 last_sample2 = sample2; - Sint16 last_sample1 = sample1; - Sint16 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint16) SDL_SwapBE16(sample7)); - dst[6] = ((Sint16) SDL_SwapBE16(sample6)); - dst[5] = ((Sint16) SDL_SwapBE16(sample5)); - dst[4] = ((Sint16) SDL_SwapBE16(sample4)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[7]))) + ((Sint32) last_sample7)) >> 1); - sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[6]))) + ((Sint32) last_sample6)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S16MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint16 sample0 = ((Sint16) SDL_SwapBE16(src[0])); - Sint16 sample1 = ((Sint16) SDL_SwapBE16(src[1])); - Sint16 sample2 = ((Sint16) SDL_SwapBE16(src[2])); - Sint16 sample3 = ((Sint16) SDL_SwapBE16(src[3])); - Sint16 sample4 = ((Sint16) SDL_SwapBE16(src[4])); - Sint16 sample5 = ((Sint16) SDL_SwapBE16(src[5])); - Sint16 sample6 = ((Sint16) SDL_SwapBE16(src[6])); - Sint16 sample7 = ((Sint16) SDL_SwapBE16(src[7])); - Sint16 last_sample0 = sample0; - Sint16 last_sample1 = sample1; - Sint16 last_sample2 = sample2; - Sint16 last_sample3 = sample3; - Sint16 last_sample4 = sample4; - Sint16 last_sample5 = sample5; - Sint16 last_sample6 = sample6; - Sint16 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint16) SDL_SwapBE16(sample0)); - dst[1] = ((Sint16) SDL_SwapBE16(sample1)); - dst[2] = ((Sint16) SDL_SwapBE16(sample2)); - dst[3] = ((Sint16) SDL_SwapBE16(sample3)); - dst[4] = ((Sint16) SDL_SwapBE16(sample4)); - dst[5] = ((Sint16) SDL_SwapBE16(sample5)); - dst[6] = ((Sint16) SDL_SwapBE16(sample6)); - dst[7] = ((Sint16) SDL_SwapBE16(sample7)); - dst += 8; - sample0 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[0]))) + ((Sint32) last_sample0)) >> 1); - sample1 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[1]))) + ((Sint32) last_sample1)) >> 1); - sample2 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[2]))) + ((Sint32) last_sample2)) >> 1); - sample3 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[3]))) + ((Sint32) last_sample3)) >> 1); - sample4 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[4]))) + ((Sint32) last_sample4)) >> 1); - sample5 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[5]))) + ((Sint32) last_sample5)) >> 1); - sample6 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[6]))) + ((Sint32) last_sample6)) >> 1); - sample7 = (Sint16) ((((Sint32) ((Sint16) SDL_SwapBE16(src[7]))) + ((Sint32) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; + const float *src = (const float *) cvt->buf; Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst++; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; + int i; + + LOG_DEBUG_CONVERT("AUDIO_F32", "AUDIO_S32 (using SSE2)"); + + /* Get dst aligned to 16 bytes */ + for (i = cvt->len_cvt / sizeof (float); i && (((size_t) dst) & 15); --i, ++src, ++dst) { + *dst = (Sint32) (((double) *src) * 2147483647.0); + } + + SDL_assert(!i || ((((size_t) dst) & 15) == 0)); + SDL_assert(!i || ((((size_t) src) & 15) == 0)); + + { + /* Aligned! Do SSE blocks as long as we have 16 bytes available. */ + const __m128d mulby2147483647 = _mm_set1_pd(2147483647.0); + __m128i *mmdst = (__m128i *) dst; + while (i >= 4) { /* 4 * float32 */ + const __m128 floats = _mm_load_ps(src); + /* bitshift the whole register over, so _mm_cvtps_pd can read the top floats in the bottom of the vector. */ + const __m128d doubles1 = _mm_mul_pd(_mm_cvtps_pd(_mm_castsi128_ps(_mm_srli_si128(_mm_castps_si128(floats), 8))), mulby2147483647); + const __m128d doubles2 = _mm_mul_pd(_mm_cvtps_pd(floats), mulby2147483647); + _mm_store_si128(mmdst, _mm_or_si128(_mm_slli_si128(_mm_cvtpd_epi32(doubles1), 8), _mm_cvtpd_epi32(doubles2))); + i -= 4; src += 4; mmdst++; } + dst = (Sint32 *) mmdst; } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst += 2; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst += 4; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5])); - Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample5 = sample5; - Sint32 last_sample4 = sample4; - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint32) SDL_SwapLE32(sample5)); - dst[4] = ((Sint32) SDL_SwapLE32(sample4)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4])); - Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - Sint32 last_sample4 = sample4; - Sint32 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[4] = ((Sint32) SDL_SwapLE32(sample4)); - dst[5] = ((Sint32) SDL_SwapLE32(sample5)); - dst += 6; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7])); - Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6])); - Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5])); - Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 last_sample7 = sample7; - Sint32 last_sample6 = sample6; - Sint32 last_sample5 = sample5; - Sint32 last_sample4 = sample4; - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint32) SDL_SwapLE32(sample7)); - dst[6] = ((Sint32) SDL_SwapLE32(sample6)); - dst[5] = ((Sint32) SDL_SwapLE32(sample5)); - dst[4] = ((Sint32) SDL_SwapLE32(sample4)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[7]))) + ((Sint64) last_sample7)) >> 1); - sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[6]))) + ((Sint64) last_sample6)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapLE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapLE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapLE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapLE32(src[3])); - Sint32 sample4 = ((Sint32) SDL_SwapLE32(src[4])); - Sint32 sample5 = ((Sint32) SDL_SwapLE32(src[5])); - Sint32 sample6 = ((Sint32) SDL_SwapLE32(src[6])); - Sint32 sample7 = ((Sint32) SDL_SwapLE32(src[7])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - Sint32 last_sample4 = sample4; - Sint32 last_sample5 = sample5; - Sint32 last_sample6 = sample6; - Sint32 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapLE32(sample0)); - dst[1] = ((Sint32) SDL_SwapLE32(sample1)); - dst[2] = ((Sint32) SDL_SwapLE32(sample2)); - dst[3] = ((Sint32) SDL_SwapLE32(sample3)); - dst[4] = ((Sint32) SDL_SwapLE32(sample4)); - dst[5] = ((Sint32) SDL_SwapLE32(sample5)); - dst[6] = ((Sint32) SDL_SwapLE32(sample6)); - dst[7] = ((Sint32) SDL_SwapLE32(sample7)); - dst += 8; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[6]))) + ((Sint64) last_sample6)) >> 1); - sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapLE32(src[7]))) + ((Sint64) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst++; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst += 2; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst += 4; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5])); - Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample5 = sample5; - Sint32 last_sample4 = sample4; - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[5] = ((Sint32) SDL_SwapBE32(sample5)); - dst[4] = ((Sint32) SDL_SwapBE32(sample4)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4])); - Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - Sint32 last_sample4 = sample4; - Sint32 last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[4] = ((Sint32) SDL_SwapBE32(sample4)); - dst[5] = ((Sint32) SDL_SwapBE32(sample5)); - dst += 6; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_S32MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7])); - Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6])); - Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5])); - Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 last_sample7 = sample7; - Sint32 last_sample6 = sample6; - Sint32 last_sample5 = sample5; - Sint32 last_sample4 = sample4; - Sint32 last_sample3 = sample3; - Sint32 last_sample2 = sample2; - Sint32 last_sample1 = sample1; - Sint32 last_sample0 = sample0; - while (dst >= target) { - dst[7] = ((Sint32) SDL_SwapBE32(sample7)); - dst[6] = ((Sint32) SDL_SwapBE32(sample6)); - dst[5] = ((Sint32) SDL_SwapBE32(sample5)); - dst[4] = ((Sint32) SDL_SwapBE32(sample4)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[7]))) + ((Sint64) last_sample7)) >> 1); - sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[6]))) + ((Sint64) last_sample6)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_S32MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint32 sample0 = ((Sint32) SDL_SwapBE32(src[0])); - Sint32 sample1 = ((Sint32) SDL_SwapBE32(src[1])); - Sint32 sample2 = ((Sint32) SDL_SwapBE32(src[2])); - Sint32 sample3 = ((Sint32) SDL_SwapBE32(src[3])); - Sint32 sample4 = ((Sint32) SDL_SwapBE32(src[4])); - Sint32 sample5 = ((Sint32) SDL_SwapBE32(src[5])); - Sint32 sample6 = ((Sint32) SDL_SwapBE32(src[6])); - Sint32 sample7 = ((Sint32) SDL_SwapBE32(src[7])); - Sint32 last_sample0 = sample0; - Sint32 last_sample1 = sample1; - Sint32 last_sample2 = sample2; - Sint32 last_sample3 = sample3; - Sint32 last_sample4 = sample4; - Sint32 last_sample5 = sample5; - Sint32 last_sample6 = sample6; - Sint32 last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = ((Sint32) SDL_SwapBE32(sample0)); - dst[1] = ((Sint32) SDL_SwapBE32(sample1)); - dst[2] = ((Sint32) SDL_SwapBE32(sample2)); - dst[3] = ((Sint32) SDL_SwapBE32(sample3)); - dst[4] = ((Sint32) SDL_SwapBE32(sample4)); - dst[5] = ((Sint32) SDL_SwapBE32(sample5)); - dst[6] = ((Sint32) SDL_SwapBE32(sample6)); - dst[7] = ((Sint32) SDL_SwapBE32(sample7)); - dst += 8; - sample0 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[0]))) + ((Sint64) last_sample0)) >> 1); - sample1 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[1]))) + ((Sint64) last_sample1)) >> 1); - sample2 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[2]))) + ((Sint64) last_sample2)) >> 1); - sample3 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[3]))) + ((Sint64) last_sample3)) >> 1); - sample4 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[4]))) + ((Sint64) last_sample4)) >> 1); - sample5 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[5]))) + ((Sint64) last_sample5)) >> 1); - sample6 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[6]))) + ((Sint64) last_sample6)) >> 1); - sample7 = (Sint32) ((((Sint64) ((Sint32) SDL_SwapBE32(src[7]))) + ((Sint64) last_sample7)) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 1; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample0 = sample0; - while (dst >= target) { - dst[0] = SDL_SwapFloatLE(sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst++; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[1] = SDL_SwapFloatLE(sample1); - dst[0] = SDL_SwapFloatLE(sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float sample1 = SDL_SwapFloatLE(src[1]); - float last_sample0 = sample0; - float last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst[1] = SDL_SwapFloatLE(sample1); - dst += 2; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[3] = SDL_SwapFloatLE(sample3); - dst[2] = SDL_SwapFloatLE(sample2); - dst[1] = SDL_SwapFloatLE(sample1); - dst[0] = SDL_SwapFloatLE(sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample3 = SDL_SwapFloatLE(src[3]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst[1] = SDL_SwapFloatLE(sample1); - dst[2] = SDL_SwapFloatLE(sample2); - dst[3] = SDL_SwapFloatLE(sample3); - dst += 4; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 6; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - float sample5 = SDL_SwapFloatLE(src[5]); - float sample4 = SDL_SwapFloatLE(src[4]); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample5 = sample5; - float last_sample4 = sample4; - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[5] = SDL_SwapFloatLE(sample5); - dst[4] = SDL_SwapFloatLE(sample4); - dst[3] = SDL_SwapFloatLE(sample3); - dst[2] = SDL_SwapFloatLE(sample2); - dst[1] = SDL_SwapFloatLE(sample1); - dst[0] = SDL_SwapFloatLE(sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample4 = SDL_SwapFloatLE(src[4]); - float sample5 = SDL_SwapFloatLE(src[5]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - float last_sample4 = sample4; - float last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst[1] = SDL_SwapFloatLE(sample1); - dst[2] = SDL_SwapFloatLE(sample2); - dst[3] = SDL_SwapFloatLE(sample3); - dst[4] = SDL_SwapFloatLE(sample4); - dst[5] = SDL_SwapFloatLE(sample5); - dst += 6; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 8; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - float sample7 = SDL_SwapFloatLE(src[7]); - float sample6 = SDL_SwapFloatLE(src[6]); - float sample5 = SDL_SwapFloatLE(src[5]); - float sample4 = SDL_SwapFloatLE(src[4]); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample0 = SDL_SwapFloatLE(src[0]); - float last_sample7 = sample7; - float last_sample6 = sample6; - float last_sample5 = sample5; - float last_sample4 = sample4; - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[7] = SDL_SwapFloatLE(sample7); - dst[6] = SDL_SwapFloatLE(sample6); - dst[5] = SDL_SwapFloatLE(sample5); - dst[4] = SDL_SwapFloatLE(sample4); - dst[3] = SDL_SwapFloatLE(sample3); - dst[2] = SDL_SwapFloatLE(sample2); - dst[1] = SDL_SwapFloatLE(sample1); - dst[0] = SDL_SwapFloatLE(sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (float) ((((double) SDL_SwapFloatLE(src[7])) + ((double) last_sample7)) * 0.5); - sample6 = (float) ((((double) SDL_SwapFloatLE(src[6])) + ((double) last_sample6)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32LSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatLE(src[0]); - float sample1 = SDL_SwapFloatLE(src[1]); - float sample2 = SDL_SwapFloatLE(src[2]); - float sample3 = SDL_SwapFloatLE(src[3]); - float sample4 = SDL_SwapFloatLE(src[4]); - float sample5 = SDL_SwapFloatLE(src[5]); - float sample6 = SDL_SwapFloatLE(src[6]); - float sample7 = SDL_SwapFloatLE(src[7]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - float last_sample4 = sample4; - float last_sample5 = sample5; - float last_sample6 = sample6; - float last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatLE(sample0); - dst[1] = SDL_SwapFloatLE(sample1); - dst[2] = SDL_SwapFloatLE(sample2); - dst[3] = SDL_SwapFloatLE(sample3); - dst[4] = SDL_SwapFloatLE(sample4); - dst[5] = SDL_SwapFloatLE(sample5); - dst[6] = SDL_SwapFloatLE(sample6); - dst[7] = SDL_SwapFloatLE(sample7); - dst += 8; - sample0 = (float) ((((double) SDL_SwapFloatLE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatLE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatLE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatLE(src[3])) + ((double) last_sample3)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatLE(src[4])) + ((double) last_sample4)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatLE(src[5])) + ((double) last_sample5)) * 0.5); - sample6 = (float) ((((double) SDL_SwapFloatLE(src[6])) + ((double) last_sample6)) * 0.5); - sample7 = (float) ((((double) SDL_SwapFloatLE(src[7])) + ((double) last_sample7)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 1; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample0 = sample0; - while (dst >= target) { - dst[0] = SDL_SwapFloatBE(sample0); - dst--; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src--; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_1c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 1 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 64; - const int dstsize = (int) (((double)(cvt->len_cvt/4)) * cvt->rate_incr) * 4; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample0 = sample0; - while (dst < target) { - src++; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst++; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample0 = sample0; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[1] = SDL_SwapFloatBE(sample1); - dst[0] = SDL_SwapFloatBE(sample0); - dst -= 2; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 2; - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_2c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 2 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 128; - const int dstsize = (int) (((double)(cvt->len_cvt/8)) * cvt->rate_incr) * 8; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float sample1 = SDL_SwapFloatBE(src[1]); - float last_sample0 = sample0; - float last_sample1 = sample1; - while (dst < target) { - src += 2; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst[1] = SDL_SwapFloatBE(sample1); - dst += 2; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[3] = SDL_SwapFloatBE(sample3); - dst[2] = SDL_SwapFloatBE(sample2); - dst[1] = SDL_SwapFloatBE(sample1); - dst[0] = SDL_SwapFloatBE(sample0); - dst -= 4; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 4; - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_4c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 4 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 256; - const int dstsize = (int) (((double)(cvt->len_cvt/16)) * cvt->rate_incr) * 16; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample3 = SDL_SwapFloatBE(src[3]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - while (dst < target) { - src += 4; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst[1] = SDL_SwapFloatBE(sample1); - dst[2] = SDL_SwapFloatBE(sample2); - dst[3] = SDL_SwapFloatBE(sample3); - dst += 4; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 6; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - float sample5 = SDL_SwapFloatBE(src[5]); - float sample4 = SDL_SwapFloatBE(src[4]); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample5 = sample5; - float last_sample4 = sample4; - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[5] = SDL_SwapFloatBE(sample5); - dst[4] = SDL_SwapFloatBE(sample4); - dst[3] = SDL_SwapFloatBE(sample3); - dst[2] = SDL_SwapFloatBE(sample2); - dst[1] = SDL_SwapFloatBE(sample1); - dst[0] = SDL_SwapFloatBE(sample0); - dst -= 6; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 6; - sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_6c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 6 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 384; - const int dstsize = (int) (((double)(cvt->len_cvt/24)) * cvt->rate_incr) * 24; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample4 = SDL_SwapFloatBE(src[4]); - float sample5 = SDL_SwapFloatBE(src[5]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - float last_sample4 = sample4; - float last_sample5 = sample5; - while (dst < target) { - src += 6; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst[1] = SDL_SwapFloatBE(sample1); - dst[2] = SDL_SwapFloatBE(sample2); - dst[3] = SDL_SwapFloatBE(sample3); - dst[4] = SDL_SwapFloatBE(sample4); - dst[5] = SDL_SwapFloatBE(sample5); - dst += 6; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample arbitrary (x%f) AUDIO_F32MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - float *dst = ((float *) (cvt->buf + dstsize)) - 8; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - float sample7 = SDL_SwapFloatBE(src[7]); - float sample6 = SDL_SwapFloatBE(src[6]); - float sample5 = SDL_SwapFloatBE(src[5]); - float sample4 = SDL_SwapFloatBE(src[4]); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample0 = SDL_SwapFloatBE(src[0]); - float last_sample7 = sample7; - float last_sample6 = sample6; - float last_sample5 = sample5; - float last_sample4 = sample4; - float last_sample3 = sample3; - float last_sample2 = sample2; - float last_sample1 = sample1; - float last_sample0 = sample0; - while (dst >= target) { - dst[7] = SDL_SwapFloatBE(sample7); - dst[6] = SDL_SwapFloatBE(sample6); - dst[5] = SDL_SwapFloatBE(sample5); - dst[4] = SDL_SwapFloatBE(sample4); - dst[3] = SDL_SwapFloatBE(sample3); - dst[2] = SDL_SwapFloatBE(sample2); - dst[1] = SDL_SwapFloatBE(sample1); - dst[0] = SDL_SwapFloatBE(sample0); - dst -= 8; - eps += srcsize; - if ((eps << 1) >= dstsize) { - src -= 8; - sample7 = (float) ((((double) SDL_SwapFloatBE(src[7])) + ((double) last_sample7)) * 0.5); - sample6 = (float) ((((double) SDL_SwapFloatBE(src[6])) + ((double) last_sample6)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - eps -= dstsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_8c(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample arbitrary (x%f) AUDIO_F32MSB, 8 channels.\n", cvt->rate_incr); -#endif - - const int srcsize = cvt->len_cvt - 512; - const int dstsize = (int) (((double)(cvt->len_cvt/32)) * cvt->rate_incr) * 32; - register int eps = 0; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - float sample0 = SDL_SwapFloatBE(src[0]); - float sample1 = SDL_SwapFloatBE(src[1]); - float sample2 = SDL_SwapFloatBE(src[2]); - float sample3 = SDL_SwapFloatBE(src[3]); - float sample4 = SDL_SwapFloatBE(src[4]); - float sample5 = SDL_SwapFloatBE(src[5]); - float sample6 = SDL_SwapFloatBE(src[6]); - float sample7 = SDL_SwapFloatBE(src[7]); - float last_sample0 = sample0; - float last_sample1 = sample1; - float last_sample2 = sample2; - float last_sample3 = sample3; - float last_sample4 = sample4; - float last_sample5 = sample5; - float last_sample6 = sample6; - float last_sample7 = sample7; - while (dst < target) { - src += 8; - eps += dstsize; - if ((eps << 1) >= srcsize) { - dst[0] = SDL_SwapFloatBE(sample0); - dst[1] = SDL_SwapFloatBE(sample1); - dst[2] = SDL_SwapFloatBE(sample2); - dst[3] = SDL_SwapFloatBE(sample3); - dst[4] = SDL_SwapFloatBE(sample4); - dst[5] = SDL_SwapFloatBE(sample5); - dst[6] = SDL_SwapFloatBE(sample6); - dst[7] = SDL_SwapFloatBE(sample7); - dst += 8; - sample0 = (float) ((((double) SDL_SwapFloatBE(src[0])) + ((double) last_sample0)) * 0.5); - sample1 = (float) ((((double) SDL_SwapFloatBE(src[1])) + ((double) last_sample1)) * 0.5); - sample2 = (float) ((((double) SDL_SwapFloatBE(src[2])) + ((double) last_sample2)) * 0.5); - sample3 = (float) ((((double) SDL_SwapFloatBE(src[3])) + ((double) last_sample3)) * 0.5); - sample4 = (float) ((((double) SDL_SwapFloatBE(src[4])) + ((double) last_sample4)) * 0.5); - sample5 = (float) ((((double) SDL_SwapFloatBE(src[5])) + ((double) last_sample5)) * 0.5); - sample6 = (float) ((((double) SDL_SwapFloatBE(src[6])) + ((double) last_sample6)) * 0.5); - sample7 = (float) ((((double) SDL_SwapFloatBE(src[7])) + ((double) last_sample7)) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - eps -= srcsize; - } - } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - - -#if !LESS_RESAMPLERS - -static void SDLCALL -SDL_Upsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample0 = (Sint16) src[0]; - src--; - dst[1] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[0] = (Uint8) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - src += 2; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 1 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample0 = (Sint16) src[0]; - src--; - dst[3] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Uint8) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - src += 4; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 2; - dst[3] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - src += 4; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 2 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 2; - dst[7] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - src += 8; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 4; - dst[7] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[6] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[5] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - src += 8; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 4 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 4; - dst[15] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint8) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Uint8) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - src += 16; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 6; - dst[11] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[10] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[9] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[8] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[7] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[6] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[5] = (Uint8) sample5; - dst[4] = (Uint8) sample4; - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample5 = (Sint16) src[5]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample5 = (Sint16) src[5]; - src += 12; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint8) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 6 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 6; - dst[23] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[16] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[15] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[14] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[13] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[12] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[11] = (Uint8) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Uint8) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Uint8) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Uint8) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Uint8) sample5; - dst[4] = (Uint8) sample4; - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample5 = (Sint16) src[5]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample5 = (Sint16) src[5]; - src += 24; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint8) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8 * 2; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample7 = (Sint16) src[7]; - Sint16 last_sample6 = (Sint16) src[6]; - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample7 = (Sint16) src[7]; - const Sint16 sample6 = (Sint16) src[6]; - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 8; - dst[15] = (Uint8) ((sample7 + last_sample7) >> 1); - dst[14] = (Uint8) ((sample6 + last_sample6) >> 1); - dst[13] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[12] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[11] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint8) sample7; - dst[6] = (Uint8) sample6; - dst[5] = (Uint8) sample5; - dst[4] = (Uint8) sample4; - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample6 = (Sint16) src[6]; - Sint16 last_sample7 = (Sint16) src[7]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample6 = (Sint16) src[6]; - const Sint16 sample7 = (Sint16) src[7]; - src += 16; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint8) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint8) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint8 *dst = ((Uint8 *) (cvt->buf + dstsize)) - 8 * 4; - const Uint8 *src = ((Uint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint8 *target = ((const Uint8 *) cvt->buf); - Sint16 last_sample7 = (Sint16) src[7]; - Sint16 last_sample6 = (Sint16) src[6]; - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample0 = (Sint16) src[0]; - while (dst >= target) { - const Sint16 sample7 = (Sint16) src[7]; - const Sint16 sample6 = (Sint16) src[6]; - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample0 = (Sint16) src[0]; - src -= 8; - dst[31] = (Uint8) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Uint8) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Uint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Uint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Uint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Uint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Uint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Uint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Uint8) ((sample7 + last_sample7) >> 1); - dst[22] = (Uint8) ((sample6 + last_sample6) >> 1); - dst[21] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[20] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[19] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[18] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[17] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[16] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[15] = (Uint8) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Uint8) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Uint8) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Uint8) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Uint8) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Uint8) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Uint8) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Uint8) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Uint8) sample7; - dst[6] = (Uint8) sample6; - dst[5] = (Uint8) sample5; - dst[4] = (Uint8) sample4; - dst[3] = (Uint8) sample3; - dst[2] = (Uint8) sample2; - dst[1] = (Uint8) sample1; - dst[0] = (Uint8) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint8 *dst = (Uint8 *) cvt->buf; - const Uint8 *src = (Uint8 *) cvt->buf; - const Uint8 *target = (const Uint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) src[0]; - Sint16 last_sample1 = (Sint16) src[1]; - Sint16 last_sample2 = (Sint16) src[2]; - Sint16 last_sample3 = (Sint16) src[3]; - Sint16 last_sample4 = (Sint16) src[4]; - Sint16 last_sample5 = (Sint16) src[5]; - Sint16 last_sample6 = (Sint16) src[6]; - Sint16 last_sample7 = (Sint16) src[7]; - while (dst < target) { - const Sint16 sample0 = (Sint16) src[0]; - const Sint16 sample1 = (Sint16) src[1]; - const Sint16 sample2 = (Sint16) src[2]; - const Sint16 sample3 = (Sint16) src[3]; - const Sint16 sample4 = (Sint16) src[4]; - const Sint16 sample5 = (Sint16) src[5]; - const Sint16 sample6 = (Sint16) src[6]; - const Sint16 sample7 = (Sint16) src[7]; - src += 32; - dst[0] = (Uint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint8) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint8) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint8) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src--; - dst[1] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint8) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src += 2; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src--; - dst[3] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint8) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src += 4; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 2; - dst[3] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - src += 4; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 2; - dst[7] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - src += 8; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 4; - dst[7] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - src += 8; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 4; - dst[15] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint8) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint8) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - src += 16; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 6; - dst[11] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint8) sample5; - dst[4] = (Sint8) sample4; - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - src += 12; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint8) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 6; - dst[23] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint8) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint8) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint8) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint8) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint8) sample5; - dst[4] = (Sint8) sample4; - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - src += 24; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint8) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample7 = (Sint16) ((Sint8) src[7]); - Sint16 last_sample6 = (Sint16) ((Sint8) src[6]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample7 = (Sint16) ((Sint8) src[7]); - const Sint16 sample6 = (Sint16) ((Sint8) src[6]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 8; - dst[15] = (Sint8) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint8) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint8) sample7; - dst[6] = (Sint8) sample6; - dst[5] = (Sint8) sample5; - dst[4] = (Sint8) sample4; - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample6 = (Sint16) ((Sint8) src[6]); - Sint16 last_sample7 = (Sint16) ((Sint8) src[7]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample6 = (Sint16) ((Sint8) src[6]); - const Sint16 sample7 = (Sint16) ((Sint8) src[7]); - src += 16; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint8) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint8) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint8 *dst = ((Sint8 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint8 *src = ((Sint8 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint8 *target = ((const Sint8 *) cvt->buf); - Sint16 last_sample7 = (Sint16) ((Sint8) src[7]); - Sint16 last_sample6 = (Sint16) ((Sint8) src[6]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - while (dst >= target) { - const Sint16 sample7 = (Sint16) ((Sint8) src[7]); - const Sint16 sample6 = (Sint16) ((Sint8) src[6]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - src -= 8; - dst[31] = (Sint8) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint8) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint8) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint8) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint8) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint8) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint8) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint8) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint8) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint8) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint8) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint8) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint8) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint8) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint8) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint8) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint8) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint8) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint8) sample7; - dst[6] = (Sint8) sample6; - dst[5] = (Sint8) sample5; - dst[4] = (Sint8) sample4; - dst[3] = (Sint8) sample3; - dst[2] = (Sint8) sample2; - dst[1] = (Sint8) sample1; - dst[0] = (Sint8) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S8_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S8, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint8 *dst = (Sint8 *) cvt->buf; - const Sint8 *src = (Sint8 *) cvt->buf; - const Sint8 *target = (const Sint8 *) (cvt->buf + dstsize); - Sint16 last_sample0 = (Sint16) ((Sint8) src[0]); - Sint16 last_sample1 = (Sint16) ((Sint8) src[1]); - Sint16 last_sample2 = (Sint16) ((Sint8) src[2]); - Sint16 last_sample3 = (Sint16) ((Sint8) src[3]); - Sint16 last_sample4 = (Sint16) ((Sint8) src[4]); - Sint16 last_sample5 = (Sint16) ((Sint8) src[5]); - Sint16 last_sample6 = (Sint16) ((Sint8) src[6]); - Sint16 last_sample7 = (Sint16) ((Sint8) src[7]); - while (dst < target) { - const Sint16 sample0 = (Sint16) ((Sint8) src[0]); - const Sint16 sample1 = (Sint16) ((Sint8) src[1]); - const Sint16 sample2 = (Sint16) ((Sint8) src[2]); - const Sint16 sample3 = (Sint16) ((Sint8) src[3]); - const Sint16 sample4 = (Sint16) ((Sint8) src[4]); - const Sint16 sample5 = (Sint16) ((Sint8) src[5]); - const Sint16 sample6 = (Sint16) ((Sint8) src[6]); - const Sint16 sample7 = (Sint16) ((Sint8) src[7]); - src += 32; - dst[0] = (Sint8) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint8) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint8) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint8) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint8) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint8) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint8) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint8) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src--; - dst[1] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Uint16) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src += 2; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src--; - dst[3] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Uint16) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src += 4; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 2; - dst[3] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - src += 4; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 2; - dst[7] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - src += 8; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 4; - dst[7] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - src += 8; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 4; - dst[15] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - src += 16; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 6; - dst[11] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - src += 12; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 6; - dst[23] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[16] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[15] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[14] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[13] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[12] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[11] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - src += 24; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]); - Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]); - const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 8; - dst[15] = (Uint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint16) sample7; - dst[6] = (Uint16) sample6; - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]); - Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]); - const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]); - src += 16; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]); - Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - while (dst >= target) { - const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]); - const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - src -= 8; - dst[31] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Uint16) ((sample7 + last_sample7) >> 1); - dst[22] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[21] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[20] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[19] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[18] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[17] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[16] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[15] = (Uint16) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Uint16) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Uint16) sample7; - dst[6] = (Uint16) sample6; - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapLE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapLE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapLE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapLE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapLE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapLE16(src[5]); - Sint32 last_sample6 = (Sint32) SDL_SwapLE16(src[6]); - Sint32 last_sample7 = (Sint32) SDL_SwapLE16(src[7]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapLE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapLE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapLE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapLE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapLE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapLE16(src[5]); - const Sint32 sample6 = (Sint32) SDL_SwapLE16(src[6]); - const Sint32 sample7 = (Sint32) SDL_SwapLE16(src[7]); - src += 32; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src--; - dst[1] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint16) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src += 2; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src--; - dst[3] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint16) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src += 4; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 2; - dst[3] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - src += 4; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 2; - dst[7] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - src += 8; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 4; - dst[7] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - src += 8; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 4; - dst[15] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - src += 16; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 6; - dst[11] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - src += 12; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 6; - dst[23] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - src += 24; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 8; - dst[15] = (Sint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint16) sample7; - dst[6] = (Sint16) sample6; - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - src += 16; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - while (dst >= target) { - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - src -= 8; - dst[31] = (Sint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint16) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint16) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint16) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint16) sample7; - dst[6] = (Sint16) sample6; - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapLE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapLE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapLE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapLE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapLE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapLE16(src[5])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapLE16(src[6])); - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapLE16(src[7])); - src += 32; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src--; - dst[1] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Uint16) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src += 2; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 1 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src--; - dst[3] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Uint16) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src += 4; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 2; - dst[3] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - src += 4; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 2 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 2; - dst[7] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - src += 8; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 4; - dst[7] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - src += 8; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 4 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 4; - dst[15] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - src += 16; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 6; - dst[11] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - src += 12; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 6 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 6; - dst[23] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[16] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[15] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[14] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[13] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[12] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[11] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - src += 24; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_U16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 2; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]); - Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]); - const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 8; - dst[15] = (Uint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Uint16) sample7; - dst[6] = (Uint16) sample6; - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_U16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]); - Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]); - const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]); - src += 16; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_U16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_U16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Uint16 *dst = ((Uint16 *) (cvt->buf + dstsize)) - 8 * 4; - const Uint16 *src = ((Uint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Uint16 *target = ((const Uint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]); - Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - while (dst >= target) { - const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]); - const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - src -= 8; - dst[31] = (Uint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Uint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Uint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Uint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Uint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Uint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Uint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Uint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Uint16) ((sample7 + last_sample7) >> 1); - dst[22] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[21] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[20] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[19] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[18] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[17] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[16] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[15] = (Uint16) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Uint16) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Uint16) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Uint16) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Uint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Uint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Uint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Uint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Uint16) sample7; - dst[6] = (Uint16) sample6; - dst[5] = (Uint16) sample5; - dst[4] = (Uint16) sample4; - dst[3] = (Uint16) sample3; - dst[2] = (Uint16) sample2; - dst[1] = (Uint16) sample1; - dst[0] = (Uint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_U16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_U16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Uint16 *dst = (Uint16 *) cvt->buf; - const Uint16 *src = (Uint16 *) cvt->buf; - const Uint16 *target = (const Uint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) SDL_SwapBE16(src[0]); - Sint32 last_sample1 = (Sint32) SDL_SwapBE16(src[1]); - Sint32 last_sample2 = (Sint32) SDL_SwapBE16(src[2]); - Sint32 last_sample3 = (Sint32) SDL_SwapBE16(src[3]); - Sint32 last_sample4 = (Sint32) SDL_SwapBE16(src[4]); - Sint32 last_sample5 = (Sint32) SDL_SwapBE16(src[5]); - Sint32 last_sample6 = (Sint32) SDL_SwapBE16(src[6]); - Sint32 last_sample7 = (Sint32) SDL_SwapBE16(src[7]); - while (dst < target) { - const Sint32 sample0 = (Sint32) SDL_SwapBE16(src[0]); - const Sint32 sample1 = (Sint32) SDL_SwapBE16(src[1]); - const Sint32 sample2 = (Sint32) SDL_SwapBE16(src[2]); - const Sint32 sample3 = (Sint32) SDL_SwapBE16(src[3]); - const Sint32 sample4 = (Sint32) SDL_SwapBE16(src[4]); - const Sint32 sample5 = (Sint32) SDL_SwapBE16(src[5]); - const Sint32 sample6 = (Sint32) SDL_SwapBE16(src[6]); - const Sint32 sample7 = (Sint32) SDL_SwapBE16(src[7]); - src += 32; - dst[0] = (Uint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Uint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Uint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Uint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Uint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Uint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Uint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Uint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src--; - dst[1] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint16) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src += 2; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src--; - dst[3] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint16) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src += 4; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 2; - dst[3] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - src += 4; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 2; - dst[7] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - src += 8; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 4; - dst[7] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - src += 8; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 4; - dst[15] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - src += 16; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 6; - dst[11] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - src += 12; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 6; - dst[23] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - src += 24; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 8; - dst[15] = (Sint16) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint16) sample7; - dst[6] = (Sint16) sample6; - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - src += 16; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint16 *dst = ((Sint16 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint16 *src = ((Sint16 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint16 *target = ((const Sint16 *) cvt->buf); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - while (dst >= target) { - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - src -= 8; - dst[31] = (Sint16) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint16) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint16) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint16) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint16) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint16) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint16) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint16) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint16) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint16) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint16) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint16) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint16) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint16) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint16) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint16) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint16) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint16) sample7; - dst[6] = (Sint16) sample6; - dst[5] = (Sint16) sample5; - dst[4] = (Sint16) sample4; - dst[3] = (Sint16) sample3; - dst[2] = (Sint16) sample2; - dst[1] = (Sint16) sample1; - dst[0] = (Sint16) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S16MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S16MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint16 *dst = (Sint16 *) cvt->buf; - const Sint16 *src = (Sint16 *) cvt->buf; - const Sint16 *target = (const Sint16 *) (cvt->buf + dstsize); - Sint32 last_sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - Sint32 last_sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - Sint32 last_sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - Sint32 last_sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - Sint32 last_sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - Sint32 last_sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - Sint32 last_sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - Sint32 last_sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - while (dst < target) { - const Sint32 sample0 = (Sint32) ((Sint16) SDL_SwapBE16(src[0])); - const Sint32 sample1 = (Sint32) ((Sint16) SDL_SwapBE16(src[1])); - const Sint32 sample2 = (Sint32) ((Sint16) SDL_SwapBE16(src[2])); - const Sint32 sample3 = (Sint32) ((Sint16) SDL_SwapBE16(src[3])); - const Sint32 sample4 = (Sint32) ((Sint16) SDL_SwapBE16(src[4])); - const Sint32 sample5 = (Sint32) ((Sint16) SDL_SwapBE16(src[5])); - const Sint32 sample6 = (Sint32) ((Sint16) SDL_SwapBE16(src[6])); - const Sint32 sample7 = (Sint32) ((Sint16) SDL_SwapBE16(src[7])); - src += 32; - dst[0] = (Sint16) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint16) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint16) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint16) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint16) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint16) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint16) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint16) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src--; - dst[1] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint32) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src += 2; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src--; - dst[3] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint32) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src += 4; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 2; - dst[3] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - src += 4; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 2; - dst[7] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - src += 8; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 4; - dst[7] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - src += 8; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 4; - dst[15] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - src += 16; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 6; - dst[11] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - src += 12; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 6; - dst[23] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - src += 24; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 8; - dst[15] = (Sint32) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint32) sample7; - dst[6] = (Sint32) sample6; - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - src += 16; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint32) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - while (dst >= target) { - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - src -= 8; - dst[31] = (Sint32) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint32) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint32) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint32) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint32) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint32) sample7; - dst[6] = (Sint32) sample6; - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapLE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapLE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapLE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapLE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapLE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapLE32(src[5])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapLE32(src[6])); - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapLE32(src[7])); - src += 32; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint32) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src--; - dst[1] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[0] = (Sint32) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src += 2; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 1 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 1; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src--; - dst[3] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[0] = (Sint32) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src += 4; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 2; - dst[3] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - src += 4; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 2 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 2; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 2; - dst[7] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[6] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[2] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - src += 8; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 4; - dst[7] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[6] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[5] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[4] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - src += 8; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 4 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 4; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 4; - dst[15] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[14] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[13] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[12] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[6] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[5] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[4] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - src += 16; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 6; - dst[11] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[10] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[9] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[8] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[7] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[6] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - src += 12; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 6 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 6; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 6; - dst[23] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[22] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[21] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[20] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[19] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[18] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[17] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[16] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[15] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[14] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[13] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[12] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[11] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[10] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[9] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[8] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[7] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[6] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - src += 24; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_S32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 2; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 8; - dst[15] = (Sint32) ((sample7 + last_sample7) >> 1); - dst[14] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[13] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[12] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[11] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[10] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[9] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[8] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[7] = (Sint32) sample7; - dst[6] = (Sint32) sample6; - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_S32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - src += 16; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint32) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_S32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_S32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - Sint32 *dst = ((Sint32 *) (cvt->buf + dstsize)) - 8 * 4; - const Sint32 *src = ((Sint32 *) (cvt->buf + cvt->len_cvt)) - 8; - const Sint32 *target = ((const Sint32 *) cvt->buf); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - while (dst >= target) { - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - src -= 8; - dst[31] = (Sint32) ((sample7 + (3 * last_sample7)) >> 2); - dst[30] = (Sint32) ((sample6 + (3 * last_sample6)) >> 2); - dst[29] = (Sint32) ((sample5 + (3 * last_sample5)) >> 2); - dst[28] = (Sint32) ((sample4 + (3 * last_sample4)) >> 2); - dst[27] = (Sint32) ((sample3 + (3 * last_sample3)) >> 2); - dst[26] = (Sint32) ((sample2 + (3 * last_sample2)) >> 2); - dst[25] = (Sint32) ((sample1 + (3 * last_sample1)) >> 2); - dst[24] = (Sint32) ((sample0 + (3 * last_sample0)) >> 2); - dst[23] = (Sint32) ((sample7 + last_sample7) >> 1); - dst[22] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[21] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[20] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[19] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[18] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[17] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[16] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[15] = (Sint32) (((3 * sample7) + last_sample7) >> 2); - dst[14] = (Sint32) (((3 * sample6) + last_sample6) >> 2); - dst[13] = (Sint32) (((3 * sample5) + last_sample5) >> 2); - dst[12] = (Sint32) (((3 * sample4) + last_sample4) >> 2); - dst[11] = (Sint32) (((3 * sample3) + last_sample3) >> 2); - dst[10] = (Sint32) (((3 * sample2) + last_sample2) >> 2); - dst[9] = (Sint32) (((3 * sample1) + last_sample1) >> 2); - dst[8] = (Sint32) (((3 * sample0) + last_sample0) >> 2); - dst[7] = (Sint32) sample7; - dst[6] = (Sint32) sample6; - dst[5] = (Sint32) sample5; - dst[4] = (Sint32) sample4; - dst[3] = (Sint32) sample3; - dst[2] = (Sint32) sample2; - dst[1] = (Sint32) sample1; - dst[0] = (Sint32) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_S32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_S32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - Sint32 *dst = (Sint32 *) cvt->buf; - const Sint32 *src = (Sint32 *) cvt->buf; - const Sint32 *target = (const Sint32 *) (cvt->buf + dstsize); - Sint64 last_sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - Sint64 last_sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - Sint64 last_sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - Sint64 last_sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - Sint64 last_sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - Sint64 last_sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - Sint64 last_sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - Sint64 last_sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - while (dst < target) { - const Sint64 sample0 = (Sint64) ((Sint32) SDL_SwapBE32(src[0])); - const Sint64 sample1 = (Sint64) ((Sint32) SDL_SwapBE32(src[1])); - const Sint64 sample2 = (Sint64) ((Sint32) SDL_SwapBE32(src[2])); - const Sint64 sample3 = (Sint64) ((Sint32) SDL_SwapBE32(src[3])); - const Sint64 sample4 = (Sint64) ((Sint32) SDL_SwapBE32(src[4])); - const Sint64 sample5 = (Sint64) ((Sint32) SDL_SwapBE32(src[5])); - const Sint64 sample6 = (Sint64) ((Sint32) SDL_SwapBE32(src[6])); - const Sint64 sample7 = (Sint64) ((Sint32) SDL_SwapBE32(src[7])); - src += 32; - dst[0] = (Sint32) ((sample0 + last_sample0) >> 1); - dst[1] = (Sint32) ((sample1 + last_sample1) >> 1); - dst[2] = (Sint32) ((sample2 + last_sample2) >> 1); - dst[3] = (Sint32) ((sample3 + last_sample3) >> 1); - dst[4] = (Sint32) ((sample4 + last_sample4) >> 1); - dst[5] = (Sint32) ((sample5 + last_sample5) >> 1); - dst[6] = (Sint32) ((sample6 + last_sample6) >> 1); - dst[7] = (Sint32) ((sample7 + last_sample7) >> 1); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src--; - dst[1] = (float) ((sample0 + last_sample0) * 0.5); - dst[0] = (float) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src += 2; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src--; - dst[3] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[2] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[0] = (float) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src += 4; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 2; - dst[3] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - src += 4; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 2; - dst[7] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[6] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[5] = (float) ((sample1 + last_sample1) * 0.5); - dst[4] = (float) ((sample0 + last_sample0) * 0.5); - dst[3] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[2] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - src += 8; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 4; - dst[7] = (float) ((sample3 + last_sample3) * 0.5); - dst[6] = (float) ((sample2 + last_sample2) * 0.5); - dst[5] = (float) ((sample1 + last_sample1) * 0.5); - dst[4] = (float) ((sample0 + last_sample0) * 0.5); - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - src += 8; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 4; - dst[15] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[14] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[13] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[12] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[11] = (float) ((sample3 + last_sample3) * 0.5); - dst[10] = (float) ((sample2 + last_sample2) * 0.5); - dst[9] = (float) ((sample1 + last_sample1) * 0.5); - dst[8] = (float) ((sample0 + last_sample0) * 0.5); - dst[7] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[6] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[5] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[4] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - src += 16; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 6; - dst[11] = (float) ((sample5 + last_sample5) * 0.5); - dst[10] = (float) ((sample4 + last_sample4) * 0.5); - dst[9] = (float) ((sample3 + last_sample3) * 0.5); - dst[8] = (float) ((sample2 + last_sample2) * 0.5); - dst[7] = (float) ((sample1 + last_sample1) * 0.5); - dst[6] = (float) ((sample0 + last_sample0) * 0.5); - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - src += 12; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 6; - dst[23] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[22] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[21] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[20] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[19] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[18] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[17] = (float) ((sample5 + last_sample5) * 0.5); - dst[16] = (float) ((sample4 + last_sample4) * 0.5); - dst[15] = (float) ((sample3 + last_sample3) * 0.5); - dst[14] = (float) ((sample2 + last_sample2) * 0.5); - dst[13] = (float) ((sample1 + last_sample1) * 0.5); - dst[12] = (float) ((sample0 + last_sample0) * 0.5); - dst[11] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[10] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[9] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[8] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[7] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[6] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - src += 24; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - double last_sample7 = (double) SDL_SwapFloatLE(src[7]); - double last_sample6 = (double) SDL_SwapFloatLE(src[6]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample7 = (double) SDL_SwapFloatLE(src[7]); - const double sample6 = (double) SDL_SwapFloatLE(src[6]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 8; - dst[15] = (float) ((sample7 + last_sample7) * 0.5); - dst[14] = (float) ((sample6 + last_sample6) * 0.5); - dst[13] = (float) ((sample5 + last_sample5) * 0.5); - dst[12] = (float) ((sample4 + last_sample4) * 0.5); - dst[11] = (float) ((sample3 + last_sample3) * 0.5); - dst[10] = (float) ((sample2 + last_sample2) * 0.5); - dst[9] = (float) ((sample1 + last_sample1) * 0.5); - dst[8] = (float) ((sample0 + last_sample0) * 0.5); - dst[7] = (float) sample7; - dst[6] = (float) sample6; - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample6 = (double) SDL_SwapFloatLE(src[6]); - double last_sample7 = (double) SDL_SwapFloatLE(src[7]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample6 = (double) SDL_SwapFloatLE(src[6]); - const double sample7 = (double) SDL_SwapFloatLE(src[7]); - src += 16; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - dst[6] = (float) ((sample6 + last_sample6) * 0.5); - dst[7] = (float) ((sample7 + last_sample7) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - double last_sample7 = (double) SDL_SwapFloatLE(src[7]); - double last_sample6 = (double) SDL_SwapFloatLE(src[6]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - while (dst >= target) { - const double sample7 = (double) SDL_SwapFloatLE(src[7]); - const double sample6 = (double) SDL_SwapFloatLE(src[6]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - src -= 8; - dst[31] = (float) ((sample7 + (3.0 * last_sample7)) * 0.25); - dst[30] = (float) ((sample6 + (3.0 * last_sample6)) * 0.25); - dst[29] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[28] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[27] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[26] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[25] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[24] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[23] = (float) ((sample7 + last_sample7) * 0.5); - dst[22] = (float) ((sample6 + last_sample6) * 0.5); - dst[21] = (float) ((sample5 + last_sample5) * 0.5); - dst[20] = (float) ((sample4 + last_sample4) * 0.5); - dst[19] = (float) ((sample3 + last_sample3) * 0.5); - dst[18] = (float) ((sample2 + last_sample2) * 0.5); - dst[17] = (float) ((sample1 + last_sample1) * 0.5); - dst[16] = (float) ((sample0 + last_sample0) * 0.5); - dst[15] = (float) (((3.0 * sample7) + last_sample7) * 0.25); - dst[14] = (float) (((3.0 * sample6) + last_sample6) * 0.25); - dst[13] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[12] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[11] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[10] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[9] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[8] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[7] = (float) sample7; - dst[6] = (float) sample6; - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32LSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32LSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatLE(src[0]); - double last_sample1 = (double) SDL_SwapFloatLE(src[1]); - double last_sample2 = (double) SDL_SwapFloatLE(src[2]); - double last_sample3 = (double) SDL_SwapFloatLE(src[3]); - double last_sample4 = (double) SDL_SwapFloatLE(src[4]); - double last_sample5 = (double) SDL_SwapFloatLE(src[5]); - double last_sample6 = (double) SDL_SwapFloatLE(src[6]); - double last_sample7 = (double) SDL_SwapFloatLE(src[7]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatLE(src[0]); - const double sample1 = (double) SDL_SwapFloatLE(src[1]); - const double sample2 = (double) SDL_SwapFloatLE(src[2]); - const double sample3 = (double) SDL_SwapFloatLE(src[3]); - const double sample4 = (double) SDL_SwapFloatLE(src[4]); - const double sample5 = (double) SDL_SwapFloatLE(src[5]); - const double sample6 = (double) SDL_SwapFloatLE(src[6]); - const double sample7 = (double) SDL_SwapFloatLE(src[7]); - src += 32; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - dst[6] = (float) ((sample6 + last_sample6) * 0.5); - dst[7] = (float) ((sample7 + last_sample7) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src--; - dst[1] = (float) ((sample0 + last_sample0) * 0.5); - dst[0] = (float) sample0; - last_sample0 = sample0; - dst -= 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_1c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src += 2; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 1 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 1; - const float *target = ((const float *) cvt->buf); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src--; - dst[3] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[2] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[0] = (float) sample0; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_1c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 1 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src += 4; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - last_sample0 = sample0; - dst++; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 2; - dst[3] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_2c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - src += 4; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 2 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 2; - const float *target = ((const float *) cvt->buf); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 2; - dst[7] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[6] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[5] = (float) ((sample1 + last_sample1) * 0.5); - dst[4] = (float) ((sample0 + last_sample0) * 0.5); - dst[3] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[2] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_2c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 2 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - src += 8; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - dst += 2; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 4; - dst[7] = (float) ((sample3 + last_sample3) * 0.5); - dst[6] = (float) ((sample2 + last_sample2) * 0.5); - dst[5] = (float) ((sample1 + last_sample1) * 0.5); - dst[4] = (float) ((sample0 + last_sample0) * 0.5); - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 8; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_4c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - src += 8; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 4 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 4; - const float *target = ((const float *) cvt->buf); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 4; - dst[15] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[14] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[13] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[12] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[11] = (float) ((sample3 + last_sample3) * 0.5); - dst[10] = (float) ((sample2 + last_sample2) * 0.5); - dst[9] = (float) ((sample1 + last_sample1) * 0.5); - dst[8] = (float) ((sample0 + last_sample0) * 0.5); - dst[7] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[6] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[5] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[4] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_4c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 4 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - src += 16; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - dst += 4; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 6; - dst[11] = (float) ((sample5 + last_sample5) * 0.5); - dst[10] = (float) ((sample4 + last_sample4) * 0.5); - dst[9] = (float) ((sample3 + last_sample3) * 0.5); - dst[8] = (float) ((sample2 + last_sample2) * 0.5); - dst[7] = (float) ((sample1 + last_sample1) * 0.5); - dst[6] = (float) ((sample0 + last_sample0) * 0.5); - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 12; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} -static void SDLCALL -SDL_Downsample_F32MSB_6c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - src += 12; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Upsample_F32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 6 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 6 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 6; - const float *target = ((const float *) cvt->buf); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 6; - dst[23] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[22] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[21] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[20] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[19] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[18] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[17] = (float) ((sample5 + last_sample5) * 0.5); - dst[16] = (float) ((sample4 + last_sample4) * 0.5); - dst[15] = (float) ((sample3 + last_sample3) * 0.5); - dst[14] = (float) ((sample2 + last_sample2) * 0.5); - dst[13] = (float) ((sample1 + last_sample1) * 0.5); - dst[12] = (float) ((sample0 + last_sample0) * 0.5); - dst[11] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[10] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[9] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[8] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[7] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[6] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 24; + /* Finish off any leftovers with scalar operations. */ + while (i) { + *dst = (Sint32) (((double) *src) * 2147483647.0); + i--; src++; dst++; } - cvt->len_cvt = dstsize; if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); + cvt->filters[cvt->filter_index](cvt, AUDIO_S32SYS); } } - -static void SDLCALL -SDL_Downsample_F32MSB_6c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 6 channels.\n"); #endif - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - src += 24; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - dst += 6; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} -static void SDLCALL -SDL_Upsample_F32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) +void SDL_ChooseAudioConverters(void) { -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x2) AUDIO_F32MSB, 8 channels.\n"); -#endif + static SDL_bool converters_chosen = SDL_FALSE; - const int dstsize = cvt->len_cvt * 2; - float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 2; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - double last_sample7 = (double) SDL_SwapFloatBE(src[7]); - double last_sample6 = (double) SDL_SwapFloatBE(src[6]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample7 = (double) SDL_SwapFloatBE(src[7]); - const double sample6 = (double) SDL_SwapFloatBE(src[6]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 8; - dst[15] = (float) ((sample7 + last_sample7) * 0.5); - dst[14] = (float) ((sample6 + last_sample6) * 0.5); - dst[13] = (float) ((sample5 + last_sample5) * 0.5); - dst[12] = (float) ((sample4 + last_sample4) * 0.5); - dst[11] = (float) ((sample3 + last_sample3) * 0.5); - dst[10] = (float) ((sample2 + last_sample2) * 0.5); - dst[9] = (float) ((sample1 + last_sample1) * 0.5); - dst[8] = (float) ((sample0 + last_sample0) * 0.5); - dst[7] = (float) sample7; - dst[6] = (float) sample6; - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 16; + if (converters_chosen) { + return; } - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_8c_x2(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x2) AUDIO_F32MSB, 8 channels.\n"); -#endif - - const int dstsize = cvt->len_cvt / 2; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample6 = (double) SDL_SwapFloatBE(src[6]); - double last_sample7 = (double) SDL_SwapFloatBE(src[7]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample6 = (double) SDL_SwapFloatBE(src[6]); - const double sample7 = (double) SDL_SwapFloatBE(src[7]); - src += 16; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - dst[6] = (float) ((sample6 + last_sample6) * 0.5); - dst[7] = (float) ((sample7 + last_sample7) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } +#define SET_CONVERTER_FUNCS(fntype) \ + SDL_Convert_S8_to_F32 = SDL_Convert_S8_to_F32_##fntype; \ + SDL_Convert_U8_to_F32 = SDL_Convert_U8_to_F32_##fntype; \ + SDL_Convert_S16_to_F32 = SDL_Convert_S16_to_F32_##fntype; \ + SDL_Convert_U16_to_F32 = SDL_Convert_U16_to_F32_##fntype; \ + SDL_Convert_S32_to_F32 = SDL_Convert_S32_to_F32_##fntype; \ + SDL_Convert_F32_to_S8 = SDL_Convert_F32_to_S8_##fntype; \ + SDL_Convert_F32_to_U8 = SDL_Convert_F32_to_U8_##fntype; \ + SDL_Convert_F32_to_S16 = SDL_Convert_F32_to_S16_##fntype; \ + SDL_Convert_F32_to_U16 = SDL_Convert_F32_to_U16_##fntype; \ + SDL_Convert_F32_to_S32 = SDL_Convert_F32_to_S32_##fntype; \ + converters_chosen = SDL_TRUE - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); +#if HAVE_SSE2_INTRINSICS + if (SDL_HasSSE2()) { + SET_CONVERTER_FUNCS(SSE2); + return; } -} - -static void SDLCALL -SDL_Upsample_F32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Upsample (x4) AUDIO_F32MSB, 8 channels.\n"); #endif - const int dstsize = cvt->len_cvt * 4; - float *dst = ((float *) (cvt->buf + dstsize)) - 8 * 4; - const float *src = ((float *) (cvt->buf + cvt->len_cvt)) - 8; - const float *target = ((const float *) cvt->buf); - double last_sample7 = (double) SDL_SwapFloatBE(src[7]); - double last_sample6 = (double) SDL_SwapFloatBE(src[6]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - while (dst >= target) { - const double sample7 = (double) SDL_SwapFloatBE(src[7]); - const double sample6 = (double) SDL_SwapFloatBE(src[6]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - src -= 8; - dst[31] = (float) ((sample7 + (3.0 * last_sample7)) * 0.25); - dst[30] = (float) ((sample6 + (3.0 * last_sample6)) * 0.25); - dst[29] = (float) ((sample5 + (3.0 * last_sample5)) * 0.25); - dst[28] = (float) ((sample4 + (3.0 * last_sample4)) * 0.25); - dst[27] = (float) ((sample3 + (3.0 * last_sample3)) * 0.25); - dst[26] = (float) ((sample2 + (3.0 * last_sample2)) * 0.25); - dst[25] = (float) ((sample1 + (3.0 * last_sample1)) * 0.25); - dst[24] = (float) ((sample0 + (3.0 * last_sample0)) * 0.25); - dst[23] = (float) ((sample7 + last_sample7) * 0.5); - dst[22] = (float) ((sample6 + last_sample6) * 0.5); - dst[21] = (float) ((sample5 + last_sample5) * 0.5); - dst[20] = (float) ((sample4 + last_sample4) * 0.5); - dst[19] = (float) ((sample3 + last_sample3) * 0.5); - dst[18] = (float) ((sample2 + last_sample2) * 0.5); - dst[17] = (float) ((sample1 + last_sample1) * 0.5); - dst[16] = (float) ((sample0 + last_sample0) * 0.5); - dst[15] = (float) (((3.0 * sample7) + last_sample7) * 0.25); - dst[14] = (float) (((3.0 * sample6) + last_sample6) * 0.25); - dst[13] = (float) (((3.0 * sample5) + last_sample5) * 0.25); - dst[12] = (float) (((3.0 * sample4) + last_sample4) * 0.25); - dst[11] = (float) (((3.0 * sample3) + last_sample3) * 0.25); - dst[10] = (float) (((3.0 * sample2) + last_sample2) * 0.25); - dst[9] = (float) (((3.0 * sample1) + last_sample1) * 0.25); - dst[8] = (float) (((3.0 * sample0) + last_sample0) * 0.25); - dst[7] = (float) sample7; - dst[6] = (float) sample6; - dst[5] = (float) sample5; - dst[4] = (float) sample4; - dst[3] = (float) sample3; - dst[2] = (float) sample2; - dst[1] = (float) sample1; - dst[0] = (float) sample0; - last_sample7 = sample7; - last_sample6 = sample6; - last_sample5 = sample5; - last_sample4 = sample4; - last_sample3 = sample3; - last_sample2 = sample2; - last_sample1 = sample1; - last_sample0 = sample0; - dst -= 32; - } - - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -static void SDLCALL -SDL_Downsample_F32MSB_8c_x4(SDL_AudioCVT * cvt, SDL_AudioFormat format) -{ -#if DEBUG_CONVERT - fprintf(stderr, "Downsample (x4) AUDIO_F32MSB, 8 channels.\n"); +#if NEED_SCALAR_CONVERTER_FALLBACKS + SET_CONVERTER_FUNCS(Scalar); #endif - const int dstsize = cvt->len_cvt / 4; - float *dst = (float *) cvt->buf; - const float *src = (float *) cvt->buf; - const float *target = (const float *) (cvt->buf + dstsize); - double last_sample0 = (double) SDL_SwapFloatBE(src[0]); - double last_sample1 = (double) SDL_SwapFloatBE(src[1]); - double last_sample2 = (double) SDL_SwapFloatBE(src[2]); - double last_sample3 = (double) SDL_SwapFloatBE(src[3]); - double last_sample4 = (double) SDL_SwapFloatBE(src[4]); - double last_sample5 = (double) SDL_SwapFloatBE(src[5]); - double last_sample6 = (double) SDL_SwapFloatBE(src[6]); - double last_sample7 = (double) SDL_SwapFloatBE(src[7]); - while (dst < target) { - const double sample0 = (double) SDL_SwapFloatBE(src[0]); - const double sample1 = (double) SDL_SwapFloatBE(src[1]); - const double sample2 = (double) SDL_SwapFloatBE(src[2]); - const double sample3 = (double) SDL_SwapFloatBE(src[3]); - const double sample4 = (double) SDL_SwapFloatBE(src[4]); - const double sample5 = (double) SDL_SwapFloatBE(src[5]); - const double sample6 = (double) SDL_SwapFloatBE(src[6]); - const double sample7 = (double) SDL_SwapFloatBE(src[7]); - src += 32; - dst[0] = (float) ((sample0 + last_sample0) * 0.5); - dst[1] = (float) ((sample1 + last_sample1) * 0.5); - dst[2] = (float) ((sample2 + last_sample2) * 0.5); - dst[3] = (float) ((sample3 + last_sample3) * 0.5); - dst[4] = (float) ((sample4 + last_sample4) * 0.5); - dst[5] = (float) ((sample5 + last_sample5) * 0.5); - dst[6] = (float) ((sample6 + last_sample6) * 0.5); - dst[7] = (float) ((sample7 + last_sample7) * 0.5); - last_sample0 = sample0; - last_sample1 = sample1; - last_sample2 = sample2; - last_sample3 = sample3; - last_sample4 = sample4; - last_sample5 = sample5; - last_sample6 = sample6; - last_sample7 = sample7; - dst += 8; - } +#undef SET_CONVERTER_FUNCS - cvt->len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } + SDL_assert(converters_chosen == SDL_TRUE); } -#endif /* !LESS_RESAMPLERS */ -#endif /* !NO_RESAMPLERS */ - - -const SDL_AudioRateFilters sdl_audio_rate_filters[] = -{ -#if !NO_RESAMPLERS - { AUDIO_U8, 1, 0, 0, SDL_Downsample_U8_1c }, - { AUDIO_U8, 1, 1, 0, SDL_Upsample_U8_1c }, - { AUDIO_U8, 2, 0, 0, SDL_Downsample_U8_2c }, - { AUDIO_U8, 2, 1, 0, SDL_Upsample_U8_2c }, - { AUDIO_U8, 4, 0, 0, SDL_Downsample_U8_4c }, - { AUDIO_U8, 4, 1, 0, SDL_Upsample_U8_4c }, - { AUDIO_U8, 6, 0, 0, SDL_Downsample_U8_6c }, - { AUDIO_U8, 6, 1, 0, SDL_Upsample_U8_6c }, - { AUDIO_U8, 8, 0, 0, SDL_Downsample_U8_8c }, - { AUDIO_U8, 8, 1, 0, SDL_Upsample_U8_8c }, - { AUDIO_S8, 1, 0, 0, SDL_Downsample_S8_1c }, - { AUDIO_S8, 1, 1, 0, SDL_Upsample_S8_1c }, - { AUDIO_S8, 2, 0, 0, SDL_Downsample_S8_2c }, - { AUDIO_S8, 2, 1, 0, SDL_Upsample_S8_2c }, - { AUDIO_S8, 4, 0, 0, SDL_Downsample_S8_4c }, - { AUDIO_S8, 4, 1, 0, SDL_Upsample_S8_4c }, - { AUDIO_S8, 6, 0, 0, SDL_Downsample_S8_6c }, - { AUDIO_S8, 6, 1, 0, SDL_Upsample_S8_6c }, - { AUDIO_S8, 8, 0, 0, SDL_Downsample_S8_8c }, - { AUDIO_S8, 8, 1, 0, SDL_Upsample_S8_8c }, - { AUDIO_U16LSB, 1, 0, 0, SDL_Downsample_U16LSB_1c }, - { AUDIO_U16LSB, 1, 1, 0, SDL_Upsample_U16LSB_1c }, - { AUDIO_U16LSB, 2, 0, 0, SDL_Downsample_U16LSB_2c }, - { AUDIO_U16LSB, 2, 1, 0, SDL_Upsample_U16LSB_2c }, - { AUDIO_U16LSB, 4, 0, 0, SDL_Downsample_U16LSB_4c }, - { AUDIO_U16LSB, 4, 1, 0, SDL_Upsample_U16LSB_4c }, - { AUDIO_U16LSB, 6, 0, 0, SDL_Downsample_U16LSB_6c }, - { AUDIO_U16LSB, 6, 1, 0, SDL_Upsample_U16LSB_6c }, - { AUDIO_U16LSB, 8, 0, 0, SDL_Downsample_U16LSB_8c }, - { AUDIO_U16LSB, 8, 1, 0, SDL_Upsample_U16LSB_8c }, - { AUDIO_S16LSB, 1, 0, 0, SDL_Downsample_S16LSB_1c }, - { AUDIO_S16LSB, 1, 1, 0, SDL_Upsample_S16LSB_1c }, - { AUDIO_S16LSB, 2, 0, 0, SDL_Downsample_S16LSB_2c }, - { AUDIO_S16LSB, 2, 1, 0, SDL_Upsample_S16LSB_2c }, - { AUDIO_S16LSB, 4, 0, 0, SDL_Downsample_S16LSB_4c }, - { AUDIO_S16LSB, 4, 1, 0, SDL_Upsample_S16LSB_4c }, - { AUDIO_S16LSB, 6, 0, 0, SDL_Downsample_S16LSB_6c }, - { AUDIO_S16LSB, 6, 1, 0, SDL_Upsample_S16LSB_6c }, - { AUDIO_S16LSB, 8, 0, 0, SDL_Downsample_S16LSB_8c }, - { AUDIO_S16LSB, 8, 1, 0, SDL_Upsample_S16LSB_8c }, - { AUDIO_U16MSB, 1, 0, 0, SDL_Downsample_U16MSB_1c }, - { AUDIO_U16MSB, 1, 1, 0, SDL_Upsample_U16MSB_1c }, - { AUDIO_U16MSB, 2, 0, 0, SDL_Downsample_U16MSB_2c }, - { AUDIO_U16MSB, 2, 1, 0, SDL_Upsample_U16MSB_2c }, - { AUDIO_U16MSB, 4, 0, 0, SDL_Downsample_U16MSB_4c }, - { AUDIO_U16MSB, 4, 1, 0, SDL_Upsample_U16MSB_4c }, - { AUDIO_U16MSB, 6, 0, 0, SDL_Downsample_U16MSB_6c }, - { AUDIO_U16MSB, 6, 1, 0, SDL_Upsample_U16MSB_6c }, - { AUDIO_U16MSB, 8, 0, 0, SDL_Downsample_U16MSB_8c }, - { AUDIO_U16MSB, 8, 1, 0, SDL_Upsample_U16MSB_8c }, - { AUDIO_S16MSB, 1, 0, 0, SDL_Downsample_S16MSB_1c }, - { AUDIO_S16MSB, 1, 1, 0, SDL_Upsample_S16MSB_1c }, - { AUDIO_S16MSB, 2, 0, 0, SDL_Downsample_S16MSB_2c }, - { AUDIO_S16MSB, 2, 1, 0, SDL_Upsample_S16MSB_2c }, - { AUDIO_S16MSB, 4, 0, 0, SDL_Downsample_S16MSB_4c }, - { AUDIO_S16MSB, 4, 1, 0, SDL_Upsample_S16MSB_4c }, - { AUDIO_S16MSB, 6, 0, 0, SDL_Downsample_S16MSB_6c }, - { AUDIO_S16MSB, 6, 1, 0, SDL_Upsample_S16MSB_6c }, - { AUDIO_S16MSB, 8, 0, 0, SDL_Downsample_S16MSB_8c }, - { AUDIO_S16MSB, 8, 1, 0, SDL_Upsample_S16MSB_8c }, - { AUDIO_S32LSB, 1, 0, 0, SDL_Downsample_S32LSB_1c }, - { AUDIO_S32LSB, 1, 1, 0, SDL_Upsample_S32LSB_1c }, - { AUDIO_S32LSB, 2, 0, 0, SDL_Downsample_S32LSB_2c }, - { AUDIO_S32LSB, 2, 1, 0, SDL_Upsample_S32LSB_2c }, - { AUDIO_S32LSB, 4, 0, 0, SDL_Downsample_S32LSB_4c }, - { AUDIO_S32LSB, 4, 1, 0, SDL_Upsample_S32LSB_4c }, - { AUDIO_S32LSB, 6, 0, 0, SDL_Downsample_S32LSB_6c }, - { AUDIO_S32LSB, 6, 1, 0, SDL_Upsample_S32LSB_6c }, - { AUDIO_S32LSB, 8, 0, 0, SDL_Downsample_S32LSB_8c }, - { AUDIO_S32LSB, 8, 1, 0, SDL_Upsample_S32LSB_8c }, - { AUDIO_S32MSB, 1, 0, 0, SDL_Downsample_S32MSB_1c }, - { AUDIO_S32MSB, 1, 1, 0, SDL_Upsample_S32MSB_1c }, - { AUDIO_S32MSB, 2, 0, 0, SDL_Downsample_S32MSB_2c }, - { AUDIO_S32MSB, 2, 1, 0, SDL_Upsample_S32MSB_2c }, - { AUDIO_S32MSB, 4, 0, 0, SDL_Downsample_S32MSB_4c }, - { AUDIO_S32MSB, 4, 1, 0, SDL_Upsample_S32MSB_4c }, - { AUDIO_S32MSB, 6, 0, 0, SDL_Downsample_S32MSB_6c }, - { AUDIO_S32MSB, 6, 1, 0, SDL_Upsample_S32MSB_6c }, - { AUDIO_S32MSB, 8, 0, 0, SDL_Downsample_S32MSB_8c }, - { AUDIO_S32MSB, 8, 1, 0, SDL_Upsample_S32MSB_8c }, - { AUDIO_F32LSB, 1, 0, 0, SDL_Downsample_F32LSB_1c }, - { AUDIO_F32LSB, 1, 1, 0, SDL_Upsample_F32LSB_1c }, - { AUDIO_F32LSB, 2, 0, 0, SDL_Downsample_F32LSB_2c }, - { AUDIO_F32LSB, 2, 1, 0, SDL_Upsample_F32LSB_2c }, - { AUDIO_F32LSB, 4, 0, 0, SDL_Downsample_F32LSB_4c }, - { AUDIO_F32LSB, 4, 1, 0, SDL_Upsample_F32LSB_4c }, - { AUDIO_F32LSB, 6, 0, 0, SDL_Downsample_F32LSB_6c }, - { AUDIO_F32LSB, 6, 1, 0, SDL_Upsample_F32LSB_6c }, - { AUDIO_F32LSB, 8, 0, 0, SDL_Downsample_F32LSB_8c }, - { AUDIO_F32LSB, 8, 1, 0, SDL_Upsample_F32LSB_8c }, - { AUDIO_F32MSB, 1, 0, 0, SDL_Downsample_F32MSB_1c }, - { AUDIO_F32MSB, 1, 1, 0, SDL_Upsample_F32MSB_1c }, - { AUDIO_F32MSB, 2, 0, 0, SDL_Downsample_F32MSB_2c }, - { AUDIO_F32MSB, 2, 1, 0, SDL_Upsample_F32MSB_2c }, - { AUDIO_F32MSB, 4, 0, 0, SDL_Downsample_F32MSB_4c }, - { AUDIO_F32MSB, 4, 1, 0, SDL_Upsample_F32MSB_4c }, - { AUDIO_F32MSB, 6, 0, 0, SDL_Downsample_F32MSB_6c }, - { AUDIO_F32MSB, 6, 1, 0, SDL_Upsample_F32MSB_6c }, - { AUDIO_F32MSB, 8, 0, 0, SDL_Downsample_F32MSB_8c }, - { AUDIO_F32MSB, 8, 1, 0, SDL_Upsample_F32MSB_8c }, -#if !LESS_RESAMPLERS - { AUDIO_U8, 1, 0, 2, SDL_Downsample_U8_1c_x2 }, - { AUDIO_U8, 1, 1, 2, SDL_Upsample_U8_1c_x2 }, - { AUDIO_U8, 1, 0, 4, SDL_Downsample_U8_1c_x4 }, - { AUDIO_U8, 1, 1, 4, SDL_Upsample_U8_1c_x4 }, - { AUDIO_U8, 2, 0, 2, SDL_Downsample_U8_2c_x2 }, - { AUDIO_U8, 2, 1, 2, SDL_Upsample_U8_2c_x2 }, - { AUDIO_U8, 2, 0, 4, SDL_Downsample_U8_2c_x4 }, - { AUDIO_U8, 2, 1, 4, SDL_Upsample_U8_2c_x4 }, - { AUDIO_U8, 4, 0, 2, SDL_Downsample_U8_4c_x2 }, - { AUDIO_U8, 4, 1, 2, SDL_Upsample_U8_4c_x2 }, - { AUDIO_U8, 4, 0, 4, SDL_Downsample_U8_4c_x4 }, - { AUDIO_U8, 4, 1, 4, SDL_Upsample_U8_4c_x4 }, - { AUDIO_U8, 6, 0, 2, SDL_Downsample_U8_6c_x2 }, - { AUDIO_U8, 6, 1, 2, SDL_Upsample_U8_6c_x2 }, - { AUDIO_U8, 6, 0, 4, SDL_Downsample_U8_6c_x4 }, - { AUDIO_U8, 6, 1, 4, SDL_Upsample_U8_6c_x4 }, - { AUDIO_U8, 8, 0, 2, SDL_Downsample_U8_8c_x2 }, - { AUDIO_U8, 8, 1, 2, SDL_Upsample_U8_8c_x2 }, - { AUDIO_U8, 8, 0, 4, SDL_Downsample_U8_8c_x4 }, - { AUDIO_U8, 8, 1, 4, SDL_Upsample_U8_8c_x4 }, - { AUDIO_S8, 1, 0, 2, SDL_Downsample_S8_1c_x2 }, - { AUDIO_S8, 1, 1, 2, SDL_Upsample_S8_1c_x2 }, - { AUDIO_S8, 1, 0, 4, SDL_Downsample_S8_1c_x4 }, - { AUDIO_S8, 1, 1, 4, SDL_Upsample_S8_1c_x4 }, - { AUDIO_S8, 2, 0, 2, SDL_Downsample_S8_2c_x2 }, - { AUDIO_S8, 2, 1, 2, SDL_Upsample_S8_2c_x2 }, - { AUDIO_S8, 2, 0, 4, SDL_Downsample_S8_2c_x4 }, - { AUDIO_S8, 2, 1, 4, SDL_Upsample_S8_2c_x4 }, - { AUDIO_S8, 4, 0, 2, SDL_Downsample_S8_4c_x2 }, - { AUDIO_S8, 4, 1, 2, SDL_Upsample_S8_4c_x2 }, - { AUDIO_S8, 4, 0, 4, SDL_Downsample_S8_4c_x4 }, - { AUDIO_S8, 4, 1, 4, SDL_Upsample_S8_4c_x4 }, - { AUDIO_S8, 6, 0, 2, SDL_Downsample_S8_6c_x2 }, - { AUDIO_S8, 6, 1, 2, SDL_Upsample_S8_6c_x2 }, - { AUDIO_S8, 6, 0, 4, SDL_Downsample_S8_6c_x4 }, - { AUDIO_S8, 6, 1, 4, SDL_Upsample_S8_6c_x4 }, - { AUDIO_S8, 8, 0, 2, SDL_Downsample_S8_8c_x2 }, - { AUDIO_S8, 8, 1, 2, SDL_Upsample_S8_8c_x2 }, - { AUDIO_S8, 8, 0, 4, SDL_Downsample_S8_8c_x4 }, - { AUDIO_S8, 8, 1, 4, SDL_Upsample_S8_8c_x4 }, - { AUDIO_U16LSB, 1, 0, 2, SDL_Downsample_U16LSB_1c_x2 }, - { AUDIO_U16LSB, 1, 1, 2, SDL_Upsample_U16LSB_1c_x2 }, - { AUDIO_U16LSB, 1, 0, 4, SDL_Downsample_U16LSB_1c_x4 }, - { AUDIO_U16LSB, 1, 1, 4, SDL_Upsample_U16LSB_1c_x4 }, - { AUDIO_U16LSB, 2, 0, 2, SDL_Downsample_U16LSB_2c_x2 }, - { AUDIO_U16LSB, 2, 1, 2, SDL_Upsample_U16LSB_2c_x2 }, - { AUDIO_U16LSB, 2, 0, 4, SDL_Downsample_U16LSB_2c_x4 }, - { AUDIO_U16LSB, 2, 1, 4, SDL_Upsample_U16LSB_2c_x4 }, - { AUDIO_U16LSB, 4, 0, 2, SDL_Downsample_U16LSB_4c_x2 }, - { AUDIO_U16LSB, 4, 1, 2, SDL_Upsample_U16LSB_4c_x2 }, - { AUDIO_U16LSB, 4, 0, 4, SDL_Downsample_U16LSB_4c_x4 }, - { AUDIO_U16LSB, 4, 1, 4, SDL_Upsample_U16LSB_4c_x4 }, - { AUDIO_U16LSB, 6, 0, 2, SDL_Downsample_U16LSB_6c_x2 }, - { AUDIO_U16LSB, 6, 1, 2, SDL_Upsample_U16LSB_6c_x2 }, - { AUDIO_U16LSB, 6, 0, 4, SDL_Downsample_U16LSB_6c_x4 }, - { AUDIO_U16LSB, 6, 1, 4, SDL_Upsample_U16LSB_6c_x4 }, - { AUDIO_U16LSB, 8, 0, 2, SDL_Downsample_U16LSB_8c_x2 }, - { AUDIO_U16LSB, 8, 1, 2, SDL_Upsample_U16LSB_8c_x2 }, - { AUDIO_U16LSB, 8, 0, 4, SDL_Downsample_U16LSB_8c_x4 }, - { AUDIO_U16LSB, 8, 1, 4, SDL_Upsample_U16LSB_8c_x4 }, - { AUDIO_S16LSB, 1, 0, 2, SDL_Downsample_S16LSB_1c_x2 }, - { AUDIO_S16LSB, 1, 1, 2, SDL_Upsample_S16LSB_1c_x2 }, - { AUDIO_S16LSB, 1, 0, 4, SDL_Downsample_S16LSB_1c_x4 }, - { AUDIO_S16LSB, 1, 1, 4, SDL_Upsample_S16LSB_1c_x4 }, - { AUDIO_S16LSB, 2, 0, 2, SDL_Downsample_S16LSB_2c_x2 }, - { AUDIO_S16LSB, 2, 1, 2, SDL_Upsample_S16LSB_2c_x2 }, - { AUDIO_S16LSB, 2, 0, 4, SDL_Downsample_S16LSB_2c_x4 }, - { AUDIO_S16LSB, 2, 1, 4, SDL_Upsample_S16LSB_2c_x4 }, - { AUDIO_S16LSB, 4, 0, 2, SDL_Downsample_S16LSB_4c_x2 }, - { AUDIO_S16LSB, 4, 1, 2, SDL_Upsample_S16LSB_4c_x2 }, - { AUDIO_S16LSB, 4, 0, 4, SDL_Downsample_S16LSB_4c_x4 }, - { AUDIO_S16LSB, 4, 1, 4, SDL_Upsample_S16LSB_4c_x4 }, - { AUDIO_S16LSB, 6, 0, 2, SDL_Downsample_S16LSB_6c_x2 }, - { AUDIO_S16LSB, 6, 1, 2, SDL_Upsample_S16LSB_6c_x2 }, - { AUDIO_S16LSB, 6, 0, 4, SDL_Downsample_S16LSB_6c_x4 }, - { AUDIO_S16LSB, 6, 1, 4, SDL_Upsample_S16LSB_6c_x4 }, - { AUDIO_S16LSB, 8, 0, 2, SDL_Downsample_S16LSB_8c_x2 }, - { AUDIO_S16LSB, 8, 1, 2, SDL_Upsample_S16LSB_8c_x2 }, - { AUDIO_S16LSB, 8, 0, 4, SDL_Downsample_S16LSB_8c_x4 }, - { AUDIO_S16LSB, 8, 1, 4, SDL_Upsample_S16LSB_8c_x4 }, - { AUDIO_U16MSB, 1, 0, 2, SDL_Downsample_U16MSB_1c_x2 }, - { AUDIO_U16MSB, 1, 1, 2, SDL_Upsample_U16MSB_1c_x2 }, - { AUDIO_U16MSB, 1, 0, 4, SDL_Downsample_U16MSB_1c_x4 }, - { AUDIO_U16MSB, 1, 1, 4, SDL_Upsample_U16MSB_1c_x4 }, - { AUDIO_U16MSB, 2, 0, 2, SDL_Downsample_U16MSB_2c_x2 }, - { AUDIO_U16MSB, 2, 1, 2, SDL_Upsample_U16MSB_2c_x2 }, - { AUDIO_U16MSB, 2, 0, 4, SDL_Downsample_U16MSB_2c_x4 }, - { AUDIO_U16MSB, 2, 1, 4, SDL_Upsample_U16MSB_2c_x4 }, - { AUDIO_U16MSB, 4, 0, 2, SDL_Downsample_U16MSB_4c_x2 }, - { AUDIO_U16MSB, 4, 1, 2, SDL_Upsample_U16MSB_4c_x2 }, - { AUDIO_U16MSB, 4, 0, 4, SDL_Downsample_U16MSB_4c_x4 }, - { AUDIO_U16MSB, 4, 1, 4, SDL_Upsample_U16MSB_4c_x4 }, - { AUDIO_U16MSB, 6, 0, 2, SDL_Downsample_U16MSB_6c_x2 }, - { AUDIO_U16MSB, 6, 1, 2, SDL_Upsample_U16MSB_6c_x2 }, - { AUDIO_U16MSB, 6, 0, 4, SDL_Downsample_U16MSB_6c_x4 }, - { AUDIO_U16MSB, 6, 1, 4, SDL_Upsample_U16MSB_6c_x4 }, - { AUDIO_U16MSB, 8, 0, 2, SDL_Downsample_U16MSB_8c_x2 }, - { AUDIO_U16MSB, 8, 1, 2, SDL_Upsample_U16MSB_8c_x2 }, - { AUDIO_U16MSB, 8, 0, 4, SDL_Downsample_U16MSB_8c_x4 }, - { AUDIO_U16MSB, 8, 1, 4, SDL_Upsample_U16MSB_8c_x4 }, - { AUDIO_S16MSB, 1, 0, 2, SDL_Downsample_S16MSB_1c_x2 }, - { AUDIO_S16MSB, 1, 1, 2, SDL_Upsample_S16MSB_1c_x2 }, - { AUDIO_S16MSB, 1, 0, 4, SDL_Downsample_S16MSB_1c_x4 }, - { AUDIO_S16MSB, 1, 1, 4, SDL_Upsample_S16MSB_1c_x4 }, - { AUDIO_S16MSB, 2, 0, 2, SDL_Downsample_S16MSB_2c_x2 }, - { AUDIO_S16MSB, 2, 1, 2, SDL_Upsample_S16MSB_2c_x2 }, - { AUDIO_S16MSB, 2, 0, 4, SDL_Downsample_S16MSB_2c_x4 }, - { AUDIO_S16MSB, 2, 1, 4, SDL_Upsample_S16MSB_2c_x4 }, - { AUDIO_S16MSB, 4, 0, 2, SDL_Downsample_S16MSB_4c_x2 }, - { AUDIO_S16MSB, 4, 1, 2, SDL_Upsample_S16MSB_4c_x2 }, - { AUDIO_S16MSB, 4, 0, 4, SDL_Downsample_S16MSB_4c_x4 }, - { AUDIO_S16MSB, 4, 1, 4, SDL_Upsample_S16MSB_4c_x4 }, - { AUDIO_S16MSB, 6, 0, 2, SDL_Downsample_S16MSB_6c_x2 }, - { AUDIO_S16MSB, 6, 1, 2, SDL_Upsample_S16MSB_6c_x2 }, - { AUDIO_S16MSB, 6, 0, 4, SDL_Downsample_S16MSB_6c_x4 }, - { AUDIO_S16MSB, 6, 1, 4, SDL_Upsample_S16MSB_6c_x4 }, - { AUDIO_S16MSB, 8, 0, 2, SDL_Downsample_S16MSB_8c_x2 }, - { AUDIO_S16MSB, 8, 1, 2, SDL_Upsample_S16MSB_8c_x2 }, - { AUDIO_S16MSB, 8, 0, 4, SDL_Downsample_S16MSB_8c_x4 }, - { AUDIO_S16MSB, 8, 1, 4, SDL_Upsample_S16MSB_8c_x4 }, - { AUDIO_S32LSB, 1, 0, 2, SDL_Downsample_S32LSB_1c_x2 }, - { AUDIO_S32LSB, 1, 1, 2, SDL_Upsample_S32LSB_1c_x2 }, - { AUDIO_S32LSB, 1, 0, 4, SDL_Downsample_S32LSB_1c_x4 }, - { AUDIO_S32LSB, 1, 1, 4, SDL_Upsample_S32LSB_1c_x4 }, - { AUDIO_S32LSB, 2, 0, 2, SDL_Downsample_S32LSB_2c_x2 }, - { AUDIO_S32LSB, 2, 1, 2, SDL_Upsample_S32LSB_2c_x2 }, - { AUDIO_S32LSB, 2, 0, 4, SDL_Downsample_S32LSB_2c_x4 }, - { AUDIO_S32LSB, 2, 1, 4, SDL_Upsample_S32LSB_2c_x4 }, - { AUDIO_S32LSB, 4, 0, 2, SDL_Downsample_S32LSB_4c_x2 }, - { AUDIO_S32LSB, 4, 1, 2, SDL_Upsample_S32LSB_4c_x2 }, - { AUDIO_S32LSB, 4, 0, 4, SDL_Downsample_S32LSB_4c_x4 }, - { AUDIO_S32LSB, 4, 1, 4, SDL_Upsample_S32LSB_4c_x4 }, - { AUDIO_S32LSB, 6, 0, 2, SDL_Downsample_S32LSB_6c_x2 }, - { AUDIO_S32LSB, 6, 1, 2, SDL_Upsample_S32LSB_6c_x2 }, - { AUDIO_S32LSB, 6, 0, 4, SDL_Downsample_S32LSB_6c_x4 }, - { AUDIO_S32LSB, 6, 1, 4, SDL_Upsample_S32LSB_6c_x4 }, - { AUDIO_S32LSB, 8, 0, 2, SDL_Downsample_S32LSB_8c_x2 }, - { AUDIO_S32LSB, 8, 1, 2, SDL_Upsample_S32LSB_8c_x2 }, - { AUDIO_S32LSB, 8, 0, 4, SDL_Downsample_S32LSB_8c_x4 }, - { AUDIO_S32LSB, 8, 1, 4, SDL_Upsample_S32LSB_8c_x4 }, - { AUDIO_S32MSB, 1, 0, 2, SDL_Downsample_S32MSB_1c_x2 }, - { AUDIO_S32MSB, 1, 1, 2, SDL_Upsample_S32MSB_1c_x2 }, - { AUDIO_S32MSB, 1, 0, 4, SDL_Downsample_S32MSB_1c_x4 }, - { AUDIO_S32MSB, 1, 1, 4, SDL_Upsample_S32MSB_1c_x4 }, - { AUDIO_S32MSB, 2, 0, 2, SDL_Downsample_S32MSB_2c_x2 }, - { AUDIO_S32MSB, 2, 1, 2, SDL_Upsample_S32MSB_2c_x2 }, - { AUDIO_S32MSB, 2, 0, 4, SDL_Downsample_S32MSB_2c_x4 }, - { AUDIO_S32MSB, 2, 1, 4, SDL_Upsample_S32MSB_2c_x4 }, - { AUDIO_S32MSB, 4, 0, 2, SDL_Downsample_S32MSB_4c_x2 }, - { AUDIO_S32MSB, 4, 1, 2, SDL_Upsample_S32MSB_4c_x2 }, - { AUDIO_S32MSB, 4, 0, 4, SDL_Downsample_S32MSB_4c_x4 }, - { AUDIO_S32MSB, 4, 1, 4, SDL_Upsample_S32MSB_4c_x4 }, - { AUDIO_S32MSB, 6, 0, 2, SDL_Downsample_S32MSB_6c_x2 }, - { AUDIO_S32MSB, 6, 1, 2, SDL_Upsample_S32MSB_6c_x2 }, - { AUDIO_S32MSB, 6, 0, 4, SDL_Downsample_S32MSB_6c_x4 }, - { AUDIO_S32MSB, 6, 1, 4, SDL_Upsample_S32MSB_6c_x4 }, - { AUDIO_S32MSB, 8, 0, 2, SDL_Downsample_S32MSB_8c_x2 }, - { AUDIO_S32MSB, 8, 1, 2, SDL_Upsample_S32MSB_8c_x2 }, - { AUDIO_S32MSB, 8, 0, 4, SDL_Downsample_S32MSB_8c_x4 }, - { AUDIO_S32MSB, 8, 1, 4, SDL_Upsample_S32MSB_8c_x4 }, - { AUDIO_F32LSB, 1, 0, 2, SDL_Downsample_F32LSB_1c_x2 }, - { AUDIO_F32LSB, 1, 1, 2, SDL_Upsample_F32LSB_1c_x2 }, - { AUDIO_F32LSB, 1, 0, 4, SDL_Downsample_F32LSB_1c_x4 }, - { AUDIO_F32LSB, 1, 1, 4, SDL_Upsample_F32LSB_1c_x4 }, - { AUDIO_F32LSB, 2, 0, 2, SDL_Downsample_F32LSB_2c_x2 }, - { AUDIO_F32LSB, 2, 1, 2, SDL_Upsample_F32LSB_2c_x2 }, - { AUDIO_F32LSB, 2, 0, 4, SDL_Downsample_F32LSB_2c_x4 }, - { AUDIO_F32LSB, 2, 1, 4, SDL_Upsample_F32LSB_2c_x4 }, - { AUDIO_F32LSB, 4, 0, 2, SDL_Downsample_F32LSB_4c_x2 }, - { AUDIO_F32LSB, 4, 1, 2, SDL_Upsample_F32LSB_4c_x2 }, - { AUDIO_F32LSB, 4, 0, 4, SDL_Downsample_F32LSB_4c_x4 }, - { AUDIO_F32LSB, 4, 1, 4, SDL_Upsample_F32LSB_4c_x4 }, - { AUDIO_F32LSB, 6, 0, 2, SDL_Downsample_F32LSB_6c_x2 }, - { AUDIO_F32LSB, 6, 1, 2, SDL_Upsample_F32LSB_6c_x2 }, - { AUDIO_F32LSB, 6, 0, 4, SDL_Downsample_F32LSB_6c_x4 }, - { AUDIO_F32LSB, 6, 1, 4, SDL_Upsample_F32LSB_6c_x4 }, - { AUDIO_F32LSB, 8, 0, 2, SDL_Downsample_F32LSB_8c_x2 }, - { AUDIO_F32LSB, 8, 1, 2, SDL_Upsample_F32LSB_8c_x2 }, - { AUDIO_F32LSB, 8, 0, 4, SDL_Downsample_F32LSB_8c_x4 }, - { AUDIO_F32LSB, 8, 1, 4, SDL_Upsample_F32LSB_8c_x4 }, - { AUDIO_F32MSB, 1, 0, 2, SDL_Downsample_F32MSB_1c_x2 }, - { AUDIO_F32MSB, 1, 1, 2, SDL_Upsample_F32MSB_1c_x2 }, - { AUDIO_F32MSB, 1, 0, 4, SDL_Downsample_F32MSB_1c_x4 }, - { AUDIO_F32MSB, 1, 1, 4, SDL_Upsample_F32MSB_1c_x4 }, - { AUDIO_F32MSB, 2, 0, 2, SDL_Downsample_F32MSB_2c_x2 }, - { AUDIO_F32MSB, 2, 1, 2, SDL_Upsample_F32MSB_2c_x2 }, - { AUDIO_F32MSB, 2, 0, 4, SDL_Downsample_F32MSB_2c_x4 }, - { AUDIO_F32MSB, 2, 1, 4, SDL_Upsample_F32MSB_2c_x4 }, - { AUDIO_F32MSB, 4, 0, 2, SDL_Downsample_F32MSB_4c_x2 }, - { AUDIO_F32MSB, 4, 1, 2, SDL_Upsample_F32MSB_4c_x2 }, - { AUDIO_F32MSB, 4, 0, 4, SDL_Downsample_F32MSB_4c_x4 }, - { AUDIO_F32MSB, 4, 1, 4, SDL_Upsample_F32MSB_4c_x4 }, - { AUDIO_F32MSB, 6, 0, 2, SDL_Downsample_F32MSB_6c_x2 }, - { AUDIO_F32MSB, 6, 1, 2, SDL_Upsample_F32MSB_6c_x2 }, - { AUDIO_F32MSB, 6, 0, 4, SDL_Downsample_F32MSB_6c_x4 }, - { AUDIO_F32MSB, 6, 1, 4, SDL_Upsample_F32MSB_6c_x4 }, - { AUDIO_F32MSB, 8, 0, 2, SDL_Downsample_F32MSB_8c_x2 }, - { AUDIO_F32MSB, 8, 1, 2, SDL_Upsample_F32MSB_8c_x2 }, - { AUDIO_F32MSB, 8, 0, 4, SDL_Downsample_F32MSB_8c_x4 }, - { AUDIO_F32MSB, 8, 1, 4, SDL_Upsample_F32MSB_8c_x4 }, -#endif /* !LESS_RESAMPLERS */ -#endif /* !NO_RESAMPLERS */ - { 0, 0, 0, 0, NULL } -}; - -/* 390 converters generated. */ - -/* *INDENT-ON* */ - /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/SDL_mixer.c b/Engine/lib/sdl/src/audio/SDL_mixer.c index e0219392d..d416a94c2 100644 --- a/Engine/lib/sdl/src/audio/SDL_mixer.c +++ b/Engine/lib/sdl/src/audio/SDL_mixer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/audio/SDL_sysaudio.h b/Engine/lib/sdl/src/audio/SDL_sysaudio.h index 943169bf7..f0e1f3dad 100644 --- a/Engine/lib/sdl/src/audio/SDL_sysaudio.h +++ b/Engine/lib/sdl/src/audio/SDL_sysaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,11 +20,13 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_sysaudio_h -#define _SDL_sysaudio_h +#ifndef SDL_sysaudio_h_ +#define SDL_sysaudio_h_ #include "SDL_mutex.h" #include "SDL_thread.h" +#include "../SDL_dataqueue.h" +#include "./SDL_audio_c.h" /* !!! FIXME: These are wordy and unlocalized... */ #define DEFAULT_OUTPUT_DEVNAME "System audio output device" @@ -49,7 +51,6 @@ extern void SDL_RemoveAudioDevice(const int iscapture, void *handle); as appropriate so SDL's list of devices is accurate. */ extern void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device); - /* This is the size of a packet when using SDL_QueueAudio(). We allocate these as necessary and pool them, under the assumption that we'll eventually end up with a handful that keep recycling, meeting whatever @@ -61,20 +62,13 @@ extern void SDL_OpenedAudioDeviceDisconnected(SDL_AudioDevice *device); The system preallocates enough packets for 2 callbacks' worth of data. */ #define SDL_AUDIOBUFFERQUEUE_PACKETLEN (8 * 1024) -/* Used by apps that queue audio instead of using the callback. */ -typedef struct SDL_AudioBufferQueue -{ - Uint8 data[SDL_AUDIOBUFFERQUEUE_PACKETLEN]; /* packet data. */ - Uint32 datalen; /* bytes currently in use in this packet. */ - Uint32 startpos; /* bytes currently consumed in this packet. */ - struct SDL_AudioBufferQueue *next; /* next item in linked list. */ -} SDL_AudioBufferQueue; - typedef struct SDL_AudioDriverImpl { void (*DetectDevices) (void); int (*OpenDevice) (_THIS, void *handle, const char *devname, int iscapture); void (*ThreadInit) (_THIS); /* Called by audio thread at start */ + void (*ThreadDeinit) (_THIS); /* Called by audio thread at end */ + void (*BeginLoopIteration)(_THIS); /* Called by audio thread at top of loop */ void (*WaitDevice) (_THIS); void (*PlayDevice) (_THIS); int (*GetPendingBytes) (_THIS); @@ -105,11 +99,7 @@ typedef struct SDL_AudioDeviceItem { void *handle; struct SDL_AudioDeviceItem *next; - #if (defined(__GNUC__) && (__GNUC__ <= 2)) - char name[1]; /* actually variable length. */ - #else - char name[]; - #endif + char name[SDL_VARIABLE_LENGTH_ARRAY]; } SDL_AudioDeviceItem; @@ -136,15 +126,6 @@ typedef struct SDL_AudioDriver } SDL_AudioDriver; -/* Streamer */ -typedef struct -{ - Uint8 *buffer; - int max_len; /* the maximum length in bytes */ - int read_pos, write_pos; /* the position of the write and read heads in bytes */ -} SDL_AudioStreamer; - - /* Define the SDL audio driver structure */ struct SDL_AudioDevice { @@ -152,15 +133,14 @@ struct SDL_AudioDevice /* Data common to all devices */ SDL_AudioDeviceID id; - /* The current audio specification (shared with audio thread) */ + /* The device's current audio specification */ SDL_AudioSpec spec; - /* An audio conversion block for audio format emulation */ - SDL_AudioCVT convert; + /* The callback's expected audio specification (converted vs device's spec). */ + SDL_AudioSpec callbackspec; - /* The streamer, if sample rate conversion necessitates it */ - int use_streamer; - SDL_AudioStreamer streamer; + /* Stream that converts and resamples. NULL if not needed. */ + SDL_AudioStream *stream; /* Current state flags */ SDL_atomic_t shutdown; /* true if we are signaling the play thread to end. */ @@ -168,8 +148,11 @@ struct SDL_AudioDevice SDL_atomic_t paused; SDL_bool iscapture; - /* Fake audio buffer for when the audio hardware is busy */ - Uint8 *fake_stream; + /* Scratch buffer used in the bridge between SDL and the user callback. */ + Uint8 *work_buffer; + + /* Size, in bytes, of work_buffer. */ + Uint32 work_buffer_len; /* A mutex for locking the mixing buffers */ SDL_mutex *mixer_lock; @@ -179,10 +162,7 @@ struct SDL_AudioDevice SDL_threadID threadid; /* Queued buffers (if app not using callback). */ - SDL_AudioBufferQueue *buffer_queue_head; /* device fed from here. */ - SDL_AudioBufferQueue *buffer_queue_tail; /* queue fills to here. */ - SDL_AudioBufferQueue *buffer_queue_pool; /* these are unused packets. */ - Uint32 queued_bytes; /* number of bytes of audio data in the queue. */ + SDL_DataQueue *buffer_queue; /* * * */ /* Data private to this driver */ @@ -200,6 +180,32 @@ typedef struct AudioBootStrap int demand_only; /* 1==request explicitly, or it won't be available. */ } AudioBootStrap; -#endif /* _SDL_sysaudio_h */ +/* Not all of these are available in a given build. Use #ifdefs, etc. */ +extern AudioBootStrap PULSEAUDIO_bootstrap; +extern AudioBootStrap ALSA_bootstrap; +extern AudioBootStrap JACK_bootstrap; +extern AudioBootStrap SNDIO_bootstrap; +extern AudioBootStrap NETBSDAUDIO_bootstrap; +extern AudioBootStrap DSP_bootstrap; +extern AudioBootStrap QSAAUDIO_bootstrap; +extern AudioBootStrap SUNAUDIO_bootstrap; +extern AudioBootStrap ARTS_bootstrap; +extern AudioBootStrap ESD_bootstrap; +extern AudioBootStrap NACLAUDIO_bootstrap; +extern AudioBootStrap NAS_bootstrap; +extern AudioBootStrap WASAPI_bootstrap; +extern AudioBootStrap DSOUND_bootstrap; +extern AudioBootStrap WINMM_bootstrap; +extern AudioBootStrap PAUDIO_bootstrap; +extern AudioBootStrap HAIKUAUDIO_bootstrap; +extern AudioBootStrap COREAUDIO_bootstrap; +extern AudioBootStrap DISKAUDIO_bootstrap; +extern AudioBootStrap DUMMYAUDIO_bootstrap; +extern AudioBootStrap FUSIONSOUND_bootstrap; +extern AudioBootStrap ANDROIDAUDIO_bootstrap; +extern AudioBootStrap PSPAUDIO_bootstrap; +extern AudioBootStrap EMSCRIPTENAUDIO_bootstrap; + +#endif /* SDL_sysaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/SDL_wave.c b/Engine/lib/sdl/src/audio/SDL_wave.c index d173b4a92..2c76a8ce9 100644 --- a/Engine/lib/sdl/src/audio/SDL_wave.c +++ b/Engine/lib/sdl/src/audio/SDL_wave.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -403,6 +403,47 @@ IMA_ADPCM_decode(Uint8 ** audio_buf, Uint32 * audio_len) return (0); } + +static int +ConvertSint24ToSint32(Uint8 ** audio_buf, Uint32 * audio_len) +{ + const double DIVBY8388608 = 0.00000011920928955078125; + const Uint32 original_len = *audio_len; + const Uint32 samples = original_len / 3; + const Uint32 expanded_len = samples * sizeof (Uint32); + Uint8 *ptr = (Uint8 *) SDL_realloc(*audio_buf, expanded_len); + const Uint8 *src; + Uint32 *dst; + Uint32 i; + + if (!ptr) { + return SDL_OutOfMemory(); + } + + *audio_buf = ptr; + *audio_len = expanded_len; + + /* work from end to start, since we're expanding in-place. */ + src = (ptr + original_len) - 3; + dst = ((Uint32 *) (ptr + expanded_len)) - 1; + for (i = 0; i < samples; i++) { + /* There's probably a faster way to do all this. */ + const Sint32 converted = ((Sint32) ( (((Uint32) src[2]) << 24) | + (((Uint32) src[1]) << 16) | + (((Uint32) src[0]) << 8) )) >> 8; + const double scaled = (((double) converted) * DIVBY8388608); + src -= 3; + *(dst--) = (Sint32) (scaled * 2147483647.0); + } + + return 0; +} + + +/* GUIDs that are used by WAVE_FORMAT_EXTENSIBLE */ +static const Uint8 extensible_pcm_guid[16] = { 1, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113 }; +static const Uint8 extensible_ieee_guid[16] = { 3, 0, 0, 0, 0, 0, 16, 0, 128, 0, 0, 170, 0, 56, 155, 113 }; + SDL_AudioSpec * SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, SDL_AudioSpec * spec, Uint8 ** audio_buf, Uint32 * audio_len) @@ -421,6 +462,7 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, /* FMT chunk */ WaveFMT *format = NULL; + WaveExtensibleFMT *ext = NULL; SDL_zero(chunk); @@ -494,6 +536,24 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, } IMA_ADPCM_encoded = 1; break; + case EXTENSIBLE_CODE: + /* note that this ignores channel masks, smaller valid bit counts + inside a larger container, and most subtypes. This is just enough + to get things that didn't really _need_ WAVE_FORMAT_EXTENSIBLE + to be useful working when they use this format flag. */ + ext = (WaveExtensibleFMT *) format; + if (SDL_SwapLE16(ext->size) < 22) { + SDL_SetError("bogus extended .wav header"); + was_error = 1; + goto done; + } + if (SDL_memcmp(ext->subformat, extensible_pcm_guid, 16) == 0) { + break; /* cool. */ + } else if (SDL_memcmp(ext->subformat, extensible_ieee_guid, 16) == 0) { + IEEE_float_encoded = 1; + break; + } + break; case MP3_CODE: SDL_SetError("MPEG Layer 3 data not supported"); was_error = 1; @@ -528,6 +588,9 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, case 16: spec->format = AUDIO_S16; break; + case 24: /* convert this. */ + spec->format = AUDIO_S32; + break; case 32: spec->format = AUDIO_S32; break; @@ -575,6 +638,13 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc, } } + if (SDL_SwapLE16(format->bitspersample) == 24) { + if (ConvertSint24ToSint32(audio_buf, audio_len) < 0) { + was_error = 1; + goto done; + } + } + /* Don't return a buffer that isn't a multiple of samplesize */ samplesize = ((SDL_AUDIO_BITSIZE(spec->format)) / 8) * spec->channels; *audio_len &= ~(samplesize - 1); diff --git a/Engine/lib/sdl/src/audio/SDL_wave.h b/Engine/lib/sdl/src/audio/SDL_wave.h index f2f93986e..5c60f7538 100644 --- a/Engine/lib/sdl/src/audio/SDL_wave.h +++ b/Engine/lib/sdl/src/audio/SDL_wave.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,6 +38,7 @@ #define IEEE_FLOAT_CODE 0x0003 #define IMA_ADPCM_CODE 0x0011 #define MP3_CODE 0x0055 +#define EXTENSIBLE_CODE 0xFFFE #define WAVE_MONO 1 #define WAVE_STEREO 2 @@ -64,4 +65,13 @@ typedef struct Chunk Uint8 *data; } Chunk; +typedef struct WaveExtensibleFMT +{ + WaveFMT format; + Uint16 size; + Uint16 validbits; + Uint32 channelmask; + Uint8 subformat[16]; /* a GUID. */ +} WaveExtensibleFMT; + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/alsa/SDL_alsa_audio.c b/Engine/lib/sdl/src/audio/alsa/SDL_alsa_audio.c index 574d51bd5..2dba1ff46 100644 --- a/Engine/lib/sdl/src/audio/alsa/SDL_alsa_audio.c +++ b/Engine/lib/sdl/src/audio/alsa/SDL_alsa_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,6 @@ #include #include /* For kill() */ -#include #include #include "SDL_assert.h" @@ -91,6 +90,10 @@ static int (*ALSA_snd_pcm_reset)(snd_pcm_t *); static int (*ALSA_snd_device_name_hint) (int, const char *, void ***); static char* (*ALSA_snd_device_name_get_hint) (const void *, const char *); static int (*ALSA_snd_device_name_free_hint) (void **); +#ifdef SND_CHMAP_API_VERSION +static snd_pcm_chmap_t* (*ALSA_snd_pcm_get_chmap) (snd_pcm_t *); +static int (*ALSA_snd_pcm_chmap_print) (const snd_pcm_chmap_t *map, size_t maxlen, char *buf); +#endif #ifdef SDL_AUDIO_DRIVER_ALSA_DYNAMIC #define snd_pcm_hw_params_sizeof ALSA_snd_pcm_hw_params_sizeof @@ -155,6 +158,10 @@ load_alsa_syms(void) SDL_ALSA_SYM(snd_device_name_hint); SDL_ALSA_SYM(snd_device_name_get_hint); SDL_ALSA_SYM(snd_device_name_free_hint); +#ifdef SND_CHMAP_API_VERSION + SDL_ALSA_SYM(snd_pcm_get_chmap); + SDL_ALSA_SYM(snd_pcm_chmap_print); +#endif return 0; } @@ -255,25 +262,25 @@ ALSA_WaitDevice(_THIS) tmp = ptr[3]; ptr[3] = ptr[5]; ptr[5] = tmp; \ } -static SDL_INLINE void +static void swizzle_alsa_channels_6_64bit(void *buffer, Uint32 bufferlen) { SWIZ6(Uint64, buffer, bufferlen); } -static SDL_INLINE void +static void swizzle_alsa_channels_6_32bit(void *buffer, Uint32 bufferlen) { SWIZ6(Uint32, buffer, bufferlen); } -static SDL_INLINE void +static void swizzle_alsa_channels_6_16bit(void *buffer, Uint32 bufferlen) { SWIZ6(Uint16, buffer, bufferlen); } -static SDL_INLINE void +static void swizzle_alsa_channels_6_8bit(void *buffer, Uint32 bufferlen) { SWIZ6(Uint8, buffer, bufferlen); @@ -286,7 +293,7 @@ swizzle_alsa_channels_6_8bit(void *buffer, Uint32 bufferlen) * Called right before feeding this->hidden->mixbuf to the hardware. Swizzle * channels from Windows/Mac order to the format alsalib will want. */ -static SDL_INLINE void +static void swizzle_alsa_channels(_THIS, void *buffer, Uint32 bufferlen) { if (this->spec.channels == 6) { @@ -302,6 +309,15 @@ swizzle_alsa_channels(_THIS, void *buffer, Uint32 bufferlen) /* !!! FIXME: update this for 7.1 if needed, later. */ } +#ifdef SND_CHMAP_API_VERSION +/* Some devices have the right channel map, no swizzling necessary */ +static void +no_swizzle(_THIS, void *buffer, Uint32 bufferlen) +{ + return; +} +#endif /* SND_CHMAP_API_VERSION */ + static void ALSA_PlayDevice(_THIS) @@ -311,23 +327,10 @@ ALSA_PlayDevice(_THIS) this->spec.channels; snd_pcm_uframes_t frames_left = ((snd_pcm_uframes_t) this->spec.samples); - swizzle_alsa_channels(this, this->hidden->mixbuf, frames_left); + this->hidden->swizzle_func(this, this->hidden->mixbuf, frames_left); while ( frames_left > 0 && SDL_AtomicGet(&this->enabled) ) { - int status; - - /* This wait is a work-around for a hang when USB devices are - unplugged. Normally it should not result in any waiting, - but in the case of a USB unplug, it serves as a way to - join the playback thread after the timeout occurs */ - status = ALSA_snd_pcm_wait(this->hidden->pcm_handle, 1000); - if (status == 0) { - /*fprintf(stderr, "ALSA timeout waiting for available buffer space\n");*/ - SDL_OpenedAudioDeviceDisconnected(this); - return; - } - - status = ALSA_snd_pcm_writei(this->hidden->pcm_handle, + int status = ALSA_snd_pcm_writei(this->hidden->pcm_handle, sample_buf, frames_left); if (status < 0) { @@ -347,6 +350,13 @@ ALSA_PlayDevice(_THIS) } continue; } + else if (status == 0) { + /* No frames were written (no available space in pcm device). + Allow other threads to catch up. */ + Uint32 delay = (frames_left / 2 * 1000) / this->spec.freq; + SDL_Delay(delay); + } + sample_buf += status * frame_size; frames_left -= status; } @@ -366,23 +376,22 @@ ALSA_CaptureFromDevice(_THIS, void *buffer, int buflen) this->spec.channels; const int total_frames = buflen / frame_size; snd_pcm_uframes_t frames_left = total_frames; + snd_pcm_uframes_t wait_time = frame_size / 2; SDL_assert((buflen % frame_size) == 0); while ( frames_left > 0 && SDL_AtomicGet(&this->enabled) ) { - /* !!! FIXME: This works, but needs more testing before going live */ - /* ALSA_snd_pcm_wait(this->hidden->pcm_handle, -1); */ - int status = ALSA_snd_pcm_readi(this->hidden->pcm_handle, + int status; + + status = ALSA_snd_pcm_readi(this->hidden->pcm_handle, sample_buf, frames_left); - if (status < 0) { + if (status == -EAGAIN) { + ALSA_snd_pcm_wait(this->hidden->pcm_handle, wait_time); + status = 0; + } + else if (status < 0) { /*printf("ALSA: capture error %d\n", status);*/ - if (status == -EAGAIN) { - /* Apparently snd_pcm_recover() doesn't handle this case - - does it assume snd_pcm_wait() above? */ - SDL_Delay(1); - continue; - } status = ALSA_snd_pcm_recover(this->hidden->pcm_handle, status, 0); if (status < 0) { /* Hmm, not much we can do - abort */ @@ -398,7 +407,7 @@ ALSA_CaptureFromDevice(_THIS, void *buffer, int buflen) frames_left -= status; } - swizzle_alsa_channels(this, buffer, total_frames - frames_left); + this->hidden->swizzle_func(this, buffer, total_frames - frames_left); return (total_frames - frames_left) * frame_size; } @@ -548,6 +557,10 @@ ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) SDL_AudioFormat test_format = 0; unsigned int rate = 0; unsigned int channels = 0; +#ifdef SND_CHMAP_API_VERSION + snd_pcm_chmap_t *chmap; + char chmap_str[64]; +#endif /* Initialize all variables that we clean on shutdown */ this->hidden = (struct SDL_PrivateAudioData *) @@ -640,6 +653,22 @@ ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) } this->spec.format = test_format; + /* Validate number of channels and determine if swizzling is necessary + * Assume original swizzling, until proven otherwise. + */ + this->hidden->swizzle_func = swizzle_alsa_channels; +#ifdef SND_CHMAP_API_VERSION + chmap = ALSA_snd_pcm_get_chmap(pcm_handle); + if (chmap) { + ALSA_snd_pcm_chmap_print(chmap, sizeof(chmap_str), chmap_str); + if (SDL_strcmp("FL FR FC LFE RL RR", chmap_str) == 0 || + SDL_strcmp("FL FR FC LFE SL SR", chmap_str) == 0) { + this->hidden->swizzle_func = no_swizzle; + } + free(chmap); + } +#endif /* SND_CHMAP_API_VERSION */ + /* Set the number of channels */ status = ALSA_snd_pcm_hw_params_set_channels(pcm_handle, hwparams, this->spec.channels); @@ -708,8 +737,9 @@ ALSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) SDL_memset(this->hidden->mixbuf, this->spec.silence, this->hidden->mixlen); } - /* Switch to blocking mode for playback */ - ALSA_snd_pcm_nonblock(pcm_handle, 0); + if (!iscapture) { + ALSA_snd_pcm_nonblock(pcm_handle, 0); + } /* We're ready to rock and roll. :-) */ return 0; @@ -726,18 +756,28 @@ static void add_device(const int iscapture, const char *name, void *hint, ALSA_Device **pSeen) { ALSA_Device *dev = SDL_malloc(sizeof (ALSA_Device)); - char *desc = ALSA_snd_device_name_get_hint(hint, "DESC"); + char *desc; char *handle = NULL; char *ptr; - if (!desc) { - SDL_free(dev); - return; - } else if (!dev) { - free(desc); + if (!dev) { return; } + /* Not all alsa devices are enumerable via snd_device_name_get_hint + (i.e. bluetooth devices). Therefore if hint is passed in to this + function as NULL, assume name contains desc. + Make sure not to free the storage associated with desc in this case */ + if (hint) { + desc = ALSA_snd_device_name_get_hint(hint, "DESC"); + if (!desc) { + SDL_free(dev); + return; + } + } else { + desc = (char *) name; + } + SDL_assert(name != NULL); /* some strings have newlines, like "HDA NVidia, HDMI 0\nHDMI Audio Output". @@ -751,14 +791,16 @@ add_device(const int iscapture, const char *name, void *hint, ALSA_Device **pSee handle = SDL_strdup(name); if (!handle) { - free(desc); + if (hint) { + free(desc); + } SDL_free(dev); return; } SDL_AddAudioDevice(iscapture, desc, handle); - free(desc); - + if (hint) + free(desc); dev->name = handle; dev->iscapture = iscapture; dev->next = *pSeen; @@ -778,12 +820,15 @@ ALSA_HotplugThread(void *arg) ALSA_Device *dev; Uint32 ticks; + SDL_SetThreadPriority(SDL_THREAD_PRIORITY_LOW); + while (!SDL_AtomicGet(&ALSA_hotplug_shutdown)) { void **hints = NULL; + ALSA_Device *unseen; + ALSA_Device *seen; + ALSA_Device *prev; + if (ALSA_snd_device_name_hint(-1, "pcm", &hints) != -1) { - ALSA_Device *unseen = devices; - ALSA_Device *seen = NULL; - ALSA_Device *prev; int i, j; const char *match = NULL; int bestmatch = 0xFFFF; @@ -793,6 +838,8 @@ ALSA_HotplugThread(void *arg) "hw:", "sysdefault:", "default:", NULL }; + unseen = devices; + seen = NULL; /* Apparently there are several different ways that ALSA lists actual hardware. It could be prefixed with "hw:" or "default:" or "sysdefault:" and maybe others. Go through the list and see @@ -887,7 +934,7 @@ ALSA_HotplugThread(void *arg) /* report anything still in unseen as removed. */ for (dev = unseen; dev; dev = next) { - /*printf("ALSA: removing %s device '%s'\n", dev->iscapture ? "capture" : "output", dev->name);*/ + /*printf("ALSA: removing usb %s device '%s'\n", dev->iscapture ? "capture" : "output", dev->name);*/ next = dev->next; SDL_RemoveAudioDevice(dev->iscapture, dev->name); SDL_free(dev->name); diff --git a/Engine/lib/sdl/src/audio/alsa/SDL_alsa_audio.h b/Engine/lib/sdl/src/audio/alsa/SDL_alsa_audio.h index 3080aea23..f62050017 100644 --- a/Engine/lib/sdl/src/audio/alsa/SDL_alsa_audio.h +++ b/Engine/lib/sdl/src/audio/alsa/SDL_alsa_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_ALSA_audio_h -#define _SDL_ALSA_audio_h +#ifndef SDL_ALSA_audio_h_ +#define SDL_ALSA_audio_h_ #include @@ -38,8 +38,11 @@ struct SDL_PrivateAudioData /* Raw mixing buffer */ Uint8 *mixbuf; int mixlen; + + /* swizzle function */ + void (*swizzle_func)(_THIS, void *buffer, Uint32 bufferlen); }; -#endif /* _SDL_ALSA_audio_h */ +#endif /* SDL_ALSA_audio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/android/SDL_androidaudio.c b/Engine/lib/sdl/src/audio/android/SDL_androidaudio.c index 96f6d631a..7a2542461 100644 --- a/Engine/lib/sdl/src/audio/android/SDL_androidaudio.c +++ b/Engine/lib/sdl/src/audio/android/SDL_androidaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -215,6 +215,10 @@ void ANDROIDAUDIO_ResumeDevices(void) } } +#else + +void ANDROIDAUDIO_ResumeDevices(void) {} +void ANDROIDAUDIO_PauseDevices(void) {} #endif /* SDL_AUDIO_DRIVER_ANDROID */ diff --git a/Engine/lib/sdl/src/audio/android/SDL_androidaudio.h b/Engine/lib/sdl/src/audio/android/SDL_androidaudio.h index 133615302..c732ac687 100644 --- a/Engine/lib/sdl/src/audio/android/SDL_androidaudio.h +++ b/Engine/lib/sdl/src/audio/android/SDL_androidaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_androidaudio_h -#define _SDL_androidaudio_h +#ifndef SDL_androidaudio_h_ +#define SDL_androidaudio_h_ #include "../SDL_sysaudio.h" @@ -34,6 +34,9 @@ struct SDL_PrivateAudioData int resume; }; -#endif /* _SDL_androidaudio_h */ +void ANDROIDAUDIO_ResumeDevices(void); +void ANDROIDAUDIO_PauseDevices(void); + +#endif /* SDL_androidaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/arts/SDL_artsaudio.c b/Engine/lib/sdl/src/audio/arts/SDL_artsaudio.c index 6054e36b6..4e3ebf2ce 100644 --- a/Engine/lib/sdl/src/audio/arts/SDL_artsaudio.c +++ b/Engine/lib/sdl/src/audio/arts/SDL_artsaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/audio/arts/SDL_artsaudio.h b/Engine/lib/sdl/src/audio/arts/SDL_artsaudio.h index 6b9bf3037..774365486 100644 --- a/Engine/lib/sdl/src/audio/arts/SDL_artsaudio.h +++ b/Engine/lib/sdl/src/audio/arts/SDL_artsaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_artscaudio_h -#define _SDL_artscaudio_h +#ifndef SDL_artsaudio_h_ +#define SDL_artsaudio_h_ #include @@ -42,11 +42,12 @@ struct SDL_PrivateAudioData Uint8 *mixbuf; int mixlen; - /* Support for audio timing using a timer, in addition to select() */ + /* Support for audio timing using a timer, in addition to SDL_IOReady() */ float frame_ticks; float next_frame; }; #define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ -#endif /* _SDL_artscaudio_h */ +#endif /* SDL_artsaudio_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.h b/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.h index b7e5b8e21..7ce8b8dfa 100644 --- a/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.h +++ b/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_coreaudio_h -#define _SDL_coreaudio_h +#ifndef SDL_coreaudio_h_ +#define SDL_coreaudio_h_ #include "../SDL_sysaudio.h" @@ -47,7 +47,7 @@ struct SDL_PrivateAudioData { SDL_Thread *thread; AudioQueueRef audioQueue; - AudioQueueBufferRef audioBuffer[2]; + AudioQueueBufferRef *audioBuffer; void *buffer; UInt32 bufferOffset; UInt32 bufferSize; @@ -63,5 +63,6 @@ struct SDL_PrivateAudioData #endif }; -#endif /* _SDL_coreaudio_h */ +#endif /* SDL_coreaudio_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.m b/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.m index 85129050f..92f5f12a0 100644 --- a/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.m +++ b/Engine/lib/sdl/src/audio/coreaudio/SDL_coreaudio.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,6 +25,7 @@ /* !!! FIXME: clean out some of the macro salsa in here. */ #include "SDL_audio.h" +#include "SDL_hints.h" #include "../SDL_audio_c.h" #include "../SDL_sysaudio.h" #include "SDL_coreaudio.h" @@ -285,9 +286,9 @@ static void interruption_begin(_THIS) static void interruption_end(_THIS) { if (this != NULL && this->hidden != NULL && this->hidden->audioQueue != NULL - && this->hidden->interrupted) { + && this->hidden->interrupted + && AudioQueueStart(this->hidden->audioQueue, NULL) == AVAudioSessionErrorCodeNone) { this->hidden->interrupted = SDL_FALSE; - AudioQueueStart(this->hidden->audioQueue, NULL); } } @@ -325,7 +326,8 @@ static BOOL update_audio_session(_THIS, SDL_bool open) @autoreleasepool { AVAudioSession *session = [AVAudioSession sharedInstance]; NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; - NSString *category; + /* Set category to ambient by default so that other music continues playing. */ + NSString *category = AVAudioSessionCategoryAmbient; NSError *err = nil; if (open_playback_devices && open_capture_devices) { @@ -333,10 +335,17 @@ static BOOL update_audio_session(_THIS, SDL_bool open) } else if (open_capture_devices) { category = AVAudioSessionCategoryRecord; } else { - /* Set category to ambient so that other music continues playing. - You can change this at runtime in your own code if you need different - behavior. If this is common, we can add an SDL hint for this. */ - category = AVAudioSessionCategoryAmbient; + const char *hint = SDL_GetHint(SDL_HINT_AUDIO_CATEGORY); + if (hint) { + if (SDL_strcasecmp(hint, "AVAudioSessionCategoryAmbient") == 0) { + category = AVAudioSessionCategoryAmbient; + } else if (SDL_strcasecmp(hint, "AVAudioSessionCategorySoloAmbient") == 0) { + category = AVAudioSessionCategorySoloAmbient; + } else if (SDL_strcasecmp(hint, "AVAudioSessionCategoryPlayback") == 0 || + SDL_strcasecmp(hint, "playback") == 0) { + category = AVAudioSessionCategoryPlayback; + } + } } if (![session setCategory:category error:&err]) { @@ -400,8 +409,12 @@ static void outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer) { SDL_AudioDevice *this = (SDL_AudioDevice *) inUserData; + if (SDL_AtomicGet(&this->hidden->shutdown)) { + return; /* don't do anything. */ + } + if (!SDL_AtomicGet(&this->enabled) || SDL_AtomicGet(&this->paused)) { - /* Supply silence if audio is enabled and not paused */ + /* Supply silence if audio is not enabled or paused */ SDL_memset(inBuffer->mAudioData, this->spec.silence, inBuffer->mAudioDataBytesCapacity); } else { UInt32 remaining = inBuffer->mAudioDataBytesCapacity; @@ -412,7 +425,7 @@ outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffe if (this->hidden->bufferOffset >= this->hidden->bufferSize) { /* Generate the data */ SDL_LockMutex(this->mixer_lock); - (*this->spec.callback)(this->spec.userdata, + (*this->callbackspec.callback)(this->callbackspec.userdata, this->hidden->buffer, this->hidden->bufferSize); SDL_UnlockMutex(this->mixer_lock); this->hidden->bufferOffset = 0; @@ -430,9 +443,7 @@ outputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffe } } - if (!SDL_AtomicGet(&this->hidden->shutdown)) { - AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); - } + AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); inBuffer->mAudioDataByteSize = inBuffer->mAudioDataBytesCapacity; } @@ -443,7 +454,13 @@ inputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer const AudioStreamPacketDescription *inPacketDescs ) { SDL_AudioDevice *this = (SDL_AudioDevice *) inUserData; - if (SDL_AtomicGet(&this->enabled) && !SDL_AtomicGet(&this->paused)) { /* ignore unless we're active. */ + + if (SDL_AtomicGet(&this->shutdown)) { + return; /* don't do anything. */ + } + + /* ignore unless we're active. */ + if (!SDL_AtomicGet(&this->paused) && SDL_AtomicGet(&this->enabled) && !SDL_AtomicGet(&this->paused)) { const Uint8 *ptr = (const Uint8 *) inBuffer->mAudioData; UInt32 remaining = inBuffer->mAudioDataByteSize; while (remaining > 0) { @@ -459,16 +476,14 @@ inputCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer if (this->hidden->bufferOffset >= this->hidden->bufferSize) { SDL_LockMutex(this->mixer_lock); - (*this->spec.callback)(this->spec.userdata, this->hidden->buffer, this->hidden->bufferSize); + (*this->callbackspec.callback)(this->callbackspec.userdata, this->hidden->buffer, this->hidden->bufferSize); SDL_UnlockMutex(this->mixer_lock); this->hidden->bufferOffset = 0; } } } - if (!SDL_AtomicGet(&this->hidden->shutdown)) { - AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); - } + AudioQueueEnqueueBuffer(this->hidden->audioQueue, inBuffer, 0, NULL); } @@ -514,7 +529,6 @@ static void COREAUDIO_CloseDevice(_THIS) { const SDL_bool iscapture = this->iscapture; - int i; /* !!! FIXME: what does iOS do when a bluetooth audio device vanishes? Headphones unplugged? */ /* !!! FIXME: (we only do a "default" device on iOS right now...can we do more?) */ @@ -527,24 +541,24 @@ COREAUDIO_CloseDevice(_THIS) update_audio_session(this, SDL_FALSE); #endif + /* if callback fires again, feed silence; don't call into the app. */ + SDL_AtomicSet(&this->paused, 1); + + if (this->hidden->audioQueue) { + AudioQueueDispose(this->hidden->audioQueue, 1); + } + if (this->hidden->thread) { SDL_AtomicSet(&this->hidden->shutdown, 1); SDL_WaitThread(this->hidden->thread, NULL); } - if (this->hidden->audioQueue) { - for (i = 0; i < SDL_arraysize(this->hidden->audioBuffer); i++) { - if (this->hidden->audioBuffer[i]) { - AudioQueueFreeBuffer(this->hidden->audioQueue, this->hidden->audioBuffer[i]); - } - } - AudioQueueDispose(this->hidden->audioQueue, 1); - } - if (this->hidden->ready_semaphore) { SDL_DestroySemaphore(this->hidden->ready_semaphore); } + /* AudioQueueDispose() frees the actual buffer objects. */ + SDL_free(this->hidden->audioBuffer); SDL_free(this->hidden->thread_error); SDL_free(this->hidden->buffer); SDL_free(this->hidden); @@ -663,7 +677,31 @@ prepare_audioqueue(_THIS) return 0; } - for (i = 0; i < SDL_arraysize(this->hidden->audioBuffer); i++) { + /* Make sure we can feed the device a minimum amount of time */ + double MINIMUM_AUDIO_BUFFER_TIME_MS = 15.0; +#if defined(__IPHONEOS__) + if (floor(NSFoundationVersionNumber) <= NSFoundationVersionNumber_iOS_7_1) { + /* Older iOS hardware, use 40 ms as a minimum time */ + MINIMUM_AUDIO_BUFFER_TIME_MS = 40.0; + } +#endif + const double msecs = (this->spec.samples / ((double) this->spec.freq)) * 1000.0; + int numAudioBuffers = 2; + if (msecs < MINIMUM_AUDIO_BUFFER_TIME_MS) { /* use more buffers if we have a VERY small sample set. */ + numAudioBuffers = ((int)SDL_ceil(MINIMUM_AUDIO_BUFFER_TIME_MS / msecs) * 2); + } + + this->hidden->audioBuffer = SDL_calloc(1, sizeof (AudioQueueBufferRef) * numAudioBuffers); + if (this->hidden->audioBuffer == NULL) { + SDL_OutOfMemory(); + return 0; + } + +#if DEBUG_COREAUDIO + printf("COREAUDIO: numAudioBuffers == %d\n", numAudioBuffers); +#endif + + for (i = 0; i < numAudioBuffers; i++) { result = AudioQueueAllocateBuffer(this->hidden->audioQueue, this->spec.size, &this->hidden->audioBuffer[i]); CHECK_RESULT("AudioQueueAllocateBuffer"); SDL_memset(this->hidden->audioBuffer[i]->mAudioData, this->spec.silence, this->hidden->audioBuffer[i]->mAudioDataBytesCapacity); @@ -696,10 +734,7 @@ audioqueue_thread(void *arg) CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.10, 1); } - if (this->iscapture) { /* just stop immediately for capture devices. */ - AudioQueueStop(this->hidden->audioQueue, 1); - } else { /* Drain off any pending playback. */ - AudioQueueStop(this->hidden->audioQueue, 0); + if (!this->iscapture) { /* Drain off any pending playback. */ const CFTimeInterval secs = (((this->spec.size / (SDL_AUDIO_BITSIZE(this->spec.format) / 8)) / this->spec.channels) / ((CFTimeInterval) this->spec.freq)) * 2.0; CFRunLoopRunInMode(kCFRunLoopDefaultMode, secs, 0); } @@ -734,6 +769,13 @@ COREAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (!update_audio_session(this, SDL_TRUE)) { return -1; } + + /* Stop CoreAudio from doing expensive audio rate conversion */ + @autoreleasepool { + AVAudioSession* session = [AVAudioSession sharedInstance]; + [session setPreferredSampleRate:this->spec.freq error:nil]; + this->spec.freq = (int)session.sampleRate; + } #endif /* Setup a AudioStreamBasicDescription with the requested format */ diff --git a/Engine/lib/sdl/src/audio/directsound/SDL_directsound.c b/Engine/lib/sdl/src/audio/directsound/SDL_directsound.c index 5d261c92e..09b83aedf 100644 --- a/Engine/lib/sdl/src/audio/directsound/SDL_directsound.c +++ b/Engine/lib/sdl/src/audio/directsound/SDL_directsound.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -434,7 +434,6 @@ CreateCaptureBuffer(_THIS, const DWORD bufsize, WAVEFORMATEX *wfmt) LPDIRECTSOUNDCAPTURE capture = this->hidden->capture; LPDIRECTSOUNDCAPTUREBUFFER *capturebuf = &this->hidden->capturebuf; DSCBUFFERDESC format; -// DWORD junk, cursor; HRESULT result; SDL_zero(format); @@ -523,8 +522,8 @@ DSOUND_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) bufsize = numchunks * this->spec.size; if ((bufsize < DSBSIZE_MIN) || (bufsize > DSBSIZE_MAX)) { SDL_SetError("Sound buffer size must be between %d and %d", - (DSBSIZE_MIN < numchunks) ? 1 : DSBSIZE_MIN / numchunks, - DSBSIZE_MAX / numchunks); + (int) ((DSBSIZE_MIN < numchunks) ? 1 : DSBSIZE_MIN / numchunks), + (int) (DSBSIZE_MAX / numchunks)); } else { int rc; WAVEFORMATEX wfmt; diff --git a/Engine/lib/sdl/src/audio/directsound/SDL_directsound.h b/Engine/lib/sdl/src/audio/directsound/SDL_directsound.h index d646c303f..acb7b6ac1 100644 --- a/Engine/lib/sdl/src/audio/directsound/SDL_directsound.h +++ b/Engine/lib/sdl/src/audio/directsound/SDL_directsound.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_directsound_h -#define _SDL_directsound_h +#ifndef SDL_directsound_h_ +#define SDL_directsound_h_ #include "../../core/windows/SDL_directx.h" @@ -42,6 +42,6 @@ struct SDL_PrivateAudioData Uint8 *locked_buf; }; -#endif /* _SDL_directsound_h */ +#endif /* SDL_directsound_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/disk/SDL_diskaudio.c b/Engine/lib/sdl/src/audio/disk/SDL_diskaudio.c index ee5368844..2250375da 100644 --- a/Engine/lib/sdl/src/audio/disk/SDL_diskaudio.c +++ b/Engine/lib/sdl/src/audio/disk/SDL_diskaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,6 +33,7 @@ #include "SDL_audio.h" #include "../SDL_audio_c.h" #include "SDL_diskaudio.h" +#include "SDL_log.h" /* !!! FIXME: these should be SDL hints, not environment variables. */ /* environment variables and defaults. */ @@ -160,12 +161,11 @@ DISKAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); } -#if HAVE_STDIO_H - fprintf(stderr, - "WARNING: You are using the SDL disk i/o audio driver!\n" - " %s file [%s].\n", iscapture ? "Reading from" : "Writing to", - fname); -#endif + SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO, + "You are using the SDL disk i/o audio driver!\n"); + SDL_LogCritical(SDL_LOG_CATEGORY_AUDIO, + " %s file [%s].\n", iscapture ? "Reading from" : "Writing to", + fname); /* We're ready to rock and roll. :-) */ return 0; diff --git a/Engine/lib/sdl/src/audio/disk/SDL_diskaudio.h b/Engine/lib/sdl/src/audio/disk/SDL_diskaudio.h index ad152a9ce..7e73ebe53 100644 --- a/Engine/lib/sdl/src/audio/disk/SDL_diskaudio.h +++ b/Engine/lib/sdl/src/audio/disk/SDL_diskaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_diskaudio_h -#define _SDL_diskaudio_h +#ifndef SDL_diskaudio_h_ +#define SDL_diskaudio_h_ #include "SDL_rwops.h" #include "../SDL_sysaudio.h" @@ -37,5 +37,5 @@ struct SDL_PrivateAudioData Uint8 *mixbuf; }; -#endif /* _SDL_diskaudio_h */ +#endif /* SDL_diskaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.c b/Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.c index a5a31b3aa..77653bede 100644 --- a/Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.c +++ b/Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.h b/Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.h index 0e4acfcab..6bd86d71d 100644 --- a/Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.h +++ b/Engine/lib/sdl/src/audio/dsp/SDL_dspaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_dspaudio_h -#define _SDL_dspaudio_h +#ifndef SDL_dspaudio_h_ +#define SDL_dspaudio_h_ #include "../SDL_sysaudio.h" @@ -39,5 +39,5 @@ struct SDL_PrivateAudioData }; #define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ -#endif /* _SDL_dspaudio_h */ +#endif /* SDL_dspaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/dummy/SDL_dummyaudio.c b/Engine/lib/sdl/src/audio/dummy/SDL_dummyaudio.c index b39f8e327..f91dea388 100644 --- a/Engine/lib/sdl/src/audio/dummy/SDL_dummyaudio.c +++ b/Engine/lib/sdl/src/audio/dummy/SDL_dummyaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/audio/dummy/SDL_dummyaudio.h b/Engine/lib/sdl/src/audio/dummy/SDL_dummyaudio.h index b1f88b1cb..18241ee54 100644 --- a/Engine/lib/sdl/src/audio/dummy/SDL_dummyaudio.h +++ b/Engine/lib/sdl/src/audio/dummy/SDL_dummyaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_dummyaudio_h -#define _SDL_dummyaudio_h +#ifndef SDL_dummyaudio_h_ +#define SDL_dummyaudio_h_ #include "../SDL_sysaudio.h" @@ -37,5 +37,5 @@ struct SDL_PrivateAudioData Uint32 initial_calls; }; -#endif /* _SDL_dummyaudio_h */ +#endif /* SDL_dummyaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/emscripten/SDL_emscriptenaudio.c b/Engine/lib/sdl/src/audio/emscripten/SDL_emscriptenaudio.c index 839d445ee..e519f0834 100644 --- a/Engine/lib/sdl/src/audio/emscripten/SDL_emscriptenaudio.c +++ b/Engine/lib/sdl/src/audio/emscripten/SDL_emscriptenaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,175 +26,121 @@ #include "SDL_log.h" #include "../SDL_audio_c.h" #include "SDL_emscriptenaudio.h" +#include "SDL_assert.h" #include -static int -copyData(_THIS) +static void +FeedAudioDevice(_THIS, const void *buf, const int buflen) { - int byte_len; + const int framelen = (SDL_AUDIO_BITSIZE(this->spec.format) / 8) * this->spec.channels; + EM_ASM_ARGS({ + var numChannels = SDL2.audio.currentOutputBuffer['numberOfChannels']; + for (var c = 0; c < numChannels; ++c) { + var channelData = SDL2.audio.currentOutputBuffer['getChannelData'](c); + if (channelData.length != $1) { + throw 'Web Audio output buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; + } - if (this->hidden->write_off + this->convert.len_cvt > this->hidden->mixlen) { - if (this->hidden->write_off > this->hidden->read_off) { - SDL_memmove(this->hidden->mixbuf, - this->hidden->mixbuf + this->hidden->read_off, - this->hidden->mixlen - this->hidden->read_off); - this->hidden->write_off = this->hidden->write_off - this->hidden->read_off; - } else { - this->hidden->write_off = 0; + for (var j = 0; j < $1; ++j) { + channelData[j] = HEAPF32[$0 + ((j*numChannels + c) << 2) >> 2]; /* !!! FIXME: why are these shifts here? */ + } } - this->hidden->read_off = 0; - } - - SDL_memcpy(this->hidden->mixbuf + this->hidden->write_off, - this->convert.buf, - this->convert.len_cvt); - this->hidden->write_off += this->convert.len_cvt; - byte_len = this->hidden->write_off - this->hidden->read_off; - - return byte_len; + }, buf, buflen / framelen); } static void HandleAudioProcess(_THIS) { - Uint8 *buf = NULL; - int byte_len = 0; - int bytes = SDL_AUDIO_BITSIZE(this->spec.format) / 8; + SDL_AudioCallback callback = this->callbackspec.callback; + const int stream_len = this->callbackspec.size; /* Only do something if audio is enabled */ if (!SDL_AtomicGet(&this->enabled) || SDL_AtomicGet(&this->paused)) { + if (this->stream) { + SDL_AudioStreamClear(this->stream); + } return; } - if (this->convert.needed) { - const int bytes_in = SDL_AUDIO_BITSIZE(this->convert.src_format) / 8; - - if (this->hidden->conv_in_len != 0) { - this->convert.len = this->hidden->conv_in_len * bytes_in * this->spec.channels; - } - - (*this->spec.callback) (this->spec.userdata, - this->convert.buf, - this->convert.len); - SDL_ConvertAudio(&this->convert); - buf = this->convert.buf; - byte_len = this->convert.len_cvt; - - /* size mismatch*/ - if (byte_len != this->spec.size) { - if (!this->hidden->mixbuf) { - this->hidden->mixlen = this->spec.size > byte_len ? this->spec.size * 2 : byte_len * 2; - this->hidden->mixbuf = SDL_malloc(this->hidden->mixlen); + if (this->stream == NULL) { /* no conversion necessary. */ + SDL_assert(this->spec.size == stream_len); + callback(this->callbackspec.userdata, this->work_buffer, stream_len); + } else { /* streaming/converting */ + int got; + while (SDL_AudioStreamAvailable(this->stream) < ((int) this->spec.size)) { + callback(this->callbackspec.userdata, this->work_buffer, stream_len); + if (SDL_AudioStreamPut(this->stream, this->work_buffer, stream_len) == -1) { + SDL_AudioStreamClear(this->stream); + SDL_AtomicSet(&this->enabled, 0); + break; } - - /* copy existing data */ - byte_len = copyData(this); - - /* read more data*/ - while (byte_len < this->spec.size) { - (*this->spec.callback) (this->spec.userdata, - this->convert.buf, - this->convert.len); - SDL_ConvertAudio(&this->convert); - byte_len = copyData(this); - } - - byte_len = this->spec.size; - buf = this->hidden->mixbuf + this->hidden->read_off; - this->hidden->read_off += byte_len; } - } else { - if (!this->hidden->mixbuf) { - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = SDL_malloc(this->hidden->mixlen); + got = SDL_AudioStreamGet(this->stream, this->work_buffer, this->spec.size); + SDL_assert((got < 0) || (got == this->spec.size)); + if (got != this->spec.size) { + SDL_memset(this->work_buffer, this->spec.silence, this->spec.size); } - (*this->spec.callback) (this->spec.userdata, - this->hidden->mixbuf, - this->hidden->mixlen); - buf = this->hidden->mixbuf; - byte_len = this->hidden->mixlen; } - if (buf) { - EM_ASM_ARGS({ - var numChannels = SDL2.audio.currentOutputBuffer['numberOfChannels']; - for (var c = 0; c < numChannels; ++c) { - var channelData = SDL2.audio.currentOutputBuffer['getChannelData'](c); - if (channelData.length != $1) { - throw 'Web Audio output buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; - } - - for (var j = 0; j < $1; ++j) { - channelData[j] = HEAPF32[$0 + ((j*numChannels + c) << 2) >> 2]; - } - } - }, buf, byte_len / bytes / this->spec.channels); - } + FeedAudioDevice(this, this->work_buffer, this->spec.size); } static void HandleCaptureProcess(_THIS) { - Uint8 *buf; - int buflen; + SDL_AudioCallback callback = this->callbackspec.callback; + const int stream_len = this->callbackspec.size; /* Only do something if audio is enabled */ if (!SDL_AtomicGet(&this->enabled) || SDL_AtomicGet(&this->paused)) { + SDL_AudioStreamClear(this->stream); return; } - if (this->convert.needed) { - buf = this->convert.buf; - buflen = this->convert.len_cvt; - } else { - if (!this->hidden->mixbuf) { - this->hidden->mixbuf = (Uint8 *) SDL_malloc(this->spec.size); - if (!this->hidden->mixbuf) { - return; /* oh well. */ - } - } - buf = this->hidden->mixbuf; - buflen = this->spec.size; - } - EM_ASM_ARGS({ var numChannels = SDL2.capture.currentCaptureBuffer.numberOfChannels; - if (numChannels == 1) { /* fastpath this a little for the common (mono) case. */ - var channelData = SDL2.capture.currentCaptureBuffer.getChannelData(0); + for (var c = 0; c < numChannels; ++c) { + var channelData = SDL2.capture.currentCaptureBuffer.getChannelData(c); if (channelData.length != $1) { throw 'Web Audio capture buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; } - for (var j = 0; j < $1; ++j) { - setValue($0 + (j * 4), channelData[j], 'float'); - } - } else { - for (var c = 0; c < numChannels; ++c) { - var channelData = SDL2.capture.currentCaptureBuffer.getChannelData(c); - if (channelData.length != $1) { - throw 'Web Audio capture buffer length mismatch! Destination size: ' + channelData.length + ' samples vs expected ' + $1 + ' samples!'; - } + if (numChannels == 1) { /* fastpath this a little for the common (mono) case. */ + for (var j = 0; j < $1; ++j) { + setValue($0 + (j * 4), channelData[j], 'float'); + } + } else { for (var j = 0; j < $1; ++j) { setValue($0 + (((j * numChannels) + c) * 4), channelData[j], 'float'); } } } - }, buf, (this->spec.size / sizeof (float)) / this->spec.channels); + }, this->work_buffer, (this->spec.size / sizeof (float)) / this->spec.channels); /* okay, we've got an interleaved float32 array in C now. */ - if (this->convert.needed) { - SDL_ConvertAudio(&this->convert); + if (this->stream == NULL) { /* no conversion necessary. */ + SDL_assert(this->spec.size == stream_len); + callback(this->callbackspec.userdata, this->work_buffer, stream_len); + } else { /* streaming/converting */ + if (SDL_AudioStreamPut(this->stream, this->work_buffer, this->spec.size) == -1) { + SDL_AtomicSet(&this->enabled, 0); + } + + while (SDL_AudioStreamAvailable(this->stream) >= stream_len) { + const int got = SDL_AudioStreamGet(this->stream, this->work_buffer, stream_len); + SDL_assert((got < 0) || (got == stream_len)); + if (got != stream_len) { + SDL_memset(this->work_buffer, this->callbackspec.silence, stream_len); + } + callback(this->callbackspec.userdata, this->work_buffer, stream_len); /* Send it to the app. */ + } } - - /* Send it to the app. */ - (*this->spec.callback) (this->spec.userdata, buf, buflen); } - static void EMSCRIPTENAUDIO_CloseDevice(_THIS) { @@ -236,8 +182,9 @@ EMSCRIPTENAUDIO_CloseDevice(_THIS) } }, this->iscapture); - SDL_free(this->hidden->mixbuf); +#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */ SDL_free(this->hidden); +#endif } static int @@ -245,8 +192,6 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu { SDL_bool valid_format = SDL_FALSE; SDL_AudioFormat test_format; - int i; - float f; int result; /* based on parts of library_sdl.js */ @@ -293,29 +238,17 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu } /* Initialize all variables that we clean on shutdown */ +#if 0 /* !!! FIXME: currently not used. Can we move some stuff off the SDL2 namespace? --ryan. */ this->hidden = (struct SDL_PrivateAudioData *) SDL_malloc((sizeof *this->hidden)); if (this->hidden == NULL) { return SDL_OutOfMemory(); } SDL_zerop(this->hidden); +#endif /* limit to native freq */ - const int sampleRate = EM_ASM_INT_V({ - return SDL2.audioContext.sampleRate; - }); - - if(this->spec.freq != sampleRate) { - for (i = this->spec.samples; i > 0; i--) { - f = (float)i / (float)sampleRate * (float)this->spec.freq; - if (SDL_floor(f) == f) { - this->hidden->conv_in_len = SDL_floor(f); - break; - } - } - - this->spec.freq = sampleRate; - } + this->spec.freq = EM_ASM_INT_V({ return SDL2.audioContext.sampleRate; }); SDL_CalculateAudioSpec(&this->spec); @@ -395,6 +328,9 @@ EMSCRIPTENAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscaptu static int EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl) { + int available; + int capture_available; + /* Set the function pointers */ impl->OpenDevice = EMSCRIPTENAUDIO_OpenDevice; impl->CloseDevice = EMSCRIPTENAUDIO_CloseDevice; @@ -406,7 +342,7 @@ EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl) impl->ProvidesOwnCallbackThread = 1; /* check availability */ - const int available = EM_ASM_INT_V({ + available = EM_ASM_INT_V({ if (typeof(AudioContext) !== 'undefined') { return 1; } else if (typeof(webkitAudioContext) !== 'undefined') { @@ -419,7 +355,7 @@ EMSCRIPTENAUDIO_Init(SDL_AudioDriverImpl * impl) SDL_SetError("No audio context available"); } - const int capture_available = available && EM_ASM_INT_V({ + capture_available = available && EM_ASM_INT_V({ if ((typeof(navigator.mediaDevices) !== 'undefined') && (typeof(navigator.mediaDevices.getUserMedia) !== 'undefined')) { return 1; } else if (typeof(navigator.webkitGetUserMedia) !== 'undefined') { diff --git a/Engine/lib/sdl/src/audio/emscripten/SDL_emscriptenaudio.h b/Engine/lib/sdl/src/audio/emscripten/SDL_emscriptenaudio.h index cd5377d86..3c95668df 100644 --- a/Engine/lib/sdl/src/audio/emscripten/SDL_emscriptenaudio.h +++ b/Engine/lib/sdl/src/audio/emscripten/SDL_emscriptenaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_emscriptenaudio_h -#define _SDL_emscriptenaudio_h +#ifndef SDL_emscriptenaudio_h_ +#define SDL_emscriptenaudio_h_ #include "../SDL_sysaudio.h" @@ -30,13 +30,9 @@ struct SDL_PrivateAudioData { - Uint8 *mixbuf; - Uint32 mixlen; - - Uint32 conv_in_len; - - Uint32 write_off, read_off; + int unused; }; -#endif /* _SDL_emscriptenaudio_h */ +#endif /* SDL_emscriptenaudio_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/esd/SDL_esdaudio.c b/Engine/lib/sdl/src/audio/esd/SDL_esdaudio.c index 3eb719791..802ea7804 100644 --- a/Engine/lib/sdl/src/audio/esd/SDL_esdaudio.c +++ b/Engine/lib/sdl/src/audio/esd/SDL_esdaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/audio/esd/SDL_esdaudio.h b/Engine/lib/sdl/src/audio/esd/SDL_esdaudio.h index d362b16ce..9b5c25a70 100644 --- a/Engine/lib/sdl/src/audio/esd/SDL_esdaudio.h +++ b/Engine/lib/sdl/src/audio/esd/SDL_esdaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_esdaudio_h -#define _SDL_esdaudio_h +#ifndef SDL_esdaudio_h_ +#define SDL_esdaudio_h_ #include "../SDL_sysaudio.h" @@ -46,5 +46,6 @@ struct SDL_PrivateAudioData }; #define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ -#endif /* _SDL_esdaudio_h */ +#endif /* SDL_esdaudio_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/fusionsound/SDL_fsaudio.c b/Engine/lib/sdl/src/audio/fusionsound/SDL_fsaudio.c index daa0f9dd6..36fa5c545 100644 --- a/Engine/lib/sdl/src/audio/fusionsound/SDL_fsaudio.c +++ b/Engine/lib/sdl/src/audio/fusionsound/SDL_fsaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/audio/fusionsound/SDL_fsaudio.h b/Engine/lib/sdl/src/audio/fusionsound/SDL_fsaudio.h index 5cf8a2009..27e45ced2 100644 --- a/Engine/lib/sdl/src/audio/fusionsound/SDL_fsaudio.h +++ b/Engine/lib/sdl/src/audio/fusionsound/SDL_fsaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_fsaudio_h -#define _SDL_fsaudio_h +#ifndef SDL_fsaudio_h_ +#define SDL_fsaudio_h_ #include @@ -45,5 +45,6 @@ struct SDL_PrivateAudioData }; -#endif /* _SDL_fsaudio_h */ +#endif /* SDL_fsaudio_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/haiku/SDL_haikuaudio.cc b/Engine/lib/sdl/src/audio/haiku/SDL_haikuaudio.cc index 25b1fa217..52946a5b7 100644 --- a/Engine/lib/sdl/src/audio/haiku/SDL_haikuaudio.cc +++ b/Engine/lib/sdl/src/audio/haiku/SDL_haikuaudio.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,6 +36,7 @@ extern "C" #include "../SDL_audio_c.h" #include "../SDL_sysaudio.h" #include "SDL_haikuaudio.h" +#include "SDL_assert.h" } @@ -47,26 +48,39 @@ FillSound(void *device, void *stream, size_t len, const media_raw_audio_format & format) { SDL_AudioDevice *audio = (SDL_AudioDevice *) device; + SDL_AudioCallback callback = audio->callbackspec.callback; - /* Only do soemthing if audio is enabled */ - if (!SDL_AtomicGet(&audio->enabled)) { + /* Only do something if audio is enabled */ + if (!SDL_AtomicGet(&audio->enabled) || SDL_AtomicGet(&audio->paused)) { + if (audio->stream) { + SDL_AudioStreamClear(audio->stream); + } + SDL_memset(stream, audio->spec.silence, len); return; } - if (!SDL_AtomicGet(&audio->paused)) { - if (audio->convert.needed) { - SDL_LockMutex(audio->mixer_lock); - (*audio->spec.callback) (audio->spec.userdata, - (Uint8 *) audio->convert.buf, - audio->convert.len); - SDL_UnlockMutex(audio->mixer_lock); - SDL_ConvertAudio(&audio->convert); - SDL_memcpy(stream, audio->convert.buf, audio->convert.len_cvt); - } else { - SDL_LockMutex(audio->mixer_lock); - (*audio->spec.callback) (audio->spec.userdata, - (Uint8 *) stream, len); - SDL_UnlockMutex(audio->mixer_lock); + SDL_assert(audio->spec.size == len); + + if (audio->stream == NULL) { /* no conversion necessary. */ + SDL_LockMutex(audio->mixer_lock); + callback(audio->callbackspec.userdata, (Uint8 *) stream, len); + SDL_UnlockMutex(audio->mixer_lock); + } else { /* streaming/converting */ + const int stream_len = audio->callbackspec.size; + const int ilen = (int) len; + while (SDL_AudioStreamAvailable(audio->stream) < ilen) { + callback(audio->callbackspec.userdata, audio->work_buffer, stream_len); + if (SDL_AudioStreamPut(audio->stream, audio->work_buffer, stream_len) == -1) { + SDL_AudioStreamClear(audio->stream); + SDL_AtomicSet(&audio->enabled, 0); + break; + } + } + + const int got = SDL_AudioStreamGet(audio->stream, stream, ilen); + SDL_assert((got < 0) || (got == ilen)); + if (got != ilen) { + SDL_memset(stream, audio->spec.silence, len); } } } diff --git a/Engine/lib/sdl/src/audio/haiku/SDL_haikuaudio.h b/Engine/lib/sdl/src/audio/haiku/SDL_haikuaudio.h index 23e5a7655..f63ccdb1a 100644 --- a/Engine/lib/sdl/src/audio/haiku/SDL_haikuaudio.h +++ b/Engine/lib/sdl/src/audio/haiku/SDL_haikuaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_beaudio_h -#define _SDL_beaudio_h +#ifndef SDL_haikuaudio_h_ +#define SDL_haikuaudio_h_ #include "../SDL_sysaudio.h" @@ -33,6 +33,6 @@ struct SDL_PrivateAudioData BSoundPlayer *audio_obj; }; -#endif /* _SDL_beaudio_h */ +#endif /* SDL_haikuaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/jack/SDL_jackaudio.c b/Engine/lib/sdl/src/audio/jack/SDL_jackaudio.c new file mode 100644 index 000000000..a252da70e --- /dev/null +++ b/Engine/lib/sdl/src/audio/jack/SDL_jackaudio.c @@ -0,0 +1,429 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_AUDIO_DRIVER_JACK + +#include "SDL_assert.h" +#include "SDL_timer.h" +#include "SDL_audio.h" +#include "../SDL_audio_c.h" +#include "SDL_jackaudio.h" +#include "SDL_loadso.h" +#include "../../thread/SDL_systhread.h" + + +static jack_client_t * (*JACK_jack_client_open) (const char *, jack_options_t, jack_status_t *, ...); +static int (*JACK_jack_client_close) (jack_client_t *); +static void (*JACK_jack_on_shutdown) (jack_client_t *, JackShutdownCallback, void *); +static int (*JACK_jack_activate) (jack_client_t *); +static int (*JACK_jack_deactivate) (jack_client_t *); +static void * (*JACK_jack_port_get_buffer) (jack_port_t *, jack_nframes_t); +static int (*JACK_jack_port_unregister) (jack_client_t *, jack_port_t *); +static void (*JACK_jack_free) (void *); +static const char ** (*JACK_jack_get_ports) (jack_client_t *, const char *, const char *, unsigned long); +static jack_nframes_t (*JACK_jack_get_sample_rate) (jack_client_t *); +static jack_nframes_t (*JACK_jack_get_buffer_size) (jack_client_t *); +static jack_port_t * (*JACK_jack_port_register) (jack_client_t *, const char *, const char *, unsigned long, unsigned long); +static const char * (*JACK_jack_port_name) (const jack_port_t *); +static int (*JACK_jack_connect) (jack_client_t *, const char *, const char *); +static int (*JACK_jack_set_process_callback) (jack_client_t *, JackProcessCallback, void *); + +static int load_jack_syms(void); + + +#ifdef SDL_AUDIO_DRIVER_JACK_DYNAMIC + +static const char *jack_library = SDL_AUDIO_DRIVER_JACK_DYNAMIC; +static void *jack_handle = NULL; + +/* !!! FIXME: this is copy/pasted in several places now */ +static int +load_jack_sym(const char *fn, void **addr) +{ + *addr = SDL_LoadFunction(jack_handle, fn); + if (*addr == NULL) { + /* Don't call SDL_SetError(): SDL_LoadFunction already did. */ + return 0; + } + + return 1; +} + +/* cast funcs to char* first, to please GCC's strict aliasing rules. */ +#define SDL_JACK_SYM(x) \ + if (!load_jack_sym(#x, (void **) (char *) &JACK_##x)) return -1 + +static void +UnloadJackLibrary(void) +{ + if (jack_handle != NULL) { + SDL_UnloadObject(jack_handle); + jack_handle = NULL; + } +} + +static int +LoadJackLibrary(void) +{ + int retval = 0; + if (jack_handle == NULL) { + jack_handle = SDL_LoadObject(jack_library); + if (jack_handle == NULL) { + retval = -1; + /* Don't call SDL_SetError(): SDL_LoadObject already did. */ + } else { + retval = load_jack_syms(); + if (retval < 0) { + UnloadJackLibrary(); + } + } + } + return retval; +} + +#else + +#define SDL_JACK_SYM(x) JACK_##x = x + +static void +UnloadJackLibrary(void) +{ +} + +static int +LoadJackLibrary(void) +{ + load_jack_syms(); + return 0; +} + +#endif /* SDL_AUDIO_DRIVER_JACK_DYNAMIC */ + + +static int +load_jack_syms(void) +{ + SDL_JACK_SYM(jack_client_open); + SDL_JACK_SYM(jack_client_close); + SDL_JACK_SYM(jack_on_shutdown); + SDL_JACK_SYM(jack_activate); + SDL_JACK_SYM(jack_deactivate); + SDL_JACK_SYM(jack_port_get_buffer); + SDL_JACK_SYM(jack_port_unregister); + SDL_JACK_SYM(jack_free); + SDL_JACK_SYM(jack_get_ports); + SDL_JACK_SYM(jack_get_sample_rate); + SDL_JACK_SYM(jack_get_buffer_size); + SDL_JACK_SYM(jack_port_register); + SDL_JACK_SYM(jack_port_name); + SDL_JACK_SYM(jack_connect); + SDL_JACK_SYM(jack_set_process_callback); + return 0; +} + + +static void +jackShutdownCallback(void *arg) /* JACK went away; device is lost. */ +{ + SDL_AudioDevice *this = (SDL_AudioDevice *) arg; + SDL_OpenedAudioDeviceDisconnected(this); + SDL_SemPost(this->hidden->iosem); /* unblock the SDL thread. */ +} + +// !!! FIXME: implement and register these! +//typedef int(* JackSampleRateCallback)(jack_nframes_t nframes, void *arg) +//typedef int(* JackBufferSizeCallback)(jack_nframes_t nframes, void *arg) + +static int +jackProcessPlaybackCallback(jack_nframes_t nframes, void *arg) +{ + SDL_AudioDevice *this = (SDL_AudioDevice *) arg; + jack_port_t **ports = this->hidden->sdlports; + const int total_channels = this->spec.channels; + const int total_frames = this->spec.samples; + int channelsi; + + if (!SDL_AtomicGet(&this->enabled)) { + /* silence the buffer to avoid repeats and corruption. */ + SDL_memset(this->hidden->iobuffer, '\0', this->spec.size); + } + + for (channelsi = 0; channelsi < total_channels; channelsi++) { + float *dst = (float *) JACK_jack_port_get_buffer(ports[channelsi], nframes); + if (dst) { + const float *src = ((float *) this->hidden->iobuffer) + channelsi; + int framesi; + for (framesi = 0; framesi < total_frames; framesi++) { + *(dst++) = *src; + src += total_channels; + } + } + } + + SDL_SemPost(this->hidden->iosem); /* tell SDL thread we're done; refill the buffer. */ + return 0; /* success */ +} + + +/* This function waits until it is possible to write a full sound buffer */ +static void +JACK_WaitDevice(_THIS) +{ + if (SDL_AtomicGet(&this->enabled)) { + if (SDL_SemWait(this->hidden->iosem) == -1) { + SDL_OpenedAudioDeviceDisconnected(this); + } + } +} + +static Uint8 * +JACK_GetDeviceBuf(_THIS) +{ + return (Uint8 *) this->hidden->iobuffer; +} + + +static int +jackProcessCaptureCallback(jack_nframes_t nframes, void *arg) +{ + SDL_AudioDevice *this = (SDL_AudioDevice *) arg; + if (SDL_AtomicGet(&this->enabled)) { + jack_port_t **ports = this->hidden->sdlports; + const int total_channels = this->spec.channels; + const int total_frames = this->spec.samples; + int channelsi; + + for (channelsi = 0; channelsi < total_channels; channelsi++) { + const float *src = (const float *) JACK_jack_port_get_buffer(ports[channelsi], nframes); + if (src) { + float *dst = ((float *) this->hidden->iobuffer) + channelsi; + int framesi; + for (framesi = 0; framesi < total_frames; framesi++) { + *dst = *(src++); + dst += total_channels; + } + } + } + } + + SDL_SemPost(this->hidden->iosem); /* tell SDL thread we're done; new buffer is ready! */ + return 0; /* success */ +} + +static int +JACK_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + SDL_assert(buflen == this->spec.size); /* we always fill a full buffer. */ + + /* Wait for JACK to fill the iobuffer */ + if (SDL_SemWait(this->hidden->iosem) == -1) { + return -1; + } + + SDL_memcpy(buffer, this->hidden->iobuffer, buflen); + return buflen; +} + +static void +JACK_FlushCapture(_THIS) +{ + SDL_SemWait(this->hidden->iosem); +} + + +static void +JACK_CloseDevice(_THIS) +{ + if (this->hidden->client) { + JACK_jack_deactivate(this->hidden->client); + + if (this->hidden->sdlports) { + const int channels = this->spec.channels; + int i; + for (i = 0; i < channels; i++) { + JACK_jack_port_unregister(this->hidden->client, this->hidden->sdlports[i]); + } + SDL_free(this->hidden->sdlports); + } + + JACK_jack_client_close(this->hidden->client); + } + + if (this->hidden->iosem) { + SDL_DestroySemaphore(this->hidden->iosem); + } + + if (this->hidden->devports) { + JACK_jack_free(this->hidden->devports); + } + + SDL_free(this->hidden->iobuffer); +} + +static int +JACK_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +{ + /* Note that JACK uses "output" for capture devices (they output audio + data to us) and "input" for playback (we input audio data to them). + Likewise, SDL's playback port will be "output" (we write data out) + and capture will be "input" (we read data in). */ + const unsigned long sysportflags = iscapture ? JackPortIsOutput : JackPortIsInput; + const unsigned long sdlportflags = iscapture ? JackPortIsInput : JackPortIsOutput; + const JackProcessCallback callback = iscapture ? jackProcessCaptureCallback : jackProcessPlaybackCallback; + const char *sdlportstr = iscapture ? "input" : "output"; + const char **devports = NULL; + jack_client_t *client = NULL; + jack_status_t status; + int channels = 0; + int i; + + /* Initialize all variables that we clean on shutdown */ + this->hidden = (struct SDL_PrivateAudioData *) SDL_calloc(1, sizeof (*this->hidden)); + if (this->hidden == NULL) { + return SDL_OutOfMemory(); + } + + /* !!! FIXME: we _still_ need an API to specify an app name */ + client = JACK_jack_client_open("SDL", JackNoStartServer, &status, NULL); + this->hidden->client = client; + if (client == NULL) { + return SDL_SetError("Can't open JACK client"); + } + + devports = JACK_jack_get_ports(client, NULL, NULL, JackPortIsPhysical | sysportflags); + this->hidden->devports = devports; + if (!devports || !devports[0]) { + return SDL_SetError("No physical JACK ports available"); + } + + while (devports[++channels]) { + /* spin to count devports */ + } + + /* !!! FIXME: docs say about buffer size: "This size may change, clients that depend on it must register a bufsize_callback so they will be notified if it does." */ + + /* Jack pretty much demands what it wants. */ + this->spec.format = AUDIO_F32SYS; + this->spec.freq = JACK_jack_get_sample_rate(client); + this->spec.channels = channels; + this->spec.samples = JACK_jack_get_buffer_size(client); + + SDL_CalculateAudioSpec(&this->spec); + + this->hidden->iosem = SDL_CreateSemaphore(0); + if (!this->hidden->iosem) { + return -1; /* error was set by SDL_CreateSemaphore */ + } + + this->hidden->iobuffer = (float *) SDL_calloc(1, this->spec.size); + if (!this->hidden->iobuffer) { + return SDL_OutOfMemory(); + } + + /* Build SDL's ports, which we will connect to the device ports. */ + this->hidden->sdlports = (jack_port_t **) SDL_calloc(channels, sizeof (jack_port_t *)); + if (this->hidden->sdlports == NULL) { + return SDL_OutOfMemory(); + } + + for (i = 0; i < channels; i++) { + char portname[32]; + SDL_snprintf(portname, sizeof (portname), "sdl_jack_%s_%d", sdlportstr, i); + this->hidden->sdlports[i] = JACK_jack_port_register(client, portname, JACK_DEFAULT_AUDIO_TYPE, sdlportflags, 0); + if (this->hidden->sdlports[i] == NULL) { + return SDL_SetError("jack_port_register failed"); + } + } + + if (JACK_jack_set_process_callback(client, callback, this) != 0) { + return SDL_SetError("JACK: Couldn't set process callback"); + } + + JACK_jack_on_shutdown(client, jackShutdownCallback, this); + + if (JACK_jack_activate(client) != 0) { + return SDL_SetError("Failed to activate JACK client"); + } + + /* once activated, we can connect all the ports. */ + for (i = 0; i < channels; i++) { + const char *sdlport = JACK_jack_port_name(this->hidden->sdlports[i]); + const char *srcport = iscapture ? devports[i] : sdlport; + const char *dstport = iscapture ? sdlport : devports[i]; + if (JACK_jack_connect(client, srcport, dstport) != 0) { + return SDL_SetError("Couldn't connect JACK ports: %s => %s", srcport, dstport); + } + } + + /* don't need these anymore. */ + this->hidden->devports = NULL; + JACK_jack_free(devports); + + /* We're ready to rock and roll. :-) */ + return 0; +} + +static void +JACK_Deinitialize(void) +{ + UnloadJackLibrary(); +} + +static int +JACK_Init(SDL_AudioDriverImpl * impl) +{ + if (LoadJackLibrary() < 0) { + return 0; + } else { + /* Make sure a JACK server is running and available. */ + jack_status_t status; + jack_client_t *client = JACK_jack_client_open("SDL", JackNoStartServer, &status, NULL); + if (client == NULL) { + UnloadJackLibrary(); + return 0; + } + JACK_jack_client_close(client); + } + + /* Set the function pointers */ + impl->OpenDevice = JACK_OpenDevice; + impl->WaitDevice = JACK_WaitDevice; + impl->GetDeviceBuf = JACK_GetDeviceBuf; + impl->CloseDevice = JACK_CloseDevice; + impl->Deinitialize = JACK_Deinitialize; + impl->CaptureFromDevice = JACK_CaptureFromDevice; + impl->FlushCapture = JACK_FlushCapture; + impl->OnlyHasDefaultOutputDevice = SDL_TRUE; + impl->OnlyHasDefaultCaptureDevice = SDL_TRUE; + impl->HasCaptureSupport = SDL_TRUE; + + return 1; /* this audio target is available. */ +} + +AudioBootStrap JACK_bootstrap = { + "jack", "JACK Audio Connection Kit", JACK_Init, 0 +}; + +#endif /* SDL_AUDIO_DRIVER_JACK */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/jack/SDL_jackaudio.h b/Engine/lib/sdl/src/audio/jack/SDL_jackaudio.h new file mode 100644 index 000000000..aab199ac2 --- /dev/null +++ b/Engine/lib/sdl/src/audio/jack/SDL_jackaudio.h @@ -0,0 +1,42 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#ifndef SDL_jackaudio_h_ +#define SDL_jackaudio_h_ + +#include + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the audio functions */ +#define _THIS SDL_AudioDevice *this + +struct SDL_PrivateAudioData +{ + jack_client_t *client; + SDL_sem *iosem; + float *iobuffer; + const char **devports; + jack_port_t **sdlports; +}; + +#endif /* SDL_jackaudio_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.c b/Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.c index 33cbe1c83..3e3afc02d 100644 --- a/Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.c +++ b/Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,29 +45,46 @@ static void nacl_audio_callback(void* samples, uint32_t buffer_size, PP_TimeDelta latency, void* data); /* FIXME: Make use of latency if needed */ -static void nacl_audio_callback(void* samples, uint32_t buffer_size, PP_TimeDelta latency, void* data) { +static void nacl_audio_callback(void* stream, uint32_t buffer_size, PP_TimeDelta latency, void* data) { + const int len = (int) buffer_size; SDL_AudioDevice* _this = (SDL_AudioDevice*) data; + SDL_AudioCallback callback = _this->callbackspec.callback; SDL_LockMutex(private->mutex); /* !!! FIXME: is this mutex necessary? */ - if (SDL_AtomicGet(&_this->enabled) && !SDL_AtomicGet(&_this->paused)) { - if (_this->convert.needed) { - SDL_LockMutex(_this->mixer_lock); - (*_this->spec.callback) (_this->spec.userdata, - (Uint8 *) _this->convert.buf, - _this->convert.len); - SDL_UnlockMutex(_this->mixer_lock); - SDL_ConvertAudio(&_this->convert); - SDL_memcpy(samples, _this->convert.buf, _this->convert.len_cvt); - } else { - SDL_LockMutex(_this->mixer_lock); - (*_this->spec.callback) (_this->spec.userdata, (Uint8 *) samples, buffer_size); - SDL_UnlockMutex(_this->mixer_lock); + /* Only do something if audio is enabled */ + if (!SDL_AtomicGet(&_this->enabled) || SDL_AtomicGet(&_this->paused)) { + if (_this->stream) { + SDL_AudioStreamClear(_this->stream); } - } else { - SDL_memset(samples, _this->spec.silence, buffer_size); + SDL_memset(stream, _this->spec.silence, len); + return; } - + + SDL_assert(_this->spec.size == len); + + if (_this->stream == NULL) { /* no conversion necessary. */ + SDL_LockMutex(_this->mixer_lock); + callback(_this->callbackspec.userdata, stream, len); + SDL_UnlockMutex(_this->mixer_lock); + } else { /* streaming/converting */ + const int stream_len = _this->callbackspec.size; + while (SDL_AudioStreamAvailable(_this->stream) < len) { + callback(_this->callbackspec.userdata, _this->work_buffer, stream_len); + if (SDL_AudioStreamPut(_this->stream, _this->work_buffer, stream_len) == -1) { + SDL_AudioStreamClear(_this->stream); + SDL_AtomicSet(&_this->enabled, 0); + break; + } + } + + const int got = SDL_AudioStreamGet(_this->stream, stream, len); + SDL_assert((got < 0) || (got == len)); + if (got != len) { + SDL_memset(stream, _this->spec.silence, len); + } + } + SDL_UnlockMutex(private->mutex); } @@ -89,8 +106,7 @@ NACLAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { private = (SDL_PrivateAudioData *) SDL_calloc(1, (sizeof *private)); if (private == NULL) { - SDL_OutOfMemory(); - return 0; + return SDL_OutOfMemory(); } private->mutex = SDL_CreateMutex(); @@ -114,7 +130,7 @@ NACLAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { /* Start audio playback while we are still on the main thread. */ ppb_audio->StartPlayback(private->audio); - return 1; + return 0; } static int diff --git a/Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.h b/Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.h index 90ff5448e..5ec842bac 100644 --- a/Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.h +++ b/Engine/lib/sdl/src/audio/nacl/SDL_naclaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_naclaudio_h -#define _SDL_naclaudio_h +#ifndef SDL_naclaudio_h_ +#define SDL_naclaudio_h_ #include "SDL_audio.h" #include "../SDL_sysaudio.h" @@ -38,4 +38,6 @@ typedef struct SDL_PrivateAudioData { PP_Resource audio; } SDL_PrivateAudioData; -#endif /* _SDL_naclaudio_h */ +#endif /* SDL_naclaudio_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/nas/SDL_nasaudio.c b/Engine/lib/sdl/src/audio/nas/SDL_nasaudio.c index fe15cd696..5a02a3ba6 100644 --- a/Engine/lib/sdl/src/audio/nas/SDL_nasaudio.c +++ b/Engine/lib/sdl/src/audio/nas/SDL_nasaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -116,7 +116,7 @@ LoadNASLibrary(void) char *err = (char *) alloca(len); SDL_strlcpy(err, origerr, len); retval = -1; - SDL_SetError("NAS: SDL_LoadObject('%s') failed: %s\n", + SDL_SetError("NAS: SDL_LoadObject('%s') failed: %s", nas_library, err); } else { retval = load_nas_syms(); diff --git a/Engine/lib/sdl/src/audio/nas/SDL_nasaudio.h b/Engine/lib/sdl/src/audio/nas/SDL_nasaudio.h index 2f46b0b60..b1a51d1a6 100644 --- a/Engine/lib/sdl/src/audio/nas/SDL_nasaudio.h +++ b/Engine/lib/sdl/src/audio/nas/SDL_nasaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_nasaudio_h -#define _SDL_nasaudio_h +#ifndef SDL_nasaudio_h_ +#define SDL_nasaudio_h_ #ifdef __sgi #include @@ -51,6 +51,6 @@ struct SDL_PrivateAudioData struct timeval last_tv; int buf_free; }; -#endif /* _SDL_nasaudio_h */ +#endif /* SDL_nasaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/bsd/SDL_bsdaudio.c b/Engine/lib/sdl/src/audio/netbsd/SDL_netbsdaudio.c similarity index 88% rename from Engine/lib/sdl/src/audio/bsd/SDL_bsdaudio.c rename to Engine/lib/sdl/src/audio/netbsd/SDL_netbsdaudio.c index 6a970b9c7..0dc0b25eb 100644 --- a/Engine/lib/sdl/src/audio/bsd/SDL_bsdaudio.c +++ b/Engine/lib/sdl/src/audio/netbsd/SDL_netbsdaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,10 +20,10 @@ */ #include "../../SDL_internal.h" -#if SDL_AUDIO_DRIVER_BSD +#if SDL_AUDIO_DRIVER_NETBSD /* - * Driver for native OpenBSD/NetBSD audio(4). + * Driver for native NetBSD audio(4). * vedge@vedge.com.ar. */ @@ -38,9 +38,10 @@ #include "SDL_timer.h" #include "SDL_audio.h" +#include "../../core/unix/SDL_poll.h" #include "../SDL_audio_c.h" #include "../SDL_audiodev_c.h" -#include "SDL_bsdaudio.h" +#include "SDL_netbsdaudio.h" /* Use timer for synchronization */ /* #define USE_TIMER_SYNC */ @@ -50,14 +51,14 @@ static void -BSDAUDIO_DetectDevices(void) +NETBSDAUDIO_DetectDevices(void) { SDL_EnumUnixAudioDevices(0, NULL); } static void -BSDAUDIO_Status(_THIS) +NETBSDAUDIO_Status(_THIS) { #ifdef DEBUG_AUDIO /* *INDENT-OFF* */ @@ -121,7 +122,7 @@ BSDAUDIO_Status(_THIS) /* This function waits until it is possible to write a full sound buffer */ static void -BSDAUDIO_WaitDevice(_THIS) +NETBSDAUDIO_WaitDevice(_THIS) { #ifndef USE_BLOCKING_WRITES /* Not necessary when using blocking writes */ /* See if we need to use timed audio synchronization */ @@ -134,18 +135,11 @@ BSDAUDIO_WaitDevice(_THIS) SDL_Delay(ticks); } } else { - /* Use select() for audio synchronization */ - fd_set fdset; - struct timeval timeout; - - FD_ZERO(&fdset); - FD_SET(this->hidden->audio_fd, &fdset); - timeout.tv_sec = 10; - timeout.tv_usec = 0; + /* Use SDL_IOReady() for audio synchronization */ #ifdef DEBUG_AUDIO fprintf(stderr, "Waiting for audio to get ready\n"); #endif - if (select(this->hidden->audio_fd + 1, NULL, &fdset, NULL, &timeout) + if (SDL_IOReady(this->hidden->audio_fd, SDL_TRUE, 10 * 1000) <= 0) { const char *message = "Audio timeout - buggy audio driver? (disabled)"; @@ -169,7 +163,7 @@ BSDAUDIO_WaitDevice(_THIS) } static void -BSDAUDIO_PlayDevice(_THIS) +NETBSDAUDIO_PlayDevice(_THIS) { int written, p = 0; @@ -208,19 +202,19 @@ BSDAUDIO_PlayDevice(_THIS) } static Uint8 * -BSDAUDIO_GetDeviceBuf(_THIS) +NETBSDAUDIO_GetDeviceBuf(_THIS) { return (this->hidden->mixbuf); } static int -BSDAUDIO_CaptureFromDevice(_THIS, void *_buffer, int buflen) +NETBSDAUDIO_CaptureFromDevice(_THIS, void *_buffer, int buflen) { Uint8 *buffer = (Uint8 *) _buffer; int br, p = 0; - /* Write the audio data, checking for EAGAIN on broken audio drivers */ + /* Capture the audio data, checking for EAGAIN on broken audio drivers */ do { br = read(this->hidden->audio_fd, buffer + p, buflen - p); if (br > 0) @@ -243,7 +237,7 @@ BSDAUDIO_CaptureFromDevice(_THIS, void *_buffer, int buflen) } static void -BSDAUDIO_FlushCapture(_THIS) +NETBSDAUDIO_FlushCapture(_THIS) { audio_info_t info; size_t remain; @@ -265,7 +259,7 @@ BSDAUDIO_FlushCapture(_THIS) } static void -BSDAUDIO_CloseDevice(_THIS) +NETBSDAUDIO_CloseDevice(_THIS) { if (this->hidden->audio_fd >= 0) { close(this->hidden->audio_fd); @@ -275,7 +269,7 @@ BSDAUDIO_CloseDevice(_THIS) } static int -BSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +NETBSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { const int flags = iscapture ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT; SDL_AudioFormat format = 0; @@ -383,24 +377,24 @@ BSDAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) SDL_memset(this->hidden->mixbuf, this->spec.silence, this->spec.size); } - BSDAUDIO_Status(this); + NETBSDAUDIO_Status(this); /* We're ready to rock and roll. :-) */ return 0; } static int -BSDAUDIO_Init(SDL_AudioDriverImpl * impl) +NETBSDAUDIO_Init(SDL_AudioDriverImpl * impl) { /* Set the function pointers */ - impl->DetectDevices = BSDAUDIO_DetectDevices; - impl->OpenDevice = BSDAUDIO_OpenDevice; - impl->PlayDevice = BSDAUDIO_PlayDevice; - impl->WaitDevice = BSDAUDIO_WaitDevice; - impl->GetDeviceBuf = BSDAUDIO_GetDeviceBuf; - impl->CloseDevice = BSDAUDIO_CloseDevice; - impl->CaptureFromDevice = BSDAUDIO_CaptureFromDevice; - impl->FlushCapture = BSDAUDIO_FlushCapture; + impl->DetectDevices = NETBSDAUDIO_DetectDevices; + impl->OpenDevice = NETBSDAUDIO_OpenDevice; + impl->PlayDevice = NETBSDAUDIO_PlayDevice; + impl->WaitDevice = NETBSDAUDIO_WaitDevice; + impl->GetDeviceBuf = NETBSDAUDIO_GetDeviceBuf; + impl->CloseDevice = NETBSDAUDIO_CloseDevice; + impl->CaptureFromDevice = NETBSDAUDIO_CaptureFromDevice; + impl->FlushCapture = NETBSDAUDIO_FlushCapture; impl->HasCaptureSupport = SDL_TRUE; impl->AllowsArbitraryDeviceNames = 1; @@ -409,10 +403,10 @@ BSDAUDIO_Init(SDL_AudioDriverImpl * impl) } -AudioBootStrap BSD_AUDIO_bootstrap = { - "bsd", "BSD audio", BSDAUDIO_Init, 0 +AudioBootStrap NETBSDAUDIO_bootstrap = { + "netbsd", "NetBSD audio", NETBSDAUDIO_Init, 0 }; -#endif /* SDL_AUDIO_DRIVER_BSD */ +#endif /* SDL_AUDIO_DRIVER_NETBSD */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/bsd/SDL_bsdaudio.h b/Engine/lib/sdl/src/audio/netbsd/SDL_netbsdaudio.h similarity index 81% rename from Engine/lib/sdl/src/audio/bsd/SDL_bsdaudio.h rename to Engine/lib/sdl/src/audio/netbsd/SDL_netbsdaudio.h index 7fe141b14..1c46068ab 100644 --- a/Engine/lib/sdl/src/audio/bsd/SDL_bsdaudio.h +++ b/Engine/lib/sdl/src/audio/netbsd/SDL_netbsdaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_bsdaudio_h -#define _SDL_bsdaudio_h +#ifndef SDL_netbsdaudio_h_ +#define SDL_netbsdaudio_h_ #include "../SDL_sysaudio.h" @@ -32,20 +32,17 @@ struct SDL_PrivateAudioData /* The file descriptor for the audio device */ int audio_fd; - /* The parent process id, to detect when application quits */ - pid_t parent; - /* Raw mixing buffer */ Uint8 *mixbuf; int mixlen; - /* Support for audio timing using a timer, in addition to select() */ + /* Support for audio timing using a timer, in addition to SDL_IOReady() */ float frame_ticks; float next_frame; }; #define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ -#endif /* _SDL_bsdaudio_h */ +#endif /* SDL_netbsdaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/paudio/SDL_paudio.c b/Engine/lib/sdl/src/audio/paudio/SDL_paudio.c index 57202245f..1e8c124bb 100644 --- a/Engine/lib/sdl/src/audio/paudio/SDL_paudio.c +++ b/Engine/lib/sdl/src/audio/paudio/SDL_paudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,9 +36,10 @@ #include "SDL_audio.h" #include "SDL_stdinc.h" #include "../SDL_audio_c.h" +#include "../../core/unix/SDL_poll.h" #include "SDL_paudio.h" -#define DEBUG_AUDIO 0 +/* #define DEBUG_AUDIO */ /* A conflict within AIX 4.3.3 headers and probably others as well. * I guess nobody ever uses audio... Shame over AIX header files. */ @@ -137,44 +138,31 @@ PAUDIO_WaitDevice(_THIS) SDL_Delay(ticks); } } else { + int timeoutMS; audio_buffer paud_bufinfo; - /* Use select() for audio synchronization */ - struct timeval timeout; - FD_ZERO(&fdset); - FD_SET(this->hidden->audio_fd, &fdset); - if (ioctl(this->hidden->audio_fd, AUDIO_BUFFER, &paud_bufinfo) < 0) { #ifdef DEBUG_AUDIO fprintf(stderr, "Couldn't get audio buffer information\n"); #endif - timeout.tv_sec = 10; - timeout.tv_usec = 0; + timeoutMS = 10 * 1000; } else { - long ms_in_buf = paud_bufinfo.write_buf_time; - timeout.tv_sec = ms_in_buf / 1000; - ms_in_buf = ms_in_buf - timeout.tv_sec * 1000; - timeout.tv_usec = ms_in_buf * 1000; + timeoutMS = paud_bufinfo.write_buf_time; #ifdef DEBUG_AUDIO - fprintf(stderr, - "Waiting for write_buf_time=%ld,%ld\n", - timeout.tv_sec, timeout.tv_usec); + fprintf(stderr, "Waiting for write_buf_time=%d ms\n", timeoutMS); #endif } #ifdef DEBUG_AUDIO fprintf(stderr, "Waiting for audio to get ready\n"); #endif - if (select(this->hidden->audio_fd + 1, NULL, &fdset, NULL, &timeout) - <= 0) { - const char *message = - "Audio timeout - buggy audio driver? (disabled)"; + if (SDL_IOReady(this->hidden->audio_fd, SDL_TRUE, timeoutMS) <= 0) { /* * In general we should never print to the screen, * but in this case we have no other way of letting * the user know what happened. */ - fprintf(stderr, "SDL: %s - %s\n", strerror(errno), message); + fprintf(stderr, "SDL: %s - Audio timeout - buggy audio driver? (disabled)\n", strerror(errno)); SDL_OpenedAudioDeviceDisconnected(this); /* Don't try to close - may hang */ this->hidden->audio_fd = -1; @@ -245,7 +233,6 @@ PAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) SDL_AudioFormat test_format; audio_init paud_init; audio_buffer paud_bufinfo; - audio_status paud_status; audio_control paud_control; audio_change paud_change; int fd = -1; @@ -487,7 +474,7 @@ PAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return SDL_SetError("Can't start audio play"); } - /* Check to see if we need to use select() workaround */ + /* Check to see if we need to use SDL_IOReady() workaround */ if (workaround != NULL) { this->hidden->frame_ticks = (float) (this->spec.samples * 1000) / this->spec.freq; @@ -510,11 +497,11 @@ PAUDIO_Init(SDL_AudioDriverImpl * impl) close(fd); /* Set the function pointers */ - impl->OpenDevice = DSP_OpenDevice; - impl->PlayDevice = DSP_PlayDevice; - impl->PlayDevice = DSP_WaitDevice; - impl->GetDeviceBuf = DSP_GetDeviceBuf; - impl->CloseDevice = DSP_CloseDevice; + impl->OpenDevice = PAUDIO_OpenDevice; + impl->PlayDevice = PAUDIO_PlayDevice; + impl->PlayDevice = PAUDIO_WaitDevice; + impl->GetDeviceBuf = PAUDIO_GetDeviceBuf; + impl->CloseDevice = PAUDIO_CloseDevice; impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: add device enum! */ return 1; /* this audio target is available. */ diff --git a/Engine/lib/sdl/src/audio/paudio/SDL_paudio.h b/Engine/lib/sdl/src/audio/paudio/SDL_paudio.h index ebc8bb5b1..c295ae453 100644 --- a/Engine/lib/sdl/src/audio/paudio/SDL_paudio.h +++ b/Engine/lib/sdl/src/audio/paudio/SDL_paudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_paudaudio_h -#define _SDL_paudaudio_h +#ifndef SDL_paudio_h_ +#define SDL_paudio_h_ #include "../SDL_sysaudio.h" @@ -37,11 +37,12 @@ struct SDL_PrivateAudioData Uint8 *mixbuf; int mixlen; - /* Support for audio timing using a timer, in addition to select() */ + /* Support for audio timing using a timer, in addition to SDL_IOReady() */ float frame_ticks; float next_frame; }; #define FUDGE_TICKS 10 /* The scheduler overhead ticks per frame */ -#endif /* _SDL_paudaudio_h */ +#endif /* SDL_paudio_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/psp/SDL_pspaudio.c b/Engine/lib/sdl/src/audio/psp/SDL_pspaudio.c index bd3456d3f..3e7b8e12f 100644 --- a/Engine/lib/sdl/src/audio/psp/SDL_pspaudio.c +++ b/Engine/lib/sdl/src/audio/psp/SDL_pspaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -80,6 +80,7 @@ PSPAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->spec.channels == 1) { format = PSP_AUDIO_FORMAT_MONO; } else { + this->spec.channels = 2; format = PSP_AUDIO_FORMAT_STEREO; } this->hidden->channel = sceAudioChReserve(PSP_AUDIO_NEXT_CHANNEL, this->spec.samples, format); diff --git a/Engine/lib/sdl/src/audio/psp/SDL_pspaudio.h b/Engine/lib/sdl/src/audio/psp/SDL_pspaudio.h index 6b266bd0c..3f0cdc1ea 100644 --- a/Engine/lib/sdl/src/audio/psp/SDL_pspaudio.h +++ b/Engine/lib/sdl/src/audio/psp/SDL_pspaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_pspaudio_h -#define _SDL_pspaudio_h +#ifndef SDL_pspaudio_h_ +#define SDL_pspaudio_h_ #include "../SDL_sysaudio.h" @@ -40,6 +40,6 @@ struct SDL_PrivateAudioData { int next_buffer; }; -#endif /* _SDL_pspaudio_h */ -/* vim: ts=4 sw=4 - */ +#endif /* SDL_pspaudio_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/pulseaudio/SDL_pulseaudio.c b/Engine/lib/sdl/src/audio/pulseaudio/SDL_pulseaudio.c index 9ced49d21..1e9858063 100644 --- a/Engine/lib/sdl/src/audio/pulseaudio/SDL_pulseaudio.c +++ b/Engine/lib/sdl/src/audio/pulseaudio/SDL_pulseaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,7 +37,6 @@ #endif #include #include -#include #include #include "SDL_timer.h" @@ -250,12 +249,6 @@ getAppName(void) return "SDL Application"; /* oh well. */ } -static void -stream_operation_complete_no_op(pa_stream *s, int success, void *userdata) -{ - /* no-op for pa_stream_drain(), etc, to use for callback. */ -} - static void WaitForPulseOperation(pa_mainloop *mainloop, pa_operation *o) { @@ -427,6 +420,8 @@ static void PULSEAUDIO_FlushCapture(_THIS) { struct SDL_PrivateAudioData *h = this->hidden; + const void *data = NULL; + size_t nbytes = 0; if (h->capturebuf != NULL) { PULSEAUDIO_pa_stream_drop(h->stream); @@ -434,7 +429,22 @@ PULSEAUDIO_FlushCapture(_THIS) h->capturelen = 0; } - WaitForPulseOperation(h->mainloop, PULSEAUDIO_pa_stream_flush(h->stream, stream_operation_complete_no_op, NULL)); + while (SDL_TRUE) { + if (PULSEAUDIO_pa_context_get_state(h->context) != PA_CONTEXT_READY || + PULSEAUDIO_pa_stream_get_state(h->stream) != PA_STREAM_READY || + PULSEAUDIO_pa_mainloop_iterate(h->mainloop, 1, NULL) < 0) { + SDL_OpenedAudioDeviceDisconnected(this); + return; /* uhoh, pulse failed! */ + } + + if (PULSEAUDIO_pa_stream_readable_size(h->stream) == 0) { + break; /* no data available, so we're done. */ + } + + /* a new fragment is available! Just dump it. */ + PULSEAUDIO_pa_stream_peek(h->stream, &data, &nbytes); + PULSEAUDIO_pa_stream_drop(h->stream); /* drop this fragment. */ + } } static void diff --git a/Engine/lib/sdl/src/audio/pulseaudio/SDL_pulseaudio.h b/Engine/lib/sdl/src/audio/pulseaudio/SDL_pulseaudio.h index e12000f2a..61da70be4 100644 --- a/Engine/lib/sdl/src/audio/pulseaudio/SDL_pulseaudio.h +++ b/Engine/lib/sdl/src/audio/pulseaudio/SDL_pulseaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_pulseaudio_h -#define _SDL_pulseaudio_h +#ifndef SDL_pulseaudio_h_ +#define SDL_pulseaudio_h_ #include @@ -47,6 +47,6 @@ struct SDL_PrivateAudioData int capturelen; }; -#endif /* _SDL_pulseaudio_h */ +#endif /* SDL_pulseaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.c b/Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.c index 149cad90a..957ac2d4e 100644 --- a/Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.c +++ b/Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,6 +45,7 @@ #include "SDL_timer.h" #include "SDL_audio.h" +#include "../../core/unix/SDL_poll.h" #include "../SDL_audio_c.h" #include "SDL_qsa_audio.h" @@ -56,24 +57,6 @@ #define DEFAULT_CPARAMS_FRAGS_MIN 1 #define DEFAULT_CPARAMS_FRAGS_MAX 1 -#define QSA_NO_WORKAROUNDS 0x00000000 -#define QSA_MMAP_WORKAROUND 0x00000001 - -struct BuggyCards -{ - char *cardname; - unsigned long bugtype; -}; - -#define QSA_WA_CARDS 3 -#define QSA_MAX_CARD_NAME_LENGTH 33 - -struct BuggyCards buggycards[QSA_WA_CARDS] = { - {"Sound Blaster Live!", QSA_MMAP_WORKAROUND}, - {"Vortex 8820", QSA_MMAP_WORKAROUND}, - {"Vortex 8830", QSA_MMAP_WORKAROUND}, -}; - /* List of found devices */ #define QSA_MAX_DEVICES 32 #define QSA_MAX_NAME_LENGTH 81+16 /* Hardcoded in QSA, can't be changed */ @@ -97,40 +80,16 @@ QSA_SetError(const char *fn, int status) return SDL_SetError("QSA: %s() failed: %s", fn, snd_strerror(status)); } -/* card names check to apply the workarounds */ -static int -QSA_CheckBuggyCards(_THIS, unsigned long checkfor) -{ - char scardname[QSA_MAX_CARD_NAME_LENGTH]; - int it; - - if (snd_card_get_name - (this->hidden->cardno, scardname, QSA_MAX_CARD_NAME_LENGTH - 1) < 0) { - return 0; - } - - for (it = 0; it < QSA_WA_CARDS; it++) { - if (SDL_strcmp(buggycards[it].cardname, scardname) == 0) { - if (buggycards[it].bugtype == checkfor) { - return 1; - } - } - } - - return 0; -} - /* !!! FIXME: does this need to be here? Does the SDL version not work? */ static void QSA_ThreadInit(_THIS) { - struct sched_param param; - int status; - /* Increase default 10 priority to 25 to avoid jerky sound */ - status = SchedGet(0, 0, ¶m); - param.sched_priority = param.sched_curpriority + 15; - status = SchedSet(0, 0, SCHED_NOCHANGE, ¶m); + struct sched_param param; + if (SchedGet(0, 0, ¶m) != -1) { + param.sched_priority = param.sched_curpriority + 15; + SchedSet(0, 0, SCHED_NOCHANGE, ¶m); + } } /* PCM channel parameters initialize function */ @@ -155,67 +114,25 @@ QSA_InitAudioParams(snd_pcm_channel_params_t * cpars) static void QSA_WaitDevice(_THIS) { - fd_set wfds; - fd_set rfds; - int selectret; - struct timeval timeout; + int result; - if (!this->hidden->iscapture) { - FD_ZERO(&wfds); - FD_SET(this->hidden->audio_fd, &wfds); - } else { - FD_ZERO(&rfds); - FD_SET(this->hidden->audio_fd, &rfds); - } - - do { - /* Setup timeout for playing one fragment equal to 2 seconds */ - /* If timeout occured than something wrong with hardware or driver */ - /* For example, Vortex 8820 audio driver stucks on second DAC because */ - /* it doesn't exist ! */ - timeout.tv_sec = 2; - timeout.tv_usec = 0; + /* Setup timeout for playing one fragment equal to 2 seconds */ + /* If timeout occured than something wrong with hardware or driver */ + /* For example, Vortex 8820 audio driver stucks on second DAC because */ + /* it doesn't exist ! */ + result = SDL_IOReady(this->hidden->audio_fd, !this->hidden->iscapture, 2 * 1000); + switch (result) { + case -1: + SDL_SetError("QSA: SDL_IOReady() failed: %s", strerror(errno)); + break; + case 0: + SDL_SetError("QSA: timeout on buffer waiting occured"); + this->hidden->timeout_on_wait = 1; + break; + default: this->hidden->timeout_on_wait = 0; - - if (!this->hidden->iscapture) { - selectret = - select(this->hidden->audio_fd + 1, NULL, &wfds, NULL, - &timeout); - } else { - selectret = - select(this->hidden->audio_fd + 1, &rfds, NULL, NULL, - &timeout); - } - - switch (selectret) { - case -1: - { - SDL_SetError("QSA: select() failed: %s", strerror(errno)); - return; - } - break; - case 0: - { - SDL_SetError("QSA: timeout on buffer waiting occured"); - this->hidden->timeout_on_wait = 1; - return; - } - break; - default: - { - if (!this->hidden->iscapture) { - if (FD_ISSET(this->hidden->audio_fd, &wfds)) { - return; - } - } else { - if (FD_ISSET(this->hidden->audio_fd, &rfds)) { - return; - } - } - } - break; - } - } while (1); + break; + } } static void @@ -357,7 +274,6 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) if (this->hidden == NULL) { return SDL_OutOfMemory(); } - SDL_zerop(this->hidden); /* Initialize channel transfer parameters to default */ QSA_InitAudioParams(&cparams); @@ -371,13 +287,13 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) this->hidden->cardno = device->cardno; status = snd_pcm_open(&this->hidden->audio_handle, device->cardno, device->deviceno, - iscapture ? SND_PCM_OPEN_PLAYBACK : SND_PCM_OPEN_CAPTURE); + iscapture ? SND_PCM_OPEN_CAPTURE : SND_PCM_OPEN_PLAYBACK); } else { /* Open system default audio device */ status = snd_pcm_open_preferred(&this->hidden->audio_handle, &this->hidden->cardno, &this->hidden->deviceno, - iscapture ? SND_PCM_OPEN_PLAYBACK : SND_PCM_OPEN_CAPTURE); + iscapture ? SND_PCM_OPEN_CAPTURE : SND_PCM_OPEN_PLAYBACK); } /* Check if requested device is opened */ @@ -386,16 +302,6 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return QSA_SetError("snd_pcm_open", status); } - if (!QSA_CheckBuggyCards(this, QSA_MMAP_WORKAROUND)) { - /* Disable QSA MMAP plugin for buggy audio drivers */ - status = - snd_pcm_plugin_set_disable(this->hidden->audio_handle, - PLUGIN_DISABLE_MMAP); - if (status < 0) { - return QSA_SetError("snd_pcm_plugin_set_disable", status); - } - } - /* Try for a closest match on audio format */ format = 0; /* can't use format as SND_PCM_SFMT_U8 = 0 in qsa */ @@ -494,7 +400,7 @@ QSA_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) /* Setup the transfer parameters according to cparams */ status = snd_pcm_plugin_params(this->hidden->audio_handle, &cparams); if (status < 0) { - return QSA_SetError("snd_pcm_channel_params", status); + return QSA_SetError("snd_pcm_plugin_params", status); } /* Make sure channel is setup right one last time */ @@ -722,9 +628,6 @@ QSA_Deinitialize(void) static int QSA_Init(SDL_AudioDriverImpl * impl) { - snd_pcm_t *handle = NULL; - int32_t status = 0; - /* Clear devices array */ SDL_zero(qsa_playback_device); SDL_zero(qsa_capture_device); @@ -745,20 +648,12 @@ QSA_Init(SDL_AudioDriverImpl * impl) impl->LockDevice = NULL; impl->UnlockDevice = NULL; - impl->OnlyHasDefaultOutputDevice = 0; impl->ProvidesOwnCallbackThread = 0; impl->SkipMixerLock = 0; impl->HasCaptureSupport = 1; impl->OnlyHasDefaultOutputDevice = 0; impl->OnlyHasDefaultCaptureDevice = 0; - /* Check if io-audio manager is running or not */ - status = snd_cards(); - if (status == 0) { - /* if no, return immediately */ - return 1; - } - return 1; /* this audio target is available. */ } diff --git a/Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.h b/Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.h index 19a2215aa..a6300c1a9 100644 --- a/Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.h +++ b/Engine/lib/sdl/src/audio/qsa/SDL_qsa_audio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/audio/sdlgenaudiocvt.pl b/Engine/lib/sdl/src/audio/sdlgenaudiocvt.pl deleted file mode 100755 index c53f1c355..000000000 --- a/Engine/lib/sdl/src/audio/sdlgenaudiocvt.pl +++ /dev/null @@ -1,761 +0,0 @@ -#!/usr/bin/perl -w - -use warnings; -use strict; - -my @audiotypes = qw( - U8 - S8 - U16LSB - S16LSB - U16MSB - S16MSB - S32LSB - S32MSB - F32LSB - F32MSB -); - -my @channels = ( 1, 2, 4, 6, 8 ); -my %funcs; -my $custom_converters = 0; - - -sub getTypeConvertHashId { - my ($from, $to) = @_; - return "TYPECONVERTER $from/$to"; -} - - -sub getResamplerHashId { - my ($from, $channels, $upsample, $multiple) = @_; - return "RESAMPLER $from/$channels/$upsample/$multiple"; -} - - -sub outputHeader { - print < - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#include "../SDL_internal.h" -#include "SDL_audio.h" -#include "SDL_audio_c.h" - -#ifndef DEBUG_CONVERT -#define DEBUG_CONVERT 0 -#endif - - -/* If you can guarantee your data and need space, you can eliminate code... */ - -/* Just build the arbitrary resamplers if you're saving code space. */ -#ifndef LESS_RESAMPLERS -#define LESS_RESAMPLERS 0 -#endif - -/* Don't build any resamplers if you're REALLY saving code space. */ -#ifndef NO_RESAMPLERS -#define NO_RESAMPLERS 0 -#endif - -/* Don't build any type converters if you're saving code space. */ -#ifndef NO_CONVERTERS -#define NO_CONVERTERS 0 -#endif - - -/* *INDENT-OFF* */ - -EOF - - my @vals = ( 127, 32767, 2147483647 ); - foreach (@vals) { - my $val = $_; - my $fval = 1.0 / $val; - print("#define DIVBY${val} ${fval}f\n"); - } - - print("\n"); -} - -sub outputFooter { - print < 8) { - $code = "SDL_Swap${BEorLE}${size}($val)"; - } else { - $code = $val; - } - - if (($signed) and (!$float)) { - $code = "((Sint${size}) $code)"; - } - } - - return "${code}"; -} - - -sub maxIntVal { - my $size = shift; - if ($size == 8) { - return 0x7F; - } elsif ($size == 16) { - return 0x7FFF; - } elsif ($size == 32) { - return 0x7FFFFFFF; - } - - die("bug in script.\n"); -} - -sub getFloatToIntMult { - my $size = shift; - my $val = maxIntVal($size) . '.0'; - $val .= 'f' if ($size < 32); - return $val; -} - -sub getIntToFloatDivBy { - my $size = shift; - return 'DIVBY' . maxIntVal($size); -} - -sub getSignFlipVal { - my $size = shift; - if ($size == 8) { - return '0x80'; - } elsif ($size == 16) { - return '0x8000'; - } elsif ($size == 32) { - return '0x80000000'; - } - - die("bug in script.\n"); -} - -sub buildCvtFunc { - my ($from, $to) = @_; - my ($fsigned, $ffloat, $fsize, $fendian, $fctype) = splittype($from); - my ($tsigned, $tfloat, $tsize, $tendian, $tctype) = splittype($to); - my $diffs = 0; - $diffs++ if ($fsize != $tsize); - $diffs++ if ($fsigned != $tsigned); - $diffs++ if ($ffloat != $tfloat); - $diffs++ if ($fendian ne $tendian); - - return if ($diffs == 0); - - my $hashid = getTypeConvertHashId($from, $to); - if (1) { # !!! FIXME: if ($diffs > 1) { - my $sym = "SDL_Convert_${from}_to_${to}"; - $funcs{$hashid} = $sym; - $custom_converters++; - - # Always unsigned for ints, for possible byteswaps. - my $srctype = (($ffloat) ? 'float' : "Uint${fsize}"); - - print <buf + cvt->len_cvt)) - 1; - dst = (($tctype *) (cvt->buf + cvt->len_cvt * $mult)) - 1; - for (i = cvt->len_cvt / sizeof ($srctype); i; --i, --src, --dst) { -EOF - } else { - print <buf; - dst = ($tctype *) cvt->buf; - for (i = cvt->len_cvt / sizeof ($srctype); i; --i, ++src, ++dst) { -EOF - } - - # Have to convert to/from float/int. - # !!! FIXME: cast through double for int32<->float? - my $code = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, '*src'); - if ($ffloat != $tfloat) { - if ($ffloat) { - my $mult = getFloatToIntMult($tsize); - if (!$tsigned) { # bump from -1.0f/1.0f to 0.0f/2.0f - $code = "($code + 1.0f)"; - } - $code = "(($tctype) ($code * $mult))"; - } else { - # $divby will be the reciprocal, to avoid pipeline stalls - # from floating point division...so multiply it. - my $divby = getIntToFloatDivBy($fsize); - $code = "(((float) $code) * $divby)"; - if (!$fsigned) { # bump from 0.0f/2.0f to -1.0f/1.0f. - $code = "($code - 1.0f)"; - } - } - } else { - # All integer conversions here. - if ($fsigned != $tsigned) { - my $signflipval = getSignFlipVal($fsize); - $code = "(($code) ^ $signflipval)"; - } - - my $shiftval = abs($fsize - $tsize); - if ($fsize < $tsize) { - $code = "((($tctype) $code) << $shiftval)"; - } elsif ($fsize > $tsize) { - $code = "(($tctype) ($code >> $shiftval))"; - } - } - - my $swap = getSwapFunc($tsize, $tsigned, $tfloat, $tendian, 'val'); - - print < $tsize) { - my $divby = $fsize / $tsize; - print(" cvt->len_cvt /= $divby;\n"); - } elsif ($fsize < $tsize) { - my $mult = $tsize / $fsize; - print(" cvt->len_cvt *= $mult;\n"); - } - - print <filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, AUDIO_$to); - } -} - -EOF - - } else { - if ($fsigned != $tsigned) { - $funcs{$hashid} = 'SDL_ConvertSigned'; - } elsif ($ffloat != $tfloat) { - $funcs{$hashid} = 'SDL_ConvertFloat'; - } elsif ($fsize != $tsize) { - $funcs{$hashid} = 'SDL_ConvertSize'; - } elsif ($fendian ne $tendian) { - $funcs{$hashid} = 'SDL_ConvertEndian'; - } else { - die("error in script.\n"); - } - } -} - - -sub buildTypeConverters { - print "#if !NO_CONVERTERS\n\n"; - foreach (@audiotypes) { - my $from = $_; - foreach (@audiotypes) { - my $to = $_; - buildCvtFunc($from, $to); - } - } - print "#endif /* !NO_CONVERTERS */\n\n\n"; - - print "const SDL_AudioTypeFilters sdl_audio_type_filters[] =\n{\n"; - print "#if !NO_CONVERTERS\n"; - foreach (@audiotypes) { - my $from = $_; - foreach (@audiotypes) { - my $to = $_; - if ($from ne $to) { - my $hashid = getTypeConvertHashId($from, $to); - my $sym = $funcs{$hashid}; - print(" { AUDIO_$from, AUDIO_$to, $sym },\n"); - } - } - } - print "#endif /* !NO_CONVERTERS */\n"; - - print(" { 0, 0, NULL }\n"); - print "};\n\n\n"; -} - -sub getBiggerCtype { - my ($isfloat, $size) = @_; - - if ($isfloat) { - if ($size == 32) { - return 'double'; - } - die("bug in script.\n"); - } - - if ($size == 8) { - return 'Sint16'; - } elsif ($size == 16) { - return 'Sint32' - } elsif ($size == 32) { - return 'Sint64' - } - - die("bug in script.\n"); -} - - -# These handle arbitrary resamples...44100Hz to 48000Hz, for example. -# Man, this code is skanky. -sub buildArbitraryResampleFunc { - # !!! FIXME: we do a lot of unnecessary and ugly casting in here, due to getSwapFunc(). - my ($from, $channels, $upsample) = @_; - my ($fsigned, $ffloat, $fsize, $fendian, $fctype) = splittype($from); - - my $bigger = getBiggerCtype($ffloat, $fsize); - my $interp = ($ffloat) ? '* 0.5' : '>> 1'; - - my $resample = ($upsample) ? 'Upsample' : 'Downsample'; - my $hashid = getResamplerHashId($from, $channels, $upsample, 0); - my $sym = "SDL_${resample}_${from}_${channels}c"; - $funcs{$hashid} = $sym; - $custom_converters++; - - my $fudge = $fsize * $channels * 2; # !!! FIXME - my $eps_adjust = ($upsample) ? 'dstsize' : 'srcsize'; - my $incr = ''; - my $incr2 = ''; - my $block_align = $channels * $fsize/8; - - - # !!! FIXME: DEBUG_CONVERT should report frequencies. - print <rate_incr); -#endif - - const int srcsize = cvt->len_cvt - $fudge; - const int dstsize = (int) (((double)(cvt->len_cvt/${block_align})) * cvt->rate_incr) * ${block_align}; - register int eps = 0; -EOF - - my $endcomparison = '!='; - - # Upsampling (growing the buffer) needs to work backwards, since we - # overwrite the buffer as we go. - if ($upsample) { - $endcomparison = '>='; # dst > target - print <buf + dstsize)) - $channels; - const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels; - const $fctype *target = ((const $fctype *) cvt->buf); -EOF - } else { - $endcomparison = '<'; # dst < target - print <buf; - const $fctype *src = ($fctype *) cvt->buf; - const $fctype *target = (const $fctype *) (cvt->buf + dstsize); -EOF - } - - for (my $i = 0; $i < $channels; $i++) { - my $idx = ($upsample) ? (($channels - $i) - 1) : $i; - my $val = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, "src[$idx]"); - print <= dstsize) { - $incr2; -EOF - } else { # downsample. - $incr = ($channels == 1) ? 'src++' : "src += $channels"; - print <= srcsize) { -EOF - for (my $i = 0; $i < $channels; $i++) { - my $val = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, "sample${i}"); - print <len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -EOF - -} - -# These handle clean resamples...doubling and quadrupling the sample rate, etc. -sub buildMultipleResampleFunc { - # !!! FIXME: we do a lot of unnecessary and ugly casting in here, due to getSwapFunc(). - my ($from, $channels, $upsample, $multiple) = @_; - my ($fsigned, $ffloat, $fsize, $fendian, $fctype) = splittype($from); - - my $bigger = getBiggerCtype($ffloat, $fsize); - my $interp = ($ffloat) ? '* 0.5' : '>> 1'; - my $interp2 = ($ffloat) ? '* 0.25' : '>> 2'; - my $mult3 = ($ffloat) ? '3.0' : '3'; - my $lencvtop = ($upsample) ? '*' : '/'; - - my $resample = ($upsample) ? 'Upsample' : 'Downsample'; - my $hashid = getResamplerHashId($from, $channels, $upsample, $multiple); - my $sym = "SDL_${resample}_${from}_${channels}c_x${multiple}"; - $funcs{$hashid} = $sym; - $custom_converters++; - - # !!! FIXME: DEBUG_CONVERT should report frequencies. - print <len_cvt $lencvtop $multiple; -EOF - - my $endcomparison = '!='; - - # Upsampling (growing the buffer) needs to work backwards, since we - # overwrite the buffer as we go. - if ($upsample) { - $endcomparison = '>='; # dst > target - print <buf + dstsize)) - $channels * $multiple; - const $fctype *src = (($fctype *) (cvt->buf + cvt->len_cvt)) - $channels; - const $fctype *target = ((const $fctype *) cvt->buf); -EOF - } else { - $endcomparison = '<'; # dst < target - print <buf; - const $fctype *src = ($fctype *) cvt->buf; - const $fctype *target = (const $fctype *) (cvt->buf + dstsize); -EOF - } - - for (my $i = 0; $i < $channels; $i++) { - my $idx = ($upsample) ? (($channels - $i) - 1) : $i; - my $val = getSwapFunc($fsize, $fsigned, $ffloat, $fendian, "src[$idx]"); - print <= 0; $i--) { - my $dsti = $i + $channels; - print <= 0; $i--) { - my $dsti = $i; - print <= 0; $i--) { - my $dsti = $i + ($channels * 3); - print <= 0; $i--) { - my $dsti = $i + ($channels * 2); - print <= 0; $i--) { - my $dsti = $i + ($channels * 1); - print <= 0; $i--) { - my $dsti = $i + ($channels * 0); - print <len_cvt = dstsize; - if (cvt->filters[++cvt->filter_index]) { - cvt->filters[cvt->filter_index] (cvt, format); - } -} - -EOF - -} - -sub buildResamplers { - print "#if !NO_RESAMPLERS\n\n"; - foreach (@audiotypes) { - my $from = $_; - foreach (@channels) { - my $channel = $_; - buildArbitraryResampleFunc($from, $channel, 1); - buildArbitraryResampleFunc($from, $channel, 0); - } - } - - print "\n#if !LESS_RESAMPLERS\n\n"; - foreach (@audiotypes) { - my $from = $_; - foreach (@channels) { - my $channel = $_; - for (my $multiple = 2; $multiple <= 4; $multiple += 2) { - buildMultipleResampleFunc($from, $channel, 1, $multiple); - buildMultipleResampleFunc($from, $channel, 0, $multiple); - } - } - } - - print "#endif /* !LESS_RESAMPLERS */\n"; - print "#endif /* !NO_RESAMPLERS */\n\n\n"; - - print "const SDL_AudioRateFilters sdl_audio_rate_filters[] =\n{\n"; - print "#if !NO_RESAMPLERS\n"; - foreach (@audiotypes) { - my $from = $_; - foreach (@channels) { - my $channel = $_; - for (my $upsample = 0; $upsample <= 1; $upsample++) { - my $hashid = getResamplerHashId($from, $channel, $upsample, 0); - my $sym = $funcs{$hashid}; - print(" { AUDIO_$from, $channel, $upsample, 0, $sym },\n"); - } - } - } - - print "#if !LESS_RESAMPLERS\n"; - foreach (@audiotypes) { - my $from = $_; - foreach (@channels) { - my $channel = $_; - for (my $multiple = 2; $multiple <= 4; $multiple += 2) { - for (my $upsample = 0; $upsample <= 1; $upsample++) { - my $hashid = getResamplerHashId($from, $channel, $upsample, $multiple); - my $sym = $funcs{$hashid}; - print(" { AUDIO_$from, $channel, $upsample, $multiple, $sym },\n"); - } - } - } - } - - print "#endif /* !LESS_RESAMPLERS */\n"; - print "#endif /* !NO_RESAMPLERS */\n"; - print(" { 0, 0, 0, 0, NULL }\n"); - print "};\n\n"; -} - - -# mainline ... - -outputHeader(); -buildTypeConverters(); -buildResamplers(); -outputFooter(); - -exit 0; - -# end of sdlgenaudiocvt.pl ... - diff --git a/Engine/lib/sdl/src/audio/sndio/SDL_sndioaudio.c b/Engine/lib/sdl/src/audio/sndio/SDL_sndioaudio.c index fb7d78ff1..4a4917184 100644 --- a/Engine/lib/sdl/src/audio/sndio/SDL_sndioaudio.c +++ b/Engine/lib/sdl/src/audio/sndio/SDL_sndioaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,6 +33,7 @@ #include #endif +#include #include #include "SDL_audio.h" @@ -43,6 +44,14 @@ #include "SDL_loadso.h" #endif +#ifndef INFTIM +#define INFTIM -1 +#endif + +#ifndef SIO_DEVANY +#define SIO_DEVANY "default" +#endif + static struct sio_hdl * (*SNDIO_sio_open)(const char *, unsigned int, int); static void (*SNDIO_sio_close)(struct sio_hdl *); static int (*SNDIO_sio_setpar)(struct sio_hdl *, struct sio_par *); @@ -51,6 +60,10 @@ static int (*SNDIO_sio_start)(struct sio_hdl *); static int (*SNDIO_sio_stop)(struct sio_hdl *); static size_t (*SNDIO_sio_read)(struct sio_hdl *, void *, size_t); static size_t (*SNDIO_sio_write)(struct sio_hdl *, const void *, size_t); +static int (*SNDIO_sio_nfds)(struct sio_hdl *); +static int (*SNDIO_sio_pollfd)(struct sio_hdl *, struct pollfd *, int); +static int (*SNDIO_sio_revents)(struct sio_hdl *, struct pollfd *); +static int (*SNDIO_sio_eof)(struct sio_hdl *); static void (*SNDIO_sio_initpar)(struct sio_par *); #ifdef SDL_AUDIO_DRIVER_SNDIO_DYNAMIC @@ -87,6 +100,10 @@ load_sndio_syms(void) SDL_SNDIO_SYM(sio_stop); SDL_SNDIO_SYM(sio_read); SDL_SNDIO_SYM(sio_write); + SDL_SNDIO_SYM(sio_nfds); + SDL_SNDIO_SYM(sio_pollfd); + SDL_SNDIO_SYM(sio_revents); + SDL_SNDIO_SYM(sio_eof); SDL_SNDIO_SYM(sio_initpar); return 0; } @@ -164,6 +181,41 @@ SNDIO_PlayDevice(_THIS) #endif } +static int +SNDIO_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + size_t r; + int revents; + int nfds; + + /* Emulate a blocking read */ + r = SNDIO_sio_read(this->hidden->dev, buffer, buflen); + while (r == 0 && !SNDIO_sio_eof(this->hidden->dev)) { + if ((nfds = SNDIO_sio_pollfd(this->hidden->dev, this->hidden->pfd, POLLIN)) <= 0 + || poll(this->hidden->pfd, nfds, INFTIM) < 0) { + return -1; + } + revents = SNDIO_sio_revents(this->hidden->dev, this->hidden->pfd); + if (revents & POLLIN) { + r = SNDIO_sio_read(this->hidden->dev, buffer, buflen); + } + if (revents & POLLHUP) { + break; + } + } + return (int) r; +} + +static void +SNDIO_FlushCapture(_THIS) +{ + char buf[512]; + + while (SNDIO_sio_read(this->hidden->dev, buf, sizeof(buf)) != 0) { + /* do nothing */; + } +} + static Uint8 * SNDIO_GetDeviceBuf(_THIS) { @@ -173,6 +225,9 @@ SNDIO_GetDeviceBuf(_THIS) static void SNDIO_CloseDevice(_THIS) { + if ( this->hidden->pfd != NULL ) { + SDL_free(this->hidden->pfd); + } if ( this->hidden->dev != NULL ) { SNDIO_sio_stop(this->hidden->dev); SNDIO_sio_close(this->hidden->dev); @@ -197,11 +252,19 @@ SNDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) this->hidden->mixlen = this->spec.size; - /* !!! FIXME: SIO_DEVANY can be a specific device... */ - if ((this->hidden->dev = SNDIO_sio_open(SIO_DEVANY, SIO_PLAY, 0)) == NULL) { + /* Capture devices must be non-blocking for SNDIO_FlushCapture */ + if ((this->hidden->dev = + SNDIO_sio_open(devname != NULL ? devname : SIO_DEVANY, + iscapture ? SIO_REC : SIO_PLAY, iscapture)) == NULL) { return SDL_SetError("sio_open() failed"); } + /* Allocate the pollfd array for capture devices */ + if (iscapture && (this->hidden->pfd = + SDL_malloc(sizeof(struct pollfd) * SNDIO_sio_nfds(this->hidden->dev))) == NULL) { + return SDL_OutOfMemory(); + } + SNDIO_sio_initpar(&par); par.rate = this->spec.freq; @@ -300,8 +363,12 @@ SNDIO_Init(SDL_AudioDriverImpl * impl) impl->PlayDevice = SNDIO_PlayDevice; impl->GetDeviceBuf = SNDIO_GetDeviceBuf; impl->CloseDevice = SNDIO_CloseDevice; + impl->CaptureFromDevice = SNDIO_CaptureFromDevice; + impl->FlushCapture = SNDIO_FlushCapture; impl->Deinitialize = SNDIO_Deinitialize; - impl->OnlyHasDefaultOutputDevice = 1; /* !!! FIXME: sndio can handle multiple devices. */ + + impl->AllowsArbitraryDeviceNames = 1; + impl->HasCaptureSupport = SDL_TRUE; return 1; /* this audio target is available. */ } diff --git a/Engine/lib/sdl/src/audio/sndio/SDL_sndioaudio.h b/Engine/lib/sdl/src/audio/sndio/SDL_sndioaudio.h index 1e748ac93..144bbc22b 100644 --- a/Engine/lib/sdl/src/audio/sndio/SDL_sndioaudio.h +++ b/Engine/lib/sdl/src/audio/sndio/SDL_sndioaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,9 +20,10 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_sndioaudio_h -#define _SDL_sndioaudio_h +#ifndef SDL_sndioaudio_h_ +#define SDL_sndioaudio_h_ +#include #include #include "../SDL_sysaudio.h" @@ -38,8 +39,11 @@ struct SDL_PrivateAudioData /* Raw mixing buffer */ Uint8 *mixbuf; int mixlen; + + /* Polling structures for non-blocking sndio devices */ + struct pollfd *pfd; }; -#endif /* _SDL_sndioaudio_h */ +#endif /* SDL_sndioaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/sun/SDL_sunaudio.c b/Engine/lib/sdl/src/audio/sun/SDL_sunaudio.c index b994c12c3..ddf94b3a3 100644 --- a/Engine/lib/sdl/src/audio/sun/SDL_sunaudio.c +++ b/Engine/lib/sdl/src/audio/sun/SDL_sunaudio.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,6 +40,7 @@ #include "SDL_timer.h" #include "SDL_audio.h" +#include "../../core/unix/SDL_poll.h" #include "../SDL_audio_c.h" #include "../SDL_audiodev_c.h" #include "SDL_sunaudio.h" @@ -97,11 +98,7 @@ SUNAUDIO_WaitDevice(_THIS) } } #else - fd_set fdset; - - FD_ZERO(&fdset); - FD_SET(this->hidden->audio_fd, &fdset); - select(this->hidden->audio_fd + 1, NULL, &fdset, NULL, NULL); + SDL_IOReady(this->hidden->audio_fd, SDL_TRUE, -1); #endif } @@ -193,6 +190,10 @@ SUNAUDIO_CloseDevice(_THIS) static int SUNAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) { +#ifdef AUDIO_SETINFO + int enc; +#endif + int desired_freq = 0; const int flags = ((iscapture) ? OPEN_FLAGS_INPUT : OPEN_FLAGS_OUTPUT); SDL_AudioFormat format = 0; audio_info_t info; @@ -220,10 +221,7 @@ SUNAUDIO_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) return SDL_SetError("Couldn't open %s: %s", devname, strerror(errno)); } -#ifdef AUDIO_SETINFO - int enc; -#endif - int desired_freq = this->spec.freq; + desired_freq = this->spec.freq; /* Determine the audio parameters from the AudioSpec */ switch (SDL_AUDIO_BITSIZE(this->spec.format)) { diff --git a/Engine/lib/sdl/src/audio/sun/SDL_sunaudio.h b/Engine/lib/sdl/src/audio/sun/SDL_sunaudio.h index ecced0f51..2b7d57bde 100644 --- a/Engine/lib/sdl/src/audio/sun/SDL_sunaudio.h +++ b/Engine/lib/sdl/src/audio/sun/SDL_sunaudio.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_sunaudio_h -#define _SDL_sunaudio_h +#ifndef SDL_sunaudio_h_ +#define SDL_sunaudio_h_ #include "../SDL_sysaudio.h" @@ -42,6 +42,6 @@ struct SDL_PrivateAudioData int frequency; /* The audio frequency in KHz */ }; -#endif /* _SDL_sunaudio_h */ +#endif /* SDL_sunaudio_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.c b/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.c new file mode 100644 index 000000000..b7c8dda5d --- /dev/null +++ b/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.c @@ -0,0 +1,779 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_AUDIO_DRIVER_WASAPI + +#include "../../core/windows/SDL_windows.h" +#include "SDL_audio.h" +#include "SDL_timer.h" +#include "../SDL_audio_c.h" +#include "../SDL_sysaudio.h" +#include "SDL_assert.h" +#include "SDL_log.h" + +#define COBJMACROS +#include +#include + +#include "SDL_wasapi.h" + +/* This constant isn't available on MinGW-w64 */ +#ifndef AUDCLNT_STREAMFLAGS_RATEADJUST +#define AUDCLNT_STREAMFLAGS_RATEADJUST 0x00100000 +#endif + +/* these increment as default devices change. Opened default devices pick up changes in their threads. */ +SDL_atomic_t WASAPI_DefaultPlaybackGeneration; +SDL_atomic_t WASAPI_DefaultCaptureGeneration; + +/* This is a list of device id strings we have inflight, so we have consistent pointers to the same device. */ +typedef struct DevIdList +{ + WCHAR *str; + struct DevIdList *next; +} DevIdList; + +static DevIdList *deviceid_list = NULL; + +/* Some GUIDs we need to know without linking to libraries that aren't available before Vista. */ +static const IID SDL_IID_IAudioRenderClient = { 0xf294acfc, 0x3146, 0x4483,{ 0xa7, 0xbf, 0xad, 0xdc, 0xa7, 0xc2, 0x60, 0xe2 } }; +static const IID SDL_IID_IAudioCaptureClient = { 0xc8adbd64, 0xe71e, 0x48a0,{ 0xa4, 0xde, 0x18, 0x5c, 0x39, 0x5c, 0xd3, 0x17 } }; +static const GUID SDL_KSDATAFORMAT_SUBTYPE_PCM = { 0x00000001, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } }; +static const GUID SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT = { 0x00000003, 0x0000, 0x0010,{ 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 } }; + +static SDL_bool +WStrEqual(const WCHAR *a, const WCHAR *b) +{ + while (*a) { + if (*a != *b) { + return SDL_FALSE; + } + a++; + b++; + } + return *b == 0; +} + +static size_t +WStrLen(const WCHAR *wstr) +{ + size_t retval = 0; + if (wstr) { + while (*(wstr++)) { + retval++; + } + } + return retval; +} + +static WCHAR * +WStrDupe(const WCHAR *wstr) +{ + const size_t len = (WStrLen(wstr) + 1) * sizeof (WCHAR); + WCHAR *retval = (WCHAR *) SDL_malloc(len); + if (retval) { + SDL_memcpy(retval, wstr, len); + } + return retval; +} + + +void +WASAPI_RemoveDevice(const SDL_bool iscapture, LPCWSTR devid) +{ + DevIdList *i; + DevIdList *next; + DevIdList *prev = NULL; + for (i = deviceid_list; i; i = next) { + next = i->next; + if (WStrEqual(i->str, devid)) { + if (prev) { + prev->next = next; + } else { + deviceid_list = next; + } + SDL_RemoveAudioDevice(iscapture, i->str); + SDL_free(i->str); + SDL_free(i); + } + prev = i; + } +} + +void +WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, LPCWSTR devid) +{ + DevIdList *devidlist; + + /* You can have multiple endpoints on a device that are mutually exclusive ("Speakers" vs "Line Out" or whatever). + In a perfect world, things that are unplugged won't be in this collection. The only gotcha is probably for + phones and tablets, where you might have an internal speaker and a headphone jack and expect both to be + available and switch automatically. (!!! FIXME...?) */ + + /* see if we already have this one. */ + for (devidlist = deviceid_list; devidlist; devidlist = devidlist->next) { + if (WStrEqual(devidlist->str, devid)) { + return; /* we already have this. */ + } + } + + devidlist = (DevIdList *) SDL_malloc(sizeof (*devidlist)); + if (!devidlist) { + return; /* oh well. */ + } + + devid = WStrDupe(devid); + if (!devid) { + SDL_free(devidlist); + return; /* oh well. */ + } + + devidlist->str = (WCHAR *) devid; + devidlist->next = deviceid_list; + deviceid_list = devidlist; + + SDL_AddAudioDevice(iscapture, devname, (void *) devid); +} + +static void +WASAPI_DetectDevices(void) +{ + WASAPI_EnumerateEndpoints(); +} + +static int +WASAPI_GetPendingBytes(_THIS) +{ + UINT32 frames = 0; + + /* it's okay to fail here; we'll deal with failures in the audio thread. */ + /* FIXME: need a lock around checking this->hidden->client */ + if (this->hidden->client != NULL) { /* definitely activated? */ + if (FAILED(IAudioClient_GetCurrentPadding(this->hidden->client, &frames))) { + return 0; /* oh well. */ + } + } + return ((int) frames) * this->hidden->framesize; +} + +static SDL_INLINE SDL_bool +WasapiFailed(_THIS, const HRESULT err) +{ + if (err == S_OK) { + return SDL_FALSE; + } + + if (err == AUDCLNT_E_DEVICE_INVALIDATED) { + this->hidden->device_lost = SDL_TRUE; + } else if (SDL_AtomicGet(&this->enabled)) { + IAudioClient_Stop(this->hidden->client); + SDL_OpenedAudioDeviceDisconnected(this); + SDL_assert(!SDL_AtomicGet(&this->enabled)); + } + + return SDL_TRUE; +} + +static int +UpdateAudioStream(_THIS, const SDL_AudioSpec *oldspec) +{ + /* Since WASAPI requires us to handle all audio conversion, and our + device format might have changed, we might have to add/remove/change + the audio stream that the higher level uses to convert data, so + SDL keeps firing the callback as if nothing happened here. */ + + if ( (this->callbackspec.channels == this->spec.channels) && + (this->callbackspec.format == this->spec.format) && + (this->callbackspec.freq == this->spec.freq) && + (this->callbackspec.samples == this->spec.samples) ) { + /* no need to buffer/convert in an AudioStream! */ + SDL_FreeAudioStream(this->stream); + this->stream = NULL; + } else if ( (oldspec->channels == this->spec.channels) && + (oldspec->format == this->spec.format) && + (oldspec->freq == this->spec.freq) ) { + /* The existing audio stream is okay to keep using. */ + } else { + /* replace the audiostream for new format */ + SDL_FreeAudioStream(this->stream); + if (this->iscapture) { + this->stream = SDL_NewAudioStream(this->spec.format, + this->spec.channels, this->spec.freq, + this->callbackspec.format, + this->callbackspec.channels, + this->callbackspec.freq); + } else { + this->stream = SDL_NewAudioStream(this->callbackspec.format, + this->callbackspec.channels, + this->callbackspec.freq, this->spec.format, + this->spec.channels, this->spec.freq); + } + + if (!this->stream) { + return -1; + } + } + + /* make sure our scratch buffer can cover the new device spec. */ + if (this->spec.size > this->work_buffer_len) { + Uint8 *ptr = (Uint8 *) SDL_realloc(this->work_buffer, this->spec.size); + if (ptr == NULL) { + return SDL_OutOfMemory(); + } + this->work_buffer = ptr; + this->work_buffer_len = this->spec.size; + } + + return 0; +} + + +static void ReleaseWasapiDevice(_THIS); + +static SDL_bool +RecoverWasapiDevice(_THIS) +{ + ReleaseWasapiDevice(this); /* dump the lost device's handles. */ + + if (this->hidden->default_device_generation) { + this->hidden->default_device_generation = SDL_AtomicGet(this->iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration); + } + + /* this can fail for lots of reasons, but the most likely is we had a + non-default device that was disconnected, so we can't recover. Default + devices try to reinitialize whatever the new default is, so it's more + likely to carry on here, but this handles a non-default device that + simply had its format changed in the Windows Control Panel. */ + if (WASAPI_ActivateDevice(this, SDL_TRUE) == -1) { + SDL_OpenedAudioDeviceDisconnected(this); + return SDL_FALSE; + } + + this->hidden->device_lost = SDL_FALSE; + + return SDL_TRUE; /* okay, carry on with new device details! */ +} + +static SDL_bool +RecoverWasapiIfLost(_THIS) +{ + const int generation = this->hidden->default_device_generation; + SDL_bool lost = this->hidden->device_lost; + + if (!SDL_AtomicGet(&this->enabled)) { + return SDL_FALSE; /* already failed. */ + } + + if (!this->hidden->client) { + return SDL_TRUE; /* still waiting for activation. */ + } + + if (!lost && (generation > 0)) { /* is a default device? */ + const int newgen = SDL_AtomicGet(this->iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration); + if (generation != newgen) { /* the desired default device was changed, jump over to it. */ + lost = SDL_TRUE; + } + } + + return lost ? RecoverWasapiDevice(this) : SDL_TRUE; +} + +static Uint8 * +WASAPI_GetDeviceBuf(_THIS) +{ + /* get an endpoint buffer from WASAPI. */ + BYTE *buffer = NULL; + + while (RecoverWasapiIfLost(this) && this->hidden->render) { + if (!WasapiFailed(this, IAudioRenderClient_GetBuffer(this->hidden->render, this->spec.samples, &buffer))) { + return (Uint8 *) buffer; + } + SDL_assert(buffer == NULL); + } + + return (Uint8 *) buffer; +} + +static void +WASAPI_PlayDevice(_THIS) +{ + if (this->hidden->render != NULL) { /* definitely activated? */ + /* WasapiFailed() will mark the device for reacquisition or removal elsewhere. */ + WasapiFailed(this, IAudioRenderClient_ReleaseBuffer(this->hidden->render, this->spec.samples, 0)); + } +} + +static void +WASAPI_WaitDevice(_THIS) +{ + while (RecoverWasapiIfLost(this) && this->hidden->client && this->hidden->event) { + /*SDL_Log("WAITDEVICE");*/ + if (WaitForSingleObjectEx(this->hidden->event, INFINITE, FALSE) == WAIT_OBJECT_0) { + const UINT32 maxpadding = this->spec.samples; + UINT32 padding = 0; + if (!WasapiFailed(this, IAudioClient_GetCurrentPadding(this->hidden->client, &padding))) { + /*SDL_Log("WASAPI EVENT! padding=%u maxpadding=%u", (unsigned int)padding, (unsigned int)maxpadding);*/ + if (padding <= maxpadding) { + break; + } + } + } else { + /*SDL_Log("WASAPI FAILED EVENT!");*/ + IAudioClient_Stop(this->hidden->client); + SDL_OpenedAudioDeviceDisconnected(this); + } + } +} + +static int +WASAPI_CaptureFromDevice(_THIS, void *buffer, int buflen) +{ + SDL_AudioStream *stream = this->hidden->capturestream; + const int avail = SDL_AudioStreamAvailable(stream); + if (avail > 0) { + const int cpy = SDL_min(buflen, avail); + SDL_AudioStreamGet(stream, buffer, cpy); + return cpy; + } + + while (RecoverWasapiIfLost(this)) { + HRESULT ret; + BYTE *ptr = NULL; + UINT32 frames = 0; + DWORD flags = 0; + + /* uhoh, client isn't activated yet, just return silence. */ + if (!this->hidden->capture) { + /* Delay so we run at about the speed that audio would be arriving. */ + SDL_Delay(((this->spec.samples * 1000) / this->spec.freq)); + SDL_memset(buffer, this->spec.silence, buflen); + return buflen; + } + + ret = IAudioCaptureClient_GetBuffer(this->hidden->capture, &ptr, &frames, &flags, NULL, NULL); + if (ret != AUDCLNT_S_BUFFER_EMPTY) { + WasapiFailed(this, ret); /* mark device lost/failed if necessary. */ + } + + if ((ret == AUDCLNT_S_BUFFER_EMPTY) || !frames) { + WASAPI_WaitDevice(this); + } else if (ret == S_OK) { + const int total = ((int) frames) * this->hidden->framesize; + const int cpy = SDL_min(buflen, total); + const int leftover = total - cpy; + const SDL_bool silent = (flags & AUDCLNT_BUFFERFLAGS_SILENT) ? SDL_TRUE : SDL_FALSE; + + if (silent) { + SDL_memset(buffer, this->spec.silence, cpy); + } else { + SDL_memcpy(buffer, ptr, cpy); + } + + if (leftover > 0) { + ptr += cpy; + if (silent) { + SDL_memset(ptr, this->spec.silence, leftover); /* I guess this is safe? */ + } + + if (SDL_AudioStreamPut(stream, ptr, leftover) == -1) { + return -1; /* uhoh, out of memory, etc. Kill device. :( */ + } + } + + ret = IAudioCaptureClient_ReleaseBuffer(this->hidden->capture, frames); + WasapiFailed(this, ret); /* mark device lost/failed if necessary. */ + + return cpy; + } + } + + return -1; /* unrecoverable error. */ +} + +static void +WASAPI_FlushCapture(_THIS) +{ + BYTE *ptr = NULL; + UINT32 frames = 0; + DWORD flags = 0; + + if (!this->hidden->capture) { + return; /* not activated yet? */ + } + + /* just read until we stop getting packets, throwing them away. */ + while (SDL_TRUE) { + const HRESULT ret = IAudioCaptureClient_GetBuffer(this->hidden->capture, &ptr, &frames, &flags, NULL, NULL); + if (ret == AUDCLNT_S_BUFFER_EMPTY) { + break; /* no more buffered data; we're done. */ + } else if (WasapiFailed(this, ret)) { + break; /* failed for some other reason, abort. */ + } else if (WasapiFailed(this, IAudioCaptureClient_ReleaseBuffer(this->hidden->capture, frames))) { + break; /* something broke. */ + } + } + SDL_AudioStreamClear(this->hidden->capturestream); +} + +static void +ReleaseWasapiDevice(_THIS) +{ + if (this->hidden->client) { + IAudioClient_Stop(this->hidden->client); + IAudioClient_SetEventHandle(this->hidden->client, NULL); + IAudioClient_Release(this->hidden->client); + this->hidden->client = NULL; + } + + if (this->hidden->render) { + IAudioRenderClient_Release(this->hidden->render); + this->hidden->render = NULL; + } + + if (this->hidden->capture) { + IAudioCaptureClient_Release(this->hidden->capture); + this->hidden->capture = NULL; + } + + if (this->hidden->waveformat) { + CoTaskMemFree(this->hidden->waveformat); + this->hidden->waveformat = NULL; + } + + if (this->hidden->capturestream) { + SDL_FreeAudioStream(this->hidden->capturestream); + this->hidden->capturestream = NULL; + } + + if (this->hidden->activation_handler) { + WASAPI_PlatformDeleteActivationHandler(this->hidden->activation_handler); + this->hidden->activation_handler = NULL; + } + + if (this->hidden->event) { + CloseHandle(this->hidden->event); + this->hidden->event = NULL; + } +} + +static void +WASAPI_CloseDevice(_THIS) +{ + WASAPI_UnrefDevice(this); +} + +void +WASAPI_RefDevice(_THIS) +{ + SDL_AtomicIncRef(&this->hidden->refcount); +} + +void +WASAPI_UnrefDevice(_THIS) +{ + if (!SDL_AtomicDecRef(&this->hidden->refcount)) { + return; + } + + /* actual closing happens here. */ + + /* don't touch this->hidden->task in here; it has to be reverted from + our callback thread. We do that in WASAPI_ThreadDeinit(). + (likewise for this->hidden->coinitialized). */ + ReleaseWasapiDevice(this); + SDL_free(this->hidden->devid); + SDL_free(this->hidden); +} + +/* This is called once a device is activated, possibly asynchronously. */ +int +WASAPI_PrepDevice(_THIS, const SDL_bool updatestream) +{ + /* !!! FIXME: we could request an exclusive mode stream, which is lower latency; + !!! it will write into the kernel's audio buffer directly instead of + !!! shared memory that a user-mode mixer then writes to the kernel with + !!! everything else. Doing this means any other sound using this device will + !!! stop playing, including the user's MP3 player and system notification + !!! sounds. You'd probably need to release the device when the app isn't in + !!! the foreground, to be a good citizen of the system. It's doable, but it's + !!! more work and causes some annoyances, and I don't know what the latency + !!! wins actually look like. Maybe add a hint to force exclusive mode at + !!! some point. To be sure, defaulting to shared mode is the right thing to + !!! do in any case. */ + const SDL_AudioSpec oldspec = this->spec; + const AUDCLNT_SHAREMODE sharemode = AUDCLNT_SHAREMODE_SHARED; + UINT32 bufsize = 0; /* this is in sample frames, not samples, not bytes. */ + REFERENCE_TIME duration = 0; + IAudioClient *client = this->hidden->client; + IAudioRenderClient *render = NULL; + IAudioCaptureClient *capture = NULL; + WAVEFORMATEX *waveformat = NULL; + SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); + SDL_AudioFormat wasapi_format = 0; + SDL_bool valid_format = SDL_FALSE; + HRESULT ret = S_OK; + DWORD streamflags = 0; + + SDL_assert(client != NULL); + +#ifdef __WINRT__ /* CreateEventEx() arrived in Vista, so we need an #ifdef for XP. */ + this->hidden->event = CreateEventEx(NULL, NULL, 0, EVENT_ALL_ACCESS); +#else + this->hidden->event = CreateEventW(NULL, 0, 0, NULL); +#endif + + if (this->hidden->event == NULL) { + return WIN_SetError("WASAPI can't create an event handle"); + } + + ret = IAudioClient_GetMixFormat(client, &waveformat); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't determine mix format", ret); + } + + SDL_assert(waveformat != NULL); + this->hidden->waveformat = waveformat; + + this->spec.channels = (Uint8) waveformat->nChannels; + + /* Make sure we have a valid format that we can convert to whatever WASAPI wants. */ + if ((waveformat->wFormatTag == WAVE_FORMAT_IEEE_FLOAT) && (waveformat->wBitsPerSample == 32)) { + wasapi_format = AUDIO_F32SYS; + } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 16)) { + wasapi_format = AUDIO_S16SYS; + } else if ((waveformat->wFormatTag == WAVE_FORMAT_PCM) && (waveformat->wBitsPerSample == 32)) { + wasapi_format = AUDIO_S32SYS; + } else if (waveformat->wFormatTag == WAVE_FORMAT_EXTENSIBLE) { + const WAVEFORMATEXTENSIBLE *ext = (const WAVEFORMATEXTENSIBLE *) waveformat; + if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, sizeof (GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { + wasapi_format = AUDIO_F32SYS; + } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof (GUID)) == 0) && (waveformat->wBitsPerSample == 16)) { + wasapi_format = AUDIO_S16SYS; + } else if ((SDL_memcmp(&ext->SubFormat, &SDL_KSDATAFORMAT_SUBTYPE_PCM, sizeof (GUID)) == 0) && (waveformat->wBitsPerSample == 32)) { + wasapi_format = AUDIO_S32SYS; + } + } + + while ((!valid_format) && (test_format)) { + if (test_format == wasapi_format) { + this->spec.format = test_format; + valid_format = SDL_TRUE; + break; + } + test_format = SDL_NextAudioFormat(); + } + + if (!valid_format) { + return SDL_SetError("WASAPI: Unsupported audio format"); + } + + ret = IAudioClient_GetDevicePeriod(client, NULL, &duration); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't determine minimum device period", ret); + } + + /* favor WASAPI's resampler over our own, in Win7+. */ + if (this->spec.freq != waveformat->nSamplesPerSec) { + /* RATEADJUST only works with output devices in share mode, and is available in Win7 and later.*/ + if (WIN_IsWindows7OrGreater() && !this->iscapture && (sharemode == AUDCLNT_SHAREMODE_SHARED)) { + streamflags |= AUDCLNT_STREAMFLAGS_RATEADJUST; + waveformat->nSamplesPerSec = this->spec.freq; + waveformat->nAvgBytesPerSec = waveformat->nSamplesPerSec * waveformat->nChannels * (waveformat->wBitsPerSample / 8); + } + else { + this->spec.freq = waveformat->nSamplesPerSec; /* force sampling rate so our resampler kicks in. */ + } + } + + streamflags |= AUDCLNT_STREAMFLAGS_EVENTCALLBACK; + ret = IAudioClient_Initialize(client, sharemode, streamflags, duration, sharemode == AUDCLNT_SHAREMODE_SHARED ? 0 : duration, waveformat, NULL); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't initialize audio client", ret); + } + + ret = IAudioClient_SetEventHandle(client, this->hidden->event); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't set event handle", ret); + } + + ret = IAudioClient_GetBufferSize(client, &bufsize); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't determine buffer size", ret); + } + + this->spec.samples = (Uint16) bufsize; + if (!this->iscapture) { + this->spec.samples /= 2; /* fill half of the DMA buffer on each run. */ + } + + /* Update the fragment size as size in bytes */ + SDL_CalculateAudioSpec(&this->spec); + + this->hidden->framesize = (SDL_AUDIO_BITSIZE(this->spec.format) / 8) * this->spec.channels; + + if (this->iscapture) { + this->hidden->capturestream = SDL_NewAudioStream(this->spec.format, this->spec.channels, this->spec.freq, this->spec.format, this->spec.channels, this->spec.freq); + if (!this->hidden->capturestream) { + return -1; /* already set SDL_Error */ + } + + ret = IAudioClient_GetService(client, &SDL_IID_IAudioCaptureClient, (void**) &capture); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't get capture client service", ret); + } + + SDL_assert(capture != NULL); + this->hidden->capture = capture; + ret = IAudioClient_Start(client); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't start capture", ret); + } + + WASAPI_FlushCapture(this); /* MSDN says you should flush capture endpoint right after startup. */ + } else { + ret = IAudioClient_GetService(client, &SDL_IID_IAudioRenderClient, (void**) &render); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't get render client service", ret); + } + + SDL_assert(render != NULL); + this->hidden->render = render; + ret = IAudioClient_Start(client); + if (FAILED(ret)) { + return WIN_SetErrorFromHRESULT("WASAPI can't start playback", ret); + } + } + + if (updatestream) { + if (UpdateAudioStream(this, &oldspec) == -1) { + return -1; + } + } + + return 0; /* good to go. */ +} + + +static int +WASAPI_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) +{ + LPCWSTR devid = (LPCWSTR) handle; + + /* Initialize all variables that we clean on shutdown */ + this->hidden = (struct SDL_PrivateAudioData *) + SDL_malloc((sizeof *this->hidden)); + if (this->hidden == NULL) { + return SDL_OutOfMemory(); + } + SDL_zerop(this->hidden); + + WASAPI_RefDevice(this); /* so CloseDevice() will unref to zero. */ + + if (!devid) { /* is default device? */ + this->hidden->default_device_generation = SDL_AtomicGet(iscapture ? &WASAPI_DefaultCaptureGeneration : &WASAPI_DefaultPlaybackGeneration); + } else { + this->hidden->devid = WStrDupe(devid); + if (!this->hidden->devid) { + return SDL_OutOfMemory(); + } + } + + if (WASAPI_ActivateDevice(this, SDL_FALSE) == -1) { + return -1; /* already set error. */ + } + + /* Ready, but waiting for async device activation. + Until activation is successful, we will report silence from capture + devices and ignore data on playback devices. + Also, since we don't know the _actual_ device format until after + activation, we let the app have whatever it asks for. We set up + an SDL_AudioStream to convert, if necessary, once the activation + completes. */ + + return 0; +} + +static void +WASAPI_ThreadInit(_THIS) +{ + WASAPI_PlatformThreadInit(this); +} + +static void +WASAPI_ThreadDeinit(_THIS) +{ + WASAPI_PlatformThreadDeinit(this); +} + +static void +WASAPI_Deinitialize(void) +{ + DevIdList *devidlist; + DevIdList *next; + + WASAPI_PlatformDeinit(); + + for (devidlist = deviceid_list; devidlist; devidlist = next) { + next = devidlist->next; + SDL_free(devidlist->str); + SDL_free(devidlist); + } + deviceid_list = NULL; +} + +static int +WASAPI_Init(SDL_AudioDriverImpl * impl) +{ + SDL_AtomicSet(&WASAPI_DefaultPlaybackGeneration, 1); + SDL_AtomicSet(&WASAPI_DefaultCaptureGeneration, 1); + + if (WASAPI_PlatformInit() == -1) { + return 0; + } + + /* Set the function pointers */ + impl->DetectDevices = WASAPI_DetectDevices; + impl->ThreadInit = WASAPI_ThreadInit; + impl->ThreadDeinit = WASAPI_ThreadDeinit; + impl->BeginLoopIteration = WASAPI_BeginLoopIteration; + impl->OpenDevice = WASAPI_OpenDevice; + impl->PlayDevice = WASAPI_PlayDevice; + impl->WaitDevice = WASAPI_WaitDevice; + impl->GetPendingBytes = WASAPI_GetPendingBytes; + impl->GetDeviceBuf = WASAPI_GetDeviceBuf; + impl->CaptureFromDevice = WASAPI_CaptureFromDevice; + impl->FlushCapture = WASAPI_FlushCapture; + impl->CloseDevice = WASAPI_CloseDevice; + impl->Deinitialize = WASAPI_Deinitialize; + impl->HasCaptureSupport = 1; + + return 1; /* this audio target is available. */ +} + +AudioBootStrap WASAPI_bootstrap = { + "wasapi", "WASAPI", WASAPI_Init, 0 +}; + +#endif /* SDL_AUDIO_DRIVER_WASAPI */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.h b/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.h new file mode 100644 index 000000000..142c0e586 --- /dev/null +++ b/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi.h @@ -0,0 +1,85 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_wasapi_h_ +#define SDL_wasapi_h_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include "../SDL_sysaudio.h" + +/* Hidden "this" pointer for the audio functions */ +#ifdef __cplusplus +#define _THIS SDL_AudioDevice *_this +#else +#define _THIS SDL_AudioDevice *this +#endif + +struct SDL_PrivateAudioData +{ + SDL_atomic_t refcount; + WCHAR *devid; + WAVEFORMATEX *waveformat; + IAudioClient *client; + IAudioRenderClient *render; + IAudioCaptureClient *capture; + SDL_AudioStream *capturestream; + HANDLE event; + HANDLE task; + SDL_bool coinitialized; + int framesize; + int default_device_generation; + SDL_bool device_lost; + void *activation_handler; + SDL_atomic_t just_activated; +}; + +/* these increment as default devices change. Opened default devices pick up changes in their threads. */ +extern SDL_atomic_t WASAPI_DefaultPlaybackGeneration; +extern SDL_atomic_t WASAPI_DefaultCaptureGeneration; + +/* win32 and winrt implementations call into these. */ +int WASAPI_PrepDevice(_THIS, const SDL_bool updatestream); +void WASAPI_RefDevice(_THIS); +void WASAPI_UnrefDevice(_THIS); +void WASAPI_AddDevice(const SDL_bool iscapture, const char *devname, LPCWSTR devid); +void WASAPI_RemoveDevice(const SDL_bool iscapture, LPCWSTR devid); + +/* These are functions that are implemented differently for Windows vs WinRT. */ +int WASAPI_PlatformInit(void); +void WASAPI_PlatformDeinit(void); +void WASAPI_EnumerateEndpoints(void); +int WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery); +void WASAPI_PlatformThreadInit(_THIS); +void WASAPI_PlatformThreadDeinit(_THIS); +void WASAPI_PlatformDeleteActivationHandler(void *handler); +void WASAPI_BeginLoopIteration(_THIS); + +#ifdef __cplusplus +} +#endif + +#endif /* SDL_wasapi_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi_win32.c b/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi_win32.c new file mode 100644 index 000000000..8b55582c3 --- /dev/null +++ b/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi_win32.c @@ -0,0 +1,417 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +/* This is code that Windows uses to talk to WASAPI-related system APIs. + This is for non-WinRT desktop apps. The C++/CX implementation of these + functions, exclusive to WinRT, are in SDL_wasapi_winrt.cpp. + The code in SDL_wasapi.c is used by both standard Windows and WinRT builds + to deal with audio and calls into these functions. */ + +#if SDL_AUDIO_DRIVER_WASAPI && !defined(__WINRT__) + +#include "../../core/windows/SDL_windows.h" +#include "SDL_audio.h" +#include "SDL_timer.h" +#include "../SDL_audio_c.h" +#include "../SDL_sysaudio.h" +#include "SDL_assert.h" +#include "SDL_log.h" + +#define COBJMACROS +#include +#include + +#include "SDL_wasapi.h" + +static const ERole SDL_WASAPI_role = eConsole; /* !!! FIXME: should this be eMultimedia? Should be a hint? */ + +/* This is global to the WASAPI target, to handle hotplug and default device lookup. */ +static IMMDeviceEnumerator *enumerator = NULL; + +/* PropVariantInit() is an inline function/macro in PropIdl.h that calls the C runtime's memset() directly. Use ours instead, to avoid dependency. */ +#ifdef PropVariantInit +#undef PropVariantInit +#endif +#define PropVariantInit(p) SDL_zerop(p) + +/* handle to Avrt.dll--Vista and later!--for flagging the callback thread as "Pro Audio" (low latency). */ +static HMODULE libavrt = NULL; +typedef HANDLE(WINAPI *pfnAvSetMmThreadCharacteristicsW)(LPWSTR, LPDWORD); +typedef BOOL(WINAPI *pfnAvRevertMmThreadCharacteristics)(HANDLE); +static pfnAvSetMmThreadCharacteristicsW pAvSetMmThreadCharacteristicsW = NULL; +static pfnAvRevertMmThreadCharacteristics pAvRevertMmThreadCharacteristics = NULL; + +/* Some GUIDs we need to know without linking to libraries that aren't available before Vista. */ +static const CLSID SDL_CLSID_MMDeviceEnumerator = { 0xbcde0395, 0xe52f, 0x467c,{ 0x8e, 0x3d, 0xc4, 0x57, 0x92, 0x91, 0x69, 0x2e } }; +static const IID SDL_IID_IMMDeviceEnumerator = { 0xa95664d2, 0x9614, 0x4f35,{ 0xa7, 0x46, 0xde, 0x8d, 0xb6, 0x36, 0x17, 0xe6 } }; +static const IID SDL_IID_IMMNotificationClient = { 0x7991eec9, 0x7e89, 0x4d85,{ 0x83, 0x90, 0x6c, 0x70, 0x3c, 0xec, 0x60, 0xc0 } }; +static const IID SDL_IID_IMMEndpoint = { 0x1be09788, 0x6894, 0x4089,{ 0x85, 0x86, 0x9a, 0x2a, 0x6c, 0x26, 0x5a, 0xc5 } }; +static const IID SDL_IID_IAudioClient = { 0x1cb9ad4c, 0xdbfa, 0x4c32,{ 0xb1, 0x78, 0xc2, 0xf5, 0x68, 0xa7, 0x03, 0xb2 } }; +static const PROPERTYKEY SDL_PKEY_Device_FriendlyName = { { 0xa45c254e, 0xdf1c, 0x4efd,{ 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, } }, 14 }; + + +static char * +GetWasapiDeviceName(IMMDevice *device) +{ + /* PKEY_Device_FriendlyName gives you "Speakers (SoundBlaster Pro)" which drives me nuts. I'd rather it be + "SoundBlaster Pro (Speakers)" but I guess that's developers vs users. Windows uses the FriendlyName in + its own UIs, like Volume Control, etc. */ + char *utf8dev = NULL; + IPropertyStore *props = NULL; + if (SUCCEEDED(IMMDevice_OpenPropertyStore(device, STGM_READ, &props))) { + PROPVARIANT var; + PropVariantInit(&var); + if (SUCCEEDED(IPropertyStore_GetValue(props, &SDL_PKEY_Device_FriendlyName, &var))) { + utf8dev = WIN_StringToUTF8(var.pwszVal); + } + PropVariantClear(&var); + IPropertyStore_Release(props); + } + return utf8dev; +} + + +/* We need a COM subclass of IMMNotificationClient for hotplug support, which is + easy in C++, but we have to tapdance more to make work in C. + Thanks to this page for coaching on how to make this work: + https://www.codeproject.com/Articles/13601/COM-in-plain-C */ + +typedef struct SDLMMNotificationClient +{ + const IMMNotificationClientVtbl *lpVtbl; + SDL_atomic_t refcount; +} SDLMMNotificationClient; + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_QueryInterface(IMMNotificationClient *this, REFIID iid, void **ppv) +{ + if ((WIN_IsEqualIID(iid, &IID_IUnknown)) || (WIN_IsEqualIID(iid, &SDL_IID_IMMNotificationClient))) + { + *ppv = this; + this->lpVtbl->AddRef(this); + return S_OK; + } + + *ppv = NULL; + return E_NOINTERFACE; +} + +static ULONG STDMETHODCALLTYPE +SDLMMNotificationClient_AddRef(IMMNotificationClient *ithis) +{ + SDLMMNotificationClient *this = (SDLMMNotificationClient *) ithis; + return (ULONG) (SDL_AtomicIncRef(&this->refcount) + 1); +} + +static ULONG STDMETHODCALLTYPE +SDLMMNotificationClient_Release(IMMNotificationClient *ithis) +{ + /* this is a static object; we don't ever free it. */ + SDLMMNotificationClient *this = (SDLMMNotificationClient *) ithis; + const ULONG retval = SDL_AtomicDecRef(&this->refcount); + if (retval == 0) { + SDL_AtomicSet(&this->refcount, 0); /* uhh... */ + return 0; + } + return retval - 1; +} + +/* These are the entry points called when WASAPI device endpoints change. */ +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnDefaultDeviceChanged(IMMNotificationClient *ithis, EDataFlow flow, ERole role, LPCWSTR pwstrDeviceId) +{ + if (role != SDL_WASAPI_role) { + return S_OK; /* ignore it. */ + } + + /* Increment the "generation," so opened devices will pick this up in their threads. */ + switch (flow) { + case eRender: + SDL_AtomicAdd(&WASAPI_DefaultPlaybackGeneration, 1); + break; + + case eCapture: + SDL_AtomicAdd(&WASAPI_DefaultCaptureGeneration, 1); + break; + + case eAll: + SDL_AtomicAdd(&WASAPI_DefaultPlaybackGeneration, 1); + SDL_AtomicAdd(&WASAPI_DefaultCaptureGeneration, 1); + break; + + default: + SDL_assert(!"uhoh, unexpected OnDefaultDeviceChange flow!"); + break; + } + + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnDeviceAdded(IMMNotificationClient *ithis, LPCWSTR pwstrDeviceId) +{ + /* we ignore this; devices added here then progress to ACTIVE, if appropriate, in + OnDeviceStateChange, making that a better place to deal with device adds. More + importantly: the first time you plug in a USB audio device, this callback will + fire, but when you unplug it, it isn't removed (it's state changes to NOTPRESENT). + Plugging it back in won't fire this callback again. */ + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnDeviceRemoved(IMMNotificationClient *ithis, LPCWSTR pwstrDeviceId) +{ + /* See notes in OnDeviceAdded handler about why we ignore this. */ + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnDeviceStateChanged(IMMNotificationClient *ithis, LPCWSTR pwstrDeviceId, DWORD dwNewState) +{ + IMMDevice *device = NULL; + + if (SUCCEEDED(IMMDeviceEnumerator_GetDevice(enumerator, pwstrDeviceId, &device))) { + IMMEndpoint *endpoint = NULL; + if (SUCCEEDED(IMMDevice_QueryInterface(device, &SDL_IID_IMMEndpoint, (void **) &endpoint))) { + EDataFlow flow; + if (SUCCEEDED(IMMEndpoint_GetDataFlow(endpoint, &flow))) { + const SDL_bool iscapture = (flow == eCapture); + if (dwNewState == DEVICE_STATE_ACTIVE) { + char *utf8dev = GetWasapiDeviceName(device); + if (utf8dev) { + WASAPI_AddDevice(iscapture, utf8dev, pwstrDeviceId); + SDL_free(utf8dev); + } + } else { + WASAPI_RemoveDevice(iscapture, pwstrDeviceId); + } + } + IMMEndpoint_Release(endpoint); + } + IMMDevice_Release(device); + } + + return S_OK; +} + +static HRESULT STDMETHODCALLTYPE +SDLMMNotificationClient_OnPropertyValueChanged(IMMNotificationClient *this, LPCWSTR pwstrDeviceId, const PROPERTYKEY key) +{ + return S_OK; /* we don't care about these. */ +} + +static const IMMNotificationClientVtbl notification_client_vtbl = { + SDLMMNotificationClient_QueryInterface, + SDLMMNotificationClient_AddRef, + SDLMMNotificationClient_Release, + SDLMMNotificationClient_OnDeviceStateChanged, + SDLMMNotificationClient_OnDeviceAdded, + SDLMMNotificationClient_OnDeviceRemoved, + SDLMMNotificationClient_OnDefaultDeviceChanged, + SDLMMNotificationClient_OnPropertyValueChanged +}; + +static SDLMMNotificationClient notification_client = { ¬ification_client_vtbl, { 1 } }; + + +int +WASAPI_PlatformInit(void) +{ + HRESULT ret; + + /* just skip the discussion with COM here. */ + if (!WIN_IsWindowsVistaOrGreater()) { + return SDL_SetError("WASAPI support requires Windows Vista or later"); + } + + if (FAILED(WIN_CoInitialize())) { + return SDL_SetError("WASAPI: CoInitialize() failed"); + } + + ret = CoCreateInstance(&SDL_CLSID_MMDeviceEnumerator, NULL, CLSCTX_INPROC_SERVER, &SDL_IID_IMMDeviceEnumerator, (LPVOID) &enumerator); + if (FAILED(ret)) { + WIN_CoUninitialize(); + return WIN_SetErrorFromHRESULT("WASAPI CoCreateInstance(MMDeviceEnumerator)", ret); + } + + libavrt = LoadLibraryW(L"avrt.dll"); /* this library is available in Vista and later. No WinXP, so have to LoadLibrary to use it for now! */ + if (libavrt) { + pAvSetMmThreadCharacteristicsW = (pfnAvSetMmThreadCharacteristicsW) GetProcAddress(libavrt, "AvSetMmThreadCharacteristicsW"); + pAvRevertMmThreadCharacteristics = (pfnAvRevertMmThreadCharacteristics) GetProcAddress(libavrt, "AvRevertMmThreadCharacteristics"); + } + + return 0; +} + +void +WASAPI_PlatformDeinit(void) +{ + if (enumerator) { + IMMDeviceEnumerator_UnregisterEndpointNotificationCallback(enumerator, (IMMNotificationClient *) ¬ification_client); + IMMDeviceEnumerator_Release(enumerator); + enumerator = NULL; + } + + if (libavrt) { + FreeLibrary(libavrt); + libavrt = NULL; + } + + pAvSetMmThreadCharacteristicsW = NULL; + pAvRevertMmThreadCharacteristics = NULL; + + WIN_CoUninitialize(); +} + +void +WASAPI_PlatformThreadInit(_THIS) +{ + /* this thread uses COM. */ + if (SUCCEEDED(WIN_CoInitialize())) { /* can't report errors, hope it worked! */ + this->hidden->coinitialized = SDL_TRUE; + } + + /* Set this thread to very high "Pro Audio" priority. */ + if (pAvSetMmThreadCharacteristicsW) { + DWORD idx = 0; + this->hidden->task = pAvSetMmThreadCharacteristicsW(TEXT("Pro Audio"), &idx); + } +} + +void +WASAPI_PlatformThreadDeinit(_THIS) +{ + /* Set this thread back to normal priority. */ + if (this->hidden->task && pAvRevertMmThreadCharacteristics) { + pAvRevertMmThreadCharacteristics(this->hidden->task); + this->hidden->task = NULL; + } + + if (this->hidden->coinitialized) { + WIN_CoUninitialize(); + this->hidden->coinitialized = SDL_FALSE; + } +} + +int +WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery) +{ + LPCWSTR devid = this->hidden->devid; + IMMDevice *device = NULL; + HRESULT ret; + + if (devid == NULL) { + const EDataFlow dataflow = this->iscapture ? eCapture : eRender; + ret = IMMDeviceEnumerator_GetDefaultAudioEndpoint(enumerator, dataflow, SDL_WASAPI_role, &device); + } else { + ret = IMMDeviceEnumerator_GetDevice(enumerator, devid, &device); + } + + if (FAILED(ret)) { + SDL_assert(device == NULL); + this->hidden->client = NULL; + return WIN_SetErrorFromHRESULT("WASAPI can't find requested audio endpoint", ret); + } + + /* this is not async in standard win32, yay! */ + ret = IMMDevice_Activate(device, &SDL_IID_IAudioClient, CLSCTX_ALL, NULL, (void **) &this->hidden->client); + IMMDevice_Release(device); + + if (FAILED(ret)) { + SDL_assert(this->hidden->client == NULL); + return WIN_SetErrorFromHRESULT("WASAPI can't activate audio endpoint", ret); + } + + SDL_assert(this->hidden->client != NULL); + if (WASAPI_PrepDevice(this, isrecovery) == -1) { /* not async, fire it right away. */ + return -1; + } + + return 0; /* good to go. */ +} + + +static void +WASAPI_EnumerateEndpointsForFlow(const SDL_bool iscapture) +{ + IMMDeviceCollection *collection = NULL; + UINT i, total; + + /* Note that WASAPI separates "adapter devices" from "audio endpoint devices" + ...one adapter device ("SoundBlaster Pro") might have multiple endpoint devices ("Speakers", "Line-Out"). */ + + if (FAILED(IMMDeviceEnumerator_EnumAudioEndpoints(enumerator, iscapture ? eCapture : eRender, DEVICE_STATE_ACTIVE, &collection))) { + return; + } + + if (FAILED(IMMDeviceCollection_GetCount(collection, &total))) { + IMMDeviceCollection_Release(collection); + return; + } + + for (i = 0; i < total; i++) { + IMMDevice *device = NULL; + if (SUCCEEDED(IMMDeviceCollection_Item(collection, i, &device))) { + LPWSTR devid = NULL; + if (SUCCEEDED(IMMDevice_GetId(device, &devid))) { + char *devname = GetWasapiDeviceName(device); + if (devname) { + WASAPI_AddDevice(iscapture, devname, devid); + SDL_free(devname); + } + CoTaskMemFree(devid); + } + IMMDevice_Release(device); + } + } + + IMMDeviceCollection_Release(collection); +} + +void +WASAPI_EnumerateEndpoints(void) +{ + WASAPI_EnumerateEndpointsForFlow(SDL_FALSE); /* playback */ + WASAPI_EnumerateEndpointsForFlow(SDL_TRUE); /* capture */ + + /* if this fails, we just won't get hotplug events. Carry on anyhow. */ + IMMDeviceEnumerator_RegisterEndpointNotificationCallback(enumerator, (IMMNotificationClient *) ¬ification_client); +} + +void +WASAPI_PlatformDeleteActivationHandler(void *handler) +{ + /* not asynchronous. */ + SDL_assert(!"This function should have only been called on WinRT."); +} + +void +WASAPI_BeginLoopIteration(_THIS) +{ + /* no-op. */ +} + +#endif /* SDL_AUDIO_DRIVER_WASAPI && !defined(__WINRT__) */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi_winrt.cpp b/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi_winrt.cpp new file mode 100644 index 000000000..309ec6a78 --- /dev/null +++ b/Engine/lib/sdl/src/audio/wasapi/SDL_wasapi_winrt.cpp @@ -0,0 +1,276 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +// This is C++/CX code that the WinRT port uses to talk to WASAPI-related +// system APIs. The C implementation of these functions, for non-WinRT apps, +// is in SDL_wasapi_win32.c. The code in SDL_wasapi.c is used by both standard +// Windows and WinRT builds to deal with audio and calls into these functions. + +#if SDL_AUDIO_DRIVER_WASAPI && defined(__WINRT__) + +#include +#include +#include +#include +#include + +extern "C" { +#include "../../core/windows/SDL_windows.h" +#include "SDL_audio.h" +#include "SDL_timer.h" +#include "../SDL_audio_c.h" +#include "../SDL_sysaudio.h" +#include "SDL_assert.h" +#include "SDL_log.h" +} + +#define COBJMACROS +#include +#include + +#include "SDL_wasapi.h" + +using namespace Windows::Devices::Enumeration; +using namespace Windows::Media::Devices; +using namespace Windows::Foundation; +using namespace Microsoft::WRL; + +class SDL_WasapiDeviceEventHandler +{ +public: + SDL_WasapiDeviceEventHandler(const SDL_bool _iscapture); + ~SDL_WasapiDeviceEventHandler(); + void OnDeviceAdded(DeviceWatcher^ sender, DeviceInformation^ args); + void OnDeviceRemoved(DeviceWatcher^ sender, DeviceInformationUpdate^ args); + void OnDeviceUpdated(DeviceWatcher^ sender, DeviceInformationUpdate^ args); + void OnDefaultRenderDeviceChanged(Platform::Object^ sender, DefaultAudioRenderDeviceChangedEventArgs^ args); + void OnDefaultCaptureDeviceChanged(Platform::Object^ sender, DefaultAudioCaptureDeviceChangedEventArgs^ args); + +private: + const SDL_bool iscapture; + DeviceWatcher^ watcher; + Windows::Foundation::EventRegistrationToken added_handler; + Windows::Foundation::EventRegistrationToken removed_handler; + Windows::Foundation::EventRegistrationToken updated_handler; + Windows::Foundation::EventRegistrationToken default_changed_handler; +}; + +SDL_WasapiDeviceEventHandler::SDL_WasapiDeviceEventHandler(const SDL_bool _iscapture) + : iscapture(_iscapture) + , watcher(DeviceInformation::CreateWatcher(_iscapture ? DeviceClass::AudioCapture : DeviceClass::AudioRender)) +{ + if (!watcher) + return; // uhoh. + + // !!! FIXME: this doesn't need a lambda here, I think, if I make SDL_WasapiDeviceEventHandler a proper C++/CX class. --ryan. + added_handler = watcher->Added += ref new TypedEventHandler([this](DeviceWatcher^ sender, DeviceInformation^ args) { OnDeviceAdded(sender, args); } ); + removed_handler = watcher->Removed += ref new TypedEventHandler([this](DeviceWatcher^ sender, DeviceInformationUpdate^ args) { OnDeviceRemoved(sender, args); } ); + updated_handler = watcher->Updated += ref new TypedEventHandler([this](DeviceWatcher^ sender, DeviceInformationUpdate^ args) { OnDeviceUpdated(sender, args); } ); + if (iscapture) { + default_changed_handler = MediaDevice::DefaultAudioCaptureDeviceChanged += ref new TypedEventHandler([this](Platform::Object^ sender, DefaultAudioCaptureDeviceChangedEventArgs^ args) { OnDefaultCaptureDeviceChanged(sender, args); } ); + } else { + default_changed_handler = MediaDevice::DefaultAudioRenderDeviceChanged += ref new TypedEventHandler([this](Platform::Object^ sender, DefaultAudioRenderDeviceChangedEventArgs^ args) { OnDefaultRenderDeviceChanged(sender, args); } ); + } + watcher->Start(); +} + +SDL_WasapiDeviceEventHandler::~SDL_WasapiDeviceEventHandler() +{ + if (watcher) { + watcher->Added -= added_handler; + watcher->Removed -= removed_handler; + watcher->Updated -= updated_handler; + watcher->Stop(); + watcher = nullptr; + } + + if (iscapture) { + MediaDevice::DefaultAudioCaptureDeviceChanged -= default_changed_handler; + } else { + MediaDevice::DefaultAudioRenderDeviceChanged -= default_changed_handler; + } +} + +void +SDL_WasapiDeviceEventHandler::OnDeviceAdded(DeviceWatcher^ sender, DeviceInformation^ info) +{ + SDL_assert(sender == this->watcher); + char *utf8dev = WIN_StringToUTF8(info->Name->Data()); + if (utf8dev) { + WASAPI_AddDevice(this->iscapture, utf8dev, info->Id->Data()); + SDL_free(utf8dev); + } +} + +void +SDL_WasapiDeviceEventHandler::OnDeviceRemoved(DeviceWatcher^ sender, DeviceInformationUpdate^ info) +{ + SDL_assert(sender == this->watcher); + WASAPI_RemoveDevice(this->iscapture, info->Id->Data()); +} + +void +SDL_WasapiDeviceEventHandler::OnDeviceUpdated(DeviceWatcher^ sender, DeviceInformationUpdate^ args) +{ + SDL_assert(sender == this->watcher); +} + +void +SDL_WasapiDeviceEventHandler::OnDefaultRenderDeviceChanged(Platform::Object^ sender, DefaultAudioRenderDeviceChangedEventArgs^ args) +{ + SDL_assert(this->iscapture); + SDL_AtomicAdd(&WASAPI_DefaultPlaybackGeneration, 1); +} + +void +SDL_WasapiDeviceEventHandler::OnDefaultCaptureDeviceChanged(Platform::Object^ sender, DefaultAudioCaptureDeviceChangedEventArgs^ args) +{ + SDL_assert(!this->iscapture); + SDL_AtomicAdd(&WASAPI_DefaultCaptureGeneration, 1); +} + + +static SDL_WasapiDeviceEventHandler *playback_device_event_handler; +static SDL_WasapiDeviceEventHandler *capture_device_event_handler; + +int WASAPI_PlatformInit(void) +{ + return 0; +} + +void WASAPI_PlatformDeinit(void) +{ + delete playback_device_event_handler; + playback_device_event_handler = nullptr; + delete capture_device_event_handler; + capture_device_event_handler = nullptr; +} + +void WASAPI_EnumerateEndpoints(void) +{ + // DeviceWatchers will fire an Added event for each existing device at + // startup, so we don't need to enumerate them separately before + // listening for updates. + playback_device_event_handler = new SDL_WasapiDeviceEventHandler(SDL_FALSE); + capture_device_event_handler = new SDL_WasapiDeviceEventHandler(SDL_TRUE); +} + +struct SDL_WasapiActivationHandler : public RuntimeClass< RuntimeClassFlags< ClassicCom >, FtmBase, IActivateAudioInterfaceCompletionHandler > +{ + SDL_WasapiActivationHandler() : device(nullptr) {} + STDMETHOD(ActivateCompleted)(IActivateAudioInterfaceAsyncOperation *operation); + SDL_AudioDevice *device; +}; + +HRESULT +SDL_WasapiActivationHandler::ActivateCompleted(IActivateAudioInterfaceAsyncOperation *async) +{ + HRESULT result = S_OK; + IUnknown *iunknown = nullptr; + const HRESULT ret = async->GetActivateResult(&result, &iunknown); + + if (SUCCEEDED(ret) && SUCCEEDED(result)) { + iunknown->QueryInterface(IID_PPV_ARGS(&device->hidden->client)); + if (device->hidden->client) { + // Just set a flag, since we're probably in a different thread. We'll pick it up and init everything on our own thread to prevent races. + SDL_AtomicSet(&device->hidden->just_activated, 1); + } + } + + WASAPI_UnrefDevice(device); + + return S_OK; +} + +void +WASAPI_PlatformDeleteActivationHandler(void *handler) +{ + ((SDL_WasapiActivationHandler *) handler)->Release(); +} + +int +WASAPI_ActivateDevice(_THIS, const SDL_bool isrecovery) +{ + LPCWSTR devid = _this->hidden->devid; + Platform::String^ defdevid; + + if (devid == nullptr) { + defdevid = _this->iscapture ? MediaDevice::GetDefaultAudioCaptureId(AudioDeviceRole::Default) : MediaDevice::GetDefaultAudioRenderId(AudioDeviceRole::Default); + if (defdevid) { + devid = defdevid->Data(); + } + } + + SDL_AtomicSet(&_this->hidden->just_activated, 0); + + ComPtr handler = Make(); + if (handler == nullptr) { + return SDL_SetError("Failed to allocate WASAPI activation handler"); + } + + handler.Get()->AddRef(); // we hold a reference after ComPtr destructs on return, causing a Release, and Release ourselves in WASAPI_PlatformDeleteActivationHandler(), etc. + handler.Get()->device = _this; + _this->hidden->activation_handler = handler.Get(); + + WASAPI_RefDevice(_this); /* completion handler will unref it. */ + IActivateAudioInterfaceAsyncOperation *async = nullptr; + const HRESULT ret = ActivateAudioInterfaceAsync(devid, __uuidof(IAudioClient), nullptr, handler.Get(), &async); + + if (async != nullptr) { + async->Release(); + } + + if (FAILED(ret)) { + handler.Get()->Release(); + WASAPI_UnrefDevice(_this); + return WIN_SetErrorFromHRESULT("WASAPI can't activate requested audio endpoint", ret); + } + + return 0; +} + +void +WASAPI_BeginLoopIteration(_THIS) +{ + if (SDL_AtomicCAS(&_this->hidden->just_activated, 1, 0)) { + if (WASAPI_PrepDevice(_this, SDL_TRUE) == -1) { + SDL_OpenedAudioDeviceDisconnected(_this); + } + } +} + +void +WASAPI_PlatformThreadInit(_THIS) +{ + // !!! FIXME: set this thread to "Pro Audio" priority. +} + +void +WASAPI_PlatformThreadDeinit(_THIS) +{ + // !!! FIXME: set this thread to "Pro Audio" priority. +} + +#endif // SDL_AUDIO_DRIVER_WASAPI && defined(__WINRT__) + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/winmm/SDL_winmm.c b/Engine/lib/sdl/src/audio/winmm/SDL_winmm.c index 34f543ddb..8e5c17ba1 100644 --- a/Engine/lib/sdl/src/audio/winmm/SDL_winmm.c +++ b/Engine/lib/sdl/src/audio/winmm/SDL_winmm.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,6 +33,40 @@ #include "../SDL_audio_c.h" #include "SDL_winmm.h" +/* MinGW32 mmsystem.h doesn't include these structures */ +#if defined(__MINGW32__) && defined(_MMSYSTEM_H) + +typedef struct tagWAVEINCAPS2W +{ + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + WCHAR szPname[MAXPNAMELEN]; + DWORD dwFormats; + WORD wChannels; + WORD wReserved1; + GUID ManufacturerGuid; + GUID ProductGuid; + GUID NameGuid; +} WAVEINCAPS2W,*PWAVEINCAPS2W,*NPWAVEINCAPS2W,*LPWAVEINCAPS2W; + +typedef struct tagWAVEOUTCAPS2W +{ + WORD wMid; + WORD wPid; + MMVERSION vDriverVersion; + WCHAR szPname[MAXPNAMELEN]; + DWORD dwFormats; + WORD wChannels; + WORD wReserved1; + DWORD dwSupport; + GUID ManufacturerGuid; + GUID ProductGuid; + GUID NameGuid; +} WAVEOUTCAPS2W,*PWAVEOUTCAPS2W,*NPWAVEOUTCAPS2W,*LPWAVEOUTCAPS2W; + +#endif /* defined(__MINGW32__) && defined(_MMSYSTEM_H) */ + #ifndef WAVE_FORMAT_IEEE_FLOAT #define WAVE_FORMAT_IEEE_FLOAT 0x0003 #endif diff --git a/Engine/lib/sdl/src/audio/winmm/SDL_winmm.h b/Engine/lib/sdl/src/audio/winmm/SDL_winmm.h index 401db398b..9342bb9f1 100644 --- a/Engine/lib/sdl/src/audio/winmm/SDL_winmm.h +++ b/Engine/lib/sdl/src/audio/winmm/SDL_winmm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_winmm_h -#define _SDL_winmm_h +#ifndef SDL_winmm_h_ +#define SDL_winmm_h_ #include "../SDL_sysaudio.h" @@ -40,6 +40,6 @@ struct SDL_PrivateAudioData int next_buffer; }; -#endif /* _SDL_winmm_h */ +#endif /* SDL_winmm_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2.c b/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2.c deleted file mode 100644 index a18e5d24e..000000000 --- a/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2.c +++ /dev/null @@ -1,503 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -/* WinRT NOTICE: - - A few changes to SDL's XAudio2 backend were warranted by API - changes to Windows. Many, but not all of these are documented by Microsoft - at: - http://blogs.msdn.com/b/chuckw/archive/2012/04/02/xaudio2-and-windows-8-consumer-preview.aspx - - 1. Windows' thread synchronization function, CreateSemaphore, was removed - from WinRT. SDL's semaphore API was substituted instead. - 2. The method calls, IXAudio2::GetDeviceCount and IXAudio2::GetDeviceDetails - were removed from the XAudio2 API. Microsoft is telling developers to - use APIs in Windows::Foundation instead. - For SDL, the missing methods were reimplemented using the APIs Microsoft - said to use. - 3. CoInitialize and CoUninitialize are not available in WinRT. - These calls were removed, as COM will have been initialized earlier, - at least by the call to the WinRT app's main function - (aka 'int main(Platform::Array^)). (DLudwig: - This was my understanding of how WinRT: the 'main' function uses - a tag of [MTAThread], which should initialize COM. My understanding - of COM is somewhat limited, and I may be incorrect here.) - 4. IXAudio2::CreateMasteringVoice changed its integer-based 'DeviceIndex' - argument to a string-based one, 'szDeviceId'. In WinRT, the - string-based argument will be used. -*/ -#include "../../SDL_internal.h" - -#if SDL_AUDIO_DRIVER_XAUDIO2 - -#include "../../core/windows/SDL_windows.h" -#include "SDL_audio.h" -#include "../SDL_audio_c.h" -#include "../SDL_sysaudio.h" -#include "SDL_assert.h" - -#ifdef __GNUC__ -/* The configure script already did any necessary checking */ -# define SDL_XAUDIO2_HAS_SDK 1 -#elif defined(__WINRT__) -/* WinRT always has access to the XAudio 2 SDK (albeit with a header file - that doesn't compile as C code). -*/ -# define SDL_XAUDIO2_HAS_SDK -#include "SDL_xaudio2.h" /* ... compiles as C code, in contrast to XAudio2 headers - in the Windows SDK, v.10.0.10240.0 (Win 10's initial SDK) - */ -#else -/* XAudio2 exists in the last DirectX SDK as well as the latest Windows SDK. - To enable XAudio2 support, you will need to add the location of your DirectX SDK headers to - the SDL projects additional include directories and then set SDL_XAUDIO2_HAS_SDK=1 as a - preprocessor define - */ -#if 0 /* See comment above */ -#include -#if (!defined(_DXSDK_BUILD_MAJOR) || (_DXSDK_BUILD_MAJOR < 1284)) -# pragma message("Your DirectX SDK is too old. Disabling XAudio2 support.") -#else -# define SDL_XAUDIO2_HAS_SDK 1 -#endif -#endif -#endif /* 0 */ - -#ifdef SDL_XAUDIO2_HAS_SDK - -/* Check to see if we're compiling for XAudio 2.8, or higher. */ -#ifdef WINVER -#if WINVER >= 0x0602 /* Windows 8 SDK or higher? */ -#define SDL_XAUDIO2_WIN8 1 -#endif -#endif - -#if !defined(_SDL_XAUDIO2_H) -#define INITGUID 1 -#include -#endif - -/* Hidden "this" pointer for the audio functions */ -#define _THIS SDL_AudioDevice *this - -#ifdef __WINRT__ -#include "SDL_xaudio2_winrthelpers.h" -#endif - -/* Fixes bug 1210 where some versions of gcc need named parameters */ -#ifdef __GNUC__ -#ifdef THIS -#undef THIS -#endif -#define THIS INTERFACE *p -#ifdef THIS_ -#undef THIS_ -#endif -#define THIS_ INTERFACE *p, -#endif - -struct SDL_PrivateAudioData -{ - IXAudio2 *ixa2; - IXAudio2SourceVoice *source; - IXAudio2MasteringVoice *mastering; - SDL_sem * semaphore; - Uint8 *mixbuf; - int mixlen; - Uint8 *nextbuf; -}; - - -static void -XAUDIO2_DetectDevices(void) -{ - IXAudio2 *ixa2 = NULL; - UINT32 devcount = 0; - UINT32 i = 0; - - if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) { - SDL_SetError("XAudio2: XAudio2Create() failed at detection."); - return; - } else if (IXAudio2_GetDeviceCount(ixa2, &devcount) != S_OK) { - SDL_SetError("XAudio2: IXAudio2::GetDeviceCount() failed."); - IXAudio2_Release(ixa2); - return; - } - - for (i = 0; i < devcount; i++) { - XAUDIO2_DEVICE_DETAILS details; - if (IXAudio2_GetDeviceDetails(ixa2, i, &details) == S_OK) { - char *str = WIN_StringToUTF8(details.DisplayName); - if (str != NULL) { - SDL_AddAudioDevice(SDL_FALSE, str, (void *) ((size_t) i+1)); - SDL_free(str); /* SDL_AddAudioDevice made a copy of the string. */ - } - } - } - - IXAudio2_Release(ixa2); -} - -static void STDMETHODCALLTYPE -VoiceCBOnBufferEnd(THIS_ void *data) -{ - /* Just signal the SDL audio thread and get out of XAudio2's way. */ - SDL_AudioDevice *this = (SDL_AudioDevice *) data; - SDL_SemPost(this->hidden->semaphore); -} - -static void STDMETHODCALLTYPE -VoiceCBOnVoiceError(THIS_ void *data, HRESULT Error) -{ - SDL_AudioDevice *this = (SDL_AudioDevice *) data; - SDL_OpenedAudioDeviceDisconnected(this); -} - -/* no-op callbacks... */ -static void STDMETHODCALLTYPE VoiceCBOnStreamEnd(THIS) {} -static void STDMETHODCALLTYPE VoiceCBOnVoiceProcessPassStart(THIS_ UINT32 b) {} -static void STDMETHODCALLTYPE VoiceCBOnVoiceProcessPassEnd(THIS) {} -static void STDMETHODCALLTYPE VoiceCBOnBufferStart(THIS_ void *data) {} -static void STDMETHODCALLTYPE VoiceCBOnLoopEnd(THIS_ void *data) {} - - -static Uint8 * -XAUDIO2_GetDeviceBuf(_THIS) -{ - return this->hidden->nextbuf; -} - -static void -XAUDIO2_PlayDevice(_THIS) -{ - XAUDIO2_BUFFER buffer; - Uint8 *mixbuf = this->hidden->mixbuf; - Uint8 *nextbuf = this->hidden->nextbuf; - const int mixlen = this->hidden->mixlen; - IXAudio2SourceVoice *source = this->hidden->source; - HRESULT result = S_OK; - - if (!SDL_AtomicGet(&this->enabled)) { /* shutting down? */ - return; - } - - /* Submit the next filled buffer */ - SDL_zero(buffer); - buffer.AudioBytes = mixlen; - buffer.pAudioData = nextbuf; - buffer.pContext = this; - - if (nextbuf == mixbuf) { - nextbuf += mixlen; - } else { - nextbuf = mixbuf; - } - this->hidden->nextbuf = nextbuf; - - result = IXAudio2SourceVoice_SubmitSourceBuffer(source, &buffer, NULL); - if (result == XAUDIO2_E_DEVICE_INVALIDATED) { - /* !!! FIXME: possibly disconnected or temporary lost. Recover? */ - } - - if (result != S_OK) { /* uhoh, panic! */ - IXAudio2SourceVoice_FlushSourceBuffers(source); - SDL_OpenedAudioDeviceDisconnected(this); - } -} - -static void -XAUDIO2_WaitDevice(_THIS) -{ - if (SDL_AtomicGet(&this->enabled)) { - SDL_SemWait(this->hidden->semaphore); - } -} - -static void -XAUDIO2_PrepareToClose(_THIS) -{ - IXAudio2SourceVoice *source = this->hidden->source; - if (source) { - IXAudio2SourceVoice_Discontinuity(source); - } -} - -static void -XAUDIO2_CloseDevice(_THIS) -{ - IXAudio2 *ixa2 = this->hidden->ixa2; - IXAudio2SourceVoice *source = this->hidden->source; - IXAudio2MasteringVoice *mastering = this->hidden->mastering; - - if (source != NULL) { - IXAudio2SourceVoice_Stop(source, 0, XAUDIO2_COMMIT_NOW); - IXAudio2SourceVoice_FlushSourceBuffers(source); - IXAudio2SourceVoice_DestroyVoice(source); - } - if (ixa2 != NULL) { - IXAudio2_StopEngine(ixa2); - } - if (mastering != NULL) { - IXAudio2MasteringVoice_DestroyVoice(mastering); - } - if (ixa2 != NULL) { - IXAudio2_Release(ixa2); - } - if (this->hidden->semaphore != NULL) { - SDL_DestroySemaphore(this->hidden->semaphore); - } - - SDL_free(this->hidden->mixbuf); - SDL_free(this->hidden); -} - -static int -XAUDIO2_OpenDevice(_THIS, void *handle, const char *devname, int iscapture) -{ - HRESULT result = S_OK; - WAVEFORMATEX waveformat; - int valid_format = 0; - SDL_AudioFormat test_format = SDL_FirstAudioFormat(this->spec.format); - IXAudio2 *ixa2 = NULL; - IXAudio2SourceVoice *source = NULL; -#if defined(SDL_XAUDIO2_WIN8) - LPCWSTR devId = NULL; -#else - UINT32 devId = 0; /* 0 == system default device. */ -#endif - - static IXAudio2VoiceCallbackVtbl callbacks_vtable = { - VoiceCBOnVoiceProcessPassStart, - VoiceCBOnVoiceProcessPassEnd, - VoiceCBOnStreamEnd, - VoiceCBOnBufferStart, - VoiceCBOnBufferEnd, - VoiceCBOnLoopEnd, - VoiceCBOnVoiceError - }; - - static IXAudio2VoiceCallback callbacks = { &callbacks_vtable }; - -#if defined(SDL_XAUDIO2_WIN8) - /* !!! FIXME: hook up hotplugging. */ -#else - if (handle != NULL) { /* specific device requested? */ - /* -1 because we increment the original value to avoid NULL. */ - const size_t val = ((size_t) handle) - 1; - devId = (UINT32) val; - } -#endif - - if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) { - return SDL_SetError("XAudio2: XAudio2Create() failed at open."); - } - - /* - XAUDIO2_DEBUG_CONFIGURATION debugConfig; - debugConfig.TraceMask = XAUDIO2_LOG_ERRORS; //XAUDIO2_LOG_WARNINGS | XAUDIO2_LOG_DETAIL | XAUDIO2_LOG_FUNC_CALLS | XAUDIO2_LOG_TIMING | XAUDIO2_LOG_LOCKS | XAUDIO2_LOG_MEMORY | XAUDIO2_LOG_STREAMING; - debugConfig.BreakMask = XAUDIO2_LOG_ERRORS; //XAUDIO2_LOG_WARNINGS; - debugConfig.LogThreadID = TRUE; - debugConfig.LogFileline = TRUE; - debugConfig.LogFunctionName = TRUE; - debugConfig.LogTiming = TRUE; - ixa2->SetDebugConfiguration(&debugConfig); - */ - - /* Initialize all variables that we clean on shutdown */ - this->hidden = (struct SDL_PrivateAudioData *) - SDL_malloc((sizeof *this->hidden)); - if (this->hidden == NULL) { - IXAudio2_Release(ixa2); - return SDL_OutOfMemory(); - } - SDL_zerop(this->hidden); - - this->hidden->ixa2 = ixa2; - this->hidden->semaphore = SDL_CreateSemaphore(1); - if (this->hidden->semaphore == NULL) { - return SDL_SetError("XAudio2: CreateSemaphore() failed!"); - } - - while ((!valid_format) && (test_format)) { - switch (test_format) { - case AUDIO_U8: - case AUDIO_S16: - case AUDIO_S32: - case AUDIO_F32: - this->spec.format = test_format; - valid_format = 1; - break; - } - test_format = SDL_NextAudioFormat(); - } - - if (!valid_format) { - return SDL_SetError("XAudio2: Unsupported audio format"); - } - - /* Update the fragment size as size in bytes */ - SDL_CalculateAudioSpec(&this->spec); - - /* We feed a Source, it feeds the Mastering, which feeds the device. */ - this->hidden->mixlen = this->spec.size; - this->hidden->mixbuf = (Uint8 *) SDL_malloc(2 * this->hidden->mixlen); - if (this->hidden->mixbuf == NULL) { - return SDL_OutOfMemory(); - } - this->hidden->nextbuf = this->hidden->mixbuf; - SDL_memset(this->hidden->mixbuf, this->spec.silence, 2 * this->hidden->mixlen); - - /* We use XAUDIO2_DEFAULT_CHANNELS instead of this->spec.channels. On - Xbox360, this means 5.1 output, but on Windows, it means "figure out - what the system has." It might be preferable to let XAudio2 blast - stereo output to appropriate surround sound configurations - instead of clamping to 2 channels, even though we'll configure the - Source Voice for whatever number of channels you supply. */ -#if SDL_XAUDIO2_WIN8 - result = IXAudio2_CreateMasteringVoice(ixa2, &this->hidden->mastering, - XAUDIO2_DEFAULT_CHANNELS, - this->spec.freq, 0, devId, NULL, AudioCategory_GameEffects); -#else - result = IXAudio2_CreateMasteringVoice(ixa2, &this->hidden->mastering, - XAUDIO2_DEFAULT_CHANNELS, - this->spec.freq, 0, devId, NULL); -#endif - if (result != S_OK) { - return SDL_SetError("XAudio2: Couldn't create mastering voice"); - } - - SDL_zero(waveformat); - if (SDL_AUDIO_ISFLOAT(this->spec.format)) { - waveformat.wFormatTag = WAVE_FORMAT_IEEE_FLOAT; - } else { - waveformat.wFormatTag = WAVE_FORMAT_PCM; - } - waveformat.wBitsPerSample = SDL_AUDIO_BITSIZE(this->spec.format); - waveformat.nChannels = this->spec.channels; - waveformat.nSamplesPerSec = this->spec.freq; - waveformat.nBlockAlign = - waveformat.nChannels * (waveformat.wBitsPerSample / 8); - waveformat.nAvgBytesPerSec = - waveformat.nSamplesPerSec * waveformat.nBlockAlign; - waveformat.cbSize = sizeof(waveformat); - -#ifdef __WINRT__ - // DLudwig: for now, make XAudio2 do sample rate conversion, just to - // get the loopwave test to work. - // - // TODO, WinRT: consider removing WinRT-specific source-voice creation code from SDL_xaudio2.c - result = IXAudio2_CreateSourceVoice(ixa2, &source, &waveformat, - 0, - 1.0f, &callbacks, NULL, NULL); -#else - result = IXAudio2_CreateSourceVoice(ixa2, &source, &waveformat, - XAUDIO2_VOICE_NOSRC | - XAUDIO2_VOICE_NOPITCH, - 1.0f, &callbacks, NULL, NULL); - -#endif - if (result != S_OK) { - return SDL_SetError("XAudio2: Couldn't create source voice"); - } - this->hidden->source = source; - - /* Start everything playing! */ - result = IXAudio2_StartEngine(ixa2); - if (result != S_OK) { - return SDL_SetError("XAudio2: Couldn't start engine"); - } - - result = IXAudio2SourceVoice_Start(source, 0, XAUDIO2_COMMIT_NOW); - if (result != S_OK) { - return SDL_SetError("XAudio2: Couldn't start source voice"); - } - - return 0; /* good to go. */ -} - -static void -XAUDIO2_Deinitialize(void) -{ -#if defined(__WIN32__) - WIN_CoUninitialize(); -#endif -} - -#endif /* SDL_XAUDIO2_HAS_SDK */ - - -static int -XAUDIO2_Init(SDL_AudioDriverImpl * impl) -{ -#ifndef SDL_XAUDIO2_HAS_SDK - SDL_SetError("XAudio2: SDL was built without XAudio2 support (old DirectX SDK)."); - return 0; /* no XAudio2 support, ever. Update your SDK! */ -#else - /* XAudio2Create() is a macro that uses COM; we don't load the .dll */ - IXAudio2 *ixa2 = NULL; -#if defined(__WIN32__) - // TODO, WinRT: Investigate using CoInitializeEx here - if (FAILED(WIN_CoInitialize())) { - SDL_SetError("XAudio2: CoInitialize() failed"); - return 0; - } -#endif - - if (XAudio2Create(&ixa2, 0, XAUDIO2_DEFAULT_PROCESSOR) != S_OK) { -#if defined(__WIN32__) - WIN_CoUninitialize(); -#endif - SDL_SetError("XAudio2: XAudio2Create() failed at initialization"); - return 0; /* not available. */ - } - IXAudio2_Release(ixa2); - - /* Set the function pointers */ - impl->DetectDevices = XAUDIO2_DetectDevices; - impl->OpenDevice = XAUDIO2_OpenDevice; - impl->PlayDevice = XAUDIO2_PlayDevice; - impl->WaitDevice = XAUDIO2_WaitDevice; - impl->PrepareToClose = XAUDIO2_PrepareToClose; - impl->GetDeviceBuf = XAUDIO2_GetDeviceBuf; - impl->CloseDevice = XAUDIO2_CloseDevice; - impl->Deinitialize = XAUDIO2_Deinitialize; - - /* !!! FIXME: We can apparently use a C++ interface on Windows 8 - * !!! FIXME: (Windows::Devices::Enumeration::DeviceInformation) for device - * !!! FIXME: detection, but it's not implemented here yet. - * !!! FIXME: see http://blogs.msdn.com/b/chuckw/archive/2012/04/02/xaudio2-and-windows-8-consumer-preview.aspx - * !!! FIXME: for now, force the default device. - */ -#if defined(SDL_XAUDIO2_WIN8) || defined(__WINRT__) - impl->OnlyHasDefaultOutputDevice = 1; -#endif - - return 1; /* this audio target is available. */ -#endif -} - -AudioBootStrap XAUDIO2_bootstrap = { - "xaudio2", "XAudio2", XAUDIO2_Init, 0 -}; - -#endif /* SDL_AUDIO_DRIVER_XAUDIO2 */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2.h b/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2.h deleted file mode 100644 index 864eba451..000000000 --- a/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2.h +++ /dev/null @@ -1,386 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _SDL_XAUDIO2_H -#define _SDL_XAUDIO2_H - -#include -#include -#include - -/* XAudio2 packs its structure members together as tightly as possible. - This pragma is needed to ensure compatibility with XAudio2 on 64-bit - platforms. -*/ -#pragma pack(push, 1) - -typedef interface IXAudio2 IXAudio2; -typedef interface IXAudio2SourceVoice IXAudio2SourceVoice; -typedef interface IXAudio2MasteringVoice IXAudio2MasteringVoice; -typedef interface IXAudio2EngineCallback IXAudio2EngineCallback; -typedef interface IXAudio2VoiceCallback IXAudio2VoiceCallback; -typedef interface IXAudio2Voice IXAudio2Voice; -typedef interface IXAudio2SubmixVoice IXAudio2SubmixVoice; - -typedef enum _AUDIO_STREAM_CATEGORY { - AudioCategory_Other = 0, - AudioCategory_ForegroundOnlyMedia, - AudioCategory_BackgroundCapableMedia, - AudioCategory_Communications, - AudioCategory_Alerts, - AudioCategory_SoundEffects, - AudioCategory_GameEffects, - AudioCategory_GameMedia, - AudioCategory_GameChat, - AudioCategory_Movie, - AudioCategory_Media -} AUDIO_STREAM_CATEGORY; - -typedef struct XAUDIO2_BUFFER { - UINT32 Flags; - UINT32 AudioBytes; - const BYTE *pAudioData; - UINT32 PlayBegin; - UINT32 PlayLength; - UINT32 LoopBegin; - UINT32 LoopLength; - UINT32 LoopCount; - void *pContext; -} XAUDIO2_BUFFER; - -typedef struct XAUDIO2_BUFFER_WMA { - const UINT32 *pDecodedPacketCumulativeBytes; - UINT32 PacketCount; -} XAUDIO2_BUFFER_WMA; - -typedef struct XAUDIO2_SEND_DESCRIPTOR { - UINT32 Flags; - IXAudio2Voice *pOutputVoice; -} XAUDIO2_SEND_DESCRIPTOR; - -typedef struct XAUDIO2_VOICE_SENDS { - UINT32 SendCount; - XAUDIO2_SEND_DESCRIPTOR *pSends; -} XAUDIO2_VOICE_SENDS; - -typedef struct XAUDIO2_EFFECT_DESCRIPTOR { - IUnknown *pEffect; - BOOL InitialState; - UINT32 OutputChannels; -} XAUDIO2_EFFECT_DESCRIPTOR; - -typedef struct XAUDIO2_EFFECT_CHAIN { - UINT32 EffectCount; - XAUDIO2_EFFECT_DESCRIPTOR *pEffectDescriptors; -} XAUDIO2_EFFECT_CHAIN; - -typedef struct XAUDIO2_PERFORMANCE_DATA { - UINT64 AudioCyclesSinceLastQuery; - UINT64 TotalCyclesSinceLastQuery; - UINT32 MinimumCyclesPerQuantum; - UINT32 MaximumCyclesPerQuantum; - UINT32 MemoryUsageInBytes; - UINT32 CurrentLatencyInSamples; - UINT32 GlitchesSinceEngineStarted; - UINT32 ActiveSourceVoiceCount; - UINT32 TotalSourceVoiceCount; - UINT32 ActiveSubmixVoiceCount; - UINT32 ActiveResamplerCount; - UINT32 ActiveMatrixMixCount; - UINT32 ActiveXmaSourceVoices; - UINT32 ActiveXmaStreams; -} XAUDIO2_PERFORMANCE_DATA; - -typedef struct XAUDIO2_DEBUG_CONFIGURATION { - UINT32 TraceMask; - UINT32 BreakMask; - BOOL LogThreadID; - BOOL LogFileline; - BOOL LogFunctionName; - BOOL LogTiming; -} XAUDIO2_DEBUG_CONFIGURATION; - -typedef struct XAUDIO2_VOICE_DETAILS { - UINT32 CreationFlags; - UINT32 ActiveFlags; - UINT32 InputChannels; - UINT32 InputSampleRate; -} XAUDIO2_VOICE_DETAILS; - -typedef enum XAUDIO2_FILTER_TYPE { - LowPassFilter = 0, - BandPassFilter = 1, - HighPassFilter = 2, - NotchFilter = 3, - LowPassOnePoleFilter = 4, - HighPassOnePoleFilter = 5 -} XAUDIO2_FILTER_TYPE; - -typedef struct XAUDIO2_FILTER_PARAMETERS { - XAUDIO2_FILTER_TYPE Type; - float Frequency; - float OneOverQ; -} XAUDIO2_FILTER_PARAMETERS; - -typedef struct XAUDIO2_VOICE_STATE { - void *pCurrentBufferContext; - UINT32 BuffersQueued; - UINT64 SamplesPlayed; -} XAUDIO2_VOICE_STATE; - - -typedef UINT32 XAUDIO2_PROCESSOR; -#define Processor1 0x00000001 -#define XAUDIO2_DEFAULT_PROCESSOR Processor1 - -#define XAUDIO2_E_DEVICE_INVALIDATED 0x88960004 -#define XAUDIO2_COMMIT_NOW 0 -#define XAUDIO2_VOICE_NOSAMPLESPLAYED 0x0100 -#define XAUDIO2_DEFAULT_CHANNELS 0 - -extern HRESULT __stdcall XAudio2Create( - _Out_ IXAudio2 **ppXAudio2, - _In_ UINT32 Flags, - _In_ XAUDIO2_PROCESSOR XAudio2Processor - ); - -#undef INTERFACE -#define INTERFACE IXAudio2 -typedef interface IXAudio2 { - const struct IXAudio2Vtbl FAR* lpVtbl; -} IXAudio2; -typedef const struct IXAudio2Vtbl IXAudio2Vtbl; -const struct IXAudio2Vtbl -{ - /* IUnknown */ - STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - /* IXAudio2 */ - STDMETHOD_(HRESULT, RegisterForCallbacks)(THIS, IXAudio2EngineCallback *pCallback) PURE; - STDMETHOD_(VOID, UnregisterForCallbacks)(THIS, IXAudio2EngineCallback *pCallback) PURE; - STDMETHOD_(HRESULT, CreateSourceVoice)(THIS, IXAudio2SourceVoice **ppSourceVoice, - const WAVEFORMATEX *pSourceFormat, - UINT32 Flags, - float MaxFrequencyRatio, - IXAudio2VoiceCallback *pCallback, - const XAUDIO2_VOICE_SENDS *pSendList, - const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE; - STDMETHOD_(HRESULT, CreateSubmixVoice)(THIS, IXAudio2SubmixVoice **ppSubmixVoice, - UINT32 InputChannels, - UINT32 InputSampleRate, - UINT32 Flags, - UINT32 ProcessingStage, - const XAUDIO2_VOICE_SENDS *pSendList, - const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE; - STDMETHOD_(HRESULT, CreateMasteringVoice)(THIS, IXAudio2MasteringVoice **ppMasteringVoice, - UINT32 InputChannels, - UINT32 InputSampleRate, - UINT32 Flags, - LPCWSTR szDeviceId, - const XAUDIO2_EFFECT_CHAIN *pEffectChain, - AUDIO_STREAM_CATEGORY StreamCategory) PURE; - STDMETHOD_(HRESULT, StartEngine)(THIS) PURE; - STDMETHOD_(VOID, StopEngine)(THIS) PURE; - STDMETHOD_(HRESULT, CommitChanges)(THIS, UINT32 OperationSet) PURE; - STDMETHOD_(HRESULT, GetPerformanceData)(THIS, XAUDIO2_PERFORMANCE_DATA *pPerfData) PURE; - STDMETHOD_(HRESULT, SetDebugConfiguration)(THIS, XAUDIO2_DEBUG_CONFIGURATION *pDebugConfiguration, - VOID *pReserved) PURE; -}; - -#define IXAudio2_Release(A) ((A)->lpVtbl->Release(A)) -#define IXAudio2_CreateSourceVoice(A,B,C,D,E,F,G,H) ((A)->lpVtbl->CreateSourceVoice(A,B,C,D,E,F,G,H)) -#define IXAudio2_CreateMasteringVoice(A,B,C,D,E,F,G,H) ((A)->lpVtbl->CreateMasteringVoice(A,B,C,D,E,F,G,H)) -#define IXAudio2_StartEngine(A) ((A)->lpVtbl->StartEngine(A)) -#define IXAudio2_StopEngine(A) ((A)->lpVtbl->StopEngine(A)) - - -#undef INTERFACE -#define INTERFACE IXAudio2SourceVoice -typedef interface IXAudio2SourceVoice { - const struct IXAudio2SourceVoiceVtbl FAR* lpVtbl; -} IXAudio2SourceVoice; -typedef const struct IXAudio2SourceVoiceVtbl IXAudio2SourceVoiceVtbl; -const struct IXAudio2SourceVoiceVtbl -{ - /* MSDN says that IXAudio2Voice inherits from IXAudio2, but MSVC's debugger - * says otherwise, and that IXAudio2Voice doesn't inherit from any other - * interface! - */ - - /* IXAudio2Voice */ - STDMETHOD_(VOID, GetVoiceDetails)(THIS, XAUDIO2_VOICE_DETAILS *pVoiceDetails) PURE; - STDMETHOD_(HRESULT, SetOutputVoices)(THIS, const XAUDIO2_VOICE_SENDS *pSendList) PURE; - STDMETHOD_(HRESULT, SetEffectChain)(THIS, const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE; - STDMETHOD_(HRESULT, EnableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE; - STDMETHOD_(HRESULT, DisableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetEffectState)(THIS, UINT32 EffectIndex, BOOL *pEnabled) PURE; - STDMETHOD_(HRESULT, SetEffectParameters)(THIS, UINT32 EffectIndex, - const void *pParameters, - UINT32 ParametersByteSize, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetEffectParameters)(THIS, UINT32 EffectIndex, - void *pParameters, - UINT32 ParametersByteSize) PURE; - STDMETHOD_(HRESULT, SetFilterParameters)(THIS, const XAUDIO2_FILTER_PARAMETERS *pParameters, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetFilterParameters)(THIS, XAUDIO2_FILTER_PARAMETERS *pParameters) PURE; - STDMETHOD_(HRESULT, SetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice, - XAUDIO2_FILTER_PARAMETERS *pParameters, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice, - XAUDIO2_FILTER_PARAMETERS *pParameters) PURE; - STDMETHOD_(HRESULT, SetVolume)(THIS, float Volume, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetVolume)(THIS, float *pVolume) PURE; - STDMETHOD_(HRESULT, SetChannelVolumes)(THIS, UINT32 Channels, - const float *pVolumes, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetChannelVolumes)(THIS, UINT32 Channels, - float *pVolumes) PURE; - STDMETHOD_(HRESULT, SetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice, - UINT32 SourceChannels, - UINT32 DestinationChannels, - const float *pLevelMatrix, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice, - UINT32 SourceChannels, - UINT32 DestinationChannels, - float *pLevelMatrix) PURE; - STDMETHOD_(VOID, DestroyVoice)(THIS) PURE; - - /* IXAudio2SourceVoice */ - STDMETHOD_(HRESULT, Start)(THIS, UINT32 Flags, - UINT32 OperationSet) PURE; - STDMETHOD_(HRESULT, Stop)(THIS, UINT32 Flags, - UINT32 OperationSet) PURE; - STDMETHOD_(HRESULT, SubmitSourceBuffer)(THIS, const XAUDIO2_BUFFER *pBuffer, - const XAUDIO2_BUFFER_WMA *pBufferWMA) PURE; - STDMETHOD_(HRESULT, FlushSourceBuffers)(THIS) PURE; - STDMETHOD_(HRESULT, Discontinuity)(THIS) PURE; - STDMETHOD_(HRESULT, ExitLoop)(THIS, UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetState)(THIS, XAUDIO2_VOICE_STATE *pVoiceState, - UINT32 Flags) PURE; - STDMETHOD_(HRESULT, SetFrequencyRatio)(THIS, float Ratio, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetFrequencyRatio)(THIS, float *pRatio) PURE; - STDMETHOD_(HRESULT, SetSourceSampleRate)(THIS, UINT32 NewSourceSampleRate) PURE; -}; - -#define IXAudio2SourceVoice_DestroyVoice(A) ((A)->lpVtbl->DestroyVoice(A)) -#define IXAudio2SourceVoice_Start(A,B,C) ((A)->lpVtbl->Start(A,B,C)) -#define IXAudio2SourceVoice_Stop(A,B,C) ((A)->lpVtbl->Stop(A,B,C)) -#define IXAudio2SourceVoice_SubmitSourceBuffer(A,B,C) ((A)->lpVtbl->SubmitSourceBuffer(A,B,C)) -#define IXAudio2SourceVoice_FlushSourceBuffers(A) ((A)->lpVtbl->FlushSourceBuffers(A)) -#define IXAudio2SourceVoice_Discontinuity(A) ((A)->lpVtbl->Discontinuity(A)) -#define IXAudio2SourceVoice_GetState(A,B,C) ((A)->lpVtbl->GetState(A,B,C)) - - -#undef INTERFACE -#define INTERFACE IXAudio2MasteringVoice -typedef interface IXAudio2MasteringVoice { - const struct IXAudio2MasteringVoiceVtbl FAR* lpVtbl; -} IXAudio2MasteringVoice; -typedef const struct IXAudio2MasteringVoiceVtbl IXAudio2MasteringVoiceVtbl; -const struct IXAudio2MasteringVoiceVtbl -{ - /* MSDN says that IXAudio2Voice inherits from IXAudio2, but MSVC's debugger - * says otherwise, and that IXAudio2Voice doesn't inherit from any other - * interface! - */ - - /* IXAudio2Voice */ - STDMETHOD_(VOID, GetVoiceDetails)(THIS, XAUDIO2_VOICE_DETAILS *pVoiceDetails) PURE; - STDMETHOD_(HRESULT, SetOutputVoices)(THIS, const XAUDIO2_VOICE_SENDS *pSendList) PURE; - STDMETHOD_(HRESULT, SetEffectChain)(THIS, const XAUDIO2_EFFECT_CHAIN *pEffectChain) PURE; - STDMETHOD_(HRESULT, EnableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE; - STDMETHOD_(HRESULT, DisableEffect)(THIS, UINT32 EffectIndex, UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetEffectState)(THIS, UINT32 EffectIndex, BOOL *pEnabled) PURE; - STDMETHOD_(HRESULT, SetEffectParameters)(THIS, UINT32 EffectIndex, - const void *pParameters, - UINT32 ParametersByteSize, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetEffectParameters)(THIS, UINT32 EffectIndex, - void *pParameters, - UINT32 ParametersByteSize) PURE; - STDMETHOD_(HRESULT, SetFilterParameters)(THIS, const XAUDIO2_FILTER_PARAMETERS *pParameters, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetFilterParameters)(THIS, XAUDIO2_FILTER_PARAMETERS *pParameters) PURE; - STDMETHOD_(HRESULT, SetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice, - XAUDIO2_FILTER_PARAMETERS *pParameters, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetOutputFilterParameters)(THIS, IXAudio2Voice *pDestinationVoice, - XAUDIO2_FILTER_PARAMETERS *pParameters) PURE; - STDMETHOD_(HRESULT, SetVolume)(THIS, float Volume, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetVolume)(THIS, float *pVolume) PURE; - STDMETHOD_(HRESULT, SetChannelVolumes)(THIS, UINT32 Channels, - const float *pVolumes, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetChannelVolumes)(THIS, UINT32 Channels, - float *pVolumes) PURE; - STDMETHOD_(HRESULT, SetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice, - UINT32 SourceChannels, - UINT32 DestinationChannels, - const float *pLevelMatrix, - UINT32 OperationSet) PURE; - STDMETHOD_(VOID, GetOutputMatrix)(THIS, IXAudio2Voice *pDestinationVoice, - UINT32 SourceChannels, - UINT32 DestinationChannels, - float *pLevelMatrix) PURE; - STDMETHOD_(VOID, DestroyVoice)(THIS) PURE; - - /* IXAudio2SourceVoice */ - STDMETHOD_(VOID, GetChannelMask)(THIS, DWORD *pChannelMask) PURE; -}; - -#define IXAudio2MasteringVoice_DestroyVoice(A) ((A)->lpVtbl->DestroyVoice(A)) - - -#undef INTERFACE -#define INTERFACE IXAudio2VoiceCallback -typedef interface IXAudio2VoiceCallback { - const struct IXAudio2VoiceCallbackVtbl FAR* lpVtbl; -} IXAudio2VoiceCallback; -typedef const struct IXAudio2VoiceCallbackVtbl IXAudio2VoiceCallbackVtbl; -const struct IXAudio2VoiceCallbackVtbl -{ - /* MSDN says that IXAudio2VoiceCallback inherits from IXAudio2, but SDL's - * own code says otherwise, and that IXAudio2VoiceCallback doesn't inherit - * from any other interface! - */ - - /* IXAudio2VoiceCallback */ - STDMETHOD_(VOID, OnVoiceProcessingPassStart)(THIS, UINT32 BytesRequired) PURE; - STDMETHOD_(VOID, OnVoiceProcessingPassEnd)(THIS) PURE; - STDMETHOD_(VOID, OnStreamEnd)(THIS) PURE; - STDMETHOD_(VOID, OnBufferStart)(THIS, void *pBufferContext) PURE; - STDMETHOD_(VOID, OnBufferEnd)(THIS, void *pBufferContext) PURE; - STDMETHOD_(VOID, OnLoopEnd)(THIS, void *pBufferContext) PURE; - STDMETHOD_(VOID, OnVoiceError)(THIS, void *pBufferContext, HRESULT Error) PURE; -}; - -#pragma pack(pop) /* Undo pragma push */ - -#endif /* _SDL_XAUDIO2_H */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp b/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp deleted file mode 100644 index b2d67c7fb..000000000 --- a/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2_winrthelpers.cpp +++ /dev/null @@ -1,90 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#include -#include "SDL_xaudio2_winrthelpers.h" - -#if WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP -using Windows::Devices::Enumeration::DeviceClass; -using Windows::Devices::Enumeration::DeviceInformation; -using Windows::Devices::Enumeration::DeviceInformationCollection; -#endif - -extern "C" HRESULT __cdecl IXAudio2_GetDeviceCount(IXAudio2 * ixa2, UINT32 * devcount) -{ -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP - // There doesn't seem to be any audio device enumeration on Windows Phone. - // In lieu of this, just treat things as if there is one and only one - // audio device. - *devcount = 1; - return S_OK; -#else - // TODO, WinRT: make xaudio2 device enumeration only happen once, and in the background - auto operation = DeviceInformation::FindAllAsync(DeviceClass::AudioRender); - while (operation->Status != Windows::Foundation::AsyncStatus::Completed) - { - } - - DeviceInformationCollection^ devices = operation->GetResults(); - *devcount = devices->Size; - return S_OK; -#endif -} - -extern "C" HRESULT IXAudio2_GetDeviceDetails(IXAudio2 * unused, UINT32 index, XAUDIO2_DEVICE_DETAILS * details) -{ -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP - // Windows Phone doesn't seem to have the same device enumeration APIs that - // Windows 8/RT has, or it doesn't have them at all. In lieu of this, - // just treat things as if there is one, and only one, default device. - if (index != 0) - { - return XAUDIO2_E_INVALID_CALL; - } - - if (details) - { - wcsncpy_s(details->DeviceID, ARRAYSIZE(details->DeviceID), L"default", _TRUNCATE); - wcsncpy_s(details->DisplayName, ARRAYSIZE(details->DisplayName), L"default", _TRUNCATE); - } - return S_OK; -#else - auto operation = DeviceInformation::FindAllAsync(DeviceClass::AudioRender); - while (operation->Status != Windows::Foundation::AsyncStatus::Completed) - { - } - - DeviceInformationCollection^ devices = operation->GetResults(); - if (index >= devices->Size) - { - return XAUDIO2_E_INVALID_CALL; - } - - DeviceInformation^ d = devices->GetAt(index); - if (details) - { - wcsncpy_s(details->DeviceID, ARRAYSIZE(details->DeviceID), d->Id->Data(), _TRUNCATE); - wcsncpy_s(details->DisplayName, ARRAYSIZE(details->DisplayName), d->Name->Data(), _TRUNCATE); - } - return S_OK; -#endif -} diff --git a/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h b/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h deleted file mode 100644 index aa6486f91..000000000 --- a/Engine/lib/sdl/src/audio/xaudio2/SDL_xaudio2_winrthelpers.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -// -// Re-implementation of methods removed from XAudio2 (in WinRT): -// - -typedef struct XAUDIO2_DEVICE_DETAILS -{ - WCHAR DeviceID[256]; - WCHAR DisplayName[256]; - /* Other fields exist in the pre-Windows 8 version of this struct, however - they weren't used by SDL, so they weren't added. - */ -} XAUDIO2_DEVICE_DETAILS; - - -#ifdef __cplusplus -extern "C" { -#endif - -HRESULT IXAudio2_GetDeviceCount(IXAudio2 * unused, UINT32 * devcount); -HRESULT IXAudio2_GetDeviceDetails(IXAudio2 * unused, UINT32 index, XAUDIO2_DEVICE_DETAILS * details); - -#ifdef __cplusplus -} -#endif - - -// -// C-style macros to call XAudio2's methods in C++: -// -#ifdef __cplusplus -/* -#define IXAudio2_CreateMasteringVoice(A, B, C, D, E, F, G) (A)->CreateMasteringVoice((B), (C), (D), (E), (F), (G)) -#define IXAudio2_CreateSourceVoice(A, B, C, D, E, F, G, H) (A)->CreateSourceVoice((B), (C), (D), (E), (F), (G), (H)) -#define IXAudio2_QueryInterface(A, B, C) (A)->QueryInterface((B), (C)) -#define IXAudio2_Release(A) (A)->Release() -#define IXAudio2_StartEngine(A) (A)->StartEngine() -#define IXAudio2_StopEngine(A) (A)->StopEngine() - -#define IXAudio2MasteringVoice_DestroyVoice(A) (A)->DestroyVoice() - -#define IXAudio2SourceVoice_DestroyVoice(A) (A)->DestroyVoice() -#define IXAudio2SourceVoice_Discontinuity(A) (A)->Discontinuity() -#define IXAudio2SourceVoice_FlushSourceBuffers(A) (A)->FlushSourceBuffers() -#define IXAudio2SourceVoice_GetState(A, B) (A)->GetState((B)) -#define IXAudio2SourceVoice_Start(A, B, C) (A)->Start((B), (C)) -#define IXAudio2SourceVoice_Stop(A, B, C) (A)->Stop((B), (C)) -#define IXAudio2SourceVoice_SubmitSourceBuffer(A, B, C) (A)->SubmitSourceBuffer((B), (C)) -*/ -#endif // ifdef __cplusplus diff --git a/Engine/lib/sdl/src/core/android/SDL_android.c b/Engine/lib/sdl/src/core/android/SDL_android.c index b93b16255..c40c6764f 100644 --- a/Engine/lib/sdl/src/core/android/SDL_android.c +++ b/Engine/lib/sdl/src/core/android/SDL_android.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,12 +23,14 @@ #include "SDL_assert.h" #include "SDL_hints.h" #include "SDL_log.h" +#include "SDL_main.h" #ifdef __ANDROID__ #include "SDL_system.h" #include "SDL_android.h" -#include + +#include "keyinfotable.h" #include "../../events/SDL_events_c.h" #include "../../video/android/SDL_androidkeyboard.h" @@ -37,17 +39,153 @@ #include "../../video/android/SDL_androidvideo.h" #include "../../video/android/SDL_androidwindow.h" #include "../../joystick/android/SDL_sysjoystick_c.h" +#include "../../haptic/android/SDL_syshaptic_c.h" #include #include #include #include -#define LOG_TAG "SDL_android" +#include +/* #define LOG_TAG "SDL_android" */ /* #define LOGI(...) __android_log_print(ANDROID_LOG_INFO,LOG_TAG,__VA_ARGS__) */ /* #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) */ #define LOGI(...) do {} while (0) #define LOGE(...) do {} while (0) + +#define SDL_JAVA_PREFIX org_libsdl_app +#define CONCAT1(prefix, class, function) CONCAT2(prefix, class, function) +#define CONCAT2(prefix, class, function) Java_ ## prefix ## _ ## class ## _ ## function +#define SDL_JAVA_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLActivity, function) +#define SDL_JAVA_AUDIO_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLAudioManager, function) +#define SDL_JAVA_CONTROLLER_INTERFACE(function) CONCAT1(SDL_JAVA_PREFIX, SDLControllerManager, function) +#define SDL_JAVA_INTERFACE_INPUT_CONNECTION(function) CONCAT1(SDL_JAVA_PREFIX, SDLInputConnection, function) + + +/* Java class SDLActivity */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)( + JNIEnv* mEnv, jclass cls); + +JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)( + JNIEnv* env, jclass cls, + jstring library, jstring function, jobject array); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)( + JNIEnv* env, jclass jcls, + jstring filename); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)( + JNIEnv* env, jclass jcls, + jint width, jint height, jint format, jfloat rate); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)( + JNIEnv* env, jclass jcls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)( + JNIEnv* env, jclass jcls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyDown)( + JNIEnv* env, jclass jcls, + jint keycode); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyUp)( + JNIEnv* env, jclass jcls, + jint keycode); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost)( + JNIEnv* env, jclass jcls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeTouch)( + JNIEnv* env, jclass jcls, + jint touch_device_id_in, jint pointer_finger_id_in, + jint action, jfloat x, jfloat y, jfloat p); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeMouse)( + JNIEnv* env, jclass jcls, + jint button, jint action, jfloat x, jfloat y); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)( + JNIEnv* env, jclass jcls, + jfloat x, jfloat y, jfloat z); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)( + JNIEnv* env, jclass jcls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)( + JNIEnv* env, jclass cls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)( + JNIEnv* env, jclass cls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)( + JNIEnv* env, jclass cls); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)( + JNIEnv* env, jclass cls); + +JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)( + JNIEnv* env, jclass cls, + jstring name); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)( + JNIEnv* env, jclass cls, + jstring name, jstring value); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeEnvironmentVariablesSet)( + JNIEnv* env, jclass cls); + +/* Java class SDLInputConnection */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)( + JNIEnv* env, jclass cls, + jstring text, jint newCursorPosition); + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)( + JNIEnv* env, jclass cls, + jstring text, jint newCursorPosition); + +/* Java class SDLAudioManager */ +JNIEXPORT void JNICALL SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI)( + JNIEnv *env, jclass jcls); + +/* Java class SDLControllerManager */ +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI)( + JNIEnv *env, jclass jcls); + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown)( + JNIEnv* env, jclass jcls, + jint device_id, jint keycode); + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadUp)( + JNIEnv* env, jclass jcls, + jint device_id, jint keycode); + +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeJoy)( + JNIEnv* env, jclass jcls, + jint device_id, jint axis, jfloat value); + +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeHat)( + JNIEnv* env, jclass jcls, + jint device_id, jint hat_id, jint x, jint y); + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddJoystick)( + JNIEnv* env, jclass jcls, + jint device_id, jstring device_name, jstring device_desc, jint is_accelerometer, + jint nbuttons, jint naxes, jint nhats, jint nballs); + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveJoystick)( + JNIEnv* env, jclass jcls, + jint device_id); + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddHaptic)( + JNIEnv* env, jclass jcls, + jint device_id, jstring device_name); + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic)( + JNIEnv* env, jclass jcls, + jint device_id); + + + /* Uncomment this to log messages entering and exiting methods in this file */ /* #define DEBUG_JNI */ @@ -57,7 +195,6 @@ static void Android_JNI_ThreadDestroyed(void*); This file links the Java side of Android with libsdl *******************************************************************************/ #include -#include /******************************************************************************* @@ -71,6 +208,26 @@ static jclass mActivityClass; /* method signatures */ static jmethodID midGetNativeSurface; +static jmethodID midSetActivityTitle; +static jmethodID midSetWindowStyle; +static jmethodID midSetOrientation; +static jmethodID midGetContext; +static jmethodID midIsAndroidTV; +static jmethodID midInputGetInputDeviceIds; +static jmethodID midSendMessage; +static jmethodID midShowTextInput; +static jmethodID midIsScreenKeyboardShown; +static jmethodID midClipboardSetText; +static jmethodID midClipboardGetText; +static jmethodID midClipboardHasText; +static jmethodID midOpenAPKExpansionInputStream; +static jmethodID midGetManifestEnvironmentVariables; +static jmethodID midGetDisplayDPI; + +/* audio manager */ +static jclass mAudioManagerClass; + +/* method signatures */ static jmethodID midAudioOpen; static jmethodID midAudioWriteShortBuffer; static jmethodID midAudioWriteByteBuffer; @@ -79,12 +236,24 @@ static jmethodID midCaptureOpen; static jmethodID midCaptureReadShortBuffer; static jmethodID midCaptureReadByteBuffer; static jmethodID midCaptureClose; + +/* controller manager */ +static jclass mControllerManagerClass; + +/* method signatures */ static jmethodID midPollInputDevices; +static jmethodID midPollHapticDevices; +static jmethodID midHapticRun; + +/* static fields */ +static jfieldID fidSeparateMouseAndTouch; /* Accelerometer data storage */ static float fLastAccelerometer[3]; static SDL_bool bHasNewData; +static SDL_bool bHasEnvironmentVariables = SDL_FALSE; + /******************************************************************************* Functions called by JNI *******************************************************************************/ @@ -111,10 +280,20 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) return JNI_VERSION_1_4; } -/* Called before SDL_main() to initialize JNI bindings */ -JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls) +void checkJNIReady() { - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_Android_Init()"); + if (!mActivityClass || !mAudioManagerClass || !mControllerManagerClass) { + // We aren't fully initialized, let's just return. + return; + } + + SDL_SetMainReady(); +} + +/* Activity initialization -- called before SDL_main() to initialize JNI bindings */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetupJNI)(JNIEnv* mEnv, jclass cls) +{ + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeSetupJNI()"); Android_JNI_SetupThread(); @@ -122,38 +301,196 @@ JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls) midGetNativeSurface = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "getNativeSurface","()Landroid/view/Surface;"); - midAudioOpen = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "audioOpen", "(IZZI)I"); - midAudioWriteShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "audioWriteShortBuffer", "([S)V"); - midAudioWriteByteBuffer = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "audioWriteByteBuffer", "([B)V"); - midAudioClose = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "audioClose", "()V"); - midCaptureOpen = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "captureOpen", "(IZZI)I"); - midCaptureReadShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "captureReadShortBuffer", "([SZ)I"); - midCaptureReadByteBuffer = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "captureReadByteBuffer", "([BZ)I"); - midCaptureClose = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "captureClose", "()V"); - midPollInputDevices = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "pollInputDevices", "()V"); + midSetActivityTitle = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "setActivityTitle","(Ljava/lang/String;)Z"); + midSetWindowStyle = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "setWindowStyle","(Z)V"); + midSetOrientation = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "setOrientation","(IIZLjava/lang/String;)V"); + midGetContext = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "getContext","()Landroid/content/Context;"); + midIsAndroidTV = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "isAndroidTV","()Z"); + midInputGetInputDeviceIds = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "inputGetInputDeviceIds", "(I)[I"); + midSendMessage = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "sendMessage", "(II)Z"); + midShowTextInput = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "showTextInput", "(IIII)Z"); + midIsScreenKeyboardShown = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "isScreenKeyboardShown","()Z"); + midClipboardSetText = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "clipboardSetText", "(Ljava/lang/String;)V"); + midClipboardGetText = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "clipboardGetText", "()Ljava/lang/String;"); + midClipboardHasText = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "clipboardHasText", "()Z"); + midOpenAPKExpansionInputStream = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "openAPKExpansionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;"); - bHasNewData = SDL_FALSE; + midGetManifestEnvironmentVariables = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, + "getManifestEnvironmentVariables", "()Z"); + + midGetDisplayDPI = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "getDisplayDPI", "()Landroid/util/DisplayMetrics;"); + midGetDisplayDPI = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, "getDisplayDPI", "()Landroid/util/DisplayMetrics;"); if (!midGetNativeSurface || - !midAudioOpen || !midAudioWriteShortBuffer || !midAudioWriteByteBuffer || !midAudioClose || - !midCaptureOpen || !midCaptureReadShortBuffer || !midCaptureReadByteBuffer || !midCaptureClose || - !midPollInputDevices) { - __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL: Couldn't locate Java callbacks, check that they're named and typed correctly"); + !midSetActivityTitle || !midSetWindowStyle || !midSetOrientation || !midGetContext || !midIsAndroidTV || !midInputGetInputDeviceIds || + !midSendMessage || !midShowTextInput || !midIsScreenKeyboardShown || + !midClipboardSetText || !midClipboardGetText || !midClipboardHasText || + !midOpenAPKExpansionInputStream || !midGetManifestEnvironmentVariables|| !midGetDisplayDPI) { + __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLActivity.java?"); } - __android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_Android_Init() finished!"); + + fidSeparateMouseAndTouch = (*mEnv)->GetStaticFieldID(mEnv, mActivityClass, "mSeparateMouseAndTouch", "Z"); + + if (!fidSeparateMouseAndTouch) { + __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java static fields, do you have the latest version of SDLActivity.java?"); + } + + checkJNIReady(); +} + +/* Audio initialization -- called before SDL_main() to initialize JNI bindings */ +JNIEXPORT void JNICALL SDL_JAVA_AUDIO_INTERFACE(nativeSetupJNI)(JNIEnv* mEnv, jclass cls) +{ + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "AUDIO nativeSetupJNI()"); + + Android_JNI_SetupThread(); + + mAudioManagerClass = (jclass)((*mEnv)->NewGlobalRef(mEnv, cls)); + + midAudioOpen = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "audioOpen", "(IZZI)I"); + midAudioWriteShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "audioWriteShortBuffer", "([S)V"); + midAudioWriteByteBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "audioWriteByteBuffer", "([B)V"); + midAudioClose = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "audioClose", "()V"); + midCaptureOpen = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "captureOpen", "(IZZI)I"); + midCaptureReadShortBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "captureReadShortBuffer", "([SZ)I"); + midCaptureReadByteBuffer = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "captureReadByteBuffer", "([BZ)I"); + midCaptureClose = (*mEnv)->GetStaticMethodID(mEnv, mAudioManagerClass, + "captureClose", "()V"); + + if (!midAudioOpen || !midAudioWriteShortBuffer || !midAudioWriteByteBuffer || !midAudioClose || + !midCaptureOpen || !midCaptureReadShortBuffer || !midCaptureReadByteBuffer || !midCaptureClose) { + __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLAudioManager.java?"); + } + + checkJNIReady(); +} + +/* Controller initialization -- called before SDL_main() to initialize JNI bindings */ +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeSetupJNI)(JNIEnv* mEnv, jclass cls) +{ + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "CONTROLLER nativeSetupJNI()"); + + Android_JNI_SetupThread(); + + mControllerManagerClass = (jclass)((*mEnv)->NewGlobalRef(mEnv, cls)); + + midPollInputDevices = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass, + "pollInputDevices", "()V"); + midPollHapticDevices = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass, + "pollHapticDevices", "()V"); + midHapticRun = (*mEnv)->GetStaticMethodID(mEnv, mControllerManagerClass, + "hapticRun", "(II)V"); + + if (!midPollInputDevices || !midPollHapticDevices || !midHapticRun) { + __android_log_print(ANDROID_LOG_WARN, "SDL", "Missing some Java callbacks, do you have the latest version of SDLControllerManager.java?"); + } + + checkJNIReady(); +} + +/* SDL main function prototype */ +typedef int (*SDL_main_func)(int argc, char *argv[]); + +/* Start up the SDL app */ +JNIEXPORT int JNICALL SDL_JAVA_INTERFACE(nativeRunMain)(JNIEnv* env, jclass cls, jstring library, jstring function, jobject array) +{ + int status = -1; + const char *library_file; + void *library_handle; + + __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeRunMain()"); + + library_file = (*env)->GetStringUTFChars(env, library, NULL); + library_handle = dlopen(library_file, RTLD_GLOBAL); + if (library_handle) { + const char *function_name; + SDL_main_func SDL_main; + + function_name = (*env)->GetStringUTFChars(env, function, NULL); + SDL_main = (SDL_main_func)dlsym(library_handle, function_name); + if (SDL_main) { + int i; + int argc; + int len; + char **argv; + + /* Prepare the arguments. */ + len = (*env)->GetArrayLength(env, array); + argv = SDL_stack_alloc(char*, 1 + len + 1); + argc = 0; + /* Use the name "app_process" so PHYSFS_platformCalcBaseDir() works. + https://bitbucket.org/MartinFelis/love-android-sdl2/issue/23/release-build-crash-on-start + */ + argv[argc++] = SDL_strdup("app_process"); + for (i = 0; i < len; ++i) { + const char* utf; + char* arg = NULL; + jstring string = (*env)->GetObjectArrayElement(env, array, i); + if (string) { + utf = (*env)->GetStringUTFChars(env, string, 0); + if (utf) { + arg = SDL_strdup(utf); + (*env)->ReleaseStringUTFChars(env, string, utf); + } + (*env)->DeleteLocalRef(env, string); + } + if (!arg) { + arg = SDL_strdup(""); + } + argv[argc++] = arg; + } + argv[argc] = NULL; + + + /* Run the application. */ + status = SDL_main(argc, argv); + + /* Release the arguments. */ + for (i = 0; i < argc; ++i) { + SDL_free(argv[i]); + } + SDL_stack_free(argv); + + } else { + __android_log_print(ANDROID_LOG_ERROR, "SDL", "nativeRunMain(): Couldn't find function %s in library %s", function_name, library_file); + } + (*env)->ReleaseStringUTFChars(env, function, function_name); + + dlclose(library_handle); + + } else { + __android_log_print(ANDROID_LOG_ERROR, "SDL", "nativeRunMain(): Couldn't load library %s", library_file); + } + (*env)->ReleaseStringUTFChars(env, library, library_file); + + /* Do not issue an exit or the whole application will terminate instead of just the SDL thread */ + /* exit(status); */ + + return status; } /* Drop file */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeDropFile( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeDropFile)( JNIEnv* env, jclass jcls, jstring filename) { @@ -164,7 +501,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeDropFile( } /* Resize */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeResize( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeResize)( JNIEnv* env, jclass jcls, jint width, jint height, jint format, jfloat rate) { @@ -172,7 +509,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeResize( } /* Paddown */ -JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_onNativePadDown( +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadDown)( JNIEnv* env, jclass jcls, jint device_id, jint keycode) { @@ -180,15 +517,15 @@ JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_onNativePadDown( } /* Padup */ -JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_onNativePadUp( - JNIEnv* env, jclass jcls, - jint device_id, jint keycode) +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativePadUp)( + JNIEnv* env, jclass jcls, + jint device_id, jint keycode) { return Android_OnPadUp(device_id, keycode); } /* Joy */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeJoy( +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeJoy)( JNIEnv* env, jclass jcls, jint device_id, jint axis, jfloat value) { @@ -196,7 +533,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeJoy( } /* POV Hat */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeHat( +JNIEXPORT void JNICALL SDL_JAVA_CONTROLLER_INTERFACE(onNativeHat)( JNIEnv* env, jclass jcls, jint device_id, jint hat_id, jint x, jint y) { @@ -204,30 +541,52 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeHat( } -JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_nativeAddJoystick( - JNIEnv* env, jclass jcls, - jint device_id, jstring device_name, jint is_accelerometer, - jint nbuttons, jint naxes, jint nhats, jint nballs) +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddJoystick)( + JNIEnv* env, jclass jcls, + jint device_id, jstring device_name, jstring device_desc, jint is_accelerometer, + jint nbuttons, jint naxes, jint nhats, jint nballs) { int retval; const char *name = (*env)->GetStringUTFChars(env, device_name, NULL); + const char *desc = (*env)->GetStringUTFChars(env, device_desc, NULL); - retval = Android_AddJoystick(device_id, name, (SDL_bool) is_accelerometer, nbuttons, naxes, nhats, nballs); + retval = Android_AddJoystick(device_id, name, desc, (SDL_bool) is_accelerometer, nbuttons, naxes, nhats, nballs); (*env)->ReleaseStringUTFChars(env, device_name, name); - + (*env)->ReleaseStringUTFChars(env, device_desc, desc); + return retval; } -JNIEXPORT jint JNICALL Java_org_libsdl_app_SDLActivity_nativeRemoveJoystick( - JNIEnv* env, jclass jcls, jint device_id) +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveJoystick)( + JNIEnv* env, jclass jcls, + jint device_id) { return Android_RemoveJoystick(device_id); } +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeAddHaptic)( + JNIEnv* env, jclass jcls, jint device_id, jstring device_name) +{ + int retval; + const char *name = (*env)->GetStringUTFChars(env, device_name, NULL); + + retval = Android_AddHaptic(device_id, name); + + (*env)->ReleaseStringUTFChars(env, device_name, name); + + return retval; +} + +JNIEXPORT jint JNICALL SDL_JAVA_CONTROLLER_INTERFACE(nativeRemoveHaptic)( + JNIEnv* env, jclass jcls, jint device_id) +{ + return Android_RemoveHaptic(device_id); +} + /* Surface Created */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceChanged(JNIEnv* env, jclass jcls) +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceChanged)(JNIEnv* env, jclass jcls) { SDL_WindowData *data; SDL_VideoDevice *_this; @@ -235,10 +594,10 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceChanged(JN if (Android_Window == NULL || Android_Window->driverdata == NULL ) { return; } - + _this = SDL_GetVideoDevice(); data = (SDL_WindowData *) Android_Window->driverdata; - + /* If the surface has been previously destroyed by onNativeSurfaceDestroyed, recreate it here */ if (data->egl_surface == EGL_NO_SURFACE) { if(data->native_window) { @@ -247,13 +606,13 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceChanged(JN data->native_window = Android_JNI_GetNativeWindow(); data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window); } - + /* GL Context handling is done in the event loop because this function is run from the Java thread */ - + } /* Surface Destroyed */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceDestroyed(JNIEnv* env, jclass jcls) +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeSurfaceDestroyed)(JNIEnv* env, jclass jcls) { /* We have to clear the current context and destroy the egl surface here * Otherwise there's BAD_NATIVE_WINDOW errors coming from eglCreateWindowSurface on resume @@ -261,40 +620,42 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeSurfaceDestroyed( */ SDL_WindowData *data; SDL_VideoDevice *_this; - + if (Android_Window == NULL || Android_Window->driverdata == NULL ) { return; } - + _this = SDL_GetVideoDevice(); data = (SDL_WindowData *) Android_Window->driverdata; - + if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_MakeCurrent(_this, NULL, NULL); SDL_EGL_DestroySurface(_this, data->egl_surface); data->egl_surface = EGL_NO_SURFACE; } - + /* GL Context handling is done in the event loop because this function is run from the Java thread */ } /* Keydown */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeKeyDown( - JNIEnv* env, jclass jcls, jint keycode) +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyDown)( + JNIEnv* env, jclass jcls, + jint keycode) { Android_OnKeyDown(keycode); } /* Keyup */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeKeyUp( - JNIEnv* env, jclass jcls, jint keycode) +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyUp)( + JNIEnv* env, jclass jcls, + jint keycode) { Android_OnKeyUp(keycode); } /* Keyboard Focus Lost */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeKeyboardFocusLost( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeKeyboardFocusLost)( JNIEnv* env, jclass jcls) { /* Calling SDL_StopTextInput will take care of hiding the keyboard and cleaning up the DummyText widget */ @@ -303,7 +664,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeKeyboardFocusLost /* Touch */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeTouch( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeTouch)( JNIEnv* env, jclass jcls, jint touch_device_id_in, jint pointer_finger_id_in, jint action, jfloat x, jfloat y, jfloat p) @@ -312,7 +673,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeTouch( } /* Mouse */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeMouse( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeMouse)( JNIEnv* env, jclass jcls, jint button, jint action, jfloat x, jfloat y) { @@ -320,7 +681,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeMouse( } /* Accelerometer */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeAccel( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeAccel)( JNIEnv* env, jclass jcls, jfloat x, jfloat y, jfloat z) { @@ -330,15 +691,22 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_onNativeAccel( bHasNewData = SDL_TRUE; } +/* Clipboard */ +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(onNativeClipboardChanged)( + JNIEnv* env, jclass jcls) +{ + SDL_SendClipboardUpdate(); +} + /* Low memory */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeLowMemory( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeLowMemory)( JNIEnv* env, jclass cls) { SDL_SendAppEvent(SDL_APP_LOWMEMORY); } /* Quit */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeQuit( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeQuit)( JNIEnv* env, jclass cls) { /* Discard previous events. The user should have handled state storage @@ -354,24 +722,25 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeQuit( } /* Pause */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativePause( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativePause)( JNIEnv* env, jclass cls) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativePause()"); + if (Android_Window) { SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND); SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND); - - /* *After* sending the relevant events, signal the pause semaphore + + /* *After* sending the relevant events, signal the pause semaphore * so the event loop knows to pause and (optionally) block itself */ if (!SDL_SemValue(Android_PauseSem)) SDL_SemPost(Android_PauseSem); } } /* Resume */ -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeResume( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeResume)( JNIEnv* env, jclass cls) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "nativeResume()"); @@ -389,7 +758,7 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLActivity_nativeResume( } } -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLInputConnection_nativeCommitText( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeCommitText)( JNIEnv* env, jclass cls, jstring text, jint newCursorPosition) { @@ -400,7 +769,37 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLInputConnection_nativeCommitText( (*env)->ReleaseStringUTFChars(env, text, utftext); } -JNIEXPORT void JNICALL Java_org_libsdl_app_SDLInputConnection_nativeSetComposingText( +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeGenerateScancodeForUnichar)( + JNIEnv* env, jclass cls, + jchar chUnicode) +{ + SDL_Scancode code = SDL_SCANCODE_UNKNOWN; + uint16_t mod = 0; + + // We do not care about bigger than 127. + if (chUnicode < 127) { + AndroidKeyInfo info = unicharToAndroidKeyInfoTable[chUnicode]; + code = info.code; + mod = info.mod; + } + + if (mod & KMOD_SHIFT) { + /* If character uses shift, press shift down */ + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LSHIFT); + } + + /* send a keydown and keyup even for the character */ + SDL_SendKeyboardKey(SDL_PRESSED, code); + SDL_SendKeyboardKey(SDL_RELEASED, code); + + if (mod & KMOD_SHIFT) { + /* If character uses shift, press shift back up */ + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LSHIFT); + } +} + + +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE_INPUT_CONNECTION(nativeSetComposingText)( JNIEnv* env, jclass cls, jstring text, jint newCursorPosition) { @@ -411,7 +810,10 @@ JNIEXPORT void JNICALL Java_org_libsdl_app_SDLInputConnection_nativeSetComposing (*env)->ReleaseStringUTFChars(env, text, utftext); } -JNIEXPORT jstring JNICALL Java_org_libsdl_app_SDLActivity_nativeGetHint(JNIEnv* env, jclass cls, jstring name) { +JNIEXPORT jstring JNICALL SDL_JAVA_INTERFACE(nativeGetHint)( + JNIEnv* env, jclass cls, + jstring name) +{ const char *utfname = (*env)->GetStringUTFChars(env, name, NULL); const char *hint = SDL_GetHint(utfname); @@ -421,6 +823,20 @@ JNIEXPORT jstring JNICALL Java_org_libsdl_app_SDLActivity_nativeGetHint(JNIEnv* return result; } +JNIEXPORT void JNICALL SDL_JAVA_INTERFACE(nativeSetenv)( + JNIEnv* env, jclass cls, + jstring name, jstring value) +{ + const char *utfname = (*env)->GetStringUTFChars(env, name, NULL); + const char *utfvalue = (*env)->GetStringUTFChars(env, value, NULL); + + SDL_setenv(utfname, utfvalue, 1); + + (*env)->ReleaseStringUTFChars(env, name, utfname); + (*env)->ReleaseStringUTFChars(env, value, utfvalue); + +} + /******************************************************************************* Functions called by SDL into Java *******************************************************************************/ @@ -481,20 +897,32 @@ ANativeWindow* Android_JNI_GetNativeWindow(void) s = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetNativeSurface); anw = ANativeWindow_fromSurface(env, s); (*env)->DeleteLocalRef(env, s); - + return anw; } void Android_JNI_SetActivityTitle(const char *title) { - jmethodID mid; JNIEnv *mEnv = Android_JNI_GetEnv(); - mid = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass,"setActivityTitle","(Ljava/lang/String;)Z"); - if (mid) { - jstring jtitle = (jstring)((*mEnv)->NewStringUTF(mEnv, title)); - (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, mid, jtitle); - (*mEnv)->DeleteLocalRef(mEnv, jtitle); - } + + jstring jtitle = (jstring)((*mEnv)->NewStringUTF(mEnv, title)); + (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, midSetActivityTitle, jtitle); + (*mEnv)->DeleteLocalRef(mEnv, jtitle); +} + +void Android_JNI_SetWindowStyle(SDL_bool fullscreen) +{ + JNIEnv *mEnv = Android_JNI_GetEnv(); + (*mEnv)->CallStaticVoidMethod(mEnv, mActivityClass, midSetWindowStyle, fullscreen ? 1 : 0); +} + +void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint) +{ + JNIEnv *mEnv = Android_JNI_GetEnv(); + + jstring jhint = (jstring)((*mEnv)->NewStringUTF(mEnv, (hint ? hint : ""))); + (*mEnv)->CallStaticVoidMethod(mEnv, mActivityClass, midSetOrientation, w, h, (resizable? 1 : 0), jhint); + (*mEnv)->DeleteLocalRef(mEnv, jhint); } SDL_bool Android_JNI_GetAccelerometerValues(float values[3]) @@ -592,7 +1020,7 @@ int Android_JNI_OpenAudioDevice(int iscapture, int sampleRate, int is16Bit, int if (iscapture) { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device for capture"); captureBuffer16Bit = is16Bit; - if ((*env)->CallStaticIntMethod(env, mActivityClass, midCaptureOpen, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames) != 0) { + if ((*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureOpen, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames) != 0) { /* Error during audio initialization */ __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: error on AudioRecord initialization!"); return 0; @@ -600,7 +1028,7 @@ int Android_JNI_OpenAudioDevice(int iscapture, int sampleRate, int is16Bit, int } else { __android_log_print(ANDROID_LOG_VERBOSE, "SDL", "SDL audio: opening device for output"); audioBuffer16Bit = is16Bit; - if ((*env)->CallStaticIntMethod(env, mActivityClass, midAudioOpen, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames) != 0) { + if ((*env)->CallStaticIntMethod(env, mAudioManagerClass, midAudioOpen, sampleRate, audioBuffer16Bit, audioBufferStereo, desiredBufferFrames) != 0) { /* Error during audio initialization */ __android_log_print(ANDROID_LOG_WARN, "SDL", "SDL audio: error on AudioTrack initialization!"); return 0; @@ -657,6 +1085,38 @@ int Android_JNI_OpenAudioDevice(int iscapture, int sampleRate, int is16Bit, int return audioBufferFrames; } +int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi) +{ + JNIEnv *env = Android_JNI_GetEnv(); + + jobject jDisplayObj = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetDisplayDPI); + jclass jDisplayClass = (*env)->GetObjectClass(env, jDisplayObj); + + jfieldID fidXdpi = (*env)->GetFieldID(env, jDisplayClass, "xdpi", "F"); + jfieldID fidYdpi = (*env)->GetFieldID(env, jDisplayClass, "ydpi", "F"); + jfieldID fidDdpi = (*env)->GetFieldID(env, jDisplayClass, "densityDpi", "I"); + + float nativeXdpi = (*env)->GetFloatField(env, jDisplayObj, fidXdpi); + float nativeYdpi = (*env)->GetFloatField(env, jDisplayObj, fidYdpi); + int nativeDdpi = (*env)->GetIntField(env, jDisplayObj, fidDdpi); + + + (*env)->DeleteLocalRef(env, jDisplayObj); + (*env)->DeleteLocalRef(env, jDisplayClass); + + if (ddpi) { + *ddpi = (float)nativeDdpi; + } + if (xdpi) { + *xdpi = nativeXdpi; + } + if (ydpi) { + *ydpi = nativeYdpi; + } + + return 0; +} + void * Android_JNI_GetAudioBuffer(void) { return audioBufferPinned; @@ -668,10 +1128,10 @@ void Android_JNI_WriteAudioBuffer(void) if (audioBuffer16Bit) { (*mAudioEnv)->ReleaseShortArrayElements(mAudioEnv, (jshortArray)audioBuffer, (jshort *)audioBufferPinned, JNI_COMMIT); - (*mAudioEnv)->CallStaticVoidMethod(mAudioEnv, mActivityClass, midAudioWriteShortBuffer, (jshortArray)audioBuffer); + (*mAudioEnv)->CallStaticVoidMethod(mAudioEnv, mAudioManagerClass, midAudioWriteShortBuffer, (jshortArray)audioBuffer); } else { (*mAudioEnv)->ReleaseByteArrayElements(mAudioEnv, (jbyteArray)audioBuffer, (jbyte *)audioBufferPinned, JNI_COMMIT); - (*mAudioEnv)->CallStaticVoidMethod(mAudioEnv, mActivityClass, midAudioWriteByteBuffer, (jbyteArray)audioBuffer); + (*mAudioEnv)->CallStaticVoidMethod(mAudioEnv, mAudioManagerClass, midAudioWriteByteBuffer, (jbyteArray)audioBuffer); } /* JNI_COMMIT means the changes are committed to the VM but the buffer remains pinned */ @@ -685,7 +1145,7 @@ int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen) if (captureBuffer16Bit) { SDL_assert((*env)->GetArrayLength(env, (jshortArray)captureBuffer) == (buflen / 2)); - br = (*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_TRUE); + br = (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_TRUE); if (br > 0) { jshort *ptr = (*env)->GetShortArrayElements(env, (jshortArray)captureBuffer, &isCopy); br *= 2; @@ -694,7 +1154,7 @@ int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen) } } else { SDL_assert((*env)->GetArrayLength(env, (jshortArray)captureBuffer) == buflen); - br = (*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_TRUE); + br = (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_TRUE); if (br > 0) { jbyte *ptr = (*env)->GetByteArrayElements(env, (jbyteArray)captureBuffer, &isCopy); SDL_memcpy(buffer, ptr, br); @@ -708,7 +1168,7 @@ int Android_JNI_CaptureAudioBuffer(void *buffer, int buflen) void Android_JNI_FlushCapturedAudio(void) { JNIEnv *env = Android_JNI_GetEnv(); - #if 0 /* !!! FIXME: this needs API 23, or it'll do blocking reads and never end. */ +#if 0 /* !!! FIXME: this needs API 23, or it'll do blocking reads and never end. */ if (captureBuffer16Bit) { const jint len = (*env)->GetArrayLength(env, (jshortArray)captureBuffer); while ((*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_FALSE) == len) { /* spin */ } @@ -716,13 +1176,13 @@ void Android_JNI_FlushCapturedAudio(void) const jint len = (*env)->GetArrayLength(env, (jbyteArray)captureBuffer); while ((*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_FALSE) == len) { /* spin */ } } - #else +#else if (captureBuffer16Bit) { - (*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_FALSE); + (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadShortBuffer, (jshortArray)captureBuffer, JNI_FALSE); } else { - (*env)->CallStaticIntMethod(env, mActivityClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_FALSE); + (*env)->CallStaticIntMethod(env, mAudioManagerClass, midCaptureReadByteBuffer, (jbyteArray)captureBuffer, JNI_FALSE); } - #endif +#endif } void Android_JNI_CloseAudioDevice(const int iscapture) @@ -730,13 +1190,13 @@ void Android_JNI_CloseAudioDevice(const int iscapture) JNIEnv *env = Android_JNI_GetEnv(); if (iscapture) { - (*env)->CallStaticVoidMethod(env, mActivityClass, midCaptureClose); + (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midCaptureClose); if (captureBuffer) { (*env)->DeleteGlobalRef(env, captureBuffer); captureBuffer = NULL; } } else { - (*env)->CallStaticVoidMethod(env, mActivityClass, midAudioClose); + (*env)->CallStaticVoidMethod(env, mAudioManagerClass, midAudioClose); if (audioBuffer) { (*env)->DeleteGlobalRef(env, audioBuffer); audioBuffer = NULL; @@ -818,10 +1278,7 @@ static int Internal_Android_JNI_FileOpen(SDL_RWops* ctx) ctx->hidden.androidio.position = 0; /* context = SDLActivity.getContext(); */ - mid = (*mEnv)->GetStaticMethodID(mEnv, mActivityClass, - "getContext","()Landroid/content/Context;"); - context = (*mEnv)->CallStaticObjectMethod(mEnv, mActivityClass, mid); - + context = (*mEnv)->CallStaticObjectMethod(mEnv, mActivityClass, midGetContext); /* assetManager = context.getAssets(); */ mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, context), @@ -873,13 +1330,7 @@ fallback: inputStream = (*mEnv)->CallObjectMethod(mEnv, assetManager, mid, fileNameJString, 1 /* ACCESS_RANDOM */); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { /* Try fallback to APK expansion files */ - mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, context), - "openAPKExpansionInputStream", "(Ljava/lang/String;)Ljava/io/InputStream;"); - if (!mid) { - SDL_SetError("No openAPKExpansionInputStream() in Java class"); - goto failure; /* Java class is missing the required method */ - } - inputStream = (*mEnv)->CallObjectMethod(mEnv, context, mid, fileNameJString); + inputStream = (*mEnv)->CallStaticObjectMethod(mEnv, mActivityClass, midOpenAPKExpansionInputStream, fileNameJString); /* Exception is checked first because it always needs to be cleared. * If no exception occurred then the last SDL error message is kept. @@ -897,7 +1348,7 @@ fallback: * android/apis/content/ReadAsset.java imply that Android's * AssetInputStream.available() /will/ always return the total file size */ - + /* size = inputStream.available(); */ mid = (*mEnv)->GetMethodID(mEnv, (*mEnv)->GetObjectClass(mEnv, inputStream), "available", "()I"); @@ -945,7 +1396,7 @@ failure: } } - + LocalReferenceHolder_Cleanup(&refs); return result; } @@ -959,7 +1410,7 @@ int Android_JNI_FileOpen(SDL_RWops* ctx, jstring fileNameJString; if (!LocalReferenceHolder_Init(&refs, mEnv)) { - LocalReferenceHolder_Cleanup(&refs); + LocalReferenceHolder_Cleanup(&refs); return -1; } @@ -1013,7 +1464,7 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, mEnv = Android_JNI_GetEnv(); if (!LocalReferenceHolder_Init(&refs, mEnv)) { - LocalReferenceHolder_Cleanup(&refs); + LocalReferenceHolder_Cleanup(&refs); return 0; } @@ -1026,7 +1477,7 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, int result = (*mEnv)->CallIntMethod(mEnv, readableByteChannel, readMethod, byteBuffer); if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { - LocalReferenceHolder_Cleanup(&refs); + LocalReferenceHolder_Cleanup(&refs); return 0; } @@ -1038,7 +1489,7 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, bytesRead += result; ctx->hidden.androidio.position += result; } - LocalReferenceHolder_Cleanup(&refs); + LocalReferenceHolder_Cleanup(&refs); return bytesRead / size; } } @@ -1195,120 +1646,41 @@ int Android_JNI_FileClose(SDL_RWops* ctx) return Internal_Android_JNI_FileClose(ctx, SDL_TRUE); } -/* returns a new global reference which needs to be released later */ -static jobject Android_JNI_GetSystemServiceObject(const char* name) -{ - struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); - JNIEnv* env = Android_JNI_GetEnv(); - jobject retval = NULL; - jstring service; - jmethodID mid; - jobject context; - jobject manager; - - if (!LocalReferenceHolder_Init(&refs, env)) { - LocalReferenceHolder_Cleanup(&refs); - return NULL; - } - - service = (*env)->NewStringUTF(env, name); - - mid = (*env)->GetStaticMethodID(env, mActivityClass, "getContext", "()Landroid/content/Context;"); - context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); - - mid = (*env)->GetMethodID(env, mActivityClass, "getSystemServiceFromUiThread", "(Ljava/lang/String;)Ljava/lang/Object;"); - manager = (*env)->CallObjectMethod(env, context, mid, service); - - (*env)->DeleteLocalRef(env, service); - - retval = manager ? (*env)->NewGlobalRef(env, manager) : NULL; - LocalReferenceHolder_Cleanup(&refs); - return retval; -} - -#define SETUP_CLIPBOARD(error) \ - struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); \ - JNIEnv* env = Android_JNI_GetEnv(); \ - jobject clipboard; \ - if (!LocalReferenceHolder_Init(&refs, env)) { \ - LocalReferenceHolder_Cleanup(&refs); \ - return error; \ - } \ - clipboard = Android_JNI_GetSystemServiceObject("clipboard"); \ - if (!clipboard) { \ - LocalReferenceHolder_Cleanup(&refs); \ - return error; \ - } - -#define CLEANUP_CLIPBOARD() \ - LocalReferenceHolder_Cleanup(&refs); - int Android_JNI_SetClipboardText(const char* text) { - /* Watch out for C89 scoping rules because of the macro */ - SETUP_CLIPBOARD(-1) - - /* Nest the following in a scope to avoid C89 declaration rules triggered by the macro */ - { - jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, clipboard), "setText", "(Ljava/lang/CharSequence;)V"); - jstring string = (*env)->NewStringUTF(env, text); - (*env)->CallVoidMethod(env, clipboard, mid, string); - (*env)->DeleteGlobalRef(env, clipboard); - (*env)->DeleteLocalRef(env, string); - } - CLEANUP_CLIPBOARD(); - + JNIEnv* env = Android_JNI_GetEnv(); + jstring string = (*env)->NewStringUTF(env, text); + (*env)->CallStaticVoidMethod(env, mActivityClass, midClipboardSetText, string); + (*env)->DeleteLocalRef(env, string); return 0; } char* Android_JNI_GetClipboardText(void) { - /* Watch out for C89 scoping rules because of the macro */ - SETUP_CLIPBOARD(SDL_strdup("")) - - /* Nest the following in a scope to avoid C89 declaration rules triggered by the macro */ - { - jmethodID mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, clipboard), "getText", "()Ljava/lang/CharSequence;"); - jobject sequence = (*env)->CallObjectMethod(env, clipboard, mid); - (*env)->DeleteGlobalRef(env, clipboard); - if (sequence) { - jstring string; - const char* utf; - mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, sequence), "toString", "()Ljava/lang/String;"); - string = (jstring)((*env)->CallObjectMethod(env, sequence, mid)); - utf = (*env)->GetStringUTFChars(env, string, 0); - if (utf) { - char* text = SDL_strdup(utf); - (*env)->ReleaseStringUTFChars(env, string, utf); - - CLEANUP_CLIPBOARD(); - - return text; - } + JNIEnv* env = Android_JNI_GetEnv(); + char* text = NULL; + jstring string; + + string = (*env)->CallStaticObjectMethod(env, mActivityClass, midClipboardGetText); + if (string) { + const char* utf = (*env)->GetStringUTFChars(env, string, 0); + if (utf) { + text = SDL_strdup(utf); + (*env)->ReleaseStringUTFChars(env, string, utf); } + (*env)->DeleteLocalRef(env, string); } - CLEANUP_CLIPBOARD(); - - return SDL_strdup(""); + + return (text == NULL) ? SDL_strdup("") : text; } SDL_bool Android_JNI_HasClipboardText(void) { - jmethodID mid; - jboolean has; - /* Watch out for C89 scoping rules because of the macro */ - SETUP_CLIPBOARD(SDL_FALSE) - - mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, clipboard), "hasText", "()Z"); - has = (*env)->CallBooleanMethod(env, clipboard, mid); - (*env)->DeleteGlobalRef(env, clipboard); - - CLEANUP_CLIPBOARD(); - - return has ? SDL_TRUE : SDL_FALSE; + JNIEnv* env = Android_JNI_GetEnv(); + jboolean retval = (*env)->CallStaticBooleanMethod(env, mActivityClass, midClipboardHasText); + return (retval == JNI_TRUE) ? SDL_TRUE : SDL_FALSE; } - /* returns 0 on success or -1 on error (others undefined then) * returns truthy or falsy value in plugged, charged and battery * returns the value in seconds and percent or -1 if not available @@ -1333,8 +1705,8 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco } - mid = (*env)->GetStaticMethodID(env, mActivityClass, "getContext", "()Landroid/content/Context;"); - context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); + /* context = SDLActivity.getContext(); */ + context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); action = (*env)->NewStringUTF(env, "android.intent.action.BATTERY_CHANGED"); @@ -1405,7 +1777,7 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco if (percent) { int level; int scale; - + /* Watch out for C89 scoping rules because of the macro */ { GET_INT_EXTRA(level_temp, "level") /* == BatteryManager.EXTRA_LEVEL (API 5) */ @@ -1416,7 +1788,7 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco GET_INT_EXTRA(scale_temp, "scale") /* == BatteryManager.EXTRA_SCALE (API 5) */ scale = scale_temp; } - + if ((level == -1) || (scale == -1)) { LocalReferenceHolder_Cleanup(&refs); return -1; @@ -1434,8 +1806,7 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco int Android_JNI_GetTouchDeviceIds(int **ids) { JNIEnv *env = Android_JNI_GetEnv(); jint sources = 4098; /* == InputDevice.SOURCE_TOUCHSCREEN */ - jmethodID mid = (*env)->GetStaticMethodID(env, mActivityClass, "inputGetInputDeviceIds", "(I)[I"); - jintArray array = (jintArray) (*env)->CallStaticObjectMethod(env, mActivityClass, mid, sources); + jintArray array = (jintArray) (*env)->CallStaticObjectMethod(env, mActivityClass, midInputGetInputDeviceIds, sources); int number = 0; *ids = NULL; if (array) { @@ -1456,12 +1827,32 @@ int Android_JNI_GetTouchDeviceIds(int **ids) { return number; } +/* sets the mSeparateMouseAndTouch field */ +void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value) +{ + JNIEnv *env = Android_JNI_GetEnv(); + (*env)->SetStaticBooleanField(env, mActivityClass, fidSeparateMouseAndTouch, new_value ? JNI_TRUE : JNI_FALSE); +} + void Android_JNI_PollInputDevices(void) { JNIEnv *env = Android_JNI_GetEnv(); - (*env)->CallStaticVoidMethod(env, mActivityClass, midPollInputDevices); + (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midPollInputDevices); } +void Android_JNI_PollHapticDevices(void) +{ + JNIEnv *env = Android_JNI_GetEnv(); + (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midPollHapticDevices); +} + +void Android_JNI_HapticRun(int device_id, int length) +{ + JNIEnv *env = Android_JNI_GetEnv(); + (*env)->CallStaticVoidMethod(env, mControllerManagerClass, midHapticRun, device_id, length); +} + + /* See SDLActivity.java for constants. */ #define COMMAND_SET_KEEP_SCREEN_ON 5 @@ -1469,16 +1860,8 @@ void Android_JNI_PollInputDevices(void) int Android_JNI_SendMessage(int command, int param) { JNIEnv *env = Android_JNI_GetEnv(); - jmethodID mid; jboolean success; - if (!env) { - return -1; - } - mid = (*env)->GetStaticMethodID(env, mActivityClass, "sendMessage", "(II)Z"); - if (!mid) { - return -1; - } - success = (*env)->CallStaticBooleanMethod(env, mActivityClass, mid, command, param); + success = (*env)->CallStaticBooleanMethod(env, mActivityClass, midSendMessage, command, param); return success ? 0 : -1; } @@ -1490,16 +1873,7 @@ void Android_JNI_SuspendScreenSaver(SDL_bool suspend) void Android_JNI_ShowTextInput(SDL_Rect *inputRect) { JNIEnv *env = Android_JNI_GetEnv(); - jmethodID mid; - if (!env) { - return; - } - - mid = (*env)->GetStaticMethodID(env, mActivityClass, "showTextInput", "(IIII)Z"); - if (!mid) { - return; - } - (*env)->CallStaticBooleanMethod(env, mActivityClass, mid, + (*env)->CallStaticBooleanMethod(env, mActivityClass, midShowTextInput, inputRect->x, inputRect->y, inputRect->w, @@ -1513,6 +1887,15 @@ void Android_JNI_HideTextInput(void) Android_JNI_SendMessage(COMMAND_TEXTEDIT_HIDE, 0); } +SDL_bool Android_JNI_IsScreenKeyboardShown() +{ + JNIEnv *mEnv = Android_JNI_GetEnv(); + jboolean is_shown = 0; + is_shown = (*mEnv)->CallStaticBooleanMethod(mEnv, mActivityClass, midIsScreenKeyboardShown); + return is_shown; +} + + int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { JNIEnv *env; @@ -1567,11 +1950,8 @@ int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *bu (*env)->DeleteLocalRef(env, clazz); - /* call function */ - - mid = (*env)->GetStaticMethodID(env, mActivityClass, "getContext","()Landroid/content/Context;"); - - context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); + /* context = SDLActivity.getContext(); */ + context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); clazz = (*env)->GetObjectClass(env, context); @@ -1608,31 +1988,31 @@ int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *bu ////////////////////////////////////////////////////////////////////////////// */ -void *SDL_AndroidGetJNIEnv() +void *SDL_AndroidGetJNIEnv(void) { return Android_JNI_GetEnv(); } - - -void *SDL_AndroidGetActivity() +void *SDL_AndroidGetActivity(void) { /* See SDL_system.h for caveats on using this function. */ - jmethodID mid; - JNIEnv *env = Android_JNI_GetEnv(); if (!env) { return NULL; } /* return SDLActivity.getContext(); */ - mid = (*env)->GetStaticMethodID(env, mActivityClass, - "getContext","()Landroid/content/Context;"); - return (*env)->CallStaticObjectMethod(env, mActivityClass, mid); + return (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); } -const char * SDL_AndroidGetInternalStoragePath() +SDL_bool SDL_IsAndroidTV(void) +{ + JNIEnv *env = Android_JNI_GetEnv(); + return (*env)->CallStaticBooleanMethod(env, mActivityClass, midIsAndroidTV); +} + +const char * SDL_AndroidGetInternalStoragePath(void) { static char *s_AndroidInternalFilesPath = NULL; @@ -1651,9 +2031,12 @@ const char * SDL_AndroidGetInternalStoragePath() } /* context = SDLActivity.getContext(); */ - mid = (*env)->GetStaticMethodID(env, mActivityClass, - "getContext","()Landroid/content/Context;"); - context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); + context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); + if (!context) { + SDL_SetError("Couldn't get Android context!"); + LocalReferenceHolder_Cleanup(&refs); + return NULL; + } /* fileObj = context.getFilesDir(); */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context), @@ -1665,10 +2048,14 @@ const char * SDL_AndroidGetInternalStoragePath() return NULL; } - /* path = fileObject.getAbsolutePath(); */ + /* path = fileObject.getCanonicalPath(); */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, fileObject), - "getAbsolutePath", "()Ljava/lang/String;"); + "getCanonicalPath", "()Ljava/lang/String;"); pathString = (jstring)(*env)->CallObjectMethod(env, fileObject, mid); + if (Android_JNI_ExceptionOccurred(SDL_FALSE)) { + LocalReferenceHolder_Cleanup(&refs); + return NULL; + } path = (*env)->GetStringUTFChars(env, pathString, NULL); s_AndroidInternalFilesPath = SDL_strdup(path); @@ -1679,7 +2066,7 @@ const char * SDL_AndroidGetInternalStoragePath() return s_AndroidInternalFilesPath; } -int SDL_AndroidGetExternalStorageState() +int SDL_AndroidGetExternalStorageState(void) { struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__); jmethodID mid; @@ -1718,7 +2105,7 @@ int SDL_AndroidGetExternalStorageState() return stateFlags; } -const char * SDL_AndroidGetExternalStoragePath() +const char * SDL_AndroidGetExternalStoragePath(void) { static char *s_AndroidExternalFilesPath = NULL; @@ -1737,9 +2124,7 @@ const char * SDL_AndroidGetExternalStoragePath() } /* context = SDLActivity.getContext(); */ - mid = (*env)->GetStaticMethodID(env, mActivityClass, - "getContext","()Landroid/content/Context;"); - context = (*env)->CallStaticObjectMethod(env, mActivityClass, mid); + context = (*env)->CallStaticObjectMethod(env, mActivityClass, midGetContext); /* fileObj = context.getExternalFilesDir(); */ mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, context), @@ -1765,12 +2150,22 @@ const char * SDL_AndroidGetExternalStoragePath() return s_AndroidExternalFilesPath; } -jclass Android_JNI_GetActivityClass(void) +void Android_JNI_GetManifestEnvironmentVariables(void) { - return mActivityClass; + if (!mActivityClass || !midGetManifestEnvironmentVariables) { + __android_log_print(ANDROID_LOG_WARN, "SDL", "Request to get environment variables before JNI is ready"); + return; + } + + if (!bHasEnvironmentVariables) { + JNIEnv *env = Android_JNI_GetEnv(); + SDL_bool ret = (*env)->CallStaticBooleanMethod(env, mActivityClass, midGetManifestEnvironmentVariables); + if (ret) { + bHasEnvironmentVariables = SDL_TRUE; + } + } } #endif /* __ANDROID__ */ /* vi: set ts=4 sw=4 expandtab: */ - diff --git a/Engine/lib/sdl/src/core/android/SDL_android.h b/Engine/lib/sdl/src/core/android/SDL_android.h index cb7ff0736..c800dc651 100644 --- a/Engine/lib/sdl/src/core/android/SDL_android.h +++ b/Engine/lib/sdl/src/core/android/SDL_android.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,11 +34,17 @@ extern "C" { /* Interface from the SDL library into the Android Java activity */ extern void Android_JNI_SetActivityTitle(const char *title); +extern void Android_JNI_SetWindowStyle(SDL_bool fullscreen); +extern void Android_JNI_SetOrientation(int w, int h, int resizable, const char *hint); + extern SDL_bool Android_JNI_GetAccelerometerValues(float values[3]); extern void Android_JNI_ShowTextInput(SDL_Rect *inputRect); extern void Android_JNI_HideTextInput(void); +extern SDL_bool Android_JNI_IsScreenKeyboardShown(void); extern ANativeWindow* Android_JNI_GetNativeWindow(void); +extern int Android_JNI_GetDisplayDPI(float *ddpi, float *xdpi, float *ydpi); + /* Audio support */ extern int Android_JNI_OpenAudioDevice(int iscapture, int sampleRate, int is16Bit, int channelCount, int desiredBufferFrames); extern void* Android_JNI_GetAudioBuffer(void); @@ -56,6 +62,9 @@ size_t Android_JNI_FileRead(SDL_RWops* ctx, void* buffer, size_t size, size_t ma size_t Android_JNI_FileWrite(SDL_RWops* ctx, const void* buffer, size_t size, size_t num); int Android_JNI_FileClose(SDL_RWops* ctx); +/* Environment support */ +void Android_JNI_GetManifestEnvironmentVariables(void); + /* Clipboard support */ int Android_JNI_SetClipboardText(const char* text); char* Android_JNI_GetClipboardText(void); @@ -67,21 +76,32 @@ int Android_JNI_GetPowerInfo(int* plugged, int* charged, int* battery, int* seco /* Joystick support */ void Android_JNI_PollInputDevices(void); +/* Haptic support */ +void Android_JNI_PollHapticDevices(void); +void Android_JNI_HapticRun(int device_id, int length); + /* Video */ void Android_JNI_SuspendScreenSaver(SDL_bool suspend); /* Touch support */ int Android_JNI_GetTouchDeviceIds(int **ids); +void Android_JNI_SetSeparateMouseAndTouch(SDL_bool new_value); /* Threads */ #include JNIEnv *Android_JNI_GetEnv(void); int Android_JNI_SetupThread(void); -jclass Android_JNI_GetActivityClass(void); /* Generic messages */ int Android_JNI_SendMessage(int command, int param); +/* Init */ +JNIEXPORT void JNICALL SDL_Android_Init(JNIEnv* mEnv, jclass cls); + +/* MessageBox */ +#include "SDL_messagebox.h" +int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); + /* Ends C function definitions when using C++ */ #ifdef __cplusplus /* *INDENT-OFF* */ diff --git a/Engine/lib/sdl/src/core/android/keyinfotable.h b/Engine/lib/sdl/src/core/android/keyinfotable.h new file mode 100644 index 000000000..4437121e8 --- /dev/null +++ b/Engine/lib/sdl/src/core/android/keyinfotable.h @@ -0,0 +1,175 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef _ANDROID_KeyInfo +#define _ANDROID_KeyInfo + +#include "SDL_scancode.h" +#include "SDL_keycode.h" + +/* + This file is used by the keyboard code in SDL_uikitview.m to convert between characters + passed in from the iPhone's virtual keyboard, and tuples of SDL_Scancode and SDL_keymods. + For example unicharToUIKeyInfoTable['a'] would give you the scan code and keymod for lower + case a. +*/ + +typedef struct +{ + SDL_Scancode code; + uint16_t mod; +} AndroidKeyInfo; + +/* So far only ASCII characters here */ +static AndroidKeyInfo unicharToAndroidKeyInfoTable[] = { +/* 0 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 1 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 2 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 3 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 4 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 5 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 6 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 7 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 8 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 9 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 10 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 11 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 12 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 13 */ { SDL_SCANCODE_RETURN, 0 }, +/* 14 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 15 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 16 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 17 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 18 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 19 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 20 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 21 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 22 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 23 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 24 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 25 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 26 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 27 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 28 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 29 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 30 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 31 */ { SDL_SCANCODE_UNKNOWN, 0 }, +/* 32 */ { SDL_SCANCODE_SPACE, 0 }, +/* 33 */ { SDL_SCANCODE_1, KMOD_SHIFT }, /* plus shift modifier '!' */ +/* 34 */ { SDL_SCANCODE_APOSTROPHE, KMOD_SHIFT }, /* plus shift modifier '"' */ +/* 35 */ { SDL_SCANCODE_3, KMOD_SHIFT }, /* plus shift modifier '#' */ +/* 36 */ { SDL_SCANCODE_4, KMOD_SHIFT }, /* plus shift modifier '$' */ +/* 37 */ { SDL_SCANCODE_5, KMOD_SHIFT }, /* plus shift modifier '%' */ +/* 38 */ { SDL_SCANCODE_7, KMOD_SHIFT }, /* plus shift modifier '&' */ +/* 39 */ { SDL_SCANCODE_APOSTROPHE, 0 }, /* ''' */ +/* 40 */ { SDL_SCANCODE_9, KMOD_SHIFT }, /* plus shift modifier '(' */ +/* 41 */ { SDL_SCANCODE_0, KMOD_SHIFT }, /* plus shift modifier ')' */ +/* 42 */ { SDL_SCANCODE_8, KMOD_SHIFT }, /* '*' */ +/* 43 */ { SDL_SCANCODE_EQUALS, KMOD_SHIFT }, /* plus shift modifier '+' */ +/* 44 */ { SDL_SCANCODE_COMMA, 0 }, /* ',' */ +/* 45 */ { SDL_SCANCODE_MINUS, 0 }, /* '-' */ +/* 46 */ { SDL_SCANCODE_PERIOD, 0 }, /* '.' */ +/* 47 */ { SDL_SCANCODE_SLASH, 0 }, /* '/' */ +/* 48 */ { SDL_SCANCODE_0, 0 }, +/* 49 */ { SDL_SCANCODE_1, 0 }, +/* 50 */ { SDL_SCANCODE_2, 0 }, +/* 51 */ { SDL_SCANCODE_3, 0 }, +/* 52 */ { SDL_SCANCODE_4, 0 }, +/* 53 */ { SDL_SCANCODE_5, 0 }, +/* 54 */ { SDL_SCANCODE_6, 0 }, +/* 55 */ { SDL_SCANCODE_7, 0 }, +/* 56 */ { SDL_SCANCODE_8, 0 }, +/* 57 */ { SDL_SCANCODE_9, 0 }, +/* 58 */ { SDL_SCANCODE_SEMICOLON, KMOD_SHIFT }, /* plus shift modifier ';' */ +/* 59 */ { SDL_SCANCODE_SEMICOLON, 0 }, +/* 60 */ { SDL_SCANCODE_COMMA, KMOD_SHIFT }, /* plus shift modifier '<' */ +/* 61 */ { SDL_SCANCODE_EQUALS, 0 }, +/* 62 */ { SDL_SCANCODE_PERIOD, KMOD_SHIFT }, /* plus shift modifier '>' */ +/* 63 */ { SDL_SCANCODE_SLASH, KMOD_SHIFT }, /* plus shift modifier '?' */ +/* 64 */ { SDL_SCANCODE_2, KMOD_SHIFT }, /* plus shift modifier '@' */ +/* 65 */ { SDL_SCANCODE_A, KMOD_SHIFT }, /* all the following need shift modifiers */ +/* 66 */ { SDL_SCANCODE_B, KMOD_SHIFT }, +/* 67 */ { SDL_SCANCODE_C, KMOD_SHIFT }, +/* 68 */ { SDL_SCANCODE_D, KMOD_SHIFT }, +/* 69 */ { SDL_SCANCODE_E, KMOD_SHIFT }, +/* 70 */ { SDL_SCANCODE_F, KMOD_SHIFT }, +/* 71 */ { SDL_SCANCODE_G, KMOD_SHIFT }, +/* 72 */ { SDL_SCANCODE_H, KMOD_SHIFT }, +/* 73 */ { SDL_SCANCODE_I, KMOD_SHIFT }, +/* 74 */ { SDL_SCANCODE_J, KMOD_SHIFT }, +/* 75 */ { SDL_SCANCODE_K, KMOD_SHIFT }, +/* 76 */ { SDL_SCANCODE_L, KMOD_SHIFT }, +/* 77 */ { SDL_SCANCODE_M, KMOD_SHIFT }, +/* 78 */ { SDL_SCANCODE_N, KMOD_SHIFT }, +/* 79 */ { SDL_SCANCODE_O, KMOD_SHIFT }, +/* 80 */ { SDL_SCANCODE_P, KMOD_SHIFT }, +/* 81 */ { SDL_SCANCODE_Q, KMOD_SHIFT }, +/* 82 */ { SDL_SCANCODE_R, KMOD_SHIFT }, +/* 83 */ { SDL_SCANCODE_S, KMOD_SHIFT }, +/* 84 */ { SDL_SCANCODE_T, KMOD_SHIFT }, +/* 85 */ { SDL_SCANCODE_U, KMOD_SHIFT }, +/* 86 */ { SDL_SCANCODE_V, KMOD_SHIFT }, +/* 87 */ { SDL_SCANCODE_W, KMOD_SHIFT }, +/* 88 */ { SDL_SCANCODE_X, KMOD_SHIFT }, +/* 89 */ { SDL_SCANCODE_Y, KMOD_SHIFT }, +/* 90 */ { SDL_SCANCODE_Z, KMOD_SHIFT }, +/* 91 */ { SDL_SCANCODE_LEFTBRACKET, 0 }, +/* 92 */ { SDL_SCANCODE_BACKSLASH, 0 }, +/* 93 */ { SDL_SCANCODE_RIGHTBRACKET, 0 }, +/* 94 */ { SDL_SCANCODE_6, KMOD_SHIFT }, /* plus shift modifier '^' */ +/* 95 */ { SDL_SCANCODE_MINUS, KMOD_SHIFT }, /* plus shift modifier '_' */ +/* 96 */ { SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* '`' */ +/* 97 */ { SDL_SCANCODE_A, 0 }, +/* 98 */ { SDL_SCANCODE_B, 0 }, +/* 99 */ { SDL_SCANCODE_C, 0 }, +/* 100 */{ SDL_SCANCODE_D, 0 }, +/* 101 */{ SDL_SCANCODE_E, 0 }, +/* 102 */{ SDL_SCANCODE_F, 0 }, +/* 103 */{ SDL_SCANCODE_G, 0 }, +/* 104 */{ SDL_SCANCODE_H, 0 }, +/* 105 */{ SDL_SCANCODE_I, 0 }, +/* 106 */{ SDL_SCANCODE_J, 0 }, +/* 107 */{ SDL_SCANCODE_K, 0 }, +/* 108 */{ SDL_SCANCODE_L, 0 }, +/* 109 */{ SDL_SCANCODE_M, 0 }, +/* 110 */{ SDL_SCANCODE_N, 0 }, +/* 111 */{ SDL_SCANCODE_O, 0 }, +/* 112 */{ SDL_SCANCODE_P, 0 }, +/* 113 */{ SDL_SCANCODE_Q, 0 }, +/* 114 */{ SDL_SCANCODE_R, 0 }, +/* 115 */{ SDL_SCANCODE_S, 0 }, +/* 116 */{ SDL_SCANCODE_T, 0 }, +/* 117 */{ SDL_SCANCODE_U, 0 }, +/* 118 */{ SDL_SCANCODE_V, 0 }, +/* 119 */{ SDL_SCANCODE_W, 0 }, +/* 120 */{ SDL_SCANCODE_X, 0 }, +/* 121 */{ SDL_SCANCODE_Y, 0 }, +/* 122 */{ SDL_SCANCODE_Z, 0 }, +/* 123 */{ SDL_SCANCODE_LEFTBRACKET, KMOD_SHIFT }, /* plus shift modifier '{' */ +/* 124 */{ SDL_SCANCODE_BACKSLASH, KMOD_SHIFT }, /* plus shift modifier '|' */ +/* 125 */{ SDL_SCANCODE_RIGHTBRACKET, KMOD_SHIFT }, /* plus shift modifier '}' */ +/* 126 */{ SDL_SCANCODE_GRAVE, KMOD_SHIFT }, /* plus shift modifier '~' */ +/* 127 */{ SDL_SCANCODE_BACKSPACE, KMOD_SHIFT } +}; + +#endif /* _ANDROID_KeyInfo */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_dbus.c b/Engine/lib/sdl/src/core/linux/SDL_dbus.c index ab73ca17c..ff4f0fe67 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_dbus.c +++ b/Engine/lib/sdl/src/core/linux/SDL_dbus.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -56,7 +56,9 @@ LoadDBUSSyms(void) SDL_DBUS_SYM(message_is_signal); SDL_DBUS_SYM(message_new_method_call); SDL_DBUS_SYM(message_append_args); + SDL_DBUS_SYM(message_append_args_valist); SDL_DBUS_SYM(message_get_args); + SDL_DBUS_SYM(message_get_args_valist); SDL_DBUS_SYM(message_iter_init); SDL_DBUS_SYM(message_iter_next); SDL_DBUS_SYM(message_iter_get_basic); @@ -68,6 +70,7 @@ LoadDBUSSyms(void) SDL_DBUS_SYM(error_free); SDL_DBUS_SYM(get_local_machine_id); SDL_DBUS_SYM(free); + SDL_DBUS_SYM(free_string_array); SDL_DBUS_SYM(shutdown); #undef SDL_DBUS_SYM @@ -112,14 +115,15 @@ SDL_DBus_Init(void) DBusError err; dbus.error_init(&err); dbus.session_conn = dbus.bus_get_private(DBUS_BUS_SESSION, &err); + if (!dbus.error_is_set(&err)) { + dbus.system_conn = dbus.bus_get_private(DBUS_BUS_SYSTEM, &err); + } if (dbus.error_is_set(&err)) { dbus.error_free(&err); - if (dbus.session_conn) { - dbus.connection_unref(dbus.session_conn); - dbus.session_conn = NULL; - } + SDL_DBus_Quit(); return; /* oh well */ } + dbus.connection_set_exit_on_disconnect(dbus.system_conn, 0); dbus.connection_set_exit_on_disconnect(dbus.session_conn, 0); } } @@ -127,12 +131,23 @@ SDL_DBus_Init(void) void SDL_DBus_Quit(void) { + if (dbus.system_conn) { + dbus.connection_close(dbus.system_conn); + dbus.connection_unref(dbus.system_conn); + } if (dbus.session_conn) { dbus.connection_close(dbus.session_conn); dbus.connection_unref(dbus.session_conn); - dbus.shutdown(); - SDL_memset(&dbus, 0, sizeof(dbus)); } +/* Don't do this - bug 3950 + dbus_shutdown() is a debug feature which closes all global resources in the dbus library. Calling this should be done by the app, not a library, because if there are multiple users of dbus in the process then SDL could shut it down even though another part is using it. +*/ +#if 0 + if (dbus.shutdown) { + dbus.shutdown(); + } +#endif + SDL_zero(dbus); UnloadDBUSLibrary(); } @@ -150,90 +165,171 @@ SDL_DBus_GetContext(void) } } -void -SDL_DBus_ScreensaverTickle(void) +static SDL_bool +SDL_DBus_CallMethodInternal(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, va_list ap) { - DBusConnection *conn = dbus.session_conn; - if (conn != NULL) { - DBusMessage *msg = dbus.message_new_method_call("org.gnome.ScreenSaver", - "/org/gnome/ScreenSaver", - "org.gnome.ScreenSaver", - "SimulateUserActivity"); - if (msg != NULL) { - if (dbus.connection_send(conn, msg, NULL)) { - dbus.connection_flush(conn); + SDL_bool retval = SDL_FALSE; + + if (conn) { + DBusMessage *msg = dbus.message_new_method_call(node, path, interface, method); + if (msg) { + int firstarg = va_arg(ap, int); + if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_append_args_valist(msg, firstarg, ap)) { + DBusMessage *reply = dbus.connection_send_with_reply_and_block(conn, msg, 300, NULL); + if (reply) { + firstarg = va_arg(ap, int); + if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_get_args_valist(reply, NULL, firstarg, ap)) { + retval = SDL_TRUE; + } + dbus.message_unref(reply); + } } dbus.message_unref(msg); } } + + return retval; +} + +SDL_bool +SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...) +{ + SDL_bool retval; + va_list ap; + va_start(ap, method); + retval = SDL_DBus_CallMethodInternal(conn, node, path, interface, method, ap); + va_end(ap); + return retval; +} + +SDL_bool +SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...) +{ + SDL_bool retval; + va_list ap; + va_start(ap, method); + retval = SDL_DBus_CallMethodInternal(dbus.session_conn, node, path, interface, method, ap); + va_end(ap); + return retval; +} + +static SDL_bool +SDL_DBus_CallVoidMethodInternal(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, va_list ap) +{ + SDL_bool retval = SDL_FALSE; + + if (conn) { + DBusMessage *msg = dbus.message_new_method_call(node, path, interface, method); + if (msg) { + int firstarg = va_arg(ap, int); + if ((firstarg == DBUS_TYPE_INVALID) || dbus.message_append_args_valist(msg, firstarg, ap)) { + if (dbus.connection_send(conn, msg, NULL)) { + dbus.connection_flush(conn); + retval = SDL_TRUE; + } + } + + dbus.message_unref(msg); + } + } + + return retval; +} + +SDL_bool +SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...) +{ + SDL_bool retval; + va_list ap; + va_start(ap, method); + retval = SDL_DBus_CallVoidMethodInternal(conn, node, path, interface, method, ap); + va_end(ap); + return retval; +} + +SDL_bool +SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...) +{ + SDL_bool retval; + va_list ap; + va_start(ap, method); + retval = SDL_DBus_CallVoidMethodInternal(dbus.session_conn, node, path, interface, method, ap); + va_end(ap); + return retval; +} + +SDL_bool +SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result) +{ + SDL_bool retval = SDL_FALSE; + + if (conn) { + DBusMessage *msg = dbus.message_new_method_call(node, path, "org.freedesktop.DBus.Properties", "Get"); + if (msg) { + if (dbus.message_append_args(msg, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &property, DBUS_TYPE_INVALID)) { + DBusMessage *reply = dbus.connection_send_with_reply_and_block(conn, msg, 300, NULL); + if (reply) { + DBusMessageIter iter, sub; + dbus.message_iter_init(reply, &iter); + if (dbus.message_iter_get_arg_type(&iter) == DBUS_TYPE_VARIANT) { + dbus.message_iter_recurse(&iter, &sub); + if (dbus.message_iter_get_arg_type(&sub) == expectedtype) { + dbus.message_iter_get_basic(&sub, result); + retval = SDL_TRUE; + } + } + dbus.message_unref(reply); + } + } + dbus.message_unref(msg); + } + } + + return retval; +} + +SDL_bool +SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result) +{ + return SDL_DBus_QueryPropertyOnConnection(dbus.session_conn, node, path, interface, property, expectedtype, result); +} + + +void +SDL_DBus_ScreensaverTickle(void) +{ + SDL_DBus_CallVoidMethod("org.gnome.ScreenSaver", "/org/gnome/ScreenSaver", "org.gnome.ScreenSaver", "SimulateUserActivity", DBUS_TYPE_INVALID); } SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit) { - DBusConnection *conn = dbus.session_conn; - - if (conn == NULL) - return SDL_FALSE; - - if (inhibit && - screensaver_cookie != 0) - return SDL_TRUE; - if (!inhibit && - screensaver_cookie == 0) - return SDL_TRUE; - - if (inhibit) { - const char *app = "My SDL application"; - const char *reason = "Playing a game"; - - DBusMessage *msg = dbus.message_new_method_call("org.freedesktop.ScreenSaver", - "/org/freedesktop/ScreenSaver", - "org.freedesktop.ScreenSaver", - "Inhibit"); - if (msg != NULL) { - dbus.message_append_args (msg, - DBUS_TYPE_STRING, &app, - DBUS_TYPE_STRING, &reason, - DBUS_TYPE_INVALID); - } - - if (msg != NULL) { - DBusMessage *reply; - - reply = dbus.connection_send_with_reply_and_block(conn, msg, 300, NULL); - if (reply) { - if (!dbus.message_get_args(reply, NULL, - DBUS_TYPE_UINT32, &screensaver_cookie, - DBUS_TYPE_INVALID)) - screensaver_cookie = 0; - dbus.message_unref(reply); - } - - dbus.message_unref(msg); - } - - if (screensaver_cookie == 0) { - return SDL_FALSE; - } + if ( (inhibit && (screensaver_cookie != 0)) || (!inhibit && (screensaver_cookie == 0)) ) { return SDL_TRUE; } else { - DBusMessage *msg = dbus.message_new_method_call("org.freedesktop.ScreenSaver", - "/org/freedesktop/ScreenSaver", - "org.freedesktop.ScreenSaver", - "UnInhibit"); - dbus.message_append_args (msg, - DBUS_TYPE_UINT32, &screensaver_cookie, - DBUS_TYPE_INVALID); - if (msg != NULL) { - if (dbus.connection_send(conn, msg, NULL)) { - dbus.connection_flush(conn); - } - dbus.message_unref(msg); - } + const char *node = "org.freedesktop.ScreenSaver"; + const char *path = "/org/freedesktop/ScreenSaver"; + const char *interface = "org.freedesktop.ScreenSaver"; - screensaver_cookie = 0; - return SDL_TRUE; + if (inhibit) { + const char *app = "My SDL application"; + const char *reason = "Playing a game"; + if (!SDL_DBus_CallMethod(node, path, interface, "Inhibit", + DBUS_TYPE_STRING, &app, DBUS_TYPE_STRING, &reason, DBUS_TYPE_INVALID, + DBUS_TYPE_UINT32, &screensaver_cookie, DBUS_TYPE_INVALID)) { + return SDL_FALSE; + } + return (screensaver_cookie != 0) ? SDL_TRUE : SDL_FALSE; + } else { + if (!SDL_DBus_CallVoidMethod(node, path, interface, "UnInhibit", DBUS_TYPE_UINT32, &screensaver_cookie, DBUS_TYPE_INVALID)) { + return SDL_FALSE; + } + screensaver_cookie = 0; + } } + + return SDL_TRUE; } #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_dbus.h b/Engine/lib/sdl/src/core/linux/SDL_dbus.h index c064381a0..062543d46 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_dbus.h +++ b/Engine/lib/sdl/src/core/linux/SDL_dbus.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_dbus_h -#define _SDL_dbus_h +#ifndef SDL_dbus_h_ +#define SDL_dbus_h_ #ifdef HAVE_DBUS_DBUS_H #define SDL_USE_LIBDBUS 1 @@ -32,6 +32,7 @@ typedef struct SDL_DBusContext { DBusConnection *session_conn; + DBusConnection *system_conn; DBusConnection *(*bus_get_private)(DBusBusType, DBusError *); dbus_bool_t (*bus_register)(DBusConnection *, DBusError *); @@ -53,7 +54,9 @@ typedef struct SDL_DBusContext { dbus_bool_t (*message_is_signal)(DBusMessage *, const char *, const char *); DBusMessage *(*message_new_method_call)(const char *, const char *, const char *, const char *); dbus_bool_t (*message_append_args)(DBusMessage *, int, ...); + dbus_bool_t (*message_append_args_valist)(DBusMessage *, int, va_list); dbus_bool_t (*message_get_args)(DBusMessage *, DBusError *, int, ...); + dbus_bool_t (*message_get_args_valist)(DBusMessage *, DBusError *, int, va_list); dbus_bool_t (*message_iter_init)(DBusMessage *, DBusMessageIter *); dbus_bool_t (*message_iter_next)(DBusMessageIter *); void (*message_iter_get_basic)(DBusMessageIter *, void *); @@ -65,6 +68,7 @@ typedef struct SDL_DBusContext { void (*error_free)(DBusError *); char *(*get_local_machine_id)(void); void (*free)(void *); + void (*free_string_array)(char **); void (*shutdown)(void); } SDL_DBusContext; @@ -72,11 +76,22 @@ typedef struct SDL_DBusContext { extern void SDL_DBus_Init(void); extern void SDL_DBus_Quit(void); extern SDL_DBusContext * SDL_DBus_GetContext(void); + +/* These use the built-in Session connection. */ +extern SDL_bool SDL_DBus_CallMethod(const char *node, const char *path, const char *interface, const char *method, ...); +extern SDL_bool SDL_DBus_CallVoidMethod(const char *node, const char *path, const char *interface, const char *method, ...); +extern SDL_bool SDL_DBus_QueryProperty(const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result); + +/* These use whatever connection you like. */ +extern SDL_bool SDL_DBus_CallMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...); +extern SDL_bool SDL_DBus_CallVoidMethodOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *method, ...); +extern SDL_bool SDL_DBus_QueryPropertyOnConnection(DBusConnection *conn, const char *node, const char *path, const char *interface, const char *property, const int expectedtype, void *result); + extern void SDL_DBus_ScreensaverTickle(void); extern SDL_bool SDL_DBus_ScreensaverInhibit(SDL_bool inhibit); #endif /* HAVE_DBUS_DBUS_H */ -#endif /* _SDL_dbus_h */ +#endif /* SDL_dbus_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_evdev.c b/Engine/lib/sdl/src/core/linux/SDL_evdev.c index 4761f3e46..a50692617 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_evdev.c +++ b/Engine/lib/sdl/src/core/linux/SDL_evdev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,51 +30,51 @@ */ #include "SDL_evdev.h" +#include "SDL_evdev_kbd.h" #include #include #include #include -#include /* For the definition of PATH_MAX */ #include -#ifdef SDL_INPUT_LINUXKD -#include -#include -#include -#include /* for TIOCL_GETSHIFTSTATE */ -#endif #include "SDL.h" #include "SDL_assert.h" #include "SDL_endian.h" -#include "../../core/linux/SDL_udev.h" #include "SDL_scancode.h" #include "../../events/SDL_events_c.h" #include "../../events/scancodes_linux.h" /* adds linux_scancode_table */ +#include "../../core/linux/SDL_udev.h" -/* This isn't defined in older Linux kernel headers */ +/* These are not defined in older Linux kernel headers */ #ifndef SYN_DROPPED #define SYN_DROPPED 3 #endif +#ifndef ABS_MT_SLOT +#define ABS_MT_SLOT 0x2f +#define ABS_MT_POSITION_X 0x35 +#define ABS_MT_POSITION_Y 0x36 +#define ABS_MT_TRACKING_ID 0x39 +#endif typedef struct SDL_evdevlist_item { char *path; int fd; - + /* TODO: use this for every device, not just touchscreen */ int out_of_sync; - + /* TODO: expand on this to have data for every possible class (mouse, keyboard, touchpad, etc.). Also there's probably some things in here we can pull out to the SDL_evdevlist_item i.e. name */ int is_touchscreen; struct { char* name; - + int min_x, max_x, range_x; int min_y, max_y, range_y; - + int max_slots; int current_slot; struct { @@ -88,18 +88,17 @@ typedef struct SDL_evdevlist_item int x, y; } * slots; } * touchscreen_data; - + struct SDL_evdevlist_item *next; } SDL_evdevlist_item; typedef struct SDL_EVDEV_PrivateData { + int ref_count; + int num_devices; SDL_evdevlist_item *first; SDL_evdevlist_item *last; - int num_devices; - int ref_count; - int console_fd; - int kb_mode; + SDL_EVDEV_keyboard_state *kbd; } SDL_EVDEV_PrivateData; #define _THIS SDL_EVDEV_PrivateData *_this @@ -111,7 +110,7 @@ static int SDL_EVDEV_device_removed(const char *dev_path); #if SDL_USE_LIBUDEV static int SDL_EVDEV_device_added(const char *dev_path, int udev_class); -void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, +static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *dev_path); #endif /* SDL_USE_LIBUDEV */ @@ -126,93 +125,6 @@ static Uint8 EVDEV_MouseButtons[] = { SDL_BUTTON_X2 + 3 /* BTN_TASK 0x117 */ }; -static const char* EVDEV_consoles[] = { - /* "/proc/self/fd/0", - "/dev/tty", - "/dev/tty0", */ /* the tty ioctl's prohibit these */ - "/dev/tty1", - "/dev/tty2", - "/dev/tty3", - "/dev/tty4", - "/dev/tty5", - "/dev/tty6", - "/dev/tty7", /* usually X is spawned in tty7 */ - "/dev/vc/0", - "/dev/console" -}; - -static int SDL_EVDEV_is_console(int fd) { - int type; - - return isatty(fd) && ioctl(fd, KDGKBTYPE, &type) == 0 && - (type == KB_101 || type == KB_84); -} - -/* Prevent keystrokes from reaching the tty */ -static int SDL_EVDEV_mute_keyboard(int tty_fd, int* old_kb_mode) -{ - if (!SDL_EVDEV_is_console(tty_fd)) { - return SDL_SetError("Tried to mute an invalid tty"); - } - - if (ioctl(tty_fd, KDGKBMODE, old_kb_mode) < 0) { - return SDL_SetError("Failed to get keyboard mode during muting"); - } - - /* FIXME: atm this absolutely ruins the vt, and KDSKBMUTE isn't implemented - in the kernel */ - /* - if (ioctl(tty_fd, KDSKBMODE, K_OFF) < 0) { - return SDL_SetError("Failed to set keyboard mode during muting"); - } - */ - - return 0; -} - -/* Restore the keyboard mode for given tty */ -static void SDL_EVDEV_unmute_keyboard(int tty_fd, int kb_mode) -{ - /* read above */ - /* - if (ioctl(tty_fd, KDSKBMODE, kb_mode) < 0) { - SDL_Log("Failed to unmute keyboard"); - } - */ -} - -static int SDL_EVDEV_get_active_tty() -{ - int i, fd, ret, tty = 0; - char tiocl; - struct vt_stat vt_state; - char path[PATH_MAX + 1]; - - for(i = 0; i < SDL_arraysize(EVDEV_consoles); i++) { - fd = open(EVDEV_consoles[i], O_RDONLY); - - if (fd < 0 && !SDL_EVDEV_is_console(fd)) - break; - - tiocl = TIOCL_GETFGCONSOLE; - if ((ret = ioctl(fd, TIOCLINUX, &tiocl)) >= 0) - tty = ret + 1; - else if (ioctl(fd, VT_GETSTATE, &vt_state) == 0) - tty = vt_state.v_active; - - close(fd); - - if (tty) { - sprintf(path, "/dev/tty%u", tty); - fd = open(path, O_RDONLY); - if (fd >= 0 && SDL_EVDEV_is_console(fd)) - return fd; - } - } - - return SDL_SetError("Failed to determine active tty"); -} - int SDL_EVDEV_Init(void) { @@ -236,24 +148,18 @@ SDL_EVDEV_Init(void) _this = NULL; return -1; } - + /* Force a scan to build the initial device list */ SDL_UDEV_Scan(); #else /* TODO: Scan the devices manually, like a caveman */ #endif /* SDL_USE_LIBUDEV */ - - /* We need a physical terminal (not PTS) to be able to translate key - code to symbols via the kernel tables */ - _this->console_fd = SDL_EVDEV_get_active_tty(); - - /* Mute the keyboard so keystrokes only generate evdev events and do not - leak through to the console */ - SDL_EVDEV_mute_keyboard(_this->console_fd, &_this->kb_mode); + + _this->kbd = SDL_EVDEV_kbd_init(); } - + _this->ref_count += 1; - + return 0; } @@ -263,42 +169,39 @@ SDL_EVDEV_Quit(void) if (_this == NULL) { return; } - + _this->ref_count -= 1; - + if (_this->ref_count < 1) { #if SDL_USE_LIBUDEV SDL_UDEV_DelCallback(SDL_EVDEV_udev_callback); SDL_UDEV_Quit(); #endif /* SDL_USE_LIBUDEV */ - - if (_this->console_fd >= 0) { - SDL_EVDEV_unmute_keyboard(_this->console_fd, _this->kb_mode); - close(_this->console_fd); - } - + + SDL_EVDEV_kbd_quit(_this->kbd); + /* Remove existing devices */ while(_this->first != NULL) { SDL_EVDEV_device_removed(_this->first->path); } - + SDL_assert(_this->first == NULL); SDL_assert(_this->last == NULL); SDL_assert(_this->num_devices == 0); - + SDL_free(_this); _this = NULL; } } #if SDL_USE_LIBUDEV -void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, +static void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, const char* dev_path) { if (dev_path == NULL) { return; } - + switch(udev_event) { case SDL_UDEV_DEVICEADDED: if (!(udev_class & (SDL_UDEV_DEVICE_MOUSE | SDL_UDEV_DEVICE_KEYBOARD | @@ -316,82 +219,6 @@ void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_event, int udev_class, } #endif /* SDL_USE_LIBUDEV */ -#ifdef SDL_INPUT_LINUXKD -/* this logic is pulled from kbd_keycode() in drivers/tty/vt/keyboard.c in the - Linux kernel source */ -static void SDL_EVDEV_do_text_input(unsigned short keycode) { - char shift_state; - int locks_state; - struct kbentry kbe; - unsigned char type; - char text[2] = { 0 }; - - if (_this->console_fd < 0) - return; - - shift_state = TIOCL_GETSHIFTSTATE; - if (ioctl(_this->console_fd, TIOCLINUX, &shift_state) < 0) { - /* TODO: error */ - return; - } - - kbe.kb_table = shift_state; - kbe.kb_index = keycode; - - if (ioctl(_this->console_fd, KDGKBENT, &kbe) < 0) { - /* TODO: error */ - return; - } - - type = KTYP(kbe.kb_value); - - if (type < 0xf0) { - /* - * FIXME: keysyms with a type below 0xf0 represent a unicode character - * which requires special handling due to dead characters, diacritics, - * etc. For perfect input a proper way to deal with such characters - * should be implemented. - * - * For reference, the only place I was able to find out about this - * special 0xf0 value was in an unused? couple of patches listed below. - * - * http://ftp.tc.edu.tw/pub/docs/Unicode/utf8/linux-2.3.12-keyboard.diff - * http://ftp.tc.edu.tw/pub/docs/Unicode/utf8/linux-2.3.12-console.diff - */ - - return; - } - - type -= 0xf0; - - /* if type is KT_LETTER then it can be affected by Caps Lock */ - if (type == KT_LETTER) { - type = KT_LATIN; - - if (ioctl(_this->console_fd, KDGKBLED, &locks_state) < 0) { - /* TODO: error */ - return; - } - - if (locks_state & K_CAPSLOCK) { - kbe.kb_table = shift_state ^ (1 << KG_SHIFT); - - if (ioctl(_this->console_fd, KDGKBENT, &kbe) < 0) { - /* TODO: error */ - return; - } - } - } - - /* TODO: convert values >= 0x80 from ISO-8859-1? to UTF-8 */ - if (type != KT_LATIN || KVAL(kbe.kb_value) >= 0x80) - return; - - *text = KVAL(kbe.kb_value); - SDL_SendKeyboardText(text); -} -#endif /* SDL_INPUT_LINUXKD */ - void SDL_EVDEV_Poll(void) { @@ -423,7 +250,7 @@ SDL_EVDEV_Poll(void) events[i].type == EV_SYN && events[i].code != SYN_REPORT) { break; } - + switch (events[i].type) { case EV_KEY: if (events[i].code >= BTN_MOUSE && events[i].code < BTN_MOUSE + SDL_arraysize(EVDEV_MouseButtons)) { @@ -443,11 +270,9 @@ SDL_EVDEV_Poll(void) SDL_SendKeyboardKey(SDL_RELEASED, scan_code); } else if (events[i].value == 1 || events[i].value == 2 /* key repeated */) { SDL_SendKeyboardKey(SDL_PRESSED, scan_code); -#ifdef SDL_INPUT_LINUXKD - SDL_EVDEV_do_text_input(events[i].code); -#endif /* SDL_INPUT_LINUXKD */ } } + SDL_EVDEV_kbd_keycode(_this->kbd, events[i].code, events[i].value); break; case EV_ABS: switch(events[i].code) { @@ -519,13 +344,13 @@ SDL_EVDEV_Poll(void) case SYN_REPORT: if (!item->is_touchscreen) /* FIXME: temp hack */ break; - + for(j = 0; j < item->touchscreen_data->max_slots; j++) { norm_x = (float)(item->touchscreen_data->slots[j].x - item->touchscreen_data->min_x) / (float)item->touchscreen_data->range_x; norm_y = (float)(item->touchscreen_data->slots[j].y - item->touchscreen_data->min_y) / (float)item->touchscreen_data->range_y; - + switch(item->touchscreen_data->slots[j].delta) { case EVDEV_TOUCH_SLOTDELTA_DOWN: SDL_SendTouch(item->fd, item->touchscreen_data->slots[j].tracking_id, SDL_TRUE, norm_x, norm_y, 1.0f); @@ -544,7 +369,7 @@ SDL_EVDEV_Poll(void) break; } } - + if (item->out_of_sync) item->out_of_sync = 0; break; @@ -573,8 +398,8 @@ SDL_EVDEV_translate_keycode(int keycode) if (scancode == SDL_SCANCODE_UNKNOWN) { SDL_Log("The key you just pressed is not recognized by SDL. To help " - "get this fixed, please report this to the SDL mailing list " - " EVDEV KeyCode %d\n", keycode); + "get this fixed, please report this to the SDL forums/mailing list " + " EVDEV KeyCode %d", keycode); } return scancode; @@ -587,26 +412,26 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) int ret, i; char name[64]; struct input_absinfo abs_info; - + if (!item->is_touchscreen) return 0; - + item->touchscreen_data = SDL_calloc(1, sizeof(*item->touchscreen_data)); if (item->touchscreen_data == NULL) return SDL_OutOfMemory(); - + ret = ioctl(item->fd, EVIOCGNAME(sizeof(name)), name); if (ret < 0) { SDL_free(item->touchscreen_data); return SDL_SetError("Failed to get evdev touchscreen name"); } - + item->touchscreen_data->name = SDL_strdup(name); if (item->touchscreen_data->name == NULL) { SDL_free(item->touchscreen_data); return SDL_OutOfMemory(); } - + ret = ioctl(item->fd, EVIOCGABS(ABS_MT_POSITION_X), &abs_info); if (ret < 0) { SDL_free(item->touchscreen_data->name); @@ -616,7 +441,7 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) item->touchscreen_data->min_x = abs_info.minimum; item->touchscreen_data->max_x = abs_info.maximum; item->touchscreen_data->range_x = abs_info.maximum - abs_info.minimum; - + ret = ioctl(item->fd, EVIOCGABS(ABS_MT_POSITION_Y), &abs_info); if (ret < 0) { SDL_free(item->touchscreen_data->name); @@ -626,7 +451,7 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) item->touchscreen_data->min_y = abs_info.minimum; item->touchscreen_data->max_y = abs_info.maximum; item->touchscreen_data->range_y = abs_info.maximum - abs_info.minimum; - + ret = ioctl(item->fd, EVIOCGABS(ABS_MT_SLOT), &abs_info); if (ret < 0) { SDL_free(item->touchscreen_data->name); @@ -634,7 +459,7 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) return SDL_SetError("Failed to get evdev touchscreen limits"); } item->touchscreen_data->max_slots = abs_info.maximum + 1; - + item->touchscreen_data->slots = SDL_calloc( item->touchscreen_data->max_slots, sizeof(*item->touchscreen_data->slots)); @@ -643,11 +468,11 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) SDL_free(item->touchscreen_data); return SDL_OutOfMemory(); } - + for(i = 0; i < item->touchscreen_data->max_slots; i++) { item->touchscreen_data->slots[i].tracking_id = -1; } - + ret = SDL_AddTouch(item->fd, /* I guess our fd is unique enough */ item->touchscreen_data->name); if (ret < 0) { @@ -656,7 +481,7 @@ SDL_EVDEV_init_touchscreen(SDL_evdevlist_item* item) SDL_free(item->touchscreen_data); return ret; } - + return 0; } #endif /* SDL_USE_LIBUDEV */ @@ -665,7 +490,7 @@ static void SDL_EVDEV_destroy_touchscreen(SDL_evdevlist_item* item) { if (!item->is_touchscreen) return; - + SDL_DelTouch(item->fd); SDL_free(item->touchscreen_data->slots); SDL_free(item->touchscreen_data->name); @@ -689,21 +514,21 @@ SDL_EVDEV_sync_device(SDL_evdevlist_item *item) __u32* mt_req_code; __s32* mt_req_values; size_t mt_req_size; - + /* TODO: sync devices other than touchscreen */ if (!item->is_touchscreen) return; - + mt_req_size = sizeof(*mt_req_code) + sizeof(*mt_req_values) * item->touchscreen_data->max_slots; - + mt_req_code = SDL_calloc(1, mt_req_size); if (mt_req_code == NULL) { return; } - + mt_req_values = (__s32*)mt_req_code + 1; - + *mt_req_code = ABS_MT_TRACKING_ID; ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); if (ret < 0) { @@ -730,7 +555,7 @@ SDL_EVDEV_sync_device(SDL_evdevlist_item *item) item->touchscreen_data->slots[i].delta = EVDEV_TOUCH_SLOTDELTA_UP; } } - + *mt_req_code = ABS_MT_POSITION_X; ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); if (ret < 0) { @@ -748,7 +573,7 @@ SDL_EVDEV_sync_device(SDL_evdevlist_item *item) } } } - + *mt_req_code = ABS_MT_POSITION_Y; ret = ioctl(item->fd, EVIOCGMTSLOTS(mt_req_size), mt_req_code); if (ret < 0) { @@ -766,14 +591,14 @@ SDL_EVDEV_sync_device(SDL_evdevlist_item *item) } } } - + ret = ioctl(item->fd, EVIOCGABS(ABS_MT_SLOT), &abs_info); if (ret < 0) { SDL_free(mt_req_code); return; } item->touchscreen_data->current_slot = abs_info.value; - + SDL_free(mt_req_code); #endif /* EVIOCGMTSLOTS */ @@ -792,7 +617,7 @@ SDL_EVDEV_device_added(const char *dev_path, int udev_class) return -1; /* already have this one */ } } - + item = (SDL_evdevlist_item *) SDL_calloc(1, sizeof (SDL_evdevlist_item)); if (item == NULL) { return SDL_OutOfMemory(); @@ -803,33 +628,33 @@ SDL_EVDEV_device_added(const char *dev_path, int udev_class) SDL_free(item); return SDL_SetError("Unable to open %s", dev_path); } - + item->path = SDL_strdup(dev_path); if (item->path == NULL) { close(item->fd); SDL_free(item); return SDL_OutOfMemory(); } - + if (udev_class & SDL_UDEV_DEVICE_TOUCHSCREEN) { item->is_touchscreen = 1; - + if ((ret = SDL_EVDEV_init_touchscreen(item)) < 0) { close(item->fd); SDL_free(item); return ret; } } - + if (_this->last == NULL) { _this->first = _this->last = item; } else { _this->last->next = item; _this->last = item; } - + SDL_EVDEV_sync_device(item); - + return _this->num_devices++; } #endif /* SDL_USE_LIBUDEV */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_evdev.h b/Engine/lib/sdl/src/core/linux/SDL_evdev.h index 85b193864..8d6d683e6 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_evdev.h +++ b/Engine/lib/sdl/src/core/linux/SDL_evdev.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_evdev_h -#define _SDL_evdev_h +#ifndef SDL_evdev_h_ +#define SDL_evdev_h_ #ifdef SDL_INPUT_LINUXEV @@ -34,6 +34,6 @@ extern void SDL_EVDEV_Poll(void); #endif /* SDL_INPUT_LINUXEV */ -#endif /* _SDL_evdev_h */ +#endif /* SDL_evdev_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.c b/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.c new file mode 100644 index 000000000..250e6440b --- /dev/null +++ b/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.c @@ -0,0 +1,677 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#include "SDL_evdev_kbd.h" + +#ifdef SDL_INPUT_LINUXKD + +/* This logic is adapted from drivers/tty/vt/keyboard.c in the Linux kernel source */ + +#include +#include +#include +#include +#include +#include +#include /* for TIOCL_GETSHIFTSTATE */ + +#include "../../events/SDL_events_c.h" +#include "SDL_evdev_kbd_default_accents.h" +#include "SDL_evdev_kbd_default_keymap.h" + +/* These are not defined in older Linux kernel headers */ +#ifndef K_UNICODE +#define K_UNICODE 0x03 +#endif +#ifndef K_OFF +#define K_OFF 0x04 +#endif + +/* + * Handler Tables. + */ + +#define K_HANDLERS\ + k_self, k_fn, k_spec, k_pad,\ + k_dead, k_cons, k_cur, k_shift,\ + k_meta, k_ascii, k_lock, k_lowercase,\ + k_slock, k_dead2, k_brl, k_ignore + +typedef void (k_handler_fn)(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag); +static k_handler_fn K_HANDLERS; +static k_handler_fn *k_handler[16] = { K_HANDLERS }; + +typedef void (fn_handler_fn)(SDL_EVDEV_keyboard_state *kbd); +static void fn_enter(SDL_EVDEV_keyboard_state *kbd); +static void fn_caps_toggle(SDL_EVDEV_keyboard_state *kbd); +static void fn_caps_on(SDL_EVDEV_keyboard_state *kbd); +static void fn_num(SDL_EVDEV_keyboard_state *kbd); +static void fn_compose(SDL_EVDEV_keyboard_state *kbd); + +static fn_handler_fn *fn_handler[] = +{ + NULL, fn_enter, NULL, NULL, + NULL, NULL, NULL, fn_caps_toggle, + fn_num, NULL, NULL, NULL, + NULL, fn_caps_on, fn_compose, NULL, + NULL, NULL, NULL, fn_num +}; + + +/* + * Keyboard State + */ + +struct SDL_EVDEV_keyboard_state +{ + int console_fd; + int old_kbd_mode; + unsigned short **key_maps; + unsigned char shift_down[NR_SHIFT]; /* shift state counters.. */ + SDL_bool dead_key_next; + int npadch; /* -1 or number assembled on pad */ + struct kbdiacrs *accents; + unsigned int diacr; + SDL_bool rep; /* flag telling character repeat */ + unsigned char lockstate; + unsigned char slockstate; + unsigned char ledflagstate; + char shift_state; + char text[128]; + unsigned int text_len; +}; + +#ifdef DUMP_ACCENTS +static void SDL_EVDEV_dump_accents(SDL_EVDEV_keyboard_state *kbd) +{ + unsigned int i; + + printf("static struct kbdiacrs default_accents = {\n"); + printf(" %d,\n", kbd->accents->kb_cnt); + printf(" {\n"); + for (i = 0; i < kbd->accents->kb_cnt; ++i) { + struct kbdiacr *diacr = &kbd->accents->kbdiacr[i]; + printf(" { 0x%.2x, 0x%.2x, 0x%.2x },\n", + diacr->diacr, diacr->base, diacr->result); + } + while (i < 256) { + printf(" { 0x00, 0x00, 0x00 },\n"); + ++i; + } + printf(" }\n"); + printf("};\n"); +} +#endif /* DUMP_ACCENTS */ + +#ifdef DUMP_KEYMAP +static void SDL_EVDEV_dump_keymap(SDL_EVDEV_keyboard_state *kbd) +{ + int i, j; + + for (i = 0; i < MAX_NR_KEYMAPS; ++i) { + if (kbd->key_maps[i]) { + printf("static unsigned short default_key_map_%d[NR_KEYS] = {", i); + for (j = 0; j < NR_KEYS; ++j) { + if ((j%8) == 0) { + printf("\n "); + } + printf("0x%.4x, ", kbd->key_maps[i][j]); + } + printf("\n};\n"); + } + } + printf("\n"); + printf("static unsigned short *default_key_maps[MAX_NR_KEYMAPS] = {\n"); + for (i = 0; i < MAX_NR_KEYMAPS; ++i) { + if (kbd->key_maps[i]) { + printf(" default_key_map_%d,\n", i); + } else { + printf(" NULL,\n"); + } + } + printf("};\n"); +} +#endif /* DUMP_KEYMAP */ + +static int SDL_EVDEV_kbd_load_keymaps(SDL_EVDEV_keyboard_state *kbd) +{ + int i, j; + + kbd->key_maps = (unsigned short **)SDL_calloc(MAX_NR_KEYMAPS, sizeof(unsigned short *)); + if (!kbd->key_maps) { + return -1; + } + + for (i = 0; i < MAX_NR_KEYMAPS; ++i) { + struct kbentry kbe; + + kbe.kb_table = i; + kbe.kb_index = 0; + if (ioctl(kbd->console_fd, KDGKBENT, &kbe) < 0) { + return -1; + } + + if (kbe.kb_value == K_NOSUCHMAP) { + continue; + } + + kbd->key_maps[i] = (unsigned short *)SDL_malloc(NR_KEYS * sizeof(unsigned short)); + if (!kbd->key_maps[i]) { + return -1; + } + + for (j = 0; j < NR_KEYS; ++j) { + kbe.kb_table = i; + kbe.kb_index = j; + if (ioctl(kbd->console_fd, KDGKBENT, &kbe) < 0) { + return -1; + } + kbd->key_maps[i][j] = (kbe.kb_value ^ 0xf000); + } + } + return 0; +} + +SDL_EVDEV_keyboard_state * +SDL_EVDEV_kbd_init(void) +{ + SDL_EVDEV_keyboard_state *kbd; + int i; + char flag_state; + char shift_state[2] = {TIOCL_GETSHIFTSTATE, 0}; + + kbd = (SDL_EVDEV_keyboard_state *)SDL_calloc(1, sizeof(*kbd)); + if (!kbd) { + return NULL; + } + + kbd->npadch = -1; + + /* This might fail if we're not connected to a tty (e.g. on the Steam Link) */ + kbd->console_fd = open("/dev/tty", O_RDONLY); + + if (ioctl(kbd->console_fd, TIOCLINUX, shift_state) == 0) { + kbd->shift_state = *shift_state; + } + + if (ioctl(kbd->console_fd, KDGKBLED, &flag_state) == 0) { + kbd->ledflagstate = flag_state; + } + + kbd->accents = &default_accents; + if (ioctl(kbd->console_fd, KDGKBDIACR, kbd->accents) < 0) { + /* No worries, we'll use the default accent table */ + } + + kbd->key_maps = default_key_maps; + if (ioctl(kbd->console_fd, KDGKBMODE, &kbd->old_kbd_mode) == 0) { + /* Set the keyboard in UNICODE mode and load the keymaps */ + ioctl(kbd->console_fd, KDSKBMODE, K_UNICODE); + + if (SDL_EVDEV_kbd_load_keymaps(kbd) < 0) { + for (i = 0; i < MAX_NR_KEYMAPS; ++i) { + if (kbd->key_maps[i]) { + SDL_free(kbd->key_maps[i]); + } + } + SDL_free(kbd->key_maps); + + kbd->key_maps = default_key_maps; + } + + /* Mute the keyboard so keystrokes only generate evdev events + * and do not leak through to the console + */ + ioctl(kbd->console_fd, KDSKBMODE, K_OFF); + } + +#ifdef DUMP_ACCENTS + SDL_EVDEV_dump_accents(kbd); +#endif +#ifdef DUMP_KEYMAP + SDL_EVDEV_dump_keymap(kbd); +#endif + return kbd; +} + +void +SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *kbd) +{ + if (!kbd) { + return; + } + + if (kbd->console_fd >= 0) { + /* Restore the original keyboard mode */ + ioctl(kbd->console_fd, KDSKBMODE, kbd->old_kbd_mode); + + close(kbd->console_fd); + kbd->console_fd = -1; + } + + if (kbd->key_maps && kbd->key_maps != default_key_maps) { + int i; + for (i = 0; i < MAX_NR_KEYMAPS; ++i) { + if (kbd->key_maps[i]) { + SDL_free(kbd->key_maps[i]); + } + } + SDL_free(kbd->key_maps); + } + + SDL_free(kbd); +} + +/* + * Helper Functions. + */ +static void put_queue(SDL_EVDEV_keyboard_state *kbd, uint c) +{ + /* c is already part of a UTF-8 sequence and safe to add as a character */ + if (kbd->text_len < (sizeof(kbd->text)-1)) { + kbd->text[kbd->text_len++] = (char)c; + } +} + +static void put_utf8(SDL_EVDEV_keyboard_state *kbd, uint c) +{ + if (c < 0x80) + /* 0******* */ + put_queue(kbd, c); + else if (c < 0x800) { + /* 110***** 10****** */ + put_queue(kbd, 0xc0 | (c >> 6)); + put_queue(kbd, 0x80 | (c & 0x3f)); + } else if (c < 0x10000) { + if (c >= 0xD800 && c < 0xE000) + return; + if (c == 0xFFFF) + return; + /* 1110**** 10****** 10****** */ + put_queue(kbd, 0xe0 | (c >> 12)); + put_queue(kbd, 0x80 | ((c >> 6) & 0x3f)); + put_queue(kbd, 0x80 | (c & 0x3f)); + } else if (c < 0x110000) { + /* 11110*** 10****** 10****** 10****** */ + put_queue(kbd, 0xf0 | (c >> 18)); + put_queue(kbd, 0x80 | ((c >> 12) & 0x3f)); + put_queue(kbd, 0x80 | ((c >> 6) & 0x3f)); + put_queue(kbd, 0x80 | (c & 0x3f)); + } +} + +/* + * We have a combining character DIACR here, followed by the character CH. + * If the combination occurs in the table, return the corresponding value. + * Otherwise, if CH is a space or equals DIACR, return DIACR. + * Otherwise, conclude that DIACR was not combining after all, + * queue it and return CH. + */ +static unsigned int handle_diacr(SDL_EVDEV_keyboard_state *kbd, unsigned int ch) +{ + unsigned int d = kbd->diacr; + unsigned int i; + + kbd->diacr = 0; + + for (i = 0; i < kbd->accents->kb_cnt; i++) { + if (kbd->accents->kbdiacr[i].diacr == d && + kbd->accents->kbdiacr[i].base == ch) { + return kbd->accents->kbdiacr[i].result; + } + } + + if (ch == ' ' || ch == d) + return d; + + put_utf8(kbd, d); + + return ch; +} + +static int vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) +{ + return ((kbd->ledflagstate >> flag) & 1); +} + +static void set_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) +{ + kbd->ledflagstate |= 1 << flag; +} + +static void clr_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) +{ + kbd->ledflagstate &= ~(1 << flag); +} + +static void chg_vc_kbd_lock(SDL_EVDEV_keyboard_state *kbd, int flag) +{ + kbd->lockstate ^= 1 << flag; +} + +static void chg_vc_kbd_slock(SDL_EVDEV_keyboard_state *kbd, int flag) +{ + kbd->slockstate ^= 1 << flag; +} + +static void chg_vc_kbd_led(SDL_EVDEV_keyboard_state *kbd, int flag) +{ + kbd->ledflagstate ^= 1 << flag; +} + +/* + * Special function handlers + */ + +static void fn_enter(SDL_EVDEV_keyboard_state *kbd) +{ + if (kbd->diacr) { + put_utf8(kbd, kbd->diacr); + kbd->diacr = 0; + } +} + +static void fn_caps_toggle(SDL_EVDEV_keyboard_state *kbd) +{ + if (kbd->rep) + return; + + chg_vc_kbd_led(kbd, K_CAPSLOCK); +} + +static void fn_caps_on(SDL_EVDEV_keyboard_state *kbd) +{ + if (kbd->rep) + return; + + set_vc_kbd_led(kbd, K_CAPSLOCK); +} + +static void fn_num(SDL_EVDEV_keyboard_state *kbd) +{ + if (!kbd->rep) + chg_vc_kbd_led(kbd, K_NUMLOCK); +} + +static void fn_compose(SDL_EVDEV_keyboard_state *kbd) +{ + kbd->dead_key_next = SDL_TRUE; +} + +/* + * Special key handlers + */ + +static void k_ignore(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +static void k_spec(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + if (up_flag) + return; + if (value >= SDL_arraysize(fn_handler)) + return; + if (fn_handler[value]) + fn_handler[value](kbd); +} + +static void k_lowercase(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +static void k_self(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + if (up_flag) + return; /* no action, if this is a key release */ + + if (kbd->diacr) + value = handle_diacr(kbd, value); + + if (kbd->dead_key_next) { + kbd->dead_key_next = SDL_FALSE; + kbd->diacr = value; + return; + } + put_utf8(kbd, value); +} + +static void k_deadunicode(SDL_EVDEV_keyboard_state *kbd, unsigned int value, char up_flag) +{ + if (up_flag) + return; + + kbd->diacr = (kbd->diacr ? handle_diacr(kbd, value) : value); +} + +static void k_dead(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + const unsigned char ret_diacr[NR_DEAD] = {'`', '\'', '^', '~', '"', ',' }; + + k_deadunicode(kbd, ret_diacr[value], up_flag); +} + +static void k_dead2(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + k_deadunicode(kbd, value, up_flag); +} + +static void k_cons(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +static void k_fn(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +static void k_cur(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +static void k_pad(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + static const char pad_chars[] = "0123456789+-*/\015,.?()#"; + + if (up_flag) + return; /* no action, if this is a key release */ + + if (!vc_kbd_led(kbd, K_NUMLOCK)) { + /* unprintable action */ + return; + } + + put_queue(kbd, pad_chars[value]); +} + +static void k_shift(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + int old_state = kbd->shift_state; + + if (kbd->rep) + return; + /* + * Mimic typewriter: + * a CapsShift key acts like Shift but undoes CapsLock + */ + if (value == KVAL(K_CAPSSHIFT)) { + value = KVAL(K_SHIFT); + if (!up_flag) + clr_vc_kbd_led(kbd, K_CAPSLOCK); + } + + if (up_flag) { + /* + * handle the case that two shift or control + * keys are depressed simultaneously + */ + if (kbd->shift_down[value]) + kbd->shift_down[value]--; + } else + kbd->shift_down[value]++; + + if (kbd->shift_down[value]) + kbd->shift_state |= (1 << value); + else + kbd->shift_state &= ~(1 << value); + + /* kludge */ + if (up_flag && kbd->shift_state != old_state && kbd->npadch != -1) { + put_utf8(kbd, kbd->npadch); + kbd->npadch = -1; + } +} + +static void k_meta(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +static void k_ascii(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + int base; + + if (up_flag) + return; + + if (value < 10) { + /* decimal input of code, while Alt depressed */ + base = 10; + } else { + /* hexadecimal input of code, while AltGr depressed */ + value -= 10; + base = 16; + } + + if (kbd->npadch == -1) + kbd->npadch = value; + else + kbd->npadch = kbd->npadch * base + value; +} + +static void k_lock(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + if (up_flag || kbd->rep) + return; + + chg_vc_kbd_lock(kbd, value); +} + +static void k_slock(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ + k_shift(kbd, value, up_flag); + if (up_flag || kbd->rep) + return; + + chg_vc_kbd_slock(kbd, value); + /* try to make Alt, oops, AltGr and such work */ + if (!kbd->key_maps[kbd->lockstate ^ kbd->slockstate]) { + kbd->slockstate = 0; + chg_vc_kbd_slock(kbd, value); + } +} + +static void k_brl(SDL_EVDEV_keyboard_state *kbd, unsigned char value, char up_flag) +{ +} + +void +SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *kbd, unsigned int keycode, int down) +{ + unsigned char shift_final; + unsigned char type; + unsigned short *key_map; + unsigned short keysym; + + if (!kbd) { + return; + } + + kbd->rep = (down == 2); + + shift_final = (kbd->shift_state | kbd->slockstate) ^ kbd->lockstate; + key_map = kbd->key_maps[shift_final]; + if (!key_map) { + kbd->slockstate = 0; + return; + } + + if (keycode < NR_KEYS) { + keysym = key_map[keycode]; + } else { + return; + } + + type = KTYP(keysym); + + if (type < 0xf0) { + if (down) { + put_utf8(kbd, keysym); + } + } else { + type -= 0xf0; + + /* if type is KT_LETTER then it can be affected by Caps Lock */ + if (type == KT_LETTER) { + type = KT_LATIN; + + if (vc_kbd_led(kbd, K_CAPSLOCK)) { + key_map = kbd->key_maps[shift_final ^ (1 << KG_SHIFT)]; + if (key_map) { + keysym = key_map[keycode]; + } + } + } + + (*k_handler[type])(kbd, keysym & 0xff, !down); + + if (type != KT_SLOCK) { + kbd->slockstate = 0; + } + } + + if (kbd->text_len > 0) { + kbd->text[kbd->text_len] = '\0'; + SDL_SendKeyboardText(kbd->text); + kbd->text_len = 0; + } +} + +#else /* !SDL_INPUT_LINUXKD */ + +SDL_EVDEV_keyboard_state * +SDL_EVDEV_kbd_init(void) +{ + return NULL; +} + +void +SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode, int down) +{ +} + +void +SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state) +{ +} + +#endif /* SDL_INPUT_LINUXKD */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.h b/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.h new file mode 100644 index 000000000..831ba3ade --- /dev/null +++ b/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd.h @@ -0,0 +1,29 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +struct SDL_EVDEV_keyboard_state; +typedef struct SDL_EVDEV_keyboard_state SDL_EVDEV_keyboard_state; + +extern SDL_EVDEV_keyboard_state *SDL_EVDEV_kbd_init(void); +extern void SDL_EVDEV_kbd_keycode(SDL_EVDEV_keyboard_state *state, unsigned int keycode, int down); +extern void SDL_EVDEV_kbd_quit(SDL_EVDEV_keyboard_state *state); + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd_default_accents.h b/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd_default_accents.h new file mode 100644 index 000000000..2fb52544c --- /dev/null +++ b/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd_default_accents.h @@ -0,0 +1,284 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +static struct kbdiacrs default_accents = { + 68, + { + { 0x60, 0x41, 0xc0 }, + { 0x60, 0x61, 0xe0 }, + { 0x27, 0x41, 0xc1 }, + { 0x27, 0x61, 0xe1 }, + { 0x5e, 0x41, 0xc2 }, + { 0x5e, 0x61, 0xe2 }, + { 0x7e, 0x41, 0xc3 }, + { 0x7e, 0x61, 0xe3 }, + { 0x22, 0x41, 0xc4 }, + { 0x22, 0x61, 0xe4 }, + { 0x4f, 0x41, 0xc5 }, + { 0x6f, 0x61, 0xe5 }, + { 0x30, 0x41, 0xc5 }, + { 0x30, 0x61, 0xe5 }, + { 0x41, 0x41, 0xc5 }, + { 0x61, 0x61, 0xe5 }, + { 0x41, 0x45, 0xc6 }, + { 0x61, 0x65, 0xe6 }, + { 0x2c, 0x43, 0xc7 }, + { 0x2c, 0x63, 0xe7 }, + { 0x60, 0x45, 0xc8 }, + { 0x60, 0x65, 0xe8 }, + { 0x27, 0x45, 0xc9 }, + { 0x27, 0x65, 0xe9 }, + { 0x5e, 0x45, 0xca }, + { 0x5e, 0x65, 0xea }, + { 0x22, 0x45, 0xcb }, + { 0x22, 0x65, 0xeb }, + { 0x60, 0x49, 0xcc }, + { 0x60, 0x69, 0xec }, + { 0x27, 0x49, 0xcd }, + { 0x27, 0x69, 0xed }, + { 0x5e, 0x49, 0xce }, + { 0x5e, 0x69, 0xee }, + { 0x22, 0x49, 0xcf }, + { 0x22, 0x69, 0xef }, + { 0x2d, 0x44, 0xd0 }, + { 0x2d, 0x64, 0xf0 }, + { 0x7e, 0x4e, 0xd1 }, + { 0x7e, 0x6e, 0xf1 }, + { 0x60, 0x4f, 0xd2 }, + { 0x60, 0x6f, 0xf2 }, + { 0x27, 0x4f, 0xd3 }, + { 0x27, 0x6f, 0xf3 }, + { 0x5e, 0x4f, 0xd4 }, + { 0x5e, 0x6f, 0xf4 }, + { 0x7e, 0x4f, 0xd5 }, + { 0x7e, 0x6f, 0xf5 }, + { 0x22, 0x4f, 0xd6 }, + { 0x22, 0x6f, 0xf6 }, + { 0x2f, 0x4f, 0xd8 }, + { 0x2f, 0x6f, 0xf8 }, + { 0x60, 0x55, 0xd9 }, + { 0x60, 0x75, 0xf9 }, + { 0x27, 0x55, 0xda }, + { 0x27, 0x75, 0xfa }, + { 0x5e, 0x55, 0xdb }, + { 0x5e, 0x75, 0xfb }, + { 0x22, 0x55, 0xdc }, + { 0x22, 0x75, 0xfc }, + { 0x27, 0x59, 0xdd }, + { 0x27, 0x79, 0xfd }, + { 0x54, 0x48, 0xde }, + { 0x74, 0x68, 0xfe }, + { 0x73, 0x73, 0xdf }, + { 0x22, 0x79, 0xff }, + { 0x73, 0x7a, 0xdf }, + { 0x69, 0x6a, 0xff }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + { 0x00, 0x00, 0x00 }, + } +}; + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd_default_keymap.h b/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd_default_keymap.h new file mode 100644 index 000000000..0ed305020 --- /dev/null +++ b/Engine/lib/sdl/src/core/linux/SDL_evdev_kbd_default_keymap.h @@ -0,0 +1,4763 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +static unsigned short default_key_map_0[NR_KEYS] = { + 0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_1[NR_KEYS] = { + 0xf200, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_2[NR_KEYS] = { + 0xf200, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_3[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +#ifdef INCLUDE_EXTENDED_KEYMAP +static unsigned short default_key_map_4[NR_KEYS] = { + 0xf200, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_5[NR_KEYS] = { + 0xf200, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_6[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_7[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_8[NR_KEYS] = { + 0xf200, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_9[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_10[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_11[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_12[NR_KEYS] = { + 0xf200, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf11a, 0xf10c, 0xf10d, 0xf11b, 0xf11c, 0xf110, 0xf311, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, +}; +static unsigned short default_key_map_13[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_14[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_15[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_16[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_17[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_18[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_19[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_20[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_21[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_22[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_23[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_24[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_25[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_26[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_27[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_28[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_29[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_30[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_31[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_32[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_33[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_34[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_35[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_36[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_37[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_38[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_39[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_40[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_41[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_42[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_43[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_44[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_45[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_46[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_47[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_48[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_49[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_50[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_51[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_52[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_53[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_54[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_55[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_56[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_57[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_58[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_59[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_60[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_61[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_62[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_63[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_64[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_65[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_66[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_67[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_68[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_69[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_70[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_71[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_72[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_73[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_74[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_75[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_76[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_77[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_78[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_79[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_80[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_81[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_82[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_83[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_84[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_85[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_86[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_87[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_88[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_89[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_90[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_91[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_92[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_93[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_94[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_95[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_96[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_97[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_98[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_99[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_100[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_101[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_102[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_103[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_104[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_105[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_106[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_107[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_108[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_109[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_110[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_111[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_112[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_113[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, + 0xf111, 0xf112, 0xf113, 0xf11e, 0xf11f, 0xf208, 0xf203, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf03e, 0xf120, + 0xf121, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf200, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf20b, 0xf601, 0xf602, 0xf117, 0xf600, 0xf20a, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_114[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, + 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf07f, 0xf009, + 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55, 0xfb49, + 0xfb4f, 0xfb50, 0xf05b, 0xf05d, 0xf201, 0xf702, 0xfb41, 0xfb53, + 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c, 0xf03b, + 0xf027, 0xf060, 0xf700, 0xf05c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, + 0xfb42, 0xfb4e, 0xfb4d, 0xf02c, 0xf02e, 0xf02f, 0xf700, 0xf916, + 0xf703, 0xf020, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf202, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf07c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_115[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e, + 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf07f, 0xf009, + 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75, 0xfb69, + 0xfb6f, 0xfb70, 0xf07b, 0xf07d, 0xf201, 0xf702, 0xfb61, 0xfb73, + 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c, 0xf03a, + 0xf022, 0xf07e, 0xf700, 0xf07c, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, + 0xfb62, 0xfb6e, 0xfb6d, 0xf03c, 0xf03e, 0xf03f, 0xf700, 0xf30c, + 0xf703, 0xf020, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0x00a6, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_116[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, 0xf208, 0xf204, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf12c, + 0xf12d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_117[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, + 0xf133, 0xf134, 0xf135, 0xf136, 0xf137, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf138, + 0xf139, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_118[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf000, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf01c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_119[NR_KEYS] = { + 0xf27e, 0xf01b, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf01e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf008, 0xf009, + 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015, 0xf009, + 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf00d, 0xf702, 0xf001, 0xf013, + 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c, 0xf200, + 0xf200, 0xf01e, 0xf700, 0xf01c, 0xf01a, 0xf018, 0xf003, 0xf016, + 0xf002, 0xf00e, 0xf201, 0xf200, 0xf20e, 0xf07f, 0xf700, 0xf30c, + 0xf703, 0xf000, 0xfa06, 0xf518, 0xf519, 0xf51a, 0xf51b, 0xf51c, + 0xf51d, 0xf51e, 0xf51f, 0xf520, 0xf521, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf01c, 0xf522, + 0xf523, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf01c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf205, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_120[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf202, 0xf907, + 0xf908, 0xf909, 0xf30b, 0xf904, 0xf905, 0xf906, 0xf30a, 0xf901, + 0xf902, 0xf903, 0xf900, 0xf310, 0xf206, 0xf200, 0xf83c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf212, + 0xf118, 0xf210, 0xf211, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_121[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf916, + 0xf703, 0xf820, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf914, 0xf209, 0xf911, + 0xf912, 0xf913, 0xf917, 0xf90e, 0xf90f, 0xf910, 0xf918, 0xf90b, + 0xf90c, 0xf90d, 0xf90a, 0xf310, 0xf206, 0xf200, 0xf83e, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf919, 0xf702, 0xf915, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_122[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836, + 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf87f, 0xf809, + 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875, 0xf869, + 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, 0xf702, 0xf861, 0xf873, + 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf86c, 0xf83b, + 0xf827, 0xf860, 0xf700, 0xf85c, 0xf87a, 0xf878, 0xf863, 0xf876, + 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_123[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf821, 0xf840, 0xf823, 0xf824, 0xf825, 0xf85e, + 0xf826, 0xf82a, 0xf828, 0xf829, 0xf85f, 0xf82b, 0xf87f, 0xf809, + 0xf851, 0xf857, 0xf845, 0xf852, 0xf854, 0xf859, 0xf855, 0xf849, + 0xf84f, 0xf850, 0xf87b, 0xf87d, 0xf80d, 0xf702, 0xf841, 0xf853, + 0xf844, 0xf846, 0xf847, 0xf848, 0xf84a, 0xf84b, 0xf84c, 0xf83a, + 0xf822, 0xf87e, 0xf700, 0xf87c, 0xf85a, 0xf858, 0xf843, 0xf856, + 0xf842, 0xf84e, 0xf84d, 0xf83c, 0xf83e, 0xf83f, 0xf700, 0xf30c, + 0xf703, 0xf820, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf87c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf206, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_124[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, + 0xf505, 0xf506, 0xf507, 0xf508, 0xf509, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf50a, + 0xf50b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_125[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, + 0xf511, 0xf512, 0xf513, 0xf514, 0xf515, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf516, + 0xf517, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_126[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf800, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf20c, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf20c, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +static unsigned short default_key_map_127[NR_KEYS] = { + 0xf27e, 0xf81b, 0xf200, 0xf800, 0xf200, 0xf200, 0xf200, 0xf81e, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf81f, 0xf200, 0xf808, 0xf809, + 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815, 0xf809, + 0xf80f, 0xf810, 0xf81b, 0xf81d, 0xf80d, 0xf702, 0xf801, 0xf813, + 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c, 0xf200, + 0xf200, 0xf81e, 0xf700, 0xf81c, 0xf81a, 0xf818, 0xf803, 0xf816, + 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf20e, 0xf87f, 0xf700, 0xf30c, + 0xf703, 0xf800, 0xfa06, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, + 0xf105, 0xf106, 0xf107, 0xf108, 0xf109, 0xf208, 0xf209, 0xf307, + 0xf308, 0xf309, 0xf30b, 0xf304, 0xf305, 0xf306, 0xf30a, 0xf301, + 0xf302, 0xf303, 0xf300, 0xf310, 0xf206, 0xf200, 0xf81c, 0xf10a, + 0xf10b, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf30e, 0xf702, 0xf30d, 0xf81c, 0xf703, 0xf205, 0xf114, 0xf603, + 0xf118, 0xf601, 0xf602, 0xf117, 0xf600, 0xf119, 0xf115, 0xf116, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, + 0xf200, 0xf310, 0xf200, 0xf200, 0xf200, 0xf703, 0xf703, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, + 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, +}; +#endif /* INCLUDE_EXTENDED_KEYMAP */ + +static unsigned short *default_key_maps[MAX_NR_KEYMAPS] = { + default_key_map_0, + default_key_map_1, + default_key_map_2, + default_key_map_3, +#ifdef INCLUDE_EXTENDED_KEYMAP + default_key_map_4, + default_key_map_5, + default_key_map_6, + default_key_map_7, + default_key_map_8, + default_key_map_9, + default_key_map_10, + default_key_map_11, + default_key_map_12, + default_key_map_13, + default_key_map_14, + default_key_map_15, + default_key_map_16, + default_key_map_17, + default_key_map_18, + default_key_map_19, + default_key_map_20, + default_key_map_21, + default_key_map_22, + default_key_map_23, + default_key_map_24, + default_key_map_25, + default_key_map_26, + default_key_map_27, + default_key_map_28, + default_key_map_29, + default_key_map_30, + default_key_map_31, + default_key_map_32, + default_key_map_33, + default_key_map_34, + default_key_map_35, + default_key_map_36, + default_key_map_37, + default_key_map_38, + default_key_map_39, + default_key_map_40, + default_key_map_41, + default_key_map_42, + default_key_map_43, + default_key_map_44, + default_key_map_45, + default_key_map_46, + default_key_map_47, + default_key_map_48, + default_key_map_49, + default_key_map_50, + default_key_map_51, + default_key_map_52, + default_key_map_53, + default_key_map_54, + default_key_map_55, + default_key_map_56, + default_key_map_57, + default_key_map_58, + default_key_map_59, + default_key_map_60, + default_key_map_61, + default_key_map_62, + default_key_map_63, + default_key_map_64, + default_key_map_65, + default_key_map_66, + default_key_map_67, + default_key_map_68, + default_key_map_69, + default_key_map_70, + default_key_map_71, + default_key_map_72, + default_key_map_73, + default_key_map_74, + default_key_map_75, + default_key_map_76, + default_key_map_77, + default_key_map_78, + default_key_map_79, + default_key_map_80, + default_key_map_81, + default_key_map_82, + default_key_map_83, + default_key_map_84, + default_key_map_85, + default_key_map_86, + default_key_map_87, + default_key_map_88, + default_key_map_89, + default_key_map_90, + default_key_map_91, + default_key_map_92, + default_key_map_93, + default_key_map_94, + default_key_map_95, + default_key_map_96, + default_key_map_97, + default_key_map_98, + default_key_map_99, + default_key_map_100, + default_key_map_101, + default_key_map_102, + default_key_map_103, + default_key_map_104, + default_key_map_105, + default_key_map_106, + default_key_map_107, + default_key_map_108, + default_key_map_109, + default_key_map_110, + default_key_map_111, + default_key_map_112, + default_key_map_113, + default_key_map_114, + default_key_map_115, + default_key_map_116, + default_key_map_117, + default_key_map_118, + default_key_map_119, + default_key_map_120, + default_key_map_121, + default_key_map_122, + default_key_map_123, + default_key_map_124, + default_key_map_125, + default_key_map_126, + default_key_map_127, +#else /* !INCLUDE_EXTENDED_KEYMAP */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, +#endif /* INCLUDE_EXTENDED_KEYMAP */ + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, +}; + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_fcitx.c b/Engine/lib/sdl/src/core/linux/SDL_fcitx.c index 83d19e690..41954e92d 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_fcitx.c +++ b/Engine/lib/sdl/src/core/linux/SDL_fcitx.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -118,71 +118,6 @@ GetAppName() return SDL_strdup("SDL_App"); } -/* - * Copied from fcitx source - */ -#define CONT(i) ISUTF8_CB(in[i]) -#define VAL(i, s) ((in[i]&0x3f) << s) - -static char * -_fcitx_utf8_get_char(const char *i, uint32_t *chr) -{ - const unsigned char* in = (const unsigned char *)i; - if (!(in[0] & 0x80)) { - *(chr) = *(in); - return (char *)in + 1; - } - - /* 2-byte, 0x80-0x7ff */ - if ((in[0] & 0xe0) == 0xc0 && CONT(1)) { - *chr = ((in[0] & 0x1f) << 6) | VAL(1, 0); - return (char *)in + 2; - } - - /* 3-byte, 0x800-0xffff */ - if ((in[0] & 0xf0) == 0xe0 && CONT(1) && CONT(2)) { - *chr = ((in[0] & 0xf) << 12) | VAL(1, 6) | VAL(2, 0); - return (char *)in + 3; - } - - /* 4-byte, 0x10000-0x1FFFFF */ - if ((in[0] & 0xf8) == 0xf0 && CONT(1) && CONT(2) && CONT(3)) { - *chr = ((in[0] & 0x7) << 18) | VAL(1, 12) | VAL(2, 6) | VAL(3, 0); - return (char *)in + 4; - } - - /* 5-byte, 0x200000-0x3FFFFFF */ - if ((in[0] & 0xfc) == 0xf8 && CONT(1) && CONT(2) && CONT(3) && CONT(4)) { - *chr = ((in[0] & 0x3) << 24) | VAL(1, 18) | VAL(2, 12) | VAL(3, 6) | VAL(4, 0); - return (char *)in + 5; - } - - /* 6-byte, 0x400000-0x7FFFFFF */ - if ((in[0] & 0xfe) == 0xfc && CONT(1) && CONT(2) && CONT(3) && CONT(4) && CONT(5)) { - *chr = ((in[0] & 0x1) << 30) | VAL(1, 24) | VAL(2, 18) | VAL(3, 12) | VAL(4, 6) | VAL(5, 0); - return (char *)in + 6; - } - - *chr = *in; - - return (char *)in + 1; -} - -static size_t -_fcitx_utf8_strlen(const char *s) -{ - unsigned int l = 0; - - while (*s) { - uint32_t chr; - - s = _fcitx_utf8_get_char(s, &chr); - l++; - } - - return l; -} - static DBusHandlerResult DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) { @@ -214,8 +149,8 @@ DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) size_t cursor = 0; while (i < text_bytes) { - size_t sz = SDL_utf8strlcpy(buf, text + i, sizeof(buf)); - size_t chars = _fcitx_utf8_strlen(buf); + const size_t sz = SDL_utf8strlcpy(buf, text + i, sizeof(buf)); + const size_t chars = SDL_utf8strlen(buf); SDL_SendEditingText(buf, cursor, chars); @@ -231,116 +166,50 @@ DBus_MessageFilter(DBusConnection *conn, DBusMessage *msg, void *data) return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; } -static DBusMessage* -FcitxClientICNewMethod(FcitxClient *client, - const char *method) +static void +FcitxClientICCallMethod(FcitxClient *client, const char *method) { - SDL_DBusContext *dbus = client->dbus; - return dbus->message_new_method_call( - client->servicename, - client->icname, - FCITX_IC_DBUS_INTERFACE, - method); + SDL_DBus_CallVoidMethod(client->servicename, client->icname, FCITX_IC_DBUS_INTERFACE, method, DBUS_TYPE_INVALID); } -static void -FcitxClientICCallMethod(FcitxClient *client, - const char *method) -{ - SDL_DBusContext *dbus = client->dbus; - DBusMessage *msg = FcitxClientICNewMethod(client, method); - - if (msg == NULL) - return ; - - if (dbus->connection_send(dbus->session_conn, msg, NULL)) { - dbus->connection_flush(dbus->session_conn); - } - - dbus->message_unref(msg); -} - -static void +static void SDLCALL Fcitx_SetCapabilities(void *data, const char *name, const char *old_val, const char *internal_editing) { FcitxClient *client = (FcitxClient *)data; - SDL_DBusContext *dbus = client->dbus; Uint32 caps = CAPACITY_NONE; - DBusMessage *msg = FcitxClientICNewMethod(client, "SetCapacity"); - if (msg == NULL) - return ; - if (!(internal_editing && *internal_editing == '1')) { caps |= CAPACITY_PREEDIT; } - dbus->message_append_args(msg, - DBUS_TYPE_UINT32, &caps, - DBUS_TYPE_INVALID); - if (dbus->connection_send(dbus->session_conn, msg, NULL)) { - dbus->connection_flush(dbus->session_conn); - } - - dbus->message_unref(msg); + SDL_DBus_CallVoidMethod(client->servicename, client->icname, FCITX_IC_DBUS_INTERFACE, "SetCapacity", DBUS_TYPE_UINT32, &caps, DBUS_TYPE_INVALID); } -static void +static SDL_bool FcitxClientCreateIC(FcitxClient *client) { - char *appname = NULL; - pid_t pid = 0; - int id = 0; - SDL_bool enable; - Uint32 arg1, arg2, arg3, arg4; + char *appname = GetAppName(); + pid_t pid = getpid(); + int id = -1; + Uint32 enable, arg1, arg2, arg3, arg4; - SDL_DBusContext *dbus = client->dbus; - DBusMessage *reply = NULL; - DBusMessage *msg = dbus->message_new_method_call( - client->servicename, - FCITX_IM_DBUS_PATH, - FCITX_IM_DBUS_INTERFACE, - "CreateICv3" - ); + if (!SDL_DBus_CallMethod(client->servicename, FCITX_IM_DBUS_PATH, FCITX_IM_DBUS_INTERFACE, "CreateICv3", + DBUS_TYPE_STRING, &appname, DBUS_TYPE_INT32, &pid, DBUS_TYPE_INVALID, + DBUS_TYPE_INT32, &id, DBUS_TYPE_BOOLEAN, &enable, DBUS_TYPE_UINT32, &arg1, DBUS_TYPE_UINT32, &arg2, DBUS_TYPE_UINT32, &arg3, DBUS_TYPE_UINT32, &arg4, DBUS_TYPE_INVALID)) { + id = -1; /* just in case. */ + } - if (msg == NULL) - return ; + SDL_free(appname); - appname = GetAppName(); - pid = getpid(); - dbus->message_append_args(msg, - DBUS_TYPE_STRING, &appname, - DBUS_TYPE_INT32, &pid, - DBUS_TYPE_INVALID); + if (id >= 0) { + SDL_DBusContext *dbus = client->dbus; - do { - reply = dbus->connection_send_with_reply_and_block( - dbus->session_conn, - msg, - DBUS_TIMEOUT, - NULL); - - if (!reply) - break; - if (!dbus->message_get_args(reply, NULL, - DBUS_TYPE_INT32, &id, - DBUS_TYPE_BOOLEAN, &enable, - DBUS_TYPE_UINT32, &arg1, - DBUS_TYPE_UINT32, &arg2, - DBUS_TYPE_UINT32, &arg3, - DBUS_TYPE_UINT32, &arg4, - DBUS_TYPE_INVALID)) - break; - - if (id < 0) - break; client->id = id; - SDL_snprintf(client->icname, IC_NAME_MAX, - FCITX_IC_DBUS_PATH, client->id); + SDL_snprintf(client->icname, IC_NAME_MAX, FCITX_IC_DBUS_PATH, client->id); dbus->bus_add_match(dbus->session_conn, "type='signal', interface='org.fcitx.Fcitx.InputContext'", @@ -350,14 +219,11 @@ FcitxClientCreateIC(FcitxClient *client) NULL); dbus->connection_flush(dbus->session_conn); - SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, &Fcitx_SetCapabilities, client); + SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, Fcitx_SetCapabilities, client); + return SDL_TRUE; } - while (0); - if (reply) - dbus->message_unref(reply); - dbus->message_unref(msg); - SDL_free(appname); + return SDL_FALSE; } static Uint32 @@ -391,9 +257,7 @@ SDL_Fcitx_Init() "%s-%d", FCITX_DBUS_SERVICE, GetDisplayNumber()); - FcitxClientCreateIC(&fcitx_client); - - return SDL_TRUE; + return FcitxClientCreateIC(&fcitx_client); } void @@ -422,47 +286,21 @@ SDL_Fcitx_Reset(void) SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) { - DBusMessage *msg = NULL; - DBusMessage *reply = NULL; - SDL_DBusContext *dbus = fcitx_client.dbus; - - Uint32 state = 0; - SDL_bool handled = SDL_FALSE; + Uint32 state = Fcitx_ModState(); + Uint32 handled = SDL_FALSE; int type = FCITX_PRESS_KEY; Uint32 event_time = 0; - msg = FcitxClientICNewMethod(&fcitx_client, "ProcessKeyEvent"); - if (msg == NULL) - return SDL_FALSE; - - state = Fcitx_ModState(); - dbus->message_append_args(msg, - DBUS_TYPE_UINT32, &keysym, - DBUS_TYPE_UINT32, &keycode, - DBUS_TYPE_UINT32, &state, - DBUS_TYPE_INT32, &type, - DBUS_TYPE_UINT32, &event_time, - DBUS_TYPE_INVALID); - - reply = dbus->connection_send_with_reply_and_block(dbus->session_conn, - msg, - -1, - NULL); - - if (reply) { - dbus->message_get_args(reply, - NULL, - DBUS_TYPE_INT32, &handled, - DBUS_TYPE_INVALID); - - dbus->message_unref(reply); + if (SDL_DBus_CallMethod(fcitx_client.servicename, fcitx_client.icname, FCITX_IC_DBUS_INTERFACE, "ProcessKeyEvent", + DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &state, DBUS_TYPE_INT32, &type, DBUS_TYPE_UINT32, &event_time, DBUS_TYPE_INVALID, + DBUS_TYPE_INT32, &handled, DBUS_TYPE_INVALID)) { + if (handled) { + SDL_Fcitx_UpdateTextRect(NULL); + return SDL_TRUE; + } } - if (handled) { - SDL_Fcitx_UpdateTextRect(NULL); - } - - return handled; + return SDL_FALSE; } void @@ -473,10 +311,6 @@ SDL_Fcitx_UpdateTextRect(SDL_Rect *rect) int x = 0, y = 0; SDL_Rect *cursor = &fcitx_client.cursor_rect; - SDL_DBusContext *dbus = fcitx_client.dbus; - DBusMessage *msg = NULL; - DBusConnection *conn; - if (rect) { SDL_memcpy(cursor, rect, sizeof(SDL_Rect)); } @@ -506,7 +340,7 @@ SDL_Fcitx_UpdateTextRect(SDL_Rect *rect) #endif if (cursor->x == -1 && cursor->y == -1 && cursor->w == 0 && cursor->h == 0) { - // move to bottom left + /* move to bottom left */ int w = 0, h = 0; SDL_GetWindowSize(focused_win, &w, &h); cursor->x = 0; @@ -516,26 +350,12 @@ SDL_Fcitx_UpdateTextRect(SDL_Rect *rect) x += cursor->x; y += cursor->y; - msg = FcitxClientICNewMethod(&fcitx_client, "SetCursorRect"); - if (msg == NULL) - return ; - - dbus->message_append_args(msg, - DBUS_TYPE_INT32, &x, - DBUS_TYPE_INT32, &y, - DBUS_TYPE_INT32, &cursor->w, - DBUS_TYPE_INT32, &cursor->h, - DBUS_TYPE_INVALID); - - conn = dbus->session_conn; - if (dbus->connection_send(conn, msg, NULL)) - dbus->connection_flush(conn); - - dbus->message_unref(msg); + SDL_DBus_CallVoidMethod(fcitx_client.servicename, fcitx_client.icname, FCITX_IC_DBUS_INTERFACE, "SetCursorRect", + DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_INT32, &cursor->w, DBUS_TYPE_INT32, &cursor->h, DBUS_TYPE_INVALID); } void -SDL_Fcitx_PumpEvents() +SDL_Fcitx_PumpEvents(void) { SDL_DBusContext *dbus = fcitx_client.dbus; DBusConnection *conn = dbus->session_conn; diff --git a/Engine/lib/sdl/src/core/linux/SDL_fcitx.h b/Engine/lib/sdl/src/core/linux/SDL_fcitx.h index 64020475c..9407cd93d 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_fcitx.h +++ b/Engine/lib/sdl/src/core/linux/SDL_fcitx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_fcitx_h -#define _SDL_fcitx_h +#ifndef SDL_fcitx_h_ +#define SDL_fcitx_h_ #include "../../SDL_internal.h" @@ -33,8 +33,8 @@ extern void SDL_Fcitx_SetFocus(SDL_bool focused); extern void SDL_Fcitx_Reset(void); extern SDL_bool SDL_Fcitx_ProcessKeyEvent(Uint32 keysym, Uint32 keycode); extern void SDL_Fcitx_UpdateTextRect(SDL_Rect *rect); -extern void SDL_Fcitx_PumpEvents(); +extern void SDL_Fcitx_PumpEvents(void); -#endif /* _SDL_fcitx_h */ +#endif /* SDL_fcitx_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_ibus.c b/Engine/lib/sdl/src/core/linux/SDL_ibus.c index 3d63b8b30..a9c319716 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_ibus.c +++ b/Engine/lib/sdl/src/core/linux/SDL_ibus.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,7 +45,7 @@ static char *input_ctx_path = NULL; static SDL_Rect ibus_cursor_rect = { 0, 0, 0, 0 }; static DBusConnection *ibus_conn = NULL; static char *ibus_addr_file = NULL; -int inotify_fd = -1, inotify_wd = -1; +static int inotify_fd = -1, inotify_wd = -1; static Uint32 IBus_ModState(void) @@ -107,21 +107,6 @@ IBus_GetVariantText(DBusConnection *conn, DBusMessageIter *iter, SDL_DBusContext return text; } -static size_t -IBus_utf8_strlen(const char *str) -{ - size_t utf8_len = 0; - const char *p; - - for (p = str; *p; ++p) { - if (!((*p & 0x80) && !(*p & 0x40))) { - ++utf8_len; - } - } - - return utf8_len; -} - static DBusHandlerResult IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data) { @@ -135,7 +120,7 @@ IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data) text = IBus_GetVariantText(conn, &iter, dbus); if (text && *text) { - char buf[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; + char buf[SDL_TEXTINPUTEVENT_TEXT_SIZE]; size_t text_bytes = SDL_strlen(text), i = 0; while (i < text_bytes) { @@ -162,8 +147,8 @@ IBus_MessageHandler(DBusConnection *conn, DBusMessage *msg, void *user_data) size_t cursor = 0; do { - size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); - size_t chars = IBus_utf8_strlen(buf); + const size_t sz = SDL_utf8strlcpy(buf, text+i, sizeof(buf)); + const size_t chars = SDL_utf8strlen(buf); SDL_SendEditingText(buf, cursor, chars); @@ -302,35 +287,20 @@ IBus_GetDBusAddressFilename(void) static SDL_bool IBus_CheckConnection(SDL_DBusContext *dbus); -static void +static void SDLCALL IBus_SetCapabilities(void *data, const char *name, const char *old_val, const char *internal_editing) { SDL_DBusContext *dbus = SDL_DBus_GetContext(); if (IBus_CheckConnection(dbus)) { + Uint32 caps = IBUS_CAP_FOCUS; + if (!(internal_editing && *internal_editing == '1')) { + caps |= IBUS_CAP_PREEDIT_TEXT; + } - DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE, - input_ctx_path, - IBUS_INPUT_INTERFACE, - "SetCapabilities"); - if (msg) { - Uint32 caps = IBUS_CAP_FOCUS; - if (!(internal_editing && *internal_editing == '1')) { - caps |= IBUS_CAP_PREEDIT_TEXT; - } - - dbus->message_append_args(msg, - DBUS_TYPE_UINT32, &caps, - DBUS_TYPE_INVALID); - } - - if (msg) { - if (dbus->connection_send(ibus_conn, msg, NULL)) { - dbus->connection_flush(ibus_conn); - } - dbus->message_unref(msg); - } + SDL_DBus_CallVoidMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "SetCapabilities", + DBUS_TYPE_UINT32, &caps, DBUS_TYPE_INVALID); } } @@ -338,9 +308,9 @@ IBus_SetCapabilities(void *data, const char *name, const char *old_val, static SDL_bool IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr) { + const char *client_name = "SDL2_Application"; const char *path = NULL; SDL_bool result = SDL_FALSE; - DBusMessage *msg; DBusObjectPathVTable ibus_vtable; SDL_zero(ibus_vtable); @@ -361,39 +331,17 @@ IBus_SetupConnection(SDL_DBusContext *dbus, const char* addr) dbus->connection_flush(ibus_conn); - msg = dbus->message_new_method_call(IBUS_SERVICE, IBUS_PATH, IBUS_INTERFACE, "CreateInputContext"); - if (msg) { - const char *client_name = "SDL2_Application"; - dbus->message_append_args(msg, - DBUS_TYPE_STRING, &client_name, - DBUS_TYPE_INVALID); - } - - if (msg) { - DBusMessage *reply; - - reply = dbus->connection_send_with_reply_and_block(ibus_conn, msg, 1000, NULL); - if (reply) { - if (dbus->message_get_args(reply, NULL, - DBUS_TYPE_OBJECT_PATH, &path, - DBUS_TYPE_INVALID)) { - if (input_ctx_path) { - SDL_free(input_ctx_path); - } - input_ctx_path = SDL_strdup(path); - result = SDL_TRUE; - } - dbus->message_unref(reply); - } - dbus->message_unref(msg); - } - - if (result) { - SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, &IBus_SetCapabilities, NULL); + if (SDL_DBus_CallMethodOnConnection(ibus_conn, IBUS_SERVICE, IBUS_PATH, IBUS_INTERFACE, "CreateInputContext", + DBUS_TYPE_STRING, &client_name, DBUS_TYPE_INVALID, + DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_INVALID)) { + SDL_free(input_ctx_path); + input_ctx_path = SDL_strdup(path); + SDL_AddHintCallback(SDL_HINT_IME_INTERNAL_EDITING, IBus_SetCapabilities, NULL); dbus->bus_add_match(ibus_conn, "type='signal',interface='org.freedesktop.IBus.InputContext'", NULL); dbus->connection_try_register_object_path(ibus_conn, input_ctx_path, &ibus_vtable, dbus, NULL); dbus->connection_flush(ibus_conn); + result = SDL_TRUE; } SDL_IBus_SetFocus(SDL_GetKeyboardFocus() != NULL); @@ -521,7 +469,7 @@ SDL_IBus_Quit(void) inotify_wd = -1; } - SDL_DelHintCallback(SDL_HINT_IME_INTERNAL_EDITING, &IBus_SetCapabilities, NULL); + SDL_DelHintCallback(SDL_HINT_IME_INTERNAL_EDITING, IBus_SetCapabilities, NULL); SDL_memset(&ibus_cursor_rect, 0, sizeof(ibus_cursor_rect)); } @@ -532,16 +480,7 @@ IBus_SimpleMessage(const char *method) SDL_DBusContext *dbus = SDL_DBus_GetContext(); if (IBus_CheckConnection(dbus)) { - DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE, - input_ctx_path, - IBUS_INPUT_INTERFACE, - method); - if (msg) { - if (dbus->connection_send(ibus_conn, msg, NULL)) { - dbus->connection_flush(ibus_conn); - } - dbus->message_unref(msg); - } + SDL_DBus_CallVoidMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, method, DBUS_TYPE_INVALID); } } @@ -561,43 +500,21 @@ SDL_IBus_Reset(void) SDL_bool SDL_IBus_ProcessKeyEvent(Uint32 keysym, Uint32 keycode) { - SDL_bool result = SDL_FALSE; + Uint32 result = 0; SDL_DBusContext *dbus = SDL_DBus_GetContext(); if (IBus_CheckConnection(dbus)) { - DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE, - input_ctx_path, - IBUS_INPUT_INTERFACE, - "ProcessKeyEvent"); - if (msg) { - Uint32 mods = IBus_ModState(); - dbus->message_append_args(msg, - DBUS_TYPE_UINT32, &keysym, - DBUS_TYPE_UINT32, &keycode, - DBUS_TYPE_UINT32, &mods, - DBUS_TYPE_INVALID); + Uint32 mods = IBus_ModState(); + if (!SDL_DBus_CallMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "ProcessKeyEvent", + DBUS_TYPE_UINT32, &keysym, DBUS_TYPE_UINT32, &keycode, DBUS_TYPE_UINT32, &mods, DBUS_TYPE_INVALID, + DBUS_TYPE_BOOLEAN, &result, DBUS_TYPE_INVALID)) { + result = 0; } - - if (msg) { - DBusMessage *reply; - - reply = dbus->connection_send_with_reply_and_block(ibus_conn, msg, 300, NULL); - if (reply) { - if (!dbus->message_get_args(reply, NULL, - DBUS_TYPE_BOOLEAN, &result, - DBUS_TYPE_INVALID)) { - result = SDL_FALSE; - } - dbus->message_unref(reply); - } - dbus->message_unref(msg); - } - } SDL_IBus_UpdateTextRect(NULL); - return result; + return result ? SDL_TRUE : SDL_FALSE; } void @@ -643,25 +560,8 @@ SDL_IBus_UpdateTextRect(SDL_Rect *rect) dbus = SDL_DBus_GetContext(); if (IBus_CheckConnection(dbus)) { - DBusMessage *msg = dbus->message_new_method_call(IBUS_SERVICE, - input_ctx_path, - IBUS_INPUT_INTERFACE, - "SetCursorLocation"); - if (msg) { - dbus->message_append_args(msg, - DBUS_TYPE_INT32, &x, - DBUS_TYPE_INT32, &y, - DBUS_TYPE_INT32, &ibus_cursor_rect.w, - DBUS_TYPE_INT32, &ibus_cursor_rect.h, - DBUS_TYPE_INVALID); - } - - if (msg) { - if (dbus->connection_send(ibus_conn, msg, NULL)) { - dbus->connection_flush(ibus_conn); - } - dbus->message_unref(msg); - } + SDL_DBus_CallVoidMethodOnConnection(ibus_conn, IBUS_SERVICE, input_ctx_path, IBUS_INPUT_INTERFACE, "SetCursorLocation", + DBUS_TYPE_INT32, &x, DBUS_TYPE_INT32, &y, DBUS_TYPE_INT32, &ibus_cursor_rect.w, DBUS_TYPE_INT32, &ibus_cursor_rect.h, DBUS_TYPE_INVALID); } } @@ -680,3 +580,5 @@ SDL_IBus_PumpEvents(void) } #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_ibus.h b/Engine/lib/sdl/src/core/linux/SDL_ibus.h index 5ee7a8e40..d533ff72c 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_ibus.h +++ b/Engine/lib/sdl/src/core/linux/SDL_ibus.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_ibus_h -#define _SDL_ibus_h +#ifndef SDL_ibus_h_ +#define SDL_ibus_h_ #ifdef HAVE_IBUS_IBUS_H #define SDL_USE_IBUS 1 @@ -49,10 +49,10 @@ extern void SDL_IBus_UpdateTextRect(SDL_Rect *window_relative_rect); /* Checks DBus for new IBus events, and calls SDL_SendKeyboardText / SDL_SendEditingText for each event it finds */ -extern void SDL_IBus_PumpEvents(); +extern void SDL_IBus_PumpEvents(void); #endif /* HAVE_IBUS_IBUS_H */ -#endif /* _SDL_ibus_h */ +#endif /* SDL_ibus_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_ime.c b/Engine/lib/sdl/src/core/linux/SDL_ime.c index 049bd6e02..29b0182f3 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_ime.c +++ b/Engine/lib/sdl/src/core/linux/SDL_ime.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -87,8 +87,20 @@ SDL_IME_Init(void) { InitIME(); - if (SDL_IME_Init_Real) - return SDL_IME_Init_Real(); + if (SDL_IME_Init_Real) { + if (SDL_IME_Init_Real()) { + return SDL_TRUE; + } + + /* uhoh, the IME implementation's init failed! Disable IME support. */ + SDL_IME_Init_Real = NULL; + SDL_IME_Quit_Real = NULL; + SDL_IME_SetFocus_Real = NULL; + SDL_IME_Reset_Real = NULL; + SDL_IME_ProcessKeyEvent_Real = NULL; + SDL_IME_UpdateTextRect_Real = NULL; + SDL_IME_PumpEvents_Real = NULL; + } return SDL_FALSE; } @@ -136,3 +148,5 @@ SDL_IME_PumpEvents() if (SDL_IME_PumpEvents_Real) SDL_IME_PumpEvents_Real(); } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_ime.h b/Engine/lib/sdl/src/core/linux/SDL_ime.h index 22b31de39..e39839c62 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_ime.h +++ b/Engine/lib/sdl/src/core/linux/SDL_ime.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,20 +19,22 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_ime_h -#define _SDL_ime_h +#ifndef SDL_ime_h_ +#define SDL_ime_h_ #include "../../SDL_internal.h" #include "SDL_stdinc.h" #include "SDL_rect.h" -extern SDL_bool SDL_IME_Init(); -extern void SDL_IME_Quit(); +extern SDL_bool SDL_IME_Init(void); +extern void SDL_IME_Quit(void); extern void SDL_IME_SetFocus(SDL_bool focused); -extern void SDL_IME_Reset(); +extern void SDL_IME_Reset(void); extern SDL_bool SDL_IME_ProcessKeyEvent(Uint32 keysym, Uint32 keycode); extern void SDL_IME_UpdateTextRect(SDL_Rect *rect); -extern void SDL_IME_PumpEvents(); +extern void SDL_IME_PumpEvents(void); -#endif /* _SDL_ime_h */ +#endif /* SDL_ime_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_udev.c b/Engine/lib/sdl/src/core/linux/SDL_udev.c index ae78ddd68..dfbeb790a 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_udev.c +++ b/Engine/lib/sdl/src/core/linux/SDL_udev.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,9 +31,12 @@ #include -#include "SDL.h" +#include "SDL_assert.h" +#include "SDL_loadso.h" +#include "SDL_timer.h" +#include "../unix/SDL_poll.h" -static const char* SDL_UDEV_LIBS[] = { "libudev.so.1", "libudev.so.0" }; +static const char *SDL_UDEV_LIBS[] = { "libudev.so.1", "libudev.so.0" }; #define _THIS SDL_UDEV_PrivateData *_this static _THIS = NULL; @@ -98,14 +101,7 @@ SDL_UDEV_hotplug_update_available(void) { if (_this->udev_mon != NULL) { const int fd = _this->udev_monitor_get_fd(_this->udev_mon); - fd_set fds; - struct timeval tv; - - FD_ZERO(&fds); - FD_SET(fd, &fds); - tv.tv_sec = 0; - tv.tv_usec = 0; - if ((select(fd+1, &fds, NULL, NULL, &tv) > 0) && (FD_ISSET(fd, &fds))) { + if (SDL_IOReady(fd, SDL_FALSE, 0)) { return SDL_TRUE; } } @@ -209,7 +205,7 @@ SDL_UDEV_Scan(void) enumerate = _this->udev_enumerate_new(_this->udev); if (enumerate == NULL) { SDL_UDEV_Quit(); - SDL_SetError("udev_monitor_new_from_netlink() failed"); + SDL_SetError("udev_enumerate_new() failed"); return; } @@ -252,8 +248,25 @@ SDL_UDEV_LoadLibrary(void) if (_this == NULL) { return SDL_SetError("UDEV not initialized"); } - - + + /* See if there is a udev library already loaded */ + if (SDL_UDEV_load_syms() == 0) { + return 0; + } + +#ifdef SDL_UDEV_DYNAMIC + /* Check for the build environment's libudev first */ + if (_this->udev_handle == NULL) { + _this->udev_handle = SDL_LoadObject(SDL_UDEV_DYNAMIC); + if (_this->udev_handle != NULL) { + retval = SDL_UDEV_load_syms(); + if (retval < 0) { + SDL_UDEV_UnloadLibrary(); + } + } + } +#endif + if (_this->udev_handle == NULL) { for( i = 0 ; i < SDL_arraysize(SDL_UDEV_LIBS); i++) { _this->udev_handle = SDL_LoadObject(SDL_UDEV_LIBS[i]); @@ -280,7 +293,6 @@ SDL_UDEV_LoadLibrary(void) #define BITS_PER_LONG (sizeof(unsigned long) * 8) #define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) #define OFF(x) ((x)%BITS_PER_LONG) -#define BIT(x) (1UL<> OFF(bit)) & 1) @@ -537,3 +549,5 @@ SDL_UDEV_DelCallback(SDL_UDEV_Callback cb) #endif /* SDL_USE_LIBUDEV */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/linux/SDL_udev.h b/Engine/lib/sdl/src/core/linux/SDL_udev.h index 9ffbb3252..edf51870b 100644 --- a/Engine/lib/sdl/src/core/linux/SDL_udev.h +++ b/Engine/lib/sdl/src/core/linux/SDL_udev.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_udev_h -#define _SDL_udev_h +#ifndef SDL_udev_h_ +#define SDL_udev_h_ #if HAVE_LIBUDEV_H @@ -116,4 +116,6 @@ extern void SDL_UDEV_DelCallback(SDL_UDEV_Callback cb); #endif /* HAVE_LIBUDEV_H */ -#endif /* _SDL_udev_h */ +#endif /* SDL_udev_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/unix/SDL_poll.c b/Engine/lib/sdl/src/core/unix/SDL_poll.c new file mode 100644 index 000000000..5ac6d0b60 --- /dev/null +++ b/Engine/lib/sdl/src/core/unix/SDL_poll.c @@ -0,0 +1,87 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#include "SDL_assert.h" +#include "SDL_poll.h" + +#ifdef HAVE_POLL +#include +#else +#include +#include +#include +#endif +#include + + +int +SDL_IOReady(int fd, SDL_bool forWrite, int timeoutMS) +{ + int result; + + /* Note: We don't bother to account for elapsed time if we get EINTR */ + do + { +#ifdef HAVE_POLL + struct pollfd info; + + info.fd = fd; + if (forWrite) { + info.events = POLLOUT; + } else { + info.events = POLLIN | POLLPRI; + } + result = poll(&info, 1, timeoutMS); +#else + fd_set rfdset, *rfdp = NULL; + fd_set wfdset, *wfdp = NULL; + struct timeval tv, *tvp = NULL; + + /* If this assert triggers we'll corrupt memory here */ + SDL_assert(fd >= 0 && fd < FD_SETSIZE); + + if (forWrite) { + FD_ZERO(&wfdset); + FD_SET(fd, &wfdset); + wfdp = &wfdset; + } else { + FD_ZERO(&rfdset); + FD_SET(fd, &rfdset); + rfdp = &rfdset; + } + + if (timeoutMS >= 0) { + tv.tv_sec = timeoutMS / 1000; + tv.tv_usec = (timeoutMS % 1000) * 1000; + tvp = &tv; + } + + result = select(fd + 1, rfdp, wfdp, NULL, tvp); +#endif /* HAVE_POLL */ + + } while ( result < 0 && errno == EINTR ); + + return result; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/unix/SDL_poll.h b/Engine/lib/sdl/src/core/unix/SDL_poll.h new file mode 100644 index 000000000..bf20e23d9 --- /dev/null +++ b/Engine/lib/sdl/src/core/unix/SDL_poll.h @@ -0,0 +1,34 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifndef SDL_poll_h_ +#define SDL_poll_h_ + +#include "SDL_stdinc.h" + + +extern int SDL_IOReady(int fd, SDL_bool forWrite, int timeoutMS); + +#endif /* SDL_poll_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/windows/SDL_directx.h b/Engine/lib/sdl/src/core/windows/SDL_directx.h index 0533f61ed..7fe826fab 100644 --- a/Engine/lib/sdl/src/core/windows/SDL_directx.h +++ b/Engine/lib/sdl/src/core/windows/SDL_directx.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_directx_h -#define _SDL_directx_h +#ifndef SDL_directx_h_ +#define SDL_directx_h_ /* Include all of the DirectX 8.0 headers and adds any necessary tweaks */ @@ -106,6 +106,6 @@ typedef struct { int unused; } DIDEVICEINSTANCE; #endif -#endif /* _SDL_directx_h */ +#endif /* SDL_directx_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/windows/SDL_windows.c b/Engine/lib/sdl/src/core/windows/SDL_windows.c index 6433fe26f..66240435f 100644 --- a/Engine/lib/sdl/src/core/windows/SDL_windows.c +++ b/Engine/lib/sdl/src/core/windows/SDL_windows.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,7 +33,7 @@ #endif -/* Sets an error message based on GetLastError() */ +/* Sets an error message based on an HRESULT */ int WIN_SetErrorFromHRESULT(const char *prefix, HRESULT hr) { @@ -115,7 +115,7 @@ IsWindowsVersionOrGreater(WORD wMajorVersion, WORD wMinorVersion, WORD wServiceP } #endif -BOOL WIN_IsWindowsVistaOrGreater() +BOOL WIN_IsWindowsVistaOrGreater(void) { #ifdef __WINRT__ return TRUE; @@ -124,6 +124,15 @@ BOOL WIN_IsWindowsVistaOrGreater() #endif } +BOOL WIN_IsWindows7OrGreater(void) +{ +#ifdef __WINRT__ + return TRUE; +#else + return IsWindowsVersionOrGreater(HIBYTE(_WIN32_WINNT_WIN7), LOBYTE(_WIN32_WINNT_WIN7), 0); +#endif +} + /* WAVExxxCAPS gives you 31 bytes for the device name, and just truncates if it's longer. However, since WinXP, you can use the WAVExxxCAPS2 structure, which @@ -142,6 +151,8 @@ Registry, and a unhelpful "Microphone(Yeti Stereo Microph" in winmm. Sigh. (Also, DirectSound shouldn't be limited to 32 chars, but its device enum has the same problem.) + +WASAPI doesn't need this. This is just for DirectSound/WinMM. */ char * WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid) @@ -158,7 +169,7 @@ WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid) DWORD len = 0; char *retval = NULL; - if (SDL_memcmp(guid, &nullguid, sizeof (*guid)) == 0) { + if (WIN_IsEqualGUID(guid, &nullguid)) { return WIN_StringToUTF8(name); /* No GUID, go with what we've got. */ } @@ -202,6 +213,18 @@ WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid) #endif /* if __WINRT__ / else */ } +BOOL +WIN_IsEqualGUID(const GUID * a, const GUID * b) +{ + return (SDL_memcmp(a, b, sizeof (*a)) == 0); +} + +BOOL +WIN_IsEqualIID(REFIID a, REFIID b) +{ + return (SDL_memcmp(a, b, sizeof (*a)) == 0); +} + #endif /* __WIN32__ || __WINRT__ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/windows/SDL_windows.h b/Engine/lib/sdl/src/core/windows/SDL_windows.h index 0f67e4be5..4a3336ad8 100644 --- a/Engine/lib/sdl/src/core/windows/SDL_windows.h +++ b/Engine/lib/sdl/src/core/windows/SDL_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,6 +35,7 @@ #endif #include +#include /* for REFIID with broken mingw.org headers */ /* Routines to convert from UTF8 to native Windows text */ #if UNICODE @@ -57,11 +58,18 @@ extern HRESULT WIN_CoInitialize(void); extern void WIN_CoUninitialize(void); /* Returns SDL_TRUE if we're running on Windows Vista and newer */ -extern BOOL WIN_IsWindowsVistaOrGreater(); +extern BOOL WIN_IsWindowsVistaOrGreater(void); + +/* Returns SDL_TRUE if we're running on Windows 7 and newer */ +extern BOOL WIN_IsWindows7OrGreater(void); /* You need to SDL_free() the result of this call. */ extern char *WIN_LookupAudioDeviceName(const WCHAR *name, const GUID *guid); +/* Checks to see if two GUID are the same. */ +extern BOOL WIN_IsEqualGUID(const GUID * a, const GUID * b); +extern BOOL WIN_IsEqualIID(REFIID a, REFIID b); + #endif /* _INCLUDED_WINDOWS_H */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/windows/SDL_xinput.c b/Engine/lib/sdl/src/core/windows/SDL_xinput.c index 355cd8343..75bf60003 100644 --- a/Engine/lib/sdl/src/core/windows/SDL_xinput.c +++ b/Engine/lib/sdl/src/core/windows/SDL_xinput.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/core/windows/SDL_xinput.h b/Engine/lib/sdl/src/core/windows/SDL_xinput.h index 67f8fdc1f..6106c2b05 100644 --- a/Engine/lib/sdl/src/core/windows/SDL_xinput.h +++ b/Engine/lib/sdl/src/core/windows/SDL_xinput.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_xinput_h -#define _SDL_xinput_h +#ifndef SDL_xinput_h_ +#define SDL_xinput_h_ #ifdef HAVE_XINPUT_H @@ -100,6 +100,8 @@ #endif /* typedef's for XInput structs we use */ + +#ifndef HAVE_XINPUT_GAMEPAD_EX typedef struct { WORD wButtons; @@ -111,12 +113,15 @@ typedef struct SHORT sThumbRY; DWORD dwPaddingReserved; } XINPUT_GAMEPAD_EX; +#endif +#ifndef HAVE_XINPUT_STATE_EX typedef struct { DWORD dwPacketNumber; XINPUT_GAMEPAD_EX Gamepad; } XINPUT_STATE_EX; +#endif typedef struct { @@ -167,6 +172,6 @@ extern DWORD SDL_XInputVersion; /* ((major << 16) & 0xFF00) | (minor & 0xFF) */ #endif /* HAVE_XINPUT_H */ -#endif /* _SDL_xinput_h */ +#endif /* SDL_xinput_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_common.cpp b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_common.cpp index 265aa942e..887b47eaa 100644 --- a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_common.cpp +++ b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_common.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,8 @@ #include "SDL_winrtapp_direct3d.h" #include "SDL_winrtapp_xaml.h" +#include + int (*WINRT_SDLAppEntryPoint)(int, char **) = NULL; extern "C" DECLSPEC int @@ -32,6 +34,33 @@ SDL_WinRTRunApp(int (*mainFunction)(int, char **), void * xamlBackgroundPanel) if (xamlBackgroundPanel) { return SDL_WinRTInitXAMLApp(mainFunction, xamlBackgroundPanel); } else { + if (FAILED(Windows::Foundation::Initialize(RO_INIT_MULTITHREADED))) { + return 1; + } return SDL_WinRTInitNonXAMLApp(mainFunction); } } + + +extern "C" DECLSPEC SDL_WinRT_DeviceFamily +SDL_WinRTGetDeviceFamily() +{ +#if NTDDI_VERSION >= NTDDI_WIN10 /* !!! FIXME: I have no idea if this is the right test. This is a UWP API, I think. Older windows should...just return "mobile"? I don't know. --ryan. */ + Platform::String^ deviceFamily = Windows::System::Profile::AnalyticsInfo::VersionInfo->DeviceFamily; + + if (deviceFamily->Equals("Windows.Desktop")) + { + return SDL_WINRT_DEVICEFAMILY_DESKTOP; + } + else if (deviceFamily->Equals("Windows.Mobile")) + { + return SDL_WINRT_DEVICEFAMILY_MOBILE; + } + else if (deviceFamily->Equals("Windows.Xbox")) + { + return SDL_WINRT_DEVICEFAMILY_XBOX; + } +#endif + + return SDL_WINRT_DEVICEFAMILY_UNKNOWN; +} \ No newline at end of file diff --git a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_common.h b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_common.h index e87a0b6b6..d68704c06 100644 --- a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_common.h +++ b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_common.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,12 @@ */ #include "SDL_config.h" -#ifndef _SDL_winrtapp_common_h -#define _SDL_winrtapp_common_h +#ifndef SDL_winrtapp_common_h_ +#define SDL_winrtapp_common_h_ /* A pointer to the app's C-style main() function (which is a different function than the WinRT app's actual entry point). */ extern int (*WINRT_SDLAppEntryPoint)(int, char **); -#endif // ifndef _SDL_winrtapp_common_h +#endif // SDL_winrtapp_common_h_ diff --git a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_direct3d.cpp b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_direct3d.cpp index e4ffadaad..6fa0bea79 100644 --- a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_direct3d.cpp +++ b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_direct3d.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -47,7 +47,6 @@ using namespace Windows::Phone::UI::Input; /* SDL includes */ extern "C" { -#include "../../SDL_internal.h" #include "SDL_assert.h" #include "SDL_events.h" #include "SDL_hints.h" @@ -122,7 +121,8 @@ int SDL_WinRTInitNonXAMLApp(int (*mainFunction)(int, char **)) return 0; } -static void WINRT_SetDisplayOrientationsPreference(void *userdata, const char *name, const char *oldValue, const char *newValue) +static void SDLCALL +WINRT_SetDisplayOrientationsPreference(void *userdata, const char *name, const char *oldValue, const char *newValue) { SDL_assert(SDL_strcmp(name, SDL_HINT_ORIENTATIONS) == 0); @@ -827,7 +827,7 @@ static void WINRT_OnBackButtonPressed(BackButtonEventArgs ^ args) } } -#if NTDDI_VERSION == NTDDI_WIN10 +#if NTDDI_VERSION >= NTDDI_WIN10 void SDL_WinRTApp::OnBackButtonPressed(Platform::Object^ sender, Windows::UI::Core::BackRequestedEventArgs^ args) { diff --git a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_direct3d.h b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_direct3d.h index 4b48115f0..7f5259268 100644 --- a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_direct3d.h +++ b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_direct3d.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_xaml.cpp b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_xaml.cpp index 201e3b6c2..9789d036f 100644 --- a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_xaml.cpp +++ b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_xaml.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_xaml.h b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_xaml.h index a08b67c40..85b430587 100644 --- a/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_xaml.h +++ b/Engine/lib/sdl/src/core/winrt/SDL_winrtapp_xaml.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "SDL_config.h" -#ifndef _SDL_winrtapp_xaml_h -#define _SDL_winrtapp_xaml_h +#ifndef SDL_winrtapp_xaml_h_ +#define SDL_winrtapp_xaml_h_ #include "SDL_stdinc.h" @@ -30,4 +30,4 @@ extern SDL_bool WINRT_XAMLWasEnabled; extern int SDL_WinRTInitXAMLApp(int (*mainFunction)(int, char **), void * backgroundPanelAsIInspectable); #endif // ifdef __cplusplus -#endif // ifndef _SDL_winrtapp_xaml_h +#endif // SDL_winrtapp_xaml_h_ diff --git a/Engine/lib/sdl/src/cpuinfo/SDL_cpuinfo.c b/Engine/lib/sdl/src/cpuinfo/SDL_cpuinfo.c index c4c55be39..4e2c0f101 100644 --- a/Engine/lib/sdl/src/cpuinfo/SDL_cpuinfo.c +++ b/Engine/lib/sdl/src/cpuinfo/SDL_cpuinfo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,6 +27,13 @@ #if defined(__WIN32__) #include "../core/windows/SDL_windows.h" #endif +#if defined(__OS2__) +#define INCL_DOS +#include +#ifndef QSV_NUMPROCESSORS +#define QSV_NUMPROCESSORS 26 +#endif +#endif /* CPU feature detection for SDL */ @@ -50,6 +57,25 @@ #include #endif +#if defined(__QNXNTO__) +#include +#endif + +#if (defined(__LINUX__) || defined(__ANDROID__)) && defined(__ARM_ARCH) +/*#include */ +#ifndef AT_HWCAP +#define AT_HWCAP 16 +#endif +#ifndef HWCAP_NEON +#define HWCAP_NEON (1 << 12) +#endif +#if defined HAVE_GETAUXVAL +#include +#else +#include +#endif +#endif + #define CPU_HAS_RDTSC 0x00000001 #define CPU_HAS_ALTIVEC 0x00000002 #define CPU_HAS_MMX 0x00000004 @@ -61,6 +87,7 @@ #define CPU_HAS_SSE42 0x00000200 #define CPU_HAS_AVX 0x00000400 #define CPU_HAS_AVX2 0x00000800 +#define CPU_HAS_NEON 0x00001000 #if SDL_ALTIVEC_BLITTERS && HAVE_SETJMP && !__MACOSX__ && !__OpenBSD__ /* This is the brute force way of detecting instruction sets... @@ -78,6 +105,7 @@ static int CPU_haveCPUID(void) { int has_CPUID = 0; + /* *INDENT-OFF* */ #ifndef SDL_CPUINFO_DISABLED #if defined(__GNUC__) && defined(i386) @@ -212,62 +240,50 @@ done: } #else #define cpuid(func, a, b, c, d) \ - a = b = c = d = 0 + do { a = b = c = d = 0; (void) a; (void) b; (void) c; (void) d; } while (0) #endif -static int -CPU_getCPUIDFeatures(void) +static int CPU_CPUIDFeatures[4]; +static int CPU_CPUIDMaxFunction = 0; +static SDL_bool CPU_OSSavesYMM = SDL_FALSE; + +static void +CPU_calcCPUIDFeatures(void) { - int features = 0; - int a, b, c, d; + static SDL_bool checked = SDL_FALSE; + if (!checked) { + checked = SDL_TRUE; + if (CPU_haveCPUID()) { + int a, b, c, d; + cpuid(0, a, b, c, d); + CPU_CPUIDMaxFunction = a; + if (CPU_CPUIDMaxFunction >= 1) { + cpuid(1, a, b, c, d); + CPU_CPUIDFeatures[0] = a; + CPU_CPUIDFeatures[1] = b; + CPU_CPUIDFeatures[2] = c; + CPU_CPUIDFeatures[3] = d; - cpuid(0, a, b, c, d); - if (a >= 1) { - cpuid(1, a, b, c, d); - features = d; - } - return features; -} - -static SDL_bool -CPU_OSSavesYMM(void) -{ - int a, b, c, d; - - /* Check to make sure we can call xgetbv */ - cpuid(0, a, b, c, d); - if (a < 1) { - return SDL_FALSE; - } - cpuid(1, a, b, c, d); - if (!(c & 0x08000000)) { - return SDL_FALSE; - } - - /* Call xgetbv to see if YMM register state is saved */ - a = 0; + /* Check to make sure we can call xgetbv */ + if (c & 0x08000000) { + /* Call xgetbv to see if YMM register state is saved */ #if defined(__GNUC__) && (defined(i386) || defined(__x86_64__)) - asm(".byte 0x0f, 0x01, 0xd0" : "=a" (a) : "c" (0) : "%edx"); + __asm__(".byte 0x0f, 0x01, 0xd0" : "=a" (a) : "c" (0) : "%edx"); #elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) && (_MSC_FULL_VER >= 160040219) /* VS2010 SP1 */ - a = (int)_xgetbv(0); + a = (int)_xgetbv(0); #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__) - __asm - { - xor ecx, ecx - _asm _emit 0x0f _asm _emit 0x01 _asm _emit 0xd0 - mov a, eax - } + __asm + { + xor ecx, ecx + _asm _emit 0x0f _asm _emit 0x01 _asm _emit 0xd0 + mov a, eax + } #endif - return ((a & 6) == 6) ? SDL_TRUE : SDL_FALSE; -} - -static int -CPU_haveRDTSC(void) -{ - if (CPU_haveCPUID()) { - return (CPU_getCPUIDFeatures() & 0x00000010); + CPU_OSSavesYMM = ((a & 6) == 6) ? SDL_TRUE : SDL_FALSE; + } + } + } } - return 0; } static int @@ -299,21 +315,61 @@ CPU_haveAltiVec(void) return altivec; } +#if (defined(__LINUX__) || defined(__ANDROID__)) && defined(__ARM_ARCH) && !defined(HAVE_GETAUXVAL) static int -CPU_haveMMX(void) +readProcAuxvForNeon(void) { - if (CPU_haveCPUID()) { - return (CPU_getCPUIDFeatures() & 0x00800000); + int neon = 0; + int kv[2]; + const int fd = open("/proc/self/auxv", O_RDONLY); + if (fd != -1) { + while (read(fd, kv, sizeof (kv)) == sizeof (kv)) { + if (kv[0] == AT_HWCAP) { + neon = ((kv[1] & HWCAP_NEON) == HWCAP_NEON); + break; + } + } + close(fd); } + return neon; +} +#endif + + +static int +CPU_haveNEON(void) +{ +/* The way you detect NEON is a privileged instruction on ARM, so you have + query the OS kernel in a platform-specific way. :/ */ +#if defined(SDL_CPUINFO_DISABLED) || !defined(__ARM_ARCH) + return 0; /* disabled or not an ARM CPU at all. */ +#elif __ARM_ARCH >= 8 + return 1; /* ARMv8 always has non-optional NEON support. */ +#elif defined(__APPLE__) && (__ARM_ARCH >= 7) + /* (note that sysctlbyname("hw.optional.neon") doesn't work!) */ + return 1; /* all Apple ARMv7 chips and later have NEON. */ +#elif defined(__APPLE__) + return 0; /* assume anything else from Apple doesn't have NEON. */ +#elif defined(__QNXNTO__) + return SYSPAGE_ENTRY(cpuinfo)->flags & ARM_CPU_FLAG_NEON; +#elif (defined(__LINUX__) || defined(__ANDROID__)) && defined(HAVE_GETAUXVAL) + return ((getauxval(AT_HWCAP) & HWCAP_NEON) == HWCAP_NEON); +#elif (defined(__LINUX__) || defined(__ANDROID__)) + return readProcAuxvForNeon(); /* Android offers a static library for this, but it just parses /proc/self/auxv */ +#elif (defined(__WINDOWS__) || defined(__WINRT__)) && defined(_M_ARM) + /* All WinRT ARM devices are required to support NEON, but just in case. */ + return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) != 0; +#else +#warning SDL_HasNEON is not implemented for this ARM platform. Write me. return 0; +#endif } static int CPU_have3DNow(void) { - if (CPU_haveCPUID()) { + if (CPU_CPUIDMaxFunction > 0) { /* that is, do we have CPUID at all? */ int a, b, c, d; - cpuid(0x80000000, a, b, c, d); if (a >= 0x80000001) { cpuid(0x80000001, a, b, c, d); @@ -323,95 +379,23 @@ CPU_have3DNow(void) return 0; } -static int -CPU_haveSSE(void) -{ - if (CPU_haveCPUID()) { - return (CPU_getCPUIDFeatures() & 0x02000000); - } - return 0; -} - -static int -CPU_haveSSE2(void) -{ - if (CPU_haveCPUID()) { - return (CPU_getCPUIDFeatures() & 0x04000000); - } - return 0; -} - -static int -CPU_haveSSE3(void) -{ - if (CPU_haveCPUID()) { - int a, b, c, d; - - cpuid(0, a, b, c, d); - if (a >= 1) { - cpuid(1, a, b, c, d); - return (c & 0x00000001); - } - } - return 0; -} - -static int -CPU_haveSSE41(void) -{ - if (CPU_haveCPUID()) { - int a, b, c, d; - - cpuid(0, a, b, c, d); - if (a >= 1) { - cpuid(1, a, b, c, d); - return (c & 0x00080000); - } - } - return 0; -} - -static int -CPU_haveSSE42(void) -{ - if (CPU_haveCPUID()) { - int a, b, c, d; - - cpuid(0, a, b, c, d); - if (a >= 1) { - cpuid(1, a, b, c, d); - return (c & 0x00100000); - } - } - return 0; -} - -static int -CPU_haveAVX(void) -{ - if (CPU_haveCPUID() && CPU_OSSavesYMM()) { - int a, b, c, d; - - cpuid(0, a, b, c, d); - if (a >= 1) { - cpuid(1, a, b, c, d); - return (c & 0x10000000); - } - } - return 0; -} +#define CPU_haveRDTSC() (CPU_CPUIDFeatures[3] & 0x00000010) +#define CPU_haveMMX() (CPU_CPUIDFeatures[3] & 0x00800000) +#define CPU_haveSSE() (CPU_CPUIDFeatures[3] & 0x02000000) +#define CPU_haveSSE2() (CPU_CPUIDFeatures[3] & 0x04000000) +#define CPU_haveSSE3() (CPU_CPUIDFeatures[2] & 0x00000001) +#define CPU_haveSSE41() (CPU_CPUIDFeatures[2] & 0x00080000) +#define CPU_haveSSE42() (CPU_CPUIDFeatures[2] & 0x00100000) +#define CPU_haveAVX() (CPU_OSSavesYMM && (CPU_CPUIDFeatures[2] & 0x10000000)) static int CPU_haveAVX2(void) { - if (CPU_haveCPUID() && CPU_OSSavesYMM()) { + if (CPU_OSSavesYMM && (CPU_CPUIDMaxFunction >= 7)) { int a, b, c, d; - - cpuid(0, a, b, c, d); - if (a >= 7) { - cpuid(7, a, b, c, d); - return (b & 0x00000020); - } + (void) a; (void) b; (void) c; (void) d; /* compiler warnings... */ + cpuid(7, a, b, c, d); + return (b & 0x00000020); } return 0; } @@ -441,6 +425,12 @@ SDL_GetCPUCount(void) SDL_CPUCount = info.dwNumberOfProcessors; } #endif +#ifdef __OS2__ + if (SDL_CPUCount <= 0) { + DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS, + &SDL_CPUCount, sizeof(SDL_CPUCount) ); + } +#endif #endif /* There has to be at least 1, right? :) */ if (SDL_CPUCount <= 0) { @@ -459,7 +449,8 @@ SDL_GetCPUType(void) if (!SDL_CPUType[0]) { int i = 0; - if (CPU_haveCPUID()) { + CPU_calcCPUIDFeatures(); + if (CPU_CPUIDMaxFunction > 0) { /* do we have CPUID at all? */ int a, b, c, d; cpuid(0x00000000, a, b, c, d); (void) a; @@ -496,7 +487,8 @@ SDL_GetCPUName(void) int i = 0; int a, b, c, d; - if (CPU_haveCPUID()) { + CPU_calcCPUIDFeatures(); + if (CPU_CPUIDMaxFunction > 0) { /* do we have CPUID at all? */ cpuid(0x80000000, a, b, c, d); if (a >= 0x80000004) { cpuid(0x80000002, a, b, c, d); @@ -584,6 +576,7 @@ static Uint32 SDL_GetCPUFeatures(void) { if (SDL_CPUFeatures == 0xFFFFFFFF) { + CPU_calcCPUIDFeatures(); SDL_CPUFeatures = 0; if (CPU_haveRDTSC()) { SDL_CPUFeatures |= CPU_HAS_RDTSC; @@ -618,107 +611,84 @@ SDL_GetCPUFeatures(void) if (CPU_haveAVX2()) { SDL_CPUFeatures |= CPU_HAS_AVX2; } + if (CPU_haveNEON()) { + SDL_CPUFeatures |= CPU_HAS_NEON; + } } return SDL_CPUFeatures; } -SDL_bool -SDL_HasRDTSC(void) +#define CPU_FEATURE_AVAILABLE(f) ((SDL_GetCPUFeatures() & f) ? SDL_TRUE : SDL_FALSE) + +SDL_bool SDL_HasRDTSC(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_RDTSC) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_RDTSC); } SDL_bool SDL_HasAltiVec(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_ALTIVEC) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_ALTIVEC); } SDL_bool SDL_HasMMX(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_MMX) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_MMX); } SDL_bool SDL_Has3DNow(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_3DNOW) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_3DNOW); } SDL_bool SDL_HasSSE(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_SSE) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE); } SDL_bool SDL_HasSSE2(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_SSE2) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE2); } SDL_bool SDL_HasSSE3(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_SSE3) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE3); } SDL_bool SDL_HasSSE41(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_SSE41) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE41); } SDL_bool SDL_HasSSE42(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_SSE42) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_SSE42); } SDL_bool SDL_HasAVX(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_AVX) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX); } SDL_bool SDL_HasAVX2(void) { - if (SDL_GetCPUFeatures() & CPU_HAS_AVX2) { - return SDL_TRUE; - } - return SDL_FALSE; + return CPU_FEATURE_AVAILABLE(CPU_HAS_AVX2); +} + +SDL_bool +SDL_HasNEON(void) +{ + return CPU_FEATURE_AVAILABLE(CPU_HAS_NEON); } static int SDL_SystemRAM = 0; @@ -762,6 +732,13 @@ SDL_GetSystemRAM(void) } } #endif +#ifdef __OS2__ + if (SDL_SystemRAM <= 0) { + Uint32 sysram = 0; + DosQuerySysInfo(QSV_TOTPHYSMEM, QSV_TOTPHYSMEM, &sysram, 4); + SDL_SystemRAM = (int) (sysram / 0x100000U); + } +#endif #endif } return SDL_SystemRAM; @@ -790,6 +767,7 @@ main() printf("SSE4.2: %d\n", SDL_HasSSE42()); printf("AVX: %d\n", SDL_HasAVX()); printf("AVX2: %d\n", SDL_HasAVX2()); + printf("NEON: %d\n", SDL_HasNEON()); printf("RAM: %d MB\n", SDL_GetSystemRAM()); return 0; } diff --git a/Engine/lib/sdl/src/dynapi/SDL_dynapi.c b/Engine/lib/sdl/src/dynapi/SDL_dynapi.c index c26baf379..b898826b2 100644 --- a/Engine/lib/sdl/src/dynapi/SDL_dynapi.c +++ b/Engine/lib/sdl/src/dynapi/SDL_dynapi.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,11 +24,17 @@ #if SDL_DYNAMIC_API +#if defined(__OS2__) +#define INCL_DOS +#define INCL_DOSERRORS +#include +#endif + #include "SDL.h" -/* !!! FIXME: Shouldn't these be included in SDL.h? */ -#include "SDL_shape.h" +/* These headers have system specific definitions, so aren't included above */ #include "SDL_syswm.h" +#include "SDL_vulkan.h" /* This is the version of the dynamic API. This doesn't match the SDL version and should not change until there's been a major revamp in API/ABI. @@ -56,38 +62,38 @@ static void SDL_InitDynamicAPI(void); #if DISABLE_JUMP_MAGIC /* Can't use the macro for varargs nonsense. This is atrocious. */ #define SDL_DYNAPI_VARARGS_LOGFN(_static, name, initcall, logname, prio) \ - _static void SDL_Log##logname##name(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ + _static void SDLCALL SDL_Log##logname##name(int category, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ va_list ap; initcall; va_start(ap, fmt); \ jump_table.SDL_LogMessageV(category, SDL_LOG_PRIORITY_##prio, fmt, ap); \ va_end(ap); \ } #define SDL_DYNAPI_VARARGS(_static, name, initcall) \ - _static int SDL_SetError##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ + _static int SDLCALL SDL_SetError##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ char buf[512]; /* !!! FIXME: dynamic allocation */ \ va_list ap; initcall; va_start(ap, fmt); \ jump_table.SDL_vsnprintf(buf, sizeof (buf), fmt, ap); \ va_end(ap); \ return jump_table.SDL_SetError("%s", buf); \ } \ - _static int SDL_sscanf##name(const char *buf, SDL_SCANF_FORMAT_STRING const char *fmt, ...) { \ + _static int SDLCALL SDL_sscanf##name(const char *buf, SDL_SCANF_FORMAT_STRING const char *fmt, ...) { \ int retval; va_list ap; initcall; va_start(ap, fmt); \ retval = jump_table.SDL_vsscanf(buf, fmt, ap); \ va_end(ap); \ return retval; \ } \ - _static int SDL_snprintf##name(SDL_OUT_Z_CAP(maxlen) char *buf, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ + _static int SDLCALL SDL_snprintf##name(SDL_OUT_Z_CAP(maxlen) char *buf, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ int retval; va_list ap; initcall; va_start(ap, fmt); \ retval = jump_table.SDL_vsnprintf(buf, maxlen, fmt, ap); \ va_end(ap); \ return retval; \ } \ - _static void SDL_Log##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ + _static void SDLCALL SDL_Log##name(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ va_list ap; initcall; va_start(ap, fmt); \ jump_table.SDL_LogMessageV(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO, fmt, ap); \ va_end(ap); \ } \ - _static void SDL_LogMessage##name(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ + _static void SDLCALL SDL_LogMessage##name(int category, SDL_LogPriority priority, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) { \ va_list ap; initcall; va_start(ap, fmt); \ jump_table.SDL_LogMessageV(category, priority, fmt, ap); \ va_end(ap); \ @@ -105,9 +111,9 @@ static void SDL_InitDynamicAPI(void); /* The DEFAULT funcs will init jump table and then call real function. */ /* The REAL funcs are the actual functions, name-mangled to not clash. */ #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \ - typedef rc (*SDL_DYNAPIFN_##fn) params; \ - static rc fn##_DEFAULT params; \ - extern rc fn##_REAL params; + typedef rc (SDLCALL *SDL_DYNAPIFN_##fn) params; \ + static rc SDLCALL fn##_DEFAULT params; \ + extern rc SDLCALL fn##_REAL params; #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC @@ -119,7 +125,7 @@ typedef struct { } SDL_DYNAPI_jump_table; /* Predeclare the default functions for initializing the jump table. */ -#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) static rc fn##_DEFAULT params; +#define SDL_DYNAPI_PROC(rc,fn,params,args,ret) static rc SDLCALL fn##_DEFAULT params; #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC @@ -133,7 +139,7 @@ static SDL_DYNAPI_jump_table jump_table = { /* Default functions init the function table then call right thing. */ #if DISABLE_JUMP_MAGIC #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \ - static rc fn##_DEFAULT params { \ + static rc SDLCALL fn##_DEFAULT params { \ SDL_InitDynamicAPI(); \ ret jump_table.fn args; \ } @@ -150,7 +156,7 @@ SDL_DYNAPI_VARARGS(static, _DEFAULT, SDL_InitDynamicAPI()) /* Public API functions to jump into the jump table. */ #if DISABLE_JUMP_MAGIC #define SDL_DYNAPI_PROC(rc,fn,params,args,ret) \ - rc fn params { ret jump_table.fn args; } + rc SDLCALL fn params { ret jump_table.fn args; } #define SDL_DYNAPI_PROC_NO_VARARGS 1 #include "SDL_dynapi_procs.h" #undef SDL_DYNAPI_PROC @@ -216,21 +222,7 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) return retval; } -#elif defined(__HAIKU__) -#include -static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) -{ - image_id lib = load_add_on(fname); - void *retval = NULL; - if (lib >= 0) { - if (get_image_symbol(lib, sym, B_SYMBOL_TYPE_TEXT, &retval) != B_NO_ERROR) { - unload_add_on(lib); - retval = NULL; - } - } - return retval; -} -#elif defined(unix) || defined(__unix__) || defined(__APPLE__) +#elif defined(unix) || defined(__unix__) || defined(__APPLE__) || defined(__HAIKU__) || defined(__QNX__) #include static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) { @@ -244,6 +236,21 @@ static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) } return retval; } + +#elif defined(__OS2__) +static SDL_INLINE void *get_sdlapi_entry(const char *fname, const char *sym) +{ + HMODULE hmodule; + PFN retval = NULL; + char error[256]; + if (DosLoadModule(&error, sizeof(error), fname, &hmodule) == NO_ERROR) { + if (DosQueryProcAddr(hmodule, 0, sym, &retval) != NO_ERROR) { + DosFreeModule(hmodule); + } + } + return (void *) retval; +} + #else #error Please define your platform. #endif @@ -316,4 +323,3 @@ SDL_InitDynamicAPI(void) #endif /* SDL_DYNAMIC_API */ /* vi: set ts=4 sw=4 expandtab: */ - diff --git a/Engine/lib/sdl/src/dynapi/SDL_dynapi.h b/Engine/lib/sdl/src/dynapi/SDL_dynapi.h index 5e78338f2..73316f1f8 100644 --- a/Engine/lib/sdl/src/dynapi/SDL_dynapi.h +++ b/Engine/lib/sdl/src/dynapi/SDL_dynapi.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_dynapi_h -#define _SDL_dynapi_h +#ifndef SDL_dynapi_h_ +#define SDL_dynapi_h_ /* IMPORTANT: This is the master switch to disabling the dynamic API. We made it so you diff --git a/Engine/lib/sdl/src/dynapi/SDL_dynapi_overrides.h b/Engine/lib/sdl/src/dynapi/SDL_dynapi_overrides.h index 9541611ce..1ec2eaffd 100644 --- a/Engine/lib/sdl/src/dynapi/SDL_dynapi_overrides.h +++ b/Engine/lib/sdl/src/dynapi/SDL_dynapi_overrides.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,12 +27,6 @@ #error You should not be here. #endif -/* so annoying. */ -#if defined(__thumb__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)) -#define SDL_MemoryBarrierRelease SDL_MemoryBarrierRelease_REAL -#define SDL_MemoryBarrierAcquire SDL_MemoryBarrierAcquire_REAL -#endif - #define SDL_SetError SDL_SetError_REAL #define SDL_Log SDL_Log_REAL #define SDL_LogVerbose SDL_LogVerbose_REAL @@ -612,3 +606,66 @@ #define SDL_CreateRGBSurfaceWithFormat SDL_CreateRGBSurfaceWithFormat_REAL #define SDL_CreateRGBSurfaceWithFormatFrom SDL_CreateRGBSurfaceWithFormatFrom_REAL #define SDL_GetHintBoolean SDL_GetHintBoolean_REAL +#define SDL_JoystickGetDeviceVendor SDL_JoystickGetDeviceVendor_REAL +#define SDL_JoystickGetDeviceProduct SDL_JoystickGetDeviceProduct_REAL +#define SDL_JoystickGetDeviceProductVersion SDL_JoystickGetDeviceProductVersion_REAL +#define SDL_JoystickGetVendor SDL_JoystickGetVendor_REAL +#define SDL_JoystickGetProduct SDL_JoystickGetProduct_REAL +#define SDL_JoystickGetProductVersion SDL_JoystickGetProductVersion_REAL +#define SDL_GameControllerGetVendor SDL_GameControllerGetVendor_REAL +#define SDL_GameControllerGetProduct SDL_GameControllerGetProduct_REAL +#define SDL_GameControllerGetProductVersion SDL_GameControllerGetProductVersion_REAL +#define SDL_HasNEON SDL_HasNEON_REAL +#define SDL_GameControllerNumMappings SDL_GameControllerNumMappings_REAL +#define SDL_GameControllerMappingForIndex SDL_GameControllerMappingForIndex_REAL +#define SDL_JoystickGetAxisInitialState SDL_JoystickGetAxisInitialState_REAL +#define SDL_JoystickGetDeviceType SDL_JoystickGetDeviceType_REAL +#define SDL_JoystickGetType SDL_JoystickGetType_REAL +#define SDL_MemoryBarrierReleaseFunction SDL_MemoryBarrierReleaseFunction_REAL +#define SDL_MemoryBarrierAcquireFunction SDL_MemoryBarrierAcquireFunction_REAL +#define SDL_JoystickGetDeviceInstanceID SDL_JoystickGetDeviceInstanceID_REAL +#define SDL_utf8strlen SDL_utf8strlen_REAL +#define SDL_LoadFile_RW SDL_LoadFile_RW_REAL +#define SDL_wcscmp SDL_wcscmp_REAL +#define SDL_ComposeCustomBlendMode SDL_ComposeCustomBlendMode_REAL +#define SDL_DuplicateSurface SDL_DuplicateSurface_REAL +#define SDL_Vulkan_LoadLibrary SDL_Vulkan_LoadLibrary_REAL +#define SDL_Vulkan_GetVkGetInstanceProcAddr SDL_Vulkan_GetVkGetInstanceProcAddr_REAL +#define SDL_Vulkan_UnloadLibrary SDL_Vulkan_UnloadLibrary_REAL +#define SDL_Vulkan_GetInstanceExtensions SDL_Vulkan_GetInstanceExtensions_REAL +#define SDL_Vulkan_CreateSurface SDL_Vulkan_CreateSurface_REAL +#define SDL_Vulkan_GetDrawableSize SDL_Vulkan_GetDrawableSize_REAL +#define SDL_LockJoysticks SDL_LockJoysticks_REAL +#define SDL_UnlockJoysticks SDL_UnlockJoysticks_REAL +#define SDL_GetMemoryFunctions SDL_GetMemoryFunctions_REAL +#define SDL_SetMemoryFunctions SDL_SetMemoryFunctions_REAL +#define SDL_GetNumAllocations SDL_GetNumAllocations_REAL +#define SDL_NewAudioStream SDL_NewAudioStream_REAL +#define SDL_AudioStreamPut SDL_AudioStreamPut_REAL +#define SDL_AudioStreamGet SDL_AudioStreamGet_REAL +#define SDL_AudioStreamClear SDL_AudioStreamClear_REAL +#define SDL_AudioStreamAvailable SDL_AudioStreamAvailable_REAL +#define SDL_FreeAudioStream SDL_FreeAudioStream_REAL +#define SDL_AudioStreamFlush SDL_AudioStreamFlush_REAL +#define SDL_acosf SDL_acosf_REAL +#define SDL_asinf SDL_asinf_REAL +#define SDL_atanf SDL_atanf_REAL +#define SDL_atan2f SDL_atan2f_REAL +#define SDL_ceilf SDL_ceilf_REAL +#define SDL_copysignf SDL_copysignf_REAL +#define SDL_fabsf SDL_fabsf_REAL +#define SDL_floorf SDL_floorf_REAL +#define SDL_logf SDL_logf_REAL +#define SDL_powf SDL_powf_REAL +#define SDL_scalbnf SDL_scalbnf_REAL +#define SDL_fmod SDL_fmod_REAL +#define SDL_fmodf SDL_fmodf_REAL +#define SDL_SetYUVConversionMode SDL_SetYUVConversionMode_REAL +#define SDL_GetYUVConversionMode SDL_GetYUVConversionMode_REAL +#define SDL_GetYUVConversionModeForResolution SDL_GetYUVConversionModeForResolution_REAL +#define SDL_RenderGetMetalLayer SDL_RenderGetMetalLayer_REAL +#define SDL_RenderGetMetalCommandEncoder SDL_RenderGetMetalCommandEncoder_REAL +#define SDL_IsAndroidTV SDL_IsAndroidTV_REAL +#define SDL_WinRTGetDeviceFamily SDL_WinRTGetDeviceFamily_REAL +#define SDL_log10 SDL_log10_REAL +#define SDL_log10f SDL_log10f_REAL diff --git a/Engine/lib/sdl/src/dynapi/SDL_dynapi_procs.h b/Engine/lib/sdl/src/dynapi/SDL_dynapi_procs.h index a08835b26..b715d33ce 100644 --- a/Engine/lib/sdl/src/dynapi/SDL_dynapi_procs.h +++ b/Engine/lib/sdl/src/dynapi/SDL_dynapi_procs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -50,6 +50,8 @@ SDL_DYNAPI_PROC(int,SDL_snprintf,(SDL_OUT_Z_CAP(b) char *a, size_t b, SDL_PRINTF #if defined(__WIN32__) && !defined(HAVE_LIBC) SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return) +#elif defined(__OS2__) +SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c, pfnSDL_CurrentBeginThread d, pfnSDL_CurrentEndThread e),(a,b,c,d,e),return) #else SDL_DYNAPI_PROC(SDL_Thread*,SDL_CreateThread,(SDL_ThreadFunction a, const char *b, void *c),(a,b,c),return) #endif @@ -60,12 +62,6 @@ SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromFP,(FILE *a, SDL_bool b),(a,b),return) SDL_DYNAPI_PROC(SDL_RWops*,SDL_RWFromFP,(void *a, SDL_bool b),(a,b),return) #endif -/* so annoying. */ -#if defined(__thumb__) && (defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__)) -SDL_DYNAPI_PROC(void,SDL_MemoryBarrierRelease,(void),(),) -SDL_DYNAPI_PROC(void,SDL_MemoryBarrierAcquire,(void),(),) -#endif - #ifdef __WIN32__ SDL_DYNAPI_PROC(int,SDL_RegisterApp,(char *a, Uint32 b, void *c),(a,b,c),return) SDL_DYNAPI_PROC(void,SDL_UnregisterApp,(void),(),) @@ -73,12 +69,12 @@ SDL_DYNAPI_PROC(int,SDL_Direct3D9GetAdapterIndex,(int a),(a),return) SDL_DYNAPI_PROC(IDirect3DDevice9*,SDL_RenderGetD3D9Device,(SDL_Renderer *a),(a),return) #endif -#if defined(__IPHONEOS__) && __IPHONEOS__ +#ifdef __IPHONEOS__ SDL_DYNAPI_PROC(int,SDL_iPhoneSetAnimationCallback,(SDL_Window *a, int b, void c, void *d),(a,b,c,d),return) SDL_DYNAPI_PROC(void,SDL_iPhoneSetEventPump,(SDL_bool a),(a),) #endif -#if defined(__ANDROID__) && __ANDROID__ +#ifdef __ANDROID__ SDL_DYNAPI_PROC(void*,SDL_AndroidGetJNIEnv,(void),(),return) SDL_DYNAPI_PROC(void*,SDL_AndroidGetActivity,(void),(),return) SDL_DYNAPI_PROC(const char*,SDL_AndroidGetInternalStoragePath,(void),(),return) @@ -644,3 +640,70 @@ SDL_DYNAPI_PROC(void,SDL_SetWindowResizable,(SDL_Window *a, SDL_bool b),(a,b),) SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurfaceWithFormat,(Uint32 a, int b, int c, int d, Uint32 e),(a,b,c,d,e),return) SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurfaceWithFormatFrom,(void *a, int b, int c, int d, int e, Uint32 f),(a,b,c,d,e,f),return) SDL_DYNAPI_PROC(SDL_bool,SDL_GetHintBoolean,(const char *a, SDL_bool b),(a,b),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetDeviceVendor,(int a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetDeviceProduct,(int a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetDeviceProductVersion,(int a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetVendor,(SDL_Joystick *a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetProduct,(SDL_Joystick *a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetProductVersion,(SDL_Joystick *a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetVendor,(SDL_GameController *a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetProduct,(SDL_GameController *a),(a),return) +SDL_DYNAPI_PROC(Uint16,SDL_GameControllerGetProductVersion,(SDL_GameController *a),(a),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_HasNEON,(void),(),return) +SDL_DYNAPI_PROC(int,SDL_GameControllerNumMappings,(void),(),return) +SDL_DYNAPI_PROC(char*,SDL_GameControllerMappingForIndex,(int a),(a),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_JoystickGetAxisInitialState,(SDL_Joystick *a, int b, Sint16 *c),(a,b,c),return) +SDL_DYNAPI_PROC(SDL_JoystickType,SDL_JoystickGetDeviceType,(int a),(a),return) +SDL_DYNAPI_PROC(SDL_JoystickType,SDL_JoystickGetType,(SDL_Joystick *a),(a),return) +SDL_DYNAPI_PROC(void,SDL_MemoryBarrierReleaseFunction,(void),(),) +SDL_DYNAPI_PROC(void,SDL_MemoryBarrierAcquireFunction,(void),(),) +SDL_DYNAPI_PROC(SDL_JoystickID,SDL_JoystickGetDeviceInstanceID,(int a),(a),return) +SDL_DYNAPI_PROC(size_t,SDL_utf8strlen,(const char *a),(a),return) +SDL_DYNAPI_PROC(void*,SDL_LoadFile_RW,(SDL_RWops *a, size_t *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(int,SDL_wcscmp,(const wchar_t *a, const wchar_t *b),(a,b),return) +SDL_DYNAPI_PROC(SDL_BlendMode,SDL_ComposeCustomBlendMode,(SDL_BlendFactor a, SDL_BlendFactor b, SDL_BlendOperation c, SDL_BlendFactor d, SDL_BlendFactor e, SDL_BlendOperation f),(a,b,c,d,e,f),return) +SDL_DYNAPI_PROC(SDL_Surface*,SDL_DuplicateSurface,(SDL_Surface *a),(a),return) +SDL_DYNAPI_PROC(int,SDL_Vulkan_LoadLibrary,(const char *a),(a),return) +SDL_DYNAPI_PROC(void*,SDL_Vulkan_GetVkGetInstanceProcAddr,(void),(),return) +SDL_DYNAPI_PROC(void,SDL_Vulkan_UnloadLibrary,(void),(),) +SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_GetInstanceExtensions,(SDL_Window *a, unsigned int *b, const char **c),(a,b,c),return) +SDL_DYNAPI_PROC(SDL_bool,SDL_Vulkan_CreateSurface,(SDL_Window *a, VkInstance b, VkSurfaceKHR *c),(a,b,c),return) +SDL_DYNAPI_PROC(void,SDL_Vulkan_GetDrawableSize,(SDL_Window *a, int *b, int *c),(a,b,c),) +SDL_DYNAPI_PROC(void,SDL_LockJoysticks,(void),(),) +SDL_DYNAPI_PROC(void,SDL_UnlockJoysticks,(void),(),) +SDL_DYNAPI_PROC(void,SDL_GetMemoryFunctions,(SDL_malloc_func *a, SDL_calloc_func *b, SDL_realloc_func *c, SDL_free_func *d),(a,b,c,d),) +SDL_DYNAPI_PROC(int,SDL_SetMemoryFunctions,(SDL_malloc_func a, SDL_calloc_func b, SDL_realloc_func c, SDL_free_func d),(a,b,c,d),return) +SDL_DYNAPI_PROC(int,SDL_GetNumAllocations,(void),(),return) +SDL_DYNAPI_PROC(SDL_AudioStream*,SDL_NewAudioStream,(const SDL_AudioFormat a, const Uint8 b, const int c, const SDL_AudioFormat d, const Uint8 e, const int f),(a,b,c,d,e,f),return) +SDL_DYNAPI_PROC(int,SDL_AudioStreamPut,(SDL_AudioStream *a, const void *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(int,SDL_AudioStreamGet,(SDL_AudioStream *a, void *b, int c),(a,b,c),return) +SDL_DYNAPI_PROC(void,SDL_AudioStreamClear,(SDL_AudioStream *a),(a),) +SDL_DYNAPI_PROC(int,SDL_AudioStreamAvailable,(SDL_AudioStream *a),(a),return) +SDL_DYNAPI_PROC(void,SDL_FreeAudioStream,(SDL_AudioStream *a),(a),) +SDL_DYNAPI_PROC(int,SDL_AudioStreamFlush,(SDL_AudioStream *a),(a),return) +SDL_DYNAPI_PROC(float,SDL_acosf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_asinf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_atanf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_atan2f,(float a, float b),(a,b),return) +SDL_DYNAPI_PROC(float,SDL_ceilf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_copysignf,(float a, float b),(a,b),return) +SDL_DYNAPI_PROC(float,SDL_fabsf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_floorf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_logf,(float a),(a),return) +SDL_DYNAPI_PROC(float,SDL_powf,(float a, float b),(a,b),return) +SDL_DYNAPI_PROC(float,SDL_scalbnf,(float a, int b),(a,b),return) +SDL_DYNAPI_PROC(double,SDL_fmod,(double a, double b),(a,b),return) +SDL_DYNAPI_PROC(float,SDL_fmodf,(float a, float b),(a,b),return) +SDL_DYNAPI_PROC(void,SDL_SetYUVConversionMode,(SDL_YUV_CONVERSION_MODE a),(a),) +SDL_DYNAPI_PROC(SDL_YUV_CONVERSION_MODE,SDL_GetYUVConversionMode,(void),(),return) +SDL_DYNAPI_PROC(SDL_YUV_CONVERSION_MODE,SDL_GetYUVConversionModeForResolution,(int a, int b),(a,b),return) +SDL_DYNAPI_PROC(void*,SDL_RenderGetMetalLayer,(SDL_Renderer *a),(a),return) +SDL_DYNAPI_PROC(void*,SDL_RenderGetMetalCommandEncoder,(SDL_Renderer *a),(a),return) +#ifdef __WINRT__ +SDL_DYNAPI_PROC(SDL_WinRT_DeviceFamily,SDL_WinRTGetDeviceFamily,(void),(),return) +#endif +#ifdef __ANDROID__ +SDL_DYNAPI_PROC(SDL_bool,SDL_IsAndroidTV,(void),(),return) +#endif +SDL_DYNAPI_PROC(double,SDL_log10,(double a),(a),return) +SDL_DYNAPI_PROC(float,SDL_log10f,(float a),(a),return) diff --git a/Engine/lib/sdl/src/dynapi/gendynapi.pl b/Engine/lib/sdl/src/dynapi/gendynapi.pl index 5c3d79608..721241be6 100755 --- a/Engine/lib/sdl/src/dynapi/gendynapi.pl +++ b/Engine/lib/sdl/src/dynapi/gendynapi.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl -w # Simple DirectMedia Layer -# Copyright (C) 1997-2016 Sam Lantinga +# Copyright (C) 1997-2018 Sam Lantinga # # This software is provided 'as-is', without any express or implied # warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/events/SDL_clipboardevents.c b/Engine/lib/sdl/src/events/SDL_clipboardevents.c index 9b2209bdf..5c45853b7 100644 --- a/Engine/lib/sdl/src/events/SDL_clipboardevents.c +++ b/Engine/lib/sdl/src/events/SDL_clipboardevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/events/SDL_clipboardevents_c.h b/Engine/lib/sdl/src/events/SDL_clipboardevents_c.h index 98e6a38bd..24c450bab 100644 --- a/Engine/lib/sdl/src/events/SDL_clipboardevents_c.h +++ b/Engine/lib/sdl/src/events/SDL_clipboardevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,11 +20,11 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_clipboardevents_c_h -#define _SDL_clipboardevents_c_h +#ifndef SDL_clipboardevents_c_h_ +#define SDL_clipboardevents_c_h_ extern int SDL_SendClipboardUpdate(void); -#endif /* _SDL_clipboardevents_c_h */ +#endif /* SDL_clipboardevents_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/events/SDL_dropevents.c b/Engine/lib/sdl/src/events/SDL_dropevents.c index 49b07d9a6..39c512008 100644 --- a/Engine/lib/sdl/src/events/SDL_dropevents.c +++ b/Engine/lib/sdl/src/events/SDL_dropevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/events/SDL_dropevents_c.h b/Engine/lib/sdl/src/events/SDL_dropevents_c.h index a7adb8560..79f37cc16 100644 --- a/Engine/lib/sdl/src/events/SDL_dropevents_c.h +++ b/Engine/lib/sdl/src/events/SDL_dropevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_dropevents_c_h -#define _SDL_dropevents_c_h +#ifndef SDL_dropevents_c_h_ +#define SDL_dropevents_c_h_ extern int SDL_SendDropFile(SDL_Window *window, const char *file); extern int SDL_SendDropText(SDL_Window *window, const char *text); extern int SDL_SendDropComplete(SDL_Window *window); -#endif /* _SDL_dropevents_c_h */ +#endif /* SDL_dropevents_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/events/SDL_events.c b/Engine/lib/sdl/src/events/SDL_events.c index 2f5b0af29..f2e5b6278 100644 --- a/Engine/lib/sdl/src/events/SDL_events.c +++ b/Engine/lib/sdl/src/events/SDL_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,6 @@ #include "SDL.h" #include "SDL_events.h" -#include "SDL_syswm.h" #include "SDL_thread.h" #include "SDL_events_c.h" #include "../timer/SDL_timer_c.h" @@ -32,21 +31,25 @@ #include "../joystick/SDL_joystick_c.h" #endif #include "../video/SDL_sysvideo.h" +#include "SDL_syswm.h" + +/*#define SDL_DEBUG_EVENTS 1*/ /* An arbitrary limit so we don't have unbounded growth */ #define SDL_MAX_QUEUED_EVENTS 65535 -/* Public data -- the event filter */ -SDL_EventFilter SDL_EventOK = NULL; -void *SDL_EventOKParam; - typedef struct SDL_EventWatcher { SDL_EventFilter callback; void *userdata; - struct SDL_EventWatcher *next; + SDL_bool removed; } SDL_EventWatcher; +static SDL_mutex *SDL_event_watchers_lock; +static SDL_EventWatcher SDL_EventOK; static SDL_EventWatcher *SDL_event_watchers = NULL; +static int SDL_event_watchers_count = 0; +static SDL_bool SDL_event_watchers_dispatching = SDL_FALSE; +static SDL_bool SDL_event_watchers_removed = SDL_FALSE; typedef struct { Uint32 bits[8]; @@ -84,6 +87,230 @@ static struct } SDL_EventQ = { NULL, { 1 }, { 0 }, 0, NULL, NULL, NULL, NULL, NULL }; +#ifdef SDL_DEBUG_EVENTS + +/* this is to make printf() calls cleaner. */ +#define uint unsigned int + +static void +SDL_DebugPrintEvent(const SDL_Event *event) +{ + /* !!! FIXME: This code is kinda ugly, sorry. */ + printf("SDL EVENT: "); + + if ((event->type >= SDL_USEREVENT) && (event->type <= SDL_LASTEVENT)) { + printf("SDL_USEREVENT"); + if (event->type > SDL_USEREVENT) { + printf("+%u", ((uint) event->type) - SDL_USEREVENT); + } + printf(" (timestamp=%u windowid=%u code=%d data1=%p data2=%p)", + (uint) event->user.timestamp, (uint) event->user.windowID, + (int) event->user.code, event->user.data1, event->user.data2); + return; + } + + switch (event->type) { + #define SDL_EVENT_CASE(x) case x: printf("%s", #x); + SDL_EVENT_CASE(SDL_FIRSTEVENT) printf("(THIS IS PROBABLY A BUG!)"); break; + SDL_EVENT_CASE(SDL_QUIT) printf("(timestamp=%u)", (uint) event->quit.timestamp); break; + SDL_EVENT_CASE(SDL_APP_TERMINATING) break; + SDL_EVENT_CASE(SDL_APP_LOWMEMORY) break; + SDL_EVENT_CASE(SDL_APP_WILLENTERBACKGROUND) break; + SDL_EVENT_CASE(SDL_APP_DIDENTERBACKGROUND) break; + SDL_EVENT_CASE(SDL_APP_WILLENTERFOREGROUND) break; + SDL_EVENT_CASE(SDL_APP_DIDENTERFOREGROUND) break; + SDL_EVENT_CASE(SDL_KEYMAPCHANGED) break; + SDL_EVENT_CASE(SDL_CLIPBOARDUPDATE) break; + SDL_EVENT_CASE(SDL_RENDER_TARGETS_RESET) break; + SDL_EVENT_CASE(SDL_RENDER_DEVICE_RESET) break; + #undef SDL_EVENT_CASE + + #define SDL_EVENT_CASE(x) case x: printf("%s ", #x); + + SDL_EVENT_CASE(SDL_WINDOWEVENT) + printf("(timestamp=%u windowid=%u event=", (uint) event->window.timestamp, (uint) event->window.windowID); + switch(event->window.event) { + case SDL_WINDOWEVENT_NONE: printf("none(THIS IS PROBABLY A BUG!)"); break; + #define SDL_WINDOWEVENT_CASE(x) case x: printf("%s", #x); break + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_SHOWN); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIDDEN); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_EXPOSED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MOVED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_RESIZED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_SIZE_CHANGED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MINIMIZED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_MAXIMIZED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_RESTORED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_ENTER); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_LEAVE); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_FOCUS_GAINED); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_FOCUS_LOST); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_CLOSE); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_TAKE_FOCUS); + SDL_WINDOWEVENT_CASE(SDL_WINDOWEVENT_HIT_TEST); + #undef SDL_WINDOWEVENT_CASE + default: printf("UNKNOWN(bug? fixme?)"); break; + } + printf(" data1=%d data2=%d)", (int) event->window.data1, (int) event->window.data2); + break; + + SDL_EVENT_CASE(SDL_SYSWMEVENT) + printf("(timestamp=%u)", (uint) event->syswm.timestamp); + /* !!! FIXME: we don't delve further at the moment. */ + break; + + #define PRINT_KEY_EVENT(event) \ + printf("(timestamp=%u windowid=%u state=%s repeat=%s scancode=%u keycode=%u mod=%u)", \ + (uint) event->key.timestamp, (uint) event->key.windowID, \ + event->key.state == SDL_PRESSED ? "pressed" : "released", \ + event->key.repeat ? "true" : "false", \ + (uint) event->key.keysym.scancode, \ + (uint) event->key.keysym.sym, \ + (uint) event->key.keysym.mod) + SDL_EVENT_CASE(SDL_KEYDOWN) PRINT_KEY_EVENT(event); break; + SDL_EVENT_CASE(SDL_KEYUP) PRINT_KEY_EVENT(event); break; + #undef PRINT_KEY_EVENT + + SDL_EVENT_CASE(SDL_TEXTEDITING) + printf("(timestamp=%u windowid=%u text='%s' start=%d length=%d)", + (uint) event->edit.timestamp, (uint) event->edit.windowID, + event->edit.text, (int) event->edit.start, (int) event->edit.length); + break; + + SDL_EVENT_CASE(SDL_TEXTINPUT) + printf("(timestamp=%u windowid=%u text='%s')", (uint) event->text.timestamp, (uint) event->text.windowID, event->text.text); + break; + + + SDL_EVENT_CASE(SDL_MOUSEMOTION) + printf("(timestamp=%u windowid=%u which=%u state=%u x=%d y=%d xrel=%d yrel=%d)", + (uint) event->motion.timestamp, (uint) event->motion.windowID, + (uint) event->motion.which, (uint) event->motion.state, + (int) event->motion.x, (int) event->motion.y, + (int) event->motion.xrel, (int) event->motion.yrel); + break; + + #define PRINT_MBUTTON_EVENT(event) \ + printf("(timestamp=%u windowid=%u which=%u button=%u state=%s clicks=%u x=%d y=%d)", \ + (uint) event->button.timestamp, (uint) event->button.windowID, \ + (uint) event->button.which, (uint) event->button.button, \ + event->button.state == SDL_PRESSED ? "pressed" : "released", \ + (uint) event->button.clicks, (int) event->button.x, (int) event->button.y) + SDL_EVENT_CASE(SDL_MOUSEBUTTONDOWN) PRINT_MBUTTON_EVENT(event); break; + SDL_EVENT_CASE(SDL_MOUSEBUTTONUP) PRINT_MBUTTON_EVENT(event); break; + #undef PRINT_MBUTTON_EVENT + + + SDL_EVENT_CASE(SDL_MOUSEWHEEL) + printf("(timestamp=%u windowid=%u which=%u x=%d y=%d direction=%s)", + (uint) event->wheel.timestamp, (uint) event->wheel.windowID, + (uint) event->wheel.which, (int) event->wheel.x, (int) event->wheel.y, + event->wheel.direction == SDL_MOUSEWHEEL_NORMAL ? "normal" : "flipped"); + break; + + SDL_EVENT_CASE(SDL_JOYAXISMOTION) + printf("(timestamp=%u which=%d axis=%u value=%d)", + (uint) event->jaxis.timestamp, (int) event->jaxis.which, + (uint) event->jaxis.axis, (int) event->jaxis.value); + break; + + SDL_EVENT_CASE(SDL_JOYBALLMOTION) + printf("(timestamp=%u which=%d ball=%u xrel=%d yrel=%d)", + (uint) event->jball.timestamp, (int) event->jball.which, + (uint) event->jball.ball, (int) event->jball.xrel, (int) event->jball.yrel); + break; + + SDL_EVENT_CASE(SDL_JOYHATMOTION) + printf("(timestamp=%u which=%d hat=%u value=%u)", + (uint) event->jhat.timestamp, (int) event->jhat.which, + (uint) event->jhat.hat, (uint) event->jhat.value); + break; + + #define PRINT_JBUTTON_EVENT(event) \ + printf("(timestamp=%u which=%d button=%u state=%s)", \ + (uint) event->jbutton.timestamp, (int) event->jbutton.which, \ + (uint) event->jbutton.button, event->jbutton.state == SDL_PRESSED ? "pressed" : "released") + SDL_EVENT_CASE(SDL_JOYBUTTONDOWN) PRINT_JBUTTON_EVENT(event); break; + SDL_EVENT_CASE(SDL_JOYBUTTONUP) PRINT_JBUTTON_EVENT(event); break; + #undef PRINT_JBUTTON_EVENT + + #define PRINT_JOYDEV_EVENT(event) printf("(timestamp=%u which=%d)", (uint) event->jdevice.timestamp, (int) event->jdevice.which) + SDL_EVENT_CASE(SDL_JOYDEVICEADDED) PRINT_JOYDEV_EVENT(event); break; + SDL_EVENT_CASE(SDL_JOYDEVICEREMOVED) PRINT_JOYDEV_EVENT(event); break; + #undef PRINT_JOYDEV_EVENT + + SDL_EVENT_CASE(SDL_CONTROLLERAXISMOTION) + printf("(timestamp=%u which=%d axis=%u value=%d)", + (uint) event->caxis.timestamp, (int) event->caxis.which, + (uint) event->caxis.axis, (int) event->caxis.value); + break; + + #define PRINT_CBUTTON_EVENT(event) \ + printf("(timestamp=%u which=%d button=%u state=%s)", \ + (uint) event->cbutton.timestamp, (int) event->cbutton.which, \ + (uint) event->cbutton.button, event->cbutton.state == SDL_PRESSED ? "pressed" : "released") + SDL_EVENT_CASE(SDL_CONTROLLERBUTTONDOWN) PRINT_CBUTTON_EVENT(event); break; + SDL_EVENT_CASE(SDL_CONTROLLERBUTTONUP) PRINT_CBUTTON_EVENT(event); break; + #undef PRINT_CBUTTON_EVENT + + #define PRINT_CONTROLLERDEV_EVENT(event) printf("(timestamp=%u which=%d)", (uint) event->cdevice.timestamp, (int) event->cdevice.which) + SDL_EVENT_CASE(SDL_CONTROLLERDEVICEADDED) PRINT_CONTROLLERDEV_EVENT(event); break; + SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMOVED) PRINT_CONTROLLERDEV_EVENT(event); break; + SDL_EVENT_CASE(SDL_CONTROLLERDEVICEREMAPPED) PRINT_CONTROLLERDEV_EVENT(event); break; + #undef PRINT_CONTROLLERDEV_EVENT + + #define PRINT_FINGER_EVENT(event) \ + printf("(timestamp=%u touchid=%lld fingerid=%lld x=%f y=%f dx=%f dy=%f pressure=%f)", \ + (uint) event->tfinger.timestamp, (long long) event->tfinger.touchId, \ + (long long) event->tfinger.fingerId, event->tfinger.x, event->tfinger.y, \ + event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure) + SDL_EVENT_CASE(SDL_FINGERDOWN) PRINT_FINGER_EVENT(event); break; + SDL_EVENT_CASE(SDL_FINGERUP) PRINT_FINGER_EVENT(event); break; + SDL_EVENT_CASE(SDL_FINGERMOTION) PRINT_FINGER_EVENT(event); break; + #undef PRINT_FINGER_EVENT + + #define PRINT_DOLLAR_EVENT(event) \ + printf("(timestamp=%u touchid=%lld gestureid=%lld numfingers=%u error=%f x=%f y=%f)", \ + (uint) event->dgesture.timestamp, (long long) event->dgesture.touchId, \ + (long long) event->dgesture.gestureId, (uint) event->dgesture.numFingers, \ + event->dgesture.error, event->dgesture.x, event->dgesture.y); + SDL_EVENT_CASE(SDL_DOLLARGESTURE) PRINT_DOLLAR_EVENT(event); break; + SDL_EVENT_CASE(SDL_DOLLARRECORD) PRINT_DOLLAR_EVENT(event); break; + #undef PRINT_DOLLAR_EVENT + + SDL_EVENT_CASE(SDL_MULTIGESTURE) + printf("(timestamp=%u touchid=%lld dtheta=%f ddist=%f x=%f y=%f numfingers=%u)", + (uint) event->mgesture.timestamp, (long long) event->mgesture.touchId, + event->mgesture.dTheta, event->mgesture.dDist, + event->mgesture.x, event->mgesture.y, (uint) event->mgesture.numFingers); + break; + + #define PRINT_DROP_EVENT(event) printf("(file='%s' timestamp=%u windowid=%u)", event->drop.file, (uint) event->drop.timestamp, (uint) event->drop.windowID) + SDL_EVENT_CASE(SDL_DROPFILE) PRINT_DROP_EVENT(event); break; + SDL_EVENT_CASE(SDL_DROPTEXT) PRINT_DROP_EVENT(event); break; + SDL_EVENT_CASE(SDL_DROPBEGIN) PRINT_DROP_EVENT(event); break; + SDL_EVENT_CASE(SDL_DROPCOMPLETE) PRINT_DROP_EVENT(event); break; + #undef PRINT_DROP_EVENT + + #define PRINT_AUDIODEV_EVENT(event) printf("(timestamp=%u which=%u iscapture=%s)", (uint) event->adevice.timestamp, (uint) event->adevice.which, event->adevice.iscapture ? "true" : "false"); + SDL_EVENT_CASE(SDL_AUDIODEVICEADDED) PRINT_AUDIODEV_EVENT(event); break; + SDL_EVENT_CASE(SDL_AUDIODEVICEREMOVED) PRINT_AUDIODEV_EVENT(event); break; + #undef PRINT_AUDIODEV_EVENT + + #undef SDL_EVENT_CASE + + default: + printf("UNKNOWN SDL EVENT #%u! (Bug? FIXME?)", (uint) event->type); + break; + } + + printf("\n"); +} +#undef uint +#endif + + + /* Public functions */ void @@ -141,12 +368,16 @@ SDL_StopEventLoop(void) SDL_disabled_events[i] = NULL; } - while (SDL_event_watchers) { - SDL_EventWatcher *tmp = SDL_event_watchers; - SDL_event_watchers = tmp->next; - SDL_free(tmp); + if (SDL_event_watchers_lock) { + SDL_DestroyMutex(SDL_event_watchers_lock); + SDL_event_watchers_lock = NULL; } - SDL_EventOK = NULL; + if (SDL_event_watchers) { + SDL_free(SDL_event_watchers); + SDL_event_watchers = NULL; + SDL_event_watchers_count = 0; + } + SDL_zero(SDL_EventOK); if (SDL_EventQ.lock) { SDL_UnlockMutex(SDL_EventQ.lock); @@ -169,9 +400,16 @@ SDL_StartEventLoop(void) #if !SDL_THREADS_DISABLED if (!SDL_EventQ.lock) { SDL_EventQ.lock = SDL_CreateMutex(); + if (SDL_EventQ.lock == NULL) { + return -1; + } } - if (SDL_EventQ.lock == NULL) { - return -1; + + if (!SDL_event_watchers_lock) { + SDL_event_watchers_lock = SDL_CreateMutex(); + if (SDL_event_watchers_lock == NULL) { + return -1; + } } #endif /* !SDL_THREADS_DISABLED */ @@ -209,6 +447,10 @@ SDL_AddEvent(SDL_Event * event) SDL_EventQ.free = entry->next; } + #ifdef SDL_DEBUG_EVENTS + SDL_DebugPrintEvent(event); + #endif + entry->event = *event; if (event->type == SDL_SYSWMEVENT) { entry->msg = *event->syswm.msg; @@ -376,7 +618,7 @@ SDL_FlushEvents(Uint32 minType, Uint32 maxType) #endif /* Lock the event queue */ - if (SDL_EventQ.lock && SDL_LockMutex(SDL_EventQ.lock) == 0) { + if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) { SDL_EventEntry *entry, *next; Uint32 type; for (entry = SDL_EventQ.head; entry; entry = next) { @@ -386,7 +628,9 @@ SDL_FlushEvents(Uint32 minType, Uint32 maxType) SDL_CutEvent(entry); } } - SDL_UnlockMutex(SDL_EventQ.lock); + if (SDL_EventQ.lock) { + SDL_UnlockMutex(SDL_EventQ.lock); + } } } @@ -458,16 +702,46 @@ SDL_WaitEventTimeout(SDL_Event * event, int timeout) int SDL_PushEvent(SDL_Event * event) { - SDL_EventWatcher *curr; - event->common.timestamp = SDL_GetTicks(); - if (SDL_EventOK && !SDL_EventOK(SDL_EventOKParam, event)) { - return 0; - } + if (SDL_EventOK.callback || SDL_event_watchers_count > 0) { + if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { + if (SDL_EventOK.callback && !SDL_EventOK.callback(SDL_EventOK.userdata, event)) { + if (SDL_event_watchers_lock) { + SDL_UnlockMutex(SDL_event_watchers_lock); + } + return 0; + } - for (curr = SDL_event_watchers; curr; curr = curr->next) { - curr->callback(curr->userdata, event); + if (SDL_event_watchers_count > 0) { + /* Make sure we only dispatch the current watcher list */ + int i, event_watchers_count = SDL_event_watchers_count; + + SDL_event_watchers_dispatching = SDL_TRUE; + for (i = 0; i < event_watchers_count; ++i) { + if (!SDL_event_watchers[i].removed) { + SDL_event_watchers[i].callback(SDL_event_watchers[i].userdata, event); + } + } + SDL_event_watchers_dispatching = SDL_FALSE; + + if (SDL_event_watchers_removed) { + for (i = SDL_event_watchers_count; i--; ) { + if (SDL_event_watchers[i].removed) { + --SDL_event_watchers_count; + if (i < SDL_event_watchers_count) { + SDL_memmove(&SDL_event_watchers[i], &SDL_event_watchers[i+1], (SDL_event_watchers_count - i) * sizeof(SDL_event_watchers[i])); + } + } + } + SDL_event_watchers_removed = SDL_FALSE; + } + } + + if (SDL_event_watchers_lock) { + SDL_UnlockMutex(SDL_event_watchers_lock); + } + } } if (SDL_PeepEvents(event, 1, SDL_ADDEVENT, 0, 0) <= 0) { @@ -482,69 +756,89 @@ SDL_PushEvent(SDL_Event * event) void SDL_SetEventFilter(SDL_EventFilter filter, void *userdata) { - /* Set filter and discard pending events */ - SDL_EventOK = NULL; - SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT); - SDL_EventOKParam = userdata; - SDL_EventOK = filter; + if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { + /* Set filter and discard pending events */ + SDL_EventOK.callback = filter; + SDL_EventOK.userdata = userdata; + SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT); + + if (SDL_event_watchers_lock) { + SDL_UnlockMutex(SDL_event_watchers_lock); + } + } } SDL_bool SDL_GetEventFilter(SDL_EventFilter * filter, void **userdata) { + SDL_EventWatcher event_ok; + + if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { + event_ok = SDL_EventOK; + + if (SDL_event_watchers_lock) { + SDL_UnlockMutex(SDL_event_watchers_lock); + } + } else { + SDL_zero(event_ok); + } + if (filter) { - *filter = SDL_EventOK; + *filter = event_ok.callback; } if (userdata) { - *userdata = SDL_EventOKParam; + *userdata = event_ok.userdata; } - return SDL_EventOK ? SDL_TRUE : SDL_FALSE; + return event_ok.callback ? SDL_TRUE : SDL_FALSE; } -/* FIXME: This is not thread-safe yet */ void SDL_AddEventWatch(SDL_EventFilter filter, void *userdata) { - SDL_EventWatcher *watcher, *tail; + if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { + SDL_EventWatcher *event_watchers; - watcher = (SDL_EventWatcher *)SDL_malloc(sizeof(*watcher)); - if (!watcher) { - /* Uh oh... */ - return; - } + event_watchers = SDL_realloc(SDL_event_watchers, (SDL_event_watchers_count + 1) * sizeof(*event_watchers)); + if (event_watchers) { + SDL_EventWatcher *watcher; - /* create the watcher */ - watcher->callback = filter; - watcher->userdata = userdata; - watcher->next = NULL; - - /* add the watcher to the end of the list */ - if (SDL_event_watchers) { - for (tail = SDL_event_watchers; tail->next; tail = tail->next) { - continue; + SDL_event_watchers = event_watchers; + watcher = &SDL_event_watchers[SDL_event_watchers_count]; + watcher->callback = filter; + watcher->userdata = userdata; + watcher->removed = SDL_FALSE; + ++SDL_event_watchers_count; + } + + if (SDL_event_watchers_lock) { + SDL_UnlockMutex(SDL_event_watchers_lock); } - tail->next = watcher; - } else { - SDL_event_watchers = watcher; } } -/* FIXME: This is not thread-safe yet */ void SDL_DelEventWatch(SDL_EventFilter filter, void *userdata) { - SDL_EventWatcher *prev = NULL; - SDL_EventWatcher *curr; + if (!SDL_event_watchers_lock || SDL_LockMutex(SDL_event_watchers_lock) == 0) { + int i; - for (curr = SDL_event_watchers; curr; prev = curr, curr = curr->next) { - if (curr->callback == filter && curr->userdata == userdata) { - if (prev) { - prev->next = curr->next; - } else { - SDL_event_watchers = curr->next; + for (i = 0; i < SDL_event_watchers_count; ++i) { + if (SDL_event_watchers[i].callback == filter && SDL_event_watchers[i].userdata == userdata) { + if (SDL_event_watchers_dispatching) { + SDL_event_watchers[i].removed = SDL_TRUE; + SDL_event_watchers_removed = SDL_TRUE; + } else { + --SDL_event_watchers_count; + if (i < SDL_event_watchers_count) { + SDL_memmove(&SDL_event_watchers[i], &SDL_event_watchers[i+1], (SDL_event_watchers_count - i) * sizeof(SDL_event_watchers[i])); + } + } + break; } - SDL_free(curr); - break; + } + + if (SDL_event_watchers_lock) { + SDL_UnlockMutex(SDL_event_watchers_lock); } } } @@ -552,7 +846,7 @@ SDL_DelEventWatch(SDL_EventFilter filter, void *userdata) void SDL_FilterEvents(SDL_EventFilter filter, void *userdata) { - if (SDL_EventQ.lock && SDL_LockMutex(SDL_EventQ.lock) == 0) { + if (!SDL_EventQ.lock || SDL_LockMutex(SDL_EventQ.lock) == 0) { SDL_EventEntry *entry, *next; for (entry = SDL_EventQ.head; entry; entry = next) { next = entry->next; @@ -560,7 +854,9 @@ SDL_FilterEvents(SDL_EventFilter filter, void *userdata) SDL_CutEvent(entry); } } - SDL_UnlockMutex(SDL_EventQ.lock); + if (SDL_EventQ.lock) { + SDL_UnlockMutex(SDL_EventQ.lock); + } } } diff --git a/Engine/lib/sdl/src/events/SDL_events_c.h b/Engine/lib/sdl/src/events/SDL_events_c.h index 2e3319047..b1bd277e7 100644 --- a/Engine/lib/sdl/src/events/SDL_events_c.h +++ b/Engine/lib/sdl/src/events/SDL_events_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -46,8 +46,4 @@ extern void SDL_QuitQuit(void); extern void SDL_SendPendingQuit(void); -/* The event filter function */ -extern SDL_EventFilter SDL_EventOK; -extern void *SDL_EventOKParam; - /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/events/SDL_gesture.c b/Engine/lib/sdl/src/events/SDL_gesture.c index 43914202c..c3b73e022 100644 --- a/Engine/lib/sdl/src/events/SDL_gesture.c +++ b/Engine/lib/sdl/src/events/SDL_gesture.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -71,9 +71,9 @@ typedef struct { SDL_bool recording; } SDL_GestureTouch; -SDL_GestureTouch *SDL_gestureTouch; -int SDL_numGestureTouches = 0; -SDL_bool recordAll; +static SDL_GestureTouch *SDL_gestureTouch; +static int SDL_numGestureTouches = 0; +static SDL_bool recordAll; #if 0 static void PrintPath(SDL_FloatPoint *path) @@ -101,6 +101,12 @@ int SDL_RecordGesture(SDL_TouchID touchId) return (touchId < 0); } +void SDL_GestureQuit() +{ + SDL_free(SDL_gestureTouch); + SDL_gestureTouch = NULL; +} + static unsigned long SDL_HashDollar(SDL_FloatPoint* points) { unsigned long hash = 5381; @@ -374,7 +380,7 @@ static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points) dist += d; } if (numPoints < DOLLARNPOINTS-1) { - SDL_SetError("ERROR: NumPoints = %i\n",numPoints); + SDL_SetError("ERROR: NumPoints = %i", numPoints); return 0; } /* copy the last point */ @@ -457,6 +463,28 @@ int SDL_GestureAddTouch(SDL_TouchID touchId) return 0; } +int SDL_GestureDelTouch(SDL_TouchID touchId) +{ + int i; + for (i = 0; i < SDL_numGestureTouches; i++) { + if (SDL_gestureTouch[i].id == touchId) { + break; + } + } + + if (i == SDL_numGestureTouches) { + /* not found */ + return -1; + } + + SDL_free(SDL_gestureTouch[i].dollarTemplate); + SDL_zero(SDL_gestureTouch[i]); + + SDL_numGestureTouches--; + SDL_memcpy(&SDL_gestureTouch[i], &SDL_gestureTouch[SDL_numGestureTouches], sizeof(SDL_gestureTouch[i])); + return 0; +} + static SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id) { int i; @@ -468,7 +496,7 @@ static SDL_GestureTouch * SDL_GetGestureTouch(SDL_TouchID id) return NULL; } -int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist) +static int SDL_SendGestureMulti(SDL_GestureTouch* touch,float dTheta,float dDist) { SDL_Event event; event.mgesture.type = SDL_MULTIGESTURE; diff --git a/Engine/lib/sdl/src/events/SDL_gesture_c.h b/Engine/lib/sdl/src/events/SDL_gesture_c.h index 3ff542cbb..b8e4427f0 100644 --- a/Engine/lib/sdl/src/events/SDL_gesture_c.h +++ b/Engine/lib/sdl/src/events/SDL_gesture_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,15 +20,16 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_gesture_c_h -#define _SDL_gesture_c_h +#ifndef SDL_gesture_c_h_ +#define SDL_gesture_c_h_ extern int SDL_GestureAddTouch(SDL_TouchID touchId); +extern int SDL_GestureDelTouch(SDL_TouchID touchId); extern void SDL_GestureProcessEvent(SDL_Event* event); -extern int SDL_RecordGesture(SDL_TouchID touchId); +extern void SDL_GestureQuit(void); -#endif /* _SDL_gesture_c_h */ +#endif /* SDL_gesture_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/events/SDL_keyboard.c b/Engine/lib/sdl/src/events/SDL_keyboard.c index 15726545c..e1295764e 100644 --- a/Engine/lib/sdl/src/events/SDL_keyboard.c +++ b/Engine/lib/sdl/src/events/SDL_keyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -273,6 +273,10 @@ static const SDL_Keycode SDL_default_keymap[SDL_NUM_SCANCODES] = { SDLK_KBDILLUMUP, SDLK_EJECT, SDLK_SLEEP, + SDLK_APP1, + SDLK_APP2, + SDLK_AUDIOREWIND, + SDLK_AUDIOFASTFORWARD, }; static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = { @@ -505,6 +509,10 @@ static const char *SDL_scancode_names[SDL_NUM_SCANCODES] = { "KBDIllumUp", "Eject", "Sleep", + "App1", + "App2", + "AudioRewind", + "AudioFastForward", }; /* Taken from SDL_iconv() */ @@ -569,7 +577,7 @@ SDL_ResetKeyboard(void) #ifdef DEBUG_KEYBOARD printf("Resetting keyboard\n"); #endif - for (scancode = 0; scancode < SDL_NUM_SCANCODES; ++scancode) { + for (scancode = (SDL_Scancode) 0; scancode < SDL_NUM_SCANCODES; ++scancode) { if (keyboard->keystate[scancode] == SDL_PRESSED) { SDL_SendKeyboardKey(SDL_RELEASED, scancode); } @@ -586,12 +594,22 @@ void SDL_SetKeymap(int start, SDL_Keycode * keys, int length) { SDL_Keyboard *keyboard = &SDL_keyboard; + SDL_Scancode scancode; if (start < 0 || start + length > SDL_NUM_SCANCODES) { return; } SDL_memcpy(&keyboard->keymap[start], keys, sizeof(*keys) * length); + + /* The number key scancodes always map to the number key keycodes. + * On AZERTY layouts these technically are symbols, but users (and games) + * always think of them and view them in UI as number keys. + */ + keyboard->keymap[SDL_SCANCODE_0] = SDLK_0; + for (scancode = SDL_SCANCODE_1; scancode <= SDL_SCANCODE_9; ++scancode) { + keyboard->keymap[scancode] = SDLK_1 + (scancode - SDL_SCANCODE_1); + } } void @@ -664,7 +682,6 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode) int posted; SDL_Keymod modifier; SDL_Keycode keycode; - Uint16 modstate; Uint32 type; Uint8 repeat; @@ -737,7 +754,6 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode) break; } if (SDL_KEYDOWN == type) { - modstate = keyboard->modstate; switch (keycode) { case SDLK_NUMLOCKCLEAR: keyboard->modstate ^= KMOD_NUM; @@ -751,7 +767,6 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode) } } else { keyboard->modstate &= ~modifier; - modstate = keyboard->modstate; } /* Post the event, if desired */ @@ -763,7 +778,7 @@ SDL_SendKeyboardKey(Uint8 state, SDL_Scancode scancode) event.key.repeat = repeat; event.key.keysym.scancode = scancode; event.key.keysym.sym = keycode; - event.key.keysym.mod = modstate; + event.key.keysym.mod = keyboard->modstate; event.key.windowID = keyboard->focus ? keyboard->focus->id : 0; posted = (SDL_PushEvent(&event) > 0); } @@ -834,7 +849,7 @@ SDL_GetModState(void) { SDL_Keyboard *keyboard = &SDL_keyboard; - return keyboard->modstate; + return (SDL_Keymod) keyboard->modstate; } void @@ -863,7 +878,7 @@ SDL_GetKeyFromScancode(SDL_Scancode scancode) { SDL_Keyboard *keyboard = &SDL_keyboard; - if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) { + if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) { SDL_InvalidParamError("scancode"); return 0; } @@ -890,7 +905,7 @@ const char * SDL_GetScancodeName(SDL_Scancode scancode) { const char *name; - if (scancode < SDL_SCANCODE_UNKNOWN || scancode >= SDL_NUM_SCANCODES) { + if (((int)scancode) < ((int)SDL_SCANCODE_UNKNOWN) || scancode >= SDL_NUM_SCANCODES) { SDL_InvalidParamError("scancode"); return ""; } @@ -968,8 +983,10 @@ SDL_GetKeyFromName(const char *name) { SDL_Keycode key; - /* Check input */ - if (name == NULL) return SDLK_UNKNOWN; + /* Check input */ + if (name == NULL) { + return SDLK_UNKNOWN; + } /* If it's a single UTF-8 character, then that's the keycode itself */ key = *(const unsigned char *)name; diff --git a/Engine/lib/sdl/src/events/SDL_keyboard_c.h b/Engine/lib/sdl/src/events/SDL_keyboard_c.h index b4d1c0739..7f12a382a 100644 --- a/Engine/lib/sdl/src/events/SDL_keyboard_c.h +++ b/Engine/lib/sdl/src/events/SDL_keyboard_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_keyboard_c_h -#define _SDL_keyboard_c_h +#ifndef SDL_keyboard_c_h_ +#define SDL_keyboard_c_h_ #include "SDL_keycode.h" #include "SDL_events.h" @@ -65,6 +65,6 @@ extern char *SDL_UCS4ToUTF8(Uint32 ch, char *dst); /* Toggle on or off pieces of the keyboard mod state. */ extern void SDL_ToggleModState(const SDL_Keymod modstate, const SDL_bool toggle); -#endif /* _SDL_keyboard_c_h */ +#endif /* SDL_keyboard_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/events/SDL_mouse.c b/Engine/lib/sdl/src/events/SDL_mouse.c index 4236a9901..4f4e62f87 100644 --- a/Engine/lib/sdl/src/events/SDL_mouse.c +++ b/Engine/lib/sdl/src/events/SDL_mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,7 +27,6 @@ #include "SDL_timer.h" #include "SDL_events.h" #include "SDL_events_c.h" -#include "default_cursor.h" #include "../video/SDL_sysvideo.h" /* #define DEBUG_MOUSE */ @@ -40,12 +39,59 @@ static int SDL_double_click_radius = 1; static int SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y); +static void SDLCALL +SDL_MouseNormalSpeedScaleChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_Mouse *mouse = (SDL_Mouse *)userdata; + + if (hint && *hint) { + mouse->normal_speed_scale = (float)SDL_atof(hint); + } else { + mouse->normal_speed_scale = 1.0f; + } +} + +static void SDLCALL +SDL_MouseRelativeSpeedScaleChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_Mouse *mouse = (SDL_Mouse *)userdata; + + if (hint && *hint) { + mouse->relative_speed_scale = (float)SDL_atof(hint); + } else { + mouse->relative_speed_scale = 1.0f; + } +} + +static void SDLCALL +SDL_TouchMouseEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_Mouse *mouse = (SDL_Mouse *)userdata; + + if (hint && (*hint == '0' || SDL_strcasecmp(hint, "false") == 0)) { + mouse->touch_mouse_events = SDL_FALSE; + } else { + mouse->touch_mouse_events = SDL_TRUE; + } +} + /* Public functions */ int SDL_MouseInit(void) { SDL_Mouse *mouse = SDL_GetMouse(); + SDL_zerop(mouse); + + SDL_AddHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE, + SDL_MouseNormalSpeedScaleChanged, mouse); + + SDL_AddHintCallback(SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE, + SDL_MouseRelativeSpeedScaleChanged, mouse); + + SDL_AddHintCallback(SDL_HINT_TOUCH_MOUSE_EVENTS, + SDL_TouchMouseEventsChanged, mouse); + mouse->cursor_shown = SDL_TRUE; return (0); @@ -82,6 +128,7 @@ SDL_GetMouseFocus(void) return mouse->focus; } +#if 0 void SDL_ResetMouse(void) { @@ -98,6 +145,7 @@ SDL_ResetMouse(void) } SDL_assert(mouse->buttonstate == 0); } +#endif void SDL_SetMouseFocus(SDL_Window * window) @@ -126,6 +174,7 @@ SDL_SetMouseFocus(SDL_Window * window) } mouse->focus = window; + mouse->has_position = SDL_FALSE; if (mouse->focus) { SDL_SendWindowEvent(mouse->focus, SDL_WINDOWEVENT_ENTER, 0, 0); @@ -176,10 +225,10 @@ SDL_UpdateMouseFocus(SDL_Window * window, int x, int y, Uint32 buttonstate) if (window != mouse->focus) { #ifdef DEBUG_MOUSE - printf("Mouse entered window, synthesizing focus gain & move event\n"); + printf("Mouse entered window, synthesizing focus gain & move event\n"); #endif - SDL_SetMouseFocus(window); - SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y); + SDL_SetMouseFocus(window); + SDL_PrivateSendMouseMotion(window, mouse->mouseID, 0, x, y); } return SDL_TRUE; } @@ -197,6 +246,21 @@ SDL_SendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int return SDL_PrivateSendMouseMotion(window, mouseID, relative, x, y); } +static int +GetScaledMouseDelta(float scale, int value, float *accum) +{ + if (scale != 1.0f) { + *accum += scale * value; + if (*accum >= 0.0f) { + value = (int)SDL_floor(*accum); + } else { + value = (int)SDL_ceil(*accum); + } + *accum -= value; + } + return value; +} + static int SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relative, int x, int y) { @@ -205,7 +269,11 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ int xrel; int yrel; - if (mouse->relative_mode_warp) { + if (mouseID == SDL_TOUCH_MOUSEID && !mouse->touch_mouse_events) { + return 0; + } + + if (mouseID != SDL_TOUCH_MOUSEID && mouse->relative_mode_warp) { int center_x = 0, center_y = 0; SDL_GetWindowSize(window, ¢er_x, ¢er_y); center_x /= 2; @@ -219,6 +287,13 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ } if (relative) { + if (mouse->relative_mode) { + x = GetScaledMouseDelta(mouse->relative_speed_scale, x, &mouse->scale_accum_x); + y = GetScaledMouseDelta(mouse->relative_speed_scale, y, &mouse->scale_accum_y); + } else { + x = GetScaledMouseDelta(mouse->normal_speed_scale, x, &mouse->scale_accum_x); + y = GetScaledMouseDelta(mouse->normal_speed_scale, y, &mouse->scale_accum_y); + } xrel = x; yrel = y; x = (mouse->last_x + xrel); @@ -236,6 +311,19 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ return 0; } + /* Ignore relative motion when first positioning the mouse */ + if (!mouse->has_position) { + xrel = 0; + yrel = 0; + mouse->has_position = SDL_TRUE; + } + + /* Ignore relative motion positioning the first touch */ + if (mouseID == SDL_TOUCH_MOUSEID && !mouse->buttonstate) { + xrel = 0; + yrel = 0; + } + /* Update internal mouse coordinates */ if (!mouse->relative_mode) { mouse->x = x; @@ -250,7 +338,7 @@ SDL_PrivateSendMouseMotion(SDL_Window * window, SDL_MouseID mouseID, int relativ if (window && ((window->flags & SDL_WINDOW_MOUSE_CAPTURE) == 0)) { int x_max = 0, y_max = 0; - // !!! FIXME: shouldn't this be (window) instead of (mouse->focus)? + /* !!! FIXME: shouldn't this be (window) instead of (mouse->focus)? */ SDL_GetWindowSize(mouse->focus, &x_max, &y_max); --x_max; --y_max; @@ -330,6 +418,10 @@ SDL_PrivateSendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state Uint32 type; Uint32 buttonstate = mouse->buttonstate; + if (mouseID == SDL_TOUCH_MOUSEID && !mouse->touch_mouse_events) { + return 0; + } + /* Figure out which event to perform */ switch (state) { case SDL_PRESSED: @@ -417,10 +509,11 @@ SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 } int -SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_MouseWheelDirection direction) +SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction) { SDL_Mouse *mouse = SDL_GetMouse(); int posted; + int integral_x, integral_y; if (window) { SDL_SetMouseFocus(window); @@ -430,6 +523,26 @@ SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_M return 0; } + mouse->accumulated_wheel_x += x; + if (mouse->accumulated_wheel_x > 0) { + integral_x = (int)SDL_floor(mouse->accumulated_wheel_x); + } else if (mouse->accumulated_wheel_x < 0) { + integral_x = (int)SDL_ceil(mouse->accumulated_wheel_x); + } else { + integral_x = 0; + } + mouse->accumulated_wheel_x -= integral_x; + + mouse->accumulated_wheel_y += y; + if (mouse->accumulated_wheel_y > 0) { + integral_y = (int)SDL_floor(mouse->accumulated_wheel_y); + } else if (mouse->accumulated_wheel_y < 0) { + integral_y = (int)SDL_ceil(mouse->accumulated_wheel_y); + } else { + integral_y = 0; + } + mouse->accumulated_wheel_y -= integral_y; + /* Post the event, if desired */ posted = 0; if (SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE) { @@ -437,8 +550,12 @@ SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_M event.type = SDL_MOUSEWHEEL; event.wheel.windowID = mouse->focus ? mouse->focus->id : 0; event.wheel.which = mouseID; - event.wheel.x = x; - event.wheel.y = y; +#if 0 /* Uncomment this when it goes in for SDL 2.1 */ + event.wheel.preciseX = x; + event.wheel.preciseY = y; +#endif + event.wheel.x = integral_x; + event.wheel.y = integral_y; event.wheel.direction = (Uint32)direction; posted = (SDL_PushEvent(&event) > 0); } @@ -463,16 +580,23 @@ SDL_MouseQuit(void) SDL_FreeCursor(cursor); cursor = next; } + mouse->cursors = NULL; if (mouse->def_cursor && mouse->FreeCursor) { mouse->FreeCursor(mouse->def_cursor); + mouse->def_cursor = NULL; } if (mouse->clickstate) { SDL_free(mouse->clickstate); + mouse->clickstate = NULL; } - SDL_zerop(mouse); + SDL_DelHintCallback(SDL_HINT_MOUSE_NORMAL_SPEED_SCALE, + SDL_MouseNormalSpeedScaleChanged, mouse); + + SDL_DelHintCallback(SDL_HINT_MOUSE_RELATIVE_SPEED_SCALE, + SDL_MouseRelativeSpeedScaleChanged, mouse); } Uint32 @@ -522,7 +646,6 @@ SDL_GetGlobalMouseState(int *x, int *y) *x = *y = 0; if (!mouse->GetGlobalMouseState) { - SDL_assert(0 && "This should really be implemented for every target."); return 0; } @@ -601,6 +724,8 @@ SDL_SetRelativeMouseMode(SDL_bool enabled) } } mouse->relative_mode = enabled; + mouse->scale_accum_x = 0.0f; + mouse->scale_accum_y = 0.0f; if (mouse->focus) { SDL_UpdateWindowGrab(mouse->focus); diff --git a/Engine/lib/sdl/src/events/SDL_mouse_c.h b/Engine/lib/sdl/src/events/SDL_mouse_c.h index 06dc88701..28089e0c4 100644 --- a/Engine/lib/sdl/src/events/SDL_mouse_c.h +++ b/Engine/lib/sdl/src/events/SDL_mouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_mouse_c_h -#define _SDL_mouse_c_h +#ifndef SDL_mouse_c_h_ +#define SDL_mouse_c_h_ #include "SDL_mouse.h" @@ -80,9 +80,17 @@ typedef struct int xdelta; int ydelta; int last_x, last_y; /* the last reported x and y coordinates */ + float accumulated_wheel_x; + float accumulated_wheel_y; Uint32 buttonstate; + SDL_bool has_position; SDL_bool relative_mode; SDL_bool relative_mode_warp; + float normal_speed_scale; + float relative_speed_scale; + float scale_accum_x; + float scale_accum_y; + SDL_bool touch_mouse_events; /* Data for double-click tracking */ int num_clickstates; @@ -123,11 +131,11 @@ extern int SDL_SendMouseButton(SDL_Window * window, SDL_MouseID mouseID, Uint8 s extern int SDL_SendMouseButtonClicks(SDL_Window * window, SDL_MouseID mouseID, Uint8 state, Uint8 button, int clicks); /* Send a mouse wheel event */ -extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, int x, int y, SDL_MouseWheelDirection direction); +extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction); /* Shutdown the mouse subsystem */ extern void SDL_MouseQuit(void); -#endif /* _SDL_mouse_c_h */ +#endif /* SDL_mouse_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/events/SDL_quit.c b/Engine/lib/sdl/src/events/SDL_quit.c index 3cb6b3d4f..2b24efe3c 100644 --- a/Engine/lib/sdl/src/events/SDL_quit.c +++ b/Engine/lib/sdl/src/events/SDL_quit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -55,7 +55,7 @@ SDL_QuitInit_Internal(void) struct sigaction action; sigaction(SIGINT, NULL, &action); #ifdef HAVE_SA_SIGACTION - if ( action.sa_handler == SIG_DFL && action.sa_sigaction == (void*)SIG_DFL ) { + if ( action.sa_handler == SIG_DFL && (void (*)(int))action.sa_sigaction == SIG_DFL ) { #else if ( action.sa_handler == SIG_DFL ) { #endif @@ -65,7 +65,7 @@ SDL_QuitInit_Internal(void) sigaction(SIGTERM, NULL, &action); #ifdef HAVE_SA_SIGACTION - if ( action.sa_handler == SIG_DFL && action.sa_sigaction == (void*)SIG_DFL ) { + if ( action.sa_handler == SIG_DFL && (void (*)(int))action.sa_sigaction == SIG_DFL ) { #else if ( action.sa_handler == SIG_DFL ) { #endif diff --git a/Engine/lib/sdl/src/events/SDL_sysevents.h b/Engine/lib/sdl/src/events/SDL_sysevents.h index c4ce08764..3d9ab922d 100644 --- a/Engine/lib/sdl/src/events/SDL_sysevents.h +++ b/Engine/lib/sdl/src/events/SDL_sysevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/events/SDL_touch.c b/Engine/lib/sdl/src/events/SDL_touch.c index c73827c96..003741644 100644 --- a/Engine/lib/sdl/src/events/SDL_touch.c +++ b/Engine/lib/sdl/src/events/SDL_touch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,6 +25,7 @@ #include "SDL_assert.h" #include "SDL_events.h" #include "SDL_events_c.h" +#include "../video/SDL_sysvideo.h" static int SDL_num_touch = 0; @@ -48,7 +49,7 @@ SDL_TouchID SDL_GetTouchDevice(int index) { if (index < 0 || index >= SDL_num_touch) { - SDL_SetError("Unknown touch device"); + SDL_SetError("Unknown touch device index %d", index); return 0; } return SDL_touchDevices[index]->id; @@ -74,7 +75,12 @@ SDL_GetTouch(SDL_TouchID id) { int index = SDL_GetTouchIndex(id); if (index < 0 || index >= SDL_num_touch) { - SDL_SetError("Unknown touch device"); + if (SDL_GetVideoDevice()->ResetTouch != NULL) { + SDL_SetError("Unknown touch id %d, resetting", (int) id); + (SDL_GetVideoDevice()->ResetTouch)(SDL_GetVideoDevice()); + } else { + SDL_SetError("Unknown touch device id %d, cannot reset", (int) id); + } return NULL; } return SDL_touchDevices[index]; @@ -92,7 +98,7 @@ SDL_GetFingerIndex(const SDL_Touch * touch, SDL_FingerID fingerid) return -1; } -SDL_Finger * +static SDL_Finger * SDL_GetFinger(const SDL_Touch * touch, SDL_FingerID id) { int index = SDL_GetFingerIndex(touch, id); @@ -346,6 +352,9 @@ SDL_DelTouch(SDL_TouchID id) SDL_num_touch--; SDL_touchDevices[index] = SDL_touchDevices[SDL_num_touch]; + + /* Delete this touch device for gestures */ + SDL_GestureDelTouch(id); } void @@ -360,6 +369,7 @@ SDL_TouchQuit(void) SDL_free(SDL_touchDevices); SDL_touchDevices = NULL; + SDL_GestureQuit(); } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/events/SDL_touch_c.h b/Engine/lib/sdl/src/events/SDL_touch_c.h index d025df6e8..2a4431026 100644 --- a/Engine/lib/sdl/src/events/SDL_touch_c.h +++ b/Engine/lib/sdl/src/events/SDL_touch_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../SDL_internal.h" #include "../../include/SDL_touch.h" -#ifndef _SDL_touch_c_h -#define _SDL_touch_c_h +#ifndef SDL_touch_c_h_ +#define SDL_touch_c_h_ typedef struct SDL_Touch { @@ -56,6 +56,6 @@ extern void SDL_DelTouch(SDL_TouchID id); /* Shutdown the touch subsystem */ extern void SDL_TouchQuit(void); -#endif /* _SDL_touch_c_h */ +#endif /* SDL_touch_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/events/SDL_windowevents.c b/Engine/lib/sdl/src/events/SDL_windowevents.c index b45015bd0..610fad5ce 100644 --- a/Engine/lib/sdl/src/events/SDL_windowevents.c +++ b/Engine/lib/sdl/src/events/SDL_windowevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,7 @@ #include "../video/SDL_sysvideo.h" -static int +static int SDLCALL RemovePendingResizedEvents(void * userdata, SDL_Event *event) { SDL_Event *new_event = (SDL_Event *)userdata; @@ -42,7 +42,7 @@ RemovePendingResizedEvents(void * userdata, SDL_Event *event) return 1; } -static int +static int SDLCALL RemovePendingSizeChangedEvents(void * userdata, SDL_Event *event) { SDL_Event *new_event = (SDL_Event *)userdata; @@ -56,7 +56,7 @@ RemovePendingSizeChangedEvents(void * userdata, SDL_Event *event) return 1; } -static int +static int SDLCALL RemovePendingMoveEvents(void * userdata, SDL_Event *event) { SDL_Event *new_event = (SDL_Event *)userdata; @@ -70,7 +70,7 @@ RemovePendingMoveEvents(void * userdata, SDL_Event *event) return 1; } -static int +static int SDLCALL RemovePendingExposedEvents(void * userdata, SDL_Event *event) { SDL_Event *new_event = (SDL_Event *)userdata; diff --git a/Engine/lib/sdl/src/events/SDL_windowevents_c.h b/Engine/lib/sdl/src/events/SDL_windowevents_c.h index 2a6a4c051..a529a1131 100644 --- a/Engine/lib/sdl/src/events/SDL_windowevents_c.h +++ b/Engine/lib/sdl/src/events/SDL_windowevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,12 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_windowevents_c_h -#define _SDL_windowevents_c_h +#ifndef SDL_windowevents_c_h_ +#define SDL_windowevents_c_h_ extern int SDL_SendWindowEvent(SDL_Window * window, Uint8 windowevent, int data1, int data2); -#endif /* _SDL_windowevents_c_h */ +#endif /* SDL_windowevents_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/events/blank_cursor.h b/Engine/lib/sdl/src/events/blank_cursor.h index 5e15852cb..bc1bffa85 100644 --- a/Engine/lib/sdl/src/events/blank_cursor.h +++ b/Engine/lib/sdl/src/events/blank_cursor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/events/default_cursor.h b/Engine/lib/sdl/src/events/default_cursor.h index 297dd2dc1..27e82ff73 100644 --- a/Engine/lib/sdl/src/events/default_cursor.h +++ b/Engine/lib/sdl/src/events/default_cursor.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/events/scancodes_darwin.h b/Engine/lib/sdl/src/events/scancodes_darwin.h index 269225309..7848d86f4 100644 --- a/Engine/lib/sdl/src/events/scancodes_darwin.h +++ b/Engine/lib/sdl/src/events/scancodes_darwin.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/events/scancodes_linux.h b/Engine/lib/sdl/src/events/scancodes_linux.h index e197ee3fe..3fec4b597 100644 --- a/Engine/lib/sdl/src/events/scancodes_linux.h +++ b/Engine/lib/sdl/src/events/scancodes_linux.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -194,7 +194,7 @@ static SDL_Scancode const linux_scancode_table[] = { /* 165 */ SDL_SCANCODE_AUDIOPREV, /* KEY_PREVIOUSSONG */ /* 166 */ SDL_SCANCODE_AUDIOSTOP, /* KEY_STOPCD */ /* 167 */ SDL_SCANCODE_UNKNOWN, /* KEY_RECORD */ - /* 168 */ SDL_SCANCODE_UNKNOWN, /* KEY_REWIND */ + /* 168 */ SDL_SCANCODE_AUDIOREWIND, /* KEY_REWIND */ /* 169 */ SDL_SCANCODE_UNKNOWN, /* KEY_PHONE */ /* 170 */ SDL_SCANCODE_UNKNOWN, /* KEY_ISO */ /* 171 */ SDL_SCANCODE_UNKNOWN, /* KEY_CONFIG */ @@ -230,7 +230,7 @@ static SDL_Scancode const linux_scancode_table[] = { /* 205 */ SDL_SCANCODE_UNKNOWN, /* KEY_SUSPEND */ /* 206 */ SDL_SCANCODE_UNKNOWN, /* KEY_CLOSE */ /* 207 */ SDL_SCANCODE_UNKNOWN, /* KEY_PLAY */ - /* 208 */ SDL_SCANCODE_UNKNOWN, /* KEY_FASTFORWARD */ + /* 208 */ SDL_SCANCODE_AUDIOFASTFORWARD, /* KEY_FASTFORWARD */ /* 209 */ SDL_SCANCODE_UNKNOWN, /* KEY_BASSBOOST */ /* 210 */ SDL_SCANCODE_UNKNOWN, /* KEY_PRINT */ /* 211 */ SDL_SCANCODE_UNKNOWN, /* KEY_HP */ diff --git a/Engine/lib/sdl/src/events/scancodes_windows.h b/Engine/lib/sdl/src/events/scancodes_windows.h index b23a261ea..f8eed1b9c 100644 --- a/Engine/lib/sdl/src/events/scancodes_windows.h +++ b/Engine/lib/sdl/src/events/scancodes_windows.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/events/scancodes_xfree86.h b/Engine/lib/sdl/src/events/scancodes_xfree86.h index 804196ca4..7d1f844b0 100644 --- a/Engine/lib/sdl/src/events/scancodes_xfree86.h +++ b/Engine/lib/sdl/src/events/scancodes_xfree86.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -345,7 +345,7 @@ static const SDL_Scancode xfree86_scancode_table2[] = { /* 165 */ SDL_SCANCODE_AUDIOPREV, /* 166 */ SDL_SCANCODE_AUDIOSTOP, /* 167 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioRecord */ - /* 168 */ SDL_SCANCODE_UNKNOWN, /* XF86AudioRewind */ + /* 168 */ SDL_SCANCODE_AUDIOREWIND, /* XF86AudioRewind */ /* 169 */ SDL_SCANCODE_UNKNOWN, /* XF86Phone */ /* 170 */ SDL_SCANCODE_UNKNOWN, /* 171 */ SDL_SCANCODE_F13, /* XF86Tools */ diff --git a/Engine/lib/sdl/src/file/SDL_rwops.c b/Engine/lib/sdl/src/file/SDL_rwops.c index 38beb6285..cf5d3aa0b 100644 --- a/Engine/lib/sdl/src/file/SDL_rwops.c +++ b/Engine/lib/sdl/src/file/SDL_rwops.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,14 +18,27 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ + +/* We won't get fseeko64 on QNX if _LARGEFILE64_SOURCE is defined, but the + configure script knows the C runtime has it and enables it. */ +#ifndef __QNXNTO__ /* Need this so Linux systems define fseek64o, ftell64o and off64_t */ #define _LARGEFILE64_SOURCE +#endif + #include "../SDL_internal.h" #if defined(__WIN32__) #include "../core/windows/SDL_windows.h" #endif +#ifdef HAVE_STDIO_H +#include +#endif + +#ifdef HAVE_LIMITS_H +#include +#endif /* This file provides a general interface for SDL to read and write data sources. It can easily be extended to files, memory, etc. @@ -292,6 +305,42 @@ windows_file_close(SDL_RWops * context) #ifdef HAVE_STDIO_H +#ifdef HAVE_FOPEN64 +#define fopen fopen64 +#endif +#ifdef HAVE_FSEEKO64 +#define fseek_off_t off64_t +#define fseek fseeko64 +#define ftell ftello64 +#elif defined(HAVE_FSEEKO) +#if defined(OFF_MIN) && defined(OFF_MAX) +#define FSEEK_OFF_MIN OFF_MIN +#define FSEEK_OFF_MAX OFF_MAX +#elif defined(HAVE_LIMITS_H) +/* POSIX doesn't specify the minimum and maximum macros for off_t so + * we have to improvise and dance around implementation-defined + * behavior. This may fail if the off_t type has padding bits or + * is not a two's-complement representation. The compilers will detect + * and eliminate the dead code if off_t has 64 bits. + */ +#define FSEEK_OFF_MAX (((((off_t)1 << (sizeof(off_t) * CHAR_BIT - 2)) - 1) << 1) + 1) +#define FSEEK_OFF_MIN (-(FSEEK_OFF_MAX) - 1) +#endif +#define fseek_off_t off_t +#define fseek fseeko +#define ftell ftello +#elif defined(HAVE__FSEEKI64) +#define fseek_off_t __int64 +#define fseek _fseeki64 +#define ftell _ftelli64 +#else +#ifdef HAVE_LIMITS_H +#define FSEEK_OFF_MIN LONG_MIN +#define FSEEK_OFF_MAX LONG_MAX +#endif +#define fseek_off_t long +#endif + /* Functions to read/write stdio file pointers */ static Sint64 SDLCALL @@ -312,23 +361,19 @@ stdio_size(SDL_RWops * context) static Sint64 SDLCALL stdio_seek(SDL_RWops * context, Sint64 offset, int whence) { -#ifdef HAVE_FSEEKO64 - if (fseeko64(context->hidden.stdio.fp, (off64_t)offset, whence) == 0) { - return ftello64(context->hidden.stdio.fp); - } -#elif defined(HAVE_FSEEKO) - if (fseeko(context->hidden.stdio.fp, (off_t)offset, whence) == 0) { - return ftello(context->hidden.stdio.fp); - } -#elif defined(HAVE__FSEEKI64) - if (_fseeki64(context->hidden.stdio.fp, offset, whence) == 0) { - return _ftelli64(context->hidden.stdio.fp); - } -#else - if (fseek(context->hidden.stdio.fp, offset, whence) == 0) { - return ftell(context->hidden.stdio.fp); +#if defined(FSEEK_OFF_MIN) && defined(FSEEK_OFF_MAX) + if (offset < (Sint64)(FSEEK_OFF_MIN) || offset > (Sint64)(FSEEK_OFF_MAX)) { + return SDL_SetError("Seek offset out of range"); } #endif + + if (fseek(context->hidden.stdio.fp, (fseek_off_t)offset, whence) == 0) { + Sint64 pos = ftell(context->hidden.stdio.fp); + if (pos < 0) { + return SDL_SetError("Couldn't get stream offset"); + } + return pos; + } return SDL_Error(SDL_EFSEEK); } @@ -653,6 +698,59 @@ SDL_FreeRW(SDL_RWops * area) SDL_free(area); } +/* Load all the data from an SDL data stream */ +void * +SDL_LoadFile_RW(SDL_RWops * src, size_t *datasize, int freesrc) +{ + const int FILE_CHUNK_SIZE = 1024; + Sint64 size; + size_t size_read, size_total; + void *data = NULL, *newdata; + + if (!src) { + SDL_InvalidParamError("src"); + return NULL; + } + + size = SDL_RWsize(src); + if (size < 0) { + size = FILE_CHUNK_SIZE; + } + data = SDL_malloc((size_t)(size + 1)); + + size_total = 0; + for (;;) { + if ((((Sint64)size_total) + FILE_CHUNK_SIZE) > size) { + size = (size_total + FILE_CHUNK_SIZE); + newdata = SDL_realloc(data, (size_t)(size + 1)); + if (!newdata) { + SDL_free(data); + data = NULL; + SDL_OutOfMemory(); + goto done; + } + data = newdata; + } + + size_read = SDL_RWread(src, (char *)data+size_total, 1, (size_t)(size-size_total)); + if (size_read == 0) { + break; + } + size_total += size_read; + } + + if (datasize) { + *datasize = size_total; + } + ((char *)data)[size_total] = '\0'; + +done: + if (freesrc && src) { + SDL_RWclose(src); + } + return data; +} + /* Functions for dynamically reading and writing endian-specific values */ Uint8 diff --git a/Engine/lib/sdl/src/file/cocoa/SDL_rwopsbundlesupport.h b/Engine/lib/sdl/src/file/cocoa/SDL_rwopsbundlesupport.h index 2c63f1dab..64edc0d0e 100644 --- a/Engine/lib/sdl/src/file/cocoa/SDL_rwopsbundlesupport.h +++ b/Engine/lib/sdl/src/file/cocoa/SDL_rwopsbundlesupport.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/file/cocoa/SDL_rwopsbundlesupport.m b/Engine/lib/sdl/src/file/cocoa/SDL_rwopsbundlesupport.m index 3385d3aa5..8f1bf54d7 100644 --- a/Engine/lib/sdl/src/file/cocoa/SDL_rwopsbundlesupport.m +++ b/Engine/lib/sdl/src/file/cocoa/SDL_rwopsbundlesupport.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/filesystem/android/SDL_sysfilesystem.c b/Engine/lib/sdl/src/filesystem/android/SDL_sysfilesystem.c index 3bdf9966d..7f3f92d7d 100644 --- a/Engine/lib/sdl/src/filesystem/android/SDL_sysfilesystem.c +++ b/Engine/lib/sdl/src/filesystem/android/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,6 @@ /* System dependent filesystem routines */ #include -#include #include "SDL_error.h" #include "SDL_filesystem.h" @@ -37,6 +36,7 @@ char * SDL_GetBasePath(void) { /* The current working directory is / on Android */ + SDL_Unsupported(); return NULL; } diff --git a/Engine/lib/sdl/src/filesystem/cocoa/SDL_sysfilesystem.m b/Engine/lib/sdl/src/filesystem/cocoa/SDL_sysfilesystem.m index 6dee58052..6153a2086 100644 --- a/Engine/lib/sdl/src/filesystem/cocoa/SDL_sysfilesystem.m +++ b/Engine/lib/sdl/src/filesystem/cocoa/SDL_sysfilesystem.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -71,8 +71,15 @@ char * SDL_GetPrefPath(const char *org, const char *app) { @autoreleasepool { - char *retval = NULL; + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if (!org) { + org = ""; + } + char *retval = NULL; NSArray *array = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES); if ([array count] > 0) { /* we only want the first item in the list. */ @@ -85,7 +92,11 @@ SDL_GetPrefPath(const char *org, const char *app) SDL_OutOfMemory(); } else { char *ptr; - SDL_snprintf(retval, len, "%s/%s/%s/", base, org, app); + if (*org) { + SDL_snprintf(retval, len, "%s/%s/%s/", base, org, app); + } else { + SDL_snprintf(retval, len, "%s/%s/", base, app); + } for (ptr = retval+1; *ptr; ptr++) { if (*ptr == '/') { *ptr = '\0'; diff --git a/Engine/lib/sdl/src/filesystem/dummy/SDL_sysfilesystem.c b/Engine/lib/sdl/src/filesystem/dummy/SDL_sysfilesystem.c index 2570f4c75..f4628a10e 100644 --- a/Engine/lib/sdl/src/filesystem/dummy/SDL_sysfilesystem.c +++ b/Engine/lib/sdl/src/filesystem/dummy/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/filesystem/emscripten/SDL_sysfilesystem.c b/Engine/lib/sdl/src/filesystem/emscripten/SDL_sysfilesystem.c index ca49df1b9..4ba57c1a9 100644 --- a/Engine/lib/sdl/src/filesystem/emscripten/SDL_sysfilesystem.c +++ b/Engine/lib/sdl/src/filesystem/emscripten/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -46,6 +46,14 @@ SDL_GetPrefPath(const char *org, const char *app) char *retval; size_t len = 0; + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if (!org) { + org = ""; + } + len = SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3; retval = (char *) SDL_malloc(len); if (!retval) { @@ -53,7 +61,11 @@ SDL_GetPrefPath(const char *org, const char *app) return NULL; } - SDL_snprintf(retval, len, "%s%s/%s/", append, org, app); + if (*org) { + SDL_snprintf(retval, len, "%s%s/%s/", append, org, app); + } else { + SDL_snprintf(retval, len, "%s%s/", append, app); + } if (mkdir(retval, 0700) != 0 && errno != EEXIST) { SDL_SetError("Couldn't create directory '%s': '%s'", retval, strerror(errno)); diff --git a/Engine/lib/sdl/src/filesystem/haiku/SDL_sysfilesystem.cc b/Engine/lib/sdl/src/filesystem/haiku/SDL_sysfilesystem.cc index 03489168e..b56bc4bbe 100644 --- a/Engine/lib/sdl/src/filesystem/haiku/SDL_sysfilesystem.cc +++ b/Engine/lib/sdl/src/filesystem/haiku/SDL_sysfilesystem.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,10 +25,10 @@ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* System dependent filesystem routines */ -#include -#include -#include -#include +#include +#include +#include +#include #include "SDL_error.h" #include "SDL_stdinc.h" @@ -75,13 +75,30 @@ SDL_GetPrefPath(const char *org, const char *app) { // !!! FIXME: is there a better way to do this? const char *home = SDL_getenv("HOME"); - const char *append = "config/settings/"; - const size_t len = SDL_strlen(home) + SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3; + const char *append = "/config/settings/"; + size_t len = SDL_strlen(home); + + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if (!org) { + org = ""; + } + + if (!len || (home[len - 1] == '/')) { + ++append; // home empty or ends with separator, skip the one from append + } + len += SDL_strlen(append) + SDL_strlen(org) + SDL_strlen(app) + 3; char *retval = (char *) SDL_malloc(len); if (!retval) { SDL_OutOfMemory(); } else { - SDL_snprintf(retval, len, "%s%s%s/%s/", home, append, org, app); + if (*org) { + SDL_snprintf(retval, len, "%s%s%s/%s/", home, append, org, app); + } else { + SDL_snprintf(retval, len, "%s%s%s/", home, append, app); + } create_directory(retval, 0700); // Haiku api: creates missing dirs } diff --git a/Engine/lib/sdl/src/filesystem/nacl/SDL_sysfilesystem.c b/Engine/lib/sdl/src/filesystem/nacl/SDL_sysfilesystem.c index ac8fef1e3..f22ca75a6 100644 --- a/Engine/lib/sdl/src/filesystem/nacl/SDL_sysfilesystem.c +++ b/Engine/lib/sdl/src/filesystem/nacl/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,3 +40,4 @@ SDL_GetPrefPath(const char *org, const char *app) #endif /* SDL_FILESYSTEM_NACL */ +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/filesystem/unix/SDL_sysfilesystem.c b/Engine/lib/sdl/src/filesystem/unix/SDL_sysfilesystem.c index bd2e84cd1..d6af39f5b 100644 --- a/Engine/lib/sdl/src/filesystem/unix/SDL_sysfilesystem.c +++ b/Engine/lib/sdl/src/filesystem/unix/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,6 +32,7 @@ #include #include #include +#include #if defined(__FREEBSD__) || defined(__OPENBSD__) #include @@ -40,7 +41,10 @@ #include "SDL_error.h" #include "SDL_stdinc.h" #include "SDL_filesystem.h" +#include "SDL_rwops.h" +/* QNX's /proc/self/exefile is a text file and not a symlink. */ +#if !defined(__QNXNTO__) static char * readSymLink(const char *path) { @@ -72,7 +76,7 @@ readSymLink(const char *path) SDL_free(retval); return NULL; } - +#endif char * SDL_GetBasePath(void) @@ -122,13 +126,17 @@ SDL_GetBasePath(void) /* is a Linux-style /proc filesystem available? */ if (!retval && (access("/proc", F_OK) == 0)) { + /* !!! FIXME: after 2.0.6 ships, let's delete this code and just + use the /proc/%llu version. There's no reason to have + two copies of this plus all the #ifdefs. --ryan. */ #if defined(__FREEBSD__) retval = readSymLink("/proc/curproc/file"); #elif defined(__NETBSD__) retval = readSymLink("/proc/curproc/exe"); +#elif defined(__QNXNTO__) + retval = SDL_LoadFile("/proc/self/exefile", NULL); #else retval = readSymLink("/proc/self/exe"); /* linux. */ -#endif if (retval == NULL) { /* older kernels don't have /proc/self ... try PID version... */ char path[64]; @@ -139,6 +147,7 @@ SDL_GetBasePath(void) retval = readSymLink(path); } } +#endif } /* If we had access to argv[0] here, we could check it for a path, @@ -180,6 +189,14 @@ SDL_GetPrefPath(const char *org, const char *app) char *ptr = NULL; size_t len = 0; + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if (!org) { + org = ""; + } + if (!envr) { /* You end up with "$HOME/.local/share/Game Name 2" */ envr = SDL_getenv("HOME"); @@ -204,7 +221,11 @@ SDL_GetPrefPath(const char *org, const char *app) return NULL; } - SDL_snprintf(retval, len, "%s%s%s/%s/", envr, append, org, app); + if (*org) { + SDL_snprintf(retval, len, "%s%s%s/%s/", envr, append, org, app); + } else { + SDL_snprintf(retval, len, "%s%s%s/", envr, append, app); + } for (ptr = retval+1; *ptr; ptr++) { if (*ptr == '/') { diff --git a/Engine/lib/sdl/src/filesystem/windows/SDL_sysfilesystem.c b/Engine/lib/sdl/src/filesystem/windows/SDL_sysfilesystem.c index fd942d75f..52197891a 100644 --- a/Engine/lib/sdl/src/filesystem/windows/SDL_sysfilesystem.c +++ b/Engine/lib/sdl/src/filesystem/windows/SDL_sysfilesystem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -118,6 +118,14 @@ SDL_GetPrefPath(const char *org, const char *app) size_t new_wpath_len = 0; BOOL api_result = FALSE; + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if (!org) { + org = ""; + } + if (!SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, path))) { WIN_SetError("Couldn't locate our prefpath"); return NULL; @@ -145,8 +153,10 @@ SDL_GetPrefPath(const char *org, const char *app) return NULL; } - lstrcatW(path, L"\\"); - lstrcatW(path, worg); + if (*worg) { + lstrcatW(path, L"\\"); + lstrcatW(path, worg); + } SDL_free(worg); api_result = CreateDirectoryW(path, NULL); diff --git a/Engine/lib/sdl/src/filesystem/winrt/SDL_sysfilesystem.cpp b/Engine/lib/sdl/src/filesystem/winrt/SDL_sysfilesystem.cpp index b4caf9037..71818dd26 100644 --- a/Engine/lib/sdl/src/filesystem/winrt/SDL_sysfilesystem.cpp +++ b/Engine/lib/sdl/src/filesystem/winrt/SDL_sysfilesystem.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -152,6 +152,14 @@ SDL_GetPrefPath(const char *org, const char *app) size_t new_wpath_len = 0; BOOL api_result = FALSE; + if (!app) { + SDL_InvalidParamError("app"); + return NULL; + } + if (!org) { + org = ""; + } + srcPath = SDL_WinRTGetFSPathUNICODE(SDL_WINRT_PATH_LOCAL_FOLDER); if ( ! srcPath) { SDL_SetError("Unable to find a source path"); @@ -186,9 +194,11 @@ SDL_GetPrefPath(const char *org, const char *app) return NULL; } - SDL_wcslcat(path, L"\\", new_wpath_len + 1); - SDL_wcslcat(path, worg, new_wpath_len + 1); - SDL_free(worg); + if (*worg) { + SDL_wcslcat(path, L"\\", new_wpath_len + 1); + SDL_wcslcat(path, worg, new_wpath_len + 1); + SDL_free(worg); + } api_result = CreateDirectoryW(path, NULL); if (api_result == FALSE) { @@ -219,3 +229,5 @@ SDL_GetPrefPath(const char *org, const char *app) } #endif /* __WINRT__ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/haptic/SDL_haptic.c b/Engine/lib/sdl/src/haptic/SDL_haptic.c index ddce908d6..4988c30ba 100644 --- a/Engine/lib/sdl/src/haptic/SDL_haptic.c +++ b/Engine/lib/sdl/src/haptic/SDL_haptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,9 +25,9 @@ #include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */ #include "SDL_assert.h" +/* Global for SDL_windowshaptic.c */ SDL_Haptic *SDL_haptics = NULL; - /* * Initializes the Haptic devices. */ @@ -313,6 +313,7 @@ SDL_HapticOpenFromJoystick(SDL_Joystick * joystick) SDL_memset(haptic, 0, sizeof(SDL_Haptic)); haptic->rumble_id = -1; if (SDL_SYS_HapticOpenFromJoystick(haptic, joystick) < 0) { + SDL_SetError("Haptic: SDL_SYS_HapticOpenFromJoystick failed."); SDL_free(haptic); return NULL; } diff --git a/Engine/lib/sdl/src/haptic/SDL_haptic_c.h b/Engine/lib/sdl/src/haptic/SDL_haptic_c.h index 5b9372b5c..26d900d44 100644 --- a/Engine/lib/sdl/src/haptic/SDL_haptic_c.h +++ b/Engine/lib/sdl/src/haptic/SDL_haptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/haptic/SDL_syshaptic.h b/Engine/lib/sdl/src/haptic/SDL_syshaptic.h index 372cefacf..4f4cd9fef 100644 --- a/Engine/lib/sdl/src/haptic/SDL_syshaptic.h +++ b/Engine/lib/sdl/src/haptic/SDL_syshaptic.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../SDL_internal.h" -#ifndef _SDL_syshaptic_h -#define _SDL_syshaptic_h +#ifndef SDL_syshaptic_h_ +#define SDL_syshaptic_h_ #include "SDL_haptic.h" @@ -62,7 +62,7 @@ struct _SDL_Haptic extern int SDL_SYS_HapticInit(void); /* Function to return the number of haptic devices plugged in right now */ -extern int SDL_SYS_NumHaptics(); +extern int SDL_SYS_NumHaptics(void); /* * Gets the device dependent name of the haptic device @@ -203,6 +203,6 @@ extern int SDL_SYS_HapticUnpause(SDL_Haptic * haptic); */ extern int SDL_SYS_HapticStopAll(SDL_Haptic * haptic); -#endif /* _SDL_syshaptic_h */ +#endif /* SDL_syshaptic_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/haptic/android/SDL_syshaptic.c b/Engine/lib/sdl/src/haptic/android/SDL_syshaptic.c new file mode 100644 index 000000000..1fb235249 --- /dev/null +++ b/Engine/lib/sdl/src/haptic/android/SDL_syshaptic.c @@ -0,0 +1,357 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifdef SDL_HAPTIC_ANDROID + +#include "SDL_assert.h" +#include "SDL_timer.h" +#include "SDL_syshaptic_c.h" +#include "../SDL_syshaptic.h" +#include "SDL_haptic.h" +#include "../../core/android/SDL_android.h" +#include "SDL_joystick.h" +#include "../../joystick/SDL_sysjoystick.h" /* For the real SDL_Joystick */ +#include "../../joystick/android/SDL_sysjoystick_c.h" /* For joystick hwdata */ + + +typedef struct SDL_hapticlist_item +{ + int device_id; + char *name; + SDL_Haptic *haptic; + struct SDL_hapticlist_item *next; +} SDL_hapticlist_item; + +static SDL_hapticlist_item *SDL_hapticlist = NULL; +static SDL_hapticlist_item *SDL_hapticlist_tail = NULL; +static int numhaptics = 0; + + +int +SDL_SYS_HapticInit(void) +{ + /* Support for device connect/disconnect is API >= 16 only, + * so we poll every three seconds + * Ref: http://developer.android.com/reference/android/hardware/input/InputManager.InputDeviceListener.html + */ + static Uint32 timeout = 0; + if (SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { + timeout = SDL_GetTicks() + 3000; + Android_JNI_PollHapticDevices(); + } + return (numhaptics); +} + +int +SDL_SYS_NumHaptics(void) +{ + return (numhaptics); +} + +static SDL_hapticlist_item * +HapticByOrder(int index) +{ + SDL_hapticlist_item *item = SDL_hapticlist; + if ((index < 0) || (index >= numhaptics)) { + return NULL; + } + while (index > 0) { + SDL_assert(item != NULL); + --index; + item = item->next; + } + return item; +} + +static SDL_hapticlist_item * +HapticByDevId (int device_id) +{ + SDL_hapticlist_item *item; + for (item = SDL_hapticlist; item != NULL; item = item->next) { + if (device_id == item->device_id) { + /*SDL_Log("=+=+=+=+=+= HapticByDevId id [%d]", device_id);*/ + return item; + } + } + return NULL; +} + +const char * +SDL_SYS_HapticName(int index) +{ + SDL_hapticlist_item *item = HapticByOrder(index); + if (item == NULL ) { + SDL_SetError("No such device"); + return NULL; + } + return item->name; +} + + +static SDL_hapticlist_item * +OpenHaptic(SDL_Haptic *haptic, SDL_hapticlist_item *item) +{ + if (item == NULL ) { + SDL_SetError("No such device"); + return NULL; + } + if (item->haptic != NULL) { + SDL_SetError("Haptic already opened"); + return NULL; + } + + haptic->hwdata = (struct haptic_hwdata *)item; + item->haptic = haptic; + + haptic->supported = SDL_HAPTIC_LEFTRIGHT; + haptic->neffects = 1; + haptic->nplaying = haptic->neffects; + haptic->effects = (struct haptic_effect *)SDL_malloc (sizeof (struct haptic_effect) * haptic->neffects); + if (haptic->effects == NULL) { + SDL_OutOfMemory(); + return NULL; + } + SDL_memset(haptic->effects, 0, sizeof (struct haptic_effect) * haptic->neffects); + return item; +} + +static SDL_hapticlist_item * +OpenHapticByOrder(SDL_Haptic *haptic, int index) +{ + return OpenHaptic (haptic, HapticByOrder(index)); +} + +static SDL_hapticlist_item * +OpenHapticByDevId(SDL_Haptic *haptic, int device_id) +{ + return OpenHaptic (haptic, HapticByDevId(device_id)); +} + +int +SDL_SYS_HapticOpen(SDL_Haptic *haptic) +{ + return (OpenHapticByOrder(haptic, haptic->index) == NULL ? -1 : 0); +} + + +int +SDL_SYS_HapticMouse(void) +{ + return 0; +} + + +int +SDL_SYS_JoystickIsHaptic(SDL_Joystick *joystick) +{ + SDL_hapticlist_item *item; + item = HapticByDevId(((joystick_hwdata *)joystick->hwdata)->device_id); + return (item != NULL) ? 1 : 0; +} + + +int +SDL_SYS_HapticOpenFromJoystick(SDL_Haptic *haptic, SDL_Joystick *joystick) +{ + return (OpenHapticByDevId(haptic, ((joystick_hwdata *)joystick->hwdata)->device_id) == NULL ? -1 : 0); +} + + +int +SDL_SYS_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick) +{ + return (((SDL_hapticlist_item *)haptic->hwdata)->device_id == ((joystick_hwdata *)joystick->hwdata)->device_id ? 1 : 0); +} + + +void +SDL_SYS_HapticClose(SDL_Haptic * haptic) +{ + ((SDL_hapticlist_item *)haptic->hwdata)->haptic = NULL; + haptic->hwdata = NULL; + return; +} + + +void +SDL_SYS_HapticQuit(void) +{ + SDL_hapticlist_item *item = NULL; + SDL_hapticlist_item *next = NULL; + + for (item = SDL_hapticlist; item; item = next) { + next = item->next; + SDL_free(item); + } + + SDL_hapticlist = SDL_hapticlist_tail = NULL; + numhaptics = 0; + return; +} + + +int +SDL_SYS_HapticNewEffect(SDL_Haptic * haptic, + struct haptic_effect *effect, SDL_HapticEffect * base) +{ + return 0; +} + + +int +SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic, + struct haptic_effect *effect, + SDL_HapticEffect * data) +{ + return 0; +} + + +int +SDL_SYS_HapticRunEffect(SDL_Haptic * haptic, struct haptic_effect *effect, + Uint32 iterations) +{ + Android_JNI_HapticRun (((SDL_hapticlist_item *)haptic->hwdata)->device_id, effect->effect.leftright.length); + return 0; +} + + +int +SDL_SYS_HapticStopEffect(SDL_Haptic * haptic, struct haptic_effect *effect) +{ + return 0; +} + + +void +SDL_SYS_HapticDestroyEffect(SDL_Haptic * haptic, struct haptic_effect *effect) +{ + return; +} + + +int +SDL_SYS_HapticGetEffectStatus(SDL_Haptic * haptic, + struct haptic_effect *effect) +{ + return 0; +} + + +int +SDL_SYS_HapticSetGain(SDL_Haptic * haptic, int gain) +{ + return 0; +} + + +int +SDL_SYS_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter) +{ + return 0; +} + +int +SDL_SYS_HapticPause(SDL_Haptic * haptic) +{ + return 0; +} + +int +SDL_SYS_HapticUnpause(SDL_Haptic * haptic) +{ + return 0; +} + +int +SDL_SYS_HapticStopAll(SDL_Haptic * haptic) +{ + return 0; +} + + + +int +Android_AddHaptic(int device_id, const char *name) +{ + SDL_hapticlist_item *item; + item = (SDL_hapticlist_item *) SDL_calloc(1, sizeof (SDL_hapticlist_item)); + if (item == NULL) { + return -1; + } + + item->device_id = device_id; + item->name = SDL_strdup (name); + if (item->name == NULL) { + SDL_free (item); + return -1; + } + + if (SDL_hapticlist_tail == NULL) { + SDL_hapticlist = SDL_hapticlist_tail = item; + } else { + SDL_hapticlist_tail->next = item; + SDL_hapticlist_tail = item; + } + + ++numhaptics; + return numhaptics; +} + +int +Android_RemoveHaptic(int device_id) +{ + SDL_hapticlist_item *item; + SDL_hapticlist_item *prev = NULL; + + for (item = SDL_hapticlist; item != NULL; item = item->next) { + /* found it, remove it. */ + if (device_id == item->device_id) { + const int retval = item->haptic ? item->haptic->index : -1; + + if (prev != NULL) { + prev->next = item->next; + } else { + SDL_assert(SDL_hapticlist == item); + SDL_hapticlist = item->next; + } + if (item == SDL_hapticlist_tail) { + SDL_hapticlist_tail = prev; + } + + /* Need to decrement the haptic count */ + --numhaptics; + /* !!! TODO: Send a haptic remove event? */ + + SDL_free(item->name); + SDL_free(item); + return retval; + } + prev = item; + } + return -1; +} + + +#endif /* SDL_HAPTIC_ANDROID */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/haptic/android/SDL_syshaptic_c.h b/Engine/lib/sdl/src/haptic/android/SDL_syshaptic_c.h new file mode 100644 index 000000000..08634d223 --- /dev/null +++ b/Engine/lib/sdl/src/haptic/android/SDL_syshaptic_c.h @@ -0,0 +1,12 @@ +#include "SDL_config.h" + +#ifdef SDL_HAPTIC_ANDROID + + +extern int Android_AddHaptic(int device_id, const char *name); +extern int Android_RemoveHaptic(int device_id); + + +#endif /* SDL_HAPTIC_ANDROID */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/haptic/darwin/SDL_syshaptic.c b/Engine/lib/sdl/src/haptic/darwin/SDL_syshaptic.c index d662012c3..67cb9f52f 100644 --- a/Engine/lib/sdl/src/haptic/darwin/SDL_syshaptic.c +++ b/Engine/lib/sdl/src/haptic/darwin/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -189,7 +189,7 @@ SDL_SYS_HapticInit(void) } int -SDL_SYS_NumHaptics() +SDL_SYS_NumHaptics(void) { return numhaptics; } diff --git a/Engine/lib/sdl/src/haptic/darwin/SDL_syshaptic_c.h b/Engine/lib/sdl/src/haptic/darwin/SDL_syshaptic_c.h index 2b72aab3d..073db53b3 100644 --- a/Engine/lib/sdl/src/haptic/darwin/SDL_syshaptic_c.h +++ b/Engine/lib/sdl/src/haptic/darwin/SDL_syshaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/haptic/dummy/SDL_syshaptic.c b/Engine/lib/sdl/src/haptic/dummy/SDL_syshaptic.c index 727e7ecac..283fe6711 100644 --- a/Engine/lib/sdl/src/haptic/dummy/SDL_syshaptic.c +++ b/Engine/lib/sdl/src/haptic/dummy/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/haptic/linux/SDL_syshaptic.c b/Engine/lib/sdl/src/haptic/linux/SDL_syshaptic.c index 7bd966449..9c11a2f0e 100644 --- a/Engine/lib/sdl/src/haptic/linux/SDL_syshaptic.c +++ b/Engine/lib/sdl/src/haptic/linux/SDL_syshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -49,7 +49,7 @@ static int MaybeAddDevice(const char *path); #if SDL_USE_LIBUDEV static int MaybeRemoveDevice(const char *path); -void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); +static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); #endif /* SDL_USE_LIBUDEV */ /* @@ -187,7 +187,7 @@ SDL_SYS_HapticInit(void) } int -SDL_SYS_NumHaptics() +SDL_SYS_NumHaptics(void) { return numhaptics; } @@ -211,7 +211,7 @@ HapticByDevIndex(int device_index) } #if SDL_USE_LIBUDEV -void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) +static void haptic_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) { if (devpath == NULL || !(udev_class & SDL_UDEV_DEVICE_JOYSTICK)) { return; diff --git a/Engine/lib/sdl/src/haptic/windows/SDL_dinputhaptic.c b/Engine/lib/sdl/src/haptic/windows/SDL_dinputhaptic.c index c81432c26..897d1282e 100644 --- a/Engine/lib/sdl/src/haptic/windows/SDL_dinputhaptic.c +++ b/Engine/lib/sdl/src/haptic/windows/SDL_dinputhaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -58,15 +58,6 @@ DI_SetError(const char *str, HRESULT err) return SDL_SetError("Haptic error %s", str); } -/* - * Checks to see if two GUID are the same. - */ -static int -DI_GUIDIsSame(const GUID * a, const GUID * b) -{ - return (SDL_memcmp(a, b, sizeof (GUID)) == 0); -} - /* * Callback to find the haptic devices. */ @@ -219,17 +210,17 @@ DI_DeviceObjectCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef) if ((dev->dwType & DIDFT_AXIS) && (dev->dwFlags & DIDOI_FFACTUATOR)) { const GUID *guid = &dev->guidType; DWORD offset = 0; - if (DI_GUIDIsSame(guid, &GUID_XAxis)) { + if (WIN_IsEqualGUID(guid, &GUID_XAxis)) { offset = DIJOFS_X; - } else if (DI_GUIDIsSame(guid, &GUID_YAxis)) { + } else if (WIN_IsEqualGUID(guid, &GUID_YAxis)) { offset = DIJOFS_Y; - } else if (DI_GUIDIsSame(guid, &GUID_ZAxis)) { + } else if (WIN_IsEqualGUID(guid, &GUID_ZAxis)) { offset = DIJOFS_Z; - } else if (DI_GUIDIsSame(guid, &GUID_RxAxis)) { + } else if (WIN_IsEqualGUID(guid, &GUID_RxAxis)) { offset = DIJOFS_RX; - } else if (DI_GUIDIsSame(guid, &GUID_RyAxis)) { + } else if (WIN_IsEqualGUID(guid, &GUID_RyAxis)) { offset = DIJOFS_RY; - } else if (DI_GUIDIsSame(guid, &GUID_RzAxis)) { + } else if (WIN_IsEqualGUID(guid, &GUID_RzAxis)) { offset = DIJOFS_RZ; } else { return DIENUM_CONTINUE; /* can't use this, go on. */ @@ -251,7 +242,7 @@ DI_DeviceObjectCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef) * Callback to get all supported effects. */ #define EFFECT_TEST(e,s) \ -if (DI_GUIDIsSame(&pei->guid, &(e))) \ +if (WIN_IsEqualGUID(&pei->guid, &(e))) \ haptic->supported |= (s) static BOOL CALLBACK DI_EffectCallback(LPCDIEFFECTINFO pei, LPVOID pv) @@ -481,7 +472,7 @@ SDL_DINPUT_JoystickSameHaptic(SDL_Haptic * haptic, SDL_Joystick * joystick) return 0; } - return DI_GUIDIsSame(&hap_instance.guidInstance, &joy_instance.guidInstance); + return WIN_IsEqualGUID(&hap_instance.guidInstance, &joy_instance.guidInstance); } int @@ -500,7 +491,7 @@ SDL_DINPUT_HapticOpenFromJoystick(SDL_Haptic * haptic, SDL_Joystick * joystick) /* Since it comes from a joystick we have to try to match it with a haptic device on our haptic list. */ for (item = SDL_hapticlist; item != NULL; item = item->next) { - if (!item->bXInputHaptic && DI_GUIDIsSame(&item->instance.guidInstance, &joy_instance.guidInstance)) { + if (!item->bXInputHaptic && WIN_IsEqualGUID(&item->instance.guidInstance, &joy_instance.guidInstance)) { haptic->index = index; return SDL_DINPUT_HapticOpenFromDevice(haptic, joystick->hwdata->InputDevice, SDL_TRUE); } @@ -1016,6 +1007,19 @@ SDL_DINPUT_HapticUpdateEffect(SDL_Haptic * haptic, struct haptic_effect *effect, /* Create the actual effect. */ ret = IDirectInputEffect_SetParameters(effect->hweffect->ref, &temp, flags); + if (ret == DIERR_NOTEXCLUSIVEACQUIRED) { + IDirectInputDevice8_Unacquire(haptic->hwdata->device); + ret = IDirectInputDevice8_SetCooperativeLevel(haptic->hwdata->device, SDL_HelperWindow, DISCL_EXCLUSIVE | DISCL_BACKGROUND); + if (SUCCEEDED(ret)) { + ret = DIERR_NOTACQUIRED; + } + } + if (ret == DIERR_INPUTLOST || ret == DIERR_NOTACQUIRED) { + ret = IDirectInputDevice8_Acquire(haptic->hwdata->device); + if (SUCCEEDED(ret)) { + ret = IDirectInputEffect_SetParameters(effect->hweffect->ref, &temp, flags); + } + } if (FAILED(ret)) { DI_SetError("Unable to update effect", ret); goto err_update; diff --git a/Engine/lib/sdl/src/haptic/windows/SDL_dinputhaptic_c.h b/Engine/lib/sdl/src/haptic/windows/SDL_dinputhaptic_c.h index 3dc0f1303..81c0ad142 100644 --- a/Engine/lib/sdl/src/haptic/windows/SDL_dinputhaptic_c.h +++ b/Engine/lib/sdl/src/haptic/windows/SDL_dinputhaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/haptic/windows/SDL_windowshaptic.c b/Engine/lib/sdl/src/haptic/windows/SDL_windowshaptic.c index c6bcba1f3..3d7361de2 100644 --- a/Engine/lib/sdl/src/haptic/windows/SDL_windowshaptic.c +++ b/Engine/lib/sdl/src/haptic/windows/SDL_windowshaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -98,7 +98,7 @@ SDL_SYS_RemoveHapticDevice(SDL_hapticlist_item *prev, SDL_hapticlist_item *item) } int -SDL_SYS_NumHaptics() +SDL_SYS_NumHaptics(void) { return numhaptics; } diff --git a/Engine/lib/sdl/src/haptic/windows/SDL_windowshaptic_c.h b/Engine/lib/sdl/src/haptic/windows/SDL_windowshaptic_c.h index f34426442..256ffbf35 100644 --- a/Engine/lib/sdl/src/haptic/windows/SDL_windowshaptic_c.h +++ b/Engine/lib/sdl/src/haptic/windows/SDL_windowshaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowshaptic_c_h -#define _SDL_windowshaptic_c_h +#ifndef SDL_windowshaptic_c_h_ +#define SDL_windowshaptic_c_h_ #include "SDL_thread.h" #include "../SDL_syshaptic.h" @@ -82,7 +82,7 @@ extern SDL_hapticlist_item *SDL_hapticlist; extern int SDL_SYS_AddHapticDevice(SDL_hapticlist_item *item); extern int SDL_SYS_RemoveHapticDevice(SDL_hapticlist_item *prev, SDL_hapticlist_item *item); -#endif /* _SDL_windowshaptic_c_h */ +#endif /* SDL_windowshaptic_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/haptic/windows/SDL_xinputhaptic.c b/Engine/lib/sdl/src/haptic/windows/SDL_xinputhaptic.c index afbab456a..53e7ad3e9 100644 --- a/Engine/lib/sdl/src/haptic/windows/SDL_xinputhaptic.c +++ b/Engine/lib/sdl/src/haptic/windows/SDL_xinputhaptic.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -278,8 +278,9 @@ SDL_XINPUT_HapticUpdateEffect(SDL_Haptic * haptic, struct haptic_effect *effect, { XINPUT_VIBRATION *vib = &effect->hweffect->vibration; SDL_assert(data->type == SDL_HAPTIC_LEFTRIGHT); - vib->wLeftMotorSpeed = data->leftright.large_magnitude; - vib->wRightMotorSpeed = data->leftright.small_magnitude; + /* SDL_HapticEffect has max magnitude of 32767, XInput expects 65535 max, so multiply */ + vib->wLeftMotorSpeed = data->leftright.large_magnitude * 2; + vib->wRightMotorSpeed = data->leftright.small_magnitude * 2; SDL_LockMutex(haptic->hwdata->mutex); if (haptic->hwdata->stopTicks) { /* running right now? Update it. */ XINPUTSETSTATE(haptic->hwdata->userid, vib); diff --git a/Engine/lib/sdl/src/haptic/windows/SDL_xinputhaptic_c.h b/Engine/lib/sdl/src/haptic/windows/SDL_xinputhaptic_c.h index f9a0c85b2..eed029ed1 100644 --- a/Engine/lib/sdl/src/haptic/windows/SDL_xinputhaptic_c.h +++ b/Engine/lib/sdl/src/haptic/windows/SDL_xinputhaptic_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/joystick/SDL_gamecontroller.c b/Engine/lib/sdl/src/joystick/SDL_gamecontroller.c index 1d3a4c203..b0f833a33 100644 --- a/Engine/lib/sdl/src/joystick/SDL_gamecontroller.c +++ b/Engine/lib/sdl/src/joystick/SDL_gamecontroller.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,70 +24,78 @@ #include "SDL_events.h" #include "SDL_assert.h" -#include "SDL_sysjoystick.h" #include "SDL_hints.h" +#include "SDL_sysjoystick.h" +#include "SDL_joystick_c.h" #include "SDL_gamecontrollerdb.h" #if !SDL_EVENTS_DISABLED #include "../events/SDL_events_c.h" #endif -#define ABS(_x) ((_x) < 0 ? -(_x) : (_x)) + +#if defined(__ANDROID__) +#include "SDL_system.h" +#endif + #define SDL_CONTROLLER_PLATFORM_FIELD "platform:" /* a list of currently opened game controllers */ static SDL_GameController *SDL_gamecontrollers = NULL; -/* keep track of the hat and mask value that transforms this hat movement into a button/axis press */ -struct _SDL_HatMapping +typedef struct { - int hat; - Uint8 mask; -}; + SDL_GameControllerBindType inputType; + union + { + int button; -/* We need 36 entries for Android (as of SDL v2.0.4) */ -#define k_nMaxReverseEntries 48 + struct { + int axis; + int axis_min; + int axis_max; + } axis; -/** - * We are encoding the "HAT" as 0xhm. where h == hat ID and m == mask - * MAX 4 hats supported - */ -#define k_nMaxHatEntries 0x3f + 1 + struct { + int hat; + int hat_mask; + } hat; -/* our in memory mapping db between joystick objects and controller mappings */ -struct _SDL_ControllerMapping -{ - SDL_JoystickGUID guid; - const char *name; + } input; - /* mapping of axis/button id to controller version */ - int axes[SDL_CONTROLLER_AXIS_MAX]; - int buttonasaxis[SDL_CONTROLLER_AXIS_MAX]; + SDL_GameControllerBindType outputType; + union + { + SDL_GameControllerButton button; - int buttons[SDL_CONTROLLER_BUTTON_MAX]; - int axesasbutton[SDL_CONTROLLER_BUTTON_MAX]; - struct _SDL_HatMapping hatasbutton[SDL_CONTROLLER_BUTTON_MAX]; + struct { + SDL_GameControllerAxis axis; + int axis_min; + int axis_max; + } axis; - /* reverse mapping, joystick indices to buttons */ - SDL_GameControllerAxis raxes[k_nMaxReverseEntries]; - SDL_GameControllerAxis rbuttonasaxis[k_nMaxReverseEntries]; - - SDL_GameControllerButton rbuttons[k_nMaxReverseEntries]; - SDL_GameControllerButton raxesasbutton[k_nMaxReverseEntries]; - SDL_GameControllerButton rhatasbutton[k_nMaxHatEntries]; - -}; + } output; +} SDL_ExtendedGameControllerBind; /* our hard coded list of mapping support */ +typedef enum +{ + SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT, + SDL_CONTROLLER_MAPPING_PRIORITY_API, + SDL_CONTROLLER_MAPPING_PRIORITY_USER, +} SDL_ControllerMappingPriority; + typedef struct _ControllerMapping_t { SDL_JoystickGUID guid; char *name; char *mapping; + SDL_ControllerMappingPriority priority; struct _ControllerMapping_t *next; } ControllerMapping_t; +static SDL_JoystickGUID s_zeroGUID; static ControllerMapping_t *s_pSupportedControllers = NULL; static ControllerMapping_t *s_pXInputMapping = NULL; static ControllerMapping_t *s_pEmscriptenMapping = NULL; @@ -97,14 +105,88 @@ struct _SDL_GameController { SDL_Joystick *joystick; /* underlying joystick device */ int ref_count; - Uint8 hatState[4]; /* the current hat state for this controller */ - struct _SDL_ControllerMapping mapping; /* the mapping object for this controller */ + + SDL_JoystickGUID guid; + const char *name; + int num_bindings; + SDL_ExtendedGameControllerBind *bindings; + SDL_ExtendedGameControllerBind **last_match_axis; + Uint8 *last_hat_mask; + struct _SDL_GameController *next; /* pointer to next game controller we have allocated */ }; -int SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value); -int SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state); +typedef struct +{ + int num_entries; + int max_entries; + Uint32 *entries; +} SDL_vidpid_list; + +static SDL_vidpid_list SDL_allowed_controllers; +static SDL_vidpid_list SDL_ignored_controllers; + +static void +SDL_LoadVIDPIDListFromHint(const char *hint, SDL_vidpid_list *list) +{ + Uint32 entry; + char *spot; + char *file = NULL; + + list->num_entries = 0; + + if (hint && *hint == '@') { + spot = file = (char *)SDL_LoadFile(hint+1, NULL); + } else { + spot = (char *)hint; + } + + if (!spot) { + return; + } + + while ((spot = SDL_strstr(spot, "0x")) != NULL) { + entry = (Uint16)SDL_strtol(spot, &spot, 0); + entry <<= 16; + spot = SDL_strstr(spot, "0x"); + if (!spot) { + break; + } + entry |= (Uint16)SDL_strtol(spot, &spot, 0); + + if (list->num_entries == list->max_entries) { + int max_entries = list->max_entries + 16; + Uint32 *entries = (Uint32 *)SDL_realloc(list->entries, max_entries*sizeof(*list->entries)); + if (entries == NULL) { + /* Out of memory, go with what we have already */ + break; + } + list->entries = entries; + list->max_entries = max_entries; + } + list->entries[list->num_entries++] = entry; + } + + if (file) { + SDL_free(file); + } +} + +static void SDLCALL +SDL_GameControllerIgnoreDevicesChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_LoadVIDPIDListFromHint(hint, &SDL_ignored_controllers); +} + +static void SDLCALL +SDL_GameControllerIgnoreDevicesExceptChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + SDL_LoadVIDPIDListFromHint(hint, &SDL_allowed_controllers); +} + +static int SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value); +static int SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state); /* * If there is an existing add event in the queue, it needs to be modified @@ -135,40 +217,136 @@ static void UpdateEventsForDeviceRemoval() SDL_stack_free(events); } +static SDL_bool HasSameOutput(SDL_ExtendedGameControllerBind *a, SDL_ExtendedGameControllerBind *b) +{ + if (a->outputType != b->outputType) { + return SDL_FALSE; + } + + if (a->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + return (a->output.axis.axis == b->output.axis.axis); + } else { + return (a->output.button == b->output.button); + } +} + +static void ResetOutput(SDL_GameController *gamecontroller, SDL_ExtendedGameControllerBind *bind) +{ + if (bind->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + SDL_PrivateGameControllerAxis(gamecontroller, bind->output.axis.axis, 0); + } else { + SDL_PrivateGameControllerButton(gamecontroller, bind->output.button, SDL_RELEASED); + } +} + +static void HandleJoystickAxis(SDL_GameController *gamecontroller, int axis, int value) +{ + int i; + SDL_ExtendedGameControllerBind *last_match = gamecontroller->last_match_axis[axis]; + SDL_ExtendedGameControllerBind *match = NULL; + + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS && + axis == binding->input.axis.axis) { + if (binding->input.axis.axis_min < binding->input.axis.axis_max) { + if (value >= binding->input.axis.axis_min && + value <= binding->input.axis.axis_max) { + match = binding; + break; + } + } else { + if (value >= binding->input.axis.axis_max && + value <= binding->input.axis.axis_min) { + match = binding; + break; + } + } + } + } + + if (last_match && (!match || !HasSameOutput(last_match, match))) { + /* Clear the last input that this axis generated */ + ResetOutput(gamecontroller, last_match); + } + + if (match) { + if (match->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + if (match->input.axis.axis_min != match->output.axis.axis_min || match->input.axis.axis_max != match->output.axis.axis_max) { + float normalized_value = (float)(value - match->input.axis.axis_min) / (match->input.axis.axis_max - match->input.axis.axis_min); + value = match->output.axis.axis_min + (int)(normalized_value * (match->output.axis.axis_max - match->output.axis.axis_min)); + } + SDL_PrivateGameControllerAxis(gamecontroller, match->output.axis.axis, (Sint16)value); + } else { + Uint8 state; + int threshold = match->input.axis.axis_min + (match->input.axis.axis_max - match->input.axis.axis_min) / 2; + if (match->input.axis.axis_max < match->input.axis.axis_min) { + state = (value <= threshold) ? SDL_PRESSED : SDL_RELEASED; + } else { + state = (value >= threshold) ? SDL_PRESSED : SDL_RELEASED; + } + SDL_PrivateGameControllerButton(gamecontroller, match->output.button, state); + } + } + gamecontroller->last_match_axis[axis] = match; +} + +static void HandleJoystickButton(SDL_GameController *gamecontroller, int button, Uint8 state) +{ + int i; + + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON && + button == binding->input.button) { + if (binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + int value = state ? binding->output.axis.axis_max : binding->output.axis.axis_min; + SDL_PrivateGameControllerAxis(gamecontroller, binding->output.axis.axis, (Sint16)value); + } else { + SDL_PrivateGameControllerButton(gamecontroller, binding->output.button, state); + } + break; + } + } +} + +static void HandleJoystickHat(SDL_GameController *gamecontroller, int hat, Uint8 value) +{ + int i; + Uint8 last_mask = gamecontroller->last_hat_mask[hat]; + Uint8 changed_mask = (last_mask ^ value); + + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT && hat == binding->input.hat.hat) { + if ((changed_mask & binding->input.hat.hat_mask) != 0) { + if (value & binding->input.hat.hat_mask) { + if (binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + SDL_PrivateGameControllerAxis(gamecontroller, binding->output.axis.axis, (Sint16)binding->output.axis.axis_max); + } else { + SDL_PrivateGameControllerButton(gamecontroller, binding->output.button, SDL_PRESSED); + } + } else { + ResetOutput(gamecontroller, binding); + } + } + } + } + gamecontroller->last_hat_mask[hat] = value; +} + /* * Event filter to fire controller events from joystick ones */ -int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event) +static int SDLCALL SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event) { switch(event->type) { case SDL_JOYAXISMOTION: { - SDL_GameController *controllerlist; - - if (event->jaxis.axis >= k_nMaxReverseEntries) - { - SDL_SetError("SDL_GameControllerEventWatcher: Axis index %d too large, ignoring motion", (int)event->jaxis.axis); - break; - } - - controllerlist = SDL_gamecontrollers; + SDL_GameController *controllerlist = SDL_gamecontrollers; while (controllerlist) { if (controllerlist->joystick->instance_id == event->jaxis.which) { - if (controllerlist->mapping.raxes[event->jaxis.axis] >= 0) /* simple axis to axis, send it through */ { - SDL_GameControllerAxis axis = controllerlist->mapping.raxes[event->jaxis.axis]; - Sint16 value = event->jaxis.value; - switch (axis) { - case SDL_CONTROLLER_AXIS_TRIGGERLEFT: - case SDL_CONTROLLER_AXIS_TRIGGERRIGHT: - value = value / 2 + 16384; - break; - default: - break; - } - SDL_PrivateGameControllerAxis(controllerlist, axis, value); - } else if (controllerlist->mapping.raxesasbutton[event->jaxis.axis] >= 0) { /* simulate an axis as a button */ - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.raxesasbutton[event->jaxis.axis], ABS(event->jaxis.value) > 32768/2 ? SDL_PRESSED : SDL_RELEASED); - } + HandleJoystickAxis(controllerlist, event->jaxis.axis, event->jaxis.value); break; } controllerlist = controllerlist->next; @@ -178,22 +356,10 @@ int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event) case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: { - SDL_GameController *controllerlist; - - if (event->jbutton.button >= k_nMaxReverseEntries) - { - SDL_SetError("SDL_GameControllerEventWatcher: Button index %d too large, ignoring update", (int)event->jbutton.button); - break; - } - - controllerlist = SDL_gamecontrollers; + SDL_GameController *controllerlist = SDL_gamecontrollers; while (controllerlist) { if (controllerlist->joystick->instance_id == event->jbutton.which) { - if (controllerlist->mapping.rbuttons[event->jbutton.button] >= 0) { /* simple button as button */ - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rbuttons[event->jbutton.button], event->jbutton.state); - } else if (controllerlist->mapping.rbuttonasaxis[event->jbutton.button] >= 0) { /* an button pretending to be an axis */ - SDL_PrivateGameControllerAxis(controllerlist, controllerlist->mapping.rbuttonasaxis[event->jbutton.button], event->jbutton.state > 0 ? 32767 : 0); - } + HandleJoystickButton(controllerlist, event->jbutton.button, event->jbutton.state); break; } controllerlist = controllerlist->next; @@ -202,43 +368,10 @@ int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event) break; case SDL_JOYHATMOTION: { - SDL_GameController *controllerlist; - - if (event->jhat.hat >= 4) break; - - controllerlist = SDL_gamecontrollers; + SDL_GameController *controllerlist = SDL_gamecontrollers; while (controllerlist) { if (controllerlist->joystick->instance_id == event->jhat.which) { - Uint8 bSame = controllerlist->hatState[event->jhat.hat] & event->jhat.value; - /* Get list of removed bits (button release) */ - Uint8 bChanged = controllerlist->hatState[event->jhat.hat] ^ bSame; - /* the hat idx in the high nibble */ - int bHighHat = event->jhat.hat << 4; - - if (bChanged & SDL_HAT_DOWN) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_DOWN], SDL_RELEASED); - if (bChanged & SDL_HAT_UP) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_UP], SDL_RELEASED); - if (bChanged & SDL_HAT_LEFT) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_LEFT], SDL_RELEASED); - if (bChanged & SDL_HAT_RIGHT) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_RIGHT], SDL_RELEASED); - - /* Get list of added bits (button press) */ - bChanged = event->jhat.value ^ bSame; - - if (bChanged & SDL_HAT_DOWN) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_DOWN], SDL_PRESSED); - if (bChanged & SDL_HAT_UP) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_UP], SDL_PRESSED); - if (bChanged & SDL_HAT_LEFT) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_LEFT], SDL_PRESSED); - if (bChanged & SDL_HAT_RIGHT) - SDL_PrivateGameControllerButton(controllerlist, controllerlist->mapping.rhatasbutton[bHighHat | SDL_HAT_RIGHT], SDL_PRESSED); - - /* update our state cache */ - controllerlist->hatState[event->jhat.hat] = event->jhat.value; - + HandleJoystickHat(controllerlist, event->jhat.hat, event->jhat.value); break; } controllerlist = controllerlist->next; @@ -283,7 +416,7 @@ int SDL_GameControllerEventWatcher(void *userdata, SDL_Event * event) /* * Helper function to scan the mappings database for a controller with the specified GUID */ -ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID *guid) +static ControllerMapping_t *SDL_PrivateGetControllerMappingForGUID(SDL_JoystickGUID *guid) { ControllerMapping_t *pSupportedController = s_pSupportedControllers; while (pSupportedController) { @@ -311,12 +444,18 @@ static const char* map_StringForControllerAxis[] = { SDL_GameControllerAxis SDL_GameControllerGetAxisFromString(const char *pchString) { int entry; - if (!pchString || !pchString[0]) + + if (pchString && (*pchString == '+' || *pchString == '-')) { + ++pchString; + } + + if (!pchString || !pchString[0]) { return SDL_CONTROLLER_AXIS_INVALID; + } for (entry = 0; map_StringForControllerAxis[entry]; ++entry) { if (!SDL_strcasecmp(pchString, map_StringForControllerAxis[entry])) - return entry; + return (SDL_GameControllerAxis) entry; } return SDL_CONTROLLER_AXIS_INVALID; } @@ -362,7 +501,7 @@ SDL_GameControllerButton SDL_GameControllerGetButtonFromString(const char *pchSt for (entry = 0; map_StringForControllerButton[entry]; ++entry) { if (SDL_strcasecmp(pchString, map_StringForControllerButton[entry]) == 0) - return entry; + return (SDL_GameControllerButton) entry; } return SDL_CONTROLLER_BUTTON_INVALID; } @@ -381,63 +520,95 @@ const char* SDL_GameControllerGetStringForButton(SDL_GameControllerButton axis) /* * given a controller button name and a joystick name update our mapping structure with it */ -void SDL_PrivateGameControllerParseButton(const char *szGameButton, const char *szJoystickButton, struct _SDL_ControllerMapping *pMapping) +static void SDL_PrivateGameControllerParseElement(SDL_GameController *gamecontroller, const char *szGameButton, const char *szJoystickButton) { - int iSDLButton = 0; + SDL_ExtendedGameControllerBind bind; SDL_GameControllerButton button; SDL_GameControllerAxis axis; - button = SDL_GameControllerGetButtonFromString(szGameButton); + SDL_bool invert_input = SDL_FALSE; + char half_axis_input = 0; + char half_axis_output = 0; + + if (*szGameButton == '+' || *szGameButton == '-') { + half_axis_output = *szGameButton++; + } + axis = SDL_GameControllerGetAxisFromString(szGameButton); - iSDLButton = SDL_atoi(&szJoystickButton[1]); - - if (szJoystickButton[0] == 'a') { - if (iSDLButton >= k_nMaxReverseEntries) { - SDL_SetError("Axis index too large: %d", iSDLButton); - return; - } - if (axis != SDL_CONTROLLER_AXIS_INVALID) { - pMapping->axes[ axis ] = iSDLButton; - pMapping->raxes[ iSDLButton ] = axis; - } else if (button != SDL_CONTROLLER_BUTTON_INVALID) { - pMapping->axesasbutton[ button ] = iSDLButton; - pMapping->raxesasbutton[ iSDLButton ] = button; + button = SDL_GameControllerGetButtonFromString(szGameButton); + if (axis != SDL_CONTROLLER_AXIS_INVALID) { + bind.outputType = SDL_CONTROLLER_BINDTYPE_AXIS; + bind.output.axis.axis = axis; + if (axis == SDL_CONTROLLER_AXIS_TRIGGERLEFT || axis == SDL_CONTROLLER_AXIS_TRIGGERRIGHT) { + bind.output.axis.axis_min = 0; + bind.output.axis.axis_max = SDL_JOYSTICK_AXIS_MAX; } else { - SDL_assert(!"How did we get here?"); + if (half_axis_output == '+') { + bind.output.axis.axis_min = 0; + bind.output.axis.axis_max = SDL_JOYSTICK_AXIS_MAX; + } else if (half_axis_output == '-') { + bind.output.axis.axis_min = 0; + bind.output.axis.axis_max = SDL_JOYSTICK_AXIS_MIN; + } else { + bind.output.axis.axis_min = SDL_JOYSTICK_AXIS_MIN; + bind.output.axis.axis_max = SDL_JOYSTICK_AXIS_MAX; + } } + } else if (button != SDL_CONTROLLER_BUTTON_INVALID) { + bind.outputType = SDL_CONTROLLER_BINDTYPE_BUTTON; + bind.output.button = button; + } else { + SDL_SetError("Unexpected controller element %s", szGameButton); + return; + } - } else if (szJoystickButton[0] == 'b') { - if (iSDLButton >= k_nMaxReverseEntries) { - SDL_SetError("Button index too large: %d", iSDLButton); - return; - } - if (button != SDL_CONTROLLER_BUTTON_INVALID) { - pMapping->buttons[ button ] = iSDLButton; - pMapping->rbuttons[ iSDLButton ] = button; - } else if (axis != SDL_CONTROLLER_AXIS_INVALID) { - pMapping->buttonasaxis[ axis ] = iSDLButton; - pMapping->rbuttonasaxis[ iSDLButton ] = axis; + if (*szJoystickButton == '+' || *szJoystickButton == '-') { + half_axis_input = *szJoystickButton++; + } + if (szJoystickButton[SDL_strlen(szJoystickButton) - 1] == '~') { + invert_input = SDL_TRUE; + } + + if (szJoystickButton[0] == 'a' && SDL_isdigit(szJoystickButton[1])) { + bind.inputType = SDL_CONTROLLER_BINDTYPE_AXIS; + bind.input.axis.axis = SDL_atoi(&szJoystickButton[1]); + if (half_axis_input == '+') { + bind.input.axis.axis_min = 0; + bind.input.axis.axis_max = SDL_JOYSTICK_AXIS_MAX; + } else if (half_axis_input == '-') { + bind.input.axis.axis_min = 0; + bind.input.axis.axis_max = SDL_JOYSTICK_AXIS_MIN; } else { - SDL_assert(!"How did we get here?"); + bind.input.axis.axis_min = SDL_JOYSTICK_AXIS_MIN; + bind.input.axis.axis_max = SDL_JOYSTICK_AXIS_MAX; } - } else if (szJoystickButton[0] == 'h') { + if (invert_input) { + int tmp = bind.input.axis.axis_min; + bind.input.axis.axis_min = bind.input.axis.axis_max; + bind.input.axis.axis_max = tmp; + } + } else if (szJoystickButton[0] == 'b' && SDL_isdigit(szJoystickButton[1])) { + bind.inputType = SDL_CONTROLLER_BINDTYPE_BUTTON; + bind.input.button = SDL_atoi(&szJoystickButton[1]); + } else if (szJoystickButton[0] == 'h' && SDL_isdigit(szJoystickButton[1]) && + szJoystickButton[2] == '.' && SDL_isdigit(szJoystickButton[3])) { int hat = SDL_atoi(&szJoystickButton[1]); int mask = SDL_atoi(&szJoystickButton[3]); - if (hat >= 4) { - SDL_SetError("Hat index too large: %d", iSDLButton); - } - - if (button != SDL_CONTROLLER_BUTTON_INVALID) { - int ridx; - pMapping->hatasbutton[ button ].hat = hat; - pMapping->hatasbutton[ button ].mask = mask; - ridx = (hat << 4) | mask; - pMapping->rhatasbutton[ ridx ] = button; - } else if (axis != SDL_CONTROLLER_AXIS_INVALID) { - SDL_assert(!"Support hat as axis"); - } else { - SDL_assert(!"How did we get here?"); - } + bind.inputType = SDL_CONTROLLER_BINDTYPE_HAT; + bind.input.hat.hat = hat; + bind.input.hat.hat_mask = mask; + } else { + SDL_SetError("Unexpected joystick element: %s", szJoystickButton); + return; } + + ++gamecontroller->num_bindings; + gamecontroller->bindings = (SDL_ExtendedGameControllerBind *)SDL_realloc(gamecontroller->bindings, gamecontroller->num_bindings * sizeof(*gamecontroller->bindings)); + if (!gamecontroller->bindings) { + gamecontroller->num_bindings = 0; + SDL_OutOfMemory(); + return; + } + gamecontroller->bindings[gamecontroller->num_bindings - 1] = bind; } @@ -445,7 +616,7 @@ void SDL_PrivateGameControllerParseButton(const char *szGameButton, const char * * given a controller mapping string update our mapping object */ static void -SDL_PrivateGameControllerParseControllerConfigString(struct _SDL_ControllerMapping *pMapping, const char *pchString) +SDL_PrivateGameControllerParseControllerConfigString(SDL_GameController *gamecontroller, const char *pchString) { char szGameButton[20]; char szJoystickButton[20]; @@ -453,8 +624,8 @@ SDL_PrivateGameControllerParseControllerConfigString(struct _SDL_ControllerMappi int i = 0; const char *pchPos = pchString; - SDL_memset(szGameButton, 0x0, sizeof(szGameButton)); - SDL_memset(szJoystickButton, 0x0, sizeof(szJoystickButton)); + SDL_zero(szGameButton); + SDL_zero(szJoystickButton); while (pchPos && *pchPos) { if (*pchPos == ':') { @@ -465,9 +636,9 @@ SDL_PrivateGameControllerParseControllerConfigString(struct _SDL_ControllerMappi } else if (*pchPos == ',') { i = 0; bGameButton = SDL_TRUE; - SDL_PrivateGameControllerParseButton(szGameButton, szJoystickButton, pMapping); - SDL_memset(szGameButton, 0x0, sizeof(szGameButton)); - SDL_memset(szJoystickButton, 0x0, sizeof(szJoystickButton)); + SDL_PrivateGameControllerParseElement(gamecontroller, szGameButton, szJoystickButton); + SDL_zero(szGameButton); + SDL_zero(szJoystickButton); } else if (bGameButton) { if (i >= sizeof(szGameButton)) { @@ -487,50 +658,44 @@ SDL_PrivateGameControllerParseControllerConfigString(struct _SDL_ControllerMappi pchPos++; } - SDL_PrivateGameControllerParseButton(szGameButton, szJoystickButton, pMapping); + SDL_PrivateGameControllerParseElement(gamecontroller, szGameButton, szJoystickButton); } /* * Make a new button mapping struct */ -void SDL_PrivateLoadButtonMapping(struct _SDL_ControllerMapping *pMapping, SDL_JoystickGUID guid, const char *pchName, const char *pchMapping) +static void SDL_PrivateLoadButtonMapping(SDL_GameController *gamecontroller, SDL_JoystickGUID guid, const char *pchName, const char *pchMapping) { - int j; + int i; - pMapping->guid = guid; - pMapping->name = pchName; + gamecontroller->guid = guid; + gamecontroller->name = pchName; + gamecontroller->num_bindings = 0; + SDL_memset(gamecontroller->last_match_axis, 0, gamecontroller->joystick->naxes * sizeof(*gamecontroller->last_match_axis)); - /* set all the button mappings to non defaults */ - for (j = 0; j < SDL_CONTROLLER_AXIS_MAX; j++) { - pMapping->axes[j] = -1; - pMapping->buttonasaxis[j] = -1; + SDL_PrivateGameControllerParseControllerConfigString(gamecontroller, pchMapping); + + /* Set the zero point for triggers */ + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS && + binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS && + (binding->output.axis.axis == SDL_CONTROLLER_AXIS_TRIGGERLEFT || + binding->output.axis.axis == SDL_CONTROLLER_AXIS_TRIGGERRIGHT)) { + if (binding->input.axis.axis < gamecontroller->joystick->naxes) { + gamecontroller->joystick->axes[binding->input.axis.axis].value = + gamecontroller->joystick->axes[binding->input.axis.axis].zero = (Sint16)binding->input.axis.axis_min; + } + } } - for (j = 0; j < SDL_CONTROLLER_BUTTON_MAX; j++) { - pMapping->buttons[j] = -1; - pMapping->axesasbutton[j] = -1; - pMapping->hatasbutton[j].hat = -1; - } - - for (j = 0; j < k_nMaxReverseEntries; j++) { - pMapping->raxes[j] = SDL_CONTROLLER_AXIS_INVALID; - pMapping->rbuttonasaxis[j] = SDL_CONTROLLER_AXIS_INVALID; - pMapping->rbuttons[j] = SDL_CONTROLLER_BUTTON_INVALID; - pMapping->raxesasbutton[j] = SDL_CONTROLLER_BUTTON_INVALID; - } - - for (j = 0; j < k_nMaxHatEntries; j++) { - pMapping->rhatasbutton[j] = SDL_CONTROLLER_BUTTON_INVALID; - } - - SDL_PrivateGameControllerParseControllerConfigString(pMapping, pchMapping); } /* * grab the guid string from a mapping string */ -char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping) +static char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping) { const char *pFirstComma = SDL_strchr(pMapping, ','); if (pFirstComma) { @@ -540,7 +705,26 @@ char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping) return NULL; } SDL_memcpy(pchGUID, pMapping, pFirstComma - pMapping); - pchGUID[ pFirstComma - pMapping ] = 0; + pchGUID[pFirstComma - pMapping] = '\0'; + + /* Convert old style GUIDs to the new style in 2.0.5 */ +#if __WIN32__ + if (SDL_strlen(pchGUID) == 32 && + SDL_memcmp(&pchGUID[20], "504944564944", 12) == 0) { + SDL_memcpy(&pchGUID[20], "000000000000", 12); + SDL_memcpy(&pchGUID[16], &pchGUID[4], 4); + SDL_memcpy(&pchGUID[8], &pchGUID[0], 4); + SDL_memcpy(&pchGUID[0], "03000000", 8); + } +#elif __MACOSX__ + if (SDL_strlen(pchGUID) == 32 && + SDL_memcmp(&pchGUID[4], "000000000000", 12) == 0 && + SDL_memcmp(&pchGUID[20], "000000000000", 12) == 0) { + SDL_memcpy(&pchGUID[20], "000000000000", 12); + SDL_memcpy(&pchGUID[8], &pchGUID[0], 4); + SDL_memcpy(&pchGUID[0], "03000000", 8); + } +#endif return pchGUID; } return NULL; @@ -550,7 +734,7 @@ char *SDL_PrivateGetControllerGUIDFromMappingString(const char *pMapping) /* * grab the name string from a mapping string */ -char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping) +static char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping) { const char *pFirstComma, *pSecondComma; char *pchName; @@ -569,7 +753,7 @@ char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping) return NULL; } SDL_memcpy(pchName, pFirstComma + 1, pSecondComma - pFirstComma); - pchName[ pSecondComma - pFirstComma - 1 ] = 0; + pchName[pSecondComma - pFirstComma - 1] = 0; return pchName; } @@ -577,7 +761,7 @@ char *SDL_PrivateGetControllerNameFromMappingString(const char *pMapping) /* * grab the button mapping string from a mapping string */ -char *SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping) +static char *SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping) { const char *pFirstComma, *pSecondComma; @@ -595,18 +779,18 @@ char *SDL_PrivateGetControllerMappingFromMappingString(const char *pMapping) /* * Helper function to refresh a mapping */ -void SDL_PrivateGameControllerRefreshMapping(ControllerMapping_t *pControllerMapping) +static void SDL_PrivateGameControllerRefreshMapping(ControllerMapping_t *pControllerMapping) { SDL_GameController *gamecontrollerlist = SDL_gamecontrollers; while (gamecontrollerlist) { - if (!SDL_memcmp(&gamecontrollerlist->mapping.guid, &pControllerMapping->guid, sizeof(pControllerMapping->guid))) { + if (!SDL_memcmp(&gamecontrollerlist->guid, &pControllerMapping->guid, sizeof(pControllerMapping->guid))) { SDL_Event event; event.type = SDL_CONTROLLERDEVICEREMAPPED; event.cdevice.which = gamecontrollerlist->joystick->instance_id; SDL_PushEvent(&event); /* Not really threadsafe. Should this lock access within SDL_GameControllerEventWatcher? */ - SDL_PrivateLoadButtonMapping(&gamecontrollerlist->mapping, pControllerMapping->guid, pControllerMapping->name, pControllerMapping->mapping); + SDL_PrivateLoadButtonMapping(gamecontrollerlist, pControllerMapping->guid, pControllerMapping->name, pControllerMapping->mapping); } gamecontrollerlist = gamecontrollerlist->next; @@ -617,7 +801,7 @@ void SDL_PrivateGameControllerRefreshMapping(ControllerMapping_t *pControllerMap * Helper function to add a mapping for a guid */ static ControllerMapping_t * -SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, SDL_bool *existing) +SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, SDL_bool *existing, SDL_ControllerMappingPriority priority) { char *pchName; char *pchMapping; @@ -638,13 +822,20 @@ SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, pControllerMapping = SDL_PrivateGetControllerMappingForGUID(&jGUID); if (pControllerMapping) { - /* Update existing mapping */ - SDL_free(pControllerMapping->name); - pControllerMapping->name = pchName; - SDL_free(pControllerMapping->mapping); - pControllerMapping->mapping = pchMapping; - /* refresh open controllers */ - SDL_PrivateGameControllerRefreshMapping(pControllerMapping); + /* Only overwrite the mapping if the priority is the same or higher. */ + if (pControllerMapping->priority <= priority) { + /* Update existing mapping */ + SDL_free(pControllerMapping->name); + pControllerMapping->name = pchName; + SDL_free(pControllerMapping->mapping); + pControllerMapping->mapping = pchMapping; + pControllerMapping->priority = priority; + /* refresh open controllers */ + SDL_PrivateGameControllerRefreshMapping(pControllerMapping); + } else { + SDL_free(pchName); + SDL_free(pchMapping); + } *existing = SDL_TRUE; } else { pControllerMapping = SDL_malloc(sizeof(*pControllerMapping)); @@ -657,8 +848,22 @@ SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, pControllerMapping->guid = jGUID; pControllerMapping->name = pchName; pControllerMapping->mapping = pchMapping; - pControllerMapping->next = s_pSupportedControllers; - s_pSupportedControllers = pControllerMapping; + pControllerMapping->next = NULL; + pControllerMapping->priority = priority; + + if (s_pSupportedControllers) { + /* Add the mapping to the end of the list */ + ControllerMapping_t *pCurrMapping, *pPrevMapping; + + for ( pPrevMapping = s_pSupportedControllers, pCurrMapping = pPrevMapping->next; + pCurrMapping; + pPrevMapping = pCurrMapping, pCurrMapping = pCurrMapping->next ) { + continue; + } + pPrevMapping->next = pControllerMapping; + } else { + s_pSupportedControllers = pControllerMapping; + } *existing = SDL_FALSE; } return pControllerMapping; @@ -667,45 +872,70 @@ SDL_PrivateAddMappingForGUID(SDL_JoystickGUID jGUID, const char *mappingString, /* * Helper function to determine pre-calculated offset to certain joystick mappings */ -ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index) +static ControllerMapping_t *SDL_PrivateGetControllerMappingForNameAndGUID(const char *name, SDL_JoystickGUID guid) { - SDL_JoystickGUID jGUID = SDL_JoystickGetDeviceGUID(device_index); ControllerMapping_t *mapping; - mapping = SDL_PrivateGetControllerMappingForGUID(&jGUID); + mapping = SDL_PrivateGetControllerMappingForGUID(&guid); +#if defined(SDL_JOYSTICK_EMSCRIPTEN) + if (!mapping && s_pEmscriptenMapping) { + mapping = s_pEmscriptenMapping; + } +#else + (void) s_pEmscriptenMapping; /* pacify ARMCC */ +#endif +#ifdef __LINUX__ + if (!mapping && name) { + if (SDL_strstr(name, "Xbox 360 Wireless Receiver")) { + /* The Linux driver xpad.c maps the wireless dpad to buttons */ + SDL_bool existing; + mapping = SDL_PrivateAddMappingForGUID(guid, +"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); + } + } +#endif /* __LINUX__ */ + + if (!mapping && name) { + if (SDL_strstr(name, "Xbox") || SDL_strstr(name, "X-Box") || SDL_strstr(name, "XBOX")) { + mapping = s_pXInputMapping; + } + } + return mapping; +} + +static ControllerMapping_t *SDL_PrivateGetControllerMapping(int device_index) +{ + const char *name; + SDL_JoystickGUID guid; + ControllerMapping_t *mapping; + + SDL_LockJoysticks(); + + if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) { + SDL_SetError("There are %d joysticks available", SDL_NumJoysticks()); + SDL_UnlockJoysticks(); + return (NULL); + } + + name = SDL_JoystickNameForIndex(device_index); + guid = SDL_JoystickGetDeviceGUID(device_index); + mapping = SDL_PrivateGetControllerMappingForNameAndGUID(name, guid); #if SDL_JOYSTICK_XINPUT if (!mapping && SDL_SYS_IsXInputGamepad_DeviceIndex(device_index)) { mapping = s_pXInputMapping; } #endif -#if defined(SDL_JOYSTICK_EMSCRIPTEN) - if (!mapping && s_pEmscriptenMapping) { - mapping = s_pEmscriptenMapping; - } -#endif -#ifdef __LINUX__ - if (!mapping) { - const char *name = SDL_JoystickNameForIndex(device_index); - if (name) { - if (SDL_strstr(name, "Xbox 360 Wireless Receiver")) { - /* The Linux driver xpad.c maps the wireless dpad to buttons */ - SDL_bool existing; - mapping = SDL_PrivateAddMappingForGUID(jGUID, -"none,X360 Wireless Controller,a:b0,b:b1,back:b6,dpdown:b14,dpleft:b11,dpright:b12,dpup:b13,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", - &existing); - } - } - } -#endif /* __LINUX__ */ - - if (!mapping) { - const char *name = SDL_JoystickNameForIndex(device_index); - if (name) { - if (SDL_strstr(name, "Xbox") || SDL_strstr(name, "X-Box")) { - mapping = s_pXInputMapping; - } - } +#if defined(__ANDROID__) + if (!mapping && SDL_SYS_IsDPAD_DeviceIndex(device_index)) { + SDL_bool existing; + char mapping_string[1024]; + SDL_snprintf(mapping_string, sizeof(mapping_string), "none,%s,a:b0,b:b4,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,", name); + mapping = SDL_PrivateAddMappingForGUID(guid, mapping_string, + &existing, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); } +#endif /* __ANDROID__ */ + SDL_UnlockJoysticks(); return mapping; } @@ -781,10 +1011,10 @@ SDL_GameControllerAddMappingsFromRW(SDL_RWops * rw, int freerw) } /* - * Add or update an entry into the Mappings Database + * Add or update an entry into the Mappings Database with a priority */ -int -SDL_GameControllerAddMapping(const char *mappingString) +static int +SDL_PrivateGameControllerAddMapping(const char *mappingString, SDL_ControllerMappingPriority priority) { char *pchGUID; SDL_JoystickGUID jGUID; @@ -810,7 +1040,7 @@ SDL_GameControllerAddMapping(const char *mappingString) jGUID = SDL_JoystickGetGUIDFromString(pchGUID); SDL_free(pchGUID); - pControllerMapping = SDL_PrivateAddMappingForGUID(jGUID, mappingString, &existing); + pControllerMapping = SDL_PrivateAddMappingForGUID(jGUID, mappingString, &existing, priority); if (!pControllerMapping) { return -1; } @@ -828,6 +1058,66 @@ SDL_GameControllerAddMapping(const char *mappingString) } } +/* + * Add or update an entry into the Mappings Database + */ +int +SDL_GameControllerAddMapping(const char *mappingString) +{ + return SDL_PrivateGameControllerAddMapping(mappingString, SDL_CONTROLLER_MAPPING_PRIORITY_API); +} + +/* + * Get the number of mappings installed + */ +int +SDL_GameControllerNumMappings(void) +{ + int num_mappings = 0; + ControllerMapping_t *mapping; + + for (mapping = s_pSupportedControllers; mapping; mapping = mapping->next) { + if (SDL_memcmp(&mapping->guid, &s_zeroGUID, sizeof(mapping->guid)) == 0) { + continue; + } + ++num_mappings; + } + return num_mappings; +} + +/* + * Get the mapping at a particular index. + */ +char * +SDL_GameControllerMappingForIndex(int mapping_index) +{ + ControllerMapping_t *mapping; + + for (mapping = s_pSupportedControllers; mapping; mapping = mapping->next) { + if (SDL_memcmp(&mapping->guid, &s_zeroGUID, sizeof(mapping->guid)) == 0) { + continue; + } + if (mapping_index == 0) { + char *pMappingString; + char pchGUID[33]; + size_t needed; + + SDL_JoystickGetGUIDString(mapping->guid, pchGUID, sizeof(pchGUID)); + /* allocate enough memory for GUID + ',' + name + ',' + mapping + \0 */ + needed = SDL_strlen(pchGUID) + 1 + SDL_strlen(mapping->name) + 1 + SDL_strlen(mapping->mapping) + 1; + pMappingString = SDL_malloc(needed); + if (!pMappingString) { + SDL_OutOfMemory(); + return NULL; + } + SDL_snprintf(pMappingString, needed, "%s,%s,%s", pchGUID, mapping->name, mapping->mapping); + return pMappingString; + } + --mapping_index; + } + return NULL; +} + /* * Get the mapping string for this GUID */ @@ -862,7 +1152,7 @@ SDL_GameControllerMapping(SDL_GameController * gamecontroller) return NULL; } - return SDL_GameControllerMappingForGUID(gamecontroller->mapping.guid); + return SDL_GameControllerMappingForGUID(gamecontroller->guid); } static void @@ -882,7 +1172,7 @@ SDL_GameControllerLoadHints() if (pchNewLine) *pchNewLine = '\0'; - SDL_GameControllerAddMapping(pUserMappings); + SDL_PrivateGameControllerAddMapping(pUserMappings, SDL_CONTROLLER_MAPPING_PRIORITY_USER); if (pchNewLine) { pUserMappings = pchNewLine + 1; @@ -894,25 +1184,60 @@ SDL_GameControllerLoadHints() } } +/* + * Fill the given buffer with the expected controller mapping filepath. + * Usually this will just be CONTROLLER_MAPPING_FILE, but for Android, + * we want to get the internal storage path. + */ +static SDL_bool SDL_GetControllerMappingFilePath(char *path, size_t size) +{ +#ifdef CONTROLLER_MAPPING_FILE +#define STRING(X) SDL_STRINGIFY_ARG(X) + return SDL_strlcpy(path, STRING(CONTROLLER_MAPPING_FILE), size) < size; +#elif defined(__ANDROID__) + return SDL_snprintf(path, size, "%s/controller_map.txt", SDL_AndroidGetInternalStoragePath()) < size; +#else + return SDL_FALSE; +#endif +} + /* * Initialize the game controller system, mostly load our DB of controller config mappings */ int -SDL_GameControllerInit(void) +SDL_GameControllerInitMappings(void) { + char szControllerMapPath[1024]; int i = 0; const char *pMappingString = NULL; pMappingString = s_ControllerMappings[i]; while (pMappingString) { - SDL_GameControllerAddMapping(pMappingString); + SDL_PrivateGameControllerAddMapping(pMappingString, SDL_CONTROLLER_MAPPING_PRIORITY_DEFAULT); i++; pMappingString = s_ControllerMappings[i]; } + if (SDL_GetControllerMappingFilePath(szControllerMapPath, sizeof(szControllerMapPath))) { + SDL_GameControllerAddMappingsFromFile(szControllerMapPath); + } + /* load in any user supplied config */ SDL_GameControllerLoadHints(); + SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES, + SDL_GameControllerIgnoreDevicesChanged, NULL); + SDL_AddHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT, + SDL_GameControllerIgnoreDevicesExceptChanged, NULL); + + return (0); +} + +int +SDL_GameControllerInit(void) +{ + int i; + /* watch for joy events and fire controller ones if needed */ SDL_AddEventWatch(SDL_GameControllerEventWatcher, NULL); @@ -936,7 +1261,7 @@ SDL_GameControllerInit(void) const char * SDL_GameControllerNameForIndex(int device_index) { - ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index); + ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index); if (pSupportedController) { return pSupportedController->name; } @@ -944,20 +1269,83 @@ SDL_GameControllerNameForIndex(int device_index) } +/* + * Return 1 if the joystick with this name and GUID is a supported controller + */ +SDL_bool +SDL_IsGameControllerNameAndGUID(const char *name, SDL_JoystickGUID guid) +{ + ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMappingForNameAndGUID(name, guid); + if (pSupportedController) { + return SDL_TRUE; + } + return SDL_FALSE; +} + /* * Return 1 if the joystick at this device index is a supported controller */ SDL_bool SDL_IsGameController(int device_index) { - ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index); + ControllerMapping_t *pSupportedController = SDL_PrivateGetControllerMapping(device_index); if (pSupportedController) { return SDL_TRUE; } - return SDL_FALSE; } +/* + * Return 1 if the game controller should be ignored by SDL + */ +SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid) +{ + int i; + Uint16 vendor; + Uint16 product; + Uint32 vidpid; + + if (SDL_allowed_controllers.num_entries == 0 && + SDL_ignored_controllers.num_entries == 0) { + return SDL_FALSE; + } + + SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL); + vidpid = MAKE_VIDPID(vendor, product); + + if (SDL_GetHintBoolean("SDL_GAMECONTROLLER_ALLOW_STEAM_VIRTUAL_GAMEPAD", SDL_FALSE)) { + /* We shouldn't ignore Steam's virtual gamepad since it's using the hints to filter out the real controllers so it can remap input for the virtual controller */ + SDL_bool bSteamVirtualGamepad = SDL_FALSE; +#if defined(__LINUX__) + bSteamVirtualGamepad = (vendor == 0x28DE && product == 0x11FF); +#elif defined(__MACOSX__) + bSteamVirtualGamepad = (SDL_strncmp(name, "GamePad-", 8) == 0); +#elif defined(__WIN32__) + /* We can't tell on Windows, but Steam will block others in input hooks */ + bSteamVirtualGamepad = SDL_TRUE; +#endif + if (bSteamVirtualGamepad) { + return SDL_FALSE; + } + } + + if (SDL_allowed_controllers.num_entries > 0) { + for (i = 0; i < SDL_allowed_controllers.num_entries; ++i) { + if (vidpid == SDL_allowed_controllers.entries[i]) { + return SDL_FALSE; + } + } + return SDL_TRUE; + } else { + for (i = 0; i < SDL_ignored_controllers.num_entries; ++i) { + if (vidpid == SDL_ignored_controllers.entries[i]) { + return SDL_TRUE; + } + } + return SDL_FALSE; + } +} + /* * Open a controller for use - the index passed as an argument refers to * the N'th controller on the system. This index is the value which will @@ -972,8 +1360,11 @@ SDL_GameControllerOpen(int device_index) SDL_GameController *gamecontrollerlist; ControllerMapping_t *pSupportedController = NULL; + SDL_LockJoysticks(); + if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) { SDL_SetError("There are %d joysticks available", SDL_NumJoysticks()); + SDL_UnlockJoysticks(); return (NULL); } @@ -983,6 +1374,7 @@ SDL_GameControllerOpen(int device_index) if (SDL_SYS_GetInstanceIdOfDeviceIndex(device_index) == gamecontrollerlist->joystick->instance_id) { gamecontroller = gamecontrollerlist; ++gamecontroller->ref_count; + SDL_UnlockJoysticks(); return (gamecontroller); } gamecontrollerlist = gamecontrollerlist->next; @@ -992,46 +1384,56 @@ SDL_GameControllerOpen(int device_index) pSupportedController = SDL_PrivateGetControllerMapping(device_index); if (!pSupportedController) { SDL_SetError("Couldn't find mapping for device (%d)", device_index); - return (NULL); - } - - /* Create and initialize the joystick */ - gamecontroller = (SDL_GameController *) SDL_malloc((sizeof *gamecontroller)); - if (gamecontroller == NULL) { - SDL_OutOfMemory(); + SDL_UnlockJoysticks(); + return NULL; + } + + /* Create and initialize the controller */ + gamecontroller = (SDL_GameController *) SDL_calloc(1, sizeof(*gamecontroller)); + if (gamecontroller == NULL) { + SDL_OutOfMemory(); + SDL_UnlockJoysticks(); return NULL; } - SDL_memset(gamecontroller, 0, (sizeof *gamecontroller)); gamecontroller->joystick = SDL_JoystickOpen(device_index); if (!gamecontroller->joystick) { SDL_free(gamecontroller); + SDL_UnlockJoysticks(); return NULL; } - SDL_PrivateLoadButtonMapping(&gamecontroller->mapping, pSupportedController->guid, pSupportedController->name, pSupportedController->mapping); - - /* The triggers are mapped from -32768 to 32767, where -32768 is the 'unpressed' value */ - { - int leftTriggerMapping = gamecontroller->mapping.axes[SDL_CONTROLLER_AXIS_TRIGGERLEFT]; - int rightTriggerMapping = gamecontroller->mapping.axes[SDL_CONTROLLER_AXIS_TRIGGERRIGHT]; - if (leftTriggerMapping >= 0) { - gamecontroller->joystick->axes[leftTriggerMapping] = - gamecontroller->joystick->axes_zero[leftTriggerMapping] = (Sint16)-32768; + if (gamecontroller->joystick->naxes) { + gamecontroller->last_match_axis = (SDL_ExtendedGameControllerBind **)SDL_calloc(gamecontroller->joystick->naxes, sizeof(*gamecontroller->last_match_axis)); + if (!gamecontroller->last_match_axis) { + SDL_OutOfMemory(); + SDL_JoystickClose(gamecontroller->joystick); + SDL_free(gamecontroller); + SDL_UnlockJoysticks(); + return NULL; } - if (rightTriggerMapping >= 0) { - gamecontroller->joystick->axes[rightTriggerMapping] = - gamecontroller->joystick->axes_zero[rightTriggerMapping] = (Sint16)-32768; + } + if (gamecontroller->joystick->nhats) { + gamecontroller->last_hat_mask = (Uint8 *)SDL_calloc(gamecontroller->joystick->nhats, sizeof(*gamecontroller->last_hat_mask)); + if (!gamecontroller->last_hat_mask) { + SDL_OutOfMemory(); + SDL_JoystickClose(gamecontroller->joystick); + SDL_free(gamecontroller->last_match_axis); + SDL_free(gamecontroller); + SDL_UnlockJoysticks(); + return NULL; } } - /* Add joystick to list */ + SDL_PrivateLoadButtonMapping(gamecontroller, pSupportedController->guid, pSupportedController->name, pSupportedController->mapping); + + /* Add the controller to list */ ++gamecontroller->ref_count; - /* Link the joystick in the list */ + /* Link the controller in the list */ gamecontroller->next = SDL_gamecontrollers; SDL_gamecontrollers = gamecontroller; - SDL_SYS_JoystickUpdate(gamecontroller->joystick); + SDL_UnlockJoysticks(); return (gamecontroller); } @@ -1046,69 +1448,133 @@ SDL_GameControllerUpdate(void) SDL_JoystickUpdate(); } - /* * Get the current state of an axis control on a controller */ Sint16 SDL_GameControllerGetAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis) { + int i; + if (!gamecontroller) return 0; - if (gamecontroller->mapping.axes[axis] >= 0) { - Sint16 value = (SDL_JoystickGetAxis(gamecontroller->joystick, gamecontroller->mapping.axes[axis])); - switch (axis) { - case SDL_CONTROLLER_AXIS_TRIGGERLEFT: - case SDL_CONTROLLER_AXIS_TRIGGERRIGHT: - /* Shift it to be 0 - 32767 */ - value = value / 2 + 16384; - default: - break; + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS && binding->output.axis.axis == axis) { + int value = 0; + SDL_bool valid_input_range; + SDL_bool valid_output_range; + + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + value = SDL_JoystickGetAxis(gamecontroller->joystick, binding->input.axis.axis); + if (binding->input.axis.axis_min < binding->input.axis.axis_max) { + valid_input_range = (value >= binding->input.axis.axis_min && value <= binding->input.axis.axis_max); + } else { + valid_input_range = (value >= binding->input.axis.axis_max && value <= binding->input.axis.axis_min); + } + if (valid_input_range) { + if (binding->input.axis.axis_min != binding->output.axis.axis_min || binding->input.axis.axis_max != binding->output.axis.axis_max) { + float normalized_value = (float)(value - binding->input.axis.axis_min) / (binding->input.axis.axis_max - binding->input.axis.axis_min); + value = binding->output.axis.axis_min + (int)(normalized_value * (binding->output.axis.axis_max - binding->output.axis.axis_min)); + } + } + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) { + value = SDL_JoystickGetButton(gamecontroller->joystick, binding->input.button); + if (value == SDL_PRESSED) { + value = binding->output.axis.axis_max; + } + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) { + int hat_mask = SDL_JoystickGetHat(gamecontroller->joystick, binding->input.hat.hat); + if (hat_mask & binding->input.hat.hat_mask) { + value = binding->output.axis.axis_max; + } + } + + if (binding->output.axis.axis_min < binding->output.axis.axis_max) { + valid_output_range = (value >= binding->output.axis.axis_min && value <= binding->output.axis.axis_max); + } else { + valid_output_range = (value >= binding->output.axis.axis_max && value <= binding->output.axis.axis_min); + } + /* If the value is zero, there might be another binding that makes it non-zero */ + if (value != 0 && valid_output_range) { + return (Sint16)value; + } } - return value; - } else if (gamecontroller->mapping.buttonasaxis[axis] >= 0) { - Uint8 value; - value = SDL_JoystickGetButton(gamecontroller->joystick, gamecontroller->mapping.buttonasaxis[axis]); - if (value > 0) - return 32767; - return 0; } return 0; } - /* * Get the current state of a button on a controller */ Uint8 SDL_GameControllerGetButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button) { + int i; + if (!gamecontroller) return 0; - if (gamecontroller->mapping.buttons[button] >= 0) { - return (SDL_JoystickGetButton(gamecontroller->joystick, gamecontroller->mapping.buttons[button])); - } else if (gamecontroller->mapping.axesasbutton[button] >= 0) { - Sint16 value; - value = SDL_JoystickGetAxis(gamecontroller->joystick, gamecontroller->mapping.axesasbutton[button]); - if (ABS(value) > 32768/2) - return 1; - return 0; - } else if (gamecontroller->mapping.hatasbutton[button].hat >= 0) { - Uint8 value; - value = SDL_JoystickGetHat(gamecontroller->joystick, gamecontroller->mapping.hatasbutton[button].hat); + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->outputType == SDL_CONTROLLER_BINDTYPE_BUTTON && binding->output.button == button) { + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + SDL_bool valid_input_range; - if (value & gamecontroller->mapping.hatasbutton[button].mask) - return 1; - return 0; + int value = SDL_JoystickGetAxis(gamecontroller->joystick, binding->input.axis.axis); + int threshold = binding->input.axis.axis_min + (binding->input.axis.axis_max - binding->input.axis.axis_min) / 2; + if (binding->input.axis.axis_min < binding->input.axis.axis_max) { + valid_input_range = (value >= binding->input.axis.axis_min && value <= binding->input.axis.axis_max); + if (valid_input_range) { + return (value >= threshold) ? SDL_PRESSED : SDL_RELEASED; + } + } else { + valid_input_range = (value >= binding->input.axis.axis_max && value <= binding->input.axis.axis_min); + if (valid_input_range) { + return (value <= threshold) ? SDL_PRESSED : SDL_RELEASED; + } + } + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) { + return SDL_JoystickGetButton(gamecontroller->joystick, binding->input.button); + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) { + int hat_mask = SDL_JoystickGetHat(gamecontroller->joystick, binding->input.hat.hat); + return (hat_mask & binding->input.hat.hat_mask) ? SDL_PRESSED : SDL_RELEASED; + } + } } + return SDL_RELEASED; +} - return 0; +const char * +SDL_GameControllerName(SDL_GameController * gamecontroller) +{ + if (!gamecontroller) + return NULL; + + return gamecontroller->name; +} + +Uint16 +SDL_GameControllerGetVendor(SDL_GameController * gamecontroller) +{ + return SDL_JoystickGetVendor(SDL_GameControllerGetJoystick(gamecontroller)); +} + +Uint16 +SDL_GameControllerGetProduct(SDL_GameController * gamecontroller) +{ + return SDL_JoystickGetProduct(SDL_GameControllerGetJoystick(gamecontroller)); +} + +Uint16 +SDL_GameControllerGetProductVersion(SDL_GameController * gamecontroller) +{ + return SDL_JoystickGetProductVersion(SDL_GameControllerGetJoystick(gamecontroller)); } /* - * Return if the joystick in question is currently attached to the system, + * Return if the controller in question is currently attached to the system, * \return 0 if not plugged in, 1 if still present. */ SDL_bool @@ -1120,17 +1586,6 @@ SDL_GameControllerGetAttached(SDL_GameController * gamecontroller) return SDL_JoystickGetAttached(gamecontroller->joystick); } - -const char * -SDL_GameControllerName(SDL_GameController * gamecontroller) -{ - if (!gamecontroller) - return NULL; - - return (gamecontroller->mapping.name); -} - - /* * Get the joystick for this controller */ @@ -1149,64 +1604,81 @@ SDL_Joystick *SDL_GameControllerGetJoystick(SDL_GameController * gamecontroller) SDL_GameController * SDL_GameControllerFromInstanceID(SDL_JoystickID joyid) { - SDL_GameController *gamecontroller = SDL_gamecontrollers; + SDL_GameController *gamecontroller; + + SDL_LockJoysticks(); + gamecontroller = SDL_gamecontrollers; while (gamecontroller) { if (gamecontroller->joystick->instance_id == joyid) { + SDL_UnlockJoysticks(); return gamecontroller; } gamecontroller = gamecontroller->next; } - + SDL_UnlockJoysticks(); return NULL; } -/** +/* * Get the SDL joystick layer binding for this controller axis mapping */ SDL_GameControllerButtonBind SDL_GameControllerGetBindForAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis) { + int i; SDL_GameControllerButtonBind bind; - SDL_memset(&bind, 0x0, sizeof(bind)); + SDL_zero(bind); if (!gamecontroller || axis == SDL_CONTROLLER_AXIS_INVALID) return bind; - if (gamecontroller->mapping.axes[axis] >= 0) { - bind.bindType = SDL_CONTROLLER_BINDTYPE_AXIS; - bind.value.button = gamecontroller->mapping.axes[axis]; - } else if (gamecontroller->mapping.buttonasaxis[axis] >= 0) { - bind.bindType = SDL_CONTROLLER_BINDTYPE_BUTTON; - bind.value.button = gamecontroller->mapping.buttonasaxis[axis]; + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->outputType == SDL_CONTROLLER_BINDTYPE_AXIS && binding->output.axis.axis == axis) { + bind.bindType = binding->inputType; + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + /* FIXME: There might be multiple axes bound now that we have axis ranges... */ + bind.value.axis = binding->input.axis.axis; + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) { + bind.value.button = binding->input.button; + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) { + bind.value.hat.hat = binding->input.hat.hat; + bind.value.hat.hat_mask = binding->input.hat.hat_mask; + } + break; + } } - return bind; } -/** +/* * Get the SDL joystick layer binding for this controller button mapping */ SDL_GameControllerButtonBind SDL_GameControllerGetBindForButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button) { + int i; SDL_GameControllerButtonBind bind; - SDL_memset(&bind, 0x0, sizeof(bind)); + SDL_zero(bind); if (!gamecontroller || button == SDL_CONTROLLER_BUTTON_INVALID) return bind; - if (gamecontroller->mapping.buttons[button] >= 0) { - bind.bindType = SDL_CONTROLLER_BINDTYPE_BUTTON; - bind.value.button = gamecontroller->mapping.buttons[button]; - } else if (gamecontroller->mapping.axesasbutton[button] >= 0) { - bind.bindType = SDL_CONTROLLER_BINDTYPE_AXIS; - bind.value.axis = gamecontroller->mapping.axesasbutton[button]; - } else if (gamecontroller->mapping.hatasbutton[button].hat >= 0) { - bind.bindType = SDL_CONTROLLER_BINDTYPE_HAT; - bind.value.hat.hat = gamecontroller->mapping.hatasbutton[button].hat; - bind.value.hat.hat_mask = gamecontroller->mapping.hatasbutton[button].mask; + for (i = 0; i < gamecontroller->num_bindings; ++i) { + SDL_ExtendedGameControllerBind *binding = &gamecontroller->bindings[i]; + if (binding->outputType == SDL_CONTROLLER_BINDTYPE_BUTTON && binding->output.button == button) { + bind.bindType = binding->inputType; + if (binding->inputType == SDL_CONTROLLER_BINDTYPE_AXIS) { + bind.value.axis = binding->input.axis.axis; + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_BUTTON) { + bind.value.button = binding->input.button; + } else if (binding->inputType == SDL_CONTROLLER_BINDTYPE_HAT) { + bind.value.hat.hat = binding->input.hat.hat; + bind.value.hat.hat_mask = binding->input.hat.hat_mask; + } + break; + } } - return bind; } @@ -1219,8 +1691,11 @@ SDL_GameControllerClose(SDL_GameController * gamecontroller) if (!gamecontroller) return; + SDL_LockJoysticks(); + /* First decrement ref count */ if (--gamecontroller->ref_count > 0) { + SDL_UnlockJoysticks(); return; } @@ -1236,14 +1711,18 @@ SDL_GameControllerClose(SDL_GameController * gamecontroller) } else { SDL_gamecontrollers = gamecontroller->next; } - break; } gamecontrollerlistprev = gamecontrollerlist; gamecontrollerlist = gamecontrollerlist->next; } + SDL_free(gamecontroller->bindings); + SDL_free(gamecontroller->last_match_axis); + SDL_free(gamecontroller->last_hat_mask); SDL_free(gamecontroller); + + SDL_UnlockJoysticks(); } @@ -1253,11 +1732,18 @@ SDL_GameControllerClose(SDL_GameController * gamecontroller) void SDL_GameControllerQuit(void) { - ControllerMapping_t *pControllerMap; + SDL_LockJoysticks(); while (SDL_gamecontrollers) { SDL_gamecontrollers->ref_count = 1; SDL_GameControllerClose(SDL_gamecontrollers); } + SDL_UnlockJoysticks(); +} + +void +SDL_GameControllerQuitMappings(void) +{ + ControllerMapping_t *pControllerMap; while (s_pSupportedControllers) { pControllerMap = s_pSupportedControllers; @@ -1269,12 +1755,25 @@ SDL_GameControllerQuit(void) SDL_DelEventWatch(SDL_GameControllerEventWatcher, NULL); + SDL_DelHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES, + SDL_GameControllerIgnoreDevicesChanged, NULL); + SDL_DelHintCallback(SDL_HINT_GAMECONTROLLER_IGNORE_DEVICES_EXCEPT, + SDL_GameControllerIgnoreDevicesExceptChanged, NULL); + + if (SDL_allowed_controllers.entries) { + SDL_free(SDL_allowed_controllers.entries); + SDL_zero(SDL_allowed_controllers); + } + if (SDL_ignored_controllers.entries) { + SDL_free(SDL_ignored_controllers.entries); + SDL_zero(SDL_ignored_controllers); + } } /* * Event filter to transform joystick events into appropriate game controller ones */ -int +static int SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameControllerAxis axis, Sint16 value) { int posted; @@ -1298,7 +1797,7 @@ SDL_PrivateGameControllerAxis(SDL_GameController * gamecontroller, SDL_GameContr /* * Event filter to transform joystick events into appropriate game controller ones */ -int +static int SDL_PrivateGameControllerButton(SDL_GameController * gamecontroller, SDL_GameControllerButton button, Uint8 state) { int posted; diff --git a/Engine/lib/sdl/src/joystick/SDL_gamecontrollerdb.h b/Engine/lib/sdl/src/joystick/SDL_gamecontrollerdb.h index 1e623cbb8..fdc0b592b 100644 --- a/Engine/lib/sdl/src/joystick/SDL_gamecontrollerdb.h +++ b/Engine/lib/sdl/src/joystick/SDL_gamecontrollerdb.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,77 +35,193 @@ static const char *s_ControllerMappings [] = "xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", #endif #if SDL_JOYSTICK_DINPUT - "10280900000000000000504944564944,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", - "341a3608000000000000504944564944,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "e8206058000000000000504944564944,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", - "ffff0000000000000000504944564944,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", - "6d0416c2000000000000504944564944,Generic DirectInput Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "6d0418c2000000000000504944564944,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "6d0419c2000000000000504944564944,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ - "4d6963726f736f66742050432d6a6f79,OUYA Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:b12,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a5,righty:a4,x:b1,y:b2,", - "88880803000000000000504944564944,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,", - "4c056802000000000000504944564944,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", - "25090500000000000000504944564944,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,", - "4c05c405000000000000504944564944,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000022000000090000000000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,", + "03000000203800000900000000000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a3,righty:a4,start:b11,x:b4,y:b3,", + "03000000102800000900000000000000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", + "03000000a00500003232000000000000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,", + "03000000341a00003608000000000000,Afterglow PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000e82000006058000000000000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000260900008888000000000000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a4,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,", + "03000000a306000022f6000000000000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", + "03000000ffff00000000000000000000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "030000000d0f00006e00000000000000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00006600000000000000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000000d0f00005f00000000000000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00005e00000000000000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000008f0e00001330000000000000,HuiJia SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b9,x:b3,y:b0,", + "030000006d04000016c2000000000000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000018c2000000000000,Logitech F510 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000019c2000000000000,Logitech F710 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ + "03000000380700005032000000000000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700005082000000000000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000790000004418000000000000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,", + "030000001008000001e5000000000000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,", + "030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "03000000362800000100000000000000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:b13,rightx:a3,righty:a4,x:b1,y:b2,", + "03000000888800000803000000000000,PS3 Controller,a:b2,b:b1,back:b8,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b9,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:b7,rightx:a3,righty:a4,start:b11,x:b0,y:b3,", + "030000004c0500006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", + "03000000250900000500000000000000,PS3 DualShock,a:b2,b:b1,back:b9,dpdown:h0.8,dpleft:h0.4,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b6,leftstick:b10,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b11,righttrigger:b5,rightx:a2,righty:a3,start:b8,x:b0,y:b3,", + "030000004c050000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000cc09000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000a00b000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000790000001100000000000000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,", + "030000006b140000010d000000000000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000a30600000cff000000000000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a2,righty:a3,x:b0,y:b1,", + "03000000a30600000b04000000010000,Saitek P990 Dual Analog Pad,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b8,x:b0,y:b3,", + "03000000172700004431000000000000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a7,rightx:a2,righty:a5,start:b11,x:b3,y:b4,", + "03000000830500006020000000000000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,", #endif #if defined(__MACOSX__) - "10280000000000000900000000000000,8Bitdo SFC30 GamePad Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", - "830500000000000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000022000000090000001000000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,", + "03000000203800000900000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,", + "03000000102800000900000000000000,8Bitdo SFC30 GamePad Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", + "03000000a00500003232000008010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,", + "030000008305000031b0000000000000,Cideko AK08b,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000260900008888000088020000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,", + "03000000a306000022f6000001030000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", - "6d0400000000000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ - "6d0400000000000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "6d040000000000001fc2000000000000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", - "6d0400000000000019c2000000000000,Logitech Wireless Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* This includes F710 in DInput mode and the "Logitech Cordless RumblePad 2", at the very least. */ - "4c050000000000006802000000000000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", - "4c05000000000000c405000000000000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", - "351200000000000021ab000000000000,SFC30 Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", - "11010000000000002014000000000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,", - "11010000000000001714000000000000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b12,x:b2,y:b3,", - "5e040000000000008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000000d0f00006e00000000010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00006600000000010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000000d0f00005f00000000010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00005e00000000010000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000008f0e00001330000011010000,HuiJia SNES Controller,a:b4,b:b2,back:b16,dpdown:+a2,dpleft:-a0,dpright:+a0,dpup:-a2,leftshoulder:b12,rightshoulder:b14,start:b18,x:b6,y:b0,", + "030000006d04000016c2000014040000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000016c2000000030000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000016c2000000000000,Logitech F310 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ + "030000006d04000018c2000000000000,Logitech F510 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d0400001fc2000000000000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000006d04000019c2000000000000,Logitech Wireless Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* This includes F710 in DInput mode and the "Logitech Cordless RumblePad 2", at the very least. */ + "03000000380700005032000000010000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700005082000000010000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000790000004418000000010000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,", + "030000001008000001e5000006010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,", + "030000007e0500000920000000000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "030000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", + "030000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000a00b000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000321500000010000000010000,Razer RAIJU,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "0300000032150000030a000000000000,Razer Wildcat,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "03000000790000001100000006010000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a4,dpleft:-a3,dpright:+a3,dpup:-a4,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,", + "030000006b140000010d000000010000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000003512000021ab000000000000,SFC30 Joystick,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", + "030000005e0400008e02000001000000,Steam Virtual GamePad,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "03000000110100002014000001000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,x:b2,y:b3,", + "03000000381000002014000001000000,SteelSeries Nimbus,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,x:b2,y:b3,", + "03000000110100001714000000000000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,", + "03000000110100001714000020010000,SteelSeries Stratus XL,a:b0,b:b1,dpdown:b9,dpleft:b11,dpright:b10,dpup:b8,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1~,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3~,start:b12,x:b2,y:b3,", + "030000005e0400008e02000000000000,X360 Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "03000000c6240000045d000000000000,Xbox 360 Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000005e040000d102000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000005e040000e302000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000005e040000dd02000000000000,Xbox One Wired Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000005e040000e002000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000005e040000ea02000000000000,Xbox Wireless Controller,a:b0,b:b1,back:b9,dpdown:b12,dpleft:b13,dpright:b14,dpup:b11,guide:b10,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,start:b8,x:b2,y:b3,", + "030000005e040000fd02000003090000,Xbox Wireless Controller,a:b0,b:b1,back:b16,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", + "03000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b15,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,", + "03000000120c0000100e000000010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000830500006020000000010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,", #endif #if defined(__LINUX__) + "03000000022000000090000011010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,", + "05000000203800000900000000010000,8Bitdo NES30 Pro,a:b1,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b6,leftstick:b13,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:b9,rightx:a2,righty:a3,start:b11,x:b4,y:b3,", "05000000102800000900000000010000,8Bitdo SFC30 GamePad,a:b1,b:b0,back:b10,leftshoulder:b6,leftx:a0,lefty:a1,rightshoulder:b7,start:b11,x:b4,y:b3,", + "05000000a00500003232000008010000,8Bitdo Zero GamePad,a:b0,b:b1,back:b10,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b11,x:b3,y:b4,", "03000000100000008200000011010000,Akishop Customs PS360+ v1.66,a:b1,b:b2,back:b12,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,lefttrigger:b6,rightshoulder:b5,righttrigger:b7,start:b9,x:b0,y:b3,", "03000000e82000006058000001010000,Cideko AK08b,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b0,", + "03000000260900008888000000010000,Cyber Gadget GameCube Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b6,righttrigger:a5,rightx:a2,righty:a3~,start:b7,x:b2,y:b3,", + "03000000a306000022f6000011010000,Cyborg V.3 Rumble Pad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:-a3,rightx:a2,righty:a4,start:b9,x:b0,y:b3,", + "03000000790000000600000010010000,DragonRise Inc. Generic USB Joystick,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a4,start:b9,x:b3,y:b0,", "0500000047532047616d657061640000,GameStop Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "030000006f0e00000104000000010000,Gamestop Logic3 Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "030000000d0f00006e00000011010000,HORIPAD 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00006600000011010000,HORIPAD 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000000d0f00005f00000011010000,Hori Fighting Commander 4 (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000000d0f00005e00000011010000,Hori Fighting Commander 4 (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000008f0e00001330000010010000,HuiJia SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b6,rightshoulder:b7,start:b9,x:b3,y:b0,", "03000000ba2200002010000001010000,Jess Technology USB Game Controller,a:b2,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a3,righty:a2,start:b9,x:b3,y:b0,", "030000006d04000019c2000010010000,Logitech Cordless RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000016c2000011010000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "030000006d04000016c2000010010000,Logitech Dual Action,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000006d0400001dc2000014400000,Logitech F310 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000006d0400001ec2000020200000,Logitech F510 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000006d04000019c2000011010000,Logitech F710 Gamepad (DInput),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", /* Guide button doesn't seem to be sent in DInput mode. */ "030000006d0400001fc2000005030000,Logitech F710 Gamepad (XInput),a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "030000006d04000018c2000010010000,Logitech RumblePad 2,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700005032000011010000,Mad Catz FightPad PRO (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", + "03000000380700005082000011010000,Mad Catz FightPad PRO (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000380700008433000011010000,Mad Catz FightStick TE S+ PS3,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000380700008483000011010000,Mad Catz FightStick TE S+ PS4,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000380700003847000090040000,Mad Catz Wired Xbox 360 Controller (SFIV),a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", "03000000380700008034000011010000,Mad Catz fightstick (PS3),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "03000000380700008084000011010000,Mad Catz fightstick (PS4),a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000380700001888000010010000,MadCatz PC USB Wired Stick 8818,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", - "03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", - "050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b1,b:b0,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", - "050000003620000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,", + "03000000790000004418000010010000,Mayflash GameCube Controller,a:b1,b:b2,dpdown:b14,dpleft:b15,dpright:b13,dpup:b12,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:a4,rightx:a5,righty:a2,start:b9,x:b0,y:b3,", + "030000001008000001e5000010010000,NEXT SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b6,start:b9,x:b3,y:b0,", + "03000000550900001072000011010000,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b13,leftshoulder:b4,leftstick:b8,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", + "050000007e0500000920000001000000,Nintendo Switch Pro Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", + "050000007e0500003003000001000000,Nintendo Wii Remote Pro Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b3,y:b2,", + "030000000d0500000308000010010000,Nostromo n45 Dual Analog Gamepad,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b9,leftshoulder:b4,leftstick:b12,lefttrigger:b5,leftx:a0,lefty:a1,rightshoulder:b6,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b10,x:b2,y:b3,", + "05000000362800000100000002010000,OUYA Game Controller,a:b0,b:b3,dpdown:b9,dpleft:b10,dpright:b11,dpup:b8,guide:b14,leftshoulder:b4,leftstick:b6,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b7,righttrigger:a5,rightx:a3,righty:a4,x:b1,y:b2,", + "030000006f0e00006401000001010000,PDP Battlefield One,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000ff1100004133000010010000,PS2 Controller,a:b2,b:b1,back:b8,leftshoulder:b6,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b5,start:b9,x:b3,y:b0,", + "030000004c0500006802000010010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", + "050000004c0500006802000000010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:a12,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:a13,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", "030000004c0500006802000011010000,PS3 Controller,a:b14,b:b13,back:b0,dpdown:b6,dpleft:b7,dpright:b5,dpup:b4,guide:b16,leftshoulder:b10,leftstick:b1,lefttrigger:b8,leftx:a0,lefty:a1,rightshoulder:b11,rightstick:b2,righttrigger:b9,rightx:a2,righty:a3,start:b3,x:b15,y:b12,", + "030000004c0500006802000010810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "050000004c0500006802000000810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "030000004c0500006802000011810000,PS3 Controller,a:b0,b:b1,back:b8,dpdown:b14,dpleft:b15,dpright:b16,dpup:b13,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", "03000000341a00003608000011010000,PS3 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b0,y:b3,", "030000004c050000c405000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "050000004c050000c405000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "030000004c050000cc09000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "050000004c050000cc09000000010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000a00b000011010000,PS4 Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "030000004c050000c405000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "050000004c050000c405000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "030000004c050000cc09000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "050000004c050000cc09000001800000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "050000004c050000cc09000000810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "030000004c050000a00b000011810000,PS4 Controller,a:b0,b:b1,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b11,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b12,righttrigger:a5,rightx:a3,righty:a4,start:b9,x:b3,y:b2,", + "03000000300f00001211000011010000,QanBa Arcade JoyStick,a:b2,b:b0,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b5,lefttrigger:b4,leftx:a0,lefty:a1,rightshoulder:b7,righttrigger:b6,start:b9,x:b1,y:b3,", + "03000000321500000010000011010000,Razer RAIJU,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", "03000000c6240000045d000025010000,Razer Sabertooth,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "03000000321500000009000011010000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", "050000003215000000090000163a0000,Razer Serval,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a4,rightx:a2,righty:a3,start:b7,x:b2,y:b3,", + "0300000032150000030a000001010000,Razer Wildcat,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000790000001100000010010000,Retrolink SNES Controller,a:b2,b:b1,back:b8,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b9,x:b3,y:b0,", + "030000006b140000010d000011010000,Revolution Pro Controller,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000a30600000cff000010010000,Saitek P2500 Force Rumble Pad,a:b2,b:b3,back:b11,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:b7,rightx:a3,righty:a2,x:b0,y:b1,", + "03000000a30600000b04000000010000,Saitek P990 Dual Analog Pad,a:b1,b:b2,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a3,righty:a2,start:b8,x:b0,y:b3,", + "03000000de2800000211000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "03000000de2800000112000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "05000000de2800000212000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "03000000de2800004211000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", "03000000de280000fc11000001000000,Steam Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", - "03000000de280000ff11000001000000,Valve Streaming Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "03000000de280000ff11000001000000,Steam Virtual Gamepad,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "xinput,XInput Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", "050000005e040000e002000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b4,leftstick:b8,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b9,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", - "030000005e040000d102000001010000,Xbox One Wireless Controller,a:b0,b:b1,back:b6,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b10,righttrigger:a5,rightx:a3,righty:a4,start:b7,x:b2,y:b3,", + "050000005e040000fd02000003090000,Xbox One Wireless Controller,a:b0,b:b1,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b16,leftshoulder:b6,leftstick:b13,lefttrigger:a5,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a4,rightx:a2,righty:a3,start:b11,x:b3,y:b4,", + "05000000172700004431000029010000,XiaoMi Game Controller,a:b0,b:b1,back:b10,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b20,leftshoulder:b6,leftstick:b13,lefttrigger:a7,leftx:a0,lefty:a1,rightshoulder:b7,rightstick:b14,righttrigger:a6,rightx:a2,righty:a5,start:b11,x:b3,y:b4,", + "03000000120c0000100e000011010000,ZEROPLUS P4 Gamepad,a:b1,b:b2,back:b8,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b12,leftshoulder:b4,leftstick:b10,lefttrigger:a3,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:a4,rightx:a2,righty:a5,start:b9,x:b0,y:b3,", + "03000000830500006020000010010000,iBuffalo SNES Controller,a:b1,b:b0,back:b6,dpdown:+a1,dpleft:-a0,dpright:+a0,dpup:-a1,leftshoulder:b4,rightshoulder:b5,start:b7,x:b3,y:b2,", #endif #if defined(__ANDROID__) + "34323662653333636330306631326233,ASUS Gamepad,a:b0,b:b1,back:b4,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b6,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,x:b2,y:b3,", + "64633436313965656664373634323364,Microsoft X-Box 360 pad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,x:b2,y:b3,", "4e564944494120436f72706f72617469,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", + "61363931656135336130663561616264,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", + "37336435666338653565313731303834,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,", + "35643031303033326130316330353564,PS4 Controller,a:b1,b:b17,back:b15,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b5,leftshoulder:b3,leftstick:b4,lefttrigger:+a3,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b6,righttrigger:+a4,rightx:a2,righty:a5,start:b16,x:b0,y:b2,", + "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", + "34356136633366613530316338376136,Xbox Wireless Controller,a:b0,b:b1,back:b9,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,guide:b10,leftshoulder:b3,leftstick:b15,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b18,rightstick:b16,righttrigger:a5,rightx:a3,righty:a4,x:b17,y:b2,", #endif #if defined(SDL_JOYSTICK_MFI) "4d466947616d65706164010000000000,MFi Extended Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a5,rightx:a3,righty:a4,start:b6,x:b2,y:b3,", "4d466947616d65706164020000000000,MFi Gamepad,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b4,rightshoulder:b5,start:b6,x:b2,y:b3,", + "4d466947616d65706164030000000000,Remote,a:b0,b:b2,leftx:a0,lefty:a1,", + "05000000de2800000511000001000000,Steam Controller,a:b0,b:b1,back:b6,guide:b8,leftshoulder:b4,leftstick:b9,lefttrigger:a2,leftx:a0,lefty:a1,rightshoulder:b5,righttrigger:a3,start:b7,x:b2,y:b3,", #endif #if defined(SDL_JOYSTICK_EMSCRIPTEN) "emscripten,Standard Gamepad,a:b0,b:b1,back:b8,dpdown:b13,dpleft:b14,dpright:b15,dpup:b12,guide:b16,leftshoulder:b4,leftstick:b10,lefttrigger:b6,leftx:a0,lefty:a1,rightshoulder:b5,rightstick:b11,righttrigger:b7,rightx:a2,righty:a3,start:b9,x:b2,y:b3,", diff --git a/Engine/lib/sdl/src/joystick/SDL_joystick.c b/Engine/lib/sdl/src/joystick/SDL_joystick.c index c426a39e5..b93c03d37 100644 --- a/Engine/lib/sdl/src/joystick/SDL_joystick.c +++ b/Engine/lib/sdl/src/joystick/SDL_joystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,12 +31,32 @@ #if !SDL_EVENTS_DISABLED #include "../events/SDL_events_c.h" #endif +#include "../video/SDL_sysvideo.h" + static SDL_bool SDL_joystick_allows_background_events = SDL_FALSE; static SDL_Joystick *SDL_joysticks = NULL; -static SDL_Joystick *SDL_updating_joystick = NULL; +static SDL_bool SDL_updating_joystick = SDL_FALSE; +static SDL_mutex *SDL_joystick_lock = NULL; /* This needs to support recursive locks */ -static void +void +SDL_LockJoysticks(void) +{ + if (SDL_joystick_lock) { + SDL_LockMutex(SDL_joystick_lock); + } +} + +void +SDL_UnlockJoysticks(void) +{ + if (SDL_joystick_lock) { + SDL_UnlockMutex(SDL_joystick_lock); + } +} + + +static void SDLCALL SDL_JoystickAllowBackgroundEventsChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { if (hint && *hint == '1') { @@ -51,6 +71,13 @@ SDL_JoystickInit(void) { int status; + SDL_GameControllerInitMappings(); + + /* Create the joystick list lock */ + if (!SDL_joystick_lock) { + SDL_joystick_lock = SDL_CreateMutex(); + } + /* See if we should allow joystick events while in the background */ SDL_AddHintCallback(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, SDL_JoystickAllowBackgroundEventsChanged, NULL); @@ -83,13 +110,45 @@ SDL_NumJoysticks(void) const char * SDL_JoystickNameForIndex(int device_index) { - if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) { + if (device_index < 0 || device_index >= SDL_NumJoysticks()) { SDL_SetError("There are %d joysticks available", SDL_NumJoysticks()); return (NULL); } return (SDL_SYS_JoystickNameForDeviceIndex(device_index)); } +/* + * Return true if this joystick is known to have all axes centered at zero + * This isn't generally needed unless the joystick never generates an initial axis value near zero, + * e.g. it's emulating axes with digital buttons + */ +static SDL_bool +SDL_JoystickAxesCenteredAtZero(SDL_Joystick *joystick) +{ + static Uint32 zero_centered_joysticks[] = { + MAKE_VIDPID(0x0e8f, 0x3013), /* HuiJia SNES USB adapter */ + MAKE_VIDPID(0x05a0, 0x3232), /* 8Bitdo Zero Gamepad */ + }; + + int i; + Uint32 id = MAKE_VIDPID(SDL_JoystickGetVendor(joystick), + SDL_JoystickGetProduct(joystick)); + +/*printf("JOYSTICK '%s' VID/PID 0x%.4x/0x%.4x AXES: %d\n", joystick->name, vendor, product, joystick->naxes);*/ + + if (joystick->naxes == 2) { + /* Assume D-pad or thumbstick style axes are centered at 0 */ + return SDL_TRUE; + } + + for (i = 0; i < SDL_arraysize(zero_centered_joysticks); ++i) { + if (id == zero_centered_joysticks[i]) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + /* * Open a joystick for use - the index passed as an argument refers to * the N'th joystick on the system. This index is the value which will @@ -109,29 +168,33 @@ SDL_JoystickOpen(int device_index) return (NULL); } + SDL_LockJoysticks(); + joysticklist = SDL_joysticks; /* If the joystick is already open, return it - * it is important that we have a single joystick * for each instance id - */ + * it is important that we have a single joystick * for each instance id + */ while (joysticklist) { - if (SDL_SYS_GetInstanceIdOfDeviceIndex(device_index) == joysticklist->instance_id) { + if (SDL_JoystickGetDeviceInstanceID(device_index) == joysticklist->instance_id) { joystick = joysticklist; ++joystick->ref_count; + SDL_UnlockJoysticks(); return (joystick); } joysticklist = joysticklist->next; } /* Create and initialize the joystick */ - joystick = (SDL_Joystick *) SDL_malloc((sizeof *joystick)); + joystick = (SDL_Joystick *) SDL_calloc(sizeof(*joystick), 1); if (joystick == NULL) { SDL_OutOfMemory(); + SDL_UnlockJoysticks(); return NULL; } - SDL_memset(joystick, 0, (sizeof *joystick)); if (SDL_SYS_JoystickOpen(joystick, device_index) < 0) { SDL_free(joystick); + SDL_UnlockJoysticks(); return NULL; } @@ -142,20 +205,16 @@ SDL_JoystickOpen(int device_index) joystick->name = NULL; if (joystick->naxes > 0) { - joystick->axes = (Sint16 *) SDL_malloc(joystick->naxes * sizeof(Sint16)); - joystick->axes_zero = (Sint16 *) SDL_malloc(joystick->naxes * sizeof(Sint16)); + joystick->axes = (SDL_JoystickAxisInfo *) SDL_calloc(joystick->naxes, sizeof(SDL_JoystickAxisInfo)); } if (joystick->nhats > 0) { - joystick->hats = (Uint8 *) SDL_malloc - (joystick->nhats * sizeof(Uint8)); + joystick->hats = (Uint8 *) SDL_calloc(joystick->nhats, sizeof(Uint8)); } if (joystick->nballs > 0) { - joystick->balls = (struct balldelta *) SDL_malloc - (joystick->nballs * sizeof(*joystick->balls)); + joystick->balls = (struct balldelta *) SDL_calloc(joystick->nballs, sizeof(*joystick->balls)); } if (joystick->nbuttons > 0) { - joystick->buttons = (Uint8 *) SDL_malloc - (joystick->nbuttons * sizeof(Uint8)); + joystick->buttons = (Uint8 *) SDL_calloc(joystick->nbuttons, sizeof(Uint8)); } if (((joystick->naxes > 0) && !joystick->axes) || ((joystick->nhats > 0) && !joystick->hats) @@ -163,30 +222,30 @@ SDL_JoystickOpen(int device_index) || ((joystick->nbuttons > 0) && !joystick->buttons)) { SDL_OutOfMemory(); SDL_JoystickClose(joystick); + SDL_UnlockJoysticks(); return NULL; } - if (joystick->axes) { - SDL_memset(joystick->axes, 0, joystick->naxes * sizeof(Sint16)); - SDL_memset(joystick->axes_zero, 0, joystick->naxes * sizeof(Sint16)); - } - if (joystick->hats) { - SDL_memset(joystick->hats, 0, joystick->nhats * sizeof(Uint8)); - } - if (joystick->balls) { - SDL_memset(joystick->balls, 0, - joystick->nballs * sizeof(*joystick->balls)); - } - if (joystick->buttons) { - SDL_memset(joystick->buttons, 0, joystick->nbuttons * sizeof(Uint8)); - } joystick->epowerlevel = SDL_JOYSTICK_POWER_UNKNOWN; + /* If this joystick is known to have all zero centered axes, skip the auto-centering code */ + if (SDL_JoystickAxesCenteredAtZero(joystick)) { + int i; + + for (i = 0; i < joystick->naxes; ++i) { + joystick->axes[i].has_initial_value = SDL_TRUE; + } + } + + joystick->is_game_controller = SDL_IsGameController(device_index); + /* Add joystick to list */ ++joystick->ref_count; /* Link the joystick in the list */ joystick->next = SDL_joysticks; SDL_joysticks = joystick; + SDL_UnlockJoysticks(); + SDL_SYS_JoystickUpdate(joystick); return (joystick); @@ -271,7 +330,7 @@ SDL_JoystickGetAxis(SDL_Joystick * joystick, int axis) return (0); } if (axis < joystick->naxes) { - state = joystick->axes[axis]; + state = joystick->axes[axis].value; } else { SDL_SetError("Joystick only has %d axes", joystick->naxes); state = 0; @@ -279,6 +338,25 @@ SDL_JoystickGetAxis(SDL_Joystick * joystick, int axis) return (state); } +/* + * Get the initial state of an axis control on a joystick + */ +SDL_bool +SDL_JoystickGetAxisInitialState(SDL_Joystick * joystick, int axis, Sint16 *state) +{ + if (!SDL_PrivateJoystickValid(joystick)) { + return SDL_FALSE; + } + if (axis >= joystick->naxes) { + SDL_SetError("Joystick only has %d axes", joystick->naxes); + return SDL_FALSE; + } + if (state) { + *state = joystick->axes[axis].initial_value; + } + return joystick->axes[axis].has_initial_value; +} + /* * Get the current state of a hat on a joystick */ @@ -380,14 +458,16 @@ SDL_JoystickInstanceID(SDL_Joystick * joystick) SDL_Joystick * SDL_JoystickFromInstanceID(SDL_JoystickID joyid) { - SDL_Joystick *joystick = SDL_joysticks; - while (joystick) { + SDL_Joystick *joystick; + + SDL_LockJoysticks(); + for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { if (joystick->instance_id == joyid) { + SDL_UnlockJoysticks(); return joystick; } - joystick = joystick->next; } - + SDL_UnlockJoysticks(); return NULL; } @@ -417,12 +497,16 @@ SDL_JoystickClose(SDL_Joystick * joystick) return; } + SDL_LockJoysticks(); + /* First decrement ref count */ if (--joystick->ref_count > 0) { + SDL_UnlockJoysticks(); return; } - if (joystick == SDL_updating_joystick) { + if (SDL_updating_joystick) { + SDL_UnlockJoysticks(); return; } @@ -453,6 +537,8 @@ SDL_JoystickClose(SDL_Joystick * joystick) SDL_free(joystick->balls); SDL_free(joystick->buttons); SDL_free(joystick); + + SDL_UnlockJoysticks(); } void @@ -461,6 +547,8 @@ SDL_JoystickQuit(void) /* Make sure we're not getting called in the middle of updating joysticks */ SDL_assert(!SDL_updating_joystick); + SDL_LockJoysticks(); + /* Stop the event polling */ while (SDL_joysticks) { SDL_joysticks->ref_count = 1; @@ -470,9 +558,21 @@ SDL_JoystickQuit(void) /* Quit the joystick setup */ SDL_SYS_JoystickQuit(); + SDL_UnlockJoysticks(); + #if !SDL_EVENTS_DISABLED SDL_QuitSubSystem(SDL_INIT_EVENTS); #endif + + SDL_DelHintCallback(SDL_HINT_JOYSTICK_ALLOW_BACKGROUND_EVENTS, + SDL_JoystickAllowBackgroundEventsChanged, NULL); + + if (SDL_joystick_lock) { + SDL_DestroyMutex(SDL_joystick_lock); + SDL_joystick_lock = NULL; + } + + SDL_GameControllerQuitMappings(); } @@ -483,16 +583,10 @@ SDL_PrivateJoystickShouldIgnoreEvent() return SDL_FALSE; } - if (SDL_WasInit(SDL_INIT_VIDEO)) { - if (SDL_GetKeyboardFocus() == NULL) { - /* Video is initialized and we don't have focus, ignore the event. */ - return SDL_TRUE; - } else { - return SDL_FALSE; - } + if (SDL_HasWindows() && SDL_GetKeyboardFocus() == NULL) { + /* We have windows but we don't have focus, ignore the event. */ + return SDL_TRUE; } - - /* Video subsystem wasn't initialized, always allow the event */ return SDL_FALSE; } @@ -507,10 +601,7 @@ void SDL_PrivateJoystickAdded(int device_index) if (SDL_GetEventState(event.type) == SDL_ENABLE) { event.jdevice.which = device_index; - if ( (SDL_EventOK == NULL) || - (*SDL_EventOK) (SDL_EventOKParam, &event) ) { - SDL_PushEvent(&event); - } + SDL_PushEvent(&event); } #endif /* !SDL_EVENTS_DISABLED */ } @@ -553,10 +644,7 @@ void SDL_PrivateJoystickRemoved(SDL_JoystickID device_instance) if (SDL_GetEventState(event.type) == SDL_ENABLE) { event.jdevice.which = device_instance; - if ( (SDL_EventOK == NULL) || - (*SDL_EventOK) (SDL_EventOKParam, &event) ) { - SDL_PushEvent(&event); - } + SDL_PushEvent(&event); } UpdateEventsForDeviceRemoval(); @@ -572,22 +660,38 @@ SDL_PrivateJoystickAxis(SDL_Joystick * joystick, Uint8 axis, Sint16 value) if (axis >= joystick->naxes) { return 0; } - if (value == joystick->axes[axis]) { + if (!joystick->axes[axis].has_initial_value) { + joystick->axes[axis].initial_value = value; + joystick->axes[axis].value = value; + joystick->axes[axis].zero = value; + joystick->axes[axis].has_initial_value = SDL_TRUE; + } + if (value == joystick->axes[axis].value) { return 0; } + if (!joystick->axes[axis].sent_initial_value) { + /* Make sure we don't send motion until there's real activity on this axis */ + const int MAX_ALLOWED_JITTER = SDL_JOYSTICK_AXIS_MAX / 80; /* ShanWan PS3 controller needed 96 */ + if (SDL_abs(value - joystick->axes[axis].value) <= MAX_ALLOWED_JITTER) { + return 0; + } + joystick->axes[axis].sent_initial_value = SDL_TRUE; + joystick->axes[axis].value = value; /* Just so we pass the check above */ + SDL_PrivateJoystickAxis(joystick, axis, joystick->axes[axis].initial_value); + } /* We ignore events if we don't have keyboard focus, except for centering * events. */ if (SDL_PrivateJoystickShouldIgnoreEvent()) { - if ((value > joystick->axes_zero[axis] && value >= joystick->axes[axis]) || - (value < joystick->axes_zero[axis] && value <= joystick->axes[axis])) { + if ((value > joystick->axes[axis].zero && value >= joystick->axes[axis].value) || + (value < joystick->axes[axis].zero && value <= joystick->axes[axis].value)) { return 0; } } /* Update internal joystick state */ - joystick->axes[axis] = value; + joystick->axes[axis].value = value; /* Post the event, if desired */ posted = 0; @@ -737,24 +841,30 @@ SDL_JoystickUpdate(void) { SDL_Joystick *joystick; - joystick = SDL_joysticks; - while (joystick) { - SDL_Joystick *joysticknext; - /* save off the next pointer, the Update call may cause a joystick removed event - * and cause our joystick pointer to be freed - */ - joysticknext = joystick->next; + SDL_LockJoysticks(); - SDL_updating_joystick = joystick; + if (SDL_updating_joystick) { + /* The joysticks are already being updated */ + SDL_UnlockJoysticks(); + return; + } + SDL_updating_joystick = SDL_TRUE; + + /* Make sure the list is unlocked while dispatching events to prevent application deadlocks */ + SDL_UnlockJoysticks(); + + for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { SDL_SYS_JoystickUpdate(joystick); if (joystick->force_recentering) { int i; - /* Tell the app that everything is centered/unpressed... */ + /* Tell the app that everything is centered/unpressed... */ for (i = 0; i < joystick->naxes; i++) { - SDL_PrivateJoystickAxis(joystick, i, joystick->axes_zero[i]); + if (joystick->axes[i].has_initial_value) { + SDL_PrivateJoystickAxis(joystick, i, joystick->axes[i].zero); + } } for (i = 0; i < joystick->nbuttons; i++) { @@ -767,21 +877,25 @@ SDL_JoystickUpdate(void) joystick->force_recentering = SDL_FALSE; } + } - SDL_updating_joystick = NULL; + SDL_LockJoysticks(); - /* If the joystick was closed while updating, free it here */ + SDL_updating_joystick = SDL_FALSE; + + /* If any joysticks were closed while updating, free them here */ + for (joystick = SDL_joysticks; joystick; joystick = joystick->next) { if (joystick->ref_count <= 0) { SDL_JoystickClose(joystick); } - - joystick = joysticknext; } /* this needs to happen AFTER walking the joystick list above, so that any dangling hardware data from removed devices can be free'd */ SDL_SYS_JoystickDetect(); + + SDL_UnlockJoysticks(); } int @@ -816,10 +930,154 @@ SDL_JoystickEventState(int state) #endif /* SDL_EVENTS_DISABLED */ } +void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version) +{ + Uint16 *guid16 = (Uint16 *)guid.data; + + /* If the GUID fits the form of BUS 0000 VENDOR 0000 PRODUCT 0000, return the data */ + if (/* guid16[0] is device bus type */ + guid16[1] == 0x0000 && + /* guid16[2] is vendor ID */ + guid16[3] == 0x0000 && + /* guid16[4] is product ID */ + guid16[5] == 0x0000 + /* guid16[6] is product version */ + ) { + if (vendor) { + *vendor = guid16[2]; + } + if (product) { + *product = guid16[4]; + } + if (version) { + *version = guid16[6]; + } + } else { + if (vendor) { + *vendor = 0; + } + if (product) { + *product = 0; + } + if (version) { + *version = 0; + } + } +} + +static SDL_bool SDL_IsJoystickProductWheel(Uint32 vidpid) +{ + static Uint32 wheel_joysticks[] = { + MAKE_VIDPID(0x046d, 0xc294), /* Logitech generic wheel */ + MAKE_VIDPID(0x046d, 0xc295), /* Logitech Momo Force */ + MAKE_VIDPID(0x046d, 0xc298), /* Logitech Driving Force Pro */ + MAKE_VIDPID(0x046d, 0xc299), /* Logitech G25 */ + MAKE_VIDPID(0x046d, 0xc29a), /* Logitech Driving Force GT */ + MAKE_VIDPID(0x046d, 0xc29b), /* Logitech G27 */ + MAKE_VIDPID(0x046d, 0xc261), /* Logitech G920 (initial mode) */ + MAKE_VIDPID(0x046d, 0xc262), /* Logitech G920 (active mode) */ + MAKE_VIDPID(0x044f, 0xb65d), /* Thrustmaster Wheel FFB */ + MAKE_VIDPID(0x044f, 0xb66d), /* Thrustmaster Wheel FFB */ + MAKE_VIDPID(0x044f, 0xb677), /* Thrustmaster T150 */ + MAKE_VIDPID(0x044f, 0xb664), /* Thrustmaster TX (initial mode) */ + MAKE_VIDPID(0x044f, 0xb669), /* Thrustmaster TX (active mode) */ + }; + int i; + + for (i = 0; i < SDL_arraysize(wheel_joysticks); ++i) { + if (vidpid == wheel_joysticks[i]) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static SDL_bool SDL_IsJoystickProductFlightStick(Uint32 vidpid) +{ + static Uint32 flightstick_joysticks[] = { + MAKE_VIDPID(0x044f, 0x0402), /* HOTAS Warthog Joystick */ + MAKE_VIDPID(0x0738, 0x2221), /* Saitek Pro Flight X-56 Rhino Stick */ + }; + int i; + + for (i = 0; i < SDL_arraysize(flightstick_joysticks); ++i) { + if (vidpid == flightstick_joysticks[i]) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static SDL_bool SDL_IsJoystickProductThrottle(Uint32 vidpid) +{ + static Uint32 throttle_joysticks[] = { + MAKE_VIDPID(0x044f, 0x0404), /* HOTAS Warthog Throttle */ + MAKE_VIDPID(0x0738, 0xa221), /* Saitek Pro Flight X-56 Rhino Throttle */ + }; + int i; + + for (i = 0; i < SDL_arraysize(throttle_joysticks); ++i) { + if (vidpid == throttle_joysticks[i]) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static SDL_JoystickType SDL_GetJoystickGUIDType(SDL_JoystickGUID guid) +{ + Uint16 vendor; + Uint16 product; + Uint32 vidpid; + + if (guid.data[14] == 'x') { + /* XInput GUID, get the type based on the XInput device subtype */ + switch (guid.data[15]) { + case 0x01: /* XINPUT_DEVSUBTYPE_GAMEPAD */ + return SDL_JOYSTICK_TYPE_GAMECONTROLLER; + case 0x02: /* XINPUT_DEVSUBTYPE_WHEEL */ + return SDL_JOYSTICK_TYPE_WHEEL; + case 0x03: /* XINPUT_DEVSUBTYPE_ARCADE_STICK */ + return SDL_JOYSTICK_TYPE_ARCADE_STICK; + case 0x04: /* XINPUT_DEVSUBTYPE_FLIGHT_STICK */ + return SDL_JOYSTICK_TYPE_FLIGHT_STICK; + case 0x05: /* XINPUT_DEVSUBTYPE_DANCE_PAD */ + return SDL_JOYSTICK_TYPE_DANCE_PAD; + case 0x06: /* XINPUT_DEVSUBTYPE_GUITAR */ + case 0x07: /* XINPUT_DEVSUBTYPE_GUITAR_ALTERNATE */ + case 0x0B: /* XINPUT_DEVSUBTYPE_GUITAR_BASS */ + return SDL_JOYSTICK_TYPE_GUITAR; + case 0x08: /* XINPUT_DEVSUBTYPE_DRUM_KIT */ + return SDL_JOYSTICK_TYPE_DRUM_KIT; + case 0x13: /* XINPUT_DEVSUBTYPE_ARCADE_PAD */ + return SDL_JOYSTICK_TYPE_ARCADE_PAD; + default: + return SDL_JOYSTICK_TYPE_UNKNOWN; + } + } + + SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL); + vidpid = MAKE_VIDPID(vendor, product); + + if (SDL_IsJoystickProductWheel(vidpid)) { + return SDL_JOYSTICK_TYPE_WHEEL; + } + + if (SDL_IsJoystickProductFlightStick(vidpid)) { + return SDL_JOYSTICK_TYPE_FLIGHT_STICK; + } + + if (SDL_IsJoystickProductThrottle(vidpid)) { + return SDL_JOYSTICK_TYPE_THROTTLE; + } + + return SDL_JOYSTICK_TYPE_UNKNOWN; +} + /* return the guid for this index */ SDL_JoystickGUID SDL_JoystickGetDeviceGUID(int device_index) { - if ((device_index < 0) || (device_index >= SDL_NumJoysticks())) { + if (device_index < 0 || device_index >= SDL_NumJoysticks()) { SDL_JoystickGUID emptyGUID; SDL_SetError("There are %d joysticks available", SDL_NumJoysticks()); SDL_zero(emptyGUID); @@ -828,7 +1086,56 @@ SDL_JoystickGUID SDL_JoystickGetDeviceGUID(int device_index) return SDL_SYS_JoystickGetDeviceGUID(device_index); } -/* return the guid for this opened device */ +Uint16 SDL_JoystickGetDeviceVendor(int device_index) +{ + Uint16 vendor; + SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index); + + SDL_GetJoystickGUIDInfo(guid, &vendor, NULL, NULL); + return vendor; +} + +Uint16 SDL_JoystickGetDeviceProduct(int device_index) +{ + Uint16 product; + SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index); + + SDL_GetJoystickGUIDInfo(guid, NULL, &product, NULL); + return product; +} + +Uint16 SDL_JoystickGetDeviceProductVersion(int device_index) +{ + Uint16 version; + SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index); + + SDL_GetJoystickGUIDInfo(guid, NULL, NULL, &version); + return version; +} + +SDL_JoystickType SDL_JoystickGetDeviceType(int device_index) +{ + SDL_JoystickType type; + SDL_JoystickGUID guid = SDL_JoystickGetDeviceGUID(device_index); + + type = SDL_GetJoystickGUIDType(guid); + if (type == SDL_JOYSTICK_TYPE_UNKNOWN) { + if (SDL_IsGameController(device_index)) { + type = SDL_JOYSTICK_TYPE_GAMECONTROLLER; + } + } + return type; +} + +SDL_JoystickID SDL_JoystickGetDeviceInstanceID(int device_index) +{ + if (device_index < 0 || device_index >= SDL_NumJoysticks()) { + SDL_SetError("There are %d joysticks available", SDL_NumJoysticks()); + return -1; + } + return SDL_SYS_GetInstanceIdOfDeviceIndex(device_index); +} + SDL_JoystickGUID SDL_JoystickGetGUID(SDL_Joystick * joystick) { if (!SDL_PrivateJoystickValid(joystick)) { @@ -839,6 +1146,47 @@ SDL_JoystickGUID SDL_JoystickGetGUID(SDL_Joystick * joystick) return SDL_SYS_JoystickGetGUID(joystick); } +Uint16 SDL_JoystickGetVendor(SDL_Joystick * joystick) +{ + Uint16 vendor; + SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); + + SDL_GetJoystickGUIDInfo(guid, &vendor, NULL, NULL); + return vendor; +} + +Uint16 SDL_JoystickGetProduct(SDL_Joystick * joystick) +{ + Uint16 product; + SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); + + SDL_GetJoystickGUIDInfo(guid, NULL, &product, NULL); + return product; +} + +Uint16 SDL_JoystickGetProductVersion(SDL_Joystick * joystick) +{ + Uint16 version; + SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); + + SDL_GetJoystickGUIDInfo(guid, NULL, NULL, &version); + return version; +} + +SDL_JoystickType SDL_JoystickGetType(SDL_Joystick * joystick) +{ + SDL_JoystickType type; + SDL_JoystickGUID guid = SDL_JoystickGetGUID(joystick); + + type = SDL_GetJoystickGUIDType(guid); + if (type == SDL_JOYSTICK_TYPE_UNKNOWN) { + if (joystick && joystick->is_game_controller) { + type = SDL_JOYSTICK_TYPE_GAMECONTROLLER; + } + } + return type; +} + /* convert the guid to a printable string */ void SDL_JoystickGetGUIDString(SDL_JoystickGUID guid, char *pszGUID, int cbGUID) { @@ -925,5 +1273,4 @@ SDL_JoystickPowerLevel SDL_JoystickCurrentPowerLevel(SDL_Joystick * joystick) return joystick->epowerlevel; } - /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/joystick/SDL_joystick_c.h b/Engine/lib/sdl/src/joystick/SDL_joystick_c.h index cb9c92544..0a8fdb455 100644 --- a/Engine/lib/sdl/src/joystick/SDL_joystick_c.h +++ b/Engine/lib/sdl/src/joystick/SDL_joystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,9 +28,19 @@ extern int SDL_JoystickInit(void); extern void SDL_JoystickQuit(void); /* Initialization and shutdown functions */ +extern int SDL_GameControllerInitMappings(void); +extern void SDL_GameControllerQuitMappings(void); extern int SDL_GameControllerInit(void); extern void SDL_GameControllerQuit(void); +/* Function to extract information from an SDL joystick GUID */ +extern void SDL_GetJoystickGUIDInfo(SDL_JoystickGUID guid, Uint16 *vendor, Uint16 *product, Uint16 *version); + +/* Function to return whether a joystick name and GUID is a game controller */ +extern SDL_bool SDL_IsGameControllerNameAndGUID(const char *name, SDL_JoystickGUID guid); + +/* Function to return whether a game controller should be ignored */ +extern SDL_bool SDL_ShouldIgnoreGameController(const char *name, SDL_JoystickGUID guid); /* Internal event queueing functions */ extern void SDL_PrivateJoystickAdded(int device_index); diff --git a/Engine/lib/sdl/src/joystick/SDL_sysjoystick.h b/Engine/lib/sdl/src/joystick/SDL_sysjoystick.h index f4cad05ec..7de5d83d2 100644 --- a/Engine/lib/sdl/src/joystick/SDL_sysjoystick.h +++ b/Engine/lib/sdl/src/joystick/SDL_sysjoystick.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_sysjoystick_h -#define _SDL_sysjoystick_h +#ifndef SDL_sysjoystick_h_ +#define SDL_sysjoystick_h_ /* This is the system specific header for the SDL joystick API */ @@ -29,14 +29,22 @@ #include "SDL_joystick_c.h" /* The SDL joystick structure */ +typedef struct _SDL_JoystickAxisInfo +{ + Sint16 initial_value; /* Initial axis state */ + Sint16 value; /* Current axis state */ + Sint16 zero; /* Zero point on the axis (-32768 for triggers) */ + SDL_bool has_initial_value; /* Whether we've seen a value on the axis yet */ + SDL_bool sent_initial_value; /* Whether we've sent the initial axis value */ +} SDL_JoystickAxisInfo; + struct _SDL_Joystick { SDL_JoystickID instance_id; /* Device instance, monotonically increasing from 0 */ char *name; /* Joystick name - system dependent */ int naxes; /* Number of axis controls on the joystick */ - Sint16 *axes; /* Current axis states */ - Sint16 *axes_zero; /* Zero point on the axis (-32768 for triggers) */ + SDL_JoystickAxisInfo *axes; int nhats; /* Number of hats on the joystick */ Uint8 *hats; /* Current hat states */ @@ -54,11 +62,15 @@ struct _SDL_Joystick int ref_count; /* Reference count for multiple opens */ + SDL_bool is_game_controller; SDL_bool force_recentering; /* SDL_TRUE if this device needs to have its state reset to 0 */ SDL_JoystickPowerLevel epowerlevel; /* power level of this joystick, SDL_JOYSTICK_POWER_UNKNOWN if not supported */ struct _SDL_Joystick *next; /* pointer to next joystick we have allocated */ }; +/* Macro to combine a USB vendor ID and product ID into a single Uint32 value */ +#define MAKE_VIDPID(VID, PID) (((Uint32)(VID))<<16|(PID)) + /* Function to scan the system for joysticks. * Joystick 0 should be the system default joystick. * This function should return the number of available joysticks, or -1 @@ -67,10 +79,10 @@ struct _SDL_Joystick extern int SDL_SYS_JoystickInit(void); /* Function to return the number of joystick devices plugged in right now */ -extern int SDL_SYS_NumJoysticks(); +extern int SDL_SYS_NumJoysticks(void); /* Function to cause any queued joystick insertions to be processed */ -extern void SDL_SYS_JoystickDetect(); +extern void SDL_SYS_JoystickDetect(void); /* Function to get the device-dependent name of a joystick */ extern const char *SDL_SYS_JoystickNameForDeviceIndex(int device_index); @@ -114,6 +126,11 @@ extern SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick); extern SDL_bool SDL_SYS_IsXInputGamepad_DeviceIndex(int device_index); #endif -#endif /* _SDL_sysjoystick_h */ +#if defined(__ANDROID__) +/* Function returns SDL_TRUE if this device is a DPAD (maybe a TV remote) */ +extern SDL_bool SDL_SYS_IsDPAD_DeviceIndex(int device_index); +#endif + +#endif /* SDL_sysjoystick_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/joystick/android/SDL_sysjoystick.c b/Engine/lib/sdl/src/joystick/android/SDL_sysjoystick.c index a09e9a12c..ce5a5df0b 100644 --- a/Engine/lib/sdl/src/joystick/android/SDL_sysjoystick.c +++ b/Engine/lib/sdl/src/joystick/android/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,7 +34,9 @@ #include "SDL_log.h" #include "SDL_sysjoystick_c.h" #include "../SDL_joystick_c.h" +#include "../../events/SDL_keyboard_c.h" #include "../../core/android/SDL_android.h" +#include "../steam/SDL_steamcontroller.h" #include "android/keycodes.h" @@ -77,10 +79,9 @@ static int instance_counter = 0; static int keycode_to_SDL(int keycode) { - /* FIXME: If this function gets too unwiedly in the future, replace with a lookup table */ + /* FIXME: If this function gets too unwieldy in the future, replace with a lookup table */ int button = 0; - switch(keycode) - { + switch (keycode) { /* Some gamepad buttons (API 9) */ case AKEYCODE_BUTTON_A: button = SDL_CONTROLLER_BUTTON_A; @@ -109,6 +110,7 @@ keycode_to_SDL(int keycode) case AKEYCODE_BUTTON_START: button = SDL_CONTROLLER_BUTTON_START; break; + case AKEYCODE_BACK: case AKEYCODE_BUTTON_SELECT: button = SDL_CONTROLLER_BUTTON_BACK; break; @@ -142,7 +144,9 @@ keycode_to_SDL(int keycode) button = SDL_CONTROLLER_BUTTON_DPAD_RIGHT; break; case AKEYCODE_DPAD_CENTER: - button = SDL_CONTROLLER_BUTTON_MAX+4; /* Not supported by GameController */ + /* This is handled better by applications as the A button */ + /*button = SDL_CONTROLLER_BUTTON_MAX+4;*/ /* Not supported by GameController */ + button = SDL_CONTROLLER_BUTTON_A; break; /* More gamepad buttons (API 12), these get mapped to 20...35*/ @@ -167,7 +171,7 @@ keycode_to_SDL(int keycode) default: return -1; - break; + /* break; -Wunreachable-code-break */ } /* This is here in case future generations, probably with six fingers per hand, @@ -175,7 +179,30 @@ keycode_to_SDL(int keycode) */ SDL_assert(button < ANDROID_MAX_NBUTTONS); return button; - +} + +static SDL_Scancode +button_to_scancode(int button) +{ + switch (button) { + case SDL_CONTROLLER_BUTTON_A: + return SDL_SCANCODE_RETURN; + case SDL_CONTROLLER_BUTTON_B: + return SDL_SCANCODE_ESCAPE; + case SDL_CONTROLLER_BUTTON_BACK: + return SDL_SCANCODE_ESCAPE; + case SDL_CONTROLLER_BUTTON_DPAD_UP: + return SDL_SCANCODE_UP; + case SDL_CONTROLLER_BUTTON_DPAD_DOWN: + return SDL_SCANCODE_DOWN; + case SDL_CONTROLLER_BUTTON_DPAD_LEFT: + return SDL_SCANCODE_LEFT; + case SDL_CONTROLLER_BUTTON_DPAD_RIGHT: + return SDL_SCANCODE_RIGHT; + } + + /* Unsupported button */ + return SDL_SCANCODE_UNKNOWN; } int @@ -187,6 +214,8 @@ Android_OnPadDown(int device_id, int keycode) item = JoystickByDeviceId(device_id); if (item && item->joystick) { SDL_PrivateJoystickButton(item->joystick, button , SDL_PRESSED); + } else { + SDL_SendKeyboardKey(SDL_PRESSED, button_to_scancode(button)); } return 0; } @@ -203,6 +232,8 @@ Android_OnPadUp(int device_id, int keycode) item = JoystickByDeviceId(device_id); if (item && item->joystick) { SDL_PrivateJoystickButton(item->joystick, button, SDL_RELEASED); + } else { + SDL_SendKeyboardKey(SDL_RELEASED, button_to_scancode(button)); } return 0; } @@ -216,7 +247,7 @@ Android_OnJoy(int device_id, int axis, float value) /* Android gives joy info normalized as [-1.0, 1.0] or [0.0, 1.0] */ SDL_joylist_item *item = JoystickByDeviceId(device_id); if (item && item->joystick) { - SDL_PrivateJoystickAxis(item->joystick, axis, (Sint16) (32767.*value) ); + SDL_PrivateJoystickAxis(item->joystick, axis, (Sint16) (32767.*value)); } return 0; @@ -234,7 +265,7 @@ Android_OnHat(int device_id, int hat_id, int x, int y) if (x >= -1 && x <=1 && y >= -1 && y <= 1) { SDL_joylist_item *item = JoystickByDeviceId(device_id); if (item && item->joystick) { - SDL_PrivateJoystickHat(item->joystick, hat_id, position_map[y+1][x+1] ); + SDL_PrivateJoystickHat(item->joystick, hat_id, position_map[y+1][x+1]); } return 0; } @@ -244,18 +275,25 @@ Android_OnHat(int device_id, int hat_id, int x, int y) int -Android_AddJoystick(int device_id, const char *name, SDL_bool is_accelerometer, int nbuttons, int naxes, int nhats, int nballs) +Android_AddJoystick(int device_id, const char *name, const char *desc, SDL_bool is_accelerometer, int nbuttons, int naxes, int nhats, int nballs) { SDL_JoystickGUID guid; SDL_joylist_item *item; + + if (!SDL_GetHintBoolean(SDL_HINT_TV_REMOTE_AS_JOYSTICK, SDL_TRUE)) { + /* Ignore devices that aren't actually controllers (e.g. remotes), they'll be handled as keyboard input */ + if (naxes < 2 && nhats < 1) { + return -1; + } + } - if(JoystickByDeviceId(device_id) != NULL || name == NULL) { + if (JoystickByDeviceId(device_id) != NULL || name == NULL) { return -1; } /* the GUID is just the first 16 chars of the name for now */ - SDL_zero( guid ); - SDL_memcpy( &guid, name, SDL_min( sizeof(guid), SDL_strlen( name ) ) ); + SDL_zero(guid); + SDL_memcpy(&guid, desc, SDL_min(sizeof(guid), SDL_strlen(desc))); item = (SDL_joylist_item *) SDL_malloc(sizeof (SDL_joylist_item)); if (item == NULL) { @@ -266,7 +304,7 @@ Android_AddJoystick(int device_id, const char *name, SDL_bool is_accelerometer, item->guid = guid; item->device_id = device_id; item->name = SDL_strdup(name); - if ( item->name == NULL ) { + if (item->name == NULL) { SDL_free(item); return -1; } @@ -349,6 +387,79 @@ Android_RemoveJoystick(int device_id) } +static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_JoystickGUID guid, int *device_instance) +{ + SDL_joylist_item *item; + + item = (SDL_joylist_item *)SDL_calloc(1, sizeof (SDL_joylist_item)); + if (item == NULL) { + return SDL_FALSE; + } + + *device_instance = item->device_instance = instance_counter++; + item->device_id = -1; + item->name = SDL_strdup(name); + item->guid = guid; + SDL_GetSteamControllerInputs(&item->nbuttons, + &item->naxes, + &item->nhats); + item->m_bSteamController = SDL_TRUE; + + if (SDL_joylist_tail == NULL) { + SDL_joylist = SDL_joylist_tail = item; + } else { + SDL_joylist_tail->next = item; + SDL_joylist_tail = item; + } + + /* Need to increment the joystick count before we post the event */ + ++numjoysticks; + + SDL_PrivateJoystickAdded(numjoysticks - 1); + + return SDL_TRUE; +} + +static void SteamControllerDisconnectedCallback(int device_instance) +{ + SDL_joylist_item *item = SDL_joylist; + SDL_joylist_item *prev = NULL; + + while (item != NULL) { + if (item->device_instance == device_instance) { + break; + } + prev = item; + item = item->next; + } + + if (item == NULL) { + return; + } + + if (item->joystick) { + item->joystick->hwdata = NULL; + } + + if (prev != NULL) { + prev->next = item->next; + } else { + SDL_assert(SDL_joylist == item); + SDL_joylist = item->next; + } + if (item == SDL_joylist_tail) { + SDL_joylist_tail = prev; + } + + /* Need to decrement the joystick count before we post the event */ + --numjoysticks; + + SDL_PrivateJoystickRemoved(item->device_instance); + + SDL_free(item->name); + SDL_free(item); +} + int SDL_SYS_JoystickInit(void) { @@ -356,29 +467,36 @@ SDL_SYS_JoystickInit(void) if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE)) { /* Default behavior, accelerometer as joystick */ - Android_AddJoystick(ANDROID_ACCELEROMETER_DEVICE_ID, ANDROID_ACCELEROMETER_NAME, SDL_TRUE, 0, 3, 0, 0); + Android_AddJoystick(ANDROID_ACCELEROMETER_DEVICE_ID, ANDROID_ACCELEROMETER_NAME, ANDROID_ACCELEROMETER_NAME, SDL_TRUE, 0, 3, 0, 0); } + SDL_InitSteamControllers(SteamControllerConnectedCallback, + SteamControllerDisconnectedCallback); + return (numjoysticks); } -int SDL_SYS_NumJoysticks() +int +SDL_SYS_NumJoysticks(void) { return numjoysticks; } -void SDL_SYS_JoystickDetect() +void +SDL_SYS_JoystickDetect(void) { /* Support for device connect/disconnect is API >= 16 only, * so we poll every three seconds * Ref: http://developer.android.com/reference/android/hardware/input/InputManager.InputDeviceListener.html */ static Uint32 timeout = 0; - if (SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { + if (!timeout || SDL_TICKS_PASSED(SDL_GetTicks(), timeout)) { timeout = SDL_GetTicks() + 3000; Android_JNI_PollInputDevices(); } + + SDL_UpdateSteamControllers(); } static SDL_joylist_item * @@ -447,7 +565,7 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) { SDL_joylist_item *item = JoystickByDevIndex(device_index); - if (item == NULL ) { + if (item == NULL) { return SDL_SetError("No such device"); } @@ -475,30 +593,34 @@ SDL_bool SDL_SYS_JoystickAttached(SDL_Joystick *joystick) void SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) { - int i; - Sint16 value; - float values[3]; - SDL_joylist_item *item = SDL_joylist; + SDL_joylist_item *item = (SDL_joylist_item *) joystick->hwdata; - while (item) { - if (item->is_accelerometer) { - if (item->joystick) { - if (Android_JNI_GetAccelerometerValues(values)) { - for ( i = 0; i < 3; i++ ) { - if (values[i] > 1.0f) { - values[i] = 1.0f; - } else if (values[i] < -1.0f) { - values[i] = -1.0f; - } + if (item == NULL) { + return; + } + + if (item->m_bSteamController) { + SDL_UpdateSteamController(joystick); + return; + } - value = (Sint16)(values[i] * 32767.0f); - SDL_PrivateJoystickAxis(item->joystick, i, value); - } + if (item->is_accelerometer) { + int i; + Sint16 value; + float values[3]; + + if (Android_JNI_GetAccelerometerValues(values)) { + for (i = 0; i < 3; i++) { + if (values[i] > 1.0f) { + values[i] = 1.0f; + } else if (values[i] < -1.0f) { + values[i] = -1.0f; } + + value = (Sint16)(values[i] * 32767.0f); + SDL_PrivateJoystickAxis(item->joystick, i, value); } - break; } - item = item->next; } } @@ -516,6 +638,10 @@ SDL_SYS_JoystickClose(SDL_Joystick * joystick) void SDL_SYS_JoystickQuit(void) { +/* We don't have any way to scan for joysticks at init, so don't wipe the list + * of joysticks here in case this is a reinit. + */ +#if 0 SDL_joylist_item *item = NULL; SDL_joylist_item *next = NULL; @@ -529,9 +655,12 @@ SDL_SYS_JoystickQuit(void) numjoysticks = 0; instance_counter = 0; +#endif /* 0 */ + + SDL_QuitSteamControllers(); } -SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index ) +SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID(int device_index) { return JoystickByDevIndex(device_index)->guid; } @@ -548,6 +677,11 @@ SDL_JoystickGUID SDL_SYS_JoystickGetGUID(SDL_Joystick * joystick) return guid; } +SDL_bool SDL_SYS_IsDPAD_DeviceIndex(int device_index) +{ + return JoystickByDevIndex(device_index)->naxes == 0; +} + #endif /* SDL_JOYSTICK_ANDROID */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/joystick/android/SDL_sysjoystick_c.h b/Engine/lib/sdl/src/joystick/android/SDL_sysjoystick_c.h index 51803db35..c2cbc4e6a 100644 --- a/Engine/lib/sdl/src/joystick/android/SDL_sysjoystick_c.h +++ b/Engine/lib/sdl/src/joystick/android/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,13 +22,17 @@ #include "../../SDL_internal.h" #ifdef SDL_JOYSTICK_ANDROID + +#ifndef SDL_sysjoystick_c_h_ +#define SDL_sysjoystick_c_h_ + #include "../SDL_sysjoystick.h" extern int Android_OnPadDown(int device_id, int keycode); extern int Android_OnPadUp(int device_id, int keycode); extern int Android_OnJoy(int device_id, int axisnum, float value); extern int Android_OnHat(int device_id, int hat_id, int x, int y); -extern int Android_AddJoystick(int device_id, const char *name, SDL_bool is_accelerometer, int nbuttons, int naxes, int nhats, int nballs); +extern int Android_AddJoystick(int device_id, const char *name, const char *desc, SDL_bool is_accelerometer, int nbuttons, int naxes, int nhats, int nballs); extern int Android_RemoveJoystick(int device_id); /* A linked list of available joysticks */ @@ -42,11 +46,16 @@ typedef struct SDL_joylist_item SDL_Joystick *joystick; int nbuttons, naxes, nhats, nballs; + /* Steam Controller support */ + SDL_bool m_bSteamController; + struct SDL_joylist_item *next; } SDL_joylist_item; typedef SDL_joylist_item joystick_hwdata; +#endif /* SDL_sysjoystick_c_h_ */ + #endif /* SDL_JOYSTICK_ANDROID */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/joystick/bsd/SDL_sysjoystick.c b/Engine/lib/sdl/src/joystick/bsd/SDL_sysjoystick.c index ddc899f6e..940854504 100644 --- a/Engine/lib/sdl/src/joystick/bsd/SDL_sysjoystick.c +++ b/Engine/lib/sdl/src/joystick/bsd/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -204,12 +204,14 @@ SDL_SYS_JoystickInit(void) return (SDL_SYS_numjoysticks); } -int SDL_SYS_NumJoysticks() +int +SDL_SYS_NumJoysticks(void) { return SDL_SYS_numjoysticks; } -void SDL_SYS_JoystickDetect() +void +SDL_SYS_JoystickDetect(void) { } @@ -520,12 +522,8 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joy) v *= 32768 / ((ymax - ymin + 1) / 2); SDL_PrivateJoystickAxis(joy, 1, v); } - if (gameport.b1 != joy->buttons[0]) { - SDL_PrivateJoystickButton(joy, 0, gameport.b1); - } - if (gameport.b2 != joy->buttons[1]) { - SDL_PrivateJoystickButton(joy, 1, gameport.b2); - } + SDL_PrivateJoystickButton(joy, 0, gameport.b1); + SDL_PrivateJoystickButton(joy, 1, gameport.b2); } return; } @@ -561,9 +559,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joy) v *= 32768 / ((hitem.logical_maximum - hitem.logical_minimum + 1) / 2); - if (v != joy->axes[naxe]) { - SDL_PrivateJoystickAxis(joy, naxe, v); - } + SDL_PrivateJoystickAxis(joy, naxe, v); } else if (usage == HUG_HAT_SWITCH) { v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem); SDL_PrivateJoystickHat(joy, 0, @@ -574,9 +570,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joy) } case HUP_BUTTON: v = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem); - if (joy->buttons[nbutton] != v) { - SDL_PrivateJoystickButton(joy, nbutton, v); - } + SDL_PrivateJoystickButton(joy, nbutton, v); nbutton++; break; default: diff --git a/Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick.c b/Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick.c index da10fbac5..abfb1c62b 100644 --- a/Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick.c +++ b/Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -105,10 +105,11 @@ FreeDevice(recDevice *removeDevice) return pDeviceNext; } -static SInt32 -GetHIDElementState(recDevice *pDevice, recElement *pElement) +static SDL_bool +GetHIDElementState(recDevice *pDevice, recElement *pElement, SInt32 *pValue) { SInt32 value = 0; + int returnValue = SDL_FALSE; if (pDevice && pElement) { IOHIDValueRef valueRef; @@ -122,25 +123,34 @@ GetHIDElementState(recDevice *pDevice, recElement *pElement) if (value > pElement->maxReport) { pElement->maxReport = value; } + *pValue = value; + + returnValue = SDL_TRUE; } } - - return value; + return returnValue; } -static SInt32 -GetHIDScaledCalibratedState(recDevice * pDevice, recElement * pElement, SInt32 min, SInt32 max) +static SDL_bool +GetHIDScaledCalibratedState(recDevice * pDevice, recElement * pElement, SInt32 min, SInt32 max, SInt32 *pValue) { const float deviceScale = max - min; const float readScale = pElement->maxReport - pElement->minReport; - const SInt32 value = GetHIDElementState(pDevice, pElement); - if (readScale == 0) { - return value; /* no scaling at all */ - } - return ((value - pElement->minReport) * deviceScale / readScale) + min; + int returnValue = SDL_FALSE; + if (GetHIDElementState(pDevice, pElement, pValue)) + { + if (readScale == 0) { + returnValue = SDL_TRUE; /* no scaling at all */ + } + else + { + *pValue = ((*pValue - pElement->minReport) * deviceScale / readScale) + min; + returnValue = SDL_TRUE; + } + } + return returnValue; } - static void JoystickDeviceWasRemovedCallback(void *ctx, IOReturn result, void *sender) { @@ -248,6 +258,8 @@ AddHIDElement(const void *value, void *parameter) switch (usage) { case kHIDUsage_Sim_Rudder: case kHIDUsage_Sim_Throttle: + case kHIDUsage_Sim_Accelerator: + case kHIDUsage_Sim_Brake: if (!ElementAlreadyAdded(cookie, pDevice->firstAxis)) { element = (recElement *) SDL_calloc(1, sizeof (recElement)); if (element) { @@ -321,9 +333,14 @@ AddHIDElement(const void *value, void *parameter) static SDL_bool GetDeviceInfo(IOHIDDeviceRef hidDevice, recDevice *pDevice) { - Uint32 *guid32 = NULL; + const Uint16 BUS_USB = 0x03; + const Uint16 BUS_BLUETOOTH = 0x05; + Sint32 vendor = 0; + Sint32 product = 0; + Sint32 version = 0; CFTypeRef refCF = NULL; CFArrayRef array = NULL; + Uint16 *guid16 = (Uint16 *)pDevice->guid.data; /* get usage page and usage */ refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDPrimaryUsagePageKey)); @@ -359,22 +376,32 @@ GetDeviceInfo(IOHIDDeviceRef hidDevice, recDevice *pDevice) refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDVendorIDKey)); if (refCF) { - CFNumberGetValue(refCF, kCFNumberSInt32Type, &pDevice->guid.data[0]); + CFNumberGetValue(refCF, kCFNumberSInt32Type, &vendor); } refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDProductIDKey)); if (refCF) { - CFNumberGetValue(refCF, kCFNumberSInt32Type, &pDevice->guid.data[8]); + CFNumberGetValue(refCF, kCFNumberSInt32Type, &product); } - /* Check to make sure we have a vendor and product ID - If we don't, use the same algorithm as the Linux code for Bluetooth devices */ - guid32 = (Uint32*)pDevice->guid.data; - if (!guid32[0] && !guid32[1]) { - /* If we don't have a vendor and product ID this is probably a Bluetooth device */ - const Uint16 BUS_BLUETOOTH = 0x05; - Uint16 *guid16 = (Uint16 *)guid32; - *guid16++ = BUS_BLUETOOTH; + refCF = IOHIDDeviceGetProperty(hidDevice, CFSTR(kIOHIDVersionNumberKey)); + if (refCF) { + CFNumberGetValue(refCF, kCFNumberSInt32Type, &version); + } + + SDL_memset(pDevice->guid.data, 0, sizeof(pDevice->guid.data)); + + if (vendor && product) { + *guid16++ = SDL_SwapLE16(BUS_USB); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16((Uint16)vendor); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16((Uint16)product); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16((Uint16)version); + *guid16++ = 0; + } else { + *guid16++ = SDL_SwapLE16(BUS_BLUETOOTH); *guid16++ = 0; SDL_strlcpy((char*)guid16, pDevice->product, sizeof(pDevice->guid.data) - 4); } @@ -428,6 +455,12 @@ JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender, IOHIDDevic return; /* not a device we care about, probably. */ } + if (SDL_IsGameControllerNameAndGUID(device->product, device->guid) && + SDL_ShouldIgnoreGameController(device->product, device->guid)) { + SDL_free(device); + return; + } + /* Get notified when this device is disconnected. */ IOHIDDeviceRegisterRemovalCallback(ioHIDDeviceObject, JoystickDeviceWasRemovedCallback, device); IOHIDDeviceScheduleWithRunLoop(ioHIDDeviceObject, CFRunLoopGetCurrent(), SDL_JOYSTICK_RUNLOOP_MODE); @@ -565,7 +598,7 @@ SDL_SYS_JoystickInit(void) /* Function to return the number of joystick devices plugged in right now */ int -SDL_SYS_NumJoysticks() +SDL_SYS_NumJoysticks(void) { recDevice *device = gpDeviceList; int nJoySticks = 0; @@ -583,7 +616,7 @@ SDL_SYS_NumJoysticks() /* Function to cause any queued joystick insertions to be processed */ void -SDL_SYS_JoystickDetect() +SDL_SYS_JoystickDetect(void) { recDevice *device = gpDeviceList; while (device) { @@ -594,8 +627,8 @@ SDL_SYS_JoystickDetect() } } - // run this after the checks above so we don't set device->removed and delete the device before - // SDL_SYS_JoystickUpdate can run to clean up the SDL_Joystick object that owns this device + /* run this after the checks above so we don't set device->removed and delete the device before + SDL_SYS_JoystickUpdate can run to clean up the SDL_Joystick object that owns this device */ while (CFRunLoopRunInMode(SDL_JOYSTICK_RUNLOOP_MODE,0,TRUE) == kCFRunLoopRunHandledSource) { /* no-op. Pending callbacks will fire in CFRunLoopRunInMode(). */ } @@ -675,11 +708,14 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) element = device->firstAxis; i = 0; + + int goodRead = SDL_FALSE; while (element) { - value = GetHIDScaledCalibratedState(device, element, -32768, 32767); - if (value != joystick->axes[i]) { + goodRead = GetHIDScaledCalibratedState(device, element, -32768, 32767, &value); + if (goodRead) { SDL_PrivateJoystickAxis(joystick, i, value); } + element = element->pNext; ++i; } @@ -687,67 +723,70 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) element = device->firstButton; i = 0; while (element) { - value = GetHIDElementState(device, element); - if (value > 1) { /* handle pressure-sensitive buttons */ - value = 1; - } - if (value != joystick->buttons[i]) { + goodRead = GetHIDElementState(device, element, &value); + if (goodRead) { + if (value > 1) { /* handle pressure-sensitive buttons */ + value = 1; + } SDL_PrivateJoystickButton(joystick, i, value); } + element = element->pNext; ++i; } element = device->firstHat; i = 0; + while (element) { Uint8 pos = 0; range = (element->max - element->min + 1); - value = GetHIDElementState(device, element) - element->min; - if (range == 4) { /* 4 position hatswitch - scale up value */ - value *= 2; - } else if (range != 8) { /* Neither a 4 nor 8 positions - fall back to default position (centered) */ - value = -1; - } - switch (value) { - case 0: - pos = SDL_HAT_UP; - break; - case 1: - pos = SDL_HAT_RIGHTUP; - break; - case 2: - pos = SDL_HAT_RIGHT; - break; - case 3: - pos = SDL_HAT_RIGHTDOWN; - break; - case 4: - pos = SDL_HAT_DOWN; - break; - case 5: - pos = SDL_HAT_LEFTDOWN; - break; - case 6: - pos = SDL_HAT_LEFT; - break; - case 7: - pos = SDL_HAT_LEFTUP; - break; - default: - /* Every other value is mapped to center. We do that because some - * joysticks use 8 and some 15 for this value, and apparently - * there are even more variants out there - so we try to be generous. - */ - pos = SDL_HAT_CENTERED; - break; - } + goodRead = GetHIDElementState(device, element, &value); + if (goodRead) { + value -= element->min; + if (range == 4) { /* 4 position hatswitch - scale up value */ + value *= 2; + } else if (range != 8) { /* Neither a 4 nor 8 positions - fall back to default position (centered) */ + value = -1; + } + switch (value) { + case 0: + pos = SDL_HAT_UP; + break; + case 1: + pos = SDL_HAT_RIGHTUP; + break; + case 2: + pos = SDL_HAT_RIGHT; + break; + case 3: + pos = SDL_HAT_RIGHTDOWN; + break; + case 4: + pos = SDL_HAT_DOWN; + break; + case 5: + pos = SDL_HAT_LEFTDOWN; + break; + case 6: + pos = SDL_HAT_LEFT; + break; + case 7: + pos = SDL_HAT_LEFTUP; + break; + default: + /* Every other value is mapped to center. We do that because some + * joysticks use 8 and some 15 for this value, and apparently + * there are even more variants out there - so we try to be generous. + */ + pos = SDL_HAT_CENTERED; + break; + } - if (pos != joystick->hats[i]) { SDL_PrivateJoystickHat(joystick, i, pos); } - + element = element->pNext; ++i; } diff --git a/Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick_c.h b/Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick_c.h index 1c317eca7..cde6a5c21 100644 --- a/Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick_c.h +++ b/Engine/lib/sdl/src/joystick/darwin/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -68,5 +68,6 @@ struct joystick_hwdata }; typedef struct joystick_hwdata recDevice; - #endif /* SDL_JOYSTICK_IOKIT_H */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/joystick/dummy/SDL_sysjoystick.c b/Engine/lib/sdl/src/joystick/dummy/SDL_sysjoystick.c index 10fda10da..3dd96a001 100644 --- a/Engine/lib/sdl/src/joystick/dummy/SDL_sysjoystick.c +++ b/Engine/lib/sdl/src/joystick/dummy/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,12 +37,14 @@ SDL_SYS_JoystickInit(void) return 0; } -int SDL_SYS_NumJoysticks() +int +SDL_SYS_NumJoysticks(void) { return 0; } -void SDL_SYS_JoystickDetect() +void +SDL_SYS_JoystickDetect(void) { } diff --git a/Engine/lib/sdl/src/joystick/emscripten/SDL_sysjoystick.c b/Engine/lib/sdl/src/joystick/emscripten/SDL_sysjoystick.c index 6b203667a..b5bcaad6c 100644 --- a/Engine/lib/sdl/src/joystick/emscripten/SDL_sysjoystick.c +++ b/Engine/lib/sdl/src/joystick/emscripten/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,6 @@ #include "SDL_events.h" #include "SDL_joystick.h" -#include "SDL_hints.h" #include "SDL_assert.h" #include "SDL_timer.h" #include "SDL_log.h" @@ -42,7 +41,7 @@ static SDL_joylist_item *SDL_joylist_tail = NULL; static int numjoysticks = 0; static int instance_counter = 0; -EM_BOOL +static EM_BOOL Emscripten_JoyStickConnected(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData) { int i; @@ -111,7 +110,7 @@ Emscripten_JoyStickConnected(int eventType, const EmscriptenGamepadEvent *gamepa return 1; } -EM_BOOL +static EM_BOOL Emscripten_JoyStickDisconnected(int eventType, const EmscriptenGamepadEvent *gamepadEvent, void *userData) { SDL_joylist_item *item = SDL_joylist; @@ -146,7 +145,7 @@ Emscripten_JoyStickDisconnected(int eventType, const EmscriptenGamepadEvent *gam /* Need to decrement the joystick count before we post the event */ --numjoysticks; - SDL_PrivateJoystickRemoved(item->device_instance); + SDL_PrivateJoystickRemoved(item->device_instance); #ifdef DEBUG_JOYSTICK SDL_Log("Removed joystick with id %d", item->device_instance); @@ -240,12 +239,14 @@ JoystickByIndex(int index) return item; } -int SDL_SYS_NumJoysticks() +int +SDL_SYS_NumJoysticks(void) { return numjoysticks; } -void SDL_SYS_JoystickDetect() +void +SDL_SYS_JoystickDetect(void) { } @@ -329,7 +330,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) for(i = 0; i < item->naxes; i++) { if(item->axis[i] != gamepadState.axis[i]) { - // do we need to do conversion? + /* do we need to do conversion? */ SDL_PrivateJoystickAxis(item->joystick, i, (Sint16) (32767.*gamepadState.axis[i])); } diff --git a/Engine/lib/sdl/src/joystick/emscripten/SDL_sysjoystick_c.h b/Engine/lib/sdl/src/joystick/emscripten/SDL_sysjoystick_c.h index 41f613e11..0c2be1db4 100644 --- a/Engine/lib/sdl/src/joystick/emscripten/SDL_sysjoystick_c.h +++ b/Engine/lib/sdl/src/joystick/emscripten/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/joystick/haiku/SDL_haikujoystick.cc b/Engine/lib/sdl/src/joystick/haiku/SDL_haikujoystick.cc index a680189c7..9ab2c72fd 100644 --- a/Engine/lib/sdl/src/joystick/haiku/SDL_haikujoystick.cc +++ b/Engine/lib/sdl/src/joystick/haiku/SDL_haikujoystick.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,8 +24,8 @@ /* This is the Haiku implementation of the SDL joystick API */ -#include -#include +#include +#include extern "C" { @@ -84,12 +84,12 @@ extern "C" return (SDL_SYS_numjoysticks); } - int SDL_SYS_NumJoysticks() + int SDL_SYS_NumJoysticks(void) { return SDL_SYS_numjoysticks; } - void SDL_SYS_JoystickDetect() + void SDL_SYS_JoystickDetect(void) { } @@ -176,10 +176,9 @@ extern "C" SDL_HAT_LEFT, SDL_HAT_LEFTUP }; - const int JITTER = (32768 / 10); /* 10% jitter threshold (ok?) */ BJoystick *stick; - int i, change; + int i; int16 *axes; uint8 *hats; uint32 buttons; @@ -197,24 +196,17 @@ extern "C" /* Generate axis motion events */ for (i = 0; i < joystick->naxes; ++i) { - change = ((int32) axes[i] - joystick->axes[i]); - if ((change > JITTER) || (change < -JITTER)) { - SDL_PrivateJoystickAxis(joystick, i, axes[i]); - } + SDL_PrivateJoystickAxis(joystick, i, axes[i]); } /* Generate hat change events */ for (i = 0; i < joystick->nhats; ++i) { - if (hats[i] != joystick->hats[i]) { - SDL_PrivateJoystickHat(joystick, i, hat_map[hats[i]]); - } + SDL_PrivateJoystickHat(joystick, i, hat_map[hats[i]]); } /* Generate button events */ for (i = 0; i < joystick->nbuttons; ++i) { - if ((buttons & 0x01) != joystick->buttons[i]) { - SDL_PrivateJoystickButton(joystick, i, (buttons & 0x01)); - } + SDL_PrivateJoystickButton(joystick, i, (buttons & 0x01)); buttons >>= 1; } } @@ -236,12 +228,12 @@ extern "C" { int i; - for (i = 0; SDL_joyport[i]; ++i) { + for (i = 0; i < SDL_SYS_numjoysticks; ++i) { SDL_free(SDL_joyport[i]); } SDL_joyport[0] = NULL; - for (i = 0; SDL_joyname[i]; ++i) { + for (i = 0; i < SDL_SYS_numjoysticks; ++i) { SDL_free(SDL_joyname[i]); } SDL_joyname[0] = NULL; diff --git a/Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick.m b/Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick.m index eb7e00032..d6014980c 100644 --- a/Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick.m +++ b/Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,12 +26,15 @@ /* needed for SDL_IPHONE_MAX_GFORCE macro */ #include "SDL_config_iphoneos.h" +#include "SDL_assert.h" #include "SDL_events.h" #include "SDL_joystick.h" #include "SDL_hints.h" #include "SDL_stdinc.h" #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" +#include "../steam/SDL_steamcontroller.h" + #if !SDL_EVENTS_DISABLED #include "../../events/SDL_events_c.h" @@ -57,6 +60,7 @@ static SDL_JoystickDeviceItem *deviceList = NULL; static int numjoysticks = 0; static SDL_JoystickID instancecounter = 0; +int SDL_AppleTVRemoteOpenedAsJoystick = 0; static SDL_JoystickDeviceItem * GetDeviceForIndex(int device_index) @@ -113,6 +117,7 @@ SDL_SYS_AddMFIJoystickDevice(SDL_JoystickDeviceItem *device, GCController *contr #if TARGET_OS_TV else if (controller.microGamepad) { device->guid.data[10] = 3; + device->remote = SDL_TRUE; } #endif /* TARGET_OS_TV */ @@ -147,6 +152,15 @@ SDL_SYS_AddJoystickDevice(GCController *controller, SDL_bool accelerometer) { SDL_JoystickDeviceItem *device = deviceList; +#if TARGET_OS_TV + if (!SDL_GetHintBoolean(SDL_HINT_TV_REMOTE_AS_JOYSTICK, SDL_TRUE)) { + /* Ignore devices that aren't actually controllers (e.g. remotes), they'll be handled as keyboard input */ + if (controller && !controller.extendedGamepad && !controller.gamepad && controller.microGamepad) { + return; + } + } +#endif + while (device != NULL) { if (device->controller == controller) { return; @@ -154,13 +168,11 @@ SDL_SYS_AddJoystickDevice(GCController *controller, SDL_bool accelerometer) device = device->next; } - device = (SDL_JoystickDeviceItem *) SDL_malloc(sizeof(SDL_JoystickDeviceItem)); + device = (SDL_JoystickDeviceItem *) SDL_calloc(1, sizeof(SDL_JoystickDeviceItem)); if (device == NULL) { return; } - SDL_zerop(device); - device->accelerometer = accelerometer; device->instance_id = instancecounter++; @@ -242,7 +254,7 @@ SDL_SYS_RemoveJoystickDevice(SDL_JoystickDeviceItem *device) --numjoysticks; - SDL_PrivateJoystickRemoved(device->instance_id); + SDL_PrivateJoystickRemoved(device->instance_id); SDL_free(device->name); SDL_free(device); @@ -251,7 +263,7 @@ SDL_SYS_RemoveJoystickDevice(SDL_JoystickDeviceItem *device) } #if TARGET_OS_TV -static void +static void SDLCALL SDL_AppleTVRemoteRotationHintChanged(void *udata, const char *name, const char *oldValue, const char *newValue) { BOOL allowRotation = newValue != NULL && *newValue != '0'; @@ -266,6 +278,50 @@ SDL_AppleTVRemoteRotationHintChanged(void *udata, const char *name, const char * } #endif /* TARGET_OS_TV */ +static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_JoystickGUID guid, int *device_instance) +{ + SDL_JoystickDeviceItem *device = (SDL_JoystickDeviceItem *)SDL_calloc(1, sizeof(SDL_JoystickDeviceItem)); + if (device == NULL) { + return SDL_FALSE; + } + + *device_instance = device->instance_id = instancecounter++; + device->name = SDL_strdup(name); + device->guid = guid; + SDL_GetSteamControllerInputs(&device->nbuttons, + &device->naxes, + &device->nhats); + device->m_bSteamController = SDL_TRUE; + + if (deviceList == NULL) { + deviceList = device; + } else { + SDL_JoystickDeviceItem *lastdevice = deviceList; + while (lastdevice->next != NULL) { + lastdevice = lastdevice->next; + } + lastdevice->next = device; + } + + ++numjoysticks; + + SDL_PrivateJoystickAdded(numjoysticks - 1); + + return SDL_TRUE; +} + +static void SteamControllerDisconnectedCallback(int device_instance) +{ + SDL_JoystickDeviceItem *item; + + for (item = deviceList; item; item = item->next) { + if (item->instance_id == device_instance) { + SDL_SYS_RemoveJoystickDevice(item); + break; + } + } +} + /* Function to scan the system for joysticks. * Joystick 0 should be the system default joystick. * It should return 0, or -1 on an unrecoverable fatal error. @@ -276,6 +332,9 @@ SDL_SYS_JoystickInit(void) @autoreleasepool { NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; + SDL_InitSteamControllers(SteamControllerConnectedCallback, + SteamControllerDisconnectedCallback); + #if !TARGET_OS_TV if (SDL_GetHintBoolean(SDL_HINT_ACCELEROMETER_AS_JOYSTICK, SDL_TRUE)) { /* Default behavior, accelerometer as joystick */ @@ -326,13 +385,16 @@ SDL_SYS_JoystickInit(void) return numjoysticks; } -int SDL_SYS_NumJoysticks() +int +SDL_SYS_NumJoysticks(void) { return numjoysticks; } -void SDL_SYS_JoystickDetect() +void +SDL_SYS_JoystickDetect(void) { + SDL_UpdateSteamControllers(); } /* Function to get the device-dependent name of a joystick */ @@ -395,6 +457,9 @@ SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) #endif /* SDL_JOYSTICK_MFI */ } } + if (device->remote) { + ++SDL_AppleTVRemoteOpenedAsJoystick; + } return 0; } @@ -514,7 +579,7 @@ SDL_SYS_MFIJoystickUpdate(SDL_Joystick * joystick) * initializes its values to 0. We only want to make sure the * player index is up to date if the user actually moves an axis. */ if ((i != 2 && i != 5) || axes[i] != -32768) { - updateplayerindex |= (joystick->axes[i] != axes[i]); + updateplayerindex |= (joystick->axes[i].value != axes[i]); } SDL_PrivateJoystickAxis(joystick, i, axes[i]); } @@ -551,13 +616,10 @@ SDL_SYS_MFIJoystickUpdate(SDL_Joystick * joystick) }; for (i = 0; i < SDL_arraysize(axes); i++) { - updateplayerindex |= (joystick->axes[i] != axes[i]); + updateplayerindex |= (joystick->axes[i].value != axes[i]); SDL_PrivateJoystickAxis(joystick, i, axes[i]); } - /* Apparently the dpad values are not accurate enough to be useful. */ - /* hatstate = SDL_SYS_MFIJoystickHatStateForDPad(gamepad.dpad); */ - Uint8 buttons[] = { gamepad.buttonA.isPressed, gamepad.buttonX.isPressed, @@ -567,8 +629,6 @@ SDL_SYS_MFIJoystickUpdate(SDL_Joystick * joystick) updateplayerindex |= (joystick->buttons[i] != buttons[i]); SDL_PrivateJoystickButton(joystick, i, buttons[i]); } - - /* TODO: Figure out what to do with reportsAbsoluteDpadValues */ } #endif /* TARGET_OS_TV */ @@ -626,6 +686,11 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) if (device == NULL) { return; } + + if (device->m_bSteamController) { + SDL_UpdateSteamController(joystick); + return; + } if (device->accelerometer) { SDL_SYS_AccelerometerUpdate(joystick); @@ -659,6 +724,9 @@ SDL_SYS_JoystickClose(SDL_Joystick * joystick) #endif } } + if (device->remote) { + --SDL_AppleTVRemoteOpenedAsJoystick; + } } /* Function to perform any system-specific joystick related cleanup */ @@ -694,6 +762,8 @@ SDL_SYS_JoystickQuit(void) #endif /* !TARGET_OS_TV */ } + SDL_QuitSteamControllers(); + numjoysticks = 0; } diff --git a/Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick_c.h b/Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick_c.h index be0ddf068..7be5b04a5 100644 --- a/Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick_c.h +++ b/Engine/lib/sdl/src/joystick/iphoneos/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,6 +31,7 @@ typedef struct joystick_hwdata { SDL_bool accelerometer; + SDL_bool remote; GCController __unsafe_unretained *controller; int num_pause_presses; @@ -44,6 +45,9 @@ typedef struct joystick_hwdata int nbuttons; int nhats; + /* Steam Controller support */ + SDL_bool m_bSteamController; + struct joystick_hwdata *next; } joystick_hwdata; diff --git a/Engine/lib/sdl/src/joystick/linux/SDL_sysjoystick.c b/Engine/lib/sdl/src/joystick/linux/SDL_sysjoystick.c index bd52b1808..457c4b85b 100644 --- a/Engine/lib/sdl/src/joystick/linux/SDL_sysjoystick.c +++ b/Engine/lib/sdl/src/joystick/linux/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,8 +38,10 @@ #include "SDL_assert.h" #include "SDL_joystick.h" #include "SDL_endian.h" +#include "../../events/SDL_events_c.h" #include "../SDL_sysjoystick.h" #include "../SDL_joystick_c.h" +#include "../steam/SDL_steamcontroller.h" #include "SDL_sysjoystick_c.h" /* This isn't defined in older Linux kernel headers */ @@ -52,7 +54,7 @@ static int MaybeAddDevice(const char *path); #if SDL_USE_LIBUDEV static int MaybeRemoveDevice(const char *path); -void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); +static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath); #endif /* SDL_USE_LIBUDEV */ @@ -66,6 +68,9 @@ typedef struct SDL_joylist_item dev_t devnum; struct joystick_hwdata *hwdata; struct SDL_joylist_item *next; + + /* Steam Controller support */ + SDL_bool m_bSteamController; } SDL_joylist_item; static SDL_joylist_item *SDL_joylist = NULL; @@ -73,6 +78,7 @@ static SDL_joylist_item *SDL_joylist_tail = NULL; static int numjoysticks = 0; static int instance_counter = 0; + #define test_bit(nr, addr) \ (((1UL << ((nr) % (sizeof(long) * 8))) & ((addr)[(nr) / (sizeof(long) * 8)])) != 0) #define NBITS(x) ((((x)-1)/(sizeof(long) * 8))+1) @@ -80,8 +86,102 @@ static int instance_counter = 0; static int IsJoystick(int fd, char *namebuf, const size_t namebuflen, SDL_JoystickGUID *guid) { + /* This list is taken from: + https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/generate_rules.py + */ + static Uint32 joystick_blacklist[] = { + /* Microsoft Microsoft Wireless Optical Desktop® 2.10 */ + /* Microsoft Wireless Desktop - Comfort Edition */ + MAKE_VIDPID(0x045e, 0x009d), + + /* Microsoft Microsoft® Digital Media Pro Keyboard */ + /* Microsoft Corp. Digital Media Pro Keyboard */ + MAKE_VIDPID(0x045e, 0x00b0), + + /* Microsoft Microsoft® Digital Media Keyboard */ + /* Microsoft Corp. Digital Media Keyboard 1.0A */ + MAKE_VIDPID(0x045e, 0x00b4), + + /* Microsoft Microsoft® Digital Media Keyboard 3000 */ + MAKE_VIDPID(0x045e, 0x0730), + + /* Microsoft Microsoft® 2.4GHz Transceiver v6.0 */ + /* Microsoft Microsoft® 2.4GHz Transceiver v8.0 */ + /* Microsoft Corp. Nano Transceiver v1.0 for Bluetooth */ + /* Microsoft Wireless Mobile Mouse 1000 */ + /* Microsoft Wireless Desktop 3000 */ + MAKE_VIDPID(0x045e, 0x0745), + + /* Microsoft® SideWinder(TM) 2.4GHz Transceiver */ + MAKE_VIDPID(0x045e, 0x0748), + + /* Microsoft Corp. Wired Keyboard 600 */ + MAKE_VIDPID(0x045e, 0x0750), + + /* Microsoft Corp. Sidewinder X4 keyboard */ + MAKE_VIDPID(0x045e, 0x0768), + + /* Microsoft Corp. Arc Touch Mouse Transceiver */ + MAKE_VIDPID(0x045e, 0x0773), + + /* Microsoft® 2.4GHz Transceiver v9.0 */ + /* Microsoft® Nano Transceiver v2.1 */ + /* Microsoft Sculpt Ergonomic Keyboard (5KV-00001) */ + MAKE_VIDPID(0x045e, 0x07a5), + + /* Microsoft® Nano Transceiver v1.0 */ + /* Microsoft Wireless Keyboard 800 */ + MAKE_VIDPID(0x045e, 0x07b2), + + /* Microsoft® Nano Transceiver v2.0 */ + MAKE_VIDPID(0x045e, 0x0800), + + /* List of Wacom devices at: http://linuxwacom.sourceforge.net/wiki/index.php/Device_IDs */ + MAKE_VIDPID(0x056a, 0x0010), /* Wacom ET-0405 Graphire */ + MAKE_VIDPID(0x056a, 0x0011), /* Wacom ET-0405A Graphire2 (4x5) */ + MAKE_VIDPID(0x056a, 0x0012), /* Wacom ET-0507A Graphire2 (5x7) */ + MAKE_VIDPID(0x056a, 0x0013), /* Wacom CTE-430 Graphire3 (4x5) */ + MAKE_VIDPID(0x056a, 0x0014), /* Wacom CTE-630 Graphire3 (6x8) */ + MAKE_VIDPID(0x056a, 0x0015), /* Wacom CTE-440 Graphire4 (4x5) */ + MAKE_VIDPID(0x056a, 0x0016), /* Wacom CTE-640 Graphire4 (6x8) */ + MAKE_VIDPID(0x056a, 0x0017), /* Wacom CTE-450 Bamboo Fun (4x5) */ + MAKE_VIDPID(0x056a, 0x0016), /* Wacom CTE-640 Graphire 4 6x8 */ + MAKE_VIDPID(0x056a, 0x0017), /* Wacom CTE-450 Bamboo Fun 4x5 */ + MAKE_VIDPID(0x056a, 0x0018), /* Wacom CTE-650 Bamboo Fun 6x8 */ + MAKE_VIDPID(0x056a, 0x0019), /* Wacom CTE-631 Bamboo One */ + MAKE_VIDPID(0x056a, 0x00d1), /* Wacom Bamboo Pen and Touch CTH-460 */ + + MAKE_VIDPID(0x09da, 0x054f), /* A4 Tech Co., G7 750 mouse */ + MAKE_VIDPID(0x09da, 0x3043), /* A4 Tech Co., Ltd Bloody R8A Gaming Mouse */ + MAKE_VIDPID(0x09da, 0x31b5), /* A4 Tech Co., Ltd Bloody TL80 Terminator Laser Gaming Mouse */ + MAKE_VIDPID(0x09da, 0x3997), /* A4 Tech Co., Ltd Bloody RT7 Terminator Wireless */ + MAKE_VIDPID(0x09da, 0x3f8b), /* A4 Tech Co., Ltd Bloody V8 mouse */ + MAKE_VIDPID(0x09da, 0x51f4), /* Modecom MC-5006 Keyboard */ + MAKE_VIDPID(0x09da, 0x5589), /* A4 Tech Co., Ltd Terminator TL9 Laser Gaming Mouse */ + MAKE_VIDPID(0x09da, 0x7b22), /* A4 Tech Co., Ltd Bloody V5 */ + MAKE_VIDPID(0x09da, 0x7f2d), /* A4 Tech Co., Ltd Bloody R3 mouse */ + MAKE_VIDPID(0x09da, 0x8090), /* A4 Tech Co., Ltd X-718BK Oscar Optical Gaming Mouse */ + MAKE_VIDPID(0x09da, 0x9066), /* A4 Tech Co., Sharkoon Fireglider Optical */ + MAKE_VIDPID(0x09da, 0x9090), /* A4 Tech Co., Ltd XL-730K / XL-750BK / XL-755BK Laser Mouse */ + MAKE_VIDPID(0x09da, 0x90c0), /* A4 Tech Co., Ltd X7 G800V keyboard */ + MAKE_VIDPID(0x09da, 0xf012), /* A4 Tech Co., Ltd Bloody V7 mouse */ + MAKE_VIDPID(0x09da, 0xf32a), /* A4 Tech Co., Ltd Bloody B540 keyboard */ + MAKE_VIDPID(0x09da, 0xf613), /* A4 Tech Co., Ltd Bloody V2 mouse */ + MAKE_VIDPID(0x09da, 0xf624), /* A4 Tech Co., Ltd Bloody B120 Keyboard */ + + MAKE_VIDPID(0x1d57, 0xad03), /* [T3] 2.4GHz and IR Air Mouse Remote Control */ + + MAKE_VIDPID(0x1e7d, 0x2e4a), /* Roccat Tyon Mouse */ + + MAKE_VIDPID(0x20a0, 0x422d), /* Winkeyless.kr Keyboards */ + + MAKE_VIDPID(0x2516, 0x001f), /* Cooler Master Storm Mizar Mouse */ + MAKE_VIDPID(0x2516, 0x0028), /* Cooler Master Storm Alcor Mouse */ + }; struct input_id inpid; - Uint16 *guid16 = (Uint16 *) ((char *) &guid->data); + int i; + Uint32 id; + Uint16 *guid16 = (Uint16 *)guid->data; #if !SDL_USE_LIBUDEV /* When udev is enabled we only get joystick devices here, so there's no need to test them */ @@ -109,33 +209,45 @@ IsJoystick(int fd, char *namebuf, const size_t namebuflen, SDL_JoystickGUID *gui return 0; } + /* Check the joystick blacklist */ + id = MAKE_VIDPID(inpid.vendor, inpid.product); + for (i = 0; i < SDL_arraysize(joystick_blacklist); ++i) { + if (id == joystick_blacklist[i]) { + return 0; + } + } + #ifdef DEBUG_JOYSTICK - printf("Joystick: %s, bustype = %d, vendor = 0x%x, product = 0x%x, version = %d\n", namebuf, inpid.bustype, inpid.vendor, inpid.product, inpid.version); + printf("Joystick: %s, bustype = %d, vendor = 0x%.4x, product = 0x%.4x, version = %d\n", namebuf, inpid.bustype, inpid.vendor, inpid.product, inpid.version); #endif SDL_memset(guid->data, 0, sizeof(guid->data)); /* We only need 16 bits for each of these; space them out to fill 128. */ /* Byteswap so devices get same GUID on little/big endian platforms. */ - *(guid16++) = SDL_SwapLE16(inpid.bustype); - *(guid16++) = 0; + *guid16++ = SDL_SwapLE16(inpid.bustype); + *guid16++ = 0; - if (inpid.vendor && inpid.product && inpid.version) { - *(guid16++) = SDL_SwapLE16(inpid.vendor); - *(guid16++) = 0; - *(guid16++) = SDL_SwapLE16(inpid.product); - *(guid16++) = 0; - *(guid16++) = SDL_SwapLE16(inpid.version); - *(guid16++) = 0; + if (inpid.vendor && inpid.product) { + *guid16++ = SDL_SwapLE16(inpid.vendor); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(inpid.product); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(inpid.version); + *guid16++ = 0; } else { SDL_strlcpy((char*)guid16, namebuf, sizeof(guid->data) - 4); } + if (SDL_IsGameControllerNameAndGUID(namebuf, *guid) && + SDL_ShouldIgnoreGameController(namebuf, *guid)) { + return 0; + } return 1; } #if SDL_USE_LIBUDEV -void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) +static void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath) { if (devpath == NULL) { return; @@ -282,6 +394,7 @@ MaybeRemoveDevice(const char *path) } #endif +#if ! SDL_USE_LIBUDEV static int JoystickInitWithoutUdev(void) { @@ -298,7 +411,7 @@ JoystickInitWithoutUdev(void) return numjoysticks; } - +#endif #if SDL_USE_LIBUDEV static int @@ -321,6 +434,77 @@ JoystickInitWithUdev(void) } #endif +static SDL_bool SteamControllerConnectedCallback(const char *name, SDL_JoystickGUID guid, int *device_instance) +{ + SDL_joylist_item *item; + + item = (SDL_joylist_item *) SDL_calloc(1, sizeof (SDL_joylist_item)); + if (item == NULL) { + return SDL_FALSE; + } + + item->path = SDL_strdup(""); + item->name = SDL_strdup(name); + item->guid = guid; + item->m_bSteamController = SDL_TRUE; + + if ((item->path == NULL) || (item->name == NULL)) { + SDL_free(item->path); + SDL_free(item->name); + SDL_free(item); + return SDL_FALSE; + } + + *device_instance = item->device_instance = instance_counter++; + if (SDL_joylist_tail == NULL) { + SDL_joylist = SDL_joylist_tail = item; + } else { + SDL_joylist_tail->next = item; + SDL_joylist_tail = item; + } + + /* Need to increment the joystick count before we post the event */ + ++numjoysticks; + + SDL_PrivateJoystickAdded(numjoysticks - 1); + + return SDL_TRUE; +} + +static void SteamControllerDisconnectedCallback(int device_instance) +{ + SDL_joylist_item *item; + SDL_joylist_item *prev = NULL; + + for (item = SDL_joylist; item != NULL; item = item->next) { + /* found it, remove it. */ + if (item->device_instance == device_instance) { + if (item->hwdata) { + item->hwdata->item = NULL; + } + if (prev != NULL) { + prev->next = item->next; + } else { + SDL_assert(SDL_joylist == item); + SDL_joylist = item->next; + } + if (item == SDL_joylist_tail) { + SDL_joylist_tail = prev; + } + + /* Need to decrement the joystick count before we post the event */ + --numjoysticks; + + SDL_PrivateJoystickRemoved(item->device_instance); + + SDL_free(item->name); + SDL_free(item); + return; + } + prev = item; + } +} + int SDL_SYS_JoystickInit(void) { @@ -340,24 +524,30 @@ SDL_SYS_JoystickInit(void) SDL_free(envcopy); } + SDL_InitSteamControllers(SteamControllerConnectedCallback, + SteamControllerDisconnectedCallback); + #if SDL_USE_LIBUDEV return JoystickInitWithUdev(); -#endif - +#else return JoystickInitWithoutUdev(); +#endif } -int SDL_SYS_NumJoysticks() +int +SDL_SYS_NumJoysticks(void) { return numjoysticks; } -void SDL_SYS_JoystickDetect() +void +SDL_SYS_JoystickDetect(void) { #if SDL_USE_LIBUDEV SDL_UDEV_Poll(); #endif - + + SDL_UpdateSteamControllers(); } static SDL_joylist_item * @@ -446,16 +636,16 @@ ConfigJoystick(SDL_Joystick * joystick, int fd) #ifdef DEBUG_INPUT_EVENTS printf("Joystick has button: 0x%x\n", i); #endif - joystick->hwdata->key_map[i - BTN_MISC] = joystick->nbuttons; + joystick->hwdata->key_map[i] = joystick->nbuttons; ++joystick->nbuttons; } } - for (i = BTN_MISC; i < BTN_JOYSTICK; ++i) { + for (i = 0; i < BTN_JOYSTICK; ++i) { if (test_bit(i, keybit)) { #ifdef DEBUG_INPUT_EVENTS printf("Joystick has button: 0x%x\n", i); #endif - joystick->hwdata->key_map[i - BTN_MISC] = joystick->nbuttons; + joystick->hwdata->key_map[i] = joystick->nbuttons; ++joystick->nbuttons; } } @@ -541,47 +731,53 @@ int SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) { SDL_joylist_item *item = JoystickByDevIndex(device_index); - char *fname = NULL; - int fd = -1; if (item == NULL) { return SDL_SetError("No such device"); } - fname = item->path; - fd = open(fname, O_RDONLY, 0); - if (fd < 0) { - return SDL_SetError("Unable to open %s", fname); - } - joystick->instance_id = item->device_instance; joystick->hwdata = (struct joystick_hwdata *) - SDL_malloc(sizeof(*joystick->hwdata)); + SDL_calloc(1, sizeof(*joystick->hwdata)); if (joystick->hwdata == NULL) { - close(fd); return SDL_OutOfMemory(); } - SDL_memset(joystick->hwdata, 0, sizeof(*joystick->hwdata)); joystick->hwdata->item = item; joystick->hwdata->guid = item->guid; - joystick->hwdata->fd = fd; - joystick->hwdata->fname = SDL_strdup(item->path); - if (joystick->hwdata->fname == NULL) { - SDL_free(joystick->hwdata); - joystick->hwdata = NULL; - close(fd); - return SDL_OutOfMemory(); + joystick->hwdata->m_bSteamController = item->m_bSteamController; + + if (item->m_bSteamController) { + joystick->hwdata->fd = -1; + SDL_GetSteamControllerInputs(&joystick->nbuttons, + &joystick->naxes, + &joystick->nhats); + } else { + int fd = open(item->path, O_RDONLY, 0); + if (fd < 0) { + SDL_free(joystick->hwdata); + joystick->hwdata = NULL; + return SDL_SetError("Unable to open %s", item->path); + } + + joystick->hwdata->fd = fd; + joystick->hwdata->fname = SDL_strdup(item->path); + if (joystick->hwdata->fname == NULL) { + SDL_free(joystick->hwdata); + joystick->hwdata = NULL; + close(fd); + return SDL_OutOfMemory(); + } + + /* Set the joystick to non-blocking read mode */ + fcntl(fd, F_SETFL, O_NONBLOCK); + + /* Get the number of buttons and axes on the joystick */ + ConfigJoystick(joystick, fd); } SDL_assert(item->hwdata == NULL); item->hwdata = joystick->hwdata; - /* Set the joystick to non-blocking read mode */ - fcntl(fd, F_SETFL, O_NONBLOCK); - - /* Get the number of buttons and axes on the joystick */ - ConfigJoystick(joystick, fd); - /* mark joystick as fresh and ready */ joystick->hwdata->fresh = 1; @@ -712,12 +908,9 @@ HandleInputEvents(SDL_Joystick * joystick) code = events[i].code; switch (events[i].type) { case EV_KEY: - if (code >= BTN_MISC) { - code -= BTN_MISC; - SDL_PrivateJoystickButton(joystick, - joystick->hwdata->key_map[code], - events[i].value); - } + SDL_PrivateJoystickButton(joystick, + joystick->hwdata->key_map[code], + events[i].value); break; case EV_ABS: switch (code) { @@ -775,6 +968,11 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) { int i; + if (joystick->hwdata->m_bSteamController) { + SDL_UpdateSteamController(joystick); + return; + } + HandleInputEvents(joystick); /* Deliver ball motion updates */ @@ -796,7 +994,9 @@ void SDL_SYS_JoystickClose(SDL_Joystick * joystick) { if (joystick->hwdata) { - close(joystick->hwdata->fd); + if (joystick->hwdata->fd >= 0) { + close(joystick->hwdata->fd); + } if (joystick->hwdata->item) { joystick->hwdata->item->hwdata = NULL; } @@ -830,6 +1030,8 @@ SDL_SYS_JoystickQuit(void) SDL_UDEV_DelCallback(joystick_udev_callback); SDL_UDEV_Quit(); #endif + + SDL_QuitSteamControllers(); } SDL_JoystickGUID SDL_SYS_JoystickGetDeviceGUID( int device_index ) diff --git a/Engine/lib/sdl/src/joystick/linux/SDL_sysjoystick_c.h b/Engine/lib/sdl/src/joystick/linux/SDL_sysjoystick_c.h index ee7717839..d06b387ee 100644 --- a/Engine/lib/sdl/src/joystick/linux/SDL_sysjoystick_c.h +++ b/Engine/lib/sdl/src/joystick/linux/SDL_sysjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -43,7 +43,7 @@ struct joystick_hwdata } *balls; /* Support for the Linux 2.4 unified input interface */ - Uint8 key_map[KEY_MAX - BTN_MISC]; + Uint8 key_map[KEY_MAX]; Uint8 abs_map[ABS_MAX]; struct axis_correct { @@ -52,6 +52,9 @@ struct joystick_hwdata } abs_correct[ABS_MAX]; int fresh; + + /* Steam Controller support */ + SDL_bool m_bSteamController; }; /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/joystick/psp/SDL_sysjoystick.c b/Engine/lib/sdl/src/joystick/psp/SDL_sysjoystick.c index 352960edf..228cbb209 100644 --- a/Engine/lib/sdl/src/joystick/psp/SDL_sysjoystick.c +++ b/Engine/lib/sdl/src/joystick/psp/SDL_sysjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -132,12 +132,12 @@ int SDL_SYS_JoystickInit(void) return 1; } -int SDL_SYS_NumJoysticks() +int SDL_SYS_NumJoysticks(void) { return 1; } -void SDL_SYS_JoystickDetect() +void SDL_SYS_JoystickDetect(void) { } diff --git a/Engine/lib/sdl/src/joystick/sort_controllers.py b/Engine/lib/sdl/src/joystick/sort_controllers.py index af95d6513..47213c220 100755 --- a/Engine/lib/sdl/src/joystick/sort_controllers.py +++ b/Engine/lib/sdl/src/joystick/sort_controllers.py @@ -29,6 +29,7 @@ def write_controllers(): global controller_guids for entry in sorted(controllers, key=lambda entry: entry[2]): line = "".join(entry) + "\n" + line = line.replace("\t", " ") if not line.endswith(",\n") and not line.endswith("*/\n"): print("Warning: '%s' is missing a comma at the end of the line" % (line)) if (entry[1] in controller_guids): diff --git a/Engine/lib/sdl/src/joystick/steam/SDL_steamcontroller.c b/Engine/lib/sdl/src/joystick/steam/SDL_steamcontroller.c new file mode 100644 index 000000000..1edaa94ab --- /dev/null +++ b/Engine/lib/sdl/src/joystick/steam/SDL_steamcontroller.c @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#include "../SDL_sysjoystick.h" +#include "../SDL_joystick_c.h" +#include "SDL_steamcontroller.h" + + +void SDL_InitSteamControllers(SteamControllerConnectedCallback_t connectedCallback, + SteamControllerDisconnectedCallback_t disconnectedCallback) +{ +} + +void SDL_GetSteamControllerInputs(int *nbuttons, int *naxes, int *nhats) +{ + *nbuttons = 0; + *naxes = 0; + *nhats = 0; +} + +void SDL_UpdateSteamControllers(void) +{ +} + +void SDL_UpdateSteamController(SDL_Joystick *joystick) +{ +} + +void SDL_QuitSteamControllers(void) +{ +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/joystick/steam/SDL_steamcontroller.h b/Engine/lib/sdl/src/joystick/steam/SDL_steamcontroller.h new file mode 100644 index 000000000..ce37b4de5 --- /dev/null +++ b/Engine/lib/sdl/src/joystick/steam/SDL_steamcontroller.h @@ -0,0 +1,33 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +typedef SDL_bool (*SteamControllerConnectedCallback_t)(const char *name, SDL_JoystickGUID guid, int *device_instance); +typedef void (*SteamControllerDisconnectedCallback_t)(int device_instance); + +void SDL_InitSteamControllers(SteamControllerConnectedCallback_t connectedCallback, + SteamControllerDisconnectedCallback_t disconnectedCallback); +void SDL_GetSteamControllerInputs(int *nbuttons, int *naxes, int *nhats); +void SDL_UpdateSteamControllers(void); +void SDL_UpdateSteamController(SDL_Joystick *joystick); +void SDL_QuitSteamControllers(void); + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/joystick/windows/SDL_dinputjoystick.c b/Engine/lib/sdl/src/joystick/windows/SDL_dinputjoystick.c index 7166075b1..cff868b28 100644 --- a/Engine/lib/sdl/src/joystick/windows/SDL_dinputjoystick.c +++ b/Engine/lib/sdl/src/joystick/windows/SDL_dinputjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,9 +33,7 @@ #endif #define INPUT_QSIZE 32 /* Buffer up to 32 input messages */ -#define AXIS_MIN -32768 /* minimum value for axis coordinate */ -#define AXIS_MAX 32767 /* maximum value for axis coordinate */ -#define JOY_AXIS_THRESHOLD (((AXIS_MAX)-(AXIS_MIN))/100) /* 1% motion */ +#define JOY_AXIS_THRESHOLD (((SDL_JOYSTICK_AXIS_MAX)-(SDL_JOYSTICK_AXIS_MIN))/100) /* 1% motion */ /* external variables referenced. */ extern HWND SDL_HelperWindow; @@ -350,21 +348,70 @@ SDL_DINPUT_JoystickInit(void) static BOOL CALLBACK EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext) { + const Uint16 BUS_USB = 0x03; + const Uint16 BUS_BLUETOOTH = 0x05; JoyStick_DeviceData *pNewJoystick; JoyStick_DeviceData *pPrevJoystick = NULL; const DWORD devtype = (pdidInstance->dwDevType & 0xFF); + Uint16 *guid16; + WCHAR hidPath[MAX_PATH]; if (devtype == DI8DEVTYPE_SUPPLEMENTAL) { - return DIENUM_CONTINUE; /* Ignore touchpads, etc. */ + /* Add any supplemental devices that should be ignored here */ +#define MAKE_TABLE_ENTRY(VID, PID) ((((DWORD)PID)<<16)|VID) + static DWORD ignored_devices[] = { + MAKE_TABLE_ENTRY(0, 0) + }; +#undef MAKE_TABLE_ENTRY + unsigned int i; + + for (i = 0; i < SDL_arraysize(ignored_devices); ++i) { + if (pdidInstance->guidProduct.Data1 == ignored_devices[i]) { + return DIENUM_CONTINUE; + } + } } if (SDL_IsXInputDevice(&pdidInstance->guidProduct)) { return DIENUM_CONTINUE; /* ignore XInput devices here, keep going. */ } + { + HRESULT result; + LPDIRECTINPUTDEVICE8 device; + LPDIRECTINPUTDEVICE8 InputDevice; + DIPROPGUIDANDPATH dipdw2; + + result = IDirectInput8_CreateDevice(dinput, &(pdidInstance->guidInstance), &device, NULL); + if (FAILED(result)) { + return DIENUM_CONTINUE; /* better luck next time? */ + } + + /* Now get the IDirectInputDevice8 interface, instead. */ + result = IDirectInputDevice8_QueryInterface(device, &IID_IDirectInputDevice8, (LPVOID *)&InputDevice); + /* We are done with this object. Use the stored one from now on. */ + IDirectInputDevice8_Release(device); + if (FAILED(result)) { + return DIENUM_CONTINUE; /* better luck next time? */ + } + dipdw2.diph.dwSize = sizeof(dipdw2); + dipdw2.diph.dwHeaderSize = sizeof(dipdw2.diph); + dipdw2.diph.dwObj = 0; // device property + dipdw2.diph.dwHow = DIPH_DEVICE; + + result = IDirectInputDevice8_GetProperty(InputDevice, DIPROP_GUIDANDPATH, &dipdw2.diph); + IDirectInputDevice8_Release(InputDevice); + if (FAILED(result)) { + return DIENUM_CONTINUE; /* better luck next time? */ + } + + /* Get device path, compare that instead of GUID, additionally update GUIDs of joysticks with matching paths, in case they're not open yet. */ + SDL_wcslcpy(hidPath, dipdw2.wszPath, SDL_arraysize(hidPath)); + } + pNewJoystick = *(JoyStick_DeviceData **)pContext; while (pNewJoystick) { - if (!SDL_memcmp(&pNewJoystick->dxdevice.guidInstance, &pdidInstance->guidInstance, sizeof(pNewJoystick->dxdevice.guidInstance))) { + if (SDL_wcscmp(pNewJoystick->hidPath, hidPath) == 0) { /* if we are replacing the front of the list then update it */ if (pNewJoystick == *(JoyStick_DeviceData **)pContext) { *(JoyStick_DeviceData **)pContext = pNewJoystick->pNext; @@ -372,6 +419,9 @@ EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext) pPrevJoystick->pNext = pNewJoystick->pNext; } + // Update with new guid/etc, if it has changed + pNewJoystick->dxdevice = *pdidInstance; + pNewJoystick->pNext = SYS_Joystick; SYS_Joystick = pNewJoystick; @@ -388,6 +438,7 @@ EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext) } SDL_zerop(pNewJoystick); + SDL_wcslcpy(pNewJoystick->hidPath, hidPath, SDL_arraysize(pNewJoystick->hidPath)); pNewJoystick->joystickname = WIN_StringToUTF8(pdidInstance->tszProductName); if (!pNewJoystick->joystickname) { SDL_free(pNewJoystick); @@ -397,7 +448,30 @@ EnumJoysticksCallback(const DIDEVICEINSTANCE * pdidInstance, VOID * pContext) SDL_memcpy(&(pNewJoystick->dxdevice), pdidInstance, sizeof(DIDEVICEINSTANCE)); - SDL_memcpy(&pNewJoystick->guid, &pdidInstance->guidProduct, sizeof(pNewJoystick->guid)); + SDL_memset(pNewJoystick->guid.data, 0, sizeof(pNewJoystick->guid.data)); + + guid16 = (Uint16 *)pNewJoystick->guid.data; + if (SDL_memcmp(&pdidInstance->guidProduct.Data4[2], "PIDVID", 6) == 0) { + *guid16++ = SDL_SwapLE16(BUS_USB); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16((Uint16)LOWORD(pdidInstance->guidProduct.Data1)); /* vendor */ + *guid16++ = 0; + *guid16++ = SDL_SwapLE16((Uint16)HIWORD(pdidInstance->guidProduct.Data1)); /* product */ + *guid16++ = 0; + *guid16++ = 0; /* version */ + *guid16++ = 0; + } else { + *guid16++ = SDL_SwapLE16(BUS_BLUETOOTH); + *guid16++ = 0; + SDL_strlcpy((char*)guid16, pNewJoystick->joystickname, sizeof(pNewJoystick->guid.data) - 4); + } + + if (SDL_IsGameControllerNameAndGUID(pNewJoystick->joystickname, pNewJoystick->guid) && + SDL_ShouldIgnoreGameController(pNewJoystick->joystickname, pNewJoystick->guid)) { + SDL_free(pNewJoystick); + return DIENUM_CONTINUE; + } + SDL_SYS_AddJoystickDevice(pNewJoystick); return DIENUM_CONTINUE; /* get next device, please */ @@ -461,8 +535,8 @@ EnumDevObjectsCallback(LPCDIDEVICEOBJECTINSTANCE dev, LPVOID pvRef) diprg.diph.dwHeaderSize = sizeof(diprg.diph); diprg.diph.dwObj = dev->dwType; diprg.diph.dwHow = DIPH_BYID; - diprg.lMin = AXIS_MIN; - diprg.lMax = AXIS_MAX; + diprg.lMin = SDL_JOYSTICK_AXIS_MIN; + diprg.lMax = SDL_JOYSTICK_AXIS_MAX; result = IDirectInputDevice8_SetProperty(joystick->hwdata->InputDevice, diff --git a/Engine/lib/sdl/src/joystick/windows/SDL_dinputjoystick_c.h b/Engine/lib/sdl/src/joystick/windows/SDL_dinputjoystick_c.h index 7e4ff3e19..5cc18903b 100644 --- a/Engine/lib/sdl/src/joystick/windows/SDL_dinputjoystick_c.h +++ b/Engine/lib/sdl/src/joystick/windows/SDL_dinputjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/joystick/windows/SDL_mmjoystick.c b/Engine/lib/sdl/src/joystick/windows/SDL_mmjoystick.c index 374618181..9fa86656f 100644 --- a/Engine/lib/sdl/src/joystick/windows/SDL_mmjoystick.c +++ b/Engine/lib/sdl/src/joystick/windows/SDL_mmjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -41,10 +41,6 @@ #define MAX_JOYSTICKS 16 #define MAX_AXES 6 /* each joystick can have up to 6 axes */ #define MAX_BUTTONS 32 /* and 32 buttons */ -#define AXIS_MIN -32768 /* minimum value for axis coordinate */ -#define AXIS_MAX 32767 /* maximum value for axis coordinate */ -/* limit axis to 256 possible positions to filter out noise */ -#define JOY_AXIS_THRESHOLD (((AXIS_MAX)-(AXIS_MIN))/256) #define JOY_BUTTON_FLAG(n) (1<hwdata->id = SYS_JoystickID[index]; for (i = 0; i < MAX_AXES; ++i) { if ((i < 2) || (SYS_Joystick[index].wCaps & caps_flags[i - 2])) { - joystick->hwdata->transaxis[i].offset = AXIS_MIN - axis_min[i]; + joystick->hwdata->transaxis[i].offset = SDL_JOYSTICK_AXIS_MIN - axis_min[i]; joystick->hwdata->transaxis[i].scale = - (float) (AXIS_MAX - AXIS_MIN) / (axis_max[i] - axis_min[i]); + (float) (SDL_JOYSTICK_AXIS_MAX - SDL_JOYSTICK_AXIS_MIN) / (axis_max[i] - axis_min[i]); } else { joystick->hwdata->transaxis[i].offset = 0; joystick->hwdata->transaxis[i].scale = 1.0; /* Just in case */ @@ -315,7 +323,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) }; DWORD pos[MAX_AXES]; struct _transaxis *transaxis; - int value, change; + int value; JOYINFOEX joyinfo; joyinfo.dwSize = sizeof(joyinfo); @@ -340,14 +348,8 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) transaxis = joystick->hwdata->transaxis; for (i = 0; i < joystick->naxes; i++) { if (joyinfo.dwFlags & flags[i]) { - value = - (int) (((float) pos[i] + - transaxis[i].offset) * transaxis[i].scale); - change = (value - joystick->axes[i]); - if ((change < -JOY_AXIS_THRESHOLD) - || (change > JOY_AXIS_THRESHOLD)) { - SDL_PrivateJoystickAxis(joystick, (Uint8) i, (Sint16) value); - } + value = (int) (((float) pos[i] + transaxis[i].offset) * transaxis[i].scale); + SDL_PrivateJoystickAxis(joystick, (Uint8) i, (Sint16) value); } } @@ -355,15 +357,9 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) if (joyinfo.dwFlags & JOY_RETURNBUTTONS) { for (i = 0; i < joystick->nbuttons; ++i) { if (joyinfo.dwButtons & JOY_BUTTON_FLAG(i)) { - if (!joystick->buttons[i]) { - SDL_PrivateJoystickButton(joystick, (Uint8) i, - SDL_PRESSED); - } + SDL_PrivateJoystickButton(joystick, (Uint8) i, SDL_PRESSED); } else { - if (joystick->buttons[i]) { - SDL_PrivateJoystickButton(joystick, (Uint8) i, - SDL_RELEASED); - } + SDL_PrivateJoystickButton(joystick, (Uint8) i, SDL_RELEASED); } } } @@ -373,9 +369,7 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) Uint8 pos; pos = TranslatePOV(joyinfo.dwPOV); - if (pos != joystick->hats[0]) { - SDL_PrivateJoystickHat(joystick, 0, pos); - } + SDL_PrivateJoystickHat(joystick, 0, pos); } } diff --git a/Engine/lib/sdl/src/joystick/windows/SDL_windowsjoystick.c b/Engine/lib/sdl/src/joystick/windows/SDL_windowsjoystick.c index e528afa7f..45cbea688 100644 --- a/Engine/lib/sdl/src/joystick/windows/SDL_windowsjoystick.c +++ b/Engine/lib/sdl/src/joystick/windows/SDL_windowsjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,8 +37,6 @@ #include "SDL_events.h" #include "SDL_timer.h" #include "SDL_mutex.h" -#include "SDL_events.h" -#include "SDL_hints.h" #include "SDL_joystick.h" #include "../SDL_sysjoystick.h" #include "../../thread/SDL_systhread.h" @@ -91,9 +89,10 @@ SDL_CreateDeviceNotification(SDL_DeviceNotificationData *data) return 0; } -static void -SDL_CheckDeviceNotification(SDL_DeviceNotificationData *data) +static SDL_bool +SDL_WaitForDeviceNotification(SDL_DeviceNotificationData *data, SDL_mutex *mutex) { + return SDL_FALSE; } #else /* !__WINRT__ */ @@ -106,6 +105,8 @@ typedef struct HDEVNOTIFY hNotify; } SDL_DeviceNotificationData; +#define IDT_SDL_DEVICE_CHANGE_TIMER_1 1200 +#define IDT_SDL_DEVICE_CHANGE_TIMER_2 1201 /* windowproc for our joystick detect thread message only window, to detect any USB device addition/removal */ static LRESULT CALLBACK @@ -115,17 +116,19 @@ SDL_PrivateJoystickDetectProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa case WM_DEVICECHANGE: switch (wParam) { case DBT_DEVICEARRIVAL: - if (((DEV_BROADCAST_HDR*)lParam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) { - s_bWindowsDeviceChanged = SDL_TRUE; - } - break; case DBT_DEVICEREMOVECOMPLETE: if (((DEV_BROADCAST_HDR*)lParam)->dbch_devicetype == DBT_DEVTYP_DEVICEINTERFACE) { - s_bWindowsDeviceChanged = SDL_TRUE; + /* notify 300ms and 2 seconds later to ensure all APIs have updated status */ + SetTimer(hwnd, IDT_SDL_DEVICE_CHANGE_TIMER_1, 300, NULL); + SetTimer(hwnd, IDT_SDL_DEVICE_CHANGE_TIMER_2, 2000, NULL); } break; } return 0; + case WM_TIMER: + KillTimer(hwnd, wParam); + s_bWindowsDeviceChanged = SDL_TRUE; + return 0; } return DefWindowProc (hwnd, message, wParam, lParam); @@ -189,21 +192,26 @@ SDL_CreateDeviceNotification(SDL_DeviceNotificationData *data) return 0; } -static void -SDL_CheckDeviceNotification(SDL_DeviceNotificationData *data) +static SDL_bool +SDL_WaitForDeviceNotification(SDL_DeviceNotificationData *data, SDL_mutex *mutex) { MSG msg; + int lastret = 1; if (!data->messageWindow) { - return; + return SDL_FALSE; /* device notifications require a window */ } - while (PeekMessage(&msg, data->messageWindow, 0, 0, PM_NOREMOVE)) { - if (GetMessage(&msg, data->messageWindow, 0, 0) != 0) { + SDL_UnlockMutex(mutex); + while (lastret > 0 && s_bWindowsDeviceChanged == SDL_FALSE) { + lastret = GetMessage(&msg, NULL, 0, 0); /* WM_QUIT causes return value of 0 */ + if (lastret > 0) { TranslateMessage(&msg); DispatchMessage(&msg); } } + SDL_LockMutex(mutex); + return (lastret != -1) ? SDL_TRUE : SDL_FALSE; } #endif /* __WINRT__ */ @@ -227,31 +235,30 @@ SDL_JoystickThread(void *_data) while (s_bJoystickThreadQuit == SDL_FALSE) { SDL_bool bXInputChanged = SDL_FALSE; - SDL_CondWaitTimeout(s_condJoystickThread, s_mutexJoyStickEnum, 300); - - SDL_CheckDeviceNotification(¬ification_data); - + if (SDL_WaitForDeviceNotification(¬ification_data, s_mutexJoyStickEnum) == SDL_FALSE) { #if SDL_JOYSTICK_XINPUT - if (SDL_XINPUT_Enabled() && XINPUTGETCAPABILITIES) { - /* scan for any change in XInput devices */ - Uint8 userId; - for (userId = 0; userId < XUSER_MAX_COUNT; userId++) { - XINPUT_CAPABILITIES capabilities; - const DWORD result = XINPUTGETCAPABILITIES(userId, XINPUT_FLAG_GAMEPAD, &capabilities); - const SDL_bool available = (result == ERROR_SUCCESS); - if (bOpenedXInputDevices[userId] != available) { - bXInputChanged = SDL_TRUE; - bOpenedXInputDevices[userId] = available; + /* WM_DEVICECHANGE not working, poll for new XINPUT controllers */ + SDL_CondWaitTimeout(s_condJoystickThread, s_mutexJoyStickEnum, 1000); + if (SDL_XINPUT_Enabled() && XINPUTGETCAPABILITIES) { + /* scan for any change in XInput devices */ + Uint8 userId; + for (userId = 0; userId < XUSER_MAX_COUNT; userId++) { + XINPUT_CAPABILITIES capabilities; + const DWORD result = XINPUTGETCAPABILITIES(userId, XINPUT_FLAG_GAMEPAD, &capabilities); + const SDL_bool available = (result == ERROR_SUCCESS); + if (bOpenedXInputDevices[userId] != available) { + bXInputChanged = SDL_TRUE; + bOpenedXInputDevices[userId] = available; + } } } - } +#else + /* WM_DEVICECHANGE not working, no XINPUT, no point in keeping thread alive */ + break; #endif /* SDL_JOYSTICK_XINPUT */ + } if (s_bWindowsDeviceChanged || bXInputChanged) { - SDL_UnlockMutex(s_mutexJoyStickEnum); /* let main thread go while we SDL_Delay(). */ - SDL_Delay(300); /* wait for direct input to find out about this device */ - SDL_LockMutex(s_mutexJoyStickEnum); - s_bDeviceRemoved = SDL_TRUE; s_bDeviceAdded = SDL_TRUE; s_bWindowsDeviceChanged = SDL_FALSE; @@ -307,7 +314,7 @@ SDL_SYS_JoystickInit(void) /* return the number of joysticks that are connected right now */ int -SDL_SYS_NumJoysticks() +SDL_SYS_NumJoysticks(void) { int nJoysticks = 0; JoyStick_DeviceData *device = SYS_Joystick; @@ -321,7 +328,7 @@ SDL_SYS_NumJoysticks() /* detect any new joysticks being inserted into the system */ void -SDL_SYS_JoystickDetect() +SDL_SYS_JoystickDetect(void) { JoyStick_DeviceData *pCurList = NULL; @@ -498,6 +505,9 @@ SDL_SYS_JoystickQuit(void) s_bJoystickThreadQuit = SDL_TRUE; SDL_CondBroadcast(s_condJoystickThread); /* signal the joystick thread to quit */ SDL_UnlockMutex(s_mutexJoyStickEnum); +#ifndef __WINRT__ + PostThreadMessage(SDL_GetThreadID(s_threadJoystick), WM_QUIT, 0, 0); +#endif SDL_WaitThread(s_threadJoystick, NULL); /* wait for it to bugger off */ SDL_DestroyMutex(s_mutexJoyStickEnum); diff --git a/Engine/lib/sdl/src/joystick/windows/SDL_windowsjoystick_c.h b/Engine/lib/sdl/src/joystick/windows/SDL_windowsjoystick_c.h index d3c5fcaab..01b8b3ab1 100644 --- a/Engine/lib/sdl/src/joystick/windows/SDL_windowsjoystick_c.h +++ b/Engine/lib/sdl/src/joystick/windows/SDL_windowsjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,6 +37,7 @@ typedef struct JoyStick_DeviceData BYTE SubType; Uint8 XInputUserId; DIDEVICEINSTANCE dxdevice; + WCHAR hidPath[MAX_PATH]; struct JoyStick_DeviceData *pNext; } JoyStick_DeviceData; diff --git a/Engine/lib/sdl/src/joystick/windows/SDL_xinputjoystick.c b/Engine/lib/sdl/src/joystick/windows/SDL_xinputjoystick.c index d581d45b9..823e7674f 100644 --- a/Engine/lib/sdl/src/joystick/windows/SDL_xinputjoystick.c +++ b/Engine/lib/sdl/src/joystick/windows/SDL_xinputjoystick.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,16 +33,23 @@ * Internal stuff. */ static SDL_bool s_bXInputEnabled = SDL_TRUE; +static char *s_arrXInputDevicePath[XUSER_MAX_COUNT]; static SDL_bool SDL_XInputUseOldJoystickMapping() { +#ifdef __WINRT__ + /* TODO: remove this __WINRT__ block, but only after integrating with UWP/WinRT's HID API */ + /* FIXME: Why are Win8/10 different here? -flibit */ + return (NTDDI_VERSION < NTDDI_WIN10); +#else static int s_XInputUseOldJoystickMapping = -1; if (s_XInputUseOldJoystickMapping < 0) { s_XInputUseOldJoystickMapping = SDL_GetHintBoolean(SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING, SDL_FALSE); } return (s_XInputUseOldJoystickMapping > 0); +#endif } SDL_bool SDL_XINPUT_Enabled(void) @@ -104,8 +111,80 @@ GetXInputName(const Uint8 userid, BYTE SubType) return SDL_strdup(name); } +/* We can't really tell what device is being used for XInput, but we can guess + and we'll be correct for the case where only one device is connected. + */ static void -AddXInputDevice(const Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext) +GuessXInputDevice(Uint8 userid, Uint16 *pVID, Uint16 *pPID, Uint16 *pVersion) +{ +#ifndef __WINRT__ /* TODO: remove this ifndef __WINRT__ block, but only after integrating with UWP/WinRT's HID API */ + + PRAWINPUTDEVICELIST devices = NULL; + UINT i, j, device_count = 0; + + if ((GetRawInputDeviceList(NULL, &device_count, sizeof(RAWINPUTDEVICELIST)) == -1) || (!device_count)) { + return; /* oh well. */ + } + + devices = (PRAWINPUTDEVICELIST)SDL_malloc(sizeof(RAWINPUTDEVICELIST) * device_count); + if (devices == NULL) { + return; + } + + if (GetRawInputDeviceList(devices, &device_count, sizeof(RAWINPUTDEVICELIST)) == -1) { + SDL_free(devices); + return; /* oh well. */ + } + + for (i = 0; i < device_count; i++) { + RID_DEVICE_INFO rdi; + char devName[128]; + UINT rdiSize = sizeof(rdi); + UINT nameSize = SDL_arraysize(devName); + + rdi.cbSize = sizeof(rdi); + if ((devices[i].dwType == RIM_TYPEHID) && + (GetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICEINFO, &rdi, &rdiSize) != ((UINT)-1)) && + (GetRawInputDeviceInfoA(devices[i].hDevice, RIDI_DEVICENAME, devName, &nameSize) != ((UINT)-1)) && + (SDL_strstr(devName, "IG_") != NULL)) { + SDL_bool found = SDL_FALSE; + for (j = 0; j < SDL_arraysize(s_arrXInputDevicePath); ++j) { + if (j == userid) { + continue; + } + if (!s_arrXInputDevicePath[j]) { + continue; + } + if (SDL_strcmp(devName, s_arrXInputDevicePath[j]) == 0) { + found = SDL_TRUE; + break; + } + } + if (found) { + /* We already have this device in our XInput device list */ + continue; + } + + /* We don't actually know if this is the right device for this + * userid, but we'll record it so we'll at least be consistent + * when the raw device list changes. + */ + *pVID = (Uint16)rdi.hid.dwVendorId; + *pPID = (Uint16)rdi.hid.dwProductId; + *pVersion = (Uint16)rdi.hid.dwVersionNumber; + if (s_arrXInputDevicePath[userid]) { + SDL_free(s_arrXInputDevicePath[userid]); + } + s_arrXInputDevicePath[userid] = SDL_strdup(devName); + break; + } + } + SDL_free(devices); +#endif /* ifndef __WINRT__ */ +} + +static void +AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext) { JoyStick_DeviceData *pPrevJoystick = NULL; JoyStick_DeviceData *pNewJoystick = *pContext; @@ -150,16 +229,35 @@ AddXInputDevice(const Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext if (SDL_XInputUseOldJoystickMapping()) { SDL_zero(pNewJoystick->guid); } else { - pNewJoystick->guid.data[0] = 'x'; - pNewJoystick->guid.data[1] = 'i'; - pNewJoystick->guid.data[2] = 'n'; - pNewJoystick->guid.data[3] = 'p'; - pNewJoystick->guid.data[4] = 'u'; - pNewJoystick->guid.data[5] = 't'; - pNewJoystick->guid.data[6] = SubType; + const Uint16 BUS_USB = 0x03; + Uint16 vendor = 0; + Uint16 product = 0; + Uint16 version = 0; + Uint16 *guid16 = (Uint16 *)pNewJoystick->guid.data; + + GuessXInputDevice(userid, &vendor, &product, &version); + + *guid16++ = SDL_SwapLE16(BUS_USB); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(vendor); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(product); + *guid16++ = 0; + *guid16++ = SDL_SwapLE16(version); + *guid16++ = 0; + + /* Note that this is an XInput device and what subtype it is */ + pNewJoystick->guid.data[14] = 'x'; + pNewJoystick->guid.data[15] = SubType; } pNewJoystick->SubType = SubType; pNewJoystick->XInputUserId = userid; + + if (SDL_ShouldIgnoreGameController(pNewJoystick->joystickname, pNewJoystick->guid)) { + SDL_free(pNewJoystick); + return; + } + SDL_SYS_AddJoystickDevice(pNewJoystick); } @@ -220,14 +318,12 @@ SDL_XINPUT_JoystickOpen(SDL_Joystick * joystick, JoyStick_DeviceData *joystickde static void UpdateXInputJoystickBatteryInformation(SDL_Joystick * joystick, XINPUT_BATTERY_INFORMATION_EX *pBatteryInformation) { - if ( pBatteryInformation->BatteryType != BATTERY_TYPE_UNKNOWN ) - { + if (pBatteryInformation->BatteryType != BATTERY_TYPE_UNKNOWN) { SDL_JoystickPowerLevel ePowerLevel = SDL_JOYSTICK_POWER_UNKNOWN; if (pBatteryInformation->BatteryType == BATTERY_TYPE_WIRED) { ePowerLevel = SDL_JOYSTICK_POWER_WIRED; } else { - switch ( pBatteryInformation->BatteryLevel ) - { + switch (pBatteryInformation->BatteryLevel) { case BATTERY_LEVEL_EMPTY: ePowerLevel = SDL_JOYSTICK_POWER_EMPTY; break; @@ -244,7 +340,7 @@ UpdateXInputJoystickBatteryInformation(SDL_Joystick * joystick, XINPUT_BATTERY_I } } - SDL_PrivateJoystickBatteryLevel( joystick, ePowerLevel ); + SDL_PrivateJoystickBatteryLevel(joystick, ePowerLevel); } } @@ -272,7 +368,7 @@ UpdateXInputJoystickState_OLD(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputS SDL_PrivateJoystickButton(joystick, button, (wButtons & s_XInputButtons[button]) ? SDL_PRESSED : SDL_RELEASED); } - UpdateXInputJoystickBatteryInformation( joystick, pBatteryInformation ); + UpdateXInputJoystickBatteryInformation(joystick, pBatteryInformation); } static void @@ -313,7 +409,7 @@ UpdateXInputJoystickState(SDL_Joystick * joystick, XINPUT_STATE_EX *pXInputState } SDL_PrivateJoystickHat(joystick, 0, hat); - UpdateXInputJoystickBatteryInformation( joystick, pBatteryInformation ); + UpdateXInputJoystickBatteryInformation(joystick, pBatteryInformation); } void @@ -328,15 +424,20 @@ SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick) result = XINPUTGETSTATE(joystick->hwdata->userid, &XInputState); if (result == ERROR_DEVICE_NOT_CONNECTED) { + Uint8 userid = joystick->hwdata->userid; + joystick->hwdata->send_remove_event = SDL_TRUE; joystick->hwdata->removed = SDL_TRUE; + if (s_arrXInputDevicePath[userid]) { + SDL_free(s_arrXInputDevicePath[userid]); + s_arrXInputDevicePath[userid] = NULL; + } return; } - SDL_zero( XBatteryInformation ); - if ( XINPUTGETBATTERYINFORMATION ) - { - result = XINPUTGETBATTERYINFORMATION( joystick->hwdata->userid, BATTERY_DEVTYPE_GAMEPAD, &XBatteryInformation ); + SDL_zero(XBatteryInformation); + if (XINPUTGETBATTERYINFORMATION) { + result = XINPUTGETBATTERYINFORMATION(joystick->hwdata->userid, BATTERY_DEVTYPE_GAMEPAD, &XBatteryInformation); } /* only fire events if the data changed from last time */ diff --git a/Engine/lib/sdl/src/joystick/windows/SDL_xinputjoystick_c.h b/Engine/lib/sdl/src/joystick/windows/SDL_xinputjoystick_c.h index b3ba8c02e..63616ee30 100644 --- a/Engine/lib/sdl/src/joystick/windows/SDL_xinputjoystick_c.h +++ b/Engine/lib/sdl/src/joystick/windows/SDL_xinputjoystick_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/libm/e_atan2.c b/Engine/lib/sdl/src/libm/e_atan2.c index f7b91a3e1..32b972570 100644 --- a/Engine/lib/sdl/src/libm/e_atan2.c +++ b/Engine/lib/sdl/src/libm/e_atan2.c @@ -81,8 +81,8 @@ double attribute_hidden __ieee754_atan2(double y, double x) switch(m) { case 0: return pi_o_4+tiny;/* atan(+INF,+INF) */ case 1: return -pi_o_4-tiny;/* atan(-INF,+INF) */ - case 2: return 3.0*pi_o_4+tiny;/* atan(+INF,-INF) */ - case 3: return -3.0*pi_o_4-tiny;/* atan(-INF,-INF) */ + case 2: return 3.0*pi_o_4+tiny;/*atan(+INF,-INF)*/ + case 3: return -3.0*pi_o_4-tiny;/*atan(-INF,-INF)*/ } } else { switch(m) { @@ -114,3 +114,21 @@ double attribute_hidden __ieee754_atan2(double y, double x) return (z-pi_lo)-pi;/* atan(-,-) */ } } + +/* + * wrapper atan2(y,x) + */ +#ifndef _IEEE_LIBM +double atan2(double y, double x) +{ + double z = __ieee754_atan2(y, x); + if (_LIB_VERSION == _IEEE_ || isnan(x) || isnan(y)) + return z; + if (x == 0.0 && y == 0.0) + return __kernel_standard(y,x,3); /* atan2(+-0,+-0) */ + return z; +} +#else +strong_alias(__ieee754_atan2, atan2) +#endif +libm_hidden_def(atan2) diff --git a/Engine/lib/sdl/src/libm/e_fmod.c b/Engine/lib/sdl/src/libm/e_fmod.c new file mode 100644 index 000000000..fd8bacb2b --- /dev/null +++ b/Engine/lib/sdl/src/libm/e_fmod.c @@ -0,0 +1,144 @@ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * __ieee754_fmod(x,y) + * Return x mod y in exact arithmetic + * Method: shift and subtract + */ + +#include "math_libm.h" +#include "math_private.h" + +static const double one = 1.0, Zero[] = {0.0, -0.0,}; + +double attribute_hidden __ieee754_fmod(double x, double y) +{ + int32_t n,hx,hy,hz,ix,iy,sx,i; + u_int32_t lx,ly,lz; + + EXTRACT_WORDS(hx,lx,x); + EXTRACT_WORDS(hy,ly,y); + sx = hx&0x80000000; /* sign of x */ + hx ^=sx; /* |x| */ + hy &= 0x7fffffff; /* |y| */ + + /* purge off exception values */ + if((hy|ly)==0||(hx>=0x7ff00000)|| /* y=0,or x not finite */ + ((hy|((ly|-(int32_t)ly)>>31))>0x7ff00000)) /* or y is NaN */ + return (x*y)/(x*y); + if(hx<=hy) { + if((hx>31]; /* |x|=|y| return x*0*/ + } + + /* determine ix = ilogb(x) */ + if(hx<0x00100000) { /* subnormal x */ + if(hx==0) { + for (ix = -1043, i=lx; i>0; i<<=1) ix -=1; + } else { + for (ix = -1022,i=(hx<<11); i>0; i<<=1) ix -=1; + } + } else ix = (hx>>20)-1023; + + /* determine iy = ilogb(y) */ + if(hy<0x00100000) { /* subnormal y */ + if(hy==0) { + for (iy = -1043, i=ly; i>0; i<<=1) iy -=1; + } else { + for (iy = -1022,i=(hy<<11); i>0; i<<=1) iy -=1; + } + } else iy = (hy>>20)-1023; + + /* set up {hx,lx}, {hy,ly} and align y to x */ + if(ix >= -1022) + hx = 0x00100000|(0x000fffff&hx); + else { /* subnormal x, shift x to normal */ + n = -1022-ix; + if(n<=31) { + hx = (hx<>(32-n)); + lx <<= n; + } else { + hx = lx<<(n-32); + lx = 0; + } + } + if(iy >= -1022) + hy = 0x00100000|(0x000fffff&hy); + else { /* subnormal y, shift y to normal */ + n = -1022-iy; + if(n<=31) { + hy = (hy<>(32-n)); + ly <<= n; + } else { + hy = ly<<(n-32); + ly = 0; + } + } + + /* fix point fmod */ + n = ix - iy; + while(n--) { + hz=hx-hy;lz=lx-ly; if(lx>31); lx = lx+lx;} + else { + if((hz|lz)==0) /* return sign(x)*0 */ + return Zero[(u_int32_t)sx>>31]; + hx = hz+hz+(lz>>31); lx = lz+lz; + } + } + hz=hx-hy;lz=lx-ly; if(lx=0) {hx=hz;lx=lz;} + + /* convert back to floating value and restore the sign */ + if((hx|lx)==0) /* return sign(x)*0 */ + return Zero[(u_int32_t)sx>>31]; + while(hx<0x00100000) { /* normalize x */ + hx = hx+hx+(lx>>31); lx = lx+lx; + iy -= 1; + } + if(iy>= -1022) { /* normalize output */ + hx = ((hx-0x00100000)|((iy+1023)<<20)); + INSERT_WORDS(x,hx|sx,lx); + } else { /* subnormal output */ + n = -1022 - iy; + if(n<=20) { + lx = (lx>>n)|((u_int32_t)hx<<(32-n)); + hx >>= n; + } else if (n<=31) { + lx = (hx<<(32-n))|(lx>>n); hx = sx; + } else { + lx = hx>>(n-32); hx = sx; + } + INSERT_WORDS(x,hx|sx,lx); + x *= one; /* create necessary signal */ + } + return x; /* exact output */ +} + +/* + * wrapper fmod(x,y) + */ +#ifndef _IEEE_LIBM +double fmod(double x, double y) +{ + double z = __ieee754_fmod(x, y); + if (_LIB_VERSION == _IEEE_ || isnan(y) || isnan(x)) + return z; + if (y == 0.0) + return __kernel_standard(x, y, 27); /* fmod(x,0) */ + return z; +} +#else +strong_alias(__ieee754_fmod, fmod) +#endif +libm_hidden_def(fmod) diff --git a/Engine/lib/sdl/src/libm/e_log.c b/Engine/lib/sdl/src/libm/e_log.c index da64138cd..208df815c 100644 --- a/Engine/lib/sdl/src/libm/e_log.c +++ b/Engine/lib/sdl/src/libm/e_log.c @@ -1,4 +1,3 @@ -/* @(#)e_log.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,9 +9,9 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: e_log.c,v 1.8 1995/05/10 20:45:49 jtc Exp $"; +#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */ +/* C4723: potential divide by zero. */ +#pragma warning ( disable : 4723 ) #endif /* __ieee754_log(x) @@ -69,99 +68,85 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -#ifdef __STDC__ static const double -#else -static double -#endif - ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */ - ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */ - two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */ - Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */ - Lg2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */ - Lg3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */ - Lg4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */ - Lg5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */ - Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */ - Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */ +ln2_hi = 6.93147180369123816490e-01, /* 3fe62e42 fee00000 */ +ln2_lo = 1.90821492927058770002e-10, /* 3dea39ef 35793c76 */ +two54 = 1.80143985094819840000e+16, /* 43500000 00000000 */ +Lg1 = 6.666666666666735130e-01, /* 3FE55555 55555593 */ +Lg2 = 3.999999999940941908e-01, /* 3FD99999 9997FA04 */ +Lg3 = 2.857142874366239149e-01, /* 3FD24924 94229359 */ +Lg4 = 2.222219843214978396e-01, /* 3FCC71C5 1D8E78AF */ +Lg5 = 1.818357216161805012e-01, /* 3FC74664 96CB03DE */ +Lg6 = 1.531383769920937332e-01, /* 3FC39A09 D078C69F */ +Lg7 = 1.479819860511658591e-01; /* 3FC2F112 DF3E5244 */ -#ifdef __STDC__ -static const double zero = 0.0; -#else -static double zero = 0.0; -#endif +static const double zero = 0.0; -#ifdef __STDC__ -double attribute_hidden -__ieee754_log(double x) -#else -double attribute_hidden -__ieee754_log(x) - double x; -#endif +double attribute_hidden __ieee754_log(double x) { - double hfsq, f, s, z, R, w, t1, t2, dk; - int32_t k, hx, i, j; - u_int32_t lx; + double hfsq,f,s,z,R,w,t1,t2,dk; + int32_t k,hx,i,j; + u_int32_t lx; - EXTRACT_WORDS(hx, lx, x); + EXTRACT_WORDS(hx,lx,x); - k = 0; - if (hx < 0x00100000) { /* x < 2**-1022 */ - if (((hx & 0x7fffffff) | lx) == 0) - return -two54 / zero; /* log(+-0)=-inf */ - if (hx < 0) - return (x - x) / zero; /* log(-#) = NaN */ - k -= 54; - x *= two54; /* subnormal number, scale up x */ - GET_HIGH_WORD(hx, x); - } - if (hx >= 0x7ff00000) - return x + x; - k += (hx >> 20) - 1023; - hx &= 0x000fffff; - i = (hx + 0x95f64) & 0x100000; - SET_HIGH_WORD(x, hx | (i ^ 0x3ff00000)); /* normalize x or x/2 */ - k += (i >> 20); - f = x - 1.0; - if ((0x000fffff & (2 + hx)) < 3) { /* |f| < 2**-20 */ - if (f == zero) { - if (k == 0) - return zero; - else { - dk = (double) k; - return dk * ln2_hi + dk * ln2_lo; - } - } - R = f * f * (0.5 - 0.33333333333333333 * f); - if (k == 0) - return f - R; - else { - dk = (double) k; - return dk * ln2_hi - ((R - dk * ln2_lo) - f); - } - } - s = f / (2.0 + f); - dk = (double) k; - z = s * s; - i = hx - 0x6147a; - w = z * z; - j = 0x6b851 - hx; - t1 = w * (Lg2 + w * (Lg4 + w * Lg6)); - t2 = z * (Lg1 + w * (Lg3 + w * (Lg5 + w * Lg7))); - i |= j; - R = t2 + t1; - if (i > 0) { - hfsq = 0.5 * f * f; - if (k == 0) - return f - (hfsq - s * (hfsq + R)); - else - return dk * ln2_hi - ((hfsq - (s * (hfsq + R) + dk * ln2_lo)) - - f); - } else { - if (k == 0) - return f - s * (f - R); - else - return dk * ln2_hi - ((s * (f - R) - dk * ln2_lo) - f); - } + k=0; + if (hx < 0x00100000) { /* x < 2**-1022 */ + if (((hx&0x7fffffff)|lx)==0) + return -two54/zero; /* log(+-0)=-inf */ + if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ + k -= 54; x *= two54; /* subnormal number, scale up x */ + GET_HIGH_WORD(hx,x); + } + if (hx >= 0x7ff00000) return x+x; + k += (hx>>20)-1023; + hx &= 0x000fffff; + i = (hx+0x95f64)&0x100000; + SET_HIGH_WORD(x,hx|(i^0x3ff00000)); /* normalize x or x/2 */ + k += (i>>20); + f = x-1.0; + if((0x000fffff&(2+hx))<3) { /* |f| < 2**-20 */ + if(f==zero) {if(k==0) return zero; else {dk=(double)k; + return dk*ln2_hi+dk*ln2_lo;} + } + R = f*f*(0.5-0.33333333333333333*f); + if(k==0) return f-R; else {dk=(double)k; + return dk*ln2_hi-((R-dk*ln2_lo)-f);} + } + s = f/(2.0+f); + dk = (double)k; + z = s*s; + i = hx-0x6147a; + w = z*z; + j = 0x6b851-hx; + t1= w*(Lg2+w*(Lg4+w*Lg6)); + t2= z*(Lg1+w*(Lg3+w*(Lg5+w*Lg7))); + i |= j; + R = t2+t1; + if(i>0) { + hfsq=0.5*f*f; + if(k==0) return f-(hfsq-s*(hfsq+R)); else + return dk*ln2_hi-((hfsq-(s*(hfsq+R)+dk*ln2_lo))-f); + } else { + if(k==0) return f-s*(f-R); else + return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f); + } } + +/* + * wrapper log(x) + */ +#ifndef _IEEE_LIBM +double log(double x) +{ + double z = __ieee754_log(x); + if (_LIB_VERSION == _IEEE_ || isnan(x) || x > 0.0) + return z; + if (x == 0.0) + return __kernel_standard(x, x, 16); /* log(0) */ + return __kernel_standard(x, x, 17); /* log(x<0) */ +} +#else +strong_alias(__ieee754_log, log) +#endif +libm_hidden_def(log) diff --git a/Engine/lib/sdl/src/libm/e_log10.c b/Engine/lib/sdl/src/libm/e_log10.c new file mode 100644 index 000000000..a30ba54e6 --- /dev/null +++ b/Engine/lib/sdl/src/libm/e_log10.c @@ -0,0 +1,106 @@ +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */ +/* C4723: potential divide by zero. */ +#pragma warning ( disable : 4723 ) +#endif + +/* __ieee754_log10(x) + * Return the base 10 logarithm of x + * + * Method : + * Let log10_2hi = leading 40 bits of log10(2) and + * log10_2lo = log10(2) - log10_2hi, + * ivln10 = 1/log(10) rounded. + * Then + * n = ilogb(x), + * if(n<0) n = n+1; + * x = scalbn(x,-n); + * log10(x) := n*log10_2hi + (n*log10_2lo + ivln10*log(x)) + * + * Note 1: + * To guarantee log10(10**n)=n, where 10**n is normal, the rounding + * mode must set to Round-to-Nearest. + * Note 2: + * [1/log(10)] rounded to 53 bits has error .198 ulps; + * log10 is monotonic at all binary break points. + * + * Special cases: + * log10(x) is NaN with signal if x < 0; + * log10(+INF) is +INF with no signal; log10(0) is -INF with signal; + * log10(NaN) is that NaN with no signal; + * log10(10**N) = N for N=0,1,...,22. + * + * Constants: + * The hexadecimal values are the intended ones for the following constants. + * The decimal values may be used, provided that the compiler will convert + * from decimal to binary accurately enough to produce the hexadecimal values + * shown. + */ + +#include "math_libm.h" +#include "math_private.h" + +static const double +two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ +ivln10 = 4.34294481903251816668e-01, /* 0x3FDBCB7B, 0x1526E50E */ +log10_2hi = 3.01029995663611771306e-01, /* 0x3FD34413, 0x509F6000 */ +log10_2lo = 3.69423907715893078616e-13; /* 0x3D59FEF3, 0x11F12B36 */ + +static const double zero = 0.0; + +double attribute_hidden __ieee754_log10(double x) +{ + double y,z; + int32_t i,k,hx; + u_int32_t lx; + + EXTRACT_WORDS(hx,lx,x); + + k=0; + if (hx < 0x00100000) { /* x < 2**-1022 */ + if (((hx&0x7fffffff)|lx)==0) + return -two54/zero; /* log(+-0)=-inf */ + if (hx<0) return (x-x)/zero; /* log(-#) = NaN */ + k -= 54; x *= two54; /* subnormal number, scale up x */ + GET_HIGH_WORD(hx,x); + } + if (hx >= 0x7ff00000) return x+x; + k += (hx>>20)-1023; + i = ((u_int32_t)k&0x80000000)>>31; + hx = (hx&0x000fffff)|((0x3ff-i)<<20); + y = (double)(k+i); + SET_HIGH_WORD(x,hx); + z = y*log10_2lo + ivln10*__ieee754_log(x); + return z+y*log10_2hi; +} + +/* + * wrapper log10(X) + */ +#ifndef _IEEE_LIBM +double log10(double x) +{ + double z = __ieee754_log10(x); + if (_LIB_VERSION == _IEEE_ || isnan(x)) + return z; + if (x <= 0.0) { + if(x == 0.0) + return __kernel_standard(x, x, 18); /* log10(0) */ + return __kernel_standard(x, x, 19); /* log10(x<0) */ + } + return z; +} +#else +strong_alias(__ieee754_log10, log10) +#endif +libm_hidden_def(log10) diff --git a/Engine/lib/sdl/src/libm/e_pow.c b/Engine/lib/sdl/src/libm/e_pow.c index 686da2e55..cfd1dbfbe 100644 --- a/Engine/lib/sdl/src/libm/e_pow.c +++ b/Engine/lib/sdl/src/libm/e_pow.c @@ -1,4 +1,3 @@ -/* @(#)e_pow.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,10 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static char rcsid[] = "$NetBSD: e_pow.c,v 1.9 1995/05/12 04:57:32 jtc Exp $"; -#endif - /* __ieee754_pow(x,y) return x**y * * n @@ -26,25 +21,26 @@ static char rcsid[] = "$NetBSD: e_pow.c,v 1.9 1995/05/12 04:57:32 jtc Exp $"; * 3. Return x**y = 2**n*exp(y'*log2) * * Special cases: - * 1. (anything) ** 0 is 1 - * 2. (anything) ** 1 is itself - * 3. (anything) ** NAN is NAN - * 4. NAN ** (anything except 0) is NAN - * 5. +-(|x| > 1) ** +INF is +INF - * 6. +-(|x| > 1) ** -INF is +0 - * 7. +-(|x| < 1) ** +INF is +0 - * 8. +-(|x| < 1) ** -INF is +INF - * 9. +-1 ** +-INF is NAN - * 10. +0 ** (+anything except 0, NAN) is +0 - * 11. -0 ** (+anything except 0, NAN, odd integer) is +0 - * 12. +0 ** (-anything except 0, NAN) is +INF - * 13. -0 ** (-anything except 0, NAN, odd integer) is +INF - * 14. -0 ** (odd integer) = -( +0 ** (odd integer) ) - * 15. +INF ** (+anything except 0,NAN) is +INF - * 16. +INF ** (-anything except 0,NAN) is +0 - * 17. -INF ** (anything) = -0 ** (-anything) - * 18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer) - * 19. (-anything except 0 and inf) ** (non-integer) is NAN + * 1. +-1 ** anything is 1.0 + * 2. +-1 ** +-INF is 1.0 + * 3. (anything) ** 0 is 1 + * 4. (anything) ** 1 is itself + * 5. (anything) ** NAN is NAN + * 6. NAN ** (anything except 0) is NAN + * 7. +-(|x| > 1) ** +INF is +INF + * 8. +-(|x| > 1) ** -INF is +0 + * 9. +-(|x| < 1) ** +INF is +0 + * 10 +-(|x| < 1) ** -INF is +INF + * 11. +0 ** (+anything except 0, NAN) is +0 + * 12. -0 ** (+anything except 0, NAN, odd integer) is +0 + * 13. +0 ** (-anything except 0, NAN) is +INF + * 14. -0 ** (-anything except 0, NAN, odd integer) is +INF + * 15. -0 ** (odd integer) = -( +0 ** (odd integer) ) + * 16. +INF ** (+anything except 0,NAN) is +INF + * 17. +INF ** (-anything except 0,NAN) is +0 + * 18. -INF ** (anything) = -0 ** (-anything) + * 19. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer) + * 20. (-anything except 0 and inf) ** (non-integer) is NAN * * Accuracy: * pow(x,y) returns x**y nearly rounded. In particular @@ -62,281 +58,286 @@ static char rcsid[] = "$NetBSD: e_pow.c,v 1.9 1995/05/12 04:57:32 jtc Exp $"; #include "math_libm.h" #include "math_private.h" -libm_hidden_proto(scalbn) - libm_hidden_proto(fabs) -#ifdef __STDC__ - static const double -#else - static double +#if defined(_MSC_VER) /* Handle Microsoft VC++ compiler specifics. */ +/* C4756: overflow in constant arithmetic */ +#pragma warning ( disable : 4756 ) #endif - bp[] = { 1.0, 1.5, }, dp_h[] = { - 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */ - dp_l[] = { - 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */ +static const double +bp[] = {1.0, 1.5,}, +dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */ +dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */ +zero = 0.0, +one = 1.0, +two = 2.0, +two53 = 9007199254740992.0, /* 0x43400000, 0x00000000 */ +huge = 1.0e300, +tiny = 1.0e-300, + /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */ +L1 = 5.99999999999994648725e-01, /* 0x3FE33333, 0x33333303 */ +L2 = 4.28571428578550184252e-01, /* 0x3FDB6DB6, 0xDB6FABFF */ +L3 = 3.33333329818377432918e-01, /* 0x3FD55555, 0x518F264D */ +L4 = 2.72728123808534006489e-01, /* 0x3FD17460, 0xA91D4101 */ +L5 = 2.30660745775561754067e-01, /* 0x3FCD864A, 0x93C9DB65 */ +L6 = 2.06975017800338417784e-01, /* 0x3FCA7E28, 0x4A454EEF */ +P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */ +P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */ +P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */ +P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */ +P5 = 4.13813679705723846039e-08, /* 0x3E663769, 0x72BEA4D0 */ +lg2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */ +lg2_h = 6.93147182464599609375e-01, /* 0x3FE62E43, 0x00000000 */ +lg2_l = -1.90465429995776804525e-09, /* 0xBE205C61, 0x0CA86C39 */ +ovt = 8.0085662595372944372e-0017, /* -(1024-log2(ovfl+.5ulp)) */ +cp = 9.61796693925975554329e-01, /* 0x3FEEC709, 0xDC3A03FD =2/(3ln2) */ +cp_h = 9.61796700954437255859e-01, /* 0x3FEEC709, 0xE0000000 =(float)cp */ +cp_l = -7.02846165095275826516e-09, /* 0xBE3E2FE0, 0x145B01F5 =tail of cp_h*/ +ivln2 = 1.44269504088896338700e+00, /* 0x3FF71547, 0x652B82FE =1/ln2 */ +ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2*/ +ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ - zero = 0.0, one = 1.0, two = 2.0, two53 = 9007199254740992.0, /* 0x43400000, 0x00000000 */ - huge_val = 1.0e300, tiny = 1.0e-300, - /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */ - L1 = 5.99999999999994648725e-01, /* 0x3FE33333, 0x33333303 */ - L2 = 4.28571428578550184252e-01, /* 0x3FDB6DB6, 0xDB6FABFF */ - L3 = 3.33333329818377432918e-01, /* 0x3FD55555, 0x518F264D */ - L4 = 2.72728123808534006489e-01, /* 0x3FD17460, 0xA91D4101 */ - L5 = 2.30660745775561754067e-01, /* 0x3FCD864A, 0x93C9DB65 */ - L6 = 2.06975017800338417784e-01, /* 0x3FCA7E28, 0x4A454EEF */ - P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */ - P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */ - P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */ - P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */ - P5 = 4.13813679705723846039e-08, /* 0x3E663769, 0x72BEA4D0 */ - lg2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */ - lg2_h = 6.93147182464599609375e-01, /* 0x3FE62E43, 0x00000000 */ - lg2_l = -1.90465429995776804525e-09, /* 0xBE205C61, 0x0CA86C39 */ - ovt = 8.0085662595372944372e-0017, /* -(1024-log2(ovfl+.5ulp)) */ - cp = 9.61796693925975554329e-01, /* 0x3FEEC709, 0xDC3A03FD =2/(3ln2) */ - cp_h = 9.61796700954437255859e-01, /* 0x3FEEC709, 0xE0000000 =(float)cp */ - cp_l = -7.02846165095275826516e-09, /* 0xBE3E2FE0, 0x145B01F5 =tail of cp_h */ - ivln2 = 1.44269504088896338700e+00, /* 0x3FF71547, 0x652B82FE =1/ln2 */ - ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2 */ - ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail */ +double attribute_hidden __ieee754_pow(double x, double y) +{ + double z,ax,z_h,z_l,p_h,p_l; + double y1,t1,t2,r,s,t,u,v,w; + int32_t i,j,k,yisint,n; + int32_t hx,hy,ix,iy; + u_int32_t lx,ly; -#ifdef __STDC__ - double attribute_hidden __ieee754_pow(double x, double y) + EXTRACT_WORDS(hx,lx,x); + /* x==1: 1**y = 1 (even if y is NaN) */ + if (hx==0x3ff00000 && lx==0) { + return x; + } + ix = hx&0x7fffffff; + + EXTRACT_WORDS(hy,ly,y); + iy = hy&0x7fffffff; + + /* y==zero: x**0 = 1 */ + if((iy|ly)==0) return one; + + /* +-NaN return x+y */ + if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) || + iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) + return x+y; + + /* determine if y is an odd int when x < 0 + * yisint = 0 ... y is not an integer + * yisint = 1 ... y is an odd int + * yisint = 2 ... y is an even int + */ + yisint = 0; + if(hx<0) { + if(iy>=0x43400000) yisint = 2; /* even integer y */ + else if(iy>=0x3ff00000) { + k = (iy>>20)-0x3ff; /* exponent */ + if(k>20) { + j = ly>>(52-k); + if((j<<(52-k))==ly) yisint = 2-(j&1); + } else if(ly==0) { + j = iy>>(20-k); + if((j<<(20-k))==iy) yisint = 2-(j&1); + } + } + } + + /* special value of y */ + if(ly==0) { + if (iy==0x7ff00000) { /* y is +-inf */ + if (((ix-0x3ff00000)|lx)==0) + return one; /* +-1**+-inf is 1 (yes, weird rule) */ + if (ix >= 0x3ff00000) /* (|x|>1)**+-inf = inf,0 */ + return (hy>=0) ? y : zero; + /* (|x|<1)**-,+inf = inf,0 */ + return (hy<0) ? -y : zero; + } + if(iy==0x3ff00000) { /* y is +-1 */ + if(hy<0) return one/x; else return x; + } + if(hy==0x40000000) return x*x; /* y is 2 */ + if(hy==0x3fe00000) { /* y is 0.5 */ + if(hx>=0) /* x >= +0 */ + return __ieee754_sqrt(x); + } + } + + ax = fabs(x); + /* special value of x */ + if(lx==0) { + if(ix==0x7ff00000||ix==0||ix==0x3ff00000){ + z = ax; /*x is +-0,+-inf,+-1*/ + if(hy<0) z = one/z; /* z = (1/|x|) */ + if(hx<0) { + if(((ix-0x3ff00000)|yisint)==0) { + z = (z-z)/(z-z); /* (-1)**non-int is NaN */ + } else if(yisint==1) + z = -z; /* (x<0)**odd = -(|x|**odd) */ + } + return z; + } + } + + /* (x<0)**(non-int) is NaN */ + if(((((u_int32_t)hx>>31)-1)|yisint)==0) return (x-x)/(x-x); + + /* |y| is huge */ + if(iy>0x41e00000) { /* if |y| > 2**31 */ + if(iy>0x43f00000){ /* if |y| > 2**64, must o/uflow */ + if(ix<=0x3fefffff) return (hy<0)? huge*huge:tiny*tiny; + if(ix>=0x3ff00000) return (hy>0)? huge*huge:tiny*tiny; + } + /* over/underflow if x is not close to one */ + if(ix<0x3fefffff) return (hy<0)? huge*huge:tiny*tiny; + if(ix>0x3ff00000) return (hy>0)? huge*huge:tiny*tiny; + /* now |1-x| is tiny <= 2**-20, suffice to compute + log(x) by x-x^2/2+x^3/3-x^4/4 */ + t = x-1; /* t has 20 trailing zeros */ + w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25)); + u = ivln2_h*t; /* ivln2_h has 21 sig. bits */ + v = t*ivln2_l-w*ivln2; + t1 = u+v; + SET_LOW_WORD(t1,0); + t2 = v-(t1-u); + } else { + double s2,s_h,s_l,t_h,t_l; + n = 0; + /* take care subnormal number */ + if(ix<0x00100000) + {ax *= two53; n -= 53; GET_HIGH_WORD(ix,ax); } + n += ((ix)>>20)-0x3ff; + j = ix&0x000fffff; + /* determine interval */ + ix = j|0x3ff00000; /* normalize ix */ + if(j<=0x3988E) k=0; /* |x|>1)|0x20000000)+0x00080000+(k<<18)); + t_l = ax - (t_h-bp[k]); + s_l = v*((u-s_h*t_h)-s_h*t_l); + /* compute log(ax) */ + s2 = s*s; + r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); + r += s_l*(s_h+s); + s2 = s_h*s_h; + t_h = 3.0+s2+r; + SET_LOW_WORD(t_h,0); + t_l = r-((t_h-3.0)-s2); + /* u+v = s*(1+...) */ + u = s_h*t_h; + v = s_l*t_h+t_l*s; + /* 2/(3log2)*(s+...) */ + p_h = u+v; + SET_LOW_WORD(p_h,0); + p_l = v-(p_h-u); + z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */ + z_l = cp_l*p_h+p_l*cp+dp_l[k]; + /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ + t = (double)n; + t1 = (((z_h+z_l)+dp_h[k])+t); + SET_LOW_WORD(t1,0); + t2 = z_l-(((t1-t)-dp_h[k])-z_h); + } + + s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ + if(((((u_int32_t)hx>>31)-1)|(yisint-1))==0) + s = -one;/* (-ve)**(odd int) */ + + /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ + y1 = y; + SET_LOW_WORD(y1,0); + p_l = (y-y1)*t1+y*t2; + p_h = y1*t1; + z = p_l+p_h; + EXTRACT_WORDS(j,i,z); + if (j>=0x40900000) { /* z >= 1024 */ + if(((j-0x40900000)|i)!=0) /* if z > 1024 */ + return s*huge*huge; /* overflow */ + else { + if(p_l+ovt>z-p_h) return s*huge*huge; /* overflow */ + } + } else if((j&0x7fffffff)>=0x4090cc00 ) { /* z <= -1075 */ + if(((j-0xc090cc00)|i)!=0) /* z < -1075 */ + return s*tiny*tiny; /* underflow */ + else { + if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */ + } + } + /* + * compute 2**(p_h+p_l) + */ + i = j&0x7fffffff; + k = (i>>20)-0x3ff; + n = 0; + if(i>0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */ + n = j+(0x00100000>>(k+1)); + k = ((n&0x7fffffff)>>20)-0x3ff; /* new k for n */ + t = zero; + SET_HIGH_WORD(t,n&~(0x000fffff>>k)); + n = ((n&0x000fffff)|0x00100000)>>(20-k); + if(j<0) n = -n; + p_h -= t; + } + t = p_l+p_h; + SET_LOW_WORD(t,0); + u = t*lg2_h; + v = (p_l-(t-p_h))*lg2+t*lg2_l; + z = u+v; + w = v-(z-u); + t = z*z; + t1 = z - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); + r = (z*t1)/(t1-two)-(w+z*w); + z = one-(r-z); + GET_HIGH_WORD(j,z); + j += (n<<20); + if((j>>20)<=0) z = scalbn(z,n); /* subnormal output */ + else SET_HIGH_WORD(z,j); + return s*z; +} + +/* + * wrapper pow(x,y) return x**y + */ +#ifndef _IEEE_LIBM +double pow(double x, double y) +{ + double z = __ieee754_pow(x, y); + if (_LIB_VERSION == _IEEE_|| isnan(y)) + return z; + if (isnan(x)) { + if (y == 0.0) + return __kernel_standard(x, y, 42); /* pow(NaN,0.0) */ + return z; + } + if (x == 0.0) { + if (y == 0.0) + return __kernel_standard(x, y, 20); /* pow(0.0,0.0) */ + if (isfinite(y) && y < 0.0) + return __kernel_standard(x,y,23); /* pow(0.0,negative) */ + return z; + } + if (!isfinite(z)) { + if (isfinite(x) && isfinite(y)) { + if (isnan(z)) + return __kernel_standard(x, y, 24); /* pow neg**non-int */ + return __kernel_standard(x, y, 21); /* pow overflow */ + } + } + if (z == 0.0 && isfinite(x) && isfinite(y)) + return __kernel_standard(x, y, 22); /* pow underflow */ + return z; +} #else - double attribute_hidden __ieee754_pow(x, y) - double x, y; +strong_alias(__ieee754_pow, pow) #endif - { - double z, ax, z_h, z_l, p_h, p_l; - double y1, t1, t2, r, s, t, u, v, w; - int32_t i, j, k, yisint, n; - int32_t hx, hy, ix, iy; - u_int32_t lx, ly; - - EXTRACT_WORDS(hx, lx, x); - EXTRACT_WORDS(hy, ly, y); - ix = hx & 0x7fffffff; - iy = hy & 0x7fffffff; - - /* y==zero: x**0 = 1 */ - if ((iy | ly) == 0) - return one; - - /* +-NaN return x+y */ - if (ix > 0x7ff00000 || ((ix == 0x7ff00000) && (lx != 0)) || - iy > 0x7ff00000 || ((iy == 0x7ff00000) && (ly != 0))) - return x + y; - - /* determine if y is an odd int when x < 0 - * yisint = 0 ... y is not an integer - * yisint = 1 ... y is an odd int - * yisint = 2 ... y is an even int - */ - yisint = 0; - if (hx < 0) { - if (iy >= 0x43400000) - yisint = 2; /* even integer y */ - else if (iy >= 0x3ff00000) { - k = (iy >> 20) - 0x3ff; /* exponent */ - if (k > 20) { - j = ly >> (52 - k); - if ((j << (52 - k)) == ly) - yisint = 2 - (j & 1); - } else if (ly == 0) { - j = iy >> (20 - k); - if ((j << (20 - k)) == iy) - yisint = 2 - (j & 1); - } - } - } - - /* special value of y */ - if (ly == 0) { - if (iy == 0x7ff00000) { /* y is +-inf */ - if (((ix - 0x3ff00000) | lx) == 0) - return y - y; /* inf**+-1 is NaN */ - else if (ix >= 0x3ff00000) /* (|x|>1)**+-inf = inf,0 */ - return (hy >= 0) ? y : zero; - else /* (|x|<1)**-,+inf = inf,0 */ - return (hy < 0) ? -y : zero; - } - if (iy == 0x3ff00000) { /* y is +-1 */ - if (hy < 0) - return one / x; - else - return x; - } - if (hy == 0x40000000) - return x * x; /* y is 2 */ - if (hy == 0x3fe00000) { /* y is 0.5 */ - if (hx >= 0) /* x >= +0 */ - return __ieee754_sqrt(x); - } - } - - ax = fabs(x); - /* special value of x */ - if (lx == 0) { - if (ix == 0x7ff00000 || ix == 0 || ix == 0x3ff00000) { - z = ax; /* x is +-0,+-inf,+-1 */ - if (hy < 0) - z = one / z; /* z = (1/|x|) */ - if (hx < 0) { - if (((ix - 0x3ff00000) | yisint) == 0) { - z = (z - z) / (z - z); /* (-1)**non-int is NaN */ - } else if (yisint == 1) - z = -z; /* (x<0)**odd = -(|x|**odd) */ - } - return z; - } - } - - /* (x<0)**(non-int) is NaN */ - if (((((u_int32_t) hx >> 31) - 1) | yisint) == 0) - return (x - x) / (x - x); - - /* |y| is huge */ - if (iy > 0x41e00000) { /* if |y| > 2**31 */ - if (iy > 0x43f00000) { /* if |y| > 2**64, must o/uflow */ - if (ix <= 0x3fefffff) - return (hy < 0) ? huge_val * huge_val : tiny * tiny; - if (ix >= 0x3ff00000) - return (hy > 0) ? huge_val * huge_val : tiny * tiny; - } - /* over/underflow if x is not close to one */ - if (ix < 0x3fefffff) - return (hy < 0) ? huge_val * huge_val : tiny * tiny; - if (ix > 0x3ff00000) - return (hy > 0) ? huge_val * huge_val : tiny * tiny; - /* now |1-x| is tiny <= 2**-20, suffice to compute - log(x) by x-x^2/2+x^3/3-x^4/4 */ - t = x - 1; /* t has 20 trailing zeros */ - w = (t * t) * (0.5 - t * (0.3333333333333333333333 - t * 0.25)); - u = ivln2_h * t; /* ivln2_h has 21 sig. bits */ - v = t * ivln2_l - w * ivln2; - t1 = u + v; - SET_LOW_WORD(t1, 0); - t2 = v - (t1 - u); - } else { - double s2, s_h, s_l, t_h, t_l; - n = 0; - /* take care subnormal number */ - if (ix < 0x00100000) { - ax *= two53; - n -= 53; - GET_HIGH_WORD(ix, ax); - } - n += ((ix) >> 20) - 0x3ff; - j = ix & 0x000fffff; - /* determine interval */ - ix = j | 0x3ff00000; /* normalize ix */ - if (j <= 0x3988E) - k = 0; /* |x|> 1) | 0x20000000) + 0x00080000 + (k << 18)); - t_l = ax - (t_h - bp[k]); - s_l = v * ((u - s_h * t_h) - s_h * t_l); - /* compute log(ax) */ - s2 = s * s; - r = s2 * s2 * (L1 + - s2 * (L2 + - s2 * (L3 + - s2 * (L4 + s2 * (L5 + s2 * L6))))); - r += s_l * (s_h + s); - s2 = s_h * s_h; - t_h = 3.0 + s2 + r; - SET_LOW_WORD(t_h, 0); - t_l = r - ((t_h - 3.0) - s2); - /* u+v = s*(1+...) */ - u = s_h * t_h; - v = s_l * t_h + t_l * s; - /* 2/(3log2)*(s+...) */ - p_h = u + v; - SET_LOW_WORD(p_h, 0); - p_l = v - (p_h - u); - z_h = cp_h * p_h; /* cp_h+cp_l = 2/(3*log2) */ - z_l = cp_l * p_h + p_l * cp + dp_l[k]; - /* log2(ax) = (s+..)*2/(3*log2) = n + dp_h + z_h + z_l */ - t = (double) n; - t1 = (((z_h + z_l) + dp_h[k]) + t); - SET_LOW_WORD(t1, 0); - t2 = z_l - (((t1 - t) - dp_h[k]) - z_h); - } - - s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ - if (((((u_int32_t) hx >> 31) - 1) | (yisint - 1)) == 0) - s = -one; /* (-ve)**(odd int) */ - - /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ - y1 = y; - SET_LOW_WORD(y1, 0); - p_l = (y - y1) * t1 + y * t2; - p_h = y1 * t1; - z = p_l + p_h; - EXTRACT_WORDS(j, i, z); - if (j >= 0x40900000) { /* z >= 1024 */ - if (((j - 0x40900000) | i) != 0) /* if z > 1024 */ - return s * huge_val * huge_val; /* overflow */ - else { - if (p_l + ovt > z - p_h) - return s * huge_val * huge_val; /* overflow */ - } - } else if ((j & 0x7fffffff) >= 0x4090cc00) { /* z <= -1075 */ - if (((j - 0xc090cc00) | i) != 0) /* z < -1075 */ - return s * tiny * tiny; /* underflow */ - else { - if (p_l <= z - p_h) - return s * tiny * tiny; /* underflow */ - } - } - /* - * compute 2**(p_h+p_l) - */ - i = j & 0x7fffffff; - k = (i >> 20) - 0x3ff; - n = 0; - if (i > 0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */ - n = j + (0x00100000 >> (k + 1)); - k = ((n & 0x7fffffff) >> 20) - 0x3ff; /* new k for n */ - t = zero; - SET_HIGH_WORD(t, n & ~(0x000fffff >> k)); - n = ((n & 0x000fffff) | 0x00100000) >> (20 - k); - if (j < 0) - n = -n; - p_h -= t; - } - t = p_l + p_h; - SET_LOW_WORD(t, 0); - u = t * lg2_h; - v = (p_l - (t - p_h)) * lg2 + t * lg2_l; - z = u + v; - w = v - (z - u); - t = z * z; - t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); - r = (z * t1) / (t1 - two) - (w + z * w); - z = one - (r - z); - GET_HIGH_WORD(j, z); - j += (n << 20); - if ((j >> 20) <= 0) - z = scalbn(z, n); /* subnormal output */ - else - SET_HIGH_WORD(z, j); - return s * z; - } +libm_hidden_def(pow) diff --git a/Engine/lib/sdl/src/libm/e_rem_pio2.c b/Engine/lib/sdl/src/libm/e_rem_pio2.c index a8ffe3142..df7c2b823 100644 --- a/Engine/lib/sdl/src/libm/e_rem_pio2.c +++ b/Engine/lib/sdl/src/libm/e_rem_pio2.c @@ -1,4 +1,3 @@ -/* @(#)e_rem_pio2.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: e_rem_pio2.c,v 1.8 1995/05/10 20:46:02 jtc Exp $"; -#endif - /* __ieee754_rem_pio2(x,y) * * return the remainder of x rem pi/2 in y[0]+y[1] @@ -24,40 +18,30 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -libm_hidden_proto(fabs) - /* * Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi */ -#ifdef __STDC__ - static const int32_t two_over_pi[] = { -#else - static int32_t two_over_pi[] = { -#endif - 0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, - 0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, - 0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, - 0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41, - 0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8, - 0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF, - 0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, - 0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, - 0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3, - 0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, - 0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B, - }; +static const int32_t two_over_pi[] = { +0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, +0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A, +0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, +0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41, +0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8, +0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF, +0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, +0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, +0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3, +0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, +0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B, +}; -#ifdef __STDC__ static const int32_t npio2_hw[] = { -#else -static int32_t npio2_hw[] = { -#endif - 0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C, - 0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C, - 0x40346B9C, 0x4035FDBB, 0x40378FDB, 0x403921FB, 0x403AB41B, 0x403C463A, - 0x403DD85A, 0x403F6A7A, 0x40407E4C, 0x4041475C, 0x4042106C, 0x4042D97C, - 0x4043A28C, 0x40446B9C, 0x404534AC, 0x4045FDBB, 0x4046C6CB, 0x40478FDB, - 0x404858EB, 0x404921FB, +0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C, +0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C, +0x40346B9C, 0x4035FDBB, 0x40378FDB, 0x403921FB, 0x403AB41B, 0x403C463A, +0x403DD85A, 0x403F6A7A, 0x40407E4C, 0x4041475C, 0x4042106C, 0x4042D97C, +0x4043A28C, 0x40446B9C, 0x404534AC, 0x4045FDBB, 0x4046C6CB, 0x40478FDB, +0x404858EB, 0x404921FB, }; /* @@ -70,132 +54,108 @@ static int32_t npio2_hw[] = { * pio2_3t: pi/2 - (pio2_1+pio2_2+pio2_3) */ -#ifdef __STDC__ static const double -#else -static double -#endif - zero = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ - half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ - two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ - invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ - pio2_1 = 1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */ - pio2_1t = 6.07710050650619224932e-11, /* 0x3DD0B461, 0x1A626331 */ - pio2_2 = 6.07710050630396597660e-11, /* 0x3DD0B461, 0x1A600000 */ - pio2_2t = 2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */ - pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ - pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ +zero = 0.00000000000000000000e+00, /* 0x00000000, 0x00000000 */ +half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ +two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ +invpio2 = 6.36619772367581382433e-01, /* 0x3FE45F30, 0x6DC9C883 */ +pio2_1 = 1.57079632673412561417e+00, /* 0x3FF921FB, 0x54400000 */ +pio2_1t = 6.07710050650619224932e-11, /* 0x3DD0B461, 0x1A626331 */ +pio2_2 = 6.07710050630396597660e-11, /* 0x3DD0B461, 0x1A600000 */ +pio2_2t = 2.02226624879595063154e-21, /* 0x3BA3198A, 0x2E037073 */ +pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ +pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ -#ifdef __STDC__ -int32_t attribute_hidden -__ieee754_rem_pio2(double x, double *y) -#else -int32_t attribute_hidden -__ieee754_rem_pio2(x, y) - double x, y[]; -#endif +int32_t attribute_hidden __ieee754_rem_pio2(double x, double *y) { - double z = 0.0, w, t, r, fn; - double tx[3]; - int32_t e0, i, j, nx, n, ix, hx; - u_int32_t low; + double z=0.0,w,t,r,fn; + double tx[3]; + int32_t e0,i,j,nx,n,ix,hx; + u_int32_t low; - GET_HIGH_WORD(hx, x); /* high word of x */ - ix = hx & 0x7fffffff; - if (ix <= 0x3fe921fb) { /* |x| ~<= pi/4 , no need for reduction */ - y[0] = x; - y[1] = 0; - return 0; - } - if (ix < 0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */ - if (hx > 0) { - z = x - pio2_1; - if (ix != 0x3ff921fb) { /* 33+53 bit pi is good enough */ - y[0] = z - pio2_1t; - y[1] = (z - y[0]) - pio2_1t; - } else { /* near pi/2, use 33+33+53 bit pi */ - z -= pio2_2; - y[0] = z - pio2_2t; - y[1] = (z - y[0]) - pio2_2t; - } - return 1; - } else { /* negative x */ - z = x + pio2_1; - if (ix != 0x3ff921fb) { /* 33+53 bit pi is good enough */ - y[0] = z + pio2_1t; - y[1] = (z - y[0]) + pio2_1t; - } else { /* near pi/2, use 33+33+53 bit pi */ - z += pio2_2; - y[0] = z + pio2_2t; - y[1] = (z - y[0]) + pio2_2t; - } - return -1; - } - } - if (ix <= 0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */ - t = fabs(x); - n = (int32_t) (t * invpio2 + half); - fn = (double) n; - r = t - fn * pio2_1; - w = fn * pio2_1t; /* 1st round good to 85 bit */ - if (n < 32 && ix != npio2_hw[n - 1]) { - y[0] = r - w; /* quick check no cancellation */ - } else { - u_int32_t high; - j = ix >> 20; - y[0] = r - w; - GET_HIGH_WORD(high, y[0]); - i = j - ((high >> 20) & 0x7ff); - if (i > 16) { /* 2nd iteration needed, good to 118 */ - t = r; - w = fn * pio2_2; - r = t - w; - w = fn * pio2_2t - ((t - r) - w); - y[0] = r - w; - GET_HIGH_WORD(high, y[0]); - i = j - ((high >> 20) & 0x7ff); - if (i > 49) { /* 3rd iteration need, 151 bits acc */ - t = r; /* will cover all possible cases */ - w = fn * pio2_3; - r = t - w; - w = fn * pio2_3t - ((t - r) - w); - y[0] = r - w; - } - } - } - y[1] = (r - y[0]) - w; - if (hx < 0) { - y[0] = -y[0]; - y[1] = -y[1]; - return -n; - } else - return n; - } + GET_HIGH_WORD(hx,x); /* high word of x */ + ix = hx&0x7fffffff; + if(ix<=0x3fe921fb) /* |x| ~<= pi/4 , no need for reduction */ + {y[0] = x; y[1] = 0; return 0;} + if(ix<0x4002d97c) { /* |x| < 3pi/4, special case with n=+-1 */ + if(hx>0) { + z = x - pio2_1; + if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */ + y[0] = z - pio2_1t; + y[1] = (z-y[0])-pio2_1t; + } else { /* near pi/2, use 33+33+53 bit pi */ + z -= pio2_2; + y[0] = z - pio2_2t; + y[1] = (z-y[0])-pio2_2t; + } + return 1; + } else { /* negative x */ + z = x + pio2_1; + if(ix!=0x3ff921fb) { /* 33+53 bit pi is good enough */ + y[0] = z + pio2_1t; + y[1] = (z-y[0])+pio2_1t; + } else { /* near pi/2, use 33+33+53 bit pi */ + z += pio2_2; + y[0] = z + pio2_2t; + y[1] = (z-y[0])+pio2_2t; + } + return -1; + } + } + if(ix<=0x413921fb) { /* |x| ~<= 2^19*(pi/2), medium size */ + t = fabs(x); + n = (int32_t) (t*invpio2+half); + fn = (double)n; + r = t-fn*pio2_1; + w = fn*pio2_1t; /* 1st round good to 85 bit */ + if(n<32&&ix!=npio2_hw[n-1]) { + y[0] = r-w; /* quick check no cancellation */ + } else { + u_int32_t high; + j = ix>>20; + y[0] = r-w; + GET_HIGH_WORD(high,y[0]); + i = j-((high>>20)&0x7ff); + if(i>16) { /* 2nd iteration needed, good to 118 */ + t = r; + w = fn*pio2_2; + r = t-w; + w = fn*pio2_2t-((t-r)-w); + y[0] = r-w; + GET_HIGH_WORD(high,y[0]); + i = j-((high>>20)&0x7ff); + if(i>49) { /* 3rd iteration need, 151 bits acc */ + t = r; /* will cover all possible cases */ + w = fn*pio2_3; + r = t-w; + w = fn*pio2_3t-((t-r)-w); + y[0] = r-w; + } + } + } + y[1] = (r-y[0])-w; + if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} + else return n; + } /* * all other (large) arguments */ - if (ix >= 0x7ff00000) { /* x is inf or NaN */ - y[0] = y[1] = x - x; - return 0; - } + if(ix>=0x7ff00000) { /* x is inf or NaN */ + y[0]=y[1]=x-x; return 0; + } /* set z = scalbn(|x|,ilogb(x)-23) */ - GET_LOW_WORD(low, x); - SET_LOW_WORD(z, low); - e0 = (ix >> 20) - 1046; /* e0 = ilogb(z)-23; */ - SET_HIGH_WORD(z, ix - ((int32_t) (e0 << 20))); - for (i = 0; i < 2; i++) { - tx[i] = (double) ((int32_t) (z)); - z = (z - tx[i]) * two24; - } - tx[2] = z; - nx = 3; - while (tx[nx - 1] == zero) - nx--; /* skip zero term */ - n = __kernel_rem_pio2(tx, y, e0, nx, 2, two_over_pi); - if (hx < 0) { - y[0] = -y[0]; - y[1] = -y[1]; - return -n; - } - return n; + GET_LOW_WORD(low,x); + SET_LOW_WORD(z,low); + e0 = (ix>>20)-1046; /* e0 = ilogb(z)-23; */ + SET_HIGH_WORD(z, ix - ((int32_t)(e0<<20))); + for(i=0;i<2;i++) { + tx[i] = (double)((int32_t)(z)); + z = (z-tx[i])*two24; + } + tx[2] = z; + nx = 3; + while(tx[nx-1]==zero) nx--; /* skip zero term */ + n = __kernel_rem_pio2(tx,y,e0,nx,2,two_over_pi); + if(hx<0) {y[0] = -y[0]; y[1] = -y[1]; return -n;} + return n; } diff --git a/Engine/lib/sdl/src/libm/e_sqrt.c b/Engine/lib/sdl/src/libm/e_sqrt.c index b8b8bec6f..39c83e1f3 100644 --- a/Engine/lib/sdl/src/libm/e_sqrt.c +++ b/Engine/lib/sdl/src/libm/e_sqrt.c @@ -1,4 +1,3 @@ -/* @(#)e_sqrt.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: e_sqrt.c,v 1.8 1995/05/10 20:46:17 jtc Exp $"; -#endif - /* __ieee754_sqrt(x) * Return correctly rounded sqrt. * ------------------------------------------ @@ -88,124 +82,123 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -#ifdef __STDC__ static const double one = 1.0, tiny = 1.0e-300; -#else -static double one = 1.0, tiny = 1.0e-300; -#endif -#ifdef __STDC__ -double attribute_hidden -__ieee754_sqrt(double x) -#else -double attribute_hidden -__ieee754_sqrt(x) - double x; -#endif +double attribute_hidden __ieee754_sqrt(double x) { - double z; - int32_t sign = (int) 0x80000000; - int32_t ix0, s0, q, m, t, i; - u_int32_t r, t1, s1, ix1, q1; + double z; + int32_t sign = (int)0x80000000; + int32_t ix0,s0,q,m,t,i; + u_int32_t r,t1,s1,ix1,q1; - EXTRACT_WORDS(ix0, ix1, x); + EXTRACT_WORDS(ix0,ix1,x); /* take care of Inf and NaN */ - if ((ix0 & 0x7ff00000) == 0x7ff00000) { - return x * x + x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf - sqrt(-inf)=sNaN */ - } + if((ix0&0x7ff00000)==0x7ff00000) { + return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf + sqrt(-inf)=sNaN */ + } /* take care of zero */ - if (ix0 <= 0) { - if (((ix0 & (~sign)) | ix1) == 0) - return x; /* sqrt(+-0) = +-0 */ - else if (ix0 < 0) - return (x - x) / (x - x); /* sqrt(-ve) = sNaN */ - } + if(ix0<=0) { + if(((ix0&(~sign))|ix1)==0) return x;/* sqrt(+-0) = +-0 */ + else if(ix0<0) + return (x-x)/(x-x); /* sqrt(-ve) = sNaN */ + } /* normalize x */ - m = (ix0 >> 20); - if (m == 0) { /* subnormal x */ - while (ix0 == 0) { - m -= 21; - ix0 |= (ix1 >> 11); - ix1 <<= 21; - } - for (i = 0; (ix0 & 0x00100000) == 0; i++) - ix0 <<= 1; - m -= i - 1; - ix0 |= (ix1 >> (32 - i)); - ix1 <<= i; - } - m -= 1023; /* unbias exponent */ - ix0 = (ix0 & 0x000fffff) | 0x00100000; - if (m & 1) { /* odd m, double x to make it even */ - ix0 += ix0 + ((ix1 & sign) >> 31); - ix1 += ix1; - } - m >>= 1; /* m = [m/2] */ + m = (ix0>>20); + if(m==0) { /* subnormal x */ + while(ix0==0) { + m -= 21; + ix0 |= (ix1>>11); ix1 <<= 21; + } + for(i=0;(ix0&0x00100000)==0;i++) ix0<<=1; + m -= i-1; + ix0 |= (ix1>>(32-i)); + ix1 <<= i; + } + m -= 1023; /* unbias exponent */ + ix0 = (ix0&0x000fffff)|0x00100000; + if(m&1){ /* odd m, double x to make it even */ + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + } + m >>= 1; /* m = [m/2] */ /* generate sqrt(x) bit by bit */ - ix0 += ix0 + ((ix1 & sign) >> 31); - ix1 += ix1; - q = q1 = s0 = s1 = 0; /* [q,q1] = sqrt(x) */ - r = 0x00200000; /* r = moving bit from right to left */ + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + q = q1 = s0 = s1 = 0; /* [q,q1] = sqrt(x) */ + r = 0x00200000; /* r = moving bit from right to left */ - while (r != 0) { - t = s0 + r; - if (t <= ix0) { - s0 = t + r; - ix0 -= t; - q += r; - } - ix0 += ix0 + ((ix1 & sign) >> 31); - ix1 += ix1; - r >>= 1; - } + while(r!=0) { + t = s0+r; + if(t<=ix0) { + s0 = t+r; + ix0 -= t; + q += r; + } + ix0 += ix0 + ((ix1&sign)>>31); + ix1 += ix1; + r>>=1; + } - r = sign; - while (r != 0) { - t1 = s1 + r; - t = s0; - if ((t < ix0) || ((t == ix0) && (t1 <= ix1))) { - s1 = t1 + r; - if (((t1 & sign) == sign) && (s1 & sign) == 0) - s0 += 1; - ix0 -= t; - if (ix1 < t1) - ix0 -= 1; - ix1 -= t1; - q1 += r; - } - ix0 += ix0 + ((ix1 & sign) >> 31); - ix1 += ix1; - r >>= 1; - } + r = sign; + while(r!=0) { + t1 = s1+r; + t = s0; + if((t>31); + ix1 += ix1; + r>>=1; + } /* use floating add to find out rounding direction */ - if ((ix0 | ix1) != 0) { - z = one - tiny; /* trigger inexact flag */ - if (z >= one) { - z = one + tiny; - if (q1 == (u_int32_t) 0xffffffff) { - q1 = 0; - q += 1; - } else if (z > one) { - if (q1 == (u_int32_t) 0xfffffffe) - q += 1; - q1 += 2; - } else - q1 += (q1 & 1); - } - } - ix0 = (q >> 1) + 0x3fe00000; - ix1 = q1 >> 1; - if ((q & 1) == 1) - ix1 |= sign; - ix0 += (m << 20); - INSERT_WORDS(z, ix0, ix1); - return z; + if((ix0|ix1)!=0) { + z = one-tiny; /* trigger inexact flag */ + if (z>=one) { + z = one+tiny; + if (q1==(u_int32_t)0xffffffff) { q1=0; q += 1;} + else if (z>one) { + if (q1==(u_int32_t)0xfffffffe) q+=1; + q1+=2; + } else + q1 += (q1&1); + } + } + ix0 = (q>>1)+0x3fe00000; + ix1 = q1>>1; + if ((q&1)==1) ix1 |= sign; + ix0 += (m <<20); + INSERT_WORDS(z,ix0,ix1); + return z; } +/* + * wrapper sqrt(x) + */ +#ifndef _IEEE_LIBM +double sqrt(double x) +{ + double z = __ieee754_sqrt(x); + if (_LIB_VERSION == _IEEE_ || isnan(x)) + return z; + if (x < 0.0) + return __kernel_standard(x, x, 26); /* sqrt(negative) */ + return z; +} +#else +strong_alias(__ieee754_sqrt, sqrt) +#endif +libm_hidden_def(sqrt) + + /* Other methods (use floating-point arithmetic) ------------- diff --git a/Engine/lib/sdl/src/libm/k_cos.c b/Engine/lib/sdl/src/libm/k_cos.c index 64c50e3fb..e1326fa64 100644 --- a/Engine/lib/sdl/src/libm/k_cos.c +++ b/Engine/lib/sdl/src/libm/k_cos.c @@ -1,4 +1,3 @@ -/* @(#)k_cos.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: k_cos.c,v 1.8 1995/05/10 20:46:22 jtc Exp $"; -#endif - /* * __kernel_cos( x, y ) * kernel cos function on [-pi/4, pi/4], pi/4 ~ 0.785398164 @@ -53,48 +47,36 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -#ifdef __STDC__ static const double -#else -static double -#endif - one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ - C1 = 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C */ - C2 = -1.38888888888741095749e-03, /* 0xBF56C16C, 0x16C15177 */ - C3 = 2.48015872894767294178e-05, /* 0x3EFA01A0, 0x19CB1590 */ - C4 = -2.75573143513906633035e-07, /* 0xBE927E4F, 0x809C52AD */ - C5 = 2.08757232129817482790e-09, /* 0x3E21EE9E, 0xBDB4B1C4 */ - C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */ +one = 1.00000000000000000000e+00, /* 0x3FF00000, 0x00000000 */ +C1 = 4.16666666666666019037e-02, /* 0x3FA55555, 0x5555554C */ +C2 = -1.38888888888741095749e-03, /* 0xBF56C16C, 0x16C15177 */ +C3 = 2.48015872894767294178e-05, /* 0x3EFA01A0, 0x19CB1590 */ +C4 = -2.75573143513906633035e-07, /* 0xBE927E4F, 0x809C52AD */ +C5 = 2.08757232129817482790e-09, /* 0x3E21EE9E, 0xBDB4B1C4 */ +C6 = -1.13596475577881948265e-11; /* 0xBDA8FAE9, 0xBE8838D4 */ -#ifdef __STDC__ -double attribute_hidden -__kernel_cos(double x, double y) -#else -double attribute_hidden -__kernel_cos(x, y) - double x, y; -#endif +double attribute_hidden __kernel_cos(double x, double y) { - double a, hz, z, r, qx; - int32_t ix; - GET_HIGH_WORD(ix, x); - ix &= 0x7fffffff; /* ix = |x|'s high word */ - if (ix < 0x3e400000) { /* if x < 2**27 */ - if (((int) x) == 0) - return one; /* generate inexact */ - } - z = x * x; - r = z * (C1 + z * (C2 + z * (C3 + z * (C4 + z * (C5 + z * C6))))); - if (ix < 0x3FD33333) /* if |x| < 0.3 */ - return one - (0.5 * z - (z * r - x * y)); - else { - if (ix > 0x3fe90000) { /* x > 0.78125 */ - qx = 0.28125; - } else { - INSERT_WORDS(qx, ix - 0x00200000, 0); /* x/4 */ - } - hz = 0.5 * z - qx; - a = one - qx; - return a - (hz - (z * r - x * y)); - } + double a,hz,z,r,qx; + int32_t ix; + GET_HIGH_WORD(ix,x); + ix &= 0x7fffffff; /* ix = |x|'s high word*/ + if(ix<0x3e400000) { /* if x < 2**27 */ + if(((int)x)==0) return one; /* generate inexact */ + } + z = x*x; + r = z*(C1+z*(C2+z*(C3+z*(C4+z*(C5+z*C6))))); + if(ix < 0x3FD33333) /* if |x| < 0.3 */ + return one - (0.5*z - (z*r - x*y)); + else { + if(ix > 0x3fe90000) { /* x > 0.78125 */ + qx = 0.28125; + } else { + INSERT_WORDS(qx,ix-0x00200000,0); /* x/4 */ + } + hz = 0.5*z-qx; + a = one-qx; + return a - (hz - (z*r-x*y)); + } } diff --git a/Engine/lib/sdl/src/libm/k_rem_pio2.c b/Engine/lib/sdl/src/libm/k_rem_pio2.c index 23c2b61dd..7b04275c6 100644 --- a/Engine/lib/sdl/src/libm/k_rem_pio2.c +++ b/Engine/lib/sdl/src/libm/k_rem_pio2.c @@ -1,4 +1,3 @@ -/* @(#)k_rem_pio2.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: k_rem_pio2.c,v 1.7 1995/05/10 20:46:25 jtc Exp $"; -#endif - /* * __kernel_rem_pio2(x,y,e0,nx,prec,ipio2) * double x[],y[]; int e0,nx,prec; int ipio2[]; @@ -134,230 +128,172 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -#include "SDL_assert.h" +static const int init_jk[] = {2,3,4,6}; /* initial value for jk */ -libm_hidden_proto(scalbn) - libm_hidden_proto(floor) -#ifdef __STDC__ - static const int init_jk[] = { 2, 3, 4, 6 }; /* initial value for jk */ -#else - static int init_jk[] = { 2, 3, 4, 6 }; -#endif - -#ifdef __STDC__ static const double PIo2[] = { -#else -static double PIo2[] = { -#endif - 1.57079625129699707031e+00, /* 0x3FF921FB, 0x40000000 */ - 7.54978941586159635335e-08, /* 0x3E74442D, 0x00000000 */ - 5.39030252995776476554e-15, /* 0x3CF84698, 0x80000000 */ - 3.28200341580791294123e-22, /* 0x3B78CC51, 0x60000000 */ - 1.27065575308067607349e-29, /* 0x39F01B83, 0x80000000 */ - 1.22933308981111328932e-36, /* 0x387A2520, 0x40000000 */ - 2.73370053816464559624e-44, /* 0x36E38222, 0x80000000 */ - 2.16741683877804819444e-51, /* 0x3569F31D, 0x00000000 */ + 1.57079625129699707031e+00, /* 0x3FF921FB, 0x40000000 */ + 7.54978941586159635335e-08, /* 0x3E74442D, 0x00000000 */ + 5.39030252995776476554e-15, /* 0x3CF84698, 0x80000000 */ + 3.28200341580791294123e-22, /* 0x3B78CC51, 0x60000000 */ + 1.27065575308067607349e-29, /* 0x39F01B83, 0x80000000 */ + 1.22933308981111328932e-36, /* 0x387A2520, 0x40000000 */ + 2.73370053816464559624e-44, /* 0x36E38222, 0x80000000 */ + 2.16741683877804819444e-51, /* 0x3569F31D, 0x00000000 */ }; -#ifdef __STDC__ static const double -#else -static double -#endif - zero = 0.0, one = 1.0, two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ - twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */ +zero = 0.0, +one = 1.0, +two24 = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ +twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */ -#ifdef __STDC__ -int attribute_hidden -__kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, - const int32_t * ipio2) -#else -int attribute_hidden -__kernel_rem_pio2(x, y, e0, nx, prec, ipio2) - double x[], y[]; - int e0, nx, prec; - int32_t ipio2[]; -#endif +int attribute_hidden __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int32_t *ipio2) { - int32_t jz, jx, jv, jp, jk, carry, n, iq[20], i, j, k, m, q0, ih; - double z, fw, f[20], fq[20], q[20]; + int32_t jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; + double z,fw,f[20],fq[20],q[20]; - /* initialize jk */ - SDL_assert((prec >= 0) && (prec < SDL_arraysize(init_jk))); - jk = init_jk[prec]; - SDL_assert((jk >= 2) && (jk <= 6)); - jp = jk; + /* initialize jk*/ + jk = init_jk[prec]; + jp = jk; /* determine jx,jv,q0, note that 3>q0 */ - SDL_assert(nx > 0); - jx = nx - 1; - jv = (e0 - 3) / 24; - if (jv < 0) - jv = 0; - q0 = e0 - 24 * (jv + 1); + jx = nx-1; + jv = (e0-3)/24; if(jv<0) jv=0; + q0 = e0-24*(jv+1); /* set up f[0] to f[jx+jk] where f[jx+jk] = ipio2[jv+jk] */ - j = jv - jx; - m = jx + jk; - for (i = 0; i <= m; i++, j++) - f[i] = (j < 0) ? zero : (double) ipio2[j]; + j = jv-jx; m = jx+jk; + for(i=0;i<=m;i++,j++) f[i] = (j<0)? zero : (double) ipio2[j]; /* compute q[0],q[1],...q[jk] */ - for (i = 0; i <= jk; i++) { - for (j = 0, fw = 0.0; j <= jx; j++) - fw += x[j] * f[jx + i - j]; - q[i] = fw; - } + for (i=0;i<=jk;i++) { + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; + q[i] = fw; + } - jz = jk; - recompute: + jz = jk; +recompute: /* distill q[] into iq[] reversingly */ - for (i = 0, j = jz, z = q[jz]; j > 0; i++, j--) { - fw = (double) ((int32_t) (twon24 * z)); - iq[i] = (int32_t) (z - two24 * fw); - z = q[j - 1] + fw; - } + for(i=0,j=jz,z=q[jz];j>0;i++,j--) { + fw = (double)((int32_t)(twon24* z)); + iq[i] = (int32_t)(z-two24*fw); + z = q[j-1]+fw; + } /* compute n */ - z = scalbn(z, q0); /* actual value of z */ - z -= 8.0 * floor(z * 0.125); /* trim off integer >= 8 */ - n = (int32_t) z; - z -= (double) n; - ih = 0; - if (q0 > 0) { /* need iq[jz-1] to determine n */ - i = (iq[jz - 1] >> (24 - q0)); - n += i; - iq[jz - 1] -= i << (24 - q0); - ih = iq[jz - 1] >> (23 - q0); - } else if (q0 == 0) - ih = iq[jz - 1] >> 23; - else if (z >= 0.5) - ih = 2; + z = scalbn(z,q0); /* actual value of z */ + z -= 8.0*floor(z*0.125); /* trim off integer >= 8 */ + n = (int32_t) z; + z -= (double)n; + ih = 0; + if(q0>0) { /* need iq[jz-1] to determine n */ + i = (iq[jz-1]>>(24-q0)); n += i; + iq[jz-1] -= i<<(24-q0); + ih = iq[jz-1]>>(23-q0); + } + else if(q0==0) ih = iq[jz-1]>>23; + else if(z>=0.5) ih=2; - if (ih > 0) { /* q > 0.5 */ - n += 1; - carry = 0; - for (i = 0; i < jz; i++) { /* compute 1-q */ - j = iq[i]; - if (carry == 0) { - if (j != 0) { - carry = 1; - iq[i] = 0x1000000 - j; - } - } else - iq[i] = 0xffffff - j; - } - if (q0 > 0) { /* rare case: chance is 1 in 12 */ - switch (q0) { - case 1: - iq[jz - 1] &= 0x7fffff; - break; - case 2: - iq[jz - 1] &= 0x3fffff; - break; - } - } - if (ih == 2) { - z = one - z; - if (carry != 0) - z -= scalbn(one, q0); - } - } + if(ih>0) { /* q > 0.5 */ + n += 1; carry = 0; + for(i=0;i0) { /* rare case: chance is 1 in 12 */ + switch(q0) { + case 1: + iq[jz-1] &= 0x7fffff; break; + case 2: + iq[jz-1] &= 0x3fffff; break; + } + } + if(ih==2) { + z = one - z; + if(carry!=0) z -= scalbn(one,q0); + } + } /* check if recomputation is needed */ - if (z == zero) { - j = 0; - for (i = jz - 1; i >= jk; i--) - j |= iq[i]; - if (j == 0) { /* need recomputation */ - for (k = 1; iq[jk - k] == 0; k++); /* k = no. of terms needed */ + if(z==zero) { + j = 0; + for (i=jz-1;i>=jk;i--) j |= iq[i]; + if(j==0) { /* need recomputation */ + for(k=1;iq[jk-k]==0;k++); /* k = no. of terms needed */ - for (i = jz + 1; i <= jz + k; i++) { /* add q[jz+1] to q[jz+k] */ - f[jx + i] = (double) ipio2[jv + i]; - for (j = 0, fw = 0.0; j <= jx; j++) - fw += x[j] * f[jx + i - j]; - q[i] = fw; - } - jz += k; - goto recompute; - } - } + for(i=jz+1;i<=jz+k;i++) { /* add q[jz+1] to q[jz+k] */ + f[jx+i] = (double) ipio2[jv+i]; + for(j=0,fw=0.0;j<=jx;j++) fw += x[j]*f[jx+i-j]; + q[i] = fw; + } + jz += k; + goto recompute; + } + } /* chop off zero terms */ - if (z == 0.0) { - jz -= 1; - q0 -= 24; - while (iq[jz] == 0) { - jz--; - q0 -= 24; - } - } else { /* break z into 24-bit if necessary */ - z = scalbn(z, -q0); - if (z >= two24) { - fw = (double) ((int32_t) (twon24 * z)); - iq[jz] = (int32_t) (z - two24 * fw); - jz += 1; - q0 += 24; - iq[jz] = (int32_t) fw; - } else - iq[jz] = (int32_t) z; - } + if(z==0.0) { + jz -= 1; q0 -= 24; + while(iq[jz]==0) { jz--; q0-=24;} + } else { /* break z into 24-bit if necessary */ + z = scalbn(z,-q0); + if(z>=two24) { + fw = (double)((int32_t)(twon24*z)); + iq[jz] = (int32_t)(z-two24*fw); + jz += 1; q0 += 24; + iq[jz] = (int32_t) fw; + } else iq[jz] = (int32_t) z ; + } /* convert integer "bit" chunk to floating-point value */ - fw = scalbn(one, q0); - for (i = jz; i >= 0; i--) { - q[i] = fw * (double) iq[i]; - fw *= twon24; - } + fw = scalbn(one,q0); + for(i=jz;i>=0;i--) { + q[i] = fw*(double)iq[i]; fw*=twon24; + } /* compute PIo2[0,...,jp]*q[jz,...,0] */ - for (i = jz; i >= 0; i--) { - for (fw = 0.0, k = 0; k <= jp && k <= jz - i; k++) - fw += PIo2[k] * q[i + k]; - fq[jz - i] = fw; - } + for(i=jz;i>=0;i--) { + for(fw=0.0,k=0;k<=jp&&k<=jz-i;k++) fw += PIo2[k]*q[i+k]; + fq[jz-i] = fw; + } /* compress fq[] into y[] */ - switch (prec) { - case 0: - fw = 0.0; - for (i = jz; i >= 0; i--) - fw += fq[i]; - y[0] = (ih == 0) ? fw : -fw; - break; - case 1: - case 2: - fw = 0.0; - for (i = jz; i >= 0; i--) - fw += fq[i]; - y[0] = (ih == 0) ? fw : -fw; - fw = fq[0] - fw; - for (i = 1; i <= jz; i++) - fw += fq[i]; - y[1] = (ih == 0) ? fw : -fw; - break; - case 3: /* painful */ - for (i = jz; i > 0; i--) { - fw = fq[i - 1] + fq[i]; - fq[i] += fq[i - 1] - fw; - fq[i - 1] = fw; - } - for (i = jz; i > 1; i--) { - fw = fq[i - 1] + fq[i]; - fq[i] += fq[i - 1] - fw; - fq[i - 1] = fw; - } - for (fw = 0.0, i = jz; i >= 2; i--) - fw += fq[i]; - if (ih == 0) { - y[0] = fq[0]; - y[1] = fq[1]; - y[2] = fw; - } else { - y[0] = -fq[0]; - y[1] = -fq[1]; - y[2] = -fw; - } - } - return n & 7; + switch(prec) { + case 0: + fw = 0.0; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; + break; + case 1: + case 2: + fw = 0.0; + for (i=jz;i>=0;i--) fw += fq[i]; + y[0] = (ih==0)? fw: -fw; + fw = fq[0]-fw; + for (i=1;i<=jz;i++) fw += fq[i]; + y[1] = (ih==0)? fw: -fw; + break; + case 3: /* painful */ + for (i=jz;i>0;i--) { + fw = fq[i-1]+fq[i]; + fq[i] += fq[i-1]-fw; + fq[i-1] = fw; + } + for (i=jz;i>1;i--) { + fw = fq[i-1]+fq[i]; + fq[i] += fq[i-1]-fw; + fq[i-1] = fw; + } + for (fw=0.0,i=jz;i>=2;i--) fw += fq[i]; + if(ih==0) { + y[0] = fq[0]; y[1] = fq[1]; y[2] = fw; + } else { + y[0] = -fq[0]; y[1] = -fq[1]; y[2] = -fw; + } + } + return n&7; } diff --git a/Engine/lib/sdl/src/libm/k_sin.c b/Engine/lib/sdl/src/libm/k_sin.c index 60881575a..3520d6b4c 100644 --- a/Engine/lib/sdl/src/libm/k_sin.c +++ b/Engine/lib/sdl/src/libm/k_sin.c @@ -1,4 +1,3 @@ -/* @(#)k_sin.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: k_sin.c,v 1.8 1995/05/10 20:46:31 jtc Exp $"; -#endif - /* __kernel_sin( x, y, iy) * kernel sin function on [-pi/4, pi/4], pi/4 ~ 0.7854 * Input x is assumed to be bounded by ~pi/4 in magnitude. @@ -46,42 +40,26 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -#ifdef __STDC__ static const double -#else -static double -#endif - half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ - S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */ - S2 = 8.33333333332248946124e-03, /* 0x3F811111, 0x1110F8A6 */ - S3 = -1.98412698298579493134e-04, /* 0xBF2A01A0, 0x19C161D5 */ - S4 = 2.75573137070700676789e-06, /* 0x3EC71DE3, 0x57B1FE7D */ - S5 = -2.50507602534068634195e-08, /* 0xBE5AE5E6, 0x8A2B9CEB */ - S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */ +half = 5.00000000000000000000e-01, /* 0x3FE00000, 0x00000000 */ +S1 = -1.66666666666666324348e-01, /* 0xBFC55555, 0x55555549 */ +S2 = 8.33333333332248946124e-03, /* 0x3F811111, 0x1110F8A6 */ +S3 = -1.98412698298579493134e-04, /* 0xBF2A01A0, 0x19C161D5 */ +S4 = 2.75573137070700676789e-06, /* 0x3EC71DE3, 0x57B1FE7D */ +S5 = -2.50507602534068634195e-08, /* 0xBE5AE5E6, 0x8A2B9CEB */ +S6 = 1.58969099521155010221e-10; /* 0x3DE5D93A, 0x5ACFD57C */ -#ifdef __STDC__ -double attribute_hidden -__kernel_sin(double x, double y, int iy) -#else -double attribute_hidden -__kernel_sin(x, y, iy) - double x, y; - int iy; /* iy=0 if y is zero */ -#endif +double attribute_hidden __kernel_sin(double x, double y, int iy) { - double z, r, v; - int32_t ix; - GET_HIGH_WORD(ix, x); - ix &= 0x7fffffff; /* high word of x */ - if (ix < 0x3e400000) { /* |x| < 2**-27 */ - if ((int) x == 0) - return x; - } /* generate inexact */ - z = x * x; - v = z * x; - r = S2 + z * (S3 + z * (S4 + z * (S5 + z * S6))); - if (iy == 0) - return x + v * (S1 + z * r); - else - return x - ((z * (half * y - v * r) - y) - v * S1); + double z,r,v; + int32_t ix; + GET_HIGH_WORD(ix,x); + ix &= 0x7fffffff; /* high word of x */ + if(ix<0x3e400000) /* |x| < 2**-27 */ + {if((int)x==0) return x;} /* generate inexact */ + z = x*x; + v = z*x; + r = S2+z*(S3+z*(S4+z*(S5+z*S6))); + if(iy==0) return x+v*(S1+z*r); + else return x-((z*(half*y-v*r)-y)-v*S1); } diff --git a/Engine/lib/sdl/src/libm/k_tan.c b/Engine/lib/sdl/src/libm/k_tan.c index 27e6639b0..47b4e3dcd 100644 --- a/Engine/lib/sdl/src/libm/k_tan.c +++ b/Engine/lib/sdl/src/libm/k_tan.c @@ -66,7 +66,7 @@ T[] = { 2.59073051863633712884e-05, /* 0x3EFB2A70, 0x74BF7AD4 */ }; -double __kernel_tan(double x, double y, int iy) +double attribute_hidden __kernel_tan(double x, double y, int iy) { double z,r,v,w,s; int32_t ix,hx; diff --git a/Engine/lib/sdl/src/libm/math_libm.h b/Engine/lib/sdl/src/libm/math_libm.h index 3fe1727a3..eb7bdd597 100644 --- a/Engine/lib/sdl/src/libm/math_libm.h +++ b/Engine/lib/sdl/src/libm/math_libm.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,9 @@ double SDL_uclibc_copysign(double x, double y); double SDL_uclibc_cos(double x); double SDL_uclibc_fabs(double x); double SDL_uclibc_floor(double x); +double SDL_uclibc_fmod(double x, double y); double SDL_uclibc_log(double x); +double SDL_uclibc_log10(double x); double SDL_uclibc_pow(double x, double y); double SDL_uclibc_scalbn(double x, int n); double SDL_uclibc_sin(double x); diff --git a/Engine/lib/sdl/src/libm/math_private.h b/Engine/lib/sdl/src/libm/math_private.h index 74c8b3d45..1c0c8a4e9 100644 --- a/Engine/lib/sdl/src/libm/math_private.h +++ b/Engine/lib/sdl/src/libm/math_private.h @@ -21,9 +21,11 @@ #include "SDL_endian.h" /* #include */ +#define _IEEE_LIBM #define attribute_hidden #define libm_hidden_proto(x) #define libm_hidden_def(x) +#define strong_alias(x, y) #ifndef __HAIKU__ /* already defined in a system header. */ typedef unsigned int u_int32_t; @@ -35,8 +37,11 @@ typedef unsigned int u_int32_t; #define cos SDL_uclibc_cos #define fabs SDL_uclibc_fabs #define floor SDL_uclibc_floor +#define __ieee754_fmod SDL_uclibc_fmod #define __ieee754_log SDL_uclibc_log +#define __ieee754_log10 SDL_uclibc_log10 #define __ieee754_pow SDL_uclibc_pow +#define scalbln SDL_uclibc_scalbln #define scalbn SDL_uclibc_scalbn #define sin SDL_uclibc_sin #define __ieee754_sqrt SDL_uclibc_sqrt diff --git a/Engine/lib/sdl/src/libm/s_atan.c b/Engine/lib/sdl/src/libm/s_atan.c index 970ea4dbf..f664f0eb3 100644 --- a/Engine/lib/sdl/src/libm/s_atan.c +++ b/Engine/lib/sdl/src/libm/s_atan.c @@ -112,4 +112,3 @@ double atan(double x) } } libm_hidden_def(atan) - diff --git a/Engine/lib/sdl/src/libm/s_copysign.c b/Engine/lib/sdl/src/libm/s_copysign.c index afd43e9a7..a2f275bf7 100644 --- a/Engine/lib/sdl/src/libm/s_copysign.c +++ b/Engine/lib/sdl/src/libm/s_copysign.c @@ -1,4 +1,3 @@ -/* @(#)s_copysign.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: s_copysign.c,v 1.8 1995/05/10 20:46:57 jtc Exp $"; -#endif - /* * copysign(double x, double y) * copysign(x,y) returns a value with the magnitude of x and @@ -24,19 +18,12 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -libm_hidden_proto(copysign) -#ifdef __STDC__ - double copysign(double x, double y) -#else - double copysign(x, y) - double x, y; -#endif +double copysign(double x, double y) { - u_int32_t hx, hy; - GET_HIGH_WORD(hx, x); - GET_HIGH_WORD(hy, y); - SET_HIGH_WORD(x, (hx & 0x7fffffff) | (hy & 0x80000000)); - return x; + u_int32_t hx,hy; + GET_HIGH_WORD(hx,x); + GET_HIGH_WORD(hy,y); + SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000)); + return x; } - libm_hidden_def(copysign) diff --git a/Engine/lib/sdl/src/libm/s_cos.c b/Engine/lib/sdl/src/libm/s_cos.c index 66b156c9f..554026053 100644 --- a/Engine/lib/sdl/src/libm/s_cos.c +++ b/Engine/lib/sdl/src/libm/s_cos.c @@ -1,4 +1,3 @@ -/* @(#)s_cos.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: s_cos.c,v 1.7 1995/05/10 20:47:02 jtc Exp $"; -#endif - /* cos(x) * Return cosine function of x. * @@ -49,43 +43,31 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -libm_hidden_proto(cos) -#ifdef __STDC__ - double cos(double x) -#else - double cos(x) - double x; -#endif +double cos(double x) { - double y[2], z = 0.0; - int32_t n, ix; + double y[2],z=0.0; + int32_t n, ix; /* High word of x. */ - GET_HIGH_WORD(ix, x); + GET_HIGH_WORD(ix,x); /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if (ix <= 0x3fe921fb) - return __kernel_cos(x, z); + ix &= 0x7fffffff; + if(ix <= 0x3fe921fb) return __kernel_cos(x,z); /* cos(Inf or NaN) is NaN */ - else if (ix >= 0x7ff00000) - return x - x; + else if (ix>=0x7ff00000) return x-x; /* argument reduction needed */ - else { - n = __ieee754_rem_pio2(x, y); - switch (n & 3) { - case 0: - return __kernel_cos(y[0], y[1]); - case 1: - return -__kernel_sin(y[0], y[1], 1); - case 2: - return -__kernel_cos(y[0], y[1]); - default: - return __kernel_sin(y[0], y[1], 1); - } - } + else { + n = __ieee754_rem_pio2(x,y); + switch(n&3) { + case 0: return __kernel_cos(y[0],y[1]); + case 1: return -__kernel_sin(y[0],y[1],1); + case 2: return -__kernel_cos(y[0],y[1]); + default: + return __kernel_sin(y[0],y[1],1); + } + } } - libm_hidden_def(cos) diff --git a/Engine/lib/sdl/src/libm/s_fabs.c b/Engine/lib/sdl/src/libm/s_fabs.c index 5cf0c3977..9ee943c40 100644 --- a/Engine/lib/sdl/src/libm/s_fabs.c +++ b/Engine/lib/sdl/src/libm/s_fabs.c @@ -1,4 +1,3 @@ -/* @(#)s_fabs.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,30 +9,21 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: s_fabs.c,v 1.7 1995/05/10 20:47:13 jtc Exp $"; -#endif - /* * fabs(x) returns the absolute value of x. */ +/*#include */ +/* Prevent math.h from defining a colliding inline */ +#undef __USE_EXTERN_INLINES #include "math_libm.h" #include "math_private.h" -libm_hidden_proto(fabs) -#ifdef __STDC__ - double fabs(double x) -#else - double fabs(x) - double x; -#endif +double fabs(double x) { - u_int32_t high; - GET_HIGH_WORD(high, x); - SET_HIGH_WORD(x, high & 0x7fffffff); - return x; + u_int32_t high; + GET_HIGH_WORD(high,x); + SET_HIGH_WORD(x,high&0x7fffffff); + return x; } - libm_hidden_def(fabs) diff --git a/Engine/lib/sdl/src/libm/s_floor.c b/Engine/lib/sdl/src/libm/s_floor.c index b553d3038..3f9a5cead 100644 --- a/Engine/lib/sdl/src/libm/s_floor.c +++ b/Engine/lib/sdl/src/libm/s_floor.c @@ -1,4 +1,3 @@ -/* @(#)s_floor.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: s_floor.c,v 1.8 1995/05/10 20:47:20 jtc Exp $"; -#endif - /* * floor(x) * Return x rounded toward -inf to integral value @@ -24,73 +18,54 @@ static const char rcsid[] = * Inexact flag raised if x not equal to floor(x). */ +/*#include */ +/* Prevent math.h from defining a colliding inline */ +#undef __USE_EXTERN_INLINES #include "math_libm.h" #include "math_private.h" -#ifdef __STDC__ -static const double huge_val = 1.0e300; -#else -static double huge_val = 1.0e300; -#endif +static const double huge = 1.0e300; -libm_hidden_proto(floor) -#ifdef __STDC__ - double floor(double x) -#else - double floor(x) - double x; -#endif +double floor(double x) { - int32_t i0, i1, j0; - u_int32_t i, j; - EXTRACT_WORDS(i0, i1, x); - j0 = ((i0 >> 20) & 0x7ff) - 0x3ff; - if (j0 < 20) { - if (j0 < 0) { /* raise inexact if x != 0 */ - if (huge_val + x > 0.0) { /* return 0*sign(x) if |x|<1 */ - if (i0 >= 0) { - i0 = i1 = 0; - } else if (((i0 & 0x7fffffff) | i1) != 0) { - i0 = 0xbff00000; - i1 = 0; - } - } - } else { - i = (0x000fffff) >> j0; - if (((i0 & i) | i1) == 0) - return x; /* x is integral */ - if (huge_val + x > 0.0) { /* raise inexact flag */ - if (i0 < 0) - i0 += (0x00100000) >> j0; - i0 &= (~i); - i1 = 0; - } - } - } else if (j0 > 51) { - if (j0 == 0x400) - return x + x; /* inf or NaN */ - else - return x; /* x is integral */ - } else { - i = ((u_int32_t) (0xffffffff)) >> (j0 - 20); - if ((i1 & i) == 0) - return x; /* x is integral */ - if (huge_val + x > 0.0) { /* raise inexact flag */ - if (i0 < 0) { - if (j0 == 20) - i0 += 1; - else { - j = i1 + (1 << (52 - j0)); - if (j < (u_int32_t) i1) - i0 += 1; /* got a carry */ - i1 = j; - } - } - i1 &= (~i); - } - } - INSERT_WORDS(x, i0, i1); - return x; + int32_t i0,i1,j0; + u_int32_t i,j; + EXTRACT_WORDS(i0,i1,x); + j0 = ((i0>>20)&0x7ff)-0x3ff; + if(j0<20) { + if(j0<0) { /* raise inexact if x != 0 */ + if(huge+x>0.0) {/* return 0*sign(x) if |x|<1 */ + if(i0>=0) {i0=i1=0;} + else if(((i0&0x7fffffff)|i1)!=0) + { i0=0xbff00000;i1=0;} + } + } else { + i = (0x000fffff)>>j0; + if(((i0&i)|i1)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(i0<0) i0 += (0x00100000)>>j0; + i0 &= (~i); i1=0; + } + } + } else if (j0>51) { + if(j0==0x400) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } else { + i = ((u_int32_t)(0xffffffff))>>(j0-20); + if((i1&i)==0) return x; /* x is integral */ + if(huge+x>0.0) { /* raise inexact flag */ + if(i0<0) { + if(j0==20) i0+=1; + else { + j = i1+(1<<(52-j0)); + if(j<(u_int32_t)i1) i0 +=1 ; /* got a carry */ + i1=j; + } + } + i1 &= (~i); + } + } + INSERT_WORDS(x,i0,i1); + return x; } - libm_hidden_def(floor) diff --git a/Engine/lib/sdl/src/libm/s_scalbn.c b/Engine/lib/sdl/src/libm/s_scalbn.c index f824e926d..6bb719223 100644 --- a/Engine/lib/sdl/src/libm/s_scalbn.c +++ b/Engine/lib/sdl/src/libm/s_scalbn.c @@ -1,4 +1,3 @@ -/* @(#)s_scalbn.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,70 +9,61 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: s_scalbn.c,v 1.8 1995/05/10 20:48:08 jtc Exp $"; -#endif - /* - * scalbn (double x, int n) - * scalbn(x,n) returns x* 2**n computed by exponent + * scalbln(double x, long n) + * scalbln(x,n) returns x * 2**n computed by exponent * manipulation rather than by actually performing an * exponentiation or a multiplication. */ #include "math_libm.h" #include "math_private.h" +#include -libm_hidden_proto(copysign) -#ifdef __STDC__ - static const double -#else - static double -#endif - two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ - twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */ - huge_val = 1.0e+300, tiny = 1.0e-300; +static const double +two54 = 1.80143985094819840000e+16, /* 0x43500000, 0x00000000 */ +twom54 = 5.55111512312578270212e-17, /* 0x3C900000, 0x00000000 */ +huge = 1.0e+300, +tiny = 1.0e-300; -libm_hidden_proto(scalbn) -#ifdef __STDC__ - double scalbn(double x, int n) -#else - double scalbn(x, n) - double x; - int n; -#endif +double scalbln(double x, long n) { - int32_t k, hx, lx; - EXTRACT_WORDS(hx, lx, x); - k = (hx & 0x7ff00000) >> 20; /* extract exponent */ - if (k == 0) { /* 0 or subnormal x */ - if ((lx | (hx & 0x7fffffff)) == 0) - return x; /* +-0 */ - x *= two54; - GET_HIGH_WORD(hx, x); - k = ((hx & 0x7ff00000) >> 20) - 54; - if (n < -50000) - return tiny * x; /* underflow */ - } - if (k == 0x7ff) - return x + x; /* NaN or Inf */ - k = k + n; - if (k > 0x7fe) - return huge_val * copysign(huge_val, x); /* overflow */ - if (k > 0) { /* normal result */ - SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20)); - return x; - } - if (k <= -54) { - if (n > 50000) /* in case integer overflow in n+k */ - return huge_val * copysign(huge_val, x); /* overflow */ - else - return tiny * copysign(tiny, x); /* underflow */ - } - k += 54; /* subnormal result */ - SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20)); - return x * twom54; -} + int32_t k, hx, lx; + EXTRACT_WORDS(hx, lx, x); + k = (hx & 0x7ff00000) >> 20; /* extract exponent */ + if (k == 0) { /* 0 or subnormal x */ + if ((lx | (hx & 0x7fffffff)) == 0) + return x; /* +-0 */ + x *= two54; + GET_HIGH_WORD(hx, x); + k = ((hx & 0x7ff00000) >> 20) - 54; + } + if (k == 0x7ff) + return x + x; /* NaN or Inf */ + k = k + n; + if (k > 0x7fe) + return huge * copysign(huge, x); /* overflow */ + if (n < -50000) + return tiny * copysign(tiny, x); /* underflow */ + if (k > 0) { /* normal result */ + SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20)); + return x; + } + if (k <= -54) { + if (n > 50000) /* in case integer overflow in n+k */ + return huge * copysign(huge, x); /* overflow */ + return tiny * copysign(tiny, x); /* underflow */ + } + k += 54; /* subnormal result */ + SET_HIGH_WORD(x, (hx & 0x800fffff) | (k << 20)); + return x * twom54; +} +libm_hidden_def(scalbln) + + +double scalbn(double x, int n) +{ + return scalbln(x, n); +} libm_hidden_def(scalbn) diff --git a/Engine/lib/sdl/src/libm/s_sin.c b/Engine/lib/sdl/src/libm/s_sin.c index 771176619..b3cd7a0e3 100644 --- a/Engine/lib/sdl/src/libm/s_sin.c +++ b/Engine/lib/sdl/src/libm/s_sin.c @@ -1,4 +1,3 @@ -/* @(#)s_sin.c 5.1 93/09/24 */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. @@ -10,11 +9,6 @@ * ==================================================== */ -#if defined(LIBM_SCCS) && !defined(lint) -static const char rcsid[] = - "$NetBSD: s_sin.c,v 1.7 1995/05/10 20:48:15 jtc Exp $"; -#endif - /* sin(x) * Return sine function of x. * @@ -49,43 +43,31 @@ static const char rcsid[] = #include "math_libm.h" #include "math_private.h" -libm_hidden_proto(sin) -#ifdef __STDC__ - double sin(double x) -#else - double sin(x) - double x; -#endif +double sin(double x) { - double y[2], z = 0.0; - int32_t n, ix; + double y[2],z=0.0; + int32_t n, ix; /* High word of x. */ - GET_HIGH_WORD(ix, x); + GET_HIGH_WORD(ix,x); /* |x| ~< pi/4 */ - ix &= 0x7fffffff; - if (ix <= 0x3fe921fb) - return __kernel_sin(x, z, 0); + ix &= 0x7fffffff; + if(ix <= 0x3fe921fb) return __kernel_sin(x,z,0); /* sin(Inf or NaN) is NaN */ - else if (ix >= 0x7ff00000) - return x - x; + else if (ix>=0x7ff00000) return x-x; /* argument reduction needed */ - else { - n = __ieee754_rem_pio2(x, y); - switch (n & 3) { - case 0: - return __kernel_sin(y[0], y[1], 1); - case 1: - return __kernel_cos(y[0], y[1]); - case 2: - return -__kernel_sin(y[0], y[1], 1); - default: - return -__kernel_cos(y[0], y[1]); - } - } + else { + n = __ieee754_rem_pio2(x,y); + switch(n&3) { + case 0: return __kernel_sin(y[0],y[1],1); + case 1: return __kernel_cos(y[0],y[1]); + case 2: return -__kernel_sin(y[0],y[1],1); + default: + return -__kernel_cos(y[0],y[1]); + } + } } - libm_hidden_def(sin) diff --git a/Engine/lib/sdl/src/loadso/dlopen/SDL_sysloadso.c b/Engine/lib/sdl/src/loadso/dlopen/SDL_sysloadso.c index 7b30b7735..18b4b8436 100644 --- a/Engine/lib/sdl/src/loadso/dlopen/SDL_sysloadso.c +++ b/Engine/lib/sdl/src/loadso/dlopen/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/loadso/dummy/SDL_sysloadso.c b/Engine/lib/sdl/src/loadso/dummy/SDL_sysloadso.c index 4f132f9f5..291c08b81 100644 --- a/Engine/lib/sdl/src/loadso/dummy/SDL_sysloadso.c +++ b/Engine/lib/sdl/src/loadso/dummy/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/loadso/haiku/SDL_sysloadso.c b/Engine/lib/sdl/src/loadso/haiku/SDL_sysloadso.c deleted file mode 100644 index 1336d9e18..000000000 --- a/Engine/lib/sdl/src/loadso/haiku/SDL_sysloadso.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifdef SDL_LOADSO_HAIKU - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* System dependent library loading routines */ - -#include -#include - -#include "SDL_loadso.h" - -void * -SDL_LoadObject(const char *sofile) -{ - void *handle = NULL; - image_id library_id = load_add_on(sofile); - if (library_id < 0) { - SDL_SetError(strerror((int) library_id)); - } else { - handle = (void *) (library_id); - } - return (handle); -} - -void * -SDL_LoadFunction(void *handle, const char *name) -{ - void *sym = NULL; - image_id library_id = (image_id) handle; - status_t rc = - get_image_symbol(library_id, name, B_SYMBOL_TYPE_TEXT, &sym); - if (rc != B_NO_ERROR) { - SDL_SetError(strerror(rc)); - } - return (sym); -} - -void -SDL_UnloadObject(void *handle) -{ - image_id library_id; - if (handle != NULL) { - library_id = (image_id) handle; - unload_add_on(library_id); - } -} - -#endif /* SDL_LOADSO_HAIKU */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/loadso/windows/SDL_sysloadso.c b/Engine/lib/sdl/src/loadso/windows/SDL_sysloadso.c index bdb2b9874..351570f92 100644 --- a/Engine/lib/sdl/src/loadso/windows/SDL_sysloadso.c +++ b/Engine/lib/sdl/src/loadso/windows/SDL_sysloadso.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/main/android/SDL_android_main.c b/Engine/lib/sdl/src/main/android/SDL_android_main.c index 671d9328e..054738a9a 100644 --- a/Engine/lib/sdl/src/main/android/SDL_android_main.c +++ b/Engine/lib/sdl/src/main/android/SDL_android_main.c @@ -1,83 +1,7 @@ /* SDL_android_main.c, placed in the public domain by Sam Lantinga 3/13/14 + + As of SDL 2.0.6 this file is no longer necessary. */ -#include "../../SDL_internal.h" - -#ifdef __ANDROID__ - -/* Include the SDL main definition header */ -#include "SDL_main.h" - -/******************************************************************************* - Functions called by JNI -*******************************************************************************/ -#include - -/* Called before SDL_main() to initialize JNI bindings in SDL library */ -extern void SDL_Android_Init(JNIEnv* env, jclass cls); - -/* This prototype is needed to prevent a warning about the missing prototype for global function below */ -JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject array); - -/* Start up the SDL app */ -JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject array) -{ - int i; - int argc; - int status; - int len; - char** argv; - - /* This interface could expand with ABI negotiation, callbacks, etc. */ - SDL_Android_Init(env, cls); - - SDL_SetMainReady(); - - /* Prepare the arguments. */ - - len = (*env)->GetArrayLength(env, array); - argv = SDL_stack_alloc(char*, 1 + len + 1); - argc = 0; - /* Use the name "app_process" so PHYSFS_platformCalcBaseDir() works. - https://bitbucket.org/MartinFelis/love-android-sdl2/issue/23/release-build-crash-on-start - */ - argv[argc++] = SDL_strdup("app_process"); - for (i = 0; i < len; ++i) { - const char* utf; - char* arg = NULL; - jstring string = (*env)->GetObjectArrayElement(env, array, i); - if (string) { - utf = (*env)->GetStringUTFChars(env, string, 0); - if (utf) { - arg = SDL_strdup(utf); - (*env)->ReleaseStringUTFChars(env, string, utf); - } - (*env)->DeleteLocalRef(env, string); - } - if (!arg) { - arg = SDL_strdup(""); - } - argv[argc++] = arg; - } - argv[argc] = NULL; - - - /* Run the application. */ - - status = SDL_main(argc, argv); - - /* Release the arguments. */ - - for (i = 0; i < argc; ++i) { - SDL_free(argv[i]); - } - SDL_stack_free(argv); - /* Do not issue an exit or the whole application will terminate instead of just the SDL thread */ - /* exit(status); */ - - return status; -} - -#endif /* __ANDROID__ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/main/haiku/SDL_BApp.h b/Engine/lib/sdl/src/main/haiku/SDL_BApp.h index 9672d462c..ba3f9271c 100644 --- a/Engine/lib/sdl/src/main/haiku/SDL_BApp.h +++ b/Engine/lib/sdl/src/main/haiku/SDL_BApp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,9 @@ #define SDL_BAPP_H #include +#if SDL_VIDEO_OPENGL #include +#endif #include "../../video/haiku/SDL_bkeyboard.h" @@ -37,7 +39,6 @@ extern "C" { /* Local includes */ #include "../../events/SDL_events_c.h" -#include "../../video/haiku/SDL_bkeyboard.h" #include "../../video/haiku/SDL_bframebuffer.h" #ifdef __cplusplus @@ -81,7 +82,9 @@ class SDL_BApp : public BApplication { public: SDL_BApp(const char* signature) : BApplication(signature) { +#if SDL_VIDEO_OPENGL _current_context = NULL; +#endif } @@ -189,6 +192,7 @@ public: return _window_map[winID]; } +#if SDL_VIDEO_OPENGL void SetCurrentContext(BGLView *newContext) { if(_current_context) _current_context->UnlockGL(); @@ -196,6 +200,8 @@ public: if (_current_context) _current_context->LockGL(); } +#endif + private: /* Event management */ void _HandleBasicWindowEvent(BMessage *msg, int32 sdlEventType) { @@ -385,8 +391,9 @@ private: /* Members */ std::vector _window_map; /* Keeps track of SDL_Windows by index-id */ - display_mode *_saved_mode; +#if SDL_VIDEO_OPENGL BGLView *_current_context; +#endif }; #endif diff --git a/Engine/lib/sdl/src/main/haiku/SDL_BeApp.cc b/Engine/lib/sdl/src/main/haiku/SDL_BeApp.cc index 4c5df0954..f4ee17951 100644 --- a/Engine/lib/sdl/src/main/haiku/SDL_BeApp.cc +++ b/Engine/lib/sdl/src/main/haiku/SDL_BeApp.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,10 @@ /* Handle the BeApp specific portions of the application */ #include +#include #include #include +#include #include #include "SDL_BApp.h" /* SDL_BApp class definition */ @@ -43,7 +45,7 @@ extern "C" { #include "../../thread/SDL_systhread.h" /* Flag to tell whether or not the Be application is active or not */ -int SDL_BeAppActive = 0; +static int SDL_BeAppActive = 0; static SDL_Thread *SDL_AppThread = NULL; static int @@ -51,7 +53,24 @@ StartBeApp(void *unused) { BApplication *App; - App = new SDL_BApp("application/x-SDL-executable"); + // default application signature + const char *signature = "application/x-SDL-executable"; + // dig resources for correct signature + image_info info; + int32 cookie = 0; + if (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) { + BFile f(info.name, O_RDONLY); + if (f.InitCheck() == B_OK) { + BAppFileInfo app_info(&f); + if (app_info.InitCheck() == B_OK) { + char sig[B_MIME_TYPE_LENGTH]; + if (app_info.GetSignature(sig) == B_OK) + signature = strndup(sig, B_MIME_TYPE_LENGTH); + } + } + } + + App = new SDL_BApp(signature); App->Run(); delete App; diff --git a/Engine/lib/sdl/src/main/haiku/SDL_BeApp.h b/Engine/lib/sdl/src/main/haiku/SDL_BeApp.h index 6700a3be9..83a2beb34 100644 --- a/Engine/lib/sdl/src/main/haiku/SDL_BeApp.h +++ b/Engine/lib/sdl/src/main/haiku/SDL_BeApp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,8 +31,6 @@ extern int SDL_InitBeApp(void); /* Quit the Be Application, if there's nothing left to do */ extern void SDL_QuitBeApp(void); -/* Flag to tell whether the app is active or not */ -extern int SDL_BeAppActive; /* vi: set ts=4 sw=4 expandtab: */ #ifdef __cplusplus diff --git a/Engine/lib/sdl/src/main/nacl/SDL_nacl_main.c b/Engine/lib/sdl/src/main/nacl/SDL_nacl_main.c index 4c01d0fba..af66bdb7d 100644 --- a/Engine/lib/sdl/src/main/nacl/SDL_nacl_main.c +++ b/Engine/lib/sdl/src/main/nacl/SDL_nacl_main.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/main/windows/SDL_windows_main.c b/Engine/lib/sdl/src/main/windows/SDL_windows_main.c index b502ed50e..5e643a44b 100644 --- a/Engine/lib/sdl/src/main/windows/SDL_windows_main.c +++ b/Engine/lib/sdl/src/main/windows/SDL_windows_main.c @@ -51,7 +51,7 @@ ParseCommandLine(char *cmdline, char **argv) argc = last_argc = 0; for (bufp = cmdline; *bufp;) { /* Skip leading whitespace */ - while (SDL_isspace(*bufp)) { + while (*bufp == ' ' || *bufp == '\t') { ++bufp; } /* Skip over argument */ @@ -77,7 +77,7 @@ ParseCommandLine(char *cmdline, char **argv) ++argc; } /* Skip over word */ - while (*bufp && !SDL_isspace(*bufp)) { + while (*bufp && (*bufp != ' ' && *bufp != '\t')) { ++bufp; } } diff --git a/Engine/lib/sdl/src/main/windows/version.rc b/Engine/lib/sdl/src/main/windows/version.rc index e10443b06..6d16ad57d 100644 --- a/Engine/lib/sdl/src/main/windows/version.rc +++ b/Engine/lib/sdl/src/main/windows/version.rc @@ -9,8 +9,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,5,0 - PRODUCTVERSION 2,0,5,0 + FILEVERSION 2,0,8,0 + PRODUCTVERSION 2,0,8,0 FILEFLAGSMASK 0x3fL FILEFLAGS 0x0L FILEOS 0x40004L @@ -23,12 +23,12 @@ BEGIN BEGIN VALUE "CompanyName", "\0" VALUE "FileDescription", "SDL\0" - VALUE "FileVersion", "2, 0, 5, 0\0" + VALUE "FileVersion", "2, 0, 8, 0\0" VALUE "InternalName", "SDL\0" - VALUE "LegalCopyright", "Copyright © 2016 Sam Lantinga\0" + VALUE "LegalCopyright", "Copyright © 2018 Sam Lantinga\0" VALUE "OriginalFilename", "SDL2.dll\0" VALUE "ProductName", "Simple DirectMedia Layer\0" - VALUE "ProductVersion", "2, 0, 5, 0\0" + VALUE "ProductVersion", "2, 0, 8, 0\0" END END BLOCK "VarFileInfo" diff --git a/Engine/lib/sdl/src/main/winrt/SDL_winrt_main_NonXAML.cpp b/Engine/lib/sdl/src/main/winrt/SDL_winrt_main_NonXAML.cpp index ce5e82473..19d22504c 100644 --- a/Engine/lib/sdl/src/main/winrt/SDL_winrt_main_NonXAML.cpp +++ b/Engine/lib/sdl/src/main/winrt/SDL_winrt_main_NonXAML.cpp @@ -50,10 +50,5 @@ int CALLBACK WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { - if (FAILED(Windows::Foundation::Initialize(RO_INIT_MULTITHREADED))) { - return 1; - } - - SDL_WinRTRunApp(SDL_main, NULL); - return 0; + return SDL_WinRTRunApp(SDL_main, NULL); } diff --git a/Engine/lib/sdl/src/power/SDL_power.c b/Engine/lib/sdl/src/power/SDL_power.c index 016013b97..e09e27ba2 100644 --- a/Engine/lib/sdl/src/power/SDL_power.c +++ b/Engine/lib/sdl/src/power/SDL_power.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,6 +20,7 @@ */ #include "../SDL_internal.h" #include "SDL_power.h" +#include "SDL_syspower.h" /* * Returns SDL_TRUE if we have a definitive answer. @@ -29,18 +30,6 @@ typedef SDL_bool (*SDL_GetPowerInfo_Impl) (SDL_PowerState * state, int *seconds, int *percent); -SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Windows(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_MacOSX(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Haiku(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_WinRT(SDL_PowerState *, int *, int *); -SDL_bool SDL_GetPowerInfo_Emscripten(SDL_PowerState *, int *, int *); - #ifndef SDL_POWER_DISABLED #ifdef SDL_POWER_HARDWIRED /* This is for things that _never_ have a battery */ @@ -59,6 +48,7 @@ SDL_GetPowerInfo_Hardwired(SDL_PowerState * state, int *seconds, int *percent) static SDL_GetPowerInfo_Impl implementations[] = { #ifndef SDL_POWER_DISABLED #ifdef SDL_POWER_LINUX /* in order of preference. More than could work. */ + SDL_GetPowerInfo_Linux_org_freedesktop_upower, SDL_GetPowerInfo_Linux_sys_class_power_supply, SDL_GetPowerInfo_Linux_proc_acpi, SDL_GetPowerInfo_Linux_proc_apm, diff --git a/Engine/lib/sdl/src/power/SDL_syspower.h b/Engine/lib/sdl/src/power/SDL_syspower.h new file mode 100644 index 000000000..a9bf70cfc --- /dev/null +++ b/Engine/lib/sdl/src/power/SDL_syspower.h @@ -0,0 +1,47 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +/* These are functions that need to be implemented by a port of SDL */ + +#ifndef SDL_syspower_h_ +#define SDL_syspower_h_ + +#include "SDL_power.h" + +/* Not all of these are available in a given build. Use #ifdefs, etc. */ +SDL_bool SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Linux_proc_acpi(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Windows(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_UIKit(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_MacOSX(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Haiku(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Android(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_PSP(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_WinRT(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Emscripten(SDL_PowerState *, int *, int *); +SDL_bool SDL_GetPowerInfo_Hardwired(SDL_PowerState *, int *, int *); + +#endif /* SDL_syspower_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/power/android/SDL_syspower.c b/Engine/lib/sdl/src/power/android/SDL_syspower.c index 5a4b0fc14..f0f492de3 100644 --- a/Engine/lib/sdl/src/power/android/SDL_syspower.c +++ b/Engine/lib/sdl/src/power/android/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ #if SDL_POWER_ANDROID #include "SDL_power.h" +#include "../SDL_syspower.h" #include "../../core/android/SDL_android.h" diff --git a/Engine/lib/sdl/src/power/emscripten/SDL_syspower.c b/Engine/lib/sdl/src/power/emscripten/SDL_syspower.c index 307f79742..9b921685b 100644 --- a/Engine/lib/sdl/src/power/emscripten/SDL_syspower.c +++ b/Engine/lib/sdl/src/power/emscripten/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/power/haiku/SDL_syspower.c b/Engine/lib/sdl/src/power/haiku/SDL_syspower.c index cfda8c962..47961bb2a 100644 --- a/Engine/lib/sdl/src/power/haiku/SDL_syspower.c +++ b/Engine/lib/sdl/src/power/haiku/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,9 @@ */ #include "../../SDL_internal.h" +/* uses BeOS euc.jp apm driver. */ /* !!! FIXME: does this thing even work on Haiku? */ + #ifndef SDL_POWER_DISABLED #if SDL_POWER_HAIKU diff --git a/Engine/lib/sdl/src/power/linux/SDL_syspower.c b/Engine/lib/sdl/src/power/linux/SDL_syspower.c index 793e26669..105d5fe7f 100644 --- a/Engine/lib/sdl/src/power/linux/SDL_syspower.c +++ b/Engine/lib/sdl/src/power/linux/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,6 +32,9 @@ #include #include "SDL_power.h" +#include "../SDL_syspower.h" + +#include "../../core/linux/SDL_dbus.h" static const char *proc_apm_path = "/proc/apm"; static const char *proc_acpi_battery_path = "/proc/acpi/battery"; @@ -425,8 +428,6 @@ SDL_GetPowerInfo_Linux_proc_apm(SDL_PowerState * state, return SDL_TRUE; } -/* !!! FIXME: implement d-bus queries to org.freedesktop.UPower. */ - SDL_bool SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *seconds, int *percent) { @@ -459,6 +460,16 @@ SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *second continue; /* we don't care about UPS and such. */ } + /* if the scope is "device," it might be something like a PS4 + controller reporting its own battery, and not something that powers + the system. Most system batteries don't list a scope at all; we + assume it's a system battery if not specified. */ + if (read_power_file(base, name, "scope", str, sizeof (str))) { + if (SDL_strcmp(str, "device\n") == 0) { + continue; /* skip external devices with their own batteries. */ + } + } + /* some drivers don't offer this, so if it's not explicitly reported assume it's present. */ if (read_power_file(base, name, "present", str, sizeof (str)) && (SDL_strcmp(str, "0\n") == 0)) { st = SDL_POWERSTATE_NO_BATTERY; @@ -513,6 +524,118 @@ SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *second return SDL_TRUE; /* don't look any further. */ } + +/* d-bus queries to org.freedesktop.UPower. */ +#if SDL_USE_LIBDBUS +#define UPOWER_DBUS_NODE "org.freedesktop.UPower" +#define UPOWER_DBUS_PATH "/org/freedesktop/UPower" +#define UPOWER_DBUS_INTERFACE "org.freedesktop.UPower" +#define UPOWER_DEVICE_DBUS_INTERFACE "org.freedesktop.UPower.Device" + +static void +check_upower_device(DBusConnection *conn, const char *path, SDL_PowerState *state, int *seconds, int *percent) +{ + SDL_bool choose = SDL_FALSE; + SDL_PowerState st; + int secs; + int pct; + Uint32 ui32 = 0; + Sint64 si64 = 0; + double d = 0.0; + + if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "Type", DBUS_TYPE_UINT32, &ui32)) { + return; /* Don't know _what_ we're looking at. Give up on it. */ + } else if (ui32 != 2) { /* 2==Battery*/ + return; /* we don't care about UPS and such. */ + } else if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "PowerSupply", DBUS_TYPE_BOOLEAN, &ui32)) { + return; + } else if (!ui32) { + return; /* we don't care about random devices with batteries, like wireless controllers, etc */ + } else if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "IsPresent", DBUS_TYPE_BOOLEAN, &ui32)) { + return; + } else if (!ui32) { + st = SDL_POWERSTATE_NO_BATTERY; + } else if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "State", DBUS_TYPE_UINT32, &ui32)) { + st = SDL_POWERSTATE_UNKNOWN; /* uh oh */ + } else if (ui32 == 1) { /* 1 == charging */ + st = SDL_POWERSTATE_CHARGING; + } else if ((ui32 == 2) || (ui32 == 3)) { /* 2 == discharging, 3 == empty. */ + st = SDL_POWERSTATE_ON_BATTERY; + } else if (ui32 == 4) { /* 4 == full */ + st = SDL_POWERSTATE_CHARGED; + } else { + st = SDL_POWERSTATE_UNKNOWN; /* uh oh */ + } + + if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "Percentage", DBUS_TYPE_DOUBLE, &d)) { + pct = -1; /* some old/cheap batteries don't set this property. */ + } else { + pct = (int) d; + pct = (pct > 100) ? 100 : pct; /* clamp between 0%, 100% */ + } + + if (!SDL_DBus_QueryPropertyOnConnection(conn, UPOWER_DBUS_NODE, path, UPOWER_DEVICE_DBUS_INTERFACE, "TimeToEmpty", DBUS_TYPE_INT64, &si64)) { + secs = -1; + } else { + secs = (int) si64; + secs = (secs <= 0) ? -1 : secs; /* 0 == unknown */ + } + + /* + * We pick the battery that claims to have the most minutes left. + * (failing a report of minutes, we'll take the highest percent.) + */ + if ((secs < 0) && (*seconds < 0)) { + if ((pct < 0) && (*percent < 0)) { + choose = SDL_TRUE; /* at least we know there's a battery. */ + } else if (pct > *percent) { + choose = SDL_TRUE; + } + } else if (secs > *seconds) { + choose = SDL_TRUE; + } + + if (choose) { + *seconds = secs; + *percent = pct; + *state = st; + } +} +#endif + +SDL_bool +SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, int *seconds, int *percent) +{ + SDL_bool retval = SDL_FALSE; + + #if SDL_USE_LIBDBUS + SDL_DBusContext *dbus = SDL_DBus_GetContext(); + char **paths = NULL; + int i, numpaths = 0; + + if (!SDL_DBus_CallMethodOnConnection(dbus->system_conn, UPOWER_DBUS_NODE, UPOWER_DBUS_PATH, UPOWER_DBUS_INTERFACE, "EnumerateDevices", + DBUS_TYPE_INVALID, + DBUS_TYPE_ARRAY, DBUS_TYPE_OBJECT_PATH, &paths, &numpaths, DBUS_TYPE_INVALID)) { + return SDL_FALSE; /* try a different approach than UPower. */ + } + + retval = SDL_TRUE; /* Clearly we can use this interface. */ + *state = SDL_POWERSTATE_NO_BATTERY; /* assume we're just plugged in. */ + *seconds = -1; + *percent = -1; + + for (i = 0; i < numpaths; i++) { + check_upower_device(dbus->system_conn, paths[i], state, seconds, percent); + } + + if (dbus) { + dbus->free_string_array(paths); + } + #endif /* SDL_USE_LIBDBUS */ + + return retval; +} + #endif /* SDL_POWER_LINUX */ #endif /* SDL_POWER_DISABLED */ diff --git a/Engine/lib/sdl/src/power/macosx/SDL_syspower.c b/Engine/lib/sdl/src/power/macosx/SDL_syspower.c index f865d59ef..f28b6c8b5 100644 --- a/Engine/lib/sdl/src/power/macosx/SDL_syspower.c +++ b/Engine/lib/sdl/src/power/macosx/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/power/psp/SDL_syspower.c b/Engine/lib/sdl/src/power/psp/SDL_syspower.c index 76c21b947..74585b2a6 100644 --- a/Engine/lib/sdl/src/power/psp/SDL_syspower.c +++ b/Engine/lib/sdl/src/power/psp/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/power/uikit/SDL_syspower.h b/Engine/lib/sdl/src/power/uikit/SDL_syspower.h index 4cfa5c974..4a42fd235 100644 --- a/Engine/lib/sdl/src/power/uikit/SDL_syspower.h +++ b/Engine/lib/sdl/src/power/uikit/SDL_syspower.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/power/uikit/SDL_syspower.m b/Engine/lib/sdl/src/power/uikit/SDL_syspower.m index 7186b219c..cb8a25282 100644 --- a/Engine/lib/sdl/src/power/uikit/SDL_syspower.m +++ b/Engine/lib/sdl/src/power/uikit/SDL_syspower.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/power/windows/SDL_syspower.c b/Engine/lib/sdl/src/power/windows/SDL_syspower.c index ff3784ccf..be6c9d3c0 100644 --- a/Engine/lib/sdl/src/power/windows/SDL_syspower.c +++ b/Engine/lib/sdl/src/power/windows/SDL_syspower.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/power/winrt/SDL_syspower.cpp b/Engine/lib/sdl/src/power/winrt/SDL_syspower.cpp index 94e5a2853..9f2c2ad63 100644 --- a/Engine/lib/sdl/src/power/winrt/SDL_syspower.cpp +++ b/Engine/lib/sdl/src/power/winrt/SDL_syspower.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/SDL_d3dmath.c b/Engine/lib/sdl/src/render/SDL_d3dmath.c index 83d67bfa7..47eafb2f8 100644 --- a/Engine/lib/sdl/src/render/SDL_d3dmath.c +++ b/Engine/lib/sdl/src/render/SDL_d3dmath.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,32 +31,32 @@ Float4X4 MatrixIdentity() { Float4X4 m; SDL_zero(m); - m._11 = 1.0f; - m._22 = 1.0f; - m._33 = 1.0f; - m._44 = 1.0f; + m.v._11 = 1.0f; + m.v._22 = 1.0f; + m.v._33 = 1.0f; + m.v._44 = 1.0f; return m; } Float4X4 MatrixMultiply(Float4X4 M1, Float4X4 M2) { Float4X4 m; - m._11 = M1._11 * M2._11 + M1._12 * M2._21 + M1._13 * M2._31 + M1._14 * M2._41; - m._12 = M1._11 * M2._12 + M1._12 * M2._22 + M1._13 * M2._32 + M1._14 * M2._42; - m._13 = M1._11 * M2._13 + M1._12 * M2._23 + M1._13 * M2._33 + M1._14 * M2._43; - m._14 = M1._11 * M2._14 + M1._12 * M2._24 + M1._13 * M2._34 + M1._14 * M2._44; - m._21 = M1._21 * M2._11 + M1._22 * M2._21 + M1._23 * M2._31 + M1._24 * M2._41; - m._22 = M1._21 * M2._12 + M1._22 * M2._22 + M1._23 * M2._32 + M1._24 * M2._42; - m._23 = M1._21 * M2._13 + M1._22 * M2._23 + M1._23 * M2._33 + M1._24 * M2._43; - m._24 = M1._21 * M2._14 + M1._22 * M2._24 + M1._23 * M2._34 + M1._24 * M2._44; - m._31 = M1._31 * M2._11 + M1._32 * M2._21 + M1._33 * M2._31 + M1._34 * M2._41; - m._32 = M1._31 * M2._12 + M1._32 * M2._22 + M1._33 * M2._32 + M1._34 * M2._42; - m._33 = M1._31 * M2._13 + M1._32 * M2._23 + M1._33 * M2._33 + M1._34 * M2._43; - m._34 = M1._31 * M2._14 + M1._32 * M2._24 + M1._33 * M2._34 + M1._34 * M2._44; - m._41 = M1._41 * M2._11 + M1._42 * M2._21 + M1._43 * M2._31 + M1._44 * M2._41; - m._42 = M1._41 * M2._12 + M1._42 * M2._22 + M1._43 * M2._32 + M1._44 * M2._42; - m._43 = M1._41 * M2._13 + M1._42 * M2._23 + M1._43 * M2._33 + M1._44 * M2._43; - m._44 = M1._41 * M2._14 + M1._42 * M2._24 + M1._43 * M2._34 + M1._44 * M2._44; + m.v._11 = M1.v._11 * M2.v._11 + M1.v._12 * M2.v._21 + M1.v._13 * M2.v._31 + M1.v._14 * M2.v._41; + m.v._12 = M1.v._11 * M2.v._12 + M1.v._12 * M2.v._22 + M1.v._13 * M2.v._32 + M1.v._14 * M2.v._42; + m.v._13 = M1.v._11 * M2.v._13 + M1.v._12 * M2.v._23 + M1.v._13 * M2.v._33 + M1.v._14 * M2.v._43; + m.v._14 = M1.v._11 * M2.v._14 + M1.v._12 * M2.v._24 + M1.v._13 * M2.v._34 + M1.v._14 * M2.v._44; + m.v._21 = M1.v._21 * M2.v._11 + M1.v._22 * M2.v._21 + M1.v._23 * M2.v._31 + M1.v._24 * M2.v._41; + m.v._22 = M1.v._21 * M2.v._12 + M1.v._22 * M2.v._22 + M1.v._23 * M2.v._32 + M1.v._24 * M2.v._42; + m.v._23 = M1.v._21 * M2.v._13 + M1.v._22 * M2.v._23 + M1.v._23 * M2.v._33 + M1.v._24 * M2.v._43; + m.v._24 = M1.v._21 * M2.v._14 + M1.v._22 * M2.v._24 + M1.v._23 * M2.v._34 + M1.v._24 * M2.v._44; + m.v._31 = M1.v._31 * M2.v._11 + M1.v._32 * M2.v._21 + M1.v._33 * M2.v._31 + M1.v._34 * M2.v._41; + m.v._32 = M1.v._31 * M2.v._12 + M1.v._32 * M2.v._22 + M1.v._33 * M2.v._32 + M1.v._34 * M2.v._42; + m.v._33 = M1.v._31 * M2.v._13 + M1.v._32 * M2.v._23 + M1.v._33 * M2.v._33 + M1.v._34 * M2.v._43; + m.v._34 = M1.v._31 * M2.v._14 + M1.v._32 * M2.v._24 + M1.v._33 * M2.v._34 + M1.v._34 * M2.v._44; + m.v._41 = M1.v._41 * M2.v._11 + M1.v._42 * M2.v._21 + M1.v._43 * M2.v._31 + M1.v._44 * M2.v._41; + m.v._42 = M1.v._41 * M2.v._12 + M1.v._42 * M2.v._22 + M1.v._43 * M2.v._32 + M1.v._44 * M2.v._42; + m.v._43 = M1.v._41 * M2.v._13 + M1.v._42 * M2.v._23 + M1.v._43 * M2.v._33 + M1.v._44 * M2.v._43; + m.v._44 = M1.v._41 * M2.v._14 + M1.v._42 * M2.v._24 + M1.v._43 * M2.v._34 + M1.v._44 * M2.v._44; return m; } @@ -64,10 +64,10 @@ Float4X4 MatrixScaling(float x, float y, float z) { Float4X4 m; SDL_zero(m); - m._11 = x; - m._22 = y; - m._33 = z; - m._44 = 1.0f; + m.v._11 = x; + m.v._22 = y; + m.v._33 = z; + m.v._44 = 1.0f; return m; } @@ -75,13 +75,13 @@ Float4X4 MatrixTranslation(float x, float y, float z) { Float4X4 m; SDL_zero(m); - m._11 = 1.0f; - m._22 = 1.0f; - m._33 = 1.0f; - m._44 = 1.0f; - m._41 = x; - m._42 = y; - m._43 = z; + m.v._11 = 1.0f; + m.v._22 = 1.0f; + m.v._33 = 1.0f; + m.v._44 = 1.0f; + m.v._41 = x; + m.v._42 = y; + m.v._43 = z; return m; } @@ -91,12 +91,12 @@ Float4X4 MatrixRotationX(float r) float cosR = SDL_cosf(r); Float4X4 m; SDL_zero(m); - m._11 = 1.0f; - m._22 = cosR; - m._23 = sinR; - m._32 = -sinR; - m._33 = cosR; - m._44 = 1.0f; + m.v._11 = 1.0f; + m.v._22 = cosR; + m.v._23 = sinR; + m.v._32 = -sinR; + m.v._33 = cosR; + m.v._44 = 1.0f; return m; } @@ -106,12 +106,12 @@ Float4X4 MatrixRotationY(float r) float cosR = SDL_cosf(r); Float4X4 m; SDL_zero(m); - m._11 = cosR; - m._13 = -sinR; - m._22 = 1.0f; - m._31 = sinR; - m._33 = cosR; - m._44 = 1.0f; + m.v._11 = cosR; + m.v._13 = -sinR; + m.v._22 = 1.0f; + m.v._31 = sinR; + m.v._33 = cosR; + m.v._44 = 1.0f; return m; } @@ -121,12 +121,12 @@ Float4X4 MatrixRotationZ(float r) float cosR = SDL_cosf(r); Float4X4 m; SDL_zero(m); - m._11 = cosR; - m._12 = sinR; - m._21 = -sinR; - m._22 = cosR; - m._33 = 1.0f; - m._44 = 1.0f; + m.v._11 = cosR; + m.v._12 = sinR; + m.v._21 = -sinR; + m.v._22 = cosR; + m.v._33 = 1.0f; + m.v._44 = 1.0f; return m; } diff --git a/Engine/lib/sdl/src/render/SDL_d3dmath.h b/Engine/lib/sdl/src/render/SDL_d3dmath.h index 87c44c7a3..8555a170b 100644 --- a/Engine/lib/sdl/src/render/SDL_d3dmath.h +++ b/Engine/lib/sdl/src/render/SDL_d3dmath.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,7 +53,7 @@ typedef struct float _21, _22, _23, _24; float _31, _32, _33, _34; float _41, _42, _43, _44; - }; + } v; float m[4][4]; }; } Float4X4; diff --git a/Engine/lib/sdl/src/render/SDL_render.c b/Engine/lib/sdl/src/render/SDL_render.c index 94750810d..8cd3a7bc1 100644 --- a/Engine/lib/sdl/src/render/SDL_render.c +++ b/Engine/lib/sdl/src/render/SDL_render.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,17 +33,44 @@ #define SDL_WINDOWRENDERDATA "_SDL_WindowRenderData" #define CHECK_RENDERER_MAGIC(renderer, retval) \ + SDL_assert(renderer && renderer->magic == &renderer_magic); \ if (!renderer || renderer->magic != &renderer_magic) { \ SDL_SetError("Invalid renderer"); \ return retval; \ } #define CHECK_TEXTURE_MAGIC(texture, retval) \ + SDL_assert(texture && texture->magic == &texture_magic); \ if (!texture || texture->magic != &texture_magic) { \ SDL_SetError("Invalid texture"); \ return retval; \ } +/* Predefined blend modes */ +#define SDL_COMPOSE_BLENDMODE(srcColorFactor, dstColorFactor, colorOperation, \ + srcAlphaFactor, dstAlphaFactor, alphaOperation) \ + (SDL_BlendMode)(((Uint32)colorOperation << 0) | \ + ((Uint32)srcColorFactor << 4) | \ + ((Uint32)dstColorFactor << 8) | \ + ((Uint32)alphaOperation << 16) | \ + ((Uint32)srcAlphaFactor << 20) | \ + ((Uint32)dstAlphaFactor << 24)) + +#define SDL_BLENDMODE_NONE_FULL \ + SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ZERO, SDL_BLENDOPERATION_ADD, \ + SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ZERO, SDL_BLENDOPERATION_ADD) + +#define SDL_BLENDMODE_BLEND_FULL \ + SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD, \ + SDL_BLENDFACTOR_ONE, SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA, SDL_BLENDOPERATION_ADD) + +#define SDL_BLENDMODE_ADD_FULL \ + SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD, \ + SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD) + +#define SDL_BLENDMODE_MOD_FULL \ + SDL_COMPOSE_BLENDMODE(SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_SRC_COLOR, SDL_BLENDOPERATION_ADD, \ + SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_ADD) #if !SDL_RENDER_DISABLED static const SDL_RenderDriver *render_drivers[] = { @@ -65,6 +92,9 @@ static const SDL_RenderDriver *render_drivers[] = { #if SDL_VIDEO_RENDER_DIRECTFB &DirectFB_RenderDriver, #endif +#if SDL_VIDEO_RENDER_METAL + &METAL_RenderDriver, +#endif #if SDL_VIDEO_RENDER_PSP &PSP_RenderDriver, #endif @@ -102,7 +132,7 @@ SDL_GetRenderDriverInfo(int index, SDL_RendererInfo * info) #endif } -static int +static int SDLCALL SDL_RendererEventWatch(void *userdata, SDL_Event *event) { SDL_Renderer *renderer = (SDL_Renderer *)userdata; @@ -168,31 +198,59 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event) } else if (event->type == SDL_MOUSEMOTION) { SDL_Window *window = SDL_GetWindowFromID(event->motion.windowID); if (renderer->logical_w && window == renderer->window) { - event->motion.x -= renderer->viewport.x; - event->motion.y -= renderer->viewport.y; - event->motion.x = (int)(event->motion.x / renderer->scale.x); - event->motion.y = (int)(event->motion.y / renderer->scale.y); + event->motion.x -= (int)(renderer->viewport.x * renderer->dpi_scale.x); + event->motion.y -= (int)(renderer->viewport.y * renderer->dpi_scale.y); + event->motion.x = (int)(event->motion.x / (renderer->scale.x * renderer->dpi_scale.x)); + event->motion.y = (int)(event->motion.y / (renderer->scale.y * renderer->dpi_scale.y)); if (event->motion.xrel > 0) { - event->motion.xrel = SDL_max(1, (int)(event->motion.xrel / renderer->scale.x)); + event->motion.xrel = SDL_max(1, (int)(event->motion.xrel / (renderer->scale.x * renderer->dpi_scale.x))); } else if (event->motion.xrel < 0) { - event->motion.xrel = SDL_min(-1, (int)(event->motion.xrel / renderer->scale.x)); + event->motion.xrel = SDL_min(-1, (int)(event->motion.xrel / (renderer->scale.x * renderer->dpi_scale.x))); } if (event->motion.yrel > 0) { - event->motion.yrel = SDL_max(1, (int)(event->motion.yrel / renderer->scale.y)); + event->motion.yrel = SDL_max(1, (int)(event->motion.yrel / (renderer->scale.y * renderer->dpi_scale.y))); } else if (event->motion.yrel < 0) { - event->motion.yrel = SDL_min(-1, (int)(event->motion.yrel / renderer->scale.y)); + event->motion.yrel = SDL_min(-1, (int)(event->motion.yrel / (renderer->scale.y * renderer->dpi_scale.y))); } } } else if (event->type == SDL_MOUSEBUTTONDOWN || event->type == SDL_MOUSEBUTTONUP) { SDL_Window *window = SDL_GetWindowFromID(event->button.windowID); if (renderer->logical_w && window == renderer->window) { - event->button.x -= renderer->viewport.x; - event->button.y -= renderer->viewport.y; - event->button.x = (int)(event->button.x / renderer->scale.x); - event->button.y = (int)(event->button.y / renderer->scale.y); + event->button.x -= (int)(renderer->viewport.x * renderer->dpi_scale.x); + event->button.y -= (int)(renderer->viewport.y * renderer->dpi_scale.y); + event->button.x = (int)(event->button.x / (renderer->scale.x * renderer->dpi_scale.x)); + event->button.y = (int)(event->button.y / (renderer->scale.y * renderer->dpi_scale.y)); + } + } else if (event->type == SDL_FINGERDOWN || + event->type == SDL_FINGERUP || + event->type == SDL_FINGERMOTION) { + if (renderer->logical_w) { + int w = 1; + int h = 1; + SDL_GetRendererOutputSize(renderer, &w, &h); + + event->tfinger.x *= (w - 1); + event->tfinger.y *= (h - 1); + + event->tfinger.x -= (renderer->viewport.x * renderer->dpi_scale.x); + event->tfinger.y -= (renderer->viewport.y * renderer->dpi_scale.y); + event->tfinger.x = (event->tfinger.x / (renderer->scale.x * renderer->dpi_scale.x)); + event->tfinger.y = (event->tfinger.y / (renderer->scale.y * renderer->dpi_scale.y)); + + if (renderer->logical_w > 1) { + event->tfinger.x = event->tfinger.x / (renderer->logical_w - 1); + } else { + event->tfinger.x = 0.5f; + } + if (renderer->logical_h > 1) { + event->tfinger.y = event->tfinger.y / (renderer->logical_h - 1); + } else { + event->tfinger.y = 0.5f; + } } } + return 0; } @@ -289,6 +347,18 @@ SDL_CreateRenderer(SDL_Window * window, int index, Uint32 flags) renderer->window = window; renderer->scale.x = 1.0f; renderer->scale.y = 1.0f; + renderer->dpi_scale.x = 1.0f; + renderer->dpi_scale.y = 1.0f; + + if (window && renderer->GetOutputSize) { + int window_w, window_h; + int output_w, output_h; + if (renderer->GetOutputSize(renderer, &output_w, &output_h) == 0) { + SDL_GetWindowSize(renderer->window, &window_w, &window_h); + renderer->dpi_scale.x = (float)window_w / output_w; + renderer->dpi_scale.y = (float)window_h / output_h; + } + } if (SDL_GetWindowFlags(window) & (SDL_WINDOW_HIDDEN|SDL_WINDOW_MINIMIZED)) { renderer->hidden = SDL_TRUE; @@ -367,6 +437,23 @@ SDL_GetRendererOutputSize(SDL_Renderer * renderer, int *w, int *h) } } +static SDL_bool +IsSupportedBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + switch (blendMode) + { + /* These are required to be supported by all renderers */ + case SDL_BLENDMODE_NONE: + case SDL_BLENDMODE_BLEND: + case SDL_BLENDMODE_ADD: + case SDL_BLENDMODE_MOD: + return SDL_TRUE; + + default: + return renderer->SupportsBlendMode && renderer->SupportsBlendMode(renderer, blendMode); + } +} + static SDL_bool IsSupportedFormat(SDL_Renderer * renderer, Uint32 format) { @@ -694,6 +781,9 @@ SDL_SetTextureBlendMode(SDL_Texture * texture, SDL_BlendMode blendMode) CHECK_TEXTURE_MAGIC(texture, -1); renderer = texture->renderer; + if (!IsSupportedBlendMode(renderer, blendMode)) { + return SDL_Unsupported(); + } texture->blendMode = blendMode; if (texture->native) { return SDL_SetTextureBlendMode(texture->native, blendMode); @@ -734,8 +824,8 @@ SDL_UpdateTextureYUV(SDL_Texture * texture, const SDL_Rect * rect, if (texture->access == SDL_TEXTUREACCESS_STREAMING) { /* We can lock the texture and copy to it */ - void *native_pixels; - int native_pitch; + void *native_pixels = NULL; + int native_pitch = 0; if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) { return -1; @@ -745,18 +835,18 @@ SDL_UpdateTextureYUV(SDL_Texture * texture, const SDL_Rect * rect, SDL_UnlockTexture(native); } else { /* Use a temporary buffer for updating */ - void *temp_pixels; - int temp_pitch; - - temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); - temp_pixels = SDL_malloc(rect->h * temp_pitch); - if (!temp_pixels) { - return SDL_OutOfMemory(); + const int temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); + const size_t alloclen = rect->h * temp_pitch; + if (alloclen > 0) { + void *temp_pixels = SDL_malloc(alloclen); + if (!temp_pixels) { + return SDL_OutOfMemory(); + } + SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format, + rect->w, rect->h, temp_pixels, temp_pitch); + SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch); + SDL_free(temp_pixels); } - SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format, - rect->w, rect->h, temp_pixels, temp_pitch); - SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch); - SDL_free(temp_pixels); } return 0; } @@ -767,10 +857,14 @@ SDL_UpdateTextureNative(SDL_Texture * texture, const SDL_Rect * rect, { SDL_Texture *native = texture->native; + if (!rect->w || !rect->h) { + return 0; /* nothing to do. */ + } + if (texture->access == SDL_TEXTUREACCESS_STREAMING) { /* We can lock the texture and copy to it */ - void *native_pixels; - int native_pitch; + void *native_pixels = NULL; + int native_pitch = 0; if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) { return -1; @@ -781,19 +875,19 @@ SDL_UpdateTextureNative(SDL_Texture * texture, const SDL_Rect * rect, SDL_UnlockTexture(native); } else { /* Use a temporary buffer for updating */ - void *temp_pixels; - int temp_pitch; - - temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); - temp_pixels = SDL_malloc(rect->h * temp_pitch); - if (!temp_pixels) { - return SDL_OutOfMemory(); + const int temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); + const size_t alloclen = rect->h * temp_pitch; + if (alloclen > 0) { + void *temp_pixels = SDL_malloc(alloclen); + if (!temp_pixels) { + return SDL_OutOfMemory(); + } + SDL_ConvertPixels(rect->w, rect->h, + texture->format, pixels, pitch, + native->format, temp_pixels, temp_pitch); + SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch); + SDL_free(temp_pixels); } - SDL_ConvertPixels(rect->w, rect->h, - texture->format, pixels, pitch, - native->format, temp_pixels, temp_pitch); - SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch); - SDL_free(temp_pixels); } return 0; } @@ -853,10 +947,14 @@ SDL_UpdateTextureYUVPlanar(SDL_Texture * texture, const SDL_Rect * rect, full_rect.h = texture->h; rect = &full_rect; + if (!rect->w || !rect->h) { + return 0; /* nothing to do. */ + } + if (texture->access == SDL_TEXTUREACCESS_STREAMING) { /* We can lock the texture and copy to it */ - void *native_pixels; - int native_pitch; + void *native_pixels = NULL; + int native_pitch = 0; if (SDL_LockTexture(native, rect, &native_pixels, &native_pitch) < 0) { return -1; @@ -866,18 +964,18 @@ SDL_UpdateTextureYUVPlanar(SDL_Texture * texture, const SDL_Rect * rect, SDL_UnlockTexture(native); } else { /* Use a temporary buffer for updating */ - void *temp_pixels; - int temp_pitch; - - temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); - temp_pixels = SDL_malloc(rect->h * temp_pitch); - if (!temp_pixels) { - return SDL_OutOfMemory(); + const int temp_pitch = (((rect->w * SDL_BYTESPERPIXEL(native->format)) + 3) & ~3); + const size_t alloclen = rect->h * temp_pitch; + if (alloclen > 0) { + void *temp_pixels = SDL_malloc(alloclen); + if (!temp_pixels) { + return SDL_OutOfMemory(); + } + SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format, + rect->w, rect->h, temp_pixels, temp_pitch); + SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch); + SDL_free(temp_pixels); } - SDL_SW_CopyYUVToRGB(texture->yuv, rect, native->format, - rect->w, rect->h, temp_pixels, temp_pitch); - SDL_UpdateTexture(native, rect, temp_pixels, temp_pitch); - SDL_free(temp_pixels); } return 0; } @@ -924,6 +1022,10 @@ int SDL_UpdateYUVTexture(SDL_Texture * texture, const SDL_Rect * rect, rect = &full_rect; } + if (!rect->w || !rect->h) { + return 0; /* nothing to do. */ + } + if (texture->yuv) { return SDL_UpdateTextureYUVPlanar(texture, rect, Yplane, Ypitch, Uplane, Upitch, Vplane, Vpitch); } else { @@ -1144,6 +1246,9 @@ UpdateLogicalSize(SDL_Renderer *renderer) float real_aspect; float scale; SDL_Rect viewport; + /* 0 is for letterbox, 1 is for overscan */ + int scale_policy = 0; + const char *hint; if (!renderer->logical_w || !renderer->logical_h) { return 0; @@ -1152,6 +1257,20 @@ UpdateLogicalSize(SDL_Renderer *renderer) return -1; } + hint = SDL_GetHint(SDL_HINT_RENDER_LOGICAL_SIZE_MODE); + if (hint && (*hint == '1' || SDL_strcasecmp(hint, "overscan") == 0)) { + SDL_bool overscan_supported = SDL_TRUE; + /* Unfortunately, Direct3D 9 doesn't support negative viewport numbers + which the overscan implementation relies on. + */ + if (SDL_strcasecmp(SDL_GetCurrentVideoDriver(), "direct3d") == 0) { + overscan_supported = SDL_FALSE; + } + if (overscan_supported) { + scale_policy = 1; + } + } + want_aspect = (float)renderer->logical_w / renderer->logical_h; real_aspect = (float)w / h; @@ -1175,21 +1294,47 @@ UpdateLogicalSize(SDL_Renderer *renderer) scale = (float)w / renderer->logical_w; SDL_RenderSetViewport(renderer, NULL); } else if (want_aspect > real_aspect) { - /* We want a wider aspect ratio than is available - letterbox it */ - scale = (float)w / renderer->logical_w; - viewport.x = 0; - viewport.w = w; - viewport.h = (int)SDL_ceil(renderer->logical_h * scale); - viewport.y = (h - viewport.h) / 2; - SDL_RenderSetViewport(renderer, &viewport); + if (scale_policy == 1) { + /* We want a wider aspect ratio than is available - + zoom so logical height matches the real height + and the width will grow off the screen + */ + scale = (float)h / renderer->logical_h; + viewport.y = 0; + viewport.h = h; + viewport.w = (int)SDL_ceil(renderer->logical_w * scale); + viewport.x = (w - viewport.w) / 2; + SDL_RenderSetViewport(renderer, &viewport); + } else { + /* We want a wider aspect ratio than is available - letterbox it */ + scale = (float)w / renderer->logical_w; + viewport.x = 0; + viewport.w = w; + viewport.h = (int)SDL_ceil(renderer->logical_h * scale); + viewport.y = (h - viewport.h) / 2; + SDL_RenderSetViewport(renderer, &viewport); + } } else { - /* We want a narrower aspect ratio than is available - use side-bars */ - scale = (float)h / renderer->logical_h; - viewport.y = 0; - viewport.h = h; - viewport.w = (int)SDL_ceil(renderer->logical_w * scale); - viewport.x = (w - viewport.w) / 2; - SDL_RenderSetViewport(renderer, &viewport); + if (scale_policy == 1) { + /* We want a narrower aspect ratio than is available - + zoom so logical width matches the real width + and the height will grow off the screen + */ + scale = (float)w / renderer->logical_w; + viewport.x = 0; + viewport.w = w; + viewport.h = (int)SDL_ceil(renderer->logical_h * scale); + viewport.y = (h - viewport.h) / 2; + SDL_RenderSetViewport(renderer, &viewport); + } else { + /* We want a narrower aspect ratio than is available - use side-bars */ + scale = (float)h / renderer->logical_h; + viewport.y = 0; + viewport.h = h; + viewport.w = (int)SDL_ceil(renderer->logical_w * scale); + viewport.x = (w - viewport.w) / 2; + SDL_RenderSetViewport(renderer, &viewport); + } } /* Set the new scale */ @@ -1382,6 +1527,9 @@ SDL_SetRenderDrawBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) { CHECK_RENDERER_MAGIC(renderer, -1); + if (!IsSupportedBlendMode(renderer, blendMode)) { + return SDL_Unsupported(); + } renderer->blendMode = blendMode; return 0; } @@ -1926,7 +2074,9 @@ SDL_DestroyRenderer(SDL_Renderer * renderer) /* Free existing textures for this renderer */ while (renderer->textures) { + SDL_Texture *tex = renderer->textures; (void) tex; SDL_DestroyTexture(renderer->textures); + SDL_assert(tex != renderer->textures); /* satisfy static analysis. */ } if (renderer->window) { @@ -1970,4 +2120,115 @@ int SDL_GL_UnbindTexture(SDL_Texture *texture) return SDL_Unsupported(); } +void * +SDL_RenderGetMetalLayer(SDL_Renderer * renderer) +{ + CHECK_RENDERER_MAGIC(renderer, NULL); + + if (renderer->GetMetalLayer) { + return renderer->GetMetalLayer(renderer); + } + return NULL; +} + +void * +SDL_RenderGetMetalCommandEncoder(SDL_Renderer * renderer) +{ + CHECK_RENDERER_MAGIC(renderer, NULL); + + if (renderer->GetMetalCommandEncoder) { + return renderer->GetMetalCommandEncoder(renderer); + } + return NULL; +} + +static SDL_BlendMode +SDL_GetShortBlendMode(SDL_BlendMode blendMode) +{ + if (blendMode == SDL_BLENDMODE_NONE_FULL) { + return SDL_BLENDMODE_NONE; + } + if (blendMode == SDL_BLENDMODE_BLEND_FULL) { + return SDL_BLENDMODE_BLEND; + } + if (blendMode == SDL_BLENDMODE_ADD_FULL) { + return SDL_BLENDMODE_ADD; + } + if (blendMode == SDL_BLENDMODE_MOD_FULL) { + return SDL_BLENDMODE_MOD; + } + return blendMode; +} + +static SDL_BlendMode +SDL_GetLongBlendMode(SDL_BlendMode blendMode) +{ + if (blendMode == SDL_BLENDMODE_NONE) { + return SDL_BLENDMODE_NONE_FULL; + } + if (blendMode == SDL_BLENDMODE_BLEND) { + return SDL_BLENDMODE_BLEND_FULL; + } + if (blendMode == SDL_BLENDMODE_ADD) { + return SDL_BLENDMODE_ADD_FULL; + } + if (blendMode == SDL_BLENDMODE_MOD) { + return SDL_BLENDMODE_MOD_FULL; + } + return blendMode; +} + +SDL_BlendMode +SDL_ComposeCustomBlendMode(SDL_BlendFactor srcColorFactor, SDL_BlendFactor dstColorFactor, + SDL_BlendOperation colorOperation, + SDL_BlendFactor srcAlphaFactor, SDL_BlendFactor dstAlphaFactor, + SDL_BlendOperation alphaOperation) +{ + SDL_BlendMode blendMode = SDL_COMPOSE_BLENDMODE(srcColorFactor, dstColorFactor, colorOperation, + srcAlphaFactor, dstAlphaFactor, alphaOperation); + return SDL_GetShortBlendMode(blendMode); +} + +SDL_BlendFactor +SDL_GetBlendModeSrcColorFactor(SDL_BlendMode blendMode) +{ + blendMode = SDL_GetLongBlendMode(blendMode); + return (SDL_BlendFactor)(((Uint32)blendMode >> 4) & 0xF); +} + +SDL_BlendFactor +SDL_GetBlendModeDstColorFactor(SDL_BlendMode blendMode) +{ + blendMode = SDL_GetLongBlendMode(blendMode); + return (SDL_BlendFactor)(((Uint32)blendMode >> 8) & 0xF); +} + +SDL_BlendOperation +SDL_GetBlendModeColorOperation(SDL_BlendMode blendMode) +{ + blendMode = SDL_GetLongBlendMode(blendMode); + return (SDL_BlendOperation)(((Uint32)blendMode >> 0) & 0xF); +} + +SDL_BlendFactor +SDL_GetBlendModeSrcAlphaFactor(SDL_BlendMode blendMode) +{ + blendMode = SDL_GetLongBlendMode(blendMode); + return (SDL_BlendFactor)(((Uint32)blendMode >> 20) & 0xF); +} + +SDL_BlendFactor +SDL_GetBlendModeDstAlphaFactor(SDL_BlendMode blendMode) +{ + blendMode = SDL_GetLongBlendMode(blendMode); + return (SDL_BlendFactor)(((Uint32)blendMode >> 24) & 0xF); +} + +SDL_BlendOperation +SDL_GetBlendModeAlphaOperation(SDL_BlendMode blendMode) +{ + blendMode = SDL_GetLongBlendMode(blendMode); + return (SDL_BlendOperation)(((Uint32)blendMode >> 16) & 0xF); +} + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/SDL_sysrender.h b/Engine/lib/sdl/src/render/SDL_sysrender.h index 378fc4d97..f0f54c883 100644 --- a/Engine/lib/sdl/src/render/SDL_sysrender.h +++ b/Engine/lib/sdl/src/render/SDL_sysrender.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_sysrender_h -#define _SDL_sysrender_h +#ifndef SDL_sysrender_h_ +#define SDL_sysrender_h_ #include "SDL_render.h" #include "SDL_events.h" @@ -79,6 +79,7 @@ struct SDL_Renderer void (*WindowEvent) (SDL_Renderer * renderer, const SDL_WindowEvent *event); int (*GetOutputSize) (SDL_Renderer * renderer, int *w, int *h); + SDL_bool (*SupportsBlendMode)(SDL_Renderer * renderer, SDL_BlendMode blendMode); int (*CreateTexture) (SDL_Renderer * renderer, SDL_Texture * texture); int (*SetTextureColorMod) (SDL_Renderer * renderer, SDL_Texture * texture); @@ -122,6 +123,9 @@ struct SDL_Renderer int (*GL_BindTexture) (SDL_Renderer * renderer, SDL_Texture *texture, float *texw, float *texh); int (*GL_UnbindTexture) (SDL_Renderer * renderer, SDL_Texture *texture); + void *(*GetMetalLayer) (SDL_Renderer * renderer); + void *(*GetMetalCommandEncoder) (SDL_Renderer * renderer); + /* The current renderer info */ SDL_RendererInfo info; @@ -154,6 +158,9 @@ struct SDL_Renderer SDL_FPoint scale; SDL_FPoint scale_backup; + /* The pixel to point coordinate scale */ + SDL_FPoint dpi_scale; + /* The list of textures */ SDL_Texture *textures; SDL_Texture *target; @@ -173,33 +180,25 @@ struct SDL_RenderDriver SDL_RendererInfo info; }; -#if !SDL_RENDER_DISABLED - -#if SDL_VIDEO_RENDER_D3D +/* Not all of these are available in a given build. Use #ifdefs, etc. */ extern SDL_RenderDriver D3D_RenderDriver; -#endif -#if SDL_VIDEO_RENDER_D3D11 extern SDL_RenderDriver D3D11_RenderDriver; -#endif -#if SDL_VIDEO_RENDER_OGL extern SDL_RenderDriver GL_RenderDriver; -#endif -#if SDL_VIDEO_RENDER_OGL_ES2 extern SDL_RenderDriver GLES2_RenderDriver; -#endif -#if SDL_VIDEO_RENDER_OGL_ES extern SDL_RenderDriver GLES_RenderDriver; -#endif -#if SDL_VIDEO_RENDER_DIRECTFB extern SDL_RenderDriver DirectFB_RenderDriver; -#endif -#if SDL_VIDEO_RENDER_PSP +extern SDL_RenderDriver METAL_RenderDriver; extern SDL_RenderDriver PSP_RenderDriver; -#endif extern SDL_RenderDriver SW_RenderDriver; -#endif /* !SDL_RENDER_DISABLED */ +/* Blend mode functions */ +extern SDL_BlendFactor SDL_GetBlendModeSrcColorFactor(SDL_BlendMode blendMode); +extern SDL_BlendFactor SDL_GetBlendModeDstColorFactor(SDL_BlendMode blendMode); +extern SDL_BlendOperation SDL_GetBlendModeColorOperation(SDL_BlendMode blendMode); +extern SDL_BlendFactor SDL_GetBlendModeSrcAlphaFactor(SDL_BlendMode blendMode); +extern SDL_BlendFactor SDL_GetBlendModeDstAlphaFactor(SDL_BlendMode blendMode); +extern SDL_BlendOperation SDL_GetBlendModeAlphaOperation(SDL_BlendMode blendMode); -#endif /* _SDL_sysrender_h */ +#endif /* SDL_sysrender_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/SDL_yuv_mmx.c b/Engine/lib/sdl/src/render/SDL_yuv_mmx.c deleted file mode 100644 index 0de776a36..000000000 --- a/Engine/lib/sdl/src/render/SDL_yuv_mmx.c +++ /dev/null @@ -1,431 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../SDL_internal.h" - -#if (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES - -#include "SDL_stdinc.h" - -#include "mmx.h" - -/* *INDENT-OFF* */ - -static mmx_t MMX_0080w = { .ud = {0x00800080, 0x00800080} }; -static mmx_t MMX_00FFw = { .ud = {0x00ff00ff, 0x00ff00ff} }; -static mmx_t MMX_FF00w = { .ud = {0xff00ff00, 0xff00ff00} }; - -static mmx_t MMX_Ycoeff = { .uw = {0x004a, 0x004a, 0x004a, 0x004a} }; - -static mmx_t MMX_UbluRGB = { .uw = {0x0072, 0x0072, 0x0072, 0x0072} }; -static mmx_t MMX_VredRGB = { .uw = {0x0059, 0x0059, 0x0059, 0x0059} }; -static mmx_t MMX_UgrnRGB = { .uw = {0xffea, 0xffea, 0xffea, 0xffea} }; -static mmx_t MMX_VgrnRGB = { .uw = {0xffd2, 0xffd2, 0xffd2, 0xffd2} }; - -static mmx_t MMX_Ublu5x5 = { .uw = {0x0081, 0x0081, 0x0081, 0x0081} }; -static mmx_t MMX_Vred5x5 = { .uw = {0x0066, 0x0066, 0x0066, 0x0066} }; -static mmx_t MMX_Ugrn565 = { .uw = {0xffe8, 0xffe8, 0xffe8, 0xffe8} }; -static mmx_t MMX_Vgrn565 = { .uw = {0xffcd, 0xffcd, 0xffcd, 0xffcd} }; - -static mmx_t MMX_red565 = { .uw = {0xf800, 0xf800, 0xf800, 0xf800} }; -static mmx_t MMX_grn565 = { .uw = {0x07e0, 0x07e0, 0x07e0, 0x07e0} }; - -/** - This MMX assembler is my first assembler/MMX program ever. - Thus it maybe buggy. - Send patches to: - mvogt@rhrk.uni-kl.de - - After it worked fine I have "obfuscated" the code a bit to have - more parallism in the MMX units. This means I moved - initilisation around and delayed other instruction. - Performance measurement did not show that this brought any advantage - but in theory it _should_ be faster this way. - - The overall performanve gain to the C based dither was 30%-40%. - The MMX routine calculates 256bit=8RGB values in each cycle - (4 for row1 & 4 for row2) - - The red/green/blue.. coefficents are taken from the mpeg_play - player. They look nice, but I dont know if you can have - better values, to avoid integer rounding errors. - - - IMPORTANT: - ========== - - It is a requirement that the cr/cb/lum are 8 byte aligned and - the out are 16byte aligned or you will/may get segfaults - -*/ - -void ColorRGBDitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod ) -{ - Uint32 *row1; - Uint32 *row2; - - unsigned char* y = lum +cols*rows; /* Pointer to the end */ - int x = 0; - row1 = (Uint32 *)out; /* 32 bit target */ - row2 = (Uint32 *)out+cols+mod; /* start of second row */ - mod = (mod+cols+mod)*4; /* increment for row1 in byte */ - - __asm__ __volatile__ ( - /* tap dance to workaround the inability to use %%ebx at will... */ - /* move one thing to the stack... */ - "pushl $0\n" /* save a slot on the stack. */ - "pushl %%ebx\n" /* save %%ebx. */ - "movl %0, %%ebx\n" /* put the thing in ebx. */ - "movl %%ebx,4(%%esp)\n" /* put the thing in the stack slot. */ - "popl %%ebx\n" /* get back %%ebx (the PIC register). */ - - ".align 8\n" - "1:\n" - - /* create Cr (result in mm1) */ - "pushl %%ebx\n" - "movl 4(%%esp),%%ebx\n" - "movd (%%ebx),%%mm1\n" /* 0 0 0 0 v3 v2 v1 v0 */ - "popl %%ebx\n" - "pxor %%mm7,%%mm7\n" /* 00 00 00 00 00 00 00 00 */ - "movd (%2), %%mm2\n" /* 0 0 0 0 l3 l2 l1 l0 */ - "punpcklbw %%mm7,%%mm1\n" /* 0 v3 0 v2 00 v1 00 v0 */ - "punpckldq %%mm1,%%mm1\n" /* 00 v1 00 v0 00 v1 00 v0 */ - "psubw %9,%%mm1\n" /* mm1-128:r1 r1 r0 r0 r1 r1 r0 r0 */ - - /* create Cr_g (result in mm0) */ - "movq %%mm1,%%mm0\n" /* r1 r1 r0 r0 r1 r1 r0 r0 */ - "pmullw %10,%%mm0\n" /* red*-46dec=0.7136*64 */ - "pmullw %11,%%mm1\n" /* red*89dec=1.4013*64 */ - "psraw $6, %%mm0\n" /* red=red/64 */ - "psraw $6, %%mm1\n" /* red=red/64 */ - - /* create L1 L2 (result in mm2,mm4) */ - /* L2=lum+cols */ - "movq (%2,%4),%%mm3\n" /* 0 0 0 0 L3 L2 L1 L0 */ - "punpckldq %%mm3,%%mm2\n" /* L3 L2 L1 L0 l3 l2 l1 l0 */ - "movq %%mm2,%%mm4\n" /* L3 L2 L1 L0 l3 l2 l1 l0 */ - "pand %12,%%mm2\n" /* L3 0 L1 0 l3 0 l1 0 */ - "pand %13,%%mm4\n" /* 0 L2 0 L0 0 l2 0 l0 */ - "psrlw $8,%%mm2\n" /* 0 L3 0 L1 0 l3 0 l1 */ - - /* create R (result in mm6) */ - "movq %%mm2,%%mm5\n" /* 0 L3 0 L1 0 l3 0 l1 */ - "movq %%mm4,%%mm6\n" /* 0 L2 0 L0 0 l2 0 l0 */ - "paddsw %%mm1, %%mm5\n" /* lum1+red:x R3 x R1 x r3 x r1 */ - "paddsw %%mm1, %%mm6\n" /* lum1+red:x R2 x R0 x r2 x r0 */ - "packuswb %%mm5,%%mm5\n" /* R3 R1 r3 r1 R3 R1 r3 r1 */ - "packuswb %%mm6,%%mm6\n" /* R2 R0 r2 r0 R2 R0 r2 r0 */ - "pxor %%mm7,%%mm7\n" /* 00 00 00 00 00 00 00 00 */ - "punpcklbw %%mm5,%%mm6\n" /* R3 R2 R1 R0 r3 r2 r1 r0 */ - - /* create Cb (result in mm1) */ - "movd (%1), %%mm1\n" /* 0 0 0 0 u3 u2 u1 u0 */ - "punpcklbw %%mm7,%%mm1\n" /* 0 u3 0 u2 00 u1 00 u0 */ - "punpckldq %%mm1,%%mm1\n" /* 00 u1 00 u0 00 u1 00 u0 */ - "psubw %9,%%mm1\n" /* mm1-128:u1 u1 u0 u0 u1 u1 u0 u0 */ - - /* create Cb_g (result in mm5) */ - "movq %%mm1,%%mm5\n" /* u1 u1 u0 u0 u1 u1 u0 u0 */ - "pmullw %14,%%mm5\n" /* blue*-109dec=1.7129*64 */ - "pmullw %15,%%mm1\n" /* blue*114dec=1.78125*64 */ - "psraw $6, %%mm5\n" /* blue=red/64 */ - "psraw $6, %%mm1\n" /* blue=blue/64 */ - - /* create G (result in mm7) */ - "movq %%mm2,%%mm3\n" /* 0 L3 0 L1 0 l3 0 l1 */ - "movq %%mm4,%%mm7\n" /* 0 L2 0 L0 0 l2 0 l1 */ - "paddsw %%mm5, %%mm3\n" /* lum1+Cb_g:x G3t x G1t x g3t x g1t */ - "paddsw %%mm5, %%mm7\n" /* lum1+Cb_g:x G2t x G0t x g2t x g0t */ - "paddsw %%mm0, %%mm3\n" /* lum1+Cr_g:x G3 x G1 x g3 x g1 */ - "paddsw %%mm0, %%mm7\n" /* lum1+blue:x G2 x G0 x g2 x g0 */ - "packuswb %%mm3,%%mm3\n" /* G3 G1 g3 g1 G3 G1 g3 g1 */ - "packuswb %%mm7,%%mm7\n" /* G2 G0 g2 g0 G2 G0 g2 g0 */ - "punpcklbw %%mm3,%%mm7\n" /* G3 G2 G1 G0 g3 g2 g1 g0 */ - - /* create B (result in mm5) */ - "movq %%mm2,%%mm3\n" /* 0 L3 0 L1 0 l3 0 l1 */ - "movq %%mm4,%%mm5\n" /* 0 L2 0 L0 0 l2 0 l1 */ - "paddsw %%mm1, %%mm3\n" /* lum1+blue:x B3 x B1 x b3 x b1 */ - "paddsw %%mm1, %%mm5\n" /* lum1+blue:x B2 x B0 x b2 x b0 */ - "packuswb %%mm3,%%mm3\n" /* B3 B1 b3 b1 B3 B1 b3 b1 */ - "packuswb %%mm5,%%mm5\n" /* B2 B0 b2 b0 B2 B0 b2 b0 */ - "punpcklbw %%mm3,%%mm5\n" /* B3 B2 B1 B0 b3 b2 b1 b0 */ - - /* fill destination row1 (needed are mm6=Rr,mm7=Gg,mm5=Bb) */ - - "pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */ - "pxor %%mm4,%%mm4\n" /* 0 0 0 0 0 0 0 0 */ - "movq %%mm6,%%mm1\n" /* R3 R2 R1 R0 r3 r2 r1 r0 */ - "movq %%mm5,%%mm3\n" /* B3 B2 B1 B0 b3 b2 b1 b0 */ - - /* process lower lum */ - "punpcklbw %%mm4,%%mm1\n" /* 0 r3 0 r2 0 r1 0 r0 */ - "punpcklbw %%mm4,%%mm3\n" /* 0 b3 0 b2 0 b1 0 b0 */ - "movq %%mm1,%%mm2\n" /* 0 r3 0 r2 0 r1 0 r0 */ - "movq %%mm3,%%mm0\n" /* 0 b3 0 b2 0 b1 0 b0 */ - "punpcklwd %%mm1,%%mm3\n" /* 0 r1 0 b1 0 r0 0 b0 */ - "punpckhwd %%mm2,%%mm0\n" /* 0 r3 0 b3 0 r2 0 b2 */ - - "pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */ - "movq %%mm7,%%mm1\n" /* G3 G2 G1 G0 g3 g2 g1 g0 */ - "punpcklbw %%mm1,%%mm2\n" /* g3 0 g2 0 g1 0 g0 0 */ - "punpcklwd %%mm4,%%mm2\n" /* 0 0 g1 0 0 0 g0 0 */ - "por %%mm3, %%mm2\n" /* 0 r1 g1 b1 0 r0 g0 b0 */ - "movq %%mm2,(%3)\n" /* wrote out ! row1 */ - - "pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */ - "punpcklbw %%mm1,%%mm4\n" /* g3 0 g2 0 g1 0 g0 0 */ - "punpckhwd %%mm2,%%mm4\n" /* 0 0 g3 0 0 0 g2 0 */ - "por %%mm0, %%mm4\n" /* 0 r3 g3 b3 0 r2 g2 b2 */ - "movq %%mm4,8(%3)\n" /* wrote out ! row1 */ - - /* fill destination row2 (needed are mm6=Rr,mm7=Gg,mm5=Bb) */ - /* this can be done "destructive" */ - "pxor %%mm2,%%mm2\n" /* 0 0 0 0 0 0 0 0 */ - "punpckhbw %%mm2,%%mm6\n" /* 0 R3 0 R2 0 R1 0 R0 */ - "punpckhbw %%mm1,%%mm5\n" /* G3 B3 G2 B2 G1 B1 G0 B0 */ - "movq %%mm5,%%mm1\n" /* G3 B3 G2 B2 G1 B1 G0 B0 */ - "punpcklwd %%mm6,%%mm1\n" /* 0 R1 G1 B1 0 R0 G0 B0 */ - "movq %%mm1,(%5)\n" /* wrote out ! row2 */ - "punpckhwd %%mm6,%%mm5\n" /* 0 R3 G3 B3 0 R2 G2 B2 */ - "movq %%mm5,8(%5)\n" /* wrote out ! row2 */ - - "addl $4,%2\n" /* lum+4 */ - "leal 16(%3),%3\n" /* row1+16 */ - "leal 16(%5),%5\n" /* row2+16 */ - "addl $2,(%%esp)\n" /* cr+2 */ - "addl $2,%1\n" /* cb+2 */ - - "addl $4,%6\n" /* x+4 */ - "cmpl %4,%6\n" - - "jl 1b\n" - "addl %4,%2\n" /* lum += cols */ - "addl %8,%3\n" /* row1+= mod */ - "addl %8,%5\n" /* row2+= mod */ - "movl $0,%6\n" /* x=0 */ - "cmpl %7,%2\n" - "jl 1b\n" - - "addl $4,%%esp\n" /* get rid of the stack slot we reserved. */ - "emms\n" /* reset MMX registers. */ - : - : "m" (cr), "r"(cb),"r"(lum), - "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod), - "m"(MMX_0080w),"m"(MMX_VgrnRGB),"m"(MMX_VredRGB), - "m"(MMX_FF00w),"m"(MMX_00FFw),"m"(MMX_UgrnRGB), - "m"(MMX_UbluRGB) - ); -} - -void Color565DitherYV12MMX1X( int *colortab, Uint32 *rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod ) -{ - Uint16 *row1; - Uint16 *row2; - - unsigned char* y = lum +cols*rows; /* Pointer to the end */ - int x = 0; - row1 = (Uint16 *)out; /* 16 bit target */ - row2 = (Uint16 *)out+cols+mod; /* start of second row */ - mod = (mod+cols+mod)*2; /* increment for row1 in byte */ - - __asm__ __volatile__( - /* tap dance to workaround the inability to use %%ebx at will... */ - /* move one thing to the stack... */ - "pushl $0\n" /* save a slot on the stack. */ - "pushl %%ebx\n" /* save %%ebx. */ - "movl %0, %%ebx\n" /* put the thing in ebx. */ - "movl %%ebx, 4(%%esp)\n" /* put the thing in the stack slot. */ - "popl %%ebx\n" /* get back %%ebx (the PIC register). */ - - ".align 8\n" - "1:\n" - - "movd (%1), %%mm0\n" /* 4 Cb 0 0 0 0 u3 u2 u1 u0 */ - "pxor %%mm7, %%mm7\n" - "pushl %%ebx\n" - "movl 4(%%esp), %%ebx\n" - "movd (%%ebx), %%mm1\n" /* 4 Cr 0 0 0 0 v3 v2 v1 v0 */ - "popl %%ebx\n" - - "punpcklbw %%mm7, %%mm0\n" /* 4 W cb 0 u3 0 u2 0 u1 0 u0 */ - "punpcklbw %%mm7, %%mm1\n" /* 4 W cr 0 v3 0 v2 0 v1 0 v0 */ - "psubw %9, %%mm0\n" - "psubw %9, %%mm1\n" - "movq %%mm0, %%mm2\n" /* Cb 0 u3 0 u2 0 u1 0 u0 */ - "movq %%mm1, %%mm3\n" /* Cr */ - "pmullw %10, %%mm2\n" /* Cb2green 0 R3 0 R2 0 R1 0 R0 */ - "movq (%2), %%mm6\n" /* L1 l7 L6 L5 L4 L3 L2 L1 L0 */ - "pmullw %11, %%mm0\n" /* Cb2blue */ - "pand %12, %%mm6\n" /* L1 00 L6 00 L4 00 L2 00 L0 */ - "pmullw %13, %%mm3\n" /* Cr2green */ - "movq (%2), %%mm7\n" /* L2 */ - "pmullw %14, %%mm1\n" /* Cr2red */ - "psrlw $8, %%mm7\n" /* L2 00 L7 00 L5 00 L3 00 L1 */ - "pmullw %15, %%mm6\n" /* lum1 */ - "paddw %%mm3, %%mm2\n" /* Cb2green + Cr2green == green */ - "pmullw %15, %%mm7\n" /* lum2 */ - - "movq %%mm6, %%mm4\n" /* lum1 */ - "paddw %%mm0, %%mm6\n" /* lum1 +blue 00 B6 00 B4 00 B2 00 B0 */ - "movq %%mm4, %%mm5\n" /* lum1 */ - "paddw %%mm1, %%mm4\n" /* lum1 +red 00 R6 00 R4 00 R2 00 R0 */ - "paddw %%mm2, %%mm5\n" /* lum1 +green 00 G6 00 G4 00 G2 00 G0 */ - "psraw $6, %%mm4\n" /* R1 0 .. 64 */ - "movq %%mm7, %%mm3\n" /* lum2 00 L7 00 L5 00 L3 00 L1 */ - "psraw $6, %%mm5\n" /* G1 - .. + */ - "paddw %%mm0, %%mm7\n" /* Lum2 +blue 00 B7 00 B5 00 B3 00 B1 */ - "psraw $6, %%mm6\n" /* B1 0 .. 64 */ - "packuswb %%mm4, %%mm4\n" /* R1 R1 */ - "packuswb %%mm5, %%mm5\n" /* G1 G1 */ - "packuswb %%mm6, %%mm6\n" /* B1 B1 */ - "punpcklbw %%mm4, %%mm4\n" - "punpcklbw %%mm5, %%mm5\n" - - "pand %16, %%mm4\n" - "psllw $3, %%mm5\n" /* GREEN 1 */ - "punpcklbw %%mm6, %%mm6\n" - "pand %17, %%mm5\n" - "pand %16, %%mm6\n" - "por %%mm5, %%mm4\n" /* */ - "psrlw $11, %%mm6\n" /* BLUE 1 */ - "movq %%mm3, %%mm5\n" /* lum2 */ - "paddw %%mm1, %%mm3\n" /* lum2 +red 00 R7 00 R5 00 R3 00 R1 */ - "paddw %%mm2, %%mm5\n" /* lum2 +green 00 G7 00 G5 00 G3 00 G1 */ - "psraw $6, %%mm3\n" /* R2 */ - "por %%mm6, %%mm4\n" /* MM4 */ - "psraw $6, %%mm5\n" /* G2 */ - "movq (%2, %4), %%mm6\n" /* L3 load lum2 */ - "psraw $6, %%mm7\n" - "packuswb %%mm3, %%mm3\n" - "packuswb %%mm5, %%mm5\n" - "packuswb %%mm7, %%mm7\n" - "pand %12, %%mm6\n" /* L3 */ - "punpcklbw %%mm3, %%mm3\n" - "punpcklbw %%mm5, %%mm5\n" - "pmullw %15, %%mm6\n" /* lum3 */ - "punpcklbw %%mm7, %%mm7\n" - "psllw $3, %%mm5\n" /* GREEN 2 */ - "pand %16, %%mm7\n" - "pand %16, %%mm3\n" - "psrlw $11, %%mm7\n" /* BLUE 2 */ - "pand %17, %%mm5\n" - "por %%mm7, %%mm3\n" - "movq (%2,%4), %%mm7\n" /* L4 load lum2 */ - "por %%mm5, %%mm3\n" - "psrlw $8, %%mm7\n" /* L4 */ - "movq %%mm4, %%mm5\n" - "punpcklwd %%mm3, %%mm4\n" - "pmullw %15, %%mm7\n" /* lum4 */ - "punpckhwd %%mm3, %%mm5\n" - - "movq %%mm4, (%3)\n" /* write row1 */ - "movq %%mm5, 8(%3)\n" /* write row1 */ - - "movq %%mm6, %%mm4\n" /* Lum3 */ - "paddw %%mm0, %%mm6\n" /* Lum3 +blue */ - - "movq %%mm4, %%mm5\n" /* Lum3 */ - "paddw %%mm1, %%mm4\n" /* Lum3 +red */ - "paddw %%mm2, %%mm5\n" /* Lum3 +green */ - "psraw $6, %%mm4\n" - "movq %%mm7, %%mm3\n" /* Lum4 */ - "psraw $6, %%mm5\n" - "paddw %%mm0, %%mm7\n" /* Lum4 +blue */ - "psraw $6, %%mm6\n" /* Lum3 +blue */ - "movq %%mm3, %%mm0\n" /* Lum4 */ - "packuswb %%mm4, %%mm4\n" - "paddw %%mm1, %%mm3\n" /* Lum4 +red */ - "packuswb %%mm5, %%mm5\n" - "paddw %%mm2, %%mm0\n" /* Lum4 +green */ - "packuswb %%mm6, %%mm6\n" - "punpcklbw %%mm4, %%mm4\n" - "punpcklbw %%mm5, %%mm5\n" - "punpcklbw %%mm6, %%mm6\n" - "psllw $3, %%mm5\n" /* GREEN 3 */ - "pand %16, %%mm4\n" - "psraw $6, %%mm3\n" /* psr 6 */ - "psraw $6, %%mm0\n" - "pand %16, %%mm6\n" /* BLUE */ - "pand %17, %%mm5\n" - "psrlw $11, %%mm6\n" /* BLUE 3 */ - "por %%mm5, %%mm4\n" - "psraw $6, %%mm7\n" - "por %%mm6, %%mm4\n" - "packuswb %%mm3, %%mm3\n" - "packuswb %%mm0, %%mm0\n" - "packuswb %%mm7, %%mm7\n" - "punpcklbw %%mm3, %%mm3\n" - "punpcklbw %%mm0, %%mm0\n" - "punpcklbw %%mm7, %%mm7\n" - "pand %16, %%mm3\n" - "pand %16, %%mm7\n" /* BLUE */ - "psllw $3, %%mm0\n" /* GREEN 4 */ - "psrlw $11, %%mm7\n" - "pand %17, %%mm0\n" - "por %%mm7, %%mm3\n" - "por %%mm0, %%mm3\n" - - "movq %%mm4, %%mm5\n" - - "punpcklwd %%mm3, %%mm4\n" - "punpckhwd %%mm3, %%mm5\n" - - "movq %%mm4, (%5)\n" - "movq %%mm5, 8(%5)\n" - - "addl $8, %6\n" - "addl $8, %2\n" - "addl $4, (%%esp)\n" - "addl $4, %1\n" - "cmpl %4, %6\n" - "leal 16(%3), %3\n" - "leal 16(%5),%5\n" /* row2+16 */ - - "jl 1b\n" - "addl %4, %2\n" /* lum += cols */ - "addl %8, %3\n" /* row1+= mod */ - "addl %8, %5\n" /* row2+= mod */ - "movl $0, %6\n" /* x=0 */ - "cmpl %7, %2\n" - "jl 1b\n" - "addl $4, %%esp\n" /* get rid of the stack slot we reserved. */ - "emms\n" - : - : "m" (cr), "r"(cb),"r"(lum), - "r"(row1),"r"(cols),"r"(row2),"m"(x),"m"(y),"m"(mod), - "m"(MMX_0080w),"m"(MMX_Ugrn565),"m"(MMX_Ublu5x5), - "m"(MMX_00FFw),"m"(MMX_Vgrn565),"m"(MMX_Vred5x5), - "m"(MMX_Ycoeff),"m"(MMX_red565),"m"(MMX_grn565) - ); -} - -/* *INDENT-ON* */ - -#endif /* GCC3 i386 inline assembly */ - -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/SDL_yuv_sw.c b/Engine/lib/sdl/src/render/SDL_yuv_sw.c index 7fc6b8865..c227cdc67 100644 --- a/Engine/lib/sdl/src/render/SDL_yuv_sw.c +++ b/Engine/lib/sdl/src/render/SDL_yuv_sw.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,1011 +22,15 @@ /* This is the software implementation of the YUV texture support */ -/* This code was derived from code carrying the following copyright notices: - - * Copyright (c) 1995 The Regents of the University of California. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF - * CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS - * ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO - * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - * Copyright (c) 1995 Erik Corry - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement is - * hereby granted, provided that the above copyright notice and the following - * two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL ERIK CORRY BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, - * SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF - * THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF ERIK CORRY HAS BEEN ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ERIK CORRY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" - * BASIS, AND ERIK CORRY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, - * UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - - * Portions of this software Copyright (c) 1995 Brown University. - * All rights reserved. - * - * Permission to use, copy, modify, and distribute this software and its - * documentation for any purpose, without fee, and without written agreement - * is hereby granted, provided that the above copyright notice and the - * following two paragraphs appear in all copies of this software. - * - * IN NO EVENT SHALL BROWN UNIVERSITY BE LIABLE TO ANY PARTY FOR - * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT - * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF BROWN - * UNIVERSITY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * BROWN UNIVERSITY SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" - * BASIS, AND BROWN UNIVERSITY HAS NO OBLIGATION TO PROVIDE MAINTENANCE, - * SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. - */ - #include "SDL_assert.h" -#include "SDL_video.h" -#include "SDL_cpuinfo.h" + #include "SDL_yuv_sw_c.h" -/* The colorspace conversion functions */ - -#if (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES -extern void Color565DitherYV12MMX1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod); -extern void ColorRGBDitherYV12MMX1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod); -#endif - -static void -Color16DitherYV12Mod1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned short *row1; - unsigned short *row2; - unsigned char *lum2; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - row1 = (unsigned short *) out; - row2 = row1 + cols + mod; - lum2 = lum + cols; - - mod += cols + mod; - - y = rows / 2; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = *lum++; - *row1++ = (unsigned short) (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - - L = *lum++; - *row1++ = (unsigned short) (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - - - /* Now, do second row. */ - - L = *lum2++; - *row2++ = (unsigned short) (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - - L = *lum2++; - *row2++ = (unsigned short) (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - } - - /* - * These values are at the start of the next line, (due - * to the ++'s above),but they need to be at the start - * of the line after that. - */ - lum += cols; - lum2 += cols; - row1 += mod; - row2 += mod; - } -} - -static void -Color24DitherYV12Mod1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int value; - unsigned char *row1; - unsigned char *row2; - unsigned char *lum2; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - row1 = out; - row2 = row1 + cols * 3 + mod * 3; - lum2 = lum + cols; - - mod += cols + mod; - mod *= 3; - - y = rows / 2; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = *lum++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - *row1++ = (value) & 0xFF; - *row1++ = (value >> 8) & 0xFF; - *row1++ = (value >> 16) & 0xFF; - - L = *lum++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - *row1++ = (value) & 0xFF; - *row1++ = (value >> 8) & 0xFF; - *row1++ = (value >> 16) & 0xFF; - - - /* Now, do second row. */ - - L = *lum2++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - *row2++ = (value) & 0xFF; - *row2++ = (value >> 8) & 0xFF; - *row2++ = (value >> 16) & 0xFF; - - L = *lum2++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - *row2++ = (value) & 0xFF; - *row2++ = (value >> 8) & 0xFF; - *row2++ = (value >> 16) & 0xFF; - } - - /* - * These values are at the start of the next line, (due - * to the ++'s above),but they need to be at the start - * of the line after that. - */ - lum += cols; - lum2 += cols; - row1 += mod; - row2 += mod; - } -} - -static void -Color32DitherYV12Mod1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int *row1; - unsigned int *row2; - unsigned char *lum2; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - row1 = (unsigned int *) out; - row2 = row1 + cols + mod; - lum2 = lum + cols; - - mod += cols + mod; - - y = rows / 2; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = *lum++; - *row1++ = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - - L = *lum++; - *row1++ = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - - - /* Now, do second row. */ - - L = *lum2++; - *row2++ = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - - L = *lum2++; - *row2++ = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - } - - /* - * These values are at the start of the next line, (due - * to the ++'s above),but they need to be at the start - * of the line after that. - */ - lum += cols; - lum2 += cols; - row1 += mod; - row2 += mod; - } -} - -/* - * In this function I make use of a nasty trick. The tables have the lower - * 16 bits replicated in the upper 16. This means I can write ints and get - * the horisontal doubling for free (almost). - */ -static void -Color16DitherYV12Mod2X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int *row1 = (unsigned int *) out; - const int next_row = cols + (mod / 2); - unsigned int *row2 = row1 + 2 * next_row; - unsigned char *lum2; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - lum2 = lum + cols; - - mod = (next_row * 3) + (mod / 2); - - y = rows / 2; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = *lum++; - row1[0] = row1[next_row] = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - row1++; - - L = *lum++; - row1[0] = row1[next_row] = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - row1++; - - - /* Now, do second row. */ - - L = *lum2++; - row2[0] = row2[next_row] = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - row2++; - - L = *lum2++; - row2[0] = row2[next_row] = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - row2++; - } - - /* - * These values are at the start of the next line, (due - * to the ++'s above),but they need to be at the start - * of the line after that. - */ - lum += cols; - lum2 += cols; - row1 += mod; - row2 += mod; - } -} - -static void -Color24DitherYV12Mod2X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int value; - unsigned char *row1 = out; - const int next_row = (cols * 2 + mod) * 3; - unsigned char *row2 = row1 + 2 * next_row; - unsigned char *lum2; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - lum2 = lum + cols; - - mod = next_row * 3 + mod * 3; - - y = rows / 2; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = *lum++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row1[0 + 0] = row1[3 + 0] = row1[next_row + 0] = - row1[next_row + 3 + 0] = (value) & 0xFF; - row1[0 + 1] = row1[3 + 1] = row1[next_row + 1] = - row1[next_row + 3 + 1] = (value >> 8) & 0xFF; - row1[0 + 2] = row1[3 + 2] = row1[next_row + 2] = - row1[next_row + 3 + 2] = (value >> 16) & 0xFF; - row1 += 2 * 3; - - L = *lum++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row1[0 + 0] = row1[3 + 0] = row1[next_row + 0] = - row1[next_row + 3 + 0] = (value) & 0xFF; - row1[0 + 1] = row1[3 + 1] = row1[next_row + 1] = - row1[next_row + 3 + 1] = (value >> 8) & 0xFF; - row1[0 + 2] = row1[3 + 2] = row1[next_row + 2] = - row1[next_row + 3 + 2] = (value >> 16) & 0xFF; - row1 += 2 * 3; - - - /* Now, do second row. */ - - L = *lum2++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row2[0 + 0] = row2[3 + 0] = row2[next_row + 0] = - row2[next_row + 3 + 0] = (value) & 0xFF; - row2[0 + 1] = row2[3 + 1] = row2[next_row + 1] = - row2[next_row + 3 + 1] = (value >> 8) & 0xFF; - row2[0 + 2] = row2[3 + 2] = row2[next_row + 2] = - row2[next_row + 3 + 2] = (value >> 16) & 0xFF; - row2 += 2 * 3; - - L = *lum2++; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row2[0 + 0] = row2[3 + 0] = row2[next_row + 0] = - row2[next_row + 3 + 0] = (value) & 0xFF; - row2[0 + 1] = row2[3 + 1] = row2[next_row + 1] = - row2[next_row + 3 + 1] = (value >> 8) & 0xFF; - row2[0 + 2] = row2[3 + 2] = row2[next_row + 2] = - row2[next_row + 3 + 2] = (value >> 16) & 0xFF; - row2 += 2 * 3; - } - - /* - * These values are at the start of the next line, (due - * to the ++'s above),but they need to be at the start - * of the line after that. - */ - lum += cols; - lum2 += cols; - row1 += mod; - row2 += mod; - } -} - -static void -Color32DitherYV12Mod2X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int *row1 = (unsigned int *) out; - const int next_row = cols * 2 + mod; - unsigned int *row2 = row1 + 2 * next_row; - unsigned char *lum2; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - lum2 = lum + cols; - - mod = (next_row * 3) + mod; - - y = rows / 2; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - ++cr; - ++cb; - - L = *lum++; - row1[0] = row1[1] = row1[next_row] = row1[next_row + 1] = - (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row1 += 2; - - L = *lum++; - row1[0] = row1[1] = row1[next_row] = row1[next_row + 1] = - (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row1 += 2; - - - /* Now, do second row. */ - - L = *lum2++; - row2[0] = row2[1] = row2[next_row] = row2[next_row + 1] = - (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row2 += 2; - - L = *lum2++; - row2[0] = row2[1] = row2[next_row] = row2[next_row + 1] = - (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row2 += 2; - } - - /* - * These values are at the start of the next line, (due - * to the ++'s above),but they need to be at the start - * of the line after that. - */ - lum += cols; - lum2 += cols; - row1 += mod; - row2 += mod; - } -} - -static void -Color16DitherYUY2Mod1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned short *row; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - row = (unsigned short *) out; - - y = rows; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - cr += 4; - cb += 4; - - L = *lum; - lum += 2; - *row++ = (unsigned short) (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - - L = *lum; - lum += 2; - *row++ = (unsigned short) (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - - } - - row += mod; - } -} - -static void -Color24DitherYUY2Mod1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int value; - unsigned char *row; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - row = (unsigned char *) out; - mod *= 3; - y = rows; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - cr += 4; - cb += 4; - - L = *lum; - lum += 2; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - *row++ = (value) & 0xFF; - *row++ = (value >> 8) & 0xFF; - *row++ = (value >> 16) & 0xFF; - - L = *lum; - lum += 2; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - *row++ = (value) & 0xFF; - *row++ = (value >> 8) & 0xFF; - *row++ = (value >> 16) & 0xFF; - - } - row += mod; - } -} - -static void -Color32DitherYUY2Mod1X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int *row; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - row = (unsigned int *) out; - y = rows; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - cr += 4; - cb += 4; - - L = *lum; - lum += 2; - *row++ = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - - L = *lum; - lum += 2; - *row++ = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - - - } - row += mod; - } -} - -/* - * In this function I make use of a nasty trick. The tables have the lower - * 16 bits replicated in the upper 16. This means I can write ints and get - * the horisontal doubling for free (almost). - */ -static void -Color16DitherYUY2Mod2X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int *row = (unsigned int *) out; - const int next_row = cols + (mod / 2); - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - - y = rows; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - cr += 4; - cb += 4; - - L = *lum; - lum += 2; - row[0] = row[next_row] = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - row++; - - L = *lum; - lum += 2; - row[0] = row[next_row] = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | - rgb_2_pix[L + cb_b]); - row++; - - } - row += next_row; - } -} - -static void -Color24DitherYUY2Mod2X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int value; - unsigned char *row = out; - const int next_row = (cols * 2 + mod) * 3; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - y = rows; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - cr += 4; - cb += 4; - - L = *lum; - lum += 2; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row[0 + 0] = row[3 + 0] = row[next_row + 0] = - row[next_row + 3 + 0] = (value) & 0xFF; - row[0 + 1] = row[3 + 1] = row[next_row + 1] = - row[next_row + 3 + 1] = (value >> 8) & 0xFF; - row[0 + 2] = row[3 + 2] = row[next_row + 2] = - row[next_row + 3 + 2] = (value >> 16) & 0xFF; - row += 2 * 3; - - L = *lum; - lum += 2; - value = (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row[0 + 0] = row[3 + 0] = row[next_row + 0] = - row[next_row + 3 + 0] = (value) & 0xFF; - row[0 + 1] = row[3 + 1] = row[next_row + 1] = - row[next_row + 3 + 1] = (value >> 8) & 0xFF; - row[0 + 2] = row[3 + 2] = row[next_row + 2] = - row[next_row + 3 + 2] = (value >> 16) & 0xFF; - row += 2 * 3; - - } - row += next_row; - } -} - -static void -Color32DitherYUY2Mod2X(int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod) -{ - unsigned int *row = (unsigned int *) out; - const int next_row = cols * 2 + mod; - int x, y; - int cr_r; - int crb_g; - int cb_b; - int cols_2 = cols / 2; - mod += mod; - y = rows; - while (y--) { - x = cols_2; - while (x--) { - register int L; - - cr_r = 0 * 768 + 256 + colortab[*cr + 0 * 256]; - crb_g = 1 * 768 + 256 + colortab[*cr + 1 * 256] - + colortab[*cb + 2 * 256]; - cb_b = 2 * 768 + 256 + colortab[*cb + 3 * 256]; - cr += 4; - cb += 4; - - L = *lum; - lum += 2; - row[0] = row[1] = row[next_row] = row[next_row + 1] = - (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row += 2; - - L = *lum; - lum += 2; - row[0] = row[1] = row[next_row] = row[next_row + 1] = - (rgb_2_pix[L + cr_r] | - rgb_2_pix[L + crb_g] | rgb_2_pix[L + cb_b]); - row += 2; - - - } - - row += next_row; - } -} - -/* - * How many 1 bits are there in the Uint32. - * Low performance, do not call often. - */ -static int -number_of_bits_set(Uint32 a) -{ - if (!a) - return 0; - if (a & 1) - return 1 + number_of_bits_set(a >> 1); - return (number_of_bits_set(a >> 1)); -} - -/* - * How many 0 bits are there at least significant end of Uint32. - * Low performance, do not call often. - */ -static int -free_bits_at_bottom(Uint32 a) -{ - /* assume char is 8 bits */ - if (!a) - return sizeof(Uint32) * 8; - if (((Sint32) a) & 1l) - return 0; - return 1 + free_bits_at_bottom(a >> 1); -} - -static int -SDL_SW_SetupYUVDisplay(SDL_SW_YUVTexture * swdata, Uint32 target_format) -{ - Uint32 *r_2_pix_alloc; - Uint32 *g_2_pix_alloc; - Uint32 *b_2_pix_alloc; - int i; - int bpp; - Uint32 Rmask, Gmask, Bmask, Amask; - - if (!SDL_PixelFormatEnumToMasks - (target_format, &bpp, &Rmask, &Gmask, &Bmask, &Amask) || bpp < 15) { - return SDL_SetError("Unsupported YUV destination format"); - } - - swdata->target_format = target_format; - r_2_pix_alloc = &swdata->rgb_2_pix[0 * 768]; - g_2_pix_alloc = &swdata->rgb_2_pix[1 * 768]; - b_2_pix_alloc = &swdata->rgb_2_pix[2 * 768]; - - /* - * Set up entries 0-255 in rgb-to-pixel value tables. - */ - for (i = 0; i < 256; ++i) { - r_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set(Rmask)); - r_2_pix_alloc[i + 256] <<= free_bits_at_bottom(Rmask); - r_2_pix_alloc[i + 256] |= Amask; - g_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set(Gmask)); - g_2_pix_alloc[i + 256] <<= free_bits_at_bottom(Gmask); - g_2_pix_alloc[i + 256] |= Amask; - b_2_pix_alloc[i + 256] = i >> (8 - number_of_bits_set(Bmask)); - b_2_pix_alloc[i + 256] <<= free_bits_at_bottom(Bmask); - b_2_pix_alloc[i + 256] |= Amask; - } - - /* - * If we have 16-bit output depth, then we double the value - * in the top word. This means that we can write out both - * pixels in the pixel doubling mode with one op. It is - * harmless in the normal case as storing a 32-bit value - * through a short pointer will lose the top bits anyway. - */ - if (SDL_BYTESPERPIXEL(target_format) == 2) { - for (i = 0; i < 256; ++i) { - r_2_pix_alloc[i + 256] |= (r_2_pix_alloc[i + 256]) << 16; - g_2_pix_alloc[i + 256] |= (g_2_pix_alloc[i + 256]) << 16; - b_2_pix_alloc[i + 256] |= (b_2_pix_alloc[i + 256]) << 16; - } - } - - /* - * Spread out the values we have to the rest of the array so that - * we do not need to check for overflow. - */ - for (i = 0; i < 256; ++i) { - r_2_pix_alloc[i] = r_2_pix_alloc[256]; - r_2_pix_alloc[i + 512] = r_2_pix_alloc[511]; - g_2_pix_alloc[i] = g_2_pix_alloc[256]; - g_2_pix_alloc[i + 512] = g_2_pix_alloc[511]; - b_2_pix_alloc[i] = b_2_pix_alloc[256]; - b_2_pix_alloc[i + 512] = b_2_pix_alloc[511]; - } - - /* You have chosen wisely... */ - switch (swdata->format) { - case SDL_PIXELFORMAT_YV12: - case SDL_PIXELFORMAT_IYUV: - if (SDL_BYTESPERPIXEL(target_format) == 2) { -#if (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES - /* inline assembly functions */ - if (SDL_HasMMX() && (Rmask == 0xF800) && - (Gmask == 0x07E0) && (Bmask == 0x001F) - && (swdata->w & 15) == 0) { -/* printf("Using MMX 16-bit 565 dither\n"); */ - swdata->Display1X = Color565DitherYV12MMX1X; - } else { -/* printf("Using C 16-bit dither\n"); */ - swdata->Display1X = Color16DitherYV12Mod1X; - } -#else - swdata->Display1X = Color16DitherYV12Mod1X; -#endif - swdata->Display2X = Color16DitherYV12Mod2X; - } - if (SDL_BYTESPERPIXEL(target_format) == 3) { - swdata->Display1X = Color24DitherYV12Mod1X; - swdata->Display2X = Color24DitherYV12Mod2X; - } - if (SDL_BYTESPERPIXEL(target_format) == 4) { -#if (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES - /* inline assembly functions */ - if (SDL_HasMMX() && (Rmask == 0x00FF0000) && - (Gmask == 0x0000FF00) && - (Bmask == 0x000000FF) && (swdata->w & 15) == 0) { -/* printf("Using MMX 32-bit dither\n"); */ - swdata->Display1X = ColorRGBDitherYV12MMX1X; - } else { -/* printf("Using C 32-bit dither\n"); */ - swdata->Display1X = Color32DitherYV12Mod1X; - } -#else - swdata->Display1X = Color32DitherYV12Mod1X; -#endif - swdata->Display2X = Color32DitherYV12Mod2X; - } - break; - case SDL_PIXELFORMAT_YUY2: - case SDL_PIXELFORMAT_UYVY: - case SDL_PIXELFORMAT_YVYU: - if (SDL_BYTESPERPIXEL(target_format) == 2) { - swdata->Display1X = Color16DitherYUY2Mod1X; - swdata->Display2X = Color16DitherYUY2Mod2X; - } - if (SDL_BYTESPERPIXEL(target_format) == 3) { - swdata->Display1X = Color24DitherYUY2Mod1X; - swdata->Display2X = Color24DitherYUY2Mod2X; - } - if (SDL_BYTESPERPIXEL(target_format) == 4) { - swdata->Display1X = Color32DitherYUY2Mod1X; - swdata->Display2X = Color32DitherYUY2Mod2X; - } - break; - default: - /* We should never get here (caught above) */ - break; - } - - SDL_FreeSurface(swdata->display); - swdata->display = NULL; - return 0; -} - SDL_SW_YUVTexture * SDL_SW_CreateYUVTexture(Uint32 format, int w, int h) { SDL_SW_YUVTexture *swdata; - int *Cr_r_tab; - int *Cr_g_tab; - int *Cb_g_tab; - int *Cb_b_tab; - int i; - int CR, CB; switch (format) { case SDL_PIXELFORMAT_YV12: @@ -1034,6 +38,8 @@ SDL_SW_CreateYUVTexture(Uint32 format, int w, int h) case SDL_PIXELFORMAT_YUY2: case SDL_PIXELFORMAT_UYVY: case SDL_PIXELFORMAT_YVYU: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: break; default: SDL_SetError("Unsupported YUV format"); @@ -1050,48 +56,67 @@ SDL_SW_CreateYUVTexture(Uint32 format, int w, int h) swdata->target_format = SDL_PIXELFORMAT_UNKNOWN; swdata->w = w; swdata->h = h; - swdata->pixels = (Uint8 *) SDL_malloc(w * h * 2); - swdata->colortab = (int *) SDL_malloc(4 * 256 * sizeof(int)); - swdata->rgb_2_pix = (Uint32 *) SDL_malloc(3 * 768 * sizeof(Uint32)); - if (!swdata->pixels || !swdata->colortab || !swdata->rgb_2_pix) { - SDL_SW_DestroyYUVTexture(swdata); - SDL_OutOfMemory(); - return NULL; + { + const int sz_plane = w * h; + const int sz_plane_chroma = ((w + 1) / 2) * ((h + 1) / 2); + const int sz_plane_packed = ((w + 1) / 2) * h; + int dst_size = 0; + switch(format) + { + case SDL_PIXELFORMAT_YV12: /**< Planar mode: Y + V + U (3 planes) */ + case SDL_PIXELFORMAT_IYUV: /**< Planar mode: Y + U + V (3 planes) */ + dst_size = sz_plane + sz_plane_chroma + sz_plane_chroma; + break; + + case SDL_PIXELFORMAT_YUY2: /**< Packed mode: Y0+U0+Y1+V0 (1 plane) */ + case SDL_PIXELFORMAT_UYVY: /**< Packed mode: U0+Y0+V0+Y1 (1 plane) */ + case SDL_PIXELFORMAT_YVYU: /**< Packed mode: Y0+V0+Y1+U0 (1 plane) */ + dst_size = 4 * sz_plane_packed; + break; + + case SDL_PIXELFORMAT_NV12: /**< Planar mode: Y + U/V interleaved (2 planes) */ + case SDL_PIXELFORMAT_NV21: /**< Planar mode: Y + V/U interleaved (2 planes) */ + dst_size = sz_plane + sz_plane_chroma + sz_plane_chroma; + break; + + default: + SDL_assert(0 && "We should never get here (caught above)"); + break; + } + swdata->pixels = (Uint8 *) SDL_malloc(dst_size); + if (!swdata->pixels) { + SDL_SW_DestroyYUVTexture(swdata); + SDL_OutOfMemory(); + return NULL; + } } - /* Generate the tables for the display surface */ - Cr_r_tab = &swdata->colortab[0 * 256]; - Cr_g_tab = &swdata->colortab[1 * 256]; - Cb_g_tab = &swdata->colortab[2 * 256]; - Cb_b_tab = &swdata->colortab[3 * 256]; - for (i = 0; i < 256; i++) { - /* Gamma correction (luminescence table) and chroma correction - would be done here. See the Berkeley mpeg_play sources. - */ - CB = CR = (i - 128); - Cr_r_tab[i] = (int) ((0.419 / 0.299) * CR); - Cr_g_tab[i] = (int) (-(0.299 / 0.419) * CR); - Cb_g_tab[i] = (int) (-(0.114 / 0.331) * CB); - Cb_b_tab[i] = (int) ((0.587 / 0.331) * CB); - } - - /* Find the pitch and offset values for the overlay */ + /* Find the pitch and offset values for the texture */ switch (format) { case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_IYUV: swdata->pitches[0] = w; - swdata->pitches[1] = swdata->pitches[0] / 2; - swdata->pitches[2] = swdata->pitches[0] / 2; + swdata->pitches[1] = (swdata->pitches[0] + 1) / 2; + swdata->pitches[2] = (swdata->pitches[0] + 1) / 2; swdata->planes[0] = swdata->pixels; swdata->planes[1] = swdata->planes[0] + swdata->pitches[0] * h; - swdata->planes[2] = swdata->planes[1] + swdata->pitches[1] * h / 2; + swdata->planes[2] = swdata->planes[1] + swdata->pitches[1] * ((h + 1) / 2); break; case SDL_PIXELFORMAT_YUY2: case SDL_PIXELFORMAT_UYVY: case SDL_PIXELFORMAT_YVYU: - swdata->pitches[0] = w * 2; + swdata->pitches[0] = ((w + 1) / 2) * 4; swdata->planes[0] = swdata->pixels; break; + + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + swdata->pitches[0] = w; + swdata->pitches[1] = 2 * ((swdata->pitches[0] + 1) / 2); + swdata->planes[0] = swdata->pixels; + swdata->planes[1] = swdata->planes[0] + swdata->pitches[0] * h; + break; + default: SDL_assert(0 && "We should never get here (caught above)"); break; @@ -1120,7 +145,7 @@ SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, if (rect->x == 0 && rect->y == 0 && rect->w == swdata->w && rect->h == swdata->h) { SDL_memcpy(swdata->pixels, pixels, - (swdata->h * swdata->w) + (swdata->h * swdata->w) / 2); + (swdata->h * swdata->w) + 2* ((swdata->h + 1) /2) * ((swdata->w + 1) / 2)); } else { Uint8 *src, *dst; int row; @@ -1135,28 +160,28 @@ SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, src += pitch; dst += swdata->w; } - + /* Copy the next plane */ src = (Uint8 *) pixels + rect->h * pitch; dst = swdata->pixels + swdata->h * swdata->w; - dst += rect->y/2 * swdata->w/2 + rect->x/2; - length = rect->w / 2; - for (row = 0; row < rect->h/2; ++row) { + dst += rect->y/2 * ((swdata->w + 1) / 2) + rect->x/2; + length = (rect->w + 1) / 2; + for (row = 0; row < (rect->h + 1)/2; ++row) { SDL_memcpy(dst, src, length); - src += pitch/2; - dst += swdata->w/2; + src += (pitch + 1)/2; + dst += (swdata->w + 1)/2; } /* Copy the next plane */ - src = (Uint8 *) pixels + rect->h * pitch + (rect->h * pitch) / 4; + src = (Uint8 *) pixels + rect->h * pitch + ((rect->h + 1) / 2) * ((pitch + 1) / 2); dst = swdata->pixels + swdata->h * swdata->w + - (swdata->h * swdata->w) / 4; - dst += rect->y/2 * swdata->w/2 + rect->x/2; - length = rect->w / 2; - for (row = 0; row < rect->h/2; ++row) { + ((swdata->h + 1)/2) * ((swdata->w+1) / 2); + dst += rect->y/2 * ((swdata->w + 1)/2) + rect->x/2; + length = (rect->w + 1) / 2; + for (row = 0; row < (rect->h + 1)/2; ++row) { SDL_memcpy(dst, src, length); - src += pitch/2; - dst += swdata->w/2; + src += (pitch + 1)/2; + dst += (swdata->w + 1)/2; } } break; @@ -1172,7 +197,7 @@ SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, dst = swdata->planes[0] + rect->y * swdata->pitches[0] + rect->x * 2; - length = rect->w * 2; + length = 4 * ((rect->w + 1) / 2); for (row = 0; row < rect->h; ++row) { SDL_memcpy(dst, src, length); src += pitch; @@ -1180,6 +205,40 @@ SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, } } break; + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + { + if (rect->x == 0 && rect->y == 0 && rect->w == swdata->w && rect->h == swdata->h) { + SDL_memcpy(swdata->pixels, pixels, + (swdata->h * swdata->w) + 2* ((swdata->h + 1) /2) * ((swdata->w + 1) / 2)); + } else { + + Uint8 *src, *dst; + int row; + size_t length; + + /* Copy the Y plane */ + src = (Uint8 *) pixels; + dst = swdata->pixels + rect->y * swdata->w + rect->x; + length = rect->w; + for (row = 0; row < rect->h; ++row) { + SDL_memcpy(dst, src, length); + src += pitch; + dst += swdata->w; + } + + /* Copy the next plane */ + src = (Uint8 *) pixels + rect->h * pitch; + dst = swdata->pixels + swdata->h * swdata->w; + dst += 2 * ((rect->y + 1)/2) * ((swdata->w + 1) / 2) + 2 * (rect->x/2); + length = 2 * ((rect->w + 1) / 2); + for (row = 0; row < (rect->h + 1)/2; ++row) { + SDL_memcpy(dst, src, length); + src += 2 * ((pitch + 1)/2); + dst += 2 * ((swdata->w + 1)/2); + } + } + } } return 0; } @@ -1211,14 +270,14 @@ SDL_SW_UpdateYUVTexturePlanar(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, dst = swdata->pixels + swdata->h * swdata->w; } else { dst = swdata->pixels + swdata->h * swdata->w + - (swdata->h * swdata->w) / 4; + ((swdata->h + 1) / 2) * ((swdata->w + 1) / 2); } - dst += rect->y/2 * swdata->w/2 + rect->x/2; - length = rect->w / 2; - for (row = 0; row < rect->h/2; ++row) { + dst += rect->y/2 * ((swdata->w + 1)/2) + rect->x/2; + length = (rect->w + 1) / 2; + for (row = 0; row < (rect->h + 1)/2; ++row) { SDL_memcpy(dst, src, length); src += Upitch; - dst += swdata->w/2; + dst += (swdata->w + 1)/2; } /* Copy the V plane */ @@ -1227,14 +286,14 @@ SDL_SW_UpdateYUVTexturePlanar(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, dst = swdata->pixels + swdata->h * swdata->w; } else { dst = swdata->pixels + swdata->h * swdata->w + - (swdata->h * swdata->w) / 4; + ((swdata->h + 1) / 2) * ((swdata->w + 1) / 2); } - dst += rect->y/2 * swdata->w/2 + rect->x/2; - length = rect->w / 2; - for (row = 0; row < rect->h/2; ++row) { + dst += rect->y/2 * ((swdata->w + 1)/2) + rect->x/2; + length = (rect->w + 1) / 2; + for (row = 0; row < (rect->h + 1)/2; ++row) { SDL_memcpy(dst, src, length); src += Vpitch; - dst += swdata->w/2; + dst += (swdata->w + 1)/2; } return 0; } @@ -1246,11 +305,13 @@ SDL_SW_LockYUVTexture(SDL_SW_YUVTexture * swdata, const SDL_Rect * rect, switch (swdata->format) { case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: if (rect && (rect->x != 0 || rect->y != 0 || rect->w != swdata->w || rect->h != swdata->h)) { return SDL_SetError - ("YV12 and IYUV textures only support full surface locks"); + ("YV12, IYUV, NV12, NV21 textures only support full surface locks"); } break; } @@ -1274,27 +335,16 @@ SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect, Uint32 target_format, int w, int h, void *pixels, int pitch) { - const int targetbpp = SDL_BYTESPERPIXEL(target_format); int stretch; - int scale_2x; - Uint8 *lum, *Cr, *Cb; - int mod; - - if (targetbpp == 0) { - return SDL_SetError("Invalid target pixel format"); - } /* Make sure we're set up to display in the desired format */ - if (target_format != swdata->target_format) { - if (SDL_SW_SetupYUVDisplay(swdata, target_format) < 0) { - return -1; - } + if (target_format != swdata->target_format && swdata->display) { + SDL_FreeSurface(swdata->display); + swdata->display = NULL; } stretch = 0; - scale_2x = 0; - if (srcrect->x || srcrect->y || srcrect->w < swdata->w - || srcrect->h < swdata->h) { + if (srcrect->x || srcrect->y || srcrect->w < swdata->w || srcrect->h < swdata->h) { /* The source rectangle has been clipped. Using a scratch surface is easier than adding clipped source support to all the blitters, plus that would @@ -1302,11 +352,7 @@ SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect, */ stretch = 1; } else if ((srcrect->w != w) || (srcrect->h != h)) { - if ((w == 2 * srcrect->w) && (h == 2 * srcrect->h)) { - scale_2x = 1; - } else { - stretch = 1; - } + stretch = 1; } if (stretch) { int bpp; @@ -1342,45 +388,10 @@ SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect, pixels = swdata->stretch->pixels; pitch = swdata->stretch->pitch; } - switch (swdata->format) { - case SDL_PIXELFORMAT_YV12: - lum = swdata->planes[0]; - Cr = swdata->planes[1]; - Cb = swdata->planes[2]; - break; - case SDL_PIXELFORMAT_IYUV: - lum = swdata->planes[0]; - Cr = swdata->planes[2]; - Cb = swdata->planes[1]; - break; - case SDL_PIXELFORMAT_YUY2: - lum = swdata->planes[0]; - Cr = lum + 3; - Cb = lum + 1; - break; - case SDL_PIXELFORMAT_UYVY: - lum = swdata->planes[0] + 1; - Cr = lum + 1; - Cb = lum - 1; - break; - case SDL_PIXELFORMAT_YVYU: - lum = swdata->planes[0]; - Cr = lum + 1; - Cb = lum + 3; - break; - default: - return SDL_SetError("Unsupported YUV format in copy"); - } - mod = (pitch / targetbpp); - - if (scale_2x) { - mod -= (swdata->w * 2); - swdata->Display2X(swdata->colortab, swdata->rgb_2_pix, - lum, Cr, Cb, pixels, swdata->h, swdata->w, mod); - } else { - mod -= swdata->w; - swdata->Display1X(swdata->colortab, swdata->rgb_2_pix, - lum, Cr, Cb, pixels, swdata->h, swdata->w, mod); + if (SDL_ConvertPixels(swdata->w, swdata->h, swdata->format, + swdata->planes[0], swdata->pitches[0], + target_format, pixels, pitch) < 0) { + return -1; } if (stretch) { SDL_Rect rect = *srcrect; @@ -1394,8 +405,6 @@ SDL_SW_DestroyYUVTexture(SDL_SW_YUVTexture * swdata) { if (swdata) { SDL_free(swdata->pixels); - SDL_free(swdata->colortab); - SDL_free(swdata->rgb_2_pix); SDL_FreeSurface(swdata->stretch); SDL_FreeSurface(swdata->display); SDL_free(swdata); diff --git a/Engine/lib/sdl/src/render/SDL_yuv_sw_c.h b/Engine/lib/sdl/src/render/SDL_yuv_sw_c.h index 2752096f4..0dfb5db7f 100644 --- a/Engine/lib/sdl/src/render/SDL_yuv_sw_c.h +++ b/Engine/lib/sdl/src/render/SDL_yuv_sw_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,16 +30,6 @@ struct SDL_SW_YUVTexture Uint32 target_format; int w, h; Uint8 *pixels; - int *colortab; - Uint32 *rgb_2_pix; - void (*Display1X) (int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod); - void (*Display2X) (int *colortab, Uint32 * rgb_2_pix, - unsigned char *lum, unsigned char *cr, - unsigned char *cb, unsigned char *out, - int rows, int cols, int mod); /* These are just so we don't have to allocate them separately */ Uint16 pitches[3]; @@ -69,4 +59,9 @@ int SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect, int pitch); void SDL_SW_DestroyYUVTexture(SDL_SW_YUVTexture * swdata); +/* FIXME: This breaks on various versions of GCC and should be rewritten using intrinsics */ +#if 0 /* (__GNUC__ > 2) && defined(__i386__) && __OPTIMIZE__ && SDL_ASSEMBLY_ROUTINES && !defined(__clang__) */ +#define USE_MMX_ASSEMBLY 1 +#endif + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/direct3d/SDL_render_d3d.c b/Engine/lib/sdl/src/render/direct3d/SDL_render_d3d.c index 151dbbf04..d3be57132 100644 --- a/Engine/lib/sdl/src/render/direct3d/SDL_render_d3d.c +++ b/Engine/lib/sdl/src/render/direct3d/SDL_render_d3d.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -39,85 +39,7 @@ #include #endif - -#ifdef ASSEMBLE_SHADER -#pragma comment(lib, "d3dx9.lib") - -/************************************************************************** - * ID3DXBuffer: - * ------------ - * The buffer object is used by D3DX to return arbitrary size data. - * - * GetBufferPointer - - * Returns a pointer to the beginning of the buffer. - * - * GetBufferSize - - * Returns the size of the buffer, in bytes. - **************************************************************************/ - -typedef interface ID3DXBuffer ID3DXBuffer; -typedef interface ID3DXBuffer *LPD3DXBUFFER; - -/* {8BA5FB08-5195-40e2-AC58-0D989C3A0102} */ -DEFINE_GUID(IID_ID3DXBuffer, -0x8ba5fb08, 0x5195, 0x40e2, 0xac, 0x58, 0xd, 0x98, 0x9c, 0x3a, 0x1, 0x2); - -#undef INTERFACE -#define INTERFACE ID3DXBuffer - -typedef interface ID3DXBuffer { - const struct ID3DXBufferVtbl FAR* lpVtbl; -} ID3DXBuffer; -typedef const struct ID3DXBufferVtbl ID3DXBufferVtbl; -const struct ID3DXBufferVtbl -{ - /* IUnknown */ - STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE; - STDMETHOD_(ULONG, AddRef)(THIS) PURE; - STDMETHOD_(ULONG, Release)(THIS) PURE; - - /* ID3DXBuffer */ - STDMETHOD_(LPVOID, GetBufferPointer)(THIS) PURE; - STDMETHOD_(DWORD, GetBufferSize)(THIS) PURE; -}; - -HRESULT WINAPI - D3DXAssembleShader( - LPCSTR pSrcData, - UINT SrcDataLen, - CONST LPVOID* pDefines, - LPVOID pInclude, - DWORD Flags, - LPD3DXBUFFER* ppShader, - LPD3DXBUFFER* ppErrorMsgs); - -static void PrintShaderData(LPDWORD shader_data, DWORD shader_size) -{ - OutputDebugStringA("const DWORD shader_data[] = {\n\t"); - { - SDL_bool newline = SDL_FALSE; - unsigned i; - for (i = 0; i < shader_size / sizeof(DWORD); ++i) { - char dword[11]; - if (i > 0) { - if ((i%6) == 0) { - newline = SDL_TRUE; - } - if (newline) { - OutputDebugStringA(",\n "); - newline = SDL_FALSE; - } else { - OutputDebugStringA(", "); - } - } - SDL_snprintf(dword, sizeof(dword), "0x%8.8x", shader_data[i]); - OutputDebugStringA(dword); - } - OutputDebugStringA("\n};\n"); - } -} - -#endif /* ASSEMBLE_SHADER */ +#include "SDL_shaders_d3d.h" /* Direct3D renderer implementation */ @@ -125,6 +47,7 @@ static void PrintShaderData(LPDWORD shader_data, DWORD shader_size) static SDL_Renderer *D3D_CreateRenderer(SDL_Window * window, Uint32 flags); static void D3D_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event); +static SDL_bool D3D_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode); static int D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int D3D_RecreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, @@ -187,7 +110,7 @@ typedef struct IDirect3DSurface9 *defaultRenderTarget; IDirect3DSurface9 *currentRenderTarget; void* d3dxDLL; - LPDIRECT3DPIXELSHADER9 ps_yuv; + LPDIRECT3DPIXELSHADER9 shaders[NUM_SHADERS]; } D3D_RenderData; typedef struct @@ -196,6 +119,7 @@ typedef struct int w, h; DWORD usage; Uint32 format; + D3DFORMAT d3dfmt; IDirect3DTexture9 *texture; IDirect3DTexture9 *staging; } D3D_TextureRep; @@ -312,6 +236,8 @@ PixelFormatToD3DFMT(Uint32 format) return D3DFMT_A8R8G8B8; case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: return D3DFMT_L8; default: return D3DFMT_UNKNOWN; @@ -542,6 +468,7 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) } renderer->WindowEvent = D3D_WindowEvent; + renderer->SupportsBlendMode = D3D_SupportsBlendMode; renderer->CreateTexture = D3D_CreateTexture; renderer->UpdateTexture = D3D_UpdateTexture; renderer->UpdateTextureYUV = D3D_UpdateTextureYUV; @@ -659,136 +586,19 @@ D3D_CreateRenderer(SDL_Window * window, Uint32 flags) /* Set up parameters for rendering */ D3D_InitRenderState(data); - if (caps.MaxSimultaneousTextures >= 3) - { -#ifdef ASSEMBLE_SHADER - /* This shader was created by running the following HLSL through the fxc compiler - and then tuning the generated assembly. - - fxc /T fx_4_0 /O3 /Gfa /Fc yuv.fxc yuv.fx - - --- yuv.fx --- - Texture2D g_txY; - Texture2D g_txU; - Texture2D g_txV; - - SamplerState samLinear - { - Filter = ANISOTROPIC; - AddressU = Clamp; - AddressV = Clamp; - MaxAnisotropy = 1; - }; - - struct VS_OUTPUT - { - float2 TextureUV : TEXCOORD0; - }; - - struct PS_OUTPUT - { - float4 RGBAColor : SV_Target; - }; - - PS_OUTPUT YUV420( VS_OUTPUT In ) - { - const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; - const float3 Rcoeff = {1.164, 0.000, 1.596}; - const float3 Gcoeff = {1.164, -0.391, -0.813}; - const float3 Bcoeff = {1.164, 2.018, 0.000}; - - PS_OUTPUT Output; - float2 TextureUV = In.TextureUV; - - float3 yuv; - yuv.x = g_txY.Sample( samLinear, TextureUV ).r; - yuv.y = g_txU.Sample( samLinear, TextureUV ).r; - yuv.z = g_txV.Sample( samLinear, TextureUV ).r; - - yuv += offset; - Output.RGBAColor.r = dot(yuv, Rcoeff); - Output.RGBAColor.g = dot(yuv, Gcoeff); - Output.RGBAColor.b = dot(yuv, Bcoeff); - Output.RGBAColor.a = 1.0f; - - return Output; - } - - technique10 RenderYUV420 - { - pass P0 - { - SetPixelShader( CompileShader( ps_4_0_level_9_0, YUV420() ) ); - } - } - */ - const char *shader_text = - "ps_2_0\n" - "def c0, -0.0627451017, -0.501960814, -0.501960814, 1\n" - "def c1, 1.16400003, 0, 1.59599996, 0\n" - "def c2, 1.16400003, -0.391000003, -0.813000023, 0\n" - "def c3, 1.16400003, 2.01799989, 0, 0\n" - "dcl t0.xy\n" - "dcl v0.xyzw\n" - "dcl_2d s0\n" - "dcl_2d s1\n" - "dcl_2d s2\n" - "texld r0, t0, s0\n" - "texld r1, t0, s1\n" - "texld r2, t0, s2\n" - "mov r0.y, r1.x\n" - "mov r0.z, r2.x\n" - "add r0.xyz, r0, c0\n" - "dp3 r1.x, r0, c1\n" - "dp3 r1.y, r0, c2\n" - "dp2add r1.z, r0, c3, c3.z\n" /* Logically this is "dp3 r1.z, r0, c3" but the optimizer did its magic */ - "mov r1.w, c0.w\n" - "mul r0, r1, v0\n" /* Not in the HLSL, multiply by vertex color */ - "mov oC0, r0\n" - ; - LPD3DXBUFFER pCode; - LPD3DXBUFFER pErrorMsgs; - LPDWORD shader_data = NULL; - DWORD shader_size = 0; - result = D3DXAssembleShader(shader_text, SDL_strlen(shader_text), NULL, NULL, 0, &pCode, &pErrorMsgs); - if (!FAILED(result)) { - shader_data = (DWORD*)pCode->lpVtbl->GetBufferPointer(pCode); - shader_size = pCode->lpVtbl->GetBufferSize(pCode); - PrintShaderData(shader_data, shader_size); - } else { - const char *error = (const char *)pErrorMsgs->lpVtbl->GetBufferPointer(pErrorMsgs); - SDL_SetError("Couldn't assemble shader: %s", error); - } -#else - const DWORD shader_data[] = { - 0xffff0200, 0x05000051, 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, - 0x3f800000, 0x05000051, 0xa00f0001, 0x3f94fdf4, 0x00000000, 0x3fcc49ba, - 0x00000000, 0x05000051, 0xa00f0002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, - 0x00000000, 0x05000051, 0xa00f0003, 0x3f94fdf4, 0x400126e9, 0x00000000, - 0x00000000, 0x0200001f, 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, - 0x900f0000, 0x0200001f, 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, - 0xa00f0801, 0x0200001f, 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, - 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, - 0x03000042, 0x800f0002, 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, - 0x80000001, 0x02000001, 0x80040000, 0x80000002, 0x03000002, 0x80070000, - 0x80e40000, 0xa0e40000, 0x03000008, 0x80010001, 0x80e40000, 0xa0e40001, - 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, - 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, - 0x03000005, 0x800f0000, 0x80e40001, 0x90e40000, 0x02000001, 0x800f0800, - 0x80e40000, 0x0000ffff - }; -#endif - if (shader_data != NULL) { - result = IDirect3DDevice9_CreatePixelShader(data->device, shader_data, &data->ps_yuv); - if (!FAILED(result)) { - renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12; - renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV; - } else { + if (caps.MaxSimultaneousTextures >= 3) { + int i; + for (i = 0; i < SDL_arraysize(data->shaders); ++i) { + result = D3D9_CreatePixelShader(data->device, (D3D9_Shader)i, &data->shaders[i]); + if (FAILED(result)) { D3D_SetError("CreatePixelShader()", result); } } + if (data->shaders[SHADER_YUV_JPEG] && data->shaders[SHADER_YUV_BT601] && data->shaders[SHADER_YUV_BT709]) { + renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12; + renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV; + } } - return renderer; } @@ -802,6 +612,58 @@ D3D_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) } } +static D3DBLEND GetBlendFunc(SDL_BlendFactor factor) +{ + switch (factor) { + case SDL_BLENDFACTOR_ZERO: + return D3DBLEND_ZERO; + case SDL_BLENDFACTOR_ONE: + return D3DBLEND_ONE; + case SDL_BLENDFACTOR_SRC_COLOR: + return D3DBLEND_SRCCOLOR; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: + return D3DBLEND_INVSRCCOLOR; + case SDL_BLENDFACTOR_SRC_ALPHA: + return D3DBLEND_SRCALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: + return D3DBLEND_INVSRCALPHA; + case SDL_BLENDFACTOR_DST_COLOR: + return D3DBLEND_DESTCOLOR; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: + return D3DBLEND_INVDESTCOLOR; + case SDL_BLENDFACTOR_DST_ALPHA: + return D3DBLEND_DESTALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: + return D3DBLEND_INVDESTALPHA; + default: + return (D3DBLEND)0; + } +} + +static SDL_bool +D3D_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (!GetBlendFunc(srcColorFactor) || !GetBlendFunc(srcAlphaFactor) || + !GetBlendFunc(dstColorFactor) || !GetBlendFunc(dstAlphaFactor)) { + return SDL_FALSE; + } + if ((srcColorFactor != srcAlphaFactor || dstColorFactor != dstAlphaFactor) && !data->enableSeparateAlphaBlend) { + return SDL_FALSE; + } + if (colorOperation != SDL_BLENDOPERATION_ADD || alphaOperation != SDL_BLENDOPERATION_ADD) { + return SDL_FALSE; + } + return SDL_TRUE; +} + static D3DTEXTUREFILTERTYPE GetScaleQuality(void) { @@ -815,7 +677,7 @@ GetScaleQuality(void) } static int -D3D_CreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD usage, Uint32 format, int w, int h) +D3D_CreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD usage, Uint32 format, D3DFORMAT d3dfmt, int w, int h) { HRESULT result; @@ -824,6 +686,7 @@ D3D_CreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD us texture->h = h; texture->usage = usage; texture->format = format; + texture->d3dfmt = d3dfmt; result = IDirect3DDevice9_CreateTexture(device, w, h, 1, usage, PixelFormatToD3DFMT(format), @@ -842,8 +705,7 @@ D3D_CreateStagingTexture(IDirect3DDevice9 *device, D3D_TextureRep *texture) if (texture->staging == NULL) { result = IDirect3DDevice9_CreateTexture(device, texture->w, texture->h, 1, 0, - PixelFormatToD3DFMT(texture->format), - D3DPOOL_SYSTEMMEM, &texture->staging, NULL); + texture->d3dfmt, D3DPOOL_SYSTEMMEM, &texture->staging, NULL); if (FAILED(result)) { return D3D_SetError("CreateTexture(D3DPOOL_SYSTEMMEM)", result); } @@ -879,7 +741,7 @@ D3D_BindTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, DWORD samp } static int -D3D_RecreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, Uint32 format, int w, int h) +D3D_RecreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture) { if (texture->texture) { IDirect3DTexture9_Release(texture->texture); @@ -893,7 +755,7 @@ D3D_RecreateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, Uint32 } static int -D3D_UpdateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, Uint32 format, int x, int y, int w, int h, const void *pixels, int pitch) +D3D_UpdateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, int x, int y, int w, int h, const void *pixels, int pitch) { RECT d3drect; D3DLOCKED_RECT locked; @@ -917,8 +779,8 @@ D3D_UpdateTextureRep(IDirect3DDevice9 *device, D3D_TextureRep *texture, Uint32 f } src = (const Uint8 *)pixels; - dst = locked.pBits; - length = w * SDL_BYTESPERPIXEL(format); + dst = (Uint8 *)locked.pBits; + length = w * SDL_BYTESPERPIXEL(texture->format); if (length == pitch && length == locked.Pitch) { SDL_memcpy(dst, src, length*h); } else { @@ -977,7 +839,7 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) usage = 0; } - if (D3D_CreateTextureRep(data->device, &texturedata->texture, usage, texture->format, texture->w, texture->h) < 0) { + if (D3D_CreateTextureRep(data->device, &texturedata->texture, usage, texture->format, PixelFormatToD3DFMT(texture->format), texture->w, texture->h) < 0) { return -1; } @@ -985,11 +847,11 @@ D3D_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) texture->format == SDL_PIXELFORMAT_IYUV) { texturedata->yuv = SDL_TRUE; - if (D3D_CreateTextureRep(data->device, &texturedata->utexture, usage, texture->format, texture->w / 2, texture->h / 2) < 0) { + if (D3D_CreateTextureRep(data->device, &texturedata->utexture, usage, texture->format, PixelFormatToD3DFMT(texture->format), (texture->w + 1) / 2, (texture->h + 1) / 2) < 0) { return -1; } - if (D3D_CreateTextureRep(data->device, &texturedata->vtexture, usage, texture->format, texture->w / 2, texture->h / 2) < 0) { + if (D3D_CreateTextureRep(data->device, &texturedata->vtexture, usage, texture->format, PixelFormatToD3DFMT(texture->format), (texture->w + 1) / 2, (texture->h + 1) / 2) < 0) { return -1; } } @@ -1006,16 +868,16 @@ D3D_RecreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) return 0; } - if (D3D_RecreateTextureRep(data->device, &texturedata->texture, texture->format, texture->w, texture->h) < 0) { + if (D3D_RecreateTextureRep(data->device, &texturedata->texture) < 0) { return -1; } if (texturedata->yuv) { - if (D3D_RecreateTextureRep(data->device, &texturedata->utexture, texture->format, texture->w / 2, texture->h / 2) < 0) { + if (D3D_RecreateTextureRep(data->device, &texturedata->utexture) < 0) { return -1; } - if (D3D_RecreateTextureRep(data->device, &texturedata->vtexture, texture->format, texture->w / 2, texture->h / 2) < 0) { + if (D3D_RecreateTextureRep(data->device, &texturedata->vtexture) < 0) { return -1; } } @@ -1034,7 +896,7 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - if (D3D_UpdateTextureRep(data->device, &texturedata->texture, texture->format, rect->x, rect->y, rect->w, rect->h, pixels, pitch) < 0) { + if (D3D_UpdateTextureRep(data->device, &texturedata->texture, rect->x, rect->y, rect->w, rect->h, pixels, pitch) < 0) { return -1; } @@ -1042,13 +904,13 @@ D3D_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, /* Skip to the correct offset into the next texture */ pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); - if (D3D_UpdateTextureRep(data->device, texture->format == SDL_PIXELFORMAT_YV12 ? &texturedata->vtexture : &texturedata->utexture, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, pixels, pitch / 2) < 0) { + if (D3D_UpdateTextureRep(data->device, texture->format == SDL_PIXELFORMAT_YV12 ? &texturedata->vtexture : &texturedata->utexture, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, pixels, (pitch + 1) / 2) < 0) { return -1; } /* Skip to the correct offset into the next texture */ - pixels = (const void*)((const Uint8*)pixels + (rect->h * pitch)/4); - if (D3D_UpdateTextureRep(data->device, texture->format == SDL_PIXELFORMAT_YV12 ? &texturedata->utexture : &texturedata->vtexture, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, pixels, pitch / 2) < 0) { + pixels = (const void*)((const Uint8*)pixels + ((rect->h + 1) / 2) * ((pitch + 1) / 2)); + if (D3D_UpdateTextureRep(data->device, texture->format == SDL_PIXELFORMAT_YV12 ? &texturedata->utexture : &texturedata->vtexture, rect->x / 2, (rect->y + 1) / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, pixels, (pitch + 1) / 2) < 0) { return -1; } } @@ -1070,13 +932,13 @@ D3D_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - if (D3D_UpdateTextureRep(data->device, &texturedata->texture, texture->format, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) { + if (D3D_UpdateTextureRep(data->device, &texturedata->texture, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) { return -1; } - if (D3D_UpdateTextureRep(data->device, &texturedata->utexture, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Uplane, Upitch) < 0) { + if (D3D_UpdateTextureRep(data->device, &texturedata->utexture, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, Uplane, Upitch) < 0) { return -1; } - if (D3D_UpdateTextureRep(data->device, &texturedata->vtexture, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Vplane, Vpitch) < 0) { + if (D3D_UpdateTextureRep(data->device, &texturedata->vtexture, rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, Vplane, Vpitch) < 0) { return -1; } return 0; @@ -1215,7 +1077,9 @@ D3D_SetRenderTargetInternal(SDL_Renderer * renderer, SDL_Texture * texture) static int D3D_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) { - D3D_ActivateRenderer(renderer); + if (D3D_ActivateRenderer(renderer) < 0) { + return -1; + } return D3D_SetRenderTargetInternal(renderer, texture); } @@ -1353,55 +1217,22 @@ D3D_RenderClear(SDL_Renderer * renderer) } static void -D3D_SetBlendMode(D3D_RenderData * data, int blendMode) +D3D_SetBlendMode(D3D_RenderData * data, SDL_BlendMode blendMode) { - switch (blendMode) { - case SDL_BLENDMODE_NONE: - IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, - FALSE); - break; - case SDL_BLENDMODE_BLEND: - IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, - TRUE); + if (blendMode == SDL_BLENDMODE_NONE) { + IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, FALSE); + } else { + IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, TRUE); IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND, - D3DBLEND_SRCALPHA); + GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode))); IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND, - D3DBLEND_INVSRCALPHA); + GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode))); if (data->enableSeparateAlphaBlend) { IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLENDALPHA, - D3DBLEND_ONE); + GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blendMode))); IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLENDALPHA, - D3DBLEND_INVSRCALPHA); + GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blendMode))); } - break; - case SDL_BLENDMODE_ADD: - IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, - TRUE); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND, - D3DBLEND_SRCALPHA); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND, - D3DBLEND_ONE); - if (data->enableSeparateAlphaBlend) { - IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLENDALPHA, - D3DBLEND_ZERO); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLENDALPHA, - D3DBLEND_ONE); - } - break; - case SDL_BLENDMODE_MOD: - IDirect3DDevice9_SetRenderState(data->device, D3DRS_ALPHABLENDENABLE, - TRUE); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLEND, - D3DBLEND_ZERO); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLEND, - D3DBLEND_SRCCOLOR); - if (data->enableSeparateAlphaBlend) { - IDirect3DDevice9_SetRenderState(data->device, D3DRS_SRCBLENDALPHA, - D3DBLEND_ZERO); - IDirect3DDevice9_SetRenderState(data->device, D3DRS_DESTBLENDALPHA, - D3DBLEND_ONE); - } - break; } } @@ -1583,17 +1414,68 @@ D3D_UpdateTextureScaleMode(D3D_RenderData *data, D3D_TextureData *texturedata, u texturedata->scaleMode); IDirect3DDevice9_SetSamplerState(data->device, index, D3DSAMP_MAGFILTER, texturedata->scaleMode); + IDirect3DDevice9_SetSamplerState(data->device, index, D3DSAMP_ADDRESSU, + D3DTADDRESS_CLAMP); + IDirect3DDevice9_SetSamplerState(data->device, index, D3DSAMP_ADDRESSV, + D3DTADDRESS_CLAMP); data->scaleMode[index] = texturedata->scaleMode; } } +static int +D3D_RenderSetupTextureState(SDL_Renderer * renderer, SDL_Texture * texture, LPDIRECT3DPIXELSHADER9 *shader) +{ + D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; + D3D_TextureData *texturedata; + + *shader = NULL; + + texturedata = (D3D_TextureData *)texture->driverdata; + if (!texturedata) { + SDL_SetError("Texture is not currently available"); + return -1; + } + + D3D_UpdateTextureScaleMode(data, texturedata, 0); + + if (D3D_BindTextureRep(data->device, &texturedata->texture, 0) < 0) { + return -1; + } + + if (texturedata->yuv) { + switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { + case SDL_YUV_CONVERSION_JPEG: + *shader = data->shaders[SHADER_YUV_JPEG]; + break; + case SDL_YUV_CONVERSION_BT601: + *shader = data->shaders[SHADER_YUV_BT601]; + break; + case SDL_YUV_CONVERSION_BT709: + *shader = data->shaders[SHADER_YUV_BT709]; + break; + default: + return SDL_SetError("Unsupported YUV conversion mode"); + } + + D3D_UpdateTextureScaleMode(data, texturedata, 1); + D3D_UpdateTextureScaleMode(data, texturedata, 2); + + if (D3D_BindTextureRep(data->device, &texturedata->utexture, 1) < 0) { + return -1; + } + if (D3D_BindTextureRep(data->device, &texturedata->vtexture, 2) < 0) { + return -1; + } + } + return 0; +} + static int D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * srcrect, const SDL_FRect * dstrect) { D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; - D3D_TextureData *texturedata; - LPDIRECT3DPIXELSHADER9 shader = NULL; + LPDIRECT3DPIXELSHADER9 shader; float minx, miny, maxx, maxy; float minu, maxu, minv, maxv; DWORD color; @@ -1604,12 +1486,6 @@ D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - texturedata = (D3D_TextureData *)texture->driverdata; - if (!texturedata) { - SDL_SetError("Texture is not currently available"); - return -1; - } - minx = dstrect->x - 0.5f; miny = dstrect->y - 0.5f; maxx = dstrect->x + dstrect->w - 0.5f; @@ -1652,45 +1528,25 @@ D3D_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, D3D_SetBlendMode(data, texture->blendMode); - D3D_UpdateTextureScaleMode(data, texturedata, 0); - - if (D3D_BindTextureRep(data->device, &texturedata->texture, 0) < 0) { + if (D3D_RenderSetupTextureState(renderer, texture, &shader) < 0) { return -1; } - - if (texturedata->yuv) { - shader = data->ps_yuv; - - D3D_UpdateTextureScaleMode(data, texturedata, 1); - D3D_UpdateTextureScaleMode(data, texturedata, 2); - - if (D3D_BindTextureRep(data->device, &texturedata->utexture, 1) < 0) { - return -1; - } - if (D3D_BindTextureRep(data->device, &texturedata->vtexture, 2) < 0) { - return -1; - } - } - + if (shader) { result = IDirect3DDevice9_SetPixelShader(data->device, shader); if (FAILED(result)) { return D3D_SetError("SetShader()", result); } } - result = - IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2, - vertices, sizeof(*vertices)); + result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2, + vertices, sizeof(*vertices)); if (FAILED(result)) { - return D3D_SetError("DrawPrimitiveUP()", result); + D3D_SetError("DrawPrimitiveUP()", result); } if (shader) { - result = IDirect3DDevice9_SetPixelShader(data->device, NULL); - if (FAILED(result)) { - return D3D_SetError("SetShader()", result); - } + IDirect3DDevice9_SetPixelShader(data->device, NULL); } - return 0; + return FAILED(result) ? -1 : 0; } @@ -1700,7 +1556,6 @@ D3D_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, const double angle, const SDL_FPoint * center, const SDL_RendererFlip flip) { D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; - D3D_TextureData *texturedata; LPDIRECT3DPIXELSHADER9 shader = NULL; float minx, miny, maxx, maxy; float minu, maxu, minv, maxv; @@ -1714,38 +1569,30 @@ D3D_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - texturedata = (D3D_TextureData *)texture->driverdata; - if (!texturedata) { - SDL_SetError("Texture is not currently available"); - return -1; - } - centerx = center->x; centery = center->y; - if (flip & SDL_FLIP_HORIZONTAL) { - minx = dstrect->w - centerx - 0.5f; - maxx = -centerx - 0.5f; - } - else { - minx = -centerx - 0.5f; - maxx = dstrect->w - centerx - 0.5f; - } - - if (flip & SDL_FLIP_VERTICAL) { - miny = dstrect->h - centery - 0.5f; - maxy = -centery - 0.5f; - } - else { - miny = -centery - 0.5f; - maxy = dstrect->h - centery - 0.5f; - } + minx = -centerx; + maxx = dstrect->w - centerx; + miny = -centery; + maxy = dstrect->h - centery; minu = (float) srcrect->x / texture->w; maxu = (float) (srcrect->x + srcrect->w) / texture->w; minv = (float) srcrect->y / texture->h; maxv = (float) (srcrect->y + srcrect->h) / texture->h; + if (flip & SDL_FLIP_HORIZONTAL) { + float tmp = maxu; + maxu = minu; + minu = tmp; + } + if (flip & SDL_FLIP_VERTICAL) { + float tmp = maxv; + maxv = minv; + minv = tmp; + } + color = D3DCOLOR_ARGB(texture->a, texture->r, texture->g, texture->b); vertices[0].x = minx; @@ -1778,55 +1625,37 @@ D3D_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, D3D_SetBlendMode(data, texture->blendMode); - /* Rotate and translate */ - modelMatrix = MatrixMultiply( - MatrixRotationZ((float)(M_PI * (float) angle / 180.0f)), - MatrixTranslation(dstrect->x + center->x, dstrect->y + center->y, 0) -); - IDirect3DDevice9_SetTransform(data->device, D3DTS_VIEW, (D3DMATRIX*)&modelMatrix); - - D3D_UpdateTextureScaleMode(data, texturedata, 0); - - if (D3D_BindTextureRep(data->device, &texturedata->texture, 0) < 0) { + if (D3D_RenderSetupTextureState(renderer, texture, &shader) < 0) { return -1; } - if (texturedata->yuv) { - shader = data->ps_yuv; - - D3D_UpdateTextureScaleMode(data, texturedata, 1); - D3D_UpdateTextureScaleMode(data, texturedata, 2); - - if (D3D_BindTextureRep(data->device, &texturedata->utexture, 1) < 0) { - return -1; - } - if (D3D_BindTextureRep(data->device, &texturedata->vtexture, 2) < 0) { - return -1; - } - } - + /* Rotate and translate */ + modelMatrix = MatrixMultiply( + MatrixRotationZ((float)(M_PI * (float) angle / 180.0f)), + MatrixTranslation(dstrect->x + center->x - 0.5f, dstrect->y + center->y - 0.5f, 0)); + IDirect3DDevice9_SetTransform(data->device, D3DTS_VIEW, (D3DMATRIX*)&modelMatrix); + if (shader) { result = IDirect3DDevice9_SetPixelShader(data->device, shader); if (FAILED(result)) { - return D3D_SetError("SetShader()", result); + D3D_SetError("SetShader()", result); + goto done; } } - result = - IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2, - vertices, sizeof(*vertices)); + result = IDirect3DDevice9_DrawPrimitiveUP(data->device, D3DPT_TRIANGLEFAN, 2, + vertices, sizeof(*vertices)); if (FAILED(result)) { - return D3D_SetError("DrawPrimitiveUP()", result); + D3D_SetError("DrawPrimitiveUP()", result); } +done: if (shader) { - result = IDirect3DDevice9_SetPixelShader(data->device, NULL); - if (FAILED(result)) { - return D3D_SetError("SetShader()", result); - } + IDirect3DDevice9_SetPixelShader(data->device, NULL); } modelMatrix = MatrixIdentity(); IDirect3DDevice9_SetTransform(data->device, D3DTS_VIEW, (D3DMATRIX*)&modelMatrix); - return 0; + + return FAILED(result) ? -1 : 0; } static int @@ -1936,6 +1765,8 @@ D3D_DestroyRenderer(SDL_Renderer * renderer) D3D_RenderData *data = (D3D_RenderData *) renderer->driverdata; if (data) { + int i; + /* Release the render target */ if (data->defaultRenderTarget) { IDirect3DSurface9_Release(data->defaultRenderTarget); @@ -1945,11 +1776,15 @@ D3D_DestroyRenderer(SDL_Renderer * renderer) IDirect3DSurface9_Release(data->currentRenderTarget); data->currentRenderTarget = NULL; } - if (data->ps_yuv) { - IDirect3DPixelShader9_Release(data->ps_yuv); + for (i = 0; i < SDL_arraysize(data->shaders); ++i) { + if (data->shaders[i]) { + IDirect3DPixelShader9_Release(data->shaders[i]); + data->shaders[i] = NULL; + } } if (data->device) { IDirect3DDevice9_Release(data->device); + data->device = NULL; } if (data->d3d) { IDirect3D9_Release(data->d3d); diff --git a/Engine/lib/sdl/src/render/direct3d/SDL_shaders_d3d.c b/Engine/lib/sdl/src/render/direct3d/SDL_shaders_d3d.c new file mode 100644 index 000000000..b95fddca8 --- /dev/null +++ b/Engine/lib/sdl/src/render/direct3d/SDL_shaders_d3d.c @@ -0,0 +1,274 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#include "SDL_render.h" +#include "SDL_system.h" + +#if SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED + +#include "../../core/windows/SDL_windows.h" + +#include + +#include "SDL_shaders_d3d.h" + +/* The shaders here were compiled with: + + fxc /T ps_2_0 /Fo"" "" + + Shader object code was converted to a list of DWORDs via the following + *nix style command (available separately from Windows + MSVC): + + hexdump -v -e '6/4 "0x%08.8x, " "\n"' +*/ + +/* --- D3D9_PixelShader_YUV_JPEG.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler = sampler_state + { + addressU = Clamp; + addressV = Clamp; + mipfilter = NONE; + minfilter = LINEAR; + magfilter = LINEAR; + }; + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {0.0, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; + const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; + const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } +*/ +static const DWORD D3D9_PixelShader_YUV_JPEG[] = { + 0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200, + 0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003, + 0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001, + 0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0, + 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, + 0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874, + 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004, + 0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, + 0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001, + 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, + 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, + 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000, + 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f800000, 0x00000000, 0x3fb374bc, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000, + 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042, + 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000, + 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000, + 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008, + 0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000, + 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, + 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, + 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff +}; + +/* --- D3D9_PixelShader_YUV_BT601.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler = sampler_state + { + addressU = Clamp; + addressV = Clamp; + mipfilter = NONE; + minfilter = LINEAR; + magfilter = LINEAR; + }; + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; + const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; + const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } +*/ +static const DWORD D3D9_PixelShader_YUV_BT601[] = { + 0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200, + 0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003, + 0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001, + 0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0, + 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, + 0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874, + 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004, + 0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, + 0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001, + 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, + 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, + 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x00000000, 0x3fcc49ba, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000, + 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042, + 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000, + 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000, + 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008, + 0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000, + 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, + 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, + 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff +}; + +/* --- D3D9_PixelShader_YUV_BT709.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler = sampler_state + { + addressU = Clamp; + addressV = Clamp; + mipfilter = NONE; + minfilter = LINEAR; + magfilter = LINEAR; + }; + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; + const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; + const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } +*/ +static const DWORD D3D9_PixelShader_YUV_BT709[] = { + 0xffff0200, 0x0044fffe, 0x42415443, 0x0000001c, 0x000000d7, 0xffff0200, + 0x00000003, 0x0000001c, 0x00000100, 0x000000d0, 0x00000058, 0x00010003, + 0x00000001, 0x00000070, 0x00000000, 0x00000080, 0x00020003, 0x00000001, + 0x00000098, 0x00000000, 0x000000a8, 0x00000003, 0x00000001, 0x000000c0, + 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, + 0xab005565, 0x00070004, 0x00040001, 0x00000001, 0x00000000, 0x53656874, + 0x6c706d61, 0x742b7265, 0x65546568, 0x72757478, 0xab005665, 0x00070004, + 0x00040001, 0x00000001, 0x00000000, 0x53656874, 0x6c706d61, 0x742b7265, + 0x65546568, 0x72757478, 0xab005965, 0x00070004, 0x00040001, 0x00000001, + 0x00000000, 0x325f7370, 0x4d00305f, 0x6f726369, 0x74666f73, 0x29522820, + 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, + 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x00000000, 0x3fe57732, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0x900f0000, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, 0x90000000, + 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000042, + 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, 0xb0e40000, + 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, 0x80040000, + 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000008, + 0x80010001, 0x80e40000, 0xa0e40001, 0x03000008, 0x80020001, 0x80e40000, + 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, + 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, + 0x90e40000, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff +}; + + +static const DWORD *D3D9_shaders[] = { + D3D9_PixelShader_YUV_JPEG, + D3D9_PixelShader_YUV_BT601, + D3D9_PixelShader_YUV_BT709, +}; + +HRESULT D3D9_CreatePixelShader(IDirect3DDevice9 *d3dDevice, D3D9_Shader shader, IDirect3DPixelShader9 **pixelShader) +{ + return IDirect3DDevice9_CreatePixelShader(d3dDevice, D3D9_shaders[shader], pixelShader); +} + +#endif /* SDL_VIDEO_RENDER_D3D && !SDL_RENDER_DISABLED */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/direct3d/SDL_shaders_d3d.h b/Engine/lib/sdl/src/render/direct3d/SDL_shaders_d3d.h new file mode 100644 index 000000000..854958277 --- /dev/null +++ b/Engine/lib/sdl/src/render/direct3d/SDL_shaders_d3d.h @@ -0,0 +1,34 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +/* D3D9 shader implementation */ + +typedef enum { + SHADER_YUV_JPEG, + SHADER_YUV_BT601, + SHADER_YUV_BT709, + NUM_SHADERS +} D3D9_Shader; + +extern HRESULT D3D9_CreatePixelShader(IDirect3DDevice9 *d3dDevice, D3D9_Shader shader, IDirect3DPixelShader9 **pixelShader); + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/direct3d11/SDL_render_d3d11.c b/Engine/lib/sdl/src/render/direct3d11/SDL_render_d3d11.c index df0f1558a..e0ccfc450 100644 --- a/Engine/lib/sdl/src/render/direct3d11/SDL_render_d3d11.c +++ b/Engine/lib/sdl/src/render/direct3d11/SDL_render_d3d11.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,10 +29,10 @@ #include "SDL_syswm.h" #include "../SDL_sysrender.h" #include "../SDL_d3dmath.h" -/* #include "SDL_log.h" */ #include +#include "SDL_shaders_d3d11.h" #ifdef __WINRT__ @@ -88,11 +88,24 @@ typedef struct ID3D11ShaderResourceView *mainTextureResourceViewU; ID3D11Texture2D *mainTextureV; ID3D11ShaderResourceView *mainTextureResourceViewV; + + /* NV12 texture support */ + SDL_bool nv12; + ID3D11Texture2D *mainTextureNV; + ID3D11ShaderResourceView *mainTextureResourceViewNV; + Uint8 *pixels; int pitch; SDL_Rect locked_rect; } D3D11_TextureData; +/* Blend mode data */ +typedef struct +{ + SDL_BlendMode blendMode; + ID3D11BlendState *blendState; +} D3D11_BlendMode; + /* Private renderer data */ typedef struct { @@ -109,12 +122,9 @@ typedef struct ID3D11InputLayout *inputLayout; ID3D11Buffer *vertexBuffer; ID3D11VertexShader *vertexShader; - ID3D11PixelShader *colorPixelShader; - ID3D11PixelShader *texturePixelShader; - ID3D11PixelShader *yuvPixelShader; - ID3D11BlendState *blendModeBlend; - ID3D11BlendState *blendModeAdd; - ID3D11BlendState *blendModeMod; + ID3D11PixelShader *pixelShaders[NUM_SHADERS]; + int blendModesCount; + D3D11_BlendMode *blendModes; ID3D11SamplerState *nearestPixelSampler; ID3D11SamplerState *linearSampler; D3D_FEATURE_LEVEL featureLevel; @@ -164,558 +174,12 @@ static const GUID SDL_IID_ID3D11Debug = { 0x79cf2233, 0x7536, 0x4948, { 0x9d, 0x #pragma GCC diagnostic pop #endif -/* Direct3D 11.x shaders - - SDL's shaders are compiled into SDL itself, to simplify distribution. - - All Direct3D 11.x shaders were compiled with the following: - - fxc /E"main" /T "" /Fo"" "" - - Variables: - - : the type of shader. A table of utilized shader types is - listed below. - - : where to store compiled output - - : where to read shader source code from - - Shader types: - - ps_4_0_level_9_1: Pixel shader for Windows 8+, including Windows RT - - vs_4_0_level_9_1: Vertex shader for Windows 8+, including Windows RT - - ps_4_0_level_9_3: Pixel shader for Windows Phone 8 - - vs_4_0_level_9_3: Vertex shader for Windows Phone 8 - - - Shader object code was converted to a list of DWORDs via the following - *nix style command (available separately from Windows + MSVC): - - hexdump -v -e '6/4 "0x%08.8x, " "\n"' - */ -#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP -#define D3D11_USE_SHADER_MODEL_4_0_level_9_3 -#else -#define D3D11_USE_SHADER_MODEL_4_0_level_9_1 -#endif - -/* The color-only-rendering pixel shader: - - --- D3D11_PixelShader_Colors.hlsl --- - struct PixelShaderInput - { - float4 pos : SV_POSITION; - float2 tex : TEXCOORD0; - float4 color : COLOR0; - }; - - float4 main(PixelShaderInput input) : SV_TARGET - { - return input.color; - } -*/ -#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) -static const DWORD D3D11_PixelShader_Colors[] = { - 0x43425844, 0xd74c28fe, 0xa1eb8804, 0x269d512a, 0x7699723d, 0x00000001, - 0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140, - 0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200, - 0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, - 0x00240000, 0xffff0200, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001, - 0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040, - 0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, - 0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002, - 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, - 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000, - 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d, - 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, - 0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438, - 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000, - 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, - 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 -}; -#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) -static const DWORD D3D11_PixelShader_Colors[] = { - 0x43425844, 0x93f6ccfc, 0x5f919270, 0x7a11aa4f, 0x9148e931, 0x00000001, - 0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140, - 0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200, - 0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, - 0x00240000, 0xffff0201, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001, - 0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040, - 0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, - 0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002, - 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, - 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000, - 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d, - 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, - 0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438, - 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000, - 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, - 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 -}; -#else -#error "An appropriate 'colors' pixel shader is not defined." -#endif - -/* The texture-rendering pixel shader: - - --- D3D11_PixelShader_Textures.hlsl --- - Texture2D theTexture : register(t0); - SamplerState theSampler : register(s0); - - struct PixelShaderInput - { - float4 pos : SV_POSITION; - float2 tex : TEXCOORD0; - float4 color : COLOR0; - }; - - float4 main(PixelShaderInput input) : SV_TARGET - { - return theTexture.Sample(theSampler, input.tex) * input.color; - } -*/ -#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) -static const DWORD D3D11_PixelShader_Textures[] = { - 0x43425844, 0x6299b59f, 0x155258f2, 0x873ab86a, 0xfcbb6dcd, 0x00000001, - 0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8, - 0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200, - 0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001, - 0x00280000, 0x00000000, 0xffff0200, 0x0200001f, 0x80000000, 0xb0030000, - 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800, - 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000, - 0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, - 0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000, - 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, - 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, - 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003, - 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8, - 0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100, - 0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005, - 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874, - 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263, - 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, - 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00, - 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, - 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, - 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 -}; -#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) -static const DWORD D3D11_PixelShader_Textures[] = { - 0x43425844, 0x5876569a, 0x01b6c87e, 0x8447454f, 0xc7f3ef10, 0x00000001, - 0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8, - 0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200, - 0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001, - 0x00280000, 0x00000000, 0xffff0201, 0x0200001f, 0x80000000, 0xb0030000, - 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800, - 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000, - 0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, - 0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000, - 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, - 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, - 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2, - 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, - 0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, - 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003, - 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8, - 0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100, - 0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005, - 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874, - 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263, - 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, - 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00, - 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, - 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, - 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 -}; -#else -#error "An appropriate 'textures' pixel shader is not defined" -#endif - -/* The yuv-rendering pixel shader: - - --- D3D11_PixelShader_YUV.hlsl --- - Texture2D theTextureY : register(t0); - Texture2D theTextureU : register(t1); - Texture2D theTextureV : register(t2); - SamplerState theSampler : register(s0); - - struct PixelShaderInput - { - float4 pos : SV_POSITION; - float2 tex : TEXCOORD0; - float4 color : COLOR0; - }; - - float4 main(PixelShaderInput input) : SV_TARGET - { - const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; - const float3 Rcoeff = {1.164, 0.000, 1.596}; - const float3 Gcoeff = {1.164, -0.391, -0.813}; - const float3 Bcoeff = {1.164, 2.018, 0.000}; - - float4 Output; - - float3 yuv; - yuv.x = theTextureY.Sample(theSampler, input.tex).r; - yuv.y = theTextureU.Sample(theSampler, input.tex).r; - yuv.z = theTextureV.Sample(theSampler, input.tex).r; - - yuv += offset; - Output.r = dot(yuv, Rcoeff); - Output.g = dot(yuv, Gcoeff); - Output.b = dot(yuv, Bcoeff); - Output.a = 1.0f; - - return Output * input.color; - } - -*/ -#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) -static const DWORD D3D11_PixelShader_YUV[] = { - 0x43425844, 0x2321c6c6, 0xf14df2d1, 0xc79d068d, 0x8e672abf, 0x00000001, - 0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438, - 0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200, - 0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, - 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051, - 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, - 0xa00f0001, 0x3f94fdf4, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, - 0xa00f0002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, 0x00000000, 0x05000051, - 0xa00f0003, 0x3f94fdf4, 0x400126e9, 0x00000000, 0x00000000, 0x0200001f, - 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, - 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, - 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, - 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, - 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, - 0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, - 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001, - 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, - 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, - 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, - 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, - 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000, - 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, - 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555, - 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, - 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, - 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, - 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, - 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, - 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2, - 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000, - 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001, - 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002, - 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, - 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f94fdf4, 0x3fcc49ba, - 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246, - 0x00000000, 0x00004002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, 0x00000000, - 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002, - 0x3f94fdf4, 0x400126e9, 0x00000000, 0x00000000, 0x05000036, 0x00100082, - 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, - 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, - 0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005, - 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c, - 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7, - 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, - 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, - 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005, - 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874, - 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, - 0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369, - 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, - 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, - 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, - 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, - 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, - 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, - 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, - 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, - 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 -}; -#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) -static const DWORD D3D11_PixelShader_YUV[] = { - 0x43425844, 0x6ede7360, 0x45ff5f8a, 0x34ac92ba, 0xb865f5e0, 0x00000001, - 0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410, - 0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200, - 0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, - 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051, - 0xa00f0000, 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, - 0xa00f0001, 0x3f94fdf4, 0x3fcc49ba, 0x00000000, 0x400126e9, 0x05000051, - 0xa00f0002, 0x3f94fdf4, 0xbec83127, 0xbf5020c5, 0x00000000, 0x0200001f, - 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, - 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, - 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801, - 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001, - 0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001, - 0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000, - 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, 0x03000008, - 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, - 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005, - 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, - 0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, - 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, - 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000, - 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062, - 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, - 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001, - 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2, - 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, - 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001, - 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, - 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000, - 0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, - 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, - 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, - 0x3f94fdf4, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, - 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f94fdf4, 0xbec83127, - 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, - 0x00000000, 0x00004002, 0x3f94fdf4, 0x400126e9, 0x00000000, 0x00000000, - 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, - 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000, - 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000, - 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, - 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, - 0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, - 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, - 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, - 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, - 0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478, - 0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, - 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, - 0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, - 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, - 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, - 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, - 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, - 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, - 0x45475241, 0xabab0054 -}; -#else -#error "An appropriate 'yuv' pixel shader is not defined." -#endif - -/* The sole vertex shader: - - --- D3D11_VertexShader.hlsl --- - #pragma pack_matrix( row_major ) - - cbuffer VertexShaderConstants : register(b0) - { - matrix model; - matrix projectionAndView; - }; - - struct VertexShaderInput - { - float3 pos : POSITION; - float2 tex : TEXCOORD0; - float4 color : COLOR0; - }; - - struct VertexShaderOutput - { - float4 pos : SV_POSITION; - float2 tex : TEXCOORD0; - float4 color : COLOR0; - }; - - VertexShaderOutput main(VertexShaderInput input) - { - VertexShaderOutput output; - float4 pos = float4(input.pos, 1.0f); - - // Transform the vertex position into projected space. - pos = mul(pos, model); - pos = mul(pos, projectionAndView); - output.pos = pos; - - // Pass through texture coordinates and color values without transformation - output.tex = input.tex; - output.color = input.color; - - return output; - } -*/ -#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) -static const DWORD D3D11_VertexShader[] = { - 0x43425844, 0x62dfae5f, 0x3e8bd8df, 0x9ec97127, 0x5044eefb, 0x00000001, - 0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0, - 0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200, - 0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000, - 0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0200, - 0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001, - 0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000, - 0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000, - 0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002, - 0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000, - 0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001, - 0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004, - 0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000, - 0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000, - 0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002, - 0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059, - 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000, - 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002, - 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002, - 0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46, - 0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006, - 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000, - 0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46, - 0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003, - 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46, - 0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006, - 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001, - 0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46, - 0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2, - 0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007, - 0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046, - 0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000, - 0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054, - 0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174, - 0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000, - 0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4, - 0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4, - 0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000, - 0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, - 0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062, - 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50, - 0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f, - 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000, - 0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, - 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f -}; -#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) -static const DWORD D3D11_VertexShader[] = { - 0x43425844, 0x01a24e41, 0x696af551, 0x4b2a87d1, 0x82ea03f6, 0x00000001, - 0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0, - 0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200, - 0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000, - 0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0201, - 0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001, - 0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000, - 0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000, - 0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002, - 0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000, - 0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001, - 0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004, - 0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000, - 0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000, - 0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002, - 0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059, - 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000, - 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002, - 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032, - 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002, - 0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46, - 0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006, - 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000, - 0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46, - 0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2, - 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003, - 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46, - 0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006, - 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001, - 0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46, - 0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2, - 0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007, - 0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046, - 0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002, - 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000, - 0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054, - 0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, - 0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174, - 0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000, - 0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4, - 0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4, - 0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000, - 0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077, - 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, - 0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, - 0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050, - 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059, - 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062, - 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50, - 0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f, - 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, - 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, - 0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000, - 0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, - 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f -}; -#else -#error "An appropriate vertex shader is not defined." -#endif - /* Direct3D 11.1 renderer implementation */ static SDL_Renderer *D3D11_CreateRenderer(SDL_Window * window, Uint32 flags); static void D3D11_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event); +static SDL_bool D3D11_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode); static int D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *srcPixels, @@ -766,12 +230,14 @@ SDL_RenderDriver D3D11_RenderDriver = { SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE ), /* flags. see SDL_RendererFlags */ - 4, /* num_texture_formats */ + 6, /* num_texture_formats */ { /* texture_formats */ SDL_PIXELFORMAT_ARGB8888, SDL_PIXELFORMAT_RGB888, SDL_PIXELFORMAT_YV12, - SDL_PIXELFORMAT_IYUV + SDL_PIXELFORMAT_IYUV, + SDL_PIXELFORMAT_NV12, + SDL_PIXELFORMAT_NV21 }, 0, /* max_texture_width: will be filled in later */ 0 /* max_texture_height: will be filled in later */ @@ -780,7 +246,8 @@ SDL_RenderDriver D3D11_RenderDriver = { Uint32 -D3D11_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat) { +D3D11_DXGIFormatToSDLPixelFormat(DXGI_FORMAT dxgiFormat) +{ switch (dxgiFormat) { case DXGI_FORMAT_B8G8R8A8_UNORM: return SDL_PIXELFORMAT_ARGB8888; @@ -801,6 +268,8 @@ SDLPixelFormatToDXGIFormat(Uint32 sdlFormat) return DXGI_FORMAT_B8G8R8X8_UNORM; case SDL_PIXELFORMAT_YV12: case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: /* For the Y texture */ + case SDL_PIXELFORMAT_NV21: /* For the Y texture */ return DXGI_FORMAT_R8_UNORM; default: return DXGI_FORMAT_UNKNOWN; @@ -826,6 +295,7 @@ D3D11_CreateRenderer(SDL_Window * window, Uint32 flags) } renderer->WindowEvent = D3D11_WindowEvent; + renderer->SupportsBlendMode = D3D11_SupportsBlendMode; renderer->CreateTexture = D3D11_CreateTexture; renderer->UpdateTexture = D3D11_UpdateTexture; renderer->UpdateTextureYUV = D3D11_UpdateTextureYUV; @@ -898,6 +368,8 @@ D3D11_ReleaseAll(SDL_Renderer * renderer) /* Release/reset everything else */ if (data) { + int i; + SAFE_RELEASE(data->dxgiFactory); SAFE_RELEASE(data->dxgiAdapter); SAFE_RELEASE(data->d3dDevice); @@ -908,12 +380,17 @@ D3D11_ReleaseAll(SDL_Renderer * renderer) SAFE_RELEASE(data->inputLayout); SAFE_RELEASE(data->vertexBuffer); SAFE_RELEASE(data->vertexShader); - SAFE_RELEASE(data->colorPixelShader); - SAFE_RELEASE(data->texturePixelShader); - SAFE_RELEASE(data->yuvPixelShader); - SAFE_RELEASE(data->blendModeBlend); - SAFE_RELEASE(data->blendModeAdd); - SAFE_RELEASE(data->blendModeMod); + for (i = 0; i < SDL_arraysize(data->pixelShaders); ++i) { + SAFE_RELEASE(data->pixelShaders[i]); + } + if (data->blendModesCount > 0) { + for (i = 0; i < data->blendModesCount; ++i) { + SAFE_RELEASE(data->blendModes[i].blendState); + } + SDL_free(data->blendModes); + + data->blendModesCount = 0; + } SAFE_RELEASE(data->nearestPixelSampler); SAFE_RELEASE(data->linearSampler); SAFE_RELEASE(data->mainRasterizer); @@ -954,37 +431,96 @@ D3D11_DestroyRenderer(SDL_Renderer * renderer) SDL_free(renderer); } -static HRESULT -D3D11_CreateBlendMode(SDL_Renderer * renderer, - BOOL enableBlending, - D3D11_BLEND srcBlend, - D3D11_BLEND destBlend, - D3D11_BLEND srcBlendAlpha, - D3D11_BLEND destBlendAlpha, - ID3D11BlendState ** blendStateOutput) +static D3D11_BLEND GetBlendFunc(SDL_BlendFactor factor) +{ + switch (factor) { + case SDL_BLENDFACTOR_ZERO: + return D3D11_BLEND_ZERO; + case SDL_BLENDFACTOR_ONE: + return D3D11_BLEND_ONE; + case SDL_BLENDFACTOR_SRC_COLOR: + return D3D11_BLEND_SRC_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: + return D3D11_BLEND_INV_SRC_COLOR; + case SDL_BLENDFACTOR_SRC_ALPHA: + return D3D11_BLEND_SRC_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: + return D3D11_BLEND_INV_SRC_ALPHA; + case SDL_BLENDFACTOR_DST_COLOR: + return D3D11_BLEND_DEST_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: + return D3D11_BLEND_INV_DEST_COLOR; + case SDL_BLENDFACTOR_DST_ALPHA: + return D3D11_BLEND_DEST_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: + return D3D11_BLEND_INV_DEST_ALPHA; + default: + return (D3D11_BLEND)0; + } +} + +static D3D11_BLEND_OP GetBlendEquation(SDL_BlendOperation operation) +{ + switch (operation) { + case SDL_BLENDOPERATION_ADD: + return D3D11_BLEND_OP_ADD; + case SDL_BLENDOPERATION_SUBTRACT: + return D3D11_BLEND_OP_SUBTRACT; + case SDL_BLENDOPERATION_REV_SUBTRACT: + return D3D11_BLEND_OP_REV_SUBTRACT; + case SDL_BLENDOPERATION_MINIMUM: + return D3D11_BLEND_OP_MIN; + case SDL_BLENDOPERATION_MAXIMUM: + return D3D11_BLEND_OP_MAX; + default: + return (D3D11_BLEND_OP)0; + } +} + +static SDL_bool +D3D11_CreateBlendState(SDL_Renderer * renderer, SDL_BlendMode blendMode) { D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata; + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + ID3D11BlendState *blendState = NULL; + D3D11_BlendMode *blendModes; HRESULT result = S_OK; D3D11_BLEND_DESC blendDesc; SDL_zero(blendDesc); blendDesc.AlphaToCoverageEnable = FALSE; blendDesc.IndependentBlendEnable = FALSE; - blendDesc.RenderTarget[0].BlendEnable = enableBlending; - blendDesc.RenderTarget[0].SrcBlend = srcBlend; - blendDesc.RenderTarget[0].DestBlend = destBlend; - blendDesc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD; - blendDesc.RenderTarget[0].SrcBlendAlpha = srcBlendAlpha; - blendDesc.RenderTarget[0].DestBlendAlpha = destBlendAlpha; - blendDesc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_ADD; + blendDesc.RenderTarget[0].BlendEnable = TRUE; + blendDesc.RenderTarget[0].SrcBlend = GetBlendFunc(srcColorFactor); + blendDesc.RenderTarget[0].DestBlend = GetBlendFunc(dstColorFactor); + blendDesc.RenderTarget[0].BlendOp = GetBlendEquation(colorOperation); + blendDesc.RenderTarget[0].SrcBlendAlpha = GetBlendFunc(srcAlphaFactor); + blendDesc.RenderTarget[0].DestBlendAlpha = GetBlendFunc(dstAlphaFactor); + blendDesc.RenderTarget[0].BlendOpAlpha = GetBlendEquation(alphaOperation); blendDesc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL; - result = ID3D11Device_CreateBlendState(data->d3dDevice, &blendDesc, blendStateOutput); + result = ID3D11Device_CreateBlendState(data->d3dDevice, &blendDesc, &blendState); if (FAILED(result)) { WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateBlendState"), result); - return result; + return SDL_FALSE; } - return S_OK; + blendModes = (D3D11_BlendMode *)SDL_realloc(data->blendModes, (data->blendModesCount + 1) * sizeof(*blendModes)); + if (!blendModes) { + SAFE_RELEASE(blendState); + SDL_OutOfMemory(); + return SDL_FALSE; + } + blendModes[data->blendModesCount].blendMode = blendMode; + blendModes[data->blendModesCount].blendState = blendState; + data->blendModes = blendModes; + ++data->blendModesCount; + + return SDL_TRUE; } /* Create resources that depend on the device. */ @@ -1000,6 +536,7 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) IDXGIDevice1 *dxgiDevice = NULL; HRESULT result = S_OK; UINT creationFlags; + int i; /* This array defines the set of DirectX hardware feature levels this app will support. * Note the ordering should be preserved. @@ -1017,14 +554,6 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) D3D_FEATURE_LEVEL_9_1 }; - /* Declare how the input layout for SDL's vertex shader will be setup: */ - const D3D11_INPUT_ELEMENT_DESC vertexDesc[] = - { - { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 }, - }; - D3D11_BUFFER_DESC constantBufferDesc; D3D11_SAMPLER_DESC samplerDesc; D3D11_RASTERIZER_DESC rasterDesc; @@ -1156,63 +685,14 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) goto done; } - /* Load in SDL's one and only vertex shader: */ - result = ID3D11Device_CreateVertexShader(data->d3dDevice, - D3D11_VertexShader, - sizeof(D3D11_VertexShader), - NULL, - &data->vertexShader - ); - if (FAILED(result)) { - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateVertexShader"), result); + if (D3D11_CreateVertexShader(data->d3dDevice, &data->vertexShader, &data->inputLayout) < 0) { goto done; } - /* Create an input layout for SDL's vertex shader: */ - result = ID3D11Device_CreateInputLayout(data->d3dDevice, - vertexDesc, - ARRAYSIZE(vertexDesc), - D3D11_VertexShader, - sizeof(D3D11_VertexShader), - &data->inputLayout - ); - if (FAILED(result)) { - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateInputLayout"), result); - goto done; - } - - /* Load in SDL's pixel shaders */ - result = ID3D11Device_CreatePixelShader(data->d3dDevice, - D3D11_PixelShader_Colors, - sizeof(D3D11_PixelShader_Colors), - NULL, - &data->colorPixelShader - ); - if (FAILED(result)) { - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreatePixelShader ['color' shader]"), result); - goto done; - } - - result = ID3D11Device_CreatePixelShader(data->d3dDevice, - D3D11_PixelShader_Textures, - sizeof(D3D11_PixelShader_Textures), - NULL, - &data->texturePixelShader - ); - if (FAILED(result)) { - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreatePixelShader ['textures' shader]"), result); - goto done; - } - - result = ID3D11Device_CreatePixelShader(data->d3dDevice, - D3D11_PixelShader_YUV, - sizeof(D3D11_PixelShader_YUV), - NULL, - &data->yuvPixelShader - ); - if (FAILED(result)) { - WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreatePixelShader ['yuv' shader]"), result); - goto done; + for (i = 0; i < SDL_arraysize(data->pixelShaders); ++i) { + if (D3D11_CreatePixelShader(data->d3dDevice, (D3D11_Shader)i, &data->pixelShaders[i]) < 0) { + goto done; + } } /* Setup space to hold vertex shader constants: */ @@ -1286,41 +766,9 @@ D3D11_CreateDeviceResources(SDL_Renderer * renderer) } /* Create blending states: */ - result = D3D11_CreateBlendMode( - renderer, - TRUE, - D3D11_BLEND_SRC_ALPHA, /* srcBlend */ - D3D11_BLEND_INV_SRC_ALPHA, /* destBlend */ - D3D11_BLEND_ONE, /* srcBlendAlpha */ - D3D11_BLEND_INV_SRC_ALPHA, /* destBlendAlpha */ - &data->blendModeBlend); - if (FAILED(result)) { - /* D3D11_CreateBlendMode will set the SDL error, if it fails */ - goto done; - } - - result = D3D11_CreateBlendMode( - renderer, - TRUE, - D3D11_BLEND_SRC_ALPHA, /* srcBlend */ - D3D11_BLEND_ONE, /* destBlend */ - D3D11_BLEND_ZERO, /* srcBlendAlpha */ - D3D11_BLEND_ONE, /* destBlendAlpha */ - &data->blendModeAdd); - if (FAILED(result)) { - /* D3D11_CreateBlendMode will set the SDL error, if it fails */ - goto done; - } - - result = D3D11_CreateBlendMode( - renderer, - TRUE, - D3D11_BLEND_ZERO, /* srcBlend */ - D3D11_BLEND_SRC_COLOR, /* destBlend */ - D3D11_BLEND_ZERO, /* srcBlendAlpha */ - D3D11_BLEND_ONE, /* destBlendAlpha */ - &data->blendModeMod); - if (FAILED(result)) { + if (!D3D11_CreateBlendState(renderer, SDL_BLENDMODE_BLEND) || + !D3D11_CreateBlendState(renderer, SDL_BLENDMODE_ADD) || + !D3D11_CreateBlendState(renderer, SDL_BLENDMODE_MOD)) { /* D3D11_CreateBlendMode will set the SDL error, if it fails */ goto done; } @@ -1694,6 +1142,25 @@ D3D11_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) } } +static SDL_bool +D3D11_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (!GetBlendFunc(srcColorFactor) || !GetBlendFunc(srcAlphaFactor) || + !GetBlendEquation(colorOperation) || + !GetBlendFunc(dstColorFactor) || !GetBlendFunc(dstAlphaFactor) || + !GetBlendEquation(alphaOperation)) { + return SDL_FALSE; + } + return SDL_TRUE; +} + static D3D11_FILTER GetScaleQuality(void) { @@ -1768,8 +1235,8 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) texture->format == SDL_PIXELFORMAT_IYUV) { textureData->yuv = SDL_TRUE; - textureDesc.Width /= 2; - textureDesc.Height /= 2; + textureDesc.Width = (textureDesc.Width + 1) / 2; + textureDesc.Height = (textureDesc.Height + 1) / 2; result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice, &textureDesc, @@ -1794,6 +1261,28 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) } } + if (texture->format == SDL_PIXELFORMAT_NV12 || + texture->format == SDL_PIXELFORMAT_NV21) { + D3D11_TEXTURE2D_DESC nvTextureDesc = textureDesc; + + textureData->nv12 = SDL_TRUE; + + nvTextureDesc.Format = DXGI_FORMAT_R8G8_UNORM; + nvTextureDesc.Width = (textureDesc.Width + 1) / 2; + nvTextureDesc.Height = (textureDesc.Height + 1) / 2; + + result = ID3D11Device_CreateTexture2D(rendererData->d3dDevice, + &nvTextureDesc, + NULL, + &textureData->mainTextureNV + ); + if (FAILED(result)) { + D3D11_DestroyTexture(renderer, texture); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateTexture2D"), result); + return -1; + } + } + resourceViewDesc.Format = textureDesc.Format; resourceViewDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D; resourceViewDesc.Texture2D.MostDetailedMip = 0; @@ -1832,6 +1321,23 @@ D3D11_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) } } + if (textureData->nv12) { + D3D11_SHADER_RESOURCE_VIEW_DESC nvResourceViewDesc = resourceViewDesc; + + nvResourceViewDesc.Format = DXGI_FORMAT_R8G8_UNORM; + + result = ID3D11Device_CreateShaderResourceView(rendererData->d3dDevice, + (ID3D11Resource *)textureData->mainTextureNV, + &nvResourceViewDesc, + &textureData->mainTextureResourceViewNV + ); + if (FAILED(result)) { + D3D11_DestroyTexture(renderer, texture); + WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateShaderResourceView"), result); + return -1; + } + } + if (texture->access & SDL_TEXTUREACCESS_TARGET) { D3D11_RENDER_TARGET_VIEW_DESC renderTargetViewDesc; renderTargetViewDesc.Format = textureDesc.Format; @@ -1876,7 +1382,7 @@ D3D11_DestroyTexture(SDL_Renderer * renderer, } static int -D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *texture, Uint32 format, int x, int y, int w, int h, const void *pixels, int pitch) +D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *texture, int bpp, int x, int y, int w, int h, const void *pixels, int pitch) { ID3D11Texture2D *stagingTexture; const Uint8 *src; @@ -1920,7 +1426,7 @@ D3D11_UpdateTextureInternal(D3D11_RenderData *rendererData, ID3D11Texture2D *tex src = (const Uint8 *)pixels; dst = textureMemory.pData; - length = w * SDL_BYTESPERPIXEL(format); + length = w * bpp; if (length == pitch && length == textureMemory.RowPitch) { SDL_memcpy(dst, src, length*h); } else { @@ -1971,7 +1477,7 @@ D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, texture->format, rect->x, rect->y, rect->w, rect->h, srcPixels, srcPitch) < 0) { + if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, srcPixels, srcPitch) < 0) { return -1; } @@ -1979,13 +1485,22 @@ D3D11_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, /* Skip to the correct offset into the next texture */ srcPixels = (const void*)((const Uint8*)srcPixels + rect->h * srcPitch); - if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureV : textureData->mainTextureU, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, srcPixels, srcPitch / 2) < 0) { + if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureV : textureData->mainTextureU, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, srcPixels, (srcPitch + 1) / 2) < 0) { return -1; } /* Skip to the correct offset into the next texture */ - srcPixels = (const void*)((const Uint8*)srcPixels + (rect->h * srcPitch) / 4); - if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureU : textureData->mainTextureV, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, srcPixels, srcPitch / 2) < 0) { + srcPixels = (const void*)((const Uint8*)srcPixels + ((rect->h + 1) / 2) * ((srcPitch + 1) / 2)); + if (D3D11_UpdateTextureInternal(rendererData, texture->format == SDL_PIXELFORMAT_YV12 ? textureData->mainTextureU : textureData->mainTextureV, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2, srcPixels, (srcPitch + 1) / 2) < 0) { + return -1; + } + } + + if (textureData->nv12) { + /* Skip to the correct offset into the next texture */ + srcPixels = (const void*)((const Uint8*)srcPixels + rect->h * srcPitch); + + if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureNV, 2, rect->x / 2, rect->y / 2, ((rect->w + 1) / 2), (rect->h + 1) / 2, srcPixels, 2*((srcPitch + 1) / 2)) < 0) { return -1; } } @@ -2007,13 +1522,13 @@ D3D11_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, texture->format, rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) { + if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTexture, SDL_BYTESPERPIXEL(texture->format), rect->x, rect->y, rect->w, rect->h, Yplane, Ypitch) < 0) { return -1; } - if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureU, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Uplane, Upitch) < 0) { + if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureU, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Uplane, Upitch) < 0) { return -1; } - if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureV, texture->format, rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Vplane, Vpitch) < 0) { + if (D3D11_UpdateTextureInternal(rendererData, textureData->mainTextureV, SDL_BYTESPERPIXEL(texture->format), rect->x / 2, rect->y / 2, rect->w / 2, rect->h / 2, Vplane, Vpitch) < 0) { return -1; } return 0; @@ -2034,7 +1549,7 @@ D3D11_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - if (textureData->yuv) { + if (textureData->yuv || textureData->nv12) { /* It's more efficient to upload directly... */ if (!textureData->pixels) { textureData->pitch = texture->w; @@ -2117,7 +1632,7 @@ D3D11_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) return; } - if (textureData->yuv) { + if (textureData->yuv || textureData->nv12) { const SDL_Rect *rect = &textureData->locked_rect; void *pixels = (void *) ((Uint8 *) textureData->pixels + rect->y * textureData->pitch + @@ -2443,19 +1958,21 @@ D3D11_RenderSetBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) { D3D11_RenderData *rendererData = (D3D11_RenderData *)renderer->driverdata; ID3D11BlendState *blendState = NULL; - switch (blendMode) { - case SDL_BLENDMODE_BLEND: - blendState = rendererData->blendModeBlend; - break; - case SDL_BLENDMODE_ADD: - blendState = rendererData->blendModeAdd; - break; - case SDL_BLENDMODE_MOD: - blendState = rendererData->blendModeMod; - break; - case SDL_BLENDMODE_NONE: - blendState = NULL; - break; + if (blendMode != SDL_BLENDMODE_NONE) { + int i; + for (i = 0; i < rendererData->blendModesCount; ++i) { + if (blendMode == rendererData->blendModes[i].blendMode) { + blendState = rendererData->blendModes[i].blendState; + break; + } + } + if (!blendState) { + if (D3D11_CreateBlendState(renderer, blendMode)) { + /* Successfully created the blend state, try again */ + D3D11_RenderSetBlendMode(renderer, blendMode); + } + return; + } } if (blendState != rendererData->currentBlendState) { ID3D11DeviceContext_OMSetBlendState(rendererData->d3dContext, blendState, 0, 0xFFFFFFFF); @@ -2518,7 +2035,7 @@ D3D11_RenderDrawPoints(SDL_Renderer * renderer, vertices = SDL_stack_alloc(VertexPositionColor, count); for (i = 0; i < count; ++i) { - const VertexPositionColor v = { { points[i].x, points[i].y, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } }; + const VertexPositionColor v = { { points[i].x + 0.5f, points[i].y + 0.5f, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } }; vertices[i] = v; } @@ -2531,7 +2048,7 @@ D3D11_RenderDrawPoints(SDL_Renderer * renderer, D3D11_SetPixelShader( renderer, - rendererData->colorPixelShader, + rendererData->pixelShaders[SHADER_SOLID], 0, NULL, NULL); @@ -2557,7 +2074,7 @@ D3D11_RenderDrawLines(SDL_Renderer * renderer, vertices = SDL_stack_alloc(VertexPositionColor, count); for (i = 0; i < count; ++i) { - const VertexPositionColor v = { { points[i].x, points[i].y, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } }; + const VertexPositionColor v = { { points[i].x + 0.5f, points[i].y + 0.5f, 0.0f }, { 0.0f, 0.0f }, { r, g, b, a } }; vertices[i] = v; } @@ -2570,12 +2087,18 @@ D3D11_RenderDrawLines(SDL_Renderer * renderer, D3D11_SetPixelShader( renderer, - rendererData->colorPixelShader, + rendererData->pixelShaders[SHADER_SOLID], 0, NULL, NULL); D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_LINESTRIP, count); + + if (points[0].x != points[count - 1].x || points[0].y != points[count - 1].y) { + ID3D11DeviceContext_IASetPrimitiveTopology(rendererData->d3dContext, D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); + ID3D11DeviceContext_Draw(rendererData->d3dContext, 1, count - 1); + } + SDL_stack_free(vertices); return 0; } @@ -2609,7 +2132,7 @@ D3D11_RenderFillRects(SDL_Renderer * renderer, D3D11_SetPixelShader( renderer, - rendererData->colorPixelShader, + rendererData->pixelShaders[SHADER_SOLID], 0, NULL, NULL); @@ -2620,20 +2143,91 @@ D3D11_RenderFillRects(SDL_Renderer * renderer, return 0; } -static ID3D11SamplerState * -D3D11_RenderGetSampler(SDL_Renderer * renderer, SDL_Texture * texture) +static int +D3D11_RenderSetupSampler(SDL_Renderer * renderer, SDL_Texture * texture) { D3D11_RenderData *rendererData = (D3D11_RenderData *) renderer->driverdata; D3D11_TextureData *textureData = (D3D11_TextureData *) texture->driverdata; + ID3D11SamplerState *textureSampler; switch (textureData->scaleMode) { case D3D11_FILTER_MIN_MAG_MIP_POINT: - return rendererData->nearestPixelSampler; + textureSampler = rendererData->nearestPixelSampler; + break; case D3D11_FILTER_MIN_MAG_MIP_LINEAR: - return rendererData->linearSampler; + textureSampler = rendererData->linearSampler; + break; default: - return NULL; + return SDL_SetError("Unknown scale mode: %d\n", textureData->scaleMode); } + + if (textureData->yuv) { + ID3D11ShaderResourceView *shaderResources[] = { + textureData->mainTextureResourceView, + textureData->mainTextureResourceViewU, + textureData->mainTextureResourceViewV + }; + D3D11_Shader shader; + + switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { + case SDL_YUV_CONVERSION_JPEG: + shader = SHADER_YUV_JPEG; + break; + case SDL_YUV_CONVERSION_BT601: + shader = SHADER_YUV_BT601; + break; + case SDL_YUV_CONVERSION_BT709: + shader = SHADER_YUV_BT709; + break; + default: + return SDL_SetError("Unsupported YUV conversion mode"); + } + + D3D11_SetPixelShader( + renderer, + rendererData->pixelShaders[shader], + SDL_arraysize(shaderResources), + shaderResources, + textureSampler); + + } else if (textureData->nv12) { + ID3D11ShaderResourceView *shaderResources[] = { + textureData->mainTextureResourceView, + textureData->mainTextureResourceViewNV, + }; + D3D11_Shader shader; + + switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { + case SDL_YUV_CONVERSION_JPEG: + shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_JPEG : SHADER_NV21_JPEG; + break; + case SDL_YUV_CONVERSION_BT601: + shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_BT601 : SHADER_NV21_BT601; + break; + case SDL_YUV_CONVERSION_BT709: + shader = texture->format == SDL_PIXELFORMAT_NV12 ? SHADER_NV12_BT709 : SHADER_NV21_BT709; + break; + default: + return SDL_SetError("Unsupported YUV conversion mode"); + } + + D3D11_SetPixelShader( + renderer, + rendererData->pixelShaders[shader], + SDL_arraysize(shaderResources), + shaderResources, + textureSampler); + + } else { + D3D11_SetPixelShader( + renderer, + rendererData->pixelShaders[SHADER_RGB], + 1, + &textureData->mainTextureResourceView, + textureSampler); + } + + return 0; } static int @@ -2645,7 +2239,6 @@ D3D11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, float minu, maxu, minv, maxv; Float4 color; VertexPositionColor vertices[4]; - ID3D11SamplerState *textureSampler; D3D11_RenderStartDrawOp(renderer); D3D11_RenderSetBlendMode(renderer, texture->blendMode); @@ -2700,26 +2293,8 @@ D3D11_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - textureSampler = D3D11_RenderGetSampler(renderer, texture); - if (textureData->yuv) { - ID3D11ShaderResourceView *shaderResources[] = { - textureData->mainTextureResourceView, - textureData->mainTextureResourceViewU, - textureData->mainTextureResourceViewV - }; - D3D11_SetPixelShader( - renderer, - rendererData->yuvPixelShader, - SDL_arraysize(shaderResources), - shaderResources, - textureSampler); - } else { - D3D11_SetPixelShader( - renderer, - rendererData->texturePixelShader, - 1, - &textureData->mainTextureResourceView, - textureSampler); + if (D3D11_RenderSetupSampler(renderer, texture) < 0) { + return -1; } D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, sizeof(vertices) / sizeof(VertexPositionColor)); @@ -2739,7 +2314,6 @@ D3D11_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, Float4X4 modelMatrix; float minx, maxx, miny, maxy; VertexPositionColor vertices[4]; - ID3D11SamplerState *textureSampler; D3D11_RenderStartDrawOp(renderer); D3D11_RenderSetBlendMode(renderer, texture->blendMode); @@ -2816,26 +2390,8 @@ D3D11_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, return -1; } - textureSampler = D3D11_RenderGetSampler(renderer, texture); - if (textureData->yuv) { - ID3D11ShaderResourceView *shaderResources[] = { - textureData->mainTextureResourceView, - textureData->mainTextureResourceViewU, - textureData->mainTextureResourceViewV - }; - D3D11_SetPixelShader( - renderer, - rendererData->yuvPixelShader, - SDL_arraysize(shaderResources), - shaderResources, - textureSampler); - } else { - D3D11_SetPixelShader( - renderer, - rendererData->texturePixelShader, - 1, - &textureData->mainTextureResourceView, - textureSampler); + if (D3D11_RenderSetupSampler(renderer, texture) < 0) { + return -1; } D3D11_RenderFinishDrawOp(renderer, D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP, sizeof(vertices) / sizeof(VertexPositionColor)); diff --git a/Engine/lib/sdl/src/render/direct3d11/SDL_render_winrt.cpp b/Engine/lib/sdl/src/render/direct3d11/SDL_render_winrt.cpp index 99f2b4ea4..2f2c3e54b 100644 --- a/Engine/lib/sdl/src/render/direct3d11/SDL_render_winrt.cpp +++ b/Engine/lib/sdl/src/render/direct3d11/SDL_render_winrt.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/direct3d11/SDL_render_winrt.h b/Engine/lib/sdl/src/render/direct3d11/SDL_render_winrt.h index 734ebf41a..7bb8fb78b 100644 --- a/Engine/lib/sdl/src/render/direct3d11/SDL_render_winrt.h +++ b/Engine/lib/sdl/src/render/direct3d11/SDL_render_winrt.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/direct3d11/SDL_shaders_d3d11.c b/Engine/lib/sdl/src/render/direct3d11/SDL_shaders_d3d11.c new file mode 100644 index 000000000..f1277b9c0 --- /dev/null +++ b/Engine/lib/sdl/src/render/direct3d11/SDL_shaders_d3d11.c @@ -0,0 +1,1957 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED + +#include "SDL_stdinc.h" + +#define COBJMACROS +#include "../../core/windows/SDL_windows.h" +#include + +#include "SDL_shaders_d3d11.h" + +#define SDL_COMPOSE_ERROR(str) SDL_STRINGIFY_ARG(__FUNCTION__) ", " str + + +/* Direct3D 11.x shaders + + SDL's shaders are compiled into SDL itself, to simplify distribution. + + All Direct3D 11.x shaders were compiled with the following: + + fxc /E"main" /T "" /Fo"" "" + + Variables: + - : the type of shader. A table of utilized shader types is + listed below. + - : where to store compiled output + - : where to read shader source code from + + Shader types: + - ps_4_0_level_9_1: Pixel shader for Windows 8+, including Windows RT + - vs_4_0_level_9_1: Vertex shader for Windows 8+, including Windows RT + - ps_4_0_level_9_3: Pixel shader for Windows Phone 8 + - vs_4_0_level_9_3: Vertex shader for Windows Phone 8 + + + Shader object code was converted to a list of DWORDs via the following + *nix style command (available separately from Windows + MSVC): + + hexdump -v -e '6/4 "0x%08.8x, " "\n"' + */ +#if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP +#define D3D11_USE_SHADER_MODEL_4_0_level_9_3 +#else +#define D3D11_USE_SHADER_MODEL_4_0_level_9_1 +#endif + +/* The color-only-rendering pixel shader: + + --- D3D11_PixelShader_Colors.hlsl --- + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + return input.color; + } +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_Colors[] = { + 0x43425844, 0xd74c28fe, 0xa1eb8804, 0x269d512a, 0x7699723d, 0x00000001, + 0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140, + 0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200, + 0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, + 0x00240000, 0xffff0200, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001, + 0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040, + 0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, + 0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000, + 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d, + 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, + 0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_Colors[] = { + 0x43425844, 0x93f6ccfc, 0x5f919270, 0x7a11aa4f, 0x9148e931, 0x00000001, + 0x00000240, 0x00000006, 0x00000038, 0x00000084, 0x000000c4, 0x00000140, + 0x00000198, 0x0000020c, 0x396e6f41, 0x00000044, 0x00000044, 0xffff0200, + 0x00000020, 0x00000024, 0x00240000, 0x00240000, 0x00240000, 0x00240000, + 0x00240000, 0xffff0201, 0x0200001f, 0x80000000, 0xb00f0001, 0x02000001, + 0x800f0800, 0xb0e40001, 0x0000ffff, 0x52444853, 0x00000038, 0x00000040, + 0x0000000e, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, + 0x00000000, 0x05000036, 0x001020f2, 0x00000000, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x00000002, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x00000050, 0x00000000, 0x00000000, + 0x00000000, 0x0000001c, 0xffff0400, 0x00000100, 0x0000001c, 0x7263694d, + 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, + 0x6c69706d, 0x39207265, 0x2e30332e, 0x30303239, 0x3336312e, 0xab003438, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000003, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'colors' pixel shader is not defined." +#endif + +/* The texture-rendering pixel shader: + + --- D3D11_PixelShader_Textures.hlsl --- + Texture2D theTexture : register(t0); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + return theTexture.Sample(theSampler, input.tex) * input.color; + } +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_Textures[] = { + 0x43425844, 0x6299b59f, 0x155258f2, 0x873ab86a, 0xfcbb6dcd, 0x00000001, + 0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8, + 0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200, + 0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001, + 0x00280000, 0x00000000, 0xffff0200, 0x0200001f, 0x80000000, 0xb0030000, + 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800, + 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000, + 0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, + 0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000, + 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, + 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003, + 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8, + 0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100, + 0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874, + 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263, + 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, + 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_Textures[] = { + 0x43425844, 0x5876569a, 0x01b6c87e, 0x8447454f, 0xc7f3ef10, 0x00000001, + 0x00000330, 0x00000006, 0x00000038, 0x000000c0, 0x0000015c, 0x000001d8, + 0x00000288, 0x000002fc, 0x396e6f41, 0x00000080, 0x00000080, 0xffff0200, + 0x00000058, 0x00000028, 0x00280000, 0x00280000, 0x00280000, 0x00240001, + 0x00280000, 0x00000000, 0xffff0201, 0x0200001f, 0x80000000, 0xb0030000, + 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, 0xa00f0800, + 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, 0x03000005, 0x800f0000, + 0x80e40000, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, + 0x52444853, 0x00000094, 0x00000040, 0x00000025, 0x0300005a, 0x00106000, + 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000001, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000000, + 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x00000003, + 0x00000001, 0x00000000, 0x00000003, 0x00000001, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000a8, + 0x00000000, 0x00000000, 0x00000002, 0x0000001c, 0xffff0400, 0x00000100, + 0x00000072, 0x0000005c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000001, 0x00000067, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x53656874, + 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x694d0065, 0x736f7263, + 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, + 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, 0xababab00, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'textures' pixel shader is not defined" +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_YUV_JPEG.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {0.0, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; + const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; + const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_YUV_JPEG[] = { + 0x43425844, 0x10359e9c, 0x92c3d2c4, 0x00bf0cd5, 0x5ce8c499, 0x00000001, + 0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438, + 0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200, + 0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, + 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051, + 0xa00f0000, 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, + 0xa00f0001, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x05000051, + 0xa00f0002, 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, + 0xa00f0003, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, + 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, + 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, + 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, + 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, + 0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, + 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001, + 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, + 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, + 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, + 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, + 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000, + 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, + 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555, + 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, + 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, + 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, + 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, + 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2, + 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000, + 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001, + 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002, + 0x00000000, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, + 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f800000, 0x3fb374bc, + 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246, + 0x00000000, 0x00004002, 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, + 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002, + 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x05000036, 0x00100082, + 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, + 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, + 0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005, + 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c, + 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, + 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, + 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874, + 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, + 0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369, + 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, + 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_YUV_JPEG[] = { + 0x43425844, 0x616d6673, 0x83174178, 0x15aac25d, 0x2a340487, 0x00000001, + 0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410, + 0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200, + 0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, + 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051, + 0xa00f0000, 0x00000000, 0xbf008081, 0x3f800000, 0x3fb374bc, 0x05000051, + 0xa00f0001, 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, + 0xa00f0002, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, + 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, + 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801, + 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001, + 0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001, + 0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000, + 0x0400005a, 0x80010001, 0x80e80000, 0xa0ee0000, 0xa0000000, 0x03000008, + 0x80020001, 0x80e40000, 0xa0e40001, 0x0400005a, 0x80040001, 0x80e40000, + 0xa0e40002, 0xa0aa0002, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005, + 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, + 0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, + 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, + 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000, + 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062, + 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, + 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001, + 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2, + 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, + 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001, + 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, + 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000, + 0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, + 0x00000000, 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, 0x00000000, + 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, + 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, + 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f800000, 0xbeb02de0, + 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, + 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, + 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, + 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000, + 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000, + 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, + 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, + 0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, + 0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, + 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, + 0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478, + 0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, + 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, + 0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, + 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, + 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, + 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, + 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, + 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, + 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_YUV_BT601.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; + const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; + const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_YUV_BT601[] = { + 0x43425844, 0x628ec838, 0xbe9cec6a, 0xc9ee10bb, 0x63283218, 0x00000001, + 0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438, + 0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200, + 0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, + 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051, + 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, + 0xa00f0001, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, + 0xa00f0002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, + 0xa00f0003, 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, + 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, + 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, + 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, + 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, + 0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, + 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001, + 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, + 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, + 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, + 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, + 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000, + 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, + 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555, + 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, + 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, + 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, + 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, + 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2, + 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000, + 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001, + 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002, + 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, + 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, 0x3fcc49ba, + 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246, + 0x00000000, 0x00004002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, + 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002, + 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x05000036, 0x00100082, + 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, + 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, + 0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005, + 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c, + 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, + 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, + 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874, + 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, + 0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369, + 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, + 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_YUV_BT601[] = { + 0x43425844, 0x692b159b, 0xf58723cc, 0xf4ceac9e, 0x35eec738, 0x00000001, + 0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410, + 0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200, + 0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, + 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051, + 0xa00f0000, 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, + 0xa00f0001, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x400119ce, 0x05000051, + 0xa00f0002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, + 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, + 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801, + 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001, + 0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001, + 0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000, + 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, 0x03000008, + 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, + 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005, + 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, + 0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, + 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, + 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000, + 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062, + 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, + 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001, + 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2, + 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, + 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001, + 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, + 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000, + 0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, + 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, + 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, + 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, + 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbec89a02, + 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, + 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, + 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, + 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000, + 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000, + 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, + 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, + 0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, + 0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, + 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, + 0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478, + 0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, + 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, + 0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, + 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, + 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, + 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, + 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, + 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, + 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_YUV_BT709.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureU : register(t1); + Texture2D theTextureV : register(t2); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; + const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; + const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.y = theTextureU.Sample(theSampler, input.tex).r; + yuv.z = theTextureV.Sample(theSampler, input.tex).r; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_YUV_BT709[] = { + 0x43425844, 0x5045fa84, 0xc2908cce, 0x278dacc3, 0xd4276f8f, 0x00000001, + 0x000005e8, 0x00000006, 0x00000038, 0x000001dc, 0x000003bc, 0x00000438, + 0x00000540, 0x000005b4, 0x396e6f41, 0x0000019c, 0x0000019c, 0xffff0200, + 0x0000016c, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, + 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0200, 0x05000051, + 0xa00f0000, 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, + 0xa00f0001, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x05000051, + 0xa00f0002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, + 0xa00f0003, 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, + 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, + 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40800, + 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0002, + 0xb0e40000, 0xa0e40802, 0x02000001, 0x80020000, 0x80000001, 0x02000001, + 0x80040000, 0x80000002, 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, + 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, 0x80010001, + 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, + 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, + 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, + 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, + 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, 0x00106000, 0x00000000, + 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, 0x00107000, + 0x00000001, 0x00005555, 0x04001858, 0x00107000, 0x00000002, 0x00005555, + 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, + 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, + 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, + 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, + 0x00100022, 0x00000000, 0x0010000a, 0x00000001, 0x09000045, 0x001000f2, + 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000002, 0x00106000, + 0x00000000, 0x05000036, 0x00100042, 0x00000000, 0x0010000a, 0x00000001, + 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, 0x00004002, + 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, + 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, 0x3fe57732, + 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, 0x00100246, + 0x00000000, 0x00004002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, + 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, 0x00004002, + 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x05000036, 0x00100082, + 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, + 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, + 0x00000074, 0x0000000c, 0x00000002, 0x00000000, 0x00000003, 0x00000005, + 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x46454452, 0x00000100, 0x00000000, 0x00000000, 0x00000004, 0x0000001c, + 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x000000a7, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, 0x00000001, + 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, + 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000002, 0x00000001, 0x0000000d, 0x53656874, + 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, + 0x72757478, 0x74005565, 0x65546568, 0x72757478, 0x4d005665, 0x6f726369, + 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, + 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, 0x34383336, 0xababab00, + 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, + 0x00000001, 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, + 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, + 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, + 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, + 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, + 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_YUV_BT709[] = { + 0x43425844, 0x72d13260, 0xf6c36f65, 0x8b9b28f5, 0x5010733c, 0x00000001, + 0x000005c0, 0x00000006, 0x00000038, 0x000001b4, 0x00000394, 0x00000410, + 0x00000518, 0x0000058c, 0x396e6f41, 0x00000174, 0x00000174, 0xffff0200, + 0x00000144, 0x00000030, 0x00300000, 0x00300000, 0x00300000, 0x00240003, + 0x00300000, 0x00000000, 0x00010001, 0x00020002, 0xffff0201, 0x05000051, + 0xa00f0000, 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, + 0xa00f0001, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x40073190, 0x05000051, + 0xa00f0002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0200001f, + 0x80000000, 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, + 0x90000000, 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x0200001f, + 0x90000000, 0xa00f0802, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40801, + 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, 0x02000001, 0x80020001, + 0x80000000, 0x03000042, 0x800f0000, 0xb0e40000, 0xa0e40802, 0x02000001, + 0x80040001, 0x80000000, 0x03000002, 0x80070000, 0x80e40001, 0xa0d40000, + 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, 0x03000008, + 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, + 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, 0x03000005, + 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, + 0x0000ffff, 0x52444853, 0x000001d8, 0x00000040, 0x00000076, 0x0300005a, + 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, + 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x04001858, 0x00107000, + 0x00000002, 0x00005555, 0x03001062, 0x00101032, 0x00000001, 0x03001062, + 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, 0x02000068, + 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, 0x00000001, + 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, 0x001000f2, + 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, 0x00106000, + 0x00000000, 0x05000036, 0x00100022, 0x00000000, 0x0010000a, 0x00000001, + 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, + 0x00000002, 0x00106000, 0x00000000, 0x05000036, 0x00100042, 0x00000000, + 0x0010000a, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, + 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, + 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, + 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, + 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbe5a511a, + 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, + 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, + 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, + 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x0000000c, 0x00000002, 0x00000000, + 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x00000100, 0x00000000, 0x00000000, + 0x00000004, 0x0000001c, 0xffff0400, 0x00000100, 0x000000cb, 0x0000009c, + 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, + 0x00000001, 0x000000a7, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, + 0x00000000, 0x00000001, 0x0000000d, 0x000000b3, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x000000bf, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000002, 0x00000001, + 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, + 0x74005965, 0x65546568, 0x72757478, 0x74005565, 0x65546568, 0x72757478, + 0x4d005665, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, + 0x72656461, 0x6d6f4320, 0x656c6970, 0x2e362072, 0x36392e33, 0x312e3030, + 0x34383336, 0xababab00, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, + 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, + 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, + 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, + 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, + 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, + 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_NV12_JPEG.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {0.0, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; + const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; + const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_NV12_JPEG[] = { + 0x43425844, 0x8fb9c77a, 0xe9e39686, 0x62b0e0e9, 0xd2bf8183, 0x00000001, + 0x00000548, 0x00000006, 0x00000038, 0x000001b0, 0x00000348, 0x000003c4, + 0x000004a0, 0x00000514, 0x396e6f41, 0x00000170, 0x00000170, 0xffff0200, + 0x00000144, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, + 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, + 0x02000001, 0x80060000, 0x80d20001, 0x03000002, 0x80070000, 0x80e40000, + 0xa0e40000, 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, + 0x80010001, 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, + 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, + 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, + 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, + 0x52444853, 0x00000190, 0x00000040, 0x00000064, 0x0300005a, 0x00106000, + 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, + 0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, + 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, + 0x02000068, 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, + 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, + 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, + 0x00106000, 0x00000000, 0x05000036, 0x00100062, 0x00000000, 0x00100106, + 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, + 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, + 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f800000, + 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, + 0x00100246, 0x00000000, 0x00004002, 0x3f800000, 0xbeb02de0, 0xbf36cf42, + 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, + 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x05000036, + 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, + 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, + 0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, 0x00000003, + 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x46454452, 0x000000d4, 0x00000000, 0x00000000, 0x00000003, + 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, 0x0000007c, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, + 0x00000087, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, + 0x00000001, 0x0000000d, 0x00000093, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x53656874, 0x6c706d61, + 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, 0x72757478, + 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, + 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, 0x392e332e, 0x2e303036, + 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, + 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, + 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, + 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, + 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, + 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, + 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_NV12_JPEG[] = { + 0x43425844, 0xe33e5d8b, 0x1b5f6461, 0x1afee99f, 0xcc345c04, 0x00000001, + 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, + 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, + 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, + 0x00000000, 0xbf008081, 0x3f800000, 0x3fb374bc, 0x05000051, 0xa00f0001, + 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, + 0x02000001, 0x80060001, 0x80d00000, 0x03000002, 0x80070000, 0x80e40001, + 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0ee0000, 0xa0000000, + 0x03000008, 0x80020001, 0x80e40000, 0xa0e40001, 0x0400005a, 0x80040001, + 0x80e40000, 0xa0e40002, 0xa0aa0002, 0x02000001, 0x80080001, 0xa0aa0000, + 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, + 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, + 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, + 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, + 0x00000000, 0x00100106, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, + 0x00100246, 0x00000000, 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, + 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, + 0x00004002, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, + 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f800000, + 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, + 0x00100046, 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, + 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, + 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, + 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, + 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, + 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, + 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, + 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, + 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, + 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, + 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, + 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, + 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, + 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, + 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, + 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_NV12_BT601.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; + const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; + const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_NV12_BT601[] = { + 0x43425844, 0xd1d24a0c, 0x337c447a, 0x22b55cff, 0xb5c9c74b, 0x00000001, + 0x00000548, 0x00000006, 0x00000038, 0x000001b0, 0x00000348, 0x000003c4, + 0x000004a0, 0x00000514, 0x396e6f41, 0x00000170, 0x00000170, 0xffff0200, + 0x00000144, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, + 0x02000001, 0x80060000, 0x80d20001, 0x03000002, 0x80070000, 0x80e40000, + 0xa0e40000, 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, + 0x80010001, 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, + 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, + 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, + 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, + 0x52444853, 0x00000190, 0x00000040, 0x00000064, 0x0300005a, 0x00106000, + 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, + 0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, + 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, + 0x02000068, 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, + 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, + 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, + 0x00106000, 0x00000000, 0x05000036, 0x00100062, 0x00000000, 0x00100106, + 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, + 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, + 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, + 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, + 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbec89a02, 0xbf5020c5, + 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, + 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x05000036, + 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, + 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, + 0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, 0x00000003, + 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x46454452, 0x000000d4, 0x00000000, 0x00000000, 0x00000003, + 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, 0x0000007c, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, + 0x00000087, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, + 0x00000001, 0x0000000d, 0x00000093, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x53656874, 0x6c706d61, + 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, 0x72757478, + 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, + 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, 0x392e332e, 0x2e303036, + 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, + 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, + 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, + 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, + 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, + 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, + 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_NV12_BT601[] = { + 0x43425844, 0x84b8b692, 0x589b9edd, 0x51ef2f0b, 0xf7247962, 0x00000001, + 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, + 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, + 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x400119ce, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, + 0x02000001, 0x80060001, 0x80d00000, 0x03000002, 0x80070000, 0x80e40001, + 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, + 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, + 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, + 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, + 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, + 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, + 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, + 0x00000000, 0x00100106, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, + 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, + 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, + 0x00004002, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, + 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, + 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, + 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, + 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, + 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, + 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, + 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, + 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, + 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, + 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, + 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, + 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, + 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, + 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, + 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, + 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, + 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, + 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_NV12_BT709.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; + const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; + const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).rg; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_NV12_BT709[] = { + 0x43425844, 0x40d1b8d5, 0xaf4b78b5, 0x907fd0b5, 0xa2d23686, 0x00000001, + 0x00000548, 0x00000006, 0x00000038, 0x000001b0, 0x00000348, 0x000003c4, + 0x000004a0, 0x00000514, 0x396e6f41, 0x00000170, 0x00000170, 0xffff0200, + 0x00000144, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, + 0x02000001, 0x80060000, 0x80d20001, 0x03000002, 0x80070000, 0x80e40000, + 0xa0e40000, 0x03000005, 0x80080000, 0x80000000, 0xa0000001, 0x04000004, + 0x80010001, 0x80aa0000, 0xa0550001, 0x80ff0000, 0x03000008, 0x80020001, + 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, 0x80e40000, 0xa0e40003, + 0xa0aa0003, 0x02000001, 0x80080001, 0xa0ff0000, 0x03000005, 0x800f0000, + 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, 0x80e40000, 0x0000ffff, + 0x52444853, 0x00000190, 0x00000040, 0x00000064, 0x0300005a, 0x00106000, + 0x00000000, 0x04001858, 0x00107000, 0x00000000, 0x00005555, 0x04001858, + 0x00107000, 0x00000001, 0x00005555, 0x03001062, 0x00101032, 0x00000001, + 0x03001062, 0x001010f2, 0x00000002, 0x03000065, 0x001020f2, 0x00000000, + 0x02000068, 0x00000002, 0x09000045, 0x001000f2, 0x00000000, 0x00101046, + 0x00000001, 0x00107e46, 0x00000000, 0x00106000, 0x00000000, 0x09000045, + 0x001000f2, 0x00000001, 0x00101046, 0x00000001, 0x00107e46, 0x00000001, + 0x00106000, 0x00000000, 0x05000036, 0x00100062, 0x00000000, 0x00100106, + 0x00000001, 0x0a000000, 0x00100072, 0x00000000, 0x00100246, 0x00000000, + 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, 0x00000000, 0x0a00000f, + 0x00100012, 0x00000001, 0x00100086, 0x00000000, 0x00004002, 0x3f950b0f, + 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, 0x00100022, 0x00000001, + 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, 0xbe5a511a, 0xbf086c22, + 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, 0x00100046, 0x00000000, + 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x05000036, + 0x00100082, 0x00000001, 0x00004001, 0x3f800000, 0x07000038, 0x001020f2, + 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, 0x00000002, 0x0100003e, + 0x54415453, 0x00000074, 0x0000000a, 0x00000002, 0x00000000, 0x00000003, + 0x00000005, 0x00000000, 0x00000000, 0x00000001, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x46454452, 0x000000d4, 0x00000000, 0x00000000, 0x00000003, + 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, 0x0000007c, 0x00000003, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, 0x00000001, + 0x00000087, 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000000, + 0x00000001, 0x0000000d, 0x00000093, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, 0x53656874, 0x6c706d61, + 0x74007265, 0x65546568, 0x72757478, 0x74005965, 0x65546568, 0x72757478, + 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, + 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, 0x392e332e, 0x2e303036, + 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, 0x00000003, 0x00000008, + 0x00000050, 0x00000000, 0x00000001, 0x00000003, 0x00000000, 0x0000000f, + 0x0000005c, 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, + 0x00000065, 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, + 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, 0x44524f4f, 0x4c4f4300, + 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x0000000f, 0x545f5653, + 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_NV12_BT709[] = { + 0x43425844, 0xa3bba187, 0x71b6afa9, 0x15998682, 0x2d545cae, 0x00000001, + 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, + 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, + 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fe57732, 0x00000000, 0x40073190, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, + 0x02000001, 0x80060001, 0x80d00000, 0x03000002, 0x80070000, 0x80e40001, + 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, + 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, + 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, + 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, + 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, + 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, + 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, + 0x00000000, 0x00100106, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, + 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, + 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, + 0x00004002, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, + 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, + 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, + 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, + 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, + 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, + 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, + 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, + 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, + 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, + 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, + 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, + 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, + 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, + 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, + 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, + 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, + 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, + 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_NV21_JPEG.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {0.0, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.0000, 0.0000, 1.4020}; + const float3 Gcoeff = {1.0000, -0.3441, -0.7141}; + const float3 Bcoeff = {1.0000, 1.7720, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_NV21_JPEG[] = { + 0x43425844, 0x9c41f579, 0xfd1019d8, 0x7c27e3ae, 0x52e3a5ff, 0x00000001, + 0x00000554, 0x00000006, 0x00000038, 0x000001bc, 0x00000354, 0x000003d0, + 0x000004ac, 0x00000520, 0x396e6f41, 0x0000017c, 0x0000017c, 0xffff0200, + 0x00000150, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, + 0x00000000, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, + 0x02000001, 0x80020000, 0x80550001, 0x02000001, 0x80040000, 0x80000001, + 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000005, 0x80080000, + 0x80000000, 0xa0000001, 0x04000004, 0x80010001, 0x80aa0000, 0xa0550001, + 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, + 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001, + 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, + 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, + 0x00000064, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, + 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, + 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, + 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, + 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, + 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, + 0x00100062, 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, + 0x00000000, 0x00100246, 0x00000000, 0x00004002, 0x00000000, 0xbf008081, + 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, + 0x00000000, 0x00004002, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, + 0x0a000010, 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, + 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, + 0x00000001, 0x00100046, 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, + 0x00000000, 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, + 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, + 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, + 0x00000002, 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, + 0x00000000, 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, + 0x000000a0, 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, + 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, + 0x74005965, 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, + 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, + 0x36207265, 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, + 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, + 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, + 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, + 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_NV21_JPEG[] = { + 0x43425844, 0x5705ccc9, 0xeb57571d, 0x8ce556e0, 0x2adef743, 0x00000001, + 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, + 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, + 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, + 0x00000000, 0xbf008081, 0x3f800000, 0x3fb374bc, 0x05000051, 0xa00f0001, + 0x3f800000, 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f800000, 0x3fe2d0e5, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, + 0x02000001, 0x80060001, 0x80c40000, 0x03000002, 0x80070000, 0x80e40001, + 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0ee0000, 0xa0000000, + 0x03000008, 0x80020001, 0x80e40000, 0xa0e40001, 0x0400005a, 0x80040001, + 0x80e40000, 0xa0e40002, 0xa0aa0002, 0x02000001, 0x80080001, 0xa0aa0000, + 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, + 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, + 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, + 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, + 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, + 0x00100246, 0x00000000, 0x00004002, 0x00000000, 0xbf008081, 0xbf008081, + 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, + 0x00004002, 0x3f800000, 0x3fb374bc, 0x00000000, 0x00000000, 0x0a000010, + 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f800000, + 0xbeb02de0, 0xbf36cf42, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, + 0x00100046, 0x00000000, 0x00004002, 0x3f800000, 0x3fe2d0e5, 0x00000000, + 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, + 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, + 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, + 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, + 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, + 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, + 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, + 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, + 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, + 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, + 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, + 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, + 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, + 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, + 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_NV21_BT601.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.5960}; + const float3 Gcoeff = {1.1644, -0.3918, -0.8130}; + const float3 Bcoeff = {1.1644, 2.0172, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_NV21_BT601[] = { + 0x43425844, 0x7fc6cfdc, 0xba87a4ff, 0xa72685a6, 0xa051b38c, 0x00000001, + 0x00000554, 0x00000006, 0x00000038, 0x000001bc, 0x00000354, 0x000003d0, + 0x000004ac, 0x00000520, 0x396e6f41, 0x0000017c, 0x0000017c, 0xffff0200, + 0x00000150, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f950b0f, 0x400119ce, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, + 0x02000001, 0x80020000, 0x80550001, 0x02000001, 0x80040000, 0x80000001, + 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000005, 0x80080000, + 0x80000000, 0xa0000001, 0x04000004, 0x80010001, 0x80aa0000, 0xa0550001, + 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, + 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001, + 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, + 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, + 0x00000064, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, + 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, + 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, + 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, + 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, + 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, + 0x00100062, 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, + 0x00000000, 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, + 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, + 0x00000000, 0x00004002, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, + 0x0a000010, 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, + 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, + 0x00000001, 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, + 0x00000000, 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, + 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, + 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, + 0x00000002, 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, + 0x00000000, 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, + 0x000000a0, 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, + 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, + 0x74005965, 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, + 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, + 0x36207265, 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, + 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, + 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, + 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, + 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_NV21_BT601[] = { + 0x43425844, 0x1e92bca4, 0xfeb04e20, 0x3f4226b1, 0xc89c58ad, 0x00000001, + 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, + 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, + 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x400119ce, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, + 0x02000001, 0x80060001, 0x80c40000, 0x03000002, 0x80070000, 0x80e40001, + 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, + 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, + 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, + 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, + 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, + 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, + 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, + 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, + 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, + 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, + 0x00004002, 0x3f950b0f, 0x3fcc49ba, 0x00000000, 0x00000000, 0x0a000010, + 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, + 0xbec89a02, 0xbf5020c5, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, + 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x400119ce, 0x00000000, + 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, + 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, + 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, + 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, + 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, + 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, + 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, + 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, + 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, + 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, + 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, + 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, + 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, + 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, + 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The yuv-rendering pixel shader: + + --- D3D11_PixelShader_NV21_BT709.hlsl --- + Texture2D theTextureY : register(t0); + Texture2D theTextureUV : register(t1); + SamplerState theSampler : register(s0); + + struct PixelShaderInput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + float4 main(PixelShaderInput input) : SV_TARGET + { + const float3 offset = {-0.0627451017, -0.501960814, -0.501960814}; + const float3 Rcoeff = {1.1644, 0.0000, 1.7927}; + const float3 Gcoeff = {1.1644, -0.2132, -0.5329}; + const float3 Bcoeff = {1.1644, 2.1124, 0.0000}; + + float4 Output; + + float3 yuv; + yuv.x = theTextureY.Sample(theSampler, input.tex).r; + yuv.yz = theTextureUV.Sample(theSampler, input.tex).gr; + + yuv += offset; + Output.r = dot(yuv, Rcoeff); + Output.g = dot(yuv, Gcoeff); + Output.b = dot(yuv, Bcoeff); + Output.a = 1.0f; + + return Output * input.color; + } + +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_PixelShader_NV21_BT709[] = { + 0x43425844, 0x754ba6c4, 0xe321a747, 0x23680787, 0x6bb1bdcc, 0x00000001, + 0x00000554, 0x00000006, 0x00000038, 0x000001bc, 0x00000354, 0x000003d0, + 0x000004ac, 0x00000520, 0x396e6f41, 0x0000017c, 0x0000017c, 0xffff0200, + 0x00000150, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0200, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0xbf008081, 0x3f800000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x05000051, 0xa00f0003, + 0x3f950b0f, 0x40073190, 0x00000000, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40800, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40801, + 0x02000001, 0x80020000, 0x80550001, 0x02000001, 0x80040000, 0x80000001, + 0x03000002, 0x80070000, 0x80e40000, 0xa0e40000, 0x03000005, 0x80080000, + 0x80000000, 0xa0000001, 0x04000004, 0x80010001, 0x80aa0000, 0xa0550001, + 0x80ff0000, 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, + 0x80040001, 0x80e40000, 0xa0e40003, 0xa0aa0003, 0x02000001, 0x80080001, + 0xa0ff0000, 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, + 0x800f0800, 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, + 0x00000064, 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, + 0x00000000, 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, + 0x03001062, 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, + 0x03000065, 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, + 0x001000f2, 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, + 0x00106000, 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, + 0x00000001, 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, + 0x00100062, 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, + 0x00000000, 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, + 0xbf008081, 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, + 0x00000000, 0x00004002, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, + 0x0a000010, 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, + 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, + 0x00000001, 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, + 0x00000000, 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, + 0x3f800000, 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, + 0x00101e46, 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, + 0x00000002, 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, + 0x00000001, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, + 0x00000000, 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, + 0x000000a0, 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, + 0x00000004, 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, + 0x00000002, 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, + 0x0000000d, 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, + 0x74005965, 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, + 0x52282074, 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, + 0x36207265, 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, + 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, + 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, + 0x00000003, 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, + 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, + 0x00000000, 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_PixelShader_NV21_BT709[] = { + 0x43425844, 0xb6219b20, 0xb71bbcf7, 0xf361cc45, 0xc4d5f5be, 0x00000001, + 0x00000520, 0x00000006, 0x00000038, 0x00000188, 0x00000320, 0x0000039c, + 0x00000478, 0x000004ec, 0x396e6f41, 0x00000148, 0x00000148, 0xffff0200, + 0x0000011c, 0x0000002c, 0x002c0000, 0x002c0000, 0x002c0000, 0x00240002, + 0x002c0000, 0x00000000, 0x00010001, 0xffff0201, 0x05000051, 0xa00f0000, + 0xbd808081, 0xbf008081, 0x3f800000, 0x00000000, 0x05000051, 0xa00f0001, + 0x3f950b0f, 0x3fe57732, 0x00000000, 0x40073190, 0x05000051, 0xa00f0002, + 0x3f950b0f, 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0200001f, 0x80000000, + 0xb0030000, 0x0200001f, 0x80000000, 0xb00f0001, 0x0200001f, 0x90000000, + 0xa00f0800, 0x0200001f, 0x90000000, 0xa00f0801, 0x03000042, 0x800f0000, + 0xb0e40000, 0xa0e40801, 0x03000042, 0x800f0001, 0xb0e40000, 0xa0e40800, + 0x02000001, 0x80060001, 0x80c40000, 0x03000002, 0x80070000, 0x80e40001, + 0xa0d40000, 0x0400005a, 0x80010001, 0x80e80000, 0xa0e40001, 0xa0aa0001, + 0x03000008, 0x80020001, 0x80e40000, 0xa0e40002, 0x0400005a, 0x80040001, + 0x80e40000, 0xa0ec0001, 0xa0aa0001, 0x02000001, 0x80080001, 0xa0aa0000, + 0x03000005, 0x800f0000, 0x80e40001, 0xb0e40001, 0x02000001, 0x800f0800, + 0x80e40000, 0x0000ffff, 0x52444853, 0x00000190, 0x00000040, 0x00000064, + 0x0300005a, 0x00106000, 0x00000000, 0x04001858, 0x00107000, 0x00000000, + 0x00005555, 0x04001858, 0x00107000, 0x00000001, 0x00005555, 0x03001062, + 0x00101032, 0x00000001, 0x03001062, 0x001010f2, 0x00000002, 0x03000065, + 0x001020f2, 0x00000000, 0x02000068, 0x00000002, 0x09000045, 0x001000f2, + 0x00000000, 0x00101046, 0x00000001, 0x00107e46, 0x00000000, 0x00106000, + 0x00000000, 0x09000045, 0x001000f2, 0x00000001, 0x00101046, 0x00000001, + 0x00107e46, 0x00000001, 0x00106000, 0x00000000, 0x05000036, 0x00100062, + 0x00000000, 0x00100456, 0x00000001, 0x0a000000, 0x00100072, 0x00000000, + 0x00100246, 0x00000000, 0x00004002, 0xbd808081, 0xbf008081, 0xbf008081, + 0x00000000, 0x0a00000f, 0x00100012, 0x00000001, 0x00100086, 0x00000000, + 0x00004002, 0x3f950b0f, 0x3fe57732, 0x00000000, 0x00000000, 0x0a000010, + 0x00100022, 0x00000001, 0x00100246, 0x00000000, 0x00004002, 0x3f950b0f, + 0xbe5a511a, 0xbf086c22, 0x00000000, 0x0a00000f, 0x00100042, 0x00000001, + 0x00100046, 0x00000000, 0x00004002, 0x3f950b0f, 0x40073190, 0x00000000, + 0x00000000, 0x05000036, 0x00100082, 0x00000001, 0x00004001, 0x3f800000, + 0x07000038, 0x001020f2, 0x00000000, 0x00100e46, 0x00000001, 0x00101e46, + 0x00000002, 0x0100003e, 0x54415453, 0x00000074, 0x0000000a, 0x00000002, + 0x00000000, 0x00000003, 0x00000005, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x46454452, 0x000000d4, 0x00000000, + 0x00000000, 0x00000003, 0x0000001c, 0xffff0400, 0x00000100, 0x000000a0, + 0x0000007c, 0x00000003, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000001, 0x00000001, 0x00000087, 0x00000002, 0x00000005, 0x00000004, + 0xffffffff, 0x00000000, 0x00000001, 0x0000000d, 0x00000093, 0x00000002, + 0x00000005, 0x00000004, 0xffffffff, 0x00000001, 0x00000001, 0x0000000d, + 0x53656874, 0x6c706d61, 0x74007265, 0x65546568, 0x72757478, 0x74005965, + 0x65546568, 0x72757478, 0x00565565, 0x7263694d, 0x666f736f, 0x52282074, + 0x4c482029, 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x36207265, + 0x392e332e, 0x2e303036, 0x38333631, 0xabab0034, 0x4e475349, 0x0000006c, + 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, 0x00000003, + 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, 0x00000003, + 0x00000001, 0x00000303, 0x00000065, 0x00000000, 0x00000000, 0x00000003, + 0x00000002, 0x00000f0f, 0x505f5653, 0x5449534f, 0x004e4f49, 0x43584554, + 0x44524f4f, 0x4c4f4300, 0xab00524f, 0x4e47534f, 0x0000002c, 0x00000001, + 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x0000000f, 0x545f5653, 0x45475241, 0xabab0054 +}; +#else +#error "An appropriate 'yuv' pixel shader is not defined." +#endif + +/* The sole vertex shader: + + --- D3D11_VertexShader.hlsl --- + #pragma pack_matrix( row_major ) + + cbuffer VertexShaderConstants : register(b0) + { + matrix model; + matrix projectionAndView; + }; + + struct VertexShaderInput + { + float3 pos : POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + struct VertexShaderOutput + { + float4 pos : SV_POSITION; + float2 tex : TEXCOORD0; + float4 color : COLOR0; + }; + + VertexShaderOutput main(VertexShaderInput input) + { + VertexShaderOutput output; + float4 pos = float4(input.pos, 1.0f); + + // Transform the vertex position into projected space. + pos = mul(pos, model); + pos = mul(pos, projectionAndView); + output.pos = pos; + + // Pass through texture coordinates and color values without transformation + output.tex = input.tex; + output.color = input.color; + + return output; + } +*/ +#if defined(D3D11_USE_SHADER_MODEL_4_0_level_9_1) +static const DWORD D3D11_VertexShader[] = { + 0x43425844, 0x62dfae5f, 0x3e8bd8df, 0x9ec97127, 0x5044eefb, 0x00000001, + 0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0, + 0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200, + 0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000, + 0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0200, + 0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001, + 0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000, + 0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000, + 0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002, + 0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000, + 0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001, + 0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004, + 0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000, + 0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000, + 0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002, + 0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059, + 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000, + 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002, + 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032, + 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002, + 0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46, + 0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006, + 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000, + 0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46, + 0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2, + 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003, + 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46, + 0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006, + 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001, + 0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46, + 0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2, + 0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007, + 0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046, + 0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000, + 0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054, + 0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, + 0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174, + 0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000, + 0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4, + 0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4, + 0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000, + 0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077, + 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, + 0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, + 0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059, + 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062, + 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50, + 0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f, + 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, + 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000, + 0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f +}; +#elif defined(D3D11_USE_SHADER_MODEL_4_0_level_9_3) +static const DWORD D3D11_VertexShader[] = { + 0x43425844, 0x01a24e41, 0x696af551, 0x4b2a87d1, 0x82ea03f6, 0x00000001, + 0x00000598, 0x00000006, 0x00000038, 0x0000016c, 0x00000334, 0x000003b0, + 0x000004b4, 0x00000524, 0x396e6f41, 0x0000012c, 0x0000012c, 0xfffe0200, + 0x000000f8, 0x00000034, 0x00240001, 0x00300000, 0x00300000, 0x00240000, + 0x00300001, 0x00000000, 0x00010008, 0x00000000, 0x00000000, 0xfffe0201, + 0x0200001f, 0x80000005, 0x900f0000, 0x0200001f, 0x80010005, 0x900f0001, + 0x0200001f, 0x80020005, 0x900f0002, 0x03000005, 0x800f0000, 0x90550000, + 0xa0e40002, 0x04000004, 0x800f0000, 0x90000000, 0xa0e40001, 0x80e40000, + 0x04000004, 0x800f0000, 0x90aa0000, 0xa0e40003, 0x80e40000, 0x03000002, + 0x800f0000, 0x80e40000, 0xa0e40004, 0x03000005, 0x800f0001, 0x80550000, + 0xa0e40006, 0x04000004, 0x800f0001, 0x80000000, 0xa0e40005, 0x80e40001, + 0x04000004, 0x800f0001, 0x80aa0000, 0xa0e40007, 0x80e40001, 0x04000004, + 0x800f0000, 0x80ff0000, 0xa0e40008, 0x80e40001, 0x04000004, 0xc0030000, + 0x80ff0000, 0xa0e40000, 0x80e40000, 0x02000001, 0xc00c0000, 0x80e40000, + 0x02000001, 0xe0030000, 0x90e40001, 0x02000001, 0xe00f0001, 0x90e40002, + 0x0000ffff, 0x52444853, 0x000001c0, 0x00010040, 0x00000070, 0x04000059, + 0x00208e46, 0x00000000, 0x00000008, 0x0300005f, 0x00101072, 0x00000000, + 0x0300005f, 0x00101032, 0x00000001, 0x0300005f, 0x001010f2, 0x00000002, + 0x04000067, 0x001020f2, 0x00000000, 0x00000001, 0x03000065, 0x00102032, + 0x00000001, 0x03000065, 0x001020f2, 0x00000002, 0x02000068, 0x00000002, + 0x08000038, 0x001000f2, 0x00000000, 0x00101556, 0x00000000, 0x00208e46, + 0x00000000, 0x00000001, 0x0a000032, 0x001000f2, 0x00000000, 0x00101006, + 0x00000000, 0x00208e46, 0x00000000, 0x00000000, 0x00100e46, 0x00000000, + 0x0a000032, 0x001000f2, 0x00000000, 0x00101aa6, 0x00000000, 0x00208e46, + 0x00000000, 0x00000002, 0x00100e46, 0x00000000, 0x08000000, 0x001000f2, + 0x00000000, 0x00100e46, 0x00000000, 0x00208e46, 0x00000000, 0x00000003, + 0x08000038, 0x001000f2, 0x00000001, 0x00100556, 0x00000000, 0x00208e46, + 0x00000000, 0x00000005, 0x0a000032, 0x001000f2, 0x00000001, 0x00100006, + 0x00000000, 0x00208e46, 0x00000000, 0x00000004, 0x00100e46, 0x00000001, + 0x0a000032, 0x001000f2, 0x00000001, 0x00100aa6, 0x00000000, 0x00208e46, + 0x00000000, 0x00000006, 0x00100e46, 0x00000001, 0x0a000032, 0x001020f2, + 0x00000000, 0x00100ff6, 0x00000000, 0x00208e46, 0x00000000, 0x00000007, + 0x00100e46, 0x00000001, 0x05000036, 0x00102032, 0x00000001, 0x00101046, + 0x00000001, 0x05000036, 0x001020f2, 0x00000002, 0x00101e46, 0x00000002, + 0x0100003e, 0x54415453, 0x00000074, 0x0000000b, 0x00000002, 0x00000000, + 0x00000006, 0x00000003, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000003, 0x00000000, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x46454452, 0x000000fc, 0x00000001, 0x00000054, + 0x00000001, 0x0000001c, 0xfffe0400, 0x00000100, 0x000000c6, 0x0000003c, + 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000001, + 0x00000001, 0x74726556, 0x68537865, 0x72656461, 0x736e6f43, 0x746e6174, + 0xabab0073, 0x0000003c, 0x00000002, 0x0000006c, 0x00000080, 0x00000000, + 0x00000000, 0x0000009c, 0x00000000, 0x00000040, 0x00000002, 0x000000a4, + 0x00000000, 0x000000b4, 0x00000040, 0x00000040, 0x00000002, 0x000000a4, + 0x00000000, 0x65646f6d, 0xabab006c, 0x00030002, 0x00040004, 0x00000000, + 0x00000000, 0x6a6f7270, 0x69746365, 0x6e416e6f, 0x65695664, 0x694d0077, + 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, + 0x706d6f43, 0x72656c69, 0x332e3920, 0x32392e30, 0x312e3030, 0x34383336, + 0xababab00, 0x4e475349, 0x00000068, 0x00000003, 0x00000008, 0x00000050, + 0x00000000, 0x00000000, 0x00000003, 0x00000000, 0x00000707, 0x00000059, + 0x00000000, 0x00000000, 0x00000003, 0x00000001, 0x00000303, 0x00000062, + 0x00000000, 0x00000000, 0x00000003, 0x00000002, 0x00000f0f, 0x49534f50, + 0x4e4f4954, 0x58455400, 0x524f4f43, 0x4f430044, 0x00524f4c, 0x4e47534f, + 0x0000006c, 0x00000003, 0x00000008, 0x00000050, 0x00000000, 0x00000001, + 0x00000003, 0x00000000, 0x0000000f, 0x0000005c, 0x00000000, 0x00000000, + 0x00000003, 0x00000001, 0x00000c03, 0x00000065, 0x00000000, 0x00000000, + 0x00000003, 0x00000002, 0x0000000f, 0x505f5653, 0x5449534f, 0x004e4f49, + 0x43584554, 0x44524f4f, 0x4c4f4300, 0xab00524f +}; +#else +#error "An appropriate vertex shader is not defined." +#endif + +static struct +{ + const void *shader_data; + SIZE_T shader_size; +} D3D11_shaders[] = { + { D3D11_PixelShader_Colors, sizeof(D3D11_PixelShader_Colors) }, + { D3D11_PixelShader_Textures, sizeof(D3D11_PixelShader_Textures) }, + { D3D11_PixelShader_YUV_JPEG, sizeof(D3D11_PixelShader_YUV_JPEG) }, + { D3D11_PixelShader_YUV_BT601, sizeof(D3D11_PixelShader_YUV_BT601) }, + { D3D11_PixelShader_YUV_BT709, sizeof(D3D11_PixelShader_YUV_BT709) }, + { D3D11_PixelShader_NV12_JPEG, sizeof(D3D11_PixelShader_NV12_JPEG) }, + { D3D11_PixelShader_NV12_BT601, sizeof(D3D11_PixelShader_NV12_BT601) }, + { D3D11_PixelShader_NV12_BT709, sizeof(D3D11_PixelShader_NV12_BT709) }, + { D3D11_PixelShader_NV21_JPEG, sizeof(D3D11_PixelShader_NV21_JPEG) }, + { D3D11_PixelShader_NV21_BT601, sizeof(D3D11_PixelShader_NV21_BT601) }, + { D3D11_PixelShader_NV21_BT709, sizeof(D3D11_PixelShader_NV21_BT709) }, +}; + +int D3D11_CreateVertexShader(ID3D11Device1 *d3dDevice, ID3D11VertexShader **vertexShader, ID3D11InputLayout **inputLayout) +{ + /* Declare how the input layout for SDL's vertex shader will be setup: */ + const D3D11_INPUT_ELEMENT_DESC vertexDesc[] = + { + { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "TEXCOORD", 0, DXGI_FORMAT_R32G32_FLOAT, 0, 12, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 0, 20, D3D11_INPUT_PER_VERTEX_DATA, 0 }, + }; + HRESULT result; + + /* Load in SDL's one and only vertex shader: */ + result = ID3D11Device_CreateVertexShader(d3dDevice, + D3D11_VertexShader, + sizeof(D3D11_VertexShader), + NULL, + vertexShader + ); + if (FAILED(result)) { + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateVertexShader"), result); + } + + /* Create an input layout for SDL's vertex shader: */ + result = ID3D11Device_CreateInputLayout(d3dDevice, + vertexDesc, + ARRAYSIZE(vertexDesc), + D3D11_VertexShader, + sizeof(D3D11_VertexShader), + inputLayout + ); + if (FAILED(result)) { + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreateInputLayout"), result); + } + return 0; +} + +int D3D11_CreatePixelShader(ID3D11Device1 *d3dDevice, D3D11_Shader shader, ID3D11PixelShader **pixelShader) +{ + HRESULT result; + + result = ID3D11Device_CreatePixelShader(d3dDevice, + D3D11_shaders[shader].shader_data, + D3D11_shaders[shader].shader_size, + NULL, + pixelShader + ); + if (FAILED(result)) { + return WIN_SetErrorFromHRESULT(SDL_COMPOSE_ERROR("ID3D11Device1::CreatePixelShader"), result); + } + return 0; +} + +#endif /* SDL_VIDEO_RENDER_D3D11 && !SDL_RENDER_DISABLED */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/direct3d11/SDL_shaders_d3d11.h b/Engine/lib/sdl/src/render/direct3d11/SDL_shaders_d3d11.h new file mode 100644 index 000000000..b28b5728f --- /dev/null +++ b/Engine/lib/sdl/src/render/direct3d11/SDL_shaders_d3d11.h @@ -0,0 +1,43 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +/* D3D11 shader implementation */ + +typedef enum { + SHADER_SOLID, + SHADER_RGB, + SHADER_YUV_JPEG, + SHADER_YUV_BT601, + SHADER_YUV_BT709, + SHADER_NV12_JPEG, + SHADER_NV12_BT601, + SHADER_NV12_BT709, + SHADER_NV21_JPEG, + SHADER_NV21_BT601, + SHADER_NV21_BT709, + NUM_SHADERS +} D3D11_Shader; + +extern int D3D11_CreateVertexShader(ID3D11Device1 *d3dDevice, ID3D11VertexShader **vertexShader, ID3D11InputLayout **inputLayout); +extern int D3D11_CreatePixelShader(ID3D11Device1 *d3dDevice, D3D11_Shader shader, ID3D11PixelShader **pixelShader); + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/metal/SDL_render_metal.m b/Engine/lib/sdl/src/render/metal/SDL_render_metal.m new file mode 100644 index 000000000..f7af72d42 --- /dev/null +++ b/Engine/lib/sdl/src/render/metal/SDL_render_metal.m @@ -0,0 +1,1429 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_RENDER_METAL && !SDL_RENDER_DISABLED + +#include "SDL_hints.h" +#include "SDL_log.h" +#include "SDL_assert.h" +#include "SDL_syswm.h" +#include "../SDL_sysrender.h" + +#ifdef __MACOSX__ +#include "../../video/cocoa/SDL_cocoametalview.h" +#else +#include "../../video/uikit/SDL_uikitmetalview.h" +#endif +#include +#import +#import + +/* Regenerate these with build-metal-shaders.sh */ +#ifdef __MACOSX__ +#include "SDL_shaders_metal_osx.h" +#else +#include "SDL_shaders_metal_ios.h" +#endif + +/* Apple Metal renderer implementation */ + +static SDL_Renderer *METAL_CreateRenderer(SDL_Window * window, Uint32 flags); +static void METAL_WindowEvent(SDL_Renderer * renderer, + const SDL_WindowEvent *event); +static int METAL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h); +static SDL_bool METAL_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode); +static int METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static int METAL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, const void *pixels, + int pitch); +static int METAL_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, + const Uint8 *Yplane, int Ypitch, + const Uint8 *Uplane, int Upitch, + const Uint8 *Vplane, int Vpitch); +static int METAL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, void **pixels, int *pitch); +static void METAL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static int METAL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture); +static int METAL_UpdateViewport(SDL_Renderer * renderer); +static int METAL_UpdateClipRect(SDL_Renderer * renderer); +static int METAL_RenderClear(SDL_Renderer * renderer); +static int METAL_RenderDrawPoints(SDL_Renderer * renderer, + const SDL_FPoint * points, int count); +static int METAL_RenderDrawLines(SDL_Renderer * renderer, + const SDL_FPoint * points, int count); +static int METAL_RenderFillRects(SDL_Renderer * renderer, + const SDL_FRect * rects, int count); +static int METAL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * srcrect, const SDL_FRect * dstrect); +static int METAL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * srcrect, const SDL_FRect * dstrect, + const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip); +static int METAL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, + Uint32 pixel_format, void * pixels, int pitch); +static void METAL_RenderPresent(SDL_Renderer * renderer); +static void METAL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture); +static void METAL_DestroyRenderer(SDL_Renderer * renderer); +static void *METAL_GetMetalLayer(SDL_Renderer * renderer); +static void *METAL_GetMetalCommandEncoder(SDL_Renderer * renderer); + +SDL_RenderDriver METAL_RenderDriver = { + METAL_CreateRenderer, + { + "metal", + (SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_TARGETTEXTURE), + 6, + { + SDL_PIXELFORMAT_ARGB8888, + SDL_PIXELFORMAT_ABGR8888, + SDL_PIXELFORMAT_YV12, + SDL_PIXELFORMAT_IYUV, + SDL_PIXELFORMAT_NV12, + SDL_PIXELFORMAT_NV21 + }, + 0, 0, + } +}; + +/* macOS requires constants in a buffer to have a 256 byte alignment. */ +#ifdef __MACOSX__ +#define CONSTANT_ALIGN 256 +#else +#define CONSTANT_ALIGN 4 +#endif + +#define ALIGN_CONSTANTS(size) ((size + CONSTANT_ALIGN - 1) & (~(CONSTANT_ALIGN - 1))) + +static const size_t CONSTANTS_OFFSET_IDENTITY = 0; +static const size_t CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM = ALIGN_CONSTANTS(CONSTANTS_OFFSET_IDENTITY + sizeof(float) * 16); +static const size_t CONSTANTS_OFFSET_DECODE_JPEG = ALIGN_CONSTANTS(CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM + sizeof(float) * 16); +static const size_t CONSTANTS_OFFSET_DECODE_BT601 = ALIGN_CONSTANTS(CONSTANTS_OFFSET_DECODE_JPEG + sizeof(float) * 4 * 4); +static const size_t CONSTANTS_OFFSET_DECODE_BT709 = ALIGN_CONSTANTS(CONSTANTS_OFFSET_DECODE_BT601 + sizeof(float) * 4 * 4); +static const size_t CONSTANTS_OFFSET_CLEAR_VERTS = ALIGN_CONSTANTS(CONSTANTS_OFFSET_DECODE_BT709 + sizeof(float) * 4 * 4); +static const size_t CONSTANTS_LENGTH = CONSTANTS_OFFSET_CLEAR_VERTS + sizeof(float) * 6; + +typedef enum SDL_MetalVertexFunction +{ + SDL_METAL_VERTEX_SOLID, + SDL_METAL_VERTEX_COPY, +} SDL_MetalVertexFunction; + +typedef enum SDL_MetalFragmentFunction +{ + SDL_METAL_FRAGMENT_SOLID = 0, + SDL_METAL_FRAGMENT_COPY, + SDL_METAL_FRAGMENT_YUV, + SDL_METAL_FRAGMENT_NV12, + SDL_METAL_FRAGMENT_NV21, + SDL_METAL_FRAGMENT_COUNT, +} SDL_MetalFragmentFunction; + +typedef struct METAL_PipelineState +{ + SDL_BlendMode blendMode; + void *pipe; +} METAL_PipelineState; + +typedef struct METAL_PipelineCache +{ + METAL_PipelineState *states; + int count; + SDL_MetalVertexFunction vertexFunction; + SDL_MetalFragmentFunction fragmentFunction; + MTLPixelFormat renderTargetFormat; + const char *label; +} METAL_PipelineCache; + +/* Each shader combination used by drawing functions has a separate pipeline + * cache, and we have a separate list of caches for each render target pixel + * format. This is more efficient than iterating over a global cache to find + * the pipeline based on the specified shader combination and RT pixel format, + * since we know what the RT pixel format is when we set the render target, and + * we know what the shader combination is inside each drawing function's code. */ +typedef struct METAL_ShaderPipelines +{ + MTLPixelFormat renderTargetFormat; + METAL_PipelineCache caches[SDL_METAL_FRAGMENT_COUNT]; +} METAL_ShaderPipelines; + +@interface METAL_RenderData : NSObject + @property (nonatomic, retain) id mtldevice; + @property (nonatomic, retain) id mtlcmdqueue; + @property (nonatomic, retain) id mtlcmdbuffer; + @property (nonatomic, retain) id mtlcmdencoder; + @property (nonatomic, retain) id mtllibrary; + @property (nonatomic, retain) id mtlbackbuffer; + @property (nonatomic, retain) id mtlsamplernearest; + @property (nonatomic, retain) id mtlsamplerlinear; + @property (nonatomic, retain) id mtlbufconstants; + @property (nonatomic, retain) CAMetalLayer *mtllayer; + @property (nonatomic, retain) MTLRenderPassDescriptor *mtlpassdesc; + @property (nonatomic, assign) METAL_ShaderPipelines *activepipelines; + @property (nonatomic, assign) METAL_ShaderPipelines *allpipelines; + @property (nonatomic, assign) int pipelinescount; +@end + +@implementation METAL_RenderData +#if !__has_feature(objc_arc) +- (void)dealloc +{ + [_mtldevice release]; + [_mtlcmdqueue release]; + [_mtlcmdbuffer release]; + [_mtlcmdencoder release]; + [_mtllibrary release]; + [_mtlbackbuffer release]; + [_mtlsamplernearest release]; + [_mtlsamplerlinear release]; + [_mtlbufconstants release]; + [_mtllayer release]; + [_mtlpassdesc release]; + [super dealloc]; +} +#endif +@end + +@interface METAL_TextureData : NSObject + @property (nonatomic, retain) id mtltexture; + @property (nonatomic, retain) id mtltexture_uv; + @property (nonatomic, retain) id mtlsampler; + @property (nonatomic, assign) SDL_MetalFragmentFunction fragmentFunction; + @property (nonatomic, assign) BOOL yuv; + @property (nonatomic, assign) BOOL nv12; + @property (nonatomic, assign) size_t conversionBufferOffset; +@end + +@implementation METAL_TextureData +#if !__has_feature(objc_arc) +- (void)dealloc +{ + [_mtltexture release]; + [_mtltexture_uv release]; + [_mtlsampler release]; + [super dealloc]; +} +#endif +@end + +static int +IsMetalAvailable(const SDL_SysWMinfo *syswm) +{ + if (syswm->subsystem != SDL_SYSWM_COCOA && syswm->subsystem != SDL_SYSWM_UIKIT) { + return SDL_SetError("Metal render target only supports Cocoa and UIKit video targets at the moment."); + } + + // this checks a weak symbol. +#if (defined(__MACOSX__) && (MAC_OS_X_VERSION_MIN_REQUIRED < 101100)) + if (MTLCreateSystemDefaultDevice == NULL) { // probably on 10.10 or lower. + return SDL_SetError("Metal framework not available on this system"); + } +#endif + + return 0; +} + +static const MTLBlendOperation invalidBlendOperation = (MTLBlendOperation)0xFFFFFFFF; +static const MTLBlendFactor invalidBlendFactor = (MTLBlendFactor)0xFFFFFFFF; + +static MTLBlendOperation +GetBlendOperation(SDL_BlendOperation operation) +{ + switch (operation) { + case SDL_BLENDOPERATION_ADD: return MTLBlendOperationAdd; + case SDL_BLENDOPERATION_SUBTRACT: return MTLBlendOperationSubtract; + case SDL_BLENDOPERATION_REV_SUBTRACT: return MTLBlendOperationReverseSubtract; + case SDL_BLENDOPERATION_MINIMUM: return MTLBlendOperationMin; + case SDL_BLENDOPERATION_MAXIMUM: return MTLBlendOperationMax; + default: return invalidBlendOperation; + } +} + +static MTLBlendFactor +GetBlendFactor(SDL_BlendFactor factor) +{ + switch (factor) { + case SDL_BLENDFACTOR_ZERO: return MTLBlendFactorZero; + case SDL_BLENDFACTOR_ONE: return MTLBlendFactorOne; + case SDL_BLENDFACTOR_SRC_COLOR: return MTLBlendFactorSourceColor; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: return MTLBlendFactorOneMinusSourceColor; + case SDL_BLENDFACTOR_SRC_ALPHA: return MTLBlendFactorSourceAlpha; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: return MTLBlendFactorOneMinusSourceAlpha; + case SDL_BLENDFACTOR_DST_COLOR: return MTLBlendFactorDestinationColor; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: return MTLBlendFactorOneMinusDestinationColor; + case SDL_BLENDFACTOR_DST_ALPHA: return MTLBlendFactorDestinationAlpha; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: return MTLBlendFactorOneMinusDestinationAlpha; + default: return invalidBlendFactor; + } +} + +static NSString * +GetVertexFunctionName(SDL_MetalVertexFunction function) +{ + switch (function) { + case SDL_METAL_VERTEX_SOLID: return @"SDL_Solid_vertex"; + case SDL_METAL_VERTEX_COPY: return @"SDL_Copy_vertex"; + default: return nil; + } +} + +static NSString * +GetFragmentFunctionName(SDL_MetalFragmentFunction function) +{ + switch (function) { + case SDL_METAL_FRAGMENT_SOLID: return @"SDL_Solid_fragment"; + case SDL_METAL_FRAGMENT_COPY: return @"SDL_Copy_fragment"; + case SDL_METAL_FRAGMENT_YUV: return @"SDL_YUV_fragment"; + case SDL_METAL_FRAGMENT_NV12: return @"SDL_NV12_fragment"; + case SDL_METAL_FRAGMENT_NV21: return @"SDL_NV21_fragment"; + default: return nil; + } +} + +static id +MakePipelineState(METAL_RenderData *data, METAL_PipelineCache *cache, + NSString *blendlabel, SDL_BlendMode blendmode) +{ + id mtlvertfn = [data.mtllibrary newFunctionWithName:GetVertexFunctionName(cache->vertexFunction)]; + id mtlfragfn = [data.mtllibrary newFunctionWithName:GetFragmentFunctionName(cache->fragmentFunction)]; + SDL_assert(mtlvertfn != nil); + SDL_assert(mtlfragfn != nil); + + MTLRenderPipelineDescriptor *mtlpipedesc = [[MTLRenderPipelineDescriptor alloc] init]; + mtlpipedesc.vertexFunction = mtlvertfn; + mtlpipedesc.fragmentFunction = mtlfragfn; + + MTLRenderPipelineColorAttachmentDescriptor *rtdesc = mtlpipedesc.colorAttachments[0]; + + rtdesc.pixelFormat = cache->renderTargetFormat; + + if (blendmode != SDL_BLENDMODE_NONE) { + rtdesc.blendingEnabled = YES; + rtdesc.sourceRGBBlendFactor = GetBlendFactor(SDL_GetBlendModeSrcColorFactor(blendmode)); + rtdesc.destinationRGBBlendFactor = GetBlendFactor(SDL_GetBlendModeDstColorFactor(blendmode)); + rtdesc.rgbBlendOperation = GetBlendOperation(SDL_GetBlendModeColorOperation(blendmode)); + rtdesc.sourceAlphaBlendFactor = GetBlendFactor(SDL_GetBlendModeSrcAlphaFactor(blendmode)); + rtdesc.destinationAlphaBlendFactor = GetBlendFactor(SDL_GetBlendModeDstAlphaFactor(blendmode)); + rtdesc.alphaBlendOperation = GetBlendOperation(SDL_GetBlendModeAlphaOperation(blendmode)); + } else { + rtdesc.blendingEnabled = NO; + } + + mtlpipedesc.label = [@(cache->label) stringByAppendingString:blendlabel]; + + NSError *err = nil; + id state = [data.mtldevice newRenderPipelineStateWithDescriptor:mtlpipedesc error:&err]; + SDL_assert(err == nil); + + METAL_PipelineState pipeline; + pipeline.blendMode = blendmode; + pipeline.pipe = (void *)CFBridgingRetain(state); + + METAL_PipelineState *states = SDL_realloc(cache->states, (cache->count + 1) * sizeof(pipeline)); + +#if !__has_feature(objc_arc) + [mtlpipedesc release]; // !!! FIXME: can these be reused for each creation, or does the pipeline obtain it? + [mtlvertfn release]; + [mtlfragfn release]; + [state release]; +#endif + + if (states) { + states[cache->count++] = pipeline; + cache->states = states; + return (__bridge id)pipeline.pipe; + } else { + CFBridgingRelease(pipeline.pipe); + SDL_OutOfMemory(); + return NULL; + } +} + +static void +MakePipelineCache(METAL_RenderData *data, METAL_PipelineCache *cache, const char *label, + MTLPixelFormat rtformat, SDL_MetalVertexFunction vertfn, SDL_MetalFragmentFunction fragfn) +{ + SDL_zerop(cache); + + cache->vertexFunction = vertfn; + cache->fragmentFunction = fragfn; + cache->renderTargetFormat = rtformat; + cache->label = label; + + /* Create pipeline states for the default blend modes. Custom blend modes + * will be added to the cache on-demand. */ + MakePipelineState(data, cache, @" (blend=none)", SDL_BLENDMODE_NONE); + MakePipelineState(data, cache, @" (blend=blend)", SDL_BLENDMODE_BLEND); + MakePipelineState(data, cache, @" (blend=add)", SDL_BLENDMODE_ADD); + MakePipelineState(data, cache, @" (blend=mod)", SDL_BLENDMODE_MOD); +} + +static void +DestroyPipelineCache(METAL_PipelineCache *cache) +{ + if (cache != NULL) { + for (int i = 0; i < cache->count; i++) { + CFBridgingRelease(cache->states[i].pipe); + } + + SDL_free(cache->states); + } +} + +void +MakeShaderPipelines(METAL_RenderData *data, METAL_ShaderPipelines *pipelines, MTLPixelFormat rtformat) +{ + SDL_zerop(pipelines); + + pipelines->renderTargetFormat = rtformat; + + MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_SOLID], "SDL primitives pipeline", rtformat, SDL_METAL_VERTEX_SOLID, SDL_METAL_FRAGMENT_SOLID); + MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_COPY], "SDL copy pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_COPY); + MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_YUV], "SDL YUV pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_YUV); + MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_NV12], "SDL NV12 pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_NV12); + MakePipelineCache(data, &pipelines->caches[SDL_METAL_FRAGMENT_NV21], "SDL NV21 pipeline", rtformat, SDL_METAL_VERTEX_COPY, SDL_METAL_FRAGMENT_NV21); +} + +static METAL_ShaderPipelines * +ChooseShaderPipelines(METAL_RenderData *data, MTLPixelFormat rtformat) +{ + METAL_ShaderPipelines *allpipelines = data.allpipelines; + int count = data.pipelinescount; + + for (int i = 0; i < count; i++) { + if (allpipelines[i].renderTargetFormat == rtformat) { + return &allpipelines[i]; + } + } + + allpipelines = SDL_realloc(allpipelines, (count + 1) * sizeof(METAL_ShaderPipelines)); + + if (allpipelines == NULL) { + SDL_OutOfMemory(); + return NULL; + } + + MakeShaderPipelines(data, &allpipelines[count], rtformat); + + data.allpipelines = allpipelines; + data.pipelinescount = count + 1; + + return &data.allpipelines[count]; +} + +static void +DestroyAllPipelines(METAL_ShaderPipelines *allpipelines, int count) +{ + if (allpipelines != NULL) { + for (int i = 0; i < count; i++) { + for (int cache = 0; cache < SDL_METAL_FRAGMENT_COUNT; cache++) { + DestroyPipelineCache(&allpipelines[i].caches[cache]); + } + } + + SDL_free(allpipelines); + } +} + +static inline id +ChoosePipelineState(METAL_RenderData *data, METAL_ShaderPipelines *pipelines, SDL_MetalFragmentFunction fragfn, SDL_BlendMode blendmode) +{ + METAL_PipelineCache *cache = &pipelines->caches[fragfn]; + + for (int i = 0; i < cache->count; i++) { + if (cache->states[i].blendMode == blendmode) { + return (__bridge id)cache->states[i].pipe; + } + } + + return MakePipelineState(data, cache, [NSString stringWithFormat:@" (blend=custom 0x%x)", blendmode], blendmode); +} + +static SDL_Renderer * +METAL_CreateRenderer(SDL_Window * window, Uint32 flags) +{ @autoreleasepool { + SDL_Renderer *renderer = NULL; + METAL_RenderData *data = NULL; + id mtldevice = nil; + SDL_SysWMinfo syswm; + + SDL_VERSION(&syswm.version); + if (!SDL_GetWindowWMInfo(window, &syswm)) { + return NULL; + } + + if (IsMetalAvailable(&syswm) == -1) { + return NULL; + } + + renderer = (SDL_Renderer *) SDL_calloc(1, sizeof(*renderer)); + if (!renderer) { + SDL_OutOfMemory(); + return NULL; + } + + // !!! FIXME: MTLCopyAllDevices() can find other GPUs on macOS... + mtldevice = MTLCreateSystemDefaultDevice(); + + if (mtldevice == nil) { + SDL_free(renderer); + SDL_SetError("Failed to obtain Metal device"); + return NULL; + } + + // !!! FIXME: error checking on all of this. + data = [[METAL_RenderData alloc] init]; + + renderer->driverdata = (void*)CFBridgingRetain(data); + renderer->window = window; + +#ifdef __MACOSX__ + NSView *view = Cocoa_Mtl_AddMetalView(window); + CAMetalLayer *layer = (CAMetalLayer *)[view layer]; + + layer.device = mtldevice; + + //layer.colorspace = nil; + +#else + UIView *view = UIKit_Mtl_AddMetalView(window); + CAMetalLayer *layer = (CAMetalLayer *)[view layer]; +#endif + + // Necessary for RenderReadPixels. + layer.framebufferOnly = NO; + + data.mtldevice = layer.device; + data.mtllayer = layer; + id mtlcmdqueue = [data.mtldevice newCommandQueue]; + data.mtlcmdqueue = mtlcmdqueue; + data.mtlcmdqueue.label = @"SDL Metal Renderer"; + data.mtlpassdesc = [MTLRenderPassDescriptor renderPassDescriptor]; + + NSError *err = nil; + + // The compiled .metallib is embedded in a static array in a header file + // but the original shader source code is in SDL_shaders_metal.metal. + dispatch_data_t mtllibdata = dispatch_data_create(sdl_metallib, sdl_metallib_len, dispatch_get_global_queue(0, 0), ^{}); + id mtllibrary = [data.mtldevice newLibraryWithData:mtllibdata error:&err]; + data.mtllibrary = mtllibrary; + SDL_assert(err == nil); +#if !__has_feature(objc_arc) + dispatch_release(mtllibdata); +#endif + data.mtllibrary.label = @"SDL Metal renderer shader library"; + + /* Do some shader pipeline state loading up-front rather than on demand. */ + data.pipelinescount = 0; + data.allpipelines = NULL; + ChooseShaderPipelines(data, MTLPixelFormatBGRA8Unorm); + + MTLSamplerDescriptor *samplerdesc = [[MTLSamplerDescriptor alloc] init]; + + samplerdesc.minFilter = MTLSamplerMinMagFilterNearest; + samplerdesc.magFilter = MTLSamplerMinMagFilterNearest; + id mtlsamplernearest = [data.mtldevice newSamplerStateWithDescriptor:samplerdesc]; + data.mtlsamplernearest = mtlsamplernearest; + + samplerdesc.minFilter = MTLSamplerMinMagFilterLinear; + samplerdesc.magFilter = MTLSamplerMinMagFilterLinear; + id mtlsamplerlinear = [data.mtldevice newSamplerStateWithDescriptor:samplerdesc]; + data.mtlsamplerlinear = mtlsamplerlinear; + + /* Note: matrices are column major. */ + float identitytransform[16] = { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.0f, 0.0f, 0.0f, 1.0f, + }; + + float halfpixeltransform[16] = { + 1.0f, 0.0f, 0.0f, 0.0f, + 0.0f, 1.0f, 0.0f, 0.0f, + 0.0f, 0.0f, 1.0f, 0.0f, + 0.5f, 0.5f, 0.0f, 1.0f, + }; + + /* Metal pads float3s to 16 bytes. */ + float decodetransformJPEG[4*4] = { + 0.0, -0.501960814, -0.501960814, 0.0, /* offset */ + 1.0000, 0.0000, 1.4020, 0.0, /* Rcoeff */ + 1.0000, -0.3441, -0.7141, 0.0, /* Gcoeff */ + 1.0000, 1.7720, 0.0000, 0.0, /* Bcoeff */ + }; + + float decodetransformBT601[4*4] = { + -0.0627451017, -0.501960814, -0.501960814, 0.0, /* offset */ + 1.1644, 0.0000, 1.5960, 0.0, /* Rcoeff */ + 1.1644, -0.3918, -0.8130, 0.0, /* Gcoeff */ + 1.1644, 2.0172, 0.0000, 0.0, /* Bcoeff */ + }; + + float decodetransformBT709[4*4] = { + 0.0, -0.501960814, -0.501960814, 0.0, /* offset */ + 1.0000, 0.0000, 1.4020, 0.0, /* Rcoeff */ + 1.0000, -0.3441, -0.7141, 0.0, /* Gcoeff */ + 1.0000, 1.7720, 0.0000, 0.0, /* Bcoeff */ + }; + + float clearverts[6] = {0.0f, 0.0f, 0.0f, 2.0f, 2.0f, 0.0f}; + + id mtlbufconstantstaging = [data.mtldevice newBufferWithLength:CONSTANTS_LENGTH options:MTLResourceStorageModeShared]; + mtlbufconstantstaging.label = @"SDL constant staging data"; + + id mtlbufconstants = [data.mtldevice newBufferWithLength:CONSTANTS_LENGTH options:MTLResourceStorageModePrivate]; + data.mtlbufconstants = mtlbufconstants; + data.mtlbufconstants.label = @"SDL constant data"; + + char *constantdata = [mtlbufconstantstaging contents]; + SDL_memcpy(constantdata + CONSTANTS_OFFSET_IDENTITY, identitytransform, sizeof(identitytransform)); + SDL_memcpy(constantdata + CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM, halfpixeltransform, sizeof(halfpixeltransform)); + SDL_memcpy(constantdata + CONSTANTS_OFFSET_DECODE_JPEG, decodetransformJPEG, sizeof(decodetransformJPEG)); + SDL_memcpy(constantdata + CONSTANTS_OFFSET_DECODE_BT601, decodetransformBT601, sizeof(decodetransformBT601)); + SDL_memcpy(constantdata + CONSTANTS_OFFSET_DECODE_BT709, decodetransformBT709, sizeof(decodetransformBT709)); + SDL_memcpy(constantdata + CONSTANTS_OFFSET_CLEAR_VERTS, clearverts, sizeof(clearverts)); + + id cmdbuffer = [data.mtlcmdqueue commandBuffer]; + id blitcmd = [cmdbuffer blitCommandEncoder]; + + [blitcmd copyFromBuffer:mtlbufconstantstaging sourceOffset:0 toBuffer:data.mtlbufconstants destinationOffset:0 size:CONSTANTS_LENGTH]; + + [blitcmd endEncoding]; + [cmdbuffer commit]; + + // !!! FIXME: force more clears here so all the drawables are sane to start, and our static buffers are definitely flushed. + + renderer->WindowEvent = METAL_WindowEvent; + renderer->GetOutputSize = METAL_GetOutputSize; + renderer->SupportsBlendMode = METAL_SupportsBlendMode; + renderer->CreateTexture = METAL_CreateTexture; + renderer->UpdateTexture = METAL_UpdateTexture; + renderer->UpdateTextureYUV = METAL_UpdateTextureYUV; + renderer->LockTexture = METAL_LockTexture; + renderer->UnlockTexture = METAL_UnlockTexture; + renderer->SetRenderTarget = METAL_SetRenderTarget; + renderer->UpdateViewport = METAL_UpdateViewport; + renderer->UpdateClipRect = METAL_UpdateClipRect; + renderer->RenderClear = METAL_RenderClear; + renderer->RenderDrawPoints = METAL_RenderDrawPoints; + renderer->RenderDrawLines = METAL_RenderDrawLines; + renderer->RenderFillRects = METAL_RenderFillRects; + renderer->RenderCopy = METAL_RenderCopy; + renderer->RenderCopyEx = METAL_RenderCopyEx; + renderer->RenderReadPixels = METAL_RenderReadPixels; + renderer->RenderPresent = METAL_RenderPresent; + renderer->DestroyTexture = METAL_DestroyTexture; + renderer->DestroyRenderer = METAL_DestroyRenderer; + renderer->GetMetalLayer = METAL_GetMetalLayer; + renderer->GetMetalCommandEncoder = METAL_GetMetalCommandEncoder; + + renderer->info = METAL_RenderDriver.info; + renderer->info.flags = (SDL_RENDERER_ACCELERATED | SDL_RENDERER_TARGETTEXTURE); + +#if defined(__MACOSX__) && defined(MAC_OS_X_VERSION_10_13) + if (@available(macOS 10.13, *)) { + data.mtllayer.displaySyncEnabled = (flags & SDL_RENDERER_PRESENTVSYNC) != 0; + } else +#endif + { + renderer->info.flags |= SDL_RENDERER_PRESENTVSYNC; + } + + /* https://developer.apple.com/metal/Metal-Feature-Set-Tables.pdf */ + int maxtexsize = 4096; +#if defined(__MACOSX__) + maxtexsize = 16384; +#elif defined(__TVOS__) + maxtexsize = 8192; +#ifdef __TVOS_11_0 + if (@available(tvOS 11.0, *)) { + if ([mtldevice supportsFeatureSet:MTLFeatureSet_tvOS_GPUFamily2_v1]) { + maxtexsize = 16384; + } + } +#endif +#else +#ifdef __IPHONE_11_0 + if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily4_v1]) { + maxtexsize = 16384; + } else +#endif +#ifdef __IPHONE_10_0 + if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily3_v1]) { + maxtexsize = 16384; + } else +#endif + if ([mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily2_v2] || [mtldevice supportsFeatureSet:MTLFeatureSet_iOS_GPUFamily1_v2]) { + maxtexsize = 8192; + } else { + maxtexsize = 4096; + } +#endif + + renderer->info.max_texture_width = maxtexsize; + renderer->info.max_texture_height = maxtexsize; + +#if !__has_feature(objc_arc) + [mtlcmdqueue release]; + [mtllibrary release]; + [samplerdesc release]; + [mtlsamplernearest release]; + [mtlsamplerlinear release]; + [mtlbufconstants release]; + [view release]; + [data release]; + [mtldevice release]; +#endif + + return renderer; +}} + +static void +METAL_ActivateRenderCommandEncoder(SDL_Renderer * renderer, MTLLoadAction load) +{ + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + /* Our SetRenderTarget just signals that the next render operation should + * set up a new render pass. This is where that work happens. */ + if (data.mtlcmdencoder == nil) { + id mtltexture = nil; + + if (renderer->target != NULL) { + METAL_TextureData *texdata = (__bridge METAL_TextureData *)renderer->target->driverdata; + mtltexture = texdata.mtltexture; + } else { + if (data.mtlbackbuffer == nil) { + /* The backbuffer's contents aren't guaranteed to persist after + * presenting, so we can leave it undefined when loading it. */ + data.mtlbackbuffer = [data.mtllayer nextDrawable]; + if (load == MTLLoadActionLoad) { + load = MTLLoadActionDontCare; + } + } + mtltexture = data.mtlbackbuffer.texture; + } + + SDL_assert(mtltexture); + + if (load == MTLLoadActionClear) { + MTLClearColor color = MTLClearColorMake(renderer->r/255.0, renderer->g/255.0, renderer->b/255.0, renderer->a/255.0); + data.mtlpassdesc.colorAttachments[0].clearColor = color; + } + + data.mtlpassdesc.colorAttachments[0].loadAction = load; + data.mtlpassdesc.colorAttachments[0].texture = mtltexture; + + data.mtlcmdbuffer = [data.mtlcmdqueue commandBuffer]; + data.mtlcmdencoder = [data.mtlcmdbuffer renderCommandEncoderWithDescriptor:data.mtlpassdesc]; + + if (data.mtlbackbuffer != nil && mtltexture == data.mtlbackbuffer.texture) { + data.mtlcmdencoder.label = @"SDL metal renderer backbuffer"; + } else { + data.mtlcmdencoder.label = @"SDL metal renderer render target"; + } + + data.activepipelines = ChooseShaderPipelines(data, mtltexture.pixelFormat); + + /* Make sure the viewport and clip rect are set on the new render pass. */ + METAL_UpdateViewport(renderer); + METAL_UpdateClipRect(renderer); + } +} + +static void +METAL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) +{ + if (event->event == SDL_WINDOWEVENT_SIZE_CHANGED || + event->event == SDL_WINDOWEVENT_SHOWN || + event->event == SDL_WINDOWEVENT_HIDDEN) { + // !!! FIXME: write me + } +} + +static int +METAL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + if (w) { + *w = (int)data.mtllayer.drawableSize.width; + } + if (h) { + *h = (int)data.mtllayer.drawableSize.height; + } + return 0; +}} + +static SDL_bool +METAL_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (GetBlendFactor(srcColorFactor) == invalidBlendFactor || + GetBlendFactor(srcAlphaFactor) == invalidBlendFactor || + GetBlendOperation(colorOperation) == invalidBlendOperation || + GetBlendFactor(dstColorFactor) == invalidBlendFactor || + GetBlendFactor(dstAlphaFactor) == invalidBlendFactor || + GetBlendOperation(alphaOperation) == invalidBlendOperation) { + return SDL_FALSE; + } + return SDL_TRUE; +} + +static int +METAL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + MTLPixelFormat pixfmt; + + switch (texture->format) { + case SDL_PIXELFORMAT_ABGR8888: + pixfmt = MTLPixelFormatRGBA8Unorm; + break; + case SDL_PIXELFORMAT_ARGB8888: + pixfmt = MTLPixelFormatBGRA8Unorm; + break; + case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + pixfmt = MTLPixelFormatR8Unorm; + break; + default: + return SDL_SetError("Texture format %s not supported by Metal", SDL_GetPixelFormatName(texture->format)); + } + + MTLTextureDescriptor *mtltexdesc = [MTLTextureDescriptor texture2DDescriptorWithPixelFormat:pixfmt + width:(NSUInteger)texture->w height:(NSUInteger)texture->h mipmapped:NO]; + + /* Not available in iOS 8. */ + if ([mtltexdesc respondsToSelector:@selector(usage)]) { + if (texture->access == SDL_TEXTUREACCESS_TARGET) { + mtltexdesc.usage = MTLTextureUsageShaderRead | MTLTextureUsageRenderTarget; + } else { + mtltexdesc.usage = MTLTextureUsageShaderRead; + } + } + + id mtltexture = [data.mtldevice newTextureWithDescriptor:mtltexdesc]; + if (mtltexture == nil) { + return SDL_SetError("Texture allocation failed"); + } + + id mtltexture_uv = nil; + + BOOL yuv = (texture->format == SDL_PIXELFORMAT_IYUV) || (texture->format == SDL_PIXELFORMAT_YV12); + BOOL nv12 = (texture->format == SDL_PIXELFORMAT_NV12) || (texture->format == SDL_PIXELFORMAT_NV21); + + if (yuv) { + mtltexdesc.pixelFormat = MTLPixelFormatR8Unorm; + mtltexdesc.width = (texture->w + 1) / 2; + mtltexdesc.height = (texture->h + 1) / 2; + mtltexdesc.textureType = MTLTextureType2DArray; + mtltexdesc.arrayLength = 2; + mtltexture_uv = [data.mtldevice newTextureWithDescriptor:mtltexdesc]; + } else if (nv12) { + mtltexdesc.pixelFormat = MTLPixelFormatRG8Unorm; + mtltexdesc.width = (texture->w + 1) / 2; + mtltexdesc.height = (texture->h + 1) / 2; + mtltexture_uv = [data.mtldevice newTextureWithDescriptor:mtltexdesc]; + } + + METAL_TextureData *texturedata = [[METAL_TextureData alloc] init]; + const char *hint = SDL_GetHint(SDL_HINT_RENDER_SCALE_QUALITY); + if (!hint || *hint == '0' || SDL_strcasecmp(hint, "nearest") == 0) { + texturedata.mtlsampler = data.mtlsamplernearest; + } else { + texturedata.mtlsampler = data.mtlsamplerlinear; + } + texturedata.mtltexture = mtltexture; + texturedata.mtltexture_uv = mtltexture_uv; + + texturedata.yuv = yuv; + texturedata.nv12 = nv12; + + if (yuv) { + texturedata.fragmentFunction = SDL_METAL_FRAGMENT_YUV; + } else if (texture->format == SDL_PIXELFORMAT_NV12) { + texturedata.fragmentFunction = SDL_METAL_FRAGMENT_NV12; + } else if (texture->format == SDL_PIXELFORMAT_NV21) { + texturedata.fragmentFunction = SDL_METAL_FRAGMENT_NV21; + } else { + texturedata.fragmentFunction = SDL_METAL_FRAGMENT_COPY; + } + + if (yuv || nv12) { + size_t offset = 0; + SDL_YUV_CONVERSION_MODE mode = SDL_GetYUVConversionModeForResolution(texture->w, texture->h); + switch (mode) { + case SDL_YUV_CONVERSION_JPEG: offset = CONSTANTS_OFFSET_DECODE_JPEG; break; + case SDL_YUV_CONVERSION_BT601: offset = CONSTANTS_OFFSET_DECODE_BT601; break; + case SDL_YUV_CONVERSION_BT709: offset = CONSTANTS_OFFSET_DECODE_BT709; break; + default: offset = 0; break; + } + texturedata.conversionBufferOffset = offset; + } + + texture->driverdata = (void*)CFBridgingRetain(texturedata); + +#if !__has_feature(objc_arc) + [texturedata release]; + [mtltexture release]; + [mtltexture_uv release]; +#endif + + return 0; +}} + +static int +METAL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, const void *pixels, int pitch) +{ @autoreleasepool { + METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata; + + /* !!! FIXME: replaceRegion does not do any synchronization, so it might + * !!! FIXME: stomp on a previous frame's data that's currently being read + * !!! FIXME: by the GPU. */ + [texturedata.mtltexture replaceRegion:MTLRegionMake2D(rect->x, rect->y, rect->w, rect->h) + mipmapLevel:0 + withBytes:pixels + bytesPerRow:pitch]; + + if (texturedata.yuv) { + int Uslice = texture->format == SDL_PIXELFORMAT_YV12 ? 1 : 0; + int Vslice = texture->format == SDL_PIXELFORMAT_YV12 ? 0 : 1; + + /* Skip to the correct offset into the next texture */ + pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); + [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2) + mipmapLevel:0 + slice:Uslice + withBytes:pixels + bytesPerRow:(pitch + 1) / 2 + bytesPerImage:0]; + + /* Skip to the correct offset into the next texture */ + pixels = (const void*)((const Uint8*)pixels + ((rect->h + 1) / 2) * ((pitch + 1)/2)); + [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2) + mipmapLevel:0 + slice:Vslice + withBytes:pixels + bytesPerRow:(pitch + 1) / 2 + bytesPerImage:0]; + } + + if (texturedata.nv12) { + /* Skip to the correct offset into the next texture */ + pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); + [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2) + mipmapLevel:0 + slice:0 + withBytes:pixels + bytesPerRow:2 * ((pitch + 1) / 2) + bytesPerImage:0]; + } + + return 0; +}} + +static int +METAL_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, + const Uint8 *Yplane, int Ypitch, + const Uint8 *Uplane, int Upitch, + const Uint8 *Vplane, int Vpitch) +{ @autoreleasepool { + METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata; + int Uslice = texture->format == SDL_PIXELFORMAT_YV12 ? 1 : 0; + int Vslice = texture->format == SDL_PIXELFORMAT_YV12 ? 0 : 1; + + /* Bail out if we're supposed to update an empty rectangle */ + if (rect->w <= 0 || rect->h <= 0) { + return 0; + } + + [texturedata.mtltexture replaceRegion:MTLRegionMake2D(rect->x, rect->y, rect->w, rect->h) + mipmapLevel:0 + withBytes:Yplane + bytesPerRow:Ypitch]; + + [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2) + mipmapLevel:0 + slice:Uslice + withBytes:Uplane + bytesPerRow:Upitch + bytesPerImage:0]; + + [texturedata.mtltexture_uv replaceRegion:MTLRegionMake2D(rect->x / 2, rect->y / 2, (rect->w + 1) / 2, (rect->h + 1) / 2) + mipmapLevel:0 + slice:Vslice + withBytes:Vplane + bytesPerRow:Vpitch + bytesPerImage:0]; + + return 0; +}} + +static int +METAL_LockTexture(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * rect, void **pixels, int *pitch) +{ + return SDL_Unsupported(); // !!! FIXME: write me +} + +static void +METAL_UnlockTexture(SDL_Renderer * renderer, SDL_Texture * texture) +{ + // !!! FIXME: write me +} + +static int +METAL_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + if (data.mtlcmdencoder) { + /* End encoding for the previous render target so we can set up a new + * render pass for this one. */ + [data.mtlcmdencoder endEncoding]; + [data.mtlcmdbuffer commit]; + + data.mtlcmdencoder = nil; + data.mtlcmdbuffer = nil; + } + + /* We don't begin a new render pass right away - we delay it until an actual + * draw or clear happens. That way we can use hardware clears when possible, + * which are only available when beginning a new render pass. */ + return 0; +}} + +static int +METAL_SetOrthographicProjection(SDL_Renderer *renderer, int w, int h) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + float projection[4][4]; + + if (!w || !h) { + return 0; + } + + /* Prepare an orthographic projection */ + projection[0][0] = 2.0f / w; + projection[0][1] = 0.0f; + projection[0][2] = 0.0f; + projection[0][3] = 0.0f; + projection[1][0] = 0.0f; + projection[1][1] = -2.0f / h; + projection[1][2] = 0.0f; + projection[1][3] = 0.0f; + projection[2][0] = 0.0f; + projection[2][1] = 0.0f; + projection[2][2] = 0.0f; + projection[2][3] = 0.0f; + projection[3][0] = -1.0f; + projection[3][1] = 1.0f; + projection[3][2] = 0.0f; + projection[3][3] = 1.0f; + + // !!! FIXME: This should be in a buffer... + [data.mtlcmdencoder setVertexBytes:projection length:sizeof(float)*16 atIndex:2]; + return 0; +}} + +static int +METAL_UpdateViewport(SDL_Renderer * renderer) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + if (data.mtlcmdencoder) { + MTLViewport viewport; + viewport.originX = renderer->viewport.x; + viewport.originY = renderer->viewport.y; + viewport.width = renderer->viewport.w; + viewport.height = renderer->viewport.h; + viewport.znear = 0.0; + viewport.zfar = 1.0; + [data.mtlcmdencoder setViewport:viewport]; + METAL_SetOrthographicProjection(renderer, renderer->viewport.w, renderer->viewport.h); + } + return 0; +}} + +static int +METAL_UpdateClipRect(SDL_Renderer * renderer) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + if (data.mtlcmdencoder) { + MTLScissorRect mtlrect; + // !!! FIXME: should this care about the viewport? + if (renderer->clipping_enabled) { + const SDL_Rect *rect = &renderer->clip_rect; + mtlrect.x = renderer->viewport.x + rect->x; + mtlrect.y = renderer->viewport.x + rect->y; + mtlrect.width = rect->w; + mtlrect.height = rect->h; + } else { + mtlrect.x = renderer->viewport.x; + mtlrect.y = renderer->viewport.y; + mtlrect.width = renderer->viewport.w; + mtlrect.height = renderer->viewport.h; + } + if (mtlrect.width > 0 && mtlrect.height > 0) { + [data.mtlcmdencoder setScissorRect:mtlrect]; + } + } + return 0; +}} + +static int +METAL_RenderClear(SDL_Renderer * renderer) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + /* Since we set up the render command encoder lazily when a draw is + * requested, we can do the fast path hardware clear if no draws have + * happened since the last SetRenderTarget. */ + if (data.mtlcmdencoder == nil) { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionClear); + } else { + // !!! FIXME: render color should live in a dedicated uniform buffer. + const float color[4] = { ((float)renderer->r) / 255.0f, ((float)renderer->g) / 255.0f, ((float)renderer->b) / 255.0f, ((float)renderer->a) / 255.0f }; + + MTLViewport viewport; // RenderClear ignores the viewport state, though, so reset that. + viewport.originX = viewport.originY = 0.0; + viewport.width = data.mtlpassdesc.colorAttachments[0].texture.width; + viewport.height = data.mtlpassdesc.colorAttachments[0].texture.height; + viewport.znear = 0.0; + viewport.zfar = 1.0; + + // Slow path for clearing: draw a filled fullscreen triangle. + METAL_SetOrthographicProjection(renderer, 1, 1); + [data.mtlcmdencoder setViewport:viewport]; + [data.mtlcmdencoder setRenderPipelineState:ChoosePipelineState(data, data.activepipelines, SDL_METAL_FRAGMENT_SOLID, SDL_BLENDMODE_NONE)]; + [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_CLEAR_VERTS atIndex:0]; + [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_IDENTITY atIndex:3]; + [data.mtlcmdencoder setFragmentBytes:color length:sizeof(color) atIndex:0]; + [data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangle vertexStart:0 vertexCount:3]; + + // reset the viewport for the rest of our usual drawing work... + viewport.originX = renderer->viewport.x; + viewport.originY = renderer->viewport.y; + viewport.width = renderer->viewport.w; + viewport.height = renderer->viewport.h; + viewport.znear = 0.0; + viewport.zfar = 1.0; + [data.mtlcmdencoder setViewport:viewport]; + METAL_SetOrthographicProjection(renderer, renderer->viewport.w, renderer->viewport.h); + } + + return 0; +}} + +// normalize a value from 0.0f to len into 0.0f to 1.0f. +static inline float +normtex(const float _val, const float len) +{ + return _val / len; +} + +static int +DrawVerts(SDL_Renderer * renderer, const SDL_FPoint * points, int count, + const MTLPrimitiveType primtype) +{ @autoreleasepool { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + + const size_t vertlen = (sizeof (float) * 2) * count; + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + // !!! FIXME: render color should live in a dedicated uniform buffer. + const float color[4] = { ((float)renderer->r) / 255.0f, ((float)renderer->g) / 255.0f, ((float)renderer->b) / 255.0f, ((float)renderer->a) / 255.0f }; + + [data.mtlcmdencoder setRenderPipelineState:ChoosePipelineState(data, data.activepipelines, SDL_METAL_FRAGMENT_SOLID, renderer->blendMode)]; + [data.mtlcmdencoder setFragmentBytes:color length:sizeof(color) atIndex:0]; + + [data.mtlcmdencoder setVertexBytes:points length:vertlen atIndex:0]; + [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_HALF_PIXEL_TRANSFORM atIndex:3]; + [data.mtlcmdencoder drawPrimitives:primtype vertexStart:0 vertexCount:count]; + + return 0; +}} + +static int +METAL_RenderDrawPoints(SDL_Renderer * renderer, const SDL_FPoint * points, int count) +{ + return DrawVerts(renderer, points, count, MTLPrimitiveTypePoint); +} + +static int +METAL_RenderDrawLines(SDL_Renderer * renderer, const SDL_FPoint * points, int count) +{ + return DrawVerts(renderer, points, count, MTLPrimitiveTypeLineStrip); +} + +static int +METAL_RenderFillRects(SDL_Renderer * renderer, const SDL_FRect * rects, int count) +{ @autoreleasepool { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + // !!! FIXME: render color should live in a dedicated uniform buffer. + const float color[4] = { ((float)renderer->r) / 255.0f, ((float)renderer->g) / 255.0f, ((float)renderer->b) / 255.0f, ((float)renderer->a) / 255.0f }; + + [data.mtlcmdencoder setRenderPipelineState:ChoosePipelineState(data, data.activepipelines, SDL_METAL_FRAGMENT_SOLID, renderer->blendMode)]; + [data.mtlcmdencoder setFragmentBytes:color length:sizeof(color) atIndex:0]; + [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_IDENTITY atIndex:3]; + + for (int i = 0; i < count; i++, rects++) { + if ((rects->w <= 0.0f) || (rects->h <= 0.0f)) continue; + + const float verts[] = { + rects->x, rects->y + rects->h, + rects->x, rects->y, + rects->x + rects->w, rects->y + rects->h, + rects->x + rects->w, rects->y + }; + + [data.mtlcmdencoder setVertexBytes:verts length:sizeof(verts) atIndex:0]; + [data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4]; + } + + return 0; +}} + +static void +METAL_SetupRenderCopy(METAL_RenderData *data, SDL_Texture *texture, METAL_TextureData *texturedata) +{ + float color[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; + if (texture->modMode) { + color[0] = ((float)texture->r) / 255.0f; + color[1] = ((float)texture->g) / 255.0f; + color[2] = ((float)texture->b) / 255.0f; + color[3] = ((float)texture->a) / 255.0f; + } + + [data.mtlcmdencoder setRenderPipelineState:ChoosePipelineState(data, data.activepipelines, texturedata.fragmentFunction, texture->blendMode)]; + [data.mtlcmdencoder setFragmentBytes:color length:sizeof(color) atIndex:0]; + [data.mtlcmdencoder setFragmentSamplerState:texturedata.mtlsampler atIndex:0]; + + [data.mtlcmdencoder setFragmentTexture:texturedata.mtltexture atIndex:0]; + + if (texturedata.yuv || texturedata.nv12) { + [data.mtlcmdencoder setFragmentTexture:texturedata.mtltexture_uv atIndex:1]; + [data.mtlcmdencoder setFragmentBuffer:data.mtlbufconstants offset:texturedata.conversionBufferOffset atIndex:1]; + } +} + +static int +METAL_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * srcrect, const SDL_FRect * dstrect) +{ @autoreleasepool { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata; + const float texw = (float) texturedata.mtltexture.width; + const float texh = (float) texturedata.mtltexture.height; + + METAL_SetupRenderCopy(data, texture, texturedata); + + const float xy[] = { + dstrect->x, dstrect->y + dstrect->h, + dstrect->x, dstrect->y, + dstrect->x + dstrect->w, dstrect->y + dstrect->h, + dstrect->x + dstrect->w, dstrect->y + }; + + const float uv[] = { + normtex(srcrect->x, texw), normtex(srcrect->y + srcrect->h, texh), + normtex(srcrect->x, texw), normtex(srcrect->y, texh), + normtex(srcrect->x + srcrect->w, texw), normtex(srcrect->y + srcrect->h, texh), + normtex(srcrect->x + srcrect->w, texw), normtex(srcrect->y, texh) + }; + + [data.mtlcmdencoder setVertexBytes:xy length:sizeof(xy) atIndex:0]; + [data.mtlcmdencoder setVertexBytes:uv length:sizeof(uv) atIndex:1]; + [data.mtlcmdencoder setVertexBuffer:data.mtlbufconstants offset:CONSTANTS_OFFSET_IDENTITY atIndex:3]; + [data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4]; + + return 0; +}} + +static int +METAL_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, + const SDL_Rect * srcrect, const SDL_FRect * dstrect, + const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip) +{ @autoreleasepool { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + METAL_TextureData *texturedata = (__bridge METAL_TextureData *)texture->driverdata; + const float texw = (float) texturedata.mtltexture.width; + const float texh = (float) texturedata.mtltexture.height; + float transform[16]; + float minu, maxu, minv, maxv; + + METAL_SetupRenderCopy(data, texture, texturedata); + + minu = normtex(srcrect->x, texw); + maxu = normtex(srcrect->x + srcrect->w, texw); + minv = normtex(srcrect->y, texh); + maxv = normtex(srcrect->y + srcrect->h, texh); + + if (flip & SDL_FLIP_HORIZONTAL) { + float tmp = maxu; + maxu = minu; + minu = tmp; + } + if (flip & SDL_FLIP_VERTICAL) { + float tmp = maxv; + maxv = minv; + minv = tmp; + } + + const float uv[] = { + minu, maxv, + minu, minv, + maxu, maxv, + maxu, minv + }; + + const float xy[] = { + -center->x, dstrect->h - center->y, + -center->x, -center->y, + dstrect->w - center->x, dstrect->h - center->y, + dstrect->w - center->x, -center->y + }; + + { + float rads = (float)(M_PI * (float) angle / 180.0f); + float c = cosf(rads), s = sinf(rads); + SDL_memset(transform, 0, sizeof(transform)); + + transform[10] = transform[15] = 1.0f; + + /* Rotation */ + transform[0] = c; + transform[1] = s; + transform[4] = -s; + transform[5] = c; + + /* Translation */ + transform[12] = dstrect->x + center->x; + transform[13] = dstrect->y + center->y; + } + + [data.mtlcmdencoder setVertexBytes:xy length:sizeof(xy) atIndex:0]; + [data.mtlcmdencoder setVertexBytes:uv length:sizeof(uv) atIndex:1]; + [data.mtlcmdencoder setVertexBytes:transform length:sizeof(transform) atIndex:3]; + [data.mtlcmdencoder drawPrimitives:MTLPrimitiveTypeTriangleStrip vertexStart:0 vertexCount:4]; + + return 0; +}} + +static int +METAL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, + Uint32 pixel_format, void * pixels, int pitch) +{ @autoreleasepool { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + + // !!! FIXME: this probably needs to commit the current command buffer, and probably waitUntilCompleted + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + id mtltexture = data.mtlpassdesc.colorAttachments[0].texture; + MTLRegion mtlregion = MTLRegionMake2D(rect->x, rect->y, rect->w, rect->h); + + // we only do BGRA8 or RGBA8 at the moment, so 4 will do. + const int temp_pitch = rect->w * 4; + void *temp_pixels = SDL_malloc(temp_pitch * rect->h); + if (!temp_pixels) { + return SDL_OutOfMemory(); + } + + [mtltexture getBytes:temp_pixels bytesPerRow:temp_pitch fromRegion:mtlregion mipmapLevel:0]; + + const Uint32 temp_format = (mtltexture.pixelFormat == MTLPixelFormatBGRA8Unorm) ? SDL_PIXELFORMAT_ARGB8888 : SDL_PIXELFORMAT_ABGR8888; + const int status = SDL_ConvertPixels(rect->w, rect->h, temp_format, temp_pixels, temp_pitch, pixel_format, pixels, pitch); + SDL_free(temp_pixels); + return status; +}} + +static void +METAL_RenderPresent(SDL_Renderer * renderer) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + + if (data.mtlcmdencoder != nil) { + [data.mtlcmdencoder endEncoding]; + } + if (data.mtlbackbuffer != nil) { + [data.mtlcmdbuffer presentDrawable:data.mtlbackbuffer]; + } + if (data.mtlcmdbuffer != nil) { + [data.mtlcmdbuffer commit]; + } + data.mtlcmdencoder = nil; + data.mtlcmdbuffer = nil; + data.mtlbackbuffer = nil; +}} + +static void +METAL_DestroyTexture(SDL_Renderer * renderer, SDL_Texture * texture) +{ @autoreleasepool { + CFBridgingRelease(texture->driverdata); + texture->driverdata = NULL; +}} + +static void +METAL_DestroyRenderer(SDL_Renderer * renderer) +{ @autoreleasepool { + if (renderer->driverdata) { + METAL_RenderData *data = CFBridgingRelease(renderer->driverdata); + + if (data.mtlcmdencoder != nil) { + [data.mtlcmdencoder endEncoding]; + } + + DestroyAllPipelines(data.allpipelines, data.pipelinescount); + } + + SDL_free(renderer); +}} + +static void * +METAL_GetMetalLayer(SDL_Renderer * renderer) +{ @autoreleasepool { + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + return (__bridge void*)data.mtllayer; +}} + +static void * +METAL_GetMetalCommandEncoder(SDL_Renderer * renderer) +{ @autoreleasepool { + METAL_ActivateRenderCommandEncoder(renderer, MTLLoadActionLoad); + METAL_RenderData *data = (__bridge METAL_RenderData *) renderer->driverdata; + return (__bridge void*)data.mtlcmdencoder; +}} + +#endif /* SDL_VIDEO_RENDER_METAL && !SDL_RENDER_DISABLED */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/metal/SDL_shaders_metal.metal b/Engine/lib/sdl/src/render/metal/SDL_shaders_metal.metal new file mode 100644 index 000000000..8df3b753e --- /dev/null +++ b/Engine/lib/sdl/src/render/metal/SDL_shaders_metal.metal @@ -0,0 +1,109 @@ +#include +#include + +using namespace metal; + +struct SolidVertexOutput +{ + float4 position [[position]]; + float pointSize [[point_size]]; +}; + +vertex SolidVertexOutput SDL_Solid_vertex(const device float2 *position [[buffer(0)]], + constant float4x4 &projection [[buffer(2)]], + constant float4x4 &transform [[buffer(3)]], + uint vid [[vertex_id]]) +{ + SolidVertexOutput v; + v.position = (projection * transform) * float4(position[vid], 0.0f, 1.0f); + v.pointSize = 1.0f; + return v; +} + +fragment float4 SDL_Solid_fragment(constant float4 &col [[buffer(0)]]) +{ + return col; +} + +struct CopyVertexOutput +{ + float4 position [[position]]; + float2 texcoord; +}; + +vertex CopyVertexOutput SDL_Copy_vertex(const device float2 *position [[buffer(0)]], + const device float2 *texcoords [[buffer(1)]], + constant float4x4 &projection [[buffer(2)]], + constant float4x4 &transform [[buffer(3)]], + uint vid [[vertex_id]]) +{ + CopyVertexOutput v; + v.position = (projection * transform) * float4(position[vid], 0.0f, 1.0f); + v.texcoord = texcoords[vid]; + return v; +} + +fragment float4 SDL_Copy_fragment(CopyVertexOutput vert [[stage_in]], + constant float4 &col [[buffer(0)]], + texture2d tex [[texture(0)]], + sampler s [[sampler(0)]]) +{ + return tex.sample(s, vert.texcoord) * col; +} + +struct YUVDecode +{ + float3 offset; + float3 Rcoeff; + float3 Gcoeff; + float3 Bcoeff; +}; + +fragment float4 SDL_YUV_fragment(CopyVertexOutput vert [[stage_in]], + constant float4 &col [[buffer(0)]], + constant YUVDecode &decode [[buffer(1)]], + texture2d texY [[texture(0)]], + texture2d_array texUV [[texture(1)]], + sampler s [[sampler(0)]]) +{ + float3 yuv; + yuv.x = texY.sample(s, vert.texcoord).r; + yuv.y = texUV.sample(s, vert.texcoord, 0).r; + yuv.z = texUV.sample(s, vert.texcoord, 1).r; + + yuv += decode.offset; + + return col * float4(dot(yuv, decode.Rcoeff), dot(yuv, decode.Gcoeff), dot(yuv, decode.Bcoeff), 1.0); +} + +fragment float4 SDL_NV12_fragment(CopyVertexOutput vert [[stage_in]], + constant float4 &col [[buffer(0)]], + constant YUVDecode &decode [[buffer(1)]], + texture2d texY [[texture(0)]], + texture2d texUV [[texture(1)]], + sampler s [[sampler(0)]]) +{ + float3 yuv; + yuv.x = texY.sample(s, vert.texcoord).r; + yuv.yz = texUV.sample(s, vert.texcoord).rg; + + yuv += decode.offset; + + return col * float4(dot(yuv, decode.Rcoeff), dot(yuv, decode.Gcoeff), dot(yuv, decode.Bcoeff), 1.0); +} + +fragment float4 SDL_NV21_fragment(CopyVertexOutput vert [[stage_in]], + constant float4 &col [[buffer(0)]], + constant YUVDecode &decode [[buffer(1)]], + texture2d texY [[texture(0)]], + texture2d texUV [[texture(1)]], + sampler s [[sampler(0)]]) +{ + float3 yuv; + yuv.x = texY.sample(s, vert.texcoord).r; + yuv.yz = texUV.sample(s, vert.texcoord).gr; + + yuv += decode.offset; + + return col * float4(dot(yuv, decode.Rcoeff), dot(yuv, decode.Gcoeff), dot(yuv, decode.Bcoeff), 1.0); +} diff --git a/Engine/lib/sdl/src/render/metal/SDL_shaders_metal_ios.h b/Engine/lib/sdl/src/render/metal/SDL_shaders_metal_ios.h new file mode 100644 index 000000000..1c9325238 --- /dev/null +++ b/Engine/lib/sdl/src/render/metal/SDL_shaders_metal_ios.h @@ -0,0 +1,1899 @@ +const unsigned char sdl_metallib[] = { + 0x4d, 0x54, 0x4c, 0x42, 0x01, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xd8, 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xa8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x54, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x4e, 0x41, 0x4d, 0x45, 0x11, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x53, 0x6f, + 0x6c, 0x69, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x00, 0x54, + 0x59, 0x50, 0x45, 0x01, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x20, 0x00, + 0xa1, 0x91, 0x35, 0x76, 0xce, 0x36, 0x38, 0x71, 0xba, 0x1c, 0x81, 0x62, + 0xda, 0x7c, 0x6b, 0x94, 0xc7, 0x88, 0x39, 0xd4, 0x91, 0xc2, 0xe7, 0xf9, + 0x21, 0x8c, 0x74, 0x25, 0xa9, 0xb0, 0x81, 0x85, 0x4f, 0x46, 0x46, 0x54, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x77, 0x00, 0x00, 0x00, + 0x4e, 0x41, 0x4d, 0x45, 0x10, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x43, 0x6f, + 0x70, 0x79, 0x5f, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x00, 0x54, 0x59, + 0x50, 0x45, 0x01, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x20, 0x00, 0x71, + 0xbb, 0x07, 0x58, 0x1b, 0x7c, 0x44, 0xaa, 0x03, 0xc8, 0xab, 0x11, 0xe4, + 0x63, 0xdb, 0xe3, 0xe6, 0xce, 0x52, 0x97, 0x34, 0x82, 0xf0, 0x46, 0x70, + 0xaa, 0xa9, 0x31, 0x51, 0x3c, 0xe8, 0x39, 0x4f, 0x46, 0x46, 0x54, 0x18, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, + 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x7a, 0x00, 0x00, 0x00, 0x4e, + 0x41, 0x4d, 0x45, 0x13, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x53, 0x6f, 0x6c, + 0x69, 0x64, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x00, + 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, 0x20, + 0x00, 0x4a, 0x07, 0x48, 0xd3, 0xb7, 0x7a, 0x3a, 0x01, 0x6c, 0xaa, 0x80, + 0xde, 0x84, 0x6e, 0x3c, 0x9a, 0xdd, 0x55, 0x90, 0x43, 0xa6, 0xdd, 0xbb, + 0xd6, 0xeb, 0xea, 0x81, 0x62, 0xf6, 0x50, 0x04, 0x95, 0x4f, 0x46, 0x46, + 0x54, 0x18, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x16, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, + 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, 0x00, 0x00, + 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x43, + 0x6f, 0x70, 0x79, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, + 0x20, 0x00, 0x4c, 0xaa, 0x05, 0x27, 0x1a, 0x40, 0x5c, 0xe3, 0xd5, 0x46, + 0x38, 0xad, 0x07, 0xe7, 0x70, 0xdf, 0xde, 0x83, 0x74, 0x96, 0x26, 0x6e, + 0x35, 0x7b, 0xc9, 0xc5, 0x46, 0x08, 0x51, 0xb4, 0x13, 0xa8, 0x4f, 0x46, + 0x46, 0x54, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, + 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x78, 0x00, + 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x11, 0x00, 0x53, 0x44, 0x4c, 0x5f, + 0x59, 0x55, 0x56, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, + 0x20, 0x00, 0xc9, 0x73, 0x33, 0x9a, 0x36, 0x6d, 0x15, 0x10, 0xa2, 0x81, + 0xaa, 0xbf, 0x27, 0xb1, 0x22, 0xc6, 0x0a, 0x7b, 0x68, 0x66, 0xdb, 0xe9, + 0xab, 0x19, 0x22, 0x40, 0x87, 0x6b, 0x10, 0x93, 0xc5, 0xf5, 0x4f, 0x46, + 0x46, 0x54, 0x18, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x2a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, + 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, 0x00, + 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, 0x5f, + 0x4e, 0x56, 0x31, 0x32, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, + 0x48, 0x20, 0x00, 0x59, 0x54, 0x77, 0x75, 0xe5, 0xb6, 0xd5, 0x2e, 0xf7, + 0xb1, 0x9d, 0xd1, 0x75, 0x39, 0x4c, 0x97, 0x0f, 0x40, 0x58, 0xaa, 0xc9, + 0x42, 0xe8, 0x03, 0x29, 0x1e, 0x93, 0x63, 0x0c, 0x91, 0x38, 0xc8, 0x4f, + 0x46, 0x46, 0x54, 0x18, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x38, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, + 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, + 0x00, 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, + 0x5f, 0x4e, 0x56, 0x32, 0x31, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, + 0x6e, 0x74, 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, + 0x53, 0x48, 0x20, 0x00, 0x77, 0x01, 0x3e, 0x26, 0x2e, 0xc2, 0xe2, 0x34, + 0x70, 0xcf, 0x0c, 0x9e, 0x0d, 0xed, 0x69, 0xa4, 0x2a, 0x9c, 0x80, 0x06, + 0x52, 0xd1, 0x4b, 0x77, 0x6d, 0xda, 0x29, 0x27, 0x51, 0x25, 0xf4, 0x92, + 0x4f, 0x46, 0x46, 0x54, 0x18, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x46, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, + 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x30, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xc9, 0x02, 0x00, 0x00, + 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, + 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, + 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, + 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, + 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, + 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, + 0x51, 0x18, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x20, 0x00, + 0x16, 0xa0, 0xda, 0x60, 0x08, 0x02, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x18, + 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x20, 0x01, 0x15, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0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0e, 0x6d, + 0x00, 0x0f, 0xf2, 0xf0, 0x0e, 0xf4, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef, + 0x20, 0x0f, 0x6d, 0x20, 0x0e, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2, + 0xd0, 0x06, 0xf3, 0x90, 0x0e, 0xfa, 0x50, 0x0e, 0x00, 0x1e, 0x00, 0x04, + 0x3d, 0x84, 0x83, 0x3c, 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43, + 0x39, 0x84, 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d, + 0x60, 0x0e, 0xf0, 0x10, 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3, + 0x10, 0x0e, 0xe6, 0x50, 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, + 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, + 0x40, 0xd4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, + 0x3d, 0xb4, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, + 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x08, 0x00, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x50, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x70, 0x9f, 0x34, 0x45, 0x94, + 0x30, 0xf9, 0xac, 0xb3, 0x20, 0xc3, 0x4b, 0x44, 0x13, 0x71, 0xa1, 0xd4, + 0xf4, 0x50, 0x93, 0xff, 0x00, 0x82, 0x42, 0x0c, 0x58, 0x08, 0x60, 0x18, + 0x41, 0x00, 0x06, 0x11, 0x86, 0x20, 0x09, 0xc2, 0x4c, 0xd3, 0x38, 0xb0, + 0x43, 0x38, 0xcc, 0xc3, 0x3c, 0xb8, 0x41, 0x3b, 0x94, 0x03, 0x3d, 0x84, + 0x03, 0x3b, 0xe8, 0x81, 0x1e, 0xb4, 0x43, 0x38, 0xd0, 0x83, 0x3c, 0xa4, + 0x03, 0x3e, 0xa0, 0xa0, 0x0c, 0x22, 0x18, 0xc2, 0x1c, 0x01, 0x18, 0x94, + 0x42, 0x90, 0x73, 0x10, 0xa5, 0x81, 0x00, 0x32, 0x73, 0x04, 0xa0, 0x30, + 0x88, 0x10, 0x08, 0x53, 0x00, 0x23, 0x00, 0xc3, 0x08, 0x04, 0x32, 0x47, + 0x10, 0x50, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, + 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, + 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, + 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, + 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, + 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, + 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, + 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, + 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, + 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, + 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, + 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, + 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, + 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, + 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, + 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x43, 0x18, 0x05, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x2c, 0x10, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x42, + 0x25, 0x30, 0x02, 0x50, 0x80, 0x01, 0x05, 0x51, 0x04, 0x05, 0x52, 0x06, + 0xd4, 0x46, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, + 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, + 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, + 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, + 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, + 0x65, 0x88, 0xb0, 0x00, 0x43, 0x0c, 0x24, 0x40, 0x08, 0x44, 0x60, 0xd1, + 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x59, 0x06, 0x24, 0x40, 0x02, 0x44, + 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, + 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x0a, 0x72, 0x61, 0x69, 0x72, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, + 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x84, 0xe5, 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, + 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, + 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x96, 0x84, 0x61, 0x10, + 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, + 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, + 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x16, + 0x32, 0x61, 0x69, 0x72, 0x2e, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, + 0x6e, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, + 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, + 0xd1, 0xd1, 0x90, 0x09, 0x4b, 0x93, 0x73, 0x09, 0x93, 0x3b, 0xfb, 0x72, + 0x0b, 0x6b, 0x2b, 0x23, 0x02, 0xf7, 0x36, 0x97, 0x46, 0x97, 0xf6, 0xe6, + 0x36, 0x44, 0x59, 0x9a, 0xc5, 0x59, 0x9e, 0x05, 0x5a, 0x22, 0x3a, 0x61, + 0x69, 0x72, 0x2e, 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, + 0x65, 0x2c, 0xcc, 0xd8, 0xde, 0xc2, 0xe8, 0x98, 0xc0, 0xbd, 0xa5, 0xb9, + 0xd1, 0x4d, 0xa5, 0xe9, 0x95, 0x0d, 0x51, 0x96, 0x69, 0x71, 0x16, 0x6a, + 0x81, 0x96, 0x6a, 0x08, 0xb1, 0x48, 0x8b, 0x45, 0x25, 0x2c, 0x4d, 0xce, + 0x45, 0xac, 0xce, 0xcc, 0xac, 0x4c, 0x8e, 0x52, 0x58, 0x9a, 0x9c, 0x0b, + 0xdb, 0xdb, 0x58, 0x18, 0x5d, 0xda, 0x9b, 0xdb, 0x57, 0x9a, 0x1b, 0x59, + 0x19, 0x1e, 0x91, 0xb0, 0x34, 0x39, 0x17, 0xb9, 0xb2, 0x30, 0x32, 0x46, + 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, + 0x5f, 0x73, 0x69, 0x7a, 0x65, 0xbc, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, + 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xc2, 0xd8, 0xd2, 0xce, 0xdc, + 0xbe, 0xe6, 0xd2, 0xf4, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xc9, + 0x0c, 0xe1, 0x10, 0x61, 0xc1, 0x96, 0x0c, 0x11, 0x90, 0x60, 0xd1, 0x96, + 0x0d, 0x21, 0x16, 0x0e, 0x21, 0x16, 0x67, 0xe9, 0x16, 0x68, 0x89, 0xf8, + 0x84, 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, + 0xa5, 0xe9, 0x95, 0x11, 0x31, 0x63, 0x7b, 0x0b, 0xa3, 0xa3, 0xc1, 0xa3, + 0xa1, 0x02, 0x27, 0xf7, 0xa6, 0x56, 0x36, 0x46, 0x97, 0xf6, 0xe6, 0x36, + 0x04, 0x0c, 0x90, 0x60, 0xc1, 0x96, 0x0f, 0x19, 0x96, 0x0c, 0x29, 0x90, + 0x60, 0xd1, 0x96, 0x0d, 0x19, 0x16, 0x0e, 0x31, 0x16, 0x67, 0x01, 0x83, + 0x05, 0x5a, 0xc2, 0x80, 0x09, 0x9d, 0x5c, 0x98, 0xdb, 0x9c, 0xd9, 0x9b, + 0x5c, 0xdb, 0x10, 0x30, 0x40, 0x8a, 0x05, 0x5b, 0x3e, 0x64, 0x58, 0x32, + 0xe4, 0x40, 0x82, 0x45, 0x5b, 0x36, 0x64, 0x58, 0x38, 0xc4, 0x58, 0x9c, + 0x05, 0x0c, 0x16, 0x68, 0x19, 0x03, 0x36, 0x61, 0x69, 0x72, 0x2e, 0x76, + 0x65, 0x72, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x64, 0x24, 0xea, 0xd2, 0xdc, + 0xe8, 0x38, 0xd8, 0xa5, 0x91, 0x0d, 0x61, 0x90, 0x63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e1, 0x1d, 0xdc, 0x61, + 0x1e, 0xa6, 0x10, 0x06, 0xa2, 0x30, 0x23, 0x94, 0x70, 0x48, 0x07, 0x79, + 0x70, 0x03, 0x7b, 0x28, 0x07, 0x79, 0xa0, 0x87, 0x72, 0xc0, 0x87, 0x29, + 0x81, 0x1a, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, + 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, + 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, + 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, + 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, + 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, + 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, + 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, + 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, + 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, + 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, + 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, + 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, + 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, + 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, + 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, + 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, + 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, + 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, + 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, + 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, + 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, + 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, + 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, + 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, + 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, + 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, + 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, + 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, + 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x06, 0x00, 0xb1, 0x5d, 0xf9, 0xb3, 0xce, 0x82, + 0x0c, 0x7f, 0x45, 0x44, 0x13, 0x71, 0x01, 0x00, 0x61, 0x20, 0x00, 0x00, + 0x69, 0x00, 0x00, 0x00, 0x13, 0x04, 0x47, 0x2c, 0x10, 0x00, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x14, 0xe7, 0x20, 0x84, 0x60, 0x9a, 0x46, 0x00, + 0xa8, 0x95, 0x41, 0x11, 0x94, 0x00, 0xa1, 0x42, 0x98, 0x01, 0xa0, 0x31, + 0x03, 0x40, 0x62, 0x06, 0x80, 0xc2, 0x0c, 0x00, 0x81, 0x11, 0x80, 0x31, + 0x02, 0x10, 0x04, 0x41, 0xfc, 0x03, 0x00, 0x00, 0x33, 0x11, 0x0c, 0x12, + 0x14, 0x33, 0x11, 0x0c, 0x12, 0x14, 0xe3, 0x11, 0xd1, 0x94, 0x4d, 0x14, + 0x94, 0x59, 0x82, 0x60, 0xa0, 0x02, 0xb1, 0x03, 0xe0, 0x0c, 0x86, 0x0b, + 0x9a, 0x8c, 0x47, 0x50, 0x57, 0x17, 0x50, 0x50, 0x06, 0x19, 0x82, 0x65, + 0xb2, 0xc0, 0x90, 0xcf, 0x2c, 0x81, 0x30, 0x50, 0x81, 0x90, 0x42, 0x50, + 0x09, 0x03, 0x15, 0x01, 0x11, 0x44, 0xc2, 0x18, 0x42, 0x21, 0xcc, 0x31, + 0x40, 0x01, 0x19, 0x0c, 0x32, 0x04, 0x51, 0x76, 0x45, 0x93, 0xf1, 0x88, + 0x2f, 0x0c, 0xce, 0x20, 0xa0, 0xa0, 0x58, 0x40, 0xc8, 0xc7, 0x02, 0x04, + 0x3e, 0xa6, 0xb0, 0x01, 0x0c, 0x86, 0x1b, 0x02, 0x0e, 0x0c, 0x66, 0x19, + 0x06, 0x21, 0x18, 0x8f, 0xb0, 0xce, 0xa0, 0x0d, 0xa2, 0xc1, 0x88, 0x80, + 0x28, 0x00, 0x9b, 0xde, 0x00, 0x06, 0xc3, 0x0d, 0xc1, 0x07, 0x06, 0xb3, + 0x0c, 0x44, 0x10, 0x8c, 0x47, 0x64, 0x6a, 0x00, 0x07, 0x6a, 0x40, 0x41, + 0x19, 0x8f, 0xd8, 0xd8, 0x40, 0x0e, 0xc6, 0x80, 0x82, 0x32, 0x1e, 0xd1, + 0xb9, 0x01, 0x1d, 0x98, 0x01, 0x05, 0x65, 0x3c, 0xe2, 0x83, 0x03, 0x3b, + 0x48, 0x03, 0x0a, 0xca, 0x78, 0x04, 0x18, 0xc8, 0x01, 0x1e, 0xc8, 0xc1, + 0x60, 0x44, 0x80, 0x14, 0xc0, 0x78, 0x44, 0x18, 0xcc, 0x41, 0x1e, 0xa8, + 0xc1, 0x60, 0x44, 0x70, 0x14, 0xc0, 0x78, 0x84, 0x18, 0xd0, 0x81, 0x1e, + 0xb0, 0xc1, 0x60, 0x44, 0x60, 0x14, 0xc0, 0x78, 0xc4, 0x18, 0xd4, 0xc1, + 0x1e, 0xb8, 0xc1, 0x60, 0x44, 0x50, 0x14, 0xc0, 0xc9, 0x41, 0x8b, 0xf1, + 0x04, 0x3b, 0x08, 0x28, 0x20, 0x83, 0x0c, 0x41, 0x1b, 0xd0, 0xc1, 0x1c, + 0x43, 0xb0, 0x06, 0x7d, 0x30, 0xc7, 0x10, 0xac, 0x01, 0x1f, 0x0c, 0x32, + 0x04, 0x6e, 0x60, 0x07, 0x16, 0x48, 0xf2, 0x99, 0x25, 0x28, 0x06, 0x2a, + 0x10, 0x95, 0x20, 0xaa, 0x62, 0xa0, 0x22, 0x20, 0x88, 0xa8, 0x18, 0x43, + 0x28, 0x84, 0x39, 0x86, 0x39, 0x08, 0x4e, 0x61, 0x90, 0x21, 0xa0, 0x03, + 0x3e, 0xb8, 0xa2, 0xc9, 0x78, 0x84, 0x1c, 0x90, 0x82, 0x2a, 0x04, 0x14, + 0x14, 0x0b, 0x08, 0xf9, 0x58, 0x80, 0xc0, 0xc7, 0x94, 0x57, 0x80, 0xc1, + 0x70, 0x43, 0xf0, 0x07, 0x60, 0x30, 0xcb, 0x60, 0x14, 0xc1, 0x6c, 0x43, + 0x1f, 0x0c, 0xc0, 0x6c, 0x43, 0xb0, 0x07, 0x41, 0x06, 0x01, 0x31, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x21, 0x78, 0x83, 0x2d, 0x03, 0x12, + 0xbc, 0xc1, 0x96, 0x61, 0x0a, 0xde, 0x60, 0xcb, 0xa0, 0x05, 0x6f, 0xb0, + 0x65, 0x80, 0x83, 0xe0, 0x0d, 0xb6, 0x0c, 0x7e, 0x10, 0xbc, 0x01, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x88, 0x0b, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, + 0xdf, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, + 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, + 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, + 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, + 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, + 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, + 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, + 0x1b, 0x8c, 0x20, 0x00, 0x16, 0xa0, 0xda, 0x60, 0x08, 0x02, 0xb0, 0x00, + 0xd5, 0x06, 0x63, 0x18, 0x80, 0x05, 0xa8, 0x36, 0x18, 0x04, 0x01, 0x2c, + 0x40, 0xb5, 0x81, 0x5c, 0x8a, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, + 0xa8, 0x88, 0x71, 0x78, 0x07, 0x79, 0x90, 0x87, 0x72, 0x18, 0x07, 0x7a, + 0x60, 0x87, 0x7c, 0x68, 0x03, 0x79, 0x78, 0x87, 0x7a, 0x70, 0x07, 0x72, + 0x28, 0x07, 0x72, 0x68, 0x03, 0x72, 0x48, 0x07, 0x7b, 0x48, 0x07, 0x72, + 0x28, 0x87, 0x36, 0x98, 0x87, 0x78, 0x90, 0x07, 0x7a, 0x68, 0x03, 0x73, + 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xcc, 0x21, + 0x1c, 0xd8, 0x61, 0x1e, 0xca, 0x01, 0x20, 0xc8, 0x21, 0x1d, 0xe6, 0x21, + 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0xa1, 0x0d, 0xe8, 0x21, 0x1c, 0xd2, 0x81, + 0x1d, 0xda, 0x60, 0x1c, 0xc2, 0x81, 0x1d, 0xd8, 0x61, 0x1e, 0x00, 0x73, + 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x76, 0x28, 0x87, 0x79, + 0x98, 0x87, 0x36, 0x80, 0x07, 0x79, 0x28, 0x87, 0x71, 0x48, 0x87, 0x79, + 0x28, 0x87, 0x36, 0x30, 0x07, 0x78, 0x68, 0x87, 0x70, 0x20, 0x07, 0x80, + 0x1e, 0xe4, 0xa1, 0x1e, 0xca, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0xc0, + 0x1c, 0xe4, 0x21, 0x1c, 0xda, 0xa1, 0x1c, 0xda, 0x00, 0x1e, 0xde, 0x21, + 0x1d, 0xdc, 0x81, 0x1e, 0xca, 0x41, 0x1e, 0xda, 0xa0, 0x1c, 0xd8, 0x21, + 0x1d, 0xda, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x06, 0x77, + 0x78, 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, + 0x80, 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, + 0x28, 0x07, 0x76, 0x48, 0x87, 0x76, 0x68, 0x03, 0x77, 0x78, 0x07, 0x77, + 0x68, 0x03, 0x76, 0x28, 0x87, 0x70, 0x30, 0x07, 0x80, 0x70, 0x87, 0x77, + 0x68, 0x83, 0x74, 0x70, 0x07, 0x73, 0x98, 0x87, 0x36, 0x30, 0x07, 0x78, + 0x68, 0x83, 0x76, 0x08, 0x07, 0x7a, 0x40, 0x07, 0x80, 0x1e, 0xe4, 0xa1, + 0x1e, 0xca, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0x40, 0x1d, 0xea, 0xa1, + 0x1d, 0xe0, 0xa1, 0x0d, 0xe8, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, + 0x1e, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x77, + 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73, + 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, + 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21, + 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41, + 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, + 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, + 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, + 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, + 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, + 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21, + 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21, + 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73, + 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70, + 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, + 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2, + 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1, + 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70, + 0x60, 0x87, 0x79, 0x28, 0x07, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x13, 0x8a, 0x40, 0x18, 0x88, 0x02, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x50, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0xe7, + 0x49, 0x53, 0x44, 0x09, 0x93, 0xcf, 0x39, 0x0f, 0xf6, 0x12, 0xd1, 0x44, + 0x5c, 0x28, 0x35, 0x3d, 0xd4, 0xe4, 0x3f, 0x80, 0xa0, 0x10, 0x03, 0x16, + 0x82, 0x18, 0x44, 0x10, 0x82, 0x24, 0x08, 0x33, 0x4d, 0xe3, 0xc0, 0x0e, + 0xe1, 0x30, 0x0f, 0xf3, 0xe0, 0x06, 0xed, 0x50, 0x0e, 0xf4, 0x10, 0x0e, + 0xec, 0xa0, 0x07, 0x7a, 0xd0, 0x0e, 0xe1, 0x40, 0x0f, 0xf2, 0x90, 0x0e, + 0xf8, 0x80, 0x82, 0x32, 0x88, 0x60, 0x08, 0x73, 0x04, 0x60, 0x50, 0x8c, + 0x41, 0xc8, 0x39, 0x88, 0xd2, 0x40, 0x00, 0x99, 0x39, 0x02, 0x50, 0x18, + 0x44, 0x08, 0x84, 0x29, 0x80, 0x11, 0x80, 0x61, 0x04, 0x02, 0x99, 0x23, + 0x08, 0x28, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, + 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, + 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, + 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, + 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, + 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, + 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, + 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, + 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, + 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, + 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, + 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, + 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, + 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, + 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, + 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x43, 0x18, 0x05, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x2c, 0x10, 0x00, 0x00, 0x09, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x42, + 0x25, 0x50, 0x10, 0x23, 0x00, 0x05, 0x18, 0x50, 0x04, 0x05, 0x52, 0x06, + 0x85, 0x40, 0x6d, 0x04, 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0xd3, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, + 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, + 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, + 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, + 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0xb0, 0x00, 0x43, 0x0c, 0x24, 0x40, + 0x04, 0x64, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x59, 0x06, + 0x24, 0x40, 0x02, 0x64, 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, + 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, + 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x0a, + 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, + 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x84, 0xe5, 0x20, 0x19, 0x84, 0xa5, + 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, + 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, + 0xd1, 0x8d, 0xa1, 0x7d, 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, + 0x96, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, + 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, + 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, + 0x36, 0x44, 0x58, 0x16, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x70, 0x6f, 0x73, + 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, + 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, + 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x90, 0x09, 0x4b, 0x93, 0x73, 0x09, + 0x93, 0x3b, 0xfb, 0x72, 0x0b, 0x6b, 0x2b, 0x23, 0x02, 0xf7, 0x36, 0x97, + 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x44, 0x59, 0x9a, 0xc5, 0x59, 0x9e, 0x05, + 0x5a, 0x22, 0x46, 0x61, 0x69, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x74, 0x65, + 0x78, 0x5f, 0x6f, 0x75, 0x74, 0x70, 0x75, 0x74, 0xcc, 0xce, 0xca, 0xdc, + 0xca, 0xe4, 0xc2, 0xe8, 0xca, 0xc8, 0x50, 0x70, 0xe8, 0xca, 0xf0, 0xc6, + 0xde, 0xde, 0xe4, 0xc8, 0x88, 0xec, 0x64, 0xbe, 0xcc, 0x52, 0x68, 0x98, + 0xb1, 0xbd, 0x85, 0xd1, 0xc9, 0x10, 0xa1, 0x2b, 0xc3, 0x1b, 0x7b, 0x7b, + 0x93, 0x23, 0x1b, 0xc2, 0x2c, 0xd3, 0x42, 0x2d, 0xce, 0x52, 0x2d, 0xd0, + 0x62, 0x0d, 0x21, 0x16, 0x69, 0xb9, 0xa8, 0x84, 0xa5, 0xc9, 0xb9, 0x88, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x51, 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, + 0x1b, 0x0b, 0xa3, 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, + 0x23, 0x12, 0x96, 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, + 0x4d, 0xce, 0x25, 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, + 0x2e, 0x4d, 0xaf, 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, + 0x17, 0x5d, 0x1e, 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, + 0x5c, 0x9a, 0x5e, 0xd9, 0x10, 0x0e, 0x19, 0x96, 0x6c, 0xd1, 0x90, 0x01, + 0x09, 0x96, 0x6d, 0xe1, 0x10, 0x61, 0xe9, 0x10, 0x61, 0x71, 0x96, 0x6a, + 0x81, 0x96, 0x88, 0x09, 0x5d, 0x19, 0xde, 0xd8, 0xdb, 0x9b, 0x1c, 0xd9, + 0xdc, 0x10, 0x0e, 0x09, 0x96, 0x6c, 0xd1, 0x90, 0x00, 0x09, 0x96, 0x6d, + 0xe1, 0x10, 0x61, 0xe9, 0x10, 0x61, 0x71, 0x96, 0x6a, 0x81, 0x96, 0x8f, + 0x4f, 0x58, 0x9a, 0x9c, 0x8b, 0x58, 0x9d, 0x99, 0x59, 0x99, 0xdc, 0xd7, + 0x5c, 0x9a, 0x5e, 0x19, 0x11, 0x33, 0xb6, 0xb7, 0x30, 0x3a, 0x1a, 0x3c, + 0x1a, 0x2a, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x43, 0xc0, 0x00, 0x29, 0x96, 0x6c, 0x09, 0x03, 0x84, 0x58, 0x34, 0xa4, + 0x40, 0x82, 0x65, 0x5b, 0x38, 0x84, 0x58, 0x3a, 0xc4, 0x58, 0x9c, 0x45, + 0x0c, 0x16, 0x68, 0x19, 0x03, 0x26, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, + 0x6f, 0x72, 0x6d, 0x43, 0xc0, 0x00, 0x39, 0x96, 0x6c, 0x09, 0x03, 0x84, + 0x58, 0x34, 0xe4, 0x40, 0x82, 0x65, 0x5b, 0x38, 0x84, 0x58, 0x3a, 0xc4, + 0x58, 0x9c, 0x45, 0x0c, 0x16, 0x68, 0x29, 0x03, 0x36, 0x61, 0x69, 0x72, + 0x2e, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x64, 0x24, 0xea, + 0xd2, 0xdc, 0xe8, 0x38, 0xd8, 0xa5, 0x91, 0x0d, 0x61, 0x10, 0x64, 0x39, + 0x83, 0xc5, 0x59, 0xd0, 0x60, 0x81, 0x96, 0x34, 0x18, 0xa2, 0x2c, 0xde, + 0x02, 0x06, 0x0b, 0x19, 0x2c, 0x66, 0xb0, 0xa8, 0xc1, 0x10, 0x43, 0x01, + 0x16, 0x6c, 0x59, 0x03, 0x3e, 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, + 0x65, 0x6e, 0x74, 0x20, 0x63, 0x68, 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, + 0xe0, 0xd8, 0xca, 0x40, 0x86, 0x56, 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, + 0x86, 0x08, 0x8b, 0x1b, 0x0c, 0x31, 0x96, 0x36, 0x58, 0xde, 0xa0, 0x49, + 0x86, 0x18, 0x0b, 0x1c, 0x2c, 0x70, 0xd0, 0x24, 0x23, 0x14, 0x76, 0x60, + 0x07, 0x7b, 0x68, 0x07, 0x37, 0x48, 0x07, 0x72, 0x28, 0x07, 0x77, 0xa0, + 0x87, 0x29, 0x41, 0x30, 0x62, 0x09, 0x87, 0x74, 0x90, 0x07, 0x37, 0xb0, + 0x87, 0x72, 0x90, 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x81, + 0x30, 0x82, 0x0a, 0x87, 0x74, 0x90, 0x07, 0x37, 0x60, 0x87, 0x70, 0x70, + 0x87, 0x73, 0xa8, 0x87, 0x70, 0x38, 0x87, 0x72, 0xf8, 0x05, 0x7b, 0x28, + 0x07, 0x79, 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x10, 0x23, + 0xa6, 0x70, 0x48, 0x07, 0x79, 0x70, 0x83, 0x71, 0x78, 0x87, 0x76, 0x80, + 0x87, 0x74, 0x60, 0x87, 0x72, 0xf8, 0x85, 0x77, 0x80, 0x07, 0x7a, 0x48, + 0x87, 0x77, 0x70, 0x87, 0x79, 0x98, 0x42, 0x18, 0x88, 0xc2, 0x8c, 0x50, + 0xc2, 0x21, 0x1d, 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x81, 0x1e, + 0xca, 0x01, 0x1f, 0xa6, 0x04, 0x6c, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, + 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, + 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, + 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, + 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, + 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, + 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, + 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, + 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, + 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, + 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, + 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, + 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, + 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, + 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, + 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, + 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, + 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, + 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, + 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, + 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, + 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, + 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, + 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, + 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, + 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, + 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, + 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, + 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, + 0x71, 0x20, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x06, 0xf0, 0xb0, 0x5d, + 0xf9, 0x73, 0xce, 0x83, 0xfd, 0x15, 0x11, 0x4d, 0xc4, 0x05, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x6d, 0x00, 0x00, 0x00, 0x13, 0x04, 0x47, 0x2c, + 0x10, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x14, 0xe7, 0x20, 0x86, + 0x80, 0xa2, 0x46, 0x00, 0xa8, 0x95, 0x41, 0x11, 0x94, 0x00, 0xa1, 0x19, + 0x00, 0x1a, 0x33, 0x00, 0x24, 0x66, 0x00, 0x28, 0xcc, 0x00, 0x10, 0x18, + 0x23, 0x00, 0x41, 0x10, 0xc4, 0xbf, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x33, 0x11, 0x0c, 0x12, 0x14, 0x33, 0x11, 0x0c, 0x12, 0x14, 0xe3, 0x11, + 0xd0, 0x94, 0x4d, 0x14, 0x94, 0x59, 0x82, 0x60, 0xa0, 0x02, 0xb1, 0x03, + 0xe0, 0x0c, 0x86, 0x0b, 0x9a, 0x8c, 0x47, 0x4c, 0x57, 0x17, 0x50, 0x50, + 0x06, 0x19, 0x82, 0x45, 0xb2, 0xc0, 0x90, 0xcf, 0x2c, 0x81, 0x30, 0x50, + 0x81, 0x98, 0x42, 0x50, 0x09, 0x03, 0x15, 0x01, 0x11, 0x44, 0xc2, 0x18, + 0x42, 0x21, 0xcc, 0x31, 0x40, 0x01, 0x19, 0x0c, 0x32, 0x04, 0x11, 0x76, + 0x45, 0x93, 0xf1, 0x08, 0x2f, 0x0c, 0xce, 0x20, 0xa0, 0xa0, 0x58, 0x40, + 0xc8, 0xc7, 0x02, 0x04, 0x3e, 0xa6, 0xb4, 0x01, 0x0c, 0x86, 0x1b, 0x82, + 0x33, 0x00, 0x83, 0x59, 0x86, 0x41, 0x08, 0xc6, 0x23, 0xac, 0x33, 0x68, + 0x83, 0x68, 0x30, 0x22, 0x20, 0x0a, 0xc0, 0x26, 0x38, 0x80, 0xc1, 0x70, + 0x43, 0xa0, 0x06, 0x60, 0x30, 0xcb, 0x40, 0x04, 0xc1, 0x78, 0x44, 0xa6, + 0x06, 0x70, 0xa0, 0x06, 0x14, 0x94, 0xf1, 0x88, 0x8d, 0x0d, 0xe4, 0x40, + 0x0c, 0x28, 0x28, 0xe3, 0x11, 0x9d, 0x1b, 0xd0, 0x41, 0x19, 0x50, 0x50, + 0xc6, 0x23, 0x3e, 0x38, 0xb0, 0x03, 0x34, 0xa0, 0xa0, 0x8c, 0x47, 0x80, + 0x81, 0x1c, 0xe0, 0x81, 0x1c, 0x0c, 0x46, 0x04, 0x48, 0x01, 0x8c, 0x47, + 0x84, 0xc1, 0x1c, 0xe4, 0x41, 0x1a, 0x0c, 0x46, 0x04, 0x47, 0x01, 0x8c, + 0x47, 0x88, 0x01, 0x1d, 0xe8, 0xc1, 0x1a, 0x0c, 0x46, 0x04, 0x46, 0x01, + 0x8c, 0x47, 0x8c, 0x41, 0x1d, 0xec, 0x41, 0x1b, 0x0c, 0x46, 0x04, 0x45, + 0x01, 0x5c, 0x1c, 0xb4, 0x18, 0x4f, 0xb0, 0x83, 0x80, 0x02, 0x32, 0xc8, + 0x10, 0xb0, 0xc1, 0x1c, 0xcc, 0x31, 0x04, 0x6a, 0xe0, 0x07, 0x73, 0x0c, + 0x01, 0x1b, 0xf4, 0xc1, 0x20, 0x43, 0xe0, 0x06, 0x75, 0x60, 0x81, 0x24, + 0x9f, 0x59, 0x82, 0x62, 0xa0, 0x02, 0x61, 0x09, 0xa2, 0x2a, 0x06, 0x2a, + 0x02, 0x82, 0x88, 0x8a, 0x31, 0x84, 0x42, 0x98, 0x63, 0x98, 0x83, 0xe0, + 0x14, 0x06, 0x19, 0x02, 0x3a, 0xd8, 0x83, 0x2b, 0x9a, 0x8c, 0x47, 0xc8, + 0x01, 0x29, 0xa8, 0x42, 0x40, 0x41, 0xb1, 0x80, 0x90, 0x8f, 0x05, 0x08, + 0x7c, 0x4c, 0x81, 0x05, 0x18, 0x0c, 0x37, 0x04, 0xaa, 0x00, 0x06, 0xb3, + 0x0c, 0x46, 0x11, 0x8c, 0x27, 0xa0, 0x02, 0x45, 0x01, 0x99, 0x6d, 0x00, + 0x85, 0x02, 0x98, 0x6d, 0x08, 0x84, 0x20, 0x83, 0x80, 0x18, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x21, 0x88, 0x83, 0x2d, 0x03, 0x12, + 0xc4, 0xc1, 0x96, 0x61, 0x0a, 0xe2, 0x60, 0xcb, 0xa0, 0x05, 0x71, 0xb0, + 0x65, 0x80, 0x83, 0x20, 0x0e, 0xb6, 0x0c, 0x7e, 0x10, 0xc4, 0xc1, 0x96, + 0xa1, 0x14, 0x82, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x90, 0x08, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, + 0x21, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, + 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, + 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x10, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, + 0x84, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, + 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, + 0x24, 0x07, 0xc8, 0x08, 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, + 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00, + 0x1b, 0x8c, 0x20, 0x00, 0x16, 0xa0, 0xda, 0x40, 0x2e, 0xc2, 0xff, 0xff, + 0xff, 0xff, 0x0f, 0x80, 0x04, 0x54, 0xc4, 0x38, 0xbc, 0x83, 0x3c, 0xc8, + 0x43, 0x39, 0x8c, 0x03, 0x3d, 0xb0, 0x43, 0x3e, 0xb4, 0x81, 0x3c, 0xbc, + 0x43, 0x3d, 0xb8, 0x03, 0x39, 0x94, 0x03, 0x39, 0xb4, 0x01, 0x39, 0xa4, + 0x83, 0x3d, 0xa4, 0x03, 0x39, 0x94, 0x43, 0x1b, 0xcc, 0x43, 0x3c, 0xc8, + 0x03, 0x3d, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1b, 0xb4, 0x43, 0x38, 0xd0, + 0x03, 0x3a, 0x00, 0xe6, 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x10, + 0xe4, 0x90, 0x0e, 0xf3, 0x10, 0x0e, 0xe2, 0xc0, 0x0e, 0xe5, 0xd0, 0x06, + 0xf4, 0x10, 0x0e, 0xe9, 0xc0, 0x0e, 0x6d, 0x30, 0x0e, 0xe1, 0xc0, 0x0e, + 0xec, 0x30, 0x0f, 0x80, 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, + 0x04, 0x3b, 0x94, 0xc3, 0x3c, 0xcc, 0x43, 0x1b, 0xc0, 0x83, 0x3c, 0x94, + 0xc3, 0x38, 0xa4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, + 0x43, 0x38, 0x90, 0x03, 0x40, 0x0f, 0xf2, 0x50, 0x0f, 0xe5, 0x00, 0x10, + 0xee, 0xf0, 0x0e, 0x6d, 0x60, 0x0e, 0xf2, 0x10, 0x0e, 0xed, 0x50, 0x0e, + 0x6d, 0x00, 0x0f, 0xef, 0x90, 0x0e, 0xee, 0x40, 0x0f, 0xe5, 0x20, 0x0f, + 0x6d, 0x50, 0x0e, 0xec, 0x90, 0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, 0x80, 0x0e, 0x80, 0x39, 0x84, + 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0xc4, 0x3c, 0xd0, 0x43, 0x38, 0x8c, + 0xc3, 0x3a, 0xb4, 0x01, 0x3c, 0xc8, 0xc3, 0x3b, 0xd0, 0x43, 0x39, 0x8c, + 0x03, 0x3d, 0xbc, 0x83, 0x3c, 0xb4, 0x81, 0x38, 0xd4, 0x83, 0x39, 0x98, + 0x43, 0x39, 0xc8, 0x43, 0x1b, 0xcc, 0x43, 0x3a, 0xe8, 0x43, 0x39, 0x00, + 0x78, 0x00, 0x10, 0xf4, 0x10, 0x0e, 0xf2, 0x70, 0x0e, 0xe5, 0x40, 0x0f, + 0x6d, 0x60, 0x0e, 0xe5, 0x10, 0x0e, 0xf4, 0x50, 0x0f, 0xf2, 0x50, 0x0e, + 0xf3, 0x00, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1c, 0xd8, 0x01, 0x40, 0xd4, + 0x83, 0x3b, 0xcc, 0x43, 0x38, 0x98, 0x43, 0x39, 0xb4, 0x81, 0x39, 0xc0, + 0x43, 0x1b, 0xb4, 0x43, 0x38, 0xd0, 0x03, 0x3a, 0x00, 0xf4, 0x20, 0x0f, + 0xf5, 0x50, 0x0e, 0x00, 0x51, 0x0f, 0xf3, 0x50, 0x0e, 0x6d, 0x30, 0x0f, + 0xef, 0x60, 0x0e, 0xf4, 0xd0, 0x06, 0xe6, 0xc0, 0x0e, 0xef, 0x10, 0x0e, + 0xf4, 0x00, 0x98, 0x43, 0x38, 0xb0, 0xc3, 0x3c, 0x94, 0x03, 0x00, 0x00, + 0x49, 0x18, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x13, 0x84, 0x40, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x32, 0x22, 0x08, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x13, 0x22, 0xa4, 0x84, 0x04, 0x13, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x88, 0x8c, 0x0b, 0x84, 0x84, 0x4c, + 0x10, 0x24, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x88, 0x10, 0x08, 0x45, + 0x08, 0xa1, 0x19, 0x08, 0x98, 0x23, 0x00, 0x83, 0x39, 0x02, 0x50, 0x18, + 0x01, 0x00, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, + 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, + 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, + 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, + 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, + 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, + 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, + 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, + 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, + 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, + 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, + 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, + 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, + 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, + 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, + 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x43, 0x18, 0x02, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x2c, 0x10, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x0c, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0xb2, + 0x11, 0x80, 0x12, 0x28, 0x90, 0x82, 0xa0, 0x1b, 0x01, 0x00, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, + 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, + 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, + 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, + 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x50, 0x00, + 0x43, 0x0c, 0x43, 0x30, 0x08, 0x23, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, + 0x36, 0x04, 0x29, 0x06, 0x43, 0x30, 0x04, 0x23, 0xe0, 0x16, 0x96, 0x26, + 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, + 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, + 0x36, 0x44, 0x28, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, + 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x84, 0xe2, + 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, + 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, + 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x95, 0xb9, 0x85, 0x89, + 0xb1, 0x95, 0x0d, 0x11, 0x8a, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32, + 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66, + 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x28, 0x16, 0x46, 0x61, 0x69, 0x72, + 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, + 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, + 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0x8a, 0xc6, 0x08, 0x0a, 0xa7, 0x78, 0x86, + 0x08, 0x05, 0x44, 0x25, 0x2c, 0x4d, 0xce, 0x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 0xc4, 0x28, + 0xba, 0xe2, 0x3b, 0x8a, 0x21, 0x46, 0x01, 0x06, 0x05, 0x18, 0x1c, 0xc5, + 0x08, 0x85, 0x1d, 0xd8, 0xc1, 0x1e, 0xda, 0xc1, 0x0d, 0xd2, 0x81, 0x1c, + 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0x10, 0x8c, 0x58, 0xc2, 0x21, 0x1d, + 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x61, 0x1e, 0xd2, 0xe1, 0x1d, + 0xdc, 0x61, 0x4a, 0x20, 0x8c, 0xa0, 0xc2, 0x21, 0x1d, 0xe4, 0xc1, 0x0d, + 0xd8, 0x21, 0x1c, 0xdc, 0xe1, 0x1c, 0xea, 0x21, 0x1c, 0xce, 0xa1, 0x1c, + 0x7e, 0xc1, 0x1e, 0xca, 0x41, 0x1e, 0xe6, 0x21, 0x1d, 0xde, 0xc1, 0x1d, + 0xa6, 0x04, 0xc4, 0x88, 0x29, 0x1c, 0xd2, 0x41, 0x1e, 0xdc, 0x60, 0x1c, + 0xde, 0xa1, 0x1d, 0xe0, 0x21, 0x1d, 0xd8, 0xa1, 0x1c, 0x7e, 0xe1, 0x1d, + 0xe0, 0x81, 0x1e, 0xd2, 0xe1, 0x1d, 0xdc, 0x61, 0x1e, 0xa6, 0x10, 0x06, + 0xa2, 0x30, 0x23, 0x98, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x73, 0x90, + 0x87, 0x70, 0x38, 0x87, 0x76, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, 0x01, + 0x07, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, + 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, + 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, + 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, + 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, + 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, + 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, + 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, + 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, + 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, + 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, + 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, + 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, + 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, + 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, + 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, + 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, + 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, + 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, + 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, + 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, + 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, + 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, + 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, + 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, + 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, + 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, + 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, + 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, + 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x06, 0x20, 0xb1, 0x5d, 0xf9, 0xb3, 0xce, 0x82, + 0x0c, 0x7f, 0x11, 0x01, 0x06, 0x43, 0x34, 0x13, 0x00, 0x00, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x13, 0x04, 0x01, 0x05, + 0x25, 0x83, 0x80, 0x18, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x06, 0x20, 0x08, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x60, 0x0a, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, + 0x21, 0x0c, 0x00, 0x00, 0x95, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, + 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, + 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, + 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, + 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, + 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, + 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, + 0x89, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, 0x16, 0xa0, 0xda, 0x60, + 0x08, 0x05, 0xb0, 0x00, 0xd5, 0x06, 0x73, 0x19, 0xfe, 0xff, 0xff, 0xff, + 0x7f, 0x00, 0x18, 0x40, 0x02, 0x2a, 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, + 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8, 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, + 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, + 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, + 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, + 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, + 0x72, 0x48, 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, + 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, + 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, + 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, + 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, + 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, + 0x77, 0x78, 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, + 0x36, 0x80, 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, + 0x36, 0x28, 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, + 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, + 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, + 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, + 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, + 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, + 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, + 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, + 0x36, 0x50, 0x87, 0x7a, 0x68, 0x07, 0x78, 0x68, 0x03, 0x7a, 0x08, 0x07, + 0x71, 0x60, 0x87, 0x72, 0x98, 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, + 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xdc, 0x21, 0x1c, 0xdc, + 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, + 0x01, 0x1d, 0x00, 0x7a, 0x90, 0x87, 0x7a, 0x28, 0x07, 0x80, 0x70, 0x87, + 0x77, 0x68, 0x83, 0x79, 0x48, 0x87, 0x73, 0x70, 0x87, 0x72, 0x20, 0x87, + 0x36, 0xd0, 0x87, 0x72, 0x90, 0x87, 0x77, 0x98, 0x87, 0x36, 0x30, 0x07, + 0x78, 0x68, 0x83, 0x76, 0x08, 0x07, 0x7a, 0x40, 0x07, 0xc0, 0x1c, 0xc2, + 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x62, 0x1e, 0xe8, 0x21, 0x1c, 0xc6, + 0x61, 0x1d, 0xda, 0x00, 0x1e, 0xe4, 0xe1, 0x1d, 0xe8, 0xa1, 0x1c, 0xc6, + 0x81, 0x1e, 0xde, 0x41, 0x1e, 0xda, 0x40, 0x1c, 0xea, 0xc1, 0x1c, 0xcc, + 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xf4, 0xa1, 0x1c, 0x00, + 0x3c, 0x00, 0x08, 0x7a, 0x08, 0x07, 0x79, 0x38, 0x87, 0x72, 0xa0, 0x87, + 0x36, 0x30, 0x87, 0x72, 0x08, 0x07, 0x7a, 0xa8, 0x07, 0x79, 0x28, 0x87, + 0x79, 0x00, 0xda, 0xc0, 0x1c, 0xe0, 0x21, 0x0e, 0xec, 0x00, 0x20, 0xea, + 0xc1, 0x1d, 0xe6, 0x21, 0x1c, 0xcc, 0xa1, 0x1c, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x7a, 0x90, 0x87, + 0x7a, 0x28, 0x07, 0x80, 0xa8, 0x87, 0x79, 0x28, 0x87, 0x36, 0x98, 0x87, + 0x77, 0x30, 0x07, 0x7a, 0x68, 0x03, 0x73, 0x60, 0x87, 0x77, 0x08, 0x07, + 0x7a, 0x00, 0xcc, 0x21, 0x1c, 0xd8, 0x61, 0x1e, 0xca, 0x01, 0xd8, 0x40, + 0x10, 0x01, 0xb0, 0x6c, 0x20, 0x0a, 0x01, 0x58, 0x36, 0x20, 0xc6, 0xff, + 0xff, 0xff, 0xff, 0x0f, 0x00, 0x03, 0x48, 0x40, 0x05, 0x00, 0x00, 0x00, + 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x13, 0x86, 0x40, 0x18, + 0x26, 0x0c, 0x44, 0x61, 0x00, 0x00, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, + 0x1e, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, + 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, + 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x48, 0x33, 0x00, + 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, 0x08, 0x81, 0x70, 0x94, + 0x34, 0x45, 0x94, 0x30, 0xf9, 0xff, 0x44, 0x5c, 0x13, 0x15, 0x11, 0xbf, + 0x3d, 0xfc, 0xd3, 0x18, 0x01, 0x30, 0x88, 0x40, 0x04, 0x17, 0x49, 0x53, + 0x44, 0x09, 0x93, 0xff, 0x4b, 0x00, 0xf3, 0x2c, 0x44, 0xf4, 0x4f, 0x63, + 0x04, 0xc0, 0x20, 0x82, 0x21, 0x14, 0x23, 0x04, 0x31, 0xca, 0x21, 0x34, + 0x47, 0x10, 0xcc, 0x11, 0x80, 0xc1, 0x30, 0x82, 0xb0, 0x14, 0x24, 0x94, + 0x23, 0x14, 0x53, 0x80, 0xda, 0x40, 0xc0, 0x1c, 0x01, 0x28, 0x8c, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, + 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, + 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, + 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, + 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, + 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, + 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, + 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, + 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, + 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, + 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, + 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, + 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, + 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, + 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, + 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, + 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, + 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, + 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, + 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x43, 0x98, 0x04, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, + 0x21, 0x8c, 0x03, 0x04, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x16, + 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x5a, + 0x25, 0x30, 0x02, 0x50, 0x20, 0x05, 0x51, 0x04, 0x65, 0x50, 0x08, 0x04, + 0x47, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, + 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, + 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, + 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, + 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, + 0x65, 0x88, 0xf0, 0x00, 0x43, 0x8c, 0x45, 0x58, 0x8a, 0x65, 0x60, 0xd1, + 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x79, 0x86, 0x45, 0x58, 0x84, 0x65, + 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, + 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x78, 0x0a, 0x72, 0x61, 0x69, 0x72, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, + 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x84, 0xe7, 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, + 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, + 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x9e, 0x84, 0x61, 0x10, + 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, + 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, + 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x78, 0x16, + 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, + 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, + 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0x9e, 0x66, 0x19, + 0x1e, 0xe7, 0x79, 0x86, 0x08, 0x0f, 0x44, 0x26, 0x2c, 0x4d, 0xce, 0x05, + 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, 0x9c, + 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, 0x17, + 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, 0x34, + 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x44, 0xe0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, 0xdc, + 0x86, 0x40, 0xcb, 0xf0, 0x48, 0xcf, 0xf4, 0x50, 0x8f, 0xf3, 0x3c, 0x4f, + 0xf5, 0x58, 0x94, 0xc2, 0xd2, 0xe4, 0x5c, 0xcc, 0xe4, 0xc2, 0xce, 0xda, + 0xca, 0xdc, 0xe8, 0xbe, 0xd2, 0xdc, 0xe0, 0xea, 0xe8, 0x98, 0x9d, 0x95, + 0xb9, 0x95, 0xc9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0xc1, 0x32, 0x2c, 0xc2, 0x13, 0x06, 0x8f, 0x18, 0x2c, + 0xc4, 0x33, 0x06, 0x0b, 0xf1, 0x38, 0xcf, 0xf3, 0x54, 0x0f, 0x19, 0x70, + 0x09, 0x4b, 0x93, 0x73, 0xa1, 0x2b, 0xc3, 0xa3, 0xab, 0x93, 0x2b, 0xa3, + 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x46, 0x8c, + 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x4c, 0x86, 0x8c, 0xc7, 0x8c, 0xed, + 0x2d, 0x8c, 0x8e, 0x05, 0x64, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0xcc, 0x87, + 0x03, 0x5d, 0x19, 0xde, 0x10, 0x6a, 0x39, 0x1e, 0x33, 0x78, 0xc0, 0x60, + 0x19, 0x16, 0xe1, 0x39, 0x83, 0xc7, 0x79, 0xd0, 0xe0, 0xa9, 0x9e, 0x34, + 0xe0, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x26, + 0xc7, 0x63, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, 0x10, + 0x69, 0x41, 0x9e, 0x35, 0x78, 0xc0, 0x60, 0x19, 0x16, 0xe1, 0x71, 0x1e, + 0x36, 0x78, 0xaa, 0xa7, 0x0d, 0x86, 0x28, 0xcf, 0xf5, 0x74, 0x4f, 0x19, + 0x3c, 0x6a, 0xf0, 0xb8, 0xc1, 0x10, 0x23, 0x01, 0x9e, 0xe8, 0x79, 0x03, + 0x3e, 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74, 0x20, + 0x63, 0x68, 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, 0xe0, 0xd8, 0xca, 0x40, + 0x86, 0x56, 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, 0x86, 0x08, 0x8f, 0x1c, + 0x0c, 0x31, 0x9e, 0x38, 0x78, 0xe6, 0x00, 0x4a, 0x86, 0x18, 0x0f, 0x1d, + 0x3c, 0x74, 0x00, 0x25, 0x23, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, + 0x37, 0x48, 0x07, 0x72, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, 0x41, 0x30, + 0x62, 0x09, 0x87, 0x74, 0x90, 0x07, 0x37, 0xb0, 0x87, 0x72, 0x90, 0x87, + 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x81, 0x30, 0x82, 0x0a, 0x87, + 0x74, 0x90, 0x07, 0x37, 0x60, 0x87, 0x70, 0x70, 0x87, 0x73, 0xa8, 0x87, + 0x70, 0x38, 0x87, 0x72, 0xf8, 0x05, 0x7b, 0x28, 0x07, 0x79, 0x98, 0x87, + 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x10, 0x23, 0xa6, 0x70, 0x48, 0x07, + 0x79, 0x70, 0x83, 0x71, 0x78, 0x87, 0x76, 0x80, 0x87, 0x74, 0x60, 0x87, + 0x72, 0xf8, 0x85, 0x77, 0x80, 0x07, 0x7a, 0x48, 0x87, 0x77, 0x70, 0x87, + 0x79, 0x98, 0x42, 0x18, 0x88, 0xc2, 0x8c, 0x60, 0xc2, 0x21, 0x1d, 0xe4, + 0xc1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xe1, 0x1c, 0xda, 0xa1, 0x1c, 0xdc, + 0x81, 0x1e, 0xa6, 0x04, 0x70, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, + 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, + 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, + 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, + 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, + 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, + 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, + 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, + 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, + 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, + 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, + 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, + 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, + 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, + 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, + 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, + 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, + 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, + 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, + 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, + 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, + 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, + 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, + 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, + 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, + 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, + 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, + 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, + 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, + 0x71, 0x20, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x06, 0x10, 0xb1, 0x5d, + 0xf9, 0x73, 0xce, 0x83, 0xfd, 0x45, 0x04, 0x18, 0x0c, 0xd1, 0x4c, 0x16, + 0xb0, 0x01, 0x48, 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, 0xd7, + 0x44, 0x45, 0xc4, 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x0d, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, + 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xc4, 0x46, 0x00, 0x48, + 0xd5, 0xc0, 0x08, 0x00, 0x81, 0x11, 0x00, 0x00, 0x23, 0x06, 0x8a, 0x10, + 0x48, 0x46, 0x81, 0x0c, 0x84, 0x10, 0x10, 0x52, 0x2c, 0x10, 0xe4, 0x93, + 0x41, 0x40, 0x0c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x20, 0xa8, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x6c, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, + 0x21, 0x0c, 0x00, 0x00, 0x98, 0x03, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, + 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, + 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, + 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, + 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, + 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, + 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, + 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, 0x16, 0xa0, 0xda, 0x60, + 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, 0x80, 0x05, 0xa8, 0x36, + 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0x00, 0x12, 0x31, + 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xec, 0x90, + 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, 0x40, 0x0e, 0xe5, 0x40, + 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, 0x40, 0x0e, 0xe5, 0xd0, + 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, + 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, 0x39, 0x84, 0x03, 0x3b, + 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, 0x3c, 0x84, 0x83, 0x38, + 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, 0x3a, 0xb0, 0x43, 0x1b, + 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, 0x60, 0x0e, 0xe1, 0xc0, + 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5, 0x30, 0x0f, 0xf3, 0xd0, + 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9, 0x30, 0x0f, 0xe5, 0xd0, + 0x06, 0xe6, 0x00, 0x0f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 0x3d, 0x00, 0xe6, 0x10, 0x0e, 0xec, 0x30, + 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff, 0xff, 0xff, 0xff, 0x07, + 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8, + 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca, + 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca, + 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, 0x87, 0x79, 0x08, 0x07, + 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87, + 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2, + 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6, + 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca, + 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07, + 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x30, 0x07, + 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, 0x87, 0x77, 0x48, 0x07, + 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, 0x07, 0x76, 0x48, 0x87, + 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde, + 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0, + 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca, + 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda, + 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, + 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, + 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, + 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87, + 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, + 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, + 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda, + 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87, + 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07, + 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87, + 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0, + 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda, + 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6, + 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07, + 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87, + 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, + 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde, + 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8, + 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, 0x07, 0x60, 0x03, 0x61, + 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, 0x80, 0x20, 0xff, 0xff, + 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, 0x06, 0x22, 0xf9, 0xff, + 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x88, 0x09, 0x41, 0x31, + 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, + 0x31, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, + 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, + 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x78, 0x33, 0x00, + 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, 0x08, 0x81, 0x30, 0x8c, + 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, 0x2f, 0xbb, 0x6f, 0x47, + 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, 0x11, 0x0a, 0xe1, 0x28, + 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, 0x26, 0x2a, 0x22, 0x7e, + 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, 0x08, 0x4e, 0x93, 0xa6, + 0x88, 0x12, 0x26, 0xff, 0x9f, 0x88, 0x6b, 0xa2, 0x22, 0xe2, 0xb7, 0x87, + 0x1f, 0x88, 0x22, 0x00, 0xfb, 0xa7, 0x31, 0x02, 0x60, 0x10, 0x21, 0x09, + 0x2e, 0x92, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59, 0x88, + 0xe8, 0x9f, 0xc6, 0x08, 0x80, 0x41, 0x84, 0x45, 0x28, 0x48, 0x08, 0x62, + 0x18, 0xa4, 0x18, 0xb5, 0x32, 0x00, 0x42, 0xe8, 0xcd, 0x11, 0x80, 0xc1, + 0x1c, 0x41, 0x30, 0x8c, 0x20, 0x44, 0x25, 0x09, 0x8a, 0x89, 0x28, 0xa7, + 0x04, 0x44, 0x0b, 0x12, 0x10, 0x13, 0x72, 0x4a, 0x40, 0x76, 0x20, 0x60, + 0x18, 0x61, 0x88, 0x86, 0x11, 0x88, 0x68, 0x8e, 0x00, 0x14, 0x06, 0x11, + 0x08, 0x61, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xa8, 0x70, 0x48, + 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, + 0x87, 0x72, 0x68, 0x83, 0x74, 0x78, 0x87, 0x79, 0xc8, 0x03, 0x37, 0x80, + 0x03, 0x37, 0x80, 0x83, 0x0d, 0xef, 0x51, 0x0e, 0x6d, 0x00, 0x0f, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, + 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe6, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, + 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xf6, + 0x20, 0x07, 0x74, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xd0, 0x06, 0xf6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x40, 0x07, 0x78, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xf6, + 0x90, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, + 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0x60, 0x0f, 0x71, 0x90, 0x07, 0x72, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, + 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, + 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xd0, 0x06, 0xf6, + 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, + 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xd0, 0x06, 0xe6, + 0x80, 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, + 0x20, 0x07, 0x78, 0xd0, 0x06, 0xee, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x43, 0x18, 0x07, 0x00, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x80, 0x21, 0x0c, 0x04, 0x04, 0x80, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xc0, 0x10, 0xa6, 0x02, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x60, 0x08, 0x73, 0x01, 0x01, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x90, 0x05, 0x02, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x8a, + 0x23, 0x00, 0x25, 0x50, 0x20, 0x05, 0x18, 0x50, 0x10, 0x45, 0x50, 0x06, + 0x05, 0x54, 0x60, 0x85, 0x50, 0x0a, 0xc5, 0x40, 0x7b, 0x04, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, + 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, + 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, + 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, + 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x80, 0x01, + 0x43, 0x8c, 0xa8, 0x88, 0x90, 0x88, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, + 0x36, 0x04, 0xc1, 0x86, 0xa8, 0x88, 0x8a, 0x88, 0xe0, 0x16, 0x96, 0x26, + 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, + 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, + 0x36, 0x44, 0xc0, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, + 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x04, 0xec, + 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, + 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, + 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x95, 0xb9, 0x85, 0x89, + 0xb1, 0x95, 0x0d, 0x11, 0xb0, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32, + 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66, + 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xc0, 0x16, 0x46, 0x61, 0x69, 0x72, + 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, 0x67, + 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, + 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, + 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0xb0, 0x26, 0x22, 0x30, 0x07, 0x7b, 0x86, + 0x08, 0x18, 0x44, 0x26, 0x2c, 0x4d, 0xce, 0x05, 0xee, 0x6d, 0x2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 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5, 0xe9, 0x95, 0x51, 0x0a, + 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, 0xa3, 0x4b, 0x7b, 0x73, 0xfb, + 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, 0x96, 0x26, 0xe7, 0x22, 0x57, + 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, 0x25, 0x4c, 0xee, 0xec, 0x8b, + 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf, 0x8c, 0x57, 0x58, 0x9a, + 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e, 0x5c, 0xd9, 0x57, 0x18, + 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0x87, 0xb1, 0x37, + 0xb6, 0x21, 0x60, 0x10, 0x25, 0x98, 0x87, 0x7d, 0x91, 0x81, 0x81, 0x41, + 0x44, 0x44, 0x05, 0x16, 0x06, 0x98, 0x18, 0x44, 0x06, 0x36, 0x06, 0x91, + 0x81, 0x39, 0xd8, 0x83, 0x55, 0x18, 0x19, 0x90, 0x0a, 0x4b, 0x93, 0x73, + 0x99, 0xa3, 0x93, 0xab, 0x1b, 0xa3, 0xfb, 0xa2, 0xcb, 0x83, 0x2b, 0xfb, + 0x4a, 0x73, 0x33, 0x7b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x37, 0x43, + 0xe3, 0xcd, 0xcc, 0x6c, 0xae, 0x8c, 0x8e, 0x86, 0xd4, 0xd8, 0x5b, 0x99, + 0x99, 0x19, 0x8d, 0xa3, 0xb1, 0xb7, 0x32, 0x33, 0x33, 0x1a, 0x42, 0x63, + 0x6f, 0x65, 0x66, 0x66, 0x43, 0xd0, 0x20, 0x22, 0x22, 0x23, 0x22, 0xb0, + 0x33, 0xc0, 0xd0, 0x20, 0x32, 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd2, + 0x20, 0x5a, 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd4, 0x20, 0x62, 0x22, + 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd6, 0x80, 0x49, 0x56, 0x95, 0x15, 0x51, + 0xd9, 0xd8, 0x1b, 0x59, 0x19, 0x0d, 0xb2, 0xb2, 0xb1, 0x37, 0xb2, 0xb2, + 0x21, 0x64, 0x10, 0x29, 0x98, 0x87, 0x7d, 0xd1, 0x81, 0x81, 0x41, 0x54, + 0x44, 0x05, 0x16, 0x06, 0x98, 0x19, 0x60, 0x6c, 0x80, 0x89, 0x41, 0x74, + 0x60, 0x63, 0x10, 0x19, 0x98, 0x83, 0xb5, 0x01, 0x56, 0x61, 0x6e, 0xc0, + 0x25, 0x2c, 0x4d, 0xce, 0x85, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x8c, + 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x19, 0x31, + 0xba, 0x32, 0x3c, 0xba, 0x3a, 0xb9, 0x32, 0x19, 0x32, 0x1e, 0x33, 0xb6, + 0xb7, 0x30, 0x3a, 0x16, 0x90, 0xb9, 0xb0, 0x36, 0x38, 0xb6, 0x32, 0x1f, + 0x12, 0x74, 0x65, 0x78, 0x59, 0x43, 0xa8, 0xa8, 0xc1, 0xe0, 0x00, 0x03, + 0x83, 0x88, 0x88, 0x0a, 0x2c, 0x0e, 0x30, 0x07, 0x93, 0x03, 0xac, 0xc2, + 0xe6, 0x80, 0x1e, 0x5d, 0x19, 0x1e, 0x5d, 0x9d, 0x5c, 0x99, 0x0c, 0xd9, + 0x57, 0x98, 0x9c, 0x5c, 0x58, 0x1e, 0x8f, 0x19, 0xdb, 0x5b, 0x18, 0x1d, + 0x0b, 0xc8, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x99, 0x0f, 0x0b, 0xba, 0x32, + 0xbc, 0x2a, 0xab, 0x21, 0x54, 0xe4, 0x60, 0x70, 0x80, 0x81, 0x41, 0x54, + 0x44, 0x05, 0x16, 0x07, 0x98, 0x83, 0xd5, 0x01, 0x56, 0x61, 0x76, 0xc0, + 0x25, 0x2c, 0x4d, 0xce, 0x65, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, + 0xc7, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x99, 0x1c, 0x83, 0xb9, 0x21, 0x52, + 0xf4, 0x60, 0x78, 0x80, 0x81, 0x41, 0x44, 0x44, 0x05, 0xe6, 0x60, 0x79, + 0x80, 0x55, 0x98, 0x1e, 0x0c, 0x71, 0xb0, 0x0b, 0xeb, 0xb0, 0x32, 0xc0, + 0xde, 0x00, 0xa3, 0x03, 0xec, 0x0e, 0xb0, 0x3d, 0x18, 0x62, 0x38, 0x00, + 0x16, 0x61, 0x7c, 0xc0, 0xe7, 0xad, 0xcd, 0x2d, 0x0d, 0xee, 0x8d, 0xae, + 0xcc, 0x8d, 0x0e, 0x64, 0x0c, 0x2d, 0x4c, 0x8e, 0xcf, 0x54, 0x5a, 0x1b, + 0x1c, 0x5b, 0x19, 0xc8, 0xd0, 0xca, 0x0a, 0x08, 0x95, 0x50, 0x50, 0xd0, + 0x10, 0x01, 0xfb, 0x83, 0x21, 0x06, 0xe6, 0x07, 0x18, 0x28, 0x6c, 0xd0, + 0x10, 0x03, 0x0b, 0x05, 0x2c, 0x14, 0x36, 0x68, 0x84, 0xc2, 0x0e, 0xec, + 0x60, 0x0f, 0xed, 0xe0, 0x06, 0xe9, 0x40, 0x0e, 0xe5, 0xe0, 0x0e, 0xf4, + 0x30, 0x25, 0x08, 0x46, 0x2c, 0xe1, 0x90, 0x0e, 0xf2, 0xe0, 0x06, 0xf6, + 0x50, 0x0e, 0xf2, 0x30, 0x0f, 0xe9, 0xf0, 0x0e, 0xee, 0x30, 0x25, 0x10, + 0x46, 0x50, 0xe1, 0x90, 0x0e, 0xf2, 0xe0, 0x06, 0xec, 0x10, 0x0e, 0xee, + 0x70, 0x0e, 0xf5, 0x10, 0x0e, 0xe7, 0x50, 0x0e, 0xbf, 0x60, 0x0f, 0xe5, + 0x20, 0x0f, 0xf3, 0x90, 0x0e, 0xef, 0xe0, 0x0e, 0x53, 0x02, 0x62, 0xc4, + 0x14, 0x0e, 0xe9, 0x20, 0x0f, 0x6e, 0x30, 0x0e, 0xef, 0xd0, 0x0e, 0xf0, + 0x90, 0x0e, 0xec, 0x50, 0x0e, 0xbf, 0xf0, 0x0e, 0xf0, 0x40, 0x0f, 0xe9, + 0xf0, 0x0e, 0xee, 0x30, 0x0f, 0x53, 0x08, 0x03, 0x51, 0x98, 0x11, 0x4c, + 0x38, 0xa4, 0x83, 0x3c, 0xb8, 0x81, 0x39, 0xc8, 0x43, 0x38, 0x9c, 0x43, + 0x3b, 0x94, 0x83, 0x3b, 0xd0, 0xc3, 0x94, 0xa0, 0x0f, 0x00, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, + 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, + 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, + 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, + 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, + 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, + 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, + 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, + 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, + 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, + 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, + 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, + 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, + 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, + 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, + 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, + 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, + 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, + 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, + 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, + 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, + 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, + 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, + 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, + 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, + 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, + 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, + 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, + 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, + 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x26, 0x10, 0x06, 0x00, 0x12, 0xf9, 0x12, 0xc0, 0x3c, 0x0b, 0xf1, 0x4f, + 0xc4, 0x35, 0x51, 0x11, 0xf1, 0xdb, 0xc3, 0x0f, 0x44, 0x11, 0x80, 0xf9, + 0x15, 0x5e, 0xdc, 0xb6, 0x05, 0x34, 0x00, 0x12, 0xf9, 0x83, 0x33, 0xf9, + 0xd5, 0x5d, 0xdc, 0xb6, 0x0d, 0x6c, 0x00, 0x12, 0xf9, 0x12, 0xc0, 0x3c, + 0x0b, 0xf1, 0x4f, 0xc4, 0x35, 0x51, 0x11, 0xf1, 0xdb, 0x83, 0x5f, 0xe1, + 0xc5, 0x6d, 0x1b, 0x00, 0xc4, 0x76, 0xe5, 0x2f, 0xbb, 0xef, 0x5f, 0x44, + 0x80, 0xc1, 0x10, 0xcd, 0x04, 0x00, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, + 0x3e, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0xa4, 0xe7, 0x20, 0x88, 0x22, 0xe1, 0x28, 0xcf, + 0x31, 0x10, 0x1c, 0x37, 0xd6, 0x00, 0x04, 0x02, 0xcd, 0x11, 0x00, 0x8a, + 0x33, 0x00, 0x24, 0x6b, 0x60, 0x04, 0x80, 0xc8, 0x0c, 0x00, 0x85, 0x19, + 0x00, 0x02, 0x63, 0x04, 0x20, 0x08, 0x82, 0xf8, 0x37, 0x02, 0x00, 0x00, + 0x23, 0x06, 0xca, 0x10, 0x80, 0x81, 0xc3, 0x44, 0x06, 0x52, 0x04, 0x23, + 0x06, 0xcb, 0x10, 0x88, 0x81, 0xd3, 0x48, 0x60, 0x70, 0x24, 0x86, 0x30, + 0x86, 0x10, 0x84, 0xc1, 0x20, 0xc3, 0x60, 0x34, 0x73, 0x0c, 0x81, 0x20, + 0x06, 0x23, 0x06, 0xcb, 0x10, 0x98, 0x81, 0x14, 0x59, 0x63, 0xb0, 0x34, + 0x8a, 0x31, 0x86, 0x10, 0x94, 0xc1, 0x1c, 0xc3, 0x10, 0x84, 0xc1, 0x20, + 0x43, 0xc0, 0x4c, 0x87, 0x8d, 0xa5, 0xa0, 0xd8, 0x10, 0xc0, 0x87, 0xb8, + 0x32, 0xc8, 0x20, 0x40, 0xd6, 0x78, 0x43, 0x17, 0x06, 0x6c, 0x70, 0xc1, + 0x58, 0x0a, 0xca, 0x20, 0x43, 0x40, 0x69, 0x23, 0x06, 0x05, 0x11, 0xd0, + 0x41, 0x11, 0xcc, 0x31, 0x58, 0x81, 0x1c, 0x8c, 0x37, 0x8c, 0xc1, 0x19, + 0xb8, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, 0x81, 0x06, 0x06, 0x23, + 0x06, 0x05, 0x11, 0xe8, 0xc1, 0x12, 0xcc, 0x31, 0x18, 0xc1, 0x1d, 0x8c, + 0x37, 0xa4, 0x41, 0x1b, 0xcc, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, + 0x01, 0x18, 0x98, 0xc1, 0x88, 0x41, 0x41, 0x04, 0xa0, 0x10, 0x05, 0x73, + 0x0c, 0x46, 0x90, 0x07, 0x73, 0x0c, 0x81, 0x18, 0xe4, 0x81, 0x05, 0x95, + 0x7c, 0x32, 0x08, 0x88, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x5b, 0x06, 0x26, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf0, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x79, 0x03, 0x00, 0x00, + 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, + 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, + 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, + 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, + 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, + 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, + 0x51, 0x18, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, + 0x16, 0xa0, 0xda, 0x60, 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, + 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, + 0xc0, 0x00, 0x12, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, + 0x40, 0x0f, 0xec, 0x90, 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, + 0x40, 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, + 0x40, 0x0e, 0xe5, 0xd0, 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, + 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, + 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, + 0x3c, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, + 0x3a, 0xb0, 0x43, 0x1b, 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, + 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5, + 0x30, 0x0f, 0xf3, 0xd0, 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9, + 0x30, 0x0f, 0xe5, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4, + 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, + 0x1b, 0x98, 0x83, 0x3c, 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, + 0x3b, 0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e, 0xd8, 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, + 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, + 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, + 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, + 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, + 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, + 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, + 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, + 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, + 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, + 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, + 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, + 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, + 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, + 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, + 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, + 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, + 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, + 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, + 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, + 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, + 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, + 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, + 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, + 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, + 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, + 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, + 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, + 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, + 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, + 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, + 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, + 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, + 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, + 0x07, 0x60, 0x03, 0x61, 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, + 0x80, 0x20, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, + 0x06, 0x22, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, + 0x49, 0x18, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, + 0x88, 0x09, 0x41, 0x31, 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x68, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, + 0x08, 0x81, 0x30, 0x8c, 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, + 0x2f, 0xbb, 0x6f, 0x47, 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, + 0x11, 0x0a, 0xe1, 0x28, 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, + 0x26, 0x2a, 0x22, 0x7e, 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, + 0x08, 0x2e, 0x92, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59, + 0x88, 0xe8, 0x9f, 0xc6, 0x08, 0x80, 0x41, 0x84, 0x44, 0x28, 0x48, 0x08, + 0x62, 0x18, 0x84, 0x14, 0xad, 0x32, 0x00, 0x42, 0xa8, 0xcd, 0x11, 0x04, + 0x73, 0x04, 0x60, 0x30, 0x8c, 0x20, 0x40, 0x05, 0x09, 0x48, 0x89, 0x17, + 0x1f, 0x20, 0x39, 0x10, 0x30, 0x8c, 0x30, 0x40, 0xc3, 0x08, 0x04, 0x34, + 0x47, 0x00, 0x0a, 0x83, 0x08, 0x84, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, + 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, 0x74, 0x78, 0x87, 0x79, + 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, 0x0d, 0xef, 0x51, 0x0e, + 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x7a, 0x80, 0x07, + 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x78, 0xa0, 0x07, + 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, + 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x60, 0x07, + 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, + 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, + 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07, + 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, + 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, + 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x40, 0x07, + 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, + 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x20, 0x07, + 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, 0x07, 0x72, 0xa0, 0x07, + 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, + 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, + 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x75, 0x10, 0x07, + 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, + 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, + 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, + 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, + 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xee, 0x80, 0x07, + 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x43, 0x18, 0x06, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x8c, 0x03, 0x04, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x10, 0x66, 0x02, 0x02, 0x60, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0b, 0x04, 0x0a, 0x00, 0x00, 0x00, + 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, + 0xc6, 0x04, 0x43, 0x82, 0x23, 0x00, 0x25, 0x50, 0x20, 0x05, 0x18, 0x50, + 0x10, 0x45, 0x50, 0x06, 0x05, 0x54, 0x60, 0x85, 0x50, 0x0a, 0xc5, 0x40, + 0x77, 0x04, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x0d, 0x01, 0x00, 0x00, + 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, + 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, + 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, + 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, + 0x65, 0x88, 0x40, 0x01, 0x43, 0x0c, 0x88, 0x80, 0x0e, 0x68, 0x60, 0xd1, + 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0xa1, 0x06, 0x88, 0x80, 0x08, 0x68, + 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, + 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x0a, 0x72, 0x61, 0x69, 0x72, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, + 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x04, 0xea, 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, + 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, + 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0xa8, 0x84, 0x61, 0x10, + 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, + 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, + 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x16, + 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, + 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, + 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0xa8, 0x06, 0x1a, + 0x28, 0x87, 0x7a, 0x86, 0x08, 0x14, 0x44, 0x26, 0x2c, 0x4d, 0xce, 0x05, + 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, 0x9c, + 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, 0x17, + 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, 0x34, + 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x44, 0xe0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, 0xdc, + 0x86, 0x40, 0xd0, 0x40, 0x49, 0xd4, 0x44, 0x51, 0x94, 0x43, 0x3d, 0x54, + 0x45, 0x59, 0x94, 0xc2, 0xd2, 0xe4, 0x5c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d7, 0x5c, 0x9a, 0x5e, + 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, 0x00, 0x21, 0x94, 0x47, 0x7d, + 0x50, 0x41, 0x81, 0x01, 0x34, 0x40, 0x04, 0x15, 0x06, 0x94, 0x18, 0x40, + 0x05, 0x35, 0x06, 0x50, 0x41, 0x39, 0xd4, 0x43, 0x55, 0x14, 0x19, 0x90, + 0x0a, 0x4b, 0x93, 0x73, 0x99, 0xa3, 0x93, 0xab, 0x1b, 0xa3, 0xfb, 0xa2, + 0xcb, 0x83, 0x2b, 0xfb, 0x4a, 0x73, 0x33, 0x7b, 0xa3, 0x61, 0xc6, 0xf6, + 0x16, 0x46, 0x37, 0x43, 0xe3, 0xcd, 0xcc, 0x6c, 0xae, 0x8c, 0x8e, 0x86, + 0xd4, 0xd8, 0x5b, 0x99, 0x99, 0x19, 0x8d, 0xa3, 0xb1, 0xb7, 0x32, 0x33, + 0x33, 0x1a, 0x42, 0x63, 0x6f, 0x65, 0x66, 0x66, 0x43, 0xd0, 0x00, 0x1a, + 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd0, 0x00, 0x2a, 0xa0, 0x02, 0x1a, + 0xa8, 0x33, 0xa0, 0xd2, 0x00, 0x52, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, + 0xd4, 0x00, 0x5a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd6, 0x80, 0x49, + 0x56, 0x95, 0x15, 0x51, 0xd9, 0xd8, 0x1b, 0x59, 0x19, 0x0d, 0xb2, 0xb2, + 0xb1, 0x37, 0xb2, 0xb2, 0x21, 0x64, 0x00, 0x25, 0x94, 0x47, 0x7d, 0x90, + 0x41, 0x81, 0x01, 0x44, 0x40, 0x04, 0x15, 0x06, 0x94, 0x19, 0x50, 0x6c, + 0x40, 0x89, 0x01, 0x64, 0x50, 0x63, 0x00, 0x15, 0x94, 0x43, 0xb5, 0x01, + 0x55, 0x51, 0x6e, 0xc0, 0x25, 0x2c, 0x4d, 0xce, 0x85, 0xae, 0x0c, 0x8f, + 0xae, 0x4e, 0xae, 0x8c, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x5c, 0x58, 0x1b, + 0x1c, 0x5b, 0x19, 0x31, 0xba, 0x32, 0x3c, 0xba, 0x3a, 0xb9, 0x32, 0x19, + 0x32, 0x1e, 0x33, 0xb6, 0xb7, 0x30, 0x3a, 0x16, 0x90, 0xb9, 0xb0, 0x36, + 0x38, 0xb6, 0x32, 0x1f, 0x12, 0x74, 0x65, 0x78, 0x59, 0x43, 0x28, 0x88, + 0xa1, 0xe0, 0x80, 0x02, 0x03, 0x68, 0x80, 0x08, 0x2a, 0x0e, 0x28, 0x87, + 0x92, 0x03, 0xaa, 0xa2, 0xe6, 0x80, 0x05, 0x5d, 0x19, 0x5e, 0x95, 0xd5, + 0x10, 0x0a, 0x6a, 0x28, 0x38, 0xa0, 0xc0, 0x00, 0x22, 0x20, 0x82, 0x8a, + 0x03, 0xca, 0xa1, 0xe4, 0x80, 0xaa, 0xa8, 0x3a, 0xe0, 0x12, 0x96, 0x26, + 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x26, 0xc7, 0x63, 0x2e, 0xac, + 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, 0x10, 0x09, 0x72, 0xa8, 0x3b, + 0xa0, 0xc0, 0x00, 0x1a, 0x20, 0x82, 0x72, 0x28, 0x3c, 0xa0, 0x2a, 0x2a, + 0x0f, 0x86, 0x38, 0xd4, 0x45, 0x75, 0x54, 0x19, 0x50, 0x6f, 0x40, 0xd1, + 0x01, 0x65, 0x07, 0x94, 0x1e, 0x0c, 0x31, 0x18, 0x80, 0x8a, 0xa8, 0x3d, + 0xe0, 0xf3, 0xd6, 0xe6, 0x96, 0x06, 0xf7, 0x46, 0x57, 0xe6, 0x46, 0x07, + 0x32, 0x86, 0x16, 0x26, 0xc7, 0x67, 0x2a, 0xad, 0x0d, 0x8e, 0xad, 0x0c, + 0x64, 0x68, 0x65, 0x05, 0x84, 0x4a, 0x28, 0x28, 0x68, 0x88, 0x40, 0xf9, + 0xc1, 0x10, 0x83, 0xea, 0x03, 0xea, 0x0f, 0xae, 0x67, 0x88, 0x41, 0x81, + 0x02, 0x05, 0x0a, 0xd7, 0x33, 0x42, 0x61, 0x07, 0x76, 0xb0, 0x87, 0x76, + 0x70, 0x83, 0x74, 0x20, 0x87, 0x72, 0x70, 0x07, 0x7a, 0x98, 0x12, 0x04, + 0x23, 0x96, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x7b, 0x28, 0x07, 0x79, + 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x08, 0x23, 0xa8, 0x70, + 0x48, 0x07, 0x79, 0x70, 0x03, 0x76, 0x08, 0x07, 0x77, 0x38, 0x87, 0x7a, + 0x08, 0x87, 0x73, 0x28, 0x87, 0x5f, 0xb0, 0x87, 0x72, 0x90, 0x87, 0x79, + 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x01, 0x31, 0x62, 0x0a, 0x87, 0x74, + 0x90, 0x07, 0x37, 0x18, 0x87, 0x77, 0x68, 0x07, 0x78, 0x48, 0x07, 0x76, + 0x28, 0x87, 0x5f, 0x78, 0x07, 0x78, 0xa0, 0x87, 0x74, 0x78, 0x07, 0x77, + 0x98, 0x87, 0x29, 0x84, 0x81, 0x28, 0xcc, 0x08, 0x26, 0x1c, 0xd2, 0x41, + 0x1e, 0xdc, 0xc0, 0x1c, 0xe4, 0x21, 0x1c, 0xce, 0xa1, 0x1d, 0xca, 0xc1, + 0x1d, 0xe8, 0x61, 0x4a, 0xc0, 0x07, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, + 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, + 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, + 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, + 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, + 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, + 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, + 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, + 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, + 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, + 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, + 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, + 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, + 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, + 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, + 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, + 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, + 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, + 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, + 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, + 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, + 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, + 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, + 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, + 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, + 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, + 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, + 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, + 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, + 0x71, 0x20, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x16, 0xd0, 0x00, 0x48, + 0xe4, 0x0f, 0xce, 0xe4, 0x57, 0x77, 0x71, 0xdb, 0x26, 0xb0, 0x01, 0x48, + 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, 0xd7, 0x44, 0x45, 0xc4, + 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x6d, 0x00, 0x11, 0xdb, 0x95, 0xff, + 0xf9, 0xd6, 0xf6, 0x5f, 0x44, 0x80, 0xc1, 0x10, 0xcd, 0x04, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, + 0x10, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x64, 0xe7, 0x20, 0x06, + 0x02, 0xe9, 0xa8, 0x8e, 0x35, 0x00, 0x03, 0x31, 0xc7, 0x30, 0x10, 0xdd, + 0x1c, 0xc3, 0xd0, 0x75, 0xf4, 0x6a, 0x60, 0x04, 0x80, 0xe0, 0x0c, 0x00, + 0xc5, 0x11, 0x00, 0xaa, 0x63, 0x0d, 0x40, 0x20, 0x10, 0x99, 0x01, 0xa0, + 0x30, 0x03, 0x40, 0x60, 0x8c, 0x00, 0x04, 0x41, 0x10, 0xff, 0x46, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x23, 0x06, 0xca, 0x10, 0x88, 0x01, 0xe4, 0x4c, + 0x89, 0x81, 0x04, 0x23, 0x06, 0xca, 0x10, 0x8c, 0x01, 0xf4, 0x50, 0xca, + 0x91, 0x08, 0x83, 0x0c, 0x42, 0xc1, 0x0c, 0x32, 0x08, 0x86, 0x33, 0xc8, + 0x20, 0x04, 0xd0, 0x20, 0x43, 0x90, 0x48, 0x77, 0x8d, 0xa5, 0xa0, 0xd8, + 0x10, 0xc0, 0x87, 0xb6, 0x32, 0xc8, 0x20, 0x34, 0xcf, 0x78, 0x03, 0x07, + 0x06, 0x6b, 0x70, 0xc1, 0x58, 0x0a, 0xca, 0x20, 0x43, 0x10, 0x4d, 0x23, + 0x06, 0x05, 0x11, 0xc8, 0x41, 0x11, 0xcc, 0x31, 0x4c, 0x41, 0x1c, 0x8c, + 0x37, 0x88, 0x81, 0x19, 0xb4, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, + 0xc1, 0x95, 0x8d, 0x18, 0x14, 0x44, 0x80, 0x07, 0x4b, 0x30, 0xc7, 0x60, + 0x04, 0x76, 0x30, 0xde, 0x80, 0x06, 0x6c, 0x20, 0x07, 0x17, 0x8c, 0xa5, + 0xa0, 0x0c, 0x32, 0x04, 0xdd, 0x37, 0x62, 0x50, 0x10, 0x81, 0x1f, 0x44, + 0xc1, 0x1c, 0x83, 0x11, 0xe0, 0xc1, 0x1c, 0x43, 0xf0, 0xe1, 0x81, 0x05, + 0x95, 0x7c, 0x32, 0x08, 0x88, 0x01, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x5b, 0x86, 0x24, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0xf8, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x7b, 0x03, 0x00, 0x00, + 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, + 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, + 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, + 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, + 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, + 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, + 0x51, 0x18, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, + 0x16, 0xa0, 0xda, 0x60, 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, + 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, + 0xc0, 0x00, 0x12, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, + 0x40, 0x0f, 0xec, 0x90, 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, + 0x40, 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, + 0x40, 0x0e, 0xe5, 0xd0, 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, + 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, + 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, + 0x3c, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, + 0x3a, 0xb0, 0x43, 0x1b, 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, + 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5, + 0x30, 0x0f, 0xf3, 0xd0, 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9, + 0x30, 0x0f, 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0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, + 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff, + 0xff, 0xff, 0xff, 0x07, 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, + 0xc6, 0x81, 0x1e, 0xd8, 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, + 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, + 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, + 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, + 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, + 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, + 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, + 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, + 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, + 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, + 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, + 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, + 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, + 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, + 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, + 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, + 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, + 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, + 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, + 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, + 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, + 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, + 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, + 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, + 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, + 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, + 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, + 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, + 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, + 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, + 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, + 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, + 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, + 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, + 0x07, 0x60, 0x03, 0x61, 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, + 0x80, 0x20, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, + 0x06, 0x22, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, + 0x49, 0x18, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, + 0x88, 0x09, 0x41, 0x31, 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x68, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, + 0x08, 0x81, 0x30, 0x8c, 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, + 0x2f, 0xbb, 0x6f, 0x47, 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, + 0x11, 0x0a, 0xe1, 0x28, 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, + 0x26, 0x2a, 0x22, 0x7e, 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, + 0x08, 0x2e, 0x92, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59, + 0x88, 0xe8, 0x9f, 0xc6, 0x08, 0x80, 0x41, 0x84, 0x44, 0x28, 0x48, 0x08, + 0x62, 0x18, 0x84, 0x14, 0xad, 0x32, 0x00, 0x42, 0xa8, 0xcd, 0x11, 0x04, + 0x73, 0x04, 0x60, 0x30, 0x8c, 0x20, 0x40, 0x05, 0x09, 0x48, 0x89, 0x17, + 0x1f, 0x20, 0x39, 0x10, 0x30, 0x8c, 0x30, 0x40, 0xc3, 0x08, 0x04, 0x34, + 0x47, 0x00, 0x0a, 0x83, 0x08, 0x84, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x13, 0xa8, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, + 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, 0x74, 0x78, 0x87, 0x79, + 0xc8, 0x03, 0x37, 0x80, 0x03, 0x37, 0x80, 0x83, 0x0d, 0xef, 0x51, 0x0e, + 0x6d, 0x00, 0x0f, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x7a, 0x80, 0x07, + 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x78, 0xa0, 0x07, 0x78, 0xa0, 0x07, + 0x78, 0xd0, 0x06, 0xe9, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, + 0x7a, 0x10, 0x07, 0x76, 0xd0, 0x06, 0xe9, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xe9, 0x60, 0x07, + 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, + 0xe6, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, + 0x72, 0xd0, 0x06, 0xe6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07, + 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, + 0xf6, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, + 0x76, 0xd0, 0x06, 0xf6, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xd0, 0x06, 0xf6, 0x40, 0x07, + 0x78, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xd0, 0x06, + 0xf6, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xd0, 0x06, 0xf6, 0x90, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x20, 0x07, + 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x90, 0x07, 0x72, 0xa0, 0x07, + 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, + 0xf6, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, + 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x75, 0x10, 0x07, + 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, 0x72, 0xa0, 0x07, 0x75, 0x10, 0x07, + 0x72, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, + 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, + 0x74, 0xd0, 0x06, 0xe6, 0x80, 0x07, 0x70, 0xa0, 0x07, 0x71, 0x20, 0x07, + 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xee, 0x80, 0x07, + 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x43, 0x18, 0x06, + 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x21, 0x8c, 0x03, 0x04, + 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x10, 0x66, 0x02, 0x02, 0x60, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x0b, 0x04, 0x0a, 0x00, 0x00, 0x00, + 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, + 0xc6, 0x04, 0x43, 0x82, 0x23, 0x00, 0x25, 0x50, 0x20, 0x05, 0x18, 0x50, + 0x10, 0x45, 0x50, 0x06, 0x05, 0x54, 0x60, 0x85, 0x50, 0x0a, 0xc5, 0x40, + 0x77, 0x04, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x0d, 0x01, 0x00, 0x00, + 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, + 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, + 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, + 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, + 0x65, 0x88, 0x40, 0x01, 0x43, 0x0c, 0x88, 0x80, 0x0e, 0x68, 0x60, 0xd1, + 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0xa1, 0x06, 0x88, 0x80, 0x08, 0x68, + 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, + 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x0a, 0x72, 0x61, 0x69, 0x72, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, + 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x04, 0xea, 0x20, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, + 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, + 0x95, 0xb9, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0xa8, 0x84, 0x61, 0x10, + 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, + 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, + 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x16, + 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, + 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, + 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, + 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0xa8, 0x06, 0x1a, + 0x28, 0x87, 0x7a, 0x86, 0x08, 0x14, 0x44, 0x26, 0x2c, 0x4d, 0xce, 0x05, + 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, 0x9c, + 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, 0x17, + 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, 0x34, + 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e, 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, 0xce, 0x25, + 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf, + 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e, + 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, + 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, 0x00, 0x21, 0x94, 0x47, 0x7d, + 0x50, 0x41, 0x81, 0x01, 0x34, 0x40, 0x04, 0x15, 0x06, 0x94, 0x18, 0x40, + 0x05, 0x35, 0x06, 0x50, 0x41, 0x39, 0xd4, 0x43, 0x55, 0x14, 0x19, 0x90, + 0x0a, 0x4b, 0x93, 0x73, 0x99, 0xa3, 0x93, 0xab, 0x1b, 0xa3, 0xfb, 0xa2, + 0xcb, 0x83, 0x2b, 0xfb, 0x4a, 0x73, 0x33, 0x7b, 0xa3, 0x61, 0xc6, 0xf6, + 0x16, 0x46, 0x37, 0x43, 0xe3, 0xcd, 0xcc, 0x6c, 0xae, 0x8c, 0x8e, 0x86, + 0xd4, 0xd8, 0x5b, 0x99, 0x99, 0x19, 0x8d, 0xa3, 0xb1, 0xb7, 0x32, 0x33, + 0x33, 0x1a, 0x42, 0x63, 0x6f, 0x65, 0x66, 0x66, 0x43, 0xd0, 0x00, 0x1a, + 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd0, 0x00, 0x2a, 0xa0, 0x02, 0x1a, + 0xa8, 0x33, 0xa0, 0xd2, 0x00, 0x52, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, + 0xd4, 0x00, 0x5a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd6, 0x80, 0x49, + 0x56, 0x95, 0x15, 0x51, 0xd9, 0xd8, 0x1b, 0x59, 0x19, 0x0d, 0xb2, 0xb2, + 0xb1, 0x37, 0xb2, 0xb2, 0x21, 0x64, 0x00, 0x25, 0x94, 0x47, 0x7d, 0x90, + 0x41, 0x81, 0x01, 0x44, 0x40, 0x04, 0x15, 0x06, 0x94, 0x19, 0x50, 0x6c, + 0x40, 0x89, 0x01, 0x64, 0x50, 0x63, 0x00, 0x15, 0x94, 0x43, 0xb5, 0x01, + 0x55, 0x51, 0x6e, 0xc0, 0x25, 0x2c, 0x4d, 0xce, 0x85, 0xae, 0x0c, 0x8f, + 0xae, 0x4e, 0xae, 0x8c, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x5c, 0x58, 0x1b, + 0x1c, 0x5b, 0x19, 0x31, 0xba, 0x32, 0x3c, 0xba, 0x3a, 0xb9, 0x32, 0x19, + 0x32, 0x1e, 0x33, 0xb6, 0xb7, 0x30, 0x3a, 0x16, 0x90, 0xb9, 0xb0, 0x36, + 0x38, 0xb6, 0x32, 0x1f, 0x12, 0x74, 0x65, 0x78, 0x59, 0x43, 0x28, 0x88, + 0xa1, 0xe0, 0x80, 0x02, 0x03, 0x68, 0x80, 0x08, 0x2a, 0x0e, 0x28, 0x87, + 0x92, 0x03, 0xaa, 0xa2, 0xe6, 0x80, 0x05, 0x5d, 0x19, 0x5e, 0x95, 0xd5, + 0x10, 0x0a, 0x6a, 0x28, 0x38, 0xa0, 0xc0, 0x00, 0x22, 0x20, 0x82, 0x8a, + 0x03, 0xca, 0xa1, 0xe4, 0x80, 0xaa, 0xa8, 0x3a, 0xe0, 0x12, 0x96, 0x26, + 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x26, 0xc7, 0x63, 0x2e, 0xac, + 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, 0x10, 0x09, 0x72, 0xa8, 0x3b, + 0xa0, 0xc0, 0x00, 0x1a, 0x20, 0x82, 0x72, 0x28, 0x3c, 0xa0, 0x2a, 0x2a, + 0x0f, 0x86, 0x38, 0xd4, 0x45, 0x75, 0x54, 0x19, 0x50, 0x6f, 0x40, 0xd1, + 0x01, 0x65, 0x07, 0x94, 0x1e, 0x0c, 0x31, 0x18, 0x80, 0x8a, 0xa8, 0x3d, + 0xe0, 0xf3, 0xd6, 0xe6, 0x96, 0x06, 0xf7, 0x46, 0x57, 0xe6, 0x46, 0x07, + 0x32, 0x86, 0x16, 0x26, 0xc7, 0x67, 0x2a, 0xad, 0x0d, 0x8e, 0xad, 0x0c, + 0x64, 0x68, 0x65, 0x05, 0x84, 0x4a, 0x28, 0x28, 0x68, 0x88, 0x40, 0xf9, + 0xc1, 0x10, 0x83, 0xea, 0x03, 0xea, 0x0f, 0xae, 0x67, 0x88, 0x41, 0x81, + 0x02, 0x05, 0x0a, 0xd7, 0x33, 0x42, 0x61, 0x07, 0x76, 0xb0, 0x87, 0x76, + 0x70, 0x83, 0x74, 0x20, 0x87, 0x72, 0x70, 0x07, 0x7a, 0x98, 0x12, 0x04, + 0x23, 0x96, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x7b, 0x28, 0x07, 0x79, + 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x08, 0x23, 0xa8, 0x70, + 0x48, 0x07, 0x79, 0x70, 0x03, 0x76, 0x08, 0x07, 0x77, 0x38, 0x87, 0x7a, + 0x08, 0x87, 0x73, 0x28, 0x87, 0x5f, 0xb0, 0x87, 0x72, 0x90, 0x87, 0x79, + 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x01, 0x31, 0x62, 0x0a, 0x87, 0x74, + 0x90, 0x07, 0x37, 0x18, 0x87, 0x77, 0x68, 0x07, 0x78, 0x48, 0x07, 0x76, + 0x28, 0x87, 0x5f, 0x78, 0x07, 0x78, 0xa0, 0x87, 0x74, 0x78, 0x07, 0x77, + 0x98, 0x87, 0x29, 0x84, 0x81, 0x28, 0xcc, 0x08, 0x26, 0x1c, 0xd2, 0x41, + 0x1e, 0xdc, 0xc0, 0x1c, 0xe4, 0x21, 0x1c, 0xce, 0xa1, 0x1d, 0xca, 0xc1, + 0x1d, 0xe8, 0x61, 0x4a, 0xc0, 0x07, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, + 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, + 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, + 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, + 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, + 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, + 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, + 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, + 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, + 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, + 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, + 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, + 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, + 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, + 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, + 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, + 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, + 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, + 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, + 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, + 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, + 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, + 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, + 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, + 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, + 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, + 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, + 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, + 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, + 0x71, 0x20, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, 0x16, 0xd0, 0x00, 0x48, + 0xe4, 0x0f, 0xce, 0xe4, 0x57, 0x77, 0x71, 0xdb, 0x26, 0xb0, 0x01, 0x48, + 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, 0xd7, 0x44, 0x45, 0xc4, + 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x6d, 0x00, 0x11, 0xdb, 0x95, 0xff, + 0xf9, 0xda, 0xf5, 0x5f, 0x44, 0x80, 0xc1, 0x10, 0xcd, 0x04, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, + 0x10, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x64, 0xe7, 0x20, 0x06, + 0x02, 0xf1, 0xa8, 0x8e, 0x35, 0x00, 0x03, 0x31, 0xc7, 0x30, 0x10, 0xde, + 0x1c, 0xc3, 0xe0, 0x79, 0x63, 0x0d, 0x40, 0x20, 0xd0, 0xab, 0x81, 0x11, + 0x00, 0x82, 0x33, 0x00, 0x14, 0x47, 0x00, 0xc6, 0x12, 0x02, 0x80, 0xc8, + 0x0c, 0x00, 0x89, 0x19, 0x00, 0x0a, 0x33, 0x00, 0x04, 0xc6, 0x08, 0x40, + 0x10, 0x04, 0xf1, 0x6f, 0x04, 0x00, 0x00, 0x00, 0x23, 0x06, 0xca, 0x10, + 0x90, 0x81, 0x04, 0x55, 0xca, 0x91, 0x04, 0x23, 0x06, 0xca, 0x10, 0x94, + 0x81, 0x14, 0x59, 0x0b, 0xa2, 0x08, 0x83, 0x0c, 0x41, 0x81, 0x0c, 0x32, + 0x0c, 0xc6, 0x33, 0xc8, 0x20, 0x20, 0xd1, 0x20, 0x83, 0x10, 0x4c, 0x83, + 0x0c, 0xc1, 0x52, 0x9d, 0x36, 0x96, 0x82, 0x62, 0x43, 0x00, 0x1f, 0xf2, + 0xca, 0x20, 0x83, 0xe0, 0x58, 0xe3, 0x0d, 0xdf, 0x18, 0xb8, 0xc1, 0x05, + 0x63, 0x29, 0x28, 0x83, 0x0c, 0x81, 0xa4, 0x8d, 0x18, 0x14, 0x44, 0x50, + 0x07, 0x45, 0x30, 0xc7, 0x40, 0x05, 0x74, 0x30, 0xde, 0x50, 0x06, 0x69, + 0x00, 0x07, 0x17, 0x8c, 0xa5, 0xa0, 0x0c, 0x32, 0x04, 0x18, 0x18, 0x8c, + 0x18, 0x14, 0x44, 0xb0, 0x07, 0x4b, 0x30, 0xc7, 0x60, 0x04, 0x79, 0x30, + 0xde, 0xb0, 0x06, 0x6f, 0x50, 0x07, 0x17, 0x8c, 0xa5, 0xa0, 0x0c, 0x32, + 0x04, 0x9e, 0x19, 0x8c, 0x18, 0x14, 0x44, 0x10, 0x0a, 0x51, 0x30, 0xc7, + 0x60, 0x04, 0x7b, 0x30, 0xc7, 0x10, 0x80, 0xc1, 0x1e, 0x58, 0x50, 0xc9, + 0x27, 0x83, 0x80, 0x18, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x06, 0x25, 0x08, + 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 +}; +const unsigned int sdl_metallib_len = 22744; diff --git a/Engine/lib/sdl/src/render/metal/SDL_shaders_metal_osx.h b/Engine/lib/sdl/src/render/metal/SDL_shaders_metal_osx.h new file mode 100644 index 000000000..787c6fe21 --- /dev/null +++ b/Engine/lib/sdl/src/render/metal/SDL_shaders_metal_osx.h @@ -0,0 +1,1903 @@ +const unsigned char sdl_metallib[] = { + 0x4d, 0x54, 0x4c, 0x42, 0x01, 0x80, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x59, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x58, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xa8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x54, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, + 0x4e, 0x41, 0x4d, 0x45, 0x11, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x53, 0x6f, + 0x6c, 0x69, 0x64, 0x5f, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x00, 0x54, + 0x59, 0x50, 0x45, 0x01, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x20, 0x00, + 0xcb, 0x86, 0x8e, 0x78, 0x90, 0x1d, 0xa9, 0xc3, 0xb9, 0xec, 0xcd, 0xec, + 0x69, 0xba, 0x3d, 0x7e, 0x97, 0xb5, 0xa9, 0x05, 0x01, 0xbe, 0x87, 0xd8, + 0x0c, 0xca, 0x1a, 0xb4, 0x91, 0x54, 0x7e, 0x29, 0x4f, 0x46, 0x46, 0x54, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x77, 0x00, 0x00, 0x00, + 0x4e, 0x41, 0x4d, 0x45, 0x10, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x43, 0x6f, + 0x70, 0x79, 0x5f, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x00, 0x54, 0x59, + 0x50, 0x45, 0x01, 0x00, 0x00, 0x48, 0x41, 0x53, 0x48, 0x20, 0x00, 0xf5, + 0xc6, 0xe3, 0x26, 0x71, 0xe3, 0x1c, 0x45, 0x4d, 0xb1, 0xdb, 0x0e, 0x1a, + 0x29, 0x85, 0x9d, 0xa7, 0x04, 0x40, 0x91, 0x18, 0x99, 0x5c, 0x9f, 0xdb, + 0x7c, 0x30, 0xd1, 0x67, 0x59, 0xd8, 0xa4, 0x4f, 0x46, 0x46, 0x54, 0x18, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, 0x00, 0x01, + 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x7a, 0x00, 0x00, 0x00, 0x4e, + 0x41, 0x4d, 0x45, 0x13, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x53, 0x6f, 0x6c, + 0x69, 0x64, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x00, + 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, 0x20, + 0x00, 0x31, 0xa8, 0x6b, 0xb7, 0x4d, 0x8a, 0x56, 0xc7, 0x91, 0xa4, 0x37, + 0xfd, 0xa6, 0xbf, 0x79, 0xd1, 0x55, 0x8c, 0xd5, 0x1b, 0x88, 0x69, 0x8e, + 0x6c, 0xf0, 0x53, 0x1b, 0xd3, 0x35, 0xfe, 0x3f, 0x01, 0x4f, 0x46, 0x46, + 0x54, 0x18, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, 0x08, + 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, 0x00, 0x00, + 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, 0x5f, 0x43, + 0x6f, 0x70, 0x79, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, + 0x20, 0x00, 0x52, 0xe7, 0xfc, 0x67, 0x4e, 0xed, 0x7a, 0xa8, 0x44, 0x82, + 0xb2, 0x41, 0x3c, 0xdb, 0x9e, 0xe8, 0x5b, 0xbb, 0x30, 0x60, 0xf8, 0xa1, + 0x94, 0xac, 0xb4, 0x80, 0xaa, 0x08, 0xa6, 0xa0, 0xe6, 0xfd, 0x4f, 0x46, + 0x46, 0x54, 0x18, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0x1f, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, + 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x78, 0x00, + 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x11, 0x00, 0x53, 0x44, 0x4c, 0x5f, + 0x59, 0x55, 0x56, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, 0x74, + 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, 0x48, + 0x20, 0x00, 0x28, 0x59, 0x9d, 0x20, 0x32, 0xc7, 0x94, 0x63, 0xa8, 0xda, + 0x9c, 0xac, 0x28, 0xb8, 0x01, 0xc3, 0x5f, 0x48, 0xf6, 0x74, 0x09, 0x1a, + 0xd9, 0x84, 0x91, 0x19, 0xc6, 0xe7, 0x4e, 0x94, 0x47, 0xce, 0x4f, 0x46, + 0x46, 0x54, 0x18, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x2a, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, 0x00, + 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, 0x00, + 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, 0x5f, + 0x4e, 0x56, 0x31, 0x32, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, 0x6e, + 0x74, 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, 0x53, + 0x48, 0x20, 0x00, 0x08, 0x35, 0xd4, 0x21, 0x2f, 0xca, 0x8d, 0x22, 0xb2, + 0xa3, 0x9a, 0xd8, 0xd9, 0x46, 0x6d, 0x01, 0x7d, 0x06, 0x95, 0x04, 0x7a, + 0x94, 0xdf, 0x2b, 0xd2, 0x21, 0xea, 0x99, 0x9f, 0x2b, 0xda, 0x65, 0x4f, + 0x46, 0x46, 0x54, 0x18, 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x38, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, 0x01, + 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x79, + 0x00, 0x00, 0x00, 0x4e, 0x41, 0x4d, 0x45, 0x12, 0x00, 0x53, 0x44, 0x4c, + 0x5f, 0x4e, 0x56, 0x32, 0x31, 0x5f, 0x66, 0x72, 0x61, 0x67, 0x6d, 0x65, + 0x6e, 0x74, 0x00, 0x54, 0x59, 0x50, 0x45, 0x01, 0x00, 0x01, 0x48, 0x41, + 0x53, 0x48, 0x20, 0x00, 0xe0, 0x53, 0xda, 0x06, 0xef, 0x80, 0x49, 0x61, + 0xf6, 0x9e, 0xee, 0xfe, 0x49, 0xb6, 0xd2, 0xce, 0xb8, 0xea, 0x5f, 0x9a, + 0xf4, 0x77, 0x35, 0xe7, 0xd3, 0xfc, 0x0f, 0xf6, 0x01, 0xe5, 0x90, 0xd6, + 0x4f, 0x46, 0x46, 0x54, 0x18, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0x46, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x45, 0x52, 0x53, 0x08, 0x00, + 0x01, 0x00, 0x08, 0x00, 0x01, 0x00, 0x01, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, + 0x04, 0x00, 0x00, 0x00, 0x45, 0x4e, 0x44, 0x54, 0x04, 0x00, 0x00, 0x00, + 0x45, 0x4e, 0x44, 0x54, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x38, 0x0b, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0xcb, 0x02, 0x00, 0x00, + 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, + 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, + 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, + 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, + 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, + 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, + 0x51, 0x18, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x20, 0x00, + 0x16, 0xa0, 0xda, 0x60, 0x08, 0x02, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x18, + 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, + 0x20, 0x01, 0x15, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, + 0x40, 0x0f, 0xec, 0x90, 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, + 0x40, 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, + 0x40, 0x0e, 0xe5, 0xd0, 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, + 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, + 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, + 0x3c, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, + 0x3a, 0xb0, 0x43, 0x1b, 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, + 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, 0x50, 0x0e, 0x00, 0xc1, 0x0e, 0xe5, + 0x30, 0x0f, 0xf3, 0xd0, 0x06, 0xf0, 0x20, 0x0f, 0xe5, 0x30, 0x0e, 0xe9, + 0x30, 0x0f, 0xe5, 0xd0, 0x06, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xe4, + 0x00, 0xd0, 0x83, 0x3c, 0xd4, 0x43, 0x39, 0x00, 0x84, 0x3b, 0xbc, 0x43, + 0x1b, 0x98, 0x83, 0x3c, 0x84, 0x43, 0x3b, 0x94, 0x43, 0x1b, 0xc0, 0xc3, + 0x3b, 0xa4, 0x83, 0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, 0x3b, 0xcc, 0x43, 0x1b, 0x98, 0x03, 0x3c, 0xb4, 0x41, + 0x3b, 0x84, 0x03, 0x3d, 0xa0, 0x03, 0x60, 0x0e, 0xe1, 0xc0, 0x0e, 0xf3, + 0x50, 0x0e, 0x00, 0x31, 0x0f, 0xf4, 0x10, 0x0e, 0xe3, 0xb0, 0x0e, 0x6d, + 0x00, 0x0f, 0xf2, 0xf0, 0x0e, 0xf4, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xef, + 0x20, 0x0f, 0x6d, 0x20, 0x0e, 0xf5, 0x60, 0x0e, 0xe6, 0x50, 0x0e, 0xf2, + 0xd0, 0x06, 0xf3, 0x90, 0x0e, 0xfa, 0x50, 0x0e, 0x00, 0x1e, 0x00, 0x04, + 0x3d, 0x84, 0x83, 0x3c, 0x9c, 0x43, 0x39, 0xd0, 0x43, 0x1b, 0x98, 0x43, + 0x39, 0x84, 0x03, 0x3d, 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d, + 0x60, 0x0e, 0xf0, 0x10, 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3, + 0x10, 0x0e, 0xe6, 0x50, 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, + 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, + 0x40, 0xd4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, + 0x3d, 0xb4, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, + 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x08, 0x00, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x50, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x70, 0x9f, 0x34, 0x45, 0x94, + 0x30, 0xf9, 0xac, 0xb3, 0x20, 0xc3, 0x4b, 0x44, 0x13, 0x71, 0xa1, 0xd4, + 0xf4, 0x50, 0x93, 0xff, 0x00, 0x82, 0x42, 0x0c, 0x58, 0x08, 0x60, 0x18, + 0x41, 0x00, 0x06, 0x11, 0x86, 0x20, 0x09, 0xc2, 0x4c, 0xd3, 0x38, 0xb0, + 0x43, 0x38, 0xcc, 0xc3, 0x3c, 0xb8, 0x41, 0x3b, 0x94, 0x03, 0x3d, 0x84, + 0x03, 0x3b, 0xe8, 0x81, 0x1e, 0xb4, 0x43, 0x38, 0xd0, 0x83, 0x3c, 0xa4, + 0x03, 0x3e, 0xa0, 0xa0, 0x0c, 0x22, 0x18, 0xc2, 0x1c, 0x01, 0x18, 0x94, + 0x42, 0x90, 0x73, 0x10, 0xa5, 0x81, 0x00, 0x32, 0x73, 0x04, 0xa0, 0x30, + 0x88, 0x10, 0x08, 0x53, 0x00, 0x23, 0x00, 0xc3, 0x08, 0x04, 0x32, 0x47, + 0x10, 0x50, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, + 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, + 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, 0x87, 0x38, 0x80, 0x03, + 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, 0xf0, 0x1e, 0xe5, 0xd0, + 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x78, 0xa0, + 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, + 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, + 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10, + 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, + 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, + 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x74, 0x80, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, + 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x20, + 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, + 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, 0x20, 0x07, 0x7a, 0x20, + 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, + 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, + 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x50, 0x07, 0x71, 0x20, + 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, + 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, + 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, + 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0x30, 0x84, 0x51, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x02, 0x01, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, 0x19, 0x11, 0x4c, 0x90, + 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x42, 0x25, 0x30, 0x02, 0x50, + 0x80, 0x01, 0x05, 0x51, 0x04, 0x05, 0x52, 0x06, 0xd4, 0x46, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0xc4, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, + 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, + 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, + 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, + 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0xb0, 0x00, + 0x43, 0x0c, 0x24, 0x40, 0x08, 0x44, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, + 0x36, 0x04, 0x59, 0x06, 0x24, 0x40, 0x02, 0x44, 0xe0, 0x16, 0x96, 0x26, + 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, + 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, + 0x36, 0x44, 0x58, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, + 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x84, 0xe5, + 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, + 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, + 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85, + 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x96, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, + 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, + 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, + 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x16, 0x32, 0x61, 0x69, + 0x72, 0x2e, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x8c, 0xc2, + 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, + 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x90, + 0x09, 0x4b, 0x93, 0x73, 0x09, 0x93, 0x3b, 0xfb, 0x72, 0x0b, 0x6b, 0x2b, + 0x23, 0x02, 0xf7, 0x36, 0x97, 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x44, 0x59, + 0x9a, 0xc5, 0x59, 0x9e, 0x05, 0x5a, 0x22, 0x3a, 0x61, 0x69, 0x72, 0x2e, + 0x70, 0x6f, 0x69, 0x6e, 0x74, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x2c, 0xcc, + 0xd8, 0xde, 0xc2, 0xe8, 0x98, 0xc0, 0xbd, 0xa5, 0xb9, 0xd1, 0x4d, 0xa5, + 0xe9, 0x95, 0x0d, 0x51, 0x96, 0x69, 0x71, 0x16, 0x6a, 0x81, 0x96, 0x6a, + 0x08, 0xb1, 0x48, 0x8b, 0x45, 0x25, 0x2c, 0x4d, 0xce, 0x45, 0xac, 0xce, + 0xcc, 0xac, 0x4c, 0x8e, 0x52, 0x58, 0x9a, 0x9c, 0x0b, 0xdb, 0xdb, 0x58, + 0x18, 0x5d, 0xda, 0x9b, 0xdb, 0x57, 0x9a, 0x1b, 0x59, 0x19, 0x1e, 0x91, + 0xb0, 0x34, 0x39, 0x17, 0xb9, 0xb2, 0x30, 0x32, 0x46, 0x61, 0x69, 0x72, + 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x5f, 0x73, 0x69, + 0x7a, 0x65, 0xbc, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, + 0xf2, 0xe0, 0xca, 0xbe, 0xc2, 0xd8, 0xd2, 0xce, 0xdc, 0xbe, 0xe6, 0xd2, + 0xf4, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xc9, 0x0c, 0xe1, 0x10, + 0x61, 0xc1, 0x96, 0x0c, 0x11, 0x90, 0x60, 0xd1, 0x96, 0x0d, 0x21, 0x16, + 0x0e, 0x21, 0x16, 0x67, 0xe9, 0x16, 0x68, 0x89, 0xf8, 0x84, 0xa5, 0xc9, + 0xb9, 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5, 0xe9, 0x95, + 0x11, 0x31, 0x63, 0x7b, 0x0b, 0xa3, 0xa3, 0xc1, 0xa3, 0xa1, 0x02, 0x27, + 0xf7, 0xa6, 0x56, 0x36, 0x46, 0x97, 0xf6, 0xe6, 0x36, 0x04, 0x0c, 0x90, + 0x60, 0xc1, 0x96, 0x0f, 0x19, 0x96, 0x0c, 0x29, 0x90, 0x60, 0xd1, 0x96, + 0x0d, 0x19, 0x16, 0x0e, 0x31, 0x16, 0x67, 0x01, 0x83, 0x05, 0x5a, 0xc2, + 0x80, 0x09, 0x9d, 0x5c, 0x98, 0xdb, 0x9c, 0xd9, 0x9b, 0x5c, 0xdb, 0x10, + 0x30, 0x40, 0x8a, 0x05, 0x5b, 0x3e, 0x64, 0x58, 0x32, 0xe4, 0x40, 0x82, + 0x45, 0x5b, 0x36, 0x64, 0x58, 0x38, 0xc4, 0x58, 0x9c, 0x05, 0x0c, 0x16, + 0x68, 0x19, 0x03, 0x36, 0x61, 0x69, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x74, + 0x65, 0x78, 0x5f, 0x69, 0x64, 0x24, 0xea, 0xd2, 0xdc, 0xe8, 0x38, 0xd8, + 0xa5, 0x91, 0x0d, 0x61, 0x90, 0x63, 0x29, 0x83, 0xc5, 0x59, 0xcc, 0x60, + 0x81, 0x96, 0x33, 0x18, 0x82, 0x2c, 0xde, 0x22, 0x06, 0x0b, 0x19, 0x2c, + 0x68, 0x30, 0xc4, 0x50, 0x80, 0xe5, 0x5a, 0xd2, 0x80, 0xcf, 0x5b, 0x9b, + 0x5b, 0x1a, 0xdc, 0x1b, 0x5d, 0x99, 0x1b, 0x1d, 0xc8, 0x18, 0x5a, 0x98, + 0x1c, 0x9f, 0xa9, 0xb4, 0x36, 0x38, 0xb6, 0x32, 0x90, 0xa1, 0x95, 0x15, + 0x10, 0x2a, 0xa1, 0xa0, 0xa0, 0x21, 0xc2, 0xc2, 0x06, 0x43, 0x8c, 0x65, + 0x0d, 0x96, 0x36, 0x68, 0x90, 0x21, 0xc6, 0xe2, 0x06, 0x8b, 0x1b, 0x34, + 0xc8, 0x08, 0x85, 0x1d, 0xd8, 0xc1, 0x1e, 0xda, 0xc1, 0x0d, 0xd2, 0x81, + 0x1c, 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0x10, 0x8c, 0x58, 0xc2, 0x21, + 0x1d, 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x61, 0x1e, 0xd2, 0xe1, + 0x1d, 0xdc, 0x61, 0x4a, 0x20, 0x8c, 0xa0, 0xc2, 0x21, 0x1d, 0xe4, 0xc1, + 0x0d, 0xd8, 0x21, 0x1c, 0xdc, 0xe1, 0x1c, 0xea, 0x21, 0x1c, 0xce, 0xa1, + 0x1c, 0x7e, 0xc1, 0x1e, 0xca, 0x41, 0x1e, 0xe6, 0x21, 0x1d, 0xde, 0xc1, + 0x1d, 0xa6, 0x04, 0xc4, 0x88, 0x29, 0x1c, 0xd2, 0x41, 0x1e, 0xdc, 0x60, + 0x1c, 0xde, 0xa1, 0x1d, 0xe0, 0x21, 0x1d, 0xd8, 0xa1, 0x1c, 0x7e, 0xe1, + 0x1d, 0xe0, 0x81, 0x1e, 0xd2, 0xe1, 0x1d, 0xdc, 0x61, 0x1e, 0xa6, 0x10, + 0x06, 0xa2, 0x30, 0x23, 0x94, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x7b, + 0x28, 0x07, 0x79, 0xa0, 0x87, 0x72, 0xc0, 0x87, 0x29, 0x81, 0x1a, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, + 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, + 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, + 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, + 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, + 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, + 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, + 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, + 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, + 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, + 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, + 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, + 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, + 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, + 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, + 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, + 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, + 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, + 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, + 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, + 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, + 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, + 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, + 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, + 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, + 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, + 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, + 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, + 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, + 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x06, 0x00, 0xb1, 0x5d, 0xf9, 0xb3, 0xce, 0x82, 0x0c, 0x7f, 0x45, 0x44, + 0x13, 0x71, 0x01, 0x00, 0x61, 0x20, 0x00, 0x00, 0x69, 0x00, 0x00, 0x00, + 0x13, 0x04, 0x47, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x14, 0x47, 0x00, 0xa8, 0x95, 0x41, 0x11, 0x94, 0x00, 0xa1, 0x42, 0x20, + 0x31, 0x03, 0x40, 0x61, 0x06, 0x80, 0xc0, 0x08, 0xc0, 0x18, 0x01, 0x08, + 0x82, 0x20, 0xfe, 0x01, 0x33, 0x11, 0x0c, 0x12, 0x14, 0x33, 0x11, 0x0c, + 0x12, 0x14, 0xe3, 0x11, 0x0e, 0x64, 0x41, 0x14, 0x94, 0x59, 0x82, 0x60, + 0xa0, 0x02, 0x81, 0x03, 0xe0, 0x0c, 0x86, 0x0b, 0x9a, 0x8c, 0x47, 0x44, + 0x94, 0x16, 0x50, 0x50, 0x06, 0x19, 0x82, 0x25, 0xb2, 0xc0, 0x90, 0xcf, + 0x2c, 0x81, 0x30, 0x50, 0x81, 0xf8, 0x41, 0x50, 0x09, 0x03, 0x15, 0x01, + 0x11, 0x44, 0xc2, 0x18, 0x42, 0x21, 0xcc, 0x31, 0x40, 0x41, 0x18, 0x0c, + 0x32, 0x04, 0xd1, 0x75, 0x45, 0x93, 0xf1, 0x08, 0xce, 0x23, 0x83, 0x80, + 0x82, 0x62, 0x01, 0x21, 0x1f, 0x0b, 0x10, 0xf8, 0x98, 0x92, 0x06, 0x30, + 0x18, 0x6e, 0x08, 0x34, 0x30, 0x98, 0x65, 0x18, 0x84, 0x60, 0x3c, 0xc2, + 0x22, 0x03, 0x35, 0x88, 0x06, 0x23, 0x02, 0xa2, 0x00, 0x6c, 0x62, 0x03, + 0x18, 0x0c, 0x37, 0x04, 0x1d, 0x18, 0xcc, 0x32, 0x10, 0x41, 0x30, 0x1e, + 0x91, 0x9d, 0x41, 0x1b, 0x9c, 0x01, 0x05, 0x65, 0x3c, 0x62, 0x4b, 0x83, + 0x37, 0x08, 0x03, 0x0a, 0xca, 0x78, 0x44, 0xb7, 0x06, 0x71, 0x40, 0x06, + 0x14, 0x94, 0xf1, 0x88, 0xaf, 0x0d, 0xe6, 0xe0, 0x0c, 0x28, 0x28, 0xe3, + 0x11, 0x60, 0xf0, 0x06, 0x75, 0xf0, 0x06, 0x83, 0x11, 0x01, 0x52, 0x00, + 0xe3, 0x11, 0x61, 0x00, 0x07, 0x76, 0x80, 0x06, 0x83, 0x11, 0xc1, 0x51, + 0x00, 0xe3, 0x11, 0x62, 0x10, 0x07, 0x77, 0xa0, 0x06, 0x83, 0x11, 0x81, + 0x51, 0x00, 0xe3, 0x11, 0x63, 0x20, 0x07, 0x78, 0xc0, 0x06, 0x83, 0x11, + 0x41, 0x51, 0x00, 0xf7, 0x06, 0x2d, 0xc6, 0x13, 0xe6, 0x20, 0xa0, 0x80, + 0x8c, 0x21, 0x04, 0x7c, 0x30, 0xc7, 0xc0, 0x06, 0x41, 0x1f, 0x8c, 0x21, + 0x0c, 0x7f, 0x30, 0xc7, 0x20, 0x04, 0xa0, 0x30, 0xc7, 0x10, 0xb8, 0x41, + 0x1f, 0xcc, 0x31, 0x04, 0x6e, 0xc0, 0x07, 0x83, 0x0c, 0x41, 0x1c, 0xdc, + 0x81, 0x05, 0x95, 0x7c, 0x66, 0x09, 0x8a, 0x81, 0x0a, 0x44, 0x25, 0x88, + 0xaa, 0x18, 0xa8, 0x08, 0x08, 0x22, 0x2a, 0xc6, 0x10, 0x0a, 0x61, 0x8e, + 0xc1, 0x0e, 0x82, 0x53, 0x18, 0x64, 0x08, 0xee, 0xa0, 0x0f, 0xae, 0x68, + 0x32, 0x1e, 0x51, 0x07, 0xa4, 0xa0, 0x0a, 0x01, 0x05, 0xc5, 0x02, 0x42, + 0x3e, 0x16, 0x20, 0xf0, 0x31, 0xe5, 0x15, 0x60, 0x30, 0xdc, 0x10, 0x80, + 0x02, 0x18, 0xcc, 0x32, 0x18, 0x45, 0x30, 0xdb, 0x00, 0x0a, 0x03, 0x30, + 0xdb, 0x10, 0xf8, 0x41, 0x90, 0x41, 0x40, 0x0c, 0x08, 0x00, 0x00, 0x00, + 0x5b, 0x86, 0x21, 0x78, 0x83, 0x2d, 0x03, 0x12, 0xbc, 0xc1, 0x96, 0x61, + 0x0a, 0xde, 0x60, 0xcb, 0xa0, 0x05, 0x6f, 0xb0, 0x65, 0x80, 0x83, 0xe0, + 0x0d, 0xb6, 0x0c, 0xa1, 0x10, 0xbc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, + 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0x90, 0x0b, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, + 0xe1, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, + 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, + 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, + 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, + 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, + 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, + 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, + 0x1b, 0x8c, 0x20, 0x00, 0x16, 0xa0, 0xda, 0x60, 0x08, 0x02, 0xb0, 0x00, + 0xd5, 0x06, 0x63, 0x18, 0x80, 0x05, 0xa8, 0x36, 0x18, 0x04, 0x01, 0x2c, + 0x40, 0xb5, 0x81, 0x5c, 0x8a, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x09, + 0xa8, 0x88, 0x71, 0x78, 0x07, 0x79, 0x90, 0x87, 0x72, 0x18, 0x07, 0x7a, + 0x60, 0x87, 0x7c, 0x68, 0x03, 0x79, 0x78, 0x87, 0x7a, 0x70, 0x07, 0x72, + 0x28, 0x07, 0x72, 0x68, 0x03, 0x72, 0x48, 0x07, 0x7b, 0x48, 0x07, 0x72, + 0x28, 0x87, 0x36, 0x98, 0x87, 0x78, 0x90, 0x07, 0x7a, 0x68, 0x03, 0x73, + 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xcc, 0x21, + 0x1c, 0xd8, 0x61, 0x1e, 0xca, 0x01, 0x20, 0xc8, 0x21, 0x1d, 0xe6, 0x21, + 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0xa1, 0x0d, 0xe8, 0x21, 0x1c, 0xd2, 0x81, + 0x1d, 0xda, 0x60, 0x1c, 0xc2, 0x81, 0x1d, 0xd8, 0x61, 0x1e, 0x00, 0x73, + 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x76, 0x28, 0x87, 0x79, + 0x98, 0x87, 0x36, 0x80, 0x07, 0x79, 0x28, 0x87, 0x71, 0x48, 0x87, 0x79, + 0x28, 0x87, 0x36, 0x30, 0x07, 0x78, 0x68, 0x87, 0x70, 0x20, 0x07, 0x80, + 0x1e, 0xe4, 0xa1, 0x1e, 0xca, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0xc0, + 0x1c, 0xe4, 0x21, 0x1c, 0xda, 0xa1, 0x1c, 0xda, 0x00, 0x1e, 0xde, 0x21, + 0x1d, 0xdc, 0x81, 0x1e, 0xca, 0x41, 0x1e, 0xda, 0xa0, 0x1c, 0xd8, 0x21, + 0x1d, 0xda, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x06, 0x77, + 0x78, 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, + 0x80, 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, + 0x28, 0x07, 0x76, 0x48, 0x87, 0x76, 0x68, 0x03, 0x77, 0x78, 0x07, 0x77, + 0x68, 0x03, 0x76, 0x28, 0x87, 0x70, 0x30, 0x07, 0x80, 0x70, 0x87, 0x77, + 0x68, 0x83, 0x74, 0x70, 0x07, 0x73, 0x98, 0x87, 0x36, 0x30, 0x07, 0x78, + 0x68, 0x83, 0x76, 0x08, 0x07, 0x7a, 0x40, 0x07, 0x80, 0x1e, 0xe4, 0xa1, + 0x1e, 0xca, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0x40, 0x1d, 0xea, 0xa1, + 0x1d, 0xe0, 0xa1, 0x0d, 0xe8, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, + 0x1e, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x77, + 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73, + 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, + 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21, + 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41, + 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, + 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, + 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, + 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, + 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, + 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21, + 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21, + 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73, + 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70, + 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, + 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2, + 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1, + 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70, + 0x60, 0x87, 0x79, 0x28, 0x07, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x13, 0x8a, 0x40, 0x18, 0x88, 0x02, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x50, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0xe7, + 0x49, 0x53, 0x44, 0x09, 0x93, 0xcf, 0x39, 0x0f, 0xf6, 0x12, 0xd1, 0x44, + 0x5c, 0x28, 0x35, 0x3d, 0xd4, 0xe4, 0x3f, 0x80, 0xa0, 0x10, 0x03, 0x16, + 0x82, 0x18, 0x44, 0x10, 0x82, 0x24, 0x08, 0x33, 0x4d, 0xe3, 0xc0, 0x0e, + 0xe1, 0x30, 0x0f, 0xf3, 0xe0, 0x06, 0xed, 0x50, 0x0e, 0xf4, 0x10, 0x0e, + 0xec, 0xa0, 0x07, 0x7a, 0xd0, 0x0e, 0xe1, 0x40, 0x0f, 0xf2, 0x90, 0x0e, + 0xf8, 0x80, 0x82, 0x32, 0x88, 0x60, 0x08, 0x73, 0x04, 0x60, 0x50, 0x8c, + 0x41, 0xc8, 0x39, 0x88, 0xd2, 0x40, 0x00, 0x99, 0x39, 0x02, 0x50, 0x18, + 0x44, 0x08, 0x84, 0x29, 0x80, 0x11, 0x80, 0x61, 0x04, 0x02, 0x99, 0x23, + 0x08, 0x28, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, + 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, + 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, 0x87, 0x38, 0x80, 0x03, + 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, 0xf0, 0x1e, 0xe5, 0xd0, + 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x78, 0xa0, + 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, + 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, + 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, + 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, + 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10, + 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, + 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, + 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, + 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, 0x20, 0x07, 0x7a, 0x30, + 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x74, 0x80, + 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, + 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, + 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x20, + 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, + 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, 0x20, 0x07, 0x7a, 0x20, + 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, + 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, + 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, 0x50, 0x07, 0x71, 0x20, + 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, + 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, + 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, + 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, + 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, + 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, 0x30, 0x84, 0x51, 0x00, + 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x02, 0x01, 0x00, 0x00, + 0x09, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, 0x19, 0x11, 0x4c, 0x90, + 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x42, 0x25, 0x50, 0x10, 0x23, + 0x00, 0x05, 0x18, 0x50, 0x04, 0x05, 0x52, 0x06, 0x85, 0x40, 0x6d, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xd3, 0x00, 0x00, 0x00, + 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, + 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, + 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, + 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, + 0x65, 0x88, 0xb0, 0x00, 0x43, 0x0c, 0x24, 0x40, 0x04, 0x64, 0x60, 0xd1, + 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x59, 0x06, 0x24, 0x40, 0x02, 0x64, + 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, + 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, 0x0a, 0x72, 0x61, 0x69, 0x72, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, + 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x84, 0xe5, 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, + 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, + 0x91, 0xa5, 0xcd, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x96, 0x84, 0x61, + 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, + 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, + 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x58, + 0x16, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, + 0x6f, 0x6e, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, + 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, + 0x85, 0xd1, 0xd1, 0x90, 0x09, 0x4b, 0x93, 0x73, 0x09, 0x93, 0x3b, 0xfb, + 0x72, 0x0b, 0x6b, 0x2b, 0x23, 0x02, 0xf7, 0x36, 0x97, 0x46, 0x97, 0xf6, + 0xe6, 0x36, 0x44, 0x59, 0x9a, 0xc5, 0x59, 0x9e, 0x05, 0x5a, 0x22, 0x46, + 0x61, 0x69, 0x72, 0x2e, 0x76, 0x65, 0x72, 0x74, 0x65, 0x78, 0x5f, 0x6f, + 0x75, 0x74, 0x70, 0x75, 0x74, 0xcc, 0xce, 0xca, 0xdc, 0xca, 0xe4, 0xc2, + 0xe8, 0xca, 0xc8, 0x50, 0x70, 0xe8, 0xca, 0xf0, 0xc6, 0xde, 0xde, 0xe4, + 0xc8, 0x88, 0xec, 0x64, 0xbe, 0xcc, 0x52, 0x68, 0x98, 0xb1, 0xbd, 0x85, + 0xd1, 0xc9, 0x10, 0xa1, 0x2b, 0xc3, 0x1b, 0x7b, 0x7b, 0x93, 0x23, 0x1b, + 0xc2, 0x2c, 0xd3, 0x42, 0x2d, 0xce, 0x52, 0x2d, 0xd0, 0x62, 0x0d, 0x21, + 0x16, 0x69, 0xb9, 0xa8, 0x84, 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, + 0x95, 0xc9, 0x51, 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, 0xa3, + 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, 0x96, + 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, 0x25, + 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf, + 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e, + 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, + 0xd9, 0x10, 0x0e, 0x19, 0x96, 0x6c, 0xd1, 0x90, 0x01, 0x09, 0x96, 0x6d, + 0xe1, 0x10, 0x61, 0xe9, 0x10, 0x61, 0x71, 0x96, 0x6a, 0x81, 0x96, 0x88, + 0x09, 0x5d, 0x19, 0xde, 0xd8, 0xdb, 0x9b, 0x1c, 0xd9, 0xdc, 0x10, 0x0e, + 0x09, 0x96, 0x6c, 0xd1, 0x90, 0x00, 0x09, 0x96, 0x6d, 0xe1, 0x10, 0x61, + 0xe9, 0x10, 0x61, 0x71, 0x96, 0x6a, 0x81, 0x96, 0x8f, 0x4f, 0x58, 0x9a, + 0x9c, 0x8b, 0x58, 0x9d, 0x99, 0x59, 0x99, 0xdc, 0xd7, 0x5c, 0x9a, 0x5e, + 0x19, 0x11, 0x33, 0xb6, 0xb7, 0x30, 0x3a, 0x1a, 0x3c, 0x1a, 0x2a, 0x70, + 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x43, 0xc0, 0x00, + 0x29, 0x96, 0x6c, 0x09, 0x03, 0x84, 0x58, 0x34, 0xa4, 0x40, 0x82, 0x65, + 0x5b, 0x38, 0x84, 0x58, 0x3a, 0xc4, 0x58, 0x9c, 0x45, 0x0c, 0x16, 0x68, + 0x19, 0x03, 0x26, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x6f, 0x72, 0x6d, + 0x43, 0xc0, 0x00, 0x39, 0x96, 0x6c, 0x09, 0x03, 0x84, 0x58, 0x34, 0xe4, + 0x40, 0x82, 0x65, 0x5b, 0x38, 0x84, 0x58, 0x3a, 0xc4, 0x58, 0x9c, 0x45, + 0x0c, 0x16, 0x68, 0x29, 0x03, 0x36, 0x61, 0x69, 0x72, 0x2e, 0x76, 0x65, + 0x72, 0x74, 0x65, 0x78, 0x5f, 0x69, 0x64, 0x24, 0xea, 0xd2, 0xdc, 0xe8, + 0x38, 0xd8, 0xa5, 0x91, 0x0d, 0x61, 0x10, 0x64, 0x39, 0x83, 0xc5, 0x59, + 0xd0, 0x60, 0x81, 0x96, 0x34, 0x18, 0xa2, 0x2c, 0xde, 0x02, 0x06, 0x0b, + 0x19, 0x2c, 0x66, 0xb0, 0xa8, 0xc1, 0x10, 0x43, 0x01, 0x16, 0x6c, 0x59, + 0x03, 0x3e, 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74, + 0x20, 0x63, 0x68, 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, 0xe0, 0xd8, 0xca, + 0x40, 0x86, 0x56, 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, 0x86, 0x08, 0x8b, + 0x1b, 0x0c, 0x31, 0x96, 0x36, 0x58, 0xde, 0xa0, 0x49, 0x86, 0x18, 0x0b, + 0x1c, 0x2c, 0x70, 0xd0, 0x24, 0x23, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x48, 0x07, 0x72, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, 0x41, + 0x30, 0x62, 0x09, 0x87, 0x74, 0x90, 0x07, 0x37, 0xb0, 0x87, 0x72, 0x90, + 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x81, 0x30, 0x82, 0x0a, + 0x87, 0x74, 0x90, 0x07, 0x37, 0x60, 0x87, 0x70, 0x70, 0x87, 0x73, 0xa8, + 0x87, 0x70, 0x38, 0x87, 0x72, 0xf8, 0x05, 0x7b, 0x28, 0x07, 0x79, 0x98, + 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x10, 0x23, 0xa6, 0x70, 0x48, + 0x07, 0x79, 0x70, 0x83, 0x71, 0x78, 0x87, 0x76, 0x80, 0x87, 0x74, 0x60, + 0x87, 0x72, 0xf8, 0x85, 0x77, 0x80, 0x07, 0x7a, 0x48, 0x87, 0x77, 0x70, + 0x87, 0x79, 0x98, 0x42, 0x18, 0x88, 0xc2, 0x8c, 0x50, 0xc2, 0x21, 0x1d, + 0xe4, 0xc1, 0x0d, 0xec, 0xa1, 0x1c, 0xe4, 0x81, 0x1e, 0xca, 0x01, 0x1f, + 0xa6, 0x04, 0x6c, 0x00, 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, + 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, + 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, + 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, + 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, + 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, + 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, + 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, + 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, + 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, + 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, + 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, + 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, + 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, + 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, + 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, + 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, + 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, + 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, + 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, + 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, + 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, + 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, + 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, + 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, + 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, + 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, + 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, + 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, + 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x06, 0xf0, 0xb0, 0x5d, 0xf9, 0x73, 0xce, 0x83, + 0xfd, 0x15, 0x11, 0x4d, 0xc4, 0x05, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, + 0x6d, 0x00, 0x00, 0x00, 0x13, 0x04, 0x47, 0x2c, 0x10, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x14, 0x47, 0x00, 0xa8, 0x95, 0x41, 0x11, 0x94, + 0x00, 0x8d, 0x19, 0x00, 0x0a, 0x33, 0x00, 0x04, 0xc6, 0x08, 0x40, 0x10, + 0x04, 0xf1, 0x6f, 0x04, 0x00, 0x00, 0x00, 0x00, 0x33, 0x11, 0x0c, 0x12, + 0x14, 0x33, 0x11, 0x0c, 0x12, 0x14, 0xe3, 0x11, 0x0d, 0x64, 0x41, 0x14, + 0x94, 0x59, 0x82, 0x60, 0xa0, 0x02, 0x81, 0x03, 0xe0, 0x0c, 0x86, 0x0b, + 0x9a, 0x8c, 0x47, 0x40, 0x94, 0x16, 0x50, 0x50, 0x06, 0x19, 0x82, 0x05, + 0xb2, 0xc0, 0x90, 0xcf, 0x2c, 0x81, 0x30, 0x50, 0x81, 0x80, 0x42, 0x50, + 0x09, 0x03, 0x15, 0x01, 0x11, 0x44, 0xc2, 0x18, 0x42, 0x21, 0xcc, 0x31, + 0x40, 0x41, 0x18, 0x0c, 0x32, 0x04, 0x91, 0x75, 0x45, 0x93, 0xf1, 0x88, + 0xcd, 0x23, 0x83, 0x80, 0x82, 0x62, 0x01, 0x21, 0x1f, 0x0b, 0x10, 0xf8, + 0x98, 0xa2, 0x06, 0x30, 0x18, 0x6e, 0x08, 0xc8, 0x00, 0x0c, 0x66, 0x19, + 0x06, 0x21, 0x18, 0x8f, 0xb0, 0xc8, 0x40, 0x0d, 0xa2, 0xc1, 0x88, 0x80, + 0x28, 0x00, 0x9b, 0xda, 0x00, 0x06, 0xc3, 0x0d, 0xc1, 0x19, 0x80, 0xc1, + 0x2c, 0x03, 0x11, 0x04, 0xe3, 0x11, 0xd9, 0x19, 0xb4, 0xc1, 0x19, 0x50, + 0x50, 0xc6, 0x23, 0xb6, 0x34, 0x78, 0x03, 0x30, 0xa0, 0xa0, 0x8c, 0x47, + 0x74, 0x6b, 0x10, 0x07, 0x63, 0x40, 0x41, 0x19, 0x8f, 0xf8, 0xda, 0x60, + 0x0e, 0xcc, 0x80, 0x82, 0x32, 0x1e, 0x01, 0x06, 0x6f, 0x50, 0x07, 0x6f, + 0x30, 0x18, 0x11, 0x20, 0x05, 0x30, 0x1e, 0x11, 0x06, 0x70, 0x60, 0x07, + 0x67, 0x30, 0x18, 0x11, 0x1c, 0x05, 0x30, 0x1e, 0x21, 0x06, 0x71, 0x70, + 0x07, 0x69, 0x30, 0x18, 0x11, 0x18, 0x05, 0x30, 0x1e, 0x31, 0x06, 0x72, + 0x80, 0x07, 0x6b, 0x30, 0x18, 0x11, 0x14, 0x05, 0x70, 0x6e, 0xd0, 0x62, + 0x3c, 0x61, 0x0e, 0x02, 0x0a, 0xc8, 0x18, 0x42, 0xc0, 0x07, 0x73, 0x0c, + 0x6c, 0x10, 0xf4, 0xc1, 0x18, 0xc2, 0x00, 0x0a, 0x73, 0x0c, 0x42, 0x10, + 0x0a, 0x73, 0x0c, 0x41, 0x1b, 0xf8, 0xc1, 0x1c, 0x43, 0xf0, 0x06, 0x7d, + 0x30, 0xc8, 0x10, 0xc4, 0x81, 0x1d, 0x58, 0x50, 0xc9, 0x67, 0x96, 0xa0, + 0x18, 0xa8, 0x40, 0x58, 0x82, 0xa8, 0x8a, 0x81, 0x8a, 0x80, 0x20, 0xa2, + 0x62, 0x0c, 0xa1, 0x10, 0xe6, 0x18, 0xec, 0x20, 0x38, 0x85, 0x41, 0x86, + 0xe0, 0x0e, 0xf8, 0xe0, 0x8a, 0x26, 0xe3, 0x11, 0x75, 0x40, 0x0a, 0xaa, + 0x10, 0x50, 0x50, 0x2c, 0x20, 0xe4, 0x63, 0x01, 0x02, 0x1f, 0x53, 0x60, + 0x01, 0x06, 0xc3, 0x0d, 0x81, 0x2a, 0x80, 0xc1, 0x2c, 0x83, 0x51, 0x04, + 0xe3, 0x09, 0xa8, 0x70, 0x51, 0x40, 0x66, 0x1b, 0x44, 0xa1, 0x00, 0x66, + 0x1b, 0x02, 0x21, 0xc8, 0x20, 0x20, 0x06, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x5b, 0x86, 0x21, 0x88, 0x83, 0x2d, 0x03, 0x12, 0xc4, 0xc1, 0x96, 0x61, + 0x0a, 0xe2, 0x60, 0xcb, 0xa0, 0x05, 0x71, 0xb0, 0x65, 0x80, 0x83, 0x20, + 0x0e, 0xb6, 0x0c, 0xa1, 0x10, 0xc4, 0xc1, 0x96, 0x01, 0x15, 0x82, 0x38, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x98, 0x08, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, + 0x21, 0x0c, 0x00, 0x00, 0x23, 0x02, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, + 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, + 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x10, 0x45, 0x02, + 0x42, 0x92, 0x0b, 0x42, 0x84, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, + 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, + 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x08, 0x11, 0x62, 0xa8, 0xa0, + 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, + 0x81, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x20, 0x00, 0x16, 0xa0, 0xda, 0x40, + 0x2e, 0xc2, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x80, 0x04, 0x54, 0xc4, 0x38, + 0xbc, 0x83, 0x3c, 0xc8, 0x43, 0x39, 0x8c, 0x03, 0x3d, 0xb0, 0x43, 0x3e, + 0xb4, 0x81, 0x3c, 0xbc, 0x43, 0x3d, 0xb8, 0x03, 0x39, 0x94, 0x03, 0x39, + 0xb4, 0x01, 0x39, 0xa4, 0x83, 0x3d, 0xa4, 0x03, 0x39, 0x94, 0x43, 0x1b, + 0xcc, 0x43, 0x3c, 0xc8, 0x03, 0x3d, 0xb4, 0x81, 0x39, 0xc0, 0x43, 0x1b, + 0xb4, 0x43, 0x38, 0xd0, 0x03, 0x3a, 0x00, 0xe6, 0x10, 0x0e, 0xec, 0x30, + 0x0f, 0xe5, 0x00, 0x10, 0xe4, 0x90, 0x0e, 0xf3, 0x10, 0x0e, 0xe2, 0xc0, + 0x0e, 0xe5, 0xd0, 0x06, 0xf4, 0x10, 0x0e, 0xe9, 0xc0, 0x0e, 0x6d, 0x30, + 0x0e, 0xe1, 0xc0, 0x0e, 0xec, 0x30, 0x0f, 0x80, 0x39, 0x84, 0x03, 0x3b, + 0xcc, 0x43, 0x39, 0x00, 0x04, 0x3b, 0x94, 0xc3, 0x3c, 0xcc, 0x43, 0x1b, + 0xc0, 0x83, 0x3c, 0x94, 0xc3, 0x38, 0xa4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, + 0x98, 0x03,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, 0x43, 0x38, 0xb0, 0xc3, 0x3c, + 0x94, 0x03, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x13, 0x84, 0x40, 0x00, 0x89, 0x20, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x32, 0x22, 0x08, 0x09, 0x20, 0x64, 0x85, 0x04, 0x13, 0x22, 0xa4, 0x84, + 0x04, 0x13, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x88, 0x8c, + 0x0b, 0x84, 0x84, 0x4c, 0x10, 0x24, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, + 0x88, 0x10, 0x08, 0x45, 0x08, 0xa1, 0x19, 0x08, 0x98, 0x23, 0x00, 0x83, + 0x39, 0x02, 0x50, 0x18, 0x01, 0x00, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, + 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, + 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, + 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, + 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, + 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, + 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, + 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, + 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, + 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, + 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, + 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, + 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0x30, 0x84, 0x21, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, + 0x02, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x0c, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0xb2, + 0x11, 0x80, 0x12, 0x28, 0x90, 0x82, 0xa0, 0x1b, 0x01, 0x00, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, + 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, + 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, + 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, + 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x50, 0x00, + 0x43, 0x0c, 0x43, 0x30, 0x08, 0x23, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, + 0x36, 0x04, 0x29, 0x06, 0x43, 0x30, 0x04, 0x23, 0xe0, 0x16, 0x96, 0x26, + 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, + 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, + 0x36, 0x44, 0x28, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, + 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x84, 0xe2, + 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, + 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, + 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85, + 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x8a, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, + 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, + 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, + 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x28, 0x16, 0x46, 0x61, 0x69, + 0x72, 0x2e, 0x72, 0x65, 0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, 0x07, 0x79, 0x70, 0x03, 0x73, + 0x90, 0x87, 0x70, 0x38, 0x87, 0x76, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, + 0x01, 0x07, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, + 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, + 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, + 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, + 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, + 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, + 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, + 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, + 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, + 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, + 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, + 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, + 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, + 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, + 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, + 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, + 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, + 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, + 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, + 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, + 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, + 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, + 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, + 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, + 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, + 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, + 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, + 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, + 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, + 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, + 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, + 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x06, 0x20, 0xb1, 0x5d, 0xf9, 0xb3, 0xce, 0x82, + 0x0c, 0x7f, 0x11, 0x01, 0x06, 0x43, 0x34, 0x13, 0x00, 0x00, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x13, 0x04, 0x01, 0x05, + 0x25, 0x83, 0x80, 0x18, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x06, 0x20, 0x08, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x68, 0x0a, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x97, 0x02, 0x00, 0x00, + 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, + 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, + 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, + 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, + 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, + 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, + 0x51, 0x18, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, + 0x16, 0xa0, 0xda, 0x60, 0x08, 0x05, 0xb0, 0x00, 0xd5, 0x06, 0x73, 0x19, + 0xfe, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x18, 0x40, 0x02, 0x2a, 0x62, 0x1c, + 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8, 0x21, 0x1f, + 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c, + 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d, + 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, + 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, + 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, + 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, + 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, + 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, + 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, + 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, + 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, + 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, + 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, + 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, + 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, + 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, + 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, + 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, + 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, + 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, + 0x08, 0x77, 0x78, 0x87, 0x36, 0x50, 0x87, 0x7a, 0x68, 0x07, 0x78, 0x68, + 0x03, 0x7a, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x98, 0x07, 0xc0, 0x1c, + 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, + 0xdc, 0x21, 0x1c, 0xdc, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, + 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x7a, 0x90, 0x87, 0x7a, 0x28, + 0x07, 0x80, 0x70, 0x87, 0x77, 0x68, 0x83, 0x79, 0x48, 0x87, 0x73, 0x70, + 0x87, 0x72, 0x20, 0x87, 0x36, 0xd0, 0x87, 0x72, 0x90, 0x87, 0x77, 0x98, + 0x87, 0x36, 0x30, 0x07, 0x78, 0x68, 0x83, 0x76, 0x08, 0x07, 0x7a, 0x40, + 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x62, 0x1e, + 0xe8, 0x21, 0x1c, 0xc6, 0x61, 0x1d, 0xda, 0x00, 0x1e, 0xe4, 0xe1, 0x1d, + 0xe8, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xde, 0x41, 0x1e, 0xda, 0x40, 0x1c, + 0xea, 0xc1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, + 0xf4, 0xa1, 0x1c, 0x00, 0x3c, 0x00, 0x08, 0x7a, 0x08, 0x07, 0x79, 0x38, + 0x87, 0x72, 0xa0, 0x87, 0x36, 0x30, 0x87, 0x72, 0x08, 0x07, 0x7a, 0xa8, + 0x07, 0x79, 0x28, 0x87, 0x79, 0x00, 0xda, 0xc0, 0x1c, 0xe0, 0x21, 0x0e, + 0xec, 0x00, 0x20, 0xea, 0xc1, 0x1d, 0xe6, 0x21, 0x1c, 0xcc, 0xa1, 0x1c, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x7a, 0x90, 0x87, 0x7a, 0x28, 0x07, 0x80, 0xa8, 0x87, 0x79, 0x28, + 0x87, 0x36, 0x98, 0x87, 0x77, 0x30, 0x07, 0x7a, 0x68, 0x03, 0x73, 0x60, + 0x87, 0x77, 0x08, 0x07, 0x7a, 0x00, 0xcc, 0x21, 0x1c, 0xd8, 0x61, 0x1e, + 0xca, 0x01, 0xd8, 0x40, 0x10, 0x01, 0xb0, 0x6c, 0x20, 0x0a, 0x01, 0x58, + 0x36, 0x20, 0xc6, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x03, 0x48, 0x40, + 0x05, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x13, 0x86, 0x40, 0x18, 0x26, 0x0c, 0x44, 0x61, 0x00, 0x00, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x48, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, + 0x08, 0x81, 0x70, 0x94, 0x34, 0x45, 0x94, 0x30, 0xf9, 0xff, 0x44, 0x5c, + 0x13, 0x15, 0x11, 0xbf, 0x3d, 0xfc, 0xd3, 0x18, 0x01, 0x30, 0x88, 0x40, + 0x04, 0x17, 0x49, 0x53, 0x44, 0x09, 0x93, 0xff, 0x4b, 0x00, 0xf3, 0x2c, + 0x44, 0xf4, 0x4f, 0x63, 0x04, 0xc0, 0x20, 0x82, 0x21, 0x14, 0x23, 0x04, + 0x31, 0xca, 0x21, 0x34, 0x47, 0x10, 0xcc, 0x11, 0x80, 0xc1, 0x30, 0x82, + 0xb0, 0x14, 0x24, 0x94, 0x23, 0x14, 0x53, 0x80, 0xda, 0x40, 0xc0, 0x1c, + 0x01, 0x28, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, + 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, + 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, + 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, + 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, + 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, + 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, + 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, + 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, + 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, + 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, + 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, + 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0x30, 0x84, 0x49, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, + 0xc2, 0x38, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x81, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x10, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x5a, + 0x25, 0x30, 0x02, 0x50, 0x20, 0x05, 0x51, 0x04, 0x65, 0x50, 0x08, 0x04, + 0x47, 0x00, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, + 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, + 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, + 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, + 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, + 0x65, 0x88, 0xf0, 0x00, 0x43, 0x8c, 0x45, 0x58, 0x8a, 0x65, 0x60, 0xd1, + 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0x79, 0x86, 0x45, 0x58, 0x84, 0x65, + 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, + 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, + 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x78, 0x0a, 0x72, 0x61, 0x69, 0x72, + 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, + 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x43, 0x84, 0xe7, 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, + 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, + 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, + 0x91, 0xa5, 0xcd, 0x85, 0x89, 0xb1, 0x95, 0x0d, 0x11, 0x9e, 0x84, 0x61, + 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, + 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, + 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0x78, + 0x16, 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, + 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, + 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0x9e, 0x66, + 0x19, 0x1e, 0xe7, 0x79, 0x86, 0x08, 0x0f, 0x44, 0x26, 0x2c, 0x4d, 0xce, + 0x05, 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, + 0x9c, 0xcb, 0x58, 0x99, 0x1b, 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, + 0x17, 0xb7, 0xb7, 0x2f, 0xb8, 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, + 0x34, 0xbb, 0x32, 0x32, 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, +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 0x25, 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, + 0xaf, 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, + 0x1e, 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, + 0x5e, 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, 0xb0, 0x18, 0x8f, 0xf7, + 0x7c, 0x0b, 0xf1, 0x80, 0xc1, 0x32, 0x2c, 0xc2, 0x13, 0x06, 0x8f, 0x18, + 0x2c, 0xc4, 0x33, 0x06, 0x0b, 0xf1, 0x38, 0xcf, 0xf3, 0x54, 0x0f, 0x19, + 0x70, 0x09, 0x4b, 0x93, 0x73, 0xa1, 0x2b, 0xc3, 0xa3, 0xab, 0x93, 0x2b, + 0xa3, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, 0x46, + 0x8c, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x4c, 0x86, 0x8c, 0xc7, 0x8c, + 0xed, 0x2d, 0x8c, 0x8e, 0x05, 0x64, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0xcc, + 0x87, 0x03, 0x5d, 0x19, 0xde, 0x10, 0x6a, 0x39, 0x1e, 0x33, 0x78, 0xc0, + 0x60, 0x19, 0x16, 0xe1, 0x39, 0x83, 0xc7, 0x79, 0xd0, 0xe0, 0xa9, 0x9e, + 0x34, 0xe0, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, + 0x26, 0xc7, 0x63, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, + 0x10, 0x69, 0x41, 0x9e, 0x35, 0x78, 0xc0, 0x60, 0x19, 0x16, 0xe1, 0x71, + 0x1e, 0x36, 0x78, 0xaa, 0xa7, 0x0d, 0x86, 0x28, 0xcf, 0xf5, 0x74, 0x4f, + 0x19, 0x3c, 0x6a, 0xf0, 0xb8, 0xc1, 0x10, 0x23, 0x01, 0x9e, 0xe8, 0x79, + 0x03, 0x3e, 0x6f, 0x6d, 0x6e, 0x69, 0x70, 0x6f, 0x74, 0x65, 0x6e, 0x74, + 0x20, 0x63, 0x68, 0x61, 0x72, 0x7c, 0xa6, 0xd2, 0xda, 0xe0, 0xd8, 0xca, + 0x40, 0x86, 0x56, 0x56, 0x40, 0xa8, 0x84, 0x82, 0x82, 0x86, 0x08, 0x8f, + 0x1c, 0x0c, 0x31, 0x9e, 0x38, 0x78, 0xe6, 0x00, 0x4a, 0x86, 0x18, 0x0f, + 0x1d, 0x3c, 0x74, 0x00, 0x25, 0x23, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x48, 0x07, 0x72, 0x28, 0x07, 0x77, 0xa0, 0x87, 0x29, 0x41, + 0x30, 0x62, 0x09, 0x87, 0x74, 0x90, 0x07, 0x37, 0xb0, 0x87, 0x72, 0x90, + 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x81, 0x30, 0x82, 0x0a, + 0x87, 0x74, 0x90, 0x07, 0x37, 0x60, 0x87, 0x70, 0x70, 0x87, 0x73, 0xa8, + 0x87, 0x70, 0x38, 0x87, 0x72, 0xf8, 0x05, 0x7b, 0x28, 0x07, 0x79, 0x98, + 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x12, 0x10, 0x23, 0xa6, 0x70, 0x48, + 0x07, 0x79, 0x70, 0x83, 0x71, 0x78, 0x87, 0x76, 0x80, 0x87, 0x74, 0x60, + 0x87, 0x72, 0xf8, 0x85, 0x77, 0x80, 0x07, 0x7a, 0x48, 0x87, 0x77, 0x70, + 0x87, 0x79, 0x98, 0x42, 0x18, 0x88, 0xc2, 0x8c, 0x60, 0xc2, 0x21, 0x1d, + 0xe4, 0xc1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xe1, 0x1c, 0xda, 0xa1, 0x1c, + 0xdc, 0x81, 0x1e, 0xa6, 0x04, 0x70, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, 0xc4, 0xe1, 0x1c, 0x66, + 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, 0x8c, 0x42, 0x80, 0x07, + 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, 0x00, 0x0f, 0xed, 0x10, + 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, 0xc2, 0xc1, 0x1d, 0xce, + 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, 0x38, 0x84, 0x83, 0x1b, + 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, 0x3d, 0xcc, 0x78, 0x8c, + 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, 0x87, 0x70, 0x70, 0x07, + 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, 0x87, 0x19, 0xcc, 0x11, + 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, 0x30, 0x0f, 0xe3, 0xf0, + 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, 0xde, 0x21, 0x1c, 0xd8, + 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, 0x3b, 0xbc, 0x83, 0x3b, + 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, 0x3c, 0x84, 0x03, 0x3b, + 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x68, 0x87, + 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, 0x87, 0x70, 0x60, 0x07, + 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, 0x87, 0x77, 0x80, 0x87, + 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, 0x87, 0x79, 0x98, 0x81, + 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, 0xc0, 0x0e, 0xec, 0x30, + 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xcc, 0xa1, 0x1c, 0xe4, + 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, 0xc4, 0x81, 0x1d, 0xca, + 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, 0x39, 0x98, 0x43, 0x39, + 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, 0x38, 0x88, 0x03, 0x3b, + 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, 0x3b, 0xd4, 0x03, 0x3b, + 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, 0x87, 0x72, 0x70, 0x83, + 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, 0x87, 0x74, 0xa0, 0x87, + 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, 0x50, 0x0e, 0xe4, 0x90, + 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, 0x50, 0x0e, 0x33, 0x20, + 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, 0xd2, 0x21, 0x1c, 0xdc, + 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, 0xea, 0x01, 0x1e, 0x66, + 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, 0x3b, 0xcc, 0x50, 0x24, + 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, 0x87, 0x77, 0x78, 0x07, + 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, 0x50, 0x0e, 0x00, 0x00, + 0x71, 0x20, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x06, 0x10, 0xb1, 0x5d, + 0xf9, 0x73, 0xce, 0x83, 0xfd, 0x45, 0x04, 0x18, 0x0c, 0xd1, 0x4c, 0x16, + 0xb0, 0x01, 0x48, 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, 0xd7, + 0x44, 0x45, 0xc4, 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x0d, 0x00, 0x00, + 0x61, 0x20, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, + 0x10, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0xc4, 0x46, 0x00, 0x48, + 0xd5, 0xc0, 0x08, 0x00, 0x81, 0x11, 0x00, 0x00, 0x23, 0x06, 0x8a, 0x10, + 0x48, 0x46, 0x81, 0x0c, 0x84, 0x10, 0x10, 0x52, 0x2c, 0x10, 0xe4, 0x93, + 0x41, 0x40, 0x0c, 0x00, 0x02, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x20, 0xa8, + 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x74, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0x42, 0x43, 0xc0, 0xde, 0x21, 0x0c, 0x00, 0x00, 0x9a, 0x03, 0x00, 0x00, + 0x0b, 0x82, 0x20, 0x00, 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, + 0x07, 0x81, 0x23, 0x91, 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, + 0x92, 0x01, 0x84, 0x0c, 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, + 0x80, 0x14, 0x45, 0x02, 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, + 0x38, 0x08, 0x18, 0x49, 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, + 0x23, 0xc4, 0x52, 0x80, 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, + 0x11, 0x62, 0xa8, 0xa0, 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, + 0x51, 0x18, 0x00, 0x00, 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, + 0x16, 0xa0, 0xda, 0x60, 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, + 0x80, 0x05, 0xa8, 0x36, 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, + 0xc0, 0x00, 0x12, 0x31, 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, + 0x40, 0x0f, 0xec, 0x90, 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, + 0x40, 0x0e, 0xe5, 0x40, 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, + 0x40, 0x0e, 0xe5, 0xd0, 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, + 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, + 0x39, 0x84, 0x03, 0x3b, 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, + 0x3c, 0x84, 0x83, 0x38, 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, +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x10, 0x0e, 0xe6, 0x50, 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, + 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, + 0x40, 0xd4, 0xc3, 0x3c, 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, + 0x3d, 0xb4, 0x81, 0x39, 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, + 0x10, 0x0e, 0xec, 0x30, 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff, + 0xff, 0xff, 0xff, 0x07, 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, + 0xc6, 0x81, 0x1e, 0xd8, 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, + 0xdc, 0x81, 0x1c, 0xca, 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, + 0xd2, 0x81, 0x1c, 0xca, 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, + 0x87, 0x79, 0x08, 0x07, 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, + 0x87, 0x74, 0x60, 0x87, 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, + 0x07, 0xc0, 0x1c, 0xc2, 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, + 0xca, 0x61, 0x1e, 0xe6, 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, + 0xd2, 0x61, 0x1e, 0xca, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, + 0xc8, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, + 0x87, 0x36, 0x30, 0x07, 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, + 0x87, 0x77, 0x48, 0x07, 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, + 0x07, 0x76, 0x48, 0x87, 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, + 0x80, 0xc1, 0x1d, 0xde, 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, + 0xca, 0xa1, 0x0d, 0xe0, 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, + 0xe4, 0xa1, 0x0d, 0xca, 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, + 0xde, 0xc1, 0x1d, 0xda, 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, + 0xdc, 0xe1, 0x1d, 0xda, 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, + 0xcc, 0x01, 0x1e, 0xda, 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, + 0x07, 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, + 0x87, 0x70, 0x70, 0x87, 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, + 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, + 0x00, 0xc2, 0x1d, 0xde, 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, + 0xca, 0x81, 0x1c, 0xda, 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, + 0xda, 0xc0, 0x1c, 0xe0, 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, + 0x00, 0x73, 0x08, 0x07, 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, + 0x87, 0x70, 0x18, 0x87, 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, + 0x87, 0x72, 0x18, 0x07, 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, + 0x07, 0x73, 0x30, 0x87, 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, + 0x87, 0x72, 0x00, 0xf0, 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, + 0xca, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, + 0xe4, 0xa1, 0x1c, 0xe6, 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, + 0x03, 0x80, 0xa8, 0x07, 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, + 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, + 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, + 0xda, 0x60, 0x1e, 0xde, 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, + 0xde, 0x21, 0x1c, 0xe8, 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, + 0x07, 0x60, 0x03, 0x61, 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, + 0x80, 0x20, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, + 0x06, 0x22, 0xf9, 0xff, 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, + 0x49, 0x18, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, + 0x88, 0x09, 0x41, 0x31, 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, + 0x89, 0x20, 0x00, 0x00, 0x31, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, + 0x20, 0x64, 0x85, 0x04, 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, + 0x84, 0xa1, 0x90, 0x14, 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, + 0x10, 0x78, 0x33, 0x00, 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, + 0x08, 0x81, 0x30, 0x8c, 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, + 0x2f, 0xbb, 0x6f, 0x47, 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, + 0x11, 0x0a, 0xe1, 0x28, 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, + 0x26, 0x2a, 0x22, 0x7e, 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, + 0x08, 0x4e, 0x93, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x9f, 0x88, 0x6b, 0xa2, + 0x22, 0xe2, 0xb7, 0x87, 0x1f, 0x88, 0x22, 0x00, 0xfb, 0xa7, 0x31, 0x02, + 0x60, 0x10, 0x21, 0x09, 0x2e, 0x92, 0xa6, 0x88, 0x12, 0x26, 0xff, 0x97, + 0x00, 0xe6, 0x59, 0x88, 0xe8, 0x9f, 0xc6, 0x08, 0x80, 0x41, 0x84, 0x45, + 0x28, 0x48, 0x08, 0x62, 0x18, 0xa4, 0x18, 0xb5, 0x32, 0x00, 0x42, 0xe8, + 0xcd, 0x11, 0x80, 0xc1, 0x1c, 0x41, 0x30, 0x8c, 0x20, 0x44, 0x25, 0x09, + 0x8a, 0x89, 0x28, 0xa7, 0x04, 0x44, 0x0b, 0x12, 0x10, 0x13, 0x72, 0x4a, + 0x40, 0x76, 0x20, 0x60, 0x18, 0x61, 0x88, 0x86, 0x11, 0x88, 0x68, 0x8e, + 0x00, 0x14, 0x06, 0x11, 0x08, 0x61, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x13, 0xb2, 0x70, 0x48, 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, + 0x80, 0x07, 0x78, 0x60, 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, + 0x78, 0x87, 0x79, 0xc0, 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, + 0x70, 0x03, 0x38, 0xd8, 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, + 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x6d, 0x90, 0x0e, 0x71, 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, + 0xe9, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, + 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, + 0x6d, 0x90, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x6d, 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, + 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, + 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, + 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, + 0x7a, 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, + 0x72, 0x40, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, + 0x6d, 0x60, 0x0f, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, + 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, + 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, + 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, + 0x79, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, + 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, + 0xf6, 0x10, 0x07, 0x79, 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, + 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, + 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, + 0x76, 0xd0, 0x06, 0xf6, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, + 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, + 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, + 0x74, 0xa0, 0x07, 0x71, 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, + 0x78, 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, + 0x72, 0x80, 0x07, 0x6d, 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, + 0x7a, 0x30, 0x07, 0x72, 0x30, 0x84, 0x71, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0xc2, 0x40, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0c, 0x61, 0x2a, 0x20, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x86, 0x30, 0x17, 0x10, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x59, 0x20, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, + 0x19, 0x11, 0x4c, 0x90, 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x8a, + 0x23, 0x00, 0x25, 0x50, 0x20, 0x05, 0x18, 0x50, 0x10, 0x45, 0x50, 0x06, + 0x05, 0x54, 0x60, 0x85, 0x50, 0x0a, 0xc5, 0x40, 0x7b, 0x04, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x15, 0x01, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, + 0xd7, 0x20, 0x08, 0x0e, 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, + 0xc4, 0xae, 0x4c, 0x6e, 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, + 0x25, 0x06, 0x04, 0xa5, 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, + 0x07, 0x46, 0xc6, 0x25, 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x80, 0x01, + 0x43, 0x8c, 0xa8, 0x88, 0x90, 0x88, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, + 0x36, 0x04, 0xc1, 0x86, 0xa8, 0x88, 0x8a, 0x88, 0xe0, 0x16, 0x96, 0x26, + 0xe7, 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, + 0xf6, 0x26, 0xd7, 0x36, 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, + 0x36, 0x44, 0xc0, 0x0a, 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, + 0x70, 0x69, 0x6c, 0x65, 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, + 0x74, 0x68, 0x5f, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x04, 0xec, + 0x60, 0x19, 0x84, 0xa5, 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, + 0x95, 0xb9, 0x98, 0xc9, 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, + 0xc9, 0x7d, 0x99, 0x95, 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85, + 0x89, 0xb1, 0x95, 0x0d, 0x11, 0xb0, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, + 0x32, 0xf6, 0xd6, 0x06, 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, + 0x66, 0x57, 0xf6, 0x45, 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, + 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xc0, 0x16, 0x46, 0x61, 0x69, + 0x72, 0x2e, 0x72, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, + 0x67, 0x65, 0x74, 0x8c, 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, + 0xe8, 0xf2, 0xe0, 0xca, 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, + 0xbd, 0x85, 0xd1, 0xd1, 0x0c, 0x41, 0xb0, 0x26, 0x22, 0x30, 0x07, 0x7b, + 0x86, 0x08, 0x18, 0x44, 0x26, 0x2c, 0x4d, 0xce, 0x05, 0xee, 0x6d, 0x2e, + 0x8d, 0x2e, 0xed, 0xcd, 0x8d, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x58, 0x99, + 0x1b, 0x5d, 0x99, 0x1c, 0xa5, 0xb0, 0x34, 0x39, 0x17, 0xb7, 0xb7, 0x2f, + 0xb8, 0x32, 0xb9, 0x39, 0xb8, 0xb2, 0x31, 0xba, 0x34, 0xbb, 0x32, 0x32, + 0x61, 0x69, 0x72, 0x2e, 0x61, 0x72, 0x67, 0x5f, 0x6e, 0x61, 0x6d, 0x65, + 0x44, 0xe0, 0xde, 0xe6, 0xd2, 0xe8, 0xd2, 0xde, 0xdc, 0x86, 0x40, 0x11, + 0x81, 0x49, 0xd8, 0x84, 0x51, 0x98, 0x83, 0x3d, 0x58, 0x85, 0x59, 0x94, + 0xc2, 0xd2, 0xe4, 0x5c, 0xcc, 0xe4, 0xc2, 0xce, 0xda, 0xca, 0xdc, 0xe8, + 0xbe, 0xd2, 0xdc, 0xe0, 0xea, 0xe8, 0x98, 0x9d, 0x95, 0xb9, 0x95, 0xc9, + 0x85, 0xd1, 0x95, 0x91, 0xa1, 0xe0, 0xd0, 0x95, 0xe1, 0x8d, 0xbd, 0xbd, + 0xc9, 0x91, 0x11, 0xd9, 0xc9, 0x7c, 0x99, 0xa5, 0xf0, 0x09, 0x4b, 0x93, + 0x73, 0x81, 0x2b, 0x93, 0x9b, 0x83, 0x2b, 0x1b, 0xa3, 0x4b, 0xb3, 0x2b, + 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x27, 0x43, 0x84, 0xae, 0x0c, 0x6f, + 0xec, 0xed, 0x4d, 0x8e, 0x6c, 0x88, 0x14, 0x15, 0x18, 0x86, 0x65, 0xd8, + 0x84, 0x69, 0x98, 0x83, 0x6d, 0x58, 0x85, 0x71, 0x54, 0xc2, 0xd2, 0xe4, + 0x5c, 0xc4, 0xea, 0xcc, 0xcc, 0xca, 0xe4, 0xf8, 0x84, 0xa5, 0xc9, 0xb9, + 0x88, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0xcd, 0xa5, 0xe9, 0x95, 0x51, + 0x0a, 0x4b, 0x93, 0x73, 0x61, 0x7b, 0x1b, 0x0b, 0xa3, 0x4b, 0x7b, 0x73, + 0xfb, 0x4a, 0x73, 0x23, 0x2b, 0xc3, 0x23, 0x12, 0x96, 0x26, 0xe7, 0x22, + 0x57, 0x16, 0x46, 0xc6, 0x28, 0x2c, 0x4d, 0xce, 0x25, 0x4c, 0xee, 0xec, + 0x8b, 0x2e, 0x0f, 0xae, 0xec, 0x6b, 0x2e, 0x4d, 0xaf, 0x8c, 0x57, 0x58, + 0x9a, 0x9c, 0x4b, 0x98, 0xdc, 0xd9, 0x17, 0x5d, 0x1e, 0x5c, 0xd9, 0x57, + 0x18, 0x5b, 0xda, 0x99, 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0x87, 0xb1, + 0x37, 0xb6, 0x21, 0x60, 0x10, 0x25, 0x98, 0x87, 0x7d, 0x91, 0x81, 0x81, + 0x41, 0x44, 0x44, 0x05, 0x16, 0x06, 0x98, 0x18, 0x44, 0x06, 0x36, 0x06, + 0x91, 0x81, 0x39, 0xd8, 0x83, 0x55, 0x18, 0x19, 0x90, 0x0a, 0x4b, 0x93, + 0x73, 0x99, 0xa3, 0x93, 0xab, 0x1b, 0xa3, 0xfb, 0xa2, 0xcb, 0x83, 0x2b, + 0xfb, 0x4a, 0x73, 0x33, 0x7b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x37, + 0x43, 0xe3, 0xcd, 0xcc, 0x6c, 0xae, 0x8c, 0x8e, 0x86, 0xd4, 0xd8, 0x5b, + 0x99, 0x99, 0x19, 0x8d, 0xa3, 0xb1, 0xb7, 0x32, 0x33, 0x33, 0x1a, 0x42, + 0x63, 0x6f, 0x65, 0x66, 0x66, 0x43, 0xd0, 0x20, 0x22, 0x22, 0x23, 0x22, + 0xb0, 0x33, 0xc0, 0xd0, 0x20, 0x32, 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, + 0xd2, 0x20, 0x5a, 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd4, 0x20, 0x62, + 0x22, 0x23, 0x22, 0xb0, 0x33, 0xc0, 0xd6, 0x80, 0x49, 0x56, 0x95, 0x15, + 0x51, 0xd9, 0xd8, 0x1b, 0x59, 0x19, 0x0d, 0xb2, 0xb2, 0xb1, 0x37, 0xb2, + 0xb2, 0x21, 0x64, 0x10, 0x29, 0x98, 0x87, 0x7d, 0xd1, 0x81, 0x81, 0x41, + 0x54, 0x44, 0x05, 0x16, 0x06, 0x98, 0x19, 0x60, 0x6c, 0x80, 0x89, 0x41, + 0x74, 0x60, 0x63, 0x10, 0x19, 0x98, 0x83, 0xb5, 0x01, 0x56, 0x61, 0x6e, + 0xc0, 0x25, 0x2c, 0x4d, 0xce, 0x85, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, + 0x8c, 0x4a, 0x58, 0x9a, 0x9c, 0xcb, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x19, + 0x31, 0xba, 0x32, 0x3c, 0xba, 0x3a, 0xb9, 0x32, 0x19, 0x32, 0x1e, 0x33, + 0xb6, 0xb7, 0x30, 0x3a, 0x16, 0x90, 0xb9, 0xb0, 0x36, 0x38, 0xb6, 0x32, + 0x1f, 0x12, 0x74, 0x65, 0x78, 0x59, 0x43, 0xa8, 0xa8, 0xc1, 0xe0, 0x00, + 0x03, 0x83, 0x88, 0x88, 0x0a, 0x2c, 0x0e, 0x30, 0x07, 0x93, 0x03, 0xac, + 0xc2, 0xe6, 0x80, 0x1e, 0x5d, 0x19, 0x1e, 0x5d, 0x9d, 0x5c, 0x99, 0x0c, + 0xd9, 0x57, 0x98, 0x9c, 0x5c, 0x58, 0x1e, 0x8f, 0x19, 0xdb, 0x5b, 0x18, + 0x1d, 0x0b, 0xc8, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x99, 0x0f, 0x0b, 0xba, + 0x32, 0xbc, 0x2a, 0xab, 0x21, 0x54, 0xe4, 0x60, 0x70, 0x80, 0x81, 0x41, + 0x54, 0x44, 0x05, 0x16, 0x07, 0x98, 0x83, 0xd5, 0x01, 0x56, 0x61, 0x76, + 0xc0, 0x25, 0x2c, 0x4d, 0xce, 0x65, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, + 0x8e, 0xc7, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x99, 0x1c, 0x83, 0xb9, 0x21, + 0x52, 0xf4, 0x60, 0x78, 0x80, 0x81, 0x41, 0x44, 0x44, 0x05, 0xe6, 0x60, + 0x79, 0x80, 0x55, 0x98, 0x1e, 0x0c, 0x71, 0xb0, 0x0b, 0xeb, 0xb0, 0x32, + 0xc0, 0xde, 0x00, 0xa3, 0x03, 0xec, 0x0e, 0xb0, 0x3d, 0x18, 0x62, 0x38, + 0x00, 0x16, 0x61, 0x7c, 0xc0, 0xe7, 0xad, 0xcd, 0x2d, 0x0d, 0xee, 0x8d, + 0xae, 0xcc, 0x8d, 0x0e, 0x64, 0x0c, 0x2d, 0x4c, 0x8e, 0xcf, 0x54, 0x5a, + 0x1b, 0x1c, 0x5b, 0x19, 0xc8, 0xd0, 0xca, 0x0a, 0x08, 0x95, 0x50, 0x50, + 0xd0, 0x10, 0x01, 0xfb, 0x83, 0x21, 0x06, 0xe6, 0x07, 0x18, 0x28, 0x6c, + 0xd0, 0x10, 0x03, 0x0b, 0x05, 0x2c, 0x14, 0x36, 0x68, 0x84, 0xc2, 0x0e, + 0xec, 0x60, 0x0f, 0xed, 0xe0, 0x06, 0xe9, 0x40, 0x0e, 0xe5, 0xe0, 0x0e, + 0xf4, 0x30, 0x25, 0x08, 0x46, 0x2c, 0xe1, 0x90, 0x0e, 0xf2, 0xe0, 0x06, + 0xf6, 0x50, 0x0e, 0xf2, 0x30, 0x0f, 0xe9, 0xf0, 0x0e, 0xee, 0x30, 0x25, + 0x10, 0x46, 0x50, 0xe1, 0x90, 0x0e, 0xf2, 0xe0, 0x06, 0xec, 0x10, 0x0e, + 0xee, 0x70, 0x0e, 0xf5, 0x10, 0x0e, 0xe7, 0x50, 0x0e, 0xbf, 0x60, 0x0f, + 0xe5, 0x20, 0x0f, 0xf3, 0x90, 0x0e, 0xef, 0xe0, 0x0e, 0x53, 0x02, 0x62, + 0xc4, 0x14, 0x0e, 0xe9, 0x20, 0x0f, 0x6e, 0x30, 0x0e, 0xef, 0xd0, 0x0e, + 0xf0, 0x90, 0x0e, 0xec, 0x50, 0x0e, 0xbf, 0xf0, 0x0e, 0xf0, 0x40, 0x0f, + 0xe9, 0xf0, 0x0e, 0xee, 0x30, 0x0f, 0x53, 0x08, 0x03, 0x51, 0x98, 0x11, + 0x4c, 0x38, 0xa4, 0x83, 0x3c, 0xb8, 0x81, 0x39, 0xc8, 0x43, 0x38, 0x9c, + 0x43, 0x3b, 0x94, 0x83, 0x3b, 0xd0, 0xc3, 0x94, 0xa0, 0x0f, 0x00, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, + 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, + 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, + 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, + 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, + 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, + 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, + 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, + 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, + 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, + 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, + 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, + 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, + 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, + 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, + 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, + 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, + 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, + 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, + 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, + 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, + 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, + 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, + 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, + 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, + 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, + 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, + 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, + 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, + 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x26, 0x10, 0x06, 0x00, 0x12, 0xf9, 0x12, 0xc0, 0x3c, 0x0b, 0xf1, 0x4f, + 0xc4, 0x35, 0x51, 0x11, 0xf1, 0xdb, 0xc3, 0x0f, 0x44, 0x11, 0x80, 0xf9, + 0x15, 0x5e, 0xdc, 0xb6, 0x05, 0x34, 0x00, 0x12, 0xf9, 0x83, 0x33, 0xf9, + 0xd5, 0x5d, 0xdc, 0xb6, 0x0d, 0x6c, 0x00, 0x12, 0xf9, 0x12, 0xc0, 0x3c, + 0x0b, 0xf1, 0x4f, 0xc4, 0x35, 0x51, 0x11, 0xf1, 0xdb, 0x83, 0x5f, 0xe1, + 0xc5, 0x6d, 0x1b, 0x00, 0xc4, 0x76, 0xe5, 0x2f, 0xbb, 0xef, 0x5f, 0x44, + 0x80, 0xc1, 0x10, 0xcd, 0x04, 0x00, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, + 0x3e, 0x00, 0x00, 0x00, 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, + 0x0b, 0x00, 0x00, 0x00, 0xa4, 0xe7, 0x20, 0x88, 0x22, 0xe1, 0x28, 0xcf, + 0x31, 0x10, 0x1c, 0x37, 0xd6, 0x00, 0x04, 0x02, 0xcd, 0x11, 0x00, 0x8a, + 0x33, 0x00, 0x24, 0x6b, 0x60, 0x04, 0x80, 0xc8, 0x0c, 0x00, 0x85, 0x19, + 0x00, 0x02, 0x63, 0x04, 0x20, 0x08, 0x82, 0xf8, 0x37, 0x02, 0x00, 0x00, + 0x23, 0x06, 0xca, 0x10, 0x80, 0x81, 0xc3, 0x44, 0x06, 0x52, 0x04, 0x23, + 0x06, 0xcb, 0x10, 0x88, 0x81, 0xd3, 0x48, 0x60, 0x70, 0x24, 0x86, 0x30, + 0x86, 0x10, 0x84, 0xc1, 0x20, 0xc3, 0x60, 0x34, 0x73, 0x0c, 0x81, 0x20, + 0x06, 0x23, 0x06, 0xcb, 0x10, 0x98, 0x81, 0x14, 0x59, 0x63, 0xb0, 0x34, + 0x8a, 0x31, 0x86, 0x10, 0x94, 0xc1, 0x1c, 0xc3, 0x10, 0x84, 0xc1, 0x20, + 0x43, 0xc0, 0x4c, 0x87, 0x8d, 0xa5, 0xa0, 0xd8, 0x10, 0xc0, 0x87, 0xb8, + 0x32, 0xc8, 0x20, 0x40, 0xd6, 0x78, 0x43, 0x17, 0x06, 0x6c, 0x70, 0xc1, + 0x58, 0x0a, 0xca, 0x20, 0x43, 0x40, 0x69, 0x23, 0x06, 0x05, 0x11, 0xd0, + 0x41, 0x11, 0xcc, 0x31, 0x58, 0x81, 0x1c, 0x8c, 0x37, 0x8c, 0xc1, 0x19, + 0xb8, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, 0x81, 0x06, 0x06, 0x23, + 0x06, 0x05, 0x11, 0xe8, 0xc1, 0x12, 0xcc, 0x31, 0x18, 0xc1, 0x1d, 0x8c, + 0x37, 0xa4, 0x41, 0x1b, 0xcc, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, + 0x01, 0x18, 0x98, 0xc1, 0x88, 0x41, 0x41, 0x04, 0xa0, 0x10, 0x05, 0x73, + 0x0c, 0x46, 0x90, 0x07, 0x73, 0x0c, 0x81, 0x18, 0xe4, 0x81, 0x05, 0x95, + 0x7c, 0x32, 0x08, 0x88, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x5b, 0x06, 0x26, 0x10, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0xf8, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, + 0x21, 0x0c, 0x00, 0x00, 0x7b, 0x03, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, + 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, + 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, + 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, + 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, + 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, + 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, + 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, 0x16, 0xa0, 0xda, 0x60, + 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, 0x80, 0x05, 0xa8, 0x36, + 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0x00, 0x12, 0x31, + 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xec, 0x90, + 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, 0x40, 0x0e, 0xe5, 0x40, + 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, 0x40, 0x0e, 0xe5, 0xd0, + 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, + 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, 0x39, 0x84, 0x03, 0x3b, + 0xcc, 0x43, 0x39, 0x00, 0x04, 0x39, 0xa4, 0xc3, 0x3c, 0x84, 0x83, 0x38, + 0xb0, 0x43, 0x39, 0xb4, 0x01, 0x3d, 0x84, 0x43, 0x3a, 0xb0, 0x43, 0x1b, + 0x8c, 0x43, 0x38, 0xb0, 0x03, 0x3b, 0xcc, 0x03, 0x60, 0x0e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0xf4, 0x80, + 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, 0x40, 0xd4, 0xc3, 0x3c, + 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, 0x3d, 0xb4, 0x81, 0x39, + 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, 0x10, 0x0e, 0xec, 0x30, + 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff, 0xff, 0xff, 0xff, 0x07, + 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8, + 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca, + 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca, + 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, 0x87, 0x79, 0x08, 0x07, + 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87, + 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2, + 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6, + 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca, + 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07, + 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x30, 0x07, + 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, 0x87, 0x77, 0x48, 0x07, + 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, 0x07, 0x76, 0x48, 0x87, + 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde, + 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0, + 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca, + 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda, + 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, + 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, + 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, + 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87, + 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, + 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, + 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda, + 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87, + 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07, + 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87, + 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0, + 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda, + 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6, + 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07, + 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87, + 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, + 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde, + 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8, + 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, 0x07, 0x60, 0x03, 0x61, + 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, 0x80, 0x20, 0xff, 0xff, + 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, 0x06, 0x22, 0xf9, 0xff, + 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x88, 0x09, 0x41, 0x31, + 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, + 0x28, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, + 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, + 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x68, 0x33, 0x00, + 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, 0x08, 0x81, 0x30, 0x8c, + 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, 0x2f, 0xbb, 0x6f, 0x47, + 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, 0x11, 0x0a, 0xe1, 0x28, + 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, 0x26, 0x2a, 0x22, 0x7e, + 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, 0x08, 0x2e, 0x92, 0xa6, + 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59, 0x88, 0xe8, 0x9f, 0xc6, + 0x08, 0x80, 0x41, 0x84, 0x44, 0x28, 0x48, 0x08, 0x62, 0x18, 0x84, 0x14, + 0xad, 0x32, 0x00, 0x42, 0xa8, 0xcd, 0x11, 0x04, 0x73, 0x04, 0x60, 0x30, + 0x8c, 0x20, 0x40, 0x05, 0x09, 0x48, 0x89, 0x17, 0x1f, 0x20, 0x39, 0x10, + 0x30, 0x8c, 0x30, 0x40, 0xc3, 0x08, 0x04, 0x34, 0x47, 0x00, 0x0a, 0x83, + 0x08, 0x84, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, + 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, + 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, + 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, + 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, + 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, + 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, + 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, + 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, + 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, + 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, + 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, + 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0x30, 0x84, 0x61, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, + 0xc2, 0x38, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x61, + 0x26, 0x20, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb2, 0x40, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, + 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x82, 0x23, 0x00, 0x25, 0x50, + 0x20, 0x05, 0x18, 0x50, 0x10, 0x45, 0x50, 0x06, 0x05, 0x54, 0x60, 0x85, + 0x50, 0x0a, 0xc5, 0x40, 0x77, 0x04, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x0d, 0x01, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, + 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, + 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, + 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, + 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x40, 0x01, 0x43, 0x0c, 0x88, 0x80, + 0x0e, 0x68, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0xa1, 0x06, + 0x88, 0x80, 0x08, 0x68, 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, + 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, + 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x0a, + 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, + 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x04, 0xea, 0x60, 0x19, 0x84, 0xa5, + 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, + 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, + 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85, 0x89, 0xb1, 0x95, 0x0d, + 0x11, 0xa8, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, + 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, + 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, + 0x56, 0x36, 0x44, 0xa0, 0x16, 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, + 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, + 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, + 0xbe, 0xdc, 0xc2, 0xda, 0xca, 0x68, 0x98, 0xb1, 0xbd, 0x85, 0xd1, 0xd1, + 0x0c, 0x41, 0xa8, 0x06, 0x1a, 0x28, 0x87, 0x7a, 0x86, 0x08, 0x14, 0x44, + 0x26, 0x2c, 0x4d, 0xce, 0x05, 0xee, 0x6d, 0x2e, 0x8d, 0x2e, 0xed, 0xcd, + 0x8d, 0x4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xa5, 0xe9, 0x95, 0x51, 0x0a, 0x4b, 0x93, 0x73, + 0x61, 0x7b, 0x1b, 0x0b, 0xa3, 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, + 0x2b, 0xc3, 0x23, 0x12, 0x96, 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, + 0x28, 0x2c, 0x4d, 0xce, 0x25, 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, + 0xec, 0x6b, 0x2e, 0x4d, 0xaf, 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, + 0xdc, 0xd9, 0x17, 0x5d, 0x1e, 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, + 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, + 0x00, 0x21, 0x94, 0x47, 0x7d, 0x50, 0x41, 0x81, 0x01, 0x34, 0x40, 0x04, + 0x15, 0x06, 0x94, 0x18, 0x40, 0x05, 0x35, 0x06, 0x50, 0x41, 0x39, 0xd4, + 0x43, 0x55, 0x14, 0x19, 0x90, 0x0a, 0x4b, 0x93, 0x73, 0x99, 0xa3, 0x93, + 0xab, 0x1b, 0xa3, 0xfb, 0xa2, 0xcb, 0x83, 0x2b, 0xfb, 0x4a, 0x73, 0x33, + 0x7b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x37, 0x43, 0xe3, 0xcd, 0xcc, + 0x6c, 0xae, 0x8c, 0x8e, 0x86, 0xd4, 0xd8, 0x5b, 0x99, 0x99, 0x19, 0x8d, + 0xa3, 0xb1, 0xb7, 0x32, 0x33, 0x33, 0x1a, 0x42, 0x63, 0x6f, 0x65, 0x66, + 0x66, 0x43, 0xd0, 0x00, 0x1a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd0, + 0x00, 0x2a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd2, 0x00, 0x52, 0xa0, + 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd4, 0x00, 0x5a, 0xa0, 0x02, 0x1a, 0xa8, + 0x33, 0xa0, 0xd6, 0x80, 0x49, 0x56, 0x95, 0x15, 0x51, 0xd9, 0xd8, 0x1b, + 0x59, 0x19, 0x0d, 0xb2, 0xb2, 0xb1, 0x37, 0xb2, 0xb2, 0x21, 0x64, 0x00, + 0x25, 0x94, 0x47, 0x7d, 0x90, 0x41, 0x81, 0x01, 0x44, 0x40, 0x04, 0x15, + 0x06, 0x94, 0x19, 0x50, 0x6c, 0x40, 0x89, 0x01, 0x64, 0x50, 0x63, 0x00, + 0x15, 0x94, 0x43, 0xb5, 0x01, 0x55, 0x51, 0x6e, 0xc0, 0x25, 0x2c, 0x4d, + 0xce, 0x85, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x8c, 0x4a, 0x58, 0x9a, + 0x9c, 0xcb, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x19, 0x31, 0xba, 0x32, 0x3c, + 0xba, 0x3a, 0xb9, 0x32, 0x19, 0x32, 0x1e, 0x33, 0xb6, 0xb7, 0x30, 0x3a, + 0x16, 0x90, 0xb9, 0xb0, 0x36, 0x38, 0xb6, 0x32, 0x1f, 0x12, 0x74, 0x65, + 0x78, 0x59, 0x43, 0x28, 0x88, 0xa1, 0xe0, 0x80, 0x02, 0x03, 0x68, 0x80, + 0x08, 0x2a, 0x0e, 0x28, 0x87, 0x92, 0x03, 0xaa, 0xa2, 0xe6, 0x80, 0x05, + 0x5d, 0x19, 0x5e, 0x95, 0xd5, 0x10, 0x0a, 0x6a, 0x28, 0x38, 0xa0, 0xc0, + 0x00, 0x22, 0x20, 0x82, 0x8a, 0x03, 0xca, 0xa1, 0xe4, 0x80, 0xaa, 0xa8, + 0x3a, 0xe0, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, + 0x26, 0xc7, 0x63, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, + 0x10, 0x09, 0x72, 0xa8, 0x3b, 0xa0, 0xc0, 0x00, 0x1a, 0x20, 0x82, 0x72, + 0x28, 0x3c, 0xa0, 0x2a, 0x2a, 0x0f, 0x86, 0x38, 0xd4, 0x45, 0x75, 0x54, + 0x19, 0x50, 0x6f, 0x40, 0xd1, 0x01, 0x65, 0x07, 0x94, 0x1e, 0x0c, 0x31, + 0x18, 0x80, 0x8a, 0xa8, 0x3d, 0xe0, 0xf3, 0xd6, 0xe6, 0x96, 0x06, 0xf7, + 0x46, 0x57, 0xe6, 0x46, 0x07, 0x32, 0x86, 0x16, 0x26, 0xc7, 0x67, 0x2a, + 0xad, 0x0d, 0x8e, 0xad, 0x0c, 0x64, 0x68, 0x65, 0x05, 0x84, 0x4a, 0x28, + 0x28, 0x68, 0x88, 0x40, 0xf9, 0xc1, 0x10, 0x83, 0xea, 0x03, 0xea, 0x0f, + 0xae, 0x67, 0x88, 0x41, 0x81, 0x02, 0x05, 0x0a, 0xd7, 0x33, 0x42, 0x61, + 0x07, 0x76, 0xb0, 0x87, 0x76, 0x70, 0x83, 0x74, 0x20, 0x87, 0x72, 0x70, + 0x07, 0x7a, 0x98, 0x12, 0x04, 0x23, 0x96, 0x70, 0x48, 0x07, 0x79, 0x70, + 0x03, 0x7b, 0x28, 0x07, 0x79, 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, + 0x12, 0x08, 0x23, 0xa8, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x76, 0x08, + 0x07, 0x77, 0x38, 0x87, 0x7a, 0x08, 0x87, 0x73, 0x28, 0x87, 0x5f, 0xb0, + 0x87, 0x72, 0x90, 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x01, + 0x31, 0x62, 0x0a, 0x87, 0x74, 0x90, 0x07, 0x37, 0x18, 0x87, 0x77, 0x68, + 0x07, 0x78, 0x48, 0x07, 0x76, 0x28, 0x87, 0x5f, 0x78, 0x07, 0x78, 0xa0, + 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x87, 0x29, 0x84, 0x81, 0x28, 0xcc, + 0x08, 0x26, 0x1c, 0xd2, 0x41, 0x1e, 0xdc, 0xc0, 0x1c, 0xe4, 0x21, 0x1c, + 0xce, 0xa1, 0x1d, 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0xc0, 0x07, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, + 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, + 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, + 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, + 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, + 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, + 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, + 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, + 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, + 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, + 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, + 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, + 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, + 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, + 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, + 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, + 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, + 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, + 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, + 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, + 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, + 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, + 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, + 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, + 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, + 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, + 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, + 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, + 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, + 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, + 0x16, 0xd0, 0x00, 0x48, 0xe4, 0x0f, 0xce, 0xe4, 0x57, 0x77, 0x71, 0xdb, + 0x26, 0xb0, 0x01, 0x48, 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, + 0xd7, 0x44, 0x45, 0xc4, 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x6d, 0x00, + 0x11, 0xdb, 0x95, 0xff, 0xf9, 0xd6, 0xf6, 0x5f, 0x44, 0x80, 0xc1, 0x10, + 0xcd, 0x04, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, 0x3a, 0x00, 0x00, 0x00, + 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x64, 0xe7, 0x20, 0x06, 0x02, 0xe9, 0xa8, 0x8e, 0x35, 0x00, 0x03, 0x31, + 0xc7, 0x30, 0x10, 0xdd, 0x1c, 0xc3, 0xd0, 0x75, 0xf4, 0x6a, 0x60, 0x04, + 0x80, 0xe0, 0x0c, 0x00, 0xc5, 0x11, 0x00, 0xaa, 0x63, 0x0d, 0x40, 0x20, + 0x10, 0x99, 0x01, 0xa0, 0x30, 0x03, 0x40, 0x60, 0x8c, 0x00, 0x04, 0x41, + 0x10, 0xff, 0x46, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x06, 0xca, 0x10, + 0x88, 0x01, 0xe4, 0x4c, 0x89, 0x81, 0x04, 0x23, 0x06, 0xca, 0x10, 0x8c, + 0x01, 0xf4, 0x50, 0xca, 0x91, 0x08, 0x83, 0x0c, 0x42, 0xc1, 0x0c, 0x32, + 0x08, 0x86, 0x33, 0xc8, 0x20, 0x04, 0xd0, 0x20, 0x43, 0x90, 0x48, 0x77, + 0x8d, 0xa5, 0xa0, 0xd8, 0x10, 0xc0, 0x87, 0xb6, 0x32, 0xc8, 0x20, 0x34, + 0xcf, 0x78, 0x03, 0x07, 0x06, 0x6b, 0x70, 0xc1, 0x58, 0x0a, 0xca, 0x20, + 0x43, 0x10, 0x4d, 0x23, 0x06, 0x05, 0x11, 0xc8, 0x41, 0x11, 0xcc, 0x31, + 0x4c, 0x41, 0x1c, 0x8c, 0x37, 0x88, 0x81, 0x19, 0xb4, 0xc1, 0x05, 0x63, + 0x29, 0x28, 0x83, 0x0c, 0xc1, 0x95, 0x8d, 0x18, 0x14, 0x44, 0x80, 0x07, + 0x4b, 0x30, 0xc7, 0x60, 0x04, 0x76, 0x30, 0xde, 0x80, 0x06, 0x6c, 0x20, + 0x07, 0x17, 0x8c, 0xa5, 0xa0, 0x0c, 0x32, 0x04, 0xdd, 0x37, 0x62, 0x50, + 0x10, 0x81, 0x1f, 0x44, 0xc1, 0x1c, 0x83, 0x11, 0xe0, 0xc1, 0x1c, 0x43, + 0xf0, 0xe1, 0x81, 0x05, 0x95, 0x7c, 0x32, 0x08, 0x88, 0x01, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x5b, 0x86, 0x24, 0x08, 0x05, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xde, 0xc0, 0x17, 0x0b, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, + 0x00, 0x0e, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x42, 0x43, 0xc0, 0xde, + 0x21, 0x0c, 0x00, 0x00, 0x7d, 0x03, 0x00, 0x00, 0x0b, 0x82, 0x20, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x12, 0x00, 0x00, 0x00, 0x07, 0x81, 0x23, 0x91, + 0x41, 0xc8, 0x04, 0x49, 0x06, 0x10, 0x32, 0x39, 0x92, 0x01, 0x84, 0x0c, + 0x25, 0x05, 0x08, 0x19, 0x1e, 0x04, 0x8b, 0x62, 0x80, 0x14, 0x45, 0x02, + 0x42, 0x92, 0x0b, 0x42, 0xa4, 0x10, 0x32, 0x14, 0x38, 0x08, 0x18, 0x49, + 0x0a, 0x32, 0x44, 0x24, 0x48, 0x0a, 0x90, 0x21, 0x23, 0xc4, 0x52, 0x80, + 0x0c, 0x19, 0x21, 0x72, 0x24, 0x07, 0xc8, 0x48, 0x11, 0x62, 0xa8, 0xa0, + 0xa8, 0x40, 0xc6, 0xf0, 0x01, 0x00, 0x00, 0x00, 0x51, 0x18, 0x00, 0x00, + 0x03, 0x01, 0x00, 0x00, 0x1b, 0x8c, 0x60, 0x00, 0x16, 0xa0, 0xda, 0x60, + 0x08, 0x04, 0xb0, 0x00, 0xd5, 0x06, 0x63, 0x38, 0x80, 0x05, 0xa8, 0x36, + 0x90, 0x0b, 0xf1, 0xff, 0xff, 0xff, 0xff, 0x03, 0xc0, 0x00, 0x12, 0x31, + 0x0e, 0xef, 0x20, 0x0f, 0xf2, 0x50, 0x0e, 0xe3, 0x40, 0x0f, 0xec, 0x90, + 0x0f, 0x6d, 0x20, 0x0f, 0xef, 0x50, 0x0f, 0xee, 0x40, 0x0e, 0xe5, 0x40, + 0x0e, 0x6d, 0x40, 0x0e, 0xe9, 0x60, 0x0f, 0xe9, 0x40, 0x0e, 0xe5, 0xd0, + 0x06, 0xf3, 0x10, 0x0f, 0xf2, 0x40, 0x0f, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, + 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x80, 0x39, 0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03, 0x3d, + 0xd4, 0x83, 0x3c, 0x94, 0xc3, 0x3c, 0x00, 0x6d, 0x60, 0x0e, 0xf0, 0x10, + 0x07, 0x76, 0x00, 0x10, 0xf5, 0xe0, 0x0e, 0xf3, 0x10, 0x0e, 0xe6, 0x50, + 0x0e, 0x6d, 0x60, 0x0e, 0xf0, 0xd0, 0x06, 0xed, 0x10, 0x0e, 0xf4, 0x80, + 0x0e, 0x00, 0x3d, 0xc8, 0x43, 0x3d, 0x94, 0x03, 0x40, 0xd4, 0xc3, 0x3c, + 0x94, 0x43, 0x1b, 0xcc, 0xc3, 0x3b, 0x98, 0x03, 0x3d, 0xb4, 0x81, 0x39, + 0xb0, 0xc3, 0x3b, 0x84, 0x03, 0x3d, 0x00, 0xe6, 0x10, 0x0e, 0xec, 0x30, + 0x0f, 0xe5, 0x00, 0x6c, 0x50, 0x95, 0xe2, 0xff, 0xff, 0xff, 0xff, 0x07, + 0x62, 0x1c, 0xde, 0x41, 0x1e, 0xe4, 0xa1, 0x1c, 0xc6, 0x81, 0x1e, 0xd8, + 0x21, 0x1f, 0xda, 0x40, 0x1e, 0xde, 0xa1, 0x1e, 0xdc, 0x81, 0x1c, 0xca, + 0x81, 0x1c, 0xda, 0x80, 0x1c, 0xd2, 0xc1, 0x1e, 0xd2, 0x81, 0x1c, 0xca, + 0xa1, 0x0d, 0xe6, 0x21, 0x1e, 0xe4, 0x81, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x08, 0x72, 0x48, 0x87, 0x79, 0x08, 0x07, + 0x71, 0x60, 0x87, 0x72, 0x68, 0x03, 0x7a, 0x08, 0x87, 0x74, 0x60, 0x87, + 0x36, 0x18, 0x87, 0x70, 0x60, 0x07, 0x76, 0x98, 0x07, 0xc0, 0x1c, 0xc2, + 0x81, 0x1d, 0xe6, 0xa1, 0x1c, 0x00, 0x82, 0x1d, 0xca, 0x61, 0x1e, 0xe6, + 0xa1, 0x0d, 0xe0, 0x41, 0x1e, 0xca, 0x61, 0x1c, 0xd2, 0x61, 0x1e, 0xca, + 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, 0x21, 0x1c, 0xc8, 0x01, 0xa0, 0x07, + 0x79, 0xa8, 0x87, 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x30, 0x07, + 0x79, 0x08, 0x87, 0x76, 0x28, 0x87, 0x36, 0x80, 0x87, 0x77, 0x48, 0x07, + 0x77, 0xa0, 0x87, 0x72, 0x90, 0x87, 0x36, 0x28, 0x07, 0x76, 0x48, 0x87, + 0x76, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x80, 0xc1, 0x1d, 0xde, + 0xa1, 0x0d, 0xcc, 0x41, 0x1e, 0xc2, 0xa1, 0x1d, 0xca, 0xa1, 0x0d, 0xe0, + 0xe1, 0x1d, 0xd2, 0xc1, 0x1d, 0xe8, 0xa1, 0x1c, 0xe4, 0xa1, 0x0d, 0xca, + 0x81, 0x1d, 0xd2, 0xa1, 0x1d, 0xda, 0xc0, 0x1d, 0xde, 0xc1, 0x1d, 0xda, + 0x80, 0x1d, 0xca, 0x21, 0x1c, 0xcc, 0x01, 0x20, 0xdc, 0xe1, 0x1d, 0xda, + 0x20, 0x1d, 0xdc, 0xc1, 0x1c, 0xe6, 0xa1, 0x0d, 0xcc, 0x01, 0x1e, 0xda, + 0xa0, 0x1d, 0xc2, 0x81, 0x1e, 0xd0, 0x01, 0xa0, 0x07, 0x79, 0xa8, 0x87, + 0x72, 0x00, 0x08, 0x77, 0x78, 0x87, 0x36, 0x70, 0x87, 0x70, 0x70, 0x87, + 0x79, 0x68, 0x03, 0x73, 0x80, 0x87, 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, + 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, 0xa1, 0x1c, 0x00, 0xc2, 0x1d, 0xde, + 0xa1, 0x0d, 0xe6, 0x21, 0x1d, 0xce, 0xc1, 0x1d, 0xca, 0x81, 0x1c, 0xda, + 0x40, 0x1f, 0xca, 0x41, 0x1e, 0xde, 0x61, 0x1e, 0xda, 0xc0, 0x1c, 0xe0, + 0xa1, 0x0d, 0xda, 0x21, 0x1c, 0xe8, 0x01, 0x1d, 0x00, 0x73, 0x08, 0x07, + 0x76, 0x98, 0x87, 0x72, 0x00, 0x88, 0x79, 0xa0, 0x87, 0x70, 0x18, 0x87, + 0x75, 0x68, 0x03, 0x78, 0x90, 0x87, 0x77, 0xa0, 0x87, 0x72, 0x18, 0x07, + 0x7a, 0x78, 0x07, 0x79, 0x68, 0x03, 0x71, 0xa8, 0x07, 0x73, 0x30, 0x87, + 0x72, 0x90, 0x87, 0x36, 0x98, 0x87, 0x74, 0xd0, 0x87, 0x72, 0x00, 0xf0, + 0x00, 0x20, 0xe8, 0x21, 0x1c, 0xe4, 0xe1, 0x1c, 0xca, 0x81, 0x1e, 0xda, + 0xc0, 0x1c, 0xca, 0x21, 0x1c, 0xe8, 0xa1, 0x1e, 0xe4, 0xa1, 0x1c, 0xe6, + 0x01, 0x68, 0x03, 0x73, 0x80, 0x87, 0x38, 0xb0, 0x03, 0x80, 0xa8, 0x07, + 0x77, 0x98, 0x87, 0x70, 0x30, 0x87, 0x72, 0x68, 0x03, 0x73, 0x80, 0x87, + 0x36, 0x68, 0x87, 0x70, 0xa0, 0x07, 0x74, 0x00, 0xe8, 0x41, 0x1e, 0xea, + 0xa1, 0x1c, 0x00, 0xa2, 0x1e, 0xe6, 0xa1, 0x1c, 0xda, 0x60, 0x1e, 0xde, + 0xc1, 0x1c, 0xe8, 0xa1, 0x0d, 0xcc, 0x81, 0x1d, 0xde, 0x21, 0x1c, 0xe8, + 0x01, 0x30, 0x87, 0x70, 0x60, 0x87, 0x79, 0x28, 0x07, 0x60, 0x03, 0x61, + 0x04, 0xc0, 0xb2, 0x81, 0x38, 0x04, 0x60, 0xd9, 0x80, 0x20, 0xff, 0xff, + 0xff, 0xff, 0x3f, 0x00, 0x0c, 0x20, 0x01, 0xd5, 0x06, 0x22, 0xf9, 0xff, + 0xff, 0xff, 0xff, 0x01, 0x90, 0x00, 0x00, 0x00, 0x49, 0x18, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x13, 0x88, 0x40, 0x18, 0x88, 0x09, 0x41, 0x31, + 0x61, 0x30, 0x0e, 0x64, 0x42, 0x90, 0x00, 0x00, 0x89, 0x20, 0x00, 0x00, + 0x28, 0x00, 0x00, 0x00, 0x32, 0x22, 0x48, 0x09, 0x20, 0x64, 0x85, 0x04, + 0x93, 0x22, 0xa4, 0x84, 0x04, 0x93, 0x22, 0xe3, 0x84, 0xa1, 0x90, 0x14, + 0x12, 0x4c, 0x8a, 0x8c, 0x0b, 0x84, 0xa4, 0x4c, 0x10, 0x68, 0x33, 0x00, + 0xc3, 0x08, 0x04, 0x30, 0x8c, 0x20, 0x00, 0x83, 0x08, 0x81, 0x30, 0x8c, + 0x30, 0x00, 0x07, 0x49, 0x53, 0x44, 0x09, 0x93, 0x2f, 0xbb, 0x6f, 0x47, + 0x08, 0xce, 0x40, 0x20, 0x82, 0x10, 0x42, 0x06, 0x11, 0x0a, 0xe1, 0x28, + 0x69, 0x8a, 0x28, 0x61, 0xf2, 0xff, 0x89, 0xb8, 0x26, 0x2a, 0x22, 0x7e, + 0x7b, 0xf8, 0xa7, 0x31, 0x02, 0x60, 0x10, 0xe1, 0x08, 0x2e, 0x92, 0xa6, + 0x88, 0x12, 0x26, 0xff, 0x97, 0x00, 0xe6, 0x59, 0x88, 0xe8, 0x9f, 0xc6, + 0x08, 0x80, 0x41, 0x84, 0x44, 0x28, 0x48, 0x08, 0x62, 0x18, 0x84, 0x14, + 0xad, 0x32, 0x00, 0x42, 0xa8, 0xcd, 0x11, 0x04, 0x73, 0x04, 0x60, 0x30, + 0x8c, 0x20, 0x40, 0x05, 0x09, 0x48, 0x89, 0x17, 0x1f, 0x20, 0x39, 0x10, + 0x30, 0x8c, 0x30, 0x40, 0xc3, 0x08, 0x04, 0x34, 0x47, 0x00, 0x0a, 0x83, + 0x08, 0x84, 0x30, 0x02, 0x00, 0x00, 0x00, 0x00, 0x13, 0xb2, 0x70, 0x48, + 0x07, 0x79, 0xb0, 0x03, 0x3a, 0x68, 0x83, 0x70, 0x80, 0x07, 0x78, 0x60, + 0x87, 0x72, 0x68, 0x83, 0x76, 0x08, 0x87, 0x71, 0x78, 0x87, 0x79, 0xc0, + 0x87, 0x38, 0x80, 0x03, 0x37, 0x88, 0x83, 0x38, 0x70, 0x03, 0x38, 0xd8, + 0xf0, 0x1e, 0xe5, 0xd0, 0x06, 0xf0, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x90, 0x0e, 0x71, + 0xa0, 0x07, 0x78, 0xa0, 0x07, 0x78, 0xd0, 0x06, 0xe9, 0x80, 0x07, 0x7a, + 0x80, 0x07, 0x7a, 0x80, 0x07, 0x6d, 0x90, 0x0e, 0x71, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x76, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x90, 0x0e, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x90, 0x0e, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x73, 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0e, 0x76, 0x40, 0x07, 0x7a, + 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, + 0x00, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, + 0x80, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x60, 0x07, 0x7a, 0x10, 0x07, 0x76, + 0xa0, 0x07, 0x71, 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x40, 0x07, 0x7a, + 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x73, + 0x20, 0x07, 0x7a, 0x30, 0x07, 0x72, 0xa0, 0x07, 0x73, 0x20, 0x07, 0x6d, + 0x60, 0x0f, 0x74, 0x80, 0x07, 0x7a, 0x60, 0x07, 0x74, 0xa0, 0x07, 0x76, + 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x76, 0x40, 0x07, 0x7a, 0x60, 0x07, 0x74, + 0xa0, 0x07, 0x76, 0x40, 0x07, 0x6d, 0x60, 0x0f, 0x79, 0x60, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0x60, 0x0f, 0x71, 0x20, 0x07, 0x78, 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, + 0xa0, 0x07, 0x71, 0x20, 0x07, 0x78, 0xd0, 0x06, 0xf6, 0x10, 0x07, 0x79, + 0x20, 0x07, 0x7a, 0x20, 0x07, 0x75, 0x60, 0x07, 0x7a, 0x20, 0x07, 0x75, + 0x60, 0x07, 0x6d, 0x60, 0x0f, 0x72, 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, + 0x50, 0x07, 0x76, 0xa0, 0x07, 0x72, 0x50, 0x07, 0x76, 0xd0, 0x06, 0xf6, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, 0x50, 0x07, 0x71, 0x20, 0x07, 0x7a, + 0x50, 0x07, 0x71, 0x20, 0x07, 0x6d, 0x60, 0x0f, 0x71, 0x00, 0x07, 0x72, + 0x40, 0x07, 0x7a, 0x10, 0x07, 0x70, 0x20, 0x07, 0x74, 0xa0, 0x07, 0x71, + 0x00, 0x07, 0x72, 0x40, 0x07, 0x6d, 0x60, 0x0e, 0x78, 0x00, 0x07, 0x7a, + 0x10, 0x07, 0x72, 0x80, 0x07, 0x7a, 0x10, 0x07, 0x72, 0x80, 0x07, 0x6d, + 0xe0, 0x0e, 0x78, 0xa0, 0x07, 0x71, 0x60, 0x07, 0x7a, 0x30, 0x07, 0x72, + 0x30, 0x84, 0x61, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, + 0xc2, 0x38, 0x40, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x61, + 0x26, 0x20, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb2, 0x40, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x32, 0x1e, 0x98, 0x14, 0x19, 0x11, 0x4c, 0x90, + 0x8c, 0x09, 0x26, 0x47, 0xc6, 0x04, 0x43, 0x82, 0x23, 0x00, 0x25, 0x50, + 0x20, 0x05, 0x18, 0x50, 0x10, 0x45, 0x50, 0x06, 0x05, 0x54, 0x60, 0x85, + 0x50, 0x0a, 0xc5, 0x40, 0x77, 0x04, 0x00, 0x00, 0x79, 0x18, 0x00, 0x00, + 0x0d, 0x01, 0x00, 0x00, 0x1a, 0x03, 0x4c, 0x10, 0xd7, 0x20, 0x08, 0x0e, + 0x8e, 0xad, 0x0c, 0x84, 0x89, 0xc9, 0xaa, 0x09, 0xc4, 0xae, 0x4c, 0x6e, + 0x2e, 0xed, 0xcd, 0x0d, 0x04, 0x07, 0x46, 0xc6, 0x25, 0x06, 0x04, 0xa5, + 0xad, 0x8c, 0x2e, 0x8c, 0xcd, 0xac, 0xac, 0x05, 0x07, 0x46, 0xc6, 0x25, + 0xc6, 0x65, 0x86, 0x26, 0x65, 0x88, 0x40, 0x01, 0x43, 0x0c, 0x88, 0x80, + 0x0e, 0x68, 0x60, 0xd1, 0x54, 0x46, 0x17, 0xc6, 0x36, 0x04, 0xa1, 0x06, + 0x88, 0x80, 0x08, 0x68, 0xe0, 0x16, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, + 0x06, 0x97, 0xc6, 0x56, 0xe6, 0x42, 0x56, 0xe6, 0xf6, 0x26, 0xd7, 0x36, + 0xf7, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, 0x56, 0x36, 0x44, 0xa0, 0x0a, + 0x72, 0x61, 0x69, 0x72, 0x2e, 0x63, 0x6f, 0x6d, 0x70, 0x69, 0x6c, 0x65, + 0x2e, 0x66, 0x61, 0x73, 0x74, 0x5f, 0x6d, 0x61, 0x74, 0x68, 0x5f, 0x65, + 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x43, 0x04, 0xea, 0x60, 0x19, 0x84, 0xa5, + 0xc9, 0xb9, 0x8c, 0xbd, 0xb5, 0xc1, 0xa5, 0xb1, 0x95, 0xb9, 0x98, 0xc9, + 0x85, 0xb5, 0x95, 0x89, 0xd5, 0x99, 0x99, 0x95, 0xc9, 0x7d, 0x99, 0x95, + 0xd1, 0x8d, 0xa1, 0x7d, 0x91, 0xa5, 0xcd, 0x85, 0x89, 0xb1, 0x95, 0x0d, + 0x11, 0xa8, 0x84, 0x61, 0x10, 0x96, 0x26, 0xe7, 0x32, 0xf6, 0xd6, 0x06, + 0x97, 0xc6, 0x56, 0xe6, 0xe2, 0x16, 0x46, 0x97, 0x66, 0x57, 0xf6, 0x45, + 0xf6, 0x56, 0x27, 0xc6, 0x56, 0xf6, 0x45, 0x96, 0x36, 0x17, 0x26, 0xc6, + 0x56, 0x36, 0x44, 0xa0, 0x16, 0x46, 0x61, 0x69, 0x72, 0x2e, 0x72, 0x65, + 0x6e, 0x64, 0x65, 0x72, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x8c, + 0xc2, 0xd2, 0xe4, 0x5c, 0xc2, 0xe4, 0xce, 0xbe, 0xe8, 0xf2, 0xe0, 0xca, + 0xbe, 0xd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x14, 0x46, 0x65, 0xd4, 0x44, 0x69, 0x94, 0x43, + 0x6d, 0x54, 0x45, 0x71, 0x54, 0xc2, 0xd2, 0xe4, 0x5c, 0xc4, 0xea, 0xcc, + 0xcc, 0xca, 0xe4, 0xf8, 0x84, 0xa5, 0xc9, 0xb9, 0x88, 0xd5, 0x99, 0x99, + 0x95, 0xc9, 0x7d, 0xcd, 0xa5, 0xe9, 0x95, 0x51, 0x0a, 0x4b, 0x93, 0x73, + 0x61, 0x7b, 0x1b, 0x0b, 0xa3, 0x4b, 0x7b, 0x73, 0xfb, 0x4a, 0x73, 0x23, + 0x2b, 0xc3, 0x23, 0x12, 0x96, 0x26, 0xe7, 0x22, 0x57, 0x16, 0x46, 0xc6, + 0x28, 0x2c, 0x4d, 0xce, 0x25, 0x4c, 0xee, 0xec, 0x8b, 0x2e, 0x0f, 0xae, + 0xec, 0x6b, 0x2e, 0x4d, 0xaf, 0x8c, 0x57, 0x58, 0x9a, 0x9c, 0x4b, 0x98, + 0xdc, 0xd9, 0x17, 0x5d, 0x1e, 0x5c, 0xd9, 0x57, 0x18, 0x5b, 0xda, 0x99, + 0xdb, 0xd7, 0x5c, 0x9a, 0x5e, 0x19, 0x87, 0xb1, 0x37, 0xb6, 0x21, 0x60, + 0x00, 0x21, 0x94, 0x47, 0x7d, 0x50, 0x41, 0x81, 0x01, 0x34, 0x40, 0x04, + 0x15, 0x06, 0x94, 0x18, 0x40, 0x05, 0x35, 0x06, 0x50, 0x41, 0x39, 0xd4, + 0x43, 0x55, 0x14, 0x19, 0x90, 0x0a, 0x4b, 0x93, 0x73, 0x99, 0xa3, 0x93, + 0xab, 0x1b, 0xa3, 0xfb, 0xa2, 0xcb, 0x83, 0x2b, 0xfb, 0x4a, 0x73, 0x33, + 0x7b, 0xa3, 0x61, 0xc6, 0xf6, 0x16, 0x46, 0x37, 0x43, 0xe3, 0xcd, 0xcc, + 0x6c, 0xae, 0x8c, 0x8e, 0x86, 0xd4, 0xd8, 0x5b, 0x99, 0x99, 0x19, 0x8d, + 0xa3, 0xb1, 0xb7, 0x32, 0x33, 0x33, 0x1a, 0x42, 0x63, 0x6f, 0x65, 0x66, + 0x66, 0x43, 0xd0, 0x00, 0x1a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd0, + 0x00, 0x2a, 0xa0, 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd2, 0x00, 0x52, 0xa0, + 0x02, 0x1a, 0xa8, 0x33, 0xa0, 0xd4, 0x00, 0x5a, 0xa0, 0x02, 0x1a, 0xa8, + 0x33, 0xa0, 0xd6, 0x80, 0x49, 0x56, 0x95, 0x15, 0x51, 0xd9, 0xd8, 0x1b, + 0x59, 0x19, 0x0d, 0xb2, 0xb2, 0xb1, 0x37, 0xb2, 0xb2, 0x21, 0x64, 0x00, + 0x25, 0x94, 0x47, 0x7d, 0x90, 0x41, 0x81, 0x01, 0x44, 0x40, 0x04, 0x15, + 0x06, 0x94, 0x19, 0x50, 0x6c, 0x40, 0x89, 0x01, 0x64, 0x50, 0x63, 0x00, + 0x15, 0x94, 0x43, 0xb5, 0x01, 0x55, 0x51, 0x6e, 0xc0, 0x25, 0x2c, 0x4d, + 0xce, 0x85, 0xae, 0x0c, 0x8f, 0xae, 0x4e, 0xae, 0x8c, 0x4a, 0x58, 0x9a, + 0x9c, 0xcb, 0x5c, 0x58, 0x1b, 0x1c, 0x5b, 0x19, 0x31, 0xba, 0x32, 0x3c, + 0xba, 0x3a, 0xb9, 0x32, 0x19, 0x32, 0x1e, 0x33, 0xb6, 0xb7, 0x30, 0x3a, + 0x16, 0x90, 0xb9, 0xb0, 0x36, 0x38, 0xb6, 0x32, 0x1f, 0x12, 0x74, 0x65, + 0x78, 0x59, 0x43, 0x28, 0x88, 0xa1, 0xe0, 0x80, 0x02, 0x03, 0x68, 0x80, + 0x08, 0x2a, 0x0e, 0x28, 0x87, 0x92, 0x03, 0xaa, 0xa2, 0xe6, 0x80, 0x05, + 0x5d, 0x19, 0x5e, 0x95, 0xd5, 0x10, 0x0a, 0x6a, 0x28, 0x38, 0xa0, 0xc0, + 0x00, 0x22, 0x20, 0x82, 0x8a, 0x03, 0xca, 0xa1, 0xe4, 0x80, 0xaa, 0xa8, + 0x3a, 0xe0, 0x12, 0x96, 0x26, 0xe7, 0x32, 0x17, 0xd6, 0x06, 0xc7, 0x56, + 0x26, 0xc7, 0x63, 0x2e, 0xac, 0x0d, 0x8e, 0xad, 0x4c, 0x8e, 0xc1, 0xdc, + 0x10, 0x09, 0x72, 0xa8, 0x3b, 0xa0, 0xc0, 0x00, 0x1a, 0x20, 0x82, 0x72, + 0x28, 0x3c, 0xa0, 0x2a, 0x2a, 0x0f, 0x86, 0x38, 0xd4, 0x45, 0x75, 0x54, + 0x19, 0x50, 0x6f, 0x40, 0xd1, 0x01, 0x65, 0x07, 0x94, 0x1e, 0x0c, 0x31, + 0x18, 0x80, 0x8a, 0xa8, 0x3d, 0xe0, 0xf3, 0xd6, 0xe6, 0x96, 0x06, 0xf7, + 0x46, 0x57, 0xe6, 0x46, 0x07, 0x32, 0x86, 0x16, 0x26, 0xc7, 0x67, 0x2a, + 0xad, 0x0d, 0x8e, 0xad, 0x0c, 0x64, 0x68, 0x65, 0x05, 0x84, 0x4a, 0x28, + 0x28, 0x68, 0x88, 0x40, 0xf9, 0xc1, 0x10, 0x83, 0xea, 0x03, 0xea, 0x0f, + 0xae, 0x67, 0x88, 0x41, 0x81, 0x02, 0x05, 0x0a, 0xd7, 0x33, 0x42, 0x61, + 0x07, 0x76, 0xb0, 0x87, 0x76, 0x70, 0x83, 0x74, 0x20, 0x87, 0x72, 0x70, + 0x07, 0x7a, 0x98, 0x12, 0x04, 0x23, 0x96, 0x70, 0x48, 0x07, 0x79, 0x70, + 0x03, 0x7b, 0x28, 0x07, 0x79, 0x98, 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, + 0x12, 0x08, 0x23, 0xa8, 0x70, 0x48, 0x07, 0x79, 0x70, 0x03, 0x76, 0x08, + 0x07, 0x77, 0x38, 0x87, 0x7a, 0x08, 0x87, 0x73, 0x28, 0x87, 0x5f, 0xb0, + 0x87, 0x72, 0x90, 0x87, 0x79, 0x48, 0x87, 0x77, 0x70, 0x87, 0x29, 0x01, + 0x31, 0x62, 0x0a, 0x87, 0x74, 0x90, 0x07, 0x37, 0x18, 0x87, 0x77, 0x68, + 0x07, 0x78, 0x48, 0x07, 0x76, 0x28, 0x87, 0x5f, 0x78, 0x07, 0x78, 0xa0, + 0x87, 0x74, 0x78, 0x07, 0x77, 0x98, 0x87, 0x29, 0x84, 0x81, 0x28, 0xcc, + 0x08, 0x26, 0x1c, 0xd2, 0x41, 0x1e, 0xdc, 0xc0, 0x1c, 0xe4, 0x21, 0x1c, + 0xce, 0xa1, 0x1d, 0xca, 0xc1, 0x1d, 0xe8, 0x61, 0x4a, 0xc0, 0x07, 0x00, + 0x79, 0x18, 0x00, 0x00, 0x5c, 0x00, 0x00, 0x00, 0x33, 0x08, 0x80, 0x1c, + 0xc4, 0xe1, 0x1c, 0x66, 0x14, 0x01, 0x3d, 0x88, 0x43, 0x38, 0x84, 0xc3, + 0x8c, 0x42, 0x80, 0x07, 0x79, 0x78, 0x07, 0x73, 0x98, 0x71, 0x0c, 0xe6, + 0x00, 0x0f, 0xed, 0x10, 0x0e, 0xf4, 0x80, 0x0e, 0x33, 0x0c, 0x42, 0x1e, + 0xc2, 0xc1, 0x1d, 0xce, 0xa1, 0x1c, 0x66, 0x30, 0x05, 0x3d, 0x88, 0x43, + 0x38, 0x84, 0x83, 0x1b, 0xcc, 0x03, 0x3d, 0xc8, 0x43, 0x3d, 0x8c, 0x03, + 0x3d, 0xcc, 0x78, 0x8c, 0x74, 0x70, 0x07, 0x7b, 0x08, 0x07, 0x79, 0x48, + 0x87, 0x70, 0x70, 0x07, 0x7a, 0x70, 0x03, 0x76, 0x78, 0x87, 0x70, 0x20, + 0x87, 0x19, 0xcc, 0x11, 0x0e, 0xec, 0x90, 0x0e, 0xe1, 0x30, 0x0f, 0x6e, + 0x30, 0x0f, 0xe3, 0xf0, 0x0e, 0xf0, 0x50, 0x0e, 0x33, 0x10, 0xc4, 0x1d, + 0xde, 0x21, 0x1c, 0xd8, 0x21, 0x1d, 0xc2, 0x61, 0x1e, 0x66, 0x30, 0x89, + 0x3b, 0xbc, 0x83, 0x3b, 0xd0, 0x43, 0x39, 0xb4, 0x03, 0x3c, 0xbc, 0x83, + 0x3c, 0x84, 0x03, 0x3b, 0xcc, 0xf0, 0x14, 0x76, 0x60, 0x07, 0x7b, 0x68, + 0x07, 0x37, 0x68, 0x87, 0x72, 0x68, 0x07, 0x37, 0x80, 0x87, 0x70, 0x90, + 0x87, 0x70, 0x60, 0x07, 0x76, 0x28, 0x07, 0x76, 0xf8, 0x05, 0x76, 0x78, + 0x87, 0x77, 0x80, 0x87, 0x5f, 0x08, 0x87, 0x71, 0x18, 0x87, 0x72, 0x98, + 0x87, 0x79, 0x98, 0x81, 0x2c, 0xee, 0xf0, 0x0e, 0xee, 0xe0, 0x0e, 0xf5, + 0xc0, 0x0e, 0xec, 0x30, 0x03, 0x62, 0xc8, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, + 0xcc, 0xa1, 0x1c, 0xe4, 0xa1, 0x1c, 0xdc, 0x61, 0x1c, 0xca, 0x21, 0x1c, + 0xc4, 0x81, 0x1d, 0xca, 0x61, 0x06, 0xd6, 0x90, 0x43, 0x39, 0xc8, 0x43, + 0x39, 0x98, 0x43, 0x39, 0xc8, 0x43, 0x39, 0xb8, 0xc3, 0x38, 0x94, 0x43, + 0x38, 0x88, 0x03, 0x3b, 0x94, 0xc3, 0x2f, 0xbc, 0x83, 0x3c, 0xfc, 0x82, + 0x3b, 0xd4, 0x03, 0x3b, 0xb0, 0xc3, 0x0c, 0xc7, 0x69, 0x87, 0x70, 0x58, + 0x87, 0x72, 0x70, 0x83, 0x74, 0x68, 0x07, 0x78, 0x60, 0x87, 0x74, 0x18, + 0x87, 0x74, 0xa0, 0x87, 0x19, 0xce, 0x53, 0x0f, 0xee, 0x00, 0x0f, 0xf2, + 0x50, 0x0e, 0xe4, 0x90, 0x0e, 0xe3, 0x40, 0x0f, 0xe1, 0x20, 0x0e, 0xec, + 0x50, 0x0e, 0x33, 0x20, 0x28, 0x1d, 0xdc, 0xc1, 0x1e, 0xc2, 0x41, 0x1e, + 0xd2, 0x21, 0x1c, 0xdc, 0x81, 0x1e, 0xdc, 0xe0, 0x1c, 0xe4, 0xe1, 0x1d, + 0xea, 0x01, 0x1e, 0x66, 0x18, 0x51, 0x38, 0xb0, 0x43, 0x3a, 0x9c, 0x83, + 0x3b, 0xcc, 0x50, 0x24, 0x76, 0x60, 0x07, 0x7b, 0x68, 0x07, 0x37, 0x60, + 0x87, 0x77, 0x78, 0x07, 0x78, 0x98, 0x51, 0x4c, 0xf4, 0x90, 0x0f, 0xf0, + 0x50, 0x0e, 0x00, 0x00, 0x71, 0x20, 0x00, 0x00, 0x0d, 0x00, 0x00, 0x00, + 0x16, 0xd0, 0x00, 0x48, 0xe4, 0x0f, 0xce, 0xe4, 0x57, 0x77, 0x71, 0xdb, + 0x26, 0xb0, 0x01, 0x48, 0xe4, 0x4b, 0x00, 0xf3, 0x2c, 0xc4, 0x3f, 0x11, + 0xd7, 0x44, 0x45, 0xc4, 0x6f, 0x0f, 0x7e, 0x85, 0x17, 0xb7, 0x6d, 0x00, + 0x11, 0xdb, 0x95, 0xff, 0xf9, 0xda, 0xf5, 0x5f, 0x44, 0x80, 0xc1, 0x10, + 0xcd, 0x04, 0x00, 0x00, 0x61, 0x20, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, + 0x13, 0x04, 0x41, 0x2c, 0x10, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, + 0x64, 0xe7, 0x20, 0x06, 0x02, 0xf1, 0xa8, 0x8e, 0x35, 0x00, 0x03, 0x31, + 0xc7, 0x30, 0x10, 0xde, 0x1c, 0xc3, 0xe0, 0x79, 0x63, 0x0d, 0x40, 0x20, + 0xd0, 0xab, 0x81, 0x11, 0x00, 0x82, 0x33, 0x00, 0x14, 0x47, 0x00, 0xc6, + 0x12, 0x02, 0x80, 0xc8, 0x0c, 0x00, 0x89, 0x19, 0x00, 0x0a, 0x33, 0x00, + 0x04, 0xc6, 0x08, 0x40, 0x10, 0x04, 0xf1, 0x6f, 0x04, 0x00, 0x00, 0x00, + 0x23, 0x06, 0xca, 0x10, 0x90, 0x81, 0x04, 0x55, 0xca, 0x91, 0x04, 0x23, + 0x06, 0xca, 0x10, 0x94, 0x81, 0x14, 0x59, 0x0b, 0xa2, 0x08, 0x83, 0x0c, + 0x41, 0x81, 0x0c, 0x32, 0x0c, 0xc6, 0x33, 0xc8, 0x20, 0x20, 0xd1, 0x20, + 0x83, 0x10, 0x4c, 0x83, 0x0c, 0xc1, 0x52, 0x9d, 0x36, 0x96, 0x82, 0x62, + 0x43, 0x00, 0x1f, 0xf2, 0xca, 0x20, 0x83, 0xe0, 0x58, 0xe3, 0x0d, 0xdf, + 0x18, 0xb8, 0xc1, 0x05, 0x63, 0x29, 0x28, 0x83, 0x0c, 0x81, 0xa4, 0x8d, + 0x18, 0x14, 0x44, 0x50, 0x07, 0x45, 0x30, 0xc7, 0x40, 0x05, 0x74, 0x30, + 0xde, 0x50, 0x06, 0x69, 0x00, 0x07, 0x17, 0x8c, 0xa5, 0xa0, 0x0c, 0x32, + 0x04, 0x18, 0x18, 0x8c, 0x18, 0x14, 0x44, 0xb0, 0x07, 0x4b, 0x30, 0xc7, + 0x60, 0x04, 0x79, 0x30, 0xde, 0xb0, 0x06, 0x6f, 0x50, 0x07, 0x17, 0x8c, + 0xa5, 0xa0, 0x0c, 0x32, 0x04, 0x9e, 0x19, 0x8c, 0x18, 0x14, 0x44, 0x10, + 0x0a, 0x51, 0x30, 0xc7, 0x60, 0x04, 0x7b, 0x30, 0xc7, 0x10, 0x80, 0xc1, + 0x1e, 0x58, 0x50, 0xc9, 0x27, 0x83, 0x80, 0x18, 0x02, 0x00, 0x00, 0x00, + 0x5b, 0x06, 0x25, 0x08, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00 +}; +const unsigned int sdl_metallib_len = 22792; diff --git a/Engine/lib/sdl/src/render/metal/build-metal-shaders.sh b/Engine/lib/sdl/src/render/metal/build-metal-shaders.sh new file mode 100755 index 000000000..8ebf63eab --- /dev/null +++ b/Engine/lib/sdl/src/render/metal/build-metal-shaders.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +set -x +set -e +cd `dirname "$0"` + +generate_shaders() +{ + platform=$1 + /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal -std=$platform-metal1.1 -Wall -O3 -o ./sdl.air ./SDL_shaders_metal.metal || exit $? + /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metal-ar rc sdl.metalar sdl.air || exit $? + /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/usr/bin/metallib -o sdl.metallib sdl.metalar || exit $? + xxd -i sdl.metallib | perl -w -p -e 's/\Aunsigned /const unsigned /;' >./SDL_shaders_metal_$platform.h + rm -f sdl.air sdl.metalar sdl.metallib +} + +generate_shaders osx +generate_shaders ios diff --git a/Engine/lib/sdl/src/render/mmx.h b/Engine/lib/sdl/src/render/mmx.h deleted file mode 100644 index 3bd00ac23..000000000 --- a/Engine/lib/sdl/src/render/mmx.h +++ /dev/null @@ -1,642 +0,0 @@ -/* mmx.h - - MultiMedia eXtensions GCC interface library for IA32. - - To use this library, simply include this header file - and compile with GCC. You MUST have inlining enabled - in order for mmx_ok() to work; this can be done by - simply using -O on the GCC command line. - - Compiling with -DMMX_TRACE will cause detailed trace - output to be sent to stderr for each mmx operation. - This adds lots of code, and obviously slows execution to - a crawl, but can be very useful for debugging. - - THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT - LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY - AND FITNESS FOR ANY PARTICULAR PURPOSE. - - 1997-99 by H. Dietz and R. Fisher - - Notes: - It appears that the latest gas has the pand problem fixed, therefore - I'll undefine BROKEN_PAND by default. -*/ - -#ifndef _MMX_H -#define _MMX_H - - -/* Warning: at this writing, the version of GAS packaged - with most Linux distributions does not handle the - parallel AND operation mnemonic correctly. If the - symbol BROKEN_PAND is defined, a slower alternative - coding will be used. If execution of mmxtest results - in an illegal instruction fault, define this symbol. -*/ -#undef BROKEN_PAND - - -/* The type of an value that fits in an MMX register - (note that long long constant values MUST be suffixed - by LL and unsigned long long values by ULL, lest - they be truncated by the compiler) -*/ -typedef union -{ - long long q; /* Quadword (64-bit) value */ - unsigned long long uq; /* Unsigned Quadword */ - int d[2]; /* 2 Doubleword (32-bit) values */ - unsigned int ud[2]; /* 2 Unsigned Doubleword */ - short w[4]; /* 4 Word (16-bit) values */ - unsigned short uw[4]; /* 4 Unsigned Word */ - char b[8]; /* 8 Byte (8-bit) values */ - unsigned char ub[8]; /* 8 Unsigned Byte */ - float s[2]; /* Single-precision (32-bit) value */ -} __attribute__ ((aligned(8))) mmx_t; /* On an 8-byte (64-bit) boundary */ - - -#if 0 -/* Function to test if multimedia instructions are supported... -*/ -inline extern int -mm_support(void) -{ - /* Returns 1 if MMX instructions are supported, - 3 if Cyrix MMX and Extended MMX instructions are supported - 5 if AMD MMX and 3DNow! instructions are supported - 0 if hardware does not support any of these - */ - register int rval = 0; - - __asm__ __volatile__( - /* See if CPUID instruction is supported ... */ - /* ... Get copies of EFLAGS into eax and ecx */ - "pushf\n\t" - "popl %%eax\n\t" "movl %%eax, %%ecx\n\t" - /* ... Toggle the ID bit in one copy and store */ - /* to the EFLAGS reg */ - "xorl $0x200000, %%eax\n\t" - "push %%eax\n\t" "popf\n\t" - /* ... Get the (hopefully modified) EFLAGS */ - "pushf\n\t" "popl %%eax\n\t" - /* ... Compare and test result */ - "xorl %%eax, %%ecx\n\t" "testl $0x200000, %%ecx\n\t" "jz NotSupported1\n\t" /* CPUID not supported */ - /* Get standard CPUID information, and - go to a specific vendor section */ - "movl $0, %%eax\n\t" "cpuid\n\t" - /* Check for Intel */ - "cmpl $0x756e6547, %%ebx\n\t" - "jne TryAMD\n\t" - "cmpl $0x49656e69, %%edx\n\t" - "jne TryAMD\n\t" - "cmpl $0x6c65746e, %%ecx\n" - "jne TryAMD\n\t" "jmp Intel\n\t" - /* Check for AMD */ - "\nTryAMD:\n\t" - "cmpl $0x68747541, %%ebx\n\t" - "jne TryCyrix\n\t" - "cmpl $0x69746e65, %%edx\n\t" - "jne TryCyrix\n\t" - "cmpl $0x444d4163, %%ecx\n" - "jne TryCyrix\n\t" "jmp AMD\n\t" - /* Check for Cyrix */ - "\nTryCyrix:\n\t" - "cmpl $0x69727943, %%ebx\n\t" - "jne NotSupported2\n\t" - "cmpl $0x736e4978, %%edx\n\t" - "jne NotSupported3\n\t" - "cmpl $0x64616574, %%ecx\n\t" - "jne NotSupported4\n\t" - /* Drop through to Cyrix... */ - /* Cyrix Section */ - /* See if extended CPUID level 80000001 is supported */ - /* The value of CPUID/80000001 for the 6x86MX is undefined - according to the Cyrix CPU Detection Guide (Preliminary - Rev. 1.01 table 1), so we'll check the value of eax for - CPUID/0 to see if standard CPUID level 2 is supported. - According to the table, the only CPU which supports level - 2 is also the only one which supports extended CPUID levels. - */ - "cmpl $0x2, %%eax\n\t" "jne MMXtest\n\t" /* Use standard CPUID instead */ - /* Extended CPUID supported (in theory), so get extended - features */ - "movl $0x80000001, %%eax\n\t" "cpuid\n\t" "testl $0x00800000, %%eax\n\t" /* Test for MMX */ - "jz NotSupported5\n\t" /* MMX not supported */ - "testl $0x01000000, %%eax\n\t" /* Test for Ext'd MMX */ - "jnz EMMXSupported\n\t" "movl $1, %0:\n\n\t" /* MMX Supported */ - "jmp Return\n\n" "EMMXSupported:\n\t" "movl $3, %0:\n\n\t" /* EMMX and MMX Supported */ - "jmp Return\n\t" - /* AMD Section */ - "AMD:\n\t" - /* See if extended CPUID is supported */ - "movl $0x80000000, %%eax\n\t" "cpuid\n\t" "cmpl $0x80000000, %%eax\n\t" "jl MMXtest\n\t" /* Use standard CPUID instead */ - /* Extended CPUID supported, so get extended features */ - "movl $0x80000001, %%eax\n\t" "cpuid\n\t" "testl $0x00800000, %%edx\n\t" /* Test for MMX */ - "jz NotSupported6\n\t" /* MMX not supported */ - "testl $0x80000000, %%edx\n\t" /* Test for 3DNow! */ - "jnz ThreeDNowSupported\n\t" "movl $1, %0:\n\n\t" /* MMX Supported */ - "jmp Return\n\n" "ThreeDNowSupported:\n\t" "movl $5, %0:\n\n\t" /* 3DNow! and MMX Supported */ - "jmp Return\n\t" - /* Intel Section */ - "Intel:\n\t" - /* Check for MMX */ - "MMXtest:\n\t" "movl $1, %%eax\n\t" "cpuid\n\t" "testl $0x00800000, %%edx\n\t" /* Test for MMX */ - "jz NotSupported7\n\t" /* MMX Not supported */ - "movl $1, %0:\n\n\t" /* MMX Supported */ - "jmp Return\n\t" - /* Nothing supported */ - "\nNotSupported1:\n\t" "#movl $101, %0:\n\n\t" "\nNotSupported2:\n\t" "#movl $102, %0:\n\n\t" "\nNotSupported3:\n\t" "#movl $103, %0:\n\n\t" "\nNotSupported4:\n\t" "#movl $104, %0:\n\n\t" "\nNotSupported5:\n\t" "#movl $105, %0:\n\n\t" "\nNotSupported6:\n\t" "#movl $106, %0:\n\n\t" "\nNotSupported7:\n\t" "#movl $107, %0:\n\n\t" "movl $0, %0:\n\n\t" "Return:\n\t":"=a"(rval): /* no input */ - :"eax", "ebx", "ecx", "edx"); - - /* Return */ - return (rval); -} - -/* Function to test if mmx instructions are supported... -*/ -inline extern int -mmx_ok(void) -{ - /* Returns 1 if MMX instructions are supported, 0 otherwise */ - return (mm_support() & 0x1); -} -#endif - -/* Helper functions for the instruction macros that follow... - (note that memory-to-register, m2r, instructions are nearly - as efficient as register-to-register, r2r, instructions; - however, memory-to-memory instructions are really simulated - as a convenience, and are only 1/3 as efficient) -*/ -#ifdef MMX_TRACE - -/* Include the stuff for printing a trace to stderr... -*/ - -#define mmx_i2r(op, imm, reg) \ - { \ - mmx_t mmx_trace; \ - mmx_trace.uq = (imm); \ - printf(#op "_i2r(" #imm "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#reg "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "X" (imm)); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#reg "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#define mmx_m2r(op, mem, reg) \ - { \ - mmx_t mmx_trace; \ - mmx_trace = (mem); \ - printf(#op "_m2r(" #mem "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#reg "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "X" (mem)); \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#reg "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#define mmx_r2m(op, reg, mem) \ - { \ - mmx_t mmx_trace; \ - __asm__ __volatile__ ("movq %%" #reg ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#op "_r2m(" #reg "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - mmx_trace = (mem); \ - printf(#mem "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ (#op " %%" #reg ", %0" \ - : "=X" (mem) \ - : /* nothing */ ); \ - mmx_trace = (mem); \ - printf(#mem "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#define mmx_r2r(op, regs, regd) \ - { \ - mmx_t mmx_trace; \ - __asm__ __volatile__ ("movq %%" #regs ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#op "_r2r(" #regs "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ ("movq %%" #regd ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#regd "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ (#op " %" #regs ", %" #regd); \ - __asm__ __volatile__ ("movq %%" #regd ", %0" \ - : "=X" (mmx_trace) \ - : /* nothing */ ); \ - printf(#regd "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#define mmx_m2m(op, mems, memd) \ - { \ - mmx_t mmx_trace; \ - mmx_trace = (mems); \ - printf(#op "_m2m(" #mems "=0x%08x%08x, ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - mmx_trace = (memd); \ - printf(#memd "=0x%08x%08x) => ", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - __asm__ __volatile__ ("movq %0, %%mm0\n\t" \ - #op " %1, %%mm0\n\t" \ - "movq %%mm0, %0" \ - : "=X" (memd) \ - : "X" (mems)); \ - mmx_trace = (memd); \ - printf(#memd "=0x%08x%08x\n", \ - mmx_trace.d[1], mmx_trace.d[0]); \ - } - -#else - -/* These macros are a lot simpler without the tracing... -*/ - -#define mmx_i2r(op, imm, reg) \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "X" (imm) ) - -#define mmx_m2r(op, mem, reg) \ - __asm__ __volatile__ (#op " %0, %%" #reg \ - : /* nothing */ \ - : "m" (mem)) - -#define mmx_r2m(op, reg, mem) \ - __asm__ __volatile__ (#op " %%" #reg ", %0" \ - : "=m" (mem) \ - : /* nothing */ ) - -#define mmx_r2r(op, regs, regd) \ - __asm__ __volatile__ (#op " %" #regs ", %" #regd) - -#define mmx_m2m(op, mems, memd) \ - __asm__ __volatile__ ("movq %0, %%mm0\n\t" \ - #op " %1, %%mm0\n\t" \ - "movq %%mm0, %0" \ - : "=X" (memd) \ - : "X" (mems)) - -#endif - - -/* 1x64 MOVe Quadword - (this is both a load and a store... - in fact, it is the only way to store) -*/ -#define movq_m2r(var, reg) mmx_m2r(movq, var, reg) -#define movq_r2m(reg, var) mmx_r2m(movq, reg, var) -#define movq_r2r(regs, regd) mmx_r2r(movq, regs, regd) -#define movq(vars, vard) \ - __asm__ __volatile__ ("movq %1, %%mm0\n\t" \ - "movq %%mm0, %0" \ - : "=X" (vard) \ - : "X" (vars)) - - -/* 1x32 MOVe Doubleword - (like movq, this is both load and store... - but is most useful for moving things between - mmx registers and ordinary registers) -*/ -#define movd_m2r(var, reg) mmx_m2r(movd, var, reg) -#define movd_r2m(reg, var) mmx_r2m(movd, reg, var) -#define movd_r2r(regs, regd) mmx_r2r(movd, regs, regd) -#define movd(vars, vard) \ - __asm__ __volatile__ ("movd %1, %%mm0\n\t" \ - "movd %%mm0, %0" \ - : "=X" (vard) \ - : "X" (vars)) - - -/* 2x32, 4x16, and 8x8 Parallel ADDs -*/ -#define paddd_m2r(var, reg) mmx_m2r(paddd, var, reg) -#define paddd_r2r(regs, regd) mmx_r2r(paddd, regs, regd) -#define paddd(vars, vard) mmx_m2m(paddd, vars, vard) - -#define paddw_m2r(var, reg) mmx_m2r(paddw, var, reg) -#define paddw_r2r(regs, regd) mmx_r2r(paddw, regs, regd) -#define paddw(vars, vard) mmx_m2m(paddw, vars, vard) - -#define paddb_m2r(var, reg) mmx_m2r(paddb, var, reg) -#define paddb_r2r(regs, regd) mmx_r2r(paddb, regs, regd) -#define paddb(vars, vard) mmx_m2m(paddb, vars, vard) - - -/* 4x16 and 8x8 Parallel ADDs using Saturation arithmetic -*/ -#define paddsw_m2r(var, reg) mmx_m2r(paddsw, var, reg) -#define paddsw_r2r(regs, regd) mmx_r2r(paddsw, regs, regd) -#define paddsw(vars, vard) mmx_m2m(paddsw, vars, vard) - -#define paddsb_m2r(var, reg) mmx_m2r(paddsb, var, reg) -#define paddsb_r2r(regs, regd) mmx_r2r(paddsb, regs, regd) -#define paddsb(vars, vard) mmx_m2m(paddsb, vars, vard) - - -/* 4x16 and 8x8 Parallel ADDs using Unsigned Saturation arithmetic -*/ -#define paddusw_m2r(var, reg) mmx_m2r(paddusw, var, reg) -#define paddusw_r2r(regs, regd) mmx_r2r(paddusw, regs, regd) -#define paddusw(vars, vard) mmx_m2m(paddusw, vars, vard) - -#define paddusb_m2r(var, reg) mmx_m2r(paddusb, var, reg) -#define paddusb_r2r(regs, regd) mmx_r2r(paddusb, regs, regd) -#define paddusb(vars, vard) mmx_m2m(paddusb, vars, vard) - - -/* 2x32, 4x16, and 8x8 Parallel SUBs -*/ -#define psubd_m2r(var, reg) mmx_m2r(psubd, var, reg) -#define psubd_r2r(regs, regd) mmx_r2r(psubd, regs, regd) -#define psubd(vars, vard) mmx_m2m(psubd, vars, vard) - -#define psubw_m2r(var, reg) mmx_m2r(psubw, var, reg) -#define psubw_r2r(regs, regd) mmx_r2r(psubw, regs, regd) -#define psubw(vars, vard) mmx_m2m(psubw, vars, vard) - -#define psubb_m2r(var, reg) mmx_m2r(psubb, var, reg) -#define psubb_r2r(regs, regd) mmx_r2r(psubb, regs, regd) -#define psubb(vars, vard) mmx_m2m(psubb, vars, vard) - - -/* 4x16 and 8x8 Parallel SUBs using Saturation arithmetic -*/ -#define psubsw_m2r(var, reg) mmx_m2r(psubsw, var, reg) -#define psubsw_r2r(regs, regd) mmx_r2r(psubsw, regs, regd) -#define psubsw(vars, vard) mmx_m2m(psubsw, vars, vard) - -#define psubsb_m2r(var, reg) mmx_m2r(psubsb, var, reg) -#define psubsb_r2r(regs, regd) mmx_r2r(psubsb, regs, regd) -#define psubsb(vars, vard) mmx_m2m(psubsb, vars, vard) - - -/* 4x16 and 8x8 Parallel SUBs using Unsigned Saturation arithmetic -*/ -#define psubusw_m2r(var, reg) mmx_m2r(psubusw, var, reg) -#define psubusw_r2r(regs, regd) mmx_r2r(psubusw, regs, regd) -#define psubusw(vars, vard) mmx_m2m(psubusw, vars, vard) - -#define psubusb_m2r(var, reg) mmx_m2r(psubusb, var, reg) -#define psubusb_r2r(regs, regd) mmx_r2r(psubusb, regs, regd) -#define psubusb(vars, vard) mmx_m2m(psubusb, vars, vard) - - -/* 4x16 Parallel MULs giving Low 4x16 portions of results -*/ -#define pmullw_m2r(var, reg) mmx_m2r(pmullw, var, reg) -#define pmullw_r2r(regs, regd) mmx_r2r(pmullw, regs, regd) -#define pmullw(vars, vard) mmx_m2m(pmullw, vars, vard) - - -/* 4x16 Parallel MULs giving High 4x16 portions of results -*/ -#define pmulhw_m2r(var, reg) mmx_m2r(pmulhw, var, reg) -#define pmulhw_r2r(regs, regd) mmx_r2r(pmulhw, regs, regd) -#define pmulhw(vars, vard) mmx_m2m(pmulhw, vars, vard) - - -/* 4x16->2x32 Parallel Mul-ADD - (muls like pmullw, then adds adjacent 16-bit fields - in the multiply result to make the final 2x32 result) -*/ -#define pmaddwd_m2r(var, reg) mmx_m2r(pmaddwd, var, reg) -#define pmaddwd_r2r(regs, regd) mmx_r2r(pmaddwd, regs, regd) -#define pmaddwd(vars, vard) mmx_m2m(pmaddwd, vars, vard) - - -/* 1x64 bitwise AND -*/ -#ifdef BROKEN_PAND -#define pand_m2r(var, reg) \ - { \ - mmx_m2r(pandn, (mmx_t) -1LL, reg); \ - mmx_m2r(pandn, var, reg); \ - } -#define pand_r2r(regs, regd) \ - { \ - mmx_m2r(pandn, (mmx_t) -1LL, regd); \ - mmx_r2r(pandn, regs, regd) \ - } -#define pand(vars, vard) \ - { \ - movq_m2r(vard, mm0); \ - mmx_m2r(pandn, (mmx_t) -1LL, mm0); \ - mmx_m2r(pandn, vars, mm0); \ - movq_r2m(mm0, vard); \ - } -#else -#define pand_m2r(var, reg) mmx_m2r(pand, var, reg) -#define pand_r2r(regs, regd) mmx_r2r(pand, regs, regd) -#define pand(vars, vard) mmx_m2m(pand, vars, vard) -#endif - - -/* 1x64 bitwise AND with Not the destination -*/ -#define pandn_m2r(var, reg) mmx_m2r(pandn, var, reg) -#define pandn_r2r(regs, regd) mmx_r2r(pandn, regs, regd) -#define pandn(vars, vard) mmx_m2m(pandn, vars, vard) - - -/* 1x64 bitwise OR -*/ -#define por_m2r(var, reg) mmx_m2r(por, var, reg) -#define por_r2r(regs, regd) mmx_r2r(por, regs, regd) -#define por(vars, vard) mmx_m2m(por, vars, vard) - - -/* 1x64 bitwise eXclusive OR -*/ -#define pxor_m2r(var, reg) mmx_m2r(pxor, var, reg) -#define pxor_r2r(regs, regd) mmx_r2r(pxor, regs, regd) -#define pxor(vars, vard) mmx_m2m(pxor, vars, vard) - - -/* 2x32, 4x16, and 8x8 Parallel CoMPare for EQuality - (resulting fields are either 0 or -1) -*/ -#define pcmpeqd_m2r(var, reg) mmx_m2r(pcmpeqd, var, reg) -#define pcmpeqd_r2r(regs, regd) mmx_r2r(pcmpeqd, regs, regd) -#define pcmpeqd(vars, vard) mmx_m2m(pcmpeqd, vars, vard) - -#define pcmpeqw_m2r(var, reg) mmx_m2r(pcmpeqw, var, reg) -#define pcmpeqw_r2r(regs, regd) mmx_r2r(pcmpeqw, regs, regd) -#define pcmpeqw(vars, vard) mmx_m2m(pcmpeqw, vars, vard) - -#define pcmpeqb_m2r(var, reg) mmx_m2r(pcmpeqb, var, reg) -#define pcmpeqb_r2r(regs, regd) mmx_r2r(pcmpeqb, regs, regd) -#define pcmpeqb(vars, vard) mmx_m2m(pcmpeqb, vars, vard) - - -/* 2x32, 4x16, and 8x8 Parallel CoMPare for Greater Than - (resulting fields are either 0 or -1) -*/ -#define pcmpgtd_m2r(var, reg) mmx_m2r(pcmpgtd, var, reg) -#define pcmpgtd_r2r(regs, regd) mmx_r2r(pcmpgtd, regs, regd) -#define pcmpgtd(vars, vard) mmx_m2m(pcmpgtd, vars, vard) - -#define pcmpgtw_m2r(var, reg) mmx_m2r(pcmpgtw, var, reg) -#define pcmpgtw_r2r(regs, regd) mmx_r2r(pcmpgtw, regs, regd) -#define pcmpgtw(vars, vard) mmx_m2m(pcmpgtw, vars, vard) - -#define pcmpgtb_m2r(var, reg) mmx_m2r(pcmpgtb, var, reg) -#define pcmpgtb_r2r(regs, regd) mmx_r2r(pcmpgtb, regs, regd) -#define pcmpgtb(vars, vard) mmx_m2m(pcmpgtb, vars, vard) - - -/* 1x64, 2x32, and 4x16 Parallel Shift Left Logical -*/ -#define psllq_i2r(imm, reg) mmx_i2r(psllq, imm, reg) -#define psllq_m2r(var, reg) mmx_m2r(psllq, var, reg) -#define psllq_r2r(regs, regd) mmx_r2r(psllq, regs, regd) -#define psllq(vars, vard) mmx_m2m(psllq, vars, vard) - -#define pslld_i2r(imm, reg) mmx_i2r(pslld, imm, reg) -#define pslld_m2r(var, reg) mmx_m2r(pslld, var, reg) -#define pslld_r2r(regs, regd) mmx_r2r(pslld, regs, regd) -#define pslld(vars, vard) mmx_m2m(pslld, vars, vard) - -#define psllw_i2r(imm, reg) mmx_i2r(psllw, imm, reg) -#define psllw_m2r(var, reg) mmx_m2r(psllw, var, reg) -#define psllw_r2r(regs, regd) mmx_r2r(psllw, regs, regd) -#define psllw(vars, vard) mmx_m2m(psllw, vars, vard) - - -/* 1x64, 2x32, and 4x16 Parallel Shift Right Logical -*/ -#define psrlq_i2r(imm, reg) mmx_i2r(psrlq, imm, reg) -#define psrlq_m2r(var, reg) mmx_m2r(psrlq, var, reg) -#define psrlq_r2r(regs, regd) mmx_r2r(psrlq, regs, regd) -#define psrlq(vars, vard) mmx_m2m(psrlq, vars, vard) - -#define psrld_i2r(imm, reg) mmx_i2r(psrld, imm, reg) -#define psrld_m2r(var, reg) mmx_m2r(psrld, var, reg) -#define psrld_r2r(regs, regd) mmx_r2r(psrld, regs, regd) -#define psrld(vars, vard) mmx_m2m(psrld, vars, vard) - -#define psrlw_i2r(imm, reg) mmx_i2r(psrlw, imm, reg) -#define psrlw_m2r(var, reg) mmx_m2r(psrlw, var, reg) -#define psrlw_r2r(regs, regd) mmx_r2r(psrlw, regs, regd) -#define psrlw(vars, vard) mmx_m2m(psrlw, vars, vard) - - -/* 2x32 and 4x16 Parallel Shift Right Arithmetic -*/ -#define psrad_i2r(imm, reg) mmx_i2r(psrad, imm, reg) -#define psrad_m2r(var, reg) mmx_m2r(psrad, var, reg) -#define psrad_r2r(regs, regd) mmx_r2r(psrad, regs, regd) -#define psrad(vars, vard) mmx_m2m(psrad, vars, vard) - -#define psraw_i2r(imm, reg) mmx_i2r(psraw, imm, reg) -#define psraw_m2r(var, reg) mmx_m2r(psraw, var, reg) -#define psraw_r2r(regs, regd) mmx_r2r(psraw, regs, regd) -#define psraw(vars, vard) mmx_m2m(psraw, vars, vard) - - -/* 2x32->4x16 and 4x16->8x8 PACK and Signed Saturate - (packs source and dest fields into dest in that order) -*/ -#define packssdw_m2r(var, reg) mmx_m2r(packssdw, var, reg) -#define packssdw_r2r(regs, regd) mmx_r2r(packssdw, regs, regd) -#define packssdw(vars, vard) mmx_m2m(packssdw, vars, vard) - -#define packsswb_m2r(var, reg) mmx_m2r(packsswb, var, reg) -#define packsswb_r2r(regs, regd) mmx_r2r(packsswb, regs, regd) -#define packsswb(vars, vard) mmx_m2m(packsswb, vars, vard) - - -/* 4x16->8x8 PACK and Unsigned Saturate - (packs source and dest fields into dest in that order) -*/ -#define packuswb_m2r(var, reg) mmx_m2r(packuswb, var, reg) -#define packuswb_r2r(regs, regd) mmx_r2r(packuswb, regs, regd) -#define packuswb(vars, vard) mmx_m2m(packuswb, vars, vard) - - -/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK Low - (interleaves low half of dest with low half of source - as padding in each result field) -*/ -#define punpckldq_m2r(var, reg) mmx_m2r(punpckldq, var, reg) -#define punpckldq_r2r(regs, regd) mmx_r2r(punpckldq, regs, regd) -#define punpckldq(vars, vard) mmx_m2m(punpckldq, vars, vard) - -#define punpcklwd_m2r(var, reg) mmx_m2r(punpcklwd, var, reg) -#define punpcklwd_r2r(regs, regd) mmx_r2r(punpcklwd, regs, regd) -#define punpcklwd(vars, vard) mmx_m2m(punpcklwd, vars, vard) - -#define punpcklbw_m2r(var, reg) mmx_m2r(punpcklbw, var, reg) -#define punpcklbw_r2r(regs, regd) mmx_r2r(punpcklbw, regs, regd) -#define punpcklbw(vars, vard) mmx_m2m(punpcklbw, vars, vard) - - -/* 2x32->1x64, 4x16->2x32, and 8x8->4x16 UNPaCK High - (interleaves high half of dest with high half of source - as padding in each result field) -*/ -#define punpckhdq_m2r(var, reg) mmx_m2r(punpckhdq, var, reg) -#define punpckhdq_r2r(regs, regd) mmx_r2r(punpckhdq, regs, regd) -#define punpckhdq(vars, vard) mmx_m2m(punpckhdq, vars, vard) - -#define punpckhwd_m2r(var, reg) mmx_m2r(punpckhwd, var, reg) -#define punpckhwd_r2r(regs, regd) mmx_r2r(punpckhwd, regs, regd) -#define punpckhwd(vars, vard) mmx_m2m(punpckhwd, vars, vard) - -#define punpckhbw_m2r(var, reg) mmx_m2r(punpckhbw, var, reg) -#define punpckhbw_r2r(regs, regd) mmx_r2r(punpckhbw, regs, regd) -#define punpckhbw(vars, vard) mmx_m2m(punpckhbw, vars, vard) - - -/* Empty MMx State - (used to clean-up when going from mmx to float use - of the registers that are shared by both; note that - there is no float-to-mmx operation needed, because - only the float tag word info is corruptible) -*/ -#ifdef MMX_TRACE - -#define emms() \ - { \ - printf("emms()\n"); \ - __asm__ __volatile__ ("emms"); \ - } - -#else - -#define emms() __asm__ __volatile__ ("emms") - -#endif - -#endif -/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/opengl/SDL_glfuncs.h b/Engine/lib/sdl/src/render/opengl/SDL_glfuncs.h index c8eba583c..02be0e157 100644 --- a/Engine/lib/sdl/src/render/opengl/SDL_glfuncs.h +++ b/Engine/lib/sdl/src/render/opengl/SDL_glfuncs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,7 +35,8 @@ SDL_PROC(void, glBindTexture, (GLenum, GLuint)) SDL_PROC_UNUSED(void, glBitmap, (GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, const GLubyte *)) -SDL_PROC(void, glBlendFunc, (GLenum, GLenum)) +SDL_PROC(void, glBlendEquation, (GLenum)) +SDL_PROC_UNUSED(void, glBlendFunc, (GLenum, GLenum)) SDL_PROC(void, glBlendFuncSeparate, (GLenum, GLenum, GLenum, GLenum)) SDL_PROC_UNUSED(void, glCallList, (GLuint)) SDL_PROC_UNUSED(void, glCallLists, (GLsizei, GLenum, const GLvoid *)) diff --git a/Engine/lib/sdl/src/render/opengl/SDL_render_gl.c b/Engine/lib/sdl/src/render/opengl/SDL_render_gl.c index 1ca2cb5c4..1c379eb25 100644 --- a/Engine/lib/sdl/src/render/opengl/SDL_render_gl.c +++ b/Engine/lib/sdl/src/render/opengl/SDL_render_gl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -55,6 +55,7 @@ static SDL_Renderer *GL_CreateRenderer(SDL_Window * window, Uint32 flags); static void GL_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event); static int GL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h); +static SDL_bool GL_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode); static int GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, @@ -126,7 +127,7 @@ typedef struct struct { GL_Shader shader; Uint32 color; - int blendMode; + SDL_BlendMode blendMode; } current; SDL_bool GL_EXT_framebuffer_object_supported; @@ -259,10 +260,8 @@ GL_CheckAllErrors (const char *prefix, SDL_Renderer *renderer, const char *file, #if 0 #define GL_CheckError(prefix, renderer) -#elif defined(_MSC_VER) -#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, __FILE__, __LINE__, __FUNCTION__) #else -#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, __FILE__, __LINE__, __PRETTY_FUNCTION__) +#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, SDL_FILE, SDL_LINE, SDL_FUNCTION) #endif static int @@ -275,7 +274,7 @@ GL_LoadFunctions(GL_RenderData * data) do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - return SDL_SetError("Couldn't load GL function %s: %s\n", #func, SDL_GetError()); \ + return SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \ } \ } while ( 0 ); #endif /* __SDL_NOGETPROCADDR__ */ @@ -320,8 +319,8 @@ GL_ResetState(SDL_Renderer *renderer) } data->current.shader = SHADER_NONE; - data->current.color = 0; - data->current.blendMode = -1; + data->current.color = 0xffffffff; + data->current.blendMode = SDL_BLENDMODE_INVALID; data->glDisable(GL_DEPTH_TEST); data->glDisable(GL_CULL_FACE); @@ -428,6 +427,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->WindowEvent = GL_WindowEvent; renderer->GetOutputSize = GL_GetOutputSize; + renderer->SupportsBlendMode = GL_SupportsBlendMode; renderer->CreateTexture = GL_CreateTexture; renderer->UpdateTexture = GL_UpdateTexture; renderer->UpdateTextureYUV = GL_UpdateTextureYUV; @@ -493,7 +493,7 @@ GL_CreateRenderer(SDL_Window * window, Uint32 flags) PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc = (PFNGLDEBUGMESSAGECALLBACKARBPROC) SDL_GL_GetProcAddress("glDebugMessageCallbackARB"); data->GL_ARB_debug_output_supported = SDL_TRUE; - data->glGetPointerv(GL_DEBUG_CALLBACK_FUNCTION_ARB, (GLvoid **)&data->next_error_callback); + data->glGetPointerv(GL_DEBUG_CALLBACK_FUNCTION_ARB, (GLvoid **)(char *)&data->next_error_callback); data->glGetPointerv(GL_DEBUG_CALLBACK_USER_PARAM_ARB, &data->next_error_userparam); glDebugMessageCallbackARBFunc(GL_HandleDebugMessage, renderer); @@ -595,6 +595,72 @@ GL_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) return 0; } +static GLenum GetBlendFunc(SDL_BlendFactor factor) +{ + switch (factor) { + case SDL_BLENDFACTOR_ZERO: + return GL_ZERO; + case SDL_BLENDFACTOR_ONE: + return GL_ONE; + case SDL_BLENDFACTOR_SRC_COLOR: + return GL_SRC_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: + return GL_ONE_MINUS_SRC_COLOR; + case SDL_BLENDFACTOR_SRC_ALPHA: + return GL_SRC_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: + return GL_ONE_MINUS_SRC_ALPHA; + case SDL_BLENDFACTOR_DST_COLOR: + return GL_DST_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: + return GL_ONE_MINUS_DST_COLOR; + case SDL_BLENDFACTOR_DST_ALPHA: + return GL_DST_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: + return GL_ONE_MINUS_DST_ALPHA; + default: + return GL_INVALID_ENUM; + } +} + +static GLenum GetBlendEquation(SDL_BlendOperation operation) +{ + switch (operation) { + case SDL_BLENDOPERATION_ADD: + return GL_FUNC_ADD; + case SDL_BLENDOPERATION_SUBTRACT: + return GL_FUNC_SUBTRACT; + case SDL_BLENDOPERATION_REV_SUBTRACT: + return GL_FUNC_REVERSE_SUBTRACT; + default: + return GL_INVALID_ENUM; + } +} + +static SDL_bool +GL_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (GetBlendFunc(srcColorFactor) == GL_INVALID_ENUM || + GetBlendFunc(srcAlphaFactor) == GL_INVALID_ENUM || + GetBlendEquation(colorOperation) == GL_INVALID_ENUM || + GetBlendFunc(dstColorFactor) == GL_INVALID_ENUM || + GetBlendFunc(dstAlphaFactor) == GL_INVALID_ENUM || + GetBlendEquation(alphaOperation) == GL_INVALID_ENUM) { + return SDL_FALSE; + } + if (colorOperation != alphaOperation) { + return SDL_FALSE; + } + return SDL_TRUE; +} + SDL_FORCE_INLINE int power_of_2(int input) { @@ -684,12 +750,12 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) if (texture->format == SDL_PIXELFORMAT_YV12 || texture->format == SDL_PIXELFORMAT_IYUV) { /* Need to add size for the U and V planes */ - size += (2 * (texture->h * data->pitch) / 4); + size += 2 * ((texture->h + 1) / 2) * ((data->pitch + 1) / 2); } if (texture->format == SDL_PIXELFORMAT_NV12 || texture->format == SDL_PIXELFORMAT_NV21) { /* Need to add size for the U/V plane */ - size += ((texture->h * data->pitch) / 2); + size += 2 * ((texture->h + 1) / 2) * ((data->pitch + 1) / 2); } data->pixels = SDL_calloc(1, size); if (!data->pixels) { @@ -807,8 +873,8 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w/2, - texture_h/2, 0, format, type, NULL); + renderdata->glTexImage2D(data->type, 0, internalFormat, (texture_w+1)/2, + (texture_h+1)/2, 0, format, type, NULL); renderdata->glBindTexture(data->type, data->vtexture); renderdata->glTexParameteri(data->type, GL_TEXTURE_MIN_FILTER, @@ -819,8 +885,8 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->type, 0, internalFormat, texture_w/2, - texture_h/2, 0, format, type, NULL); + renderdata->glTexImage2D(data->type, 0, internalFormat, (texture_w+1)/2, + (texture_h+1)/2, 0, format, type, NULL); renderdata->glDisable(data->type); } @@ -841,8 +907,8 @@ GL_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->type, 0, GL_LUMINANCE_ALPHA, texture_w/2, - texture_h/2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL); + renderdata->glTexImage2D(data->type, 0, GL_LUMINANCE_ALPHA, (texture_w+1)/2, + (texture_h+1)/2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL); renderdata->glDisable(data->type); } @@ -869,7 +935,7 @@ GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, rect->h, data->format, data->formattype, pixels); if (data->yuv) { - renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, (pitch / 2)); + renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, ((pitch + 1) / 2)); /* Skip to the correct offset into the next texture */ pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); @@ -879,29 +945,29 @@ GL_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, renderdata->glBindTexture(data->type, data->utexture); } renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2, - rect->w/2, rect->h/2, + (rect->w+1)/2, (rect->h+1)/2, data->format, data->formattype, pixels); /* Skip to the correct offset into the next texture */ - pixels = (const void*)((const Uint8*)pixels + (rect->h * pitch)/4); + pixels = (const void*)((const Uint8*)pixels + ((rect->h + 1) / 2) * ((pitch + 1) / 2)); if (texture->format == SDL_PIXELFORMAT_YV12) { renderdata->glBindTexture(data->type, data->utexture); } else { renderdata->glBindTexture(data->type, data->vtexture); } renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2, - rect->w/2, rect->h/2, + (rect->w+1)/2, (rect->h+1)/2, data->format, data->formattype, pixels); } if (data->nv12) { - renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, (pitch / 2)); + renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, ((pitch + 1) / 2)); /* Skip to the correct offset into the next texture */ pixels = (const void*)((const Uint8*)pixels + rect->h * pitch); renderdata->glBindTexture(data->type, data->utexture); renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2, - rect->w/2, rect->h/2, + (rect->w + 1)/2, (rect->h + 1)/2, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, pixels); } renderdata->glDisable(data->type); @@ -932,13 +998,13 @@ GL_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, Upitch); renderdata->glBindTexture(data->type, data->utexture); renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2, - rect->w/2, rect->h/2, + (rect->w + 1)/2, (rect->h + 1)/2, data->format, data->formattype, Uplane); renderdata->glPixelStorei(GL_UNPACK_ROW_LENGTH, Vpitch); renderdata->glBindTexture(data->type, data->vtexture); renderdata->glTexSubImage2D(data->type, 0, rect->x/2, rect->y/2, - rect->w/2, rect->h/2, + (rect->w + 1)/2, (rect->h + 1)/2, data->format, data->formattype, Vplane); renderdata->glDisable(data->type); @@ -1041,6 +1107,8 @@ GL_UpdateViewport(SDL_Renderer * renderer) 0.0, 1.0); } } + data->glMatrixMode(GL_MODELVIEW); + return GL_CheckError("", renderer); } @@ -1090,25 +1158,18 @@ GL_SetColor(GL_RenderData * data, Uint8 r, Uint8 g, Uint8 b, Uint8 a) } static void -GL_SetBlendMode(GL_RenderData * data, int blendMode) +GL_SetBlendMode(GL_RenderData * data, SDL_BlendMode blendMode) { if (blendMode != data->current.blendMode) { - switch (blendMode) { - case SDL_BLENDMODE_NONE: + if (blendMode == SDL_BLENDMODE_NONE) { data->glDisable(GL_BLEND); - break; - case SDL_BLENDMODE_BLEND: + } else { data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - break; - case SDL_BLENDMODE_ADD: - data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_ONE); - break; - case SDL_BLENDMODE_MOD: - data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GL_ZERO, GL_SRC_COLOR, GL_ZERO, GL_ONE); - break; + data->glBlendFuncSeparate(GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blendMode))); + data->glBlendEquation(GetBlendEquation(SDL_GetBlendModeColorOperation(blendMode))); } data->current.blendMode = blendMode; } @@ -1286,13 +1347,37 @@ GL_SetupCopy(SDL_Renderer * renderer, SDL_Texture * texture) GL_SetBlendMode(data, texture->blendMode); - if (texturedata->yuv) { - GL_SetShader(data, SHADER_YUV); - } else if (texturedata->nv12) { - if (texture->format == SDL_PIXELFORMAT_NV12) { - GL_SetShader(data, SHADER_NV12); - } else { - GL_SetShader(data, SHADER_NV21); + if (texturedata->yuv || texturedata->nv12) { + switch (SDL_GetYUVConversionModeForResolution(texture->w, texture->h)) { + case SDL_YUV_CONVERSION_JPEG: + if (texturedata->yuv) { + GL_SetShader(data, SHADER_YUV_JPEG); + } else if (texture->format == SDL_PIXELFORMAT_NV12) { + GL_SetShader(data, SHADER_NV12_JPEG); + } else { + GL_SetShader(data, SHADER_NV21_JPEG); + } + break; + case SDL_YUV_CONVERSION_BT601: + if (texturedata->yuv) { + GL_SetShader(data, SHADER_YUV_BT601); + } else if (texture->format == SDL_PIXELFORMAT_NV12) { + GL_SetShader(data, SHADER_NV12_BT601); + } else { + GL_SetShader(data, SHADER_NV21_BT601); + } + break; + case SDL_YUV_CONVERSION_BT709: + if (texturedata->yuv) { + GL_SetShader(data, SHADER_YUV_BT709); + } else if (texture->format == SDL_PIXELFORMAT_NV12) { + GL_SetShader(data, SHADER_NV12_BT709); + } else { + GL_SetShader(data, SHADER_NV21_BT709); + } + break; + default: + return SDL_SetError("Unsupported YUV conversion mode"); } } else { GL_SetShader(data, SHADER_RGB); @@ -1430,18 +1515,21 @@ GL_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, GL_ActivateRenderer(renderer); + if (!convert_format(data, temp_format, &internalFormat, &format, &type)) { + return SDL_SetError("Texture format %s not supported by OpenGL", + SDL_GetPixelFormatName(temp_format)); + } + + if (!rect->w || !rect->h) { + return 0; /* nothing to do. */ + } + temp_pitch = rect->w * SDL_BYTESPERPIXEL(temp_format); temp_pixels = SDL_malloc(rect->h * temp_pitch); if (!temp_pixels) { return SDL_OutOfMemory(); } - if (!convert_format(data, temp_format, &internalFormat, &format, &type)) { - SDL_free(temp_pixels); - return SDL_SetError("Texture format %s not supported by OpenGL", - SDL_GetPixelFormatName(temp_format)); - } - SDL_GetRendererOutputSize(renderer, &w, &h); data->glPixelStorei(GL_PACK_ALIGNMENT, 1); @@ -1518,6 +1606,11 @@ GL_DestroyRenderer(SDL_Renderer * renderer) GL_RenderData *data = (GL_RenderData *) renderer->driverdata; if (data) { + if (data->context != NULL) { + /* make sure we delete the right resources! */ + GL_ActivateRenderer(renderer); + } + GL_ClearErrors(renderer); if (data->GL_ARB_debug_output_supported) { PFNGLDEBUGMESSAGECALLBACKARBPROC glDebugMessageCallbackARBFunc = (PFNGLDEBUGMESSAGECALLBACKARBPROC) SDL_GL_GetProcAddress("glDebugMessageCallbackARB"); diff --git a/Engine/lib/sdl/src/render/opengl/SDL_shaders_gl.c b/Engine/lib/sdl/src/render/opengl/SDL_shaders_gl.c index bcf7b4315..251b54d13 100644 --- a/Engine/lib/sdl/src/render/opengl/SDL_shaders_gl.c +++ b/Engine/lib/sdl/src/render/opengl/SDL_shaders_gl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -62,6 +62,151 @@ struct GL_ShaderContext GL_ShaderData shaders[NUM_SHADERS]; }; +#define COLOR_VERTEX_SHADER \ +"varying vec4 v_color;\n" \ +"\n" \ +"void main()\n" \ +"{\n" \ +" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" \ +" v_color = gl_Color;\n" \ +"}" \ + +#define TEXTURE_VERTEX_SHADER \ +"varying vec4 v_color;\n" \ +"varying vec2 v_texCoord;\n" \ +"\n" \ +"void main()\n" \ +"{\n" \ +" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" \ +" v_color = gl_Color;\n" \ +" v_texCoord = vec2(gl_MultiTexCoord0);\n" \ +"}" \ + +#define JPEG_SHADER_CONSTANTS \ +"// YUV offset \n" \ +"const vec3 offset = vec3(0, -0.501960814, -0.501960814);\n" \ +"\n" \ +"// RGB coefficients \n" \ +"const vec3 Rcoeff = vec3(1, 0.000, 1.402);\n" \ +"const vec3 Gcoeff = vec3(1, -0.3441, -0.7141);\n" \ +"const vec3 Bcoeff = vec3(1, 1.772, 0.000);\n" \ + +#define BT601_SHADER_CONSTANTS \ +"// YUV offset \n" \ +"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \ +"\n" \ +"// RGB coefficients \n" \ +"const vec3 Rcoeff = vec3(1.1644, 0.000, 1.596);\n" \ +"const vec3 Gcoeff = vec3(1.1644, -0.3918, -0.813);\n" \ +"const vec3 Bcoeff = vec3(1.1644, 2.0172, 0.000);\n" \ + +#define BT709_SHADER_CONSTANTS \ +"// YUV offset \n" \ +"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \ +"\n" \ +"// RGB coefficients \n" \ +"const vec3 Rcoeff = vec3(1.1644, 0.000, 1.7927);\n" \ +"const vec3 Gcoeff = vec3(1.1644, -0.2132, -0.5329);\n" \ +"const vec3 Bcoeff = vec3(1.1644, 2.1124, 0.000);\n" \ + +#define YUV_SHADER_PROLOGUE \ +"varying vec4 v_color;\n" \ +"varying vec2 v_texCoord;\n" \ +"uniform sampler2D tex0; // Y \n" \ +"uniform sampler2D tex1; // U \n" \ +"uniform sampler2D tex2; // V \n" \ +"\n" \ + +#define YUV_SHADER_BODY \ +"\n" \ +"void main()\n" \ +"{\n" \ +" vec2 tcoord;\n" \ +" vec3 yuv, rgb;\n" \ +"\n" \ +" // Get the Y value \n" \ +" tcoord = v_texCoord;\n" \ +" yuv.x = texture2D(tex0, tcoord).r;\n" \ +"\n" \ +" // Get the U and V values \n" \ +" tcoord *= UVCoordScale;\n" \ +" yuv.y = texture2D(tex1, tcoord).r;\n" \ +" yuv.z = texture2D(tex2, tcoord).r;\n" \ +"\n" \ +" // Do the color transform \n" \ +" yuv += offset;\n" \ +" rgb.r = dot(yuv, Rcoeff);\n" \ +" rgb.g = dot(yuv, Gcoeff);\n" \ +" rgb.b = dot(yuv, Bcoeff);\n" \ +"\n" \ +" // That was easy. :) \n" \ +" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" \ +"}" \ + +#define NV12_SHADER_PROLOGUE \ +"varying vec4 v_color;\n" \ +"varying vec2 v_texCoord;\n" \ +"uniform sampler2D tex0; // Y \n" \ +"uniform sampler2D tex1; // U/V \n" \ +"\n" \ + +#define NV12_SHADER_BODY \ +"\n" \ +"void main()\n" \ +"{\n" \ +" vec2 tcoord;\n" \ +" vec3 yuv, rgb;\n" \ +"\n" \ +" // Get the Y value \n" \ +" tcoord = v_texCoord;\n" \ +" yuv.x = texture2D(tex0, tcoord).r;\n" \ +"\n" \ +" // Get the U and V values \n" \ +" tcoord *= UVCoordScale;\n" \ +" yuv.yz = texture2D(tex1, tcoord).ra;\n" \ +"\n" \ +" // Do the color transform \n" \ +" yuv += offset;\n" \ +" rgb.r = dot(yuv, Rcoeff);\n" \ +" rgb.g = dot(yuv, Gcoeff);\n" \ +" rgb.b = dot(yuv, Bcoeff);\n" \ +"\n" \ +" // That was easy. :) \n" \ +" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" \ +"}" \ + +#define NV21_SHADER_PROLOGUE \ +"varying vec4 v_color;\n" \ +"varying vec2 v_texCoord;\n" \ +"uniform sampler2D tex0; // Y \n" \ +"uniform sampler2D tex1; // U/V \n" \ +"\n" \ + +#define NV21_SHADER_BODY \ +"\n" \ +"void main()\n" \ +"{\n" \ +" vec2 tcoord;\n" \ +" vec3 yuv, rgb;\n" \ +"\n" \ +" // Get the Y value \n" \ +" tcoord = v_texCoord;\n" \ +" yuv.x = texture2D(tex0, tcoord).r;\n" \ +"\n" \ +" // Get the U and V values \n" \ +" tcoord *= UVCoordScale;\n" \ +" yuv.yz = texture2D(tex1, tcoord).ar;\n" \ +"\n" \ +" // Do the color transform \n" \ +" yuv += offset;\n" \ +" rgb.r = dot(yuv, Rcoeff);\n" \ +" rgb.g = dot(yuv, Gcoeff);\n" \ +" rgb.b = dot(yuv, Bcoeff);\n" \ +"\n" \ +" // That was easy. :) \n" \ +" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" \ +"}" \ + /* * NOTE: Always use sampler2D, etc here. We'll #define them to the * texture_rectangle versions if we choose to use that extension. @@ -74,13 +219,7 @@ static const char *shader_source[NUM_SHADERS][2] = /* SHADER_SOLID */ { /* vertex shader */ -"varying vec4 v_color;\n" -"\n" -"void main()\n" -"{\n" -" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" -" v_color = gl_Color;\n" -"}", + COLOR_VERTEX_SHADER, /* fragment shader */ "varying vec4 v_color;\n" "\n" @@ -93,15 +232,7 @@ static const char *shader_source[NUM_SHADERS][2] = /* SHADER_RGB */ { /* vertex shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"\n" -"void main()\n" -"{\n" -" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" -" v_color = gl_Color;\n" -" v_texCoord = vec2(gl_MultiTexCoord0);\n" -"}", + TEXTURE_VERTEX_SHADER, /* fragment shader */ "varying vec4 v_color;\n" "varying vec2 v_texCoord;\n" @@ -113,156 +244,86 @@ static const char *shader_source[NUM_SHADERS][2] = "}" }, - /* SHADER_YUV */ + /* SHADER_YUV_JPEG */ { /* vertex shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"\n" -"void main()\n" -"{\n" -" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" -" v_color = gl_Color;\n" -" v_texCoord = vec2(gl_MultiTexCoord0);\n" -"}", + TEXTURE_VERTEX_SHADER, /* fragment shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"uniform sampler2D tex0; // Y \n" -"uniform sampler2D tex1; // U \n" -"uniform sampler2D tex2; // V \n" -"\n" -"// YUV offset \n" -"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" -"\n" -"// RGB coefficients \n" -"const vec3 Rcoeff = vec3(1.164, 0.000, 1.596);\n" -"const vec3 Gcoeff = vec3(1.164, -0.391, -0.813);\n" -"const vec3 Bcoeff = vec3(1.164, 2.018, 0.000);\n" -"\n" -"void main()\n" -"{\n" -" vec2 tcoord;\n" -" vec3 yuv, rgb;\n" -"\n" -" // Get the Y value \n" -" tcoord = v_texCoord;\n" -" yuv.x = texture2D(tex0, tcoord).r;\n" -"\n" -" // Get the U and V values \n" -" tcoord *= UVCoordScale;\n" -" yuv.y = texture2D(tex1, tcoord).r;\n" -" yuv.z = texture2D(tex2, tcoord).r;\n" -"\n" -" // Do the color transform \n" -" yuv += offset;\n" -" rgb.r = dot(yuv, Rcoeff);\n" -" rgb.g = dot(yuv, Gcoeff);\n" -" rgb.b = dot(yuv, Bcoeff);\n" -"\n" -" // That was easy. :) \n" -" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" -"}" + YUV_SHADER_PROLOGUE + JPEG_SHADER_CONSTANTS + YUV_SHADER_BODY }, - - /* SHADER_NV12 */ + /* SHADER_YUV_BT601 */ { /* vertex shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"\n" -"void main()\n" -"{\n" -" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" -" v_color = gl_Color;\n" -" v_texCoord = vec2(gl_MultiTexCoord0);\n" -"}", + TEXTURE_VERTEX_SHADER, /* fragment shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"uniform sampler2D tex0; // Y \n" -"uniform sampler2D tex1; // U/V \n" -"\n" -"// YUV offset \n" -"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" -"\n" -"// RGB coefficients \n" -"const vec3 Rcoeff = vec3(1.164, 0.000, 1.596);\n" -"const vec3 Gcoeff = vec3(1.164, -0.391, -0.813);\n" -"const vec3 Bcoeff = vec3(1.164, 2.018, 0.000);\n" -"\n" -"void main()\n" -"{\n" -" vec2 tcoord;\n" -" vec3 yuv, rgb;\n" -"\n" -" // Get the Y value \n" -" tcoord = v_texCoord;\n" -" yuv.x = texture2D(tex0, tcoord).r;\n" -"\n" -" // Get the U and V values \n" -" tcoord *= UVCoordScale;\n" -" yuv.yz = texture2D(tex1, tcoord).ra;\n" -"\n" -" // Do the color transform \n" -" yuv += offset;\n" -" rgb.r = dot(yuv, Rcoeff);\n" -" rgb.g = dot(yuv, Gcoeff);\n" -" rgb.b = dot(yuv, Bcoeff);\n" -"\n" -" // That was easy. :) \n" -" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" -"}" + YUV_SHADER_PROLOGUE + BT601_SHADER_CONSTANTS + YUV_SHADER_BODY }, - - /* SHADER_NV21 */ + /* SHADER_YUV_BT709 */ { /* vertex shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"\n" -"void main()\n" -"{\n" -" gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;\n" -" v_color = gl_Color;\n" -" v_texCoord = vec2(gl_MultiTexCoord0);\n" -"}", + TEXTURE_VERTEX_SHADER, /* fragment shader */ -"varying vec4 v_color;\n" -"varying vec2 v_texCoord;\n" -"uniform sampler2D tex0; // Y \n" -"uniform sampler2D tex1; // U/V \n" -"\n" -"// YUV offset \n" -"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" -"\n" -"// RGB coefficients \n" -"const vec3 Rcoeff = vec3(1.164, 0.000, 1.596);\n" -"const vec3 Gcoeff = vec3(1.164, -0.391, -0.813);\n" -"const vec3 Bcoeff = vec3(1.164, 2.018, 0.000);\n" -"\n" -"void main()\n" -"{\n" -" vec2 tcoord;\n" -" vec3 yuv, rgb;\n" -"\n" -" // Get the Y value \n" -" tcoord = v_texCoord;\n" -" yuv.x = texture2D(tex0, tcoord).r;\n" -"\n" -" // Get the U and V values \n" -" tcoord *= UVCoordScale;\n" -" yuv.yz = texture2D(tex1, tcoord).ar;\n" -"\n" -" // Do the color transform \n" -" yuv += offset;\n" -" rgb.r = dot(yuv, Rcoeff);\n" -" rgb.g = dot(yuv, Gcoeff);\n" -" rgb.b = dot(yuv, Bcoeff);\n" -"\n" -" // That was easy. :) \n" -" gl_FragColor = vec4(rgb, 1.0) * v_color;\n" -"}" + YUV_SHADER_PROLOGUE + BT709_SHADER_CONSTANTS + YUV_SHADER_BODY + }, + /* SHADER_NV12_JPEG */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + NV12_SHADER_PROLOGUE + JPEG_SHADER_CONSTANTS + NV12_SHADER_BODY + }, + /* SHADER_NV12_BT601 */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + NV12_SHADER_PROLOGUE + BT601_SHADER_CONSTANTS + NV12_SHADER_BODY + }, + /* SHADER_NV12_BT709 */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + NV12_SHADER_PROLOGUE + BT709_SHADER_CONSTANTS + NV12_SHADER_BODY + }, + /* SHADER_NV21_JPEG */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + NV21_SHADER_PROLOGUE + JPEG_SHADER_CONSTANTS + NV21_SHADER_BODY + }, + /* SHADER_NV21_BT601 */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + NV21_SHADER_PROLOGUE + BT601_SHADER_CONSTANTS + NV21_SHADER_BODY + }, + /* SHADER_NV21_BT709 */ + { + /* vertex shader */ + TEXTURE_VERTEX_SHADER, + /* fragment shader */ + NV21_SHADER_PROLOGUE + BT709_SHADER_CONSTANTS + NV21_SHADER_BODY }, }; @@ -369,7 +430,7 @@ DestroyShaderProgram(GL_ShaderContext *ctx, GL_ShaderData *data) } GL_ShaderContext * -GL_CreateShaderContext() +GL_CreateShaderContext(void) { GL_ShaderContext *ctx; SDL_bool shaders_supported; diff --git a/Engine/lib/sdl/src/render/opengl/SDL_shaders_gl.h b/Engine/lib/sdl/src/render/opengl/SDL_shaders_gl.h index 261627cc7..9805c599c 100644 --- a/Engine/lib/sdl/src/render/opengl/SDL_shaders_gl.h +++ b/Engine/lib/sdl/src/render/opengl/SDL_shaders_gl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,15 +26,21 @@ typedef enum { SHADER_NONE, SHADER_SOLID, SHADER_RGB, - SHADER_YUV, - SHADER_NV12, - SHADER_NV21, + SHADER_YUV_JPEG, + SHADER_YUV_BT601, + SHADER_YUV_BT709, + SHADER_NV12_JPEG, + SHADER_NV12_BT601, + SHADER_NV12_BT709, + SHADER_NV21_JPEG, + SHADER_NV21_BT601, + SHADER_NV21_BT709, NUM_SHADERS } GL_Shader; typedef struct GL_ShaderContext GL_ShaderContext; -extern GL_ShaderContext * GL_CreateShaderContext(); +extern GL_ShaderContext * GL_CreateShaderContext(void); extern void GL_SelectShader(GL_ShaderContext *ctx, GL_Shader shader); extern void GL_DestroyShaderContext(GL_ShaderContext *ctx); diff --git a/Engine/lib/sdl/src/render/opengles/SDL_glesfuncs.h b/Engine/lib/sdl/src/render/opengles/SDL_glesfuncs.h index a15d76d49..e00982b15 100644 --- a/Engine/lib/sdl/src/render/opengles/SDL_glesfuncs.h +++ b/Engine/lib/sdl/src/render/opengles/SDL_glesfuncs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,6 +21,8 @@ SDL_PROC(void, glBindTexture, (GLenum, GLuint)) SDL_PROC(void, glBlendFunc, (GLenum, GLenum)) +SDL_PROC_OES(void, glBlendEquationOES, (GLenum)) +SDL_PROC_OES(void, glBlendEquationSeparateOES, (GLenum, GLenum)) SDL_PROC_OES(void, glBlendFuncSeparateOES, (GLenum, GLenum, GLenum, GLenum)) SDL_PROC(void, glClear, (GLbitfield)) SDL_PROC(void, glClearColor, (GLclampf, GLclampf, GLclampf, GLclampf)) diff --git a/Engine/lib/sdl/src/render/opengles/SDL_render_gles.c b/Engine/lib/sdl/src/render/opengles/SDL_render_gles.c index 71f5b3a7a..d6bfca5d0 100644 --- a/Engine/lib/sdl/src/render/opengles/SDL_render_gles.c +++ b/Engine/lib/sdl/src/render/opengles/SDL_render_gles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -56,6 +56,7 @@ static SDL_Renderer *GLES_CreateRenderer(SDL_Window * window, Uint32 flags); static void GLES_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event); static int GLES_GetOutputSize(SDL_Renderer * renderer, int *w, int *h); +static SDL_bool GLES_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode); static int GLES_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture); static int GLES_UpdateTexture(SDL_Renderer * renderer, SDL_Texture * texture, const SDL_Rect * rect, const void *pixels, @@ -116,7 +117,7 @@ typedef struct SDL_GLContext context; struct { Uint32 color; - int blendMode; + SDL_BlendMode blendMode; SDL_bool tex_coords; } current; @@ -130,6 +131,8 @@ typedef struct GLuint window_framebuffer; SDL_bool GL_OES_blend_func_separate_supported; + SDL_bool GL_OES_blend_equation_separate_supported; + SDL_bool GL_OES_blend_subtract_supported; } GLES_RenderData; typedef struct @@ -197,7 +200,7 @@ static int GLES_LoadFunctions(GLES_RenderData * data) do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - return SDL_SetError("Couldn't load GLES function %s: %s\n", #func, SDL_GetError()); \ + return SDL_SetError("Couldn't load GLES function %s: %s", #func, SDL_GetError()); \ } \ } while ( 0 ); #define SDL_PROC_OES(ret,func,params) \ @@ -214,7 +217,7 @@ static int GLES_LoadFunctions(GLES_RenderData * data) static SDL_GLContext SDL_CurrentContext = NULL; -GLES_FBOList * +static GLES_FBOList * GLES_GetFBO(GLES_RenderData *data, Uint32 w, Uint32 h) { GLES_FBOList *result = data->framebuffers; @@ -261,8 +264,8 @@ GLES_ResetState(SDL_Renderer *renderer) GLES_ActivateRenderer(renderer); } - data->current.color = 0; - data->current.blendMode = -1; + data->current.color = 0xffffffff; + data->current.blendMode = SDL_BLENDMODE_INVALID; data->current.tex_coords = SDL_FALSE; data->glDisable(GL_DEPTH_TEST); @@ -319,6 +322,7 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) renderer->WindowEvent = GLES_WindowEvent; renderer->GetOutputSize = GLES_GetOutputSize; + renderer->SupportsBlendMode = GLES_SupportsBlendMode; renderer->CreateTexture = GLES_CreateTexture; renderer->UpdateTexture = GLES_UpdateTexture; renderer->LockTexture = GLES_LockTexture; @@ -388,6 +392,12 @@ GLES_CreateRenderer(SDL_Window * window, Uint32 flags) if (SDL_GL_ExtensionSupported("GL_OES_blend_func_separate")) { data->GL_OES_blend_func_separate_supported = SDL_TRUE; } + if (SDL_GL_ExtensionSupported("GL_OES_blend_equation_separate")) { + data->GL_OES_blend_equation_separate_supported = SDL_TRUE; + } + if (SDL_GL_ExtensionSupported("GL_OES_blend_subtract")) { + data->GL_OES_blend_subtract_supported = SDL_TRUE; + } /* Set up parameters for rendering */ GLES_ResetState(renderer); @@ -430,6 +440,79 @@ GLES_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) return 0; } +static GLenum GetBlendFunc(SDL_BlendFactor factor) +{ + switch (factor) { + case SDL_BLENDFACTOR_ZERO: + return GL_ZERO; + case SDL_BLENDFACTOR_ONE: + return GL_ONE; + case SDL_BLENDFACTOR_SRC_COLOR: + return GL_SRC_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: + return GL_ONE_MINUS_SRC_COLOR; + case SDL_BLENDFACTOR_SRC_ALPHA: + return GL_SRC_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: + return GL_ONE_MINUS_SRC_ALPHA; + case SDL_BLENDFACTOR_DST_COLOR: + return GL_DST_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: + return GL_ONE_MINUS_DST_COLOR; + case SDL_BLENDFACTOR_DST_ALPHA: + return GL_DST_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: + return GL_ONE_MINUS_DST_ALPHA; + default: + return GL_INVALID_ENUM; + } +} + +static GLenum GetBlendEquation(SDL_BlendOperation operation) +{ + switch (operation) { + case SDL_BLENDOPERATION_ADD: + return GL_FUNC_ADD_OES; + case SDL_BLENDOPERATION_SUBTRACT: + return GL_FUNC_SUBTRACT_OES; + case SDL_BLENDOPERATION_REV_SUBTRACT: + return GL_FUNC_REVERSE_SUBTRACT_OES; + default: + return GL_INVALID_ENUM; + } +} + +static SDL_bool +GLES_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata; + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (GetBlendFunc(srcColorFactor) == GL_INVALID_ENUM || + GetBlendFunc(srcAlphaFactor) == GL_INVALID_ENUM || + GetBlendEquation(colorOperation) == GL_INVALID_ENUM || + GetBlendFunc(dstColorFactor) == GL_INVALID_ENUM || + GetBlendFunc(dstAlphaFactor) == GL_INVALID_ENUM || + GetBlendEquation(alphaOperation) == GL_INVALID_ENUM) { + return SDL_FALSE; + } + if ((srcColorFactor != srcAlphaFactor || dstColorFactor != dstAlphaFactor) && !data->GL_OES_blend_func_separate_supported) { + return SDL_FALSE; + } + if (colorOperation != alphaOperation && !data->GL_OES_blend_equation_separate_supported) { + return SDL_FALSE; + } + if (colorOperation != SDL_BLENDOPERATION_ADD && !data->GL_OES_blend_subtract_supported) { + return SDL_FALSE; + } + return SDL_TRUE; +} + static SDL_INLINE int power_of_2(int input) { @@ -633,8 +716,6 @@ GLES_SetRenderTarget(SDL_Renderer * renderer, SDL_Texture * texture) GLES_TextureData *texturedata = NULL; GLenum status; - GLES_ActivateRenderer(renderer); - if (!data->GL_OES_framebuffer_object_supported) { return SDL_SetError("Can't enable render target support in this renderer"); } @@ -694,6 +775,8 @@ GLES_UpdateViewport(SDL_Renderer * renderer) 0.0, 1.0); } } + data->glMatrixMode(GL_MODELVIEW); + return 0; } @@ -739,37 +822,28 @@ GLES_SetColor(GLES_RenderData * data, Uint8 r, Uint8 g, Uint8 b, Uint8 a) } static void -GLES_SetBlendMode(GLES_RenderData * data, int blendMode) +GLES_SetBlendMode(GLES_RenderData * data, SDL_BlendMode blendMode) { if (blendMode != data->current.blendMode) { - switch (blendMode) { - case SDL_BLENDMODE_NONE: + if (blendMode == SDL_BLENDMODE_NONE) { data->glDisable(GL_BLEND); - break; - case SDL_BLENDMODE_BLEND: + } else { data->glEnable(GL_BLEND); if (data->GL_OES_blend_func_separate_supported) { - data->glBlendFuncSeparateOES(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + data->glBlendFuncSeparateOES(GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blendMode))); } else { - data->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + data->glBlendFunc(GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode))); } - break; - case SDL_BLENDMODE_ADD: - data->glEnable(GL_BLEND); - if (data->GL_OES_blend_func_separate_supported) { - data->glBlendFuncSeparateOES(GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_ONE); - } else { - data->glBlendFunc(GL_SRC_ALPHA, GL_ONE); + if (data->GL_OES_blend_equation_separate_supported) { + data->glBlendEquationSeparateOES(GetBlendEquation(SDL_GetBlendModeColorOperation(blendMode)), + GetBlendEquation(SDL_GetBlendModeAlphaOperation(blendMode))); + } else if (data->GL_OES_blend_subtract_supported) { + data->glBlendEquationOES(GetBlendEquation(SDL_GetBlendModeColorOperation(blendMode))); } - break; - case SDL_BLENDMODE_MOD: - data->glEnable(GL_BLEND); - if (data->GL_OES_blend_func_separate_supported) { - data->glBlendFuncSeparateOES(GL_ZERO, GL_SRC_COLOR, GL_ZERO, GL_ONE); - } else { - data->glBlendFunc(GL_ZERO, GL_SRC_COLOR); - } - break; } data->current.blendMode = blendMode; } diff --git a/Engine/lib/sdl/src/render/opengles2/SDL_gles2funcs.h b/Engine/lib/sdl/src/render/opengles2/SDL_gles2funcs.h index 0ecfa7f94..b6a143618 100644 --- a/Engine/lib/sdl/src/render/opengles2/SDL_gles2funcs.h +++ b/Engine/lib/sdl/src/render/opengles2/SDL_gles2funcs.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,6 +23,7 @@ SDL_PROC(void, glActiveTexture, (GLenum)) SDL_PROC(void, glAttachShader, (GLuint, GLuint)) SDL_PROC(void, glBindAttribLocation, (GLuint, GLuint, const char *)) SDL_PROC(void, glBindTexture, (GLenum, GLuint)) +SDL_PROC(void, glBlendEquationSeparate, (GLenum, GLenum)) SDL_PROC(void, glBlendFuncSeparate, (GLenum, GLenum, GLenum, GLenum)) SDL_PROC(void, glClear, (GLbitfield)) SDL_PROC(void, glClearColor, (GLclampf, GLclampf, GLclampf, GLclampf)) @@ -53,7 +54,11 @@ SDL_PROC(void, glPixelStorei, (GLenum, GLint)) SDL_PROC(void, glReadPixels, (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid*)) SDL_PROC(void, glScissor, (GLint, GLint, GLsizei, GLsizei)) SDL_PROC(void, glShaderBinary, (GLsizei, const GLuint *, GLenum, const void *, GLsizei)) +#if __NACL__ || __ANDROID__ +SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar **, const GLint *)) +#else SDL_PROC(void, glShaderSource, (GLuint, GLsizei, const GLchar* const*, const GLint *)) +#endif SDL_PROC(void, glTexImage2D, (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *)) SDL_PROC(void, glTexParameteri, (GLenum, GLenum, GLint)) SDL_PROC(void, glTexSubImage2D, (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) diff --git a/Engine/lib/sdl/src/render/opengles2/SDL_render_gles2.c b/Engine/lib/sdl/src/render/opengles2/SDL_render_gles2.c index c846a7b39..0cd388c37 100644 --- a/Engine/lib/sdl/src/render/opengles2/SDL_render_gles2.c +++ b/Engine/lib/sdl/src/render/opengles2/SDL_render_gles2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,6 +22,7 @@ #if SDL_VIDEO_RENDER_OGL_ES2 && !SDL_RENDER_DISABLED +#include "SDL_assert.h" #include "SDL_hints.h" #include "SDL_opengles2.h" #include "../SDL_sysrender.h" @@ -122,7 +123,6 @@ typedef struct GLES2_ShaderCache typedef struct GLES2_ProgramCacheEntry { GLuint id; - SDL_BlendMode blend_mode; GLES2_ShaderCacheEntry *vertex_shader; GLES2_ShaderCacheEntry *fragment_shader; GLuint uniform_locations[16]; @@ -167,7 +167,8 @@ typedef enum GLES2_IMAGESOURCE_TEXTURE_BGR, GLES2_IMAGESOURCE_TEXTURE_YUV, GLES2_IMAGESOURCE_TEXTURE_NV12, - GLES2_IMAGESOURCE_TEXTURE_NV21 + GLES2_IMAGESOURCE_TEXTURE_NV21, + GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES } GLES2_ImageSource; typedef struct GLES2_DriverContext @@ -177,7 +178,7 @@ typedef struct GLES2_DriverContext SDL_bool debug_enabled; struct { - int blendMode; + SDL_BlendMode blendMode; SDL_bool tex_coords; } current; @@ -259,10 +260,8 @@ GL_CheckAllErrors (const char *prefix, SDL_Renderer *renderer, const char *file, #if 0 #define GL_CheckError(prefix, renderer) -#elif defined(_MSC_VER) -#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, __FILE__, __LINE__, __FUNCTION__) #else -#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, __FILE__, __LINE__, __PRETTY_FUNCTION__) +#define GL_CheckError(prefix, renderer) GL_CheckAllErrors(prefix, renderer, SDL_FILE, SDL_LINE, SDL_FUNCTION) #endif @@ -297,7 +296,7 @@ static int GLES2_LoadFunctions(GLES2_DriverContext * data) do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - return SDL_SetError("Couldn't load GLES2 function %s: %s\n", #func, SDL_GetError()); \ + return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \ } \ } while ( 0 ); #endif /* __SDL_NOGETPROCADDR__ */ @@ -307,7 +306,7 @@ static int GLES2_LoadFunctions(GLES2_DriverContext * data) return 0; } -GLES2_FBOList * +static GLES2_FBOList * GLES2_GetFBO(GLES2_DriverContext *data, Uint32 w, Uint32 h) { GLES2_FBOList *result = data->framebuffers; @@ -372,6 +371,69 @@ GLES2_GetOutputSize(SDL_Renderer * renderer, int *w, int *h) return 0; } +static GLenum GetBlendFunc(SDL_BlendFactor factor) +{ + switch (factor) { + case SDL_BLENDFACTOR_ZERO: + return GL_ZERO; + case SDL_BLENDFACTOR_ONE: + return GL_ONE; + case SDL_BLENDFACTOR_SRC_COLOR: + return GL_SRC_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_COLOR: + return GL_ONE_MINUS_SRC_COLOR; + case SDL_BLENDFACTOR_SRC_ALPHA: + return GL_SRC_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: + return GL_ONE_MINUS_SRC_ALPHA; + case SDL_BLENDFACTOR_DST_COLOR: + return GL_DST_COLOR; + case SDL_BLENDFACTOR_ONE_MINUS_DST_COLOR: + return GL_ONE_MINUS_DST_COLOR; + case SDL_BLENDFACTOR_DST_ALPHA: + return GL_DST_ALPHA; + case SDL_BLENDFACTOR_ONE_MINUS_DST_ALPHA: + return GL_ONE_MINUS_DST_ALPHA; + default: + return GL_INVALID_ENUM; + } +} + +static GLenum GetBlendEquation(SDL_BlendOperation operation) +{ + switch (operation) { + case SDL_BLENDOPERATION_ADD: + return GL_FUNC_ADD; + case SDL_BLENDOPERATION_SUBTRACT: + return GL_FUNC_SUBTRACT; + case SDL_BLENDOPERATION_REV_SUBTRACT: + return GL_FUNC_REVERSE_SUBTRACT; + default: + return GL_INVALID_ENUM; + } +} + +static SDL_bool +GLES2_SupportsBlendMode(SDL_Renderer * renderer, SDL_BlendMode blendMode) +{ + SDL_BlendFactor srcColorFactor = SDL_GetBlendModeSrcColorFactor(blendMode); + SDL_BlendFactor srcAlphaFactor = SDL_GetBlendModeSrcAlphaFactor(blendMode); + SDL_BlendOperation colorOperation = SDL_GetBlendModeColorOperation(blendMode); + SDL_BlendFactor dstColorFactor = SDL_GetBlendModeDstColorFactor(blendMode); + SDL_BlendFactor dstAlphaFactor = SDL_GetBlendModeDstAlphaFactor(blendMode); + SDL_BlendOperation alphaOperation = SDL_GetBlendModeAlphaOperation(blendMode); + + if (GetBlendFunc(srcColorFactor) == GL_INVALID_ENUM || + GetBlendFunc(srcAlphaFactor) == GL_INVALID_ENUM || + GetBlendEquation(colorOperation) == GL_INVALID_ENUM || + GetBlendFunc(dstColorFactor) == GL_INVALID_ENUM || + GetBlendFunc(dstAlphaFactor) == GL_INVALID_ENUM || + GetBlendEquation(alphaOperation) == GL_INVALID_ENUM) { + return SDL_FALSE; + } + return SDL_TRUE; +} + static int GLES2_UpdateViewport(SDL_Renderer * renderer) { @@ -531,17 +593,32 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) format = GL_LUMINANCE; type = GL_UNSIGNED_BYTE; break; +#ifdef GL_TEXTURE_EXTERNAL_OES + case SDL_PIXELFORMAT_EXTERNAL_OES: + format = GL_NONE; + type = GL_NONE; + break; +#endif default: return SDL_SetError("Texture format not supported"); } + if (texture->format == SDL_PIXELFORMAT_EXTERNAL_OES && + texture->access != SDL_TEXTUREACCESS_STATIC) { + return SDL_SetError("Unsupported texture access for SDL_PIXELFORMAT_EXTERNAL_OES"); + } + /* Allocate a texture struct */ data = (GLES2_TextureData *)SDL_calloc(1, sizeof(GLES2_TextureData)); if (!data) { return SDL_OutOfMemory(); } data->texture = 0; +#ifdef GL_TEXTURE_EXTERNAL_OES + data->texture_type = (texture->format == SDL_PIXELFORMAT_EXTERNAL_OES) ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D; +#else data->texture_type = GL_TEXTURE_2D; +#endif data->pixel_format = format; data->pixel_type = type; data->yuv = ((texture->format == SDL_PIXELFORMAT_IYUV) || (texture->format == SDL_PIXELFORMAT_YV12)); @@ -557,11 +634,11 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) size = texture->h * data->pitch; if (data->yuv) { /* Need to add size for the U and V planes */ - size += (2 * (texture->h * data->pitch) / 4); + size += 2 * ((texture->h + 1) / 2) * ((data->pitch + 1) / 2); } if (data->nv12) { /* Need to add size for the U/V plane */ - size += ((texture->h * data->pitch) / 2); + size += 2 * ((texture->h + 1) / 2) * ((data->pitch + 1) / 2); } data->pixel_data = SDL_calloc(1, size); if (!data->pixel_data) { @@ -584,7 +661,7 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->texture_type, 0, format, texture->w / 2, texture->h / 2, 0, format, type, NULL); + renderdata->glTexImage2D(data->texture_type, 0, format, (texture->w + 1) / 2, (texture->h + 1) / 2, 0, format, type, NULL); renderdata->glGenTextures(1, &data->texture_u); if (GL_CheckError("glGenTexures()", renderer) < 0) { @@ -596,7 +673,7 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->texture_type, 0, format, texture->w / 2, texture->h / 2, 0, format, type, NULL); + renderdata->glTexImage2D(data->texture_type, 0, format, (texture->w + 1) / 2, (texture->h + 1) / 2, 0, format, type, NULL); if (GL_CheckError("glTexImage2D()", renderer) < 0) { return -1; } @@ -613,7 +690,7 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->texture_type, 0, GL_LUMINANCE_ALPHA, texture->w / 2, texture->h / 2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL); + renderdata->glTexImage2D(data->texture_type, 0, GL_LUMINANCE_ALPHA, (texture->w + 1) / 2, (texture->h + 1) / 2, 0, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, NULL); if (GL_CheckError("glTexImage2D()", renderer) < 0) { return -1; } @@ -630,9 +707,11 @@ GLES2_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture) renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_MAG_FILTER, scaleMode); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); renderdata->glTexParameteri(data->texture_type, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - renderdata->glTexImage2D(data->texture_type, 0, format, texture->w, texture->h, 0, format, type, NULL); - if (GL_CheckError("glTexImage2D()", renderer) < 0) { - return -1; + if (texture->format != SDL_PIXELFORMAT_EXTERNAL_OES) { + renderdata->glTexImage2D(data->texture_type, 0, format, texture->w, texture->h, 0, format, type, NULL); + if (GL_CheckError("glTexImage2D()", renderer) < 0) { + return -1; + } } if (texture->access == SDL_TEXTUREACCESS_TARGET) { @@ -713,14 +792,15 @@ GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect GLES2_TexSubImage2D(data, tdata->texture_type, rect->x / 2, rect->y / 2, - rect->w / 2, - rect->h / 2, + (rect->w + 1) / 2, + (rect->h + 1) / 2, tdata->pixel_format, tdata->pixel_type, - pixels, pitch / 2, 1); + pixels, (pitch + 1) / 2, 1); + /* Skip to the correct offset into the next texture */ - pixels = (const void*)((const Uint8*)pixels + (rect->h * pitch)/4); + pixels = (const void*)((const Uint8*)pixels + ((rect->h + 1) / 2) * ((pitch + 1)/2)); if (texture->format == SDL_PIXELFORMAT_YV12) { data->glBindTexture(tdata->texture_type, tdata->texture_u); } else { @@ -729,11 +809,11 @@ GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect GLES2_TexSubImage2D(data, tdata->texture_type, rect->x / 2, rect->y / 2, - rect->w / 2, - rect->h / 2, + (rect->w + 1) / 2, + (rect->h + 1) / 2, tdata->pixel_format, tdata->pixel_type, - pixels, pitch / 2, 1); + pixels, (pitch + 1) / 2, 1); } if (tdata->nv12) { @@ -743,11 +823,11 @@ GLES2_UpdateTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect GLES2_TexSubImage2D(data, tdata->texture_type, rect->x / 2, rect->y / 2, - rect->w / 2, - rect->h / 2, + (rect->w + 1) / 2, + (rect->h + 1) / 2, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, - pixels, pitch, 2); + pixels, 2 * ((pitch + 1) / 2), 2); } return GL_CheckError("glTexSubImage2D()", renderer); @@ -774,8 +854,8 @@ GLES2_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, GLES2_TexSubImage2D(data, tdata->texture_type, rect->x / 2, rect->y / 2, - rect->w / 2, - rect->h / 2, + (rect->w + 1) / 2, + (rect->h + 1) / 2, tdata->pixel_format, tdata->pixel_type, Vplane, Vpitch, 1); @@ -784,8 +864,8 @@ GLES2_UpdateTextureYUV(SDL_Renderer * renderer, SDL_Texture * texture, GLES2_TexSubImage2D(data, tdata->texture_type, rect->x / 2, rect->y / 2, - rect->w / 2, - rect->h / 2, + (rect->w + 1) / 2, + (rect->h + 1) / 2, tdata->pixel_format, tdata->pixel_type, Uplane, Upitch, 1); @@ -882,19 +962,16 @@ GLES2_DestroyTexture(SDL_Renderer *renderer, SDL_Texture *texture) * Shader management functions * *************************************************************************************************/ -static GLES2_ShaderCacheEntry *GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type, - SDL_BlendMode blendMode); +static GLES2_ShaderCacheEntry *GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type); static void GLES2_EvictShader(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *entry); static GLES2_ProgramCacheEntry *GLES2_CacheProgram(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *vertex, - GLES2_ShaderCacheEntry *fragment, - SDL_BlendMode blendMode); -static int GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, - SDL_BlendMode blendMode); + GLES2_ShaderCacheEntry *fragment); +static int GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, int w, int h); static GLES2_ProgramCacheEntry * GLES2_CacheProgram(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *vertex, - GLES2_ShaderCacheEntry *fragment, SDL_BlendMode blendMode) + GLES2_ShaderCacheEntry *fragment) { GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata; GLES2_ProgramCacheEntry *entry; @@ -933,7 +1010,6 @@ GLES2_CacheProgram(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *vertex, } entry->vertex_shader = vertex; entry->fragment_shader = fragment; - entry->blend_mode = blendMode; /* Create the program and link it */ entry->id = data->glCreateProgram(); @@ -1011,7 +1087,7 @@ GLES2_CacheProgram(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *vertex, } static GLES2_ShaderCacheEntry * -GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type, SDL_BlendMode blendMode) +GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type) { GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata; const GLES2_Shader *shader; @@ -1021,7 +1097,7 @@ GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type, SDL_BlendMode b int i, j; /* Find the corresponding shader */ - shader = GLES2_GetShader(type, blendMode); + shader = GLES2_GetShader(type); if (!shader) { SDL_SetError("No shader matching the requested characteristics was found"); return NULL; @@ -1068,7 +1144,7 @@ GLES2_CacheShader(SDL_Renderer *renderer, GLES2_ShaderType type, SDL_BlendMode b /* Compile or load the selected shader instance */ entry->id = data->glCreateShader(instance->type); if (instance->format == (GLenum)-1) { - data->glShaderSource(entry->id, 1, (const char **)&instance->data, NULL); + data->glShaderSource(entry->id, 1, (const char **)(char *)&instance->data, NULL); data->glCompileShader(entry->id); data->glGetShaderiv(entry->id, GL_COMPILE_STATUS, &compileSuccessful); } else { @@ -1130,7 +1206,7 @@ GLES2_EvictShader(SDL_Renderer *renderer, GLES2_ShaderCacheEntry *entry) } static int -GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, SDL_BlendMode blendMode) +GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, int w, int h) { GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata; GLES2_ShaderCacheEntry *vertex = NULL; @@ -1157,24 +1233,66 @@ GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, SDL_BlendM ftype = GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC; break; case GLES2_IMAGESOURCE_TEXTURE_YUV: - ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_SRC; + switch (SDL_GetYUVConversionModeForResolution(w, h)) { + case SDL_YUV_CONVERSION_JPEG: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG_SRC; + break; + case SDL_YUV_CONVERSION_BT601: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601_SRC; + break; + case SDL_YUV_CONVERSION_BT709: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709_SRC; + break; + default: + SDL_SetError("Unsupported YUV conversion mode: %d\n", SDL_GetYUVConversionModeForResolution(w, h)); + goto fault; + } break; case GLES2_IMAGESOURCE_TEXTURE_NV12: - ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_SRC; + switch (SDL_GetYUVConversionModeForResolution(w, h)) { + case SDL_YUV_CONVERSION_JPEG: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_JPEG_SRC; + break; + case SDL_YUV_CONVERSION_BT601: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT601_SRC; + break; + case SDL_YUV_CONVERSION_BT709: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT709_SRC; + break; + default: + SDL_SetError("Unsupported YUV conversion mode: %d\n", SDL_GetYUVConversionModeForResolution(w, h)); + goto fault; + } break; case GLES2_IMAGESOURCE_TEXTURE_NV21: - ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_SRC; + switch (SDL_GetYUVConversionModeForResolution(w, h)) { + case SDL_YUV_CONVERSION_JPEG: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG_SRC; + break; + case SDL_YUV_CONVERSION_BT601: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601_SRC; + break; + case SDL_YUV_CONVERSION_BT709: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709_SRC; + break; + default: + SDL_SetError("Unsupported YUV conversion mode: %d\n", SDL_GetYUVConversionModeForResolution(w, h)); + goto fault; + } + break; + case GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES: + ftype = GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES_SRC; break; default: goto fault; } /* Load the requested shaders */ - vertex = GLES2_CacheShader(renderer, vtype, blendMode); + vertex = GLES2_CacheShader(renderer, vtype); if (!vertex) { goto fault; } - fragment = GLES2_CacheShader(renderer, ftype, blendMode); + fragment = GLES2_CacheShader(renderer, ftype); if (!fragment) { goto fault; } @@ -1187,7 +1305,7 @@ GLES2_SelectProgram(SDL_Renderer *renderer, GLES2_ImageSource source, SDL_BlendM } /* Generate a matching program */ - program = GLES2_CacheProgram(renderer, vertex, fragment, blendMode); + program = GLES2_CacheProgram(renderer, vertex, fragment); if (!program) { goto fault; } @@ -1341,26 +1459,19 @@ GLES2_RenderClear(SDL_Renderer * renderer) } static void -GLES2_SetBlendMode(GLES2_DriverContext *data, int blendMode) +GLES2_SetBlendMode(GLES2_DriverContext *data, SDL_BlendMode blendMode) { if (blendMode != data->current.blendMode) { - switch (blendMode) { - default: - case SDL_BLENDMODE_NONE: + if (blendMode == SDL_BLENDMODE_NONE) { data->glDisable(GL_BLEND); - break; - case SDL_BLENDMODE_BLEND: + } else { data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - break; - case SDL_BLENDMODE_ADD: - data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ZERO, GL_ONE); - break; - case SDL_BLENDMODE_MOD: - data->glEnable(GL_BLEND); - data->glBlendFuncSeparate(GL_ZERO, GL_SRC_COLOR, GL_ZERO, GL_ONE); - break; + data->glBlendFuncSeparate(GetBlendFunc(SDL_GetBlendModeSrcColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstColorFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeSrcAlphaFactor(blendMode)), + GetBlendFunc(SDL_GetBlendModeDstAlphaFactor(blendMode))); + data->glBlendEquationSeparate(GetBlendEquation(SDL_GetBlendModeColorOperation(blendMode)), + GetBlendEquation(SDL_GetBlendModeAlphaOperation(blendMode))); } data->current.blendMode = blendMode; } @@ -1383,18 +1494,17 @@ static int GLES2_SetDrawingState(SDL_Renderer * renderer) { GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata; - const int blendMode = renderer->blendMode; GLES2_ProgramCacheEntry *program; Uint8 r, g, b, a; GLES2_ActivateRenderer(renderer); - GLES2_SetBlendMode(data, blendMode); + GLES2_SetBlendMode(data, renderer->blendMode); GLES2_SetTexCoords(data, SDL_FALSE); /* Activate an appropriate shader and set the projection matrix */ - if (GLES2_SelectProgram(renderer, GLES2_IMAGESOURCE_SOLID, blendMode) < 0) { + if (GLES2_SelectProgram(renderer, GLES2_IMAGESOURCE_SOLID, 0, 0) < 0) { return -1; } @@ -1555,12 +1665,10 @@ GLES2_SetupCopy(SDL_Renderer *renderer, SDL_Texture *texture) GLES2_DriverContext *data = (GLES2_DriverContext *)renderer->driverdata; GLES2_TextureData *tdata = (GLES2_TextureData *)texture->driverdata; GLES2_ImageSource sourceType = GLES2_IMAGESOURCE_TEXTURE_ABGR; - SDL_BlendMode blendMode; GLES2_ProgramCacheEntry *program; Uint8 r, g, b, a; /* Activate an appropriate shader and set the projection matrix */ - blendMode = texture->blendMode; if (renderer->target) { /* Check if we need to do color mapping between the source and render target textures */ if (renderer->target->format != texture->format) { @@ -1623,6 +1731,9 @@ GLES2_SetupCopy(SDL_Renderer *renderer, SDL_Texture *texture) case SDL_PIXELFORMAT_NV21: sourceType = GLES2_IMAGESOURCE_TEXTURE_NV21; break; + case SDL_PIXELFORMAT_EXTERNAL_OES: + sourceType = GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES; + break; default: return SDL_SetError("Unsupported texture format"); } @@ -1653,12 +1764,15 @@ GLES2_SetupCopy(SDL_Renderer *renderer, SDL_Texture *texture) case SDL_PIXELFORMAT_NV21: sourceType = GLES2_IMAGESOURCE_TEXTURE_NV21; break; + case SDL_PIXELFORMAT_EXTERNAL_OES: + sourceType = GLES2_IMAGESOURCE_TEXTURE_EXTERNAL_OES; + break; default: return SDL_SetError("Unsupported texture format"); } } - if (GLES2_SelectProgram(renderer, sourceType, blendMode) < 0) { + if (GLES2_SelectProgram(renderer, sourceType, texture->w, texture->h) < 0) { return -1; } @@ -1705,7 +1819,7 @@ GLES2_SetupCopy(SDL_Renderer *renderer, SDL_Texture *texture) } /* Configure texture blending */ - GLES2_SetBlendMode(data, blendMode); + GLES2_SetBlendMode(data, texture->blendMode); GLES2_SetTexCoords(data, SDL_TRUE); return 0; @@ -1923,7 +2037,9 @@ static int GLES2_UnbindTexture (SDL_Renderer * renderer, SDL_Texture *texture) * Renderer instantiation * *************************************************************************************************/ +#ifdef ZUNE_HD #define GL_NVIDIA_PLATFORM_BINARY_NV 0x890B +#endif static void GLES2_ResetState(SDL_Renderer *renderer) @@ -1936,7 +2052,7 @@ GLES2_ResetState(SDL_Renderer *renderer) GLES2_ActivateRenderer(renderer); } - data->current.blendMode = -1; + data->current.blendMode = SDL_BLENDMODE_INVALID; data->current.tex_coords = SDL_FALSE; data->glActiveTexture(GL_TEXTURE0); @@ -1963,7 +2079,7 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) #ifndef ZUNE_HD GLboolean hasCompiler; #endif - Uint32 window_flags; + Uint32 window_flags = 0; /* -Wconditional-uninitialized */ GLint window_framebuffer; GLint value; int profile_mask = 0, major = 0, minor = 0; @@ -1980,8 +2096,9 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) } window_flags = SDL_GetWindowFlags(window); + /* OpenGL ES 3.0 is a superset of OpenGL ES 2.0 */ if (!(window_flags & SDL_WINDOW_OPENGL) || - profile_mask != SDL_GL_CONTEXT_PROFILE_ES || major != RENDERER_CONTEXT_MAJOR || minor != RENDERER_CONTEXT_MINOR) { + profile_mask != SDL_GL_CONTEXT_PROFILE_ES || major < RENDERER_CONTEXT_MAJOR) { changed_window = SDL_TRUE; SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_ES); @@ -2089,33 +2206,37 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags) data->window_framebuffer = (GLuint)window_framebuffer; /* Populate the function pointers for the module */ - renderer->WindowEvent = &GLES2_WindowEvent; - renderer->GetOutputSize = &GLES2_GetOutputSize; - renderer->CreateTexture = &GLES2_CreateTexture; - renderer->UpdateTexture = &GLES2_UpdateTexture; - renderer->UpdateTextureYUV = &GLES2_UpdateTextureYUV; - renderer->LockTexture = &GLES2_LockTexture; - renderer->UnlockTexture = &GLES2_UnlockTexture; - renderer->SetRenderTarget = &GLES2_SetRenderTarget; - renderer->UpdateViewport = &GLES2_UpdateViewport; - renderer->UpdateClipRect = &GLES2_UpdateClipRect; - renderer->RenderClear = &GLES2_RenderClear; - renderer->RenderDrawPoints = &GLES2_RenderDrawPoints; - renderer->RenderDrawLines = &GLES2_RenderDrawLines; - renderer->RenderFillRects = &GLES2_RenderFillRects; - renderer->RenderCopy = &GLES2_RenderCopy; - renderer->RenderCopyEx = &GLES2_RenderCopyEx; - renderer->RenderReadPixels = &GLES2_RenderReadPixels; - renderer->RenderPresent = &GLES2_RenderPresent; - renderer->DestroyTexture = &GLES2_DestroyTexture; - renderer->DestroyRenderer = &GLES2_DestroyRenderer; - renderer->GL_BindTexture = &GLES2_BindTexture; - renderer->GL_UnbindTexture = &GLES2_UnbindTexture; + renderer->WindowEvent = GLES2_WindowEvent; + renderer->GetOutputSize = GLES2_GetOutputSize; + renderer->SupportsBlendMode = GLES2_SupportsBlendMode; + renderer->CreateTexture = GLES2_CreateTexture; + renderer->UpdateTexture = GLES2_UpdateTexture; + renderer->UpdateTextureYUV = GLES2_UpdateTextureYUV; + renderer->LockTexture = GLES2_LockTexture; + renderer->UnlockTexture = GLES2_UnlockTexture; + renderer->SetRenderTarget = GLES2_SetRenderTarget; + renderer->UpdateViewport = GLES2_UpdateViewport; + renderer->UpdateClipRect = GLES2_UpdateClipRect; + renderer->RenderClear = GLES2_RenderClear; + renderer->RenderDrawPoints = GLES2_RenderDrawPoints; + renderer->RenderDrawLines = GLES2_RenderDrawLines; + renderer->RenderFillRects = GLES2_RenderFillRects; + renderer->RenderCopy = GLES2_RenderCopy; + renderer->RenderCopyEx = GLES2_RenderCopyEx; + renderer->RenderReadPixels = GLES2_RenderReadPixels; + renderer->RenderPresent = GLES2_RenderPresent; + renderer->DestroyTexture = GLES2_DestroyTexture; + renderer->DestroyRenderer = GLES2_DestroyRenderer; + renderer->GL_BindTexture = GLES2_BindTexture; + renderer->GL_UnbindTexture = GLES2_UnbindTexture; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_YV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_IYUV; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV12; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21; +#ifdef GL_TEXTURE_EXTERNAL_OES + renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_EXTERNAL_OES; +#endif GLES2_ResetState(renderer); diff --git a/Engine/lib/sdl/src/render/opengles2/SDL_shaders_gles2.c b/Engine/lib/sdl/src/render/opengles2/SDL_shaders_gles2.c index 0c01a8c64..b0bcdff25 100644 --- a/Engine/lib/sdl/src/render/opengles2/SDL_shaders_gles2.c +++ b/Engine/lib/sdl/src/render/opengles2/SDL_shaders_gles2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -126,70 +126,166 @@ static const Uint8 GLES2_FragmentSrc_TextureBGRSrc_[] = " \ } \ "; +#define JPEG_SHADER_CONSTANTS \ +"// YUV offset \n" \ +"const vec3 offset = vec3(0, -0.501960814, -0.501960814);\n" \ +"\n" \ +"// RGB coefficients \n" \ +"const mat3 matrix = mat3( 1, 1, 1,\n" \ +" 0, -0.3441, 1.772,\n" \ +" 1.402, -0.7141, 0);\n" \ + +#define BT601_SHADER_CONSTANTS \ +"// YUV offset \n" \ +"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \ +"\n" \ +"// RGB coefficients \n" \ +"const mat3 matrix = mat3( 1.1644, 1.1644, 1.1644,\n" \ +" 0, -0.3918, 2.0172,\n" \ +" 1.596, -0.813, 0);\n" \ + +#define BT709_SHADER_CONSTANTS \ +"// YUV offset \n" \ +"const vec3 offset = vec3(-0.0627451017, -0.501960814, -0.501960814);\n" \ +"\n" \ +"// RGB coefficients \n" \ +"const mat3 matrix = mat3( 1.1644, 1.1644, 1.1644,\n" \ +" 0, -0.2132, 2.1124,\n" \ +" 1.7927, -0.5329, 0);\n" \ + + +#define YUV_SHADER_PROLOGUE \ +"precision mediump float;\n" \ +"uniform sampler2D u_texture;\n" \ +"uniform sampler2D u_texture_u;\n" \ +"uniform sampler2D u_texture_v;\n" \ +"uniform vec4 u_modulation;\n" \ +"varying vec2 v_texCoord;\n" \ +"\n" \ + +#define YUV_SHADER_BODY \ +"\n" \ +"void main()\n" \ +"{\n" \ +" mediump vec3 yuv;\n" \ +" lowp vec3 rgb;\n" \ +"\n" \ +" // Get the YUV values \n" \ +" yuv.x = texture2D(u_texture, v_texCoord).r;\n" \ +" yuv.y = texture2D(u_texture_u, v_texCoord).r;\n" \ +" yuv.z = texture2D(u_texture_v, v_texCoord).r;\n" \ +"\n" \ +" // Do the color transform \n" \ +" yuv += offset;\n" \ +" rgb = matrix * yuv;\n" \ +"\n" \ +" // That was easy. :) \n" \ +" gl_FragColor = vec4(rgb, 1);\n" \ +" gl_FragColor *= u_modulation;\n" \ +"}" \ + +#define NV12_SHADER_BODY \ +"\n" \ +"void main()\n" \ +"{\n" \ +" mediump vec3 yuv;\n" \ +" lowp vec3 rgb;\n" \ +"\n" \ +" // Get the YUV values \n" \ +" yuv.x = texture2D(u_texture, v_texCoord).r;\n" \ +" yuv.yz = texture2D(u_texture_u, v_texCoord).ra;\n" \ +"\n" \ +" // Do the color transform \n" \ +" yuv += offset;\n" \ +" rgb = matrix * yuv;\n" \ +"\n" \ +" // That was easy. :) \n" \ +" gl_FragColor = vec4(rgb, 1);\n" \ +" gl_FragColor *= u_modulation;\n" \ +"}" \ + +#define NV21_SHADER_BODY \ +"\n" \ +"void main()\n" \ +"{\n" \ +" mediump vec3 yuv;\n" \ +" lowp vec3 rgb;\n" \ +"\n" \ +" // Get the YUV values \n" \ +" yuv.x = texture2D(u_texture, v_texCoord).r;\n" \ +" yuv.yz = texture2D(u_texture_u, v_texCoord).ar;\n" \ +"\n" \ +" // Do the color transform \n" \ +" yuv += offset;\n" \ +" rgb = matrix * yuv;\n" \ +"\n" \ +" // That was easy. :) \n" \ +" gl_FragColor = vec4(rgb, 1);\n" \ +" gl_FragColor *= u_modulation;\n" \ +"}" \ + /* YUV to ABGR conversion */ -static const Uint8 GLES2_FragmentSrc_TextureYUVSrc_[] = " \ - precision mediump float; \ - uniform sampler2D u_texture; \ - uniform sampler2D u_texture_u; \ - uniform sampler2D u_texture_v; \ - uniform vec4 u_modulation; \ - varying vec2 v_texCoord; \ - \ - void main() \ - { \ - mediump vec3 yuv; \ - lowp vec3 rgb; \ - yuv.x = texture2D(u_texture, v_texCoord).r; \ - yuv.y = texture2D(u_texture_u, v_texCoord).r - 0.5; \ - yuv.z = texture2D(u_texture_v, v_texCoord).r - 0.5; \ - rgb = mat3( 1, 1, 1, \ - 0, -0.39465, 2.03211, \ - 1.13983, -0.58060, 0) * yuv; \ - gl_FragColor = vec4(rgb, 1); \ - gl_FragColor *= u_modulation; \ - } \ -"; +static const Uint8 GLES2_FragmentSrc_TextureYUVJPEGSrc_[] = \ + YUV_SHADER_PROLOGUE \ + JPEG_SHADER_CONSTANTS \ + YUV_SHADER_BODY \ +; +static const Uint8 GLES2_FragmentSrc_TextureYUVBT601Src_[] = \ + YUV_SHADER_PROLOGUE \ + BT601_SHADER_CONSTANTS \ + YUV_SHADER_BODY \ +; +static const Uint8 GLES2_FragmentSrc_TextureYUVBT709Src_[] = \ + YUV_SHADER_PROLOGUE \ + BT709_SHADER_CONSTANTS \ + YUV_SHADER_BODY \ +; /* NV12 to ABGR conversion */ -static const Uint8 GLES2_FragmentSrc_TextureNV12Src_[] = " \ - precision mediump float; \ - uniform sampler2D u_texture; \ - uniform sampler2D u_texture_u; \ - uniform vec4 u_modulation; \ - varying vec2 v_texCoord; \ - \ - void main() \ - { \ - mediump vec3 yuv; \ - lowp vec3 rgb; \ - yuv.x = texture2D(u_texture, v_texCoord).r; \ - yuv.yz = texture2D(u_texture_u, v_texCoord).ra - 0.5; \ - rgb = mat3( 1, 1, 1, \ - 0, -0.39465, 2.03211, \ - 1.13983, -0.58060, 0) * yuv; \ - gl_FragColor = vec4(rgb, 1); \ - gl_FragColor *= u_modulation; \ - } \ -"; +static const Uint8 GLES2_FragmentSrc_TextureNV12JPEGSrc_[] = \ + YUV_SHADER_PROLOGUE \ + JPEG_SHADER_CONSTANTS \ + NV12_SHADER_BODY \ +; +static const Uint8 GLES2_FragmentSrc_TextureNV12BT601Src_[] = \ + YUV_SHADER_PROLOGUE \ + BT601_SHADER_CONSTANTS \ + NV12_SHADER_BODY \ +; +static const Uint8 GLES2_FragmentSrc_TextureNV12BT709Src_[] = \ + YUV_SHADER_PROLOGUE \ + BT709_SHADER_CONSTANTS \ + NV12_SHADER_BODY \ +; /* NV21 to ABGR conversion */ -static const Uint8 GLES2_FragmentSrc_TextureNV21Src_[] = " \ +static const Uint8 GLES2_FragmentSrc_TextureNV21JPEGSrc_[] = \ + YUV_SHADER_PROLOGUE \ + JPEG_SHADER_CONSTANTS \ + NV21_SHADER_BODY \ +; +static const Uint8 GLES2_FragmentSrc_TextureNV21BT601Src_[] = \ + YUV_SHADER_PROLOGUE \ + BT601_SHADER_CONSTANTS \ + NV21_SHADER_BODY \ +; +static const Uint8 GLES2_FragmentSrc_TextureNV21BT709Src_[] = \ + YUV_SHADER_PROLOGUE \ + BT709_SHADER_CONSTANTS \ + NV21_SHADER_BODY \ +; + +/* Custom Android video format texture */ +static const Uint8 GLES2_FragmentSrc_TextureExternalOESSrc_[] = " \ + #extension GL_OES_EGL_image_external : require\n\ precision mediump float; \ - uniform sampler2D u_texture; \ - uniform sampler2D u_texture_u; \ + uniform samplerExternalOES u_texture; \ uniform vec4 u_modulation; \ varying vec2 v_texCoord; \ \ void main() \ { \ - mediump vec3 yuv; \ - lowp vec3 rgb; \ - yuv.x = texture2D(u_texture, v_texCoord).r; \ - yuv.yz = texture2D(u_texture_u, v_texCoord).ar - 0.5; \ - rgb = mat3( 1, 1, 1, \ - 0, -0.39465, 2.03211, \ - 1.13983, -0.58060, 0) * yuv; \ - gl_FragColor = vec4(rgb, 1); \ + gl_FragColor = texture2D(u_texture, v_texCoord); \ gl_FragColor *= u_modulation; \ } \ "; @@ -236,570 +332,190 @@ static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureBGRSrc = { GLES2_FragmentSrc_TextureBGRSrc_ }; -static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVSrc = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVJPEGSrc = { GL_FRAGMENT_SHADER, GLES2_SOURCE_SHADER, - sizeof(GLES2_FragmentSrc_TextureYUVSrc_), - GLES2_FragmentSrc_TextureYUVSrc_ + sizeof(GLES2_FragmentSrc_TextureYUVJPEGSrc_), + GLES2_FragmentSrc_TextureYUVJPEGSrc_ }; -static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12Src = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVBT601Src = { GL_FRAGMENT_SHADER, GLES2_SOURCE_SHADER, - sizeof(GLES2_FragmentSrc_TextureNV12Src_), - GLES2_FragmentSrc_TextureNV12Src_ + sizeof(GLES2_FragmentSrc_TextureYUVBT601Src_), + GLES2_FragmentSrc_TextureYUVBT601Src_ }; -static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21Src = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureYUVBT709Src = { GL_FRAGMENT_SHADER, GLES2_SOURCE_SHADER, - sizeof(GLES2_FragmentSrc_TextureNV21Src_), - GLES2_FragmentSrc_TextureNV21Src_ + sizeof(GLES2_FragmentSrc_TextureYUVBT709Src_), + GLES2_FragmentSrc_TextureYUVBT709Src_ }; - -/************************************************************************************************* - * Vertex/fragment shader binaries (NVIDIA Tegra 1/2) * - *************************************************************************************************/ - -#if GLES2_INCLUDE_NVIDIA_SHADERS - -#define GL_NVIDIA_PLATFORM_BINARY_NV 0x890B - -static const Uint8 GLES2_VertexTegra_Default_[] = { - 243, 193, 1, 142, 31, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 46, 0, 0, 0, 48, 0, 0, 0, 2, 0, 0, 0, 85, 0, 0, 0, 2, 0, 0, 0, 24, 0, 0, 0, 3, 0, 0, 0, - 91, 0, 0, 0, 1, 0, 0, 0, 16, 0, 0, 0, 5, 0, 0, 0, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 95, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0, - 13, 0, 0, 0, 102, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 16, 0, 0, 0, 104, 0, 0, 0, 1, 0, 0, 0, 32, 0, 0, 0, 17, 0, 0, 0, 112, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 112, 0, 0, 0, 80, 0, 0, 0, 80, 0, 0, 0, 19, 0, 0, 0, 132, 0, - 0, 0, 104, 0, 0, 0, 104, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 97, - 95, 112, 111, 115, 105, 116, 105, 111, 110, 0, 97, 95, 116, 101, 120, 67, 111, 111, 114, 100, - 0, 118, 95, 116, 101, 120, 67, 111, 111, 114, 100, 0, 117, 95, 112, 114, 111, 106, 101, 99, - 116, 105, 111, 110, 0, 0, 0, 0, 0, 0, 0, 82, 139, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 80, 139, 0, - 0, 1, 0, 0, 0, 22, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 33, 0, 0, 0, 92, 139, 0, 0, - 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 240, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 64, 0, 0, 0, 80, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 193, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 66, 24, 0, 6, 34, 108, 28, - 0, 0, 42, 16, 128, 0, 195, 192, 6, 129, 252, 255, 65, 96, 108, 28, 0, 0, 0, 0, 0, 1, 195, 192, - 6, 1, 252, 255, 33, 96, 108, 156, 31, 64, 8, 1, 64, 0, 131, 192, 6, 1, 156, 159, 65, 96, 108, - 28, 0, 0, 85, 32, 0, 1, 195, 192, 6, 1, 252, 255, 33, 96, 108, 156, 31, 64, 0, 64, 64, 0, 131, - 192, 134, 1, 152, 31, 65, 96, 108, 156, 31, 64, 127, 48, 0, 1, 195, 192, 6, 129, 129, 255, 33, - 96 -}; - -static const Uint8 GLES2_FragmentTegra_None_SolidSrc_[] = { - 155, 191, 159, 1, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 75, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 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, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, 1, - 0, 0, 0, 1, 0, 0, 0, 1, 0, 65, 37, 0, 0, 0, 0, 1, 0, 0, 21, 0, 0, 0, 0, 1, 0, 1, 38, 0, 0, 0, - 0, 1, 0, 1, 39, 0, 0, 0, 0, 1, 0, 1, 40, 1, 0, 0, 0, 8, 0, 4, 40, 0, 40, 0, 0, 0, 242, 65, 63, - 192, 200, 0, 0, 0, 242, 65, 63, 128, 168, 0, 0, 0, 242, 65, 63, 64, 72, 0, 0, 0, 242, 65, 63, - 1, 0, 6, 40, 0, 0, 0, 0, 1, 0, 1, 41, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_Alpha_SolidSrc_[] = { - 169, 153, 195, 28, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 8, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 75, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, - 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 75, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0, 13, 0, - 0, 0, 82, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 14, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 22, 0, 0, 0, 84, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 92, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 15, 0, 0, 0, 93, 0, 0, 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, 0, 1, 40, 1, 0, 0, 0, 5, 0, 0, 0, 9, 0, 0, 0, 24, 0, 4, 40, 232, 231, 15, - 0, 0, 242, 65, 62, 194, 72, 1, 0, 0, 250, 65, 63, 194, 40, 1, 0, 0, 250, 65, 63, 192, 168, 1, - 0, 0, 242, 1, 64, 192, 168, 1, 0, 0, 242, 1, 68, 168, 32, 0, 0, 0, 50, 64, 0, 192, 168, 15, - 0, 0, 242, 1, 66, 168, 64, 0, 16, 0, 242, 65, 1, 232, 231, 15, 0, 0, 242, 65, 62, 168, 160, - 0, 0, 0, 50, 64, 2, 104, 192, 0, 0, 36, 48, 66, 4, 232, 231, 15, 0, 0, 242, 65, 62, 3, 0, 6, - 40, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 1, 41, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_Additive_SolidSrc_[] = { - 59, 71, 42, 17, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, 0, - 0, 8, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 75, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, - 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 75, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0, 13, 0, - 0, 0, 82, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 14, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 22, 0, 0, 0, 84, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 92, 0, 0, 0, 1, 0, 0, 0, 4,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0, 0, 0, 26, - 0, 70, 192, 40, 0, 0, 0, 2, 0, 64, 192, 72, 0, 0, 0, 10, 0, 66, 192, 168, 0, 0, 0, 18, 0, 68, - 1, 0, 6, 40, 0, 0, 0, 0, 1, 0, 1, 41, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_Modulated_SolidSrc_[] = { - 37, 191, 49, 17, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, 0, - 0, 8, 0, 0, 0, 8, 0, 0, 0, 2, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 75, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 0, 0, 0, 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, - 75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 75, 0, 0, 0, 1, 0, 0, 0, 28, 0, 0, 0, 13, 0, - 0, 0, 82, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 14, 0, 0, 0, 84, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 22, 0, 0, 0, 84, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 92, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 15, 0, 0, 0, 93, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 113, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 113, 0, 0, - 0, 108, 0, 0, 0, 108, 0, 0, 0, 20, 0, 0, 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, 0, 0, - 0, 113, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 117, 95, 99, 111, 108, 111, 114, 0, 0, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 32, 32, 17, 241, 0, 0, 0, 240, 0, - 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 21, 32, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 20, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, - 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 65, 37, 8, 0, 129, 0, 1, 0, 0, 21, 0, 0, 0, 0, 1, 0, 1, 38, 0, - 0, 0, 0, 1, 0, 1, 39, 0, 0, 0, 0, 1, 0, 1, 40, 1, 0, 0, 0, 8, 0, 4, 40, 104, 192, 0, 0, 0, 242, - 1, 70, 8, 32, 0, 0, 0, 242, 1, 64, 40, 64, 0, 0, 0, 242, 1, 66, 72, 160, 0, 0, 0, 242, 1, 68, - 1, 0, 6, 40, 0, 0, 0, 0, 1, 0, 1, 41, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_None_TextureSrc_[] = { - 220, 217, 41, 211, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 34, 0, 0, 0, 36, 0, 0, 0, 2, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 82, 0, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0, 6, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, - 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 87, 0, 0, 0, 2, 0, 0, 0, 56, 0, 0, 0, - 13, 0, 0, 0, 101, 0, 0, 0, 4, 0, 0, 0, 16, 0, 0, 0, 14, 0, 0, 0, 105, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 22, 0, 0, 0, 106, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 114, 0, 0, 0, 1, 0, - 0, 0, 4, 0, 0, 0, 15, 0, 0, 0, 115, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 135, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 135, - 0, 0, 0, 120, 0, 0, 0, 120, 0, 0, 0, 20, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, - 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 118, 95, 116, 101, 120, 67, 111, 111, 114, 100, 0, 117, 95, 109, 111, 100, 117, 108, - 97, 116, 105, 111, 110, 0, 117, 95, 116, 101, 120, 116, 117, 114, 101, 0, 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, 220, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 94, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, - 0, 2, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 241, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, - 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 21, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, - 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 65, 37, 0, 0, 0, 0, 1, 0, - 0, 21, 0, 0, 0, 0, 1, 0, 1, 38, 1, 0, 0, 0, 2, 0, 4, 38, 186, 81, 78, 16, 2, 1, 0, 0, 1, 0, - 1, 39, 0, 4, 0, 0, 1, 0, 1, 40, 1, 0, 0, 0, 8, 0, 4, 40, 104, 192, 0, 0, 0, 242, 1, 70, 8, 32, - 0, 0, 0, 242, 1, 64, 40, 64, 0, 0, 0, 242, 1, 66, 72, 160, 0, 0, 0, 242, 1, 68, 1, 0, 6, 40, - 0, 0, 0, 0, 1, 0, 1, 41, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_Alpha_TextureSrc_[] = { - 71, 202, 114, 229, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 34, 0, 0, 0, 36, 0, 0, 0, 2, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 82, 0, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0, 6, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, - 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 87, 0, 0, 0, 2, 0, 0, 0, 56, 0, 0, 0, - 13, 0, 0, 0, 101, 0, 0, 0, 4, 0, 0, 0, 16, 0, 0, 0, 14, 0, 0, 0, 105, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 22, 0, 0, 0, 106, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 114, 0, 0, 0, 1, 0, - 0, 0, 4, 0, 0, 0, 15, 0, 0, 0, 115, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 135, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 135, - 0, 0, 0, 176, 0, 0, 0, 176, 0, 0, 0, 20, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, - 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 118, 95, 116, 101, 120, 67, 111, 111, 114, 100, 0, 117, 95, 109, 111, 100, 117, 108, - 97, 116, 105, 111, 110, 0, 117, 95, 116, 101, 120, 116, 117, 114, 101, 0, 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, 220, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 94, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, - 0, 2, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 118, 118, 17, 241, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, - 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, - 1, 0, 0, 0, 2, 0, 0, 0, 21, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 16, 0, 0, 0, 16, - 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, 1, 0, 0, 0, 2, 0, 0, 0, 2, 0, 65, 37, 0, 0, 0, 0, - 8, 0, 129, 0, 1, 0, 0, 21, 0, 0, 0, 0, 2, 0, 1, 38, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 4, 38, 186, - 81, 78, 16, 2, 1, 0, 0, 2, 0, 1, 39, 0, 4, 0, 0, 0, 0, 0, 0, 2, 0, 1, 40, 1, 0, 0, 0, 5, 0, - 0, 0, 16, 0, 4, 40, 40, 160, 1, 0, 0, 242, 1, 66, 8, 192, 1, 0, 0, 242, 1, 64, 104, 32, 1, 0, - 0, 242, 1, 70, 72, 64, 1, 0, 0, 242, 1, 68, 154, 192, 0, 0, 37, 34, 64, 3, 8, 32, 0, 0, 5, 58, - 208, 4, 40, 64, 0, 0, 5, 50, 208, 4, 72, 160, 0, 0, 37, 42, 208, 4, 2, 0, 6, 40, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, 1, 41, 0, 0, 0, 0, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_Additive_TextureSrc_[] = { - 161, 234, 193, 234, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 34, 0, 0, 0, 36, 0, 0, 0, 2, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 82, 0, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0, 6, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, - 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 87, 0, 0, 0, 2, 0, 0, 0, 56, 0, 0, 0, - 13, 0, 0, 0, 101, 0, 0, 0, 4, 0, 0, 0, 16, 0, 0, 0, 14, 0, 0, 0, 105, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 22, 0, 0, 0, 106, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 114, 0, 0, 0, 1, 0, - 0, 0, 4, 0, 0, 0, 15, 0, 0, 0, 115, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 135, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 135, - 0, 0, 0, 176, 0, 0, 0, 176, 0, 0, 0, 20, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, - 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 118, 95, 116, 101, 120, 67, 111, 111, 114, 100, 0, 117, 95, 109, 111, 100, 117, 108, - 97, 116, 105, 111, 110, 0, 117, 95, 116, 101, 120, 116, 117, 114, 101, 0, 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, 0, 26, 64, 4, 136, 32, 0, 0, 0, 2, 64, 7, - 136, 64, 0, 0, 0, 10, 64, 6, 136, 160, 0, 0, 0, 18, 64, 5, 2, 0, 6, 40, 0, 0, 0, 0, 0, 0, 0, - 0, 2, 0, 1, 41, 0, 0, 0, 0, 5, 0, 2, 0 -}; - -static const Uint8 GLES2_FragmentTegra_Modulated_TextureSrc_[] = { - 75, 132, 201, 227, 47, 109, 131, 38, 6, 0, 1, 0, 5, 0, 0, 0, 17, 0, 0, 0, 1, 0, 0, 0, 73, 0, - 0, 0, 34, 0, 0, 0, 36, 0, 0, 0, 2, 0, 0, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 82, 0, 0, 0, 1, 0, 0, 0, 20, 0, 0, 0, 6, 0, 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, - 0, 0, 87, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 8, 0, 0, 0, 87, 0, 0, 0, 2, 0, 0, 0, 56, 0, 0, 0, - 13, 0, 0, 0, 101, 0, 0, 0, 4, 0, 0, 0, 16, 0, 0, 0, 14, 0, 0, 0, 105, 0, 0, 0, 1, 0, 0, 0, 4, - 0, 0, 0, 22, 0, 0, 0, 106, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 23, 0, 0, 0, 114, 0, 0, 0, 1, 0, - 0, 0, 4, 0, 0, 0, 15, 0, 0, 0, 115, 0, 0, 0, 1, 0, 0, 0, 80, 0, 0, 0, 17, 0, 0, 0, 135, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 18, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 19, 0, 0, 0, 135, - 0, 0, 0, 176, 0, 0, 0, 176, 0, 0, 0, 20, 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21, - 0, 0, 0, 135, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 109, 97, 110, 70, 73, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 118, 95, 116, 101, 120, 67, 111, 111, 114, 100, 0, 117, 95, 109, 111, 100, 117, 108, - 97, 116, 105, 111, 110, 0, 117, 95, 116, 101, 120, 116, 117, 114, 101, 0, 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, 0, 0, 220, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0, 0, 82, 139, 0, 0, 1, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 94, 139, 0, 0, 1, 0, 0, 0, 1, 0, 0, - 0, 2, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 5, 48, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 32, 32, 17, 241, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 240, - 0, 0, 0, 240, 0, 0, 0, 240, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 7, 0, 0, 0, 2, 0, 0, 0, 1, 0, - 0, 0, 2, 0, 0, 0, 21, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 16, 0, 0, 0, 16, 0, 0, - 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 65, 82, 50, 48, 45, 66, 73, 78, 1, 0, 0, 0, 2, 0, 0, 0, 2, 0, 65, 37, 0, 0, 0, 0, 8, 0, - 129, 0, 1, 0, 0, 21, 0, 0, 0, 0, 2, 0, 1, 38, 1, 0, 0, 0, 0, 0, 0, 0, 2, 0, 4, 38, 186, 81, - 78, 16, 2, 1, 0, 0, 2, 0, 1, 39, 0, 4, 0, 0, 0, 0, 0, 0, 2, 0, 1, 40, 1, 0, 0, 0, 5, 0, 0, 0, - 16, 0, 4, 40, 40, 160, 1, 0, 0, 242, 1, 66, 8, 192, 1, 0, 0, 242, 1, 64, 104, 32, 1, 0, 0, 242, - 1, 70, 72, 64, 1, 0, 0, 242, 1, 68, 104, 192, 0, 0, 0, 242, 65, 4, 232, 32, 0, 0, 0, 242, 65, - 0, 40, 64, 0, 0, 0, 242, 65, 6, 72, 160, 0, 0, 0, 242, 65, 5, 2, 0, 6, 40, 0, 0, 0, 0, 0, 0, - 0, 0, 2, 0, 1, 41, 0, 0, 0, 0, 5, 0, 2, 0 -}; - -static const GLES2_ShaderInstance GLES2_VertexTegra_Default = { - GL_VERTEX_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_VertexTegra_Default_), - GLES2_VertexTegra_Default_ -}; - -static const GLES2_ShaderInstance GLES2_FragmentTegra_None_SolidSrc = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12JPEGSrc = { GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_None_SolidSrc_), - GLES2_FragmentTegra_None_SolidSrc_ + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureNV12JPEGSrc_), + GLES2_FragmentSrc_TextureNV12JPEGSrc_ }; -static const GLES2_ShaderInstance GLES2_FragmentTegra_Alpha_SolidSrc = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12BT601Src = { GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_Alpha_SolidSrc_), - GLES2_FragmentTegra_Alpha_SolidSrc_ + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureNV12BT601Src_), + GLES2_FragmentSrc_TextureNV12BT601Src_ }; -static const GLES2_ShaderInstance GLES2_FragmentTegra_Additive_SolidSrc = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21BT709Src = { GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_Additive_SolidSrc_), - GLES2_FragmentTegra_Additive_SolidSrc_ + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureNV21BT709Src_), + GLES2_FragmentSrc_TextureNV21BT709Src_ }; -static const GLES2_ShaderInstance GLES2_FragmentTegra_Modulated_SolidSrc = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21JPEGSrc = { GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_Modulated_SolidSrc_), - GLES2_FragmentTegra_Modulated_SolidSrc_ + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureNV21JPEGSrc_), + GLES2_FragmentSrc_TextureNV21JPEGSrc_ }; -static const GLES2_ShaderInstance GLES2_FragmentTegra_None_TextureSrc = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV21BT601Src = { GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_None_TextureSrc_), - GLES2_FragmentTegra_None_TextureSrc_ + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureNV21BT601Src_), + GLES2_FragmentSrc_TextureNV21BT601Src_ }; -static const GLES2_ShaderInstance GLES2_FragmentTegra_Alpha_TextureSrc = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureNV12BT709Src = { GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_Alpha_TextureSrc_), - GLES2_FragmentTegra_Alpha_TextureSrc_ + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureNV12BT709Src_), + GLES2_FragmentSrc_TextureNV12BT709Src_ }; -static const GLES2_ShaderInstance GLES2_FragmentTegra_Additive_TextureSrc = { +static const GLES2_ShaderInstance GLES2_FragmentSrc_TextureExternalOESSrc = { GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_Additive_TextureSrc_), - GLES2_FragmentTegra_Additive_TextureSrc_ + GLES2_SOURCE_SHADER, + sizeof(GLES2_FragmentSrc_TextureExternalOESSrc_), + GLES2_FragmentSrc_TextureExternalOESSrc_ }; -static const GLES2_ShaderInstance GLES2_FragmentTegra_Modulated_TextureSrc = { - GL_FRAGMENT_SHADER, - GL_NVIDIA_PLATFORM_BINARY_NV, - sizeof(GLES2_FragmentTegra_Modulated_TextureSrc_), - GLES2_FragmentTegra_Modulated_TextureSrc_ -}; - -#endif /* GLES2_INCLUDE_NVIDIA_SHADERS */ /************************************************************************************************* * Vertex/fragment shader definitions * *************************************************************************************************/ static GLES2_Shader GLES2_VertexShader_Default = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else 1, -#endif { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_VertexTegra_Default, -#endif &GLES2_VertexSrc_Default } }; -static GLES2_Shader GLES2_FragmentShader_None_SolidSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else +static GLES2_Shader GLES2_FragmentShader_SolidSrc = { 1, -#endif { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_None_SolidSrc, -#endif &GLES2_FragmentSrc_SolidSrc } }; -static GLES2_Shader GLES2_FragmentShader_Alpha_SolidSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else +static GLES2_Shader GLES2_FragmentShader_TextureABGRSrc = { 1, -#endif { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_Alpha_SolidSrc, -#endif - &GLES2_FragmentSrc_SolidSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Additive_SolidSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_Additive_SolidSrc, -#endif - &GLES2_FragmentSrc_SolidSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Modulated_SolidSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_Modulated_SolidSrc, -#endif - &GLES2_FragmentSrc_SolidSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_None_TextureABGRSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_None_TextureSrc, -#endif &GLES2_FragmentSrc_TextureABGRSrc } }; -static GLES2_Shader GLES2_FragmentShader_Alpha_TextureABGRSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_Alpha_TextureSrc, -#endif - &GLES2_FragmentSrc_TextureABGRSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Additive_TextureABGRSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_Additive_TextureSrc, -#endif - &GLES2_FragmentSrc_TextureABGRSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Modulated_TextureABGRSrc = { -#if GLES2_INCLUDE_NVIDIA_SHADERS - 2, -#else - 1, -#endif - { -#if GLES2_INCLUDE_NVIDIA_SHADERS - &GLES2_FragmentTegra_Modulated_TextureSrc, -#endif - &GLES2_FragmentSrc_TextureABGRSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_None_TextureARGBSrc = { +static GLES2_Shader GLES2_FragmentShader_TextureARGBSrc = { 1, { &GLES2_FragmentSrc_TextureARGBSrc } }; -static GLES2_Shader GLES2_FragmentShader_Alpha_TextureARGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureARGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Additive_TextureARGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureARGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Modulated_TextureARGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureARGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_None_TextureRGBSrc = { +static GLES2_Shader GLES2_FragmentShader_TextureRGBSrc = { 1, { &GLES2_FragmentSrc_TextureRGBSrc } }; -static GLES2_Shader GLES2_FragmentShader_Alpha_TextureRGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureRGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Additive_TextureRGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureRGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_Modulated_TextureRGBSrc = { - 1, - { - &GLES2_FragmentSrc_TextureRGBSrc - } -}; - -static GLES2_Shader GLES2_FragmentShader_None_TextureBGRSrc = { +static GLES2_Shader GLES2_FragmentShader_TextureBGRSrc = { 1, { &GLES2_FragmentSrc_TextureBGRSrc } }; -static GLES2_Shader GLES2_FragmentShader_Alpha_TextureBGRSrc = { +static GLES2_Shader GLES2_FragmentShader_TextureYUVJPEGSrc = { 1, { - &GLES2_FragmentSrc_TextureBGRSrc + &GLES2_FragmentSrc_TextureYUVJPEGSrc } }; -static GLES2_Shader GLES2_FragmentShader_Additive_TextureBGRSrc = { +static GLES2_Shader GLES2_FragmentShader_TextureYUVBT601Src = { 1, { - &GLES2_FragmentSrc_TextureBGRSrc + &GLES2_FragmentSrc_TextureYUVBT601Src } }; -static GLES2_Shader GLES2_FragmentShader_Modulated_TextureBGRSrc = { +static GLES2_Shader GLES2_FragmentShader_TextureYUVBT709Src = { 1, { - &GLES2_FragmentSrc_TextureBGRSrc + &GLES2_FragmentSrc_TextureYUVBT709Src } }; -static GLES2_Shader GLES2_FragmentShader_TextureYUVSrc = { +static GLES2_Shader GLES2_FragmentShader_TextureNV12JPEGSrc = { 1, { - &GLES2_FragmentSrc_TextureYUVSrc + &GLES2_FragmentSrc_TextureNV12JPEGSrc } }; -static GLES2_Shader GLES2_FragmentShader_TextureNV12Src = { +static GLES2_Shader GLES2_FragmentShader_TextureNV12BT601Src = { 1, { - &GLES2_FragmentSrc_TextureNV12Src + &GLES2_FragmentSrc_TextureNV12BT601Src } }; -static GLES2_Shader GLES2_FragmentShader_TextureNV21Src = { +static GLES2_Shader GLES2_FragmentShader_TextureNV12BT709Src = { 1, { - &GLES2_FragmentSrc_TextureNV21Src + &GLES2_FragmentSrc_TextureNV12BT709Src + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureNV21JPEGSrc = { + 1, + { + &GLES2_FragmentSrc_TextureNV21JPEGSrc + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureNV21BT601Src = { + 1, + { + &GLES2_FragmentSrc_TextureNV21BT601Src + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureNV21BT709Src = { + 1, + { + &GLES2_FragmentSrc_TextureNV21BT709Src + } +}; + +static GLES2_Shader GLES2_FragmentShader_TextureExternalOESSrc = { + 1, + { + &GLES2_FragmentSrc_TextureExternalOESSrc } }; @@ -808,94 +524,41 @@ static GLES2_Shader GLES2_FragmentShader_TextureNV21Src = { * Shader selector * *************************************************************************************************/ -const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type, SDL_BlendMode blendMode) +const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type) { switch (type) { case GLES2_SHADER_VERTEX_DEFAULT: return &GLES2_VertexShader_Default; case GLES2_SHADER_FRAGMENT_SOLID_SRC: - switch (blendMode) { - case SDL_BLENDMODE_NONE: - return &GLES2_FragmentShader_None_SolidSrc; - case SDL_BLENDMODE_BLEND: - return &GLES2_FragmentShader_Alpha_SolidSrc; - case SDL_BLENDMODE_ADD: - return &GLES2_FragmentShader_Additive_SolidSrc; - case SDL_BLENDMODE_MOD: - return &GLES2_FragmentShader_Modulated_SolidSrc; - default: - return NULL; - } + return &GLES2_FragmentShader_SolidSrc; case GLES2_SHADER_FRAGMENT_TEXTURE_ABGR_SRC: - switch (blendMode) { - case SDL_BLENDMODE_NONE: - return &GLES2_FragmentShader_None_TextureABGRSrc; - case SDL_BLENDMODE_BLEND: - return &GLES2_FragmentShader_Alpha_TextureABGRSrc; - case SDL_BLENDMODE_ADD: - return &GLES2_FragmentShader_Additive_TextureABGRSrc; - case SDL_BLENDMODE_MOD: - return &GLES2_FragmentShader_Modulated_TextureABGRSrc; - default: - return NULL; - } + return &GLES2_FragmentShader_TextureABGRSrc; case GLES2_SHADER_FRAGMENT_TEXTURE_ARGB_SRC: - switch (blendMode) { - case SDL_BLENDMODE_NONE: - return &GLES2_FragmentShader_None_TextureARGBSrc; - case SDL_BLENDMODE_BLEND: - return &GLES2_FragmentShader_Alpha_TextureARGBSrc; - case SDL_BLENDMODE_ADD: - return &GLES2_FragmentShader_Additive_TextureARGBSrc; - case SDL_BLENDMODE_MOD: - return &GLES2_FragmentShader_Modulated_TextureARGBSrc; - default: - return NULL; - } - + return &GLES2_FragmentShader_TextureARGBSrc; case GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC: - switch (blendMode) { - case SDL_BLENDMODE_NONE: - return &GLES2_FragmentShader_None_TextureRGBSrc; - case SDL_BLENDMODE_BLEND: - return &GLES2_FragmentShader_Alpha_TextureRGBSrc; - case SDL_BLENDMODE_ADD: - return &GLES2_FragmentShader_Additive_TextureRGBSrc; - case SDL_BLENDMODE_MOD: - return &GLES2_FragmentShader_Modulated_TextureRGBSrc; - default: - return NULL; - } - + return &GLES2_FragmentShader_TextureRGBSrc; case GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC: - switch (blendMode) { - case SDL_BLENDMODE_NONE: - return &GLES2_FragmentShader_None_TextureBGRSrc; - case SDL_BLENDMODE_BLEND: - return &GLES2_FragmentShader_Alpha_TextureBGRSrc; - case SDL_BLENDMODE_ADD: - return &GLES2_FragmentShader_Additive_TextureBGRSrc; - case SDL_BLENDMODE_MOD: - return &GLES2_FragmentShader_Modulated_TextureBGRSrc; - default: - return NULL; - } - - case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_SRC: - { - return &GLES2_FragmentShader_TextureYUVSrc; - } - - case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_SRC: - { - return &GLES2_FragmentShader_TextureNV12Src; - } - - case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_SRC: - { - return &GLES2_FragmentShader_TextureNV21Src; - } - + return &GLES2_FragmentShader_TextureBGRSrc; + case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG_SRC: + return &GLES2_FragmentShader_TextureYUVJPEGSrc; + case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601_SRC: + return &GLES2_FragmentShader_TextureYUVBT601Src; + case GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709_SRC: + return &GLES2_FragmentShader_TextureYUVBT709Src; + case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_JPEG_SRC: + return &GLES2_FragmentShader_TextureNV12JPEGSrc; + case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT601_SRC: + return &GLES2_FragmentShader_TextureNV12BT601Src; + case GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT709_SRC: + return &GLES2_FragmentShader_TextureNV12BT709Src; + case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG_SRC: + return &GLES2_FragmentShader_TextureNV21JPEGSrc; + case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601_SRC: + return &GLES2_FragmentShader_TextureNV21BT601Src; + case GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709_SRC: + return &GLES2_FragmentShader_TextureNV21BT709Src; + case GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES_SRC: + return &GLES2_FragmentShader_TextureExternalOESSrc; default: return NULL; } diff --git a/Engine/lib/sdl/src/render/opengles2/SDL_shaders_gles2.h b/Engine/lib/sdl/src/render/opengles2/SDL_shaders_gles2.h index 3958ae00d..c16ce127e 100644 --- a/Engine/lib/sdl/src/render/opengles2/SDL_shaders_gles2.h +++ b/Engine/lib/sdl/src/render/opengles2/SDL_shaders_gles2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,10 +20,10 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_RENDER_OGL_ES2 +#ifndef SDL_shaders_gles2_h_ +#define SDL_shaders_gles2_h_ -#ifndef SDL_shaderdata_h_ -#define SDL_shaderdata_h_ +#if SDL_VIDEO_RENDER_OGL_ES2 typedef struct GLES2_ShaderInstance { @@ -47,17 +47,24 @@ typedef enum GLES2_SHADER_FRAGMENT_TEXTURE_ARGB_SRC, GLES2_SHADER_FRAGMENT_TEXTURE_BGR_SRC, GLES2_SHADER_FRAGMENT_TEXTURE_RGB_SRC, - GLES2_SHADER_FRAGMENT_TEXTURE_YUV_SRC, - GLES2_SHADER_FRAGMENT_TEXTURE_NV12_SRC, - GLES2_SHADER_FRAGMENT_TEXTURE_NV21_SRC + GLES2_SHADER_FRAGMENT_TEXTURE_YUV_JPEG_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT601_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_YUV_BT709_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_NV12_JPEG_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT601_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_NV12_BT709_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_NV21_JPEG_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709_SRC, + GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES_SRC } GLES2_ShaderType; #define GLES2_SOURCE_SHADER (GLenum)-1 -const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type, SDL_BlendMode blendMode); - -#endif /* SDL_shaderdata_h_ */ +const GLES2_Shader *GLES2_GetShader(GLES2_ShaderType type); #endif /* SDL_VIDEO_RENDER_OGL_ES2 */ +#endif /* SDL_shaders_gles2_h_ */ + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/render/psp/SDL_render_psp.c b/Engine/lib/sdl/src/render/psp/SDL_render_psp.c index f2851319e..38f893e8f 100644 --- a/Engine/lib/sdl/src/render/psp/SDL_render_psp.c +++ b/Engine/lib/sdl/src/render/psp/SDL_render_psp.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -949,11 +949,11 @@ PSP_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, vertices[3].y = y + sw - ch; vertices[3].z = 0; - if (flip & SDL_FLIP_HORIZONTAL) { + if (flip & SDL_FLIP_VERTICAL) { Swap(&vertices[0].v, &vertices[2].v); Swap(&vertices[1].v, &vertices[3].v); } - if (flip & SDL_FLIP_VERTICAL) { + if (flip & SDL_FLIP_HORIZONTAL) { Swap(&vertices[0].u, &vertices[2].u); Swap(&vertices[1].u, &vertices[3].u); } diff --git a/Engine/lib/sdl/src/render/software/SDL_blendfillrect.c b/Engine/lib/sdl/src/render/software/SDL_blendfillrect.c index 7cfb274ae..8a3f7500e 100644 --- a/Engine/lib/sdl/src/render/software/SDL_blendfillrect.c +++ b/Engine/lib/sdl/src/render/software/SDL_blendfillrect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -245,7 +245,7 @@ SDL_BlendFillRect(SDL_Surface * dst, const SDL_Rect * rect, } else { return SDL_BlendFillRect_ARGB8888(dst, rect, blendMode, r, g, b, a); } - break; + /* break; -Wunreachable-code-break */ } break; default: diff --git a/Engine/lib/sdl/src/render/software/SDL_blendfillrect.h b/Engine/lib/sdl/src/render/software/SDL_blendfillrect.h index 88bb2e2c4..262210f77 100644 --- a/Engine/lib/sdl/src/render/software/SDL_blendfillrect.h +++ b/Engine/lib/sdl/src/render/software/SDL_blendfillrect.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/software/SDL_blendline.c b/Engine/lib/sdl/src/render/software/SDL_blendline.c index ef0d58531..0ed0ccd20 100644 --- a/Engine/lib/sdl/src/render/software/SDL_blendline.c +++ b/Engine/lib/sdl/src/render/software/SDL_blendline.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -685,7 +685,7 @@ SDL_CalculateBlendLineFunc(const SDL_PixelFormat * fmt) } else { return SDL_BlendLine_RGB2; } - break; + /* break; -Wunreachable-code-break */ case 4: if (fmt->Rmask == 0x00FF0000) { if (fmt->Amask) { diff --git a/Engine/lib/sdl/src/render/software/SDL_blendline.h b/Engine/lib/sdl/src/render/software/SDL_blendline.h index c0b545f34..82072cb00 100644 --- a/Engine/lib/sdl/src/render/software/SDL_blendline.h +++ b/Engine/lib/sdl/src/render/software/SDL_blendline.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/software/SDL_blendpoint.c b/Engine/lib/sdl/src/render/software/SDL_blendpoint.c index fc42dfe76..37fb49862 100644 --- a/Engine/lib/sdl/src/render/software/SDL_blendpoint.c +++ b/Engine/lib/sdl/src/render/software/SDL_blendpoint.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -235,13 +235,11 @@ SDL_BlendPoint(SDL_Surface * dst, int x, int y, SDL_BlendMode blendMode, Uint8 r switch (dst->format->Rmask) { case 0x00FF0000: if (!dst->format->Amask) { - return SDL_BlendPoint_RGB888(dst, x, y, blendMode, r, g, b, - a); + return SDL_BlendPoint_RGB888(dst, x, y, blendMode, r, g, b, a); } else { - return SDL_BlendPoint_ARGB8888(dst, x, y, blendMode, r, g, b, - a); + return SDL_BlendPoint_ARGB8888(dst, x, y, blendMode, r, g, b, a); } - break; + /* break; -Wunreachable-code-break */ } break; default: diff --git a/Engine/lib/sdl/src/render/software/SDL_blendpoint.h b/Engine/lib/sdl/src/render/software/SDL_blendpoint.h index 58ddec7ee..dd9e49c1c 100644 --- a/Engine/lib/sdl/src/render/software/SDL_blendpoint.h +++ b/Engine/lib/sdl/src/render/software/SDL_blendpoint.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/software/SDL_draw.h b/Engine/lib/sdl/src/render/software/SDL_draw.h index 3a5e7cf11..945f2bcd0 100644 --- a/Engine/lib/sdl/src/render/software/SDL_draw.h +++ b/Engine/lib/sdl/src/render/software/SDL_draw.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -562,10 +562,10 @@ do { \ while (height--) { \ { int n = (width+3)/4; \ switch (width & 3) { \ - case 0: do { op; pixel++; \ - case 3: op; pixel++; \ - case 2: op; pixel++; \ - case 1: op; pixel++; \ + case 0: do { op; pixel++; /* fallthrough */ \ + case 3: op; pixel++; /* fallthrough */ \ + case 2: op; pixel++; /* fallthrough */ \ + case 1: op; pixel++; /* fallthrough */ \ } while ( --n > 0 ); \ } \ } \ diff --git a/Engine/lib/sdl/src/render/software/SDL_drawline.c b/Engine/lib/sdl/src/render/software/SDL_drawline.c index fd50ea748..eeb54ed3a 100644 --- a/Engine/lib/sdl/src/render/software/SDL_drawline.c +++ b/Engine/lib/sdl/src/render/software/SDL_drawline.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/software/SDL_drawline.h b/Engine/lib/sdl/src/render/software/SDL_drawline.h index 40721c3fc..9395d5050 100644 --- a/Engine/lib/sdl/src/render/software/SDL_drawline.h +++ b/Engine/lib/sdl/src/render/software/SDL_drawline.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/software/SDL_drawpoint.c b/Engine/lib/sdl/src/render/software/SDL_drawpoint.c index 98f0d83c0..64a4e52a9 100644 --- a/Engine/lib/sdl/src/render/software/SDL_drawpoint.c +++ b/Engine/lib/sdl/src/render/software/SDL_drawpoint.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/software/SDL_drawpoint.h b/Engine/lib/sdl/src/render/software/SDL_drawpoint.h index e77857ac9..c36670007 100644 --- a/Engine/lib/sdl/src/render/software/SDL_drawpoint.h +++ b/Engine/lib/sdl/src/render/software/SDL_drawpoint.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/software/SDL_render_sw.c b/Engine/lib/sdl/src/render/software/SDL_render_sw.c index e7a6cd88d..89e54b859 100644 --- a/Engine/lib/sdl/src/render/software/SDL_render_sw.c +++ b/Engine/lib/sdl/src/render/software/SDL_render_sw.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -239,7 +239,10 @@ SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) SDL_SetSurfaceAlphaMod(texture->driverdata, texture->a); SDL_SetSurfaceBlendMode(texture->driverdata, texture->blendMode); - if (texture->access == SDL_TEXTUREACCESS_STATIC) { + /* Only RLE encode textures without an alpha channel since the RLE coder + * discards the color values of pixels with an alpha value of zero. + */ + if (texture->access == SDL_TEXTUREACCESS_STATIC && !Amask) { SDL_SetSurfaceRLE(texture->driverdata, 1); } @@ -368,9 +371,14 @@ SW_UpdateClipRect(SDL_Renderer * renderer) SDL_Surface *surface = data->surface; if (surface) { if (renderer->clipping_enabled) { - SDL_SetClipRect(surface, &renderer->clip_rect); + SDL_Rect clip_rect; + clip_rect = renderer->clip_rect; + clip_rect.x += renderer->viewport.x; + clip_rect.y += renderer->viewport.y; + SDL_IntersectRect(&renderer->viewport, &clip_rect, &clip_rect); + SDL_SetClipRect(surface, &clip_rect); } else { - SDL_SetClipRect(surface, NULL); + SDL_SetClipRect(surface, &renderer->viewport); } } return 0; @@ -599,9 +607,15 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, SDL_Surface *surface = SW_ActivateRenderer(renderer); SDL_Surface *src = (SDL_Surface *) texture->driverdata; SDL_Rect final_rect, tmp_rect; - SDL_Surface *surface_rotated, *surface_scaled; - int retval, dstwidth, dstheight, abscenterx, abscentery; + SDL_Surface *src_clone, *src_rotated, *src_scaled; + SDL_Surface *mask = NULL, *mask_rotated = NULL; + int retval = 0, dstwidth, dstheight, abscenterx, abscentery; double cangle, sangle, px, py, p1x, p1y, p2x, p2y, p3x, p3y, p4x, p4y; + SDL_BlendMode blendmode; + Uint8 alphaMod, rMod, gMod, bMod; + int applyModulation = SDL_FALSE; + int blitRequired = SDL_FALSE; + int isOpaque = SDL_FALSE; if (!surface) { return -1; @@ -617,69 +631,104 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, final_rect.w = (int)dstrect->w; final_rect.h = (int)dstrect->h; - /* SDLgfx_rotateSurface doesn't accept a source rectangle, so crop and scale if we need to */ tmp_rect = final_rect; tmp_rect.x = 0; tmp_rect.y = 0; - if (srcrect->w == final_rect.w && srcrect->h == final_rect.h && srcrect->x == 0 && srcrect->y == 0) { - surface_scaled = src; /* but if we don't need to, just use the original */ - retval = 0; - } else { - SDL_Surface *blit_src = src; - Uint32 colorkey; - SDL_BlendMode blendMode; - Uint8 alphaMod, r, g, b; - SDL_bool cloneSource = SDL_FALSE; - surface_scaled = SDL_CreateRGBSurface(SDL_SWSURFACE, final_rect.w, final_rect.h, src->format->BitsPerPixel, - src->format->Rmask, src->format->Gmask, - src->format->Bmask, src->format->Amask ); - if (!surface_scaled) { - return -1; + /* It is possible to encounter an RLE encoded surface here and locking it is + * necessary because this code is going to access the pixel buffer directly. + */ + if (SDL_MUSTLOCK(src)) { + SDL_LockSurface(src); + } + + /* Clone the source surface but use its pixel buffer directly. + * The original source surface must be treated as read-only. + */ + src_clone = SDL_CreateRGBSurfaceFrom(src->pixels, src->w, src->h, src->format->BitsPerPixel, src->pitch, + src->format->Rmask, src->format->Gmask, + src->format->Bmask, src->format->Amask); + if (src_clone == NULL) { + if (SDL_MUSTLOCK(src)) { + SDL_UnlockSurface(src); } + return -1; + } - /* copy the color key, alpha mod, blend mode, and color mod so the scaled surface behaves like the source */ - if (SDL_GetColorKey(src, &colorkey) == 0) { - SDL_SetColorKey(surface_scaled, SDL_TRUE, colorkey); - cloneSource = SDL_TRUE; - } - SDL_GetSurfaceAlphaMod(src, &alphaMod); /* these will be copied to surface_scaled below if necessary */ - SDL_GetSurfaceBlendMode(src, &blendMode); - SDL_GetSurfaceColorMod(src, &r, &g, &b); + SDL_GetSurfaceBlendMode(src, &blendmode); + SDL_GetSurfaceAlphaMod(src, &alphaMod); + SDL_GetSurfaceColorMod(src, &rMod, &gMod, &bMod); - /* now we need to blit the src into surface_scaled. since we want to copy the colors from the source to - * surface_scaled rather than blend them, etc. we'll need to disable the blend mode, alpha mod, etc. - * but we don't want to modify src (in case it's being used on other threads), so we'll need to clone it - * before changing the blend options - */ - cloneSource |= blendMode != SDL_BLENDMODE_NONE || (alphaMod & r & g & b) != 255; - if (cloneSource) { - blit_src = SDL_ConvertSurface(src, src->format, src->flags); /* clone src */ - if (!blit_src) { - SDL_FreeSurface(surface_scaled); - return -1; - } - SDL_SetSurfaceAlphaMod(blit_src, 255); /* disable all blending options in blit_src */ - SDL_SetSurfaceBlendMode(blit_src, SDL_BLENDMODE_NONE); - SDL_SetColorKey(blit_src, 0, 0); - SDL_SetSurfaceColorMod(blit_src, 255, 255, 255); - SDL_SetSurfaceRLE(blit_src, 0); /* don't RLE encode a surface we'll only use once */ + /* SDLgfx_rotateSurface only accepts 32-bit surfaces with a 8888 layout. Everything else has to be converted. */ + if (src->format->BitsPerPixel != 32 || SDL_PIXELLAYOUT(src->format->format) != SDL_PACKEDLAYOUT_8888 || !src->format->Amask) { + blitRequired = SDL_TRUE; + } - SDL_SetSurfaceAlphaMod(surface_scaled, alphaMod); /* copy blending options to surface_scaled */ - SDL_SetSurfaceBlendMode(surface_scaled, blendMode); - SDL_SetSurfaceColorMod(surface_scaled, r, g, b); - } + /* If scaling and cropping is necessary, it has to be taken care of before the rotation. */ + if (!(srcrect->w == final_rect.w && srcrect->h == final_rect.h && srcrect->x == 0 && srcrect->y == 0)) { + blitRequired = SDL_TRUE; + } - retval = SDL_BlitScaled(blit_src, srcrect, surface_scaled, &tmp_rect); - if (blit_src != src) { - SDL_FreeSurface(blit_src); + /* The color and alpha modulation has to be applied before the rotation when using the NONE and MOD blend modes. */ + if ((blendmode == SDL_BLENDMODE_NONE || blendmode == SDL_BLENDMODE_MOD) && (alphaMod & rMod & gMod & bMod) != 255) { + applyModulation = SDL_TRUE; + SDL_SetSurfaceAlphaMod(src_clone, alphaMod); + SDL_SetSurfaceColorMod(src_clone, rMod, gMod, bMod); + } + + /* Opaque surfaces are much easier to handle with the NONE blend mode. */ + if (blendmode == SDL_BLENDMODE_NONE && !src->format->Amask && alphaMod == 255) { + isOpaque = SDL_TRUE; + } + + /* The NONE blend mode requires a mask for non-opaque surfaces. This mask will be used + * to clear the pixels in the destination surface. The other steps are explained below. + */ + if (blendmode == SDL_BLENDMODE_NONE && !isOpaque) { + mask = SDL_CreateRGBSurface(0, final_rect.w, final_rect.h, 32, + 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); + if (mask == NULL) { + retval = -1; + } else { + SDL_SetSurfaceBlendMode(mask, SDL_BLENDMODE_MOD); } } + /* Create a new surface should there be a format mismatch or if scaling, cropping, + * or modulation is required. It's possible to use the source surface directly otherwise. + */ + if (!retval && (blitRequired || applyModulation)) { + SDL_Rect scale_rect = tmp_rect; + src_scaled = SDL_CreateRGBSurface(0, final_rect.w, final_rect.h, 32, + 0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000); + if (src_scaled == NULL) { + retval = -1; + } else { + SDL_SetSurfaceBlendMode(src_clone, SDL_BLENDMODE_NONE); + retval = SDL_BlitScaled(src_clone, srcrect, src_scaled, &scale_rect); + SDL_FreeSurface(src_clone); + src_clone = src_scaled; + src_scaled = NULL; + } + } + + /* SDLgfx_rotateSurface is going to make decisions depending on the blend mode. */ + SDL_SetSurfaceBlendMode(src_clone, blendmode); + if (!retval) { SDLgfx_rotozoomSurfaceSizeTrig(tmp_rect.w, tmp_rect.h, angle, &dstwidth, &dstheight, &cangle, &sangle); - surface_rotated = SDLgfx_rotateSurface(surface_scaled, angle, dstwidth/2, dstheight/2, GetScaleQuality(), flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, dstwidth, dstheight, cangle, sangle); - if(surface_rotated) { + src_rotated = SDLgfx_rotateSurface(src_clone, angle, dstwidth/2, dstheight/2, GetScaleQuality(), flip & SDL_FLIP_HORIZONTAL, flip & SDL_FLIP_VERTICAL, dstwidth, dstheight, cangle, sangle); + if (src_rotated == NULL) { + retval = -1; + } + if (!retval && mask != NULL) { + /* The mask needed for the NONE blend mode gets rotated with the same parameters. */ + mask_rotated = SDLgfx_rotateSurface(mask, angle, dstwidth/2, dstheight/2, SDL_FALSE, 0, 0, dstwidth, dstheight, cangle, sangle); + if (mask_rotated == NULL) { + retval = -1; + } + } + if (!retval) { /* Find out where the new origin is by rotating the four final_rect points around the center and then taking the extremes */ abscenterx = final_rect.x + (int)center->x; abscentery = final_rect.y + (int)center->y; @@ -715,13 +764,69 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture, tmp_rect.w = dstwidth; tmp_rect.h = dstheight; - retval = SDL_BlitSurface(surface_rotated, NULL, surface, &tmp_rect); - SDL_FreeSurface(surface_rotated); + /* The NONE blend mode needs some special care with non-opaque surfaces. + * Other blend modes or opaque surfaces can be blitted directly. + */ + if (blendmode != SDL_BLENDMODE_NONE || isOpaque) { + if (applyModulation == SDL_FALSE) { + /* If the modulation wasn't already applied, make it happen now. */ + SDL_SetSurfaceAlphaMod(src_rotated, alphaMod); + SDL_SetSurfaceColorMod(src_rotated, rMod, gMod, bMod); + } + retval = SDL_BlitSurface(src_rotated, NULL, surface, &tmp_rect); + } else { + /* The NONE blend mode requires three steps to get the pixels onto the destination surface. + * First, the area where the rotated pixels will be blitted to get set to zero. + * This is accomplished by simply blitting a mask with the NONE blend mode. + * The colorkey set by the rotate function will discard the correct pixels. + */ + SDL_Rect mask_rect = tmp_rect; + SDL_SetSurfaceBlendMode(mask_rotated, SDL_BLENDMODE_NONE); + retval = SDL_BlitSurface(mask_rotated, NULL, surface, &mask_rect); + if (!retval) { + /* The next step copies the alpha value. This is done with the BLEND blend mode and + * by modulating the source colors with 0. Since the destination is all zeros, this + * will effectively set the destination alpha to the source alpha. + */ + SDL_SetSurfaceColorMod(src_rotated, 0, 0, 0); + mask_rect = tmp_rect; + retval = SDL_BlitSurface(src_rotated, NULL, surface, &mask_rect); + if (!retval) { + /* The last step gets the color values in place. The ADD blend mode simply adds them to + * the destination (where the color values are all zero). However, because the ADD blend + * mode modulates the colors with the alpha channel, a surface without an alpha mask needs + * to be created. This makes all source pixels opaque and the colors get copied correctly. + */ + SDL_Surface *src_rotated_rgb; + src_rotated_rgb = SDL_CreateRGBSurfaceFrom(src_rotated->pixels, src_rotated->w, src_rotated->h, + src_rotated->format->BitsPerPixel, src_rotated->pitch, + src_rotated->format->Rmask, src_rotated->format->Gmask, + src_rotated->format->Bmask, 0); + if (src_rotated_rgb == NULL) { + retval = -1; + } else { + SDL_SetSurfaceBlendMode(src_rotated_rgb, SDL_BLENDMODE_ADD); + retval = SDL_BlitSurface(src_rotated_rgb, NULL, surface, &tmp_rect); + SDL_FreeSurface(src_rotated_rgb); + } + } + } + SDL_FreeSurface(mask_rotated); + } + if (src_rotated != NULL) { + SDL_FreeSurface(src_rotated); + } } } - if (surface_scaled != src) { - SDL_FreeSurface(surface_scaled); + if (SDL_MUSTLOCK(src)) { + SDL_UnlockSurface(src); + } + if (mask != NULL) { + SDL_FreeSurface(mask); + } + if (src_clone != NULL) { + SDL_FreeSurface(src_clone); } return retval; } @@ -733,19 +838,14 @@ SW_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, SDL_Surface *surface = SW_ActivateRenderer(renderer); Uint32 src_format; void *src_pixels; - SDL_Rect final_rect; if (!surface) { return -1; } - if (renderer->viewport.x || renderer->viewport.y) { - final_rect.x = renderer->viewport.x + rect->x; - final_rect.y = renderer->viewport.y + rect->y; - final_rect.w = rect->w; - final_rect.h = rect->h; - rect = &final_rect; - } + /* NOTE: The rect is already adjusted according to the viewport by + * SDL_RenderReadPixels. + */ if (rect->x < 0 || rect->x+rect->w > surface->w || rect->y < 0 || rect->y+rect->h > surface->h) { diff --git a/Engine/lib/sdl/src/render/software/SDL_render_sw_c.h b/Engine/lib/sdl/src/render/software/SDL_render_sw_c.h index 89b4e8acc..8f065de7f 100644 --- a/Engine/lib/sdl/src/render/software/SDL_render_sw_c.h +++ b/Engine/lib/sdl/src/render/software/SDL_render_sw_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/render/software/SDL_rotate.c b/Engine/lib/sdl/src/render/software/SDL_rotate.c index 0141d174d..44762048f 100644 --- a/Engine/lib/sdl/src/render/software/SDL_rotate.c +++ b/Engine/lib/sdl/src/render/software/SDL_rotate.c @@ -76,11 +76,6 @@ to a situation where the program can segfault. */ #define GUARD_ROWS (2) -/* ! -\brief Lower limit of absolute zoom factor or rotation degrees. -*/ -#define VALUE_LIMIT 0.001 - /* ! \brief Returns colorkey info for a surface */ @@ -142,7 +137,7 @@ SDLgfx_rotozoomSurfaceSizeTrig(int width, int height, double angle, cy = *cangle * y; sx = *sangle * x; sy = *sangle * y; - + dstwidthhalf = MAX((int) SDL_ceil(MAX(MAX(MAX(SDL_fabs(cx + sy), SDL_fabs(cx - sy)), SDL_fabs(-cx + sy)), SDL_fabs(-cx - sy))), 1); dstheighthalf = MAX((int) @@ -262,7 +257,7 @@ _transformSurfaceRGBA(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int dy = (sdy >> 16); if (flipx) dx = sw - dx; if (flipy) dy = sh - dy; - if ((unsigned)dx < (unsigned)sw && (unsigned)dy < (unsigned)sh) { + if ((dx > -1) && (dy > -1) && (dx < (src->w-1)) && (dy < (src->h-1))) { sp = (tColorRGBA *) ((Uint8 *) src->pixels + src->pitch * dy) + dx; c00 = *sp; sp += 1; @@ -390,10 +385,14 @@ transformSurfaceY(SDL_Surface * src, SDL_Surface * dst, int cx, int cy, int isin /* ! \brief Rotates and zooms a surface with different horizontal and vertival scaling factors and optional anti-aliasing. -Rotates a 32bit or 8bit 'src' surface to newly created 'dst' surface. +Rotates a 32-bit or 8-bit 'src' surface to newly created 'dst' surface. 'angle' is the rotation in degrees, 'centerx' and 'centery' the rotation center. If 'smooth' is set -then the destination 32bit surface is anti-aliased. If the surface is not 8bit -or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. +then the destination 32-bit surface is anti-aliased. 8-bit surfaces must have a colorkey. 32-bit +surfaces must have a 8888 layout with red, green, blue and alpha masks (any ordering goes). +The blend mode of the 'src' surface has some effects on generation of the 'dst' surface: The NONE +mode will set the BLEND mode on the 'dst' surface. The MOD mode either generates a white 'dst' +surface and sets the colorkey or fills the it with the colorkey before copying the pixels. +When using the NONE and MOD modes, color and alpha modulation must be applied before using this function. \param src The surface to rotozoom. \param angle The angle to rotate in degrees. @@ -413,69 +412,47 @@ or 32bit RGBA/ABGR it will be converted into a 32bit RGBA format on the fly. SDL_Surface * SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, int smooth, int flipx, int flipy, int dstwidth, int dstheight, double cangle, double sangle) { - SDL_Surface *rz_src; SDL_Surface *rz_dst; - int is32bit, angle90; + int is8bit, angle90; int i; - Uint8 r = 0, g = 0, b = 0; + SDL_BlendMode blendmode; Uint32 colorkey = 0; - int colorKeyAvailable = 0; + int colorKeyAvailable = SDL_FALSE; double sangleinv, cangleinv; - /* - * Sanity check - */ + /* Sanity check */ if (src == NULL) - return (NULL); + return NULL; - if (src->flags & SDL_TRUE/* SDL_SRCCOLORKEY */) - { - colorkey = _colorkey(src); - SDL_GetRGB(colorkey, src->format, &r, &g, &b); - colorKeyAvailable = 1; - } - /* - * Determine if source surface is 32bit or 8bit - */ - is32bit = (src->format->BitsPerPixel == 32); - if ((is32bit) || (src->format->BitsPerPixel == 8)) { - /* - * Use source surface 'as is' - */ - rz_src = src; - } else { - rz_src = SDL_ConvertSurfaceFormat(src, SDL_PIXELFORMAT_ARGB32, src->flags); - if (rz_src == NULL) { - return NULL; - } - is32bit = 1; + if (SDL_GetColorKey(src, &colorkey) == 0) { + colorKeyAvailable = SDL_TRUE; } - /* Determine target size */ - /* _rotozoomSurfaceSizeTrig(rz_src->w, rz_src->h, angle, &dstwidth, &dstheight, &cangle, &sangle); */ + /* This function requires a 32-bit surface or 8-bit surface with a colorkey */ + is8bit = src->format->BitsPerPixel == 8 && colorKeyAvailable; + if (!(is8bit || (src->format->BitsPerPixel == 32 && src->format->Amask))) + return NULL; - /* - * Calculate target factors from sin/cos and zoom - */ + /* Calculate target factors from sin/cos and zoom */ sangleinv = sangle*65536.0; cangleinv = cangle*65536.0; - /* - * Alloc space to completely contain the rotated surface - */ - if (is32bit) { - /* - * Target surface is 32bit with source RGBA/ABGR ordering - */ - rz_dst = - SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 32, - rz_src->format->Rmask, rz_src->format->Gmask, - rz_src->format->Bmask, rz_src->format->Amask); + /* Alloc space to completely contain the rotated surface */ + rz_dst = NULL; + if (is8bit) { + /* Target surface is 8 bit */ + rz_dst = SDL_CreateRGBSurface(0, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0); + if (rz_dst != NULL) { + for (i = 0; i < src->format->palette->ncolors; i++) { + rz_dst->format->palette->colors[i] = src->format->palette->colors[i]; + } + rz_dst->format->palette->ncolors = src->format->palette->ncolors; + } } else { - /* - * Target surface is 8bit - */ - rz_dst = SDL_CreateRGBSurface(SDL_SWSURFACE, dstwidth, dstheight + GUARD_ROWS, 8, 0, 0, 0, 0); + /* Target surface is 32 bit with source RGBA ordering */ + rz_dst = SDL_CreateRGBSurface(0, dstwidth, dstheight + GUARD_ROWS, 32, + src->format->Rmask, src->format->Gmask, + src->format->Bmask, src->format->Amask); } /* Check target */ @@ -485,17 +462,32 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, /* Adjust for guard rows */ rz_dst->h = dstheight; - if (colorKeyAvailable == 1){ - colorkey = SDL_MapRGB(rz_dst->format, r, g, b); + SDL_GetSurfaceBlendMode(src, &blendmode); - SDL_FillRect(rz_dst, NULL, colorkey ); + if (colorKeyAvailable == SDL_TRUE) { + /* If available, the colorkey will be used to discard the pixels that are outside of the rotated area. */ + SDL_SetColorKey(rz_dst, SDL_TRUE, colorkey); + SDL_FillRect(rz_dst, NULL, colorkey); + } else if (blendmode == SDL_BLENDMODE_NONE) { + blendmode = SDL_BLENDMODE_BLEND; + } else if (blendmode == SDL_BLENDMODE_MOD) { + /* Without a colorkey, the target texture has to be white for the MOD blend mode so + * that the pixels outside the rotated area don't affect the destination surface. + */ + colorkey = SDL_MapRGBA(rz_dst->format, 255, 255, 255, 0); + SDL_FillRect(rz_dst, NULL, colorkey); + /* Setting a white colorkey for the destination surface makes the final blit discard + * all pixels outside of the rotated area. This doesn't interfere with anything because + * white pixels are already a no-op and the MOD blend mode does not interact with alpha. + */ + SDL_SetColorKey(rz_dst, SDL_TRUE, colorkey); } - /* - * Lock source surface - */ - if (SDL_MUSTLOCK(rz_src)) { - SDL_LockSurface(rz_src); + SDL_SetSurfaceBlendMode(rz_dst, blendmode); + + /* Lock source surface */ + if (SDL_MUSTLOCK(src)) { + SDL_LockSurface(src); } /* check if the rotation is a multiple of 90 degrees so we can take a fast path and also somewhat reduce @@ -510,70 +502,29 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int centerx, int centery, angle90 = -1; } - /* - * Check which kind of surface we have - */ - if (is32bit) { - /* - * Call the 32bit transformation routine to do the rotation (using alpha) - */ - if (angle90 >= 0) { - transformSurfaceRGBA90(rz_src, rz_dst, angle90, flipx, flipy); - } else { - _transformSurfaceRGBA(rz_src, rz_dst, centerx, centery, (int) (sangleinv), (int) (cangleinv), flipx, flipy, smooth); - } - /* - * Turn on source-alpha support - */ - /* SDL_SetAlpha(rz_dst, SDL_SRCALPHA, 255); */ - SDL_SetColorKey(rz_dst, /* SDL_SRCCOLORKEY */ SDL_TRUE | SDL_RLEACCEL, _colorkey(rz_src)); - } else { - /* - * Copy palette and colorkey info - */ - for (i = 0; i < rz_src->format->palette->ncolors; i++) { - rz_dst->format->palette->colors[i] = rz_src->format->palette->colors[i]; - } - rz_dst->format->palette->ncolors = rz_src->format->palette->ncolors; - /* - * Call the 8bit transformation routine to do the rotation - */ + if (is8bit) { + /* Call the 8-bit transformation routine to do the rotation */ if(angle90 >= 0) { - transformSurfaceY90(rz_src, rz_dst, angle90, flipx, flipy); + transformSurfaceY90(src, rz_dst, angle90, flipx, flipy); } else { - transformSurfaceY(rz_src, rz_dst, centerx, centery, (int)(sangleinv), (int)(cangleinv), flipx, flipy); + transformSurfaceY(src, rz_dst, centerx, centery, (int)sangleinv, (int)cangleinv, + flipx, flipy); + } + } else { + /* Call the 32-bit transformation routine to do the rotation */ + if (angle90 >= 0) { + transformSurfaceRGBA90(src, rz_dst, angle90, flipx, flipy); + } else { + _transformSurfaceRGBA(src, rz_dst, centerx, centery, (int)sangleinv, (int)cangleinv, + flipx, flipy, smooth); } - SDL_SetColorKey(rz_dst, /* SDL_SRCCOLORKEY */ SDL_TRUE | SDL_RLEACCEL, _colorkey(rz_src)); } - /* copy alpha mod, color mod, and blend mode */ - { - SDL_BlendMode blendMode; - Uint8 alphaMod, cr, cg, cb; - SDL_GetSurfaceAlphaMod(src, &alphaMod); - SDL_GetSurfaceBlendMode(src, &blendMode); - SDL_GetSurfaceColorMod(src, &cr, &cg, &cb); - SDL_SetSurfaceAlphaMod(rz_dst, alphaMod); - SDL_SetSurfaceBlendMode(rz_dst, blendMode); - SDL_SetSurfaceColorMod(rz_dst, cr, cg, cb); + /* Unlock source surface */ + if (SDL_MUSTLOCK(src)) { + SDL_UnlockSurface(src); } - /* - * Unlock source surface - */ - if (SDL_MUSTLOCK(rz_src)) { - SDL_UnlockSurface(rz_src); - } - - /* - * Cleanup temp surface - */ - if (rz_src != src) { - SDL_FreeSurface(rz_src); - } - - /* - * Return destination surface - */ - return (rz_dst); + /* Return rotated surface */ + return rz_dst; } diff --git a/Engine/lib/sdl/src/render/software/SDL_rotate.h b/Engine/lib/sdl/src/render/software/SDL_rotate.h index 338109fc0..2bf2ea82e 100644 --- a/Engine/lib/sdl/src/render/software/SDL_rotate.h +++ b/Engine/lib/sdl/src/render/software/SDL_rotate.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/stdlib/SDL_getenv.c b/Engine/lib/sdl/src/stdlib/SDL_getenv.c index 3fc4119fd..591a314f6 100644 --- a/Engine/lib/sdl/src/stdlib/SDL_getenv.c +++ b/Engine/lib/sdl/src/stdlib/SDL_getenv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,6 +29,10 @@ #include "../core/windows/SDL_windows.h" #endif +#if defined(__ANDROID__) +#include "../core/android/SDL_android.h" +#endif + #include "SDL_stdinc.h" #if defined(__WIN32__) && (!defined(HAVE_SETENV) || !defined(HAVE_GETENV)) @@ -60,9 +64,7 @@ SDL_setenv(const char *name, const char *value, int overwrite) } if (!overwrite) { - char ch = 0; - const size_t len = GetEnvironmentVariableA(name, &ch, sizeof (ch)); - if (len > 0) { + if (GetEnvironmentVariableA(name, NULL, 0) > 0) { return 0; /* asked not to overwrite existing value. */ } } @@ -173,8 +175,13 @@ SDL_setenv(const char *name, const char *value, int overwrite) char * SDL_getenv(const char *name) { +#if defined(__ANDROID__) + /* Make sure variables from the application manifest are available */ + Android_JNI_GetManifestEnvironmentVariables(); +#endif + /* Input validation */ - if (!name || SDL_strlen(name)==0) { + if (!name || !*name) { return NULL; } diff --git a/Engine/lib/sdl/src/stdlib/SDL_iconv.c b/Engine/lib/sdl/src/stdlib/SDL_iconv.c index 34bcd8431..f8dbc9fa7 100644 --- a/Engine/lib/sdl/src/stdlib/SDL_iconv.c +++ b/Engine/lib/sdl/src/stdlib/SDL_iconv.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,6 +38,7 @@ If we get this wrong, it's just a warning, so no big deal. */ #if defined(_XGP6) || defined(__APPLE__) || \ + defined(__EMSCRIPTEN__) || \ (defined(__GLIBC__) && ((__GLIBC__ > 2) || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 2)) || \ (defined(_NEWLIB_VERSION))) #define ICONV_INBUF_NONCONST @@ -797,6 +798,7 @@ SDL_iconv(SDL_iconv_t cd, if (ch > 0x10FFFF) { ch = UNKNOWN_UNICODE; } + /* fallthrough */ case ENCODING_UCS4BE: if (ch > 0x7FFFFFFF) { ch = UNKNOWN_UNICODE; @@ -818,6 +820,7 @@ SDL_iconv(SDL_iconv_t cd, if (ch > 0x10FFFF) { ch = UNKNOWN_UNICODE; } + /* fallthrough */ case ENCODING_UCS4LE: if (ch > 0x7FFFFFFF) { ch = UNKNOWN_UNICODE; diff --git a/Engine/lib/sdl/src/stdlib/SDL_malloc.c b/Engine/lib/sdl/src/stdlib/SDL_malloc.c index d640c8fad..ace76bf70 100644 --- a/Engine/lib/sdl/src/stdlib/SDL_malloc.c +++ b/Engine/lib/sdl/src/stdlib/SDL_malloc.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,33 +26,11 @@ #include "../SDL_internal.h" /* This file contains portable memory management functions for SDL */ - #include "SDL_stdinc.h" +#include "SDL_atomic.h" +#include "SDL_error.h" -#if defined(HAVE_MALLOC) - -void *SDL_malloc(size_t size) -{ - return malloc(size); -} - -void *SDL_calloc(size_t nmemb, size_t size) -{ - return calloc(nmemb, size); -} - -void *SDL_realloc(void *ptr, size_t size) -{ - return realloc(ptr, size); -} - -void SDL_free(void *ptr) -{ - free(ptr); -} - -#else /* the rest of this is a LOT of tapdancing to implement malloc. :) */ - +#ifndef HAVE_MALLOC #define LACKS_SYS_TYPES_H #define LACKS_STDIO_H #define LACKS_STRINGS_H @@ -60,6 +38,7 @@ void SDL_free(void *ptr) #define LACKS_STDLIB_H #define ABORT #define USE_LOCKS 1 +#define USE_DL_PREFIX /* This is a version (aka dlmalloc) of malloc/free/realloc written by @@ -636,12 +615,12 @@ DEFAULT_MMAP_THRESHOLD default: 256K #define MALLINFO_FIELD_TYPE size_t #endif /* MALLINFO_FIELD_TYPE */ +#ifndef memset #define memset SDL_memset +#endif +#ifndef memcpy #define memcpy SDL_memcpy -#define malloc SDL_malloc -#define calloc SDL_calloc -#define realloc SDL_realloc -#define free SDL_free +#endif /* mallopt tuning options. SVID/XPG defines four standard parameter @@ -2946,13 +2925,17 @@ static void internal_malloc_stats(mstate m) { if (!PREACTION(m)) { +#ifndef LACKS_STDIO_H size_t maxfp = 0; +#endif size_t fp = 0; size_t used = 0; check_malloc_state(m); if (is_initialized(m)) { msegmentptr s = &m->seg; +#ifndef LACKS_STDIO_H maxfp = m->max_footprint; +#endif fp = m->footprint; used = fp - (m->topsize + TOP_FOOT_SIZE); @@ -5261,4 +5244,133 @@ History: #endif /* !HAVE_MALLOC */ +#ifdef HAVE_MALLOC +#define real_malloc malloc +#define real_calloc calloc +#define real_realloc realloc +#define real_free free +#else +#define real_malloc dlmalloc +#define real_calloc dlcalloc +#define real_realloc dlrealloc +#define real_free dlfree +#endif + +/* Memory functions used by SDL that can be replaced by the application */ +static struct +{ + SDL_malloc_func malloc_func; + SDL_calloc_func calloc_func; + SDL_realloc_func realloc_func; + SDL_free_func free_func; + SDL_atomic_t num_allocations; +} s_mem = { + real_malloc, real_calloc, real_realloc, real_free, { 0 } +}; + +void SDL_GetMemoryFunctions(SDL_malloc_func *malloc_func, + SDL_calloc_func *calloc_func, + SDL_realloc_func *realloc_func, + SDL_free_func *free_func) +{ + if (malloc_func) { + *malloc_func = s_mem.malloc_func; + } + if (calloc_func) { + *calloc_func = s_mem.calloc_func; + } + if (realloc_func) { + *realloc_func = s_mem.realloc_func; + } + if (free_func) { + *free_func = s_mem.free_func; + } +} + +int SDL_SetMemoryFunctions(SDL_malloc_func malloc_func, + SDL_calloc_func calloc_func, + SDL_realloc_func realloc_func, + SDL_free_func free_func) +{ + if (!malloc_func) { + return SDL_InvalidParamError("malloc_func"); + } + if (!calloc_func) { + return SDL_InvalidParamError("calloc_func"); + } + if (!realloc_func) { + return SDL_InvalidParamError("realloc_func"); + } + if (!free_func) { + return SDL_InvalidParamError("free_func"); + } + + s_mem.malloc_func = malloc_func; + s_mem.calloc_func = calloc_func; + s_mem.realloc_func = realloc_func; + s_mem.free_func = free_func; + return 0; +} + +int SDL_GetNumAllocations(void) +{ + return SDL_AtomicGet(&s_mem.num_allocations); +} + +void *SDL_malloc(size_t size) +{ + void *mem; + + if (!size) { + size = 1; + } + + mem = s_mem.malloc_func(size); + if (mem) { + SDL_AtomicIncRef(&s_mem.num_allocations); + } + return mem; +} + +void *SDL_calloc(size_t nmemb, size_t size) +{ + void *mem; + + if (!nmemb || !size) { + nmemb = 1; + size = 1; + } + + mem = s_mem.calloc_func(nmemb, size); + if (mem) { + SDL_AtomicIncRef(&s_mem.num_allocations); + } + return mem; +} + +void *SDL_realloc(void *ptr, size_t size) +{ + void *mem; + + if (!ptr && !size) { + size = 1; + } + + mem = s_mem.realloc_func(ptr, size); + if (mem && !ptr) { + SDL_AtomicIncRef(&s_mem.num_allocations); + } + return mem; +} + +void SDL_free(void *ptr) +{ + if (!ptr) { + return; + } + + s_mem.free_func(ptr); + (void)SDL_AtomicDecRef(&s_mem.num_allocations); +} + /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/stdlib/SDL_qsort.c b/Engine/lib/sdl/src/stdlib/SDL_qsort.c index 2ef33b15e..700b9da91 100644 --- a/Engine/lib/sdl/src/stdlib/SDL_qsort.c +++ b/Engine/lib/sdl/src/stdlib/SDL_qsort.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -275,7 +275,7 @@ typedef struct { char * first; char * last; } stack_entry; /* and so is the pivoting logic (note: last is inclusive): */ #define Pivot(swapper,sz) \ - if (last-first>PIVOT_THRESHOLD*sz) mid=pivot_big(first,mid,last,sz,compare);\ + if ((size_t)(last-first)>PIVOT_THRESHOLD*sz) mid=pivot_big(first,mid,last,sz,compare);\ else { \ if (compare(first,mid)<0) { \ if (compare(mid,last)>0) { \ @@ -362,7 +362,7 @@ typedef struct { char * first; char * last; } stack_entry; static char * pivot_big(char *first, char *mid, char *last, size_t size, int compare(const void *, const void *)) { - int d=(((last-first)/size)>>3)*size; + size_t d=(((last-first)/size)>>3)*size; #ifdef DEBUG_QSORT fprintf(stderr, "pivot_big: first=%p last=%p size=%lu n=%lu\n", first, (unsigned long)last, size, (unsigned long)((last-first+1)/size)); #endif @@ -413,7 +413,7 @@ static void qsort_nonaligned(void *base, size_t nmemb, size_t size, first=(char*)base; last=first+(nmemb-1)*size; - if (last-first>=trunc) { + if ((size_t)(last-first)>=trunc) { char *ffirst=first, *llast=last; while (1) { /* Select pivot */ @@ -444,7 +444,7 @@ static void qsort_aligned(void *base, size_t nmemb, size_t size, first=(char*)base; last=first+(nmemb-1)*size; - if (last-first>=trunc) { + if ((size_t)(last-first)>=trunc) { char *ffirst=first,*llast=last; while (1) { /* Select pivot */ @@ -519,7 +519,7 @@ extern void qsortG(void *base, size_t nmemb, size_t size, int (*compare)(const void *, const void *)) { if (nmemb<=1) return; - if (((int)base|size)&(WORD_BYTES-1)) + if (((size_t)base|size)&(WORD_BYTES-1)) qsort_nonaligned(base,nmemb,size,compare); else if (size!=WORD_BYTES) qsort_aligned(base,nmemb,size,compare); diff --git a/Engine/lib/sdl/src/stdlib/SDL_stdlib.c b/Engine/lib/sdl/src/stdlib/SDL_stdlib.c index f5a152b49..b36d83c79 100644 --- a/Engine/lib/sdl/src/stdlib/SDL_stdlib.c +++ b/Engine/lib/sdl/src/stdlib/SDL_stdlib.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,7 +38,17 @@ SDL_atan(double x) return atan(x); #else return SDL_uclibc_atan(x); -#endif /* HAVE_ATAN */ +#endif +} + +float +SDL_atanf(float x) +{ +#if defined(HAVE_ATANF) + return atanf(x); +#else + return (float)SDL_atan((double)x); +#endif } double @@ -48,7 +58,17 @@ SDL_atan2(double x, double y) return atan2(x, y); #else return SDL_uclibc_atan2(x, y); -#endif /* HAVE_ATAN2 */ +#endif +} + +float +SDL_atan2f(float x, float y) +{ +#if defined(HAVE_ATAN2F) + return atan2f(x, y); +#else + return (float)SDL_atan2((double)x, (double)y); +#endif } double @@ -71,6 +91,16 @@ SDL_acos(double val) #endif } +float +SDL_acosf(float val) +{ +#if defined(HAVE_ACOSF) + return acosf(val); +#else + return (float)SDL_acos((double)val); +#endif +} + double SDL_asin(double val) { @@ -87,6 +117,16 @@ SDL_asin(double val) #endif } +float +SDL_asinf(float val) +{ +#if defined(HAVE_ASINF) + return asinf(val); +#else + return (float)SDL_asin((double)val); +#endif +} + double SDL_ceil(double x) { @@ -102,6 +142,16 @@ SDL_ceil(double x) #endif /* HAVE_CEIL */ } +float +SDL_ceilf(float x) +{ +#if defined(HAVE_CEILF) + return ceilf(x); +#else + return (float)SDL_ceil((float)x); +#endif +} + double SDL_copysign(double x, double y) { @@ -109,11 +159,27 @@ SDL_copysign(double x, double y) return copysign(x, y); #elif defined(HAVE__COPYSIGN) return _copysign(x, y); +#elif defined(__WATCOMC__) && defined(__386__) + /* this is nasty as hell, but it works.. */ + unsigned int *xi = (unsigned int *) &x, + *yi = (unsigned int *) &y; + xi[1] = (yi[1] & 0x80000000) | (xi[1] & 0x7fffffff); + return x; #else return SDL_uclibc_copysign(x, y); #endif /* HAVE_COPYSIGN */ } +float +SDL_copysignf(float x, float y) +{ +#if defined(HAVE_COPYSIGNF) + return copysignf(x, y); +#else + return (float)SDL_copysign((double)x, (double)y); +#endif +} + double SDL_cos(double x) { @@ -121,7 +187,7 @@ SDL_cos(double x) return cos(x); #else return SDL_uclibc_cos(x); -#endif /* HAVE_COS */ +#endif } float @@ -141,7 +207,17 @@ SDL_fabs(double x) return fabs(x); #else return SDL_uclibc_fabs(x); -#endif /* HAVE_FABS */ +#endif +} + +float +SDL_fabsf(float x) +{ +#if defined(HAVE_FABSF) + return fabsf(x); +#else + return (float)SDL_fabs((double)x); +#endif } double @@ -151,7 +227,37 @@ SDL_floor(double x) return floor(x); #else return SDL_uclibc_floor(x); -#endif /* HAVE_FLOOR */ +#endif +} + +float +SDL_floorf(float x) +{ +#if defined(HAVE_FLOORF) + return floorf(x); +#else + return (float)SDL_floor((double)x); +#endif +} + +double +SDL_fmod(double x, double y) +{ +#if defined(HAVE_FMOD) + return fmod(x, y); +#else + return SDL_uclibc_fmod(x, y); +#endif +} + +float +SDL_fmodf(float x, float y) +{ +#if defined(HAVE_FMODF) + return fmodf(x, y); +#else + return (float)SDL_fmod((double)x, (double)y); +#endif } double @@ -161,7 +267,37 @@ SDL_log(double x) return log(x); #else return SDL_uclibc_log(x); -#endif /* HAVE_LOG */ +#endif +} + +float +SDL_logf(float x) +{ +#if defined(HAVE_LOGF) + return logf(x); +#else + return (float)SDL_log((double)x); +#endif +} + +double +SDL_log10(double x) +{ +#if defined(HAVE_LOG10) + return log10(x); +#else + return SDL_uclibc_log10(x); +#endif +} + +float +SDL_log10f(float x) +{ +#if defined(HAVE_LOG10F) + return log10f(x); +#else + return (float)SDL_log10((double)x); +#endif } double @@ -171,7 +307,17 @@ SDL_pow(double x, double y) return pow(x, y); #else return SDL_uclibc_pow(x, y); -#endif /* HAVE_POW */ +#endif +} + +float +SDL_powf(float x, float y) +{ +#if defined(HAVE_POWF) + return powf(x, y); +#else + return (float)SDL_pow((double)x, (double)y); +#endif } double @@ -181,9 +327,23 @@ SDL_scalbn(double x, int n) return scalbn(x, n); #elif defined(HAVE__SCALB) return _scalb(x, n); +#elif defined(HAVE_LIBC) && defined(HAVE_FLOAT_H) && (FLT_RADIX == 2) +/* from scalbn(3): If FLT_RADIX equals 2 (which is + * usual), then scalbn() is equivalent to ldexp(3). */ + return ldexp(x, n); #else return SDL_uclibc_scalbn(x, n); -#endif /* HAVE_SCALBN */ +#endif +} + +float +SDL_scalbnf(float x, int n) +{ +#if defined(HAVE_SCALBNF) + return scalbnf(x, n); +#else + return (float)SDL_scalbn((double)x, n); +#endif } double @@ -193,7 +353,7 @@ SDL_sin(double x) return sin(x); #else return SDL_uclibc_sin(x); -#endif /* HAVE_SIN */ +#endif } float @@ -203,7 +363,7 @@ SDL_sinf(float x) return sinf(x); #else return (float)SDL_sin((double)x); -#endif /* HAVE_SINF */ +#endif } double @@ -914,8 +1074,8 @@ _allshr() { /* *INDENT-OFF* */ __asm { - cmp cl,40h - jae RETZERO + cmp cl,3Fh + jae RETSIGN cmp cl,20h jae MORE32 shrd eax,edx,cl @@ -923,13 +1083,13 @@ _allshr() ret MORE32: mov eax,edx - xor edx,edx + sar edx,1Fh and cl,1Fh sar eax,cl ret -RETZERO: - xor eax,eax - xor edx,edx +RETSIGN: + sar edx,1Fh + mov eax,edx ret } /* *INDENT-ON* */ diff --git a/Engine/lib/sdl/src/stdlib/SDL_string.c b/Engine/lib/sdl/src/stdlib/SDL_string.c index debbebaed..444ae6d52 100644 --- a/Engine/lib/sdl/src/stdlib/SDL_string.c +++ b/Engine/lib/sdl/src/stdlib/SDL_string.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,24 +18,20 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ - -#if defined(__clang_analyzer__) && !defined(SDL_DISABLE_ANALYZE_MACROS) +#if defined(__clang_analyzer__) #define SDL_DISABLE_ANALYZE_MACROS 1 #endif -#ifndef _GNU_SOURCE -#define _GNU_SOURCE 1 -#endif - #include "../SDL_internal.h" /* This file contains portable string manipulation functions for SDL */ #include "SDL_stdinc.h" - +#if !defined(HAVE_VSSCANF) || !defined(HAVE_STRTOL) || !defined(HAVE_STRTOUL) || !defined(HAVE_STRTOLL) || !defined(HAVE_STRTOULL) || !defined(HAVE_STRTOD) #define SDL_isupperhex(X) (((X) >= 'A') && ((X) <= 'F')) #define SDL_islowerhex(X) (((X) >= 'a') && ((X) <= 'f')) +#endif #define UTF8_IsLeadByte(c) ((c) >= 0xC0 && (c) <= 0xF4) #define UTF8_IsTrailingByte(c) ((c) >= 0x80 && (c) <= 0xBF) @@ -82,7 +78,7 @@ SDL_ScanLong(const char *text, int radix, long *valuep) value += v; ++text; } - if (valuep) { + if (valuep && text > textstart) { if (negative && value) { *valuep = -value; } else { @@ -118,7 +114,7 @@ SDL_ScanUnsignedLong(const char *text, int radix, unsigned long *valuep) value += v; ++text; } - if (valuep) { + if (valuep && text > textstart) { *valuep = value; } return (text - textstart); @@ -150,7 +146,7 @@ SDL_ScanUintPtrT(const char *text, int radix, uintptr_t * valuep) value += v; ++text; } - if (valuep) { + if (valuep && text > textstart) { *valuep = value; } return (text - textstart); @@ -187,7 +183,7 @@ SDL_ScanLongLong(const char *text, int radix, Sint64 * valuep) value += v; ++text; } - if (valuep) { + if (valuep && text > textstart) { if (negative && value) { *valuep = -value; } else { @@ -223,7 +219,7 @@ SDL_ScanUnsignedLongLong(const char *text, int radix, Uint64 * valuep) value += v; ++text; } - if (valuep) { + if (valuep && text > textstart) { *valuep = value; } return (text - textstart); @@ -255,7 +251,7 @@ SDL_ScanFloat(const char *text, double *valuep) ++text; } } - if (valuep) { + if (valuep && text > textstart) { if (negative && value) { *valuep = -value; } else { @@ -465,6 +461,22 @@ SDL_wcslcat(SDL_INOUT_Z_CAP(maxlen) wchar_t *dst, const wchar_t *src, size_t max #endif /* HAVE_WCSLCAT */ } +int +SDL_wcscmp(const wchar_t *str1, const wchar_t *str2) +{ +#if defined(HAVE_WCSCMP) + return wcscmp(str1, str2); +#else + while (*str1 && *str2) { + if (*str1 != *str2) + break; + ++str1; + ++str2; + } + return (int)(*str1 - *str2); +#endif /* HAVE_WCSCMP */ +} + size_t SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen) { @@ -481,7 +493,8 @@ SDL_strlcpy(SDL_OUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen) #endif /* HAVE_STRLCPY */ } -size_t SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes) +size_t +SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size_t dst_bytes) { size_t src_bytes = SDL_strlen(src); size_t bytes = SDL_min(src_bytes, dst_bytes - 1); @@ -513,6 +526,23 @@ size_t SDL_utf8strlcpy(SDL_OUT_Z_CAP(dst_bytes) char *dst, const char *src, size return bytes; } +size_t +SDL_utf8strlen(const char *str) +{ + size_t retval = 0; + const char *p = str; + char ch; + + while ((ch = *(p++))) { + /* if top two bits are 1 and 0, it's a continuation byte. */ + if ((ch & 0xc0) != 0x80) { + retval++; + } + } + + return retval; +} + size_t SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen) { @@ -531,16 +561,12 @@ SDL_strlcat(SDL_INOUT_Z_CAP(maxlen) char *dst, const char *src, size_t maxlen) char * SDL_strdup(const char *string) { -#if defined(HAVE_STRDUP) - return strdup(string); -#else size_t len = SDL_strlen(string) + 1; char *newstr = SDL_malloc(len); if (newstr) { - SDL_strlcpy(newstr, string, len); + SDL_memcpy(newstr, string, len); } return newstr; -#endif /* HAVE_STRDUP */ } char * @@ -789,7 +815,7 @@ SDL_strtol(const char *string, char **endp, int base) return strtol(string, endp, base); #else size_t len; - long value; + long value = 0; if (!base) { if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) { @@ -814,7 +840,7 @@ SDL_strtoul(const char *string, char **endp, int base) return strtoul(string, endp, base); #else size_t len; - unsigned long value; + unsigned long value = 0; if (!base) { if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) { @@ -839,7 +865,7 @@ SDL_strtoll(const char *string, char **endp, int base) return strtoll(string, endp, base); #else size_t len; - Sint64 value; + Sint64 value = 0; if (!base) { if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) { @@ -864,7 +890,7 @@ SDL_strtoull(const char *string, char **endp, int base) return strtoull(string, endp, base); #else size_t len; - Uint64 value; + Uint64 value = 0; if (!base) { if ((SDL_strlen(string) > 2) && (SDL_strncmp(string, "0x", 2) == 0)) { @@ -889,7 +915,7 @@ SDL_strtod(const char *string, char **endp) return strtod(string, endp); #else size_t len; - double value; + double value = 0.0; len = SDL_ScanFloat(string, &value); if (endp) { @@ -911,7 +937,7 @@ SDL_strcmp(const char *str1, const char *str2) ++str1; ++str2; } - return (int) ((unsigned char) *str1 - (unsigned char) *str2); + return (int)((unsigned char) *str1 - (unsigned char) *str2); #endif /* HAVE_STRCMP */ } @@ -1011,6 +1037,10 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) { int retval = 0; + if (!text || !*text) { + return -1; + } + while (*fmt) { if (*fmt == ' ') { while (SDL_isspace((unsigned char) *text)) { @@ -1030,6 +1060,7 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) DO_LONG, DO_LONGLONG } inttype = DO_INT; + size_t advance; SDL_bool suppress = SDL_FALSE; ++fmt; @@ -1109,16 +1140,18 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) case 'd': if (inttype == DO_LONGLONG) { Sint64 value; - text += SDL_ScanLongLong(text, radix, &value); - if (!suppress) { + advance = SDL_ScanLongLong(text, radix, &value); + text += advance; + if (advance && !suppress) { Sint64 *valuep = va_arg(ap, Sint64 *); *valuep = value; ++retval; } } else { long value; - text += SDL_ScanLong(text, radix, &value); - if (!suppress) { + advance = SDL_ScanLong(text, radix, &value); + text += advance; + if (advance && !suppress) { switch (inttype) { case DO_SHORT: { @@ -1160,17 +1193,19 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) /* Fall through to unsigned handling */ case 'u': if (inttype == DO_LONGLONG) { - Uint64 value; - text += SDL_ScanUnsignedLongLong(text, radix, &value); - if (!suppress) { + Uint64 value = 0; + advance = SDL_ScanUnsignedLongLong(text, radix, &value); + text += advance; + if (advance && !suppress) { Uint64 *valuep = va_arg(ap, Uint64 *); *valuep = value; ++retval; } } else { - unsigned long value; - text += SDL_ScanUnsignedLong(text, radix, &value); - if (!suppress) { + unsigned long value = 0; + advance = SDL_ScanUnsignedLong(text, radix, &value); + text += advance; + if (advance && !suppress) { switch (inttype) { case DO_SHORT: { @@ -1201,9 +1236,10 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) break; case 'p': { - uintptr_t value; - text += SDL_ScanUintPtrT(text, 16, &value); - if (!suppress) { + uintptr_t value = 0; + advance = SDL_ScanUintPtrT(text, 16, &value); + text += advance; + if (advance && !suppress) { void **valuep = va_arg(ap, void **); *valuep = (void *) value; ++retval; @@ -1214,8 +1250,9 @@ SDL_vsscanf(const char *text, const char *fmt, va_list ap) case 'f': { double value; - text += SDL_ScanFloat(text, &value); - if (!suppress) { + advance = SDL_ScanFloat(text, &value); + text += advance; + if (advance && !suppress) { float *valuep = va_arg(ap, float *); *valuep = (float) value; ++retval; @@ -1317,6 +1354,10 @@ SDL_PrintString(char *text, size_t maxlen, SDL_FormatInfo *info, const char *str size_t length = 0; size_t slen; + if (string == NULL) { + string = "(null)"; + } + if (info && info->width && (size_t)info->width > SDL_strlen(string)) { char fill = info->pad_zeroes ? '0' : ' '; size_t width = info->width - SDL_strlen(string); @@ -1488,7 +1529,7 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, if (!fmt) { fmt = ""; } - while (*fmt) { + while (*fmt && left > 1) { if (*fmt == '%') { SDL_bool done = SDL_FALSE; size_t len = 0; @@ -1632,6 +1673,16 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, len = SDL_PrintFloat(text, left, &info, va_arg(ap, double)); done = SDL_TRUE; break; + case 'S': + { + /* In practice this is used on Windows for WCHAR strings */ + wchar_t *wide_arg = va_arg(ap, wchar_t *); + char *arg = SDL_iconv_string("UTF-8", "UTF-16LE", (char *)(wide_arg), (SDL_wcslen(wide_arg)+1)*sizeof(*wide_arg)); + len = SDL_PrintString(text, left, &info, arg); + SDL_free(arg); + done = SDL_TRUE; + } + break; case 's': len = SDL_PrintString(text, left, &info, va_arg(ap, char *)); done = SDL_TRUE; @@ -1650,12 +1701,8 @@ SDL_vsnprintf(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, const char *fmt, left -= len; } } else { - if (left > 1) { - *text = *fmt; - --left; - } - ++fmt; - ++text; + *text++ = *fmt++; + --left; } } if (left > 0) { diff --git a/Engine/lib/sdl/src/test/SDL_test_assert.c b/Engine/lib/sdl/src/test/SDL_test_assert.c index ee2f13248..4b5728560 100644 --- a/Engine/lib/sdl/src/test/SDL_test_assert.c +++ b/Engine/lib/sdl/src/test/SDL_test_assert.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -148,3 +148,5 @@ int SDLTest_AssertSummaryToTestResult() } } } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_common.c b/Engine/lib/sdl/src/test/SDL_test_common.c index 1d0b005b5..b7e294af7 100644 --- a/Engine/lib/sdl/src/test/SDL_test_common.c +++ b/Engine/lib/sdl/src/test/SDL_test_common.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,10 +32,33 @@ #define AUDIO_USAGE \ "[--rate N] [--format U8|S8|U16|U16LE|U16BE|S16|S16LE|S16BE] [--channels N] [--samples N]" +static void SDL_snprintfcat(SDL_OUT_Z_CAP(maxlen) char *text, size_t maxlen, SDL_PRINTF_FORMAT_STRING const char *fmt, ... ) +{ + size_t length = SDL_strlen(text); + va_list ap; + + va_start(ap, fmt); + text += length; + maxlen -= length; + SDL_vsnprintf(text, maxlen, fmt, ap); + va_end(ap); +} + SDLTest_CommonState * SDLTest_CommonCreateState(char **argv, Uint32 flags) { - SDLTest_CommonState *state = (SDLTest_CommonState *)SDL_calloc(1, sizeof(*state)); + int i; + SDLTest_CommonState *state; + + /* Do this first so we catch all allocations */ + for (i = 1; argv[i]; ++i) { + if (SDL_strcasecmp(argv[i], "--trackmem") == 0) { + SDLTest_TrackAllocations(); + break; + } + } + + state = (SDLTest_CommonState *)SDL_calloc(1, sizeof(*state)); if (!state) { SDL_OutOfMemory(); return NULL; @@ -435,6 +458,10 @@ SDLTest_CommonArg(SDLTest_CommonState * state, int index) state->audiospec.samples = (Uint16) SDL_atoi(argv[index]); return 2; } + if (SDL_strcasecmp(argv[index], "--trackmem") == 0) { + /* Already handled in SDLTest_CommonCreateState() */ + return 1; + } if ((SDL_strcasecmp(argv[index], "-h") == 0) || (SDL_strcasecmp(argv[index], "--help") == 0)) { /* Print the usage message */ @@ -452,134 +479,140 @@ SDLTest_CommonUsage(SDLTest_CommonState * state) { switch (state->flags & (SDL_INIT_VIDEO | SDL_INIT_AUDIO)) { case SDL_INIT_VIDEO: - return VIDEO_USAGE; + return "[--trackmem] " VIDEO_USAGE; case SDL_INIT_AUDIO: - return AUDIO_USAGE; + return "[--trackmem] " AUDIO_USAGE; case (SDL_INIT_VIDEO | SDL_INIT_AUDIO): - return VIDEO_USAGE " " AUDIO_USAGE; + return "[--trackmem] " VIDEO_USAGE " " AUDIO_USAGE; default: - return ""; + return "[--trackmem]"; } } static void -SDLTest_PrintRendererFlag(Uint32 flag) +SDLTest_PrintRendererFlag(char *text, size_t maxlen, Uint32 flag) { switch (flag) { - case SDL_RENDERER_PRESENTVSYNC: - fprintf(stderr, "PresentVSync"); + case SDL_RENDERER_SOFTWARE: + SDL_snprintfcat(text, maxlen, "Software"); break; case SDL_RENDERER_ACCELERATED: - fprintf(stderr, "Accelerated"); + SDL_snprintfcat(text, maxlen, "Accelerated"); + break; + case SDL_RENDERER_PRESENTVSYNC: + SDL_snprintfcat(text, maxlen, "PresentVSync"); + break; + case SDL_RENDERER_TARGETTEXTURE: + SDL_snprintfcat(text, maxlen, "TargetTexturesSupported"); break; default: - fprintf(stderr, "0x%8.8x", flag); + SDL_snprintfcat(text, maxlen, "0x%8.8x", flag); break; } } static void -SDLTest_PrintPixelFormat(Uint32 format) +SDLTest_PrintPixelFormat(char *text, size_t maxlen, Uint32 format) { switch (format) { case SDL_PIXELFORMAT_UNKNOWN: - fprintf(stderr, "Unknwon"); + SDL_snprintfcat(text, maxlen, "Unknown"); break; case SDL_PIXELFORMAT_INDEX1LSB: - fprintf(stderr, "Index1LSB"); + SDL_snprintfcat(text, maxlen, "Index1LSB"); break; case SDL_PIXELFORMAT_INDEX1MSB: - fprintf(stderr, "Index1MSB"); + SDL_snprintfcat(text, maxlen, "Index1MSB"); break; case SDL_PIXELFORMAT_INDEX4LSB: - fprintf(stderr, "Index4LSB"); + SDL_snprintfcat(text, maxlen, "Index4LSB"); break; case SDL_PIXELFORMAT_INDEX4MSB: - fprintf(stderr, "Index4MSB"); + SDL_snprintfcat(text, maxlen, "Index4MSB"); break; case SDL_PIXELFORMAT_INDEX8: - fprintf(stderr, "Index8"); + SDL_snprintfcat(text, maxlen, "Index8"); break; case SDL_PIXELFORMAT_RGB332: - fprintf(stderr, "RGB332"); + SDL_snprintfcat(text, maxlen, "RGB332"); break; case SDL_PIXELFORMAT_RGB444: - fprintf(stderr, "RGB444"); + SDL_snprintfcat(text, maxlen, "RGB444"); break; case SDL_PIXELFORMAT_RGB555: - fprintf(stderr, "RGB555"); + SDL_snprintfcat(text, maxlen, "RGB555"); break; case SDL_PIXELFORMAT_BGR555: - fprintf(stderr, "BGR555"); + SDL_snprintfcat(text, maxlen, "BGR555"); break; case SDL_PIXELFORMAT_ARGB4444: - fprintf(stderr, "ARGB4444"); + SDL_snprintfcat(text, maxlen, "ARGB4444"); break; case SDL_PIXELFORMAT_ABGR4444: - fprintf(stderr, "ABGR4444"); + SDL_snprintfcat(text, maxlen, "ABGR4444"); break; case SDL_PIXELFORMAT_ARGB1555: - fprintf(stderr, "ARGB1555"); + SDL_snprintfcat(text, maxlen, "ARGB1555"); break; case SDL_PIXELFORMAT_ABGR1555: - fprintf(stderr, "ABGR1555"); + SDL_snprintfcat(text, maxlen, "ABGR1555"); break; case SDL_PIXELFORMAT_RGB565: - fprintf(stderr, "RGB565"); + SDL_snprintfcat(text, maxlen, "RGB565"); break; case SDL_PIXELFORMAT_BGR565: - fprintf(stderr, "BGR565"); + SDL_snprintfcat(text, maxlen, "BGR565"); break; case SDL_PIXELFORMAT_RGB24: - fprintf(stderr, "RGB24"); + SDL_snprintfcat(text, maxlen, "RGB24"); break; case SDL_PIXELFORMAT_BGR24: - fprintf(stderr, "BGR24"); + SDL_snprintfcat(text, maxlen, "BGR24"); break; case SDL_PIXELFORMAT_RGB888: - fprintf(stderr, "RGB888"); + SDL_snprintfcat(text, maxlen, "RGB888"); break; case SDL_PIXELFORMAT_BGR888: - fprintf(stderr, "BGR888"); + SDL_snprintfcat(text, maxlen, "BGR888"); break; case SDL_PIXELFORMAT_ARGB8888: - fprintf(stderr, "ARGB8888"); + SDL_snprintfcat(text, maxlen, "ARGB8888"); break; case SDL_PIXELFORMAT_RGBA8888: - fprintf(stderr, "RGBA8888"); + SDL_snprintfcat(text, maxlen, "RGBA8888"); break; case SDL_PIXELFORMAT_ABGR8888: - fprintf(stderr, "ABGR8888"); + SDL_snprintfcat(text, maxlen, "ABGR8888"); break; case SDL_PIXELFORMAT_BGRA8888: - fprintf(stderr, "BGRA8888"); + SDL_snprintfcat(text, maxlen, "BGRA8888"); break; case SDL_PIXELFORMAT_ARGB2101010: - fprintf(stderr, "ARGB2101010"); + SDL_snprintfcat(text, maxlen, "ARGB2101010"); break; case SDL_PIXELFORMAT_YV12: - fprintf(stderr, "YV12"); + SDL_snprintfcat(text, maxlen, "YV12"); break; case SDL_PIXELFORMAT_IYUV: - fprintf(stderr, "IYUV"); + SDL_snprintfcat(text, maxlen, "IYUV"); break; case SDL_PIXELFORMAT_YUY2: - fprintf(stderr, "YUY2"); + SDL_snprintfcat(text, maxlen, "YUY2"); break; case SDL_PIXELFORMAT_UYVY: - fprintf(stderr, "UYVY"); + SDL_snprintfcat(text, maxlen, "UYVY"); break; case SDL_PIXELFORMAT_YVYU: - fprintf(stderr, "YVYU"); + SDL_snprintfcat(text, maxlen, "YVYU"); break; case SDL_PIXELFORMAT_NV12: - fprintf(stderr, "NV12"); + SDL_snprintfcat(text, maxlen, "NV12"); break; case SDL_PIXELFORMAT_NV21: - fprintf(stderr, "NV21"); + SDL_snprintfcat(text, maxlen, "NV21"); break; default: - fprintf(stderr, "0x%8.8x", format); + SDL_snprintfcat(text, maxlen, "0x%8.8x", format); break; } } @@ -588,35 +621,37 @@ static void SDLTest_PrintRenderer(SDL_RendererInfo * info) { int i, count; + char text[1024]; - fprintf(stderr, " Renderer %s:\n", info->name); + SDL_Log(" Renderer %s:\n", info->name); - fprintf(stderr, " Flags: 0x%8.8X", info->flags); - fprintf(stderr, " ("); + SDL_snprintf(text, sizeof(text), " Flags: 0x%8.8X", info->flags); + SDL_snprintfcat(text, sizeof(text), " ("); count = 0; for (i = 0; i < sizeof(info->flags) * 8; ++i) { Uint32 flag = (1 << i); if (info->flags & flag) { if (count > 0) { - fprintf(stderr, " | "); + SDL_snprintfcat(text, sizeof(text), " | "); } - SDLTest_PrintRendererFlag(flag); + SDLTest_PrintRendererFlag(text, sizeof(text), flag); ++count; } } - fprintf(stderr, ")\n"); + SDL_snprintfcat(text, sizeof(text), ")"); + SDL_Log("%s\n", text); - fprintf(stderr, " Texture formats (%d): ", info->num_texture_formats); + SDL_snprintf(text, sizeof(text), " Texture formats (%d): ", info->num_texture_formats); for (i = 0; i < (int) info->num_texture_formats; ++i) { if (i > 0) { - fprintf(stderr, ", "); + SDL_snprintfcat(text, sizeof(text), ", "); } - SDLTest_PrintPixelFormat(info->texture_formats[i]); + SDLTest_PrintPixelFormat(text, sizeof(text), info->texture_formats[i]); } - fprintf(stderr, "\n"); + SDL_Log("%s\n", text); if (info->max_texture_width || info->max_texture_height) { - fprintf(stderr, " Max Texture Size: %dx%d\n", + SDL_Log(" Max Texture Size: %dx%d\n", info->max_texture_width, info->max_texture_height); } } @@ -629,7 +664,7 @@ SDLTest_LoadIcon(const char *file) /* Load the icon surface */ icon = SDL_LoadBMP(file); if (icon == NULL) { - fprintf(stderr, "Couldn't load %s: %s\n", file, SDL_GetError()); + SDL_Log("Couldn't load %s: %s\n", file, SDL_GetError()); return (NULL); } @@ -641,35 +676,82 @@ SDLTest_LoadIcon(const char *file) return (icon); } +static SDL_HitTestResult SDLCALL +SDLTest_ExampleHitTestCallback(SDL_Window *win, const SDL_Point *area, void *data) +{ + int w, h; + const int RESIZE_BORDER = 8; + const int DRAGGABLE_TITLE = 32; + + /*SDL_Log("Hit test point %d,%d\n", area->x, area->y);*/ + + SDL_GetWindowSize(win, &w, &h); + + if (area->x < RESIZE_BORDER) { + if (area->y < RESIZE_BORDER) { + SDL_Log("SDL_HITTEST_RESIZE_TOPLEFT\n"); + return SDL_HITTEST_RESIZE_TOPLEFT; + } else if (area->y >= (h-RESIZE_BORDER)) { + SDL_Log("SDL_HITTEST_RESIZE_BOTTOMLEFT\n"); + return SDL_HITTEST_RESIZE_BOTTOMLEFT; + } else { + SDL_Log("SDL_HITTEST_RESIZE_LEFT\n"); + return SDL_HITTEST_RESIZE_LEFT; + } + } else if (area->x >= (w-RESIZE_BORDER)) { + if (area->y < RESIZE_BORDER) { + SDL_Log("SDL_HITTEST_RESIZE_TOPRIGHT\n"); + return SDL_HITTEST_RESIZE_TOPRIGHT; + } else if (area->y >= (h-RESIZE_BORDER)) { + SDL_Log("SDL_HITTEST_RESIZE_BOTTOMRIGHT\n"); + return SDL_HITTEST_RESIZE_BOTTOMRIGHT; + } else { + SDL_Log("SDL_HITTEST_RESIZE_RIGHT\n"); + return SDL_HITTEST_RESIZE_RIGHT; + } + } else if (area->y >= (h-RESIZE_BORDER)) { + SDL_Log("SDL_HITTEST_RESIZE_BOTTOM\n"); + return SDL_HITTEST_RESIZE_BOTTOM; + } else if (area->y < RESIZE_BORDER) { + SDL_Log("SDL_HITTEST_RESIZE_TOP\n"); + return SDL_HITTEST_RESIZE_TOP; + } else if (area->y < DRAGGABLE_TITLE) { + SDL_Log("SDL_HITTEST_DRAGGABLE\n"); + return SDL_HITTEST_DRAGGABLE; + } + return SDL_HITTEST_NORMAL; +} + SDL_bool SDLTest_CommonInit(SDLTest_CommonState * state) { int i, j, m, n, w, h; SDL_DisplayMode fullscreen_mode; + char text[1024]; if (state->flags & SDL_INIT_VIDEO) { if (state->verbose & VERBOSE_VIDEO) { n = SDL_GetNumVideoDrivers(); if (n == 0) { - fprintf(stderr, "No built-in video drivers\n"); + SDL_Log("No built-in video drivers\n"); } else { - fprintf(stderr, "Built-in video drivers:"); + SDL_snprintf(text, sizeof(text), "Built-in video drivers:"); for (i = 0; i < n; ++i) { if (i > 0) { - fprintf(stderr, ","); + SDL_snprintfcat(text, sizeof(text), ","); } - fprintf(stderr, " %s", SDL_GetVideoDriver(i)); + SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetVideoDriver(i)); } - fprintf(stderr, "\n"); + SDL_Log("%s\n", text); } } if (SDL_VideoInit(state->videodriver) < 0) { - fprintf(stderr, "Couldn't initialize video driver: %s\n", + SDL_Log("Couldn't initialize video driver: %s\n", SDL_GetError()); return SDL_FALSE; } if (state->verbose & VERBOSE_VIDEO) { - fprintf(stderr, "Video driver: %s\n", + SDL_Log("Video driver: %s\n", SDL_GetCurrentVideoDriver()); } @@ -706,75 +788,82 @@ SDLTest_CommonInit(SDLTest_CommonState * state) } if (state->verbose & VERBOSE_MODES) { - SDL_Rect bounds; + SDL_Rect bounds, usablebounds; + float hdpi = 0; + float vdpi = 0; SDL_DisplayMode mode; int bpp; Uint32 Rmask, Gmask, Bmask, Amask; #if SDL_VIDEO_DRIVER_WINDOWS - int adapterIndex = 0; - int outputIndex = 0; + int adapterIndex = 0; + int outputIndex = 0; #endif n = SDL_GetNumVideoDisplays(); - fprintf(stderr, "Number of displays: %d\n", n); + SDL_Log("Number of displays: %d\n", n); for (i = 0; i < n; ++i) { - fprintf(stderr, "Display %d: %s\n", i, SDL_GetDisplayName(i)); + SDL_Log("Display %d: %s\n", i, SDL_GetDisplayName(i)); SDL_zero(bounds); SDL_GetDisplayBounds(i, &bounds); - fprintf(stderr, "Bounds: %dx%d at %d,%d\n", bounds.w, bounds.h, bounds.x, bounds.y); + + SDL_zero(usablebounds); + SDL_GetDisplayUsableBounds(i, &usablebounds); + + SDL_GetDisplayDPI(i, NULL, &hdpi, &vdpi); + + SDL_Log("Bounds: %dx%d at %d,%d\n", bounds.w, bounds.h, bounds.x, bounds.y); + SDL_Log("Usable bounds: %dx%d at %d,%d\n", usablebounds.w, usablebounds.h, usablebounds.x, usablebounds.y); + SDL_Log("DPI: %fx%f\n", hdpi, vdpi); SDL_GetDesktopDisplayMode(i, &mode); SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask, &Amask); - fprintf(stderr, - " Current mode: %dx%d@%dHz, %d bits-per-pixel (%s)\n", + SDL_Log(" Current mode: %dx%d@%dHz, %d bits-per-pixel (%s)\n", mode.w, mode.h, mode.refresh_rate, bpp, SDL_GetPixelFormatName(mode.format)); if (Rmask || Gmask || Bmask) { - fprintf(stderr, " Red Mask = 0x%.8x\n", Rmask); - fprintf(stderr, " Green Mask = 0x%.8x\n", Gmask); - fprintf(stderr, " Blue Mask = 0x%.8x\n", Bmask); + SDL_Log(" Red Mask = 0x%.8x\n", Rmask); + SDL_Log(" Green Mask = 0x%.8x\n", Gmask); + SDL_Log(" Blue Mask = 0x%.8x\n", Bmask); if (Amask) - fprintf(stderr, " Alpha Mask = 0x%.8x\n", Amask); + SDL_Log(" Alpha Mask = 0x%.8x\n", Amask); } /* Print available fullscreen video modes */ m = SDL_GetNumDisplayModes(i); if (m == 0) { - fprintf(stderr, "No available fullscreen video modes\n"); + SDL_Log("No available fullscreen video modes\n"); } else { - fprintf(stderr, " Fullscreen video modes:\n"); + SDL_Log(" Fullscreen video modes:\n"); for (j = 0; j < m; ++j) { SDL_GetDisplayMode(i, j, &mode); SDL_PixelFormatEnumToMasks(mode.format, &bpp, &Rmask, &Gmask, &Bmask, &Amask); - fprintf(stderr, - " Mode %d: %dx%d@%dHz, %d bits-per-pixel (%s)\n", + SDL_Log(" Mode %d: %dx%d@%dHz, %d bits-per-pixel (%s)\n", j, mode.w, mode.h, mode.refresh_rate, bpp, SDL_GetPixelFormatName(mode.format)); if (Rmask || Gmask || Bmask) { - fprintf(stderr, " Red Mask = 0x%.8x\n", + SDL_Log(" Red Mask = 0x%.8x\n", Rmask); - fprintf(stderr, " Green Mask = 0x%.8x\n", + SDL_Log(" Green Mask = 0x%.8x\n", Gmask); - fprintf(stderr, " Blue Mask = 0x%.8x\n", + SDL_Log(" Blue Mask = 0x%.8x\n", Bmask); if (Amask) - fprintf(stderr, - " Alpha Mask = 0x%.8x\n", + SDL_Log(" Alpha Mask = 0x%.8x\n", Amask); } } } #if SDL_VIDEO_DRIVER_WINDOWS - /* Print the D3D9 adapter index */ - adapterIndex = SDL_Direct3D9GetAdapterIndex( i ); - fprintf( stderr, "D3D9 Adapter Index: %d", adapterIndex ); + /* Print the D3D9 adapter index */ + adapterIndex = SDL_Direct3D9GetAdapterIndex( i ); + SDL_Log("D3D9 Adapter Index: %d", adapterIndex); - /* Print the DXGI adapter and output indices */ - SDL_DXGIGetOutputInfo(i, &adapterIndex, &outputIndex); - fprintf( stderr, "DXGI Adapter Index: %d Output Index: %d", adapterIndex, outputIndex ); + /* Print the DXGI adapter and output indices */ + SDL_DXGIGetOutputInfo(i, &adapterIndex, &outputIndex); + SDL_Log("DXGI Adapter Index: %d Output Index: %d", adapterIndex, outputIndex); #endif } } @@ -784,9 +873,9 @@ SDLTest_CommonInit(SDLTest_CommonState * state) n = SDL_GetNumRenderDrivers(); if (n == 0) { - fprintf(stderr, "No built-in render drivers\n"); + SDL_Log("No built-in render drivers\n"); } else { - fprintf(stderr, "Built-in render drivers:\n"); + SDL_Log("Built-in render drivers:\n"); for (i = 0; i < n; ++i) { SDL_GetRenderDriverInfo(i, &info); SDLTest_PrintRenderer(&info); @@ -815,16 +904,16 @@ SDLTest_CommonInit(SDLTest_CommonState * state) fullscreen_mode.refresh_rate = state->refresh_rate; state->windows = - (SDL_Window **) SDL_malloc(state->num_windows * + (SDL_Window **) SDL_calloc(state->num_windows, sizeof(*state->windows)); state->renderers = - (SDL_Renderer **) SDL_malloc(state->num_windows * + (SDL_Renderer **) SDL_calloc(state->num_windows, sizeof(*state->renderers)); state->targets = - (SDL_Texture **) SDL_malloc(state->num_windows * + (SDL_Texture **) SDL_calloc(state->num_windows, sizeof(*state->targets)); if (!state->windows || !state->renderers) { - fprintf(stderr, "Out of memory!\n"); + SDL_Log("Out of memory!\n"); return SDL_FALSE; } for (i = 0; i < state->num_windows; ++i) { @@ -841,7 +930,7 @@ SDLTest_CommonInit(SDLTest_CommonState * state) state->window_w, state->window_h, state->window_flags); if (!state->windows[i]) { - fprintf(stderr, "Couldn't create window: %s\n", + SDL_Log("Couldn't create window: %s\n", SDL_GetError()); return SDL_FALSE; } @@ -859,11 +948,17 @@ SDLTest_CommonInit(SDLTest_CommonState * state) state->window_h = h; } if (SDL_SetWindowDisplayMode(state->windows[i], &fullscreen_mode) < 0) { - fprintf(stderr, "Can't set up fullscreen display mode: %s\n", + SDL_Log("Can't set up fullscreen display mode: %s\n", SDL_GetError()); return SDL_FALSE; } + /* Add resize/drag areas for windows that are borderless and resizable */ + if ((state->window_flags & (SDL_WINDOW_RESIZABLE|SDL_WINDOW_BORDERLESS)) == + (SDL_WINDOW_RESIZABLE|SDL_WINDOW_BORDERLESS)) { + SDL_SetWindowHitTest(state->windows[i], SDLTest_ExampleHitTestCallback, NULL); + } + if (state->window_icon) { SDL_Surface *icon = SDLTest_LoadIcon(state->window_icon); if (icon) { @@ -874,12 +969,9 @@ SDLTest_CommonInit(SDLTest_CommonState * state) SDL_ShowWindow(state->windows[i]); - state->renderers[i] = NULL; - state->targets[i] = NULL; - if (!state->skip_renderer && (state->renderdriver - || !(state->window_flags & SDL_WINDOW_OPENGL))) { + || !(state->window_flags & (SDL_WINDOW_OPENGL | SDL_WINDOW_VULKAN)))) { m = -1; if (state->renderdriver) { SDL_RendererInfo info; @@ -893,8 +985,7 @@ SDLTest_CommonInit(SDLTest_CommonState * state) } } if (m == -1) { - fprintf(stderr, - "Couldn't find render driver named %s", + SDL_Log("Couldn't find render driver named %s", state->renderdriver); return SDL_FALSE; } @@ -902,7 +993,7 @@ SDLTest_CommonInit(SDLTest_CommonState * state) state->renderers[i] = SDL_CreateRenderer(state->windows[i], m, state->render_flags); if (!state->renderers[i]) { - fprintf(stderr, "Couldn't create renderer: %s\n", + SDL_Log("Couldn't create renderer: %s\n", SDL_GetError()); return SDL_FALSE; } @@ -914,7 +1005,7 @@ SDLTest_CommonInit(SDLTest_CommonState * state) if (state->verbose & VERBOSE_RENDER) { SDL_RendererInfo info; - fprintf(stderr, "Current renderer:\n"); + SDL_Log("Current renderer:\n"); SDL_GetRendererInfo(state->renderers[i], &info); SDLTest_PrintRenderer(&info); } @@ -926,30 +1017,30 @@ SDLTest_CommonInit(SDLTest_CommonState * state) if (state->verbose & VERBOSE_AUDIO) { n = SDL_GetNumAudioDrivers(); if (n == 0) { - fprintf(stderr, "No built-in audio drivers\n"); + SDL_Log("No built-in audio drivers\n"); } else { - fprintf(stderr, "Built-in audio drivers:"); + SDL_snprintf(text, sizeof(text), "Built-in audio drivers:"); for (i = 0; i < n; ++i) { if (i > 0) { - fprintf(stderr, ","); + SDL_snprintfcat(text, sizeof(text), ","); } - fprintf(stderr, " %s", SDL_GetAudioDriver(i)); + SDL_snprintfcat(text, sizeof(text), " %s", SDL_GetAudioDriver(i)); } - fprintf(stderr, "\n"); + SDL_Log("%s\n", text); } } if (SDL_AudioInit(state->audiodriver) < 0) { - fprintf(stderr, "Couldn't initialize audio driver: %s\n", + SDL_Log("Couldn't initialize audio driver: %s\n", SDL_GetError()); return SDL_FALSE; } if (state->verbose & VERBOSE_VIDEO) { - fprintf(stderr, "Audio driver: %s\n", + SDL_Log("Audio driver: %s\n", SDL_GetCurrentAudioDriver()); } if (SDL_OpenAudio(&state->audiospec, NULL) < 0) { - fprintf(stderr, "Couldn't open audio: %s\n", SDL_GetError()); + SDL_Log("Couldn't open audio: %s\n", SDL_GetError()); return SDL_FALSE; } } @@ -1071,7 +1162,7 @@ SDLTest_PrintEvent(SDL_Event * event) SDL_Log("SDL EVENT: Window %d hit test", event->window.windowID); break; default: - SDL_Log("SDL EVENT: Window %d got unknown event %d", + SDL_Log("SDL EVENT: Window %d got unknown event 0x%4.4x", event->window.windowID, event->window.event); break; } @@ -1090,10 +1181,17 @@ SDLTest_PrintEvent(SDL_Event * event) SDL_GetScancodeName(event->key.keysym.scancode), event->key.keysym.sym, SDL_GetKeyName(event->key.keysym.sym)); break; + case SDL_TEXTEDITING: + SDL_Log("SDL EVENT: Keyboard: text editing \"%s\" in window %d", + event->edit.text, event->edit.windowID); + break; case SDL_TEXTINPUT: SDL_Log("SDL EVENT: Keyboard: text input \"%s\" in window %d", event->text.text, event->text.windowID); break; + case SDL_KEYMAPCHANGED: + SDL_Log("SDL EVENT: Keymap changed"); + break; case SDL_MOUSEMOTION: SDL_Log("SDL EVENT: Mouse: moved to %d,%d (%d,%d) in window %d", event->motion.x, event->motion.y, @@ -1200,6 +1298,13 @@ SDLTest_PrintEvent(SDL_Event * event) SDL_Log("SDL EVENT: Clipboard updated"); break; + case SDL_FINGERMOTION: + SDL_Log("SDL EVENT: Finger: motion touch=%ld, finger=%ld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f", + (long) event->tfinger.touchId, + (long) event->tfinger.fingerId, + event->tfinger.x, event->tfinger.y, + event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure); + break; case SDL_FINGERDOWN: case SDL_FINGERUP: SDL_Log("SDL EVENT: Finger: %s touch=%ld, finger=%ld, x=%f, y=%f, dx=%f, dy=%f, pressure=%f", @@ -1210,10 +1315,10 @@ SDLTest_PrintEvent(SDL_Event * event) event->tfinger.dx, event->tfinger.dy, event->tfinger.pressure); break; case SDL_DOLLARGESTURE: - SDL_Log("SDL_EVENT: Dollar gesture detect: %"SDL_PRIs64, (Sint64) event->dgesture.gestureId); + SDL_Log("SDL_EVENT: Dollar gesture detect: %ld", (long) event->dgesture.gestureId); break; case SDL_DOLLARRECORD: - SDL_Log("SDL_EVENT: Dollar gesture record: %"SDL_PRIs64, (Sint64) event->dgesture.gestureId); + SDL_Log("SDL_EVENT: Dollar gesture record: %ld", (long) event->dgesture.gestureId); break; case SDL_MULTIGESTURE: SDL_Log("SDL_EVENT: Multi gesture fingers: %d", event->mgesture.numFingers); @@ -1226,6 +1331,25 @@ SDLTest_PrintEvent(SDL_Event * event) SDL_Log("SDL EVENT: render targets reset"); break; + case SDL_APP_TERMINATING: + SDL_Log("SDL EVENT: App terminating"); + break; + case SDL_APP_LOWMEMORY: + SDL_Log("SDL EVENT: App running low on memory"); + break; + case SDL_APP_WILLENTERBACKGROUND: + SDL_Log("SDL EVENT: App will enter the background"); + break; + case SDL_APP_DIDENTERBACKGROUND: + SDL_Log("SDL EVENT: App entered the background"); + break; + case SDL_APP_WILLENTERFOREGROUND: + SDL_Log("SDL EVENT: App will enter the foreground"); + break; + case SDL_APP_DIDENTERFOREGROUND: + SDL_Log("SDL EVENT: App entered the foreground"); + break; + case SDL_QUIT: SDL_Log("SDL EVENT: Quit requested"); break; @@ -1233,7 +1357,7 @@ SDLTest_PrintEvent(SDL_Event * event) SDL_Log("SDL EVENT: User event %d", event->user.code); break; default: - SDL_Log("Unknown event %04x", event->type); + SDL_Log("Unknown event 0x%4.4x", event->type); break; } } @@ -1257,19 +1381,19 @@ SDLTest_ScreenShot(SDL_Renderer *renderer) #endif 0x00000000); if (!surface) { - fprintf(stderr, "Couldn't create surface: %s\n", SDL_GetError()); + SDL_Log("Couldn't create surface: %s\n", SDL_GetError()); return; } if (SDL_RenderReadPixels(renderer, NULL, surface->format->format, surface->pixels, surface->pitch) < 0) { - fprintf(stderr, "Couldn't read screen: %s\n", SDL_GetError()); + SDL_Log("Couldn't read screen: %s\n", SDL_GetError()); SDL_free(surface); return; } if (SDL_SaveBMP(surface, "screenshot.bmp") < 0) { - fprintf(stderr, "Couldn't save screenshot.bmp: %s\n", SDL_GetError()); + SDL_Log("Couldn't save screenshot.bmp: %s\n", SDL_GetError()); SDL_free(surface); return; } @@ -1374,6 +1498,49 @@ SDLTest_CommonEvent(SDLTest_CommonState * state, SDL_Event * event, int *done) } } break; + case SDLK_UP: + case SDLK_DOWN: + case SDLK_LEFT: + case SDLK_RIGHT: + if (withAlt) { + /* Alt-Up/Down/Left/Right switches between displays */ + SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + if (window) { + int currentIndex = SDL_GetWindowDisplayIndex(window); + int numDisplays = SDL_GetNumVideoDisplays(); + + if (currentIndex >= 0 && numDisplays >= 1) { + int dest; + if (event->key.keysym.sym == SDLK_UP || event->key.keysym.sym == SDLK_LEFT) { + dest = (currentIndex + numDisplays - 1) % numDisplays; + } else { + dest = (currentIndex + numDisplays + 1) % numDisplays; + } + SDL_Log("Centering on display %d\n", dest); + SDL_SetWindowPosition(window, + SDL_WINDOWPOS_CENTERED_DISPLAY(dest), + SDL_WINDOWPOS_CENTERED_DISPLAY(dest)); + } + } + } + if (withShift) { + /* Shift-Up/Down/Left/Right shift the window by 100px */ + SDL_Window *window = SDL_GetWindowFromID(event->key.windowID); + if (window) { + const int delta = 100; + int x, y; + SDL_GetWindowPosition(window, &x, &y); + + if (event->key.keysym.sym == SDLK_UP) y -= delta; + if (event->key.keysym.sym == SDLK_DOWN) y += delta; + if (event->key.keysym.sym == SDLK_LEFT) x -= delta; + if (event->key.keysym.sym == SDLK_RIGHT) x += delta; + + SDL_Log("Setting position to (%d, %d)\n", x, y); + SDL_SetWindowPosition(window, x, y); + } + } + break; case SDLK_o: if (withControl) { /* Ctrl-O (or Ctrl-Shift-O) changes window opacity. */ @@ -1610,6 +1777,7 @@ SDLTest_CommonQuit(SDLTest_CommonState * state) } SDL_free(state); SDL_Quit(); + SDLTest_LogAllocations(); } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_compare.c b/Engine/lib/sdl/src/test/SDL_test_compare.c index d06ead9f7..d4e3e71f0 100644 --- a/Engine/lib/sdl/src/test/SDL_test_compare.c +++ b/Engine/lib/sdl/src/test/SDL_test_compare.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -113,3 +113,5 @@ int SDLTest_CompareSurfaces(SDL_Surface *surface, SDL_Surface *referenceSurface, return ret; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_crc32.c b/Engine/lib/sdl/src/test/SDL_test_crc32.c index 6e1220881..ea6b0a85b 100644 --- a/Engine/lib/sdl/src/test/SDL_test_crc32.c +++ b/Engine/lib/sdl/src/test/SDL_test_crc32.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -69,7 +69,6 @@ int SDLTest_Crc32Init(SDLTest_Crc32Context *crcContext) } /* Complete CRC32 calculation on a memory block */ - int SDLTest_Crc32Calc(SDLTest_Crc32Context * crcContext, CrcUint8 *inBuf, CrcUint32 inLen, CrcUint32 *crc32) { if (SDLTest_Crc32CalcStart(crcContext,crc32)) { @@ -163,3 +162,5 @@ int SDLTest_Crc32Done(SDLTest_Crc32Context * crcContext) return 0; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_font.c b/Engine/lib/sdl/src/test/SDL_test_font.c index afd35c6c2..7825cc66f 100644 --- a/Engine/lib/sdl/src/test/SDL_test_font.c +++ b/Engine/lib/sdl/src/test/SDL_test_font.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -3116,9 +3116,9 @@ static SDL_Texture *SDLTest_CharTextureCache[256]; int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) { - const Uint32 charWidth = FONT_CHARACTER_SIZE; - const Uint32 charHeight = FONT_CHARACTER_SIZE; - const Uint32 charSize = FONT_CHARACTER_SIZE; + const Uint32 charWidth = FONT_CHARACTER_SIZE; + const Uint32 charHeight = FONT_CHARACTER_SIZE; + const Uint32 charSize = FONT_CHARACTER_SIZE; SDL_Rect srect; SDL_Rect drect; int result; @@ -3133,16 +3133,16 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) Uint8 r, g, b, a; /* - * Setup source rectangle - */ + * Setup source rectangle + */ srect.x = 0; srect.y = 0; srect.w = charWidth; srect.h = charHeight; /* - * Setup destination rectangle - */ + * Setup destination rectangle + */ drect.x = x; drect.y = y; drect.w = charWidth; @@ -3152,12 +3152,12 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) ci = (unsigned char)c; /* - * Create new charWidth x charHeight bitmap surface if not already present. - */ + * Create new charWidth x charHeight bitmap surface if not already present. + */ if (SDLTest_CharTextureCache[ci] == NULL) { /* - * Redraw character into surface - */ + * Redraw character into surface + */ character = SDL_CreateRGBSurface(SDL_SWSURFACE, charWidth, charHeight, 32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF); @@ -3170,8 +3170,8 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) pitch = character->pitch; /* - * Drawing loop - */ + * Drawing loop + */ patt = 0; for (iy = 0; iy < charWidth; iy++) { mask = 0x00; @@ -3196,24 +3196,24 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) SDL_FreeSurface(character); /* - * Check pointer - */ + * Check pointer + */ if (SDLTest_CharTextureCache[ci] == NULL) { return (-1); } } /* - * Set color - */ + * Set color + */ result = 0; result |= SDL_GetRenderDrawColor(renderer, &r, &g, &b, &a); result |= SDL_SetTextureColorMod(SDLTest_CharTextureCache[ci], r, g, b); result |= SDL_SetTextureAlphaMod(SDLTest_CharTextureCache[ci], a); /* - * Draw texture onto destination - */ + * Draw texture onto destination + */ result |= SDL_RenderCopy(renderer, SDLTest_CharTextureCache[ci], &srect, &drect); return (result); @@ -3221,7 +3221,7 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, char c) int SDLTest_DrawString(SDL_Renderer * renderer, int x, int y, const char *s) { - const Uint32 charWidth = FONT_CHARACTER_SIZE; + const Uint32 charWidth = FONT_CHARACTER_SIZE; int result = 0; int curx = x; int cury = y; @@ -3236,3 +3236,15 @@ int SDLTest_DrawString(SDL_Renderer * renderer, int x, int y, const char *s) return (result); } +void SDLTest_CleanupTextDrawing(void) +{ + unsigned int i; + for (i = 0; i < SDL_arraysize(SDLTest_CharTextureCache); ++i) { + if (SDLTest_CharTextureCache[i]) { + SDL_DestroyTexture(SDLTest_CharTextureCache[i]); + SDLTest_CharTextureCache[i] = NULL; + } + } +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_fuzzer.c b/Engine/lib/sdl/src/test/SDL_test_fuzzer.c index 1bd8dfa18..eee56a9fe 100644 --- a/Engine/lib/sdl/src/test/SDL_test_fuzzer.c +++ b/Engine/lib/sdl/src/test/SDL_test_fuzzer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,19 +27,20 @@ #include "SDL_config.h" +#include /* Visual Studio 2008 doesn't have stdint.h */ #if defined(_MSC_VER) && _MSC_VER <= 1500 -#define UINT8_MAX ~(Uint8)0 -#define UINT16_MAX ~(Uint16)0 -#define UINT32_MAX ~(Uint32)0 -#define UINT64_MAX ~(Uint64)0 +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define INT64_MIN _I64_MIN +#define INT64_MAX _I64_MAX +#define UINT64_MAX _UI64_MAX #else -#define _GNU_SOURCE #include #endif #include #include -#include #include #include "SDL_test.h" @@ -125,29 +126,35 @@ SDLTest_RandomUint32() Uint64 SDLTest_RandomUint64() { - Uint64 value = 0; - Uint32 *vp = (void *)&value; + union { + Uint64 v64; + Uint32 v32[2]; + } value; + value.v64 = 0; fuzzerInvocationCounter++; - vp[0] = SDLTest_RandomSint32(); - vp[1] = SDLTest_RandomSint32(); + value.v32[0] = SDLTest_RandomSint32(); + value.v32[1] = SDLTest_RandomSint32(); - return value; + return value.v64; } Sint64 SDLTest_RandomSint64() { - Uint64 value = 0; - Uint32 *vp = (void *)&value; + union { + Uint64 v64; + Uint32 v32[2]; + } value; + value.v64 = 0; fuzzerInvocationCounter++; - vp[0] = SDLTest_RandomSint32(); - vp[1] = SDLTest_RandomSint32(); + value.v32[0] = SDLTest_RandomSint32(); + value.v32[1] = SDLTest_RandomSint32(); - return value; + return (Sint64)value.v64; } @@ -197,7 +204,7 @@ SDLTest_RandomIntegerInRange(Sint32 pMin, Sint32 pMax) * * \returns Returns a random boundary value for the domain or 0 in case of error */ -Uint64 +static Uint64 SDLTest_GenerateUnsignedBoundaryValues(const Uint64 maxValue, Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain) { Uint64 b1, b2; @@ -298,7 +305,7 @@ Uint64 SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool validDomain) { /* max value for Uint64 */ - const Uint64 maxValue = ULLONG_MAX; + const Uint64 maxValue = UINT64_MAX; return SDLTest_GenerateUnsignedBoundaryValues(maxValue, (Uint64) boundary1, (Uint64) boundary2, validDomain); @@ -329,7 +336,7 @@ SDLTest_RandomUint64BoundaryValue(Uint64 boundary1, Uint64 boundary2, SDL_bool v * * \returns Returns a random boundary value for the domain or 0 in case of error */ -Sint64 +static Sint64 SDLTest_GenerateSignedBoundaryValues(const Sint64 minValue, const Sint64 maxValue, Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain) { Sint64 b1, b2; @@ -434,8 +441,8 @@ Sint64 SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool validDomain) { /* min & max values for Sint64 */ - const Sint64 maxValue = LLONG_MAX; - const Sint64 minValue = LLONG_MIN; + const Sint64 maxValue = INT64_MAX; + const Sint64 minValue = INT64_MIN; return SDLTest_GenerateSignedBoundaryValues(minValue, maxValue, boundary1, boundary2, validDomain); @@ -444,7 +451,7 @@ SDLTest_RandomSint64BoundaryValue(Sint64 boundary1, Sint64 boundary2, SDL_bool v float SDLTest_RandomUnitFloat() { - return (float) SDLTest_RandomUint32() / UINT_MAX; + return SDLTest_RandomUint32() / (float) UINT_MAX; } float @@ -523,3 +530,5 @@ SDLTest_RandomAsciiStringOfSize(int size) return string; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_harness.c b/Engine/lib/sdl/src/test/SDL_test_harness.c index 4b86c7a0d..15021c6fd 100644 --- a/Engine/lib/sdl/src/test/SDL_test_harness.c +++ b/Engine/lib/sdl/src/test/SDL_test_harness.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -97,17 +97,17 @@ SDLTest_GenerateRunSeed(const int length) * \returns The generated execution key to initialize the fuzzer with. * */ -Uint64 -SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iteration) +static Uint64 +SDLTest_GenerateExecKey(const char *runSeed, char *suiteName, char *testName, int iteration) { SDLTest_Md5Context md5Context; Uint64 *keys; char iterationString[16]; - Uint32 runSeedLength; - Uint32 suiteNameLength; - Uint32 testNameLength; - Uint32 iterationStringLength; - Uint32 entireStringLength; + size_t runSeedLength; + size_t suiteNameLength; + size_t testNameLength; + size_t iterationStringLength; + size_t entireStringLength; char *buffer; if (runSeed == NULL || runSeed[0] == '\0') { @@ -150,7 +150,7 @@ SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iter /* Hash string and use half of the digest as 64bit exec key */ SDLTest_Md5Init(&md5Context); - SDLTest_Md5Update(&md5Context, (unsigned char *)buffer, entireStringLength); + SDLTest_Md5Update(&md5Context, (unsigned char *)buffer, (unsigned int) entireStringLength); SDLTest_Md5Final(&md5Context); SDL_free(buffer); keys = (Uint64 *)md5Context.digest; @@ -168,7 +168,7 @@ SDLTest_GenerateExecKey(char *runSeed, char *suiteName, char *testName, int iter * * \return Timer id or -1 on failure. */ -SDL_TimerID +static SDL_TimerID SDLTest_SetTestTimeout(int timeout, void (*callback)()) { Uint32 timeoutInMilliseconds; @@ -206,8 +206,8 @@ SDLTest_SetTestTimeout(int timeout, void (*callback)()) /** * \brief Timeout handler. Aborts test run and exits harness process. */ -void - SDLTest_BailOut() +static SDL_NORETURN void +SDLTest_BailOut() { SDLTest_LogError("TestCaseTimeout timer expired. Aborting test run."); exit(TEST_ABORTED); /* bail out from the test */ @@ -223,8 +223,8 @@ void * * \returns Test case result. */ -int -SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference *testCase, Uint64 execKey, SDL_bool forceTestRun) +static int +SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, const SDLTest_TestCaseReference *testCase, Uint64 execKey, SDL_bool forceTestRun) { SDL_TimerID timer = 0; int testCaseResult = 0; @@ -313,7 +313,8 @@ SDLTest_RunTest(SDLTest_TestSuiteReference *testSuite, SDLTest_TestCaseReference } /* Prints summary of all suites/tests contained in the given reference */ -void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites) +#if 0 +static void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites) { int suiteCounter; int testCounter; @@ -340,12 +341,13 @@ void SDLTest_LogTestSuiteSummary(SDLTest_TestSuiteReference *testSuites) } } } +#endif /* Gets a timer value in seconds */ -float GetClock() +static float GetClock() { - float currentClock = (float)clock(); - return currentClock / (float)CLOCKS_PER_SEC; + float currentClock = clock() / (float) CLOCKS_PER_SEC; + return currentClock; } /** @@ -370,7 +372,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user int testCounter; int iterationCounter; SDLTest_TestSuiteReference *testSuite; - SDLTest_TestCaseReference *testCase; + const SDLTest_TestCaseReference *testCase; const char *runSeed = NULL; char *currentSuiteName; char *currentTestName; @@ -396,7 +398,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user Uint32 testPassedCount = 0; Uint32 testSkippedCount = 0; Uint32 countSum = 0; - SDLTest_TestCaseReference **failedTests; + const SDLTest_TestCaseReference **failedTests; /* Sanitize test iterations */ if (testIterations < 1) { @@ -440,7 +442,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user } /* Pre-allocate an array for tracking failed tests (potentially all test cases) */ - failedTests = (SDLTest_TestCaseReference **)SDL_malloc(totalNumberOfTests * sizeof(SDLTest_TestCaseReference *)); + failedTests = (const SDLTest_TestCaseReference **)SDL_malloc(totalNumberOfTests * sizeof(SDLTest_TestCaseReference *)); if (failedTests == NULL) { SDLTest_LogError("Unable to allocate cache for failed tests"); SDL_Error(SDL_ENOMEM); @@ -466,7 +468,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user testCounter = 0; while (testSuite->testCases[testCounter] && testFilter == 0) { - testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter]; + testCase = testSuite->testCases[testCounter]; testCounter++; if (testCase->name != NULL && SDL_strcmp(filter, testCase->name) == 0) { /* Matched a test name */ @@ -483,7 +485,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user if (suiteFilter == 0 && testFilter == 0) { SDLTest_LogError("Filter '%s' did not match any test suite/case.", filter); SDLTest_Log("Exit code: 2"); - SDL_free(failedTests); + SDL_free((void *) failedTests); return 2; } } @@ -521,7 +523,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user testCounter = 0; while(testSuite->testCases[testCounter]) { - testCase=(SDLTest_TestCaseReference *)testSuite->testCases[testCounter]; + testCase = testSuite->testCases[testCounter]; currentTestName = (char *)((testCase->name) ? testCase->name : SDLTEST_INVALID_NAME_FORMAT); testCounter++; @@ -562,7 +564,7 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user if (userExecKey != 0) { execKey = userExecKey; } else { - execKey = SDLTest_GenerateExecKey((char *)runSeed, testSuite->name, testCase->name, iterationCounter); + execKey = SDLTest_GenerateExecKey(runSeed, testSuite->name, testCase->name, iterationCounter); } SDLTest_Log("Test Iteration %i: execKey %" SDL_PRIu64, iterationCounter, execKey); @@ -669,8 +671,10 @@ int SDLTest_RunSuites(SDLTest_TestSuiteReference *testSuites[], const char *user SDLTest_Log(" --seed %s --filter %s", runSeed, failedTests[testCounter]->name); } } - SDL_free(failedTests); + SDL_free((void *) failedTests); SDLTest_Log("Exit code: %d", runResult); return runResult; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_imageBlit.c b/Engine/lib/sdl/src/test/SDL_test_imageBlit.c index 5896ca099..f5c251a97 100644 --- a/Engine/lib/sdl/src/test/SDL_test_imageBlit.c +++ b/Engine/lib/sdl/src/test/SDL_test_imageBlit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /* GIMP RGB C-Source image dump (blit.c) */ -const SDLTest_SurfaceImage_t SDLTest_imageBlit = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlit = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -561,7 +561,7 @@ SDL_Surface *SDLTest_ImageBlit() return surface; } -const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitColor = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -1044,7 +1044,7 @@ SDL_Surface *SDLTest_ImageBlitColor() return surface; } -const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitAlpha = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -1555,3 +1555,5 @@ SDL_Surface *SDLTest_ImageBlitAlpha() ); return surface; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_imageBlitBlend.c b/Engine/lib/sdl/src/test/SDL_test_imageBlitBlend.c index 6e8c2f1b4..cf2d4afc1 100644 --- a/Engine/lib/sdl/src/test/SDL_test_imageBlitBlend.c +++ b/Engine/lib/sdl/src/test/SDL_test_imageBlitBlend.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /* GIMP RGB C-Source image dump (alpha.c) */ -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAdd = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -601,7 +601,7 @@ SDL_Surface *SDLTest_ImageBlitBlendAdd() return surface; } -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlend = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -1131,7 +1131,7 @@ SDL_Surface *SDLTest_ImageBlitBlend() return surface; } -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendMod = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -1561,7 +1561,7 @@ SDL_Surface *SDLTest_ImageBlitBlendMod() return surface; } -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendNone = { 80, 60, 3, "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" "\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377" @@ -2374,7 +2374,7 @@ SDL_Surface *SDLTest_ImageBlitBlendNone() return surface; } -const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = { +static const SDLTest_SurfaceImage_t SDLTest_imageBlitBlendAll = { 80, 60, 3, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -2841,3 +2841,5 @@ SDL_Surface *SDLTest_ImageBlitBlendAll() ); return surface; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_imageFace.c b/Engine/lib/sdl/src/test/SDL_test_imageFace.c index 84f5037f4..9b436378d 100644 --- a/Engine/lib/sdl/src/test/SDL_test_imageFace.c +++ b/Engine/lib/sdl/src/test/SDL_test_imageFace.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /* GIMP RGBA C-Source image dump (face.c) */ -const SDLTest_SurfaceImage_t SDLTest_imageFace = { +static const SDLTest_SurfaceImage_t SDLTest_imageFace = { 32, 32, 4, "\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377" "\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377\377\0\377\377" @@ -244,3 +244,4 @@ SDL_Surface *SDLTest_ImageFace() return surface; } +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_imagePrimitives.c b/Engine/lib/sdl/src/test/SDL_test_imagePrimitives.c index 4ab48d2de..17597c614 100644 --- a/Engine/lib/sdl/src/test/SDL_test_imagePrimitives.c +++ b/Engine/lib/sdl/src/test/SDL_test_imagePrimitives.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /* GIMP RGB C-Source image dump (primitives.c) */ -const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = { +static const SDLTest_SurfaceImage_t SDLTest_imagePrimitives = { 80, 60, 3, "\5ii\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" @@ -510,3 +510,5 @@ SDL_Surface *SDLTest_ImagePrimitives() ); return surface; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_imagePrimitivesBlend.c b/Engine/lib/sdl/src/test/SDL_test_imagePrimitivesBlend.c index 5e538628e..aa5066261 100644 --- a/Engine/lib/sdl/src/test/SDL_test_imagePrimitivesBlend.c +++ b/Engine/lib/sdl/src/test/SDL_test_imagePrimitivesBlend.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ /* GIMP RGB C-Source image dump (alpha.c) */ -const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = { +static const SDLTest_SurfaceImage_t SDLTest_imagePrimitivesBlend = { 80, 60, 3, "\260e\15\222\356/\37\313\15\36\330\17K\3745D\3471\0\20\0D\3502D\3502<\321" ",\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\0-\0\377\377" @@ -692,3 +692,5 @@ SDL_Surface *SDLTest_ImagePrimitivesBlend() ); return surface; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_log.c b/Engine/lib/sdl/src/test/SDL_test_log.c index a2f857f26..5d6ff2425 100644 --- a/Engine/lib/sdl/src/test/SDL_test_log.c +++ b/Engine/lib/sdl/src/test/SDL_test_log.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,7 +26,9 @@ */ /* quiet windows compiler warnings */ -#define _CRT_SECURE_NO_WARNINGS +#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) +# define _CRT_SECURE_NO_WARNINGS +#endif #include "SDL_config.h" @@ -39,6 +41,19 @@ #include "SDL_test.h" +/* work around compiler warning on older GCCs. */ +#if (defined(__GNUC__) && (__GNUC__ <= 2)) +static size_t +strftime_gcc2_workaround(char *s, size_t max, const char *fmt, const struct tm *tm) +{ + return strftime(s, max, fmt, tm); +} +#ifdef strftime +#undef strftime +#endif +#define strftime strftime_gcc2_workaround +#endif + /* ! * Converts unix timestamp to its ascii representation in localtime * @@ -50,7 +65,7 @@ * * \return Ascii representation of the timestamp in localtime in the format '08/23/01 14:55:02' */ -char *SDLTest_TimestampToString(const time_t timestamp) +static char *SDLTest_TimestampToString(const time_t timestamp) { time_t copy; static char buffer[64]; @@ -99,3 +114,5 @@ void SDLTest_LogError(SDL_PRINTF_FORMAT_STRING const char *fmt, ...) /* Log with timestamp and newline */ SDL_LogMessage(SDL_LOG_CATEGORY_TEST, SDL_LOG_PRIORITY_ERROR, "%s: %s", SDLTest_TimestampToString(time(0)), logMessage); } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_md5.c b/Engine/lib/sdl/src/test/SDL_test_md5.c index 7cc356757..c0d05a492 100644 --- a/Engine/lib/sdl/src/test/SDL_test_md5.c +++ b/Engine/lib/sdl/src/test/SDL_test_md5.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -334,3 +334,5 @@ static void SDLTest_Md5Transform(MD5UINT4 * buf, MD5UINT4 * in) buf[2] += c; buf[3] += d; } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_memory.c b/Engine/lib/sdl/src/test/SDL_test_memory.c new file mode 100644 index 000000000..6ce72f64d --- /dev/null +++ b/Engine/lib/sdl/src/test/SDL_test_memory.c @@ -0,0 +1,274 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "SDL_config.h" +#include "SDL_assert.h" +#include "SDL_stdinc.h" +#include "SDL_log.h" +#include "SDL_test_crc32.h" +#include "SDL_test_memory.h" + +#ifdef HAVE_LIBUNWIND_H +#include +#endif + +/* This is a simple tracking allocator to demonstrate the use of SDL's + memory allocation replacement functionality. + + It gets slow with large numbers of allocations and shouldn't be used + for production code. +*/ + +typedef struct SDL_tracked_allocation +{ + void *mem; + size_t size; + Uint64 stack[10]; + char stack_names[10][256]; + struct SDL_tracked_allocation *next; +} SDL_tracked_allocation; + +static SDLTest_Crc32Context s_crc32_context; +static SDL_malloc_func SDL_malloc_orig = NULL; +static SDL_calloc_func SDL_calloc_orig = NULL; +static SDL_realloc_func SDL_realloc_orig = NULL; +static SDL_free_func SDL_free_orig = NULL; +static int s_previous_allocations = 0; +static SDL_tracked_allocation *s_tracked_allocations[256]; + +static unsigned int get_allocation_bucket(void *mem) +{ + CrcUint32 crc_value; + unsigned int index; + SDLTest_Crc32Calc(&s_crc32_context, (CrcUint8 *)&mem, sizeof(mem), &crc_value); + index = (crc_value & (SDL_arraysize(s_tracked_allocations) - 1)); + return index; +} + +static SDL_bool SDL_IsAllocationTracked(void *mem) +{ + SDL_tracked_allocation *entry; + int index = get_allocation_bucket(mem); + for (entry = s_tracked_allocations[index]; entry; entry = entry->next) { + if (mem == entry->mem) { + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static void SDL_TrackAllocation(void *mem, size_t size) +{ + SDL_tracked_allocation *entry; + int index = get_allocation_bucket(mem); + + if (SDL_IsAllocationTracked(mem)) { + return; + } + entry = (SDL_tracked_allocation *)SDL_malloc_orig(sizeof(*entry)); + if (!entry) { + return; + } + entry->mem = mem; + entry->size = size; + + /* Generate the stack trace for the allocation */ + SDL_zero(entry->stack); +#ifdef HAVE_LIBUNWIND_H + { + int stack_index; + unw_cursor_t cursor; + unw_context_t context; + + unw_getcontext(&context); + unw_init_local(&cursor, &context); + + stack_index = 0; + while (unw_step(&cursor) > 0) { + unw_word_t offset, pc; + char sym[256]; + + unw_get_reg(&cursor, UNW_REG_IP, &pc); + entry->stack[stack_index] = pc; + + if (unw_get_proc_name(&cursor, sym, sizeof(sym), &offset) == 0) { + snprintf(entry->stack_names[stack_index], sizeof(entry->stack_names[stack_index]), "%s+0x%llx", sym, offset); + } + ++stack_index; + + if (stack_index == SDL_arraysize(entry->stack)) { + break; + } + } + } +#endif /* HAVE_LIBUNWIND_H */ + + entry->next = s_tracked_allocations[index]; + s_tracked_allocations[index] = entry; +} + +static void SDL_UntrackAllocation(void *mem) +{ + SDL_tracked_allocation *entry, *prev; + int index = get_allocation_bucket(mem); + + prev = NULL; + for (entry = s_tracked_allocations[index]; entry; entry = entry->next) { + if (mem == entry->mem) { + if (prev) { + prev->next = entry->next; + } else { + s_tracked_allocations[index] = entry->next; + } + SDL_free_orig(entry); + return; + } + prev = entry; + } +} + +static void * SDLCALL SDLTest_TrackedMalloc(size_t size) +{ + void *mem; + + mem = SDL_malloc_orig(size); + if (mem) { + SDL_TrackAllocation(mem, size); + } + return mem; +} + +static void * SDLCALL SDLTest_TrackedCalloc(size_t nmemb, size_t size) +{ + void *mem; + + mem = SDL_calloc_orig(nmemb, size); + if (mem) { + SDL_TrackAllocation(mem, nmemb * size); + } + return mem; +} + +static void * SDLCALL SDLTest_TrackedRealloc(void *ptr, size_t size) +{ + void *mem; + + SDL_assert(!ptr || SDL_IsAllocationTracked(ptr)); + mem = SDL_realloc_orig(ptr, size); + if (mem && mem != ptr) { + if (ptr) { + SDL_UntrackAllocation(ptr); + } + SDL_TrackAllocation(mem, size); + } + return mem; +} + +static void SDLCALL SDLTest_TrackedFree(void *ptr) +{ + if (!ptr) { + return; + } + + if (!s_previous_allocations) { + SDL_assert(SDL_IsAllocationTracked(ptr)); + } + SDL_UntrackAllocation(ptr); + SDL_free_orig(ptr); +} + +int SDLTest_TrackAllocations() +{ + if (SDL_malloc_orig) { + return 0; + } + + SDLTest_Crc32Init(&s_crc32_context); + + s_previous_allocations = SDL_GetNumAllocations(); + if (s_previous_allocations != 0) { + SDL_Log("SDLTest_TrackAllocations(): There are %d previous allocations, disabling free() validation", s_previous_allocations); + } + + SDL_GetMemoryFunctions(&SDL_malloc_orig, + &SDL_calloc_orig, + &SDL_realloc_orig, + &SDL_free_orig); + + SDL_SetMemoryFunctions(SDLTest_TrackedMalloc, + SDLTest_TrackedCalloc, + SDLTest_TrackedRealloc, + SDLTest_TrackedFree); + return 0; +} + +void SDLTest_LogAllocations() +{ + char *message = NULL; + size_t message_size = 0; + char line[128], *tmp; + SDL_tracked_allocation *entry; + int index, count, stack_index; + Uint64 total_allocated; + + if (!SDL_malloc_orig) { + return; + } + +#define ADD_LINE() \ + message_size += (SDL_strlen(line) + 1); \ + tmp = (char *)SDL_realloc_orig(message, message_size); \ + if (!tmp) { \ + return; \ + } \ + message = tmp; \ + SDL_strlcat(message, line, message_size) + + SDL_strlcpy(line, "Memory allocations:\n", sizeof(line)); + ADD_LINE(); + SDL_strlcpy(line, "Expect 2 allocations from within SDL_GetErrBuf()\n", sizeof(line)); + ADD_LINE(); + + count = 0; + total_allocated = 0; + for (index = 0; index < SDL_arraysize(s_tracked_allocations); ++index) { + for (entry = s_tracked_allocations[index]; entry; entry = entry->next) { + SDL_snprintf(line, sizeof(line), "Allocation %d: %d bytes\n", count, (int)entry->size); + ADD_LINE(); + /* Start at stack index 1 to skip our tracking functions */ + for (stack_index = 1; stack_index < SDL_arraysize(entry->stack); ++stack_index) { + if (!entry->stack[stack_index]) { + break; + } + SDL_snprintf(line, sizeof(line), "\t0x%"SDL_PRIx64": %s\n", entry->stack[stack_index], entry->stack_names[stack_index]); + ADD_LINE(); + } + total_allocated += entry->size; + ++count; + } + } + SDL_snprintf(line, sizeof(line), "Total: %.2f Kb in %d allocations\n", (float)total_allocated / 1024, count); + ADD_LINE(); +#undef ADD_LINE + + SDL_Log("%s", message); +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/test/SDL_test_random.c b/Engine/lib/sdl/src/test/SDL_test_random.c index c5baaa640..9e0f1df57 100644 --- a/Engine/lib/sdl/src/test/SDL_test_random.c +++ b/Engine/lib/sdl/src/test/SDL_test_random.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -70,7 +70,7 @@ void SDLTest_RandomInitTime(SDLTest_RandomContext * rndContext) srand((unsigned int)time(NULL)); a=rand(); - srand(clock()); + srand((unsigned int)clock()); b=rand(); SDLTest_RandomInit(rndContext, a, b); } @@ -92,3 +92,5 @@ unsigned int SDLTest_Random(SDLTest_RandomContext * rndContext) rndContext->c++; return (rndContext->x); } + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/thread/SDL_systhread.h b/Engine/lib/sdl/src/thread/SDL_systhread.h index 05a012536..1862b239b 100644 --- a/Engine/lib/sdl/src/thread/SDL_systhread.h +++ b/Engine/lib/sdl/src/thread/SDL_systhread.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,8 +22,8 @@ /* These are functions that need to be implemented by a port of SDL */ -#ifndef _SDL_systhread_h -#define _SDL_systhread_h +#ifndef SDL_systhread_h_ +#define SDL_systhread_h_ #include "SDL_thread.h" #include "SDL_thread_c.h" @@ -55,7 +55,7 @@ extern void SDL_SYS_WaitThread(SDL_Thread * thread); extern void SDL_SYS_DetachThread(SDL_Thread * thread); /* Get the thread local storage for this thread */ -extern SDL_TLSData *SDL_SYS_GetTLSData(); +extern SDL_TLSData *SDL_SYS_GetTLSData(void); /* Set the thread local storage for this thread */ extern int SDL_SYS_SetTLSData(SDL_TLSData *data); @@ -65,6 +65,6 @@ extern SDL_Thread * SDL_CreateThreadInternal(int (SDLCALL * fn) (void *), const char *name, const size_t stacksize, void *data); -#endif /* _SDL_systhread_h */ +#endif /* SDL_systhread_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/thread/SDL_thread.c b/Engine/lib/sdl/src/thread/SDL_thread.c index ae865790a..84b72d577 100644 --- a/Engine/lib/sdl/src/thread/SDL_thread.c +++ b/Engine/lib/sdl/src/thread/SDL_thread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -50,7 +50,7 @@ SDL_TLSGet(SDL_TLSID id) } int -SDL_TLSSet(SDL_TLSID id, const void *value, void (*destructor)(void *)) +SDL_TLSSet(SDL_TLSID id, const void *value, void (SDLCALL *destructor)(void *)) { SDL_TLSData *storage; @@ -121,7 +121,7 @@ static SDL_TLSEntry *SDL_generic_TLS; SDL_TLSData * -SDL_Generic_GetTLSData() +SDL_Generic_GetTLSData(void) { SDL_threadID thread = SDL_ThreadID(); SDL_TLSEntry *entry; diff --git a/Engine/lib/sdl/src/thread/SDL_thread_c.h b/Engine/lib/sdl/src/thread/SDL_thread_c.h index 554325d6d..b68f90e91 100644 --- a/Engine/lib/sdl/src/thread/SDL_thread_c.h +++ b/Engine/lib/sdl/src/thread/SDL_thread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_thread_c_h -#define _SDL_thread_c_h +#ifndef SDL_thread_c_h_ +#define SDL_thread_c_h_ #include "SDL_thread.h" @@ -71,7 +71,7 @@ typedef struct { unsigned int limit; struct { void *data; - void (*destructor)(void*); + void (SDLCALL *destructor)(void*); } array[1]; } SDL_TLSData; @@ -82,7 +82,7 @@ typedef struct { This is only intended as a fallback if getting real thread-local storage fails or isn't supported on this platform. */ -extern SDL_TLSData *SDL_Generic_GetTLSData(); +extern SDL_TLSData *SDL_Generic_GetTLSData(void); /* Set cross-platform, slow, thread local storage for this thread. This is only intended as a fallback if getting real thread-local @@ -90,6 +90,6 @@ extern SDL_TLSData *SDL_Generic_GetTLSData(); */ extern int SDL_Generic_SetTLSData(SDL_TLSData *data); -#endif /* _SDL_thread_c_h */ +#endif /* SDL_thread_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/thread/generic/SDL_syscond.c b/Engine/lib/sdl/src/thread/generic/SDL_syscond.c index e2ccd88ef..34b9893b3 100644 --- a/Engine/lib/sdl/src/thread/generic/SDL_syscond.c +++ b/Engine/lib/sdl/src/thread/generic/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/generic/SDL_sysmutex.c b/Engine/lib/sdl/src/thread/generic/SDL_sysmutex.c index f2f668970..df78ca9ed 100644 --- a/Engine/lib/sdl/src/thread/generic/SDL_sysmutex.c +++ b/Engine/lib/sdl/src/thread/generic/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/generic/SDL_sysmutex_c.h b/Engine/lib/sdl/src/thread/generic/SDL_sysmutex_c.h index 9dba5e16c..2979437b5 100644 --- a/Engine/lib/sdl/src/thread/generic/SDL_sysmutex_c.h +++ b/Engine/lib/sdl/src/thread/generic/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/generic/SDL_syssem.c b/Engine/lib/sdl/src/thread/generic/SDL_syssem.c index 92afcb0c0..30ff82441 100644 --- a/Engine/lib/sdl/src/thread/generic/SDL_syssem.c +++ b/Engine/lib/sdl/src/thread/generic/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/generic/SDL_systhread.c b/Engine/lib/sdl/src/thread/generic/SDL_systhread.c index 7a81a6201..7a19b781c 100644 --- a/Engine/lib/sdl/src/thread/generic/SDL_systhread.c +++ b/Engine/lib/sdl/src/thread/generic/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/generic/SDL_systhread_c.h b/Engine/lib/sdl/src/thread/generic/SDL_systhread_c.h index ea9b71460..13db579d0 100644 --- a/Engine/lib/sdl/src/thread/generic/SDL_systhread_c.h +++ b/Engine/lib/sdl/src/thread/generic/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/generic/SDL_systls.c b/Engine/lib/sdl/src/thread/generic/SDL_systls.c index e29c19818..241862e83 100644 --- a/Engine/lib/sdl/src/thread/generic/SDL_systls.c +++ b/Engine/lib/sdl/src/thread/generic/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,7 @@ SDL_TLSData * -SDL_SYS_GetTLSData() +SDL_SYS_GetTLSData(void) { return SDL_Generic_GetTLSData(); } diff --git a/Engine/lib/sdl/src/thread/psp/SDL_syscond.c b/Engine/lib/sdl/src/thread/psp/SDL_syscond.c index a84b206c8..4ed73e0ec 100644 --- a/Engine/lib/sdl/src/thread/psp/SDL_syscond.c +++ b/Engine/lib/sdl/src/thread/psp/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/psp/SDL_sysmutex.c b/Engine/lib/sdl/src/thread/psp/SDL_sysmutex.c index 78129fa69..e2db5eb11 100644 --- a/Engine/lib/sdl/src/thread/psp/SDL_sysmutex.c +++ b/Engine/lib/sdl/src/thread/psp/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/psp/SDL_sysmutex_c.h b/Engine/lib/sdl/src/thread/psp/SDL_sysmutex_c.h index 9dba5e16c..2979437b5 100644 --- a/Engine/lib/sdl/src/thread/psp/SDL_sysmutex_c.h +++ b/Engine/lib/sdl/src/thread/psp/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/psp/SDL_syssem.c b/Engine/lib/sdl/src/thread/psp/SDL_syssem.c index 643406c46..0c3643409 100644 --- a/Engine/lib/sdl/src/thread/psp/SDL_syssem.c +++ b/Engine/lib/sdl/src/thread/psp/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -108,7 +108,7 @@ int SDL_SemWaitTimeout(SDL_sem *sem, Uint32 timeout) case SCE_KERNEL_ERROR_WAIT_TIMEOUT: return SDL_MUTEX_TIMEDOUT; default: - return SDL_SetError("WaitForSingleObject() failed"); + return SDL_SetError("sceKernelWaitSema() failed"); } } diff --git a/Engine/lib/sdl/src/thread/psp/SDL_systhread.c b/Engine/lib/sdl/src/thread/psp/SDL_systhread.c index c6003b8ed..9286be59e 100644 --- a/Engine/lib/sdl/src/thread/psp/SDL_systhread.c +++ b/Engine/lib/sdl/src/thread/psp/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/psp/SDL_systhread_c.h b/Engine/lib/sdl/src/thread/psp/SDL_systhread_c.h index 4f74df06a..ea26f81d2 100644 --- a/Engine/lib/sdl/src/thread/psp/SDL_systhread_c.h +++ b/Engine/lib/sdl/src/thread/psp/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/pthread/SDL_syscond.c b/Engine/lib/sdl/src/thread/pthread/SDL_syscond.c index 998ac55b3..d23578038 100644 --- a/Engine/lib/sdl/src/thread/pthread/SDL_syscond.c +++ b/Engine/lib/sdl/src/thread/pthread/SDL_syscond.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,7 +42,7 @@ SDL_CreateCond(void) cond = (SDL_cond *) SDL_malloc(sizeof(SDL_cond)); if (cond) { - if (pthread_cond_init(&cond->cond, NULL) < 0) { + if (pthread_cond_init(&cond->cond, NULL) != 0) { SDL_SetError("pthread_cond_init() failed"); SDL_free(cond); cond = NULL; @@ -129,7 +129,7 @@ SDL_CondWaitTimeout(SDL_cond * cond, SDL_mutex * mutex, Uint32 ms) switch (retval) { case EINTR: goto tryagain; - break; + /* break; -Wunreachable-code-break */ case ETIMEDOUT: retval = SDL_MUTEX_TIMEDOUT; break; diff --git a/Engine/lib/sdl/src/thread/pthread/SDL_sysmutex.c b/Engine/lib/sdl/src/thread/pthread/SDL_sysmutex.c index f24cfdab0..e7b5b5cec 100644 --- a/Engine/lib/sdl/src/thread/pthread/SDL_sysmutex.c +++ b/Engine/lib/sdl/src/thread/pthread/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,9 +20,6 @@ */ #include "../../SDL_internal.h" -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif #include #include @@ -108,7 +105,7 @@ SDL_LockMutex(SDL_mutex * mutex) } } #else - if (pthread_mutex_lock(&mutex->id) < 0) { + if (pthread_mutex_lock(&mutex->id) != 0) { return SDL_SetError("pthread_mutex_lock() failed"); } #endif @@ -137,7 +134,7 @@ SDL_TryLockMutex(SDL_mutex * mutex) We set the locking thread id after we obtain the lock so unlocks from other threads will fail. */ - if (pthread_mutex_lock(&mutex->id) == 0) { + if (pthread_mutex_trylock(&mutex->id) == 0) { mutex->owner = this_thread; mutex->recursive = 0; } else if (errno == EBUSY) { @@ -184,7 +181,7 @@ SDL_UnlockMutex(SDL_mutex * mutex) } #else - if (pthread_mutex_unlock(&mutex->id) < 0) { + if (pthread_mutex_unlock(&mutex->id) != 0) { return SDL_SetError("pthread_mutex_unlock() failed"); } #endif /* FAKE_RECURSIVE_MUTEX */ diff --git a/Engine/lib/sdl/src/thread/pthread/SDL_sysmutex_c.h b/Engine/lib/sdl/src/thread/pthread/SDL_sysmutex_c.h index ee60ca041..27ac1da61 100644 --- a/Engine/lib/sdl/src/thread/pthread/SDL_sysmutex_c.h +++ b/Engine/lib/sdl/src/thread/pthread/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_mutex_c_h -#define _SDL_mutex_c_h +#ifndef SDL_mutex_c_h_ +#define SDL_mutex_c_h_ struct SDL_mutex { pthread_mutex_t id; }; -#endif /* _SDL_mutex_c_h */ +#endif /* SDL_mutex_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/thread/pthread/SDL_syssem.c b/Engine/lib/sdl/src/thread/pthread/SDL_syssem.c index b7547e699..bdebf1311 100644 --- a/Engine/lib/sdl/src/thread/pthread/SDL_syssem.c +++ b/Engine/lib/sdl/src/thread/pthread/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,9 +20,6 @@ */ #include "../../SDL_internal.h" -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif #include #include #include @@ -94,7 +91,10 @@ SDL_SemWait(SDL_sem * sem) return SDL_SetError("Passed a NULL semaphore"); } - retval = sem_wait(&sem->sem); + do { + retval = sem_wait(&sem->sem); + } while (retval < 0 && errno == EINTR); + if (retval < 0) { retval = SDL_SetError("sem_wait() failed"); } diff --git a/Engine/lib/sdl/src/thread/pthread/SDL_systhread.c b/Engine/lib/sdl/src/thread/pthread/SDL_systhread.c index 4958f6fb9..035484085 100644 --- a/Engine/lib/sdl/src/thread/pthread/SDL_systhread.c +++ b/Engine/lib/sdl/src/thread/pthread/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -52,7 +52,7 @@ #endif #ifdef __HAIKU__ -#include +#include #endif #include "SDL_assert.h" @@ -212,7 +212,7 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) int policy; pthread_t thread = pthread_self(); - if (pthread_getschedparam(thread, &policy, &sched) < 0) { + if (pthread_getschedparam(thread, &policy, &sched) != 0) { return SDL_SetError("pthread_getschedparam() failed"); } if (priority == SDL_THREAD_PRIORITY_LOW) { @@ -224,7 +224,7 @@ SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority) int max_priority = sched_get_priority_max(policy); sched.sched_priority = (min_priority + (max_priority - min_priority) / 2); } - if (pthread_setschedparam(thread, policy, &sched) < 0) { + if (pthread_setschedparam(thread, policy, &sched) != 0) { return SDL_SetError("pthread_setschedparam() failed"); } return 0; diff --git a/Engine/lib/sdl/src/thread/pthread/SDL_systhread_c.h b/Engine/lib/sdl/src/thread/pthread/SDL_systhread_c.h index 4ad188443..898c219fd 100644 --- a/Engine/lib/sdl/src/thread/pthread/SDL_systhread_c.h +++ b/Engine/lib/sdl/src/thread/pthread/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/pthread/SDL_systls.c b/Engine/lib/sdl/src/thread/pthread/SDL_systls.c index 622ad0297..c580595bd 100644 --- a/Engine/lib/sdl/src/thread/pthread/SDL_systls.c +++ b/Engine/lib/sdl/src/thread/pthread/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,6 +20,7 @@ */ #include "../../SDL_internal.h" #include "SDL_thread.h" +#include "../SDL_systhread.h" #include "../SDL_thread_c.h" #include @@ -31,7 +32,7 @@ static pthread_key_t thread_local_storage = INVALID_PTHREAD_KEY; static SDL_bool generic_local_storage = SDL_FALSE; SDL_TLSData * -SDL_SYS_GetTLSData() +SDL_SYS_GetTLSData(void) { if (thread_local_storage == INVALID_PTHREAD_KEY && !generic_local_storage) { static SDL_SpinLock lock; diff --git a/Engine/lib/sdl/src/thread/stdcpp/SDL_syscond.cpp b/Engine/lib/sdl/src/thread/stdcpp/SDL_syscond.cpp index 976bff487..32c7c4bc3 100644 --- a/Engine/lib/sdl/src/thread/stdcpp/SDL_syscond.cpp +++ b/Engine/lib/sdl/src/thread/stdcpp/SDL_syscond.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/stdcpp/SDL_sysmutex.cpp b/Engine/lib/sdl/src/thread/stdcpp/SDL_sysmutex.cpp index 04028627d..667d36b48 100644 --- a/Engine/lib/sdl/src/thread/stdcpp/SDL_sysmutex.cpp +++ b/Engine/lib/sdl/src/thread/stdcpp/SDL_sysmutex.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/stdcpp/SDL_sysmutex_c.h b/Engine/lib/sdl/src/thread/stdcpp/SDL_sysmutex_c.h index ab0f2dd83..000288f29 100644 --- a/Engine/lib/sdl/src/thread/stdcpp/SDL_sysmutex_c.h +++ b/Engine/lib/sdl/src/thread/stdcpp/SDL_sysmutex_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/stdcpp/SDL_systhread.cpp b/Engine/lib/sdl/src/thread/stdcpp/SDL_systhread.cpp index 6e5ef473e..3020f1c1b 100644 --- a/Engine/lib/sdl/src/thread/stdcpp/SDL_systhread.cpp +++ b/Engine/lib/sdl/src/thread/stdcpp/SDL_systhread.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -153,7 +153,7 @@ SDL_SYS_DetachThread(SDL_Thread * thread) extern "C" SDL_TLSData * -SDL_SYS_GetTLSData() +SDL_SYS_GetTLSData(void) { return SDL_Generic_GetTLSData(); } diff --git a/Engine/lib/sdl/src/thread/stdcpp/SDL_systhread_c.h b/Engine/lib/sdl/src/thread/stdcpp/SDL_systhread_c.h index c3cc507c3..ee4764de6 100644 --- a/Engine/lib/sdl/src/thread/stdcpp/SDL_systhread_c.h +++ b/Engine/lib/sdl/src/thread/stdcpp/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/windows/SDL_sysmutex.c b/Engine/lib/sdl/src/thread/windows/SDL_sysmutex.c index 413cb6703..119e62b67 100644 --- a/Engine/lib/sdl/src/thread/windows/SDL_sysmutex.c +++ b/Engine/lib/sdl/src/thread/windows/SDL_sysmutex.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/thread/windows/SDL_syssem.c b/Engine/lib/sdl/src/thread/windows/SDL_syssem.c index 86b58882d..dcb36fa0f 100644 --- a/Engine/lib/sdl/src/thread/windows/SDL_syssem.c +++ b/Engine/lib/sdl/src/thread/windows/SDL_syssem.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -90,11 +90,7 @@ SDL_SemWaitTimeout(SDL_sem * sem, Uint32 timeout) } else { dwMilliseconds = (DWORD) timeout; } -#if __WINRT__ switch (WaitForSingleObjectEx(sem->id, dwMilliseconds, FALSE)) { -#else - switch (WaitForSingleObject(sem->id, dwMilliseconds)) { -#endif case WAIT_OBJECT_0: InterlockedDecrement(&sem->count); retval = 0; diff --git a/Engine/lib/sdl/src/thread/windows/SDL_systhread.c b/Engine/lib/sdl/src/thread/windows/SDL_systhread.c index 20a4bd6e2..90036c920 100644 --- a/Engine/lib/sdl/src/thread/windows/SDL_systhread.c +++ b/Engine/lib/sdl/src/thread/windows/SDL_systhread.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -164,26 +164,55 @@ typedef struct tagTHREADNAME_INFO } THREADNAME_INFO; #pragma pack(pop) + +typedef HRESULT (WINAPI *pfnSetThreadDescription)(HANDLE, PCWSTR); + void SDL_SYS_SetupThread(const char *name) { - if ((name != NULL) && IsDebuggerPresent()) { - THREADNAME_INFO inf; + if (name != NULL) { + #ifndef __WINRT__ /* !!! FIXME: There's no LoadLibrary() in WinRT; don't know if SetThreadDescription is available there at all at the moment. */ + static pfnSetThreadDescription pSetThreadDescription = NULL; + static HMODULE kernel32 = 0; - /* C# and friends will try to catch this Exception, let's avoid it. */ - if (SDL_GetHintBoolean(SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING, SDL_FALSE)) { - return; + if (!kernel32) { + kernel32 = LoadLibraryW(L"kernel32.dll"); + if (kernel32) { + pSetThreadDescription = (pfnSetThreadDescription) GetProcAddress(kernel32, "SetThreadDescription"); + } } - /* This magic tells the debugger to name a thread if it's listening. */ - SDL_zero(inf); - inf.dwType = 0x1000; - inf.szName = name; - inf.dwThreadID = (DWORD) -1; - inf.dwFlags = 0; + if (pSetThreadDescription != NULL) { + WCHAR *strw = WIN_UTF8ToString(name); + if (strw) { + pSetThreadDescription(GetCurrentThread(), strw); + SDL_free(strw); + } + } + #endif - /* The debugger catches this, renames the thread, continues on. */ - RaiseException(0x406D1388, 0, sizeof(inf) / sizeof(ULONG), (const ULONG_PTR*) &inf); + /* Presumably some version of Visual Studio will understand SetThreadDescription(), + but we still need to deal with older OSes and debuggers. Set it with the arcane + exception magic, too. */ + + if (IsDebuggerPresent()) { + THREADNAME_INFO inf; + + /* C# and friends will try to catch this Exception, let's avoid it. */ + if (SDL_GetHintBoolean(SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING, SDL_TRUE)) { + return; + } + + /* This magic tells the debugger to name a thread if it's listening. */ + SDL_zero(inf); + inf.dwType = 0x1000; + inf.szName = name; + inf.dwThreadID = (DWORD) -1; + inf.dwFlags = 0; + + /* The debugger catches this, renames the thread, continues on. */ + RaiseException(0x406D1388, 0, sizeof(inf) / sizeof(ULONG), (const ULONG_PTR*) &inf); + } } } diff --git a/Engine/lib/sdl/src/thread/windows/SDL_systhread_c.h b/Engine/lib/sdl/src/thread/windows/SDL_systhread_c.h index 90866a7bb..65d5a1b8c 100644 --- a/Engine/lib/sdl/src/thread/windows/SDL_systhread_c.h +++ b/Engine/lib/sdl/src/thread/windows/SDL_systhread_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_systhread_c_h -#define _SDL_systhread_c_h +#ifndef SDL_systhread_c_h_ +#define SDL_systhread_c_h_ #include "../../core/windows/SDL_windows.h" typedef HANDLE SYS_ThreadHandle; -#endif /* _SDL_systhread_c_h */ +#endif /* SDL_systhread_c_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/thread/windows/SDL_systls.c b/Engine/lib/sdl/src/thread/windows/SDL_systls.c index 7ec630e8f..888fd747a 100644 --- a/Engine/lib/sdl/src/thread/windows/SDL_systls.c +++ b/Engine/lib/sdl/src/thread/windows/SDL_systls.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,7 +32,7 @@ static DWORD thread_local_storage = TLS_OUT_OF_INDEXES; static SDL_bool generic_local_storage = SDL_FALSE; SDL_TLSData * -SDL_SYS_GetTLSData() +SDL_SYS_GetTLSData(void) { if (thread_local_storage == TLS_OUT_OF_INDEXES && !generic_local_storage) { static SDL_SpinLock lock; diff --git a/Engine/lib/sdl/src/timer/SDL_timer.c b/Engine/lib/sdl/src/timer/SDL_timer.c index abe968e86..f4a13f4bd 100644 --- a/Engine/lib/sdl/src/timer/SDL_timer.c +++ b/Engine/lib/sdl/src/timer/SDL_timer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -97,7 +97,7 @@ SDL_AddTimerInternal(SDL_TimerData *data, SDL_Timer *timer) timer->next = curr; } -static int +static int SDLCALL SDL_TimerThread(void *_data) { SDL_TimerData *data = (SDL_TimerData *)_data; @@ -168,6 +168,7 @@ SDL_TimerThread(void *_data) if (interval > 0) { /* Reschedule this timer */ + current->interval = interval; current->scheduled = tick + interval; SDL_AddTimerInternal(data, current); } else { diff --git a/Engine/lib/sdl/src/timer/SDL_timer_c.h b/Engine/lib/sdl/src/timer/SDL_timer_c.h index 6ae817058..f83bdded0 100644 --- a/Engine/lib/sdl/src/timer/SDL_timer_c.h +++ b/Engine/lib/sdl/src/timer/SDL_timer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/timer/dummy/SDL_systimer.c b/Engine/lib/sdl/src/timer/dummy/SDL_systimer.c index 1174d2241..aff145b29 100644 --- a/Engine/lib/sdl/src/timer/dummy/SDL_systimer.c +++ b/Engine/lib/sdl/src/timer/dummy/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/timer/haiku/SDL_systimer.c b/Engine/lib/sdl/src/timer/haiku/SDL_systimer.c index f45aa64d7..16f49c05c 100644 --- a/Engine/lib/sdl/src/timer/haiku/SDL_systimer.c +++ b/Engine/lib/sdl/src/timer/haiku/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #ifdef SDL_TIMER_HAIKU -#include +#include #include "SDL_timer.h" diff --git a/Engine/lib/sdl/src/timer/psp/SDL_systimer.c b/Engine/lib/sdl/src/timer/psp/SDL_systimer.c index 1e8802cf1..e39d8007f 100644 --- a/Engine/lib/sdl/src/timer/psp/SDL_systimer.c +++ b/Engine/lib/sdl/src/timer/psp/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/timer/unix/SDL_systimer.c b/Engine/lib/sdl/src/timer/unix/SDL_systimer.c index 217fe327f..5045996f3 100644 --- a/Engine/lib/sdl/src/timer/unix/SDL_systimer.c +++ b/Engine/lib/sdl/src/timer/unix/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,6 +29,7 @@ #include "SDL_timer.h" #include "SDL_assert.h" +#include "../SDL_timer_c.h" /* The clock_gettime provides monotonous time, so we should use it if it's available. The clock_gettime function is behind ifdef diff --git a/Engine/lib/sdl/src/timer/windows/SDL_systimer.c b/Engine/lib/sdl/src/timer/windows/SDL_systimer.c index 5c9121a51..3f5413b26 100644 --- a/Engine/lib/sdl/src/timer/windows/SDL_systimer.c +++ b/Engine/lib/sdl/src/timer/windows/SDL_systimer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -60,7 +60,7 @@ SDL_SetSystemTimerResolution(const UINT uPeriod) #endif } -static void +static void SDLCALL SDL_TimerResolutionChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { UINT uPeriod; diff --git a/Engine/lib/sdl/src/video/SDL_RLEaccel.c b/Engine/lib/sdl/src/video/SDL_RLEaccel.c index 67baaf664..661cb1f53 100644 --- a/Engine/lib/sdl/src/video/SDL_RLEaccel.c +++ b/Engine/lib/sdl/src/video/SDL_RLEaccel.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -90,9 +90,6 @@ #include "SDL_blit.h" #include "SDL_RLEaccel_c.h" -#ifndef MAX -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif #ifndef MIN #define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif @@ -448,7 +445,7 @@ RLEClipBlit(int w, Uint8 * srcbuf, SDL_Surface * surf_dst, /* blit a colorkeyed RLE surface */ -int +int SDLCALL SDL_RLEBlit(SDL_Surface * surf_src, SDL_Rect * srcrect, SDL_Surface * surf_dst, SDL_Rect * dstrect) { @@ -726,7 +723,7 @@ RLEAlphaClipBlit(int w, Uint8 * srcbuf, SDL_Surface * surf_dst, } /* blit a pixel-alpha RLE surface */ -int +int SDLCALL SDL_RLEAlphaBlit(SDL_Surface * surf_src, SDL_Rect * srcrect, SDL_Surface * surf_dst, SDL_Rect * dstrect) { @@ -1280,7 +1277,7 @@ RLEColorkeySurface(SDL_Surface * surface) int y; Uint8 *srcbuf, *lastline; int maxsize = 0; - int bpp = surface->format->BytesPerPixel; + const int bpp = surface->format->BytesPerPixel; getpix_func getpix; Uint32 ckey, rgbmask; int w, h; @@ -1303,6 +1300,9 @@ RLEColorkeySurface(SDL_Surface * surface) maxsize = surface->h * (4 * (surface->w / 65535 + 1) + surface->w * 4) + 4; break; + + default: + return -1; } rlebuf = (Uint8 *) SDL_malloc(maxsize); @@ -1396,7 +1396,7 @@ RLEColorkeySurface(SDL_Surface * surface) surface->map->data = p; } - return (0); + return 0; } int diff --git a/Engine/lib/sdl/src/video/SDL_RLEaccel_c.h b/Engine/lib/sdl/src/video/SDL_RLEaccel_c.h index c04fc1527..fe418358b 100644 --- a/Engine/lib/sdl/src/video/SDL_RLEaccel_c.h +++ b/Engine/lib/sdl/src/video/SDL_RLEaccel_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,9 +23,9 @@ /* Useful functions and variables from SDL_RLEaccel.c */ extern int SDL_RLESurface(SDL_Surface * surface); -extern int SDL_RLEBlit(SDL_Surface * src, SDL_Rect * srcrect, - SDL_Surface * dst, SDL_Rect * dstrect); -extern int SDL_RLEAlphaBlit(SDL_Surface * src, SDL_Rect * srcrect, - SDL_Surface * dst, SDL_Rect * dstrect); +extern int SDLCALL SDL_RLEBlit (SDL_Surface * src, SDL_Rect * srcrect, + SDL_Surface * dst, SDL_Rect * dstrect); +extern int SDLCALL SDL_RLEAlphaBlit(SDL_Surface * src, SDL_Rect * srcrect, + SDL_Surface * dst, SDL_Rect * dstrect); extern void SDL_UnRLESurface(SDL_Surface * surface, int recode); /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/SDL_blit.c b/Engine/lib/sdl/src/video/SDL_blit.c index 90aa87898..0d4e2fdb9 100644 --- a/Engine/lib/sdl/src/video/SDL_blit.c +++ b/Engine/lib/sdl/src/video/SDL_blit.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,7 +30,7 @@ #include "SDL_pixels_c.h" /* The general purpose software blit routine */ -static int +static int SDLCALL SDL_SoftBlit(SDL_Surface * src, SDL_Rect * srcrect, SDL_Surface * dst, SDL_Rect * dstrect) { @@ -219,6 +219,12 @@ SDL_CalculateBlit(SDL_Surface * surface) SDL_BlitMap *map = surface->map; SDL_Surface *dst = map->dst; + /* We don't currently support blitting to < 8 bpp surfaces */ + if (dst->format->BitsPerPixel < 8) { + SDL_InvalidateMap(map); + return SDL_SetError("Blit combination not supported"); + } + /* Clean everything out to start */ if ((surface->flags & SDL_RLEACCEL) == SDL_RLEACCEL) { SDL_UnRLESurface(surface, 1); @@ -239,6 +245,10 @@ SDL_CalculateBlit(SDL_Surface * surface) /* Choose a standard blit function */ if (map->identity && !(map->info.flags & ~SDL_COPY_RLE_DESIRED)) { blit = SDL_BlitCopy; + } else if (surface->format->Rloss > 8 || dst->format->Rloss > 8) { + /* Greater than 8 bits per channel not supported yet */ + SDL_InvalidateMap(map); + return SDL_SetError("Blit combination not supported"); } else if (surface->format->BitsPerPixel < 8 && SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) { blit = SDL_CalculateBlit0(surface); diff --git a/Engine/lib/sdl/src/video/SDL_blit.h b/Engine/lib/sdl/src/video/SDL_blit.h index e30f8afec..ca1053445 100644 --- a/Engine/lib/sdl/src/video/SDL_blit.h +++ b/Engine/lib/sdl/src/video/SDL_blit.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_blit_h -#define _SDL_blit_h +#ifndef SDL_blit_h_ +#define SDL_blit_h_ #include "SDL_cpuinfo.h" #include "SDL_endian.h" @@ -70,7 +70,8 @@ typedef struct Uint8 r, g, b, a; } SDL_BlitInfo; -typedef void (SDLCALL * SDL_BlitFunc) (SDL_BlitInfo * info); +typedef void (*SDL_BlitFunc) (SDL_BlitInfo *info); + typedef struct { @@ -443,19 +444,19 @@ do { \ /* Blend the RGB values of two pixels with an alpha value */ #define ALPHA_BLEND_RGB(sR, sG, sB, A, dR, dG, dB) \ do { \ - dR = ((((unsigned)(sR-dR)*(unsigned)A)/255)+dR); \ - dG = ((((unsigned)(sG-dG)*(unsigned)A)/255)+dG); \ - dB = ((((unsigned)(sB-dB)*(unsigned)A)/255)+dB); \ + dR = (Uint8)((((int)(sR-dR)*(int)A)/255)+dR); \ + dG = (Uint8)((((int)(sG-dG)*(int)A)/255)+dG); \ + dB = (Uint8)((((int)(sB-dB)*(int)A)/255)+dB); \ } while(0) /* Blend the RGBA values of two pixels */ #define ALPHA_BLEND_RGBA(sR, sG, sB, sA, dR, dG, dB, dA) \ do { \ - dR = ((((unsigned)(sR-dR)*(unsigned)sA)/255)+dR); \ - dG = ((((unsigned)(sG-dG)*(unsigned)sA)/255)+dG); \ - dB = ((((unsigned)(sB-dB)*(unsigned)sA)/255)+dB); \ - dA = ((unsigned)sA+(unsigned)dA-((unsigned)sA*dA)/255); \ + dR = (Uint8)((((int)(sR-dR)*(int)sA)/255)+dR); \ + dG = (Uint8)((((int)(sG-dG)*(int)sA)/255)+dG); \ + dB = (Uint8)((((int)(sB-dB)*(int)sA)/255)+dB); \ + dA = (Uint8)((int)sA+dA-((int)sA*dA)/255); \ } while(0) @@ -471,14 +472,14 @@ do { \ #define DUFFS_LOOP8(pixel_copy_increment, width) \ { int n = (width+7)/8; \ switch (width & 7) { \ - case 0: do { pixel_copy_increment; \ - case 7: pixel_copy_increment; \ - case 6: pixel_copy_increment; \ - case 5: pixel_copy_increment; \ - case 4: pixel_copy_increment; \ - case 3: pixel_copy_increment; \ - case 2: pixel_copy_increment; \ - case 1: pixel_copy_increment; \ + case 0: do { pixel_copy_increment; /* fallthrough */ \ + case 7: pixel_copy_increment; /* fallthrough */ \ + case 6: pixel_copy_increment; /* fallthrough */ \ + case 5: pixel_copy_increment; /* fallthrough */ \ + case 4: pixel_copy_increment; /* fallthrough */ \ + case 3: pixel_copy_increment; /* fallthrough */ \ + case 2: pixel_copy_increment; /* fallthrough */ \ + case 1: pixel_copy_increment; /* fallthrough */ \ } while ( --n > 0 ); \ } \ } @@ -487,10 +488,10 @@ do { \ #define DUFFS_LOOP4(pixel_copy_increment, width) \ { int n = (width+3)/4; \ switch (width & 3) { \ - case 0: do { pixel_copy_increment; \ - case 3: pixel_copy_increment; \ - case 2: pixel_copy_increment; \ - case 1: pixel_copy_increment; \ + case 0: do { pixel_copy_increment; /* fallthrough */ \ + case 3: pixel_copy_increment; /* fallthrough */ \ + case 2: pixel_copy_increment; /* fallthrough */ \ + case 1: pixel_copy_increment; /* fallthrough */ \ } while (--n > 0); \ } \ } @@ -547,6 +548,6 @@ do { \ #pragma warning(disable: 4550) #endif -#endif /* _SDL_blit_h */ +#endif /* SDL_blit_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/SDL_blit_0.c b/Engine/lib/sdl/src/video/SDL_blit_0.c index fe7330d78..b5c8efb3c 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_0.c +++ b/Engine/lib/sdl/src/video/SDL_blit_0.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/SDL_blit_1.c b/Engine/lib/sdl/src/video/SDL_blit_1.c index 69c15d08d..b7c5412ee 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_1.c +++ b/Engine/lib/sdl/src/video/SDL_blit_1.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -70,12 +70,14 @@ Blit1to1(SDL_BlitInfo * info) } /* This is now endian dependent */ -#if ( SDL_BYTEORDER == SDL_LIL_ENDIAN ) -#define HI 1 -#define LO 0 -#else /* ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) */ -#define HI 0 -#define LO 1 +#ifndef USE_DUFFS_LOOP +# if ( SDL_BYTEORDER == SDL_LIL_ENDIAN ) +# define HI 1 +# define LO 0 +# else /* ( SDL_BYTEORDER == SDL_BIG_ENDIAN ) */ +# define HI 0 +# define LO 1 +# endif #endif static void Blit1to2(SDL_BlitInfo * info) diff --git a/Engine/lib/sdl/src/video/SDL_blit_A.c b/Engine/lib/sdl/src/video/SDL_blit_A.c index 0190ffddd..1e9c9d89b 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_A.c +++ b/Engine/lib/sdl/src/video/SDL_blit_A.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -1317,9 +1317,9 @@ SDL_CalculateBlitA(SDL_Surface * surface) case 3: default: - return BlitNtoNPixelAlpha; + break; } - break; + return BlitNtoNPixelAlpha; case SDL_COPY_MODULATE_ALPHA | SDL_COPY_BLEND: if (sf->Amask == 0) { diff --git a/Engine/lib/sdl/src/video/SDL_blit_N.c b/Engine/lib/sdl/src/video/SDL_blit_N.c index 94894a78c..441cd9a21 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_N.c +++ b/Engine/lib/sdl/src/video/SDL_blit_N.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -118,12 +118,6 @@ calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt) 16, 8, 0, 24, 0, NULL }; - if (!srcfmt) { - srcfmt = &default_pixel_format; - } - if (!dstfmt) { - dstfmt = &default_pixel_format; - } const vector unsigned char plus = VECUINT8_LITERAL(0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, 0x08, @@ -131,11 +125,20 @@ calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt) 0x0C); vector unsigned char vswiz; vector unsigned int srcvec; + Uint32 rmask, gmask, bmask, amask; + + if (!srcfmt) { + srcfmt = &default_pixel_format; + } + if (!dstfmt) { + dstfmt = &default_pixel_format; + } + #define RESHIFT(X) (3 - ((X) >> 3)) - Uint32 rmask = RESHIFT(srcfmt->Rshift) << (dstfmt->Rshift); - Uint32 gmask = RESHIFT(srcfmt->Gshift) << (dstfmt->Gshift); - Uint32 bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift); - Uint32 amask; + rmask = RESHIFT(srcfmt->Rshift) << (dstfmt->Rshift); + gmask = RESHIFT(srcfmt->Gshift) << (dstfmt->Gshift); + bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift); + /* Use zero for alpha if either surface doesn't have alpha */ if (dstfmt->Amask) { amask = @@ -147,6 +150,7 @@ calc_swizzle32(const SDL_PixelFormat * srcfmt, const SDL_PixelFormat * dstfmt) 0xFFFFFFFF); } #undef RESHIFT + ((unsigned int *) (char *) &srcvec)[0] = (rmask | gmask | bmask | amask); vswiz = vec_add(plus, (vector unsigned char) vec_splat(srcvec, 0)); return (vswiz); @@ -1109,6 +1113,7 @@ Blit_RGB101010_index8(SDL_BlitInfo * info) (((*src)&0x0000F800)>>6)| \ (((*src)&0x000000F8)>>3)); \ } +#ifndef USE_DUFFS_LOOP #define RGB888_RGB555_TWO(dst, src) { \ *(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>9)| \ (((src[HI])&0x0000F800)>>6)| \ @@ -1117,6 +1122,7 @@ Blit_RGB101010_index8(SDL_BlitInfo * info) (((src[LO])&0x0000F800)>>6)| \ (((src[LO])&0x000000F8)>>3); \ } +#endif static void Blit_RGB888_RGB555(SDL_BlitInfo * info) { @@ -1233,6 +1239,7 @@ Blit_RGB888_RGB555(SDL_BlitInfo * info) (((*src)&0x0000FC00)>>5)| \ (((*src)&0x000000F8)>>3)); \ } +#ifndef USE_DUFFS_LOOP #define RGB888_RGB565_TWO(dst, src) { \ *(Uint32 *)(dst) = (((((src[HI])&0x00F80000)>>8)| \ (((src[HI])&0x0000FC00)>>5)| \ @@ -1241,6 +1248,7 @@ Blit_RGB888_RGB555(SDL_BlitInfo * info) (((src[LO])&0x0000FC00)>>5)| \ (((src[LO])&0x000000F8)>>3); \ } +#endif static void Blit_RGB888_RGB565(SDL_BlitInfo * info) { @@ -2455,6 +2463,9 @@ BlitNto2101010(SDL_BlitInfo * info) } /* Normal N to N optimized blitters */ +#define NO_ALPHA 1 +#define SET_ALPHA 2 +#define COPY_ALPHA 4 struct blit_table { Uint32 srcR, srcG, srcB; @@ -2462,8 +2473,7 @@ struct blit_table Uint32 dstR, dstG, dstB; Uint32 blit_features; SDL_BlitFunc blitfunc; - enum - { NO_ALPHA = 1, SET_ALPHA = 2, COPY_ALPHA = 4 } alpha; + Uint32 alpha; /* bitwise NO_ALPHA, SET_ALPHA, COPY_ALPHA */ }; static const struct blit_table normal_blit_1[] = { /* Default for 8-bit RGB source, never optimized */ diff --git a/Engine/lib/sdl/src/video/SDL_blit_auto.c b/Engine/lib/sdl/src/video/SDL_blit_auto.c index f12281913..d9d266f9b 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_auto.c +++ b/Engine/lib/sdl/src/video/SDL_blit_auto.c @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/SDL_blit_auto.h b/Engine/lib/sdl/src/video/SDL_blit_auto.h index 58a532db0..41a6a3208 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_auto.h +++ b/Engine/lib/sdl/src/video/SDL_blit_auto.h @@ -1,7 +1,7 @@ /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/SDL_blit_copy.c b/Engine/lib/sdl/src/video/SDL_blit_copy.c index 674650dd9..e86289845 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_copy.c +++ b/Engine/lib/sdl/src/video/SDL_blit_copy.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/SDL_blit_copy.h b/Engine/lib/sdl/src/video/SDL_blit_copy.h index 060026d8a..46651791e 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_copy.h +++ b/Engine/lib/sdl/src/video/SDL_blit_copy.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/SDL_blit_slow.c b/Engine/lib/sdl/src/video/SDL_blit_slow.c index 02ab41de7..20ca8ab81 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_slow.c +++ b/Engine/lib/sdl/src/video/SDL_blit_slow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/SDL_blit_slow.h b/Engine/lib/sdl/src/video/SDL_blit_slow.h index 75005fc53..02d360a6e 100644 --- a/Engine/lib/sdl/src/video/SDL_blit_slow.h +++ b/Engine/lib/sdl/src/video/SDL_blit_slow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/SDL_bmp.c b/Engine/lib/sdl/src/video/SDL_bmp.c index 2d9cf240b..ba908a659 100644 --- a/Engine/lib/sdl/src/video/SDL_bmp.c +++ b/Engine/lib/sdl/src/video/SDL_bmp.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -124,6 +124,9 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc) Uint32 biClrUsed = 0; /* Uint32 biClrImportant = 0; */ + (void) haveRGBMasks; + (void) haveAlphaMask; + /* Make sure we are passed a valid data source */ surface = NULL; was_error = SDL_FALSE; diff --git a/Engine/lib/sdl/src/video/SDL_clipboard.c b/Engine/lib/sdl/src/video/SDL_clipboard.c index 91d1eeea0..0dd6a05b9 100644 --- a/Engine/lib/sdl/src/video/SDL_clipboard.c +++ b/Engine/lib/sdl/src/video/SDL_clipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/SDL_egl.c b/Engine/lib/sdl/src/video/SDL_egl.c index c90380566..0daf98ac1 100644 --- a/Engine/lib/sdl/src/video/SDL_egl.c +++ b/Engine/lib/sdl/src/video/SDL_egl.c @@ -1,6 +1,6 @@ /* * Simple DirectMedia Layer - * Copyright (C) 1997-2016 Sam Lantinga + * Copyright (C) 1997-2018 Sam Lantinga * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -25,8 +25,12 @@ #if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT #include "../core/windows/SDL_windows.h" #endif +#if SDL_VIDEO_DRIVER_ANDROID +#include +#endif #include "SDL_sysvideo.h" +#include "SDL_log.h" #include "SDL_egl_c.h" #include "SDL_loadso.h" #include "SDL_hints.h" @@ -40,10 +44,12 @@ #if SDL_VIDEO_DRIVER_RPI /* Raspbian places the OpenGL ES/EGL binaries in a non standard path */ -#define DEFAULT_EGL "/opt/vc/lib/libEGL.so" -#define DEFAULT_OGL_ES2 "/opt/vc/lib/libGLESv2.so" -#define DEFAULT_OGL_ES_PVR "/opt/vc/lib/libGLES_CM.so" -#define DEFAULT_OGL_ES "/opt/vc/lib/libGLESv1_CM.so" +#define DEFAULT_EGL ( vc4 ? "libEGL.so.1" : "libbrcmEGL.so" ) +#define DEFAULT_OGL_ES2 ( vc4 ? "libGLESv2.so.2" : "libbrcmGLESv2.so" ) +#define ALT_EGL "libEGL.so" +#define ALT_OGL_ES2 "libGLESv2.so" +#define DEFAULT_OGL_ES_PVR ( vc4 ? "libGLES_CM.so.1" : "libbrcmGLESv2.so" ) +#define DEFAULT_OGL_ES ( vc4 ? "libGLESv1_CM.so.1" : "libbrcmGLESv2.so" ) #elif SDL_VIDEO_DRIVER_ANDROID || SDL_VIDEO_DRIVER_VIVANTE /* Android */ @@ -59,6 +65,13 @@ #define DEFAULT_OGL_ES_PVR "libGLES_CM.dll" #define DEFAULT_OGL_ES "libGLESv1_CM.dll" +#elif SDL_VIDEO_DRIVER_COCOA +/* EGL AND OpenGL ES support via ANGLE */ +#define DEFAULT_EGL "libEGL.dylib" +#define DEFAULT_OGL_ES2 "libGLESv2.dylib" +#define DEFAULT_OGL_ES_PVR "libGLES_CM.dylib" //??? +#define DEFAULT_OGL_ES "libGLESv1_CM.dylib" //??? + #else /* Desktop Linux */ #define DEFAULT_OGL "libGL.so.1" @@ -68,46 +81,130 @@ #define DEFAULT_OGL_ES "libGLESv1_CM.so.1" #endif /* SDL_VIDEO_DRIVER_RPI */ +#ifdef SDL_VIDEO_STATIC_ANGLE +#define LOAD_FUNC(NAME) \ +_this->egl_data->NAME = (void *)NAME; +#else #define LOAD_FUNC(NAME) \ _this->egl_data->NAME = SDL_LoadFunction(_this->egl_data->dll_handle, #NAME); \ if (!_this->egl_data->NAME) \ { \ return SDL_SetError("Could not retrieve EGL function " #NAME); \ } - -/* EGL implementation of SDL OpenGL ES support */ -#ifdef EGL_KHR_create_context -static int SDL_EGL_HasExtension(_THIS, const char *ext) +#endif + +static const char * SDL_EGL_GetErrorName(EGLint eglErrorCode) +{ +#define SDL_EGL_ERROR_TRANSLATE(e) case e: return #e; + switch (eglErrorCode) { + SDL_EGL_ERROR_TRANSLATE(EGL_SUCCESS); + SDL_EGL_ERROR_TRANSLATE(EGL_NOT_INITIALIZED); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_ACCESS); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_ALLOC); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_ATTRIBUTE); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_CONTEXT); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_CONFIG); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_CURRENT_SURFACE); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_DISPLAY); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_SURFACE); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_MATCH); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_PARAMETER); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_NATIVE_PIXMAP); + SDL_EGL_ERROR_TRANSLATE(EGL_BAD_NATIVE_WINDOW); + SDL_EGL_ERROR_TRANSLATE(EGL_CONTEXT_LOST); + } + return ""; +} + +int SDL_EGL_SetErrorEx(const char * message, const char * eglFunctionName, EGLint eglErrorCode) +{ + const char * errorText = SDL_EGL_GetErrorName(eglErrorCode); + char altErrorText[32]; + if (errorText[0] == '\0') { + /* An unknown-to-SDL error code was reported. Report its hexadecimal value, instead of its name. */ + SDL_snprintf(altErrorText, SDL_arraysize(altErrorText), "0x%x", (unsigned int)eglErrorCode); + errorText = altErrorText; + } + return SDL_SetError("%s (call to %s failed, reporting an error of %s)", message, eglFunctionName, errorText); +} + +/* EGL implementation of SDL OpenGL ES support */ +typedef enum { + SDL_EGL_DISPLAY_EXTENSION, + SDL_EGL_CLIENT_EXTENSION +} SDL_EGL_ExtensionType; + +static SDL_bool SDL_EGL_HasExtension(_THIS, SDL_EGL_ExtensionType type, const char *ext) { - int i; - int len = 0; size_t ext_len; - const char *exts; - const char *ext_word; + const char *ext_override; + const char *egl_extstr; + const char *ext_start; + + /* Invalid extensions can be rejected early */ + if (ext == NULL || *ext == 0 || SDL_strchr(ext, ' ') != NULL) { + /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "SDL_EGL_HasExtension: Invalid EGL extension"); */ + return SDL_FALSE; + } + + /* Extensions can be masked with an environment variable. + * Unlike the OpenGL override, this will use the set bits of an integer + * to disable the extension. + * Bit Action + * 0 If set, the display extension is masked and not present to SDL. + * 1 If set, the client extension is masked and not present to SDL. + */ + ext_override = SDL_getenv(ext); + if (ext_override != NULL) { + int disable_ext = SDL_atoi(ext_override); + if (disable_ext & 0x01 && type == SDL_EGL_DISPLAY_EXTENSION) { + return SDL_FALSE; + } else if (disable_ext & 0x02 && type == SDL_EGL_CLIENT_EXTENSION) { + return SDL_FALSE; + } + } ext_len = SDL_strlen(ext); - exts = _this->egl_data->eglQueryString(_this->egl_data->egl_display, EGL_EXTENSIONS); + switch (type) { + case SDL_EGL_DISPLAY_EXTENSION: + egl_extstr = _this->egl_data->eglQueryString(_this->egl_data->egl_display, EGL_EXTENSIONS); + break; + case SDL_EGL_CLIENT_EXTENSION: + /* EGL_EXT_client_extensions modifies eglQueryString to return client extensions + * if EGL_NO_DISPLAY is passed. Implementations without it are required to return NULL. + * This behavior is included in EGL 1.5. + */ + egl_extstr = _this->egl_data->eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS); + break; + default: + /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "SDL_EGL_HasExtension: Invalid extension type"); */ + return SDL_FALSE; + } - if (exts) { - ext_word = exts; + if (egl_extstr != NULL) { + ext_start = egl_extstr; - for (i = 0; exts[i] != 0; i++) { - if (exts[i] == ' ') { - if (ext_len == len && !SDL_strncmp(ext_word, ext, len)) { - return 1; + while (*ext_start) { + ext_start = SDL_strstr(ext_start, ext); + if (ext_start == NULL) { + return SDL_FALSE; + } + /* Check if the match is not just a substring of one of the extensions */ + if (ext_start == egl_extstr || *(ext_start - 1) == ' ') { + if (ext_start[ext_len] == ' ' || ext_start[ext_len] == 0) { + return SDL_TRUE; } - - len = 0; - ext_word = &exts[i + 1]; - } else { - len++; + } + /* If the search stopped in the middle of an extension, skip to the end of it */ + ext_start += ext_len; + while (*ext_start != ' ' && *ext_start != 0) { + ext_start++; } } } - return 0; + return SDL_FALSE; } -#endif /* EGL_KHR_create_context */ void * SDL_EGL_GetProcAddress(_THIS, const char *proc) @@ -116,7 +213,7 @@ SDL_EGL_GetProcAddress(_THIS, const char *proc) void *retval; /* eglGetProcAddress is busted on Android http://code.google.com/p/android/issues/detail?id=7681 */ -#if !defined(SDL_VIDEO_DRIVER_ANDROID) && !defined(SDL_VIDEO_DRIVER_MIR) +#if !defined(SDL_VIDEO_DRIVER_ANDROID) if (_this->egl_data->eglGetProcAddress) { retval = _this->egl_data->eglGetProcAddress(proc); if (retval) { @@ -158,16 +255,20 @@ SDL_EGL_UnloadLibrary(_THIS) } int -SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_display) +SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_display, EGLenum platform) { void *dll_handle = NULL, *egl_dll_handle = NULL; /* The naming is counter intuitive, but hey, I just work here -- Gabriel */ const char *path = NULL; + int egl_version_major = 0, egl_version_minor = 0; #if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT const char *d3dcompiler; #endif +#if SDL_VIDEO_DRIVER_RPI + SDL_bool vc4 = (0 == access("/sys/module/vc4/", F_OK)); +#endif if (_this->egl_data) { - return SDL_SetError("OpenGL ES context already created"); + return SDL_SetError("EGL context already created"); } _this->egl_data = (struct SDL_EGL_VideoData *) SDL_calloc(1, sizeof(SDL_EGL_VideoData)); @@ -185,10 +286,13 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa } } if (SDL_strcasecmp(d3dcompiler, "none") != 0) { - SDL_LoadObject(d3dcompiler); + if (SDL_LoadObject(d3dcompiler) == NULL) { + SDL_ClearError(); + } } #endif +#ifndef SDL_VIDEO_STATIC_ANGLE /* A funny thing, loading EGL.so first does not work on the Raspberry, so we load libGL* first */ path = SDL_getenv("SDL_VIDEO_GL_DRIVER"); if (path != NULL) { @@ -200,6 +304,13 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa if (_this->gl_config.major_version > 1) { path = DEFAULT_OGL_ES2; egl_dll_handle = SDL_LoadObject(path); +#ifdef ALT_OGL_ES2 + if (egl_dll_handle == NULL && !vc4) { + path = ALT_OGL_ES2; + egl_dll_handle = SDL_LoadObject(path); + } +#endif + } else { path = DEFAULT_OGL_ES; egl_dll_handle = SDL_LoadObject(path); @@ -207,6 +318,12 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa path = DEFAULT_OGL_ES_PVR; egl_dll_handle = SDL_LoadObject(path); } +#ifdef ALT_OGL_ES2 + if (egl_dll_handle == NULL && !vc4) { + path = ALT_OGL_ES2; + egl_dll_handle = SDL_LoadObject(path); + } +#endif } } #ifdef DEFAULT_OGL @@ -236,6 +353,14 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa path = DEFAULT_EGL; } dll_handle = SDL_LoadObject(path); + +#ifdef ALT_EGL + if (dll_handle == NULL && !vc4) { + path = ALT_EGL; + dll_handle = SDL_LoadObject(path); + } +#endif + if (dll_handle == NULL || SDL_LoadFunction(dll_handle, "eglChooseConfig") == NULL) { if (dll_handle != NULL) { SDL_UnloadObject(dll_handle); @@ -244,6 +369,7 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa } SDL_ClearError(); } +#endif _this->egl_data->dll_handle = dll_handle; @@ -256,6 +382,7 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa LOAD_FUNC(eglGetConfigAttrib); LOAD_FUNC(eglCreateContext); LOAD_FUNC(eglDestroyContext); + LOAD_FUNC(eglCreatePbufferSurface); LOAD_FUNC(eglCreateWindowSurface); LOAD_FUNC(eglDestroySurface); LOAD_FUNC(eglMakeCurrent); @@ -265,10 +392,43 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa LOAD_FUNC(eglWaitGL); LOAD_FUNC(eglBindAPI); LOAD_FUNC(eglQueryString); - + LOAD_FUNC(eglGetError); + + if (_this->egl_data->eglQueryString) { + /* EGL 1.5 allows querying for client version */ + const char *egl_version = _this->egl_data->eglQueryString(EGL_NO_DISPLAY, EGL_VERSION); + if (egl_version != NULL) { + if (SDL_sscanf(egl_version, "%d.%d", &egl_version_major, &egl_version_minor) != 2) { + egl_version_major = 0; + egl_version_minor = 0; + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not parse EGL version string: %s", egl_version); + } + } + } + + if (egl_version_major == 1 && egl_version_minor == 5) { + LOAD_FUNC(eglGetPlatformDisplay); + } + + _this->egl_data->egl_display = EGL_NO_DISPLAY; #if !defined(__WINRT__) - _this->egl_data->egl_display = _this->egl_data->eglGetDisplay(native_display); - if (!_this->egl_data->egl_display) { + if (platform) { + if (egl_version_major == 1 && egl_version_minor == 5) { + _this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplay(platform, (void *)(size_t)native_display, NULL); + } else { + if (SDL_EGL_HasExtension(_this, SDL_EGL_CLIENT_EXTENSION, "EGL_EXT_platform_base")) { + _this->egl_data->eglGetPlatformDisplayEXT = SDL_EGL_GetProcAddress(_this, "eglGetPlatformDisplayEXT"); + if (_this->egl_data->eglGetPlatformDisplayEXT) { + _this->egl_data->egl_display = _this->egl_data->eglGetPlatformDisplayEXT(platform, (void *)(size_t)native_display, NULL); + } + } + } + } + /* Try the implementation-specific eglGetDisplay even if eglGetPlatformDisplay fails */ + if (_this->egl_data->egl_display == EGL_NO_DISPLAY) { + _this->egl_data->egl_display = _this->egl_data->eglGetDisplay(native_display); + } + if (_this->egl_data->egl_display == EGL_NO_DISPLAY) { return SDL_SetError("Could not get EGL display"); } @@ -277,8 +437,6 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa } #endif - _this->gl_config.driver_loaded = 1; - if (path) { SDL_strlcpy(_this->gl_config.driver_path, path, sizeof(_this->gl_config.driver_path) - 1); } else { @@ -291,13 +449,19 @@ SDL_EGL_LoadLibrary(_THIS, const char *egl_path, NativeDisplayType native_displa int SDL_EGL_ChooseConfig(_THIS) { - /* 64 seems nice. */ +/* 64 seems nice. */ EGLint attribs[64]; EGLint found_configs = 0, value; +#ifdef SDL_VIDEO_DRIVER_KMSDRM + /* Intel EGL on KMS/DRM (al least) returns invalid configs that confuse the bitdiff search used */ + /* later in this function, so we simply use the first one when using the KMSDRM driver for now. */ + EGLConfig configs[1]; +#else /* 128 seems even nicer here */ EGLConfig configs[128]; +#endif int i, j, best_bitdiff = -1, bitdiff; - + if (!_this->egl_data) { /* The EGL library wasn't loaded, SDL_GetError() should have info */ return -1; @@ -340,23 +504,11 @@ SDL_EGL_ChooseConfig(_THIS) attribs[i++] = _this->gl_config.multisamplesamples; } - if (_this->gl_config.framebuffer_srgb_capable) { -#ifdef EGL_KHR_gl_colorspace - if (SDL_EGL_HasExtension(_this, "EGL_KHR_gl_colorspace")) { - attribs[i++] = EGL_GL_COLORSPACE_KHR; - attribs[i++] = EGL_GL_COLORSPACE_SRGB_KHR; - } else -#endif - { - return SDL_SetError("EGL implementation does not support sRGB system framebuffers"); - } - } - attribs[i++] = EGL_RENDERABLE_TYPE; if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { #ifdef EGL_KHR_create_context if (_this->gl_config.major_version >= 3 && - SDL_EGL_HasExtension(_this, "EGL_KHR_create_context")) { + SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_create_context")) { attribs[i++] = EGL_OPENGL_ES3_BIT_KHR; } else #endif @@ -371,6 +523,11 @@ SDL_EGL_ChooseConfig(_THIS) _this->egl_data->eglBindAPI(EGL_OPENGL_API); } + if (_this->egl_data->egl_surfacetype) { + attribs[i++] = EGL_SURFACE_TYPE; + attribs[i++] = _this->egl_data->egl_surfacetype; + } + attribs[i++] = EGL_NONE; if (_this->egl_data->eglChooseConfig(_this->egl_data->egl_display, @@ -378,7 +535,7 @@ SDL_EGL_ChooseConfig(_THIS) configs, SDL_arraysize(configs), &found_configs) == EGL_FALSE || found_configs == 0) { - return SDL_SetError("Couldn't find matching EGL config"); + return SDL_EGL_SetError("Couldn't find matching EGL config", "eglChooseConfig"); } /* eglChooseConfig returns a number of configurations that match or exceed the requested attribs. */ @@ -458,7 +615,7 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) /* The Major/minor version, context profiles, and context flags can * only be specified when this extension is available. */ - if (SDL_EGL_HasExtension(_this, "EGL_KHR_create_context")) { + if (SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_create_context")) { attribs[attr++] = EGL_CONTEXT_MAJOR_VERSION_KHR; attribs[attr++] = major_version; attribs[attr++] = EGL_CONTEXT_MINOR_VERSION_KHR; @@ -483,6 +640,19 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) } } + if (_this->gl_config.no_error) { +#ifdef EGL_KHR_create_context_no_error + if (SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_create_context_no_error")) { + attribs[attr++] = EGL_CONTEXT_OPENGL_NO_ERROR_KHR; + attribs[attr++] = _this->gl_config.no_error; + } else +#endif + { + SDL_SetError("EGL implementation does not support no_error contexts"); + return NULL; + } + } + attribs[attr++] = EGL_NONE; /* Bind the API */ @@ -497,15 +667,23 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface) share_context, attribs); if (egl_context == EGL_NO_CONTEXT) { - SDL_SetError("Could not create EGL context"); + SDL_EGL_SetError("Could not create EGL context", "eglCreateContext"); return NULL; } _this->egl_data->egl_swapinterval = 0; if (SDL_EGL_MakeCurrent(_this, egl_surface, egl_context) < 0) { + /* Save the SDL error set by SDL_EGL_MakeCurrent */ + char errorText[1024]; + SDL_strlcpy(errorText, SDL_GetError(), SDL_arraysize(errorText)); + + /* Delete the context, which may alter the value returned by SDL_GetError() */ SDL_EGL_DeleteContext(_this, egl_context); - SDL_SetError("Could not make EGL context current"); + + /* Restore the SDL error */ + SDL_SetError("%s", errorText); + return NULL; } @@ -529,7 +707,7 @@ SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context) } else { if (!_this->egl_data->eglMakeCurrent(_this->egl_data->egl_display, egl_surface, egl_surface, egl_context)) { - return SDL_SetError("Unable to make EGL context current"); + return SDL_EGL_SetError("Unable to make EGL context current", "eglMakeCurrent"); } } @@ -551,7 +729,7 @@ SDL_EGL_SetSwapInterval(_THIS, int interval) return 0; } - return SDL_SetError("Unable to set the EGL swap interval"); + return SDL_EGL_SetError("Unable to set the EGL swap interval", "eglSwapInterval"); } int @@ -565,10 +743,13 @@ SDL_EGL_GetSwapInterval(_THIS) return _this->egl_data->egl_swapinterval; } -void +int SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface) { - _this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, egl_surface); + if (!_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, egl_surface)) { + return SDL_EGL_SetError("unable to show color buffer in an OS-native window", "eglSwapBuffers"); + } + return 0; } void @@ -591,11 +772,17 @@ SDL_EGL_DeleteContext(_THIS, SDL_GLContext context) EGLSurface * SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) { + /* max 2 values plus terminator. */ + EGLint attribs[3]; + int attr = 0; + + EGLSurface * surface; + if (SDL_EGL_ChooseConfig(_this) != 0) { return EGL_NO_SURFACE; } -#if __ANDROID__ +#if SDL_VIDEO_DRIVER_ANDROID { /* Android docs recommend doing this! * Ref: http://developer.android.com/reference/android/app/NativeActivity.html @@ -608,11 +795,29 @@ SDL_EGL_CreateSurface(_THIS, NativeWindowType nw) ANativeWindow_setBuffersGeometry(nw, 0, 0, format); } #endif + if (_this->gl_config.framebuffer_srgb_capable) { +#ifdef EGL_KHR_gl_colorspace + if (SDL_EGL_HasExtension(_this, SDL_EGL_DISPLAY_EXTENSION, "EGL_KHR_gl_colorspace")) { + attribs[attr++] = EGL_GL_COLORSPACE_KHR; + attribs[attr++] = EGL_GL_COLORSPACE_SRGB_KHR; + } else +#endif + { + SDL_SetError("EGL implementation does not support sRGB system framebuffers"); + return EGL_NO_SURFACE; + } + } + + attribs[attr++] = EGL_NONE; - return _this->egl_data->eglCreateWindowSurface( + surface = _this->egl_data->eglCreateWindowSurface( _this->egl_data->egl_display, _this->egl_data->egl_config, - nw, NULL); + nw, &attribs[0]); + if (surface == EGL_NO_SURFACE) { + SDL_EGL_SetError("unable to create an EGL window surface", "eglCreateWindowSurface"); + } + return surface; } void @@ -630,4 +835,4 @@ SDL_EGL_DestroySurface(_THIS, EGLSurface egl_surface) #endif /* SDL_VIDEO_OPENGL_EGL */ /* vi: set ts=4 sw=4 expandtab: */ - + diff --git a/Engine/lib/sdl/src/video/SDL_egl_c.h b/Engine/lib/sdl/src/video/SDL_egl_c.h index c683dffa7..80b13192e 100644 --- a/Engine/lib/sdl/src/video/SDL_egl_c.h +++ b/Engine/lib/sdl/src/video/SDL_egl_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_egl_h -#define _SDL_egl_h +#ifndef SDL_egl_h_ +#define SDL_egl_h_ #if SDL_VIDEO_OPENGL_EGL @@ -35,8 +35,15 @@ typedef struct SDL_EGL_VideoData EGLDisplay egl_display; EGLConfig egl_config; int egl_swapinterval; + int egl_surfacetype; EGLDisplay(EGLAPIENTRY *eglGetDisplay) (NativeDisplayType display); + EGLDisplay(EGLAPIENTRY *eglGetPlatformDisplay) (EGLenum platform, + void *native_display, + const EGLint *attrib_list); + EGLDisplay(EGLAPIENTRY *eglGetPlatformDisplayEXT) (EGLenum platform, + void *native_display, + const EGLint *attrib_list); EGLBoolean(EGLAPIENTRY *eglInitialize) (EGLDisplay dpy, EGLint * major, EGLint * minor); EGLBoolean(EGLAPIENTRY *eglTerminate) (EGLDisplay dpy); @@ -55,6 +62,9 @@ typedef struct SDL_EGL_VideoData EGLBoolean(EGLAPIENTRY *eglDestroyContext) (EGLDisplay dpy, EGLContext ctx); + EGLSurface(EGLAPIENTRY *eglCreatePbufferSurface)(EGLDisplay dpy, EGLConfig config, + EGLint const* attrib_list); + EGLSurface(EGLAPIENTRY *eglCreateWindowSurface) (EGLDisplay dpy, EGLConfig config, NativeWindowType window, @@ -79,11 +89,16 @@ typedef struct SDL_EGL_VideoData EGLBoolean(EGLAPIENTRY *eglBindAPI)(EGLenum); + EGLint(EGLAPIENTRY *eglGetError)(void); + } SDL_EGL_VideoData; /* OpenGLES functions */ extern int SDL_EGL_GetAttribute(_THIS, SDL_GLattr attrib, int *value); -extern int SDL_EGL_LoadLibrary(_THIS, const char *path, NativeDisplayType native_display); +/* SDL_EGL_LoadLibrary can get a display for a specific platform (EGL_PLATFORM_*) + * or, if 0 is passed, let the implementation decide. + */ +extern int SDL_EGL_LoadLibrary(_THIS, const char *path, NativeDisplayType native_display, EGLenum platform); extern void *SDL_EGL_GetProcAddress(_THIS, const char *proc); extern void SDL_EGL_UnloadLibrary(_THIS); extern int SDL_EGL_ChooseConfig(_THIS); @@ -96,14 +111,18 @@ extern void SDL_EGL_DestroySurface(_THIS, EGLSurface egl_surface); /* These need to be wrapped to get the surface for the window by the platform GLES implementation */ extern SDL_GLContext SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface); extern int SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context); -extern void SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface); +extern int SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface); + +/* SDL Error-reporting */ +extern int SDL_EGL_SetErrorEx(const char * message, const char * eglFunctionName, EGLint eglErrorCode); +#define SDL_EGL_SetError(message, eglFunctionName) SDL_EGL_SetErrorEx(message, eglFunctionName, _this->egl_data->eglGetError()) /* A few of useful macros */ -#define SDL_EGL_SwapWindow_impl(BACKEND) void \ +#define SDL_EGL_SwapWindow_impl(BACKEND) int \ BACKEND ## _GLES_SwapWindow(_THIS, SDL_Window * window) \ {\ - SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);\ + return SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);\ } #define SDL_EGL_MakeCurrent_impl(BACKEND) int \ @@ -125,6 +144,6 @@ BACKEND ## _GLES_CreateContext(_THIS, SDL_Window * window) \ #endif /* SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_egl_h */ +#endif /* SDL_egl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/SDL_fillrect.c b/Engine/lib/sdl/src/video/SDL_fillrect.c index e34a43c44..63f5fcb30 100644 --- a/Engine/lib/sdl/src/video/SDL_fillrect.c +++ b/Engine/lib/sdl/src/video/SDL_fillrect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -144,13 +144,13 @@ SDL_FillRect1(Uint8 * pixels, int pitch, Uint32 color, int w, int h) switch ((uintptr_t) p & 3) { case 1: *p++ = (Uint8) color; - --n; + --n; /* fallthrough */ case 2: *p++ = (Uint8) color; - --n; + --n; /* fallthrough */ case 3: *p++ = (Uint8) color; - --n; + --n; /* fallthrough */ } SDL_memset4(p, color, (n >> 2)); } @@ -158,11 +158,11 @@ SDL_FillRect1(Uint8 * pixels, int pitch, Uint32 color, int w, int h) p += (n & ~3); switch (n & 3) { case 3: - *p++ = (Uint8) color; + *p++ = (Uint8) color; /* fallthrough */ case 2: - *p++ = (Uint8) color; + *p++ = (Uint8) color; /* fallthrough */ case 1: - *p++ = (Uint8) color; + *p++ = (Uint8) color; /* fallthrough */ } } pixels += pitch; diff --git a/Engine/lib/sdl/src/video/SDL_pixels.c b/Engine/lib/sdl/src/video/SDL_pixels.c index d905656ca..2e263955c 100644 --- a/Engine/lib/sdl/src/video/SDL_pixels.c +++ b/Engine/lib/sdl/src/video/SDL_pixels.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -326,7 +326,7 @@ SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, if (Rmask == 0) { return SDL_PIXELFORMAT_RGB555; } - /* Fall through to 16-bit checks */ + /* fallthrough */ case 16: if (Rmask == 0) { return SDL_PIXELFORMAT_RGB565; @@ -403,6 +403,13 @@ SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Amask == 0x0000) { return SDL_PIXELFORMAT_BGR565; } + if (Rmask == 0x003F && + Gmask == 0x07C0 && + Bmask == 0xF800 && + Amask == 0x0000) { + /* Technically this would be BGR556, but Witek says this works in bug 3158 */ + return SDL_PIXELFORMAT_RGB565; + } break; case 24: switch (Rmask) { @@ -483,16 +490,20 @@ SDL_MasksToPixelFormatEnum(int bpp, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, } static SDL_PixelFormat *formats; +static SDL_SpinLock formats_lock = 0; SDL_PixelFormat * SDL_AllocFormat(Uint32 pixel_format) { SDL_PixelFormat *format; + SDL_AtomicLock(&formats_lock); + /* Look it up in our list of previously allocated formats */ for (format = formats; format; format = format->next) { if (pixel_format == format->format) { ++format->refcount; + SDL_AtomicUnlock(&formats_lock); return format; } } @@ -500,10 +511,12 @@ SDL_AllocFormat(Uint32 pixel_format) /* Allocate an empty pixel format structure, and initialize it */ format = SDL_malloc(sizeof(*format)); if (format == NULL) { + SDL_AtomicUnlock(&formats_lock); SDL_OutOfMemory(); return NULL; } if (SDL_InitFormat(format, pixel_format) < 0) { + SDL_AtomicUnlock(&formats_lock); SDL_free(format); SDL_InvalidParamError("format"); return NULL; @@ -514,6 +527,9 @@ SDL_AllocFormat(Uint32 pixel_format) format->next = formats; formats = format; } + + SDL_AtomicUnlock(&formats_lock); + return format; } @@ -591,7 +607,11 @@ SDL_FreeFormat(SDL_PixelFormat *format) SDL_InvalidParamError("format"); return; } + + SDL_AtomicLock(&formats_lock); + if (--format->refcount > 0) { + SDL_AtomicUnlock(&formats_lock); return; } @@ -607,6 +627,8 @@ SDL_FreeFormat(SDL_PixelFormat *format) } } + SDL_AtomicUnlock(&formats_lock); + if (format->palette) { SDL_FreePalette(format->palette); } @@ -651,7 +673,7 @@ SDL_SetPixelFormatPalette(SDL_PixelFormat * format, SDL_Palette *palette) return SDL_SetError("SDL_SetPixelFormatPalette() passed NULL format"); } - if (palette && palette->ncolors != (1 << format->BitsPerPixel)) { + if (palette && palette->ncolors > (1 << format->BitsPerPixel)) { return SDL_SetError("SDL_SetPixelFormatPalette() passed a palette that doesn't match the format"); } @@ -741,30 +763,6 @@ SDL_DitherColors(SDL_Color * colors, int bpp) } } -/* - * Calculate the pad-aligned scanline width of a surface - */ -int -SDL_CalculatePitch(SDL_Surface * surface) -{ - int pitch; - - /* Surface should be 4-byte aligned for speed */ - pitch = surface->w * surface->format->BytesPerPixel; - switch (surface->format->BitsPerPixel) { - case 1: - pitch = (pitch + 7) / 8; - break; - case 4: - pitch = (pitch + 1) / 2; - break; - default: - break; - } - pitch = (pitch + 3) & ~3; /* 4-byte aligning */ - return (pitch); -} - /* * Match an RGB value to a particular palette index */ diff --git a/Engine/lib/sdl/src/video/SDL_pixels_c.h b/Engine/lib/sdl/src/video/SDL_pixels_c.h index 4ee91b8a3..900f0b080 100644 --- a/Engine/lib/sdl/src/video/SDL_pixels_c.h +++ b/Engine/lib/sdl/src/video/SDL_pixels_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,7 +34,6 @@ extern int SDL_MapSurface(SDL_Surface * src, SDL_Surface * dst); extern void SDL_FreeBlitMap(SDL_BlitMap * map); /* Miscellaneous functions */ -extern int SDL_CalculatePitch(SDL_Surface * surface); extern void SDL_DitherColors(SDL_Color * colors, int bpp); extern Uint8 SDL_FindColor(SDL_Palette * pal, Uint8 r, Uint8 g, Uint8 b, Uint8 a); diff --git a/Engine/lib/sdl/src/video/SDL_rect.c b/Engine/lib/sdl/src/video/SDL_rect.c index 2b29451c7..8c6ff2da7 100644 --- a/Engine/lib/sdl/src/video/SDL_rect.c +++ b/Engine/lib/sdl/src/video/SDL_rect.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #include "SDL_rect.h" #include "SDL_rect_c.h" - +#include "SDL_assert.h" SDL_bool SDL_HasIntersection(const SDL_Rect * A, const SDL_Rect * B) @@ -441,9 +441,15 @@ SDL_IntersectRectAndLine(const SDL_Rect * rect, int *X1, int *Y1, int *X2, y = recty2; x = x1 + ((x2 - x1) * (y - y1)) / (y2 - y1); } else if (outcode2 & CODE_LEFT) { + /* If this assertion ever fires, here's the static analysis that warned about it: + http://buildbot.libsdl.org/sdl-static-analysis/sdl-macosx-static-analysis/sdl-macosx-static-analysis-1101/report-b0d01a.html#EndPath */ + SDL_assert(x2 != x1); /* if equal: division by zero. */ x = rectx1; y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); } else if (outcode2 & CODE_RIGHT) { + /* If this assertion ever fires, here's the static analysis that warned about it: + http://buildbot.libsdl.org/sdl-static-analysis/sdl-macosx-static-analysis/sdl-macosx-static-analysis-1101/report-39b114.html#EndPath */ + SDL_assert(x2 != x1); /* if equal: division by zero. */ x = rectx2; y = y1 + ((y2 - y1) * (x - x1)) / (x2 - x1); } diff --git a/Engine/lib/sdl/src/video/SDL_rect_c.h b/Engine/lib/sdl/src/video/SDL_rect_c.h index aa5fbde79..d67e49348 100644 --- a/Engine/lib/sdl/src/video/SDL_rect_c.h +++ b/Engine/lib/sdl/src/video/SDL_rect_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/SDL_shape.c b/Engine/lib/sdl/src/video/SDL_shape.c index 4a2e5465b..6f029bceb 100644 --- a/Engine/lib/sdl/src/video/SDL_shape.c +++ b/Engine/lib/sdl/src/video/SDL_shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,6 +35,10 @@ SDL_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned SDL_Window *result = NULL; result = SDL_CreateWindow(title,-1000,-1000,w,h,(flags | SDL_WINDOW_BORDERLESS) & (~SDL_WINDOW_FULLSCREEN) & (~SDL_WINDOW_RESIZABLE) /* & (~SDL_WINDOW_SHOWN) */); if(result != NULL) { + if (SDL_GetVideoDevice()->shape_driver.CreateShaper == NULL) { + SDL_DestroyWindow(result); + return NULL; + } result->shaper = SDL_GetVideoDevice()->shape_driver.CreateShaper(result); if(result->shaper != NULL) { result->shaper->userx = x; @@ -70,11 +74,14 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm int y = 0; Uint8 r = 0,g = 0,b = 0,alpha = 0; Uint8* pixel = NULL; - Uint32 bitmap_pixel,pixel_value = 0,mask_value = 0; + Uint32 pixel_value = 0,mask_value = 0; + int bytes_per_scanline = (shape->w + (ppb - 1)) / ppb; + Uint8 *bitmap_scanline; SDL_Color key; if(SDL_MUSTLOCK(shape)) SDL_LockSurface(shape); for(y = 0;yh;y++) { + bitmap_scanline = bitmap + y * bytes_per_scanline; for(x=0;xw;x++) { alpha = 0; pixel_value = 0; @@ -94,7 +101,6 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm break; } SDL_GetRGBA(pixel_value,shape->format,&r,&g,&b,&alpha); - bitmap_pixel = y*shape->w + x; switch(mode.mode) { case(ShapeModeDefault): mask_value = (alpha >= 1 ? 1 : 0); @@ -110,7 +116,7 @@ SDL_CalculateShapeBitmap(SDL_WindowShapeMode mode,SDL_Surface *shape,Uint8* bitm mask_value = ((key.r != r || key.g != g || key.b != b) ? 1 : 0); break; } - bitmap[bitmap_pixel / ppb] |= mask_value << (7 - ((ppb - 1) - (bitmap_pixel % ppb))); + bitmap_scanline[x / ppb] |= mask_value << (x % ppb); } } if(SDL_MUSTLOCK(shape)) @@ -206,8 +212,14 @@ RecursivelyCalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* mask,SDL_Rec SDL_ShapeTree* SDL_CalculateShapeTree(SDL_WindowShapeMode mode,SDL_Surface* shape) { - SDL_Rect dimensions = {0,0,shape->w,shape->h}; + SDL_Rect dimensions; SDL_ShapeTree* result = NULL; + + dimensions.x = 0; + dimensions.y = 0; + dimensions.w = shape->w; + dimensions.h = shape->h; + if(SDL_MUSTLOCK(shape)) SDL_LockSurface(shape); result = RecursivelyCalculateShapeTree(mode,shape,dimensions); @@ -234,10 +246,10 @@ void SDL_FreeShapeTree(SDL_ShapeTree** shape_tree) { if((*shape_tree)->kind == QuadShape) { - SDL_FreeShapeTree((SDL_ShapeTree **)&(*shape_tree)->data.children.upleft); - SDL_FreeShapeTree((SDL_ShapeTree **)&(*shape_tree)->data.children.upright); - SDL_FreeShapeTree((SDL_ShapeTree **)&(*shape_tree)->data.children.downleft); - SDL_FreeShapeTree((SDL_ShapeTree **)&(*shape_tree)->data.children.downright); + SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.upleft); + SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.upright); + SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.downleft); + SDL_FreeShapeTree((SDL_ShapeTree **)(char*)&(*shape_tree)->data.children.downright); } SDL_free(*shape_tree); *shape_tree = NULL; diff --git a/Engine/lib/sdl/src/video/SDL_shape_internals.h b/Engine/lib/sdl/src/video/SDL_shape_internals.h index bdb0ee91b..3af175cdf 100644 --- a/Engine/lib/sdl/src/video/SDL_shape_internals.h +++ b/Engine/lib/sdl/src/video/SDL_shape_internals.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_shape_internals_h -#define _SDL_shape_internals_h +#ifndef SDL_shape_internals_h_ +#define SDL_shape_internals_h_ #include "SDL_rect.h" #include "SDL_shape.h" diff --git a/Engine/lib/sdl/src/video/SDL_stretch.c b/Engine/lib/sdl/src/video/SDL_stretch.c index bb34dffb7..8cc6bf30b 100644 --- a/Engine/lib/sdl/src/video/SDL_stretch.c +++ b/Engine/lib/sdl/src/video/SDL_stretch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,8 +33,8 @@ into the general blitting mechanism. */ -#if ((defined(_MFC_VER) && defined(_M_IX86)) || \ - defined(__WATCOMC__) || \ +#if ((defined(_MSC_VER) && defined(_M_IX86)) || \ + (defined(__WATCOMC__) && defined(__386__)) || \ (defined(__GNUC__) && defined(__i386__))) && SDL_ASSEMBLY_ROUTINES /* There's a bug with gcc 4.4.1 and -O2 where srcp doesn't get the correct * value after the first scanline. FIXME? */ @@ -53,7 +53,7 @@ #define PAGE_ALIGNED #endif -#if defined(_M_IX86) || defined(i386) +#if defined(_M_IX86) || defined(__i386__) || defined(__386__) #define PREFIX16 0x66 #define STORE_BYTE 0xAA #define STORE_WORD 0xAB @@ -102,7 +102,7 @@ generate_rowbytes(int src_w, int dst_w, int bpp) store = STORE_WORD; break; default: - return SDL_SetError("ASM stretch of %d bytes isn't supported\n", bpp); + return SDL_SetError("ASM stretch of %d bytes isn't supported", bpp); } #ifdef HAVE_MPROTECT /* Make the code writeable */ diff --git a/Engine/lib/sdl/src/video/SDL_surface.c b/Engine/lib/sdl/src/video/SDL_surface.c index 9d52e5ca4..719f831e8 100644 --- a/Engine/lib/sdl/src/video/SDL_surface.c +++ b/Engine/lib/sdl/src/video/SDL_surface.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,9 +25,39 @@ #include "SDL_blit.h" #include "SDL_RLEaccel_c.h" #include "SDL_pixels_c.h" +#include "SDL_yuv_c.h" + + +/* Check to make sure we can safely check multiplication of surface w and pitch and it won't overflow size_t */ +SDL_COMPILE_TIME_ASSERT(surface_size_assumptions, + sizeof(int) == sizeof(Sint32) && sizeof(size_t) >= sizeof(Sint32)); /* Public routines */ +/* + * Calculate the pad-aligned scanline width of a surface + */ +int +SDL_CalculatePitch(Uint32 format, int width) +{ + int pitch; + + /* Surface should be 4-byte aligned for speed */ + pitch = width * SDL_BYTESPERPIXEL(format); + switch (SDL_BITSPERPIXEL(format)) { + case 1: + pitch = (pitch + 7) / 8; + break; + case 4: + pitch = (pitch + 1) / 2; + break; + default: + break; + } + pitch = (pitch + 3) & ~3; /* 4-byte aligning */ + return pitch; +} + /* * Create an empty RGB surface of the appropriate depth using the given * enum SDL_PIXELFORMAT_* format @@ -55,7 +85,7 @@ SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, } surface->w = width; surface->h = height; - surface->pitch = SDL_CalculatePitch(surface); + surface->pitch = SDL_CalculatePitch(format, width); SDL_SetClipRect(surface, NULL); if (SDL_ISPIXELFORMAT_INDEXED(surface->format->format)) { @@ -80,7 +110,16 @@ SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth, /* Get the pixels */ if (surface->w && surface->h) { - surface->pixels = SDL_malloc(surface->h * surface->pitch); + /* Assumptions checked in surface_size_assumptions assert above */ + Sint64 size = ((Sint64)surface->h * surface->pitch); + if (size < 0 || size > SDL_MAX_SINT32) { + /* Overflow... */ + SDL_FreeSurface(surface); + SDL_OutOfMemory(); + return NULL; + } + + surface->pixels = SDL_malloc((size_t)size); if (!surface->pixels) { SDL_FreeSurface(surface); SDL_OutOfMemory(); @@ -257,11 +296,11 @@ int SDL_GetColorKey(SDL_Surface * surface, Uint32 * key) { if (!surface) { - return -1; + return SDL_InvalidParamError("surface"); } if (!(surface->map->info.flags & SDL_COPY_COLORKEY)) { - return -1; + return SDL_SetError("Surface doesn't have a colorkey"); } if (key) { @@ -778,8 +817,8 @@ SDL_UpperBlitScaled(SDL_Surface * src, const SDL_Rect * srcrect, final_src.x = (int)SDL_floor(src_x0 + 0.5); final_src.y = (int)SDL_floor(src_y0 + 0.5); - final_src.w = (int)SDL_floor(src_x1 - src_x0 + 1.5); - final_src.h = (int)SDL_floor(src_y1 - src_y0 + 1.5); + final_src.w = (int)SDL_floor(src_x1 + 1 + 0.5) - (int)SDL_floor(src_x0 + 0.5); + final_src.h = (int)SDL_floor(src_y1 + 1 + 0.5) - (int)SDL_floor(src_y0 + 0.5); final_dst.x = (int)SDL_floor(dst_x0 + 0.5); final_dst.y = (int)SDL_floor(dst_y0 + 0.5); @@ -870,6 +909,15 @@ SDL_UnlockSurface(SDL_Surface * surface) } } +/* + * Creates a new surface identical to the existing surface + */ +SDL_Surface * +SDL_DuplicateSurface(SDL_Surface * surface) +{ + return SDL_ConvertSurface(surface, surface->format, surface->flags); +} + /* * Convert a surface into the specified pixel format. */ @@ -882,6 +930,15 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format, SDL_Color copy_color; SDL_Rect bounds; + if (!surface) { + SDL_InvalidParamError("surface"); + return NULL; + } + if (!format) { + SDL_InvalidParamError("format"); + return NULL; + } + /* Check for empty destination palette! (results in empty image) */ if (format->palette != NULL) { int i; @@ -970,13 +1027,37 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format, } if (set_colorkey_by_color) { - /* Set the colorkey by color, which needs to be unique */ - Uint8 keyR, keyG, keyB, keyA; + SDL_Surface *tmp; + SDL_Surface *tmp2; + int converted_colorkey = 0; + + /* Create a dummy surface to get the colorkey converted */ + tmp = SDL_CreateRGBSurface(0, 1, 1, + surface->format->BitsPerPixel, surface->format->Rmask, + surface->format->Gmask, surface->format->Bmask, + surface->format->Amask); + + /* Share the palette, if any */ + if (surface->format->palette) { + SDL_SetSurfacePalette(tmp, surface->format->palette); + } + + SDL_FillRect(tmp, NULL, surface->map->info.colorkey); + + tmp->map->info.flags &= ~SDL_COPY_COLORKEY; + + /* Convertion of the colorkey */ + tmp2 = SDL_ConvertSurface(tmp, format, 0); + + /* Get the converted colorkey */ + SDL_memcpy(&converted_colorkey, tmp2->pixels, tmp2->format->BytesPerPixel); + + SDL_FreeSurface(tmp); + SDL_FreeSurface(tmp2); + + /* Set the converted colorkey on the new surface */ + SDL_SetColorKey(convert, 1, converted_colorkey); - SDL_GetRGBA(surface->map->info.colorkey, surface->format, &keyR, - &keyG, &keyB, &keyA); - SDL_SetColorKey(convert, 1, - SDL_MapRGBA(convert->format, keyR, keyG, keyB, keyA)); /* This is needed when converting for 3D texture upload */ SDL_ConvertColorkeyToAlpha(convert); } @@ -986,7 +1067,7 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format, /* Enable alpha blending by default if the new surface has an * alpha channel or alpha modulation */ if ((surface->format->Amask && format->Amask) || - (copy_flags & (SDL_COPY_COLORKEY|SDL_COPY_MODULATE_ALPHA))) { + (copy_flags & SDL_COPY_MODULATE_ALPHA)) { SDL_SetSurfaceBlendMode(convert, SDL_BLENDMODE_BLEND); } if ((copy_flags & SDL_COPY_RLE_DESIRED) || (flags & SDL_RLEACCEL)) { @@ -1072,57 +1153,24 @@ int SDL_ConvertPixels(int width, int height, return SDL_InvalidParamError("dst_pitch"); } + if (SDL_ISPIXELFORMAT_FOURCC(src_format) && SDL_ISPIXELFORMAT_FOURCC(dst_format)) { + return SDL_ConvertPixels_YUV_to_YUV(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } else if (SDL_ISPIXELFORMAT_FOURCC(src_format)) { + return SDL_ConvertPixels_YUV_to_RGB(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } else if (SDL_ISPIXELFORMAT_FOURCC(dst_format)) { + return SDL_ConvertPixels_RGB_to_YUV(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } + /* Fast path for same format copy */ if (src_format == dst_format) { - int bpp, i; - - if (SDL_ISPIXELFORMAT_FOURCC(src_format)) { - switch (src_format) { - case SDL_PIXELFORMAT_YUY2: - case SDL_PIXELFORMAT_UYVY: - case SDL_PIXELFORMAT_YVYU: - bpp = 2; - break; - case SDL_PIXELFORMAT_YV12: - case SDL_PIXELFORMAT_IYUV: - case SDL_PIXELFORMAT_NV12: - case SDL_PIXELFORMAT_NV21: - bpp = 1; - break; - default: - return SDL_SetError("Unknown FOURCC pixel format"); - } - } else { - bpp = SDL_BYTESPERPIXEL(src_format); - } + int i; + const int bpp = SDL_BYTESPERPIXEL(src_format); width *= bpp; - for (i = height; i--;) { SDL_memcpy(dst, src, width); - src = (Uint8*)src + src_pitch; + src = (const Uint8*)src + src_pitch; dst = (Uint8*)dst + dst_pitch; } - - if (src_format == SDL_PIXELFORMAT_YV12 || src_format == SDL_PIXELFORMAT_IYUV) { - /* U and V planes are a quarter the size of the Y plane */ - width /= 2; - height /= 2; - src_pitch /= 2; - dst_pitch /= 2; - for (i = height * 2; i--;) { - SDL_memcpy(dst, src, width); - src = (Uint8*)src + src_pitch; - dst = (Uint8*)dst + dst_pitch; - } - } else if (src_format == SDL_PIXELFORMAT_NV12 || src_format == SDL_PIXELFORMAT_NV21) { - /* U/V plane is half the height of the Y plane */ - height /= 2; - for (i = height; i--;) { - SDL_memcpy(dst, src, width); - src = (Uint8*)src + src_pitch; - dst = (Uint8*)dst + dst_pitch; - } - } return 0; } @@ -1156,6 +1204,8 @@ SDL_FreeSurface(SDL_Surface * surface) if (surface->flags & SDL_DONTFREE) { return; } + SDL_InvalidateMap(surface->map); + if (--surface->refcount > 0) { return; } @@ -1170,13 +1220,12 @@ SDL_FreeSurface(SDL_Surface * surface) SDL_FreeFormat(surface->format); surface->format = NULL; } - if (surface->map != NULL) { - SDL_FreeBlitMap(surface->map); - surface->map = NULL; - } if (!(surface->flags & SDL_PREALLOC)) { SDL_free(surface->pixels); } + if (surface->map) { + SDL_FreeBlitMap(surface->map); + } SDL_free(surface); } diff --git a/Engine/lib/sdl/src/video/SDL_sysvideo.h b/Engine/lib/sdl/src/video/SDL_sysvideo.h index cd2ed2a7e..9df71c9aa 100644 --- a/Engine/lib/sdl/src/video/SDL_sysvideo.h +++ b/Engine/lib/sdl/src/video/SDL_sysvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,15 @@ */ #include "../SDL_internal.h" -#ifndef _SDL_sysvideo_h -#define _SDL_sysvideo_h +#ifndef SDL_sysvideo_h_ +#define SDL_sysvideo_h_ #include "SDL_messagebox.h" #include "SDL_shape.h" #include "SDL_thread.h" +#include "SDL_vulkan_internal.h" + /* The SDL video driver */ typedef struct SDL_WindowShaper SDL_WindowShaper; @@ -163,6 +165,11 @@ struct SDL_VideoDevice */ void (*VideoQuit) (_THIS); + /* + * Reinitialize the touch devices -- called if an unknown touch ID occurs. + */ + void (*ResetTouch) (_THIS); + /* * * */ /* * Display functions @@ -200,8 +207,8 @@ struct SDL_VideoDevice /* * Window functions */ - int (*CreateWindow) (_THIS, SDL_Window * window); - int (*CreateWindowFrom) (_THIS, SDL_Window * window, const void *data); + int (*CreateSDLWindow) (_THIS, SDL_Window * window); + int (*CreateSDLWindowFrom) (_THIS, SDL_Window * window, const void *data); void (*SetWindowTitle) (_THIS, SDL_Window * window); void (*SetWindowIcon) (_THIS, SDL_Window * window, SDL_Surface * icon); void (*SetWindowPosition) (_THIS, SDL_Window * window); @@ -252,8 +259,19 @@ struct SDL_VideoDevice void (*GL_GetDrawableSize) (_THIS, SDL_Window * window, int *w, int *h); int (*GL_SetSwapInterval) (_THIS, int interval); int (*GL_GetSwapInterval) (_THIS); - void (*GL_SwapWindow) (_THIS, SDL_Window * window); + int (*GL_SwapWindow) (_THIS, SDL_Window * window); void (*GL_DeleteContext) (_THIS, SDL_GLContext context); + void (*GL_DefaultProfileConfig) (_THIS, int *mask, int *major, int *minor); + + /* * * */ + /* + * Vulkan support + */ + int (*Vulkan_LoadLibrary) (_THIS, const char *path); + void (*Vulkan_UnloadLibrary) (_THIS); + SDL_bool (*Vulkan_GetInstanceExtensions) (_THIS, SDL_Window *window, unsigned *count, const char **names); + SDL_bool (*Vulkan_CreateSurface) (_THIS, SDL_Window *window, VkInstance instance, VkSurfaceKHR *surface); + void (*Vulkan_GetDrawableSize) (_THIS, SDL_Window * window, int *w, int *h); /* * * */ /* @@ -288,6 +306,7 @@ struct SDL_VideoDevice /* * * */ /* Data common to all drivers */ + SDL_bool is_dummy; SDL_bool suspend_screensaver; int num_displays; SDL_VideoDisplay *displays; @@ -295,7 +314,7 @@ struct SDL_VideoDevice SDL_Window *grabbed_window; Uint8 window_magic; Uint32 next_object_id; - char * clipboard_text; + char *clipboard_text; /* * * */ /* Data used by the GL drivers */ @@ -323,7 +342,9 @@ struct SDL_VideoDevice int profile_mask; int share_with_current_context; int release_behavior; + int reset_notification; int framebuffer_srgb_capable; + int no_error; int retained_backing; int driver_loaded; char driver_path[256]; @@ -340,6 +361,17 @@ struct SDL_VideoDevice SDL_TLSID current_glwin_tls; SDL_TLSID current_glctx_tls; + /* * * */ + /* Data used by the Vulkan drivers */ + struct + { + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr; + PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties; + int loader_loaded; + char loader_path[256]; + void *loader_handle; + } vulkan_config; + /* * * */ /* Data private to this driver */ void *driverdata; @@ -366,57 +398,26 @@ typedef struct VideoBootStrap SDL_VideoDevice *(*create) (int devindex); } VideoBootStrap; -#if SDL_VIDEO_DRIVER_COCOA +/* Not all of these are available in a given build. Use #ifdefs, etc. */ extern VideoBootStrap COCOA_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_X11 extern VideoBootStrap X11_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_MIR extern VideoBootStrap MIR_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_DIRECTFB extern VideoBootStrap DirectFB_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_WINDOWS extern VideoBootStrap WINDOWS_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_WINRT extern VideoBootStrap WINRT_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_HAIKU extern VideoBootStrap HAIKU_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_PANDORA extern VideoBootStrap PND_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_UIKIT extern VideoBootStrap UIKIT_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_ANDROID extern VideoBootStrap Android_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_PSP extern VideoBootStrap PSP_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_RPI extern VideoBootStrap RPI_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_DUMMY +extern VideoBootStrap KMSDRM_bootstrap; extern VideoBootStrap DUMMY_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_WAYLAND extern VideoBootStrap Wayland_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_NACL extern VideoBootStrap NACL_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_VIVANTE extern VideoBootStrap VIVANTE_bootstrap; -#endif -#if SDL_VIDEO_DRIVER_EMSCRIPTEN extern VideoBootStrap Emscripten_bootstrap; -#endif +extern VideoBootStrap QNX_bootstrap; extern SDL_VideoDevice *SDL_GetVideoDevice(void); extern int SDL_AddBasicVideoDisplay(const SDL_DisplayMode * desktop_mode); @@ -425,7 +426,10 @@ extern SDL_bool SDL_AddDisplayMode(SDL_VideoDisplay *display, const SDL_DisplayM extern SDL_VideoDisplay *SDL_GetDisplayForWindow(SDL_Window *window); extern void *SDL_GetDisplayDriverData( int displayIndex ); +extern void SDL_GL_DeduceMaxSupportedESProfile(int* major, int* minor); + extern int SDL_RecreateWindow(SDL_Window * window, Uint32 flags); +extern SDL_bool SDL_HasWindows(void); extern void SDL_OnWindowShown(SDL_Window * window); extern void SDL_OnWindowHidden(SDL_Window * window); @@ -443,6 +447,13 @@ extern SDL_bool SDL_ShouldAllowTopmost(void); extern float SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches); -#endif /* _SDL_sysvideo_h */ +extern void SDL_OnApplicationWillTerminate(void); +extern void SDL_OnApplicationDidReceiveMemoryWarning(void); +extern void SDL_OnApplicationWillResignActive(void); +extern void SDL_OnApplicationDidEnterBackground(void); +extern void SDL_OnApplicationWillEnterForeground(void); +extern void SDL_OnApplicationDidBecomeActive(void); + +#endif /* SDL_sysvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/SDL_video.c b/Engine/lib/sdl/src/video/SDL_video.c index 0a21ef5fc..8cf195d1a 100644 --- a/Engine/lib/sdl/src/video/SDL_video.c +++ b/Engine/lib/sdl/src/video/SDL_video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -46,13 +46,10 @@ #include "SDL_opengles2.h" #endif /* SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL */ +#if !SDL_VIDEO_OPENGL #ifndef GL_CONTEXT_RELEASE_BEHAVIOR_KHR #define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB #endif - -/* On Windows, windows.h defines CreateWindow */ -#ifdef CreateWindow -#undef CreateWindow #endif #ifdef __EMSCRIPTEN__ @@ -100,15 +97,21 @@ static VideoBootStrap *bootstrap[] = { #if SDL_VIDEO_DRIVER_PSP &PSP_bootstrap, #endif +#if SDL_VIDEO_DRIVER_KMSDRM + &KMSDRM_bootstrap, +#endif #if SDL_VIDEO_DRIVER_RPI &RPI_bootstrap, -#endif +#endif #if SDL_VIDEO_DRIVER_NACL &NACL_bootstrap, #endif #if SDL_VIDEO_DRIVER_EMSCRIPTEN &Emscripten_bootstrap, #endif +#if SDL_VIDEO_DRIVER_QNX + &QNX_bootstrap, +#endif #if SDL_VIDEO_DRIVER_DUMMY &DUMMY_bootstrap, #endif @@ -122,6 +125,7 @@ static SDL_VideoDevice *_this = NULL; SDL_UninitializedVideo(); \ return retval; \ } \ + SDL_assert(window && window->magic == &_this->window_magic); \ if (!window || window->magic != &_this->window_magic) { \ SDL_SetError("Invalid window"); \ return retval; \ @@ -133,6 +137,7 @@ static SDL_VideoDevice *_this = NULL; return retval; \ } \ SDL_assert(_this->displays != NULL); \ + SDL_assert(displayIndex >= 0 && displayIndex < _this->num_displays); \ if (displayIndex < 0 || displayIndex >= _this->num_displays) { \ SDL_SetError("displayIndex must be in the range 0 - %d", \ _this->num_displays - 1); \ @@ -170,6 +175,11 @@ ShouldUseTextureFramebuffer() return SDL_TRUE; } + /* If this is the dummy driver there is no texture support */ + if (_this->is_dummy) { + return SDL_FALSE; + } + /* If the user has specified a software renderer we can't use a texture framebuffer, or renderer creation will go recursive. */ @@ -195,7 +205,7 @@ ShouldUseTextureFramebuffer() return SDL_FALSE; #elif defined(__MACOSX__) - /* Mac OS X uses OpenGL as the native fast path */ + /* Mac OS X uses OpenGL as the native fast path (for cocoa and X11) */ return SDL_TRUE; #elif defined(__LINUX__) @@ -336,9 +346,14 @@ SDL_CreateWindowTexture(SDL_VideoDevice *unused, SDL_Window * window, Uint32 * f /* Create framebuffer data */ data->bytes_per_pixel = SDL_BYTESPERPIXEL(*format); data->pitch = (((window->w * data->bytes_per_pixel) + 3) & ~3); - data->pixels = SDL_malloc(window->h * data->pitch); - if (!data->pixels) { - return SDL_OutOfMemory(); + + { + /* Make static analysis happy about potential malloc(0) calls. */ + const size_t allocsize = window->h * data->pitch; + data->pixels = SDL_malloc((allocsize > 0) ? allocsize : 1); + if (!data->pixels) { + return SDL_OutOfMemory(); + } } *pixels = data->pixels; @@ -707,21 +722,21 @@ int SDL_GetDisplayUsableBounds(int displayIndex, SDL_Rect * rect) int SDL_GetDisplayDPI(int displayIndex, float * ddpi, float * hdpi, float * vdpi) { - SDL_VideoDisplay *display; + SDL_VideoDisplay *display; CHECK_DISPLAY_INDEX(displayIndex, -1); display = &_this->displays[displayIndex]; - if (_this->GetDisplayDPI) { - if (_this->GetDisplayDPI(_this, display, ddpi, hdpi, vdpi) == 0) { - return 0; - } + if (_this->GetDisplayDPI) { + if (_this->GetDisplayDPI(_this, display, ddpi, hdpi, vdpi) == 0) { + return 0; + } } else { return SDL_Unsupported(); } - return -1; + return -1; } SDL_bool @@ -1157,35 +1172,38 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) CHECK_WINDOW_MAGIC(window,-1); /* if we are in the process of hiding don't go back to fullscreen */ - if ( window->is_hiding && fullscreen ) + if (window->is_hiding && fullscreen) { return 0; + } #ifdef __MACOSX__ /* if the window is going away and no resolution change is necessary, - do nothing, or else we may trigger an ugly double-transition + do nothing, or else we may trigger an ugly double-transition */ - if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) - return 0; + if (SDL_strcmp(_this->name, "cocoa") == 0) { /* don't do this for X11, etc */ + if (window->is_destroying && (window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) + return 0; - /* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */ - if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) { - if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) { - return -1; + /* If we're switching between a fullscreen Space and "normal" fullscreen, we need to get back to normal first. */ + if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN)) { + if (!Cocoa_SetWindowFullscreenSpace(window, SDL_FALSE)) { + return -1; + } + } else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) { + display = SDL_GetDisplayForWindow(window); + SDL_SetDisplayModeForDisplay(display, NULL); + if (_this->SetWindowFullscreen) { + _this->SetWindowFullscreen(_this, window, display, SDL_FALSE); + } } - } else if (fullscreen && ((window->last_fullscreen_flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN) && ((window->flags & FULLSCREEN_MASK) == SDL_WINDOW_FULLSCREEN_DESKTOP)) { - display = SDL_GetDisplayForWindow(window); - SDL_SetDisplayModeForDisplay(display, NULL); - if (_this->SetWindowFullscreen) { - _this->SetWindowFullscreen(_this, window, display, SDL_FALSE); - } - } - if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) { - if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) { - return -1; + if (Cocoa_SetWindowFullscreenSpace(window, fullscreen)) { + if (Cocoa_IsWindowInFullscreenSpace(window) != fullscreen) { + return -1; + } + window->last_fullscreen_flags = window->flags; + return 0; } - window->last_fullscreen_flags = window->flags; - return 0; } #elif __WINRT__ && (NTDDI_VERSION < NTDDI_WIN10) /* HACK: WinRT 8.x apps can't choose whether or not they are fullscreen @@ -1304,7 +1322,7 @@ SDL_UpdateFullscreenMode(SDL_Window * window, SDL_bool fullscreen) } #define CREATE_FLAGS \ - (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP) + (SDL_WINDOW_OPENGL | SDL_WINDOW_BORDERLESS | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI | SDL_WINDOW_ALWAYS_ON_TOP | SDL_WINDOW_SKIP_TASKBAR | SDL_WINDOW_POPUP_MENU | SDL_WINDOW_UTILITY | SDL_WINDOW_TOOLTIP | SDL_WINDOW_VULKAN) static void SDL_FinishWindowCreation(SDL_Window *window, Uint32 flags) @@ -1338,7 +1356,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) } } - if ( (((flags & SDL_WINDOW_UTILITY) != 0) + ((flags & SDL_WINDOW_TOOLTIP) != 0) + ((flags & SDL_WINDOW_POPUP_MENU) != 0)) > 1 ) { + if ((((flags & SDL_WINDOW_UTILITY) != 0) + ((flags & SDL_WINDOW_TOOLTIP) != 0) + ((flags & SDL_WINDOW_POPUP_MENU) != 0)) > 1) { SDL_SetError("Conflicting window flags specified"); return NULL; } @@ -1359,7 +1377,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) /* Some platforms have OpenGL enabled by default */ #if (SDL_VIDEO_OPENGL && __MACOSX__) || __IPHONEOS__ || __ANDROID__ || __NACL__ - if (SDL_strcmp(_this->name, "dummy") != 0) { + if (!_this->is_dummy && !(flags & SDL_WINDOW_VULKAN)) { flags |= SDL_WINDOW_OPENGL; } #endif @@ -1373,6 +1391,21 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) } } + if (flags & SDL_WINDOW_VULKAN) { + if (!_this->Vulkan_CreateSurface) { + SDL_SetError("Vulkan support is either not configured in SDL " + "or not available in video driver"); + return NULL; + } + if (flags & SDL_WINDOW_OPENGL) { + SDL_SetError("Vulkan and OpenGL not supported on same window"); + return NULL; + } + if (SDL_Vulkan_LoadLibrary(NULL) < 0) { + return NULL; + } + } + /* Unless the user has specified the high-DPI disabling hint, respect the * SDL_WINDOW_ALLOW_HIGHDPI flag. */ @@ -1439,7 +1472,7 @@ SDL_CreateWindow(const char *title, int x, int y, int w, int h, Uint32 flags) } _this->windows = window; - if (_this->CreateWindow && _this->CreateWindow(_this, window) < 0) { + if (_this->CreateSDLWindow && _this->CreateSDLWindow(_this, window) < 0) { SDL_DestroyWindow(window); return NULL; } @@ -1476,7 +1509,7 @@ SDL_CreateWindowFrom(const void *data) SDL_UninitializedVideo(); return NULL; } - if (!_this->CreateWindowFrom) { + if (!_this->CreateSDLWindowFrom) { SDL_Unsupported(); return NULL; } @@ -1498,7 +1531,7 @@ SDL_CreateWindowFrom(const void *data) } _this->windows = window; - if (_this->CreateWindowFrom(_this, window, data) < 0) { + if (_this->CreateSDLWindowFrom(_this, window, data) < 0) { SDL_DestroyWindow(window); return NULL; } @@ -1548,12 +1581,22 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) } } + if ((window->flags & SDL_WINDOW_VULKAN) != (flags & SDL_WINDOW_VULKAN)) { + SDL_SetError("Can't change SDL_WINDOW_VULKAN window flag"); + return -1; + } + + if ((window->flags & SDL_WINDOW_VULKAN) && (flags & SDL_WINDOW_OPENGL)) { + SDL_SetError("Vulkan and OpenGL not supported on same window"); + return -1; + } + window->flags = ((flags & CREATE_FLAGS) | SDL_WINDOW_HIDDEN); window->last_fullscreen_flags = window->flags; window->is_destroying = SDL_FALSE; - if (_this->CreateWindow && !(flags & SDL_WINDOW_FOREIGN)) { - if (_this->CreateWindow(_this, window) < 0) { + if (_this->CreateSDLWindow && !(flags & SDL_WINDOW_FOREIGN)) { + if (_this->CreateSDLWindow(_this, window) < 0) { if (loaded_opengl) { SDL_GL_UnloadLibrary(); window->flags &= ~SDL_WINDOW_OPENGL; @@ -1583,6 +1626,12 @@ SDL_RecreateWindow(SDL_Window * window, Uint32 flags) return 0; } +SDL_bool +SDL_HasWindows(void) +{ + return (_this && _this->windows != NULL); +} + Uint32 SDL_GetWindowID(SDL_Window * window) { @@ -1738,7 +1787,7 @@ SDL_SetWindowPosition(SDL_Window * window, int x, int y) if (SDL_WINDOWPOS_ISCENTERED(x) || SDL_WINDOWPOS_ISCENTERED(y)) { int displayIndex = (x & 0xFFFF); SDL_Rect bounds; - if (displayIndex > _this->num_displays) { + if (displayIndex >= _this->num_displays) { displayIndex = 0; } @@ -1867,20 +1916,16 @@ SDL_SetWindowSize(SDL_Window * window, int w, int h) } /* Make sure we don't exceed any window size limits */ - if (window->min_w && w < window->min_w) - { + if (window->min_w && w < window->min_w) { w = window->min_w; } - if (window->max_w && w > window->max_w) - { + if (window->max_w && w > window->max_w) { w = window->max_w; } - if (window->min_h && h < window->min_h) - { + if (window->min_h && h < window->min_h) { h = window->min_h; } - if (window->max_h && h > window->max_h) - { + if (window->max_h && h > window->max_h) { h = window->max_h; } @@ -1917,30 +1962,6 @@ SDL_GetWindowSize(SDL_Window * window, int *w, int *h) } } -void -SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h) -{ - CHECK_WINDOW_MAGIC(window,); - if (min_w <= 0) { - SDL_InvalidParamError("min_w"); - return; - } - if (min_h <= 0) { - SDL_InvalidParamError("min_h"); - return; - } - - if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { - window->min_w = min_w; - window->min_h = min_h; - if (_this->SetWindowMinimumSize) { - _this->SetWindowMinimumSize(_this, window); - } - /* Ensure that window is not smaller than minimal size */ - SDL_SetWindowSize(window, SDL_max(window->w, window->min_w), SDL_max(window->h, window->min_h)); - } -} - int SDL_GetWindowBordersSize(SDL_Window * window, int *top, int *left, int *bottom, int *right) { @@ -1963,6 +1984,37 @@ SDL_GetWindowBordersSize(SDL_Window * window, int *top, int *left, int *bottom, return _this->GetWindowBordersSize(_this, window, top, left, bottom, right); } +void +SDL_SetWindowMinimumSize(SDL_Window * window, int min_w, int min_h) +{ + CHECK_WINDOW_MAGIC(window,); + if (min_w <= 0) { + SDL_InvalidParamError("min_w"); + return; + } + if (min_h <= 0) { + SDL_InvalidParamError("min_h"); + return; + } + + if ((window->max_w && min_w >= window->max_w) || + (window->max_h && min_h >= window->max_h)) { + SDL_SetError("SDL_SetWindowMinimumSize(): Tried to set minimum size larger than maximum size"); + return; + } + + window->min_w = min_w; + window->min_h = min_h; + + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { + if (_this->SetWindowMinimumSize) { + _this->SetWindowMinimumSize(_this, window); + } + /* Ensure that window is not smaller than minimal size */ + SDL_SetWindowSize(window, SDL_max(window->w, window->min_w), SDL_max(window->h, window->min_h)); + } +} + void SDL_GetWindowMinimumSize(SDL_Window * window, int *min_w, int *min_h) { @@ -1988,9 +2040,15 @@ SDL_SetWindowMaximumSize(SDL_Window * window, int max_w, int max_h) return; } + if (max_w <= window->min_w || max_h <= window->min_h) { + SDL_SetError("SDL_SetWindowMaximumSize(): Tried to set maximum size smaller than minimum size"); + return; + } + + window->max_w = max_w; + window->max_h = max_h; + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { - window->max_w = max_w; - window->max_h = max_h; if (_this->SetWindowMaximumSize) { _this->SetWindowMaximumSize(_this, window); } @@ -2035,13 +2093,13 @@ SDL_HideWindow(SDL_Window * window) return; } - window->is_hiding = SDL_TRUE; + window->is_hiding = SDL_TRUE; SDL_UpdateFullscreenMode(window, SDL_FALSE); if (_this->HideWindow) { _this->HideWindow(_this, window); } - window->is_hiding = SDL_FALSE; + window->is_hiding = SDL_FALSE; SDL_SendWindowEvent(window, SDL_WINDOWEVENT_HIDDEN, 0, 0); } @@ -2506,8 +2564,10 @@ ShouldMinimizeOnFocusLoss(SDL_Window * window) } #ifdef __MACOSX__ - if (Cocoa_IsWindowInFullscreenSpace(window)) { - return SDL_FALSE; + if (SDL_strcmp(_this->name, "cocoa") == 0) { /* don't do this for X11, etc */ + if (Cocoa_IsWindowInFullscreenSpace(window)) { + return SDL_FALSE; + } } #endif @@ -2586,6 +2646,9 @@ SDL_DestroyWindow(SDL_Window * window) if (window->flags & SDL_WINDOW_OPENGL) { SDL_GL_UnloadLibrary(); } + if (window->flags & SDL_WINDOW_VULKAN) { + SDL_Vulkan_UnloadLibrary(); + } display = SDL_GetDisplayForWindow(window); if (display->fullscreen_window == window) { @@ -2777,11 +2840,13 @@ SDL_GL_UnloadLibrary(void) } } +#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 static SDL_INLINE SDL_bool isAtLeastGL3(const char *verstr) { return (verstr && (SDL_atoi(verstr) >= 3)); } +#endif SDL_bool SDL_GL_ExtensionSupported(const char *extension) @@ -2855,7 +2920,7 @@ SDL_GL_ExtensionSupported(const char *extension) break; terminator = where + SDL_strlen(extension); - if (where == start || *(where - 1) == ' ') + if (where == extensions || *(where - 1) == ' ') if (*terminator == ' ' || *terminator == '\0') return SDL_TRUE; @@ -2867,6 +2932,37 @@ SDL_GL_ExtensionSupported(const char *extension) #endif } +/* Deduce supported ES profile versions from the supported + ARB_ES*_compatibility extensions. There is no direct query. + + This is normally only called when the OpenGL driver supports + {GLX,WGL}_EXT_create_context_es2_profile. + */ +void +SDL_GL_DeduceMaxSupportedESProfile(int* major, int* minor) +{ +/* THIS REQUIRES AN EXISTING GL CONTEXT THAT HAS BEEN MADE CURRENT. */ +/* Please refer to https://bugzilla.libsdl.org/show_bug.cgi?id=3725 for discussion. */ +#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES || SDL_VIDEO_OPENGL_ES2 + /* XXX This is fragile; it will break in the event of release of + * new versions of OpenGL ES. + */ + if (SDL_GL_ExtensionSupported("GL_ARB_ES3_2_compatibility")) { + *major = 3; + *minor = 2; + } else if (SDL_GL_ExtensionSupported("GL_ARB_ES3_1_compatibility")) { + *major = 3; + *minor = 1; + } else if (SDL_GL_ExtensionSupported("GL_ARB_ES3_compatibility")) { + *major = 3; + *minor = 0; + } else { + *major = 2; + *minor = 0; + } +#endif +} + void SDL_GL_ResetAttributes() { @@ -2891,22 +2987,32 @@ SDL_GL_ResetAttributes() _this->gl_config.multisamplesamples = 0; _this->gl_config.retained_backing = 1; _this->gl_config.accelerated = -1; /* accelerated or not, both are fine */ - _this->gl_config.profile_mask = 0; + + if (_this->GL_DefaultProfileConfig) { + _this->GL_DefaultProfileConfig(_this, &_this->gl_config.profile_mask, + &_this->gl_config.major_version, + &_this->gl_config.minor_version); + } else { #if SDL_VIDEO_OPENGL - _this->gl_config.major_version = 2; - _this->gl_config.minor_version = 1; + _this->gl_config.major_version = 2; + _this->gl_config.minor_version = 1; + _this->gl_config.profile_mask = 0; #elif SDL_VIDEO_OPENGL_ES2 - _this->gl_config.major_version = 2; - _this->gl_config.minor_version = 0; - _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; + _this->gl_config.major_version = 2; + _this->gl_config.minor_version = 0; + _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; #elif SDL_VIDEO_OPENGL_ES - _this->gl_config.major_version = 1; - _this->gl_config.minor_version = 1; - _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; + _this->gl_config.major_version = 1; + _this->gl_config.minor_version = 1; + _this->gl_config.profile_mask = SDL_GL_CONTEXT_PROFILE_ES; #endif + } + _this->gl_config.flags = 0; _this->gl_config.framebuffer_srgb_capable = 0; + _this->gl_config.no_error = 0; _this->gl_config.release_behavior = SDL_GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH; + _this->gl_config.reset_notification = SDL_GL_CONTEXT_RESET_NO_NOTIFICATION; _this->gl_config.share_with_current_context = 0; } @@ -3016,6 +3122,12 @@ SDL_GL_SetAttribute(SDL_GLattr attr, int value) case SDL_GL_CONTEXT_RELEASE_BEHAVIOR: _this->gl_config.release_behavior = value; break; + case SDL_GL_CONTEXT_RESET_NOTIFICATION: + _this->gl_config.reset_notification = value; + break; + case SDL_GL_CONTEXT_NO_ERROR: + _this->gl_config.no_error = value; + break; default: retval = SDL_SetError("Unknown OpenGL attribute"); break; @@ -3047,9 +3159,17 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) GLenum attachmentattrib = 0; #endif + if (!value) { + return SDL_InvalidParamError("value"); + } + /* Clear value in any case */ *value = 0; + if (!_this) { + return SDL_UninitializedVideo(); + } + switch (attr) { case SDL_GL_RED_SIZE: #if SDL_VIDEO_OPENGL @@ -3212,6 +3332,11 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) *value = _this->gl_config.framebuffer_srgb_capable; return 0; } + case SDL_GL_CONTEXT_NO_ERROR: + { + *value = _this->gl_config.no_error; + return 0; + } default: return SDL_SetError("Unknown OpenGL attribute"); } @@ -3219,7 +3344,7 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) #if SDL_VIDEO_OPENGL glGetStringFunc = SDL_GL_GetProcAddress("glGetString"); if (!glGetStringFunc) { - return SDL_SetError("Failed getting OpenGL glGetString entry point"); + return -1; } if (attachmentattrib && isAtLeastGL3((const char *) glGetStringFunc(GL_VERSION))) { @@ -3228,7 +3353,7 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) if (glGetFramebufferAttachmentParameterivFunc) { glGetFramebufferAttachmentParameterivFunc(GL_FRAMEBUFFER, attachment, attachmentattrib, (GLint *) value); } else { - return SDL_SetError("Failed getting OpenGL glGetFramebufferAttachmentParameteriv entry point"); + return -1; } } else #endif @@ -3238,13 +3363,13 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value) if (glGetIntegervFunc) { glGetIntegervFunc(attrib, (GLint *) value); } else { - return SDL_SetError("Failed getting OpenGL glGetIntegerv entry point"); + return -1; } } glGetErrorFunc = SDL_GL_GetProcAddress("glGetError"); if (!glGetErrorFunc) { - return SDL_SetError("Failed getting OpenGL glGetError entry point"); + return -1; } error = glGetErrorFunc(); @@ -3617,8 +3742,9 @@ SDL_IsScreenKeyboardShown(SDL_Window *window) #include "x11/SDL_x11messagebox.h" #endif -// This function will be unused if none of the above video drivers are present. -SDL_UNUSED static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype) + +#if SDL_VIDEO_DRIVER_WINDOWS || SDL_VIDEO_DRIVER_WINRT || SDL_VIDEO_DRIVER_COCOA || SDL_VIDEO_DRIVER_UIKIT || SDL_VIDEO_DRIVER_X11 +static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData *messageboxdata, SDL_SYSWM_TYPE drivertype) { SDL_SysWMinfo info; SDL_Window *window = messageboxdata->window; @@ -3634,6 +3760,7 @@ SDL_UNUSED static SDL_bool SDL_MessageboxValidForDriver(const SDL_MessageBoxData return (info.subsystem == drivertype); } } +#endif int SDL_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) @@ -3780,15 +3907,171 @@ SDL_SetWindowHitTest(SDL_Window * window, SDL_HitTest callback, void *userdata) return 0; } -float SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches) +float +SDL_ComputeDiagonalDPI(int hpix, int vpix, float hinches, float vinches) { - float den2 = hinches * hinches + vinches * vinches; - if ( den2 <= 0.0f ) { - return 0.0f; - } - - return (float)(SDL_sqrt((double)hpix * (double)hpix + (double)vpix * (double)vpix) / - SDL_sqrt((double)den2)); + float den2 = hinches * hinches + vinches * vinches; + if (den2 <= 0.0f) { + return 0.0f; + } + + return (float)(SDL_sqrt((double)hpix * (double)hpix + (double)vpix * (double)vpix) / + SDL_sqrt((double)den2)); +} + +/* + * Functions used by iOS application delegates + */ +void SDL_OnApplicationWillTerminate(void) +{ + SDL_SendAppEvent(SDL_APP_TERMINATING); +} + +void SDL_OnApplicationDidReceiveMemoryWarning(void) +{ + SDL_SendAppEvent(SDL_APP_LOWMEMORY); +} + +void SDL_OnApplicationWillResignActive(void) +{ + if (_this) { + SDL_Window *window; + for (window = _this->windows; window != NULL; window = window->next) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); + } + } + SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND); +} + +void SDL_OnApplicationDidEnterBackground(void) +{ + SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND); +} + +void SDL_OnApplicationWillEnterForeground(void) +{ + SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND); +} + +void SDL_OnApplicationDidBecomeActive(void) +{ + SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND); + + if (_this) { + SDL_Window *window; + for (window = _this->windows; window != NULL; window = window->next) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); + } + } +} + +#define NOT_A_VULKAN_WINDOW "The specified window isn't a Vulkan window" + +int SDL_Vulkan_LoadLibrary(const char *path) +{ + int retval; + if (!_this) { + SDL_UninitializedVideo(); + return -1; + } + if (_this->vulkan_config.loader_loaded) { + if (path && SDL_strcmp(path, _this->vulkan_config.loader_path) != 0) { + return SDL_SetError("Vulkan loader library already loaded"); + } + retval = 0; + } else { + if (!_this->Vulkan_LoadLibrary) { + return SDL_SetError("No Vulkan support in video driver"); + } + retval = _this->Vulkan_LoadLibrary(_this, path); + } + if (retval == 0) { + _this->vulkan_config.loader_loaded++; + } + return retval; +} + +void *SDL_Vulkan_GetVkGetInstanceProcAddr(void) +{ + if (!_this) { + SDL_UninitializedVideo(); + return NULL; + } + if (!_this->vulkan_config.loader_loaded) { + SDL_SetError("No Vulkan loader has been loaded"); + return NULL; + } + return _this->vulkan_config.vkGetInstanceProcAddr; +} + +void SDL_Vulkan_UnloadLibrary(void) +{ + if (!_this) { + SDL_UninitializedVideo(); + return; + } + if (_this->vulkan_config.loader_loaded > 0) { + if (--_this->vulkan_config.loader_loaded > 0) { + return; + } + if (_this->Vulkan_UnloadLibrary) { + _this->Vulkan_UnloadLibrary(_this); + } + } +} + +SDL_bool SDL_Vulkan_GetInstanceExtensions(SDL_Window *window, unsigned *count, const char **names) +{ + CHECK_WINDOW_MAGIC(window, SDL_FALSE); + + if (!(window->flags & SDL_WINDOW_VULKAN)) { + SDL_SetError(NOT_A_VULKAN_WINDOW); + return SDL_FALSE; + } + + if (!count) { + SDL_InvalidParamError("count"); + return SDL_FALSE; + } + + return _this->Vulkan_GetInstanceExtensions(_this, window, count, names); +} + +SDL_bool SDL_Vulkan_CreateSurface(SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + CHECK_WINDOW_MAGIC(window, SDL_FALSE); + + if (!(window->flags & SDL_WINDOW_VULKAN)) { + SDL_SetError(NOT_A_VULKAN_WINDOW); + return SDL_FALSE; + } + + if (!instance) { + SDL_InvalidParamError("instance"); + return SDL_FALSE; + } + + if (!surface) { + SDL_InvalidParamError("surface"); + return SDL_FALSE; + } + + return _this->Vulkan_CreateSurface(_this, window, instance, surface); +} + +void SDL_Vulkan_GetDrawableSize(SDL_Window * window, int *w, int *h) +{ + CHECK_WINDOW_MAGIC(window,); + + if (_this->Vulkan_GetDrawableSize) { + _this->Vulkan_GetDrawableSize(_this, window, w, h); + } else { + SDL_GetWindowSize(window, w, h); + } } /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/SDL_vulkan_internal.h b/Engine/lib/sdl/src/video/SDL_vulkan_internal.h new file mode 100644 index 000000000..cdf464ee0 --- /dev/null +++ b/Engine/lib/sdl/src/video/SDL_vulkan_internal.h @@ -0,0 +1,91 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#ifndef SDL_vulkan_internal_h_ +#define SDL_vulkan_internal_h_ + +#include "../SDL_internal.h" + +#include "SDL_stdinc.h" + +#if defined(SDL_LOADSO_DISABLED) +#undef SDL_VIDEO_VULKAN +#define SDL_VIDEO_VULKAN 0 +#endif + +#if SDL_VIDEO_VULKAN + +#if SDL_VIDEO_DRIVER_ANDROID +#define VK_USE_PLATFORM_ANDROID_KHR +#endif +#if SDL_VIDEO_DRIVER_COCOA +#define VK_USE_PLATFORM_MACOS_MVK +#endif +#if SDL_VIDEO_DRIVER_MIR +#define VK_USE_PLATFORM_MIR_KHR +#endif +#if SDL_VIDEO_DRIVER_UIKIT +#define VK_USE_PLATFORM_IOS_MVK +#endif +#if SDL_VIDEO_DRIVER_WAYLAND +#define VK_USE_PLATFORM_WAYLAND_KHR +#include "wayland/SDL_waylanddyn.h" +#endif +#if SDL_VIDEO_DRIVER_WINDOWS +#define VK_USE_PLATFORM_WIN32_KHR +#include "../core/windows/SDL_windows.h" +#endif +#if SDL_VIDEO_DRIVER_X11 +#define VK_USE_PLATFORM_XLIB_KHR +#define VK_USE_PLATFORM_XCB_KHR +#endif + +#define VK_NO_PROTOTYPES +#include "./khronos/vulkan/vulkan.h" + +#include "SDL_vulkan.h" + + +extern const char *SDL_Vulkan_GetResultString(VkResult result); + +extern VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList( + PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties, + Uint32 *extensionCount); /* free returned list with SDL_free */ + +/* Implements functionality of SDL_Vulkan_GetInstanceExtensions for a list of + * names passed in nameCount and names. */ +extern SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount, + const char **userNames, + unsigned nameCount, + const char *const *names); + +#else + +/* No SDL Vulkan support, just include the header for typedefs */ +#include "SDL_vulkan.h" + +typedef void (*PFN_vkGetInstanceProcAddr) (void); +typedef int (*PFN_vkEnumerateInstanceExtensionProperties) (void); + +#endif /* SDL_VIDEO_VULKAN */ + +#endif /* SDL_vulkan_internal_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/SDL_vulkan_utils.c b/Engine/lib/sdl/src/video/SDL_vulkan_utils.c new file mode 100644 index 000000000..d4cbed4d9 --- /dev/null +++ b/Engine/lib/sdl/src/video/SDL_vulkan_utils.c @@ -0,0 +1,172 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +#include "SDL_vulkan_internal.h" +#include "SDL_error.h" + +#if SDL_VIDEO_VULKAN + +const char *SDL_Vulkan_GetResultString(VkResult result) +{ + switch((int)result) + { + case VK_SUCCESS: + return "VK_SUCCESS"; + case VK_NOT_READY: + return "VK_NOT_READY"; + case VK_TIMEOUT: + return "VK_TIMEOUT"; + case VK_EVENT_SET: + return "VK_EVENT_SET"; + case VK_EVENT_RESET: + return "VK_EVENT_RESET"; + case VK_INCOMPLETE: + return "VK_INCOMPLETE"; + case VK_ERROR_OUT_OF_HOST_MEMORY: + return "VK_ERROR_OUT_OF_HOST_MEMORY"; + case VK_ERROR_OUT_OF_DEVICE_MEMORY: + return "VK_ERROR_OUT_OF_DEVICE_MEMORY"; + case VK_ERROR_INITIALIZATION_FAILED: + return "VK_ERROR_INITIALIZATION_FAILED"; + case VK_ERROR_DEVICE_LOST: + return "VK_ERROR_DEVICE_LOST"; + case VK_ERROR_MEMORY_MAP_FAILED: + return "VK_ERROR_MEMORY_MAP_FAILED"; + case VK_ERROR_LAYER_NOT_PRESENT: + return "VK_ERROR_LAYER_NOT_PRESENT"; + case VK_ERROR_EXTENSION_NOT_PRESENT: + return "VK_ERROR_EXTENSION_NOT_PRESENT"; + case VK_ERROR_FEATURE_NOT_PRESENT: + return "VK_ERROR_FEATURE_NOT_PRESENT"; + case VK_ERROR_INCOMPATIBLE_DRIVER: + return "VK_ERROR_INCOMPATIBLE_DRIVER"; + case VK_ERROR_TOO_MANY_OBJECTS: + return "VK_ERROR_TOO_MANY_OBJECTS"; + case VK_ERROR_FORMAT_NOT_SUPPORTED: + return "VK_ERROR_FORMAT_NOT_SUPPORTED"; + case VK_ERROR_FRAGMENTED_POOL: + return "VK_ERROR_FRAGMENTED_POOL"; + case VK_ERROR_SURFACE_LOST_KHR: + return "VK_ERROR_SURFACE_LOST_KHR"; + case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: + return "VK_ERROR_NATIVE_WINDOW_IN_USE_KHR"; + case VK_SUBOPTIMAL_KHR: + return "VK_SUBOPTIMAL_KHR"; + case VK_ERROR_OUT_OF_DATE_KHR: + return "VK_ERROR_OUT_OF_DATE_KHR"; + case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: + return "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR"; + case VK_ERROR_VALIDATION_FAILED_EXT: + return "VK_ERROR_VALIDATION_FAILED_EXT"; + case VK_ERROR_OUT_OF_POOL_MEMORY_KHR: + return "VK_ERROR_OUT_OF_POOL_MEMORY_KHR"; + case VK_ERROR_INVALID_SHADER_NV: + return "VK_ERROR_INVALID_SHADER_NV"; + case VK_RESULT_MAX_ENUM: + case VK_RESULT_RANGE_SIZE: + break; + } + if(result < 0) + return "VK_ERROR_"; + return "VK_"; +} + +VkExtensionProperties *SDL_Vulkan_CreateInstanceExtensionsList( + PFN_vkEnumerateInstanceExtensionProperties vkEnumerateInstanceExtensionProperties, + Uint32 *extensionCount) +{ + Uint32 count = 0; + VkResult result = vkEnumerateInstanceExtensionProperties(NULL, &count, NULL); + VkExtensionProperties *retval; + if(result == VK_ERROR_INCOMPATIBLE_DRIVER) + { + /* Avoid the ERR_MAX_STRLEN limit by passing part of the message + * as a string argument. + */ + SDL_SetError( + "You probably don't have a working Vulkan driver installed. %s %s %s(%d)", + "Getting Vulkan extensions failed:", + "vkEnumerateInstanceExtensionProperties returned", + SDL_Vulkan_GetResultString(result), + (int)result); + return NULL; + } + else if(result != VK_SUCCESS) + { + SDL_SetError( + "Getting Vulkan extensions failed: vkEnumerateInstanceExtensionProperties returned " + "%s(%d)", + SDL_Vulkan_GetResultString(result), + (int)result); + return NULL; + } + if(count == 0) + { + retval = SDL_calloc(1, sizeof(VkExtensionProperties)); // so we can return non-null + } + else + { + retval = SDL_calloc(count, sizeof(VkExtensionProperties)); + } + if(!retval) + { + SDL_OutOfMemory(); + return NULL; + } + result = vkEnumerateInstanceExtensionProperties(NULL, &count, retval); + if(result != VK_SUCCESS) + { + SDL_SetError( + "Getting Vulkan extensions failed: vkEnumerateInstanceExtensionProperties returned " + "%s(%d)", + SDL_Vulkan_GetResultString(result), + (int)result); + SDL_free(retval); + return NULL; + } + *extensionCount = count; + return retval; +} + +SDL_bool SDL_Vulkan_GetInstanceExtensions_Helper(unsigned *userCount, + const char **userNames, + unsigned nameCount, + const char *const *names) +{ + if (userNames) { + unsigned i; + + if (*userCount < nameCount) { + SDL_SetError("Output array for SDL_Vulkan_GetInstanceExtensions needs to be at least %d big", nameCount); + return SDL_FALSE; + } + for (i = 0; i < nameCount; i++) { + userNames[i] = names[i]; + } + } + *userCount = nameCount; + return SDL_TRUE; +} + +#endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/SDL_yuv.c b/Engine/lib/sdl/src/video/SDL_yuv.c new file mode 100644 index 000000000..50910a5f7 --- /dev/null +++ b/Engine/lib/sdl/src/video/SDL_yuv.c @@ -0,0 +1,1834 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + +#include "SDL_endian.h" +#include "SDL_video.h" +#include "SDL_pixels_c.h" + +#include "yuv2rgb/yuv_rgb.h" + +#define SDL_YUV_SD_THRESHOLD 576 + + +static SDL_YUV_CONVERSION_MODE SDL_YUV_ConversionMode = SDL_YUV_CONVERSION_BT601; + + +void SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_MODE mode) +{ + SDL_YUV_ConversionMode = mode; +} + +SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionMode() +{ + return SDL_YUV_ConversionMode; +} + +SDL_YUV_CONVERSION_MODE SDL_GetYUVConversionModeForResolution(int width, int height) +{ + SDL_YUV_CONVERSION_MODE mode = SDL_GetYUVConversionMode(); + if (mode == SDL_YUV_CONVERSION_AUTOMATIC) { + if (height <= SDL_YUV_SD_THRESHOLD) { + mode = SDL_YUV_CONVERSION_BT601; + } else { + mode = SDL_YUV_CONVERSION_BT709; + } + } + return mode; +} + +static int GetYUVConversionType(int width, int height, YCbCrType *yuv_type) +{ + switch (SDL_GetYUVConversionModeForResolution(width, height)) { + case SDL_YUV_CONVERSION_JPEG: + *yuv_type = YCBCR_JPEG; + break; + case SDL_YUV_CONVERSION_BT601: + *yuv_type = YCBCR_601; + break; + case SDL_YUV_CONVERSION_BT709: + *yuv_type = YCBCR_709; + break; + default: + return SDL_SetError("Unexpected YUV conversion mode"); + } + return 0; +} + +static SDL_bool IsPlanar2x2Format(Uint32 format) +{ + return (format == SDL_PIXELFORMAT_YV12 || + format == SDL_PIXELFORMAT_IYUV || + format == SDL_PIXELFORMAT_NV12 || + format == SDL_PIXELFORMAT_NV21); +} + +static SDL_bool IsPacked4Format(Uint32 format) +{ + return (format == SDL_PIXELFORMAT_YUY2 || + format == SDL_PIXELFORMAT_UYVY || + format == SDL_PIXELFORMAT_YVYU); +} + +static int GetYUVPlanes(int width, int height, Uint32 format, const void *yuv, int yuv_pitch, + const Uint8 **y, const Uint8 **u, const Uint8 **v, Uint32 *y_stride, Uint32 *uv_stride) +{ + const Uint8 *planes[3] = { NULL, NULL, NULL }; + int pitches[3] = { 0, 0, 0 }; + + switch (format) { + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + pitches[0] = yuv_pitch; + pitches[1] = (pitches[0] + 1) / 2; + pitches[2] = (pitches[0] + 1) / 2; + planes[0] = (const Uint8 *)yuv; + planes[1] = planes[0] + pitches[0] * height; + planes[2] = planes[1] + pitches[1] * ((height + 1) / 2); + break; + case SDL_PIXELFORMAT_YUY2: + case SDL_PIXELFORMAT_UYVY: + case SDL_PIXELFORMAT_YVYU: + pitches[0] = yuv_pitch; + planes[0] = (const Uint8 *)yuv; + break; + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + pitches[0] = yuv_pitch; + pitches[1] = 2 * ((pitches[0] + 1) / 2); + planes[0] = (const Uint8 *)yuv; + planes[1] = planes[0] + pitches[0] * height; + break; + default: + return SDL_SetError("GetYUVPlanes(): Unsupported YUV format: %s", SDL_GetPixelFormatName(format)); + } + + switch (format) { + case SDL_PIXELFORMAT_YV12: + *y = planes[0]; + *y_stride = pitches[0]; + *v = planes[1]; + *u = planes[2]; + *uv_stride = pitches[1]; + break; + case SDL_PIXELFORMAT_IYUV: + *y = planes[0]; + *y_stride = pitches[0]; + *v = planes[2]; + *u = planes[1]; + *uv_stride = pitches[1]; + break; + case SDL_PIXELFORMAT_YUY2: + *y = planes[0]; + *y_stride = pitches[0]; + *v = *y + 3; + *u = *y + 1; + *uv_stride = pitches[0]; + break; + case SDL_PIXELFORMAT_UYVY: + *y = planes[0] + 1; + *y_stride = pitches[0]; + *v = *y + 1; + *u = *y - 1; + *uv_stride = pitches[0]; + break; + case SDL_PIXELFORMAT_YVYU: + *y = planes[0]; + *y_stride = pitches[0]; + *v = *y + 1; + *u = *y + 3; + *uv_stride = pitches[0]; + break; + case SDL_PIXELFORMAT_NV12: + *y = planes[0]; + *y_stride = pitches[0]; + *u = planes[1]; + *v = *u + 1; + *uv_stride = pitches[1]; + break; + case SDL_PIXELFORMAT_NV21: + *y = planes[0]; + *y_stride = pitches[0]; + *v = planes[1]; + *u = *v + 1; + *uv_stride = pitches[1]; + break; + default: + /* Should have caught this above */ + return SDL_SetError("GetYUVPlanes[2]: Unsupported YUV format: %s", SDL_GetPixelFormatName(format)); + } + return 0; +} + +static SDL_bool yuv_rgb_sse( + Uint32 src_format, Uint32 dst_format, + Uint32 width, Uint32 height, + const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride, + Uint8 *rgb, Uint32 rgb_stride, + YCbCrType yuv_type) +{ +#ifdef __SSE2__ + if (!SDL_HasSSE2()) { + return SDL_FALSE; + } + + if (src_format == SDL_PIXELFORMAT_YV12 || + src_format == SDL_PIXELFORMAT_IYUV) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB565: + yuv420_rgb565_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB24: + yuv420_rgb24_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuv420_rgba_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuv420_bgra_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuv420_argb_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuv420_abgr_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } + + if (src_format == SDL_PIXELFORMAT_YUY2 || + src_format == SDL_PIXELFORMAT_UYVY || + src_format == SDL_PIXELFORMAT_YVYU) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB565: + yuv422_rgb565_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB24: + yuv422_rgb24_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuv422_rgba_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuv422_bgra_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuv422_argb_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuv422_abgr_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } + + if (src_format == SDL_PIXELFORMAT_NV12 || + src_format == SDL_PIXELFORMAT_NV21) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB565: + yuvnv12_rgb565_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB24: + yuvnv12_rgb24_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuvnv12_rgba_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuvnv12_bgra_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuvnv12_argb_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuvnv12_abgr_sseu(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } +#endif + return SDL_FALSE; +} + +static SDL_bool yuv_rgb_std( + Uint32 src_format, Uint32 dst_format, + Uint32 width, Uint32 height, + const Uint8 *y, const Uint8 *u, const Uint8 *v, Uint32 y_stride, Uint32 uv_stride, + Uint8 *rgb, Uint32 rgb_stride, + YCbCrType yuv_type) +{ + if (src_format == SDL_PIXELFORMAT_YV12 || + src_format == SDL_PIXELFORMAT_IYUV) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB565: + yuv420_rgb565_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB24: + yuv420_rgb24_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuv420_rgba_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuv420_bgra_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuv420_argb_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuv420_abgr_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } + + if (src_format == SDL_PIXELFORMAT_YUY2 || + src_format == SDL_PIXELFORMAT_UYVY || + src_format == SDL_PIXELFORMAT_YVYU) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB565: + yuv422_rgb565_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB24: + yuv422_rgb24_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuv422_rgba_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuv422_bgra_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuv422_argb_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuv422_abgr_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } + + if (src_format == SDL_PIXELFORMAT_NV12 || + src_format == SDL_PIXELFORMAT_NV21) { + + switch (dst_format) { + case SDL_PIXELFORMAT_RGB565: + yuvnv12_rgb565_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB24: + yuvnv12_rgb24_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGBX8888: + case SDL_PIXELFORMAT_RGBA8888: + yuvnv12_rgba_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGRX8888: + case SDL_PIXELFORMAT_BGRA8888: + yuvnv12_bgra_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_ARGB8888: + yuvnv12_argb_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_ABGR8888: + yuvnv12_abgr_std(width, height, y, u, v, y_stride, uv_stride, rgb, rgb_stride, yuv_type); + return SDL_TRUE; + default: + break; + } + } + return SDL_FALSE; +} + +int +SDL_ConvertPixels_YUV_to_RGB(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ + const Uint8 *y = NULL; + const Uint8 *u = NULL; + const Uint8 *v = NULL; + Uint32 y_stride = 0; + Uint32 uv_stride = 0; + YCbCrType yuv_type = YCBCR_601; + + if (GetYUVPlanes(width, height, src_format, src, src_pitch, &y, &u, &v, &y_stride, &uv_stride) < 0) { + return -1; + } + + if (GetYUVConversionType(width, height, &yuv_type) < 0) { + return -1; + } + + if (yuv_rgb_sse(src_format, dst_format, width, height, y, u, v, y_stride, uv_stride, (Uint8*)dst, dst_pitch, yuv_type)) { + return 0; + } + + if (yuv_rgb_std(src_format, dst_format, width, height, y, u, v, y_stride, uv_stride, (Uint8*)dst, dst_pitch, yuv_type)) { + return 0; + } + + /* No fast path for the RGB format, instead convert using an intermediate buffer */ + if (dst_format != SDL_PIXELFORMAT_ARGB8888) { + int ret; + void *tmp; + int tmp_pitch = (width * sizeof(Uint32)); + + tmp = SDL_malloc(tmp_pitch * height); + if (tmp == NULL) { + return SDL_OutOfMemory(); + } + + /* convert src/src_format to tmp/ARGB8888 */ + ret = SDL_ConvertPixels_YUV_to_RGB(width, height, src_format, src, src_pitch, SDL_PIXELFORMAT_ARGB8888, tmp, tmp_pitch); + if (ret < 0) { + SDL_free(tmp); + return ret; + } + + /* convert tmp/ARGB8888 to dst/RGB */ + ret = SDL_ConvertPixels(width, height, SDL_PIXELFORMAT_ARGB8888, tmp, tmp_pitch, dst_format, dst, dst_pitch); + SDL_free(tmp); + return ret; + } + + return SDL_SetError("Unsupported YUV conversion"); +} + +struct RGB2YUVFactors +{ + int y_offset; + float y[3]; /* Rfactor, Gfactor, Bfactor */ + float u[3]; /* Rfactor, Gfactor, Bfactor */ + float v[3]; /* Rfactor, Gfactor, Bfactor */ +}; + +static int +SDL_ConvertPixels_ARGB8888_to_YUV(int width, int height, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch) +{ + const int src_pitch_x_2 = src_pitch * 2; + const int height_half = height / 2; + const int height_remainder = (height & 0x1); + const int width_half = width / 2; + const int width_remainder = (width & 0x1); + int i, j; + + static struct RGB2YUVFactors RGB2YUVFactorTables[SDL_YUV_CONVERSION_BT709 + 1] = + { + /* ITU-T T.871 (JPEG) */ + { + 0, + { 0.2990f, 0.5870f, 0.1140f }, + { -0.1687f, -0.3313f, 0.5000f }, + { 0.5000f, -0.4187f, -0.0813f }, + }, + /* ITU-R BT.601-7 */ + { + 16, + { 0.2568f, 0.5041f, 0.0979f }, + { -0.1482f, -0.2910f, 0.4392f }, + { 0.4392f, -0.3678f, -0.0714f }, + }, + /* ITU-R BT.709-6 */ + { + 16, + { 0.1826f, 0.6142f, 0.0620f }, + {-0.1006f, -0.3386f, 0.4392f }, + { 0.4392f, -0.3989f, -0.0403f }, + }, + }; + const struct RGB2YUVFactors *cvt = &RGB2YUVFactorTables[SDL_GetYUVConversionModeForResolution(width, height)]; + +#define MAKE_Y(r, g, b) (Uint8)((int)(cvt->y[0] * (r) + cvt->y[1] * (g) + cvt->y[2] * (b) + 0.5f) + cvt->y_offset) +#define MAKE_U(r, g, b) (Uint8)((int)(cvt->u[0] * (r) + cvt->u[1] * (g) + cvt->u[2] * (b) + 0.5f) + 128) +#define MAKE_V(r, g, b) (Uint8)((int)(cvt->v[0] * (r) + cvt->v[1] * (g) + cvt->v[2] * (b) + 0.5f) + 128) + +#define READ_2x2_PIXELS \ + const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i]; \ + const Uint32 p2 = ((const Uint32 *)curr_row)[2 * i + 1]; \ + const Uint32 p3 = ((const Uint32 *)next_row)[2 * i]; \ + const Uint32 p4 = ((const Uint32 *)next_row)[2 * i + 1]; \ + const Uint32 r = ((p1 & 0x00ff0000) + (p2 & 0x00ff0000) + (p3 & 0x00ff0000) + (p4 & 0x00ff0000)) >> 18; \ + const Uint32 g = ((p1 & 0x0000ff00) + (p2 & 0x0000ff00) + (p3 & 0x0000ff00) + (p4 & 0x0000ff00)) >> 10; \ + const Uint32 b = ((p1 & 0x000000ff) + (p2 & 0x000000ff) + (p3 & 0x000000ff) + (p4 & 0x000000ff)) >> 2; \ + +#define READ_2x1_PIXELS \ + const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i]; \ + const Uint32 p2 = ((const Uint32 *)next_row)[2 * i]; \ + const Uint32 r = ((p1 & 0x00ff0000) + (p2 & 0x00ff0000)) >> 17; \ + const Uint32 g = ((p1 & 0x0000ff00) + (p2 & 0x0000ff00)) >> 9; \ + const Uint32 b = ((p1 & 0x000000ff) + (p2 & 0x000000ff)) >> 1; \ + +#define READ_1x2_PIXELS \ + const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i]; \ + const Uint32 p2 = ((const Uint32 *)curr_row)[2 * i + 1]; \ + const Uint32 r = ((p1 & 0x00ff0000) + (p2 & 0x00ff0000)) >> 17; \ + const Uint32 g = ((p1 & 0x0000ff00) + (p2 & 0x0000ff00)) >> 9; \ + const Uint32 b = ((p1 & 0x000000ff) + (p2 & 0x000000ff)) >> 1; \ + +#define READ_1x1_PIXEL \ + const Uint32 p = ((const Uint32 *)curr_row)[2 * i]; \ + const Uint32 r = (p & 0x00ff0000) >> 16; \ + const Uint32 g = (p & 0x0000ff00) >> 8; \ + const Uint32 b = (p & 0x000000ff); \ + +#define READ_TWO_RGB_PIXELS \ + const Uint32 p = ((const Uint32 *)curr_row)[2 * i]; \ + const Uint32 r = (p & 0x00ff0000) >> 16; \ + const Uint32 g = (p & 0x0000ff00) >> 8; \ + const Uint32 b = (p & 0x000000ff); \ + const Uint32 p1 = ((const Uint32 *)curr_row)[2 * i + 1]; \ + const Uint32 r1 = (p1 & 0x00ff0000) >> 16; \ + const Uint32 g1 = (p1 & 0x0000ff00) >> 8; \ + const Uint32 b1 = (p1 & 0x000000ff); \ + const Uint32 R = (r + r1)/2; \ + const Uint32 G = (g + g1)/2; \ + const Uint32 B = (b + b1)/2; \ + +#define READ_ONE_RGB_PIXEL READ_1x1_PIXEL + + switch (dst_format) + { + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + { + const Uint8 *curr_row, *next_row; + + Uint8 *plane_y; + Uint8 *plane_u; + Uint8 *plane_v; + Uint8 *plane_interleaved_uv; + Uint32 y_stride, uv_stride, y_skip, uv_skip; + + GetYUVPlanes(width, height, dst_format, dst, dst_pitch, + (const Uint8 **)&plane_y, (const Uint8 **)&plane_u, (const Uint8 **)&plane_v, + &y_stride, &uv_stride); + plane_interleaved_uv = (plane_y + height * y_stride); + y_skip = (y_stride - width); + + curr_row = (const Uint8*)src; + + /* Write Y plane */ + for (j = 0; j < height; j++) { + for (i = 0; i < width; i++) { + const Uint32 p1 = ((const Uint32 *)curr_row)[i]; + const Uint32 r = (p1 & 0x00ff0000) >> 16; + const Uint32 g = (p1 & 0x0000ff00) >> 8; + const Uint32 b = (p1 & 0x000000ff); + *plane_y++ = MAKE_Y(r, g, b); + } + plane_y += y_skip; + curr_row += src_pitch; + } + + curr_row = (const Uint8*)src; + next_row = (const Uint8*)src; + next_row += src_pitch; + + if (dst_format == SDL_PIXELFORMAT_YV12 || dst_format == SDL_PIXELFORMAT_IYUV) + { + /* Write UV planes, not interleaved */ + uv_skip = (uv_stride - (width + 1)/2); + for (j = 0; j < height_half; j++) { + for (i = 0; i < width_half; i++) { + READ_2x2_PIXELS; + *plane_u++ = MAKE_U(r, g, b); + *plane_v++ = MAKE_V(r, g, b); + } + if (width_remainder) { + READ_2x1_PIXELS; + *plane_u++ = MAKE_U(r, g, b); + *plane_v++ = MAKE_V(r, g, b); + } + plane_u += uv_skip; + plane_v += uv_skip; + curr_row += src_pitch_x_2; + next_row += src_pitch_x_2; + } + if (height_remainder) { + for (i = 0; i < width_half; i++) { + READ_1x2_PIXELS; + *plane_u++ = MAKE_U(r, g, b); + *plane_v++ = MAKE_V(r, g, b); + } + if (width_remainder) { + READ_1x1_PIXEL; + *plane_u++ = MAKE_U(r, g, b); + *plane_v++ = MAKE_V(r, g, b); + } + plane_u += uv_skip; + plane_v += uv_skip; + } + } + else if (dst_format == SDL_PIXELFORMAT_NV12) + { + uv_skip = (uv_stride - ((width + 1)/2)*2); + for (j = 0; j < height_half; j++) { + for (i = 0; i < width_half; i++) { + READ_2x2_PIXELS; + *plane_interleaved_uv++ = MAKE_U(r, g, b); + *plane_interleaved_uv++ = MAKE_V(r, g, b); + } + if (width_remainder) { + READ_2x1_PIXELS; + *plane_interleaved_uv++ = MAKE_U(r, g, b); + *plane_interleaved_uv++ = MAKE_V(r, g, b); + } + plane_interleaved_uv += uv_skip; + curr_row += src_pitch_x_2; + next_row += src_pitch_x_2; + } + if (height_remainder) { + for (i = 0; i < width_half; i++) { + READ_1x2_PIXELS; + *plane_interleaved_uv++ = MAKE_U(r, g, b); + *plane_interleaved_uv++ = MAKE_V(r, g, b); + } + if (width_remainder) { + READ_1x1_PIXEL; + *plane_interleaved_uv++ = MAKE_U(r, g, b); + *plane_interleaved_uv++ = MAKE_V(r, g, b); + } + } + } + else /* dst_format == SDL_PIXELFORMAT_NV21 */ + { + uv_skip = (uv_stride - ((width + 1)/2)*2); + for (j = 0; j < height_half; j++) { + for (i = 0; i < width_half; i++) { + READ_2x2_PIXELS; + *plane_interleaved_uv++ = MAKE_V(r, g, b); + *plane_interleaved_uv++ = MAKE_U(r, g, b); + } + if (width_remainder) { + READ_2x1_PIXELS; + *plane_interleaved_uv++ = MAKE_V(r, g, b); + *plane_interleaved_uv++ = MAKE_U(r, g, b); + } + plane_interleaved_uv += uv_skip; + curr_row += src_pitch_x_2; + next_row += src_pitch_x_2; + } + if (height_remainder) { + for (i = 0; i < width_half; i++) { + READ_1x2_PIXELS; + *plane_interleaved_uv++ = MAKE_V(r, g, b); + *plane_interleaved_uv++ = MAKE_U(r, g, b); + } + if (width_remainder) { + READ_1x1_PIXEL; + *plane_interleaved_uv++ = MAKE_V(r, g, b); + *plane_interleaved_uv++ = MAKE_U(r, g, b); + } + } + } + } + break; + + case SDL_PIXELFORMAT_YUY2: + case SDL_PIXELFORMAT_UYVY: + case SDL_PIXELFORMAT_YVYU: + { + const Uint8 *curr_row = (const Uint8*) src; + Uint8 *plane = (Uint8*) dst; + const int row_size = (4 * ((width + 1) / 2)); + int plane_skip; + + if (dst_pitch < row_size) { + return SDL_SetError("Destination pitch is too small, expected at least %d\n", row_size); + } + plane_skip = (dst_pitch - row_size); + + /* Write YUV plane, packed */ + if (dst_format == SDL_PIXELFORMAT_YUY2) + { + for (j = 0; j < height; j++) { + for (i = 0; i < width_half; i++) { + READ_TWO_RGB_PIXELS; + /* Y U Y1 V */ + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_U(R, G, B); + *plane++ = MAKE_Y(r1, g1, b1); + *plane++ = MAKE_V(R, G, B); + } + if (width_remainder) { + READ_ONE_RGB_PIXEL; + /* Y U Y V */ + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_U(r, g, b); + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_V(r, g, b); + } + plane += plane_skip; + curr_row += src_pitch; + } + } + else if (dst_format == SDL_PIXELFORMAT_UYVY) + { + for (j = 0; j < height; j++) { + for (i = 0; i < width_half; i++) { + READ_TWO_RGB_PIXELS; + /* U Y V Y1 */ + *plane++ = MAKE_U(R, G, B); + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_V(R, G, B); + *plane++ = MAKE_Y(r1, g1, b1); + } + if (width_remainder) { + READ_ONE_RGB_PIXEL; + /* U Y V Y */ + *plane++ = MAKE_U(r, g, b); + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_V(r, g, b); + *plane++ = MAKE_Y(r, g, b); + } + plane += plane_skip; + curr_row += src_pitch; + } + } + else if (dst_format == SDL_PIXELFORMAT_YVYU) + { + for (j = 0; j < height; j++) { + for (i = 0; i < width_half; i++) { + READ_TWO_RGB_PIXELS; + /* Y V Y1 U */ + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_V(R, G, B); + *plane++ = MAKE_Y(r1, g1, b1); + *plane++ = MAKE_U(R, G, B); + } + if (width_remainder) { + READ_ONE_RGB_PIXEL; + /* Y V Y U */ + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_V(r, g, b); + *plane++ = MAKE_Y(r, g, b); + *plane++ = MAKE_U(r, g, b); + } + plane += plane_skip; + curr_row += src_pitch; + } + } + } + break; + + default: + return SDL_SetError("Unsupported YUV destination format: %s", SDL_GetPixelFormatName(dst_format)); + } +#undef MAKE_Y +#undef MAKE_U +#undef MAKE_V +#undef READ_2x2_PIXELS +#undef READ_2x1_PIXELS +#undef READ_1x2_PIXELS +#undef READ_1x1_PIXEL +#undef READ_TWO_RGB_PIXELS +#undef READ_ONE_RGB_PIXEL + return 0; +} + +int +SDL_ConvertPixels_RGB_to_YUV(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ +#if 0 /* Doesn't handle odd widths */ + /* RGB24 to FOURCC */ + if (src_format == SDL_PIXELFORMAT_RGB24) { + Uint8 *y; + Uint8 *u; + Uint8 *v; + Uint32 y_stride; + Uint32 uv_stride; + YCbCrType yuv_type; + + if (GetYUVPlanes(width, height, dst_format, dst, dst_pitch, (const Uint8 **)&y, (const Uint8 **)&u, (const Uint8 **)&v, &y_stride, &uv_stride) < 0) { + return -1; + } + + if (GetYUVConversionType(width, height, &yuv_type) < 0) { + return -1; + } + + rgb24_yuv420_std(width, height, src, src_pitch, y, u, v, y_stride, uv_stride, yuv_type); + return 0; + } +#endif + + /* ARGB8888 to FOURCC */ + if (src_format == SDL_PIXELFORMAT_ARGB8888) { + return SDL_ConvertPixels_ARGB8888_to_YUV(width, height, src, src_pitch, dst_format, dst, dst_pitch); + } + + /* not ARGB8888 to FOURCC : need an intermediate conversion */ + { + int ret; + void *tmp; + int tmp_pitch = (width * sizeof(Uint32)); + + tmp = SDL_malloc(tmp_pitch * height); + if (tmp == NULL) { + return SDL_OutOfMemory(); + } + + /* convert src/src_format to tmp/ARGB8888 */ + ret = SDL_ConvertPixels(width, height, src_format, src, src_pitch, SDL_PIXELFORMAT_ARGB8888, tmp, tmp_pitch); + if (ret == -1) { + SDL_free(tmp); + return ret; + } + + /* convert tmp/ARGB8888 to dst/FOURCC */ + ret = SDL_ConvertPixels_ARGB8888_to_YUV(width, height, tmp, tmp_pitch, dst_format, dst, dst_pitch); + SDL_free(tmp); + return ret; + } +} + +static int +SDL_ConvertPixels_YUV_to_YUV_Copy(int width, int height, Uint32 format, + const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int i; + + if (IsPlanar2x2Format(format)) { + /* Y plane */ + for (i = height; i--;) { + SDL_memcpy(dst, src, width); + src = (const Uint8*)src + src_pitch; + dst = (Uint8*)dst + dst_pitch; + } + + if (format == SDL_PIXELFORMAT_YV12 || format == SDL_PIXELFORMAT_IYUV) { + /* U and V planes are a quarter the size of the Y plane, rounded up */ + width = (width + 1) / 2; + height = (height + 1) / 2; + src_pitch = (src_pitch + 1) / 2; + dst_pitch = (dst_pitch + 1) / 2; + for (i = height * 2; i--;) { + SDL_memcpy(dst, src, width); + src = (const Uint8*)src + src_pitch; + dst = (Uint8*)dst + dst_pitch; + } + } else if (format == SDL_PIXELFORMAT_NV12 || format == SDL_PIXELFORMAT_NV21) { + /* U/V plane is half the height of the Y plane, rounded up */ + height = (height + 1) / 2; + width = ((width + 1) / 2)*2; + src_pitch = ((src_pitch + 1) / 2)*2; + dst_pitch = ((dst_pitch + 1) / 2)*2; + for (i = height; i--;) { + SDL_memcpy(dst, src, width); + src = (const Uint8*)src + src_pitch; + dst = (Uint8*)dst + dst_pitch; + } + } + return 0; + } + + if (IsPacked4Format(format)) { + /* Packed planes */ + width = 4 * ((width + 1) / 2); + for (i = height; i--;) { + SDL_memcpy(dst, src, width); + src = (const Uint8*)src + src_pitch; + dst = (Uint8*)dst + dst_pitch; + } + return 0; + } + + return SDL_SetError("SDL_ConvertPixels_YUV_to_YUV_Copy: Unsupported YUV format: %s", SDL_GetPixelFormatName(format)); +} + +static int +SDL_ConvertPixels_SwapUVPlanes(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int y; + const int UVwidth = (width + 1)/2; + const int UVheight = (height + 1)/2; + + /* Skip the Y plane */ + src = (const Uint8 *)src + height * src_pitch; + dst = (Uint8 *)dst + height * dst_pitch; + + if (src == dst) { + int UVpitch = (dst_pitch + 1)/2; + Uint8 *tmp; + Uint8 *row1 = dst; + Uint8 *row2 = (Uint8 *)dst + UVheight * UVpitch; + + /* Allocate a temporary row for the swap */ + tmp = (Uint8 *)SDL_malloc(UVwidth); + if (!tmp) { + return SDL_OutOfMemory(); + } + for (y = 0; y < UVheight; ++y) { + SDL_memcpy(tmp, row1, UVwidth); + SDL_memcpy(row1, row2, UVwidth); + SDL_memcpy(row2, tmp, UVwidth); + row1 += UVpitch; + row2 += UVpitch; + } + SDL_free(tmp); + } else { + const Uint8 *srcUV; + Uint8 *dstUV; + int srcUVPitch = ((src_pitch + 1)/2); + int dstUVPitch = ((dst_pitch + 1)/2); + + /* Copy the first plane */ + srcUV = (const Uint8 *)src; + dstUV = (Uint8 *)dst + UVheight * dstUVPitch; + for (y = 0; y < UVheight; ++y) { + SDL_memcpy(dstUV, srcUV, UVwidth); + srcUV += srcUVPitch; + dstUV += dstUVPitch; + } + + /* Copy the second plane */ + dstUV = (Uint8 *)dst; + for (y = 0; y < UVheight; ++y) { + SDL_memcpy(dstUV, srcUV, UVwidth); + srcUV += srcUVPitch; + dstUV += dstUVPitch; + } + } + return 0; +} + +static int +SDL_ConvertPixels_PackUVPlanes_to_NV(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV) +{ + int x, y; + const int UVwidth = (width + 1)/2; + const int UVheight = (height + 1)/2; + const int srcUVPitch = ((src_pitch + 1)/2); + const int srcUVPitchLeft = srcUVPitch - UVwidth; + const int dstUVPitch = ((dst_pitch + 1)/2)*2; + const int dstUVPitchLeft = dstUVPitch - UVwidth*2; + const Uint8 *src1, *src2; + Uint8 *dstUV; + Uint8 *tmp = NULL; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + /* Skip the Y plane */ + src = (const Uint8 *)src + height * src_pitch; + dst = (Uint8 *)dst + height * dst_pitch; + + if (src == dst) { + /* Need to make a copy of the buffer so we don't clobber it while converting */ + tmp = (Uint8 *)SDL_malloc(2*UVheight*srcUVPitch); + if (!tmp) { + return SDL_OutOfMemory(); + } + SDL_memcpy(tmp, src, 2*UVheight*srcUVPitch); + src = tmp; + } + + if (reverseUV) { + src2 = (const Uint8 *)src; + src1 = src2 + UVheight * srcUVPitch; + } else { + src1 = (const Uint8 *)src; + src2 = src1 + UVheight * srcUVPitch; + } + dstUV = (Uint8 *)dst; + + y = UVheight; + while (y--) { + x = UVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + while (x >= 16) { + __m128i u = _mm_loadu_si128((__m128i *)src1); + __m128i v = _mm_loadu_si128((__m128i *)src2); + __m128i uv1 = _mm_unpacklo_epi8(u, v); + __m128i uv2 = _mm_unpackhi_epi8(u, v); + _mm_storeu_si128((__m128i*)dstUV, uv1); + _mm_storeu_si128((__m128i*)(dstUV + 16), uv2); + src1 += 16; + src2 += 16; + dstUV += 32; + x -= 16; + } + } +#endif + while (x--) { + *dstUV++ = *src1++; + *dstUV++ = *src2++; + } + src1 += srcUVPitchLeft; + src2 += srcUVPitchLeft; + dstUV += dstUVPitchLeft; + } + + if (tmp) { + SDL_free(tmp); + } + return 0; +} + +static int +SDL_ConvertPixels_SplitNV_to_UVPlanes(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch, SDL_bool reverseUV) +{ + int x, y; + const int UVwidth = (width + 1)/2; + const int UVheight = (height + 1)/2; + const int srcUVPitch = ((src_pitch + 1)/2)*2; + const int srcUVPitchLeft = srcUVPitch - UVwidth*2; + const int dstUVPitch = ((dst_pitch + 1)/2); + const int dstUVPitchLeft = dstUVPitch - UVwidth; + const Uint8 *srcUV; + Uint8 *dst1, *dst2; + Uint8 *tmp = NULL; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + /* Skip the Y plane */ + src = (const Uint8 *)src + height * src_pitch; + dst = (Uint8 *)dst + height * dst_pitch; + + if (src == dst) { + /* Need to make a copy of the buffer so we don't clobber it while converting */ + tmp = (Uint8 *)SDL_malloc(UVheight*srcUVPitch); + if (!tmp) { + return SDL_OutOfMemory(); + } + SDL_memcpy(tmp, src, UVheight*srcUVPitch); + src = tmp; + } + + if (reverseUV) { + dst2 = (Uint8 *)dst; + dst1 = dst2 + UVheight * dstUVPitch; + } else { + dst1 = (Uint8 *)dst; + dst2 = dst1 + UVheight * dstUVPitch; + } + srcUV = (const Uint8 *)src; + + y = UVheight; + while (y--) { + x = UVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + __m128i mask = _mm_set1_epi16(0x00FF); + while (x >= 16) { + __m128i uv1 = _mm_loadu_si128((__m128i*)srcUV); + __m128i uv2 = _mm_loadu_si128((__m128i*)(srcUV+16)); + __m128i u1 = _mm_and_si128(uv1, mask); + __m128i u2 = _mm_and_si128(uv2, mask); + __m128i u = _mm_packus_epi16(u1, u2); + __m128i v1 = _mm_srli_epi16(uv1, 8); + __m128i v2 = _mm_srli_epi16(uv2, 8); + __m128i v = _mm_packus_epi16(v1, v2); + _mm_storeu_si128((__m128i*)dst1, u); + _mm_storeu_si128((__m128i*)dst2, v); + srcUV += 32; + dst1 += 16; + dst2 += 16; + x -= 16; + } + } +#endif + while (x--) { + *dst1++ = *srcUV++; + *dst2++ = *srcUV++; + } + srcUV += srcUVPitchLeft; + dst1 += dstUVPitchLeft; + dst2 += dstUVPitchLeft; + } + + if (tmp) { + SDL_free(tmp); + } + return 0; +} + +static int +SDL_ConvertPixels_SwapNV(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int UVwidth = (width + 1)/2; + const int UVheight = (height + 1)/2; + const int srcUVPitch = ((src_pitch + 1)/2)*2; + const int srcUVPitchLeft = (srcUVPitch - UVwidth*2)/sizeof(Uint16); + const int dstUVPitch = ((dst_pitch + 1)/2)*2; + const int dstUVPitchLeft = (dstUVPitch - UVwidth*2)/sizeof(Uint16); + const Uint16 *srcUV; + Uint16 *dstUV; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + /* Skip the Y plane */ + src = (const Uint8 *)src + height * src_pitch; + dst = (Uint8 *)dst + height * dst_pitch; + + srcUV = (const Uint16 *)src; + dstUV = (Uint16 *)dst; + y = UVheight; + while (y--) { + x = UVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + while (x >= 8) { + __m128i uv = _mm_loadu_si128((__m128i*)srcUV); + __m128i v = _mm_slli_epi16(uv, 8); + __m128i u = _mm_srli_epi16(uv, 8); + __m128i vu = _mm_or_si128(v, u); + _mm_storeu_si128((__m128i*)dstUV, vu); + srcUV += 8; + dstUV += 8; + x -= 8; + } + } +#endif + while (x--) { + *dstUV++ = SDL_Swap16(*srcUV++); + } + srcUV += srcUVPitchLeft; + dstUV += dstUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_Planar2x2_to_Planar2x2(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ + if (src != dst) { + /* Copy Y plane */ + int i; + const Uint8 *srcY = (const Uint8 *)src; + Uint8 *dstY = (Uint8 *)dst; + for (i = height; i--; ) { + SDL_memcpy(dstY, srcY, width); + srcY += src_pitch; + dstY += dst_pitch; + } + } + + switch (src_format) { + case SDL_PIXELFORMAT_YV12: + switch (dst_format) { + case SDL_PIXELFORMAT_IYUV: + return SDL_ConvertPixels_SwapUVPlanes(width, height, src, src_pitch, dst, dst_pitch); + case SDL_PIXELFORMAT_NV12: + return SDL_ConvertPixels_PackUVPlanes_to_NV(width, height, src, src_pitch, dst, dst_pitch, SDL_TRUE); + case SDL_PIXELFORMAT_NV21: + return SDL_ConvertPixels_PackUVPlanes_to_NV(width, height, src, src_pitch, dst, dst_pitch, SDL_FALSE); + default: + break; + } + break; + case SDL_PIXELFORMAT_IYUV: + switch (dst_format) { + case SDL_PIXELFORMAT_YV12: + return SDL_ConvertPixels_SwapUVPlanes(width, height, src, src_pitch, dst, dst_pitch); + case SDL_PIXELFORMAT_NV12: + return SDL_ConvertPixels_PackUVPlanes_to_NV(width, height, src, src_pitch, dst, dst_pitch, SDL_FALSE); + case SDL_PIXELFORMAT_NV21: + return SDL_ConvertPixels_PackUVPlanes_to_NV(width, height, src, src_pitch, dst, dst_pitch, SDL_TRUE); + default: + break; + } + break; + case SDL_PIXELFORMAT_NV12: + switch (dst_format) { + case SDL_PIXELFORMAT_YV12: + return SDL_ConvertPixels_SplitNV_to_UVPlanes(width, height, src, src_pitch, dst, dst_pitch, SDL_TRUE); + case SDL_PIXELFORMAT_IYUV: + return SDL_ConvertPixels_SplitNV_to_UVPlanes(width, height, src, src_pitch, dst, dst_pitch, SDL_FALSE); + case SDL_PIXELFORMAT_NV21: + return SDL_ConvertPixels_SwapNV(width, height, src, src_pitch, dst, dst_pitch); + default: + break; + } + break; + case SDL_PIXELFORMAT_NV21: + switch (dst_format) { + case SDL_PIXELFORMAT_YV12: + return SDL_ConvertPixels_SplitNV_to_UVPlanes(width, height, src, src_pitch, dst, dst_pitch, SDL_FALSE); + case SDL_PIXELFORMAT_IYUV: + return SDL_ConvertPixels_SplitNV_to_UVPlanes(width, height, src, src_pitch, dst, dst_pitch, SDL_TRUE); + case SDL_PIXELFORMAT_NV12: + return SDL_ConvertPixels_SwapNV(width, height, src, src_pitch, dst, dst_pitch); + default: + break; + } + break; + default: + break; + } + return SDL_SetError("SDL_ConvertPixels_Planar2x2_to_Planar2x2: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format), SDL_GetPixelFormatName(dst_format)); +} + +#define PACKED4_TO_PACKED4_ROW_SSE2(shuffle) \ + while (x >= 4) { \ + __m128i yuv = _mm_loadu_si128((__m128i*)srcYUV); \ + __m128i lo = _mm_unpacklo_epi8(yuv, _mm_setzero_si128()); \ + __m128i hi = _mm_unpackhi_epi8(yuv, _mm_setzero_si128()); \ + lo = _mm_shufflelo_epi16(lo, shuffle); \ + lo = _mm_shufflehi_epi16(lo, shuffle); \ + hi = _mm_shufflelo_epi16(hi, shuffle); \ + hi = _mm_shufflehi_epi16(hi, shuffle); \ + yuv = _mm_packus_epi16(lo, hi); \ + _mm_storeu_si128((__m128i*)dstYUV, yuv); \ + srcYUV += 16; \ + dstYUV += 16; \ + x -= 4; \ + } \ + +static int +SDL_ConvertPixels_YUY2_to_UYVY(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int YUVwidth = (width + 1)/2; + const int srcYUVPitchLeft = (src_pitch - YUVwidth*4); + const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4); + const Uint8 *srcYUV = (const Uint8 *)src; + Uint8 *dstYUV = (Uint8 *)dst; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + y = height; + while (y--) { + x = YUVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(2, 3, 0, 1)); + } +#endif + while (x--) { + Uint8 Y1, U, Y2, V; + + Y1 = srcYUV[0]; + U = srcYUV[1]; + Y2 = srcYUV[2]; + V = srcYUV[3]; + srcYUV += 4; + + dstYUV[0] = U; + dstYUV[1] = Y1; + dstYUV[2] = V; + dstYUV[3] = Y2; + dstYUV += 4; + } + srcYUV += srcYUVPitchLeft; + dstYUV += dstYUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_YUY2_to_YVYU(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int YUVwidth = (width + 1)/2; + const int srcYUVPitchLeft = (src_pitch - YUVwidth*4); + const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4); + const Uint8 *srcYUV = (const Uint8 *)src; + Uint8 *dstYUV = (Uint8 *)dst; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + y = height; + while (y--) { + x = YUVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(1, 2, 3, 0)); + } +#endif + while (x--) { + Uint8 Y1, U, Y2, V; + + Y1 = srcYUV[0]; + U = srcYUV[1]; + Y2 = srcYUV[2]; + V = srcYUV[3]; + srcYUV += 4; + + dstYUV[0] = Y1; + dstYUV[1] = V; + dstYUV[2] = Y2; + dstYUV[3] = U; + dstYUV += 4; + } + srcYUV += srcYUVPitchLeft; + dstYUV += dstYUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_UYVY_to_YUY2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int YUVwidth = (width + 1)/2; + const int srcYUVPitchLeft = (src_pitch - YUVwidth*4); + const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4); + const Uint8 *srcYUV = (const Uint8 *)src; + Uint8 *dstYUV = (Uint8 *)dst; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + y = height; + while (y--) { + x = YUVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(2, 3, 0, 1)); + } +#endif + while (x--) { + Uint8 Y1, U, Y2, V; + + U = srcYUV[0]; + Y1 = srcYUV[1]; + V = srcYUV[2]; + Y2 = srcYUV[3]; + srcYUV += 4; + + dstYUV[0] = Y1; + dstYUV[1] = U; + dstYUV[2] = Y2; + dstYUV[3] = V; + dstYUV += 4; + } + srcYUV += srcYUVPitchLeft; + dstYUV += dstYUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_UYVY_to_YVYU(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int YUVwidth = (width + 1)/2; + const int srcYUVPitchLeft = (src_pitch - YUVwidth*4); + const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4); + const Uint8 *srcYUV = (const Uint8 *)src; + Uint8 *dstYUV = (Uint8 *)dst; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + y = height; + while (y--) { + x = YUVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(0, 3, 2, 1)); + } +#endif + while (x--) { + Uint8 Y1, U, Y2, V; + + U = srcYUV[0]; + Y1 = srcYUV[1]; + V = srcYUV[2]; + Y2 = srcYUV[3]; + srcYUV += 4; + + dstYUV[0] = Y1; + dstYUV[1] = V; + dstYUV[2] = Y2; + dstYUV[3] = U; + dstYUV += 4; + } + srcYUV += srcYUVPitchLeft; + dstYUV += dstYUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_YVYU_to_YUY2(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int YUVwidth = (width + 1)/2; + const int srcYUVPitchLeft = (src_pitch - YUVwidth*4); + const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4); + const Uint8 *srcYUV = (const Uint8 *)src; + Uint8 *dstYUV = (Uint8 *)dst; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + y = height; + while (y--) { + x = YUVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(1, 2, 3, 0)); + } +#endif + while (x--) { + Uint8 Y1, U, Y2, V; + + Y1 = srcYUV[0]; + V = srcYUV[1]; + Y2 = srcYUV[2]; + U = srcYUV[3]; + srcYUV += 4; + + dstYUV[0] = Y1; + dstYUV[1] = U; + dstYUV[2] = Y2; + dstYUV[3] = V; + dstYUV += 4; + } + srcYUV += srcYUVPitchLeft; + dstYUV += dstYUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_YVYU_to_UYVY(int width, int height, const void *src, int src_pitch, void *dst, int dst_pitch) +{ + int x, y; + const int YUVwidth = (width + 1)/2; + const int srcYUVPitchLeft = (src_pitch - YUVwidth*4); + const int dstYUVPitchLeft = (dst_pitch - YUVwidth*4); + const Uint8 *srcYUV = (const Uint8 *)src; + Uint8 *dstYUV = (Uint8 *)dst; +#ifdef __SSE2__ + const SDL_bool use_SSE2 = SDL_HasSSE2(); +#endif + + y = height; + while (y--) { + x = YUVwidth; +#ifdef __SSE2__ + if (use_SSE2) { + PACKED4_TO_PACKED4_ROW_SSE2(_MM_SHUFFLE(2, 1, 0, 3)); + } +#endif + while (x--) { + Uint8 Y1, U, Y2, V; + + Y1 = srcYUV[0]; + V = srcYUV[1]; + Y2 = srcYUV[2]; + U = srcYUV[3]; + srcYUV += 4; + + dstYUV[0] = U; + dstYUV[1] = Y1; + dstYUV[2] = V; + dstYUV[3] = Y2; + dstYUV += 4; + } + srcYUV += srcYUVPitchLeft; + dstYUV += dstYUVPitchLeft; + } + return 0; +} + +static int +SDL_ConvertPixels_Packed4_to_Packed4(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ + switch (src_format) { + case SDL_PIXELFORMAT_YUY2: + switch (dst_format) { + case SDL_PIXELFORMAT_UYVY: + return SDL_ConvertPixels_YUY2_to_UYVY(width, height, src, src_pitch, dst, dst_pitch); + case SDL_PIXELFORMAT_YVYU: + return SDL_ConvertPixels_YUY2_to_YVYU(width, height, src, src_pitch, dst, dst_pitch); + default: + break; + } + break; + case SDL_PIXELFORMAT_UYVY: + switch (dst_format) { + case SDL_PIXELFORMAT_YUY2: + return SDL_ConvertPixels_UYVY_to_YUY2(width, height, src, src_pitch, dst, dst_pitch); + case SDL_PIXELFORMAT_YVYU: + return SDL_ConvertPixels_UYVY_to_YVYU(width, height, src, src_pitch, dst, dst_pitch); + default: + break; + } + break; + case SDL_PIXELFORMAT_YVYU: + switch (dst_format) { + case SDL_PIXELFORMAT_YUY2: + return SDL_ConvertPixels_YVYU_to_YUY2(width, height, src, src_pitch, dst, dst_pitch); + case SDL_PIXELFORMAT_UYVY: + return SDL_ConvertPixels_YVYU_to_UYVY(width, height, src, src_pitch, dst, dst_pitch); + default: + break; + } + break; + default: + break; + } + return SDL_SetError("SDL_ConvertPixels_Packed4_to_Packed4: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format), SDL_GetPixelFormatName(dst_format)); +} + +static int +SDL_ConvertPixels_Planar2x2_to_Packed4(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ + int x, y; + const Uint8 *srcY1, *srcY2, *srcU, *srcV; + Uint32 srcY_pitch, srcUV_pitch; + Uint32 srcY_pitch_left, srcUV_pitch_left, srcUV_pixel_stride; + Uint8 *dstY1, *dstY2, *dstU1, *dstU2, *dstV1, *dstV2; + Uint32 dstY_pitch, dstUV_pitch; + Uint32 dst_pitch_left; + + if (src == dst) { + return SDL_SetError("Can't change YUV plane types in-place"); + } + + if (GetYUVPlanes(width, height, src_format, src, src_pitch, + &srcY1, &srcU, &srcV, &srcY_pitch, &srcUV_pitch) < 0) { + return -1; + } + srcY2 = srcY1 + srcY_pitch; + srcY_pitch_left = (srcY_pitch - width); + + if (src_format == SDL_PIXELFORMAT_NV12 || src_format == SDL_PIXELFORMAT_NV21) { + srcUV_pixel_stride = 2; + srcUV_pitch_left = (srcUV_pitch - 2*((width + 1)/2)); + } else { + srcUV_pixel_stride = 1; + srcUV_pitch_left = (srcUV_pitch - ((width + 1)/2)); + } + + if (GetYUVPlanes(width, height, dst_format, dst, dst_pitch, + (const Uint8 **)&dstY1, (const Uint8 **)&dstU1, (const Uint8 **)&dstV1, + &dstY_pitch, &dstUV_pitch) < 0) { + return -1; + } + dstY2 = dstY1 + dstY_pitch; + dstU2 = dstU1 + dstUV_pitch; + dstV2 = dstV1 + dstUV_pitch; + dst_pitch_left = (dstY_pitch - 4*((width + 1)/2)); + + /* Copy 2x2 blocks of pixels at a time */ + for (y = 0; y < (height - 1); y += 2) { + for (x = 0; x < (width - 1); x += 2) { + /* Row 1 */ + *dstY1 = *srcY1++; + dstY1 += 2; + *dstY1 = *srcY1++; + dstY1 += 2; + *dstU1 = *srcU; + *dstV1 = *srcV; + + /* Row 2 */ + *dstY2 = *srcY2++; + dstY2 += 2; + *dstY2 = *srcY2++; + dstY2 += 2; + *dstU2 = *srcU; + *dstV2 = *srcV; + + srcU += srcUV_pixel_stride; + srcV += srcUV_pixel_stride; + dstU1 += 4; + dstU2 += 4; + dstV1 += 4; + dstV2 += 4; + } + + /* Last column */ + if (x == (width - 1)) { + /* Row 1 */ + *dstY1 = *srcY1; + dstY1 += 2; + *dstY1 = *srcY1++; + dstY1 += 2; + *dstU1 = *srcU; + *dstV1 = *srcV; + + /* Row 2 */ + *dstY2 = *srcY2; + dstY2 += 2; + *dstY2 = *srcY2++; + dstY2 += 2; + *dstU2 = *srcU; + *dstV2 = *srcV; + + srcU += srcUV_pixel_stride; + srcV += srcUV_pixel_stride; + dstU1 += 4; + dstU2 += 4; + dstV1 += 4; + dstV2 += 4; + } + + srcY1 += srcY_pitch_left + srcY_pitch; + srcY2 += srcY_pitch_left + srcY_pitch; + srcU += srcUV_pitch_left; + srcV += srcUV_pitch_left; + dstY1 += dst_pitch_left + dstY_pitch; + dstY2 += dst_pitch_left + dstY_pitch; + dstU1 += dst_pitch_left + dstUV_pitch; + dstU2 += dst_pitch_left + dstUV_pitch; + dstV1 += dst_pitch_left + dstUV_pitch; + dstV2 += dst_pitch_left + dstUV_pitch; + } + + /* Last row */ + if (y == (height - 1)) { + for (x = 0; x < (width - 1); x += 2) { + /* Row 1 */ + *dstY1 = *srcY1++; + dstY1 += 2; + *dstY1 = *srcY1++; + dstY1 += 2; + *dstU1 = *srcU; + *dstV1 = *srcV; + + srcU += srcUV_pixel_stride; + srcV += srcUV_pixel_stride; + dstU1 += 4; + dstV1 += 4; + } + + /* Last column */ + if (x == (width - 1)) { + /* Row 1 */ + *dstY1 = *srcY1; + dstY1 += 2; + *dstY1 = *srcY1++; + dstY1 += 2; + *dstU1 = *srcU; + *dstV1 = *srcV; + + srcU += srcUV_pixel_stride; + srcV += srcUV_pixel_stride; + dstU1 += 4; + dstV1 += 4; + } + } + return 0; +} + +static int +SDL_ConvertPixels_Packed4_to_Planar2x2(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ + int x, y; + const Uint8 *srcY1, *srcY2, *srcU1, *srcU2, *srcV1, *srcV2; + Uint32 srcY_pitch, srcUV_pitch; + Uint32 src_pitch_left; + Uint8 *dstY1, *dstY2, *dstU, *dstV; + Uint32 dstY_pitch, dstUV_pitch; + Uint32 dstY_pitch_left, dstUV_pitch_left, dstUV_pixel_stride; + + if (src == dst) { + return SDL_SetError("Can't change YUV plane types in-place"); + } + + if (GetYUVPlanes(width, height, src_format, src, src_pitch, + &srcY1, &srcU1, &srcV1, &srcY_pitch, &srcUV_pitch) < 0) { + return -1; + } + srcY2 = srcY1 + srcY_pitch; + srcU2 = srcU1 + srcUV_pitch; + srcV2 = srcV1 + srcUV_pitch; + src_pitch_left = (srcY_pitch - 4*((width + 1)/2)); + + if (GetYUVPlanes(width, height, dst_format, dst, dst_pitch, + (const Uint8 **)&dstY1, (const Uint8 **)&dstU, (const Uint8 **)&dstV, + &dstY_pitch, &dstUV_pitch) < 0) { + return -1; + } + dstY2 = dstY1 + dstY_pitch; + dstY_pitch_left = (dstY_pitch - width); + + if (dst_format == SDL_PIXELFORMAT_NV12 || dst_format == SDL_PIXELFORMAT_NV21) { + dstUV_pixel_stride = 2; + dstUV_pitch_left = (dstUV_pitch - 2*((width + 1)/2)); + } else { + dstUV_pixel_stride = 1; + dstUV_pitch_left = (dstUV_pitch - ((width + 1)/2)); + } + + /* Copy 2x2 blocks of pixels at a time */ + for (y = 0; y < (height - 1); y += 2) { + for (x = 0; x < (width - 1); x += 2) { + /* Row 1 */ + *dstY1++ = *srcY1; + srcY1 += 2; + *dstY1++ = *srcY1; + srcY1 += 2; + + /* Row 2 */ + *dstY2++ = *srcY2; + srcY2 += 2; + *dstY2++ = *srcY2; + srcY2 += 2; + + *dstU = (Uint8)(((Uint32)*srcU1 + *srcU2)/2); + *dstV = (Uint8)(((Uint32)*srcV1 + *srcV2)/2); + + srcU1 += 4; + srcU2 += 4; + srcV1 += 4; + srcV2 += 4; + dstU += dstUV_pixel_stride; + dstV += dstUV_pixel_stride; + } + + /* Last column */ + if (x == (width - 1)) { + /* Row 1 */ + *dstY1 = *srcY1; + srcY1 += 2; + *dstY1++ = *srcY1; + srcY1 += 2; + + /* Row 2 */ + *dstY2 = *srcY2; + srcY2 += 2; + *dstY2++ = *srcY2; + srcY2 += 2; + + *dstU = (Uint8)(((Uint32)*srcU1 + *srcU2)/2); + *dstV = (Uint8)(((Uint32)*srcV1 + *srcV2)/2); + + srcU1 += 4; + srcU2 += 4; + srcV1 += 4; + srcV2 += 4; + dstU += dstUV_pixel_stride; + dstV += dstUV_pixel_stride; + } + + srcY1 += src_pitch_left + srcY_pitch; + srcY2 += src_pitch_left + srcY_pitch; + srcU1 += src_pitch_left + srcUV_pitch; + srcU2 += src_pitch_left + srcUV_pitch; + srcV1 += src_pitch_left + srcUV_pitch; + srcV2 += src_pitch_left + srcUV_pitch; + dstY1 += dstY_pitch_left + dstY_pitch; + dstY2 += dstY_pitch_left + dstY_pitch; + dstU += dstUV_pitch_left; + dstV += dstUV_pitch_left; + } + + /* Last row */ + if (y == (height - 1)) { + for (x = 0; x < (width - 1); x += 2) { + *dstY1++ = *srcY1; + srcY1 += 2; + *dstY1++ = *srcY1; + srcY1 += 2; + + *dstU = *srcU1; + *dstV = *srcV1; + + srcU1 += 4; + srcV1 += 4; + dstU += dstUV_pixel_stride; + dstV += dstUV_pixel_stride; + } + + /* Last column */ + if (x == (width - 1)) { + *dstY1 = *srcY1; + *dstU = *srcU1; + *dstV = *srcV1; + } + } + return 0; +} + +int +SDL_ConvertPixels_YUV_to_YUV(int width, int height, + Uint32 src_format, const void *src, int src_pitch, + Uint32 dst_format, void *dst, int dst_pitch) +{ + if (src_format == dst_format) { + if (src == dst) { + /* Nothing to do */ + return 0; + } + return SDL_ConvertPixels_YUV_to_YUV_Copy(width, height, src_format, src, src_pitch, dst, dst_pitch); + } + + if (IsPlanar2x2Format(src_format) && IsPlanar2x2Format(dst_format)) { + return SDL_ConvertPixels_Planar2x2_to_Planar2x2(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } else if (IsPacked4Format(src_format) && IsPacked4Format(dst_format)) { + return SDL_ConvertPixels_Packed4_to_Packed4(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } else if (IsPlanar2x2Format(src_format) && IsPacked4Format(dst_format)) { + return SDL_ConvertPixels_Planar2x2_to_Packed4(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } else if (IsPacked4Format(src_format) && IsPlanar2x2Format(dst_format)) { + return SDL_ConvertPixels_Packed4_to_Planar2x2(width, height, src_format, src, src_pitch, dst_format, dst, dst_pitch); + } else { + return SDL_SetError("SDL_ConvertPixels_YUV_to_YUV: Unsupported YUV conversion: %s -> %s", SDL_GetPixelFormatName(src_format), SDL_GetPixelFormatName(dst_format)); + } +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/SDL_yuv_c.h b/Engine/lib/sdl/src/video/SDL_yuv_c.h new file mode 100644 index 000000000..6fe02b0fc --- /dev/null +++ b/Engine/lib/sdl/src/video/SDL_yuv_c.h @@ -0,0 +1,30 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../SDL_internal.h" + + +/* YUV conversion functions */ + +extern int SDL_ConvertPixels_YUV_to_RGB(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch); +extern int SDL_ConvertPixels_RGB_to_YUV(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch); +extern int SDL_ConvertPixels_YUV_to_YUV(int width, int height, Uint32 src_format, const void *src, int src_pitch, Uint32 dst_format, void *dst, int dst_pitch); + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/android/SDL_androidclipboard.c b/Engine/lib/sdl/src/video/android/SDL_androidclipboard.c index b996e7a40..c913af513 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidclipboard.c +++ b/Engine/lib/sdl/src/video/android/SDL_androidclipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,7 +23,7 @@ #if SDL_VIDEO_DRIVER_ANDROID #include "SDL_androidvideo.h" - +#include "SDL_androidclipboard.h" #include "../../core/android/SDL_android.h" int diff --git a/Engine/lib/sdl/src/video/android/SDL_androidclipboard.h b/Engine/lib/sdl/src/video/android/SDL_androidclipboard.h index a61045ae8..7f48b0e46 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidclipboard.h +++ b/Engine/lib/sdl/src/video/android/SDL_androidclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_androidclipboard_h -#define _SDL_androidclipboard_h +#ifndef SDL_androidclipboard_h_ +#define SDL_androidclipboard_h_ extern int Android_SetClipboardText(_THIS, const char *text); extern char *Android_GetClipboardText(_THIS); extern SDL_bool Android_HasClipboardText(_THIS); -#endif /* _SDL_androidclipboard_h */ +#endif /* SDL_androidclipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/android/SDL_androidevents.c b/Engine/lib/sdl/src/video/android/SDL_androidevents.c index c3cd4cc1b..6cf9af216 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidevents.c +++ b/Engine/lib/sdl/src/video/android/SDL_androidevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,19 +29,17 @@ #include "SDL_events.h" #include "SDL_androidwindow.h" - -void android_egl_context_backup(); -void android_egl_context_restore(); - -#if SDL_AUDIO_DRIVER_ANDROID -void ANDROIDAUDIO_ResumeDevices(void); -void ANDROIDAUDIO_PauseDevices(void); +#if !SDL_AUDIO_DISABLED +/* Can't include sysaudio "../../audio/android/SDL_androidaudio.h" + * because of THIS redefinition */ +extern void ANDROIDAUDIO_ResumeDevices(void); +extern void ANDROIDAUDIO_PauseDevices(void); #else static void ANDROIDAUDIO_ResumeDevices(void) {} static void ANDROIDAUDIO_PauseDevices(void) {} #endif -void +static void android_egl_context_restore() { SDL_Event event; @@ -55,7 +53,7 @@ android_egl_context_restore() } } -void +static void android_egl_context_backup() { /* Keep a copy of the EGL Context so we can try to restore it when we resume */ diff --git a/Engine/lib/sdl/src/video/android/SDL_androidevents.h b/Engine/lib/sdl/src/video/android/SDL_androidevents.h index 4a2230e20..00e742751 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidevents.h +++ b/Engine/lib/sdl/src/video/android/SDL_androidevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/android/SDL_androidgl.c b/Engine/lib/sdl/src/video/android/SDL_androidgl.c index 4cfe86357..859b46e9f 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidgl.c +++ b/Engine/lib/sdl/src/video/android/SDL_androidgl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,6 +29,7 @@ #include "SDL_androidwindow.h" #include "SDL_androidvideo.h" +#include "SDL_androidgl.h" #include "../../core/android/SDL_android.h" #include @@ -38,7 +39,7 @@ SDL_EGL_CreateContext_impl(Android) SDL_EGL_MakeCurrent_impl(Android) -void +int Android_GLES_SwapWindow(_THIS, SDL_Window * window) { /* The following two calls existed in the original Java code @@ -48,12 +49,12 @@ Android_GLES_SwapWindow(_THIS, SDL_Window * window) /*_this->egl_data->eglWaitNative(EGL_CORE_NATIVE_ENGINE); _this->egl_data->eglWaitGL();*/ - SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); + return SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); } int Android_GLES_LoadLibrary(_THIS, const char *path) { - return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) 0); + return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) 0, 0); } #endif /* SDL_VIDEO_DRIVER_ANDROID */ diff --git a/Engine/lib/sdl/src/video/android/SDL_androidgl.h b/Engine/lib/sdl/src/video/android/SDL_androidgl.h new file mode 100644 index 000000000..1dab5a6d1 --- /dev/null +++ b/Engine/lib/sdl/src/video/android/SDL_androidgl.h @@ -0,0 +1,34 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_androidgl_h_ +#define SDL_androidgl_h_ + +SDL_GLContext Android_GLES_CreateContext(_THIS, SDL_Window * window); +int Android_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +int Android_GLES_SwapWindow(_THIS, SDL_Window * window); +int Android_GLES_LoadLibrary(_THIS, const char *path); + + +#endif /* SDL_androidgl_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/android/SDL_androidkeyboard.c b/Engine/lib/sdl/src/video/android/SDL_androidkeyboard.c index 652e0cca7..6c94caca6 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidkeyboard.c +++ b/Engine/lib/sdl/src/video/android/SDL_androidkeyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -129,8 +129,8 @@ static SDL_Scancode Android_Keycodes[] = { SDL_SCANCODE_AUDIOSTOP, /* AKEYCODE_MEDIA_STOP */ SDL_SCANCODE_AUDIONEXT, /* AKEYCODE_MEDIA_NEXT */ SDL_SCANCODE_AUDIOPREV, /* AKEYCODE_MEDIA_PREVIOUS */ - SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_REWIND */ - SDL_SCANCODE_UNKNOWN, /* AKEYCODE_MEDIA_FAST_FORWARD */ + SDL_SCANCODE_AUDIOREWIND, /* AKEYCODE_MEDIA_REWIND */ + SDL_SCANCODE_AUDIOFASTFORWARD, /* AKEYCODE_MEDIA_FAST_FORWARD */ SDL_SCANCODE_MUTE, /* AKEYCODE_MUTE */ SDL_SCANCODE_PAGEUP, /* AKEYCODE_PAGE_UP */ SDL_SCANCODE_PAGEDOWN, /* AKEYCODE_PAGE_DOWN */ @@ -357,7 +357,7 @@ Android_HasScreenKeyboardSupport(_THIS) SDL_bool Android_IsScreenKeyboardShown(_THIS, SDL_Window * window) { - return SDL_IsTextInputActive(); + return Android_JNI_IsScreenKeyboardShown(); } void diff --git a/Engine/lib/sdl/src/video/android/SDL_androidkeyboard.h b/Engine/lib/sdl/src/video/android/SDL_androidkeyboard.h index ced9bc24e..a1a10f569 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidkeyboard.h +++ b/Engine/lib/sdl/src/video/android/SDL_androidkeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/android/SDL_androidmessagebox.c b/Engine/lib/sdl/src/video/android/SDL_androidmessagebox.c index 61f67636a..171602481 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidmessagebox.c +++ b/Engine/lib/sdl/src/video/android/SDL_androidmessagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,12 +23,12 @@ #if SDL_VIDEO_DRIVER_ANDROID #include "SDL_messagebox.h" +#include "SDL_androidmessagebox.h" +#include "../../core/android/SDL_android.h" int Android_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { - int Android_JNI_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); - return Android_JNI_ShowMessageBox(messageboxdata, buttonid); } diff --git a/Engine/lib/sdl/src/video/android/SDL_androidmessagebox.h b/Engine/lib/sdl/src/video/android/SDL_androidmessagebox.h index 3c680c62f..2c3a44f5d 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidmessagebox.h +++ b/Engine/lib/sdl/src/video/android/SDL_androidmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/android/SDL_androidmouse.c b/Engine/lib/sdl/src/video/android/SDL_androidmouse.c index 883fa8d22..1c075fb4a 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidmouse.c +++ b/Engine/lib/sdl/src/video/android/SDL_androidmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,6 +30,7 @@ #include "../../core/android/SDL_android.h" +/* See Android's MotionEvent class for constants */ #define ACTION_DOWN 0 #define ACTION_UP 1 #define ACTION_MOVE 2 @@ -41,41 +42,59 @@ #define BUTTON_BACK 8 #define BUTTON_FORWARD 16 -static Uint8 SDLButton; +/* Last known Android mouse button state (includes all buttons) */ +static int last_state; void Android_InitMouse(void) { - SDLButton = 0; + last_state = 0; } -void Android_OnMouse( int androidButton, int action, float x, float y) { +/* Translate Android mouse button state to SDL mouse button */ +static Uint8 +TranslateButton(int state) +{ + if (state & BUTTON_PRIMARY) { + return SDL_BUTTON_LEFT; + } else if (state & BUTTON_SECONDARY) { + return SDL_BUTTON_RIGHT; + } else if (state & BUTTON_TERTIARY) { + return SDL_BUTTON_MIDDLE; + } else if (state & BUTTON_FORWARD) { + return SDL_BUTTON_X1; + } else if (state & BUTTON_BACK) { + return SDL_BUTTON_X2; + } else { + return 0; + } +} + +void +Android_OnMouse(int state, int action, float x, float y) +{ + int changes; + Uint8 button; + if (!Android_Window) { return; } switch(action) { case ACTION_DOWN: - // Determine which button originated the event, and store it for ACTION_UP - SDLButton = SDL_BUTTON_LEFT; - if (androidButton == BUTTON_SECONDARY) { - SDLButton = SDL_BUTTON_RIGHT; - } else if (androidButton == BUTTON_TERTIARY) { - SDLButton = SDL_BUTTON_MIDDLE; - } else if (androidButton == BUTTON_FORWARD) { - SDLButton = SDL_BUTTON_X1; - } else if (androidButton == BUTTON_BACK) { - SDLButton = SDL_BUTTON_X2; - } + changes = state & ~last_state; + button = TranslateButton(changes); + last_state = state; SDL_SendMouseMotion(Android_Window, 0, 0, x, y); - SDL_SendMouseButton(Android_Window, 0, SDL_PRESSED, SDLButton); + SDL_SendMouseButton(Android_Window, 0, SDL_PRESSED, button); break; case ACTION_UP: - // Android won't give us the button that originated the ACTION_DOWN event, so we'll - // assume it's the one we stored + changes = last_state & ~state; + button = TranslateButton(changes); + last_state = state; SDL_SendMouseMotion(Android_Window, 0, 0, x, y); - SDL_SendMouseButton(Android_Window, 0, SDL_RELEASED, SDLButton); + SDL_SendMouseButton(Android_Window, 0, SDL_RELEASED, button); break; case ACTION_MOVE: diff --git a/Engine/lib/sdl/src/video/android/SDL_androidmouse.h b/Engine/lib/sdl/src/video/android/SDL_androidmouse.h index a64e06d51..f201fad97 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidmouse.h +++ b/Engine/lib/sdl/src/video/android/SDL_androidmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,14 +19,14 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_androidmouse_h -#define _SDL_androidmouse_h +#ifndef SDL_androidmouse_h_ +#define SDL_androidmouse_h_ #include "SDL_androidvideo.h" extern void Android_InitMouse(void); extern void Android_OnMouse( int button, int action, float x, float y); -#endif /* _SDL_androidmouse_h */ +#endif /* SDL_androidmouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/android/SDL_androidtouch.c b/Engine/lib/sdl/src/video/android/SDL_androidtouch.c index 0ff11ef57..5c3e4aacc 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidtouch.c +++ b/Engine/lib/sdl/src/video/android/SDL_androidtouch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -52,16 +52,13 @@ static void Android_GetWindowCoordinates(float x, float y, static SDL_bool separate_mouse_and_touch = SDL_FALSE; -static void +static void SDLCALL SeparateEventsHintWatcher(void *userdata, const char *name, const char *oldValue, const char *newValue) { - jclass mActivityClass = Android_JNI_GetActivityClass(); - JNIEnv *env = Android_JNI_GetEnv(); - jfieldID fid = (*env)->GetStaticFieldID(env, mActivityClass, "mSeparateMouseAndTouch", "Z"); - separate_mouse_and_touch = (newValue && (SDL_strcmp(newValue, "1") == 0)); - (*env)->SetStaticBooleanField(env, mActivityClass, fid, separate_mouse_and_touch ? JNI_TRUE : JNI_FALSE); + + Android_JNI_SetSeparateMouseAndTouch(separate_mouse_and_touch); } void Android_InitTouch(void) diff --git a/Engine/lib/sdl/src/video/android/SDL_androidtouch.h b/Engine/lib/sdl/src/video/android/SDL_androidtouch.h index 2ad096ce8..e10be4f99 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidtouch.h +++ b/Engine/lib/sdl/src/video/android/SDL_androidtouch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/android/SDL_androidvideo.c b/Engine/lib/sdl/src/video/android/SDL_androidvideo.c index 178a3e691..357f5cf17 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidvideo.c +++ b/Engine/lib/sdl/src/video/android/SDL_androidvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,25 +33,23 @@ #include "../../events/SDL_windowevents_c.h" #include "SDL_androidvideo.h" +#include "SDL_androidgl.h" #include "SDL_androidclipboard.h" #include "SDL_androidevents.h" #include "SDL_androidkeyboard.h" #include "SDL_androidmouse.h" #include "SDL_androidtouch.h" #include "SDL_androidwindow.h" +#include "SDL_androidvulkan.h" #define ANDROID_VID_DRIVER_NAME "Android" /* Initialization/Query functions */ static int Android_VideoInit(_THIS); static void Android_VideoQuit(_THIS); +int Android_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi); #include "../SDL_egl_c.h" -/* GL functions (SDL_androidgl.c) */ -extern SDL_GLContext Android_GLES_CreateContext(_THIS, SDL_Window * window); -extern int Android_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); -extern void Android_GLES_SwapWindow(_THIS, SDL_Window * window); -extern int Android_GLES_LoadLibrary(_THIS, const char *path); #define Android_GLES_GetProcAddress SDL_EGL_GetProcAddress #define Android_GLES_UnloadLibrary SDL_EGL_UnloadLibrary #define Android_GLES_SetSwapInterval SDL_EGL_SetSwapInterval @@ -65,7 +63,7 @@ extern int Android_GLES_LoadLibrary(_THIS, const char *path); int Android_ScreenWidth = 0; int Android_ScreenHeight = 0; Uint32 Android_ScreenFormat = SDL_PIXELFORMAT_UNKNOWN; -int Android_ScreenRate = 0; +static int Android_ScreenRate = 0; SDL_sem *Android_PauseSem = NULL, *Android_ResumeSem = NULL; @@ -118,8 +116,11 @@ Android_CreateDevice(int devindex) device->VideoQuit = Android_VideoQuit; device->PumpEvents = Android_PumpEvents; - device->CreateWindow = Android_CreateWindow; + device->GetDisplayDPI = Android_GetDisplayDPI; + + device->CreateSDLWindow = Android_CreateWindow; device->SetWindowTitle = Android_SetWindowTitle; + device->SetWindowFullscreen = Android_SetWindowFullscreen; device->DestroyWindow = Android_DestroyWindow; device->GetWindowWMInfo = Android_GetWindowWMInfo; @@ -136,6 +137,13 @@ Android_CreateDevice(int devindex) device->GL_SwapWindow = Android_GLES_SwapWindow; device->GL_DeleteContext = Android_GLES_DeleteContext; +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = Android_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = Android_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = Android_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = Android_Vulkan_CreateSurface; +#endif + /* Screensaver */ device->SuspendScreenSaver = Android_SuspendScreenSaver; @@ -194,9 +202,17 @@ Android_VideoQuit(_THIS) Android_QuitTouch(); } +int +Android_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi) +{ + return Android_JNI_GetDisplayDPI(ddpi, hdpi, vdpi); +} + void Android_SetScreenResolution(int width, int height, Uint32 format, float rate) { + SDL_VideoDevice* device; + SDL_VideoDisplay *display; Android_ScreenWidth = width; Android_ScreenHeight = height; Android_ScreenFormat = format; @@ -205,13 +221,13 @@ Android_SetScreenResolution(int width, int height, Uint32 format, float rate) /* Update the resolution of the desktop mode, so that the window can be properly resized. The screen resolution change can for - example happen when the Activity enters or exists immersive mode, + example happen when the Activity enters or exits immersive mode, which can happen after VideoInit(). */ - SDL_VideoDevice* device = SDL_GetVideoDevice(); + device = SDL_GetVideoDevice(); if (device && device->num_displays > 0) { - SDL_VideoDisplay* display = &device->displays[0]; + display = &device->displays[0]; display->desktop_mode.format = Android_ScreenFormat; display->desktop_mode.w = Android_ScreenWidth; display->desktop_mode.h = Android_ScreenHeight; @@ -219,16 +235,17 @@ Android_SetScreenResolution(int width, int height, Uint32 format, float rate) } if (Android_Window) { - SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESIZED, width, height); - /* Force the current mode to match the resize otherwise the SDL_WINDOWEVENT_RESTORED event * will fall back to the old mode */ - SDL_VideoDisplay *display = SDL_GetDisplayForWindow(Android_Window); + display = SDL_GetDisplayForWindow(Android_Window); - display->current_mode.format = format; - display->current_mode.w = width; - display->current_mode.h = height; - display->current_mode.refresh_rate = rate; + display->display_modes[0].format = format; + display->display_modes[0].w = width; + display->display_modes[0].h = height; + display->display_modes[0].refresh_rate = rate; + display->current_mode = display->display_modes[0]; + + SDL_SendWindowEvent(Android_Window, SDL_WINDOWEVENT_RESIZED, width, height); } } diff --git a/Engine/lib/sdl/src/video/android/SDL_androidvideo.h b/Engine/lib/sdl/src/video/android/SDL_androidvideo.h index 0f76a91b1..a62c98383 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidvideo.h +++ b/Engine/lib/sdl/src/video/android/SDL_androidvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_androidvideo_h -#define _SDL_androidvideo_h +#ifndef SDL_androidvideo_h_ +#define SDL_androidvideo_h_ #include "SDL_mutex.h" #include "SDL_rect.h" @@ -44,6 +44,6 @@ extern SDL_sem *Android_PauseSem, *Android_ResumeSem; extern SDL_Window *Android_Window; -#endif /* _SDL_androidvideo_h */ +#endif /* SDL_androidvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/android/SDL_androidvulkan.c b/Engine/lib/sdl/src/video/android/SDL_androidvulkan.c new file mode 100644 index 000000000..e0130349e --- /dev/null +++ b/Engine/lib/sdl/src/video/android/SDL_androidvulkan.c @@ -0,0 +1,175 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.c. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_ANDROID + +#include "SDL_androidvideo.h" +#include "SDL_androidwindow.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_androidvulkan.h" +#include "SDL_syswm.h" + +int Android_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 i, extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasAndroidSurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + if(_this->vulkan_config.loader_handle) + return SDL_SetError("Vulkan already loaded"); + + /* Load the Vulkan loader library */ + if(!path) + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + if(!path) + path = "libvulkan.so"; + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if(!_this->vulkan_config.loader_handle) + return -1; + SDL_strlcpy(_this->vulkan_config.loader_path, path, + SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + if(!vkGetInstanceProcAddr) + goto fail; + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) + goto fail; + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if(!extensions) + goto fail; + for(i = 0; i < extensionCount; i++) + { + if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasAndroidSurfaceExtension = SDL_TRUE; + } + SDL_free(extensions); + if(!hasSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + else if(!hasAndroidSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "extension"); + goto fail; + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void Android_Vulkan_UnloadLibrary(_THIS) +{ + if(_this->vulkan_config.loader_handle) + { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool Android_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForAndroid[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_ANDROID_SURFACE_EXTENSION_NAME + }; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForAndroid), + extensionsForAndroid); +} + +SDL_bool Android_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + SDL_WindowData *windowData = (SDL_WindowData *)window->driverdata; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + PFN_vkCreateAndroidSurfaceKHR vkCreateAndroidSurfaceKHR = + (PFN_vkCreateAndroidSurfaceKHR)vkGetInstanceProcAddr( + (VkInstance)instance, + "vkCreateAndroidSurfaceKHR"); + VkAndroidSurfaceCreateInfoKHR createInfo; + VkResult result; + + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + if(!vkCreateAndroidSurfaceKHR) + { + SDL_SetError(VK_KHR_ANDROID_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + SDL_zero(createInfo); + createInfo.sType = VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.window = windowData->native_window; + result = vkCreateAndroidSurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateAndroidSurfaceKHR failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; +} + +#endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/android/SDL_androidvulkan.h b/Engine/lib/sdl/src/video/android/SDL_androidvulkan.h new file mode 100644 index 000000000..2634c61f9 --- /dev/null +++ b/Engine/lib/sdl/src/video/android/SDL_androidvulkan.h @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.h. + */ + +#include "../../SDL_internal.h" + +#ifndef SDL_androidvulkan_h_ +#define SDL_androidvulkan_h_ + +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_ANDROID + +int Android_Vulkan_LoadLibrary(_THIS, const char *path); +void Android_Vulkan_UnloadLibrary(_THIS); +SDL_bool Android_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool Android_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +#endif + +#endif /* SDL_androidvulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/android/SDL_androidwindow.c b/Engine/lib/sdl/src/video/android/SDL_androidwindow.c index 37a928faf..f1cbf5861 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidwindow.c +++ b/Engine/lib/sdl/src/video/android/SDL_androidwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,6 +29,7 @@ #include "SDL_androidvideo.h" #include "SDL_androidwindow.h" +#include "SDL_hints.h" int Android_CreateWindow(_THIS, SDL_Window * window) @@ -42,6 +43,9 @@ Android_CreateWindow(_THIS, SDL_Window * window) Android_PauseSem = SDL_CreateSemaphore(0); Android_ResumeSem = SDL_CreateSemaphore(0); + /* Set orientation */ + Android_JNI_SetOrientation(window->w, window->h, window->flags & SDL_WINDOW_RESIZABLE, SDL_GetHint(SDL_HINT_ORIENTATIONS)); + /* Adjust the window data to match the screen */ window->x = 0; window->y = 0; @@ -49,7 +53,6 @@ Android_CreateWindow(_THIS, SDL_Window * window) window->h = Android_ScreenHeight; window->flags &= ~SDL_WINDOW_RESIZABLE; /* window is NEVER resizeable */ - window->flags |= SDL_WINDOW_FULLSCREEN; /* window is always fullscreen */ window->flags &= ~SDL_WINDOW_HIDDEN; window->flags |= SDL_WINDOW_SHOWN; /* only one window on Android */ window->flags |= SDL_WINDOW_INPUT_FOCUS; /* always has input focus */ @@ -69,13 +72,17 @@ Android_CreateWindow(_THIS, SDL_Window * window) SDL_free(data); return SDL_SetError("Could not fetch native window"); } - - data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window); - if (data->egl_surface == EGL_NO_SURFACE) { - ANativeWindow_release(data->native_window); - SDL_free(data); - return SDL_SetError("Could not create GLES window surface"); + /* Do not create EGLSurface for Vulkan window since it will then make the window + incompatible with vkCreateAndroidSurfaceKHR */ + if ((window->flags & SDL_WINDOW_VULKAN) == 0) { + data->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) data->native_window); + + if (data->egl_surface == EGL_NO_SURFACE) { + ANativeWindow_release(data->native_window); + SDL_free(data); + return SDL_SetError("Could not create GLES window surface"); + } } window->driverdata = data; @@ -90,6 +97,12 @@ Android_SetWindowTitle(_THIS, SDL_Window * window) Android_JNI_SetActivityTitle(window->title); } +void +Android_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen) +{ + Android_JNI_SetWindowStyle(fullscreen); +} + void Android_DestroyWindow(_THIS, SDL_Window * window) { @@ -128,7 +141,7 @@ Android_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) info->info.android.surface = data->egl_surface; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/Engine/lib/sdl/src/video/android/SDL_androidwindow.h b/Engine/lib/sdl/src/video/android/SDL_androidwindow.h index 3ac99f42b..df99567ac 100644 --- a/Engine/lib/sdl/src/video/android/SDL_androidwindow.h +++ b/Engine/lib/sdl/src/video/android/SDL_androidwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,15 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_androidwindow_h -#define _SDL_androidwindow_h +#ifndef SDL_androidwindow_h_ +#define SDL_androidwindow_h_ #include "../../core/android/SDL_android.h" #include "../SDL_egl_c.h" extern int Android_CreateWindow(_THIS, SDL_Window * window); extern void Android_SetWindowTitle(_THIS, SDL_Window * window); +extern void Android_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen); extern void Android_DestroyWindow(_THIS, SDL_Window * window); extern SDL_bool Android_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo * info); @@ -39,6 +40,6 @@ typedef struct } SDL_WindowData; -#endif /* _SDL_androidwindow_h */ +#endif /* SDL_androidwindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaclipboard.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaclipboard.h index 871b394f5..54e4c8813 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaclipboard.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoaclipboard_h -#define _SDL_cocoaclipboard_h +#ifndef SDL_cocoaclipboard_h_ +#define SDL_cocoaclipboard_h_ /* Forward declaration */ struct SDL_VideoData; @@ -31,6 +31,6 @@ extern char *Cocoa_GetClipboardText(_THIS); extern SDL_bool Cocoa_HasClipboardText(_THIS); extern void Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data); -#endif /* _SDL_cocoaclipboard_h */ +#endif /* SDL_cocoaclipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaclipboard.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaclipboard.m index fd8680925..9c966342e 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaclipboard.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaclipboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaevents.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaevents.h index ea40e5317..986168ea3 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaevents.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoaevents_h -#define _SDL_cocoaevents_h +#ifndef SDL_cocoaevents_h_ +#define SDL_cocoaevents_h_ extern void Cocoa_RegisterApp(void); extern void Cocoa_PumpEvents(_THIS); extern void Cocoa_SuspendScreenSaver(_THIS); -#endif /* _SDL_cocoaevents_h */ +#endif /* SDL_cocoaevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaevents.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaevents.m index 17a3183b7..38f4ba676 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaevents.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaevents.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,6 +38,8 @@ - (void)terminate:(id)sender; - (void)sendEvent:(NSEvent *)theEvent; ++ (void)registerUserDefaults; + @end @implementation SDLApplication @@ -55,22 +57,22 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent) SDL_VideoDevice *_this = SDL_GetVideoDevice(); switch ([theEvent type]) { - case NSLeftMouseDown: - case NSOtherMouseDown: - case NSRightMouseDown: - case NSLeftMouseUp: - case NSOtherMouseUp: - case NSRightMouseUp: - case NSLeftMouseDragged: - case NSRightMouseDragged: - case NSOtherMouseDragged: /* usually middle mouse dragged */ - case NSMouseMoved: - case NSScrollWheel: + case NSEventTypeLeftMouseDown: + case NSEventTypeOtherMouseDown: + case NSEventTypeRightMouseDown: + case NSEventTypeLeftMouseUp: + case NSEventTypeOtherMouseUp: + case NSEventTypeRightMouseUp: + case NSEventTypeLeftMouseDragged: + case NSEventTypeRightMouseDragged: + case NSEventTypeOtherMouseDragged: /* usually middle mouse dragged */ + case NSEventTypeMouseMoved: + case NSEventTypeScrollWheel: Cocoa_HandleMouseEvent(_this, theEvent); break; - case NSKeyDown: - case NSKeyUp: - case NSFlagsChanged: + case NSEventTypeKeyDown: + case NSEventTypeKeyUp: + case NSEventTypeFlagsChanged: Cocoa_HandleKeyEvent(_this, theEvent); break; default: @@ -90,6 +92,17 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent) [super sendEvent:theEvent]; } ++ (void)registerUserDefaults +{ + NSDictionary *appDefaults = [[NSDictionary alloc] initWithObjectsAndKeys: + [NSNumber numberWithBool:NO], @"AppleMomentumScrollSupported", + [NSNumber numberWithBool:NO], @"ApplePressAndHoldEnabled", + [NSNumber numberWithBool:YES], @"ApplePersistenceIgnoreState", + nil]; + [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults]; + [appDefaults release]; +} + @end // SDLApplication /* setAppleMenu disappeared from the headers in 10.4 */ @@ -216,6 +229,22 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent) { return (BOOL)SDL_SendDropFile(NULL, [filename UTF8String]) && SDL_SendDropComplete(NULL); } + +- (void)applicationDidFinishLaunching:(NSNotification *)notification +{ + /* The menu bar of SDL apps which don't have the typical .app bundle + * structure fails to work the first time a window is created (until it's + * de-focused and re-focused), if this call is in Cocoa_RegisterApp instead + * of here. https://bugzilla.libsdl.org/show_bug.cgi?id=3051 + */ + if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) { + [NSApp activateIgnoringOtherApps:YES]; + } + + /* If we call this before NSApp activation, macOS might print a complaint + * about ApplePersistenceIgnoreState. */ + [SDLApplication registerUserDefaults]; +} @end static SDLAppDelegate *appDelegate = nil; @@ -289,7 +318,7 @@ CreateApplicationMenus(void) [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"]; menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"]; - [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)]; + [menuItem setKeyEquivalentModifierMask:(NSEventModifierFlagOption|NSEventModifierFlagCommand)]; [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""]; @@ -335,7 +364,7 @@ CreateApplicationMenus(void) /* Add menu items */ menuItem = [viewMenu addItemWithTitle:@"Toggle Full Screen" action:@selector(toggleFullScreen:) keyEquivalent:@"f"]; - [menuItem setKeyEquivalentModifierMask:NSControlKeyMask | NSCommandKeyMask]; + [menuItem setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand]; /* Put menu into the menubar */ menuItem = [[NSMenuItem alloc] initWithTitle:@"View" action:nil keyEquivalent:@""]; @@ -361,20 +390,18 @@ Cocoa_RegisterApp(void) if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) { [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular]; - [NSApp activateIgnoringOtherApps:YES]; } if ([NSApp mainMenu] == nil) { CreateApplicationMenus(); } [NSApp finishLaunching]; - NSDictionary *appDefaults = [[NSDictionary alloc] initWithObjectsAndKeys: - [NSNumber numberWithBool:NO], @"AppleMomentumScrollSupported", - [NSNumber numberWithBool:NO], @"ApplePressAndHoldEnabled", - [NSNumber numberWithBool:YES], @"ApplePersistenceIgnoreState", - nil]; - [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults]; - [appDefaults release]; + if ([NSApp delegate]) { + /* The SDL app delegate calls this in didFinishLaunching if it's + * attached to the NSApp, otherwise we need to call it manually. + */ + [SDLApplication registerUserDefaults]; + } } if (NSApp && !appDelegate) { appDelegate = [[SDLAppDelegate alloc] init]; @@ -394,6 +421,7 @@ void Cocoa_PumpEvents(_THIS) { @autoreleasepool { +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 /* Update activity every 30 seconds to prevent screensaver */ SDL_VideoData *data = (SDL_VideoData *)_this->driverdata; if (_this->suspend_screensaver && !data->screensaver_use_iopm) { @@ -404,9 +432,10 @@ Cocoa_PumpEvents(_THIS) data->screensaver_activity = now; } } +#endif for ( ; ; ) { - NSEvent *event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; + NSEvent *event = [NSApp nextEventMatchingMask:NSEventMaskAny untilDate:[NSDate distantPast] inMode:NSDefaultRunLoopMode dequeue:YES ]; if ( event == nil ) { break; } diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoakeyboard.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoakeyboard.h index 4f9da0185..7d8952381 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoakeyboard.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoakeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoakeyboard_h -#define _SDL_cocoakeyboard_h +#ifndef SDL_cocoakeyboard_h_ +#define SDL_cocoakeyboard_h_ extern void Cocoa_InitKeyboard(_THIS); extern void Cocoa_HandleKeyEvent(_THIS, NSEvent * event); @@ -31,6 +31,6 @@ extern void Cocoa_StartTextInput(_THIS); extern void Cocoa_StopTextInput(_THIS); extern void Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect); -#endif /* _SDL_cocoakeyboard_h */ +#endif /* SDL_cocoakeyboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoakeyboard.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoakeyboard.m index 8b2ed91c2..8436047f9 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoakeyboard.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoakeyboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -93,7 +93,7 @@ return _selectedRange; } -- (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange; +- (void)setMarkedText:(id)aString selectedRange:(NSRange)selectedRange replacementRange:(NSRange)replacementRange { if ([aString isKindOfClass:[NSAttributedString class]]) { aString = [aString string]; @@ -127,7 +127,7 @@ SDL_SendEditingText("", 0, 0); } -- (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange; +- (NSRect)firstRectForCharacterRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange { NSWindow *window = [self window]; NSRect contentRect = [window contentRectForFrameRect:[window frame]]; @@ -143,16 +143,19 @@ aRange.location, aRange.length, windowHeight, NSStringFromRect(rect)); - if ([window respondsToSelector:@selector(convertRectToScreen:)]) { - rect = [window convertRectToScreen:rect]; - } else { +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1070 + if (![window respondsToSelector:@selector(convertRectToScreen:)]) { rect.origin = [window convertBaseToScreen:rect.origin]; + } else +#endif + { + rect = [window convertRectToScreen:rect]; } return rect; } -- (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange; +- (NSAttributedString *)attributedSubstringForProposedRange:(NSRange)aRange actualRange:(NSRangePointer)actualRange { DEBUG_IME(@"attributedSubstringFromRange: (%d, %d)", aRange.location, aRange.length); return nil; @@ -460,7 +463,7 @@ DoSidedModifiers(unsigned short scancode, unsigned int i, bit; /* Iterate through the bits, testing each against the old modifiers */ - for (i = 0, bit = NSShiftKeyMask; bit <= NSCommandKeyMask; bit <<= 1, ++i) { + for (i = 0, bit = NSEventModifierFlagShift; bit <= NSEventModifierFlagCommand; bit <<= 1, ++i) { unsigned int oldMask, newMask; oldMask = oldMods & bit; @@ -581,7 +584,7 @@ Cocoa_InitKeyboard(_THIS) SDL_SetScancodeName(SDL_SCANCODE_RGUI, "Right Command"); data->modifierFlags = [NSEvent modifierFlags]; - SDL_ToggleModState(KMOD_CAPS, (data->modifierFlags & NSAlphaShiftKeyMask) != 0); + SDL_ToggleModState(KMOD_CAPS, (data->modifierFlags & NSEventModifierFlagCapsLock) != 0); InitHIDCallback(); } @@ -646,7 +649,7 @@ Cocoa_SetTextInputRect(_THIS, SDL_Rect *rect) void Cocoa_HandleKeyEvent(_THIS, NSEvent *event) { - SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + SDL_VideoData *data = _this ? ((SDL_VideoData *) _this->driverdata) : NULL; if (!data) { return; /* can happen when returning from fullscreen Space on shutdown */ } @@ -670,7 +673,7 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event) } switch ([event type]) { - case NSKeyDown: + case NSEventTypeKeyDown: if (![event isARepeat]) { /* See if we need to rebuild the keyboard layout */ UpdateKeymap(data, SDL_TRUE); @@ -679,7 +682,7 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event) SDL_SendKeyboardKey(SDL_PRESSED, code); #if 1 if (code == SDL_SCANCODE_UNKNOWN) { - fprintf(stderr, "The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL mailing list or to Christian Walther . Mac virtual key code is %d.\n", scancode); + fprintf(stderr, "The key you just pressed is not recognized by SDL. To help get this fixed, report this to the SDL forums/mailing list or to Christian Walther . Mac virtual key code is %d.\n", scancode); } #endif if (SDL_EventState(SDL_TEXTINPUT, SDL_QUERY)) { @@ -694,10 +697,10 @@ Cocoa_HandleKeyEvent(_THIS, NSEvent *event) #endif } break; - case NSKeyUp: + case NSEventTypeKeyUp: SDL_SendKeyboardKey(SDL_RELEASED, code); break; - case NSFlagsChanged: + case NSEventTypeFlagsChanged: /* FIXME CW 2007-08-14: check if this whole mess that takes up half of this file is really necessary */ HandleModifiers(_this, scancode, [event modifierFlags]); break; diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamessagebox.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamessagebox.h index d1ca7882e..74a815ad6 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamessagebox.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamessagebox.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamessagebox.m index ed59e728c..a98237f45 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamessagebox.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamessagebox.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -57,11 +57,24 @@ - (void)showAlert:(NSAlert*)alert { if (nswindow) { - [alert beginSheetModalForWindow:nswindow modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:nil]; +#ifdef MAC_OS_X_VERSION_10_9 + if ([alert respondsToSelector:@selector(beginSheetModalForWindow:completionHandler:)]) { + [alert beginSheetModalForWindow:nswindow completionHandler:^(NSModalResponse returnCode) { + clicked = returnCode; + }]; + } else +#endif + { +#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090 + [alert beginSheetModalForWindow:nswindow modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:nil]; +#endif + } + while (clicked < 0) { SDL_PumpEvents(); SDL_Delay(100); } + [nswindow release]; } else { clicked = [alert runModal]; @@ -86,11 +99,11 @@ Cocoa_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) NSAlert* alert = [[[NSAlert alloc] init] autorelease]; if (messageboxdata->flags & SDL_MESSAGEBOX_ERROR) { - [alert setAlertStyle:NSCriticalAlertStyle]; + [alert setAlertStyle:NSAlertStyleCritical]; } else if (messageboxdata->flags & SDL_MESSAGEBOX_WARNING) { - [alert setAlertStyle:NSWarningAlertStyle]; + [alert setAlertStyle:NSAlertStyleWarning]; } else { - [alert setAlertStyle:NSInformationalAlertStyle]; + [alert setAlertStyle:NSAlertStyleInformational]; } [alert setMessageText:[NSString stringWithUTF8String:messageboxdata->title]]; diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoametalview.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoametalview.h new file mode 100644 index 000000000..c0a582ff4 --- /dev/null +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoametalview.h @@ -0,0 +1,63 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +/* + * @author Mark Callow, www.edgewise-consulting.com. + * + * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing + * how to add a CAMetalLayer backed view. + */ + +#ifndef SDL_cocoametalview_h_ +#define SDL_cocoametalview_h_ + +#import "../SDL_sysvideo.h" +#import "SDL_cocoawindow.h" + +#if SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL) + +#import +#import +#import + +#define METALVIEW_TAG 255 + +@interface SDL_cocoametalview : NSView { + NSInteger _tag; +} + +- (instancetype)initWithFrame:(NSRect)frame + scale:(CGFloat)scale; + +/* Override superclass tag so this class can set it. */ +@property (assign, readonly) NSInteger tag; + +@end + +SDL_cocoametalview* Cocoa_Mtl_AddMetalView(SDL_Window* window); + +void Cocoa_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h); + +#endif /* SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL) */ + +#endif /* SDL_cocoametalview_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoametalview.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoametalview.m new file mode 100644 index 000000000..e9c08a007 --- /dev/null +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoametalview.m @@ -0,0 +1,135 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +/* + * @author Mark Callow, www.edgewise-consulting.com. + * + * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing + * how to add a CAMetalLayer backed view. + */ + +#import "SDL_cocoametalview.h" + +#if SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL) + +#include "SDL_assert.h" + +@implementation SDL_cocoametalview + +/* The synthesized getter should be called by super's viewWithTag. */ +@synthesize tag = _tag; + +/* Return a Metal-compatible layer. */ ++ (Class)layerClass +{ + return NSClassFromString(@"CAMetalLayer"); +} + +/* Indicate the view wants to draw using a backing layer instead of drawRect. */ +- (BOOL)wantsUpdateLayer +{ + return YES; +} + +/* When the wantsLayer property is set to YES, this method will be invoked to + * return a layer instance. + */ +- (CALayer*)makeBackingLayer +{ + return [self.class.layerClass layer]; +} + +- (instancetype)initWithFrame:(NSRect)frame + scale:(CGFloat)scale +{ + if ((self = [super initWithFrame:frame])) { + _tag = METALVIEW_TAG; + self.wantsLayer = YES; + + /* Allow resize. */ + self.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; + + /* Set the desired scale. The default drawableSize of a CAMetalLayer + * is its bounds x its scale so nothing further needs to be done. + */ + self.layer.contentsScale = scale; + } + + return self; +} + +/* Set the size of the metal drawables when the view is resized. */ +- (void)resizeWithOldSuperviewSize:(NSSize)oldSize +{ + [super resizeWithOldSuperviewSize:oldSize]; +} + +@end + +SDL_cocoametalview* +Cocoa_Mtl_AddMetalView(SDL_Window* window) +{ + SDL_WindowData* data = (__bridge SDL_WindowData *)window->driverdata; + NSView *view = data->nswindow.contentView; + CGFloat scale = 1.0; + + if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + /* Set the scale to the natural scale factor of the screen - then + * the backing dimensions of the Metal view will match the pixel + * dimensions of the screen rather than the dimensions in points + * yielding high resolution on retine displays. + * + * N.B. In order for backingScaleFactor to be > 1, + * NSHighResolutionCapable must be set to true in the app's Info.plist. + */ + NSWindow* nswindow = data->nswindow; + if ([nswindow.screen respondsToSelector:@selector(backingScaleFactor)]) + scale = data->nswindow.screen.backingScaleFactor; + } + + SDL_cocoametalview *metalview + = [[SDL_cocoametalview alloc] initWithFrame:view.frame scale:scale]; + [view addSubview:metalview]; + return metalview; +} + +void +Cocoa_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h) +{ + SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata; + NSView *view = data->nswindow.contentView; + SDL_cocoametalview* metalview = [view viewWithTag:METALVIEW_TAG]; + if (metalview) { + CAMetalLayer *layer = (CAMetalLayer*)metalview.layer; + assert(layer != NULL); + if (w) { + *w = layer.drawableSize.width; + } + if (h) { + *h = layer.drawableSize.height; + } + } else { + SDL_GetWindowSize(window, w, h); + } +} + +#endif /* SDL_VIDEO_DRIVER_COCOA && (SDL_VIDEO_VULKAN || SDL_VIDEO_RENDER_METAL) */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamodes.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamodes.h index ce8601cba..05482e891 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamodes.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoamodes_h -#define _SDL_cocoamodes_h +#ifndef SDL_cocoamodes_h_ +#define SDL_cocoamodes_h_ typedef struct { @@ -41,6 +41,6 @@ extern int Cocoa_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, extern int Cocoa_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); extern void Cocoa_QuitModes(_THIS); -#endif /* _SDL_cocoamodes_h */ +#endif /* SDL_cocoamodes_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamodes.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamodes.m index 6ae9decbc..97ccd945d 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamodes.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamodes.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -340,27 +340,53 @@ void Cocoa_GetDisplayModes(_THIS, SDL_VideoDisplay * display) { SDL_DisplayData *data = (SDL_DisplayData *) display->driverdata; - CFArrayRef modes = CGDisplayCopyAllDisplayModes(data->display, NULL); + CVDisplayLinkRef link = NULL; + CGDisplayModeRef desktopmoderef; + SDL_DisplayMode desktopmode; + CFArrayRef modes; + + CVDisplayLinkCreateWithCGDisplay(data->display, &link); + + desktopmoderef = CGDisplayCopyDisplayMode(data->display); + + /* CopyAllDisplayModes won't always contain the desktop display mode (if + * NULL is passed in) - for example on a retina 15" MBP, System Preferences + * allows choosing 1920x1200 but it's not in the list. AddDisplayMode makes + * sure there are no duplicates so it's safe to always add the desktop mode + * even in cases where it is in the CopyAllDisplayModes list. + */ + if (desktopmoderef && GetDisplayMode(_this, desktopmoderef, link, &desktopmode)) { + if (!SDL_AddDisplayMode(display, &desktopmode)) { + CGDisplayModeRelease(desktopmoderef); + SDL_free(desktopmode.driverdata); + } + } else { + CGDisplayModeRelease(desktopmoderef); + } + + modes = CGDisplayCopyAllDisplayModes(data->display, NULL); if (modes) { - CVDisplayLinkRef link = NULL; - const CFIndex count = CFArrayGetCount(modes); CFIndex i; - - CVDisplayLinkCreateWithCGDisplay(data->display, &link); + const CFIndex count = CFArrayGetCount(modes); for (i = 0; i < count; i++) { CGDisplayModeRef moderef = (CGDisplayModeRef) CFArrayGetValueAtIndex(modes, i); SDL_DisplayMode mode; + if (GetDisplayMode(_this, moderef, link, &mode)) { - CGDisplayModeRetain(moderef); - SDL_AddDisplayMode(display, &mode); + if (SDL_AddDisplayMode(display, &mode)) { + CGDisplayModeRetain(moderef); + } else { + SDL_free(mode.driverdata); + } } } - CVDisplayLinkRelease(link); CFRelease(modes); } + + CVDisplayLinkRelease(link); } int diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamouse.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamouse.h index 4f60c8372..b79a3cf98 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamouse.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoamouse_h -#define _SDL_cocoamouse_h +#ifndef SDL_cocoamouse_h_ +#define SDL_cocoamouse_h_ #include "SDL_cocoavideo.h" @@ -47,6 +47,6 @@ typedef struct { + (NSCursor *)invisibleCursor; @end -#endif /* _SDL_cocoamouse_h */ +#endif /* SDL_cocoamouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamouse.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamouse.m index 0a27549ae..029a31832 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamouse.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamouse.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,7 @@ #include "SDL_events.h" #include "SDL_cocoamouse.h" #include "SDL_cocoamousetap.h" +#include "SDL_cocoavideo.h" #include "../../events/SDL_mouse_c.h" @@ -363,10 +364,10 @@ void Cocoa_HandleMouseEvent(_THIS, NSEvent *event) { switch ([event type]) { - case NSMouseMoved: - case NSLeftMouseDragged: - case NSRightMouseDragged: - case NSOtherMouseDragged: + case NSEventTypeMouseMoved: + case NSEventTypeLeftMouseDragged: + case NSEventTypeRightMouseDragged: + case NSEventTypeOtherMouseDragged: break; default: @@ -431,17 +432,7 @@ Cocoa_HandleMouseWheel(SDL_Window *window, NSEvent *event) } } - if (x > 0) { - x = SDL_ceil(x); - } else if (x < 0) { - x = SDL_floor(x); - } - if (y > 0) { - y = SDL_ceil(y); - } else if (y < 0) { - y = SDL_floor(y); - } - SDL_SendMouseWheel(window, mouse->mouseID, (int)x, (int)y, direction); + SDL_SendMouseWheel(window, mouse->mouseID, x, y, direction); } void diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamousetap.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamousetap.h index af92314b6..40ce3861f 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamousetap.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamousetap.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,15 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoamousetap_h -#define _SDL_cocoamousetap_h +#ifndef SDL_cocoamousetap_h_ +#define SDL_cocoamousetap_h_ #include "SDL_cocoamouse.h" extern void Cocoa_InitMouseEventTap(SDL_MouseData *driverdata); +extern void Cocoa_EnableMouseEventTap(SDL_MouseData *driverdata, SDL_bool enabled); extern void Cocoa_QuitMouseEventTap(SDL_MouseData *driverdata); -#endif /* _SDL_cocoamousetap_h */ +#endif /* SDL_cocoamousetap_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamousetap.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamousetap.m index 48abbca9c..3c4fcf23e 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoamousetap.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoamousetap.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -69,11 +69,14 @@ Cocoa_MouseTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event switch (type) { case kCGEventTapDisabledByTimeout: - case kCGEventTapDisabledByUserInput: { CGEventTapEnable(tapdata->tap, true); return NULL; } + case kCGEventTapDisabledByUserInput: + { + return NULL; + } default: break; } @@ -142,15 +145,12 @@ Cocoa_MouseTapThread(void *data) { SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)data; - /* Create a tap. */ - CFMachPortRef eventTap = CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap, - kCGEventTapOptionDefault, allGrabbedEventsMask, - &Cocoa_MouseTapCallback, tapdata); + /* Tap was created on main thread but we own it now. */ + CFMachPortRef eventTap = tapdata->tap; if (eventTap) { /* Try to create a runloop source we can schedule. */ CFRunLoopSourceRef runloopSource = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, eventTap, 0); if (runloopSource) { - tapdata->tap = eventTap; tapdata->runloopSource = runloopSource; } else { CFRelease(eventTap); @@ -202,15 +202,32 @@ Cocoa_InitMouseEventTap(SDL_MouseData* driverdata) tapdata->runloopStartedSemaphore = SDL_CreateSemaphore(0); if (tapdata->runloopStartedSemaphore) { - tapdata->thread = SDL_CreateThreadInternal(&Cocoa_MouseTapThread, "Event Tap Loop", 512 * 1024, tapdata); - if (!tapdata->thread) { - SDL_DestroySemaphore(tapdata->runloopStartedSemaphore); + tapdata->tap = CGEventTapCreate(kCGSessionEventTap, kCGHeadInsertEventTap, + kCGEventTapOptionDefault, allGrabbedEventsMask, + &Cocoa_MouseTapCallback, tapdata); + if (tapdata->tap) { + /* Tap starts disabled, until app requests mouse grab */ + CGEventTapEnable(tapdata->tap, false); + tapdata->thread = SDL_CreateThreadInternal(&Cocoa_MouseTapThread, "Event Tap Loop", 512 * 1024, tapdata); + if (tapdata->thread) { + /* Success - early out. Ownership transferred to thread. */ + return; + } + CFRelease(tapdata->tap); } + SDL_DestroySemaphore(tapdata->runloopStartedSemaphore); } + SDL_free(driverdata->tapdata); + driverdata->tapdata = NULL; +} - if (!tapdata->thread) { - SDL_free(driverdata->tapdata); - driverdata->tapdata = NULL; +void +Cocoa_EnableMouseEventTap(SDL_MouseData *driverdata, SDL_bool enabled) +{ + SDL_MouseEventTapData *tapdata = (SDL_MouseEventTapData*)driverdata->tapdata; + if (tapdata && tapdata->tap) + { + CGEventTapEnable(tapdata->tap, !!enabled); } } @@ -245,6 +262,11 @@ Cocoa_InitMouseEventTap(SDL_MouseData *unused) { } +void +Cocoa_EnableMouseEventTap(SDL_MouseData *driverdata, SDL_bool enabled) +{ +} + void Cocoa_QuitMouseEventTap(SDL_MouseData *driverdata) { diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengl.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengl.h index 1f7bd57f0..81ca5edd5 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengl.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoaopengl_h -#define _SDL_cocoaopengl_h +#ifndef SDL_cocoaopengl_h_ +#define SDL_cocoaopengl_h_ #if SDL_VIDEO_OPENGL_CGL @@ -58,11 +58,11 @@ extern void Cocoa_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h); extern int Cocoa_GL_SetSwapInterval(_THIS, int interval); extern int Cocoa_GL_GetSwapInterval(_THIS); -extern void Cocoa_GL_SwapWindow(_THIS, SDL_Window * window); +extern int Cocoa_GL_SwapWindow(_THIS, SDL_Window * window); extern void Cocoa_GL_DeleteContext(_THIS, SDL_GLContext context); #endif /* SDL_VIDEO_OPENGL_CGL */ -#endif /* _SDL_cocoaopengl_h */ +#endif /* SDL_cocoaopengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengl.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengl.m index 645e5ba45..5f18a2ee8 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengl.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengl.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,6 +25,7 @@ #if SDL_VIDEO_OPENGL_CGL #include "SDL_cocoavideo.h" #include "SDL_cocoaopengl.h" +#include "SDL_cocoaopengles.h" #include #include @@ -165,8 +166,27 @@ Cocoa_GL_CreateContext(_THIS, SDL_Window * window) int glversion_minor; if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { - SDL_SetError ("OpenGL ES is not supported on this platform"); +#if SDL_VIDEO_OPENGL_EGL + /* Switch to EGL based functions */ + Cocoa_GL_UnloadLibrary(_this); + _this->GL_LoadLibrary = Cocoa_GLES_LoadLibrary; + _this->GL_GetProcAddress = Cocoa_GLES_GetProcAddress; + _this->GL_UnloadLibrary = Cocoa_GLES_UnloadLibrary; + _this->GL_CreateContext = Cocoa_GLES_CreateContext; + _this->GL_MakeCurrent = Cocoa_GLES_MakeCurrent; + _this->GL_SetSwapInterval = Cocoa_GLES_SetSwapInterval; + _this->GL_GetSwapInterval = Cocoa_GLES_GetSwapInterval; + _this->GL_SwapWindow = Cocoa_GLES_SwapWindow; + _this->GL_DeleteContext = Cocoa_GLES_DeleteContext; + + if (Cocoa_GLES_LoadLibrary(_this, NULL) != 0) { + return NULL; + } + return Cocoa_GLES_CreateContext(_this, window); +#else + SDL_SetError("SDL not configured with EGL support"); return NULL; +#endif } if ((_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_CORE) && !lion_or_later) { SDL_SetError ("OpenGL Core Profile is not supported on this platform version"); @@ -383,13 +403,14 @@ Cocoa_GL_GetSwapInterval(_THIS) return status; }} -void +int Cocoa_GL_SwapWindow(_THIS, SDL_Window * window) { @autoreleasepool { SDLOpenGLContext* nscontext = (SDLOpenGLContext*)SDL_GL_GetCurrentContext(); [nscontext flushBuffer]; [nscontext updateIfNeeded]; + return 0; }} void diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengles.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengles.h new file mode 100644 index 000000000..fc7f5c054 --- /dev/null +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengles.h @@ -0,0 +1,49 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_cocoaopengles_h_ +#define SDL_cocoaopengles_h_ + +#if SDL_VIDEO_OPENGL_EGL + +#include "../SDL_sysvideo.h" +#include "../SDL_egl_c.h" + +/* OpenGLES functions */ +#define Cocoa_GLES_GetAttribute SDL_EGL_GetAttribute +#define Cocoa_GLES_GetProcAddress SDL_EGL_GetProcAddress +#define Cocoa_GLES_UnloadLibrary SDL_EGL_UnloadLibrary +#define Cocoa_GLES_GetSwapInterval SDL_EGL_GetSwapInterval +#define Cocoa_GLES_SetSwapInterval SDL_EGL_SetSwapInterval + +extern int Cocoa_GLES_LoadLibrary(_THIS, const char *path); +extern SDL_GLContext Cocoa_GLES_CreateContext(_THIS, SDL_Window * window); +extern int Cocoa_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int Cocoa_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +extern void Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context); +extern int Cocoa_GLES_SetupWindow(_THIS, SDL_Window * window); + +#endif /* SDL_VIDEO_OPENGL_EGL */ + +#endif /* SDL_cocoaopengles_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengles.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengles.m new file mode 100644 index 000000000..e0a05a1a3 --- /dev/null +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoaopengles.m @@ -0,0 +1,132 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_COCOA && SDL_VIDEO_OPENGL_EGL + +#include "SDL_cocoavideo.h" +#include "SDL_cocoaopengles.h" +#include "SDL_cocoaopengl.h" +#include "SDL_log.h" + +/* EGL implementation of SDL OpenGL support */ + +int +Cocoa_GLES_LoadLibrary(_THIS, const char *path) { + + /* If the profile requested is not GL ES, switch over to WIN_GL functions */ + if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { +#if SDL_VIDEO_OPENGL_CGL + Cocoa_GLES_UnloadLibrary(_this); + _this->GL_LoadLibrary = Cocoa_GL_LoadLibrary; + _this->GL_GetProcAddress = Cocoa_GL_GetProcAddress; + _this->GL_UnloadLibrary = Cocoa_GL_UnloadLibrary; + _this->GL_CreateContext = Cocoa_GL_CreateContext; + _this->GL_MakeCurrent = Cocoa_GL_MakeCurrent; + _this->GL_SetSwapInterval = Cocoa_GL_SetSwapInterval; + _this->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval; + _this->GL_SwapWindow = Cocoa_GL_SwapWindow; + _this->GL_DeleteContext = Cocoa_GL_DeleteContext; + return Cocoa_GL_LoadLibrary(_this, path); +#else + return SDL_SetError("SDL not configured with OpenGL/CGL support"); +#endif + } + + if (_this->egl_data == NULL) { + return SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0); + } + + return 0; +} + +SDL_GLContext +Cocoa_GLES_CreateContext(_THIS, SDL_Window * window) +{ + SDL_GLContext context; + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + +#if SDL_VIDEO_OPENGL_CGL + if (_this->gl_config.profile_mask != SDL_GL_CONTEXT_PROFILE_ES) { + /* Switch to CGL based functions */ + Cocoa_GLES_UnloadLibrary(_this); + _this->GL_LoadLibrary = Cocoa_GL_LoadLibrary; + _this->GL_GetProcAddress = Cocoa_GL_GetProcAddress; + _this->GL_UnloadLibrary = Cocoa_GL_UnloadLibrary; + _this->GL_CreateContext = Cocoa_GL_CreateContext; + _this->GL_MakeCurrent = Cocoa_GL_MakeCurrent; + _this->GL_SetSwapInterval = Cocoa_GL_SetSwapInterval; + _this->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval; + _this->GL_SwapWindow = Cocoa_GL_SwapWindow; + _this->GL_DeleteContext = Cocoa_GL_DeleteContext; + + if (Cocoa_GL_LoadLibrary(_this, NULL) != 0) { + return NULL; + } + + return Cocoa_GL_CreateContext(_this, window); + } +#endif + + context = SDL_EGL_CreateContext(_this, data->egl_surface); + return context; +} + +void +Cocoa_GLES_DeleteContext(_THIS, SDL_GLContext context) +{ + SDL_EGL_DeleteContext(_this, context); + Cocoa_GLES_UnloadLibrary(_this); +} + +SDL_EGL_SwapWindow_impl(Cocoa) +SDL_EGL_MakeCurrent_impl(Cocoa) + +int +Cocoa_GLES_SetupWindow(_THIS, SDL_Window * window) +{ + /* The current context is lost in here; save it and reset it. */ + SDL_WindowData *windowdata = (SDL_WindowData *) window->driverdata; + SDL_Window *current_win = SDL_GL_GetCurrentWindow(); + SDL_GLContext current_ctx = SDL_GL_GetCurrentContext(); + + + if (_this->egl_data == NULL) { + if (SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0) < 0) { + SDL_EGL_UnloadLibrary(_this); + return -1; + } + } + + /* Create the GLES window surface */ + NSView* v = windowdata->nswindow.contentView; + windowdata->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType)[v layer]); + + if (windowdata->egl_surface == EGL_NO_SURFACE) { + return SDL_SetError("Could not create GLES window surface"); + } + + return Cocoa_GLES_MakeCurrent(_this, current_win, current_ctx); +} + +#endif /* SDL_VIDEO_DRIVER_COCOA && SDL_VIDEO_OPENGL_EGL */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoashape.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoashape.h index f64b59178..da1b5eb8e 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoashape.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoashape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_cocoashape_h -#define _SDL_cocoashape_h +#ifndef SDL_cocoashape_h_ +#define SDL_cocoashape_h_ #include "SDL_stdinc.h" #include "SDL_video.h" @@ -40,4 +40,6 @@ extern SDL_WindowShaper* Cocoa_CreateShaper(SDL_Window* window); extern int Cocoa_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode); extern int Cocoa_ResizeWindowShape(SDL_Window *window); -#endif +#endif /* SDL_cocoashape_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoashape.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoashape.m index fc8a2775c..7a2f04f6e 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoashape.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoashape.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,7 +35,7 @@ Cocoa_CreateShaper(SDL_Window* window) SDL_WindowData* windata = (SDL_WindowData*)window->driverdata; [windata->nswindow setOpaque:NO]; - [windata->nswindow setStyleMask:NSBorderlessWindowMask]; + [windata->nswindow setStyleMask:NSWindowStyleMaskBorderless]; SDL_WindowShaper* result = result = malloc(sizeof(SDL_WindowShaper)); result->window = window; diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoavideo.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoavideo.h index 498ce6cca..05bbd3483 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoavideo.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoavideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoavideo_h -#define _SDL_cocoavideo_h +#ifndef SDL_cocoavideo_h_ +#define SDL_cocoavideo_h_ #include "SDL_opengl.h" @@ -40,6 +40,59 @@ #include "SDL_cocoaopengl.h" #include "SDL_cocoawindow.h" +#ifndef MAC_OS_X_VERSION_10_12 +#define DECLARE_EVENT(name) static const NSEventType NSEventType##name = NS##name +DECLARE_EVENT(LeftMouseDown); +DECLARE_EVENT(LeftMouseUp); +DECLARE_EVENT(RightMouseDown); +DECLARE_EVENT(RightMouseUp); +DECLARE_EVENT(OtherMouseDown); +DECLARE_EVENT(OtherMouseUp); +DECLARE_EVENT(MouseMoved); +DECLARE_EVENT(LeftMouseDragged); +DECLARE_EVENT(RightMouseDragged); +DECLARE_EVENT(OtherMouseDragged); +DECLARE_EVENT(ScrollWheel); +DECLARE_EVENT(KeyDown); +DECLARE_EVENT(KeyUp); +DECLARE_EVENT(FlagsChanged); +#undef DECLARE_EVENT + +static const NSEventMask NSEventMaskAny = NSAnyEventMask; + +#define DECLARE_MODIFIER_FLAG(name) static const NSUInteger NSEventModifierFlag##name = NS##name##KeyMask +DECLARE_MODIFIER_FLAG(Shift); +DECLARE_MODIFIER_FLAG(Control); +DECLARE_MODIFIER_FLAG(Command); +DECLARE_MODIFIER_FLAG(NumericPad); +DECLARE_MODIFIER_FLAG(Help); +DECLARE_MODIFIER_FLAG(Function); +#undef DECLARE_MODIFIER_FLAG +static const NSUInteger NSEventModifierFlagCapsLock = NSAlphaShiftKeyMask; +static const NSUInteger NSEventModifierFlagOption = NSAlternateKeyMask; + +#define DECLARE_WINDOW_MASK(name) static const unsigned int NSWindowStyleMask##name = NS##name##WindowMask +DECLARE_WINDOW_MASK(Borderless); +DECLARE_WINDOW_MASK(Titled); +DECLARE_WINDOW_MASK(Closable); +DECLARE_WINDOW_MASK(Miniaturizable); +DECLARE_WINDOW_MASK(Resizable); +DECLARE_WINDOW_MASK(TexturedBackground); +DECLARE_WINDOW_MASK(UnifiedTitleAndToolbar); +DECLARE_WINDOW_MASK(FullScreen); +/*DECLARE_WINDOW_MASK(FullSizeContentView);*/ /* Not used, fails compile on older SDKs */ +static const unsigned int NSWindowStyleMaskUtilityWindow = NSUtilityWindowMask; +static const unsigned int NSWindowStyleMaskDocModalWindow = NSDocModalWindowMask; +static const unsigned int NSWindowStyleMaskHUDWindow = NSHUDWindowMask; +#undef DECLARE_WINDOW_MASK + +#define DECLARE_ALERT_STYLE(name) static const NSUInteger NSAlertStyle##name = NS##name##AlertStyle +DECLARE_ALERT_STYLE(Warning); +DECLARE_ALERT_STYLE(Informational); +DECLARE_ALERT_STYLE(Critical); +#undef DECLARE_ALERT_STYLE +#endif + /* Private display data */ @class SDLTranslatorResponder; @@ -60,6 +113,6 @@ typedef struct SDL_VideoData /* Utility functions */ extern NSImage * Cocoa_CreateImage(SDL_Surface * surface); -#endif /* _SDL_cocoavideo_h */ +#endif /* SDL_cocoavideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoavideo.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoavideo.m index e436e6521..545dc1ed9 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoavideo.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoavideo.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,7 @@ #include "SDL_endian.h" #include "SDL_cocoavideo.h" #include "SDL_cocoashape.h" +#include "SDL_cocoavulkan.h" #include "SDL_assert.h" /* Initialization/Query functions */ @@ -80,8 +81,8 @@ Cocoa_CreateDevice(int devindex) device->PumpEvents = Cocoa_PumpEvents; device->SuspendScreenSaver = Cocoa_SuspendScreenSaver; - device->CreateWindow = Cocoa_CreateWindow; - device->CreateWindowFrom = Cocoa_CreateWindowFrom; + device->CreateSDLWindow = Cocoa_CreateWindow; + device->CreateSDLWindowFrom = Cocoa_CreateWindowFrom; device->SetWindowTitle = Cocoa_SetWindowTitle; device->SetWindowIcon = Cocoa_SetWindowIcon; device->SetWindowPosition = Cocoa_SetWindowPosition; @@ -120,6 +121,24 @@ Cocoa_CreateDevice(int devindex) device->GL_GetSwapInterval = Cocoa_GL_GetSwapInterval; device->GL_SwapWindow = Cocoa_GL_SwapWindow; device->GL_DeleteContext = Cocoa_GL_DeleteContext; +#elif SDL_VIDEO_OPENGL_EGL + device->GL_LoadLibrary = Cocoa_GLES_LoadLibrary; + device->GL_GetProcAddress = Cocoa_GLES_GetProcAddress; + device->GL_UnloadLibrary = Cocoa_GLES_UnloadLibrary; + device->GL_CreateContext = Cocoa_GLES_CreateContext; + device->GL_MakeCurrent = Cocoa_GLES_MakeCurrent; + device->GL_SetSwapInterval = Cocoa_GLES_SetSwapInterval; + device->GL_GetSwapInterval = Cocoa_GLES_GetSwapInterval; + device->GL_SwapWindow = Cocoa_GLES_SwapWindow; + device->GL_DeleteContext = Cocoa_GLES_DeleteContext; +#endif + +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = Cocoa_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = Cocoa_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = Cocoa_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = Cocoa_Vulkan_CreateSurface; + device->Vulkan_GetDrawableSize = Cocoa_Vulkan_GetDrawableSize; #endif device->StartTextInput = Cocoa_StartTextInput; diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoavulkan.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoavulkan.h new file mode 100644 index 000000000..a49c148c1 --- /dev/null +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoavulkan.h @@ -0,0 +1,55 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.h. + */ + + +#include "../../SDL_internal.h" + +#ifndef SDL_cocoavulkan_h_ +#define SDL_cocoavulkan_h_ + +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA + +int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path); +void Cocoa_Vulkan_UnloadLibrary(_THIS); +SDL_bool Cocoa_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool Cocoa_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +void Cocoa_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h); + +#endif + +#endif /* SDL_cocoavulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoavulkan.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoavulkan.m new file mode 100644 index 000000000..2cf55bb5a --- /dev/null +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoavulkan.m @@ -0,0 +1,231 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.c. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_COCOA + +#include "SDL_cocoavideo.h" +#include "SDL_cocoawindow.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_cocoametalview.h" +#include "SDL_cocoavulkan.h" +#include "SDL_syswm.h" + +#include + +const char* defaultPaths[] = { + "vulkan.framework/vulkan", + "libvulkan.1.dylib", + "MoltenVK.framework/MoltenVK", + "libMoltenVK.dylib" +}; + +/* Since libSDL is most likely a .dylib, need RTLD_DEFAULT not RTLD_SELF. */ +#define DEFAULT_HANDLE RTLD_DEFAULT + +int Cocoa_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasMacOSSurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + + if (_this->vulkan_config.loader_handle) { + SDL_SetError("Vulkan/MoltenVK already loaded"); + return -1; + } + + /* Load the Vulkan loader library */ + if (!path) { + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + } + + if (!path) { + /* MoltenVK framework, currently, v0.17.0, has a static library and is + * the recommended way to use the package. There is likely no object to + * load. */ + vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)dlsym(DEFAULT_HANDLE, + "vkGetInstanceProcAddr"); + } + + if (vkGetInstanceProcAddr) { + _this->vulkan_config.loader_handle = DEFAULT_HANDLE; + } else { + const char** paths; + int numPaths; + int i; + + if (path) { + paths = &path; + numPaths = 1; + } else { + /* Look for framework or .dylib packaged with the application + * instead. */ + paths = defaultPaths; + numPaths = SDL_arraysize(defaultPaths); + } + + for (i=0; i < numPaths; i++) { + _this->vulkan_config.loader_handle = SDL_LoadObject(paths[i]); + if (_this->vulkan_config.loader_handle) + break; + else + continue; + } + if (i == numPaths) + return -1; + + SDL_strlcpy(_this->vulkan_config.loader_path, paths[i], + SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + } + + if (!vkGetInstanceProcAddr) { + SDL_SetError("Failed to find %s in either executable or %s: %s", + "vkGetInstanceProcAddr", + _this->vulkan_config.loader_path, + (const char *) dlerror()); + goto fail; + } + + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if (!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) { + goto fail; + } + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if (!extensions) { + goto fail; + } + for (Uint32 i = 0; i < extensionCount; i++) { + if (SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) { + hasSurfaceExtension = SDL_TRUE; + } else if (SDL_strcmp(VK_MVK_MACOS_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) { + hasMacOSSurfaceExtension = SDL_TRUE; + } + } + SDL_free(extensions); + if (!hasSurfaceExtension) { + SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } else if (!hasMacOSSurfaceExtension) { + SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the " + VK_MVK_MACOS_SURFACE_EXTENSION_NAME "extension"); + goto fail; + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void Cocoa_Vulkan_UnloadLibrary(_THIS) +{ + if (_this->vulkan_config.loader_handle) { + if (_this->vulkan_config.loader_handle != DEFAULT_HANDLE) { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + } + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool Cocoa_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForCocoa[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_MVK_MACOS_SURFACE_EXTENSION_NAME + }; + if (!_this->vulkan_config.loader_handle) { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForCocoa), + extensionsForCocoa); +} + +SDL_bool Cocoa_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + PFN_vkCreateMacOSSurfaceMVK vkCreateMacOSSurfaceMVK = + (PFN_vkCreateMacOSSurfaceMVK)vkGetInstanceProcAddr( + (VkInstance)instance, + "vkCreateMacOSSurfaceMVK"); + VkMacOSSurfaceCreateInfoMVK createInfo = {}; + VkResult result; + + if (!_this->vulkan_config.loader_handle) { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + if (!vkCreateMacOSSurfaceMVK) { + SDL_SetError(VK_MVK_MACOS_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + createInfo.sType = VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.pView = Cocoa_Mtl_AddMetalView(window); + result = vkCreateMacOSSurfaceMVK(instance, &createInfo, + NULL, surface); + if (result != VK_SUCCESS) { + SDL_SetError("vkCreateMacOSSurfaceMVK failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; +} + +void Cocoa_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h) +{ + Cocoa_Mtl_GetDrawableSize(window, w, h); +} + +#endif + +/* vim: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoawindow.h b/Engine/lib/sdl/src/video/cocoa/SDL_cocoawindow.h index a32de8387..df6f173a7 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoawindow.h +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoawindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,11 +20,15 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_cocoawindow_h -#define _SDL_cocoawindow_h +#ifndef SDL_cocoawindow_h_ +#define SDL_cocoawindow_h_ #import +#if SDL_VIDEO_OPENGL_EGL +#include "../SDL_egl_c.h" +#endif + typedef struct SDL_WindowData SDL_WindowData; typedef enum @@ -114,6 +118,9 @@ struct SDL_WindowData SDL_bool inWindowMove; Cocoa_WindowListener *listener; struct SDL_VideoData *videodata; +#if SDL_VIDEO_OPENGL_EGL + EGLSurface egl_surface; +#endif }; extern int Cocoa_CreateWindow(_THIS, SDL_Window * window); @@ -142,6 +149,6 @@ extern void Cocoa_DestroyWindow(_THIS, SDL_Window * window); extern SDL_bool Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info); extern int Cocoa_SetWindowHitTest(SDL_Window *window, SDL_bool enabled); -#endif /* _SDL_cocoawindow_h */ +#endif /* SDL_cocoawindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/cocoa/SDL_cocoawindow.m b/Engine/lib/sdl/src/video/cocoa/SDL_cocoawindow.m index cfad54854..b1a5b465d 100644 --- a/Engine/lib/sdl/src/video/cocoa/SDL_cocoawindow.m +++ b/Engine/lib/sdl/src/video/cocoa/SDL_cocoawindow.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -38,7 +38,9 @@ #include "SDL_cocoavideo.h" #include "SDL_cocoashape.h" #include "SDL_cocoamouse.h" +#include "SDL_cocoamousetap.h" #include "SDL_cocoaopengl.h" +#include "SDL_cocoaopengles.h" #include "SDL_assert.h" /* #define DEBUG_COCOAWINDOW */ @@ -64,10 +66,31 @@ - (NSDragOperation)draggingEntered:(id )sender; - (BOOL)performDragOperation:(id )sender; - (BOOL)wantsPeriodicDraggingUpdates; +- (BOOL)validateMenuItem:(NSMenuItem *)menuItem; + +- (SDL_Window*)findSDLWindow; @end @implementation SDLWindow +- (BOOL)validateMenuItem:(NSMenuItem *)menuItem +{ + /* Only allow using the macOS native fullscreen toggle menubar item if the + * window is resizable and not in a SDL fullscreen mode. + */ + if ([menuItem action] == @selector(toggleFullScreen:)) { + SDL_Window *window = [self findSDLWindow]; + if (window == NULL) { + return NO; + } else if ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_FULLSCREEN_DESKTOP)) != 0) { + return NO; + } else if ((window->flags & SDL_WINDOW_RESIZABLE) == 0) { + return NO; + } + } + return [super validateMenuItem:menuItem]; +} + - (BOOL)canBecomeKeyWindow { return YES; @@ -82,7 +105,7 @@ { [super sendEvent:event]; - if ([event type] != NSLeftMouseUp) { + if ([event type] != NSEventTypeLeftMouseUp) { return; } @@ -116,11 +139,10 @@ - (BOOL)performDragOperation:(id )sender { @autoreleasepool { - SDL_VideoDevice *_this = SDL_GetVideoDevice(); NSPasteboard *pasteboard = [sender draggingPasteboard]; NSArray *types = [NSArray arrayWithObject:NSFilenamesPboardType]; NSString *desiredType = [pasteboard availableTypeFromArray:types]; - SDL_Window *sdlwindow = nil; + SDL_Window *sdlwindow = [self findSDLWindow]; if (desiredType == nil) { return NO; /* can't accept anything that's being dropped here. */ @@ -157,16 +179,6 @@ } } - /* !!! FIXME: is there a better way to do this? */ - if (_this) { - for (sdlwindow = _this->windows; sdlwindow; sdlwindow = sdlwindow->next) { - NSWindow *nswindow = ((SDL_WindowData *) sdlwindow->driverdata)->nswindow; - if (nswindow == self) { - break; - } - } - } - if (!SDL_SendDropFile(sdlwindow, [[fileURL path] UTF8String])) { return NO; } @@ -181,6 +193,24 @@ return NO; } +- (SDL_Window*)findSDLWindow +{ + SDL_Window *sdlwindow = NULL; + SDL_VideoDevice *_this = SDL_GetVideoDevice(); + + /* !!! FIXME: is there a better way to do this? */ + if (_this) { + for (sdlwindow = _this->windows; sdlwindow; sdlwindow = sdlwindow->next) { + NSWindow *nswindow = ((SDL_WindowData *) sdlwindow->driverdata)->nswindow; + if (nswindow == self) { + break; + } + } + } + + return sdlwindow; +} + @end @@ -220,15 +250,15 @@ GetWindowStyle(SDL_Window * window) NSUInteger style = 0; if (window->flags & SDL_WINDOW_FULLSCREEN) { - style = NSBorderlessWindowMask; + style = NSWindowStyleMaskBorderless; } else { if (window->flags & SDL_WINDOW_BORDERLESS) { - style = NSBorderlessWindowMask; + style = NSWindowStyleMaskBorderless; } else { - style = (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask); + style = (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable); } if (window->flags & SDL_WINDOW_RESIZABLE) { - style |= NSResizableWindowMask; + style |= NSWindowStyleMaskResizable; } } return style; @@ -491,6 +521,11 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) NSRect rect = [nswindow contentRectForFrameRect:[nswindow frame]]; ConvertNSRect([nswindow screen], fullscreen, &rect); + if (inFullscreenTransition) { + /* We'll take care of this at the end of the transition */ + return; + } + if (s_moveHack) { SDL_bool blockMove = ((SDL_GetTicks() - s_moveHack) < 500); @@ -594,8 +629,8 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) [NSMenu setMenuBarVisible:NO]; } - const unsigned int newflags = [NSEvent modifierFlags] & NSAlphaShiftKeyMask; - _data->videodata->modifierFlags = (_data->videodata->modifierFlags & ~NSAlphaShiftKeyMask) | newflags; + const unsigned int newflags = [NSEvent modifierFlags] & NSEventModifierFlagCapsLock; + _data->videodata->modifierFlags = (_data->videodata->modifierFlags & ~NSEventModifierFlagCapsLock) | newflags; SDL_ToggleModState(KMOD_CAPS, newflags != 0); } @@ -641,7 +676,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) { SDL_Window *window = _data->window; - SetWindowStyle(window, (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask)); + SetWindowStyle(window, (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskResizable)); isFullscreenSpace = YES; inFullscreenTransition = YES; @@ -666,6 +701,8 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) - (void)windowDidEnterFullScreen:(NSNotification *)aNotification { SDL_Window *window = _data->window; + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + NSWindow *nswindow = data->nswindow; inFullscreenTransition = NO; @@ -673,6 +710,11 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) pendingWindowOperation = PENDING_OPERATION_NONE; [self setFullscreenSpace:NO]; } else { + /* Unset the resizable flag. + This is a workaround for https://bugzilla.libsdl.org/show_bug.cgi?id=3697 + */ + SetWindowStyle(window, [nswindow styleMask] & (~NSWindowStyleMaskResizable)); + if ((window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP) { [NSMenu setMenuBarVisible:NO]; } @@ -683,6 +725,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) */ window->w = 0; window->h = 0; + [self windowDidMove:aNotification]; [self windowDidResize:aNotification]; } } @@ -691,13 +734,13 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) { SDL_Window *window = _data->window; + isFullscreenSpace = NO; + inFullscreenTransition = YES; + /* As of OS X 10.11, the window seems to need to be resizable when exiting a Space, in order for it to resize back to its windowed-mode size. */ - SetWindowStyle(window, GetWindowStyle(window) | NSResizableWindowMask); - - isFullscreenSpace = NO; - inFullscreenTransition = YES; + SetWindowStyle(window, GetWindowStyle(window) | NSWindowStyleMaskResizable); } - (void)windowDidFailToExitFullScreen:(NSNotification *)aNotification @@ -708,7 +751,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) return; } - SetWindowStyle(window, (NSTitledWindowMask|NSClosableWindowMask|NSMiniaturizableWindowMask|NSResizableWindowMask)); + SetWindowStyle(window, (NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskMiniaturizable|NSWindowStyleMaskResizable)); isFullscreenSpace = YES; inFullscreenTransition = NO; @@ -744,11 +787,36 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) [NSMenu setMenuBarVisible:YES]; pendingWindowOperation = PENDING_OPERATION_NONE; + +#if 0 +/* This fixed bug 3719, which is that changing window size while fullscreen + doesn't take effect when leaving fullscreen, but introduces bug 3809, + which is that a maximized window doesn't go back to normal size when + restored, so this code is disabled until we can properly handle the + beginning and end of maximize and restore. + */ + /* Restore windowed size and position in case it changed while fullscreen */ + { + NSRect rect; + rect.origin.x = window->windowed.x; + rect.origin.y = window->windowed.y; + rect.size.width = window->windowed.w; + rect.size.height = window->windowed.h; + ConvertNSRect([nswindow screen], NO, &rect); + + s_moveHack = 0; + [nswindow setContentSize:rect.size]; + [nswindow setFrameOrigin:rect.origin]; + s_moveHack = SDL_GetTicks(); + } +#endif /* 0 */ + /* Force the size change event in case it was delivered earlier while the window was still animating into place. */ window->w = 0; window->h = 0; + [self windowDidMove:aNotification]; [self windowDidResize:aNotification]; /* FIXME: Why does the window get hidden? */ @@ -839,7 +907,7 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) switch ([theEvent buttonNumber]) { case 0: - if (([theEvent modifierFlags] & NSControlKeyMask) && + if (([theEvent modifierFlags] & NSEventModifierFlagControl) && GetHintCtrlClickEmulateRightClick()) { wasCtrlLeft = YES; button = SDL_BUTTON_RIGHT; @@ -1085,6 +1153,11 @@ SetWindowStyle(SDL_Window * window, NSUInteger style) - (void)drawRect:(NSRect)dirtyRect { + /* Force the graphics context to clear to black so we don't get a flash of + white until the app is ready to draw. In practice on modern macOS, this + only gets called for window creation and other extraordinary events. */ + [[NSColor blackColor] setFill]; + NSRectFill(dirtyRect); SDL_SendWindowEvent(_sdlWindow, SDL_WINDOWEVENT_EXPOSED, 0, 0); } @@ -1168,12 +1241,12 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, SDL_bool created { unsigned long style = [nswindow styleMask]; - if (style == NSBorderlessWindowMask) { + if (style == NSWindowStyleMaskBorderless) { window->flags |= SDL_WINDOW_BORDERLESS; } else { window->flags &= ~SDL_WINDOW_BORDERLESS; } - if (style & NSResizableWindowMask) { + if (style & NSWindowStyleMaskResizable) { window->flags |= SDL_WINDOW_RESIZABLE; } else { window->flags &= ~SDL_WINDOW_RESIZABLE; @@ -1249,7 +1322,6 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) @catch (NSException *e) { return SDL_SetError("%s", [[e reason] UTF8String]); } - [nswindow setBackgroundColor:[NSColor blackColor]]; if (videodata->allow_spaces) { SDL_assert(floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6); @@ -1271,7 +1343,14 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) [contentView setWantsBestResolutionOpenGLSurface:YES]; } } - +#if SDL_VIDEO_OPENGL_ES2 +#if SDL_VIDEO_OPENGL_EGL + if ((window->flags & SDL_WINDOW_OPENGL) && + _this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { + [contentView setWantsLayer:TRUE]; + } +#endif /* SDL_VIDEO_OPENGL_EGL */ +#endif /* SDL_VIDEO_OPENGL_ES2 */ [nswindow setContentView:contentView]; [contentView release]; @@ -1282,6 +1361,25 @@ Cocoa_CreateWindow(_THIS, SDL_Window * window) [nswindow release]; return -1; } + + if (!(window->flags & SDL_WINDOW_OPENGL)) { + return 0; + } + + /* The rest of this macro mess is for OpenGL or OpenGL ES windows */ +#if SDL_VIDEO_OPENGL_ES2 + if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES) { +#if SDL_VIDEO_OPENGL_EGL + if (Cocoa_GLES_SetupWindow(_this, window) < 0) { + Cocoa_DestroyWindow(_this, window); + return -1; + } + return 0; +#else + return SDL_SetError("Could not create GLES window surface (EGL support not configured)"); +#endif /* SDL_VIDEO_OPENGL_EGL */ + } +#endif /* SDL_VIDEO_OPENGL_ES2 */ return 0; }} @@ -1534,7 +1632,7 @@ Cocoa_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display rect.origin.y += (screenRect.size.height - rect.size.height); } - [nswindow setStyleMask:NSBorderlessWindowMask]; + [nswindow setStyleMask:NSWindowStyleMaskBorderless]; } else { rect.origin.x = window->windowed.x; rect.origin.y = window->windowed.y; @@ -1634,8 +1732,13 @@ Cocoa_GetWindowGammaRamp(_THIS, SDL_Window * window, Uint16 * ramp) void Cocoa_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) { - /* Move the cursor to the nearest point in the window */ + SDL_Mouse *mouse = SDL_GetMouse(); SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + + /* Enable or disable the event tap as necessary */ + Cocoa_EnableMouseEventTap(mouse->driverdata, grabbed); + + /* Move the cursor to the nearest point in the window */ if (grabbed && data && ![data->listener isMoving]) { int x, y; CGPoint cgpoint; @@ -1700,7 +1803,7 @@ Cocoa_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) info->info.cocoa.window = nswindow; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_WM.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_WM.c index 4b979f36c..d9d0c3a03 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_WM.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_WM.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_WM.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_WM.h index f5f9a46fd..98d943fa3 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_WM.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_WM.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_directfb_wm_h -#define _SDL_directfb_wm_h +#ifndef SDL_directfb_wm_h_ +#define SDL_directfb_wm_h_ #include "SDL_DirectFB_video.h" @@ -51,6 +51,6 @@ extern DFBResult DirectFB_WM_GetClientSize(_THIS, SDL_Window * window, int *cw, int *ch); -#endif /* _SDL_directfb_wm_h */ +#endif /* SDL_directfb_wm_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_dyn.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_dyn.c index 52a4b5367..12cf21af5 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_dyn.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_dyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_dyn.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_dyn.h index bd99a3faf..1a370c641 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_dyn.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_dyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_DirectFB_dyn_h -#define _SDL_DirectFB_dyn_h +#ifndef SDL_DirectFB_dyn_h_ +#define SDL_DirectFB_dyn_h_ #define DFB_SYMS \ DFB_SYM(DFBResult, DirectFBError, (const char *msg, DFBResult result), (msg, result), return) \ @@ -36,4 +36,6 @@ int SDL_DirectFB_LoadLibrary(void); void SDL_DirectFB_UnLoadLibrary(void); -#endif +#endif /* SDL_DirectFB_dyn_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_events.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_events.c index 0bf9fdba5..27cf19f91 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_events.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -743,9 +743,6 @@ void DirectFB_QuitKeyboard(_THIS) { /* SDL_DFB_DEVICEDATA(_this); */ - - SDL_KeyboardQuit(); - } #endif /* SDL_VIDEO_DRIVER_DIRECTFB */ diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_events.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_events.h index 2931ad2a1..ccbdb0ac9 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_events.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_DirectFB_events_h -#define _SDL_DirectFB_events_h +#ifndef SDL_DirectFB_events_h_ +#define SDL_DirectFB_events_h_ #include "../SDL_sysvideo.h" @@ -29,4 +29,6 @@ extern void DirectFB_InitKeyboard(_THIS); extern void DirectFB_QuitKeyboard(_THIS); extern void DirectFB_PumpEventsWindow(_THIS); -#endif +#endif /* SDL_DirectFB_events_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_modes.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_modes.c index 9d0abf560..a3b8b45bf 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_modes.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_modes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_modes.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_modes.h index 9911eff56..75d8bbfd9 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_modes.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_modes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_directfb_modes_h -#define _SDL_directfb_modes_h +#ifndef SDL_directfb_modes_h_ +#define SDL_directfb_modes_h_ #include @@ -54,6 +54,6 @@ extern void DirectFB_QuitModes(_THIS); extern void DirectFB_SetContext(_THIS, SDL_Window *window); -#endif /* _SDL_directfb_modes_h */ +#endif /* SDL_directfb_modes_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_mouse.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_mouse.c index 0657d2f06..a2b3e416e 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_mouse.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,10 +36,8 @@ static SDL_Cursor *DirectFB_CreateDefaultCursor(void); static SDL_Cursor *DirectFB_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y); static int DirectFB_ShowCursor(SDL_Cursor * cursor); -static void DirectFB_MoveCursor(SDL_Cursor * cursor); static void DirectFB_FreeCursor(SDL_Cursor * cursor); static void DirectFB_WarpMouse(SDL_Window * window, int x, int y); -static void DirectFB_FreeMouse(SDL_Mouse * mouse); static const char *arrow[] = { /* pixels */ @@ -84,11 +82,9 @@ DirectFB_CreateDefaultCursor(void) SDL_DFB_DEVICEDATA(dev); DFB_CursorData *curdata; - DFBResult ret; DFBSurfaceDescription dsc; SDL_Cursor *cursor; Uint32 *dest; - Uint32 *p; int pitch, i, j; SDL_DFB_ALLOC_CLEAR( cursor, sizeof(*cursor)); @@ -139,7 +135,6 @@ DirectFB_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) SDL_DFB_DEVICEDATA(dev); DFB_CursorData *curdata; - DFBResult ret; DFBSurfaceDescription dsc; SDL_Cursor *cursor; Uint32 *dest; @@ -184,7 +179,6 @@ static int DirectFB_ShowCursor(SDL_Cursor * cursor) { SDL_DFB_CURSORDATA(cursor); - DFBResult ret; SDL_Window *window; window = SDL_GetFocusWindow(); @@ -239,7 +233,6 @@ DirectFB_WarpMouse(SDL_Window * window, int x, int y) SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); DFB_DisplayData *dispdata = (DFB_DisplayData *) display->driverdata; DFB_WindowData *windata = (DFB_WindowData *) window->driverdata; - DFBResult ret; int cx, cy; SDL_DFB_CHECKERR(windata->dfbwin->GetPosition(windata->dfbwin, &cx, &cy)); @@ -253,8 +246,10 @@ DirectFB_WarpMouse(SDL_Window * window, int x, int y) #if USE_MULTI_API +static void DirectFB_MoveCursor(SDL_Cursor * cursor); static void DirectFB_WarpMouse(SDL_Mouse * mouse, SDL_Window * window, int x, int y); +static void DirectFB_FreeMouse(SDL_Mouse * mouse); static int id_mask; diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_mouse.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_mouse.h index 4e2f27a92..e1236a07e 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_mouse.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_DirectFB_mouse_h -#define _SDL_DirectFB_mouse_h +#ifndef SDL_DirectFB_mouse_h_ +#define SDL_DirectFB_mouse_h_ #include @@ -39,6 +39,6 @@ struct _DFB_CursorData extern void DirectFB_InitMouse(_THIS); extern void DirectFB_QuitMouse(_THIS); -#endif /* _SDL_DirectFB_mouse_h */ +#endif /* SDL_DirectFB_mouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_opengl.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_opengl.c index 065854a08..93d2fdeff 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_opengl.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_opengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -117,9 +117,9 @@ DirectFB_GL_LoadLibrary(_THIS, const char *path) if (path == NULL) { - path = SDL_getenv("SDL_VIDEO_GL_DRIVER"); + path = SDL_getenv("SDL_OPENGL_LIBRARY"); if (path == NULL) { - path = "libGL.so"; + path = "libGL.so.1"; } } @@ -133,7 +133,6 @@ DirectFB_GL_LoadLibrary(_THIS, const char *path) SDL_DFB_DEBUG("Loaded library: %s\n", path); _this->gl_config.dll_handle = handle; - _this->gl_config.driver_loaded = 1; if (path) { SDL_strlcpy(_this->gl_config.driver_path, path, SDL_arraysize(_this->gl_config.driver_path)); @@ -151,16 +150,10 @@ static void DirectFB_GL_UnloadLibrary(_THIS) { #if 0 - int ret; - - if (_this->gl_config.driver_loaded) { - - ret = GL_UnloadObject(_this->gl_config.dll_handle); - if (ret) - SDL_DFB_ERR("Error #%d trying to unload library.\n", ret); - _this->gl_config.dll_handle = NULL; - _this->gl_config.driver_loaded = 0; - } + int ret = GL_UnloadObject(_this->gl_config.dll_handle); + if (ret) + SDL_DFB_ERR("Error #%d trying to unload library.\n", ret); + _this->gl_config.dll_handle = NULL; #endif /* Free OpenGL memory */ SDL_free(_this->gl_data); @@ -246,18 +239,12 @@ DirectFB_GL_GetSwapInterval(_THIS) return 0; } -void +int DirectFB_GL_SwapWindow(_THIS, SDL_Window * window) { SDL_DFB_WINDOWDATA(window); - DFBRegion region; DirectFB_GLContext *p; - region.x1 = 0; - region.y1 = 0; - region.x2 = window->w; - region.y2 = window->h; - #if 0 if (devdata->glFinish) devdata->glFinish(); @@ -273,9 +260,9 @@ DirectFB_GL_SwapWindow(_THIS, SDL_Window * window) } SDL_DFB_CHECKERR(windata->window_surface->Flip(windata->window_surface,NULL, DSFLIP_PIPELINE |DSFLIP_BLIT | DSFLIP_ONSYNC )); - return; + return 0; error: - return; + return -1; } void diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_opengl.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_opengl.h index 6391ee4f3..9463e1bba 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_opengl.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ -#ifndef _SDL_directfb_opengl_h -#define _SDL_directfb_opengl_h +#ifndef SDL_directfb_opengl_h_ +#define SDL_directfb_opengl_h_ #include "SDL_DirectFB_video.h" @@ -50,7 +50,7 @@ extern int DirectFB_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern int DirectFB_GL_SetSwapInterval(_THIS, int interval); extern int DirectFB_GL_GetSwapInterval(_THIS); -extern void DirectFB_GL_SwapWindow(_THIS, SDL_Window * window); +extern int DirectFB_GL_SwapWindow(_THIS, SDL_Window * window); extern void DirectFB_GL_DeleteContext(_THIS, SDL_GLContext context); extern void DirectFB_GL_FreeWindowContexts(_THIS, SDL_Window * window); @@ -59,6 +59,6 @@ extern void DirectFB_GL_DestroyWindowContexts(_THIS, SDL_Window * window); #endif /* SDL_DIRECTFB_OPENGL */ -#endif /* _SDL_directfb_opengl_h */ +#endif /* SDL_directfb_opengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_render.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_render.c index 4a1bf46b8..4054f732a 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_render.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_render.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -217,7 +217,9 @@ static SDL_INLINE IDirectFBSurface *get_dfb_surface(SDL_Window *window) SDL_memset(&wm_info, 0, sizeof(SDL_SysWMinfo)); SDL_VERSION(&wm_info.version); - SDL_GetWindowWMInfo(window, &wm_info); + if (!SDL_GetWindowWMInfo(window, &wm_info)) { + return NULL; + } return wm_info.info.dfb.surface; } @@ -228,7 +230,9 @@ static SDL_INLINE IDirectFBWindow *get_dfb_window(SDL_Window *window) SDL_memset(&wm_info, 0, sizeof(SDL_SysWMinfo)); SDL_VERSION(&wm_info.version); - SDL_GetWindowWMInfo(window, &wm_info); + if (!SDL_GetWindowWMInfo(window, &wm_info)) { + return NULL; + } return wm_info.info.dfb.window; } @@ -332,7 +336,7 @@ DirectFB_WindowEvent(SDL_Renderer * renderer, const SDL_WindowEvent *event) } } -int +static int DirectFB_RenderClear(SDL_Renderer * renderer) { DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; @@ -344,7 +348,6 @@ DirectFB_RenderClear(SDL_Renderer * renderer) destsurf->Clear(destsurf, renderer->r, renderer->g, renderer->b, renderer->a); - return 0; } @@ -357,6 +360,10 @@ DirectFB_CreateRenderer(SDL_Window * window, Uint32 flags) DirectFB_RenderData *data = NULL; DFBSurfaceCapabilities scaps; + if (!winsurf) { + return NULL; + } + SDL_DFB_ALLOC_CLEAR(renderer, sizeof(*renderer)); SDL_DFB_ALLOC_CLEAR(data, sizeof(*data)); @@ -530,7 +537,7 @@ DirectFB_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture) /* find the right pixelformat */ pixelformat = DirectFB_SDLToDFBPixelFormat(texture->format); if (pixelformat == DSPF_UNKNOWN) { - SDL_SetError("Unknown pixel format %d\n", data->format); + SDL_SetError("Unknown pixel format %d", data->format); goto error; } @@ -1273,7 +1280,7 @@ DirectFB_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect, Uint32 format, void * pixels, int pitch) { Uint32 sdl_format; - void * laypixels; + unsigned char* laypixels; int laypitch; DFBSurfacePixelFormat dfb_format; DirectFB_RenderData *data = (DirectFB_RenderData *) renderer->driverdata; @@ -1303,7 +1310,7 @@ DirectFB_RenderWritePixels(SDL_Renderer * renderer, const SDL_Rect * rect, SDL_Window *window = renderer->window; SDL_DFB_WINDOWDATA(window); Uint32 sdl_format; - void * laypixels; + unsigned char* laypixels; int laypitch; DFBSurfacePixelFormat dfb_format; diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_render.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_render.h index be016b084..bc3c07595 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_render.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_render.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_shape.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_shape.c index 3239e3021..36559319f 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_shape.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,25 +29,22 @@ #include "../SDL_shape_internals.h" -SDL_Window* -DirectFB_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) { - return SDL_CreateWindow(title,x,y,w,h,flags /* | SDL_DFB_WINDOW_SHAPED */); -} - SDL_WindowShaper* DirectFB_CreateShaper(SDL_Window* window) { SDL_WindowShaper* result = NULL; + SDL_ShapeData* data; + int resized_properly; result = malloc(sizeof(SDL_WindowShaper)); result->window = window; result->mode.mode = ShapeModeDefault; result->mode.parameters.binarizationCutoff = 1; result->userx = result->usery = 0; - SDL_ShapeData* data = SDL_malloc(sizeof(SDL_ShapeData)); + data = SDL_malloc(sizeof(SDL_ShapeData)); result->driverdata = data; data->surface = NULL; window->shaper = result; - int resized_properly = DirectFB_ResizeWindowShape(window); + resized_properly = DirectFB_ResizeWindowShape(window); SDL_assert(resized_properly == 0); return result; diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_shape.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_shape.h index 46be39fbf..f0a418df5 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_shape.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_DirectFB_shape_h -#define _SDL_DirectFB_shape_h +#ifndef SDL_DirectFB_shape_h_ +#define SDL_DirectFB_shape_h_ #include @@ -31,9 +31,8 @@ typedef struct { IDirectFBSurface *surface; } SDL_ShapeData; -extern SDL_Window* DirectFB_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags); extern SDL_WindowShaper* DirectFB_CreateShaper(SDL_Window* window); extern int DirectFB_ResizeWindowShape(SDL_Window* window); extern int DirectFB_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode); -#endif /* _SDL_DirectFB_shape_h */ +#endif /* SDL_DirectFB_shape_h_ */ diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_video.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_video.c index d339dd78e..45fa81dc1 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_video.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,14 +22,10 @@ #if SDL_VIDEO_DRIVER_DIRECTFB -#include "SDL_DirectFB_video.h" - -#include "SDL_DirectFB_events.h" /* * #include "SDL_DirectFB_keyboard.h" */ #include "SDL_DirectFB_modes.h" -#include "SDL_DirectFB_mouse.h" #include "SDL_DirectFB_opengl.h" #include "SDL_DirectFB_window.h" #include "SDL_DirectFB_WM.h" @@ -107,16 +103,14 @@ DirectFB_CreateDevice(int devindex) /* Initialize all variables that we clean on shutdown */ SDL_DFB_ALLOC_CLEAR(device, sizeof(SDL_VideoDevice)); - /* Set the function pointers */ - /* Set the function pointers */ device->VideoInit = DirectFB_VideoInit; device->VideoQuit = DirectFB_VideoQuit; device->GetDisplayModes = DirectFB_GetDisplayModes; device->SetDisplayMode = DirectFB_SetDisplayMode; device->PumpEvents = DirectFB_PumpEventsWindow; - device->CreateWindow = DirectFB_CreateWindow; - device->CreateWindowFrom = DirectFB_CreateWindowFrom; + device->CreateSDLWindow = DirectFB_CreateWindow; + device->CreateSDLWindowFrom = DirectFB_CreateWindowFrom; device->SetWindowTitle = DirectFB_SetWindowTitle; device->SetWindowIcon = DirectFB_SetWindowIcon; device->SetWindowPosition = DirectFB_SetWindowPosition; @@ -178,7 +172,7 @@ DirectFB_DeviceInformation(IDirectFB * dfb) SDL_DFB_LOG( "Driver Version: %d.%d", desc.driver.major, desc.driver.minor); - SDL_DFB_LOG( "Video memoory: %d", desc.video_memory); + SDL_DFB_LOG( "Video memory: %d", desc.video_memory); SDL_DFB_LOG( "Blitting flags:"); for (n = 0; blitting_flags[n].flag; n++) { @@ -234,8 +228,7 @@ DirectFB_VideoInit(_THIS) DirectFBSetOption("disable-module", "x11input"); } - /* FIXME: Reenable as default once multi kbd/mouse interface is sorted out */ - devdata->use_linux_input = readBoolEnv(DFBENV_USE_LINUX_INPUT, 0); /* default: on */ + devdata->use_linux_input = readBoolEnv(DFBENV_USE_LINUX_INPUT, 1); /* default: on */ if (!devdata->use_linux_input) { diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_video.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_video.h index b36ace0dd..f019031cf 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_video.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_DirectFB_video_h -#define _SDL_DirectFB_video_h +#ifndef SDL_DirectFB_video_h_ +#define SDL_DirectFB_video_h_ #include #include @@ -167,4 +167,4 @@ DFBSurfacePixelFormat DirectFB_SDLToDFBPixelFormat(Uint32 format); void DirectFB_SetSupportedPixelFormats(SDL_RendererInfo *ri); -#endif /* _SDL_DirectFB_video_h */ +#endif /* SDL_DirectFB_video_h_ */ diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_window.c b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_window.c index 40bbe6aee..55171ed1d 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_window.c +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_window.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -458,9 +458,29 @@ SDL_bool DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo * info) { + const Uint32 version = ((((Uint32) info->version.major) * 1000000) + + (((Uint32) info->version.minor) * 10000) + + (((Uint32) info->version.patch))); + SDL_DFB_DEVICEDATA(_this); SDL_DFB_WINDOWDATA(window); + /* Before 2.0.6, it was possible to build an SDL with DirectFB support + (SDL_SysWMinfo will be large enough to hold DirectFB info), but build + your app against SDL headers that didn't have DirectFB support + (SDL_SysWMinfo could be smaller than DirectFB needs. This would lead + to an app properly using SDL_GetWindowWMInfo() but we'd accidentally + overflow memory on the stack or heap. To protect against this, we've + padded out the struct unconditionally in the headers and DirectFB will + just return an error for older apps using this function. Those apps + will need to be recompiled against newer headers or not use DirectFB, + maybe by forcing SDL_VIDEODRIVER=x11. */ + if (version < 2000006) { + info->subsystem = SDL_SYSWM_UNKNOWN; + SDL_SetError("Version must be 2.0.6 or newer"); + return SDL_FALSE; + } + if (info->version.major == SDL_MAJOR_VERSION && info->version.minor == SDL_MINOR_VERSION) { info->subsystem = SDL_SYSWM_DIRECTFB; @@ -469,7 +489,7 @@ DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window, info->info.dfb.surface = windata->surface; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_window.h b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_window.h index 4b9970812..f03aab2e5 100644 --- a/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_window.h +++ b/Engine/lib/sdl/src/video/directfb/SDL_DirectFB_window.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_directfb_window_h -#define _SDL_directfb_window_h +#ifndef SDL_directfb_window_h_ +#define SDL_directfb_window_h_ #include "SDL_DirectFB_video.h" #include "SDL_DirectFB_WM.h" @@ -77,6 +77,6 @@ extern SDL_bool DirectFB_GetWindowWMInfo(_THIS, SDL_Window * window, extern void DirectFB_AdjustWindowSurface(SDL_Window * window); extern int DirectFB_SetWindowOpacity(_THIS, SDL_Window * window, float opacity); -#endif /* _SDL_directfb_window_h */ +#endif /* SDL_directfb_window_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/dummy/SDL_nullevents.c b/Engine/lib/sdl/src/video/dummy/SDL_nullevents.c index a5a944304..e9918bd8e 100644 --- a/Engine/lib/sdl/src/video/dummy/SDL_nullevents.c +++ b/Engine/lib/sdl/src/video/dummy/SDL_nullevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/dummy/SDL_nullevents_c.h b/Engine/lib/sdl/src/video/dummy/SDL_nullevents_c.h index d2f78698d..a5636be53 100644 --- a/Engine/lib/sdl/src/video/dummy/SDL_nullevents_c.h +++ b/Engine/lib/sdl/src/video/dummy/SDL_nullevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/dummy/SDL_nullframebuffer.c b/Engine/lib/sdl/src/video/dummy/SDL_nullframebuffer.c index 01c8a5abb..64c77810e 100644 --- a/Engine/lib/sdl/src/video/dummy/SDL_nullframebuffer.c +++ b/Engine/lib/sdl/src/video/dummy/SDL_nullframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/dummy/SDL_nullframebuffer_c.h b/Engine/lib/sdl/src/video/dummy/SDL_nullframebuffer_c.h index 37d198f90..5d6b7aed5 100644 --- a/Engine/lib/sdl/src/video/dummy/SDL_nullframebuffer_c.h +++ b/Engine/lib/sdl/src/video/dummy/SDL_nullframebuffer_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/dummy/SDL_nullvideo.c b/Engine/lib/sdl/src/video/dummy/SDL_nullvideo.c index 96f47813a..317faf4fd 100644 --- a/Engine/lib/sdl/src/video/dummy/SDL_nullvideo.c +++ b/Engine/lib/sdl/src/video/dummy/SDL_nullvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -84,6 +84,7 @@ DUMMY_CreateDevice(int devindex) SDL_OutOfMemory(); return (0); } + device->is_dummy = SDL_TRUE; /* Set the function pointers */ device->VideoInit = DUMMY_VideoInit; diff --git a/Engine/lib/sdl/src/video/dummy/SDL_nullvideo.h b/Engine/lib/sdl/src/video/dummy/SDL_nullvideo.h index 0126ba183..c77034935 100644 --- a/Engine/lib/sdl/src/video/dummy/SDL_nullvideo.h +++ b/Engine/lib/sdl/src/video/dummy/SDL_nullvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,11 +20,11 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_nullvideo_h -#define _SDL_nullvideo_h +#ifndef SDL_nullvideo_h_ +#define SDL_nullvideo_h_ #include "../SDL_sysvideo.h" -#endif /* _SDL_nullvideo_h */ +#endif /* SDL_nullvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenevents.c b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenevents.c index a4720e402..14bc24030 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenevents.c +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -270,7 +270,7 @@ static const SDL_Scancode emscripten_scancode_table[] = { /* "borrowed" from SDL_windowsevents.c */ -int +static int Emscripten_ConvertUTF32toUTF8(Uint32 codepoint, char * text) { if (codepoint <= 0x7F) { @@ -297,13 +297,23 @@ Emscripten_ConvertUTF32toUTF8(Uint32 codepoint, char * text) return SDL_TRUE; } -EM_BOOL +static EM_BOOL +Emscripten_HandlePointerLockChange(int eventType, const EmscriptenPointerlockChangeEvent *changeEvent, void *userData) +{ + SDL_WindowData *window_data = (SDL_WindowData *) userData; + /* keep track of lock losses, so we can regrab if/when appropriate. */ + window_data->has_pointer_lock = changeEvent->isActive; + return 0; +} + + +static EM_BOOL Emscripten_HandleMouseMove(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData) { SDL_WindowData *window_data = userData; + const int isPointerLocked = window_data->has_pointer_lock; int mx, my; static double residualx = 0, residualy = 0; - EmscriptenPointerlockChangeEvent pointerlock_status; /* rescale (in case canvas is being scaled)*/ double client_w, client_h, xscale, yscale; @@ -311,10 +321,6 @@ Emscripten_HandleMouseMove(int eventType, const EmscriptenMouseEvent *mouseEvent xscale = window_data->window->w / client_w; yscale = window_data->window->h / client_h; - /* check for pointer lock */ - int isPointerLockSupported = emscripten_get_pointerlock_status(&pointerlock_status); - int isPointerLocked = isPointerLockSupported == EMSCRIPTEN_RESULT_SUCCESS ? pointerlock_status.isActive : SDL_FALSE; - if (isPointerLocked) { residualx += mouseEvent->movementX * xscale; residualy += mouseEvent->movementY * yscale; @@ -332,11 +338,14 @@ Emscripten_HandleMouseMove(int eventType, const EmscriptenMouseEvent *mouseEvent return 0; } -EM_BOOL +static EM_BOOL Emscripten_HandleMouseButton(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData) { SDL_WindowData *window_data = userData; - uint32_t sdl_button; + Uint8 sdl_button; + Uint8 sdl_button_state; + SDL_EventType sdl_event_type; + switch (mouseEvent->button) { case 0: sdl_button = SDL_BUTTON_LEFT; @@ -351,22 +360,27 @@ Emscripten_HandleMouseButton(int eventType, const EmscriptenMouseEvent *mouseEve return 0; } - SDL_EventType sdl_event_type = (eventType == EMSCRIPTEN_EVENT_MOUSEDOWN ? SDL_PRESSED : SDL_RELEASED); - SDL_SendMouseButton(window_data->window, 0, sdl_event_type, sdl_button); + if (eventType == EMSCRIPTEN_EVENT_MOUSEDOWN) { + if (SDL_GetMouse()->relative_mode && !window_data->has_pointer_lock) { + emscripten_request_pointerlock(NULL, 0); /* try to regrab lost pointer lock. */ + } + sdl_button_state = SDL_PRESSED; + sdl_event_type = SDL_MOUSEBUTTONDOWN; + } else { + sdl_button_state = SDL_RELEASED; + sdl_event_type = SDL_MOUSEBUTTONUP; + } + SDL_SendMouseButton(window_data->window, 0, sdl_button_state, sdl_button); return SDL_GetEventState(sdl_event_type) == SDL_ENABLE; } -EM_BOOL +static EM_BOOL Emscripten_HandleMouseFocus(int eventType, const EmscriptenMouseEvent *mouseEvent, void *userData) { SDL_WindowData *window_data = userData; int mx = mouseEvent->canvasX, my = mouseEvent->canvasY; - EmscriptenPointerlockChangeEvent pointerlock_status; - - /* check for pointer lock */ - int isPointerLockSupported = emscripten_get_pointerlock_status(&pointerlock_status); - int isPointerLocked = isPointerLockSupported == EMSCRIPTEN_RESULT_SUCCESS ? pointerlock_status.isActive : SDL_FALSE; + const int isPointerLocked = window_data->has_pointer_lock; if (!isPointerLocked) { /* rescale (in case canvas is being scaled)*/ @@ -382,15 +396,15 @@ Emscripten_HandleMouseFocus(int eventType, const EmscriptenMouseEvent *mouseEven return SDL_GetEventState(SDL_WINDOWEVENT) == SDL_ENABLE; } -EM_BOOL +static EM_BOOL Emscripten_HandleWheel(int eventType, const EmscriptenWheelEvent *wheelEvent, void *userData) { SDL_WindowData *window_data = userData; - SDL_SendMouseWheel(window_data->window, 0, wheelEvent->deltaX, -wheelEvent->deltaY, SDL_MOUSEWHEEL_NORMAL); + SDL_SendMouseWheel(window_data->window, 0, (float)wheelEvent->deltaX, (float)-wheelEvent->deltaY, SDL_MOUSEWHEEL_NORMAL); return SDL_GetEventState(SDL_MOUSEWHEEL) == SDL_ENABLE; } -EM_BOOL +static EM_BOOL Emscripten_HandleFocus(int eventType, const EmscriptenFocusEvent *wheelEvent, void *userData) { SDL_WindowData *window_data = userData; @@ -405,7 +419,7 @@ Emscripten_HandleFocus(int eventType, const EmscriptenFocusEvent *wheelEvent, vo return SDL_GetEventState(SDL_WINDOWEVENT) == SDL_ENABLE; } -EM_BOOL +static EM_BOOL Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, void *userData) { SDL_WindowData *window_data = userData; @@ -423,6 +437,7 @@ Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, vo for (i = 0; i < touchEvent->numTouches; i++) { SDL_FingerID id; float x, y; + int mx, my; if (!touchEvent->touches[i].isChanged) continue; @@ -431,11 +446,14 @@ Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, vo x = touchEvent->touches[i].canvasX / client_w; y = touchEvent->touches[i].canvasY / client_h; + mx = x * window_data->window->w; + my = y * window_data->window->h; + if (eventType == EMSCRIPTEN_EVENT_TOUCHSTART) { if (!window_data->finger_touching) { window_data->finger_touching = SDL_TRUE; window_data->first_finger = id; - SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, x, y); + SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, mx, my); SDL_SendMouseButton(window_data->window, SDL_TOUCH_MOUSEID, SDL_PRESSED, SDL_BUTTON_LEFT); } SDL_SendTouch(deviceId, id, SDL_TRUE, x, y, 1.0f); @@ -445,7 +463,7 @@ Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, vo } } else if (eventType == EMSCRIPTEN_EVENT_TOUCHMOVE) { if ((window_data->finger_touching) && (window_data->first_finger == id)) { - SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, x, y); + SDL_SendMouseMotion(window_data->window, SDL_TOUCH_MOUSEID, 0, mx, my); } SDL_SendTouchMotion(deviceId, id, x, y, 1.0f); @@ -468,10 +486,12 @@ Emscripten_HandleTouch(int eventType, const EmscriptenTouchEvent *touchEvent, vo return preventDefault; } -EM_BOOL +static EM_BOOL Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData) { Uint32 scancode; + SDL_bool prevent_default; + SDL_bool is_nav_key; /* .keyCode is deprecated, but still the most reliable way to get keys */ if (keyEvent->keyCode < SDL_arraysize(emscripten_scancode_table)) { @@ -499,18 +519,25 @@ Emscripten_HandleKey(int eventType, const EmscriptenKeyboardEvent *keyEvent, voi } } - SDL_bool prevent_default = SDL_GetEventState(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_KEYDOWN : SDL_KEYUP) == SDL_ENABLE; + prevent_default = SDL_GetEventState(eventType == EMSCRIPTEN_EVENT_KEYDOWN ? SDL_KEYDOWN : SDL_KEYUP) == SDL_ENABLE; /* if TEXTINPUT events are enabled we can't prevent keydown or we won't get keypress * we need to ALWAYS prevent backspace and tab otherwise chrome takes action and does bad navigation UX */ - if (eventType == EMSCRIPTEN_EVENT_KEYDOWN && SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE && keyEvent->keyCode != 8 /* backspace */ && keyEvent->keyCode != 9 /* tab */) + is_nav_key = keyEvent->keyCode == 8 /* backspace */ || + keyEvent->keyCode == 9 /* tab */ || + keyEvent->keyCode == 37 /* left */ || + keyEvent->keyCode == 38 /* up */ || + keyEvent->keyCode == 39 /* right */ || + keyEvent->keyCode == 40 /* down */; + + if (eventType == EMSCRIPTEN_EVENT_KEYDOWN && SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE && !is_nav_key) prevent_default = SDL_FALSE; return prevent_default; } -EM_BOOL +static EM_BOOL Emscripten_HandleKeyPress(int eventType, const EmscriptenKeyboardEvent *keyEvent, void *userData) { char text[5]; @@ -520,7 +547,7 @@ Emscripten_HandleKeyPress(int eventType, const EmscriptenKeyboardEvent *keyEvent return SDL_GetEventState(SDL_TEXTINPUT) == SDL_ENABLE; } -EM_BOOL +static EM_BOOL Emscripten_HandleFullscreenChange(int eventType, const EmscriptenFullscreenChangeEvent *fullscreenChangeEvent, void *userData) { SDL_WindowData *window_data = userData; @@ -541,13 +568,15 @@ Emscripten_HandleFullscreenChange(int eventType, const EmscriptenFullscreenChang return 0; } -EM_BOOL +static EM_BOOL Emscripten_HandleResize(int eventType, const EmscriptenUiEvent *uiEvent, void *userData) { SDL_WindowData *window_data = userData; /* update pixel ratio */ - window_data->pixel_ratio = emscripten_get_device_pixel_ratio(); + if (window_data->window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + window_data->pixel_ratio = emscripten_get_device_pixel_ratio(); + } if(!(window_data->window->flags & FULLSCREEN_MASK)) { @@ -591,7 +620,7 @@ Emscripten_HandleCanvasResize(int eventType, const void *reserved, void *userDat return 0; } -EM_BOOL +static EM_BOOL Emscripten_HandleVisibilityChange(int eventType, const EmscriptenVisibilityChangeEvent *visEvent, void *userData) { SDL_WindowData *window_data = userData; @@ -602,6 +631,8 @@ Emscripten_HandleVisibilityChange(int eventType, const EmscriptenVisibilityChang void Emscripten_RegisterEventHandlers(SDL_WindowData *data) { + const char *keyElement; + /* There is only one window and that window is the canvas */ emscripten_set_mousemove_callback("#canvas", data, 0, Emscripten_HandleMouseMove); @@ -621,8 +652,10 @@ Emscripten_RegisterEventHandlers(SDL_WindowData *data) emscripten_set_touchmove_callback("#canvas", data, 0, Emscripten_HandleTouch); emscripten_set_touchcancel_callback("#canvas", data, 0, Emscripten_HandleTouch); + emscripten_set_pointerlockchange_callback("#document", data, 0, Emscripten_HandlePointerLockChange); + /* Keyboard events are awkward */ - const char *keyElement = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT); + keyElement = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT); if (!keyElement) keyElement = "#window"; emscripten_set_keydown_callback(keyElement, data, 0, Emscripten_HandleKey); @@ -639,6 +672,8 @@ Emscripten_RegisterEventHandlers(SDL_WindowData *data) void Emscripten_UnregisterEventHandlers(SDL_WindowData *data) { + const char *target; + /* only works due to having one window */ emscripten_set_mousemove_callback("#canvas", NULL, 0, NULL); @@ -658,14 +693,15 @@ Emscripten_UnregisterEventHandlers(SDL_WindowData *data) emscripten_set_touchmove_callback("#canvas", NULL, 0, NULL); emscripten_set_touchcancel_callback("#canvas", NULL, 0, NULL); - const char *target = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT); + emscripten_set_pointerlockchange_callback("#document", NULL, 0, NULL); + + target = SDL_GetHint(SDL_HINT_EMSCRIPTEN_KEYBOARD_ELEMENT); if (!target) { target = "#window"; } emscripten_set_keydown_callback(target, NULL, 0, NULL); emscripten_set_keyup_callback(target, NULL, 0, NULL); - emscripten_set_keypress_callback(target, NULL, 0, NULL); emscripten_set_fullscreenchange_callback("#document", NULL, 0, NULL); diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenevents.h b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenevents.h index 089ff60da..3a4e05832 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenevents.h +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ -#ifndef _SDL_emscriptenevents_h -#define _SDL_emscriptenevents_h +#ifndef SDL_emscriptenevents_h_ +#define SDL_emscriptenevents_h_ #include "SDL_emscriptenvideo.h" @@ -31,9 +31,10 @@ Emscripten_RegisterEventHandlers(SDL_WindowData *data); extern void Emscripten_UnregisterEventHandlers(SDL_WindowData *data); -extern int +extern EM_BOOL Emscripten_HandleCanvasResize(int eventType, const void *reserved, void *userData); -#endif /* _SDL_emscriptenevents_h */ + +#endif /* SDL_emscriptenevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenframebuffer.c b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenframebuffer.c index 8a6a465d9..bfdec3b56 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenframebuffer.c +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenframebuffer.h b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenframebuffer.h index b2a6d3b37..49a215a2a 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenframebuffer.h +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_emscriptenframebuffer_h -#define _SDL_emscriptenframebuffer_h +#ifndef SDL_emscriptenframebuffer_h_ +#define SDL_emscriptenframebuffer_h_ extern int Emscripten_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, void ** pixels, int *pitch); extern int Emscripten_UpdateWindowFramebuffer(_THIS, SDL_Window * window, const SDL_Rect * rects, int numrects); extern void Emscripten_DestroyWindowFramebuffer(_THIS, SDL_Window * window); -#endif /* _SDL_emscriptenframebuffer_h */ +#endif /* SDL_emscriptenframebuffer_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenmouse.c b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenmouse.c index 512ad2220..490f5b05d 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenmouse.c +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,9 +32,8 @@ #include "../../events/SDL_mouse_c.h" #include "SDL_assert.h" - static SDL_Cursor* -Emscripten_CreateDefaultCursor() +Emscripten_CreateCursorFromString(const char* cursor_str, SDL_bool is_custom) { SDL_Cursor* cursor; Emscripten_CursorData *curdata; @@ -48,7 +47,8 @@ Emscripten_CreateDefaultCursor() return NULL; } - curdata->system_cursor = "default"; + curdata->system_cursor = cursor_str; + curdata->is_custom = is_custom; cursor->driverdata = curdata; } else { @@ -58,19 +58,82 @@ Emscripten_CreateDefaultCursor() return cursor; } -/* static SDL_Cursor* -Emscripten_CreateCursor(SDL_Surface* sruface, int hot_x, int hot_y) +Emscripten_CreateDefaultCursor() { - return Emscripten_CreateDefaultCursor(); + return Emscripten_CreateCursorFromString("default", SDL_FALSE); +} + +static SDL_Cursor* +Emscripten_CreateCursor(SDL_Surface* surface, int hot_x, int hot_y) +{ + const char *cursor_url = NULL; + SDL_Surface *conv_surf; + + conv_surf = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ABGR8888, 0); + + if (!conv_surf) { + return NULL; + } + + cursor_url = (const char *)EM_ASM_INT({ + var w = $0; + var h = $1; + var hot_x = $2; + var hot_y = $3; + var pixels = $4; + + var canvas = document.createElement("canvas"); + canvas.width = w; + canvas.height = h; + + var ctx = canvas.getContext("2d"); + + var image = ctx.createImageData(w, h); + var data = image.data; + var src = pixels >> 2; + var dst = 0; + var num; + if (typeof CanvasPixelArray !== 'undefined' && data instanceof CanvasPixelArray) { + // IE10/IE11: ImageData objects are backed by the deprecated CanvasPixelArray, + // not UInt8ClampedArray. These don't have buffers, so we need to revert + // to copying a byte at a time. We do the undefined check because modern + // browsers do not define CanvasPixelArray anymore. + num = data.length; + while (dst < num) { + var val = HEAP32[src]; // This is optimized. Instead, we could do {{{ makeGetValue('buffer', 'dst', 'i32') }}}; + data[dst ] = val & 0xff; + data[dst+1] = (val >> 8) & 0xff; + data[dst+2] = (val >> 16) & 0xff; + data[dst+3] = (val >> 24) & 0xff; + src++; + dst += 4; + } + } else { + var data32 = new Int32Array(data.buffer); + num = data32.length; + data32.set(HEAP32.subarray(src, src + num)); + } + + ctx.putImageData(image, 0, 0); + var url = hot_x === 0 && hot_y === 0 + ? "url(" + canvas.toDataURL() + "), auto" + : "url(" + canvas.toDataURL() + ") " + hot_x + " " + hot_y + ", auto"; + + var urlBuf = _malloc(url.length + 1); + stringToUTF8(url, urlBuf, url.length + 1); + + return urlBuf; + }, surface->w, surface->h, hot_x, hot_y, conv_surf->pixels); + + SDL_FreeSurface(conv_surf); + + return Emscripten_CreateCursorFromString(cursor_url, SDL_TRUE); } -*/ static SDL_Cursor* Emscripten_CreateSystemCursor(SDL_SystemCursor id) { - SDL_Cursor *cursor; - Emscripten_CursorData *curdata; const char *cursor_name = NULL; switch(id) { @@ -114,22 +177,7 @@ Emscripten_CreateSystemCursor(SDL_SystemCursor id) return NULL; } - cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor)); - if (!cursor) { - SDL_OutOfMemory(); - return NULL; - } - curdata = (Emscripten_CursorData *) SDL_calloc(1, sizeof(*curdata)); - if (!curdata) { - SDL_OutOfMemory(); - SDL_free(cursor); - return NULL; - } - - curdata->system_cursor = cursor_name; - cursor->driverdata = curdata; - - return cursor; + return Emscripten_CreateCursorFromString(cursor_name, SDL_FALSE); } static void @@ -140,6 +188,9 @@ Emscripten_FreeCursor(SDL_Cursor* cursor) curdata = (Emscripten_CursorData *) cursor->driverdata; if (curdata != NULL) { + if (curdata->is_custom) { + SDL_free((char *)curdata->system_cursor); + } SDL_free(cursor->driverdata); } @@ -202,9 +253,7 @@ Emscripten_InitMouse() { SDL_Mouse* mouse = SDL_GetMouse(); -/* mouse->CreateCursor = Emscripten_CreateCursor; -*/ mouse->ShowCursor = Emscripten_ShowCursor; mouse->FreeCursor = Emscripten_FreeCursor; mouse->WarpMouse = Emscripten_WarpMouse; @@ -217,17 +266,6 @@ Emscripten_InitMouse() void Emscripten_FiniMouse() { - SDL_Mouse* mouse = SDL_GetMouse(); - - Emscripten_FreeCursor(mouse->def_cursor); - mouse->def_cursor = NULL; - - mouse->CreateCursor = NULL; - mouse->ShowCursor = NULL; - mouse->FreeCursor = NULL; - mouse->WarpMouse = NULL; - mouse->CreateSystemCursor = NULL; - mouse->SetRelativeMouseMode = NULL; } #endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN */ diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenmouse.h b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenmouse.h index 76ea849ed..d6cd4927e 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenmouse.h +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,15 @@ */ -#ifndef _SDL_emscriptenmouse_h -#define _SDL_emscriptenmouse_h +#ifndef SDL_emscriptenmouse_h_ +#define SDL_emscriptenmouse_h_ + +#include "SDL_stdinc.h" typedef struct _Emscripten_CursorData { const char *system_cursor; + SDL_bool is_custom; } Emscripten_CursorData; extern void @@ -34,6 +37,6 @@ Emscripten_InitMouse(); extern void Emscripten_FiniMouse(); -#endif /* _SDL_emscriptenmouse_h */ +#endif /* SDL_emscriptenmouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenopengles.c b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenopengles.c index 12a37c604..a6609edc0 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenopengles.c +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -39,11 +39,15 @@ Emscripten_GLES_LoadLibrary(_THIS, const char *path) { if (!_this->egl_data) { return SDL_OutOfMemory(); } - + + /* Emscripten forces you to manually cast eglGetProcAddress to the real + function type; grep for "__eglMustCastToProperFunctionPointerType" in + Emscripten's egl.h for details. */ + _this->egl_data->eglGetProcAddress = (void *(EGLAPIENTRY *)(const char *)) eglGetProcAddress; + LOAD_FUNC(eglGetDisplay); LOAD_FUNC(eglInitialize); LOAD_FUNC(eglTerminate); - LOAD_FUNC(eglGetProcAddress); LOAD_FUNC(eglChooseConfig); LOAD_FUNC(eglGetConfigAttrib); LOAD_FUNC(eglCreateContext); @@ -66,8 +70,6 @@ Emscripten_GLES_LoadLibrary(_THIS, const char *path) { return SDL_SetError("Could not initialize EGL"); } - _this->gl_config.driver_loaded = 1; - if (path) { SDL_strlcpy(_this->gl_config.driver_path, path, sizeof(_this->gl_config.driver_path) - 1); } else { diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenopengles.h b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenopengles.h index edafed822..fbd93cbbb 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenopengles.h +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_emscriptenopengles_h -#define _SDL_emscriptenopengles_h +#ifndef SDL_emscriptenopengles_h_ +#define SDL_emscriptenopengles_h_ #if SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL @@ -38,12 +38,12 @@ extern int Emscripten_GLES_LoadLibrary(_THIS, const char *path); extern void Emscripten_GLES_DeleteContext(_THIS, SDL_GLContext context); extern SDL_GLContext Emscripten_GLES_CreateContext(_THIS, SDL_Window * window); -extern void Emscripten_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int Emscripten_GLES_SwapWindow(_THIS, SDL_Window * window); extern int Emscripten_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern void Emscripten_GLES_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h); #endif /* SDL_VIDEO_DRIVER_EMSCRIPTEN && SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_emscriptenopengles_h */ +#endif /* SDL_emscriptenopengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenvideo.c b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenvideo.c index 847bb4cf8..cbb933de8 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenvideo.c +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -91,8 +91,7 @@ Emscripten_CreateDevice(int devindex) device->PumpEvents = Emscripten_PumpEvents; - device->CreateWindow = Emscripten_CreateWindow; - /*device->CreateWindowFrom = Emscripten_CreateWindowFrom;*/ + device->CreateSDLWindow = Emscripten_CreateWindow; device->SetWindowTitle = Emscripten_SetWindowTitle; /*device->SetWindowIcon = Emscripten_SetWindowIcon; device->SetWindowPosition = Emscripten_SetWindowPosition;*/ @@ -111,6 +110,7 @@ Emscripten_CreateDevice(int devindex) device->UpdateWindowFramebuffer = Emscripten_UpdateWindowFramebuffer; device->DestroyWindowFramebuffer = Emscripten_DestroyWindowFramebuffer; +#if SDL_VIDEO_OPENGL_EGL device->GL_LoadLibrary = Emscripten_GLES_LoadLibrary; device->GL_GetProcAddress = Emscripten_GLES_GetProcAddress; device->GL_UnloadLibrary = Emscripten_GLES_UnloadLibrary; @@ -121,6 +121,7 @@ Emscripten_CreateDevice(int devindex) device->GL_SwapWindow = Emscripten_GLES_SwapWindow; device->GL_DeleteContext = Emscripten_GLES_DeleteContext; device->GL_GetDrawableSize = Emscripten_GLES_GetDrawableSize; +#endif device->free = Emscripten_DeleteDevice; @@ -228,6 +229,7 @@ Emscripten_CreateWindow(_THIS, SDL_Window * window) } } +#if SDL_VIDEO_OPENGL_EGL if (window->flags & SDL_WINDOW_OPENGL) { if (!_this->egl_data) { if (SDL_GL_LoadLibrary(NULL) < 0) { @@ -240,6 +242,7 @@ Emscripten_CreateWindow(_THIS, SDL_Window * window) return SDL_SetError("Could not create GLES window surface"); } } +#endif wdata->window = window; @@ -263,7 +266,9 @@ static void Emscripten_SetWindowSize(_THIS, SDL_Window * window) if (window->driverdata) { data = (SDL_WindowData *) window->driverdata; /* update pixel ratio */ - data->pixel_ratio = emscripten_get_device_pixel_ratio(); + if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + data->pixel_ratio = emscripten_get_device_pixel_ratio(); + } emscripten_set_canvas_size(window->w * data->pixel_ratio, window->h * data->pixel_ratio); /*scale canvas down*/ @@ -282,10 +287,12 @@ Emscripten_DestroyWindow(_THIS, SDL_Window * window) data = (SDL_WindowData *) window->driverdata; Emscripten_UnregisterEventHandlers(data); +#if SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); data->egl_surface = EGL_NO_SURFACE; } +#endif SDL_free(window->driverdata); window->driverdata = NULL; } diff --git a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenvideo.h b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenvideo.h index 7618ab6cc..c2001b006 100644 --- a/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenvideo.h +++ b/Engine/lib/sdl/src/video/emscripten/SDL_emscriptenvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,15 +20,17 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_emscriptenvideo_h -#define _SDL_emscriptenvideo_h +#ifndef SDL_emscriptenvideo_h_ +#define SDL_emscriptenvideo_h_ #include "../SDL_sysvideo.h" #include "../../events/SDL_touch_c.h" #include #include +#if SDL_VIDEO_OPENGL_EGL #include +#endif typedef struct SDL_WindowData { @@ -47,8 +49,10 @@ typedef struct SDL_WindowData SDL_bool finger_touching; /* for mapping touch events to mice */ SDL_FingerID first_finger; + + SDL_bool has_pointer_lock; } SDL_WindowData; -#endif /* _SDL_emscriptenvideo_h */ +#endif /* SDL_emscriptenvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_BWin.h b/Engine/lib/sdl/src/video/haiku/SDL_BWin.h index a353e1aca..3e6188860 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_BWin.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_BWin.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_BWin_h -#define _SDL_BWin_h +#ifndef SDL_BWin_h_ +#define SDL_BWin_h_ #ifdef __cplusplus extern "C" { @@ -38,9 +38,9 @@ extern "C" { #include #include #include -#include +#include #if SDL_VIDEO_OPENGL -#include +#include #endif #include "SDL_events.h" #include "../../main/haiku/SDL_BApp.h" @@ -72,6 +72,7 @@ class SDL_BWin:public BDirectWindow #if SDL_VIDEO_OPENGL _SDL_GLView = NULL; + _gl_type = 0; #endif _shown = false; _inhibit_resize = false; @@ -114,6 +115,8 @@ class SDL_BWin:public BDirectWindow } #endif + delete _prev_frame; + /* Clean up framebuffer stuff */ _buffer_locker->Lock(); #ifdef DRAWTHREAD @@ -133,6 +136,7 @@ class SDL_BWin:public BDirectWindow B_FOLLOW_ALL_SIDES, (B_WILL_DRAW | B_FRAME_EVENTS), gl_flags); + _gl_type = gl_flags; } AddChild(_SDL_GLView); _SDL_GLView->EnableDirectMode(true); @@ -250,6 +254,7 @@ class SDL_BWin:public BDirectWindow virtual void WindowActivated(bool active) { BMessage msg(BAPP_KEYBOARD_FOCUS); /* Mouse focus sold separately */ + msg.AddBool("focusGained", active); _PostWindowEvent(msg); } @@ -442,6 +447,7 @@ class SDL_BWin:public BDirectWindow BBitmap *GetBitmap() { return _bitmap; } #if SDL_VIDEO_OPENGL BGLView *GetGLView() { return _SDL_GLView; } + Uint32 GetGLType() { return _gl_type; } #endif /* Setter methods */ @@ -585,7 +591,7 @@ private: if(msg->FindBool("window-border", &bEnabled) != B_OK) { return; } - SetLook(bEnabled ? B_BORDERED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK); + SetLook(bEnabled ? B_TITLED_WINDOW_LOOK : B_NO_BORDER_WINDOW_LOOK); } void _SetResizable(BMessage *msg) { @@ -624,6 +630,7 @@ private: /* Members */ #if SDL_VIDEO_OPENGL BGLView * _SDL_GLView; + Uint32 _gl_type; #endif int32 _last_buttons; @@ -667,4 +674,6 @@ private: * through a draw cycle. Occurs when the previous * buffer provided by DirectConnected() is invalidated. */ -#endif +#endif /* SDL_BWin_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bclipboard.cc b/Engine/lib/sdl/src/video/haiku/SDL_bclipboard.cc index fcd1caa26..e7d01b9be 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bclipboard.cc +++ b/Engine/lib/sdl/src/video/haiku/SDL_bclipboard.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #if SDL_VIDEO_DRIVER_HAIKU -/* BWindow based framebuffer implementation */ +/* BWindow based clipboard implementation */ #include #include @@ -43,7 +43,7 @@ int BE_SetClipboardText(_THIS, const char *text) { /* Presumably the string of characters is ascii-format */ ssize_t asciiLength = 0; for(; text[asciiLength] != 0; ++asciiLength) {} - clip->AddData("text/plain", B_MIME_TYPE, &text, asciiLength); + clip->AddData("text/plain", B_MIME_TYPE, text, asciiLength); be_clipboard->Commit(); } be_clipboard->Unlock(); @@ -61,8 +61,6 @@ char *BE_GetClipboardText(_THIS) { /* Presumably the string of characters is ascii-format */ clip->FindData("text/plain", B_MIME_TYPE, (const void**)&text, &length); - } else { - be_clipboard->Unlock(); } be_clipboard->Unlock(); } @@ -71,8 +69,8 @@ char *BE_GetClipboardText(_THIS) { result = SDL_strdup(""); } else { /* Copy the data and pass on to SDL */ - result = (char*)SDL_calloc(1, sizeof(char*)*length); - SDL_strlcpy(result, text, length); + result = (char *)SDL_malloc((length + 1) * sizeof(char)); + SDL_strlcpy(result, text, length + 1); } return result; @@ -93,3 +91,5 @@ SDL_bool BE_HasClipboardText(_THIS) { #endif #endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bclipboard.h b/Engine/lib/sdl/src/video/haiku/SDL_bclipboard.h index dd31f19a5..2f7a1c243 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bclipboard.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_bclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -29,3 +29,5 @@ extern char *BE_GetClipboardText(_THIS); extern SDL_bool BE_HasClipboardText(_THIS); #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bevents.cc b/Engine/lib/sdl/src/video/haiku/SDL_bevents.cc index 36513a3b2..c716731a4 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bevents.cc +++ b/Engine/lib/sdl/src/video/haiku/SDL_bevents.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,3 +37,5 @@ void BE_PumpEvents(_THIS) { #endif #endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bevents.h b/Engine/lib/sdl/src/video/haiku/SDL_bevents.h index cb756c967..3c090c89e 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bevents.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_bevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,3 +35,5 @@ extern void BE_PumpEvents(_THIS); #endif #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bframebuffer.cc b/Engine/lib/sdl/src/video/haiku/SDL_bframebuffer.cc index 5e6a300e8..f53c50019 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bframebuffer.cc +++ b/Engine/lib/sdl/src/video/haiku/SDL_bframebuffer.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,7 +35,9 @@ extern "C" { #endif -int32 BE_UpdateOnce(SDL_Window *window); +#ifndef DRAWTHREAD +static int32 BE_UpdateOnce(SDL_Window *window); +#endif static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) { return ((SDL_BWin*)(window->driverdata)); @@ -76,7 +78,8 @@ int BE_CreateWindowFramebuffer(_THIS, SDL_Window * window, true); /* Contiguous memory required */ if(bitmap->InitCheck() != B_OK) { - return SDL_SetError("Could not initialize back buffer!\n"); + delete bitmap; + return SDL_SetError("Could not initialize back buffer!"); } @@ -143,7 +146,6 @@ int32 BE_DrawThread(void *data) { /* Blit each clipping rectangle */ bscreen.WaitForRetrace(); for(i = 0; i < numClips; ++i) { - clipping_rect rc = clips[i]; /* Get addresses of the start of each clipping rectangle */ int32 width = clips[i].right - clips[i].left + 1; int32 height = clips[i].bottom - clips[i].top + 1; @@ -199,7 +201,8 @@ void BE_DestroyWindowFramebuffer(_THIS, SDL_Window * window) { * The specific issues have since become rare enough that they may have been * solved, but I doubt it- they were pretty sporadic before now. */ -int32 BE_UpdateOnce(SDL_Window *window) { +#ifndef DRAWTHREAD +static int32 BE_UpdateOnce(SDL_Window *window) { SDL_BWin *bwin = _ToBeWin(window); BScreen bscreen; if(!bscreen.IsValid()) { @@ -224,7 +227,6 @@ int32 BE_UpdateOnce(SDL_Window *window) { /* Blit each clipping rectangle */ bscreen.WaitForRetrace(); for(i = 0; i < numClips; ++i) { - clipping_rect rc = clips[i]; /* Get addresses of the start of each clipping rectangle */ int32 width = clips[i].right - clips[i].left + 1; int32 height = clips[i].bottom - clips[i].top + 1; @@ -246,9 +248,12 @@ int32 BE_UpdateOnce(SDL_Window *window) { } return 0; } +#endif #ifdef __cplusplus } #endif #endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bframebuffer.h b/Engine/lib/sdl/src/video/haiku/SDL_bframebuffer.h index d6be21f4d..ce0fc6284 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bframebuffer.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_bframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -43,3 +43,5 @@ extern int32 BE_DrawThread(void *data); #endif #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bkeyboard.cc b/Engine/lib/sdl/src/video/haiku/SDL_bkeyboard.cc index 0ae3d3fc1..5c72ecf98 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bkeyboard.cc +++ b/Engine/lib/sdl/src/video/haiku/SDL_bkeyboard.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -41,7 +41,7 @@ extern "C" { static SDL_Scancode keymap[KEYMAP_SIZE]; static int8 keystate[KEYMAP_SIZE]; -void BE_InitOSKeymap() { +void BE_InitOSKeymap(void) { for( uint i = 0; i < SDL_TABLESIZE(keymap); ++i ) { keymap[i] = SDL_SCANCODE_UNKNOWN; } @@ -186,3 +186,5 @@ void BE_SetKeyState(int32 bkey, int8 state) { #endif #endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bkeyboard.h b/Engine/lib/sdl/src/video/haiku/SDL_bkeyboard.h index 632799421..9620c9bdd 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bkeyboard.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_bkeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,7 +30,7 @@ extern "C" { #include "../../../include/SDL_keyboard.h" -extern void BE_InitOSKeymap(); +extern void BE_InitOSKeymap(void); extern SDL_Scancode BE_GetScancodeFromBeKey(int32 bkey); extern int8 BE_GetKeyState(int32 bkey); extern void BE_SetKeyState(int32 bkey, int8 state); @@ -40,3 +40,5 @@ extern void BE_SetKeyState(int32 bkey, int8 state); #endif #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bmodes.cc b/Engine/lib/sdl/src/video/haiku/SDL_bmodes.cc index 84aeb1f07..110534280 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bmodes.cc +++ b/Engine/lib/sdl/src/video/haiku/SDL_bmodes.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -43,7 +43,7 @@ extern "C" { #if WRAP_BMODE /* This wrapper is here so that the driverdata can be freed without freeing the display_mode structure */ -typedef struct SDL_DisplayModeData { +struct SDL_DisplayModeData { display_mode *bmode; }; #endif @@ -310,7 +310,7 @@ int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){ } if(bscreen.SetMode(bmode) != B_OK) { - return SDL_SetError("Bad video mode\n"); + return SDL_SetError("Bad video mode"); } free(bmode_list); @@ -329,3 +329,5 @@ int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, SDL_DisplayMode *mode){ #endif #endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bmodes.h b/Engine/lib/sdl/src/video/haiku/SDL_bmodes.h index c3882ba58..38f4b5843 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bmodes.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_bmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -44,3 +44,5 @@ extern int BE_SetDisplayMode(_THIS, SDL_VideoDisplay *display, #endif #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bopengl.cc b/Engine/lib/sdl/src/video/haiku/SDL_bopengl.cc index 15454f100..3456932ce 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bopengl.cc +++ b/Engine/lib/sdl/src/video/haiku/SDL_bopengl.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,7 @@ */ #include "../../SDL_internal.h" -#if SDL_VIDEO_DRIVER_HAIKU +#if SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL #include "SDL_bopengl.h" @@ -35,43 +35,41 @@ extern "C" { #endif -#define BGL_FLAGS BGL_RGB | BGL_DOUBLE - static SDL_INLINE SDL_BWin *_ToBeWin(SDL_Window *window) { - return ((SDL_BWin*)(window->driverdata)); + return ((SDL_BWin*)(window->driverdata)); } static SDL_INLINE SDL_BApp *_GetBeApp() { - return ((SDL_BApp*)be_app); + return ((SDL_BApp*)be_app); } /* Passing a NULL path means load pointers from the application */ int BE_GL_LoadLibrary(_THIS, const char *path) { /* FIXME: Is this working correctly? */ - image_info info; - int32 cookie = 0; - while (get_next_image_info(0, &cookie, &info) == B_OK) { - void *location = NULL; - if( get_image_symbol(info.id, "glBegin", B_SYMBOL_TYPE_ANY, - &location) == B_OK) { + image_info info; + int32 cookie = 0; + while (get_next_image_info(0, &cookie, &info) == B_OK) { + void *location = NULL; + if( get_image_symbol(info.id, "glBegin", B_SYMBOL_TYPE_ANY, + &location) == B_OK) { - _this->gl_config.dll_handle = (void *) info.id; - _this->gl_config.driver_loaded = 1; - SDL_strlcpy(_this->gl_config.driver_path, "libGL.so", - SDL_arraysize(_this->gl_config.driver_path)); - } - } - return 0; + _this->gl_config.dll_handle = (void *) (size_t) info.id; + _this->gl_config.driver_loaded = 1; + SDL_strlcpy(_this->gl_config.driver_path, "libGL.so", + SDL_arraysize(_this->gl_config.driver_path)); + } + } + return 0; } void *BE_GL_GetProcAddress(_THIS, const char *proc) { - if (_this->gl_config.dll_handle != NULL) { - void *location = NULL; - status_t err; - if ((err = - get_image_symbol((image_id) _this->gl_config.dll_handle, + if (_this->gl_config.dll_handle != NULL) { + void *location = NULL; + status_t err; + if ((err = + get_image_symbol((image_id) (size_t) _this->gl_config.dll_handle, proc, B_SYMBOL_TYPE_ANY, &location)) == B_OK) { return location; @@ -79,52 +77,75 @@ void *BE_GL_GetProcAddress(_THIS, const char *proc) SDL_SetError("Couldn't find OpenGL symbol"); return NULL; } - } else { - SDL_SetError("OpenGL library not loaded"); - return NULL; - } + } else { + SDL_SetError("OpenGL library not loaded"); + return NULL; + } } -void BE_GL_SwapWindow(_THIS, SDL_Window * window) { +int BE_GL_SwapWindow(_THIS, SDL_Window * window) { _ToBeWin(window)->SwapBuffers(); + return 0; } int BE_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { - _GetBeApp()->SetCurrentContext(((SDL_BWin*)context)->GetGLView()); - return 0; + SDL_BWin* win = (SDL_BWin*)context; + _GetBeApp()->SetCurrentContext(win ? win->GetGLView() : NULL); + return 0; } SDL_GLContext BE_GL_CreateContext(_THIS, SDL_Window * window) { - /* FIXME: Not sure what flags should be included here; may want to have - most of them */ - SDL_BWin *bwin = _ToBeWin(window); - bwin->CreateGLView(BGL_FLAGS); - return (SDL_GLContext)(bwin); + /* FIXME: Not sure what flags should be included here; may want to have + most of them */ + SDL_BWin *bwin = _ToBeWin(window); + Uint32 gl_flags = BGL_RGB; + if (_this->gl_config.alpha_size) { + gl_flags |= BGL_ALPHA; + } + if (_this->gl_config.depth_size) { + gl_flags |= BGL_DEPTH; + } + if (_this->gl_config.stencil_size) { + gl_flags |= BGL_STENCIL; + } + if (_this->gl_config.double_buffer) { + gl_flags |= BGL_DOUBLE; + } else { + gl_flags |= BGL_SINGLE; + } + if (_this->gl_config.accum_red_size || + _this->gl_config.accum_green_size || + _this->gl_config.accum_blue_size || + _this->gl_config.accum_alpha_size) { + gl_flags |= BGL_ACCUM; + } + bwin->CreateGLView(gl_flags); + return (SDL_GLContext)(bwin); } void BE_GL_DeleteContext(_THIS, SDL_GLContext context) { - /* Currently, automatically unlocks the view */ - ((SDL_BWin*)context)->RemoveGLView(); + /* Currently, automatically unlocks the view */ + ((SDL_BWin*)context)->RemoveGLView(); } int BE_GL_SetSwapInterval(_THIS, int interval) { - /* TODO: Implement this, if necessary? */ - return 0; + /* TODO: Implement this, if necessary? */ + return SDL_Unsupported(); } int BE_GL_GetSwapInterval(_THIS) { - /* TODO: Implement this, if necessary? */ - return 0; + /* TODO: Implement this, if necessary? */ + return 0; } void BE_GL_UnloadLibrary(_THIS) { - /* TODO: Implement this, if necessary? */ + /* TODO: Implement this, if necessary? */ } @@ -132,88 +153,24 @@ void BE_GL_UnloadLibrary(_THIS) { mode changes (see SDL_bmodes.cc), but it doesn't seem to help, and is not currently in use. */ void BE_GL_RebootContexts(_THIS) { - SDL_Window *window = _this->windows; - while(window) { - SDL_BWin *bwin = _ToBeWin(window); - if(bwin->GetGLView()) { - bwin->LockLooper(); - bwin->RemoveGLView(); - bwin->CreateGLView(BGL_FLAGS); - bwin->UnlockLooper(); - } - window = window->next; - } -} - - -#if 0 /* Functions from 1.2 that do not appear to be used in 1.3 */ - - int BE_GL_GetAttribute(_THIS, SDL_GLattr attrib, int *value) - { - /* - FIXME? Right now BE_GL_GetAttribute shouldn't be called between glBegin() and glEnd() - it doesn't use "cached" values - */ - switch (attrib) { - case SDL_GL_RED_SIZE: - glGetIntegerv(GL_RED_BITS, (GLint *) value); - break; - case SDL_GL_GREEN_SIZE: - glGetIntegerv(GL_GREEN_BITS, (GLint *) value); - break; - case SDL_GL_BLUE_SIZE: - glGetIntegerv(GL_BLUE_BITS, (GLint *) value); - break; - case SDL_GL_ALPHA_SIZE: - glGetIntegerv(GL_ALPHA_BITS, (GLint *) value); - break; - case SDL_GL_DOUBLEBUFFER: - glGetBooleanv(GL_DOUBLEBUFFER, (GLboolean *) value); - break; - case SDL_GL_BUFFER_SIZE: - int v; - glGetIntegerv(GL_RED_BITS, (GLint *) & v); - *value = v; - glGetIntegerv(GL_GREEN_BITS, (GLint *) & v); - *value += v; - glGetIntegerv(GL_BLUE_BITS, (GLint *) & v); - *value += v; - glGetIntegerv(GL_ALPHA_BITS, (GLint *) & v); - *value += v; - break; - case SDL_GL_DEPTH_SIZE: - glGetIntegerv(GL_DEPTH_BITS, (GLint *) value); /* Mesa creates 16 only? r5 always 32 */ - break; - case SDL_GL_STENCIL_SIZE: - glGetIntegerv(GL_STENCIL_BITS, (GLint *) value); - break; - case SDL_GL_ACCUM_RED_SIZE: - glGetIntegerv(GL_ACCUM_RED_BITS, (GLint *) value); - break; - case SDL_GL_ACCUM_GREEN_SIZE: - glGetIntegerv(GL_ACCUM_GREEN_BITS, (GLint *) value); - break; - case SDL_GL_ACCUM_BLUE_SIZE: - glGetIntegerv(GL_ACCUM_BLUE_BITS, (GLint *) value); - break; - case SDL_GL_ACCUM_ALPHA_SIZE: - glGetIntegerv(GL_ACCUM_ALPHA_BITS, (GLint *) value); - break; - case SDL_GL_STEREO: - case SDL_GL_MULTISAMPLEBUFFERS: - case SDL_GL_MULTISAMPLESAMPLES: - default: - *value = 0; - return (-1); + SDL_Window *window = _this->windows; + while(window) { + SDL_BWin *bwin = _ToBeWin(window); + if(bwin->GetGLView()) { + bwin->LockLooper(); + bwin->RemoveGLView(); + bwin->CreateGLView(bwin->GetGLType()); + bwin->UnlockLooper(); } - return 0; + window = window->next; } - -#endif - +} #ifdef __cplusplus } #endif -#endif /* SDL_VIDEO_DRIVER_HAIKU */ +#endif /* SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bopengl.h b/Engine/lib/sdl/src/video/haiku/SDL_bopengl.h index e7d475dfb..bc0798c93 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bopengl.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_bopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,6 +22,8 @@ #ifndef SDL_BOPENGL_H #define SDL_BOPENGL_H +#if SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL + #ifdef __cplusplus extern "C" { #endif @@ -36,7 +38,7 @@ extern int BE_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern int BE_GL_SetSwapInterval(_THIS, int interval); /* TODO */ extern int BE_GL_GetSwapInterval(_THIS); /* TODO */ -extern void BE_GL_SwapWindow(_THIS, SDL_Window * window); +extern int BE_GL_SwapWindow(_THIS, SDL_Window * window); extern SDL_GLContext BE_GL_CreateContext(_THIS, SDL_Window * window); extern void BE_GL_DeleteContext(_THIS, SDL_GLContext context); @@ -46,4 +48,8 @@ extern void BE_GL_RebootContexts(_THIS); } #endif +#endif /* SDL_VIDEO_DRIVER_HAIKU && SDL_VIDEO_OPENGL */ + #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bvideo.cc b/Engine/lib/sdl/src/video/haiku/SDL_bvideo.cc index 8986c609c..afe20e3b8 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bvideo.cc +++ b/Engine/lib/sdl/src/video/haiku/SDL_bvideo.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -68,8 +68,8 @@ BE_CreateDevice(int devindex) device->SetDisplayMode = BE_SetDisplayMode; device->PumpEvents = BE_PumpEvents; - device->CreateWindow = BE_CreateWindow; - device->CreateWindowFrom = BE_CreateWindowFrom; + device->CreateSDLWindow = BE_CreateWindow; + device->CreateSDLWindowFrom = BE_CreateWindowFrom; device->SetWindowTitle = BE_SetWindowTitle; device->SetWindowIcon = BE_SetWindowIcon; device->SetWindowPosition = BE_SetWindowPosition; @@ -96,7 +96,7 @@ BE_CreateDevice(int devindex) device->shape_driver.SetWindowShape = NULL; device->shape_driver.ResizeWindowShape = NULL; - +#if SDL_VIDEO_OPENGL device->GL_LoadLibrary = BE_GL_LoadLibrary; device->GL_GetProcAddress = BE_GL_GetProcAddress; device->GL_UnloadLibrary = BE_GL_UnloadLibrary; @@ -106,6 +106,7 @@ BE_CreateDevice(int devindex) device->GL_GetSwapInterval = BE_GL_GetSwapInterval; device->GL_SwapWindow = BE_GL_SwapWindow; device->GL_DeleteContext = BE_GL_DeleteContext; +#endif device->StartTextInput = BE_StartTextInput; device->StopTextInput = BE_StopTextInput; @@ -173,3 +174,5 @@ void BE_VideoQuit(_THIS) #endif #endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bvideo.h b/Engine/lib/sdl/src/video/haiku/SDL_bvideo.h index ef5c74032..0e28220d9 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bvideo.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_bvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,3 +40,5 @@ extern int BE_Available(void); #endif #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bwindow.cc b/Engine/lib/sdl/src/video/haiku/SDL_bwindow.cc index a35471df5..0931abe9a 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bwindow.cc +++ b/Engine/lib/sdl/src/video/haiku/SDL_bwindow.cc @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -41,7 +41,7 @@ static SDL_INLINE SDL_BApp *_GetBeApp() { static int _InitWindow(_THIS, SDL_Window *window) { uint32 flags = 0; - window_look look = B_BORDERED_WINDOW_LOOK; + window_look look = B_TITLED_WINDOW_LOOK; BRect bounds( window->x, @@ -66,7 +66,7 @@ static int _InitWindow(_THIS, SDL_Window *window) { SDL_BWin *bwin = new(std::nothrow) SDL_BWin(bounds, look, flags); if(bwin == NULL) - return ENOMEM; + return -1; window->driverdata = bwin; int32 winID = _GetBeApp()->GetID(window); @@ -76,8 +76,9 @@ static int _InitWindow(_THIS, SDL_Window *window) { } int BE_CreateWindow(_THIS, SDL_Window *window) { - if(_InitWindow(_this, window) == ENOMEM) - return ENOMEM; + if (_InitWindow(_this, window) < 0) { + return -1; + } /* Start window loop */ _ToBeWin(window)->Show(); @@ -102,8 +103,9 @@ int BE_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) { } /* If we are out of memory, return the error code */ - if(_InitWindow(_this, window) == ENOMEM) - return ENOMEM; + if (_InitWindow(_this, window) < 0) { + return -1; + } /* TODO: Add any other SDL-supported window attributes here */ _ToBeWin(window)->SetTitle(otherBWin->Title()); @@ -227,3 +229,5 @@ SDL_bool BE_GetWindowWMInfo(_THIS, SDL_Window * window, #endif #endif /* SDL_VIDEO_DRIVER_HAIKU */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/haiku/SDL_bwindow.h b/Engine/lib/sdl/src/video/haiku/SDL_bwindow.h index 388443dac..100ffed1a 100644 --- a/Engine/lib/sdl/src/video/haiku/SDL_bwindow.h +++ b/Engine/lib/sdl/src/video/haiku/SDL_bwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -52,3 +52,4 @@ extern SDL_bool BE_GetWindowWMInfo(_THIS, SDL_Window * window, #endif +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/khronos/EGL/egl.h b/Engine/lib/sdl/src/video/khronos/EGL/egl.h new file mode 100644 index 000000000..93a21873c --- /dev/null +++ b/Engine/lib/sdl/src/video/khronos/EGL/egl.h @@ -0,0 +1,303 @@ +#ifndef __egl_h_ +#define __egl_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2017 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** http://www.khronos.org/registry/egl +** +** Khronos $Git commit SHA1: a732b061e7 $ on $Git commit date: 2017-06-17 23:27:53 +0100 $ +*/ + +#include + +/* Generated on date 20170627 */ + +/* Generated C header for: + * API: egl + * Versions considered: .* + * Versions emitted: .* + * Default extensions included: None + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef EGL_VERSION_1_0 +#define EGL_VERSION_1_0 1 +typedef unsigned int EGLBoolean; +typedef void *EGLDisplay; +#include +#include +typedef void *EGLConfig; +typedef void *EGLSurface; +typedef void *EGLContext; +typedef void (*__eglMustCastToProperFunctionPointerType)(void); +#define EGL_ALPHA_SIZE 0x3021 +#define EGL_BAD_ACCESS 0x3002 +#define EGL_BAD_ALLOC 0x3003 +#define EGL_BAD_ATTRIBUTE 0x3004 +#define EGL_BAD_CONFIG 0x3005 +#define EGL_BAD_CONTEXT 0x3006 +#define EGL_BAD_CURRENT_SURFACE 0x3007 +#define EGL_BAD_DISPLAY 0x3008 +#define EGL_BAD_MATCH 0x3009 +#define EGL_BAD_NATIVE_PIXMAP 0x300A +#define EGL_BAD_NATIVE_WINDOW 0x300B +#define EGL_BAD_PARAMETER 0x300C +#define EGL_BAD_SURFACE 0x300D +#define EGL_BLUE_SIZE 0x3022 +#define EGL_BUFFER_SIZE 0x3020 +#define EGL_CONFIG_CAVEAT 0x3027 +#define EGL_CONFIG_ID 0x3028 +#define EGL_CORE_NATIVE_ENGINE 0x305B +#define EGL_DEPTH_SIZE 0x3025 +#define EGL_DONT_CARE EGL_CAST(EGLint,-1) +#define EGL_DRAW 0x3059 +#define EGL_EXTENSIONS 0x3055 +#define EGL_FALSE 0 +#define EGL_GREEN_SIZE 0x3023 +#define EGL_HEIGHT 0x3056 +#define EGL_LARGEST_PBUFFER 0x3058 +#define EGL_LEVEL 0x3029 +#define EGL_MAX_PBUFFER_HEIGHT 0x302A +#define EGL_MAX_PBUFFER_PIXELS 0x302B +#define EGL_MAX_PBUFFER_WIDTH 0x302C +#define EGL_NATIVE_RENDERABLE 0x302D +#define EGL_NATIVE_VISUAL_ID 0x302E +#define EGL_NATIVE_VISUAL_TYPE 0x302F +#define EGL_NONE 0x3038 +#define EGL_NON_CONFORMANT_CONFIG 0x3051 +#define EGL_NOT_INITIALIZED 0x3001 +#define EGL_NO_CONTEXT EGL_CAST(EGLContext,0) +#define EGL_NO_DISPLAY EGL_CAST(EGLDisplay,0) +#define EGL_NO_SURFACE EGL_CAST(EGLSurface,0) +#define EGL_PBUFFER_BIT 0x0001 +#define EGL_PIXMAP_BIT 0x0002 +#define EGL_READ 0x305A +#define EGL_RED_SIZE 0x3024 +#define EGL_SAMPLES 0x3031 +#define EGL_SAMPLE_BUFFERS 0x3032 +#define EGL_SLOW_CONFIG 0x3050 +#define EGL_STENCIL_SIZE 0x3026 +#define EGL_SUCCESS 0x3000 +#define EGL_SURFACE_TYPE 0x3033 +#define EGL_TRANSPARENT_BLUE_VALUE 0x3035 +#define EGL_TRANSPARENT_GREEN_VALUE 0x3036 +#define EGL_TRANSPARENT_RED_VALUE 0x3037 +#define EGL_TRANSPARENT_RGB 0x3052 +#define EGL_TRANSPARENT_TYPE 0x3034 +#define EGL_TRUE 1 +#define EGL_VENDOR 0x3053 +#define EGL_VERSION 0x3054 +#define EGL_WIDTH 0x3057 +#define EGL_WINDOW_BIT 0x0004 +EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); +EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); +EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface); +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); +EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); +EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void); +EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw); +EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id); +EGLAPI EGLint EGLAPIENTRY eglGetError (void); +EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname); +EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor); +EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); +EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name); +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface); +EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine); +#endif /* EGL_VERSION_1_0 */ + +#ifndef EGL_VERSION_1_1 +#define EGL_VERSION_1_1 1 +#define EGL_BACK_BUFFER 0x3084 +#define EGL_BIND_TO_TEXTURE_RGB 0x3039 +#define EGL_BIND_TO_TEXTURE_RGBA 0x303A +#define EGL_CONTEXT_LOST 0x300E +#define EGL_MIN_SWAP_INTERVAL 0x303B +#define EGL_MAX_SWAP_INTERVAL 0x303C +#define EGL_MIPMAP_TEXTURE 0x3082 +#define EGL_MIPMAP_LEVEL 0x3083 +#define EGL_NO_TEXTURE 0x305C +#define EGL_TEXTURE_2D 0x305F +#define EGL_TEXTURE_FORMAT 0x3080 +#define EGL_TEXTURE_RGB 0x305D +#define EGL_TEXTURE_RGBA 0x305E +#define EGL_TEXTURE_TARGET 0x3081 +EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer); +EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); +EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval); +#endif /* EGL_VERSION_1_1 */ + +#ifndef EGL_VERSION_1_2 +#define EGL_VERSION_1_2 1 +typedef unsigned int EGLenum; +typedef void *EGLClientBuffer; +#define EGL_ALPHA_FORMAT 0x3088 +#define EGL_ALPHA_FORMAT_NONPRE 0x308B +#define EGL_ALPHA_FORMAT_PRE 0x308C +#define EGL_ALPHA_MASK_SIZE 0x303E +#define EGL_BUFFER_PRESERVED 0x3094 +#define EGL_BUFFER_DESTROYED 0x3095 +#define EGL_CLIENT_APIS 0x308D +#define EGL_COLORSPACE 0x3087 +#define EGL_COLORSPACE_sRGB 0x3089 +#define EGL_COLORSPACE_LINEAR 0x308A +#define EGL_COLOR_BUFFER_TYPE 0x303F +#define EGL_CONTEXT_CLIENT_TYPE 0x3097 +#define EGL_DISPLAY_SCALING 10000 +#define EGL_HORIZONTAL_RESOLUTION 0x3090 +#define EGL_LUMINANCE_BUFFER 0x308F +#define EGL_LUMINANCE_SIZE 0x303D +#define EGL_OPENGL_ES_BIT 0x0001 +#define EGL_OPENVG_BIT 0x0002 +#define EGL_OPENGL_ES_API 0x30A0 +#define EGL_OPENVG_API 0x30A1 +#define EGL_OPENVG_IMAGE 0x3096 +#define EGL_PIXEL_ASPECT_RATIO 0x3092 +#define EGL_RENDERABLE_TYPE 0x3040 +#define EGL_RENDER_BUFFER 0x3086 +#define EGL_RGB_BUFFER 0x308E +#define EGL_SINGLE_BUFFER 0x3085 +#define EGL_SWAP_BEHAVIOR 0x3093 +#define EGL_UNKNOWN EGL_CAST(EGLint,-1) +#define EGL_VERTICAL_RESOLUTION 0x3091 +EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api); +EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void); +#endif /* EGL_VERSION_1_2 */ + +#ifndef EGL_VERSION_1_3 +#define EGL_VERSION_1_3 1 +#define EGL_CONFORMANT 0x3042 +#define EGL_CONTEXT_CLIENT_VERSION 0x3098 +#define EGL_MATCH_NATIVE_PIXMAP 0x3041 +#define EGL_OPENGL_ES2_BIT 0x0004 +#define EGL_VG_ALPHA_FORMAT 0x3088 +#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B +#define EGL_VG_ALPHA_FORMAT_PRE 0x308C +#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040 +#define EGL_VG_COLORSPACE 0x3087 +#define EGL_VG_COLORSPACE_sRGB 0x3089 +#define EGL_VG_COLORSPACE_LINEAR 0x308A +#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020 +#endif /* EGL_VERSION_1_3 */ + +#ifndef EGL_VERSION_1_4 +#define EGL_VERSION_1_4 1 +#define EGL_DEFAULT_DISPLAY EGL_CAST(EGLNativeDisplayType,0) +#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200 +#define EGL_MULTISAMPLE_RESOLVE 0x3099 +#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A +#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B +#define EGL_OPENGL_API 0x30A2 +#define EGL_OPENGL_BIT 0x0008 +#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400 +EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void); +#endif /* EGL_VERSION_1_4 */ + +#ifndef EGL_VERSION_1_5 +#define EGL_VERSION_1_5 1 +typedef void *EGLSync; +typedef intptr_t EGLAttrib; +typedef khronos_utime_nanoseconds_t EGLTime; +typedef void *EGLImage; +#define EGL_CONTEXT_MAJOR_VERSION 0x3098 +#define EGL_CONTEXT_MINOR_VERSION 0x30FB +#define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD +#define EGL_NO_RESET_NOTIFICATION 0x31BE +#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF +#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001 +#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002 +#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0 +#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1 +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2 +#define EGL_OPENGL_ES3_BIT 0x00000040 +#define EGL_CL_EVENT_HANDLE 0x309C +#define EGL_SYNC_CL_EVENT 0x30FE +#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0 +#define EGL_SYNC_TYPE 0x30F7 +#define EGL_SYNC_STATUS 0x30F1 +#define EGL_SYNC_CONDITION 0x30F8 +#define EGL_SIGNALED 0x30F2 +#define EGL_UNSIGNALED 0x30F3 +#define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001 +#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull +#define EGL_TIMEOUT_EXPIRED 0x30F5 +#define EGL_CONDITION_SATISFIED 0x30F6 +#define EGL_NO_SYNC EGL_CAST(EGLSync,0) +#define EGL_SYNC_FENCE 0x30F9 +#define EGL_GL_COLORSPACE 0x309D +#define EGL_GL_COLORSPACE_SRGB 0x3089 +#define EGL_GL_COLORSPACE_LINEAR 0x308A +#define EGL_GL_RENDERBUFFER 0x30B9 +#define EGL_GL_TEXTURE_2D 0x30B1 +#define EGL_GL_TEXTURE_LEVEL 0x30BC +#define EGL_GL_TEXTURE_3D 0x30B2 +#define EGL_GL_TEXTURE_ZOFFSET 0x30BD +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8 +#define EGL_IMAGE_PRESERVED 0x30D2 +#define EGL_NO_IMAGE EGL_CAST(EGLImage,0) +EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync); +EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout); +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value); +EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image); +EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags); +#endif /* EGL_VERSION_1_5 */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Engine/lib/sdl/src/video/khronos/EGL/eglext.h b/Engine/lib/sdl/src/video/khronos/EGL/eglext.h new file mode 100644 index 000000000..d2def032d --- /dev/null +++ b/Engine/lib/sdl/src/video/khronos/EGL/eglext.h @@ -0,0 +1,1241 @@ +#ifndef __eglext_h_ +#define __eglext_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2017 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** http://www.khronos.org/registry/egl +** +** Khronos $Git commit SHA1: a732b061e7 $ on $Git commit date: 2017-06-17 23:27:53 +0100 $ +*/ + +#include + +#define EGL_EGLEXT_VERSION 20170627 + +/* Generated C header for: + * API: egl + * Versions considered: .* + * Versions emitted: _nomatch_^ + * Default extensions included: egl + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef EGL_KHR_cl_event +#define EGL_KHR_cl_event 1 +#define EGL_CL_EVENT_HANDLE_KHR 0x309C +#define EGL_SYNC_CL_EVENT_KHR 0x30FE +#define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF +#endif /* EGL_KHR_cl_event */ + +#ifndef EGL_KHR_cl_event2 +#define EGL_KHR_cl_event2 1 +typedef void *EGLSyncKHR; +typedef intptr_t EGLAttribKHR; +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list); +#endif +#endif /* EGL_KHR_cl_event2 */ + +#ifndef EGL_KHR_client_get_all_proc_addresses +#define EGL_KHR_client_get_all_proc_addresses 1 +#endif /* EGL_KHR_client_get_all_proc_addresses */ + +#ifndef EGL_KHR_config_attribs +#define EGL_KHR_config_attribs 1 +#define EGL_CONFORMANT_KHR 0x3042 +#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 +#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 +#endif /* EGL_KHR_config_attribs */ + +#ifndef EGL_KHR_context_flush_control +#define EGL_KHR_context_flush_control 1 +#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0 +#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097 +#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098 +#endif /* EGL_KHR_context_flush_control */ + +#ifndef EGL_KHR_create_context +#define EGL_KHR_create_context 1 +#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098 +#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB +#define EGL_CONTEXT_FLAGS_KHR 0x30FC +#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD +#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE +#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF +#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 +#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 +#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 +#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 +#define EGL_OPENGL_ES3_BIT_KHR 0x00000040 +#endif /* EGL_KHR_create_context */ + +#ifndef EGL_KHR_create_context_no_error +#define EGL_KHR_create_context_no_error 1 +#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3 +#endif /* EGL_KHR_create_context_no_error */ + +#ifndef EGL_KHR_debug +#define EGL_KHR_debug 1 +typedef void *EGLLabelKHR; +typedef void *EGLObjectKHR; +typedef void (EGLAPIENTRY *EGLDEBUGPROCKHR)(EGLenum error,const char *command,EGLint messageType,EGLLabelKHR threadLabel,EGLLabelKHR objectLabel,const char* message); +#define EGL_OBJECT_THREAD_KHR 0x33B0 +#define EGL_OBJECT_DISPLAY_KHR 0x33B1 +#define EGL_OBJECT_CONTEXT_KHR 0x33B2 +#define EGL_OBJECT_SURFACE_KHR 0x33B3 +#define EGL_OBJECT_IMAGE_KHR 0x33B4 +#define EGL_OBJECT_SYNC_KHR 0x33B5 +#define EGL_OBJECT_STREAM_KHR 0x33B6 +#define EGL_DEBUG_MSG_CRITICAL_KHR 0x33B9 +#define EGL_DEBUG_MSG_ERROR_KHR 0x33BA +#define EGL_DEBUG_MSG_WARN_KHR 0x33BB +#define EGL_DEBUG_MSG_INFO_KHR 0x33BC +#define EGL_DEBUG_CALLBACK_KHR 0x33B8 +typedef EGLint (EGLAPIENTRYP PFNEGLDEBUGMESSAGECONTROLKHRPROC) (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEBUGKHRPROC) (EGLint attribute, EGLAttrib *value); +typedef EGLint (EGLAPIENTRYP PFNEGLLABELOBJECTKHRPROC) (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLint EGLAPIENTRY eglDebugMessageControlKHR (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDebugKHR (EGLint attribute, EGLAttrib *value); +EGLAPI EGLint EGLAPIENTRY eglLabelObjectKHR (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label); +#endif +#endif /* EGL_KHR_debug */ + +#ifndef EGL_KHR_display_reference +#define EGL_KHR_display_reference 1 +#define EGL_TRACK_REFERENCES_KHR 0x3352 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBKHRPROC) (EGLDisplay dpy, EGLint name, EGLAttrib *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribKHR (EGLDisplay dpy, EGLint name, EGLAttrib *value); +#endif +#endif /* EGL_KHR_display_reference */ + +#ifndef EGL_KHR_fence_sync +#define EGL_KHR_fence_sync 1 +typedef khronos_utime_nanoseconds_t EGLTimeKHR; +#ifdef KHRONOS_SUPPORT_INT64 +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0 +#define EGL_SYNC_CONDITION_KHR 0x30F8 +#define EGL_SYNC_FENCE_KHR 0x30F9 +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync); +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync); +EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout); +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_KHR_fence_sync */ + +#ifndef EGL_KHR_get_all_proc_addresses +#define EGL_KHR_get_all_proc_addresses 1 +#endif /* EGL_KHR_get_all_proc_addresses */ + +#ifndef EGL_KHR_gl_colorspace +#define EGL_KHR_gl_colorspace 1 +#define EGL_GL_COLORSPACE_KHR 0x309D +#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089 +#define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A +#endif /* EGL_KHR_gl_colorspace */ + +#ifndef EGL_KHR_gl_renderbuffer_image +#define EGL_KHR_gl_renderbuffer_image 1 +#define EGL_GL_RENDERBUFFER_KHR 0x30B9 +#endif /* EGL_KHR_gl_renderbuffer_image */ + +#ifndef EGL_KHR_gl_texture_2D_image +#define EGL_KHR_gl_texture_2D_image 1 +#define EGL_GL_TEXTURE_2D_KHR 0x30B1 +#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC +#endif /* EGL_KHR_gl_texture_2D_image */ + +#ifndef EGL_KHR_gl_texture_3D_image +#define EGL_KHR_gl_texture_3D_image 1 +#define EGL_GL_TEXTURE_3D_KHR 0x30B2 +#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD +#endif /* EGL_KHR_gl_texture_3D_image */ + +#ifndef EGL_KHR_gl_texture_cubemap_image +#define EGL_KHR_gl_texture_cubemap_image 1 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 +#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 +#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 +#endif /* EGL_KHR_gl_texture_cubemap_image */ + +#ifndef EGL_KHR_image +#define EGL_KHR_image 1 +typedef void *EGLImageKHR; +#define EGL_NATIVE_PIXMAP_KHR 0x30B0 +#define EGL_NO_IMAGE_KHR EGL_CAST(EGLImageKHR,0) +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image); +#endif +#endif /* EGL_KHR_image */ + +#ifndef EGL_KHR_image_base +#define EGL_KHR_image_base 1 +#define EGL_IMAGE_PRESERVED_KHR 0x30D2 +#endif /* EGL_KHR_image_base */ + +#ifndef EGL_KHR_image_pixmap +#define EGL_KHR_image_pixmap 1 +#endif /* EGL_KHR_image_pixmap */ + +#ifndef EGL_KHR_lock_surface +#define EGL_KHR_lock_surface 1 +#define EGL_READ_SURFACE_BIT_KHR 0x0001 +#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 +#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 +#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 +#define EGL_MATCH_FORMAT_KHR 0x3043 +#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 +#define EGL_FORMAT_RGB_565_KHR 0x30C1 +#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 +#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 +#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 +#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 +#define EGL_BITMAP_POINTER_KHR 0x30C6 +#define EGL_BITMAP_PITCH_KHR 0x30C7 +#define EGL_BITMAP_ORIGIN_KHR 0x30C8 +#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 +#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA +#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB +#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC +#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD +#define EGL_LOWER_LEFT_KHR 0x30CE +#define EGL_UPPER_LEFT_KHR 0x30CF +typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface); +#endif +#endif /* EGL_KHR_lock_surface */ + +#ifndef EGL_KHR_lock_surface2 +#define EGL_KHR_lock_surface2 1 +#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110 +#endif /* EGL_KHR_lock_surface2 */ + +#ifndef EGL_KHR_lock_surface3 +#define EGL_KHR_lock_surface3 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value); +#endif +#endif /* EGL_KHR_lock_surface3 */ + +#ifndef EGL_KHR_mutable_render_buffer +#define EGL_KHR_mutable_render_buffer 1 +#define EGL_MUTABLE_RENDER_BUFFER_BIT_KHR 0x1000 +#endif /* EGL_KHR_mutable_render_buffer */ + +#ifndef EGL_KHR_no_config_context +#define EGL_KHR_no_config_context 1 +#define EGL_NO_CONFIG_KHR EGL_CAST(EGLConfig,0) +#endif /* EGL_KHR_no_config_context */ + +#ifndef EGL_KHR_partial_update +#define EGL_KHR_partial_update 1 +#define EGL_BUFFER_AGE_KHR 0x313D +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#endif +#endif /* EGL_KHR_partial_update */ + +#ifndef EGL_KHR_platform_android +#define EGL_KHR_platform_android 1 +#define EGL_PLATFORM_ANDROID_KHR 0x3141 +#endif /* EGL_KHR_platform_android */ + +#ifndef EGL_KHR_platform_gbm +#define EGL_KHR_platform_gbm 1 +#define EGL_PLATFORM_GBM_KHR 0x31D7 +#endif /* EGL_KHR_platform_gbm */ + +#ifndef EGL_KHR_platform_wayland +#define EGL_KHR_platform_wayland 1 +#define EGL_PLATFORM_WAYLAND_KHR 0x31D8 +#endif /* EGL_KHR_platform_wayland */ + +#ifndef EGL_KHR_platform_x11 +#define EGL_KHR_platform_x11 1 +#define EGL_PLATFORM_X11_KHR 0x31D5 +#define EGL_PLATFORM_X11_SCREEN_KHR 0x31D6 +#endif /* EGL_KHR_platform_x11 */ + +#ifndef EGL_KHR_reusable_sync +#define EGL_KHR_reusable_sync 1 +#ifdef KHRONOS_SUPPORT_INT64 +#define EGL_SYNC_STATUS_KHR 0x30F1 +#define EGL_SIGNALED_KHR 0x30F2 +#define EGL_UNSIGNALED_KHR 0x30F3 +#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5 +#define EGL_CONDITION_SATISFIED_KHR 0x30F6 +#define EGL_SYNC_TYPE_KHR 0x30F7 +#define EGL_SYNC_REUSABLE_KHR 0x30FA +#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 +#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull +#define EGL_NO_SYNC_KHR EGL_CAST(EGLSyncKHR,0) +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_KHR_reusable_sync */ + +#ifndef EGL_KHR_stream +#define EGL_KHR_stream 1 +typedef void *EGLStreamKHR; +typedef khronos_uint64_t EGLuint64KHR; +#ifdef KHRONOS_SUPPORT_INT64 +#define EGL_NO_STREAM_KHR EGL_CAST(EGLStreamKHR,0) +#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210 +#define EGL_PRODUCER_FRAME_KHR 0x3212 +#define EGL_CONSUMER_FRAME_KHR 0x3213 +#define EGL_STREAM_STATE_KHR 0x3214 +#define EGL_STREAM_STATE_CREATED_KHR 0x3215 +#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216 +#define EGL_STREAM_STATE_EMPTY_KHR 0x3217 +#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218 +#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219 +#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A +#define EGL_BAD_STREAM_KHR 0x321B +#define EGL_BAD_STATE_KHR 0x321C +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_KHR_stream */ + +#ifndef EGL_KHR_stream_attrib +#define EGL_KHR_stream_attrib 1 +#ifdef KHRONOS_SUPPORT_INT64 +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBKHRPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamAttribKHR (EGLDisplay dpy, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_KHR_stream_attrib */ + +#ifndef EGL_KHR_stream_consumer_gltexture +#define EGL_KHR_stream_consumer_gltexture 1 +#ifdef EGL_KHR_stream +#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream); +#endif +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_consumer_gltexture */ + +#ifndef EGL_KHR_stream_cross_process_fd +#define EGL_KHR_stream_cross_process_fd 1 +typedef int EGLNativeFileDescriptorKHR; +#ifdef EGL_KHR_stream +#define EGL_NO_FILE_DESCRIPTOR_KHR EGL_CAST(EGLNativeFileDescriptorKHR,-1) +typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream); +typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream); +EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); +#endif +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_cross_process_fd */ + +#ifndef EGL_KHR_stream_fifo +#define EGL_KHR_stream_fifo 1 +#ifdef EGL_KHR_stream +#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC +#define EGL_STREAM_TIME_NOW_KHR 0x31FD +#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE +#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); +#endif +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_fifo */ + +#ifndef EGL_KHR_stream_producer_aldatalocator +#define EGL_KHR_stream_producer_aldatalocator 1 +#ifdef EGL_KHR_stream +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_producer_aldatalocator */ + +#ifndef EGL_KHR_stream_producer_eglsurface +#define EGL_KHR_stream_producer_eglsurface 1 +#ifdef EGL_KHR_stream +#define EGL_STREAM_BIT_KHR 0x0800 +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); +#endif +#endif /* EGL_KHR_stream */ +#endif /* EGL_KHR_stream_producer_eglsurface */ + +#ifndef EGL_KHR_surfaceless_context +#define EGL_KHR_surfaceless_context 1 +#endif /* EGL_KHR_surfaceless_context */ + +#ifndef EGL_KHR_swap_buffers_with_damage +#define EGL_KHR_swap_buffers_with_damage 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#endif +#endif /* EGL_KHR_swap_buffers_with_damage */ + +#ifndef EGL_KHR_vg_parent_image +#define EGL_KHR_vg_parent_image 1 +#define EGL_VG_PARENT_IMAGE_KHR 0x30BA +#endif /* EGL_KHR_vg_parent_image */ + +#ifndef EGL_KHR_wait_sync +#define EGL_KHR_wait_sync 1 +typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); +#endif +#endif /* EGL_KHR_wait_sync */ + +#ifndef EGL_ANDROID_blob_cache +#define EGL_ANDROID_blob_cache 1 +typedef khronos_ssize_t EGLsizeiANDROID; +typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize); +typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize); +typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); +#endif +#endif /* EGL_ANDROID_blob_cache */ + +#ifndef EGL_ANDROID_create_native_client_buffer +#define EGL_ANDROID_create_native_client_buffer 1 +#define EGL_NATIVE_BUFFER_USAGE_ANDROID 0x3143 +#define EGL_NATIVE_BUFFER_USAGE_PROTECTED_BIT_ANDROID 0x00000001 +#define EGL_NATIVE_BUFFER_USAGE_RENDERBUFFER_BIT_ANDROID 0x00000002 +#define EGL_NATIVE_BUFFER_USAGE_TEXTURE_BIT_ANDROID 0x00000004 +typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC) (const EGLint *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLClientBuffer EGLAPIENTRY eglCreateNativeClientBufferANDROID (const EGLint *attrib_list); +#endif +#endif /* EGL_ANDROID_create_native_client_buffer */ + +#ifndef EGL_ANDROID_framebuffer_target +#define EGL_ANDROID_framebuffer_target 1 +#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147 +#endif /* EGL_ANDROID_framebuffer_target */ + +#ifndef EGL_ANDROID_front_buffer_auto_refresh +#define EGL_ANDROID_front_buffer_auto_refresh 1 +#define EGL_FRONT_BUFFER_AUTO_REFRESH_ANDROID 0x314C +#endif /* EGL_ANDROID_front_buffer_auto_refresh */ + +#ifndef EGL_ANDROID_image_native_buffer +#define EGL_ANDROID_image_native_buffer 1 +#define EGL_NATIVE_BUFFER_ANDROID 0x3140 +#endif /* EGL_ANDROID_image_native_buffer */ + +#ifndef EGL_ANDROID_native_fence_sync +#define EGL_ANDROID_native_fence_sync 1 +#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144 +#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145 +#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146 +#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1 +typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync); +#endif +#endif /* EGL_ANDROID_native_fence_sync */ + +#ifndef EGL_ANDROID_presentation_time +#define EGL_ANDROID_presentation_time 1 +typedef khronos_stime_nanoseconds_t EGLnsecsANDROID; +typedef EGLBoolean (EGLAPIENTRYP PFNEGLPRESENTATIONTIMEANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglPresentationTimeANDROID (EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time); +#endif +#endif /* EGL_ANDROID_presentation_time */ + +#ifndef EGL_ANDROID_recordable +#define EGL_ANDROID_recordable 1 +#define EGL_RECORDABLE_ANDROID 0x3142 +#endif /* EGL_ANDROID_recordable */ + +#ifndef EGL_ANGLE_d3d_share_handle_client_buffer +#define EGL_ANGLE_d3d_share_handle_client_buffer 1 +#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200 +#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */ + +#ifndef EGL_ANGLE_device_d3d +#define EGL_ANGLE_device_d3d 1 +#define EGL_D3D9_DEVICE_ANGLE 0x33A0 +#define EGL_D3D11_DEVICE_ANGLE 0x33A1 +#endif /* EGL_ANGLE_device_d3d */ + +#ifndef EGL_ANGLE_query_surface_pointer +#define EGL_ANGLE_query_surface_pointer 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); +#endif +#endif /* EGL_ANGLE_query_surface_pointer */ + +#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle +#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1 +#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */ + +#ifndef EGL_ANGLE_window_fixed_size +#define EGL_ANGLE_window_fixed_size 1 +#define EGL_FIXED_SIZE_ANGLE 0x3201 +#endif /* EGL_ANGLE_window_fixed_size */ + +#ifndef EGL_ARM_implicit_external_sync +#define EGL_ARM_implicit_external_sync 1 +#define EGL_SYNC_PRIOR_COMMANDS_IMPLICIT_EXTERNAL_ARM 0x328A +#endif /* EGL_ARM_implicit_external_sync */ + +#ifndef EGL_ARM_pixmap_multisample_discard +#define EGL_ARM_pixmap_multisample_discard 1 +#define EGL_DISCARD_SAMPLES_ARM 0x3286 +#endif /* EGL_ARM_pixmap_multisample_discard */ + +#ifndef EGL_EXT_bind_to_front +#define EGL_EXT_bind_to_front 1 +#define EGL_FRONT_BUFFER_EXT 0x3464 +#endif /* EGL_EXT_bind_to_front */ + +#ifndef EGL_EXT_buffer_age +#define EGL_EXT_buffer_age 1 +#define EGL_BUFFER_AGE_EXT 0x313D +#endif /* EGL_EXT_buffer_age */ + +#ifndef EGL_EXT_client_extensions +#define EGL_EXT_client_extensions 1 +#endif /* EGL_EXT_client_extensions */ + +#ifndef EGL_EXT_compositor +#define EGL_EXT_compositor 1 +#define EGL_PRIMARY_COMPOSITOR_CONTEXT_EXT 0x3460 +#define EGL_EXTERNAL_REF_ID_EXT 0x3461 +#define EGL_COMPOSITOR_DROP_NEWEST_FRAME_EXT 0x3462 +#define EGL_COMPOSITOR_KEEP_NEWEST_FRAME_EXT 0x3463 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETCONTEXTLISTEXTPROC) (const EGLint *external_ref_ids, EGLint num_entries); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETCONTEXTATTRIBUTESEXTPROC) (EGLint external_ref_id, const EGLint *context_attributes, EGLint num_entries); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETWINDOWLISTEXTPROC) (EGLint external_ref_id, const EGLint *external_win_ids, EGLint num_entries); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETWINDOWATTRIBUTESEXTPROC) (EGLint external_win_id, const EGLint *window_attributes, EGLint num_entries); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORBINDTEXWINDOWEXTPROC) (EGLint external_win_id); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETSIZEEXTPROC) (EGLint external_win_id, EGLint width, EGLint height); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSWAPPOLICYEXTPROC) (EGLint external_win_id, EGLint policy); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetContextListEXT (const EGLint *external_ref_ids, EGLint num_entries); +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetContextAttributesEXT (EGLint external_ref_id, const EGLint *context_attributes, EGLint num_entries); +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetWindowListEXT (EGLint external_ref_id, const EGLint *external_win_ids, EGLint num_entries); +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetWindowAttributesEXT (EGLint external_win_id, const EGLint *window_attributes, EGLint num_entries); +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorBindTexWindowEXT (EGLint external_win_id); +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetSizeEXT (EGLint external_win_id, EGLint width, EGLint height); +EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSwapPolicyEXT (EGLint external_win_id, EGLint policy); +#endif +#endif /* EGL_EXT_compositor */ + +#ifndef EGL_EXT_create_context_robustness +#define EGL_EXT_create_context_robustness 1 +#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF +#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138 +#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE +#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF +#endif /* EGL_EXT_create_context_robustness */ + +#ifndef EGL_EXT_device_base +#define EGL_EXT_device_base 1 +typedef void *EGLDeviceEXT; +#define EGL_NO_DEVICE_EXT EGL_CAST(EGLDeviceEXT,0) +#define EGL_BAD_DEVICE_EXT 0x322B +#define EGL_DEVICE_EXT 0x322C +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value); +typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value); +EGLAPI const char *EGLAPIENTRY eglQueryDeviceStringEXT (EGLDeviceEXT device, EGLint name); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDevicesEXT (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); +#endif +#endif /* EGL_EXT_device_base */ + +#ifndef EGL_EXT_device_drm +#define EGL_EXT_device_drm 1 +#define EGL_DRM_DEVICE_FILE_EXT 0x3233 +#endif /* EGL_EXT_device_drm */ + +#ifndef EGL_EXT_device_enumeration +#define EGL_EXT_device_enumeration 1 +#endif /* EGL_EXT_device_enumeration */ + +#ifndef EGL_EXT_device_openwf +#define EGL_EXT_device_openwf 1 +#define EGL_OPENWF_DEVICE_ID_EXT 0x3237 +#endif /* EGL_EXT_device_openwf */ + +#ifndef EGL_EXT_device_query +#define EGL_EXT_device_query 1 +#endif /* EGL_EXT_device_query */ + +#ifndef EGL_EXT_gl_colorspace_bt2020_linear +#define EGL_EXT_gl_colorspace_bt2020_linear 1 +#define EGL_GL_COLORSPACE_BT2020_LINEAR_EXT 0x333F +#endif /* EGL_EXT_gl_colorspace_bt2020_linear */ + +#ifndef EGL_EXT_gl_colorspace_bt2020_pq +#define EGL_EXT_gl_colorspace_bt2020_pq 1 +#define EGL_GL_COLORSPACE_BT2020_PQ_EXT 0x3340 +#endif /* EGL_EXT_gl_colorspace_bt2020_pq */ + +#ifndef EGL_EXT_gl_colorspace_display_p3 +#define EGL_EXT_gl_colorspace_display_p3 1 +#define EGL_GL_COLORSPACE_DISPLAY_P3_EXT 0x3363 +#endif /* EGL_EXT_gl_colorspace_display_p3 */ + +#ifndef EGL_EXT_gl_colorspace_display_p3_linear +#define EGL_EXT_gl_colorspace_display_p3_linear 1 +#define EGL_GL_COLORSPACE_DISPLAY_P3_LINEAR_EXT 0x3362 +#endif /* EGL_EXT_gl_colorspace_display_p3_linear */ + +#ifndef EGL_EXT_gl_colorspace_scrgb +#define EGL_EXT_gl_colorspace_scrgb 1 +#define EGL_GL_COLORSPACE_SCRGB_EXT 0x3351 +#endif /* EGL_EXT_gl_colorspace_scrgb */ + +#ifndef EGL_EXT_gl_colorspace_scrgb_linear +#define EGL_EXT_gl_colorspace_scrgb_linear 1 +#define EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT 0x3350 +#endif /* EGL_EXT_gl_colorspace_scrgb_linear */ + +#ifndef EGL_EXT_image_dma_buf_import +#define EGL_EXT_image_dma_buf_import 1 +#define EGL_LINUX_DMA_BUF_EXT 0x3270 +#define EGL_LINUX_DRM_FOURCC_EXT 0x3271 +#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272 +#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273 +#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274 +#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275 +#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276 +#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277 +#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278 +#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279 +#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A +#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B +#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C +#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D +#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E +#define EGL_ITU_REC601_EXT 0x327F +#define EGL_ITU_REC709_EXT 0x3280 +#define EGL_ITU_REC2020_EXT 0x3281 +#define EGL_YUV_FULL_RANGE_EXT 0x3282 +#define EGL_YUV_NARROW_RANGE_EXT 0x3283 +#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284 +#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285 +#endif /* EGL_EXT_image_dma_buf_import */ + +#ifndef EGL_EXT_image_dma_buf_import_modifiers +#define EGL_EXT_image_dma_buf_import_modifiers 1 +#define EGL_DMA_BUF_PLANE3_FD_EXT 0x3440 +#define EGL_DMA_BUF_PLANE3_OFFSET_EXT 0x3441 +#define EGL_DMA_BUF_PLANE3_PITCH_EXT 0x3442 +#define EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT 0x3443 +#define EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT 0x3444 +#define EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT 0x3445 +#define EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT 0x3446 +#define EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT 0x3447 +#define EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT 0x3448 +#define EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT 0x3449 +#define EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT 0x344A +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFFORMATSEXTPROC) (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFMODIFIERSEXTPROC) (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDmaBufFormatsEXT (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDmaBufModifiersEXT (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers); +#endif +#endif /* EGL_EXT_image_dma_buf_import_modifiers */ + +#ifndef EGL_EXT_image_implicit_sync_control +#define EGL_EXT_image_implicit_sync_control 1 +#define EGL_IMPORT_SYNC_TYPE_EXT 0x3470 +#define EGL_IMPORT_IMPLICIT_SYNC_EXT 0x3471 +#define EGL_IMPORT_EXPLICIT_SYNC_EXT 0x3472 +#endif /* EGL_EXT_image_implicit_sync_control */ + +#ifndef EGL_EXT_multiview_window +#define EGL_EXT_multiview_window 1 +#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134 +#endif /* EGL_EXT_multiview_window */ + +#ifndef EGL_EXT_output_base +#define EGL_EXT_output_base 1 +typedef void *EGLOutputLayerEXT; +typedef void *EGLOutputPortEXT; +#define EGL_NO_OUTPUT_LAYER_EXT EGL_CAST(EGLOutputLayerEXT,0) +#define EGL_NO_OUTPUT_PORT_EXT EGL_CAST(EGLOutputPortEXT,0) +#define EGL_BAD_OUTPUT_LAYER_EXT 0x322D +#define EGL_BAD_OUTPUT_PORT_EXT 0x322E +#define EGL_SWAP_INTERVAL_EXT 0x322F +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value); +typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value); +typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputLayersEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers); +EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputPortsEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports); +EGLAPI EGLBoolean EGLAPIENTRY eglOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value); +EGLAPI const char *EGLAPIENTRY eglQueryOutputLayerStringEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name); +EGLAPI EGLBoolean EGLAPIENTRY eglOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value); +EGLAPI const char *EGLAPIENTRY eglQueryOutputPortStringEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name); +#endif +#endif /* EGL_EXT_output_base */ + +#ifndef EGL_EXT_output_drm +#define EGL_EXT_output_drm 1 +#define EGL_DRM_CRTC_EXT 0x3234 +#define EGL_DRM_PLANE_EXT 0x3235 +#define EGL_DRM_CONNECTOR_EXT 0x3236 +#endif /* EGL_EXT_output_drm */ + +#ifndef EGL_EXT_output_openwf +#define EGL_EXT_output_openwf 1 +#define EGL_OPENWF_PIPELINE_ID_EXT 0x3238 +#define EGL_OPENWF_PORT_ID_EXT 0x3239 +#endif /* EGL_EXT_output_openwf */ + +#ifndef EGL_EXT_pixel_format_float +#define EGL_EXT_pixel_format_float 1 +#define EGL_COLOR_COMPONENT_TYPE_EXT 0x3339 +#define EGL_COLOR_COMPONENT_TYPE_FIXED_EXT 0x333A +#define EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT 0x333B +#endif /* EGL_EXT_pixel_format_float */ + +#ifndef EGL_EXT_platform_base +#define EGL_EXT_platform_base 1 +typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list); +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list); +EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list); +#endif +#endif /* EGL_EXT_platform_base */ + +#ifndef EGL_EXT_platform_device +#define EGL_EXT_platform_device 1 +#define EGL_PLATFORM_DEVICE_EXT 0x313F +#endif /* EGL_EXT_platform_device */ + +#ifndef EGL_EXT_platform_wayland +#define EGL_EXT_platform_wayland 1 +#define EGL_PLATFORM_WAYLAND_EXT 0x31D8 +#endif /* EGL_EXT_platform_wayland */ + +#ifndef EGL_EXT_platform_x11 +#define EGL_EXT_platform_x11 1 +#define EGL_PLATFORM_X11_EXT 0x31D5 +#define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6 +#endif /* EGL_EXT_platform_x11 */ + +#ifndef EGL_EXT_protected_content +#define EGL_EXT_protected_content 1 +#define EGL_PROTECTED_CONTENT_EXT 0x32C0 +#endif /* EGL_EXT_protected_content */ + +#ifndef EGL_EXT_protected_surface +#define EGL_EXT_protected_surface 1 +#endif /* EGL_EXT_protected_surface */ + +#ifndef EGL_EXT_stream_consumer_egloutput +#define EGL_EXT_stream_consumer_egloutput 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer); +#endif +#endif /* EGL_EXT_stream_consumer_egloutput */ + +#ifndef EGL_EXT_surface_CTA861_3_metadata +#define EGL_EXT_surface_CTA861_3_metadata 1 +#define EGL_CTA861_3_MAX_CONTENT_LIGHT_LEVEL_EXT 0x3360 +#define EGL_CTA861_3_MAX_FRAME_AVERAGE_LEVEL_EXT 0x3361 +#endif /* EGL_EXT_surface_CTA861_3_metadata */ + +#ifndef EGL_EXT_surface_SMPTE2086_metadata +#define EGL_EXT_surface_SMPTE2086_metadata 1 +#define EGL_SMPTE2086_DISPLAY_PRIMARY_RX_EXT 0x3341 +#define EGL_SMPTE2086_DISPLAY_PRIMARY_RY_EXT 0x3342 +#define EGL_SMPTE2086_DISPLAY_PRIMARY_GX_EXT 0x3343 +#define EGL_SMPTE2086_DISPLAY_PRIMARY_GY_EXT 0x3344 +#define EGL_SMPTE2086_DISPLAY_PRIMARY_BX_EXT 0x3345 +#define EGL_SMPTE2086_DISPLAY_PRIMARY_BY_EXT 0x3346 +#define EGL_SMPTE2086_WHITE_POINT_X_EXT 0x3347 +#define EGL_SMPTE2086_WHITE_POINT_Y_EXT 0x3348 +#define EGL_SMPTE2086_MAX_LUMINANCE_EXT 0x3349 +#define EGL_SMPTE2086_MIN_LUMINANCE_EXT 0x334A +#define EGL_METADATA_SCALING_EXT 50000 +#endif /* EGL_EXT_surface_SMPTE2086_metadata */ + +#ifndef EGL_EXT_swap_buffers_with_damage +#define EGL_EXT_swap_buffers_with_damage 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); +#endif +#endif /* EGL_EXT_swap_buffers_with_damage */ + +#ifndef EGL_EXT_yuv_surface +#define EGL_EXT_yuv_surface 1 +#define EGL_YUV_ORDER_EXT 0x3301 +#define EGL_YUV_NUMBER_OF_PLANES_EXT 0x3311 +#define EGL_YUV_SUBSAMPLE_EXT 0x3312 +#define EGL_YUV_DEPTH_RANGE_EXT 0x3317 +#define EGL_YUV_CSC_STANDARD_EXT 0x330A +#define EGL_YUV_PLANE_BPP_EXT 0x331A +#define EGL_YUV_BUFFER_EXT 0x3300 +#define EGL_YUV_ORDER_YUV_EXT 0x3302 +#define EGL_YUV_ORDER_YVU_EXT 0x3303 +#define EGL_YUV_ORDER_YUYV_EXT 0x3304 +#define EGL_YUV_ORDER_UYVY_EXT 0x3305 +#define EGL_YUV_ORDER_YVYU_EXT 0x3306 +#define EGL_YUV_ORDER_VYUY_EXT 0x3307 +#define EGL_YUV_ORDER_AYUV_EXT 0x3308 +#define EGL_YUV_SUBSAMPLE_4_2_0_EXT 0x3313 +#define EGL_YUV_SUBSAMPLE_4_2_2_EXT 0x3314 +#define EGL_YUV_SUBSAMPLE_4_4_4_EXT 0x3315 +#define EGL_YUV_DEPTH_RANGE_LIMITED_EXT 0x3318 +#define EGL_YUV_DEPTH_RANGE_FULL_EXT 0x3319 +#define EGL_YUV_CSC_STANDARD_601_EXT 0x330B +#define EGL_YUV_CSC_STANDARD_709_EXT 0x330C +#define EGL_YUV_CSC_STANDARD_2020_EXT 0x330D +#define EGL_YUV_PLANE_BPP_0_EXT 0x331B +#define EGL_YUV_PLANE_BPP_8_EXT 0x331C +#define EGL_YUV_PLANE_BPP_10_EXT 0x331D +#endif /* EGL_EXT_yuv_surface */ + +#ifndef EGL_HI_clientpixmap +#define EGL_HI_clientpixmap 1 +struct EGLClientPixmapHI { + void *pData; + EGLint iWidth; + EGLint iHeight; + EGLint iStride; +}; +#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74 +typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap); +#endif +#endif /* EGL_HI_clientpixmap */ + +#ifndef EGL_HI_colorformats +#define EGL_HI_colorformats 1 +#define EGL_COLOR_FORMAT_HI 0x8F70 +#define EGL_COLOR_RGB_HI 0x8F71 +#define EGL_COLOR_RGBA_HI 0x8F72 +#define EGL_COLOR_ARGB_HI 0x8F73 +#endif /* EGL_HI_colorformats */ + +#ifndef EGL_IMG_context_priority +#define EGL_IMG_context_priority 1 +#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100 +#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101 +#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102 +#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103 +#endif /* EGL_IMG_context_priority */ + +#ifndef EGL_IMG_image_plane_attribs +#define EGL_IMG_image_plane_attribs 1 +#define EGL_NATIVE_BUFFER_MULTIPLANE_SEPARATE_IMG 0x3105 +#define EGL_NATIVE_BUFFER_PLANE_OFFSET_IMG 0x3106 +#endif /* EGL_IMG_image_plane_attribs */ + +#ifndef EGL_MESA_drm_image +#define EGL_MESA_drm_image 1 +#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 +#define EGL_DRM_BUFFER_USE_MESA 0x31D1 +#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 +#define EGL_DRM_BUFFER_MESA 0x31D3 +#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4 +#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 +#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 +typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); +#endif +#endif /* EGL_MESA_drm_image */ + +#ifndef EGL_MESA_image_dma_buf_export +#define EGL_MESA_image_dma_buf_export 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageQueryMESA (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers); +EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageMESA (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets); +#endif +#endif /* EGL_MESA_image_dma_buf_export */ + +#ifndef EGL_MESA_platform_gbm +#define EGL_MESA_platform_gbm 1 +#define EGL_PLATFORM_GBM_MESA 0x31D7 +#endif /* EGL_MESA_platform_gbm */ + +#ifndef EGL_MESA_platform_surfaceless +#define EGL_MESA_platform_surfaceless 1 +#define EGL_PLATFORM_SURFACELESS_MESA 0x31DD +#endif /* EGL_MESA_platform_surfaceless */ + +#ifndef EGL_NOK_swap_region +#define EGL_NOK_swap_region 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); +#endif +#endif /* EGL_NOK_swap_region */ + +#ifndef EGL_NOK_swap_region2 +#define EGL_NOK_swap_region2 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects); +#endif +#endif /* EGL_NOK_swap_region2 */ + +#ifndef EGL_NOK_texture_from_pixmap +#define EGL_NOK_texture_from_pixmap 1 +#define EGL_Y_INVERTED_NOK 0x307F +#endif /* EGL_NOK_texture_from_pixmap */ + +#ifndef EGL_NV_3dvision_surface +#define EGL_NV_3dvision_surface 1 +#define EGL_AUTO_STEREO_NV 0x3136 +#endif /* EGL_NV_3dvision_surface */ + +#ifndef EGL_NV_coverage_sample +#define EGL_NV_coverage_sample 1 +#define EGL_COVERAGE_BUFFERS_NV 0x30E0 +#define EGL_COVERAGE_SAMPLES_NV 0x30E1 +#endif /* EGL_NV_coverage_sample */ + +#ifndef EGL_NV_coverage_sample_resolve +#define EGL_NV_coverage_sample_resolve 1 +#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131 +#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132 +#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133 +#endif /* EGL_NV_coverage_sample_resolve */ + +#ifndef EGL_NV_cuda_event +#define EGL_NV_cuda_event 1 +#define EGL_CUDA_EVENT_HANDLE_NV 0x323B +#define EGL_SYNC_CUDA_EVENT_NV 0x323C +#define EGL_SYNC_CUDA_EVENT_COMPLETE_NV 0x323D +#endif /* EGL_NV_cuda_event */ + +#ifndef EGL_NV_depth_nonlinear +#define EGL_NV_depth_nonlinear 1 +#define EGL_DEPTH_ENCODING_NV 0x30E2 +#define EGL_DEPTH_ENCODING_NONE_NV 0 +#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3 +#endif /* EGL_NV_depth_nonlinear */ + +#ifndef EGL_NV_device_cuda +#define EGL_NV_device_cuda 1 +#define EGL_CUDA_DEVICE_NV 0x323A +#endif /* EGL_NV_device_cuda */ + +#ifndef EGL_NV_native_query +#define EGL_NV_native_query 1 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap); +#endif +#endif /* EGL_NV_native_query */ + +#ifndef EGL_NV_post_convert_rounding +#define EGL_NV_post_convert_rounding 1 +#endif /* EGL_NV_post_convert_rounding */ + +#ifndef EGL_NV_post_sub_buffer +#define EGL_NV_post_sub_buffer 1 +#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE +typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); +#endif +#endif /* EGL_NV_post_sub_buffer */ + +#ifndef EGL_NV_robustness_video_memory_purge +#define EGL_NV_robustness_video_memory_purge 1 +#define EGL_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x334C +#endif /* EGL_NV_robustness_video_memory_purge */ + +#ifndef EGL_NV_stream_consumer_gltexture_yuv +#define EGL_NV_stream_consumer_gltexture_yuv 1 +#define EGL_YUV_PLANE0_TEXTURE_UNIT_NV 0x332C +#define EGL_YUV_PLANE1_TEXTURE_UNIT_NV 0x332D +#define EGL_YUV_PLANE2_TEXTURE_UNIT_NV 0x332E +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLAttrib *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalAttribsNV (EGLDisplay dpy, EGLStreamKHR stream, EGLAttrib *attrib_list); +#endif +#endif /* EGL_NV_stream_consumer_gltexture_yuv */ + +#ifndef EGL_NV_stream_cross_display +#define EGL_NV_stream_cross_display 1 +#define EGL_STREAM_CROSS_DISPLAY_NV 0x334E +#endif /* EGL_NV_stream_cross_display */ + +#ifndef EGL_NV_stream_cross_object +#define EGL_NV_stream_cross_object 1 +#define EGL_STREAM_CROSS_OBJECT_NV 0x334D +#endif /* EGL_NV_stream_cross_object */ + +#ifndef EGL_NV_stream_cross_partition +#define EGL_NV_stream_cross_partition 1 +#define EGL_STREAM_CROSS_PARTITION_NV 0x323F +#endif /* EGL_NV_stream_cross_partition */ + +#ifndef EGL_NV_stream_cross_process +#define EGL_NV_stream_cross_process 1 +#define EGL_STREAM_CROSS_PROCESS_NV 0x3245 +#endif /* EGL_NV_stream_cross_process */ + +#ifndef EGL_NV_stream_cross_system +#define EGL_NV_stream_cross_system 1 +#define EGL_STREAM_CROSS_SYSTEM_NV 0x334F +#endif /* EGL_NV_stream_cross_system */ + +#ifndef EGL_NV_stream_fifo_next +#define EGL_NV_stream_fifo_next 1 +#define EGL_PENDING_FRAME_NV 0x3329 +#define EGL_STREAM_TIME_PENDING_NV 0x332A +#endif /* EGL_NV_stream_fifo_next */ + +#ifndef EGL_NV_stream_fifo_synchronous +#define EGL_NV_stream_fifo_synchronous 1 +#define EGL_STREAM_FIFO_SYNCHRONOUS_NV 0x3336 +#endif /* EGL_NV_stream_fifo_synchronous */ + +#ifndef EGL_NV_stream_frame_limits +#define EGL_NV_stream_frame_limits 1 +#define EGL_PRODUCER_MAX_FRAME_HINT_NV 0x3337 +#define EGL_CONSUMER_MAX_FRAME_HINT_NV 0x3338 +#endif /* EGL_NV_stream_frame_limits */ + +#ifndef EGL_NV_stream_metadata +#define EGL_NV_stream_metadata 1 +#define EGL_MAX_STREAM_METADATA_BLOCKS_NV 0x3250 +#define EGL_MAX_STREAM_METADATA_BLOCK_SIZE_NV 0x3251 +#define EGL_MAX_STREAM_METADATA_TOTAL_SIZE_NV 0x3252 +#define EGL_PRODUCER_METADATA_NV 0x3253 +#define EGL_CONSUMER_METADATA_NV 0x3254 +#define EGL_PENDING_METADATA_NV 0x3328 +#define EGL_METADATA0_SIZE_NV 0x3255 +#define EGL_METADATA1_SIZE_NV 0x3256 +#define EGL_METADATA2_SIZE_NV 0x3257 +#define EGL_METADATA3_SIZE_NV 0x3258 +#define EGL_METADATA0_TYPE_NV 0x3259 +#define EGL_METADATA1_TYPE_NV 0x325A +#define EGL_METADATA2_TYPE_NV 0x325B +#define EGL_METADATA3_TYPE_NV 0x325C +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBNVPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLint n, EGLint offset, EGLint size, const void *data); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum name, EGLint n, EGLint offset, EGLint size, void *data); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribNV (EGLDisplay dpy, EGLint attribute, EGLAttrib *value); +EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamMetadataNV (EGLDisplay dpy, EGLStreamKHR stream, EGLint n, EGLint offset, EGLint size, const void *data); +EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamMetadataNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum name, EGLint n, EGLint offset, EGLint size, void *data); +#endif +#endif /* EGL_NV_stream_metadata */ + +#ifndef EGL_NV_stream_remote +#define EGL_NV_stream_remote 1 +#define EGL_STREAM_STATE_INITIALIZING_NV 0x3240 +#define EGL_STREAM_TYPE_NV 0x3241 +#define EGL_STREAM_PROTOCOL_NV 0x3242 +#define EGL_STREAM_ENDPOINT_NV 0x3243 +#define EGL_STREAM_LOCAL_NV 0x3244 +#define EGL_STREAM_PRODUCER_NV 0x3247 +#define EGL_STREAM_CONSUMER_NV 0x3248 +#define EGL_STREAM_PROTOCOL_FD_NV 0x3246 +#endif /* EGL_NV_stream_remote */ + +#ifndef EGL_NV_stream_reset +#define EGL_NV_stream_reset 1 +#define EGL_SUPPORT_RESET_NV 0x3334 +#define EGL_SUPPORT_REUSE_NV 0x3335 +typedef EGLBoolean (EGLAPIENTRYP PFNEGLRESETSTREAMNVPROC) (EGLDisplay dpy, EGLStreamKHR stream); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLBoolean EGLAPIENTRY eglResetStreamNV (EGLDisplay dpy, EGLStreamKHR stream); +#endif +#endif /* EGL_NV_stream_reset */ + +#ifndef EGL_NV_stream_socket +#define EGL_NV_stream_socket 1 +#define EGL_STREAM_PROTOCOL_SOCKET_NV 0x324B +#define EGL_SOCKET_HANDLE_NV 0x324C +#define EGL_SOCKET_TYPE_NV 0x324D +#endif /* EGL_NV_stream_socket */ + +#ifndef EGL_NV_stream_socket_inet +#define EGL_NV_stream_socket_inet 1 +#define EGL_SOCKET_TYPE_INET_NV 0x324F +#endif /* EGL_NV_stream_socket_inet */ + +#ifndef EGL_NV_stream_socket_unix +#define EGL_NV_stream_socket_unix 1 +#define EGL_SOCKET_TYPE_UNIX_NV 0x324E +#endif /* EGL_NV_stream_socket_unix */ + +#ifndef EGL_NV_stream_sync +#define EGL_NV_stream_sync 1 +#define EGL_SYNC_NEW_FRAME_NV 0x321F +typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list); +#endif +#endif /* EGL_NV_stream_sync */ + +#ifndef EGL_NV_sync +#define EGL_NV_sync 1 +typedef void *EGLSyncNV; +typedef khronos_utime_nanoseconds_t EGLTimeNV; +#ifdef KHRONOS_SUPPORT_INT64 +#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6 +#define EGL_SYNC_STATUS_NV 0x30E7 +#define EGL_SIGNALED_NV 0x30E8 +#define EGL_UNSIGNALED_NV 0x30E9 +#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001 +#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull +#define EGL_ALREADY_SIGNALED_NV 0x30EA +#define EGL_TIMEOUT_EXPIRED_NV 0x30EB +#define EGL_CONDITION_SATISFIED_NV 0x30EC +#define EGL_SYNC_TYPE_NV 0x30ED +#define EGL_SYNC_CONDITION_NV 0x30EE +#define EGL_SYNC_FENCE_NV 0x30EF +#define EGL_NO_SYNC_NV EGL_CAST(EGLSyncNV,0) +typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync); +typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode); +typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); +EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync); +EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync); +EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); +EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode); +EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_NV_sync */ + +#ifndef EGL_NV_system_time +#define EGL_NV_system_time 1 +typedef khronos_utime_nanoseconds_t EGLuint64NV; +#ifdef KHRONOS_SUPPORT_INT64 +typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void); +typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void); +#ifdef EGL_EGLEXT_PROTOTYPES +EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void); +EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void); +#endif +#endif /* KHRONOS_SUPPORT_INT64 */ +#endif /* EGL_NV_system_time */ + +#ifndef EGL_TIZEN_image_native_buffer +#define EGL_TIZEN_image_native_buffer 1 +#define EGL_NATIVE_BUFFER_TIZEN 0x32A0 +#endif /* EGL_TIZEN_image_native_buffer */ + +#ifndef EGL_TIZEN_image_native_surface +#define EGL_TIZEN_image_native_surface 1 +#define EGL_NATIVE_SURFACE_TIZEN 0x32A1 +#endif /* EGL_TIZEN_image_native_surface */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Engine/lib/sdl/src/video/khronos/EGL/eglplatform.h b/Engine/lib/sdl/src/video/khronos/EGL/eglplatform.h new file mode 100644 index 000000000..c77c3338d --- /dev/null +++ b/Engine/lib/sdl/src/video/khronos/EGL/eglplatform.h @@ -0,0 +1,132 @@ +#ifndef __eglplatform_h_ +#define __eglplatform_h_ + +/* +** Copyright (c) 2007-2016 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Platform-specific types and definitions for egl.h + * $Revision: 30994 $ on $Date: 2015-04-30 13:36:48 -0700 (Thu, 30 Apr 2015) $ + * + * Adopters may modify khrplatform.h and this file to suit their platform. + * You are encouraged to submit all modifications to the Khronos group so that + * they can be included in future versions of this file. Please submit changes + * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) + * by filing a bug against product "EGL" component "Registry". + */ + +#include + +/* Macros used in EGL function prototype declarations. + * + * EGL functions should be prototyped as: + * + * EGLAPI return-type EGLAPIENTRY eglFunction(arguments); + * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments); + * + * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h + */ + +#ifndef EGLAPI +#define EGLAPI KHRONOS_APICALL +#endif + +#ifndef EGLAPIENTRY +#define EGLAPIENTRY KHRONOS_APIENTRY +#endif +#define EGLAPIENTRYP EGLAPIENTRY* + +/* The types NativeDisplayType, NativeWindowType, and NativePixmapType + * are aliases of window-system-dependent types, such as X Display * or + * Windows Device Context. They must be defined in platform-specific + * code below. The EGL-prefixed versions of Native*Type are the same + * types, renamed in EGL 1.3 so all types in the API start with "EGL". + * + * Khronos STRONGLY RECOMMENDS that you use the default definitions + * provided below, since these changes affect both binary and source + * portability of applications using EGL running on different EGL + * implementations. + */ + +#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN 1 +#endif +#include + +typedef HDC EGLNativeDisplayType; +typedef HBITMAP EGLNativePixmapType; +typedef HWND EGLNativeWindowType; + +#elif defined(__APPLE__) || defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */ + +typedef int EGLNativeDisplayType; +typedef void *EGLNativeWindowType; +typedef void *EGLNativePixmapType; + +#elif defined(__ANDROID__) || defined(ANDROID) + +struct ANativeWindow; +struct egl_native_pixmap_t; + +typedef struct ANativeWindow* EGLNativeWindowType; +typedef struct egl_native_pixmap_t* EGLNativePixmapType; +typedef void* EGLNativeDisplayType; + +#elif defined(__unix__) + +/* X11 (tentative) */ +#include +#include + +typedef Display *EGLNativeDisplayType; +typedef Pixmap EGLNativePixmapType; +typedef Window EGLNativeWindowType; + +#else +#error "Platform not recognized" +#endif + +/* EGL 1.2 types, renamed for consistency in EGL 1.3 */ +typedef EGLNativeDisplayType NativeDisplayType; +typedef EGLNativePixmapType NativePixmapType; +typedef EGLNativeWindowType NativeWindowType; + + +/* Define EGLint. This must be a signed integral type large enough to contain + * all legal attribute names and values passed into and out of EGL, whether + * their type is boolean, bitmask, enumerant (symbolic constant), integer, + * handle, or other. While in general a 32-bit integer will suffice, if + * handles are 64 bit types, then EGLint should be defined as a signed 64-bit + * integer type. + */ +typedef khronos_int32_t EGLint; + + +/* C++ / C typecast macros for special EGL handle values */ +#if defined(__cplusplus) +#define EGL_CAST(type, value) (static_cast(value)) +#else +#define EGL_CAST(type, value) ((type) (value)) +#endif + +#endif /* __eglplatform_h */ diff --git a/Engine/lib/sdl/src/video/khronos/GLES2/gl2.h b/Engine/lib/sdl/src/video/khronos/GLES2/gl2.h new file mode 100644 index 000000000..8ba164229 --- /dev/null +++ b/Engine/lib/sdl/src/video/khronos/GLES2/gl2.h @@ -0,0 +1,675 @@ +#ifndef __gl2_h_ +#define __gl2_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2017 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** https://github.com/KhronosGroup/OpenGL-Registry +*/ + +#include + +#ifndef GL_APIENTRYP +#define GL_APIENTRYP GL_APIENTRY* +#endif + +#ifndef GL_GLES_PROTOTYPES +#define GL_GLES_PROTOTYPES 1 +#endif + +/* Generated on date 20170817 */ + +/* Generated C header for: + * API: gles2 + * Profile: common + * Versions considered: 2\.[0-9] + * Versions emitted: .* + * Default extensions included: None + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef GL_ES_VERSION_2_0 +#define GL_ES_VERSION_2_0 1 +#include +typedef khronos_int8_t GLbyte; +typedef khronos_float_t GLclampf; +typedef khronos_int32_t GLfixed; +typedef short GLshort; +typedef unsigned short GLushort; +typedef void GLvoid; +typedef struct __GLsync *GLsync; +typedef khronos_int64_t GLint64; +typedef khronos_uint64_t GLuint64; +typedef unsigned int GLenum; +typedef unsigned int GLuint; +typedef char GLchar; +typedef khronos_float_t GLfloat; +typedef khronos_ssize_t GLsizeiptr; +typedef khronos_intptr_t GLintptr; +typedef unsigned int GLbitfield; +typedef int GLint; +typedef unsigned char GLboolean; +typedef int GLsizei; +typedef khronos_uint8_t GLubyte; +#define GL_DEPTH_BUFFER_BIT 0x00000100 +#define GL_STENCIL_BUFFER_BIT 0x00000400 +#define GL_COLOR_BUFFER_BIT 0x00004000 +#define GL_FALSE 0 +#define GL_TRUE 1 +#define GL_POINTS 0x0000 +#define GL_LINES 0x0001 +#define GL_LINE_LOOP 0x0002 +#define GL_LINE_STRIP 0x0003 +#define GL_TRIANGLES 0x0004 +#define GL_TRIANGLE_STRIP 0x0005 +#define GL_TRIANGLE_FAN 0x0006 +#define GL_ZERO 0 +#define GL_ONE 1 +#define GL_SRC_COLOR 0x0300 +#define GL_ONE_MINUS_SRC_COLOR 0x0301 +#define GL_SRC_ALPHA 0x0302 +#define GL_ONE_MINUS_SRC_ALPHA 0x0303 +#define GL_DST_ALPHA 0x0304 +#define GL_ONE_MINUS_DST_ALPHA 0x0305 +#define GL_DST_COLOR 0x0306 +#define GL_ONE_MINUS_DST_COLOR 0x0307 +#define GL_SRC_ALPHA_SATURATE 0x0308 +#define GL_FUNC_ADD 0x8006 +#define GL_BLEND_EQUATION 0x8009 +#define GL_BLEND_EQUATION_RGB 0x8009 +#define GL_BLEND_EQUATION_ALPHA 0x883D +#define GL_FUNC_SUBTRACT 0x800A +#define GL_FUNC_REVERSE_SUBTRACT 0x800B +#define GL_BLEND_DST_RGB 0x80C8 +#define GL_BLEND_SRC_RGB 0x80C9 +#define GL_BLEND_DST_ALPHA 0x80CA +#define GL_BLEND_SRC_ALPHA 0x80CB +#define GL_CONSTANT_COLOR 0x8001 +#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 +#define GL_CONSTANT_ALPHA 0x8003 +#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 +#define GL_BLEND_COLOR 0x8005 +#define GL_ARRAY_BUFFER 0x8892 +#define GL_ELEMENT_ARRAY_BUFFER 0x8893 +#define GL_ARRAY_BUFFER_BINDING 0x8894 +#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 +#define GL_STREAM_DRAW 0x88E0 +#define GL_STATIC_DRAW 0x88E4 +#define GL_DYNAMIC_DRAW 0x88E8 +#define GL_BUFFER_SIZE 0x8764 +#define GL_BUFFER_USAGE 0x8765 +#define GL_CURRENT_VERTEX_ATTRIB 0x8626 +#define GL_FRONT 0x0404 +#define GL_BACK 0x0405 +#define GL_FRONT_AND_BACK 0x0408 +#define GL_TEXTURE_2D 0x0DE1 +#define GL_CULL_FACE 0x0B44 +#define GL_BLEND 0x0BE2 +#define GL_DITHER 0x0BD0 +#define GL_STENCIL_TEST 0x0B90 +#define GL_DEPTH_TEST 0x0B71 +#define GL_SCISSOR_TEST 0x0C11 +#define GL_POLYGON_OFFSET_FILL 0x8037 +#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E +#define GL_SAMPLE_COVERAGE 0x80A0 +#define GL_NO_ERROR 0 +#define GL_INVALID_ENUM 0x0500 +#define GL_INVALID_VALUE 0x0501 +#define GL_INVALID_OPERATION 0x0502 +#define GL_OUT_OF_MEMORY 0x0505 +#define GL_CW 0x0900 +#define GL_CCW 0x0901 +#define GL_LINE_WIDTH 0x0B21 +#define GL_ALIASED_POINT_SIZE_RANGE 0x846D +#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E +#define GL_CULL_FACE_MODE 0x0B45 +#define GL_FRONT_FACE 0x0B46 +#define GL_DEPTH_RANGE 0x0B70 +#define GL_DEPTH_WRITEMASK 0x0B72 +#define GL_DEPTH_CLEAR_VALUE 0x0B73 +#define GL_DEPTH_FUNC 0x0B74 +#define GL_STENCIL_CLEAR_VALUE 0x0B91 +#define GL_STENCIL_FUNC 0x0B92 +#define GL_STENCIL_FAIL 0x0B94 +#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 +#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 +#define GL_STENCIL_REF 0x0B97 +#define GL_STENCIL_VALUE_MASK 0x0B93 +#define GL_STENCIL_WRITEMASK 0x0B98 +#define GL_STENCIL_BACK_FUNC 0x8800 +#define GL_STENCIL_BACK_FAIL 0x8801 +#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 +#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 +#define GL_STENCIL_BACK_REF 0x8CA3 +#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 +#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 +#define GL_VIEWPORT 0x0BA2 +#define GL_SCISSOR_BOX 0x0C10 +#define GL_COLOR_CLEAR_VALUE 0x0C22 +#define GL_COLOR_WRITEMASK 0x0C23 +#define GL_UNPACK_ALIGNMENT 0x0CF5 +#define GL_PACK_ALIGNMENT 0x0D05 +#define GL_MAX_TEXTURE_SIZE 0x0D33 +#define GL_MAX_VIEWPORT_DIMS 0x0D3A +#define GL_SUBPIXEL_BITS 0x0D50 +#define GL_RED_BITS 0x0D52 +#define GL_GREEN_BITS 0x0D53 +#define GL_BLUE_BITS 0x0D54 +#define GL_ALPHA_BITS 0x0D55 +#define GL_DEPTH_BITS 0x0D56 +#define GL_STENCIL_BITS 0x0D57 +#define GL_POLYGON_OFFSET_UNITS 0x2A00 +#define GL_POLYGON_OFFSET_FACTOR 0x8038 +#define GL_TEXTURE_BINDING_2D 0x8069 +#define GL_SAMPLE_BUFFERS 0x80A8 +#define GL_SAMPLES 0x80A9 +#define GL_SAMPLE_COVERAGE_VALUE 0x80AA +#define GL_SAMPLE_COVERAGE_INVERT 0x80AB +#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 +#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 +#define GL_DONT_CARE 0x1100 +#define GL_FASTEST 0x1101 +#define GL_NICEST 0x1102 +#define GL_GENERATE_MIPMAP_HINT 0x8192 +#define GL_BYTE 0x1400 +#define GL_UNSIGNED_BYTE 0x1401 +#define GL_SHORT 0x1402 +#define GL_UNSIGNED_SHORT 0x1403 +#define GL_INT 0x1404 +#define GL_UNSIGNED_INT 0x1405 +#define GL_FLOAT 0x1406 +#define GL_FIXED 0x140C +#define GL_DEPTH_COMPONENT 0x1902 +#define GL_ALPHA 0x1906 +#define GL_RGB 0x1907 +#define GL_RGBA 0x1908 +#define GL_LUMINANCE 0x1909 +#define GL_LUMINANCE_ALPHA 0x190A +#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 +#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 +#define GL_UNSIGNED_SHORT_5_6_5 0x8363 +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC +#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_SHADER_TYPE 0x8B4F +#define GL_DELETE_STATUS 0x8B80 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_NEVER 0x0200 +#define GL_LESS 0x0201 +#define GL_EQUAL 0x0202 +#define GL_LEQUAL 0x0203 +#define GL_GREATER 0x0204 +#define GL_NOTEQUAL 0x0205 +#define GL_GEQUAL 0x0206 +#define GL_ALWAYS 0x0207 +#define GL_KEEP 0x1E00 +#define GL_REPLACE 0x1E01 +#define GL_INCR 0x1E02 +#define GL_DECR 0x1E03 +#define GL_INVERT 0x150A +#define GL_INCR_WRAP 0x8507 +#define GL_DECR_WRAP 0x8508 +#define GL_VENDOR 0x1F00 +#define GL_RENDERER 0x1F01 +#define GL_VERSION 0x1F02 +#define GL_EXTENSIONS 0x1F03 +#define GL_NEAREST 0x2600 +#define GL_LINEAR 0x2601 +#define GL_NEAREST_MIPMAP_NEAREST 0x2700 +#define GL_LINEAR_MIPMAP_NEAREST 0x2701 +#define GL_NEAREST_MIPMAP_LINEAR 0x2702 +#define GL_LINEAR_MIPMAP_LINEAR 0x2703 +#define GL_TEXTURE_MAG_FILTER 0x2800 +#define GL_TEXTURE_MIN_FILTER 0x2801 +#define GL_TEXTURE_WRAP_S 0x2802 +#define GL_TEXTURE_WRAP_T 0x2803 +#define GL_TEXTURE 0x1702 +#define GL_TEXTURE_CUBE_MAP 0x8513 +#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 +#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 +#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A +#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C +#define GL_TEXTURE0 0x84C0 +#define GL_TEXTURE1 0x84C1 +#define GL_TEXTURE2 0x84C2 +#define GL_TEXTURE3 0x84C3 +#define GL_TEXTURE4 0x84C4 +#define GL_TEXTURE5 0x84C5 +#define GL_TEXTURE6 0x84C6 +#define GL_TEXTURE7 0x84C7 +#define GL_TEXTURE8 0x84C8 +#define GL_TEXTURE9 0x84C9 +#define GL_TEXTURE10 0x84CA +#define GL_TEXTURE11 0x84CB +#define GL_TEXTURE12 0x84CC +#define GL_TEXTURE13 0x84CD +#define GL_TEXTURE14 0x84CE +#define GL_TEXTURE15 0x84CF +#define GL_TEXTURE16 0x84D0 +#define GL_TEXTURE17 0x84D1 +#define GL_TEXTURE18 0x84D2 +#define GL_TEXTURE19 0x84D3 +#define GL_TEXTURE20 0x84D4 +#define GL_TEXTURE21 0x84D5 +#define GL_TEXTURE22 0x84D6 +#define GL_TEXTURE23 0x84D7 +#define GL_TEXTURE24 0x84D8 +#define GL_TEXTURE25 0x84D9 +#define GL_TEXTURE26 0x84DA +#define GL_TEXTURE27 0x84DB +#define GL_TEXTURE28 0x84DC +#define GL_TEXTURE29 0x84DD +#define GL_TEXTURE30 0x84DE +#define GL_TEXTURE31 0x84DF +#define GL_ACTIVE_TEXTURE 0x84E0 +#define GL_REPEAT 0x2901 +#define GL_CLAMP_TO_EDGE 0x812F +#define GL_MIRRORED_REPEAT 0x8370 +#define GL_FLOAT_VEC2 0x8B50 +#define GL_FLOAT_VEC3 0x8B51 +#define GL_FLOAT_VEC4 0x8B52 +#define GL_INT_VEC2 0x8B53 +#define GL_INT_VEC3 0x8B54 +#define GL_INT_VEC4 0x8B55 +#define GL_BOOL 0x8B56 +#define GL_BOOL_VEC2 0x8B57 +#define GL_BOOL_VEC3 0x8B58 +#define GL_BOOL_VEC4 0x8B59 +#define GL_FLOAT_MAT2 0x8B5A +#define GL_FLOAT_MAT3 0x8B5B +#define GL_FLOAT_MAT4 0x8B5C +#define GL_SAMPLER_2D 0x8B5E +#define GL_SAMPLER_CUBE 0x8B60 +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 +#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A +#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B +#define GL_COMPILE_STATUS 0x8B81 +#define GL_INFO_LOG_LENGTH 0x8B84 +#define GL_SHADER_SOURCE_LENGTH 0x8B88 +#define GL_SHADER_COMPILER 0x8DFA +#define GL_SHADER_BINARY_FORMATS 0x8DF8 +#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 +#define GL_LOW_FLOAT 0x8DF0 +#define GL_MEDIUM_FLOAT 0x8DF1 +#define GL_HIGH_FLOAT 0x8DF2 +#define GL_LOW_INT 0x8DF3 +#define GL_MEDIUM_INT 0x8DF4 +#define GL_HIGH_INT 0x8DF5 +#define GL_FRAMEBUFFER 0x8D40 +#define GL_RENDERBUFFER 0x8D41 +#define GL_RGBA4 0x8056 +#define GL_RGB5_A1 0x8057 +#define GL_RGB565 0x8D62 +#define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_STENCIL_INDEX8 0x8D48 +#define GL_RENDERBUFFER_WIDTH 0x8D42 +#define GL_RENDERBUFFER_HEIGHT 0x8D43 +#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 +#define GL_RENDERBUFFER_RED_SIZE 0x8D50 +#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 +#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 +#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 +#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 +#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 +#define GL_COLOR_ATTACHMENT0 0x8CE0 +#define GL_DEPTH_ATTACHMENT 0x8D00 +#define GL_STENCIL_ATTACHMENT 0x8D20 +#define GL_NONE 0 +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 +#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD +#define GL_FRAMEBUFFER_BINDING 0x8CA6 +#define GL_RENDERBUFFER_BINDING 0x8CA7 +#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 +#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 +typedef void (GL_APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture); +typedef void (GL_APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (GL_APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name); +typedef void (GL_APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer); +typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer); +typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer); +typedef void (GL_APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture); +typedef void (GL_APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage); +typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLCLEARPROC) (GLbitfield mask); +typedef void (GL_APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d); +typedef void (GL_APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s); +typedef void (GL_APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +typedef void (GL_APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +typedef void (GL_APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef GLuint (GL_APIENTRYP PFNGLCREATEPROGRAMPROC) (void); +typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROC) (GLenum type); +typedef void (GL_APIENTRYP PFNGLCULLFACEPROC) (GLenum mode); +typedef void (GL_APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers); +typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers); +typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers); +typedef void (GL_APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader); +typedef void (GL_APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures); +typedef void (GL_APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func); +typedef void (GL_APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f); +typedef void (GL_APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader); +typedef void (GL_APIENTRYP PFNGLDISABLEPROC) (GLenum cap); +typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices); +typedef void (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap); +typedef void (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index); +typedef void (GL_APIENTRYP PFNGLFINISHPROC) (void); +typedef void (GL_APIENTRYP PFNGLFLUSHPROC) (void); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +typedef void (GL_APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode); +typedef void (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers); +typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers); +typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers); +typedef void (GL_APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures); +typedef void (GL_APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +typedef void (GL_APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +typedef GLint (GL_APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (GL_APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data); +typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef GLenum (GL_APIENTRYP PFNGLGETERRORPROC) (void); +typedef void (GL_APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data); +typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (GL_APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +typedef void (GL_APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params); +typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name); +typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer); +typedef void (GL_APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode); +typedef GLboolean (GL_APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer); +typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDPROC) (GLenum cap); +typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer); +typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPROC) (GLuint program); +typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer); +typedef GLboolean (GL_APIENTRYP PFNGLISSHADERPROC) (GLuint shader); +typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture); +typedef void (GL_APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width); +typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units); +typedef void (GL_APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); +typedef void (GL_APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void); +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert); +typedef void (GL_APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +typedef void (GL_APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +typedef void (GL_APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass); +typedef void (GL_APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +typedef void (GL_APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0); +typedef void (GL_APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0); +typedef void (GL_APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1); +typedef void (GL_APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1); +typedef void (GL_APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (GL_APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2); +typedef void (GL_APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (GL_APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (GL_APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +typedef void (GL_APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height); +#if GL_GLES_PROTOTYPES +GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); +GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); +GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); +GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); +GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode); +GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage); +GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); +GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); +GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); +GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d); +GL_APICALL void GL_APIENTRY glClearStencil (GLint s); +GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); +GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); +GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); +GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); +GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); +GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); +GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); +GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); +GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); +GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); +GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); +GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); +GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f); +GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glDisable (GLenum cap); +GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices); +GL_APICALL void GL_APIENTRY glEnable (GLenum cap); +GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glFinish (void); +GL_APICALL void GL_APIENTRY glFlush (void); +GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); +GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); +GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); +GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers); +GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); +GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures); +GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); +GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); +GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name); +GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data); +GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); +GL_APICALL GLenum GL_APIENTRY glGetError (void); +GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data); +GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data); +GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); +GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); +GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name); +GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params); +GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name); +GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer); +GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); +GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); +GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); +GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); +GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); +GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); +GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); +GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); +GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); +GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); +GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); +GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); +GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); +GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); +GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); +GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); +GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0); +GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0); +GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1); +GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1); +GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); +GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); +GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); +GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x); +GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); +GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); +#endif +#endif /* GL_ES_VERSION_2_0 */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Engine/lib/sdl/src/video/khronos/GLES2/gl2ext.h b/Engine/lib/sdl/src/video/khronos/GLES2/gl2ext.h new file mode 100644 index 000000000..4e1488c62 --- /dev/null +++ b/Engine/lib/sdl/src/video/khronos/GLES2/gl2ext.h @@ -0,0 +1,3505 @@ +#ifndef __gl2ext_h_ +#define __gl2ext_h_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2013-2017 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ +/* +** This header is generated from the Khronos OpenGL / OpenGL ES XML +** API Registry. The current version of the Registry, generator scripts +** used to make the header, and the header can be found at +** https://github.com/KhronosGroup/OpenGL-Registry +*/ + +#ifndef GL_APIENTRYP +#define GL_APIENTRYP GL_APIENTRY* +#endif + +/* Generated on date 20170817 */ + +/* Generated C header for: + * API: gles2 + * Profile: common + * Versions considered: 2\.[0-9] + * Versions emitted: _nomatch_^ + * Default extensions included: gles2 + * Additional extensions included: _nomatch_^ + * Extensions removed: _nomatch_^ + */ + +#ifndef GL_KHR_blend_equation_advanced +#define GL_KHR_blend_equation_advanced 1 +#define GL_MULTIPLY_KHR 0x9294 +#define GL_SCREEN_KHR 0x9295 +#define GL_OVERLAY_KHR 0x9296 +#define GL_DARKEN_KHR 0x9297 +#define GL_LIGHTEN_KHR 0x9298 +#define GL_COLORDODGE_KHR 0x9299 +#define GL_COLORBURN_KHR 0x929A +#define GL_HARDLIGHT_KHR 0x929B +#define GL_SOFTLIGHT_KHR 0x929C +#define GL_DIFFERENCE_KHR 0x929E +#define GL_EXCLUSION_KHR 0x92A0 +#define GL_HSL_HUE_KHR 0x92AD +#define GL_HSL_SATURATION_KHR 0x92AE +#define GL_HSL_COLOR_KHR 0x92AF +#define GL_HSL_LUMINOSITY_KHR 0x92B0 +typedef void (GL_APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlendBarrierKHR (void); +#endif +#endif /* GL_KHR_blend_equation_advanced */ + +#ifndef GL_KHR_blend_equation_advanced_coherent +#define GL_KHR_blend_equation_advanced_coherent 1 +#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285 +#endif /* GL_KHR_blend_equation_advanced_coherent */ + +#ifndef GL_KHR_context_flush_control +#define GL_KHR_context_flush_control 1 +#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB +#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x82FC +#endif /* GL_KHR_context_flush_control */ + +#ifndef GL_KHR_debug +#define GL_KHR_debug 1 +typedef void (GL_APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); +#define GL_SAMPLER 0x82E6 +#define GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR 0x8242 +#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR 0x8243 +#define GL_DEBUG_CALLBACK_FUNCTION_KHR 0x8244 +#define GL_DEBUG_CALLBACK_USER_PARAM_KHR 0x8245 +#define GL_DEBUG_SOURCE_API_KHR 0x8246 +#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR 0x8247 +#define GL_DEBUG_SOURCE_SHADER_COMPILER_KHR 0x8248 +#define GL_DEBUG_SOURCE_THIRD_PARTY_KHR 0x8249 +#define GL_DEBUG_SOURCE_APPLICATION_KHR 0x824A +#define GL_DEBUG_SOURCE_OTHER_KHR 0x824B +#define GL_DEBUG_TYPE_ERROR_KHR 0x824C +#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR 0x824D +#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR 0x824E +#define GL_DEBUG_TYPE_PORTABILITY_KHR 0x824F +#define GL_DEBUG_TYPE_PERFORMANCE_KHR 0x8250 +#define GL_DEBUG_TYPE_OTHER_KHR 0x8251 +#define GL_DEBUG_TYPE_MARKER_KHR 0x8268 +#define GL_DEBUG_TYPE_PUSH_GROUP_KHR 0x8269 +#define GL_DEBUG_TYPE_POP_GROUP_KHR 0x826A +#define GL_DEBUG_SEVERITY_NOTIFICATION_KHR 0x826B +#define GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR 0x826C +#define GL_DEBUG_GROUP_STACK_DEPTH_KHR 0x826D +#define GL_BUFFER_KHR 0x82E0 +#define GL_SHADER_KHR 0x82E1 +#define GL_PROGRAM_KHR 0x82E2 +#define GL_VERTEX_ARRAY_KHR 0x8074 +#define GL_QUERY_KHR 0x82E3 +#define GL_PROGRAM_PIPELINE_KHR 0x82E4 +#define GL_SAMPLER_KHR 0x82E6 +#define GL_MAX_LABEL_LENGTH_KHR 0x82E8 +#define GL_MAX_DEBUG_MESSAGE_LENGTH_KHR 0x9143 +#define GL_MAX_DEBUG_LOGGED_MESSAGES_KHR 0x9144 +#define GL_DEBUG_LOGGED_MESSAGES_KHR 0x9145 +#define GL_DEBUG_SEVERITY_HIGH_KHR 0x9146 +#define GL_DEBUG_SEVERITY_MEDIUM_KHR 0x9147 +#define GL_DEBUG_SEVERITY_LOW_KHR 0x9148 +#define GL_DEBUG_OUTPUT_KHR 0x92E0 +#define GL_CONTEXT_FLAG_DEBUG_BIT_KHR 0x00000002 +#define GL_STACK_OVERFLOW_KHR 0x0503 +#define GL_STACK_UNDERFLOW_KHR 0x0504 +typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRPROC) (GLDEBUGPROCKHR callback, const void *userParam); +typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPKHRPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); +typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRPROC) (void); +typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRPROC) (GLenum pname, void **params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDebugMessageControlKHR (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); +GL_APICALL void GL_APIENTRY glDebugMessageInsertKHR (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); +GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHR (GLDEBUGPROCKHR callback, const void *userParam); +GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHR (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); +GL_APICALL void GL_APIENTRY glPushDebugGroupKHR (GLenum source, GLuint id, GLsizei length, const GLchar *message); +GL_APICALL void GL_APIENTRY glPopDebugGroupKHR (void); +GL_APICALL void GL_APIENTRY glObjectLabelKHR (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); +GL_APICALL void GL_APIENTRY glGetObjectLabelKHR (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +GL_APICALL void GL_APIENTRY glObjectPtrLabelKHR (const void *ptr, GLsizei length, const GLchar *label); +GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHR (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); +GL_APICALL void GL_APIENTRY glGetPointervKHR (GLenum pname, void **params); +#endif +#endif /* GL_KHR_debug */ + +#ifndef GL_KHR_no_error +#define GL_KHR_no_error 1 +#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008 +#endif /* GL_KHR_no_error */ + +#ifndef GL_KHR_parallel_shader_compile +#define GL_KHR_parallel_shader_compile 1 +#define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0 +#define GL_COMPLETION_STATUS_KHR 0x91B1 +typedef void (GL_APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSKHRPROC) (GLuint count); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMaxShaderCompilerThreadsKHR (GLuint count); +#endif +#endif /* GL_KHR_parallel_shader_compile */ + +#ifndef GL_KHR_robust_buffer_access_behavior +#define GL_KHR_robust_buffer_access_behavior 1 +#endif /* GL_KHR_robust_buffer_access_behavior */ + +#ifndef GL_KHR_robustness +#define GL_KHR_robustness 1 +#define GL_CONTEXT_ROBUST_ACCESS_KHR 0x90F3 +#define GL_LOSE_CONTEXT_ON_RESET_KHR 0x8252 +#define GL_GUILTY_CONTEXT_RESET_KHR 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_KHR 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_KHR 0x8255 +#define GL_RESET_NOTIFICATION_STRATEGY_KHR 0x8256 +#define GL_NO_RESET_NOTIFICATION_KHR 0x8261 +#define GL_CONTEXT_LOST_KHR 0x0507 +typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC) (void); +typedef void (GL_APIENTRYP PFNGLREADNPIXELSKHRPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMUIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusKHR (void); +GL_APICALL void GL_APIENTRY glReadnPixelsKHR (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GL_APICALL void GL_APIENTRY glGetnUniformfvKHR (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetnUniformivKHR (GLuint program, GLint location, GLsizei bufSize, GLint *params); +GL_APICALL void GL_APIENTRY glGetnUniformuivKHR (GLuint program, GLint location, GLsizei bufSize, GLuint *params); +#endif +#endif /* GL_KHR_robustness */ + +#ifndef GL_KHR_texture_compression_astc_hdr +#define GL_KHR_texture_compression_astc_hdr 1 +#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 +#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 +#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 +#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 +#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 +#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 +#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 +#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 +#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 +#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 +#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA +#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB +#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC +#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD +#endif /* GL_KHR_texture_compression_astc_hdr */ + +#ifndef GL_KHR_texture_compression_astc_ldr +#define GL_KHR_texture_compression_astc_ldr 1 +#endif /* GL_KHR_texture_compression_astc_ldr */ + +#ifndef GL_KHR_texture_compression_astc_sliced_3d +#define GL_KHR_texture_compression_astc_sliced_3d 1 +#endif /* GL_KHR_texture_compression_astc_sliced_3d */ + +#ifndef GL_OES_EGL_image +#define GL_OES_EGL_image 1 +typedef void *GLeglImageOES; +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); +GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); +#endif +#endif /* GL_OES_EGL_image */ + +#ifndef GL_OES_EGL_image_external +#define GL_OES_EGL_image_external 1 +#define GL_TEXTURE_EXTERNAL_OES 0x8D65 +#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 +#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 +#define GL_SAMPLER_EXTERNAL_OES 0x8D66 +#endif /* GL_OES_EGL_image_external */ + +#ifndef GL_OES_EGL_image_external_essl3 +#define GL_OES_EGL_image_external_essl3 1 +#endif /* GL_OES_EGL_image_external_essl3 */ + +#ifndef GL_OES_compressed_ETC1_RGB8_sub_texture +#define GL_OES_compressed_ETC1_RGB8_sub_texture 1 +#endif /* GL_OES_compressed_ETC1_RGB8_sub_texture */ + +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_OES_compressed_ETC1_RGB8_texture 1 +#define GL_ETC1_RGB8_OES 0x8D64 +#endif /* GL_OES_compressed_ETC1_RGB8_texture */ + +#ifndef GL_OES_compressed_paletted_texture +#define GL_OES_compressed_paletted_texture 1 +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 +#endif /* GL_OES_compressed_paletted_texture */ + +#ifndef GL_OES_copy_image +#define GL_OES_copy_image 1 +typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAOESPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCopyImageSubDataOES (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#endif +#endif /* GL_OES_copy_image */ + +#ifndef GL_OES_depth24 +#define GL_OES_depth24 1 +#define GL_DEPTH_COMPONENT24_OES 0x81A6 +#endif /* GL_OES_depth24 */ + +#ifndef GL_OES_depth32 +#define GL_OES_depth32 1 +#define GL_DEPTH_COMPONENT32_OES 0x81A7 +#endif /* GL_OES_depth32 */ + +#ifndef GL_OES_depth_texture +#define GL_OES_depth_texture 1 +#endif /* GL_OES_depth_texture */ + +#ifndef GL_OES_draw_buffers_indexed +#define GL_OES_draw_buffers_indexed 1 +#define GL_MIN 0x8007 +#define GL_MAX 0x8008 +typedef void (GL_APIENTRYP PFNGLENABLEIOESPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLDISABLEIOESPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIOESPROC) (GLuint buf, GLenum mode); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIOESPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCIOESPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIOESPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (GL_APIENTRYP PFNGLCOLORMASKIOESPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIOESPROC) (GLenum target, GLuint index); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glEnableiOES (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glDisableiOES (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glBlendEquationiOES (GLuint buf, GLenum mode); +GL_APICALL void GL_APIENTRY glBlendEquationSeparateiOES (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunciOES (GLuint buf, GLenum src, GLenum dst); +GL_APICALL void GL_APIENTRY glBlendFuncSeparateiOES (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GL_APICALL void GL_APIENTRY glColorMaskiOES (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GL_APICALL GLboolean GL_APIENTRY glIsEnablediOES (GLenum target, GLuint index); +#endif +#endif /* GL_OES_draw_buffers_indexed */ + +#ifndef GL_OES_draw_elements_base_vertex +#define GL_OES_draw_elements_base_vertex 1 +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawElementsBaseVertexOES (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GL_APICALL void GL_APIENTRY glDrawRangeElementsBaseVertexOES (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexOES (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +GL_APICALL void GL_APIENTRY glMultiDrawElementsBaseVertexEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex); +#endif +#endif /* GL_OES_draw_elements_base_vertex */ + +#ifndef GL_OES_element_index_uint +#define GL_OES_element_index_uint 1 +#endif /* GL_OES_element_index_uint */ + +#ifndef GL_OES_fbo_render_mipmap +#define GL_OES_fbo_render_mipmap 1 +#endif /* GL_OES_fbo_render_mipmap */ + +#ifndef GL_OES_fragment_precision_high +#define GL_OES_fragment_precision_high 1 +#endif /* GL_OES_fragment_precision_high */ + +#ifndef GL_OES_geometry_point_size +#define GL_OES_geometry_point_size 1 +#endif /* GL_OES_geometry_point_size */ + +#ifndef GL_OES_geometry_shader +#define GL_OES_geometry_shader 1 +#define GL_GEOMETRY_SHADER_OES 0x8DD9 +#define GL_GEOMETRY_SHADER_BIT_OES 0x00000004 +#define GL_GEOMETRY_LINKED_VERTICES_OUT_OES 0x8916 +#define GL_GEOMETRY_LINKED_INPUT_TYPE_OES 0x8917 +#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_OES 0x8918 +#define GL_GEOMETRY_SHADER_INVOCATIONS_OES 0x887F +#define GL_LAYER_PROVOKING_VERTEX_OES 0x825E +#define GL_LINES_ADJACENCY_OES 0x000A +#define GL_LINE_STRIP_ADJACENCY_OES 0x000B +#define GL_TRIANGLES_ADJACENCY_OES 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY_OES 0x000D +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8DDF +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_OES 0x8A2C +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8A32 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_OES 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_OES 0x9124 +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_OES 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_OES 0x8DE1 +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_OES 0x8E5A +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_OES 0x8C29 +#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_OES 0x92CF +#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_OES 0x92D5 +#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_OES 0x90CD +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_OES 0x90D7 +#define GL_FIRST_VERTEX_CONVENTION_OES 0x8E4D +#define GL_LAST_VERTEX_CONVENTION_OES 0x8E4E +#define GL_UNDEFINED_VERTEX_OES 0x8260 +#define GL_PRIMITIVES_GENERATED_OES 0x8C87 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS_OES 0x9312 +#define GL_MAX_FRAMEBUFFER_LAYERS_OES 0x9317 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_OES 0x8DA8 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_OES 0x8DA7 +#define GL_REFERENCED_BY_GEOMETRY_SHADER_OES 0x9309 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREOESPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTextureOES (GLenum target, GLenum attachment, GLuint texture, GLint level); +#endif +#endif /* GL_OES_geometry_shader */ + +#ifndef GL_OES_get_program_binary +#define GL_OES_get_program_binary 1 +#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE +#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF +typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLint length); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); +GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const void *binary, GLint length); +#endif +#endif /* GL_OES_get_program_binary */ + +#ifndef GL_OES_gpu_shader5 +#define GL_OES_gpu_shader5 1 +#endif /* GL_OES_gpu_shader5 */ + +#ifndef GL_OES_mapbuffer +#define GL_OES_mapbuffer 1 +#define GL_WRITE_ONLY_OES 0x88B9 +#define GL_BUFFER_ACCESS_OES 0x88BB +#define GL_BUFFER_MAPPED_OES 0x88BC +#define GL_BUFFER_MAP_POINTER_OES 0x88BD +typedef void *(GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); +typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void **params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void *GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); +GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target); +GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void **params); +#endif +#endif /* GL_OES_mapbuffer */ + +#ifndef GL_OES_packed_depth_stencil +#define GL_OES_packed_depth_stencil 1 +#define GL_DEPTH_STENCIL_OES 0x84F9 +#define GL_UNSIGNED_INT_24_8_OES 0x84FA +#define GL_DEPTH24_STENCIL8_OES 0x88F0 +#endif /* GL_OES_packed_depth_stencil */ + +#ifndef GL_OES_primitive_bounding_box +#define GL_OES_primitive_bounding_box 1 +#define GL_PRIMITIVE_BOUNDING_BOX_OES 0x92BE +typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXOESPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxOES (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#endif +#endif /* GL_OES_primitive_bounding_box */ + +#ifndef GL_OES_required_internalformat +#define GL_OES_required_internalformat 1 +#define GL_ALPHA8_OES 0x803C +#define GL_DEPTH_COMPONENT16_OES 0x81A5 +#define GL_LUMINANCE4_ALPHA4_OES 0x8043 +#define GL_LUMINANCE8_ALPHA8_OES 0x8045 +#define GL_LUMINANCE8_OES 0x8040 +#define GL_RGBA4_OES 0x8056 +#define GL_RGB5_A1_OES 0x8057 +#define GL_RGB565_OES 0x8D62 +#define GL_RGB8_OES 0x8051 +#define GL_RGBA8_OES 0x8058 +#define GL_RGB10_EXT 0x8052 +#define GL_RGB10_A2_EXT 0x8059 +#endif /* GL_OES_required_internalformat */ + +#ifndef GL_OES_rgb8_rgba8 +#define GL_OES_rgb8_rgba8 1 +#endif /* GL_OES_rgb8_rgba8 */ + +#ifndef GL_OES_sample_shading +#define GL_OES_sample_shading 1 +#define GL_SAMPLE_SHADING_OES 0x8C36 +#define GL_MIN_SAMPLE_SHADING_VALUE_OES 0x8C37 +typedef void (GL_APIENTRYP PFNGLMINSAMPLESHADINGOESPROC) (GLfloat value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMinSampleShadingOES (GLfloat value); +#endif +#endif /* GL_OES_sample_shading */ + +#ifndef GL_OES_sample_variables +#define GL_OES_sample_variables 1 +#endif /* GL_OES_sample_variables */ + +#ifndef GL_OES_shader_image_atomic +#define GL_OES_shader_image_atomic 1 +#endif /* GL_OES_shader_image_atomic */ + +#ifndef GL_OES_shader_io_blocks +#define GL_OES_shader_io_blocks 1 +#endif /* GL_OES_shader_io_blocks */ + +#ifndef GL_OES_shader_multisample_interpolation +#define GL_OES_shader_multisample_interpolation 1 +#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5B +#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5C +#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES 0x8E5D +#endif /* GL_OES_shader_multisample_interpolation */ + +#ifndef GL_OES_standard_derivatives +#define GL_OES_standard_derivatives 1 +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B +#endif /* GL_OES_standard_derivatives */ + +#ifndef GL_OES_stencil1 +#define GL_OES_stencil1 1 +#define GL_STENCIL_INDEX1_OES 0x8D46 +#endif /* GL_OES_stencil1 */ + +#ifndef GL_OES_stencil4 +#define GL_OES_stencil4 1 +#define GL_STENCIL_INDEX4_OES 0x8D47 +#endif /* GL_OES_stencil4 */ + +#ifndef GL_OES_surfaceless_context +#define GL_OES_surfaceless_context 1 +#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219 +#endif /* GL_OES_surfaceless_context */ + +#ifndef GL_OES_tessellation_point_size +#define GL_OES_tessellation_point_size 1 +#endif /* GL_OES_tessellation_point_size */ + +#ifndef GL_OES_tessellation_shader +#define GL_OES_tessellation_shader 1 +#define GL_PATCHES_OES 0x000E +#define GL_PATCH_VERTICES_OES 0x8E72 +#define GL_TESS_CONTROL_OUTPUT_VERTICES_OES 0x8E75 +#define GL_TESS_GEN_MODE_OES 0x8E76 +#define GL_TESS_GEN_SPACING_OES 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER_OES 0x8E78 +#define GL_TESS_GEN_POINT_MODE_OES 0x8E79 +#define GL_ISOLINES_OES 0x8E7A +#define GL_QUADS_OES 0x0007 +#define GL_FRACTIONAL_ODD_OES 0x8E7B +#define GL_FRACTIONAL_EVEN_OES 0x8E7C +#define GL_MAX_PATCH_VERTICES_OES 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL_OES 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_OES 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_OES 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_OES 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS_OES 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_OES 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_OES 0x8E86 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_OES 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_OES 0x8E8A +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_OES 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_OES 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E1F +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_OES 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_OES 0x92CE +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_OES 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_OES 0x92D4 +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_OES 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_OES 0x90CC +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_OES 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_OES 0x90D9 +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED_OES 0x8221 +#define GL_IS_PER_PATCH_OES 0x92E7 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_OES 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_OES 0x9308 +#define GL_TESS_CONTROL_SHADER_OES 0x8E88 +#define GL_TESS_EVALUATION_SHADER_OES 0x8E87 +#define GL_TESS_CONTROL_SHADER_BIT_OES 0x00000008 +#define GL_TESS_EVALUATION_SHADER_BIT_OES 0x00000010 +typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIOESPROC) (GLenum pname, GLint value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPatchParameteriOES (GLenum pname, GLint value); +#endif +#endif /* GL_OES_tessellation_shader */ + +#ifndef GL_OES_texture_3D +#define GL_OES_texture_3D 1 +#define GL_TEXTURE_WRAP_R_OES 0x8072 +#define GL_TEXTURE_3D_OES 0x806F +#define GL_TEXTURE_BINDING_3D_OES 0x806A +#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 +#define GL_SAMPLER_3D_OES 0x8B5F +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4 +typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +#endif +#endif /* GL_OES_texture_3D */ + +#ifndef GL_OES_texture_border_clamp +#define GL_OES_texture_border_clamp 1 +#define GL_TEXTURE_BORDER_COLOR_OES 0x1004 +#define GL_CLAMP_TO_BORDER_OES 0x812D +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, const GLuint *param); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexParameterIivOES (GLenum target, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glTexParameterIuivOES (GLenum target, GLenum pname, const GLuint *params); +GL_APICALL void GL_APIENTRY glGetTexParameterIivOES (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetTexParameterIuivOES (GLenum target, GLenum pname, GLuint *params); +GL_APICALL void GL_APIENTRY glSamplerParameterIivOES (GLuint sampler, GLenum pname, const GLint *param); +GL_APICALL void GL_APIENTRY glSamplerParameterIuivOES (GLuint sampler, GLenum pname, const GLuint *param); +GL_APICALL void GL_APIENTRY glGetSamplerParameterIivOES (GLuint sampler, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivOES (GLuint sampler, GLenum pname, GLuint *params); +#endif +#endif /* GL_OES_texture_border_clamp */ + +#ifndef GL_OES_texture_buffer +#define GL_OES_texture_buffer 1 +#define GL_TEXTURE_BUFFER_OES 0x8C2A +#define GL_TEXTURE_BUFFER_BINDING_OES 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_OES 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_OES 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_OES 0x8C2D +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_OES 0x919F +#define GL_SAMPLER_BUFFER_OES 0x8DC2 +#define GL_INT_SAMPLER_BUFFER_OES 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_OES 0x8DD8 +#define GL_IMAGE_BUFFER_OES 0x9051 +#define GL_INT_IMAGE_BUFFER_OES 0x905C +#define GL_UNSIGNED_INT_IMAGE_BUFFER_OES 0x9067 +#define GL_TEXTURE_BUFFER_OFFSET_OES 0x919D +#define GL_TEXTURE_BUFFER_SIZE_OES 0x919E +typedef void (GL_APIENTRYP PFNGLTEXBUFFEROESPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEOESPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexBufferOES (GLenum target, GLenum internalformat, GLuint buffer); +GL_APICALL void GL_APIENTRY glTexBufferRangeOES (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#endif +#endif /* GL_OES_texture_buffer */ + +#ifndef GL_OES_texture_compression_astc +#define GL_OES_texture_compression_astc 1 +#define GL_COMPRESSED_RGBA_ASTC_3x3x3_OES 0x93C0 +#define GL_COMPRESSED_RGBA_ASTC_4x3x3_OES 0x93C1 +#define GL_COMPRESSED_RGBA_ASTC_4x4x3_OES 0x93C2 +#define GL_COMPRESSED_RGBA_ASTC_4x4x4_OES 0x93C3 +#define GL_COMPRESSED_RGBA_ASTC_5x4x4_OES 0x93C4 +#define GL_COMPRESSED_RGBA_ASTC_5x5x4_OES 0x93C5 +#define GL_COMPRESSED_RGBA_ASTC_5x5x5_OES 0x93C6 +#define GL_COMPRESSED_RGBA_ASTC_6x5x5_OES 0x93C7 +#define GL_COMPRESSED_RGBA_ASTC_6x6x5_OES 0x93C8 +#define GL_COMPRESSED_RGBA_ASTC_6x6x6_OES 0x93C9 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES 0x93E0 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES 0x93E1 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES 0x93E2 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES 0x93E3 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES 0x93E4 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES 0x93E5 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES 0x93E6 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES 0x93E7 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES 0x93E8 +#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES 0x93E9 +#endif /* GL_OES_texture_compression_astc */ + +#ifndef GL_OES_texture_cube_map_array +#define GL_OES_texture_cube_map_array 1 +#define GL_TEXTURE_CUBE_MAP_ARRAY_OES 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_OES 0x900A +#define GL_SAMPLER_CUBE_MAP_ARRAY_OES 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_OES 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_OES 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_OES 0x900F +#define GL_IMAGE_CUBE_MAP_ARRAY_OES 0x9054 +#define GL_INT_IMAGE_CUBE_MAP_ARRAY_OES 0x905F +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_OES 0x906A +#endif /* GL_OES_texture_cube_map_array */ + +#ifndef GL_OES_texture_float +#define GL_OES_texture_float 1 +#endif /* GL_OES_texture_float */ + +#ifndef GL_OES_texture_float_linear +#define GL_OES_texture_float_linear 1 +#endif /* GL_OES_texture_float_linear */ + +#ifndef GL_OES_texture_half_float +#define GL_OES_texture_half_float 1 +#define GL_HALF_FLOAT_OES 0x8D61 +#endif /* GL_OES_texture_half_float */ + +#ifndef GL_OES_texture_half_float_linear +#define GL_OES_texture_half_float_linear 1 +#endif /* GL_OES_texture_half_float_linear */ + +#ifndef GL_OES_texture_npot +#define GL_OES_texture_npot 1 +#endif /* GL_OES_texture_npot */ + +#ifndef GL_OES_texture_stencil8 +#define GL_OES_texture_stencil8 1 +#define GL_STENCIL_INDEX_OES 0x1901 +#define GL_STENCIL_INDEX8_OES 0x8D48 +#endif /* GL_OES_texture_stencil8 */ + +#ifndef GL_OES_texture_storage_multisample_2d_array +#define GL_OES_texture_storage_multisample_2d_array 1 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES 0x9102 +#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES 0x9105 +#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910B +#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910C +#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910D +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexStorage3DMultisampleOES (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); +#endif +#endif /* GL_OES_texture_storage_multisample_2d_array */ + +#ifndef GL_OES_texture_view +#define GL_OES_texture_view 1 +#define GL_TEXTURE_VIEW_MIN_LEVEL_OES 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS_OES 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER_OES 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS_OES 0x82DE +#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF +typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWOESPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTextureViewOES (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#endif +#endif /* GL_OES_texture_view */ + +#ifndef GL_OES_vertex_array_object +#define GL_OES_vertex_array_object 1 +#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 +typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array); +typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays); +typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array); +GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays); +GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays); +GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array); +#endif +#endif /* GL_OES_vertex_array_object */ + +#ifndef GL_OES_vertex_half_float +#define GL_OES_vertex_half_float 1 +#endif /* GL_OES_vertex_half_float */ + +#ifndef GL_OES_vertex_type_10_10_10_2 +#define GL_OES_vertex_type_10_10_10_2 1 +#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6 +#define GL_INT_10_10_10_2_OES 0x8DF7 +#endif /* GL_OES_vertex_type_10_10_10_2 */ + +#ifndef GL_OES_viewport_array +#define GL_OES_viewport_array 1 +#define GL_MAX_VIEWPORTS_OES 0x825B +#define GL_VIEWPORT_SUBPIXEL_BITS_OES 0x825C +#define GL_VIEWPORT_BOUNDS_RANGE_OES 0x825D +#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX_OES 0x825F +typedef void (GL_APIENTRYP PFNGLVIEWPORTARRAYVOESPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFOESPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFVOESPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLSCISSORARRAYVOESPROC) (GLuint first, GLsizei count, const GLint *v); +typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDOESPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDVOESPROC) (GLuint index, const GLint *v); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEARRAYFVOESPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEINDEXEDFOESPROC) (GLuint index, GLfloat n, GLfloat f); +typedef void (GL_APIENTRYP PFNGLGETFLOATI_VOESPROC) (GLenum target, GLuint index, GLfloat *data); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glViewportArrayvOES (GLuint first, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glViewportIndexedfOES (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +GL_APICALL void GL_APIENTRY glViewportIndexedfvOES (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glScissorArrayvOES (GLuint first, GLsizei count, const GLint *v); +GL_APICALL void GL_APIENTRY glScissorIndexedOES (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glScissorIndexedvOES (GLuint index, const GLint *v); +GL_APICALL void GL_APIENTRY glDepthRangeArrayfvOES (GLuint first, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glDepthRangeIndexedfOES (GLuint index, GLfloat n, GLfloat f); +GL_APICALL void GL_APIENTRY glGetFloati_vOES (GLenum target, GLuint index, GLfloat *data); +#endif +#endif /* GL_OES_viewport_array */ + +#ifndef GL_AMD_compressed_3DC_texture +#define GL_AMD_compressed_3DC_texture 1 +#define GL_3DC_X_AMD 0x87F9 +#define GL_3DC_XY_AMD 0x87FA +#endif /* GL_AMD_compressed_3DC_texture */ + +#ifndef GL_AMD_compressed_ATC_texture +#define GL_AMD_compressed_ATC_texture 1 +#define GL_ATC_RGB_AMD 0x8C92 +#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 +#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE +#endif /* GL_AMD_compressed_ATC_texture */ + +#ifndef GL_AMD_performance_monitor +#define GL_AMD_performance_monitor 1 +#define GL_COUNTER_TYPE_AMD 0x8BC0 +#define GL_COUNTER_RANGE_AMD 0x8BC1 +#define GL_UNSIGNED_INT64_AMD 0x8BC2 +#define GL_PERCENTAGE_AMD 0x8BC3 +#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 +#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 +#define GL_PERFMON_RESULT_AMD 0x8BC6 +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data); +typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); +typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *data); +GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors); +GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors); +GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); +GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor); +GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#endif +#endif /* GL_AMD_performance_monitor */ + +#ifndef GL_AMD_program_binary_Z400 +#define GL_AMD_program_binary_Z400 1 +#define GL_Z400_BINARY_AMD 0x8740 +#endif /* GL_AMD_program_binary_Z400 */ + +#ifndef GL_ANDROID_extension_pack_es31a +#define GL_ANDROID_extension_pack_es31a 1 +#endif /* GL_ANDROID_extension_pack_es31a */ + +#ifndef GL_ANGLE_depth_texture +#define GL_ANGLE_depth_texture 1 +#endif /* GL_ANGLE_depth_texture */ + +#ifndef GL_ANGLE_framebuffer_blit +#define GL_ANGLE_framebuffer_blit 1 +#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA +typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif +#endif /* GL_ANGLE_framebuffer_blit */ + +#ifndef GL_ANGLE_framebuffer_multisample +#define GL_ANGLE_framebuffer_multisample 1 +#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56 +#define GL_MAX_SAMPLES_ANGLE 0x8D57 +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif +#endif /* GL_ANGLE_framebuffer_multisample */ + +#ifndef GL_ANGLE_instanced_arrays +#define GL_ANGLE_instanced_arrays 1 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor); +#endif +#endif /* GL_ANGLE_instanced_arrays */ + +#ifndef GL_ANGLE_pack_reverse_row_order +#define GL_ANGLE_pack_reverse_row_order 1 +#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 +#endif /* GL_ANGLE_pack_reverse_row_order */ + +#ifndef GL_ANGLE_program_binary +#define GL_ANGLE_program_binary 1 +#define GL_PROGRAM_BINARY_ANGLE 0x93A6 +#endif /* GL_ANGLE_program_binary */ + +#ifndef GL_ANGLE_texture_compression_dxt3 +#define GL_ANGLE_texture_compression_dxt3 1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 +#endif /* GL_ANGLE_texture_compression_dxt3 */ + +#ifndef GL_ANGLE_texture_compression_dxt5 +#define GL_ANGLE_texture_compression_dxt5 1 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 +#endif /* GL_ANGLE_texture_compression_dxt5 */ + +#ifndef GL_ANGLE_texture_usage +#define GL_ANGLE_texture_usage 1 +#define GL_TEXTURE_USAGE_ANGLE 0x93A2 +#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3 +#endif /* GL_ANGLE_texture_usage */ + +#ifndef GL_ANGLE_translated_shader_source +#define GL_ANGLE_translated_shader_source 1 +#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 +typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); +#endif +#endif /* GL_ANGLE_translated_shader_source */ + +#ifndef GL_APPLE_clip_distance +#define GL_APPLE_clip_distance 1 +#define GL_MAX_CLIP_DISTANCES_APPLE 0x0D32 +#define GL_CLIP_DISTANCE0_APPLE 0x3000 +#define GL_CLIP_DISTANCE1_APPLE 0x3001 +#define GL_CLIP_DISTANCE2_APPLE 0x3002 +#define GL_CLIP_DISTANCE3_APPLE 0x3003 +#define GL_CLIP_DISTANCE4_APPLE 0x3004 +#define GL_CLIP_DISTANCE5_APPLE 0x3005 +#define GL_CLIP_DISTANCE6_APPLE 0x3006 +#define GL_CLIP_DISTANCE7_APPLE 0x3007 +#endif /* GL_APPLE_clip_distance */ + +#ifndef GL_APPLE_color_buffer_packed_float +#define GL_APPLE_color_buffer_packed_float 1 +#endif /* GL_APPLE_color_buffer_packed_float */ + +#ifndef GL_APPLE_copy_texture_levels +#define GL_APPLE_copy_texture_levels 1 +typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); +#endif +#endif /* GL_APPLE_copy_texture_levels */ + +#ifndef GL_APPLE_framebuffer_multisample +#define GL_APPLE_framebuffer_multisample 1 +#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56 +#define GL_MAX_SAMPLES_APPLE 0x8D57 +#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void); +#endif +#endif /* GL_APPLE_framebuffer_multisample */ + +#ifndef GL_APPLE_rgb_422 +#define GL_APPLE_rgb_422 1 +#define GL_RGB_422_APPLE 0x8A1F +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#define GL_RGB_RAW_422_APPLE 0x8A51 +#endif /* GL_APPLE_rgb_422 */ + +#ifndef GL_APPLE_sync +#define GL_APPLE_sync 1 +#define GL_SYNC_OBJECT_APPLE 0x8A53 +#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111 +#define GL_OBJECT_TYPE_APPLE 0x9112 +#define GL_SYNC_CONDITION_APPLE 0x9113 +#define GL_SYNC_STATUS_APPLE 0x9114 +#define GL_SYNC_FLAGS_APPLE 0x9115 +#define GL_SYNC_FENCE_APPLE 0x9116 +#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117 +#define GL_UNSIGNALED_APPLE 0x9118 +#define GL_SIGNALED_APPLE 0x9119 +#define GL_ALREADY_SIGNALED_APPLE 0x911A +#define GL_TIMEOUT_EXPIRED_APPLE 0x911B +#define GL_CONDITION_SATISFIED_APPLE 0x911C +#define GL_WAIT_FAILED_APPLE 0x911D +#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001 +#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull +typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags); +typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync); +typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync); +typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); +typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params); +typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags); +GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync); +GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync); +GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); +GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); +GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params); +GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); +#endif +#endif /* GL_APPLE_sync */ + +#ifndef GL_APPLE_texture_format_BGRA8888 +#define GL_APPLE_texture_format_BGRA8888 1 +#define GL_BGRA_EXT 0x80E1 +#define GL_BGRA8_EXT 0x93A1 +#endif /* GL_APPLE_texture_format_BGRA8888 */ + +#ifndef GL_APPLE_texture_max_level +#define GL_APPLE_texture_max_level 1 +#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D +#endif /* GL_APPLE_texture_max_level */ + +#ifndef GL_APPLE_texture_packed_float +#define GL_APPLE_texture_packed_float 1 +#define GL_UNSIGNED_INT_10F_11F_11F_REV_APPLE 0x8C3B +#define GL_UNSIGNED_INT_5_9_9_9_REV_APPLE 0x8C3E +#define GL_R11F_G11F_B10F_APPLE 0x8C3A +#define GL_RGB9_E5_APPLE 0x8C3D +#endif /* GL_APPLE_texture_packed_float */ + +#ifndef GL_ARM_mali_program_binary +#define GL_ARM_mali_program_binary 1 +#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61 +#endif /* GL_ARM_mali_program_binary */ + +#ifndef GL_ARM_mali_shader_binary +#define GL_ARM_mali_shader_binary 1 +#define GL_MALI_SHADER_BINARY_ARM 0x8F60 +#endif /* GL_ARM_mali_shader_binary */ + +#ifndef GL_ARM_rgba8 +#define GL_ARM_rgba8 1 +#endif /* GL_ARM_rgba8 */ + +#ifndef GL_ARM_shader_framebuffer_fetch +#define GL_ARM_shader_framebuffer_fetch 1 +#define GL_FETCH_PER_SAMPLE_ARM 0x8F65 +#define GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM 0x8F66 +#endif /* GL_ARM_shader_framebuffer_fetch */ + +#ifndef GL_ARM_shader_framebuffer_fetch_depth_stencil +#define GL_ARM_shader_framebuffer_fetch_depth_stencil 1 +#endif /* GL_ARM_shader_framebuffer_fetch_depth_stencil */ + +#ifndef GL_DMP_program_binary +#define GL_DMP_program_binary 1 +#define GL_SMAPHS30_PROGRAM_BINARY_DMP 0x9251 +#define GL_SMAPHS_PROGRAM_BINARY_DMP 0x9252 +#define GL_DMP_PROGRAM_BINARY_DMP 0x9253 +#endif /* GL_DMP_program_binary */ + +#ifndef GL_DMP_shader_binary +#define GL_DMP_shader_binary 1 +#define GL_SHADER_BINARY_DMP 0x9250 +#endif /* GL_DMP_shader_binary */ + +#ifndef GL_EXT_EGL_image_array +#define GL_EXT_EGL_image_array 1 +#endif /* GL_EXT_EGL_image_array */ + +#ifndef GL_EXT_YUV_target +#define GL_EXT_YUV_target 1 +#define GL_SAMPLER_EXTERNAL_2D_Y2Y_EXT 0x8BE7 +#endif /* GL_EXT_YUV_target */ + +#ifndef GL_EXT_base_instance +#define GL_EXT_base_instance 1 +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEEXTPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedBaseInstanceEXT (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseInstanceEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexBaseInstanceEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance); +#endif +#endif /* GL_EXT_base_instance */ + +#ifndef GL_EXT_blend_func_extended +#define GL_EXT_blend_func_extended 1 +#define GL_SRC1_COLOR_EXT 0x88F9 +#define GL_SRC1_ALPHA_EXT 0x8589 +#define GL_ONE_MINUS_SRC1_COLOR_EXT 0x88FA +#define GL_ONE_MINUS_SRC1_ALPHA_EXT 0x88FB +#define GL_SRC_ALPHA_SATURATE_EXT 0x0308 +#define GL_LOCATION_INDEX_EXT 0x930F +#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT 0x88FC +typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDEXTPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name); +typedef GLint (GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXEXTPROC) (GLuint program, GLenum programInterface, const GLchar *name); +typedef GLint (GL_APIENTRYP PFNGLGETFRAGDATAINDEXEXTPROC) (GLuint program, const GLchar *name); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBindFragDataLocationIndexedEXT (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name); +GL_APICALL void GL_APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name); +GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocationIndexEXT (GLuint program, GLenum programInterface, const GLchar *name); +GL_APICALL GLint GL_APIENTRY glGetFragDataIndexEXT (GLuint program, const GLchar *name); +#endif +#endif /* GL_EXT_blend_func_extended */ + +#ifndef GL_EXT_blend_minmax +#define GL_EXT_blend_minmax 1 +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#endif /* GL_EXT_blend_minmax */ + +#ifndef GL_EXT_buffer_storage +#define GL_EXT_buffer_storage 1 +#define GL_MAP_READ_BIT 0x0001 +#define GL_MAP_WRITE_BIT 0x0002 +#define GL_MAP_PERSISTENT_BIT_EXT 0x0040 +#define GL_MAP_COHERENT_BIT_EXT 0x0080 +#define GL_DYNAMIC_STORAGE_BIT_EXT 0x0100 +#define GL_CLIENT_STORAGE_BIT_EXT 0x0200 +#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT_EXT 0x00004000 +#define GL_BUFFER_IMMUTABLE_STORAGE_EXT 0x821F +#define GL_BUFFER_STORAGE_FLAGS_EXT 0x8220 +typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEEXTPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBufferStorageEXT (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags); +#endif +#endif /* GL_EXT_buffer_storage */ + +#ifndef GL_EXT_clear_texture +#define GL_EXT_clear_texture 1 +typedef void (GL_APIENTRYP PFNGLCLEARTEXIMAGEEXTPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +typedef void (GL_APIENTRYP PFNGLCLEARTEXSUBIMAGEEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glClearTexImageEXT (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); +GL_APICALL void GL_APIENTRY glClearTexSubImageEXT (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); +#endif +#endif /* GL_EXT_clear_texture */ + +#ifndef GL_EXT_clip_control +#define GL_EXT_clip_control 1 +#define GL_LOWER_LEFT_EXT 0x8CA1 +#define GL_UPPER_LEFT_EXT 0x8CA2 +#define GL_NEGATIVE_ONE_TO_ONE_EXT 0x935E +#define GL_ZERO_TO_ONE_EXT 0x935F +#define GL_CLIP_ORIGIN_EXT 0x935C +#define GL_CLIP_DEPTH_MODE_EXT 0x935D +typedef void (GL_APIENTRYP PFNGLCLIPCONTROLEXTPROC) (GLenum origin, GLenum depth); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glClipControlEXT (GLenum origin, GLenum depth); +#endif +#endif /* GL_EXT_clip_control */ + +#ifndef GL_EXT_clip_cull_distance +#define GL_EXT_clip_cull_distance 1 +#define GL_MAX_CLIP_DISTANCES_EXT 0x0D32 +#define GL_MAX_CULL_DISTANCES_EXT 0x82F9 +#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES_EXT 0x82FA +#define GL_CLIP_DISTANCE0_EXT 0x3000 +#define GL_CLIP_DISTANCE1_EXT 0x3001 +#define GL_CLIP_DISTANCE2_EXT 0x3002 +#define GL_CLIP_DISTANCE3_EXT 0x3003 +#define GL_CLIP_DISTANCE4_EXT 0x3004 +#define GL_CLIP_DISTANCE5_EXT 0x3005 +#define GL_CLIP_DISTANCE6_EXT 0x3006 +#define GL_CLIP_DISTANCE7_EXT 0x3007 +#endif /* GL_EXT_clip_cull_distance */ + +#ifndef GL_EXT_color_buffer_float +#define GL_EXT_color_buffer_float 1 +#endif /* GL_EXT_color_buffer_float */ + +#ifndef GL_EXT_color_buffer_half_float +#define GL_EXT_color_buffer_half_float 1 +#define GL_RGBA16F_EXT 0x881A +#define GL_RGB16F_EXT 0x881B +#define GL_RG16F_EXT 0x822F +#define GL_R16F_EXT 0x822D +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211 +#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17 +#endif /* GL_EXT_color_buffer_half_float */ + +#ifndef GL_EXT_conservative_depth +#define GL_EXT_conservative_depth 1 +#endif /* GL_EXT_conservative_depth */ + +#ifndef GL_EXT_copy_image +#define GL_EXT_copy_image 1 +typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAEXTPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCopyImageSubDataEXT (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); +#endif +#endif /* GL_EXT_copy_image */ + +#ifndef GL_EXT_debug_label +#define GL_EXT_debug_label 1 +#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F +#define GL_PROGRAM_OBJECT_EXT 0x8B40 +#define GL_SHADER_OBJECT_EXT 0x8B48 +#define GL_BUFFER_OBJECT_EXT 0x9151 +#define GL_QUERY_OBJECT_EXT 0x9153 +#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 +#define GL_TRANSFORM_FEEDBACK 0x8E22 +typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label); +GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif +#endif /* GL_EXT_debug_label */ + +#ifndef GL_EXT_debug_marker +#define GL_EXT_debug_marker 1 +typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker); +GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker); +GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void); +#endif +#endif /* GL_EXT_debug_marker */ + +#ifndef GL_EXT_discard_framebuffer +#define GL_EXT_discard_framebuffer 1 +#define GL_COLOR_EXT 0x1800 +#define GL_DEPTH_EXT 0x1801 +#define GL_STENCIL_EXT 0x1802 +typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments); +#endif +#endif /* GL_EXT_discard_framebuffer */ + +#ifndef GL_EXT_disjoint_timer_query +#define GL_EXT_disjoint_timer_query 1 +#define GL_QUERY_COUNTER_BITS_EXT 0x8864 +#define GL_CURRENT_QUERY_EXT 0x8865 +#define GL_QUERY_RESULT_EXT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 +#define GL_TIME_ELAPSED_EXT 0x88BF +#define GL_TIMESTAMP_EXT 0x8E28 +#define GL_GPU_DISJOINT_EXT 0x8FBB +typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids); +typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id); +typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id); +typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target); +typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids); +GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids); +GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id); +GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id); +GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target); +GL_APICALL void GL_APIENTRY glQueryCounterEXT (GLuint id, GLenum target); +GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetQueryObjectivEXT (GLuint id, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params); +GL_APICALL void GL_APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params); +GL_APICALL void GL_APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params); +#endif +#endif /* GL_EXT_disjoint_timer_query */ + +#ifndef GL_EXT_draw_buffers +#define GL_EXT_draw_buffers 1 +#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF +#define GL_MAX_DRAW_BUFFERS_EXT 0x8824 +#define GL_DRAW_BUFFER0_EXT 0x8825 +#define GL_DRAW_BUFFER1_EXT 0x8826 +#define GL_DRAW_BUFFER2_EXT 0x8827 +#define GL_DRAW_BUFFER3_EXT 0x8828 +#define GL_DRAW_BUFFER4_EXT 0x8829 +#define GL_DRAW_BUFFER5_EXT 0x882A +#define GL_DRAW_BUFFER6_EXT 0x882B +#define GL_DRAW_BUFFER7_EXT 0x882C +#define GL_DRAW_BUFFER8_EXT 0x882D +#define GL_DRAW_BUFFER9_EXT 0x882E +#define GL_DRAW_BUFFER10_EXT 0x882F +#define GL_DRAW_BUFFER11_EXT 0x8830 +#define GL_DRAW_BUFFER12_EXT 0x8831 +#define GL_DRAW_BUFFER13_EXT 0x8832 +#define GL_DRAW_BUFFER14_EXT 0x8833 +#define GL_DRAW_BUFFER15_EXT 0x8834 +#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 +#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 +#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 +#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 +#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 +#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 +#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 +#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 +#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 +#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 +#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA +#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB +#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC +#define GL_COLOR_ATTACHMENT13_EXT 0x8CED +#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE +#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF +typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs); +#endif +#endif /* GL_EXT_draw_buffers */ + +#ifndef GL_EXT_draw_buffers_indexed +#define GL_EXT_draw_buffers_indexed 1 +typedef void (GL_APIENTRYP PFNGLENABLEIEXTPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLDISABLEIEXTPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIEXTPROC) (GLuint buf, GLenum mode); +typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIEXTPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCIEXTPROC) (GLuint buf, GLenum src, GLenum dst); +typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIEXTPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +typedef void (GL_APIENTRYP PFNGLCOLORMASKIEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIEXTPROC) (GLenum target, GLuint index); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glEnableiEXT (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glDisableiEXT (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glBlendEquationiEXT (GLuint buf, GLenum mode); +GL_APICALL void GL_APIENTRY glBlendEquationSeparateiEXT (GLuint buf, GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunciEXT (GLuint buf, GLenum src, GLenum dst); +GL_APICALL void GL_APIENTRY glBlendFuncSeparateiEXT (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GL_APICALL void GL_APIENTRY glColorMaskiEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); +GL_APICALL GLboolean GL_APIENTRY glIsEnablediEXT (GLenum target, GLuint index); +#endif +#endif /* GL_EXT_draw_buffers_indexed */ + +#ifndef GL_EXT_draw_elements_base_vertex +#define GL_EXT_draw_elements_base_vertex 1 +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawElementsBaseVertexEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GL_APICALL void GL_APIENTRY glDrawRangeElementsBaseVertexEXT (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex); +#endif +#endif /* GL_EXT_draw_elements_base_vertex */ + +#ifndef GL_EXT_draw_instanced +#define GL_EXT_draw_instanced 1 +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#endif +#endif /* GL_EXT_draw_instanced */ + +#ifndef GL_EXT_draw_transform_feedback +#define GL_EXT_draw_transform_feedback 1 +typedef void (GL_APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKEXTPROC) (GLenum mode, GLuint id); +typedef void (GL_APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDEXTPROC) (GLenum mode, GLuint id, GLsizei instancecount); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawTransformFeedbackEXT (GLenum mode, GLuint id); +GL_APICALL void GL_APIENTRY glDrawTransformFeedbackInstancedEXT (GLenum mode, GLuint id, GLsizei instancecount); +#endif +#endif /* GL_EXT_draw_transform_feedback */ + +#ifndef GL_EXT_external_buffer +#define GL_EXT_external_buffer 1 +typedef void *GLeglClientBufferEXT; +typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEEXTERNALEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERSTORAGEEXTERNALEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBufferStorageExternalEXT (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +GL_APICALL void GL_APIENTRY glNamedBufferStorageExternalEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags); +#endif +#endif /* GL_EXT_external_buffer */ + +#ifndef GL_EXT_float_blend +#define GL_EXT_float_blend 1 +#endif /* GL_EXT_float_blend */ + +#ifndef GL_EXT_geometry_point_size +#define GL_EXT_geometry_point_size 1 +#endif /* GL_EXT_geometry_point_size */ + +#ifndef GL_EXT_geometry_shader +#define GL_EXT_geometry_shader 1 +#define GL_GEOMETRY_SHADER_EXT 0x8DD9 +#define GL_GEOMETRY_SHADER_BIT_EXT 0x00000004 +#define GL_GEOMETRY_LINKED_VERTICES_OUT_EXT 0x8916 +#define GL_GEOMETRY_LINKED_INPUT_TYPE_EXT 0x8917 +#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT 0x8918 +#define GL_GEOMETRY_SHADER_INVOCATIONS_EXT 0x887F +#define GL_LAYER_PROVOKING_VERTEX_EXT 0x825E +#define GL_LINES_ADJACENCY_EXT 0x000A +#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B +#define GL_TRIANGLES_ADJACENCY_EXT 0x000C +#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D +#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF +#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT 0x8A2C +#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8A32 +#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT 0x9123 +#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT 0x9124 +#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 +#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 +#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT 0x8E5A +#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 +#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT 0x92CF +#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT 0x92D5 +#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT 0x90CD +#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT 0x90D7 +#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D +#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E +#define GL_UNDEFINED_VERTEX_EXT 0x8260 +#define GL_PRIMITIVES_GENERATED_EXT 0x8C87 +#define GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT 0x9312 +#define GL_MAX_FRAMEBUFFER_LAYERS_EXT 0x9317 +#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 +#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 +#define GL_REFERENCED_BY_GEOMETRY_SHADER_EXT 0x9309 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level); +#endif +#endif /* GL_EXT_geometry_shader */ + +#ifndef GL_EXT_gpu_shader5 +#define GL_EXT_gpu_shader5 1 +#endif /* GL_EXT_gpu_shader5 */ + +#ifndef GL_EXT_instanced_arrays +#define GL_EXT_instanced_arrays 1 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_EXT 0x88FE +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTPROC) (GLuint index, GLuint divisor); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glVertexAttribDivisorEXT (GLuint index, GLuint divisor); +#endif +#endif /* GL_EXT_instanced_arrays */ + +#ifndef GL_EXT_map_buffer_range +#define GL_EXT_map_buffer_range 1 +#define GL_MAP_READ_BIT_EXT 0x0001 +#define GL_MAP_WRITE_BIT_EXT 0x0002 +#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004 +#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008 +#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010 +#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020 +typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void *GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length); +#endif +#endif /* GL_EXT_map_buffer_range */ + +#ifndef GL_EXT_memory_object +#define GL_EXT_memory_object 1 +#define GL_TEXTURE_TILING_EXT 0x9580 +#define GL_DEDICATED_MEMORY_OBJECT_EXT 0x9581 +#define GL_PROTECTED_MEMORY_OBJECT_EXT 0x959B +#define GL_NUM_TILING_TYPES_EXT 0x9582 +#define GL_TILING_TYPES_EXT 0x9583 +#define GL_OPTIMAL_TILING_EXT 0x9584 +#define GL_LINEAR_TILING_EXT 0x9585 +#define GL_NUM_DEVICE_UUIDS_EXT 0x9596 +#define GL_DEVICE_UUID_EXT 0x9597 +#define GL_DRIVER_UUID_EXT 0x9598 +#define GL_UUID_SIZE_EXT 16 +typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEVEXTPROC) (GLenum pname, GLubyte *data); +typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEI_VEXTPROC) (GLenum target, GLuint index, GLubyte *data); +typedef void (GL_APIENTRYP PFNGLDELETEMEMORYOBJECTSEXTPROC) (GLsizei n, const GLuint *memoryObjects); +typedef GLboolean (GL_APIENTRYP PFNGLISMEMORYOBJECTEXTPROC) (GLuint memoryObject); +typedef void (GL_APIENTRYP PFNGLCREATEMEMORYOBJECTSEXTPROC) (GLsizei n, GLuint *memoryObjects); +typedef void (GL_APIENTRYP PFNGLMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLGETMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEMEMEXTPROC) (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM2DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM2DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM3DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM3DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERSTORAGEMEMEXTPROC) (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetUnsignedBytevEXT (GLenum pname, GLubyte *data); +GL_APICALL void GL_APIENTRY glGetUnsignedBytei_vEXT (GLenum target, GLuint index, GLubyte *data); +GL_APICALL void GL_APIENTRY glDeleteMemoryObjectsEXT (GLsizei n, const GLuint *memoryObjects); +GL_APICALL GLboolean GL_APIENTRY glIsMemoryObjectEXT (GLuint memoryObject); +GL_APICALL void GL_APIENTRY glCreateMemoryObjectsEXT (GLsizei n, GLuint *memoryObjects); +GL_APICALL void GL_APIENTRY glMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glGetMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glTexStorageMem2DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTexStorageMem2DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTexStorageMem3DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTexStorageMem3DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glBufferStorageMemEXT (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTextureStorageMem2DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTextureStorageMem2DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTextureStorageMem3DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glTextureStorageMem3DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset); +GL_APICALL void GL_APIENTRY glNamedBufferStorageMemEXT (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset); +#endif +#endif /* GL_EXT_memory_object */ + +#ifndef GL_EXT_memory_object_fd +#define GL_EXT_memory_object_fd 1 +#define GL_HANDLE_TYPE_OPAQUE_FD_EXT 0x9586 +typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYFDEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, GLint fd); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glImportMemoryFdEXT (GLuint memory, GLuint64 size, GLenum handleType, GLint fd); +#endif +#endif /* GL_EXT_memory_object_fd */ + +#ifndef GL_EXT_memory_object_win32 +#define GL_EXT_memory_object_win32 1 +#define GL_HANDLE_TYPE_OPAQUE_WIN32_EXT 0x9587 +#define GL_HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT 0x9588 +#define GL_DEVICE_LUID_EXT 0x9599 +#define GL_DEVICE_NODE_MASK_EXT 0x959A +#define GL_LUID_SIZE_EXT 8 +#define GL_HANDLE_TYPE_D3D12_TILEPOOL_EXT 0x9589 +#define GL_HANDLE_TYPE_D3D12_RESOURCE_EXT 0x958A +#define GL_HANDLE_TYPE_D3D11_IMAGE_EXT 0x958B +#define GL_HANDLE_TYPE_D3D11_IMAGE_KMT_EXT 0x958C +typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYWIN32HANDLEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, void *handle); +typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYWIN32NAMEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, const void *name); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glImportMemoryWin32HandleEXT (GLuint memory, GLuint64 size, GLenum handleType, void *handle); +GL_APICALL void GL_APIENTRY glImportMemoryWin32NameEXT (GLuint memory, GLuint64 size, GLenum handleType, const void *name); +#endif +#endif /* GL_EXT_memory_object_win32 */ + +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount); +#endif +#endif /* GL_EXT_multi_draw_arrays */ + +#ifndef GL_EXT_multi_draw_indirect +#define GL_EXT_multi_draw_indirect 1 +typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTEXTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTEXTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMultiDrawArraysIndirectEXT (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride); +GL_APICALL void GL_APIENTRY glMultiDrawElementsIndirectEXT (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride); +#endif +#endif /* GL_EXT_multi_draw_indirect */ + +#ifndef GL_EXT_multisampled_compatibility +#define GL_EXT_multisampled_compatibility 1 +#define GL_MULTISAMPLE_EXT 0x809D +#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F +#endif /* GL_EXT_multisampled_compatibility */ + +#ifndef GL_EXT_multisampled_render_to_texture +#define GL_EXT_multisampled_render_to_texture 1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C +#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 +#define GL_MAX_SAMPLES_EXT 0x8D57 +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif +#endif /* GL_EXT_multisampled_render_to_texture */ + +#ifndef GL_EXT_multiview_draw_buffers +#define GL_EXT_multiview_draw_buffers 1 +#define GL_COLOR_ATTACHMENT_EXT 0x90F0 +#define GL_MULTIVIEW_EXT 0x90F1 +#define GL_DRAW_BUFFER_EXT 0x0C01 +#define GL_READ_BUFFER_EXT 0x0C02 +#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2 +typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index); +typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices); +typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glReadBufferIndexedEXT (GLenum src, GLint index); +GL_APICALL void GL_APIENTRY glDrawBuffersIndexedEXT (GLint n, const GLenum *location, const GLint *indices); +GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLint *data); +#endif +#endif /* GL_EXT_multiview_draw_buffers */ + +#ifndef GL_EXT_occlusion_query_boolean +#define GL_EXT_occlusion_query_boolean 1 +#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A +#endif /* GL_EXT_occlusion_query_boolean */ + +#ifndef GL_EXT_polygon_offset_clamp +#define GL_EXT_polygon_offset_clamp 1 +#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B +typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETCLAMPEXTPROC) (GLfloat factor, GLfloat units, GLfloat clamp); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPolygonOffsetClampEXT (GLfloat factor, GLfloat units, GLfloat clamp); +#endif +#endif /* GL_EXT_polygon_offset_clamp */ + +#ifndef GL_EXT_post_depth_coverage +#define GL_EXT_post_depth_coverage 1 +#endif /* GL_EXT_post_depth_coverage */ + +#ifndef GL_EXT_primitive_bounding_box +#define GL_EXT_primitive_bounding_box 1 +#define GL_PRIMITIVE_BOUNDING_BOX_EXT 0x92BE +typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXEXTPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxEXT (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +#endif +#endif /* GL_EXT_primitive_bounding_box */ + +#ifndef GL_EXT_protected_textures +#define GL_EXT_protected_textures 1 +#define GL_CONTEXT_FLAG_PROTECTED_CONTENT_BIT_EXT 0x00000010 +#define GL_TEXTURE_PROTECTED_EXT 0x8BFA +#endif /* GL_EXT_protected_textures */ + +#ifndef GL_EXT_pvrtc_sRGB +#define GL_EXT_pvrtc_sRGB 1 +#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54 +#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0 +#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1 +#endif /* GL_EXT_pvrtc_sRGB */ + +#ifndef GL_EXT_raster_multisample +#define GL_EXT_raster_multisample 1 +#define GL_RASTER_MULTISAMPLE_EXT 0x9327 +#define GL_RASTER_SAMPLES_EXT 0x9328 +#define GL_MAX_RASTER_SAMPLES_EXT 0x9329 +#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A +#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B +#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C +typedef void (GL_APIENTRYP PFNGLRASTERSAMPLESEXTPROC) (GLuint samples, GLboolean fixedsamplelocations); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRasterSamplesEXT (GLuint samples, GLboolean fixedsamplelocations); +#endif +#endif /* GL_EXT_raster_multisample */ + +#ifndef GL_EXT_read_format_bgra +#define GL_EXT_read_format_bgra 1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 +#endif /* GL_EXT_read_format_bgra */ + +#ifndef GL_EXT_render_snorm +#define GL_EXT_render_snorm 1 +#define GL_R8_SNORM 0x8F94 +#define GL_RG8_SNORM 0x8F95 +#define GL_RGBA8_SNORM 0x8F97 +#define GL_R16_SNORM_EXT 0x8F98 +#define GL_RG16_SNORM_EXT 0x8F99 +#define GL_RGBA16_SNORM_EXT 0x8F9B +#endif /* GL_EXT_render_snorm */ + +#ifndef GL_EXT_robustness +#define GL_EXT_robustness 1 +#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255 +#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3 +#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256 +#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252 +#define GL_NO_RESET_NOTIFICATION_EXT 0x8261 +typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void); +typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void); +GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params); +#endif +#endif /* GL_EXT_robustness */ + +#ifndef GL_EXT_sRGB +#define GL_EXT_sRGB 1 +#define GL_SRGB_EXT 0x8C40 +#define GL_SRGB_ALPHA_EXT 0x8C42 +#define GL_SRGB8_ALPHA8_EXT 0x8C43 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 +#endif /* GL_EXT_sRGB */ + +#ifndef GL_EXT_sRGB_write_control +#define GL_EXT_sRGB_write_control 1 +#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 +#endif /* GL_EXT_sRGB_write_control */ + +#ifndef GL_EXT_semaphore +#define GL_EXT_semaphore 1 +#define GL_LAYOUT_GENERAL_EXT 0x958D +#define GL_LAYOUT_COLOR_ATTACHMENT_EXT 0x958E +#define GL_LAYOUT_DEPTH_STENCIL_ATTACHMENT_EXT 0x958F +#define GL_LAYOUT_DEPTH_STENCIL_READ_ONLY_EXT 0x9590 +#define GL_LAYOUT_SHADER_READ_ONLY_EXT 0x9591 +#define GL_LAYOUT_TRANSFER_SRC_EXT 0x9592 +#define GL_LAYOUT_TRANSFER_DST_EXT 0x9593 +typedef void (GL_APIENTRYP PFNGLGENSEMAPHORESEXTPROC) (GLsizei n, GLuint *semaphores); +typedef void (GL_APIENTRYP PFNGLDELETESEMAPHORESEXTPROC) (GLsizei n, const GLuint *semaphores); +typedef GLboolean (GL_APIENTRYP PFNGLISSEMAPHOREEXTPROC) (GLuint semaphore); +typedef void (GL_APIENTRYP PFNGLSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, const GLuint64 *params); +typedef void (GL_APIENTRYP PFNGLGETSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, GLuint64 *params); +typedef void (GL_APIENTRYP PFNGLWAITSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts); +typedef void (GL_APIENTRYP PFNGLSIGNALSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGenSemaphoresEXT (GLsizei n, GLuint *semaphores); +GL_APICALL void GL_APIENTRY glDeleteSemaphoresEXT (GLsizei n, const GLuint *semaphores); +GL_APICALL GLboolean GL_APIENTRY glIsSemaphoreEXT (GLuint semaphore); +GL_APICALL void GL_APIENTRY glSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, const GLuint64 *params); +GL_APICALL void GL_APIENTRY glGetSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, GLuint64 *params); +GL_APICALL void GL_APIENTRY glWaitSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts); +GL_APICALL void GL_APIENTRY glSignalSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts); +#endif +#endif /* GL_EXT_semaphore */ + +#ifndef GL_EXT_semaphore_fd +#define GL_EXT_semaphore_fd 1 +typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREFDEXTPROC) (GLuint semaphore, GLenum handleType, GLint fd); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glImportSemaphoreFdEXT (GLuint semaphore, GLenum handleType, GLint fd); +#endif +#endif /* GL_EXT_semaphore_fd */ + +#ifndef GL_EXT_semaphore_win32 +#define GL_EXT_semaphore_win32 1 +#define GL_HANDLE_TYPE_D3D12_FENCE_EXT 0x9594 +#define GL_D3D12_FENCE_VALUE_EXT 0x9595 +typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREWIN32HANDLEEXTPROC) (GLuint semaphore, GLenum handleType, void *handle); +typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREWIN32NAMEEXTPROC) (GLuint semaphore, GLenum handleType, const void *name); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glImportSemaphoreWin32HandleEXT (GLuint semaphore, GLenum handleType, void *handle); +GL_APICALL void GL_APIENTRY glImportSemaphoreWin32NameEXT (GLuint semaphore, GLenum handleType, const void *name); +#endif +#endif /* GL_EXT_semaphore_win32 */ + +#ifndef GL_EXT_separate_shader_objects +#define GL_EXT_separate_shader_objects 1 +#define GL_ACTIVE_PROGRAM_EXT 0x8259 +#define GL_VERTEX_SHADER_BIT_EXT 0x00000001 +#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002 +#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF +#define GL_PROGRAM_SEPARABLE_EXT 0x8258 +#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A +typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program); +typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings); +typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines); +typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params); +typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program); +typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program); +GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline); +GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings); +GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines); +GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines); +GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params); +GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline); +GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value); +GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0); +GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0); +GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1); +GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1); +GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program); +GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline); +GL_APICALL void GL_APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0); +GL_APICALL void GL_APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1); +GL_APICALL void GL_APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +GL_APICALL void GL_APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +GL_APICALL void GL_APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#endif +#endif /* GL_EXT_separate_shader_objects */ + +#ifndef GL_EXT_shader_framebuffer_fetch +#define GL_EXT_shader_framebuffer_fetch 1 +#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52 +#endif /* GL_EXT_shader_framebuffer_fetch */ + +#ifndef GL_EXT_shader_group_vote +#define GL_EXT_shader_group_vote 1 +#endif /* GL_EXT_shader_group_vote */ + +#ifndef GL_EXT_shader_implicit_conversions +#define GL_EXT_shader_implicit_conversions 1 +#endif /* GL_EXT_shader_implicit_conversions */ + +#ifndef GL_EXT_shader_integer_mix +#define GL_EXT_shader_integer_mix 1 +#endif /* GL_EXT_shader_integer_mix */ + +#ifndef GL_EXT_shader_io_blocks +#define GL_EXT_shader_io_blocks 1 +#endif /* GL_EXT_shader_io_blocks */ + +#ifndef GL_EXT_shader_non_constant_global_initializers +#define GL_EXT_shader_non_constant_global_initializers 1 +#endif /* GL_EXT_shader_non_constant_global_initializers */ + +#ifndef GL_EXT_shader_pixel_local_storage +#define GL_EXT_shader_pixel_local_storage 1 +#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT 0x8F63 +#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT 0x8F67 +#define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT 0x8F64 +#endif /* GL_EXT_shader_pixel_local_storage */ + +#ifndef GL_EXT_shader_pixel_local_storage2 +#define GL_EXT_shader_pixel_local_storage2 1 +#define GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_FAST_SIZE_EXT 0x9650 +#define GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_SIZE_EXT 0x9651 +#define GL_FRAMEBUFFER_INCOMPLETE_INSUFFICIENT_SHADER_COMBINED_LOCAL_STORAGE_EXT 0x9652 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC) (GLuint target, GLsizei size); +typedef GLsizei (GL_APIENTRYP PFNGLGETFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC) (GLuint target); +typedef void (GL_APIENTRYP PFNGLCLEARPIXELLOCALSTORAGEUIEXTPROC) (GLsizei offset, GLsizei n, const GLuint *values); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferPixelLocalStorageSizeEXT (GLuint target, GLsizei size); +GL_APICALL GLsizei GL_APIENTRY glGetFramebufferPixelLocalStorageSizeEXT (GLuint target); +GL_APICALL void GL_APIENTRY glClearPixelLocalStorageuiEXT (GLsizei offset, GLsizei n, const GLuint *values); +#endif +#endif /* GL_EXT_shader_pixel_local_storage2 */ + +#ifndef GL_EXT_shader_texture_lod +#define GL_EXT_shader_texture_lod 1 +#endif /* GL_EXT_shader_texture_lod */ + +#ifndef GL_EXT_shadow_samplers +#define GL_EXT_shadow_samplers 1 +#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C +#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D +#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E +#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62 +#endif /* GL_EXT_shadow_samplers */ + +#ifndef GL_EXT_sparse_texture +#define GL_EXT_sparse_texture 1 +#define GL_TEXTURE_SPARSE_EXT 0x91A6 +#define GL_VIRTUAL_PAGE_SIZE_INDEX_EXT 0x91A7 +#define GL_NUM_SPARSE_LEVELS_EXT 0x91AA +#define GL_NUM_VIRTUAL_PAGE_SIZES_EXT 0x91A8 +#define GL_VIRTUAL_PAGE_SIZE_X_EXT 0x9195 +#define GL_VIRTUAL_PAGE_SIZE_Y_EXT 0x9196 +#define GL_VIRTUAL_PAGE_SIZE_Z_EXT 0x9197 +#define GL_TEXTURE_2D_ARRAY 0x8C1A +#define GL_TEXTURE_3D 0x806F +#define GL_MAX_SPARSE_TEXTURE_SIZE_EXT 0x9198 +#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_EXT 0x9199 +#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_EXT 0x919A +#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_EXT 0x91A9 +typedef void (GL_APIENTRYP PFNGLTEXPAGECOMMITMENTEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexPageCommitmentEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit); +#endif +#endif /* GL_EXT_sparse_texture */ + +#ifndef GL_EXT_sparse_texture2 +#define GL_EXT_sparse_texture2 1 +#endif /* GL_EXT_sparse_texture2 */ + +#ifndef GL_EXT_tessellation_point_size +#define GL_EXT_tessellation_point_size 1 +#endif /* GL_EXT_tessellation_point_size */ + +#ifndef GL_EXT_tessellation_shader +#define GL_EXT_tessellation_shader 1 +#define GL_PATCHES_EXT 0x000E +#define GL_PATCH_VERTICES_EXT 0x8E72 +#define GL_TESS_CONTROL_OUTPUT_VERTICES_EXT 0x8E75 +#define GL_TESS_GEN_MODE_EXT 0x8E76 +#define GL_TESS_GEN_SPACING_EXT 0x8E77 +#define GL_TESS_GEN_VERTEX_ORDER_EXT 0x8E78 +#define GL_TESS_GEN_POINT_MODE_EXT 0x8E79 +#define GL_ISOLINES_EXT 0x8E7A +#define GL_QUADS_EXT 0x0007 +#define GL_FRACTIONAL_ODD_EXT 0x8E7B +#define GL_FRACTIONAL_EVEN_EXT 0x8E7C +#define GL_MAX_PATCH_VERTICES_EXT 0x8E7D +#define GL_MAX_TESS_GEN_LEVEL_EXT 0x8E7E +#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E7F +#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E80 +#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT 0x8E81 +#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT 0x8E82 +#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT 0x8E83 +#define GL_MAX_TESS_PATCH_COMPONENTS_EXT 0x8E84 +#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT 0x8E85 +#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT 0x8E86 +#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT 0x8E89 +#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT 0x8E8A +#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT 0x886C +#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT 0x886D +#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E1E +#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E1F +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT 0x92CD +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT 0x92CE +#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT 0x92D3 +#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT 0x92D4 +#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT 0x90CB +#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT 0x90CC +#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT 0x90D8 +#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT 0x90D9 +#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221 +#define GL_IS_PER_PATCH_EXT 0x92E7 +#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT 0x9307 +#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT 0x9308 +#define GL_TESS_CONTROL_SHADER_EXT 0x8E88 +#define GL_TESS_EVALUATION_SHADER_EXT 0x8E87 +#define GL_TESS_CONTROL_SHADER_BIT_EXT 0x00000008 +#define GL_TESS_EVALUATION_SHADER_BIT_EXT 0x00000010 +typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIEXTPROC) (GLenum pname, GLint value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPatchParameteriEXT (GLenum pname, GLint value); +#endif +#endif /* GL_EXT_tessellation_shader */ + +#ifndef GL_EXT_texture_border_clamp +#define GL_EXT_texture_border_clamp 1 +#define GL_TEXTURE_BORDER_COLOR_EXT 0x1004 +#define GL_CLAMP_TO_BORDER_EXT 0x812D +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); +typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, const GLint *param); +typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, const GLuint *param); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, GLuint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params); +GL_APICALL void GL_APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params); +GL_APICALL void GL_APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params); +GL_APICALL void GL_APIENTRY glSamplerParameterIivEXT (GLuint sampler, GLenum pname, const GLint *param); +GL_APICALL void GL_APIENTRY glSamplerParameterIuivEXT (GLuint sampler, GLenum pname, const GLuint *param); +GL_APICALL void GL_APIENTRY glGetSamplerParameterIivEXT (GLuint sampler, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivEXT (GLuint sampler, GLenum pname, GLuint *params); +#endif +#endif /* GL_EXT_texture_border_clamp */ + +#ifndef GL_EXT_texture_buffer +#define GL_EXT_texture_buffer 1 +#define GL_TEXTURE_BUFFER_EXT 0x8C2A +#define GL_TEXTURE_BUFFER_BINDING_EXT 0x8C2A +#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B +#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C +#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D +#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT 0x919F +#define GL_SAMPLER_BUFFER_EXT 0x8DC2 +#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 +#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 +#define GL_IMAGE_BUFFER_EXT 0x9051 +#define GL_INT_IMAGE_BUFFER_EXT 0x905C +#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067 +#define GL_TEXTURE_BUFFER_OFFSET_EXT 0x919D +#define GL_TEXTURE_BUFFER_SIZE_EXT 0x919E +typedef void (GL_APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer); +typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEEXTPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer); +GL_APICALL void GL_APIENTRY glTexBufferRangeEXT (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +#endif +#endif /* GL_EXT_texture_buffer */ + +#ifndef GL_EXT_texture_compression_astc_decode_mode +#define GL_EXT_texture_compression_astc_decode_mode 1 +#define GL_TEXTURE_ASTC_DECODE_PRECISION_EXT 0x8F69 +#endif /* GL_EXT_texture_compression_astc_decode_mode */ + +#ifndef GL_EXT_texture_compression_bptc +#define GL_EXT_texture_compression_bptc 1 +#define GL_COMPRESSED_RGBA_BPTC_UNORM_EXT 0x8E8C +#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT 0x8E8D +#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT 0x8E8E +#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT 0x8E8F +#endif /* GL_EXT_texture_compression_bptc */ + +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_EXT_texture_compression_dxt1 1 +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#endif /* GL_EXT_texture_compression_dxt1 */ + +#ifndef GL_EXT_texture_compression_rgtc +#define GL_EXT_texture_compression_rgtc 1 +#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB +#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC +#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD +#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE +#endif /* GL_EXT_texture_compression_rgtc */ + +#ifndef GL_EXT_texture_compression_s3tc +#define GL_EXT_texture_compression_s3tc 1 +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 +#endif /* GL_EXT_texture_compression_s3tc */ + +#ifndef GL_EXT_texture_compression_s3tc_srgb +#define GL_EXT_texture_compression_s3tc_srgb 1 +#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F +#endif /* GL_EXT_texture_compression_s3tc_srgb */ + +#ifndef GL_EXT_texture_cube_map_array +#define GL_EXT_texture_cube_map_array 1 +#define GL_TEXTURE_CUBE_MAP_ARRAY_EXT 0x9009 +#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT 0x900A +#define GL_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900C +#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT 0x900D +#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900E +#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900F +#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054 +#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F +#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A +#endif /* GL_EXT_texture_cube_map_array */ + +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_EXT_texture_filter_anisotropic 1 +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif /* GL_EXT_texture_filter_anisotropic */ + +#ifndef GL_EXT_texture_filter_minmax +#define GL_EXT_texture_filter_minmax 1 +#endif /* GL_EXT_texture_filter_minmax */ + +#ifndef GL_EXT_texture_format_BGRA8888 +#define GL_EXT_texture_format_BGRA8888 1 +#endif /* GL_EXT_texture_format_BGRA8888 */ + +#ifndef GL_EXT_texture_norm16 +#define GL_EXT_texture_norm16 1 +#define GL_R16_EXT 0x822A +#define GL_RG16_EXT 0x822C +#define GL_RGBA16_EXT 0x805B +#define GL_RGB16_EXT 0x8054 +#define GL_RGB16_SNORM_EXT 0x8F9A +#endif /* GL_EXT_texture_norm16 */ + +#ifndef GL_EXT_texture_rg +#define GL_EXT_texture_rg 1 +#define GL_RED_EXT 0x1903 +#define GL_RG_EXT 0x8227 +#define GL_R8_EXT 0x8229 +#define GL_RG8_EXT 0x822B +#endif /* GL_EXT_texture_rg */ + +#ifndef GL_EXT_texture_sRGB_R8 +#define GL_EXT_texture_sRGB_R8 1 +#define GL_SR8_EXT 0x8FBD +#endif /* GL_EXT_texture_sRGB_R8 */ + +#ifndef GL_EXT_texture_sRGB_RG8 +#define GL_EXT_texture_sRGB_RG8 1 +#define GL_SRG8_EXT 0x8FBE +#endif /* GL_EXT_texture_sRGB_RG8 */ + +#ifndef GL_EXT_texture_sRGB_decode +#define GL_EXT_texture_sRGB_decode 1 +#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48 +#define GL_DECODE_EXT 0x8A49 +#define GL_SKIP_DECODE_EXT 0x8A4A +#endif /* GL_EXT_texture_sRGB_decode */ + +#ifndef GL_EXT_texture_storage +#define GL_EXT_texture_storage 1 +#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F +#define GL_ALPHA8_EXT 0x803C +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_RGBA32F_EXT 0x8814 +#define GL_RGB32F_EXT 0x8815 +#define GL_ALPHA32F_EXT 0x8816 +#define GL_LUMINANCE32F_EXT 0x8818 +#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 +#define GL_ALPHA16F_EXT 0x881C +#define GL_LUMINANCE16F_EXT 0x881E +#define GL_LUMINANCE_ALPHA16F_EXT 0x881F +#define GL_R32F_EXT 0x822E +#define GL_RG32F_EXT 0x8230 +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif +#endif /* GL_EXT_texture_storage */ + +#ifndef GL_EXT_texture_type_2_10_10_10_REV +#define GL_EXT_texture_type_2_10_10_10_REV 1 +#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 +#endif /* GL_EXT_texture_type_2_10_10_10_REV */ + +#ifndef GL_EXT_texture_view +#define GL_EXT_texture_view 1 +#define GL_TEXTURE_VIEW_MIN_LEVEL_EXT 0x82DB +#define GL_TEXTURE_VIEW_NUM_LEVELS_EXT 0x82DC +#define GL_TEXTURE_VIEW_MIN_LAYER_EXT 0x82DD +#define GL_TEXTURE_VIEW_NUM_LAYERS_EXT 0x82DE +typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWEXTPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glTextureViewEXT (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); +#endif +#endif /* GL_EXT_texture_view */ + +#ifndef GL_EXT_unpack_subimage +#define GL_EXT_unpack_subimage 1 +#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2 +#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4 +#endif /* GL_EXT_unpack_subimage */ + +#ifndef GL_EXT_win32_keyed_mutex +#define GL_EXT_win32_keyed_mutex 1 +typedef GLboolean (GL_APIENTRYP PFNGLACQUIREKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key, GLuint timeout); +typedef GLboolean (GL_APIENTRYP PFNGLRELEASEKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLboolean GL_APIENTRY glAcquireKeyedMutexWin32EXT (GLuint memory, GLuint64 key, GLuint timeout); +GL_APICALL GLboolean GL_APIENTRY glReleaseKeyedMutexWin32EXT (GLuint memory, GLuint64 key); +#endif +#endif /* GL_EXT_win32_keyed_mutex */ + +#ifndef GL_EXT_window_rectangles +#define GL_EXT_window_rectangles 1 +#define GL_INCLUSIVE_EXT 0x8F10 +#define GL_EXCLUSIVE_EXT 0x8F11 +#define GL_WINDOW_RECTANGLE_EXT 0x8F12 +#define GL_WINDOW_RECTANGLE_MODE_EXT 0x8F13 +#define GL_MAX_WINDOW_RECTANGLES_EXT 0x8F14 +#define GL_NUM_WINDOW_RECTANGLES_EXT 0x8F15 +typedef void (GL_APIENTRYP PFNGLWINDOWRECTANGLESEXTPROC) (GLenum mode, GLsizei count, const GLint *box); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glWindowRectanglesEXT (GLenum mode, GLsizei count, const GLint *box); +#endif +#endif /* GL_EXT_window_rectangles */ + +#ifndef GL_FJ_shader_binary_GCCSO +#define GL_FJ_shader_binary_GCCSO 1 +#define GL_GCCSO_SHADER_BINARY_FJ 0x9260 +#endif /* GL_FJ_shader_binary_GCCSO */ + +#ifndef GL_IMG_bindless_texture +#define GL_IMG_bindless_texture 1 +typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTUREHANDLEIMGPROC) (GLuint texture); +typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEIMGPROC) (GLuint texture, GLuint sampler); +typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64IMGPROC) (GLint location, GLuint64 value); +typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64VIMGPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64IMGPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VIMGPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLuint64 GL_APIENTRY glGetTextureHandleIMG (GLuint texture); +GL_APICALL GLuint64 GL_APIENTRY glGetTextureSamplerHandleIMG (GLuint texture, GLuint sampler); +GL_APICALL void GL_APIENTRY glUniformHandleui64IMG (GLint location, GLuint64 value); +GL_APICALL void GL_APIENTRY glUniformHandleui64vIMG (GLint location, GLsizei count, const GLuint64 *value); +GL_APICALL void GL_APIENTRY glProgramUniformHandleui64IMG (GLuint program, GLint location, GLuint64 value); +GL_APICALL void GL_APIENTRY glProgramUniformHandleui64vIMG (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +#endif +#endif /* GL_IMG_bindless_texture */ + +#ifndef GL_IMG_framebuffer_downsample +#define GL_IMG_framebuffer_downsample 1 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_AND_DOWNSAMPLE_IMG 0x913C +#define GL_NUM_DOWNSAMPLE_SCALES_IMG 0x913D +#define GL_DOWNSAMPLE_SCALES_IMG 0x913E +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SCALE_IMG 0x913F +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DDOWNSAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint xscale, GLint yscale); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERDOWNSAMPLEIMGPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer, GLint xscale, GLint yscale); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTexture2DDownsampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint xscale, GLint yscale); +GL_APICALL void GL_APIENTRY glFramebufferTextureLayerDownsampleIMG (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer, GLint xscale, GLint yscale); +#endif +#endif /* GL_IMG_framebuffer_downsample */ + +#ifndef GL_IMG_multisampled_render_to_texture +#define GL_IMG_multisampled_render_to_texture 1 +#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 +#define GL_MAX_SAMPLES_IMG 0x9135 +#define GL_TEXTURE_SAMPLES_IMG 0x9136 +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif +#endif /* GL_IMG_multisampled_render_to_texture */ + +#ifndef GL_IMG_program_binary +#define GL_IMG_program_binary 1 +#define GL_SGX_PROGRAM_BINARY_IMG 0x9130 +#endif /* GL_IMG_program_binary */ + +#ifndef GL_IMG_read_format +#define GL_IMG_read_format 1 +#define GL_BGRA_IMG 0x80E1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365 +#endif /* GL_IMG_read_format */ + +#ifndef GL_IMG_shader_binary +#define GL_IMG_shader_binary 1 +#define GL_SGX_BINARY_IMG 0x8C0A +#endif /* GL_IMG_shader_binary */ + +#ifndef GL_IMG_texture_compression_pvrtc +#define GL_IMG_texture_compression_pvrtc 1 +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 +#endif /* GL_IMG_texture_compression_pvrtc */ + +#ifndef GL_IMG_texture_compression_pvrtc2 +#define GL_IMG_texture_compression_pvrtc2 1 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138 +#endif /* GL_IMG_texture_compression_pvrtc2 */ + +#ifndef GL_IMG_texture_filter_cubic +#define GL_IMG_texture_filter_cubic 1 +#define GL_CUBIC_IMG 0x9139 +#define GL_CUBIC_MIPMAP_NEAREST_IMG 0x913A +#define GL_CUBIC_MIPMAP_LINEAR_IMG 0x913B +#endif /* GL_IMG_texture_filter_cubic */ + +#ifndef GL_INTEL_conservative_rasterization +#define GL_INTEL_conservative_rasterization 1 +#define GL_CONSERVATIVE_RASTERIZATION_INTEL 0x83FE +#endif /* GL_INTEL_conservative_rasterization */ + +#ifndef GL_INTEL_framebuffer_CMAA +#define GL_INTEL_framebuffer_CMAA 1 +typedef void (GL_APIENTRYP PFNGLAPPLYFRAMEBUFFERATTACHMENTCMAAINTELPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glApplyFramebufferAttachmentCMAAINTEL (void); +#endif +#endif /* GL_INTEL_framebuffer_CMAA */ + +#ifndef GL_INTEL_performance_query +#define GL_INTEL_performance_query 1 +#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000 +#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001 +#define GL_PERFQUERY_WAIT_INTEL 0x83FB +#define GL_PERFQUERY_FLUSH_INTEL 0x83FA +#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9 +#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0 +#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1 +#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2 +#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3 +#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4 +#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5 +#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8 +#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9 +#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA +#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB +#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC +#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD +#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE +#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF +#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500 +typedef void (GL_APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (GL_APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle); +typedef void (GL_APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (GL_APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle); +typedef void (GL_APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId); +typedef void (GL_APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId); +typedef void (GL_APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); +typedef void (GL_APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten); +typedef void (GL_APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId); +typedef void (GL_APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle); +GL_APICALL void GL_APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle); +GL_APICALL void GL_APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle); +GL_APICALL void GL_APIENTRY glEndPerfQueryINTEL (GLuint queryHandle); +GL_APICALL void GL_APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId); +GL_APICALL void GL_APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId); +GL_APICALL void GL_APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); +GL_APICALL void GL_APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten); +GL_APICALL void GL_APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId); +GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); +#endif +#endif /* GL_INTEL_performance_query */ + +#ifndef GL_MESA_shader_integer_functions +#define GL_MESA_shader_integer_functions 1 +#endif /* GL_MESA_shader_integer_functions */ + +#ifndef GL_NVX_blend_equation_advanced_multi_draw_buffers +#define GL_NVX_blend_equation_advanced_multi_draw_buffers 1 +#endif /* GL_NVX_blend_equation_advanced_multi_draw_buffers */ + +#ifndef GL_NV_bindless_texture +#define GL_NV_bindless_texture 1 +typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture); +typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler); +typedef void (GL_APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); +typedef void (GL_APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle); +typedef GLuint64 (GL_APIENTRYP PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +typedef void (GL_APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access); +typedef void (GL_APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle); +typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value); +typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64 *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle); +typedef GLboolean (GL_APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLuint64 GL_APIENTRY glGetTextureHandleNV (GLuint texture); +GL_APICALL GLuint64 GL_APIENTRY glGetTextureSamplerHandleNV (GLuint texture, GLuint sampler); +GL_APICALL void GL_APIENTRY glMakeTextureHandleResidentNV (GLuint64 handle); +GL_APICALL void GL_APIENTRY glMakeTextureHandleNonResidentNV (GLuint64 handle); +GL_APICALL GLuint64 GL_APIENTRY glGetImageHandleNV (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format); +GL_APICALL void GL_APIENTRY glMakeImageHandleResidentNV (GLuint64 handle, GLenum access); +GL_APICALL void GL_APIENTRY glMakeImageHandleNonResidentNV (GLuint64 handle); +GL_APICALL void GL_APIENTRY glUniformHandleui64NV (GLint location, GLuint64 value); +GL_APICALL void GL_APIENTRY glUniformHandleui64vNV (GLint location, GLsizei count, const GLuint64 *value); +GL_APICALL void GL_APIENTRY glProgramUniformHandleui64NV (GLuint program, GLint location, GLuint64 value); +GL_APICALL void GL_APIENTRY glProgramUniformHandleui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64 *values); +GL_APICALL GLboolean GL_APIENTRY glIsTextureHandleResidentNV (GLuint64 handle); +GL_APICALL GLboolean GL_APIENTRY glIsImageHandleResidentNV (GLuint64 handle); +#endif +#endif /* GL_NV_bindless_texture */ + +#ifndef GL_NV_blend_equation_advanced +#define GL_NV_blend_equation_advanced 1 +#define GL_BLEND_OVERLAP_NV 0x9281 +#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280 +#define GL_BLUE_NV 0x1905 +#define GL_COLORBURN_NV 0x929A +#define GL_COLORDODGE_NV 0x9299 +#define GL_CONJOINT_NV 0x9284 +#define GL_CONTRAST_NV 0x92A1 +#define GL_DARKEN_NV 0x9297 +#define GL_DIFFERENCE_NV 0x929E +#define GL_DISJOINT_NV 0x9283 +#define GL_DST_ATOP_NV 0x928F +#define GL_DST_IN_NV 0x928B +#define GL_DST_NV 0x9287 +#define GL_DST_OUT_NV 0x928D +#define GL_DST_OVER_NV 0x9289 +#define GL_EXCLUSION_NV 0x92A0 +#define GL_GREEN_NV 0x1904 +#define GL_HARDLIGHT_NV 0x929B +#define GL_HARDMIX_NV 0x92A9 +#define GL_HSL_COLOR_NV 0x92AF +#define GL_HSL_HUE_NV 0x92AD +#define GL_HSL_LUMINOSITY_NV 0x92B0 +#define GL_HSL_SATURATION_NV 0x92AE +#define GL_INVERT_OVG_NV 0x92B4 +#define GL_INVERT_RGB_NV 0x92A3 +#define GL_LIGHTEN_NV 0x9298 +#define GL_LINEARBURN_NV 0x92A5 +#define GL_LINEARDODGE_NV 0x92A4 +#define GL_LINEARLIGHT_NV 0x92A7 +#define GL_MINUS_CLAMPED_NV 0x92B3 +#define GL_MINUS_NV 0x929F +#define GL_MULTIPLY_NV 0x9294 +#define GL_OVERLAY_NV 0x9296 +#define GL_PINLIGHT_NV 0x92A8 +#define GL_PLUS_CLAMPED_ALPHA_NV 0x92B2 +#define GL_PLUS_CLAMPED_NV 0x92B1 +#define GL_PLUS_DARKER_NV 0x9292 +#define GL_PLUS_NV 0x9291 +#define GL_RED_NV 0x1903 +#define GL_SCREEN_NV 0x9295 +#define GL_SOFTLIGHT_NV 0x929C +#define GL_SRC_ATOP_NV 0x928E +#define GL_SRC_IN_NV 0x928A +#define GL_SRC_NV 0x9286 +#define GL_SRC_OUT_NV 0x928C +#define GL_SRC_OVER_NV 0x9288 +#define GL_UNCORRELATED_NV 0x9282 +#define GL_VIVIDLIGHT_NV 0x92A6 +#define GL_XOR_NV 0x1506 +typedef void (GL_APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value); +typedef void (GL_APIENTRYP PFNGLBLENDBARRIERNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlendParameteriNV (GLenum pname, GLint value); +GL_APICALL void GL_APIENTRY glBlendBarrierNV (void); +#endif +#endif /* GL_NV_blend_equation_advanced */ + +#ifndef GL_NV_blend_equation_advanced_coherent +#define GL_NV_blend_equation_advanced_coherent 1 +#define GL_BLEND_ADVANCED_COHERENT_NV 0x9285 +#endif /* GL_NV_blend_equation_advanced_coherent */ + +#ifndef GL_NV_blend_minmax_factor +#define GL_NV_blend_minmax_factor 1 +#define GL_FACTOR_MIN_AMD 0x901C +#define GL_FACTOR_MAX_AMD 0x901D +#endif /* GL_NV_blend_minmax_factor */ + +#ifndef GL_NV_conditional_render +#define GL_NV_conditional_render 1 +#define GL_QUERY_WAIT_NV 0x8E13 +#define GL_QUERY_NO_WAIT_NV 0x8E14 +#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15 +#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16 +typedef void (GL_APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode); +typedef void (GL_APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBeginConditionalRenderNV (GLuint id, GLenum mode); +GL_APICALL void GL_APIENTRY glEndConditionalRenderNV (void); +#endif +#endif /* GL_NV_conditional_render */ + +#ifndef GL_NV_conservative_raster +#define GL_NV_conservative_raster 1 +#define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346 +#define GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347 +#define GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348 +#define GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349 +typedef void (GL_APIENTRYP PFNGLSUBPIXELPRECISIONBIASNVPROC) (GLuint xbits, GLuint ybits); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glSubpixelPrecisionBiasNV (GLuint xbits, GLuint ybits); +#endif +#endif /* GL_NV_conservative_raster */ + +#ifndef GL_NV_conservative_raster_pre_snap_triangles +#define GL_NV_conservative_raster_pre_snap_triangles 1 +#define GL_CONSERVATIVE_RASTER_MODE_NV 0x954D +#define GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV 0x954E +#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV 0x954F +typedef void (GL_APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERINVPROC) (GLenum pname, GLint param); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glConservativeRasterParameteriNV (GLenum pname, GLint param); +#endif +#endif /* GL_NV_conservative_raster_pre_snap_triangles */ + +#ifndef GL_NV_copy_buffer +#define GL_NV_copy_buffer 1 +#define GL_COPY_READ_BUFFER_NV 0x8F36 +#define GL_COPY_WRITE_BUFFER_NV 0x8F37 +typedef void (GL_APIENTRYP PFNGLCOPYBUFFERSUBDATANVPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCopyBufferSubDataNV (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#endif +#endif /* GL_NV_copy_buffer */ + +#ifndef GL_NV_coverage_sample +#define GL_NV_coverage_sample 1 +#define GL_COVERAGE_COMPONENT_NV 0x8ED0 +#define GL_COVERAGE_COMPONENT4_NV 0x8ED1 +#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2 +#define GL_COVERAGE_BUFFERS_NV 0x8ED3 +#define GL_COVERAGE_SAMPLES_NV 0x8ED4 +#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 +#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 +#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7 +#define GL_COVERAGE_BUFFER_BIT_NV 0x00008000 +typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask); +typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask); +GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation); +#endif +#endif /* GL_NV_coverage_sample */ + +#ifndef GL_NV_depth_nonlinear +#define GL_NV_depth_nonlinear 1 +#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C +#endif /* GL_NV_depth_nonlinear */ + +#ifndef GL_NV_draw_buffers +#define GL_NV_draw_buffers 1 +#define GL_MAX_DRAW_BUFFERS_NV 0x8824 +#define GL_DRAW_BUFFER0_NV 0x8825 +#define GL_DRAW_BUFFER1_NV 0x8826 +#define GL_DRAW_BUFFER2_NV 0x8827 +#define GL_DRAW_BUFFER3_NV 0x8828 +#define GL_DRAW_BUFFER4_NV 0x8829 +#define GL_DRAW_BUFFER5_NV 0x882A +#define GL_DRAW_BUFFER6_NV 0x882B +#define GL_DRAW_BUFFER7_NV 0x882C +#define GL_DRAW_BUFFER8_NV 0x882D +#define GL_DRAW_BUFFER9_NV 0x882E +#define GL_DRAW_BUFFER10_NV 0x882F +#define GL_DRAW_BUFFER11_NV 0x8830 +#define GL_DRAW_BUFFER12_NV 0x8831 +#define GL_DRAW_BUFFER13_NV 0x8832 +#define GL_DRAW_BUFFER14_NV 0x8833 +#define GL_DRAW_BUFFER15_NV 0x8834 +#define GL_COLOR_ATTACHMENT0_NV 0x8CE0 +#define GL_COLOR_ATTACHMENT1_NV 0x8CE1 +#define GL_COLOR_ATTACHMENT2_NV 0x8CE2 +#define GL_COLOR_ATTACHMENT3_NV 0x8CE3 +#define GL_COLOR_ATTACHMENT4_NV 0x8CE4 +#define GL_COLOR_ATTACHMENT5_NV 0x8CE5 +#define GL_COLOR_ATTACHMENT6_NV 0x8CE6 +#define GL_COLOR_ATTACHMENT7_NV 0x8CE7 +#define GL_COLOR_ATTACHMENT8_NV 0x8CE8 +#define GL_COLOR_ATTACHMENT9_NV 0x8CE9 +#define GL_COLOR_ATTACHMENT10_NV 0x8CEA +#define GL_COLOR_ATTACHMENT11_NV 0x8CEB +#define GL_COLOR_ATTACHMENT12_NV 0x8CEC +#define GL_COLOR_ATTACHMENT13_NV 0x8CED +#define GL_COLOR_ATTACHMENT14_NV 0x8CEE +#define GL_COLOR_ATTACHMENT15_NV 0x8CEF +typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs); +#endif +#endif /* GL_NV_draw_buffers */ + +#ifndef GL_NV_draw_instanced +#define GL_NV_draw_instanced 1 +typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawArraysInstancedNV (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +#endif +#endif /* GL_NV_draw_instanced */ + +#ifndef GL_NV_draw_vulkan_image +#define GL_NV_draw_vulkan_image 1 +typedef void (GL_APIENTRY *GLVULKANPROCNV)(void); +typedef void (GL_APIENTRYP PFNGLDRAWVKIMAGENVPROC) (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1); +typedef GLVULKANPROCNV (GL_APIENTRYP PFNGLGETVKPROCADDRNVPROC) (const GLchar *name); +typedef void (GL_APIENTRYP PFNGLWAITVKSEMAPHORENVPROC) (GLuint64 vkSemaphore); +typedef void (GL_APIENTRYP PFNGLSIGNALVKSEMAPHORENVPROC) (GLuint64 vkSemaphore); +typedef void (GL_APIENTRYP PFNGLSIGNALVKFENCENVPROC) (GLuint64 vkFence); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDrawVkImageNV (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1); +GL_APICALL GLVULKANPROCNV GL_APIENTRY glGetVkProcAddrNV (const GLchar *name); +GL_APICALL void GL_APIENTRY glWaitVkSemaphoreNV (GLuint64 vkSemaphore); +GL_APICALL void GL_APIENTRY glSignalVkSemaphoreNV (GLuint64 vkSemaphore); +GL_APICALL void GL_APIENTRY glSignalVkFenceNV (GLuint64 vkFence); +#endif +#endif /* GL_NV_draw_vulkan_image */ + +#ifndef GL_NV_explicit_attrib_location +#define GL_NV_explicit_attrib_location 1 +#endif /* GL_NV_explicit_attrib_location */ + +#ifndef GL_NV_fbo_color_attachments +#define GL_NV_fbo_color_attachments 1 +#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF +#endif /* GL_NV_fbo_color_attachments */ + +#ifndef GL_NV_fence +#define GL_NV_fence 1 +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences); +GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences); +GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint fence); +GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint fence); +GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint fence); +GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition); +#endif +#endif /* GL_NV_fence */ + +#ifndef GL_NV_fill_rectangle +#define GL_NV_fill_rectangle 1 +#define GL_FILL_RECTANGLE_NV 0x933C +#endif /* GL_NV_fill_rectangle */ + +#ifndef GL_NV_fragment_coverage_to_color +#define GL_NV_fragment_coverage_to_color 1 +#define GL_FRAGMENT_COVERAGE_TO_COLOR_NV 0x92DD +#define GL_FRAGMENT_COVERAGE_COLOR_NV 0x92DE +typedef void (GL_APIENTRYP PFNGLFRAGMENTCOVERAGECOLORNVPROC) (GLuint color); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFragmentCoverageColorNV (GLuint color); +#endif +#endif /* GL_NV_fragment_coverage_to_color */ + +#ifndef GL_NV_fragment_shader_interlock +#define GL_NV_fragment_shader_interlock 1 +#endif /* GL_NV_fragment_shader_interlock */ + +#ifndef GL_NV_framebuffer_blit +#define GL_NV_framebuffer_blit 1 +#define GL_READ_FRAMEBUFFER_NV 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_NV 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA +typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glBlitFramebufferNV (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif +#endif /* GL_NV_framebuffer_blit */ + +#ifndef GL_NV_framebuffer_mixed_samples +#define GL_NV_framebuffer_mixed_samples 1 +#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331 +#define GL_COLOR_SAMPLES_NV 0x8E20 +#define GL_DEPTH_SAMPLES_NV 0x932D +#define GL_STENCIL_SAMPLES_NV 0x932E +#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F +#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330 +#define GL_COVERAGE_MODULATION_NV 0x9332 +#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333 +typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufsize, GLfloat *v); +typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glCoverageModulationTableNV (GLsizei n, const GLfloat *v); +GL_APICALL void GL_APIENTRY glGetCoverageModulationTableNV (GLsizei bufsize, GLfloat *v); +GL_APICALL void GL_APIENTRY glCoverageModulationNV (GLenum components); +#endif +#endif /* GL_NV_framebuffer_mixed_samples */ + +#ifndef GL_NV_framebuffer_multisample +#define GL_NV_framebuffer_multisample 1 +#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56 +#define GL_MAX_SAMPLES_NV 0x8D57 +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif +#endif /* GL_NV_framebuffer_multisample */ + +#ifndef GL_NV_generate_mipmap_sRGB +#define GL_NV_generate_mipmap_sRGB 1 +#endif /* GL_NV_generate_mipmap_sRGB */ + +#ifndef GL_NV_geometry_shader_passthrough +#define GL_NV_geometry_shader_passthrough 1 +#endif /* GL_NV_geometry_shader_passthrough */ + +#ifndef GL_NV_gpu_shader5 +#define GL_NV_gpu_shader5 1 +typedef khronos_int64_t GLint64EXT; +typedef khronos_uint64_t GLuint64EXT; +#define GL_INT64_NV 0x140E +#define GL_UNSIGNED_INT64_NV 0x140F +#define GL_INT8_NV 0x8FE0 +#define GL_INT8_VEC2_NV 0x8FE1 +#define GL_INT8_VEC3_NV 0x8FE2 +#define GL_INT8_VEC4_NV 0x8FE3 +#define GL_INT16_NV 0x8FE4 +#define GL_INT16_VEC2_NV 0x8FE5 +#define GL_INT16_VEC3_NV 0x8FE6 +#define GL_INT16_VEC4_NV 0x8FE7 +#define GL_INT64_VEC2_NV 0x8FE9 +#define GL_INT64_VEC3_NV 0x8FEA +#define GL_INT64_VEC4_NV 0x8FEB +#define GL_UNSIGNED_INT8_NV 0x8FEC +#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED +#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE +#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF +#define GL_UNSIGNED_INT16_NV 0x8FF0 +#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1 +#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2 +#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3 +#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5 +#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6 +#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7 +#define GL_FLOAT16_NV 0x8FF8 +#define GL_FLOAT16_VEC2_NV 0x8FF9 +#define GL_FLOAT16_VEC3_NV 0x8FFA +#define GL_FLOAT16_VEC4_NV 0x8FFB +#define GL_PATCHES 0x000E +typedef void (GL_APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x); +typedef void (GL_APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y); +typedef void (GL_APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (GL_APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (GL_APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x); +typedef void (GL_APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (GL_APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (GL_APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (GL_APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glUniform1i64NV (GLint location, GLint64EXT x); +GL_APICALL void GL_APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y); +GL_APICALL void GL_APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GL_APICALL void GL_APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GL_APICALL void GL_APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x); +GL_APICALL void GL_APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y); +GL_APICALL void GL_APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GL_APICALL void GL_APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GL_APICALL void GL_APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params); +GL_APICALL void GL_APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x); +GL_APICALL void GL_APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y); +GL_APICALL void GL_APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z); +GL_APICALL void GL_APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w); +GL_APICALL void GL_APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x); +GL_APICALL void GL_APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y); +GL_APICALL void GL_APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z); +GL_APICALL void GL_APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w); +GL_APICALL void GL_APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +GL_APICALL void GL_APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value); +#endif +#endif /* GL_NV_gpu_shader5 */ + +#ifndef GL_NV_image_formats +#define GL_NV_image_formats 1 +#endif /* GL_NV_image_formats */ + +#ifndef GL_NV_instanced_arrays +#define GL_NV_instanced_arrays 1 +#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE +typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor); +#endif +#endif /* GL_NV_instanced_arrays */ + +#ifndef GL_NV_internalformat_sample_query +#define GL_NV_internalformat_sample_query 1 +#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 +#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102 +#define GL_MULTISAMPLES_NV 0x9371 +#define GL_SUPERSAMPLE_SCALE_X_NV 0x9372 +#define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373 +#define GL_CONFORMANT_NV 0x9374 +typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params); +#endif +#endif /* GL_NV_internalformat_sample_query */ + +#ifndef GL_NV_non_square_matrices +#define GL_NV_non_square_matrices 1 +#define GL_FLOAT_MAT2x3_NV 0x8B65 +#define GL_FLOAT_MAT2x4_NV 0x8B66 +#define GL_FLOAT_MAT3x2_NV 0x8B67 +#define GL_FLOAT_MAT3x4_NV 0x8B68 +#define GL_FLOAT_MAT4x2_NV 0x8B69 +#define GL_FLOAT_MAT4x3_NV 0x8B6A +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glUniformMatrix2x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix3x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix2x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix4x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix3x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +GL_APICALL void GL_APIENTRY glUniformMatrix4x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +#endif +#endif /* GL_NV_non_square_matrices */ + +#ifndef GL_NV_path_rendering +#define GL_NV_path_rendering 1 +#define GL_PATH_FORMAT_SVG_NV 0x9070 +#define GL_PATH_FORMAT_PS_NV 0x9071 +#define GL_STANDARD_FONT_NAME_NV 0x9072 +#define GL_SYSTEM_FONT_NAME_NV 0x9073 +#define GL_FILE_NAME_NV 0x9074 +#define GL_PATH_STROKE_WIDTH_NV 0x9075 +#define GL_PATH_END_CAPS_NV 0x9076 +#define GL_PATH_INITIAL_END_CAP_NV 0x9077 +#define GL_PATH_TERMINAL_END_CAP_NV 0x9078 +#define GL_PATH_JOIN_STYLE_NV 0x9079 +#define GL_PATH_MITER_LIMIT_NV 0x907A +#define GL_PATH_DASH_CAPS_NV 0x907B +#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C +#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D +#define GL_PATH_DASH_OFFSET_NV 0x907E +#define GL_PATH_CLIENT_LENGTH_NV 0x907F +#define GL_PATH_FILL_MODE_NV 0x9080 +#define GL_PATH_FILL_MASK_NV 0x9081 +#define GL_PATH_FILL_COVER_MODE_NV 0x9082 +#define GL_PATH_STROKE_COVER_MODE_NV 0x9083 +#define GL_PATH_STROKE_MASK_NV 0x9084 +#define GL_COUNT_UP_NV 0x9088 +#define GL_COUNT_DOWN_NV 0x9089 +#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A +#define GL_CONVEX_HULL_NV 0x908B +#define GL_BOUNDING_BOX_NV 0x908D +#define GL_TRANSLATE_X_NV 0x908E +#define GL_TRANSLATE_Y_NV 0x908F +#define GL_TRANSLATE_2D_NV 0x9090 +#define GL_TRANSLATE_3D_NV 0x9091 +#define GL_AFFINE_2D_NV 0x9092 +#define GL_AFFINE_3D_NV 0x9094 +#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096 +#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098 +#define GL_UTF8_NV 0x909A +#define GL_UTF16_NV 0x909B +#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C +#define GL_PATH_COMMAND_COUNT_NV 0x909D +#define GL_PATH_COORD_COUNT_NV 0x909E +#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F +#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0 +#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1 +#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2 +#define GL_SQUARE_NV 0x90A3 +#define GL_ROUND_NV 0x90A4 +#define GL_TRIANGULAR_NV 0x90A5 +#define GL_BEVEL_NV 0x90A6 +#define GL_MITER_REVERT_NV 0x90A7 +#define GL_MITER_TRUNCATE_NV 0x90A8 +#define GL_SKIP_MISSING_GLYPH_NV 0x90A9 +#define GL_USE_MISSING_GLYPH_NV 0x90AA +#define GL_PATH_ERROR_POSITION_NV 0x90AB +#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD +#define GL_ADJACENT_PAIRS_NV 0x90AE +#define GL_FIRST_TO_REST_NV 0x90AF +#define GL_PATH_GEN_MODE_NV 0x90B0 +#define GL_PATH_GEN_COEFF_NV 0x90B1 +#define GL_PATH_GEN_COMPONENTS_NV 0x90B3 +#define GL_PATH_STENCIL_FUNC_NV 0x90B7 +#define GL_PATH_STENCIL_REF_NV 0x90B8 +#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9 +#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD +#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE +#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF +#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4 +#define GL_MOVE_TO_RESETS_NV 0x90B5 +#define GL_MOVE_TO_CONTINUES_NV 0x90B6 +#define GL_CLOSE_PATH_NV 0x00 +#define GL_MOVE_TO_NV 0x02 +#define GL_RELATIVE_MOVE_TO_NV 0x03 +#define GL_LINE_TO_NV 0x04 +#define GL_RELATIVE_LINE_TO_NV 0x05 +#define GL_HORIZONTAL_LINE_TO_NV 0x06 +#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07 +#define GL_VERTICAL_LINE_TO_NV 0x08 +#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09 +#define GL_QUADRATIC_CURVE_TO_NV 0x0A +#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B +#define GL_CUBIC_CURVE_TO_NV 0x0C +#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D +#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E +#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F +#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10 +#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11 +#define GL_SMALL_CCW_ARC_TO_NV 0x12 +#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13 +#define GL_SMALL_CW_ARC_TO_NV 0x14 +#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15 +#define GL_LARGE_CCW_ARC_TO_NV 0x16 +#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17 +#define GL_LARGE_CW_ARC_TO_NV 0x18 +#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19 +#define GL_RESTART_PATH_NV 0xF0 +#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2 +#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4 +#define GL_RECT_NV 0xF6 +#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8 +#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA +#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC +#define GL_ARC_TO_NV 0xFE +#define GL_RELATIVE_ARC_TO_NV 0xFF +#define GL_BOLD_BIT_NV 0x01 +#define GL_ITALIC_BIT_NV 0x02 +#define GL_GLYPH_WIDTH_BIT_NV 0x01 +#define GL_GLYPH_HEIGHT_BIT_NV 0x02 +#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04 +#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08 +#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10 +#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20 +#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40 +#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80 +#define GL_GLYPH_HAS_KERNING_BIT_NV 0x100 +#define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000 +#define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000 +#define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000 +#define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000 +#define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000 +#define GL_FONT_ASCENDER_BIT_NV 0x00200000 +#define GL_FONT_DESCENDER_BIT_NV 0x00400000 +#define GL_FONT_HEIGHT_BIT_NV 0x00800000 +#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000 +#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000 +#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000 +#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000 +#define GL_FONT_HAS_KERNING_BIT_NV 0x10000000 +#define GL_ROUNDED_RECT_NV 0xE8 +#define GL_RELATIVE_ROUNDED_RECT_NV 0xE9 +#define GL_ROUNDED_RECT2_NV 0xEA +#define GL_RELATIVE_ROUNDED_RECT2_NV 0xEB +#define GL_ROUNDED_RECT4_NV 0xEC +#define GL_RELATIVE_ROUNDED_RECT4_NV 0xED +#define GL_ROUNDED_RECT8_NV 0xEE +#define GL_RELATIVE_ROUNDED_RECT8_NV 0xEF +#define GL_RELATIVE_RECT_NV 0xF7 +#define GL_FONT_GLYPHS_AVAILABLE_NV 0x9368 +#define GL_FONT_TARGET_UNAVAILABLE_NV 0x9369 +#define GL_FONT_UNAVAILABLE_NV 0x936A +#define GL_FONT_UNINTELLIGIBLE_NV 0x936B +#define GL_CONIC_CURVE_TO_NV 0x1A +#define GL_RELATIVE_CONIC_CURVE_TO_NV 0x1B +#define GL_FONT_NUM_GLYPH_INDICES_BIT_NV 0x20000000 +#define GL_STANDARD_FONT_FORMAT_NV 0x936C +#define GL_PATH_PROJECTION_NV 0x1701 +#define GL_PATH_MODELVIEW_NV 0x1700 +#define GL_PATH_MODELVIEW_STACK_DEPTH_NV 0x0BA3 +#define GL_PATH_MODELVIEW_MATRIX_NV 0x0BA6 +#define GL_PATH_MAX_MODELVIEW_STACK_DEPTH_NV 0x0D36 +#define GL_PATH_TRANSPOSE_MODELVIEW_MATRIX_NV 0x84E3 +#define GL_PATH_PROJECTION_STACK_DEPTH_NV 0x0BA4 +#define GL_PATH_PROJECTION_MATRIX_NV 0x0BA7 +#define GL_PATH_MAX_PROJECTION_STACK_DEPTH_NV 0x0D38 +#define GL_PATH_TRANSPOSE_PROJECTION_MATRIX_NV 0x84E4 +#define GL_FRAGMENT_INPUT_NV 0x936D +typedef GLuint (GL_APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range); +typedef void (GL_APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range); +typedef GLboolean (GL_APIENTRYP PFNGLISPATHNVPROC) (GLuint path); +typedef void (GL_APIENTRYP PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (GL_APIENTRYP PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (GL_APIENTRYP PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (GL_APIENTRYP PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords); +typedef void (GL_APIENTRYP PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void *pathString); +typedef void (GL_APIENTRYP PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (GL_APIENTRYP PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (GL_APIENTRYP PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights); +typedef void (GL_APIENTRYP PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath); +typedef void (GL_APIENTRYP PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight); +typedef void (GL_APIENTRYP PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value); +typedef void (GL_APIENTRYP PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value); +typedef void (GL_APIENTRYP PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat *dashArray); +typedef void (GL_APIENTRYP PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask); +typedef void (GL_APIENTRYP PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units); +typedef void (GL_APIENTRYP PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask); +typedef void (GL_APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func); +typedef void (GL_APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode); +typedef void (GL_APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode); +typedef void (GL_APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint *value); +typedef void (GL_APIENTRYP PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat *value); +typedef void (GL_APIENTRYP PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte *commands); +typedef void (GL_APIENTRYP PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat *coords); +typedef void (GL_APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dashArray); +typedef void (GL_APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); +typedef void (GL_APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); +typedef void (GL_APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); +typedef GLboolean (GL_APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y); +typedef GLboolean (GL_APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y); +typedef GLfloat (GL_APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments); +typedef GLboolean (GL_APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +typedef void (GL_APIENTRYP PFNGLMATRIXLOAD3X2FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXLOAD3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXMULT3X2FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXMULT3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m); +typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); +typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode); +typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +typedef GLenum (GL_APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +typedef GLenum (GL_APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef GLenum (GL_APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +typedef void (GL_APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL GLuint GL_APIENTRY glGenPathsNV (GLsizei range); +GL_APICALL void GL_APIENTRY glDeletePathsNV (GLuint path, GLsizei range); +GL_APICALL GLboolean GL_APIENTRY glIsPathNV (GLuint path); +GL_APICALL void GL_APIENTRY glPathCommandsNV (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +GL_APICALL void GL_APIENTRY glPathCoordsNV (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords); +GL_APICALL void GL_APIENTRY glPathSubCommandsNV (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords); +GL_APICALL void GL_APIENTRY glPathSubCoordsNV (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords); +GL_APICALL void GL_APIENTRY glPathStringNV (GLuint path, GLenum format, GLsizei length, const void *pathString); +GL_APICALL void GL_APIENTRY glPathGlyphsNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GL_APICALL void GL_APIENTRY glPathGlyphRangeNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GL_APICALL void GL_APIENTRY glWeightPathsNV (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights); +GL_APICALL void GL_APIENTRY glCopyPathNV (GLuint resultPath, GLuint srcPath); +GL_APICALL void GL_APIENTRY glInterpolatePathsNV (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight); +GL_APICALL void GL_APIENTRY glTransformPathNV (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glPathParameterivNV (GLuint path, GLenum pname, const GLint *value); +GL_APICALL void GL_APIENTRY glPathParameteriNV (GLuint path, GLenum pname, GLint value); +GL_APICALL void GL_APIENTRY glPathParameterfvNV (GLuint path, GLenum pname, const GLfloat *value); +GL_APICALL void GL_APIENTRY glPathParameterfNV (GLuint path, GLenum pname, GLfloat value); +GL_APICALL void GL_APIENTRY glPathDashArrayNV (GLuint path, GLsizei dashCount, const GLfloat *dashArray); +GL_APICALL void GL_APIENTRY glPathStencilFuncNV (GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glPathStencilDepthOffsetNV (GLfloat factor, GLfloat units); +GL_APICALL void GL_APIENTRY glStencilFillPathNV (GLuint path, GLenum fillMode, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glPathCoverDepthFuncNV (GLenum func); +GL_APICALL void GL_APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode); +GL_APICALL void GL_APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode); +GL_APICALL void GL_APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glGetPathParameterivNV (GLuint path, GLenum pname, GLint *value); +GL_APICALL void GL_APIENTRY glGetPathParameterfvNV (GLuint path, GLenum pname, GLfloat *value); +GL_APICALL void GL_APIENTRY glGetPathCommandsNV (GLuint path, GLubyte *commands); +GL_APICALL void GL_APIENTRY glGetPathCoordsNV (GLuint path, GLfloat *coords); +GL_APICALL void GL_APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray); +GL_APICALL void GL_APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics); +GL_APICALL void GL_APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics); +GL_APICALL void GL_APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing); +GL_APICALL GLboolean GL_APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y); +GL_APICALL GLboolean GL_APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y); +GL_APICALL GLfloat GL_APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments); +GL_APICALL GLboolean GL_APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY); +GL_APICALL void GL_APIENTRY glMatrixLoad3x2fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixLoad3x3fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixLoadTranspose3x3fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixMult3x2fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixMult3x3fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glMatrixMultTranspose3x3fNV (GLenum matrixMode, const GLfloat *m); +GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathNV (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode); +GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathNV (GLuint path, GLint reference, GLuint mask, GLenum coverMode); +GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues); +GL_APICALL GLenum GL_APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]); +GL_APICALL GLenum GL_APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GL_APICALL GLenum GL_APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale); +GL_APICALL void GL_APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs); +GL_APICALL void GL_APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params); +#endif +#endif /* GL_NV_path_rendering */ + +#ifndef GL_NV_path_rendering_shared_edge +#define GL_NV_path_rendering_shared_edge 1 +#define GL_SHARED_EDGE_NV 0xC0 +#endif /* GL_NV_path_rendering_shared_edge */ + +#ifndef GL_NV_pixel_buffer_object +#define GL_NV_pixel_buffer_object 1 +#define GL_PIXEL_PACK_BUFFER_NV 0x88EB +#define GL_PIXEL_UNPACK_BUFFER_NV 0x88EC +#define GL_PIXEL_PACK_BUFFER_BINDING_NV 0x88ED +#define GL_PIXEL_UNPACK_BUFFER_BINDING_NV 0x88EF +#endif /* GL_NV_pixel_buffer_object */ + +#ifndef GL_NV_polygon_mode +#define GL_NV_polygon_mode 1 +#define GL_POLYGON_MODE_NV 0x0B40 +#define GL_POLYGON_OFFSET_POINT_NV 0x2A01 +#define GL_POLYGON_OFFSET_LINE_NV 0x2A02 +#define GL_POINT_NV 0x1B00 +#define GL_LINE_NV 0x1B01 +#define GL_FILL_NV 0x1B02 +typedef void (GL_APIENTRYP PFNGLPOLYGONMODENVPROC) (GLenum face, GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glPolygonModeNV (GLenum face, GLenum mode); +#endif +#endif /* GL_NV_polygon_mode */ + +#ifndef GL_NV_read_buffer +#define GL_NV_read_buffer 1 +#define GL_READ_BUFFER_NV 0x0C02 +typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode); +#endif +#endif /* GL_NV_read_buffer */ + +#ifndef GL_NV_read_buffer_front +#define GL_NV_read_buffer_front 1 +#endif /* GL_NV_read_buffer_front */ + +#ifndef GL_NV_read_depth +#define GL_NV_read_depth 1 +#endif /* GL_NV_read_depth */ + +#ifndef GL_NV_read_depth_stencil +#define GL_NV_read_depth_stencil 1 +#endif /* GL_NV_read_depth_stencil */ + +#ifndef GL_NV_read_stencil +#define GL_NV_read_stencil 1 +#endif /* GL_NV_read_stencil */ + +#ifndef GL_NV_sRGB_formats +#define GL_NV_sRGB_formats 1 +#define GL_SLUMINANCE_NV 0x8C46 +#define GL_SLUMINANCE_ALPHA_NV 0x8C44 +#define GL_SRGB8_NV 0x8C41 +#define GL_SLUMINANCE8_NV 0x8C47 +#define GL_SLUMINANCE8_ALPHA8_NV 0x8C45 +#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E +#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F +#define GL_ETC1_SRGB8_NV 0x88EE +#endif /* GL_NV_sRGB_formats */ + +#ifndef GL_NV_sample_locations +#define GL_NV_sample_locations 1 +#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D +#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV 0x933E +#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV 0x933F +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV 0x9340 +#define GL_SAMPLE_LOCATION_NV 0x8E50 +#define GL_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9341 +#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV 0x9342 +#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV 0x9343 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLRESOLVEDEPTHVALUESNVPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferSampleLocationsfvNV (GLenum target, GLuint start, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glNamedFramebufferSampleLocationsfvNV (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glResolveDepthValuesNV (void); +#endif +#endif /* GL_NV_sample_locations */ + +#ifndef GL_NV_sample_mask_override_coverage +#define GL_NV_sample_mask_override_coverage 1 +#endif /* GL_NV_sample_mask_override_coverage */ + +#ifndef GL_NV_shader_atomic_fp16_vector +#define GL_NV_shader_atomic_fp16_vector 1 +#endif /* GL_NV_shader_atomic_fp16_vector */ + +#ifndef GL_NV_shader_noperspective_interpolation +#define GL_NV_shader_noperspective_interpolation 1 +#endif /* GL_NV_shader_noperspective_interpolation */ + +#ifndef GL_NV_shadow_samplers_array +#define GL_NV_shadow_samplers_array 1 +#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4 +#endif /* GL_NV_shadow_samplers_array */ + +#ifndef GL_NV_shadow_samplers_cube +#define GL_NV_shadow_samplers_cube 1 +#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5 +#endif /* GL_NV_shadow_samplers_cube */ + +#ifndef GL_NV_texture_border_clamp +#define GL_NV_texture_border_clamp 1 +#define GL_TEXTURE_BORDER_COLOR_NV 0x1004 +#define GL_CLAMP_TO_BORDER_NV 0x812D +#endif /* GL_NV_texture_border_clamp */ + +#ifndef GL_NV_texture_compression_s3tc_update +#define GL_NV_texture_compression_s3tc_update 1 +#endif /* GL_NV_texture_compression_s3tc_update */ + +#ifndef GL_NV_texture_npot_2D_mipmap +#define GL_NV_texture_npot_2D_mipmap 1 +#endif /* GL_NV_texture_npot_2D_mipmap */ + +#ifndef GL_NV_viewport_array +#define GL_NV_viewport_array 1 +#define GL_MAX_VIEWPORTS_NV 0x825B +#define GL_VIEWPORT_SUBPIXEL_BITS_NV 0x825C +#define GL_VIEWPORT_BOUNDS_RANGE_NV 0x825D +#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX_NV 0x825F +typedef void (GL_APIENTRYP PFNGLVIEWPORTARRAYVNVPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFVNVPROC) (GLuint index, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLSCISSORARRAYVNVPROC) (GLuint first, GLsizei count, const GLint *v); +typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDNVPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDVNVPROC) (GLuint index, const GLint *v); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEARRAYFVNVPROC) (GLuint first, GLsizei count, const GLfloat *v); +typedef void (GL_APIENTRYP PFNGLDEPTHRANGEINDEXEDFNVPROC) (GLuint index, GLfloat n, GLfloat f); +typedef void (GL_APIENTRYP PFNGLGETFLOATI_VNVPROC) (GLenum target, GLuint index, GLfloat *data); +typedef void (GL_APIENTRYP PFNGLENABLEINVPROC) (GLenum target, GLuint index); +typedef void (GL_APIENTRYP PFNGLDISABLEINVPROC) (GLenum target, GLuint index); +typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDINVPROC) (GLenum target, GLuint index); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glViewportArrayvNV (GLuint first, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glViewportIndexedfNV (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h); +GL_APICALL void GL_APIENTRY glViewportIndexedfvNV (GLuint index, const GLfloat *v); +GL_APICALL void GL_APIENTRY glScissorArrayvNV (GLuint first, GLsizei count, const GLint *v); +GL_APICALL void GL_APIENTRY glScissorIndexedNV (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glScissorIndexedvNV (GLuint index, const GLint *v); +GL_APICALL void GL_APIENTRY glDepthRangeArrayfvNV (GLuint first, GLsizei count, const GLfloat *v); +GL_APICALL void GL_APIENTRY glDepthRangeIndexedfNV (GLuint index, GLfloat n, GLfloat f); +GL_APICALL void GL_APIENTRY glGetFloati_vNV (GLenum target, GLuint index, GLfloat *data); +GL_APICALL void GL_APIENTRY glEnableiNV (GLenum target, GLuint index); +GL_APICALL void GL_APIENTRY glDisableiNV (GLenum target, GLuint index); +GL_APICALL GLboolean GL_APIENTRY glIsEnablediNV (GLenum target, GLuint index); +#endif +#endif /* GL_NV_viewport_array */ + +#ifndef GL_NV_viewport_array2 +#define GL_NV_viewport_array2 1 +#endif /* GL_NV_viewport_array2 */ + +#ifndef GL_NV_viewport_swizzle +#define GL_NV_viewport_swizzle 1 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV 0x9350 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_X_NV 0x9351 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_Y_NV 0x9352 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Y_NV 0x9353 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_Z_NV 0x9354 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Z_NV 0x9355 +#define GL_VIEWPORT_SWIZZLE_POSITIVE_W_NV 0x9356 +#define GL_VIEWPORT_SWIZZLE_NEGATIVE_W_NV 0x9357 +#define GL_VIEWPORT_SWIZZLE_X_NV 0x9358 +#define GL_VIEWPORT_SWIZZLE_Y_NV 0x9359 +#define GL_VIEWPORT_SWIZZLE_Z_NV 0x935A +#define GL_VIEWPORT_SWIZZLE_W_NV 0x935B +typedef void (GL_APIENTRYP PFNGLVIEWPORTSWIZZLENVPROC) (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glViewportSwizzleNV (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew); +#endif +#endif /* GL_NV_viewport_swizzle */ + +#ifndef GL_OVR_multiview +#define GL_OVR_multiview 1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632 +#define GL_MAX_VIEWS_OVR 0x9631 +#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTextureMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews); +#endif +#endif /* GL_OVR_multiview */ + +#ifndef GL_OVR_multiview2 +#define GL_OVR_multiview2 1 +#endif /* GL_OVR_multiview2 */ + +#ifndef GL_OVR_multiview_multisampled_render_to_texture +#define GL_OVR_multiview_multisampled_render_to_texture 1 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferTextureMultisampleMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews); +#endif +#endif /* GL_OVR_multiview_multisampled_render_to_texture */ + +#ifndef GL_QCOM_alpha_test +#define GL_QCOM_alpha_test 1 +#define GL_ALPHA_TEST_QCOM 0x0BC0 +#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1 +#define GL_ALPHA_TEST_REF_QCOM 0x0BC2 +typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref); +#endif +#endif /* GL_QCOM_alpha_test */ + +#ifndef GL_QCOM_binning_control +#define GL_QCOM_binning_control 1 +#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0 +#define GL_CPU_OPTIMIZED_QCOM 0x8FB1 +#define GL_GPU_OPTIMIZED_QCOM 0x8FB2 +#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3 +#endif /* GL_QCOM_binning_control */ + +#ifndef GL_QCOM_driver_control +#define GL_QCOM_driver_control 1 +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls); +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls); +GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl); +GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl); +#endif +#endif /* GL_QCOM_driver_control */ + +#ifndef GL_QCOM_extended_get +#define GL_QCOM_extended_get 1 +#define GL_TEXTURE_WIDTH_QCOM 0x8BD2 +#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3 +#define GL_TEXTURE_DEPTH_QCOM 0x8BD4 +#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5 +#define GL_TEXTURE_FORMAT_QCOM 0x8BD6 +#define GL_TEXTURE_TYPE_QCOM 0x8BD7 +#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8 +#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9 +#define GL_TEXTURE_TARGET_QCOM 0x8BDA +#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB +#define GL_STATE_RESTORE 0x8BDC +typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, void **params); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures); +GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels); +GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, void **params); +#endif +#endif /* GL_QCOM_extended_get */ + +#ifndef GL_QCOM_extended_get2 +#define GL_QCOM_extended_get2 1 +typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders); +GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program); +GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length); +#endif +#endif /* GL_QCOM_extended_get2 */ + +#ifndef GL_QCOM_framebuffer_foveated +#define GL_QCOM_framebuffer_foveated 1 +#define GL_FOVEATION_ENABLE_BIT_QCOM 0x00000001 +#define GL_FOVEATION_SCALED_BIN_METHOD_BIT_QCOM 0x00000002 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFOVEATIONCONFIGQCOMPROC) (GLuint framebuffer, GLuint numLayers, GLuint focalPointsPerLayer, GLuint requestedFeatures, GLuint *providedFeatures); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFOVEATIONPARAMETERSQCOMPROC) (GLuint framebuffer, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferFoveationConfigQCOM (GLuint framebuffer, GLuint numLayers, GLuint focalPointsPerLayer, GLuint requestedFeatures, GLuint *providedFeatures); +GL_APICALL void GL_APIENTRY glFramebufferFoveationParametersQCOM (GLuint framebuffer, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea); +#endif +#endif /* GL_QCOM_framebuffer_foveated */ + +#ifndef GL_QCOM_perfmon_global_mode +#define GL_QCOM_perfmon_global_mode 1 +#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 +#endif /* GL_QCOM_perfmon_global_mode */ + +#ifndef GL_QCOM_shader_framebuffer_fetch_noncoherent +#define GL_QCOM_shader_framebuffer_fetch_noncoherent 1 +#define GL_FRAMEBUFFER_FETCH_NONCOHERENT_QCOM 0x96A2 +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFETCHBARRIERQCOMPROC) (void); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glFramebufferFetchBarrierQCOM (void); +#endif +#endif /* GL_QCOM_shader_framebuffer_fetch_noncoherent */ + +#ifndef GL_QCOM_tiled_rendering +#define GL_QCOM_tiled_rendering 1 +#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001 +#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002 +#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004 +#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008 +#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010 +#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020 +#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040 +#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080 +#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100 +#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200 +#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400 +#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800 +#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000 +#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000 +#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000 +#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000 +#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000 +#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000 +#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000 +#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000 +#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000 +#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000 +#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000 +#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000 +#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000 +#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000 +#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000 +#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000 +#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000 +#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000 +#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000 +#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000 +typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask); +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask); +#endif +#endif /* GL_QCOM_tiled_rendering */ + +#ifndef GL_QCOM_writeonly_rendering +#define GL_QCOM_writeonly_rendering 1 +#define GL_WRITEONLY_RENDERING_QCOM 0x8823 +#endif /* GL_QCOM_writeonly_rendering */ + +#ifndef GL_VIV_shader_binary +#define GL_VIV_shader_binary 1 +#define GL_SHADER_BINARY_VIV 0x8FC4 +#endif /* GL_VIV_shader_binary */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Engine/lib/sdl/src/video/khronos/GLES2/gl2platform.h b/Engine/lib/sdl/src/video/khronos/GLES2/gl2platform.h new file mode 100644 index 000000000..eb318dc3a --- /dev/null +++ b/Engine/lib/sdl/src/video/khronos/GLES2/gl2platform.h @@ -0,0 +1,38 @@ +#ifndef __gl2platform_h_ +#define __gl2platform_h_ + +/* +** Copyright (c) 2017 The Khronos Group Inc. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h + * + * Adopters may modify khrplatform.h and this file to suit their platform. + * Please contribute modifications back to Khronos as pull requests on the + * public github repository: + * https://github.com/KhronosGroup/OpenGL-Registry + */ + +#include + +#ifndef GL_APICALL +#define GL_APICALL KHRONOS_APICALL +#endif + +#ifndef GL_APIENTRY +#define GL_APIENTRY KHRONOS_APIENTRY +#endif + +#endif /* __gl2platform_h_ */ diff --git a/Engine/lib/sdl/src/video/khronos/KHR/khrplatform.h b/Engine/lib/sdl/src/video/khronos/KHR/khrplatform.h new file mode 100644 index 000000000..1ad3554a7 --- /dev/null +++ b/Engine/lib/sdl/src/video/khronos/KHR/khrplatform.h @@ -0,0 +1,284 @@ +#ifndef __khrplatform_h_ +#define __khrplatform_h_ + +/* +** Copyright (c) 2008-2009 The Khronos Group Inc. +** +** Permission is hereby granted, free of charge, to any person obtaining a +** copy of this software and/or associated documentation files (the +** "Materials"), to deal in the Materials without restriction, including +** without limitation the rights to use, copy, modify, merge, publish, +** distribute, sublicense, and/or sell copies of the Materials, and to +** permit persons to whom the Materials are furnished to do so, subject to +** the following conditions: +** +** The above copyright notice and this permission notice shall be included +** in all copies or substantial portions of the Materials. +** +** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. +*/ + +/* Khronos platform-specific types and definitions. + * + * $Revision: 32517 $ on $Date: 2016-03-11 02:41:19 -0800 (Fri, 11 Mar 2016) $ + * + * Adopters may modify this file to suit their platform. Adopters are + * encouraged to submit platform specific modifications to the Khronos + * group so that they can be included in future versions of this file. + * Please submit changes by sending them to the public Khronos Bugzilla + * (http://khronos.org/bugzilla) by filing a bug against product + * "Khronos (general)" component "Registry". + * + * A predefined template which fills in some of the bug fields can be + * reached using http://tinyurl.com/khrplatform-h-bugreport, but you + * must create a Bugzilla login first. + * + * + * See the Implementer's Guidelines for information about where this file + * should be located on your system and for more details of its use: + * http://www.khronos.org/registry/implementers_guide.pdf + * + * This file should be included as + * #include + * by Khronos client API header files that use its types and defines. + * + * The types in khrplatform.h should only be used to define API-specific types. + * + * Types defined in khrplatform.h: + * khronos_int8_t signed 8 bit + * khronos_uint8_t unsigned 8 bit + * khronos_int16_t signed 16 bit + * khronos_uint16_t unsigned 16 bit + * khronos_int32_t signed 32 bit + * khronos_uint32_t unsigned 32 bit + * khronos_int64_t signed 64 bit + * khronos_uint64_t unsigned 64 bit + * khronos_intptr_t signed same number of bits as a pointer + * khronos_uintptr_t unsigned same number of bits as a pointer + * khronos_ssize_t signed size + * khronos_usize_t unsigned size + * khronos_float_t signed 32 bit floating point + * khronos_time_ns_t unsigned 64 bit time in nanoseconds + * khronos_utime_nanoseconds_t unsigned time interval or absolute time in + * nanoseconds + * khronos_stime_nanoseconds_t signed time interval in nanoseconds + * khronos_boolean_enum_t enumerated boolean type. This should + * only be used as a base type when a client API's boolean type is + * an enum. Client APIs which use an integer or other type for + * booleans cannot use this as the base type for their boolean. + * + * Tokens defined in khrplatform.h: + * + * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. + * + * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. + * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. + * + * Calling convention macros defined in this file: + * KHRONOS_APICALL + * KHRONOS_APIENTRY + * KHRONOS_APIATTRIBUTES + * + * These may be used in function prototypes as: + * + * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( + * int arg1, + * int arg2) KHRONOS_APIATTRIBUTES; + */ + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APICALL + *------------------------------------------------------------------------- + * This precedes the return type of the function in the function prototype. + */ +#if defined(_WIN32) && !defined(__SCITECH_SNAP__) +# define KHRONOS_APICALL __declspec(dllimport) +#elif defined (__SYMBIAN32__) +# define KHRONOS_APICALL IMPORT_C +#elif defined(__ANDROID__) +# define KHRONOS_APICALL __attribute__((visibility("default"))) +#else +# define KHRONOS_APICALL +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIENTRY + *------------------------------------------------------------------------- + * This follows the return type of the function and precedes the function + * name in the function prototype. + */ +#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__) + /* Win32 but not WinCE */ +# define KHRONOS_APIENTRY __stdcall +#else +# define KHRONOS_APIENTRY +#endif + +/*------------------------------------------------------------------------- + * Definition of KHRONOS_APIATTRIBUTES + *------------------------------------------------------------------------- + * This follows the closing parenthesis of the function prototype arguments. + */ +#if defined (__ARMCC_2__) +#define KHRONOS_APIATTRIBUTES __softfp +#else +#define KHRONOS_APIATTRIBUTES +#endif + +/*------------------------------------------------------------------------- + * basic type definitions + *-----------------------------------------------------------------------*/ +#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__) + + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__VMS ) || defined(__sgi) + +/* + * Using + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(_WIN32) && !defined(__SCITECH_SNAP__) + +/* + * Win32 + */ +typedef __int32 khronos_int32_t; +typedef unsigned __int32 khronos_uint32_t; +typedef __int64 khronos_int64_t; +typedef unsigned __int64 khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif defined(__sun__) || defined(__digital__) + +/* + * Sun or Digital + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#if defined(__arch64__) || defined(_LP64) +typedef long int khronos_int64_t; +typedef unsigned long int khronos_uint64_t; +#else +typedef long long int khronos_int64_t; +typedef unsigned long long int khronos_uint64_t; +#endif /* __arch64__ */ +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#elif 0 + +/* + * Hypothetical platform with no float or int64 support + */ +typedef int khronos_int32_t; +typedef unsigned int khronos_uint32_t; +#define KHRONOS_SUPPORT_INT64 0 +#define KHRONOS_SUPPORT_FLOAT 0 + +#else + +/* + * Generic fallback + */ +#include +typedef int32_t khronos_int32_t; +typedef uint32_t khronos_uint32_t; +typedef int64_t khronos_int64_t; +typedef uint64_t khronos_uint64_t; +#define KHRONOS_SUPPORT_INT64 1 +#define KHRONOS_SUPPORT_FLOAT 1 + +#endif + + +/* + * Types that are (so far) the same on all platforms + */ +typedef signed char khronos_int8_t; +typedef unsigned char khronos_uint8_t; +typedef signed short int khronos_int16_t; +typedef unsigned short int khronos_uint16_t; + +/* + * Types that differ between LLP64 and LP64 architectures - in LLP64, + * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears + * to be the only LLP64 architecture in current use. + */ +#ifdef _WIN64 +typedef signed long long int khronos_intptr_t; +typedef unsigned long long int khronos_uintptr_t; +typedef signed long long int khronos_ssize_t; +typedef unsigned long long int khronos_usize_t; +#else +typedef signed long int khronos_intptr_t; +typedef unsigned long int khronos_uintptr_t; +typedef signed long int khronos_ssize_t; +typedef unsigned long int khronos_usize_t; +#endif + +#if KHRONOS_SUPPORT_FLOAT +/* + * Float type + */ +typedef float khronos_float_t; +#endif + +#if KHRONOS_SUPPORT_INT64 +/* Time types + * + * These types can be used to represent a time interval in nanoseconds or + * an absolute Unadjusted System Time. Unadjusted System Time is the number + * of nanoseconds since some arbitrary system event (e.g. since the last + * time the system booted). The Unadjusted System Time is an unsigned + * 64 bit value that wraps back to 0 every 584 years. Time intervals + * may be either signed or unsigned. + */ +typedef khronos_uint64_t khronos_utime_nanoseconds_t; +typedef khronos_int64_t khronos_stime_nanoseconds_t; +#endif + +/* + * Dummy value used to pad enum types to 32 bits. + */ +#ifndef KHRONOS_MAX_ENUM +#define KHRONOS_MAX_ENUM 0x7FFFFFFF +#endif + +/* + * Enumerated boolean type + * + * Values other than zero should be considered to be true. Therefore + * comparisons should not be made against KHRONOS_TRUE. + */ +typedef enum { + KHRONOS_FALSE = 0, + KHRONOS_TRUE = 1, + KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM +} khronos_boolean_enum_t; + +#endif /* __khrplatform_h_ */ diff --git a/Engine/lib/sdl/src/video/khronos/vulkan/vk_platform.h b/Engine/lib/sdl/src/video/khronos/vulkan/vk_platform.h new file mode 100644 index 000000000..72f80493c --- /dev/null +++ b/Engine/lib/sdl/src/video/khronos/vulkan/vk_platform.h @@ -0,0 +1,120 @@ +// +// File: vk_platform.h +// +/* +** Copyright (c) 2014-2017 The Khronos Group Inc. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + + +#ifndef VK_PLATFORM_H_ +#define VK_PLATFORM_H_ + +#ifdef __cplusplus +extern "C" +{ +#endif // __cplusplus + +/* +*************************************************************************************************** +* Platform-specific directives and type declarations +*************************************************************************************************** +*/ + +/* Platform-specific calling convention macros. + * + * Platforms should define these so that Vulkan clients call Vulkan commands + * with the same calling conventions that the Vulkan implementation expects. + * + * VKAPI_ATTR - Placed before the return type in function declarations. + * Useful for C++11 and GCC/Clang-style function attribute syntax. + * VKAPI_CALL - Placed after the return type in function declarations. + * Useful for MSVC-style calling convention syntax. + * VKAPI_PTR - Placed between the '(' and '*' in function pointer types. + * + * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void); + * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); + */ +#if defined(_WIN32) + // On Windows, Vulkan commands use the stdcall convention + #define VKAPI_ATTR + #define VKAPI_CALL __stdcall + #define VKAPI_PTR VKAPI_CALL +#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 + #error "Vulkan isn't supported for the 'armeabi' NDK ABI" +#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) + // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" + // calling convention, i.e. float parameters are passed in registers. This + // is true even if the rest of the application passes floats on the stack, + // as it does by default when compiling for the armeabi-v7a NDK ABI. + #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) + #define VKAPI_CALL + #define VKAPI_PTR VKAPI_ATTR +#else + // On other platforms, use the default calling convention + #define VKAPI_ATTR + #define VKAPI_CALL + #define VKAPI_PTR +#endif + +#include + +#if !defined(VK_NO_STDINT_H) + #if defined(_MSC_VER) && (_MSC_VER < 1600) + typedef signed __int8 int8_t; + typedef unsigned __int8 uint8_t; + typedef signed __int16 int16_t; + typedef unsigned __int16 uint16_t; + typedef signed __int32 int32_t; + typedef unsigned __int32 uint32_t; + typedef signed __int64 int64_t; + typedef unsigned __int64 uint64_t; + #else + #include + #endif +#endif // !defined(VK_NO_STDINT_H) + +#ifdef __cplusplus +} // extern "C" +#endif // __cplusplus + +// Platform-specific headers required by platform window system extensions. +// These are enabled prior to #including "vulkan.h". The same enable then +// controls inclusion of the extension interfaces in vulkan.h. + +#ifdef VK_USE_PLATFORM_ANDROID_KHR +#include +#endif + +#ifdef VK_USE_PLATFORM_MIR_KHR +#include +#endif + +#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#include +#endif + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#include +#endif + +#ifdef VK_USE_PLATFORM_XLIB_KHR +#include +#endif + +#ifdef VK_USE_PLATFORM_XCB_KHR +#include +#endif + +#endif diff --git a/Engine/lib/sdl/src/video/khronos/vulkan/vulkan.h b/Engine/lib/sdl/src/video/khronos/vulkan/vulkan.h new file mode 100644 index 000000000..04495fa0c --- /dev/null +++ b/Engine/lib/sdl/src/video/khronos/vulkan/vulkan.h @@ -0,0 +1,6458 @@ +#ifndef VULKAN_H_ +#define VULKAN_H_ 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* +** Copyright (c) 2015-2017 The Khronos Group Inc. +** +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at +** +** http://www.apache.org/licenses/LICENSE-2.0 +** +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and +** limitations under the License. +*/ + +/* +** This header is generated from the Khronos Vulkan XML API Registry. +** +*/ + + +#define VK_VERSION_1_0 1 +#include "./vk_platform.h" + +#define VK_MAKE_VERSION(major, minor, patch) \ + (((major) << 22) | ((minor) << 12) | (patch)) + +// DEPRECATED: This define has been removed. Specific version defines (e.g. VK_API_VERSION_1_0), or the VK_MAKE_VERSION macro, should be used instead. +//#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 0) // Patch version should always be set to 0 + +// Vulkan 1.0 version number +#define VK_API_VERSION_1_0 VK_MAKE_VERSION(1, 0, 0)// Patch version should always be set to 0 + +#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22) +#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff) +#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff) +// Version of this file +#define VK_HEADER_VERSION 59 + + +#define VK_NULL_HANDLE 0 + + + +#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; + + +#if !defined(VK_DEFINE_NON_DISPATCHABLE_HANDLE) +#if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) + #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object; +#else + #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object; +#endif +#endif + + + +typedef uint32_t VkFlags; +typedef uint32_t VkBool32; +typedef uint64_t VkDeviceSize; +typedef uint32_t VkSampleMask; + +VK_DEFINE_HANDLE(VkInstance) +VK_DEFINE_HANDLE(VkPhysicalDevice) +VK_DEFINE_HANDLE(VkDevice) +VK_DEFINE_HANDLE(VkQueue) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSemaphore) +VK_DEFINE_HANDLE(VkCommandBuffer) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFence) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDeviceMemory) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBuffer) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImage) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkEvent) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkQueryPool) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferView) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImageView) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkShaderModule) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineCache) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineLayout) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkRenderPass) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipeline) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSetLayout) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSampler) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorPool) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSet) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFramebuffer) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCommandPool) + +#define VK_LOD_CLAMP_NONE 1000.0f +#define VK_REMAINING_MIP_LEVELS (~0U) +#define VK_REMAINING_ARRAY_LAYERS (~0U) +#define VK_WHOLE_SIZE (~0ULL) +#define VK_ATTACHMENT_UNUSED (~0U) +#define VK_TRUE 1 +#define VK_FALSE 0 +#define VK_QUEUE_FAMILY_IGNORED (~0U) +#define VK_SUBPASS_EXTERNAL (~0U) +#define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256 +#define VK_UUID_SIZE 16 +#define VK_MAX_MEMORY_TYPES 32 +#define VK_MAX_MEMORY_HEAPS 16 +#define VK_MAX_EXTENSION_NAME_SIZE 256 +#define VK_MAX_DESCRIPTION_SIZE 256 + + +typedef enum VkPipelineCacheHeaderVersion { + VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1, + VK_PIPELINE_CACHE_HEADER_VERSION_BEGIN_RANGE = VK_PIPELINE_CACHE_HEADER_VERSION_ONE, + VK_PIPELINE_CACHE_HEADER_VERSION_END_RANGE = VK_PIPELINE_CACHE_HEADER_VERSION_ONE, + VK_PIPELINE_CACHE_HEADER_VERSION_RANGE_SIZE = (VK_PIPELINE_CACHE_HEADER_VERSION_ONE - VK_PIPELINE_CACHE_HEADER_VERSION_ONE + 1), + VK_PIPELINE_CACHE_HEADER_VERSION_MAX_ENUM = 0x7FFFFFFF +} VkPipelineCacheHeaderVersion; + +typedef enum VkResult { + VK_SUCCESS = 0, + VK_NOT_READY = 1, + VK_TIMEOUT = 2, + VK_EVENT_SET = 3, + VK_EVENT_RESET = 4, + VK_INCOMPLETE = 5, + VK_ERROR_OUT_OF_HOST_MEMORY = -1, + VK_ERROR_OUT_OF_DEVICE_MEMORY = -2, + VK_ERROR_INITIALIZATION_FAILED = -3, + VK_ERROR_DEVICE_LOST = -4, + VK_ERROR_MEMORY_MAP_FAILED = -5, + VK_ERROR_LAYER_NOT_PRESENT = -6, + VK_ERROR_EXTENSION_NOT_PRESENT = -7, + VK_ERROR_FEATURE_NOT_PRESENT = -8, + VK_ERROR_INCOMPATIBLE_DRIVER = -9, + VK_ERROR_TOO_MANY_OBJECTS = -10, + VK_ERROR_FORMAT_NOT_SUPPORTED = -11, + VK_ERROR_FRAGMENTED_POOL = -12, + VK_ERROR_SURFACE_LOST_KHR = -1000000000, + VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001, + VK_SUBOPTIMAL_KHR = 1000001003, + VK_ERROR_OUT_OF_DATE_KHR = -1000001004, + VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001, + VK_ERROR_VALIDATION_FAILED_EXT = -1000011001, + VK_ERROR_INVALID_SHADER_NV = -1000012000, + VK_ERROR_OUT_OF_POOL_MEMORY_KHR = -1000069000, + VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR = -1000072003, + VK_RESULT_BEGIN_RANGE = VK_ERROR_FRAGMENTED_POOL, + VK_RESULT_END_RANGE = VK_INCOMPLETE, + VK_RESULT_RANGE_SIZE = (VK_INCOMPLETE - VK_ERROR_FRAGMENTED_POOL + 1), + VK_RESULT_MAX_ENUM = 0x7FFFFFFF +} VkResult; + +typedef enum VkStructureType { + VK_STRUCTURE_TYPE_APPLICATION_INFO = 0, + VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1, + VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2, + VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3, + VK_STRUCTURE_TYPE_SUBMIT_INFO = 4, + VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO = 5, + VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 6, + VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 7, + VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 8, + VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 9, + VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10, + VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11, + VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12, + VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13, + VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14, + VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15, + VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16, + VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 17, + VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 18, + VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 19, + VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 20, + VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 21, + VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 22, + VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = 23, + VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 24, + VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 25, + VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 26, + VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 27, + VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 28, + VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 29, + VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 30, + VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 31, + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 32, + VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33, + VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO = 34, + VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 35, + VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 36, + VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 37, + VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 38, + VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = 39, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO = 40, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO = 41, + VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = 42, + VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43, + VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 44, + VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 45, + VK_STRUCTURE_TYPE_MEMORY_BARRIER = 46, + VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO = 47, + VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO = 48, + VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 1000001000, + VK_STRUCTURE_TYPE_PRESENT_INFO_KHR = 1000001001, + VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR = 1000002000, + VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR = 1000002001, + VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR = 1000003000, + VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000, + VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000, + VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000, + VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR = 1000007000, + VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000, + VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000, + VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT = 1000011000, + VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD = 1000018000, + VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT = 1000022000, + VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT = 1000022001, + VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT = 1000022002, + VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = 1000026000, + VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = 1000026001, + VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = 1000026002, + VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD = 1000041000, + VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO_KHX = 1000053000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHX = 1000053001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHX = 1000053002, + VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV = 1000056000, + VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV = 1000056001, + VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057000, + VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057001, + VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV = 1000058000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR = 1000059000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR = 1000059001, + VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR = 1000059002, + VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHR = 1000059003, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHR = 1000059004, + VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2_KHR = 1000059005, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR = 1000059006, + VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2_KHR = 1000059007, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2_KHR = 1000059008, + VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHX = 1000060000, + VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHX = 1000060001, + VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHX = 1000060002, + VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO_KHX = 1000060003, + VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO_KHX = 1000060004, + VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO_KHX = 1000060005, + VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO_KHX = 1000060006, + VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHX = 1000060007, + VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHX = 1000060008, + VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHX = 1000060009, + VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHX = 1000060010, + VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHX = 1000060011, + VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHX = 1000060012, + VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT = 1000061000, + VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN = 1000062000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHX = 1000070000, + VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO_KHX = 1000070001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO_KHR = 1000071000, + VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES_KHR = 1000071001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO_KHR = 1000071002, + VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES_KHR = 1000071003, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHR = 1000071004, + VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO_KHR = 1000072000, + VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHR = 1000072001, + VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR = 1000072002, + VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073000, + VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073001, + VK_STRUCTURE_TYPE_MEMORY_WIN32_HANDLE_PROPERTIES_KHR = 1000073002, + VK_STRUCTURE_TYPE_MEMORY_GET_WIN32_HANDLE_INFO_KHR = 1000073003, + VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR = 1000074000, + VK_STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHR = 1000074001, + VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR = 1000074002, + VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR = 1000075000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO_KHR = 1000076000, + VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES_KHR = 1000076001, + VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO_KHR = 1000077000, + VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = 1000078000, + VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = 1000078001, + VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR = 1000078002, + VK_STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR = 1000078003, + VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR = 1000079000, + VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR = 1000079001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR = 1000080000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR = 1000083000, + VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR = 1000084000, + VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO_KHR = 1000085000, + VK_STRUCTURE_TYPE_OBJECT_TABLE_CREATE_INFO_NVX = 1000086000, + VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NVX = 1000086001, + VK_STRUCTURE_TYPE_CMD_PROCESS_COMMANDS_INFO_NVX = 1000086002, + VK_STRUCTURE_TYPE_CMD_RESERVE_SPACE_FOR_COMMANDS_INFO_NVX = 1000086003, + VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_LIMITS_NVX = 1000086004, + VK_STRUCTURE_TYPE_DEVICE_GENERATED_COMMANDS_FEATURES_NVX = 1000086005, + VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV = 1000087000, + VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT = 1000090000, + VK_STRUCTURE_TYPE_DISPLAY_POWER_INFO_EXT = 1000091000, + VK_STRUCTURE_TYPE_DEVICE_EVENT_INFO_EXT = 1000091001, + VK_STRUCTURE_TYPE_DISPLAY_EVENT_INFO_EXT = 1000091002, + VK_STRUCTURE_TYPE_SWAPCHAIN_COUNTER_CREATE_INFO_EXT = 1000091003, + VK_STRUCTURE_TYPE_PRESENT_TIMES_INFO_GOOGLE = 1000092000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_ATTRIBUTES_PROPERTIES_NVX = 1000097000, + VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV = 1000098000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT = 1000099000, + VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT = 1000099001, + VK_STRUCTURE_TYPE_HDR_METADATA_EXT = 1000105000, + VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR = 1000111000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO_KHR = 1000112000, + VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES_KHR = 1000112001, + VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO_KHR = 1000113000, + VK_STRUCTURE_TYPE_IMPORT_FENCE_WIN32_HANDLE_INFO_KHR = 1000114000, + VK_STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR = 1000114001, + VK_STRUCTURE_TYPE_FENCE_GET_WIN32_HANDLE_INFO_KHR = 1000114002, + VK_STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR = 1000115000, + VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR = 1000115001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR = 1000119000, + VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR = 1000119001, + VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR = 1000119002, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR = 1000120000, + VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK = 1000122000, + VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000, + VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR = 1000127000, + VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR = 1000127001, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT = 1000130000, + VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO_EXT = 1000130001, + VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR = 1000146000, + VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR = 1000146001, + VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2_KHR = 1000146002, + VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR = 1000146003, + VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2_KHR = 1000146004, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT = 1000148000, + VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT = 1000148001, + VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT = 1000148002, + VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV = 1000149000, + VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV = 1000152000, + VK_STRUCTURE_TYPE_BEGIN_RANGE = VK_STRUCTURE_TYPE_APPLICATION_INFO, + VK_STRUCTURE_TYPE_END_RANGE = VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO, + VK_STRUCTURE_TYPE_RANGE_SIZE = (VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO - VK_STRUCTURE_TYPE_APPLICATION_INFO + 1), + VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkStructureType; + +typedef enum VkSystemAllocationScope { + VK_SYSTEM_ALLOCATION_SCOPE_COMMAND = 0, + VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = 1, + VK_SYSTEM_ALLOCATION_SCOPE_CACHE = 2, + VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = 3, + VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 4, + VK_SYSTEM_ALLOCATION_SCOPE_BEGIN_RANGE = VK_SYSTEM_ALLOCATION_SCOPE_COMMAND, + VK_SYSTEM_ALLOCATION_SCOPE_END_RANGE = VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE, + VK_SYSTEM_ALLOCATION_SCOPE_RANGE_SIZE = (VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE - VK_SYSTEM_ALLOCATION_SCOPE_COMMAND + 1), + VK_SYSTEM_ALLOCATION_SCOPE_MAX_ENUM = 0x7FFFFFFF +} VkSystemAllocationScope; + +typedef enum VkInternalAllocationType { + VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0, + VK_INTERNAL_ALLOCATION_TYPE_BEGIN_RANGE = VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE, + VK_INTERNAL_ALLOCATION_TYPE_END_RANGE = VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE, + VK_INTERNAL_ALLOCATION_TYPE_RANGE_SIZE = (VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE - VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE + 1), + VK_INTERNAL_ALLOCATION_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkInternalAllocationType; + +typedef enum VkFormat { + VK_FORMAT_UNDEFINED = 0, + VK_FORMAT_R4G4_UNORM_PACK8 = 1, + VK_FORMAT_R4G4B4A4_UNORM_PACK16 = 2, + VK_FORMAT_B4G4R4A4_UNORM_PACK16 = 3, + VK_FORMAT_R5G6B5_UNORM_PACK16 = 4, + VK_FORMAT_B5G6R5_UNORM_PACK16 = 5, + VK_FORMAT_R5G5B5A1_UNORM_PACK16 = 6, + VK_FORMAT_B5G5R5A1_UNORM_PACK16 = 7, + VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8, + VK_FORMAT_R8_UNORM = 9, + VK_FORMAT_R8_SNORM = 10, + VK_FORMAT_R8_USCALED = 11, + VK_FORMAT_R8_SSCALED = 12, + VK_FORMAT_R8_UINT = 13, + VK_FORMAT_R8_SINT = 14, + VK_FORMAT_R8_SRGB = 15, + VK_FORMAT_R8G8_UNORM = 16, + VK_FORMAT_R8G8_SNORM = 17, + VK_FORMAT_R8G8_USCALED = 18, + VK_FORMAT_R8G8_SSCALED = 19, + VK_FORMAT_R8G8_UINT = 20, + VK_FORMAT_R8G8_SINT = 21, + VK_FORMAT_R8G8_SRGB = 22, + VK_FORMAT_R8G8B8_UNORM = 23, + VK_FORMAT_R8G8B8_SNORM = 24, + VK_FORMAT_R8G8B8_USCALED = 25, + VK_FORMAT_R8G8B8_SSCALED = 26, + VK_FORMAT_R8G8B8_UINT = 27, + VK_FORMAT_R8G8B8_SINT = 28, + VK_FORMAT_R8G8B8_SRGB = 29, + VK_FORMAT_B8G8R8_UNORM = 30, + VK_FORMAT_B8G8R8_SNORM = 31, + VK_FORMAT_B8G8R8_USCALED = 32, + VK_FORMAT_B8G8R8_SSCALED = 33, + VK_FORMAT_B8G8R8_UINT = 34, + VK_FORMAT_B8G8R8_SINT = 35, + VK_FORMAT_B8G8R8_SRGB = 36, + VK_FORMAT_R8G8B8A8_UNORM = 37, + VK_FORMAT_R8G8B8A8_SNORM = 38, + VK_FORMAT_R8G8B8A8_USCALED = 39, + VK_FORMAT_R8G8B8A8_SSCALED = 40, + VK_FORMAT_R8G8B8A8_UINT = 41, + VK_FORMAT_R8G8B8A8_SINT = 42, + VK_FORMAT_R8G8B8A8_SRGB = 43, + VK_FORMAT_B8G8R8A8_UNORM = 44, + VK_FORMAT_B8G8R8A8_SNORM = 45, + VK_FORMAT_B8G8R8A8_USCALED = 46, + VK_FORMAT_B8G8R8A8_SSCALED = 47, + VK_FORMAT_B8G8R8A8_UINT = 48, + VK_FORMAT_B8G8R8A8_SINT = 49, + VK_FORMAT_B8G8R8A8_SRGB = 50, + VK_FORMAT_A8B8G8R8_UNORM_PACK32 = 51, + VK_FORMAT_A8B8G8R8_SNORM_PACK32 = 52, + VK_FORMAT_A8B8G8R8_USCALED_PACK32 = 53, + VK_FORMAT_A8B8G8R8_SSCALED_PACK32 = 54, + VK_FORMAT_A8B8G8R8_UINT_PACK32 = 55, + VK_FORMAT_A8B8G8R8_SINT_PACK32 = 56, + VK_FORMAT_A8B8G8R8_SRGB_PACK32 = 57, + VK_FORMAT_A2R10G10B10_UNORM_PACK32 = 58, + VK_FORMAT_A2R10G10B10_SNORM_PACK32 = 59, + VK_FORMAT_A2R10G10B10_USCALED_PACK32 = 60, + VK_FORMAT_A2R10G10B10_SSCALED_PACK32 = 61, + VK_FORMAT_A2R10G10B10_UINT_PACK32 = 62, + VK_FORMAT_A2R10G10B10_SINT_PACK32 = 63, + VK_FORMAT_A2B10G10R10_UNORM_PACK32 = 64, + VK_FORMAT_A2B10G10R10_SNORM_PACK32 = 65, + VK_FORMAT_A2B10G10R10_USCALED_PACK32 = 66, + VK_FORMAT_A2B10G10R10_SSCALED_PACK32 = 67, + VK_FORMAT_A2B10G10R10_UINT_PACK32 = 68, + VK_FORMAT_A2B10G10R10_SINT_PACK32 = 69, + VK_FORMAT_R16_UNORM = 70, + VK_FORMAT_R16_SNORM = 71, + VK_FORMAT_R16_USCALED = 72, + VK_FORMAT_R16_SSCALED = 73, + VK_FORMAT_R16_UINT = 74, + VK_FORMAT_R16_SINT = 75, + VK_FORMAT_R16_SFLOAT = 76, + VK_FORMAT_R16G16_UNORM = 77, + VK_FORMAT_R16G16_SNORM = 78, + VK_FORMAT_R16G16_USCALED = 79, + VK_FORMAT_R16G16_SSCALED = 80, + VK_FORMAT_R16G16_UINT = 81, + VK_FORMAT_R16G16_SINT = 82, + VK_FORMAT_R16G16_SFLOAT = 83, + VK_FORMAT_R16G16B16_UNORM = 84, + VK_FORMAT_R16G16B16_SNORM = 85, + VK_FORMAT_R16G16B16_USCALED = 86, + VK_FORMAT_R16G16B16_SSCALED = 87, + VK_FORMAT_R16G16B16_UINT = 88, + VK_FORMAT_R16G16B16_SINT = 89, + VK_FORMAT_R16G16B16_SFLOAT = 90, + VK_FORMAT_R16G16B16A16_UNORM = 91, + VK_FORMAT_R16G16B16A16_SNORM = 92, + VK_FORMAT_R16G16B16A16_USCALED = 93, + VK_FORMAT_R16G16B16A16_SSCALED = 94, + VK_FORMAT_R16G16B16A16_UINT = 95, + VK_FORMAT_R16G16B16A16_SINT = 96, + VK_FORMAT_R16G16B16A16_SFLOAT = 97, + VK_FORMAT_R32_UINT = 98, + VK_FORMAT_R32_SINT = 99, + VK_FORMAT_R32_SFLOAT = 100, + VK_FORMAT_R32G32_UINT = 101, + VK_FORMAT_R32G32_SINT = 102, + VK_FORMAT_R32G32_SFLOAT = 103, + VK_FORMAT_R32G32B32_UINT = 104, + VK_FORMAT_R32G32B32_SINT = 105, + VK_FORMAT_R32G32B32_SFLOAT = 106, + VK_FORMAT_R32G32B32A32_UINT = 107, + VK_FORMAT_R32G32B32A32_SINT = 108, + VK_FORMAT_R32G32B32A32_SFLOAT = 109, + VK_FORMAT_R64_UINT = 110, + VK_FORMAT_R64_SINT = 111, + VK_FORMAT_R64_SFLOAT = 112, + VK_FORMAT_R64G64_UINT = 113, + VK_FORMAT_R64G64_SINT = 114, + VK_FORMAT_R64G64_SFLOAT = 115, + VK_FORMAT_R64G64B64_UINT = 116, + VK_FORMAT_R64G64B64_SINT = 117, + VK_FORMAT_R64G64B64_SFLOAT = 118, + VK_FORMAT_R64G64B64A64_UINT = 119, + VK_FORMAT_R64G64B64A64_SINT = 120, + VK_FORMAT_R64G64B64A64_SFLOAT = 121, + VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122, + VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123, + VK_FORMAT_D16_UNORM = 124, + VK_FORMAT_X8_D24_UNORM_PACK32 = 125, + VK_FORMAT_D32_SFLOAT = 126, + VK_FORMAT_S8_UINT = 127, + VK_FORMAT_D16_UNORM_S8_UINT = 128, + VK_FORMAT_D24_UNORM_S8_UINT = 129, + VK_FORMAT_D32_SFLOAT_S8_UINT = 130, + VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131, + VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132, + VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133, + VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134, + VK_FORMAT_BC2_UNORM_BLOCK = 135, + VK_FORMAT_BC2_SRGB_BLOCK = 136, + VK_FORMAT_BC3_UNORM_BLOCK = 137, + VK_FORMAT_BC3_SRGB_BLOCK = 138, + VK_FORMAT_BC4_UNORM_BLOCK = 139, + VK_FORMAT_BC4_SNORM_BLOCK = 140, + VK_FORMAT_BC5_UNORM_BLOCK = 141, + VK_FORMAT_BC5_SNORM_BLOCK = 142, + VK_FORMAT_BC6H_UFLOAT_BLOCK = 143, + VK_FORMAT_BC6H_SFLOAT_BLOCK = 144, + VK_FORMAT_BC7_UNORM_BLOCK = 145, + VK_FORMAT_BC7_SRGB_BLOCK = 146, + VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147, + VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148, + VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149, + VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150, + VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151, + VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152, + VK_FORMAT_EAC_R11_UNORM_BLOCK = 153, + VK_FORMAT_EAC_R11_SNORM_BLOCK = 154, + VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155, + VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156, + VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157, + VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158, + VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159, + VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160, + VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161, + VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162, + VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163, + VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164, + VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165, + VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166, + VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167, + VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168, + VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169, + VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170, + VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171, + VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172, + VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173, + VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174, + VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175, + VK_FORMAT_ASTC_10x6_SRGB_BLOCK = 176, + VK_FORMAT_ASTC_10x8_UNORM_BLOCK = 177, + VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178, + VK_FORMAT_ASTC_10x10_UNORM_BLOCK = 179, + VK_FORMAT_ASTC_10x10_SRGB_BLOCK = 180, + VK_FORMAT_ASTC_12x10_UNORM_BLOCK = 181, + VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182, + VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183, + VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184, + VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = 1000054000, + VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = 1000054001, + VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = 1000054002, + VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = 1000054003, + VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = 1000054004, + VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005, + VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006, + VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007, + VK_FORMAT_BEGIN_RANGE = VK_FORMAT_UNDEFINED, + VK_FORMAT_END_RANGE = VK_FORMAT_ASTC_12x12_SRGB_BLOCK, + VK_FORMAT_RANGE_SIZE = (VK_FORMAT_ASTC_12x12_SRGB_BLOCK - VK_FORMAT_UNDEFINED + 1), + VK_FORMAT_MAX_ENUM = 0x7FFFFFFF +} VkFormat; + +typedef enum VkImageType { + VK_IMAGE_TYPE_1D = 0, + VK_IMAGE_TYPE_2D = 1, + VK_IMAGE_TYPE_3D = 2, + VK_IMAGE_TYPE_BEGIN_RANGE = VK_IMAGE_TYPE_1D, + VK_IMAGE_TYPE_END_RANGE = VK_IMAGE_TYPE_3D, + VK_IMAGE_TYPE_RANGE_SIZE = (VK_IMAGE_TYPE_3D - VK_IMAGE_TYPE_1D + 1), + VK_IMAGE_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkImageType; + +typedef enum VkImageTiling { + VK_IMAGE_TILING_OPTIMAL = 0, + VK_IMAGE_TILING_LINEAR = 1, + VK_IMAGE_TILING_BEGIN_RANGE = VK_IMAGE_TILING_OPTIMAL, + VK_IMAGE_TILING_END_RANGE = VK_IMAGE_TILING_LINEAR, + VK_IMAGE_TILING_RANGE_SIZE = (VK_IMAGE_TILING_LINEAR - VK_IMAGE_TILING_OPTIMAL + 1), + VK_IMAGE_TILING_MAX_ENUM = 0x7FFFFFFF +} VkImageTiling; + +typedef enum VkPhysicalDeviceType { + VK_PHYSICAL_DEVICE_TYPE_OTHER = 0, + VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 1, + VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 2, + VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 3, + VK_PHYSICAL_DEVICE_TYPE_CPU = 4, + VK_PHYSICAL_DEVICE_TYPE_BEGIN_RANGE = VK_PHYSICAL_DEVICE_TYPE_OTHER, + VK_PHYSICAL_DEVICE_TYPE_END_RANGE = VK_PHYSICAL_DEVICE_TYPE_CPU, + VK_PHYSICAL_DEVICE_TYPE_RANGE_SIZE = (VK_PHYSICAL_DEVICE_TYPE_CPU - VK_PHYSICAL_DEVICE_TYPE_OTHER + 1), + VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkPhysicalDeviceType; + +typedef enum VkQueryType { + VK_QUERY_TYPE_OCCLUSION = 0, + VK_QUERY_TYPE_PIPELINE_STATISTICS = 1, + VK_QUERY_TYPE_TIMESTAMP = 2, + VK_QUERY_TYPE_BEGIN_RANGE = VK_QUERY_TYPE_OCCLUSION, + VK_QUERY_TYPE_END_RANGE = VK_QUERY_TYPE_TIMESTAMP, + VK_QUERY_TYPE_RANGE_SIZE = (VK_QUERY_TYPE_TIMESTAMP - VK_QUERY_TYPE_OCCLUSION + 1), + VK_QUERY_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkQueryType; + +typedef enum VkSharingMode { + VK_SHARING_MODE_EXCLUSIVE = 0, + VK_SHARING_MODE_CONCURRENT = 1, + VK_SHARING_MODE_BEGIN_RANGE = VK_SHARING_MODE_EXCLUSIVE, + VK_SHARING_MODE_END_RANGE = VK_SHARING_MODE_CONCURRENT, + VK_SHARING_MODE_RANGE_SIZE = (VK_SHARING_MODE_CONCURRENT - VK_SHARING_MODE_EXCLUSIVE + 1), + VK_SHARING_MODE_MAX_ENUM = 0x7FFFFFFF +} VkSharingMode; + +typedef enum VkImageLayout { + VK_IMAGE_LAYOUT_UNDEFINED = 0, + VK_IMAGE_LAYOUT_GENERAL = 1, + VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL = 2, + VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 3, + VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL = 4, + VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 5, + VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL = 6, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL = 7, + VK_IMAGE_LAYOUT_PREINITIALIZED = 8, + VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002, + VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR = 1000111000, + VK_IMAGE_LAYOUT_BEGIN_RANGE = VK_IMAGE_LAYOUT_UNDEFINED, + VK_IMAGE_LAYOUT_END_RANGE = VK_IMAGE_LAYOUT_PREINITIALIZED, + VK_IMAGE_LAYOUT_RANGE_SIZE = (VK_IMAGE_LAYOUT_PREINITIALIZED - VK_IMAGE_LAYOUT_UNDEFINED + 1), + VK_IMAGE_LAYOUT_MAX_ENUM = 0x7FFFFFFF +} VkImageLayout; + +typedef enum VkImageViewType { + VK_IMAGE_VIEW_TYPE_1D = 0, + VK_IMAGE_VIEW_TYPE_2D = 1, + VK_IMAGE_VIEW_TYPE_3D = 2, + VK_IMAGE_VIEW_TYPE_CUBE = 3, + VK_IMAGE_VIEW_TYPE_1D_ARRAY = 4, + VK_IMAGE_VIEW_TYPE_2D_ARRAY = 5, + VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 6, + VK_IMAGE_VIEW_TYPE_BEGIN_RANGE = VK_IMAGE_VIEW_TYPE_1D, + VK_IMAGE_VIEW_TYPE_END_RANGE = VK_IMAGE_VIEW_TYPE_CUBE_ARRAY, + VK_IMAGE_VIEW_TYPE_RANGE_SIZE = (VK_IMAGE_VIEW_TYPE_CUBE_ARRAY - VK_IMAGE_VIEW_TYPE_1D + 1), + VK_IMAGE_VIEW_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkImageViewType; + +typedef enum VkComponentSwizzle { + VK_COMPONENT_SWIZZLE_IDENTITY = 0, + VK_COMPONENT_SWIZZLE_ZERO = 1, + VK_COMPONENT_SWIZZLE_ONE = 2, + VK_COMPONENT_SWIZZLE_R = 3, + VK_COMPONENT_SWIZZLE_G = 4, + VK_COMPONENT_SWIZZLE_B = 5, + VK_COMPONENT_SWIZZLE_A = 6, + VK_COMPONENT_SWIZZLE_BEGIN_RANGE = VK_COMPONENT_SWIZZLE_IDENTITY, + VK_COMPONENT_SWIZZLE_END_RANGE = VK_COMPONENT_SWIZZLE_A, + VK_COMPONENT_SWIZZLE_RANGE_SIZE = (VK_COMPONENT_SWIZZLE_A - VK_COMPONENT_SWIZZLE_IDENTITY + 1), + VK_COMPONENT_SWIZZLE_MAX_ENUM = 0x7FFFFFFF +} VkComponentSwizzle; + +typedef enum VkVertexInputRate { + VK_VERTEX_INPUT_RATE_VERTEX = 0, + VK_VERTEX_INPUT_RATE_INSTANCE = 1, + VK_VERTEX_INPUT_RATE_BEGIN_RANGE = VK_VERTEX_INPUT_RATE_VERTEX, + VK_VERTEX_INPUT_RATE_END_RANGE = VK_VERTEX_INPUT_RATE_INSTANCE, + VK_VERTEX_INPUT_RATE_RANGE_SIZE = (VK_VERTEX_INPUT_RATE_INSTANCE - VK_VERTEX_INPUT_RATE_VERTEX + 1), + VK_VERTEX_INPUT_RATE_MAX_ENUM = 0x7FFFFFFF +} VkVertexInputRate; + +typedef enum VkPrimitiveTopology { + VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0, + VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 1, + VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 2, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 3, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 4, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 5, + VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY = 6, + VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 7, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 8, + VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 9, + VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 10, + VK_PRIMITIVE_TOPOLOGY_BEGIN_RANGE = VK_PRIMITIVE_TOPOLOGY_POINT_LIST, + VK_PRIMITIVE_TOPOLOGY_END_RANGE = VK_PRIMITIVE_TOPOLOGY_PATCH_LIST, + VK_PRIMITIVE_TOPOLOGY_RANGE_SIZE = (VK_PRIMITIVE_TOPOLOGY_PATCH_LIST - VK_PRIMITIVE_TOPOLOGY_POINT_LIST + 1), + VK_PRIMITIVE_TOPOLOGY_MAX_ENUM = 0x7FFFFFFF +} VkPrimitiveTopology; + +typedef enum VkPolygonMode { + VK_POLYGON_MODE_FILL = 0, + VK_POLYGON_MODE_LINE = 1, + VK_POLYGON_MODE_POINT = 2, + VK_POLYGON_MODE_FILL_RECTANGLE_NV = 1000153000, + VK_POLYGON_MODE_BEGIN_RANGE = VK_POLYGON_MODE_FILL, + VK_POLYGON_MODE_END_RANGE = VK_POLYGON_MODE_POINT, + VK_POLYGON_MODE_RANGE_SIZE = (VK_POLYGON_MODE_POINT - VK_POLYGON_MODE_FILL + 1), + VK_POLYGON_MODE_MAX_ENUM = 0x7FFFFFFF +} VkPolygonMode; + +typedef enum VkFrontFace { + VK_FRONT_FACE_COUNTER_CLOCKWISE = 0, + VK_FRONT_FACE_CLOCKWISE = 1, + VK_FRONT_FACE_BEGIN_RANGE = VK_FRONT_FACE_COUNTER_CLOCKWISE, + VK_FRONT_FACE_END_RANGE = VK_FRONT_FACE_CLOCKWISE, + VK_FRONT_FACE_RANGE_SIZE = (VK_FRONT_FACE_CLOCKWISE - VK_FRONT_FACE_COUNTER_CLOCKWISE + 1), + VK_FRONT_FACE_MAX_ENUM = 0x7FFFFFFF +} VkFrontFace; + +typedef enum VkCompareOp { + VK_COMPARE_OP_NEVER = 0, + VK_COMPARE_OP_LESS = 1, + VK_COMPARE_OP_EQUAL = 2, + VK_COMPARE_OP_LESS_OR_EQUAL = 3, + VK_COMPARE_OP_GREATER = 4, + VK_COMPARE_OP_NOT_EQUAL = 5, + VK_COMPARE_OP_GREATER_OR_EQUAL = 6, + VK_COMPARE_OP_ALWAYS = 7, + VK_COMPARE_OP_BEGIN_RANGE = VK_COMPARE_OP_NEVER, + VK_COMPARE_OP_END_RANGE = VK_COMPARE_OP_ALWAYS, + VK_COMPARE_OP_RANGE_SIZE = (VK_COMPARE_OP_ALWAYS - VK_COMPARE_OP_NEVER + 1), + VK_COMPARE_OP_MAX_ENUM = 0x7FFFFFFF +} VkCompareOp; + +typedef enum VkStencilOp { + VK_STENCIL_OP_KEEP = 0, + VK_STENCIL_OP_ZERO = 1, + VK_STENCIL_OP_REPLACE = 2, + VK_STENCIL_OP_INCREMENT_AND_CLAMP = 3, + VK_STENCIL_OP_DECREMENT_AND_CLAMP = 4, + VK_STENCIL_OP_INVERT = 5, + VK_STENCIL_OP_INCREMENT_AND_WRAP = 6, + VK_STENCIL_OP_DECREMENT_AND_WRAP = 7, + VK_STENCIL_OP_BEGIN_RANGE = VK_STENCIL_OP_KEEP, + VK_STENCIL_OP_END_RANGE = VK_STENCIL_OP_DECREMENT_AND_WRAP, + VK_STENCIL_OP_RANGE_SIZE = (VK_STENCIL_OP_DECREMENT_AND_WRAP - VK_STENCIL_OP_KEEP + 1), + VK_STENCIL_OP_MAX_ENUM = 0x7FFFFFFF +} VkStencilOp; + +typedef enum VkLogicOp { + VK_LOGIC_OP_CLEAR = 0, + VK_LOGIC_OP_AND = 1, + VK_LOGIC_OP_AND_REVERSE = 2, + VK_LOGIC_OP_COPY = 3, + VK_LOGIC_OP_AND_INVERTED = 4, + VK_LOGIC_OP_NO_OP = 5, + VK_LOGIC_OP_XOR = 6, + VK_LOGIC_OP_OR = 7, + VK_LOGIC_OP_NOR = 8, + VK_LOGIC_OP_EQUIVALENT = 9, + VK_LOGIC_OP_INVERT = 10, + VK_LOGIC_OP_OR_REVERSE = 11, + VK_LOGIC_OP_COPY_INVERTED = 12, + VK_LOGIC_OP_OR_INVERTED = 13, + VK_LOGIC_OP_NAND = 14, + VK_LOGIC_OP_SET = 15, + VK_LOGIC_OP_BEGIN_RANGE = VK_LOGIC_OP_CLEAR, + VK_LOGIC_OP_END_RANGE = VK_LOGIC_OP_SET, + VK_LOGIC_OP_RANGE_SIZE = (VK_LOGIC_OP_SET - VK_LOGIC_OP_CLEAR + 1), + VK_LOGIC_OP_MAX_ENUM = 0x7FFFFFFF +} VkLogicOp; + +typedef enum VkBlendFactor { + VK_BLEND_FACTOR_ZERO = 0, + VK_BLEND_FACTOR_ONE = 1, + VK_BLEND_FACTOR_SRC_COLOR = 2, + VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR = 3, + VK_BLEND_FACTOR_DST_COLOR = 4, + VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR = 5, + VK_BLEND_FACTOR_SRC_ALPHA = 6, + VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = 7, + VK_BLEND_FACTOR_DST_ALPHA = 8, + VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA = 9, + VK_BLEND_FACTOR_CONSTANT_COLOR = 10, + VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 11, + VK_BLEND_FACTOR_CONSTANT_ALPHA = 12, + VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 13, + VK_BLEND_FACTOR_SRC_ALPHA_SATURATE = 14, + VK_BLEND_FACTOR_SRC1_COLOR = 15, + VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = 16, + VK_BLEND_FACTOR_SRC1_ALPHA = 17, + VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 18, + VK_BLEND_FACTOR_BEGIN_RANGE = VK_BLEND_FACTOR_ZERO, + VK_BLEND_FACTOR_END_RANGE = VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA, + VK_BLEND_FACTOR_RANGE_SIZE = (VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA - VK_BLEND_FACTOR_ZERO + 1), + VK_BLEND_FACTOR_MAX_ENUM = 0x7FFFFFFF +} VkBlendFactor; + +typedef enum VkBlendOp { + VK_BLEND_OP_ADD = 0, + VK_BLEND_OP_SUBTRACT = 1, + VK_BLEND_OP_REVERSE_SUBTRACT = 2, + VK_BLEND_OP_MIN = 3, + VK_BLEND_OP_MAX = 4, + VK_BLEND_OP_ZERO_EXT = 1000148000, + VK_BLEND_OP_SRC_EXT = 1000148001, + VK_BLEND_OP_DST_EXT = 1000148002, + VK_BLEND_OP_SRC_OVER_EXT = 1000148003, + VK_BLEND_OP_DST_OVER_EXT = 1000148004, + VK_BLEND_OP_SRC_IN_EXT = 1000148005, + VK_BLEND_OP_DST_IN_EXT = 1000148006, + VK_BLEND_OP_SRC_OUT_EXT = 1000148007, + VK_BLEND_OP_DST_OUT_EXT = 1000148008, + VK_BLEND_OP_SRC_ATOP_EXT = 1000148009, + VK_BLEND_OP_DST_ATOP_EXT = 1000148010, + VK_BLEND_OP_XOR_EXT = 1000148011, + VK_BLEND_OP_MULTIPLY_EXT = 1000148012, + VK_BLEND_OP_SCREEN_EXT = 1000148013, + VK_BLEND_OP_OVERLAY_EXT = 1000148014, + VK_BLEND_OP_DARKEN_EXT = 1000148015, + VK_BLEND_OP_LIGHTEN_EXT = 1000148016, + VK_BLEND_OP_COLORDODGE_EXT = 1000148017, + VK_BLEND_OP_COLORBURN_EXT = 1000148018, + VK_BLEND_OP_HARDLIGHT_EXT = 1000148019, + VK_BLEND_OP_SOFTLIGHT_EXT = 1000148020, + VK_BLEND_OP_DIFFERENCE_EXT = 1000148021, + VK_BLEND_OP_EXCLUSION_EXT = 1000148022, + VK_BLEND_OP_INVERT_EXT = 1000148023, + VK_BLEND_OP_INVERT_RGB_EXT = 1000148024, + VK_BLEND_OP_LINEARDODGE_EXT = 1000148025, + VK_BLEND_OP_LINEARBURN_EXT = 1000148026, + VK_BLEND_OP_VIVIDLIGHT_EXT = 1000148027, + VK_BLEND_OP_LINEARLIGHT_EXT = 1000148028, + VK_BLEND_OP_PINLIGHT_EXT = 1000148029, + VK_BLEND_OP_HARDMIX_EXT = 1000148030, + VK_BLEND_OP_HSL_HUE_EXT = 1000148031, + VK_BLEND_OP_HSL_SATURATION_EXT = 1000148032, + VK_BLEND_OP_HSL_COLOR_EXT = 1000148033, + VK_BLEND_OP_HSL_LUMINOSITY_EXT = 1000148034, + VK_BLEND_OP_PLUS_EXT = 1000148035, + VK_BLEND_OP_PLUS_CLAMPED_EXT = 1000148036, + VK_BLEND_OP_PLUS_CLAMPED_ALPHA_EXT = 1000148037, + VK_BLEND_OP_PLUS_DARKER_EXT = 1000148038, + VK_BLEND_OP_MINUS_EXT = 1000148039, + VK_BLEND_OP_MINUS_CLAMPED_EXT = 1000148040, + VK_BLEND_OP_CONTRAST_EXT = 1000148041, + VK_BLEND_OP_INVERT_OVG_EXT = 1000148042, + VK_BLEND_OP_RED_EXT = 1000148043, + VK_BLEND_OP_GREEN_EXT = 1000148044, + VK_BLEND_OP_BLUE_EXT = 1000148045, + VK_BLEND_OP_BEGIN_RANGE = VK_BLEND_OP_ADD, + VK_BLEND_OP_END_RANGE = VK_BLEND_OP_MAX, + VK_BLEND_OP_RANGE_SIZE = (VK_BLEND_OP_MAX - VK_BLEND_OP_ADD + 1), + VK_BLEND_OP_MAX_ENUM = 0x7FFFFFFF +} VkBlendOp; + +typedef enum VkDynamicState { + VK_DYNAMIC_STATE_VIEWPORT = 0, + VK_DYNAMIC_STATE_SCISSOR = 1, + VK_DYNAMIC_STATE_LINE_WIDTH = 2, + VK_DYNAMIC_STATE_DEPTH_BIAS = 3, + VK_DYNAMIC_STATE_BLEND_CONSTANTS = 4, + VK_DYNAMIC_STATE_DEPTH_BOUNDS = 5, + VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 6, + VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 7, + VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8, + VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV = 1000087000, + VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT = 1000099000, + VK_DYNAMIC_STATE_BEGIN_RANGE = VK_DYNAMIC_STATE_VIEWPORT, + VK_DYNAMIC_STATE_END_RANGE = VK_DYNAMIC_STATE_STENCIL_REFERENCE, + VK_DYNAMIC_STATE_RANGE_SIZE = (VK_DYNAMIC_STATE_STENCIL_REFERENCE - VK_DYNAMIC_STATE_VIEWPORT + 1), + VK_DYNAMIC_STATE_MAX_ENUM = 0x7FFFFFFF +} VkDynamicState; + +typedef enum VkFilter { + VK_FILTER_NEAREST = 0, + VK_FILTER_LINEAR = 1, + VK_FILTER_CUBIC_IMG = 1000015000, + VK_FILTER_BEGIN_RANGE = VK_FILTER_NEAREST, + VK_FILTER_END_RANGE = VK_FILTER_LINEAR, + VK_FILTER_RANGE_SIZE = (VK_FILTER_LINEAR - VK_FILTER_NEAREST + 1), + VK_FILTER_MAX_ENUM = 0x7FFFFFFF +} VkFilter; + +typedef enum VkSamplerMipmapMode { + VK_SAMPLER_MIPMAP_MODE_NEAREST = 0, + VK_SAMPLER_MIPMAP_MODE_LINEAR = 1, + VK_SAMPLER_MIPMAP_MODE_BEGIN_RANGE = VK_SAMPLER_MIPMAP_MODE_NEAREST, + VK_SAMPLER_MIPMAP_MODE_END_RANGE = VK_SAMPLER_MIPMAP_MODE_LINEAR, + VK_SAMPLER_MIPMAP_MODE_RANGE_SIZE = (VK_SAMPLER_MIPMAP_MODE_LINEAR - VK_SAMPLER_MIPMAP_MODE_NEAREST + 1), + VK_SAMPLER_MIPMAP_MODE_MAX_ENUM = 0x7FFFFFFF +} VkSamplerMipmapMode; + +typedef enum VkSamplerAddressMode { + VK_SAMPLER_ADDRESS_MODE_REPEAT = 0, + VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 1, + VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 2, + VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3, + VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4, + VK_SAMPLER_ADDRESS_MODE_BEGIN_RANGE = VK_SAMPLER_ADDRESS_MODE_REPEAT, + VK_SAMPLER_ADDRESS_MODE_END_RANGE = VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER, + VK_SAMPLER_ADDRESS_MODE_RANGE_SIZE = (VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER - VK_SAMPLER_ADDRESS_MODE_REPEAT + 1), + VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = 0x7FFFFFFF +} VkSamplerAddressMode; + +typedef enum VkBorderColor { + VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0, + VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 1, + VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 2, + VK_BORDER_COLOR_INT_OPAQUE_BLACK = 3, + VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 4, + VK_BORDER_COLOR_INT_OPAQUE_WHITE = 5, + VK_BORDER_COLOR_BEGIN_RANGE = VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK, + VK_BORDER_COLOR_END_RANGE = VK_BORDER_COLOR_INT_OPAQUE_WHITE, + VK_BORDER_COLOR_RANGE_SIZE = (VK_BORDER_COLOR_INT_OPAQUE_WHITE - VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK + 1), + VK_BORDER_COLOR_MAX_ENUM = 0x7FFFFFFF +} VkBorderColor; + +typedef enum VkDescriptorType { + VK_DESCRIPTOR_TYPE_SAMPLER = 0, + VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 1, + VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 2, + VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 3, + VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 4, + VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 5, + VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 6, + VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 7, + VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 8, + VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9, + VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10, + VK_DESCRIPTOR_TYPE_BEGIN_RANGE = VK_DESCRIPTOR_TYPE_SAMPLER, + VK_DESCRIPTOR_TYPE_END_RANGE = VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT, + VK_DESCRIPTOR_TYPE_RANGE_SIZE = (VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT - VK_DESCRIPTOR_TYPE_SAMPLER + 1), + VK_DESCRIPTOR_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkDescriptorType; + +typedef enum VkAttachmentLoadOp { + VK_ATTACHMENT_LOAD_OP_LOAD = 0, + VK_ATTACHMENT_LOAD_OP_CLEAR = 1, + VK_ATTACHMENT_LOAD_OP_DONT_CARE = 2, + VK_ATTACHMENT_LOAD_OP_BEGIN_RANGE = VK_ATTACHMENT_LOAD_OP_LOAD, + VK_ATTACHMENT_LOAD_OP_END_RANGE = VK_ATTACHMENT_LOAD_OP_DONT_CARE, + VK_ATTACHMENT_LOAD_OP_RANGE_SIZE = (VK_ATTACHMENT_LOAD_OP_DONT_CARE - VK_ATTACHMENT_LOAD_OP_LOAD + 1), + VK_ATTACHMENT_LOAD_OP_MAX_ENUM = 0x7FFFFFFF +} VkAttachmentLoadOp; + +typedef enum VkAttachmentStoreOp { + VK_ATTACHMENT_STORE_OP_STORE = 0, + VK_ATTACHMENT_STORE_OP_DONT_CARE = 1, + VK_ATTACHMENT_STORE_OP_BEGIN_RANGE = VK_ATTACHMENT_STORE_OP_STORE, + VK_ATTACHMENT_STORE_OP_END_RANGE = VK_ATTACHMENT_STORE_OP_DONT_CARE, + VK_ATTACHMENT_STORE_OP_RANGE_SIZE = (VK_ATTACHMENT_STORE_OP_DONT_CARE - VK_ATTACHMENT_STORE_OP_STORE + 1), + VK_ATTACHMENT_STORE_OP_MAX_ENUM = 0x7FFFFFFF +} VkAttachmentStoreOp; + +typedef enum VkPipelineBindPoint { + VK_PIPELINE_BIND_POINT_GRAPHICS = 0, + VK_PIPELINE_BIND_POINT_COMPUTE = 1, + VK_PIPELINE_BIND_POINT_BEGIN_RANGE = VK_PIPELINE_BIND_POINT_GRAPHICS, + VK_PIPELINE_BIND_POINT_END_RANGE = VK_PIPELINE_BIND_POINT_COMPUTE, + VK_PIPELINE_BIND_POINT_RANGE_SIZE = (VK_PIPELINE_BIND_POINT_COMPUTE - VK_PIPELINE_BIND_POINT_GRAPHICS + 1), + VK_PIPELINE_BIND_POINT_MAX_ENUM = 0x7FFFFFFF +} VkPipelineBindPoint; + +typedef enum VkCommandBufferLevel { + VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0, + VK_COMMAND_BUFFER_LEVEL_SECONDARY = 1, + VK_COMMAND_BUFFER_LEVEL_BEGIN_RANGE = VK_COMMAND_BUFFER_LEVEL_PRIMARY, + VK_COMMAND_BUFFER_LEVEL_END_RANGE = VK_COMMAND_BUFFER_LEVEL_SECONDARY, + VK_COMMAND_BUFFER_LEVEL_RANGE_SIZE = (VK_COMMAND_BUFFER_LEVEL_SECONDARY - VK_COMMAND_BUFFER_LEVEL_PRIMARY + 1), + VK_COMMAND_BUFFER_LEVEL_MAX_ENUM = 0x7FFFFFFF +} VkCommandBufferLevel; + +typedef enum VkIndexType { + VK_INDEX_TYPE_UINT16 = 0, + VK_INDEX_TYPE_UINT32 = 1, + VK_INDEX_TYPE_BEGIN_RANGE = VK_INDEX_TYPE_UINT16, + VK_INDEX_TYPE_END_RANGE = VK_INDEX_TYPE_UINT32, + VK_INDEX_TYPE_RANGE_SIZE = (VK_INDEX_TYPE_UINT32 - VK_INDEX_TYPE_UINT16 + 1), + VK_INDEX_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkIndexType; + +typedef enum VkSubpassContents { + VK_SUBPASS_CONTENTS_INLINE = 0, + VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 1, + VK_SUBPASS_CONTENTS_BEGIN_RANGE = VK_SUBPASS_CONTENTS_INLINE, + VK_SUBPASS_CONTENTS_END_RANGE = VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS, + VK_SUBPASS_CONTENTS_RANGE_SIZE = (VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS - VK_SUBPASS_CONTENTS_INLINE + 1), + VK_SUBPASS_CONTENTS_MAX_ENUM = 0x7FFFFFFF +} VkSubpassContents; + +typedef enum VkObjectType { + VK_OBJECT_TYPE_UNKNOWN = 0, + VK_OBJECT_TYPE_INSTANCE = 1, + VK_OBJECT_TYPE_PHYSICAL_DEVICE = 2, + VK_OBJECT_TYPE_DEVICE = 3, + VK_OBJECT_TYPE_QUEUE = 4, + VK_OBJECT_TYPE_SEMAPHORE = 5, + VK_OBJECT_TYPE_COMMAND_BUFFER = 6, + VK_OBJECT_TYPE_FENCE = 7, + VK_OBJECT_TYPE_DEVICE_MEMORY = 8, + VK_OBJECT_TYPE_BUFFER = 9, + VK_OBJECT_TYPE_IMAGE = 10, + VK_OBJECT_TYPE_EVENT = 11, + VK_OBJECT_TYPE_QUERY_POOL = 12, + VK_OBJECT_TYPE_BUFFER_VIEW = 13, + VK_OBJECT_TYPE_IMAGE_VIEW = 14, + VK_OBJECT_TYPE_SHADER_MODULE = 15, + VK_OBJECT_TYPE_PIPELINE_CACHE = 16, + VK_OBJECT_TYPE_PIPELINE_LAYOUT = 17, + VK_OBJECT_TYPE_RENDER_PASS = 18, + VK_OBJECT_TYPE_PIPELINE = 19, + VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT = 20, + VK_OBJECT_TYPE_SAMPLER = 21, + VK_OBJECT_TYPE_DESCRIPTOR_POOL = 22, + VK_OBJECT_TYPE_DESCRIPTOR_SET = 23, + VK_OBJECT_TYPE_FRAMEBUFFER = 24, + VK_OBJECT_TYPE_COMMAND_POOL = 25, + VK_OBJECT_TYPE_SURFACE_KHR = 1000000000, + VK_OBJECT_TYPE_SWAPCHAIN_KHR = 1000001000, + VK_OBJECT_TYPE_DISPLAY_KHR = 1000002000, + VK_OBJECT_TYPE_DISPLAY_MODE_KHR = 1000002001, + VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT = 1000011000, + VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR = 1000085000, + VK_OBJECT_TYPE_OBJECT_TABLE_NVX = 1000086000, + VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX = 1000086001, + VK_OBJECT_TYPE_BEGIN_RANGE = VK_OBJECT_TYPE_UNKNOWN, + VK_OBJECT_TYPE_END_RANGE = VK_OBJECT_TYPE_COMMAND_POOL, + VK_OBJECT_TYPE_RANGE_SIZE = (VK_OBJECT_TYPE_COMMAND_POOL - VK_OBJECT_TYPE_UNKNOWN + 1), + VK_OBJECT_TYPE_MAX_ENUM = 0x7FFFFFFF +} VkObjectType; + +typedef VkFlags VkInstanceCreateFlags; + +typedef enum VkFormatFeatureFlagBits { + VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, + VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, + VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004, + VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008, + VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010, + VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020, + VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040, + VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, + VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100, + VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, + VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400, + VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = 0x00002000, + VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = 0x00004000, + VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR = 0x00008000, + VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT = 0x00010000, + VK_FORMAT_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkFormatFeatureFlagBits; +typedef VkFlags VkFormatFeatureFlags; + +typedef enum VkImageUsageFlagBits { + VK_IMAGE_USAGE_TRANSFER_SRC_BIT = 0x00000001, + VK_IMAGE_USAGE_TRANSFER_DST_BIT = 0x00000002, + VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004, + VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008, + VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010, + VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, + VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, + VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, + VK_IMAGE_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkImageUsageFlagBits; +typedef VkFlags VkImageUsageFlags; + +typedef enum VkImageCreateFlagBits { + VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001, + VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, + VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = 0x00000004, + VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008, + VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 0x00000010, + VK_IMAGE_CREATE_BIND_SFR_BIT_KHX = 0x00000040, + VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR = 0x00000020, + VK_IMAGE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkImageCreateFlagBits; +typedef VkFlags VkImageCreateFlags; + +typedef enum VkSampleCountFlagBits { + VK_SAMPLE_COUNT_1_BIT = 0x00000001, + VK_SAMPLE_COUNT_2_BIT = 0x00000002, + VK_SAMPLE_COUNT_4_BIT = 0x00000004, + VK_SAMPLE_COUNT_8_BIT = 0x00000008, + VK_SAMPLE_COUNT_16_BIT = 0x00000010, + VK_SAMPLE_COUNT_32_BIT = 0x00000020, + VK_SAMPLE_COUNT_64_BIT = 0x00000040, + VK_SAMPLE_COUNT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkSampleCountFlagBits; +typedef VkFlags VkSampleCountFlags; + +typedef enum VkQueueFlagBits { + VK_QUEUE_GRAPHICS_BIT = 0x00000001, + VK_QUEUE_COMPUTE_BIT = 0x00000002, + VK_QUEUE_TRANSFER_BIT = 0x00000004, + VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008, + VK_QUEUE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkQueueFlagBits; +typedef VkFlags VkQueueFlags; + +typedef enum VkMemoryPropertyFlagBits { + VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 0x00000001, + VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000002, + VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004, + VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008, + VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010, + VK_MEMORY_PROPERTY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkMemoryPropertyFlagBits; +typedef VkFlags VkMemoryPropertyFlags; + +typedef enum VkMemoryHeapFlagBits { + VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001, + VK_MEMORY_HEAP_MULTI_INSTANCE_BIT_KHX = 0x00000002, + VK_MEMORY_HEAP_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkMemoryHeapFlagBits; +typedef VkFlags VkMemoryHeapFlags; +typedef VkFlags VkDeviceCreateFlags; +typedef VkFlags VkDeviceQueueCreateFlags; + +typedef enum VkPipelineStageFlagBits { + VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001, + VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002, + VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004, + VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008, + VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010, + VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020, + VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040, + VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080, + VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100, + VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200, + VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400, + VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800, + VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000, + VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT = 0x00002000, + VK_PIPELINE_STAGE_HOST_BIT = 0x00004000, + VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 0x00008000, + VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00010000, + VK_PIPELINE_STAGE_COMMAND_PROCESS_BIT_NVX = 0x00020000, + VK_PIPELINE_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkPipelineStageFlagBits; +typedef VkFlags VkPipelineStageFlags; +typedef VkFlags VkMemoryMapFlags; + +typedef enum VkImageAspectFlagBits { + VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001, + VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002, + VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004, + VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008, + VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkImageAspectFlagBits; +typedef VkFlags VkImageAspectFlags; + +typedef enum VkSparseImageFormatFlagBits { + VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001, + VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 0x00000002, + VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004, + VK_SPARSE_IMAGE_FORMAT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkSparseImageFormatFlagBits; +typedef VkFlags VkSparseImageFormatFlags; + +typedef enum VkSparseMemoryBindFlagBits { + VK_SPARSE_MEMORY_BIND_METADATA_BIT = 0x00000001, + VK_SPARSE_MEMORY_BIND_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkSparseMemoryBindFlagBits; +typedef VkFlags VkSparseMemoryBindFlags; + +typedef enum VkFenceCreateFlagBits { + VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001, + VK_FENCE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkFenceCreateFlagBits; +typedef VkFlags VkFenceCreateFlags; +typedef VkFlags VkSemaphoreCreateFlags; +typedef VkFlags VkEventCreateFlags; +typedef VkFlags VkQueryPoolCreateFlags; + +typedef enum VkQueryPipelineStatisticFlagBits { + VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 0x00000001, + VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 0x00000002, + VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 0x00000004, + VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 0x00000008, + VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 0x00000010, + VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 0x00000020, + VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 0x00000040, + VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 0x00000080, + VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100, + VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200, + VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, + VK_QUERY_PIPELINE_STATISTIC_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkQueryPipelineStatisticFlagBits; +typedef VkFlags VkQueryPipelineStatisticFlags; + +typedef enum VkQueryResultFlagBits { + VK_QUERY_RESULT_64_BIT = 0x00000001, + VK_QUERY_RESULT_WAIT_BIT = 0x00000002, + VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, + VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, + VK_QUERY_RESULT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkQueryResultFlagBits; +typedef VkFlags VkQueryResultFlags; + +typedef enum VkBufferCreateFlagBits { + VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001, + VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, + VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, + VK_BUFFER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkBufferCreateFlagBits; +typedef VkFlags VkBufferCreateFlags; + +typedef enum VkBufferUsageFlagBits { + VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 0x00000001, + VK_BUFFER_USAGE_TRANSFER_DST_BIT = 0x00000002, + VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004, + VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008, + VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010, + VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020, + VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040, + VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, + VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, + VK_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkBufferUsageFlagBits; +typedef VkFlags VkBufferUsageFlags; +typedef VkFlags VkBufferViewCreateFlags; +typedef VkFlags VkImageViewCreateFlags; +typedef VkFlags VkShaderModuleCreateFlags; +typedef VkFlags VkPipelineCacheCreateFlags; + +typedef enum VkPipelineCreateFlagBits { + VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001, + VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002, + VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004, + VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHX = 0x00000008, + VK_PIPELINE_CREATE_DISPATCH_BASE_KHX = 0x00000010, + VK_PIPELINE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkPipelineCreateFlagBits; +typedef VkFlags VkPipelineCreateFlags; +typedef VkFlags VkPipelineShaderStageCreateFlags; + +typedef enum VkShaderStageFlagBits { + VK_SHADER_STAGE_VERTEX_BIT = 0x00000001, + VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002, + VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004, + VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008, + VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010, + VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020, + VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F, + VK_SHADER_STAGE_ALL = 0x7FFFFFFF, + VK_SHADER_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkShaderStageFlagBits; +typedef VkFlags VkPipelineVertexInputStateCreateFlags; +typedef VkFlags VkPipelineInputAssemblyStateCreateFlags; +typedef VkFlags VkPipelineTessellationStateCreateFlags; +typedef VkFlags VkPipelineViewportStateCreateFlags; +typedef VkFlags VkPipelineRasterizationStateCreateFlags; + +typedef enum VkCullModeFlagBits { + VK_CULL_MODE_NONE = 0, + VK_CULL_MODE_FRONT_BIT = 0x00000001, + VK_CULL_MODE_BACK_BIT = 0x00000002, + VK_CULL_MODE_FRONT_AND_BACK = 0x00000003, + VK_CULL_MODE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkCullModeFlagBits; +typedef VkFlags VkCullModeFlags; +typedef VkFlags VkPipelineMultisampleStateCreateFlags; +typedef VkFlags VkPipelineDepthStencilStateCreateFlags; +typedef VkFlags VkPipelineColorBlendStateCreateFlags; + +typedef enum VkColorComponentFlagBits { + VK_COLOR_COMPONENT_R_BIT = 0x00000001, + VK_COLOR_COMPONENT_G_BIT = 0x00000002, + VK_COLOR_COMPONENT_B_BIT = 0x00000004, + VK_COLOR_COMPONENT_A_BIT = 0x00000008, + VK_COLOR_COMPONENT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkColorComponentFlagBits; +typedef VkFlags VkColorComponentFlags; +typedef VkFlags VkPipelineDynamicStateCreateFlags; +typedef VkFlags VkPipelineLayoutCreateFlags; +typedef VkFlags VkShaderStageFlags; +typedef VkFlags VkSamplerCreateFlags; + +typedef enum VkDescriptorSetLayoutCreateFlagBits { + VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR = 0x00000001, + VK_DESCRIPTOR_SET_LAYOUT_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkDescriptorSetLayoutCreateFlagBits; +typedef VkFlags VkDescriptorSetLayoutCreateFlags; + +typedef enum VkDescriptorPoolCreateFlagBits { + VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001, + VK_DESCRIPTOR_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkDescriptorPoolCreateFlagBits; +typedef VkFlags VkDescriptorPoolCreateFlags; +typedef VkFlags VkDescriptorPoolResetFlags; +typedef VkFlags VkFramebufferCreateFlags; +typedef VkFlags VkRenderPassCreateFlags; + +typedef enum VkAttachmentDescriptionFlagBits { + VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 0x00000001, + VK_ATTACHMENT_DESCRIPTION_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkAttachmentDescriptionFlagBits; +typedef VkFlags VkAttachmentDescriptionFlags; + +typedef enum VkSubpassDescriptionFlagBits { + VK_SUBPASS_DESCRIPTION_PER_VIEW_ATTRIBUTES_BIT_NVX = 0x00000001, + VK_SUBPASS_DESCRIPTION_PER_VIEW_POSITION_X_ONLY_BIT_NVX = 0x00000002, + VK_SUBPASS_DESCRIPTION_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkSubpassDescriptionFlagBits; +typedef VkFlags VkSubpassDescriptionFlags; + +typedef enum VkAccessFlagBits { + VK_ACCESS_INDIRECT_COMMAND_READ_BIT = 0x00000001, + VK_ACCESS_INDEX_READ_BIT = 0x00000002, + VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT = 0x00000004, + VK_ACCESS_UNIFORM_READ_BIT = 0x00000008, + VK_ACCESS_INPUT_ATTACHMENT_READ_BIT = 0x00000010, + VK_ACCESS_SHADER_READ_BIT = 0x00000020, + VK_ACCESS_SHADER_WRITE_BIT = 0x00000040, + VK_ACCESS_COLOR_ATTACHMENT_READ_BIT = 0x00000080, + VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT = 0x00000100, + VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT = 0x00000200, + VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = 0x00000400, + VK_ACCESS_TRANSFER_READ_BIT = 0x00000800, + VK_ACCESS_TRANSFER_WRITE_BIT = 0x00001000, + VK_ACCESS_HOST_READ_BIT = 0x00002000, + VK_ACCESS_HOST_WRITE_BIT = 0x00004000, + VK_ACCESS_MEMORY_READ_BIT = 0x00008000, + VK_ACCESS_MEMORY_WRITE_BIT = 0x00010000, + VK_ACCESS_COMMAND_PROCESS_READ_BIT_NVX = 0x00020000, + VK_ACCESS_COMMAND_PROCESS_WRITE_BIT_NVX = 0x00040000, + VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT = 0x00080000, + VK_ACCESS_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkAccessFlagBits; +typedef VkFlags VkAccessFlags; + +typedef enum VkDependencyFlagBits { + VK_DEPENDENCY_BY_REGION_BIT = 0x00000001, + VK_DEPENDENCY_VIEW_LOCAL_BIT_KHX = 0x00000002, + VK_DEPENDENCY_DEVICE_GROUP_BIT_KHX = 0x00000004, + VK_DEPENDENCY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkDependencyFlagBits; +typedef VkFlags VkDependencyFlags; + +typedef enum VkCommandPoolCreateFlagBits { + VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 0x00000001, + VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, + VK_COMMAND_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkCommandPoolCreateFlagBits; +typedef VkFlags VkCommandPoolCreateFlags; + +typedef enum VkCommandPoolResetFlagBits { + VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, + VK_COMMAND_POOL_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkCommandPoolResetFlagBits; +typedef VkFlags VkCommandPoolResetFlags; + +typedef enum VkCommandBufferUsageFlagBits { + VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001, + VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002, + VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004, + VK_COMMAND_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkCommandBufferUsageFlagBits; +typedef VkFlags VkCommandBufferUsageFlags; + +typedef enum VkQueryControlFlagBits { + VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001, + VK_QUERY_CONTROL_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkQueryControlFlagBits; +typedef VkFlags VkQueryControlFlags; + +typedef enum VkCommandBufferResetFlagBits { + VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, + VK_COMMAND_BUFFER_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkCommandBufferResetFlagBits; +typedef VkFlags VkCommandBufferResetFlags; + +typedef enum VkStencilFaceFlagBits { + VK_STENCIL_FACE_FRONT_BIT = 0x00000001, + VK_STENCIL_FACE_BACK_BIT = 0x00000002, + VK_STENCIL_FRONT_AND_BACK = 0x00000003, + VK_STENCIL_FACE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF +} VkStencilFaceFlagBits; +typedef VkFlags VkStencilFaceFlags; + +typedef struct VkApplicationInfo { + VkStructureType sType; + const void* pNext; + const char* pApplicationName; + uint32_t applicationVersion; + const char* pEngineName; + uint32_t engineVersion; + uint32_t apiVersion; +} VkApplicationInfo; + +typedef struct VkInstanceCreateInfo { + VkStructureType sType; + const void* pNext; + VkInstanceCreateFlags flags; + const VkApplicationInfo* pApplicationInfo; + uint32_t enabledLayerCount; + const char* const* ppEnabledLayerNames; + uint32_t enabledExtensionCount; + const char* const* ppEnabledExtensionNames; +} VkInstanceCreateInfo; + +typedef void* (VKAPI_PTR *PFN_vkAllocationFunction)( + void* pUserData, + size_t size, + size_t alignment, + VkSystemAllocationScope allocationScope); + +typedef void* (VKAPI_PTR *PFN_vkReallocationFunction)( + void* pUserData, + void* pOriginal, + size_t size, + size_t alignment, + VkSystemAllocationScope allocationScope); + +typedef void (VKAPI_PTR *PFN_vkFreeFunction)( + void* pUserData, + void* pMemory); + +typedef void (VKAPI_PTR *PFN_vkInternalAllocationNotification)( + void* pUserData, + size_t size, + VkInternalAllocationType allocationType, + VkSystemAllocationScope allocationScope); + +typedef void (VKAPI_PTR *PFN_vkInternalFreeNotification)( + void* pUserData, + size_t size, + VkInternalAllocationType allocationType, + VkSystemAllocationScope allocationScope); + +typedef struct VkAllocationCallbacks { + void* pUserData; + PFN_vkAllocationFunction pfnAllocation; + PFN_vkReallocationFunction pfnReallocation; + PFN_vkFreeFunction pfnFree; + PFN_vkInternalAllocationNotification pfnInternalAllocation; + PFN_vkInternalFreeNotification pfnInternalFree; +} VkAllocationCallbacks; + +typedef struct VkPhysicalDeviceFeatures { + VkBool32 robustBufferAccess; + VkBool32 fullDrawIndexUint32; + VkBool32 imageCubeArray; + VkBool32 independentBlend; + VkBool32 geometryShader; + VkBool32 tessellationShader; + VkBool32 sampleRateShading; + VkBool32 dualSrcBlend; + VkBool32 logicOp; + VkBool32 multiDrawIndirect; + VkBool32 drawIndirectFirstInstance; + VkBool32 depthClamp; + VkBool32 depthBiasClamp; + VkBool32 fillModeNonSolid; + VkBool32 depthBounds; + VkBool32 wideLines; + VkBool32 largePoints; + VkBool32 alphaToOne; + VkBool32 multiViewport; + VkBool32 samplerAnisotropy; + VkBool32 textureCompressionETC2; + VkBool32 textureCompressionASTC_LDR; + VkBool32 textureCompressionBC; + VkBool32 occlusionQueryPrecise; + VkBool32 pipelineStatisticsQuery; + VkBool32 vertexPipelineStoresAndAtomics; + VkBool32 fragmentStoresAndAtomics; + VkBool32 shaderTessellationAndGeometryPointSize; + VkBool32 shaderImageGatherExtended; + VkBool32 shaderStorageImageExtendedFormats; + VkBool32 shaderStorageImageMultisample; + VkBool32 shaderStorageImageReadWithoutFormat; + VkBool32 shaderStorageImageWriteWithoutFormat; + VkBool32 shaderUniformBufferArrayDynamicIndexing; + VkBool32 shaderSampledImageArrayDynamicIndexing; + VkBool32 shaderStorageBufferArrayDynamicIndexing; + VkBool32 shaderStorageImageArrayDynamicIndexing; + VkBool32 shaderClipDistance; + VkBool32 shaderCullDistance; + VkBool32 shaderFloat64; + VkBool32 shaderInt64; + VkBool32 shaderInt16; + VkBool32 shaderResourceResidency; + VkBool32 shaderResourceMinLod; + VkBool32 sparseBinding; + VkBool32 sparseResidencyBuffer; + VkBool32 sparseResidencyImage2D; + VkBool32 sparseResidencyImage3D; + VkBool32 sparseResidency2Samples; + VkBool32 sparseResidency4Samples; + VkBool32 sparseResidency8Samples; + VkBool32 sparseResidency16Samples; + VkBool32 sparseResidencyAliased; + VkBool32 variableMultisampleRate; + VkBool32 inheritedQueries; +} VkPhysicalDeviceFeatures; + +typedef struct VkFormatProperties { + VkFormatFeatureFlags linearTilingFeatures; + VkFormatFeatureFlags optimalTilingFeatures; + VkFormatFeatureFlags bufferFeatures; +} VkFormatProperties; + +typedef struct VkExtent3D { + uint32_t width; + uint32_t height; + uint32_t depth; +} VkExtent3D; + +typedef struct VkImageFormatProperties { + VkExtent3D maxExtent; + uint32_t maxMipLevels; + uint32_t maxArrayLayers; + VkSampleCountFlags sampleCounts; + VkDeviceSize maxResourceSize; +} VkImageFormatProperties; + +typedef struct VkPhysicalDeviceLimits { + uint32_t maxImageDimension1D; + uint32_t maxImageDimension2D; + uint32_t maxImageDimension3D; + uint32_t maxImageDimensionCube; + uint32_t maxImageArrayLayers; + uint32_t maxTexelBufferElements; + uint32_t maxUniformBufferRange; + uint32_t maxStorageBufferRange; + uint32_t maxPushConstantsSize; + uint32_t maxMemoryAllocationCount; + uint32_t maxSamplerAllocationCount; + VkDeviceSize bufferImageGranularity; + VkDeviceSize sparseAddressSpaceSize; + uint32_t maxBoundDescriptorSets; + uint32_t maxPerStageDescriptorSamplers; + uint32_t maxPerStageDescriptorUniformBuffers; + uint32_t maxPerStageDescriptorStorageBuffers; + uint32_t maxPerStageDescriptorSampledImages; + uint32_t maxPerStageDescriptorStorageImages; + uint32_t maxPerStageDescriptorInputAttachments; + uint32_t maxPerStageResources; + uint32_t maxDescriptorSetSamplers; + uint32_t maxDescriptorSetUniformBuffers; + uint32_t maxDescriptorSetUniformBuffersDynamic; + uint32_t maxDescriptorSetStorageBuffers; + uint32_t maxDescriptorSetStorageBuffersDynamic; + uint32_t maxDescriptorSetSampledImages; + uint32_t maxDescriptorSetStorageImages; + uint32_t maxDescriptorSetInputAttachments; + uint32_t maxVertexInputAttributes; + uint32_t maxVertexInputBindings; + uint32_t maxVertexInputAttributeOffset; + uint32_t maxVertexInputBindingStride; + uint32_t maxVertexOutputComponents; + uint32_t maxTessellationGenerationLevel; + uint32_t maxTessellationPatchSize; + uint32_t maxTessellationControlPerVertexInputComponents; + uint32_t maxTessellationControlPerVertexOutputComponents; + uint32_t maxTessellationControlPerPatchOutputComponents; + uint32_t maxTessellationControlTotalOutputComponents; + uint32_t maxTessellationEvaluationInputComponents; + uint32_t maxTessellationEvaluationOutputComponents; + uint32_t maxGeometryShaderInvocations; + uint32_t maxGeometryInputComponents; + uint32_t maxGeometryOutputComponents; + uint32_t maxGeometryOutputVertices; + uint32_t maxGeometryTotalOutputComponents; + uint32_t maxFragmentInputComponents; + uint32_t maxFragmentOutputAttachments; + uint32_t maxFragmentDualSrcAttachments; + uint32_t maxFragmentCombinedOutputResources; + uint32_t maxComputeSharedMemorySize; + uint32_t maxComputeWorkGroupCount[3]; + uint32_t maxComputeWorkGroupInvocations; + uint32_t maxComputeWorkGroupSize[3]; + uint32_t subPixelPrecisionBits; + uint32_t subTexelPrecisionBits; + uint32_t mipmapPrecisionBits; + uint32_t maxDrawIndexedIndexValue; + uint32_t maxDrawIndirectCount; + float maxSamplerLodBias; + float maxSamplerAnisotropy; + uint32_t maxViewports; + uint32_t maxViewportDimensions[2]; + float viewportBoundsRange[2]; + uint32_t viewportSubPixelBits; + size_t minMemoryMapAlignment; + VkDeviceSize minTexelBufferOffsetAlignment; + VkDeviceSize minUniformBufferOffsetAlignment; + VkDeviceSize minStorageBufferOffsetAlignment; + int32_t minTexelOffset; + uint32_t maxTexelOffset; + int32_t minTexelGatherOffset; + uint32_t maxTexelGatherOffset; + float minInterpolationOffset; + float maxInterpolationOffset; + uint32_t subPixelInterpolationOffsetBits; + uint32_t maxFramebufferWidth; + uint32_t maxFramebufferHeight; + uint32_t maxFramebufferLayers; + VkSampleCountFlags framebufferColorSampleCounts; + VkSampleCountFlags framebufferDepthSampleCounts; + VkSampleCountFlags framebufferStencilSampleCounts; + VkSampleCountFlags framebufferNoAttachmentsSampleCounts; + uint32_t maxColorAttachments; + VkSampleCountFlags sampledImageColorSampleCounts; + VkSampleCountFlags sampledImageIntegerSampleCounts; + VkSampleCountFlags sampledImageDepthSampleCounts; + VkSampleCountFlags sampledImageStencilSampleCounts; + VkSampleCountFlags storageImageSampleCounts; + uint32_t maxSampleMaskWords; + VkBool32 timestampComputeAndGraphics; + float timestampPeriod; + uint32_t maxClipDistances; + uint32_t maxCullDistances; + uint32_t maxCombinedClipAndCullDistances; + uint32_t discreteQueuePriorities; + float pointSizeRange[2]; + float lineWidthRange[2]; + float pointSizeGranularity; + float lineWidthGranularity; + VkBool32 strictLines; + VkBool32 standardSampleLocations; + VkDeviceSize optimalBufferCopyOffsetAlignment; + VkDeviceSize optimalBufferCopyRowPitchAlignment; + VkDeviceSize nonCoherentAtomSize; +} VkPhysicalDeviceLimits; + +typedef struct VkPhysicalDeviceSparseProperties { + VkBool32 residencyStandard2DBlockShape; + VkBool32 residencyStandard2DMultisampleBlockShape; + VkBool32 residencyStandard3DBlockShape; + VkBool32 residencyAlignedMipSize; + VkBool32 residencyNonResidentStrict; +} VkPhysicalDeviceSparseProperties; + +typedef struct VkPhysicalDeviceProperties { + uint32_t apiVersion; + uint32_t driverVersion; + uint32_t vendorID; + uint32_t deviceID; + VkPhysicalDeviceType deviceType; + char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]; + uint8_t pipelineCacheUUID[VK_UUID_SIZE]; + VkPhysicalDeviceLimits limits; + VkPhysicalDeviceSparseProperties sparseProperties; +} VkPhysicalDeviceProperties; + +typedef struct VkQueueFamilyProperties { + VkQueueFlags queueFlags; + uint32_t queueCount; + uint32_t timestampValidBits; + VkExtent3D minImageTransferGranularity; +} VkQueueFamilyProperties; + +typedef struct VkMemoryType { + VkMemoryPropertyFlags propertyFlags; + uint32_t heapIndex; +} VkMemoryType; + +typedef struct VkMemoryHeap { + VkDeviceSize size; + VkMemoryHeapFlags flags; +} VkMemoryHeap; + +typedef struct VkPhysicalDeviceMemoryProperties { + uint32_t memoryTypeCount; + VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES]; + uint32_t memoryHeapCount; + VkMemoryHeap memoryHeaps[VK_MAX_MEMORY_HEAPS]; +} VkPhysicalDeviceMemoryProperties; + +typedef void (VKAPI_PTR *PFN_vkVoidFunction)(void); +typedef struct VkDeviceQueueCreateInfo { + VkStructureType sType; + const void* pNext; + VkDeviceQueueCreateFlags flags; + uint32_t queueFamilyIndex; + uint32_t queueCount; + const float* pQueuePriorities; +} VkDeviceQueueCreateInfo; + +typedef struct VkDeviceCreateInfo { + VkStructureType sType; + const void* pNext; + VkDeviceCreateFlags flags; + uint32_t queueCreateInfoCount; + const VkDeviceQueueCreateInfo* pQueueCreateInfos; + uint32_t enabledLayerCount; + const char* const* ppEnabledLayerNames; + uint32_t enabledExtensionCount; + const char* const* ppEnabledExtensionNames; + const VkPhysicalDeviceFeatures* pEnabledFeatures; +} VkDeviceCreateInfo; + +typedef struct VkExtensionProperties { + char extensionName[VK_MAX_EXTENSION_NAME_SIZE]; + uint32_t specVersion; +} VkExtensionProperties; + +typedef struct VkLayerProperties { + char layerName[VK_MAX_EXTENSION_NAME_SIZE]; + uint32_t specVersion; + uint32_t implementationVersion; + char description[VK_MAX_DESCRIPTION_SIZE]; +} VkLayerProperties; + +typedef struct VkSubmitInfo { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreCount; + const VkSemaphore* pWaitSemaphores; + const VkPipelineStageFlags* pWaitDstStageMask; + uint32_t commandBufferCount; + const VkCommandBuffer* pCommandBuffers; + uint32_t signalSemaphoreCount; + const VkSemaphore* pSignalSemaphores; +} VkSubmitInfo; + +typedef struct VkMemoryAllocateInfo { + VkStructureType sType; + const void* pNext; + VkDeviceSize allocationSize; + uint32_t memoryTypeIndex; +} VkMemoryAllocateInfo; + +typedef struct VkMappedMemoryRange { + VkStructureType sType; + const void* pNext; + VkDeviceMemory memory; + VkDeviceSize offset; + VkDeviceSize size; +} VkMappedMemoryRange; + +typedef struct VkMemoryRequirements { + VkDeviceSize size; + VkDeviceSize alignment; + uint32_t memoryTypeBits; +} VkMemoryRequirements; + +typedef struct VkSparseImageFormatProperties { + VkImageAspectFlags aspectMask; + VkExtent3D imageGranularity; + VkSparseImageFormatFlags flags; +} VkSparseImageFormatProperties; + +typedef struct VkSparseImageMemoryRequirements { + VkSparseImageFormatProperties formatProperties; + uint32_t imageMipTailFirstLod; + VkDeviceSize imageMipTailSize; + VkDeviceSize imageMipTailOffset; + VkDeviceSize imageMipTailStride; +} VkSparseImageMemoryRequirements; + +typedef struct VkSparseMemoryBind { + VkDeviceSize resourceOffset; + VkDeviceSize size; + VkDeviceMemory memory; + VkDeviceSize memoryOffset; + VkSparseMemoryBindFlags flags; +} VkSparseMemoryBind; + +typedef struct VkSparseBufferMemoryBindInfo { + VkBuffer buffer; + uint32_t bindCount; + const VkSparseMemoryBind* pBinds; +} VkSparseBufferMemoryBindInfo; + +typedef struct VkSparseImageOpaqueMemoryBindInfo { + VkImage image; + uint32_t bindCount; + const VkSparseMemoryBind* pBinds; +} VkSparseImageOpaqueMemoryBindInfo; + +typedef struct VkImageSubresource { + VkImageAspectFlags aspectMask; + uint32_t mipLevel; + uint32_t arrayLayer; +} VkImageSubresource; + +typedef struct VkOffset3D { + int32_t x; + int32_t y; + int32_t z; +} VkOffset3D; + +typedef struct VkSparseImageMemoryBind { + VkImageSubresource subresource; + VkOffset3D offset; + VkExtent3D extent; + VkDeviceMemory memory; + VkDeviceSize memoryOffset; + VkSparseMemoryBindFlags flags; +} VkSparseImageMemoryBind; + +typedef struct VkSparseImageMemoryBindInfo { + VkImage image; + uint32_t bindCount; + const VkSparseImageMemoryBind* pBinds; +} VkSparseImageMemoryBindInfo; + +typedef struct VkBindSparseInfo { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreCount; + const VkSemaphore* pWaitSemaphores; + uint32_t bufferBindCount; + const VkSparseBufferMemoryBindInfo* pBufferBinds; + uint32_t imageOpaqueBindCount; + const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds; + uint32_t imageBindCount; + const VkSparseImageMemoryBindInfo* pImageBinds; + uint32_t signalSemaphoreCount; + const VkSemaphore* pSignalSemaphores; +} VkBindSparseInfo; + +typedef struct VkFenceCreateInfo { + VkStructureType sType; + const void* pNext; + VkFenceCreateFlags flags; +} VkFenceCreateInfo; + +typedef struct VkSemaphoreCreateInfo { + VkStructureType sType; + const void* pNext; + VkSemaphoreCreateFlags flags; +} VkSemaphoreCreateInfo; + +typedef struct VkEventCreateInfo { + VkStructureType sType; + const void* pNext; + VkEventCreateFlags flags; +} VkEventCreateInfo; + +typedef struct VkQueryPoolCreateInfo { + VkStructureType sType; + const void* pNext; + VkQueryPoolCreateFlags flags; + VkQueryType queryType; + uint32_t queryCount; + VkQueryPipelineStatisticFlags pipelineStatistics; +} VkQueryPoolCreateInfo; + +typedef struct VkBufferCreateInfo { + VkStructureType sType; + const void* pNext; + VkBufferCreateFlags flags; + VkDeviceSize size; + VkBufferUsageFlags usage; + VkSharingMode sharingMode; + uint32_t queueFamilyIndexCount; + const uint32_t* pQueueFamilyIndices; +} VkBufferCreateInfo; + +typedef struct VkBufferViewCreateInfo { + VkStructureType sType; + const void* pNext; + VkBufferViewCreateFlags flags; + VkBuffer buffer; + VkFormat format; + VkDeviceSize offset; + VkDeviceSize range; +} VkBufferViewCreateInfo; + +typedef struct VkImageCreateInfo { + VkStructureType sType; + const void* pNext; + VkImageCreateFlags flags; + VkImageType imageType; + VkFormat format; + VkExtent3D extent; + uint32_t mipLevels; + uint32_t arrayLayers; + VkSampleCountFlagBits samples; + VkImageTiling tiling; + VkImageUsageFlags usage; + VkSharingMode sharingMode; + uint32_t queueFamilyIndexCount; + const uint32_t* pQueueFamilyIndices; + VkImageLayout initialLayout; +} VkImageCreateInfo; + +typedef struct VkSubresourceLayout { + VkDeviceSize offset; + VkDeviceSize size; + VkDeviceSize rowPitch; + VkDeviceSize arrayPitch; + VkDeviceSize depthPitch; +} VkSubresourceLayout; + +typedef struct VkComponentMapping { + VkComponentSwizzle r; + VkComponentSwizzle g; + VkComponentSwizzle b; + VkComponentSwizzle a; +} VkComponentMapping; + +typedef struct VkImageSubresourceRange { + VkImageAspectFlags aspectMask; + uint32_t baseMipLevel; + uint32_t levelCount; + uint32_t baseArrayLayer; + uint32_t layerCount; +} VkImageSubresourceRange; + +typedef struct VkImageViewCreateInfo { + VkStructureType sType; + const void* pNext; + VkImageViewCreateFlags flags; + VkImage image; + VkImageViewType viewType; + VkFormat format; + VkComponentMapping components; + VkImageSubresourceRange subresourceRange; +} VkImageViewCreateInfo; + +typedef struct VkShaderModuleCreateInfo { + VkStructureType sType; + const void* pNext; + VkShaderModuleCreateFlags flags; + size_t codeSize; + const uint32_t* pCode; +} VkShaderModuleCreateInfo; + +typedef struct VkPipelineCacheCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineCacheCreateFlags flags; + size_t initialDataSize; + const void* pInitialData; +} VkPipelineCacheCreateInfo; + +typedef struct VkSpecializationMapEntry { + uint32_t constantID; + uint32_t offset; + size_t size; +} VkSpecializationMapEntry; + +typedef struct VkSpecializationInfo { + uint32_t mapEntryCount; + const VkSpecializationMapEntry* pMapEntries; + size_t dataSize; + const void* pData; +} VkSpecializationInfo; + +typedef struct VkPipelineShaderStageCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineShaderStageCreateFlags flags; + VkShaderStageFlagBits stage; + VkShaderModule module; + const char* pName; + const VkSpecializationInfo* pSpecializationInfo; +} VkPipelineShaderStageCreateInfo; + +typedef struct VkVertexInputBindingDescription { + uint32_t binding; + uint32_t stride; + VkVertexInputRate inputRate; +} VkVertexInputBindingDescription; + +typedef struct VkVertexInputAttributeDescription { + uint32_t location; + uint32_t binding; + VkFormat format; + uint32_t offset; +} VkVertexInputAttributeDescription; + +typedef struct VkPipelineVertexInputStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineVertexInputStateCreateFlags flags; + uint32_t vertexBindingDescriptionCount; + const VkVertexInputBindingDescription* pVertexBindingDescriptions; + uint32_t vertexAttributeDescriptionCount; + const VkVertexInputAttributeDescription* pVertexAttributeDescriptions; +} VkPipelineVertexInputStateCreateInfo; + +typedef struct VkPipelineInputAssemblyStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineInputAssemblyStateCreateFlags flags; + VkPrimitiveTopology topology; + VkBool32 primitiveRestartEnable; +} VkPipelineInputAssemblyStateCreateInfo; + +typedef struct VkPipelineTessellationStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineTessellationStateCreateFlags flags; + uint32_t patchControlPoints; +} VkPipelineTessellationStateCreateInfo; + +typedef struct VkViewport { + float x; + float y; + float width; + float height; + float minDepth; + float maxDepth; +} VkViewport; + +typedef struct VkOffset2D { + int32_t x; + int32_t y; +} VkOffset2D; + +typedef struct VkExtent2D { + uint32_t width; + uint32_t height; +} VkExtent2D; + +typedef struct VkRect2D { + VkOffset2D offset; + VkExtent2D extent; +} VkRect2D; + +typedef struct VkPipelineViewportStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineViewportStateCreateFlags flags; + uint32_t viewportCount; + const VkViewport* pViewports; + uint32_t scissorCount; + const VkRect2D* pScissors; +} VkPipelineViewportStateCreateInfo; + +typedef struct VkPipelineRasterizationStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineRasterizationStateCreateFlags flags; + VkBool32 depthClampEnable; + VkBool32 rasterizerDiscardEnable; + VkPolygonMode polygonMode; + VkCullModeFlags cullMode; + VkFrontFace frontFace; + VkBool32 depthBiasEnable; + float depthBiasConstantFactor; + float depthBiasClamp; + float depthBiasSlopeFactor; + float lineWidth; +} VkPipelineRasterizationStateCreateInfo; + +typedef struct VkPipelineMultisampleStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineMultisampleStateCreateFlags flags; + VkSampleCountFlagBits rasterizationSamples; + VkBool32 sampleShadingEnable; + float minSampleShading; + const VkSampleMask* pSampleMask; + VkBool32 alphaToCoverageEnable; + VkBool32 alphaToOneEnable; +} VkPipelineMultisampleStateCreateInfo; + +typedef struct VkStencilOpState { + VkStencilOp failOp; + VkStencilOp passOp; + VkStencilOp depthFailOp; + VkCompareOp compareOp; + uint32_t compareMask; + uint32_t writeMask; + uint32_t reference; +} VkStencilOpState; + +typedef struct VkPipelineDepthStencilStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineDepthStencilStateCreateFlags flags; + VkBool32 depthTestEnable; + VkBool32 depthWriteEnable; + VkCompareOp depthCompareOp; + VkBool32 depthBoundsTestEnable; + VkBool32 stencilTestEnable; + VkStencilOpState front; + VkStencilOpState back; + float minDepthBounds; + float maxDepthBounds; +} VkPipelineDepthStencilStateCreateInfo; + +typedef struct VkPipelineColorBlendAttachmentState { + VkBool32 blendEnable; + VkBlendFactor srcColorBlendFactor; + VkBlendFactor dstColorBlendFactor; + VkBlendOp colorBlendOp; + VkBlendFactor srcAlphaBlendFactor; + VkBlendFactor dstAlphaBlendFactor; + VkBlendOp alphaBlendOp; + VkColorComponentFlags colorWriteMask; +} VkPipelineColorBlendAttachmentState; + +typedef struct VkPipelineColorBlendStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineColorBlendStateCreateFlags flags; + VkBool32 logicOpEnable; + VkLogicOp logicOp; + uint32_t attachmentCount; + const VkPipelineColorBlendAttachmentState* pAttachments; + float blendConstants[4]; +} VkPipelineColorBlendStateCreateInfo; + +typedef struct VkPipelineDynamicStateCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineDynamicStateCreateFlags flags; + uint32_t dynamicStateCount; + const VkDynamicState* pDynamicStates; +} VkPipelineDynamicStateCreateInfo; + +typedef struct VkGraphicsPipelineCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineCreateFlags flags; + uint32_t stageCount; + const VkPipelineShaderStageCreateInfo* pStages; + const VkPipelineVertexInputStateCreateInfo* pVertexInputState; + const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState; + const VkPipelineTessellationStateCreateInfo* pTessellationState; + const VkPipelineViewportStateCreateInfo* pViewportState; + const VkPipelineRasterizationStateCreateInfo* pRasterizationState; + const VkPipelineMultisampleStateCreateInfo* pMultisampleState; + const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState; + const VkPipelineColorBlendStateCreateInfo* pColorBlendState; + const VkPipelineDynamicStateCreateInfo* pDynamicState; + VkPipelineLayout layout; + VkRenderPass renderPass; + uint32_t subpass; + VkPipeline basePipelineHandle; + int32_t basePipelineIndex; +} VkGraphicsPipelineCreateInfo; + +typedef struct VkComputePipelineCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineCreateFlags flags; + VkPipelineShaderStageCreateInfo stage; + VkPipelineLayout layout; + VkPipeline basePipelineHandle; + int32_t basePipelineIndex; +} VkComputePipelineCreateInfo; + +typedef struct VkPushConstantRange { + VkShaderStageFlags stageFlags; + uint32_t offset; + uint32_t size; +} VkPushConstantRange; + +typedef struct VkPipelineLayoutCreateInfo { + VkStructureType sType; + const void* pNext; + VkPipelineLayoutCreateFlags flags; + uint32_t setLayoutCount; + const VkDescriptorSetLayout* pSetLayouts; + uint32_t pushConstantRangeCount; + const VkPushConstantRange* pPushConstantRanges; +} VkPipelineLayoutCreateInfo; + +typedef struct VkSamplerCreateInfo { + VkStructureType sType; + const void* pNext; + VkSamplerCreateFlags flags; + VkFilter magFilter; + VkFilter minFilter; + VkSamplerMipmapMode mipmapMode; + VkSamplerAddressMode addressModeU; + VkSamplerAddressMode addressModeV; + VkSamplerAddressMode addressModeW; + float mipLodBias; + VkBool32 anisotropyEnable; + float maxAnisotropy; + VkBool32 compareEnable; + VkCompareOp compareOp; + float minLod; + float maxLod; + VkBorderColor borderColor; + VkBool32 unnormalizedCoordinates; +} VkSamplerCreateInfo; + +typedef struct VkDescriptorSetLayoutBinding { + uint32_t binding; + VkDescriptorType descriptorType; + uint32_t descriptorCount; + VkShaderStageFlags stageFlags; + const VkSampler* pImmutableSamplers; +} VkDescriptorSetLayoutBinding; + +typedef struct VkDescriptorSetLayoutCreateInfo { + VkStructureType sType; + const void* pNext; + VkDescriptorSetLayoutCreateFlags flags; + uint32_t bindingCount; + const VkDescriptorSetLayoutBinding* pBindings; +} VkDescriptorSetLayoutCreateInfo; + +typedef struct VkDescriptorPoolSize { + VkDescriptorType type; + uint32_t descriptorCount; +} VkDescriptorPoolSize; + +typedef struct VkDescriptorPoolCreateInfo { + VkStructureType sType; + const void* pNext; + VkDescriptorPoolCreateFlags flags; + uint32_t maxSets; + uint32_t poolSizeCount; + const VkDescriptorPoolSize* pPoolSizes; +} VkDescriptorPoolCreateInfo; + +typedef struct VkDescriptorSetAllocateInfo { + VkStructureType sType; + const void* pNext; + VkDescriptorPool descriptorPool; + uint32_t descriptorSetCount; + const VkDescriptorSetLayout* pSetLayouts; +} VkDescriptorSetAllocateInfo; + +typedef struct VkDescriptorImageInfo { + VkSampler sampler; + VkImageView imageView; + VkImageLayout imageLayout; +} VkDescriptorImageInfo; + +typedef struct VkDescriptorBufferInfo { + VkBuffer buffer; + VkDeviceSize offset; + VkDeviceSize range; +} VkDescriptorBufferInfo; + +typedef struct VkWriteDescriptorSet { + VkStructureType sType; + const void* pNext; + VkDescriptorSet dstSet; + uint32_t dstBinding; + uint32_t dstArrayElement; + uint32_t descriptorCount; + VkDescriptorType descriptorType; + const VkDescriptorImageInfo* pImageInfo; + const VkDescriptorBufferInfo* pBufferInfo; + const VkBufferView* pTexelBufferView; +} VkWriteDescriptorSet; + +typedef struct VkCopyDescriptorSet { + VkStructureType sType; + const void* pNext; + VkDescriptorSet srcSet; + uint32_t srcBinding; + uint32_t srcArrayElement; + VkDescriptorSet dstSet; + uint32_t dstBinding; + uint32_t dstArrayElement; + uint32_t descriptorCount; +} VkCopyDescriptorSet; + +typedef struct VkFramebufferCreateInfo { + VkStructureType sType; + const void* pNext; + VkFramebufferCreateFlags flags; + VkRenderPass renderPass; + uint32_t attachmentCount; + const VkImageView* pAttachments; + uint32_t width; + uint32_t height; + uint32_t layers; +} VkFramebufferCreateInfo; + +typedef struct VkAttachmentDescription { + VkAttachmentDescriptionFlags flags; + VkFormat format; + VkSampleCountFlagBits samples; + VkAttachmentLoadOp loadOp; + VkAttachmentStoreOp storeOp; + VkAttachmentLoadOp stencilLoadOp; + VkAttachmentStoreOp stencilStoreOp; + VkImageLayout initialLayout; + VkImageLayout finalLayout; +} VkAttachmentDescription; + +typedef struct VkAttachmentReference { + uint32_t attachment; + VkImageLayout layout; +} VkAttachmentReference; + +typedef struct VkSubpassDescription { + VkSubpassDescriptionFlags flags; + VkPipelineBindPoint pipelineBindPoint; + uint32_t inputAttachmentCount; + const VkAttachmentReference* pInputAttachments; + uint32_t colorAttachmentCount; + const VkAttachmentReference* pColorAttachments; + const VkAttachmentReference* pResolveAttachments; + const VkAttachmentReference* pDepthStencilAttachment; + uint32_t preserveAttachmentCount; + const uint32_t* pPreserveAttachments; +} VkSubpassDescription; + +typedef struct VkSubpassDependency { + uint32_t srcSubpass; + uint32_t dstSubpass; + VkPipelineStageFlags srcStageMask; + VkPipelineStageFlags dstStageMask; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; + VkDependencyFlags dependencyFlags; +} VkSubpassDependency; + +typedef struct VkRenderPassCreateInfo { + VkStructureType sType; + const void* pNext; + VkRenderPassCreateFlags flags; + uint32_t attachmentCount; + const VkAttachmentDescription* pAttachments; + uint32_t subpassCount; + const VkSubpassDescription* pSubpasses; + uint32_t dependencyCount; + const VkSubpassDependency* pDependencies; +} VkRenderPassCreateInfo; + +typedef struct VkCommandPoolCreateInfo { + VkStructureType sType; + const void* pNext; + VkCommandPoolCreateFlags flags; + uint32_t queueFamilyIndex; +} VkCommandPoolCreateInfo; + +typedef struct VkCommandBufferAllocateInfo { + VkStructureType sType; + const void* pNext; + VkCommandPool commandPool; + VkCommandBufferLevel level; + uint32_t commandBufferCount; +} VkCommandBufferAllocateInfo; + +typedef struct VkCommandBufferInheritanceInfo { + VkStructureType sType; + const void* pNext; + VkRenderPass renderPass; + uint32_t subpass; + VkFramebuffer framebuffer; + VkBool32 occlusionQueryEnable; + VkQueryControlFlags queryFlags; + VkQueryPipelineStatisticFlags pipelineStatistics; +} VkCommandBufferInheritanceInfo; + +typedef struct VkCommandBufferBeginInfo { + VkStructureType sType; + const void* pNext; + VkCommandBufferUsageFlags flags; + const VkCommandBufferInheritanceInfo* pInheritanceInfo; +} VkCommandBufferBeginInfo; + +typedef struct VkBufferCopy { + VkDeviceSize srcOffset; + VkDeviceSize dstOffset; + VkDeviceSize size; +} VkBufferCopy; + +typedef struct VkImageSubresourceLayers { + VkImageAspectFlags aspectMask; + uint32_t mipLevel; + uint32_t baseArrayLayer; + uint32_t layerCount; +} VkImageSubresourceLayers; + +typedef struct VkImageCopy { + VkImageSubresourceLayers srcSubresource; + VkOffset3D srcOffset; + VkImageSubresourceLayers dstSubresource; + VkOffset3D dstOffset; + VkExtent3D extent; +} VkImageCopy; + +typedef struct VkImageBlit { + VkImageSubresourceLayers srcSubresource; + VkOffset3D srcOffsets[2]; + VkImageSubresourceLayers dstSubresource; + VkOffset3D dstOffsets[2]; +} VkImageBlit; + +typedef struct VkBufferImageCopy { + VkDeviceSize bufferOffset; + uint32_t bufferRowLength; + uint32_t bufferImageHeight; + VkImageSubresourceLayers imageSubresource; + VkOffset3D imageOffset; + VkExtent3D imageExtent; +} VkBufferImageCopy; + +typedef union VkClearColorValue { + float float32[4]; + int32_t int32[4]; + uint32_t uint32[4]; +} VkClearColorValue; + +typedef struct VkClearDepthStencilValue { + float depth; + uint32_t stencil; +} VkClearDepthStencilValue; + +typedef union VkClearValue { + VkClearColorValue color; + VkClearDepthStencilValue depthStencil; +} VkClearValue; + +typedef struct VkClearAttachment { + VkImageAspectFlags aspectMask; + uint32_t colorAttachment; + VkClearValue clearValue; +} VkClearAttachment; + +typedef struct VkClearRect { + VkRect2D rect; + uint32_t baseArrayLayer; + uint32_t layerCount; +} VkClearRect; + +typedef struct VkImageResolve { + VkImageSubresourceLayers srcSubresource; + VkOffset3D srcOffset; + VkImageSubresourceLayers dstSubresource; + VkOffset3D dstOffset; + VkExtent3D extent; +} VkImageResolve; + +typedef struct VkMemoryBarrier { + VkStructureType sType; + const void* pNext; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; +} VkMemoryBarrier; + +typedef struct VkBufferMemoryBarrier { + VkStructureType sType; + const void* pNext; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; + uint32_t srcQueueFamilyIndex; + uint32_t dstQueueFamilyIndex; + VkBuffer buffer; + VkDeviceSize offset; + VkDeviceSize size; +} VkBufferMemoryBarrier; + +typedef struct VkImageMemoryBarrier { + VkStructureType sType; + const void* pNext; + VkAccessFlags srcAccessMask; + VkAccessFlags dstAccessMask; + VkImageLayout oldLayout; + VkImageLayout newLayout; + uint32_t srcQueueFamilyIndex; + uint32_t dstQueueFamilyIndex; + VkImage image; + VkImageSubresourceRange subresourceRange; +} VkImageMemoryBarrier; + +typedef struct VkRenderPassBeginInfo { + VkStructureType sType; + const void* pNext; + VkRenderPass renderPass; + VkFramebuffer framebuffer; + VkRect2D renderArea; + uint32_t clearValueCount; + const VkClearValue* pClearValues; +} VkRenderPassBeginInfo; + +typedef struct VkDispatchIndirectCommand { + uint32_t x; + uint32_t y; + uint32_t z; +} VkDispatchIndirectCommand; + +typedef struct VkDrawIndexedIndirectCommand { + uint32_t indexCount; + uint32_t instanceCount; + uint32_t firstIndex; + int32_t vertexOffset; + uint32_t firstInstance; +} VkDrawIndexedIndirectCommand; + +typedef struct VkDrawIndirectCommand { + uint32_t vertexCount; + uint32_t instanceCount; + uint32_t firstVertex; + uint32_t firstInstance; +} VkDrawIndirectCommand; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateInstance)(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance); +typedef void (VKAPI_PTR *PFN_vkDestroyInstance)(VkInstance instance, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkEnumeratePhysicalDevices)(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties)(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMemoryProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties); +typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetInstanceProcAddr)(VkInstance instance, const char* pName); +typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetDeviceProcAddr)(VkDevice device, const char* pName); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDevice)(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice); +typedef void (VKAPI_PTR *PFN_vkDestroyDevice)(VkDevice device, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceExtensionProperties)(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceExtensionProperties)(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceLayerProperties)(uint32_t* pPropertyCount, VkLayerProperties* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceLayerProperties)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties); +typedef void (VKAPI_PTR *PFN_vkGetDeviceQueue)(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue); +typedef VkResult (VKAPI_PTR *PFN_vkQueueSubmit)(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence); +typedef VkResult (VKAPI_PTR *PFN_vkQueueWaitIdle)(VkQueue queue); +typedef VkResult (VKAPI_PTR *PFN_vkDeviceWaitIdle)(VkDevice device); +typedef VkResult (VKAPI_PTR *PFN_vkAllocateMemory)(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory); +typedef void (VKAPI_PTR *PFN_vkFreeMemory)(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkMapMemory)(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData); +typedef void (VKAPI_PTR *PFN_vkUnmapMemory)(VkDevice device, VkDeviceMemory memory); +typedef VkResult (VKAPI_PTR *PFN_vkFlushMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges); +typedef VkResult (VKAPI_PTR *PFN_vkInvalidateMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges); +typedef void (VKAPI_PTR *PFN_vkGetDeviceMemoryCommitment)(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes); +typedef VkResult (VKAPI_PTR *PFN_vkBindBufferMemory)(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset); +typedef VkResult (VKAPI_PTR *PFN_vkBindImageMemory)(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset); +typedef void (VKAPI_PTR *PFN_vkGetBufferMemoryRequirements)(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetImageMemoryRequirements)(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements)(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkQueueBindSparse)(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence); +typedef VkResult (VKAPI_PTR *PFN_vkCreateFence)(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence); +typedef void (VKAPI_PTR *PFN_vkDestroyFence)(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkResetFences)(VkDevice device, uint32_t fenceCount, const VkFence* pFences); +typedef VkResult (VKAPI_PTR *PFN_vkGetFenceStatus)(VkDevice device, VkFence fence); +typedef VkResult (VKAPI_PTR *PFN_vkWaitForFences)(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout); +typedef VkResult (VKAPI_PTR *PFN_vkCreateSemaphore)(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore); +typedef void (VKAPI_PTR *PFN_vkDestroySemaphore)(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateEvent)(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent); +typedef void (VKAPI_PTR *PFN_vkDestroyEvent)(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetEventStatus)(VkDevice device, VkEvent event); +typedef VkResult (VKAPI_PTR *PFN_vkSetEvent)(VkDevice device, VkEvent event); +typedef VkResult (VKAPI_PTR *PFN_vkResetEvent)(VkDevice device, VkEvent event); +typedef VkResult (VKAPI_PTR *PFN_vkCreateQueryPool)(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool); +typedef void (VKAPI_PTR *PFN_vkDestroyQueryPool)(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetQueryPoolResults)(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags); +typedef VkResult (VKAPI_PTR *PFN_vkCreateBuffer)(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer); +typedef void (VKAPI_PTR *PFN_vkDestroyBuffer)(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateBufferView)(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView); +typedef void (VKAPI_PTR *PFN_vkDestroyBufferView)(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateImage)(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage); +typedef void (VKAPI_PTR *PFN_vkDestroyImage)(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout)(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout); +typedef VkResult (VKAPI_PTR *PFN_vkCreateImageView)(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView); +typedef void (VKAPI_PTR *PFN_vkDestroyImageView)(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateShaderModule)(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule); +typedef void (VKAPI_PTR *PFN_vkDestroyShaderModule)(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreatePipelineCache)(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache); +typedef void (VKAPI_PTR *PFN_vkDestroyPipelineCache)(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetPipelineCacheData)(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData); +typedef VkResult (VKAPI_PTR *PFN_vkMergePipelineCaches)(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches); +typedef VkResult (VKAPI_PTR *PFN_vkCreateGraphicsPipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines); +typedef VkResult (VKAPI_PTR *PFN_vkCreateComputePipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines); +typedef void (VKAPI_PTR *PFN_vkDestroyPipeline)(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreatePipelineLayout)(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout); +typedef void (VKAPI_PTR *PFN_vkDestroyPipelineLayout)(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateSampler)(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler); +typedef void (VKAPI_PTR *PFN_vkDestroySampler)(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorSetLayout)(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout); +typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorSetLayout)(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorPool)(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool); +typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkResetDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags); +typedef VkResult (VKAPI_PTR *PFN_vkAllocateDescriptorSets)(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets); +typedef VkResult (VKAPI_PTR *PFN_vkFreeDescriptorSets)(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets); +typedef void (VKAPI_PTR *PFN_vkUpdateDescriptorSets)(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies); +typedef VkResult (VKAPI_PTR *PFN_vkCreateFramebuffer)(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer); +typedef void (VKAPI_PTR *PFN_vkDestroyFramebuffer)(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateRenderPass)(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass); +typedef void (VKAPI_PTR *PFN_vkDestroyRenderPass)(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkGetRenderAreaGranularity)(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity); +typedef VkResult (VKAPI_PTR *PFN_vkCreateCommandPool)(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool); +typedef void (VKAPI_PTR *PFN_vkDestroyCommandPool)(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkResetCommandPool)(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags); +typedef VkResult (VKAPI_PTR *PFN_vkAllocateCommandBuffers)(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers); +typedef void (VKAPI_PTR *PFN_vkFreeCommandBuffers)(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers); +typedef VkResult (VKAPI_PTR *PFN_vkBeginCommandBuffer)(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo); +typedef VkResult (VKAPI_PTR *PFN_vkEndCommandBuffer)(VkCommandBuffer commandBuffer); +typedef VkResult (VKAPI_PTR *PFN_vkResetCommandBuffer)(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags); +typedef void (VKAPI_PTR *PFN_vkCmdBindPipeline)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline); +typedef void (VKAPI_PTR *PFN_vkCmdSetViewport)(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports); +typedef void (VKAPI_PTR *PFN_vkCmdSetScissor)(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors); +typedef void (VKAPI_PTR *PFN_vkCmdSetLineWidth)(VkCommandBuffer commandBuffer, float lineWidth); +typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBias)(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor); +typedef void (VKAPI_PTR *PFN_vkCmdSetBlendConstants)(VkCommandBuffer commandBuffer, const float blendConstants[4]); +typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBounds)(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds); +typedef void (VKAPI_PTR *PFN_vkCmdSetStencilCompareMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask); +typedef void (VKAPI_PTR *PFN_vkCmdSetStencilWriteMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask); +typedef void (VKAPI_PTR *PFN_vkCmdSetStencilReference)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference); +typedef void (VKAPI_PTR *PFN_vkCmdBindDescriptorSets)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets); +typedef void (VKAPI_PTR *PFN_vkCmdBindIndexBuffer)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType); +typedef void (VKAPI_PTR *PFN_vkCmdBindVertexBuffers)(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets); +typedef void (VKAPI_PTR *PFN_vkCmdDraw)(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance); +typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexed)(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance); +typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); +typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); +typedef void (VKAPI_PTR *PFN_vkCmdDispatch)(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); +typedef void (VKAPI_PTR *PFN_vkCmdDispatchIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset); +typedef void (VKAPI_PTR *PFN_vkCmdCopyBuffer)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdCopyImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdBlitImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter); +typedef void (VKAPI_PTR *PFN_vkCmdCopyBufferToImage)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdCopyImageToBuffer)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdUpdateBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void* pData); +typedef void (VKAPI_PTR *PFN_vkCmdFillBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data); +typedef void (VKAPI_PTR *PFN_vkCmdClearColorImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges); +typedef void (VKAPI_PTR *PFN_vkCmdClearDepthStencilImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges); +typedef void (VKAPI_PTR *PFN_vkCmdClearAttachments)(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects); +typedef void (VKAPI_PTR *PFN_vkCmdResolveImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions); +typedef void (VKAPI_PTR *PFN_vkCmdSetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask); +typedef void (VKAPI_PTR *PFN_vkCmdResetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask); +typedef void (VKAPI_PTR *PFN_vkCmdWaitEvents)(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers); +typedef void (VKAPI_PTR *PFN_vkCmdPipelineBarrier)(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers); +typedef void (VKAPI_PTR *PFN_vkCmdBeginQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags); +typedef void (VKAPI_PTR *PFN_vkCmdEndQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query); +typedef void (VKAPI_PTR *PFN_vkCmdResetQueryPool)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount); +typedef void (VKAPI_PTR *PFN_vkCmdWriteTimestamp)(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query); +typedef void (VKAPI_PTR *PFN_vkCmdCopyQueryPoolResults)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags); +typedef void (VKAPI_PTR *PFN_vkCmdPushConstants)(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues); +typedef void (VKAPI_PTR *PFN_vkCmdBeginRenderPass)(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents); +typedef void (VKAPI_PTR *PFN_vkCmdNextSubpass)(VkCommandBuffer commandBuffer, VkSubpassContents contents); +typedef void (VKAPI_PTR *PFN_vkCmdEndRenderPass)(VkCommandBuffer commandBuffer); +typedef void (VKAPI_PTR *PFN_vkCmdExecuteCommands)(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance( + const VkInstanceCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkInstance* pInstance); + +VKAPI_ATTR void VKAPI_CALL vkDestroyInstance( + VkInstance instance, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices( + VkInstance instance, + uint32_t* pPhysicalDeviceCount, + VkPhysicalDevice* pPhysicalDevices); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures* pFeatures); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkFormatProperties* pFormatProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkImageType type, + VkImageTiling tiling, + VkImageUsageFlags usage, + VkImageCreateFlags flags, + VkImageFormatProperties* pImageFormatProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties* pProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties( + VkPhysicalDevice physicalDevice, + uint32_t* pQueueFamilyPropertyCount, + VkQueueFamilyProperties* pQueueFamilyProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceMemoryProperties* pMemoryProperties); + +VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr( + VkInstance instance, + const char* pName); + +VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr( + VkDevice device, + const char* pName); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice( + VkPhysicalDevice physicalDevice, + const VkDeviceCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDevice* pDevice); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDevice( + VkDevice device, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties( + const char* pLayerName, + uint32_t* pPropertyCount, + VkExtensionProperties* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties( + VkPhysicalDevice physicalDevice, + const char* pLayerName, + uint32_t* pPropertyCount, + VkExtensionProperties* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties( + uint32_t* pPropertyCount, + VkLayerProperties* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties( + VkPhysicalDevice physicalDevice, + uint32_t* pPropertyCount, + VkLayerProperties* pProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue( + VkDevice device, + uint32_t queueFamilyIndex, + uint32_t queueIndex, + VkQueue* pQueue); + +VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit( + VkQueue queue, + uint32_t submitCount, + const VkSubmitInfo* pSubmits, + VkFence fence); + +VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle( + VkQueue queue); + +VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle( + VkDevice device); + +VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory( + VkDevice device, + const VkMemoryAllocateInfo* pAllocateInfo, + const VkAllocationCallbacks* pAllocator, + VkDeviceMemory* pMemory); + +VKAPI_ATTR void VKAPI_CALL vkFreeMemory( + VkDevice device, + VkDeviceMemory memory, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory( + VkDevice device, + VkDeviceMemory memory, + VkDeviceSize offset, + VkDeviceSize size, + VkMemoryMapFlags flags, + void** ppData); + +VKAPI_ATTR void VKAPI_CALL vkUnmapMemory( + VkDevice device, + VkDeviceMemory memory); + +VKAPI_ATTR VkResult VKAPI_CALL vkFlushMappedMemoryRanges( + VkDevice device, + uint32_t memoryRangeCount, + const VkMappedMemoryRange* pMemoryRanges); + +VKAPI_ATTR VkResult VKAPI_CALL vkInvalidateMappedMemoryRanges( + VkDevice device, + uint32_t memoryRangeCount, + const VkMappedMemoryRange* pMemoryRanges); + +VKAPI_ATTR void VKAPI_CALL vkGetDeviceMemoryCommitment( + VkDevice device, + VkDeviceMemory memory, + VkDeviceSize* pCommittedMemoryInBytes); + +VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory( + VkDevice device, + VkBuffer buffer, + VkDeviceMemory memory, + VkDeviceSize memoryOffset); + +VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory( + VkDevice device, + VkImage image, + VkDeviceMemory memory, + VkDeviceSize memoryOffset); + +VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements( + VkDevice device, + VkBuffer buffer, + VkMemoryRequirements* pMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements( + VkDevice device, + VkImage image, + VkMemoryRequirements* pMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements( + VkDevice device, + VkImage image, + uint32_t* pSparseMemoryRequirementCount, + VkSparseImageMemoryRequirements* pSparseMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkImageType type, + VkSampleCountFlagBits samples, + VkImageUsageFlags usage, + VkImageTiling tiling, + uint32_t* pPropertyCount, + VkSparseImageFormatProperties* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse( + VkQueue queue, + uint32_t bindInfoCount, + const VkBindSparseInfo* pBindInfo, + VkFence fence); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence( + VkDevice device, + const VkFenceCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkFence* pFence); + +VKAPI_ATTR void VKAPI_CALL vkDestroyFence( + VkDevice device, + VkFence fence, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetFences( + VkDevice device, + uint32_t fenceCount, + const VkFence* pFences); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus( + VkDevice device, + VkFence fence); + +VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences( + VkDevice device, + uint32_t fenceCount, + const VkFence* pFences, + VkBool32 waitAll, + uint64_t timeout); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore( + VkDevice device, + const VkSemaphoreCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSemaphore* pSemaphore); + +VKAPI_ATTR void VKAPI_CALL vkDestroySemaphore( + VkDevice device, + VkSemaphore semaphore, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateEvent( + VkDevice device, + const VkEventCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkEvent* pEvent); + +VKAPI_ATTR void VKAPI_CALL vkDestroyEvent( + VkDevice device, + VkEvent event, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus( + VkDevice device, + VkEvent event); + +VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent( + VkDevice device, + VkEvent event); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent( + VkDevice device, + VkEvent event); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool( + VkDevice device, + const VkQueryPoolCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkQueryPool* pQueryPool); + +VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool( + VkDevice device, + VkQueryPool queryPool, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults( + VkDevice device, + VkQueryPool queryPool, + uint32_t firstQuery, + uint32_t queryCount, + size_t dataSize, + void* pData, + VkDeviceSize stride, + VkQueryResultFlags flags); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer( + VkDevice device, + const VkBufferCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkBuffer* pBuffer); + +VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer( + VkDevice device, + VkBuffer buffer, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView( + VkDevice device, + const VkBufferViewCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkBufferView* pView); + +VKAPI_ATTR void VKAPI_CALL vkDestroyBufferView( + VkDevice device, + VkBufferView bufferView, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage( + VkDevice device, + const VkImageCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkImage* pImage); + +VKAPI_ATTR void VKAPI_CALL vkDestroyImage( + VkDevice device, + VkImage image, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout( + VkDevice device, + VkImage image, + const VkImageSubresource* pSubresource, + VkSubresourceLayout* pLayout); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView( + VkDevice device, + const VkImageViewCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkImageView* pView); + +VKAPI_ATTR void VKAPI_CALL vkDestroyImageView( + VkDevice device, + VkImageView imageView, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule( + VkDevice device, + const VkShaderModuleCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkShaderModule* pShaderModule); + +VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule( + VkDevice device, + VkShaderModule shaderModule, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache( + VkDevice device, + const VkPipelineCacheCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkPipelineCache* pPipelineCache); + +VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache( + VkDevice device, + VkPipelineCache pipelineCache, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineCacheData( + VkDevice device, + VkPipelineCache pipelineCache, + size_t* pDataSize, + void* pData); + +VKAPI_ATTR VkResult VKAPI_CALL vkMergePipelineCaches( + VkDevice device, + VkPipelineCache dstCache, + uint32_t srcCacheCount, + const VkPipelineCache* pSrcCaches); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines( + VkDevice device, + VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkGraphicsPipelineCreateInfo* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipelines); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateComputePipelines( + VkDevice device, + VkPipelineCache pipelineCache, + uint32_t createInfoCount, + const VkComputePipelineCreateInfo* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkPipeline* pPipelines); + +VKAPI_ATTR void VKAPI_CALL vkDestroyPipeline( + VkDevice device, + VkPipeline pipeline, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineLayout( + VkDevice device, + const VkPipelineLayoutCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkPipelineLayout* pPipelineLayout); + +VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineLayout( + VkDevice device, + VkPipelineLayout pipelineLayout, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateSampler( + VkDevice device, + const VkSamplerCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSampler* pSampler); + +VKAPI_ATTR void VKAPI_CALL vkDestroySampler( + VkDevice device, + VkSampler sampler, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorSetLayout( + VkDevice device, + const VkDescriptorSetLayoutCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDescriptorSetLayout* pSetLayout); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorSetLayout( + VkDevice device, + VkDescriptorSetLayout descriptorSetLayout, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool( + VkDevice device, + const VkDescriptorPoolCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDescriptorPool* pDescriptorPool); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool( + VkDevice device, + VkDescriptorPool descriptorPool, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool( + VkDevice device, + VkDescriptorPool descriptorPool, + VkDescriptorPoolResetFlags flags); + +VKAPI_ATTR VkResult VKAPI_CALL vkAllocateDescriptorSets( + VkDevice device, + const VkDescriptorSetAllocateInfo* pAllocateInfo, + VkDescriptorSet* pDescriptorSets); + +VKAPI_ATTR VkResult VKAPI_CALL vkFreeDescriptorSets( + VkDevice device, + VkDescriptorPool descriptorPool, + uint32_t descriptorSetCount, + const VkDescriptorSet* pDescriptorSets); + +VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets( + VkDevice device, + uint32_t descriptorWriteCount, + const VkWriteDescriptorSet* pDescriptorWrites, + uint32_t descriptorCopyCount, + const VkCopyDescriptorSet* pDescriptorCopies); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer( + VkDevice device, + const VkFramebufferCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkFramebuffer* pFramebuffer); + +VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer( + VkDevice device, + VkFramebuffer framebuffer, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass( + VkDevice device, + const VkRenderPassCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkRenderPass* pRenderPass); + +VKAPI_ATTR void VKAPI_CALL vkDestroyRenderPass( + VkDevice device, + VkRenderPass renderPass, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR void VKAPI_CALL vkGetRenderAreaGranularity( + VkDevice device, + VkRenderPass renderPass, + VkExtent2D* pGranularity); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool( + VkDevice device, + const VkCommandPoolCreateInfo* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkCommandPool* pCommandPool); + +VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool( + VkDevice device, + VkCommandPool commandPool, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool( + VkDevice device, + VkCommandPool commandPool, + VkCommandPoolResetFlags flags); + +VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers( + VkDevice device, + const VkCommandBufferAllocateInfo* pAllocateInfo, + VkCommandBuffer* pCommandBuffers); + +VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers( + VkDevice device, + VkCommandPool commandPool, + uint32_t commandBufferCount, + const VkCommandBuffer* pCommandBuffers); + +VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer( + VkCommandBuffer commandBuffer, + const VkCommandBufferBeginInfo* pBeginInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer( + VkCommandBuffer commandBuffer); + +VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandBuffer( + VkCommandBuffer commandBuffer, + VkCommandBufferResetFlags flags); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindPipeline( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipeline pipeline); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetViewport( + VkCommandBuffer commandBuffer, + uint32_t firstViewport, + uint32_t viewportCount, + const VkViewport* pViewports); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor( + VkCommandBuffer commandBuffer, + uint32_t firstScissor, + uint32_t scissorCount, + const VkRect2D* pScissors); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetLineWidth( + VkCommandBuffer commandBuffer, + float lineWidth); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias( + VkCommandBuffer commandBuffer, + float depthBiasConstantFactor, + float depthBiasClamp, + float depthBiasSlopeFactor); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetBlendConstants( + VkCommandBuffer commandBuffer, + const float blendConstants[4]); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBounds( + VkCommandBuffer commandBuffer, + float minDepthBounds, + float maxDepthBounds); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilCompareMask( + VkCommandBuffer commandBuffer, + VkStencilFaceFlags faceMask, + uint32_t compareMask); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilWriteMask( + VkCommandBuffer commandBuffer, + VkStencilFaceFlags faceMask, + uint32_t writeMask); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilReference( + VkCommandBuffer commandBuffer, + VkStencilFaceFlags faceMask, + uint32_t reference); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipelineLayout layout, + uint32_t firstSet, + uint32_t descriptorSetCount, + const VkDescriptorSet* pDescriptorSets, + uint32_t dynamicOffsetCount, + const uint32_t* pDynamicOffsets); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + VkIndexType indexType); + +VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers( + VkCommandBuffer commandBuffer, + uint32_t firstBinding, + uint32_t bindingCount, + const VkBuffer* pBuffers, + const VkDeviceSize* pOffsets); + +VKAPI_ATTR void VKAPI_CALL vkCmdDraw( + VkCommandBuffer commandBuffer, + uint32_t vertexCount, + uint32_t instanceCount, + uint32_t firstVertex, + uint32_t firstInstance); + +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed( + VkCommandBuffer commandBuffer, + uint32_t indexCount, + uint32_t instanceCount, + uint32_t firstIndex, + int32_t vertexOffset, + uint32_t firstInstance); + +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirect( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + uint32_t drawCount, + uint32_t stride); + +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirect( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + uint32_t drawCount, + uint32_t stride); + +VKAPI_ATTR void VKAPI_CALL vkCmdDispatch( + VkCommandBuffer commandBuffer, + uint32_t groupCountX, + uint32_t groupCountY, + uint32_t groupCountZ); + +VKAPI_ATTR void VKAPI_CALL vkCmdDispatchIndirect( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer( + VkCommandBuffer commandBuffer, + VkBuffer srcBuffer, + VkBuffer dstBuffer, + uint32_t regionCount, + const VkBufferCopy* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage( + VkCommandBuffer commandBuffer, + VkImage srcImage, + VkImageLayout srcImageLayout, + VkImage dstImage, + VkImageLayout dstImageLayout, + uint32_t regionCount, + const VkImageCopy* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage( + VkCommandBuffer commandBuffer, + VkImage srcImage, + VkImageLayout srcImageLayout, + VkImage dstImage, + VkImageLayout dstImageLayout, + uint32_t regionCount, + const VkImageBlit* pRegions, + VkFilter filter); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage( + VkCommandBuffer commandBuffer, + VkBuffer srcBuffer, + VkImage dstImage, + VkImageLayout dstImageLayout, + uint32_t regionCount, + const VkBufferImageCopy* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer( + VkCommandBuffer commandBuffer, + VkImage srcImage, + VkImageLayout srcImageLayout, + VkBuffer dstBuffer, + uint32_t regionCount, + const VkBufferImageCopy* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer( + VkCommandBuffer commandBuffer, + VkBuffer dstBuffer, + VkDeviceSize dstOffset, + VkDeviceSize dataSize, + const void* pData); + +VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer( + VkCommandBuffer commandBuffer, + VkBuffer dstBuffer, + VkDeviceSize dstOffset, + VkDeviceSize size, + uint32_t data); + +VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage( + VkCommandBuffer commandBuffer, + VkImage image, + VkImageLayout imageLayout, + const VkClearColorValue* pColor, + uint32_t rangeCount, + const VkImageSubresourceRange* pRanges); + +VKAPI_ATTR void VKAPI_CALL vkCmdClearDepthStencilImage( + VkCommandBuffer commandBuffer, + VkImage image, + VkImageLayout imageLayout, + const VkClearDepthStencilValue* pDepthStencil, + uint32_t rangeCount, + const VkImageSubresourceRange* pRanges); + +VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments( + VkCommandBuffer commandBuffer, + uint32_t attachmentCount, + const VkClearAttachment* pAttachments, + uint32_t rectCount, + const VkClearRect* pRects); + +VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage( + VkCommandBuffer commandBuffer, + VkImage srcImage, + VkImageLayout srcImageLayout, + VkImage dstImage, + VkImageLayout dstImageLayout, + uint32_t regionCount, + const VkImageResolve* pRegions); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent( + VkCommandBuffer commandBuffer, + VkEvent event, + VkPipelineStageFlags stageMask); + +VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent( + VkCommandBuffer commandBuffer, + VkEvent event, + VkPipelineStageFlags stageMask); + +VKAPI_ATTR void VKAPI_CALL vkCmdWaitEvents( + VkCommandBuffer commandBuffer, + uint32_t eventCount, + const VkEvent* pEvents, + VkPipelineStageFlags srcStageMask, + VkPipelineStageFlags dstStageMask, + uint32_t memoryBarrierCount, + const VkMemoryBarrier* pMemoryBarriers, + uint32_t bufferMemoryBarrierCount, + const VkBufferMemoryBarrier* pBufferMemoryBarriers, + uint32_t imageMemoryBarrierCount, + const VkImageMemoryBarrier* pImageMemoryBarriers); + +VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier( + VkCommandBuffer commandBuffer, + VkPipelineStageFlags srcStageMask, + VkPipelineStageFlags dstStageMask, + VkDependencyFlags dependencyFlags, + uint32_t memoryBarrierCount, + const VkMemoryBarrier* pMemoryBarriers, + uint32_t bufferMemoryBarrierCount, + const VkBufferMemoryBarrier* pBufferMemoryBarriers, + uint32_t imageMemoryBarrierCount, + const VkImageMemoryBarrier* pImageMemoryBarriers); + +VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery( + VkCommandBuffer commandBuffer, + VkQueryPool queryPool, + uint32_t query, + VkQueryControlFlags flags); + +VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery( + VkCommandBuffer commandBuffer, + VkQueryPool queryPool, + uint32_t query); + +VKAPI_ATTR void VKAPI_CALL vkCmdResetQueryPool( + VkCommandBuffer commandBuffer, + VkQueryPool queryPool, + uint32_t firstQuery, + uint32_t queryCount); + +VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp( + VkCommandBuffer commandBuffer, + VkPipelineStageFlagBits pipelineStage, + VkQueryPool queryPool, + uint32_t query); + +VKAPI_ATTR void VKAPI_CALL vkCmdCopyQueryPoolResults( + VkCommandBuffer commandBuffer, + VkQueryPool queryPool, + uint32_t firstQuery, + uint32_t queryCount, + VkBuffer dstBuffer, + VkDeviceSize dstOffset, + VkDeviceSize stride, + VkQueryResultFlags flags); + +VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants( + VkCommandBuffer commandBuffer, + VkPipelineLayout layout, + VkShaderStageFlags stageFlags, + uint32_t offset, + uint32_t size, + const void* pValues); + +VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass( + VkCommandBuffer commandBuffer, + const VkRenderPassBeginInfo* pRenderPassBegin, + VkSubpassContents contents); + +VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass( + VkCommandBuffer commandBuffer, + VkSubpassContents contents); + +VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass( + VkCommandBuffer commandBuffer); + +VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands( + VkCommandBuffer commandBuffer, + uint32_t commandBufferCount, + const VkCommandBuffer* pCommandBuffers); +#endif + +#define VK_KHR_surface 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) + +#define VK_KHR_SURFACE_SPEC_VERSION 25 +#define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface" +#define VK_COLORSPACE_SRGB_NONLINEAR_KHR VK_COLOR_SPACE_SRGB_NONLINEAR_KHR + + +typedef enum VkColorSpaceKHR { + VK_COLOR_SPACE_SRGB_NONLINEAR_KHR = 0, + VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT = 1000104001, + VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT = 1000104002, + VK_COLOR_SPACE_DCI_P3_LINEAR_EXT = 1000104003, + VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT = 1000104004, + VK_COLOR_SPACE_BT709_LINEAR_EXT = 1000104005, + VK_COLOR_SPACE_BT709_NONLINEAR_EXT = 1000104006, + VK_COLOR_SPACE_BT2020_LINEAR_EXT = 1000104007, + VK_COLOR_SPACE_HDR10_ST2084_EXT = 1000104008, + VK_COLOR_SPACE_DOLBYVISION_EXT = 1000104009, + VK_COLOR_SPACE_HDR10_HLG_EXT = 1000104010, + VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT = 1000104011, + VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT = 1000104012, + VK_COLOR_SPACE_PASS_THROUGH_EXT = 1000104013, + VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT = 1000104014, + VK_COLOR_SPACE_BEGIN_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, + VK_COLOR_SPACE_END_RANGE_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, + VK_COLOR_SPACE_RANGE_SIZE_KHR = (VK_COLOR_SPACE_SRGB_NONLINEAR_KHR - VK_COLOR_SPACE_SRGB_NONLINEAR_KHR + 1), + VK_COLOR_SPACE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkColorSpaceKHR; + +typedef enum VkPresentModeKHR { + VK_PRESENT_MODE_IMMEDIATE_KHR = 0, + VK_PRESENT_MODE_MAILBOX_KHR = 1, + VK_PRESENT_MODE_FIFO_KHR = 2, + VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3, + VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR = 1000111000, + VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR = 1000111001, + VK_PRESENT_MODE_BEGIN_RANGE_KHR = VK_PRESENT_MODE_IMMEDIATE_KHR, + VK_PRESENT_MODE_END_RANGE_KHR = VK_PRESENT_MODE_FIFO_RELAXED_KHR, + VK_PRESENT_MODE_RANGE_SIZE_KHR = (VK_PRESENT_MODE_FIFO_RELAXED_KHR - VK_PRESENT_MODE_IMMEDIATE_KHR + 1), + VK_PRESENT_MODE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkPresentModeKHR; + + +typedef enum VkSurfaceTransformFlagBitsKHR { + VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR = 0x00000001, + VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR = 0x00000002, + VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR = 0x00000004, + VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR = 0x00000008, + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR = 0x00000010, + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR = 0x00000020, + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = 0x00000040, + VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = 0x00000080, + VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100, + VK_SURFACE_TRANSFORM_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkSurfaceTransformFlagBitsKHR; +typedef VkFlags VkSurfaceTransformFlagsKHR; + +typedef enum VkCompositeAlphaFlagBitsKHR { + VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 0x00000001, + VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002, + VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004, + VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008, + VK_COMPOSITE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkCompositeAlphaFlagBitsKHR; +typedef VkFlags VkCompositeAlphaFlagsKHR; + +typedef struct VkSurfaceCapabilitiesKHR { + uint32_t minImageCount; + uint32_t maxImageCount; + VkExtent2D currentExtent; + VkExtent2D minImageExtent; + VkExtent2D maxImageExtent; + uint32_t maxImageArrayLayers; + VkSurfaceTransformFlagsKHR supportedTransforms; + VkSurfaceTransformFlagBitsKHR currentTransform; + VkCompositeAlphaFlagsKHR supportedCompositeAlpha; + VkImageUsageFlags supportedUsageFlags; +} VkSurfaceCapabilitiesKHR; + +typedef struct VkSurfaceFormatKHR { + VkFormat format; + VkColorSpaceKHR colorSpace; +} VkSurfaceFormatKHR; + + +typedef void (VKAPI_PTR *PFN_vkDestroySurfaceKHR)(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32* pSupported); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR( + VkInstance instance, + VkSurfaceKHR surface, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + VkSurfaceKHR surface, + VkBool32* pSupported); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR( + VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + VkSurfaceCapabilitiesKHR* pSurfaceCapabilities); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR( + VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + uint32_t* pSurfaceFormatCount, + VkSurfaceFormatKHR* pSurfaceFormats); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR( + VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + uint32_t* pPresentModeCount, + VkPresentModeKHR* pPresentModes); +#endif + +#define VK_KHR_swapchain 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSwapchainKHR) + +#define VK_KHR_SWAPCHAIN_SPEC_VERSION 68 +#define VK_KHR_SWAPCHAIN_EXTENSION_NAME "VK_KHR_swapchain" + + +typedef enum VkSwapchainCreateFlagBitsKHR { + VK_SWAPCHAIN_CREATE_BIND_SFR_BIT_KHX = 0x00000001, + VK_SWAPCHAIN_CREATE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkSwapchainCreateFlagBitsKHR; +typedef VkFlags VkSwapchainCreateFlagsKHR; + +typedef struct VkSwapchainCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkSwapchainCreateFlagsKHR flags; + VkSurfaceKHR surface; + uint32_t minImageCount; + VkFormat imageFormat; + VkColorSpaceKHR imageColorSpace; + VkExtent2D imageExtent; + uint32_t imageArrayLayers; + VkImageUsageFlags imageUsage; + VkSharingMode imageSharingMode; + uint32_t queueFamilyIndexCount; + const uint32_t* pQueueFamilyIndices; + VkSurfaceTransformFlagBitsKHR preTransform; + VkCompositeAlphaFlagBitsKHR compositeAlpha; + VkPresentModeKHR presentMode; + VkBool32 clipped; + VkSwapchainKHR oldSwapchain; +} VkSwapchainCreateInfoKHR; + +typedef struct VkPresentInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreCount; + const VkSemaphore* pWaitSemaphores; + uint32_t swapchainCount; + const VkSwapchainKHR* pSwapchains; + const uint32_t* pImageIndices; + VkResult* pResults; +} VkPresentInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateSwapchainKHR)(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain); +typedef void (VKAPI_PTR *PFN_vkDestroySwapchainKHR)(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainImagesKHR)(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages); +typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImageKHR)(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex); +typedef VkResult (VKAPI_PTR *PFN_vkQueuePresentKHR)(VkQueue queue, const VkPresentInfoKHR* pPresentInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR( + VkDevice device, + const VkSwapchainCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSwapchainKHR* pSwapchain); + +VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR( + VkDevice device, + VkSwapchainKHR swapchain, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR( + VkDevice device, + VkSwapchainKHR swapchain, + uint32_t* pSwapchainImageCount, + VkImage* pSwapchainImages); + +VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR( + VkDevice device, + VkSwapchainKHR swapchain, + uint64_t timeout, + VkSemaphore semaphore, + VkFence fence, + uint32_t* pImageIndex); + +VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR( + VkQueue queue, + const VkPresentInfoKHR* pPresentInfo); +#endif + +#define VK_KHR_display 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayKHR) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayModeKHR) + +#define VK_KHR_DISPLAY_SPEC_VERSION 21 +#define VK_KHR_DISPLAY_EXTENSION_NAME "VK_KHR_display" + + +typedef enum VkDisplayPlaneAlphaFlagBitsKHR { + VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR = 0x00000001, + VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000002, + VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000004, + VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000008, + VK_DISPLAY_PLANE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkDisplayPlaneAlphaFlagBitsKHR; +typedef VkFlags VkDisplayPlaneAlphaFlagsKHR; +typedef VkFlags VkDisplayModeCreateFlagsKHR; +typedef VkFlags VkDisplaySurfaceCreateFlagsKHR; + +typedef struct VkDisplayPropertiesKHR { + VkDisplayKHR display; + const char* displayName; + VkExtent2D physicalDimensions; + VkExtent2D physicalResolution; + VkSurfaceTransformFlagsKHR supportedTransforms; + VkBool32 planeReorderPossible; + VkBool32 persistentContent; +} VkDisplayPropertiesKHR; + +typedef struct VkDisplayModeParametersKHR { + VkExtent2D visibleRegion; + uint32_t refreshRate; +} VkDisplayModeParametersKHR; + +typedef struct VkDisplayModePropertiesKHR { + VkDisplayModeKHR displayMode; + VkDisplayModeParametersKHR parameters; +} VkDisplayModePropertiesKHR; + +typedef struct VkDisplayModeCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkDisplayModeCreateFlagsKHR flags; + VkDisplayModeParametersKHR parameters; +} VkDisplayModeCreateInfoKHR; + +typedef struct VkDisplayPlaneCapabilitiesKHR { + VkDisplayPlaneAlphaFlagsKHR supportedAlpha; + VkOffset2D minSrcPosition; + VkOffset2D maxSrcPosition; + VkExtent2D minSrcExtent; + VkExtent2D maxSrcExtent; + VkOffset2D minDstPosition; + VkOffset2D maxDstPosition; + VkExtent2D minDstExtent; + VkExtent2D maxDstExtent; +} VkDisplayPlaneCapabilitiesKHR; + +typedef struct VkDisplayPlanePropertiesKHR { + VkDisplayKHR currentDisplay; + uint32_t currentStackIndex; +} VkDisplayPlanePropertiesKHR; + +typedef struct VkDisplaySurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkDisplaySurfaceCreateFlagsKHR flags; + VkDisplayModeKHR displayMode; + uint32_t planeIndex; + uint32_t planeStackIndex; + VkSurfaceTransformFlagBitsKHR transform; + float globalAlpha; + VkDisplayPlaneAlphaFlagBitsKHR alphaMode; + VkExtent2D imageExtent; +} VkDisplaySurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPropertiesKHR* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPlanePropertiesKHR* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneSupportedDisplaysKHR)(VkPhysicalDevice physicalDevice, uint32_t planeIndex, uint32_t* pDisplayCount, VkDisplayKHR* pDisplays); +typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayModePropertiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t* pPropertyCount, VkDisplayModePropertiesKHR* pProperties); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayModeKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, const VkDisplayModeCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDisplayModeKHR* pMode); +typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR* pCapabilities); +typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayPlaneSurfaceKHR)(VkInstance instance, const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPropertiesKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pPropertyCount, + VkDisplayPropertiesKHR* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPlanePropertiesKHR( + VkPhysicalDevice physicalDevice, + uint32_t* pPropertyCount, + VkDisplayPlanePropertiesKHR* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneSupportedDisplaysKHR( + VkPhysicalDevice physicalDevice, + uint32_t planeIndex, + uint32_t* pDisplayCount, + VkDisplayKHR* pDisplays); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayModePropertiesKHR( + VkPhysicalDevice physicalDevice, + VkDisplayKHR display, + uint32_t* pPropertyCount, + VkDisplayModePropertiesKHR* pProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayModeKHR( + VkPhysicalDevice physicalDevice, + VkDisplayKHR display, + const VkDisplayModeCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDisplayModeKHR* pMode); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilitiesKHR( + VkPhysicalDevice physicalDevice, + VkDisplayModeKHR mode, + uint32_t planeIndex, + VkDisplayPlaneCapabilitiesKHR* pCapabilities); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayPlaneSurfaceKHR( + VkInstance instance, + const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif + +#define VK_KHR_display_swapchain 1 +#define VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION 9 +#define VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME "VK_KHR_display_swapchain" + +typedef struct VkDisplayPresentInfoKHR { + VkStructureType sType; + const void* pNext; + VkRect2D srcRect; + VkRect2D dstRect; + VkBool32 persistent; +} VkDisplayPresentInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateSharedSwapchainsKHR)(VkDevice device, uint32_t swapchainCount, const VkSwapchainCreateInfoKHR* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchains); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateSharedSwapchainsKHR( + VkDevice device, + uint32_t swapchainCount, + const VkSwapchainCreateInfoKHR* pCreateInfos, + const VkAllocationCallbacks* pAllocator, + VkSwapchainKHR* pSwapchains); +#endif + +#ifdef VK_USE_PLATFORM_XLIB_KHR +#define VK_KHR_xlib_surface 1 +#include + +#define VK_KHR_XLIB_SURFACE_SPEC_VERSION 6 +#define VK_KHR_XLIB_SURFACE_EXTENSION_NAME "VK_KHR_xlib_surface" + +typedef VkFlags VkXlibSurfaceCreateFlagsKHR; + +typedef struct VkXlibSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkXlibSurfaceCreateFlagsKHR flags; + Display* dpy; + Window window; +} VkXlibSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateXlibSurfaceKHR)(VkInstance instance, const VkXlibSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXlibPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, Display* dpy, VisualID visualID); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateXlibSurfaceKHR( + VkInstance instance, + const VkXlibSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXlibPresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + Display* dpy, + VisualID visualID); +#endif +#endif /* VK_USE_PLATFORM_XLIB_KHR */ + +#ifdef VK_USE_PLATFORM_XCB_KHR +#define VK_KHR_xcb_surface 1 +#include + +#define VK_KHR_XCB_SURFACE_SPEC_VERSION 6 +#define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface" + +typedef VkFlags VkXcbSurfaceCreateFlagsKHR; + +typedef struct VkXcbSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkXcbSurfaceCreateFlagsKHR flags; + xcb_connection_t* connection; + xcb_window_t window; +} VkXcbSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateXcbSurfaceKHR)(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR( + VkInstance instance, + const VkXcbSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + xcb_connection_t* connection, + xcb_visualid_t visual_id); +#endif +#endif /* VK_USE_PLATFORM_XCB_KHR */ + +#ifdef VK_USE_PLATFORM_WAYLAND_KHR +#define VK_KHR_wayland_surface 1 +#include + +#define VK_KHR_WAYLAND_SURFACE_SPEC_VERSION 6 +#define VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "VK_KHR_wayland_surface" + +typedef VkFlags VkWaylandSurfaceCreateFlagsKHR; + +typedef struct VkWaylandSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkWaylandSurfaceCreateFlagsKHR flags; + struct wl_display* display; + struct wl_surface* surface; +} VkWaylandSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateWaylandSurfaceKHR)(VkInstance instance, const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWaylandPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, struct wl_display* display); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateWaylandSurfaceKHR( + VkInstance instance, + const VkWaylandSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWaylandPresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + struct wl_display* display); +#endif +#endif /* VK_USE_PLATFORM_WAYLAND_KHR */ + +#ifdef VK_USE_PLATFORM_MIR_KHR +#define VK_KHR_mir_surface 1 +#include + +#define VK_KHR_MIR_SURFACE_SPEC_VERSION 4 +#define VK_KHR_MIR_SURFACE_EXTENSION_NAME "VK_KHR_mir_surface" + +typedef VkFlags VkMirSurfaceCreateFlagsKHR; + +typedef struct VkMirSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkMirSurfaceCreateFlagsKHR flags; + MirConnection* connection; + MirSurface* mirSurface; +} VkMirSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateMirSurfaceKHR)(VkInstance instance, const VkMirSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceMirPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, MirConnection* connection); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateMirSurfaceKHR( + VkInstance instance, + const VkMirSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceMirPresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex, + MirConnection* connection); +#endif +#endif /* VK_USE_PLATFORM_MIR_KHR */ + +#ifdef VK_USE_PLATFORM_ANDROID_KHR +#define VK_KHR_android_surface 1 +#include + +#define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6 +#define VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "VK_KHR_android_surface" + +typedef VkFlags VkAndroidSurfaceCreateFlagsKHR; + +typedef struct VkAndroidSurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkAndroidSurfaceCreateFlagsKHR flags; + ANativeWindow* window; +} VkAndroidSurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateAndroidSurfaceKHR)(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR( + VkInstance instance, + const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif +#endif /* VK_USE_PLATFORM_ANDROID_KHR */ + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_win32_surface 1 +#include + +#define VK_KHR_WIN32_SURFACE_SPEC_VERSION 6 +#define VK_KHR_WIN32_SURFACE_EXTENSION_NAME "VK_KHR_win32_surface" + +typedef VkFlags VkWin32SurfaceCreateFlagsKHR; + +typedef struct VkWin32SurfaceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkWin32SurfaceCreateFlagsKHR flags; + HINSTANCE hinstance; + HWND hwnd; +} VkWin32SurfaceCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateWin32SurfaceKHR)(VkInstance instance, const VkWin32SurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); +typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR( + VkInstance instance, + const VkWin32SurfaceCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); + +VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR( + VkPhysicalDevice physicalDevice, + uint32_t queueFamilyIndex); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_sampler_mirror_clamp_to_edge 1 +#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION 1 +#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME "VK_KHR_sampler_mirror_clamp_to_edge" + + +#define VK_KHR_get_physical_device_properties2 1 +#define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION 1 +#define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME "VK_KHR_get_physical_device_properties2" + +typedef struct VkPhysicalDeviceFeatures2KHR { + VkStructureType sType; + void* pNext; + VkPhysicalDeviceFeatures features; +} VkPhysicalDeviceFeatures2KHR; + +typedef struct VkPhysicalDeviceProperties2KHR { + VkStructureType sType; + void* pNext; + VkPhysicalDeviceProperties properties; +} VkPhysicalDeviceProperties2KHR; + +typedef struct VkFormatProperties2KHR { + VkStructureType sType; + void* pNext; + VkFormatProperties formatProperties; +} VkFormatProperties2KHR; + +typedef struct VkImageFormatProperties2KHR { + VkStructureType sType; + void* pNext; + VkImageFormatProperties imageFormatProperties; +} VkImageFormatProperties2KHR; + +typedef struct VkPhysicalDeviceImageFormatInfo2KHR { + VkStructureType sType; + const void* pNext; + VkFormat format; + VkImageType type; + VkImageTiling tiling; + VkImageUsageFlags usage; + VkImageCreateFlags flags; +} VkPhysicalDeviceImageFormatInfo2KHR; + +typedef struct VkQueueFamilyProperties2KHR { + VkStructureType sType; + void* pNext; + VkQueueFamilyProperties queueFamilyProperties; +} VkQueueFamilyProperties2KHR; + +typedef struct VkPhysicalDeviceMemoryProperties2KHR { + VkStructureType sType; + void* pNext; + VkPhysicalDeviceMemoryProperties memoryProperties; +} VkPhysicalDeviceMemoryProperties2KHR; + +typedef struct VkSparseImageFormatProperties2KHR { + VkStructureType sType; + void* pNext; + VkSparseImageFormatProperties properties; +} VkSparseImageFormatProperties2KHR; + +typedef struct VkPhysicalDeviceSparseImageFormatInfo2KHR { + VkStructureType sType; + const void* pNext; + VkFormat format; + VkImageType type; + VkSampleCountFlagBits samples; + VkImageUsageFlags usage; + VkImageTiling tiling; +} VkPhysicalDeviceSparseImageFormatInfo2KHR; + + +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2KHR* pFeatures); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceProperties2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2KHR* pProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFormatProperties2KHR)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2KHR* pFormatProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2KHR* pImageFormatInfo, VkImageFormatProperties2KHR* pImageFormatProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR)(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties2KHR* pQueueFamilyProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMemoryProperties2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2KHR* pMemoryProperties); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2KHR* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2KHR* pProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2KHR( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceFeatures2KHR* pFeatures); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2KHR( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceProperties2KHR* pProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2KHR( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkFormatProperties2KHR* pFormatProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2KHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceImageFormatInfo2KHR* pImageFormatInfo, + VkImageFormatProperties2KHR* pImageFormatProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2KHR( + VkPhysicalDevice physicalDevice, + uint32_t* pQueueFamilyPropertyCount, + VkQueueFamilyProperties2KHR* pQueueFamilyProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2KHR( + VkPhysicalDevice physicalDevice, + VkPhysicalDeviceMemoryProperties2KHR* pMemoryProperties); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2KHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceSparseImageFormatInfo2KHR* pFormatInfo, + uint32_t* pPropertyCount, + VkSparseImageFormatProperties2KHR* pProperties); +#endif + +#define VK_KHR_shader_draw_parameters 1 +#define VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION 1 +#define VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME "VK_KHR_shader_draw_parameters" + + +#define VK_KHR_maintenance1 1 +#define VK_KHR_MAINTENANCE1_SPEC_VERSION 1 +#define VK_KHR_MAINTENANCE1_EXTENSION_NAME "VK_KHR_maintenance1" + +typedef VkFlags VkCommandPoolTrimFlagsKHR; + +typedef void (VKAPI_PTR *PFN_vkTrimCommandPoolKHR)(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlagsKHR flags); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkTrimCommandPoolKHR( + VkDevice device, + VkCommandPool commandPool, + VkCommandPoolTrimFlagsKHR flags); +#endif + +#define VK_KHR_external_memory_capabilities 1 +#define VK_LUID_SIZE_KHR 8 +#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_memory_capabilities" + + +typedef enum VkExternalMemoryHandleTypeFlagBitsKHR { + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = 0x00000001, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = 0x00000002, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 0x00000004, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT_KHR = 0x00000008, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHR = 0x00000010, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHR = 0x00000020, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR = 0x00000040, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalMemoryHandleTypeFlagBitsKHR; +typedef VkFlags VkExternalMemoryHandleTypeFlagsKHR; + +typedef enum VkExternalMemoryFeatureFlagBitsKHR { + VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_KHR = 0x00000001, + VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_KHR = 0x00000002, + VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHR = 0x00000004, + VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalMemoryFeatureFlagBitsKHR; +typedef VkFlags VkExternalMemoryFeatureFlagsKHR; + +typedef struct VkExternalMemoryPropertiesKHR { + VkExternalMemoryFeatureFlagsKHR externalMemoryFeatures; + VkExternalMemoryHandleTypeFlagsKHR exportFromImportedHandleTypes; + VkExternalMemoryHandleTypeFlagsKHR compatibleHandleTypes; +} VkExternalMemoryPropertiesKHR; + +typedef struct VkPhysicalDeviceExternalImageFormatInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; +} VkPhysicalDeviceExternalImageFormatInfoKHR; + +typedef struct VkExternalImageFormatPropertiesKHR { + VkStructureType sType; + void* pNext; + VkExternalMemoryPropertiesKHR externalMemoryProperties; +} VkExternalImageFormatPropertiesKHR; + +typedef struct VkPhysicalDeviceExternalBufferInfoKHR { + VkStructureType sType; + const void* pNext; + VkBufferCreateFlags flags; + VkBufferUsageFlags usage; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; +} VkPhysicalDeviceExternalBufferInfoKHR; + +typedef struct VkExternalBufferPropertiesKHR { + VkStructureType sType; + void* pNext; + VkExternalMemoryPropertiesKHR externalMemoryProperties; +} VkExternalBufferPropertiesKHR; + +typedef struct VkPhysicalDeviceIDPropertiesKHR { + VkStructureType sType; + void* pNext; + uint8_t deviceUUID[VK_UUID_SIZE]; + uint8_t driverUUID[VK_UUID_SIZE]; + uint8_t deviceLUID[VK_LUID_SIZE_KHR]; + uint32_t deviceNodeMask; + VkBool32 deviceLUIDValid; +} VkPhysicalDeviceIDPropertiesKHR; + + +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfoKHR* pExternalBufferInfo, VkExternalBufferPropertiesKHR* pExternalBufferProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferPropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalBufferInfoKHR* pExternalBufferInfo, + VkExternalBufferPropertiesKHR* pExternalBufferProperties); +#endif + +#define VK_KHR_external_memory 1 +#define VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME "VK_KHR_external_memory" +#define VK_QUEUE_FAMILY_EXTERNAL_KHR (~0U-1) + +typedef struct VkExternalMemoryImageCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsKHR handleTypes; +} VkExternalMemoryImageCreateInfoKHR; + +typedef struct VkExternalMemoryBufferCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsKHR handleTypes; +} VkExternalMemoryBufferCreateInfoKHR; + +typedef struct VkExportMemoryAllocateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsKHR handleTypes; +} VkExportMemoryAllocateInfoKHR; + + + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_external_memory_win32 1 +#define VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_KHR_external_memory_win32" + +typedef struct VkImportMemoryWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; + HANDLE handle; + LPCWSTR name; +} VkImportMemoryWin32HandleInfoKHR; + +typedef struct VkExportMemoryWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + const SECURITY_ATTRIBUTES* pAttributes; + DWORD dwAccess; + LPCWSTR name; +} VkExportMemoryWin32HandleInfoKHR; + +typedef struct VkMemoryWin32HandlePropertiesKHR { + VkStructureType sType; + void* pNext; + uint32_t memoryTypeBits; +} VkMemoryWin32HandlePropertiesKHR; + +typedef struct VkMemoryGetWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkDeviceMemory memory; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; +} VkMemoryGetWin32HandleInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleKHR)(VkDevice device, const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle); +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandlePropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHR handleType, HANDLE handle, VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleKHR( + VkDevice device, + const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, + HANDLE* pHandle); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandlePropertiesKHR( + VkDevice device, + VkExternalMemoryHandleTypeFlagBitsKHR handleType, + HANDLE handle, + VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_external_memory_fd 1 +#define VK_KHR_EXTERNAL_MEMORY_FD_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME "VK_KHR_external_memory_fd" + +typedef struct VkImportMemoryFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; + int fd; +} VkImportMemoryFdInfoKHR; + +typedef struct VkMemoryFdPropertiesKHR { + VkStructureType sType; + void* pNext; + uint32_t memoryTypeBits; +} VkMemoryFdPropertiesKHR; + +typedef struct VkMemoryGetFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkDeviceMemory memory; + VkExternalMemoryHandleTypeFlagBitsKHR handleType; +} VkMemoryGetFdInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryFdKHR)(VkDevice device, const VkMemoryGetFdInfoKHR* pGetFdInfo, int* pFd); +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryFdPropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBitsKHR handleType, int fd, VkMemoryFdPropertiesKHR* pMemoryFdProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdKHR( + VkDevice device, + const VkMemoryGetFdInfoKHR* pGetFdInfo, + int* pFd); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdPropertiesKHR( + VkDevice device, + VkExternalMemoryHandleTypeFlagBitsKHR handleType, + int fd, + VkMemoryFdPropertiesKHR* pMemoryFdProperties); +#endif + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_win32_keyed_mutex 1 +#define VK_KHR_WIN32_KEYED_MUTEX_SPEC_VERSION 1 +#define VK_KHR_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_KHR_win32_keyed_mutex" + +typedef struct VkWin32KeyedMutexAcquireReleaseInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t acquireCount; + const VkDeviceMemory* pAcquireSyncs; + const uint64_t* pAcquireKeys; + const uint32_t* pAcquireTimeouts; + uint32_t releaseCount; + const VkDeviceMemory* pReleaseSyncs; + const uint64_t* pReleaseKeys; +} VkWin32KeyedMutexAcquireReleaseInfoKHR; + + +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_external_semaphore_capabilities 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_semaphore_capabilities" + + +typedef enum VkExternalSemaphoreHandleTypeFlagBitsKHR { + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = 0x00000001, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = 0x00000002, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 0x00000004, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT_KHR = 0x00000008, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR = 0x00000010, + VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalSemaphoreHandleTypeFlagBitsKHR; +typedef VkFlags VkExternalSemaphoreHandleTypeFlagsKHR; + +typedef enum VkExternalSemaphoreFeatureFlagBitsKHR { + VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT_KHR = 0x00000001, + VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT_KHR = 0x00000002, + VK_EXTERNAL_SEMAPHORE_FEATURE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalSemaphoreFeatureFlagBitsKHR; +typedef VkFlags VkExternalSemaphoreFeatureFlagsKHR; + +typedef struct VkPhysicalDeviceExternalSemaphoreInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; +} VkPhysicalDeviceExternalSemaphoreInfoKHR; + +typedef struct VkExternalSemaphorePropertiesKHR { + VkStructureType sType; + void* pNext; + VkExternalSemaphoreHandleTypeFlagsKHR exportFromImportedHandleTypes; + VkExternalSemaphoreHandleTypeFlagsKHR compatibleHandleTypes; + VkExternalSemaphoreFeatureFlagsKHR externalSemaphoreFeatures; +} VkExternalSemaphorePropertiesKHR; + + +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfoKHR* pExternalSemaphoreInfo, VkExternalSemaphorePropertiesKHR* pExternalSemaphoreProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphorePropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalSemaphoreInfoKHR* pExternalSemaphoreInfo, + VkExternalSemaphorePropertiesKHR* pExternalSemaphoreProperties); +#endif + +#define VK_KHR_external_semaphore 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME "VK_KHR_external_semaphore" + + +typedef enum VkSemaphoreImportFlagBitsKHR { + VK_SEMAPHORE_IMPORT_TEMPORARY_BIT_KHR = 0x00000001, + VK_SEMAPHORE_IMPORT_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkSemaphoreImportFlagBitsKHR; +typedef VkFlags VkSemaphoreImportFlagsKHR; + +typedef struct VkExportSemaphoreCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalSemaphoreHandleTypeFlagsKHR handleTypes; +} VkExportSemaphoreCreateInfoKHR; + + + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_external_semaphore_win32 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME "VK_KHR_external_semaphore_win32" + +typedef struct VkImportSemaphoreWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkSemaphore semaphore; + VkSemaphoreImportFlagsKHR flags; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; + HANDLE handle; + LPCWSTR name; +} VkImportSemaphoreWin32HandleInfoKHR; + +typedef struct VkExportSemaphoreWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + const SECURITY_ATTRIBUTES* pAttributes; + DWORD dwAccess; + LPCWSTR name; +} VkExportSemaphoreWin32HandleInfoKHR; + +typedef struct VkD3D12FenceSubmitInfoKHR { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreValuesCount; + const uint64_t* pWaitSemaphoreValues; + uint32_t signalSemaphoreValuesCount; + const uint64_t* pSignalSemaphoreValues; +} VkD3D12FenceSubmitInfoKHR; + +typedef struct VkSemaphoreGetWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkSemaphore semaphore; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; +} VkSemaphoreGetWin32HandleInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreWin32HandleKHR)(VkDevice device, const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo); +typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreWin32HandleKHR)(VkDevice device, const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreWin32HandleKHR( + VkDevice device, + const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreWin32HandleKHR( + VkDevice device, + const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, + HANDLE* pHandle); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_external_semaphore_fd 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME "VK_KHR_external_semaphore_fd" + +typedef struct VkImportSemaphoreFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkSemaphore semaphore; + VkSemaphoreImportFlagsKHR flags; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; + int fd; +} VkImportSemaphoreFdInfoKHR; + +typedef struct VkSemaphoreGetFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkSemaphore semaphore; + VkExternalSemaphoreHandleTypeFlagBitsKHR handleType; +} VkSemaphoreGetFdInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreFdKHR)(VkDevice device, const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo); +typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreFdKHR)(VkDevice device, const VkSemaphoreGetFdInfoKHR* pGetFdInfo, int* pFd); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreFdKHR( + VkDevice device, + const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreFdKHR( + VkDevice device, + const VkSemaphoreGetFdInfoKHR* pGetFdInfo, + int* pFd); +#endif + +#define VK_KHR_push_descriptor 1 +#define VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSION 1 +#define VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME "VK_KHR_push_descriptor" + +typedef struct VkPhysicalDevicePushDescriptorPropertiesKHR { + VkStructureType sType; + void* pNext; + uint32_t maxPushDescriptors; +} VkPhysicalDevicePushDescriptorPropertiesKHR; + + +typedef void (VKAPI_PTR *PFN_vkCmdPushDescriptorSetKHR)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetKHR( + VkCommandBuffer commandBuffer, + VkPipelineBindPoint pipelineBindPoint, + VkPipelineLayout layout, + uint32_t set, + uint32_t descriptorWriteCount, + const VkWriteDescriptorSet* pDescriptorWrites); +#endif + +#define VK_KHR_16bit_storage 1 +#define VK_KHR_16BIT_STORAGE_SPEC_VERSION 1 +#define VK_KHR_16BIT_STORAGE_EXTENSION_NAME "VK_KHR_16bit_storage" + +typedef struct VkPhysicalDevice16BitStorageFeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 storageBuffer16BitAccess; + VkBool32 uniformAndStorageBuffer16BitAccess; + VkBool32 storagePushConstant16; + VkBool32 storageInputOutput16; +} VkPhysicalDevice16BitStorageFeaturesKHR; + + + +#define VK_KHR_incremental_present 1 +#define VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION 1 +#define VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME "VK_KHR_incremental_present" + +typedef struct VkRectLayerKHR { + VkOffset2D offset; + VkExtent2D extent; + uint32_t layer; +} VkRectLayerKHR; + +typedef struct VkPresentRegionKHR { + uint32_t rectangleCount; + const VkRectLayerKHR* pRectangles; +} VkPresentRegionKHR; + +typedef struct VkPresentRegionsKHR { + VkStructureType sType; + const void* pNext; + uint32_t swapchainCount; + const VkPresentRegionKHR* pRegions; +} VkPresentRegionsKHR; + + + +#define VK_KHR_descriptor_update_template 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorUpdateTemplateKHR) + +#define VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSION 1 +#define VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME "VK_KHR_descriptor_update_template" + + +typedef enum VkDescriptorUpdateTemplateTypeKHR { + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR = 0, + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR = 1, + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_BEGIN_RANGE_KHR = VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR, + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_END_RANGE_KHR = VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR, + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_RANGE_SIZE_KHR = (VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR - VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR + 1), + VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_MAX_ENUM_KHR = 0x7FFFFFFF +} VkDescriptorUpdateTemplateTypeKHR; + +typedef VkFlags VkDescriptorUpdateTemplateCreateFlagsKHR; + +typedef struct VkDescriptorUpdateTemplateEntryKHR { + uint32_t dstBinding; + uint32_t dstArrayElement; + uint32_t descriptorCount; + VkDescriptorType descriptorType; + size_t offset; + size_t stride; +} VkDescriptorUpdateTemplateEntryKHR; + +typedef struct VkDescriptorUpdateTemplateCreateInfoKHR { + VkStructureType sType; + void* pNext; + VkDescriptorUpdateTemplateCreateFlagsKHR flags; + uint32_t descriptorUpdateEntryCount; + const VkDescriptorUpdateTemplateEntryKHR* pDescriptorUpdateEntries; + VkDescriptorUpdateTemplateTypeKHR templateType; + VkDescriptorSetLayout descriptorSetLayout; + VkPipelineBindPoint pipelineBindPoint; + VkPipelineLayout pipelineLayout; + uint32_t set; +} VkDescriptorUpdateTemplateCreateInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorUpdateTemplateKHR)(VkDevice device, const VkDescriptorUpdateTemplateCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplateKHR* pDescriptorUpdateTemplate); +typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorUpdateTemplateKHR)(VkDevice device, VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkUpdateDescriptorSetWithTemplateKHR)(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, const void* pData); +typedef void (VKAPI_PTR *PFN_vkCmdPushDescriptorSetWithTemplateKHR)(VkCommandBuffer commandBuffer, VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, VkPipelineLayout layout, uint32_t set, const void* pData); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorUpdateTemplateKHR( + VkDevice device, + const VkDescriptorUpdateTemplateCreateInfoKHR* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDescriptorUpdateTemplateKHR* pDescriptorUpdateTemplate); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorUpdateTemplateKHR( + VkDevice device, + VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSetWithTemplateKHR( + VkDevice device, + VkDescriptorSet descriptorSet, + VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, + const void* pData); + +VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetWithTemplateKHR( + VkCommandBuffer commandBuffer, + VkDescriptorUpdateTemplateKHR descriptorUpdateTemplate, + VkPipelineLayout layout, + uint32_t set, + const void* pData); +#endif + +#define VK_KHR_shared_presentable_image 1 +#define VK_KHR_SHARED_PRESENTABLE_IMAGE_SPEC_VERSION 1 +#define VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME "VK_KHR_shared_presentable_image" + +typedef struct VkSharedPresentSurfaceCapabilitiesKHR { + VkStructureType sType; + void* pNext; + VkImageUsageFlags sharedPresentSupportedUsageFlags; +} VkSharedPresentSurfaceCapabilitiesKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainStatusKHR)(VkDevice device, VkSwapchainKHR swapchain); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainStatusKHR( + VkDevice device, + VkSwapchainKHR swapchain); +#endif + +#define VK_KHR_external_fence_capabilities 1 +#define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_fence_capabilities" + + +typedef enum VkExternalFenceHandleTypeFlagBitsKHR { + VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = 0x00000001, + VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = 0x00000002, + VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = 0x00000004, + VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT_KHR = 0x00000008, + VK_EXTERNAL_FENCE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalFenceHandleTypeFlagBitsKHR; +typedef VkFlags VkExternalFenceHandleTypeFlagsKHR; + +typedef enum VkExternalFenceFeatureFlagBitsKHR { + VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT_KHR = 0x00000001, + VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT_KHR = 0x00000002, + VK_EXTERNAL_FENCE_FEATURE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkExternalFenceFeatureFlagBitsKHR; +typedef VkFlags VkExternalFenceFeatureFlagsKHR; + +typedef struct VkPhysicalDeviceExternalFenceInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalFenceHandleTypeFlagBitsKHR handleType; +} VkPhysicalDeviceExternalFenceInfoKHR; + +typedef struct VkExternalFencePropertiesKHR { + VkStructureType sType; + void* pNext; + VkExternalFenceHandleTypeFlagsKHR exportFromImportedHandleTypes; + VkExternalFenceHandleTypeFlagsKHR compatibleHandleTypes; + VkExternalFenceFeatureFlagsKHR externalFenceFeatures; +} VkExternalFencePropertiesKHR; + + +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfoKHR* pExternalFenceInfo, VkExternalFencePropertiesKHR* pExternalFenceProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFencePropertiesKHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceExternalFenceInfoKHR* pExternalFenceInfo, + VkExternalFencePropertiesKHR* pExternalFenceProperties); +#endif + +#define VK_KHR_external_fence 1 +#define VK_KHR_EXTERNAL_FENCE_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME "VK_KHR_external_fence" + + +typedef enum VkFenceImportFlagBitsKHR { + VK_FENCE_IMPORT_TEMPORARY_BIT_KHR = 0x00000001, + VK_FENCE_IMPORT_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF +} VkFenceImportFlagBitsKHR; +typedef VkFlags VkFenceImportFlagsKHR; + +typedef struct VkExportFenceCreateInfoKHR { + VkStructureType sType; + const void* pNext; + VkExternalFenceHandleTypeFlagsKHR handleTypes; +} VkExportFenceCreateInfoKHR; + + + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_KHR_external_fence_win32 1 +#define VK_KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME "VK_KHR_external_fence_win32" + +typedef struct VkImportFenceWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkFence fence; + VkFenceImportFlagsKHR flags; + VkExternalFenceHandleTypeFlagBitsKHR handleType; + HANDLE handle; + LPCWSTR name; +} VkImportFenceWin32HandleInfoKHR; + +typedef struct VkExportFenceWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + const SECURITY_ATTRIBUTES* pAttributes; + DWORD dwAccess; + LPCWSTR name; +} VkExportFenceWin32HandleInfoKHR; + +typedef struct VkFenceGetWin32HandleInfoKHR { + VkStructureType sType; + const void* pNext; + VkFence fence; + VkExternalFenceHandleTypeFlagBitsKHR handleType; +} VkFenceGetWin32HandleInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkImportFenceWin32HandleKHR)(VkDevice device, const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo); +typedef VkResult (VKAPI_PTR *PFN_vkGetFenceWin32HandleKHR)(VkDevice device, const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceWin32HandleKHR( + VkDevice device, + const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceWin32HandleKHR( + VkDevice device, + const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, + HANDLE* pHandle); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHR_external_fence_fd 1 +#define VK_KHR_EXTERNAL_FENCE_FD_SPEC_VERSION 1 +#define VK_KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME "VK_KHR_external_fence_fd" + +typedef struct VkImportFenceFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkFence fence; + VkFenceImportFlagsKHR flags; + VkExternalFenceHandleTypeFlagBitsKHR handleType; + int fd; +} VkImportFenceFdInfoKHR; + +typedef struct VkFenceGetFdInfoKHR { + VkStructureType sType; + const void* pNext; + VkFence fence; + VkExternalFenceHandleTypeFlagBitsKHR handleType; +} VkFenceGetFdInfoKHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkImportFenceFdKHR)(VkDevice device, const VkImportFenceFdInfoKHR* pImportFenceFdInfo); +typedef VkResult (VKAPI_PTR *PFN_vkGetFenceFdKHR)(VkDevice device, const VkFenceGetFdInfoKHR* pGetFdInfo, int* pFd); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceFdKHR( + VkDevice device, + const VkImportFenceFdInfoKHR* pImportFenceFdInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceFdKHR( + VkDevice device, + const VkFenceGetFdInfoKHR* pGetFdInfo, + int* pFd); +#endif + +#define VK_KHR_get_surface_capabilities2 1 +#define VK_KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION 1 +#define VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME "VK_KHR_get_surface_capabilities2" + +typedef struct VkPhysicalDeviceSurfaceInfo2KHR { + VkStructureType sType; + const void* pNext; + VkSurfaceKHR surface; +} VkPhysicalDeviceSurfaceInfo2KHR; + +typedef struct VkSurfaceCapabilities2KHR { + VkStructureType sType; + void* pNext; + VkSurfaceCapabilitiesKHR surfaceCapabilities; +} VkSurfaceCapabilities2KHR; + +typedef struct VkSurfaceFormat2KHR { + VkStructureType sType; + void* pNext; + VkSurfaceFormatKHR surfaceFormat; +} VkSurfaceFormat2KHR; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, VkSurfaceCapabilities2KHR* pSurfaceCapabilities); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, uint32_t* pSurfaceFormatCount, VkSurfaceFormat2KHR* pSurfaceFormats); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2KHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, + VkSurfaceCapabilities2KHR* pSurfaceCapabilities); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormats2KHR( + VkPhysicalDevice physicalDevice, + const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, + uint32_t* pSurfaceFormatCount, + VkSurfaceFormat2KHR* pSurfaceFormats); +#endif + +#define VK_KHR_variable_pointers 1 +#define VK_KHR_VARIABLE_POINTERS_SPEC_VERSION 1 +#define VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME "VK_KHR_variable_pointers" + +typedef struct VkPhysicalDeviceVariablePointerFeaturesKHR { + VkStructureType sType; + void* pNext; + VkBool32 variablePointersStorageBuffer; + VkBool32 variablePointers; +} VkPhysicalDeviceVariablePointerFeaturesKHR; + + + +#define VK_KHR_dedicated_allocation 1 +#define VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION 3 +#define VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_KHR_dedicated_allocation" + +typedef struct VkMemoryDedicatedRequirementsKHR { + VkStructureType sType; + void* pNext; + VkBool32 prefersDedicatedAllocation; + VkBool32 requiresDedicatedAllocation; +} VkMemoryDedicatedRequirementsKHR; + +typedef struct VkMemoryDedicatedAllocateInfoKHR { + VkStructureType sType; + const void* pNext; + VkImage image; + VkBuffer buffer; +} VkMemoryDedicatedAllocateInfoKHR; + + + +#define VK_KHR_storage_buffer_storage_class 1 +#define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION 1 +#define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME "VK_KHR_storage_buffer_storage_class" + + +#define VK_KHR_relaxed_block_layout 1 +#define VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION 1 +#define VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME "VK_KHR_relaxed_block_layout" + + +#define VK_KHR_get_memory_requirements2 1 +#define VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION 1 +#define VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME "VK_KHR_get_memory_requirements2" + +typedef struct VkBufferMemoryRequirementsInfo2KHR { + VkStructureType sType; + const void* pNext; + VkBuffer buffer; +} VkBufferMemoryRequirementsInfo2KHR; + +typedef struct VkImageMemoryRequirementsInfo2KHR { + VkStructureType sType; + const void* pNext; + VkImage image; +} VkImageMemoryRequirementsInfo2KHR; + +typedef struct VkImageSparseMemoryRequirementsInfo2KHR { + VkStructureType sType; + const void* pNext; + VkImage image; +} VkImageSparseMemoryRequirementsInfo2KHR; + +typedef struct VkMemoryRequirements2KHR { + VkStructureType sType; + void* pNext; + VkMemoryRequirements memoryRequirements; +} VkMemoryRequirements2KHR; + +typedef struct VkSparseImageMemoryRequirements2KHR { + VkStructureType sType; + void* pNext; + VkSparseImageMemoryRequirements memoryRequirements; +} VkSparseImageMemoryRequirements2KHR; + + +typedef void (VKAPI_PTR *PFN_vkGetImageMemoryRequirements2KHR)(VkDevice device, const VkImageMemoryRequirementsInfo2KHR* pInfo, VkMemoryRequirements2KHR* pMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetBufferMemoryRequirements2KHR)(VkDevice device, const VkBufferMemoryRequirementsInfo2KHR* pInfo, VkMemoryRequirements2KHR* pMemoryRequirements); +typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements2KHR)(VkDevice device, const VkImageSparseMemoryRequirementsInfo2KHR* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2KHR* pSparseMemoryRequirements); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements2KHR( + VkDevice device, + const VkImageMemoryRequirementsInfo2KHR* pInfo, + VkMemoryRequirements2KHR* pMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements2KHR( + VkDevice device, + const VkBufferMemoryRequirementsInfo2KHR* pInfo, + VkMemoryRequirements2KHR* pMemoryRequirements); + +VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2KHR( + VkDevice device, + const VkImageSparseMemoryRequirementsInfo2KHR* pInfo, + uint32_t* pSparseMemoryRequirementCount, + VkSparseImageMemoryRequirements2KHR* pSparseMemoryRequirements); +#endif + +#define VK_EXT_debug_report 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT) + +#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 8 +#define VK_EXT_DEBUG_REPORT_EXTENSION_NAME "VK_EXT_debug_report" +#define VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT +#define VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT + + +typedef enum VkDebugReportObjectTypeEXT { + VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = 0, + VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT = 1, + VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT = 2, + VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT = 3, + VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT = 4, + VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT = 5, + VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT = 6, + VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT = 7, + VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT = 8, + VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT = 9, + VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT = 10, + VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT = 11, + VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT = 12, + VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT = 13, + VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT = 14, + VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT = 15, + VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT = 16, + VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT = 17, + VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT = 18, + VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT = 19, + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT = 20, + VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT = 21, + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT = 22, + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT = 23, + VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT = 24, + VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT = 25, + VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26, + VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27, + VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT = 28, + VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_KHR_EXT = 29, + VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_MODE_KHR_EXT = 30, + VK_DEBUG_REPORT_OBJECT_TYPE_OBJECT_TABLE_NVX_EXT = 31, + VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT = 32, + VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR_EXT = 1000085000, + VK_DEBUG_REPORT_OBJECT_TYPE_BEGIN_RANGE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_END_RANGE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT, + VK_DEBUG_REPORT_OBJECT_TYPE_RANGE_SIZE_EXT = (VK_DEBUG_REPORT_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NVX_EXT - VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT + 1), + VK_DEBUG_REPORT_OBJECT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDebugReportObjectTypeEXT; + + +typedef enum VkDebugReportFlagBitsEXT { + VK_DEBUG_REPORT_INFORMATION_BIT_EXT = 0x00000001, + VK_DEBUG_REPORT_WARNING_BIT_EXT = 0x00000002, + VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 0x00000004, + VK_DEBUG_REPORT_ERROR_BIT_EXT = 0x00000008, + VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010, + VK_DEBUG_REPORT_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDebugReportFlagBitsEXT; +typedef VkFlags VkDebugReportFlagsEXT; + +typedef VkBool32 (VKAPI_PTR *PFN_vkDebugReportCallbackEXT)( + VkDebugReportFlagsEXT flags, + VkDebugReportObjectTypeEXT objectType, + uint64_t object, + size_t location, + int32_t messageCode, + const char* pLayerPrefix, + const char* pMessage, + void* pUserData); + +typedef struct VkDebugReportCallbackCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkDebugReportFlagsEXT flags; + PFN_vkDebugReportCallbackEXT pfnCallback; + void* pUserData; +} VkDebugReportCallbackCreateInfoEXT; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateDebugReportCallbackEXT)(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback); +typedef void (VKAPI_PTR *PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator); +typedef void (VKAPI_PTR *PFN_vkDebugReportMessageEXT)(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT( + VkInstance instance, + const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkDebugReportCallbackEXT* pCallback); + +VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT( + VkInstance instance, + VkDebugReportCallbackEXT callback, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT( + VkInstance instance, + VkDebugReportFlagsEXT flags, + VkDebugReportObjectTypeEXT objectType, + uint64_t object, + size_t location, + int32_t messageCode, + const char* pLayerPrefix, + const char* pMessage); +#endif + +#define VK_NV_glsl_shader 1 +#define VK_NV_GLSL_SHADER_SPEC_VERSION 1 +#define VK_NV_GLSL_SHADER_EXTENSION_NAME "VK_NV_glsl_shader" + + +#define VK_EXT_depth_range_unrestricted 1 +#define VK_EXT_DEPTH_RANGE_UNRESTRICTED_SPEC_VERSION 1 +#define VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME "VK_EXT_depth_range_unrestricted" + + +#define VK_IMG_filter_cubic 1 +#define VK_IMG_FILTER_CUBIC_SPEC_VERSION 1 +#define VK_IMG_FILTER_CUBIC_EXTENSION_NAME "VK_IMG_filter_cubic" + + +#define VK_AMD_rasterization_order 1 +#define VK_AMD_RASTERIZATION_ORDER_SPEC_VERSION 1 +#define VK_AMD_RASTERIZATION_ORDER_EXTENSION_NAME "VK_AMD_rasterization_order" + + +typedef enum VkRasterizationOrderAMD { + VK_RASTERIZATION_ORDER_STRICT_AMD = 0, + VK_RASTERIZATION_ORDER_RELAXED_AMD = 1, + VK_RASTERIZATION_ORDER_BEGIN_RANGE_AMD = VK_RASTERIZATION_ORDER_STRICT_AMD, + VK_RASTERIZATION_ORDER_END_RANGE_AMD = VK_RASTERIZATION_ORDER_RELAXED_AMD, + VK_RASTERIZATION_ORDER_RANGE_SIZE_AMD = (VK_RASTERIZATION_ORDER_RELAXED_AMD - VK_RASTERIZATION_ORDER_STRICT_AMD + 1), + VK_RASTERIZATION_ORDER_MAX_ENUM_AMD = 0x7FFFFFFF +} VkRasterizationOrderAMD; + +typedef struct VkPipelineRasterizationStateRasterizationOrderAMD { + VkStructureType sType; + const void* pNext; + VkRasterizationOrderAMD rasterizationOrder; +} VkPipelineRasterizationStateRasterizationOrderAMD; + + + +#define VK_AMD_shader_trinary_minmax 1 +#define VK_AMD_SHADER_TRINARY_MINMAX_SPEC_VERSION 1 +#define VK_AMD_SHADER_TRINARY_MINMAX_EXTENSION_NAME "VK_AMD_shader_trinary_minmax" + + +#define VK_AMD_shader_explicit_vertex_parameter 1 +#define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_SPEC_VERSION 1 +#define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_EXTENSION_NAME "VK_AMD_shader_explicit_vertex_parameter" + + +#define VK_EXT_debug_marker 1 +#define VK_EXT_DEBUG_MARKER_SPEC_VERSION 4 +#define VK_EXT_DEBUG_MARKER_EXTENSION_NAME "VK_EXT_debug_marker" + +typedef struct VkDebugMarkerObjectNameInfoEXT { + VkStructureType sType; + const void* pNext; + VkDebugReportObjectTypeEXT objectType; + uint64_t object; + const char* pObjectName; +} VkDebugMarkerObjectNameInfoEXT; + +typedef struct VkDebugMarkerObjectTagInfoEXT { + VkStructureType sType; + const void* pNext; + VkDebugReportObjectTypeEXT objectType; + uint64_t object; + uint64_t tagName; + size_t tagSize; + const void* pTag; +} VkDebugMarkerObjectTagInfoEXT; + +typedef struct VkDebugMarkerMarkerInfoEXT { + VkStructureType sType; + const void* pNext; + const char* pMarkerName; + float color[4]; +} VkDebugMarkerMarkerInfoEXT; + + +typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectTagEXT)(VkDevice device, const VkDebugMarkerObjectTagInfoEXT* pTagInfo); +typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectNameEXT)(VkDevice device, const VkDebugMarkerObjectNameInfoEXT* pNameInfo); +typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerBeginEXT)(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); +typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerEndEXT)(VkCommandBuffer commandBuffer); +typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerInsertEXT)(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectTagEXT( + VkDevice device, + const VkDebugMarkerObjectTagInfoEXT* pTagInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectNameEXT( + VkDevice device, + const VkDebugMarkerObjectNameInfoEXT* pNameInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerBeginEXT( + VkCommandBuffer commandBuffer, + const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerEndEXT( + VkCommandBuffer commandBuffer); + +VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerInsertEXT( + VkCommandBuffer commandBuffer, + const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); +#endif + +#define VK_AMD_gcn_shader 1 +#define VK_AMD_GCN_SHADER_SPEC_VERSION 1 +#define VK_AMD_GCN_SHADER_EXTENSION_NAME "VK_AMD_gcn_shader" + + +#define VK_NV_dedicated_allocation 1 +#define VK_NV_DEDICATED_ALLOCATION_SPEC_VERSION 1 +#define VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_NV_dedicated_allocation" + +typedef struct VkDedicatedAllocationImageCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkBool32 dedicatedAllocation; +} VkDedicatedAllocationImageCreateInfoNV; + +typedef struct VkDedicatedAllocationBufferCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkBool32 dedicatedAllocation; +} VkDedicatedAllocationBufferCreateInfoNV; + +typedef struct VkDedicatedAllocationMemoryAllocateInfoNV { + VkStructureType sType; + const void* pNext; + VkImage image; + VkBuffer buffer; +} VkDedicatedAllocationMemoryAllocateInfoNV; + + + +#define VK_AMD_draw_indirect_count 1 +#define VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION 1 +#define VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_AMD_draw_indirect_count" + +typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirectCountAMD)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); +typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirectCountAMD)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectCountAMD( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + VkBuffer countBuffer, + VkDeviceSize countBufferOffset, + uint32_t maxDrawCount, + uint32_t stride); + +VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountAMD( + VkCommandBuffer commandBuffer, + VkBuffer buffer, + VkDeviceSize offset, + VkBuffer countBuffer, + VkDeviceSize countBufferOffset, + uint32_t maxDrawCount, + uint32_t stride); +#endif + +#define VK_AMD_negative_viewport_height 1 +#define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_SPEC_VERSION 1 +#define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME "VK_AMD_negative_viewport_height" + + +#define VK_AMD_gpu_shader_half_float 1 +#define VK_AMD_GPU_SHADER_HALF_FLOAT_SPEC_VERSION 1 +#define VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME "VK_AMD_gpu_shader_half_float" + + +#define VK_AMD_shader_ballot 1 +#define VK_AMD_SHADER_BALLOT_SPEC_VERSION 1 +#define VK_AMD_SHADER_BALLOT_EXTENSION_NAME "VK_AMD_shader_ballot" + + +#define VK_AMD_texture_gather_bias_lod 1 +#define VK_AMD_TEXTURE_GATHER_BIAS_LOD_SPEC_VERSION 1 +#define VK_AMD_TEXTURE_GATHER_BIAS_LOD_EXTENSION_NAME "VK_AMD_texture_gather_bias_lod" + +typedef struct VkTextureLODGatherFormatPropertiesAMD { + VkStructureType sType; + void* pNext; + VkBool32 supportsTextureGatherLODBiasAMD; +} VkTextureLODGatherFormatPropertiesAMD; + + + +#define VK_KHX_multiview 1 +#define VK_KHX_MULTIVIEW_SPEC_VERSION 1 +#define VK_KHX_MULTIVIEW_EXTENSION_NAME "VK_KHX_multiview" + +typedef struct VkRenderPassMultiviewCreateInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t subpassCount; + const uint32_t* pViewMasks; + uint32_t dependencyCount; + const int32_t* pViewOffsets; + uint32_t correlationMaskCount; + const uint32_t* pCorrelationMasks; +} VkRenderPassMultiviewCreateInfoKHX; + +typedef struct VkPhysicalDeviceMultiviewFeaturesKHX { + VkStructureType sType; + void* pNext; + VkBool32 multiview; + VkBool32 multiviewGeometryShader; + VkBool32 multiviewTessellationShader; +} VkPhysicalDeviceMultiviewFeaturesKHX; + +typedef struct VkPhysicalDeviceMultiviewPropertiesKHX { + VkStructureType sType; + void* pNext; + uint32_t maxMultiviewViewCount; + uint32_t maxMultiviewInstanceIndex; +} VkPhysicalDeviceMultiviewPropertiesKHX; + + + +#define VK_IMG_format_pvrtc 1 +#define VK_IMG_FORMAT_PVRTC_SPEC_VERSION 1 +#define VK_IMG_FORMAT_PVRTC_EXTENSION_NAME "VK_IMG_format_pvrtc" + + +#define VK_NV_external_memory_capabilities 1 +#define VK_NV_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1 +#define VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_NV_external_memory_capabilities" + + +typedef enum VkExternalMemoryHandleTypeFlagBitsNV { + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV = 0x00000001, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV = 0x00000002, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_BIT_NV = 0x00000004, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_KMT_BIT_NV = 0x00000008, + VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF +} VkExternalMemoryHandleTypeFlagBitsNV; +typedef VkFlags VkExternalMemoryHandleTypeFlagsNV; + +typedef enum VkExternalMemoryFeatureFlagBitsNV { + VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_NV = 0x00000001, + VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_NV = 0x00000002, + VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_NV = 0x00000004, + VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF +} VkExternalMemoryFeatureFlagBitsNV; +typedef VkFlags VkExternalMemoryFeatureFlagsNV; + +typedef struct VkExternalImageFormatPropertiesNV { + VkImageFormatProperties imageFormatProperties; + VkExternalMemoryFeatureFlagsNV externalMemoryFeatures; + VkExternalMemoryHandleTypeFlagsNV exportFromImportedHandleTypes; + VkExternalMemoryHandleTypeFlagsNV compatibleHandleTypes; +} VkExternalImageFormatPropertiesNV; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkExternalMemoryHandleTypeFlagsNV externalHandleType, VkExternalImageFormatPropertiesNV* pExternalImageFormatProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceExternalImageFormatPropertiesNV( + VkPhysicalDevice physicalDevice, + VkFormat format, + VkImageType type, + VkImageTiling tiling, + VkImageUsageFlags usage, + VkImageCreateFlags flags, + VkExternalMemoryHandleTypeFlagsNV externalHandleType, + VkExternalImageFormatPropertiesNV* pExternalImageFormatProperties); +#endif + +#define VK_NV_external_memory 1 +#define VK_NV_EXTERNAL_MEMORY_SPEC_VERSION 1 +#define VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME "VK_NV_external_memory" + +typedef struct VkExternalMemoryImageCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsNV handleTypes; +} VkExternalMemoryImageCreateInfoNV; + +typedef struct VkExportMemoryAllocateInfoNV { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsNV handleTypes; +} VkExportMemoryAllocateInfoNV; + + + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_NV_external_memory_win32 1 +#define VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1 +#define VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_NV_external_memory_win32" + +typedef struct VkImportMemoryWin32HandleInfoNV { + VkStructureType sType; + const void* pNext; + VkExternalMemoryHandleTypeFlagsNV handleType; + HANDLE handle; +} VkImportMemoryWin32HandleInfoNV; + +typedef struct VkExportMemoryWin32HandleInfoNV { + VkStructureType sType; + const void* pNext; + const SECURITY_ATTRIBUTES* pAttributes; + DWORD dwAccess; +} VkExportMemoryWin32HandleInfoNV; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleNV)(VkDevice device, VkDeviceMemory memory, VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE* pHandle); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV( + VkDevice device, + VkDeviceMemory memory, + VkExternalMemoryHandleTypeFlagsNV handleType, + HANDLE* pHandle); +#endif +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#ifdef VK_USE_PLATFORM_WIN32_KHR +#define VK_NV_win32_keyed_mutex 1 +#define VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION 1 +#define VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_NV_win32_keyed_mutex" + +typedef struct VkWin32KeyedMutexAcquireReleaseInfoNV { + VkStructureType sType; + const void* pNext; + uint32_t acquireCount; + const VkDeviceMemory* pAcquireSyncs; + const uint64_t* pAcquireKeys; + const uint32_t* pAcquireTimeoutMilliseconds; + uint32_t releaseCount; + const VkDeviceMemory* pReleaseSyncs; + const uint64_t* pReleaseKeys; +} VkWin32KeyedMutexAcquireReleaseInfoNV; + + +#endif /* VK_USE_PLATFORM_WIN32_KHR */ + +#define VK_KHX_device_group 1 +#define VK_MAX_DEVICE_GROUP_SIZE_KHX 32 +#define VK_KHX_DEVICE_GROUP_SPEC_VERSION 1 +#define VK_KHX_DEVICE_GROUP_EXTENSION_NAME "VK_KHX_device_group" + + +typedef enum VkPeerMemoryFeatureFlagBitsKHX { + VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT_KHX = 0x00000001, + VK_PEER_MEMORY_FEATURE_COPY_DST_BIT_KHX = 0x00000002, + VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT_KHX = 0x00000004, + VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT_KHX = 0x00000008, + VK_PEER_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_KHX = 0x7FFFFFFF +} VkPeerMemoryFeatureFlagBitsKHX; +typedef VkFlags VkPeerMemoryFeatureFlagsKHX; + +typedef enum VkMemoryAllocateFlagBitsKHX { + VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT_KHX = 0x00000001, + VK_MEMORY_ALLOCATE_FLAG_BITS_MAX_ENUM_KHX = 0x7FFFFFFF +} VkMemoryAllocateFlagBitsKHX; +typedef VkFlags VkMemoryAllocateFlagsKHX; + +typedef enum VkDeviceGroupPresentModeFlagBitsKHX { + VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHX = 0x00000001, + VK_DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHX = 0x00000002, + VK_DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHX = 0x00000004, + VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHX = 0x00000008, + VK_DEVICE_GROUP_PRESENT_MODE_FLAG_BITS_MAX_ENUM_KHX = 0x7FFFFFFF +} VkDeviceGroupPresentModeFlagBitsKHX; +typedef VkFlags VkDeviceGroupPresentModeFlagsKHX; + +typedef struct VkMemoryAllocateFlagsInfoKHX { + VkStructureType sType; + const void* pNext; + VkMemoryAllocateFlagsKHX flags; + uint32_t deviceMask; +} VkMemoryAllocateFlagsInfoKHX; + +typedef struct VkBindBufferMemoryInfoKHX { + VkStructureType sType; + const void* pNext; + VkBuffer buffer; + VkDeviceMemory memory; + VkDeviceSize memoryOffset; + uint32_t deviceIndexCount; + const uint32_t* pDeviceIndices; +} VkBindBufferMemoryInfoKHX; + +typedef struct VkBindImageMemoryInfoKHX { + VkStructureType sType; + const void* pNext; + VkImage image; + VkDeviceMemory memory; + VkDeviceSize memoryOffset; + uint32_t deviceIndexCount; + const uint32_t* pDeviceIndices; + uint32_t SFRRectCount; + const VkRect2D* pSFRRects; +} VkBindImageMemoryInfoKHX; + +typedef struct VkDeviceGroupRenderPassBeginInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t deviceMask; + uint32_t deviceRenderAreaCount; + const VkRect2D* pDeviceRenderAreas; +} VkDeviceGroupRenderPassBeginInfoKHX; + +typedef struct VkDeviceGroupCommandBufferBeginInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t deviceMask; +} VkDeviceGroupCommandBufferBeginInfoKHX; + +typedef struct VkDeviceGroupSubmitInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t waitSemaphoreCount; + const uint32_t* pWaitSemaphoreDeviceIndices; + uint32_t commandBufferCount; + const uint32_t* pCommandBufferDeviceMasks; + uint32_t signalSemaphoreCount; + const uint32_t* pSignalSemaphoreDeviceIndices; +} VkDeviceGroupSubmitInfoKHX; + +typedef struct VkDeviceGroupBindSparseInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t resourceDeviceIndex; + uint32_t memoryDeviceIndex; +} VkDeviceGroupBindSparseInfoKHX; + +typedef struct VkDeviceGroupPresentCapabilitiesKHX { + VkStructureType sType; + const void* pNext; + uint32_t presentMask[VK_MAX_DEVICE_GROUP_SIZE_KHX]; + VkDeviceGroupPresentModeFlagsKHX modes; +} VkDeviceGroupPresentCapabilitiesKHX; + +typedef struct VkImageSwapchainCreateInfoKHX { + VkStructureType sType; + const void* pNext; + VkSwapchainKHR swapchain; +} VkImageSwapchainCreateInfoKHX; + +typedef struct VkBindImageMemorySwapchainInfoKHX { + VkStructureType sType; + const void* pNext; + VkSwapchainKHR swapchain; + uint32_t imageIndex; +} VkBindImageMemorySwapchainInfoKHX; + +typedef struct VkAcquireNextImageInfoKHX { + VkStructureType sType; + const void* pNext; + VkSwapchainKHR swapchain; + uint64_t timeout; + VkSemaphore semaphore; + VkFence fence; + uint32_t deviceMask; +} VkAcquireNextImageInfoKHX; + +typedef struct VkDeviceGroupPresentInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t swapchainCount; + const uint32_t* pDeviceMasks; + VkDeviceGroupPresentModeFlagBitsKHX mode; +} VkDeviceGroupPresentInfoKHX; + +typedef struct VkDeviceGroupSwapchainCreateInfoKHX { + VkStructureType sType; + const void* pNext; + VkDeviceGroupPresentModeFlagsKHX modes; +} VkDeviceGroupSwapchainCreateInfoKHX; + + +typedef void (VKAPI_PTR *PFN_vkGetDeviceGroupPeerMemoryFeaturesKHX)(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlagsKHX* pPeerMemoryFeatures); +typedef VkResult (VKAPI_PTR *PFN_vkBindBufferMemory2KHX)(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfoKHX* pBindInfos); +typedef VkResult (VKAPI_PTR *PFN_vkBindImageMemory2KHX)(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfoKHX* pBindInfos); +typedef void (VKAPI_PTR *PFN_vkCmdSetDeviceMaskKHX)(VkCommandBuffer commandBuffer, uint32_t deviceMask); +typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupPresentCapabilitiesKHX)(VkDevice device, VkDeviceGroupPresentCapabilitiesKHX* pDeviceGroupPresentCapabilities); +typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupSurfacePresentModesKHX)(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHX* pModes); +typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImage2KHX)(VkDevice device, const VkAcquireNextImageInfoKHX* pAcquireInfo, uint32_t* pImageIndex); +typedef void (VKAPI_PTR *PFN_vkCmdDispatchBaseKHX)(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDevicePresentRectanglesKHX)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pRectCount, VkRect2D* pRects); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeaturesKHX( + VkDevice device, + uint32_t heapIndex, + uint32_t localDeviceIndex, + uint32_t remoteDeviceIndex, + VkPeerMemoryFeatureFlagsKHX* pPeerMemoryFeatures); + +VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory2KHX( + VkDevice device, + uint32_t bindInfoCount, + const VkBindBufferMemoryInfoKHX* pBindInfos); + +VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory2KHX( + VkDevice device, + uint32_t bindInfoCount, + const VkBindImageMemoryInfoKHX* pBindInfos); + +VKAPI_ATTR void VKAPI_CALL vkCmdSetDeviceMaskKHX( + VkCommandBuffer commandBuffer, + uint32_t deviceMask); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupPresentCapabilitiesKHX( + VkDevice device, + VkDeviceGroupPresentCapabilitiesKHX* pDeviceGroupPresentCapabilities); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModesKHX( + VkDevice device, + VkSurfaceKHR surface, + VkDeviceGroupPresentModeFlagsKHX* pModes); + +VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImage2KHX( + VkDevice device, + const VkAcquireNextImageInfoKHX* pAcquireInfo, + uint32_t* pImageIndex); + +VKAPI_ATTR void VKAPI_CALL vkCmdDispatchBaseKHX( + VkCommandBuffer commandBuffer, + uint32_t baseGroupX, + uint32_t baseGroupY, + uint32_t baseGroupZ, + uint32_t groupCountX, + uint32_t groupCountY, + uint32_t groupCountZ); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDevicePresentRectanglesKHX( + VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + uint32_t* pRectCount, + VkRect2D* pRects); +#endif + +#define VK_EXT_validation_flags 1 +#define VK_EXT_VALIDATION_FLAGS_SPEC_VERSION 1 +#define VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME "VK_EXT_validation_flags" + + +typedef enum VkValidationCheckEXT { + VK_VALIDATION_CHECK_ALL_EXT = 0, + VK_VALIDATION_CHECK_SHADERS_EXT = 1, + VK_VALIDATION_CHECK_BEGIN_RANGE_EXT = VK_VALIDATION_CHECK_ALL_EXT, + VK_VALIDATION_CHECK_END_RANGE_EXT = VK_VALIDATION_CHECK_SHADERS_EXT, + VK_VALIDATION_CHECK_RANGE_SIZE_EXT = (VK_VALIDATION_CHECK_SHADERS_EXT - VK_VALIDATION_CHECK_ALL_EXT + 1), + VK_VALIDATION_CHECK_MAX_ENUM_EXT = 0x7FFFFFFF +} VkValidationCheckEXT; + +typedef struct VkValidationFlagsEXT { + VkStructureType sType; + const void* pNext; + uint32_t disabledValidationCheckCount; + VkValidationCheckEXT* pDisabledValidationChecks; +} VkValidationFlagsEXT; + + + +#ifdef VK_USE_PLATFORM_VI_NN +#define VK_NN_vi_surface 1 +#define VK_NN_VI_SURFACE_SPEC_VERSION 1 +#define VK_NN_VI_SURFACE_EXTENSION_NAME "VK_NN_vi_surface" + +typedef VkFlags VkViSurfaceCreateFlagsNN; + +typedef struct VkViSurfaceCreateInfoNN { + VkStructureType sType; + const void* pNext; + VkViSurfaceCreateFlagsNN flags; + void* window; +} VkViSurfaceCreateInfoNN; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateViSurfaceNN)(VkInstance instance, const VkViSurfaceCreateInfoNN* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateViSurfaceNN( + VkInstance instance, + const VkViSurfaceCreateInfoNN* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif +#endif /* VK_USE_PLATFORM_VI_NN */ + +#define VK_EXT_shader_subgroup_ballot 1 +#define VK_EXT_SHADER_SUBGROUP_BALLOT_SPEC_VERSION 1 +#define VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME "VK_EXT_shader_subgroup_ballot" + + +#define VK_EXT_shader_subgroup_vote 1 +#define VK_EXT_SHADER_SUBGROUP_VOTE_SPEC_VERSION 1 +#define VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME "VK_EXT_shader_subgroup_vote" + + +#define VK_KHX_device_group_creation 1 +#define VK_KHX_DEVICE_GROUP_CREATION_SPEC_VERSION 1 +#define VK_KHX_DEVICE_GROUP_CREATION_EXTENSION_NAME "VK_KHX_device_group_creation" + +typedef struct VkPhysicalDeviceGroupPropertiesKHX { + VkStructureType sType; + void* pNext; + uint32_t physicalDeviceCount; + VkPhysicalDevice physicalDevices[VK_MAX_DEVICE_GROUP_SIZE_KHX]; + VkBool32 subsetAllocation; +} VkPhysicalDeviceGroupPropertiesKHX; + +typedef struct VkDeviceGroupDeviceCreateInfoKHX { + VkStructureType sType; + const void* pNext; + uint32_t physicalDeviceCount; + const VkPhysicalDevice* pPhysicalDevices; +} VkDeviceGroupDeviceCreateInfoKHX; + + +typedef VkResult (VKAPI_PTR *PFN_vkEnumeratePhysicalDeviceGroupsKHX)(VkInstance instance, uint32_t* pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupPropertiesKHX* pPhysicalDeviceGroupProperties); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroupsKHX( + VkInstance instance, + uint32_t* pPhysicalDeviceGroupCount, + VkPhysicalDeviceGroupPropertiesKHX* pPhysicalDeviceGroupProperties); +#endif + +#define VK_NVX_device_generated_commands 1 +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkObjectTableNVX) +VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkIndirectCommandsLayoutNVX) + +#define VK_NVX_DEVICE_GENERATED_COMMANDS_SPEC_VERSION 3 +#define VK_NVX_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME "VK_NVX_device_generated_commands" + + +typedef enum VkIndirectCommandsTokenTypeNVX { + VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX = 0, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_DESCRIPTOR_SET_NVX = 1, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NVX = 2, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NVX = 3, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NVX = 4, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NVX = 5, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NVX = 6, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX = 7, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_BEGIN_RANGE_NVX = VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_END_RANGE_NVX = VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX, + VK_INDIRECT_COMMANDS_TOKEN_TYPE_RANGE_SIZE_NVX = (VK_INDIRECT_COMMANDS_TOKEN_TYPE_DISPATCH_NVX - VK_INDIRECT_COMMANDS_TOKEN_TYPE_PIPELINE_NVX + 1), + VK_INDIRECT_COMMANDS_TOKEN_TYPE_MAX_ENUM_NVX = 0x7FFFFFFF +} VkIndirectCommandsTokenTypeNVX; + +typedef enum VkObjectEntryTypeNVX { + VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX = 0, + VK_OBJECT_ENTRY_TYPE_PIPELINE_NVX = 1, + VK_OBJECT_ENTRY_TYPE_INDEX_BUFFER_NVX = 2, + VK_OBJECT_ENTRY_TYPE_VERTEX_BUFFER_NVX = 3, + VK_OBJECT_ENTRY_TYPE_PUSH_CONSTANT_NVX = 4, + VK_OBJECT_ENTRY_TYPE_BEGIN_RANGE_NVX = VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX, + VK_OBJECT_ENTRY_TYPE_END_RANGE_NVX = VK_OBJECT_ENTRY_TYPE_PUSH_CONSTANT_NVX, + VK_OBJECT_ENTRY_TYPE_RANGE_SIZE_NVX = (VK_OBJECT_ENTRY_TYPE_PUSH_CONSTANT_NVX - VK_OBJECT_ENTRY_TYPE_DESCRIPTOR_SET_NVX + 1), + VK_OBJECT_ENTRY_TYPE_MAX_ENUM_NVX = 0x7FFFFFFF +} VkObjectEntryTypeNVX; + + +typedef enum VkIndirectCommandsLayoutUsageFlagBitsNVX { + VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NVX = 0x00000001, + VK_INDIRECT_COMMANDS_LAYOUT_USAGE_SPARSE_SEQUENCES_BIT_NVX = 0x00000002, + VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EMPTY_EXECUTIONS_BIT_NVX = 0x00000004, + VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NVX = 0x00000008, + VK_INDIRECT_COMMANDS_LAYOUT_USAGE_FLAG_BITS_MAX_ENUM_NVX = 0x7FFFFFFF +} VkIndirectCommandsLayoutUsageFlagBitsNVX; +typedef VkFlags VkIndirectCommandsLayoutUsageFlagsNVX; + +typedef enum VkObjectEntryUsageFlagBitsNVX { + VK_OBJECT_ENTRY_USAGE_GRAPHICS_BIT_NVX = 0x00000001, + VK_OBJECT_ENTRY_USAGE_COMPUTE_BIT_NVX = 0x00000002, + VK_OBJECT_ENTRY_USAGE_FLAG_BITS_MAX_ENUM_NVX = 0x7FFFFFFF +} VkObjectEntryUsageFlagBitsNVX; +typedef VkFlags VkObjectEntryUsageFlagsNVX; + +typedef struct VkDeviceGeneratedCommandsFeaturesNVX { + VkStructureType sType; + const void* pNext; + VkBool32 computeBindingPointSupport; +} VkDeviceGeneratedCommandsFeaturesNVX; + +typedef struct VkDeviceGeneratedCommandsLimitsNVX { + VkStructureType sType; + const void* pNext; + uint32_t maxIndirectCommandsLayoutTokenCount; + uint32_t maxObjectEntryCounts; + uint32_t minSequenceCountBufferOffsetAlignment; + uint32_t minSequenceIndexBufferOffsetAlignment; + uint32_t minCommandsTokenBufferOffsetAlignment; +} VkDeviceGeneratedCommandsLimitsNVX; + +typedef struct VkIndirectCommandsTokenNVX { + VkIndirectCommandsTokenTypeNVX tokenType; + VkBuffer buffer; + VkDeviceSize offset; +} VkIndirectCommandsTokenNVX; + +typedef struct VkIndirectCommandsLayoutTokenNVX { + VkIndirectCommandsTokenTypeNVX tokenType; + uint32_t bindingUnit; + uint32_t dynamicCount; + uint32_t divisor; +} VkIndirectCommandsLayoutTokenNVX; + +typedef struct VkIndirectCommandsLayoutCreateInfoNVX { + VkStructureType sType; + const void* pNext; + VkPipelineBindPoint pipelineBindPoint; + VkIndirectCommandsLayoutUsageFlagsNVX flags; + uint32_t tokenCount; + const VkIndirectCommandsLayoutTokenNVX* pTokens; +} VkIndirectCommandsLayoutCreateInfoNVX; + +typedef struct VkCmdProcessCommandsInfoNVX { + VkStructureType sType; + const void* pNext; + VkObjectTableNVX objectTable; + VkIndirectCommandsLayoutNVX indirectCommandsLayout; + uint32_t indirectCommandsTokenCount; + const VkIndirectCommandsTokenNVX* pIndirectCommandsTokens; + uint32_t maxSequencesCount; + VkCommandBuffer targetCommandBuffer; + VkBuffer sequencesCountBuffer; + VkDeviceSize sequencesCountOffset; + VkBuffer sequencesIndexBuffer; + VkDeviceSize sequencesIndexOffset; +} VkCmdProcessCommandsInfoNVX; + +typedef struct VkCmdReserveSpaceForCommandsInfoNVX { + VkStructureType sType; + const void* pNext; + VkObjectTableNVX objectTable; + VkIndirectCommandsLayoutNVX indirectCommandsLayout; + uint32_t maxSequencesCount; +} VkCmdReserveSpaceForCommandsInfoNVX; + +typedef struct VkObjectTableCreateInfoNVX { + VkStructureType sType; + const void* pNext; + uint32_t objectCount; + const VkObjectEntryTypeNVX* pObjectEntryTypes; + const uint32_t* pObjectEntryCounts; + const VkObjectEntryUsageFlagsNVX* pObjectEntryUsageFlags; + uint32_t maxUniformBuffersPerDescriptor; + uint32_t maxStorageBuffersPerDescriptor; + uint32_t maxStorageImagesPerDescriptor; + uint32_t maxSampledImagesPerDescriptor; + uint32_t maxPipelineLayouts; +} VkObjectTableCreateInfoNVX; + +typedef struct VkObjectTableEntryNVX { + VkObjectEntryTypeNVX type; + VkObjectEntryUsageFlagsNVX flags; +} VkObjectTableEntryNVX; + +typedef struct VkObjectTablePipelineEntryNVX { + VkObjectEntryTypeNVX type; + VkObjectEntryUsageFlagsNVX flags; + VkPipeline pipeline; +} VkObjectTablePipelineEntryNVX; + +typedef struct VkObjectTableDescriptorSetEntryNVX { + VkObjectEntryTypeNVX type; + VkObjectEntryUsageFlagsNVX flags; + VkPipelineLayout pipelineLayout; + VkDescriptorSet descriptorSet; +} VkObjectTableDescriptorSetEntryNVX; + +typedef struct VkObjectTableVertexBufferEntryNVX { + VkObjectEntryTypeNVX type; + VkObjectEntryUsageFlagsNVX flags; + VkBuffer buffer; +} VkObjectTableVertexBufferEntryNVX; + +typedef struct VkObjectTableIndexBufferEntryNVX { + VkObjectEntryTypeNVX type; + VkObjectEntryUsageFlagsNVX flags; + VkBuffer buffer; + VkIndexType indexType; +} VkObjectTableIndexBufferEntryNVX; + +typedef struct VkObjectTablePushConstantEntryNVX { + VkObjectEntryTypeNVX type; + VkObjectEntryUsageFlagsNVX flags; + VkPipelineLayout pipelineLayout; + VkShaderStageFlags stageFlags; +} VkObjectTablePushConstantEntryNVX; + + +typedef void (VKAPI_PTR *PFN_vkCmdProcessCommandsNVX)(VkCommandBuffer commandBuffer, const VkCmdProcessCommandsInfoNVX* pProcessCommandsInfo); +typedef void (VKAPI_PTR *PFN_vkCmdReserveSpaceForCommandsNVX)(VkCommandBuffer commandBuffer, const VkCmdReserveSpaceForCommandsInfoNVX* pReserveSpaceInfo); +typedef VkResult (VKAPI_PTR *PFN_vkCreateIndirectCommandsLayoutNVX)(VkDevice device, const VkIndirectCommandsLayoutCreateInfoNVX* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkIndirectCommandsLayoutNVX* pIndirectCommandsLayout); +typedef void (VKAPI_PTR *PFN_vkDestroyIndirectCommandsLayoutNVX)(VkDevice device, VkIndirectCommandsLayoutNVX indirectCommandsLayout, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkCreateObjectTableNVX)(VkDevice device, const VkObjectTableCreateInfoNVX* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkObjectTableNVX* pObjectTable); +typedef void (VKAPI_PTR *PFN_vkDestroyObjectTableNVX)(VkDevice device, VkObjectTableNVX objectTable, const VkAllocationCallbacks* pAllocator); +typedef VkResult (VKAPI_PTR *PFN_vkRegisterObjectsNVX)(VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, const VkObjectTableEntryNVX* const* ppObjectTableEntries, const uint32_t* pObjectIndices); +typedef VkResult (VKAPI_PTR *PFN_vkUnregisterObjectsNVX)(VkDevice device, VkObjectTableNVX objectTable, uint32_t objectCount, const VkObjectEntryTypeNVX* pObjectEntryTypes, const uint32_t* pObjectIndices); +typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX)(VkPhysicalDevice physicalDevice, VkDeviceGeneratedCommandsFeaturesNVX* pFeatures, VkDeviceGeneratedCommandsLimitsNVX* pLimits); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdProcessCommandsNVX( + VkCommandBuffer commandBuffer, + const VkCmdProcessCommandsInfoNVX* pProcessCommandsInfo); + +VKAPI_ATTR void VKAPI_CALL vkCmdReserveSpaceForCommandsNVX( + VkCommandBuffer commandBuffer, + const VkCmdReserveSpaceForCommandsInfoNVX* pReserveSpaceInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateIndirectCommandsLayoutNVX( + VkDevice device, + const VkIndirectCommandsLayoutCreateInfoNVX* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkIndirectCommandsLayoutNVX* pIndirectCommandsLayout); + +VKAPI_ATTR void VKAPI_CALL vkDestroyIndirectCommandsLayoutNVX( + VkDevice device, + VkIndirectCommandsLayoutNVX indirectCommandsLayout, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkCreateObjectTableNVX( + VkDevice device, + const VkObjectTableCreateInfoNVX* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkObjectTableNVX* pObjectTable); + +VKAPI_ATTR void VKAPI_CALL vkDestroyObjectTableNVX( + VkDevice device, + VkObjectTableNVX objectTable, + const VkAllocationCallbacks* pAllocator); + +VKAPI_ATTR VkResult VKAPI_CALL vkRegisterObjectsNVX( + VkDevice device, + VkObjectTableNVX objectTable, + uint32_t objectCount, + const VkObjectTableEntryNVX* const* ppObjectTableEntries, + const uint32_t* pObjectIndices); + +VKAPI_ATTR VkResult VKAPI_CALL vkUnregisterObjectsNVX( + VkDevice device, + VkObjectTableNVX objectTable, + uint32_t objectCount, + const VkObjectEntryTypeNVX* pObjectEntryTypes, + const uint32_t* pObjectIndices); + +VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceGeneratedCommandsPropertiesNVX( + VkPhysicalDevice physicalDevice, + VkDeviceGeneratedCommandsFeaturesNVX* pFeatures, + VkDeviceGeneratedCommandsLimitsNVX* pLimits); +#endif + +#define VK_NV_clip_space_w_scaling 1 +#define VK_NV_CLIP_SPACE_W_SCALING_SPEC_VERSION 1 +#define VK_NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME "VK_NV_clip_space_w_scaling" + +typedef struct VkViewportWScalingNV { + float xcoeff; + float ycoeff; +} VkViewportWScalingNV; + +typedef struct VkPipelineViewportWScalingStateCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkBool32 viewportWScalingEnable; + uint32_t viewportCount; + const VkViewportWScalingNV* pViewportWScalings; +} VkPipelineViewportWScalingStateCreateInfoNV; + + +typedef void (VKAPI_PTR *PFN_vkCmdSetViewportWScalingNV)(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewportWScalingNV* pViewportWScalings); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdSetViewportWScalingNV( + VkCommandBuffer commandBuffer, + uint32_t firstViewport, + uint32_t viewportCount, + const VkViewportWScalingNV* pViewportWScalings); +#endif + +#define VK_EXT_direct_mode_display 1 +#define VK_EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION 1 +#define VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME "VK_EXT_direct_mode_display" + +typedef VkResult (VKAPI_PTR *PFN_vkReleaseDisplayEXT)(VkPhysicalDevice physicalDevice, VkDisplayKHR display); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkReleaseDisplayEXT( + VkPhysicalDevice physicalDevice, + VkDisplayKHR display); +#endif + +#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT +#define VK_EXT_acquire_xlib_display 1 +#include + +#define VK_EXT_ACQUIRE_XLIB_DISPLAY_SPEC_VERSION 1 +#define VK_EXT_ACQUIRE_XLIB_DISPLAY_EXTENSION_NAME "VK_EXT_acquire_xlib_display" + +typedef VkResult (VKAPI_PTR *PFN_vkAcquireXlibDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, VkDisplayKHR display); +typedef VkResult (VKAPI_PTR *PFN_vkGetRandROutputDisplayEXT)(VkPhysicalDevice physicalDevice, Display* dpy, RROutput rrOutput, VkDisplayKHR* pDisplay); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkAcquireXlibDisplayEXT( + VkPhysicalDevice physicalDevice, + Display* dpy, + VkDisplayKHR display); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetRandROutputDisplayEXT( + VkPhysicalDevice physicalDevice, + Display* dpy, + RROutput rrOutput, + VkDisplayKHR* pDisplay); +#endif +#endif /* VK_USE_PLATFORM_XLIB_XRANDR_EXT */ + +#define VK_EXT_display_surface_counter 1 +#define VK_EXT_DISPLAY_SURFACE_COUNTER_SPEC_VERSION 1 +#define VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME "VK_EXT_display_surface_counter" +#define VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES2_EXT VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT + + +typedef enum VkSurfaceCounterFlagBitsEXT { + VK_SURFACE_COUNTER_VBLANK_EXT = 0x00000001, + VK_SURFACE_COUNTER_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF +} VkSurfaceCounterFlagBitsEXT; +typedef VkFlags VkSurfaceCounterFlagsEXT; + +typedef struct VkSurfaceCapabilities2EXT { + VkStructureType sType; + void* pNext; + uint32_t minImageCount; + uint32_t maxImageCount; + VkExtent2D currentExtent; + VkExtent2D minImageExtent; + VkExtent2D maxImageExtent; + uint32_t maxImageArrayLayers; + VkSurfaceTransformFlagsKHR supportedTransforms; + VkSurfaceTransformFlagBitsKHR currentTransform; + VkCompositeAlphaFlagsKHR supportedCompositeAlpha; + VkImageUsageFlags supportedUsageFlags; + VkSurfaceCounterFlagsEXT supportedSurfaceCounters; +} VkSurfaceCapabilities2EXT; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilities2EXT* pSurfaceCapabilities); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2EXT( + VkPhysicalDevice physicalDevice, + VkSurfaceKHR surface, + VkSurfaceCapabilities2EXT* pSurfaceCapabilities); +#endif + +#define VK_EXT_display_control 1 +#define VK_EXT_DISPLAY_CONTROL_SPEC_VERSION 1 +#define VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME "VK_EXT_display_control" + + +typedef enum VkDisplayPowerStateEXT { + VK_DISPLAY_POWER_STATE_OFF_EXT = 0, + VK_DISPLAY_POWER_STATE_SUSPEND_EXT = 1, + VK_DISPLAY_POWER_STATE_ON_EXT = 2, + VK_DISPLAY_POWER_STATE_BEGIN_RANGE_EXT = VK_DISPLAY_POWER_STATE_OFF_EXT, + VK_DISPLAY_POWER_STATE_END_RANGE_EXT = VK_DISPLAY_POWER_STATE_ON_EXT, + VK_DISPLAY_POWER_STATE_RANGE_SIZE_EXT = (VK_DISPLAY_POWER_STATE_ON_EXT - VK_DISPLAY_POWER_STATE_OFF_EXT + 1), + VK_DISPLAY_POWER_STATE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDisplayPowerStateEXT; + +typedef enum VkDeviceEventTypeEXT { + VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT = 0, + VK_DEVICE_EVENT_TYPE_BEGIN_RANGE_EXT = VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT, + VK_DEVICE_EVENT_TYPE_END_RANGE_EXT = VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT, + VK_DEVICE_EVENT_TYPE_RANGE_SIZE_EXT = (VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT - VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT + 1), + VK_DEVICE_EVENT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDeviceEventTypeEXT; + +typedef enum VkDisplayEventTypeEXT { + VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT = 0, + VK_DISPLAY_EVENT_TYPE_BEGIN_RANGE_EXT = VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT, + VK_DISPLAY_EVENT_TYPE_END_RANGE_EXT = VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT, + VK_DISPLAY_EVENT_TYPE_RANGE_SIZE_EXT = (VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT - VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT + 1), + VK_DISPLAY_EVENT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDisplayEventTypeEXT; + +typedef struct VkDisplayPowerInfoEXT { + VkStructureType sType; + const void* pNext; + VkDisplayPowerStateEXT powerState; +} VkDisplayPowerInfoEXT; + +typedef struct VkDeviceEventInfoEXT { + VkStructureType sType; + const void* pNext; + VkDeviceEventTypeEXT deviceEvent; +} VkDeviceEventInfoEXT; + +typedef struct VkDisplayEventInfoEXT { + VkStructureType sType; + const void* pNext; + VkDisplayEventTypeEXT displayEvent; +} VkDisplayEventInfoEXT; + +typedef struct VkSwapchainCounterCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkSurfaceCounterFlagsEXT surfaceCounters; +} VkSwapchainCounterCreateInfoEXT; + + +typedef VkResult (VKAPI_PTR *PFN_vkDisplayPowerControlEXT)(VkDevice device, VkDisplayKHR display, const VkDisplayPowerInfoEXT* pDisplayPowerInfo); +typedef VkResult (VKAPI_PTR *PFN_vkRegisterDeviceEventEXT)(VkDevice device, const VkDeviceEventInfoEXT* pDeviceEventInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence); +typedef VkResult (VKAPI_PTR *PFN_vkRegisterDisplayEventEXT)(VkDevice device, VkDisplayKHR display, const VkDisplayEventInfoEXT* pDisplayEventInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence); +typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainCounterEXT)(VkDevice device, VkSwapchainKHR swapchain, VkSurfaceCounterFlagBitsEXT counter, uint64_t* pCounterValue); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkDisplayPowerControlEXT( + VkDevice device, + VkDisplayKHR display, + const VkDisplayPowerInfoEXT* pDisplayPowerInfo); + +VKAPI_ATTR VkResult VKAPI_CALL vkRegisterDeviceEventEXT( + VkDevice device, + const VkDeviceEventInfoEXT* pDeviceEventInfo, + const VkAllocationCallbacks* pAllocator, + VkFence* pFence); + +VKAPI_ATTR VkResult VKAPI_CALL vkRegisterDisplayEventEXT( + VkDevice device, + VkDisplayKHR display, + const VkDisplayEventInfoEXT* pDisplayEventInfo, + const VkAllocationCallbacks* pAllocator, + VkFence* pFence); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainCounterEXT( + VkDevice device, + VkSwapchainKHR swapchain, + VkSurfaceCounterFlagBitsEXT counter, + uint64_t* pCounterValue); +#endif + +#define VK_GOOGLE_display_timing 1 +#define VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION 1 +#define VK_GOOGLE_DISPLAY_TIMING_EXTENSION_NAME "VK_GOOGLE_display_timing" + +typedef struct VkRefreshCycleDurationGOOGLE { + uint64_t refreshDuration; +} VkRefreshCycleDurationGOOGLE; + +typedef struct VkPastPresentationTimingGOOGLE { + uint32_t presentID; + uint64_t desiredPresentTime; + uint64_t actualPresentTime; + uint64_t earliestPresentTime; + uint64_t presentMargin; +} VkPastPresentationTimingGOOGLE; + +typedef struct VkPresentTimeGOOGLE { + uint32_t presentID; + uint64_t desiredPresentTime; +} VkPresentTimeGOOGLE; + +typedef struct VkPresentTimesInfoGOOGLE { + VkStructureType sType; + const void* pNext; + uint32_t swapchainCount; + const VkPresentTimeGOOGLE* pTimes; +} VkPresentTimesInfoGOOGLE; + + +typedef VkResult (VKAPI_PTR *PFN_vkGetRefreshCycleDurationGOOGLE)(VkDevice device, VkSwapchainKHR swapchain, VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties); +typedef VkResult (VKAPI_PTR *PFN_vkGetPastPresentationTimingGOOGLE)(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pPresentationTimingCount, VkPastPresentationTimingGOOGLE* pPresentationTimings); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkGetRefreshCycleDurationGOOGLE( + VkDevice device, + VkSwapchainKHR swapchain, + VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties); + +VKAPI_ATTR VkResult VKAPI_CALL vkGetPastPresentationTimingGOOGLE( + VkDevice device, + VkSwapchainKHR swapchain, + uint32_t* pPresentationTimingCount, + VkPastPresentationTimingGOOGLE* pPresentationTimings); +#endif + +#define VK_NV_sample_mask_override_coverage 1 +#define VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_SPEC_VERSION 1 +#define VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_EXTENSION_NAME "VK_NV_sample_mask_override_coverage" + + +#define VK_NV_geometry_shader_passthrough 1 +#define VK_NV_GEOMETRY_SHADER_PASSTHROUGH_SPEC_VERSION 1 +#define VK_NV_GEOMETRY_SHADER_PASSTHROUGH_EXTENSION_NAME "VK_NV_geometry_shader_passthrough" + + +#define VK_NV_viewport_array2 1 +#define VK_NV_VIEWPORT_ARRAY2_SPEC_VERSION 1 +#define VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME "VK_NV_viewport_array2" + + +#define VK_NVX_multiview_per_view_attributes 1 +#define VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_SPEC_VERSION 1 +#define VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_EXTENSION_NAME "VK_NVX_multiview_per_view_attributes" + +typedef struct VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX { + VkStructureType sType; + void* pNext; + VkBool32 perViewPositionAllComponents; +} VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX; + + + +#define VK_NV_viewport_swizzle 1 +#define VK_NV_VIEWPORT_SWIZZLE_SPEC_VERSION 1 +#define VK_NV_VIEWPORT_SWIZZLE_EXTENSION_NAME "VK_NV_viewport_swizzle" + + +typedef enum VkViewportCoordinateSwizzleNV { + VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV = 0, + VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_X_NV = 1, + VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Y_NV = 2, + VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Y_NV = 3, + VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Z_NV = 4, + VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Z_NV = 5, + VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_W_NV = 6, + VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV = 7, + VK_VIEWPORT_COORDINATE_SWIZZLE_BEGIN_RANGE_NV = VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV, + VK_VIEWPORT_COORDINATE_SWIZZLE_END_RANGE_NV = VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV, + VK_VIEWPORT_COORDINATE_SWIZZLE_RANGE_SIZE_NV = (VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV - VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV + 1), + VK_VIEWPORT_COORDINATE_SWIZZLE_MAX_ENUM_NV = 0x7FFFFFFF +} VkViewportCoordinateSwizzleNV; + +typedef VkFlags VkPipelineViewportSwizzleStateCreateFlagsNV; + +typedef struct VkViewportSwizzleNV { + VkViewportCoordinateSwizzleNV x; + VkViewportCoordinateSwizzleNV y; + VkViewportCoordinateSwizzleNV z; + VkViewportCoordinateSwizzleNV w; +} VkViewportSwizzleNV; + +typedef struct VkPipelineViewportSwizzleStateCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkPipelineViewportSwizzleStateCreateFlagsNV flags; + uint32_t viewportCount; + const VkViewportSwizzleNV* pViewportSwizzles; +} VkPipelineViewportSwizzleStateCreateInfoNV; + + + +#define VK_EXT_discard_rectangles 1 +#define VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION 1 +#define VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME "VK_EXT_discard_rectangles" + + +typedef enum VkDiscardRectangleModeEXT { + VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT = 0, + VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT = 1, + VK_DISCARD_RECTANGLE_MODE_BEGIN_RANGE_EXT = VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT, + VK_DISCARD_RECTANGLE_MODE_END_RANGE_EXT = VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT, + VK_DISCARD_RECTANGLE_MODE_RANGE_SIZE_EXT = (VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT - VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT + 1), + VK_DISCARD_RECTANGLE_MODE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkDiscardRectangleModeEXT; + +typedef VkFlags VkPipelineDiscardRectangleStateCreateFlagsEXT; + +typedef struct VkPhysicalDeviceDiscardRectanglePropertiesEXT { + VkStructureType sType; + void* pNext; + uint32_t maxDiscardRectangles; +} VkPhysicalDeviceDiscardRectanglePropertiesEXT; + +typedef struct VkPipelineDiscardRectangleStateCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkPipelineDiscardRectangleStateCreateFlagsEXT flags; + VkDiscardRectangleModeEXT discardRectangleMode; + uint32_t discardRectangleCount; + const VkRect2D* pDiscardRectangles; +} VkPipelineDiscardRectangleStateCreateInfoEXT; + + +typedef void (VKAPI_PTR *PFN_vkCmdSetDiscardRectangleEXT)(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle, uint32_t discardRectangleCount, const VkRect2D* pDiscardRectangles); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkCmdSetDiscardRectangleEXT( + VkCommandBuffer commandBuffer, + uint32_t firstDiscardRectangle, + uint32_t discardRectangleCount, + const VkRect2D* pDiscardRectangles); +#endif + +#define VK_EXT_swapchain_colorspace 1 +#define VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION 3 +#define VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME "VK_EXT_swapchain_colorspace" + + +#define VK_EXT_hdr_metadata 1 +#define VK_EXT_HDR_METADATA_SPEC_VERSION 1 +#define VK_EXT_HDR_METADATA_EXTENSION_NAME "VK_EXT_hdr_metadata" + +typedef struct VkXYColorEXT { + float x; + float y; +} VkXYColorEXT; + +typedef struct VkHdrMetadataEXT { + VkStructureType sType; + const void* pNext; + VkXYColorEXT displayPrimaryRed; + VkXYColorEXT displayPrimaryGreen; + VkXYColorEXT displayPrimaryBlue; + VkXYColorEXT whitePoint; + float maxLuminance; + float minLuminance; + float maxContentLightLevel; + float maxFrameAverageLightLevel; +} VkHdrMetadataEXT; + + +typedef void (VKAPI_PTR *PFN_vkSetHdrMetadataEXT)(VkDevice device, uint32_t swapchainCount, const VkSwapchainKHR* pSwapchains, const VkHdrMetadataEXT* pMetadata); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR void VKAPI_CALL vkSetHdrMetadataEXT( + VkDevice device, + uint32_t swapchainCount, + const VkSwapchainKHR* pSwapchains, + const VkHdrMetadataEXT* pMetadata); +#endif + +#ifdef VK_USE_PLATFORM_IOS_MVK +#define VK_MVK_ios_surface 1 +#define VK_MVK_IOS_SURFACE_SPEC_VERSION 2 +#define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface" + +typedef VkFlags VkIOSSurfaceCreateFlagsMVK; + +typedef struct VkIOSSurfaceCreateInfoMVK { + VkStructureType sType; + const void* pNext; + VkIOSSurfaceCreateFlagsMVK flags; + const void* pView; +} VkIOSSurfaceCreateInfoMVK; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateIOSSurfaceMVK)(VkInstance instance, const VkIOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK( + VkInstance instance, + const VkIOSSurfaceCreateInfoMVK* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif +#endif /* VK_USE_PLATFORM_IOS_MVK */ + +#ifdef VK_USE_PLATFORM_MACOS_MVK +#define VK_MVK_macos_surface 1 +#define VK_MVK_MACOS_SURFACE_SPEC_VERSION 2 +#define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface" + +typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; + +typedef struct VkMacOSSurfaceCreateInfoMVK { + VkStructureType sType; + const void* pNext; + VkMacOSSurfaceCreateFlagsMVK flags; + const void* pView; +} VkMacOSSurfaceCreateInfoMVK; + + +typedef VkResult (VKAPI_PTR *PFN_vkCreateMacOSSurfaceMVK)(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); + +#ifndef VK_NO_PROTOTYPES +VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK( + VkInstance instance, + const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, + const VkAllocationCallbacks* pAllocator, + VkSurfaceKHR* pSurface); +#endif +#endif /* VK_USE_PLATFORM_MACOS_MVK */ + +#define VK_EXT_sampler_filter_minmax 1 +#define VK_EXT_SAMPLER_FILTER_MINMAX_SPEC_VERSION 1 +#define VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME "VK_EXT_sampler_filter_minmax" + + +typedef enum VkSamplerReductionModeEXT { + VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT = 0, + VK_SAMPLER_REDUCTION_MODE_MIN_EXT = 1, + VK_SAMPLER_REDUCTION_MODE_MAX_EXT = 2, + VK_SAMPLER_REDUCTION_MODE_BEGIN_RANGE_EXT = VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT, + VK_SAMPLER_REDUCTION_MODE_END_RANGE_EXT = VK_SAMPLER_REDUCTION_MODE_MAX_EXT, + VK_SAMPLER_REDUCTION_MODE_RANGE_SIZE_EXT = (VK_SAMPLER_REDUCTION_MODE_MAX_EXT - VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT + 1), + VK_SAMPLER_REDUCTION_MODE_MAX_ENUM_EXT = 0x7FFFFFFF +} VkSamplerReductionModeEXT; + +typedef struct VkSamplerReductionModeCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkSamplerReductionModeEXT reductionMode; +} VkSamplerReductionModeCreateInfoEXT; + +typedef struct VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT { + VkStructureType sType; + void* pNext; + VkBool32 filterMinmaxSingleComponentFormats; + VkBool32 filterMinmaxImageComponentMapping; +} VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT; + + + +#define VK_AMD_gpu_shader_int16 1 +#define VK_AMD_GPU_SHADER_INT16_SPEC_VERSION 1 +#define VK_AMD_GPU_SHADER_INT16_EXTENSION_NAME "VK_AMD_gpu_shader_int16" + + +#define VK_AMD_mixed_attachment_samples 1 +#define VK_AMD_MIXED_ATTACHMENT_SAMPLES_SPEC_VERSION 1 +#define VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME "VK_AMD_mixed_attachment_samples" + + +#define VK_EXT_shader_stencil_export 1 +#define VK_EXT_SHADER_STENCIL_EXPORT_SPEC_VERSION 1 +#define VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME "VK_EXT_shader_stencil_export" + + +#define VK_EXT_blend_operation_advanced 1 +#define VK_EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION 2 +#define VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME "VK_EXT_blend_operation_advanced" + + +typedef enum VkBlendOverlapEXT { + VK_BLEND_OVERLAP_UNCORRELATED_EXT = 0, + VK_BLEND_OVERLAP_DISJOINT_EXT = 1, + VK_BLEND_OVERLAP_CONJOINT_EXT = 2, + VK_BLEND_OVERLAP_BEGIN_RANGE_EXT = VK_BLEND_OVERLAP_UNCORRELATED_EXT, + VK_BLEND_OVERLAP_END_RANGE_EXT = VK_BLEND_OVERLAP_CONJOINT_EXT, + VK_BLEND_OVERLAP_RANGE_SIZE_EXT = (VK_BLEND_OVERLAP_CONJOINT_EXT - VK_BLEND_OVERLAP_UNCORRELATED_EXT + 1), + VK_BLEND_OVERLAP_MAX_ENUM_EXT = 0x7FFFFFFF +} VkBlendOverlapEXT; + +typedef struct VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT { + VkStructureType sType; + void* pNext; + VkBool32 advancedBlendCoherentOperations; +} VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT; + +typedef struct VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT { + VkStructureType sType; + void* pNext; + uint32_t advancedBlendMaxColorAttachments; + VkBool32 advancedBlendIndependentBlend; + VkBool32 advancedBlendNonPremultipliedSrcColor; + VkBool32 advancedBlendNonPremultipliedDstColor; + VkBool32 advancedBlendCorrelatedOverlap; + VkBool32 advancedBlendAllOperations; +} VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT; + +typedef struct VkPipelineColorBlendAdvancedStateCreateInfoEXT { + VkStructureType sType; + const void* pNext; + VkBool32 srcPremultiplied; + VkBool32 dstPremultiplied; + VkBlendOverlapEXT blendOverlap; +} VkPipelineColorBlendAdvancedStateCreateInfoEXT; + + + +#define VK_NV_fragment_coverage_to_color 1 +#define VK_NV_FRAGMENT_COVERAGE_TO_COLOR_SPEC_VERSION 1 +#define VK_NV_FRAGMENT_COVERAGE_TO_COLOR_EXTENSION_NAME "VK_NV_fragment_coverage_to_color" + +typedef VkFlags VkPipelineCoverageToColorStateCreateFlagsNV; + +typedef struct VkPipelineCoverageToColorStateCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkPipelineCoverageToColorStateCreateFlagsNV flags; + VkBool32 coverageToColorEnable; + uint32_t coverageToColorLocation; +} VkPipelineCoverageToColorStateCreateInfoNV; + + + +#define VK_NV_framebuffer_mixed_samples 1 +#define VK_NV_FRAMEBUFFER_MIXED_SAMPLES_SPEC_VERSION 1 +#define VK_NV_FRAMEBUFFER_MIXED_SAMPLES_EXTENSION_NAME "VK_NV_framebuffer_mixed_samples" + + +typedef enum VkCoverageModulationModeNV { + VK_COVERAGE_MODULATION_MODE_NONE_NV = 0, + VK_COVERAGE_MODULATION_MODE_RGB_NV = 1, + VK_COVERAGE_MODULATION_MODE_ALPHA_NV = 2, + VK_COVERAGE_MODULATION_MODE_RGBA_NV = 3, + VK_COVERAGE_MODULATION_MODE_BEGIN_RANGE_NV = VK_COVERAGE_MODULATION_MODE_NONE_NV, + VK_COVERAGE_MODULATION_MODE_END_RANGE_NV = VK_COVERAGE_MODULATION_MODE_RGBA_NV, + VK_COVERAGE_MODULATION_MODE_RANGE_SIZE_NV = (VK_COVERAGE_MODULATION_MODE_RGBA_NV - VK_COVERAGE_MODULATION_MODE_NONE_NV + 1), + VK_COVERAGE_MODULATION_MODE_MAX_ENUM_NV = 0x7FFFFFFF +} VkCoverageModulationModeNV; + +typedef VkFlags VkPipelineCoverageModulationStateCreateFlagsNV; + +typedef struct VkPipelineCoverageModulationStateCreateInfoNV { + VkStructureType sType; + const void* pNext; + VkPipelineCoverageModulationStateCreateFlagsNV flags; + VkCoverageModulationModeNV coverageModulationMode; + VkBool32 coverageModulationTableEnable; + uint32_t coverageModulationTableCount; + const float* pCoverageModulationTable; +} VkPipelineCoverageModulationStateCreateInfoNV; + + + +#define VK_NV_fill_rectangle 1 +#define VK_NV_FILL_RECTANGLE_SPEC_VERSION 1 +#define VK_NV_FILL_RECTANGLE_EXTENSION_NAME "VK_NV_fill_rectangle" + + +#define VK_EXT_post_depth_coverage 1 +#define VK_EXT_POST_DEPTH_COVERAGE_SPEC_VERSION 1 +#define VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME "VK_EXT_post_depth_coverage" + + +#define VK_EXT_shader_viewport_index_layer 1 +#define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_SPEC_VERSION 1 +#define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME "VK_EXT_shader_viewport_index_layer" + + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.c b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.c new file mode 100644 index 000000000..c79f372bf --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.c @@ -0,0 +1,171 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_KMSDRM + +#define DEBUG_DYNAMIC_KMSDRM 0 + +#include "SDL_kmsdrmdyn.h" + +#if DEBUG_DYNAMIC_KMSDRM +#include "SDL_log.h" +#endif + +#ifdef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC + +#include "SDL_name.h" +#include "SDL_loadso.h" + +typedef struct +{ + void *lib; + const char *libname; +} kmsdrmdynlib; + +#ifndef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC +#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC NULL +#endif +#ifndef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM +#define SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM NULL +#endif + +static kmsdrmdynlib kmsdrmlibs[] = { + {NULL, SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC}, + {NULL, SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC_GBM} +}; + +static void * +KMSDRM_GetSym(const char *fnname, int *pHasModule) +{ + int i; + void *fn = NULL; + for (i = 0; i < SDL_TABLESIZE(kmsdrmlibs); i++) { + if (kmsdrmlibs[i].lib != NULL) { + fn = SDL_LoadFunction(kmsdrmlibs[i].lib, fnname); + if (fn != NULL) + break; + } + } + +#if DEBUG_DYNAMIC_KMSDRM + if (fn != NULL) + SDL_Log("KMSDRM: Found '%s' in %s (%p)\n", fnname, kmsdrmlibs[i].libname, fn); + else + SDL_Log("KMSDRM: Symbol '%s' NOT FOUND!\n", fnname); +#endif + + if (fn == NULL) + *pHasModule = 0; /* kill this module. */ + + return fn; +} + +#endif /* SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC */ + +/* Define all the function pointers and wrappers... */ +#define SDL_KMSDRM_MODULE(modname) int SDL_KMSDRM_HAVE_##modname = 0; +#define SDL_KMSDRM_SYM(rc,fn,params) SDL_DYNKMSDRMFN_##fn KMSDRM_##fn = NULL; +#define SDL_KMSDRM_SYM_CONST(type,name) SDL_DYNKMSDRMCONST_##name KMSDRM_##name = NULL; +#include "SDL_kmsdrmsym.h" + +static int kmsdrm_load_refcount = 0; + +void +SDL_KMSDRM_UnloadSymbols(void) +{ + /* Don't actually unload if more than one module is using the libs... */ + if (kmsdrm_load_refcount > 0) { + if (--kmsdrm_load_refcount == 0) { +#ifdef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC + int i; +#endif + + /* set all the function pointers to NULL. */ +#define SDL_KMSDRM_MODULE(modname) SDL_KMSDRM_HAVE_##modname = 0; +#define SDL_KMSDRM_SYM(rc,fn,params) KMSDRM_##fn = NULL; +#define SDL_KMSDRM_SYM_CONST(type,name) KMSDRM_##name = NULL; +#include "SDL_kmsdrmsym.h" + + +#ifdef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC + for (i = 0; i < SDL_TABLESIZE(kmsdrmlibs); i++) { + if (kmsdrmlibs[i].lib != NULL) { + SDL_UnloadObject(kmsdrmlibs[i].lib); + kmsdrmlibs[i].lib = NULL; + } + } +#endif + } + } +} + +/* returns non-zero if all needed symbols were loaded. */ +int +SDL_KMSDRM_LoadSymbols(void) +{ + int rc = 1; /* always succeed if not using Dynamic KMSDRM stuff. */ + + /* deal with multiple modules needing these symbols... */ + if (kmsdrm_load_refcount++ == 0) { +#ifdef SDL_VIDEO_DRIVER_KMSDRM_DYNAMIC + int i; + int *thismod = NULL; + for (i = 0; i < SDL_TABLESIZE(kmsdrmlibs); i++) { + if (kmsdrmlibs[i].libname != NULL) { + kmsdrmlibs[i].lib = SDL_LoadObject(kmsdrmlibs[i].libname); + } + } + +#define SDL_KMSDRM_MODULE(modname) SDL_KMSDRM_HAVE_##modname = 1; /* default yes */ +#include "SDL_kmsdrmsym.h" + +#define SDL_KMSDRM_MODULE(modname) thismod = &SDL_KMSDRM_HAVE_##modname; +#define SDL_KMSDRM_SYM(rc,fn,params) KMSDRM_##fn = (SDL_DYNKMSDRMFN_##fn) KMSDRM_GetSym(#fn,thismod); +#define SDL_KMSDRM_SYM_CONST(type,name) KMSDRM_##name = *(SDL_DYNKMSDRMCONST_##name*) KMSDRM_GetSym(#name,thismod); +#include "SDL_kmsdrmsym.h" + + if ((SDL_KMSDRM_HAVE_LIBDRM) && (SDL_KMSDRM_HAVE_GBM)) { + /* all required symbols loaded. */ + SDL_ClearError(); + } else { + /* in case something got loaded... */ + SDL_KMSDRM_UnloadSymbols(); + rc = 0; + } + +#else /* no dynamic KMSDRM */ + +#define SDL_KMSDRM_MODULE(modname) SDL_KMSDRM_HAVE_##modname = 1; /* default yes */ +#define SDL_KMSDRM_SYM(rc,fn,params) KMSDRM_##fn = fn; +#define SDL_KMSDRM_SYM_CONST(type,name) KMSDRM_##name = name; +#include "SDL_kmsdrmsym.h" + +#endif + } + + return rc; +} + +#endif /* SDL_VIDEO_DRIVER_KMSDRM */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.h b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.h new file mode 100644 index 000000000..578b088d8 --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmdyn.h @@ -0,0 +1,53 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef SDL_kmsdrmdyn_h_ +#define SDL_kmsdrmdyn_h_ + +#include "../../SDL_internal.h" + +#include +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +int SDL_KMSDRM_LoadSymbols(void); +void SDL_KMSDRM_UnloadSymbols(void); + +/* Declare all the function pointers and wrappers... */ +#define SDL_KMSDRM_SYM(rc,fn,params) \ + typedef rc (*SDL_DYNKMSDRMFN_##fn) params; \ + extern SDL_DYNKMSDRMFN_##fn KMSDRM_##fn; +#define SDL_KMSDRM_SYM_CONST(type, name) \ + typedef type SDL_DYNKMSDRMCONST_##name; \ + extern SDL_DYNKMSDRMCONST_##name KMSDRM_##name; +#include "SDL_kmsdrmsym.h" + +#ifdef __cplusplus +} +#endif + +#endif /* SDL_kmsdrmdyn_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmevents.c b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmevents.c new file mode 100644 index 000000000..5a611f697 --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmevents.c @@ -0,0 +1,42 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_KMSDRM + +#include "SDL_kmsdrmvideo.h" +#include "SDL_kmsdrmevents.h" + +#ifdef SDL_INPUT_LINUXEV +#include "../../core/linux/SDL_evdev.h" +#endif + +void KMSDRM_PumpEvents(_THIS) +{ +#ifdef SDL_INPUT_LINUXEV + SDL_EVDEV_Poll(); +#endif + +} + +#endif /* SDL_VIDEO_DRIVER_KMSDRM */ + diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmevents.h b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmevents.h new file mode 100644 index 000000000..3b88c281d --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmevents.h @@ -0,0 +1,31 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifndef SDL_kmsdrmevents_h_ +#define SDL_kmsdrmevents_h_ + +extern void KMSDRM_PumpEvents(_THIS); +extern void KMSDRM_EventInit(_THIS); +extern void KMSDRM_EventQuit(_THIS); + +#endif /* SDL_kmsdrmevents_h_ */ diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmmouse.c b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmmouse.c new file mode 100644 index 000000000..e23dd1310 --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmmouse.c @@ -0,0 +1,501 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_KMSDRM + +#include "SDL_kmsdrmvideo.h" +#include "SDL_kmsdrmmouse.h" +#include "SDL_kmsdrmdyn.h" + +#include "../../events/SDL_mouse_c.h" +#include "../../events/default_cursor.h" + +static SDL_Cursor *KMSDRM_CreateDefaultCursor(void); +static SDL_Cursor *KMSDRM_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y); +static int KMSDRM_ShowCursor(SDL_Cursor * cursor); +static void KMSDRM_MoveCursor(SDL_Cursor * cursor); +static void KMSDRM_FreeCursor(SDL_Cursor * cursor); +static void KMSDRM_WarpMouse(SDL_Window * window, int x, int y); +static int KMSDRM_WarpMouseGlobal(int x, int y); + +static SDL_Cursor * +KMSDRM_CreateDefaultCursor(void) +{ + return SDL_CreateCursor(default_cdata, default_cmask, DEFAULT_CWIDTH, DEFAULT_CHEIGHT, DEFAULT_CHOTX, DEFAULT_CHOTY); +} + +/* Evaluate if a given cursor size is supported or not. Notably, current Intel gfx only support 64x64 and up. */ +static SDL_bool +KMSDRM_IsCursorSizeSupported (int w, int h, uint32_t bo_format) { + + SDL_VideoDevice *dev = SDL_GetVideoDevice(); + SDL_VideoData *vdata = ((SDL_VideoData *)dev->driverdata); + int ret; + uint32_t bo_handle; + struct gbm_bo *bo = KMSDRM_gbm_bo_create(vdata->gbm, w, h, bo_format, + GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE); + + if (bo == NULL) { + SDL_SetError("Could not create GBM cursor BO width size %dx%d for size testing", w, h); + goto cleanup; + } + + bo_handle = KMSDRM_gbm_bo_get_handle(bo).u32; + ret = KMSDRM_drmModeSetCursor(vdata->drm_fd, vdata->crtc_id, bo_handle, w, h); + + if (ret) { + goto cleanup; + } + else { + KMSDRM_gbm_bo_destroy(bo); + return SDL_TRUE; + } + +cleanup: + if (bo != NULL) { + KMSDRM_gbm_bo_destroy(bo); + } + return SDL_FALSE; +} + +/* Create a cursor from a surface */ +static SDL_Cursor * +KMSDRM_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y) +{ + SDL_VideoDevice *dev = SDL_GetVideoDevice(); + SDL_VideoData *vdata = ((SDL_VideoData *)dev->driverdata); + SDL_PixelFormat *pixlfmt = surface->format; + KMSDRM_CursorData *curdata; + SDL_Cursor *cursor; + SDL_bool cursor_supported = SDL_FALSE; + int i, ret, usable_cursor_w, usable_cursor_h; + uint32_t bo_format, bo_stride; + char *buffer = NULL; + size_t bufsize; + + switch(pixlfmt->format) { + case SDL_PIXELFORMAT_RGB332: + bo_format = GBM_FORMAT_RGB332; + break; + case SDL_PIXELFORMAT_ARGB4444: + bo_format = GBM_FORMAT_ARGB4444; + break; + case SDL_PIXELFORMAT_RGBA4444: + bo_format = GBM_FORMAT_RGBA4444; + break; + case SDL_PIXELFORMAT_ABGR4444: + bo_format = GBM_FORMAT_ABGR4444; + break; + case SDL_PIXELFORMAT_BGRA4444: + bo_format = GBM_FORMAT_BGRA4444; + break; + case SDL_PIXELFORMAT_ARGB1555: + bo_format = GBM_FORMAT_ARGB1555; + break; + case SDL_PIXELFORMAT_RGBA5551: + bo_format = GBM_FORMAT_RGBA5551; + break; + case SDL_PIXELFORMAT_ABGR1555: + bo_format = GBM_FORMAT_ABGR1555; + break; + case SDL_PIXELFORMAT_BGRA5551: + bo_format = GBM_FORMAT_BGRA5551; + break; + case SDL_PIXELFORMAT_RGB565: + bo_format = GBM_FORMAT_RGB565; + break; + case SDL_PIXELFORMAT_BGR565: + bo_format = GBM_FORMAT_BGR565; + break; + case SDL_PIXELFORMAT_RGB888: + case SDL_PIXELFORMAT_RGB24: + bo_format = GBM_FORMAT_RGB888; + break; + case SDL_PIXELFORMAT_BGR888: + case SDL_PIXELFORMAT_BGR24: + bo_format = GBM_FORMAT_BGR888; + break; + case SDL_PIXELFORMAT_RGBX8888: + bo_format = GBM_FORMAT_RGBX8888; + break; + case SDL_PIXELFORMAT_BGRX8888: + bo_format = GBM_FORMAT_BGRX8888; + break; + case SDL_PIXELFORMAT_ARGB8888: + bo_format = GBM_FORMAT_ARGB8888; + break; + case SDL_PIXELFORMAT_RGBA8888: + bo_format = GBM_FORMAT_RGBA8888; + break; + case SDL_PIXELFORMAT_ABGR8888: + bo_format = GBM_FORMAT_ABGR8888; + break; + case SDL_PIXELFORMAT_BGRA8888: + bo_format = GBM_FORMAT_BGRA8888; + break; + case SDL_PIXELFORMAT_ARGB2101010: + bo_format = GBM_FORMAT_ARGB2101010; + break; + default: + SDL_SetError("Unsupported pixel format for cursor"); + return NULL; + } + + if (!KMSDRM_gbm_device_is_format_supported(vdata->gbm, bo_format, GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE)) { + SDL_SetError("Unsupported pixel format for cursor"); + return NULL; + } + + cursor = (SDL_Cursor *) SDL_calloc(1, sizeof(*cursor)); + if (cursor == NULL) { + SDL_OutOfMemory(); + return NULL; + } + curdata = (KMSDRM_CursorData *) SDL_calloc(1, sizeof(*curdata)); + if (curdata == NULL) { + SDL_OutOfMemory(); + SDL_free(cursor); + return NULL; + } + + /* We have to know beforehand if a cursor with the same size as the surface is supported. + * If it's not, we have to find an usable cursor size and use an intermediate and clean buffer. + * If we can't find a cursor size supported by the hardware, we won't go on trying to + * call SDL_SetCursor() later. */ + + usable_cursor_w = surface->w; + usable_cursor_h = surface->h; + + while (usable_cursor_w <= MAX_CURSOR_W && usable_cursor_h <= MAX_CURSOR_H) { + if (KMSDRM_IsCursorSizeSupported(usable_cursor_w, usable_cursor_h, bo_format)) { + cursor_supported = SDL_TRUE; + break; + } + usable_cursor_w += usable_cursor_w; + usable_cursor_h += usable_cursor_h; + } + + if (!cursor_supported) { + SDL_SetError("Could not find a cursor size supported by the kernel driver"); + goto cleanup; + } + + curdata->hot_x = hot_x; + curdata->hot_y = hot_y; + curdata->w = usable_cursor_w; + curdata->h = usable_cursor_h; + + curdata->bo = KMSDRM_gbm_bo_create(vdata->gbm, usable_cursor_w, usable_cursor_h, bo_format, + GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE); + + if (curdata->bo == NULL) { + SDL_SetError("Could not create GBM cursor BO"); + goto cleanup; + } + + bo_stride = KMSDRM_gbm_bo_get_stride(curdata->bo); + bufsize = bo_stride * curdata->h; + + if (surface->pitch != bo_stride) { + /* pitch doesn't match stride, must be copied to temp buffer */ + buffer = SDL_malloc(bufsize); + if (buffer == NULL) { + SDL_OutOfMemory(); + goto cleanup; + } + + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + /* Could not lock surface */ + goto cleanup; + } + } + + /* Clean the whole temporary buffer */ + SDL_memset(buffer, 0x00, bo_stride * curdata->h); + + /* Copy to temporary buffer */ + for (i = 0; i < surface->h; i++) { + SDL_memcpy(buffer + (i * bo_stride), + ((char *)surface->pixels) + (i * surface->pitch), + surface->w * pixlfmt->BytesPerPixel); + } + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } + + if (KMSDRM_gbm_bo_write(curdata->bo, buffer, bufsize)) { + SDL_SetError("Could not write to GBM cursor BO"); + goto cleanup; + } + + /* Free temporary buffer */ + SDL_free(buffer); + buffer = NULL; + } else { + /* surface matches BO format */ + if (SDL_MUSTLOCK(surface)) { + if (SDL_LockSurface(surface) < 0) { + /* Could not lock surface */ + goto cleanup; + } + } + + ret = KMSDRM_gbm_bo_write(curdata->bo, surface->pixels, bufsize); + + if (SDL_MUSTLOCK(surface)) { + SDL_UnlockSurface(surface); + } + + if (ret) { + SDL_SetError("Could not write to GBM cursor BO"); + goto cleanup; + } + } + + cursor->driverdata = curdata; + + return cursor; + +cleanup: + if (buffer != NULL) { + SDL_free(buffer); + } + if (cursor != NULL) { + SDL_free(cursor); + } + if (curdata != NULL) { + if (curdata->bo != NULL) { + KMSDRM_gbm_bo_destroy(curdata->bo); + } + SDL_free(curdata); + } + return NULL; +} + +/* Show the specified cursor, or hide if cursor is NULL */ +static int +KMSDRM_ShowCursor(SDL_Cursor * cursor) +{ + SDL_VideoDevice *dev = SDL_GetVideoDevice(); + SDL_VideoData *vdata = ((SDL_VideoData *)dev->driverdata); + SDL_Mouse *mouse; + KMSDRM_CursorData *curdata; + SDL_VideoDisplay *display = NULL; + SDL_DisplayData *ddata = NULL; + int ret; + uint32_t bo_handle; + + mouse = SDL_GetMouse(); + if (mouse == NULL) { + return SDL_SetError("No mouse."); + } + + if (mouse->focus != NULL) { + display = SDL_GetDisplayForWindow(mouse->focus); + if (display != NULL) { + ddata = (SDL_DisplayData*) display->driverdata; + } + } + + if (cursor == NULL) { + /* Hide current cursor */ + if ( mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) { + curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata; + + if (curdata->crtc_id != 0) { + ret = KMSDRM_drmModeSetCursor(vdata->drm_fd, curdata->crtc_id, 0, 0, 0); + if (ret) { + SDL_SetError("Could not hide current cursor with drmModeSetCursor()."); + return ret; + } + /* Mark previous cursor as not-displayed */ + curdata->crtc_id = 0; + + return 0; + } + } + /* otherwise if possible, hide global cursor */ + if (ddata != NULL && ddata->crtc_id != 0) { + ret = KMSDRM_drmModeSetCursor(vdata->drm_fd, ddata->crtc_id, 0, 0, 0); + if (ret) { + SDL_SetError("Could not hide display's cursor with drmModeSetCursor()."); + return ret; + } + return 0; + } + + return SDL_SetError("Couldn't find cursor to hide."); + } + /* If cursor != NULL, show new cursor on display */ + if (display == NULL) { + return SDL_SetError("Could not get display for mouse."); + } + if (ddata == NULL) { + return SDL_SetError("Could not get display driverdata."); + } + + curdata = (KMSDRM_CursorData *) cursor->driverdata; + if (curdata == NULL || curdata->bo == NULL) { + return SDL_SetError("Cursor not initialized properly."); + } + + bo_handle = KMSDRM_gbm_bo_get_handle(curdata->bo).u32; + if (curdata->hot_x == 0 && curdata->hot_y == 0) { + ret = KMSDRM_drmModeSetCursor(vdata->drm_fd, ddata->crtc_id, bo_handle, + curdata->w, curdata->h); + } else { + ret = KMSDRM_drmModeSetCursor2(vdata->drm_fd, ddata->crtc_id, bo_handle, + curdata->w, curdata->h, + curdata->hot_x, curdata->hot_y); + } + if (ret) { + SDL_SetError("drmModeSetCursor failed."); + return ret; + } + + curdata->crtc_id = ddata->crtc_id; + + return 0; +} + +/* Free a window manager cursor */ +static void +KMSDRM_FreeCursor(SDL_Cursor * cursor) +{ + KMSDRM_CursorData *curdata; + int drm_fd; + + if (cursor != NULL) { + curdata = (KMSDRM_CursorData *) cursor->driverdata; + + if (curdata != NULL) { + if (curdata->bo != NULL) { + if (curdata->crtc_id != 0) { + drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo)); + /* Hide the cursor if previously shown on a CRTC */ + KMSDRM_drmModeSetCursor(drm_fd, curdata->crtc_id, 0, 0, 0); + curdata->crtc_id = 0; + } + KMSDRM_gbm_bo_destroy(curdata->bo); + curdata->bo = NULL; + } + SDL_free(cursor->driverdata); + } + SDL_free(cursor); + } +} + +/* Warp the mouse to (x,y) */ +static void +KMSDRM_WarpMouse(SDL_Window * window, int x, int y) +{ + /* Only one global/fullscreen window is supported */ + KMSDRM_WarpMouseGlobal(x, y); +} + +/* Warp the mouse to (x,y) */ +static int +KMSDRM_WarpMouseGlobal(int x, int y) +{ + KMSDRM_CursorData *curdata; + SDL_Mouse *mouse = SDL_GetMouse(); + + if (mouse != NULL && mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) { + /* Update internal mouse position. */ + SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 0, x, y); + + /* And now update the cursor graphic position on screen. */ + curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata; + if (curdata->bo != NULL) { + + if (curdata->crtc_id != 0) { + int ret, drm_fd; + drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo)); + ret = KMSDRM_drmModeMoveCursor(drm_fd, curdata->crtc_id, x, y); + + if (ret) { + SDL_SetError("drmModeMoveCursor() failed."); + } + + return ret; + } else { + return SDL_SetError("Cursor is not currently shown."); + } + } else { + return SDL_SetError("Cursor not initialized properly."); + } + } else { + return SDL_SetError("No mouse or current cursor."); + } +} + +void +KMSDRM_InitMouse(_THIS) +{ + /* FIXME: Using UDEV it should be possible to scan all mice + * but there's no point in doing so as there's no multimice support...yet! + */ + SDL_Mouse *mouse = SDL_GetMouse(); + + mouse->CreateCursor = KMSDRM_CreateCursor; + mouse->ShowCursor = KMSDRM_ShowCursor; + mouse->MoveCursor = KMSDRM_MoveCursor; + mouse->FreeCursor = KMSDRM_FreeCursor; + mouse->WarpMouse = KMSDRM_WarpMouse; + mouse->WarpMouseGlobal = KMSDRM_WarpMouseGlobal; + + SDL_SetDefaultCursor(KMSDRM_CreateDefaultCursor()); +} + +void +KMSDRM_QuitMouse(_THIS) +{ + /* TODO: ? */ +} + +/* This is called when a mouse motion event occurs */ +static void +KMSDRM_MoveCursor(SDL_Cursor * cursor) +{ + SDL_Mouse *mouse = SDL_GetMouse(); + KMSDRM_CursorData *curdata; + int drm_fd, ret; + + /* We must NOT call SDL_SendMouseMotion() here or we will enter recursivity! + That's why we move the cursor graphic ONLY. */ + if (mouse != NULL && mouse->cur_cursor != NULL && mouse->cur_cursor->driverdata != NULL) { + curdata = (KMSDRM_CursorData *) mouse->cur_cursor->driverdata; + drm_fd = KMSDRM_gbm_device_get_fd(KMSDRM_gbm_bo_get_device(curdata->bo)); + ret = KMSDRM_drmModeMoveCursor(drm_fd, curdata->crtc_id, mouse->x, mouse->y); + + if (ret) { + SDL_SetError("drmModeMoveCursor() failed."); + } + } +} + +#endif /* SDL_VIDEO_DRIVER_KMSDRM */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmmouse.h b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmmouse.h new file mode 100644 index 000000000..754417de5 --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmmouse.h @@ -0,0 +1,45 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifndef SDL_KMSDRM_mouse_h_ +#define SDL_KMSDRM_mouse_h_ + +#include + +#define MAX_CURSOR_W 512 +#define MAX_CURSOR_H 512 + +typedef struct _KMSDRM_CursorData +{ + struct gbm_bo *bo; + uint32_t crtc_id; + int hot_x, hot_y; + int w, h; +} KMSDRM_CursorData; + +extern void KMSDRM_InitMouse(_THIS); +extern void KMSDRM_QuitMouse(_THIS); + +#endif /* SDL_KMSDRM_mouse_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmopengles.c b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmopengles.c new file mode 100644 index 000000000..7a0b079ff --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmopengles.c @@ -0,0 +1,189 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_KMSDRM && SDL_VIDEO_OPENGL_EGL + +#include "SDL_log.h" + +#include "SDL_kmsdrmvideo.h" +#include "SDL_kmsdrmopengles.h" +#include "SDL_kmsdrmdyn.h" + +#ifndef EGL_PLATFORM_GBM_MESA +#define EGL_PLATFORM_GBM_MESA 0x31D7 +#endif + +/* EGL implementation of SDL OpenGL support */ + +int +KMSDRM_GLES_LoadLibrary(_THIS, const char *path) { + return SDL_EGL_LoadLibrary(_this, path, ((SDL_VideoData *)_this->driverdata)->gbm, EGL_PLATFORM_GBM_MESA); +} + +SDL_EGL_CreateContext_impl(KMSDRM) + +SDL_bool +KMSDRM_GLES_SetupCrtc(_THIS, SDL_Window * window) { + SDL_WindowData *wdata = ((SDL_WindowData *) window->driverdata); + SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata; + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + KMSDRM_FBInfo *fb_info; + + if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, wdata->egl_surface))) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed on CRTC setup"); + return SDL_FALSE; + } + + wdata->next_bo = KMSDRM_gbm_surface_lock_front_buffer(wdata->gs); + if (wdata->next_bo == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not lock GBM surface front buffer on CRTC setup"); + return SDL_FALSE; + } + + fb_info = KMSDRM_FBFromBO(_this, wdata->next_bo); + if (fb_info == NULL) { + return SDL_FALSE; + } + + if(KMSDRM_drmModeSetCrtc(vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id, + 0, 0, &vdata->saved_conn_id, 1, &displaydata->cur_mode) != 0) { + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not set up CRTC to a GBM buffer"); + return SDL_FALSE; + + } + + wdata->crtc_ready = SDL_TRUE; + return SDL_TRUE; +} + +int KMSDRM_GLES_SetSwapInterval(_THIS, int interval) { + if (!_this->egl_data) { + return SDL_SetError("EGL not initialized"); + } + + if (interval == 0 || interval == 1) { + _this->egl_data->egl_swapinterval = interval; + } else { + return SDL_SetError("Only swap intervals of 0 or 1 are supported"); + } + + return 0; +} + +int +KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window) { + SDL_WindowData *wdata = ((SDL_WindowData *) window->driverdata); + SDL_DisplayData *displaydata = (SDL_DisplayData *) SDL_GetDisplayForWindow(window)->driverdata; + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + KMSDRM_FBInfo *fb_info; + int ret; + + /* Do we still need to wait for a flip? */ + int timeout = 0; + if (_this->egl_data->egl_swapinterval == 1) { + timeout = -1; + } + if (!KMSDRM_WaitPageFlip(_this, wdata, timeout)) { + return 0; + } + + /* Release previously displayed buffer (which is now the backbuffer) and lock a new one */ + if (wdata->next_bo != NULL) { + KMSDRM_gbm_surface_release_buffer(wdata->gs, wdata->current_bo); + /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Released GBM surface %p", (void *)wdata->next_bo); */ + + wdata->current_bo = wdata->next_bo; + wdata->next_bo = NULL; + } + + if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, wdata->egl_surface))) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed."); + return 0; + } + + if (wdata->current_bo == NULL) { + wdata->current_bo = KMSDRM_gbm_surface_lock_front_buffer(wdata->gs); + if (wdata->current_bo == NULL) { + return 0; + } + } + + wdata->next_bo = KMSDRM_gbm_surface_lock_front_buffer(wdata->gs); + if (wdata->next_bo == NULL) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not lock GBM surface front buffer"); + return 0; + /* } else { + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Locked GBM surface %p", (void *)wdata->next_bo); */ + } + + fb_info = KMSDRM_FBFromBO(_this, wdata->next_bo); + if (fb_info == NULL) { + return 0; + } + if (_this->egl_data->egl_swapinterval == 0) { + /* Swap buffers instantly, possible tearing */ + /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "drmModeSetCrtc(%d, %u, %u, 0, 0, &%u, 1, &%ux%u@%u)", + vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id, vdata->saved_conn_id, + displaydata->cur_mode.hdisplay, displaydata->cur_mode.vdisplay, displaydata->cur_mode.vrefresh); */ + ret = KMSDRM_drmModeSetCrtc(vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id, + 0, 0, &vdata->saved_conn_id, 1, &displaydata->cur_mode); + if(ret != 0) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not pageflip with drmModeSetCrtc: %d", ret); + } + } else { + /* Queue page flip at vsync */ + + /* Have we already setup the CRTC to one of the GBM buffers? Do so if we have not, + or FlipPage won't work in some cases. */ + if (!wdata->crtc_ready) { + if(!KMSDRM_GLES_SetupCrtc(_this, window)) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not set up CRTC for doing vsync-ed pageflips"); + return 0; + } + } + + /* SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "drmModePageFlip(%d, %u, %u, DRM_MODE_PAGE_FLIP_EVENT, &wdata->waiting_for_flip)", + vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id); */ + ret = KMSDRM_drmModePageFlip(vdata->drm_fd, displaydata->crtc_id, fb_info->fb_id, + DRM_MODE_PAGE_FLIP_EVENT, &wdata->waiting_for_flip); + if (ret == 0) { + wdata->waiting_for_flip = SDL_TRUE; + } else { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "Could not queue pageflip: %d", ret); + } + + /* Wait immediately for vsync (as if we only had two buffers), for low input-lag scenarios. + Run your SDL2 program with "SDL_KMSDRM_DOUBLE_BUFFER=1 " to enable this. */ + if (wdata->double_buffer) { + KMSDRM_WaitPageFlip(_this, wdata, -1); + } + } + + return 0; +} + +SDL_EGL_MakeCurrent_impl(KMSDRM) + +#endif /* SDL_VIDEO_DRIVER_KMSDRM && SDL_VIDEO_OPENGL_EGL */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmopengles.h b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmopengles.h new file mode 100644 index 000000000..d0a7bfaf8 --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmopengles.h @@ -0,0 +1,48 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_kmsdrmopengles_h_ +#define SDL_kmsdrmopengles_h_ + +#if SDL_VIDEO_DRIVER_KMSDRM && SDL_VIDEO_OPENGL_EGL + +#include "../SDL_sysvideo.h" +#include "../SDL_egl_c.h" + +/* OpenGLES functions */ +#define KMSDRM_GLES_GetAttribute SDL_EGL_GetAttribute +#define KMSDRM_GLES_GetProcAddress SDL_EGL_GetProcAddress +#define KMSDRM_GLES_UnloadLibrary SDL_EGL_UnloadLibrary +#define KMSDRM_GLES_DeleteContext SDL_EGL_DeleteContext +#define KMSDRM_GLES_GetSwapInterval SDL_EGL_GetSwapInterval + +extern int KMSDRM_GLES_SetSwapInterval(_THIS, int interval); +extern int KMSDRM_GLES_LoadLibrary(_THIS, const char *path); +extern SDL_GLContext KMSDRM_GLES_CreateContext(_THIS, SDL_Window * window); +extern int KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int KMSDRM_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); + +#endif /* SDL_VIDEO_DRIVER_KMSDRM && SDL_VIDEO_OPENGL_EGL */ + +#endif /* SDL_kmsdrmopengles_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmsym.h b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmsym.h new file mode 100644 index 000000000..3ab231896 --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmsym.h @@ -0,0 +1,99 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* *INDENT-OFF* */ + +#ifndef SDL_KMSDRM_MODULE +#define SDL_KMSDRM_MODULE(modname) +#endif + +#ifndef SDL_KMSDRM_SYM +#define SDL_KMSDRM_SYM(rc,fn,params) +#endif + +#ifndef SDL_KMSDRM_SYM_CONST +#define SDL_KMSDRM_SYM_CONST(type, name) +#endif + + +SDL_KMSDRM_MODULE(LIBDRM) +SDL_KMSDRM_SYM(void,drmModeFreeResources,(drmModeResPtr ptr)) +SDL_KMSDRM_SYM(void,drmModeFreeFB,(drmModeFBPtr ptr)) +SDL_KMSDRM_SYM(void,drmModeFreeCrtc,(drmModeCrtcPtr ptr)) +SDL_KMSDRM_SYM(void,drmModeFreeConnector,(drmModeConnectorPtr ptr)) +SDL_KMSDRM_SYM(void,drmModeFreeEncoder,(drmModeEncoderPtr ptr)) +SDL_KMSDRM_SYM(drmModeResPtr,drmModeGetResources,(int fd)) +SDL_KMSDRM_SYM(int,drmModeAddFB,(int fd, uint32_t width, uint32_t height, uint8_t depth, + uint8_t bpp, uint32_t pitch, uint32_t bo_handle, + uint32_t *buf_id)) +SDL_KMSDRM_SYM(int,drmModeRmFB,(int fd, uint32_t bufferId)) +SDL_KMSDRM_SYM(drmModeFBPtr,drmModeGetFB,(int fd, uint32_t buf)) +SDL_KMSDRM_SYM(drmModeCrtcPtr,drmModeGetCrtc,(int fd, uint32_t crtcId)) +SDL_KMSDRM_SYM(int,drmModeSetCrtc,(int fd, uint32_t crtcId, uint32_t bufferId, + uint32_t x, uint32_t y, uint32_t *connectors, int count, + drmModeModeInfoPtr mode)) +SDL_KMSDRM_SYM(int,drmModeSetCursor,(int fd, uint32_t crtcId, uint32_t bo_handle, + uint32_t width, uint32_t height)) +SDL_KMSDRM_SYM(int,drmModeSetCursor2,(int fd, uint32_t crtcId, uint32_t bo_handle, + uint32_t width, uint32_t height, + int32_t hot_x, int32_t hot_y)) +SDL_KMSDRM_SYM(int,drmModeMoveCursor,(int fd, uint32_t crtcId, int x, int y)) +SDL_KMSDRM_SYM(drmModeEncoderPtr,drmModeGetEncoder,(int fd, uint32_t encoder_id)) +SDL_KMSDRM_SYM(drmModeConnectorPtr,drmModeGetConnector,(int fd, uint32_t connector_id)) +SDL_KMSDRM_SYM(int,drmHandleEvent,(int fd,drmEventContextPtr evctx)) +SDL_KMSDRM_SYM(int,drmModePageFlip,(int fd, uint32_t crtc_id, uint32_t fb_id, + uint32_t flags, void *user_data)) + + +SDL_KMSDRM_MODULE(GBM) +SDL_KMSDRM_SYM(int,gbm_device_get_fd,(struct gbm_device *gbm)) +SDL_KMSDRM_SYM(int,gbm_device_is_format_supported,(struct gbm_device *gbm, + uint32_t format, uint32_t usage)) +SDL_KMSDRM_SYM(void,gbm_device_destroy,(struct gbm_device *gbm)) +SDL_KMSDRM_SYM(struct gbm_device *,gbm_create_device,(int fd)) +SDL_KMSDRM_SYM(unsigned int,gbm_bo_get_width,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(unsigned int,gbm_bo_get_height,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(uint32_t,gbm_bo_get_stride,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(union gbm_bo_handle,gbm_bo_get_handle,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(int,gbm_bo_write,(struct gbm_bo *bo, const void *buf, size_t count)) +SDL_KMSDRM_SYM(struct gbm_device *,gbm_bo_get_device,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(void,gbm_bo_set_user_data,(struct gbm_bo *bo, void *data, + void (*destroy_user_data)(struct gbm_bo *, void *))) +SDL_KMSDRM_SYM(void *,gbm_bo_get_user_data,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(void,gbm_bo_destroy,(struct gbm_bo *bo)) +SDL_KMSDRM_SYM(struct gbm_bo *,gbm_bo_create,(struct gbm_device *gbm, + uint32_t width, uint32_t height, + uint32_t format, uint32_t usage)) +SDL_KMSDRM_SYM(struct gbm_surface *,gbm_surface_create,(struct gbm_device *gbm, + uint32_t width, uint32_t height, + uint32_t format, uint32_t flags)) +SDL_KMSDRM_SYM(void,gbm_surface_destroy,(struct gbm_surface *surf)) +SDL_KMSDRM_SYM(struct gbm_bo *,gbm_surface_lock_front_buffer,(struct gbm_surface *surf)) +SDL_KMSDRM_SYM(void,gbm_surface_release_buffer,(struct gbm_surface *surf, struct gbm_bo *bo)) + + +#undef SDL_KMSDRM_MODULE +#undef SDL_KMSDRM_SYM +#undef SDL_KMSDRM_SYM_CONST + +/* *INDENT-ON* */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmvideo.c b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmvideo.c new file mode 100644 index 000000000..7855eeddb --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -0,0 +1,664 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_KMSDRM + +/* SDL internals */ +#include "../SDL_sysvideo.h" +#include "SDL_syswm.h" +#include "SDL_log.h" +#include "SDL_hints.h" +#include "../../events/SDL_mouse_c.h" +#include "../../events/SDL_keyboard_c.h" + +#ifdef SDL_INPUT_LINUXEV +#include "../../core/linux/SDL_evdev.h" +#endif + +/* KMS/DRM declarations */ +#include "SDL_kmsdrmvideo.h" +#include "SDL_kmsdrmevents.h" +#include "SDL_kmsdrmopengles.h" +#include "SDL_kmsdrmmouse.h" +#include "SDL_kmsdrmdyn.h" + +#define KMSDRM_DRI_CARD_0 "/dev/dri/card0" + +static int +KMSDRM_Available(void) +{ + int available = 0; + + int drm_fd = open(KMSDRM_DRI_CARD_0, O_RDWR | O_CLOEXEC); + if (drm_fd >= 0) { + if (SDL_KMSDRM_LoadSymbols()) { + drmModeRes *resources = KMSDRM_drmModeGetResources(drm_fd); + if (resources != NULL) { + available = 1; + KMSDRM_drmModeFreeResources(resources); + } + SDL_KMSDRM_UnloadSymbols(); + } + close(drm_fd); + } + + return available; +} + +static void +KMSDRM_Destroy(SDL_VideoDevice * device) +{ + if (device->driverdata != NULL) { + SDL_free(device->driverdata); + device->driverdata = NULL; + } + + SDL_free(device); + SDL_KMSDRM_UnloadSymbols(); +} + +static SDL_VideoDevice * +KMSDRM_Create(int devindex) +{ + SDL_VideoDevice *device; + SDL_VideoData *vdata; + + if (devindex < 0 || devindex > 99) { + SDL_SetError("devindex (%d) must be between 0 and 99.\n", devindex); + return NULL; + } + + if (!SDL_KMSDRM_LoadSymbols()) { + return NULL; + } + + /* Initialize SDL_VideoDevice structure */ + device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice)); + if (device == NULL) { + SDL_OutOfMemory(); + return NULL; + } + + /* Initialize internal data */ + vdata = (SDL_VideoData *) SDL_calloc(1, sizeof(SDL_VideoData)); + if (vdata == NULL) { + SDL_OutOfMemory(); + goto cleanup; + } + vdata->devindex = devindex; + vdata->drm_fd = -1; + + device->driverdata = vdata; + + /* Setup amount of available displays and current display */ + device->num_displays = 0; + + /* Set device free function */ + device->free = KMSDRM_Destroy; + + /* Setup all functions which we can handle */ + device->VideoInit = KMSDRM_VideoInit; + device->VideoQuit = KMSDRM_VideoQuit; + device->GetDisplayModes = KMSDRM_GetDisplayModes; + device->SetDisplayMode = KMSDRM_SetDisplayMode; + device->CreateSDLWindow = KMSDRM_CreateWindow; + device->CreateSDLWindowFrom = KMSDRM_CreateWindowFrom; + device->SetWindowTitle = KMSDRM_SetWindowTitle; + device->SetWindowIcon = KMSDRM_SetWindowIcon; + device->SetWindowPosition = KMSDRM_SetWindowPosition; + device->SetWindowSize = KMSDRM_SetWindowSize; + device->ShowWindow = KMSDRM_ShowWindow; + device->HideWindow = KMSDRM_HideWindow; + device->RaiseWindow = KMSDRM_RaiseWindow; + device->MaximizeWindow = KMSDRM_MaximizeWindow; + device->MinimizeWindow = KMSDRM_MinimizeWindow; + device->RestoreWindow = KMSDRM_RestoreWindow; + device->SetWindowGrab = KMSDRM_SetWindowGrab; + device->DestroyWindow = KMSDRM_DestroyWindow; + device->GetWindowWMInfo = KMSDRM_GetWindowWMInfo; +#if SDL_VIDEO_OPENGL_EGL + device->GL_LoadLibrary = KMSDRM_GLES_LoadLibrary; + device->GL_GetProcAddress = KMSDRM_GLES_GetProcAddress; + device->GL_UnloadLibrary = KMSDRM_GLES_UnloadLibrary; + device->GL_CreateContext = KMSDRM_GLES_CreateContext; + device->GL_MakeCurrent = KMSDRM_GLES_MakeCurrent; + device->GL_SetSwapInterval = KMSDRM_GLES_SetSwapInterval; + device->GL_GetSwapInterval = KMSDRM_GLES_GetSwapInterval; + device->GL_SwapWindow = KMSDRM_GLES_SwapWindow; + device->GL_DeleteContext = KMSDRM_GLES_DeleteContext; +#endif + + device->PumpEvents = KMSDRM_PumpEvents; + + return device; + +cleanup: + if (device != NULL) + SDL_free(device); + if (vdata != NULL) + SDL_free(vdata); + return NULL; +} + +VideoBootStrap KMSDRM_bootstrap = { + "KMSDRM", + "KMS/DRM Video Driver", + KMSDRM_Available, + KMSDRM_Create +}; + + +static void +KMSDRM_FBDestroyCallback(struct gbm_bo *bo, void *data) +{ + KMSDRM_FBInfo *fb_info = (KMSDRM_FBInfo *)data; + + if (fb_info && fb_info->drm_fd > 0 && fb_info->fb_id != 0) { + KMSDRM_drmModeRmFB(fb_info->drm_fd, fb_info->fb_id); + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Delete DRM FB %u", fb_info->fb_id); + } + + free(fb_info); +} + +KMSDRM_FBInfo * +KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo) +{ + uint32_t w, h, stride, handle; + int ret; + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + KMSDRM_FBInfo *fb_info; + + fb_info = (KMSDRM_FBInfo *)KMSDRM_gbm_bo_get_user_data(bo); + if (fb_info != NULL) { + /* Have a previously used framebuffer, return it */ + return fb_info; + } + + /* Here a new DRM FB must be created */ + fb_info = (KMSDRM_FBInfo *)SDL_calloc(1, sizeof(KMSDRM_FBInfo)); + if (fb_info == NULL) { + SDL_OutOfMemory(); + return NULL; + } + fb_info->drm_fd = vdata->drm_fd; + + w = KMSDRM_gbm_bo_get_width(bo); + h = KMSDRM_gbm_bo_get_height(bo); + stride = KMSDRM_gbm_bo_get_stride(bo); + handle = KMSDRM_gbm_bo_get_handle(bo).u32; + + ret = KMSDRM_drmModeAddFB(vdata->drm_fd, w, h, 24, 32, stride, handle, &fb_info->fb_id); + if (ret < 0) { + free(fb_info); + return NULL; + } + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "New DRM FB (%u): %ux%u, stride %u from BO %p", fb_info->fb_id, w, h, stride, (void *)bo); + + /* Associate our DRM framebuffer with this buffer object */ + KMSDRM_gbm_bo_set_user_data(bo, fb_info, KMSDRM_FBDestroyCallback); + return fb_info; +} + +SDL_bool +KMSDRM_WaitPageFlip(_THIS, SDL_WindowData *wdata, int timeout) { + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + + while (wdata->waiting_for_flip) { + vdata->drm_pollfd.revents = 0; + if (poll(&vdata->drm_pollfd, 1, timeout) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "DRM poll error"); + return SDL_FALSE; + } + + if (vdata->drm_pollfd.revents & (POLLHUP | POLLERR)) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "DRM poll hup or error"); + return SDL_FALSE; + } + + if (vdata->drm_pollfd.revents & POLLIN) { + /* Page flip? If so, drmHandleEvent will unset wdata->waiting_for_flip */ + KMSDRM_drmHandleEvent(vdata->drm_fd, &vdata->drm_evctx); + } else { + /* Timed out and page flip didn't happen */ + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Dropping frame while waiting_for_flip"); + return SDL_FALSE; + } + } + return SDL_TRUE; +} + +static void +KMSDRM_FlipHandler(int fd, unsigned int frame, unsigned int sec, unsigned int usec, void *data) +{ + *((SDL_bool *) data) = SDL_FALSE; +} + + +/*****************************************************************************/ +/* SDL Video and Display initialization/handling functions */ +/* _this is a SDL_VideoDevice * */ +/*****************************************************************************/ +int +KMSDRM_VideoInit(_THIS) +{ + int i; + int ret = 0; + char *devname; + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + drmModeRes *resources = NULL; + drmModeConnector *connector = NULL; + drmModeEncoder *encoder = NULL; + SDL_DisplayMode current_mode; + SDL_VideoDisplay display; + + /* Allocate display internal data */ + SDL_DisplayData *data = (SDL_DisplayData *) SDL_calloc(1, sizeof(SDL_DisplayData)); + if (data == NULL) { + return SDL_OutOfMemory(); + } + + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "KMSDRM_VideoInit()"); + + /* Open /dev/dri/cardNN */ + devname = (char *) SDL_calloc(1, 16); + if (devname == NULL) { + ret = SDL_OutOfMemory(); + goto cleanup; + } + SDL_snprintf(devname, 16, "/dev/dri/card%d", vdata->devindex); + vdata->drm_fd = open(devname, O_RDWR | O_CLOEXEC); + SDL_free(devname); + + if (vdata->drm_fd < 0) { + ret = SDL_SetError("Could not open /dev/dri/card%d.", vdata->devindex); + goto cleanup; + } + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Opened DRM FD (%d)", vdata->drm_fd); + + vdata->gbm = KMSDRM_gbm_create_device(vdata->drm_fd); + if (vdata->gbm == NULL) { + ret = SDL_SetError("Couldn't create gbm device."); + goto cleanup; + } + + /* Find the first available connector with modes */ + resources = KMSDRM_drmModeGetResources(vdata->drm_fd); + if (!resources) { + ret = SDL_SetError("drmModeGetResources(%d) failed", vdata->drm_fd); + goto cleanup; + } + + for (i = 0; i < resources->count_connectors; i++) { + connector = KMSDRM_drmModeGetConnector(vdata->drm_fd, resources->connectors[i]); + if (connector == NULL) + continue; + + if (connector->connection == DRM_MODE_CONNECTED && + connector->count_modes > 0) { + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Found connector %d with %d modes.", + connector->connector_id, connector->count_modes); + vdata->saved_conn_id = connector->connector_id; + break; + } + + KMSDRM_drmModeFreeConnector(connector); + connector = NULL; + } + + if (i == resources->count_connectors) { + ret = SDL_SetError("No currently active connector found."); + goto cleanup; + } + + for (i = 0; i < resources->count_encoders; i++) { + encoder = KMSDRM_drmModeGetEncoder(vdata->drm_fd, resources->encoders[i]); + + if (encoder == NULL) + continue; + + if (encoder->encoder_id == connector->encoder_id) { + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Found encoder %d.", encoder->encoder_id); + data->encoder_id = encoder->encoder_id; + break; + } + + KMSDRM_drmModeFreeEncoder(encoder); + encoder = NULL; + } + + if (i == resources->count_encoders) { + ret = SDL_SetError("No connected encoder found."); + goto cleanup; + } + + vdata->saved_crtc = KMSDRM_drmModeGetCrtc(vdata->drm_fd, encoder->crtc_id); + if (vdata->saved_crtc == NULL) { + ret = SDL_SetError("No CRTC found."); + goto cleanup; + } + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Saved crtc_id %u, fb_id %u, (%u,%u), %ux%u", + vdata->saved_crtc->crtc_id, vdata->saved_crtc->buffer_id, vdata->saved_crtc->x, + vdata->saved_crtc->y, vdata->saved_crtc->width, vdata->saved_crtc->height); + data->crtc_id = encoder->crtc_id; + data->cur_mode = vdata->saved_crtc->mode; + vdata->crtc_id = encoder->crtc_id; + + SDL_zero(current_mode); + + current_mode.w = vdata->saved_crtc->mode.hdisplay; + current_mode.h = vdata->saved_crtc->mode.vdisplay; + current_mode.refresh_rate = vdata->saved_crtc->mode.vrefresh; + + /* FIXME ? + drmModeFB *fb = drmModeGetFB(vdata->drm_fd, vdata->saved_crtc->buffer_id); + current_mode.format = drmToSDLPixelFormat(fb->bpp, fb->depth); + drmModeFreeFB(fb); + */ + current_mode.format = SDL_PIXELFORMAT_ARGB8888; + + current_mode.driverdata = NULL; + + SDL_zero(display); + display.desktop_mode = current_mode; + display.current_mode = current_mode; + + display.driverdata = data; + /* SDL_VideoQuit will later SDL_free(display.driverdata) */ + SDL_AddVideoDisplay(&display); + + /* Setup page flip handler */ + vdata->drm_pollfd.fd = vdata->drm_fd; + vdata->drm_pollfd.events = POLLIN; + vdata->drm_evctx.version = DRM_EVENT_CONTEXT_VERSION; + vdata->drm_evctx.page_flip_handler = KMSDRM_FlipHandler; + +#ifdef SDL_INPUT_LINUXEV + SDL_EVDEV_Init(); +#endif + + KMSDRM_InitMouse(_this); + +cleanup: + if (encoder != NULL) + KMSDRM_drmModeFreeEncoder(encoder); + if (connector != NULL) + KMSDRM_drmModeFreeConnector(connector); + if (resources != NULL) + KMSDRM_drmModeFreeResources(resources); + + if (ret != 0) { + /* Error (complete) cleanup */ + SDL_free(data); + if(vdata->saved_crtc != NULL) { + KMSDRM_drmModeFreeCrtc(vdata->saved_crtc); + vdata->saved_crtc = NULL; + } + if (vdata->gbm != NULL) { + KMSDRM_gbm_device_destroy(vdata->gbm); + vdata->gbm = NULL; + } + if (vdata->drm_fd >= 0) { + close(vdata->drm_fd); + vdata->drm_fd = -1; + } + } + return ret; +} + +void +KMSDRM_VideoQuit(_THIS) +{ + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "KMSDRM_VideoQuit()"); + + if (_this->gl_config.driver_loaded) { + SDL_GL_UnloadLibrary(); + } + + if(vdata->saved_crtc != NULL) { + if(vdata->drm_fd > 0 && vdata->saved_conn_id > 0) { + /* Restore saved CRTC settings */ + drmModeCrtc *crtc = vdata->saved_crtc; + if(KMSDRM_drmModeSetCrtc(vdata->drm_fd, crtc->crtc_id, crtc->buffer_id, + crtc->x, crtc->y, &vdata->saved_conn_id, 1, + &crtc->mode) != 0) { + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Could not restore original CRTC mode"); + } + } + KMSDRM_drmModeFreeCrtc(vdata->saved_crtc); + vdata->saved_crtc = NULL; + } + if (vdata->gbm != NULL) { + KMSDRM_gbm_device_destroy(vdata->gbm); + vdata->gbm = NULL; + } + if (vdata->drm_fd >= 0) { + close(vdata->drm_fd); + SDL_LogDebug(SDL_LOG_CATEGORY_VIDEO, "Closed DRM FD %d", vdata->drm_fd); + vdata->drm_fd = -1; + } +#ifdef SDL_INPUT_LINUXEV + SDL_EVDEV_Quit(); +#endif +} + +void +KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay * display) +{ + /* Only one display mode available, the current one */ + SDL_AddDisplayMode(display, &display->current_mode); +} + +int +KMSDRM_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) +{ + return 0; +} + +int +KMSDRM_CreateWindow(_THIS, SDL_Window * window) +{ + SDL_WindowData *wdata; + SDL_VideoDisplay *display; + SDL_VideoData *vdata = ((SDL_VideoData *)_this->driverdata); + Uint32 surface_fmt, surface_flags; + + /* Allocate window internal data */ + wdata = (SDL_WindowData *) SDL_calloc(1, sizeof(SDL_WindowData)); + if (wdata == NULL) { + SDL_OutOfMemory(); + goto error; + } + + wdata->waiting_for_flip = SDL_FALSE; + display = SDL_GetDisplayForWindow(window); + + /* Windows have one size for now */ + window->w = display->desktop_mode.w; + window->h = display->desktop_mode.h; + + /* Maybe you didn't ask for a fullscreen OpenGL window, but that's what you get */ + window->flags |= (SDL_WINDOW_FULLSCREEN | SDL_WINDOW_OPENGL); + + surface_fmt = GBM_FORMAT_XRGB8888; + surface_flags = GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING; + + if (!KMSDRM_gbm_device_is_format_supported(vdata->gbm, surface_fmt, surface_flags)) { + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "GBM surface format not supported. Trying anyway."); + } + wdata->gs = KMSDRM_gbm_surface_create(vdata->gbm, window->w, window->h, surface_fmt, surface_flags); + +#if SDL_VIDEO_OPENGL_EGL + if (!_this->egl_data) { + if (SDL_GL_LoadLibrary(NULL) < 0) { + goto error; + } + } + wdata->egl_surface = SDL_EGL_CreateSurface(_this, (NativeWindowType) wdata->gs); + + if (wdata->egl_surface == EGL_NO_SURFACE) { + SDL_SetError("Could not create EGL window surface"); + goto error; + } +#endif /* SDL_VIDEO_OPENGL_EGL */ + + /* In case we want low-latency, double-buffer video, we take note here */ + wdata->double_buffer = SDL_FALSE; + if (SDL_GetHintBoolean(SDL_HINT_VIDEO_DOUBLE_BUFFER, SDL_FALSE)) { + wdata->double_buffer = SDL_TRUE; + } + + /* Window is created, but we have yet to set up CRTC to one of the GBM buffers if we want + drmModePageFlip to work, and we can't do it until EGL is completely setup, because we + need to do eglSwapBuffers so we can get a valid GBM buffer object to call + drmModeSetCrtc on it. */ + wdata->crtc_ready = SDL_FALSE; + + /* Setup driver data for this window */ + window->driverdata = wdata; + + /* One window, it always has focus */ + SDL_SetMouseFocus(window); + SDL_SetKeyboardFocus(window); + + /* Window has been successfully created */ + return 0; + +error: + if (wdata != NULL) { +#if SDL_VIDEO_OPENGL_EGL + if (wdata->egl_surface != EGL_NO_SURFACE) + SDL_EGL_DestroySurface(_this, wdata->egl_surface); +#endif /* SDL_VIDEO_OPENGL_EGL */ + if (wdata->gs != NULL) + KMSDRM_gbm_surface_destroy(wdata->gs); + SDL_free(wdata); + } + return -1; +} + +void +KMSDRM_DestroyWindow(_THIS, SDL_Window * window) +{ + SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + if(data) { + /* Wait for any pending page flips and unlock buffer */ + KMSDRM_WaitPageFlip(_this, data, -1); + if (data->next_bo != NULL) { + KMSDRM_gbm_surface_release_buffer(data->gs, data->next_bo); + data->next_bo = NULL; + } + if (data->current_bo != NULL) { + KMSDRM_gbm_surface_release_buffer(data->gs, data->current_bo); + data->current_bo = NULL; + } +#if SDL_VIDEO_OPENGL_EGL + SDL_EGL_MakeCurrent(_this, EGL_NO_SURFACE, EGL_NO_CONTEXT); + if (data->egl_surface != EGL_NO_SURFACE) { + SDL_EGL_DestroySurface(_this, data->egl_surface); + } +#endif /* SDL_VIDEO_OPENGL_EGL */ + if (data->gs != NULL) { + KMSDRM_gbm_surface_destroy(data->gs); + data->gs = NULL; + } + SDL_free(data); + window->driverdata = NULL; + } +} + +int +KMSDRM_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) +{ + return -1; +} + +void +KMSDRM_SetWindowTitle(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) +{ +} +void +KMSDRM_SetWindowPosition(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_SetWindowSize(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_ShowWindow(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_HideWindow(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_RaiseWindow(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_MaximizeWindow(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_MinimizeWindow(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_RestoreWindow(_THIS, SDL_Window * window) +{ +} +void +KMSDRM_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) +{ + +} + +/*****************************************************************************/ +/* SDL Window Manager function */ +/*****************************************************************************/ +SDL_bool +KMSDRM_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) +{ + if (info->version.major <= SDL_MAJOR_VERSION) { + return SDL_TRUE; + } else { + SDL_SetError("application not compiled with SDL %d.%d\n", + SDL_MAJOR_VERSION, SDL_MINOR_VERSION); + return SDL_FALSE; + } + + /* Failed to get window manager information */ + return SDL_FALSE; +} + +#endif /* SDL_VIDEO_DRIVER_KMSDRM */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmvideo.h b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmvideo.h new file mode 100644 index 000000000..5f00f0ebc --- /dev/null +++ b/Engine/lib/sdl/src/video/kmsdrm/SDL_kmsdrmvideo.h @@ -0,0 +1,124 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifndef __SDL_KMSDRMVIDEO_H__ +#define __SDL_KMSDRMVIDEO_H__ + +#include "../SDL_sysvideo.h" + +#include +#include +#include +#include +#include +#include +#if SDL_VIDEO_OPENGL_EGL +#include +#endif + +typedef struct SDL_VideoData +{ + int devindex; /* device index that was passed on creation */ + int drm_fd; /* DRM file desc */ + struct gbm_device *gbm; + drmEventContext drm_evctx; /* DRM event context */ + struct pollfd drm_pollfd; /* pollfd containing DRM file desc */ + drmModeCrtc *saved_crtc; /* Saved CRTC to restore on quit */ + uint32_t saved_conn_id; /* Saved DRM connector ID */ + uint32_t crtc_id; /* CRTC in use */ +} SDL_VideoData; + + +typedef struct SDL_DisplayData +{ + uint32_t encoder_id; + uint32_t crtc_id; + drmModeModeInfo cur_mode; +} SDL_DisplayData; + + +typedef struct SDL_WindowData +{ + struct gbm_surface *gs; + struct gbm_bo *current_bo; + struct gbm_bo *next_bo; + SDL_bool waiting_for_flip; + SDL_bool crtc_ready; + SDL_bool double_buffer; +#if SDL_VIDEO_OPENGL_EGL + EGLSurface egl_surface; +#endif +} SDL_WindowData; + +typedef struct KMSDRM_FBInfo +{ + int drm_fd; /* DRM file desc */ + uint32_t fb_id; /* DRM framebuffer ID */ +} KMSDRM_FBInfo; + +/* Helper functions */ +KMSDRM_FBInfo *KMSDRM_FBFromBO(_THIS, struct gbm_bo *bo); +SDL_bool KMSDRM_WaitPageFlip(_THIS, SDL_WindowData *wdata, int timeout); + +/****************************************************************************/ +/* SDL_VideoDevice functions declaration */ +/****************************************************************************/ + +/* Display and window functions */ +int KMSDRM_VideoInit(_THIS); +void KMSDRM_VideoQuit(_THIS); +void KMSDRM_GetDisplayModes(_THIS, SDL_VideoDisplay * display); +int KMSDRM_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); +int KMSDRM_CreateWindow(_THIS, SDL_Window * window); +int KMSDRM_CreateWindowFrom(_THIS, SDL_Window * window, const void *data); +void KMSDRM_SetWindowTitle(_THIS, SDL_Window * window); +void KMSDRM_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); +void KMSDRM_SetWindowPosition(_THIS, SDL_Window * window); +void KMSDRM_SetWindowSize(_THIS, SDL_Window * window); +void KMSDRM_ShowWindow(_THIS, SDL_Window * window); +void KMSDRM_HideWindow(_THIS, SDL_Window * window); +void KMSDRM_RaiseWindow(_THIS, SDL_Window * window); +void KMSDRM_MaximizeWindow(_THIS, SDL_Window * window); +void KMSDRM_MinimizeWindow(_THIS, SDL_Window * window); +void KMSDRM_RestoreWindow(_THIS, SDL_Window * window); +void KMSDRM_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed); +void KMSDRM_DestroyWindow(_THIS, SDL_Window * window); + +/* Window manager function */ +SDL_bool KMSDRM_GetWindowWMInfo(_THIS, SDL_Window * window, + struct SDL_SysWMinfo *info); + +/* OpenGL/OpenGL ES functions */ +int KMSDRM_GLES_LoadLibrary(_THIS, const char *path); +void *KMSDRM_GLES_GetProcAddress(_THIS, const char *proc); +void KMSDRM_GLES_UnloadLibrary(_THIS); +SDL_GLContext KMSDRM_GLES_CreateContext(_THIS, SDL_Window * window); +int KMSDRM_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +int KMSDRM_GLES_SetSwapInterval(_THIS, int interval); +int KMSDRM_GLES_GetSwapInterval(_THIS); +int KMSDRM_GLES_SwapWindow(_THIS, SDL_Window * window); +void KMSDRM_GLES_DeleteContext(_THIS, SDL_GLContext context); + +#endif /* __SDL_KMSDRMVIDEO_H__ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirdyn.c b/Engine/lib/sdl/src/video/mir/SDL_mirdyn.c index 6bbe53759..71dc73c8b 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirdyn.c +++ b/Engine/lib/sdl/src/video/mir/SDL_mirdyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirdyn.h b/Engine/lib/sdl/src/video/mir/SDL_mirdyn.h index a3638cf05..32364aaf0 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirdyn.h +++ b/Engine/lib/sdl/src/video/mir/SDL_mirdyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_mirdyn_h -#define _SDL_mirdyn_h +#ifndef SDL_mirdyn_h_ +#define SDL_mirdyn_h_ #include "../../SDL_internal.h" @@ -48,6 +48,6 @@ void SDL_MIR_UnloadSymbols(void); } #endif -#endif /* !defined _SDL_mirdyn_h */ +#endif /* !defined SDL_mirdyn_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirevents.c b/Engine/lib/sdl/src/video/mir/SDL_mirevents.c index e36986835..df92799f3 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirevents.c +++ b/Engine/lib/sdl/src/video/mir/SDL_mirevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -141,7 +141,7 @@ HandleTouchMotion(int device_id, int source_id, float x, float y, float pressure } static void -HandleMouseScroll(SDL_Window* sdl_window, int hscroll, int vscroll) +HandleMouseScroll(SDL_Window* sdl_window, float hscroll, float vscroll) { SDL_SendMouseWheel(sdl_window, 0, hscroll, vscroll, SDL_MOUSEWHEEL_NORMAL); } @@ -205,7 +205,7 @@ HandleMouseEvent(MirPointerEvent const* pointer, SDL_Window* sdl_window) break; case mir_pointer_action_motion: { int x, y; - int hscroll, vscroll; + float hscroll, vscroll; SDL_Mouse* mouse = SDL_GetMouse(); x = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_x); y = MIR_mir_pointer_event_axis_value(pointer, mir_pointer_axis_y); @@ -237,7 +237,7 @@ HandleMouseEvent(MirPointerEvent const* pointer, SDL_Window* sdl_window) } static void -MIR_HandleInput(MirInputEvent const* input_event, SDL_Window* window) +HandleInput(MirInputEvent const* input_event, SDL_Window* window) { switch (MIR_mir_input_event_get_type(input_event)) { case (mir_input_event_type_key): @@ -257,7 +257,7 @@ MIR_HandleInput(MirInputEvent const* input_event, SDL_Window* window) } static void -MIR_HandleResize(MirResizeEvent const* resize_event, SDL_Window* window) +HandleResize(MirResizeEvent const* resize_event, SDL_Window* window) { int new_w = MIR_mir_resize_event_get_width (resize_event); int new_h = MIR_mir_resize_event_get_height(resize_event); @@ -270,23 +270,28 @@ MIR_HandleResize(MirResizeEvent const* resize_event, SDL_Window* window) } static void -MIR_HandleSurface(MirSurfaceEvent const* surface_event, SDL_Window* window) +HandleWindow(MirWindowEvent const* event, SDL_Window* window) { - MirSurfaceAttrib attrib = MIR_mir_surface_event_get_attribute(surface_event); - int value = MIR_mir_surface_event_get_attribute_value(surface_event); + MirWindowAttrib attrib = MIR_mir_window_event_get_attribute(event); + int value = MIR_mir_window_event_get_attribute_value(event); - if (attrib == mir_surface_attrib_focus) { - if (value == mir_surface_focused) { + if (attrib == mir_window_attrib_focus) { + if (value == mir_window_focus_state_focused) { SDL_SetKeyboardFocus(window); } - else if (value == mir_surface_unfocused) { + else if (value == mir_window_focus_state_unfocused) { SDL_SetKeyboardFocus(NULL); } } } +static void +MIR_HandleClose(SDL_Window* window) { + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_CLOSE, 0, 0); +} + void -MIR_HandleEvent(MirSurface* surface, MirEvent const* ev, void* context) +MIR_HandleEvent(MirWindow* mirwindow, MirEvent const* ev, void* context) { MirEventType event_type = MIR_mir_event_get_type(ev); SDL_Window* window = (SDL_Window*)context; @@ -294,13 +299,16 @@ MIR_HandleEvent(MirSurface* surface, MirEvent const* ev, void* context) if (window) { switch (event_type) { case (mir_event_type_input): - MIR_HandleInput(MIR_mir_event_get_input_event(ev), window); + HandleInput(MIR_mir_event_get_input_event(ev), window); break; case (mir_event_type_resize): - MIR_HandleResize(MIR_mir_event_get_resize_event(ev), window); + HandleResize(MIR_mir_event_get_resize_event(ev), window); break; - case (mir_event_type_surface): - MIR_HandleSurface(MIR_mir_event_get_surface_event(ev), window); + case (mir_event_type_window): + HandleWindow(MIR_mir_event_get_window_event(ev), window); + break; + case (mir_event_type_close_window): + MIR_HandleClose(window); break; default: break; diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirevents.h b/Engine/lib/sdl/src/video/mir/SDL_mirevents.h index 121c4b365..4b0f209cd 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirevents.h +++ b/Engine/lib/sdl/src/video/mir/SDL_mirevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,15 +23,15 @@ Contributed by Brandon Schaefer, */ -#ifndef _SDL_mirevents_h -#define _SDL_mirevents_h +#ifndef SDL_mirevents_h_ +#define SDL_mirevents_h_ #include extern void -MIR_HandleEvent(MirSurface* surface, MirEvent const* ev, void* context); +MIR_HandleEvent(MirWindow*, MirEvent const* ev, void* context); -#endif /* _SDL_mirevents_h */ +#endif /* SDL_mirevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.c b/Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.c index 775bc0797..d678fff1f 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.c +++ b/Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,7 +42,7 @@ MIR_CreateWindowFramebuffer(_THIS, SDL_Window* window, Uint32* format, mir_data->software = SDL_TRUE; if (MIR_CreateWindow(_this, window) < 0) - return SDL_SetError("Failed to created a mir window."); + return SDL_SetError("Failed to create a mir window."); *format = MIR_GetSDLPixelFormat(mir_data->pixel_format); if (*format == SDL_PIXELFORMAT_UNKNOWN) @@ -70,7 +70,7 @@ MIR_UpdateWindowFramebuffer(_THIS, SDL_Window* window, char* s_dest; char* pixels; - bs = MIR_mir_surface_get_buffer_stream(mir_window->surface); + bs = MIR_mir_window_get_buffer_stream(mir_window->window); MIR_mir_buffer_stream_get_graphics_region(bs, ®ion); s_dest = region.vaddr; diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.h b/Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.h index 22a579c03..502337c32 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.h +++ b/Engine/lib/sdl/src/video/mir/SDL_mirframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,8 +23,8 @@ Contributed by Brandon Schaefer, */ -#ifndef _SDL_mirframebuffer_h -#define _SDL_mirframebuffer_h +#ifndef SDL_mirframebuffer_h_ +#define SDL_mirframebuffer_h_ #include "../SDL_sysvideo.h" @@ -41,7 +41,7 @@ MIR_UpdateWindowFramebuffer(_THIS, SDL_Window* sdl_window, extern void MIR_DestroyWindowFramebuffer(_THIS, SDL_Window* sdl_window); -#endif /* _SDL_mirframebuffer_h */ +#endif /* SDL_mirframebuffer_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirmouse.c b/Engine/lib/sdl/src/video/mir/SDL_mirmouse.c index 1a22b28e8..5f6e38c9d 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirmouse.c +++ b/Engine/lib/sdl/src/video/mir/SDL_mirmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -41,6 +41,7 @@ typedef struct { MirCursorConfiguration* conf; MirBufferStream* stream; + char const* name; } MIR_Cursor; static SDL_Cursor* @@ -55,6 +56,7 @@ MIR_CreateDefaultCursor() if (mir_cursor) { mir_cursor->conf = NULL; mir_cursor->stream = NULL; + mir_cursor->name = NULL; cursor->driverdata = mir_cursor; } else { @@ -137,12 +139,8 @@ static SDL_Cursor* MIR_CreateSystemCursor(SDL_SystemCursor id) { char const* cursor_name = NULL; - SDL_Cursor* cursor = MIR_CreateDefaultCursor(); - MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->driverdata; - - if (!cursor) { - return NULL; - } + SDL_Cursor* cursor; + MIR_Cursor* mir_cursor; switch(id) { case SDL_SYSTEM_CURSOR_ARROW: @@ -188,7 +186,13 @@ MIR_CreateSystemCursor(SDL_SystemCursor id) return NULL; } - mir_cursor->conf = MIR_mir_cursor_configuration_from_name(cursor_name); + cursor = MIR_CreateDefaultCursor(); + if (!cursor) { + return NULL; + } + + mir_cursor = (MIR_Cursor*)cursor->driverdata; + mir_cursor->name = cursor_name; return cursor; } @@ -220,18 +224,25 @@ MIR_ShowCursor(SDL_Cursor* cursor) MIR_Window* mir_window = mir_data->current_window; if (cursor && cursor->driverdata) { - if (mir_window && MIR_mir_surface_is_valid(mir_window->surface)) { + if (mir_window && MIR_mir_window_is_valid(mir_window->window)) { MIR_Cursor* mir_cursor = (MIR_Cursor*)cursor->driverdata; + if (mir_cursor->name != NULL) { + MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_cursor_name(spec, mir_cursor->name); + MIR_mir_window_apply_spec(mir_window->window, spec); + MIR_mir_window_spec_release(spec); + } + if (mir_cursor->conf) { - MIR_mir_surface_configure_cursor(mir_window->surface, mir_cursor->conf); + MIR_mir_window_configure_cursor(mir_window->window, mir_cursor->conf); } } } - else if(mir_window && MIR_mir_surface_is_valid(mir_window->surface)) { - MIR_mir_surface_configure_cursor(mir_window->surface, NULL); + else if(mir_window && MIR_mir_window_is_valid(mir_window->window)) { + MIR_mir_window_configure_cursor(mir_window->window, NULL); } - + return 0; } @@ -273,17 +284,6 @@ MIR_InitMouse() void MIR_FiniMouse() { - SDL_Mouse* mouse = SDL_GetMouse(); - - MIR_FreeCursor(mouse->def_cursor); - mouse->def_cursor = NULL; - - mouse->CreateCursor = NULL; - mouse->ShowCursor = NULL; - mouse->FreeCursor = NULL; - mouse->WarpMouse = NULL; - mouse->CreateSystemCursor = NULL; - mouse->SetRelativeMouseMode = NULL; } #endif /* SDL_VIDEO_DRIVER_MIR */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirmouse.h b/Engine/lib/sdl/src/video/mir/SDL_mirmouse.h index 94dd08561..de3261087 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirmouse.h +++ b/Engine/lib/sdl/src/video/mir/SDL_mirmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,8 +23,8 @@ Contributed by Brandon Schaefer, */ -#ifndef _SDL_mirmouse_h -#define _SDL_mirmouse_h +#ifndef SDL_mirmouse_h_ +#define SDL_mirmouse_h_ extern void MIR_InitMouse(); @@ -32,6 +32,6 @@ MIR_InitMouse(); extern void MIR_FiniMouse(); -#endif /* _SDL_mirmouse_h */ +#endif /* SDL_mirmouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_miropengl.c b/Engine/lib/sdl/src/video/mir/SDL_miropengl.c index 23fabb267..7795f97a6 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_miropengl.c +++ b/Engine/lib/sdl/src/video/mir/SDL_miropengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,12 +31,12 @@ #include "SDL_mirdyn.h" -void +int MIR_GL_SwapWindow(_THIS, SDL_Window* window) { MIR_Window* mir_wind = window->driverdata; - SDL_EGL_SwapBuffers(_this, mir_wind->egl_surface); + return SDL_EGL_SwapBuffers(_this, mir_wind->egl_surface); } int @@ -66,31 +66,13 @@ MIR_GL_LoadLibrary(_THIS, const char* path) { MIR_Data* mir_data = _this->driverdata; - SDL_EGL_LoadLibrary(_this, path, MIR_mir_connection_get_egl_native_display(mir_data->connection)); + SDL_EGL_LoadLibrary(_this, path, MIR_mir_connection_get_egl_native_display(mir_data->connection), 0); SDL_EGL_ChooseConfig(_this); return 0; } -void -MIR_GL_UnloadLibrary(_THIS) -{ - SDL_EGL_UnloadLibrary(_this); -} - -void* -MIR_GL_GetProcAddress(_THIS, const char* proc) -{ - void* proc_addr = SDL_EGL_GetProcAddress(_this, proc); - - if (!proc_addr) { - SDL_SetError("Failed to find proc address!"); - } - - return proc_addr; -} - #endif /* SDL_VIDEO_DRIVER_MIR */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_miropengl.h b/Engine/lib/sdl/src/video/mir/SDL_miropengl.h index 96bb40a6d..2168f966c 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_miropengl.h +++ b/Engine/lib/sdl/src/video/mir/SDL_miropengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,8 +23,8 @@ Contributed by Brandon Schaefer, */ -#ifndef _SDL_miropengl_h -#define _SDL_miropengl_h +#ifndef SDL_miropengl_h_ +#define SDL_miropengl_h_ #include "SDL_mirwindow.h" @@ -33,8 +33,10 @@ #define MIR_GL_DeleteContext SDL_EGL_DeleteContext #define MIR_GL_GetSwapInterval SDL_EGL_GetSwapInterval #define MIR_GL_SetSwapInterval SDL_EGL_SetSwapInterval +#define MIR_GL_UnloadLibrary SDL_EGL_UnloadLibrary +#define MIR_GL_GetProcAddress SDL_EGL_GetProcAddress -extern void +extern int MIR_GL_SwapWindow(_THIS, SDL_Window* window); extern int @@ -46,13 +48,6 @@ MIR_GL_CreateContext(_THIS, SDL_Window* window); extern int MIR_GL_LoadLibrary(_THIS, const char* path); -extern void -MIR_GL_UnloadLibrary(_THIS); - -extern void* -MIR_GL_GetProcAddress(_THIS, const char* proc); - -#endif /* _SDL_miropengl_h */ +#endif /* SDL_miropengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ - diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirsym.h b/Engine/lib/sdl/src/video/mir/SDL_mirsym.h index 4f97ed96c..6e18b535b 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirsym.h +++ b/Engine/lib/sdl/src/video/mir/SDL_mirsym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,28 +34,30 @@ #endif SDL_MIR_MODULE(MIR_CLIENT) -SDL_MIR_SYM(MirSurface *,mir_surface_create_sync,(MirSurfaceSpec* spec)) +SDL_MIR_SYM(MirWindow *,mir_create_window_sync,(MirWindowSpec* spec)) SDL_MIR_SYM(MirEGLNativeWindowType,mir_buffer_stream_get_egl_native_window,(MirBufferStream *surface)) -SDL_MIR_SYM(void,mir_buffer_stream_get_graphics_region,(MirBufferStream *stream, MirGraphicsRegion *graphics_region)) +SDL_MIR_SYM(bool,mir_buffer_stream_get_graphics_region,(MirBufferStream *stream, MirGraphicsRegion *graphics_region)) SDL_MIR_SYM(void,mir_buffer_stream_swap_buffers_sync,(MirBufferStream *stream)) -SDL_MIR_SYM(void,mir_surface_set_event_handler,(MirSurface *surface, mir_surface_event_callback callback, void* context)) -SDL_MIR_SYM(MirSurfaceSpec*,mir_connection_create_spec_for_normal_surface,(MirConnection *connection, int width, int height, MirPixelFormat format)) -SDL_MIR_SYM(MirSurfaceSpec*,mir_connection_create_spec_for_changes,(MirConnection *connection)) -SDL_MIR_SYM(void,mir_surface_spec_set_buffer_usage,(MirSurfaceSpec *spec, MirBufferUsage usage)) -SDL_MIR_SYM(void,mir_surface_spec_set_name,(MirSurfaceSpec *spec, char const *name)) -SDL_MIR_SYM(void,mir_surface_spec_release,(MirSurfaceSpec *spec)) -SDL_MIR_SYM(void,mir_surface_spec_set_width,(MirSurfaceSpec *spec, unsigned width)) -SDL_MIR_SYM(void,mir_surface_spec_set_height,(MirSurfaceSpec *spec, unsigned height)) -SDL_MIR_SYM(void,mir_surface_spec_set_min_width,(MirSurfaceSpec *spec, unsigned min_width)) -SDL_MIR_SYM(void,mir_surface_spec_set_min_height,(MirSurfaceSpec *spec, unsigned min_height)) -SDL_MIR_SYM(void,mir_surface_spec_set_max_width,(MirSurfaceSpec *spec, unsigned max_width)) -SDL_MIR_SYM(void,mir_surface_spec_set_max_height,(MirSurfaceSpec *spec, unsigned max_height)) -SDL_MIR_SYM(void,mir_surface_spec_set_type,(MirSurfaceSpec *spec, MirSurfaceType type)) -SDL_MIR_SYM(void,mir_surface_spec_set_state,(MirSurfaceSpec *spec, MirSurfaceState state)) -SDL_MIR_SYM(void,mir_surface_spec_set_pointer_confinement,(MirSurfaceSpec *spec, MirPointerConfinementState state)) -SDL_MIR_SYM(void,mir_surface_apply_spec,(MirSurface *surface, MirSurfaceSpec *spec)) -SDL_MIR_SYM(void,mir_surface_get_parameters,(MirSurface *surface, MirSurfaceParameters *params)) -SDL_MIR_SYM(MirBufferStream*,mir_surface_get_buffer_stream,(MirSurface *surface)) +SDL_MIR_SYM(void,mir_window_set_event_handler,(MirWindow* window, MirWindowEventCallback callback, void* context)) +SDL_MIR_SYM(MirWindowSpec*,mir_create_normal_window_spec,(MirConnection *connection, int width, int height)) +SDL_MIR_SYM(MirWindowSpec*,mir_create_window_spec,(MirConnection *connection)) +SDL_MIR_SYM(void,mir_window_spec_set_buffer_usage,(MirWindowSpec *spec, MirBufferUsage usage)) +SDL_MIR_SYM(void,mir_window_spec_set_name,(MirWindowSpec *spec, char const *name)) +SDL_MIR_SYM(void,mir_window_spec_release,(MirWindowSpec *spec)) +SDL_MIR_SYM(void,mir_window_spec_set_width,(MirWindowSpec *spec, unsigned width)) +SDL_MIR_SYM(void,mir_window_spec_set_height,(MirWindowSpec *spec, unsigned height)) +SDL_MIR_SYM(void,mir_window_spec_set_min_width,(MirWindowSpec *spec, unsigned min_width)) +SDL_MIR_SYM(void,mir_window_spec_set_min_height,(MirWindowSpec *spec, unsigned min_height)) +SDL_MIR_SYM(void,mir_window_spec_set_max_width,(MirWindowSpec *spec, unsigned max_width)) +SDL_MIR_SYM(void,mir_window_spec_set_max_height,(MirWindowSpec *spec, unsigned max_height)) +SDL_MIR_SYM(void,mir_window_spec_set_type,(MirWindowSpec *spec, MirWindowType type)) +SDL_MIR_SYM(void,mir_window_spec_set_state,(MirWindowSpec *spec, MirWindowState state)) +SDL_MIR_SYM(void,mir_window_spec_set_pointer_confinement,(MirWindowSpec *spec, MirPointerConfinementState state)) +SDL_MIR_SYM(void,mir_window_spec_set_pixel_format,(MirWindowSpec *spec, MirPixelFormat pixel_format)) +SDL_MIR_SYM(void,mir_window_spec_set_cursor_name,(MirWindowSpec *spec, char const* cursor_name)) +SDL_MIR_SYM(void,mir_window_apply_spec,(MirWindow* window, MirWindowSpec* spec)) +SDL_MIR_SYM(void,mir_window_get_parameters,(MirWindow *window, MirWindowParameters *params)) +SDL_MIR_SYM(MirBufferStream*,mir_window_get_buffer_stream,(MirWindow* window)) SDL_MIR_SYM(MirCursorConfiguration*,mir_cursor_configuration_from_buffer_stream,(MirBufferStream const* stream, int hot_x, int hot_y)) SDL_MIR_SYM(MirBufferStream*,mir_connection_create_buffer_stream_sync,(MirConnection *connection, int w, int h, MirPixelFormat format, MirBufferUsage usage)) SDL_MIR_SYM(MirKeyboardAction,mir_keyboard_event_action,(MirKeyboardEvent const *event)) @@ -76,7 +78,7 @@ SDL_MIR_SYM(MirResizeEvent const*,mir_event_get_resize_event,(MirEvent const *ev SDL_MIR_SYM(MirKeyboardEvent const*,mir_input_event_get_keyboard_event,(MirInputEvent const *event)) SDL_MIR_SYM(MirPointerEvent const*,mir_input_event_get_pointer_event,(MirInputEvent const *event)) SDL_MIR_SYM(MirTouchEvent const*,mir_input_event_get_touch_event,(MirInputEvent const *event)) -SDL_MIR_SYM(MirSurfaceEvent const*,mir_event_get_surface_event,(MirEvent const *event)) +SDL_MIR_SYM(MirWindowEvent const*,mir_event_get_window_event,(MirEvent const *event)) SDL_MIR_SYM(unsigned int,mir_touch_event_point_count,(MirTouchEvent const *event)) SDL_MIR_SYM(void,mir_connection_get_available_surface_formats,(MirConnection* connection, MirPixelFormat* formats, unsigned const int format_size, unsigned int *num_valid_formats)) SDL_MIR_SYM(MirEGLNativeDisplayType,mir_connection_get_egl_native_display,(MirConnection *connection)) @@ -84,24 +86,23 @@ SDL_MIR_SYM(bool,mir_connection_is_valid,(MirConnection *connection)) SDL_MIR_SYM(void,mir_connection_release,(MirConnection *connection)) SDL_MIR_SYM(MirPixelFormat,mir_connection_get_egl_pixel_format,(MirConnection* connection, void* egldisplay, void* eglconfig)) SDL_MIR_SYM(MirConnection *,mir_connect_sync,(char const *server, char const *app_name)) -SDL_MIR_SYM(char const *,mir_surface_get_error_message,(MirSurface *surface)) -SDL_MIR_SYM(bool,mir_surface_is_valid,(MirSurface *surface)) -SDL_MIR_SYM(void,mir_surface_release_sync,(MirSurface *surface)) +SDL_MIR_SYM(char const *,mir_window_get_error_message,(MirWindow *window)) +SDL_MIR_SYM(bool,mir_window_is_valid,(MirWindow *window)) +SDL_MIR_SYM(void,mir_window_release_sync,(MirWindow* window)) SDL_MIR_SYM(void,mir_buffer_stream_release_sync,(MirBufferStream *stream)) -SDL_MIR_SYM(MirCursorConfiguration*,mir_cursor_configuration_from_name,(char const* cursor_name)) -SDL_MIR_SYM(MirWaitHandle*,mir_surface_configure_cursor,(MirSurface* surface, MirCursorConfiguration const* conf)) +SDL_MIR_SYM(void,mir_window_configure_cursor,(MirWindow* window, MirCursorConfiguration const* conf)) SDL_MIR_SYM(void,mir_cursor_configuration_destroy,(MirCursorConfiguration* conf)) SDL_MIR_SYM(int,mir_resize_event_get_width,(MirResizeEvent const* resize_event)) SDL_MIR_SYM(int,mir_resize_event_get_height,(MirResizeEvent const* resize_event)) SDL_MIR_SYM(char const*,mir_connection_get_error_message,(MirConnection* connection)) -SDL_MIR_SYM(MirSurfaceAttrib,mir_surface_event_get_attribute,(MirSurfaceEvent const* surface_event)) -SDL_MIR_SYM(int,mir_surface_event_get_attribute_value,(MirSurfaceEvent const* surface_event)) -SDL_MIR_SYM(void,mir_wait_for,(MirWaitHandle* handle)) +SDL_MIR_SYM(MirWindowAttrib,mir_window_event_get_attribute,(MirWindowEvent const* event)) +SDL_MIR_SYM(int,mir_window_event_get_attribute_value,(MirWindowEvent const* window_event)) SDL_MIR_SYM(MirDisplayConfig*,mir_connection_create_display_configuration,(MirConnection* connection)) SDL_MIR_SYM(void,mir_display_config_release,(MirDisplayConfig* config)) SDL_MIR_SYM(int,mir_display_config_get_num_outputs,(MirDisplayConfig const* config)) SDL_MIR_SYM(MirOutput*,mir_display_config_get_mutable_output,(MirDisplayConfig* config, size_t index)) SDL_MIR_SYM(int,mir_output_get_num_modes,(MirOutput const* output)) +SDL_MIR_SYM(MirOutputMode const*,mir_output_get_current_mode,(MirOutput const* output)) SDL_MIR_SYM(MirPixelFormat,mir_output_get_current_pixel_format,(MirOutput const* output)) SDL_MIR_SYM(int,mir_output_get_position_x,(MirOutput const* output)) SDL_MIR_SYM(int,mir_output_get_position_y,(MirOutput const* output)) @@ -115,7 +116,7 @@ SDL_MIR_SYM(MirOutputMode const*,mir_output_get_mode,(MirOutput const* output, s SDL_MIR_SYM(int,mir_output_mode_get_width,(MirOutputMode const* mode)) SDL_MIR_SYM(int,mir_output_mode_get_height,(MirOutputMode const* mode)) SDL_MIR_SYM(double,mir_output_mode_get_refresh_rate,(MirOutputMode const* mode)) -SDL_MIR_SYM(MirOutputGammaSupported,mir_output_is_gamma_supported,(MirOutput const* output)) +SDL_MIR_SYM(bool,mir_output_is_gamma_supported,(MirOutput const* output)) SDL_MIR_SYM(uint32_t,mir_output_get_gamma_size,(MirOutput const* output)) SDL_MIR_SYM(void,mir_output_get_gamma,(MirOutput const* output, uint16_t* red, uint16_t* green, uint16_t* blue, uint32_t size)) SDL_MIR_SYM(void,mir_output_set_gamma,(MirOutput* output, uint16_t const* red, uint16_t const* green, uint16_t const* blue, uint32_t size)) diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirvideo.c b/Engine/lib/sdl/src/video/mir/SDL_mirvideo.c index 6a8f9e482..8f3a368cf 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirvideo.c +++ b/Engine/lib/sdl/src/video/mir/SDL_mirvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,6 +27,9 @@ #if SDL_VIDEO_DRIVER_MIR +#include "SDL_assert.h" +#include "SDL_log.h" + #include "SDL_mirwindow.h" #include "SDL_video.h" @@ -34,6 +37,7 @@ #include "SDL_mirmouse.h" #include "SDL_miropengl.h" #include "SDL_mirvideo.h" +#include "SDL_mirvulkan.h" #include "SDL_mirdyn.h" @@ -98,7 +102,19 @@ MIR_Available() int available = 0; if (SDL_MIR_LoadSymbols()) { - /* !!! FIXME: try to make a MirConnection here. */ + + /* Lets ensure we can connect to the mir server */ + MirConnection* connection = MIR_mir_connect_sync(NULL, SDL_FUNCTION); + + if (!MIR_mir_connection_is_valid(connection)) { + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "Unable to connect to the mir server %s", + MIR_mir_connection_get_error_message(connection)); + + return available; + } + + MIR_mir_connection_release(connection); + available = 1; SDL_MIR_UnloadSymbols(); } @@ -165,7 +181,7 @@ MIR_CreateDevice(int device_index) device->GL_GetProcAddress = MIR_GL_GetProcAddress; /* mirwindow */ - device->CreateWindow = MIR_CreateWindow; + device->CreateSDLWindow = MIR_CreateWindow; device->DestroyWindow = MIR_DestroyWindow; device->GetWindowWMInfo = MIR_GetWindowWMInfo; device->SetWindowFullscreen = MIR_SetWindowFullscreen; @@ -182,7 +198,7 @@ MIR_CreateDevice(int device_index) device->SetWindowGammaRamp = MIR_SetWindowGammaRamp; device->GetWindowGammaRamp = MIR_GetWindowGammaRamp; - device->CreateWindowFrom = NULL; + device->CreateSDLWindowFrom = NULL; device->SetWindowIcon = NULL; device->RaiseWindow = NULL; device->SetWindowBordered = NULL; @@ -218,6 +234,13 @@ MIR_CreateDevice(int device_index) device->ShowMessageBox = NULL; +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = MIR_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = MIR_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = MIR_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = MIR_Vulkan_CreateSurface; +#endif + return device; } @@ -255,7 +278,7 @@ MIR_InitDisplayFromOutput(_THIS, MirOutput* output) MirPixelFormat format = MIR_mir_output_get_current_pixel_format(output); int num_modes = MIR_mir_output_get_num_modes(output); - SDL_DisplayMode current_mode = MIR_ConvertModeToSDLMode(mir_output_get_current_mode(output), format); + SDL_DisplayMode current_mode = MIR_ConvertModeToSDLMode(MIR_mir_output_get_current_mode(output), format); SDL_zero(display); @@ -297,7 +320,7 @@ MIR_VideoInit(_THIS) { MIR_Data* mir_data = _this->driverdata; - mir_data->connection = MIR_mir_connect_sync(NULL, __PRETTY_FUNCTION__); + mir_data->connection = MIR_mir_connect_sync(NULL, SDL_FUNCTION); mir_data->current_window = NULL; mir_data->software = SDL_FALSE; mir_data->pixel_format = mir_pixel_format_invalid; diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirvideo.h b/Engine/lib/sdl/src/video/mir/SDL_mirvideo.h index 71ef4ecc1..6850bac52 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirvideo.h +++ b/Engine/lib/sdl/src/video/mir/SDL_mirvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,11 +23,12 @@ Contributed by Brandon Schaefer, */ -#ifndef _SDL_mirvideo_h_ -#define _SDL_mirvideo_h_ +#ifndef SDL_mirvideo_h__ +#define SDL_mirvideo_h__ #include #include +#include "SDL_stdinc.h" typedef struct MIR_Window MIR_Window; @@ -43,6 +44,6 @@ typedef struct extern Uint32 MIR_GetSDLPixelFormat(MirPixelFormat format); -#endif /* _SDL_mirvideo_h_ */ +#endif /* SDL_mirvideo_h__ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirvulkan.c b/Engine/lib/sdl/src/video/mir/SDL_mirvulkan.c new file mode 100644 index 000000000..6ba3fa3cd --- /dev/null +++ b/Engine/lib/sdl/src/video/mir/SDL_mirvulkan.c @@ -0,0 +1,176 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.c. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_MIR + +#include "SDL_mirvideo.h" +#include "SDL_mirwindow.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_mirvulkan.h" +#include "SDL_syswm.h" + +int MIR_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasMIRSurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + if(_this->vulkan_config.loader_handle) + return SDL_SetError("Vulkan already loaded"); + + /* Load the Vulkan loader library */ + if(!path) + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + if(!path) + path = "libvulkan.so.1"; + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if(!_this->vulkan_config.loader_handle) + return -1; + SDL_strlcpy(_this->vulkan_config.loader_path, path, + SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + if(!vkGetInstanceProcAddr) + goto fail; + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) + goto fail; + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if(!extensions) + goto fail; + for(Uint32 i = 0; i < extensionCount; i++) + { + if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_MIR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasMIRSurfaceExtension = SDL_TRUE; + } + SDL_free(extensions); + if(!hasSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + else if(!hasMIRSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_MIR_SURFACE_EXTENSION_NAME "extension"); + goto fail; + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void MIR_Vulkan_UnloadLibrary(_THIS) +{ + if(_this->vulkan_config.loader_handle) + { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool MIR_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForMir[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_MIR_SURFACE_EXTENSION_NAME + }; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForMir), + extensionsForMir); +} + +SDL_bool MIR_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + MIR_Window *windowData = (MIR_Window *)window->driverdata; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + PFN_vkCreateMirSurfaceKHR vkCreateMirSurfaceKHR = + (PFN_vkCreateMirSurfaceKHR)vkGetInstanceProcAddr( + (VkInstance)instance, + "vkCreateMirSurfaceKHR"); + VkMirSurfaceCreateInfoKHR createInfo; + VkResult result; + + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + if(!vkCreateMirSurfaceKHR) + { + SDL_SetError(VK_KHR_MIR_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + SDL_zero(createInfo); + createInfo.sType = VK_STRUCTURE_TYPE_MIR_SURFACE_CREATE_INFO_KHR; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.connection = windowData->mir_data->connection; + createInfo.mirSurface = windowData->window; + result = vkCreateMirSurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateMirSurfaceKHR failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; +} + +#endif + +/* vim: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirvulkan.h b/Engine/lib/sdl/src/video/mir/SDL_mirvulkan.h new file mode 100644 index 000000000..6f40d5b50 --- /dev/null +++ b/Engine/lib/sdl/src/video/mir/SDL_mirvulkan.h @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.h. + */ + +#include "../../SDL_internal.h" + +#ifndef SDL_mirvulkan_h_ +#define SDL_mirvulkan_h_ + +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_MIR + +int MIR_Vulkan_LoadLibrary(_THIS, const char *path); +void MIR_Vulkan_UnloadLibrary(_THIS); +SDL_bool MIR_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool MIR_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +#endif + +#endif /* SDL_mirvulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirwindow.c b/Engine/lib/sdl/src/video/mir/SDL_mirwindow.c index 1bf9016a0..80877eef4 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirwindow.c +++ b/Engine/lib/sdl/src/video/mir/SDL_mirwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,18 +36,18 @@ #include "SDL_mirdyn.h" -int -IsSurfaceValid(MIR_Window* mir_window) +static int +IsMirWindowValid(MIR_Window* mir_window) { - if (!MIR_mir_surface_is_valid(mir_window->surface)) { - const char* error = MIR_mir_surface_get_error_message(mir_window->surface); - return SDL_SetError("Failed to created a mir surface: %s", error); + if (!MIR_mir_window_is_valid(mir_window->window)) { + const char* error = MIR_mir_window_get_error_message(mir_window->window); + return SDL_SetError("Failed to create a mir surface: %s", error); } - return 0; + return 1; } -MirPixelFormat +static MirPixelFormat FindValidPixelFormat(MIR_Data* mir_data) { unsigned int pf_size = 32; @@ -81,7 +81,7 @@ MIR_CreateWindow(_THIS, SDL_Window* window) MirPixelFormat pixel_format; MirBufferUsage buffer_usage; - MirSurfaceSpec* spec; + MirWindowSpec* spec; mir_window = SDL_calloc(1, sizeof(MIR_Window)); if (!mir_window) @@ -117,36 +117,36 @@ MIR_CreateWindow(_THIS, SDL_Window* window) if (mir_data->software) buffer_usage = mir_buffer_usage_software; - spec = MIR_mir_connection_create_spec_for_normal_surface(mir_data->connection, - window->w, - window->h, - pixel_format); + spec = MIR_mir_create_normal_window_spec(mir_data->connection, + window->w, + window->h); - MIR_mir_surface_spec_set_buffer_usage(spec, buffer_usage); - MIR_mir_surface_spec_set_name(spec, "Mir surface"); + MIR_mir_window_spec_set_buffer_usage(spec, buffer_usage); + MIR_mir_window_spec_set_name(spec, "Mir surface"); + MIR_mir_window_spec_set_pixel_format(spec, pixel_format); if (window->flags & SDL_WINDOW_INPUT_FOCUS) SDL_SetKeyboardFocus(window); - mir_window->surface = MIR_mir_surface_create_sync(spec); - MIR_mir_surface_set_event_handler(mir_window->surface, MIR_HandleEvent, window); + mir_window->window = MIR_mir_create_window_sync(spec); + MIR_mir_window_set_event_handler(mir_window->window, MIR_HandleEvent, window); - MIR_mir_surface_spec_release(spec); + MIR_mir_window_spec_release(spec); - if (!MIR_mir_surface_is_valid(mir_window->surface)) { - return SDL_SetError("Failed to created a mir surface: %s", - MIR_mir_surface_get_error_message(mir_window->surface)); + if (!MIR_mir_window_is_valid(mir_window->window)) { + return SDL_SetError("Failed to create a mir surface: %s", + MIR_mir_window_get_error_message(mir_window->window)); } if (window->flags & SDL_WINDOW_OPENGL) { EGLNativeWindowType egl_native_window = (EGLNativeWindowType)MIR_mir_buffer_stream_get_egl_native_window( - MIR_mir_surface_get_buffer_stream(mir_window->surface)); + MIR_mir_window_get_buffer_stream(mir_window->window)); mir_window->egl_surface = SDL_EGL_CreateSurface(_this, egl_native_window); if (mir_window->egl_surface == EGL_NO_SURFACE) { - return SDL_SetError("Failed to created a window surface %p", + return SDL_SetError("Failed to create a window surface %p", _this->egl_data->egl_display); } } @@ -167,7 +167,7 @@ MIR_DestroyWindow(_THIS, SDL_Window* window) if (mir_data) { SDL_EGL_DestroySurface(_this, mir_window->egl_surface); - MIR_mir_surface_release_sync(mir_window->surface); + MIR_mir_window_release_sync(mir_window->window); mir_data->current_window = NULL; @@ -185,7 +185,8 @@ MIR_GetWindowWMInfo(_THIS, SDL_Window* window, SDL_SysWMinfo* info) info->subsystem = SDL_SYSWM_MIR; info->info.mir.connection = mir_window->mir_data->connection; - info->info.mir.surface = mir_window->surface; + // Cannot change this to window due to it being in the public API + info->info.mir.surface = mir_window->window; return SDL_TRUE; } @@ -193,153 +194,104 @@ MIR_GetWindowWMInfo(_THIS, SDL_Window* window, SDL_SysWMinfo* info) return SDL_FALSE; } +static void +UpdateMirWindowState(MIR_Data* mir_data, MIR_Window* mir_window, MirWindowState window_state) +{ + if (IsMirWindowValid(mir_window)) { + MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_state(spec, window_state); + + MIR_mir_window_apply_spec(mir_window->window, spec); + MIR_mir_window_spec_release(spec); + } +} + void MIR_SetWindowFullscreen(_THIS, SDL_Window* window, SDL_VideoDisplay* display, SDL_bool fullscreen) { - MIR_Data* mir_data = _this->driverdata; - MIR_Window* mir_window = window->driverdata; - MirSurfaceSpec* spec; - MirSurfaceState state; + if (IsMirWindowValid(window->driverdata)) { + MirWindowState state; - if (IsSurfaceValid(mir_window) < 0) - return; + if (fullscreen) { + state = mir_window_state_fullscreen; + } + else { + state = mir_window_state_restored; + } - if (fullscreen) { - state = mir_surface_state_fullscreen; - } else { - state = mir_surface_state_restored; + UpdateMirWindowState(_this->driverdata, window->driverdata, state); } - - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_state(spec, state); - - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); } void MIR_MaximizeWindow(_THIS, SDL_Window* window) { - MIR_Data* mir_data = _this->driverdata; - MIR_Window* mir_window = window->driverdata; - MirSurfaceSpec* spec; - - if (IsSurfaceValid(mir_window) < 0) - return; - - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_state(spec, mir_surface_state_maximized); - - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); + UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_maximized); } void MIR_MinimizeWindow(_THIS, SDL_Window* window) { - MIR_Data* mir_data = _this->driverdata; - MIR_Window* mir_window = window->driverdata; - MirSurfaceSpec* spec; - - if (IsSurfaceValid(mir_window) < 0) - return; - - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_state(spec, mir_surface_state_minimized); - - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); + UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_minimized); } void MIR_RestoreWindow(_THIS, SDL_Window * window) { - MIR_Data* mir_data = _this->driverdata; - MIR_Window* mir_window = window->driverdata; - MirSurfaceSpec* spec; - - if (IsSurfaceValid(mir_window) < 0) - return; - - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_state(spec, mir_surface_state_restored); - - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); + UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_restored); } void MIR_HideWindow(_THIS, SDL_Window* window) { - MIR_Data* mir_data = _this->driverdata; - MIR_Window* mir_window = window->driverdata; - MirSurfaceSpec* spec; - - if (IsSurfaceValid(mir_window) < 0) - return; - - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_state(spec, mir_surface_state_hidden); - - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); + UpdateMirWindowState(_this->driverdata, window->driverdata, mir_window_state_hidden); } void MIR_SetWindowSize(_THIS, SDL_Window* window) { - MIR_Data* mir_data = _this->driverdata; + MIR_Data* mir_data = _this->driverdata; MIR_Window* mir_window = window->driverdata; - MirSurfaceSpec* spec; - if (IsSurfaceValid(mir_window) < 0) - return; + if (IsMirWindowValid(mir_window)) { + MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_width (spec, window->w); + MIR_mir_window_spec_set_height(spec, window->h); - /* You cannot set the x/y of a mir window! So only update w/h */ - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_width (spec, window->w); - MIR_mir_surface_spec_set_height(spec, window->h); - - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); + MIR_mir_window_apply_spec(mir_window->window, spec); + } } void MIR_SetWindowMinimumSize(_THIS, SDL_Window* window) { - MIR_Data* mir_data = _this->driverdata; + MIR_Data* mir_data = _this->driverdata; MIR_Window* mir_window = window->driverdata; - MirSurfaceSpec* spec; - if (IsSurfaceValid(mir_window) < 0) - return; + if (IsMirWindowValid(mir_window)) { + MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_min_width (spec, window->min_w); + MIR_mir_window_spec_set_min_height(spec, window->min_h); - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_min_width (spec, window->min_w); - MIR_mir_surface_spec_set_min_height(spec, window->min_h); - - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); + MIR_mir_window_apply_spec(mir_window->window, spec); + } } void MIR_SetWindowMaximumSize(_THIS, SDL_Window* window) { - MIR_Data* mir_data = _this->driverdata; + MIR_Data* mir_data = _this->driverdata; MIR_Window* mir_window = window->driverdata; - MirSurfaceSpec* spec; - if (IsSurfaceValid(mir_window) < 0) - return; + if (IsMirWindowValid(mir_window)) { + MirWindowSpec* spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_max_width (spec, window->max_w); + MIR_mir_window_spec_set_max_height(spec, window->max_h); - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_max_width (spec, window->max_w); - MIR_mir_surface_spec_set_max_height(spec, window->max_h); - - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); + MIR_mir_window_apply_spec(mir_window->window, spec); + } } void @@ -348,16 +300,16 @@ MIR_SetWindowTitle(_THIS, SDL_Window* window) MIR_Data* mir_data = _this->driverdata; MIR_Window* mir_window = window->driverdata; char const* title = window->title ? window->title : ""; - MirSurfaceSpec* spec; + MirWindowSpec* spec; - if (IsSurfaceValid(mir_window) < 0) + if (IsMirWindowValid(mir_window) < 0) return; - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_name(spec, title); + spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_name(spec, title); - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); + MIR_mir_window_apply_spec(mir_window->window, spec); + MIR_mir_window_spec_release(spec); } void @@ -366,16 +318,16 @@ MIR_SetWindowGrab(_THIS, SDL_Window* window, SDL_bool grabbed) MIR_Data* mir_data = _this->driverdata; MIR_Window* mir_window = window->driverdata; MirPointerConfinementState confined = mir_pointer_unconfined; - MirSurfaceSpec* spec; + MirWindowSpec* spec; if (grabbed) - confined = mir_pointer_confined_to_surface; + confined = mir_pointer_confined_to_window; - spec = MIR_mir_connection_create_spec_for_changes(mir_data->connection); - MIR_mir_surface_spec_set_pointer_confinement(spec, confined); + spec = MIR_mir_create_window_spec(mir_data->connection); + MIR_mir_window_spec_set_pointer_confinement(spec, confined); - MIR_mir_surface_apply_spec(mir_window->surface, spec); - MIR_mir_surface_spec_release(spec); + MIR_mir_window_apply_spec(mir_window->window, spec); + MIR_mir_window_spec_release(spec); } int diff --git a/Engine/lib/sdl/src/video/mir/SDL_mirwindow.h b/Engine/lib/sdl/src/video/mir/SDL_mirwindow.h index c4084aa4e..af618f50c 100644 --- a/Engine/lib/sdl/src/video/mir/SDL_mirwindow.h +++ b/Engine/lib/sdl/src/video/mir/SDL_mirwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,8 +23,8 @@ Contributed by Brandon Schaefer, */ -#ifndef _SDL_mirwindow_h -#define _SDL_mirwindow_h +#ifndef SDL_mirwindow_h_ +#define SDL_mirwindow_h_ #include "../SDL_sysvideo.h" #include "SDL_syswm.h" @@ -35,7 +35,7 @@ struct MIR_Window { SDL_Window* sdl_window; MIR_Data* mir_data; - MirSurface* surface; + MirWindow* window; EGLSurface egl_surface; }; @@ -87,7 +87,7 @@ MIR_SetWindowGammaRamp(_THIS, SDL_Window* window, Uint16 const* ramp); extern int MIR_GetWindowGammaRamp(_THIS, SDL_Window* window, Uint16* ramp); -#endif /* _SDL_mirwindow_h */ +#endif /* SDL_mirwindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/nacl/SDL_naclevents.c b/Engine/lib/sdl/src/video/nacl/SDL_naclevents.c index d6ebbdf87..812df2bf2 100644 --- a/Engine/lib/sdl/src/video/nacl/SDL_naclevents.c +++ b/Engine/lib/sdl/src/video/nacl/SDL_naclevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -298,7 +298,7 @@ static Uint8 SDL_NACL_translate_mouse_button(int32_t button) { return SDL_BUTTON_MIDDLE; case PP_INPUTEVENT_MOUSEBUTTON_RIGHT: return SDL_BUTTON_RIGHT; - + case PP_INPUTEVENT_MOUSEBUTTON_NONE: default: return 0; @@ -314,14 +314,14 @@ SDL_NACL_translate_keycode(int keycode) scancode = NACL_Keycodes[keycode]; } if (scancode == SDL_SCANCODE_UNKNOWN) { - SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL mailing list NACL KeyCode %d \n", keycode); + SDL_Log("The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list NACL KeyCode %d", keycode); } return scancode; } void NACL_PumpEvents(_THIS) { PSEvent* ps_event; - PP_Resource event; + PP_Resource event; PP_InputEvent_Type type; PP_InputEvent_Modifier modifiers; struct PP_Rect rect; @@ -329,11 +329,11 @@ void NACL_PumpEvents(_THIS) { struct PP_Point location; struct PP_Var var; const char *str; - char text[64]; + char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; Uint32 str_len; SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata; SDL_Mouse *mouse = SDL_GetMouse(); - + if (driverdata->window) { while ((ps_event = PSEventTryAcquire()) != NULL) { event = ps_event->as_resource; @@ -344,9 +344,9 @@ void NACL_PumpEvents(_THIS) { NACL_SetScreenResolution(rect.size.width, rect.size.height, SDL_PIXELFORMAT_UNKNOWN); // FIXME: Rebuild context? See life.c UpdateContext break; - + /* From HandleInputEvent, contains an input resource. */ - case PSE_INSTANCE_HANDLEINPUT: + case PSE_INSTANCE_HANDLEINPUT: type = driverdata->ppb_input_event->GetType(event); modifiers = driverdata->ppb_input_event->GetModifiers(event); switch(type) { @@ -359,35 +359,35 @@ void NACL_PumpEvents(_THIS) { case PP_INPUTEVENT_TYPE_WHEEL: /* FIXME: GetTicks provides high resolution scroll events */ fp = driverdata->ppb_wheel_input_event->GetDelta(event); - SDL_SendMouseWheel(mouse->focus, mouse->mouseID, (int) fp.x, (int) fp.y, SDL_MOUSEWHEEL_NORMAL); + SDL_SendMouseWheel(mouse->focus, mouse->mouseID, fp.x, fp.y, SDL_MOUSEWHEEL_NORMAL); break; - + case PP_INPUTEVENT_TYPE_MOUSEENTER: case PP_INPUTEVENT_TYPE_MOUSELEAVE: /* FIXME: Mouse Focus */ break; - - - case PP_INPUTEVENT_TYPE_MOUSEMOVE: + + + case PP_INPUTEVENT_TYPE_MOUSEMOVE: location = driverdata->ppb_mouse_input_event->GetPosition(event); SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, location.x, location.y); break; - + case PP_INPUTEVENT_TYPE_TOUCHSTART: case PP_INPUTEVENT_TYPE_TOUCHMOVE: case PP_INPUTEVENT_TYPE_TOUCHEND: case PP_INPUTEVENT_TYPE_TOUCHCANCEL: /* FIXME: Touch events */ break; - + case PP_INPUTEVENT_TYPE_KEYDOWN: SDL_SendKeyboardKey(SDL_PRESSED, SDL_NACL_translate_keycode(driverdata->ppb_keyboard_input_event->GetKeyCode(event))); break; - + case PP_INPUTEVENT_TYPE_KEYUP: SDL_SendKeyboardKey(SDL_RELEASED, SDL_NACL_translate_keycode(driverdata->ppb_keyboard_input_event->GetKeyCode(event))); break; - + case PP_INPUTEVENT_TYPE_CHAR: var = driverdata->ppb_keyboard_input_event->GetCharacterText(event); str = driverdata->ppb_var->VarToUtf8(var, &str_len); @@ -397,17 +397,17 @@ void NACL_PumpEvents(_THIS) { } SDL_strlcpy(text, str, str_len ); text[str_len] = '\0'; - + SDL_SendKeyboardText(text); /* FIXME: Do we have to handle ref counting? driverdata->ppb_var->Release(var);*/ break; - + default: break; } break; - - + + /* From HandleMessage, contains a PP_Var. */ case PSE_INSTANCE_HANDLEMESSAGE: break; @@ -419,7 +419,7 @@ void NACL_PumpEvents(_THIS) { /* When the 3D context is lost, no resource. */ case PSE_GRAPHICS3D_GRAPHICS3DCONTEXTLOST: break; - + /* When the mouse lock is lost. */ case PSE_MOUSELOCK_MOUSELOCKLOST: break; @@ -427,7 +427,7 @@ void NACL_PumpEvents(_THIS) { default: break; } - + PSEventRelease(ps_event); } } diff --git a/Engine/lib/sdl/src/video/nacl/SDL_naclevents_c.h b/Engine/lib/sdl/src/video/nacl/SDL_naclevents_c.h index 3255578c3..8059ea557 100644 --- a/Engine/lib/sdl/src/video/nacl/SDL_naclevents_c.h +++ b/Engine/lib/sdl/src/video/nacl/SDL_naclevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,11 +20,11 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_naclevents_c_h -#define _SDL_naclevents_c_h +#ifndef SDL_naclevents_c_h_ +#define SDL_naclevents_c_h_ #include "SDL_naclvideo.h" extern void NACL_PumpEvents(_THIS); -#endif /* _SDL_naclevents_c_h */ +#endif /* SDL_naclevents_c_h_ */ diff --git a/Engine/lib/sdl/src/video/nacl/SDL_naclglue.c b/Engine/lib/sdl/src/video/nacl/SDL_naclglue.c index 79f5b0f90..544cc6fd5 100644 --- a/Engine/lib/sdl/src/video/nacl/SDL_naclglue.c +++ b/Engine/lib/sdl/src/video/nacl/SDL_naclglue.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/nacl/SDL_naclopengles.c b/Engine/lib/sdl/src/video/nacl/SDL_naclopengles.c index e11245135..98b9ad3f6 100644 --- a/Engine/lib/sdl/src/video/nacl/SDL_naclopengles.c +++ b/Engine/lib/sdl/src/video/nacl/SDL_naclopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -141,7 +141,7 @@ int NACL_GLES_SetSwapInterval(_THIS, int interval) { /* STUB */ - return 0; + return SDL_Unsupported(); } int @@ -151,12 +151,15 @@ NACL_GLES_GetSwapInterval(_THIS) return 0; } -void +int NACL_GLES_SwapWindow(_THIS, SDL_Window * window) { SDL_VideoData *driverdata = (SDL_VideoData *) _this->driverdata; struct PP_CompletionCallback callback = { NULL, 0, PP_COMPLETIONCALLBACK_FLAG_NONE }; - driverdata->ppb_graphics->SwapBuffers((PP_Resource) SDL_GL_GetCurrentContext(), callback ); + if (driverdata->ppb_graphics->SwapBuffers((PP_Resource) SDL_GL_GetCurrentContext(), callback ) != 0) { + return SDL_SetError("SwapBuffers failed"); + } + return 0; } void diff --git a/Engine/lib/sdl/src/video/nacl/SDL_naclopengles.h b/Engine/lib/sdl/src/video/nacl/SDL_naclopengles.h index 1845e8191..744c0e533 100644 --- a/Engine/lib/sdl/src/video/nacl/SDL_naclopengles.h +++ b/Engine/lib/sdl/src/video/nacl/SDL_naclopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_naclgl_h -#define _SDL_naclgl_h +#ifndef SDL_naclopengles_h_ +#define SDL_naclopengles_h_ extern int NACL_GLES_LoadLibrary(_THIS, const char *path); extern void *NACL_GLES_GetProcAddress(_THIS, const char *proc); @@ -30,9 +30,9 @@ extern SDL_GLContext NACL_GLES_CreateContext(_THIS, SDL_Window * window); extern int NACL_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern int NACL_GLES_SetSwapInterval(_THIS, int interval); extern int NACL_GLES_GetSwapInterval(_THIS); -extern void NACL_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int NACL_GLES_SwapWindow(_THIS, SDL_Window * window); extern void NACL_GLES_DeleteContext(_THIS, SDL_GLContext context); -#endif /* _SDL_naclgl_h */ +#endif /* SDL_naclopengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/nacl/SDL_naclvideo.c b/Engine/lib/sdl/src/video/nacl/SDL_naclvideo.c index 467155c67..24dda2c15 100644 --- a/Engine/lib/sdl/src/video/nacl/SDL_naclvideo.c +++ b/Engine/lib/sdl/src/video/nacl/SDL_naclvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -81,7 +81,7 @@ static int NACL_Available(void) { static void NACL_DeleteDevice(SDL_VideoDevice *device) { SDL_VideoData *driverdata = (SDL_VideoData*) device->driverdata; driverdata->ppb_core->ReleaseResource((PP_Resource) driverdata->ppb_message_loop); - SDL_free(device->driverdata); + /* device->driverdata is not freed because it points to static memory */ SDL_free(device); } @@ -107,7 +107,7 @@ static SDL_VideoDevice *NACL_CreateDevice(int devindex) { device->VideoQuit = NACL_VideoQuit; device->PumpEvents = NACL_PumpEvents; - device->CreateWindow = NACL_CreateWindow; + device->CreateSDLWindow = NACL_CreateWindow; device->SetWindowTitle = NACL_SetWindowTitle; device->DestroyWindow = NACL_DestroyWindow; diff --git a/Engine/lib/sdl/src/video/nacl/SDL_naclvideo.h b/Engine/lib/sdl/src/video/nacl/SDL_naclvideo.h index 174a6e77c..6986aa83c 100644 --- a/Engine/lib/sdl/src/video/nacl/SDL_naclvideo.h +++ b/Engine/lib/sdl/src/video/nacl/SDL_naclvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_naclvideo_h -#define _SDL_naclvideo_h +#ifndef SDL_naclvideo_h_ +#define SDL_naclvideo_h_ #include "../SDL_sysvideo.h" #include "ppapi_simple/ps_interface.h" @@ -64,4 +64,4 @@ typedef struct SDL_VideoData { extern void NACL_SetScreenResolution(int width, int height, Uint32 format); -#endif /* _SDL_naclvideo_h */ +#endif /* SDL_naclvideo_h_ */ diff --git a/Engine/lib/sdl/src/video/nacl/SDL_naclwindow.c b/Engine/lib/sdl/src/video/nacl/SDL_naclwindow.c index 32d1e6d7e..71933313c 100644 --- a/Engine/lib/sdl/src/video/nacl/SDL_naclwindow.c +++ b/Engine/lib/sdl/src/video/nacl/SDL_naclwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/nacl/SDL_naclwindow.h b/Engine/lib/sdl/src/video/nacl/SDL_naclwindow.h index 617bfc3ab..412b15f2e 100644 --- a/Engine/lib/sdl/src/video/nacl/SDL_naclwindow.h +++ b/Engine/lib/sdl/src/video/nacl/SDL_naclwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,13 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_naclwindow_h -#define _SDL_naclwindow_h +#ifndef SDL_naclwindow_h_ +#define SDL_naclwindow_h_ extern int NACL_CreateWindow(_THIS, SDL_Window * window); extern void NACL_SetWindowTitle(_THIS, SDL_Window * window); extern void NACL_DestroyWindow(_THIS, SDL_Window * window); -#endif /* _SDL_naclwindow_h */ +#endif /* SDL_naclwindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/pandora/SDL_pandora.c b/Engine/lib/sdl/src/video/pandora/SDL_pandora.c index 7afa54306..b319b164c 100644 --- a/Engine/lib/sdl/src/video/pandora/SDL_pandora.c +++ b/Engine/lib/sdl/src/video/pandora/SDL_pandora.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -102,8 +102,8 @@ PND_create() device->VideoQuit = PND_videoquit; device->GetDisplayModes = PND_getdisplaymodes; device->SetDisplayMode = PND_setdisplaymode; - device->CreateWindow = PND_createwindow; - device->CreateWindowFrom = PND_createwindowfrom; + device->CreateSDLWindow = PND_createwindow; + device->CreateSDLWindowFrom = PND_createwindowfrom; device->SetWindowTitle = PND_setwindowtitle; device->SetWindowIcon = PND_setwindowicon; device->SetWindowPosition = PND_setwindowposition; @@ -116,7 +116,9 @@ PND_create() device->RestoreWindow = PND_restorewindow; device->SetWindowGrab = PND_setwindowgrab; device->DestroyWindow = PND_destroywindow; +#if 0 device->GetWindowWMInfo = PND_getwindowwminfo; +#endif device->GL_LoadLibrary = PND_gl_loadlibrary; device->GL_GetProcAddress = PND_gl_getprocaddres; device->GL_UnloadLibrary = PND_gl_unloadlibrary; @@ -298,13 +300,14 @@ PND_destroywindow(_THIS, SDL_Window * window) /*****************************************************************************/ /* SDL Window Manager function */ /*****************************************************************************/ +#if 0 SDL_bool PND_getwindowwminfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) { if (info->version.major <= SDL_MAJOR_VERSION) { return SDL_TRUE; } else { - SDL_SetError("application not compiled with SDL %d.%d\n", + SDL_SetError("application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } @@ -312,6 +315,7 @@ PND_getwindowwminfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) /* Failed to get window manager information */ return SDL_FALSE; } +#endif /*****************************************************************************/ /* SDL OpenGL/OpenGL ES functions */ @@ -637,7 +641,7 @@ PND_gl_createcontext(_THIS, SDL_Window * window) if (wdata->gles_surface == 0) { - SDL_SetError("Error : eglCreateWindowSurface failed;\n"); + SDL_SetError("Error : eglCreateWindowSurface failed;"); return NULL; } @@ -774,15 +778,14 @@ PND_gl_getswapinterval(_THIS) return ((SDL_VideoData *) _this->driverdata)->swapinterval; } -void +int PND_gl_swapwindow(_THIS, SDL_Window * window) { SDL_VideoData *phdata = (SDL_VideoData *) _this->driverdata; SDL_WindowData *wdata = (SDL_WindowData *) window->driverdata; if (phdata->egl_initialized != SDL_TRUE) { - SDL_SetError("PND: GLES initialization failed, no OpenGL ES support"); - return; + return SDL_SetError("PND: GLES initialization failed, no OpenGL ES support"); } /* Many applications do not uses glFinish(), so we call it for them */ @@ -792,6 +795,7 @@ PND_gl_swapwindow(_THIS, SDL_Window * window) eglWaitGL(); eglSwapBuffers(phdata->egl_display, wdata->gles_surface); + return 0; } void diff --git a/Engine/lib/sdl/src/video/pandora/SDL_pandora.h b/Engine/lib/sdl/src/video/pandora/SDL_pandora.h index 859b7ee5d..9e460e764 100644 --- a/Engine/lib/sdl/src/video/pandora/SDL_pandora.h +++ b/Engine/lib/sdl/src/video/pandora/SDL_pandora.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -92,7 +92,7 @@ SDL_GLContext PND_gl_createcontext(_THIS, SDL_Window * window); int PND_gl_makecurrent(_THIS, SDL_Window * window, SDL_GLContext context); int PND_gl_setswapinterval(_THIS, int interval); int PND_gl_getswapinterval(_THIS); -void PND_gl_swapwindow(_THIS, SDL_Window * window); +int PND_gl_swapwindow(_THIS, SDL_Window * window); void PND_gl_deletecontext(_THIS, SDL_GLContext context); diff --git a/Engine/lib/sdl/src/video/pandora/SDL_pandora_events.c b/Engine/lib/sdl/src/video/pandora/SDL_pandora_events.c index d22d0c759..bff7a36b4 100644 --- a/Engine/lib/sdl/src/video/pandora/SDL_pandora_events.c +++ b/Engine/lib/sdl/src/video/pandora/SDL_pandora_events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/pandora/SDL_pandora_events.h b/Engine/lib/sdl/src/video/pandora/SDL_pandora_events.h index e9f8d7cfa..f714384cd 100644 --- a/Engine/lib/sdl/src/video/pandora/SDL_pandora_events.h +++ b/Engine/lib/sdl/src/video/pandora/SDL_pandora_events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/psp/SDL_pspevents.c b/Engine/lib/sdl/src/video/psp/SDL_pspevents.c index 71267272d..14277b3bf 100644 --- a/Engine/lib/sdl/src/video/psp/SDL_pspevents.c +++ b/Engine/lib/sdl/src/video/psp/SDL_pspevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -260,12 +260,12 @@ void PSP_EventInit(_THIS) #endif /* Start thread to read data */ if((event_sem = SDL_CreateSemaphore(1)) == NULL) { - SDL_SetError("Can't create input semaphore\n"); + SDL_SetError("Can't create input semaphore"); return; } running = 1; if((thread = SDL_CreateThreadInternal(EventUpdate, "PSPInputThread", 4096, NULL)) == NULL) { - SDL_SetError("Can't create input thread\n"); + SDL_SetError("Can't create input thread"); return; } } diff --git a/Engine/lib/sdl/src/video/psp/SDL_pspevents_c.h b/Engine/lib/sdl/src/video/psp/SDL_pspevents_c.h index e1929d237..e98beb4a4 100644 --- a/Engine/lib/sdl/src/video/psp/SDL_pspevents_c.h +++ b/Engine/lib/sdl/src/video/psp/SDL_pspevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/psp/SDL_pspgl.c b/Engine/lib/sdl/src/video/psp/SDL_pspgl.c index e4f81e9ee..644fb34e6 100644 --- a/Engine/lib/sdl/src/video/psp/SDL_pspgl.c +++ b/Engine/lib/sdl/src/video/psp/SDL_pspgl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -47,10 +47,6 @@ int PSP_GL_LoadLibrary(_THIS, const char *path) { - if (!_this->gl_config.driver_loaded) { - _this->gl_config.driver_loaded = 1; - } - return 0; } @@ -174,10 +170,13 @@ PSP_GL_GetSwapInterval(_THIS) return _this->gl_data->swapinterval; } -void +int PSP_GL_SwapWindow(_THIS, SDL_Window * window) { - eglSwapBuffers(_this->gl_data->display, _this->gl_data->surface); + if (!eglSwapBuffers(_this->gl_data->display, _this->gl_data->surface)) { + return SDL_SetError("eglSwapBuffers() failed"); + } + return 0; } void diff --git a/Engine/lib/sdl/src/video/psp/SDL_pspgl_c.h b/Engine/lib/sdl/src/video/psp/SDL_pspgl_c.h index 308b02729..49300fb38 100644 --- a/Engine/lib/sdl/src/video/psp/SDL_pspgl_c.h +++ b/Engine/lib/sdl/src/video/psp/SDL_pspgl_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_pspgl_c_h -#define _SDL_pspgl_c_h +#ifndef SDL_pspgl_c_h_ +#define SDL_pspgl_c_h_ #include @@ -40,7 +40,7 @@ extern void * PSP_GL_GetProcAddress(_THIS, const char *proc); extern int PSP_GL_MakeCurrent(_THIS,SDL_Window * window, SDL_GLContext context); extern void PSP_GL_SwapBuffers(_THIS); -extern void PSP_GL_SwapWindow(_THIS, SDL_Window * window); +extern int PSP_GL_SwapWindow(_THIS, SDL_Window * window); extern SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window * window); extern int PSP_GL_LoadLibrary(_THIS, const char *path); @@ -49,4 +49,6 @@ extern int PSP_GL_SetSwapInterval(_THIS, int interval); extern int PSP_GL_GetSwapInterval(_THIS); -#endif /* _SDL_pspgl_c_h */ +#endif /* SDL_pspgl_c_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/psp/SDL_pspmouse.c b/Engine/lib/sdl/src/video/psp/SDL_pspmouse.c index b7c3d2b99..bd34dfaec 100644 --- a/Engine/lib/sdl/src/video/psp/SDL_pspmouse.c +++ b/Engine/lib/sdl/src/video/psp/SDL_pspmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/psp/SDL_pspmouse_c.h b/Engine/lib/sdl/src/video/psp/SDL_pspmouse_c.h index 2a3df68ef..2d2640eb0 100644 --- a/Engine/lib/sdl/src/video/psp/SDL_pspmouse_c.h +++ b/Engine/lib/sdl/src/video/psp/SDL_pspmouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/psp/SDL_pspvideo.c b/Engine/lib/sdl/src/video/psp/SDL_pspvideo.c index 381e4899e..82317793f 100644 --- a/Engine/lib/sdl/src/video/psp/SDL_pspvideo.c +++ b/Engine/lib/sdl/src/video/psp/SDL_pspvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -113,8 +113,8 @@ PSP_Create() device->VideoQuit = PSP_VideoQuit; device->GetDisplayModes = PSP_GetDisplayModes; device->SetDisplayMode = PSP_SetDisplayMode; - device->CreateWindow = PSP_CreateWindow; - device->CreateWindowFrom = PSP_CreateWindowFrom; + device->CreateSDLWindow = PSP_CreateWindow; + device->CreateSDLWindowFrom = PSP_CreateWindowFrom; device->SetWindowTitle = PSP_SetWindowTitle; device->SetWindowIcon = PSP_SetWindowIcon; device->SetWindowPosition = PSP_SetWindowPosition; @@ -127,7 +127,9 @@ PSP_Create() device->RestoreWindow = PSP_RestoreWindow; device->SetWindowGrab = PSP_SetWindowGrab; device->DestroyWindow = PSP_DestroyWindow; +#if 0 device->GetWindowWMInfo = PSP_GetWindowWMInfo; +#endif device->GL_LoadLibrary = PSP_GL_LoadLibrary; device->GL_GetProcAddress = PSP_GL_GetProcAddress; device->GL_UnloadLibrary = PSP_GL_UnloadLibrary; @@ -291,13 +293,14 @@ PSP_DestroyWindow(_THIS, SDL_Window * window) /*****************************************************************************/ /* SDL Window Manager function */ /*****************************************************************************/ +#if 0 SDL_bool PSP_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) { if (info->version.major <= SDL_MAJOR_VERSION) { return SDL_TRUE; } else { - SDL_SetError("application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } @@ -305,6 +308,7 @@ PSP_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) /* Failed to get window manager information */ return SDL_FALSE; } +#endif /* TO Write Me */ diff --git a/Engine/lib/sdl/src/video/psp/SDL_pspvideo.h b/Engine/lib/sdl/src/video/psp/SDL_pspvideo.h index f5705a944..741bad1ed 100644 --- a/Engine/lib/sdl/src/video/psp/SDL_pspvideo.h +++ b/Engine/lib/sdl/src/video/psp/SDL_pspvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_pspvideo_h -#define _SDL_pspvideo_h +#ifndef SDL_pspvideo_h_ +#define SDL_pspvideo_h_ #include @@ -88,7 +88,7 @@ SDL_GLContext PSP_GL_CreateContext(_THIS, SDL_Window * window); int PSP_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); int PSP_GL_SetSwapInterval(_THIS, int interval); int PSP_GL_GetSwapInterval(_THIS); -void PSP_GL_SwapWindow(_THIS, SDL_Window * window); +int PSP_GL_SwapWindow(_THIS, SDL_Window * window); void PSP_GL_DeleteContext(_THIS, SDL_GLContext context); /* PSP on screen keyboard */ @@ -97,6 +97,6 @@ void PSP_ShowScreenKeyboard(_THIS, SDL_Window *window); void PSP_HideScreenKeyboard(_THIS, SDL_Window *window); SDL_bool PSP_IsScreenKeyboardShown(_THIS, SDL_Window *window); -#endif /* _SDL_pspvideo_h */ +#endif /* SDL_pspvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/qnx/gl.c b/Engine/lib/sdl/src/video/qnx/gl.c new file mode 100644 index 000000000..19e1bd4f7 --- /dev/null +++ b/Engine/lib/sdl/src/video/qnx/gl.c @@ -0,0 +1,285 @@ +/* + Simple DirectMedia Layer + Copyright (C) 2017 BlackBerry Limited + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" +#include "sdl_qnx.h" + +static EGLDisplay egl_disp; + +/** + * Detertmines the pixel format to use based on the current display and EGL + * configuration. + * @param egl_conf EGL configuration to use + * @return A SCREEN_FORMAT* constant for the pixel format to use + */ +static int +chooseFormat(EGLConfig egl_conf) +{ + EGLint buffer_bit_depth; + EGLint alpha_bit_depth; + + eglGetConfigAttrib(egl_disp, egl_conf, EGL_BUFFER_SIZE, &buffer_bit_depth); + eglGetConfigAttrib(egl_disp, egl_conf, EGL_ALPHA_SIZE, &alpha_bit_depth); + + switch (buffer_bit_depth) { + case 32: + return SCREEN_FORMAT_RGBX8888; + case 24: + return SCREEN_FORMAT_RGB888; + case 16: + switch (alpha_bit_depth) { + case 4: + return SCREEN_FORMAT_RGBX4444; + case 1: + return SCREEN_FORMAT_RGBA5551; + default: + return SCREEN_FORMAT_RGB565; + } + default: + return 0; + } +} + +/** + * Enumerates the supported EGL configurations and chooses a suitable one. + * @param[out] pconf The chosen configuration + * @param[out] pformat The chosen pixel format + * @return 0 if successful, -1 on error + */ +int +glGetConfig(EGLConfig *pconf, int *pformat) +{ + EGLConfig egl_conf = (EGLConfig)0; + EGLConfig *egl_configs; + EGLint egl_num_configs; + EGLint val; + EGLBoolean rc; + EGLint i; + + // Determine the numbfer of configurations. + rc = eglGetConfigs(egl_disp, NULL, 0, &egl_num_configs); + if (rc != EGL_TRUE) { + return -1; + } + + if (egl_num_configs == 0) { + return -1; + } + + // Allocate enough memory for all configurations. + egl_configs = malloc(egl_num_configs * sizeof(*egl_configs)); + if (egl_configs == NULL) { + return -1; + } + + // Get the list of configurations. + rc = eglGetConfigs(egl_disp, egl_configs, egl_num_configs, + &egl_num_configs); + if (rc != EGL_TRUE) { + free(egl_configs); + return -1; + } + + // Find a good configuration. + for (i = 0; i < egl_num_configs; i++) { + eglGetConfigAttrib(egl_disp, egl_configs[i], EGL_SURFACE_TYPE, &val); + if (!(val & EGL_WINDOW_BIT)) { + continue; + } + + eglGetConfigAttrib(egl_disp, egl_configs[i], EGL_RENDERABLE_TYPE, &val); + if (!(val & EGL_OPENGL_ES2_BIT)) { + continue; + } + + eglGetConfigAttrib(egl_disp, egl_configs[i], EGL_DEPTH_SIZE, &val); + if (val == 0) { + continue; + } + + egl_conf = egl_configs[i]; + break; + } + + free(egl_configs); + *pconf = egl_conf; + *pformat = chooseFormat(egl_conf); + + return 0; +} + +/** + * Initializes the EGL library. + * @param _THIS + * @param name unused + * @return 0 if successful, -1 on error + */ +int +glLoadLibrary(_THIS, const char *name) +{ + EGLNativeDisplayType disp_id = EGL_DEFAULT_DISPLAY; + + egl_disp = eglGetDisplay(disp_id); + if (egl_disp == EGL_NO_DISPLAY) { + return -1; + } + + if (eglInitialize(egl_disp, NULL, NULL) == EGL_FALSE) { + return -1; + } + + return 0; +} + +/** + * Finds the address of an EGL extension function. + * @param proc Function name + * @return Function address + */ +void * +glGetProcAddress(_THIS, const char *proc) +{ + return eglGetProcAddress(proc); +} + +/** + * Associates the given window with the necessary EGL structures for drawing and + * displaying content. + * @param _THIS + * @param window The SDL window to create the context for + * @return A pointer to the created context, if successful, NULL on error + */ +SDL_GLContext +glCreateContext(_THIS, SDL_Window *window) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + EGLContext context; + EGLSurface surface; + + struct { + EGLint client_version[2]; + EGLint none; + } egl_ctx_attr = { + .client_version = { EGL_CONTEXT_CLIENT_VERSION, 2 }, + .none = EGL_NONE + }; + + struct { + EGLint render_buffer[2]; + EGLint none; + } egl_surf_attr = { + .render_buffer = { EGL_RENDER_BUFFER, EGL_BACK_BUFFER }, + .none = EGL_NONE + }; + + context = eglCreateContext(egl_disp, impl->conf, EGL_NO_CONTEXT, + (EGLint *)&egl_ctx_attr); + if (context == EGL_NO_CONTEXT) { + return NULL; + } + + surface = eglCreateWindowSurface(egl_disp, impl->conf, impl->window, + (EGLint *)&egl_surf_attr); + if (surface == EGL_NO_SURFACE) { + return NULL; + } + + eglMakeCurrent(egl_disp, surface, surface, context); + + impl->surface = surface; + return context; +} + +/** + * Sets a new value for the number of frames to display before swapping buffers. + * @param _THIS + * @param interval New interval value + * @return 0 if successful, -1 on error + */ +int +glSetSwapInterval(_THIS, int interval) +{ + if (eglSwapInterval(egl_disp, interval) != EGL_TRUE) { + return -1; + } + + return 0; +} + +/** + * Swaps the EGL buffers associated with the given window + * @param _THIS + * @param window Window to swap buffers for + * @return 0 if successful, -1 on error + */ +int +glSwapWindow(_THIS, SDL_Window *window) +{ + /* !!! FIXME: should we migrate this all over to use SDL_egl.c? */ + window_impl_t *impl = (window_impl_t *)window->driverdata; + return eglSwapBuffers(egl_disp, impl->surface) == EGL_TRUE ? 0 : -1; +} + +/** + * Makes the given context the current one for drawing operations. + * @param _THIS + * @param window SDL window associated with the context (maybe NULL) + * @param context The context to activate + * @return 0 if successful, -1 on error + */ +int +glMakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context) +{ + window_impl_t *impl; + EGLSurface surface = NULL; + + if (window) { + impl = (window_impl_t *)window->driverdata; + surface = impl->surface; + } + + if (eglMakeCurrent(egl_disp, surface, surface, context) != EGL_TRUE) { + return -1; + } + + return 0; +} + +/** + * Destroys a context. + * @param _THIS + * @param context The context to destroy + */ +void +glDeleteContext(_THIS, SDL_GLContext context) +{ + eglDestroyContext(egl_disp, context); +} + +/** + * Terminates access to the EGL library. + * @param _THIS + */ +void +glUnloadLibrary(_THIS) +{ + eglTerminate(egl_disp); +} diff --git a/Engine/lib/sdl/src/video/qnx/keyboard.c b/Engine/lib/sdl/src/video/qnx/keyboard.c new file mode 100644 index 000000000..86c6395ba --- /dev/null +++ b/Engine/lib/sdl/src/video/qnx/keyboard.c @@ -0,0 +1,133 @@ +/* + Simple DirectMedia Layer + Copyright (C) 2017 BlackBerry Limited + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" +#include "../../events/SDL_keyboard_c.h" +#include "SDL_scancode.h" +#include "SDL_events.h" +#include "sdl_qnx.h" +#include + +/** + * A map thta translates Screen key names to SDL scan codes. + * This map is incomplete, but should include most major keys. + */ +static int key_to_sdl[] = { + [KEYCODE_SPACE] = SDL_SCANCODE_SPACE, + [KEYCODE_APOSTROPHE] = SDL_SCANCODE_APOSTROPHE, + [KEYCODE_COMMA] = SDL_SCANCODE_COMMA, + [KEYCODE_MINUS] = SDL_SCANCODE_MINUS, + [KEYCODE_PERIOD] = SDL_SCANCODE_PERIOD, + [KEYCODE_SLASH] = SDL_SCANCODE_SLASH, + [KEYCODE_ZERO] = SDL_SCANCODE_0, + [KEYCODE_ONE] = SDL_SCANCODE_1, + [KEYCODE_TWO] = SDL_SCANCODE_2, + [KEYCODE_THREE] = SDL_SCANCODE_3, + [KEYCODE_FOUR] = SDL_SCANCODE_4, + [KEYCODE_FIVE] = SDL_SCANCODE_5, + [KEYCODE_SIX] = SDL_SCANCODE_6, + [KEYCODE_SEVEN] = SDL_SCANCODE_7, + [KEYCODE_EIGHT] = SDL_SCANCODE_8, + [KEYCODE_NINE] = SDL_SCANCODE_9, + [KEYCODE_SEMICOLON] = SDL_SCANCODE_SEMICOLON, + [KEYCODE_EQUAL] = SDL_SCANCODE_EQUALS, + [KEYCODE_LEFT_BRACKET] = SDL_SCANCODE_LEFTBRACKET, + [KEYCODE_BACK_SLASH] = SDL_SCANCODE_BACKSLASH, + [KEYCODE_RIGHT_BRACKET] = SDL_SCANCODE_RIGHTBRACKET, + [KEYCODE_GRAVE] = SDL_SCANCODE_GRAVE, + [KEYCODE_A] = SDL_SCANCODE_A, + [KEYCODE_B] = SDL_SCANCODE_B, + [KEYCODE_C] = SDL_SCANCODE_C, + [KEYCODE_D] = SDL_SCANCODE_D, + [KEYCODE_E] = SDL_SCANCODE_E, + [KEYCODE_F] = SDL_SCANCODE_F, + [KEYCODE_G] = SDL_SCANCODE_G, + [KEYCODE_H] = SDL_SCANCODE_H, + [KEYCODE_I] = SDL_SCANCODE_I, + [KEYCODE_J] = SDL_SCANCODE_J, + [KEYCODE_K] = SDL_SCANCODE_K, + [KEYCODE_L] = SDL_SCANCODE_L, + [KEYCODE_M] = SDL_SCANCODE_M, + [KEYCODE_N] = SDL_SCANCODE_N, + [KEYCODE_O] = SDL_SCANCODE_O, + [KEYCODE_P] = SDL_SCANCODE_P, + [KEYCODE_Q] = SDL_SCANCODE_Q, + [KEYCODE_R] = SDL_SCANCODE_R, + [KEYCODE_S] = SDL_SCANCODE_S, + [KEYCODE_T] = SDL_SCANCODE_T, + [KEYCODE_U] = SDL_SCANCODE_U, + [KEYCODE_V] = SDL_SCANCODE_V, + [KEYCODE_W] = SDL_SCANCODE_W, + [KEYCODE_X] = SDL_SCANCODE_X, + [KEYCODE_Y] = SDL_SCANCODE_Y, + [KEYCODE_Z] = SDL_SCANCODE_Z, + [KEYCODE_UP] = SDL_SCANCODE_UP, + [KEYCODE_DOWN] = SDL_SCANCODE_DOWN, + [KEYCODE_LEFT] = SDL_SCANCODE_LEFT, + [KEYCODE_PG_UP] = SDL_SCANCODE_PAGEUP, + [KEYCODE_PG_DOWN] = SDL_SCANCODE_PAGEDOWN, + [KEYCODE_RIGHT] = SDL_SCANCODE_RIGHT, + [KEYCODE_RETURN] = SDL_SCANCODE_RETURN, + [KEYCODE_TAB] = SDL_SCANCODE_TAB, + [KEYCODE_ESCAPE] = SDL_SCANCODE_ESCAPE, +}; + +/** + * Called from the event dispatcher when a keyboard event is encountered. + * Translates the event such that it can be handled by SDL. + * @param event Screen keyboard event + */ +void +handleKeyboardEvent(screen_event_t event) +{ + int val; + SDL_Scancode scancode; + + // Get the key value. + if (screen_get_event_property_iv(event, SCREEN_PROPERTY_SYM, &val) < 0) { + return; + } + + // Skip unrecognized keys. + if ((val < 0) || (val >= SDL_TABLESIZE(key_to_sdl))) { + return; + } + + // Translate to an SDL scan code. + scancode = key_to_sdl[val]; + if (scancode == 0) { + return; + } + + // Get event flags (key state). + if (screen_get_event_property_iv(event, SCREEN_PROPERTY_FLAGS, &val) < 0) { + return; + } + + // Propagate the event to SDL. + // FIXME: + // Need to handle more key states (such as key combinations). + if (val & KEY_DOWN) { + SDL_SendKeyboardKey(SDL_PRESSED, scancode); + } else { + SDL_SendKeyboardKey(SDL_RELEASED, scancode); + } +} diff --git a/Engine/lib/sdl/src/video/qnx/sdl_qnx.h b/Engine/lib/sdl/src/video/qnx/sdl_qnx.h new file mode 100644 index 000000000..65e07988e --- /dev/null +++ b/Engine/lib/sdl/src/video/qnx/sdl_qnx.h @@ -0,0 +1,48 @@ +/* + Simple DirectMedia Layer + Copyright (C) 2017 BlackBerry Limited + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#ifndef __SDL_QNX_H__ +#define __SDL_QNX_H__ + +#include "../SDL_sysvideo.h" +#include +#include + +typedef struct +{ + screen_window_t window; + EGLSurface surface; + EGLConfig conf; +} window_impl_t; + +extern void handleKeyboardEvent(screen_event_t event); + +extern int glGetConfig(EGLConfig *pconf, int *pformat); +extern int glLoadLibrary(_THIS, const char *name); +void *glGetProcAddress(_THIS, const char *proc); +extern SDL_GLContext glCreateContext(_THIS, SDL_Window *window); +extern int glSetSwapInterval(_THIS, int interval); +extern int glSwapWindow(_THIS, SDL_Window *window); +extern int glMakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +extern void glDeleteContext(_THIS, SDL_GLContext context); +extern void glUnloadLibrary(_THIS); + +#endif diff --git a/Engine/lib/sdl/src/video/qnx/video.c b/Engine/lib/sdl/src/video/qnx/video.c new file mode 100644 index 000000000..ff8223c77 --- /dev/null +++ b/Engine/lib/sdl/src/video/qnx/video.c @@ -0,0 +1,364 @@ +/* + Simple DirectMedia Layer + Copyright (C) 2017 BlackBerry Limited + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" +#include "../SDL_sysvideo.h" +#include "sdl_qnx.h" + +static screen_context_t context; +static screen_event_t event; + +/** + * Initializes the QNX video plugin. + * Creates the Screen context and event handles used for all window operations + * by the plugin. + * @param _THIS + * @return 0 if successful, -1 on error + */ +static int +videoInit(_THIS) +{ + SDL_VideoDisplay display; + + if (screen_create_context(&context, 0) < 0) { + return -1; + } + + if (screen_create_event(&event) < 0) { + return -1; + } + + SDL_zero(display); + + if (SDL_AddVideoDisplay(&display) < 0) { + return -1; + } + + _this->num_displays = 1; + return 0; +} + +static void +videoQuit(_THIS) +{ +} + +/** + * Creates a new native Screen window and associates it with the given SDL + * window. + * @param _THIS + * @param window SDL window to initialize + * @return 0 if successful, -1 on error + */ +static int +createWindow(_THIS, SDL_Window *window) +{ + window_impl_t *impl; + int size[2]; + int numbufs; + int format; + int usage; + + impl = SDL_calloc(1, sizeof(*impl)); + if (impl == NULL) { + return -1; + } + + // Create a native window. + if (screen_create_window(&impl->window, context) < 0) { + goto fail; + } + + // Set the native window's size to match the SDL window. + size[0] = window->w; + size[1] = window->h; + + if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SIZE, + size) < 0) { + goto fail; + } + + if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SOURCE_SIZE, + size) < 0) { + goto fail; + } + + // Create window buffer(s). + if (window->flags & SDL_WINDOW_OPENGL) { + if (glGetConfig(&impl->conf, &format) < 0) { + goto fail; + } + numbufs = 2; + + usage = SCREEN_USAGE_OPENGL_ES2; + if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_USAGE, + &usage) < 0) { + return -1; + } + } else { + format = SCREEN_FORMAT_RGBX8888; + numbufs = 1; + } + + // Set pixel format. + if (screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_FORMAT, + &format) < 0) { + goto fail; + } + + // Create buffer(s). + if (screen_create_window_buffers(impl->window, numbufs) < 0) { + goto fail; + } + + window->driverdata = impl; + return 0; + +fail: + if (impl->window) { + screen_destroy_window(impl->window); + } + + SDL_free(impl); + return -1; +} + +/** + * Gets a pointer to the Screen buffer associated with the given window. Note + * that the buffer is actually created in createWindow(). + * @param _THIS + * @param window SDL window to get the buffer for + * @param[out] pixles Holds a pointer to the window's buffer + * @param[out] format Holds the pixel format for the buffer + * @param[out] pitch Holds the number of bytes per line + * @return 0 if successful, -1 on error + */ +static int +createWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, + void ** pixels, int *pitch) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + screen_buffer_t buffer; + + // Get a pointer to the buffer's memory. + if (screen_get_window_property_pv(impl->window, SCREEN_PROPERTY_BUFFERS, + (void **)&buffer) < 0) { + return -1; + } + + if (screen_get_buffer_property_pv(buffer, SCREEN_PROPERTY_POINTER, + pixels) < 0) { + return -1; + } + + // Set format and pitch. + if (screen_get_buffer_property_iv(buffer, SCREEN_PROPERTY_STRIDE, + pitch) < 0) { + return -1; + } + + *format = SDL_PIXELFORMAT_RGB888; + return 0; +} + +/** + * Informs the window manager that the window needs to be updated. + * @param _THIS + * @param window The window to update + * @param rects An array of reectangular areas to update + * @param numrects Rect array length + * @return 0 if successful, -1 on error + */ +static int +updateWindowFramebuffer(_THIS, SDL_Window *window, const SDL_Rect *rects, + int numrects) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + screen_buffer_t buffer; + + if (screen_get_window_property_pv(impl->window, SCREEN_PROPERTY_BUFFERS, + (void **)&buffer) < 0) { + return -1; + } + + screen_post_window(impl->window, buffer, numrects, (int *)rects, 0); + screen_flush_context(context, 0); + return 0; +} + +/** + * Runs the main event loop. + * @param _THIS + */ +static void +pumpEvents(_THIS) +{ + int type; + + for (;;) { + if (screen_get_event(context, event, 0) < 0) { + break; + } + + if (screen_get_event_property_iv(event, SCREEN_PROPERTY_TYPE, &type) + < 0) { + break; + } + + if (type == SCREEN_EVENT_NONE) { + break; + } + + switch (type) { + case SCREEN_EVENT_KEYBOARD: + handleKeyboardEvent(event); + break; + + default: + break; + } + } +} + +/** + * Updates the size of the native window using the geometry of the SDL window. + * @param _THIS + * @param window SDL window to update + */ +static void +setWindowSize(_THIS, SDL_Window *window) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + int size[2]; + + size[0] = window->w; + size[1] = window->h; + + screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SIZE, size); + screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_SOURCE_SIZE, + size); +} + +/** + * Makes the native window associated with the given SDL window visible. + * @param _THIS + * @param window SDL window to update + */ +static void +showWindow(_THIS, SDL_Window *window) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + const int visible = 1; + + screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_VISIBLE, + &visible); +} + +/** + * Makes the native window associated with the given SDL window invisible. + * @param _THIS + * @param window SDL window to update + */ +static void +hideWindow(_THIS, SDL_Window *window) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + const int visible = 0; + + screen_set_window_property_iv(impl->window, SCREEN_PROPERTY_VISIBLE, + &visible); +} + +/** + * Destroys the native window associated with the given SDL window. + * @param _THIS + * @param window SDL window that is being destroyed + */ +static void +destroyWindow(_THIS, SDL_Window *window) +{ + window_impl_t *impl = (window_impl_t *)window->driverdata; + + if (impl) { + screen_destroy_window(impl->window); + window->driverdata = NULL; + } +} + +/** + * Frees the plugin object created by createDevice(). + * @param device Plugin object to free + */ +static void +deleteDevice(SDL_VideoDevice *device) +{ + SDL_free(device); +} + +/** + * Creates the QNX video plugin used by SDL. + * @param devindex Unused + * @return Initialized device if successful, NULL otherwise + */ +static SDL_VideoDevice * +createDevice(int devindex) +{ + SDL_VideoDevice *device; + + device = (SDL_VideoDevice *)SDL_calloc(1, sizeof(SDL_VideoDevice)); + if (device == NULL) { + return NULL; + } + + device->driverdata = NULL; + device->VideoInit = videoInit; + device->VideoQuit = videoQuit; + device->CreateSDLWindow = createWindow; + device->CreateWindowFramebuffer = createWindowFramebuffer; + device->UpdateWindowFramebuffer = updateWindowFramebuffer; + device->SetWindowSize = setWindowSize; + device->ShowWindow = showWindow; + device->HideWindow = hideWindow; + device->PumpEvents = pumpEvents; + device->DestroyWindow = destroyWindow; + + device->GL_LoadLibrary = glLoadLibrary; + device->GL_GetProcAddress = glGetProcAddress; + device->GL_CreateContext = glCreateContext; + device->GL_SetSwapInterval = glSetSwapInterval; + device->GL_SwapWindow = glSwapWindow; + device->GL_MakeCurrent = glMakeCurrent; + device->GL_DeleteContext = glDeleteContext; + device->GL_UnloadLibrary = glUnloadLibrary; + + device->free = deleteDevice; + return device; +} + +static int +available() +{ + return 1; +} + +VideoBootStrap QNX_bootstrap = { + "qnx", "QNX Screen", + available, createDevice +}; diff --git a/Engine/lib/sdl/src/video/raspberry/SDL_rpievents.c b/Engine/lib/sdl/src/video/raspberry/SDL_rpievents.c index 4104568cc..406435511 100644 --- a/Engine/lib/sdl/src/video/raspberry/SDL_rpievents.c +++ b/Engine/lib/sdl/src/video/raspberry/SDL_rpievents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/raspberry/SDL_rpievents_c.h b/Engine/lib/sdl/src/video/raspberry/SDL_rpievents_c.h index 54fc196e4..8b1737f13 100644 --- a/Engine/lib/sdl/src/video/raspberry/SDL_rpievents_c.h +++ b/Engine/lib/sdl/src/video/raspberry/SDL_rpievents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_rpievents_c_h -#define _SDL_rpievents_c_h +#ifndef SDL_rpievents_c_h_ +#define SDL_rpievents_c_h_ #include "SDL_rpivideo.h" @@ -28,4 +28,4 @@ void RPI_PumpEvents(_THIS); void RPI_EventInit(_THIS); void RPI_EventQuit(_THIS); -#endif /* _SDL_rpievents_c_h */ +#endif /* SDL_rpievents_c_h_ */ diff --git a/Engine/lib/sdl/src/video/raspberry/SDL_rpimouse.c b/Engine/lib/sdl/src/video/raspberry/SDL_rpimouse.c index ae9bdfd5c..4ea976b3b 100644 --- a/Engine/lib/sdl/src/video/raspberry/SDL_rpimouse.c +++ b/Engine/lib/sdl/src/video/raspberry/SDL_rpimouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -165,7 +165,7 @@ RPI_ShowCursor(SDL_Cursor * cursor) if (curdata->element == DISPMANX_NO_HANDLE) { vc_dispmanx_rect_set(&src_rect, 0, 0, curdata->w << 16, curdata->h << 16); - vc_dispmanx_rect_set(&dst_rect, 0, 0, curdata->w, curdata->h); + vc_dispmanx_rect_set(&dst_rect, mouse->x, mouse->y, curdata->w, curdata->h); update = vc_dispmanx_update_start(10); SDL_assert(update); @@ -247,6 +247,65 @@ RPI_WarpMouseGlobal(int x, int y) return 0; } + /* Update internal mouse position. */ + SDL_SendMouseMotion(mouse->focus, mouse->mouseID, 0, x, y); + + curdata = (RPI_CursorData *) mouse->cur_cursor->driverdata; + if (curdata->element == DISPMANX_NO_HANDLE) { + return 0; + } + + update = vc_dispmanx_update_start(10); + if (!update) { + return 0; + } + + src_rect.x = 0; + src_rect.y = 0; + src_rect.width = curdata->w << 16; + src_rect.height = curdata->h << 16; + dst_rect.x = x; + dst_rect.y = y; + dst_rect.width = curdata->w; + dst_rect.height = curdata->h; + + ret = vc_dispmanx_element_change_attributes( + update, + curdata->element, + 0, + 0, + 0, + &dst_rect, + &src_rect, + DISPMANX_NO_HANDLE, + DISPMANX_NO_ROTATE); + if (ret != DISPMANX_SUCCESS) { + return SDL_SetError("vc_dispmanx_element_change_attributes() failed"); + } + + /* Submit asynchronously, otherwise the peformance suffers a lot */ + ret = vc_dispmanx_update_submit(update, 0, NULL); + if (ret != DISPMANX_SUCCESS) { + return SDL_SetError("vc_dispmanx_update_submit() failed"); + } + return 0; +} + +/* Warp the mouse to (x,y) */ +static int +RPI_WarpMouseGlobalGraphicOnly(int x, int y) +{ + RPI_CursorData *curdata; + DISPMANX_UPDATE_HANDLE_T update; + int ret; + VC_RECT_T dst_rect; + VC_RECT_T src_rect; + SDL_Mouse *mouse = SDL_GetMouse(); + + if (mouse == NULL || mouse->cur_cursor == NULL || mouse->cur_cursor->driverdata == NULL) { + return 0; + } + curdata = (RPI_CursorData *) mouse->cur_cursor->driverdata; if (curdata->element == DISPMANX_NO_HANDLE) { return 0; @@ -317,7 +376,9 @@ static void RPI_MoveCursor(SDL_Cursor * cursor) { SDL_Mouse *mouse = SDL_GetMouse(); - RPI_WarpMouse(mouse->focus, mouse->x, mouse->y); + /* We must NOT call SDL_SendMouseMotion() on the next call or we will enter recursivity, + * so we create a version of WarpMouseGlobal without it. */ + RPI_WarpMouseGlobalGraphicOnly(mouse->x, mouse->y); } #endif /* SDL_VIDEO_DRIVER_RPI */ diff --git a/Engine/lib/sdl/src/video/raspberry/SDL_rpimouse.h b/Engine/lib/sdl/src/video/raspberry/SDL_rpimouse.h index 6a4e70511..919f8115b 100644 --- a/Engine/lib/sdl/src/video/raspberry/SDL_rpimouse.h +++ b/Engine/lib/sdl/src/video/raspberry/SDL_rpimouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_RPI_mouse_h -#define _SDL_RPI_mouse_h +#ifndef SDL_RPI_mouse_h_ +#define SDL_RPI_mouse_h_ #include "../SDL_sysvideo.h" @@ -38,6 +38,6 @@ struct _RPI_CursorData extern void RPI_InitMouse(_THIS); extern void RPI_QuitMouse(_THIS); -#endif /* _SDL_RPI_mouse_h */ +#endif /* SDL_RPI_mouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/raspberry/SDL_rpiopengles.c b/Engine/lib/sdl/src/video/raspberry/SDL_rpiopengles.c index 0881dbde8..b7630075b 100644 --- a/Engine/lib/sdl/src/video/raspberry/SDL_rpiopengles.c +++ b/Engine/lib/sdl/src/video/raspberry/SDL_rpiopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,6 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ #include "../../SDL_internal.h" +#include "SDL_hints.h" +#include "SDL_log.h" #if SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL @@ -27,13 +29,40 @@ /* EGL implementation of SDL OpenGL support */ +void +RPI_GLES_DefaultProfileConfig(_THIS, int *mask, int *major, int *minor) +{ + *mask = SDL_GL_CONTEXT_PROFILE_ES; + *major = 2; + *minor = 0; +} + int RPI_GLES_LoadLibrary(_THIS, const char *path) { - return SDL_EGL_LoadLibrary(_this, path, EGL_DEFAULT_DISPLAY); + return SDL_EGL_LoadLibrary(_this, path, EGL_DEFAULT_DISPLAY, 0); +} + +int +RPI_GLES_SwapWindow(_THIS, SDL_Window * window) { + SDL_WindowData *wdata = ((SDL_WindowData *) window->driverdata); + + if (!(_this->egl_data->eglSwapBuffers(_this->egl_data->egl_display, wdata->egl_surface))) { + SDL_LogError(SDL_LOG_CATEGORY_VIDEO, "eglSwapBuffers failed."); + return 0; + } + + /* Wait immediately for vsync (as if we only had two buffers), for low input-lag scenarios. + * Run your SDL2 program with "SDL_RPI_DOUBLE_BUFFER=1 " to enable this. */ + if (wdata->double_buffer) { + SDL_LockMutex(wdata->vsync_cond_mutex); + SDL_CondWait(wdata->vsync_cond, wdata->vsync_cond_mutex); + SDL_UnlockMutex(wdata->vsync_cond_mutex); + } + + return 0; } SDL_EGL_CreateContext_impl(RPI) -SDL_EGL_SwapWindow_impl(RPI) SDL_EGL_MakeCurrent_impl(RPI) #endif /* SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL */ diff --git a/Engine/lib/sdl/src/video/raspberry/SDL_rpiopengles.h b/Engine/lib/sdl/src/video/raspberry/SDL_rpiopengles.h index 83c800067..9724a5f73 100644 --- a/Engine/lib/sdl/src/video/raspberry/SDL_rpiopengles.h +++ b/Engine/lib/sdl/src/video/raspberry/SDL_rpiopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_rpiopengles_h -#define _SDL_rpiopengles_h +#ifndef SDL_rpiopengles_h_ +#define SDL_rpiopengles_h_ #if SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL @@ -38,11 +38,12 @@ extern int RPI_GLES_LoadLibrary(_THIS, const char *path); extern SDL_GLContext RPI_GLES_CreateContext(_THIS, SDL_Window * window); -extern void RPI_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int RPI_GLES_SwapWindow(_THIS, SDL_Window * window); extern int RPI_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); +extern void RPI_GLES_DefaultProfileConfig(_THIS, int *mask, int *major, int *minor); #endif /* SDL_VIDEO_DRIVER_RPI && SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_rpiopengles_h */ +#endif /* SDL_rpiopengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/raspberry/SDL_rpivideo.c b/Engine/lib/sdl/src/video/raspberry/SDL_rpivideo.c index 67dc77b1c..e3863803a 100644 --- a/Engine/lib/sdl/src/video/raspberry/SDL_rpivideo.c +++ b/Engine/lib/sdl/src/video/raspberry/SDL_rpivideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -59,11 +59,25 @@ RPI_Available(void) static void RPI_Destroy(SDL_VideoDevice * device) { - /* SDL_VideoData *phdata = (SDL_VideoData *) device->driverdata; */ + SDL_free(device->driverdata); + SDL_free(device); +} - if (device->driverdata != NULL) { - device->driverdata = NULL; - } +static int +RPI_GetRefreshRate() +{ + TV_DISPLAY_STATE_T tvstate; + if (vc_tv_get_display_state( &tvstate ) == 0) { + //The width/height parameters are in the same position in the union + //for HDMI and SDTV + HDMI_PROPERTY_PARAM_T property; + property.property = HDMI_PROPERTY_PIXEL_CLOCK_TYPE; + vc_tv_hdmi_get_property(&property); + return property.param1 == HDMI_PIXEL_CLOCK_TYPE_NTSC ? + tvstate.display.hdmi.frame_rate * (1000.0f/1001.0f) : + tvstate.display.hdmi.frame_rate; + } + return 60; /* Failed to get display state, default to 60 */ } static SDL_VideoDevice * @@ -100,8 +114,8 @@ RPI_Create() device->VideoQuit = RPI_VideoQuit; device->GetDisplayModes = RPI_GetDisplayModes; device->SetDisplayMode = RPI_SetDisplayMode; - device->CreateWindow = RPI_CreateWindow; - device->CreateWindowFrom = RPI_CreateWindowFrom; + device->CreateSDLWindow = RPI_CreateWindow; + device->CreateSDLWindowFrom = RPI_CreateWindowFrom; device->SetWindowTitle = RPI_SetWindowTitle; device->SetWindowIcon = RPI_SetWindowIcon; device->SetWindowPosition = RPI_SetWindowPosition; @@ -114,7 +128,9 @@ RPI_Create() device->RestoreWindow = RPI_RestoreWindow; device->SetWindowGrab = RPI_SetWindowGrab; device->DestroyWindow = RPI_DestroyWindow; +#if 0 device->GetWindowWMInfo = RPI_GetWindowWMInfo; +#endif device->GL_LoadLibrary = RPI_GLES_LoadLibrary; device->GL_GetProcAddress = RPI_GLES_GetProcAddress; device->GL_UnloadLibrary = RPI_GLES_UnloadLibrary; @@ -124,6 +140,7 @@ RPI_Create() device->GL_GetSwapInterval = RPI_GLES_GetSwapInterval; device->GL_SwapWindow = RPI_GLES_SwapWindow; device->GL_DeleteContext = RPI_GLES_DeleteContext; + device->GL_DefaultProfileConfig = RPI_GLES_DefaultProfileConfig; device->PumpEvents = RPI_PumpEvents; @@ -159,8 +176,7 @@ RPI_VideoInit(_THIS) current_mode.w = w; current_mode.h = h; - /* FIXME: Is there a way to tell the actual refresh rate? */ - current_mode.refresh_rate = 60; + current_mode.refresh_rate = RPI_GetRefreshRate(); /* 32 bpp for default */ current_mode.format = SDL_PIXELFORMAT_ABGR8888; @@ -183,7 +199,9 @@ RPI_VideoInit(_THIS) SDL_AddVideoDisplay(&display); #ifdef SDL_INPUT_LINUXEV - SDL_EVDEV_Init(); + if (SDL_EVDEV_Init() < 0) { + return -1; + } #endif RPI_InitMouse(_this); @@ -212,6 +230,16 @@ RPI_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode) return 0; } +static void +RPI_vsync_callback(DISPMANX_UPDATE_HANDLE_T u, void *data) +{ + SDL_WindowData *wdata = ((SDL_WindowData *) data); + + SDL_LockMutex(wdata->vsync_cond_mutex); + SDL_CondSignal(wdata->vsync_cond); + SDL_UnlockMutex(wdata->vsync_cond_mutex); +} + int RPI_CreateWindow(_THIS, SDL_Window * window) { @@ -287,9 +315,18 @@ RPI_CreateWindow(_THIS, SDL_Window * window) return SDL_SetError("Could not create GLES window surface"); } + /* Start generating vsync callbacks if necesary */ + wdata->double_buffer = SDL_FALSE; + if (SDL_GetHintBoolean(SDL_HINT_VIDEO_DOUBLE_BUFFER, SDL_FALSE)) { + wdata->vsync_cond = SDL_CreateCond(); + wdata->vsync_cond_mutex = SDL_CreateMutex(); + wdata->double_buffer = SDL_TRUE; + vc_dispmanx_vsync_callback(displaydata->dispman_display, RPI_vsync_callback, (void*)wdata); + } + /* Setup driver data for this window */ window->driverdata = wdata; - + /* One window, it always has focus */ SDL_SetMouseFocus(window); SDL_SetKeyboardFocus(window); @@ -302,7 +339,22 @@ void RPI_DestroyWindow(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + SDL_VideoDisplay *display = SDL_GetDisplayForWindow(window); + SDL_DisplayData *displaydata = (SDL_DisplayData *) display->driverdata; + if(data) { + if (data->double_buffer) { + /* Wait for vsync, and then stop vsync callbacks and destroy related stuff, if needed */ + SDL_LockMutex(data->vsync_cond_mutex); + SDL_CondWait(data->vsync_cond, data->vsync_cond_mutex); + SDL_UnlockMutex(data->vsync_cond_mutex); + + vc_dispmanx_vsync_callback(displaydata->dispman_display, NULL, NULL); + + SDL_DestroyCond(data->vsync_cond); + SDL_DestroyMutex(data->vsync_cond_mutex); + } + #if SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); @@ -368,13 +420,14 @@ RPI_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) /*****************************************************************************/ /* SDL Window Manager function */ /*****************************************************************************/ +#if 0 SDL_bool RPI_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) { if (info->version.major <= SDL_MAJOR_VERSION) { return SDL_TRUE; } else { - SDL_SetError("application not compiled with SDL %d.%d\n", + SDL_SetError("application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } @@ -382,6 +435,7 @@ RPI_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) /* Failed to get window manager information */ return SDL_FALSE; } +#endif #endif /* SDL_VIDEO_DRIVER_RPI */ diff --git a/Engine/lib/sdl/src/video/raspberry/SDL_rpivideo.h b/Engine/lib/sdl/src/video/raspberry/SDL_rpivideo.h index 74dcf9414..b2eb670ae 100644 --- a/Engine/lib/sdl/src/video/raspberry/SDL_rpivideo.h +++ b/Engine/lib/sdl/src/video/raspberry/SDL_rpivideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,7 @@ #include "../../SDL_internal.h" #include "../SDL_sysvideo.h" -#include "bcm_host.h" +#include #include "GLES/gl.h" #include "EGL/egl.h" #include "EGL/eglext.h" @@ -48,6 +48,12 @@ typedef struct SDL_WindowData #if SDL_VIDEO_OPENGL_EGL EGLSurface egl_surface; #endif + + /* Vsync callback cond and mutex */ + SDL_cond *vsync_cond; + SDL_mutex *vsync_cond_mutex; + SDL_bool double_buffer; + } SDL_WindowData; #define SDL_RPI_VIDEOLAYER 10000 /* High enough so to occlude everything */ @@ -90,7 +96,7 @@ SDL_GLContext RPI_GLES_CreateContext(_THIS, SDL_Window * window); int RPI_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); int RPI_GLES_SetSwapInterval(_THIS, int interval); int RPI_GLES_GetSwapInterval(_THIS); -void RPI_GLES_SwapWindow(_THIS, SDL_Window * window); +int RPI_GLES_SwapWindow(_THIS, SDL_Window * window); void RPI_GLES_DeleteContext(_THIS, SDL_GLContext context); #endif /* __SDL_RPIVIDEO_H__ */ diff --git a/Engine/lib/sdl/src/video/sdlgenblit.pl b/Engine/lib/sdl/src/video/sdlgenblit.pl index 9ebffafc4..d89ae2a8c 100755 --- a/Engine/lib/sdl/src/video/sdlgenblit.pl +++ b/Engine/lib/sdl/src/video/sdlgenblit.pl @@ -92,7 +92,7 @@ sub open_file { /* DO NOT EDIT! This file is generated by sdlgenblit.pl */ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitappdelegate.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitappdelegate.h index edf09f50f..34b01384d 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitappdelegate.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitappdelegate.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -36,6 +36,12 @@ - (void)hideLaunchScreen; +/* This property is marked as optional, and is only intended to be used when + * the app's UI is storyboard-based. SDL is not storyboard-based, however + * several major third-party ad APIs (e.g. Google admob) incorrectly assume this + * property always exists, and will crash if it doesn't. */ +@property (nonatomic) UIWindow *window; + @end /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitappdelegate.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitappdelegate.m index c94c78a41..a942dfde0 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitappdelegate.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitappdelegate.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -69,7 +69,7 @@ int main(int argc, char **argv) return exit_status; } -static void +static void SDLCALL SDL_IdleTimerDisabledChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { BOOL disable = (hint && *hint != '0'); @@ -422,14 +422,24 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh) return YES; } -- (void)applicationWillTerminate:(UIApplication *)application +- (UIWindow *)window { - SDL_SendAppEvent(SDL_APP_TERMINATING); + SDL_VideoDevice *_this = SDL_GetVideoDevice(); + if (_this) { + SDL_Window *window = NULL; + for (window = _this->windows; window != NULL; window = window->next) { + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + if (data != nil) { + return data.uiwindow; + } + } + } + return nil; } -- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application +- (void)setWindow:(UIWindow *)window { - SDL_SendAppEvent(SDL_APP_LOWMEMORY); + /* Do nothing. */ } #if !TARGET_OS_TV @@ -462,41 +472,34 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh) } #endif +- (void)applicationWillTerminate:(UIApplication *)application +{ + SDL_OnApplicationWillTerminate(); +} + +- (void)applicationDidReceiveMemoryWarning:(UIApplication *)application +{ + SDL_OnApplicationDidReceiveMemoryWarning(); +} + - (void)applicationWillResignActive:(UIApplication*)application { - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - if (_this) { - SDL_Window *window; - for (window = _this->windows; window != nil; window = window->next) { - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_LOST, 0, 0); - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_MINIMIZED, 0, 0); - } - } - SDL_SendAppEvent(SDL_APP_WILLENTERBACKGROUND); + SDL_OnApplicationWillResignActive(); } - (void)applicationDidEnterBackground:(UIApplication*)application { - SDL_SendAppEvent(SDL_APP_DIDENTERBACKGROUND); + SDL_OnApplicationDidEnterBackground(); } - (void)applicationWillEnterForeground:(UIApplication*)application { - SDL_SendAppEvent(SDL_APP_WILLENTERFOREGROUND); + SDL_OnApplicationWillEnterForeground(); } - (void)applicationDidBecomeActive:(UIApplication*)application { - SDL_SendAppEvent(SDL_APP_DIDENTERFOREGROUND); - - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - if (_this) { - SDL_Window *window; - for (window = _this->windows; window != nil; window = window->next) { - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_FOCUS_GAINED, 0, 0); - SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESTORED, 0, 0); - } - } + SDL_OnApplicationDidBecomeActive(); } - (void)sendDropFileForURL:(NSURL *)url @@ -510,23 +513,24 @@ SDL_LoadLaunchImageNamed(NSString *name, int screenh) SDL_SendDropComplete(NULL); } -#if TARGET_OS_TV -/* TODO: Use this on iOS 9+ as well? */ +#if TARGET_OS_TV || (defined(__IPHONE_9_0) && __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_9_0) + - (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary *)options { /* TODO: Handle options */ [self sendDropFileForURL:url]; return YES; } -#endif /* TARGET_OS_TV */ -#if !TARGET_OS_TV +#else + - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation { [self sendDropFileForURL:url]; return YES; } -#endif /* !TARGET_OS_TV */ + +#endif @end diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitclipboard.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitclipboard.h index 7d1c35f99..c4b689dbe 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitclipboard.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,8 +18,8 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_uikitclipboard_h -#define _SDL_uikitclipboard_h +#ifndef SDL_uikitclipboard_h_ +#define SDL_uikitclipboard_h_ #include "../SDL_sysvideo.h" @@ -30,6 +30,6 @@ extern SDL_bool UIKit_HasClipboardText(_THIS); extern void UIKit_InitClipboard(_THIS); extern void UIKit_QuitClipboard(_THIS); -#endif /* _SDL_uikitclipboard_h */ +#endif /* SDL_uikitclipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitclipboard.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitclipboard.m index 050d5885f..b1d4f6d01 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitclipboard.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitclipboard.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitevents.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitevents.h index 9b1d60c59..0c488291b 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitevents.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,13 +18,13 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_uikitevents_h -#define _SDL_uikitevents_h +#ifndef SDL_uikitevents_h_ +#define SDL_uikitevents_h_ #include "../SDL_sysvideo.h" extern void UIKit_PumpEvents(_THIS); -#endif /* _SDL_uikitevents_h */ +#endif /* SDL_uikitevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitevents.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitevents.m index 7083e204b..d64e3301c 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitevents.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitevents.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitmessagebox.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitmessagebox.h index 528072413..a766b577c 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitmessagebox.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,7 @@ #if SDL_VIDEO_DRIVER_UIKIT -extern SDL_bool UIKit_ShowingMessageBox(); +extern SDL_bool UIKit_ShowingMessageBox(void); extern int UIKit_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid); diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitmessagebox.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitmessagebox.m index 5778032a0..7950c8e69 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitmessagebox.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitmessagebox.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,7 +31,7 @@ static SDL_bool s_showingMessageBox = SDL_FALSE; SDL_bool -UIKit_ShowingMessageBox() +UIKit_ShowingMessageBox(void) { return s_showingMessageBox; } @@ -109,6 +109,18 @@ UIKit_ShowMessageBoxAlertController(const SDL_MessageBoxData *messageboxdata, in alertwindow.hidden = YES; } + /* Force the main SDL window to re-evaluate home indicator state */ + SDL_Window *focus = SDL_GetFocusWindow(); + if (focus) { + SDL_WindowData *data = (__bridge SDL_WindowData *) focus->driverdata; + if (data != nil) { + if (@available(iOS 11.0, *)) { + [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfHomeIndicatorAutoHidden) withObject:nil waitUntilDone:NO]; + [data.viewcontroller performSelectorOnMainThread:@selector(setNeedsUpdateOfScreenEdgesDeferringSystemGestures) withObject:nil waitUntilDone:NO]; + } + } + } + *buttonid = messageboxdata->buttons[clickedindex].buttonid; return YES; #else diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitmetalview.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitmetalview.h new file mode 100644 index 000000000..bc977781f --- /dev/null +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitmetalview.h @@ -0,0 +1,58 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + */ + +/* + * @author Mark Callow, www.edgewise-consulting.com. + * + * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing + * how to add a CAMetalLayer backed view. + */ + +#ifndef SDL_uikitmetalview_h_ +#define SDL_uikitmetalview_h_ + +#import "../SDL_sysvideo.h" +#import "SDL_uikitwindow.h" + +#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN) + +#import +#import +#import + +#define METALVIEW_TAG 255 + +@interface SDL_uikitmetalview : SDL_uikitview + +- (instancetype)initWithFrame:(CGRect)frame + scale:(CGFloat)scale; + +@end + +SDL_uikitmetalview* UIKit_Mtl_AddMetalView(SDL_Window* window); + +void UIKit_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h); + +#endif /* SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN) */ + +#endif /* SDL_uikitmetalview_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitmetalview.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitmetalview.m new file mode 100644 index 000000000..104189d8c --- /dev/null +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitmetalview.m @@ -0,0 +1,124 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + */ + +/* + * @author Mark Callow, www.edgewise-consulting.com. + * + * Thanks to Alex Szpakowski, @slime73 on GitHub, for his gist showing + * how to add a CAMetalLayer backed view. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN) + +#import "../SDL_sysvideo.h" +#import "SDL_uikitwindow.h" +#import "SDL_uikitmetalview.h" + +#include "SDL_assert.h" + +@implementation SDL_uikitmetalview + +/* Returns a Metal-compatible layer. */ ++ (Class)layerClass +{ + return [CAMetalLayer class]; +} + +- (instancetype)initWithFrame:(CGRect)frame + scale:(CGFloat)scale +{ + if ((self = [super initWithFrame:frame])) { + self.tag = METALVIEW_TAG; + /* Set the desired scale. The default drawableSize of a CAMetalLayer + * is its bounds x its scale so nothing further needs to be done. */ + self.layer.contentsScale = scale; + } + + return self; +} + +/* Set the size of the metal drawables when the view is resized. */ +- (void)layoutSubviews +{ + [super layoutSubviews]; +} + +@end + +SDL_uikitmetalview* +UIKit_Mtl_AddMetalView(SDL_Window* window) +{ + SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata; + SDL_uikitview *view = (SDL_uikitview*)data.uiwindow.rootViewController.view; + CGFloat scale = 1.0; + + if ([view isKindOfClass:[SDL_uikitmetalview class]]) { + return (SDL_uikitmetalview *)view; + } + + if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) { + /* Set the scale to the natural scale factor of the screen - then + * the backing dimensions of the Metal view will match the pixel + * dimensions of the screen rather than the dimensions in points + * yielding high resolution on retine displays. + */ +#ifdef __IPHONE_8_0 + if ([data.uiwindow.screen respondsToSelector:@selector(nativeScale)]) { + scale = data.uiwindow.screen.nativeScale; + } else +#endif + { + scale = data.uiwindow.screen.scale; + } + } + SDL_uikitmetalview *metalview + = [[SDL_uikitmetalview alloc] initWithFrame:view.frame + scale:scale]; + [metalview setSDLWindow:window]; + + return metalview; +} + +void +UIKit_Mtl_GetDrawableSize(SDL_Window * window, int * w, int * h) +{ + @autoreleasepool { + SDL_WindowData *data = (__bridge SDL_WindowData *)window->driverdata; + SDL_uikitview *view = (SDL_uikitview*)data.uiwindow.rootViewController.view; + SDL_uikitmetalview* metalview = [view viewWithTag:METALVIEW_TAG]; + if (metalview) { + CAMetalLayer *layer = (CAMetalLayer*)metalview.layer; + assert(layer != NULL); + if (w) { + *w = layer.drawableSize.width; + } + if (h) { + *h = layer.drawableSize.height; + } + } else { + SDL_GetWindowSize(window, w, h); + } + } +} + +#endif /* SDL_VIDEO_DRIVER_UIKIT && (SDL_VIDEO_RENDER_METAL || SDL_VIDEO_VULKAN) */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitmodes.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitmodes.h index b936df616..a1df0d496 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitmodes.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_uikitmodes_h -#define _SDL_uikitmodes_h +#ifndef SDL_uikitmodes_h_ +#define SDL_uikitmodes_h_ #include "SDL_uikitvideo.h" @@ -45,6 +45,6 @@ extern int UIKit_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMo extern void UIKit_QuitModes(_THIS); extern int UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect); -#endif /* _SDL_uikitmodes_h */ +#endif /* SDL_uikitmodes_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitmodes.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitmodes.m index cd3b8d08e..75e256bbf 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitmodes.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitmodes.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -68,21 +68,33 @@ UIKit_FreeDisplayModeData(SDL_DisplayMode * mode) } } +static NSUInteger +UIKit_GetDisplayModeRefreshRate(UIScreen *uiscreen) +{ +#ifdef __IPHONE_10_3 + if ([uiscreen respondsToSelector:@selector(maximumFramesPerSecond)]) { + return uiscreen.maximumFramesPerSecond; + } +#endif + return 0; +} + static int UIKit_AddSingleDisplayMode(SDL_VideoDisplay * display, int w, int h, - UIScreenMode * uiscreenmode) + UIScreen * uiscreen, UIScreenMode * uiscreenmode) { SDL_DisplayMode mode; SDL_zero(mode); - mode.format = SDL_PIXELFORMAT_ABGR8888; - mode.refresh_rate = 0; if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode) < 0) { return -1; } + mode.format = SDL_PIXELFORMAT_ABGR8888; + mode.refresh_rate = (int) UIKit_GetDisplayModeRefreshRate(uiscreen); mode.w = w; mode.h = h; + if (SDL_AddDisplayMode(display, &mode)) { return 0; } else { @@ -92,16 +104,16 @@ UIKit_AddSingleDisplayMode(SDL_VideoDisplay * display, int w, int h, } static int -UIKit_AddDisplayMode(SDL_VideoDisplay * display, int w, int h, +UIKit_AddDisplayMode(SDL_VideoDisplay * display, int w, int h, UIScreen * uiscreen, UIScreenMode * uiscreenmode, SDL_bool addRotation) { - if (UIKit_AddSingleDisplayMode(display, w, h, uiscreenmode) < 0) { + if (UIKit_AddSingleDisplayMode(display, w, h, uiscreen, uiscreenmode) < 0) { return -1; } if (addRotation) { /* Add the rotated version */ - if (UIKit_AddSingleDisplayMode(display, h, w, uiscreenmode) < 0) { + if (UIKit_AddSingleDisplayMode(display, h, w, uiscreen, uiscreenmode) < 0) { return -1; } } @@ -112,7 +124,11 @@ UIKit_AddDisplayMode(SDL_VideoDisplay * display, int w, int h, static int UIKit_AddDisplay(UIScreen *uiscreen) { + UIScreenMode *uiscreenmode = uiscreen.currentMode; CGSize size = uiscreen.bounds.size; + SDL_VideoDisplay display; + SDL_DisplayMode mode; + SDL_zero(mode); /* Make sure the width/height are oriented correctly */ if (UIKit_IsDisplayLandscape(uiscreen) != (size.width > size.height)) { @@ -121,15 +137,11 @@ UIKit_AddDisplay(UIScreen *uiscreen) size.height = height; } - SDL_VideoDisplay display; - SDL_DisplayMode mode; - SDL_zero(mode); mode.format = SDL_PIXELFORMAT_ABGR8888; + mode.refresh_rate = (int) UIKit_GetDisplayModeRefreshRate(uiscreen); mode.w = (int) size.width; mode.h = (int) size.height; - UIScreenMode *uiscreenmode = uiscreen.currentMode; - if (UIKit_AllocateDisplayModeData(&mode, uiscreenmode) < 0) { return -1; } @@ -220,7 +232,7 @@ UIKit_GetDisplayModes(_THIS, SDL_VideoDisplay * display) h = tmp; } - UIKit_AddDisplayMode(display, w, h, uimode, addRotation); + UIKit_AddDisplayMode(display, w, h, data.uiscreen, uimode, addRotation); } } } @@ -261,6 +273,7 @@ UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) @autoreleasepool { int displayIndex = (int) (display - _this->displays); SDL_DisplayData *data = (__bridge SDL_DisplayData *) display->driverdata; + CGRect frame = data.uiscreen.bounds; /* the default function iterates displays to make a fake offset, as if all the displays were side-by-side, which is fine for iOS. */ @@ -268,9 +281,7 @@ UIKit_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) return -1; } - CGRect frame = data.uiscreen.bounds; - -#if !TARGET_OS_TV +#if !TARGET_OS_TV && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0 if (!UIKit_IsSystemVersionAtLeast(7.0)) { frame = [data.uiscreen applicationFrame]; } diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitopengles.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitopengles.h index b52e42913..6b57289ff 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitopengles.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,8 +18,8 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_uikitopengles -#define _SDL_uikitopengles +#ifndef SDL_uikitopengles_ +#define SDL_uikitopengles_ #include "../SDL_sysvideo.h" @@ -27,14 +27,14 @@ extern int UIKit_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern void UIKit_GL_GetDrawableSize(_THIS, SDL_Window * window, int * w, int * h); -extern void UIKit_GL_SwapWindow(_THIS, SDL_Window * window); +extern int UIKit_GL_SwapWindow(_THIS, SDL_Window * window); extern SDL_GLContext UIKit_GL_CreateContext(_THIS, SDL_Window * window); extern void UIKit_GL_DeleteContext(_THIS, SDL_GLContext context); extern void *UIKit_GL_GetProcAddress(_THIS, const char *proc); extern int UIKit_GL_LoadLibrary(_THIS, const char *path); -extern void UIKit_GL_RestoreCurrentContext(); +extern void UIKit_GL_RestoreCurrentContext(void); -#endif +#endif /* SDL_uikitopengles_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitopengles.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitopengles.m index 461ff9b80..2f6dec45e 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitopengles.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitopengles.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -111,7 +111,7 @@ UIKit_GL_LoadLibrary(_THIS, const char *path) return 0; } -void UIKit_GL_SwapWindow(_THIS, SDL_Window * window) +int UIKit_GL_SwapWindow(_THIS, SDL_Window * window) { @autoreleasepool { SDLEAGLContext *context = (__bridge SDLEAGLContext *) SDL_GL_GetCurrentContext(); @@ -127,6 +127,7 @@ void UIKit_GL_SwapWindow(_THIS, SDL_Window * window) * We don't pump events here because we don't want iOS application events * (low memory, terminate, etc.) to happen inside low level rendering. */ } + return 0; } SDL_GLContext @@ -227,7 +228,7 @@ UIKit_GL_DeleteContext(_THIS, SDL_GLContext context) } void -UIKit_GL_RestoreCurrentContext() +UIKit_GL_RestoreCurrentContext(void) { @autoreleasepool { /* Some iOS system functionality (such as Dictation on the on-screen diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitopenglview.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitopenglview.h index 86fb5e12e..8d12c9ff8 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitopenglview.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitopenglview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitopenglview.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitopenglview.m index aae7ee8f2..b0628bfdb 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitopenglview.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitopenglview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitvideo.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitvideo.h index aafb714d7..e24183a0b 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitvideo.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,8 +18,8 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_uikitvideo_h -#define _SDL_uikitvideo_h +#ifndef SDL_uikitvideo_h_ +#define SDL_uikitvideo_h_ #include "../SDL_sysvideo.h" @@ -29,7 +29,7 @@ @interface SDL_VideoData : NSObject -@property (nonatomic) id pasteboardObserver; +@property (nonatomic, assign) id pasteboardObserver; @end @@ -41,6 +41,6 @@ void UIKit_SuspendScreenSaver(_THIS); SDL_bool UIKit_IsSystemVersionAtLeast(double version); -#endif /* _SDL_uikitvideo_h */ +#endif /* SDL_uikitvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitvideo.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitvideo.m index 88d461751..e74339f42 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitvideo.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitvideo.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -37,6 +37,7 @@ #include "SDL_uikitwindow.h" #include "SDL_uikitopengles.h" #include "SDL_uikitclipboard.h" +#include "SDL_uikitvulkan.h" #define UIKITVID_DRIVER_NAME "uikit" @@ -90,7 +91,7 @@ UIKit_CreateDevice(int devindex) device->SetDisplayMode = UIKit_SetDisplayMode; device->PumpEvents = UIKit_PumpEvents; device->SuspendScreenSaver = UIKit_SuspendScreenSaver; - device->CreateWindow = UIKit_CreateWindow; + device->CreateSDLWindow = UIKit_CreateWindow; device->SetWindowTitle = UIKit_SetWindowTitle; device->ShowWindow = UIKit_ShowWindow; device->HideWindow = UIKit_HideWindow; @@ -101,13 +102,13 @@ UIKit_CreateDevice(int devindex) device->GetWindowWMInfo = UIKit_GetWindowWMInfo; device->GetDisplayUsableBounds = UIKit_GetDisplayUsableBounds; - #if SDL_IPHONE_KEYBOARD +#if SDL_IPHONE_KEYBOARD device->HasScreenKeyboardSupport = UIKit_HasScreenKeyboardSupport; device->ShowScreenKeyboard = UIKit_ShowScreenKeyboard; device->HideScreenKeyboard = UIKit_HideScreenKeyboard; device->IsScreenKeyboardShown = UIKit_IsScreenKeyboardShown; device->SetTextInputRect = UIKit_SetTextInputRect; - #endif +#endif device->SetClipboardText = UIKit_SetClipboardText; device->GetClipboardText = UIKit_GetClipboardText; @@ -123,6 +124,15 @@ UIKit_CreateDevice(int devindex) device->GL_LoadLibrary = UIKit_GL_LoadLibrary; device->free = UIKit_DeleteDevice; +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = UIKit_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = UIKit_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions + = UIKit_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = UIKit_Vulkan_CreateSurface; + device->Vulkan_GetDrawableSize = UIKit_Vulkan_GetDrawableSize; +#endif + device->gl_config.accelerated = 1; return device; @@ -176,18 +186,39 @@ UIKit_IsSystemVersionAtLeast(double version) CGRect UIKit_ComputeViewFrame(SDL_Window *window, UIScreen *screen) { + CGRect frame = screen.bounds; + #if !TARGET_OS_TV && (__IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0) BOOL hasiOS7 = UIKit_IsSystemVersionAtLeast(7.0); - if (hasiOS7 || (window->flags & (SDL_WINDOW_BORDERLESS|SDL_WINDOW_FULLSCREEN))) { - /* The view should always show behind the status bar in iOS 7+. */ - return screen.bounds; - } else { - return screen.applicationFrame; + /* The view should always show behind the status bar in iOS 7+. */ + if (!hasiOS7 && !(window->flags & (SDL_WINDOW_BORDERLESS|SDL_WINDOW_FULLSCREEN))) { + frame = screen.applicationFrame; } -#else - return screen.bounds; #endif + +#if !TARGET_OS_TV + /* iOS 10 seems to have a bug where, in certain conditions, putting the + * device to sleep with the a landscape-only app open, re-orienting the + * device to portrait, and turning it back on will result in the screen + * bounds returning portrait orientation despite the app being in landscape. + * This is a workaround until a better solution can be found. + * https://bugzilla.libsdl.org/show_bug.cgi?id=3505 + * https://bugzilla.libsdl.org/show_bug.cgi?id=3465 + * https://forums.developer.apple.com/thread/65337 */ + if (UIKit_IsSystemVersionAtLeast(8.0)) { + UIInterfaceOrientation orient = [UIApplication sharedApplication].statusBarOrientation; + BOOL isLandscape = UIInterfaceOrientationIsLandscape(orient); + + if (isLandscape != (frame.size.width > frame.size.height)) { + float height = frame.size.width; + frame.size.width = frame.size.height; + frame.size.height = height; + } + } +#endif + + return frame; } /* diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitview.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitview.h index 18fa78f36..4457f6c25 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitview.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitview.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitview.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitview.m index c7d9f51d9..bd60c552f 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitview.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitview.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ #include "SDL_uikitview.h" +#include "SDL_hints.h" #include "../../events/SDL_mouse_c.h" #include "../../events/SDL_touch_c.h" #include "../../events/SDL_events_c.h" @@ -32,6 +33,9 @@ #import "SDL_uikitmodes.h" #import "SDL_uikitwindow.h" +/* This is defined in SDL_sysjoystick.m */ +extern int SDL_AppleTVRemoteOpenedAsJoystick; + @implementation SDL_uikitview { SDL_Window *sdlwindow; @@ -42,6 +46,25 @@ - (instancetype)initWithFrame:(CGRect)frame { if ((self = [super initWithFrame:frame])) { +#if TARGET_OS_TV + /* Apple TV Remote touchpad swipe gestures. */ + UISwipeGestureRecognizer *swipeUp = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)]; + swipeUp.direction = UISwipeGestureRecognizerDirectionUp; + [self addGestureRecognizer:swipeUp]; + + UISwipeGestureRecognizer *swipeDown = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)]; + swipeDown.direction = UISwipeGestureRecognizerDirectionDown; + [self addGestureRecognizer:swipeDown]; + + UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)]; + swipeLeft.direction = UISwipeGestureRecognizerDirectionLeft; + [self addGestureRecognizer:swipeLeft]; + + UISwipeGestureRecognizer *swipeRight = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(swipeGesture:)]; + swipeRight.direction = UISwipeGestureRecognizerDirectionRight; + [self addGestureRecognizer:swipeRight]; +#endif + self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; self.autoresizesSubviews = YES; @@ -215,10 +238,10 @@ return SDL_SCANCODE_RIGHT; case UIPressTypeSelect: /* HIG says: "primary button behavior" */ - return SDL_SCANCODE_SELECT; + return SDL_SCANCODE_RETURN; case UIPressTypeMenu: /* HIG says: "returns to previous screen" */ - return SDL_SCANCODE_MENU; + return SDL_SCANCODE_ESCAPE; case UIPressTypePlayPause: /* HIG says: "secondary button behavior" */ return SDL_SCANCODE_PAUSE; @@ -229,31 +252,34 @@ - (void)pressesBegan:(NSSet *)presses withEvent:(UIPressesEvent *)event { - for (UIPress *press in presses) { - SDL_Scancode scancode = [self scancodeFromPressType:press.type]; - SDL_SendKeyboardKey(SDL_PRESSED, scancode); - } - + if (!SDL_AppleTVRemoteOpenedAsJoystick) { + for (UIPress *press in presses) { + SDL_Scancode scancode = [self scancodeFromPressType:press.type]; + SDL_SendKeyboardKey(SDL_PRESSED, scancode); + } + } [super pressesBegan:presses withEvent:event]; } - (void)pressesEnded:(NSSet *)presses withEvent:(UIPressesEvent *)event { - for (UIPress *press in presses) { - SDL_Scancode scancode = [self scancodeFromPressType:press.type]; - SDL_SendKeyboardKey(SDL_RELEASED, scancode); - } - + if (!SDL_AppleTVRemoteOpenedAsJoystick) { + for (UIPress *press in presses) { + SDL_Scancode scancode = [self scancodeFromPressType:press.type]; + SDL_SendKeyboardKey(SDL_RELEASED, scancode); + } + } [super pressesEnded:presses withEvent:event]; } - (void)pressesCancelled:(NSSet *)presses withEvent:(UIPressesEvent *)event { - for (UIPress *press in presses) { - SDL_Scancode scancode = [self scancodeFromPressType:press.type]; - SDL_SendKeyboardKey(SDL_RELEASED, scancode); - } - + if (!SDL_AppleTVRemoteOpenedAsJoystick) { + for (UIPress *press in presses) { + SDL_Scancode scancode = [self scancodeFromPressType:press.type]; + SDL_SendKeyboardKey(SDL_RELEASED, scancode); + } + } [super pressesCancelled:presses withEvent:event]; } @@ -264,6 +290,37 @@ } #endif /* TARGET_OS_TV || defined(__IPHONE_9_1) */ +#if TARGET_OS_TV +-(void)swipeGesture:(UISwipeGestureRecognizer *)gesture +{ + /* Swipe gestures don't trigger begin states. */ + if (gesture.state == UIGestureRecognizerStateEnded) { + if (!SDL_AppleTVRemoteOpenedAsJoystick) { + /* Send arrow key presses for now, as we don't have an external API + * which better maps to swipe gestures. */ + switch (gesture.direction) { + case UISwipeGestureRecognizerDirectionUp: + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_UP); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_UP); + break; + case UISwipeGestureRecognizerDirectionDown: + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_DOWN); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_DOWN); + break; + case UISwipeGestureRecognizerDirectionLeft: + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_LEFT); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_LEFT); + break; + case UISwipeGestureRecognizerDirectionRight: + SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RIGHT); + SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RIGHT); + break; + } + } + } +} +#endif /* TARGET_OS_TV */ + @end #endif /* SDL_VIDEO_DRIVER_UIKIT */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitviewcontroller.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitviewcontroller.h index 860852441..fffb14223 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitviewcontroller.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitviewcontroller.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -58,6 +58,10 @@ #if !TARGET_OS_TV - (NSUInteger)supportedInterfaceOrientations; - (BOOL)prefersStatusBarHidden; +- (BOOL)prefersHomeIndicatorAutoHidden; +- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures; + +@property (nonatomic, assign) int homeIndicatorHidden; #endif #if SDL_IPHONE_KEYBOARD diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitviewcontroller.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitviewcontroller.m index e6e903ee4..296274235 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitviewcontroller.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitviewcontroller.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,7 +40,7 @@ #endif #if TARGET_OS_TV -static void +static void SDLCALL SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) { @autoreleasepool { @@ -50,6 +50,21 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char } #endif +#if !TARGET_OS_TV +static void SDLCALL +SDL_HideHomeIndicatorHintChanged(void *userdata, const char *name, const char *oldValue, const char *hint) +{ + @autoreleasepool { + SDL_uikitviewcontroller *viewcontroller = (__bridge SDL_uikitviewcontroller *) userdata; + viewcontroller.homeIndicatorHidden = (hint && *hint) ? SDL_atoi(hint) : -1; + if (@available(iOS 11.0, *)) { + [viewcontroller setNeedsUpdateOfHomeIndicatorAutoHidden]; + [viewcontroller setNeedsUpdateOfScreenEdgesDeferringSystemGestures]; + } + } +} +#endif + @implementation SDL_uikitviewcontroller { CADisplayLink *displayLink; int animationInterval; @@ -58,6 +73,7 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char #if SDL_IPHONE_KEYBOARD UITextField *textField; + BOOL rotatingOrientation; #endif } @@ -70,6 +86,7 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char #if SDL_IPHONE_KEYBOARD [self initKeyboard]; + rotatingOrientation = FALSE; #endif #if TARGET_OS_TV @@ -77,6 +94,12 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char SDL_AppleTVControllerUIHintChanged, (__bridge void *) self); #endif + +#if !TARGET_OS_TV + SDL_AddHintCallback(SDL_HINT_IOS_HIDE_HOME_INDICATOR, + SDL_HideHomeIndicatorHintChanged, + (__bridge void *) self); +#endif } return self; } @@ -92,6 +115,12 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char SDL_AppleTVControllerUIHintChanged, (__bridge void *) self); #endif + +#if !TARGET_OS_TV + SDL_DelHintCallback(SDL_HINT_IOS_HIDE_HOME_INDICATOR, + SDL_HideHomeIndicatorHintChanged, + (__bridge void *) self); +#endif } - (void)setAnimationCallback:(int)interval @@ -112,7 +141,22 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char - (void)startAnimation { displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(doLoop:)]; - [displayLink setFrameInterval:animationInterval]; + +#ifdef __IPHONE_10_3 + SDL_WindowData *data = (__bridge SDL_WindowData *) window->driverdata; + + if ([displayLink respondsToSelector:@selector(preferredFramesPerSecond)] + && data != nil && data.uiwindow != nil + && [data.uiwindow.screen respondsToSelector:@selector(maximumFramesPerSecond)]) { + displayLink.preferredFramesPerSecond = data.uiwindow.screen.maximumFramesPerSecond / animationInterval; + } else +#endif + { +#if __IPHONE_OS_VERSION_MIN_REQUIRED < 100300 + [displayLink setFrameInterval:animationInterval]; +#endif + } + [displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; } @@ -153,14 +197,44 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char return UIKit_GetSupportedOrientations(window); } +#if __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_7_0 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)orient { return ([self supportedInterfaceOrientations] & (1 << orient)) != 0; } +#endif - (BOOL)prefersStatusBarHidden { - return (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) != 0; + BOOL hidden = (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) != 0; + return hidden; +} + +- (BOOL)prefersHomeIndicatorAutoHidden +{ + BOOL hidden = NO; + if (self.homeIndicatorHidden == 1) { + hidden = YES; + } + return hidden; +} + +- (UIRectEdge)preferredScreenEdgesDeferringSystemGestures +{ + if (self.homeIndicatorHidden >= 0) { + if (self.homeIndicatorHidden == 2) { + return UIRectEdgeAll; + } else { + return UIRectEdgeNone; + } + } + + /* By default, fullscreen and borderless windows get all screen gestures */ + if ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_BORDERLESS)) != 0) { + return UIRectEdgeAll; + } else { + return UIRectEdgeNone; + } } #endif @@ -211,6 +285,29 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char } } +/* willRotateToInterfaceOrientation and didRotateFromInterfaceOrientation are deprecated in iOS 8+ in favor of viewWillTransitionToSize */ +#if TARGET_OS_TV || __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000 +- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator +{ + [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; + rotatingOrientation = TRUE; + [coordinator animateAlongsideTransition:^(id context) {} + completion:^(id context) { + rotatingOrientation = FALSE; + }]; +} +#else +- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { + [super willRotateToInterfaceOrientation:toInterfaceOrientation duration:duration]; + rotatingOrientation = TRUE; +} + +- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation { + [super didRotateFromInterfaceOrientation:fromInterfaceOrientation]; + rotatingOrientation = FALSE; +} +#endif /* TARGET_OS_TV || __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000 */ + - (void)deinitKeyboard { #if !TARGET_OS_TV @@ -239,7 +336,7 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char - (void)keyboardWillShow:(NSNotification *)notification { #if !TARGET_OS_TV - CGRect kbrect = [[notification userInfo][UIKeyboardFrameBeginUserInfoKey] CGRectValue]; + CGRect kbrect = [[notification userInfo][UIKeyboardFrameEndUserInfoKey] CGRectValue]; /* The keyboard rect is in the coordinate space of the screen/window, but we * want its height in the coordinate space of the view. */ @@ -251,7 +348,9 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char - (void)keyboardWillHide:(NSNotification *)notification { - SDL_StopTextInput(); + if (!rotatingOrientation) { + SDL_StopTextInput(); + } [self setKeyboardHeight:0]; } @@ -343,7 +442,9 @@ SDL_AppleTVControllerUIHintChanged(void *userdata, const char *name, const char { SDL_SendKeyboardKey(SDL_PRESSED, SDL_SCANCODE_RETURN); SDL_SendKeyboardKey(SDL_RELEASED, SDL_SCANCODE_RETURN); - SDL_StopTextInput(); + if (SDL_GetHintBoolean(SDL_HINT_RETURN_KEY_HIDES_IME, SDL_FALSE)) { + SDL_StopTextInput(); + } return YES; } diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitvulkan.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitvulkan.h new file mode 100644 index 000000000..e3ec350d8 --- /dev/null +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitvulkan.h @@ -0,0 +1,54 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.h. + */ + +#include "../../SDL_internal.h" + +#ifndef SDL_uikitvulkan_h_ +#define SDL_uikitvulkan_h_ + +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_UIKIT + +int UIKit_Vulkan_LoadLibrary(_THIS, const char *path); +void UIKit_Vulkan_UnloadLibrary(_THIS); +SDL_bool UIKit_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool UIKit_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +void UIKit_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h); + +#endif + +#endif /* SDL_uikitvulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitvulkan.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitvulkan.m new file mode 100644 index 000000000..771c7a475 --- /dev/null +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitvulkan.m @@ -0,0 +1,222 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.c. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_UIKIT + +#include "SDL_uikitvideo.h" +#include "SDL_uikitwindow.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_uikitvulkan.h" +#include "SDL_uikitmetalview.h" +#include "SDL_syswm.h" + +#include + +#define DEFAULT_MOLTENVK "libMoltenVK.dylib" +/* Since libSDL is static, could use RTLD_SELF. Using RTLD_DEFAULT is future + * proofing. */ +#define DEFAULT_HANDLE RTLD_DEFAULT + +int UIKit_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasIOSSurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + + if (_this->vulkan_config.loader_handle) { + return SDL_SetError("MoltenVK/Vulkan already loaded"); + } + + /* Load the Vulkan loader library */ + if (!path) { + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + } + + if (!path) { + /* MoltenVK framework, currently, v0.17.0, has a static library and is + * the recommended way to use the package. There is likely no object to + * load. */ + vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)dlsym(DEFAULT_HANDLE, + "vkGetInstanceProcAddr"); + } + + if (vkGetInstanceProcAddr) { + _this->vulkan_config.loader_handle = DEFAULT_HANDLE; + } else { + if (!path) { + /* Look for the .dylib packaged with the application instead. */ + path = DEFAULT_MOLTENVK; + } + + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if (!_this->vulkan_config.loader_handle) { + return -1; + } + SDL_strlcpy(_this->vulkan_config.loader_path, path, + SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, + "vkGetInstanceProcAddr"); + } + + if (!vkGetInstanceProcAddr) { + SDL_SetError("Failed to find %s in either executable or %s: %s", + "vkGetInstanceProcAddr", + DEFAULT_MOLTENVK, + (const char *) dlerror()); + goto fail; + } + + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + + if (!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) { + SDL_SetError("No vkEnumerateInstanceExtensionProperties found."); + goto fail; + } + + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + + if (!extensions) { + goto fail; + } + + for (Uint32 i = 0; i < extensionCount; i++) { + if (SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) { + hasSurfaceExtension = SDL_TRUE; + } else if (SDL_strcmp(VK_MVK_IOS_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) { + hasIOSSurfaceExtension = SDL_TRUE; + } + } + + SDL_free(extensions); + + if (!hasSurfaceExtension) { + SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } else if (!hasIOSSurfaceExtension) { + SDL_SetError("Installed MoltenVK/Vulkan doesn't implement the " + VK_MVK_IOS_SURFACE_EXTENSION_NAME "extension"); + goto fail; + } + + return 0; + +fail: + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void UIKit_Vulkan_UnloadLibrary(_THIS) +{ + if (_this->vulkan_config.loader_handle) { + if (_this->vulkan_config.loader_handle != DEFAULT_HANDLE) { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + } + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool UIKit_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForUIKit[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_MVK_IOS_SURFACE_EXTENSION_NAME + }; + if (!_this->vulkan_config.loader_handle) { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForUIKit), + extensionsForUIKit); +} + +SDL_bool UIKit_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + PFN_vkCreateIOSSurfaceMVK vkCreateIOSSurfaceMVK = + (PFN_vkCreateIOSSurfaceMVK)vkGetInstanceProcAddr( + (VkInstance)instance, + "vkCreateIOSSurfaceMVK"); + VkIOSSurfaceCreateInfoMVK createInfo = {}; + VkResult result; + + if (!_this->vulkan_config.loader_handle) { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + if (!vkCreateIOSSurfaceMVK) { + SDL_SetError(VK_MVK_IOS_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + + createInfo.sType = VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.pView = (__bridge void *)UIKit_Mtl_AddMetalView(window); + result = vkCreateIOSSurfaceMVK(instance, &createInfo, + NULL, surface); + if (result != VK_SUCCESS) { + SDL_SetError("vkCreateIOSSurfaceMVK failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + + return SDL_TRUE; +} + +void UIKit_Vulkan_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h) +{ + UIKit_Mtl_GetDrawableSize(window, w, h); +} + +#endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitwindow.h b/Engine/lib/sdl/src/video/uikit/SDL_uikitwindow.h index ed08c55d4..46073eef0 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitwindow.h +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -18,8 +18,8 @@ misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_uikitwindow_h -#define _SDL_uikitwindow_h +#ifndef SDL_uikitwindow_h_ +#define SDL_uikitwindow_h_ #include "../SDL_sysvideo.h" #import "SDL_uikitvideo.h" @@ -51,6 +51,6 @@ extern NSUInteger UIKit_GetSupportedOrientations(SDL_Window * window); @end -#endif /* _SDL_uikitwindow_h */ +#endif /* SDL_uikitwindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/uikit/SDL_uikitwindow.m b/Engine/lib/sdl/src/video/uikit/SDL_uikitwindow.m index 35c549b43..d01cff349 100644 --- a/Engine/lib/sdl/src/video/uikit/SDL_uikitwindow.m +++ b/Engine/lib/sdl/src/video/uikit/SDL_uikitwindow.m @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -107,6 +107,14 @@ static int SetupWindowData(_THIS, SDL_Window *window, UIWindow *uiwindow, SDL_bo #if !TARGET_OS_TV if (displaydata.uiscreen == [UIScreen mainScreen]) { + /* SDL_CreateWindow sets the window w&h to the display's bounds if the + * fullscreen flag is set. But the display bounds orientation might not + * match what we want, and GetSupportedOrientations call below uses the + * window w&h. They're overridden below anyway, so we'll just set them + * to the requested size for the purposes of determining orientation. */ + window->w = window->windowed.w; + window->h = window->windowed.h; + NSUInteger orients = UIKit_GetSupportedOrientations(window); BOOL supportsLandscape = (orients & UIInterfaceOrientationMaskLandscape) != 0; BOOL supportsPortrait = (orients & (UIInterfaceOrientationMaskPortrait|UIInterfaceOrientationMaskPortraitUpsideDown)) != 0; @@ -360,7 +368,7 @@ UIKit_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/Engine/lib/sdl/src/video/uikit/keyinfotable.h b/Engine/lib/sdl/src/video/uikit/keyinfotable.h index 962dbd922..3b2383747 100644 --- a/Engine/lib/sdl/src/video/uikit/keyinfotable.h +++ b/Engine/lib/sdl/src/video/uikit/keyinfotable.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/vivante/SDL_vivanteopengles.c b/Engine/lib/sdl/src/video/vivante/SDL_vivanteopengles.c index 687cc6a73..135e83881 100644 --- a/Engine/lib/sdl/src/video/vivante/SDL_vivanteopengles.c +++ b/Engine/lib/sdl/src/video/vivante/SDL_vivanteopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,7 +34,7 @@ VIVANTE_GLES_LoadLibrary(_THIS, const char *path) displaydata = SDL_GetDisplayDriverData(0); - return SDL_EGL_LoadLibrary(_this, path, displaydata->native_display); + return SDL_EGL_LoadLibrary(_this, path, displaydata->native_display, 0); } SDL_EGL_CreateContext_impl(VIVANTE) diff --git a/Engine/lib/sdl/src/video/vivante/SDL_vivanteopengles.h b/Engine/lib/sdl/src/video/vivante/SDL_vivanteopengles.h index f47bf7797..162d61ab9 100644 --- a/Engine/lib/sdl/src/video/vivante/SDL_vivanteopengles.h +++ b/Engine/lib/sdl/src/video/vivante/SDL_vivanteopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_vivanteopengles_h -#define _SDL_vivanteopengles_h +#ifndef SDL_vivanteopengles_h_ +#define SDL_vivanteopengles_h_ #if SDL_VIDEO_DRIVER_VIVANTE && SDL_VIDEO_OPENGL_EGL @@ -38,11 +38,11 @@ extern int VIVANTE_GLES_LoadLibrary(_THIS, const char *path); extern SDL_GLContext VIVANTE_GLES_CreateContext(_THIS, SDL_Window * window); -extern void VIVANTE_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int VIVANTE_GLES_SwapWindow(_THIS, SDL_Window * window); extern int VIVANTE_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); #endif /* SDL_VIDEO_DRIVER_VIVANTE && SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_vivanteopengles_h */ +#endif /* SDL_vivanteopengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/vivante/SDL_vivanteplatform.c b/Engine/lib/sdl/src/video/vivante/SDL_vivanteplatform.c index 76233417e..67ea63350 100644 --- a/Engine/lib/sdl/src/video/vivante/SDL_vivanteplatform.c +++ b/Engine/lib/sdl/src/video/vivante/SDL_vivanteplatform.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,6 +32,16 @@ VIVANTE_SetupPlatform(_THIS) return 0; } +char *VIVANTE_GetDisplayName(_THIS) +{ + return NULL; +} + +void +VIVANTE_UpdateDisplayScale(_THIS) +{ +} + void VIVANTE_CleanupPlatform(_THIS) { diff --git a/Engine/lib/sdl/src/video/vivante/SDL_vivanteplatform.h b/Engine/lib/sdl/src/video/vivante/SDL_vivanteplatform.h index 6e11cce62..59fbf6064 100644 --- a/Engine/lib/sdl/src/video/vivante/SDL_vivanteplatform.h +++ b/Engine/lib/sdl/src/video/vivante/SDL_vivanteplatform.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_vivanteplatform_h -#define _SDL_vivanteplatform_h +#ifndef SDL_vivanteplatform_h_ +#define SDL_vivanteplatform_h_ #if SDL_VIDEO_DRIVER_VIVANTE @@ -36,10 +36,12 @@ #endif extern int VIVANTE_SetupPlatform(_THIS); +extern char *VIVANTE_GetDisplayName(_THIS); +extern void VIVANTE_UpdateDisplayScale(_THIS); extern void VIVANTE_CleanupPlatform(_THIS); #endif /* SDL_VIDEO_DRIVER_VIVANTE */ -#endif /* _SDL_vivanteplatform_h */ +#endif /* SDL_vivanteplatform_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/vivante/SDL_vivantevideo.c b/Engine/lib/sdl/src/video/vivante/SDL_vivantevideo.c index 0372de5c3..656ab5567 100644 --- a/Engine/lib/sdl/src/video/vivante/SDL_vivantevideo.c +++ b/Engine/lib/sdl/src/video/vivante/SDL_vivantevideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -88,7 +88,7 @@ VIVANTE_Create() device->VideoQuit = VIVANTE_VideoQuit; device->GetDisplayModes = VIVANTE_GetDisplayModes; device->SetDisplayMode = VIVANTE_SetDisplayMode; - device->CreateWindow = VIVANTE_CreateWindow; + device->CreateSDLWindow = VIVANTE_CreateWindow; device->SetWindowTitle = VIVANTE_SetWindowTitle; device->SetWindowPosition = VIVANTE_SetWindowPosition; device->SetWindowSize = VIVANTE_SetWindowSize; @@ -97,6 +97,7 @@ VIVANTE_Create() device->DestroyWindow = VIVANTE_DestroyWindow; device->GetWindowWMInfo = VIVANTE_GetWindowWMInfo; +#if SDL_VIDEO_OPENGL_EGL device->GL_LoadLibrary = VIVANTE_GLES_LoadLibrary; device->GL_GetProcAddress = VIVANTE_GLES_GetProcAddress; device->GL_UnloadLibrary = VIVANTE_GLES_UnloadLibrary; @@ -106,6 +107,7 @@ VIVANTE_Create() device->GL_GetSwapInterval = VIVANTE_GLES_GetSwapInterval; device->GL_SwapWindow = VIVANTE_GLES_SwapWindow; device->GL_DeleteContext = VIVANTE_GLES_DeleteContext; +#endif device->PumpEvents = VIVANTE_PumpEvents; @@ -152,6 +154,9 @@ VIVANTE_AddVideoDisplays(_THIS) switch (bpp) { default: /* Is another format used? */ + case 32: + current_mode.format = SDL_PIXELFORMAT_ARGB8888; + break; case 16: current_mode.format = SDL_PIXELFORMAT_RGB565; break; @@ -160,6 +165,7 @@ VIVANTE_AddVideoDisplays(_THIS) current_mode.refresh_rate = 60; SDL_zero(display); + display.name = VIVANTE_GetDisplayName(_this); display.desktop_mode = current_mode; display.current_mode = current_mode; display.driverdata = data; @@ -208,6 +214,8 @@ VIVANTE_VideoInit(_THIS) return -1; } + VIVANTE_UpdateDisplayScale(_this); + #ifdef SDL_INPUT_LINUXEV if (SDL_EVDEV_Init() < 0) { return -1; @@ -281,6 +289,7 @@ VIVANTE_CreateWindow(_THIS, SDL_Window * window) return SDL_SetError("VIVANTE: Can't create native window"); } +#if SDL_VIDEO_OPENGL_EGL if (window->flags & SDL_WINDOW_OPENGL) { data->egl_surface = SDL_EGL_CreateSurface(_this, data->native_window); if (data->egl_surface == EGL_NO_SURFACE) { @@ -289,6 +298,7 @@ VIVANTE_CreateWindow(_THIS, SDL_Window * window) } else { data->egl_surface = EGL_NO_SURFACE; } +#endif /* Window has been successfully created */ return 0; @@ -302,9 +312,11 @@ VIVANTE_DestroyWindow(_THIS, SDL_Window * window) data = window->driverdata; if (data) { +#if SDL_VIDEO_OPENGL_EGL if (data->egl_surface != EGL_NO_SURFACE) { SDL_EGL_DestroySurface(_this, data->egl_surface); } +#endif if (data->native_window) { #if SDL_VIDEO_DRIVER_VIVANTE_VDK @@ -376,7 +388,7 @@ VIVANTE_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info) info->info.vivante.window = data->native_window; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/Engine/lib/sdl/src/video/vivante/SDL_vivantevideo.h b/Engine/lib/sdl/src/video/vivante/SDL_vivantevideo.h index b99c73375..d33556487 100644 --- a/Engine/lib/sdl/src/video/vivante/SDL_vivantevideo.h +++ b/Engine/lib/sdl/src/video/vivante/SDL_vivantevideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_vivantevideo_h -#define _SDL_vivantevideo_h +#ifndef SDL_vivantevideo_h_ +#define SDL_vivantevideo_h_ #include "../../SDL_internal.h" #include "../SDL_sysvideo.h" @@ -86,6 +86,6 @@ SDL_bool VIVANTE_GetWindowWMInfo(_THIS, SDL_Window * window, /* Event functions */ void VIVANTE_PumpEvents(_THIS); -#endif /* _SDL_vivantevideo_h */ +#endif /* SDL_vivantevideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandclipboard.c b/Engine/lib/sdl/src/video/wayland/SDL_waylandclipboard.c new file mode 100644 index 000000000..5fd826b9b --- /dev/null +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandclipboard.c @@ -0,0 +1,123 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_WAYLAND + +#include "SDL_waylanddatamanager.h" +#include "SDL_waylandevents_c.h" + +int +Wayland_SetClipboardText(_THIS, const char *text) +{ + SDL_VideoData *video_data = NULL; + SDL_WaylandDataDevice *data_device = NULL; + + int status = 0; + + if (_this == NULL || _this->driverdata == NULL) { + status = SDL_SetError("Video driver uninitialized"); + } else { + video_data = _this->driverdata; + /* TODO: Support more than one seat */ + data_device = Wayland_get_data_device(video_data->input); + if (text[0] != '\0') { + SDL_WaylandDataSource* source = Wayland_data_source_create(_this); + Wayland_data_source_add_data(source, TEXT_MIME, text, + strlen(text) + 1); + + status = Wayland_data_device_set_selection(data_device, source); + if (status != 0) { + Wayland_data_source_destroy(source); + } + } else { + status = Wayland_data_device_clear_selection(data_device); + } + } + + return status; +} + +char * +Wayland_GetClipboardText(_THIS) +{ + SDL_VideoData *video_data = NULL; + SDL_WaylandDataDevice *data_device = NULL; + + char *text = NULL; + + void *buffer = NULL; + size_t length = 0; + + if (_this == NULL || _this->driverdata == NULL) { + SDL_SetError("Video driver uninitialized"); + } else { + video_data = _this->driverdata; + /* TODO: Support more than one seat */ + data_device = Wayland_get_data_device(video_data->input); + if (data_device->selection_offer != NULL) { + buffer = Wayland_data_offer_receive(data_device->selection_offer, + &length, TEXT_MIME, SDL_TRUE); + if (length > 0) { + text = (char*) buffer; + } + } else if (data_device->selection_source != NULL) { + buffer = Wayland_data_source_get_data(data_device->selection_source, + &length, TEXT_MIME, SDL_TRUE); + if (length > 0) { + text = (char*) buffer; + } + } + } + + if (text == NULL) { + text = SDL_strdup(""); + } + + return text; +} + +SDL_bool +Wayland_HasClipboardText(_THIS) +{ + SDL_VideoData *video_data = NULL; + SDL_WaylandDataDevice *data_device = NULL; + + SDL_bool result = SDL_FALSE; + if (_this == NULL || _this->driverdata == NULL) { + SDL_SetError("Video driver uninitialized"); + } else { + video_data = _this->driverdata; + data_device = Wayland_get_data_device(video_data->input); + if (data_device != NULL && Wayland_data_offer_has_mime( + data_device->selection_offer, TEXT_MIME)) { + result = SDL_TRUE; + } else if(data_device != NULL && Wayland_data_source_has_mime( + data_device->selection_source, TEXT_MIME)) { + result = SDL_TRUE; + } + } + return result; +} + +#endif /* SDL_VIDEO_DRIVER_WAYLAND */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandclipboard.h b/Engine/lib/sdl/src/video/wayland/SDL_waylandclipboard.h new file mode 100644 index 000000000..467e1c77f --- /dev/null +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandclipboard.h @@ -0,0 +1,32 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_waylandclipboard_h_ +#define SDL_waylandclipboard_h_ + +extern int Wayland_SetClipboardText(_THIS, const char *text); +extern char *Wayland_GetClipboardText(_THIS); +extern SDL_bool Wayland_HasClipboardText(_THIS); + +#endif /* SDL_waylandclipboard_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylanddatamanager.c b/Engine/lib/sdl/src/video/wayland/SDL_waylanddatamanager.c new file mode 100644 index 000000000..f1b9742ce --- /dev/null +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylanddatamanager.c @@ -0,0 +1,468 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_DRIVER_WAYLAND + +#include +#include +#include +#include + +#include "SDL_stdinc.h" +#include "SDL_assert.h" +#include "../../core/unix/SDL_poll.h" + +#include "SDL_waylandvideo.h" +#include "SDL_waylanddatamanager.h" + +#include "SDL_waylanddyn.h" + +static ssize_t +write_pipe(int fd, const void* buffer, size_t total_length, size_t *pos) +{ + int ready = 0; + ssize_t bytes_written = 0; + ssize_t length = total_length - *pos; + + sigset_t sig_set; + sigset_t old_sig_set; + struct timespec zerotime = {0}; + + ready = SDL_IOReady(fd, SDL_TRUE, 1 * 1000); + + sigemptyset(&sig_set); + sigaddset(&sig_set, SIGPIPE); + + pthread_sigmask(SIG_BLOCK, &sig_set, &old_sig_set); + + if (ready == 0) { + bytes_written = SDL_SetError("Pipe timeout"); + } else if (ready < 0) { + bytes_written = SDL_SetError("Pipe select error"); + } else { + if (length > 0) { + bytes_written = write(fd, (Uint8*)buffer + *pos, SDL_min(length, PIPE_BUF)); + } + + if (bytes_written > 0) { + *pos += bytes_written; + } + } + + sigtimedwait(&sig_set, 0, &zerotime); + pthread_sigmask(SIG_SETMASK, &old_sig_set, NULL); + + return bytes_written; +} + +static ssize_t +read_pipe(int fd, void** buffer, size_t* total_length, SDL_bool null_terminate) +{ + int ready = 0; + void* output_buffer = NULL; + char temp[PIPE_BUF]; + size_t new_buffer_length = 0; + ssize_t bytes_read = 0; + size_t pos = 0; + + ready = SDL_IOReady(fd, SDL_FALSE, 1 * 1000); + + if (ready == 0) { + bytes_read = SDL_SetError("Pipe timeout"); + } else if (ready < 0) { + bytes_read = SDL_SetError("Pipe select error"); + } else { + bytes_read = read(fd, temp, sizeof(temp)); + } + + if (bytes_read > 0) { + pos = *total_length; + *total_length += bytes_read; + + if (null_terminate == SDL_TRUE) { + new_buffer_length = *total_length + 1; + } else { + new_buffer_length = *total_length; + } + + if (*buffer == NULL) { + output_buffer = SDL_malloc(new_buffer_length); + } else { + output_buffer = SDL_realloc(*buffer, new_buffer_length); + } + + if (output_buffer == NULL) { + bytes_read = SDL_OutOfMemory(); + } else { + SDL_memcpy((Uint8*)output_buffer + pos, temp, bytes_read); + + if (null_terminate == SDL_TRUE) { + SDL_memset((Uint8*)output_buffer + (new_buffer_length - 1), 0, 1); + } + + *buffer = output_buffer; + } + } + + return bytes_read; +} + +#define MIME_LIST_SIZE 4 + +static const char* mime_conversion_list[MIME_LIST_SIZE][2] = { + {"text/plain", TEXT_MIME}, + {"TEXT", TEXT_MIME}, + {"UTF8_STRING", TEXT_MIME}, + {"STRING", TEXT_MIME} +}; + +const char* +Wayland_convert_mime_type(const char *mime_type) +{ + const char *found = mime_type; + + size_t index = 0; + + for (index = 0; index < MIME_LIST_SIZE; ++index) { + if (strcmp(mime_conversion_list[index][0], mime_type) == 0) { + found = mime_conversion_list[index][1]; + break; + } + } + + return found; +} + +static SDL_MimeDataList* +mime_data_list_find(struct wl_list* list, + const char* mime_type) +{ + SDL_MimeDataList *found = NULL; + + SDL_MimeDataList *mime_list = NULL; + wl_list_for_each(mime_list, list, link) { + if (strcmp(mime_list->mime_type, mime_type) == 0) { + found = mime_list; + break; + } + } + return found; +} + +static int +mime_data_list_add(struct wl_list* list, + const char* mime_type, + void* buffer, size_t length) +{ + int status = 0; + size_t mime_type_length = 0; + + SDL_MimeDataList *mime_data = NULL; + + mime_data = mime_data_list_find(list, mime_type); + + if (mime_data == NULL) { + mime_data = SDL_calloc(1, sizeof(*mime_data)); + if (mime_data == NULL) { + status = SDL_OutOfMemory(); + } else { + WAYLAND_wl_list_insert(list, &(mime_data->link)); + + mime_type_length = strlen(mime_type) + 1; + mime_data->mime_type = SDL_malloc(mime_type_length); + if (mime_data->mime_type == NULL) { + status = SDL_OutOfMemory(); + } else { + SDL_memcpy(mime_data->mime_type, mime_type, mime_type_length); + } + } + } + + if (mime_data != NULL && buffer != NULL && length > 0) { + if (mime_data->data != NULL) { + SDL_free(mime_data->data); + } + mime_data->data = buffer; + mime_data->length = length; + } + + return status; +} + +static void +mime_data_list_free(struct wl_list *list) +{ + SDL_MimeDataList *mime_data = NULL; + SDL_MimeDataList *next = NULL; + + wl_list_for_each_safe(mime_data, next, list, link) { + if (mime_data->data != NULL) { + SDL_free(mime_data->data); + } + if (mime_data->mime_type != NULL) { + SDL_free(mime_data->mime_type); + } + SDL_free(mime_data); + } +} + +ssize_t +Wayland_data_source_send(SDL_WaylandDataSource *source, + const char *mime_type, int fd) +{ + size_t written_bytes = 0; + ssize_t status = 0; + SDL_MimeDataList *mime_data = NULL; + + mime_type = Wayland_convert_mime_type(mime_type); + mime_data = mime_data_list_find(&source->mimes, + mime_type); + + if (mime_data == NULL || mime_data->data == NULL) { + status = SDL_SetError("Invalid mime type"); + close(fd); + } else { + while (write_pipe(fd, mime_data->data, mime_data->length, + &written_bytes) > 0); + close(fd); + status = written_bytes; + } + return status; +} + +int Wayland_data_source_add_data(SDL_WaylandDataSource *source, + const char *mime_type, + const void *buffer, + size_t length) +{ + int status = 0; + if (length > 0) { + void *internal_buffer = SDL_malloc(length); + if (internal_buffer == NULL) { + status = SDL_OutOfMemory(); + } else { + SDL_memcpy(internal_buffer, buffer, length); + status = mime_data_list_add(&source->mimes, mime_type, + internal_buffer, length); + } + } + return status; +} + +SDL_bool +Wayland_data_source_has_mime(SDL_WaylandDataSource *source, + const char *mime_type) +{ + SDL_bool found = SDL_FALSE; + + if (source != NULL) { + found = mime_data_list_find(&source->mimes, mime_type) != NULL; + } + return found; +} + +void* +Wayland_data_source_get_data(SDL_WaylandDataSource *source, + size_t *length, const char* mime_type, + SDL_bool null_terminate) +{ + SDL_MimeDataList *mime_data = NULL; + void *buffer = NULL; + *length = 0; + + if (source == NULL) { + SDL_SetError("Invalid data source"); + } else { + mime_data = mime_data_list_find(&source->mimes, mime_type); + if (mime_data != NULL && mime_data->length > 0) { + buffer = SDL_malloc(mime_data->length); + if (buffer == NULL) { + *length = SDL_OutOfMemory(); + } else { + *length = mime_data->length; + SDL_memcpy(buffer, mime_data->data, mime_data->length); + } + } + } + + return buffer; +} + +void +Wayland_data_source_destroy(SDL_WaylandDataSource *source) +{ + if (source != NULL) { + wl_data_source_destroy(source->source); + mime_data_list_free(&source->mimes); + SDL_free(source); + } +} + +void* +Wayland_data_offer_receive(SDL_WaylandDataOffer *offer, + size_t *length, const char* mime_type, + SDL_bool null_terminate) +{ + SDL_WaylandDataDevice *data_device = NULL; + + int pipefd[2]; + void *buffer = NULL; + *length = 0; + + if (offer == NULL) { + SDL_SetError("Invalid data offer"); + } else if ((data_device = offer->data_device) == NULL) { + SDL_SetError("Data device not initialized"); + } else if (pipe2(pipefd, O_CLOEXEC|O_NONBLOCK) == -1) { + SDL_SetError("Could not read pipe"); + } else { + wl_data_offer_receive(offer->offer, mime_type, pipefd[1]); + + /* TODO: Needs pump and flush? */ + WAYLAND_wl_display_flush(data_device->video_data->display); + + close(pipefd[1]); + + while (read_pipe(pipefd[0], &buffer, length, null_terminate) > 0); + close(pipefd[0]); + } + return buffer; +} + +int +Wayland_data_offer_add_mime(SDL_WaylandDataOffer *offer, + const char* mime_type) +{ + return mime_data_list_add(&offer->mimes, mime_type, NULL, 0); +} + + +SDL_bool +Wayland_data_offer_has_mime(SDL_WaylandDataOffer *offer, + const char *mime_type) +{ + SDL_bool found = SDL_FALSE; + + if (offer != NULL) { + found = mime_data_list_find(&offer->mimes, mime_type) != NULL; + } + return found; +} + +void +Wayland_data_offer_destroy(SDL_WaylandDataOffer *offer) +{ + if (offer != NULL) { + wl_data_offer_destroy(offer->offer); + mime_data_list_free(&offer->mimes); + SDL_free(offer); + } +} + +int +Wayland_data_device_clear_selection(SDL_WaylandDataDevice *data_device) +{ + int status = 0; + + if (data_device == NULL || data_device->data_device == NULL) { + status = SDL_SetError("Invalid Data Device"); + } else if (data_device->selection_source != 0) { + wl_data_device_set_selection(data_device->data_device, NULL, 0); + data_device->selection_source = NULL; + } + return status; +} + +int +Wayland_data_device_set_selection(SDL_WaylandDataDevice *data_device, + SDL_WaylandDataSource *source) +{ + int status = 0; + size_t num_offers = 0; + size_t index = 0; + + if (data_device == NULL) { + status = SDL_SetError("Invalid Data Device"); + } else if (source == NULL) { + status = SDL_SetError("Invalid source"); + } else { + SDL_MimeDataList *mime_data = NULL; + + wl_list_for_each(mime_data, &(source->mimes), link) { + wl_data_source_offer(source->source, + mime_data->mime_type); + + /* TODO - Improve system for multiple mime types to same data */ + for (index = 0; index < MIME_LIST_SIZE; ++index) { + if (strcmp(mime_conversion_list[index][1], mime_data->mime_type) == 0) { + wl_data_source_offer(source->source, + mime_conversion_list[index][0]); + } + } + /* */ + + ++num_offers; + } + + if (num_offers == 0) { + Wayland_data_device_clear_selection(data_device); + status = SDL_SetError("No mime data"); + } else { + /* Only set if there is a valid serial if not set it later */ + if (data_device->selection_serial != 0) { + wl_data_device_set_selection(data_device->data_device, + source->source, + data_device->selection_serial); + } + data_device->selection_source = source; + } + } + + return status; +} + +int +Wayland_data_device_set_serial(SDL_WaylandDataDevice *data_device, + uint32_t serial) +{ + int status = -1; + if (data_device != NULL) { + status = 0; + + /* If there was no serial and there is a pending selection set it now. */ + if (data_device->selection_serial == 0 + && data_device->selection_source != NULL) { + wl_data_device_set_selection(data_device->data_device, + data_device->selection_source->source, + serial); + } + + data_device->selection_serial = serial; + } + + return status; +} + +#endif /* SDL_VIDEO_DRIVER_WAYLAND */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylanddatamanager.h b/Engine/lib/sdl/src/video/wayland/SDL_waylanddatamanager.h new file mode 100644 index 000000000..9b13e64d5 --- /dev/null +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylanddatamanager.h @@ -0,0 +1,103 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +#include "../../SDL_internal.h" + +#ifndef SDL_waylanddatamanager_h_ +#define SDL_waylanddatamanager_h_ + +#include "SDL_waylandvideo.h" +#include "SDL_waylandwindow.h" + +#define TEXT_MIME "text/plain;charset=utf-8" +#define FILE_MIME "text/uri-list" + +typedef struct { + char *mime_type; + void *data; + size_t length; + struct wl_list link; +} SDL_MimeDataList; + +typedef struct { + struct wl_data_source *source; + struct wl_list mimes; +} SDL_WaylandDataSource; + +typedef struct { + struct wl_data_offer *offer; + struct wl_list mimes; + void *data_device; +} SDL_WaylandDataOffer; + +typedef struct { + struct wl_data_device *data_device; + SDL_VideoData *video_data; + + /* Drag and Drop */ + uint32_t drag_serial; + SDL_WaylandDataOffer *drag_offer; + SDL_WaylandDataOffer *selection_offer; + + /* Clipboard */ + uint32_t selection_serial; + SDL_WaylandDataSource *selection_source; +} SDL_WaylandDataDevice; + +extern const char* Wayland_convert_mime_type(const char *mime_type); + +/* Wayland Data Source - (Sending) */ +extern SDL_WaylandDataSource* Wayland_data_source_create(_THIS); +extern ssize_t Wayland_data_source_send(SDL_WaylandDataSource *source, + const char *mime_type, int fd); +extern int Wayland_data_source_add_data(SDL_WaylandDataSource *source, + const char *mime_type, + const void *buffer, + size_t length); +extern SDL_bool Wayland_data_source_has_mime(SDL_WaylandDataSource *source, + const char *mime_type); +extern void* Wayland_data_source_get_data(SDL_WaylandDataSource *source, + size_t *length, + const char *mime_type, + SDL_bool null_terminate); +extern void Wayland_data_source_destroy(SDL_WaylandDataSource *source); + +/* Wayland Data Offer - (Receiving) */ +extern void* Wayland_data_offer_receive(SDL_WaylandDataOffer *offer, + size_t *length, + const char *mime_type, + SDL_bool null_terminate); +extern SDL_bool Wayland_data_offer_has_mime(SDL_WaylandDataOffer *offer, + const char *mime_type); +extern int Wayland_data_offer_add_mime(SDL_WaylandDataOffer *offer, + const char *mime_type); +extern void Wayland_data_offer_destroy(SDL_WaylandDataOffer *offer); + +/* Clipboard */ +extern int Wayland_data_device_clear_selection(SDL_WaylandDataDevice *device); +extern int Wayland_data_device_set_selection(SDL_WaylandDataDevice *device, + SDL_WaylandDataSource *source); +extern int Wayland_data_device_set_serial(SDL_WaylandDataDevice *device, + uint32_t serial); +#endif /* SDL_waylanddatamanager_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ + diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylanddyn.c b/Engine/lib/sdl/src/video/wayland/SDL_waylanddyn.c index 14674fbe2..98cc51887 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylanddyn.c +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylanddyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylanddyn.h b/Engine/lib/sdl/src/video/wayland/SDL_waylanddyn.h index f1f652566..720427ea7 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylanddyn.h +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylanddyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_waylanddyn_h -#define _SDL_waylanddyn_h +#ifndef SDL_waylanddyn_h_ +#define SDL_waylanddyn_h_ #include "../../SDL_internal.h" @@ -91,6 +91,10 @@ void SDL_WAYLAND_UnloadSymbols(void); #define wl_output_interface (*WAYLAND_wl_output_interface) #define wl_shell_interface (*WAYLAND_wl_shell_interface) #define wl_shm_interface (*WAYLAND_wl_shm_interface) +#define wl_data_device_interface (*WAYLAND_wl_data_device_interface) +#define wl_data_offer_interface (*WAYLAND_wl_data_offer_interface) +#define wl_data_source_interface (*WAYLAND_wl_data_source_interface) +#define wl_data_device_manager_interface (*WAYLAND_wl_data_device_manager_interface) #endif /* SDL_VIDEO_DRIVER_WAYLAND_DYNAMIC */ @@ -98,6 +102,6 @@ void SDL_WAYLAND_UnloadSymbols(void); #include "wayland-client-protocol.h" #include "wayland-egl.h" -#endif /* !defined _SDL_waylanddyn_h */ +#endif /* SDL_waylanddyn_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandevents.c b/Engine/lib/sdl/src/video/wayland/SDL_waylandevents.c index 2443aef7a..53453a239 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandevents.c +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,6 +27,7 @@ #include "SDL_assert.h" #include "SDL_log.h" +#include "../../core/unix/SDL_poll.h" #include "../../events/SDL_sysevents.h" #include "../../events/SDL_events_c.h" #include "../../events/scancodes_xfree86.h" @@ -39,6 +40,7 @@ #include "pointer-constraints-unstable-v1-client-protocol.h" #include "relative-pointer-unstable-v1-client-protocol.h" +#include "xdg-shell-unstable-v6-client-protocol.h" #include #include @@ -51,7 +53,9 @@ struct SDL_WaylandInput { SDL_VideoData *display; struct wl_seat *seat; struct wl_pointer *pointer; + struct wl_touch *touch; struct wl_keyboard *keyboard; + SDL_WaylandDataDevice *data_device; struct zwp_relative_pointer_v1 *relative_pointer; SDL_WindowData *pointer_focus; SDL_WindowData *keyboard_focus; @@ -69,20 +73,117 @@ struct SDL_WaylandInput { } xkb; }; +struct SDL_WaylandTouchPoint { + SDL_TouchID id; + float x; + float y; + struct wl_surface* surface; + + struct SDL_WaylandTouchPoint* prev; + struct SDL_WaylandTouchPoint* next; +}; + +struct SDL_WaylandTouchPointList { + struct SDL_WaylandTouchPoint* head; + struct SDL_WaylandTouchPoint* tail; +}; + +static struct SDL_WaylandTouchPointList touch_points = {NULL, NULL}; + +static void +touch_add(SDL_TouchID id, float x, float y, struct wl_surface *surface) +{ + struct SDL_WaylandTouchPoint* tp = SDL_malloc(sizeof(struct SDL_WaylandTouchPoint)); + + tp->id = id; + tp->x = x; + tp->y = y; + tp->surface = surface; + + if (touch_points.tail) { + touch_points.tail->next = tp; + tp->prev = touch_points.tail; + } else { + touch_points.head = tp; + tp->prev = NULL; + } + + touch_points.tail = tp; + tp->next = NULL; +} + +static void +touch_update(SDL_TouchID id, float x, float y) +{ + struct SDL_WaylandTouchPoint* tp = touch_points.head; + + while (tp) { + if (tp->id == id) { + tp->x = x; + tp->y = y; + } + + tp = tp->next; + } +} + +static void +touch_del(SDL_TouchID id, float* x, float* y) +{ + struct SDL_WaylandTouchPoint* tp = touch_points.head; + + while (tp) { + if (tp->id == id) { + *x = tp->x; + *y = tp->y; + + if (tp->prev) { + tp->prev->next = tp->next; + } else { + touch_points.head = tp->next; + } + + if (tp->next) { + tp->next->prev = tp->prev; + } else { + touch_points.tail = tp->prev; + } + + SDL_free(tp); + } + + tp = tp->next; + } +} + +static struct wl_surface* +touch_surface(SDL_TouchID id) +{ + struct SDL_WaylandTouchPoint* tp = touch_points.head; + + while (tp) { + if (tp->id == id) { + return tp->surface; + } + + tp = tp->next; + } + + return NULL; +} + void Wayland_PumpEvents(_THIS) { SDL_VideoData *d = _this->driverdata; - struct pollfd pfd[1]; - pfd[0].fd = WAYLAND_wl_display_get_fd(d->display); - pfd[0].events = POLLIN; - poll(pfd, 1, 0); - - if (pfd[0].revents & POLLIN) + if (SDL_IOReady(WAYLAND_wl_display_get_fd(d->display), SDL_FALSE, 0)) { WAYLAND_wl_display_dispatch(d->display); + } else + { WAYLAND_wl_display_dispatch_pending(d->display); + } } static void @@ -97,7 +198,7 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer, /* enter event for a window we've just destroyed */ return; } - + /* This handler will be called twice in Wayland 1.4 * Once for the window surface which has valid user data * and again for the mouse cursor surface which does not have valid user data @@ -105,7 +206,7 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer, */ window = (SDL_WindowData *)wl_surface_get_user_data(surface); - + if (window) { input->pointer_focus = window; SDL_SetMouseFocus(window->sdlwindow); @@ -148,15 +249,25 @@ ProcessHitTest(struct SDL_WaylandInput *input, uint32_t serial) if (window->hit_test) { const SDL_Point point = { wl_fixed_to_int(input->sx_w), wl_fixed_to_int(input->sy_w) }; const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data); - static const uint32_t directions[] = { + + static const uint32_t directions_wl[] = { WL_SHELL_SURFACE_RESIZE_TOP_LEFT, WL_SHELL_SURFACE_RESIZE_TOP, WL_SHELL_SURFACE_RESIZE_TOP_RIGHT, WL_SHELL_SURFACE_RESIZE_RIGHT, WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT, WL_SHELL_SURFACE_RESIZE_BOTTOM, WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT, WL_SHELL_SURFACE_RESIZE_LEFT }; + + /* the names are different (ZXDG_TOPLEVEL_V6_RESIZE_EDGE_* vs + WL_SHELL_SURFACE_RESIZE_*), but the values are the same. */ + const uint32_t *directions_zxdg = directions_wl; + switch (rc) { case SDL_HITTEST_DRAGGABLE: - wl_shell_surface_move(window_data->shell_surface, input->seat, serial); + if (input->display->shell.zxdg) { + zxdg_toplevel_v6_move(window_data->shell_surface.zxdg.roleobj.toplevel, input->seat, serial); + } else { + wl_shell_surface_move(window_data->shell_surface.wl, input->seat, serial); + } return SDL_TRUE; case SDL_HITTEST_RESIZE_TOPLEFT: @@ -167,7 +278,11 @@ ProcessHitTest(struct SDL_WaylandInput *input, uint32_t serial) case SDL_HITTEST_RESIZE_BOTTOM: case SDL_HITTEST_RESIZE_BOTTOMLEFT: case SDL_HITTEST_RESIZE_LEFT: - wl_shell_surface_resize(window_data->shell_surface, input->seat, serial, directions[rc - SDL_HITTEST_RESIZE_TOPLEFT]); + if (input->display->shell.zxdg) { + zxdg_toplevel_v6_resize(window_data->shell_surface.zxdg.roleobj.toplevel, input->seat, serial, directions_zxdg[rc - SDL_HITTEST_RESIZE_TOPLEFT]); + } else { + wl_shell_surface_resize(window_data->shell_surface.wl, input->seat, serial, directions_wl[rc - SDL_HITTEST_RESIZE_TOPLEFT]); + } return SDL_TRUE; default: return SDL_FALSE; @@ -184,7 +299,7 @@ pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_t serial, SDL_WindowData *window = input->pointer_focus; enum wl_pointer_button_state state = state_w; uint32_t sdl_button; - + if (input->pointer_focus) { switch (button) { case BTN_LEFT: @@ -208,6 +323,8 @@ pointer_handle_button_common(struct SDL_WaylandInput *input, uint32_t serial, default: return; } + + Wayland_data_device_set_serial(input->data_device, serial); SDL_SendMouseButton(window->sdlwindow, 0, state ? SDL_PRESSED : SDL_RELEASED, sdl_button); @@ -229,16 +346,16 @@ pointer_handle_axis_common(struct SDL_WaylandInput *input, { SDL_WindowData *window = input->pointer_focus; enum wl_pointer_axis a = axis; - int x, y; + float x, y; if (input->pointer_focus) { switch (a) { case WL_POINTER_AXIS_VERTICAL_SCROLL: x = 0; - y = wl_fixed_to_int(value); + y = 0 - (float)wl_fixed_to_double(value); break; case WL_POINTER_AXIS_HORIZONTAL_SCROLL: - x = wl_fixed_to_int(value); + x = 0 - (float)wl_fixed_to_double(value); y = 0; break; default: @@ -264,6 +381,75 @@ static const struct wl_pointer_listener pointer_listener = { pointer_handle_motion, pointer_handle_button, pointer_handle_axis, + NULL, /* frame */ + NULL, /* axis_source */ + NULL, /* axis_stop */ + NULL, /* axis_discrete */ +}; + +static void +touch_handler_down(void *data, struct wl_touch *touch, unsigned int serial, + unsigned int timestamp, struct wl_surface *surface, + int id, wl_fixed_t fx, wl_fixed_t fy) +{ + float x, y; + SDL_WindowData* window; + + window = (SDL_WindowData *)wl_surface_get_user_data(surface); + + x = wl_fixed_to_double(fx) / window->sdlwindow->w; + y = wl_fixed_to_double(fy) / window->sdlwindow->h; + + touch_add(id, x, y, surface); + SDL_SendTouch(1, (SDL_FingerID)id, SDL_TRUE, x, y, 1.0f); +} + +static void +touch_handler_up(void *data, struct wl_touch *touch, unsigned int serial, + unsigned int timestamp, int id) +{ + float x = 0, y = 0; + + touch_del(id, &x, &y); + SDL_SendTouch(1, (SDL_FingerID)id, SDL_FALSE, x, y, 0.0f); +} + +static void +touch_handler_motion(void *data, struct wl_touch *touch, unsigned int timestamp, + int id, wl_fixed_t fx, wl_fixed_t fy) +{ + float x, y; + SDL_WindowData* window; + + window = (SDL_WindowData *)wl_surface_get_user_data(touch_surface(id)); + + x = wl_fixed_to_double(fx) / window->sdlwindow->w; + y = wl_fixed_to_double(fy) / window->sdlwindow->h; + + touch_update(id, x, y); + SDL_SendTouchMotion(1, (SDL_FingerID)id, x, y, 1.0f); +} + +static void +touch_handler_frame(void *data, struct wl_touch *touch) +{ + +} + +static void +touch_handler_cancel(void *data, struct wl_touch *touch) +{ + +} + +static const struct wl_touch_listener touch_listener = { + touch_handler_down, + touch_handler_up, + touch_handler_motion, + touch_handler_frame, + touch_handler_cancel, + NULL, /* shape */ + NULL, /* orientation */ }; static void @@ -322,7 +508,7 @@ keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, /* enter event for a window we've just destroyed */ return; } - + window = wl_surface_get_user_data(surface); if (window) { @@ -373,6 +559,9 @@ keyboard_handle_key(void *data, struct wl_keyboard *keyboard, if (size > 0) { text[size] = 0; + + Wayland_data_device_set_serial(input->data_device, serial); + SDL_SendKeyboardText(text); } } @@ -396,6 +585,7 @@ static const struct wl_keyboard_listener keyboard_listener = { keyboard_handle_leave, keyboard_handle_key, keyboard_handle_modifiers, + NULL, /* repeat_info */ }; static void @@ -413,6 +603,19 @@ seat_handle_capabilities(void *data, struct wl_seat *seat, } else if (!(caps & WL_SEAT_CAPABILITY_POINTER) && input->pointer) { wl_pointer_destroy(input->pointer); input->pointer = NULL; + input->display->pointer = NULL; + } + + if ((caps & WL_SEAT_CAPABILITY_TOUCH) && !input->touch) { + SDL_AddTouch(1, "wayland_touch"); + input->touch = wl_seat_get_touch(seat); + wl_touch_set_user_data(input->touch, input); + wl_touch_add_listener(input->touch, &touch_listener, + input); + } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && input->touch) { + SDL_DelTouch(1); + wl_touch_destroy(input->touch); + input->touch = NULL; } if ((caps & WL_SEAT_CAPABILITY_KEYBOARD) && !input->keyboard) { @@ -428,12 +631,248 @@ seat_handle_capabilities(void *data, struct wl_seat *seat, static const struct wl_seat_listener seat_listener = { seat_handle_capabilities, + NULL, /* name */ +}; + +static void +data_source_handle_target(void *data, struct wl_data_source *wl_data_source, + const char *mime_type) +{ +} + +static void +data_source_handle_send(void *data, struct wl_data_source *wl_data_source, + const char *mime_type, int32_t fd) +{ + Wayland_data_source_send((SDL_WaylandDataSource *)data, mime_type, fd); +} + +static void +data_source_handle_cancelled(void *data, struct wl_data_source *wl_data_source) +{ + Wayland_data_source_destroy(data); +} + +static void +data_source_handle_dnd_drop_performed(void *data, struct wl_data_source *wl_data_source) +{ +} + +static void +data_source_handle_dnd_finished(void *data, struct wl_data_source *wl_data_source) +{ +} + +static void +data_source_handle_action(void *data, struct wl_data_source *wl_data_source, + uint32_t dnd_action) +{ +} + +static const struct wl_data_source_listener data_source_listener = { + data_source_handle_target, + data_source_handle_send, + data_source_handle_cancelled, + data_source_handle_dnd_drop_performed, // Version 3 + data_source_handle_dnd_finished, // Version 3 + data_source_handle_action, // Version 3 +}; + +SDL_WaylandDataSource* +Wayland_data_source_create(_THIS) +{ + SDL_WaylandDataSource *data_source = NULL; + SDL_VideoData *driver_data = NULL; + struct wl_data_source *id = NULL; + + if (_this == NULL || _this->driverdata == NULL) { + SDL_SetError("Video driver uninitialized"); + } else { + driver_data = _this->driverdata; + + if (driver_data->data_device_manager != NULL) { + id = wl_data_device_manager_create_data_source( + driver_data->data_device_manager); + } + + if (id == NULL) { + SDL_SetError("Wayland unable to create data source"); + } else { + data_source = SDL_calloc(1, sizeof *data_source); + if (data_source == NULL) { + SDL_OutOfMemory(); + wl_data_source_destroy(id); + } else { + WAYLAND_wl_list_init(&(data_source->mimes)); + data_source->source = id; + wl_data_source_set_user_data(id, data_source); + wl_data_source_add_listener(id, &data_source_listener, + data_source); + } + } + } + return data_source; +} + +static void +data_offer_handle_offer(void *data, struct wl_data_offer *wl_data_offer, + const char *mime_type) +{ + SDL_WaylandDataOffer *offer = data; + Wayland_data_offer_add_mime(offer, mime_type); +} + +static void +data_offer_handle_source_actions(void *data, struct wl_data_offer *wl_data_offer, + uint32_t source_actions) +{ +} + +static void +data_offer_handle_actions(void *data, struct wl_data_offer *wl_data_offer, + uint32_t dnd_action) +{ +} + +static const struct wl_data_offer_listener data_offer_listener = { + data_offer_handle_offer, + data_offer_handle_source_actions, // Version 3 + data_offer_handle_actions, // Version 3 +}; + +static void +data_device_handle_data_offer(void *data, struct wl_data_device *wl_data_device, + struct wl_data_offer *id) +{ + SDL_WaylandDataOffer *data_offer = NULL; + + data_offer = SDL_calloc(1, sizeof *data_offer); + if (data_offer == NULL) { + SDL_OutOfMemory(); + } else { + data_offer->offer = id; + data_offer->data_device = data; + WAYLAND_wl_list_init(&(data_offer->mimes)); + wl_data_offer_set_user_data(id, data_offer); + wl_data_offer_add_listener(id, &data_offer_listener, data_offer); + } +} + +static void +data_device_handle_enter(void *data, struct wl_data_device *wl_data_device, + uint32_t serial, struct wl_surface *surface, + wl_fixed_t x, wl_fixed_t y, struct wl_data_offer *id) +{ + SDL_WaylandDataDevice *data_device = data; + SDL_bool has_mime = SDL_FALSE; + uint32_t dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE; + + data_device->drag_serial = serial; + + if (id != NULL) { + data_device->drag_offer = wl_data_offer_get_user_data(id); + + /* TODO: SDL Support more mime types */ + has_mime = Wayland_data_offer_has_mime( + data_device->drag_offer, FILE_MIME); + + /* If drag_mime is NULL this will decline the offer */ + wl_data_offer_accept(id, serial, + (has_mime == SDL_TRUE) ? FILE_MIME : NULL); + + /* SDL only supports "copy" style drag and drop */ + if (has_mime == SDL_TRUE) { + dnd_action = WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY; + } + wl_data_offer_set_actions(data_device->drag_offer->offer, + dnd_action, dnd_action); + } +} + +static void +data_device_handle_leave(void *data, struct wl_data_device *wl_data_device) +{ + SDL_WaylandDataDevice *data_device = data; + SDL_WaylandDataOffer *offer = NULL; + + if (data_device->selection_offer != NULL) { + data_device->selection_offer = NULL; + Wayland_data_offer_destroy(offer); + } +} + +static void +data_device_handle_motion(void *data, struct wl_data_device *wl_data_device, + uint32_t time, wl_fixed_t x, wl_fixed_t y) +{ +} + +static void +data_device_handle_drop(void *data, struct wl_data_device *wl_data_device) +{ + SDL_WaylandDataDevice *data_device = data; + void *buffer = NULL; + size_t length = 0; + + const char *current_uri = NULL; + const char *last_char = NULL; + char *current_char = NULL; + + if (data_device->drag_offer != NULL) { + /* TODO: SDL Support more mime types */ + buffer = Wayland_data_offer_receive(data_device->drag_offer, + &length, FILE_MIME, SDL_FALSE); + + /* uri-list */ + current_uri = (const char *)buffer; + last_char = (const char *)buffer + length; + for (current_char = buffer; current_char < last_char; ++current_char) { + if (*current_char == '\n' || *current_char == 0) { + if (*current_uri != 0 && *current_uri != '#') { + *current_char = 0; + SDL_SendDropFile(NULL, current_uri); + } + current_uri = (const char *)current_char + 1; + } + } + + SDL_free(buffer); + } +} + +static void +data_device_handle_selection(void *data, struct wl_data_device *wl_data_device, + struct wl_data_offer *id) +{ + SDL_WaylandDataDevice *data_device = data; + SDL_WaylandDataOffer *offer = NULL; + + if (id != NULL) { + offer = wl_data_offer_get_user_data(id); + } + + if (data_device->selection_offer != offer) { + Wayland_data_offer_destroy(data_device->selection_offer); + data_device->selection_offer = offer; + } + + SDL_SendClipboardUpdate(); +} + +static const struct wl_data_device_listener data_device_listener = { + data_device_handle_data_offer, + data_device_handle_enter, + data_device_handle_leave, + data_device_handle_motion, + data_device_handle_drop, + data_device_handle_selection }; void Wayland_display_add_input(SDL_VideoData *d, uint32_t id) { struct SDL_WaylandInput *input; + SDL_WaylandDataDevice *data_device = NULL; input = SDL_calloc(1, sizeof *input); if (input == NULL) @@ -444,6 +883,27 @@ Wayland_display_add_input(SDL_VideoData *d, uint32_t id) input->sx_w = wl_fixed_from_int(0); input->sy_w = wl_fixed_from_int(0); d->input = input; + + if (d->data_device_manager != NULL) { + data_device = SDL_calloc(1, sizeof *data_device); + if (data_device == NULL) { + return; + } + + data_device->data_device = wl_data_device_manager_get_data_device( + d->data_device_manager, input->seat + ); + data_device->video_data = d; + + if (data_device->data_device == NULL) { + SDL_free(data_device); + } else { + wl_data_device_set_user_data(data_device->data_device, data_device); + wl_data_device_add_listener(data_device->data_device, + &data_device_listener, data_device); + input->data_device = data_device; + } + } wl_seat_add_listener(input->seat, &seat_listener, input); wl_seat_set_user_data(input->seat, input); @@ -458,12 +918,31 @@ void Wayland_display_destroy_input(SDL_VideoData *d) if (!input) return; + if (input->data_device != NULL) { + Wayland_data_device_clear_selection(input->data_device); + if (input->data_device->selection_offer != NULL) { + Wayland_data_offer_destroy(input->data_device->selection_offer); + } + if (input->data_device->drag_offer != NULL) { + Wayland_data_offer_destroy(input->data_device->drag_offer); + } + if (input->data_device->data_device != NULL) { + wl_data_device_release(input->data_device->data_device); + } + SDL_free(input->data_device); + } + if (input->keyboard) wl_keyboard_destroy(input->keyboard); if (input->pointer) wl_pointer_destroy(input->pointer); + if (input->touch) { + SDL_DelTouch(1); + wl_touch_destroy(input->touch); + } + if (input->seat) wl_seat_destroy(input->seat); @@ -477,6 +956,16 @@ void Wayland_display_destroy_input(SDL_VideoData *d) d->input = NULL; } +SDL_WaylandDataDevice* Wayland_get_data_device(struct SDL_WaylandInput *input) +{ + if (input == NULL) { + return NULL; + } + + return input->data_device; +} + +/* !!! FIXME: just merge these into display_handle_global(). */ void Wayland_display_add_relative_pointer_manager(SDL_VideoData *d, uint32_t id) { d->relative_pointer_manager = diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandevents_c.h b/Engine/lib/sdl/src/video/wayland/SDL_waylandevents_c.h index 56d12ec27..1c5ffe517 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandevents_c.h +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,17 +21,22 @@ #include "../../SDL_internal.h" -#ifndef _SDL_waylandevents_h -#define _SDL_waylandevents_h +#ifndef SDL_waylandevents_h_ +#define SDL_waylandevents_h_ #include "SDL_waylandvideo.h" #include "SDL_waylandwindow.h" +#include "SDL_waylanddatamanager.h" + +struct SDL_WaylandInput; extern void Wayland_PumpEvents(_THIS); extern void Wayland_display_add_input(SDL_VideoData *d, uint32_t id); extern void Wayland_display_destroy_input(SDL_VideoData *d); +extern SDL_WaylandDataDevice* Wayland_get_data_device(struct SDL_WaylandInput *input); + extern void Wayland_display_add_pointer_constraints(SDL_VideoData *d, uint32_t id); extern void Wayland_display_destroy_pointer_constraints(SDL_VideoData *d); @@ -41,6 +46,6 @@ extern int Wayland_input_unlock_pointer(struct SDL_WaylandInput *input); extern void Wayland_display_add_relative_pointer_manager(SDL_VideoData *d, uint32_t id); extern void Wayland_display_destroy_relative_pointer_manager(SDL_VideoData *d); -#endif /* _SDL_waylandevents_h */ +#endif /* SDL_waylandevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandmouse.c b/Engine/lib/sdl/src/video/wayland/SDL_waylandmouse.c index 8dfc9eea3..c77b53eb7 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandmouse.c +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,10 +23,6 @@ #if SDL_VIDEO_DRIVER_WAYLAND -#ifndef _GNU_SOURCE -#define _GNU_SOURCE -#endif - #include #include #include @@ -396,23 +392,5 @@ Wayland_FiniMouse(void) /* This effectively assumes that nobody else * touches SDL_Mouse which is effectively * a singleton */ - - SDL_Mouse *mouse = SDL_GetMouse(); - - /* Free the current cursor if not the same pointer as - * the default cursor */ - if (mouse->def_cursor != mouse->cur_cursor) - Wayland_FreeCursor (mouse->cur_cursor); - - Wayland_FreeCursor (mouse->def_cursor); - mouse->def_cursor = NULL; - mouse->cur_cursor = NULL; - - mouse->CreateCursor = NULL; - mouse->CreateSystemCursor = NULL; - mouse->ShowCursor = NULL; - mouse->FreeCursor = NULL; - mouse->WarpMouse = NULL; - mouse->SetRelativeMouseMode = NULL; } #endif /* SDL_VIDEO_DRIVER_WAYLAND */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandmouse.h b/Engine/lib/sdl/src/video/wayland/SDL_waylandmouse.h index 129990ded..2c50e5ff1 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandmouse.h +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandopengles.c b/Engine/lib/sdl/src/video/wayland/SDL_waylandopengles.c index 6803dbe63..9c0b84595 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandopengles.c +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -35,7 +35,7 @@ Wayland_GLES_LoadLibrary(_THIS, const char *path) { int ret; SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display); + ret = SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display, 0); Wayland_PumpEvents(_this); WAYLAND_wl_display_flush(data->display); @@ -54,14 +54,16 @@ Wayland_GLES_CreateContext(_THIS, SDL_Window * window) return context; } -void +int Wayland_GLES_SwapWindow(_THIS, SDL_Window *window) { - SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface); + if (SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface) < 0) { + return -1; + } WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); + return 0; } - int Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context) { diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandopengles.h b/Engine/lib/sdl/src/video/wayland/SDL_waylandopengles.h index 6c3f1f384..58d7f9b08 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandopengles.h +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,15 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_waylandopengles_h -#define _SDL_waylandopengles_h +#ifndef SDL_waylandopengles_h_ +#define SDL_waylandopengles_h_ #include "../SDL_sysvideo.h" #include "../SDL_egl_c.h" typedef struct SDL_PrivateGLESData { + int dummy; } SDL_PrivateGLESData; /* OpenGLES functions */ @@ -39,8 +40,10 @@ typedef struct SDL_PrivateGLESData extern int Wayland_GLES_LoadLibrary(_THIS, const char *path); extern SDL_GLContext Wayland_GLES_CreateContext(_THIS, SDL_Window * window); -extern void Wayland_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int Wayland_GLES_SwapWindow(_THIS, SDL_Window * window); extern int Wayland_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern void Wayland_GLES_DeleteContext(_THIS, SDL_GLContext context); -#endif /* _SDL_waylandopengles_h */ +#endif /* SDL_waylandopengles_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandsym.h b/Engine/lib/sdl/src/video/wayland/SDL_waylandsym.h index aea3cb129..77783df81 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandsym.h +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandsym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -83,6 +83,10 @@ SDL_WAYLAND_INTERFACE(wl_compositor_interface) SDL_WAYLAND_INTERFACE(wl_output_interface) SDL_WAYLAND_INTERFACE(wl_shell_interface) SDL_WAYLAND_INTERFACE(wl_shm_interface) +SDL_WAYLAND_INTERFACE(wl_data_device_interface) +SDL_WAYLAND_INTERFACE(wl_data_source_interface) +SDL_WAYLAND_INTERFACE(wl_data_offer_interface) +SDL_WAYLAND_INTERFACE(wl_data_device_manager_interface) SDL_WAYLAND_MODULE(WAYLAND_EGL) SDL_WAYLAND_SYM(struct wl_egl_window *, wl_egl_window_create, (struct wl_surface *, int, int)) diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandtouch.c b/Engine/lib/sdl/src/video/wayland/SDL_waylandtouch.c index 4cae42594..005b47f58 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandtouch.c +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandtouch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandtouch.h b/Engine/lib/sdl/src/video/wayland/SDL_waylandtouch.h index 5f2a05813..9efc5a54a 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandtouch.h +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandtouch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -23,8 +23,8 @@ #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH -#ifndef _SDL_waylandtouch_h -#define _SDL_waylandtouch_h +#ifndef SDL_waylandtouch_h_ +#define SDL_waylandtouch_h_ #include "SDL_waylandvideo.h" #include @@ -347,6 +347,6 @@ qt_windowmanager_open_url(struct qt_windowmanager *qt_windowmanager, uint32_t re QT_WINDOWMANAGER_OPEN_URL, remaining, url); } -#endif /* _SDL_waylandtouch_h */ +#endif /* SDL_waylandtouch_h_ */ #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandvideo.c b/Engine/lib/sdl/src/video/wayland/SDL_waylandvideo.c index 554b0ecad..8401a0884 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandvideo.c +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -34,6 +34,8 @@ #include "SDL_waylandopengles.h" #include "SDL_waylandmouse.h" #include "SDL_waylandtouch.h" +#include "SDL_waylandclipboard.h" +#include "SDL_waylandvulkan.h" #include #include @@ -43,6 +45,8 @@ #include "SDL_waylanddyn.h" #include +#include "xdg-shell-unstable-v6-client-protocol.h" + #define WAYLANDVID_DRIVER_NAME "wayland" /* Initialization/Query functions */ @@ -62,6 +66,12 @@ Wayland_VideoQuit(_THIS); static char * get_classname() { +/* !!! FIXME: this is probably wrong, albeit harmless in many common cases. From protocol spec: + "The surface class identifies the general class of applications + to which the surface belongs. A common convention is to use the + file name (or the full path if it is a non-standard location) of + the application's .desktop file as the class." */ + char *spot; #if defined(__LINUX__) || defined(__FREEBSD__) char procfile[1024]; @@ -166,7 +176,7 @@ Wayland_CreateDevice(int devindex) device->GL_GetProcAddress = Wayland_GLES_GetProcAddress; device->GL_DeleteContext = Wayland_GLES_DeleteContext; - device->CreateWindow = Wayland_CreateWindow; + device->CreateSDLWindow = Wayland_CreateWindow; device->ShowWindow = Wayland_ShowWindow; device->SetWindowFullscreen = Wayland_SetWindowFullscreen; device->MaximizeWindow = Wayland_MaximizeWindow; @@ -176,6 +186,17 @@ Wayland_CreateDevice(int devindex) device->DestroyWindow = Wayland_DestroyWindow; device->SetWindowHitTest = Wayland_SetWindowHitTest; + device->SetClipboardText = Wayland_SetClipboardText; + device->GetClipboardText = Wayland_GetClipboardText; + device->HasClipboardText = Wayland_HasClipboardText; + +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = Wayland_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = Wayland_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = Wayland_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = Wayland_Vulkan_CreateSurface; +#endif + device->free = Wayland_DeleteDevice; return device; @@ -216,9 +237,11 @@ display_handle_mode(void *data, SDL_DisplayMode mode; SDL_zero(mode); + mode.format = SDL_PIXELFORMAT_RGB888; mode.w = width; mode.h = height; mode.refresh_rate = refresh / 1000; // mHz to Hz + mode.driverdata = display->driverdata; SDL_AddDisplayMode(display, &mode); if (flags & WL_OUTPUT_MODE_CURRENT) { @@ -266,6 +289,7 @@ Wayland_add_display(SDL_VideoData *d, uint32_t id) output = wl_registry_bind(d->registry, id, &wl_output_interface, 2); if (!output) { SDL_SetError("Failed to retrieve output."); + SDL_free(display); return; } @@ -291,6 +315,18 @@ static const struct qt_windowmanager_listener windowmanager_listener = { }; #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ + +static void +handle_ping_zxdg_shell(void *data, struct zxdg_shell_v6 *zxdg, uint32_t serial) +{ + zxdg_shell_v6_pong(zxdg, serial); +} + +static const struct zxdg_shell_v6_listener shell_listener_zxdg = { + handle_ping_zxdg_shell +}; + + static void display_handle_global(void *data, struct wl_registry *registry, uint32_t id, const char *interface, uint32_t version) @@ -303,8 +339,11 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id, Wayland_add_display(d, id); } else if (strcmp(interface, "wl_seat") == 0) { Wayland_display_add_input(d, id); + } else if (strcmp(interface, "zxdg_shell_v6") == 0) { + d->shell.zxdg = wl_registry_bind(d->registry, id, &zxdg_shell_v6_interface, 1); + zxdg_shell_v6_add_listener(d->shell.zxdg, &shell_listener_zxdg, NULL); } else if (strcmp(interface, "wl_shell") == 0) { - d->shell = wl_registry_bind(d->registry, id, &wl_shell_interface, 1); + d->shell.wl = wl_registry_bind(d->registry, id, &wl_shell_interface, 1); } else if (strcmp(interface, "wl_shm") == 0) { d->shm = wl_registry_bind(registry, id, &wl_shm_interface, 1); d->cursor_theme = WAYLAND_wl_cursor_theme_load(NULL, 32, d->shm); @@ -312,6 +351,9 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id, Wayland_display_add_relative_pointer_manager(d, id); } else if (strcmp(interface, "zwp_pointer_constraints_v1") == 0) { Wayland_display_add_pointer_constraints(d, id); + } else if (strcmp(interface, "wl_data_device_manager") == 0) { + d->data_device_manager = wl_registry_bind(d->registry, id, &wl_data_device_manager_interface, 3); + #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH } else if (strcmp(interface, "qt_touch_extension") == 0) { Wayland_touch_create(d, id); @@ -327,7 +369,8 @@ display_handle_global(void *data, struct wl_registry *registry, uint32_t id, } static const struct wl_registry_listener registry_listener = { - display_handle_global + display_handle_global, + NULL, /* global_remove */ }; int @@ -390,7 +433,7 @@ void Wayland_VideoQuit(_THIS) { SDL_VideoData *data = _this->driverdata; - int i; + int i, j; Wayland_FiniMouse (); @@ -398,6 +441,11 @@ Wayland_VideoQuit(_THIS) SDL_VideoDisplay *display = &_this->displays[i]; wl_output_destroy(display->driverdata); display->driverdata = NULL; + + for (j = display->num_display_modes; j--;) { + display->display_modes[j].driverdata = NULL; + } + display->desktop_mode.driverdata = NULL; } Wayland_display_destroy_input(data); @@ -424,8 +472,11 @@ Wayland_VideoQuit(_THIS) if (data->cursor_theme) WAYLAND_wl_cursor_theme_destroy(data->cursor_theme); - if (data->shell) - wl_shell_destroy(data->shell); + if (data->shell.wl) + wl_shell_destroy(data->shell.wl); + + if (data->shell.zxdg) + zxdg_shell_v6_destroy(data->shell.zxdg); if (data->compositor) wl_compositor_destroy(data->compositor); @@ -439,7 +490,7 @@ Wayland_VideoQuit(_THIS) } SDL_free(data->classname); - free(data); + SDL_free(data); _this->driverdata = NULL; } diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandvideo.h b/Engine/lib/sdl/src/video/wayland/SDL_waylandvideo.h index ccd7ecf92..6ad68de48 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandvideo.h +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_waylandvideo_h -#define _SDL_waylandvideo_h +#ifndef SDL_waylandvideo_h_ +#define SDL_waylandvideo_h_ #include #include "wayland-util.h" @@ -43,9 +43,14 @@ typedef struct { struct wl_shm *shm; struct wl_cursor_theme *cursor_theme; struct wl_pointer *pointer; - struct wl_shell *shell; + struct { + /* !!! FIXME: add stable xdg_shell from 1.12 */ + struct zxdg_shell_v6 *zxdg; + struct wl_shell *wl; + } shell; struct zwp_relative_pointer_manager_v1 *relative_pointer_manager; struct zwp_pointer_constraints_v1 *pointer_constraints; + struct wl_data_device_manager *data_device_manager; EGLDisplay edpy; EGLContext context; @@ -65,6 +70,6 @@ typedef struct { int relative_mouse_mode; } SDL_VideoData; -#endif /* _SDL_waylandvideo_h */ +#endif /* SDL_waylandvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandvulkan.c b/Engine/lib/sdl/src/video/wayland/SDL_waylandvulkan.c new file mode 100644 index 000000000..d67472cdc --- /dev/null +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandvulkan.c @@ -0,0 +1,176 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.c. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WAYLAND + +#include "SDL_waylandvideo.h" +#include "SDL_waylandwindow.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_waylandvulkan.h" +#include "SDL_syswm.h" + +int Wayland_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 i, extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasWaylandSurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + if(_this->vulkan_config.loader_handle) + return SDL_SetError("Vulkan already loaded"); + + /* Load the Vulkan loader library */ + if(!path) + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + if(!path) + path = "libvulkan.so.1"; + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if(!_this->vulkan_config.loader_handle) + return -1; + SDL_strlcpy(_this->vulkan_config.loader_path, path, + SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + if(!vkGetInstanceProcAddr) + goto fail; + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) + goto fail; + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if(!extensions) + goto fail; + for(i = 0; i < extensionCount; i++) + { + if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasWaylandSurfaceExtension = SDL_TRUE; + } + SDL_free(extensions); + if(!hasSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + else if(!hasWaylandSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME "extension"); + goto fail; + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void Wayland_Vulkan_UnloadLibrary(_THIS) +{ + if(_this->vulkan_config.loader_handle) + { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool Wayland_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForWayland[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME + }; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForWayland), + extensionsForWayland); +} + +SDL_bool Wayland_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + SDL_WindowData *windowData = (SDL_WindowData *)window->driverdata; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + PFN_vkCreateWaylandSurfaceKHR vkCreateWaylandSurfaceKHR = + (PFN_vkCreateWaylandSurfaceKHR)vkGetInstanceProcAddr( + (VkInstance)instance, + "vkCreateWaylandSurfaceKHR"); + VkWaylandSurfaceCreateInfoKHR createInfo; + VkResult result; + + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + if(!vkCreateWaylandSurfaceKHR) + { + SDL_SetError(VK_KHR_WAYLAND_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + SDL_zero(createInfo); + createInfo.sType = VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.display = windowData->waylandData->display; + createInfo.surface = windowData->surface; + result = vkCreateWaylandSurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateWaylandSurfaceKHR failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; +} + +#endif + +/* vim: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandvulkan.h b/Engine/lib/sdl/src/video/wayland/SDL_waylandvulkan.h new file mode 100644 index 000000000..5ad3a466c --- /dev/null +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandvulkan.h @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.h. + */ + +#include "../../SDL_internal.h" + +#ifndef SDL_waylandvulkan_h_ +#define SDL_waylandvulkan_h_ + +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WAYLAND + +int Wayland_Vulkan_LoadLibrary(_THIS, const char *path); +void Wayland_Vulkan_UnloadLibrary(_THIS); +SDL_bool Wayland_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool Wayland_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +#endif + +#endif /* SDL_waylandvulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandwindow.c b/Engine/lib/sdl/src/video/wayland/SDL_waylandwindow.c index 85fca8de6..684022a79 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandwindow.c +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandwindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,16 +31,24 @@ #include "SDL_waylandvideo.h" #include "SDL_waylandtouch.h" #include "SDL_waylanddyn.h" +#include "SDL_hints.h" + +#include "xdg-shell-unstable-v6-client-protocol.h" + +/* On modern desktops, we probably will use the xdg-shell protocol instead + of wl_shell, but wl_shell might be useful on older Wayland installs that + don't have the newer protocol, or embedded things that don't have a full + window manager. */ static void -handle_ping(void *data, struct wl_shell_surface *shell_surface, +handle_ping_wl_shell_surface(void *data, struct wl_shell_surface *shell_surface, uint32_t serial) { wl_shell_surface_pong(shell_surface, serial); } static void -handle_configure(void *data, struct wl_shell_surface *shell_surface, +handle_configure_wl_shell_surface(void *data, struct wl_shell_surface *shell_surface, uint32_t edges, int32_t width, int32_t height) { SDL_WindowData *wind = (SDL_WindowData *)data; @@ -86,16 +94,94 @@ handle_configure(void *data, struct wl_shell_surface *shell_surface, } static void -handle_popup_done(void *data, struct wl_shell_surface *shell_surface) +handle_popup_done_wl_shell_surface(void *data, struct wl_shell_surface *shell_surface) { } -static const struct wl_shell_surface_listener shell_surface_listener = { - handle_ping, - handle_configure, - handle_popup_done +static const struct wl_shell_surface_listener shell_surface_listener_wl = { + handle_ping_wl_shell_surface, + handle_configure_wl_shell_surface, + handle_popup_done_wl_shell_surface }; + + + +static void +handle_configure_zxdg_shell_surface(void *data, struct zxdg_surface_v6 *zxdg, uint32_t serial) +{ + SDL_WindowData *wind = (SDL_WindowData *)data; + SDL_Window *window = wind->sdlwindow; + struct wl_region *region; + WAYLAND_wl_egl_window_resize(wind->egl_window, window->w, window->h, 0, 0); + + region = wl_compositor_create_region(wind->waylandData->compositor); + wl_region_add(region, 0, 0, window->w, window->h); + wl_surface_set_opaque_region(wind->surface, region); + wl_region_destroy(region); + SDL_SendWindowEvent(window, SDL_WINDOWEVENT_RESIZED, window->w, window->h); + zxdg_surface_v6_ack_configure(zxdg, serial); +} + +static const struct zxdg_surface_v6_listener shell_surface_listener_zxdg = { + handle_configure_zxdg_shell_surface +}; + + +static void +handle_configure_zxdg_toplevel(void *data, + struct zxdg_toplevel_v6 *zxdg_toplevel_v6, + int32_t width, + int32_t height, + struct wl_array *states) +{ + SDL_WindowData *wind = (SDL_WindowData *)data; + SDL_Window *window = wind->sdlwindow; + + /* wl_shell_surface spec states that this is a suggestion. + Ignore if less than or greater than max/min size. */ + + if (width == 0 || height == 0) { + return; + } + + if (!(window->flags & SDL_WINDOW_FULLSCREEN)) { + if ((window->flags & SDL_WINDOW_RESIZABLE)) { + if (window->max_w > 0) { + width = SDL_min(width, window->max_w); + } + width = SDL_max(width, window->min_w); + + if (window->max_h > 0) { + height = SDL_min(height, window->max_h); + } + height = SDL_max(height, window->min_h); + } else { + return; + } + } + + if (width == window->w && height == window->h) { + return; + } + + window->w = width; + window->h = height; +} + +static void +handle_close_zxdg_toplevel(void *data, struct zxdg_toplevel_v6 *zxdg_toplevel_v6) +{ + SDL_WindowData *window = (SDL_WindowData *)data; + SDL_SendWindowEvent(window->sdlwindow, SDL_WINDOWEVENT_CLOSE, 0, 0); +} + +static const struct zxdg_toplevel_v6_listener toplevel_listener_zxdg = { + handle_configure_zxdg_toplevel, + handle_close_zxdg_toplevel +}; + + #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH static void handle_onscreen_visibility(void *data, @@ -128,10 +214,29 @@ SDL_bool Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; + const Uint32 version = ((((Uint32) info->version.major) * 1000000) + + (((Uint32) info->version.minor) * 10000) + + (((Uint32) info->version.patch))); + + /* Before 2.0.6, it was possible to build an SDL with Wayland support + (SDL_SysWMinfo will be large enough to hold Wayland info), but build + your app against SDL headers that didn't have Wayland support + (SDL_SysWMinfo could be smaller than Wayland needs. This would lead + to an app properly using SDL_GetWindowWMInfo() but we'd accidentally + overflow memory on the stack or heap. To protect against this, we've + padded out the struct unconditionally in the headers and Wayland will + just return an error for older apps using this function. Those apps + will need to be recompiled against newer headers or not use Wayland, + maybe by forcing SDL_VIDEODRIVER=x11. */ + if (version < 2000006) { + info->subsystem = SDL_SYSWM_UNKNOWN; + SDL_SetError("Version must be 2.0.6 or newer"); + return SDL_FALSE; + } info->info.wl.display = data->waylandData->display; info->info.wl.surface = data->surface; - info->info.wl.shell_surface = data->shell_surface; + info->info.wl.shell_surface = data->shell_surface.wl; info->subsystem = SDL_SYSWM_WAYLAND; return SDL_TRUE; @@ -143,42 +248,121 @@ Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled) return 0; /* just succeed, the real work is done elsewhere. */ } -void Wayland_ShowWindow(_THIS, SDL_Window *window) +static void +SetFullscreen(_THIS, SDL_Window * window, struct wl_output *output) { + const SDL_VideoData *viddata = (const SDL_VideoData *) _this->driverdata; SDL_WindowData *wind = window->driverdata; - if (window->flags & SDL_WINDOW_FULLSCREEN) - wl_shell_surface_set_fullscreen(wind->shell_surface, - WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, - 0, (struct wl_output *)window->fullscreen_mode.driverdata); - else - wl_shell_surface_set_toplevel(wind->shell_surface); + if (viddata->shell.zxdg) { + if (output) { + zxdg_toplevel_v6_set_fullscreen(wind->shell_surface.zxdg.roleobj.toplevel, output); + } else { + zxdg_toplevel_v6_unset_fullscreen(wind->shell_surface.zxdg.roleobj.toplevel); + } + } else { + if (output) { + wl_shell_surface_set_fullscreen(wind->shell_surface.wl, + WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT, + 0, output); + } else { + wl_shell_surface_set_toplevel(wind->shell_surface.wl); + } + } WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); } +void Wayland_ShowWindow(_THIS, SDL_Window *window) +{ + struct wl_output *output = (struct wl_output *) window->fullscreen_mode.driverdata; + SetFullscreen(_this, window, (window->flags & SDL_WINDOW_FULLSCREEN) ? output : NULL); +} + +#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH +static void SDLCALL +QtExtendedSurface_OnHintChanged(void *userdata, const char *name, + const char *oldValue, const char *newValue) +{ + struct qt_extended_surface *qt_extended_surface = userdata; + + if (name == NULL) { + return; + } + + if (strcmp(name, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION) == 0) { + int32_t orientation = QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION; + + if (newValue != NULL) { + if (strcmp(newValue, "portrait") == 0) { + orientation = QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION; + } else if (strcmp(newValue, "landscape") == 0) { + orientation = QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION; + } else if (strcmp(newValue, "inverted-portrait") == 0) { + orientation = QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION; + } else if (strcmp(newValue, "inverted-landscape") == 0) { + orientation = QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION; + } + } + + qt_extended_surface_set_content_orientation(qt_extended_surface, orientation); + } else if (strcmp(name, SDL_HINT_QTWAYLAND_WINDOW_FLAGS) == 0) { + uint32_t flags = 0; + + if (newValue != NULL) { + char *tmp = strdup(newValue); + char *saveptr = NULL; + + char *flag = strtok_r(tmp, " ", &saveptr); + while (flag) { + if (strcmp(flag, "OverridesSystemGestures") == 0) { + flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_OVERRIDESSYSTEMGESTURES; + } else if (strcmp(flag, "StaysOnTop") == 0) { + flags |= QT_EXTENDED_SURFACE_WINDOWFLAG_STAYSONTOP; + } else if (strcmp(flag, "BypassWindowManager") == 0) { + // See https://github.com/qtproject/qtwayland/commit/fb4267103d + flags |= 4 /* QT_EXTENDED_SURFACE_WINDOWFLAG_BYPASSWINDOWMANAGER */; + } + + flag = strtok_r(NULL, " ", &saveptr); + } + + free(tmp); + } + + qt_extended_surface_set_window_flags(qt_extended_surface, flags); + } +} + +static void QtExtendedSurface_Subscribe(struct qt_extended_surface *surface, const char *name) +{ + SDL_AddHintCallback(name, QtExtendedSurface_OnHintChanged, surface); +} + +static void QtExtendedSurface_Unsubscribe(struct qt_extended_surface *surface, const char *name) +{ + SDL_DelHintCallback(name, QtExtendedSurface_OnHintChanged, surface); +} +#endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ + void Wayland_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * _display, SDL_bool fullscreen) { - SDL_WindowData *wind = window->driverdata; - - if (fullscreen) - wl_shell_surface_set_fullscreen(wind->shell_surface, - WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE, - 0, (struct wl_output *)_display->driverdata); - else - wl_shell_surface_set_toplevel(wind->shell_surface); - - WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); + struct wl_output *output = (struct wl_output *) _display->driverdata; + SetFullscreen(_this, window, fullscreen ? output : NULL); } void Wayland_RestoreWindow(_THIS, SDL_Window * window) { SDL_WindowData *wind = window->driverdata; + const SDL_VideoData *viddata = (const SDL_VideoData *) _this->driverdata; - wl_shell_surface_set_toplevel(wind->shell_surface); + if (viddata->shell.zxdg) { + } else { + wl_shell_surface_set_toplevel(wind->shell_surface.wl); + } WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); } @@ -187,10 +371,15 @@ void Wayland_MaximizeWindow(_THIS, SDL_Window * window) { SDL_WindowData *wind = window->driverdata; + SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; - wl_shell_surface_set_maximized(wind->shell_surface, NULL); + if (viddata->shell.zxdg) { + zxdg_toplevel_v6_set_maximized(wind->shell_surface.zxdg.roleobj.toplevel); + } else { + wl_shell_surface_set_maximized(wind->shell_surface.wl, NULL); + } - WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); + WAYLAND_wl_display_flush( viddata->display ); } int Wayland_CreateWindow(_THIS, SDL_Window *window) @@ -224,13 +413,25 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) data->surface = wl_compositor_create_surface(c->compositor); wl_surface_set_user_data(data->surface, data); - data->shell_surface = wl_shell_get_shell_surface(c->shell, - data->surface); - wl_shell_surface_set_class (data->shell_surface, c->classname); -#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH + + if (c->shell.zxdg) { + data->shell_surface.zxdg.surface = zxdg_shell_v6_get_xdg_surface(c->shell.zxdg, data->surface); + /* !!! FIXME: add popup role */ + data->shell_surface.zxdg.roleobj.toplevel = zxdg_surface_v6_get_toplevel(data->shell_surface.zxdg.surface); + zxdg_toplevel_v6_add_listener(data->shell_surface.zxdg.roleobj.toplevel, &toplevel_listener_zxdg, data); + zxdg_toplevel_v6_set_app_id(data->shell_surface.zxdg.roleobj.toplevel, c->classname); + } else { + data->shell_surface.wl = wl_shell_get_shell_surface(c->shell.wl, data->surface); + wl_shell_surface_set_class(data->shell_surface.wl, c->classname); + } + +#ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH if (c->surface_extension) { data->extended_surface = qt_surface_extension_get_extended_surface( c->surface_extension, data->surface); + + QtExtendedSurface_Subscribe(data->extended_surface, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION); + QtExtendedSurface_Subscribe(data->extended_surface, SDL_HINT_QTWAYLAND_WINDOW_FLAGS); } #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ @@ -244,10 +445,16 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) return SDL_SetError("failed to create a window surface"); } - if (data->shell_surface) { - wl_shell_surface_set_user_data(data->shell_surface, data); - wl_shell_surface_add_listener(data->shell_surface, - &shell_surface_listener, data); + if (c->shell.zxdg) { + if (data->shell_surface.zxdg.surface) { + zxdg_surface_v6_set_user_data(data->shell_surface.zxdg.surface, data); + zxdg_surface_v6_add_listener(data->shell_surface.zxdg.surface, &shell_surface_listener_zxdg, data); + } + } else { + if (data->shell_surface.wl) { + wl_shell_surface_set_user_data(data->shell_surface.wl, data); + wl_shell_surface_add_listener(data->shell_surface.wl, &shell_surface_listener_wl, data); + } } #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH @@ -267,6 +474,7 @@ int Wayland_CreateWindow(_THIS, SDL_Window *window) Wayland_input_lock_pointer(c->input); } + wl_surface_commit(data->surface); WAYLAND_wl_display_flush(c->display); return 0; @@ -289,9 +497,14 @@ void Wayland_SetWindowSize(_THIS, SDL_Window * window) void Wayland_SetWindowTitle(_THIS, SDL_Window * window) { SDL_WindowData *wind = window->driverdata; + SDL_VideoData *viddata = (SDL_VideoData *) _this->driverdata; if (window->title != NULL) { - wl_shell_surface_set_title(wind->shell_surface, window->title); + if (viddata->shell.zxdg) { + zxdg_toplevel_v6_set_title(wind->shell_surface.zxdg.roleobj.toplevel, window->title); + } else { + wl_shell_surface_set_title(wind->shell_surface.wl, window->title); + } } WAYLAND_wl_display_flush( ((SDL_VideoData*)_this->driverdata)->display ); @@ -306,12 +519,25 @@ void Wayland_DestroyWindow(_THIS, SDL_Window *window) SDL_EGL_DestroySurface(_this, wind->egl_surface); WAYLAND_wl_egl_window_destroy(wind->egl_window); - if (wind->shell_surface) - wl_shell_surface_destroy(wind->shell_surface); + if (data->shell.zxdg) { + if (wind->shell_surface.zxdg.roleobj.toplevel) { + zxdg_toplevel_v6_destroy(wind->shell_surface.zxdg.roleobj.toplevel); + } + if (wind->shell_surface.zxdg.surface) { + zxdg_surface_v6_destroy(wind->shell_surface.zxdg.surface); + } + } else { + if (wind->shell_surface.wl) { + wl_shell_surface_destroy(wind->shell_surface.wl); + } + } #ifdef SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH - if (wind->extended_surface) + if (wind->extended_surface) { + QtExtendedSurface_Unsubscribe(wind->extended_surface, SDL_HINT_QTWAYLAND_CONTENT_ORIENTATION); + QtExtendedSurface_Unsubscribe(wind->extended_surface, SDL_HINT_QTWAYLAND_WINDOW_FLAGS); qt_extended_surface_destroy(wind->extended_surface); + } #endif /* SDL_VIDEO_DRIVER_WAYLAND_QT_TOUCH */ wl_surface_destroy(wind->surface); diff --git a/Engine/lib/sdl/src/video/wayland/SDL_waylandwindow.h b/Engine/lib/sdl/src/video/wayland/SDL_waylandwindow.h index 319a573dc..80d4f3138 100644 --- a/Engine/lib/sdl/src/video/wayland/SDL_waylandwindow.h +++ b/Engine/lib/sdl/src/video/wayland/SDL_waylandwindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_waylandwindow_h -#define _SDL_waylandwindow_h +#ifndef SDL_waylandwindow_h_ +#define SDL_waylandwindow_h_ #include "../SDL_sysvideo.h" #include "SDL_syswm.h" @@ -31,11 +31,23 @@ struct SDL_WaylandInput; +typedef struct { + struct zxdg_surface_v6 *surface; + union { + struct zxdg_toplevel_v6 *toplevel; + struct zxdg_popup_v6 *popup; + } roleobj; +} SDL_zxdg_shell_surface; + typedef struct { SDL_Window *sdlwindow; SDL_VideoData *waylandData; struct wl_surface *surface; - struct wl_shell_surface *shell_surface; + union { + /* !!! FIXME: add stable xdg_shell from 1.12 */ + SDL_zxdg_shell_surface zxdg; + struct wl_shell_surface *wl; + } shell_surface; struct wl_egl_window *egl_window; struct SDL_WaylandInput *keyboard_device; EGLSurface egl_surface; @@ -61,6 +73,6 @@ extern SDL_bool Wayland_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info); extern int Wayland_SetWindowHitTest(SDL_Window *window, SDL_bool enabled); -#endif /* _SDL_waylandwindow_h */ +#endif /* SDL_waylandwindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_msctf.h b/Engine/lib/sdl/src/video/windows/SDL_msctf.h index 74e22f107..53cec3d13 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_msctf.h +++ b/Engine/lib/sdl/src/video/windows/SDL_msctf.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -19,8 +19,8 @@ 3. This notice may not be removed or altered from any source distribution. */ -#ifndef _SDL_msctf_h -#define _SDL_msctf_h +#ifndef SDL_msctf_h_ +#define SDL_msctf_h_ #include @@ -239,4 +239,4 @@ struct ITfSource const struct ITfSourceVtbl *lpVtbl; }; -#endif /* _SDL_msctf_h */ +#endif /* SDL_msctf_h_ */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_vkeys.h b/Engine/lib/sdl/src/video/windows/SDL_vkeys.h index fd6520419..a38e3a281 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_vkeys.h +++ b/Engine/lib/sdl/src/video/windows/SDL_vkeys.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsclipboard.c b/Engine/lib/sdl/src/video/windows/SDL_windowsclipboard.c index b57a66a7b..4e61d7ab0 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsclipboard.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsclipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsclipboard.h b/Engine/lib/sdl/src/video/windows/SDL_windowsclipboard.h index d86cd97ec..937b7d0a5 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsclipboard.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsclipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowsclipboard_h -#define _SDL_windowsclipboard_h +#ifndef SDL_windowsclipboard_h_ +#define SDL_windowsclipboard_h_ /* Forward declaration */ struct SDL_VideoData; @@ -31,6 +31,6 @@ extern char *WIN_GetClipboardText(_THIS); extern SDL_bool WIN_HasClipboardText(_THIS); extern void WIN_CheckClipboardUpdate(struct SDL_VideoData * data); -#endif /* _SDL_windowsclipboard_h */ +#endif /* SDL_windowsclipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsevents.c b/Engine/lib/sdl/src/video/windows/SDL_windowsevents.c index 02768fb68..a5fd00689 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsevents.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsevents.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,6 +28,7 @@ #include "SDL_syswm.h" #include "SDL_timer.h" #include "SDL_vkeys.h" +#include "SDL_hints.h" #include "../../events/SDL_events_c.h" #include "../../events/SDL_touch_c.h" #include "../../events/scancodes_windows.h" @@ -81,120 +82,136 @@ #define WM_UNICHAR 0x0109 #endif +static SDL_Scancode +VKeytoScancode(WPARAM vkey) +{ + switch (vkey) { + case VK_CLEAR: return SDL_SCANCODE_CLEAR; + case VK_MODECHANGE: return SDL_SCANCODE_MODE; + case VK_SELECT: return SDL_SCANCODE_SELECT; + case VK_EXECUTE: return SDL_SCANCODE_EXECUTE; + case VK_HELP: return SDL_SCANCODE_HELP; + case VK_PAUSE: return SDL_SCANCODE_PAUSE; + case VK_NUMLOCK: return SDL_SCANCODE_NUMLOCKCLEAR; + + case VK_F13: return SDL_SCANCODE_F13; + case VK_F14: return SDL_SCANCODE_F14; + case VK_F15: return SDL_SCANCODE_F15; + case VK_F16: return SDL_SCANCODE_F16; + case VK_F17: return SDL_SCANCODE_F17; + case VK_F18: return SDL_SCANCODE_F18; + case VK_F19: return SDL_SCANCODE_F19; + case VK_F20: return SDL_SCANCODE_F20; + case VK_F21: return SDL_SCANCODE_F21; + case VK_F22: return SDL_SCANCODE_F22; + case VK_F23: return SDL_SCANCODE_F23; + case VK_F24: return SDL_SCANCODE_F24; + + case VK_OEM_NEC_EQUAL: return SDL_SCANCODE_KP_EQUALS; + case VK_BROWSER_BACK: return SDL_SCANCODE_AC_BACK; + case VK_BROWSER_FORWARD: return SDL_SCANCODE_AC_FORWARD; + case VK_BROWSER_REFRESH: return SDL_SCANCODE_AC_REFRESH; + case VK_BROWSER_STOP: return SDL_SCANCODE_AC_STOP; + case VK_BROWSER_SEARCH: return SDL_SCANCODE_AC_SEARCH; + case VK_BROWSER_FAVORITES: return SDL_SCANCODE_AC_BOOKMARKS; + case VK_BROWSER_HOME: return SDL_SCANCODE_AC_HOME; + case VK_VOLUME_MUTE: return SDL_SCANCODE_AUDIOMUTE; + case VK_VOLUME_DOWN: return SDL_SCANCODE_VOLUMEDOWN; + case VK_VOLUME_UP: return SDL_SCANCODE_VOLUMEUP; + + case VK_MEDIA_NEXT_TRACK: return SDL_SCANCODE_AUDIONEXT; + case VK_MEDIA_PREV_TRACK: return SDL_SCANCODE_AUDIOPREV; + case VK_MEDIA_STOP: return SDL_SCANCODE_AUDIOSTOP; + case VK_MEDIA_PLAY_PAUSE: return SDL_SCANCODE_AUDIOPLAY; + case VK_LAUNCH_MAIL: return SDL_SCANCODE_MAIL; + case VK_LAUNCH_MEDIA_SELECT: return SDL_SCANCODE_MEDIASELECT; + + case VK_OEM_102: return SDL_SCANCODE_NONUSBACKSLASH; + + case VK_ATTN: return SDL_SCANCODE_SYSREQ; + case VK_CRSEL: return SDL_SCANCODE_CRSEL; + case VK_EXSEL: return SDL_SCANCODE_EXSEL; + case VK_OEM_CLEAR: return SDL_SCANCODE_CLEAR; + + case VK_LAUNCH_APP1: return SDL_SCANCODE_APP1; + case VK_LAUNCH_APP2: return SDL_SCANCODE_APP2; + + default: return SDL_SCANCODE_UNKNOWN; + } +} + static SDL_Scancode WindowsScanCodeToSDLScanCode(LPARAM lParam, WPARAM wParam) { SDL_Scancode code; - char bIsExtended; int nScanCode = (lParam >> 16) & 0xFF; + SDL_bool bIsExtended = (lParam & (1 << 24)) != 0; - /* 0x45 here to work around both pause and numlock sharing the same scancode, so use the VK key to tell them apart */ - if (nScanCode == 0 || nScanCode == 0x45) { - switch(wParam) { - case VK_CLEAR: return SDL_SCANCODE_CLEAR; - case VK_MODECHANGE: return SDL_SCANCODE_MODE; - case VK_SELECT: return SDL_SCANCODE_SELECT; - case VK_EXECUTE: return SDL_SCANCODE_EXECUTE; - case VK_HELP: return SDL_SCANCODE_HELP; - case VK_PAUSE: return SDL_SCANCODE_PAUSE; - case VK_NUMLOCK: return SDL_SCANCODE_NUMLOCKCLEAR; + code = VKeytoScancode(wParam); - case VK_F13: return SDL_SCANCODE_F13; - case VK_F14: return SDL_SCANCODE_F14; - case VK_F15: return SDL_SCANCODE_F15; - case VK_F16: return SDL_SCANCODE_F16; - case VK_F17: return SDL_SCANCODE_F17; - case VK_F18: return SDL_SCANCODE_F18; - case VK_F19: return SDL_SCANCODE_F19; - case VK_F20: return SDL_SCANCODE_F20; - case VK_F21: return SDL_SCANCODE_F21; - case VK_F22: return SDL_SCANCODE_F22; - case VK_F23: return SDL_SCANCODE_F23; - case VK_F24: return SDL_SCANCODE_F24; + if (code == SDL_SCANCODE_UNKNOWN && nScanCode <= 127) { + code = windows_scancode_table[nScanCode]; - case VK_OEM_NEC_EQUAL: return SDL_SCANCODE_KP_EQUALS; - case VK_BROWSER_BACK: return SDL_SCANCODE_AC_BACK; - case VK_BROWSER_FORWARD: return SDL_SCANCODE_AC_FORWARD; - case VK_BROWSER_REFRESH: return SDL_SCANCODE_AC_REFRESH; - case VK_BROWSER_STOP: return SDL_SCANCODE_AC_STOP; - case VK_BROWSER_SEARCH: return SDL_SCANCODE_AC_SEARCH; - case VK_BROWSER_FAVORITES: return SDL_SCANCODE_AC_BOOKMARKS; - case VK_BROWSER_HOME: return SDL_SCANCODE_AC_HOME; - case VK_VOLUME_MUTE: return SDL_SCANCODE_AUDIOMUTE; - case VK_VOLUME_DOWN: return SDL_SCANCODE_VOLUMEDOWN; - case VK_VOLUME_UP: return SDL_SCANCODE_VOLUMEUP; - - case VK_MEDIA_NEXT_TRACK: return SDL_SCANCODE_AUDIONEXT; - case VK_MEDIA_PREV_TRACK: return SDL_SCANCODE_AUDIOPREV; - case VK_MEDIA_STOP: return SDL_SCANCODE_AUDIOSTOP; - case VK_MEDIA_PLAY_PAUSE: return SDL_SCANCODE_AUDIOPLAY; - case VK_LAUNCH_MAIL: return SDL_SCANCODE_MAIL; - case VK_LAUNCH_MEDIA_SELECT: return SDL_SCANCODE_MEDIASELECT; - - case VK_OEM_102: return SDL_SCANCODE_NONUSBACKSLASH; - - case VK_ATTN: return SDL_SCANCODE_SYSREQ; - case VK_CRSEL: return SDL_SCANCODE_CRSEL; - case VK_EXSEL: return SDL_SCANCODE_EXSEL; - case VK_OEM_CLEAR: return SDL_SCANCODE_CLEAR; - - case VK_LAUNCH_APP1: return SDL_SCANCODE_APP1; - case VK_LAUNCH_APP2: return SDL_SCANCODE_APP2; - - default: return SDL_SCANCODE_UNKNOWN; + if (bIsExtended) { + switch (code) { + case SDL_SCANCODE_RETURN: + code = SDL_SCANCODE_KP_ENTER; + break; + case SDL_SCANCODE_LALT: + code = SDL_SCANCODE_RALT; + break; + case SDL_SCANCODE_LCTRL: + code = SDL_SCANCODE_RCTRL; + break; + case SDL_SCANCODE_SLASH: + code = SDL_SCANCODE_KP_DIVIDE; + break; + case SDL_SCANCODE_CAPSLOCK: + code = SDL_SCANCODE_KP_PLUS; + break; + default: + break; + } + } else { + switch (code) { + case SDL_SCANCODE_HOME: + code = SDL_SCANCODE_KP_7; + break; + case SDL_SCANCODE_UP: + code = SDL_SCANCODE_KP_8; + break; + case SDL_SCANCODE_PAGEUP: + code = SDL_SCANCODE_KP_9; + break; + case SDL_SCANCODE_LEFT: + code = SDL_SCANCODE_KP_4; + break; + case SDL_SCANCODE_RIGHT: + code = SDL_SCANCODE_KP_6; + break; + case SDL_SCANCODE_END: + code = SDL_SCANCODE_KP_1; + break; + case SDL_SCANCODE_DOWN: + code = SDL_SCANCODE_KP_2; + break; + case SDL_SCANCODE_PAGEDOWN: + code = SDL_SCANCODE_KP_3; + break; + case SDL_SCANCODE_INSERT: + code = SDL_SCANCODE_KP_0; + break; + case SDL_SCANCODE_DELETE: + code = SDL_SCANCODE_KP_PERIOD; + break; + case SDL_SCANCODE_PRINTSCREEN: + code = SDL_SCANCODE_KP_MULTIPLY; + break; + default: + break; + } } } - - if (nScanCode > 127) - return SDL_SCANCODE_UNKNOWN; - - code = windows_scancode_table[nScanCode]; - - bIsExtended = (lParam & (1 << 24)) != 0; - if (!bIsExtended) { - switch (code) { - case SDL_SCANCODE_HOME: - return SDL_SCANCODE_KP_7; - case SDL_SCANCODE_UP: - return SDL_SCANCODE_KP_8; - case SDL_SCANCODE_PAGEUP: - return SDL_SCANCODE_KP_9; - case SDL_SCANCODE_LEFT: - return SDL_SCANCODE_KP_4; - case SDL_SCANCODE_RIGHT: - return SDL_SCANCODE_KP_6; - case SDL_SCANCODE_END: - return SDL_SCANCODE_KP_1; - case SDL_SCANCODE_DOWN: - return SDL_SCANCODE_KP_2; - case SDL_SCANCODE_PAGEDOWN: - return SDL_SCANCODE_KP_3; - case SDL_SCANCODE_INSERT: - return SDL_SCANCODE_KP_0; - case SDL_SCANCODE_DELETE: - return SDL_SCANCODE_KP_PERIOD; - case SDL_SCANCODE_PRINTSCREEN: - return SDL_SCANCODE_KP_MULTIPLY; - default: - break; - } - } else { - switch (code) { - case SDL_SCANCODE_RETURN: - return SDL_SCANCODE_KP_ENTER; - case SDL_SCANCODE_LALT: - return SDL_SCANCODE_RALT; - case SDL_SCANCODE_LCTRL: - return SDL_SCANCODE_RCTRL; - case SDL_SCANCODE_SLASH: - return SDL_SCANCODE_KP_DIVIDE; - case SDL_SCANCODE_CAPSLOCK: - return SDL_SCANCODE_KP_PLUS; - default: - break; - } - } - return code; } @@ -204,7 +221,7 @@ WIN_ShouldIgnoreFocusClick() return !SDL_GetHintBoolean(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, SDL_FALSE); } -void +static void WIN_CheckWParamMouseButton(SDL_bool bwParamMousePressed, SDL_bool bSDLMousePressed, SDL_WindowData *data, Uint8 button, SDL_MouseID mouseID) { if (data->focus_click_pending & SDL_BUTTON(button)) { @@ -231,7 +248,7 @@ WIN_CheckWParamMouseButton(SDL_bool bwParamMousePressed, SDL_bool bSDLMousePress * Some windows systems fail to send a WM_LBUTTONDOWN sometimes, but each mouse move contains the current button state also * so this funciton reconciles our view of the world with the current buttons reported by windows */ -void +static void WIN_CheckWParamMouseButtons(WPARAM wParam, SDL_WindowData *data, SDL_MouseID mouseID) { if (wParam != data->mouse_button_flags) { @@ -246,7 +263,7 @@ WIN_CheckWParamMouseButtons(WPARAM wParam, SDL_WindowData *data, SDL_MouseID mou } -void +static void WIN_CheckRawMouseButtons(ULONG rawButtons, SDL_WindowData *data) { if (rawButtons != data->mouse_button_flags) { @@ -275,7 +292,7 @@ WIN_CheckRawMouseButtons(ULONG rawButtons, SDL_WindowData *data) } } -void +static void WIN_CheckAsyncMouseRelease(SDL_WindowData *data) { Uint32 mouseFlags; @@ -309,7 +326,7 @@ WIN_CheckAsyncMouseRelease(SDL_WindowData *data) data->mouse_button_flags = 0; } -BOOL +static BOOL WIN_ConvertUTF32toUTF8(UINT32 codepoint, char * text) { if (codepoint <= 0x7F) { @@ -342,6 +359,11 @@ ShouldGenerateWindowCloseOnAltF4(void) return !SDL_GetHintBoolean(SDL_HINT_WINDOWS_NO_CLOSE_ON_ALT_F4, SDL_FALSE); } +/* Win10 "Fall Creators Update" introduced the bug that SetCursorPos() (as used by SDL_WarpMouseInWindow()) + doesn't reliably generate WM_MOUSEMOVE events anymore (see #3931) which breaks relative mouse mode via warping. + This is used to implement a workaround.. */ +static SDL_bool isWin10FCUorNewer = SDL_FALSE; + LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -423,11 +445,11 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (SDL_GetKeyboardFocus() != data->window) { SDL_SetKeyboardFocus(data->window); } - + GetCursorPos(&cursorPos); ScreenToClient(hwnd, &cursorPos); SDL_SendMouseMotion(data->window, 0, 0, cursorPos.x, cursorPos.y); - + WIN_CheckAsyncMouseRelease(data); /* @@ -459,6 +481,17 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) if (!mouse->relative_mode || mouse->relative_mode_warp) { SDL_MouseID mouseID = (((GetMessageExtraInfo() & MOUSEEVENTF_FROMTOUCH) == MOUSEEVENTF_FROMTOUCH) ? SDL_TOUCH_MOUSEID : 0); SDL_SendMouseMotion(data->window, mouseID, 0, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); + if (isWin10FCUorNewer && mouseID != SDL_TOUCH_MOUSEID && mouse->relative_mode_warp) { + /* To work around #3931, Win10 bug introduced in Fall Creators Update, where + SetCursorPos() (SDL_WarpMouseInWindow()) doesn't reliably generate mouse events anymore, + after each windows mouse event generate a fake event for the middle of the window + if relative_mode_warp is used */ + int center_x = 0, center_y = 0; + SDL_GetWindowSize(data->window, ¢er_x, ¢er_y); + center_x /= 2; + center_y /= 2; + SDL_SendMouseMotion(data->window, mouseID, 0, center_x, center_y); + } } } /* don't break here, fall through to check the wParam like the button presses */ @@ -515,7 +548,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) initialMousePoint.y = rawmouse->lLastY; } - SDL_SendMouseMotion(data->window, 0, 1, (int)(rawmouse->lLastX-initialMousePoint.x), (int)(rawmouse->lLastY-initialMousePoint.y) ); + SDL_SendMouseMotion(data->window, 0, 1, (int)(rawmouse->lLastX-initialMousePoint.x), (int)(rawmouse->lLastY-initialMousePoint.y)); initialMousePoint.x = rawmouse->lLastX; initialMousePoint.y = rawmouse->lLastY; @@ -524,10 +557,17 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } else if (isCapture) { /* we check for where Windows thinks the system cursor lives in this case, so we don't really lose mouse accel, etc. */ POINT pt; + RECT hwndRect; + HWND currentHnd; + GetCursorPos(&pt); - if (WindowFromPoint(pt) != hwnd) { /* if in the window, WM_MOUSEMOVE, etc, will cover it. */ - ScreenToClient(hwnd, &pt); - SDL_SendMouseMotion(data->window, 0, 0, (int) pt.x, (int) pt.y); + currentHnd = WindowFromPoint(pt); + ScreenToClient(hwnd, &pt); + GetClientRect(hwnd, &hwndRect); + + /* if in the window, WM_MOUSEMOVE, etc, will cover it. */ + if(currentHnd != hwnd || pt.x < 0 || pt.y < 0 || pt.x > hwndRect.right || pt.y > hwndRect.right) { + SDL_SendMouseMotion(data->window, 0, 0, (int)pt.x, (int)pt.y); SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_LBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_LEFT); SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_RBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_RIGHT); SDL_SendMouseButton(data->window, 0, GetAsyncKeyState(VK_MBUTTON) & 0x8000 ? SDL_PRESSED : SDL_RELEASED, SDL_BUTTON_MIDDLE); @@ -542,40 +582,14 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_MOUSEWHEEL: - { - static short s_AccumulatedMotion; - - s_AccumulatedMotion += GET_WHEEL_DELTA_WPARAM(wParam); - if (s_AccumulatedMotion > 0) { - while (s_AccumulatedMotion >= WHEEL_DELTA) { - SDL_SendMouseWheel(data->window, 0, 0, 1, SDL_MOUSEWHEEL_NORMAL); - s_AccumulatedMotion -= WHEEL_DELTA; - } - } else { - while (s_AccumulatedMotion <= -WHEEL_DELTA) { - SDL_SendMouseWheel(data->window, 0, 0, -1, SDL_MOUSEWHEEL_NORMAL); - s_AccumulatedMotion += WHEEL_DELTA; - } - } - } - break; - case WM_MOUSEHWHEEL: { - static short s_AccumulatedMotion; - - s_AccumulatedMotion += GET_WHEEL_DELTA_WPARAM(wParam); - if (s_AccumulatedMotion > 0) { - while (s_AccumulatedMotion >= WHEEL_DELTA) { - SDL_SendMouseWheel(data->window, 0, 1, 0, SDL_MOUSEWHEEL_NORMAL); - s_AccumulatedMotion -= WHEEL_DELTA; - } - } else { - while (s_AccumulatedMotion <= -WHEEL_DELTA) { - SDL_SendMouseWheel(data->window, 0, -1, 0, SDL_MOUSEWHEEL_NORMAL); - s_AccumulatedMotion += WHEEL_DELTA; - } - } + short amount = GET_WHEEL_DELTA_WPARAM(wParam); + float fAmount = (float) amount / WHEEL_DELTA; + if (msg == WM_MOUSEWHEEL) + SDL_SendMouseWheel(data->window, 0, 0.0f, fAmount, SDL_MOUSEWHEEL_NORMAL); + else + SDL_SendMouseWheel(data->window, 0, fAmount, 0.0f, SDL_MOUSEWHEEL_NORMAL); } break; @@ -612,7 +626,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) SDL_SendKeyboardKey(SDL_PRESSED, code); } } - + returnCode = 0; break; @@ -683,8 +697,6 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) int w, h; int min_w, min_h; int max_w, max_h; - int style; - BOOL menu; BOOL constrain_max_size; if (SDL_IsShapedWindow(data->window)) @@ -717,21 +729,23 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) constrain_max_size = FALSE; } - size.top = 0; - size.left = 0; - size.bottom = h; - size.right = w; + if (!(SDL_GetWindowFlags(data->window) & SDL_WINDOW_BORDERLESS)) { + LONG style = GetWindowLong(hwnd, GWL_STYLE); + /* DJM - according to the docs for GetMenu(), the + return value is undefined if hwnd is a child window. + Apparently it's too difficult for MS to check + inside their function, so I have to do it here. + */ + BOOL menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); + size.top = 0; + size.left = 0; + size.bottom = h; + size.right = w; - style = GetWindowLong(hwnd, GWL_STYLE); - /* DJM - according to the docs for GetMenu(), the - return value is undefined if hwnd is a child window. - Apparently it's too difficult for MS to check - inside their function, so I have to do it here. - */ - menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); - AdjustWindowRectEx(&size, style, menu, 0); - w = size.right - size.left; - h = size.bottom - size.top; + AdjustWindowRectEx(&size, style, menu, 0); + w = size.right - size.left; + h = size.bottom - size.top; + } /* Fix our size to the current size */ info = (MINMAXINFO *) lParam; @@ -769,7 +783,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) RECT rect; int x, y; int w, h; - + if (data->initializing || data->in_border_change) { break; } @@ -800,6 +814,8 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { switch (wParam) { case SIZE_MAXIMIZED: + SDL_SendWindowEvent(data->window, + SDL_WINDOWEVENT_RESTORED, 0, 0); SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_MAXIMIZED, 0, 0); break; @@ -875,7 +891,7 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) break; case WM_TOUCH: - { + if (data->videodata->GetTouchInputInfo && data->videodata->CloseTouchInputHandle) { UINT i, num_inputs = LOWORD(wParam); PTOUCHINPUT inputs = SDL_stack_alloc(TOUCHINPUT, num_inputs); if (data->videodata->GetTouchInputInfo((HTOUCHINPUT)lParam, num_inputs, inputs, sizeof(TOUCHINPUT))) { @@ -949,11 +965,29 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } break; + case WM_NCCALCSIZE: + { + Uint32 window_flags = SDL_GetWindowFlags(data->window); + if (wParam == TRUE && (window_flags & SDL_WINDOW_BORDERLESS) && !(window_flags & SDL_WINDOW_FULLSCREEN)) { + /* When borderless, need to tell windows that the size of the non-client area is 0 */ + if (!(window_flags & SDL_WINDOW_RESIZABLE)) { + int w, h; + NCCALCSIZE_PARAMS *params = (NCCALCSIZE_PARAMS *)lParam; + w = data->window->windowed.w; + h = data->window->windowed.h; + params->rgrc[0].right = params->rgrc[0].left + w; + params->rgrc[0].bottom = params->rgrc[0].top + h; + } + return 0; + } + } + break; + case WM_NCHITTEST: { SDL_Window *window = data->window; if (window->hit_test) { - POINT winpoint = { (int) LOWORD(lParam), (int) HIWORD(lParam) }; + POINT winpoint = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; if (ScreenToClient(hwnd, &winpoint)) { const SDL_Point point = { (int) winpoint.x, (int) winpoint.y }; const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data); @@ -976,7 +1010,6 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) } } break; - } /* If there's a window proc, assume it's going to handle messages */ @@ -1036,6 +1069,43 @@ WIN_PumpEvents(_THIS) } } +/* to work around #3931, a bug introduced in Win10 Fall Creators Update (build nr. 16299) + we need to detect the windows version. this struct and the function below does that. + usually this struct and the corresponding function (RtlGetVersion) are in + but here we just load it dynamically */ +struct SDL_WIN_OSVERSIONINFOW { + ULONG dwOSVersionInfoSize; + ULONG dwMajorVersion; + ULONG dwMinorVersion; + ULONG dwBuildNumber; + ULONG dwPlatformId; + WCHAR szCSDVersion[128]; +}; + +static SDL_bool +IsWin10FCUorNewer(void) +{ + HMODULE handle = GetModuleHandleW(L"ntdll.dll"); + if (handle) { + typedef LONG(WINAPI* RtlGetVersionPtr)(struct SDL_WIN_OSVERSIONINFOW*); + RtlGetVersionPtr getVersionPtr = (RtlGetVersionPtr)GetProcAddress(handle, "RtlGetVersion"); + if (getVersionPtr != NULL) { + struct SDL_WIN_OSVERSIONINFOW info; + SDL_zero(info); + info.dwOSVersionInfoSize = sizeof(info); + if (getVersionPtr(&info) == 0) { /* STATUS_SUCCESS == 0 */ + if ( (info.dwMajorVersion == 10 && info.dwMinorVersion == 0 && info.dwBuildNumber >= 16299) + || (info.dwMajorVersion == 10 && info.dwMinorVersion > 0) + || (info.dwMajorVersion > 10) ) + { + return SDL_TRUE; + } + } + } + } + return SDL_FALSE; +} + static int app_registered = 0; LPTSTR SDL_Appname = NULL; Uint32 SDL_Appstyle = 0; @@ -1045,6 +1115,7 @@ HINSTANCE SDL_Instance = NULL; int SDL_RegisterApp(char *name, Uint32 style, void *hInst) { + const char *hint; WNDCLASSEX wcex; TCHAR path[MAX_PATH]; @@ -1081,14 +1152,26 @@ SDL_RegisterApp(char *name, Uint32 style, void *hInst) wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; - /* Use the first icon as a default icon, like in the Explorer */ - GetModuleFileName(SDL_Instance, path, MAX_PATH); - ExtractIconEx(path, 0, &wcex.hIcon, &wcex.hIconSm, 1); + hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON); + if (hint && *hint) { + wcex.hIcon = LoadIcon(SDL_Instance, MAKEINTRESOURCE(SDL_atoi(hint))); + + hint = SDL_GetHint(SDL_HINT_WINDOWS_INTRESOURCE_ICON_SMALL); + if (hint && *hint) { + wcex.hIconSm = LoadIcon(SDL_Instance, MAKEINTRESOURCE(SDL_atoi(hint))); + } + } else { + /* Use the first icon as a default icon, like in the Explorer */ + GetModuleFileName(SDL_Instance, path, MAX_PATH); + ExtractIconEx(path, 0, &wcex.hIcon, &wcex.hIconSm, 1); + } if (!RegisterClassEx(&wcex)) { return SDL_SetError("Couldn't register application class"); } + isWin10FCUorNewer = IsWin10FCUorNewer(); + app_registered = 1; return 0; } diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsevents.h b/Engine/lib/sdl/src/video/windows/SDL_windowsevents.h index dcd3118a4..1ce2fb482 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsevents.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsevents.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowsevents_h -#define _SDL_windowsevents_h +#ifndef SDL_windowsevents_h_ +#define SDL_windowsevents_h_ extern LPTSTR SDL_Appname; extern Uint32 SDL_Appstyle; @@ -31,6 +31,6 @@ extern LRESULT CALLBACK WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); extern void WIN_PumpEvents(_THIS); -#endif /* _SDL_windowsevents_h */ +#endif /* SDL_windowsevents_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsframebuffer.c b/Engine/lib/sdl/src/video/windows/SDL_windowsframebuffer.c index 7bb07ed2e..e07d9c431 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsframebuffer.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsframebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsframebuffer.h b/Engine/lib/sdl/src/video/windows/SDL_windowsframebuffer.h index 0c825f9da..a83cca52b 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsframebuffer.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsframebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowskeyboard.c b/Engine/lib/sdl/src/video/windows/SDL_windowskeyboard.c index 8271b0421..c7f357b59 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowskeyboard.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowskeyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -268,7 +268,7 @@ void IME_Present(SDL_VideoData *videodata) #else -#ifdef _SDL_msctf_h +#ifdef SDL_msctf_h_ #define USE_INIT_GUID #elif defined(__GNUC__) #define USE_INIT_GUID @@ -295,11 +295,11 @@ DEFINE_GUID(IID_ITfThreadMgrEx, 0x3E90ADE3,0x7594 #define IMEID_VER(id) ((id) & 0xffff0000) #define IMEID_LANG(id) ((id) & 0x0000ffff) -#define CHT_HKL_DAYI ((HKL)0xE0060404) -#define CHT_HKL_NEW_PHONETIC ((HKL)0xE0080404) -#define CHT_HKL_NEW_CHANG_JIE ((HKL)0xE0090404) -#define CHT_HKL_NEW_QUICK ((HKL)0xE00A0404) -#define CHT_HKL_HK_CANTONESE ((HKL)0xE00B0404) +#define CHT_HKL_DAYI ((HKL)(UINT_PTR)0xE0060404) +#define CHT_HKL_NEW_PHONETIC ((HKL)(UINT_PTR)0xE0080404) +#define CHT_HKL_NEW_CHANG_JIE ((HKL)(UINT_PTR)0xE0090404) +#define CHT_HKL_NEW_QUICK ((HKL)(UINT_PTR)0xE00A0404) +#define CHT_HKL_HK_CANTONESE ((HKL)(UINT_PTR)0xE00B0404) #define CHT_IMEFILENAME1 "TINTLGNT.IME" #define CHT_IMEFILENAME2 "CINTLGNT.IME" #define CHT_IMEFILENAME3 "MSTCIPHA.IME" @@ -312,7 +312,7 @@ DEFINE_GUID(IID_ITfThreadMgrEx, 0x3E90ADE3,0x7594 #define IMEID_CHT_VER60 (LANG_CHT | MAKEIMEVERSION(6, 0)) #define IMEID_CHT_VER_VISTA (LANG_CHT | MAKEIMEVERSION(7, 0)) -#define CHS_HKL ((HKL)0xE00E0804) +#define CHS_HKL ((HKL)(UINT_PTR)0xE00E0804) #define CHS_IMEFILENAME1 "PINTLGNT.IME" #define CHS_IMEFILENAME2 "MSSCIPYA.IME" #define IMEID_CHS_VER41 (LANG_CHS | MAKEIMEVERSION(4, 1)) @@ -331,9 +331,6 @@ static DWORD IME_GetId(SDL_VideoData *videodata, UINT uIndex); static void IME_SendEditingEvent(SDL_VideoData *videodata); static void IME_DestroyTextures(SDL_VideoData *videodata); -#define SDL_IsEqualIID(riid1, riid2) SDL_IsEqualGUID(riid1, riid2) -#define SDL_IsEqualGUID(rguid1, rguid2) (!SDL_memcmp(rguid1, rguid2, sizeof(GUID))) - static SDL_bool UILess_SetupSinks(SDL_VideoData *videodata); static void UILess_ReleaseSinks(SDL_VideoData *videodata); static void UILess_EnableUIUpdates(SDL_VideoData *videodata); @@ -354,6 +351,7 @@ IME_Init(SDL_VideoData *videodata, HWND hwnd) videodata->ime_himm32 = SDL_LoadObject("imm32.dll"); if (!videodata->ime_himm32) { videodata->ime_available = SDL_FALSE; + SDL_ClearError(); return; } videodata->ImmLockIMC = (LPINPUTCONTEXT2 (WINAPI *)(HIMC))SDL_LoadFunction(videodata->ime_himm32, "ImmLockIMC"); @@ -448,16 +446,12 @@ IME_GetReadingString(SDL_VideoData *videodata, HWND hwnd) INT err = 0; BOOL vertical = FALSE; UINT maxuilen = 0; - static OSVERSIONINFOA osversion; if (videodata->ime_uiless) return; videodata->ime_readingstring[0] = 0; - if (!osversion.dwOSVersionInfoSize) { - osversion.dwOSVersionInfoSize = sizeof(osversion); - GetVersionExA(&osversion); - } + id = IME_GetId(videodata, 0); if (!id) return; @@ -518,9 +512,6 @@ IME_GetReadingString(SDL_VideoData *videodata, HWND hwnd) } break; case IMEID_CHS_VER42: - if (osversion.dwPlatformId != VER_PLATFORM_WIN32_NT) - break; - p = *(LPBYTE *)((LPBYTE)videodata->ImmLockIMCC(lpimc->hPrivate) + 1*4 + 1*4 + 6*4); if (!p) break; @@ -837,7 +828,11 @@ IME_GetCandidateList(HIMC himc, SDL_VideoData *videodata) videodata->ime_candpgsize = i - page_start; } else { videodata->ime_candpgsize = SDL_min(cand_list->dwPageSize, MAX_CANDLIST); - page_start = (cand_list->dwSelection / videodata->ime_candpgsize) * videodata->ime_candpgsize; + if (videodata->ime_candpgsize > 0) { + page_start = (cand_list->dwSelection / videodata->ime_candpgsize) * videodata->ime_candpgsize; + } else { + page_start = 0; + } } SDL_memset(&videodata->ime_candidates, 0, sizeof(videodata->ime_candidates)); for (i = page_start, j = 0; (DWORD)i < cand_list->dwCount && j < (int)videodata->ime_candpgsize; i++, j++) { @@ -1036,7 +1031,7 @@ STDMETHODIMP_(ULONG) TSFSink_AddRef(TSFSink *sink) return ++sink->refcount; } -STDMETHODIMP_(ULONG)TSFSink_Release(TSFSink *sink) +STDMETHODIMP_(ULONG) TSFSink_Release(TSFSink *sink) { --sink->refcount; if (sink->refcount == 0) { @@ -1052,9 +1047,9 @@ STDMETHODIMP UIElementSink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv return E_INVALIDARG; *ppv = 0; - if (SDL_IsEqualIID(riid, &IID_IUnknown)) + if (WIN_IsEqualIID(riid, &IID_IUnknown)) *ppv = (IUnknown *)sink; - else if (SDL_IsEqualIID(riid, &IID_ITfUIElementSink)) + else if (WIN_IsEqualIID(riid, &IID_ITfUIElementSink)) *ppv = (ITfUIElementSink *)sink; if (*ppv) { @@ -1158,9 +1153,9 @@ STDMETHODIMP IPPASink_QueryInterface(TSFSink *sink, REFIID riid, PVOID *ppv) return E_INVALIDARG; *ppv = 0; - if (SDL_IsEqualIID(riid, &IID_IUnknown)) + if (WIN_IsEqualIID(riid, &IID_IUnknown)) *ppv = (IUnknown *)sink; - else if (SDL_IsEqualIID(riid, &IID_ITfInputProcessorProfileActivationSink)) + else if (WIN_IsEqualIID(riid, &IID_ITfInputProcessorProfileActivationSink)) *ppv = (ITfInputProcessorProfileActivationSink *)sink; if (*ppv) { @@ -1174,8 +1169,8 @@ STDMETHODIMP IPPASink_OnActivated(TSFSink *sink, DWORD dwProfileType, LANGID lan { static const GUID TF_PROFILE_DAYI = { 0x037B2C25, 0x480C, 0x4D7F, { 0xB0, 0x27, 0xD6, 0xCA, 0x6B, 0x69, 0x78, 0x8A } }; SDL_VideoData *videodata = (SDL_VideoData *)sink->data; - videodata->ime_candlistindexbase = SDL_IsEqualGUID(&TF_PROFILE_DAYI, guidProfile) ? 0 : 1; - if (SDL_IsEqualIID(catid, &GUID_TFCAT_TIP_KEYBOARD) && (dwFlags & TF_IPSINK_FLAG_ACTIVE)) + videodata->ime_candlistindexbase = WIN_IsEqualGUID(&TF_PROFILE_DAYI, guidProfile) ? 0 : 1; + if (WIN_IsEqualIID(catid, &GUID_TFCAT_TIP_KEYBOARD) && (dwFlags & TF_IPSINK_FLAG_ACTIVE)) IME_InputLangChanged((SDL_VideoData *)sink->data); IME_HideCandidateList(videodata); diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowskeyboard.h b/Engine/lib/sdl/src/video/windows/SDL_windowskeyboard.h index 84654d7b8..49a1b8788 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowskeyboard.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowskeyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowskeyboard_h -#define _SDL_windowskeyboard_h +#ifndef SDL_windowskeyboard_h_ +#define SDL_windowskeyboard_h_ extern void WIN_InitKeyboard(_THIS); extern void WIN_UpdateKeymap(void); @@ -35,6 +35,6 @@ extern void WIN_SetTextInputRect(_THIS, SDL_Rect *rect); extern SDL_bool IME_HandleMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM *lParam, struct SDL_VideoData *videodata); -#endif /* _SDL_windowskeyboard_h */ +#endif /* SDL_windowskeyboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsmessagebox.c b/Engine/lib/sdl/src/video/windows/SDL_windowsmessagebox.c index 689e5bbc3..924b4121b 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsmessagebox.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsmessagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -346,7 +346,6 @@ WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { WIN_DialogData *dialog; int i, x, y; - UINT_PTR which; const SDL_MessageBoxButtonData *buttons = messageboxdata->buttons; HFONT DialogFont; SIZE Size; @@ -354,6 +353,7 @@ WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) wchar_t* wmessage; TEXTMETRIC TM; + HWND ParentWindow = NULL; const int ButtonWidth = 88; const int ButtonHeight = 26; @@ -411,14 +411,24 @@ WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) { /* Get the metrics to try and figure our DLU conversion. */ GetTextMetrics(FontDC, &TM); - s_BaseUnitsX = TM.tmAveCharWidth + 1; + + /* Calculation from the following documentation: + * https://support.microsoft.com/en-gb/help/125681/how-to-calculate-dialog-base-units-with-non-system-based-font + * This fixes bug 2137, dialog box calculation with a fixed-width system font + */ + { + SIZE extent; + GetTextExtentPoint32A(FontDC, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 52, &extent); + s_BaseUnitsX = (extent.cx / 26 + 1) / 2; + } + /*s_BaseUnitsX = TM.tmAveCharWidth + 1;*/ s_BaseUnitsY = TM.tmHeight; } /* Measure the *pixel* size of the string. */ wmessage = WIN_UTF8ToString(messageboxdata->message); SDL_zero(TextSize); - Size.cx = DrawText(FontDC, wmessage, -1, &TextSize, DT_CALCRECT); + DrawText(FontDC, wmessage, -1, &TextSize, DT_CALCRECT); /* Add some padding for hangs, etc. */ TextSize.right += 2; @@ -462,16 +472,20 @@ WIN_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid) } else { isDefault = SDL_FALSE; } - if (!AddDialogButton(dialog, x, y, ButtonWidth, ButtonHeight, buttons[i].text, i, isDefault)) { + if (!AddDialogButton(dialog, x, y, ButtonWidth, ButtonHeight, buttons[i].text, buttons[i].buttonid, isDefault)) { FreeDialogData(dialog); return -1; } x += ButtonWidth + ButtonMargin; } - /* FIXME: If we have a parent window, get the Instance and HWND for them */ - which = DialogBoxIndirect(NULL, (DLGTEMPLATE*)dialog->lpDialog, NULL, (DLGPROC)MessageBoxDialogProc); - *buttonid = buttons[which].buttonid; + /* If we have a parent window, get the Instance and HWND for them + * so that our little dialog gets exclusive focus at all times. */ + if (messageboxdata->window) { + ParentWindow = ((SDL_WindowData*)messageboxdata->window->driverdata)->hwnd; + } + + *buttonid = (int)DialogBoxIndirect(NULL, (DLGTEMPLATE*)dialog->lpDialog, ParentWindow, (DLGPROC)MessageBoxDialogProc); FreeDialogData(dialog); return 0; diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsmessagebox.h b/Engine/lib/sdl/src/video/windows/SDL_windowsmessagebox.h index e9c692546..2cb29beb6 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsmessagebox.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsmodes.c b/Engine/lib/sdl/src/video/windows/SDL_windowsmodes.c index f172f9a3d..7425d9ab3 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsmodes.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsmodes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,56 +24,18 @@ #include "SDL_windowsvideo.h" #include "../../../include/SDL_assert.h" +#include "../../../include/SDL_log.h" /* Windows CE compatibility */ #ifndef CDS_FULLSCREEN #define CDS_FULLSCREEN 0 #endif -typedef struct _WIN_GetMonitorDPIData { - SDL_VideoData *vid_data; - SDL_DisplayMode *mode; - SDL_DisplayModeData *mode_data; -} WIN_GetMonitorDPIData; - -static BOOL CALLBACK -WIN_GetMonitorDPI(HMONITOR hMonitor, - HDC hdcMonitor, - LPRECT lprcMonitor, - LPARAM dwData) -{ - WIN_GetMonitorDPIData *data = (WIN_GetMonitorDPIData*) dwData; - UINT hdpi, vdpi; - - if (data->vid_data->GetDpiForMonitor(hMonitor, MDT_EFFECTIVE_DPI, &hdpi, &vdpi) == S_OK && - hdpi > 0 && - vdpi > 0) { - float hsize, vsize; - - data->mode_data->HorzDPI = (float)hdpi; - data->mode_data->VertDPI = (float)vdpi; - - // Figure out the monitor size and compute the diagonal DPI. - hsize = data->mode->w / data->mode_data->HorzDPI; - vsize = data->mode->h / data->mode_data->VertDPI; - - data->mode_data->DiagDPI = SDL_ComputeDiagonalDPI( data->mode->w, - data->mode->h, - hsize, - vsize ); - - // We can only handle one DPI per display mode so end the enumeration. - return FALSE; - } - - // We didn't get DPI information so keep going. - return TRUE; -} +/* #define DEBUG_MODES */ static void WIN_UpdateDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mode) { - SDL_VideoData *vid_data = (SDL_VideoData *) _this->driverdata; SDL_DisplayModeData *data = (SDL_DisplayModeData *) mode->driverdata; HDC hdc; @@ -89,39 +51,8 @@ WIN_UpdateDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * int logical_width = GetDeviceCaps( hdc, HORZRES ); int logical_height = GetDeviceCaps( hdc, VERTRES ); - data->ScaleX = (float)logical_width / data->DeviceMode.dmPelsWidth; - data->ScaleY = (float)logical_height / data->DeviceMode.dmPelsHeight; mode->w = logical_width; mode->h = logical_height; - - // WIN_GetMonitorDPI needs mode->w and mode->h - // so only call after those are set. - if (vid_data->GetDpiForMonitor) { - WIN_GetMonitorDPIData dpi_data; - RECT monitor_rect; - - dpi_data.vid_data = vid_data; - dpi_data.mode = mode; - dpi_data.mode_data = data; - monitor_rect.left = data->DeviceMode.dmPosition.x; - monitor_rect.top = data->DeviceMode.dmPosition.y; - monitor_rect.right = monitor_rect.left + 1; - monitor_rect.bottom = monitor_rect.top + 1; - EnumDisplayMonitors(NULL, &monitor_rect, WIN_GetMonitorDPI, (LPARAM)&dpi_data); - } else { - // We don't have the Windows 8.1 routine so just - // get system DPI. - data->HorzDPI = (float)GetDeviceCaps( hdc, LOGPIXELSX ); - data->VertDPI = (float)GetDeviceCaps( hdc, LOGPIXELSY ); - if (data->HorzDPI == data->VertDPI) { - data->DiagDPI = data->HorzDPI; - } else { - data->DiagDPI = SDL_ComputeDiagonalDPI( mode->w, - mode->h, - (float)GetDeviceCaps( hdc, HORZSIZE ) / 25.4f, - (float)GetDeviceCaps( hdc, VERTSIZE ) / 25.4f ); - } - } SDL_zero(bmi_data); bmi = (LPBITMAPINFO) bmi_data; @@ -199,13 +130,6 @@ WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mod mode->driverdata = data; data->DeviceMode = devmode; - /* Default basic information */ - data->ScaleX = 1.0f; - data->ScaleY = 1.0f; - data->DiagDPI = 0.0f; - data->HorzDPI = 0.0f; - data->VertDPI = 0.0f; - mode->format = SDL_PIXELFORMAT_UNKNOWN; mode->w = data->DeviceMode.dmPelsWidth; mode->h = data->DeviceMode.dmPelsHeight; @@ -217,7 +141,7 @@ WIN_GetDisplayMode(_THIS, LPCTSTR deviceName, DWORD index, SDL_DisplayMode * mod } static SDL_bool -WIN_AddDisplay(_THIS, LPTSTR DeviceName) +WIN_AddDisplay(_THIS, HMONITOR hMonitor, const MONITORINFOEX *info) { SDL_VideoDisplay display; SDL_DisplayData *displaydata; @@ -225,9 +149,10 @@ WIN_AddDisplay(_THIS, LPTSTR DeviceName) DISPLAY_DEVICE device; #ifdef DEBUG_MODES - printf("Display: %s\n", WIN_StringToUTF8(DeviceName)); + SDL_Log("Display: %s\n", WIN_StringToUTF8(info->szDevice)); #endif - if (!WIN_GetDisplayMode(_this, DeviceName, ENUM_CURRENT_SETTINGS, &mode)) { + + if (!WIN_GetDisplayMode(_this, info->szDevice, ENUM_CURRENT_SETTINGS, &mode)) { return SDL_FALSE; } @@ -235,12 +160,13 @@ WIN_AddDisplay(_THIS, LPTSTR DeviceName) if (!displaydata) { return SDL_FALSE; } - SDL_memcpy(displaydata->DeviceName, DeviceName, + SDL_memcpy(displaydata->DeviceName, info->szDevice, sizeof(displaydata->DeviceName)); + displaydata->MonitorHandle = hMonitor; SDL_zero(display); device.cb = sizeof(device); - if (EnumDisplayDevices(DeviceName, 0, &device, 0)) { + if (EnumDisplayDevices(info->szDevice, 0, &device, 0)) { display.name = WIN_StringToUTF8(device.DeviceString); } display.desktop_mode = mode; @@ -251,63 +177,53 @@ WIN_AddDisplay(_THIS, LPTSTR DeviceName) return SDL_TRUE; } +typedef struct _WIN_AddDisplaysData { + SDL_VideoDevice *video_device; + SDL_bool want_primary; +} WIN_AddDisplaysData; + +static BOOL CALLBACK +WIN_AddDisplaysCallback(HMONITOR hMonitor, + HDC hdcMonitor, + LPRECT lprcMonitor, + LPARAM dwData) +{ + WIN_AddDisplaysData *data = (WIN_AddDisplaysData*)dwData; + MONITORINFOEX info; + + SDL_zero(info); + info.cbSize = sizeof(info); + + if (GetMonitorInfo(hMonitor, (LPMONITORINFO)&info) != 0) { + const SDL_bool is_primary = ((info.dwFlags & MONITORINFOF_PRIMARY) == MONITORINFOF_PRIMARY); + + if (is_primary == data->want_primary) { + WIN_AddDisplay(data->video_device, hMonitor, &info); + } + } + + // continue enumeration + return TRUE; +} + +static void +WIN_AddDisplays(_THIS) +{ + WIN_AddDisplaysData callback_data; + callback_data.video_device = _this; + + callback_data.want_primary = SDL_TRUE; + EnumDisplayMonitors(NULL, NULL, WIN_AddDisplaysCallback, (LPARAM)&callback_data); + + callback_data.want_primary = SDL_FALSE; + EnumDisplayMonitors(NULL, NULL, WIN_AddDisplaysCallback, (LPARAM)&callback_data); +} + int WIN_InitModes(_THIS) { - int pass; - DWORD i, j, count; - DISPLAY_DEVICE device; + WIN_AddDisplays(_this); - device.cb = sizeof(device); - - /* Get the primary display in the first pass */ - for (pass = 0; pass < 2; ++pass) { - for (i = 0; ; ++i) { - TCHAR DeviceName[32]; - - if (!EnumDisplayDevices(NULL, i, &device, 0)) { - break; - } - if (!(device.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)) { - continue; - } - if (pass == 0) { - if (!(device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)) { - continue; - } - } else { - if (device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) { - continue; - } - } - SDL_memcpy(DeviceName, device.DeviceName, sizeof(DeviceName)); -#ifdef DEBUG_MODES - printf("Device: %s\n", WIN_StringToUTF8(DeviceName)); -#endif - count = 0; - for (j = 0; ; ++j) { - if (!EnumDisplayDevices(DeviceName, j, &device, 0)) { - break; - } - if (!(device.StateFlags & DISPLAY_DEVICE_ATTACHED_TO_DESKTOP)) { - continue; - } - if (pass == 0) { - if (!(device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)) { - continue; - } - } else { - if (device.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE) { - continue; - } - } - count += WIN_AddDisplay(_this, device.DeviceName); - } - if (count == 0) { - WIN_AddDisplay(_this, DeviceName); - } - } - } if (_this->num_displays == 0) { return SDL_SetError("No displays available"); } @@ -317,67 +233,104 @@ WIN_InitModes(_THIS) int WIN_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) { - SDL_DisplayModeData *data = (SDL_DisplayModeData *) display->current_mode.driverdata; - - rect->x = (int)SDL_ceil(data->DeviceMode.dmPosition.x * data->ScaleX); - rect->y = (int)SDL_ceil(data->DeviceMode.dmPosition.y * data->ScaleY); - rect->w = (int)SDL_ceil(data->DeviceMode.dmPelsWidth * data->ScaleX); - rect->h = (int)SDL_ceil(data->DeviceMode.dmPelsHeight * data->ScaleY); - - return 0; -} - -int -WIN_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi, float * hdpi, float * vdpi) -{ - SDL_DisplayModeData *data = (SDL_DisplayModeData *) display->current_mode.driverdata; - - if (ddpi) { - *ddpi = data->DiagDPI; - } - if (hdpi) { - *hdpi = data->HorzDPI; - } - if (vdpi) { - *vdpi = data->VertDPI; - } - - return data->DiagDPI != 0.0f ? 0 : SDL_SetError("Couldn't get DPI"); -} - -int -WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) -{ - const SDL_DisplayModeData *data = (const SDL_DisplayModeData *) display->current_mode.driverdata; - const DEVMODE *pDevMode = &data->DeviceMode; - POINT pt = { - /* !!! FIXME: no scale, right? */ - (LONG) (pDevMode->dmPosition.x + (pDevMode->dmPelsWidth / 2)), - (LONG) (pDevMode->dmPosition.y + (pDevMode->dmPelsHeight / 2)) - }; - HMONITOR hmon = MonitorFromPoint(pt, MONITOR_DEFAULTTONULL); + const SDL_DisplayData *data = (const SDL_DisplayData *)display->driverdata; MONITORINFO minfo; - const RECT *work; - BOOL rc = FALSE; + BOOL rc; - SDL_assert(hmon != NULL); - - if (hmon != NULL) { - SDL_zero(minfo); - minfo.cbSize = sizeof (MONITORINFO); - rc = GetMonitorInfo(hmon, &minfo); - SDL_assert(rc); - } + SDL_zero(minfo); + minfo.cbSize = sizeof(MONITORINFO); + rc = GetMonitorInfo(data->MonitorHandle, &minfo); if (!rc) { return SDL_SetError("Couldn't find monitor data"); } - work = &minfo.rcWork; - rect->x = (int)SDL_ceil(work->left * data->ScaleX); - rect->y = (int)SDL_ceil(work->top * data->ScaleY); - rect->w = (int)SDL_ceil((work->right - work->left) * data->ScaleX); - rect->h = (int)SDL_ceil((work->bottom - work->top) * data->ScaleY); + rect->x = minfo.rcMonitor.left; + rect->y = minfo.rcMonitor.top; + rect->w = minfo.rcMonitor.right - minfo.rcMonitor.left; + rect->h = minfo.rcMonitor.bottom - minfo.rcMonitor.top; + + return 0; +} + +int +WIN_GetDisplayDPI(_THIS, SDL_VideoDisplay * display, float * ddpi_out, float * hdpi_out, float * vdpi_out) +{ + const SDL_DisplayData *displaydata = (SDL_DisplayData *)display->driverdata; + const SDL_VideoData *videodata = (SDL_VideoData *)display->device->driverdata; + float hdpi = 0, vdpi = 0, ddpi = 0; + + if (videodata->GetDpiForMonitor) { + UINT hdpi_uint, vdpi_uint; + // Windows 8.1+ codepath + if (videodata->GetDpiForMonitor(displaydata->MonitorHandle, MDT_EFFECTIVE_DPI, &hdpi_uint, &vdpi_uint) == S_OK) { + // GetDpiForMonitor docs promise to return the same hdpi/vdpi + hdpi = (float)hdpi_uint; + vdpi = (float)hdpi_uint; + ddpi = (float)hdpi_uint; + } else { + return SDL_SetError("GetDpiForMonitor failed"); + } + } else { + // Window 8.0 and below: same DPI for all monitors. + HDC hdc; + int hdpi_int, vdpi_int, hpoints, vpoints, hpix, vpix; + float hinches, vinches; + + hdc = GetDC(NULL); + if (hdc == NULL) { + return SDL_SetError("GetDC failed"); + } + hdpi_int = GetDeviceCaps(hdc, LOGPIXELSX); + vdpi_int = GetDeviceCaps(hdc, LOGPIXELSY); + ReleaseDC(NULL, hdc); + + hpoints = GetSystemMetrics(SM_CXVIRTUALSCREEN); + vpoints = GetSystemMetrics(SM_CYVIRTUALSCREEN); + + hpix = MulDiv(hpoints, hdpi_int, 96); + vpix = MulDiv(vpoints, vdpi_int, 96); + + hinches = (float)hpoints / 96.0f; + vinches = (float)vpoints / 96.0f; + + hdpi = (float)hdpi_int; + vdpi = (float)vdpi_int; + ddpi = SDL_ComputeDiagonalDPI(hpix, vpix, hinches, vinches); + } + + if (ddpi_out) { + *ddpi_out = ddpi; + } + if (hdpi_out) { + *hdpi_out = hdpi; + } + if (vdpi_out) { + *vdpi_out = vdpi; + } + + return ddpi != 0.0f ? 0 : SDL_SetError("Couldn't get DPI"); +} + +int +WIN_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect) +{ + const SDL_DisplayData *data = (const SDL_DisplayData *)display->driverdata; + MONITORINFO minfo; + BOOL rc; + + SDL_zero(minfo); + minfo.cbSize = sizeof(MONITORINFO); + rc = GetMonitorInfo(data->MonitorHandle, &minfo); + + if (!rc) { + return SDL_SetError("Couldn't find monitor data"); + } + + rect->x = minfo.rcWork.left; + rect->y = minfo.rcWork.top; + rect->w = minfo.rcWork.right - minfo.rcWork.left; + rect->h = minfo.rcWork.bottom - minfo.rcWork.top; return 0; } diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsmodes.h b/Engine/lib/sdl/src/video/windows/SDL_windowsmodes.h index 6aa293d21..a5c19b7b5 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsmodes.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsmodes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,22 +20,18 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowsmodes_h -#define _SDL_windowsmodes_h +#ifndef SDL_windowsmodes_h_ +#define SDL_windowsmodes_h_ typedef struct { TCHAR DeviceName[32]; + HMONITOR MonitorHandle; } SDL_DisplayData; typedef struct { DEVMODE DeviceMode; - float ScaleX; - float ScaleY; - float DiagDPI; - float HorzDPI; - float VertDPI; } SDL_DisplayModeData; extern int WIN_InitModes(_THIS); @@ -46,6 +42,6 @@ extern void WIN_GetDisplayModes(_THIS, SDL_VideoDisplay * display); extern int WIN_SetDisplayMode(_THIS, SDL_VideoDisplay * display, SDL_DisplayMode * mode); extern void WIN_QuitModes(_THIS); -#endif /* _SDL_windowsmodes_h */ +#endif /* SDL_windowsmodes_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsmouse.c b/Engine/lib/sdl/src/video/windows/SDL_windowsmouse.c index 72d7892d4..1ddeae24b 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsmouse.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsmouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -311,13 +311,6 @@ WIN_InitMouse(_THIS) void WIN_QuitMouse(_THIS) { - SDL_Mouse *mouse = SDL_GetMouse(); - if ( mouse->def_cursor ) { - SDL_free(mouse->def_cursor); - mouse->def_cursor = NULL; - mouse->cur_cursor = NULL; - } - if (rawInputEnableCount) { /* force RAWINPUT off here. */ rawInputEnableCount = 1; ToggleRawInput(SDL_FALSE); diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsmouse.h b/Engine/lib/sdl/src/video/windows/SDL_windowsmouse.h index 60672e6bb..775c32c36 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsmouse.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsmouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,14 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowsmouse_h -#define _SDL_windowsmouse_h +#ifndef SDL_windowsmouse_h_ +#define SDL_windowsmouse_h_ extern HCURSOR SDL_cursor; extern void WIN_InitMouse(_THIS); extern void WIN_QuitMouse(_THIS); -#endif /* _SDL_windowsmouse_h */ +#endif /* SDL_windowsmouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsopengl.c b/Engine/lib/sdl/src/video/windows/SDL_windowsopengl.c index d30d838fd..c3ba56c0e 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsopengl.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsopengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,7 @@ #include "SDL_loadso.h" #include "SDL_windowsvideo.h" #include "SDL_windowsopengles.h" +#include "SDL_hints.h" /* WGL implementation of SDL OpenGL support */ @@ -81,6 +82,11 @@ #define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098 #endif +#ifndef WGL_ARB_create_context_no_error +#define WGL_ARB_create_context_no_error +#define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3 +#endif + typedef HGLRC(APIENTRYP PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, @@ -131,6 +137,44 @@ WIN_GL_LoadLibrary(_THIS, const char *path) return SDL_SetError("Could not retrieve OpenGL functions"); } + /* XXX Too sleazy? WIN_GL_InitExtensions looks for certain OpenGL + extensions via SDL_GL_DeduceMaxSupportedESProfile. This uses + SDL_GL_ExtensionSupported which in turn calls SDL_GL_GetProcAddress. + However SDL_GL_GetProcAddress will fail if the library is not + loaded; it checks for gl_config.driver_loaded > 0. To avoid this + test failing, increment driver_loaded around the call to + WIN_GLInitExtensions. + + Successful loading of the library is normally indicated by + SDL_GL_LoadLibrary incrementing driver_loaded immediately after + this function returns 0 to it. + + Alternatives to this are: + - moving SDL_GL_DeduceMaxSupportedESProfile to both the WIN and + X11 platforms while adding a function equivalent to + SDL_GL_ExtensionSupported but which directly calls + glGetProcAddress(). Having 3 copies of the + SDL_GL_ExtensionSupported makes this alternative unattractive. + - moving SDL_GL_DeduceMaxSupportedESProfile to a new file shared + by the WIN and X11 platforms while adding a function equivalent + to SDL_GL_ExtensionSupported. This is unattractive due to the + number of project files that will need updating, plus there + will be 2 copies of the SDL_GL_ExtensionSupported code. + - Add a private equivalent of SDL_GL_ExtensionSupported to + SDL_video.c. + - Move the call to WIN_GL_InitExtensions back to WIN_CreateWindow + and add a flag to gl_data to avoid multiple calls to this + expensive function. This is probably the least objectionable + alternative if this increment/decrement trick is unacceptable. + + Note that the driver_loaded > 0 check needs to remain in + SDL_GL_ExtensionSupported and SDL_GL_GetProcAddress as they are + public API functions. + */ + ++_this->gl_config.driver_loaded; + WIN_GL_InitExtensions(_this); + --_this->gl_config.driver_loaded; + return 0; } @@ -407,16 +451,28 @@ WIN_GL_InitExtensions(_THIS) } /* Check for WGL_EXT_create_context_es2_profile */ - _this->gl_data->HAS_WGL_EXT_create_context_es2_profile = SDL_FALSE; if (HasExtension("WGL_EXT_create_context_es2_profile", extensions)) { - _this->gl_data->HAS_WGL_EXT_create_context_es2_profile = SDL_TRUE; + SDL_GL_DeduceMaxSupportedESProfile( + &_this->gl_data->es_profile_max_supported_version.major, + &_this->gl_data->es_profile_max_supported_version.minor + ); } - /* Check for GLX_ARB_context_flush_control */ + /* Check for WGL_ARB_context_flush_control */ if (HasExtension("WGL_ARB_context_flush_control", extensions)) { _this->gl_data->HAS_WGL_ARB_context_flush_control = SDL_TRUE; } + /* Check for WGL_ARB_create_context_robustness */ + if (HasExtension("WGL_ARB_create_context_robustness", extensions)) { + _this->gl_data->HAS_WGL_ARB_create_context_robustness = SDL_TRUE; + } + + /* Check for WGL_ARB_create_context_no_error */ + if (HasExtension("WGL_ARB_create_context_no_error", extensions)) { + _this->gl_data->HAS_WGL_ARB_create_context_no_error = SDL_TRUE; + } + _this->gl_data->wglMakeCurrent(hdc, NULL); _this->gl_data->wglDeleteContext(hglrc); ReleaseDC(hwnd, hdc); @@ -593,14 +649,26 @@ WIN_GL_SetupWindow(_THIS, SDL_Window * window) return retval; } +SDL_bool +WIN_GL_UseEGL(_THIS) +{ + SDL_assert(_this->gl_data != NULL); + SDL_assert(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES); + + return (SDL_GetHintBoolean(SDL_HINT_OPENGL_ES_DRIVER, SDL_FALSE) + || _this->gl_config.major_version == 1 /* No WGL extension for OpenGL ES 1.x profiles. */ + || _this->gl_config.major_version > _this->gl_data->es_profile_max_supported_version.major + || (_this->gl_config.major_version == _this->gl_data->es_profile_max_supported_version.major + && _this->gl_config.minor_version > _this->gl_data->es_profile_max_supported_version.minor)); +} + SDL_GLContext WIN_GL_CreateContext(_THIS, SDL_Window * window) { HDC hdc = ((SDL_WindowData *) window->driverdata)->hdc; HGLRC context, share_context; - if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES && - !_this->gl_data->HAS_WGL_EXT_create_context_es2_profile) { + if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES && WIN_GL_UseEGL(_this)) { #if SDL_VIDEO_OPENGL_EGL /* Switch to EGL based functions */ WIN_GL_UnloadLibrary(_this); @@ -660,13 +728,13 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window) SDL_SetError("GL 3.x is not supported"); context = temp_context; } else { - /* max 10 attributes plus terminator */ - int attribs[11] = { - WGL_CONTEXT_MAJOR_VERSION_ARB, _this->gl_config.major_version, - WGL_CONTEXT_MINOR_VERSION_ARB, _this->gl_config.minor_version, - 0 - }; - int iattr = 4; + int attribs[15]; /* max 14 attributes plus terminator */ + int iattr = 0; + + attribs[iattr++] = WGL_CONTEXT_MAJOR_VERSION_ARB; + attribs[iattr++] = _this->gl_config.major_version; + attribs[iattr++] = WGL_CONTEXT_MINOR_VERSION_ARB; + attribs[iattr++] = _this->gl_config.minor_version; /* SDL profile bits match WGL profile bits */ if (_this->gl_config.profile_mask != 0) { @@ -688,6 +756,20 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window) WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB; } + /* only set if wgl extension is available */ + if (_this->gl_data->HAS_WGL_ARB_create_context_robustness) { + attribs[iattr++] = WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB; + attribs[iattr++] = _this->gl_config.reset_notification ? + WGL_LOSE_CONTEXT_ON_RESET_ARB : + WGL_NO_RESET_NOTIFICATION_ARB; + } + + /* only set if wgl extension is available */ + if (_this->gl_data->HAS_WGL_ARB_create_context_no_error) { + attribs[iattr++] = WGL_CONTEXT_OPENGL_NO_ERROR_ARB; + attribs[iattr++] = _this->gl_config.no_error; + } + attribs[iattr++] = 0; /* Create the GL 3.x context */ @@ -766,12 +848,15 @@ WIN_GL_GetSwapInterval(_THIS) return retval; } -void +int WIN_GL_SwapWindow(_THIS, SDL_Window * window) { HDC hdc = ((SDL_WindowData *) window->driverdata)->hdc; - SwapBuffers(hdc); + if (!SwapBuffers(hdc)) { + return WIN_SetError("SwapBuffers()"); + } + return 0; } void diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsopengl.h b/Engine/lib/sdl/src/video/windows/SDL_windowsopengl.h index 7b95cc8d9..75b4898c3 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsopengl.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsopengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowsopengl_h -#define _SDL_windowsopengl_h +#ifndef SDL_windowsopengl_h_ +#define SDL_windowsopengl_h_ #if SDL_VIDEO_OPENGL_WGL @@ -29,10 +29,20 @@ struct SDL_GLDriverData { SDL_bool HAS_WGL_ARB_pixel_format; SDL_bool HAS_WGL_EXT_swap_control_tear; - SDL_bool HAS_WGL_EXT_create_context_es2_profile; SDL_bool HAS_WGL_ARB_context_flush_control; + SDL_bool HAS_WGL_ARB_create_context_robustness; + SDL_bool HAS_WGL_ARB_create_context_no_error; - void *(WINAPI * wglGetProcAddress) (const char *proc); + /* Max version of OpenGL ES context that can be created if the + implementation supports WGL_EXT_create_context_es2_profile. + major = minor = 0 when unsupported. + */ + struct { + int major; + int minor; + } es_profile_max_supported_version; + + void *(WINAPI * wglGetProcAddress) (const char *proc); HGLRC(WINAPI * wglCreateContext) (HDC hdc); BOOL(WINAPI * wglDeleteContext) (HGLRC hglrc); BOOL(WINAPI * wglMakeCurrent) (HDC hdc, HGLRC hglrc); @@ -56,13 +66,14 @@ struct SDL_GLDriverData extern int WIN_GL_LoadLibrary(_THIS, const char *path); extern void *WIN_GL_GetProcAddress(_THIS, const char *proc); extern void WIN_GL_UnloadLibrary(_THIS); +extern SDL_bool WIN_GL_UseEGL(_THIS); extern int WIN_GL_SetupWindow(_THIS, SDL_Window * window); extern SDL_GLContext WIN_GL_CreateContext(_THIS, SDL_Window * window); extern int WIN_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern int WIN_GL_SetSwapInterval(_THIS, int interval); extern int WIN_GL_GetSwapInterval(_THIS); -extern void WIN_GL_SwapWindow(_THIS, SDL_Window * window); +extern int WIN_GL_SwapWindow(_THIS, SDL_Window * window); extern void WIN_GL_DeleteContext(_THIS, SDL_GLContext context); extern void WIN_GL_InitExtensions(_THIS); extern SDL_bool WIN_GL_SetPixelFormatFrom(_THIS, SDL_Window * fromWindow, SDL_Window * toWindow); @@ -126,6 +137,6 @@ extern SDL_bool WIN_GL_SetPixelFormatFrom(_THIS, SDL_Window * fromWindow, SDL_Wi #endif /* SDL_VIDEO_OPENGL_WGL */ -#endif /* _SDL_windowsopengl_h */ +#endif /* SDL_windowsopengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsopengles.c b/Engine/lib/sdl/src/video/windows/SDL_windowsopengles.c index f66cc088a..0ff61c3d0 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsopengles.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsopengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -52,7 +52,7 @@ WIN_GLES_LoadLibrary(_THIS, const char *path) { } if (_this->egl_data == NULL) { - return SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY); + return SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0); } return 0; @@ -110,7 +110,7 @@ WIN_GLES_SetupWindow(_THIS, SDL_Window * window) if (_this->egl_data == NULL) { - if (SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY) < 0) { + if (SDL_EGL_LoadLibrary(_this, NULL, EGL_DEFAULT_DISPLAY, 0) < 0) { SDL_EGL_UnloadLibrary(_this); return -1; } @@ -126,17 +126,6 @@ WIN_GLES_SetupWindow(_THIS, SDL_Window * window) return WIN_GLES_MakeCurrent(_this, current_win, current_ctx); } -int -WIN_GLES_SetSwapInterval(_THIS, int interval) -{ - /* FIXME: This should call SDL_EGL_SetSwapInterval, but ANGLE has a bug that prevents this - * from working if we do (the window contents freeze and don't swap properly). So, we ignore - * the request for now. - */ - SDL_Log("WARNING: Ignoring SDL_GL_SetSwapInterval call due to ANGLE bug"); - return 0; -} - #endif /* SDL_VIDEO_DRIVER_WINDOWS && SDL_VIDEO_OPENGL_EGL */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsopengles.h b/Engine/lib/sdl/src/video/windows/SDL_windowsopengles.h index dbdf5f6a1..86844292a 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsopengles.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_winopengles_h -#define _SDL_winopengles_h +#ifndef SDL_winopengles_h_ +#define SDL_winopengles_h_ #if SDL_VIDEO_OPENGL_EGL @@ -33,19 +33,17 @@ #define WIN_GLES_GetProcAddress SDL_EGL_GetProcAddress #define WIN_GLES_UnloadLibrary SDL_EGL_UnloadLibrary #define WIN_GLES_GetSwapInterval SDL_EGL_GetSwapInterval -/* See the WIN_GLES_GetSwapInterval implementation to see why this is commented out */ -/*#define WIN_GLES_SetSwapInterval SDL_EGL_SetSwapInterval*/ -extern int WIN_GLES_SetSwapInterval(_THIS, int interval); +#define WIN_GLES_SetSwapInterval SDL_EGL_SetSwapInterval extern int WIN_GLES_LoadLibrary(_THIS, const char *path); extern SDL_GLContext WIN_GLES_CreateContext(_THIS, SDL_Window * window); -extern void WIN_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int WIN_GLES_SwapWindow(_THIS, SDL_Window * window); extern int WIN_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern void WIN_GLES_DeleteContext(_THIS, SDL_GLContext context); extern int WIN_GLES_SetupWindow(_THIS, SDL_Window * window); #endif /* SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_winopengles_h */ +#endif /* SDL_winopengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsshape.c b/Engine/lib/sdl/src/video/windows/SDL_windowsshape.c index 0a50985a2..bed4588c5 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsshape.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsshape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -45,7 +45,7 @@ Win32_CreateShaper(SDL_Window * window) { return result; } -void +static void CombineRectRegions(SDL_ShapeTree* node,void* closure) { HRGN mask_region = *((HRGN*)closure),temp_region = NULL; if(node->kind == OpaqueShape) { diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsshape.h b/Engine/lib/sdl/src/video/windows/SDL_windowsshape.h index ddd8f49ba..eb1a887e9 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsshape.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsshape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -21,8 +21,8 @@ #include "../../SDL_internal.h" -#ifndef _SDL_windowsshape_h -#define _SDL_windowsshape_h +#ifndef SDL_windowsshape_h_ +#define SDL_windowsshape_h_ #include "SDL_video.h" #include "SDL_shape.h" @@ -37,4 +37,4 @@ extern SDL_WindowShaper* Win32_CreateShaper(SDL_Window * window); extern int Win32_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode); extern int Win32_ResizeWindowShape(SDL_Window *window); -#endif /* _SDL_windowsshape_h */ +#endif /* SDL_windowsshape_h_ */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsvideo.c b/Engine/lib/sdl/src/video/windows/SDL_windowsvideo.c index 21f63a018..8d45b721e 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsvideo.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsvideo.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,6 +33,7 @@ #include "SDL_windowsvideo.h" #include "SDL_windowsframebuffer.h" #include "SDL_windowsshape.h" +#include "SDL_windowsvulkan.h" /* Initialization/Query functions */ static int WIN_VideoInit(_THIS); @@ -42,7 +43,8 @@ static void WIN_VideoQuit(_THIS); SDL_bool g_WindowsEnableMessageLoop = SDL_TRUE; SDL_bool g_WindowFrameUsableWhileCursorHidden = SDL_TRUE; -static void UpdateWindowsEnableMessageLoop(void *userdata, const char *name, const char *oldValue, const char *newValue) +static void SDLCALL +UpdateWindowsEnableMessageLoop(void *userdata, const char *name, const char *oldValue, const char *newValue) { if (newValue && *newValue == '0') { g_WindowsEnableMessageLoop = SDL_FALSE; @@ -51,7 +53,8 @@ static void UpdateWindowsEnableMessageLoop(void *userdata, const char *name, con } } -static void UpdateWindowFrameUsableWhileCursorHidden(void *userdata, const char *name, const char *oldValue, const char *newValue) +static void SDLCALL +UpdateWindowFrameUsableWhileCursorHidden(void *userdata, const char *name, const char *oldValue, const char *newValue) { if (newValue && *newValue == '0') { g_WindowFrameUsableWhileCursorHidden = SDL_FALSE; @@ -113,11 +116,15 @@ WIN_CreateDevice(int devindex) data->CloseTouchInputHandle = (BOOL (WINAPI *)(HTOUCHINPUT)) SDL_LoadFunction(data->userDLL, "CloseTouchInputHandle"); data->GetTouchInputInfo = (BOOL (WINAPI *)(HTOUCHINPUT, UINT, PTOUCHINPUT, int)) SDL_LoadFunction(data->userDLL, "GetTouchInputInfo"); data->RegisterTouchWindow = (BOOL (WINAPI *)(HWND, ULONG)) SDL_LoadFunction(data->userDLL, "RegisterTouchWindow"); + } else { + SDL_ClearError(); } data->shcoreDLL = SDL_LoadObject("SHCORE.DLL"); if (data->shcoreDLL) { data->GetDpiForMonitor = (HRESULT (WINAPI *)(HMONITOR, MONITOR_DPI_TYPE, UINT *, UINT *)) SDL_LoadFunction(data->shcoreDLL, "GetDpiForMonitor"); + } else { + SDL_ClearError(); } /* Set the function pointers */ @@ -130,13 +137,13 @@ WIN_CreateDevice(int devindex) device->SetDisplayMode = WIN_SetDisplayMode; device->PumpEvents = WIN_PumpEvents; -#undef CreateWindow - device->CreateWindow = WIN_CreateWindow; - device->CreateWindowFrom = WIN_CreateWindowFrom; + device->CreateSDLWindow = WIN_CreateWindow; + device->CreateSDLWindowFrom = WIN_CreateWindowFrom; device->SetWindowTitle = WIN_SetWindowTitle; device->SetWindowIcon = WIN_SetWindowIcon; device->SetWindowPosition = WIN_SetWindowPosition; device->SetWindowSize = WIN_SetWindowSize; + device->GetWindowBordersSize = WIN_GetWindowBordersSize; device->SetWindowOpacity = WIN_SetWindowOpacity; device->ShowWindow = WIN_ShowWindow; device->HideWindow = WIN_HideWindow; @@ -184,6 +191,13 @@ WIN_CreateDevice(int devindex) device->GL_SwapWindow = WIN_GLES_SwapWindow; device->GL_DeleteContext = WIN_GLES_DeleteContext; #endif +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = WIN_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = WIN_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = WIN_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = WIN_Vulkan_CreateSurface; +#endif + device->StartTextInput = WIN_StartTextInput; device->StopTextInput = WIN_StopTextInput; device->SetTextInputRect = WIN_SetTextInputRect; diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsvideo.h b/Engine/lib/sdl/src/video/windows/SDL_windowsvideo.h index 912d8763d..13037544f 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowsvideo.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsvideo.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowsvideo_h -#define _SDL_windowsvideo_h +#ifndef SDL_windowsvideo_h_ +#define SDL_windowsvideo_h_ #include "../../core/windows/SDL_windows.h" @@ -194,6 +194,6 @@ extern SDL_bool g_WindowFrameUsableWhileCursorHidden; typedef struct IDirect3D9 IDirect3D9; extern SDL_bool D3D_LoadDLL( void **pD3DDLL, IDirect3D9 **pDirect3D9Interface ); -#endif /* _SDL_windowsvideo_h */ +#endif /* SDL_windowsvideo_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsvulkan.c b/Engine/lib/sdl/src/video/windows/SDL_windowsvulkan.c new file mode 100644 index 000000000..c4b34f0db --- /dev/null +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsvulkan.c @@ -0,0 +1,176 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.c. + */ + +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WINDOWS + +#include "SDL_windowsvideo.h" +#include "SDL_windowswindow.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_windowsvulkan.h" +#include "SDL_syswm.h" + +int WIN_Vulkan_LoadLibrary(_THIS, const char *path) +{ + VkExtensionProperties *extensions = NULL; + Uint32 extensionCount = 0; + Uint32 i; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasWin32SurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + if(_this->vulkan_config.loader_handle) + return SDL_SetError("Vulkan already loaded"); + + /* Load the Vulkan loader library */ + if(!path) + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + if(!path) + path = "vulkan-1.dll"; + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if(!_this->vulkan_config.loader_handle) + return -1; + SDL_strlcpy(_this->vulkan_config.loader_path, path, + SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + if(!vkGetInstanceProcAddr) + goto fail; + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) + goto fail; + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if(!extensions) + goto fail; + for(i = 0; i < extensionCount; i++) + { + if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_WIN32_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasWin32SurfaceExtension = SDL_TRUE; + } + SDL_free(extensions); + if(!hasSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + else if(!hasWin32SurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_WIN32_SURFACE_EXTENSION_NAME "extension"); + goto fail; + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void WIN_Vulkan_UnloadLibrary(_THIS) +{ + if(_this->vulkan_config.loader_handle) + { + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool WIN_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + static const char *const extensionsForWin32[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_WIN32_SURFACE_EXTENSION_NAME + }; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForWin32), + extensionsForWin32); +} + +SDL_bool WIN_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + SDL_WindowData *windowData = (SDL_WindowData *)window->driverdata; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = + (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + PFN_vkCreateWin32SurfaceKHR vkCreateWin32SurfaceKHR = + (PFN_vkCreateWin32SurfaceKHR)vkGetInstanceProcAddr( + (VkInstance)instance, + "vkCreateWin32SurfaceKHR"); + VkWin32SurfaceCreateInfoKHR createInfo; + VkResult result; + + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + + if(!vkCreateWin32SurfaceKHR) + { + SDL_SetError(VK_KHR_WIN32_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + createInfo.sType = VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR; + createInfo.pNext = NULL; + createInfo.flags = 0; + createInfo.hinstance = windowData->hinstance; + createInfo.hwnd = windowData->hwnd; + result = vkCreateWin32SurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateWin32SurfaceKHR failed: %s", + SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; +} + +#endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowsvulkan.h b/Engine/lib/sdl/src/video/windows/SDL_windowsvulkan.h new file mode 100644 index 000000000..0acc0a9f5 --- /dev/null +++ b/Engine/lib/sdl/src/video/windows/SDL_windowsvulkan.h @@ -0,0 +1,52 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ + +/* + * @author Mark Callow, www.edgewise-consulting.com. Based on Jacob Lifshay's + * SDL_x11vulkan.h. + */ + +#include "../../SDL_internal.h" + +#ifndef SDL_windowsvulkan_h_ +#define SDL_windowsvulkan_h_ + +#include "../SDL_vulkan_internal.h" +#include "../SDL_sysvideo.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_WINDOWS + +int WIN_Vulkan_LoadLibrary(_THIS, const char *path); +void WIN_Vulkan_UnloadLibrary(_THIS); +SDL_bool WIN_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool WIN_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +#endif + +#endif /* SDL_windowsvulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowswindow.c b/Engine/lib/sdl/src/video/windows/SDL_windowswindow.c index 5ce40e6ba..b08244389 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowswindow.c +++ b/Engine/lib/sdl/src/video/windows/SDL_windowswindow.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -51,9 +51,17 @@ static WCHAR *SDL_HelperWindowClassName = TEXT("SDLHelperWindowInputCatcher"); static WCHAR *SDL_HelperWindowName = TEXT("SDLHelperWindowInputMsgWindow"); static ATOM SDL_HelperWindowClass = 0; +/* For borderless Windows, still want the following flags: + - WS_CAPTION: this seems to enable the Windows minimize animation + - WS_SYSMENU: enables system context menu on task bar + - WS_MINIMIZEBOX: window will respond to Windows minimize commands sent to all windows, such as windows key + m, shaking title bar, etc. + This will also cause the task bar to overlap the window and other windowed behaviors, so only use this for windows that shouldn't appear to be fullscreen + */ + #define STYLE_BASIC (WS_CLIPSIBLINGS | WS_CLIPCHILDREN) #define STYLE_FULLSCREEN (WS_POPUP) #define STYLE_BORDERLESS (WS_POPUP) +#define STYLE_BORDERLESS_WINDOWED (WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX) #define STYLE_NORMAL (WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX) #define STYLE_RESIZABLE (WS_THICKFRAME | WS_MAXIMIZEBOX) #define STYLE_MASK (STYLE_FULLSCREEN | STYLE_BORDERLESS | STYLE_NORMAL | STYLE_RESIZABLE) @@ -67,10 +75,25 @@ GetWindowStyle(SDL_Window * window) style |= STYLE_FULLSCREEN; } else { if (window->flags & SDL_WINDOW_BORDERLESS) { - style |= STYLE_BORDERLESS; + /* SDL 2.1: + This behavior more closely matches other platform where the window is borderless + but still interacts with the window manager (e.g. task bar shows above it, it can + be resized to fit within usable desktop area, etc.) so this should be the behavior + for a future SDL release. + + If you want a borderless window the size of the desktop that looks like a fullscreen + window, then you should use the SDL_WINDOW_FULLSCREEN_DESKTOP flag. + */ + if (SDL_GetHintBoolean("SDL_BORDERLESS_WINDOWED_STYLE", SDL_FALSE)) { + style |= STYLE_BORDERLESS_WINDOWED; + } else { + style |= STYLE_BORDERLESS; + } } else { style |= STYLE_NORMAL; } + + /* You can have a borderless resizable window */ if (window->flags & SDL_WINDOW_RESIZABLE) { style |= STYLE_RESIZABLE; } @@ -78,35 +101,58 @@ GetWindowStyle(SDL_Window * window) return style; } +static void +WIN_AdjustWindowRectWithStyle(SDL_Window *window, DWORD style, BOOL menu, int *x, int *y, int *width, int *height, SDL_bool use_current) +{ + RECT rect; + + rect.left = 0; + rect.top = 0; + rect.right = (use_current ? window->w : window->windowed.w); + rect.bottom = (use_current ? window->h : window->windowed.h); + + /* borderless windows will have WM_NCCALCSIZE return 0 for the non-client area. When this happens, it looks like windows will send a resize message + expanding the window client area to the previous window + chrome size, so shouldn't need to adjust the window size for the set styles. + */ + if (!(window->flags & SDL_WINDOW_BORDERLESS)) + AdjustWindowRectEx(&rect, style, menu, 0); + + *x = (use_current ? window->x : window->windowed.x) + rect.left; + *y = (use_current ? window->y : window->windowed.y) + rect.top; + *width = (rect.right - rect.left); + *height = (rect.bottom - rect.top); +} + +static void +WIN_AdjustWindowRect(SDL_Window *window, int *x, int *y, int *width, int *height, SDL_bool use_current) +{ + SDL_WindowData *data = (SDL_WindowData *)window->driverdata; + HWND hwnd = data->hwnd; + DWORD style; + BOOL menu; + + style = GetWindowLong(hwnd, GWL_STYLE); + menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); + WIN_AdjustWindowRectWithStyle(window, style, menu, x, y, width, height, use_current); +} + static void WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; HWND hwnd = data->hwnd; - RECT rect; - DWORD style; HWND top; - BOOL menu; int x, y; int w, h; /* Figure out what the window area will be */ - if (SDL_ShouldAllowTopmost() && (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) { + if (SDL_ShouldAllowTopmost() && ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS) || (window->flags & SDL_WINDOW_ALWAYS_ON_TOP))) { top = HWND_TOPMOST; } else { top = HWND_NOTOPMOST; } - style = GetWindowLong(hwnd, GWL_STYLE); - rect.left = 0; - rect.top = 0; - rect.right = window->w; - rect.bottom = window->h; - menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); - AdjustWindowRectEx(&rect, style, menu, 0); - w = (rect.right - rect.left); - h = (rect.bottom - rect.top); - x = window->x + rect.left; - y = window->y + rect.top; + + WIN_AdjustWindowRect(window, &x, &y, &w, &h, SDL_TRUE); data->expected_resize = SDL_TRUE; SetWindowPos(hwnd, top, x, y, w, h, flags); @@ -114,7 +160,7 @@ WIN_SetWindowPositionInternal(_THIS, SDL_Window * window, UINT flags) } static int -SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) +SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, HWND parent, SDL_bool created) { SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; SDL_WindowData *data; @@ -126,7 +172,9 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) } data->window = window; data->hwnd = hwnd; + data->parent = parent; data->hdc = GetDC(hwnd); + data->hinstance = (HINSTANCE) GetWindowLongPtr(hwnd, GWLP_HINSTANCE); data->created = created; data->mouse_button_flags = 0; data->videodata = videodata; @@ -164,27 +212,13 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) if (GetClientRect(hwnd, &rect)) { int w = rect.right; int h = rect.bottom; - if ((window->w && window->w != w) || (window->h && window->h != h)) { + if ((window->windowed.w && window->windowed.w != w) || (window->windowed.h && window->windowed.h != h)) { /* We tried to create a window larger than the desktop and Windows didn't allow it. Override! */ - RECT rect; - DWORD style; - BOOL menu; int x, y; int w, h; /* Figure out what the window area will be */ - style = GetWindowLong(hwnd, GWL_STYLE); - rect.left = 0; - rect.top = 0; - rect.right = window->w; - rect.bottom = window->h; - menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); - AdjustWindowRectEx(&rect, style, menu, 0); - w = (rect.right - rect.left); - h = (rect.bottom - rect.top); - x = window->x + rect.left; - y = window->y + rect.top; - + WIN_AdjustWindowRect(window, &x, &y, &w, &h, SDL_FALSE); SetWindowPos(hwnd, HWND_NOTOPMOST, x, y, w, h, SWP_NOCOPYBITS | SWP_NOZORDER | SWP_NOACTIVATE); } else { window->w = w; @@ -208,10 +242,10 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) } else { window->flags &= ~SDL_WINDOW_SHOWN; } - if (style & (WS_BORDER | WS_THICKFRAME)) { - window->flags &= ~SDL_WINDOW_BORDERLESS; - } else { + if (style & WS_POPUP) { window->flags |= SDL_WINDOW_BORDERLESS; + } else { + window->flags &= ~SDL_WINDOW_BORDERLESS; } if (style & WS_THICKFRAME) { window->flags |= SDL_WINDOW_RESIZABLE; @@ -262,30 +296,27 @@ SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) return 0; } + + int WIN_CreateWindow(_THIS, SDL_Window * window) { - HWND hwnd; - RECT rect; + HWND hwnd, parent = NULL; DWORD style = STYLE_BASIC; int x, y; int w, h; + if (window->flags & SDL_WINDOW_SKIP_TASKBAR) { + parent = CreateWindow(SDL_Appname, TEXT(""), STYLE_BASIC, 0, 0, 32, 32, NULL, NULL, SDL_Instance, NULL); + } + style |= GetWindowStyle(window); /* Figure out what the window area will be */ - rect.left = window->x; - rect.top = window->y; - rect.right = window->x + window->w; - rect.bottom = window->y + window->h; - AdjustWindowRectEx(&rect, style, FALSE, 0); - x = rect.left; - y = rect.top; - w = (rect.right - rect.left); - h = (rect.bottom - rect.top); + WIN_AdjustWindowRectWithStyle(window, style, FALSE, &x, &y, &w, &h, SDL_FALSE); hwnd = - CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, NULL, NULL, + CreateWindow(SDL_Appname, TEXT(""), style, x, y, w, h, parent, NULL, SDL_Instance, NULL); if (!hwnd) { return WIN_SetError("Couldn't create window"); @@ -293,43 +324,47 @@ WIN_CreateWindow(_THIS, SDL_Window * window) WIN_PumpEvents(_this); - if (SetupWindowData(_this, window, hwnd, SDL_TRUE) < 0) { + if (SetupWindowData(_this, window, hwnd, parent, SDL_TRUE) < 0) { DestroyWindow(hwnd); + if (parent) { + DestroyWindow(parent); + } return -1; } -#if SDL_VIDEO_OPENGL_WGL - /* We need to initialize the extensions before deciding how to create ES profiles */ - if (window->flags & SDL_WINDOW_OPENGL) { - WIN_GL_InitExtensions(_this); - } -#endif + /* Inform Windows of the frame change so we can respond to WM_NCCALCSIZE */ + SetWindowPos(hwnd, NULL, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOSIZE | SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); + if (!(window->flags & SDL_WINDOW_OPENGL)) { + return 0; + } + + /* The rest of this macro mess is for OpenGL or OpenGL ES windows */ #if SDL_VIDEO_OPENGL_ES2 - if ((window->flags & SDL_WINDOW_OPENGL) && - _this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES -#if SDL_VIDEO_OPENGL_WGL - && (!_this->gl_data || !_this->gl_data->HAS_WGL_EXT_create_context_es2_profile) -#endif - ) { -#if SDL_VIDEO_OPENGL_EGL + if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES +#if SDL_VIDEO_OPENGL_WGL + && (!_this->gl_data || WIN_GL_UseEGL(_this)) +#endif /* SDL_VIDEO_OPENGL_WGL */ + ) { +#if SDL_VIDEO_OPENGL_EGL if (WIN_GLES_SetupWindow(_this, window) < 0) { WIN_DestroyWindow(_this, window); return -1; } + return 0; #else - return SDL_SetError("Could not create GLES window surface (no EGL support available)"); -#endif /* SDL_VIDEO_OPENGL_EGL */ - } else + return SDL_SetError("Could not create GLES window surface (EGL support not configured)"); +#endif /* SDL_VIDEO_OPENGL_EGL */ + } #endif /* SDL_VIDEO_OPENGL_ES2 */ #if SDL_VIDEO_OPENGL_WGL - if (window->flags & SDL_WINDOW_OPENGL) { - if (WIN_GL_SetupWindow(_this, window) < 0) { - WIN_DestroyWindow(_this, window); - return -1; - } + if (WIN_GL_SetupWindow(_this, window) < 0) { + WIN_DestroyWindow(_this, window); + return -1; } +#else + return SDL_SetError("Could not create GL window (WGL support not configured)"); #endif return 0; @@ -357,7 +392,7 @@ WIN_CreateWindowFrom(_THIS, SDL_Window * window, const void *data) SDL_stack_free(title); } - if (SetupWindowData(_this, window, hwnd, SDL_FALSE) < 0) { + if (SetupWindowData(_this, window, hwnd, GetParent(hwnd), SDL_FALSE) < 0) { return -1; } @@ -404,11 +439,12 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; HICON hicon = NULL; BYTE *icon_bmp; - int icon_len, y; + int icon_len, mask_len, y; SDL_RWops *dst; - /* Create temporary bitmap buffer */ - icon_len = 40 + icon->h * icon->w * 4; + /* Create temporary buffer for ICONIMAGE structure */ + mask_len = (icon->h * (icon->w + 7)/8); + icon_len = 40 + icon->h * icon->w * sizeof(Uint32) + mask_len; icon_bmp = SDL_stack_alloc(BYTE, icon_len); dst = SDL_RWFromMem(icon_bmp, icon_len); if (!dst) { @@ -423,7 +459,7 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) SDL_WriteLE16(dst, 1); SDL_WriteLE16(dst, 32); SDL_WriteLE32(dst, BI_RGB); - SDL_WriteLE32(dst, icon->h * icon->w * 4); + SDL_WriteLE32(dst, icon->h * icon->w * sizeof(Uint32)); SDL_WriteLE32(dst, 0); SDL_WriteLE32(dst, 0); SDL_WriteLE32(dst, 0); @@ -434,9 +470,12 @@ WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon) y = icon->h; while (y--) { Uint8 *src = (Uint8 *) icon->pixels + y * icon->pitch; - SDL_RWwrite(dst, src, icon->pitch, 1); + SDL_RWwrite(dst, src, icon->w * sizeof(Uint32), 1); } + /* Write the mask */ + SDL_memset(icon_bmp + icon_len - mask_len, 0xFF, mask_len); + hicon = CreateIconFromResource(icon_bmp, icon_len, TRUE, 0x00030000); SDL_RWclose(dst); @@ -461,6 +500,49 @@ WIN_SetWindowSize(_THIS, SDL_Window * window) WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOMOVE | SWP_NOACTIVATE); } +int +WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right) +{ + HWND hwnd = ((SDL_WindowData *) window->driverdata)->hwnd; + RECT rcClient, rcWindow; + POINT ptDiff; + + /* rcClient stores the size of the inner window, while rcWindow stores the outer size relative to the top-left + * screen position; so the top/left values of rcClient are always {0,0} and bottom/right are {height,width} */ + GetClientRect(hwnd, &rcClient); + GetWindowRect(hwnd, &rcWindow); + + /* convert the top/left values to make them relative to + * the window; they will end up being slightly negative */ + ptDiff.y = rcWindow.top; + ptDiff.x = rcWindow.left; + + ScreenToClient(hwnd, &ptDiff); + + rcWindow.top = ptDiff.y; + rcWindow.left = ptDiff.x; + + /* convert the bottom/right values to make them relative to the window, + * these will be slightly bigger than the inner width/height */ + ptDiff.y = rcWindow.bottom; + ptDiff.x = rcWindow.right; + + ScreenToClient(hwnd, &ptDiff); + + rcWindow.bottom = ptDiff.y; + rcWindow.right = ptDiff.x; + + /* Now that both the inner and outer rects use the same coordinate system we can substract them to get the border size. + * Keep in mind that the top/left coordinates of rcWindow are negative because the border lies slightly before {0,0}, + * so switch them around because SDL2 wants them in positive. */ + *top = rcClient.top - rcWindow.top; + *left = rcClient.left - rcWindow.left; + *bottom = rcWindow.bottom - rcClient.bottom; + *right = rcWindow.right - rcClient.right; + + return 0; +} + void WIN_ShowWindow(_THIS, SDL_Window * window) { @@ -504,15 +586,11 @@ WIN_SetWindowBordered(_THIS, SDL_Window * window, SDL_bool bordered) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; HWND hwnd = data->hwnd; - DWORD style = GetWindowLong(hwnd, GWL_STYLE); + DWORD style; - if (bordered) { - style &= ~STYLE_BORDERLESS; - style |= STYLE_NORMAL; - } else { - style &= ~STYLE_NORMAL; - style |= STYLE_BORDERLESS; - } + style = GetWindowLong(hwnd, GWL_STYLE); + style &= ~STYLE_MASK; + style |= GetWindowStyle(window); data->in_border_change = SDL_TRUE; SetWindowLong(hwnd, GWL_STYLE, style); @@ -525,13 +603,11 @@ WIN_SetWindowResizable(_THIS, SDL_Window * window, SDL_bool resizable) { SDL_WindowData *data = (SDL_WindowData *)window->driverdata; HWND hwnd = data->hwnd; - DWORD style = GetWindowLong(hwnd, GWL_STYLE); + DWORD style; - if (resizable) { - style |= STYLE_RESIZABLE; - } else { - style &= ~STYLE_RESIZABLE; - } + style = GetWindowLong(hwnd, GWL_STYLE); + style &= ~STYLE_MASK; + style |= GetWindowStyle(window); SetWindowLong(hwnd, GWL_STYLE, style); } @@ -551,15 +627,13 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; HWND hwnd = data->hwnd; - RECT rect; SDL_Rect bounds; DWORD style; HWND top; - BOOL menu; int x, y; int w, h; - if (SDL_ShouldAllowTopmost() && (window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) { + if (SDL_ShouldAllowTopmost() && ((window->flags & (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS)) == (SDL_WINDOW_FULLSCREEN|SDL_WINDOW_INPUT_FOCUS) || window->flags & SDL_WINDOW_ALWAYS_ON_TOP)) { top = HWND_TOPMOST; } else { top = HWND_NOTOPMOST; @@ -585,6 +659,8 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, style &= ~WS_MAXIMIZE; } } else { + BOOL menu; + /* Restore window-maximization state, as applicable. Special care is taken to *not* do this if and when we're alt-tab'ing away (to some other window; as indicated by @@ -595,16 +671,9 @@ WIN_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, style |= WS_MAXIMIZE; data->windowed_mode_was_maximized = SDL_FALSE; } - rect.left = 0; - rect.top = 0; - rect.right = window->windowed.w; - rect.bottom = window->windowed.h; + menu = (style & WS_CHILDWINDOW) ? FALSE : (GetMenu(hwnd) != NULL); - AdjustWindowRectEx(&rect, style, menu, 0); - w = (rect.right - rect.left); - h = (rect.bottom - rect.top); - x = window->windowed.x + rect.left; - y = window->windowed.y + rect.top; + WIN_AdjustWindowRectWithStyle(window, style, menu, &x, &y, &w, &h, SDL_FALSE); } SetWindowLong(hwnd, GWL_STYLE, style); data->expected_resize = SDL_TRUE; @@ -675,6 +744,9 @@ WIN_DestroyWindow(_THIS, SDL_Window * window) RemoveProp(data->hwnd, TEXT("SDL_WindowData")); if (data->created) { DestroyWindow(data->hwnd); + if (data->parent) { + DestroyWindow(data->parent); + } } else { /* Restore any original event handler... */ if (data->wndproc != NULL) { @@ -697,12 +769,22 @@ WIN_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) { const SDL_WindowData *data = (const SDL_WindowData *) window->driverdata; if (info->version.major <= SDL_MAJOR_VERSION) { + int versionnum = SDL_VERSIONNUM(info->version.major, info->version.minor, info->version.patch); + info->subsystem = SDL_SYSWM_WINDOWS; info->info.win.window = data->hwnd; - info->info.win.hdc = data->hdc; + + if (versionnum >= SDL_VERSIONNUM(2, 0, 4)) { + info->info.win.hdc = data->hdc; + } + + if (versionnum >= SDL_VERSIONNUM(2, 0, 5)) { + info->info.win.hinstance = data->hinstance; + } + return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } @@ -780,20 +862,27 @@ SDL_HelperWindowDestroy(void) void WIN_OnWindowEnter(_THIS, SDL_Window * window) { -#ifdef WM_MOUSELEAVE SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - TRACKMOUSEEVENT trackMouseEvent; if (!data || !data->hwnd) { /* The window wasn't fully initialized */ return; } - trackMouseEvent.cbSize = sizeof(TRACKMOUSEEVENT); - trackMouseEvent.dwFlags = TME_LEAVE; - trackMouseEvent.hwndTrack = data->hwnd; + if (window->flags & SDL_WINDOW_ALWAYS_ON_TOP) { + WIN_SetWindowPositionInternal(_this, window, SWP_NOCOPYBITS | SWP_NOSIZE | SWP_NOACTIVATE); + } - TrackMouseEvent(&trackMouseEvent); +#ifdef WM_MOUSELEAVE + { + TRACKMOUSEEVENT trackMouseEvent; + + trackMouseEvent.cbSize = sizeof(TRACKMOUSEEVENT); + trackMouseEvent.dwFlags = TME_LEAVE; + trackMouseEvent.hwndTrack = data->hwnd; + + TrackMouseEvent(&trackMouseEvent); + } #endif /* WM_MOUSELEAVE */ } diff --git a/Engine/lib/sdl/src/video/windows/SDL_windowswindow.h b/Engine/lib/sdl/src/video/windows/SDL_windowswindow.h index 7d50ba66e..0325abb8e 100644 --- a/Engine/lib/sdl/src/video/windows/SDL_windowswindow.h +++ b/Engine/lib/sdl/src/video/windows/SDL_windowswindow.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_windowswindow_h -#define _SDL_windowswindow_h +#ifndef SDL_windowswindow_h_ +#define SDL_windowswindow_h_ #if SDL_VIDEO_OPENGL_EGL #include "../SDL_egl_c.h" @@ -31,8 +31,10 @@ typedef struct { SDL_Window *window; HWND hwnd; + HWND parent; HDC hdc; HDC mdc; + HINSTANCE hinstance; HBITMAP hbm; WNDPROC wndproc; SDL_bool created; @@ -56,6 +58,7 @@ extern void WIN_SetWindowTitle(_THIS, SDL_Window * window); extern void WIN_SetWindowIcon(_THIS, SDL_Window * window, SDL_Surface * icon); extern void WIN_SetWindowPosition(_THIS, SDL_Window * window); extern void WIN_SetWindowSize(_THIS, SDL_Window * window); +extern int WIN_GetWindowBordersSize(_THIS, SDL_Window * window, int *top, int *left, int *bottom, int *right); extern int WIN_SetWindowOpacity(_THIS, SDL_Window * window, float opacity); extern void WIN_ShowWindow(_THIS, SDL_Window * window); extern void WIN_HideWindow(_THIS, SDL_Window * window); @@ -76,6 +79,6 @@ extern void WIN_OnWindowEnter(_THIS, SDL_Window * window); extern void WIN_UpdateClipCursor(SDL_Window *window); extern int WIN_SetWindowHitTest(SDL_Window *window, SDL_bool enabled); -#endif /* _SDL_windowswindow_h */ +#endif /* SDL_windowswindow_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/windows/wmmsg.h b/Engine/lib/sdl/src/video/windows/wmmsg.h index 8c1351fe9..19c1bf432 100644 --- a/Engine/lib/sdl/src/video/windows/wmmsg.h +++ b/Engine/lib/sdl/src/video/windows/wmmsg.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtevents.cpp b/Engine/lib/sdl/src/video/winrt/SDL_winrtevents.cpp index 30cf01633..370e8c514 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtevents.cpp +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtevents.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -105,7 +105,7 @@ WINRT_XAMLThreadMain(void * userdata) } void -WINRT_CycleXAMLThread() +WINRT_CycleXAMLThread(void) { switch (_threadState) { case ThreadState_NotLaunched: diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtevents_c.h b/Engine/lib/sdl/src/video/winrt/SDL_winrtevents_c.h index 05a90a3bf..8b346ec22 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtevents_c.h +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtevents_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -75,7 +75,7 @@ extern SDL_bool WINRT_IsScreenKeyboardShown(_THIS, SDL_Window *window); #endif // NTDDI_VERSION >= ... /* XAML Thread Management */ -extern void WINRT_CycleXAMLThread(); +extern void WINRT_CycleXAMLThread(void); #endif // ifdef __cplusplus_winrt diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtgamebar.cpp b/Engine/lib/sdl/src/video/winrt/SDL_winrtgamebar.cpp index 215dfcc83..961711115 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtgamebar.cpp +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtgamebar.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtgamebar_cpp.h b/Engine/lib/sdl/src/video/winrt/SDL_winrtgamebar_cpp.h index afcef37b2..a3e477798 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtgamebar_cpp.h +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtgamebar_cpp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "SDL_config.h" -#ifndef _SDL_winrtgamebar_h -#define _SDL_winrtgamebar_h +#ifndef SDL_winrtgamebar_h_ +#define SDL_winrtgamebar_h_ #ifdef __cplusplus /* These are exported as C++ functions, rather than C, to fix a compilation @@ -30,6 +30,6 @@ extern void WINRT_InitGameBar(_THIS); extern void WINRT_QuitGameBar(_THIS); #endif -#endif /* _SDL_winrtmouse_h */ +#endif /* SDL_winrtgamebar_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtkeyboard.cpp b/Engine/lib/sdl/src/video/winrt/SDL_winrtkeyboard.cpp index affcae62b..34f2421a7 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtkeyboard.cpp +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtkeyboard.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,7 +28,7 @@ /* SDL-specific includes */ -#include +#include "SDL.h" #include "SDL_winrtevents_c.h" extern "C" { diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtmessagebox.cpp b/Engine/lib/sdl/src/video/winrt/SDL_winrtmessagebox.cpp index ca958107c..3576a3f1c 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtmessagebox.cpp +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtmessagebox.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtmessagebox.h b/Engine/lib/sdl/src/video/winrt/SDL_winrtmessagebox.h index 4184aa5ee..204cf4a01 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtmessagebox.h +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtmessagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtmouse.cpp b/Engine/lib/sdl/src/video/winrt/SDL_winrtmouse.cpp index 9997d6ea4..093a1b91f 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtmouse.cpp +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtmouse.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtmouse_c.h b/Engine/lib/sdl/src/video/winrt/SDL_winrtmouse_c.h index 464ba4d47..22a80fc86 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtmouse_c.h +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtmouse_c.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "SDL_config.h" -#ifndef _SDL_winrtmouse_h -#define _SDL_winrtmouse_h +#ifndef SDL_winrtmouse_h_ +#define SDL_winrtmouse_h_ #ifdef __cplusplus extern "C" { @@ -35,6 +35,6 @@ extern SDL_bool WINRT_UsingRelativeMouseMode; } #endif -#endif /* _SDL_winrtmouse_h */ +#endif /* SDL_winrtmouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtopengles.cpp b/Engine/lib/sdl/src/video/winrt/SDL_winrtopengles.cpp index cca07fa1b..7874501e9 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtopengles.cpp +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtopengles.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,6 +28,7 @@ extern "C" { #include "SDL_winrtopengles.h" #include "SDL_loadso.h" +#include "../SDL_egl_c.h" } /* Windows includes */ @@ -57,7 +58,7 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) { SDL_VideoData *video_data = (SDL_VideoData *)_this->driverdata; - if (SDL_EGL_LoadLibrary(_this, path, EGL_DEFAULT_DISPLAY) != 0) { + if (SDL_EGL_LoadLibrary(_this, path, EGL_DEFAULT_DISPLAY, 0) != 0) { return -1; } @@ -87,11 +88,11 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) Microsoft::WRL::ComPtr cpp_display = video_data->winrtEglWindow; _this->egl_data->egl_display = ((eglGetDisplay_Old_Function)_this->egl_data->eglGetDisplay)(cpp_display); if (!_this->egl_data->egl_display) { - return SDL_SetError("Could not get Windows 8.0 EGL display"); + return SDL_EGL_SetError("Could not get Windows 8.0 EGL display", "eglGetDisplay"); } if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) { - return SDL_SetError("Could not initialize Windows 8.0 EGL"); + return SDL_EGL_SetError("Could not initialize Windows 8.0 EGL", "eglInitialize"); } } else { /* Declare some ANGLE/EGL initialization property-sets, as suggested by @@ -132,7 +133,7 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) */ eglGetPlatformDisplayEXT_Function eglGetPlatformDisplayEXT = (eglGetPlatformDisplayEXT_Function)_this->egl_data->eglGetProcAddress("eglGetPlatformDisplayEXT"); if (!eglGetPlatformDisplayEXT) { - return SDL_SetError("Could not retrieve ANGLE/WinRT display function(s)"); + return SDL_EGL_SetError("Could not retrieve ANGLE/WinRT display function(s)", "eglGetProcAddress"); } #if (WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP) @@ -141,7 +142,7 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) */ _this->egl_data->egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, defaultDisplayAttributes); if (!_this->egl_data->egl_display) { - return SDL_SetError("Could not get 10_0+ EGL display"); + return SDL_EGL_SetError("Could not get EGL display for Direct3D 10_0+", "eglGetPlatformDisplayEXT"); } if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) @@ -153,7 +154,7 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) */ _this->egl_data->egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, fl9_3DisplayAttributes); if (!_this->egl_data->egl_display) { - return SDL_SetError("Could not get 9_3 EGL display"); + return SDL_EGL_SetError("Could not get EGL display for Direct3D 9_3", "eglGetPlatformDisplayEXT"); } if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) { @@ -162,11 +163,11 @@ WINRT_GLES_LoadLibrary(_THIS, const char *path) */ _this->egl_data->egl_display = eglGetPlatformDisplayEXT(EGL_PLATFORM_ANGLE_ANGLE, EGL_DEFAULT_DISPLAY, warpDisplayAttributes); if (!_this->egl_data->egl_display) { - return SDL_SetError("Could not get WARP EGL display"); + return SDL_EGL_SetError("Could not get EGL display for Direct3D WARP", "eglGetPlatformDisplayEXT"); } if (_this->egl_data->eglInitialize(_this->egl_data->egl_display, NULL, NULL) != EGL_TRUE) { - return SDL_SetError("Could not initialize WinRT 8.x+ EGL"); + return SDL_EGL_SetError("Could not initialize WinRT 8.x+ EGL", "eglInitialize"); } } } diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtopengles.h b/Engine/lib/sdl/src/video/winrt/SDL_winrtopengles.h index 1da757b6c..a222c2b6e 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtopengles.h +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtopengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "SDL_config.h" -#ifndef _SDL_winrtopengles_h -#define _SDL_winrtopengles_h +#ifndef SDL_winrtopengles_h_ +#define SDL_winrtopengles_h_ #if SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL @@ -38,7 +38,7 @@ extern int WINRT_GLES_LoadLibrary(_THIS, const char *path); extern void WINRT_GLES_UnloadLibrary(_THIS); extern SDL_GLContext WINRT_GLES_CreateContext(_THIS, SDL_Window * window); -extern void WINRT_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int WINRT_GLES_SwapWindow(_THIS, SDL_Window * window); extern int WINRT_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); @@ -65,6 +65,6 @@ typedef EGLDisplay (EGLAPIENTRY *eglGetPlatformDisplayEXT_Function)(EGLenum, voi #endif /* SDL_VIDEO_DRIVER_WINRT && SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_winrtopengles_h */ +#endif /* SDL_winrtopengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtpointerinput.cpp b/Engine/lib/sdl/src/video/winrt/SDL_winrtpointerinput.cpp index 1d648f966..bc438f275 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtpointerinput.cpp +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtpointerinput.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -295,7 +295,7 @@ void WINRT_ProcessPointerReleasedEvent(SDL_Window *window, Windows::UI::Input::P } WINRT_LeftFingerDown = 0; } - + SDL_SendTouch( WINRT_TouchID, (SDL_FingerID) pointerPoint->PointerId, @@ -335,9 +335,8 @@ WINRT_ProcessPointerWheelChangedEvent(SDL_Window *window, Windows::UI::Input::Po return; } - // FIXME: This may need to accumulate deltas up to WHEEL_DELTA - short motion = pointerPoint->Properties->MouseWheelDelta / WHEEL_DELTA; - SDL_SendMouseWheel(window, 0, 0, motion, SDL_MOUSEWHEEL_NORMAL); + float motion = (float) pointerPoint->Properties->MouseWheelDelta / WHEEL_DELTA; + SDL_SendMouseWheel(window, 0, 0, (float) motion, SDL_MOUSEWHEEL_NORMAL); } void @@ -369,7 +368,7 @@ WINRT_ProcessMouseMovedEvent(SDL_Window * window, Windows::Devices::Input::Mouse // http://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.input.mouseeventargs.mousedelta ), // does not seem to indicate (to me) that its values should be so large. It // says that its values should be a "change in screen location". I could - // be misinterpreting this, however a post on MSDN from a Microsoft engineer (see: + // be misinterpreting this, however a post on MSDN from a Microsoft engineer (see: // http://social.msdn.microsoft.com/Forums/en-US/winappswithnativecode/thread/09a9868e-95bb-4858-ba1a-cb4d2c298d62 ), // indicates that these values are in DIPs, which is the same unit used // by CoreWindow's PointerMoved events (via the Position field in its CurrentPoint diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtvideo.cpp b/Engine/lib/sdl/src/video/winrt/SDL_winrtvideo.cpp index 9a26705ad..99bfd07b3 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtvideo.cpp +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtvideo.cpp @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -140,7 +140,7 @@ WINRT_CreateDevice(int devindex) /* Set the function pointers */ device->VideoInit = WINRT_VideoInit; device->VideoQuit = WINRT_VideoQuit; - device->CreateWindow = WINRT_CreateWindow; + device->CreateSDLWindow = WINRT_CreateWindow; device->SetWindowSize = WINRT_SetWindowSize; device->SetWindowFullscreen = WINRT_SetWindowFullscreen; device->DestroyWindow = WINRT_DestroyWindow; @@ -621,7 +621,7 @@ WINRT_CreateWindow(_THIS, SDL_Window * window) _this->egl_data->egl_config, cpp_winrtEglWindow, NULL); if (data->egl_surface == NULL) { - return SDL_SetError("eglCreateWindowSurface failed"); + return SDL_EGL_SetError("unable to create EGL native-window surface", "eglCreateWindowSurface"); } } else if (data->coreWindow.Get() != nullptr) { /* Attempt to create a window surface using newer versions of @@ -634,7 +634,7 @@ WINRT_CreateWindow(_THIS, SDL_Window * window) coreWindowAsIInspectable, NULL); if (data->egl_surface == NULL) { - return SDL_SetError("eglCreateWindowSurface failed"); + return SDL_EGL_SetError("unable to create EGL native-window surface", "eglCreateWindowSurface"); } } else { return SDL_SetError("No supported means to create an EGL window surface are available"); @@ -771,7 +771,7 @@ WINRT_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) info->info.winrt.window = reinterpret_cast(data->coreWindow.Get()); return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/Engine/lib/sdl/src/video/winrt/SDL_winrtvideo_cpp.h b/Engine/lib/sdl/src/video/winrt/SDL_winrtvideo_cpp.h index 7d5ce13e0..91e967e0d 100644 --- a/Engine/lib/sdl/src/video/winrt/SDL_winrtvideo_cpp.h +++ b/Engine/lib/sdl/src/video/winrt/SDL_winrtvideo_cpp.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11clipboard.c b/Engine/lib/sdl/src/video/x11/SDL_x11clipboard.c index 34c0a71c6..fad8c9cbf 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11clipboard.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11clipboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,13 +40,23 @@ static Window GetWindow(_THIS) { - SDL_Window *window; + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - window = _this->windows; - if (window) { - return ((SDL_WindowData *) window->driverdata)->xwindow; + /* We create an unmapped window that exists just to manage the clipboard, + since X11 selection data is tied to a specific window and dies with it. + We create the window on demand, so apps that don't use the clipboard + don't have to keep an unnecessary resource around. */ + if (data->clipboard_window == None) { + Display *dpy = data->display; + Window parent = RootWindow(dpy, DefaultScreen(dpy)); + XSetWindowAttributes xattr; + data->clipboard_window = X11_XCreateWindow(dpy, parent, -10, -10, 1, 1, 0, + CopyFromParent, InputOnly, + CopyFromParent, 0, &xattr); + X11_XFlush(data->display); } - return None; + + return data->clipboard_window; } /* We use our own cut-buffer for intermediate storage instead of diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11clipboard.h b/Engine/lib/sdl/src/video/x11/SDL_x11clipboard.h index 15dae7dfd..97aff1b73 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11clipboard.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11clipboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,14 +20,14 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11clipboard_h -#define _SDL_x11clipboard_h +#ifndef SDL_x11clipboard_h_ +#define SDL_x11clipboard_h_ extern int X11_SetClipboardText(_THIS, const char *text); extern char *X11_GetClipboardText(_THIS); extern SDL_bool X11_HasClipboardText(_THIS); extern Atom X11_GetSDLCutBufferClipboardType(Display *display); -#endif /* _SDL_x11clipboard_h */ +#endif /* SDL_x11clipboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11dyn.c b/Engine/lib/sdl/src/video/x11/SDL_x11dyn.c index d07fda740..89f736acf 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11dyn.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11dyn.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11dyn.h b/Engine/lib/sdl/src/video/x11/SDL_x11dyn.h index be1ddaa1c..d3866e70c 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11dyn.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11dyn.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11dyn_h -#define _SDL_x11dyn_h +#ifndef SDL_x11dyn_h_ +#define SDL_x11dyn_h_ #include #include @@ -107,5 +107,5 @@ extern SDL_DYNX11FN_XGetICValues X11_XGetICValues; } #endif -#endif /* !defined _SDL_x11dyn_h */ +#endif /* !defined SDL_x11dyn_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11events.c b/Engine/lib/sdl/src/video/x11/SDL_x11events.c index 56d2368a0..d293a5efc 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11events.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11events.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -31,6 +31,7 @@ #include "SDL_x11video.h" #include "SDL_x11touch.h" #include "SDL_x11xinput2.h" +#include "../../core/unix/SDL_poll.h" #include "../../events/SDL_events_c.h" #include "../../events/SDL_mouse_c.h" #include "../../events/SDL_touch_c.h" @@ -38,6 +39,7 @@ #include "SDL_hints.h" #include "SDL_timer.h" #include "SDL_syswm.h" +#include "SDL_assert.h" #include @@ -201,7 +203,7 @@ X11_IsWheelEvent(Display * display,XEvent * event,int * xticks,int * yticks) On error, -1 is returned. */ -int X11_URIDecode(char *buf, int len) { +static int X11_URIDecode(char *buf, int len) { int ri, wi, di; char decode = '\0'; if (buf == NULL || len < 0) { @@ -301,10 +303,10 @@ static char* X11_URIToLocal(char* uri) { } #if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS -static void X11_HandleGenericEvent(SDL_VideoData *videodata,XEvent event) +static void X11_HandleGenericEvent(SDL_VideoData *videodata, XEvent *xev) { /* event is a union, so cookie == &event, but this is type safe. */ - XGenericEventCookie *cookie = &event.xcookie; + XGenericEventCookie *cookie = &xev->xcookie; if (X11_XGetEventData(videodata->display, cookie)) { X11_HandleXinput2Event(videodata, cookie); X11_XFreeEventData(videodata->display, cookie); @@ -348,6 +350,7 @@ X11_ReconcileKeyboardState(_THIS) Window junk_window; int x, y; unsigned int mask; + const Uint8 *keyboardState; X11_XQueryKeymap(display, keys); @@ -357,11 +360,16 @@ X11_ReconcileKeyboardState(_THIS) SDL_ToggleModState(KMOD_NUM, (mask & X11_GetNumLockModifierMask(_this)) != 0); } + keyboardState = SDL_GetKeyboardState(0); for (keycode = 0; keycode < 256; ++keycode) { - if (keys[keycode / 8] & (1 << (keycode % 8))) { - SDL_SendKeyboardKey(SDL_PRESSED, viddata->key_layout[keycode]); - } else { - SDL_SendKeyboardKey(SDL_RELEASED, viddata->key_layout[keycode]); + SDL_Scancode scancode = viddata->key_layout[keycode]; + SDL_bool x11KeyPressed = (keys[keycode / 8] & (1 << (keycode % 8))) != 0; + SDL_bool sdlKeyPressed = keyboardState[scancode] == SDL_PRESSED; + + if (x11KeyPressed && !sdlKeyPressed) { + SDL_SendKeyboardKey(SDL_PRESSED, scancode); + } else if (!x11KeyPressed && sdlKeyPressed) { + SDL_SendKeyboardKey(SDL_RELEASED, scancode); } } } @@ -531,6 +539,95 @@ X11_UpdateUserTime(SDL_WindowData *data, const unsigned long latest) } } +static void +X11_HandleClipboardEvent(_THIS, const XEvent *xevent) +{ + SDL_VideoData *videodata = (SDL_VideoData *) _this->driverdata; + Display *display = videodata->display; + + SDL_assert(videodata->clipboard_window != None); + SDL_assert(xevent->xany.window == videodata->clipboard_window); + + switch (xevent->type) { + /* Copy the selection from our own CUTBUFFER to the requested property */ + case SelectionRequest: { + const XSelectionRequestEvent *req = &xevent->xselectionrequest; + XEvent sevent; + int seln_format; + unsigned long nbytes; + unsigned long overflow; + unsigned char *seln_data; + +#ifdef DEBUG_XEVENTS + printf("window CLIPBOARD: SelectionRequest (requestor = %ld, target = %ld)\n", + req->requestor, req->target); +#endif + + SDL_zero(sevent); + sevent.xany.type = SelectionNotify; + sevent.xselection.selection = req->selection; + sevent.xselection.target = None; + sevent.xselection.property = None; /* tell them no by default */ + sevent.xselection.requestor = req->requestor; + sevent.xselection.time = req->time; + + /* !!! FIXME: We were probably storing this on the root window + because an SDL window might go away...? but we don't have to do + this now (or ever, really). */ + if (X11_XGetWindowProperty(display, DefaultRootWindow(display), + X11_GetSDLCutBufferClipboardType(display), 0, INT_MAX/4, False, req->target, + &sevent.xselection.target, &seln_format, &nbytes, + &overflow, &seln_data) == Success) { + /* !!! FIXME: cache atoms */ + Atom XA_TARGETS = X11_XInternAtom(display, "TARGETS", 0); + if (sevent.xselection.target == req->target) { + X11_XChangeProperty(display, req->requestor, req->property, + sevent.xselection.target, seln_format, PropModeReplace, + seln_data, nbytes); + sevent.xselection.property = req->property; + } else if (XA_TARGETS == req->target) { + Atom SupportedFormats[] = { XA_TARGETS, sevent.xselection.target }; + X11_XChangeProperty(display, req->requestor, req->property, + XA_ATOM, 32, PropModeReplace, + (unsigned char*)SupportedFormats, + SDL_arraysize(SupportedFormats)); + sevent.xselection.property = req->property; + sevent.xselection.target = XA_TARGETS; + } + X11_XFree(seln_data); + } + X11_XSendEvent(display, req->requestor, False, 0, &sevent); + X11_XSync(display, False); + } + break; + + case SelectionNotify: { +#ifdef DEBUG_XEVENTS + printf("window CLIPBOARD: SelectionNotify (requestor = %ld, target = %ld)\n", + xevent->xselection.requestor, xevent->xselection.target); +#endif + videodata->selection_waiting = SDL_FALSE; + } + break; + + case SelectionClear: { + /* !!! FIXME: cache atoms */ + Atom XA_CLIPBOARD = X11_XInternAtom(display, "CLIPBOARD", 0); + +#ifdef DEBUG_XEVENTS + printf("window CLIPBOARD: SelectionClear (requestor = %ld, target = %ld)\n", + xevent->xselection.requestor, xevent->xselection.target); +#endif + + if (xevent->xselectionclear.selection == XA_PRIMARY || + (XA_CLIPBOARD != None && xevent->xselectionclear.selection == XA_CLIPBOARD)) { + SDL_SendClipboardUpdate(); + } + } + break; + } +} + static void X11_DispatchEvent(_THIS) @@ -568,14 +665,21 @@ X11_DispatchEvent(_THIS) printf("Filtered event type = %d display = %d window = %d\n", xevent.type, xevent.xany.display, xevent.xany.window); #endif + /* Make sure dead key press/release events are sent */ + /* But only if we're using one of the DBus IMEs, otherwise + some XIM IMEs will generate duplicate events */ if (orig_keycode) { - /* Make sure dead key press/release events are sent */ +#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H) SDL_Scancode scancode = videodata->key_layout[orig_keycode]; + videodata->filter_code = orig_keycode; + videodata->filter_time = xevent.xkey.time; + if (orig_event_type == KeyPress) { SDL_SendKeyboardKey(SDL_PRESSED, scancode); } else { SDL_SendKeyboardKey(SDL_RELEASED, scancode); } +#endif } return; } @@ -592,7 +696,7 @@ X11_DispatchEvent(_THIS) #if SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS if(xevent.type == GenericEvent) { - X11_HandleGenericEvent(videodata,xevent); + X11_HandleGenericEvent(videodata, &xevent); return; } #endif @@ -602,6 +706,12 @@ X11_DispatchEvent(_THIS) xevent.type, xevent.xany.display, xevent.xany.window); #endif + if ((videodata->clipboard_window != None) && + (videodata->clipboard_window == xevent.xany.window)) { + X11_HandleClipboardEvent(_this, &xevent); + return; + } + data = NULL; if (videodata && videodata->windowlist) { for (i = 0; i < videodata->numwindows; ++i) { @@ -768,7 +878,7 @@ X11_DispatchEvent(_THIS) X11_XDisplayKeycodes(display, &min_keycode, &max_keycode); keysym = X11_KeyCodeToSym(_this, keycode, xevent.xkey.state >> 13); fprintf(stderr, - "The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL mailing list X11 KeyCode %d (%d), X11 KeySym 0x%lX (%s).\n", + "The key you just pressed is not recognized by SDL. To help get this fixed, please report this to the SDL forums/mailing list X11 KeyCode %d (%d), X11 KeySym 0x%lX (%s).\n", keycode, keycode - min_keycode, keysym, X11_XKeysymToString(keysym)); } @@ -792,7 +902,10 @@ X11_DispatchEvent(_THIS) } #endif if (!handled_by_ime) { - SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]); + /* Don't send the key if it looks like a duplicate of a filtered key sent by an IME */ + if (xevent.xkey.keycode != videodata->filter_code || xevent.xkey.time != videodata->filter_time) { + SDL_SendKeyboardKey(SDL_PRESSED, videodata->key_layout[keycode]); + } if(*text) { SDL_SendKeyboardText(text); } @@ -892,7 +1005,7 @@ X11_DispatchEvent(_THIS) printf("Protocol version to use : %d\n", xdnd_version); printf("More then 3 data types : %d\n", (int) use_list); #endif - + if (use_list) { /* fetch conversion targets */ SDL_x11Prop p; @@ -906,7 +1019,7 @@ X11_DispatchEvent(_THIS) } } else if (xevent.xclient.message_type == videodata->XdndPosition) { - + #ifdef DEBUG_XEVENTS Atom act= videodata->XdndActionCopy; if(xdnd_version >= 2) { @@ -914,7 +1027,7 @@ X11_DispatchEvent(_THIS) } printf("Action requested by user is : %s\n", X11_XGetAtomName(display , act)); #endif - + /* reply with status */ memset(&m, 0, sizeof(XClientMessageEvent)); @@ -1017,7 +1130,7 @@ X11_DispatchEvent(_THIS) printf("window %p: ButtonPress (X11 button = %d)\n", data, xevent.xbutton.button); #endif if (X11_IsWheelEvent(display,&xevent,&xticks, &yticks)) { - SDL_SendMouseWheel(data->window, 0, xticks, yticks, SDL_MOUSEWHEEL_NORMAL); + SDL_SendMouseWheel(data->window, 0, (float) xticks, (float) yticks, SDL_MOUSEWHEEL_NORMAL); } else { SDL_bool ignore_click = SDL_FALSE; int button = xevent.xbutton.button; @@ -1207,55 +1320,6 @@ X11_DispatchEvent(_THIS) } break; - /* Copy the selection from our own CUTBUFFER to the requested property */ - case SelectionRequest: { - XSelectionRequestEvent *req; - XEvent sevent; - int seln_format; - unsigned long nbytes; - unsigned long overflow; - unsigned char *seln_data; - - req = &xevent.xselectionrequest; -#ifdef DEBUG_XEVENTS - printf("window %p: SelectionRequest (requestor = %ld, target = %ld)\n", data, - req->requestor, req->target); -#endif - - SDL_zero(sevent); - sevent.xany.type = SelectionNotify; - sevent.xselection.selection = req->selection; - sevent.xselection.target = None; - sevent.xselection.property = None; - sevent.xselection.requestor = req->requestor; - sevent.xselection.time = req->time; - - if (X11_XGetWindowProperty(display, DefaultRootWindow(display), - X11_GetSDLCutBufferClipboardType(display), 0, INT_MAX/4, False, req->target, - &sevent.xselection.target, &seln_format, &nbytes, - &overflow, &seln_data) == Success) { - Atom XA_TARGETS = X11_XInternAtom(display, "TARGETS", 0); - if (sevent.xselection.target == req->target) { - X11_XChangeProperty(display, req->requestor, req->property, - sevent.xselection.target, seln_format, PropModeReplace, - seln_data, nbytes); - sevent.xselection.property = req->property; - } else if (XA_TARGETS == req->target) { - Atom SupportedFormats[] = { XA_TARGETS, sevent.xselection.target }; - X11_XChangeProperty(display, req->requestor, req->property, - XA_ATOM, 32, PropModeReplace, - (unsigned char*)SupportedFormats, - SDL_arraysize(SupportedFormats)); - sevent.xselection.property = req->property; - sevent.xselection.target = XA_TARGETS; - } - X11_XFree(seln_data); - } - X11_XSendEvent(display, req->requestor, False, 0, &sevent); - X11_XSync(display, False); - } - break; - case SelectionNotify: { Atom target = xevent.xselection.target; #ifdef DEBUG_XEVENTS @@ -1299,19 +1363,6 @@ X11_DispatchEvent(_THIS) X11_XSendEvent(display, data->xdnd_source, False, NoEventMask, (XEvent*)&m); X11_XSync(display, False); - - } else { - videodata->selection_waiting = SDL_FALSE; - } - } - break; - - case SelectionClear: { - Atom XA_CLIPBOARD = X11_XInternAtom(display, "CLIPBOARD", 0); - - if (xevent.xselectionclear.selection == XA_PRIMARY || - (XA_CLIPBOARD != None && xevent.xselectionclear.selection == XA_CLIPBOARD)) { - SDL_SendClipboardUpdate(); } } break; @@ -1359,17 +1410,8 @@ X11_Pending(Display * display) } /* More drastic measures are required -- see if X is ready to talk */ - { - static struct timeval zero_time; /* static == 0 */ - int x11_fd; - fd_set fdset; - - x11_fd = ConnectionNumber(display); - FD_ZERO(&fdset); - FD_SET(x11_fd, &fdset); - if (select(x11_fd + 1, &fdset, NULL, NULL, &zero_time) == 1) { - return (X11_XPending(display)); - } + if (SDL_IOReady(ConnectionNumber(display), SDL_FALSE, 0)) { + return (X11_XPending(display)); } /* Oh well, nothing is ready .. */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11events.h b/Engine/lib/sdl/src/video/x11/SDL_x11events.h index 024fca3f4..53c69a5a1 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11events.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11events.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,12 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11events_h -#define _SDL_x11events_h +#ifndef SDL_x11events_h_ +#define SDL_x11events_h_ extern void X11_PumpEvents(_THIS); extern void X11_SuspendScreenSaver(_THIS); -#endif /* _SDL_x11events_h */ +#endif /* SDL_x11events_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11framebuffer.c b/Engine/lib/sdl/src/video/x11/SDL_x11framebuffer.c index a4886169f..ad58170bc 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11framebuffer.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11framebuffer.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -97,7 +97,7 @@ X11_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * format, shm_error = False; X_handler = X11_XSetErrorHandler(shm_errhandler); X11_XShmAttach(display, shminfo); - X11_XSync(display, True); + X11_XSync(display, False); X11_XSetErrorHandler(X_handler); if ( shm_error ) shmdt(shminfo->shmaddr); diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11framebuffer.h b/Engine/lib/sdl/src/video/x11/SDL_x11framebuffer.h index 7326e7da9..61bb0c55c 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11framebuffer.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11framebuffer.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11keyboard.c b/Engine/lib/sdl/src/video/x11/SDL_x11keyboard.c index b888bff35..d667c7b22 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11keyboard.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11keyboard.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -33,6 +33,10 @@ #include "imKStoUCS.h" +#ifdef X_HAVE_UTF8_STRING +#include +#endif + /* *INDENT-OFF* */ static const struct { KeySym keysym; @@ -262,19 +266,82 @@ X11_InitKeyboard(_THIS) int best_distance; int best_index; int distance; - + BOOL xkb_repeat = 0; + X11_XAutoRepeatOn(data->display); #if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM { - int xkb_major = XkbMajorVersion; - int xkb_minor = XkbMinorVersion; - if (X11_XkbQueryExtension(data->display, NULL, NULL, NULL, &xkb_major, &xkb_minor)) { - data->xkb = X11_XkbGetMap(data->display, XkbAllClientInfoMask, XkbUseCoreKbd); - } - } -#endif + int xkb_major = XkbMajorVersion; + int xkb_minor = XkbMinorVersion; + if (X11_XkbQueryExtension(data->display, NULL, NULL, NULL, &xkb_major, &xkb_minor)) { + data->xkb = X11_XkbGetMap(data->display, XkbAllClientInfoMask, XkbUseCoreKbd); + } + + /* This will remove KeyRelease events for held keys */ + X11_XkbSetDetectableAutoRepeat(data->display, True, &xkb_repeat); + } +#endif + + /* Open a connection to the X input manager */ +#ifdef X_HAVE_UTF8_STRING + if (SDL_X11_HAVE_UTF8) { + /* Set the locale, and call XSetLocaleModifiers before XOpenIM so that + Compose keys will work correctly. */ + char *prev_locale = setlocale(LC_ALL, NULL); + char *prev_xmods = X11_XSetLocaleModifiers(NULL); + const char *new_xmods = ""; +#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H) + const char *env_xmods = SDL_getenv("XMODIFIERS"); +#endif + SDL_bool has_dbus_ime_support = SDL_FALSE; + + if (prev_locale) { + prev_locale = SDL_strdup(prev_locale); + } + + if (prev_xmods) { + prev_xmods = SDL_strdup(prev_xmods); + } + + /* IBus resends some key events that were filtered by XFilterEvents + when it is used via XIM which causes issues. Prevent this by forcing + @im=none if XMODIFIERS contains @im=ibus. IBus can still be used via + the DBus implementation, which also has support for pre-editing. */ +#ifdef HAVE_IBUS_IBUS_H + if (env_xmods && SDL_strstr(env_xmods, "@im=ibus") != NULL) { + has_dbus_ime_support = SDL_TRUE; + } +#endif +#ifdef HAVE_FCITX_FRONTEND_H + if (env_xmods && SDL_strstr(env_xmods, "@im=fcitx") != NULL) { + has_dbus_ime_support = SDL_TRUE; + } +#endif + if (has_dbus_ime_support || !xkb_repeat) { + new_xmods = "@im=none"; + } + + setlocale(LC_ALL, ""); + X11_XSetLocaleModifiers(new_xmods); + + data->im = X11_XOpenIM(data->display, NULL, data->classname, data->classname); + + /* Reset the locale + X locale modifiers back to how they were, + locale first because the X locale modifiers depend on it. */ + setlocale(LC_ALL, prev_locale); + X11_XSetLocaleModifiers(prev_xmods); + + if (prev_locale) { + SDL_free(prev_locale); + } + + if (prev_xmods) { + SDL_free(prev_xmods); + } + } +#endif /* Try to determine which scancodes are being used based on fingerprint */ best_distance = SDL_arraysize(fingerprint) + 1; best_index = -1; @@ -313,7 +380,7 @@ X11_InitKeyboard(_THIS) SDL_Keycode keymap[SDL_NUM_SCANCODES]; printf - ("Keyboard layout unknown, please send the following to the SDL mailing list (sdl@libsdl.org):\n"); + ("Keyboard layout unknown, please report the following to the SDL forums/mailing list (https://discourse.libsdl.org/):\n"); /* Determine key_layout - only works on US QWERTY layout */ SDL_GetDefaultKeymap(keymap); @@ -417,7 +484,7 @@ X11_QuitKeyboard(_THIS) #if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM if (data->xkb) { - X11_XkbFreeClientMap(data->xkb, 0, True); + X11_XkbFreeKeyboard(data->xkb, 0, True); data->xkb = NULL; } #endif diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11keyboard.h b/Engine/lib/sdl/src/video/x11/SDL_x11keyboard.h index 6ce3c9cce..c1cc69c96 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11keyboard.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11keyboard.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11keyboard_h -#define _SDL_x11keyboard_h +#ifndef SDL_x11keyboard_h_ +#define SDL_x11keyboard_h_ extern int X11_InitKeyboard(_THIS); extern void X11_UpdateKeymap(_THIS); @@ -31,6 +31,6 @@ extern void X11_StopTextInput(_THIS); extern void X11_SetTextInputRect(_THIS, SDL_Rect *rect); extern KeySym X11_KeyCodeToSym(_THIS, KeyCode, unsigned char group); -#endif /* _SDL_x11keyboard_h */ +#endif /* SDL_x11keyboard_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11messagebox.c b/Engine/lib/sdl/src/video/x11/SDL_x11messagebox.c index fc8b1b26b..fe6ab199e 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11messagebox.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11messagebox.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -27,6 +27,7 @@ #include "SDL_x11video.h" #include "SDL_x11dyn.h" #include "SDL_assert.h" +#include "SDL_x11messagebox.h" #include #include @@ -49,7 +50,7 @@ #define MIN_DIALOG_HEIGHT 100 /* Minimum dialog height */ static const char g_MessageBoxFontLatin1[] = "-*-*-medium-r-normal--0-120-*-*-p-0-iso8859-1"; -static const char g_MessageBoxFont[] = "-*-*-*-*-*-*-*-120-*-*-*-*-*-*"; +static const char g_MessageBoxFont[] = "-*-*-medium-r-normal--*-120-*-*-*-*-*-*"; static const SDL_MessageBoxColor g_default_colors[ SDL_MESSAGEBOX_COLOR_MAX ] = { { 56, 54, 53 }, /* SDL_MESSAGEBOX_COLOR_BACKGROUND, */ @@ -377,10 +378,11 @@ X11_MessageBoxCreateWindow( SDL_MessageBoxDataX11 *data ) int x, y; XSizeHints *sizehints; XSetWindowAttributes wnd_attr; - Atom _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_NAME, UTF8_STRING; + Atom _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_NAME; Display *display = data->display; SDL_WindowData *windowdata = NULL; const SDL_MessageBoxData *messageboxdata = data->messageboxdata; + char *title_locale = NULL; if ( messageboxdata->window ) { SDL_DisplayData *displaydata = @@ -413,10 +415,30 @@ X11_MessageBoxCreateWindow( SDL_MessageBoxDataX11 *data ) X11_XStoreName( display, data->window, messageboxdata->title ); _NET_WM_NAME = X11_XInternAtom(display, "_NET_WM_NAME", False); - UTF8_STRING = X11_XInternAtom(display, "UTF8_STRING", False); - X11_XChangeProperty(display, data->window, _NET_WM_NAME, UTF8_STRING, 8, - PropModeReplace, (unsigned char *) messageboxdata->title, - strlen(messageboxdata->title) + 1 ); + + title_locale = SDL_iconv_utf8_locale(messageboxdata->title); + if (title_locale) { + XTextProperty titleprop; + Status status = X11_XStringListToTextProperty(&title_locale, 1, &titleprop); + SDL_free(title_locale); + if (status) { + X11_XSetTextProperty(display, data->window, &titleprop, XA_WM_NAME); + X11_XFree(titleprop.value); + } + } + +#ifdef X_HAVE_UTF8_STRING + if (SDL_X11_HAVE_UTF8) { + XTextProperty titleprop; + Status status = X11_Xutf8TextListToTextProperty(display, (char **) &messageboxdata->title, 1, + XUTF8StringStyle, &titleprop); + if (status == Success) { + X11_XSetTextProperty(display, data->window, &titleprop, + _NET_WM_NAME); + X11_XFree(titleprop.value); + } + } +#endif /* Let the window manager know this is a dialog box */ _NET_WM_WINDOW_TYPE = X11_XInternAtom(display, "_NET_WM_WINDOW_TYPE", False); diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11messagebox.h b/Engine/lib/sdl/src/video/x11/SDL_x11messagebox.h index c77c57fb1..cab407b2d 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11messagebox.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11messagebox.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11modes.c b/Engine/lib/sdl/src/video/x11/SDL_x11modes.c index 29307b3a6..5eafe7343 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11modes.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11modes.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -134,23 +134,20 @@ X11_GetPixelFormatFromVisualInfo(Display * display, XVisualInfo * vinfo) } else { return SDL_PIXELFORMAT_INDEX4MSB; } - break; + /* break; -Wunreachable-code-break */ case 1: if (BitmapBitOrder(display) == LSBFirst) { return SDL_PIXELFORMAT_INDEX1LSB; } else { return SDL_PIXELFORMAT_INDEX1MSB; } - break; + /* break; -Wunreachable-code-break */ } } return SDL_PIXELFORMAT_UNKNOWN; } -/* Global for the error handler */ -int vm_event, vm_error = -1; - #if SDL_VIDEO_DRIVER_X11_XINERAMA static SDL_bool CheckXinerama(Display * display, int *major, int *minor) @@ -349,7 +346,7 @@ SetXRandRDisplayName(Display *dpy, Atom EDID, char *name, const size_t namelen, } -int +static int X11_InitModes_XRandR(_THIS) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; @@ -396,9 +393,16 @@ X11_InitModes_XRandR(_THIS) X11_XFree(pixmapformats); } - res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen)); - if (!res) { - continue; + res = X11_XRRGetScreenResourcesCurrent(dpy, RootWindow(dpy, screen)); + if (!res || res->noutput == 0) { + if (res) { + X11_XRRFreeScreenResources(res); + } + + res = X11_XRRGetScreenResources(dpy, RootWindow(dpy, screen)); + if (!res) { + continue; + } } for (output = 0; output < res->noutput; output++) { @@ -464,8 +468,8 @@ X11_InitModes_XRandR(_THIS) displaydata->screen = screen; displaydata->visual = vinfo.visual; displaydata->depth = vinfo.depth; - displaydata->hdpi = ((float) mode.w) * 25.4f / display_mm_width; - displaydata->vdpi = ((float) mode.h) * 25.4f / display_mm_height; + displaydata->hdpi = display_mm_width ? (((float) mode.w) * 25.4f / display_mm_width) : 0.0f; + displaydata->vdpi = display_mm_height ? (((float) mode.h) * 25.4f / display_mm_height) : 0.0f; displaydata->ddpi = SDL_ComputeDiagonalDPI(mode.w, mode.h, ((float) display_mm_width) / 25.4f,((float) display_mm_height) / 25.4f); displaydata->scanline_pad = scanline_pad; displaydata->x = display_x; @@ -502,6 +506,7 @@ X11_InitModes_XRandR(_THIS) static SDL_bool CheckVidMode(Display * display, int *major, int *minor) { + int vm_event, vm_error = -1; /* Default the extension not available */ *major = *minor = 0; @@ -521,7 +526,6 @@ CheckVidMode(Display * display, int *major, int *minor) } /* Query the extension version */ - vm_error = -1; if (!X11_XF86VidModeQueryExtension(display, &vm_event, &vm_error) || !X11_XF86VidModeQueryVersion(display, major, minor)) { #ifdef X11MODES_DEBUG @@ -569,7 +573,7 @@ CalculateXVidModeRefreshRate(const XF86VidModeModeInfo * info) info->vtotal)) : 0; } -SDL_bool +static SDL_bool SetXVidModeModeInfo(const XF86VidModeModeInfo *info, SDL_DisplayMode *mode) { mode->w = info->hdisplay; @@ -584,7 +588,7 @@ int X11_InitModes(_THIS) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; - int snum, screen, screencount; + int snum, screen, screencount = 0; #if SDL_VIDEO_DRIVER_X11_XINERAMA int xinerama_major, xinerama_minor; int use_xinerama = 0; @@ -604,7 +608,8 @@ X11_InitModes(_THIS) /* require at least XRandR v1.3 */ if (CheckXRandR(data->display, &xrandr_major, &xrandr_minor) && (xrandr_major >= 2 || (xrandr_major == 1 && xrandr_minor >= 3))) { - return X11_InitModes_XRandR(_this); + if (X11_InitModes_XRandR(_this) == 0) + return 0; } #endif /* SDL_VIDEO_DRIVER_X11_XRANDR */ @@ -741,9 +746,9 @@ X11_InitModes(_THIS) displaydata->visual = vinfo.visual; displaydata->depth = vinfo.depth; - // We use the displaydata screen index here so that this works - // for both the Xinerama case, where we get the overall DPI, - // and the regular X11 screen info case. + /* We use the displaydata screen index here so that this works + for both the Xinerama case, where we get the overall DPI, + and the regular X11 screen info case. */ displaydata->hdpi = (float)DisplayWidth(data->display, displaydata->screen) * 25.4f / DisplayWidthMM(data->display, displaydata->screen); displaydata->vdpi = (float)DisplayHeight(data->display, displaydata->screen) * 25.4f / @@ -824,8 +829,6 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display) int nmodes; XF86VidModeModeInfo ** modes; #endif - int screen_w; - int screen_h; SDL_DisplayMode mode; /* Unfortunately X11 requires the window to be created with the correct @@ -837,11 +840,14 @@ X11_GetDisplayModes(_THIS, SDL_VideoDisplay * sdl_display) mode.format = sdl_display->current_mode.format; mode.driverdata = NULL; - screen_w = DisplayWidth(display, data->screen); - screen_h = DisplayHeight(display, data->screen); - #if SDL_VIDEO_DRIVER_X11_XINERAMA if (data->use_xinerama) { + int screen_w; + int screen_h; + + screen_w = DisplayWidth(display, data->screen); + screen_h = DisplayHeight(display, data->screen); + if (data->use_vidmode && !data->xinerama_info.x_org && !data->xinerama_info.y_org && (screen_w > data->xinerama_info.width || screen_h > data->xinerama_info.height)) { SDL_DisplayModeData *modedata; diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11modes.h b/Engine/lib/sdl/src/video/x11/SDL_x11modes.h index 4f47f3b5c..7d3ff3ef9 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11modes.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11modes.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11modes_h -#define _SDL_x11modes_h +#ifndef SDL_x11modes_h_ +#define SDL_x11modes_h_ typedef struct { @@ -80,6 +80,6 @@ extern int X11_GetDisplayBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect extern int X11_GetDisplayUsableBounds(_THIS, SDL_VideoDisplay * sdl_display, SDL_Rect * rect); extern int X11_GetDisplayDPI(_THIS, SDL_VideoDisplay * sdl_display, float * ddpi, float * hdpi, float * vdpi); -#endif /* _SDL_x11modes_h */ +#endif /* SDL_x11modes_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11mouse.c b/Engine/lib/sdl/src/video/x11/SDL_x11mouse.c index e1a16c225..3b98726d0 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11mouse.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11mouse.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -308,23 +308,27 @@ X11_ShowCursor(SDL_Cursor * cursor) return 0; } +static void +WarpMouseInternal(Window xwindow, const int x, const int y) +{ + SDL_VideoData *videodata = (SDL_VideoData *) SDL_GetVideoDevice()->driverdata; + Display *display = videodata->display; + X11_XWarpPointer(display, None, xwindow, 0, 0, 0, 0, x, y); + X11_XSync(display, False); + videodata->global_mouse_changed = SDL_TRUE; +} + static void X11_WarpMouse(SDL_Window * window, int x, int y) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; - Display *display = data->videodata->display; - - X11_XWarpPointer(display, None, data->xwindow, 0, 0, 0, 0, x, y); - X11_XSync(display, False); + WarpMouseInternal(data->xwindow, x, y); } static int X11_WarpMouseGlobal(int x, int y) { - Display *display = GetDisplay(); - - X11_XWarpPointer(display, None, DefaultRootWindow(display), 0, 0, 0, 0, x, y); - X11_XSync(display, False); + WarpMouseInternal(DefaultRootWindow(GetDisplay()), x, y); return 0; } diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11mouse.h b/Engine/lib/sdl/src/video/x11/SDL_x11mouse.h index d31d6b722..104185832 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11mouse.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11mouse.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,12 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11mouse_h -#define _SDL_x11mouse_h +#ifndef SDL_x11mouse_h_ +#define SDL_x11mouse_h_ extern void X11_InitMouse(_THIS); extern void X11_QuitMouse(_THIS); -#endif /* _SDL_x11mouse_h */ +#endif /* SDL_x11mouse_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11opengl.c b/Engine/lib/sdl/src/video/x11/SDL_x11opengl.c index abc699dd4..7c3cb339d 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11opengl.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11opengl.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -24,6 +24,7 @@ #include "SDL_x11video.h" #include "SDL_assert.h" +#include "SDL_hints.h" /* GLX implementation of SDL OpenGL support */ @@ -113,6 +114,13 @@ typedef GLXContext(*PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display * dpy, #endif #endif +#ifndef GLX_ARB_create_context_no_error +#define GLX_ARB_create_context_no_error +#ifndef GLX_CONTEXT_OPENGL_NO_ERROR_ARB +#define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3 +#endif +#endif + #ifndef GLX_EXT_swap_control #define GLX_SWAP_INTERVAL_EXT 0x20F1 #define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2 @@ -143,7 +151,6 @@ typedef GLXContext(*PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display * dpy, static void X11_GL_InitExtensions(_THIS); - int X11_GL_LoadLibrary(_THIS, const char *path) { @@ -222,13 +229,17 @@ X11_GL_LoadLibrary(_THIS, const char *path) } /* Initialize extensions */ + /* See lengthy comment about the inc/dec in + ../windows/SDL_windowsopengl.c. */ + ++_this->gl_config.driver_loaded; X11_GL_InitExtensions(_this); + --_this->gl_config.driver_loaded; /* If we need a GL ES context and there's no * GLX_EXT_create_context_es2_profile extension, switch over to X11_GLES functions */ if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES && - ! _this->gl_data->HAS_GLX_EXT_create_context_es2_profile ) { + X11_GL_UseEGL(_this) ) { #if SDL_VIDEO_OPENGL_EGL X11_GL_UnloadLibrary(_this); /* Better avoid conflicts! */ @@ -320,9 +331,48 @@ X11_GL_InitExtensions(_THIS) { Display *display = ((SDL_VideoData *) _this->driverdata)->display; const int screen = DefaultScreen(display); + XVisualInfo *vinfo = NULL; + Window w = 0; + GLXContext prev_ctx = 0; + GLXDrawable prev_drawable = 0; + GLXContext context = 0; const char *(*glXQueryExtensionsStringFunc) (Display *, int); const char *extensions; + vinfo = X11_GL_GetVisual(_this, display, screen); + if (vinfo) { + GLXContext (*glXGetCurrentContextFunc) (void) = + (GLXContext(*)(void)) + X11_GL_GetProcAddress(_this, "glXGetCurrentContext"); + + GLXDrawable (*glXGetCurrentDrawableFunc) (void) = + (GLXDrawable(*)(void)) + X11_GL_GetProcAddress(_this, "glXGetCurrentDrawable"); + + if (glXGetCurrentContextFunc && glXGetCurrentDrawableFunc) { + XSetWindowAttributes xattr; + prev_ctx = glXGetCurrentContextFunc(); + prev_drawable = glXGetCurrentDrawableFunc(); + + xattr.background_pixel = 0; + xattr.border_pixel = 0; + xattr.colormap = + X11_XCreateColormap(display, RootWindow(display, screen), + vinfo->visual, AllocNone); + w = X11_XCreateWindow(display, RootWindow(display, screen), 0, 0, + 32, 32, 0, vinfo->depth, InputOutput, vinfo->visual, + (CWBackPixel | CWBorderPixel | CWColormap), &xattr); + + context = _this->gl_data->glXCreateContext(display, vinfo, + NULL, True); + if (context) { + _this->gl_data->glXMakeCurrent(display, w, context); + } + } + + X11_XFree(vinfo); + } + glXQueryExtensionsStringFunc = (const char *(*)(Display *, int)) X11_GL_GetProcAddress(_this, "glXQueryExtensionsString"); @@ -380,23 +430,58 @@ X11_GL_InitExtensions(_THIS) /* Check for GLX_EXT_create_context_es2_profile */ if (HasExtension("GLX_EXT_create_context_es2_profile", extensions)) { - _this->gl_data->HAS_GLX_EXT_create_context_es2_profile = SDL_TRUE; + /* this wants to call glGetString(), so it needs a context. */ + /* !!! FIXME: it would be nice not to make a context here though! */ + if (context) { + SDL_GL_DeduceMaxSupportedESProfile( + &_this->gl_data->es_profile_max_supported_version.major, + &_this->gl_data->es_profile_max_supported_version.minor + ); + } } /* Check for GLX_ARB_context_flush_control */ if (HasExtension("GLX_ARB_context_flush_control", extensions)) { _this->gl_data->HAS_GLX_ARB_context_flush_control = SDL_TRUE; } + + /* Check for GLX_ARB_create_context_robustness */ + if (HasExtension("GLX_ARB_create_context_robustness", extensions)) { + _this->gl_data->HAS_GLX_ARB_create_context_robustness = SDL_TRUE; + } + + /* Check for GLX_ARB_create_context_no_error */ + if (HasExtension("GLX_ARB_create_context_no_error", extensions)) { + _this->gl_data->HAS_GLX_ARB_create_context_no_error = SDL_TRUE; + } + + if (context) { + _this->gl_data->glXMakeCurrent(display, None, NULL); + _this->gl_data->glXDestroyContext(display, context); + if (prev_ctx && prev_drawable) { + _this->gl_data->glXMakeCurrent(display, prev_drawable, prev_ctx); + } + } + + if (w) { + X11_XDestroyWindow(display, w); + } + X11_PumpEvents(_this); } /* glXChooseVisual and glXChooseFBConfig have some small differences in * the attribute encoding, it can be chosen with the for_FBConfig parameter. + * Some targets fail if you use GLX_X_VISUAL_TYPE_EXT/GLX_DIRECT_COLOR_EXT, + * so it gets specified last if used and is pointed to by *_pvistypeattr. + * In case of failure, if that pointer is not NULL, set that pointer to None + * and try again. */ static int -X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int size, Bool for_FBConfig) +X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int size, Bool for_FBConfig, int **_pvistypeattr) { int i = 0; const int MAX_ATTRIBUTES = 64; + int *pvistypeattr = NULL; /* assert buffer is large enough to hold all SDL attributes. */ SDL_assert(size >= MAX_ATTRIBUTES); @@ -488,6 +573,7 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si EXT_visual_info extension, then add GLX_X_VISUAL_TYPE_EXT. */ if (X11_UseDirectColorVisuals() && _this->gl_data->HAS_GLX_EXT_visual_info) { + pvistypeattr = &attribs[i]; attribs[i++] = GLX_X_VISUAL_TYPE_EXT; attribs[i++] = GLX_DIRECT_COLOR_EXT; } @@ -496,6 +582,10 @@ X11_GL_GetAttributes(_THIS, Display * display, int screen, int * attribs, int si SDL_assert(i <= MAX_ATTRIBUTES); + if (_pvistypeattr) { + *_pvistypeattr = pvistypeattr; + } + return i; } @@ -505,29 +595,27 @@ X11_GL_GetVisual(_THIS, Display * display, int screen) /* 64 seems nice. */ int attribs[64]; XVisualInfo *vinfo; + int *pvistypeattr = NULL; if (!_this->gl_data) { /* The OpenGL library wasn't loaded, SDL_GetError() should have info */ return NULL; } - X11_GL_GetAttributes(_this, display, screen, attribs, 64, SDL_FALSE); + X11_GL_GetAttributes(_this, display, screen, attribs, 64, SDL_FALSE, &pvistypeattr); vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs); + + if (!vinfo && (pvistypeattr != NULL)) { + *pvistypeattr = None; + vinfo = _this->gl_data->glXChooseVisual(display, screen, attribs); + } + if (!vinfo) { SDL_SetError("Couldn't find matching GLX visual"); } return vinfo; } -#ifndef GLXBadContext -#define GLXBadContext 0 -#endif -#ifndef GLXBadFBConfig -#define GLXBadFBConfig 9 -#endif -#ifndef GLXBadProfileARB -#define GLXBadProfileARB 13 -#endif static int (*handler) (Display *, XErrorEvent *) = NULL; static const char *errorHandlerOperation = NULL; static int errorBase = 0; @@ -551,12 +639,25 @@ X11_GL_ErrorHandler(Display * d, XErrorEvent * e) } else { - SDL_SetError("Could not %s: %i (Base %i)\n", errorHandlerOperation, errorCode, errorBase); + SDL_SetError("Could not %s: %i (Base %i)", errorHandlerOperation, errorCode, errorBase); } return (0); } +SDL_bool +X11_GL_UseEGL(_THIS) +{ + SDL_assert(_this->gl_data != NULL); + SDL_assert(_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES); + + return (SDL_GetHintBoolean(SDL_HINT_OPENGL_ES_DRIVER, SDL_FALSE) + || _this->gl_config.major_version == 1 /* No GLX extension for OpenGL ES 1.x profiles. */ + || _this->gl_config.major_version > _this->gl_data->es_profile_max_supported_version.major + || (_this->gl_config.major_version == _this->gl_data->es_profile_max_supported_version.major + && _this->gl_config.minor_version > _this->gl_data->es_profile_max_supported_version.minor)); +} + SDL_GLContext X11_GL_CreateContext(_THIS, SDL_Window * window) { @@ -593,8 +694,8 @@ X11_GL_CreateContext(_THIS, SDL_Window * window) context = _this->gl_data->glXCreateContext(display, vinfo, share_context, True); } else { - /* max 10 attributes plus terminator */ - int attribs[11] = { + /* max 14 attributes plus terminator */ + int attribs[15] = { GLX_CONTEXT_MAJOR_VERSION_ARB, _this->gl_config.major_version, GLX_CONTEXT_MINOR_VERSION_ARB, @@ -624,6 +725,21 @@ X11_GL_CreateContext(_THIS, SDL_Window * window) GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB; } + /* only set if glx extension is available */ + if( _this->gl_data->HAS_GLX_ARB_create_context_robustness ) { + attribs[iattr++] = GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB; + attribs[iattr++] = + _this->gl_config.reset_notification ? + GLX_LOSE_CONTEXT_ON_RESET_ARB : + GLX_NO_RESET_NOTIFICATION_ARB; + } + + /* only set if glx extension is available */ + if( _this->gl_data->HAS_GLX_ARB_create_context_no_error ) { + attribs[iattr++] = GLX_CONTEXT_OPENGL_NO_ERROR_ARB; + attribs[iattr++] = _this->gl_config.no_error; + } + attribs[iattr++] = 0; /* Get a pointer to the context creation function for GL 3.0 */ @@ -635,19 +751,28 @@ X11_GL_CreateContext(_THIS, SDL_Window * window) /* Create a GL 3.x context */ GLXFBConfig *framebuffer_config = NULL; int fbcount = 0; + int *pvistypeattr = NULL; - X11_GL_GetAttributes(_this,display,screen,glxAttribs,64,SDL_TRUE); + X11_GL_GetAttributes(_this,display,screen,glxAttribs,64,SDL_TRUE,&pvistypeattr); - if (!_this->gl_data->glXChooseFBConfig - || !(framebuffer_config = - _this->gl_data->glXChooseFBConfig(display, + if (_this->gl_data->glXChooseFBConfig) { + framebuffer_config = _this->gl_data->glXChooseFBConfig(display, DefaultScreen(display), glxAttribs, - &fbcount))) { - SDL_SetError("No good framebuffers found. OpenGL 3.0 and later unavailable"); - } else { - context = _this->gl_data->glXCreateContextAttribsARB(display, - framebuffer_config[0], - share_context, True, attribs); + &fbcount); + + if (!framebuffer_config && (pvistypeattr != NULL)) { + *pvistypeattr = None; + framebuffer_config = _this->gl_data->glXChooseFBConfig(display, + DefaultScreen(display), glxAttribs, + &fbcount); + } + + if (framebuffer_config) { + context = _this->gl_data->glXCreateContextAttribsARB(display, + framebuffer_config[0], + share_context, True, attribs); + X11_XFree(framebuffer_config); + } } } } @@ -791,13 +916,14 @@ X11_GL_GetSwapInterval(_THIS) } } -void +int X11_GL_SwapWindow(_THIS, SDL_Window * window) { SDL_WindowData *data = (SDL_WindowData *) window->driverdata; Display *display = data->videodata->display; _this->gl_data->glXSwapBuffers(display, data->xwindow); + return 0; } void diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11opengl.h b/Engine/lib/sdl/src/video/x11/SDL_x11opengl.h index 86e77d7da..1a26ea099 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11opengl.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11opengl.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11opengl_h -#define _SDL_x11opengl_h +#ifndef SDL_x11opengl_h_ +#define SDL_x11opengl_h_ #if SDL_VIDEO_OPENGL_GLX #include "SDL_opengl.h" @@ -34,8 +34,18 @@ struct SDL_GLDriverData SDL_bool HAS_GLX_EXT_visual_rating; SDL_bool HAS_GLX_EXT_visual_info; SDL_bool HAS_GLX_EXT_swap_control_tear; - SDL_bool HAS_GLX_EXT_create_context_es2_profile; SDL_bool HAS_GLX_ARB_context_flush_control; + SDL_bool HAS_GLX_ARB_create_context_robustness; + SDL_bool HAS_GLX_ARB_create_context_no_error; + + /* Max version of OpenGL ES context that can be created if the + implementation supports GLX_EXT_create_context_es2_profile. + major = minor = 0 when unsupported. + */ + struct { + int major; + int minor; + } es_profile_max_supported_version; Bool (*glXQueryExtension) (Display*,int*,int*); void *(*glXGetProcAddress) (const GLubyte*); @@ -57,17 +67,18 @@ struct SDL_GLDriverData extern int X11_GL_LoadLibrary(_THIS, const char *path); extern void *X11_GL_GetProcAddress(_THIS, const char *proc); extern void X11_GL_UnloadLibrary(_THIS); +extern SDL_bool X11_GL_UseEGL(_THIS); extern XVisualInfo *X11_GL_GetVisual(_THIS, Display * display, int screen); extern SDL_GLContext X11_GL_CreateContext(_THIS, SDL_Window * window); extern int X11_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); extern int X11_GL_SetSwapInterval(_THIS, int interval); extern int X11_GL_GetSwapInterval(_THIS); -extern void X11_GL_SwapWindow(_THIS, SDL_Window * window); +extern int X11_GL_SwapWindow(_THIS, SDL_Window * window); extern void X11_GL_DeleteContext(_THIS, SDL_GLContext context); #endif /* SDL_VIDEO_OPENGL_GLX */ -#endif /* _SDL_x11opengl_h */ +#endif /* SDL_x11opengl_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11opengles.c b/Engine/lib/sdl/src/video/x11/SDL_x11opengles.c index 531172200..76b6cd788 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11opengles.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11opengles.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -52,7 +52,7 @@ X11_GLES_LoadLibrary(_THIS, const char *path) #endif } - return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display); + return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) data->display, 0); } XVisualInfo * diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11opengles.h b/Engine/lib/sdl/src/video/x11/SDL_x11opengles.h index 716e6e688..b189b7689 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11opengles.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11opengles.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11opengles_h -#define _SDL_x11opengles_h +#ifndef SDL_x11opengles_h_ +#define SDL_x11opengles_h_ #if SDL_VIDEO_OPENGL_EGL @@ -30,6 +30,9 @@ typedef struct SDL_PrivateGLESData { + /* 1401 If the struct-declaration-list contains no named members, the behavior is undefined. */ + /* warning: empty struct has size 0 in C, size 1 in C++ [-Wc++-compat] */ + int dummy; } SDL_PrivateGLESData; /* OpenGLES functions */ @@ -43,11 +46,11 @@ typedef struct SDL_PrivateGLESData extern int X11_GLES_LoadLibrary(_THIS, const char *path); extern XVisualInfo *X11_GLES_GetVisual(_THIS, Display * display, int screen); extern SDL_GLContext X11_GLES_CreateContext(_THIS, SDL_Window * window); -extern void X11_GLES_SwapWindow(_THIS, SDL_Window * window); +extern int X11_GLES_SwapWindow(_THIS, SDL_Window * window); extern int X11_GLES_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context); #endif /* SDL_VIDEO_OPENGL_EGL */ -#endif /* _SDL_x11opengles_h */ +#endif /* SDL_x11opengles_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11shape.c b/Engine/lib/sdl/src/video/x11/SDL_x11shape.c index 4f78ae899..4d68fe0ee 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11shape.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11shape.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -28,11 +28,6 @@ #include "SDL_x11window.h" #include "../SDL_shape_internals.h" -SDL_Window* -X11_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags) { - return SDL_CreateWindow(title,x,y,w,h,flags); -} - SDL_WindowShaper* X11_CreateShaper(SDL_Window* window) { SDL_WindowShaper* result = NULL; @@ -118,4 +113,3 @@ X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMo } #endif /* SDL_VIDEO_DRIVER_X11 */ - diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11shape.h b/Engine/lib/sdl/src/video/x11/SDL_x11shape.h index cd88ab70f..a8c2e2c94 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11shape.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11shape.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11shape_h -#define _SDL_x11shape_h +#ifndef SDL_x11shape_h_ +#define SDL_x11shape_h_ #include "SDL_video.h" #include "SDL_shape.h" @@ -32,9 +32,8 @@ typedef struct { Uint32 bitmapsize; } SDL_ShapeData; -extern SDL_Window* X11_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned int w,unsigned int h,Uint32 flags); extern SDL_WindowShaper* X11_CreateShaper(SDL_Window* window); extern int X11_ResizeWindowShape(SDL_Window* window); extern int X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shapeMode); -#endif /* _SDL_x11shape_h */ +#endif /* SDL_x11shape_h_ */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11sym.h b/Engine/lib/sdl/src/video/x11/SDL_x11sym.h index 7290412b7..a07a0309c 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11sym.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11sym.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -179,6 +179,8 @@ SDL_X11_SYM(Status,XkbGetState,(Display* a,unsigned int b,XkbStatePtr c),(a,b,c) SDL_X11_SYM(Status,XkbGetUpdatedMap,(Display* a,unsigned int b,XkbDescPtr c),(a,b,c),return) SDL_X11_SYM(XkbDescPtr,XkbGetMap,(Display* a,unsigned int b,unsigned int c),(a,b,c),return) SDL_X11_SYM(void,XkbFreeClientMap,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),) +SDL_X11_SYM(void,XkbFreeKeyboard,(XkbDescPtr a,unsigned int b, Bool c),(a,b,c),) +SDL_X11_SYM(BOOL,XkbSetDetectableAutoRepeat,(Display* a, BOOL b, BOOL* c),(a,b,c),return) #endif #if NeedWidePrototypes @@ -290,6 +292,7 @@ SDL_X11_SYM(void,XRRFreeScreenConfigInfo,(XRRScreenConfiguration *config),(confi SDL_X11_SYM(void,XRRSetScreenSize,(Display *dpy, Window window,int width, int height,int mmWidth, int mmHeight),(dpy,window,width,height,mmWidth,mmHeight),) SDL_X11_SYM(Status,XRRGetScreenSizeRange,(Display *dpy, Window window,int *minWidth, int *minHeight, int *maxWidth, int *maxHeight),(dpy,window,minWidth,minHeight,maxWidth,maxHeight),return) SDL_X11_SYM(XRRScreenResources *,XRRGetScreenResources,(Display *dpy, Window window),(dpy, window),return) +SDL_X11_SYM(XRRScreenResources *,XRRGetScreenResourcesCurrent,(Display *dpy, Window window),(dpy, window),return) SDL_X11_SYM(void,XRRFreeScreenResources,(XRRScreenResources *resources),(resources),) SDL_X11_SYM(XRROutputInfo *,XRRGetOutputInfo,(Display *dpy, XRRScreenResources *resources, RROutput output),(dpy,resources,output),return) SDL_X11_SYM(void,XRRFreeOutputInfo,(XRROutputInfo *outputInfo),(outputInfo),) diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11touch.c b/Engine/lib/sdl/src/video/x11/SDL_x11touch.c index c19e80a67..2d0e73b8b 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11touch.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11touch.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -42,6 +42,13 @@ X11_QuitTouch(_THIS) SDL_TouchQuit(); } +void +X11_ResetTouch(_THIS) +{ + X11_QuitTouch(_this); + X11_InitTouch(_this); +} + #endif /* SDL_VIDEO_DRIVER_X11 */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11touch.h b/Engine/lib/sdl/src/video/x11/SDL_x11touch.h index 7f8d18e1c..5a59af028 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11touch.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11touch.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,12 +20,13 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11touch_h -#define _SDL_x11touch_h +#ifndef SDL_x11touch_h_ +#define SDL_x11touch_h_ extern void X11_InitTouch(_THIS); extern void X11_QuitTouch(_THIS); +extern void X11_ResetTouch(_THIS); -#endif /* _SDL_x11touch_h */ +#endif /* SDL_x11touch_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11video.c b/Engine/lib/sdl/src/video/x11/SDL_x11video.c index 38b34de34..b8f8edff7 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11video.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11video.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,7 @@ #include "SDL_video.h" #include "SDL_mouse.h" +#include "SDL_timer.h" #include "../SDL_sysvideo.h" #include "../SDL_pixels_c.h" @@ -39,9 +40,7 @@ #include "SDL_x11opengles.h" #endif -#ifdef X_HAVE_UTF8_STRING -#include -#endif +#include "SDL_x11vulkan.h" /* Initialization/Query functions */ static int X11_VideoInit(_THIS); @@ -110,6 +109,9 @@ static void X11_DeleteDevice(SDL_VideoDevice * device) { SDL_VideoData *data = (SDL_VideoData *) device->driverdata; + if (device->vulkan_config.loader_handle) { + device->Vulkan_UnloadLibrary(device); + } if (data->display) { X11_XCloseDisplay(data->display); } @@ -190,8 +192,8 @@ X11_CreateDevice(int devindex) } */ data->display = X11_XOpenDisplay(display); -#if defined(__osf__) && defined(SDL_VIDEO_DRIVER_X11_DYNAMIC) - /* On Tru64 if linking without -lX11, it fails and you get following message. +#ifdef SDL_VIDEO_DRIVER_X11_DYNAMIC + /* On some systems if linking without -lX11, it fails and you get following message. * Xlib: connection to ":0.0" refused by server * Xlib: XDM authorization key matches an existing client! * @@ -220,6 +222,7 @@ X11_CreateDevice(int devindex) /* Set the function pointers */ device->VideoInit = X11_VideoInit; device->VideoQuit = X11_VideoQuit; + device->ResetTouch = X11_ResetTouch; device->GetDisplayModes = X11_GetDisplayModes; device->GetDisplayBounds = X11_GetDisplayBounds; device->GetDisplayUsableBounds = X11_GetDisplayUsableBounds; @@ -228,8 +231,8 @@ X11_CreateDevice(int devindex) device->SuspendScreenSaver = X11_SuspendScreenSaver; device->PumpEvents = X11_PumpEvents; - device->CreateWindow = X11_CreateWindow; - device->CreateWindowFrom = X11_CreateWindowFrom; + device->CreateSDLWindow = X11_CreateWindow; + device->CreateSDLWindowFrom = X11_CreateWindowFrom; device->SetWindowTitle = X11_SetWindowTitle; device->SetWindowIcon = X11_SetWindowIcon; device->SetWindowPosition = X11_SetWindowPosition; @@ -293,6 +296,13 @@ X11_CreateDevice(int devindex) device->free = X11_DeleteDevice; +#if SDL_VIDEO_VULKAN + device->Vulkan_LoadLibrary = X11_Vulkan_LoadLibrary; + device->Vulkan_UnloadLibrary = X11_Vulkan_UnloadLibrary; + device->Vulkan_GetInstanceExtensions = X11_Vulkan_GetInstanceExtensions; + device->Vulkan_CreateSurface = X11_Vulkan_CreateSurface; +#endif + return device; } @@ -388,65 +398,6 @@ X11_VideoInit(_THIS) /* I have no idea how random this actually is, or has to be. */ data->window_group = (XID) (((size_t) data->pid) ^ ((size_t) _this)); - /* Open a connection to the X input manager */ -#ifdef X_HAVE_UTF8_STRING - if (SDL_X11_HAVE_UTF8) { - /* Set the locale, and call XSetLocaleModifiers before XOpenIM so that - Compose keys will work correctly. */ - char *prev_locale = setlocale(LC_ALL, NULL); - char *prev_xmods = X11_XSetLocaleModifiers(NULL); - const char *new_xmods = ""; -#if defined(HAVE_IBUS_IBUS_H) || defined(HAVE_FCITX_FRONTEND_H) - const char *env_xmods = SDL_getenv("XMODIFIERS"); -#endif - SDL_bool has_dbus_ime_support = SDL_FALSE; - - if (prev_locale) { - prev_locale = SDL_strdup(prev_locale); - } - - if (prev_xmods) { - prev_xmods = SDL_strdup(prev_xmods); - } - - /* IBus resends some key events that were filtered by XFilterEvents - when it is used via XIM which causes issues. Prevent this by forcing - @im=none if XMODIFIERS contains @im=ibus. IBus can still be used via - the DBus implementation, which also has support for pre-editing. */ -#ifdef HAVE_IBUS_IBUS_H - if (env_xmods && SDL_strstr(env_xmods, "@im=ibus") != NULL) { - has_dbus_ime_support = SDL_TRUE; - } -#endif -#ifdef HAVE_FCITX_FRONTEND_H - if (env_xmods && SDL_strstr(env_xmods, "@im=fcitx") != NULL) { - has_dbus_ime_support = SDL_TRUE; - } -#endif - if (has_dbus_ime_support) { - new_xmods = "@im=none"; - } - - setlocale(LC_ALL, ""); - X11_XSetLocaleModifiers(new_xmods); - - data->im = X11_XOpenIM(data->display, NULL, data->classname, data->classname); - - /* Reset the locale + X locale modifiers back to how they were, - locale first because the X locale modifiers depend on it. */ - setlocale(LC_ALL, prev_locale); - X11_XSetLocaleModifiers(prev_xmods); - - if (prev_locale) { - SDL_free(prev_locale); - } - - if (prev_xmods) { - SDL_free(prev_xmods); - } - } -#endif - /* Look up some useful Atoms */ #define GET_ATOM(X) data->X = X11_XInternAtom(data->display, #X, False) GET_ATOM(WM_PROTOCOLS); @@ -511,6 +462,10 @@ X11_VideoQuit(_THIS) { SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; + if (data->clipboard_window) { + X11_XDestroyWindow(data->display, data->clipboard_window); + } + SDL_free(data->classname); #ifdef X_HAVE_UTF8_STRING if (data->im) { @@ -523,6 +478,8 @@ X11_VideoQuit(_THIS) X11_QuitMouse(_this); X11_QuitTouch(_this); +/* !!! FIXME: other subsystems use D-Bus, so we shouldn't quit it here; + have SDL.c do this at a higher level, or add refcounting. */ #if SDL_USE_LIBDBUS SDL_DBus_Quit(); #endif diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11video.h b/Engine/lib/sdl/src/video/x11/SDL_x11video.h index a3324ff53..c0dc08efe 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11video.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11video.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11video_h -#define _SDL_x11video_h +#ifndef SDL_x11video_h_ +#define SDL_x11video_h_ #include "SDL_keycode.h" @@ -68,6 +68,7 @@ #include "SDL_x11mouse.h" #include "SDL_x11opengl.h" #include "SDL_x11window.h" +#include "SDL_x11vulkan.h" /* Private display data */ @@ -82,6 +83,7 @@ typedef struct SDL_VideoData SDL_WindowData **windowlist; int windowlistlength; XID window_group; + Window clipboard_window; /* This is true for ICCCM2.0-compliant window managers */ SDL_bool net_wm; @@ -124,6 +126,8 @@ typedef struct SDL_VideoData SDL_Scancode key_layout[256]; SDL_bool selection_waiting; + SDL_bool broken_pointer_grab; /* true if XGrabPointer seems unreliable. */ + Uint32 last_mode_change_deadline; SDL_bool global_mouse_changed; @@ -133,10 +137,20 @@ typedef struct SDL_VideoData #if SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM XkbDescPtr xkb; #endif + + KeyCode filter_code; + Time filter_time; + +#if SDL_VIDEO_VULKAN + /* Vulkan variables only valid if _this->vulkan_config.loader_handle is not NULL */ + void *vulkan_xlib_xcb_library; + PFN_XGetXCBConnection vulkan_XGetXCBConnection; +#endif + } SDL_VideoData; extern SDL_bool X11_UseDirectColorVisuals(void); -#endif /* _SDL_x11video_h */ +#endif /* SDL_x11video_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11vulkan.c b/Engine/lib/sdl/src/video/x11/SDL_x11vulkan.c new file mode 100644 index 000000000..ec43aef9b --- /dev/null +++ b/Engine/lib/sdl/src/video/x11/SDL_x11vulkan.c @@ -0,0 +1,243 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_X11 + +#include "SDL_x11video.h" +#include "SDL_assert.h" + +#include "SDL_loadso.h" +#include "SDL_x11vulkan.h" + +#include +/*#include */ +/* +typedef uint32_t xcb_window_t; +typedef uint32_t xcb_visualid_t; +*/ + +int X11_Vulkan_LoadLibrary(_THIS, const char *path) +{ + SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata; + VkExtensionProperties *extensions = NULL; + Uint32 extensionCount = 0; + SDL_bool hasSurfaceExtension = SDL_FALSE; + SDL_bool hasXlibSurfaceExtension = SDL_FALSE; + SDL_bool hasXCBSurfaceExtension = SDL_FALSE; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + Uint32 i; + if(_this->vulkan_config.loader_handle) + return SDL_SetError("Vulkan already loaded"); + + /* Load the Vulkan loader library */ + if(!path) + path = SDL_getenv("SDL_VULKAN_LIBRARY"); + if(!path) + path = "libvulkan.so.1"; + _this->vulkan_config.loader_handle = SDL_LoadObject(path); + if(!_this->vulkan_config.loader_handle) + return -1; + SDL_strlcpy(_this->vulkan_config.loader_path, path, SDL_arraysize(_this->vulkan_config.loader_path)); + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)SDL_LoadFunction( + _this->vulkan_config.loader_handle, "vkGetInstanceProcAddr"); + if(!vkGetInstanceProcAddr) + goto fail; + _this->vulkan_config.vkGetInstanceProcAddr = (void *)vkGetInstanceProcAddr; + _this->vulkan_config.vkEnumerateInstanceExtensionProperties = + (void *)((PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr)( + VK_NULL_HANDLE, "vkEnumerateInstanceExtensionProperties"); + if(!_this->vulkan_config.vkEnumerateInstanceExtensionProperties) + goto fail; + extensions = SDL_Vulkan_CreateInstanceExtensionsList( + (PFN_vkEnumerateInstanceExtensionProperties) + _this->vulkan_config.vkEnumerateInstanceExtensionProperties, + &extensionCount); + if(!extensions) + goto fail; + for(i = 0; i < extensionCount; i++) + { + if(SDL_strcmp(VK_KHR_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_XCB_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasXCBSurfaceExtension = SDL_TRUE; + else if(SDL_strcmp(VK_KHR_XLIB_SURFACE_EXTENSION_NAME, extensions[i].extensionName) == 0) + hasXlibSurfaceExtension = SDL_TRUE; + } + SDL_free(extensions); + if(!hasSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement the " + VK_KHR_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + if(hasXlibSurfaceExtension) + { + videoData->vulkan_xlib_xcb_library = NULL; + } + else if(!hasXCBSurfaceExtension) + { + SDL_SetError("Installed Vulkan doesn't implement either the " + VK_KHR_XCB_SURFACE_EXTENSION_NAME "extension or the " + VK_KHR_XLIB_SURFACE_EXTENSION_NAME " extension"); + goto fail; + } + else + { + const char *libX11XCBLibraryName = SDL_getenv("SDL_X11_XCB_LIBRARY"); + if(!libX11XCBLibraryName) + libX11XCBLibraryName = "libX11-xcb.so"; + videoData->vulkan_xlib_xcb_library = SDL_LoadObject(libX11XCBLibraryName); + if(!videoData->vulkan_xlib_xcb_library) + goto fail; + videoData->vulkan_XGetXCBConnection = + SDL_LoadFunction(videoData->vulkan_xlib_xcb_library, "XGetXCBConnection"); + if(!videoData->vulkan_XGetXCBConnection) + { + SDL_UnloadObject(videoData->vulkan_xlib_xcb_library); + goto fail; + } + } + return 0; + +fail: + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + return -1; +} + +void X11_Vulkan_UnloadLibrary(_THIS) +{ + SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata; + if(_this->vulkan_config.loader_handle) + { + if(videoData->vulkan_xlib_xcb_library) + SDL_UnloadObject(videoData->vulkan_xlib_xcb_library); + SDL_UnloadObject(_this->vulkan_config.loader_handle); + _this->vulkan_config.loader_handle = NULL; + } +} + +SDL_bool X11_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names) +{ + SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + if(videoData->vulkan_xlib_xcb_library) + { + static const char *const extensionsForXCB[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_XCB_SURFACE_EXTENSION_NAME, + }; + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForXCB), extensionsForXCB); + } + else + { + static const char *const extensionsForXlib[] = { + VK_KHR_SURFACE_EXTENSION_NAME, VK_KHR_XLIB_SURFACE_EXTENSION_NAME, + }; + return SDL_Vulkan_GetInstanceExtensions_Helper( + count, names, SDL_arraysize(extensionsForXlib), extensionsForXlib); + } +} + +SDL_bool X11_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface) +{ + SDL_VideoData *videoData = (SDL_VideoData *)_this->driverdata; + SDL_WindowData *windowData = (SDL_WindowData *)window->driverdata; + PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr; + if(!_this->vulkan_config.loader_handle) + { + SDL_SetError("Vulkan is not loaded"); + return SDL_FALSE; + } + vkGetInstanceProcAddr = (PFN_vkGetInstanceProcAddr)_this->vulkan_config.vkGetInstanceProcAddr; + if(videoData->vulkan_xlib_xcb_library) + { + PFN_vkCreateXcbSurfaceKHR vkCreateXcbSurfaceKHR = + (PFN_vkCreateXcbSurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance, + "vkCreateXcbSurfaceKHR"); + VkXcbSurfaceCreateInfoKHR createInfo; + VkResult result; + if(!vkCreateXcbSurfaceKHR) + { + SDL_SetError(VK_KHR_XCB_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + SDL_zero(createInfo); + createInfo.sType = VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR; + createInfo.connection = videoData->vulkan_XGetXCBConnection(videoData->display); + if(!createInfo.connection) + { + SDL_SetError("XGetXCBConnection failed"); + return SDL_FALSE; + } + createInfo.window = (xcb_window_t)windowData->xwindow; + result = vkCreateXcbSurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateXcbSurfaceKHR failed: %s", SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; + } + else + { + PFN_vkCreateXlibSurfaceKHR vkCreateXlibSurfaceKHR = + (PFN_vkCreateXlibSurfaceKHR)vkGetInstanceProcAddr((VkInstance)instance, + "vkCreateXlibSurfaceKHR"); + VkXlibSurfaceCreateInfoKHR createInfo; + VkResult result; + if(!vkCreateXlibSurfaceKHR) + { + SDL_SetError(VK_KHR_XLIB_SURFACE_EXTENSION_NAME + " extension is not enabled in the Vulkan instance."); + return SDL_FALSE; + } + SDL_zero(createInfo); + createInfo.sType = VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR; + createInfo.dpy = videoData->display; + createInfo.window = (xcb_window_t)windowData->xwindow; + result = vkCreateXlibSurfaceKHR(instance, &createInfo, + NULL, surface); + if(result != VK_SUCCESS) + { + SDL_SetError("vkCreateXlibSurfaceKHR failed: %s", SDL_Vulkan_GetResultString(result)); + return SDL_FALSE; + } + return SDL_TRUE; + } +} + +#endif + +/* vim: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11vulkan.h b/Engine/lib/sdl/src/video/x11/SDL_x11vulkan.h new file mode 100644 index 000000000..152d9d79e --- /dev/null +++ b/Engine/lib/sdl/src/video/x11/SDL_x11vulkan.h @@ -0,0 +1,48 @@ +/* + Simple DirectMedia Layer + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. +*/ +#include "../../SDL_internal.h" + +#ifndef SDL_x11vulkan_h_ +#define SDL_x11vulkan_h_ + +#include "../SDL_vulkan_internal.h" + +#if SDL_VIDEO_VULKAN && SDL_VIDEO_DRIVER_X11 + +/*typedef struct xcb_connection_t xcb_connection_t;*/ +typedef xcb_connection_t *(*PFN_XGetXCBConnection)(Display *dpy); + +int X11_Vulkan_LoadLibrary(_THIS, const char *path); +void X11_Vulkan_UnloadLibrary(_THIS); +SDL_bool X11_Vulkan_GetInstanceExtensions(_THIS, + SDL_Window *window, + unsigned *count, + const char **names); +SDL_bool X11_Vulkan_CreateSurface(_THIS, + SDL_Window *window, + VkInstance instance, + VkSurfaceKHR *surface); + +#endif + +#endif /* SDL_x11vulkan_h_ */ + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11window.c b/Engine/lib/sdl/src/video/x11/SDL_x11window.c index 668bce225..be03aa6de 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11window.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11window.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -40,11 +40,10 @@ #include "SDL_timer.h" #include "SDL_syswm.h" -#include "SDL_assert.h" +#include "SDL_log.h" #define _NET_WM_STATE_REMOVE 0l #define _NET_WM_STATE_ADD 1l -#define _NET_WM_STATE_TOGGLE 2l static Bool isMapNotify(Display *dpy, XEvent *ev, XPointer win) { @@ -226,6 +225,19 @@ X11_GetNetWMState(_THIS, Window xwindow) if (fullscreen == 1) { flags |= SDL_WINDOW_FULLSCREEN; } + + /* If the window is unmapped, numItems will be zero and _NET_WM_STATE_HIDDEN + * will not be set. Do an additional check to see if the window is unmapped + * and mark it as SDL_WINDOW_HIDDEN if it is. + */ + { + XWindowAttributes attr; + SDL_memset(&attr,0,sizeof(attr)); + X11_XGetWindowAttributes(videodata->display, xwindow, &attr); + if (attr.map_state == IsUnmapped) { + flags |= SDL_WINDOW_HIDDEN; + } + } X11_XFree(propertyValue); } @@ -376,7 +388,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) Atom _NET_WM_WINDOW_TYPE; Atom wintype; const char *wintype_name = NULL; - int compositor = 1; + long compositor = 1; Atom _NET_WM_PID; Atom XdndAware, xdnd_version = 5; long fevent = 0; @@ -389,7 +401,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) #if SDL_VIDEO_OPENGL_EGL if (_this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES #if SDL_VIDEO_OPENGL_GLX - && ( !_this->gl_data || ! _this->gl_data->HAS_GLX_EXT_create_context_es2_profile ) + && ( !_this->gl_data || X11_GL_UseEGL(_this) ) #endif ) { vinfo = X11_GLES_GetVisual(_this, display, screen); @@ -567,11 +579,12 @@ X11_CreateWindow(_THIS, SDL_Window * window) wintype = X11_XInternAtom(display, wintype_name, False); X11_XChangeProperty(display, w, _NET_WM_WINDOW_TYPE, XA_ATOM, 32, PropModeReplace, (unsigned char *)&wintype, 1); - - _NET_WM_BYPASS_COMPOSITOR = X11_XInternAtom(display, "_NET_WM_BYPASS_COMPOSITOR", False); - X11_XChangeProperty(display, w, _NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32, - PropModeReplace, - (unsigned char *)&compositor, 1); + if (SDL_GetHintBoolean(SDL_HINT_VIDEO_X11_NET_WM_BYPASS_COMPOSITOR, SDL_TRUE)) { + _NET_WM_BYPASS_COMPOSITOR = X11_XInternAtom(display, "_NET_WM_BYPASS_COMPOSITOR", False); + X11_XChangeProperty(display, w, _NET_WM_BYPASS_COMPOSITOR, XA_CARDINAL, 32, + PropModeReplace, + (unsigned char *)&compositor, 1); + } { Atom protocols[3]; @@ -600,7 +613,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) if ((window->flags & SDL_WINDOW_OPENGL) && _this->gl_config.profile_mask == SDL_GL_CONTEXT_PROFILE_ES #if SDL_VIDEO_OPENGL_GLX - && ( !_this->gl_data || ! _this->gl_data->HAS_GLX_EXT_create_context_es2_profile ) + && ( !_this->gl_data || X11_GL_UseEGL(_this) ) #endif ) { #if SDL_VIDEO_OPENGL_EGL @@ -617,7 +630,7 @@ X11_CreateWindow(_THIS, SDL_Window * window) return SDL_SetError("Could not create GLES window surface"); } #else - return SDL_SetError("Could not create GLES window surface (no EGL support available)"); + return SDL_SetError("Could not create GLES window surface (EGL support not configured)"); #endif /* SDL_VIDEO_OPENGL_EGL */ } #endif @@ -1029,7 +1042,8 @@ X11_ShowWindow(_THIS, SDL_Window * window) /* Blocking wait for "MapNotify" event. * We use X11_XIfEvent because pXWindowEvent takes a mask rather than a type, * and XCheckTypedWindowEvent doesn't block */ - X11_XIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow); + if(!(window->flags & SDL_WINDOW_FOREIGN)) + X11_XIfEvent(display, &event, &isMapNotify, (XPointer)&data->xwindow); X11_XFlush(display); } @@ -1051,7 +1065,8 @@ X11_HideWindow(_THIS, SDL_Window * window) if (X11_IsWindowMapped(_this, window)) { X11_XWithdrawWindow(display, data->xwindow, displaydata->screen); /* Blocking wait for "UnmapNotify" event */ - X11_XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow); + if(!(window->flags & SDL_WINDOW_FOREIGN)) + X11_XIfEvent(display, &event, &isUnmapNotify, (XPointer)&data->xwindow); X11_XFlush(display); } } @@ -1484,14 +1499,25 @@ X11_SetWindowGrab(_THIS, SDL_Window * window, SDL_bool grabbed) if (oldstyle_fullscreen || grabbed) { /* Try to grab the mouse */ - for (;;) { - int result = - X11_XGrabPointer(display, data->xwindow, True, 0, GrabModeAsync, - GrabModeAsync, data->xwindow, None, CurrentTime); - if (result == GrabSuccess) { - break; + if (!data->videodata->broken_pointer_grab) { + const unsigned int mask = ButtonPressMask | ButtonReleaseMask | PointerMotionMask | FocusChangeMask; + int attempts; + int result; + + /* Try for up to 5000ms (5s) to grab. If it still fails, stop trying. */ + for (attempts = 0; attempts < 100; attempts++) { + result = X11_XGrabPointer(display, data->xwindow, True, mask, GrabModeAsync, + GrabModeAsync, data->xwindow, None, CurrentTime); + if (result == GrabSuccess) { + break; + } + SDL_Delay(50); + } + + if (result != GrabSuccess) { + SDL_LogWarn(SDL_LOG_CATEGORY_VIDEO, "The X server refused to let us grab the mouse. You might experience input bugs."); + data->videodata->broken_pointer_grab = SDL_TRUE; /* don't try again. */ } - SDL_Delay(50); } /* Raise the window if we grab the mouse */ @@ -1566,7 +1592,7 @@ X11_GetWindowWMInfo(_THIS, SDL_Window * window, SDL_SysWMinfo * info) info->info.x11.window = data->xwindow; return SDL_TRUE; } else { - SDL_SetError("Application not compiled with SDL %d.%d\n", + SDL_SetError("Application not compiled with SDL %d.%d", SDL_MAJOR_VERSION, SDL_MINOR_VERSION); return SDL_FALSE; } diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11window.h b/Engine/lib/sdl/src/video/x11/SDL_x11window.h index 50a739dad..7c4c6c5e5 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11window.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11window.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11window_h -#define _SDL_x11window_h +#ifndef SDL_x11window_h_ +#define SDL_x11window_h_ /* We need to queue the focus in/out changes because they may occur during video mode changes and we can respond to them by triggering more mode @@ -105,6 +105,6 @@ extern SDL_bool X11_GetWindowWMInfo(_THIS, SDL_Window * window, struct SDL_SysWMinfo *info); extern int X11_SetWindowHitTest(SDL_Window *window, SDL_bool enabled); -#endif /* _SDL_x11window_h */ +#endif /* SDL_x11window_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11xinput2.c b/Engine/lib/sdl/src/video/x11/SDL_x11xinput2.c index bed4234f0..06a8937cf 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11xinput2.c +++ b/Engine/lib/sdl/src/video/x11/SDL_x11xinput2.c @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -73,6 +73,35 @@ xinput2_version_atleast(const int version, const int wantmajor, const int wantmi { return ( version >= ((wantmajor * 1000) + wantminor) ); } + +#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH +static void +xinput2_normalize_touch_coordinates(SDL_VideoData *videodata, Window window, + double in_x, double in_y, float *out_x, float *out_y) +{ + int i; + for (i = 0; i < videodata->numwindows; i++) { + SDL_WindowData *d = videodata->windowlist[i]; + if (d->xwindow == window) { + if (d->window->w == 1) { + *out_x = 0.5f; + } else { + *out_x = in_x / (d->window->w - 1); + } + if (d->window->h == 1) { + *out_y = 0.5f; + } else { + *out_y = in_y / (d->window->h - 1); + } + return; + } + } + // couldn't find the window... + *out_x = in_x; + *out_y = in_y; +} +#endif /* SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH */ + #endif /* SDL_VIDEO_DRIVER_X11_XINPUT2 */ void @@ -171,22 +200,28 @@ X11_HandleXinput2Event(SDL_VideoData *videodata,XGenericEventCookie *cookie) #if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH case XI_TouchBegin: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; - SDL_SendTouch(xev->sourceid,xev->detail, - SDL_TRUE, xev->event_x, xev->event_y, 1.0); + float x, y; + xinput2_normalize_touch_coordinates(videodata, xev->event, + xev->event_x, xev->event_y, &x, &y); + SDL_SendTouch(xev->sourceid,xev->detail, SDL_TRUE, x, y, 1.0); return 1; } break; case XI_TouchEnd: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; - SDL_SendTouch(xev->sourceid,xev->detail, - SDL_FALSE, xev->event_x, xev->event_y, 1.0); + float x, y; + xinput2_normalize_touch_coordinates(videodata, xev->event, + xev->event_x, xev->event_y, &x, &y); + SDL_SendTouch(xev->sourceid,xev->detail, SDL_FALSE, x, y, 1.0); return 1; } break; case XI_TouchUpdate: { const XIDeviceEvent *xev = (const XIDeviceEvent *) cookie->data; - SDL_SendTouchMotion(xev->sourceid,xev->detail, - xev->event_x, xev->event_y, 1.0); + float x, y; + xinput2_normalize_touch_coordinates(videodata, xev->event, + xev->event_x, xev->event_y, &x, &y); + SDL_SendTouchMotion(xev->sourceid,xev->detail, x, y, 1.0); return 1; } break; diff --git a/Engine/lib/sdl/src/video/x11/SDL_x11xinput2.h b/Engine/lib/sdl/src/video/x11/SDL_x11xinput2.h index ed8dd1a4a..4780fbb93 100644 --- a/Engine/lib/sdl/src/video/x11/SDL_x11xinput2.h +++ b/Engine/lib/sdl/src/video/x11/SDL_x11xinput2.h @@ -1,6 +1,6 @@ /* Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,8 +20,8 @@ */ #include "../../SDL_internal.h" -#ifndef _SDL_x11xinput2_h -#define _SDL_x11xinput2_h +#ifndef SDL_x11xinput2_h_ +#define SDL_x11xinput2_h_ #ifndef SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS /* Define XGenericEventCookie as forward declaration when @@ -37,6 +37,6 @@ extern int X11_Xinput2IsInitialized(void); extern int X11_Xinput2IsMultitouchSupported(void); extern void X11_Xinput2SelectTouch(_THIS, SDL_Window *window); -#endif /* _SDL_x11xinput2_h */ +#endif /* SDL_x11xinput2_h_ */ /* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/src/video/x11/edid-parse.c b/Engine/lib/sdl/src/video/x11/edid-parse.c index 57f225b85..e22324f2c 100644 --- a/Engine/lib/sdl/src/video/x11/edid-parse.c +++ b/Engine/lib/sdl/src/video/x11/edid-parse.c @@ -140,14 +140,14 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info) }; bits = get_bits (edid[0x14], 4, 6); - info->digital.bits_per_primary = bit_depth[bits]; + info->ad.digital.bits_per_primary = bit_depth[bits]; bits = get_bits (edid[0x14], 0, 3); if (bits <= 5) - info->digital.interface = interfaces[bits]; + info->ad.digital.interface = interfaces[bits]; else - info->digital.interface = UNDEFINED; + info->ad.digital.interface = UNDEFINED; } else { @@ -161,17 +161,17 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info) { 0.7, 0.0, 0.7 }, }; - info->analog.video_signal_level = levels[bits][0]; - info->analog.sync_signal_level = levels[bits][1]; - info->analog.total_signal_level = levels[bits][2]; + info->ad.analog.video_signal_level = levels[bits][0]; + info->ad.analog.sync_signal_level = levels[bits][1]; + info->ad.analog.total_signal_level = levels[bits][2]; - info->analog.blank_to_black = get_bit (edid[0x14], 4); + info->ad.analog.blank_to_black = get_bit (edid[0x14], 4); - info->analog.separate_hv_sync = get_bit (edid[0x14], 3); - info->analog.composite_sync_on_h = get_bit (edid[0x14], 2); - info->analog.composite_sync_on_green = get_bit (edid[0x14], 1); + info->ad.analog.separate_hv_sync = get_bit (edid[0x14], 3); + info->ad.analog.composite_sync_on_h = get_bit (edid[0x14], 2); + info->ad.analog.composite_sync_on_green = get_bit (edid[0x14], 1); - info->analog.serration_on_vsync = get_bit (edid[0x14], 0); + info->ad.analog.serration_on_vsync = get_bit (edid[0x14], 0); } /* Screen Size / Aspect Ratio */ @@ -213,11 +213,11 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info) if (info->is_digital) { - info->digital.rgb444 = TRUE; + info->ad.digital.rgb444 = TRUE; if (get_bit (edid[0x18], 3)) - info->digital.ycrcb444 = 1; + info->ad.digital.ycrcb444 = 1; if (get_bit (edid[0x18], 4)) - info->digital.ycrcb422 = 1; + info->ad.digital.ycrcb422 = 1; } else { @@ -227,7 +227,7 @@ decode_display_parameters (const uchar *edid, MonitorInfo *info) MONOCHROME, RGB, OTHER_COLOR, UNDEFINED_COLOR }; - info->analog.color_type = color_type[bits]; + info->ad.analog.color_type = color_type[bits]; } info->srgb_is_standard = get_bit (edid[0x18], 2); @@ -455,26 +455,26 @@ decode_detailed_timing (const uchar *timing, detailed->digital_sync = get_bit (bits, 4); if (detailed->digital_sync) { - detailed->digital.composite = !get_bit (bits, 3); + detailed->ad.digital.composite = !get_bit (bits, 3); - if (detailed->digital.composite) + if (detailed->ad.digital.composite) { - detailed->digital.serrations = get_bit (bits, 2); - detailed->digital.negative_vsync = FALSE; + detailed->ad.digital.serrations = get_bit (bits, 2); + detailed->ad.digital.negative_vsync = FALSE; } else { - detailed->digital.serrations = FALSE; - detailed->digital.negative_vsync = !get_bit (bits, 2); + detailed->ad.digital.serrations = FALSE; + detailed->ad.digital.negative_vsync = !get_bit (bits, 2); } - detailed->digital.negative_hsync = !get_bit (bits, 0); + detailed->ad.digital.negative_hsync = !get_bit (bits, 0); } else { - detailed->analog.bipolar = get_bit (bits, 3); - detailed->analog.serrations = get_bit (bits, 2); - detailed->analog.sync_on_green = !get_bit (bits, 1); + detailed->ad.analog.bipolar = get_bit (bits, 3); + detailed->ad.analog.serrations = get_bit (bits, 2); + detailed->ad.analog.sync_on_green = !get_bit (bits, 1); } } @@ -579,12 +579,12 @@ dump_monitor_info (MonitorInfo *info) if (info->is_digital) { const char *interface; - if (info->digital.bits_per_primary != -1) - printf ("Bits Per Primary: %d\n", info->digital.bits_per_primary); + if (info->ad.digital.bits_per_primary != -1) + printf ("Bits Per Primary: %d\n", info->ad.digital.bits_per_primary); else printf ("Bits Per Primary: undefined\n"); - switch (info->digital.interface) + switch (info->ad.digital.interface) { case DVI: interface = "DVI"; break; case HDMI_A: interface = "HDMI-a"; break; @@ -596,27 +596,27 @@ dump_monitor_info (MonitorInfo *info) } printf ("Interface: %s\n", interface); - printf ("RGB 4:4:4: %s\n", yesno (info->digital.rgb444)); - printf ("YCrCb 4:4:4: %s\n", yesno (info->digital.ycrcb444)); - printf ("YCrCb 4:2:2: %s\n", yesno (info->digital.ycrcb422)); + printf ("RGB 4:4:4: %s\n", yesno (info->ad.digital.rgb444)); + printf ("YCrCb 4:4:4: %s\n", yesno (info->ad.digital.ycrcb444)); + printf ("YCrCb 4:2:2: %s\n", yesno (info->ad.digital.ycrcb422)); } else { const char *s; - printf ("Video Signal Level: %f\n", info->analog.video_signal_level); - printf ("Sync Signal Level: %f\n", info->analog.sync_signal_level); - printf ("Total Signal Level: %f\n", info->analog.total_signal_level); + printf ("Video Signal Level: %f\n", info->ad.analog.video_signal_level); + printf ("Sync Signal Level: %f\n", info->ad.analog.sync_signal_level); + printf ("Total Signal Level: %f\n", info->ad.analog.total_signal_level); printf ("Blank to Black: %s\n", - yesno (info->analog.blank_to_black)); + yesno (info->ad.analog.blank_to_black)); printf ("Separate HV Sync: %s\n", - yesno (info->analog.separate_hv_sync)); + yesno (info->ad.analog.separate_hv_sync)); printf ("Composite Sync on H: %s\n", - yesno (info->analog.composite_sync_on_h)); + yesno (info->ad.analog.composite_sync_on_h)); printf ("Serration on VSync: %s\n", - yesno (info->analog.serration_on_vsync)); + yesno (info->ad.analog.serration_on_vsync)); - switch (info->analog.color_type) + switch (info->ad.analog.color_type) { case UNDEFINED_COLOR: s = "undefined"; break; case MONOCHROME: s = "monochrome"; break; @@ -729,20 +729,20 @@ dump_monitor_info (MonitorInfo *info) if (timing->digital_sync) { printf (" Digital Sync:\n"); - printf (" composite: %s\n", yesno (timing->digital.composite)); - printf (" serrations: %s\n", yesno (timing->digital.serrations)); + printf (" composite: %s\n", yesno (timing->ad.digital.composite)); + printf (" serrations: %s\n", yesno (timing->ad.digital.serrations)); printf (" negative vsync: %s\n", - yesno (timing->digital.negative_vsync)); + yesno (timing->ad.digital.negative_vsync)); printf (" negative hsync: %s\n", - yesno (timing->digital.negative_hsync)); + yesno (timing->ad.digital.negative_hsync)); } else { printf (" Analog Sync:\n"); - printf (" bipolar: %s\n", yesno (timing->analog.bipolar)); - printf (" serrations: %s\n", yesno (timing->analog.serrations)); + printf (" bipolar: %s\n", yesno (timing->ad.analog.bipolar)); + printf (" serrations: %s\n", yesno (timing->ad.analog.serrations)); printf (" sync on green: %s\n", yesno ( - timing->analog.sync_on_green)); + timing->ad.analog.sync_on_green)); } } diff --git a/Engine/lib/sdl/src/video/x11/edid.h b/Engine/lib/sdl/src/video/x11/edid.h index 8c217eba2..cb9f0e87e 100644 --- a/Engine/lib/sdl/src/video/x11/edid.h +++ b/Engine/lib/sdl/src/video/x11/edid.h @@ -74,7 +74,7 @@ struct DetailedTiming int negative_vsync; int negative_hsync; } digital; - }; + } ad; }; struct MonitorInfo @@ -118,7 +118,7 @@ struct MonitorInfo int serration_on_vsync; ColorType color_type; } analog; - }; + } ad; int width_mm; /* -1 if not specified */ int height_mm; /* -1 if not specified */ diff --git a/Engine/lib/sdl/src/video/yuv2rgb/LICENSE b/Engine/lib/sdl/src/video/yuv2rgb/LICENSE new file mode 100644 index 000000000..a76efd7be --- /dev/null +++ b/Engine/lib/sdl/src/video/yuv2rgb/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2016, Adrien Descamps +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of yuv2rgb nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Engine/lib/sdl/src/video/yuv2rgb/README.md b/Engine/lib/sdl/src/video/yuv2rgb/README.md new file mode 100644 index 000000000..21191e979 --- /dev/null +++ b/Engine/lib/sdl/src/video/yuv2rgb/README.md @@ -0,0 +1,63 @@ +From: https://github.com/descampsa/yuv2rgb +# yuv2rgb +C library for fast image conversion between yuv420p and rgb24. + +This is a simple library for optimized image conversion between YUV420p and rgb24. +It was done mainly as an exercise to learn to use sse intrinsics, so there may still be room for optimization. + +For each conversion, a standard c optimized function and two sse function (with aligned and unaligned memory) are implemented. +The sse version requires only SSE2, which is available on any reasonably recent CPU. +The library also supports the three different YUV (YCrCb to be correct) color spaces that exist (see comments in code), and others can be added simply. + +There is a simple test program, that convert a raw YUV file to rgb ppm format, and measure computation time. +Optionally, it also compares the result and computation time with the ffmpeg implementation (that uses MMX), and with the IPP functions. + +To compile, simply do : + + mkdir build + cd build + cmake -DCMAKE_BUILD_TYPE=Release .. + make + +The test program only support raw YUV files for the YUV420 format, and ppm for the RGB24 format. +To generate a raw yuv file, you can use avconv: + + avconv -i example.jpg -c:v rawvideo -pix_fmt yuv420p example.yuv + +To generate the rgb file, you can use the ImageMagick convert program: + + convert example.jpg example.ppm + +Then, for YUV420 to RGB24 conversion, use the test program like that: + + ./test_yuv_rgb yuv2rgb image.yuv 4096 2160 image + +The second and third parameters are image width and height (that are needed because not available in the raw YUV file), and fourth parameter is the output filename template (several output files will be generated, named for example output_sse.ppm, output_av.ppm, etc.) + +Similarly, for RGB24 to YUV420 conversion: + + ./test_yuv_rgb yuv2rgb image.ppm image + +On my computer, the test program on a 4K image give the following for yuv2rgb: + + Time will be measured in each configuration for 100 iterations... + Processing time (std) : 2.630193 sec + Processing time (sse2_unaligned) : 0.704394 sec + Processing time (ffmpeg_unaligned) : 1.221432 sec + Processing time (ipp_unaligned) : 0.636274 sec + Processing time (sse2_aligned) : 0.606648 sec + Processing time (ffmpeg_aligned) : 1.227100 sec + Processing time (ipp_aligned) : 0.636951 sec + +And for rgb2yuv: + + Time will be measured in each configuration for 100 iterations... + Processing time (std) : 2.588675 sec + Processing time (sse2_unaligned) : 0.676625 sec + Processing time (ffmpeg_unaligned) : 3.385816 sec + Processing time (ipp_unaligned) : 0.593890 sec + Processing time (sse2_aligned) : 0.640630 sec + Processing time (ffmpeg_aligned) : 3.397952 sec + Processing time (ipp_aligned) : 0.579043 sec + +configuration : gcc 4.9.2, swscale 3.0.0, IPP 9.0.1, intel i7-5500U diff --git a/Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb.c b/Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb.c new file mode 100644 index 000000000..891dae229 --- /dev/null +++ b/Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb.c @@ -0,0 +1,687 @@ +// Copyright 2016 Adrien Descamps +// Distributed under BSD 3-Clause License +#include "../../SDL_internal.h" + +#include "yuv_rgb.h" + +#include "SDL_cpuinfo.h" +/*#include */ + +#define PRECISION 6 +#define PRECISION_FACTOR (1<[0-255]) +// for ITU-R BT.709-6 values are derived from equations in sections 3.2-3.4, assuming RGB is encoded using full range ([0-1]<->[0-255]) +// all values are rounded to the fourth decimal + +static const YUV2RGBParam YUV2RGB[3] = { + // ITU-T T.871 (JPEG) + {/*.y_shift=*/ 0, /*.y_factor=*/ V(1.0), /*.v_r_factor=*/ V(1.402), /*.u_g_factor=*/ -V(0.3441), /*.v_g_factor=*/ -V(0.7141), /*.u_b_factor=*/ V(1.772)}, + // ITU-R BT.601-7 + {/*.y_shift=*/ 16, /*.y_factor=*/ V(1.1644), /*.v_r_factor=*/ V(1.596), /*.u_g_factor=*/ -V(0.3918), /*.v_g_factor=*/ -V(0.813), /*.u_b_factor=*/ V(2.0172)}, + // ITU-R BT.709-6 + {/*.y_shift=*/ 16, /*.y_factor=*/ V(1.1644), /*.v_r_factor=*/ V(1.7927), /*.u_g_factor=*/ -V(0.2132), /*.v_g_factor=*/ -V(0.5329), /*.u_b_factor=*/ V(2.1124)} +}; + +static const RGB2YUVParam RGB2YUV[3] = { + // ITU-T T.871 (JPEG) + {/*.y_shift=*/ 0, /*.matrix=*/ {{V(0.299), V(0.587), V(0.114)}, {-V(0.1687), -V(0.3313), V(0.5)}, {V(0.5), -V(0.4187), -V(0.0813)}}}, + // ITU-R BT.601-7 + {/*.y_shift=*/ 16, /*.matrix=*/ {{V(0.2568), V(0.5041), V(0.0979)}, {-V(0.1482), -V(0.291), V(0.4392)}, {V(0.4392), -V(0.3678), -V(0.0714)}}}, + // ITU-R BT.709-6 + {/*.y_shift=*/ 16, /*.matrix=*/ {{V(0.1826), V(0.6142), V(0.062)}, {-V(0.1006), -V(0.3386), V(0.4392)}, {V(0.4392), -V(0.3989), -V(0.0403)}}} +}; + +/* The various layouts of YUV data we support */ +#define YUV_FORMAT_420 1 +#define YUV_FORMAT_422 2 +#define YUV_FORMAT_NV12 3 + +/* The various formats of RGB pixel that we support */ +#define RGB_FORMAT_RGB565 1 +#define RGB_FORMAT_RGB24 2 +#define RGB_FORMAT_RGBA 3 +#define RGB_FORMAT_BGRA 4 +#define RGB_FORMAT_ARGB 5 +#define RGB_FORMAT_ABGR 6 + +// divide by PRECISION_FACTOR and clamp to [0:255] interval +// input must be in the [-128*PRECISION_FACTOR:384*PRECISION_FACTOR] range +static uint8_t clampU8(int32_t v) +{ + static const uint8_t lut[512] = + {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46, + 47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90, + 91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125, + 126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158, + 159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, + 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223,224, + 225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255 + }; + return lut[(v+128*PRECISION_FACTOR)>>PRECISION]; +} + + +#define STD_FUNCTION_NAME yuv420_rgb565_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_RGB565 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_rgb24_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_RGB24 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_rgba_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_RGBA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_bgra_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_BGRA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_argb_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_ARGB +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv420_abgr_std +#define YUV_FORMAT YUV_FORMAT_420 +#define RGB_FORMAT RGB_FORMAT_ABGR +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_rgb565_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_RGB565 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_rgb24_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_RGB24 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_rgba_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_RGBA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_bgra_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_BGRA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_argb_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_ARGB +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuv422_abgr_std +#define YUV_FORMAT YUV_FORMAT_422 +#define RGB_FORMAT RGB_FORMAT_ABGR +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_rgb565_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_RGB565 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_rgb24_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_RGB24 +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_rgba_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_RGBA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_bgra_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_BGRA +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_argb_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_ARGB +#include "yuv_rgb_std_func.h" + +#define STD_FUNCTION_NAME yuvnv12_abgr_std +#define YUV_FORMAT YUV_FORMAT_NV12 +#define RGB_FORMAT RGB_FORMAT_ABGR +#include "yuv_rgb_std_func.h" + +void rgb24_yuv420_std( + uint32_t width, uint32_t height, + const uint8_t *RGB, uint32_t RGB_stride, + uint8_t *Y, uint8_t *U, uint8_t *V, uint32_t Y_stride, uint32_t UV_stride, + YCbCrType yuv_type) +{ + const RGB2YUVParam *const param = &(RGB2YUV[yuv_type]); + + uint32_t x, y; + for(y=0; y<(height-1); y+=2) + { + const uint8_t *rgb_ptr1=RGB+y*RGB_stride, + *rgb_ptr2=RGB+(y+1)*RGB_stride; + + uint8_t *y_ptr1=Y+y*Y_stride, + *y_ptr2=Y+(y+1)*Y_stride, + *u_ptr=U+(y/2)*UV_stride, + *v_ptr=V+(y/2)*UV_stride; + + for(x=0; x<(width-1); x+=2) + { + // compute yuv for the four pixels, u and v values are summed + int32_t y_tmp, u_tmp, v_tmp; + + y_tmp = param->matrix[0][0]*rgb_ptr1[0] + param->matrix[0][1]*rgb_ptr1[1] + param->matrix[0][2]*rgb_ptr1[2]; + u_tmp = param->matrix[1][0]*rgb_ptr1[0] + param->matrix[1][1]*rgb_ptr1[1] + param->matrix[1][2]*rgb_ptr1[2]; + v_tmp = param->matrix[2][0]*rgb_ptr1[0] + param->matrix[2][1]*rgb_ptr1[1] + param->matrix[2][2]*rgb_ptr1[2]; + y_ptr1[0]=clampU8(y_tmp+((param->y_shift)<matrix[0][0]*rgb_ptr1[3] + param->matrix[0][1]*rgb_ptr1[4] + param->matrix[0][2]*rgb_ptr1[5]; + u_tmp += param->matrix[1][0]*rgb_ptr1[3] + param->matrix[1][1]*rgb_ptr1[4] + param->matrix[1][2]*rgb_ptr1[5]; + v_tmp += param->matrix[2][0]*rgb_ptr1[3] + param->matrix[2][1]*rgb_ptr1[4] + param->matrix[2][2]*rgb_ptr1[5]; + y_ptr1[1]=clampU8(y_tmp+((param->y_shift)<matrix[0][0]*rgb_ptr2[0] + param->matrix[0][1]*rgb_ptr2[1] + param->matrix[0][2]*rgb_ptr2[2]; + u_tmp += param->matrix[1][0]*rgb_ptr2[0] + param->matrix[1][1]*rgb_ptr2[1] + param->matrix[1][2]*rgb_ptr2[2]; + v_tmp += param->matrix[2][0]*rgb_ptr2[0] + param->matrix[2][1]*rgb_ptr2[1] + param->matrix[2][2]*rgb_ptr2[2]; + y_ptr2[0]=clampU8(y_tmp+((param->y_shift)<matrix[0][0]*rgb_ptr2[3] + param->matrix[0][1]*rgb_ptr2[4] + param->matrix[0][2]*rgb_ptr2[5]; + u_tmp += param->matrix[1][0]*rgb_ptr2[3] + param->matrix[1][1]*rgb_ptr2[4] + param->matrix[1][2]*rgb_ptr2[5]; + v_tmp += param->matrix[2][0]*rgb_ptr2[3] + param->matrix[2][1]*rgb_ptr2[4] + param->matrix[2][2]*rgb_ptr2[5]; + y_ptr2[1]=clampU8(y_tmp+((param->y_shift)<matrix[0][0])), \ + _mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[0][1]))); \ +Y = _mm_add_epi16(Y, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[0][2]))); \ +Y = _mm_add_epi16(Y, _mm_set1_epi16((param->y_shift)<matrix[1][0])), \ + _mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[1][1]))); \ +U = _mm_add_epi16(U, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[1][2]))); \ +U = _mm_add_epi16(U, _mm_set1_epi16(128<matrix[2][0])), \ + _mm_mullo_epi16(G, _mm_set1_epi16(param->matrix[2][1]))); \ +V = _mm_add_epi16(V, _mm_mullo_epi16(B, _mm_set1_epi16(param->matrix[2][2]))); \ +V = _mm_add_epi16(V, _mm_set1_epi16(128<*/ + +typedef enum +{ + YCBCR_JPEG, + YCBCR_601, + YCBCR_709 +} YCbCrType; + +// yuv to rgb, standard c implementation +void yuv420_rgb565_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgb24_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgba_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_bgra_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_argb_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_abgr_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb565_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb24_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgba_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_bgra_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_argb_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_abgr_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb565_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb24_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgba_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_bgra_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_argb_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_abgr_std( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +// yuv to rgb, sse implementation +// pointers must be 16 byte aligned, and strides must be divisable by 16 +void yuv420_rgb565_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgb24_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgba_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_bgra_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_argb_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_abgr_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb565_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb24_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgba_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_bgra_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_argb_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_abgr_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb565_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb24_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgba_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_bgra_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_argb_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_abgr_sse( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +// yuv to rgb, sse implementation +// pointers do not need to be 16 byte aligned +void yuv420_rgb565_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgb24_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_rgba_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_bgra_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_argb_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv420_abgr_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb565_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgb24_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_rgba_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_bgra_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_argb_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuv422_abgr_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb565_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgb24_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_rgba_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_bgra_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_argb_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + +void yuvnv12_abgr_sseu( + uint32_t width, uint32_t height, + const uint8_t *y, const uint8_t *u, const uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + uint8_t *rgb, uint32_t rgb_stride, + YCbCrType yuv_type); + + +// rgb to yuv, standard c implementation +void rgb24_yuv420_std( + uint32_t width, uint32_t height, + const uint8_t *rgb, uint32_t rgb_stride, + uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + YCbCrType yuv_type); + +// rgb to yuv, sse implementation +// pointers must be 16 byte aligned, and strides must be divisible by 16 +void rgb24_yuv420_sse( + uint32_t width, uint32_t height, + const uint8_t *rgb, uint32_t rgb_stride, + uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + YCbCrType yuv_type); + +// rgb to yuv, sse implementation +// pointers do not need to be 16 byte aligned +void rgb24_yuv420_sseu( + uint32_t width, uint32_t height, + const uint8_t *rgb, uint32_t rgb_stride, + uint8_t *y, uint8_t *u, uint8_t *v, uint32_t y_stride, uint32_t uv_stride, + YCbCrType yuv_type); + diff --git a/Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb_sse_func.h b/Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb_sse_func.h new file mode 100644 index 000000000..f81140e18 --- /dev/null +++ b/Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb_sse_func.h @@ -0,0 +1,498 @@ +// Copyright 2016 Adrien Descamps +// Distributed under BSD 3-Clause License + +/* You need to define the following macros before including this file: + SSE_FUNCTION_NAME + STD_FUNCTION_NAME + YUV_FORMAT + RGB_FORMAT +*/ +/* You may define the following macro, which affects generated code: + SSE_ALIGNED +*/ + +#ifdef SSE_ALIGNED +/* Unaligned instructions seem faster, even on aligned data? */ +/* +#define LOAD_SI128 _mm_load_si128 +#define SAVE_SI128 _mm_stream_si128 +*/ +#define LOAD_SI128 _mm_loadu_si128 +#define SAVE_SI128 _mm_storeu_si128 +#else +#define LOAD_SI128 _mm_loadu_si128 +#define SAVE_SI128 _mm_storeu_si128 +#endif + +#define UV2RGB_16(U,V,R1,G1,B1,R2,G2,B2) \ + r_tmp = _mm_mullo_epi16(V, _mm_set1_epi16(param->v_r_factor)); \ + g_tmp = _mm_add_epi16( \ + _mm_mullo_epi16(U, _mm_set1_epi16(param->u_g_factor)), \ + _mm_mullo_epi16(V, _mm_set1_epi16(param->v_g_factor))); \ + b_tmp = _mm_mullo_epi16(U, _mm_set1_epi16(param->u_b_factor)); \ + R1 = _mm_unpacklo_epi16(r_tmp, r_tmp); \ + G1 = _mm_unpacklo_epi16(g_tmp, g_tmp); \ + B1 = _mm_unpacklo_epi16(b_tmp, b_tmp); \ + R2 = _mm_unpackhi_epi16(r_tmp, r_tmp); \ + G2 = _mm_unpackhi_epi16(g_tmp, g_tmp); \ + B2 = _mm_unpackhi_epi16(b_tmp, b_tmp); \ + +#define ADD_Y2RGB_16(Y1,Y2,R1,G1,B1,R2,G2,B2) \ + Y1 = _mm_mullo_epi16(_mm_sub_epi16(Y1, _mm_set1_epi16(param->y_shift)), _mm_set1_epi16(param->y_factor)); \ + Y2 = _mm_mullo_epi16(_mm_sub_epi16(Y2, _mm_set1_epi16(param->y_shift)), _mm_set1_epi16(param->y_factor)); \ + \ + R1 = _mm_srai_epi16(_mm_add_epi16(R1, Y1), PRECISION); \ + G1 = _mm_srai_epi16(_mm_add_epi16(G1, Y1), PRECISION); \ + B1 = _mm_srai_epi16(_mm_add_epi16(B1, Y1), PRECISION); \ + R2 = _mm_srai_epi16(_mm_add_epi16(R2, Y2), PRECISION); \ + G2 = _mm_srai_epi16(_mm_add_epi16(G2, Y2), PRECISION); \ + B2 = _mm_srai_epi16(_mm_add_epi16(B2, Y2), PRECISION); \ + +#define PACK_RGB565_32(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4) \ +{ \ + __m128i red_mask, tmp1, tmp2, tmp3, tmp4; \ +\ + red_mask = _mm_set1_epi16((short)0xF800); \ + RGB1 = _mm_and_si128(_mm_unpacklo_epi8(_mm_setzero_si128(), R1), red_mask); \ + RGB2 = _mm_and_si128(_mm_unpackhi_epi8(_mm_setzero_si128(), R1), red_mask); \ + RGB3 = _mm_and_si128(_mm_unpacklo_epi8(_mm_setzero_si128(), R2), red_mask); \ + RGB4 = _mm_and_si128(_mm_unpackhi_epi8(_mm_setzero_si128(), R2), red_mask); \ + tmp1 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpacklo_epi8(G1, _mm_setzero_si128()), 2), 5); \ + tmp2 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpackhi_epi8(G1, _mm_setzero_si128()), 2), 5); \ + tmp3 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpacklo_epi8(G2, _mm_setzero_si128()), 2), 5); \ + tmp4 = _mm_slli_epi16(_mm_srli_epi16(_mm_unpackhi_epi8(G2, _mm_setzero_si128()), 2), 5); \ + RGB1 = _mm_or_si128(RGB1, tmp1); \ + RGB2 = _mm_or_si128(RGB2, tmp2); \ + RGB3 = _mm_or_si128(RGB3, tmp3); \ + RGB4 = _mm_or_si128(RGB4, tmp4); \ + tmp1 = _mm_srli_epi16(_mm_unpacklo_epi8(B1, _mm_setzero_si128()), 3); \ + tmp2 = _mm_srli_epi16(_mm_unpackhi_epi8(B1, _mm_setzero_si128()), 3); \ + tmp3 = _mm_srli_epi16(_mm_unpacklo_epi8(B2, _mm_setzero_si128()), 3); \ + tmp4 = _mm_srli_epi16(_mm_unpackhi_epi8(B2, _mm_setzero_si128()), 3); \ + RGB1 = _mm_or_si128(RGB1, tmp1); \ + RGB2 = _mm_or_si128(RGB2, tmp2); \ + RGB3 = _mm_or_si128(RGB3, tmp3); \ + RGB4 = _mm_or_si128(RGB4, tmp4); \ +} + +#define PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +RGB1 = _mm_packus_epi16(_mm_and_si128(R1,_mm_set1_epi16(0xFF)), _mm_and_si128(R2,_mm_set1_epi16(0xFF))); \ +RGB2 = _mm_packus_epi16(_mm_and_si128(G1,_mm_set1_epi16(0xFF)), _mm_and_si128(G2,_mm_set1_epi16(0xFF))); \ +RGB3 = _mm_packus_epi16(_mm_and_si128(B1,_mm_set1_epi16(0xFF)), _mm_and_si128(B2,_mm_set1_epi16(0xFF))); \ +RGB4 = _mm_packus_epi16(_mm_srli_epi16(R1,8), _mm_srli_epi16(R2,8)); \ +RGB5 = _mm_packus_epi16(_mm_srli_epi16(G1,8), _mm_srli_epi16(G2,8)); \ +RGB6 = _mm_packus_epi16(_mm_srli_epi16(B1,8), _mm_srli_epi16(B2,8)); \ + +#define PACK_RGB24_32_STEP2(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +R1 = _mm_packus_epi16(_mm_and_si128(RGB1,_mm_set1_epi16(0xFF)), _mm_and_si128(RGB2,_mm_set1_epi16(0xFF))); \ +R2 = _mm_packus_epi16(_mm_and_si128(RGB3,_mm_set1_epi16(0xFF)), _mm_and_si128(RGB4,_mm_set1_epi16(0xFF))); \ +G1 = _mm_packus_epi16(_mm_and_si128(RGB5,_mm_set1_epi16(0xFF)), _mm_and_si128(RGB6,_mm_set1_epi16(0xFF))); \ +G2 = _mm_packus_epi16(_mm_srli_epi16(RGB1,8), _mm_srli_epi16(RGB2,8)); \ +B1 = _mm_packus_epi16(_mm_srli_epi16(RGB3,8), _mm_srli_epi16(RGB4,8)); \ +B2 = _mm_packus_epi16(_mm_srli_epi16(RGB5,8), _mm_srli_epi16(RGB6,8)); \ + +#define PACK_RGB24_32(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +PACK_RGB24_32_STEP2(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +PACK_RGB24_32_STEP2(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ +PACK_RGB24_32_STEP1(R1, R2, G1, G2, B1, B2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6) \ + +#define PACK_RGBA_32(R1, R2, G1, G2, B1, B2, A1, A2, RGB1, RGB2, RGB3, RGB4, RGB5, RGB6, RGB7, RGB8) \ +{ \ + __m128i lo_ab, hi_ab, lo_gr, hi_gr; \ +\ + lo_ab = _mm_unpacklo_epi8( A1, B1 ); \ + hi_ab = _mm_unpackhi_epi8( A1, B1 ); \ + lo_gr = _mm_unpacklo_epi8( G1, R1 ); \ + hi_gr = _mm_unpackhi_epi8( G1, R1 ); \ + RGB1 = _mm_unpacklo_epi16( lo_ab, lo_gr ); \ + RGB2 = _mm_unpackhi_epi16( lo_ab, lo_gr ); \ + RGB3 = _mm_unpacklo_epi16( hi_ab, hi_gr ); \ + RGB4 = _mm_unpackhi_epi16( hi_ab, hi_gr ); \ +\ + lo_ab = _mm_unpacklo_epi8( A2, B2 ); \ + hi_ab = _mm_unpackhi_epi8( A2, B2 ); \ + lo_gr = _mm_unpacklo_epi8( G2, R2 ); \ + hi_gr = _mm_unpackhi_epi8( G2, R2 ); \ + RGB5 = _mm_unpacklo_epi16( lo_ab, lo_gr ); \ + RGB6 = _mm_unpackhi_epi16( lo_ab, lo_gr ); \ + RGB7 = _mm_unpacklo_epi16( hi_ab, hi_gr ); \ + RGB8 = _mm_unpackhi_epi16( hi_ab, hi_gr ); \ +} + +#if RGB_FORMAT == RGB_FORMAT_RGB565 + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + \ + PACK_RGB565_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4) \ + \ + PACK_RGB565_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, rgb_5, rgb_6, rgb_7, rgb_8) \ + +#elif RGB_FORMAT == RGB_FORMAT_RGB24 + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6; \ + __m128i rgb_7, rgb_8, rgb_9, rgb_10, rgb_11, rgb_12; \ + \ + PACK_RGB24_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6) \ + \ + PACK_RGB24_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, rgb_7, rgb_8, rgb_9, rgb_10, rgb_11, rgb_12) \ + +#elif RGB_FORMAT == RGB_FORMAT_RGBA + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ + __m128i a = _mm_set1_epi8((char)0xFF); \ + \ + PACK_RGBA_32(r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, a, a, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ + \ + PACK_RGBA_32(r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, a, a, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \ + +#elif RGB_FORMAT == RGB_FORMAT_BGRA + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ + __m128i a = _mm_set1_epi8((char)0xFF); \ + \ + PACK_RGBA_32(b_8_11, b_8_12, g_8_11, g_8_12, r_8_11, r_8_12, a, a, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ + \ + PACK_RGBA_32(b_8_21, b_8_22, g_8_21, g_8_22, r_8_21, r_8_22, a, a, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \ + +#elif RGB_FORMAT == RGB_FORMAT_ARGB + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ + __m128i a = _mm_set1_epi8((char)0xFF); \ + \ + PACK_RGBA_32(a, a, r_8_11, r_8_12, g_8_11, g_8_12, b_8_11, b_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ + \ + PACK_RGBA_32(a, a, r_8_21, r_8_22, g_8_21, g_8_22, b_8_21, b_8_22, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \ + +#elif RGB_FORMAT == RGB_FORMAT_ABGR + +#define PACK_PIXEL \ + __m128i rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8; \ + __m128i rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16; \ + __m128i a = _mm_set1_epi8((char)0xFF); \ + \ + PACK_RGBA_32(a, a, b_8_11, b_8_12, g_8_11, g_8_12, r_8_11, r_8_12, rgb_1, rgb_2, rgb_3, rgb_4, rgb_5, rgb_6, rgb_7, rgb_8) \ + \ + PACK_RGBA_32(a, a, b_8_21, b_8_22, g_8_21, g_8_22, r_8_21, r_8_22, rgb_9, rgb_10, rgb_11, rgb_12, rgb_13, rgb_14, rgb_15, rgb_16) \ + +#else +#error PACK_PIXEL unimplemented +#endif + +#if RGB_FORMAT == RGB_FORMAT_RGB565 + +#define SAVE_LINE1 \ + SAVE_SI128((__m128i*)(rgb_ptr1), rgb_1); \ + SAVE_SI128((__m128i*)(rgb_ptr1+16), rgb_2); \ + SAVE_SI128((__m128i*)(rgb_ptr1+32), rgb_3); \ + SAVE_SI128((__m128i*)(rgb_ptr1+48), rgb_4); \ + +#define SAVE_LINE2 \ + SAVE_SI128((__m128i*)(rgb_ptr2), rgb_5); \ + SAVE_SI128((__m128i*)(rgb_ptr2+16), rgb_6); \ + SAVE_SI128((__m128i*)(rgb_ptr2+32), rgb_7); \ + SAVE_SI128((__m128i*)(rgb_ptr2+48), rgb_8); \ + +#elif RGB_FORMAT == RGB_FORMAT_RGB24 + +#define SAVE_LINE1 \ + SAVE_SI128((__m128i*)(rgb_ptr1), rgb_1); \ + SAVE_SI128((__m128i*)(rgb_ptr1+16), rgb_2); \ + SAVE_SI128((__m128i*)(rgb_ptr1+32), rgb_3); \ + SAVE_SI128((__m128i*)(rgb_ptr1+48), rgb_4); \ + SAVE_SI128((__m128i*)(rgb_ptr1+64), rgb_5); \ + SAVE_SI128((__m128i*)(rgb_ptr1+80), rgb_6); \ + +#define SAVE_LINE2 \ + SAVE_SI128((__m128i*)(rgb_ptr2), rgb_7); \ + SAVE_SI128((__m128i*)(rgb_ptr2+16), rgb_8); \ + SAVE_SI128((__m128i*)(rgb_ptr2+32), rgb_9); \ + SAVE_SI128((__m128i*)(rgb_ptr2+48), rgb_10); \ + SAVE_SI128((__m128i*)(rgb_ptr2+64), rgb_11); \ + SAVE_SI128((__m128i*)(rgb_ptr2+80), rgb_12); \ + +#elif RGB_FORMAT == RGB_FORMAT_RGBA || RGB_FORMAT == RGB_FORMAT_BGRA || \ + RGB_FORMAT == RGB_FORMAT_ARGB || RGB_FORMAT == RGB_FORMAT_ABGR + +#define SAVE_LINE1 \ + SAVE_SI128((__m128i*)(rgb_ptr1), rgb_1); \ + SAVE_SI128((__m128i*)(rgb_ptr1+16), rgb_2); \ + SAVE_SI128((__m128i*)(rgb_ptr1+32), rgb_3); \ + SAVE_SI128((__m128i*)(rgb_ptr1+48), rgb_4); \ + SAVE_SI128((__m128i*)(rgb_ptr1+64), rgb_5); \ + SAVE_SI128((__m128i*)(rgb_ptr1+80), rgb_6); \ + SAVE_SI128((__m128i*)(rgb_ptr1+96), rgb_7); \ + SAVE_SI128((__m128i*)(rgb_ptr1+112), rgb_8); \ + +#define SAVE_LINE2 \ + SAVE_SI128((__m128i*)(rgb_ptr2), rgb_9); \ + SAVE_SI128((__m128i*)(rgb_ptr2+16), rgb_10); \ + SAVE_SI128((__m128i*)(rgb_ptr2+32), rgb_11); \ + SAVE_SI128((__m128i*)(rgb_ptr2+48), rgb_12); \ + SAVE_SI128((__m128i*)(rgb_ptr2+64), rgb_13); \ + SAVE_SI128((__m128i*)(rgb_ptr2+80), rgb_14); \ + SAVE_SI128((__m128i*)(rgb_ptr2+96), rgb_15); \ + SAVE_SI128((__m128i*)(rgb_ptr2+112), rgb_16); \ + +#else +#error SAVE_LINE unimplemented +#endif + +#if YUV_FORMAT == YUV_FORMAT_420 + +#define READ_Y(y_ptr) \ + y = LOAD_SI128((const __m128i*)(y_ptr)); \ + +#define READ_UV \ + u = LOAD_SI128((const __m128i*)(u_ptr)); \ + v = LOAD_SI128((const __m128i*)(v_ptr)); \ + +#elif YUV_FORMAT == YUV_FORMAT_422 + +#define READ_Y(y_ptr) \ +{ \ + __m128i y1, y2; \ + y1 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(y_ptr)), 8), 8); \ + y2 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(y_ptr+16)), 8), 8); \ + y = _mm_packus_epi16(y1, y2); \ +} + +#define READ_UV \ +{ \ + __m128i u1, u2, u3, u4, v1, v2, v3, v4; \ + u1 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr)), 24), 24); \ + u2 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr+16)), 24), 24); \ + u3 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr+32)), 24), 24); \ + u4 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(u_ptr+48)), 24), 24); \ + u = _mm_packus_epi16(_mm_packs_epi32(u1, u2), _mm_packs_epi32(u3, u4)); \ + v1 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr)), 24), 24); \ + v2 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr+16)), 24), 24); \ + v3 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr+32)), 24), 24); \ + v4 = _mm_srli_epi32(_mm_slli_epi32(LOAD_SI128((const __m128i*)(v_ptr+48)), 24), 24); \ + v = _mm_packus_epi16(_mm_packs_epi32(v1, v2), _mm_packs_epi32(v3, v4)); \ +} + +#elif YUV_FORMAT == YUV_FORMAT_NV12 + +#define READ_Y(y_ptr) \ + y = LOAD_SI128((const __m128i*)(y_ptr)); \ + +#define READ_UV \ +{ \ + __m128i u1, u2, v1, v2; \ + u1 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(u_ptr)), 8), 8); \ + u2 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(u_ptr+16)), 8), 8); \ + u = _mm_packus_epi16(u1, u2); \ + v1 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(v_ptr)), 8), 8); \ + v2 = _mm_srli_epi16(_mm_slli_epi16(LOAD_SI128((const __m128i*)(v_ptr+16)), 8), 8); \ + v = _mm_packus_epi16(v1, v2); \ +} + +#else +#error READ_UV unimplemented +#endif + +#define YUV2RGB_32 \ + __m128i r_tmp, g_tmp, b_tmp; \ + __m128i r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2; \ + __m128i r_uv_16_1, g_uv_16_1, b_uv_16_1, r_uv_16_2, g_uv_16_2, b_uv_16_2; \ + __m128i y_16_1, y_16_2; \ + __m128i y, u, v, u_16, v_16; \ + __m128i r_8_11, g_8_11, b_8_11, r_8_21, g_8_21, b_8_21; \ + __m128i r_8_12, g_8_12, b_8_12, r_8_22, g_8_22, b_8_22; \ + \ + READ_UV \ + \ + /* process first 16 pixels of first line */\ + u_16 = _mm_unpacklo_epi8(u, _mm_setzero_si128()); \ + v_16 = _mm_unpacklo_epi8(v, _mm_setzero_si128()); \ + u_16 = _mm_add_epi16(u_16, _mm_set1_epi16(-128)); \ + v_16 = _mm_add_epi16(v_16, _mm_set1_epi16(-128)); \ + \ + UV2RGB_16(u_16, v_16, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \ + r_uv_16_1=r_16_1; g_uv_16_1=g_16_1; b_uv_16_1=b_16_1; \ + r_uv_16_2=r_16_2; g_uv_16_2=g_16_2; b_uv_16_2=b_16_2; \ + \ + READ_Y(y_ptr1) \ + y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \ + y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \ + \ + ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \ + \ + r_8_11 = _mm_packus_epi16(r_16_1, r_16_2); \ + g_8_11 = _mm_packus_epi16(g_16_1, g_16_2); \ + b_8_11 = _mm_packus_epi16(b_16_1, b_16_2); \ + \ + /* process first 16 pixels of second line */\ + r_16_1=r_uv_16_1; g_16_1=g_uv_16_1; b_16_1=b_uv_16_1; \ + r_16_2=r_uv_16_2; g_16_2=g_uv_16_2; b_16_2=b_uv_16_2; \ + \ + READ_Y(y_ptr2) \ + y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \ + y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \ + \ + ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \ + \ + r_8_21 = _mm_packus_epi16(r_16_1, r_16_2); \ + g_8_21 = _mm_packus_epi16(g_16_1, g_16_2); \ + b_8_21 = _mm_packus_epi16(b_16_1, b_16_2); \ + \ + /* process last 16 pixels of first line */\ + u_16 = _mm_unpackhi_epi8(u, _mm_setzero_si128()); \ + v_16 = _mm_unpackhi_epi8(v, _mm_setzero_si128()); \ + u_16 = _mm_add_epi16(u_16, _mm_set1_epi16(-128)); \ + v_16 = _mm_add_epi16(v_16, _mm_set1_epi16(-128)); \ + \ + UV2RGB_16(u_16, v_16, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \ + r_uv_16_1=r_16_1; g_uv_16_1=g_16_1; b_uv_16_1=b_16_1; \ + r_uv_16_2=r_16_2; g_uv_16_2=g_16_2; b_uv_16_2=b_16_2; \ + \ + READ_Y(y_ptr1+16*y_pixel_stride) \ + y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \ + y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \ + \ + ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \ + \ + r_8_12 = _mm_packus_epi16(r_16_1, r_16_2); \ + g_8_12 = _mm_packus_epi16(g_16_1, g_16_2); \ + b_8_12 = _mm_packus_epi16(b_16_1, b_16_2); \ + \ + /* process last 16 pixels of second line */\ + r_16_1=r_uv_16_1; g_16_1=g_uv_16_1; b_16_1=b_uv_16_1; \ + r_16_2=r_uv_16_2; g_16_2=g_uv_16_2; b_16_2=b_uv_16_2; \ + \ + READ_Y(y_ptr2+16*y_pixel_stride) \ + y_16_1 = _mm_unpacklo_epi8(y, _mm_setzero_si128()); \ + y_16_2 = _mm_unpackhi_epi8(y, _mm_setzero_si128()); \ + \ + ADD_Y2RGB_16(y_16_1, y_16_2, r_16_1, g_16_1, b_16_1, r_16_2, g_16_2, b_16_2) \ + \ + r_8_22 = _mm_packus_epi16(r_16_1, r_16_2); \ + g_8_22 = _mm_packus_epi16(g_16_1, g_16_2); \ + b_8_22 = _mm_packus_epi16(b_16_1, b_16_2); \ + \ + + +void SSE_FUNCTION_NAME(uint32_t width, uint32_t height, + const uint8_t *Y, const uint8_t *U, const uint8_t *V, uint32_t Y_stride, uint32_t UV_stride, + uint8_t *RGB, uint32_t RGB_stride, + YCbCrType yuv_type) +{ + const YUV2RGBParam *const param = &(YUV2RGB[yuv_type]); +#if YUV_FORMAT == YUV_FORMAT_420 + const int y_pixel_stride = 1; + const int uv_pixel_stride = 1; + const int uv_x_sample_interval = 2; + const int uv_y_sample_interval = 2; +#elif YUV_FORMAT == YUV_FORMAT_422 + const int y_pixel_stride = 2; + const int uv_pixel_stride = 4; + const int uv_x_sample_interval = 2; + const int uv_y_sample_interval = 1; +#elif YUV_FORMAT == YUV_FORMAT_NV12 + const int y_pixel_stride = 1; + const int uv_pixel_stride = 2; + const int uv_x_sample_interval = 2; + const int uv_y_sample_interval = 2; +#endif +#if RGB_FORMAT == RGB_FORMAT_RGB565 + const int rgb_pixel_stride = 2; +#elif RGB_FORMAT == RGB_FORMAT_RGB24 + const int rgb_pixel_stride = 3; +#elif RGB_FORMAT == RGB_FORMAT_RGBA || RGB_FORMAT == RGB_FORMAT_BGRA || \ + RGB_FORMAT == RGB_FORMAT_ARGB || RGB_FORMAT == RGB_FORMAT_ABGR + const int rgb_pixel_stride = 4; +#else +#error Unknown RGB pixel size +#endif + + if (width >= 32) { + uint32_t xpos, ypos; + for(ypos=0; ypos<(height-(uv_y_sample_interval-1)); ypos+=uv_y_sample_interval) + { + const uint8_t *y_ptr1=Y+ypos*Y_stride, + *y_ptr2=Y+(ypos+1)*Y_stride, + *u_ptr=U+(ypos/uv_y_sample_interval)*UV_stride, + *v_ptr=V+(ypos/uv_y_sample_interval)*UV_stride; + + uint8_t *rgb_ptr1=RGB+ypos*RGB_stride, + *rgb_ptr2=RGB+(ypos+1)*RGB_stride; + + for(xpos=0; xpos<(width-31); xpos+=32) + { + YUV2RGB_32 + { + PACK_PIXEL + SAVE_LINE1 + if (uv_y_sample_interval > 1) + { + SAVE_LINE2 + } + } + + y_ptr1+=32*y_pixel_stride; + y_ptr2+=32*y_pixel_stride; + u_ptr+=32*uv_pixel_stride/uv_x_sample_interval; + v_ptr+=32*uv_pixel_stride/uv_x_sample_interval; + rgb_ptr1+=32*rgb_pixel_stride; + rgb_ptr2+=32*rgb_pixel_stride; + } + } + + /* Catch the last line, if needed */ + if (uv_y_sample_interval == 2 && ypos == (height-1)) + { + const uint8_t *y_ptr=Y+ypos*Y_stride, + *u_ptr=U+(ypos/uv_y_sample_interval)*UV_stride, + *v_ptr=V+(ypos/uv_y_sample_interval)*UV_stride; + + uint8_t *rgb_ptr=RGB+ypos*RGB_stride; + + STD_FUNCTION_NAME(width, 1, y_ptr, u_ptr, v_ptr, Y_stride, UV_stride, rgb_ptr, RGB_stride, yuv_type); + } + } + + /* Catch the right column, if needed */ + { + int converted = (width & ~31); + if (converted != width) + { + const uint8_t *y_ptr=Y+converted*y_pixel_stride, + *u_ptr=U+converted*uv_pixel_stride/uv_x_sample_interval, + *v_ptr=V+converted*uv_pixel_stride/uv_x_sample_interval; + + uint8_t *rgb_ptr=RGB+converted*rgb_pixel_stride; + + STD_FUNCTION_NAME(width-converted, height, y_ptr, u_ptr, v_ptr, Y_stride, UV_stride, rgb_ptr, RGB_stride, yuv_type); + } + } +} + +#undef SSE_FUNCTION_NAME +#undef STD_FUNCTION_NAME +#undef YUV_FORMAT +#undef RGB_FORMAT +#undef SSE_ALIGNED +#undef LOAD_SI128 +#undef SAVE_SI128 +#undef UV2RGB_16 +#undef ADD_Y2RGB_16 +#undef PACK_RGB24_32_STEP1 +#undef PACK_RGB24_32_STEP2 +#undef PACK_RGB24_32 +#undef PACK_RGBA_32 +#undef PACK_PIXEL +#undef SAVE_LINE1 +#undef SAVE_LINE2 +#undef READ_Y +#undef READ_UV +#undef YUV2RGB_32 diff --git a/Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb_std_func.h b/Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb_std_func.h new file mode 100644 index 000000000..bf4f48eab --- /dev/null +++ b/Engine/lib/sdl/src/video/yuv2rgb/yuv_rgb_std_func.h @@ -0,0 +1,220 @@ +// Copyright 2016 Adrien Descamps +// Distributed under BSD 3-Clause License + +/* You need to define the following macros before including this file: + STD_FUNCTION_NAME + YUV_FORMAT + RGB_FORMAT +*/ + +#if RGB_FORMAT == RGB_FORMAT_RGB565 + +#define PACK_PIXEL(rgb_ptr) \ + *(Uint16 *)rgb_ptr = \ + ((((Uint16)clampU8(y_tmp+r_tmp)) << 8 ) & 0xF800) | \ + ((((Uint16)clampU8(y_tmp+g_tmp)) << 3) & 0x07E0) | \ + (((Uint16)clampU8(y_tmp+b_tmp)) >> 3); \ + rgb_ptr += 2; \ + +#elif RGB_FORMAT == RGB_FORMAT_RGB24 + +#define PACK_PIXEL(rgb_ptr) \ + rgb_ptr[0] = clampU8(y_tmp+r_tmp); \ + rgb_ptr[1] = clampU8(y_tmp+g_tmp); \ + rgb_ptr[2] = clampU8(y_tmp+b_tmp); \ + rgb_ptr += 3; \ + +#elif RGB_FORMAT == RGB_FORMAT_RGBA + +#define PACK_PIXEL(rgb_ptr) \ + *(Uint32 *)rgb_ptr = \ + (((Uint32)clampU8(y_tmp+r_tmp)) << 24) | \ + (((Uint32)clampU8(y_tmp+g_tmp)) << 16) | \ + (((Uint32)clampU8(y_tmp+b_tmp)) << 8) | \ + 0x000000FF; \ + rgb_ptr += 4; \ + +#elif RGB_FORMAT == RGB_FORMAT_BGRA + +#define PACK_PIXEL(rgb_ptr) \ + *(Uint32 *)rgb_ptr = \ + (((Uint32)clampU8(y_tmp+b_tmp)) << 24) | \ + (((Uint32)clampU8(y_tmp+g_tmp)) << 16) | \ + (((Uint32)clampU8(y_tmp+r_tmp)) << 8) | \ + 0x000000FF; \ + rgb_ptr += 4; \ + +#elif RGB_FORMAT == RGB_FORMAT_ARGB + +#define PACK_PIXEL(rgb_ptr) \ + *(Uint32 *)rgb_ptr = \ + 0xFF000000 | \ + (((Uint32)clampU8(y_tmp+r_tmp)) << 16) | \ + (((Uint32)clampU8(y_tmp+g_tmp)) << 8) | \ + (((Uint32)clampU8(y_tmp+b_tmp)) << 0); \ + rgb_ptr += 4; \ + +#elif RGB_FORMAT == RGB_FORMAT_ABGR + +#define PACK_PIXEL(rgb_ptr) \ + *(Uint32 *)rgb_ptr = \ + 0xFF000000 | \ + (((Uint32)clampU8(y_tmp+b_tmp)) << 16) | \ + (((Uint32)clampU8(y_tmp+g_tmp)) << 8) | \ + (((Uint32)clampU8(y_tmp+r_tmp)) << 0); \ + rgb_ptr += 4; \ + +#else +#error PACK_PIXEL unimplemented +#endif + + +void STD_FUNCTION_NAME( + uint32_t width, uint32_t height, + const uint8_t *Y, const uint8_t *U, const uint8_t *V, uint32_t Y_stride, uint32_t UV_stride, + uint8_t *RGB, uint32_t RGB_stride, + YCbCrType yuv_type) +{ + const YUV2RGBParam *const param = &(YUV2RGB[yuv_type]); +#if YUV_FORMAT == YUV_FORMAT_420 + const int y_pixel_stride = 1; + const int uv_pixel_stride = 1; + const int uv_x_sample_interval = 2; + const int uv_y_sample_interval = 2; +#elif YUV_FORMAT == YUV_FORMAT_422 + const int y_pixel_stride = 2; + const int uv_pixel_stride = 4; + const int uv_x_sample_interval = 2; + const int uv_y_sample_interval = 1; +#elif YUV_FORMAT == YUV_FORMAT_NV12 + const int y_pixel_stride = 1; + const int uv_pixel_stride = 2; + const int uv_x_sample_interval = 2; + const int uv_y_sample_interval = 2; +#endif + + uint32_t x, y; + for(y=0; y<(height-(uv_y_sample_interval-1)); y+=uv_y_sample_interval) + { + const uint8_t *y_ptr1=Y+y*Y_stride, + *y_ptr2=Y+(y+1)*Y_stride, + *u_ptr=U+(y/uv_y_sample_interval)*UV_stride, + *v_ptr=V+(y/uv_y_sample_interval)*UV_stride; + + uint8_t *rgb_ptr1=RGB+y*RGB_stride, + *rgb_ptr2=RGB+(y+1)*RGB_stride; + + for(x=0; x<(width-(uv_x_sample_interval-1)); x+=uv_x_sample_interval) + { + // Compute U and V contributions, common to the four pixels + + int32_t u_tmp = ((*u_ptr)-128); + int32_t v_tmp = ((*v_ptr)-128); + + int32_t r_tmp = (v_tmp*param->v_r_factor); + int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor); + int32_t b_tmp = (u_tmp*param->u_b_factor); + + // Compute the Y contribution for each pixel + + int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr1); + + y_tmp = ((y_ptr1[y_pixel_stride]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr1); + + if (uv_y_sample_interval > 1) { + y_tmp = ((y_ptr2[0]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr2); + + y_tmp = ((y_ptr2[y_pixel_stride]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr2); + } + + y_ptr1+=2*y_pixel_stride; + y_ptr2+=2*y_pixel_stride; + u_ptr+=2*uv_pixel_stride/uv_x_sample_interval; + v_ptr+=2*uv_pixel_stride/uv_x_sample_interval; + } + + /* Catch the last pixel, if needed */ + if (uv_x_sample_interval == 2 && x == (width-1)) + { + // Compute U and V contributions, common to the four pixels + + int32_t u_tmp = ((*u_ptr)-128); + int32_t v_tmp = ((*v_ptr)-128); + + int32_t r_tmp = (v_tmp*param->v_r_factor); + int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor); + int32_t b_tmp = (u_tmp*param->u_b_factor); + + // Compute the Y contribution for each pixel + + int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr1); + + if (uv_y_sample_interval > 1) { + y_tmp = ((y_ptr2[0]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr2); + } + } + } + + /* Catch the last line, if needed */ + if (uv_y_sample_interval == 2 && y == (height-1)) + { + const uint8_t *y_ptr1=Y+y*Y_stride, + *u_ptr=U+(y/uv_y_sample_interval)*UV_stride, + *v_ptr=V+(y/uv_y_sample_interval)*UV_stride; + + uint8_t *rgb_ptr1=RGB+y*RGB_stride; + + for(x=0; x<(width-(uv_x_sample_interval-1)); x+=uv_x_sample_interval) + { + // Compute U and V contributions, common to the four pixels + + int32_t u_tmp = ((*u_ptr)-128); + int32_t v_tmp = ((*v_ptr)-128); + + int32_t r_tmp = (v_tmp*param->v_r_factor); + int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor); + int32_t b_tmp = (u_tmp*param->u_b_factor); + + // Compute the Y contribution for each pixel + + int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr1); + + y_tmp = ((y_ptr1[y_pixel_stride]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr1); + + y_ptr1+=2*y_pixel_stride; + u_ptr+=2*uv_pixel_stride/uv_x_sample_interval; + v_ptr+=2*uv_pixel_stride/uv_x_sample_interval; + } + + /* Catch the last pixel, if needed */ + if (uv_x_sample_interval == 2 && x == (width-1)) + { + // Compute U and V contributions, common to the four pixels + + int32_t u_tmp = ((*u_ptr)-128); + int32_t v_tmp = ((*v_ptr)-128); + + int32_t r_tmp = (v_tmp*param->v_r_factor); + int32_t g_tmp = (u_tmp*param->u_g_factor + v_tmp*param->v_g_factor); + int32_t b_tmp = (u_tmp*param->u_b_factor); + + // Compute the Y contribution for each pixel + + int32_t y_tmp = ((y_ptr1[0]-param->y_shift)*param->y_factor); + PACK_PIXEL(rgb_ptr1); + } + } +} + +#undef STD_FUNCTION_NAME +#undef YUV_FORMAT +#undef RGB_FORMAT +#undef PACK_PIXEL diff --git a/Engine/lib/sdl/test/CMakeLists.txt b/Engine/lib/sdl/test/CMakeLists.txt new file mode 100644 index 000000000..3c25c5c7c --- /dev/null +++ b/Engine/lib/sdl/test/CMakeLists.txt @@ -0,0 +1,122 @@ +cmake_minimum_required(VERSION 2.8.11) +project(SDL2 C) + +# Global settings for all of the test targets +# FIXME: is this wrong? +remove_definitions(-DUSING_GENERATED_CONFIG_H) +link_libraries(SDL2_test SDL2-static) + +# FIXME: Parent directory CMakeLists.txt only sets these for mingw/cygwin, +# but we need them for VS as well. +if(WINDOWS) + link_libraries(SDL2main) + add_definitions(-Dmain=SDL_main) +endif() + +add_executable(checkkeys checkkeys.c) +add_executable(loopwave loopwave.c) +add_executable(loopwavequeue loopwavequeue.c) +add_executable(testresample testresample.c) +add_executable(testaudioinfo testaudioinfo.c) + +file(GLOB TESTAUTOMATION_SOURCE_FILES testautomation*.c) +add_executable(testautomation ${TESTAUTOMATION_SOURCE_FILES}) + +add_executable(testmultiaudio testmultiaudio.c) +add_executable(testaudiohotplug testaudiohotplug.c) +add_executable(testaudiocapture testaudiocapture.c) +add_executable(testatomic testatomic.c) +add_executable(testintersections testintersections.c) +add_executable(testrelative testrelative.c) +add_executable(testhittesting testhittesting.c) +add_executable(testdraw2 testdraw2.c) +add_executable(testdrawchessboard testdrawchessboard.c) +add_executable(testdropfile testdropfile.c) +add_executable(testerror testerror.c) +add_executable(testfile testfile.c) +add_executable(testgamecontroller testgamecontroller.c) +add_executable(testgesture testgesture.c) +add_executable(testgl2 testgl2.c) +add_executable(testgles testgles.c) +add_executable(testgles2 testgles2.c) +add_executable(testhaptic testhaptic.c) +add_executable(testhotplug testhotplug.c) +add_executable(testrumble testrumble.c) +add_executable(testthread testthread.c) +add_executable(testiconv testiconv.c) +add_executable(testime testime.c) +add_executable(testjoystick testjoystick.c) +add_executable(testkeys testkeys.c) +add_executable(testloadso testloadso.c) +add_executable(testlock testlock.c) + +if(APPLE) + add_executable(testnative testnative.c + testnativecocoa.m + testnativex11.c) +elseif(WINDOWS) + add_executable(testnative testnative.c testnativew32.c) +elseif(UNIX) + add_executable(testnative testnative.c testnativex11.c) +endif() + +add_executable(testoverlay2 testoverlay2.c testyuv_cvt.c) +add_executable(testplatform testplatform.c) +add_executable(testpower testpower.c) +add_executable(testfilesystem testfilesystem.c) +add_executable(testrendertarget testrendertarget.c) +add_executable(testscale testscale.c) +add_executable(testsem testsem.c) +add_executable(testshader testshader.c) +add_executable(testshape testshape.c) +add_executable(testsprite2 testsprite2.c) +add_executable(testspriteminimal testspriteminimal.c) +add_executable(teststreaming teststreaming.c) +add_executable(testtimer testtimer.c) +add_executable(testver testver.c) +add_executable(testviewport testviewport.c) +add_executable(testwm2 testwm2.c) +add_executable(testyuv testyuv.c testyuv_cvt.c) +add_executable(torturethread torturethread.c) +add_executable(testrendercopyex testrendercopyex.c) +add_executable(testmessage testmessage.c) +add_executable(testdisplayinfo testdisplayinfo.c) +add_executable(testqsort testqsort.c) +add_executable(testbounds testbounds.c) +add_executable(testcustomcursor testcustomcursor.c) +add_executable(controllermap controllermap.c) +add_executable(testvulkan testvulkan.c) + +# HACK: Dummy target to cause the resource files to be copied to the build directory. +# Need to make it an executable so we can use the TARGET_FILE_DIR generator expression. +# This is needed so they get copied to the correct Debug/Release subdirectory in Xcode. +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/resources_dummy.c "int main(int argc, const char **argv){ return 1; }\n") +add_executable(SDL2_test_resoureces ${CMAKE_CURRENT_BINARY_DIR}/resources_dummy.c) + +file(GLOB RESOURCE_FILES *.bmp *.wav) +foreach(RESOURCE_FILE ${RESOURCE_FILES}) + add_custom_command(TARGET SDL2_test_resoureces POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $) +endforeach(RESOURCE_FILE) + +file(COPY ${RESOURCE_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + +# TODO: Might be easier to make all targets depend on the resources...? +add_dependencies(testscale SDL2_test_resoureces) +add_dependencies(testrendercopyex SDL2_test_resoureces) +add_dependencies(controllermap SDL2_test_resoureces) +add_dependencies(testyuv SDL2_test_resoureces) +add_dependencies(testgamecontroller SDL2_test_resoureces) +add_dependencies(testshape SDL2_test_resoureces) +add_dependencies(testshader SDL2_test_resoureces) +add_dependencies(testnative SDL2_test_resoureces) +add_dependencies(testspriteminimal SDL2_test_resoureces) +add_dependencies(testautomation SDL2_test_resoureces) +add_dependencies(testcustomcursor SDL2_test_resoureces) +add_dependencies(testrendertarget SDL2_test_resoureces) +add_dependencies(testsprite2 SDL2_test_resoureces) + +add_dependencies(loopwave SDL2_test_resoureces) +add_dependencies(loopwavequeue SDL2_test_resoureces) +add_dependencies(testresample SDL2_test_resoureces) +add_dependencies(testaudiohotplug SDL2_test_resoureces) +add_dependencies(testmultiaudio SDL2_test_resoureces) diff --git a/Engine/lib/sdl/test/Makefile.in b/Engine/lib/sdl/test/Makefile.in index 68f0d3dab..bc9c24ab9 100644 --- a/Engine/lib/sdl/test/Makefile.in +++ b/Engine/lib/sdl/test/Makefile.in @@ -9,19 +9,23 @@ LIBS = @LIBS@ TARGETS = \ checkkeys$(EXE) \ + controllermap$(EXE) \ loopwave$(EXE) \ loopwavequeue$(EXE) \ testatomic$(EXE) \ - testaudioinfo$(EXE) \ testaudiocapture$(EXE) \ + testaudiohotplug$(EXE) \ + testaudioinfo$(EXE) \ testautomation$(EXE) \ testbounds$(EXE) \ testcustomcursor$(EXE) \ + testdisplayinfo$(EXE) \ testdraw2$(EXE) \ testdrawchessboard$(EXE) \ testdropfile$(EXE) \ testerror$(EXE) \ testfile$(EXE) \ + testfilesystem$(EXE) \ testgamecontroller$(EXE) \ testgesture$(EXE) \ testgl2$(EXE) \ @@ -29,26 +33,26 @@ TARGETS = \ testgles2$(EXE) \ testhaptic$(EXE) \ testhittesting$(EXE) \ - testrumble$(EXE) \ testhotplug$(EXE) \ - testthread$(EXE) \ testiconv$(EXE) \ testime$(EXE) \ testintersections$(EXE) \ - testrelative$(EXE) \ testjoystick$(EXE) \ testkeys$(EXE) \ testloadso$(EXE) \ testlock$(EXE) \ + testmessage$(EXE) \ testmultiaudio$(EXE) \ - testaudiohotplug$(EXE) \ testnative$(EXE) \ testoverlay2$(EXE) \ testplatform$(EXE) \ testpower$(EXE) \ - testfilesystem$(EXE) \ + testqsort$(EXE) \ + testrelative$(EXE) \ + testrendercopyex$(EXE) \ testrendertarget$(EXE) \ testresample$(EXE) \ + testrumble$(EXE) \ testscale$(EXE) \ testsem$(EXE) \ testshader$(EXE) \ @@ -56,18 +60,16 @@ TARGETS = \ testsprite2$(EXE) \ testspriteminimal$(EXE) \ teststreaming$(EXE) \ + testthread$(EXE) \ testtimer$(EXE) \ testver$(EXE) \ testviewport$(EXE) \ + testvulkan$(EXE) \ testwm2$(EXE) \ + testyuv$(EXE) \ torturethread$(EXE) \ - testrendercopyex$(EXE) \ - testmessage$(EXE) \ - testdisplayinfo$(EXE) \ - testqsort$(EXE) \ - controllermap$(EXE) \ -all: Makefile $(TARGETS) +all: Makefile $(TARGETS) copydatafiles Makefile: $(srcdir)/Makefile.in $(SHELL) config.status $@ @@ -217,7 +219,7 @@ endif endif endif -testoverlay2$(EXE): $(srcdir)/testoverlay2.c +testoverlay2$(EXE): $(srcdir)/testoverlay2.c $(srcdir)/testyuv_cvt.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) testplatform$(EXE): $(srcdir)/testplatform.c @@ -265,6 +267,9 @@ testviewport$(EXE): $(srcdir)/testviewport.c testwm2$(EXE): $(srcdir)/testwm2.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) +testyuv$(EXE): $(srcdir)/testyuv.c $(srcdir)/testyuv_cvt.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + torturethread$(EXE): $(srcdir)/torturethread.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) @@ -289,6 +294,9 @@ testcustomcursor$(EXE): $(srcdir)/testcustomcursor.c controllermap$(EXE): $(srcdir)/controllermap.c $(CC) -o $@ $^ $(CFLAGS) $(LIBS) +testvulkan$(EXE): $(srcdir)/testvulkan.c + $(CC) -o $@ $^ $(CFLAGS) $(LIBS) + clean: rm -f $(TARGETS) @@ -297,3 +305,20 @@ distclean: clean rm -f Makefile rm -f config.status config.cache config.log rm -rf $(srcdir)/autom4te* + + +%.bmp: $(srcdir)/%.bmp + cp $< $@ + +%.wav: $(srcdir)/%.wav + cp $< $@ + +copydatafiles: copybmpfiles copywavfiles +.PHONY : copydatafiles + +copybmpfiles: $(foreach bmp,$(wildcard $(srcdir)/*.bmp),$(notdir $(bmp))) +.PHONY : copybmpfiles + +copywavfiles: $(foreach wav,$(wildcard $(srcdir)/*.wav),$(notdir $(wav))) +.P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B8bIegoTAcB9TBUl_ESm95R^C&Z0PftfiMg}r7Gm({*h3xEX-R23sF>5giV_^Ve{tA*s^5{ zwr<^uZQHhC`}XbFv112z?%au8yLMss?%gOZF2J9Z4mj~~a06DM%;^pFhWo7ccPg7beTY%gei4Hy>{%&HDdgRH{9L;mCAjF`b>5?w;OWzI{EZZT=@k zr_$*T&JOJx*RDqNvt~mp2X}X$p00LXeo4`&Br%6BmbIGDM{qT9k#l`o*KJ_q?C$UF zLi+_ol+WJ5rhX$fH*;;SL8XYxSXY!d&EBHDv$wAYwL*v>4)n%#*-AyYfHXf}AmH-_ z5r*vOHuY#-{a6*PAVKJqI?boZXD;URh-h#)Tn?8f4CQKec~`Y%vE3;Dh(x7Q=+yew z<7NhMc|3tgEDj@rA` zgX-9J^kY z6^BW~WimO@HG+x7LQyDJ#M$Fq-^I_hZP`Gi7+MQEml<4sXjr&R9uXNuWG^aGE|Z!w z6p-KrjXS!r%T`38P#HGXCQ}GcD3;12qhl0Gl}f2p#6-%&%@E(j(FN6EdV7?q$c{>5 zT9F3i2*lEe=opnoqb1U*)u!!;xU$Q9SqjC;o|sL%P&1;|#OmXTyvFNw z8YO|mBC**yz|zgr`FlZRq0L5lD&P!vLeHYhZDT=3zUmP1VVD86AA@9 zPGEq4%Qj=DbSKD9VMwGct1~uf4}VeH2{sn!g&`cG@=F32PVZ}D>8=X*v!|9{fUjBZ zT(hiDx90iTiR|go>A7h}jU;HaTkGcCRQr{lEc}JB!34ggJ%0Hpu~P~Tb^;%*23%rRb*J;^igbAdsk=LcOm>0 sdT7V`oUF{Wc%^v8aJH|H2jibhToHP@xFE-<6wRMFnC(=N|37W}8=w12r~m)} diff --git a/Engine/lib/sdl/test/checkkeys.c b/Engine/lib/sdl/test/checkkeys.c index 771369fa3..4452acaba 100644 --- a/Engine/lib/sdl/test/checkkeys.c +++ b/Engine/lib/sdl/test/checkkeys.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -168,7 +168,19 @@ loop() PrintText("INPUT", event.text.text); break; case SDL_MOUSEBUTTONDOWN: - /* Any button press quits the app... */ + /* Left button quits the app, other buttons toggles text input */ + if (event.button.button == SDL_BUTTON_LEFT) { + done = 1; + } else { + if (SDL_IsTextInputActive()) { + SDL_Log("Stopping text input\n"); + SDL_StopTextInput(); + } else { + SDL_Log("Starting text input\n"); + SDL_StartTextInput(); + } + } + break; case SDL_QUIT: done = 1; break; diff --git a/Engine/lib/sdl/test/controllermap.c b/Engine/lib/sdl/test/controllermap.c index d626f9f89..2ca53518a 100644 --- a/Engine/lib/sdl/test/controllermap.c +++ b/Engine/lib/sdl/test/controllermap.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -32,16 +32,124 @@ #define MARKER_BUTTON 1 #define MARKER_AXIS 2 -typedef struct MappingStep +enum +{ + SDL_CONTROLLER_BINDING_AXIS_LEFTX_NEGATIVE, + SDL_CONTROLLER_BINDING_AXIS_LEFTX_POSITIVE, + SDL_CONTROLLER_BINDING_AXIS_LEFTY_NEGATIVE, + SDL_CONTROLLER_BINDING_AXIS_LEFTY_POSITIVE, + SDL_CONTROLLER_BINDING_AXIS_RIGHTX_NEGATIVE, + SDL_CONTROLLER_BINDING_AXIS_RIGHTX_POSITIVE, + SDL_CONTROLLER_BINDING_AXIS_RIGHTY_NEGATIVE, + SDL_CONTROLLER_BINDING_AXIS_RIGHTY_POSITIVE, + SDL_CONTROLLER_BINDING_AXIS_TRIGGERLEFT, + SDL_CONTROLLER_BINDING_AXIS_TRIGGERRIGHT, + SDL_CONTROLLER_BINDING_AXIS_MAX, +}; + +#define BINDING_COUNT (SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_MAX) + +static struct { int x, y; double angle; int marker; - char *field; - int axis, button, hat, hat_value; - char mapping[4096]; -}MappingStep; +} s_arrBindingDisplay[BINDING_COUNT] = { + { 387, 167, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_A */ + { 431, 132, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_B */ + { 342, 132, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_X */ + { 389, 101, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_Y */ + { 174, 132, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_BACK */ + { 233, 132, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_GUIDE */ + { 289, 132, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_START */ + { 75, 154, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_LEFTSTICK */ + { 305, 230, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_RIGHTSTICK */ + { 77, 40, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_LEFTSHOULDER */ + { 396, 36, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_RIGHTSHOULDER */ + { 154, 188, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_DPAD_UP */ + { 154, 249, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_DPAD_DOWN */ + { 116, 217, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_DPAD_LEFT */ + { 186, 217, 0.0, MARKER_BUTTON }, /* SDL_CONTROLLER_BUTTON_DPAD_RIGHT */ + { 74, 153, 270.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_LEFTX_NEGATIVE */ + { 74, 153, 90.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_LEFTX_POSITIVE */ + { 74, 153, 0.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_LEFTY_NEGATIVE */ + { 74, 153, 180.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_LEFTY_POSITIVE */ + { 306, 231, 270.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_RIGHTX_NEGATIVE */ + { 306, 231, 90.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_RIGHTX_POSITIVE */ + { 306, 231, 0.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_RIGHTY_NEGATIVE */ + { 306, 231, 180.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_RIGHTY_POSITIVE */ + { 91, -20, 180.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_TRIGGERLEFT */ + { 375, -20, 180.0, MARKER_AXIS }, /* SDL_CONTROLLER_BINDING_AXIS_TRIGGERRIGHT */ +}; + +static int s_arrBindingOrder[BINDING_COUNT] = { + SDL_CONTROLLER_BUTTON_A, + SDL_CONTROLLER_BUTTON_B, + SDL_CONTROLLER_BUTTON_Y, + SDL_CONTROLLER_BUTTON_X, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_LEFTX_NEGATIVE, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_LEFTX_POSITIVE, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_LEFTY_NEGATIVE, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_LEFTY_POSITIVE, + SDL_CONTROLLER_BUTTON_LEFTSTICK, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_RIGHTX_NEGATIVE, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_RIGHTX_POSITIVE, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_RIGHTY_NEGATIVE, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_RIGHTY_POSITIVE, + SDL_CONTROLLER_BUTTON_RIGHTSTICK, + SDL_CONTROLLER_BUTTON_LEFTSHOULDER, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_TRIGGERLEFT, + SDL_CONTROLLER_BUTTON_RIGHTSHOULDER, + SDL_CONTROLLER_BUTTON_MAX + SDL_CONTROLLER_BINDING_AXIS_TRIGGERRIGHT, + SDL_CONTROLLER_BUTTON_DPAD_UP, + SDL_CONTROLLER_BUTTON_DPAD_RIGHT, + SDL_CONTROLLER_BUTTON_DPAD_DOWN, + SDL_CONTROLLER_BUTTON_DPAD_LEFT, + SDL_CONTROLLER_BUTTON_BACK, + SDL_CONTROLLER_BUTTON_GUIDE, + SDL_CONTROLLER_BUTTON_START, +}; + +typedef struct +{ + SDL_GameControllerBindType bindType; + union + { + int button; + + struct { + int axis; + int axis_min; + int axis_max; + } axis; + + struct { + int hat; + int hat_mask; + } hat; + + } value; + + SDL_bool committed; + +} SDL_GameControllerExtendedBind; + +static SDL_GameControllerExtendedBind s_arrBindings[BINDING_COUNT]; + +typedef struct +{ + SDL_bool m_bMoving; + int m_nStartingValue; + int m_nFarthestValue; +} AxisState; + +static int s_nNumAxes; +static AxisState *s_arrAxisState; + +static int s_iCurrentBinding; +static Uint32 s_unPendingAdvanceTime; +static SDL_bool s_bBindingComplete; SDL_Texture * LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) @@ -60,23 +168,6 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) if (transparent) { if (temp->format->palette) { SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *) temp->pixels); - } else { - switch (temp->format->BitsPerPixel) { - case 15: - SDL_SetColorKey(temp, SDL_TRUE, - (*(Uint16 *) temp->pixels) & 0x00007FFF); - break; - case 16: - SDL_SetColorKey(temp, SDL_TRUE, *(Uint16 *) temp->pixels); - break; - case 24: - SDL_SetColorKey(temp, SDL_TRUE, - (*(Uint32 *) temp->pixels) & 0x00FFFFFF); - break; - case 32: - SDL_SetColorKey(temp, SDL_TRUE, *(Uint32 *) temp->pixels); - break; - } } } @@ -93,45 +184,186 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) return texture; } +static int +StandardizeAxisValue(int nValue) +{ + if (nValue > SDL_JOYSTICK_AXIS_MAX/2) { + return SDL_JOYSTICK_AXIS_MAX; + } else if (nValue < SDL_JOYSTICK_AXIS_MIN/2) { + return SDL_JOYSTICK_AXIS_MIN; + } else { + return 0; + } +} + +static void +SetCurrentBinding(int iBinding) +{ + int iIndex; + SDL_GameControllerExtendedBind *pBinding; + + if (iBinding < 0) { + return; + } + + if (iBinding == BINDING_COUNT) { + s_bBindingComplete = SDL_TRUE; + return; + } + + s_iCurrentBinding = iBinding; + + pBinding = &s_arrBindings[s_arrBindingOrder[s_iCurrentBinding]]; + SDL_zerop(pBinding); + + for (iIndex = 0; iIndex < s_nNumAxes; ++iIndex) { + s_arrAxisState[iIndex].m_nFarthestValue = s_arrAxisState[iIndex].m_nStartingValue; + } + + s_unPendingAdvanceTime = 0; +} + static SDL_bool +BBindingContainsBinding(const SDL_GameControllerExtendedBind *pBindingA, const SDL_GameControllerExtendedBind *pBindingB) +{ + if (pBindingA->bindType != pBindingB->bindType) + { + return SDL_FALSE; + } + switch (pBindingA->bindType) + { + case SDL_CONTROLLER_BINDTYPE_AXIS: + if (pBindingA->value.axis.axis != pBindingB->value.axis.axis) { + return SDL_FALSE; + } + if (!pBindingA->committed) { + return SDL_FALSE; + } + { + int minA = SDL_min(pBindingA->value.axis.axis_min, pBindingA->value.axis.axis_max); + int maxA = SDL_max(pBindingA->value.axis.axis_min, pBindingA->value.axis.axis_max); + int minB = SDL_min(pBindingB->value.axis.axis_min, pBindingB->value.axis.axis_max); + int maxB = SDL_max(pBindingB->value.axis.axis_min, pBindingB->value.axis.axis_max); + return (minA <= minB && maxA >= maxB); + } + /* Not reached */ + default: + return SDL_memcmp(pBindingA, pBindingB, sizeof(*pBindingA)) == 0; + } +} + +static void +ConfigureBinding(const SDL_GameControllerExtendedBind *pBinding) +{ + SDL_GameControllerExtendedBind *pCurrent; + int iIndex; + int iCurrentElement = s_arrBindingOrder[s_iCurrentBinding]; + + /* Do we already have this binding? */ + for (iIndex = 0; iIndex < SDL_arraysize(s_arrBindings); ++iIndex) { + pCurrent = &s_arrBindings[iIndex]; + if (BBindingContainsBinding(pCurrent, pBinding)) { + if (iIndex == SDL_CONTROLLER_BUTTON_A && iCurrentElement != SDL_CONTROLLER_BUTTON_B) { + /* Skip to the next binding */ + SetCurrentBinding(s_iCurrentBinding + 1); + return; + } + + if (iIndex == SDL_CONTROLLER_BUTTON_B) { + /* Go back to the previous binding */ + SetCurrentBinding(s_iCurrentBinding - 1); + return; + } + + /* Already have this binding, ignore it */ + return; + } + } + +#ifdef DEBUG_CONTROLLERMAP + switch ( pBinding->bindType ) + { + case SDL_CONTROLLER_BINDTYPE_NONE: + break; + case SDL_CONTROLLER_BINDTYPE_BUTTON: + SDL_Log("Configuring button binding for button %d\n", pBinding->value.button); + break; + case SDL_CONTROLLER_BINDTYPE_AXIS: + SDL_Log("Configuring axis binding for axis %d %d/%d committed = %s\n", pBinding->value.axis.axis, pBinding->value.axis.axis_min, pBinding->value.axis.axis_max, pBinding->committed ? "true" : "false"); + break; + case SDL_CONTROLLER_BINDTYPE_HAT: + SDL_Log("Configuring hat binding for hat %d %d\n", pBinding->value.hat.hat, pBinding->value.hat.hat_mask); + break; + } +#endif /* DEBUG_CONTROLLERMAP */ + + /* Should the new binding override the existing one? */ + pCurrent = &s_arrBindings[iCurrentElement]; + if (pCurrent->bindType != SDL_CONTROLLER_BINDTYPE_NONE) { + SDL_bool bNativeDPad, bCurrentDPad; + SDL_bool bNativeAxis, bCurrentAxis; + + bNativeDPad = (iCurrentElement == SDL_CONTROLLER_BUTTON_DPAD_UP || + iCurrentElement == SDL_CONTROLLER_BUTTON_DPAD_DOWN || + iCurrentElement == SDL_CONTROLLER_BUTTON_DPAD_LEFT || + iCurrentElement == SDL_CONTROLLER_BUTTON_DPAD_RIGHT); + bCurrentDPad = (pCurrent->bindType == SDL_CONTROLLER_BINDTYPE_HAT); + if (bNativeDPad && bCurrentDPad) { + /* We already have a binding of the type we want, ignore the new one */ + return; + } + + bNativeAxis = (iCurrentElement >= SDL_CONTROLLER_BUTTON_MAX); + bCurrentAxis = (pCurrent->bindType == SDL_CONTROLLER_BINDTYPE_AXIS); + if (bNativeAxis == bCurrentAxis && + (pBinding->bindType != SDL_CONTROLLER_BINDTYPE_AXIS || + pBinding->value.axis.axis != pCurrent->value.axis.axis)) { + /* We already have a binding of the type we want, ignore the new one */ + return; + } + } + + *pCurrent = *pBinding; + + if (pBinding->committed) { + s_unPendingAdvanceTime = SDL_GetTicks(); + } else { + s_unPendingAdvanceTime = 0; + } +} + +static SDL_bool +BMergeAxisBindings(int iIndex) +{ + SDL_GameControllerExtendedBind *pBindingA = &s_arrBindings[iIndex]; + SDL_GameControllerExtendedBind *pBindingB = &s_arrBindings[iIndex+1]; + if (pBindingA->bindType == SDL_CONTROLLER_BINDTYPE_AXIS && + pBindingB->bindType == SDL_CONTROLLER_BINDTYPE_AXIS && + pBindingA->value.axis.axis == pBindingB->value.axis.axis) { + if (pBindingA->value.axis.axis_min == pBindingB->value.axis.axis_min) { + pBindingA->value.axis.axis_min = pBindingA->value.axis.axis_max; + pBindingA->value.axis.axis_max = pBindingB->value.axis.axis_max; + pBindingB->bindType = SDL_CONTROLLER_BINDTYPE_NONE; + return SDL_TRUE; + } + } + return SDL_FALSE; +} + +static void WatchJoystick(SDL_Joystick * joystick) { SDL_Window *window = NULL; SDL_Renderer *screen = NULL; SDL_Texture *background, *button, *axis, *marker; const char *name = NULL; - SDL_bool retval = SDL_FALSE; - SDL_bool done = SDL_FALSE, next=SDL_FALSE; + SDL_bool done = SDL_FALSE; SDL_Event event; SDL_Rect dst; - int s, _s; Uint8 alpha=200, alpha_step = -1; Uint32 alpha_ticks = 0; - char mapping[4096], temp[4096]; - MappingStep *step, *prev_step; - MappingStep steps[] = { - {342, 132, 0.0, MARKER_BUTTON, "x", -1, -1, -1, -1, ""}, - {387, 167, 0.0, MARKER_BUTTON, "a", -1, -1, -1, -1, ""}, - {431, 132, 0.0, MARKER_BUTTON, "b", -1, -1, -1, -1, ""}, - {389, 101, 0.0, MARKER_BUTTON, "y", -1, -1, -1, -1, ""}, - {174, 132, 0.0, MARKER_BUTTON, "back", -1, -1, -1, -1, ""}, - {233, 132, 0.0, MARKER_BUTTON, "guide", -1, -1, -1, -1, ""}, - {289, 132, 0.0, MARKER_BUTTON, "start", -1, -1, -1, -1, ""}, - {116, 217, 0.0, MARKER_BUTTON, "dpleft", -1, -1, -1, -1, ""}, - {154, 249, 0.0, MARKER_BUTTON, "dpdown", -1, -1, -1, -1, ""}, - {186, 217, 0.0, MARKER_BUTTON, "dpright", -1, -1, -1, -1, ""}, - {154, 188, 0.0, MARKER_BUTTON, "dpup", -1, -1, -1, -1, ""}, - {77, 40, 0.0, MARKER_BUTTON, "leftshoulder", -1, -1, -1, -1, ""}, - {91, 0, 0.0, MARKER_BUTTON, "lefttrigger", -1, -1, -1, -1, ""}, - {396, 36, 0.0, MARKER_BUTTON, "rightshoulder", -1, -1, -1, -1, ""}, - {375, 0, 0.0, MARKER_BUTTON, "righttrigger", -1, -1, -1, -1, ""}, - {75, 154, 0.0, MARKER_BUTTON, "leftstick", -1, -1, -1, -1, ""}, - {305, 230, 0.0, MARKER_BUTTON, "rightstick", -1, -1, -1, -1, ""}, - {75, 154, 0.0, MARKER_AXIS, "leftx", -1, -1, -1, -1, ""}, - {75, 154, 90.0, MARKER_AXIS, "lefty", -1, -1, -1, -1, ""}, - {305, 230, 0.0, MARKER_AXIS, "rightx", -1, -1, -1, -1, ""}, - {305, 230, 90.0, MARKER_AXIS, "righty", -1, -1, -1, -1, ""}, - }; + SDL_JoystickID nJoystickID; + int iIndex; /* Create a window to display joystick axis position */ window = SDL_CreateWindow("Game Controller Map", SDL_WINDOWPOS_CENTERED, @@ -139,14 +371,14 @@ WatchJoystick(SDL_Joystick * joystick) SCREEN_HEIGHT, 0); if (window == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); - return SDL_FALSE; + return; } screen = SDL_CreateRenderer(window, -1, 0); if (screen == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); SDL_DestroyWindow(window); - return SDL_FALSE; + return; } background = LoadTexture(screen, "controllermap.bmp", SDL_FALSE); @@ -173,23 +405,24 @@ WatchJoystick(SDL_Joystick * joystick) To skip a button, press SPACE or click/touch the screen\n\ To exit, press ESC\n\ ====================================================================================\n"); - - /* Initialize mapping with GUID and name */ - SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick), temp, SDL_arraysize(temp)); - SDL_snprintf(mapping, SDL_arraysize(mapping), "%s,%s,platform:%s,", - temp, name ? name : "Unknown Joystick", SDL_GetPlatform()); + + nJoystickID = SDL_JoystickInstanceID(joystick); + + s_nNumAxes = SDL_JoystickNumAxes(joystick); + s_arrAxisState = (AxisState *)SDL_calloc(s_nNumAxes, sizeof(*s_arrAxisState)); + for (iIndex = 0; iIndex < s_nNumAxes; ++iIndex) { + AxisState *pAxisState = &s_arrAxisState[iIndex]; + Sint16 nInitialValue; + pAxisState->m_bMoving = SDL_JoystickGetAxisInitialState(joystick, iIndex, &nInitialValue); + pAxisState->m_nStartingValue = nInitialValue; + pAxisState->m_nFarthestValue = nInitialValue; + } /* Loop, getting joystick events! */ - for(s=0; smapping, mapping, SDL_arraysize(step->mapping)); - step->axis = -1; - step->button = -1; - step->hat = -1; - step->hat_value = -1; - - switch(step->marker) { + while (!done && !s_bBindingComplete) { + int iElement = s_arrBindingOrder[s_iCurrentBinding]; + + switch (s_arrBindingDisplay[iElement].marker) { case MARKER_AXIS: marker = axis; break; @@ -200,137 +433,271 @@ WatchJoystick(SDL_Joystick * joystick) break; } - dst.x = step->x; - dst.y = step->y; + dst.x = s_arrBindingDisplay[iElement].x; + dst.y = s_arrBindingDisplay[iElement].y; SDL_QueryTexture(marker, NULL, NULL, &dst.w, &dst.h); - next=SDL_FALSE; - SDL_SetRenderDrawColor(screen, 0xFF, 0xFF, 0xFF, SDL_ALPHA_OPAQUE); - - while (!done && !next) { - if (SDL_GetTicks() - alpha_ticks > 5) { - alpha_ticks = SDL_GetTicks(); - alpha += alpha_step; - if (alpha == 255) { - alpha_step = -1; - } - if (alpha < 128) { - alpha_step = 1; - } + if (SDL_GetTicks() - alpha_ticks > 5) { + alpha_ticks = SDL_GetTicks(); + alpha += alpha_step; + if (alpha == 255) { + alpha_step = -1; } - - SDL_RenderClear(screen); - SDL_RenderCopy(screen, background, NULL, NULL); - SDL_SetTextureAlphaMod(marker, alpha); - SDL_SetTextureColorMod(marker, 10, 255, 21); - SDL_RenderCopyEx(screen, marker, NULL, &dst, step->angle, NULL, SDL_FLIP_NONE); - SDL_RenderPresent(screen); - - if (SDL_PollEvent(&event)) { - switch (event.type) { - case SDL_JOYAXISMOTION: - if ((event.jaxis.value > 20000 || event.jaxis.value < -20000) && event.jaxis.value != -32768) { - for (_s = 0; _s < s; _s++) { - if (steps[_s].axis == event.jaxis.axis) { - break; - } - } - if (_s == s) { - step->axis = event.jaxis.axis; - SDL_strlcat(mapping, step->field, SDL_arraysize(mapping)); - SDL_snprintf(temp, SDL_arraysize(temp), ":a%u,", event.jaxis.axis); - SDL_strlcat(mapping, temp, SDL_arraysize(mapping)); - s++; - next=SDL_TRUE; - } - } - - break; - case SDL_JOYHATMOTION: - if (event.jhat.value == SDL_HAT_CENTERED) { - break; /* ignore centering, we're probably just coming back to the center from the previous item we set. */ - } - for (_s = 0; _s < s; _s++) { - if (steps[_s].hat == event.jhat.hat && steps[_s].hat_value == event.jhat.value) { - break; - } - } - if (_s == s) { - step->hat = event.jhat.hat; - step->hat_value = event.jhat.value; - SDL_strlcat(mapping, step->field, SDL_arraysize(mapping)); - SDL_snprintf(temp, SDL_arraysize(temp), ":h%u.%u,", event.jhat.hat, event.jhat.value ); - SDL_strlcat(mapping, temp, SDL_arraysize(mapping)); - s++; - next=SDL_TRUE; - } - break; - case SDL_JOYBALLMOTION: - break; - case SDL_JOYBUTTONUP: - for (_s = 0; _s < s; _s++) { - if (steps[_s].button == event.jbutton.button) { - break; - } - } - if (_s == s) { - step->button = event.jbutton.button; - SDL_strlcat(mapping, step->field, SDL_arraysize(mapping)); - SDL_snprintf(temp, SDL_arraysize(temp), ":b%u,", event.jbutton.button); - SDL_strlcat(mapping, temp, SDL_arraysize(mapping)); - s++; - next=SDL_TRUE; - } - break; - case SDL_FINGERDOWN: - case SDL_MOUSEBUTTONDOWN: - /* Skip this step */ - s++; - next=SDL_TRUE; - break; - case SDL_KEYDOWN: - if (event.key.keysym.sym == SDLK_BACKSPACE || event.key.keysym.sym == SDLK_AC_BACK) { - /* Undo! */ - if (s > 0) { - prev_step = &steps[--s]; - SDL_strlcpy(mapping, prev_step->mapping, SDL_arraysize(prev_step->mapping)); - next = SDL_TRUE; - } - break; - } - if (event.key.keysym.sym == SDLK_SPACE) { - /* Skip this step */ - s++; - next=SDL_TRUE; - break; - } - - if ((event.key.keysym.sym != SDLK_ESCAPE)) { - break; - } - /* Fall through to signal quit */ - case SDL_QUIT: - done = SDL_TRUE; - break; - default: - break; - } + if (alpha < 128) { + alpha_step = 1; } } + SDL_SetRenderDrawColor(screen, 0xFF, 0xFF, 0xFF, SDL_ALPHA_OPAQUE); + SDL_RenderClear(screen); + SDL_RenderCopy(screen, background, NULL, NULL); + SDL_SetTextureAlphaMod(marker, alpha); + SDL_SetTextureColorMod(marker, 10, 255, 21); + SDL_RenderCopyEx(screen, marker, NULL, &dst, s_arrBindingDisplay[iElement].angle, NULL, SDL_FLIP_NONE); + SDL_RenderPresent(screen); + + while (SDL_PollEvent(&event) > 0) { + switch (event.type) { + case SDL_JOYDEVICEREMOVED: + if (event.jaxis.which == nJoystickID) { + done = SDL_TRUE; + } + break; + case SDL_JOYAXISMOTION: + if (event.jaxis.which == nJoystickID) { + AxisState *pAxisState = &s_arrAxisState[event.jaxis.axis]; + int nValue = event.jaxis.value; + int nCurrentDistance, nFarthestDistance; + if (!pAxisState->m_bMoving) { + pAxisState->m_bMoving = SDL_TRUE; + pAxisState->m_nStartingValue = nValue; + pAxisState->m_nFarthestValue = nValue; + } + nCurrentDistance = SDL_abs(nValue - pAxisState->m_nStartingValue); + nFarthestDistance = SDL_abs(pAxisState->m_nFarthestValue - pAxisState->m_nStartingValue); + if (nCurrentDistance > nFarthestDistance) { + pAxisState->m_nFarthestValue = nValue; + nFarthestDistance = SDL_abs(pAxisState->m_nFarthestValue - pAxisState->m_nStartingValue); + } + +#ifdef DEBUG_CONTROLLERMAP + SDL_Log("AXIS %d nValue %d nCurrentDistance %d nFarthestDistance %d\n", event.jaxis.axis, nValue, nCurrentDistance, nFarthestDistance); +#endif + if (nFarthestDistance >= 16000) { + /* If we've gone out far enough and started to come back, let's bind this axis */ + SDL_bool bCommitBinding = (nCurrentDistance <= 10000) ? SDL_TRUE : SDL_FALSE; + SDL_GameControllerExtendedBind binding; + SDL_zero(binding); + binding.bindType = SDL_CONTROLLER_BINDTYPE_AXIS; + binding.value.axis.axis = event.jaxis.axis; + binding.value.axis.axis_min = StandardizeAxisValue(pAxisState->m_nStartingValue); + binding.value.axis.axis_max = StandardizeAxisValue(pAxisState->m_nFarthestValue); + binding.committed = bCommitBinding; + ConfigureBinding(&binding); + } + } + break; + case SDL_JOYHATMOTION: + if (event.jhat.which == nJoystickID) { + if (event.jhat.value != SDL_HAT_CENTERED) { + SDL_GameControllerExtendedBind binding; + +#ifdef DEBUG_CONTROLLERMAP + SDL_Log("HAT %d %d\n", event.jhat.hat, event.jhat.value); +#endif + SDL_zero(binding); + binding.bindType = SDL_CONTROLLER_BINDTYPE_HAT; + binding.value.hat.hat = event.jhat.hat; + binding.value.hat.hat_mask = event.jhat.value; + binding.committed = SDL_TRUE; + ConfigureBinding(&binding); + } + } + break; + case SDL_JOYBALLMOTION: + break; + case SDL_JOYBUTTONDOWN: + if (event.jbutton.which == nJoystickID) { + SDL_GameControllerExtendedBind binding; + +#ifdef DEBUG_CONTROLLERMAP + SDL_Log("BUTTON %d\n", event.jbutton.button); +#endif + SDL_zero(binding); + binding.bindType = SDL_CONTROLLER_BINDTYPE_BUTTON; + binding.value.button = event.jbutton.button; + binding.committed = SDL_TRUE; + ConfigureBinding(&binding); + } + break; + case SDL_FINGERDOWN: + case SDL_MOUSEBUTTONDOWN: + /* Skip this step */ + SetCurrentBinding(s_iCurrentBinding + 1); + break; + case SDL_KEYDOWN: + if (event.key.keysym.sym == SDLK_BACKSPACE || event.key.keysym.sym == SDLK_AC_BACK) { + SetCurrentBinding(s_iCurrentBinding - 1); + break; + } + if (event.key.keysym.sym == SDLK_SPACE) { + SetCurrentBinding(s_iCurrentBinding + 1); + break; + } + + if ((event.key.keysym.sym != SDLK_ESCAPE)) { + break; + } + /* Fall through to signal quit */ + case SDL_QUIT: + done = SDL_TRUE; + break; + default: + break; + } + } + + SDL_Delay(15); + + /* Wait 100 ms for joystick events to stop coming in, + in case a controller sends multiple events for a single control (e.g. axis and button for trigger) + */ + if (s_unPendingAdvanceTime && SDL_GetTicks() - s_unPendingAdvanceTime >= 100) { + SetCurrentBinding(s_iCurrentBinding + 1); + } } - if (s == SDL_arraysize(steps) ) { + if (s_bBindingComplete) { + char mapping[1024]; + char trimmed_name[128]; + char *spot; + int iIndex; + char pszElement[12]; + + SDL_strlcpy(trimmed_name, name, SDL_arraysize(trimmed_name)); + while (SDL_isspace(trimmed_name[0])) { + SDL_memmove(&trimmed_name[0], &trimmed_name[1], SDL_strlen(trimmed_name)); + } + while (trimmed_name[0] && SDL_isspace(trimmed_name[SDL_strlen(trimmed_name) - 1])) { + trimmed_name[SDL_strlen(trimmed_name) - 1] = '\0'; + } + while ((spot = SDL_strchr(trimmed_name, ',')) != NULL) { + SDL_memmove(spot, spot + 1, SDL_strlen(spot)); + } + + /* Initialize mapping with GUID and name */ + SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick), mapping, SDL_arraysize(mapping)); + SDL_strlcat(mapping, ",", SDL_arraysize(mapping)); + SDL_strlcat(mapping, trimmed_name, SDL_arraysize(mapping)); + SDL_strlcat(mapping, ",", SDL_arraysize(mapping)); + SDL_strlcat(mapping, "platform:", SDL_arraysize(mapping)); + SDL_strlcat(mapping, SDL_GetPlatform(), SDL_arraysize(mapping)); + SDL_strlcat(mapping, ",", SDL_arraysize(mapping)); + + for (iIndex = 0; iIndex < SDL_arraysize(s_arrBindings); ++iIndex) { + SDL_GameControllerExtendedBind *pBinding = &s_arrBindings[iIndex]; + if (pBinding->bindType == SDL_CONTROLLER_BINDTYPE_NONE) { + continue; + } + + if (iIndex < SDL_CONTROLLER_BUTTON_MAX) { + SDL_GameControllerButton eButton = (SDL_GameControllerButton)iIndex; + SDL_strlcat(mapping, SDL_GameControllerGetStringForButton(eButton), SDL_arraysize(mapping)); + } else { + const char *pszAxisName; + switch (iIndex - SDL_CONTROLLER_BUTTON_MAX) { + case SDL_CONTROLLER_BINDING_AXIS_LEFTX_NEGATIVE: + if (!BMergeAxisBindings(iIndex)) { + SDL_strlcat(mapping, "-", SDL_arraysize(mapping)); + } + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_LEFTX); + break; + case SDL_CONTROLLER_BINDING_AXIS_LEFTX_POSITIVE: + SDL_strlcat(mapping, "+", SDL_arraysize(mapping)); + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_LEFTX); + break; + case SDL_CONTROLLER_BINDING_AXIS_LEFTY_NEGATIVE: + if (!BMergeAxisBindings(iIndex)) { + SDL_strlcat(mapping, "-", SDL_arraysize(mapping)); + } + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_LEFTY); + break; + case SDL_CONTROLLER_BINDING_AXIS_LEFTY_POSITIVE: + SDL_strlcat(mapping, "+", SDL_arraysize(mapping)); + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_LEFTY); + break; + case SDL_CONTROLLER_BINDING_AXIS_RIGHTX_NEGATIVE: + if (!BMergeAxisBindings(iIndex)) { + SDL_strlcat(mapping, "-", SDL_arraysize(mapping)); + } + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_RIGHTX); + break; + case SDL_CONTROLLER_BINDING_AXIS_RIGHTX_POSITIVE: + SDL_strlcat(mapping, "+", SDL_arraysize(mapping)); + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_RIGHTX); + break; + case SDL_CONTROLLER_BINDING_AXIS_RIGHTY_NEGATIVE: + if (!BMergeAxisBindings(iIndex)) { + SDL_strlcat(mapping, "-", SDL_arraysize(mapping)); + } + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_RIGHTY); + break; + case SDL_CONTROLLER_BINDING_AXIS_RIGHTY_POSITIVE: + SDL_strlcat(mapping, "+", SDL_arraysize(mapping)); + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_RIGHTY); + break; + case SDL_CONTROLLER_BINDING_AXIS_TRIGGERLEFT: + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_TRIGGERLEFT); + break; + case SDL_CONTROLLER_BINDING_AXIS_TRIGGERRIGHT: + pszAxisName = SDL_GameControllerGetStringForAxis(SDL_CONTROLLER_AXIS_TRIGGERRIGHT); + break; + } + SDL_strlcat(mapping, pszAxisName, SDL_arraysize(mapping)); + } + SDL_strlcat(mapping, ":", SDL_arraysize(mapping)); + + pszElement[0] = '\0'; + switch (pBinding->bindType) { + case SDL_CONTROLLER_BINDTYPE_BUTTON: + SDL_snprintf(pszElement, sizeof(pszElement), "b%d", pBinding->value.button); + break; + case SDL_CONTROLLER_BINDTYPE_AXIS: + if (pBinding->value.axis.axis_min == 0 && pBinding->value.axis.axis_max == SDL_JOYSTICK_AXIS_MIN) { + /* The negative half axis */ + SDL_snprintf(pszElement, sizeof(pszElement), "-a%d", pBinding->value.axis.axis); + } else if (pBinding->value.axis.axis_min == 0 && pBinding->value.axis.axis_max == SDL_JOYSTICK_AXIS_MAX) { + /* The positive half axis */ + SDL_snprintf(pszElement, sizeof(pszElement), "+a%d", pBinding->value.axis.axis); + } else { + SDL_snprintf(pszElement, sizeof(pszElement), "a%d", pBinding->value.axis.axis); + if (pBinding->value.axis.axis_min > pBinding->value.axis.axis_max) { + /* Invert the axis */ + SDL_strlcat(pszElement, "~", SDL_arraysize(pszElement)); + } + } + break; + case SDL_CONTROLLER_BINDTYPE_HAT: + SDL_snprintf(pszElement, sizeof(pszElement), "h%d.%d", pBinding->value.hat.hat, pBinding->value.hat.hat_mask); + break; + default: + SDL_assert(!"Unknown bind type"); + break; + } + SDL_strlcat(mapping, pszElement, SDL_arraysize(mapping)); + SDL_strlcat(mapping, ",", SDL_arraysize(mapping)); + } + SDL_Log("Mapping:\n\n%s\n\n", mapping); /* Print to stdout as well so the user can cat the output somewhere */ printf("%s\n", mapping); } - - while(SDL_PollEvent(&event)) {}; + + SDL_free(s_arrAxisState); + s_arrAxisState = NULL; SDL_DestroyRenderer(screen); SDL_DestroyWindow(window); - return retval; } int @@ -368,6 +735,7 @@ main(int argc, char *argv[]) SDL_Log(" buttons: %d\n", SDL_JoystickNumButtons(joystick)); SDL_Log("instance id: %d\n", SDL_JoystickInstanceID(joystick)); SDL_Log(" guid: %s\n", guid); + SDL_Log(" VID/PID: 0x%.4x/0x%.4x\n", SDL_JoystickGetVendor(joystick), SDL_JoystickGetProduct(joystick)); SDL_JoystickClose(joystick); } } @@ -377,9 +745,6 @@ main(int argc, char *argv[]) #else if (argv[1]) { #endif - SDL_bool reportederror = SDL_FALSE; - SDL_bool keepGoing = SDL_TRUE; - SDL_Event event; int device; #ifdef __ANDROID__ device = 0; @@ -387,34 +752,11 @@ main(int argc, char *argv[]) device = atoi(argv[1]); #endif joystick = SDL_JoystickOpen(device); - - while ( keepGoing ) { - if (joystick == NULL) { - if ( !reportederror ) { - SDL_Log("Couldn't open joystick %d: %s\n", device, SDL_GetError()); - keepGoing = SDL_FALSE; - reportederror = SDL_TRUE; - } - } else { - reportederror = SDL_FALSE; - keepGoing = WatchJoystick(joystick); - SDL_JoystickClose(joystick); - } - - joystick = NULL; - if (keepGoing) { - SDL_Log("Waiting for attach\n"); - } - while (keepGoing) { - SDL_WaitEvent(&event); - if ((event.type == SDL_QUIT) || (event.type == SDL_FINGERDOWN) - || (event.type == SDL_MOUSEBUTTONDOWN)) { - keepGoing = SDL_FALSE; - } else if (event.type == SDL_JOYDEVICEADDED) { - joystick = SDL_JoystickOpen(device); - break; - } - } + if (joystick == NULL) { + SDL_Log("Couldn't open joystick %d: %s\n", device, SDL_GetError()); + } else { + WatchJoystick(joystick); + SDL_JoystickClose(joystick); } } else { @@ -435,3 +777,5 @@ main(int argc, char *argv[]) } #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/test/loopwave.c b/Engine/lib/sdl/test/loopwave.c index ec9f52819..88d8fc871 100644 --- a/Engine/lib/sdl/test/loopwave.c +++ b/Engine/lib/sdl/test/loopwave.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,17 +20,13 @@ #include #include -#if HAVE_SIGNAL_H -#include -#endif - #ifdef __EMSCRIPTEN__ #include #endif #include "SDL.h" -struct +static struct { SDL_AudioSpec spec; Uint8 *sound; /* Pointer to wave data */ @@ -38,6 +34,7 @@ struct int soundpos; /* Current play position */ } wave; +static SDL_AudioDeviceID device; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -47,6 +44,37 @@ quit(int rc) exit(rc); } +static void +close_audio() +{ + if (device != 0) { + SDL_CloseAudioDevice(device); + device = 0; + } +} + +static void +open_audio() +{ + /* Initialize fillerup() variables */ + device = SDL_OpenAudioDevice(NULL, SDL_FALSE, &wave.spec, NULL, 0); + if (!device) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError()); + SDL_FreeWAV(wave.sound); + quit(2); + } + + + /* Let the audio run */ + SDL_PauseAudioDevice(device, SDL_FALSE); +} + +static void reopen_audio() +{ + close_audio(); + open_audio(); +} + void SDLCALL fillerup(void *unused, Uint8 * stream, int len) @@ -72,17 +100,12 @@ fillerup(void *unused, Uint8 * stream, int len) } static int done = 0; -void -poked(int sig) -{ - done = 1; -} #ifdef __EMSCRIPTEN__ void loop() { - if(done || (SDL_GetAudioStatus() != SDL_AUDIO_PLAYING)) + if(done || (SDL_GetAudioDeviceStatus(device) != SDL_AUDIO_PLAYING)) emscripten_cancel_main_loop(); } #endif @@ -97,7 +120,7 @@ main(int argc, char *argv[]) SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); /* Load the SDL library */ - if (SDL_Init(SDL_INIT_AUDIO) < 0) { + if (SDL_Init(SDL_INIT_AUDIO|SDL_INIT_EVENTS) < 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError()); return (1); } @@ -114,17 +137,6 @@ main(int argc, char *argv[]) } wave.spec.callback = fillerup; -#if HAVE_SIGNAL_H - /* Set the signals */ -#ifdef SIGHUP - signal(SIGHUP, poked); -#endif - signal(SIGINT, poked); -#ifdef SIGQUIT - signal(SIGQUIT, poked); -#endif - signal(SIGTERM, poked); -#endif /* HAVE_SIGNAL_H */ /* Show the list of available drivers */ SDL_Log("Available audio drivers:"); @@ -132,27 +144,33 @@ main(int argc, char *argv[]) SDL_Log("%i: %s", i, SDL_GetAudioDriver(i)); } - /* Initialize fillerup() variables */ - if (SDL_OpenAudio(&wave.spec, NULL) < 0) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't open audio: %s\n", SDL_GetError()); - SDL_FreeWAV(wave.sound); - quit(2); - } - SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver()); - /* Let the audio run */ - SDL_PauseAudio(0); + open_audio(); + + SDL_FlushEvents(SDL_AUDIODEVICEADDED, SDL_AUDIODEVICEREMOVED); #ifdef __EMSCRIPTEN__ emscripten_set_main_loop(loop, 0, 1); #else - while (!done && (SDL_GetAudioStatus() == SDL_AUDIO_PLAYING)) - SDL_Delay(1000); + while (!done) { + SDL_Event event; + + while (SDL_PollEvent(&event) > 0) { + if (event.type == SDL_QUIT) { + done = 1; + } + if ((event.type == SDL_AUDIODEVICEADDED && !event.adevice.iscapture) || + (event.type == SDL_AUDIODEVICEREMOVED && !event.adevice.iscapture && event.adevice.which == device)) { + reopen_audio(); + } + } + SDL_Delay(100); + } #endif /* Clean up on signal */ - SDL_CloseAudio(); + close_audio(); SDL_FreeWAV(wave.sound); SDL_Quit(); return (0); diff --git a/Engine/lib/sdl/test/loopwavequeue.c b/Engine/lib/sdl/test/loopwavequeue.c index 85f5bd579..3f0a69e15 100644 --- a/Engine/lib/sdl/test/loopwavequeue.c +++ b/Engine/lib/sdl/test/loopwavequeue.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,12 +25,11 @@ #include #endif -struct +static struct { SDL_AudioSpec spec; Uint8 *sound; /* Pointer to wave data */ Uint32 soundlen; /* Length of wave data */ - int soundpos; /* Current play position */ } wave; diff --git a/Engine/lib/sdl/test/nacl/common.js b/Engine/lib/sdl/test/nacl/common.js index a108fad32..a70001551 100644 --- a/Engine/lib/sdl/test/nacl/common.js +++ b/Engine/lib/sdl/test/nacl/common.js @@ -39,7 +39,7 @@ var common = (function() { mimetype = 'application/x-ppapi-release'; else mimetype = 'application/x-ppapi-debug'; - } else if (tool == 'pnacl' && isRelease) { + } else if (tool == 'pnacl') { mimetype = 'application/x-pnacl'; } return mimetype; @@ -147,6 +147,11 @@ var common = (function() { var listenerDiv = document.getElementById('listener'); listenerDiv.appendChild(moduleEl); + // Request the offsetTop property to force a relayout. As of Apr 10, 2014 + // this is needed if the module is being loaded on a Chrome App's + // background page (see crbug.com/350445). + moduleEl.offsetTop; + // Host plugins don't send a moduleDidLoad message. We'll fake it here. var isHost = isHostToolchain(tool); if (isHost) { diff --git a/Engine/lib/sdl/test/testatomic.c b/Engine/lib/sdl/test/testatomic.c index d371ef31f..6af9d4bf6 100644 --- a/Engine/lib/sdl/test/testatomic.c +++ b/Engine/lib/sdl/test/testatomic.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -103,7 +103,10 @@ void RunBasicTest() #define NInter (CountTo/CountInc/NThreads) #define Expect (CountTo-NInter*CountInc*NThreads) -SDL_COMPILE_TIME_ASSERT(size, CountTo>0); /* check for rollover */ +enum { + CountTo_GreaterThanZero = CountTo > 0, +}; +SDL_COMPILE_TIME_ASSERT(size, CountTo_GreaterThanZero); /* check for rollover */ static SDL_atomic_t good = { 42 }; @@ -114,7 +117,7 @@ static SDL_atomic_t threadsRunning; static SDL_sem *threadDone; static -int adder(void* junk) +int SDLCALL adder(void* junk) { unsigned long N=NInter; SDL_Log("Thread subtracting %d %lu times\n",CountInc,N); @@ -492,7 +495,7 @@ typedef struct char padding[SDL_CACHELINE_SIZE-(sizeof(SDL_EventQueue*)+sizeof(int)*NUM_WRITERS+sizeof(int)+sizeof(SDL_bool))%SDL_CACHELINE_SIZE]; } ReaderData; -static int FIFO_Writer(void* _data) +static int SDLCALL FIFO_Writer(void* _data) { WriterData *data = (WriterData *)_data; SDL_EventQueue *queue = data->queue; @@ -527,7 +530,7 @@ static int FIFO_Writer(void* _data) return 0; } -static int FIFO_Reader(void* _data) +static int SDLCALL FIFO_Reader(void* _data) { ReaderData *data = (ReaderData *)_data; SDL_EventQueue *queue = data->queue; @@ -567,7 +570,7 @@ static int FIFO_Reader(void* _data) #ifdef TEST_SPINLOCK_FIFO /* This thread periodically locks the queue for no particular reason */ -static int FIFO_Watcher(void* _data) +static int SDLCALL FIFO_Watcher(void* _data) { SDL_EventQueue *queue = (SDL_EventQueue *)_data; @@ -597,7 +600,7 @@ static void RunFIFOTest(SDL_bool lock_free) int i, j; int grand_total; char textBuffer[1024]; - int len; + size_t len; SDL_Log("\nFIFO test---------------------------------------\n\n"); SDL_Log("Mode: %s\n", lock_free ? "LockFree" : "Mutex"); diff --git a/Engine/lib/sdl/test/testaudiocapture.c b/Engine/lib/sdl/test/testaudiocapture.c index 26321a71c..a418d123c 100644 --- a/Engine/lib/sdl/test/testaudiocapture.c +++ b/Engine/lib/sdl/test/testaudiocapture.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testaudiohotplug.c b/Engine/lib/sdl/test/testaudiohotplug.c index 73d480505..374cbb27b 100644 --- a/Engine/lib/sdl/test/testaudiohotplug.c +++ b/Engine/lib/sdl/test/testaudiohotplug.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testaudioinfo.c b/Engine/lib/sdl/test/testaudioinfo.c index 485fd0a38..adecce9b7 100644 --- a/Engine/lib/sdl/test/testaudioinfo.c +++ b/Engine/lib/sdl/test/testaudioinfo.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testautomation.c b/Engine/lib/sdl/test/testautomation.c index eea74b3b8..bb799ea43 100644 --- a/Engine/lib/sdl/test/testautomation.c +++ b/Engine/lib/sdl/test/testautomation.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testautomation_audio.c b/Engine/lib/sdl/test/testautomation_audio.c index bef838dde..be0f15e3d 100644 --- a/Engine/lib/sdl/test/testautomation_audio.c +++ b/Engine/lib/sdl/test/testautomation_audio.c @@ -46,7 +46,7 @@ int _audio_testCallbackLength; /* Test callback function */ -void _audio_testCallback(void *userdata, Uint8 *stream, int len) +void SDLCALL _audio_testCallback(void *userdata, Uint8 *stream, int len) { /* track that callback was called */ _audio_testCallbackCounter++; diff --git a/Engine/lib/sdl/test/testautomation_clipboard.c b/Engine/lib/sdl/test/testautomation_clipboard.c index f943ffee7..417d95746 100644 --- a/Engine/lib/sdl/test/testautomation_clipboard.c +++ b/Engine/lib/sdl/test/testautomation_clipboard.c @@ -121,7 +121,7 @@ clipboard_testClipboardTextFunctions(void *arg) SDLTest_AssertCheck( charResult[0] == '\0', "Verify SDL_GetClipboardText returned string with length 0, got length %i", - SDL_strlen(charResult)); + (int) SDL_strlen(charResult)); intResult = SDL_SetClipboardText((const char *)text); SDLTest_AssertPass("Call to SDL_SetClipboardText succeeded"); SDLTest_AssertCheck( diff --git a/Engine/lib/sdl/test/testautomation_events.c b/Engine/lib/sdl/test/testautomation_events.c index a0119bdbe..09004da52 100644 --- a/Engine/lib/sdl/test/testautomation_events.c +++ b/Engine/lib/sdl/test/testautomation_events.c @@ -25,7 +25,7 @@ int _userdataValue1 = 1; int _userdataValue2 = 2; /* Event filter that sets some flags and optionally checks userdata */ -int _events_sampleNullEventFilter(void *userdata, SDL_Event *event) +int SDLCALL _events_sampleNullEventFilter(void *userdata, SDL_Event *event) { _eventFilterCalled = 1; diff --git a/Engine/lib/sdl/test/testautomation_keyboard.c b/Engine/lib/sdl/test/testautomation_keyboard.c index b2c3b9ae1..6f25bb76c 100644 --- a/Engine/lib/sdl/test/testautomation_keyboard.c +++ b/Engine/lib/sdl/test/testautomation_keyboard.c @@ -312,7 +312,7 @@ keyboard_getSetModState(void *arg) /* Get state, cache for later reset */ result = SDL_GetModState(); SDLTest_AssertPass("Call to SDL_GetModState()"); - SDLTest_AssertCheck(result >=0 && result <= allStates, "Verify result from call is valid, expected: 0 <= result <= %i, got: %i", allStates, result); + SDLTest_AssertCheck(/*result >= 0 &&*/ result <= allStates, "Verify result from call is valid, expected: 0 <= result <= %i, got: %i", allStates, result); currentState = result; /* Set random state */ diff --git a/Engine/lib/sdl/test/testautomation_mouse.c b/Engine/lib/sdl/test/testautomation_mouse.c index 57cadee2e..ed30f2604 100644 --- a/Engine/lib/sdl/test/testautomation_mouse.c +++ b/Engine/lib/sdl/test/testautomation_mouse.c @@ -447,11 +447,23 @@ mouse_warpMouseInWindow(void *arg) { const int w = MOUSE_TESTWINDOW_WIDTH, h = MOUSE_TESTWINDOW_HEIGHT; int numPositions = 6; - int xPositions[] = {-1, 0, 1, w-1, w, w+1 }; - int yPositions[] = {-1, 0, 1, h-1, h, h+1 }; + int xPositions[6]; + int yPositions[6]; int x, y, i, j; SDL_Window *window; + xPositions[0] = -1; + xPositions[1] = 0; + xPositions[2] = 1; + xPositions[3] = w-1; + xPositions[4] = w; + xPositions[5] = w+1; + yPositions[0] = -1; + yPositions[1] = 0; + yPositions[2] = 1; + yPositions[3] = h-1; + yPositions[4] = h; + yPositions[5] = h+1; /* Create test window */ window = _createMouseSuiteTestWindow(); if (window == NULL) return TEST_ABORTED; diff --git a/Engine/lib/sdl/test/testautomation_platform.c b/Engine/lib/sdl/test/testautomation_platform.c index 5211a4a70..7cc732a7b 100644 --- a/Engine/lib/sdl/test/testautomation_platform.c +++ b/Engine/lib/sdl/test/testautomation_platform.c @@ -112,7 +112,7 @@ int platform_testGetFunctions (void *arg) char *platform; char *revision; int ret; - int len; + size_t len; platform = (char *)SDL_GetPlatform(); SDLTest_AssertPass("SDL_GetPlatform()"); @@ -122,7 +122,7 @@ int platform_testGetFunctions (void *arg) SDLTest_AssertCheck(len > 0, "SDL_GetPlatform(): expected non-empty platform, was platform: '%s', len: %i", platform, - len); + (int) len); } ret = SDL_GetCPUCount(); @@ -282,7 +282,7 @@ int platform_testGetSetClearError(void *arg) int result; const char *testError = "Testing"; char *lastError; - int len; + size_t len; SDL_ClearError(); SDLTest_AssertPass("SDL_ClearError()"); @@ -295,7 +295,7 @@ int platform_testGetSetClearError(void *arg) { len = SDL_strlen(lastError); SDLTest_AssertCheck(len == 0, - "SDL_GetError(): no message expected, len: %i", len); + "SDL_GetError(): no message expected, len: %i", (int) len); } result = SDL_SetError("%s", testError); @@ -309,8 +309,8 @@ int platform_testGetSetClearError(void *arg) len = SDL_strlen(lastError); SDLTest_AssertCheck(len == SDL_strlen(testError), "SDL_GetError(): expected message len %i, was len: %i", - SDL_strlen(testError), - len); + (int) SDL_strlen(testError), + (int) len); SDLTest_AssertCheck(SDL_strcmp(lastError, testError) == 0, "SDL_GetError(): expected message %s, was message: %s", testError, @@ -334,7 +334,7 @@ int platform_testSetErrorEmptyInput(void *arg) int result; const char *testError = ""; char *lastError; - int len; + size_t len; result = SDL_SetError("%s", testError); SDLTest_AssertPass("SDL_SetError()"); @@ -347,8 +347,8 @@ int platform_testSetErrorEmptyInput(void *arg) len = SDL_strlen(lastError); SDLTest_AssertCheck(len == SDL_strlen(testError), "SDL_GetError(): expected message len %i, was len: %i", - SDL_strlen(testError), - len); + (int) SDL_strlen(testError), + (int) len); SDLTest_AssertCheck(SDL_strcmp(lastError, testError) == 0, "SDL_GetError(): expected message '%s', was message: '%s'", testError, @@ -373,14 +373,14 @@ int platform_testSetErrorInvalidInput(void *arg) const char *invalidError = NULL; const char *probeError = "Testing"; char *lastError; - int len; + size_t len; /* Reset */ SDL_ClearError(); SDLTest_AssertPass("SDL_ClearError()"); /* Check for no-op */ - result = SDL_SetError(invalidError); + result = SDL_SetError("%s", invalidError); SDLTest_AssertPass("SDL_SetError()"); SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result); lastError = (char *)SDL_GetError(); @@ -391,16 +391,16 @@ int platform_testSetErrorInvalidInput(void *arg) len = SDL_strlen(lastError); SDLTest_AssertCheck(len == 0, "SDL_GetError(): expected message len 0, was len: %i", - len); + (int) len); } /* Set */ - result = SDL_SetError(probeError); + result = SDL_SetError("%s", probeError); SDLTest_AssertPass("SDL_SetError('%s')", probeError); SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result); /* Check for no-op */ - result = SDL_SetError(invalidError); + result = SDL_SetError("%s", invalidError); SDLTest_AssertPass("SDL_SetError(NULL)"); SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result); lastError = (char *)SDL_GetError(); @@ -411,7 +411,7 @@ int platform_testSetErrorInvalidInput(void *arg) len = SDL_strlen(lastError); SDLTest_AssertCheck(len == 0, "SDL_GetError(): expected message len 0, was len: %i", - len); + (int) len); } /* Reset */ @@ -419,7 +419,7 @@ int platform_testSetErrorInvalidInput(void *arg) SDLTest_AssertPass("SDL_ClearError()"); /* Set and check */ - result = SDL_SetError(probeError); + result = SDL_SetError("%s", probeError); SDLTest_AssertPass("SDL_SetError()"); SDLTest_AssertCheck(result == -1, "SDL_SetError: expected -1, got: %i", result); lastError = (char *)SDL_GetError(); @@ -430,8 +430,8 @@ int platform_testSetErrorInvalidInput(void *arg) len = SDL_strlen(lastError); SDLTest_AssertCheck(len == SDL_strlen(probeError), "SDL_GetError(): expected message len %i, was len: %i", - SDL_strlen(probeError), - len); + (int) SDL_strlen(probeError), + (int) len); SDLTest_AssertCheck(SDL_strcmp(lastError, probeError) == 0, "SDL_GetError(): expected message '%s', was message: '%s'", probeError, diff --git a/Engine/lib/sdl/test/testautomation_rwops.c b/Engine/lib/sdl/test/testautomation_rwops.c index 16f2161fe..9a1a29a72 100644 --- a/Engine/lib/sdl/test/testautomation_rwops.c +++ b/Engine/lib/sdl/test/testautomation_rwops.c @@ -32,9 +32,9 @@ static const char RWopsAlphabetString[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; void RWopsSetUp(void *arg) { - int fileLen; + size_t fileLen; FILE *handle; - int writtenLen; + size_t writtenLen; int result; /* Clean up from previous runs (if any); ignore errors */ @@ -49,8 +49,8 @@ RWopsSetUp(void *arg) /* Write some known text into it */ fileLen = SDL_strlen(RWopsHelloWorldTestString); - writtenLen = (int)fwrite(RWopsHelloWorldTestString, 1, fileLen, handle); - SDLTest_AssertCheck(fileLen == writtenLen, "Verify number of written bytes, expected %i, got %i", fileLen, writtenLen); + writtenLen = fwrite(RWopsHelloWorldTestString, 1, fileLen, handle); + SDLTest_AssertCheck(fileLen == writtenLen, "Verify number of written bytes, expected %i, got %i", (int) fileLen, (int) writtenLen); result = fclose(handle); SDLTest_AssertCheck(result == 0, "Verify result from fclose, expected 0, got %i", result); @@ -61,8 +61,8 @@ RWopsSetUp(void *arg) /* Write alphabet text into it */ fileLen = SDL_strlen(RWopsAlphabetString); - writtenLen = (int)fwrite(RWopsAlphabetString, 1, fileLen, handle); - SDLTest_AssertCheck(fileLen == writtenLen, "Verify number of written bytes, expected %i, got %i", fileLen, writtenLen); + writtenLen = fwrite(RWopsAlphabetString, 1, fileLen, handle); + SDLTest_AssertCheck(fileLen == writtenLen, "Verify number of written bytes, expected %i, got %i", (int) fileLen, (int) writtenLen); result = fclose(handle); SDLTest_AssertCheck(result == 0, "Verify result from fclose, expected 0, got %i", result); @@ -111,10 +111,10 @@ _testGenericRWopsValidations(SDL_RWops *rw, int write) s = SDL_RWwrite(rw, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString)-1, 1); SDLTest_AssertPass("Call to SDL_RWwrite succeeded"); if (write) { - SDLTest_AssertCheck(s == (size_t)1, "Verify result of writing one byte with SDL_RWwrite, expected 1, got %i", s); + SDLTest_AssertCheck(s == (size_t)1, "Verify result of writing one byte with SDL_RWwrite, expected 1, got %i", (int) s); } else { - SDLTest_AssertCheck(s == (size_t)0, "Verify result of writing with SDL_RWwrite, expected: 0, got %i", s); + SDLTest_AssertCheck(s == (size_t)0, "Verify result of writing with SDL_RWwrite, expected: 0, got %i", (int) s); } /* Test seek to random position */ @@ -133,8 +133,8 @@ _testGenericRWopsValidations(SDL_RWops *rw, int write) SDLTest_AssertCheck( s == (size_t)(sizeof(RWopsHelloWorldTestString)-1), "Verify result from SDL_RWread, expected %i, got %i", - sizeof(RWopsHelloWorldTestString)-1, - s); + (int) (sizeof(RWopsHelloWorldTestString)-1), + (int) s); SDLTest_AssertCheck( SDL_memcmp(buf, RWopsHelloWorldTestString, sizeof(RWopsHelloWorldTestString)-1 ) == 0, "Verify read bytes match expected string, expected '%s', got '%s'", RWopsHelloWorldTestString, buf); @@ -144,25 +144,25 @@ _testGenericRWopsValidations(SDL_RWops *rw, int write) SDLTest_AssertPass("Call to SDL_RWseek(...,-4,RW_SEEK_CUR) succeeded"); SDLTest_AssertCheck( i == (Sint64)(sizeof(RWopsHelloWorldTestString)-5), - "Verify seek to -4 with SDL_RWseek (RW_SEEK_CUR), expected %i, got %"SDL_PRIs64, - sizeof(RWopsHelloWorldTestString)-5, - i); + "Verify seek to -4 with SDL_RWseek (RW_SEEK_CUR), expected %i, got %i", + (int) (sizeof(RWopsHelloWorldTestString)-5), + (int) i); i = SDL_RWseek( rw, -1, RW_SEEK_END ); SDLTest_AssertPass("Call to SDL_RWseek(...,-1,RW_SEEK_END) succeeded"); SDLTest_AssertCheck( i == (Sint64)(sizeof(RWopsHelloWorldTestString)-2), - "Verify seek to -1 with SDL_RWseek (RW_SEEK_END), expected %i, got %"SDL_PRIs64, - sizeof(RWopsHelloWorldTestString)-2, - i); + "Verify seek to -1 with SDL_RWseek (RW_SEEK_END), expected %i, got %i", + (int) (sizeof(RWopsHelloWorldTestString)-2), + (int) i); /* Invalid whence seek */ i = SDL_RWseek( rw, 0, 999 ); SDLTest_AssertPass("Call to SDL_RWseek(...,0,invalid_whence) succeeded"); SDLTest_AssertCheck( i == (Sint64)(-1), - "Verify seek with SDL_RWseek (invalid_whence); expected: -1, got %"SDL_PRIs64, - i); + "Verify seek with SDL_RWseek (invalid_whence); expected: -1, got %i", + (int) i); } /* ! @@ -559,8 +559,8 @@ rwops_testCompareRWFromMemWithRWFromFile(void) SDLTest_AssertCheck(result == 0, "Verify result value is 0; got: %d", result); /* Compare */ - SDLTest_AssertCheck(rv_mem == rv_file, "Verify returned read blocks matches for mem and file reads; got: rv_mem=%d rv_file=%d", rv_mem, rv_file); - SDLTest_AssertCheck(sv_mem == sv_file, "Verify SEEK_END position matches for mem and file seeks; got: sv_mem=%"SDL_PRIu64" sv_file=%"SDL_PRIu64, sv_mem, sv_file); + SDLTest_AssertCheck(rv_mem == rv_file, "Verify returned read blocks matches for mem and file reads; got: rv_mem=%d rv_file=%d", (int) rv_mem, (int) rv_file); + SDLTest_AssertCheck(sv_mem == sv_file, "Verify SEEK_END position matches for mem and file seeks; got: sv_mem=%d sv_file=%d", (int) sv_mem, (int) sv_file); SDLTest_AssertCheck(buffer_mem[slen] == 0, "Verify mem buffer termination; expected: 0, got: %d", buffer_mem[slen]); SDLTest_AssertCheck(buffer_file[slen] == 0, "Verify file buffer termination; expected: 0, got: %d", buffer_file[slen]); SDLTest_AssertCheck( @@ -648,27 +648,27 @@ rwops_testFileWriteReadEndian(void) /* Write test data */ objectsWritten = SDL_WriteBE16(rw, BE16value); SDLTest_AssertPass("Call to SDL_WriteBE16()"); - SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten); + SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int) objectsWritten); objectsWritten = SDL_WriteBE32(rw, BE32value); SDLTest_AssertPass("Call to SDL_WriteBE32()"); - SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten); + SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int) objectsWritten); objectsWritten = SDL_WriteBE64(rw, BE64value); SDLTest_AssertPass("Call to SDL_WriteBE64()"); - SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten); + SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int) objectsWritten); objectsWritten = SDL_WriteLE16(rw, LE16value); SDLTest_AssertPass("Call to SDL_WriteLE16()"); - SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten); + SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int) objectsWritten); objectsWritten = SDL_WriteLE32(rw, LE32value); SDLTest_AssertPass("Call to SDL_WriteLE32()"); - SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten); + SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int) objectsWritten); objectsWritten = SDL_WriteLE64(rw, LE64value); SDLTest_AssertPass("Call to SDL_WriteLE64()"); - SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", objectsWritten); + SDLTest_AssertCheck(objectsWritten == 1, "Validate number of objects written, expected: 1, got: %i", (int) objectsWritten); /* Test seek to start */ result = SDL_RWseek( rw, 0, RW_SEEK_SET ); SDLTest_AssertPass("Call to SDL_RWseek succeeded"); - SDLTest_AssertCheck(result == 0, "Verify result from position 0 with SDL_RWseek, expected 0, got %"SDL_PRIs64, result); + SDLTest_AssertCheck(result == 0, "Verify result from position 0 with SDL_RWseek, expected 0, got %i", (int) result); /* Read test data */ BE16test = SDL_ReadBE16(rw); diff --git a/Engine/lib/sdl/test/testautomation_sdltest.c b/Engine/lib/sdl/test/testautomation_sdltest.c index 54cd6e257..979756adc 100644 --- a/Engine/lib/sdl/test/testautomation_sdltest.c +++ b/Engine/lib/sdl/test/testautomation_sdltest.c @@ -2,17 +2,20 @@ * SDL_test test suite */ +#include /* Visual Studio 2008 doesn't have stdint.h */ #if defined(_MSC_VER) && _MSC_VER <= 1500 -#define UINT8_MAX ~(Uint8)0 -#define UINT16_MAX ~(Uint16)0 -#define UINT32_MAX ~(Uint32)0 -#define UINT64_MAX ~(Uint64)0 +#define UINT8_MAX _UI8_MAX +#define UINT16_MAX _UI16_MAX +#define UINT32_MAX _UI32_MAX +#define INT64_MIN _I64_MIN +#define INT64_MAX _I64_MAX +#define UINT64_MAX _UI64_MAX #else #include #endif + #include -#include #include #include @@ -31,7 +34,8 @@ int sdltest_generateRunSeed(void *arg) { char* result; - int i, l; + size_t i, l; + int j; for (i = 1; i <= 10; i += 3) { result = SDLTest_GenerateRunSeed((const int)i); @@ -39,14 +43,14 @@ sdltest_generateRunSeed(void *arg) SDLTest_AssertCheck(result != NULL, "Verify returned value is not NULL"); if (result != NULL) { l = SDL_strlen(result); - SDLTest_AssertCheck(l == i, "Verify length of returned value is %d, got: %d", i, l); + SDLTest_AssertCheck(l == i, "Verify length of returned value is %d, got: %d", (int) i, (int) l); SDL_free(result); } } /* Negative cases */ - for (i = -2; i <= 0; i++) { - result = SDLTest_GenerateRunSeed((const int)i); + for (j = -2; j <= 0; j++) { + result = SDLTest_GenerateRunSeed((const int)j); SDLTest_AssertPass("Call to SDLTest_GenerateRunSeed()"); SDLTest_AssertCheck(result == NULL, "Verify returned value is not NULL"); } @@ -988,38 +992,38 @@ sdltest_randomBoundaryNumberSint64(void *arg) "Validate result value for parameters (1,20,SDL_FALSE); expected: 0|21, got: %"SDL_PRIs64, sresult); /* RandomSintXBoundaryValue(LLONG_MIN, 99, SDL_FALSE) returns 100 */ - sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN, 99, SDL_FALSE); + sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(INT64_MIN, 99, SDL_FALSE); SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue"); SDLTest_AssertCheck( sresult == 100, "Validate result value for parameters (LLONG_MIN,99,SDL_FALSE); expected: 100, got: %"SDL_PRIs64, sresult); /* RandomSintXBoundaryValue(LLONG_MIN + 1, LLONG_MAX, SDL_FALSE) returns LLONG_MIN (no error) */ - sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN + 1, LLONG_MAX, SDL_FALSE); + sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(INT64_MIN + 1, INT64_MAX, SDL_FALSE); SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue"); SDLTest_AssertCheck( - sresult == LLONG_MIN, - "Validate result value for parameters (LLONG_MIN+1,LLONG_MAX,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, LLONG_MIN, sresult); + sresult == INT64_MIN, + "Validate result value for parameters (LLONG_MIN+1,LLONG_MAX,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, INT64_MIN, sresult); lastError = (char *)SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set"); /* RandomSintXBoundaryValue(LLONG_MIN, LLONG_MAX - 1, SDL_FALSE) returns LLONG_MAX (no error) */ - sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN, LLONG_MAX - 1, SDL_FALSE); + sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(INT64_MIN, INT64_MAX - 1, SDL_FALSE); SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue"); SDLTest_AssertCheck( - sresult == LLONG_MAX, - "Validate result value for parameters (LLONG_MIN,LLONG_MAX - 1,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, LLONG_MAX, sresult); + sresult == INT64_MAX, + "Validate result value for parameters (LLONG_MIN,LLONG_MAX - 1,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, INT64_MAX, sresult); lastError = (char *)SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError == NULL || lastError[0] == '\0', "Validate no error message was set"); /* RandomSintXBoundaryValue(LLONG_MIN, LLONG_MAX, SDL_FALSE) returns 0 (sets error) */ - sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(LLONG_MIN, LLONG_MAX, SDL_FALSE); + sresult = (Sint64)SDLTest_RandomSint64BoundaryValue(INT64_MIN, INT64_MAX, SDL_FALSE); SDLTest_AssertPass("Call to SDLTest_RandomSint64BoundaryValue"); SDLTest_AssertCheck( - sresult == LLONG_MIN, - "Validate result value for parameters(LLONG_MIN,LLONG_MAX,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, LLONG_MIN, sresult); + sresult == INT64_MIN, + "Validate result value for parameters(LLONG_MIN,LLONG_MAX,SDL_FALSE); expected: %"SDL_PRIs64", got: %"SDL_PRIs64, INT64_MIN, sresult); lastError = (char *)SDL_GetError(); SDLTest_AssertPass("SDL_GetError()"); SDLTest_AssertCheck(lastError != NULL && SDL_strcmp(lastError, expectedError) == 0, @@ -1116,16 +1120,16 @@ int sdltest_randomAsciiString(void *arg) { char* result; - int len; + size_t len; int nonAsciiCharacters; - int i; + size_t i; result = SDLTest_RandomAsciiString(); SDLTest_AssertPass("Call to SDLTest_RandomAsciiString()"); SDLTest_AssertCheck(result != NULL, "Validate that result is not NULL"); if (result != NULL) { len = SDL_strlen(result); - SDLTest_AssertCheck(len >= 0 && len <= 255, "Validate that result length; expected: len=[1,255], got: %d", len); + SDLTest_AssertCheck(len >= 1 && len <= 255, "Validate that result length; expected: len=[1,255], got: %d", (int) len); nonAsciiCharacters = 0; for (i=0; i= 0 && len <= targetLen, "Validate that result length; expected: len=[1,%d], got: %d", targetLen, len); + SDLTest_AssertCheck(len >= 1 && len <= targetLen, "Validate that result length; expected: len=[1,%d], got: %d", (int) targetLen, (int) len); nonAsciiCharacters = 0; for (i=0; i + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testcustomcursor.c b/Engine/lib/sdl/test/testcustomcursor.c index 88b5c322d..b99a10bba 100644 --- a/Engine/lib/sdl/test/testcustomcursor.c +++ b/Engine/lib/sdl/test/testcustomcursor.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testdisplayinfo.c b/Engine/lib/sdl/test/testdisplayinfo.c index f06722e88..0cc5fbdd7 100644 --- a/Engine/lib/sdl/test/testdisplayinfo.c +++ b/Engine/lib/sdl/test/testdisplayinfo.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testdraw2.c b/Engine/lib/sdl/test/testdraw2.c index 77bd8c1fe..91ee7eea2 100644 --- a/Engine/lib/sdl/test/testdraw2.c +++ b/Engine/lib/sdl/test/testdraw2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testdrawchessboard.c b/Engine/lib/sdl/test/testdrawchessboard.c index af929e9c3..3dd78e1ac 100644 --- a/Engine/lib/sdl/test/testdrawchessboard.c +++ b/Engine/lib/sdl/test/testdrawchessboard.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,6 +25,7 @@ SDL_Window *window; SDL_Renderer *renderer; +SDL_Surface *surface; int done; void @@ -59,7 +60,20 @@ loop() { SDL_Event e; while (SDL_PollEvent(&e)) { - if (e.type == SDL_QUIT) { + + /* Re-create when window has been resized */ + if ((e.type == SDL_WINDOWEVENT) && (e.window.event == SDL_WINDOWEVENT_SIZE_CHANGED)) { + + SDL_DestroyRenderer(renderer); + + surface = SDL_GetWindowSurface(window); + renderer = SDL_CreateSoftwareRenderer(surface); + /* Clear the rendering surface with the specified color */ + SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF); + SDL_RenderClear(renderer); + } + + if (e.type == SDL_QUIT) { done = 1; #ifdef __EMSCRIPTEN__ emscripten_cancel_main_loop(); @@ -86,8 +100,6 @@ loop() int main(int argc, char *argv[]) { - SDL_Surface *surface; - /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); @@ -100,7 +112,7 @@ main(int argc, char *argv[]) /* Create window and renderer for given surface */ - window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, 0); + window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_RESIZABLE); if(!window) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n",SDL_GetError()); diff --git a/Engine/lib/sdl/test/testdropfile.c b/Engine/lib/sdl/test/testdropfile.c index b729b2f64..1c2a3f0e6 100644 --- a/Engine/lib/sdl/test/testdropfile.c +++ b/Engine/lib/sdl/test/testdropfile.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testerror.c b/Engine/lib/sdl/test/testerror.c index b5fa3fbc0..87fcab21b 100644 --- a/Engine/lib/sdl/test/testerror.c +++ b/Engine/lib/sdl/test/testerror.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -14,7 +14,6 @@ #include #include -#include #include "SDL.h" diff --git a/Engine/lib/sdl/test/testfile.c b/Engine/lib/sdl/test/testfile.c index b45795f63..e563d77be 100644 --- a/Engine/lib/sdl/test/testfile.c +++ b/Engine/lib/sdl/test/testfile.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testfilesystem.c b/Engine/lib/sdl/test/testfilesystem.c index 61a6d5a5a..ada4e864c 100644 --- a/Engine/lib/sdl/test/testfilesystem.c +++ b/Engine/lib/sdl/test/testfilesystem.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -46,6 +46,15 @@ main(int argc, char *argv[]) SDL_Log("pref path: '%s'\n", pref_path); SDL_free(pref_path); + pref_path = SDL_GetPrefPath(NULL, "testfilesystem"); + if(pref_path == NULL){ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't find pref path without organization: %s\n", + SDL_GetError()); + return 1; + } + SDL_Log("pref path: '%s'\n", pref_path); + SDL_free(pref_path); + SDL_Quit(); return 0; } diff --git a/Engine/lib/sdl/test/testgamecontroller.c b/Engine/lib/sdl/test/testgamecontroller.c index 38d2f7708..ef3a02b2f 100644 --- a/Engine/lib/sdl/test/testgamecontroller.c +++ b/Engine/lib/sdl/test/testgamecontroller.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -53,12 +53,12 @@ static const struct { int x; int y; } button_positions[] = { /* This is indexed by SDL_GameControllerAxis. */ static const struct { int x; int y; double angle; } axis_positions[] = { - {75, 154, 0.0}, /* LEFTX */ - {75, 154, 90.0}, /* LEFTY */ - {305, 230, 0.0}, /* RIGHTX */ - {305, 230, 90.0}, /* RIGHTY */ - {91, 0, 90.0}, /* TRIGGERLEFT */ - {375, 0, 90.0}, /* TRIGGERRIGHT */ + {74, 153, 270.0}, /* LEFTX */ + {74, 153, 0.0}, /* LEFTY */ + {306, 231, 270.0}, /* RIGHTX */ + {306, 231, 0.0}, /* RIGHTY */ + {91, -20, 0.0}, /* TRIGGERLEFT */ + {375, -20, 0.0}, /* TRIGGERRIGHT */ }; SDL_Renderer *screen = NULL; @@ -80,10 +80,6 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent) if (transparent) { if (temp->format->BytesPerPixel == 1) { SDL_SetColorKey(temp, SDL_TRUE, *(Uint8 *)temp->pixels); - } else { - SDL_assert(!temp->format->palette); - SDL_assert(temp->format->BitsPerPixel == 24); - SDL_SetColorKey(temp, SDL_TRUE, (*(Uint32 *)temp->pixels) & 0x00FFFFFF); } } @@ -112,6 +108,13 @@ loop(void *arg) while (SDL_PollEvent(&event)) { switch (event.type) { + case SDL_CONTROLLERAXISMOTION: + SDL_Log("Controller axis %s changed to %d\n", SDL_GameControllerGetStringForAxis((SDL_GameControllerAxis)event.caxis.axis), event.caxis.value); + break; + case SDL_CONTROLLERBUTTONDOWN: + case SDL_CONTROLLERBUTTONUP: + SDL_Log("Controller button %s %s\n", SDL_GameControllerGetStringForButton((SDL_GameControllerButton)event.cbutton.button), event.cbutton.state ? "pressed" : "released"); + break; case SDL_KEYDOWN: if (event.key.keysym.sym != SDLK_ESCAPE) { break; @@ -259,6 +262,19 @@ main(int argc, char *argv[]) SDL_GameControllerAddMappingsFromFile("gamecontrollerdb.txt"); + /* Print information about the mappings */ + if (!argv[1]) { + SDL_Log("Supported mappings:\n"); + for (i = 0; i < SDL_GameControllerNumMappings(); ++i) { + char *mapping = SDL_GameControllerMappingForIndex(i); + if (mapping) { + SDL_Log("\t%s\n", mapping); + SDL_free(mapping); + } + } + SDL_Log("\n"); + } + /* Print information about the controller */ for (i = 0; i < SDL_NumJoysticks(); ++i) { const char *name; @@ -276,7 +292,9 @@ main(int argc, char *argv[]) name = SDL_JoystickNameForIndex(i); description = "Joystick"; } - SDL_Log("%s %d: %s (guid %s)\n", description, i, name ? name : "Unknown", guid); + SDL_Log("%s %d: %s (guid %s, VID 0x%.4x, PID 0x%.4x)\n", + description, i, name ? name : "Unknown", guid, + SDL_JoystickGetDeviceVendor(i), SDL_JoystickGetDeviceProduct(i)); } SDL_Log("There are %d game controller(s) attached (%d joystick(s))\n", nController, SDL_NumJoysticks()); @@ -348,3 +366,5 @@ main(int argc, char *argv[]) } #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/test/testgesture.c b/Engine/lib/sdl/test/testgesture.c index a289ce133..f4b254a65 100644 --- a/Engine/lib/sdl/test/testgesture.c +++ b/Engine/lib/sdl/test/testgesture.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -25,7 +25,6 @@ #define WIDTH 640 #define HEIGHT 480 #define BPP 4 -#define DEPTH 32 /* MUST BE A POWER OF 2! */ #define EVENT_BUF_SIZE 256 diff --git a/Engine/lib/sdl/test/testgl2.c b/Engine/lib/sdl/test/testgl2.c index 74147f9fb..dd01d0e29 100644 --- a/Engine/lib/sdl/test/testgl2.c +++ b/Engine/lib/sdl/test/testgl2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -56,7 +56,7 @@ static int LoadContext(GL_Context * data) do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - return SDL_SetError("Couldn't load GL function %s: %s\n", #func, SDL_GetError()); \ + return SDL_SetError("Couldn't load GL function %s: %s", #func, SDL_GetError()); \ } \ } while ( 0 ); #endif /* __SDL_NOGETPROCADDR__ */ diff --git a/Engine/lib/sdl/test/testgles.c b/Engine/lib/sdl/test/testgles.c index 5be48ac56..96895da0f 100644 --- a/Engine/lib/sdl/test/testgles.c +++ b/Engine/lib/sdl/test/testgles.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testgles2.c b/Engine/lib/sdl/test/testgles2.c index 45b3d79a3..c4578a5cc 100644 --- a/Engine/lib/sdl/test/testgles2.c +++ b/Engine/lib/sdl/test/testgles2.c @@ -1,5 +1,5 @@ /* - Copyright (r) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,7 +20,8 @@ #include "SDL_test_common.h" -#if defined(__IPHONEOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__NACL__) +#if defined(__IPHONEOS__) || defined(__ANDROID__) || defined(__EMSCRIPTEN__) || defined(__NACL__) \ + || defined(__WINDOWS__) || defined(__LINUX__) #define HAVE_OPENGLES2 #endif @@ -58,7 +59,7 @@ static int LoadContext(GLES2_Context * data) do { \ data->func = SDL_GL_GetProcAddress(#func); \ if ( ! data->func ) { \ - return SDL_SetError("Couldn't load GLES2 function %s: %s\n", #func, SDL_GetError()); \ + return SDL_SetError("Couldn't load GLES2 function %s: %s", #func, SDL_GetError()); \ } \ } while ( 0 ); #endif /* __SDL_NOGETPROCADDR__ */ diff --git a/Engine/lib/sdl/test/testhittesting.c b/Engine/lib/sdl/test/testhittesting.c index 5e32be42d..c5223a983 100644 --- a/Engine/lib/sdl/test/testhittesting.c +++ b/Engine/lib/sdl/test/testhittesting.c @@ -14,7 +14,7 @@ const SDL_Rect drag_areas[] = { static const SDL_Rect *areas = drag_areas; static int numareas = SDL_arraysize(drag_areas); -static SDL_HitTestResult +static SDL_HitTestResult SDLCALL hitTest(SDL_Window *window, const SDL_Point *pt, void *data) { int i; diff --git a/Engine/lib/sdl/test/testhotplug.c b/Engine/lib/sdl/test/testhotplug.c index 1fa963754..72c90e8d9 100644 --- a/Engine/lib/sdl/test/testhotplug.c +++ b/Engine/lib/sdl/test/testhotplug.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testiconv.c b/Engine/lib/sdl/test/testiconv.c index 79efec8aa..47e8c377a 100644 --- a/Engine/lib/sdl/test/testiconv.c +++ b/Engine/lib/sdl/test/testiconv.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testime.c b/Engine/lib/sdl/test/testime.c index 39a40f82f..77bb86962 100644 --- a/Engine/lib/sdl/test/testime.c +++ b/Engine/lib/sdl/test/testime.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -99,7 +99,7 @@ static Uint8 validate_hex(const char *cp, size_t len, Uint32 *np) return 1; } -static void unifont_init(const char *fontname) +static int unifont_init(const char *fontname) { Uint8 hexBuffer[65]; Uint32 numGlyphs = 0; @@ -114,7 +114,7 @@ static void unifont_init(const char *fontname) if (unifontGlyph == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for glyph data.\n", (int)(unifontGlyphSize + 1023) / 1024); - exit(-1); + return -1; } SDL_memset(unifontGlyph, 0, unifontGlyphSize); @@ -123,7 +123,7 @@ static void unifont_init(const char *fontname) if (unifontTexture == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d KiB for texture pointer data.\n", (int)(unifontTextureSize + 1023) / 1024); - exit(-1); + return -1; } SDL_memset(unifontTexture, 0, unifontTextureSize); @@ -131,7 +131,7 @@ static void unifont_init(const char *fontname) if (hexFile == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to open font file: %s\n", fontname); - exit(-1); + return -1; } /* Read all the glyph data into memory to make it accessible later when textures are created. */ @@ -146,8 +146,8 @@ static void unifont_init(const char *fontname) break; /* EOF */ if ((numGlyphs == 0 && bytesRead == 0) || (numGlyphs > 0 && bytesRead < 9)) { - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unfiont: Unexpected end of hex file.\n"); - exit(-1); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n"); + return -1; } /* Looking for the colon that separates the codepoint and glyph data at position 2, 4, 6 and 8. */ @@ -162,13 +162,13 @@ static void unifont_init(const char *fontname) else { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Could not find codepoint and glyph data separator symbol in hex file on line %d.\n", lineNumber); - exit(-1); + return -1; } if (!validate_hex((const char *)hexBuffer, codepointHexSize, &codepoint)) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Malformed hexadecimal number in hex file on line %d.\n", lineNumber); - exit(-1); + return -1; } if (codepoint > UNIFONT_MAX_CODEPOINT) SDL_LogWarn(SDL_LOG_CATEGORY_APPLICATION, "unifont: Codepoint on line %d exceeded limit of 0x%x.\n", lineNumber, UNIFONT_MAX_CODEPOINT); @@ -181,7 +181,7 @@ static void unifont_init(const char *fontname) if (bytesRead < (33 - bytesOverread)) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n"); - exit(-1); + return -1; } if (hexBuffer[32] == '\n') glyphWidth = 8; @@ -192,14 +192,14 @@ static void unifont_init(const char *fontname) if (bytesRead < 32) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Unexpected end of hex file.\n"); - exit(-1); + return -1; } } if (!validate_hex((const char *)hexBuffer, glyphWidth * 4, NULL)) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Malformed hexadecimal glyph data in hex file on line %d.\n", lineNumber); - exit(-1); + return -1; } if (codepoint <= UNIFONT_MAX_CODEPOINT) @@ -221,6 +221,7 @@ static void unifont_init(const char *fontname) SDL_RWclose(hexFile); SDL_Log("unifont: Loaded %u glyphs.\n", numGlyphs); + return 0; } static void unifont_make_rgba(Uint8 *src, Uint8 *dst, Uint8 width) @@ -259,7 +260,7 @@ static void unifont_make_rgba(Uint8 *src, Uint8 *dst, Uint8 width) } } -static void unifont_load_texture(Uint32 textureID) +static int unifont_load_texture(Uint32 textureID) { int i; Uint8 * textureRGBA; @@ -267,14 +268,14 @@ static void unifont_load_texture(Uint32 textureID) if (textureID >= UNIFONT_NUM_TEXTURES) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Tried to load out of range texture %u.\n", textureID); - exit(-1); + return -1; } textureRGBA = (Uint8 *)SDL_malloc(UNIFONT_TEXTURE_SIZE); if (textureRGBA == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to allocate %d MiB for a texture.\n", UNIFONT_TEXTURE_SIZE / 1024 / 1024); - exit(-1); + return -1; } SDL_memset(textureRGBA, 0, UNIFONT_TEXTURE_SIZE); @@ -301,7 +302,7 @@ static void unifont_load_texture(Uint32 textureID) if (tex == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "unifont: Failed to create texture %u for renderer %d.\n", textureID, i); - exit(-1); + return -1; } unifontTexture[UNIFONT_NUM_TEXTURES * i + textureID] = tex; SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND); @@ -313,6 +314,7 @@ static void unifont_load_texture(Uint32 textureID) SDL_free(textureRGBA); unifontTextureLoaded[textureID] = 1; + return 0; } static Sint32 unifont_draw_glyph(Uint32 codepoint, int rendererID, SDL_Rect *dstrect) @@ -321,10 +323,14 @@ static Sint32 unifont_draw_glyph(Uint32 codepoint, int rendererID, SDL_Rect *dst const Uint32 textureID = codepoint / UNIFONT_GLYPHS_IN_TEXTURE; SDL_Rect srcrect; srcrect.w = srcrect.h = 16; - if (codepoint > UNIFONT_MAX_CODEPOINT) + if (codepoint > UNIFONT_MAX_CODEPOINT) { return 0; - if (!unifontTextureLoaded[textureID]) - unifont_load_texture(textureID); + } + if (!unifontTextureLoaded[textureID]) { + if (unifont_load_texture(textureID) < 0) { + return 0; + } + } texture = unifontTexture[UNIFONT_NUM_TEXTURES * rendererID + textureID]; if (texture != NULL) { @@ -430,12 +436,10 @@ Uint32 utf8_decode(char *p, size_t len) void usage() { SDL_Log("usage: testime [--font fontfile]\n"); - exit(0); } void InitInput() { - /* Prepare a rect for text input */ textRect.x = textRect.y = 100; textRect.w = DEFAULT_WINDOW_WIDTH - 2 * textRect.x; @@ -459,7 +463,8 @@ void CleanupVideo() #endif } -void _Redraw(int rendererID) { +void _Redraw(int rendererID) +{ SDL_Renderer * renderer = state->renderers[rendererID]; SDL_Rect drawnTextRect, cursorRect, underlineRect; drawnTextRect = textRect; @@ -607,7 +612,8 @@ void _Redraw(int rendererID) { SDL_SetTextInputRect(&markedRect); } -void Redraw() { +void Redraw() +{ int i; for (i = 0; i < state->num_windows; ++i) { SDL_Renderer *renderer = state->renderers[i]; @@ -623,7 +629,8 @@ void Redraw() { } } -int main(int argc, char *argv[]) { +int main(int argc, char *argv[]) +{ int i, done; SDL_Event event; const char *fontname = DEFAULT_FONT; @@ -673,14 +680,15 @@ int main(int argc, char *argv[]) { if (! font) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed to find font: %s\n", TTF_GetError()); - exit(-1); + return -1; } #else - unifont_init(fontname); + if (unifont_init(fontname) < 0) { + return -1; + } #endif SDL_Log("Using font: %s\n", fontname); - atexit(SDL_Quit); InitInput(); /* Create the windows and initialize the renderers */ diff --git a/Engine/lib/sdl/test/testintersections.c b/Engine/lib/sdl/test/testintersections.c index 82aae6338..619df0640 100644 --- a/Engine/lib/sdl/test/testintersections.c +++ b/Engine/lib/sdl/test/testintersections.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testjoystick.c b/Engine/lib/sdl/test/testjoystick.c index bed27212e..d2d1c4e2c 100644 --- a/Engine/lib/sdl/test/testjoystick.c +++ b/Engine/lib/sdl/test/testjoystick.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -239,7 +239,7 @@ WatchJoystick(SDL_Joystick * joystick) int main(int argc, char *argv[]) { - const char *name; + const char *name, *type; int i; SDL_Joystick *joystick; @@ -268,12 +268,46 @@ main(int argc, char *argv[]) SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joystick)) == joystick); SDL_JoystickGetGUIDString(SDL_JoystickGetGUID(joystick), guid, sizeof (guid)); + switch (SDL_JoystickGetType(joystick)) { + case SDL_JOYSTICK_TYPE_GAMECONTROLLER: + type = "Game Controller"; + break; + case SDL_JOYSTICK_TYPE_WHEEL: + type = "Wheel"; + break; + case SDL_JOYSTICK_TYPE_ARCADE_STICK: + type = "Arcade Stick"; + break; + case SDL_JOYSTICK_TYPE_FLIGHT_STICK: + type = "Flight Stick"; + break; + case SDL_JOYSTICK_TYPE_DANCE_PAD: + type = "Dance Pad"; + break; + case SDL_JOYSTICK_TYPE_GUITAR: + type = "Guitar"; + break; + case SDL_JOYSTICK_TYPE_DRUM_KIT: + type = "Drum Kit"; + break; + case SDL_JOYSTICK_TYPE_ARCADE_PAD: + type = "Arcade Pad"; + break; + case SDL_JOYSTICK_TYPE_THROTTLE: + type = "Throttle"; + break; + default: + type = "Unknown"; + break; + } + SDL_Log(" type: %s\n", type); SDL_Log(" axes: %d\n", SDL_JoystickNumAxes(joystick)); SDL_Log(" balls: %d\n", SDL_JoystickNumBalls(joystick)); SDL_Log(" hats: %d\n", SDL_JoystickNumHats(joystick)); SDL_Log(" buttons: %d\n", SDL_JoystickNumButtons(joystick)); SDL_Log("instance id: %d\n", SDL_JoystickInstanceID(joystick)); SDL_Log(" guid: %s\n", guid); + SDL_Log(" VID/PID: 0x%.4x/0x%.4x\n", SDL_JoystickGetVendor(joystick), SDL_JoystickGetProduct(joystick)); SDL_JoystickClose(joystick); } } @@ -320,6 +354,7 @@ main(int argc, char *argv[]) || (event.type == SDL_MOUSEBUTTONDOWN)) { keepGoing = SDL_FALSE; } else if (event.type == SDL_JOYDEVICEADDED) { + device = event.jdevice.which; joystick = SDL_JoystickOpen(device); if (joystick != NULL) { SDL_assert(SDL_JoystickFromInstanceID(SDL_JoystickInstanceID(joystick)) == joystick); @@ -344,3 +379,5 @@ main(int argc, char *argv[]) } #endif + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/test/testkeys.c b/Engine/lib/sdl/test/testkeys.c index aea496caa..73f880e13 100644 --- a/Engine/lib/sdl/test/testkeys.c +++ b/Engine/lib/sdl/test/testkeys.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testloadso.c b/Engine/lib/sdl/test/testloadso.c index fb87fbed7..c6fa33106 100644 --- a/Engine/lib/sdl/test/testloadso.c +++ b/Engine/lib/sdl/test/testloadso.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testlock.c b/Engine/lib/sdl/test/testlock.c index 113ba0d4c..8299a9a67 100644 --- a/Engine/lib/sdl/test/testlock.c +++ b/Engine/lib/sdl/test/testlock.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testmessage.c b/Engine/lib/sdl/test/testmessage.c index 91968c322..8488d8eda 100644 --- a/Engine/lib/sdl/test/testmessage.c +++ b/Engine/lib/sdl/test/testmessage.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -14,7 +14,6 @@ #include #include -#include #include "SDL.h" @@ -26,7 +25,7 @@ quit(int rc) exit(rc); } -static int +static int SDLCALL button_messagebox(void *eventNumber) { const SDL_MessageBoxButtonData buttons[] = { @@ -47,12 +46,13 @@ button_messagebox(void *eventNumber) "Custom MessageBox", "This is a custom messagebox", 2, - buttons, + NULL,/* buttons */ NULL /* Default color scheme */ }; int button = -1; int success = 0; + data.buttons = buttons; if (eventNumber) { data.message = "This is a custom messagebox from a background thread."; } diff --git a/Engine/lib/sdl/test/testmultiaudio.c b/Engine/lib/sdl/test/testmultiaudio.c index 1b07ba9fc..52a4cac7d 100644 --- a/Engine/lib/sdl/test/testmultiaudio.c +++ b/Engine/lib/sdl/test/testmultiaudio.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testnative.c b/Engine/lib/sdl/test/testnative.c index 049c4c83e..674d9d3b4 100644 --- a/Engine/lib/sdl/test/testnative.c +++ b/Engine/lib/sdl/test/testnative.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testnative.h b/Engine/lib/sdl/test/testnative.h index ed2bf7e52..29d85fb32 100644 --- a/Engine/lib/sdl/test/testnative.h +++ b/Engine/lib/sdl/test/testnative.h @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testnativew32.c b/Engine/lib/sdl/test/testnativew32.c index aaea267d2..7e96bc697 100644 --- a/Engine/lib/sdl/test/testnativew32.c +++ b/Engine/lib/sdl/test/testnativew32.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testnativex11.c b/Engine/lib/sdl/test/testnativex11.c index 69fa37bbf..386c25e9e 100644 --- a/Engine/lib/sdl/test/testnativex11.c +++ b/Engine/lib/sdl/test/testnativex11.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testoverlay2.c b/Engine/lib/sdl/test/testoverlay2.c index 453f0f443..daf07d3e9 100644 --- a/Engine/lib/sdl/test/testoverlay2.c +++ b/Engine/lib/sdl/test/testoverlay2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -16,16 +16,14 @@ * * ********************************************************************************/ -#include -#include -#include - #ifdef __EMSCRIPTEN__ #include #endif #include "SDL.h" +#include "testyuv_cvt.h" + #define MOOSEPIC_W 64 #define MOOSEPIC_H 88 @@ -33,110 +31,110 @@ #define MOOSEFRAMES_COUNT 10 SDL_Color MooseColors[84] = { - {49, 49, 49} - , {66, 24, 0} - , {66, 33, 0} - , {66, 66, 66} + {49, 49, 49, SDL_ALPHA_OPAQUE} + , {66, 24, 0, SDL_ALPHA_OPAQUE} + , {66, 33, 0, SDL_ALPHA_OPAQUE} + , {66, 66, 66, SDL_ALPHA_OPAQUE} , - {66, 115, 49} - , {74, 33, 0} - , {74, 41, 16} - , {82, 33, 8} + {66, 115, 49, SDL_ALPHA_OPAQUE} + , {74, 33, 0, SDL_ALPHA_OPAQUE} + , {74, 41, 16, SDL_ALPHA_OPAQUE} + , {82, 33, 8, SDL_ALPHA_OPAQUE} , - {82, 41, 8} - , {82, 49, 16} - , {82, 82, 82} - , {90, 41, 8} + {82, 41, 8, SDL_ALPHA_OPAQUE} + , {82, 49, 16, SDL_ALPHA_OPAQUE} + , {82, 82, 82, SDL_ALPHA_OPAQUE} + , {90, 41, 8, SDL_ALPHA_OPAQUE} , - {90, 41, 16} - , {90, 57, 24} - , {99, 49, 16} - , {99, 66, 24} + {90, 41, 16, SDL_ALPHA_OPAQUE} + , {90, 57, 24, SDL_ALPHA_OPAQUE} + , {99, 49, 16, SDL_ALPHA_OPAQUE} + , {99, 66, 24, SDL_ALPHA_OPAQUE} , - {99, 66, 33} - , {99, 74, 33} - , {107, 57, 24} - , {107, 82, 41} + {99, 66, 33, SDL_ALPHA_OPAQUE} + , {99, 74, 33, SDL_ALPHA_OPAQUE} + , {107, 57, 24, SDL_ALPHA_OPAQUE} + , {107, 82, 41, SDL_ALPHA_OPAQUE} , - {115, 57, 33} - , {115, 66, 33} - , {115, 66, 41} - , {115, 74, 0} + {115, 57, 33, SDL_ALPHA_OPAQUE} + , {115, 66, 33, SDL_ALPHA_OPAQUE} + , {115, 66, 41, SDL_ALPHA_OPAQUE} + , {115, 74, 0, SDL_ALPHA_OPAQUE} , - {115, 90, 49} - , {115, 115, 115} - , {123, 82, 0} - , {123, 99, 57} + {115, 90, 49, SDL_ALPHA_OPAQUE} + , {115, 115, 115, SDL_ALPHA_OPAQUE} + , {123, 82, 0, SDL_ALPHA_OPAQUE} + , {123, 99, 57, SDL_ALPHA_OPAQUE} , - {132, 66, 41} - , {132, 74, 41} - , {132, 90, 8} - , {132, 99, 33} + {132, 66, 41, SDL_ALPHA_OPAQUE} + , {132, 74, 41, SDL_ALPHA_OPAQUE} + , {132, 90, 8, SDL_ALPHA_OPAQUE} + , {132, 99, 33, SDL_ALPHA_OPAQUE} , - {132, 99, 66} - , {132, 107, 66} - , {140, 74, 49} - , {140, 99, 16} + {132, 99, 66, SDL_ALPHA_OPAQUE} + , {132, 107, 66, SDL_ALPHA_OPAQUE} + , {140, 74, 49, SDL_ALPHA_OPAQUE} + , {140, 99, 16, SDL_ALPHA_OPAQUE} , - {140, 107, 74} - , {140, 115, 74} - , {148, 107, 24} - , {148, 115, 82} + {140, 107, 74, SDL_ALPHA_OPAQUE} + , {140, 115, 74, SDL_ALPHA_OPAQUE} + , {148, 107, 24, SDL_ALPHA_OPAQUE} + , {148, 115, 82, SDL_ALPHA_OPAQUE} , - {148, 123, 74} - , {148, 123, 90} - , {156, 115, 33} - , {156, 115, 90} + {148, 123, 74, SDL_ALPHA_OPAQUE} + , {148, 123, 90, SDL_ALPHA_OPAQUE} + , {156, 115, 33, SDL_ALPHA_OPAQUE} + , {156, 115, 90, SDL_ALPHA_OPAQUE} , - {156, 123, 82} - , {156, 132, 82} - , {156, 132, 99} - , {156, 156, 156} + {156, 123, 82, SDL_ALPHA_OPAQUE} + , {156, 132, 82, SDL_ALPHA_OPAQUE} + , {156, 132, 99, SDL_ALPHA_OPAQUE} + , {156, 156, 156, SDL_ALPHA_OPAQUE} , - {165, 123, 49} - , {165, 123, 90} - , {165, 132, 82} - , {165, 132, 90} + {165, 123, 49, SDL_ALPHA_OPAQUE} + , {165, 123, 90, SDL_ALPHA_OPAQUE} + , {165, 132, 82, SDL_ALPHA_OPAQUE} + , {165, 132, 90, SDL_ALPHA_OPAQUE} , - {165, 132, 99} - , {165, 140, 90} - , {173, 132, 57} - , {173, 132, 99} + {165, 132, 99, SDL_ALPHA_OPAQUE} + , {165, 140, 90, SDL_ALPHA_OPAQUE} + , {173, 132, 57, SDL_ALPHA_OPAQUE} + , {173, 132, 99, SDL_ALPHA_OPAQUE} , - {173, 140, 107} - , {173, 140, 115} - , {173, 148, 99} - , {173, 173, 173} + {173, 140, 107, SDL_ALPHA_OPAQUE} + , {173, 140, 115, SDL_ALPHA_OPAQUE} + , {173, 148, 99, SDL_ALPHA_OPAQUE} + , {173, 173, 173, SDL_ALPHA_OPAQUE} , - {181, 140, 74} - , {181, 148, 115} - , {181, 148, 123} - , {181, 156, 107} + {181, 140, 74, SDL_ALPHA_OPAQUE} + , {181, 148, 115, SDL_ALPHA_OPAQUE} + , {181, 148, 123, SDL_ALPHA_OPAQUE} + , {181, 156, 107, SDL_ALPHA_OPAQUE} , - {189, 148, 123} - , {189, 156, 82} - , {189, 156, 123} - , {189, 156, 132} + {189, 148, 123, SDL_ALPHA_OPAQUE} + , {189, 156, 82, SDL_ALPHA_OPAQUE} + , {189, 156, 123, SDL_ALPHA_OPAQUE} + , {189, 156, 132, SDL_ALPHA_OPAQUE} , - {189, 189, 189} - , {198, 156, 123} - , {198, 165, 132} - , {206, 165, 99} + {189, 189, 189, SDL_ALPHA_OPAQUE} + , {198, 156, 123, SDL_ALPHA_OPAQUE} + , {198, 165, 132, SDL_ALPHA_OPAQUE} + , {206, 165, 99, SDL_ALPHA_OPAQUE} , - {206, 165, 132} - , {206, 173, 140} - , {206, 206, 206} - , {214, 173, 115} + {206, 165, 132, SDL_ALPHA_OPAQUE} + , {206, 173, 140, SDL_ALPHA_OPAQUE} + , {206, 206, 206, SDL_ALPHA_OPAQUE} + , {214, 173, 115, SDL_ALPHA_OPAQUE} , - {214, 173, 140} - , {222, 181, 148} - , {222, 189, 132} - , {222, 189, 156} + {214, 173, 140, SDL_ALPHA_OPAQUE} + , {222, 181, 148, SDL_ALPHA_OPAQUE} + , {222, 189, 132, SDL_ALPHA_OPAQUE} + , {222, 189, 156, SDL_ALPHA_OPAQUE} , - {222, 222, 222} - , {231, 198, 165} - , {231, 231, 231} - , {239, 206, 173} + {222, 222, 222, SDL_ALPHA_OPAQUE} + , {231, 198, 165, SDL_ALPHA_OPAQUE} + , {231, 231, 231, SDL_ALPHA_OPAQUE} + , {239, 206, 173, SDL_ALPHA_OPAQUE} }; Uint8 MooseFrame[MOOSEFRAMES_COUNT][MOOSEFRAME_SIZE*2]; @@ -149,8 +147,7 @@ SDL_Renderer *renderer; int paused = 0; int i; SDL_bool done = SDL_FALSE; -Uint32 pixel_format = SDL_PIXELFORMAT_YV12; -int fpsdelay; +static int fpsdelay; /* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ static void @@ -160,91 +157,6 @@ quit(int rc) exit(rc); } -/* All RGB2YUV conversion code and some other parts of code has been taken from testoverlay.c */ - -/* NOTE: These RGB conversion functions are not intended for speed, - only as examples. -*/ - -void -RGBtoYUV(Uint8 * rgb, int *yuv, int monochrome, int luminance) -{ - if (monochrome) { -#if 1 /* these are the two formulas that I found on the FourCC site... */ - yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]); - yuv[1] = 128; - yuv[2] = 128; -#else - yuv[0] = (int)(0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16; - yuv[1] = 128; - yuv[2] = 128; -#endif - } else { -#if 1 /* these are the two formulas that I found on the FourCC site... */ - yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]); - yuv[1] = (int)((rgb[2] - yuv[0]) * 0.565 + 128); - yuv[2] = (int)((rgb[0] - yuv[0]) * 0.713 + 128); -#else - yuv[0] = (0.257 * rgb[0]) + (0.504 * rgb[1]) + (0.098 * rgb[2]) + 16; - yuv[1] = 128 - (0.148 * rgb[0]) - (0.291 * rgb[1]) + (0.439 * rgb[2]); - yuv[2] = 128 + (0.439 * rgb[0]) - (0.368 * rgb[1]) - (0.071 * rgb[2]); -#endif - } - - if (luminance != 100) { - yuv[0] = yuv[0] * luminance / 100; - if (yuv[0] > 255) - yuv[0] = 255; - } -} - -void -ConvertRGBtoYV12(Uint8 *rgb, Uint8 *out, int w, int h, - int monochrome, int luminance) -{ - int x, y; - int yuv[3]; - Uint8 *op[3]; - - op[0] = out; - op[1] = op[0] + w*h; - op[2] = op[1] + w*h/4; - for (y = 0; y < h; ++y) { - for (x = 0; x < w; ++x) { - RGBtoYUV(rgb, yuv, monochrome, luminance); - *(op[0]++) = yuv[0]; - if (x % 2 == 0 && y % 2 == 0) { - *(op[1]++) = yuv[2]; - *(op[2]++) = yuv[1]; - } - rgb += 3; - } - } -} - -void -ConvertRGBtoNV12(Uint8 *rgb, Uint8 *out, int w, int h, - int monochrome, int luminance) -{ - int x, y; - int yuv[3]; - Uint8 *op[2]; - - op[0] = out; - op[1] = op[0] + w*h; - for (y = 0; y < h; ++y) { - for (x = 0; x < w; ++x) { - RGBtoYUV(rgb, yuv, monochrome, luminance); - *(op[0]++) = yuv[0]; - if (x % 2 == 0 && y % 2 == 0) { - *(op[1]++) = yuv[1]; - *(op[1]++) = yuv[2]; - } - rgb += 3; - } - } -} - static void PrintUsage(char *argv0) { @@ -307,7 +219,7 @@ loop() if (!paused) { i = (i + 1) % MOOSEFRAMES_COUNT; - SDL_UpdateTexture(MooseTexture, NULL, MooseFrame[i], MOOSEPIC_W*SDL_BYTESPERPIXEL(pixel_format)); + SDL_UpdateTexture(MooseTexture, NULL, MooseFrame[i], MOOSEPIC_W); } SDL_RenderClear(renderer); SDL_RenderCopy(renderer, MooseTexture, NULL, &displayrect); @@ -328,13 +240,7 @@ main(int argc, char **argv) SDL_Window *window; int j; int fps = 12; - int fpsdelay; int nodelay = 0; -#ifdef TEST_NV12 - Uint32 pixel_format = SDL_PIXELFORMAT_NV12; -#else - Uint32 pixel_format = SDL_PIXELFORMAT_YV12; -#endif int scale = 5; /* Enable standard application logging */ @@ -348,7 +254,7 @@ main(int argc, char **argv) while (argc > 1) { if (strcmp(argv[1], "-fps") == 0) { if (argv[2]) { - fps = atoi(argv[2]); + fps = SDL_atoi(argv[2]); if (fps == 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The -fps option requires an argument [from 1 to 1000], default is 12.\n"); @@ -372,7 +278,7 @@ main(int argc, char **argv) argc -= 1; } else if (strcmp(argv[1], "-scale") == 0) { if (argv[2]) { - scale = atoi(argv[2]); + scale = SDL_atoi(argv[2]); if (scale == 0) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "The -scale option requires an argument [from 1 to 50], default is 5.\n"); @@ -404,7 +310,6 @@ main(int argc, char **argv) RawMooseData = (Uint8 *) malloc(MOOSEFRAME_SIZE * MOOSEFRAMES_COUNT); if (RawMooseData == NULL) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Can't allocate memory for movie !\n"); - free(RawMooseData); quit(1); } @@ -441,7 +346,7 @@ main(int argc, char **argv) quit(4); } - MooseTexture = SDL_CreateTexture(renderer, pixel_format, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H); + MooseTexture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_YV12, SDL_TEXTUREACCESS_STREAMING, MOOSEPIC_W, MOOSEPIC_H); if (!MooseTexture) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError()); free(RawMooseData); @@ -463,17 +368,9 @@ main(int argc, char **argv) rgb[2] = MooseColors[frame[j]].b; rgb += 3; } - switch (pixel_format) { - case SDL_PIXELFORMAT_YV12: - ConvertRGBtoYV12(MooseFrameRGB, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, 0, 100); - break; - case SDL_PIXELFORMAT_NV12: - ConvertRGBtoNV12(MooseFrameRGB, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, 0, 100); - break; - default: - SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unsupported pixel format\n"); - break; - } + ConvertRGBtoYUV(SDL_PIXELFORMAT_YV12, MooseFrameRGB, MOOSEPIC_W*3, MooseFrame[i], MOOSEPIC_W, MOOSEPIC_H, + SDL_GetYUVConversionModeForResolution(MOOSEPIC_W, MOOSEPIC_H), + 0, 100); } free(RawMooseData); diff --git a/Engine/lib/sdl/test/testplatform.c b/Engine/lib/sdl/test/testplatform.c index 14acac4b1..84efab319 100644 --- a/Engine/lib/sdl/test/testplatform.c +++ b/Engine/lib/sdl/test/testplatform.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -30,6 +30,26 @@ TestTypes(SDL_bool verbose) { int error = 0; + SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT8, SDL_MAX_SINT8 == 127); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT8, SDL_MIN_SINT8 == -128); + SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT8, SDL_MAX_UINT8 == 255); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT8, SDL_MIN_UINT8 == 0); + + SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT16, SDL_MAX_SINT16 == 32767); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT16, SDL_MIN_SINT16 == -32768); + SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT16, SDL_MAX_UINT16 == 65535); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT16, SDL_MIN_UINT16 == 0); + + SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT32, SDL_MAX_SINT32 == 2147483647); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT32, SDL_MIN_SINT32 == ~0x7fffffff); /* Instead of -2147483648, which is treated as unsigned by some compilers */ + SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT32, SDL_MAX_UINT32 == 4294967295u); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT32, SDL_MIN_UINT32 == 0); + + SDL_COMPILE_TIME_ASSERT(SDL_MAX_SINT64, SDL_MAX_SINT64 == 9223372036854775807ll); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_SINT64, SDL_MIN_SINT64 == ~0x7fffffffffffffffll); /* Instead of -9223372036854775808, which is treated as unsigned by compilers */ + SDL_COMPILE_TIME_ASSERT(SDL_MAX_UINT64, SDL_MAX_UINT64 == 18446744073709551615ull); + SDL_COMPILE_TIME_ASSERT(SDL_MIN_UINT64, SDL_MIN_UINT64 == 0); + if (badsize(sizeof(Uint8), 1)) { if (verbose) SDL_Log("sizeof(Uint8) != 1, instead = %u\n", @@ -128,6 +148,220 @@ TestEndian(SDL_bool verbose) return (error ? 1 : 0); } +static int TST_allmul (void *a, void *b, int arg, void *result, void *expected) +{ + (*(long long *)result) = ((*(long long *)a) * (*(long long *)b)); + return (*(long long *)result) == (*(long long *)expected); +} + +static int TST_alldiv (void *a, void *b, int arg, void *result, void *expected) +{ + (*(long long *)result) = ((*(long long *)a) / (*(long long *)b)); + return (*(long long *)result) == (*(long long *)expected); +} + +static int TST_allrem (void *a, void *b, int arg, void *result, void *expected) +{ + (*(long long *)result) = ((*(long long *)a) % (*(long long *)b)); + return (*(long long *)result) == (*(long long *)expected); +} + +static int TST_ualldiv (void *a, void *b, int arg, void *result, void *expected) +{ + (*(unsigned long long *)result) = ((*(unsigned long long *)a) / (*(unsigned long long *)b)); + return (*(unsigned long long *)result) == (*(unsigned long long *)expected); +} + +static int TST_uallrem (void *a, void *b, int arg, void *result, void *expected) +{ + (*(unsigned long long *)result) = ((*(unsigned long long *)a) % (*(unsigned long long *)b)); + return (*(unsigned long long *)result) == (*(unsigned long long *)expected); +} + +static int TST_allshl (void *a, void *b, int arg, void *result, void *expected) +{ + (*(long long *)result) = (*(long long *)a) << arg; + return (*(long long *)result) == (*(long long *)expected); +} + +static int TST_aullshl (void *a, void *b, int arg, void *result, void *expected) +{ + (*(unsigned long long *)result) = (*(unsigned long long *)a) << arg; + return (*(unsigned long long *)result) == (*(unsigned long long *)expected); +} + +static int TST_allshr (void *a, void *b, int arg, void *result, void *expected) +{ + (*(long long *)result) = (*(long long *)a) >> arg; + return (*(long long *)result) == (*(long long *)expected); +} + +static int TST_aullshr (void *a, void *b, int arg, void *result, void *expected) +{ + (*(unsigned long long *)result) = (*(unsigned long long *)a) >> arg; + return (*(unsigned long long *)result) == (*(unsigned long long *)expected); +} + + +typedef int (*LL_Intrinsic)(void *a, void *b, int arg, void *result, void *expected); + +typedef struct { + const char *operation; + LL_Intrinsic routine; + unsigned long long a, b; + int arg; + unsigned long long expected_result; +} LL_Test; + +static LL_Test LL_Tests[] = +{ + /* UNDEFINED {"_allshl", &TST_allshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 65, 0x0000000000000000ll}, */ + {"_allshl", &TST_allshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 1, 0xFFFFFFFFFFFFFFFEll}, + {"_allshl", &TST_allshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 32, 0xFFFFFFFF00000000ll}, + {"_allshl", &TST_allshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 33, 0xFFFFFFFE00000000ll}, + {"_allshl", &TST_allshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 0, 0xFFFFFFFFFFFFFFFFll}, + + {"_allshr", &TST_allshr, 0xAAAAAAAA55555555ll, 0ll, 63, 0xFFFFFFFFFFFFFFFFll}, + /* UNDEFINED {"_allshr", &TST_allshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 65, 0xFFFFFFFFFFFFFFFFll}, */ + {"_allshr", &TST_allshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 1, 0xFFFFFFFFFFFFFFFFll}, + {"_allshr", &TST_allshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 32, 0xFFFFFFFFFFFFFFFFll}, + {"_allshr", &TST_allshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 33, 0xFFFFFFFFFFFFFFFFll}, + {"_allshr", &TST_allshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 0, 0xFFFFFFFFFFFFFFFFll}, + /* UNDEFINED {"_allshr", &TST_allshr, 0x5F5F5F5F5F5F5F5Fll, 0ll, 65, 0x0000000000000000ll}, */ + {"_allshr", &TST_allshr, 0x5F5F5F5F5F5F5F5Fll, 0ll, 1, 0x2FAFAFAFAFAFAFAFll}, + {"_allshr", &TST_allshr, 0x5F5F5F5F5F5F5F5Fll, 0ll, 32, 0x000000005F5F5F5Fll}, + {"_allshr", &TST_allshr, 0x5F5F5F5F5F5F5F5Fll, 0ll, 33, 0x000000002FAFAFAFll}, + + /* UNDEFINED {"_aullshl", &TST_aullshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 65, 0x0000000000000000ll}, */ + {"_aullshl", &TST_aullshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 1, 0xFFFFFFFFFFFFFFFEll}, + {"_aullshl", &TST_aullshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 32, 0xFFFFFFFF00000000ll}, + {"_aullshl", &TST_aullshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 33, 0xFFFFFFFE00000000ll}, + {"_aullshl", &TST_aullshl, 0xFFFFFFFFFFFFFFFFll, 0ll, 0, 0xFFFFFFFFFFFFFFFFll}, + + /* UNDEFINED {"_aullshr", &TST_aullshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 65, 0x0000000000000000ll}, */ + {"_aullshr", &TST_aullshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 1, 0x7FFFFFFFFFFFFFFFll}, + {"_aullshr", &TST_aullshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 32, 0x00000000FFFFFFFFll}, + {"_aullshr", &TST_aullshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 33, 0x000000007FFFFFFFll}, + {"_aullshr", &TST_aullshr, 0xFFFFFFFFFFFFFFFFll, 0ll, 0, 0xFFFFFFFFFFFFFFFFll}, + + {"_allmul", &TST_allmul, 0xFFFFFFFFFFFFFFFFll, 0x0000000000000000ll, 0, 0x0000000000000000ll}, + {"_allmul", &TST_allmul, 0x0000000000000000ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_allmul", &TST_allmul, 0x000000000FFFFFFFll, 0x0000000000000001ll, 0, 0x000000000FFFFFFFll}, + {"_allmul", &TST_allmul, 0x0000000000000001ll, 0x000000000FFFFFFFll, 0, 0x000000000FFFFFFFll}, + {"_allmul", &TST_allmul, 0x000000000FFFFFFFll, 0x0000000000000010ll, 0, 0x00000000FFFFFFF0ll}, + {"_allmul", &TST_allmul, 0x0000000000000010ll, 0x000000000FFFFFFFll, 0, 0x00000000FFFFFFF0ll}, + {"_allmul", &TST_allmul, 0x000000000FFFFFFFll, 0x0000000000000100ll, 0, 0x0000000FFFFFFF00ll}, + {"_allmul", &TST_allmul, 0x0000000000000100ll, 0x000000000FFFFFFFll, 0, 0x0000000FFFFFFF00ll}, + {"_allmul", &TST_allmul, 0x000000000FFFFFFFll, 0x0000000010000000ll, 0, 0x00FFFFFFF0000000ll}, + {"_allmul", &TST_allmul, 0x0000000010000000ll, 0x000000000FFFFFFFll, 0, 0x00FFFFFFF0000000ll}, + {"_allmul", &TST_allmul, 0x000000000FFFFFFFll, 0x0000000080000000ll, 0, 0x07FFFFFF80000000ll}, + {"_allmul", &TST_allmul, 0x0000000080000000ll, 0x000000000FFFFFFFll, 0, 0x07FFFFFF80000000ll}, + {"_allmul", &TST_allmul, 0xFFFFFFFFFFFFFFFEll, 0x0000000080000000ll, 0, 0xFFFFFFFF00000000ll}, + {"_allmul", &TST_allmul, 0x0000000080000000ll, 0xFFFFFFFFFFFFFFFEll, 0, 0xFFFFFFFF00000000ll}, + {"_allmul", &TST_allmul, 0xFFFFFFFFFFFFFFFEll, 0x0000000080000008ll, 0, 0xFFFFFFFEFFFFFFF0ll}, + {"_allmul", &TST_allmul, 0x0000000080000008ll, 0xFFFFFFFFFFFFFFFEll, 0, 0xFFFFFFFEFFFFFFF0ll}, + {"_allmul", &TST_allmul, 0x00000000FFFFFFFFll, 0x00000000FFFFFFFFll, 0, 0xFFFFFFFE00000001ll}, + + {"_alldiv", &TST_alldiv, 0x0000000000000000ll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_alldiv", &TST_alldiv, 0x0000000000000000ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_alldiv", &TST_alldiv, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0xFFFFFFFFFFFFFFFFll}, + {"_alldiv", &TST_alldiv, 0xFFFFFFFFFFFFFFFFll, 0x0000000000000001ll, 0, 0xFFFFFFFFFFFFFFFFll}, + {"_alldiv", &TST_alldiv, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0xFFFFFFFFFFFFFFFFll}, + {"_alldiv", &TST_alldiv, 0x0000000000000001ll, 0x0000000000000001ll, 0, 0x0000000000000001ll}, + {"_alldiv", &TST_alldiv, 0xFFFFFFFFFFFFFFFFll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000001ll}, + {"_alldiv", &TST_alldiv, 0x000000000FFFFFFFll, 0x0000000000000001ll, 0, 0x000000000FFFFFFFll}, + {"_alldiv", &TST_alldiv, 0x0000000FFFFFFFFFll, 0x0000000000000010ll, 0, 0x00000000FFFFFFFFll}, + {"_alldiv", &TST_alldiv, 0x0000000000000100ll, 0x000000000FFFFFFFll, 0, 0x0000000000000000ll}, + {"_alldiv", &TST_alldiv, 0x00FFFFFFF0000000ll, 0x0000000010000000ll, 0, 0x000000000FFFFFFFll}, + {"_alldiv", &TST_alldiv, 0x07FFFFFF80000000ll, 0x0000000080000000ll, 0, 0x000000000FFFFFFFll}, + {"_alldiv", &TST_alldiv, 0xFFFFFFFFFFFFFFFEll, 0x0000000080000000ll, 0, 0x0000000000000000ll}, + {"_alldiv", &TST_alldiv, 0xFFFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0x0000000080000008ll}, + {"_alldiv", &TST_alldiv, 0x7FFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0xC000000080000008ll}, + {"_alldiv", &TST_alldiv, 0x7FFFFFFEFFFFFFF0ll, 0x0000FFFFFFFFFFFEll, 0, 0x0000000000007FFFll}, + {"_alldiv", &TST_alldiv, 0x7FFFFFFEFFFFFFF0ll, 0x7FFFFFFEFFFFFFF0ll, 0, 0x0000000000000001ll}, + + {"_allrem", &TST_allrem, 0x0000000000000000ll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x0000000000000000ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0xFFFFFFFFFFFFFFFFll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x0000000000000001ll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0xFFFFFFFFFFFFFFFFll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x000000000FFFFFFFll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x0000000FFFFFFFFFll, 0x0000000000000010ll, 0, 0x000000000000000Fll}, + {"_allrem", &TST_allrem, 0x0000000000000100ll, 0x000000000FFFFFFFll, 0, 0x0000000000000100ll}, + {"_allrem", &TST_allrem, 0x00FFFFFFF0000000ll, 0x0000000010000000ll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x07FFFFFF80000000ll, 0x0000000080000000ll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0xFFFFFFFFFFFFFFFEll, 0x0000000080000000ll, 0, 0xFFFFFFFFFFFFFFFEll}, + {"_allrem", &TST_allrem, 0xFFFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x7FFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0x0000000000000000ll}, + {"_allrem", &TST_allrem, 0x7FFFFFFEFFFFFFF0ll, 0x0000FFFFFFFFFFFEll, 0, 0x0000FFFF0000FFEEll}, + {"_allrem", &TST_allrem, 0x7FFFFFFEFFFFFFF0ll, 0x7FFFFFFEFFFFFFF0ll, 0, 0x0000000000000000ll}, + + + {"_ualldiv", &TST_ualldiv, 0x0000000000000000ll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0x0000000000000000ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0xFFFFFFFFFFFFFFFFll, 0x0000000000000001ll, 0, 0xFFFFFFFFFFFFFFFFll}, + {"_ualldiv", &TST_ualldiv, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0x0000000000000001ll, 0x0000000000000001ll, 0, 0x0000000000000001ll}, + {"_ualldiv", &TST_ualldiv, 0xFFFFFFFFFFFFFFFFll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000001ll}, + {"_ualldiv", &TST_ualldiv, 0x000000000FFFFFFFll, 0x0000000000000001ll, 0, 0x000000000FFFFFFFll}, + {"_ualldiv", &TST_ualldiv, 0x0000000FFFFFFFFFll, 0x0000000000000010ll, 0, 0x00000000FFFFFFFFll}, + {"_ualldiv", &TST_ualldiv, 0x0000000000000100ll, 0x000000000FFFFFFFll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0x00FFFFFFF0000000ll, 0x0000000010000000ll, 0, 0x000000000FFFFFFFll}, + {"_ualldiv", &TST_ualldiv, 0x07FFFFFF80000000ll, 0x0000000080000000ll, 0, 0x000000000FFFFFFFll}, + {"_ualldiv", &TST_ualldiv, 0xFFFFFFFFFFFFFFFEll, 0x0000000080000000ll, 0, 0x00000001FFFFFFFFll}, + {"_ualldiv", &TST_ualldiv, 0xFFFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0x7FFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0x0000000000000000ll}, + {"_ualldiv", &TST_ualldiv, 0x7FFFFFFEFFFFFFF0ll, 0x0000FFFFFFFFFFFEll, 0, 0x0000000000007FFFll}, + {"_ualldiv", &TST_ualldiv, 0x7FFFFFFEFFFFFFF0ll, 0x7FFFFFFEFFFFFFF0ll, 0, 0x0000000000000001ll}, + + {"_uallrem", &TST_uallrem, 0x0000000000000000ll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0x0000000000000000ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000001ll}, + {"_uallrem", &TST_uallrem, 0xFFFFFFFFFFFFFFFFll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0x0000000000000001ll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000001ll}, + {"_uallrem", &TST_uallrem, 0x0000000000000001ll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0xFFFFFFFFFFFFFFFFll, 0xFFFFFFFFFFFFFFFFll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0x000000000FFFFFFFll, 0x0000000000000001ll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0x0000000FFFFFFFFFll, 0x0000000000000010ll, 0, 0x000000000000000Fll}, + {"_uallrem", &TST_uallrem, 0x0000000000000100ll, 0x000000000FFFFFFFll, 0, 0x0000000000000100ll}, + {"_uallrem", &TST_uallrem, 0x00FFFFFFF0000000ll, 0x0000000010000000ll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0x07FFFFFF80000000ll, 0x0000000080000000ll, 0, 0x0000000000000000ll}, + {"_uallrem", &TST_uallrem, 0xFFFFFFFFFFFFFFFEll, 0x0000000080000000ll, 0, 0x000000007FFFFFFEll}, + {"_uallrem", &TST_uallrem, 0xFFFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0xFFFFFFFEFFFFFFF0ll}, + {"_uallrem", &TST_uallrem, 0x7FFFFFFEFFFFFFF0ll, 0xFFFFFFFFFFFFFFFEll, 0, 0x7FFFFFFEFFFFFFF0ll}, + {"_uallrem", &TST_uallrem, 0x7FFFFFFEFFFFFFF0ll, 0x0000FFFFFFFFFFFEll, 0, 0x0000FFFF0000FFEEll}, + {"_uallrem", &TST_uallrem, 0x7FFFFFFEFFFFFFF0ll, 0x7FFFFFFEFFFFFFF0ll, 0, 0x0000000000000000ll}, + + {NULL} +}; + +int +Test64Bit (SDL_bool verbose) +{ + LL_Test *t; + int failed = 0; + + for (t = LL_Tests; t->routine != NULL; t++) { + unsigned long long result = 0; + unsigned int *al = (unsigned int *)&t->a; + unsigned int *bl = (unsigned int *)&t->b; + unsigned int *el = (unsigned int *)&t->expected_result; + unsigned int *rl = (unsigned int *)&result; + + if (!t->routine(&t->a, &t->b, t->arg, &result, &t->expected_result)) { + if (verbose) + SDL_Log("%s(0x%08X%08X, 0x%08X%08X, %3d, produced: 0x%08X%08X, expected: 0x%08X%08X\n", + t->operation, al[1], al[0], bl[1], bl[0], t->arg, rl[1], rl[0], el[1], el[0]); + ++failed; + } + } + if (verbose && (failed == 0)) + SDL_Log("All 64bit instrinsic tests passed\n"); + return (failed ? 1 : 0); +} int TestCPUInfo(SDL_bool verbose) @@ -145,6 +379,8 @@ TestCPUInfo(SDL_bool verbose) SDL_Log("SSE4.1 %s\n", SDL_HasSSE41()? "detected" : "not detected"); SDL_Log("SSE4.2 %s\n", SDL_HasSSE42()? "detected" : "not detected"); SDL_Log("AVX %s\n", SDL_HasAVX()? "detected" : "not detected"); + SDL_Log("AVX2 %s\n", SDL_HasAVX2()? "detected" : "not detected"); + SDL_Log("NEON %s\n", SDL_HasNEON()? "detected" : "not detected"); SDL_Log("System RAM %d MB\n", SDL_GetSystemRAM()); } return (0); @@ -197,6 +433,7 @@ main(int argc, char *argv[]) status += TestTypes(verbose); status += TestEndian(verbose); + status += Test64Bit(verbose); status += TestCPUInfo(verbose); status += TestAssertions(verbose); diff --git a/Engine/lib/sdl/test/testpower.c b/Engine/lib/sdl/test/testpower.c index 300d21a24..adb58832a 100644 --- a/Engine/lib/sdl/test/testpower.c +++ b/Engine/lib/sdl/test/testpower.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testqsort.c b/Engine/lib/sdl/test/testqsort.c index 48659f307..e83b0731e 100644 --- a/Engine/lib/sdl/test/testqsort.c +++ b/Engine/lib/sdl/test/testqsort.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testrelative.c b/Engine/lib/sdl/test/testrelative.c index 59d23f638..816329ff5 100644 --- a/Engine/lib/sdl/test/testrelative.c +++ b/Engine/lib/sdl/test/testrelative.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testrendercopyex.c b/Engine/lib/sdl/test/testrendercopyex.c index e34890245..209a35157 100644 --- a/Engine/lib/sdl/test/testrendercopyex.c +++ b/Engine/lib/sdl/test/testrendercopyex.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testrendertarget.c b/Engine/lib/sdl/test/testrendertarget.c index c5e1dce05..7d24d8aea 100644 --- a/Engine/lib/sdl/test/testrendertarget.c +++ b/Engine/lib/sdl/test/testrendertarget.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testresample.c b/Engine/lib/sdl/test/testresample.c index 0e92bbe11..bcdaa669a 100644 --- a/Engine/lib/sdl/test/testresample.c +++ b/Engine/lib/sdl/test/testresample.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -20,6 +20,7 @@ main(int argc, char **argv) Uint32 len = 0; Uint8 *data = NULL; int cvtfreq = 0; + int cvtchans = 0; int bitsize = 0; int blockalign = 0; int avgbytes = 0; @@ -28,12 +29,13 @@ main(int argc, char **argv) /* Enable standard application logging */ SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); - if (argc != 4) { - SDL_Log("USAGE: %s in.wav out.wav newfreq\n", argv[0]); + if (argc != 5) { + SDL_Log("USAGE: %s in.wav out.wav newfreq newchans\n", argv[0]); return 1; } cvtfreq = SDL_atoi(argv[3]); + cvtchans = SDL_atoi(argv[4]); if (SDL_Init(SDL_INIT_AUDIO) == -1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init() failed: %s\n", SDL_GetError()); @@ -47,7 +49,7 @@ main(int argc, char **argv) } if (SDL_BuildAudioCVT(&cvt, spec.format, spec.channels, spec.freq, - spec.format, spec.channels, cvtfreq) == -1) { + spec.format, cvtchans, cvtfreq) == -1) { SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "failed to build CVT: %s\n", SDL_GetError()); SDL_FreeWAV(data); SDL_Quit(); @@ -83,16 +85,16 @@ main(int argc, char **argv) } bitsize = SDL_AUDIO_BITSIZE(spec.format); - blockalign = (bitsize / 8) * spec.channels; + blockalign = (bitsize / 8) * cvtchans; avgbytes = cvtfreq * blockalign; SDL_WriteLE32(io, 0x46464952); /* RIFF */ - SDL_WriteLE32(io, len * cvt.len_mult + 36); + SDL_WriteLE32(io, cvt.len_cvt + 36); SDL_WriteLE32(io, 0x45564157); /* WAVE */ SDL_WriteLE32(io, 0x20746D66); /* fmt */ SDL_WriteLE32(io, 16); /* chunk size */ SDL_WriteLE16(io, 1); /* uncompressed */ - SDL_WriteLE16(io, spec.channels); /* channels */ + SDL_WriteLE16(io, cvtchans); /* channels */ SDL_WriteLE32(io, cvtfreq); /* sample rate */ SDL_WriteLE32(io, avgbytes); /* average bytes per second */ SDL_WriteLE16(io, blockalign); /* block align */ diff --git a/Engine/lib/sdl/test/testrumble.c b/Engine/lib/sdl/test/testrumble.c index ea7466d2d..908a6aafb 100644 --- a/Engine/lib/sdl/test/testrumble.c +++ b/Engine/lib/sdl/test/testrumble.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -54,6 +54,7 @@ main(int argc, char **argv) name = NULL; index = -1; if (argc > 1) { + size_t l; name = argv[1]; if ((strcmp(name, "--help") == 0) || (strcmp(name, "-h") == 0)) { SDL_Log("USAGE: %s [device]\n" @@ -63,9 +64,9 @@ main(int argc, char **argv) return 0; } - i = strlen(name); - if ((i < 3) && isdigit(name[0]) && ((i == 1) || isdigit(name[1]))) { - index = atoi(name); + l = SDL_strlen(name); + if ((l < 3) && SDL_isdigit(name[0]) && ((l == 1) || SDL_isdigit(name[1]))) { + index = SDL_atoi(name); name = NULL; } } diff --git a/Engine/lib/sdl/test/testscale.c b/Engine/lib/sdl/test/testscale.c index 9f5fdbff1..e1b46fcc8 100644 --- a/Engine/lib/sdl/test/testscale.c +++ b/Engine/lib/sdl/test/testscale.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testsem.c b/Engine/lib/sdl/test/testsem.c index b8d3b2749..884763e6a 100644 --- a/Engine/lib/sdl/test/testsem.c +++ b/Engine/lib/sdl/test/testsem.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testshader.c b/Engine/lib/sdl/test/testshader.c index fc6da2987..ee0ccdad2 100644 --- a/Engine/lib/sdl/test/testshader.c +++ b/Engine/lib/sdl/test/testshader.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testshape.c b/Engine/lib/sdl/test/testshape.c index 476fac21e..7e451e667 100644 --- a/Engine/lib/sdl/test/testshape.c +++ b/Engine/lib/sdl/test/testshape.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -48,7 +48,6 @@ int main(int argc,char** argv) SDL_Renderer *renderer; SDL_Color black = {0,0,0,0xff}; SDL_Event event; - int event_pending = 0; int should_exit = 0; unsigned int current_picture; int button_down; @@ -81,7 +80,6 @@ int main(int argc,char** argv) pictures[i].surface = SDL_LoadBMP(argv[i+1]); pictures[i].name = argv[i+1]; if(pictures[i].surface == NULL) { - j = 0; for(j=0;j + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -99,7 +99,12 @@ LoadSprite(const char *file) SDL_FreeSurface(temp); return (-1); } - SDL_SetTextureBlendMode(sprites[i], blendMode); + if (SDL_SetTextureBlendMode(sprites[i], blendMode) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set blend mode: %s\n", SDL_GetError()); + SDL_FreeSurface(temp); + SDL_DestroyTexture(sprites[i]); + return (-1); + } } SDL_FreeSurface(temp); @@ -295,6 +300,9 @@ main(int argc, char *argv[]) } else if (SDL_strcasecmp(argv[i + 1], "mod") == 0) { blendMode = SDL_BLENDMODE_MOD; consumed = 2; + } else if (SDL_strcasecmp(argv[i + 1], "sub") == 0) { + blendMode = SDL_ComposeCustomBlendMode(SDL_BLENDFACTOR_SRC_ALPHA, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_SUBTRACT, SDL_BLENDFACTOR_ZERO, SDL_BLENDFACTOR_ONE, SDL_BLENDOPERATION_SUBTRACT); + consumed = 2; } } } else if (SDL_strcasecmp(argv[i], "--iterations") == 0) { diff --git a/Engine/lib/sdl/test/testspriteminimal.c b/Engine/lib/sdl/test/testspriteminimal.c index 05f97309c..92560002a 100644 --- a/Engine/lib/sdl/test/testspriteminimal.c +++ b/Engine/lib/sdl/test/testspriteminimal.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/teststreaming.c b/Engine/lib/sdl/test/teststreaming.c index 86cc13917..7ec689106 100644 --- a/Engine/lib/sdl/test/teststreaming.c +++ b/Engine/lib/sdl/test/teststreaming.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testthread.c b/Engine/lib/sdl/test/testthread.c index 90e2c60c5..cdccfc499 100644 --- a/Engine/lib/sdl/test/testthread.c +++ b/Engine/lib/sdl/test/testthread.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testtimer.c b/Engine/lib/sdl/test/testtimer.c index 32b749098..34764c1c9 100644 --- a/Engine/lib/sdl/test/testtimer.c +++ b/Engine/lib/sdl/test/testtimer.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testver.c b/Engine/lib/sdl/test/testver.c index f0e3bcf3c..1ae008345 100644 --- a/Engine/lib/sdl/test/testver.c +++ b/Engine/lib/sdl/test/testver.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testviewport.c b/Engine/lib/sdl/test/testviewport.c index 7ed4e6ec3..4b8d20e76 100644 --- a/Engine/lib/sdl/test/testviewport.c +++ b/Engine/lib/sdl/test/testviewport.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testvulkan.c b/Engine/lib/sdl/test/testvulkan.c new file mode 100644 index 000000000..73a21859a --- /dev/null +++ b/Engine/lib/sdl/test/testvulkan.c @@ -0,0 +1,1201 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ +#include +#include +#include +#include + +#include "SDL_test_common.h" + +#if defined(__ANDROID__) && defined(__ARM_EABI__) && !defined(__ARM_ARCH_7A__) + +int main(int argc, char *argv[]) +{ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "No Vulkan support on this system\n"); + return 1; +} + +#else + +#define VK_NO_PROTOTYPES +#ifdef HAVE_VULKAN_H +#include +#else +/* SDL includes a copy for building on systems without the Vulkan SDK */ +#include "../src/video/khronos/vulkan/vulkan.h" +#endif +#include "SDL_vulkan.h" + +#ifndef UINT64_MAX /* VS2008 */ +#define UINT64_MAX 18446744073709551615 +#endif + +#define VULKAN_FUNCTIONS() \ + VULKAN_DEVICE_FUNCTION(vkAcquireNextImageKHR) \ + VULKAN_DEVICE_FUNCTION(vkAllocateCommandBuffers) \ + VULKAN_DEVICE_FUNCTION(vkBeginCommandBuffer) \ + VULKAN_DEVICE_FUNCTION(vkCmdClearColorImage) \ + VULKAN_DEVICE_FUNCTION(vkCmdPipelineBarrier) \ + VULKAN_DEVICE_FUNCTION(vkCreateCommandPool) \ + VULKAN_DEVICE_FUNCTION(vkCreateFence) \ + VULKAN_DEVICE_FUNCTION(vkCreateImageView) \ + VULKAN_DEVICE_FUNCTION(vkCreateSemaphore) \ + VULKAN_DEVICE_FUNCTION(vkCreateSwapchainKHR) \ + VULKAN_DEVICE_FUNCTION(vkDestroyCommandPool) \ + VULKAN_DEVICE_FUNCTION(vkDestroyDevice) \ + VULKAN_DEVICE_FUNCTION(vkDestroyFence) \ + VULKAN_DEVICE_FUNCTION(vkDestroyImageView) \ + VULKAN_DEVICE_FUNCTION(vkDestroySemaphore) \ + VULKAN_DEVICE_FUNCTION(vkDestroySwapchainKHR) \ + VULKAN_DEVICE_FUNCTION(vkDeviceWaitIdle) \ + VULKAN_DEVICE_FUNCTION(vkEndCommandBuffer) \ + VULKAN_DEVICE_FUNCTION(vkFreeCommandBuffers) \ + VULKAN_DEVICE_FUNCTION(vkGetDeviceQueue) \ + VULKAN_DEVICE_FUNCTION(vkGetFenceStatus) \ + VULKAN_DEVICE_FUNCTION(vkGetSwapchainImagesKHR) \ + VULKAN_DEVICE_FUNCTION(vkQueuePresentKHR) \ + VULKAN_DEVICE_FUNCTION(vkQueueSubmit) \ + VULKAN_DEVICE_FUNCTION(vkResetCommandBuffer) \ + VULKAN_DEVICE_FUNCTION(vkResetFences) \ + VULKAN_DEVICE_FUNCTION(vkWaitForFences) \ + VULKAN_GLOBAL_FUNCTION(vkCreateInstance) \ + VULKAN_GLOBAL_FUNCTION(vkEnumerateInstanceExtensionProperties) \ + VULKAN_GLOBAL_FUNCTION(vkEnumerateInstanceLayerProperties) \ + VULKAN_INSTANCE_FUNCTION(vkCreateDevice) \ + VULKAN_INSTANCE_FUNCTION(vkDestroyInstance) \ + VULKAN_INSTANCE_FUNCTION(vkDestroySurfaceKHR) \ + VULKAN_INSTANCE_FUNCTION(vkEnumerateDeviceExtensionProperties) \ + VULKAN_INSTANCE_FUNCTION(vkEnumeratePhysicalDevices) \ + VULKAN_INSTANCE_FUNCTION(vkGetDeviceProcAddr) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceFeatures) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceProperties) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceQueueFamilyProperties) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfaceCapabilitiesKHR) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfaceFormatsKHR) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfacePresentModesKHR) \ + VULKAN_INSTANCE_FUNCTION(vkGetPhysicalDeviceSurfaceSupportKHR) + +#define VULKAN_DEVICE_FUNCTION(name) static PFN_##name name = NULL; +#define VULKAN_GLOBAL_FUNCTION(name) static PFN_##name name = NULL; +#define VULKAN_INSTANCE_FUNCTION(name) static PFN_##name name = NULL; +VULKAN_FUNCTIONS() +#undef VULKAN_DEVICE_FUNCTION +#undef VULKAN_GLOBAL_FUNCTION +#undef VULKAN_INSTANCE_FUNCTION +static PFN_vkGetInstanceProcAddr vkGetInstanceProcAddr = NULL; + +/* Based on the headers found in + * https://github.com/KhronosGroup/Vulkan-LoaderAndValidationLayers + */ +#if VK_HEADER_VERSION < 22 +enum +{ + VK_ERROR_FRAGMENTED_POOL = -12, +}; +#endif +#if VK_HEADER_VERSION < 38 +enum { + VK_ERROR_OUT_OF_POOL_MEMORY_KHR = -1000069000 +}; +#endif + +static const char *getVulkanResultString(VkResult result) +{ + switch((int)result) + { + case VK_SUCCESS: + return "VK_SUCCESS"; + case VK_NOT_READY: + return "VK_NOT_READY"; + case VK_TIMEOUT: + return "VK_TIMEOUT"; + case VK_EVENT_SET: + return "VK_EVENT_SET"; + case VK_EVENT_RESET: + return "VK_EVENT_RESET"; + case VK_INCOMPLETE: + return "VK_INCOMPLETE"; + case VK_ERROR_OUT_OF_HOST_MEMORY: + return "VK_ERROR_OUT_OF_HOST_MEMORY"; + case VK_ERROR_OUT_OF_DEVICE_MEMORY: + return "VK_ERROR_OUT_OF_DEVICE_MEMORY"; + case VK_ERROR_INITIALIZATION_FAILED: + return "VK_ERROR_INITIALIZATION_FAILED"; + case VK_ERROR_DEVICE_LOST: + return "VK_ERROR_DEVICE_LOST"; + case VK_ERROR_MEMORY_MAP_FAILED: + return "VK_ERROR_MEMORY_MAP_FAILED"; + case VK_ERROR_LAYER_NOT_PRESENT: + return "VK_ERROR_LAYER_NOT_PRESENT"; + case VK_ERROR_EXTENSION_NOT_PRESENT: + return "VK_ERROR_EXTENSION_NOT_PRESENT"; + case VK_ERROR_FEATURE_NOT_PRESENT: + return "VK_ERROR_FEATURE_NOT_PRESENT"; + case VK_ERROR_INCOMPATIBLE_DRIVER: + return "VK_ERROR_INCOMPATIBLE_DRIVER"; + case VK_ERROR_TOO_MANY_OBJECTS: + return "VK_ERROR_TOO_MANY_OBJECTS"; + case VK_ERROR_FORMAT_NOT_SUPPORTED: + return "VK_ERROR_FORMAT_NOT_SUPPORTED"; + case VK_ERROR_FRAGMENTED_POOL: + return "VK_ERROR_FRAGMENTED_POOL"; + case VK_ERROR_SURFACE_LOST_KHR: + return "VK_ERROR_SURFACE_LOST_KHR"; + case VK_ERROR_NATIVE_WINDOW_IN_USE_KHR: + return "VK_ERROR_NATIVE_WINDOW_IN_USE_KHR"; + case VK_SUBOPTIMAL_KHR: + return "VK_SUBOPTIMAL_KHR"; + case VK_ERROR_OUT_OF_DATE_KHR: + return "VK_ERROR_OUT_OF_DATE_KHR"; + case VK_ERROR_INCOMPATIBLE_DISPLAY_KHR: + return "VK_ERROR_INCOMPATIBLE_DISPLAY_KHR"; + case VK_ERROR_VALIDATION_FAILED_EXT: + return "VK_ERROR_VALIDATION_FAILED_EXT"; + case VK_ERROR_OUT_OF_POOL_MEMORY_KHR: + return "VK_ERROR_OUT_OF_POOL_MEMORY_KHR"; + case VK_ERROR_INVALID_SHADER_NV: + return "VK_ERROR_INVALID_SHADER_NV"; + case VK_RESULT_MAX_ENUM: + case VK_RESULT_RANGE_SIZE: + break; + } + if(result < 0) + return "VK_ERROR_"; + return "VK_"; +} + +typedef struct VulkanContext +{ + VkInstance instance; + VkDevice device; + VkSurfaceKHR surface; + VkSwapchainKHR swapchain; + VkPhysicalDeviceProperties physicalDeviceProperties; + VkPhysicalDeviceFeatures physicalDeviceFeatures; + uint32_t graphicsQueueFamilyIndex; + uint32_t presentQueueFamilyIndex; + VkPhysicalDevice physicalDevice; + VkQueue graphicsQueue; + VkQueue presentQueue; + VkSemaphore imageAvailableSemaphore; + VkSemaphore renderingFinishedSemaphore; + VkSurfaceCapabilitiesKHR surfaceCapabilities; + VkSurfaceFormatKHR *surfaceFormats; + uint32_t surfaceFormatsAllocatedCount; + uint32_t surfaceFormatsCount; + uint32_t swapchainDesiredImageCount; + VkSurfaceFormatKHR surfaceFormat; + VkExtent2D swapchainSize; + VkCommandPool commandPool; + uint32_t swapchainImageCount; + VkImage *swapchainImages; + VkCommandBuffer *commandBuffers; + VkFence *fences; +} VulkanContext; + +static SDLTest_CommonState *state; +static VulkanContext vulkanContext = {0}; + +static void shutdownVulkan(void); + +/* Call this instead of exit(), so we can clean up SDL: atexit() is evil. */ +static void quit(int rc) +{ + shutdownVulkan(); + SDLTest_CommonQuit(state); + exit(rc); +} + +static void loadGlobalFunctions(void) +{ + vkGetInstanceProcAddr = SDL_Vulkan_GetVkGetInstanceProcAddr(); + if(!vkGetInstanceProcAddr) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "SDL_Vulkan_GetVkGetInstanceProcAddr(): %s\n", + SDL_GetError()); + quit(2); + } + +#define VULKAN_DEVICE_FUNCTION(name) +#define VULKAN_GLOBAL_FUNCTION(name) \ + name = (PFN_##name)vkGetInstanceProcAddr(VK_NULL_HANDLE, #name); \ + if(!name) \ + { \ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, \ + "vkGetInstanceProcAddr(VK_NULL_HANDLE, \"" #name "\") failed\n"); \ + quit(2); \ + } +#define VULKAN_INSTANCE_FUNCTION(name) + VULKAN_FUNCTIONS() +#undef VULKAN_DEVICE_FUNCTION +#undef VULKAN_GLOBAL_FUNCTION +#undef VULKAN_INSTANCE_FUNCTION +} + +static void createInstance(void) +{ + VkApplicationInfo appInfo = {0}; + VkInstanceCreateInfo instanceCreateInfo = {0}; + const char **extensions = NULL; + unsigned extensionCount = 0; + VkResult result; + + + appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO; + appInfo.apiVersion = VK_API_VERSION_1_0; + instanceCreateInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO; + instanceCreateInfo.pApplicationInfo = &appInfo; + if(!SDL_Vulkan_GetInstanceExtensions(state->windows[0], &extensionCount, NULL)) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "SDL_Vulkan_GetInstanceExtensions(): %s\n", + SDL_GetError()); + quit(2); + } + extensions = SDL_malloc(sizeof(const char *) * extensionCount); + if(!extensions) + { + SDL_OutOfMemory(); + quit(2); + } + if(!SDL_Vulkan_GetInstanceExtensions(state->windows[0], &extensionCount, extensions)) + { + SDL_free((void*)extensions); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "SDL_Vulkan_GetInstanceExtensions(): %s\n", + SDL_GetError()); + quit(2); + } + instanceCreateInfo.enabledExtensionCount = extensionCount; + instanceCreateInfo.ppEnabledExtensionNames = extensions; + result = vkCreateInstance(&instanceCreateInfo, NULL, &vulkanContext.instance); + SDL_free((void*)extensions); + if(result != VK_SUCCESS) + { + vulkanContext.instance = VK_NULL_HANDLE; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkCreateInstance(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static void loadInstanceFunctions(void) +{ +#define VULKAN_DEVICE_FUNCTION(name) +#define VULKAN_GLOBAL_FUNCTION(name) +#define VULKAN_INSTANCE_FUNCTION(name) \ + name = (PFN_##name)vkGetInstanceProcAddr(vulkanContext.instance, #name); \ + if(!name) \ + { \ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, \ + "vkGetInstanceProcAddr(instance, \"" #name "\") failed\n"); \ + quit(2); \ + } + VULKAN_FUNCTIONS() +#undef VULKAN_DEVICE_FUNCTION +#undef VULKAN_GLOBAL_FUNCTION +#undef VULKAN_INSTANCE_FUNCTION +} + +static void createSurface(void) +{ + if(!SDL_Vulkan_CreateSurface(state->windows[0], + vulkanContext.instance, + &vulkanContext.surface)) + { + vulkanContext.surface = VK_NULL_HANDLE; + SDL_LogError( + SDL_LOG_CATEGORY_APPLICATION, "SDL_Vulkan_CreateSurface(): %s\n", SDL_GetError()); + quit(2); + } +} + +static void findPhysicalDevice(void) +{ + uint32_t physicalDeviceCount = 0; + VkPhysicalDevice *physicalDevices; + VkQueueFamilyProperties *queueFamiliesProperties = NULL; + uint32_t queueFamiliesPropertiesAllocatedSize = 0; + VkExtensionProperties *deviceExtensions = NULL; + uint32_t deviceExtensionsAllocatedSize = 0; + uint32_t physicalDeviceIndex; + + VkResult result = + vkEnumeratePhysicalDevices(vulkanContext.instance, &physicalDeviceCount, NULL); + if(result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkEnumeratePhysicalDevices(): %s\n", + getVulkanResultString(result)); + quit(2); + } + if(physicalDeviceCount == 0) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkEnumeratePhysicalDevices(): no physical devices\n"); + quit(2); + } + physicalDevices = SDL_malloc(sizeof(VkPhysicalDevice) * physicalDeviceCount); + if(!physicalDevices) + { + SDL_OutOfMemory(); + quit(2); + } + result = + vkEnumeratePhysicalDevices(vulkanContext.instance, &physicalDeviceCount, physicalDevices); + if(result != VK_SUCCESS) + { + SDL_free(physicalDevices); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkEnumeratePhysicalDevices(): %s\n", + getVulkanResultString(result)); + quit(2); + } + vulkanContext.physicalDevice = NULL; + for(physicalDeviceIndex = 0; physicalDeviceIndex < physicalDeviceCount; + physicalDeviceIndex++) + { + uint32_t queueFamiliesCount = 0; + uint32_t queueFamilyIndex; + uint32_t deviceExtensionCount = 0; + SDL_bool hasSwapchainExtension = SDL_FALSE; + uint32_t i; + + + VkPhysicalDevice physicalDevice = physicalDevices[physicalDeviceIndex]; + vkGetPhysicalDeviceProperties(physicalDevice, &vulkanContext.physicalDeviceProperties); + if(VK_VERSION_MAJOR(vulkanContext.physicalDeviceProperties.apiVersion) < 1) + continue; + vkGetPhysicalDeviceFeatures(physicalDevice, &vulkanContext.physicalDeviceFeatures); + vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, &queueFamiliesCount, NULL); + if(queueFamiliesCount == 0) + continue; + if(queueFamiliesPropertiesAllocatedSize < queueFamiliesCount) + { + SDL_free(queueFamiliesProperties); + queueFamiliesPropertiesAllocatedSize = queueFamiliesCount; + queueFamiliesProperties = + SDL_malloc(sizeof(VkQueueFamilyProperties) * queueFamiliesPropertiesAllocatedSize); + if(!queueFamiliesProperties) + { + SDL_free(physicalDevices); + SDL_free(deviceExtensions); + SDL_OutOfMemory(); + quit(2); + } + } + vkGetPhysicalDeviceQueueFamilyProperties( + physicalDevice, &queueFamiliesCount, queueFamiliesProperties); + vulkanContext.graphicsQueueFamilyIndex = queueFamiliesCount; + vulkanContext.presentQueueFamilyIndex = queueFamiliesCount; + for(queueFamilyIndex = 0; queueFamilyIndex < queueFamiliesCount; + queueFamilyIndex++) + { + VkBool32 supported = 0; + + if(queueFamiliesProperties[queueFamilyIndex].queueCount == 0) + continue; + if(queueFamiliesProperties[queueFamilyIndex].queueFlags & VK_QUEUE_GRAPHICS_BIT) + vulkanContext.graphicsQueueFamilyIndex = queueFamilyIndex; + result = vkGetPhysicalDeviceSurfaceSupportKHR( + physicalDevice, queueFamilyIndex, vulkanContext.surface, &supported); + if(result != VK_SUCCESS) + { + SDL_free(physicalDevices); + SDL_free(queueFamiliesProperties); + SDL_free(deviceExtensions); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkGetPhysicalDeviceSurfaceSupportKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + if(supported) + { + vulkanContext.presentQueueFamilyIndex = queueFamilyIndex; + if(queueFamiliesProperties[queueFamilyIndex].queueFlags & VK_QUEUE_GRAPHICS_BIT) + break; // use this queue because it can present and do graphics + } + } + if(vulkanContext.graphicsQueueFamilyIndex == queueFamiliesCount) // no good queues found + continue; + if(vulkanContext.presentQueueFamilyIndex == queueFamiliesCount) // no good queues found + continue; + result = + vkEnumerateDeviceExtensionProperties(physicalDevice, NULL, &deviceExtensionCount, NULL); + if(result != VK_SUCCESS) + { + SDL_free(physicalDevices); + SDL_free(queueFamiliesProperties); + SDL_free(deviceExtensions); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkEnumerateDeviceExtensionProperties(): %s\n", + getVulkanResultString(result)); + quit(2); + } + if(deviceExtensionCount == 0) + continue; + if(deviceExtensionsAllocatedSize < deviceExtensionCount) + { + SDL_free(deviceExtensions); + deviceExtensionsAllocatedSize = deviceExtensionCount; + deviceExtensions = + SDL_malloc(sizeof(VkExtensionProperties) * deviceExtensionsAllocatedSize); + if(!deviceExtensions) + { + SDL_free(physicalDevices); + SDL_free(queueFamiliesProperties); + SDL_OutOfMemory(); + quit(2); + } + } + result = vkEnumerateDeviceExtensionProperties( + physicalDevice, NULL, &deviceExtensionCount, deviceExtensions); + if(result != VK_SUCCESS) + { + SDL_free(physicalDevices); + SDL_free(queueFamiliesProperties); + SDL_free(deviceExtensions); + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkEnumerateDeviceExtensionProperties(): %s\n", + getVulkanResultString(result)); + quit(2); + } + for(i = 0; i < deviceExtensionCount; i++) + { + if(0 == SDL_strcmp(deviceExtensions[i].extensionName, VK_KHR_SWAPCHAIN_EXTENSION_NAME)) + { + hasSwapchainExtension = SDL_TRUE; + break; + } + } + if(!hasSwapchainExtension) + continue; + vulkanContext.physicalDevice = physicalDevice; + break; + } + SDL_free(physicalDevices); + SDL_free(queueFamiliesProperties); + SDL_free(deviceExtensions); + if(!vulkanContext.physicalDevice) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Vulkan: no viable physical devices found"); + quit(2); + } +} + +static void createDevice(void) +{ + VkDeviceQueueCreateInfo deviceQueueCreateInfo[1] = {0}; + static const float queuePriority[] = {1.0f}; + VkDeviceCreateInfo deviceCreateInfo = {0}; + static const char *const deviceExtensionNames[] = { + VK_KHR_SWAPCHAIN_EXTENSION_NAME, + }; + VkResult result; + + deviceQueueCreateInfo->sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO; + deviceQueueCreateInfo->queueFamilyIndex = vulkanContext.graphicsQueueFamilyIndex; + deviceQueueCreateInfo->queueCount = 1; + deviceQueueCreateInfo->pQueuePriorities = &queuePriority[0]; + + deviceCreateInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO; + deviceCreateInfo.queueCreateInfoCount = 1; + deviceCreateInfo.pQueueCreateInfos = deviceQueueCreateInfo; + deviceCreateInfo.pEnabledFeatures = NULL; + deviceCreateInfo.enabledExtensionCount = SDL_arraysize(deviceExtensionNames); + deviceCreateInfo.ppEnabledExtensionNames = deviceExtensionNames; + result = vkCreateDevice( + vulkanContext.physicalDevice, &deviceCreateInfo, NULL, &vulkanContext.device); + if(result != VK_SUCCESS) + { + vulkanContext.device = VK_NULL_HANDLE; + SDL_LogError( + SDL_LOG_CATEGORY_APPLICATION, "vkCreateDevice(): %s\n", getVulkanResultString(result)); + quit(2); + } +} + +static void loadDeviceFunctions(void) +{ +#define VULKAN_DEVICE_FUNCTION(name) \ + name = (PFN_##name)vkGetDeviceProcAddr(vulkanContext.device, #name); \ + if(!name) \ + { \ + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, \ + "vkGetDeviceProcAddr(device, \"" #name "\") failed\n"); \ + quit(2); \ + } +#define VULKAN_GLOBAL_FUNCTION(name) +#define VULKAN_INSTANCE_FUNCTION(name) + VULKAN_FUNCTIONS() +#undef VULKAN_DEVICE_FUNCTION +#undef VULKAN_GLOBAL_FUNCTION +#undef VULKAN_INSTANCE_FUNCTION +} + +#undef VULKAN_FUNCTIONS + +static void getQueues(void) +{ + vkGetDeviceQueue(vulkanContext.device, + vulkanContext.graphicsQueueFamilyIndex, + 0, + &vulkanContext.graphicsQueue); + if(vulkanContext.graphicsQueueFamilyIndex != vulkanContext.presentQueueFamilyIndex) + vkGetDeviceQueue(vulkanContext.device, + vulkanContext.presentQueueFamilyIndex, + 0, + &vulkanContext.presentQueue); + else + vulkanContext.presentQueue = vulkanContext.graphicsQueue; +} + +static void createSemaphore(VkSemaphore *semaphore) +{ + VkResult result; + + VkSemaphoreCreateInfo createInfo = {0}; + createInfo.sType = VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO; + result = vkCreateSemaphore(vulkanContext.device, &createInfo, NULL, semaphore); + if(result != VK_SUCCESS) + { + *semaphore = VK_NULL_HANDLE; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkCreateSemaphore(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static void createSemaphores(void) +{ + createSemaphore(&vulkanContext.imageAvailableSemaphore); + createSemaphore(&vulkanContext.renderingFinishedSemaphore); +} + +static void getSurfaceCaps(void) +{ + VkResult result = vkGetPhysicalDeviceSurfaceCapabilitiesKHR( + vulkanContext.physicalDevice, vulkanContext.surface, &vulkanContext.surfaceCapabilities); + if(result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkGetPhysicalDeviceSurfaceCapabilitiesKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + + // check surface usage + if(!(vulkanContext.surfaceCapabilities.supportedUsageFlags & VK_IMAGE_USAGE_TRANSFER_DST_BIT)) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "Vulkan surface doesn't support VK_IMAGE_USAGE_TRANSFER_DST_BIT\n"); + quit(2); + } +} + +static void getSurfaceFormats(void) +{ + VkResult result = vkGetPhysicalDeviceSurfaceFormatsKHR(vulkanContext.physicalDevice, + vulkanContext.surface, + &vulkanContext.surfaceFormatsCount, + NULL); + if(result != VK_SUCCESS) + { + vulkanContext.surfaceFormatsCount = 0; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkGetPhysicalDeviceSurfaceFormatsKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + if(vulkanContext.surfaceFormatsCount > vulkanContext.surfaceFormatsAllocatedCount) + { + vulkanContext.surfaceFormatsAllocatedCount = vulkanContext.surfaceFormatsCount; + SDL_free(vulkanContext.surfaceFormats); + vulkanContext.surfaceFormats = + SDL_malloc(sizeof(VkSurfaceFormatKHR) * vulkanContext.surfaceFormatsAllocatedCount); + if(!vulkanContext.surfaceFormats) + { + vulkanContext.surfaceFormatsCount = 0; + SDL_OutOfMemory(); + quit(2); + } + } + result = vkGetPhysicalDeviceSurfaceFormatsKHR(vulkanContext.physicalDevice, + vulkanContext.surface, + &vulkanContext.surfaceFormatsCount, + vulkanContext.surfaceFormats); + if(result != VK_SUCCESS) + { + vulkanContext.surfaceFormatsCount = 0; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkGetPhysicalDeviceSurfaceFormatsKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static void getSwapchainImages(void) +{ + VkResult result; + + SDL_free(vulkanContext.swapchainImages); + vulkanContext.swapchainImages = NULL; + result = vkGetSwapchainImagesKHR( + vulkanContext.device, vulkanContext.swapchain, &vulkanContext.swapchainImageCount, NULL); + if(result != VK_SUCCESS) + { + vulkanContext.swapchainImageCount = 0; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkGetSwapchainImagesKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + vulkanContext.swapchainImages = SDL_malloc(sizeof(VkImage) * vulkanContext.swapchainImageCount); + if(!vulkanContext.swapchainImages) + { + SDL_OutOfMemory(); + quit(2); + } + result = vkGetSwapchainImagesKHR(vulkanContext.device, + vulkanContext.swapchain, + &vulkanContext.swapchainImageCount, + vulkanContext.swapchainImages); + if(result != VK_SUCCESS) + { + SDL_free(vulkanContext.swapchainImages); + vulkanContext.swapchainImages = NULL; + vulkanContext.swapchainImageCount = 0; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkGetSwapchainImagesKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static SDL_bool createSwapchain(void) +{ + uint32_t i; + int w, h; + VkSwapchainCreateInfoKHR createInfo = {0}; + VkResult result; + + // pick an image count + vulkanContext.swapchainDesiredImageCount = vulkanContext.surfaceCapabilities.minImageCount + 1; + if(vulkanContext.swapchainDesiredImageCount > vulkanContext.surfaceCapabilities.maxImageCount + && vulkanContext.surfaceCapabilities.maxImageCount > 0) + vulkanContext.swapchainDesiredImageCount = vulkanContext.surfaceCapabilities.maxImageCount; + + // pick a format + if(vulkanContext.surfaceFormatsCount == 1 + && vulkanContext.surfaceFormats[0].format == VK_FORMAT_UNDEFINED) + { + // aren't any preferred formats, so we pick + vulkanContext.surfaceFormat.colorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR; + vulkanContext.surfaceFormat.format = VK_FORMAT_R8G8B8A8_UNORM; + } + else + { + vulkanContext.surfaceFormat = vulkanContext.surfaceFormats[0]; + for(i = 0; i < vulkanContext.surfaceFormatsCount; i++) + { + if(vulkanContext.surfaceFormats[i].format == VK_FORMAT_R8G8B8A8_UNORM) + { + vulkanContext.surfaceFormat = vulkanContext.surfaceFormats[i]; + break; + } + } + } + + // get size + SDL_Vulkan_GetDrawableSize(state->windows[0], &w, &h); + vulkanContext.swapchainSize.width = w; + vulkanContext.swapchainSize.height = h; + if(w == 0 || h == 0) + return SDL_FALSE; + + createInfo.sType = VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR; + createInfo.surface = vulkanContext.surface; + createInfo.minImageCount = vulkanContext.swapchainDesiredImageCount; + createInfo.imageFormat = vulkanContext.surfaceFormat.format; + createInfo.imageColorSpace = vulkanContext.surfaceFormat.colorSpace; + createInfo.imageExtent = vulkanContext.swapchainSize; + createInfo.imageArrayLayers = 1; + createInfo.imageUsage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT; + createInfo.imageSharingMode = VK_SHARING_MODE_EXCLUSIVE; + createInfo.preTransform = vulkanContext.surfaceCapabilities.currentTransform; + createInfo.compositeAlpha = VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR; + createInfo.presentMode = VK_PRESENT_MODE_FIFO_KHR; + createInfo.clipped = VK_TRUE; + createInfo.oldSwapchain = vulkanContext.swapchain; + result = + vkCreateSwapchainKHR(vulkanContext.device, &createInfo, NULL, &vulkanContext.swapchain); + if(createInfo.oldSwapchain) + vkDestroySwapchainKHR(vulkanContext.device, createInfo.oldSwapchain, NULL); + if(result != VK_SUCCESS) + { + vulkanContext.swapchain = VK_NULL_HANDLE; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkCreateSwapchainKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + getSwapchainImages(); + return SDL_TRUE; +} + +static void destroySwapchain(void) +{ + if(vulkanContext.swapchain) + vkDestroySwapchainKHR(vulkanContext.device, vulkanContext.swapchain, NULL); + vulkanContext.swapchain = VK_NULL_HANDLE; + SDL_free(vulkanContext.swapchainImages); + vulkanContext.swapchainImages = NULL; +} + +static void destroyCommandBuffers(void) +{ + if(vulkanContext.commandBuffers) + vkFreeCommandBuffers(vulkanContext.device, + vulkanContext.commandPool, + vulkanContext.swapchainImageCount, + vulkanContext.commandBuffers); + SDL_free(vulkanContext.commandBuffers); + vulkanContext.commandBuffers = NULL; +} + +static void destroyCommandPool(void) +{ + if(vulkanContext.commandPool) + vkDestroyCommandPool(vulkanContext.device, vulkanContext.commandPool, NULL); + vulkanContext.commandPool = VK_NULL_HANDLE; +} + +static void createCommandPool(void) +{ + VkResult result; + + VkCommandPoolCreateInfo createInfo = {0}; + createInfo.sType = VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO; + createInfo.flags = + VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT | VK_COMMAND_POOL_CREATE_TRANSIENT_BIT; + createInfo.queueFamilyIndex = vulkanContext.graphicsQueueFamilyIndex; + result = + vkCreateCommandPool(vulkanContext.device, &createInfo, NULL, &vulkanContext.commandPool); + if(result != VK_SUCCESS) + { + vulkanContext.commandPool = VK_NULL_HANDLE; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkCreateCommandPool(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static void createCommandBuffers(void) +{ + VkResult result; + + VkCommandBufferAllocateInfo allocateInfo = {0}; + allocateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO; + allocateInfo.commandPool = vulkanContext.commandPool; + allocateInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY; + allocateInfo.commandBufferCount = vulkanContext.swapchainImageCount; + vulkanContext.commandBuffers = + SDL_malloc(sizeof(VkCommandBuffer) * vulkanContext.swapchainImageCount); + result = + vkAllocateCommandBuffers(vulkanContext.device, &allocateInfo, vulkanContext.commandBuffers); + if(result != VK_SUCCESS) + { + SDL_free(vulkanContext.commandBuffers); + vulkanContext.commandBuffers = NULL; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkAllocateCommandBuffers(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static void createFences(void) +{ + uint32_t i; + + vulkanContext.fences = SDL_malloc(sizeof(VkFence) * vulkanContext.swapchainImageCount); + if(!vulkanContext.fences) + { + SDL_OutOfMemory(); + quit(2); + } + for(i = 0; i < vulkanContext.swapchainImageCount; i++) + { + VkResult result; + + VkFenceCreateInfo createInfo = {0}; + createInfo.sType = VK_STRUCTURE_TYPE_FENCE_CREATE_INFO; + createInfo.flags = VK_FENCE_CREATE_SIGNALED_BIT; + result = + vkCreateFence(vulkanContext.device, &createInfo, NULL, &vulkanContext.fences[i]); + if(result != VK_SUCCESS) + { + for(; i > 0; i--) + { + vkDestroyFence(vulkanContext.device, vulkanContext.fences[i - 1], NULL); + } + SDL_free(vulkanContext.fences); + vulkanContext.fences = NULL; + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkCreateFence(): %s\n", + getVulkanResultString(result)); + quit(2); + } + } +} + +static void destroyFences(void) +{ + uint32_t i; + + if(!vulkanContext.fences) + return; + for(i = 0; i < vulkanContext.swapchainImageCount; i++) + { + vkDestroyFence(vulkanContext.device, vulkanContext.fences[i], NULL); + } + SDL_free(vulkanContext.fences); + vulkanContext.fences = NULL; +} + +static void recordPipelineImageBarrier(VkCommandBuffer commandBuffer, + VkAccessFlags sourceAccessMask, + VkAccessFlags destAccessMask, + VkImageLayout sourceLayout, + VkImageLayout destLayout, + VkImage image) +{ + VkImageMemoryBarrier barrier = {0}; + barrier.sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER; + barrier.srcAccessMask = sourceAccessMask; + barrier.dstAccessMask = destAccessMask; + barrier.oldLayout = sourceLayout; + barrier.newLayout = destLayout; + barrier.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barrier.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED; + barrier.image = image; + barrier.subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + barrier.subresourceRange.baseMipLevel = 0; + barrier.subresourceRange.levelCount = 1; + barrier.subresourceRange.baseArrayLayer = 0; + barrier.subresourceRange.layerCount = 1; + vkCmdPipelineBarrier(commandBuffer, + VK_PIPELINE_STAGE_TRANSFER_BIT, + VK_PIPELINE_STAGE_TRANSFER_BIT, + 0, + 0, + NULL, + 0, + NULL, + 1, + &barrier); +} + +static void rerecordCommandBuffer(uint32_t frameIndex, const VkClearColorValue *clearColor) +{ + VkCommandBuffer commandBuffer = vulkanContext.commandBuffers[frameIndex]; + VkImage image = vulkanContext.swapchainImages[frameIndex]; + VkCommandBufferBeginInfo beginInfo = {0}; + VkImageSubresourceRange clearRange = {0}; + + VkResult result = vkResetCommandBuffer(commandBuffer, 0); + if(result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkResetCommandBuffer(): %s\n", + getVulkanResultString(result)); + quit(2); + } + beginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO; + beginInfo.flags = VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT; + result = vkBeginCommandBuffer(commandBuffer, &beginInfo); + if(result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkBeginCommandBuffer(): %s\n", + getVulkanResultString(result)); + quit(2); + } + recordPipelineImageBarrier(commandBuffer, + 0, + VK_ACCESS_TRANSFER_WRITE_BIT, + VK_IMAGE_LAYOUT_UNDEFINED, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, + image); + clearRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; + clearRange.baseMipLevel = 0; + clearRange.levelCount = 1; + clearRange.baseArrayLayer = 0; + clearRange.layerCount = 1; + vkCmdClearColorImage( + commandBuffer, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, clearColor, 1, &clearRange); + recordPipelineImageBarrier(commandBuffer, + VK_ACCESS_TRANSFER_WRITE_BIT, + VK_ACCESS_MEMORY_READ_BIT, + VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, + VK_IMAGE_LAYOUT_PRESENT_SRC_KHR, + image); + result = vkEndCommandBuffer(commandBuffer); + if(result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkEndCommandBuffer(): %s\n", + getVulkanResultString(result)); + quit(2); + } +} + +static void destroySwapchainAndSwapchainSpecificStuff(SDL_bool doDestroySwapchain) +{ + destroyFences(); + destroyCommandBuffers(); + destroyCommandPool(); + if(doDestroySwapchain) + destroySwapchain(); +} + +static SDL_bool createNewSwapchainAndSwapchainSpecificStuff(void) +{ + destroySwapchainAndSwapchainSpecificStuff(SDL_FALSE); + getSurfaceCaps(); + getSurfaceFormats(); + if(!createSwapchain()) + return SDL_FALSE; + createCommandPool(); + createCommandBuffers(); + createFences(); + return SDL_TRUE; +} + +static void initVulkan(void) +{ + SDL_Vulkan_LoadLibrary(NULL); + SDL_memset(&vulkanContext, 0, sizeof(VulkanContext)); + loadGlobalFunctions(); + createInstance(); + loadInstanceFunctions(); + createSurface(); + findPhysicalDevice(); + createDevice(); + loadDeviceFunctions(); + getQueues(); + createSemaphores(); + createNewSwapchainAndSwapchainSpecificStuff(); +} + +static void shutdownVulkan(void) +{ + if(vulkanContext.device && vkDeviceWaitIdle) + vkDeviceWaitIdle(vulkanContext.device); + destroySwapchainAndSwapchainSpecificStuff(SDL_TRUE); + if(vulkanContext.imageAvailableSemaphore && vkDestroySemaphore) + vkDestroySemaphore(vulkanContext.device, vulkanContext.imageAvailableSemaphore, NULL); + if(vulkanContext.renderingFinishedSemaphore && vkDestroySemaphore) + vkDestroySemaphore(vulkanContext.device, vulkanContext.renderingFinishedSemaphore, NULL); + if(vulkanContext.device && vkDestroyDevice) + vkDestroyDevice(vulkanContext.device, NULL); + if(vulkanContext.surface && vkDestroySurfaceKHR) + vkDestroySurfaceKHR(vulkanContext.instance, vulkanContext.surface, NULL); + if(vulkanContext.instance && vkDestroyInstance) + vkDestroyInstance(vulkanContext.instance, NULL); + SDL_free(vulkanContext.surfaceFormats); + SDL_Vulkan_UnloadLibrary(); +} + +static SDL_bool render(void) +{ + uint32_t frameIndex; + VkResult result; + double currentTime; + VkClearColorValue clearColor = {0}; + VkPipelineStageFlags waitDestStageMask = VK_PIPELINE_STAGE_TRANSFER_BIT; + VkSubmitInfo submitInfo = {0}; + VkPresentInfoKHR presentInfo = {0}; + int w, h; + + if(!vulkanContext.swapchain) + { + SDL_bool retval = createNewSwapchainAndSwapchainSpecificStuff(); + if(!retval) + SDL_Delay(100); + return retval; + } + result = vkAcquireNextImageKHR(vulkanContext.device, + vulkanContext.swapchain, + UINT64_MAX, + vulkanContext.imageAvailableSemaphore, + VK_NULL_HANDLE, + &frameIndex); + if(result == VK_ERROR_OUT_OF_DATE_KHR) + return createNewSwapchainAndSwapchainSpecificStuff(); + if(result != VK_SUBOPTIMAL_KHR && result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkAcquireNextImageKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + result = vkWaitForFences( + vulkanContext.device, 1, &vulkanContext.fences[frameIndex], VK_FALSE, UINT64_MAX); + if(result != VK_SUCCESS) + { + SDL_LogError( + SDL_LOG_CATEGORY_APPLICATION, "vkWaitForFences(): %s\n", getVulkanResultString(result)); + quit(2); + } + result = vkResetFences(vulkanContext.device, 1, &vulkanContext.fences[frameIndex]); + if(result != VK_SUCCESS) + { + SDL_LogError( + SDL_LOG_CATEGORY_APPLICATION, "vkResetFences(): %s\n", getVulkanResultString(result)); + quit(2); + } + currentTime = (double)SDL_GetPerformanceCounter() / SDL_GetPerformanceFrequency(); + clearColor.float32[0] = (float)(0.5 + 0.5 * SDL_sin(currentTime)); + clearColor.float32[1] = (float)(0.5 + 0.5 * SDL_sin(currentTime + M_PI * 2 / 3)); + clearColor.float32[2] = (float)(0.5 + 0.5 * SDL_sin(currentTime + M_PI * 4 / 3)); + clearColor.float32[3] = 1; + rerecordCommandBuffer(frameIndex, &clearColor); + submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; + submitInfo.waitSemaphoreCount = 1; + submitInfo.pWaitSemaphores = &vulkanContext.imageAvailableSemaphore; + submitInfo.pWaitDstStageMask = &waitDestStageMask; + submitInfo.commandBufferCount = 1; + submitInfo.pCommandBuffers = &vulkanContext.commandBuffers[frameIndex]; + submitInfo.signalSemaphoreCount = 1; + submitInfo.pSignalSemaphores = &vulkanContext.renderingFinishedSemaphore; + result = vkQueueSubmit( + vulkanContext.graphicsQueue, 1, &submitInfo, vulkanContext.fences[frameIndex]); + if(result != VK_SUCCESS) + { + SDL_LogError( + SDL_LOG_CATEGORY_APPLICATION, "vkQueueSubmit(): %s\n", getVulkanResultString(result)); + quit(2); + } + presentInfo.sType = VK_STRUCTURE_TYPE_PRESENT_INFO_KHR; + presentInfo.waitSemaphoreCount = 1; + presentInfo.pWaitSemaphores = &vulkanContext.renderingFinishedSemaphore; + presentInfo.swapchainCount = 1; + presentInfo.pSwapchains = &vulkanContext.swapchain; + presentInfo.pImageIndices = &frameIndex; + result = vkQueuePresentKHR(vulkanContext.presentQueue, &presentInfo); + if(result == VK_ERROR_OUT_OF_DATE_KHR || result == VK_SUBOPTIMAL_KHR) + { + return createNewSwapchainAndSwapchainSpecificStuff(); + } + if(result != VK_SUCCESS) + { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, + "vkQueuePresentKHR(): %s\n", + getVulkanResultString(result)); + quit(2); + } + SDL_Vulkan_GetDrawableSize(state->windows[0], &w, &h); + if(w != (int)vulkanContext.swapchainSize.width || h != (int)vulkanContext.swapchainSize.height) + { + return createNewSwapchainAndSwapchainSpecificStuff(); + } + return SDL_TRUE; +} + +int main(int argc, char *argv[]) +{ + int fsaa, accel; + int i, done; + SDL_DisplayMode mode; + SDL_Event event; + Uint32 then, now, frames; + int dw, dh; + + /* Enable standard application logging */ + SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO); + + /* Initialize parameters */ + fsaa = 0; + accel = -1; + + /* Initialize test framework */ + state = SDLTest_CommonCreateState(argv, SDL_INIT_VIDEO); + if(!state) + { + return 1; + } + for(i = 1; i < argc;) + { + int consumed; + + consumed = SDLTest_CommonArg(state, i); + if(consumed < 0) + { + SDL_Log("Usage: %s %s\n", argv[0], SDLTest_CommonUsage(state)); + quit(1); + } + i += consumed; + } + + /* Set Vulkan parameters */ + state->window_flags |= SDL_WINDOW_VULKAN; + state->num_windows = 1; + state->skip_renderer = 1; + + if(!SDLTest_CommonInit(state)) + { + quit(2); + } + + SDL_GetCurrentDisplayMode(0, &mode); + SDL_Log("Screen BPP : %d\n", SDL_BITSPERPIXEL(mode.format)); + SDL_GetWindowSize(state->windows[0], &dw, &dh); + SDL_Log("Window Size : %d,%d\n", dw, dh); + SDL_Vulkan_GetDrawableSize(state->windows[0], &dw, &dh); + SDL_Log("Draw Size : %d,%d\n", dw, dh); + SDL_Log("\n"); + + initVulkan(); + + /* Main render loop */ + frames = 0; + then = SDL_GetTicks(); + done = 0; + while(!done) + { + /* Check for events */ + ++frames; + while(SDL_PollEvent(&event)) + { + SDLTest_CommonEvent(state, &event, &done); + } + + if(!done) + render(); + } + + /* Print out some timing information */ + now = SDL_GetTicks(); + if(now > then) + { + SDL_Log("%2.2f frames per second\n", ((double)frames * 1000) / (now - then)); + } + quit(0); + return 0; +} + +#endif diff --git a/Engine/lib/sdl/test/testwm2.c b/Engine/lib/sdl/test/testwm2.c index cd19e9f19..74a0fe028 100644 --- a/Engine/lib/sdl/test/testwm2.c +++ b/Engine/lib/sdl/test/testwm2.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages diff --git a/Engine/lib/sdl/test/testyuv.bmp b/Engine/lib/sdl/test/testyuv.bmp new file mode 100644 index 0000000000000000000000000000000000000000..af32034b6b5b858be470f9ef3bb023bc199bf96e GIT binary patch literal 739398 zcma&P1(?<46SwcrmJpE?q(Ma`6$Fz|5D;lW#7@M(z{Kt@#O}ZVMCtCXU04>D*j;w% z?$&uf_nb59(ZBEYf4P|J`F5SNXYTK3W}c^6+ZIoIJa(%f@9XK zRYlWPtj>97TK$G+Yug%b=QldnF1qYIUv|Mob*$0Fb$$B03(m0%FRkzMEN8!Z4Ql#4 z+g#eLq3_r5!rDH4Nz(?tJ=?Nf?fPdF9FuhyH#y%pW`oAHjB|3l<}EL>E8AXbE!tdc zovvwV*Wc9M+O}_Emo%ws7dNeM&003H=2tehi<;DPyQJB9c6qA{?TXeHS=)}yt<}|+ z`83NoPFRyG8d|d}FR;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}uy>MkjZt}@$x$|GTw@JhA~tAtO+dVSna#hZ-UO7xHL$@n{*A`g#5 zQ^6x|mnLztxFhV5$}_l#QzopN&0ET*|1W?2cJR zRv9@3lZ>pg{x^rV4G$dFS>=82->YjW{6FGV!YYY%4KrW>@9_DKVUJZQzm9knz8~5O z-_PNnIlSj$ZGD^2T(#=bRm5L-cG6WOHk=MD-h*C(F(#by(Op;tgT(fRRlM7K&yTiZ zTlMgXI)39H9K&xRm+(on6fA;e#HB=Q!74`-cc?>4@T|%=guIK>fW#~s=Yvz^eJ;4- z8P8|WIq#L`y)aHD=c)a(d4TuYtL;-vu~)H2XNls6cVdWvPu_BQWQ{$FVdj6Qj9&7d zJzLjEs!r#Wx7vSgvu82QzWeUmK2os;(ti8x*FIP*)LE);ho|=F^LXel{igqDAvAyX z3CrOX{eOEdvfWyCmz?C z2Itt$HmMgMSC2>e`s6s6i+{)*{#S~Tz4-_IdqcjFXii-7KKswQU*)c=zcE4gq z-waq@`}uXvsdE1l54JVWu4`*I{kA>2Zf$SJK?^4H9Jp^5f4+R*U;1(})#RI*#yG*&VCQ>nh<6tP-D27z3M(%VCw2&GM<95(dE}JuYRs{j0yN zxS5J!vEK5(KeMnW^Uq3HV@w$2rFBQlw2*Om jBt=sRzu=VUD&v?R8p_Bke$VsC_&b`4JUWW?1FQTWq4AQd literal 0 HcmV?d00001 diff --git a/Engine/lib/sdl/test/testyuv.c b/Engine/lib/sdl/test/testyuv.c new file mode 100644 index 000000000..f52ab9f72 --- /dev/null +++ b/Engine/lib/sdl/test/testyuv.c @@ -0,0 +1,455 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ +#include +#include +#include + +#include "SDL.h" +#include "SDL_test_font.h" +#include "testyuv_cvt.h" + + +/* 422 (YUY2, etc) formats are the largest */ +#define MAX_YUV_SURFACE_SIZE(W, H, P) (H*4*(W+P+1)/2) + + +/* Return true if the YUV format is packed pixels */ +static SDL_bool is_packed_yuv_format(Uint32 format) +{ + return (format == SDL_PIXELFORMAT_YUY2 || + format == SDL_PIXELFORMAT_UYVY || + format == SDL_PIXELFORMAT_YVYU); +} + +/* Create a surface with a good pattern for verifying YUV conversion */ +static SDL_Surface *generate_test_pattern(int pattern_size) +{ + SDL_Surface *pattern = SDL_CreateRGBSurfaceWithFormat(0, pattern_size, pattern_size, 0, SDL_PIXELFORMAT_RGB24); + + if (pattern) { + int i, x, y; + Uint8 *p, c; + const int thickness = 2; /* Important so 2x2 blocks of color are the same, to avoid Cr/Cb interpolation over pixels */ + + /* R, G, B in alternating horizontal bands */ + for (y = 0; y < pattern->h; y += thickness) { + for (i = 0; i < thickness; ++i) { + p = (Uint8 *)pattern->pixels + (y + i) * pattern->pitch + ((y/thickness) % 3); + for (x = 0; x < pattern->w; ++x) { + *p = 0xFF; + p += 3; + } + } + } + + /* Black and white in alternating vertical bands */ + c = 0xFF; + for (x = 1*thickness; x < pattern->w; x += 2*thickness) { + for (i = 0; i < thickness; ++i) { + p = (Uint8 *)pattern->pixels + (x + i)*3; + for (y = 0; y < pattern->h; ++y) { + SDL_memset(p, c, 3); + p += pattern->pitch; + } + } + if (c) { + c = 0x00; + } else { + c = 0xFF; + } + } + } + return pattern; +} + +static SDL_bool verify_yuv_data(Uint32 format, const Uint8 *yuv, int yuv_pitch, SDL_Surface *surface) +{ + const int tolerance = 20; + const int size = (surface->h * surface->pitch); + Uint8 *rgb; + SDL_bool result = SDL_FALSE; + + rgb = (Uint8 *)SDL_malloc(size); + if (!rgb) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Out of memory"); + return SDL_FALSE; + } + + if (SDL_ConvertPixels(surface->w, surface->h, format, yuv, yuv_pitch, surface->format->format, rgb, surface->pitch) == 0) { + int x, y; + result = SDL_TRUE; + for (y = 0; y < surface->h; ++y) { + const Uint8 *actual = rgb + y * surface->pitch; + const Uint8 *expected = (const Uint8 *)surface->pixels + y * surface->pitch; + for (x = 0; x < surface->w; ++x) { + int deltaR = (int)actual[0] - expected[0]; + int deltaG = (int)actual[1] - expected[1]; + int deltaB = (int)actual[2] - expected[2]; + int distance = (deltaR * deltaR + deltaG * deltaG + deltaB * deltaB); + if (distance > tolerance) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Pixel at %d,%d was 0x%.2x,0x%.2x,0x%.2x, expected 0x%.2x,0x%.2x,0x%.2x, distance = %d\n", x, y, actual[0], actual[1], actual[2], expected[0], expected[1], expected[2], distance); + result = SDL_FALSE; + } + actual += 3; + expected += 3; + } + } + } else { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(format), SDL_GetPixelFormatName(surface->format->format), SDL_GetError()); + } + SDL_free(rgb); + + return result; +} + +static int run_automated_tests(int pattern_size, int extra_pitch) +{ + const Uint32 formats[] = { + SDL_PIXELFORMAT_YV12, + SDL_PIXELFORMAT_IYUV, + SDL_PIXELFORMAT_NV12, + SDL_PIXELFORMAT_NV21, + SDL_PIXELFORMAT_YUY2, + SDL_PIXELFORMAT_UYVY, + SDL_PIXELFORMAT_YVYU + }; + int i, j; + SDL_Surface *pattern = generate_test_pattern(pattern_size); + const int yuv_len = MAX_YUV_SURFACE_SIZE(pattern->w, pattern->h, extra_pitch); + Uint8 *yuv1 = (Uint8 *)SDL_malloc(yuv_len); + Uint8 *yuv2 = (Uint8 *)SDL_malloc(yuv_len); + int yuv1_pitch, yuv2_pitch; + int result = -1; + + if (!pattern || !yuv1 || !yuv2) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't allocate test surfaces"); + goto done; + } + + /* Verify conversion from YUV formats */ + for (i = 0; i < SDL_arraysize(formats); ++i) { + if (!ConvertRGBtoYUV(formats[i], pattern->pixels, pattern->pitch, yuv1, pattern->w, pattern->h, SDL_GetYUVConversionModeForResolution(pattern->w, pattern->h), 0, 100)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "ConvertRGBtoYUV() doesn't support converting to %s\n", SDL_GetPixelFormatName(formats[i])); + goto done; + } + yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w); + if (!verify_yuv_data(formats[i], yuv1, yuv1_pitch, pattern)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to RGB\n", SDL_GetPixelFormatName(formats[i])); + goto done; + } + } + + /* Verify conversion to YUV formats */ + for (i = 0; i < SDL_arraysize(formats); ++i) { + yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch; + if (SDL_ConvertPixels(pattern->w, pattern->h, pattern->format->format, pattern->pixels, pattern->pitch, formats[i], yuv1, yuv1_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError()); + goto done; + } + if (!verify_yuv_data(formats[i], yuv1, yuv1_pitch, pattern)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from RGB to %s\n", SDL_GetPixelFormatName(formats[i])); + goto done; + } + } + + /* Verify conversion between YUV formats */ + for (i = 0; i < SDL_arraysize(formats); ++i) { + for (j = 0; j < SDL_arraysize(formats); ++j) { + yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch; + yuv2_pitch = CalculateYUVPitch(formats[j], pattern->w) + extra_pitch; + if (SDL_ConvertPixels(pattern->w, pattern->h, pattern->format->format, pattern->pixels, pattern->pitch, formats[i], yuv1, yuv1_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError()); + goto done; + } + if (SDL_ConvertPixels(pattern->w, pattern->h, formats[i], yuv1, yuv1_pitch, formats[j], yuv2, yuv2_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]), SDL_GetError()); + goto done; + } + if (!verify_yuv_data(formats[j], yuv2, yuv2_pitch, pattern)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j])); + goto done; + } + } + } + + /* Verify conversion between YUV formats in-place */ + for (i = 0; i < SDL_arraysize(formats); ++i) { + for (j = 0; j < SDL_arraysize(formats); ++j) { + if (is_packed_yuv_format(formats[i]) != is_packed_yuv_format(formats[j])) { + /* Can't change plane vs packed pixel layout in-place */ + continue; + } + + yuv1_pitch = CalculateYUVPitch(formats[i], pattern->w) + extra_pitch; + yuv2_pitch = CalculateYUVPitch(formats[j], pattern->w) + extra_pitch; + if (SDL_ConvertPixels(pattern->w, pattern->h, pattern->format->format, pattern->pixels, pattern->pitch, formats[i], yuv1, yuv1_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(pattern->format->format), SDL_GetPixelFormatName(formats[i]), SDL_GetError()); + goto done; + } + if (SDL_ConvertPixels(pattern->w, pattern->h, formats[i], yuv1, yuv1_pitch, formats[j], yuv1, yuv2_pitch) < 0) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't convert %s to %s: %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j]), SDL_GetError()); + goto done; + } + if (!verify_yuv_data(formats[j], yuv1, yuv2_pitch, pattern)) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Failed conversion from %s to %s\n", SDL_GetPixelFormatName(formats[i]), SDL_GetPixelFormatName(formats[j])); + goto done; + } + } + } + + + result = 0; + +done: + SDL_free(yuv1); + SDL_free(yuv2); + SDL_FreeSurface(pattern); + return result; +} + +int +main(int argc, char **argv) +{ + struct { + SDL_bool enable_intrinsics; + int pattern_size; + int extra_pitch; + } automated_test_params[] = { + /* Test: even width and height */ + { SDL_FALSE, 2, 0 }, + { SDL_FALSE, 4, 0 }, + /* Test: odd width and height */ + { SDL_FALSE, 1, 0 }, + { SDL_FALSE, 3, 0 }, + /* Test: even width and height, extra pitch */ + { SDL_FALSE, 2, 3 }, + { SDL_FALSE, 4, 3 }, + /* Test: odd width and height, extra pitch */ + { SDL_FALSE, 1, 3 }, + { SDL_FALSE, 3, 3 }, + /* Test: even width and height with intrinsics */ + { SDL_TRUE, 32, 0 }, + /* Test: odd width and height with intrinsics */ + { SDL_TRUE, 33, 0 }, + { SDL_TRUE, 37, 0 }, + /* Test: even width and height with intrinsics, extra pitch */ + { SDL_TRUE, 32, 3 }, + /* Test: odd width and height with intrinsics, extra pitch */ + { SDL_TRUE, 33, 3 }, + { SDL_TRUE, 37, 3 }, + }; + int arg = 1; + const char *filename; + SDL_Surface *original; + SDL_Surface *converted; + SDL_Window *window; + SDL_Renderer *renderer; + SDL_Texture *output[3]; + const char *titles[3] = { "ORIGINAL", "SOFTWARE", "HARDWARE" }; + char title[128]; + const char *yuv_name; + const char *yuv_mode; + Uint32 rgb_format = SDL_PIXELFORMAT_RGBX8888; + Uint32 yuv_format = SDL_PIXELFORMAT_YV12; + int current = 0; + int pitch; + Uint8 *raw_yuv; + Uint32 then, now, i, iterations = 100; + SDL_bool should_run_automated_tests = SDL_FALSE; + + while (argv[arg] && *argv[arg] == '-') { + if (SDL_strcmp(argv[arg], "--jpeg") == 0) { + SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_JPEG); + } else if (SDL_strcmp(argv[arg], "--bt601") == 0) { + SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_BT601); + } else if (SDL_strcmp(argv[arg], "--bt709") == 0) { + SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_BT709); + } else if (SDL_strcmp(argv[arg], "--auto") == 0) { + SDL_SetYUVConversionMode(SDL_YUV_CONVERSION_AUTOMATIC); + } else if (SDL_strcmp(argv[arg], "--yv12") == 0) { + yuv_format = SDL_PIXELFORMAT_YV12; + } else if (SDL_strcmp(argv[arg], "--iyuv") == 0) { + yuv_format = SDL_PIXELFORMAT_IYUV; + } else if (SDL_strcmp(argv[arg], "--yuy2") == 0) { + yuv_format = SDL_PIXELFORMAT_YUY2; + } else if (SDL_strcmp(argv[arg], "--uyvy") == 0) { + yuv_format = SDL_PIXELFORMAT_UYVY; + } else if (SDL_strcmp(argv[arg], "--yvyu") == 0) { + yuv_format = SDL_PIXELFORMAT_YVYU; + } else if (SDL_strcmp(argv[arg], "--nv12") == 0) { + yuv_format = SDL_PIXELFORMAT_NV12; + } else if (SDL_strcmp(argv[arg], "--nv21") == 0) { + yuv_format = SDL_PIXELFORMAT_NV21; + } else if (SDL_strcmp(argv[arg], "--rgb555") == 0) { + rgb_format = SDL_PIXELFORMAT_RGB555; + } else if (SDL_strcmp(argv[arg], "--rgb565") == 0) { + rgb_format = SDL_PIXELFORMAT_RGB565; + } else if (SDL_strcmp(argv[arg], "--rgb24") == 0) { + rgb_format = SDL_PIXELFORMAT_RGB24; + } else if (SDL_strcmp(argv[arg], "--argb") == 0) { + rgb_format = SDL_PIXELFORMAT_ARGB8888; + } else if (SDL_strcmp(argv[arg], "--abgr") == 0) { + rgb_format = SDL_PIXELFORMAT_ABGR8888; + } else if (SDL_strcmp(argv[arg], "--rgba") == 0) { + rgb_format = SDL_PIXELFORMAT_RGBA8888; + } else if (SDL_strcmp(argv[arg], "--bgra") == 0) { + rgb_format = SDL_PIXELFORMAT_BGRA8888; + } else if (SDL_strcmp(argv[arg], "--automated") == 0) { + should_run_automated_tests = SDL_TRUE; + } else { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Usage: %s [--jpeg|--bt601|-bt709|--auto] [--yv12|--iyuv|--yuy2|--uyvy|--yvyu|--nv12|--nv21] [--rgb555|--rgb565|--rgb24|--argb|--abgr|--rgba|--bgra] [image_filename]\n", argv[0]); + return 1; + } + ++arg; + } + + /* Run automated tests */ + if (should_run_automated_tests) { + for (i = 0; i < SDL_arraysize(automated_test_params); ++i) { + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Running automated test, pattern size %d, extra pitch %d, intrinsics %s\n", + automated_test_params[i].pattern_size, + automated_test_params[i].extra_pitch, + automated_test_params[i].enable_intrinsics ? "enabled" : "disabled"); + if (run_automated_tests(automated_test_params[i].pattern_size, automated_test_params[i].extra_pitch) < 0) { + return 2; + } + } + return 0; + } + + if (argv[arg]) { + filename = argv[arg]; + } else { + filename = "testyuv.bmp"; + } + original = SDL_ConvertSurfaceFormat(SDL_LoadBMP(filename), SDL_PIXELFORMAT_RGB24, 0); + if (!original) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError()); + return 3; + } + + raw_yuv = SDL_calloc(1, MAX_YUV_SURFACE_SIZE(original->w, original->h, 0)); + ConvertRGBtoYUV(yuv_format, original->pixels, original->pitch, raw_yuv, original->w, original->h, + SDL_GetYUVConversionModeForResolution(original->w, original->h), + 0, 100); + pitch = CalculateYUVPitch(yuv_format, original->w); + + converted = SDL_CreateRGBSurfaceWithFormat(0, original->w, original->h, 0, rgb_format); + if (!converted) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create converted surface: %s\n", SDL_GetError()); + return 3; + } + + then = SDL_GetTicks(); + for ( i = 0; i < iterations; ++i ) { + SDL_ConvertPixels(original->w, original->h, yuv_format, raw_yuv, pitch, rgb_format, converted->pixels, converted->pitch); + } + now = SDL_GetTicks(); + SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "%d iterations in %d ms, %.2fms each\n", iterations, (now - then), (float)(now - then)/iterations); + + window = SDL_CreateWindow("YUV test", + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + original->w, original->h, + 0); + if (!window) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create window: %s\n", SDL_GetError()); + return 4; + } + + renderer = SDL_CreateRenderer(window, -1, 0); + if (!renderer) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n", SDL_GetError()); + return 4; + } + + output[0] = SDL_CreateTextureFromSurface(renderer, original); + output[1] = SDL_CreateTextureFromSurface(renderer, converted); + output[2] = SDL_CreateTexture(renderer, yuv_format, SDL_TEXTUREACCESS_STREAMING, original->w, original->h); + if (!output[0] || !output[1] || !output[2]) { + SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't set create texture: %s\n", SDL_GetError()); + return 5; + } + SDL_UpdateTexture(output[2], NULL, raw_yuv, pitch); + + yuv_name = SDL_GetPixelFormatName(yuv_format); + if (SDL_strncmp(yuv_name, "SDL_PIXELFORMAT_", 16) == 0) { + yuv_name += 16; + } + + switch (SDL_GetYUVConversionModeForResolution(original->w, original->h)) { + case SDL_YUV_CONVERSION_JPEG: + yuv_mode = "JPEG"; + break; + case SDL_YUV_CONVERSION_BT601: + yuv_mode = "BT.601"; + break; + case SDL_YUV_CONVERSION_BT709: + yuv_mode = "BT.709"; + break; + default: + yuv_mode = "UNKNOWN"; + break; + } + + { int done = 0; + while ( !done ) + { + SDL_Event event; + while (SDL_PollEvent(&event) > 0) { + if (event.type == SDL_QUIT) { + done = 1; + } + if (event.type == SDL_KEYDOWN) { + if (event.key.keysym.sym == SDLK_ESCAPE) { + done = 1; + } else if (event.key.keysym.sym == SDLK_LEFT) { + --current; + } else if (event.key.keysym.sym == SDLK_RIGHT) { + ++current; + } + } + if (event.type == SDL_MOUSEBUTTONDOWN) { + if (event.button.x < (original->w/2)) { + --current; + } else { + ++current; + } + } + } + + /* Handle wrapping */ + if (current < 0) { + current += SDL_arraysize(output); + } + if (current >= SDL_arraysize(output)) { + current -= SDL_arraysize(output); + } + + SDL_RenderClear(renderer); + SDL_RenderCopy(renderer, output[current], NULL, NULL); + SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0xFF); + if (current == 0) { + SDLTest_DrawString(renderer, 4, 4, titles[current]); + } else { + SDL_snprintf(title, sizeof(title), "%s %s %s", titles[current], yuv_name, yuv_mode); + SDLTest_DrawString(renderer, 4, 4, title); + } + SDL_RenderPresent(renderer); + SDL_Delay(10); + } + } + SDL_Quit(); + return 0; +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/test/testyuv_cvt.c b/Engine/lib/sdl/test/testyuv_cvt.c new file mode 100644 index 000000000..553a3fa18 --- /dev/null +++ b/Engine/lib/sdl/test/testyuv_cvt.c @@ -0,0 +1,300 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +#include "SDL.h" + +#include "testyuv_cvt.h" + + +static float clip3(float x, float y, float z) +{ + return ((z < x) ? x : ((z > y) ? y : z)); +} + +static void RGBtoYUV(Uint8 * rgb, int *yuv, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance) +{ + if (mode == SDL_YUV_CONVERSION_JPEG) { + /* Full range YUV */ + yuv[0] = (int)(0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2]); + yuv[1] = (int)((rgb[2] - yuv[0]) * 0.565 + 128); + yuv[2] = (int)((rgb[0] - yuv[0]) * 0.713 + 128); + } else { + // This formula is from Microsoft's documentation: + // https://msdn.microsoft.com/en-us/library/windows/desktop/dd206750(v=vs.85).aspx + // L = Kr * R + Kb * B + (1 - Kr - Kb) * G + // Y = floor(2^(M-8) * (219*(L-Z)/S + 16) + 0.5); + // U = clip3(0, (2^M)-1, floor(2^(M-8) * (112*(B-L) / ((1-Kb)*S) + 128) + 0.5)); + // V = clip3(0, (2^M)-1, floor(2^(M-8) * (112*(R-L) / ((1-Kr)*S) + 128) + 0.5)); + float S, Z, R, G, B, L, Kr, Kb, Y, U, V; + + if (mode == SDL_YUV_CONVERSION_BT709) { + /* BT.709 */ + Kr = 0.2126f; + Kb = 0.0722f; + } else { + /* BT.601 */ + Kr = 0.299f; + Kb = 0.114f; + } + + S = 255.0f; + Z = 0.0f; + R = rgb[0]; + G = rgb[1]; + B = rgb[2]; + L = Kr * R + Kb * B + (1 - Kr - Kb) * G; + Y = (Uint8)SDL_floorf((219*(L-Z)/S + 16) + 0.5f); + U = (Uint8)clip3(0, 255, SDL_floorf((112.0f*(B-L) / ((1.0f-Kb)*S) + 128) + 0.5f)); + V = (Uint8)clip3(0, 255, SDL_floorf((112.0f*(R-L) / ((1.0f-Kr)*S) + 128) + 0.5f)); + + yuv[0] = (Uint8)Y; + yuv[1] = (Uint8)U; + yuv[2] = (Uint8)V; + } + + if (monochrome) { + yuv[1] = 128; + yuv[2] = 128; + } + + if (luminance != 100) { + yuv[0] = yuv[0] * luminance / 100; + if (yuv[0] > 255) + yuv[0] = 255; + } +} + +static void ConvertRGBtoPlanar2x2(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance) +{ + int x, y; + int yuv[4][3]; + Uint8 *Y1, *Y2, *U, *V; + Uint8 *rgb1, *rgb2; + int rgb_row_advance = (pitch - w*3) + pitch; + int UV_advance; + + rgb1 = src; + rgb2 = src + pitch; + + Y1 = out; + Y2 = Y1 + w; + switch (format) { + case SDL_PIXELFORMAT_YV12: + V = (Y1 + h * w); + U = V + ((h + 1)/2)*((w + 1)/2); + UV_advance = 1; + break; + case SDL_PIXELFORMAT_IYUV: + U = (Y1 + h * w); + V = U + ((h + 1)/2)*((w + 1)/2); + UV_advance = 1; + break; + case SDL_PIXELFORMAT_NV12: + U = (Y1 + h * w); + V = U + 1; + UV_advance = 2; + break; + case SDL_PIXELFORMAT_NV21: + V = (Y1 + h * w); + U = V + 1; + UV_advance = 2; + break; + default: + SDL_assert(!"Unsupported planar YUV format"); + return; + } + + for (y = 0; y < (h - 1); y += 2) { + for (x = 0; x < (w - 1); x += 2) { + RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[0][0]; + + RGBtoYUV(rgb1, yuv[1], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[1][0]; + + RGBtoYUV(rgb2, yuv[2], mode, monochrome, luminance); + rgb2 += 3; + *Y2++ = (Uint8)yuv[2][0]; + + RGBtoYUV(rgb2, yuv[3], mode, monochrome, luminance); + rgb2 += 3; + *Y2++ = (Uint8)yuv[3][0]; + + *U = (Uint8)SDL_floorf((yuv[0][1] + yuv[1][1] + yuv[2][1] + yuv[3][1])/4.0f + 0.5f); + U += UV_advance; + + *V = (Uint8)SDL_floorf((yuv[0][2] + yuv[1][2] + yuv[2][2] + yuv[3][2])/4.0f + 0.5f); + V += UV_advance; + } + /* Last column */ + if (x == (w - 1)) { + RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[0][0]; + + RGBtoYUV(rgb2, yuv[2], mode, monochrome, luminance); + rgb2 += 3; + *Y2++ = (Uint8)yuv[2][0]; + + *U = (Uint8)SDL_floorf((yuv[0][1] + yuv[2][1])/2.0f + 0.5f); + U += UV_advance; + + *V = (Uint8)SDL_floorf((yuv[0][2] + yuv[2][2])/2.0f + 0.5f); + V += UV_advance; + } + Y1 += w; + Y2 += w; + rgb1 += rgb_row_advance; + rgb2 += rgb_row_advance; + } + /* Last row */ + if (y == (h - 1)) { + for (x = 0; x < (w - 1); x += 2) { + RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[0][0]; + + RGBtoYUV(rgb1, yuv[1], mode, monochrome, luminance); + rgb1 += 3; + *Y1++ = (Uint8)yuv[1][0]; + + *U = (Uint8)SDL_floorf((yuv[0][1] + yuv[1][1])/2.0f + 0.5f); + U += UV_advance; + + *V = (Uint8)SDL_floorf((yuv[0][2] + yuv[1][2])/2.0f + 0.5f); + V += UV_advance; + } + /* Last column */ + if (x == (w - 1)) { + RGBtoYUV(rgb1, yuv[0], mode, monochrome, luminance); + *Y1++ = (Uint8)yuv[0][0]; + + *U = (Uint8)yuv[0][1]; + U += UV_advance; + + *V = (Uint8)yuv[0][2]; + V += UV_advance; + } + } +} + +static void ConvertRGBtoPacked4(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance) +{ + int x, y; + int yuv[2][3]; + Uint8 *Y1, *Y2, *U, *V; + Uint8 *rgb; + int rgb_row_advance = (pitch - w*3); + + rgb = src; + + switch (format) { + case SDL_PIXELFORMAT_YUY2: + Y1 = out; + U = out+1; + Y2 = out+2; + V = out+3; + break; + case SDL_PIXELFORMAT_UYVY: + U = out; + Y1 = out+1; + V = out+2; + Y2 = out+3; + break; + case SDL_PIXELFORMAT_YVYU: + Y1 = out; + V = out+1; + Y2 = out+2; + U = out+3; + break; + default: + SDL_assert(!"Unsupported packed YUV format"); + return; + } + + for (y = 0; y < h; ++y) { + for (x = 0; x < (w - 1); x += 2) { + RGBtoYUV(rgb, yuv[0], mode, monochrome, luminance); + rgb += 3; + *Y1 = (Uint8)yuv[0][0]; + Y1 += 4; + + RGBtoYUV(rgb, yuv[1], mode, monochrome, luminance); + rgb += 3; + *Y2 = (Uint8)yuv[1][0]; + Y2 += 4; + + *U = (Uint8)SDL_floorf((yuv[0][1] + yuv[1][1])/2.0f + 0.5f); + U += 4; + + *V = (Uint8)SDL_floorf((yuv[0][2] + yuv[1][2])/2.0f + 0.5f); + V += 4; + } + /* Last column */ + if (x == (w - 1)) { + RGBtoYUV(rgb, yuv[0], mode, monochrome, luminance); + rgb += 3; + *Y2 = *Y1 = (Uint8)yuv[0][0]; + Y1 += 4; + Y2 += 4; + + *U = (Uint8)yuv[0][1]; + U += 4; + + *V = (Uint8)yuv[0][2]; + V += 4; + } + rgb += rgb_row_advance; + } +} + +SDL_bool ConvertRGBtoYUV(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance) +{ + switch (format) + { + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + ConvertRGBtoPlanar2x2(format, src, pitch, out, w, h, mode, monochrome, luminance); + return SDL_TRUE; + case SDL_PIXELFORMAT_YUY2: + case SDL_PIXELFORMAT_UYVY: + case SDL_PIXELFORMAT_YVYU: + ConvertRGBtoPacked4(format, src, pitch, out, w, h, mode, monochrome, luminance); + return SDL_TRUE; + default: + return SDL_FALSE; + } +} + +int CalculateYUVPitch(Uint32 format, int width) +{ + switch (format) + { + case SDL_PIXELFORMAT_YV12: + case SDL_PIXELFORMAT_IYUV: + case SDL_PIXELFORMAT_NV12: + case SDL_PIXELFORMAT_NV21: + return width; + case SDL_PIXELFORMAT_YUY2: + case SDL_PIXELFORMAT_UYVY: + case SDL_PIXELFORMAT_YVYU: + return 4*((width + 1)/2); + default: + return 0; + } +} + +/* vi: set ts=4 sw=4 expandtab: */ diff --git a/Engine/lib/sdl/test/testyuv_cvt.h b/Engine/lib/sdl/test/testyuv_cvt.h new file mode 100644 index 000000000..bd845878f --- /dev/null +++ b/Engine/lib/sdl/test/testyuv_cvt.h @@ -0,0 +1,16 @@ +/* + Copyright (C) 1997-2018 Sam Lantinga + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely. +*/ + +/* These functions are designed for testing correctness, not for speed */ + +extern SDL_bool ConvertRGBtoYUV(Uint32 format, Uint8 *src, int pitch, Uint8 *out, int w, int h, SDL_YUV_CONVERSION_MODE mode, int monochrome, int luminance); +extern int CalculateYUVPitch(Uint32 format, int width); diff --git a/Engine/lib/sdl/test/torturethread.c b/Engine/lib/sdl/test/torturethread.c index 6b98a0a9f..9b1a407ee 100644 --- a/Engine/lib/sdl/test/torturethread.c +++ b/Engine/lib/sdl/test/torturethread.c @@ -1,5 +1,5 @@ /* - Copyright (C) 1997-2016 Sam Lantinga + Copyright (C) 1997-2018 Sam Lantinga This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages From ad5d781cef486397dce38110acaeaca8bf5ea6b0 Mon Sep 17 00:00:00 2001 From: Tim Date: Wed, 9 May 2018 23:09:32 +1000 Subject: [PATCH 124/144] cmake fix for apple sdl --- Tools/CMake/torque3d.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index d746913fb..0d29dcf38 100644 --- a/Tools/CMake/torque3d.cmake +++ b/Tools/CMake/torque3d.cmake @@ -701,7 +701,13 @@ endif() if(TORQUE_SDL) addDef(TORQUE_SDL) addInclude(${libDir}/sdl/include) - addLib(SDL2) + if(APPLE) + addLib(SDL2main) + addLib(SDL2-static) + add_dependencies(${TORQUE_APP_NAME} SDL2main SDL2-static) + else() + addLib(SDL2) + endif() SET(VIDEO_WAYLAND OFF CACHE BOOL "" FORCE) mark_as_advanced(3DNOW) From f4be184d3339ff7f6309a435fa1ebd1fb7019c74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Monta=C3=B1=C3=A9s=20Garc=C3=ADa?= Date: Wed, 9 May 2018 18:08:33 +0200 Subject: [PATCH 125/144] Particles should go downwind (while windCoefficient >0) --- Engine/source/T3D/fx/particleEmitter.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/T3D/fx/particleEmitter.cpp b/Engine/source/T3D/fx/particleEmitter.cpp index cab153574..5a1fbe094 100644 --- a/Engine/source/T3D/fx/particleEmitter.cpp +++ b/Engine/source/T3D/fx/particleEmitter.cpp @@ -1390,7 +1390,7 @@ void ParticleEmitter::emitParticles(const Point3F& start, Point3F a = last_part->acc; a -= last_part->vel * last_part->dataBlock->dragCoefficient; - a -= mWindVelocity * last_part->dataBlock->windCoefficient; + a += mWindVelocity * last_part->dataBlock->windCoefficient; //a += Point3F(0.0f, 0.0f, -9.81f) * last_part->dataBlock->gravityCoefficient; a.z += -9.81f*last_part->dataBlock->gravityCoefficient; // as long as gravity is a constant, this is faster @@ -1750,7 +1750,7 @@ void ParticleEmitter::update( U32 ms ) { Point3F a = part->acc; a -= part->vel * part->dataBlock->dragCoefficient; - a -= mWindVelocity * part->dataBlock->windCoefficient; + a += mWindVelocity * part->dataBlock->windCoefficient; a.z += -9.81f*part->dataBlock->gravityCoefficient; // AFX -- as long as gravity is a constant, this is faster part->vel += a * t; From 82338fa9f40828f0e31bb0793d29047ded29849c Mon Sep 17 00:00:00 2001 From: OTHGMars Date: Fri, 8 Jun 2018 20:32:38 -0400 Subject: [PATCH 126/144] Changes TSStatic::castRayRendered to used passed texcoord argument. This fixes a bug where TSStatic::castRayRendered() ignored the state of generateTexCoord in the passed RayInfo structure and never returned texture coordinates if requested. --- Engine/source/T3D/tsStatic.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Engine/source/T3D/tsStatic.cpp b/Engine/source/T3D/tsStatic.cpp index 7797795a5..58925b29e 100644 --- a/Engine/source/T3D/tsStatic.cpp +++ b/Engine/source/T3D/tsStatic.cpp @@ -1007,6 +1007,8 @@ bool TSStatic::castRayRendered(const Point3F &start, const Point3F &end, RayInfo // Cast the ray against the currently visible detail RayInfo localInfo; + if (info && info->generateTexCoord) + localInfo.generateTexCoord = true; bool res = mShapeInstance->castRayOpcode( mShapeInstance->getCurrentDetail(), start, end, &localInfo ); if ( res ) From b0b2b1314a129d3ad6750277f4172e5505ab69bb Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 4 Jul 2018 18:26:14 -0500 Subject: [PATCH 127/144] member var conversion error that oddly didn't crop up till mac testing. --- Engine/source/math/mPolyhedron.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/math/mPolyhedron.h b/Engine/source/math/mPolyhedron.h index 8888d531d..3da780e0c 100644 --- a/Engine/source/math/mPolyhedron.h +++ b/Engine/source/math/mPolyhedron.h @@ -267,7 +267,7 @@ struct PolyhedronFixedVectorData : public PolyhedronData Point3F* getPoints() const { return mPointList.address(); } /// Return the number of edges that this polyhedron has. - U32 getNumEdges() const { return edgeList.size(); } + U32 getNumEdges() const { return mEdgeList.size(); } /// Edge* getEdges() const { return mEdgeList.address(); } From 38237bfb6244584b7efc4cef7d56a180b1c4e71c Mon Sep 17 00:00:00 2001 From: chaigler Date: Thu, 5 Jul 2018 14:19:05 -0400 Subject: [PATCH 128/144] _GFXInitGetInitialRes() cleanup Removes unnecessary code that sets default video mode params. This is already handled by the GFXVideoMode constructor. The settings are also immediately overwritten by vm.parseFromString(). Resolves #740 --- Engine/source/gfx/gfxInit.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/Engine/source/gfx/gfxInit.cpp b/Engine/source/gfx/gfxInit.cpp index 21572b957..1c7f1f42a 100644 --- a/Engine/source/gfx/gfxInit.cpp +++ b/Engine/source/gfx/gfxInit.cpp @@ -84,28 +84,15 @@ inline static void _GFXInitReportAdapters(Vector &adapters) } } -inline static void _GFXInitGetInitialRes(GFXVideoMode &vm, const Point2I &initialSize) +inline static void _GFXInitGetInitialRes(GFXVideoMode &vm) { - const U32 kDefaultWindowSizeX = 800; - const U32 kDefaultWindowSizeY = 600; - const bool kDefaultFullscreen = false; - const U32 kDefaultBitDepth = 32; - const U32 kDefaultRefreshRate = 60; - // cache the desktop size of the main screen GFXVideoMode desktopVm = GFXInit::getDesktopResolution(); // load pref variables, properly choose windowed / fullscreen const String resString = Con::getVariable("$pref::Video::mode"); - // Set defaults into the video mode, then have it parse the user string. - vm.resolution.x = kDefaultWindowSizeX; - vm.resolution.y = kDefaultWindowSizeY; - vm.fullScreen = kDefaultFullscreen; - vm.bitDepth = kDefaultBitDepth; - vm.refreshRate = kDefaultRefreshRate; - vm.wideScreen = false; - + // Parse video mode settings from pref string vm.parseFromString(resString); } @@ -365,7 +352,7 @@ GFXAdapter *GFXInit::getBestAdapterChoice() GFXVideoMode GFXInit::getInitialVideoMode() { GFXVideoMode vm; - _GFXInitGetInitialRes(vm, Point2I(800,600)); + _GFXInitGetInitialRes(vm); return vm; } From bab3d9d5f3d06a441e07eaa162a0e6b6e4ff7785 Mon Sep 17 00:00:00 2001 From: OTHGMars Date: Sat, 7 Jul 2018 02:23:59 -0400 Subject: [PATCH 129/144] Fix for bug in GFXVideoMode::parseFromString() When testing PR #2264 I discovered that GFXVideoMode::parseFromString() will never assign false to the fullScreen value. That value must be initialized to false going in. I found it hard to believe that that could be the case and not have caused a problem before now, so I dropped: ```c++ GFXVideoMode vmTest = GFXInit::getDesktopResolution(); vmTest.fullScreen = true; vmTest.parseFromString("800 600 false 32 60"); Con::printf("%s becomes %s", "800 600 false 32 60", vmTest.toString().c_str()); ``` into the end of _GFXInitGetInitialRes() and the output string is: 800 600 false 32 60 becomes 800 600 true 32 60 0 None of the values get assigned by the macro [here](https://github.com/GarageGames/Torque3D/blob/development/Engine/source/gfx/gfxStructs.cpp#L46-L48) if their function evaluates to zero or the token is missing from the string. This commit corrects that for the boolean case to only skip the assignment if the string token is not found. --- Engine/source/gfx/gfxStructs.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Engine/source/gfx/gfxStructs.cpp b/Engine/source/gfx/gfxStructs.cpp index 7f64c6ee6..a8e6444bf 100644 --- a/Engine/source/gfx/gfxStructs.cpp +++ b/Engine/source/gfx/gfxStructs.cpp @@ -49,7 +49,9 @@ void GFXVideoMode::parseFromString( const char *str ) PARSE_ELEM(S32, resolution.x, dAtoi, tempBuf, " x\0") PARSE_ELEM(S32, resolution.y, dAtoi, NULL, " x\0") - PARSE_ELEM(S32, fullScreen, dAtob, NULL, " \0") + const char *boolptr = dStrtok(NULL, " \0"); + if (boolptr) + fullScreen = dAtob(boolptr); PARSE_ELEM(S32, bitDepth, dAtoi, NULL, " \0") PARSE_ELEM(S32, refreshRate, dAtoi, NULL, " \0") PARSE_ELEM(S32, antialiasLevel, dAtoi, NULL, " \0") From cc77e6d3017f7260141284bea81d8126e3cbf1b5 Mon Sep 17 00:00:00 2001 From: chaigler Date: Sat, 7 Jul 2018 13:16:46 -0400 Subject: [PATCH 130/144] Fix for ScatterSky zOffset zOffset was mistakenly applied to wrong transform matrix. Fixes #1721. --- Engine/source/environment/scatterSky.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/source/environment/scatterSky.cpp b/Engine/source/environment/scatterSky.cpp index 2f8d17d00..3220c46d1 100644 --- a/Engine/source/environment/scatterSky.cpp +++ b/Engine/source/environment/scatterSky.cpp @@ -955,8 +955,9 @@ void ScatterSky::_render( ObjectRenderInst *ri, SceneRenderState *state, BaseMat Point3F camPos2 = state->getCameraPosition(); MatrixF xfm(true); - + xfm.setPosition(camPos2 - Point3F(0, 0, mZOffset)); GFX->multWorld(xfm); + MatrixF xform(proj);//GFX->getProjectionMatrix()); xform *= GFX->getViewMatrix(); xform *= GFX->getWorldMatrix(); @@ -968,7 +969,6 @@ void ScatterSky::_render( ObjectRenderInst *ri, SceneRenderState *state, BaseMat rotMat.set(EulerF(M_PI_F, 0.0, 0.0)); xform.mul(rotMat); } - xform.setPosition(xform.getPosition() - Point3F(0, 0, mZOffset)); mShaderConsts->setSafe( mModelViewProjSC, xform ); mShaderConsts->setSafe( mMiscSC, miscParams ); From c54c8ed6893032507524b34cac85324e47ea208c Mon Sep 17 00:00:00 2001 From: Areloch Date: Mon, 9 Jul 2018 15:17:48 -0500 Subject: [PATCH 131/144] Create .travis.yml Initial travis CI config file push. Further calibration will be required to dial the settings in. --- .travis.yml | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..8e5970686 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,4 @@ +language: cpp +compiler: + - clang + - gcc From a48b70d5b1a86d63c14e3eabf3f85fbde82af467 Mon Sep 17 00:00:00 2001 From: rextimmy Date: Tue, 10 Jul 2018 14:13:22 +1000 Subject: [PATCH 132/144] d3d11 copyToBmp fix for new lock/unlock function --- .../gfx/D3D11/gfxD3D11TextureObject.cpp | 58 ++++++++++++++----- 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp b/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp index 7c33e1c16..d35eb1b34 100644 --- a/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp +++ b/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp @@ -183,10 +183,10 @@ bool GFXD3D11TextureObject::copyToBmp(GBitmap* bmp) PROFILE_START(GFXD3D11TextureObject_copyToBmp); - AssertFatal(bmp->getWidth() == getWidth(), "doh"); - AssertFatal(bmp->getHeight() == getHeight(), "doh"); - U32 width = getWidth(); - U32 height = getHeight(); + AssertFatal(bmp->getWidth() == getWidth(), "GFXD3D11TextureObject::copyToBmp - source/dest width does not match"); + AssertFatal(bmp->getHeight() == getHeight(), "GFXD3D11TextureObject::copyToBmp - source/dest height does not match"); + const U32 width = getWidth(); + const U32 height = getHeight(); bmp->setHasTransparency(mHasTransparency); @@ -201,21 +201,47 @@ bool GFXD3D11TextureObject::copyToBmp(GBitmap* bmp) destBytesPerPixel = 3; else // unsupported - AssertFatal(false, "unsupported bitmap format"); + AssertFatal(false, "GFXD3D11TextureObject::copyToBmp - unsupported bitmap format"); + PROFILE_START(GFXD3D11TextureObject_copyToBmp_pixCopy); - // lock the texture - DXGI_MAPPED_RECT* lockRect = (DXGI_MAPPED_RECT*) lock(); + //create temp staging texture + D3D11_TEXTURE2D_DESC desc; + static_cast(mD3DTexture)->GetDesc(&desc); + desc.BindFlags = 0; + desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE; + desc.Usage = D3D11_USAGE_STAGING; + + ID3D11Texture2D* pStagingTexture = NULL; + HRESULT hr = D3D11DEVICE->CreateTexture2D(&desc, NULL, &pStagingTexture); + if (FAILED(hr)) + { + Con::errorf("GFXD3D11TextureObject::copyToBmp - Failed to create staging texture"); + return false; + } + + //copy the classes texture to the staging texture + D3D11DEVICECONTEXT->CopyResource(pStagingTexture, mD3DTexture); + + //map the staging resource + D3D11_MAPPED_SUBRESOURCE mappedRes; + hr = D3D11DEVICECONTEXT->Map(pStagingTexture, 0, D3D11_MAP_READ, 0, &mappedRes); + if (FAILED(hr)) + { + //cleanup + SAFE_RELEASE(pStagingTexture); + Con::errorf("GFXD3D11TextureObject::copyToBmp - Failed to map staging texture"); + return false; + } // set pointers - U8* srcPtr = (U8*)lockRect->pBits; + const U8* srcPtr = (U8*)mappedRes.pData; U8* destPtr = bmp->getWritableBits(); // we will want to skip over any D3D cache data in the source texture - const S32 sourceCacheSize = lockRect->Pitch - width * sourceBytesPerPixel; - AssertFatal(sourceCacheSize >= 0, "copyToBmp: cache size is less than zero?"); + const S32 sourceCacheSize = mappedRes.RowPitch - width * sourceBytesPerPixel; + AssertFatal(sourceCacheSize >= 0, "GFXD3D11TextureObject::copyToBmp - cache size is less than zero?"); - PROFILE_START(GFXD3D11TextureObject_copyToBmp_pixCopy); // copy data into bitmap for (U32 row = 0; row < height; ++row) { @@ -236,14 +262,14 @@ bool GFXD3D11TextureObject::copyToBmp(GBitmap* bmp) // skip past the cache data for this row (if any) srcPtr += sourceCacheSize; } - PROFILE_END(); // assert if we stomped or underran memory - AssertFatal(U32(destPtr - bmp->getWritableBits()) == width * height * destBytesPerPixel, "copyToBmp: doh, memory error"); - AssertFatal(U32(srcPtr - (U8*)lockRect->pBits) == height * lockRect->Pitch, "copyToBmp: doh, memory error"); + AssertFatal(U32(destPtr - bmp->getWritableBits()) == width * height * destBytesPerPixel, "GFXD3D11TextureObject::copyToBmp - memory error"); + AssertFatal(U32(srcPtr - (U8*)mappedRes.pData) == height * mappedRes.RowPitch, "GFXD3D11TextureObject::copyToBmp - memory error"); - // unlock - unlock(); + D3D11DEVICECONTEXT->Unmap(pStagingTexture, 0); + + SAFE_RELEASE(pStagingTexture); PROFILE_END(); From cf156f505689bd764688ee0e96a2051e8ac57b00 Mon Sep 17 00:00:00 2001 From: Calvin Balke Date: Sun, 15 Jul 2018 11:50:09 -0700 Subject: [PATCH 133/144] Network Code Fixes This should be backwards compatible with existing network code, however it fixes a bug. --- Engine/source/core/stream/bitStream.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Engine/source/core/stream/bitStream.cpp b/Engine/source/core/stream/bitStream.cpp index 1a5ab3202..4a8553927 100644 --- a/Engine/source/core/stream/bitStream.cpp +++ b/Engine/source/core/stream/bitStream.cpp @@ -140,7 +140,7 @@ class HuffmanProcessor static HuffmanProcessor g_huffProcessor; - bool readHuffBuffer(BitStream* pStream, char* out_pBuffer); + bool readHuffBuffer(BitStream* pStream, char* out_pBuffer, S32 maxLen); bool writeHuffBuffer(BitStream* pStream, const char* out_pBuffer, S32 maxLen); }; @@ -667,12 +667,12 @@ void BitStream::readString(char buf[256]) if(readFlag()) { S32 offset = readInt(8); - HuffmanProcessor::g_huffProcessor.readHuffBuffer(this, stringBuffer + offset); + HuffmanProcessor::g_huffProcessor.readHuffBuffer(this, stringBuffer + offset, 256 - offset); dStrcpy(buf, stringBuffer, 256); return; } } - HuffmanProcessor::g_huffProcessor.readHuffBuffer(this, buf); + HuffmanProcessor::g_huffProcessor.readHuffBuffer(this, buf, 256); if(stringBuffer) dStrcpy(stringBuffer, buf, 256); } @@ -812,13 +812,16 @@ S16 HuffmanProcessor::determineIndex(HuffWrap& rWrap) } } -bool HuffmanProcessor::readHuffBuffer(BitStream* pStream, char* out_pBuffer) +bool HuffmanProcessor::readHuffBuffer(BitStream* pStream, char* out_pBuffer, S32 maxLen=256) { if (m_tablesBuilt == false) buildTables(); if (pStream->readFlag()) { S32 len = pStream->readInt(8); + if (len >= maxLen) { + len = maxLen; + } for (S32 i = 0; i < len; i++) { S32 index = 0; while (true) { @@ -839,6 +842,9 @@ bool HuffmanProcessor::readHuffBuffer(BitStream* pStream, char* out_pBuffer) } else { // Uncompressed string... U32 len = pStream->readInt(8); + if (len >= maxLen) { + len = maxLen; + } pStream->read(len, out_pBuffer); out_pBuffer[len] = '\0'; return true; From ae5fce616939c0416f122f1d90000a1fdc3d1195 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Fri, 27 Jul 2018 22:00:49 -0500 Subject: [PATCH 134/144] alternative to #2268 : remove secondary profiling --- Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp b/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp index d35eb1b34..d827b7a17 100644 --- a/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp +++ b/Engine/source/gfx/D3D11/gfxD3D11TextureObject.cpp @@ -202,9 +202,7 @@ bool GFXD3D11TextureObject::copyToBmp(GBitmap* bmp) else // unsupported AssertFatal(false, "GFXD3D11TextureObject::copyToBmp - unsupported bitmap format"); - - PROFILE_START(GFXD3D11TextureObject_copyToBmp_pixCopy); - + //create temp staging texture D3D11_TEXTURE2D_DESC desc; static_cast(mD3DTexture)->GetDesc(&desc); @@ -216,7 +214,7 @@ bool GFXD3D11TextureObject::copyToBmp(GBitmap* bmp) HRESULT hr = D3D11DEVICE->CreateTexture2D(&desc, NULL, &pStagingTexture); if (FAILED(hr)) { - Con::errorf("GFXD3D11TextureObject::copyToBmp - Failed to create staging texture"); + Con::errorf("GFXD3D11TextureObject::copyToBmp - Failed to create staging texture"); return false; } @@ -270,7 +268,6 @@ bool GFXD3D11TextureObject::copyToBmp(GBitmap* bmp) D3D11DEVICECONTEXT->Unmap(pStagingTexture, 0); SAFE_RELEASE(pStagingTexture); - PROFILE_END(); return true; From ee64270a2d498507a039b610b0ed85140b683240 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Tue, 7 Aug 2018 13:14:25 -0500 Subject: [PATCH 135/144] micro patch to the nativefiledialogues library to mirror file type name folks with 'hide extensions for known file types' on windows weren't seeing any entries in thier drop-down lists for file types. --- Engine/lib/nativeFileDialogs/nfd_win.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Engine/lib/nativeFileDialogs/nfd_win.cpp b/Engine/lib/nativeFileDialogs/nfd_win.cpp index a73fd8a46..1187fc84b 100644 --- a/Engine/lib/nativeFileDialogs/nfd_win.cpp +++ b/Engine/lib/nativeFileDialogs/nfd_win.cpp @@ -183,7 +183,7 @@ static nfdresult_t AddFiltersToDialog( ::IFileDialog *fileOpenDialog, const char /* end of filter -- add it to specList */ // Empty filter name -- Windows describes them by extension. - specList[specIdx].pszName = EMPTY_WSTR; + CopyNFDCharToWChar(specbuf, (wchar_t**)&specList[specIdx].pszName); CopyNFDCharToWChar( specbuf, (wchar_t**)&specList[specIdx].pszSpec ); memset( specbuf, 0, sizeof(char)*NFD_MAX_STRLEN ); @@ -203,7 +203,7 @@ static nfdresult_t AddFiltersToDialog( ::IFileDialog *fileOpenDialog, const char /* Add wildcard */ specList[specIdx].pszSpec = WILDCARD; - specList[specIdx].pszName = EMPTY_WSTR; + specList[specIdx].pszName = WILDCARD; fileOpenDialog->SetFileTypes( filterCount+1, specList ); From 02972b5961da8be4b8fbb7a8b62f258bb9422145 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 2 Sep 2018 03:50:31 -0500 Subject: [PATCH 136/144] Clear out old core structure before adding the new module-ified structure. --- .../BaseGame/game/core/CoreComponents.cs | 10 - .../BaseGame/game/core/CoreComponents.module | 19 - Templates/BaseGame/game/core/audio.cs | 436 --- Templates/BaseGame/game/core/canvas.cs | 162 - .../components/RigidBodyComponent.asset.taml | 8 - .../components/animationComponent.asset.taml | 8 - .../cameraOrbiterComponent.asset.taml | 8 - .../components/collisionComponent.asset.taml | 8 - .../core/components/game/camera.asset.taml | 9 - .../game/core/components/game/camera.cs | 185 -- .../components/game/controlObject.asset.taml | 10 - .../core/components/game/controlObject.cs | 89 - .../components/game/itemRotate.asset.taml | 10 - .../game/core/components/game/itemRotate.cs | 49 - .../components/game/playerSpawner.asset.taml | 10 - .../core/components/game/playerSpawner.cs | 78 - .../components/input/fpsControls.asset.taml | 9 - .../game/core/components/input/fpsControls.cs | 247 -- .../core/components/input/inputManager.cs | 82 - .../core/components/meshComponent.asset.taml | 8 - .../playerControllerComponent.asset.taml | 8 - .../core/components/soundComponent.asset.taml | 8 - .../stateMachineComponent.asset.taml | 8 - .../BaseGame/game/core/console/console.gui | 191 -- Templates/BaseGame/game/core/console/main.cs | 140 - .../BaseGame/game/core/console/profiles.cs | 70 - Templates/BaseGame/game/core/cursor.cs | 102 - .../game/core/fonts/Arial 10 (ansi).uft | Bin 412 -> 0 bytes .../game/core/fonts/Arial 12 (ansi).uft | Bin 62 -> 0 bytes .../game/core/fonts/Arial 14 (ansi).uft | Bin 5160 -> 0 bytes .../game/core/fonts/Arial 16 (ansi).uft | Bin 13112 -> 0 bytes .../game/core/fonts/Arial 36 (ansi).uft | Bin 1046 -> 0 bytes .../game/core/fonts/Arial Bold 14 (ansi).uft | Bin 3227 -> 0 bytes .../game/core/fonts/Arial Bold 16 (ansi).uft | Bin 1254 -> 0 bytes .../game/core/fonts/Arial Bold 18 (ansi).uft | Bin 5276 -> 0 bytes .../game/core/fonts/ArialBold 14 (ansi).uft | Bin 2276 -> 0 bytes .../game/core/fonts/ArialItalic 14 (ansi).uft | Bin 2951 -> 0 bytes .../core/fonts/Lucida Console 12 (ansi).uft | Bin 5897 -> 0 bytes .../BaseGame/game/core/gfxData/clouds.cs | 55 - .../game/core/gfxData/commonMaterialData.cs | 79 - .../BaseGame/game/core/gfxData/scatterSky.cs | 48 - .../BaseGame/game/core/gfxData/shaders.cs | 152 - .../game/core/gfxData/terrainBlock.cs | 36 - Templates/BaseGame/game/core/gfxData/water.cs | 208 -- .../gfxprofile/D3D9.ATITechnologiesInc.cs | 36 - .../gfxprofile/D3D9.NVIDIA.GeForce8600.cs | 36 - .../gfxprofile/D3D9.NVIDIA.QuadroFXGo1000.cs | 39 - .../game/core/gfxprofile/D3D9.NVIDIA.cs | 36 - .../BaseGame/game/core/gfxprofile/D3D9.cs | 26 - Templates/BaseGame/game/core/globals.cs | 102 - .../BaseGame/game/core/helperFunctions.cs | 1158 ------- .../BaseGame/game/core/images/AreaMap33.dds | Bin 109028 -> 0 bytes .../BaseGame/game/core/images/button.png | Bin 1153 -> 0 bytes .../BaseGame/game/core/images/caustics_1.png | Bin 34398 -> 0 bytes .../BaseGame/game/core/images/caustics_2.png | Bin 33963 -> 0 bytes .../BaseGame/game/core/images/checkbox.png | Bin 3943 -> 0 bytes .../game/core/images/group-border.png | Bin 1273 -> 0 bytes .../game/core/images/inactive-overlay.png | Bin 131 -> 0 bytes .../BaseGame/game/core/images/loadingbar.png | Bin 635 -> 0 bytes .../BaseGame/game/core/images/materials.cs | 32 - .../game/core/images/missingTexture.png | Bin 10645 -> 0 bytes Templates/BaseGame/game/core/images/noise.png | Bin 14610 -> 0 bytes .../game/core/images/null_color_ramp.png | Bin 2843 -> 0 bytes .../BaseGame/game/core/images/scrollBar.png | Bin 3332 -> 0 bytes .../BaseGame/game/core/images/textEdit.png | Bin 250 -> 0 bytes .../game/core/images/thumbHighlightButton.png | Bin 778 -> 0 bytes .../BaseGame/game/core/images/unavailable.png | Bin 26528 -> 0 bytes .../BaseGame/game/core/images/warnMat.dds | Bin 699192 -> 0 bytes .../BaseGame/game/core/images/window.png | Bin 2559 -> 0 bytes Templates/BaseGame/game/core/lighting.cs | 74 - .../core/lighting/advanced/deferredShading.cs | 71 - .../game/core/lighting/advanced/init.cs | 68 - .../game/core/lighting/advanced/shaders.cs | 276 -- .../BaseGame/game/core/lighting/basic/init.cs | 92 - .../game/core/lighting/basic/shadowFilter.cs | 76 - .../game/core/lighting/shadowMaps/init.cs | 32 - Templates/BaseGame/game/core/main.cs | 99 - Templates/BaseGame/game/core/oculusVR.cs | 248 -- .../BaseGame/game/core/oculusVROverlay.gui | 19 - Templates/BaseGame/game/core/parseArgs.cs | 392 --- .../BaseGame/game/core/postFX/GammaPostFX.cs | 73 - Templates/BaseGame/game/core/postFX/MLAA.cs | 186 -- .../BaseGame/game/core/postFX/MotionBlurFx.cs | 53 - .../BaseGame/game/core/postFX/caustics.cs | 64 - .../game/core/postFX/chromaticLens.cs | 77 - .../game/core/postFX/default.postfxpreset.cs | 72 - Templates/BaseGame/game/core/postFX/dof.cs | 599 ---- Templates/BaseGame/game/core/postFX/edgeAA.cs | 113 - Templates/BaseGame/game/core/postFX/flash.cs | 63 - Templates/BaseGame/game/core/postFX/fog.cs | 135 - Templates/BaseGame/game/core/postFX/fxaa.cs | 64 - Templates/BaseGame/game/core/postFX/glow.cs | 184 -- Templates/BaseGame/game/core/postFX/hdr.cs | 529 ---- .../BaseGame/game/core/postFX/lightRay.cs | 110 - .../game/core/postFX/ovrBarrelDistortion.cs | 167 - .../game/core/postFX/postFxManager.gui | 2755 ----------------- .../game/core/postFX/postFxManager.gui.cs | 446 --- .../core/postFX/postFxManager.gui.settings.cs | 439 --- .../core/postFX/postFxManager.persistance.cs | 79 - Templates/BaseGame/game/core/postFX/ssao.cs | 302 -- .../BaseGame/game/core/postFX/turbulence.cs | 57 - .../BaseGame/game/core/postFX/vignette.cs | 55 - Templates/BaseGame/game/core/postFx.cs | 88 - Templates/BaseGame/game/core/profiles.cs | 226 -- Templates/BaseGame/game/core/renderManager.cs | 136 - .../BaseGame/game/core/sfx/audioAmbience.cs | 44 - Templates/BaseGame/game/core/sfx/audioData.cs | 42 - .../game/core/sfx/audioDescriptions.cs | 143 - .../game/core/sfx/audioEnvironments.cs | 916 ------ .../BaseGame/game/core/sfx/audioStates.cs | 158 - .../core/shaders/VolumetricFog/VFogP.hlsl | 87 - .../core/shaders/VolumetricFog/VFogPreP.hlsl | 40 - .../core/shaders/VolumetricFog/VFogPreV.hlsl | 44 - .../core/shaders/VolumetricFog/VFogRefl.hlsl | 38 - .../core/shaders/VolumetricFog/VFogV.hlsl | 46 - .../core/shaders/VolumetricFog/gl/VFogP.glsl | 87 - .../shaders/VolumetricFog/gl/VFogPreP.glsl | 37 - .../shaders/VolumetricFog/gl/VFogPreV.glsl | 42 - .../shaders/VolumetricFog/gl/VFogRefl.glsl | 33 - .../core/shaders/VolumetricFog/gl/VFogV.glsl | 38 - .../game/core/shaders/basicCloudsP.hlsl | 37 - .../game/core/shaders/basicCloudsV.hlsl | 58 - .../game/core/shaders/cloudLayerP.hlsl | 146 - .../game/core/shaders/cloudLayerV.hlsl | 106 - .../fixedFunction/addColorTextureP.hlsl | 37 - .../fixedFunction/addColorTextureV.hlsl | 48 - .../core/shaders/fixedFunction/colorP.hlsl | 34 - .../core/shaders/fixedFunction/colorV.hlsl | 45 - .../fixedFunction/gl/addColorTextureP.glsl | 32 - .../fixedFunction/gl/addColorTextureV.glsl | 38 - .../core/shaders/fixedFunction/gl/colorP.glsl | 30 - .../core/shaders/fixedFunction/gl/colorV.glsl | 35 - .../fixedFunction/gl/modColorTextureP.glsl | 32 - .../fixedFunction/gl/modColorTextureV.glsl | 38 - .../fixedFunction/gl/targetRestoreP.glsl | 31 - .../fixedFunction/gl/targetRestoreV.glsl | 22 - .../shaders/fixedFunction/gl/textureP.glsl | 31 - .../shaders/fixedFunction/gl/textureV.glsl | 35 - .../fixedFunction/modColorTextureP.hlsl | 37 - .../fixedFunction/modColorTextureV.hlsl | 48 - .../shaders/fixedFunction/targetRestoreP.hlsl | 31 - .../shaders/fixedFunction/targetRestoreV.hlsl | 26 - .../core/shaders/fixedFunction/textureP.hlsl | 36 - .../core/shaders/fixedFunction/textureV.hlsl | 46 - .../BaseGame/game/core/shaders/foliage.hlsl | 186 -- .../core/shaders/fxFoliageReplicatorP.hlsl | 60 - .../core/shaders/fxFoliageReplicatorV.hlsl | 129 - .../game/core/shaders/gl/basicCloudsP.glsl | 39 - .../game/core/shaders/gl/basicCloudsV.glsl | 53 - .../BaseGame/game/core/shaders/gl/blurP.glsl | 39 - .../BaseGame/game/core/shaders/gl/blurV.glsl | 48 - .../game/core/shaders/gl/cloudLayerP.glsl | 147 - .../game/core/shaders/gl/cloudLayerV.glsl | 106 - .../game/core/shaders/gl/foliage.glsl | 186 -- .../core/shaders/gl/fxFoliageReplicatorP.glsl | 42 - .../core/shaders/gl/fxFoliageReplicatorV.glsl | 99 - .../game/core/shaders/gl/guiMaterialV.glsl | 39 - .../game/core/shaders/gl/hlslCompat.glsl | 101 - .../game/core/shaders/gl/imposter.glsl | 161 - .../game/core/shaders/gl/lighting.glsl | 249 -- .../core/shaders/gl/particleCompositeP.glsl | 62 - .../core/shaders/gl/particleCompositeV.glsl | 48 - .../game/core/shaders/gl/particlesP.glsl | 113 - .../game/core/shaders/gl/particlesV.glsl | 54 - .../core/shaders/gl/planarReflectBumpP.glsl | 70 - .../core/shaders/gl/planarReflectBumpV.glsl | 51 - .../game/core/shaders/gl/planarReflectP.glsl | 43 - .../game/core/shaders/gl/planarReflectV.glsl | 51 - .../game/core/shaders/gl/precipP.glsl | 39 - .../game/core/shaders/gl/precipV.glsl | 54 - .../core/shaders/gl/projectedShadowP.glsl | 37 - .../core/shaders/gl/projectedShadowV.glsl | 49 - .../game/core/shaders/gl/scatterSkyP.glsl | 72 - .../game/core/shaders/gl/scatterSkyV.glsl | 154 - .../BaseGame/game/core/shaders/gl/torque.glsl | 339 -- .../BaseGame/game/core/shaders/gl/wavesP.glsl | 57 - .../BaseGame/game/core/shaders/gl/wind.glsl | 101 - .../game/core/shaders/guiMaterialV.hlsl | 45 - .../BaseGame/game/core/shaders/hlslStructs.h | 116 - .../game/core/shaders/hlslStructs.hlsl | 114 - .../BaseGame/game/core/shaders/imposter.hlsl | 149 - .../BaseGame/game/core/shaders/lighting.hlsl | 249 -- .../lighting/advanced/convexGeometryV.hlsl | 54 - .../advanced/deferredClearGBufferP.hlsl | 54 - .../advanced/deferredClearGBufferV.hlsl | 43 - .../advanced/deferredColorShaderP.hlsl | 46 - .../lighting/advanced/deferredShadingP.hlsl | 54 - .../lighting/advanced/farFrustumQuad.hlsl | 47 - .../lighting/advanced/farFrustumQuadV.hlsl | 43 - .../lighting/advanced/gl/convexGeometryV.glsl | 52 - .../advanced/gl/deferredClearGBufferP.glsl | 40 - .../advanced/gl/deferredColorShaderP.glsl | 37 - .../advanced/gl/deferredShadingP.glsl | 59 - .../lighting/advanced/gl/farFrustumQuad.glsl | 30 - .../lighting/advanced/gl/farFrustumQuadV.glsl | 51 - .../lighting/advanced/gl/lightingUtils.glsl | 79 - .../lighting/advanced/gl/pointLightP.glsl | 273 -- .../lighting/advanced/gl/softShadow.glsl | 159 - .../lighting/advanced/gl/spotLightP.glsl | 210 -- .../lighting/advanced/gl/vectorLightP.glsl | 327 -- .../lighting/advanced/lightingUtils.hlsl | 51 - .../advanced/particlePointLightP.hlsl | 76 - .../advanced/particlePointLightV.hlsl | 48 - .../lighting/advanced/pointLightP.hlsl | 277 -- .../shaders/lighting/advanced/softShadow.hlsl | 158 - .../shaders/lighting/advanced/spotLightP.hlsl | 209 -- .../lighting/advanced/vectorLightP.hlsl | 328 -- .../lighting/basic/gl/shadowFilterP.glsl | 46 - .../lighting/basic/gl/shadowFilterV.glsl | 37 - .../shaders/lighting/basic/shadowFilterP.hlsl | 50 - .../shaders/lighting/basic/shadowFilterV.hlsl | 42 - .../lighting/shadowMap/boxFilterP.hlsl | 82 - .../lighting/shadowMap/boxFilterV.hlsl | 57 - .../lighting/shadowMap/gl/boxFilterP.glsl | 49 - .../lighting/shadowMap/gl/boxFilterV.glsl | 34 - .../shaders/lighting/shadowMap/shadowMapIO.h | 50 - .../lighting/shadowMap/shadowMapIO_GLSL.h | 50 - .../lighting/shadowMap/shadowMapIO_HLSL.h | 50 - .../game/core/shaders/particleCompositeP.hlsl | 61 - .../game/core/shaders/particleCompositeV.hlsl | 53 - .../game/core/shaders/particlesP.hlsl | 109 - .../game/core/shaders/particlesV.hlsl | 55 - .../game/core/shaders/planarReflectBumpP.hlsl | 87 - .../game/core/shaders/planarReflectBumpV.hlsl | 67 - .../game/core/shaders/planarReflectP.hlsl | 58 - .../game/core/shaders/planarReflectV.hlsl | 57 - .../game/core/shaders/postFX/VolFogGlowP.hlsl | 74 - .../shaders/postFX/caustics/causticsP.hlsl | 77 - .../shaders/postFX/caustics/gl/causticsP.glsl | 87 - .../core/shaders/postFX/chromaticLens.hlsl | 60 - .../shaders/postFX/dof/DOF_CalcCoC_P.hlsl | 53 - .../shaders/postFX/dof/DOF_CalcCoC_V.hlsl | 70 - .../shaders/postFX/dof/DOF_DownSample_P.hlsl | 143 - .../shaders/postFX/dof/DOF_DownSample_V.hlsl | 61 - .../core/shaders/postFX/dof/DOF_Final_P.hlsl | 145 - .../core/shaders/postFX/dof/DOF_Final_V.hlsl | 72 - .../shaders/postFX/dof/DOF_Gausian_P.hlsl | 63 - .../shaders/postFX/dof/DOF_Gausian_V.hlsl | 80 - .../shaders/postFX/dof/DOF_Passthrough_V.hlsl | 70 - .../shaders/postFX/dof/DOF_SmallBlur_P.hlsl | 46 - .../shaders/postFX/dof/DOF_SmallBlur_V.hlsl | 56 - .../shaders/postFX/dof/gl/DOF_CalcCoC_P.glsl | 55 - .../shaders/postFX/dof/gl/DOF_CalcCoC_V.glsl | 69 - .../postFX/dof/gl/DOF_DownSample_P.glsl | 143 - .../postFX/dof/gl/DOF_DownSample_V.glsl | 67 - .../shaders/postFX/dof/gl/DOF_Final_P.glsl | 147 - .../shaders/postFX/dof/gl/DOF_Final_V.glsl | 71 - .../shaders/postFX/dof/gl/DOF_Gausian_P.glsl | 68 - .../shaders/postFX/dof/gl/DOF_Gausian_V.glsl | 91 - .../postFX/dof/gl/DOF_Passthrough_V.glsl | 69 - .../postFX/dof/gl/DOF_SmallBlur_P.glsl | 46 - .../postFX/dof/gl/DOF_SmallBlur_V.glsl | 54 - .../postFX/edgeaa/dbgEdgeDisplayP.hlsl | 30 - .../core/shaders/postFX/edgeaa/edgeAAP.hlsl | 66 - .../core/shaders/postFX/edgeaa/edgeAAV.hlsl | 45 - .../shaders/postFX/edgeaa/edgeDetectP.hlsl | 93 - .../postFX/edgeaa/gl/dbgEdgeDisplayP.glsl | 36 - .../shaders/postFX/edgeaa/gl/edgeAAP.glsl | 70 - .../shaders/postFX/edgeaa/gl/edgeAAV.glsl | 43 - .../shaders/postFX/edgeaa/gl/edgeDetectP.glsl | 96 - .../game/core/shaders/postFX/flashP.hlsl | 36 - .../game/core/shaders/postFX/fogP.hlsl | 47 - .../game/core/shaders/postFX/fxaa/Fxaa3_11.h | 2047 ------------ .../game/core/shaders/postFX/fxaa/fxaaP.hlsl | 143 - .../game/core/shaders/postFX/fxaa/fxaaV.hlsl | 42 - .../core/shaders/postFX/fxaa/gl/fxaaP.glsl | 125 - .../core/shaders/postFX/fxaa/gl/fxaaV.glsl | 40 - .../game/core/shaders/postFX/gammaP.hlsl | 50 - .../core/shaders/postFX/gl/VolFogGlowP.glsl | 67 - .../core/shaders/postFX/gl/chromaticLens.glsl | 62 - .../game/core/shaders/postFX/gl/flashP.glsl | 39 - .../game/core/shaders/postFX/gl/fogP.glsl | 52 - .../game/core/shaders/postFX/gl/gammaP.glsl | 54 - .../core/shaders/postFX/gl/glowBlurP.glsl | 59 - .../core/shaders/postFX/gl/glowBlurV.glsl | 59 - .../core/shaders/postFX/gl/motionBlurP.glsl | 78 - .../core/shaders/postFX/gl/passthruP.glsl | 33 - .../game/core/shaders/postFX/gl/postFX.glsl | 63 - .../game/core/shaders/postFX/gl/postFxV.glsl | 52 - .../core/shaders/postFX/gl/turbulenceP.glsl | 52 - .../shaders/postFX/gl/underwaterFogP.glsl | 140 - .../game/core/shaders/postFX/glowBlurP.hlsl | 63 - .../game/core/shaders/postFX/glowBlurV.hlsl | 63 - .../shaders/postFX/hdr/bloomGaussBlurHP.hlsl | 68 - .../shaders/postFX/hdr/bloomGaussBlurVP.hlsl | 67 - .../shaders/postFX/hdr/brightPassFilterP.hlsl | 62 - .../postFX/hdr/calculateAdaptedLumP.hlsl | 44 - .../shaders/postFX/hdr/downScale4x4P.hlsl | 53 - .../shaders/postFX/hdr/downScale4x4V.hlsl | 138 - .../shaders/postFX/hdr/finalPassCombineP.hlsl | 92 - .../postFX/hdr/gl/bloomGaussBlurHP.glsl | 72 - .../postFX/hdr/gl/bloomGaussBlurVP.glsl | 71 - .../postFX/hdr/gl/brightPassFilterP.glsl | 65 - .../postFX/hdr/gl/calculateAdaptedLumP.glsl | 48 - .../shaders/postFX/hdr/gl/downScale4x4P.glsl | 50 - .../shaders/postFX/hdr/gl/downScale4x4V.glsl | 141 - .../postFX/hdr/gl/finalPassCombineP.glsl | 97 - .../shaders/postFX/hdr/gl/luminanceVisP.glsl | 42 - .../postFX/hdr/gl/sampleLumInitialP.glsl | 62 - .../postFX/hdr/gl/sampleLumIterativeP.glsl | 52 - .../shaders/postFX/hdr/luminanceVisP.hlsl | 39 - .../shaders/postFX/hdr/sampleLumInitialP.hlsl | 59 - .../postFX/hdr/sampleLumIterativeP.hlsl | 50 - .../postFX/lightRay/gl/lightRayOccludeP.glsl | 55 - .../shaders/postFX/lightRay/gl/lightRayP.glsl | 94 - .../postFX/lightRay/lightRayOccludeP.hlsl | 53 - .../shaders/postFX/lightRay/lightRayP.hlsl | 89 - .../postFX/mlaa/blendWeightCalculationP.hlsl | 78 - .../shaders/postFX/mlaa/edgeDetectionP.hlsl | 72 - .../core/shaders/postFX/mlaa/functions.hlsl | 145 - .../mlaa/gl/blendWeightCalculationP.glsl | 83 - .../postFX/mlaa/gl/edgeDetectionP.glsl | 76 - .../shaders/postFX/mlaa/gl/functions.glsl | 145 - .../postFX/mlaa/gl/neighborhoodBlendingP.glsl | 88 - .../core/shaders/postFX/mlaa/gl/offsetV.glsl | 57 - .../shaders/postFX/mlaa/gl/passthruV.glsl | 52 - .../postFX/mlaa/neighborhoodBlendingP.hlsl | 84 - .../core/shaders/postFX/mlaa/offsetV.hlsl | 42 - .../core/shaders/postFX/mlaa/passthruV.hlsl | 37 - .../game/core/shaders/postFX/motionBlurP.hlsl | 70 - .../oculusvr/barrelDistortionChromaP.hlsl | 95 - .../postFX/oculusvr/barrelDistortionP.hlsl | 80 - .../oculusvr/gl/barrelDistortionChromaP.glsl | 95 - .../postFX/oculusvr/gl/barrelDistortionP.glsl | 81 - .../postFX/oculusvr/gl/monoToStereoP.glsl | 60 - .../postFX/oculusvr/monoToStereoP.hlsl | 59 - .../game/core/shaders/postFX/passthruP.hlsl | 30 - .../game/core/shaders/postFX/postFx.hlsl | 40 - .../game/core/shaders/postFX/postFxV.glsl | 51 - .../game/core/shaders/postFX/postFxV.hlsl | 45 - .../core/shaders/postFX/ssao/SSAO_Blur_P.hlsl | 106 - .../core/shaders/postFX/ssao/SSAO_Blur_V.hlsl | 86 - .../game/core/shaders/postFX/ssao/SSAO_P.hlsl | 272 -- .../postFX/ssao/SSAO_PowerTable_P.hlsl | 29 - .../postFX/ssao/SSAO_PowerTable_V.hlsl | 45 - .../shaders/postFX/ssao/gl/SSAO_Blur_P.glsl | 108 - .../shaders/postFX/ssao/gl/SSAO_Blur_V.glsl | 96 - .../core/shaders/postFX/ssao/gl/SSAO_P.glsl | 278 -- .../postFX/ssao/gl/SSAO_PowerTable_P.glsl | 34 - .../postFX/ssao/gl/SSAO_PowerTable_V.glsl | 38 - .../game/core/shaders/postFX/turbulenceP.hlsl | 44 - .../core/shaders/postFX/underwaterFogP.hlsl | 138 - .../shaders/postFX/vignette/VignetteP.hlsl | 35 - .../shaders/postFX/vignette/gl/VignetteP.glsl | 41 - .../BaseGame/game/core/shaders/precipP.hlsl | 53 - .../BaseGame/game/core/shaders/precipV.hlsl | 71 - .../game/core/shaders/projectedShadowP.hlsl | 40 - .../game/core/shaders/projectedShadowV.hlsl | 60 - .../shaders/ribbons/basicRibbonShaderP.hlsl | 19 - .../shaders/ribbons/basicRibbonShaderV.hlsl | 35 - .../ribbons/gl/basicRibbonShaderP.glsl | 20 - .../ribbons/gl/basicRibbonShaderV.glsl | 37 - .../shaders/ribbons/gl/texRibbonShaderP.glsl | 22 - .../shaders/ribbons/gl/texRibbonShaderV.glsl | 37 - .../shaders/ribbons/texRibbonShaderP.hlsl | 21 - .../shaders/ribbons/texRibbonShaderV.hlsl | 35 - .../game/core/shaders/scatterSkyP.hlsl | 69 - .../game/core/shaders/scatterSkyV.hlsl | 157 - .../game/core/shaders/shaderModel.hlsl | 97 - .../game/core/shaders/shaderModelAutoGen.hlsl | 35 - .../BaseGame/game/core/shaders/shdrConsts.h | 117 - .../game/core/shaders/terrain/blendP.hlsl | 48 - .../game/core/shaders/terrain/blendV.hlsl | 52 - .../game/core/shaders/terrain/gl/blendP.glsl | 48 - .../game/core/shaders/terrain/gl/blendV.glsl | 41 - .../game/core/shaders/terrain/terrain.glsl | 52 - .../game/core/shaders/terrain/terrain.hlsl | 55 - .../BaseGame/game/core/shaders/torque.hlsl | 342 -- .../core/shaders/water/gl/waterBasicP.glsl | 216 -- .../core/shaders/water/gl/waterBasicV.glsl | 243 -- .../game/core/shaders/water/gl/waterP.glsl | 396 --- .../game/core/shaders/water/gl/waterV.glsl | 241 -- .../game/core/shaders/water/waterBasicP.hlsl | 213 -- .../game/core/shaders/water/waterBasicV.hlsl | 237 -- .../game/core/shaders/water/waterP.hlsl | 383 --- .../game/core/shaders/water/waterV.hlsl | 216 -- .../BaseGame/game/core/shaders/wavesP.hlsl | 89 - .../BaseGame/game/core/shaders/wavesV.hlsl | 90 - .../BaseGame/game/core/shaders/wind.hlsl | 101 - .../game/data/clientServer/ClientServer.cs | 112 - .../data/clientServer/ClientServer.module | 9 - .../clientServer/scripts/client/client.cs | 29 - .../scripts/client/connectionToServer.cs | 130 - .../scripts/client/levelDownload.cs | 185 -- .../clientServer/scripts/client/levelLoad.cs | 92 - .../clientServer/scripts/client/message.cs | 94 - .../data/clientServer/scripts/server/audio.cs | 40 - .../clientServer/scripts/server/commands.cs | 35 - .../scripts/server/connectionToClient.cs | 178 -- .../clientServer/scripts/server/defaults.cs | 62 - .../clientServer/scripts/server/kickban.cs | 41 - .../scripts/server/levelDownload.cs | 187 -- .../clientServer/scripts/server/levelInfo.cs | 197 -- .../clientServer/scripts/server/levelLoad.cs | 181 -- .../clientServer/scripts/server/message.cs | 50 - .../clientServer/scripts/server/server.cs | 303 -- 396 files changed, 39611 deletions(-) delete mode 100644 Templates/BaseGame/game/core/CoreComponents.cs delete mode 100644 Templates/BaseGame/game/core/CoreComponents.module delete mode 100644 Templates/BaseGame/game/core/audio.cs delete mode 100644 Templates/BaseGame/game/core/canvas.cs delete mode 100644 Templates/BaseGame/game/core/components/RigidBodyComponent.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/animationComponent.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/cameraOrbiterComponent.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/collisionComponent.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/game/camera.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/game/camera.cs delete mode 100644 Templates/BaseGame/game/core/components/game/controlObject.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/game/controlObject.cs delete mode 100644 Templates/BaseGame/game/core/components/game/itemRotate.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/game/itemRotate.cs delete mode 100644 Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/game/playerSpawner.cs delete mode 100644 Templates/BaseGame/game/core/components/input/fpsControls.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/input/fpsControls.cs delete mode 100644 Templates/BaseGame/game/core/components/input/inputManager.cs delete mode 100644 Templates/BaseGame/game/core/components/meshComponent.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/playerControllerComponent.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/soundComponent.asset.taml delete mode 100644 Templates/BaseGame/game/core/components/stateMachineComponent.asset.taml delete mode 100644 Templates/BaseGame/game/core/console/console.gui delete mode 100644 Templates/BaseGame/game/core/console/main.cs delete mode 100644 Templates/BaseGame/game/core/console/profiles.cs delete mode 100644 Templates/BaseGame/game/core/cursor.cs delete mode 100644 Templates/BaseGame/game/core/fonts/Arial 10 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/Arial 12 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/Arial 14 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/Arial 16 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/Arial 36 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/Arial Bold 14 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/Arial Bold 16 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/Arial Bold 18 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/ArialBold 14 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/ArialItalic 14 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/fonts/Lucida Console 12 (ansi).uft delete mode 100644 Templates/BaseGame/game/core/gfxData/clouds.cs delete mode 100644 Templates/BaseGame/game/core/gfxData/commonMaterialData.cs delete mode 100644 Templates/BaseGame/game/core/gfxData/scatterSky.cs delete mode 100644 Templates/BaseGame/game/core/gfxData/shaders.cs delete mode 100644 Templates/BaseGame/game/core/gfxData/terrainBlock.cs delete mode 100644 Templates/BaseGame/game/core/gfxData/water.cs delete mode 100644 Templates/BaseGame/game/core/gfxprofile/D3D9.ATITechnologiesInc.cs delete mode 100644 Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.GeForce8600.cs delete mode 100644 Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.QuadroFXGo1000.cs delete mode 100644 Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.cs delete mode 100644 Templates/BaseGame/game/core/gfxprofile/D3D9.cs delete mode 100644 Templates/BaseGame/game/core/globals.cs delete mode 100644 Templates/BaseGame/game/core/helperFunctions.cs delete mode 100644 Templates/BaseGame/game/core/images/AreaMap33.dds delete mode 100644 Templates/BaseGame/game/core/images/button.png delete mode 100644 Templates/BaseGame/game/core/images/caustics_1.png delete mode 100644 Templates/BaseGame/game/core/images/caustics_2.png delete mode 100644 Templates/BaseGame/game/core/images/checkbox.png delete mode 100644 Templates/BaseGame/game/core/images/group-border.png delete mode 100644 Templates/BaseGame/game/core/images/inactive-overlay.png delete mode 100644 Templates/BaseGame/game/core/images/loadingbar.png delete mode 100644 Templates/BaseGame/game/core/images/materials.cs delete mode 100644 Templates/BaseGame/game/core/images/missingTexture.png delete mode 100644 Templates/BaseGame/game/core/images/noise.png delete mode 100644 Templates/BaseGame/game/core/images/null_color_ramp.png delete mode 100644 Templates/BaseGame/game/core/images/scrollBar.png delete mode 100644 Templates/BaseGame/game/core/images/textEdit.png delete mode 100644 Templates/BaseGame/game/core/images/thumbHighlightButton.png delete mode 100644 Templates/BaseGame/game/core/images/unavailable.png delete mode 100644 Templates/BaseGame/game/core/images/warnMat.dds delete mode 100644 Templates/BaseGame/game/core/images/window.png delete mode 100644 Templates/BaseGame/game/core/lighting.cs delete mode 100644 Templates/BaseGame/game/core/lighting/advanced/deferredShading.cs delete mode 100644 Templates/BaseGame/game/core/lighting/advanced/init.cs delete mode 100644 Templates/BaseGame/game/core/lighting/advanced/shaders.cs delete mode 100644 Templates/BaseGame/game/core/lighting/basic/init.cs delete mode 100644 Templates/BaseGame/game/core/lighting/basic/shadowFilter.cs delete mode 100644 Templates/BaseGame/game/core/lighting/shadowMaps/init.cs delete mode 100644 Templates/BaseGame/game/core/main.cs delete mode 100644 Templates/BaseGame/game/core/oculusVR.cs delete mode 100644 Templates/BaseGame/game/core/oculusVROverlay.gui delete mode 100644 Templates/BaseGame/game/core/parseArgs.cs delete mode 100644 Templates/BaseGame/game/core/postFX/GammaPostFX.cs delete mode 100644 Templates/BaseGame/game/core/postFX/MLAA.cs delete mode 100644 Templates/BaseGame/game/core/postFX/MotionBlurFx.cs delete mode 100644 Templates/BaseGame/game/core/postFX/caustics.cs delete mode 100644 Templates/BaseGame/game/core/postFX/chromaticLens.cs delete mode 100644 Templates/BaseGame/game/core/postFX/default.postfxpreset.cs delete mode 100644 Templates/BaseGame/game/core/postFX/dof.cs delete mode 100644 Templates/BaseGame/game/core/postFX/edgeAA.cs delete mode 100644 Templates/BaseGame/game/core/postFX/flash.cs delete mode 100644 Templates/BaseGame/game/core/postFX/fog.cs delete mode 100644 Templates/BaseGame/game/core/postFX/fxaa.cs delete mode 100644 Templates/BaseGame/game/core/postFX/glow.cs delete mode 100644 Templates/BaseGame/game/core/postFX/hdr.cs delete mode 100644 Templates/BaseGame/game/core/postFX/lightRay.cs delete mode 100644 Templates/BaseGame/game/core/postFX/ovrBarrelDistortion.cs delete mode 100644 Templates/BaseGame/game/core/postFX/postFxManager.gui delete mode 100644 Templates/BaseGame/game/core/postFX/postFxManager.gui.cs delete mode 100644 Templates/BaseGame/game/core/postFX/postFxManager.gui.settings.cs delete mode 100644 Templates/BaseGame/game/core/postFX/postFxManager.persistance.cs delete mode 100644 Templates/BaseGame/game/core/postFX/ssao.cs delete mode 100644 Templates/BaseGame/game/core/postFX/turbulence.cs delete mode 100644 Templates/BaseGame/game/core/postFX/vignette.cs delete mode 100644 Templates/BaseGame/game/core/postFx.cs delete mode 100644 Templates/BaseGame/game/core/profiles.cs delete mode 100644 Templates/BaseGame/game/core/renderManager.cs delete mode 100644 Templates/BaseGame/game/core/sfx/audioAmbience.cs delete mode 100644 Templates/BaseGame/game/core/sfx/audioData.cs delete mode 100644 Templates/BaseGame/game/core/sfx/audioDescriptions.cs delete mode 100644 Templates/BaseGame/game/core/sfx/audioEnvironments.cs delete mode 100644 Templates/BaseGame/game/core/sfx/audioStates.cs delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/VFogP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/VFogPreP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/VFogPreV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/VFogRefl.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/VFogV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/gl/VFogP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/gl/VFogPreP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/gl/VFogPreV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/gl/VFogRefl.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/VolumetricFog/gl/VFogV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/basicCloudsP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/basicCloudsV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/cloudLayerP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/cloudLayerV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/addColorTextureP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/addColorTextureV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/colorP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/colorV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/addColorTextureP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/addColorTextureV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/colorP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/colorV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/modColorTextureP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/modColorTextureV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/targetRestoreP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/targetRestoreV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/textureP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/gl/textureV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/modColorTextureP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/modColorTextureV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/targetRestoreP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/targetRestoreV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/textureP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fixedFunction/textureV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/foliage.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fxFoliageReplicatorP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/fxFoliageReplicatorV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/basicCloudsP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/basicCloudsV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/blurP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/blurV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/cloudLayerP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/cloudLayerV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/foliage.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/fxFoliageReplicatorP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/fxFoliageReplicatorV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/guiMaterialV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/hlslCompat.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/imposter.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/lighting.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/particleCompositeP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/particleCompositeV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/particlesP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/particlesV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/planarReflectBumpP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/planarReflectBumpV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/planarReflectP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/planarReflectV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/precipP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/precipV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/projectedShadowP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/projectedShadowV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/scatterSkyP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/scatterSkyV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/torque.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/wavesP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/gl/wind.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/guiMaterialV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/hlslStructs.h delete mode 100644 Templates/BaseGame/game/core/shaders/hlslStructs.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/imposter.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/convexGeometryV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/deferredClearGBufferP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/deferredClearGBufferV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/deferredColorShaderP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/deferredShadingP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/farFrustumQuad.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/farFrustumQuadV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/convexGeometryV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/deferredClearGBufferP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/deferredColorShaderP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/deferredShadingP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/farFrustumQuad.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/farFrustumQuadV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/lightingUtils.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/pointLightP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/softShadow.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/spotLightP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/gl/vectorLightP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/lightingUtils.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/particlePointLightP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/particlePointLightV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/pointLightP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/softShadow.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/spotLightP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/advanced/vectorLightP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/basic/gl/shadowFilterP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/basic/gl/shadowFilterV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/basic/shadowFilterP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/basic/shadowFilterV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/shadowMap/boxFilterP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/shadowMap/boxFilterV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/shadowMap/gl/boxFilterP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/shadowMap/gl/boxFilterV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/shadowMap/shadowMapIO.h delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/shadowMap/shadowMapIO_GLSL.h delete mode 100644 Templates/BaseGame/game/core/shaders/lighting/shadowMap/shadowMapIO_HLSL.h delete mode 100644 Templates/BaseGame/game/core/shaders/particleCompositeP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/particleCompositeV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/particlesP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/particlesV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/planarReflectBumpP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/planarReflectBumpV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/planarReflectP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/planarReflectV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/VolFogGlowP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/caustics/causticsP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/caustics/gl/causticsP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/chromaticLens.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_CalcCoC_P.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_CalcCoC_V.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_DownSample_P.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_DownSample_V.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_Final_P.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_Final_V.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_Gausian_P.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_Gausian_V.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_Passthrough_V.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_SmallBlur_P.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/DOF_SmallBlur_V.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_CalcCoC_P.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_CalcCoC_V.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_DownSample_P.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_DownSample_V.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_Final_P.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_Final_V.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_Gausian_P.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_Gausian_V.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_Passthrough_V.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_SmallBlur_P.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/dof/gl/DOF_SmallBlur_V.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/edgeaa/dbgEdgeDisplayP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/edgeaa/edgeAAP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/edgeaa/edgeAAV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/edgeaa/edgeDetectP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/edgeaa/gl/dbgEdgeDisplayP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/edgeaa/gl/edgeAAP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/edgeaa/gl/edgeAAV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/edgeaa/gl/edgeDetectP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/flashP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/fogP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/fxaa/Fxaa3_11.h delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/fxaa/fxaaP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/fxaa/fxaaV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/fxaa/gl/fxaaP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/fxaa/gl/fxaaV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gammaP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/VolFogGlowP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/chromaticLens.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/flashP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/fogP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/gammaP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/glowBlurP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/glowBlurV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/motionBlurP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/passthruP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/postFX.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/postFxV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/turbulenceP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/gl/underwaterFogP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/glowBlurP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/glowBlurV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/bloomGaussBlurHP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/bloomGaussBlurVP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/brightPassFilterP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/calculateAdaptedLumP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/downScale4x4P.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/downScale4x4V.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/finalPassCombineP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/bloomGaussBlurHP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/bloomGaussBlurVP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/brightPassFilterP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/calculateAdaptedLumP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/downScale4x4P.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/downScale4x4V.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/finalPassCombineP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/luminanceVisP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/sampleLumInitialP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/gl/sampleLumIterativeP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/luminanceVisP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/sampleLumInitialP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/hdr/sampleLumIterativeP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/lightRay/gl/lightRayOccludeP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/lightRay/gl/lightRayP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/lightRay/lightRayOccludeP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/lightRay/lightRayP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/blendWeightCalculationP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/edgeDetectionP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/functions.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/gl/blendWeightCalculationP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/gl/edgeDetectionP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/gl/functions.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/gl/neighborhoodBlendingP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/gl/offsetV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/gl/passthruV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/neighborhoodBlendingP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/offsetV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/mlaa/passthruV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/motionBlurP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/oculusvr/barrelDistortionChromaP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/oculusvr/barrelDistortionP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/oculusvr/gl/barrelDistortionChromaP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/oculusvr/gl/barrelDistortionP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/oculusvr/gl/monoToStereoP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/oculusvr/monoToStereoP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/passthruP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/postFx.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/postFxV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/postFxV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_Blur_P.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_Blur_V.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_P.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_PowerTable_P.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/SSAO_PowerTable_V.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/gl/SSAO_Blur_P.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/gl/SSAO_Blur_V.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/gl/SSAO_P.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/gl/SSAO_PowerTable_P.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/ssao/gl/SSAO_PowerTable_V.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/turbulenceP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/underwaterFogP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/vignette/VignetteP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/postFX/vignette/gl/VignetteP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/precipP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/precipV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/projectedShadowP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/projectedShadowV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/ribbons/basicRibbonShaderP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/ribbons/basicRibbonShaderV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/ribbons/gl/basicRibbonShaderP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/ribbons/gl/basicRibbonShaderV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/ribbons/gl/texRibbonShaderP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/ribbons/gl/texRibbonShaderV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/ribbons/texRibbonShaderP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/ribbons/texRibbonShaderV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/scatterSkyP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/scatterSkyV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/shaderModel.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/shaderModelAutoGen.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/shdrConsts.h delete mode 100644 Templates/BaseGame/game/core/shaders/terrain/blendP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/terrain/blendV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/terrain/gl/blendP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/terrain/gl/blendV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/terrain/terrain.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/terrain/terrain.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/torque.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/water/gl/waterBasicP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/water/gl/waterBasicV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/water/gl/waterP.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/water/gl/waterV.glsl delete mode 100644 Templates/BaseGame/game/core/shaders/water/waterBasicP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/water/waterBasicV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/water/waterP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/water/waterV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/wavesP.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/wavesV.hlsl delete mode 100644 Templates/BaseGame/game/core/shaders/wind.hlsl delete mode 100644 Templates/BaseGame/game/data/clientServer/ClientServer.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/ClientServer.module delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/client/client.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/client/connectionToServer.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/client/levelDownload.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/client/levelLoad.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/client/message.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/audio.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/commands.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/connectionToClient.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/defaults.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/kickban.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/levelDownload.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/levelInfo.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/levelLoad.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/message.cs delete mode 100644 Templates/BaseGame/game/data/clientServer/scripts/server/server.cs diff --git a/Templates/BaseGame/game/core/CoreComponents.cs b/Templates/BaseGame/game/core/CoreComponents.cs deleted file mode 100644 index 5bdca8cd3..000000000 --- a/Templates/BaseGame/game/core/CoreComponents.cs +++ /dev/null @@ -1,10 +0,0 @@ - -function CoreComponentsModule::onCreate(%this) -{ - %classList = enumerateConsoleClasses( "Component" ); - - foreach$( %componentClass in %classList ) - { - echo("Native Component of type: " @ %componentClass); - } -} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/CoreComponents.module b/Templates/BaseGame/game/core/CoreComponents.module deleted file mode 100644 index 0636e3bb5..000000000 --- a/Templates/BaseGame/game/core/CoreComponents.module +++ /dev/null @@ -1,19 +0,0 @@ - - - - \ No newline at end of file diff --git a/Templates/BaseGame/game/core/audio.cs b/Templates/BaseGame/game/core/audio.cs deleted file mode 100644 index a5932de8f..000000000 --- a/Templates/BaseGame/game/core/audio.cs +++ /dev/null @@ -1,436 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// Source groups. -//----------------------------------------------------------------------------- - -singleton SFXDescription( AudioMaster ); -singleton SFXSource( AudioChannelMaster ) -{ - description = AudioMaster; -}; - -singleton SFXDescription( AudioChannel ) -{ - sourceGroup = AudioChannelMaster; -}; - -singleton SFXSource( AudioChannelDefault ) -{ - description = AudioChannel; -}; -singleton SFXSource( AudioChannelGui ) -{ - description = AudioChannel; -}; -singleton SFXSource( AudioChannelEffects ) -{ - description = AudioChannel; -}; -singleton SFXSource( AudioChannelMessages ) -{ - description = AudioChannel; -}; -singleton SFXSource( AudioChannelMusic ) -{ - description = AudioChannel; -}; - -// Set default playback states of the channels. - -AudioChannelMaster.play(); -AudioChannelDefault.play(); - -AudioChannelGui.play(); -AudioChannelMusic.play(); -AudioChannelMessages.play(); - -// Stop in-game effects channels. -AudioChannelEffects.stop(); - -//----------------------------------------------------------------------------- -// Master SFXDescriptions. -//----------------------------------------------------------------------------- - -// Master description for interface audio. -singleton SFXDescription( AudioGui ) -{ - volume = 1.0; - sourceGroup = AudioChannelGui; -}; - -// Master description for game effects audio. -singleton SFXDescription( AudioEffect ) -{ - volume = 1.0; - sourceGroup = AudioChannelEffects; -}; - -// Master description for audio in notifications. -singleton SFXDescription( AudioMessage ) -{ - volume = 1.0; - sourceGroup = AudioChannelMessages; -}; - -// Master description for music. -singleton SFXDescription( AudioMusic ) -{ - volume = 1.0; - sourceGroup = AudioChannelMusic; -}; - -//----------------------------------------------------------------------------- -// SFX Functions. -//----------------------------------------------------------------------------- - -/// This initializes the sound system device from -/// the defaults in the $pref::SFX:: globals. -function sfxStartup() -{ - echo( "\nsfxStartup..." ); - - // If we have a provider set, try initialize a device now. - - if( $pref::SFX::provider !$= "" ) - { - if( sfxInit() ) - return; - else - { - // Force auto-detection. - $pref::SFX::autoDetect = true; - } - } - - // If enabled autodetect a safe device. - - if( ( !isDefined( "$pref::SFX::autoDetect" ) || $pref::SFX::autoDetect ) && - sfxAutodetect() ) - return; - - // Failure. - - error( " Failed to initialize device!\n\n" ); - - $pref::SFX::provider = ""; - $pref::SFX::device = ""; - - return; -} - - -/// This initializes the sound system device from -/// the defaults in the $pref::SFX:: globals. -function sfxInit() -{ - // If already initialized, shut down the current device first. - - if( sfxGetDeviceInfo() !$= "" ) - sfxShutdown(); - - // Start it up! - %maxBuffers = $pref::SFX::useHardware ? -1 : $pref::SFX::maxSoftwareBuffers; - if ( !sfxCreateDevice( $pref::SFX::provider, $pref::SFX::device, $pref::SFX::useHardware, %maxBuffers ) ) - return false; - - // This returns a tab seperated string with - // the initialized system info. - %info = sfxGetDeviceInfo(); - $pref::SFX::provider = getField( %info, 0 ); - $pref::SFX::device = getField( %info, 1 ); - $pref::SFX::useHardware = getField( %info, 2 ); - %useHardware = $pref::SFX::useHardware ? "Yes" : "No"; - %maxBuffers = getField( %info, 3 ); - - echo( " Provider: " @ $pref::SFX::provider ); - echo( " Device: " @ $pref::SFX::device ); - echo( " Hardware: " @ %useHardware ); - echo( " Max Buffers: " @ %maxBuffers ); - echo( " " ); - - if( isDefined( "$pref::SFX::distanceModel" ) ) - sfxSetDistanceModel( $pref::SFX::distanceModel ); - if( isDefined( "$pref::SFX::dopplerFactor" ) ) - sfxSetDopplerFactor( $pref::SFX::dopplerFactor ); - if( isDefined( "$pref::SFX::rolloffFactor" ) ) - sfxSetRolloffFactor( $pref::SFX::rolloffFactor ); - - // Restore master volume. - - sfxSetMasterVolume( $pref::SFX::masterVolume ); - - // Restore channel volumes. - - for( %channel = 0; %channel <= 8; %channel ++ ) - sfxSetChannelVolume( %channel, $pref::SFX::channelVolume[ %channel ] ); - - return true; -} - - -/// Destroys the current sound system device. -function sfxShutdown() -{ - // Store volume prefs. - - $pref::SFX::masterVolume = sfxGetMasterVolume(); - - for( %channel = 0; %channel <= 8; %channel ++ ) - $pref::SFX::channelVolume[ %channel ] = sfxGetChannelVolume( %channel ); - - // We're assuming here that a null info - // string means that no device is loaded. - if( sfxGetDeviceInfo() $= "" ) - return; - - sfxDeleteDevice(); -} - - -/// Determines which of the two SFX providers is preferable. -function sfxCompareProvider( %providerA, %providerB ) -{ - if( %providerA $= %providerB ) - return 0; - - switch$( %providerA ) - { - // Always prefer FMOD over anything else. - case "FMOD": - return 1; - - // Prefer OpenAL over anything but FMOD. - case "OpenAL": - if( %providerB $= "FMOD" ) - return -1; - else - return 1; - - // choose XAudio over DirectSound - case "XAudio": - if( %providerB $= "FMOD" || %providerB $= "OpenAL" ) - return -1; - else - return 0; - - case "DirectSound": - if( %providerB !$= "FMOD" && %providerB !$= "OpenAL" && %providerB !$= "XAudio" ) - return 1; - else - return -1; - - default: - return -1; - } -} - - -/// Try to detect and initalize the best SFX device available. -function sfxAutodetect() -{ - // Get all the available devices. - - %devices = sfxGetAvailableDevices(); - - // Collect and sort the devices by preferentiality. - - %deviceTrySequence = new ArrayObject(); - %bestMatch = -1; - %count = getRecordCount( %devices ); - for( %i = 0; %i < %count; %i ++ ) - { - %info = getRecord( %devices, %i ); - %provider = getField( %info, 0 ); - - %deviceTrySequence.push_back( %provider, %info ); - } - - %deviceTrySequence.sortfkd( "sfxCompareProvider" ); - - // Try the devices in order. - - %count = %deviceTrySequence.count(); - for( %i = 0; %i < %count; %i ++ ) - { - %provider = %deviceTrySequence.getKey( %i ); - %info = %deviceTrySequence.getValue( %i ); - - $pref::SFX::provider = %provider; - $pref::SFX::device = getField( %info, 1 ); - $pref::SFX::useHardware = getField( %info, 2 ); - - // By default we've decided to avoid hardware devices as - // they are buggy and prone to problems. - $pref::SFX::useHardware = false; - - if( sfxInit() ) - { - $pref::SFX::autoDetect = false; - %deviceTrySequence.delete(); - return true; - } - } - - // Found no suitable device. - - error( "sfxAutodetect - Could not initialize a valid SFX device." ); - - $pref::SFX::provider = ""; - $pref::SFX::device = ""; - $pref::SFX::useHardware = ""; - - %deviceTrySequence.delete(); - - return false; -} - - -//----------------------------------------------------------------------------- -// Backwards-compatibility with old channel system. -//----------------------------------------------------------------------------- - -// Volume channel IDs for backwards-compatibility. - -$GuiAudioType = 1; // Interface. -$SimAudioType = 2; // Game. -$MessageAudioType = 3; // Notifications. -$MusicAudioType = 4; // Music. - -$AudioChannels[ 0 ] = AudioChannelDefault; -$AudioChannels[ $GuiAudioType ] = AudioChannelGui; -$AudioChannels[ $SimAudioType ] = AudioChannelEffects; -$AudioChannels[ $MessageAudioType ] = AudioChannelMessages; -$AudioChannels[ $MusicAudioType ] = AudioChannelMusic; - -function sfxOldChannelToGroup( %channel ) -{ - return $AudioChannels[ %channel ]; -} - -function sfxGroupToOldChannel( %group ) -{ - %id = %group.getId(); - for( %i = 0;; %i ++ ) - if( !isObject( $AudioChannels[ %i ] ) ) - return -1; - else if( $AudioChannels[ %i ].getId() == %id ) - return %i; - - return -1; -} - -function sfxSetMasterVolume( %volume ) -{ - AudioChannelMaster.setVolume( %volume ); -} - -function sfxGetMasterVolume( %volume ) -{ - return AudioChannelMaster.getVolume(); -} - -function sfxStopAll( %channel ) -{ - // Don't stop channel itself since that isn't quite what the function - // here intends. - - %channel = sfxOldChannelToGroup( %channel ); - if (isObject(%channel)) - { - foreach( %source in %channel ) - %source.stop(); - } -} - -function sfxGetChannelVolume( %channel ) -{ - %obj = sfxOldChannelToGroup( %channel ); - if( isObject( %obj ) ) - return %obj.getVolume(); -} - -function sfxSetChannelVolume( %channel, %volume ) -{ - %obj = sfxOldChannelToGroup( %channel ); - if( isObject( %obj ) ) - %obj.setVolume( %volume ); -} - -/*singleton SimSet( SFXPausedSet ); - - -/// Pauses the playback of active sound sources. -/// -/// @param %channels An optional word list of channel indices or an empty -/// string to pause sources on all channels. -/// @param %pauseSet An optional SimSet which is filled with the paused -/// sources. If not specified the global SfxSourceGroup -/// is used. -/// -/// @deprecated -/// -function sfxPause( %channels, %pauseSet ) -{ - // Did we get a set to populate? - if ( !isObject( %pauseSet ) ) - %pauseSet = SFXPausedSet; - - %count = SFXSourceSet.getCount(); - for ( %i = 0; %i < %count; %i++ ) - { - %source = SFXSourceSet.getObject( %i ); - - %channel = sfxGroupToOldChannel( %source.getGroup() ); - if( %channels $= "" || findWord( %channels, %channel ) != -1 ) - { - %source.pause(); - %pauseSet.add( %source ); - } - } -} - - -/// Resumes the playback of paused sound sources. -/// -/// @param %pauseSet An optional SimSet which contains the paused sound -/// sources to be resumed. If not specified the global -/// SfxSourceGroup is used. -/// @deprecated -/// -function sfxResume( %pauseSet ) -{ - if ( !isObject( %pauseSet ) ) - %pauseSet = SFXPausedSet; - - %count = %pauseSet.getCount(); - for ( %i = 0; %i < %count; %i++ ) - { - %source = %pauseSet.getObject( %i ); - %source.play(); - } - - // Clear our pause set... the caller is left - // to clear his own if he passed one. - %pauseSet.clear(); -}*/ diff --git a/Templates/BaseGame/game/core/canvas.cs b/Templates/BaseGame/game/core/canvas.cs deleted file mode 100644 index b38cdccca..000000000 --- a/Templates/BaseGame/game/core/canvas.cs +++ /dev/null @@ -1,162 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -function createCanvas(%windowTitle) -{ - if ($isDedicated) - { - GFXInit::createNullDevice(); - return true; - } - - // Create the Canvas - $GameCanvas = new GuiCanvas(Canvas) - { - displayWindow = $platform !$= "windows"; - }; - - // Set the window title - if (isObject(Canvas)) - { - Canvas.setWindowTitle(%windowTitle @ " - " @ $pref::Video::displayDevice); - configureCanvas(); - } - else - { - error("Canvas creation failed. Shutting down."); - quit(); - } -} - -// Constants for referencing video resolution preferences -$WORD::RES_X = 0; -$WORD::RES_Y = 1; -$WORD::FULLSCREEN = 2; -$WORD::BITDEPTH = 3; -$WORD::REFRESH = 4; -$WORD::AA = 5; - -function configureCanvas() -{ - // Setup a good default if we don't have one already. - if ($pref::Video::Resolution $= "") - $pref::Video::Resolution = "800 600"; - if ($pref::Video::FullScreen $= "") - $pref::Video::FullScreen = false; - if ($pref::Video::BitDepth $= "") - $pref::Video::BitDepth = "32"; - if ($pref::Video::RefreshRate $= "") - $pref::Video::RefreshRate = "60"; - if ($pref::Video::AA $= "") - $pref::Video::AA = "4"; - - %resX = $pref::Video::Resolution.x; - %resY = $pref::Video::Resolution.y; - %fs = $pref::Video::FullScreen; - %bpp = $pref::Video::BitDepth; - %rate = $pref::Video::RefreshRate; - %aa = $pref::Video::AA; - - if($cliFullscreen !$= "") { - %fs = $cliFullscreen; - $cliFullscreen = ""; - } - - echo("--------------"); - echo("Attempting to set resolution to \"" @ %resX SPC %resY SPC %fs SPC %bpp SPC %rate SPC %aa @ "\""); - - %deskRes = getDesktopResolution(); - %deskResX = getWord(%deskRes, $WORD::RES_X); - %deskResY = getWord(%deskRes, $WORD::RES_Y); - %deskResBPP = getWord(%deskRes, 2); - - // We shouldn't be getting this any more but just in case... - if (%bpp $= "Default") - %bpp = %deskResBPP; - - // Make sure we are running at a valid resolution - if (%fs $= "0" || %fs $= "false") - { - // Windowed mode has to use the same bit depth as the desktop - %bpp = %deskResBPP; - - // Windowed mode also has to run at a smaller resolution than the desktop - if ((%resX >= %deskResX) || (%resY >= %deskResY)) - { - warn("Warning: The requested windowed resolution is equal to or larger than the current desktop resolution. Attempting to find a better resolution"); - - %resCount = Canvas.getModeCount(); - for (%i = (%resCount - 1); %i >= 0; %i--) - { - %testRes = Canvas.getMode(%i); - %testResX = getWord(%testRes, $WORD::RES_X); - %testResY = getWord(%testRes, $WORD::RES_Y); - %testBPP = getWord(%testRes, $WORD::BITDEPTH); - - if (%testBPP != %bpp) - continue; - - if ((%testResX < %deskResX) && (%testResY < %deskResY)) - { - // This will work as our new resolution - %resX = %testResX; - %resY = %testResY; - - warn("Warning: Switching to \"" @ %resX SPC %resY SPC %bpp @ "\""); - - break; - } - } - } - } - - $pref::Video::Resolution = %resX SPC %resY; - $pref::Video::FullScreen = %fs; - $pref::Video::BitDepth = %bpp; - $pref::Video::RefreshRate = %rate; - $pref::Video::AA = %aa; - - if (%fs == 1 || %fs $= "true") - %fsLabel = "Yes"; - else - %fsLabel = "No"; - - echo("Accepted Mode: " NL - "--Resolution : " @ %resX SPC %resY NL - "--Full Screen : " @ %fsLabel NL - "--Bits Per Pixel : " @ %bpp NL - "--Refresh Rate : " @ %rate NL - "--AA TypeXLevel : " @ %aa NL - "--------------"); - - // Actually set the new video mode - Canvas.setVideoMode(%resX, %resY, %fs, %bpp, %rate, %aa); - - commandToServer('setClientAspectRatio', %resX, %resY); - - // AA piggybacks on the AA setting in $pref::Video::mode. - // We need to parse the setting between AA modes, and then it's level - // It's formatted as AATypexAALevel - // So, FXAAx4 or MLAAx2 - if ( isObject( FXAA_PostEffect ) ) - FXAA_PostEffect.isEnabled = ( %aa > 0 ) ? true : false; -} diff --git a/Templates/BaseGame/game/core/components/RigidBodyComponent.asset.taml b/Templates/BaseGame/game/core/components/RigidBodyComponent.asset.taml deleted file mode 100644 index 8e60db364..000000000 --- a/Templates/BaseGame/game/core/components/RigidBodyComponent.asset.taml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/animationComponent.asset.taml b/Templates/BaseGame/game/core/components/animationComponent.asset.taml deleted file mode 100644 index 771d38e02..000000000 --- a/Templates/BaseGame/game/core/components/animationComponent.asset.taml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/cameraOrbiterComponent.asset.taml b/Templates/BaseGame/game/core/components/cameraOrbiterComponent.asset.taml deleted file mode 100644 index b615f2348..000000000 --- a/Templates/BaseGame/game/core/components/cameraOrbiterComponent.asset.taml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/collisionComponent.asset.taml b/Templates/BaseGame/game/core/components/collisionComponent.asset.taml deleted file mode 100644 index 1a4f99a0d..000000000 --- a/Templates/BaseGame/game/core/components/collisionComponent.asset.taml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/game/camera.asset.taml b/Templates/BaseGame/game/core/components/game/camera.asset.taml deleted file mode 100644 index f59e429e2..000000000 --- a/Templates/BaseGame/game/core/components/game/camera.asset.taml +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/game/camera.cs b/Templates/BaseGame/game/core/components/game/camera.cs deleted file mode 100644 index b6f510c9d..000000000 --- a/Templates/BaseGame/game/core/components/game/camera.cs +++ /dev/null @@ -1,185 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -function CameraComponent::onAdd(%this) -{ - %this.addComponentField(clientOwner, "The client that views this camera", "int", "1", ""); - - %test = %this.clientOwner; - - %barf = ClientGroup.getCount(); - - %clientID = %this.getClientID(); - if(%clientID && !isObject(%clientID.camera)) - { - %this.scopeToClient(%clientID); - %this.setDirty(); - - %clientID.setCameraObject(%this.owner); - %clientID.setControlCameraFov(%this.FOV); - - %clientID.camera = %this.owner; - } - - %res = $pref::Video::mode; - %derp = 0; -} - -function CameraComponent::onRemove(%this) -{ - %clientID = %this.getClientID(); - if(%clientID) - %clientID.clearCameraObject(); -} - -function CameraComponent::onInspectorUpdate(%this) -{ - //if(%this.clientOwner) - //%this.clientOwner.setCameraObject(%this.owner); -} - -function CameraComponent::getClientID(%this) -{ - return ClientGroup.getObject(%this.clientOwner-1); -} - -function CameraComponent::isClientCamera(%this, %client) -{ - %clientID = ClientGroup.getObject(%this.clientOwner-1); - - if(%client.getID() == %clientID) - return true; - else - return false; -} - -function CameraComponent::onClientConnect(%this, %client) -{ - //if(%this.isClientCamera(%client) && !isObject(%client.camera)) - //{ - %this.scopeToClient(%client); - %this.setDirty(); - - %client.setCameraObject(%this.owner); - %client.setControlCameraFov(%this.FOV); - - %client.camera = %this.owner; - //} - //else - //{ - // echo("CONNECTED CLIENT IS NOT CAMERA OWNER!"); - //} -} - -function CameraComponent::onClientDisconnect(%this, %client) -{ - Parent::onClientDisconnect(%this, %client); - - if(isClientCamera(%client)){ - %this.clearScopeToClient(%client); - %client.clearCameraObject(); - } -} - -/// -/// -/// - -function VRCameraComponent::onAdd(%this) -{ - %this.addComponentField(clientOwner, "The client that views this camera", "int", "1", ""); - - %test = %this.clientOwner; - - %barf = ClientGroup.getCount(); - - %clientID = %this.getClientID(); - if(%clientID && !isObject(%clientID.camera)) - { - %this.scopeToClient(%clientID); - %this.setDirty(); - - %clientID.setCameraObject(%this.owner); - %clientID.setControlCameraFov(%this.FOV); - - %clientID.camera = %this.owner; - } - - %res = $pref::Video::mode; - %derp = 0; -} - -function VRCameraComponent::onRemove(%this) -{ - %clientID = %this.getClientID(); - if(%clientID) - %clientID.clearCameraObject(); -} - -function CameraComponent::onInspectorUpdate(%this) -{ - //if(%this.clientOwner) - //%this.clientOwner.setCameraObject(%this.owner); -} - -function VRCameraComponent::getClientID(%this) -{ - return ClientGroup.getObject(%this.clientOwner-1); -} - -function VRCameraComponent::isClientCamera(%this, %client) -{ - %clientID = ClientGroup.getObject(%this.clientOwner-1); - - if(%client.getID() == %clientID) - return true; - else - return false; -} - -function VRCameraComponent::onClientConnect(%this, %client) -{ - //if(%this.isClientCamera(%client) && !isObject(%client.camera)) - //{ - %this.scopeToClient(%client); - %this.setDirty(); - - %client.setCameraObject(%this.owner); - %client.setControlCameraFov(%this.FOV); - - %client.camera = %this.owner; - //} - //else - //{ - // echo("CONNECTED CLIENT IS NOT CAMERA OWNER!"); - //} -} - -function VRCameraComponent::onClientDisconnect(%this, %client) -{ - Parent::onClientDisconnect(%this, %client); - - if(isClientCamera(%client)){ - %this.clearScopeToClient(%client); - %client.clearCameraObject(); - } -} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/components/game/controlObject.asset.taml b/Templates/BaseGame/game/core/components/game/controlObject.asset.taml deleted file mode 100644 index 19515e833..000000000 --- a/Templates/BaseGame/game/core/components/game/controlObject.asset.taml +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/game/controlObject.cs b/Templates/BaseGame/game/core/components/game/controlObject.cs deleted file mode 100644 index 7f477ecca..000000000 --- a/Templates/BaseGame/game/core/components/game/controlObject.cs +++ /dev/null @@ -1,89 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//registerComponent("ControlObjectComponent", "Component", "Control Object", "Game", false, "Allows the behavior owner to operate as a camera."); - -function ControlObjectComponent::onAdd(%this) -{ - %this.addComponentField(clientOwner, "The shape to use for rendering", "int", "1", ""); - - %clientID = %this.getClientID(); - - if(%clientID && !isObject(%clientID.getControlObject())) - %clientID.setControlObject(%this.owner); -} - -function ControlObjectComponent::onRemove(%this) -{ - %clientID = %this.getClientID(); - - if(%clientID) - %clientID.setControlObject(0); -} - -function ControlObjectComponent::onClientConnect(%this, %client) -{ - if(%this.isControlClient(%client) && !isObject(%client.getControlObject())) - %client.setControlObject(%this.owner); -} - -function ControlObjectComponent::onClientDisconnect(%this, %client) -{ - if(%this.isControlClient(%client)) - %client.setControlObject(0); -} - -function ControlObjectComponent::getClientID(%this) -{ - return ClientGroup.getObject(%this.clientOwner-1); -} - -function ControlObjectComponent::isControlClient(%this, %client) -{ - %clientID = ClientGroup.getObject(%this.clientOwner-1); - - if(%client.getID() == %clientID) - return true; - else - return false; -} - -function ControlObjectComponent::onInspectorUpdate(%this, %field) -{ - %clientID = %this.getClientID(); - - if(%clientID && !isObject(%clientID.getControlObject())) - %clientID.setControlObject(%this.owner); -} - -function switchControlObject(%client, %newControlEntity) -{ - if(!isObject(%client) || !isObject(%newControlEntity)) - return error("SwitchControlObject: No client or target controller!"); - - %control = %newControlEntity.getComponent(ControlObjectComponent); - - if(!isObject(%control)) - return error("SwitchControlObject: Target controller has no conrol object behavior!"); - - %client.setControlObject(%newControlEntity); -} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/components/game/itemRotate.asset.taml b/Templates/BaseGame/game/core/components/game/itemRotate.asset.taml deleted file mode 100644 index 4c0c1bec4..000000000 --- a/Templates/BaseGame/game/core/components/game/itemRotate.asset.taml +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/game/itemRotate.cs b/Templates/BaseGame/game/core/components/game/itemRotate.cs deleted file mode 100644 index 947d19214..000000000 --- a/Templates/BaseGame/game/core/components/game/itemRotate.cs +++ /dev/null @@ -1,49 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//registerComponent("ItemRotationComponent", "Component", "Item Rotation", "Game", false, "Rotates the entity around the z axis, like an item pickup."); - -function ItemRotationComponent::onAdd(%this) -{ - %this.addComponentField(rotationsPerMinute, "Number of rotations per minute", "float", "5", ""); - %this.addComponentField(forward, "Rotate forward or backwards", "bool", "1", ""); - %this.addComponentField(horizontal, "Rotate horizontal or verticle, true for horizontal", "bool", "1", ""); -} - -function ItemRotationComponent::Update(%this) -{ - %tickRate = 0.032; - - //Rotations per second is calculated based on a standard update tick being 32ms. So we scale by the tick speed, then add that to our rotation to - //get a nice rotation speed. - if(%this.horizontal) - { - if(%this.forward) - %this.owner.rotation.z += ( ( 360 * %this.rotationsPerMinute ) / 60 ) * %tickRate; - else - %this.owner.rotation.z -= ( ( 360 * %this.rotationsPerMinute ) / 60 ) * %tickRate; - } - else - { - %this.owner.rotation.x += ( ( 360 * %this.rotationsPerMinute ) / 60 ) * %tickRate; - } -} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml b/Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml deleted file mode 100644 index 8a597aca4..000000000 --- a/Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml +++ /dev/null @@ -1,10 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/game/playerSpawner.cs b/Templates/BaseGame/game/core/components/game/playerSpawner.cs deleted file mode 100644 index a7387eaf1..000000000 --- a/Templates/BaseGame/game/core/components/game/playerSpawner.cs +++ /dev/null @@ -1,78 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//registerComponent("PlayerSpawner", "Component", -// "Player Spawner", "Game", false, "When a client connects, it spawns a player object for them and attaches them to it"); - -function PlayerSpawner::onAdd(%this) -{ - %this.clientCount = 1; - %this.friendlyName = "Player Spawner"; - %this.componentType = "Spawner"; - - %this.addComponentField("GameObjectName", "The name of the game object we spawn for the players", "gameObject", "PlayerObject"); -} - -function PlayerSpawner::onClientConnect(%this, %client) -{ - %playerObj = spawnGameObject(%this.GameObjectName, false); - - if(!isObject(%playerObj)) - return; - - %playerObj.position = %this.owner.position; - - %playerObj.notify("onClientConnect", %client); - - switchControlObject(%client, %playerObj); - switchCamera(%client, %playerObj); - - %client.player = %playerObj; - %client.camera = %playerObj; - - %inventory = %playerObj.getComponent(InventoryController); - - if(isObject(%inventory)) - { - for(%i=0; %i<5; %i++) - { - %arrow = spawnGameObject(ArrowProjectile, false); - - %inventory.addItem(%arrow); - } - } - - %playerObj.position = %this.owner.position; - %playerObj.rotation = "0 0 0"; - - %this.clientCount++; -} - -function PlayerSpawner::onClientDisConnect(%this, %client) -{ - -} - -function PlayerSpawner::getClientID(%this) -{ - return ClientGroup.getObject(%this.clientOwner-1); -} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/components/input/fpsControls.asset.taml b/Templates/BaseGame/game/core/components/input/fpsControls.asset.taml deleted file mode 100644 index cd0440055..000000000 --- a/Templates/BaseGame/game/core/components/input/fpsControls.asset.taml +++ /dev/null @@ -1,9 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/input/fpsControls.cs b/Templates/BaseGame/game/core/components/input/fpsControls.cs deleted file mode 100644 index 8331e409d..000000000 --- a/Templates/BaseGame/game/core/components/input/fpsControls.cs +++ /dev/null @@ -1,247 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//registerComponent("FPSControls", "Component", "FPS Controls", "Input", false, "First Person Shooter-type controls"); - -function FPSControls::onAdd(%this) -{ - // - %this.beginGroup("Keys"); - %this.addComponentField(forwardKey, "Key to bind to vertical thrust", keybind, "keyboard w"); - %this.addComponentField(backKey, "Key to bind to vertical thrust", keybind, "keyboard s"); - %this.addComponentField(leftKey, "Key to bind to horizontal thrust", keybind, "keyboard a"); - %this.addComponentField(rightKey, "Key to bind to horizontal thrust", keybind, "keyboard d"); - - %this.addComponentField(jump, "Key to bind to horizontal thrust", keybind, "keyboard space"); - %this.endGroup(); - - %this.beginGroup("Mouse"); - %this.addComponentField(pitchAxis, "Key to bind to horizontal thrust", keybind, "mouse yaxis"); - %this.addComponentField(yawAxis, "Key to bind to horizontal thrust", keybind, "mouse xaxis"); - %this.endGroup(); - - %this.addComponentField(moveSpeed, "Horizontal thrust force", float, 300.0); - %this.addComponentField(jumpStrength, "Vertical thrust force", float, 3.0); - // - - %control = %this.owner.getComponent( ControlObjectComponent ); - if(!%control) - return echo("SPECTATOR CONTROLS: No Control Object behavior!"); - - //%this.Physics = %this.owner.getComponent( PlayerPhysicsComponent ); - - //%this.Animation = %this.owner.getComponent( AnimationComponent ); - - //%this.Camera = %this.owner.getComponent( MountedCameraComponent ); - - //%this.Animation.playThread(0, "look"); - - %this.setupControls(%control.getClientID()); -} - -function FPSControls::onRemove(%this) -{ - Parent::onBehaviorRemove(%this); - - commandToClient(%control.clientOwnerID, 'removeInput', %this.forwardKey); - commandToClient(%control.clientOwnerID, 'removeInput', %this.backKey); - commandToClient(%control.clientOwnerID, 'removeInput', %this.leftKey); - commandToClient(%control.clientOwnerID, 'removeInput', %this.rightKey); - - commandToClient(%control.clientOwnerID, 'removeInput', %this.pitchAxis); - commandToClient(%control.clientOwnerID, 'removeInput', %this.yawAxis); -} - -function FPSControls::onBehaviorFieldUpdate(%this, %field) -{ - %controller = %this.owner.getBehavior( ControlObjectBehavior ); - commandToClient(%controller.clientOwnerID, 'updateInput', %this.getFieldValue(%field), %field); -} - -function FPSControls::onClientConnect(%this, %client) -{ - %this.setupControls(%client); -} - - -function FPSControls::setupControls(%this, %client) -{ - %control = %this.owner.getComponent( ControlObjectComponent ); - if(!%control.isControlClient(%client)) - { - echo("FPS CONTROLS: Client Did Not Match"); - return; - } - - %inputCommand = "FPSControls"; - - %test = %this.forwardKey; - - /*SetInput(%client, %this.forwardKey.x, %this.forwardKey.y, %inputCommand@"_forwardKey"); - SetInput(%client, %this.backKey.x, %this.backKey.y, %inputCommand@"_backKey"); - SetInput(%client, %this.leftKey.x, %this.leftKey.y, %inputCommand@"_leftKey"); - SetInput(%client, %this.rightKey.x, %this.rightKey.y, %inputCommand@"_rightKey"); - - SetInput(%client, %this.jump.x, %this.jump.y, %inputCommand@"_jump"); - - SetInput(%client, %this.pitchAxis.x, %this.pitchAxis.y, %inputCommand@"_pitchAxis"); - SetInput(%client, %this.yawAxis.x, %this.yawAxis.y, %inputCommand@"_yawAxis");*/ - - SetInput(%client, "keyboard", "w", %inputCommand@"_forwardKey"); - SetInput(%client, "keyboard", "s", %inputCommand@"_backKey"); - SetInput(%client, "keyboard", "a", %inputCommand@"_leftKey"); - SetInput(%client, "keyboard", "d", %inputCommand@"_rightKey"); - - SetInput(%client, "keyboard", "space", %inputCommand@"_jump"); - - SetInput(%client, "mouse", "yaxis", %inputCommand@"_pitchAxis"); - SetInput(%client, "mouse", "xaxis", %inputCommand@"_yawAxis"); - - SetInput(%client, "keyboard", "f", %inputCommand@"_flashlight"); - -} - -function FPSControls::onMoveTrigger(%this, %triggerID) -{ - //check if our jump trigger was pressed! - if(%triggerID == 2) - { - %this.owner.applyImpulse("0 0 0", "0 0 " @ %this.jumpStrength); - } -} - -function FPSControls::Update(%this) -{ - return; - - %moveVector = %this.owner.getMoveVector(); - %moveRotation = %this.owner.getMoveRotation(); - - %this.Physics.moveVector = "0 0 0"; - - if(%moveVector.x != 0) - { - %fv = VectorNormalize(%this.owner.getRightVector()); - - %forMove = VectorScale(%fv, (%moveVector.x));// * (%this.moveSpeed * 0.032))); - - //%this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove); - - %this.Physics.moveVector = VectorAdd(%this.Physics.moveVector, %forMove); - - //if(%forMove > 0) - // %this.Animation.playThread(1, "run"); - } - /*else - { - %fv = VectorNormalize(%this.owner.getRightVector()); - - %forMove = VectorScale(%fv, (%moveVector.x * (%this.moveSpeed * 0.032))); - - if(%forMove <= 0) - %this.Animation.stopThread(1); - - }*/ - - if(%moveVector.y != 0) - { - %fv = VectorNormalize(%this.owner.getForwardVector()); - - %forMove = VectorScale(%fv, (%moveVector.y));// * (%this.moveSpeed * 0.032))); - - //%this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove); - - %this.Physics.moveVector = VectorAdd(%this.Physics.moveVector, %forMove); - - //if(VectorLen(%this.Physics.velocity) < 2) - // %this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove); - } - - /*if(%moveVector.z) - { - %fv = VectorNormalize(%this.owner.getUpVector()); - - %forMove = VectorScale(%fv, (%moveVector.z * (%this.moveSpeed * 0.032))); - - %this.Physics.velocity = VectorAdd(%this.Physics.velocity, %forMove); - }*/ - - if(%moveRotation.x != 0) - { - %look = mRadToDeg(%moveRotation.x) / 180; - - //%this.Animation.setThreadPos(0, %look); - - %this.owner.getComponent( MountedCameraComponent ).rotationOffset.x += mRadToDeg(%moveRotation.x); - - //%this.Camera.rotationOffset.x += mRadToDeg(%moveRotation.x); - } - // %this.owner.rotation.x += mRadToDeg(%moveRotation.x); - - if(%moveRotation.z != 0) - { - %zrot = mRadToDeg(%moveRotation.z); - %this.owner.getComponent( MountedCameraComponent ).rotationOffset.z += %zrot; - //%this.owner.rotation.z += %zrot; - } -} - -// -function FPSControls_forwardKey(%val) -{ - $mvForwardAction = %val; -} - -function FPSControls_backKey(%val) -{ - $mvBackwardAction = %val; -} - -function FPSControls_leftKey(%val) -{ - $mvLeftAction = %val; -} - -function FPSControls_rightKey(%val) -{ - $mvRightAction = %val; -} - -function FPSControls_yawAxis(%val) -{ - $mvYaw += getMouseAdjustAmount(%val); -} - -function FPSControls_pitchAxis(%val) -{ - $mvPitch += getMouseAdjustAmount(%val); -} - -function FPSControls_jump(%val) -{ - $mvTriggerCount2++; -} - -function FPSControls_flashLight(%val) -{ - $mvTriggerCount3++; -} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/components/input/inputManager.cs b/Templates/BaseGame/game/core/components/input/inputManager.cs deleted file mode 100644 index c8123d1e3..000000000 --- a/Templates/BaseGame/game/core/components/input/inputManager.cs +++ /dev/null @@ -1,82 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -function SetInput(%client, %device, %key, %command, %bindMap, %behav) -{ - commandToClient(%client, 'SetInput', %device, %key, %command, %bindMap, %behav); -} - -function RemoveInput(%client, %device, %key, %command, %bindMap) -{ - commandToClient(%client, 'removeInput', %device, %key, %command, %bindMap); -} - -function clientCmdSetInput(%device, %key, %command, %bindMap, %behav) -{ - //if we're requesting a custom bind map, set that up - if(%bindMap $= "") - %bindMap = moveMap; - - if (!isObject(%bindMap)){ - new ActionMap(moveMap); - moveMap.push(); - } - - //get our local - //%localID = ServerConnection.resolveGhostID(%behav); - - //%tmpl = %localID.getTemplate(); - //%tmpl.insantiateNamespace(%tmpl.getName()); - - //first, check if we have an existing command - %oldBind = %bindMap.getBinding(%command); - if(%oldBind !$= "") - %bindMap.unbind(getField(%oldBind, 0), getField(%oldBind, 1)); - - //now, set the requested bind - %bindMap.bind(%device, %key, %command); -} - -function clientCmdRemoveSpecCtrlInput(%device, %key, %bindMap) -{ - //if we're requesting a custom bind map, set that up - if(%bindMap $= "") - %bindMap = moveMap; - - if (!isObject(%bindMap)) - return; - - %bindMap.unbind(%device, %key); -} - -function clientCmdSetupClientBehavior(%bhvrGstID) -{ - %localID = ServerConnection.resolveGhostID(%bhvrGstID); - %tmpl = %localID.getTemplate(); - %tmpl.insantiateNamespace(%tmpl.getName()); -} - -function getMouseAdjustAmount(%val) -{ - // based on a default camera FOV of 90' - return(%val * ($cameraFov / 90) * 0.01) * $pref::Input::LinkMouseSensitivity; -} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/components/meshComponent.asset.taml b/Templates/BaseGame/game/core/components/meshComponent.asset.taml deleted file mode 100644 index b41de171a..000000000 --- a/Templates/BaseGame/game/core/components/meshComponent.asset.taml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/playerControllerComponent.asset.taml b/Templates/BaseGame/game/core/components/playerControllerComponent.asset.taml deleted file mode 100644 index 417f409e0..000000000 --- a/Templates/BaseGame/game/core/components/playerControllerComponent.asset.taml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/soundComponent.asset.taml b/Templates/BaseGame/game/core/components/soundComponent.asset.taml deleted file mode 100644 index a29bcc9ff..000000000 --- a/Templates/BaseGame/game/core/components/soundComponent.asset.taml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/components/stateMachineComponent.asset.taml b/Templates/BaseGame/game/core/components/stateMachineComponent.asset.taml deleted file mode 100644 index ff1d53cd8..000000000 --- a/Templates/BaseGame/game/core/components/stateMachineComponent.asset.taml +++ /dev/null @@ -1,8 +0,0 @@ - diff --git a/Templates/BaseGame/game/core/console/console.gui b/Templates/BaseGame/game/core/console/console.gui deleted file mode 100644 index c2f21eba9..000000000 --- a/Templates/BaseGame/game/core/console/console.gui +++ /dev/null @@ -1,191 +0,0 @@ -//--- OBJECT WRITE BEGIN --- -%guiContent = new GuiControl(ConsoleDlg) { - position = "0 0"; - extent = "1024 768"; - minExtent = "8 8"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "1"; - helpTag = "0"; - - new GuiConsoleEditCtrl(ConsoleEntry) { - useSiblingScroller = "1"; - historySize = "40"; - tabComplete = "0"; - sinkAllKeyEvents = "1"; - password = "0"; - passwordMask = "*"; - maxLength = "255"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 750"; - extent = "1024 18"; - minExtent = "8 8"; - horizSizing = "width"; - vertSizing = "top"; - profile = "ConsoleTextEditProfile"; - visible = "1"; - active = "1"; - altCommand = "ConsoleEntry::eval();"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiContainer() { - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "1 728"; - extent = "1024 22"; - minExtent = "8 2"; - horizSizing = "width"; - vertSizing = "top"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiBitmapCtrl() { - bitmap = "data/ui/art/hudfill.png"; - color = "255 255 255 255"; - wrap = "0"; - position = "0 0"; - extent = "1024 22"; - minExtent = "8 2"; - horizSizing = "width"; - vertSizing = "bottom"; - profile = "GuiDefaultProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiCheckBoxCtrl(ConsoleDlgErrorFilterBtn) { - text = "Errors"; - groupNum = "-1"; - buttonType = "ToggleButton"; - useMouseEvents = "0"; - position = "2 2"; - extent = "113 20"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiCheckBoxProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiCheckBoxCtrl(ConsoleDlgWarnFilterBtn) { - text = "Warnings"; - groupNum = "-1"; - buttonType = "ToggleButton"; - useMouseEvents = "0"; - position = "119 2"; - extent = "113 20"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiCheckBoxProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - new GuiCheckBoxCtrl(ConsoleDlgNormalFilterBtn) { - text = "Normal Messages"; - groupNum = "-1"; - buttonType = "ToggleButton"; - useMouseEvents = "0"; - position = "236 2"; - extent = "113 20"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiCheckBoxProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "0"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - }; - new GuiScrollCtrl() { - willFirstRespond = "1"; - hScrollBar = "alwaysOn"; - vScrollBar = "alwaysOn"; - lockHorizScroll = "0"; - lockVertScroll = "0"; - constantThumbHeight = "0"; - childMargin = "0 0"; - mouseWheelScrollSpeed = "-1"; - margin = "0 0 0 0"; - padding = "0 0 0 0"; - anchorTop = "1"; - anchorBottom = "0"; - anchorLeft = "1"; - anchorRight = "0"; - position = "0 0"; - extent = "1024 730"; - minExtent = "8 8"; - horizSizing = "width"; - vertSizing = "height"; - profile = "ConsoleScrollProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - internalName = "Scroll"; - canSave = "1"; - canSaveDynamicFields = "0"; - - new GuiConsole(ConsoleMessageLogView) { - position = "1 1"; - extent = "622 324"; - minExtent = "8 2"; - horizSizing = "right"; - vertSizing = "bottom"; - profile = "GuiConsoleProfile"; - visible = "1"; - active = "1"; - tooltipProfile = "GuiToolTipProfile"; - hovertime = "1000"; - isContainer = "1"; - canSave = "1"; - canSaveDynamicFields = "0"; - }; - }; -}; -//--- OBJECT WRITE END --- \ No newline at end of file diff --git a/Templates/BaseGame/game/core/console/main.cs b/Templates/BaseGame/game/core/console/main.cs deleted file mode 100644 index 3d89234b8..000000000 --- a/Templates/BaseGame/game/core/console/main.cs +++ /dev/null @@ -1,140 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -exec("./profiles.cs"); -exec("./console.gui"); - -GlobalActionMap.bind("keyboard", "tilde", "toggleConsole"); - -function ConsoleEntry::eval() -{ - %text = trim(ConsoleEntry.getValue()); - if(%text $= "") - return; - - // If it's missing a trailing () and it's not a variable, - // append the parentheses. - if(strpos(%text, "(") == -1 && !isDefined(%text)) { - if(strpos(%text, "=") == -1 && strpos(%text, " ") == -1) { - if(strpos(%text, "{") == -1 && strpos(%text, "}") == -1) { - %text = %text @ "()"; - } - } - } - - // Append a semicolon if need be. - %pos = strlen(%text) - 1; - if(strpos(%text, ";", %pos) == -1 && strpos(%text, "}") == -1) { - %text = %text @ ";"; - } - - // Turn off warnings for assigning from void - // and evaluate the snippet. - if(!isDefined("$Con::warnVoidAssignment")) - %oldWarnVoidAssignment = true; - else - %oldWarnVoidAssignment = $Con::warnVoidAssignment; - $Con::warnVoidAssignment = false; - - echo("==>" @ %text); - if( !startsWith(%text, "function ") - && !startsWith(%text, "datablock ") - && !startsWith(%text, "foreach(") - && !startsWith(%text, "foreach$(") - && !startsWith(%text, "if(") - && !startsWith(%text, "while(") - && !startsWith(%text, "for(") - && !startsWith(%text, "switch(") - && !startsWith(%text, "switch$(")) - eval("%result = " @ %text); - else - eval(%text); - $Con::warnVoidAssignment = %oldWarnVoidAssignment; - - ConsoleEntry.setValue(""); - - // Echo result. - if(%result !$= "") - echo(%result); -} - -function ToggleConsole(%make) -{ - if (%make) { - if (ConsoleDlg.isAwake()) { - // Deactivate the console. - Canvas.popDialog(ConsoleDlg); - } else { - Canvas.pushDialog(ConsoleDlg, 99); - } - } -} - -function ConsoleDlg::hideWindow(%this) -{ - %this-->Scroll.setVisible(false); -} - -function ConsoleDlg::showWindow(%this) -{ - %this-->Scroll.setVisible(true); -} - -function ConsoleDlg::onWake(%this) -{ - ConsoleDlgErrorFilterBtn.setStateOn(ConsoleMessageLogView.getErrorFilter()); - ConsoleDlgWarnFilterBtn.setStateOn(ConsoleMessageLogView.getWarnFilter()); - ConsoleDlgNormalFilterBtn.setStateOn(ConsoleMessageLogView.getNormalFilter()); - - ConsoleMessageLogView.refresh(); -} - -function ConsoleDlg::setAlpha( %this, %alpha) -{ - if (%alpha $= "") - ConsoleScrollProfile.fillColor = $ConsoleDefaultFillColor; - else - ConsoleScrollProfile.fillColor = getWords($ConsoleDefaultFillColor, 0, 2) SPC %alpha * 255.0; -} - -function ConsoleDlgErrorFilterBtn::onClick(%this) -{ - ConsoleMessageLogView.toggleErrorFilter(); -} - -function ConsoleDlgWarnFilterBtn::onClick(%this) -{ - - ConsoleMessageLogView.toggleWarnFilter(); -} - -function ConsoleDlgNormalFilterBtn::onClick(%this) -{ - ConsoleMessageLogView.toggleNormalFilter(); -} - -function ConsoleMessageLogView::onNewMessage(%this, %errorCount, %warnCount, %normalCount) -{ - ConsoleDlgErrorFilterBtn.setText("(" @ %errorCount @ ") Errors"); - ConsoleDlgWarnFilterBtn.setText("(" @ %warnCount @ ") Warnings"); - ConsoleDlgNormalFilterBtn.setText("(" @ %normalCount @ ") Messages"); -} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/console/profiles.cs b/Templates/BaseGame/game/core/console/profiles.cs deleted file mode 100644 index b83dd4fa7..000000000 --- a/Templates/BaseGame/game/core/console/profiles.cs +++ /dev/null @@ -1,70 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -if(!isObject(GuiConsoleProfile)) -new GuiControlProfile(GuiConsoleProfile) -{ - fontType = ($platform $= "macos") ? "Monaco" : "Lucida Console"; - fontSize = ($platform $= "macos") ? 13 : 12; - fontColor = "255 255 255"; - fontColorHL = "0 255 255"; - fontColorNA = "255 0 0"; - fontColors[6] = "100 100 100"; - fontColors[7] = "100 100 0"; - fontColors[8] = "0 0 100"; - fontColors[9] = "0 100 0"; - category = "Core"; -}; - -if(!isObject(GuiConsoleTextProfile)) -new GuiControlProfile(GuiConsoleTextProfile) -{ - fontColor = "0 0 0"; - autoSizeWidth = true; - autoSizeHeight = true; - textOffset = "2 2"; - opaque = true; - fillColor = "255 255 255"; - border = true; - borderThickness = 1; - borderColor = "0 0 0"; - category = "Core"; -}; - -if(!isObject(ConsoleScrollProfile)) -new GuiControlProfile(ConsoleScrollProfile : GuiScrollProfile) -{ - opaque = true; - fillColor = "0 0 0 175"; - border = 1; - //borderThickness = 0; - borderColor = "0 0 0"; - category = "Core"; -}; - -if(!isObject(ConsoleTextEditProfile)) -new GuiControlProfile(ConsoleTextEditProfile : GuiTextEditProfile) -{ - fillColor = "242 241 240 255"; - fillColorHL = "255 255 255"; - category = "Core"; -}; diff --git a/Templates/BaseGame/game/core/cursor.cs b/Templates/BaseGame/game/core/cursor.cs deleted file mode 100644 index f71bc023a..000000000 --- a/Templates/BaseGame/game/core/cursor.cs +++ /dev/null @@ -1,102 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//--------------------------------------------------------------------------------------------- -// Cursor toggle functions. -//--------------------------------------------------------------------------------------------- -$cursorControlled = true; -function showCursor() -{ - if ($cursorControlled) - lockMouse(false); - Canvas.cursorOn(); -} - -function hideCursor() -{ - if ($cursorControlled) - lockMouse(true); - Canvas.cursorOff(); -} - -//--------------------------------------------------------------------------------------------- -// In the CanvasCursor package we add some additional functionality to the built-in GuiCanvas -// class, of which the global Canvas object is an instance. In this case, the behavior we want -// is for the cursor to automatically display, except when the only guis visible want no -// cursor - usually the in game interface. -//--------------------------------------------------------------------------------------------- -package CanvasCursorPackage -{ - -//--------------------------------------------------------------------------------------------- -// checkCursor -// The checkCursor method iterates through all the root controls on the canvas checking each -// ones noCursor property. If the noCursor property exists as anything other than false or an -// empty string on every control, the cursor will be hidden. -//--------------------------------------------------------------------------------------------- -function GuiCanvas::checkCursor(%this) -{ - %count = %this.getCount(); - for(%i = 0; %i < %count; %i++) - { - %control = %this.getObject(%i); - if ((%control.noCursor $= "") || !%control.noCursor) - { - showCursor(); - return; - } - } - // If we get here, every control requested a hidden cursor, so we oblige. - hideCursor(); -} - -//--------------------------------------------------------------------------------------------- -// The following functions override the GuiCanvas defaults that involve changing the content -// of the Canvas. Basically, all we are doing is adding a call to checkCursor to each one. -//--------------------------------------------------------------------------------------------- -function GuiCanvas::setContent(%this, %ctrl) -{ - Parent::setContent(%this, %ctrl); - %this.checkCursor(); -} - -function GuiCanvas::pushDialog(%this, %ctrl, %layer, %center) -{ - Parent::pushDialog(%this, %ctrl, %layer, %center); - %this.checkCursor(); -} - -function GuiCanvas::popDialog(%this, %ctrl) -{ - Parent::popDialog(%this, %ctrl); - %this.checkCursor(); -} - -function GuiCanvas::popLayer(%this, %layer) -{ - Parent::popLayer(%this, %layer); - %this.checkCursor(); -} - -}; - -activatePackage(CanvasCursorPackage); diff --git a/Templates/BaseGame/game/core/fonts/Arial 10 (ansi).uft b/Templates/BaseGame/game/core/fonts/Arial 10 (ansi).uft deleted file mode 100644 index 2b564950050cfca995e66f048e0523428ff493b0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 412 zcmZQ(U|?W%EXqvG;R3Qi07P>@F%ytx24VyN@mQf;5Dk%qsR4%?)Qy83;)lEIri7m zFZoExihWaFY>GaAyHfb_#$7>4rhD3-7VX{JcRHkY<;8EhWjEc^(!MS|x7jKnT~tu; z`y-fhfi55e9MJ#4lvSq~c?$DU2jYrb$q5Y1ZVG9@ Ja2IA^0RUczP(}a% diff --git a/Templates/BaseGame/game/core/fonts/Arial 12 (ansi).uft b/Templates/BaseGame/game/core/fonts/Arial 12 (ansi).uft deleted file mode 100644 index 67a177016766c6f06b5b601c3336b9fea2ac75ba..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 62 jcmZQ(U|?W%EXqvG;Q_Kh07P>_F*8U23jU*ldXO*xH#ZTF diff --git a/Templates/BaseGame/game/core/fonts/Arial 14 (ansi).uft b/Templates/BaseGame/game/core/fonts/Arial 14 (ansi).uft deleted file mode 100644 index 159010c6850f3424dbc7456533d0e2ae6f82e9bc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5160 zcmd6pc{o(vAHeU7u@_Q^vc{WI)@VUSrcmBQq%2v6&B<*H&b$_|0+eJl&@>fB()r=brDqpYvVMx%Uhk1VQY&Uat0Td<+RRF!Cau zjWOCV`p?GA5V;tAfziMSIs}2Ips_PL$D#y}Oc{Cf%K)sy{=m4j?n;0djg!%t*1!n+ z6$6OTfG+$5?N@S$2)1@{nSym*D6rF9P=6kX?^F`KibmP=6JACAEm zp&&*O33H9$nC%g|be)f}q$GrbjL;okeK(XYx>j&hClLyE9h$}tNh5qKiQN^GrIwP2#N9fP`plfvnq0Cia+%Cop zdr3m*(ovFz=pz82@2WJFiP``)+`}LReh=Bx` z8yXNy;injQ@A!&NGtMNgm4*aeGoR}t@0Fru{uZnGGG=X==MsdM65zsNRj{yd<1r7; zLlxZY$-`$JR;i0?qpVoxLtUXDKv}`nfeY#q#9fuLWc(QS>nzR2OKx17eV{qruUI@r zEB-jkg>66eW7fpRhP`6_EUtFY?(cxjw2Rhq!S)WRac+B`w+PosXp0ik@-z44XI;;R z2oO%7ML5GSv8Qg|g-FUJjc<3PLPH7aL?;XHfx%&?PF+H#ZYmqs)5sI|Mlhu(oSdlU zyE|Iegz0O(pf(De9fV8|Yd)`1!?eaj2bGD|cLDT2Q@K+}eJ$ zl^FHrtSYDM*XYCo*Q~UIk+i4vwfqBI-IU7JuAEV?_(e>p;}Zp#5NX@ub z9nL|swQ44+w@!Nw7@4Jst-(-N$H}uf2nPG!soNp-zOHO&HgP7+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a+^zDU?kb^{WpJj;9wu6D)_EOB951)XBGc- zYsDGm?VPW??+z(dPu!c`9q&PvonMOF$Pa%E-CSN8i$Mw6Yyy?MXKmAe^F zPgn2pZK^M^P7>Rlk^;^jaR}Ya zw;{J-JLjecb!&%8a_coazl3*2t5pgRqc7Tr+uw?JB(G>(cE3`n$?;SFMcy-YU#i5X zzjWvgQ{QLhHSJq-`nhRx)PB?9xKz5BrAu=7u{jr6T{@qzYtN<*zd4MRREXaH0IB1e A=Kufz diff --git a/Templates/BaseGame/game/core/fonts/Arial 16 (ansi).uft b/Templates/BaseGame/game/core/fonts/Arial 16 (ansi).uft deleted file mode 100644 index 058fbb305a81a9670c8a346f4384647711e5f8ae..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13112 zcmc(kc|29y+rYPDDnm$y6i$dxC|xPxC`yx%3{f? zsTC%5z@$V>dLNTM#-z_M>2pk)fJxIa>3^8C1e2Cy($AQ*36pkV(g93L!lWqtqoVma zGKY?Xa|_Naxdta3g64nz3qhaqgf(1~rWwI`~VIYVf7C^x$WmGu04?%cX00jhiA?qUR75t6D-JkvuDvVMP zGctluWWC}j1uFmoEQ1JvK+qmoD5C<=fEkD#X_S)Vg}XlqLS;}2=2Hqn_n{Q@DD#X^ zIh4}=(5|DabQf_t);-?=geiLC_DBg1MA2gSU>V5&Mr99=;9&ul$oim0 zbiu8HhXqg&Gg%j*?(hg6mbG>7QP4kiy(#FQejlUs_go>TERaH%Z24Er!D~=33yC=b zrR0^6Ys7LSNn7ag+kfloYYN8>L_cKpzy~0a-72b0eT5lzx%60!qPL=#N`X}n4WPg$;upNv5zrpkK~TUfgnGa&0xUoW z2=D;xAeR4yTLf4@CV$T+1bL#Atn8GlqQK0#T7E&;_#)3T_oZ!485^u-;$v07}7J;13i~ zBf9c%3+RH~1~~!+)JQf|;1-~ixdN6EdJ?5T7mSjlLhNW^QUgqS1(TXlP_PnmCK124 zPztgEP8OiQo@XbNf|$Y611Qi#bnn2ez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cgnPuIc%m|8_Q+6Y)SLfGCle171@8)=-cEPV{ENrUg~Th z^e@R76c6H?d5;P5<+^P>fT14B}?jbl5Z4sp?i>nE$YUaA|{D;bxZn;CN4dZEw z-&HMHaOqR!k}Jw#4!jW1 z%lzgk!b!OMk#|Eat=Ly0Jk7Dk$TGWm(z~+kEYoYKUAW5Uwd5g=v}RHdJ0q(oNoEko zagBH(l^DK3iaW?V)B{&{gh|}*(SxZFW;g0fRJVlaaprnoagb@z%~r+7y9Cu9PmkCW zV5)c^vA86Sp)L(ts(rI!0w0J*#-viA$qIply;Sm*-X4Ze+6A7q7v9~^I4xfKp_2gF zEfO8%6$%L|JmBT6Zb~bQ=Sone zR%qqpXWhG2pjlck0z^A!YSiIndLkn*y z^Pt=Z=2f8Sr%R+|w@4BeT`SUq?uyY5NFykIitF6F5v9U<`x z@>G-`*`4&|p#{@ro=;65cBhU%w8X7WE3$`_zZ2e_SaH&V;Y`TKy13mh2TxkkNrzNa z8t+bSuC&--6Y{C;`|h;)N=qunh2pzA&DgxpRdzp3kBQxBzWLL+>Iv=is3$3A9LeXZ zel(=VWu=(&4xOu6kV${>$jppAw59TUc6#hfGxII2E!8u2>CxfCW?cC#RiiWM@rA?Y z{EIC$D;unydu$zM^*m7d&BrPxdg};x*@5bDHLIwAu;ESd2dW0Et>QAnMz;1JsF|0r zdf{y_yfG-RvM<#tHrZf=r!lX3+QKS2v~8F(C$DN`)G9u|ZG>+&uV$H#^xX5{Fq^Ma zWlsbtCjQ{a<{GE!$qS^Ypn_qJG^eVe4pLlB!3gh|Q_Z3R>4op@VfM&{%Kjo!Y})OS gEu9P1v#zA*$faSf;)SZQ6;gch(lWimA=f+q2mLv4SO5S3 diff --git a/Templates/BaseGame/game/core/fonts/Arial 36 (ansi).uft b/Templates/BaseGame/game/core/fonts/Arial 36 (ansi).uft deleted file mode 100644 index 968441ce3b27703632299ab9837977bb7ee35234..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1046 zcm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HAv7_=GNf^_?$7)mK$uHlM0R*xA(x!OT`ErY>;X+SvMK zO8|rXwDGV_CJVweDb;LwA--*4v5bCAXz^G`Q-9yHt8?5>@Wsrdv-8m=DQ7Or-V&E7 z8MO57i7krZ72Wgrsuwe(Ay>B}I`ffQph`{?I+l5=cA(~Yy1r*=7UTgK~VR7`z1bvQ)713 zkFCS<-t?+`e-FCJ#w!$3XCK`zHrpM}BBrl9bGe*03cs}A<{R`&f?s|7ndi{OrIyrb zMUy_we6IwpuO4yctzGXjlUN4#M?TZB-O=pIli4xT4-NN><)n8w2ruI76i$s%Eod`H zOnZM@5yY+J?T{PL^p-U9Zt1MhsnKRa?K!qQ(M|I`%t(iA%H9A!+4^f~bVf0ue77xr zG@W@$zsgzRpx>JP2jN`ki@0Bao)>q3gX{RK$EInE6@q#HzUI}L>wb|5D!6}MLW#FY z{W`u@!p*?J`=Y0F!SdLj3;Ud1W~+Oj_gK(UG-b^di@o9XcIRno%VlE5|8SjYk9M~@ z>Zul(lob|K>$4_DiN>z=m;Ir{T{_fW+K~GzL48tm^s{%gNQLRHa;7UYH{Ru1JFQ@> zIxWgB9X^DbZ;W8;Y<>8+;qBIvUa zkfxfRYR(C3-&H~%e1ZW3A6IL52<;$9=N-ewZwlTDIpao=P8A zyOwMIA|;}u!OUD8ZRD8M>|WOXX~4`#{gT(Y><;&mq>m-DLm00y1Ku3Oi%jPBI7MUq zans3MM;T+5OT|7PTRP9Vx##438tgQY8^7>1qr@Fk>gAHiGp6O3ku6iv-Vqg_t>&J= z*WPGm5Qa8Al*RMn(cO+xGh@0jhvttxidL96UYPOs;Qtu^zxGRlv3kX7`bkOCe*vAy BNb3Lq diff --git a/Templates/BaseGame/game/core/gfxData/clouds.cs b/Templates/BaseGame/game/core/gfxData/clouds.cs deleted file mode 100644 index 00d56d6d3..000000000 --- a/Templates/BaseGame/game/core/gfxData/clouds.cs +++ /dev/null @@ -1,55 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//------------------------------------------------------------------------------ -// CloudLayer -//------------------------------------------------------------------------------ - -singleton ShaderData( CloudLayerShader ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/cloudLayerV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/cloudLayerP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/cloudLayerV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/cloudLayerP.glsl"; - - samplerNames[0] = "$normalHeightMap"; - - pixVersion = 2.0; -}; - -//------------------------------------------------------------------------------ -// BasicClouds -//------------------------------------------------------------------------------ - -singleton ShaderData( BasicCloudsShader ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/basicCloudsV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/basicCloudsP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/basicCloudsV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/basicCloudsP.glsl"; - - samplerNames[0] = "$diffuseMap"; - - pixVersion = 2.0; -}; diff --git a/Templates/BaseGame/game/core/gfxData/commonMaterialData.cs b/Templates/BaseGame/game/core/gfxData/commonMaterialData.cs deleted file mode 100644 index c5d8ef5bc..000000000 --- a/Templates/BaseGame/game/core/gfxData/commonMaterialData.cs +++ /dev/null @@ -1,79 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// Anim flag settings - must match material.h -// These cannot be enumed through script becuase it cannot -// handle the "|" operation for combining them together -// ie. Scroll | Wave does not work. -//----------------------------------------------------------------------------- -$scroll = 1; -$rotate = 2; -$wave = 4; -$scale = 8; -$sequence = 16; - - -// Common stateblock definitions -new GFXSamplerStateData(SamplerClampLinear) -{ - textureColorOp = GFXTOPModulate; - addressModeU = GFXAddressClamp; - addressModeV = GFXAddressClamp; - addressModeW = GFXAddressClamp; - magFilter = GFXTextureFilterLinear; - minFilter = GFXTextureFilterLinear; - mipFilter = GFXTextureFilterLinear; -}; - -new GFXSamplerStateData(SamplerClampPoint) -{ - textureColorOp = GFXTOPModulate; - addressModeU = GFXAddressClamp; - addressModeV = GFXAddressClamp; - addressModeW = GFXAddressClamp; - magFilter = GFXTextureFilterPoint; - minFilter = GFXTextureFilterPoint; - mipFilter = GFXTextureFilterPoint; -}; - -new GFXSamplerStateData(SamplerWrapLinear) -{ - textureColorOp = GFXTOPModulate; - addressModeU = GFXTextureAddressWrap; - addressModeV = GFXTextureAddressWrap; - addressModeW = GFXTextureAddressWrap; - magFilter = GFXTextureFilterLinear; - minFilter = GFXTextureFilterLinear; - mipFilter = GFXTextureFilterLinear; -}; - -new GFXSamplerStateData(SamplerWrapPoint) -{ - textureColorOp = GFXTOPModulate; - addressModeU = GFXTextureAddressWrap; - addressModeV = GFXTextureAddressWrap; - addressModeW = GFXTextureAddressWrap; - magFilter = GFXTextureFilterPoint; - minFilter = GFXTextureFilterPoint; - mipFilter = GFXTextureFilterPoint; -}; diff --git a/Templates/BaseGame/game/core/gfxData/scatterSky.cs b/Templates/BaseGame/game/core/gfxData/scatterSky.cs deleted file mode 100644 index 5add01d8b..000000000 --- a/Templates/BaseGame/game/core/gfxData/scatterSky.cs +++ /dev/null @@ -1,48 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -new GFXStateBlockData( ScatterSkySBData ) -{ - cullMode = "GFXCullNone"; - - zDefined = true; - zEnable = true; - zWriteEnable = false; - - samplersDefined = true; - samplerStates[0] = SamplerClampLinear; - samplerStates[1] = SamplerClampLinear; - vertexColorEnable = true; -}; - -singleton ShaderData( ScatterSkyShaderData ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/scatterSkyV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/scatterSkyP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/scatterSkyV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/scatterSkyP.glsl"; - - samplerNames[0] = "$nightSky"; - - pixVersion = 2.0; -}; diff --git a/Templates/BaseGame/game/core/gfxData/shaders.cs b/Templates/BaseGame/game/core/gfxData/shaders.cs deleted file mode 100644 index da3b7c864..000000000 --- a/Templates/BaseGame/game/core/gfxData/shaders.cs +++ /dev/null @@ -1,152 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -//----------------------------------------------------------------------------- -// This file contains shader data necessary for various engine utility functions -//----------------------------------------------------------------------------- - - -singleton ShaderData( ParticlesShaderData ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/particlesV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/particlesP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/particlesV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/particlesP.glsl"; - - samplerNames[0] = "$diffuseMap"; - samplerNames[1] = "$deferredTex"; - samplerNames[2] = "$paraboloidLightMap"; - - pixVersion = 2.0; -}; - -singleton ShaderData( OffscreenParticleCompositeShaderData ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/particleCompositeV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/particleCompositeP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/particleCompositeV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/particleCompositeP.glsl"; - - samplerNames[0] = "$colorSource"; - samplerNames[1] = "$edgeSource"; - - pixVersion = 2.0; -}; - -//----------------------------------------------------------------------------- -// Planar Reflection -//----------------------------------------------------------------------------- -new ShaderData( ReflectBump ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/planarReflectBumpV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/planarReflectBumpP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectBumpV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectBumpP.glsl"; - - samplerNames[0] = "$diffuseMap"; - samplerNames[1] = "$refractMap"; - samplerNames[2] = "$bumpMap"; - - pixVersion = 2.0; -}; - -new ShaderData( Reflect ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/planarReflectV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/planarReflectP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectP.glsl"; - - samplerNames[0] = "$diffuseMap"; - samplerNames[1] = "$refractMap"; - - pixVersion = 1.4; -}; - -//----------------------------------------------------------------------------- -// fxFoliageReplicator -//----------------------------------------------------------------------------- -new ShaderData( fxFoliageReplicatorShader ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/fxFoliageReplicatorV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/fxFoliageReplicatorP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/fxFoliageReplicatorV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/fxFoliageReplicatorP.glsl"; - - samplerNames[0] = "$diffuseMap"; - samplerNames[1] = "$alphaMap"; - - pixVersion = 1.4; -}; - -singleton ShaderData( VolumetricFogDeferredShader ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogPreV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogPreP.glsl"; - - pixVersion = 3.0; -}; -singleton ShaderData( VolumetricFogShader ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogP.glsl"; - - samplerNames[0] = "$deferredTex"; - samplerNames[1] = "$depthBuffer"; - samplerNames[2] = "$frontBuffer"; - samplerNames[3] = "$density"; - - pixVersion = 3.0; -}; -singleton ShaderData( VolumetricFogReflectionShader ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogRefl.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogPreV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogRefl.glsl"; - - pixVersion = 3.0; -}; -singleton ShaderData( CubemapSaveShader ) -{ - DXVertexShaderFile = "shaders/common/cubemapSaveV.hlsl"; - DXPixelShaderFile = "shaders/common/cubemapSaveP.hlsl"; - - OGLVertexShaderFile = "shaders/common/gl/cubemapSaveV.glsl"; - OGLPixelShaderFile = "shaders/common/gl/cubemapSaveP.glsl"; - - samplerNames[0] = "$cubemapTex"; - - pixVersion = 3.0; -}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/gfxData/terrainBlock.cs b/Templates/BaseGame/game/core/gfxData/terrainBlock.cs deleted file mode 100644 index 69802b1da..000000000 --- a/Templates/BaseGame/game/core/gfxData/terrainBlock.cs +++ /dev/null @@ -1,36 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -/// Used when generating the blended base texture. -singleton ShaderData( TerrainBlendShader ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/terrain/blendV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/terrain/blendP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/terrain/gl/blendV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/terrain/gl/blendP.glsl"; - - samplerNames[0] = "layerTex"; - samplerNames[1] = "textureMap"; - - pixVersion = 2.0; -}; diff --git a/Templates/BaseGame/game/core/gfxData/water.cs b/Templates/BaseGame/game/core/gfxData/water.cs deleted file mode 100644 index ec5e4be71..000000000 --- a/Templates/BaseGame/game/core/gfxData/water.cs +++ /dev/null @@ -1,208 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - - - -//----------------------------------------------------------------------------- -// Water -//----------------------------------------------------------------------------- - -singleton ShaderData( WaterShader ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/water/waterV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/water/waterP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/water/gl/waterV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/water/gl/waterP.glsl"; - - samplerNames[0] = "$bumpMap"; // noise - samplerNames[1] = "$deferredTex"; // #deferred - samplerNames[2] = "$reflectMap"; // $reflectbuff - samplerNames[3] = "$refractBuff"; // $backbuff - samplerNames[4] = "$skyMap"; // $cubemap - samplerNames[5] = "$foamMap"; // foam - samplerNames[6] = "$depthGradMap"; // depthMap ( color gradient ) - - pixVersion = 3.0; -}; - -new GFXSamplerStateData(WaterSampler) -{ - textureColorOp = GFXTOPModulate; - addressModeU = GFXAddressWrap; - addressModeV = GFXAddressWrap; - addressModeW = GFXAddressWrap; - magFilter = GFXTextureFilterLinear; - minFilter = GFXTextureFilterAnisotropic; - mipFilter = GFXTextureFilterLinear; - maxAnisotropy = 4; -}; - -singleton GFXStateBlockData( WaterStateBlock ) -{ - samplersDefined = true; - samplerStates[0] = WaterSampler; // noise - samplerStates[1] = SamplerClampPoint; // #deferred - samplerStates[2] = SamplerClampLinear; // $reflectbuff - samplerStates[3] = SamplerClampPoint; // $backbuff - samplerStates[4] = SamplerWrapLinear; // $cubemap - samplerStates[5] = SamplerWrapLinear; // foam - samplerStates[6] = SamplerClampLinear; // depthMap ( color gradient ) - cullDefined = true; - cullMode = "GFXCullCCW"; -}; - -singleton GFXStateBlockData( UnderWaterStateBlock : WaterStateBlock ) -{ - cullMode = "GFXCullCW"; -}; - -singleton CustomMaterial( WaterMat ) -{ - sampler["deferredTex"] = "#deferred"; - sampler["reflectMap"] = "$reflectbuff"; - sampler["refractBuff"] = "$backbuff"; - // These samplers are set in code not here. - // This is to allow different WaterObject instances - // to use this same material but override these textures - // per instance. - //sampler["bumpMap"] = ""; - //sampler["skyMap"] = ""; - //sampler["foamMap"] = ""; - //sampler["depthGradMap"] = ""; - - shader = WaterShader; - stateBlock = WaterStateBlock; - version = 3.0; - - useAnisotropic[0] = true; -}; - -//----------------------------------------------------------------------------- -// Underwater -//----------------------------------------------------------------------------- - -singleton ShaderData( UnderWaterShader : WaterShader ) -{ - defines = "UNDERWATER"; -}; - -singleton CustomMaterial( UnderwaterMat ) -{ - // These samplers are set in code not here. - // This is to allow different WaterObject instances - // to use this same material but override these textures - // per instance. - //sampler["bumpMap"] = "core/art/water/noise02"; - //sampler["foamMap"] = "core/art/water/foam"; - - sampler["deferredTex"] = "#deferred"; - sampler["refractBuff"] = "$backbuff"; - - shader = UnderWaterShader; - stateBlock = UnderWaterStateBlock; - specular = "0.75 0.75 0.75 1.0"; - specularPower = 48.0; - version = 3.0; -}; - -//----------------------------------------------------------------------------- -// Basic Water -//----------------------------------------------------------------------------- - -singleton ShaderData( WaterBasicShader ) -{ - DXVertexShaderFile = $Core::CommonShaderPath @ "/water/waterBasicV.hlsl"; - DXPixelShaderFile = $Core::CommonShaderPath @ "/water/waterBasicP.hlsl"; - - OGLVertexShaderFile = $Core::CommonShaderPath @ "/water/gl/waterBasicV.glsl"; - OGLPixelShaderFile = $Core::CommonShaderPath @ "/water/gl/waterBasicP.glsl"; - - samplerNames[0] = "$bumpMap"; - samplerNames[2] = "$reflectMap"; - samplerNames[3] = "$refractBuff"; - samplerNames[4] = "$skyMap"; - samplerNames[5] = "$depthGradMap"; - - pixVersion = 2.0; -}; - -singleton GFXStateBlockData( WaterBasicStateBlock ) -{ - samplersDefined = true; - samplerStates[0] = WaterSampler; // noise - samplerStates[2] = SamplerClampLinear; // $reflectbuff - samplerStates[3] = SamplerClampPoint; // $backbuff - samplerStates[4] = SamplerWrapLinear; // $cubemap - cullDefined = true; - cullMode = "GFXCullCCW"; -}; - -singleton GFXStateBlockData( UnderWaterBasicStateBlock : WaterBasicStateBlock ) -{ - cullMode = "GFXCullCW"; -}; - -singleton CustomMaterial( WaterBasicMat ) -{ - // These samplers are set in code not here. - // This is to allow different WaterObject instances - // to use this same material but override these textures - // per instance. - //sampler["bumpMap"] = "core/art/water/noise02"; - //sampler["skyMap"] = "$cubemap"; - - //sampler["deferredTex"] = "#deferred"; - sampler["reflectMap"] = "$reflectbuff"; - sampler["refractBuff"] = "$backbuff"; - - cubemap = NewLevelSkyCubemap; - shader = WaterBasicShader; - stateBlock = WaterBasicStateBlock; - version = 2.0; -}; - -//----------------------------------------------------------------------------- -// Basic UnderWater -//----------------------------------------------------------------------------- - -singleton ShaderData( UnderWaterBasicShader : WaterBasicShader) -{ - defines = "UNDERWATER"; -}; - -singleton CustomMaterial( UnderwaterBasicMat ) -{ - // These samplers are set in code not here. - // This is to allow different WaterObject instances - // to use this same material but override these textures - // per instance. - //sampler["bumpMap"] = "core/art/water/noise02"; - //samplers["skyMap"] = "$cubemap"; - - //sampler["deferredTex"] = "#deferred"; - sampler["refractBuff"] = "$backbuff"; - - shader = UnderWaterBasicShader; - stateBlock = UnderWaterBasicStateBlock; - version = 2.0; -}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/gfxprofile/D3D9.ATITechnologiesInc.cs b/Templates/BaseGame/game/core/gfxprofile/D3D9.ATITechnologiesInc.cs deleted file mode 100644 index 10c6bdf5b..000000000 --- a/Templates/BaseGame/game/core/gfxprofile/D3D9.ATITechnologiesInc.cs +++ /dev/null @@ -1,36 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -// ATI Vendor Profile Script -// -// This script is responsible for setting global -// capability strings based on the nVidia vendor. - -if(GFXCardProfiler::getVersion() < 64.44) -{ - $GFX::OutdatedDrivers = true; - $GFX::OutdatedDriversLink = "You can get newer drivers here.."; -} -else -{ - $GFX::OutdatedDrivers = false; -} diff --git a/Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.GeForce8600.cs b/Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.GeForce8600.cs deleted file mode 100644 index 328788dac..000000000 --- a/Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.GeForce8600.cs +++ /dev/null @@ -1,36 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -// nVidia Vendor Profile Script -// -// This script is responsible for setting global -// capability strings based on the nVidia vendor. - -if(GFXCardProfiler::getVersion() < 1.2) -{ - $GFX::OutdatedDrivers = true; - $GFX::OutdatedDriversLink = "You can get newer drivers here.."; -} -else -{ - $GFX::OutdatedDrivers = false; -} diff --git a/Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.QuadroFXGo1000.cs b/Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.QuadroFXGo1000.cs deleted file mode 100644 index 5681b2f6d..000000000 --- a/Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.QuadroFXGo1000.cs +++ /dev/null @@ -1,39 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -// nVidia Vendor Profile Script -// -// This script is responsible for setting global -// capability strings based on the nVidia vendor. - -if(GFXCardProfiler::getVersion() < 53.82) -{ - $GFX::OutdatedDrivers = true; - $GFX::OutdatedDriversLink = "You can get newer drivers here.."; -} -else -{ - $GFX::OutdatedDrivers = false; -} - -// Silly card has trouble with this! -GFXCardProfiler::setCapability("autoMipmapLevel", false); diff --git a/Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.cs b/Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.cs deleted file mode 100644 index b33b8d5d3..000000000 --- a/Templates/BaseGame/game/core/gfxprofile/D3D9.NVIDIA.cs +++ /dev/null @@ -1,36 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -// nVidia Vendor Profile Script -// -// This script is responsible for setting global -// capability strings based on the nVidia vendor. - -if(GFXCardProfiler::getVersion() < 56.72) -{ - $GFX::OutdatedDrivers = true; - $GFX::OutdatedDriversLink = "You can get newer drivers here.."; -} -else -{ - $GFX::OutdatedDrivers = false; -} diff --git a/Templates/BaseGame/game/core/gfxprofile/D3D9.cs b/Templates/BaseGame/game/core/gfxprofile/D3D9.cs deleted file mode 100644 index e1e299341..000000000 --- a/Templates/BaseGame/game/core/gfxprofile/D3D9.cs +++ /dev/null @@ -1,26 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -// Direct3D 9 Renderer Profile Script -// -// This script is responsible for setting global -// capability strings based on the D3D9 renderer type. \ No newline at end of file diff --git a/Templates/BaseGame/game/core/globals.cs b/Templates/BaseGame/game/core/globals.cs deleted file mode 100644 index d4e4f1ca3..000000000 --- a/Templates/BaseGame/game/core/globals.cs +++ /dev/null @@ -1,102 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - -// ---------------------------------------------------------------------------- -// DInput keyboard, mouse, and joystick prefs -// ---------------------------------------------------------------------------- - -$pref::Input::MouseEnabled = 1; -$pref::Input::LinkMouseSensitivity = 1; -$pref::Input::KeyboardEnabled = 1; -$pref::Input::KeyboardTurnSpeed = 0.1; -$pref::Input::JoystickEnabled = 0; - -// ---------------------------------------------------------------------------- -// Video Preferences -// ---------------------------------------------------------------------------- - -// Set directory paths for various data or default images. -$pref::Video::ProfilePath = "core/gfxprofile"; -$pref::Video::missingTexturePath = "core/images/missingTexture.png"; -$pref::Video::unavailableTexturePath = "core/images/unavailable.png"; -$pref::Video::warningTexturePath = "core/images/warnMat.dds"; - -$pref::Video::disableVerticalSync = 1; -$pref::Video::mode = "800 600 false 32 60 4"; -$pref::Video::defaultFenceCount = 0; - -// This disables the hardware FSAA/MSAA so that we depend completely on the FXAA -// post effect which works on all cards and in deferred mode. Note that the new -// Intel Hybrid graphics on laptops will fail to initialize when hardware AA is -// enabled... so you've been warned. -$pref::Video::disableHardwareAA = true; - -$pref::Video::disableNormalmapping = false; -$pref::Video::disablePixSpecular = false; -$pref::Video::disableCubemapping = false; -$pref::Video::disableParallaxMapping = false; - -// The number of mipmap levels to drop on loaded textures to reduce video memory -// usage. It will skip any textures that have been defined as not allowing down -// scaling. -$pref::Video::textureReductionLevel = 0; - -$pref::Video::defaultAnisotropy = 1; -//$pref::Video::Gamma = 1.0; - -/// AutoDetect graphics quality levels the next startup. -$pref::Video::autoDetect = 1; - -// ---------------------------------------------------------------------------- -// Shader stuff -// ---------------------------------------------------------------------------- - -// This is the path used by ShaderGen to cache procedural shaders. If left -// blank ShaderGen will only cache shaders to memory and not to disk. -$shaderGen::cachePath = "data/shaderCache"; - -// Uncomment to disable ShaderGen, useful when debugging -//$ShaderGen::GenNewShaders = false; - -// Uncomment to dump disassembly for any shader that is compiled to disk. These -// will appear as shadername_dis.txt in the same path as the shader file. -//$gfx::disassembleAllShaders = true; - -// ---------------------------------------------------------------------------- -// Lighting and shadowing -// ---------------------------------------------------------------------------- - -// Uncomment to enable AdvancedLighting on the Mac (T3D 2009 Beta 3) -//$pref::machax::enableAdvancedLighting = true; - -$sceneLighting::cacheSize = 20000; -$sceneLighting::purgeMethod = "lastCreated"; -$sceneLighting::cacheLighting = 1; - -$pref::Shadows::textureScalar = 1.0; -$pref::Shadows::disable = false; - -// Sets the shadow filtering mode. -// None - Disables filtering. -// SoftShadow - Does a simple soft shadow -// SoftShadowHighQuality -$pref::Shadows::filterMode = "SoftShadow"; diff --git a/Templates/BaseGame/game/core/helperFunctions.cs b/Templates/BaseGame/game/core/helperFunctions.cs deleted file mode 100644 index 1b98f1ea5..000000000 --- a/Templates/BaseGame/game/core/helperFunctions.cs +++ /dev/null @@ -1,1158 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- - - -//------------------------------------------------------------------------------ -// Check if a script file exists, compiled or not. -function isScriptFile(%path) -{ - if( isFile(%path @ ".dso") || isFile(%path) ) - return true; - - return false; -} - -function loadMaterials() -{ - // Load any materials files for which we only have DSOs. - - for( %file = findFirstFile( "*/materials.cs.dso" ); - %file !$= ""; - %file = findNextFile( "*/materials.cs.dso" )) - { - // Only execute, if we don't have the source file. - %csFileName = getSubStr( %file, 0, strlen( %file ) - 4 ); - if( !isFile( %csFileName ) ) - exec( %csFileName ); - } - - // Load all source material files. - - for( %file = findFirstFile( "*/materials.cs" ); - %file !$= ""; - %file = findNextFile( "*/materials.cs" )) - { - exec( %file ); - } - - // Load all materials created by the material editor if - // the folder exists - if( IsDirectory( "materialEditor" ) ) - { - for( %file = findFirstFile( "materialEditor/*.cs.dso" ); - %file !$= ""; - %file = findNextFile( "materialEditor/*.cs.dso" )) - { - // Only execute, if we don't have the source file. - %csFileName = getSubStr( %file, 0, strlen( %file ) - 4 ); - if( !isFile( %csFileName ) ) - exec( %csFileName ); - } - - for( %file = findFirstFile( "materialEditor/*.cs" ); - %file !$= ""; - %file = findNextFile( "materialEditor/*.cs" )) - { - exec( %file ); - } - } -} - -function reloadMaterials() -{ - reloadTextures(); - loadMaterials(); - reInitMaterials(); -} - -function loadDatablockFiles( %datablockFiles, %recurse ) -{ - if ( %recurse ) - { - recursiveLoadDatablockFiles( %datablockFiles, 9999 ); - return; - } - - %count = %datablockFiles.count(); - for ( %i=0; %i < %count; %i++ ) - { - %file = %datablockFiles.getKey( %i ); - if ( !isFile(%file @ ".dso") && !isFile(%file) ) - continue; - - exec( %file ); - } - - // Destroy the incoming list. - //%datablockFiles.delete(); -} - -function recursiveLoadDatablockFiles( %datablockFiles, %previousErrors ) -{ - %reloadDatablockFiles = new ArrayObject(); - - // Keep track of the number of datablocks that - // failed during this pass. - %failedDatablocks = 0; - - // Try re-executing the list of datablock files. - %count = %datablockFiles.count(); - for ( %i=0; %i < %count; %i++ ) - { - %file = %datablockFiles.getKey( %i ); - if ( !isFile(%file @ ".dso") && !isFile(%file) ) - continue; - - // Start counting copy constructor creation errors. - $Con::objectCopyFailures = 0; - - exec( %file ); - - // If errors occured then store this file for re-exec later. - if ( $Con::objectCopyFailures > 0 ) - { - %reloadDatablockFiles.add( %file ); - %failedDatablocks = %failedDatablocks + $Con::objectCopyFailures; - } - } - - // Clear the object copy failure counter so that - // we get console error messages again. - $Con::objectCopyFailures = -1; - - // Delete the old incoming list... we're done with it. - //%datablockFiles.delete(); - - // If we still have datablocks to retry. - %newCount = %reloadDatablockFiles.count(); - if ( %newCount > 0 ) - { - // If the datablock failures have not been reduced - // from the last pass then we must have a real syntax - // error and not just a bad dependancy. - if ( %previousErrors > %failedDatablocks ) - recursiveLoadDatablockFiles( %reloadDatablockFiles, %failedDatablocks ); - - else - { - // Since we must have real syntax errors do one - // last normal exec to output error messages. - loadDatablockFiles( %reloadDatablockFiles, false ); - } - - return; - } - - // Cleanup the empty reload list. - %reloadDatablockFiles.delete(); -} - -function getUserPath() -{ - %temp = getUserHomeDirectory(); - echo(%temp); - if(!isDirectory(%temp)) - { - %temp = getUserDataDirectory(); - echo(%temp); - if(!isDirectory(%temp)) - { - %userPath = "data"; - } - else - { - //put it in appdata/roaming - %userPath = %temp @ "/" @ $appName; - } - } - else - { - //put it in user/documents - %userPath = %temp @ "/" @ $appName; - } - return %userPath; -} - -function getPrefpath() -{ - $prefPath = getUserPath() @ "/preferences"; - return $prefPath; -} - -function updateTSShapeLoadProgress(%progress, %msg) -{ - // Check if the loading GUI is visible and use that instead of the - // separate import progress GUI if possible - /* if ( isObject(LoadingGui) && LoadingGui.isAwake() ) - { - // Save/Restore load progress at the start/end of the import process - if ( %progress == 0 ) - { - ColladaImportProgress.savedProgress = LoadingProgress.getValue(); - ColladaImportProgress.savedText = LoadingProgressTxt.getValue(); - - ColladaImportProgress.msgPrefix = "Importing " @ %msg; - %msg = "Reading file into memory..."; - } - else if ( %progress == 1.0 ) - { - LoadingProgress.setValue( ColladaImportProgress.savedProgress ); - LoadingProgressTxt.setValue( ColladaImportProgress.savedText ); - } - - %msg = ColladaImportProgress.msgPrefix @ ": " @ %msg; - - %progressCtrl = LoadingProgress; - %textCtrl = LoadingProgressTxt; - } - else - { - //it's probably the editors using it - if(isFunction("updateToolTSShapeLoadProgress")) - { - updateToolTSShapeLoadProgress(%progress, %msg); - } - } - - // Update progress indicators - if (%progress == 0) - { - %progressCtrl.setValue(0.001); - %textCtrl.setText(%msg); - } - else if (%progress != 1.0) - { - %progressCtrl.setValue(%progress); - %textCtrl.setText(%msg); - } - - Canvas.repaint(33);*/ -} - -/// A helper function which will return the ghosted client object -/// from a server object when connected to a local server. -function serverToClientObject( %serverObject ) -{ - assert( isObject( LocalClientConnection ), "serverToClientObject() - No local client connection found!" ); - assert( isObject( ServerConnection ), "serverToClientObject() - No server connection found!" ); - - %ghostId = LocalClientConnection.getGhostId( %serverObject ); - if ( %ghostId == -1 ) - return 0; - - return ServerConnection.resolveGhostID( %ghostId ); -} - -//---------------------------------------------------------------------------- -// Debug commands -//---------------------------------------------------------------------------- - -function netSimulateLag( %msDelay, %packetLossPercent ) -{ - if ( %packetLossPercent $= "" ) - %packetLossPercent = 0; - - commandToServer( 'NetSimulateLag', %msDelay, %packetLossPercent ); -} - -//Various client functions - -function validateDatablockName(%name) -{ - // remove whitespaces at beginning and end - %name = trim( %name ); - - // remove numbers at the beginning - %numbers = "0123456789"; - while( strlen(%name) > 0 ) - { - // the first character - %firstChar = getSubStr( %name, 0, 1 ); - // if the character is a number remove it - if( strpos( %numbers, %firstChar ) != -1 ) - { - %name = getSubStr( %name, 1, strlen(%name) -1 ); - %name = ltrim( %name ); - } - else - break; - } - - // replace whitespaces with underscores - %name = strreplace( %name, " ", "_" ); - - // remove any other invalid characters - %invalidCharacters = "-+*/%$&§=()[].?\"#,;!~<>|°^{}"; - %name = stripChars( %name, %invalidCharacters ); - - if( %name $= "" ) - %name = "Unnamed"; - - return %name; -} - -//-------------------------------------------------------------------------- -// Finds location of %word in %text, starting at %start. Works just like strPos -//-------------------------------------------------------------------------- - -function wordPos(%text, %word, %start) -{ - if (%start $= "") %start = 0; - - if (strpos(%text, %word, 0) == -1) return -1; - %count = getWordCount(%text); - if (%start >= %count) return -1; - for (%i = %start; %i < %count; %i++) - { - if (getWord( %text, %i) $= %word) return %i; - } - return -1; -} - -//-------------------------------------------------------------------------- -// Finds location of %field in %text, starting at %start. Works just like strPos -//-------------------------------------------------------------------------- - -function fieldPos(%text, %field, %start) -{ - if (%start $= "") %start = 0; - - if (strpos(%text, %field, 0) == -1) return -1; - %count = getFieldCount(%text); - if (%start >= %count) return -1; - for (%i = %start; %i < %count; %i++) - { - if (getField( %text, %i) $= %field) return %i; - } - return -1; -} - -//-------------------------------------------------------------------------- -// returns the text in a file with "\n" at the end of each line -//-------------------------------------------------------------------------- - -function loadFileText( %file) -{ - %fo = new FileObject(); - %fo.openForRead(%file); - %text = ""; - while(!%fo.isEOF()) - { - %text = %text @ %fo.readLine(); - if (!%fo.isEOF()) %text = %text @ "\n"; - } - - %fo.delete(); - return %text; -} - -function setValueSafe(%dest, %val) -{ - %cmd = %dest.command; - %alt = %dest.altCommand; - %dest.command = ""; - %dest.altCommand = ""; - - %dest.setValue(%val); - - %dest.command = %cmd; - %dest.altCommand = %alt; -} - -function shareValueSafe(%source, %dest) -{ - setValueSafe(%dest, %source.getValue()); -} - -function shareValueSafeDelay(%source, %dest, %delayMs) -{ - schedule(%delayMs, 0, shareValueSafe, %source, %dest); -} - - -//------------------------------------------------------------------------------ -// An Aggregate Control is a plain GuiControl that contains other controls, -// which all share a single job or represent a single value. -//------------------------------------------------------------------------------ - -// AggregateControl.setValue( ) propagates the value to any control that has an -// internal name. -function AggregateControl::setValue(%this, %val, %child) -{ - for(%i = 0; %i < %this.getCount(); %i++) - { - %obj = %this.getObject(%i); - if( %obj == %child ) - continue; - - if(%obj.internalName !$= "") - setValueSafe(%obj, %val); - } -} - -// AggregateControl.getValue() uses the value of the first control that has an -// internal name, if it has not cached a value via .setValue -function AggregateControl::getValue(%this) -{ - for(%i = 0; %i < %this.getCount(); %i++) - { - %obj = %this.getObject(%i); - if(%obj.internalName !$= "") - { - //error("obj = " @ %obj.getId() @ ", " @ %obj.getName() @ ", " @ %obj.internalName ); - //error(" value = " @ %obj.getValue()); - return %obj.getValue(); - } - } -} - -// AggregateControl.updateFromChild( ) is called by child controls to propagate -// a new value, and to trigger the onAction() callback. -function AggregateControl::updateFromChild(%this, %child) -{ - %val = %child.getValue(); - if(%val == mCeil(%val)){ - %val = mCeil(%val); - }else{ - if ( %val <= -100){ - %val = mCeil(%val); - }else if ( %val <= -10){ - %val = mFloatLength(%val, 1); - }else if ( %val < 0){ - %val = mFloatLength(%val, 2); - }else if ( %val >= 1000){ - %val = mCeil(%val); - }else if ( %val >= 100){ - %val = mFloatLength(%val, 1); - }else if ( %val >= 10){ - %val = mFloatLength(%val, 2); - }else if ( %val > 0){ - %val = mFloatLength(%val, 3); - } - } - %this.setValue(%val, %child); - %this.onAction(); -} - -// default onAction stub, here only to prevent console spam warnings. -function AggregateControl::onAction(%this) -{ -} - -// call a method on all children that have an internalName and that implement the method. -function AggregateControl::callMethod(%this, %method, %args) -{ - for(%i = 0; %i < %this.getCount(); %i++) - { - %obj = %this.getObject(%i); - if(%obj.internalName !$= "" && %obj.isMethod(%method)) - eval(%obj @ "." @ %method @ "( " @ %args @ " );"); - } - -} - -//------------------------------------------------------------------------------ -// Altered Version of TGB's QuickEditDropDownTextEditCtrl -//------------------------------------------------------------------------------ -function QuickEditDropDownTextEditCtrl::onRenameItem( %this ) -{ -} - -function QuickEditDropDownTextEditCtrl::updateFromChild( %this, %ctrl ) -{ - if( %ctrl.internalName $= "PopUpMenu" ) - { - %this->TextEdit.setText( %ctrl.getText() ); - } - else if ( %ctrl.internalName $= "TextEdit" ) - { - %popup = %this->PopupMenu; - %popup.changeTextById( %popup.getSelected(), %ctrl.getText() ); - %this.onRenameItem(); - } -} - -// Writes out all script functions to a file. -function writeOutFunctions() -{ - new ConsoleLogger(logger, "scriptFunctions.txt", false); - dumpConsoleFunctions(); - logger.delete(); -} - -// Writes out all script classes to a file. -function writeOutClasses() -{ - new ConsoleLogger(logger, "scriptClasses.txt", false); - dumpConsoleClasses(); - logger.delete(); -} - -// -function compileFiles(%pattern) -{ - %path = filePath(%pattern); - - %saveDSO = $Scripts::OverrideDSOPath; - %saveIgnore = $Scripts::ignoreDSOs; - - $Scripts::OverrideDSOPath = %path; - $Scripts::ignoreDSOs = false; - %mainCsFile = makeFullPath("main.cs"); - - for (%file = findFirstFileMultiExpr(%pattern); %file !$= ""; %file = findNextFileMultiExpr(%pattern)) - { - // we don't want to try and compile the primary main.cs - if(%mainCsFile !$= %file) - compile(%file, true); - } - - $Scripts::OverrideDSOPath = %saveDSO; - $Scripts::ignoreDSOs = %saveIgnore; - -} - -function displayHelp() -{ - // Notes on logmode: console logging is written to console.log. - // -log 0 disables console logging. - // -log 1 appends to existing logfile; it also closes the file - // (flushing the write buffer) after every write. - // -log 2 overwrites any existing logfile; it also only closes - // the logfile when the application shuts down. (default) - - error( - "Torque Demo command line options:\n"@ - " -log Logging behavior; see main.cs comments for details\n"@ - " -game Reset list of mods to only contain \n"@ - " Works like the -game argument\n"@ - " -dir Add to list of directories\n"@ - " -console Open a separate console\n"@ - " -jSave Record a journal\n"@ - " -jPlay Play back a journal\n"@ - " -help Display this help message\n" - ); -} - -// Execute startup scripts for each mod, starting at base and working up -function loadDir(%dir) -{ - pushback($userDirs, %dir, ";"); - - if (isScriptFile(%dir @ "/main.cs")) - exec(%dir @ "/main.cs"); -} - -function loadDirs(%dirPath) -{ - %dirPath = nextToken(%dirPath, token, ";"); - if (%dirPath !$= "") - loadDirs(%dirPath); - - if(exec(%token @ "/main.cs") != true) - { - error("Error: Unable to find specified directory: " @ %token ); - $dirCount--; - } -} - -//------------------------------------------------------------------------------ -// Utility remap functions: -//------------------------------------------------------------------------------ - -function ActionMap::copyBind( %this, %otherMap, %command ) -{ - if ( !isObject( %otherMap ) ) - { - error( "ActionMap::copyBind - \"" @ %otherMap @ "\" is not an object!" ); - return; - } - - %bind = %otherMap.getBinding( %command ); - if ( %bind !$= "" ) - { - %device = getField( %bind, 0 ); - %action = getField( %bind, 1 ); - %flags = %otherMap.isInverted( %device, %action ) ? "SDI" : "SD"; - %deadZone = %otherMap.getDeadZone( %device, %action ); - %scale = %otherMap.getScale( %device, %action ); - %this.bind( %device, %action, %flags, %deadZone, %scale, %command ); - } -} - -//------------------------------------------------------------------------------ -function ActionMap::blockBind( %this, %otherMap, %command ) -{ - if ( !isObject( %otherMap ) ) - { - error( "ActionMap::blockBind - \"" @ %otherMap @ "\" is not an object!" ); - return; - } - - %bind = %otherMap.getBinding( %command ); - if ( %bind !$= "" ) - %this.bind( getField( %bind, 0 ), getField( %bind, 1 ), "" ); -} - -//Dev helpers -/// Shortcut for typing dbgSetParameters with the default values torsion uses. -function dbgTorsion() -{ - dbgSetParameters( 6060, "password", false ); -} - -/// Reset the input state to a default of all-keys-up. -/// A helpful remedy for when Torque misses a button up event do to your breakpoints -/// and can't stop shooting / jumping / strafing. -function mvReset() -{ - for ( %i = 0; %i < 6; %i++ ) - setVariable( "mvTriggerCount" @ %i, 0 ); - - $mvUpAction = 0; - $mvDownAction = 0; - $mvLeftAction = 0; - $mvRightAction = 0; - - // There are others. -} - -//Persistance Manager tests - -new PersistenceManager(TestPManager); - -function runPManTest(%test) -{ - if (!isObject(TestPManager)) - return; - - if (%test $= "") - %test = 100; - - switch(%test) - { - case 0: - TestPManager.testFieldUpdates(); - case 1: - TestPManager.testObjectRename(); - case 2: - TestPManager.testNewObject(); - case 3: - TestPManager.testNewGroup(); - case 4: - TestPManager.testMoveObject(); - case 5: - TestPManager.testObjectRemove(); - case 100: - TestPManager.testFieldUpdates(); - TestPManager.testObjectRename(); - TestPManager.testNewObject(); - TestPManager.testNewGroup(); - TestPManager.testMoveObject(); - TestPManager.testObjectRemove(); - } -} - -function TestPManager::testFieldUpdates(%doNotSave) -{ - // Set some objects as dirty - TestPManager.setDirty(AudioGui); - TestPManager.setDirty(AudioSim); - TestPManager.setDirty(AudioMessage); - - // Alter some of the existing fields - AudioEffect.isLooping = true; - AudioMessage.isLooping = true; - AudioEffect.is3D = true; - - // Test removing a field - TestPManager.removeField(AudioGui, "isLooping"); - - // Alter some of the persistent fields - AudioGui.referenceDistance = 0.8; - AudioMessage.referenceDistance = 0.8; - - // Add some new dynamic fields - AudioGui.foo = "bar"; - AudioEffect.foo = "bar"; - - // Remove an object from the dirty list - // It shouldn't get updated in the file - TestPManager.removeDirty(AudioEffect); - - // Dirty an object in another file as well - TestPManager.setDirty(WarningMaterial); - - // Update a field that doesn't exist - WarningMaterial.glow[0] = true; - - // Drity another object to test for crashes - // when a dirty object is deleted - TestPManager.setDirty(SFXPausedSet); - - // Delete the object - SFXPausedSet.delete(); - - // Unless %doNotSave is set (by a batch/combo test) - // then go ahead and save now - if (!%doNotSave) - TestPManager.saveDirty(); -} - -function TestPManager::testObjectRename(%doNotSave) -{ - // Flag an object as dirty - if (isObject(AudioGui)) - TestPManager.setDirty(AudioGui); - else if (isObject(AudioGuiFoo)) - TestPManager.setDirty(AudioGuiFoo); - - // Rename it - if (isObject(AudioGui)) - AudioGui.setName(AudioGuiFoo); - else if (isObject(AudioGuiFoo)) - AudioGuiFoo.setName(AudioGui); - - // Unless %doNotSave is set (by a batch/combo test) - // then go ahead and save now - if (!%doNotSave) - TestPManager.saveDirty(); -} - -function TestPManager::testNewObject(%doNotSave) -{ - // Test adding a new named object - new SFXDescription(AudioNew) - { - volume = 0.5; - isLooping = true; - channel = $GuiAudioType; - foo = 2; - }; - - // Flag it as dirty - TestPManager.setDirty(AudioNew, "core/scripts/client/audio.cs"); - - // Test adding a new unnamed object - %obj = new SFXDescription() - { - volume = 0.75; - isLooping = true; - bar = 3; - }; - - // Flag it as dirty - TestPManager.setDirty(%obj, "core/scripts/client/audio.cs"); - - // Test adding an "empty" object - new SFXDescription(AudioEmpty); - - TestPManager.setDirty(AudioEmpty, "core/scripts/client/audio.cs"); - - // Unless %doNotSave is set (by a batch/combo test) - // then go ahead and save now - if (!%doNotSave) - TestPManager.saveDirty(); -} - -function TestPManager::testNewGroup(%doNotSave) -{ - // Test adding a new named SimGroup - new SimGroup(TestGroup) - { - foo = "bar"; - - new SFXDescription(TestObject) - { - volume = 0.5; - isLooping = true; - channel = $GuiAudioType; - foo = 1; - }; - new SimGroup(SubGroup) - { - foo = 2; - - new SFXDescription(SubObject) - { - volume = 0.5; - isLooping = true; - channel = $GuiAudioType; - foo = 3; - }; - }; - }; - - // Flag this as dirty - TestPManager.setDirty(TestGroup, "core/scripts/client/audio.cs"); - - // Test adding a new unnamed SimGroup - %group = new SimGroup() - { - foo = "bar"; - - new SFXDescription() - { - volume = 0.75; - channel = $GuiAudioType; - foo = 4; - }; - new SimGroup() - { - foo = 5; - - new SFXDescription() - { - volume = 0.75; - isLooping = true; - channel = $GuiAudioType; - foo = 6; - }; - }; - }; - - // Flag this as dirty - TestPManager.setDirty(%group, "core/scripts/client/audio.cs"); - - // Test adding a new unnamed SimSet - %set = new SimSet() - { - foo = "bar"; - - new SFXDescription() - { - volume = 0.75; - channel = $GuiAudioType; - foo = 7; - }; - new SimGroup() - { - foo = 8; - - new SFXDescription() - { - volume = 0.75; - isLooping = true; - channel = $GuiAudioType; - foo = 9; - }; - }; - }; - - // Flag this as dirty - TestPManager.setDirty(%set, "core/scripts/client/audio.cs"); - - // Unless %doNotSave is set (by a batch/combo test) - // then go ahead and save now - if (!%doNotSave) - TestPManager.saveDirty(); -} - -function TestPManager::testMoveObject(%doNotSave) -{ - // First add a couple of groups to the file - new SimGroup(MoveGroup1) - { - foo = "bar"; - - new SFXDescription(MoveObject1) - { - volume = 0.5; - isLooping = true; - channel = $GuiAudioType; - foo = 1; - }; - - new SimSet(SubGroup1) - { - new SFXDescription(SubObject1) - { - volume = 0.75; - isLooping = true; - channel = $GuiAudioType; - foo = 2; - }; - }; - }; - - // Flag this as dirty - TestPManager.setDirty(MoveGroup1, "core/scripts/client/audio.cs"); - - new SimGroup(MoveGroup2) - { - foo = "bar"; - - new SFXDescription(MoveObject2) - { - volume = 0.5; - isLooping = true; - channel = $GuiAudioType; - foo = 3; - }; - }; - - // Flag this as dirty - TestPManager.setDirty(MoveGroup2, "core/scripts/client/audio.cs"); - - // Unless %doNotSave is set (by a batch/combo test) - // then go ahead and save now - if (!%doNotSave) - TestPManager.saveDirty(); - - // Set them as dirty again - TestPManager.setDirty(MoveGroup1); - TestPManager.setDirty(MoveGroup2); - - // Give the subobject an new value - MoveObject1.foo = 4; - - // Move it into the other group - MoveGroup1.add(MoveObject2); - - // Switch the other subobject - MoveGroup2.add(MoveObject1); - - // Also add a new unnamed object to one of the groups - %obj = new SFXDescription() - { - volume = 0.75; - isLooping = true; - bar = 5; - }; - - MoveGroup1.add(%obj); - - // Unless %doNotSave is set (by a batch/combo test) - // then go ahead and save now - if (!%doNotSave) - TestPManager.saveDirty(); -} - -function TestPManager::testObjectRemove(%doNotSave) -{ - TestPManager.removeObjectFromFile(AudioSim); -} - -//Game Object management -function findGameObject(%name) -{ - //find all GameObjectAssets - %assetQuery = new AssetQuery(); - if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset")) - return 0; //if we didn't find ANY, just exit - - %count = %assetQuery.getCount(); - - for(%i=0; %i < %count; %i++) - { - %assetId = %assetQuery.getAsset(%i); - - %assetName = AssetDatabase.getAssetName(%assetId); - - if(%assetName $= %name) - { - %gameObjectAsset = AssetDatabase.acquireAsset(%assetId); - - %assetQuery.delete(); - return %gameObjectAsset; - } - } - - %assetQuery.delete(); - return 0; -} - -function spawnGameObject(%name, %addToMissionGroup) -{ - if(%addToMissionGroup $= "") - %addToMissionGroup = true; - - //First, check if this already exists in our GameObjectPool - if(isObject(GameObjectPool)) - { - %goCount = GameObjectPool.countKey(%name); - - //if we have some already in the pool, pull it out and use that - if(%goCount != 0) - { - %goIdx = GameObjectPool.getIndexFromKey(%name); - %go = GameObjectPool.getValue(%goIdx); - - %go.setHidden(false); - %go.setScopeAlways(); - - if(%addToMissionGroup == true) //save instance when saving level - MissionGroup.add(%go); - else // clear instance on level exit - MissionCleanup.add(%go); - - //remove from the object pool's list - GameObjectPool.erase(%goIdx); - - return %go; - } - } - - //We have no existing pool, or no existing game objects of this type, so spawn a new one - - %gameObjectAsset = findGameObject(%name); - - if(isObject(%gameObjectAsset)) - { - %newSGOObject = TamlRead(%gameObjectAsset.TAMLFilePath); - - if(%addToMissionGroup == true) //save instance when saving level - MissionGroup.add(%newSGOObject); - else // clear instance on level exit - MissionCleanup.add(%newSGOObject); - - return %newSGOObject; - } - - return 0; -} - -function saveGameObject(%name, %tamlPath, %scriptPath) -{ - %gameObjectAsset = findGameObject(%name); - - //find if it already exists. If it does, we'll update it, if it does not, we'll make a new asset - if(isObject(%gameObjectAsset)) - { - %assetID = %gameObjectAsset.getAssetId(); - - %gameObjectAsset.TAMLFilePath = %tamlPath; - %gameObjectAsset.scriptFilePath = %scriptPath; - - TAMLWrite(%gameObjectAsset, AssetDatabase.getAssetFilePath(%assetID)); - AssetDatabase.refreshAsset(%assetID); - } - else - { - //Doesn't exist, so make a new one - %gameObjectAsset = new GameObjectAsset() - { - assetName = %name @ "Asset"; - gameObjectName = %name; - TAMLFilePath = %tamlPath; - scriptFilePath = %scriptPath; - }; - - //Save it alongside the taml file - %path = filePath(%tamlPath); - - TAMLWrite(%gameObjectAsset, %path @ "/" @ %name @ ".asset.taml"); - AssetDatabase.refreshAllAssets(true); - } -} - -//Allocates a number of a game object into a pool to be pulled from as needed -function allocateGameObjects(%name, %amount) -{ - //First, we need to make sure our pool exists - if(!isObject(GameObjectPool)) - { - new ArrayObject(GameObjectPool); - } - - //Next, we loop and generate our game objects, and add them to the pool - for(%i=0; %i < %amount; %i++) - { - %go = spawnGameObject(%name, false); - - //When our object is in the pool, it's not "real", so we need to make sure - //that we don't ghost it to clients untill we actually spawn it. - %go.clearScopeAlways(); - - //We also hide it, so that we don't 'exist' in the scene until we spawn - %go.hidden = true; - - //Lastly, add us to the pool, with the key being our game object type - GameObjectPool.add(%name, %go); - } -} - -function Entity::delete(%this) -{ - //we want to intercept the delete call, and add it to our GameObjectPool - //if it's a game object - if(%this.gameObjectAsset !$= "") - { - %this.setHidden(true); - %this.clearScopeAlways(); - - if(!isObject(GameObjectPool)) - { - new ArrayObject(GameObjectPool); - } - - GameObjectPool.add(%this.gameObjectAsset, %this); - - %missionSet = %this.getGroup(); - %missionSet.remove(%this); - } - else - { - %this.superClass.delete(); - } -} - -function clearGameObjectPool() -{ - if(isObject(GameObjectPool)) - { - %count = GameObjectPool.count(); - - for(%i=0; %i < %count; %i++) - { - %go = GameObjectPool.getValue(%i); - - %go.superClass.delete(); - } - - GameObjectPool.empty(); - } -} - -// -function switchCamera(%client, %newCamEntity) -{ - if(!isObject(%client) || !isObject(%newCamEntity)) - return error("SwitchCamera: No client or target camera!"); - - %cam = %newCamEntity.getComponent(CameraComponent); - - if(!isObject(%cam)) - return error("SwitchCamera: Target camera doesn't have a camera behavior!"); - - //TODO: Cleanup clientOwner for previous camera! - if(%cam.clientOwner == 0 || %cam.clientOwner $= "") - %cam.clientOwner = 0; - - %cam.scopeToClient(%client); - %cam.setDirty(); - - %client.setCameraObject(%newCamEntity); - %client.setControlCameraFov(%cam.FOV); - - %client.camera = %newCamEntity; -} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/images/AreaMap33.dds b/Templates/BaseGame/game/core/images/AreaMap33.dds deleted file mode 100644 index e01982a94528594a375ae6e61c44780a8e1c0b68..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 109028 zcmeI5iFZ_0wuhNfX$3`^L4AY}f-Hm>Xh5K`9}tMZLI^Ab84N>Ylu2fN|IYh6-}}Bw zcDP(BWU8uj2UP(;v<48Z{Gf$v}=tOI*XXYs`_r*&BzL4@;I&oE;IoO1@@ z-_Q@=g7eNAu(w_h~o^*6)9TxpEUY z?^wgX0B4?$V9x2XID)9=v0h?^AFEw~GvMcp*6%&g2j)umhN6bsTRQWo%Q^MgcyR;~ z&0`sgdoT>nIrfx?z`aWMg(6ov?^wfEf&cqtXCC)1=Zr3kBZy`m%TW9Q*Weehr}Q(O z1K_L^xzfF%Z(t3$Kjh3ar*v5yK}7RduQ202xJP*bPJw$u*6$x+2W$oZ_ZeN_=Z>qv z-qM-JS=>GK_dZ`1M-at4mZ5k6H{c?;cYX}4-}}K?XFF^GbEWf6)Np%CXP!Bs%i;(k zna7Gyj9|_sI1Bca17Q7j*6D}HmF^8i4R?R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7=An=F^6AE@B~`fPo(?DehjuVqkZ;PxhnZ{OLDSfeu3#_K1p`Aj*s{N4Y4{ z!Vgv1zJ2Bjd#gAhevIGrZ=#E)VAG5h=KdYzV5QXMl30nQY1b;`M={Kt($ZnIP4?Q4 z^#HPE55#6xuH@fDLh#b5n26`qXHkXWKL(8#uAdw-*r!UfahzaO7fKhawG4TQiHV!Q zc3brQ^Kww4V_(mc!xQ5+=;3Z&+s!JbMt{tC?PZ3mB$xg_rge$j7%KneTdQ2v7dh5U z6Q*s?&k>5`DV3&P93=JZWzRxZw-IFhehInIP~D$XDW-KqUO$)R)~Z-K$xG{4B@FE% zFCR>V()tJg6J#phqAh$Sb7;|f5wHQg_$cedz#H@hg({hs-; z_*3YUg*@kswbl*&a|M9owN#|nX$w%n+6vy~IJ3^3%`IIj?oN2+_y^Wn@VntaP}lFe z&0k-M(GzHl=SYO1eK&6z=AcxyG>A|ipMz7QxcyRMoIiRFg|7aJx^_ft9$#yL@azb0 RBF+E+002ovPDHLkV1nj@91s8i diff --git a/Templates/BaseGame/game/core/images/caustics_2.png b/Templates/BaseGame/game/core/images/caustics_2.png deleted file mode 100644 index 99097fa0ed112c28958363f2951478a0955218ec..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33963 zcmXt91yGw^(+y53?yfEF?$Dy8g%+3M!L7Kv7cIrzrC6ZAi$fsA-5r9v75D$?H}i+d z1Tq8M+}(Tk>^Wz@e^F7u!XU>0fk0Rv6lK*wAOzrB1Q0qZ@S^WrW&ymQntoJ}1-<{B*J+^mJH=Z0)c2jA7tNYcrK2# zpW1?TQ{H+T>If3!6Vtt)H{*UsobAdZM{S;@binkkX7PQ?*DS}=_aD3F>&8Z8hY`-k&jPI zObj`_d$F{%guQ%LQ3-#^&B?(Y>lr)yw*7GD>wi|~ak@$+etLJ;oSmKBu)Dh(V!IJ= z=OQ5~`CngO-}U3;vctD;Oa7fS{@1s+^Vbi4KK}mHIUxb(k+Vv3;dAJ7qld2U?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MTK}-Fugso}?zYZak*Fh&jFFg>q8;VCG)>@d};1@yMJ#Msun!mnt*H zT}_U`Jcu?`IY)=rYdQq?hB)c#$^4fcIX>A8JO`n9Unb!k-KfpL>t?_6vRD~ty zI`z^`%QC1ps2GHdxeR1u`OES?&b#->z-&qrb9|)p*W2^vQ3x&8)0}QDQ_2s6c`q%d z2?{OHd-8q3L_1nAcsKKVaD`@nLdoLUvJtrn$ni7}{15!@``@5(`}uS!^hUcA>8twJ zKyCH!rfv43R%KZkPmh>PYpHyl)5*a$t~upzVimJ|Y95SKIW`K_{pZf%{~3LLL%xlU&$iTp;`M%rCDs{K4s{ zreRM&rh^Sz1dfj{(X%-qoY6kadboymM_%SabQ#?(#)R)tHBrbU^nq}{>?}Srq;jcz z{Au-Z8@0JYkvcPblir5GY|9c) zT0hc)Q89O(Jz`07Vj(OrOx(a|8f~!;rq3jcFK|ns9|1Pbv%o0x`>vSasOW}5*ZNkx wPx6^^W}6!C?24m_)Od^3pro&j&sU!PHBsYjs7~_SLBQ81DMiWhkA{K&2MO=rQ2+n{ diff --git a/Templates/BaseGame/game/core/images/checkbox.png b/Templates/BaseGame/game/core/images/checkbox.png deleted file mode 100644 index 46e0ac959fc26d224015f316df050c2f137af4d0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3943 zcmZuzc|25Y*gp0x3}Z=&AtF1;79rAP-!jNDl2Di_WF0g1HKD9w?4nnaWNQprBgU3e zLYC~i7-N}lruY5*zVDCkk8_^q+|P4g=X$RDzRvH&o15NXXFbCT008?6x2*Ap8)%9tb4lrk)-I`3P~()5{G20&{aS0<5jZ`C)ELXhV>{HfzWs?B~!vRsd2ql|mzS}alL-(@XIMsKQqBI5idZJW}m2Y zwwEf2!PEqJ}0exX&`yMPTn;m#l=2kaOiuLy7 z1sqps%$tv6`{D9H!rK;q4%9=Trcfu#ju{zu=~ojI4n{QC2N&fRH%M3xw4QS)!LsG& z#=J}5&NH<%KSez!RiAsoW%?aG12f2jQ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}+IFh;`ZjrN|Ec_+o_|pd=P64WSW4ESHHTC$ypW;+y_Nb)j}|m}lI+@@{IQS1 zgCZ*yFe|3ea;< zEge8{qB($5W^=atDR~Ny?vB^phWJDN05nlW@u2@28>@}x{@d948UOl%fk!OruNMlJ zzMB2p=PAm^qJRAnCqu0Qb)%^Cb$}j3Cn+0#8Uki^`PX>=wxzS5z#a!@^F;V2R|&zU>Vi_MX3m8=ee-7ki2fzW?yy138vc zm@#t=#QxHg^Ir;>BihQRI*!73*?XvPAyQ1yqJxbMmg+h{YPu-3QLQ;ZaA2H6C#g8Q S3QYOT0XMIk>c74QkN6*F=2BAt diff --git a/Templates/BaseGame/game/core/images/group-border.png b/Templates/BaseGame/game/core/images/group-border.png deleted file mode 100644 index 61234ae1fb3dee29eda38a371165d36b060ee426..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1273 zcmVRq)0SqBM&U{ zK~RE8k;)fTv@rNVFsUphN-&N10jmTOk|LETicKV_m54TpVAK!`|L<7|`4E(7K4ARB zDus5>J(HaE?!4W7v&qH}czMI@+&44#&Ye5=o}G2_O1ZzkpGs6d@8oj17WcW!E!8%I zG7SwXm(AMBn08BdCX>0T948-RoKK$0X0t6*Q&aiH#l^fexw~LXm>2UyPMmS3yc8^% zPN&txvs=#V2iKgriKmXs^9tJFqjWWIBOj#Opr!-61IK}Xx1-s?{L4G0_&?_ilXv4x zqfZ_btu8MwSK|-wsQY~v)cnk(&+H?8J(|C{sz$fn!M^&){#~l$>@n5f-deC_;MX2J zsxZHFtA)8SUGF$_vOr$N_B~qGz~m2~oD@4WwsorNs!FYtyCThVSEZ(BX4T=g^Lm1w z!FRq%(Y|`AS3jc65Sso~f)<#1w-6X-QZF0;z1&IJw>OAO*=w$5nIM949%2g^Yzljy(oWy)Hf= zKP~7s_`nZIkS{YqF~l(je$;4#Z=xBAo(3O1_wqgCBii5tJte9r;~AA?zGq4`(Ts_n zWQL)#a^A!gm6r6qM+nP?0Sc)kNm@4Xtw-=SGYrxowl6GaQ(5@5B&1Y;X$f*x_i`5k zxlG?JMp&eYe3Cfrf#}H=#@X;~|BtO`5XzBM3_XQWv3X-F3LkUd8np$mW$;ZD@}tlb z@grOWzKMePX$!hz`6y0z95fS#p0K!L8Eqx>`_a=%75$H%65feFik{-gOB_87-@a&t zo=kbNraT|vFoAMIeOeI8_0#*bHBgfWlms3M{F=|;vk&HAk-V?7qf70j+dSQteXuCB zxme0WXRY7zZQiQU6W{Gki*a6ad*$6z80sP_3%q+`TtsI83dY1J6eRh$8vuYoz-JP{ zd_mbs-aVmUVdndNBq%XE#kqTuz$8gP5_U;MoS^NwxEOTzWZpMPmn%SJ z?(zSC4+0292nh@kvId`u$uPqZCPNED8bgi@LmbC`Ql1P|ln1?_pHA~@{Z%BXuPKfW j%4_?bDUt6}KLr>7B{DrC{G$C100000NkvXXu0mjfaJE^D diff --git a/Templates/BaseGame/game/core/images/inactive-overlay.png b/Templates/BaseGame/game/core/images/inactive-overlay.png deleted file mode 100644 index feab83209cc442c5ad8dc73c2b86e0a8115c4743..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 131 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE;=WQl7;NpOBzNqJ&XDuZK6ep0G} zXKrG8YEWuoN@d~6R2!foRZkbkkcwMLfBw9D?8~Obq{gPz9LVg>D`Q%4bP0l+XkKL$W0) diff --git a/Templates/BaseGame/game/core/images/loadingbar.png b/Templates/BaseGame/game/core/images/loadingbar.png deleted file mode 100644 index 34f5944030dce5a174233bcef11b7d7210bbeac8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 635 zcmV->0)+jEP)X1^@s6jP_Wj0000PbVXQnQ*UN; zcVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBU!9Z5t%RCwC#SUXO`KoDI!c0P`hC>MZ^ z3Q^J_B?TOUQy@A{K+7q(h9e;wN-Csu93WES#QFHMyfI$OxSov|DWj}**K*#opXal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fo9{nagOX9mjU# z4ZJ7-D24qK=wtDY9lMNa+~mo93;s~&h8n*ed%@zFIxN$e$3vCPR5&=E+dfX_BH79G zAL7O_jth7-xQ9~H=27B)BJb7d^5=P1Y7|AY-P)ano=p@I+IW(K)D-bnND6OlyFjse z3=O&qiH_s&a$W`V(<12K+=d5xE}}EA7UPZO#QZH8#l zXaqaEqrvnO-j2)17fB)bx$Q&cC1c!DP(!v$8%m39u_y2lj)x7#@LYjv58V!lBlGZQ zcOP`cmOyEH8}{fefKs6ogvX`g==O!EbJ>gFd{=C$Iu0#^04(sRL8Rwq=mf;zS!)5T z=l;fns0*-&-j8aWhFw!FI!X;8F7ge(#xKCP#jCMHu?go~?n1wNGPeCozz>&X3>WW% z$jX;)XsfYdY;jzdEpAUV5j@1IRjg!VO z0|`t!cMc!lreIn5U--%{!8dPDyfZ$B+jmbuWZ*~W9SahKoUJfS48r_O16++l zPnwwTM`-Va%1V@TU+ zP0V{%%ak@JhD%RlFxs3fKQVtGntklu5JR@I>BQih3;N+y-OT>dj|Cb{-#| z?523~R>r$aP-M+oPPsmYRsteh@=%n!ul6w~uAaJ$Yk0g`l?ijCxzlY3<(@e(Pkt4z zyw+#U{s!vkMzGrS1@)#Cuy^wnj!C`24-rlRt2Ly3sXjX=ZsjhQU)uZ>J(3=xOl(0QP-!(>N?>&;S4c07*qo IM6N<$f@#CI-2eap diff --git a/Templates/BaseGame/game/core/images/null_color_ramp.png b/Templates/BaseGame/game/core/images/null_color_ramp.png deleted file mode 100644 index 5f5a52186eb93cb7ace739e645e5e8f8e6b8050d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2843 zcmV+$3*_{PP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvY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$n>MSVv_3!WR xqwIV#4BRgm4JXvHMKX&S7St`!IKaTf!=UB9TBWi;$P?&J22WQ%mvv4FO#lthVzU4M diff --git a/Templates/BaseGame/game/core/images/thumbHighlightButton.png b/Templates/BaseGame/game/core/images/thumbHighlightButton.png deleted file mode 100644 index 9d83b75f31b965b79ff082e3a0f6e37e4c757c1b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 778 zcmV+l1NHogP)^%4Aj<$I1_}WqRRR$d z1~4y>8i*8ofd!i&&^88q;$hSbL@LC>f3!$o1Vs!3BNnyT#Q(FzWmcoc0=>O348mYE z7Di)XG#${gULYk9sZ%c;*}t7K1LT!85hAQlXK)Rq9_nInN)!ayOp3q3h5+?ZB@mfF0rU0$f5zPxzJM_-aIs(% zaacePd~O^y0Gb=Qf!I}_n|uR62^f})T}Q)U#D)ReA_iudz%LMg;eTdyg}>q%QN>TK zMd@&GqN(S^VIe239t#(mI2R5BxNsT3gC@>{!vG#!2JoSY^WiXn50?SFXyUv$4B(}@ z3n;D^SU}}Ft66XpQhe_P#$P)N-;>uu0ogpTEtG2ypD`}kb`^|A zTPQ=eg`y=V3C3g_aP84^23RtV84ZIG8wR5-l+hN-XbXi3Efk;Vaufm3qytH#c_6Z< zE(Ia9w3GDg3<4Lg-UZX@LvA#W$v3*3@#f9jjG!4Dq}d&UEfkp8X#0Q~5|tAdDOXK#LK`1pomC0NWAfc{C??-~a#s07*qo IM6N<$f>^aj6#xJL diff --git a/Templates/BaseGame/game/core/images/unavailable.png b/Templates/BaseGame/game/core/images/unavailable.png deleted file mode 100644 index 9d818a3765d48243dea04cf3d9a43e54b1b74bac..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 26528 zcmd42cQjn#+b%o>(Mxm^glN$_Nid?fAR?mo-Xe%@CZd;!AZqk3N{C(ti4sJK-lIj& z=!RkDY`^!9bN)JKecyY&wZ663EX(Zu?7KbJecjg+t@~7!jF^cS1Okz%t0_GLfgr%I z5D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QeR5Ydm(i`TneESn$d*r}sPM{7n11J8#j=DGt7k|#_KDbA?#S5gm*-8$0 z6vV2D?5Ez~*e^X0)A%??mOK-b%z7HfCaZ&L%riz7V9$+=5#R4qGU%5)Ck!zvUV>dT z6;YxH@%w9akm)x?(Kj>n3)5)9I$smUawCb>x3QeR@YQcmD4=hx$YC$he7T7~oXuRp zmZQ^&Ind5fp+5SXu=SO-qIl)Ni#%Y;k)kndF&w+o-{x5?l^G<9h$i@z5UzdWU58m- zgYfD6bM6ErhkMDnuL;Epd{)898ULFWYRz-B%CmJ@_hdZfd%3~`RmT4qI38Yg6POid zBb9F-#lZ{OQ^~Y-y^=d7O6UD_w_Y8VHU&a^>rYBNVm;5i_1f=$GQeO16s^Gud(#5) zq<{p|OpiXZ+7Sy=myMHyK(5^%z(IWdVRrqI^$#4Jufh}r7;tVh`hUNG;s~_bzySc0 z|2hW5$Kd$Cy=TJg`b+=%tN+vS|NgB0^X2{P-~adH{|{Hy`p@%mNe l814Vh^#9YDKE&YBKxnPL?nJ&?puN6t$_nc8<+5fW{|kT=cUJ%a diff --git a/Templates/BaseGame/game/core/images/warnMat.dds b/Templates/BaseGame/game/core/images/warnMat.dds deleted file mode 100644 index ea99dcbd74a8b2ae49c5cff5a69743498a66e937..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 699192 zcmeFaPi$M+p67Q(#Rw%q$lVCxuCM)|w4M~V{T2fJ7L9l5=?1EHs%~9T&ZsR?vxyfI zsJbygxsX^C8(DbKi&_Xl?Ia2f*klZ%fGCLvqZVm(77oyhDio(NUSwqH4PbCKf$})> zK(x$!f9LR!6h(@c5=l|gmq67qMe^Qr&pE%(@6Y+2bN=K{{@nQ=Ez9~Z?NQ76FYpif z&kD-_tTFX}|NnFFRr&d!EYAO`*{_1Od*;t>$tlSnS+X5C4k!oY069PokOSlZIY17O z1LOcXKn{=tbP?mEh4x0G{HM%>a}6jFwRD81ID`aV8azt6j+Y!2Ta>0>S?>#-q__zuK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pE!#}H(MyEs=xP3H9bu}Q_gvmJ9nu~a2Sn!27e2BVQ7ck6R+_! raGdj4Z)`w+6{m>%2LJK#4dUl7PN}gm$ggc?divbC*=z9`o}2kEfiE*! diff --git a/Templates/BaseGame/game/core/images/window.png b/Templates/BaseGame/game/core/images/window.png deleted file mode 100644 index d9e8006e473974be6c97716e9ab9abc2e0e373e3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2559 zcmZ{mYar7N8^-^0n3-mBX2X<}2W6Q#PUci744;zge=T4 z5k(9UPm0LtaSnMs-`+3phx@v&PxpuW{(ZRaS(;yjK_#I80KiNx8Co5=-qDaC;3FlQ zW&|FY1kuQzXdUE540jFj1n?d~Zk{NU09S8MD^FJs%B^>vIsm|1WMYW7A&>uZx=j!^ z5{`~wa)DqRolydXYLUCguOF_#i>-tNAG-(-mZm;X3<Rf@P<9j9v>EuN;g0EIf36edixyxLB1@M1kf)pOMx0{`p`tsOCY~Xf1u3+f$GgG( z{W^Ffc}Cwvg+0?5%9vdh6&1-iCat3pz%={M*$iSBiCVEqYe4SS-IKm=oWwXDe&K~U zSM=}rm>8;yJ5K5A?aa)Jk3%|_o*e(^gIO{dJSzaPu>_D-or6UNgGrx84Bl9VUyI8C zH0%cscg9GoOIiz#GXb~CU_D`)3PA=gmN%pQ2uK>l@C17D)3|Ad)8l*{ir~#Gv_Yfs zo;W~BVVK7E|2g0({abU$d1AtKE$vi|zZ+vKlat2OE~83Z7GI4}ZOok~y-|S7+9!X@ zm=D=V5Q&Jg{mbn!H6o%+cYR}Mbu#>`fg%W0Ws%Y~kgJC9^Y<4))LncRnij8_H!Y`i z`!_}-WEK+H9D14=csgmD>{rzE96DJrUc^*301)<#%Y3xBhkwDH6ekTOo%IvE-39*H zjXYf^ae1HB`37~rW9Ndjz13eSf5wgjE zIpfy1u2Yi+5m3N4U3D3B+5g99J?n>Xd5b6{6uL}fvGm1NTmYswrrn-{*1L48NwPEE z01Bkeb{z&U2shkYT%LF>7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ff --git a/Templates/BaseGame/game/core/gui/images/thumbHighlightButton.png b/Templates/BaseGame/game/core/gui/images/thumbHighlightButton.png new file mode 100644 index 0000000000000000000000000000000000000000..9d83b75f31b965b79ff082e3a0f6e37e4c757c1b GIT binary patch literal 778 zcmV+l1NHogP)^%4Aj<$I1_}WqRRR$d z1~4y>8i*8ofd!i&&^88q;$hSbL@LC>f3!$o1Vs!3BNnyT#Q(FzWmcoc0=>O348mYE z7Di)XG#${gULYk9sZ%c;*}t7K1LT!85hAQlXK)Rq9_nInN)!ayOp3q3h5+?ZB@mfF0rU0$f5zPxzJM_-aIs(% zaacePd~O^y0Gb=Qf!I}_n|uR62^f})T}Q)U#D)ReA_iudz%LMg;eTdyg}>q%QN>TK zMd@&GqN(S^VIe239t#(mI2R5BxNsT3gC@>{!vG#!2JoSY^WiXn50?SFXyUv$4B(}@ z3n;D^SU}}Ft66XpQhe_P#$P)N-;>uu0ogpTEtG2ypD`}kb`^|A zTPQ=eg`y=V3C3g_aP84^23RtV84ZIG8wR5-l+hN-XbXi3Efk;Vaufm3qytH#c_6Z< zE(Ia9w3GDg3<4Lg-UZX@LvA#W$v3*3@#f9jjG!4Dq}d&UEfkp8X#0Q~5|tAdDOXK#LK`1pomC0NWAfc{C??-~a#s07*qo IM6N<$f>^aj6#xJL literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/gui/images/window.png b/Templates/BaseGame/game/core/gui/images/window.png new file mode 100644 index 0000000000000000000000000000000000000000..d9e8006e473974be6c97716e9ab9abc2e0e373e3 GIT binary patch literal 2559 zcmZ{mYar7N8^-^0n3-mBX2X<}2W6Q#PUci744;zge=T4 z5k(9UPm0LtaSnMs-`+3phx@v&PxpuW{(ZRaS(;yjK_#I80KiNx8Co5=-qDaC;3FlQ zW&|FY1kuQzXdUE540jFj1n?d~Zk{NU09S8MD^FJs%B^>vIsm|1WMYW7A&>uZx=j!^ z5{`~wa)DqRolydXYLUCguOF_#i>-tNAG-(-mZm;X3<Rf@P<9j9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{MDTjuUL<@pF~5B5S$iK;7o z+_TC7Tk5p6rHSxB0=yre6ueDM5kQ}aoqn-eA3Rn#&Pje@`2hBOk-4&sKO?+w9b2kI zf0XiF#Rf z9OFU1@w$b4+)wP>PXxAyia;dYOI>f5@7&&Hga$%Zf5IZvm|*; zf3~pK*<=s;cO>?%m90~|6o;Q<_j`ykc~^v=+x$znm?FWQ-nsTVbJ$u6+QdALhzt#r z+NPg#eoN>9zpf9wv%I{VPQ~GHL~o6fvFVk$N+|XWyU>O1u=Q;I?QbJuz-n}a^${AM z>%?|}%qqt{P``v^4gO&E+0lZe+G4wxM<~G-c)jkUU3jg1K$n9*j!pS_zGvC18+9C^#c>H#^Vw*%H9!%-`$X0=Jm5( zx$=?dhd^}r$e2+D_*GumpfxP)o+iTNIa5{vW(B$n{0dE@0P<#JmY^c31Bio>z)@%n zhH7nNk;pDg^=Gutbc92GxzRNS7+O@hdiA@w56Kp~zYBE{a&y!@I`ri5J&^Gp-N#)K zVOSFpBw!R2Eg(_EKH_N*jJ;$pRV%okOe<4UcO~jAWF72ReN$Ss0*4Vw+5@<`<3wVM z9#z`d*#-6{t28DoFIU!IUSKQp3;HTTp?u1_!TUG%Be5mkInx8Pa&3uLj;dxuhCpI= z6cD9b{_veDfm2T&tui!)_J2SM(dqK4;OSXYCY0;wB~KjXyRxY3zd*ICG$o!^H~3vI zCXZoXN&PTp6a%D|T3saT*@4?`6o6IVE&s`pZ9R{7(B|^E?+tS3<50&REA#^ag$bZX zy6y5@f_$>o5MWauQY#1`Ip&|$asxC!h{w*c9Dza!+4u7*SJZpQ%oqy5eDNK=>x81x|C8J|60)fxq7JVAD}M%lR`)>ZJy36^2CCZ#Kmk2r z02YJ&Bt+U!S8K~?`ST=!_2Jd1&vwfuuz!ljIBoe)znsEX)7(XpSyX{VV9+6K^)R#3 zIiu){wbNrM8{5f!>-mVJqz2=MW9U&EE= %deskResX) || (%resY >= %deskResY)) + { + warn("Warning: The requested windowed resolution is equal to or larger than the current desktop resolution. Attempting to find a better resolution"); + + %resCount = Canvas.getModeCount(); + for (%i = (%resCount - 1); %i >= 0; %i--) + { + %testRes = Canvas.getMode(%i); + %testResX = getWord(%testRes, $WORD::RES_X); + %testResY = getWord(%testRes, $WORD::RES_Y); + %testBPP = getWord(%testRes, $WORD::BITDEPTH); + + if (%testBPP != %bpp) + continue; + + if ((%testResX < %deskResX) && (%testResY < %deskResY)) + { + // This will work as our new resolution + %resX = %testResX; + %resY = %testResY; + + warn("Warning: Switching to \"" @ %resX SPC %resY SPC %bpp @ "\""); + + break; + } + } + } + } + + $pref::Video::Resolution = %resX SPC %resY; + $pref::Video::FullScreen = %fs; + $pref::Video::BitDepth = %bpp; + $pref::Video::RefreshRate = %rate; + $pref::Video::AA = %aa; + + if (%fs == 1 || %fs $= "true") + %fsLabel = "Yes"; + else + %fsLabel = "No"; + + echo("Accepted Mode: " NL + "--Resolution : " @ %resX SPC %resY NL + "--Full Screen : " @ %fsLabel NL + "--Bits Per Pixel : " @ %bpp NL + "--Refresh Rate : " @ %rate NL + "--AA TypeXLevel : " @ %aa NL + "--------------"); + + // Actually set the new video mode + Canvas.setVideoMode(%resX, %resY, %fs, %bpp, %rate, %aa); + + commandToServer('setClientAspectRatio', %resX, %resY); + + // AA piggybacks on the AA setting in $pref::Video::mode. + // We need to parse the setting between AA modes, and then it's level + // It's formatted as AATypexAALevel + // So, FXAAx4 or MLAAx2 + if ( isObject( FXAA_PostEffect ) ) + FXAA_PostEffect.isEnabled = ( %aa > 0 ) ? true : false; +} diff --git a/Templates/BaseGame/game/core/gui/scripts/cursor.cs b/Templates/BaseGame/game/core/gui/scripts/cursor.cs new file mode 100644 index 000000000..f71bc023a --- /dev/null +++ b/Templates/BaseGame/game/core/gui/scripts/cursor.cs @@ -0,0 +1,102 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//--------------------------------------------------------------------------------------------- +// Cursor toggle functions. +//--------------------------------------------------------------------------------------------- +$cursorControlled = true; +function showCursor() +{ + if ($cursorControlled) + lockMouse(false); + Canvas.cursorOn(); +} + +function hideCursor() +{ + if ($cursorControlled) + lockMouse(true); + Canvas.cursorOff(); +} + +//--------------------------------------------------------------------------------------------- +// In the CanvasCursor package we add some additional functionality to the built-in GuiCanvas +// class, of which the global Canvas object is an instance. In this case, the behavior we want +// is for the cursor to automatically display, except when the only guis visible want no +// cursor - usually the in game interface. +//--------------------------------------------------------------------------------------------- +package CanvasCursorPackage +{ + +//--------------------------------------------------------------------------------------------- +// checkCursor +// The checkCursor method iterates through all the root controls on the canvas checking each +// ones noCursor property. If the noCursor property exists as anything other than false or an +// empty string on every control, the cursor will be hidden. +//--------------------------------------------------------------------------------------------- +function GuiCanvas::checkCursor(%this) +{ + %count = %this.getCount(); + for(%i = 0; %i < %count; %i++) + { + %control = %this.getObject(%i); + if ((%control.noCursor $= "") || !%control.noCursor) + { + showCursor(); + return; + } + } + // If we get here, every control requested a hidden cursor, so we oblige. + hideCursor(); +} + +//--------------------------------------------------------------------------------------------- +// The following functions override the GuiCanvas defaults that involve changing the content +// of the Canvas. Basically, all we are doing is adding a call to checkCursor to each one. +//--------------------------------------------------------------------------------------------- +function GuiCanvas::setContent(%this, %ctrl) +{ + Parent::setContent(%this, %ctrl); + %this.checkCursor(); +} + +function GuiCanvas::pushDialog(%this, %ctrl, %layer, %center) +{ + Parent::pushDialog(%this, %ctrl, %layer, %center); + %this.checkCursor(); +} + +function GuiCanvas::popDialog(%this, %ctrl) +{ + Parent::popDialog(%this, %ctrl); + %this.checkCursor(); +} + +function GuiCanvas::popLayer(%this, %layer) +{ + Parent::popLayer(%this, %layer); + %this.checkCursor(); +} + +}; + +activatePackage(CanvasCursorPackage); diff --git a/Templates/BaseGame/game/core/gui/scripts/fonts/Arial 10 (ansi).uft b/Templates/BaseGame/game/core/gui/scripts/fonts/Arial 10 (ansi).uft new file mode 100644 index 0000000000000000000000000000000000000000..2b564950050cfca995e66f048e0523428ff493b0 GIT binary patch literal 412 zcmZQ(U|?W%EXqvG;R3Qi07P>@F%ytx24VyN@mQf;5Dk%qsR4%?)Qy83;)lEIri7m zFZoExihWaFY>GaAyHfb_#$7>4rhD3-7VX{JcRHkY<;8EhWjEc^(!MS|x7jKnT~tu; z`y-fhfi55e9MJ#4lvSq~c?$DU2jYrb$q5Y1ZVG9@ Ja2IA^0RUczP(}a% literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/gui/scripts/fonts/Arial 12 (ansi).uft b/Templates/BaseGame/game/core/gui/scripts/fonts/Arial 12 (ansi).uft new file mode 100644 index 0000000000000000000000000000000000000000..67a177016766c6f06b5b601c3336b9fea2ac75ba GIT binary patch literal 62 jcmZQ(U|?W%EXqvG;Q_Kh07P>_F*8U23jU*ldXO*xH#ZTF literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/gui/scripts/fonts/Arial 14 (ansi).uft b/Templates/BaseGame/game/core/gui/scripts/fonts/Arial 14 (ansi).uft new file mode 100644 index 0000000000000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l6TR1+xKM6^Hb97t}y)L|5*TVNW${+Aw~ z_<)nIs`VYyU!Es2!o6Z-sk?sP*}hfb-i$2O%`3Y()8pbMiS!$fc17IOeR0;Z#bW3F b6sM#M<#jvpb9awrZFUL$u!K`tU*`B9%GMUT literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/gui/scripts/fonts/Arial 16 (ansi).uft b/Templates/BaseGame/game/core/gui/scripts/fonts/Arial 16 (ansi).uft new file mode 100644 index 0000000000000000000000000000000000000000..ec996019dfe8c0fdc39ecd2cb8f3a59021328064 GIT binary patch literal 13031 zcmc(kc|26z|G@8zH58IvnzYbJv{*tJJ+f4mo+Kiv6lKU(mL!tWrjS(jr4UjSQnp8B zUm|2rWZ&14<##{bnOE~I=HK6aJ)h3P?s4qDuql(noY@BwZRumnPGtX>@58UHXnLEul-R=u!&& zt6==qQ%~uKa|>sdTEYoOkcMCXA_%lVsFdkfe=~)$q9u0Tu@XD=-zXHuvZF%P#b_^u zf*!43j$i%b6iT&B)rAa$ATtySy|hu`Dg9Wk0s{Gps*BARdLffhDO&yIAEV3^3Nd3n z7{%rbvjAO~0SH)z2tg2JIVwP@Q9(3N$L#P>C^cTR`HNtbk3wNQtzeX&LZL;w&KMP@ zP>7wDV(Yw`LcuTXI%9M#U0otwDnpmb(WT0C=`OldlP=YvOCgI=_lUZKP+}{2kcLu! z%YIV>8p~AO-@9)@p})st?+Es8oS>@<85p91x9smdvY}8o8Sp;C1Ea9ID_R3xcsHSU z9(|z1PKq~L0}4^mTE-~k*u^R2*u^R2*u`lig;L*1c&EWXwi>Y%3N6~GppGDrV;8p! zITk3@BDI9~8$r@h0ZLs-=mV<|2ZFps1?ZoCvDJ7-p?}5jFwW@8M6#` zGoTBYap?|IwcFN9CC~Z`~ zbs-}WP@$#ZAG3UkLa8&MmY8J^3WXNzAT^s|)QdtFw(LWpREyLS)4fiiuxk(rP$;qU z>yOq5s4TpaL3C*d4W+L0@70K;OP^3E#7G+z_HM+}=+aWCBgiu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AX#xfJ|Ob50@Z_C?f+0P=KLQ^7}5Jz%EZ0$B>FSZ*MFNk`5GMd%!F#*x2Eq zpe5MB#lqCMVuiy8hOKiQ!;}Okii+AWG2LW;ASfUxDkylx)g`1wQpLF5^#)7hJ!|KE z=ils2U-#pA$KKt`SFKvLPbJiJ&z^Xd&-d@MZB6BS=6Us^&iXX>wZdOtU)J&LeHIzr z6P5nz@^#lqS9~Yko_z4Z6TOqAuLJ%{-rb|(*>?Wq(^VyN&)jZ%b+KaRo}S4uDwnU{ zN|-js)c5LQm3lwzlj~FNh#o(AzHR2OEz$M+=i7vY)~=gXa@F%{;clP5R_j--Qt3aL z7;fVuH(NDJ>7-HQ{o2J(cBamed%H%ia(Cq0@_W|*KEBz;cVQOWnsEQn>bq6zU#;|< z^DkFw!-`w)ul)}FKkLZL`^y;nLtob)SiCBCC!0C%jD0_USgxD3ulmnnucCQ2CAU3` zE*km$pTsl$CP6vE1OkHH{9`Qc@}LdxGI$SRgSIj z?QJt3WHV>|cw9G8=bircH>{wDAP;<4_y6I9{U^J!7Tbah@O1TaS?83{B#C620g!D7 U#C$+paVt3?At42ntauri09vTq4gdfE literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/gui/scripts/fonts/Arial Bold 14 (ansi).uft b/Templates/BaseGame/game/core/gui/scripts/fonts/Arial Bold 14 (ansi).uft new file mode 100644 index 0000000000000000000000000000000000000000..4dbbddede62addac380eca861535ac39d2f3819b GIT binary patch literal 2669 zcmc(gdpMM76u`eR7mNrosa-n?>zZ;YOU01exP>&9T87ny+|sOTB}BQ@Xb^?RrC6a@ zk;|6sPMeg5by+*2MLRCz5(+7?^ZLGdnrB!3-Sa%}oO9maIp=-P`+nayXb6JvCc!?Q zehQ|6e%=y17YNW|$UyV7CU1ORK*T2j9v*Q;cp9@}^J8#456l7qT6o10UHOF|K*0b4 zG)&j8_z)z-(}KBhO(}$8d0H?Rwh00h1ZfjDi02QnZ=N?^?`XLnLfx*9DIG2Xd)$cb1p&(XpUD!T@ zP{Gpx1g;#rCQU#n|E&1Cf-5uD%*{mT>buHaGq(_-t3MkhYvxw0nOlv}fA0!Djr*UW zaKB81f?EIs2+;8J{M(8TLHs@Q&kBA+pCVN77Jv<}+lEjO3ub`;4QfG9=gKeqgbGsd zWrLuX2<3MK)&)^;BnP3ugS&t=yzZDlE{G7!Me+Ou2YX9#{ATcKh?A|%oFE9yqTov5 zo963zA0T_OnTc~)_Cyzvrg#WynkHg!LUE=Fk|G#uu)6gn-_pZAG9CzQ8VUALv$UZ|egBK6=a zDO#3NXrKz$l54r+W^0f^(j#1m;6%dq_Si@xbs`gK$L3yQUb zj-$F67$>@_TwCmm0^yPPa`Wlr>ZL);HV!t;QR|l@8KT*_rZo}|44YLZe`uYZlc3u! zgy==}b&w5G(}cWJhC(3|Ysr)$I(s1GLx7CpU=LHes)*^PRw&&VQ8ryKLbcyjXVBLw z)%j#{vNE1ZuE`uVI;Uc>s9Lg7&-oatBNnnxNGc%d_AES^cy-mPlV0ji4 z&yMuqxU_RmLK^BGR>F3L7{)zRaae*0iIJh9Dcdd6tt44ihY`=zaj;f{OF!UmIPx_P@zT;YGCD zu#%bT@b;B|X|lP!*&S1A%na|N!xsgf5zZT-yb;!OiN%(P*&%a&AQ3MVb8!$?+n?C5 z{3dJQh3*4oOVTCdwg5uWH1NiayW=7ziIAv--bWF zx$%f{1}lucoHHMaj!H^D#gW;s^zPRa6RfFdI@X>0*Po5%iRtf&T--+E`VapAtP-Jh literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/gui/scripts/fonts/Arial Bold 16 (ansi).uft b/Templates/BaseGame/game/core/gui/scripts/fonts/Arial Bold 16 (ansi).uft new file mode 100644 index 0000000000000000000000000000000000000000..fb096776f37c76773bef44144599604436e1c8bb GIT binary patch literal 1198 zcmZQ(U|`^KEXqvGQE$SaLNPOx52T=g4M=kVF(Z`b0E>e}K>$Rv12ISz zL_=hGfGiNeE-M6)1j}NYECH2e0@BE`EMRddB)ypSDj>$^|@K978JRyuG5B zFYPJ8_JCgk2t*{r*hE-FWH>Y|Bm@!y1R$W`fkR?rJZ0y`T zKp-X&QN^DVv->Z5-#qulv6*Eiv) z*N4?xwX5UJ&N`=0+#dScWNy`L*H5L>=D#|zMg8BD*|TeA@xG3o_BLnIpVDbhlh?^j z%5o3&E&6M?csb8&laraepQps^xjD6N4WrJb_vwM@kALp#TM~a#Ywy2@=VO;%Kl{k; z@vhTW<))`_ElB4ebe{K=1iZfwl|jHxTI6{v%tK(Pv4E+ z=TH86e%X32wVkuxFiC`bnsNL4%l9g(Ar{7*sI`_#Qy-9cW<$SJUn(^e< z=Y8{@?JJ*F|GMb&-{}nZR9{|KIQjCl*>ULu@6+XN*029oEdDuX|J*Iw{ExGYR7`6g@ft;7yps<;JgQ$Wwo=o=d4Dp<5KmV>mvv4FO@T-zDgfCfKx_xZ6}OTT5)%IV zvjNEm|NWI2OlI@<%P@03D-d4U$Ju$7=SWO|nY2JLlOgvc8~rJ1tVwPvg>o8a85wpk H3YP!?K^+@u literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/gui/scripts/fonts/Arial Bold 18 (ansi).uft b/Templates/BaseGame/game/core/gui/scripts/fonts/Arial Bold 18 (ansi).uft new file mode 100644 index 0000000000000000000000000000000000000000..1f8fdedd3337dae3859867addedafffcd75bd980 GIT binary patch literal 3066 zcmchYdpwle8poG0VJ0I}Y>jdYT~tz&OJW;xnMrO#ZhIF>ndm|;C4^yj)KoNEDM#|b zPTO_Mt&mHhWI}2bN}?o}+(L-XyS(Gmd(PJW^E{u=TF-jdcm1CAtY^LNj4%LzXn6dP z+hIkcV~5?BB9G9Zmk=~O;@2VVyNMyg#Yhtpc;Xy_v(Ruz!&0b6Hks=I5Jfy(3ANA@ zkOlyGu1D#-_B&lJpbJNq#c2N?SqVe`9(gT>VzqD#z$OfZT4<2KGXS79*8{K!@mQ_M z-28R{h3A{!7kV^~v4BGDd}W}A&p$S_k_^ED7#YnITS=yX!W`#wh8|t%grV4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t zm9&Lr{J5%x$-CR~)~jy!y9@6X)9AcNx!g@MD!r8aF!H2t%4HXQo4)L?quLHZ7gwyj gzEMiUZ??izbQ#$)evm%<0A^7=iU0rr literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/gui/scripts/fonts/ArialItalic 14 (ansi).uft b/Templates/BaseGame/game/core/gui/scripts/fonts/ArialItalic 14 (ansi).uft new file mode 100644 index 0000000000000000000000000000000000000000..5bac0316eb5a91b60214d283e613e06abf22c7a6 GIT binary patch literal 777 zcmZQ(U|`^OEXqvG@hnNq$xP-0@<9MZb3-vRkmdkl1OV|s_&*SUXm+p^ObsWH#|FfV zP#VN%U=Re83=FJ58d(;^W?&EllMDmOe`F$5qpup3`F{EP7+jA3( zXBRRY`}n-9^xOl6<_~d^KN1LKF>*)&Q3c0`E1FqxlbQF+9$g-(>N}Fxu=(J z=Jm%m>0h(vt+D^ItAB6q`<#o?_tj3`-EdQF<h%|HJ?-??h({xe^cmd6+W(v2^BiaSobP(hoEazxg4Q0qblSzyL0sS6&C}iW z%o^qr5YY3%4aMv&nQd8km_uH83VJYK`U^qa%rR&PxMxuea|Q&>Y@GDhMfNi)0#gtP zhzeK+JRw=@ocVgQQBJ>CR;7V31y(up zCBhWM2zCGgJuBv0i*wcrCyjs;^3SuWETO8wI(7w){!K!4#~5)BEw(?Sm;e4R9xcELRe|?VyrNwE{Ml zPyZN9SFSU7+kdWW2UAdI5D~Bp#vl#|I?ZfLr_Xtx&%$)&GjeCs1y+}YW!Z~41(ty> z$O`NLJ&Rsuj(+Yph>ddA>Q9)0YAj{6T*+{l0>5C#kClvsDY(ZVU(hc{1zzu;#|&QY zCCXVV@Om#%5Hs+*9M%0*=|h-;+HhKavMMF9QIH9c<&41l459+jfT%#dmZK_V&Hx4b z|LYfM{CU`9ABKMeKXZsNHZm|{*+H=O`ijwun8(R5HrRX2Ct;*rk?`JnYt_V)5M2ZD zb-V_K=(KIfKwa^5A^cp(BVfQ>Gc>Hc$!~y8Lq1J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!x>al0A;XPZHC!w@#L)kY@g-7uNQE z=y--JkP$wSu@kF}s12-@moEyG=>@O0y$26O+(%DrmD&kx+*nl5JJi^? z@qo^60iNWZ-m4=cyR`el?vds@KcMb@mO>{!?kJ@jr`FGI`~M5g^t<4^I@c-nN9z~= zKQT5mG04%g4|>J?y#Rhz01;<4e`d>IHlNNz6qlVr4(qx5rEDDK?nvhayPlz#%Q{N^ zvak?Cp!nz%I^|&LF`g#85?l1zsWVbH88ti@lZQ0Dh~qi0-wj5J)ytTjPDF~xn>mG8 z^cD^c^p$CkTBaQgMyX3H?;{F3xq7^k$!`eX=oM$5 + \ No newline at end of file diff --git a/Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Init.cs b/Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Init.cs new file mode 100644 index 000000000..c7d357bb8 --- /dev/null +++ b/Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Init.cs @@ -0,0 +1,68 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +/////////////////////////////////////////////////////////////////////////////// +// Default Prefs + +/* +$pref::LightManager::sgAtlasMaxDynamicLights = "16"; +$pref::LightManager::sgDynamicShadowDetailSize = "0"; +$pref::LightManager::sgDynamicShadowQuality = "0"; +$pref::LightManager::sgLightingProfileAllowShadows = "1"; +$pref::LightManager::sgLightingProfileQuality = "0"; +$pref::LightManager::sgMaxBestLights = "10"; +$pref::LightManager::sgMultipleDynamicShadows = "1"; +$pref::LightManager::sgShowCacheStats = "0"; +$pref::LightManager::sgUseBloom = ""; +$pref::LightManager::sgUseDRLHighDynamicRange = "0"; +$pref::LightManager::sgUseDynamicRangeLighting = "0"; +$pref::LightManager::sgUseDynamicShadows = "1"; +$pref::LightManager::sgUseToneMapping = ""; +*/ + +//exec( "./shaders.cs" ); +//exec( "./deferredShading.cs" ); + +function onActivateAdvancedLM() +{ + // Enable the offscreen target so that AL will work + // with MSAA back buffers and for HDR rendering. + AL_FormatToken.enable(); + + // Activate Deferred Shading + AL_DeferredShading.enable(); +} + +function onDeactivateAdvancedLM() +{ + // Disable the offscreen render target. + AL_FormatToken.disable(); + + // Deactivate Deferred Shading + AL_DeferredShading.disable(); +} + +function setAdvancedLighting() +{ + setLightManager( "Advanced Lighting" ); +} + diff --git a/Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Shaders.cs b/Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Shaders.cs new file mode 100644 index 000000000..a73598d9b --- /dev/null +++ b/Templates/BaseGame/game/core/lighting/scripts/advancedLighting_Shaders.cs @@ -0,0 +1,276 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +// Vector Light State +new GFXStateBlockData( AL_VectorLightState ) +{ + blendDefined = true; + blendEnable = true; + blendSrc = GFXBlendOne; + blendDest = GFXBlendOne; + blendOp = GFXBlendOpAdd; + + zDefined = true; + zEnable = false; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; // G-buffer + mSamplerNames[0] = "deferredBuffer"; + samplerStates[1] = SamplerClampPoint; // Shadow Map (Do not change this to linear, as all cards can not filter equally.) + mSamplerNames[1] = "shadowMap"; + samplerStates[2] = SamplerClampPoint; // Shadow Map (Do not change this to linear, as all cards can not filter equally.) + mSamplerNames[2] = "dynamicShadowMap"; + samplerStates[3] = SamplerClampLinear; // SSAO Mask + mSamplerNames[3] = "ssaoMask"; + samplerStates[4] = SamplerWrapPoint; // Random Direction Map + + cullDefined = true; + cullMode = GFXCullNone; + + stencilDefined = true; + stencilEnable = true; + stencilFailOp = GFXStencilOpKeep; + stencilZFailOp = GFXStencilOpKeep; + stencilPassOp = GFXStencilOpKeep; + stencilFunc = GFXCmpLess; + stencilRef = 0; +}; + +// Vector Light Material +new ShaderData( AL_VectorLightShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/farFrustumQuadV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/vectorLightP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/farFrustumQuadV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/vectorLightP.glsl"; + + samplerNames[0] = "$deferredBuffer"; + samplerNames[1] = "$shadowMap"; + samplerNames[2] = "$dynamicShadowMap"; + samplerNames[3] = "$ssaoMask"; + samplerNames[4] = "$gTapRotationTex"; + samplerNames[5] = "$lightBuffer"; + samplerNames[6] = "$colorBuffer"; + samplerNames[7] = "$matInfoBuffer"; + + pixVersion = 3.0; +}; + +new CustomMaterial( AL_VectorLightMaterial ) +{ + shader = AL_VectorLightShader; + stateBlock = AL_VectorLightState; + + sampler["deferredBuffer"] = "#deferred"; + sampler["shadowMap"] = "$dynamiclight"; + sampler["dynamicShadowMap"] = "$dynamicShadowMap"; + sampler["ssaoMask"] = "#ssaoMask"; + sampler["lightBuffer"] = "#lightinfo"; + sampler["colorBuffer"] = "#color"; + sampler["matInfoBuffer"] = "#matinfo"; + + target = "lightinfo"; + + pixVersion = 3.0; +}; + +//------------------------------------------------------------------------------ + +// Convex-geometry light states +new GFXStateBlockData( AL_ConvexLightState ) +{ + blendDefined = true; + blendEnable = true; + blendSrc = GFXBlendOne; + blendDest = GFXBlendOne; + blendOp = GFXBlendOpAdd; + + zDefined = true; + zEnable = true; + zWriteEnable = false; + zFunc = GFXCmpGreaterEqual; + + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; // G-buffer + mSamplerNames[0] = "deferredBuffer"; + samplerStates[1] = SamplerClampPoint; // Shadow Map (Do not use linear, these are perspective projections) + mSamplerNames[1] = "shadowMap"; + samplerStates[2] = SamplerClampPoint; // Shadow Map (Do not use linear, these are perspective projections) + mSamplerNames[2] = "dynamicShadowMap"; + samplerStates[3] = SamplerClampLinear; // Cookie Map + samplerStates[4] = SamplerWrapPoint; // Random Direction Map + + cullDefined = true; + cullMode = GFXCullCW; + + stencilDefined = true; + stencilEnable = true; + stencilFailOp = GFXStencilOpKeep; + stencilZFailOp = GFXStencilOpKeep; + stencilPassOp = GFXStencilOpKeep; + stencilFunc = GFXCmpLess; + stencilRef = 0; +}; + +// Point Light Material +new ShaderData( AL_PointLightShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/convexGeometryV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/pointLightP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/convexGeometryV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/pointLightP.glsl"; + + samplerNames[0] = "$deferredBuffer"; + samplerNames[1] = "$shadowMap"; + samplerNames[2] = "$dynamicShadowMap"; + samplerNames[3] = "$cookieMap"; + samplerNames[4] = "$gTapRotationTex"; + samplerNames[5] = "$lightBuffer"; + samplerNames[6] = "$colorBuffer"; + samplerNames[7] = "$matInfoBuffer"; + + pixVersion = 3.0; +}; + +new CustomMaterial( AL_PointLightMaterial ) +{ + shader = AL_PointLightShader; + stateBlock = AL_ConvexLightState; + + sampler["deferredBuffer"] = "#deferred"; + sampler["shadowMap"] = "$dynamiclight"; + sampler["dynamicShadowMap"] = "$dynamicShadowMap"; + sampler["cookieMap"] = "$dynamiclightmask"; + sampler["lightBuffer"] = "#lightinfo"; + sampler["colorBuffer"] = "#color"; + sampler["matInfoBuffer"] = "#matinfo"; + + target = "lightinfo"; + + pixVersion = 3.0; +}; + +// Spot Light Material +new ShaderData( AL_SpotLightShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/convexGeometryV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/spotLightP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/convexGeometryV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/spotLightP.glsl"; + + samplerNames[0] = "$deferredBuffer"; + samplerNames[1] = "$shadowMap"; + samplerNames[2] = "$dynamicShadowMap"; + samplerNames[3] = "$cookieMap"; + samplerNames[4] = "$gTapRotationTex"; + samplerNames[5] = "$lightBuffer"; + samplerNames[6] = "$colorBuffer"; + samplerNames[7] = "$matInfoBuffer"; + + pixVersion = 3.0; +}; + +new CustomMaterial( AL_SpotLightMaterial ) +{ + shader = AL_SpotLightShader; + stateBlock = AL_ConvexLightState; + + sampler["deferredBuffer"] = "#deferred"; + sampler["shadowMap"] = "$dynamiclight"; + sampler["dynamicShadowMap"] = "$dynamicShadowMap"; + sampler["cookieMap"] = "$dynamiclightmask"; + sampler["lightBuffer"] = "#lightinfo"; + sampler["colorBuffer"] = "#color"; + sampler["matInfoBuffer"] = "#matinfo"; + + target = "lightinfo"; + + pixVersion = 3.0; +}; + +/// This material is used for generating deferred +/// materials for objects that do not have materials. +new Material( AL_DefaultDeferredMaterial ) +{ + // We need something in the first pass else it + // won't create a proper material instance. + // + // We use color here because some objects may not + // have texture coords in their vertex format... + // for example like terrain. + // + diffuseColor[0] = "1 1 1 1"; +}; + +/// This material is used for generating shadow +/// materials for objects that do not have materials. +new Material( AL_DefaultShadowMaterial ) +{ + // We need something in the first pass else it + // won't create a proper material instance. + // + // We use color here because some objects may not + // have texture coords in their vertex format... + // for example like terrain. + // + diffuseColor[0] = "1 1 1 1"; + + // This is here mostly for terrain which uses + // this material to create its shadow material. + // + // At sunset/sunrise the sun is looking thru + // backsides of the terrain which often are not + // closed. By changing the material to be double + // sided we avoid holes in the shadowed geometry. + // + doubleSided = true; +}; + +// Particle System Point Light Material +new ShaderData( AL_ParticlePointLightShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/particlePointLightV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/particlePointLightP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/convexGeometryV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/pointLightP.glsl"; + + samplerNames[0] = "$deferredBuffer"; + + pixVersion = 3.0; +}; + +new CustomMaterial( AL_ParticlePointLightMaterial ) +{ + shader = AL_ParticlePointLightShader; + stateBlock = AL_ConvexLightState; + + sampler["deferredBuffer"] = "#deferred"; + target = "lightinfo"; + + pixVersion = 3.0; +}; diff --git a/Templates/BaseGame/game/core/lighting/scripts/basicLighting_Init.cs b/Templates/BaseGame/game/core/lighting/scripts/basicLighting_Init.cs new file mode 100644 index 000000000..99be20c5c --- /dev/null +++ b/Templates/BaseGame/game/core/lighting/scripts/basicLighting_Init.cs @@ -0,0 +1,92 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//exec( "./shadowFilter.cs" ); + +singleton GFXStateBlockData( BL_ProjectedShadowSBData ) +{ + blendDefined = true; + blendEnable = true; + blendSrc = GFXBlendDestColor; + blendDest = GFXBlendZero; + + zDefined = true; + zEnable = true; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + vertexColorEnable = true; +}; + +singleton ShaderData( BL_ProjectedShadowShaderData ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/projectedShadowV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/projectedShadowP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/projectedShadowV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/projectedShadowP.glsl"; + + samplerNames[0] = "inputTex"; + + pixVersion = 2.0; +}; + +singleton CustomMaterial( BL_ProjectedShadowMaterial ) +{ + sampler["inputTex"] = "$miscbuff"; + + shader = BL_ProjectedShadowShaderData; + stateBlock = BL_ProjectedShadowSBData; + version = 2.0; + forwardLit = true; +}; + +function onActivateBasicLM() +{ + // If HDR is enabled... enable the special format token. + if ( $platform !$= "macos" && HDRPostFx.isEnabled ) + AL_FormatToken.enable(); + + // Create render pass for projected shadow. + new RenderPassManager( BL_ProjectedShadowRPM ); + + // Create the mesh bin and add it to the manager. + %meshBin = new RenderMeshMgr(); + BL_ProjectedShadowRPM.addManager( %meshBin ); + + // Add both to the root group so that it doesn't + // end up in the MissionCleanup instant group. + RootGroup.add( BL_ProjectedShadowRPM ); + RootGroup.add( %meshBin ); +} + +function onDeactivateBasicLM() +{ + // Delete the pass manager which also deletes the bin. + BL_ProjectedShadowRPM.delete(); +} + +function setBasicLighting() +{ + setLightManager( "Basic Lighting" ); +} diff --git a/Templates/BaseGame/game/core/lighting/scripts/basicLighting_shadowFilter.cs b/Templates/BaseGame/game/core/lighting/scripts/basicLighting_shadowFilter.cs new file mode 100644 index 000000000..5aea7b607 --- /dev/null +++ b/Templates/BaseGame/game/core/lighting/scripts/basicLighting_shadowFilter.cs @@ -0,0 +1,76 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +singleton ShaderData( BL_ShadowFilterShaderV ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/basic/shadowFilterV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/basic/shadowFilterP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/basic/gl/shadowFilterV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/basic/gl/shadowFilterP.glsl"; + + samplerNames[0] = "$diffuseMap"; + + defines = "BLUR_DIR=float2(1.0,0.0)"; + + pixVersion = 2.0; +}; + +singleton ShaderData( BL_ShadowFilterShaderH : BL_ShadowFilterShaderV ) +{ + defines = "BLUR_DIR=float2(0.0,1.0)"; +}; + + +singleton GFXStateBlockData( BL_ShadowFilterSB : PFX_DefaultStateBlock ) +{ + colorWriteDefined=true; + colorWriteRed=false; + colorWriteGreen=false; + colorWriteBlue=false; + blendDefined = true; + blendEnable = true; +}; + +// NOTE: This is ONLY used in Basic Lighting, and +// only directly by the ProjectedShadow. It is not +// meant to be manually enabled like other PostEffects. +singleton PostEffect( BL_ShadowFilterPostFx ) +{ + // Blur vertically + shader = BL_ShadowFilterShaderV; + stateBlock = PFX_DefaultStateBlock; + targetClear = "PFXTargetClear_OnDraw"; + targetClearColor = "0 0 0 0"; + texture[0] = "$inTex"; + target = "$outTex"; + + // Blur horizontal + new PostEffect() + { + shader = BL_ShadowFilterShaderH; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$inTex"; + target = "$outTex"; + }; +}; diff --git a/Templates/BaseGame/game/core/lighting/scripts/deferredShading.cs b/Templates/BaseGame/game/core/lighting/scripts/deferredShading.cs new file mode 100644 index 000000000..5dbacd2e3 --- /dev/null +++ b/Templates/BaseGame/game/core/lighting/scripts/deferredShading.cs @@ -0,0 +1,71 @@ +singleton ShaderData( ClearGBufferShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/deferredClearGBufferV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/deferredClearGBufferP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/deferredClearGBufferP.glsl"; + + pixVersion = 2.0; +}; + +singleton ShaderData( DeferredColorShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFx/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/deferredColorShaderP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/deferredColorShaderP.glsl"; + + pixVersion = 2.0; +}; + +// Primary Deferred Shader +new GFXStateBlockData( AL_DeferredShadingState : PFX_DefaultStateBlock ) +{ + cullMode = GFXCullNone; + + blendDefined = true; + blendEnable = true; + blendSrc = GFXBlendSrcAlpha; + blendDest = GFXBlendInvSrcAlpha; + + samplersDefined = true; + samplerStates[0] = SamplerWrapLinear; + samplerStates[1] = SamplerWrapLinear; + samplerStates[2] = SamplerWrapLinear; + samplerStates[3] = SamplerWrapLinear; + samplerStates[4] = SamplerWrapLinear; +}; + +new ShaderData( AL_DeferredShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/deferredShadingP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/advanced/gl/deferredShadingP.glsl"; + + samplerNames[0] = "colorBufferTex"; + samplerNames[1] = "lightDeferredTex"; + samplerNames[2] = "matInfoTex"; + samplerNames[3] = "deferredTex"; + + pixVersion = 2.0; +}; + +singleton PostEffect( AL_DeferredShading ) +{ + renderTime = "PFXAfterBin"; + renderBin = "SkyBin"; + shader = AL_DeferredShader; + stateBlock = AL_DeferredShadingState; + texture[0] = "#color"; + texture[1] = "#lightinfo"; + texture[2] = "#matinfo"; + texture[3] = "#deferred"; + + target = "$backBuffer"; + renderPriority = 10000; + allowReflectPass = true; +}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/lighting/scripts/lighting.cs b/Templates/BaseGame/game/core/lighting/scripts/lighting.cs new file mode 100644 index 000000000..b7d4034ff --- /dev/null +++ b/Templates/BaseGame/game/core/lighting/scripts/lighting.cs @@ -0,0 +1,74 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +function initLightingSystems(%manager) +{ + echo( "\nInitializing Lighting Systems" ); + + // First exec the scripts for the different light managers + // in the lighting folder. + /*%pattern = "./lighting/*//*init.cs"; + %file = findFirstFile( %pattern ); + if ( %file $= "" ) + { + // Try for DSOs next. + %pattern = "./lighting/*//*init.cs.dso"; + %file = findFirstFile( %pattern ); + } + + while( %file !$= "" ) + { + exec( %file ); + %file = findNextFile( %pattern ); + }*/ + + // Try the perfered one first. + %success = setLightManager(%manager); + + // Did we completely fail to initialize a light manager? + if (!%success) + { + // If we completely failed to initialize a light + // manager then the 3d scene cannot be rendered. + quitWithErrorMessage( "Failed to set a light manager!" ); + } +} + +//--------------------------------------------------------------------------------------------- + +function onLightManagerActivate( %lmName ) +{ + // Call activation callbacks. + %activateNewFn = "onActivate" @ getWord( %lmName, 0 ) @ "LM"; + if( isFunction( %activateNewFn ) ) + eval( %activateNewFn @ "();" ); +} + +//--------------------------------------------------------------------------------------------- + +function onLightManagerDeactivate( %lmName ) +{ + // Call deactivation callback. + %deactivateOldFn = "onDeactivate" @ getWord( %lmName, 0 ) @ "LM"; + if( isFunction( %deactivateOldFn ) ) + eval( %deactivateOldFn @ "();" ); +} diff --git a/Templates/BaseGame/game/core/lighting/scripts/shadowMaps_Init.cs b/Templates/BaseGame/game/core/lighting/scripts/shadowMaps_Init.cs new file mode 100644 index 000000000..f4875bf08 --- /dev/null +++ b/Templates/BaseGame/game/core/lighting/scripts/shadowMaps_Init.cs @@ -0,0 +1,32 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +new ShaderData(BlurDepthShader) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/lighting/shadowMap/boxFilterV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/lighting/shadowMap/boxFilterP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/lighting/shadowMap/gl/boxFilterV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/lighting/shadowMap/gl/boxFilterP.glsl"; + pixVersion = 2.0; +}; diff --git a/Templates/BaseGame/game/core/postFX/Core_PostFX.cs b/Templates/BaseGame/game/core/postFX/Core_PostFX.cs new file mode 100644 index 000000000..d36d912ab --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/Core_PostFX.cs @@ -0,0 +1,33 @@ + +function Core_PostFX::onCreate(%this) +{ + // + exec("./scripts/postFx.cs"); + /*exec("./scripts/postFxManager.gui.cs"); + exec("./scripts/postFxManager.gui.settings.cs"); + exec("./scripts/postFxManager.persistance.cs"); + + exec("./scripts/default.postfxpreset.cs"); + + exec("./scripts/caustics.cs"); + exec("./scripts/chromaticLens.cs"); + exec("./scripts/dof.cs"); + exec("./scripts/edgeAA.cs"); + exec("./scripts/flash.cs"); + exec("./scripts/fog.cs"); + exec("./scripts/fxaa.cs"); + exec("./scripts/GammaPostFX.cs"); + exec("./scripts/glow.cs"); + exec("./scripts/hdr.cs"); + exec("./scripts/lightRay.cs"); + exec("./scripts/MLAA.cs"); + exec("./scripts/MotionBlurFx.cs"); + exec("./scripts/ovrBarrelDistortion.cs"); + exec("./scripts/ssao.cs"); + exec("./scripts/turbulence.cs"); + exec("./scripts/vignette.cs");*/ +} + +function Core_PostFX::onDestroy(%this) +{ +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/Core_PostFX.module b/Templates/BaseGame/game/core/postFX/Core_PostFX.module new file mode 100644 index 000000000..627a32d94 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/Core_PostFX.module @@ -0,0 +1,10 @@ + + \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/guis/postFxManager.gui b/Templates/BaseGame/game/core/postFX/guis/postFxManager.gui new file mode 100644 index 000000000..6a704eb65 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/guis/postFxManager.gui @@ -0,0 +1,2755 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = new GuiControl(PostFXManager) { + position = "0 0"; + extent = "1024 768"; + minExtent = "8 8"; + horizSizing = "width"; + vertSizing = "height"; + profile = "GuiModelessDialogProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "1"; + + new DbgFileView() { + position = "0 0"; + extent = "8 2"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiWindowCtrl(ppOptionsWindow) { + text = "PostFX Manager"; + resizeWidth = "0"; + resizeHeight = "0"; + canMove = "1"; + canClose = "1"; + canMinimize = "0"; + canMaximize = "0"; + canCollapse = "0"; + closeCommand = "Canvas.popDialog(PostFXManager);"; + edgeSnap = "0"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "306 216"; + extent = "411 336"; + minExtent = "8 8"; + horizSizing = "center"; + vertSizing = "center"; + profile = "GuiWindowProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapBorderCtrl() { + position = "11 77"; + extent = "390 216"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabBorderProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTabBookCtrl(ppOptionsTabBook) { + tabPosition = "Top"; + tabMargin = "7"; + minTabWidth = "32"; + tabHeight = "20"; + allowReorder = "0"; + defaultPage = "-1"; + selectedPage = "1"; + frontTabPadding = "0"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "11 58"; + extent = "394 233"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabBookProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTabPageCtrl(ppOptionsSSAOTab) { + fitBook = "0"; + text = "SSAO"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "394 213"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Options for the Screen Space Ambient Occlusion postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapBorderCtrl() { + position = "12 30"; + extent = "365 170"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabBorderProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "1"; + }; + new GuiTabBookCtrl(ppOptionsSSAOOptions) { + tabPosition = "Top"; + tabMargin = "7"; + minTabWidth = "64"; + tabHeight = "20"; + allowReorder = "0"; + defaultPage = "-1"; + selectedPage = "2"; + frontTabPadding = "0"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 11"; + extent = "362 185"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabBookProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTabPageCtrl(ppOptionsSSAOGeneralTab) { + fitBook = "0"; + text = "General"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "362 165"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Contains general overall settings for the SSAO postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl(ppOptionsSSAOOverallStrengthLabel) { + text = "Overall Strength"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "31 57"; + extent = "77 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the overall strength of the Ambient Occlusion effect."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAOBlurDepthLabel) { + text = "Blur (Softness)"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "38 85"; + extent = "73 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the amount of softness in the SSAO, overall."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAOBlurNormalLabel) { + text = "Blur (Normal Maps)"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "19 112"; + extent = "92 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the amount of softness in the SSAO, in the normal maps."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrl(ppOptionsSSAOQuality) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + text = "Low"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "120 28"; + extent = "211 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiPopUpMenuProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAOQualityLabel) { + text = "Quality"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "76 29"; + extent = "32 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAOOverallStrength) { + range = "0 50"; + ticks = "1000"; + snap = "0"; + value = "2"; + position = "120 56"; + extent = "211 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAOBlurDepth) { + range = "0 0.3"; + ticks = "1000"; + snap = "0"; + value = "0.001"; + position = "120 86"; + extent = "211 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAOBlurNormal) { + range = "0 1"; + ticks = "1000"; + snap = "0"; + value = "0.95"; + position = "119 113"; + extent = "212 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl(ppOptionsSSAONearTab) { + fitBook = "0"; + text = "Near"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "362 165"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Contains settings for the near range ambient occlusion aspect of the SSAO postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiSliderCtrl(ppOptionsSSAONearRadius) { + range = "0.001 5"; + ticks = "1000"; + snap = "0"; + value = "0.1"; + position = "122 17"; + extent = "221 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAONearDepthMin) { + range = "0 5"; + ticks = "1000"; + snap = "0"; + value = "0.1"; + position = "122 62"; + extent = "221 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAONearStrength) { + range = "0 20"; + ticks = "1000"; + snap = "0"; + value = "6"; + position = "122 39"; + extent = "221 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAONearRadiusLabel) { + text = "Radius"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "80 16"; + extent = "34 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the near/small radius SSAO reach."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAONearStrengthLabel) { + text = "Strength"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "73 38"; + extent = "41 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the near/small radius SSAO strength."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAONearDepthMinLabel) { + text = "Depth Min"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "66 61"; + extent = "48 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the near/small radius SSAO minimum depth value."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAONearDepthMaxLabel) { + text = "Depth Max"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "62 85"; + extent = "52 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the near/small radius SSAO maximum depth value."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAONearDepthMax) { + range = "0 50"; + ticks = "1000"; + snap = "0"; + value = "1"; + position = "122 86"; + extent = "221 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAONearToleranceNormal) { + range = "0 2"; + ticks = "1000"; + snap = "0"; + value = "0"; + position = "122 133"; + extent = "103 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAONearTolerancePower) { + range = "0 2"; + ticks = "1000"; + snap = "0"; + value = "1"; + position = "246 133"; + extent = "97 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAONearToleranceLabel2) { + text = "Tolerance / Power"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "24 132"; + extent = "92 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAONearToleranceLabel1) { + text = "Normal Maps : "; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "19 113"; + extent = "71 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl(ppOptionsSSAOFarTab) { + fitBook = "0"; + text = "Far"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "362 165"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Contains settings for the far range ambient occlusion aspect of the SSAO postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl(ppOptionsSSAOFarRadiusLabel) { + text = "Radius"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "80 16"; + extent = "34 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the far/large radius SSAO reach."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAOFarRadius) { + range = "0.001 5"; + ticks = "1000"; + snap = "0"; + value = "1"; + position = "122 17"; + extent = "221 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAOFarStrengthLabel) { + text = "Strength"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "73 38"; + extent = "41 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the far/large radius SSAO strength."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAOFarStrength) { + range = "0 20"; + ticks = "1000"; + snap = "0"; + value = "10"; + position = "122 39"; + extent = "221 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAOFarDepthMinLabel) { + text = "Depth Min"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "66 61"; + extent = "48 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the far/large radius SSAO minimum depth."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAOFarDepthMin) { + range = "0 5"; + ticks = "1000"; + snap = "0"; + value = "0.2"; + position = "122 62"; + extent = "221 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAOFarDepthMaxLabel) { + text = "Depth Max"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "62 85"; + extent = "52 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the far/large radius SSAO maximum."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAOFarDepthMax) { + range = "0 5"; + ticks = "1000"; + snap = "0"; + value = "2"; + position = "122 86"; + extent = "221 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsSSAOFarToleranceLabel1) { + text = "Normal Maps :"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "6 113"; + extent = "72 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl() { + text = "Tolerance / Power"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "24 132"; + extent = "90 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAOFarToleranceNormal) { + range = "0 2"; + ticks = "1000"; + snap = "0"; + value = "0"; + position = "122 133"; + extent = "100 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsSSAOFarTolerancePower) { + range = "0 2"; + ticks = "1000"; + snap = "0"; + value = "2"; + position = "239 133"; + extent = "104 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiCheckBoxCtrl(ppOptionsEnableSSAO) { + useInactiveState = "0"; + text = "Enable"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "329 7"; + extent = "53 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enable/Disable the SSAO postFX"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl(ppOptionsHDRTab) { + fitBook = "0"; + text = "HDR"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "394 213"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Options for the High Definition Range Lighting postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapBorderCtrl() { + position = "12 30"; + extent = "363 172"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabBorderProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "1"; + }; + new GuiTabBookCtrl(ppOptionsHDROptions) { + tabPosition = "Top"; + tabMargin = "7"; + minTabWidth = "64"; + tabHeight = "20"; + allowReorder = "0"; + defaultPage = "-1"; + selectedPage = "0"; + frontTabPadding = "0"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 11"; + extent = "365 195"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabBookProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTabPageCtrl(ppOptionsHDRBrightnessTab) { + fitBook = "0"; + text = "Brightness"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "365 175"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Contains settings related to the brightness of the HDR postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiSliderCtrl(ppOptionsHDRMinLuminance) { + range = "0 1"; + ticks = "1000"; + snap = "0"; + value = "0"; + position = "132 77"; + extent = "206 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Value : 0"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsHDRKeyValue) { + range = "0 1"; + ticks = "1000"; + snap = "0"; + value = "0.0459184"; + position = "132 50"; + extent = "206 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Value : 0.0459184"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsHDRKeyValueLabel) { + text = "Key Value"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "69 50"; + extent = "52 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The tone mapping middle grey or exposure value used to adjust the overall \"balance\" of the image."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsHDRMinLuminanceLabel) { + text = "Minimum Luminance"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "25 77"; + extent = "96 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The minimum luminance value to allow when tone mapping the scene. This is particularly useful if your scene is very dark or has a black ambient color in places."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsHDRWhiteCutoffLabel) { + text = "White Cutoff"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "56 104"; + extent = "65 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The cutoff level for the white levels in the brightness."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsHDRWhiteCutoff) { + range = "0 1"; + ticks = "1000"; + snap = "0"; + value = "0.52551"; + position = "132 104"; + extent = "206 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Value : 0.52551"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsHDRBrightnessAdaptRate) { + range = "0.1 10"; + ticks = "1000"; + snap = "0"; + value = "2"; + position = "132 132"; + extent = "205 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsHDRBrightnessAdaptRateLabel) { + text = "Brightness Adapt Rate"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "12 132"; + extent = "109 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The speed at which the view adjusts to the new lighting in the environment."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsHDRKeyValueLabel1) { + text = "Tone Mapping Contrast"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "10 24"; + extent = "111 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Tone mapping contrast is the amount of scene to blend, with the tone mapped HDR scene. Lower values are recommended but higher values give a strong contrasted darker shadowed look."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsHDRToneMappingAmount) { + range = "0 1"; + ticks = "1000"; + snap = "0"; + value = "0.265306"; + position = "132 24"; + extent = "206 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "value : 0.265306"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl(ppOptionsHDRBloomTab) { + fitBook = "0"; + text = "Bloom"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "365 175"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Contains settings related to the blooming aspect of the HDR postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiSliderCtrl(ppOptionsHDRBloomBlurMultiplier) { + range = "0 5"; + ticks = "1000"; + snap = "0"; + value = "0.502645"; + position = "132 70"; + extent = "199 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Value : 0.502645"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsHDRBloomBlurMean) { + range = "0 1"; + ticks = "1000"; + snap = "0"; + value = "0.510526"; + position = "132 97"; + extent = "200 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Value : 0.510526"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsHDRBloomBlurStdDev) { + range = "0 3"; + ticks = "1000"; + snap = "0"; + value = "1.4127"; + position = "132 123"; + extent = "199 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Value : 1.4127"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsHDRBlurMultiplierLabel) { + text = "Blur Multiplier"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "59 70"; + extent = "63 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The amount of blur to apply to the bloomed areas in the HDR."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsHDRBlurMeanLabel) { + text = "Blur \"mean\" value"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "38 97"; + extent = "84 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsHDRBlurStandardDevianceLabel) { + text = "Blur \"Std Dev\" value"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "23 123"; + extent = "99 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsHDRBloomBrightPassThresholdLabel) { + text = "Bright pass threshold"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "19 43"; + extent = "103 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The bright pass threshold controls how bright the brightest areas of the scene are in the HDR."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsHDRBloomBlurBrightPassThreshold) { + range = "0 5"; + ticks = "1000"; + snap = "0"; + value = "1.60526"; + position = "132 43"; + extent = "200 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Value : 1.60526"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiCheckBoxCtrl(ppOptionsHDRBloom) { + useInactiveState = "0"; + text = " Enable Bloom"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "250 9"; + extent = "85 24"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enables or disables the bloom (glowing effect) of the HDR PostFX."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl(ppOptionsHDRBloomEffectsTab) { + fitBook = "0"; + text = "Effects"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "365 175"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Contains settings related to the effects the HDR postFX can offer"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiCheckBoxCtrl(ppOptionsHDREffectsBlueShift) { + useInactiveState = "0"; + text = " Enable Color Shift"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "11 4"; + extent = "117 24"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enables a scene tinting/Blue shift based on the color selected below."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiColorPickerCtrl(ppOptionsHDREffectsBlueShiftColorBlend) { + baseColor = "1 0 0.0235294 1"; + pickColor = "0 0 0 1"; + selectorGap = "1"; + displayMode = "BlendColor"; + actionOnMove = "1"; + showReticle = "1"; + position = "10 29"; + extent = "344 110"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Select a color"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiColorPickerCtrl(ppOptionsHDREffectsBlueShiftColorBaseColor) { + baseColor = "1 0 0.0235294 1"; + pickColor = "0 0 0 1"; + selectorGap = "1"; + displayMode = "HorizColor"; + actionOnMove = "1"; + showReticle = "1"; + position = "10 142"; + extent = "343 21"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiDefaultProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Select a color"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiCheckBoxCtrl(ppOptionsHDRToneMapping) { + useInactiveState = "0"; + text = " Enable Tone Mapping"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "18 8"; + extent = "120 24"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enables or disabled tone mapping on the HDR. The tone mapping balanced the brightness levels during the HDR process. Recommended"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiCheckBoxCtrl(ppOptionsEnableHDR) { + useInactiveState = "0"; + text = "Enable"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "329 7"; + extent = "53 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enable/Disable the HDR postFX (takes some time to initialise, be patient)"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiCheckBoxCtrl(ppOptionsEnableHDRDebug) { + useInactiveState = "0"; + text = "Debug"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "262 7"; + extent = "53 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl(ppOptionsLightRaysTab) { + fitBook = "0"; + text = "Light Rays"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "394 213"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Options for the Light Rays postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiSliderCtrl(ppOptionsLightRaysBrightScalar) { + range = "0 5"; + ticks = "1000"; + snap = "0"; + value = "0.75"; + position = "96 46"; + extent = "264 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsLightRaysBrightnessScalarLabel) { + text = "Brightness"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "26 48"; + extent = "87 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls how bright the rays and the object casting them are in the scene."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + new GuiSliderCtrl(ppOptionsLightRaysSampleScalar) { + range = "20 512"; + ticks = "512"; + snap = "0"; + value = "40"; + position = "96 75"; + extent = "264 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + new GuiTextCtrl(ppOptionsLightRaysSampleScalarLabel) { + text = "Samples"; + maxLength = "512"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "26 76"; + extent = "87 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the number of samples for the shader."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + new GuiSliderCtrl(ppOptionsLightRaysDensityScalar) { + range = "0.01 1"; + ticks = "1000"; + snap = "0"; + value = "0.94"; + position = "96 105"; + extent = "264 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + new GuiTextCtrl(ppOptionsLightRaysDensityScalarLabel) { + text = "Density"; + maxLength = "1000"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "26 106"; + extent = "87 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the density of the rays."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + new GuiSliderCtrl(ppOptionsLightRaysWeightScalar) { + range = "0.1 10"; + ticks = "1000"; + snap = "0"; + value = "5.65"; + position = "96 135"; + extent = "264 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + new GuiTextCtrl(ppOptionsLightRaysWeightScalarLabel) { + text = "Weight"; + maxLength = "1000"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "26 136"; + extent = "87 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the weight of the rays."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + + new GuiSliderCtrl(ppOptionsLightRaysDecayScalar) { + range = "0.01 1"; + ticks = "1000"; + snap = "0"; + value = "1.0"; + position = "96 165"; + extent = "264 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + + new GuiTextCtrl(ppOptionsLightRaysDecayScalarLabel) { + text = "Decay"; + maxLength = "1000"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "26 166"; + extent = "87 15"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the decay of the rays."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiCheckBoxCtrl(ppOptionsEnableLightRays) { + useInactiveState = "0"; + text = "Enable"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "329 7"; + extent = "53 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enable/Disable the light rays postFX"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl(ppOptionsDOFTab) { + fitBook = "0"; + text = "DOF"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "394 213"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Options for the Depth Of Field postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiBitmapBorderCtrl() { + position = "14 28"; + extent = "362 170"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabBorderProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "1"; + }; + new GuiTabBookCtrl() { + tabPosition = "Top"; + tabMargin = "7"; + minTabWidth = "64"; + tabHeight = "20"; + allowReorder = "0"; + defaultPage = "-1"; + selectedPage = "1"; + frontTabPadding = "0"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "14 9"; + extent = "360 189"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabBookProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTabPageCtrl(ppOptionsDOFGeneralTab) { + fitBook = "0"; + text = "General"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "360 169"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "0"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Contains general settings related to the DOF system"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + //new GuiCheckBoxCtrl(ppOptionsDOFEnableDOF) { + //useInactiveState = "0"; + //text = "Enable DOF"; + //groupNum = "-1"; + //buttonType = "ToggleButton"; + //useMouseEvents = "0"; + //position = "31 43"; + //extent = "140 30"; + //minExtent = "8 2"; + //horizSizing = "right"; + //vertSizing = "bottom"; + //profile = "GuiCheckBoxProfile"; + //visible = "1"; + //active = "1"; + //tooltipProfile = "GuiToolTipProfile"; + //hovertime = "1000"; + //isContainer = "0"; + //canSave = "1"; + //canSaveDynamicFields = "0"; + //}; + new GuiCheckBoxCtrl(ppOptionsDOFEnableAutoFocus) { + useInactiveState = "0"; + text = "Enable Auto Focus"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "31 8"; + extent = "140 30"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl(ppOptionsDOFAutoFocusTab) { + fitBook = "0"; + text = "Auto Focus"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 20"; + extent = "360 169"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Contains settings related to the fine control of the auto focus system"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl(ppOptionsDOFNearBlurMaxLabel) { + text = "Near Blur Max"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "36 8"; + extent = "67 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The max allowed value of near blur"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsDOFFarBlurMinSlider) { + range = "0 1"; + ticks = "1000"; + snap = "0"; + value = "0"; + position = "120 8"; + extent = "224 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsDOFFarBlurMaxLabel) { + text = "Far Blur Max"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "43 34"; + extent = "60 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The max allowed value of far blur"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsDOFFarBlurMaxSlider) { + range = "0 1"; + ticks = "1000"; + snap = "0"; + value = "0"; + position = "120 34"; + extent = "224 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsDOFFocusRangeMinLabel) { + text = "Focus Range (Min)"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "13 61"; + extent = "90 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The distance range around the focal distance that remains in focus (in meters, minimum distance in focus) focal distance it is\r\ndependant on the visible distance set in your level"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsDOFFocusRangeMinSlider) { + range = "0.01 1e+003"; + ticks = "1000"; + snap = "0"; + value = "0.01"; + position = "120 61"; + extent = "224 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsDOFFocusRangeMaxLabel) { + text = "Focus Range (Max)"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "9 88"; + extent = "95 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "The distance range around the focal distance that remains in focus (in meters, maximum distance in focus) focal distance it is\r\ndependant on the visible distance set in your level"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsDOFFocusRangeMaxSlider) { + range = "0.01 1e+003"; + ticks = "1000"; + snap = "0"; + value = "0.01"; + position = "119 87"; + extent = "224 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsDOFBurCurveNearLabel) { + text = "Blur Curve Near"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "27 114"; + extent = "77 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "A small number causes bluriness to increase gradually\r\nat distances closer than the focal distance. A large number causes bluriness to \r\nincrease quickly"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsDOFBlurCurveNearSlider) { + range = "0 50"; + ticks = "1000"; + snap = "0"; + value = "0"; + position = "119 114"; + extent = "225 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsDOFBlurCurveFarLabel) { + text = "Blur Curve Far"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "33 139"; + extent = "70 16"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "A small number causes bluriness to increase gradually\r\nat distances closer than the focal distance. A large number causes bluriness to \r\nincrease quickly"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsDOFBlurCurveFarSlider) { + range = "0 50"; + ticks = "1000"; + snap = "0"; + value = "0"; + position = "119 141"; + extent = "224 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiCheckBoxCtrl(ppOptionsEnableDOF) { + useInactiveState = "0"; + text = "Enable"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "329 7"; + extent = "53 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enable/Disable the Depth of field postFX"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl(ppOptionsVignetteTab) { + fitBook = "0"; + text = "Vignette"; + maxLength = "1024"; + docking = "Client"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "1"; + anchorLeft = "1"; + anchorRight = "1"; + position = "0 40"; + extent = "394 193"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Options for the Vignette postFX"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + Enabled = "1"; + + new GuiCheckBoxCtrl(ppOptionsEnableVignette) { + text = "Enable"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "329 7"; + extent = "53 20"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enable/Disable the vignette postFX"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiSliderCtrl(ppOptionsVignetteVMax) { + range = "0.001 5"; + ticks = "1000"; + snap = "0"; + value = "0.6"; + position = "96 46"; + extent = "221 17"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiSliderBoxProfile"; + visible = "1"; + active = "1"; + variable = "$VignettePostEffect::VMax"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsVignetteVMaxLabel) { + text = "Radius"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "26 48"; + extent = "41 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Controls the maximum exposure of vignetting."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + new GuiTabPageCtrl() { + fitBook = "0"; + text = "Color Correction"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "8 27"; + extent = "376 200"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTabPageProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "ColorCorrectionTab"; + canSave = "1"; + canSaveDynamicFields = "0"; + + new GuiTextCtrl() { + text = "Color Correction Ramp"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "6 7"; + extent = "118 13"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextEditCtrl() { + historySize = "0"; + tabComplete = "0"; + sinkAllKeyEvents = "0"; + password = "0"; + passwordMask = "*"; + text = "core/postFX/images/null_color_ramp.png"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "6 29"; + extent = "365 18"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextEditProfile"; + visible = "1"; + active = "1"; + altCommand = "ppColorCorrection_selectFileHandler( $thisControl.getText() );"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "1"; + internalName = "ColorCorrectionFileName"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Select..."; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "252 54"; + extent = "56 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "ppColorCorrection_selectFile();"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "ColorCorrectionButton"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl() { + text = "Reset"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "315 54"; + extent = "56 22"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "ppColorCorrection_selectFileHandler( \"\" );"; + tooltipProfile = "GuiToolTipProfile"; + hovertime = "1000"; + isContainer = "0"; + internalName = "ColorCorrectionReset"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; + }; + new GuiButtonCtrl(ppOptionsApply) { + text = "Apply"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "309 302"; + extent = "93 23"; + minExtent = "8 8"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "PostFXManager.settingsApplyAll(); Canvas.popDialog(PostFXManager);"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Apply the settings and close this dialog"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl(ppOptionsSavePreset) { + text = "Save Preset..."; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "111 302"; + extent = "93 23"; + minExtent = "8 8"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "PostFXManager.savePresetFile();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Save the preset to a file to disk for later use (use postfx::applyPreset)"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl(ppOptionsLoadPreset) { + text = "Load Preset..."; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "12 302"; + extent = "93 23"; + minExtent = "8 8"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "PostFXManager.loadPresetFile();"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Load a post FX preset file from disk"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiCheckBoxCtrl(ppOptionsEnable) { + useInactiveState = "0"; + text = "Enable PostFX System"; + groupNum = "-1"; + buttonType = "ToggleButton"; + useMouseEvents = "0"; + position = "13 24"; + extent = "127 30"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiCheckBoxProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Enable or Disable the postFX system"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiPopUpMenuCtrl(ppOptionsQuality) { + maxPopupHeight = "200"; + sbUsesNAColor = "0"; + reverseTextList = "0"; + bitmapBounds = "16 16"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "278 30"; + extent = "122 21"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiPopUpMenuProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Used to adjust the quality/performance settings of the PostFX system. Some PostFX may not adhere to the settings in this dialog."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiTextCtrl(ppOptionsQualityLabel) { + text = "Quality"; + maxLength = "1024"; + margin = "0 0 0 0"; + padding = "0 0 0 0"; + anchorTop = "1"; + anchorBottom = "0"; + anchorLeft = "1"; + anchorRight = "0"; + position = "238 32"; + extent = "39 12"; + minExtent = "8 2"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiTextProfile"; + visible = "1"; + active = "1"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Used to adjust the quality/performance settings of the PostFX system. Some PostFX may not adhere to the settings in this dialog."; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + new GuiButtonCtrl(ppOptionsOk1) { + text = "Revert"; + groupNum = "-1"; + buttonType = "PushButton"; + useMouseEvents = "0"; + position = "210 302"; + extent = "93 23"; + minExtent = "8 8"; + horizSizing = "right"; + vertSizing = "bottom"; + profile = "GuiButtonProfile"; + visible = "1"; + active = "1"; + command = "postProcessOptionsDlg.applySettings(); Canvas.popDialog(postProcessOptionsDlg);"; + tooltipProfile = "GuiToolTipProfile"; + tooltip = "Revert any changes made since opening the dialog"; + hovertime = "1000"; + isContainer = "0"; + canSave = "1"; + canSaveDynamicFields = "0"; + }; + }; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/core/postFX/images/AreaMap33.dds b/Templates/BaseGame/game/core/postFX/images/AreaMap33.dds new file mode 100644 index 0000000000000000000000000000000000000000..e01982a94528594a375ae6e61c44780a8e1c0b68 GIT binary patch literal 109028 zcmeI5iFZ_0wuhNfX$3`^L4AY}f-Hm>Xh5K`9}tMZLI^Ab84N>Ylu2fN|IYh6-}}Bw zcDP(BWU8uj2UP(;v<48Z{Gf$v}=tOI*XXYs`_r*&BzL4@;I&oE;IoO1@@ z-_Q@=g7eNAu(w_h~o^*6)9TxpEUY z?^wgX0B4?$V9x2XID)9=v0h?^AFEw~GvMcp*6%&g2j)umhN6bsTRQWo%Q^MgcyR;~ z&0`sgdoT>nIrfx?z`aWMg(6ov?^wfEf&cqtXCC)1=Zr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HLkV1nj@91s8i literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/postFX/images/caustics_2.png b/Templates/BaseGame/game/core/postFX/images/caustics_2.png new file mode 100644 index 0000000000000000000000000000000000000000..99097fa0ed112c28958363f2951478a0955218ec GIT binary patch literal 33963 zcmXt91yGw^(+y53?yfEF?$Dy8g%+3M!L7Kv7cIrzrC6ZAi$fsA-5r9v75D$?H}i+d z1Tq8M+}(Tk>^Wz@e^F7u!XU>0fk0Rv6lK*wAOzrB1Q0qZ@S^WrW&ymQntoJ}1-<{B*J+^mJH=Z0)c2jA7tNYcrK2# zpW1?TQ{H+T>If3!6Vtt)H{*UsobAdZM{S;@binkkX7PQ?*DS}=_aD3F>&8Z8hY`-k&jPI zObj`_d$F{%guQ%LQ3-#^&B?(Y>lr)yw*7GD>wi|~ak@$+etLJ;oSmKBu)Dh(V!IJ= z=OQ5~`CngO-}U3;vctD;Oa7fS{@1s+^Vbi4KK}mHIUxb(k+Vv3;dAJ7qld2U?t;D? z#L@2V?z1YNKQApT=w_;v!fcP-TdyxKrv)>WmyX@-8Vmde-amVgH zj>@;*-rm0hV7bb3v&VP_wvC^cbEKrCXl6Yna~tyz0nM%&|jn;46ZC%aK@xu zB68PoPQPcytSOgHb}8Ih*$Ny|kH`56l2Jo@_vo^?Fx z?p!plRK~~0A75U&ay!^zx@}%#Hj7E$*B#ZJU0t-tV2=z8d{{cYF(^$W3#_ZF6U-fx zVc^ak1J>f_lz09(Vlg#3I*L6@Wb5JWy_l1eW4Ih(_|=VjLGQ4`G536>)ni{|L*ViH z_^apGt((dCCC`Ak-b{fB9&3V3eXS$I-AhxtFuD$@ovV0<-^2BWo_ni-n1~3OA<`Vq zSQOGT5JOHbuBFY*%^*5x_&98*?cINp6J2EBH%{3JBrZAH5T3=N+pjkrXOGDW^#gZ) zXJls?P4cAd9i=nqfj9l8wN?*L&rozI_h0Jx7?8r3lfXK<$e6(AxVdbsy67(pUCq0) zmWg9H^!;}6?cAVr1)m{>ox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U!PHBsYjs7~_SLBQ81DMiWhkA{K&2MO=rQ2+n{ literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/postFX/images/inactive-overlay.png b/Templates/BaseGame/game/core/postFX/images/inactive-overlay.png new file mode 100644 index 0000000000000000000000000000000000000000..feab83209cc442c5ad8dc73c2b86e0a8115c4743 GIT binary patch literal 131 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE;=WQl7;NpOBzNqJ&XDuZK6ep0G} zXKrG8YEWuoN@d~6R2!foRZkbkkcwMLfBw9D?8~Obq{gPz9LVg>D`Q%4bP0l+XkKL$W0) literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/postFX/images/materials.cs b/Templates/BaseGame/game/core/postFX/images/materials.cs new file mode 100644 index 000000000..a13c751b3 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/images/materials.cs @@ -0,0 +1,32 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton Material( Empty ) +{ +}; + +singleton Material(WarningMaterial) { + detailMap[0] = "missingTexture"; + diffuseColor[0] = "25 16 0"; + emissive[0] = false; + translucent = false; +}; diff --git a/Templates/BaseGame/game/core/postFX/images/missingTexture.png b/Templates/BaseGame/game/core/postFX/images/missingTexture.png new file mode 100644 index 0000000000000000000000000000000000000000..80a7874da967ad523e1a3308f3f14c66d4eed503 GIT binary patch literal 10645 zcmeHt_g_=nv-S>MP*4G}5D zE)M{}2HO)>E&w0_UP=IR;uB`OWifby#JJe}1(bZ=$pUYrf{!^I1Ay{Og|)NN;Jrq` z2^R+dNYVlT{1pIL1%JX%0zljW0ATwAz>!A)pca`+I&~C$ur=1&Bla{ZC>DJ-IuLL^ z8xj$#?`VBSBi=~g$mHe34;TRG%-UKVJCoqY8R)nTt4Wj@8hvs%d{1KNr?xiU)_B0| z+7+EhAVlIH#XmZ9|CID_(Qv5yDZOXu@y5f{V}%$}%egGwEtKGbJP%!*l4r70&kBpO zHi%9chC(Eya@_q?(O0*?p4!+(o;xCRQ=&;Y;#LgNMEO9jm0 zw}{`q`1Ct2eq-c!zW6_Lr@r3Y%m6t>I4~;|)=&gvH`G!D?kNuhvyDpT%hMtec4+{e zt=~VykQXQAAhi<=?Dr{)s%IsBk-+%(|fnO4tz)x-~$ zcAw2-a%xb_wdH0DecftgWwrtG^PBTw#Zp22La(0q0bG(4;=ArRgjEyMae9QAwYC;) zG1ctS8Pk!YZ`v5o zYUJDYch3JMVHA;~_G8Mp8;V>0d+kSm&wNLYXmM3Gkje=q`6Ofy zD_zR&n+?%K@M_94S*HU13tQRHJ{CgTl0%r1n1ES&cD_1U19(;Q>v8{&UR^?kmcn>)s426(+T;E$x zxm@3o^_?CvxwRVhj(VVvwyvmC!?o?8o_js@i@$RjLa$qqC=0l?bX*e$ zbzTsYADRrT$8GFJoi+>n3%)|ncitA+R-t?NCGhA>!Qhq^ADZT1)s(w$>r)g%ixVMe z^DLTBro?u}lhmfdJ2@!BvFp)}@8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&qiH_s&a$W`V(<12K+=d5xE}}EA7UPZO#QZH8#l zXaqaEqrvnO-j2)17fB)bx$Q&cC1c!DP(!v$8%m39u_y2lj)x7#@LYjv58V!lBlGZQ zcOP`cmOyEH8}{fefKs6ogvX`g==O!EbJ>gFd{=C$Iu0#^04(sRL8Rwq=mf;zS!)5T z=l;fns0*-&-j8aWhFw!FI!X;8F7ge(#xKCP#jCMHu?go~?n1wNGPeCozz>&X3>WW% z$jX;)XsfYdY;jzdEpAUV5j@1IRjg!VO z0|`t!cMc!lreIn5U--%{!8dPDyfZ$B+jmbuWZ*~W9SahKoUJfS48r_O16++l zPnwwTM`-Va%1V@TU+ zP0V{%%ak@JhD%RlFxs3fKQVtGntklu5JR@I>BQih3;N+y-OT>dj|Cb{-#| z?523~R>r$aP-M+oPPsmYRsteh@=%n!ul6w~uAaJ$Yk0g`l?ijCxzlY3<(@e(Pkt4z zyw+#U{s!vkMzGrS1@)#Cuy^wnj!C`24-rlRt2Ly3sXjX=ZsjhQU)uZ>J(3=xOl(0QP-!(>N?>&;S4c07*qo IM6N<$f@#CI-2eap literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/postFX/images/null_color_ramp.png b/Templates/BaseGame/game/core/postFX/images/null_color_ramp.png new file mode 100644 index 0000000000000000000000000000000000000000..5f5a52186eb93cb7ace739e645e5e8f8e6b8050d GIT binary patch literal 2843 zcmV+$3*_{PP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!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>dT z6;YxH@%w9akm)x?(Kj>n3)5)9I$smUawCb>x3QeR@YQcmD4=hx$YC$he7T7~oXuRp zmZQ^&Ind5fp+5SXu=SO-qIl)Ni#%Y;k)kndF&w+o-{x5?l^G<9h$i@z5UzdWU58m- zgYfD6bM6ErhkMDnuL;Epd{)898ULFWYRz-B%CmJ@_hdZfd%3~`RmT4qI38Yg6POid zBb9F-#lZ{OQ^~Y-y^=d7O6UD_w_Y8VHU&a^>rYBNVm;5i_1f=$GQeO16s^Gud(#5) zq<{p|OpiXZ+7Sy=myMHyK(5^%z(IWdVRrqI^$#4Jufh}r7;tVh`hUNG;s~_bzySc0 z|2hW5$Kd$Cy=TJg`b+=%tN+vS|NgB0^X2{P-~adH{|{Hy`p@%mNe l814Vh^#9YDKE&YBKxnPL?nJ&?puN6t$_nc8<+5fW{|kT=cUJ%a literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/postFX/images/warnMat.dds b/Templates/BaseGame/game/core/postFX/images/warnMat.dds new file mode 100644 index 0000000000000000000000000000000000000000..ea99dcbd74a8b2ae49c5cff5a69743498a66e937 GIT binary patch literal 699192 zcmeFaPi$M+p67Q(#Rw%q$lVCxuCM)|w4M~V{T2fJ7L9l5=?1EHs%~9T&ZsR?vxyfI zsJbygxsX^C8(DbKi&_Xl?Ia2f*klZ%fGCLvqZVm(77oyhDio(NUSwqH4PbCKf$})> zK(x$!f9LR!6h(@c5=l|gmq67qMe^Qr&pE%(@6Y+2bN=K{{@nQ=Ez9~Z?NQ76FYpif z&kD-_tTFX}|NnFFRr&d!EYAO`*{_1Od*;t>$tlSnS+X5C4k!oY069PokOSlZIY17O z1LOcXKn{=tbP?mEh4x0G{HM%>a}6jFwRD81ID`aV8azt6j+Y!2Ta>0>S?>#-q__zuK?WeVjr#I665w zc~jc8`_Ccz-TFrP=kceWh4zA)_i}DHIFIpvT8|g^R&40;d^w{^DEb86pH#|nIj!D{ z{+GX(_fn&(Or@-j%Fn4+>igz8<&wJIGA_I#_c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cmV?d00001 diff --git a/Templates/BaseGame/game/core/postFX/scripts/GammaPostFX.cs b/Templates/BaseGame/game/core/postFX/scripts/GammaPostFX.cs new file mode 100644 index 000000000..293d44714 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/GammaPostFX.cs @@ -0,0 +1,73 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton ShaderData( GammaShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gammaP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/gammaP.glsl"; + + samplerNames[0] = "$backBuffer"; + samplerNames[1] = "$colorCorrectionTex"; + + pixVersion = 2.0; +}; + +singleton GFXStateBlockData( GammaStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerClampLinear; +}; + +singleton PostEffect( GammaPostFX ) +{ + isEnabled = true; + allowReflectPass = true; + + renderTime = "PFXBeforeBin"; + renderBin = "EditorBin"; + renderPriority = 9998; + + shader = GammaShader; + stateBlock = GammaStateBlock; + + texture[0] = "$backBuffer"; + texture[1] = $HDRPostFX::colorCorrectionRamp; + textureSRGB[1] = true; +}; + +function GammaPostFX::preProcess( %this ) +{ + if ( %this.texture[1] !$= $HDRPostFX::colorCorrectionRamp ) + %this.setTexture( 1, $HDRPostFX::colorCorrectionRamp ); +} + +function GammaPostFX::setShaderConsts( %this ) +{ + %clampedGamma = mClamp( $pref::Video::Gamma, 2.0, 2.5); + %this.setShaderConst( "$OneOverGamma", 1 / %clampedGamma ); + %this.setShaderConst( "$Brightness", $pref::Video::Brightness ); + %this.setShaderConst( "$Contrast", $pref::Video::Contrast ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/scripts/MLAA.cs b/Templates/BaseGame/game/core/postFX/scripts/MLAA.cs new file mode 100644 index 000000000..491c98e4e --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/MLAA.cs @@ -0,0 +1,186 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + +// NOTE: This is currently disabled in favor of FXAA. See +// core\scripts\client\canvas.cs if you want to re-enable it. + +singleton GFXStateBlockData( MLAA_EdgeDetectStateBlock : PFX_DefaultStateBlock ) +{ + // Mark the edge pixels in stencil. + stencilDefined = true; + stencilEnable = true; + stencilPassOp = GFXStencilOpReplace; + stencilFunc = GFXCmpAlways; + stencilRef = 1; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; +}; + +singleton ShaderData( MLAA_EdgeDetectionShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/offsetV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/edgeDetectionP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/offsetV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/edgeDetectionP.glsl"; + + samplerNames[0] = "$colorMapG"; + samplerNames[1] = "$deferredMap"; + + pixVersion = 3.0; +}; + +singleton GFXStateBlockData( MLAA_BlendWeightCalculationStateBlock : PFX_DefaultStateBlock ) +{ + // Here we want to process only marked pixels. + stencilDefined = true; + stencilEnable = true; + stencilPassOp = GFXStencilOpKeep; + stencilFunc = GFXCmpEqual; + stencilRef = 1; + + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; + samplerStates[1] = SamplerClampLinear; + samplerStates[2] = SamplerClampPoint; +}; + +singleton ShaderData( MLAA_BlendWeightCalculationShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/passthruV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/blendWeightCalculationP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/passthruV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/blendWeightCalculationP.glsl"; + + samplerNames[0] = "$edgesMap"; + samplerNames[1] = "$edgesMapL"; + samplerNames[2] = "$areaMap"; + + pixVersion = 3.0; +}; + +singleton GFXStateBlockData( MLAA_NeighborhoodBlendingStateBlock : PFX_DefaultStateBlock ) +{ + // Here we want to process only marked pixels too. + stencilDefined = true; + stencilEnable = true; + stencilPassOp = GFXStencilOpKeep; + stencilFunc = GFXCmpEqual; + stencilRef = 1; + + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; + samplerStates[1] = SamplerClampLinear; + samplerStates[2] = SamplerClampPoint; +}; + +singleton ShaderData( MLAA_NeighborhoodBlendingShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/offsetV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/neighborhoodBlendingP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/offsetV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/mlaa/gl/neighborhoodBlendingP.glsl"; + + samplerNames[0] = "$blendMap"; + samplerNames[1] = "$colorMapL"; + samplerNames[2] = "$colorMap"; + + pixVersion = 3.0; +}; + + +singleton PostEffect( MLAAFx ) +{ + isEnabled = false; + + allowReflectPass = false; + renderTime = "PFXAfterDiffuse"; + + texture[0] = "$backBuffer"; //colorMapG + texture[1] = "#deferred"; // Used for depth detection + + target = "$outTex"; + targetClear = PFXTargetClear_OnDraw; + targetClearColor = "0 0 0 0"; + + stateBlock = MLAA_EdgeDetectStateBlock; + shader = MLAA_EdgeDetectionShader; + + // The luma calculation weights which can be user adjustable + // per-scene if nessasary. The default value of... + // + // 0.2126 0.7152 0.0722 + // + // ... is the HDTV ITU-R Recommendation BT. 709. + lumaCoefficients = "0.2126 0.7152 0.0722"; + + // The tweakable color threshold used to select + // the range of edge pixels to blend. + threshold = 0.1; + + // The depth delta threshold used to select + // the range of edge pixels to blend. + depthThreshold = 0.01; + + new PostEffect() + { + internalName = "blendingWeightsCalculation"; + + target = "$outTex"; + targetClear = PFXTargetClear_OnDraw; + + shader = MLAA_BlendWeightCalculationShader; + stateBlock = MLAA_BlendWeightCalculationStateBlock; + + texture[0] = "$inTex"; // Edges mask + texture[1] = "$inTex"; // Edges mask + texture[2] = "core/postFX/images/AreaMap33.dds"; + }; + + new PostEffect() + { + internalName = "neighborhoodBlending"; + + shader = MLAA_NeighborhoodBlendingShader; + stateBlock = MLAA_NeighborhoodBlendingStateBlock; + + texture[0] = "$inTex"; // Blend weights + texture[1] = "$backBuffer"; + texture[2] = "$backBuffer"; + }; +}; + +function MLAAFx::setShaderConsts(%this) +{ + %this.setShaderConst("$lumaCoefficients", %this.lumaCoefficients); + %this.setShaderConst("$threshold", %this.threshold); + %this.setShaderConst("$depthThreshold", %this.depthThreshold); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/scripts/MotionBlurFx.cs b/Templates/BaseGame/game/core/postFX/scripts/MotionBlurFx.cs new file mode 100644 index 000000000..6919cc5a7 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/MotionBlurFx.cs @@ -0,0 +1,53 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton ShaderData( PFX_MotionBlurShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; //we use the bare-bones postFxV.hlsl + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/motionBlurP.hlsl"; //new pixel shader + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/motionBlurP.glsl"; + + samplerNames[0] = "$backBuffer"; + samplerNames[1] = "$deferredTex"; + + pixVersion = 3.0; +}; + +singleton PostEffect(MotionBlurFX) +{ + isEnabled = false; + + renderTime = "PFXAfterDiffuse"; + + shader = PFX_MotionBlurShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backbuffer"; + texture[1] = "#deferred"; + target = "$backBuffer"; +}; + +function MotionBlurFX::setShaderConsts(%this) +{ + %this.setShaderConst( "$velocityMultiplier", 3000 ); +} diff --git a/Templates/BaseGame/game/core/postFX/scripts/caustics.cs b/Templates/BaseGame/game/core/postFX/scripts/caustics.cs new file mode 100644 index 000000000..7dcea20a5 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/caustics.cs @@ -0,0 +1,64 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton GFXStateBlockData( PFX_CausticsStateBlock : PFX_DefaultStateBlock ) +{ + blendDefined = true; + blendEnable = true; + blendSrc = GFXBlendOne; + blendDest = GFXBlendOne; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerWrapLinear; + samplerStates[2] = SamplerWrapLinear; +}; + +singleton ShaderData( PFX_CausticsShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/caustics/causticsP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/caustics/gl/causticsP.glsl"; + + samplerNames[0] = "$deferredTex"; + samplerNames[1] = "$causticsTex0"; + samplerNames[2] = "$causticsTex1"; + + pixVersion = 3.0; +}; + +singleton PostEffect( CausticsPFX ) +{ + isEnabled = false; + renderTime = "PFXAfterDiffuse"; + renderBin = "ObjTranslucentBin"; + //renderPriority = 0.1; + + shader = PFX_CausticsShader; + stateBlock = PFX_CausticsStateBlock; + texture[0] = "#deferred"; + texture[1] = "core/postFX/images/caustics_1"; + texture[2] = "core/postFX/images/caustics_2"; + target = "$backBuffer"; +}; diff --git a/Templates/BaseGame/game/core/postFX/scripts/chromaticLens.cs b/Templates/BaseGame/game/core/postFX/scripts/chromaticLens.cs new file mode 100644 index 000000000..06b8d3988 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/chromaticLens.cs @@ -0,0 +1,77 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +/// +$CAPostFx::enabled = false; + +/// The lens distortion coefficient. +$CAPostFx::distCoeffecient = -0.05; + +/// The cubic distortion value. +$CAPostFx::cubeDistortionFactor = -0.1; + +/// The amount and direction of the maxium shift for +/// the red, green, and blue channels. +$CAPostFx::colorDistortionFactor = "0.005 -0.005 0.01"; + + +singleton GFXStateBlockData( PFX_DefaultChromaticLensStateBlock ) +{ + zDefined = true; + zEnable = false; + zWriteEnable = false; + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; +}; + +singleton ShaderData( PFX_ChromaticLensShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/chromaticLens.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/chromaticLens.glsl"; + + samplerNames[0] = "$backBuffer"; + + pixVersion = 3.0; +}; + +singleton PostEffect( ChromaticLensPostFX ) +{ + renderTime = "PFXAfterDiffuse"; + renderPriority = 0.2; + isEnabled = false; + allowReflectPass = false; + + shader = PFX_ChromaticLensShader; + stateBlock = PFX_DefaultChromaticLensStateBlock; + texture[0] = "$backBuffer"; + target = "$backBuffer"; +}; + +function ChromaticLensPostFX::setShaderConsts( %this ) +{ + %this.setShaderConst( "$distCoeff", $CAPostFx::distCoeffecient ); + %this.setShaderConst( "$cubeDistort", $CAPostFx::cubeDistortionFactor ); + %this.setShaderConst( "$colorDistort", $CAPostFx::colorDistortionFactor ); +} diff --git a/Templates/BaseGame/game/core/postFX/scripts/default.postfxpreset.cs b/Templates/BaseGame/game/core/postFX/scripts/default.postfxpreset.cs new file mode 100644 index 000000000..6054d52ee --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/default.postfxpreset.cs @@ -0,0 +1,72 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +$PostFXManager::Settings::EnableVignette = "1"; +$PostFXManager::Settings::EnableDOF = "1"; +$PostFXManager::Settings::EnabledSSAO = "1"; +$PostFXManager::Settings::EnableHDR = "1"; +$PostFXManager::Settings::EnableLightRays = "1"; +$PostFXManager::Settings::EnablePostFX = "1"; +$PostFXManager::Settings::Vignette::VMax = "0.6"; +$PostFXManager::Settings::DOF::BlurCurveFar = ""; +$PostFXManager::Settings::DOF::BlurCurveNear = ""; +$PostFXManager::Settings::DOF::BlurMax = ""; +$PostFXManager::Settings::DOF::BlurMin = ""; +$PostFXManager::Settings::DOF::EnableAutoFocus = ""; +$PostFXManager::Settings::DOF::EnableDOF = ""; +$PostFXManager::Settings::DOF::FocusRangeMax = ""; +$PostFXManager::Settings::DOF::FocusRangeMin = ""; +$PostFXManager::Settings::HDR::adaptRate = "2"; +$PostFXManager::Settings::HDR::blueShiftColor = "1.05 0.97 1.27"; +$PostFXManager::Settings::HDR::brightPassThreshold = "1"; +$PostFXManager::Settings::HDR::enableBloom = "1"; +$PostFXManager::Settings::HDR::enableBlueShift = "0"; +$PostFXManager::Settings::HDR::enableToneMapping = "0.5"; +$PostFXManager::Settings::HDR::gaussMean = "0"; +$PostFXManager::Settings::HDR::gaussMultiplier = "0.3"; +$PostFXManager::Settings::HDR::gaussStdDev = "0.8"; +$PostFXManager::Settings::HDR::keyValue = "0.18"; +$PostFXManager::Settings::HDR::minLuminace = "0.001"; +$PostFXManager::Settings::HDR::whiteCutoff = "1"; +$PostFXManager::Settings::LightRays::brightScalar = "0.75"; +$PostFXManager::Settings::LightRays::decay = "1.0"; +$PostFXManager::Settings::LightRays::density = "0.94"; +$PostFXManager::Settings::LightRays::numSamples = "40"; +$PostFXManager::Settings::LightRays::weight = "5.65"; +$PostFXManager::Settings::SSAO::blurDepthTol = "0.001"; +$PostFXManager::Settings::SSAO::blurNormalTol = "0.95"; +$PostFXManager::Settings::SSAO::lDepthMax = "2"; +$PostFXManager::Settings::SSAO::lDepthMin = "0.2"; +$PostFXManager::Settings::SSAO::lDepthPow = "0.2"; +$PostFXManager::Settings::SSAO::lNormalPow = "2"; +$PostFXManager::Settings::SSAO::lNormalTol = "-0.5"; +$PostFXManager::Settings::SSAO::lRadius = "1"; +$PostFXManager::Settings::SSAO::lStrength = "10"; +$PostFXManager::Settings::SSAO::overallStrength = "2"; +$PostFXManager::Settings::SSAO::quality = "0"; +$PostFXManager::Settings::SSAO::sDepthMax = "1"; +$PostFXManager::Settings::SSAO::sDepthMin = "0.1"; +$PostFXManager::Settings::SSAO::sDepthPow = "1"; +$PostFXManager::Settings::SSAO::sNormalPow = "1"; +$PostFXManager::Settings::SSAO::sNormalTol = "0"; +$PostFXManager::Settings::SSAO::sRadius = "0.1"; +$PostFXManager::Settings::SSAO::sStrength = "6"; +$PostFXManager::Settings::ColorCorrectionRamp = "core/postFX/images/null_color_ramp.png"; diff --git a/Templates/BaseGame/game/core/postFX/scripts/dof.cs b/Templates/BaseGame/game/core/postFX/scripts/dof.cs new file mode 100644 index 000000000..736c288b2 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/dof.cs @@ -0,0 +1,599 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +/* + +================================================================================ + The DOFPostEffect API +================================================================================ + +DOFPostEffect::setFocalDist( %dist ) + +@summary +This method is for manually controlling the focus distance. It will have no +effect if auto focus is currently enabled. Makes use of the parameters set by +setFocusParams. + +@param dist +float distance in meters + +-------------------------------------------------------------------------------- + +DOFPostEffect::setAutoFocus( %enabled ) + +@summary +This method sets auto focus enabled or disabled. Makes use of the parameters set +by setFocusParams. When auto focus is enabled it determines the focal depth +by performing a raycast at the screen-center. + +@param enabled +bool + +-------------------------------------------------------------------------------- + +DOFPostEffect::setFocusParams( %nearBlurMax, %farBlurMax, %minRange, %maxRange, %nearSlope, %farSlope ) + +Set the parameters that control how the near and far equations are calculated +from the focal distance. If you are not using auto focus you will need to call +setFocusParams PRIOR to calling setFocalDist. + +@param nearBlurMax +float between 0.0 and 1.0 +The max allowed value of near blur. + +@param farBlurMax +float between 0.0 and 1.0 +The max allowed value of far blur. + +@param minRange/maxRange +float in meters +The distance range around the focal distance that remains in focus is a lerp +between the min/maxRange using the normalized focal distance as the parameter. +The point is to allow the focal range to expand as you focus farther away since this is +visually appealing. + +Note: since min/maxRange are lerped by the "normalized" focal distance it is +dependant on the visible distance set in your level. + +@param nearSlope +float less than zero +The slope of the near equation. A small number causes bluriness to increase gradually +at distances closer than the focal distance. A large number causes bluriness to +increase quickly. + +@param farSlope +float greater than zero +The slope of the far equation. A small number causes bluriness to increase gradually +at distances farther than the focal distance. A large number causes bluriness to +increase quickly. + +Note: To rephrase, the min/maxRange parameters control how much area around the +focal distance is completely in focus where the near/farSlope parameters control +how quickly or slowly bluriness increases at distances outside of that range. + +================================================================================ + Examples +================================================================================ + +Example1: Turn on DOF while zoomed in with a weapon. + +NOTE: These are not real callbacks! Hook these up to your code where appropriate! + +function onSniperZoom() +{ + // Parameterize how you want DOF to look. + DOFPostEffect.setFocusParams( 0.3, 0.3, 50, 500, -5, 5 ); + + // Turn on auto focus + DOFPostEffect.setAutoFocus( true ); + + // Turn on the PostEffect + DOFPostEffect.enable(); +} + +function onSniperUnzoom() +{ + // Turn off the PostEffect + DOFPostEffect.disable(); +} + +Example2: Manually control DOF with the mouse wheel. + +// Somewhere on startup... + +// Parameterize how you want DOF to look. +DOFPostEffect.setFocusParams( 0.3, 0.3, 50, 500, -5, 5 ); + +// Turn off auto focus +DOFPostEffect.setAutoFocus( false ); + +// Turn on the PostEffect +DOFPostEffect.enable(); + + +NOTE: These are not real callbacks! Hook these up to your code where appropriate! + +function onMouseWheelUp() +{ + // Since setFocalDist is really just a wrapper to assign to the focalDist + // dynamic field we can shortcut and increment it directly. + DOFPostEffect.focalDist += 8; +} + +function onMouseWheelDown() +{ + DOFPostEffect.focalDist -= 8; +} +*/ + +/// This method is for manually controlling the focal distance. It will have no +/// effect if auto focus is currently enabled. Makes use of the parameters set by +/// setFocusParams. +function DOFPostEffect::setFocalDist( %this, %dist ) +{ + %this.focalDist = %dist; +} + +/// This method sets auto focus enabled or disabled. Makes use of the parameters set +/// by setFocusParams. When auto focus is enabled it determine the focal depth +/// by performing a raycast at the screen-center. +function DOFPostEffect::setAutoFocus( %this, %enabled ) +{ + %this.autoFocusEnabled = %enabled; +} + +/// Set the parameters that control how the near and far equations are calculated +/// from the focal distance. If you are not using auto focus you will need to call +/// setFocusParams PRIOR to calling setFocalDist. +function DOFPostEffect::setFocusParams( %this, %nearBlurMax, %farBlurMax, %minRange, %maxRange, %nearSlope, %farSlope ) +{ + %this.nearBlurMax = %nearBlurMax; + %this.farBlurMax = %farBlurMax; + %this.minRange = %minRange; + %this.maxRange = %maxRange; + %this.nearSlope = %nearSlope; + %this.farSlope = %farSlope; +} + +/* + +More information... + +This DOF technique is based on this paper: +http://http.developer.nvidia.com/GPUGems3/gpugems3_ch28.html + +================================================================================ +1. Overview of how we represent "Depth of Field" +================================================================================ + +DOF is expressed as an amount of bluriness per pixel according to its depth. +We represented this by a piecewise linear curve depicted below. + +Note: we also refer to "bluriness" as CoC ( circle of confusion ) which is the term +used in the basis paper and in photography. + + +X-axis (depth) +x = 0.0----------------------------------------------x = 1.0 + +Y-axis (bluriness) +y = 1.0 + | + | ____(x1,y1) (x4,y4)____ + | (ns,nb)\ <--Line1 line2---> /(fe,fb) + | \ / + | \(x2,y2) (x3,y3)/ + | (ne,0)------(fs,0) +y = 0.0 + + +I have labeled the "corners" of this graph with (Xn,Yn) to illustrate that +this is in fact a collection of line segments where the x/y of each point +corresponds to the key below. + +key: +ns - (n)ear blur (s)tart distance +nb - (n)ear (b)lur amount (max value) +ne - (n)ear blur (e)nd distance +fs - (f)ar blur (s)tart distance +fe - (f)ar blur (e)nd distance +fb - (f)ar (b)lur amount (max value) + +Of greatest importance in this graph is Line1 and Line2. Where... +L1 { (x1,y1), (x2,y2) } +L2 { (x3,y3), (x4,y4) } + +Line one represents the amount of "near" blur given a pixels depth and line two +represents the amount of "far" blur at that depth. + +Both these equations are evaluated for each pixel and then the larger of the two +is kept. Also the output blur (for each equation) is clamped between 0 and its +maximum allowable value. + +Therefore, to specify a DOF "qualify" you need to specify the near-blur-line, +far-blur-line, and maximum near and far blur value. + +================================================================================ +2. Abstracting a "focal depth" +================================================================================ + +Although the shader(s) work in terms of a near and far equation it is more +useful to express DOF as an adjustable focal depth and derive the other parameters +"under the hood". + +Given a maximum near/far blur amount and a near/far slope we can calculate the +near/far equations for any focal depth. We extend this to also support a range +of depth around the focal depth that is also in focus and for that range to +shrink or grow as the focal depth moves closer or farther. + +Keep in mind this is only one implementation and depending on the effect you +desire you may which to express the relationship between focal depth and +the shader paramaters different. + +*/ + +//----------------------------------------------------------------------------- +// GFXStateBlockData / ShaderData +//----------------------------------------------------------------------------- + +singleton GFXStateBlockData( PFX_DefaultDOFStateBlock ) +{ + zDefined = true; + zEnable = false; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; + samplerStates[1] = SamplerClampPoint; +}; + +singleton GFXStateBlockData( PFX_DOFCalcCoCStateBlock ) +{ + zDefined = true; + zEnable = false; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerClampLinear; +}; + +singleton GFXStateBlockData( PFX_DOFDownSampleStateBlock ) +{ + zDefined = true; + zEnable = false; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerClampPoint; +}; + +singleton GFXStateBlockData( PFX_DOFBlurStateBlock ) +{ + zDefined = true; + zEnable = false; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; +}; + +singleton GFXStateBlockData( PFX_DOFFinalStateBlock ) +{ + zDefined = true; + zEnable = false; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerClampLinear; + samplerStates[2] = SamplerClampLinear; + samplerStates[3] = SamplerClampPoint; + + blendDefined = true; + blendEnable = true; + blendDest = GFXBlendInvSrcAlpha; + blendSrc = GFXBlendOne; +}; + +singleton ShaderData( PFX_DOFDownSampleShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_DownSample_V.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_DownSample_P.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_DownSample_V.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_DownSample_P.glsl"; + + samplerNames[0] = "$colorSampler"; + samplerNames[1] = "$depthSampler"; + + pixVersion = 3.0; +}; + +singleton ShaderData( PFX_DOFBlurYShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_Gausian_V.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_Gausian_P.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_Gausian_V.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_Gausian_P.glsl"; + + samplerNames[0] = "$diffuseMap"; + + pixVersion = 2.0; + defines = "BLUR_DIR=float2(0.0,1.0)"; +}; + +singleton ShaderData( PFX_DOFBlurXShader : PFX_DOFBlurYShader ) +{ + defines = "BLUR_DIR=float2(1.0,0.0)"; +}; + +singleton ShaderData( PFX_DOFCalcCoCShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_CalcCoC_V.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_CalcCoC_P.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_CalcCoC_V.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_CalcCoC_P.glsl"; + + samplerNames[0] = "$shrunkSampler"; + samplerNames[1] = "$blurredSampler"; + + pixVersion = 3.0; +}; + +singleton ShaderData( PFX_DOFSmallBlurShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_SmallBlur_V.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_SmallBlur_P.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_SmallBlur_V.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_SmallBlur_P.glsl"; + + samplerNames[0] = "$colorSampler"; + + pixVersion = 3.0; +}; + +singleton ShaderData( PFX_DOFFinalShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_Final_V.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/DOF_Final_P.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_Final_V.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/dof/gl/DOF_Final_P.glsl"; + + samplerNames[0] = "$colorSampler"; + samplerNames[1] = "$smallBlurSampler"; + samplerNames[2] = "$largeBlurSampler"; + samplerNames[3] = "$depthSampler"; + + pixVersion = 3.0; +}; + +//----------------------------------------------------------------------------- +// PostEffects +//----------------------------------------------------------------------------- + +function DOFPostEffect::onAdd( %this ) +{ + // The weighted distribution of CoC value to the three blur textures + // in the order small, medium, large. Most likely you will not need to + // change this value. + %this.setLerpDist( 0.2, 0.3, 0.5 ); + + // Fill out some default values but DOF really should not be turned on + // without actually specifying your own parameters! + %this.autoFocusEnabled = false; + %this.focalDist = 0.0; + %this.nearBlurMax = 0.5; + %this.farBlurMax = 0.5; + %this.minRange = 50; + %this.maxRange = 500; + %this.nearSlope = -5.0; + %this.farSlope = 5.0; +} + +function DOFPostEffect::setLerpDist( %this, %d0, %d1, %d2 ) +{ + %this.lerpScale = -1.0 / %d0 SPC -1.0 / %d1 SPC -1.0 / %d2 SPC 1.0 / %d2; + %this.lerpBias = 1.0 SPC ( 1.0 - %d2 ) / %d1 SPC 1.0 / %d2 SPC ( %d2 - 1.0 ) / %d2; +} + +singleton PostEffect( DOFPostEffect ) +{ + renderTime = "PFXAfterBin"; + renderBin = "GlowBin"; + renderPriority = 0.1; + + shader = PFX_DOFDownSampleShader; + stateBlock = PFX_DOFDownSampleStateBlock; + texture[0] = "$backBuffer"; + texture[1] = "#deferred"; + target = "#shrunk"; + targetScale = "0.25 0.25"; + + isEnabled = false; +}; + +singleton PostEffect( DOFBlurY ) +{ + shader = PFX_DOFBlurYShader; + stateBlock = PFX_DOFBlurStateBlock; + texture[0] = "#shrunk"; + target = "$outTex"; +}; + +DOFPostEffect.add( DOFBlurY ); + +singleton PostEffect( DOFBlurX ) +{ + shader = PFX_DOFBlurXShader; + stateBlock = PFX_DOFBlurStateBlock; + texture[0] = "$inTex"; + target = "#largeBlur"; +}; + +DOFPostEffect.add( DOFBlurX ); + +singleton PostEffect( DOFCalcCoC ) +{ + shader = PFX_DOFCalcCoCShader; + stateBlock = PFX_DOFCalcCoCStateBlock; + texture[0] = "#shrunk"; + texture[1] = "#largeBlur"; + target = "$outTex"; +}; + +DOFPostEffect.add( DOFCalcCoc ); + +singleton PostEffect( DOFSmallBlur ) +{ + shader = PFX_DOFSmallBlurShader; + stateBlock = PFX_DefaultDOFStateBlock; + texture[0] = "$inTex"; + target = "$outTex"; +}; + +DOFPostEffect.add( DOFSmallBlur ); + +singleton PostEffect( DOFFinalPFX ) +{ + shader = PFX_DOFFinalShader; + stateBlock = PFX_DOFFinalStateBlock; + texture[0] = "$backBuffer"; + texture[1] = "$inTex"; + texture[2] = "#largeBlur"; + texture[3] = "#deferred"; + target = "$backBuffer"; +}; + +DOFPostEffect.add( DOFFinalPFX ); + + +//----------------------------------------------------------------------------- +// Scripts +//----------------------------------------------------------------------------- + +function DOFPostEffect::setShaderConsts( %this ) +{ + if ( %this.autoFocusEnabled ) + %this.autoFocus(); + + %fd = %this.focalDist / $Param::FarDist; + + %range = mLerp( %this.minRange, %this.maxRange, %fd ) / $Param::FarDist * 0.5; + + // We work in "depth" space rather than real-world units for the + // rest of this method... + + // Given the focal distance and the range around it we want in focus + // we can determine the near-end-distance and far-start-distance + + %ned = getMax( %fd - %range, 0.0 ); + %fsd = getMin( %fd + %range, 1.0 ); + + // near slope + %nsl = %this.nearSlope; + + // Given slope of near blur equation and the near end dist and amount (x2,y2) + // solve for the y-intercept + // y = mx + b + // so... + // y - mx = b + + %b = 0.0 - %nsl * %ned; + + %eqNear = %nsl SPC %b SPC 0.0; + + // Do the same for the far blur equation... + + %fsl = %this.farSlope; + + %b = 0.0 - %fsl * %fsd; + + %eqFar = %fsl SPC %b SPC 1.0; + + %this.setShaderConst( "$dofEqWorld", %eqNear ); + DOFFinalPFX.setShaderConst( "$dofEqFar", %eqFar ); + + %this.setShaderConst( "$maxWorldCoC", %this.nearBlurMax ); + DOFFinalPFX.setShaderConst( "$maxFarCoC", %this.farBlurMax ); + + DOFFinalPFX.setShaderConst( "$dofLerpScale", %this.lerpScale ); + DOFFinalPFX.setShaderConst( "$dofLerpBias", %this.lerpBias ); +} + +function DOFPostEffect::autoFocus( %this ) +{ + if ( !isObject( ServerConnection ) || + !isObject( ServerConnection.getCameraObject() ) ) + { + return; + } + + %mask = $TypeMasks::StaticObjectType | $TypeMasks::TerrainObjectType; + %control = ServerConnection.getCameraObject(); + + %fvec = %control.getForwardVector(); + %start = %control.getPosition(); + + %end = VectorAdd( %start, VectorScale( %fvec, $Param::FarDist ) ); + + // Use the client container for this ray cast. + %result = containerRayCast( %start, %end, %mask, %control, true ); + + %hitPos = getWords( %result, 1, 3 ); + + if ( %hitPos $= "" ) + %focDist = $Param::FarDist; + else + %focDist = VectorDist( %hitPos, %start ); + + // For debuging + //$DOF::debug_dist = %focDist; + //$DOF::debug_depth = %focDist / $Param::FarDist; + //echo( "F: " @ %focDist SPC "D: " @ %delta ); + + %this.focalDist = %focDist; +} + + +// For debugging +/* +function reloadDOF() +{ + exec( "./dof.cs" ); + DOFPostEffect.reload(); + DOFPostEffect.disable(); + DOFPostEffect.enable(); +} + +function dofMetricsCallback() +{ + return " | DOF |" @ + " Dist: " @ $DOF::debug_dist @ + " Depth: " @ $DOF::debug_depth; +} +*/ \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/scripts/edgeAA.cs b/Templates/BaseGame/game/core/postFX/scripts/edgeAA.cs new file mode 100644 index 000000000..c3b4263fa --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/edgeAA.cs @@ -0,0 +1,113 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +singleton GFXStateBlockData( PFX_DefaultEdgeAAStateBlock ) +{ + zDefined = true; + zEnable = false; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; + //samplerStates[1] = SamplerWrapPoint; +}; + +singleton ShaderData( PFX_EdgeAADetectShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/edgeDetectP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/gl/edgeDetectP.glsl"; + + samplerNames[0] = "$deferredBuffer"; + + pixVersion = 3.0; +}; + +singleton ShaderData( PFX_EdgeAAShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/edgeAAV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/edgeAAP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/gl/edgeAAV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/gl/edgeAAP.glsl"; + + samplerNames[0] = "$edgeBuffer"; + samplerNames[1] = "$backBuffer"; + + pixVersion = 3.0; +}; + +singleton ShaderData( PFX_EdgeAADebugShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/dbgEdgeDisplayP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/edgeaa/gl/dbgEdgeDisplayP.glsl"; + + samplerNames[0] = "$edgeBuffer"; + + pixVersion = 3.0; +}; + +singleton PostEffect( EdgeDetectPostEffect ) +{ + renderTime = "PFXBeforeBin"; + renderBin = "ObjTranslucentBin"; + //renderPriority = 0.1; + targetScale = "0.5 0.5"; + + shader = PFX_EdgeAADetectShader; + stateBlock = PFX_DefaultEdgeAAStateBlock; + texture[0] = "#deferred"; + target = "#edge"; + + isEnabled = true; +}; + +singleton PostEffect( EdgeAAPostEffect ) +{ + renderTime = "PFXAfterDiffuse"; + //renderBin = "ObjTranslucentBin"; + //renderPriority = 0.1; + + shader = PFX_EdgeAAShader; + stateBlock = PFX_DefaultEdgeAAStateBlock; + texture[0] = "#edge"; + texture[1] = "$backBuffer"; + target = "$backBuffer"; +}; + +singleton PostEffect( Debug_EdgeAAPostEffect ) +{ + renderTime = "PFXAfterDiffuse"; + //renderBin = "ObjTranslucentBin"; + //renderPriority = 0.1; + + shader = PFX_EdgeAADebugShader; + stateBlock = PFX_DefaultEdgeAAStateBlock; + texture[0] = "#edge"; + target = "$backBuffer"; +}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/scripts/flash.cs b/Templates/BaseGame/game/core/postFX/scripts/flash.cs new file mode 100644 index 000000000..1c97c6411 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/flash.cs @@ -0,0 +1,63 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton ShaderData( PFX_FlashShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/flashP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/flashP.glsl"; + + samplerNames[0] = "$backBuffer"; + + defines = "WHITE_COLOR=float4(1.0,1.0,1.0,0.0);MUL_COLOR=float4(1.0,0.25,0.25,0.0)"; + + pixVersion = 2.0; +}; + +singleton PostEffect( FlashFx ) +{ + isEnabled = false; + allowReflectPass = false; + + renderTime = "PFXAfterDiffuse"; + + shader = PFX_FlashShader; + texture[0] = "$backBuffer"; + renderPriority = 10; + stateBlock = PFX_DefaultStateBlock; +}; + +function FlashFx::setShaderConsts( %this ) +{ + if ( isObject( ServerConnection ) ) + { + %this.setShaderConst( "$damageFlash", ServerConnection.getDamageFlash() ); + %this.setShaderConst( "$whiteOut", ServerConnection.getWhiteOut() ); + } + else + { + %this.setShaderConst( "$damageFlash", 0 ); + %this.setShaderConst( "$whiteOut", 0 ); + } +} diff --git a/Templates/BaseGame/game/core/postFX/scripts/fog.cs b/Templates/BaseGame/game/core/postFX/scripts/fog.cs new file mode 100644 index 000000000..4b9bfc663 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/fog.cs @@ -0,0 +1,135 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//------------------------------------------------------------------------------ +// Fog +//------------------------------------------------------------------------------ + +singleton ShaderData( FogPassShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/fogP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/fogP.glsl"; + + samplerNames[0] = "$deferredTex"; + + pixVersion = 2.0; +}; + + +singleton GFXStateBlockData( FogPassStateBlock : PFX_DefaultStateBlock ) +{ + blendDefined = true; + blendEnable = true; + blendSrc = GFXBlendSrcAlpha; + blendDest = GFXBlendInvSrcAlpha; +}; + + +singleton PostEffect( FogPostFx ) +{ + // We forward render the reflection pass + // so it does its own fogging. + allowReflectPass = false; + + renderTime = "PFXBeforeBin"; + renderBin = "ObjTranslucentBin"; + + shader = FogPassShader; + stateBlock = FogPassStateBlock; + texture[0] = "#deferred"; + + renderPriority = 5; + + targetFormat = getBestHDRFormat(); + isEnabled = true; +}; + + +//------------------------------------------------------------------------------ +// UnderwaterFog +//------------------------------------------------------------------------------ + +singleton ShaderData( UnderwaterFogPassShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/underwaterFogP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/underwaterFogP.glsl"; + + samplerNames[0] = "$deferredTex"; + samplerNames[1] = "$backbuffer"; + samplerNames[2] = "$waterDepthGradMap"; + + pixVersion = 2.0; +}; + + +singleton GFXStateBlockData( UnderwaterFogPassStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; + samplerStates[1] = SamplerClampPoint; + samplerStates[2] = SamplerClampLinear; +}; + + +singleton PostEffect( UnderwaterFogPostFx ) +{ + oneFrameOnly = true; + onThisFrame = false; + + // Let the fog effect render during the + // reflection pass. + allowReflectPass = true; + + renderTime = "PFXBeforeBin"; + renderBin = "ObjTranslucentBin"; + + shader = UnderwaterFogPassShader; + stateBlock = UnderwaterFogPassStateBlock; + texture[0] = "#deferred"; + texture[1] = "$backBuffer"; + texture[2] = "#waterDepthGradMap"; + + // Needs to happen after the FogPostFx + renderPriority = 4; + + isEnabled = true; +}; + +function UnderwaterFogPostFx::onEnabled( %this ) +{ + TurbulenceFx.enable(); + CausticsPFX.enable(); + return true; +} + +function UnderwaterFogPostFx::onDisabled( %this ) +{ + TurbulenceFx.disable(); + CausticsPFX.disable(); + return false; +} diff --git a/Templates/BaseGame/game/core/postFX/scripts/fxaa.cs b/Templates/BaseGame/game/core/postFX/scripts/fxaa.cs new file mode 100644 index 000000000..4b81c6e19 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/fxaa.cs @@ -0,0 +1,64 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "NVIDIA FXAA 3.11" by TIMOTHY LOTTES +// +// http://timothylottes.blogspot.com/ +// +// The shader is tuned for the defaul quality and good performance. +// See shaders\common\postFx\fxaa\fxaaP.hlsl to tweak the internal +// quality and performance settings. + +singleton GFXStateBlockData( FXAA_StateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; +}; + +singleton ShaderData( FXAA_ShaderData ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/fxaa/fxaaV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/fxaa/fxaaP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/fxaa/gl/fxaaV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/fxaa/gl/fxaaP.glsl"; + + samplerNames[0] = "$colorTex"; + + pixVersion = 3.0; +}; + +singleton PostEffect( FXAA_PostEffect ) +{ + isEnabled = false; + + allowReflectPass = false; + renderTime = "PFXAfterDiffuse"; + + texture[0] = "$backBuffer"; + + target = "$backBuffer"; + + stateBlock = FXAA_StateBlock; + shader = FXAA_ShaderData; +}; + diff --git a/Templates/BaseGame/game/core/postFX/scripts/glow.cs b/Templates/BaseGame/game/core/postFX/scripts/glow.cs new file mode 100644 index 000000000..0f062f6f7 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/glow.cs @@ -0,0 +1,184 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +singleton ShaderData( PFX_GlowBlurVertShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/glowBlurV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/glowBlurP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/glowBlurV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/glowBlurP.glsl"; + + defines = "BLUR_DIR=float2(0.0,1.0)"; + + samplerNames[0] = "$diffuseMap"; + + pixVersion = 2.0; +}; + + +singleton ShaderData( PFX_GlowBlurHorzShader : PFX_GlowBlurVertShader ) +{ + defines = "BLUR_DIR=float2(1.0,0.0)"; +}; + + +singleton GFXStateBlockData( PFX_GlowCombineStateBlock : PFX_DefaultStateBlock ) +{ + // Use alpha test to save some fillrate + // on the non-glowing areas of the scene. + alphaDefined = true; + alphaTestEnable = true; + alphaTestRef = 1; + alphaTestFunc = GFXCmpGreaterEqual; + + // Do a one to one blend. + blendDefined = true; + blendEnable = true; + blendSrc = GFXBlendOne; + blendDest = GFXBlendOne; +}; + + +singleton PostEffect( GlowPostFx ) +{ + // Do not allow the glow effect to work in reflection + // passes by default so we don't do the extra drawing. + allowReflectPass = false; + + renderTime = "PFXAfterBin"; + renderBin = "GlowBin"; + renderPriority = 1; + + // First we down sample the glow buffer. + shader = PFX_PassthruShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "#glowbuffer"; + target = "$outTex"; + targetScale = "0.5 0.5"; + + isEnabled = true; + + // Blur vertically + new PostEffect() + { + shader = PFX_GlowBlurVertShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$inTex"; + target = "$outTex"; + }; + + // Blur horizontally + new PostEffect() + { + shader = PFX_GlowBlurHorzShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$inTex"; + target = "$outTex"; + }; + + // Upsample and combine with the back buffer. + new PostEffect() + { + shader = PFX_PassthruShader; + stateBlock = PFX_GlowCombineStateBlock; + texture[0] = "$inTex"; + target = "$backBuffer"; + }; +}; + +singleton ShaderData( PFX_VolFogGlowBlurVertShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/glowBlurV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/VolFogGlowP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/glowBlurV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/VolFogGlowP.glsl"; + + defines = "BLUR_DIR=float2(0.0,1.0)"; + samplerNames[0] = "$diffuseMap"; + pixVersion = 2.0; +}; +singleton ShaderData( PFX_VolFogGlowBlurHorzShader : PFX_VolFogGlowBlurVertShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/glowBlurV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/VolFogGlowP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/glowBlurV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/VolFogGlowP.glsl"; + + defines = "BLUR_DIR=float2(1.0,0.0)"; +}; + +$VolFogGlowPostFx::glowStrength = 0.3; + +singleton PostEffect( VolFogGlowPostFx ) +{ + // Do not allow the glow effect to work in reflection + // passes by default so we don't do the extra drawing. + allowReflectPass = false; + renderTime = "PFXAfterBin"; + renderBin = "FogBin"; + renderPriority = 1; + // First we down sample the glow buffer. + shader = PFX_PassthruShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backbuffer"; + target = "$outTex"; + targetScale = "0.5 0.5"; + isEnabled = true; + // Blur vertically + new PostEffect() + { + shader = PFX_VolFogGlowBlurVertShader; + stateBlock = PFX_DefaultStateBlock; + internalName = "vert"; + texture[0] = "$inTex"; + target = "$outTex"; + }; + // Blur horizontally + new PostEffect() + { + shader = PFX_VolFogGlowBlurHorzShader; + stateBlock = PFX_DefaultStateBlock; + internalName = "hor"; + texture[0] = "$inTex"; + target = "$outTex"; + }; + // Upsample and combine with the back buffer. + new PostEffect() + { + shader = PFX_PassthruShader; + stateBlock = PFX_GlowCombineStateBlock; + texture[0] = "$inTex"; + target = "$backBuffer"; + }; +}; + +function VolFogGlowPostFx::setShaderConsts( %this ) +{ + %vp=%this-->vert; + %vp.setShaderConst( "$strength", $VolFogGlowPostFx::glowStrength ); + %vp=%this-->hor; + %vp.setShaderConst( "$strength", $VolFogGlowPostFx::glowStrength ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/scripts/hdr.cs b/Templates/BaseGame/game/core/postFX/scripts/hdr.cs new file mode 100644 index 000000000..3b2de8b7b --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/hdr.cs @@ -0,0 +1,529 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +/// Blends between the scene and the tone mapped scene. +$HDRPostFX::enableToneMapping = 0.5; + +/// The tone mapping middle grey or exposure value used +/// to adjust the overall "balance" of the image. +/// +/// 0.18 is fairly common value. +/// +$HDRPostFX::keyValue = 0.18; + +/// The minimum luninace value to allow when tone mapping +/// the scene. Is particularly useful if your scene very +/// dark or has a black ambient color in places. +$HDRPostFX::minLuminace = 0.001; + +/// The lowest luminance value which is mapped to white. This +/// is usually set to the highest visible luminance in your +/// scene. By setting this to smaller values you get a contrast +/// enhancement. +$HDRPostFX::whiteCutoff = 1.0; + +/// The rate of adaptation from the previous and new +/// average scene luminance. +$HDRPostFX::adaptRate = 2.0; + +/// Blends between the scene and the blue shifted version +/// of the scene for a cinematic desaturated night effect. +$HDRPostFX::enableBlueShift = 0.0; + +/// The blue shift color value. +$HDRPostFX::blueShiftColor = "1.05 0.97 1.27"; + + +/// Blends between the scene and the bloomed scene. +$HDRPostFX::enableBloom = 1.0; + +/// The threshold luminace value for pixels which are +/// considered "bright" and need to be bloomed. +$HDRPostFX::brightPassThreshold = 1.0; + +/// These are used in the gaussian blur of the +/// bright pass for the bloom effect. +$HDRPostFX::gaussMultiplier = 0.3; +$HDRPostFX::gaussMean = 0.0; +$HDRPostFX::gaussStdDev = 0.8; + +/// The 1x255 color correction ramp texture used +/// by both the HDR shader and the GammaPostFx shader +/// for doing full screen color correction. +$HDRPostFX::colorCorrectionRamp = "core/postFX/images/null_color_ramp.png"; + + +singleton ShaderData( HDR_BrightPassShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/brightPassFilterP.hlsl"; + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/brightPassFilterP.glsl"; + + samplerNames[0] = "$inputTex"; + samplerNames[1] = "$luminanceTex"; + + pixVersion = 3.0; +}; + +singleton ShaderData( HDR_DownScale4x4Shader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/downScale4x4V.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/downScale4x4P.hlsl"; + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/downScale4x4V.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/downScale4x4P.glsl"; + + samplerNames[0] = "$inputTex"; + + pixVersion = 2.0; +}; + +singleton ShaderData( HDR_BloomGaussBlurHShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/bloomGaussBlurHP.hlsl"; + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/bloomGaussBlurHP.glsl"; + + samplerNames[0] = "$inputTex"; + + pixVersion = 3.0; +}; + +singleton ShaderData( HDR_BloomGaussBlurVShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/bloomGaussBlurVP.hlsl"; + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/bloomGaussBlurVP.glsl"; + + samplerNames[0] = "$inputTex"; + + pixVersion = 3.0; +}; + +singleton ShaderData( HDR_SampleLumShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/sampleLumInitialP.hlsl"; + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/sampleLumInitialP.glsl"; + + samplerNames[0] = "$inputTex"; + + pixVersion = 3.0; +}; + +singleton ShaderData( HDR_DownSampleLumShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/sampleLumIterativeP.hlsl"; + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/sampleLumIterativeP.glsl"; + + samplerNames[0] = "$inputTex"; + + pixVersion = 3.0; +}; + +singleton ShaderData( HDR_CalcAdaptedLumShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/calculateAdaptedLumP.hlsl"; + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/calculateAdaptedLumP.glsl"; + + samplerNames[0] = "$currLum"; + samplerNames[1] = "$lastAdaptedLum"; + + pixVersion = 3.0; +}; + +singleton ShaderData( HDR_CombineShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/finalPassCombineP.hlsl"; + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/finalPassCombineP.glsl"; + + samplerNames[0] = "$sceneTex"; + samplerNames[1] = "$luminanceTex"; + samplerNames[2] = "$bloomTex"; + samplerNames[3] = "$colorCorrectionTex"; + samplerNames[4] = "deferredTex"; + + pixVersion = 3.0; +}; + + +singleton GFXStateBlockData( HDR_SampleStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; + samplerStates[1] = SamplerClampPoint; +}; + +singleton GFXStateBlockData( HDR_DownSampleStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerClampLinear; +}; + +singleton GFXStateBlockData( HDR_CombineStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; + samplerStates[1] = SamplerClampLinear; + samplerStates[2] = SamplerClampLinear; + samplerStates[3] = SamplerClampLinear; +}; + +singleton GFXStateBlockData( HDRStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerClampLinear; + samplerStates[2] = SamplerClampLinear; + samplerStates[3] = SamplerClampLinear; + + blendDefined = true; + blendDest = GFXBlendOne; + blendSrc = GFXBlendZero; + + zDefined = true; + zEnable = false; + zWriteEnable = false; + + cullDefined = true; + cullMode = GFXCullNone; +}; + + +function HDRPostFX::setShaderConsts( %this ) +{ + %this.setShaderConst( "$brightPassThreshold", $HDRPostFX::brightPassThreshold ); + %this.setShaderConst( "$g_fMiddleGray", $HDRPostFX::keyValue ); + + %bloomH = %this-->bloomH; + %bloomH.setShaderConst( "$gaussMultiplier", $HDRPostFX::gaussMultiplier ); + %bloomH.setShaderConst( "$gaussMean", $HDRPostFX::gaussMean ); + %bloomH.setShaderConst( "$gaussStdDev", $HDRPostFX::gaussStdDev ); + + %bloomV = %this-->bloomV; + %bloomV.setShaderConst( "$gaussMultiplier", $HDRPostFX::gaussMultiplier ); + %bloomV.setShaderConst( "$gaussMean", $HDRPostFX::gaussMean ); + %bloomV.setShaderConst( "$gaussStdDev", $HDRPostFX::gaussStdDev ); + + %minLuminace = $HDRPostFX::minLuminace; + if ( %minLuminace <= 0.0 ) + { + // The min should never be pure zero else the + // log() in the shader will generate INFs. + %minLuminace = 0.00001; + } + %this-->adaptLum.setShaderConst( "$g_fMinLuminace", %minLuminace ); + + %this-->finalLum.setShaderConst( "$adaptRate", $HDRPostFX::adaptRate ); + + %combinePass = %this-->combinePass; + %combinePass.setShaderConst( "$g_fEnableToneMapping", $HDRPostFX::enableToneMapping ); + %combinePass.setShaderConst( "$g_fMiddleGray", $HDRPostFX::keyValue ); + %combinePass.setShaderConst( "$g_fBloomScale", $HDRPostFX::enableBloom ); + %combinePass.setShaderConst( "$g_fEnableBlueShift", $HDRPostFX::enableBlueShift ); + %combinePass.setShaderConst( "$g_fBlueShiftColor", $HDRPostFX::blueShiftColor ); + + %clampedGamma = mClamp( $pref::Video::Gamma, 2.0, 2.5); + %combinePass.setShaderConst( "$g_fOneOverGamma", 1 / %clampedGamma ); + %combinePass.setShaderConst( "$Brightness", $pref::Video::Brightness ); + %combinePass.setShaderConst( "$Contrast", $pref::Video::Contrast ); + + %whiteCutoff = ( $HDRPostFX::whiteCutoff * $HDRPostFX::whiteCutoff ) * + ( $HDRPostFX::whiteCutoff * $HDRPostFX::whiteCutoff ); + %combinePass.setShaderConst( "$g_fWhiteCutoff", %whiteCutoff ); +} + +function HDRPostFX::preProcess( %this ) +{ + %combinePass = %this-->combinePass; + + if ( %combinePass.texture[3] !$= $HDRPostFX::colorCorrectionRamp ) + %combinePass.setTexture( 3, $HDRPostFX::colorCorrectionRamp ); +} + +function HDRPostFX::onEnabled( %this ) +{ + // See what HDR format would be best. + %format = getBestHDRFormat(); + if ( %format $= "" || %format $= "GFXFormatR8G8B8A8" ) + { + // We didn't get a valid HDR format... so fail. + return false; + } + + // HDR does it's own gamma calculation so + // disable this postFx. + GammaPostFX.disable(); + + // Set the right global shader define for HDR. + if ( %format $= "GFXFormatR10G10B10A2" ) + addGlobalShaderMacro( "TORQUE_HDR_RGB10" ); + else if ( %format $= "GFXFormatR16G16B16A16" ) + addGlobalShaderMacro( "TORQUE_HDR_RGB16" ); + + echo( "HDR FORMAT: " @ %format ); + + // Change the format of the offscreen surface + // to an HDR compatible format. + AL_FormatToken.format = %format; + setReflectFormat( %format ); + + // Reset the light manager which will ensure the new + // hdr encoding takes effect in all the shaders and + // that the offscreen surface is enabled. + resetLightManager(); + + return true; +} + +function HDRPostFX::onDisabled( %this ) +{ + // Enable a special GammaCorrection PostFX when this is disabled. + GammaPostFX.enable(); + + // Restore the non-HDR offscreen surface format. + %format = getBestHDRFormat(); + AL_FormatToken.format = %format; + setReflectFormat( %format ); + + removeGlobalShaderMacro( "TORQUE_HDR_RGB10" ); + removeGlobalShaderMacro( "TORQUE_HDR_RGB16" ); + + // Reset the light manager which will ensure the new + // hdr encoding takes effect in all the shaders. + resetLightManager(); +} + +singleton PostEffect( HDRPostFX ) +{ + isEnabled = false; + allowReflectPass = false; + + // Resolve the HDR before we render any editor stuff + // and before we resolve the scene to the backbuffer. + renderTime = "PFXBeforeBin"; + renderBin = "EditorBin"; + renderPriority = 9999; + + // The bright pass generates a bloomed version of + // the scene for pixels which are brighter than a + // fixed threshold value. + // + // This is then used in the final HDR combine pass + // at the end of this post effect chain. + // + + shader = HDR_BrightPassShader; + stateBlock = HDR_DownSampleStateBlock; + texture[0] = "$backBuffer"; + texture[1] = "#adaptedLum"; + target = "$outTex"; + targetFormat = "GFXFormatR16G16B16A16F"; + targetScale = "0.5 0.5"; + + new PostEffect() + { + allowReflectPass = false; + shader = HDR_DownScale4x4Shader; + stateBlock = HDR_DownSampleStateBlock; + texture[0] = "$inTex"; + target = "$outTex"; + targetFormat = "GFXFormatR16G16B16A16F"; + targetScale = "0.25 0.25"; + }; + + new PostEffect() + { + allowReflectPass = false; + internalName = "bloomH"; + + shader = HDR_BloomGaussBlurHShader; + stateBlock = HDR_DownSampleStateBlock; + texture[0] = "$inTex"; + target = "$outTex"; + targetFormat = "GFXFormatR16G16B16A16F"; + }; + + new PostEffect() + { + allowReflectPass = false; + internalName = "bloomV"; + + shader = HDR_BloomGaussBlurVShader; + stateBlock = HDR_DownSampleStateBlock; + texture[0] = "$inTex"; + target = "#bloomFinal"; + targetFormat = "GFXFormatR16G16B16A16F"; + }; + + // BrightPass End + + // Now calculate the adapted luminance. + new PostEffect() + { + allowReflectPass = false; + internalName = "adaptLum"; + + shader = HDR_SampleLumShader; + stateBlock = HDR_DownSampleStateBlock; + texture[0] = "$backBuffer"; + target = "$outTex"; + targetScale = "0.0625 0.0625"; // 1/16th + targetFormat = "GFXFormatR16F"; + + new PostEffect() + { + allowReflectPass = false; + shader = HDR_DownSampleLumShader; + stateBlock = HDR_DownSampleStateBlock; + texture[0] = "$inTex"; + target = "$outTex"; + targetScale = "0.25 0.25"; // 1/4 + targetFormat = "GFXFormatR16F"; + }; + + new PostEffect() + { + allowReflectPass = false; + shader = HDR_DownSampleLumShader; + stateBlock = HDR_DownSampleStateBlock; + texture[0] = "$inTex"; + target = "$outTex"; + targetScale = "0.25 0.25"; // 1/4 + targetFormat = "GFXFormatR16F"; + }; + + new PostEffect() + { + allowReflectPass = false; + shader = HDR_DownSampleLumShader; + stateBlock = HDR_DownSampleStateBlock; + texture[0] = "$inTex"; + target = "$outTex"; + targetScale = "0.25 0.25"; // At this point the target should be 1x1. + targetFormat = "GFXFormatR16F"; + }; + + // Note that we're reading the adapted luminance + // from the previous frame when generating this new + // one... PostEffect takes care to manage that. + new PostEffect() + { + allowReflectPass = false; + internalName = "finalLum"; + shader = HDR_CalcAdaptedLumShader; + stateBlock = HDR_DownSampleStateBlock; + texture[0] = "$inTex"; + texture[1] = "#adaptedLum"; + target = "#adaptedLum"; + targetFormat = "GFXFormatR16F"; + targetClear = "PFXTargetClear_OnCreate"; + targetClearColor = "1 1 1 1"; + }; + }; + + // Output the combined bloom and toned mapped + // version of the scene. + new PostEffect() + { + allowReflectPass = false; + internalName = "combinePass"; + + shader = HDR_CombineShader; + stateBlock = HDR_CombineStateBlock; + texture[0] = "$backBuffer"; + texture[1] = "#adaptedLum"; + texture[2] = "#bloomFinal"; + texture[3] = $HDRPostFX::colorCorrectionRamp; + target = "$backBuffer"; + }; +}; + +singleton ShaderData( LuminanceVisShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/luminanceVisP.hlsl"; + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/hdr/gl/luminanceVisP.glsl"; + + samplerNames[0] = "$inputTex"; + + pixVersion = 3.0; +}; + +singleton GFXStateBlockData( LuminanceVisStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; +}; + +function LuminanceVisPostFX::setShaderConsts( %this ) +{ + %this.setShaderConst( "$brightPassThreshold", $HDRPostFX::brightPassThreshold ); +} + +singleton PostEffect( LuminanceVisPostFX ) +{ + isEnabled = false; + allowReflectPass = false; + + // Render before we do any editor rendering. + renderTime = "PFXBeforeBin"; + renderBin = "EditorBin"; + renderPriority = 9999; + + shader = LuminanceVisShader; + stateBlock = LuminanceVisStateBlock; + texture[0] = "$backBuffer"; + target = "$backBuffer"; + //targetScale = "0.0625 0.0625"; // 1/16th + //targetFormat = "GFXFormatR16F"; +}; + +function LuminanceVisPostFX::onEnabled( %this ) +{ + if ( !HDRPostFX.isEnabled() ) + { + HDRPostFX.enable(); + } + + HDRPostFX.skip = true; + + return true; +} + +function LuminanceVisPostFX::onDisabled( %this ) +{ + HDRPostFX.skip = false; +} + diff --git a/Templates/BaseGame/game/core/postFX/scripts/lightRay.cs b/Templates/BaseGame/game/core/postFX/scripts/lightRay.cs new file mode 100644 index 000000000..523b9bdea --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/lightRay.cs @@ -0,0 +1,110 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +$LightRayPostFX::brightScalar = 0.75; +$LightRayPostFX::numSamples = 40; +$LightRayPostFX::density = 0.94; +$LightRayPostFX::weight = 5.65; +$LightRayPostFX::decay = 1.0; +$LightRayPostFX::exposure = 0.0005; +$LightRayPostFX::resolutionScale = 1.0; + + +singleton ShaderData( LightRayOccludeShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/lightRay/lightRayOccludeP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/lightRay/gl/lightRayOccludeP.glsl"; + + samplerNames[0] = "$backBuffer"; + samplerNames[1] = "$deferredTex"; + + pixVersion = 3.0; +}; + +singleton ShaderData( LightRayShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/lightRay/lightRayP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/lightRay/gl/lightRayP.glsl"; + + samplerNames[0] = "$frameSampler"; + samplerNames[1] = "$backBuffer"; + + pixVersion = 3.0; +}; + +singleton GFXStateBlockData( LightRayStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerClampLinear; +}; + +singleton PostEffect( LightRayPostFX ) +{ + isEnabled = false; + allowReflectPass = false; + + renderTime = "PFXBeforeBin"; + renderBin = "EditorBin"; + renderPriority = 10; + + shader = LightRayOccludeShader; + stateBlock = LightRayStateBlock; + texture[0] = "$backBuffer"; + texture[1] = "#deferred"; + target = "$outTex"; + targetFormat = "GFXFormatR16G16B16A16F"; + + new PostEffect() + { + shader = LightRayShader; + stateBlock = LightRayStateBlock; + internalName = "final"; + texture[0] = "$inTex"; + texture[1] = "$backBuffer"; + target = "$backBuffer"; + }; +}; + +function LightRayPostFX::preProcess( %this ) +{ + %this.targetScale = $LightRayPostFX::resolutionScale SPC $LightRayPostFX::resolutionScale; +} + +function LightRayPostFX::setShaderConsts( %this ) +{ + %this.setShaderConst( "$brightScalar", $LightRayPostFX::brightScalar ); + + %pfx = %this-->final; + %pfx.setShaderConst( "$numSamples", $LightRayPostFX::numSamples ); + %pfx.setShaderConst( "$density", $LightRayPostFX::density ); + %pfx.setShaderConst( "$weight", $LightRayPostFX::weight ); + %pfx.setShaderConst( "$decay", $LightRayPostFX::decay ); + %pfx.setShaderConst( "$exposure", $LightRayPostFX::exposure ); +} diff --git a/Templates/BaseGame/game/core/postFX/scripts/ovrBarrelDistortion.cs b/Templates/BaseGame/game/core/postFX/scripts/ovrBarrelDistortion.cs new file mode 100644 index 000000000..1ea280863 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/ovrBarrelDistortion.cs @@ -0,0 +1,167 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Only load these shaders if an Oculus VR device is present +if(!isFunction(isOculusVRDeviceActive)) + return; + +//----------------------------------------------------------------------------- +// Shader data +//----------------------------------------------------------------------------- + +singleton ShaderData( OVRMonoToStereoShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/oculusvr/monoToStereoP.hlsl"; + + //OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.hlsl"; + //OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/oculusvr/gl/monoToStereoP.glsl"; + + samplerNames[0] = "$backBuffer"; + + pixVersion = 2.0; +}; + +singleton ShaderData( OVRBarrelDistortionShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/oculusvr/barrelDistortionP.hlsl"; + + //OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + //OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/oculusvr/gl/barrelDistortionP.glsl"; + + samplerNames[0] = "$backBuffer"; + + pixVersion = 2.0; +}; + +singleton ShaderData( OVRBarrelDistortionChromaShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/oculusvr/barrelDistortionChromaP.hlsl"; + + pixVersion = 2.0; +}; + +//----------------------------------------------------------------------------- +// GFX state blocks +//----------------------------------------------------------------------------- + +singleton GFXStateBlockData( OVRBarrelDistortionStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; +}; + +//----------------------------------------------------------------------------- +// Barrel Distortion PostFx +// +// To be used with the Oculus Rift. +// Expects a stereo pair to exist on the back buffer and then applies the +// appropriate barrel distortion. +//----------------------------------------------------------------------------- +singleton BarrelDistortionPostEffect( OVRBarrelDistortionPostFX ) +{ + isEnabled = false; + allowReflectPass = false; + + renderTime = "PFXAfterDiffuse"; + renderPriority = 100; + + // The barrel distortion + shader = OVRBarrelDistortionShader; + stateBlock = OVRBarrelDistortionStateBlock; + + texture[0] = "$backBuffer"; + + scaleOutput = 1.25; +}; + +//----------------------------------------------------------------------------- +// Barrel Distortion with Chromatic Aberration Correction PostFx +// +// To be used with the Oculus Rift. +// Expects a stereo pair to exist on the back buffer and then applies the +// appropriate barrel distortion. +// This version applies a chromatic aberration correction during the +// barrel distortion. +//----------------------------------------------------------------------------- +singleton BarrelDistortionPostEffect( OVRBarrelDistortionChromaPostFX ) +{ + isEnabled = false; + allowReflectPass = false; + + renderTime = "PFXAfterDiffuse"; + renderPriority = 100; + + // The barrel distortion + shader = OVRBarrelDistortionChromaShader; + stateBlock = OVRBarrelDistortionStateBlock; + + texture[0] = "$backBuffer"; + + scaleOutput = 1.25; +}; + +//----------------------------------------------------------------------------- +// Barrel Distortion Mono PostFx +// +// To be used with the Oculus Rift. +// Takes a non-stereo image and turns it into a stereo pair with barrel +// distortion applied. Only a vertical slice around the center of the back +// buffer is used to generate the pseudo stereo pair. +//----------------------------------------------------------------------------- +singleton PostEffect( OVRBarrelDistortionMonoPostFX ) +{ + isEnabled = false; + allowReflectPass = false; + + renderTime = "PFXAfterDiffuse"; + renderPriority = 100; + + // Converts the mono display to a stereo one + shader = OVRMonoToStereoShader; + stateBlock = OVRBarrelDistortionStateBlock; + + texture[0] = "$backBuffer"; + target = "$outTex"; + + // The actual barrel distortion + new BarrelDistortionPostEffect(OVRBarrelDistortionMonoStage2PostFX) + { + shader = OVRBarrelDistortionShader; + stateBlock = OVRBarrelDistortionStateBlock; + texture[0] = "$inTex"; + target = "$backBuffer"; + + scaleOutput = 1.25; + }; + +}; + +function OVRBarrelDistortionMonoPostFX::setShaderConsts( %this ) +{ + %HMDIndex = 0; + + %xOffsets = getOVRHMDEyeXOffsets(%HMDIndex); + %this.setShaderConst( "$LensXOffsets", %xOffsets ); +} diff --git a/Templates/BaseGame/game/core/postFX/scripts/postFx.cs b/Templates/BaseGame/game/core/postFX/scripts/postFx.cs new file mode 100644 index 000000000..fe931a994 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/postFx.cs @@ -0,0 +1,88 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton ShaderData( PFX_PassthruShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/passthruP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/passthruP.glsl"; + + samplerNames[0] = "$inputTex"; + + pixVersion = 2.0; +}; + +function postFXInit() +{ + exec("core/postFX/guis/postFxManager.gui"); + + //Load the core postFX files themselves + if (!$Server::Dedicated) + { + //init the postFX + %pattern = "./*.cs"; + %file = findFirstFile( %pattern ); + if ( %file $= "" ) + { + // Try for DSOs next. + %pattern = "core/postFX/*.cs.dso"; + %file = findFirstFile( %pattern ); + } + + while( %file !$= "" ) + { + exec( %file ); + %file = findNextFile( %pattern ); + } + } +} + +function PostEffect::inspectVars( %this ) +{ + %name = %this.getName(); + %globals = "$" @ %name @ "::*"; + inspectVars( %globals ); +} + +function PostEffect::viewDisassembly( %this ) +{ + %file = %this.dumpShaderDisassembly(); + + if ( %file $= "" ) + { + echo( "PostEffect::viewDisassembly - no shader disassembly found." ); + } + else + { + echo( "PostEffect::viewDisassembly - shader disassembly file dumped ( " @ %file @ " )." ); + openFile( %file ); + } +} + +// Return true if we really want the effect enabled. +// By default this is the case. +function PostEffect::onEnabled( %this ) +{ + return true; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/scripts/postFxManager.gui.cs b/Templates/BaseGame/game/core/postFX/scripts/postFxManager.gui.cs new file mode 100644 index 000000000..a6b0f0f01 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/postFxManager.gui.cs @@ -0,0 +1,446 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +$PostFXManager::vebose = true; +function postVerbose(%string) +{ + if($PostFXManager::vebose == true) + { + echo(%string); + } +} + +function PostFXManager::onDialogPush( %this ) +{ + //Apply the settings to the controls + postVerbose("% - PostFX Manager - Loading GUI."); + + %this.settingsRefreshAll(); +} + +// :: Controls for the overall postFX manager dialog +function ppOptionsEnable::onAction(%this) +{ + //Disable / Enable all PostFX + + if(ppOptionsEnable.getValue()) + { + %toEnable = true; + } + else + { + %toEnable = false; + } + + PostFXManager.settingsSetEnabled(%toEnable); + +} + +function PostFXManager::getEnableResultFromControl(%this, %control) +{ + %toEnable = -1; + %bTest = %control.getValue(); + if(%bTest == 1) + { + %toEnable = true; + } + else + { + %toEnable = false; + } + + return %toEnable; +} + +function ppOptionsEnableSSAO::onAction(%this) +{ + %toEnable = PostFXManager.getEnableResultFromControl(%this); + PostFXManager.settingsEffectSetEnabled("SSAO", %toEnable); +} + +function ppOptionsEnableHDR::onAction(%this) +{ + %toEnable = PostFXManager.getEnableResultFromControl(%this); + PostFXManager.settingsEffectSetEnabled("HDR", %toEnable); +} + +function ppOptionsEnableLightRays::onAction(%this) +{ + %toEnable = PostFXManager.getEnableResultFromControl(%this); + PostFXManager.settingsEffectSetEnabled("LightRays", %toEnable); +} + +function ppOptionsEnableDOF::onAction(%this) +{ + %toEnable = PostFXManager.getEnableResultFromControl(%this); + PostFXManager.settingsEffectSetEnabled("DOF", %toEnable); +} + +function ppOptionsEnableVignette::onAction(%this) +{ + %toEnable = PostFXManager.getEnableResultFromControl(%this); + PostFXManager.settingsEffectSetEnabled("Vignette", %toEnable); +} + +function ppOptionsSavePreset::onClick(%this) +{ + //Stores the current settings into a preset file for loading and use later on +} + +function ppOptionsLoadPreset::onClick(%this) +{ + //Loads and applies the settings from a postfxpreset file +} + + +//Other controls, Quality dropdown +function ppOptionsSSAOQuality::onSelect( %this, %id, %text ) +{ + if(%id > -1 && %id < 3) + { + $SSAOPostFx::quality = %id; + } +} + +//SSAO Slider controls +//General Tab +function ppOptionsSSAOOverallStrength::onMouseDragged(%this) +{ + $SSAOPostFx::overallStrength = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsSSAOBlurDepth::onMouseDragged(%this) +{ + $SSAOPostFx::blurDepthTol = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsSSAOBlurNormal::onMouseDragged(%this) +{ + $SSAOPostFx::blurNormalTol = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +//Near Tab +function ppOptionsSSAONearRadius::onMouseDragged(%this) +{ + $SSAOPostFx::sRadius = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsSSAONearStrength::onMouseDragged(%this) +{ + $SSAOPostFx::sStrength = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsSSAONearDepthMin::onMouseDragged(%this) +{ + $SSAOPostFx::sDepthMin = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsSSAONearDepthMax::onMouseDragged(%this) +{ + $SSAOPostFx::sDepthMax = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsSSAONearToleranceNormal::onMouseDragged(%this) +{ + $SSAOPostFx::sNormalTol = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsSSAONearTolerancePower::onMouseDragged(%this) +{ + $SSAOPostFx::sNormalPow = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +//Far Tab +function ppOptionsSSAOFarRadius::onMouseDragged(%this) +{ + $SSAOPostFx::lRadius = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} +function ppOptionsSSAOFarStrength::onMouseDragged(%this) +{ + $SSAOPostFx::lStrength = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} +function ppOptionsSSAOFarDepthMin::onMouseDragged(%this) +{ + $SSAOPostFx::lDepthMin = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} +function ppOptionsSSAOFarDepthMax::onMouseDragged(%this) +{ + $SSAOPostFx::lDepthMax = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} +function ppOptionsSSAOFarToleranceNormal::onMouseDragged(%this) +{ + $SSAOPostFx::lNormalTol = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} +function ppOptionsSSAOFarTolerancePower::onMouseDragged(%this) +{ + $SSAOPostFx::lNormalPow = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +//HDR Slider Controls +//Brighness tab + +function ppOptionsHDRToneMappingAmount::onMouseDragged(%this) +{ + + $HDRPostFX::enableToneMapping = %this.value; + %this.ToolTip = "value : " @ %this.value; +} + +function ppOptionsHDRKeyValue::onMouseDragged(%this) +{ + $HDRPostFX::keyValue = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsHDRMinLuminance::onMouseDragged(%this) +{ + $HDRPostFX::minLuminace = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsHDRWhiteCutoff::onMouseDragged(%this) +{ + $HDRPostFX::whiteCutoff = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsHDRBrightnessAdaptRate::onMouseDragged(%this) +{ + $HDRPostFX::adaptRate = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +//Blur tab +function ppOptionsHDRBloomBlurBrightPassThreshold::onMouseDragged(%this) +{ + $HDRPostFX::brightPassThreshold = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsHDRBloomBlurMultiplier::onMouseDragged(%this) +{ + $HDRPostFX::gaussMultiplier = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsHDRBloomBlurMean::onMouseDragged(%this) +{ + $HDRPostFX::gaussMean = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsHDRBloomBlurStdDev::onMouseDragged(%this) +{ + $HDRPostFX::gaussStdDev = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + +function ppOptionsHDRBloom::onAction(%this) +{ + $HDRPostFX::enableBloom = %this.getValue(); +} + +function ppOptionsHDRToneMapping::onAction(%this) +{ + //$HDRPostFX::enableToneMapping = %this.getValue(); +} + +function ppOptionsHDREffectsBlueShift::onAction(%this) +{ + $HDRPostFX::enableBlueShift = %this.getValue(); +} + + +//Controls for color range in blue Shift dialog + +function ppOptionsHDREffectsBlueShiftColorBlend::onAction(%this) +{ + $HDRPostFX::blueShiftColor = %this.PickColor; + %this.ToolTip = "Color Values : " @ %this.PickColor; +} + +function ppOptionsHDREffectsBlueShiftColorBaseColor::onAction(%this) +{ + //This one feeds the one above + ppOptionsHDREffectsBlueShiftColorBlend.baseColor = %this.PickColor; + %this.ToolTip = "Color Values : " @ %this.PickColor; +} + + +//Light rays Brightness Slider Controls +function ppOptionsLightRaysBrightScalar::onMouseDragged(%this) +{ + $LightRayPostFX::brightScalar = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} +//Light rays Number of Samples Slider Control +function ppOptionsLightRaysSampleScalar::onMouseDragged(%this) +{ + $LightRayPostFX::numSamples = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} +//Light rays Density Slider Control +function ppOptionsLightRaysDensityScalar::onMouseDragged(%this) +{ + $LightRayPostFX::density = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} +//Light rays Weight Slider Control +function ppOptionsLightRaysWeightScalar::onMouseDragged(%this) +{ + $LightRayPostFX::weight = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} +//Light rays Decay Slider Control +function ppOptionsLightRaysDecayScalar::onMouseDragged(%this) +{ + $LightRayPostFX::decay = %this.value; + %this.ToolTip = "Value : " @ %this.value; +} + + +function ppOptionsUpdateDOFSettings() +{ + DOFPostEffect.setFocusParams( $DOFPostFx::BlurMin, $DOFPostFx::BlurMax, $DOFPostFx::FocusRangeMin, $DOFPostFx::FocusRangeMax, -($DOFPostFx::BlurCurveNear), $DOFPostFx::BlurCurveFar ); + + DOFPostEffect.setAutoFocus( $DOFPostFx::EnableAutoFocus ); + DOFPostEffect.setFocalDist(0); + + if($PostFXManager::PostFX::EnableDOF) + { + DOFPostEffect.enable(); + } + else + { + DOFPostEffect.disable(); + } +} + +//DOF General Tab +//DOF Toggles +function ppOptionsDOFEnableDOF::onAction(%this) +{ + $PostFXManager::PostFX::EnableDOF = %this.getValue(); + ppOptionsUpdateDOFSettings(); +} + + +function ppOptionsDOFEnableAutoFocus::onAction(%this) +{ + $DOFPostFx::EnableAutoFocus = %this.getValue(); + DOFPostEffect.setAutoFocus( %this.getValue() ); +} + +//DOF AutoFocus Slider controls +function ppOptionsDOFFarBlurMinSlider::onMouseDragged(%this) +{ + $DOFPostFx::BlurMin = %this.value; + ppOptionsUpdateDOFSettings(); +} + +function ppOptionsDOFFarBlurMaxSlider::onMouseDragged(%this) +{ + $DOFPostFx::BlurMax = %this.value; + ppOptionsUpdateDOFSettings(); +} + +function ppOptionsDOFFocusRangeMinSlider::onMouseDragged(%this) +{ + $DOFPostFx::FocusRangeMin = %this.value; + ppOptionsUpdateDOFSettings(); +} + +function ppOptionsDOFFocusRangeMaxSlider::onMouseDragged(%this) +{ + $DOFPostFx::FocusRangeMax = %this.value; + ppOptionsUpdateDOFSettings(); +} + +function ppOptionsDOFBlurCurveNearSlider::onMouseDragged(%this) +{ + $DOFPostFx::BlurCurveNear = %this.value; + ppOptionsUpdateDOFSettings(); +} + +function ppOptionsDOFBlurCurveFarSlider::onMouseDragged(%this) +{ + $DOFPostFx::BlurCurveFar = %this.value; + ppOptionsUpdateDOFSettings(); +} + +function ppOptionsEnableHDRDebug::onAction(%this) +{ + if ( %this.getValue() ) + LuminanceVisPostFX.enable(); + else + LuminanceVisPostFX.disable(); +} + +function ppOptionsUpdateVignetteSettings() +{ + if($PostFXManager::PostFX::EnableVignette) + { + VignettePostEffect.enable(); + } + else + { + VignettePostEffect.disable(); + } +} + +function ppOptionsVignetteEnableVignette::onAction(%this) +{ + $PostFXManager::PostFX::EnableVignette = %this.getValue(); + ppOptionsUpdateVignetteSettings(); +} + +function ppColorCorrection_selectFile() +{ + %filter = "Image Files (*.png, *.jpg, *.dds, *.bmp, *.gif, *.jng. *.tga)|*.png;*.jpg;*.dds;*.bmp;*.gif;*.jng;*.tga|All Files (*.*)|*.*|"; + getLoadFilename( %filter, "ppColorCorrection_selectFileHandler"); +} + +function ppColorCorrection_selectFileHandler( %filename ) +{ + if ( %filename $= "" || !isFile( %filename ) ) + %filename = "core/postFX/images/null_color_ramp.png"; + else + %filename = makeRelativePath( %filename, getMainDotCsDir() ); + + $HDRPostFX::colorCorrectionRamp = %filename; + PostFXManager-->ColorCorrectionFileName.Text = %filename; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/scripts/postFxManager.gui.settings.cs b/Templates/BaseGame/game/core/postFX/scripts/postFxManager.gui.settings.cs new file mode 100644 index 000000000..eefcd9b7e --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/postFxManager.gui.settings.cs @@ -0,0 +1,439 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +$PostFXManager::defaultPreset = "./default.postfxpreset.cs"; + +function PostFXManager::settingsSetEnabled(%this, %bEnablePostFX) +{ + $PostFXManager::PostFX::Enabled = %bEnablePostFX; + + //if to enable the postFX, apply the ones that are enabled + if ( %bEnablePostFX ) + { + //SSAO, HDR, LightRays, DOF + + if ( $PostFXManager::PostFX::EnableSSAO ) + SSAOPostFx.enable(); + else + SSAOPostFx.disable(); + + if ( $PostFXManager::PostFX::EnableHDR ) + HDRPostFX.enable(); + else + HDRPostFX.disable(); + + if ( $PostFXManager::PostFX::EnableLightRays ) + LightRayPostFX.enable(); + else + LightRayPostFX.disable(); + + if ( $PostFXManager::PostFX::EnableDOF ) + DOFPostEffect.enable(); + else + DOFPostEffect.disable(); + + if ( $PostFXManager::PostFX::EnableVignette ) + VignettePostEffect.enable(); + else + VignettePostEffect.disable(); + + postVerbose("% - PostFX Manager - PostFX enabled"); + } + else + { + //Disable all postFX + + SSAOPostFx.disable(); + HDRPostFX.disable(); + LightRayPostFX.disable(); + DOFPostEffect.disable(); + VignettePostEffect.disable(); + + postVerbose("% - PostFX Manager - PostFX disabled"); + } + + VolFogGlowPostFx.disable(); +} + +function PostFXManager::settingsEffectSetEnabled(%this, %sName, %bEnable) +{ + %postEffect = 0; + + //Determine the postFX to enable, and apply the boolean + if(%sName $= "SSAO") + { + %postEffect = SSAOPostFx; + $PostFXManager::PostFX::EnableSSAO = %bEnable; + //$pref::PostFX::SSAO::Enabled = %bEnable; + } + else if(%sName $= "HDR") + { + %postEffect = HDRPostFX; + $PostFXManager::PostFX::EnableHDR = %bEnable; + //$pref::PostFX::HDR::Enabled = %bEnable; + } + else if(%sName $= "LightRays") + { + %postEffect = LightRayPostFX; + $PostFXManager::PostFX::EnableLightRays = %bEnable; + //$pref::PostFX::LightRays::Enabled = %bEnable; + } + else if(%sName $= "DOF") + { + %postEffect = DOFPostEffect; + $PostFXManager::PostFX::EnableDOF = %bEnable; + //$pref::PostFX::DOF::Enabled = %bEnable; + } + else if(%sName $= "Vignette") + { + %postEffect = VignettePostEffect; + $PostFXManager::PostFX::EnableVignette = %bEnable; + //$pref::PostFX::Vignette::Enabled = %bEnable; + } + + // Apply the change + if ( %bEnable == true ) + { + %postEffect.enable(); + postVerbose("% - PostFX Manager - " @ %sName @ " enabled"); + } + else + { + %postEffect.disable(); + postVerbose("% - PostFX Manager - " @ %sName @ " disabled"); + } +} + +function PostFXManager::settingsRefreshSSAO(%this) +{ + //Apply the enabled flag + ppOptionsEnableSSAO.setValue($PostFXManager::PostFX::EnableSSAO); + + //Add the items we need to display + ppOptionsSSAOQuality.clear(); + ppOptionsSSAOQuality.add("Low", 0); + ppOptionsSSAOQuality.add("Medium", 1); + ppOptionsSSAOQuality.add("High", 2); + + //Set the selected, after adding the items! + ppOptionsSSAOQuality.setSelected($SSAOPostFx::quality); + + //SSAO - Set the values of the sliders, General Tab + ppOptionsSSAOOverallStrength.setValue($SSAOPostFx::overallStrength); + ppOptionsSSAOBlurDepth.setValue($SSAOPostFx::blurDepthTol); + ppOptionsSSAOBlurNormal.setValue($SSAOPostFx::blurNormalTol); + + //SSAO - Set the values for the near tab + ppOptionsSSAONearDepthMax.setValue($SSAOPostFx::sDepthMax); + ppOptionsSSAONearDepthMin.setValue($SSAOPostFx::sDepthMin); + ppOptionsSSAONearRadius.setValue($SSAOPostFx::sRadius); + ppOptionsSSAONearStrength.setValue($SSAOPostFx::sStrength); + ppOptionsSSAONearToleranceNormal.setValue($SSAOPostFx::sNormalTol); + ppOptionsSSAONearTolerancePower.setValue($SSAOPostFx::sNormalPow); + + //SSAO - Set the values for the far tab + ppOptionsSSAOFarDepthMax.setValue($SSAOPostFx::lDepthMax); + ppOptionsSSAOFarDepthMin.setValue($SSAOPostFx::lDepthMin); + ppOptionsSSAOFarRadius.setValue($SSAOPostFx::lRadius); + ppOptionsSSAOFarStrength.setValue($SSAOPostFx::lStrength); + ppOptionsSSAOFarToleranceNormal.setValue($SSAOPostFx::lNormalTol); + ppOptionsSSAOFarTolerancePower.setValue($SSAOPostFx::lNormalPow); +} + +function PostFXManager::settingsRefreshHDR(%this) +{ + //Apply the enabled flag + ppOptionsEnableHDR.setValue($PostFXManager::PostFX::EnableHDR); + + ppOptionsHDRBloom.setValue($HDRPostFX::enableBloom); + ppOptionsHDRBloomBlurBrightPassThreshold.setValue($HDRPostFX::brightPassThreshold); + ppOptionsHDRBloomBlurMean.setValue($HDRPostFX::gaussMean); + ppOptionsHDRBloomBlurMultiplier.setValue($HDRPostFX::gaussMultiplier); + ppOptionsHDRBloomBlurStdDev.setValue($HDRPostFX::gaussStdDev); + ppOptionsHDRBrightnessAdaptRate.setValue($HDRPostFX::adaptRate); + ppOptionsHDREffectsBlueShift.setValue($HDRPostFX::enableBlueShift); + ppOptionsHDREffectsBlueShiftColor.BaseColor = $HDRPostFX::blueShiftColor; + ppOptionsHDREffectsBlueShiftColor.PickColor = $HDRPostFX::blueShiftColor; + ppOptionsHDRKeyValue.setValue($HDRPostFX::keyValue); + ppOptionsHDRMinLuminance.setValue($HDRPostFX::minLuminace); + ppOptionsHDRToneMapping.setValue($HDRPostFX::enableToneMapping); + ppOptionsHDRToneMappingAmount.setValue($HDRPostFX::enableToneMapping); + ppOptionsHDRWhiteCutoff.setValue($HDRPostFX::whiteCutoff); + + %this-->ColorCorrectionFileName.Text = $HDRPostFX::colorCorrectionRamp; +} + +function PostFXManager::settingsRefreshLightrays(%this) +{ + //Apply the enabled flag + ppOptionsEnableLightRays.setValue($PostFXManager::PostFX::EnableLightRays); + + ppOptionsLightRaysBrightScalar.setValue($LightRayPostFX::brightScalar); + + ppOptionsLightRaysSampleScalar.setValue($LightRayPostFX::numSamples); + ppOptionsLightRaysDensityScalar.setValue($LightRayPostFX::density); + ppOptionsLightRaysWeightScalar.setValue($LightRayPostFX::weight); + ppOptionsLightRaysDecayScalar.setValue($LightRayPostFX::decay); +} + +function PostFXManager::settingsRefreshDOF(%this) +{ + //Apply the enabled flag + ppOptionsEnableDOF.setValue($PostFXManager::PostFX::EnableDOF); + + + //ppOptionsDOFEnableDOF.setValue($PostFXManager::PostFX::EnableDOF); + ppOptionsDOFEnableAutoFocus.setValue($DOFPostFx::EnableAutoFocus); + + ppOptionsDOFFarBlurMinSlider.setValue($DOFPostFx::BlurMin); + ppOptionsDOFFarBlurMaxSlider.setValue($DOFPostFx::BlurMax); + + ppOptionsDOFFocusRangeMinSlider.setValue($DOFPostFx::FocusRangeMin); + ppOptionsDOFFocusRangeMaxSlider.setValue($DOFPostFx::FocusRangeMax); + + ppOptionsDOFBlurCurveNearSlider.setValue($DOFPostFx::BlurCurveNear); + ppOptionsDOFBlurCurveFarSlider.setValue($DOFPostFx::BlurCurveFar); + +} + +function PostFXManager::settingsRefreshVignette(%this) +{ + //Apply the enabled flag + ppOptionsEnableVignette.setValue($PostFXManager::PostFX::EnableVignette); + +} + +function PostFXManager::settingsRefreshAll(%this) +{ + $PostFXManager::PostFX::Enabled = $pref::enablePostEffects; + $PostFXManager::PostFX::EnableSSAO = SSAOPostFx.isEnabled(); + $PostFXManager::PostFX::EnableHDR = HDRPostFX.isEnabled(); + $PostFXManager::PostFX::EnableLightRays = LightRayPostFX.isEnabled(); + $PostFXManager::PostFX::EnableDOF = DOFPostEffect.isEnabled(); + $PostFXManager::PostFX::EnableVignette = VignettePostEffect.isEnabled(); + + //For all the postFX here, apply the active settings in the system + //to the gui controls. + + %this.settingsRefreshSSAO(); + %this.settingsRefreshHDR(); + %this.settingsRefreshLightrays(); + %this.settingsRefreshDOF(); + %this.settingsRefreshVignette(); + + ppOptionsEnable.setValue($PostFXManager::PostFX::Enabled); + + postVerbose("% - PostFX Manager - GUI values updated."); +} + +function PostFXManager::settingsApplyFromPreset(%this) +{ + postVerbose("% - PostFX Manager - Applying from preset"); + + //SSAO Settings + $SSAOPostFx::blurDepthTol = $PostFXManager::Settings::SSAO::blurDepthTol; + $SSAOPostFx::blurNormalTol = $PostFXManager::Settings::SSAO::blurNormalTol; + $SSAOPostFx::lDepthMax = $PostFXManager::Settings::SSAO::lDepthMax; + $SSAOPostFx::lDepthMin = $PostFXManager::Settings::SSAO::lDepthMin; + $SSAOPostFx::lDepthPow = $PostFXManager::Settings::SSAO::lDepthPow; + $SSAOPostFx::lNormalPow = $PostFXManager::Settings::SSAO::lNormalPow; + $SSAOPostFx::lNormalTol = $PostFXManager::Settings::SSAO::lNormalTol; + $SSAOPostFx::lRadius = $PostFXManager::Settings::SSAO::lRadius; + $SSAOPostFx::lStrength = $PostFXManager::Settings::SSAO::lStrength; + $SSAOPostFx::overallStrength = $PostFXManager::Settings::SSAO::overallStrength; + $SSAOPostFx::quality = $PostFXManager::Settings::SSAO::quality; + $SSAOPostFx::sDepthMax = $PostFXManager::Settings::SSAO::sDepthMax; + $SSAOPostFx::sDepthMin = $PostFXManager::Settings::SSAO::sDepthMin; + $SSAOPostFx::sDepthPow = $PostFXManager::Settings::SSAO::sDepthPow; + $SSAOPostFx::sNormalPow = $PostFXManager::Settings::SSAO::sNormalPow; + $SSAOPostFx::sNormalTol = $PostFXManager::Settings::SSAO::sNormalTol; + $SSAOPostFx::sRadius = $PostFXManager::Settings::SSAO::sRadius; + $SSAOPostFx::sStrength = $PostFXManager::Settings::SSAO::sStrength; + + //HDR settings + $HDRPostFX::adaptRate = $PostFXManager::Settings::HDR::adaptRate; + $HDRPostFX::blueShiftColor = $PostFXManager::Settings::HDR::blueShiftColor; + $HDRPostFX::brightPassThreshold = $PostFXManager::Settings::HDR::brightPassThreshold; + $HDRPostFX::enableBloom = $PostFXManager::Settings::HDR::enableBloom; + $HDRPostFX::enableBlueShift = $PostFXManager::Settings::HDR::enableBlueShift; + $HDRPostFX::enableToneMapping = $PostFXManager::Settings::HDR::enableToneMapping; + $HDRPostFX::gaussMean = $PostFXManager::Settings::HDR::gaussMean; + $HDRPostFX::gaussMultiplier = $PostFXManager::Settings::HDR::gaussMultiplier; + $HDRPostFX::gaussStdDev = $PostFXManager::Settings::HDR::gaussStdDev; + $HDRPostFX::keyValue = $PostFXManager::Settings::HDR::keyValue; + $HDRPostFX::minLuminace = $PostFXManager::Settings::HDR::minLuminace; + $HDRPostFX::whiteCutoff = $PostFXManager::Settings::HDR::whiteCutoff; + $HDRPostFX::colorCorrectionRamp = $PostFXManager::Settings::ColorCorrectionRamp; + + //Light rays settings + $LightRayPostFX::brightScalar = $PostFXManager::Settings::LightRays::brightScalar; + + $LightRayPostFX::numSamples = $PostFXManager::Settings::LightRays::numSamples; + $LightRayPostFX::density = $PostFXManager::Settings::LightRays::density; + $LightRayPostFX::weight = $PostFXManager::Settings::LightRays::weight; + $LightRayPostFX::decay = $PostFXManager::Settings::LightRays::decay; + + //DOF settings + $DOFPostFx::EnableAutoFocus = $PostFXManager::Settings::DOF::EnableAutoFocus; + $DOFPostFx::BlurMin = $PostFXManager::Settings::DOF::BlurMin; + $DOFPostFx::BlurMax = $PostFXManager::Settings::DOF::BlurMax; + $DOFPostFx::FocusRangeMin = $PostFXManager::Settings::DOF::FocusRangeMin; + $DOFPostFx::FocusRangeMax = $PostFXManager::Settings::DOF::FocusRangeMax; + $DOFPostFx::BlurCurveNear = $PostFXManager::Settings::DOF::BlurCurveNear; + $DOFPostFx::BlurCurveFar = $PostFXManager::Settings::DOF::BlurCurveFar; + + //Vignette settings + $VignettePostEffect::VMax = $PostFXManager::Settings::Vignette::VMax; + $VignettePostEffect::VMin = $PostFXManager::Settings::Vignette::VMin; + + if ( $PostFXManager::forceEnableFromPresets ) + { + $PostFXManager::PostFX::Enabled = $PostFXManager::Settings::EnablePostFX; + $PostFXManager::PostFX::EnableDOF = $pref::PostFX::EnableDOF ? $PostFXManager::Settings::EnableDOF : false; + $PostFXManager::PostFX::EnableVignette = $pref::PostFX::EnableVignette ? $PostFXManager::Settings::EnableVignette : false; + $PostFXManager::PostFX::EnableLightRays = $pref::PostFX::EnableLightRays ? $PostFXManager::Settings::EnableLightRays : false; + $PostFXManager::PostFX::EnableHDR = $pref::PostFX::EnableHDR ? $PostFXManager::Settings::EnableHDR : false; + $PostFXManager::PostFX::EnableSSAO = $pref::PostFX::EnabledSSAO ? $PostFXManager::Settings::EnableSSAO : false; + + %this.settingsSetEnabled( true ); + } + + //make sure we apply the correct settings to the DOF + ppOptionsUpdateDOFSettings(); + + // Update the actual GUI controls if its awake ( otherwise it will when opened ). + if ( PostFXManager.isAwake() ) + %this.settingsRefreshAll(); +} + +function PostFXManager::settingsApplySSAO(%this) +{ + $PostFXManager::Settings::SSAO::blurDepthTol = $SSAOPostFx::blurDepthTol; + $PostFXManager::Settings::SSAO::blurNormalTol = $SSAOPostFx::blurNormalTol; + $PostFXManager::Settings::SSAO::lDepthMax = $SSAOPostFx::lDepthMax; + $PostFXManager::Settings::SSAO::lDepthMin = $SSAOPostFx::lDepthMin; + $PostFXManager::Settings::SSAO::lDepthPow = $SSAOPostFx::lDepthPow; + $PostFXManager::Settings::SSAO::lNormalPow = $SSAOPostFx::lNormalPow; + $PostFXManager::Settings::SSAO::lNormalTol = $SSAOPostFx::lNormalTol; + $PostFXManager::Settings::SSAO::lRadius = $SSAOPostFx::lRadius; + $PostFXManager::Settings::SSAO::lStrength = $SSAOPostFx::lStrength; + $PostFXManager::Settings::SSAO::overallStrength = $SSAOPostFx::overallStrength; + $PostFXManager::Settings::SSAO::quality = $SSAOPostFx::quality; + $PostFXManager::Settings::SSAO::sDepthMax = $SSAOPostFx::sDepthMax; + $PostFXManager::Settings::SSAO::sDepthMin = $SSAOPostFx::sDepthMin; + $PostFXManager::Settings::SSAO::sDepthPow = $SSAOPostFx::sDepthPow; + $PostFXManager::Settings::SSAO::sNormalPow = $SSAOPostFx::sNormalPow; + $PostFXManager::Settings::SSAO::sNormalTol = $SSAOPostFx::sNormalTol; + $PostFXManager::Settings::SSAO::sRadius = $SSAOPostFx::sRadius; + $PostFXManager::Settings::SSAO::sStrength = $SSAOPostFx::sStrength; + + postVerbose("% - PostFX Manager - Settings Saved - SSAO"); + +} + +function PostFXManager::settingsApplyHDR(%this) +{ + $PostFXManager::Settings::HDR::adaptRate = $HDRPostFX::adaptRate; + $PostFXManager::Settings::HDR::blueShiftColor = $HDRPostFX::blueShiftColor; + $PostFXManager::Settings::HDR::brightPassThreshold = $HDRPostFX::brightPassThreshold; + $PostFXManager::Settings::HDR::enableBloom = $HDRPostFX::enableBloom; + $PostFXManager::Settings::HDR::enableBlueShift = $HDRPostFX::enableBlueShift; + $PostFXManager::Settings::HDR::enableToneMapping = $HDRPostFX::enableToneMapping; + $PostFXManager::Settings::HDR::gaussMean = $HDRPostFX::gaussMean; + $PostFXManager::Settings::HDR::gaussMultiplier = $HDRPostFX::gaussMultiplier; + $PostFXManager::Settings::HDR::gaussStdDev = $HDRPostFX::gaussStdDev; + $PostFXManager::Settings::HDR::keyValue = $HDRPostFX::keyValue; + $PostFXManager::Settings::HDR::minLuminace = $HDRPostFX::minLuminace; + $PostFXManager::Settings::HDR::whiteCutoff = $HDRPostFX::whiteCutoff; + $PostFXManager::Settings::ColorCorrectionRamp = $HDRPostFX::colorCorrectionRamp; + + postVerbose("% - PostFX Manager - Settings Saved - HDR"); +} + +function PostFXManager::settingsApplyLightRays(%this) +{ + $PostFXManager::Settings::LightRays::brightScalar = $LightRayPostFX::brightScalar; + + $PostFXManager::Settings::LightRays::numSamples = $LightRayPostFX::numSamples; + $PostFXManager::Settings::LightRays::density = $LightRayPostFX::density; + $PostFXManager::Settings::LightRays::weight = $LightRayPostFX::weight; + $PostFXManager::Settings::LightRays::decay = $LightRayPostFX::decay; + + postVerbose("% - PostFX Manager - Settings Saved - Light Rays"); + +} + +function PostFXManager::settingsApplyDOF(%this) +{ + $PostFXManager::Settings::DOF::EnableAutoFocus = $DOFPostFx::EnableAutoFocus; + $PostFXManager::Settings::DOF::BlurMin = $DOFPostFx::BlurMin; + $PostFXManager::Settings::DOF::BlurMax = $DOFPostFx::BlurMax; + $PostFXManager::Settings::DOF::FocusRangeMin = $DOFPostFx::FocusRangeMin; + $PostFXManager::Settings::DOF::FocusRangeMax = $DOFPostFx::FocusRangeMax; + $PostFXManager::Settings::DOF::BlurCurveNear = $DOFPostFx::BlurCurveNear; + $PostFXManager::Settings::DOF::BlurCurveFar = $DOFPostFx::BlurCurveFar; + + postVerbose("% - PostFX Manager - Settings Saved - DOF"); + +} + +function PostFXManager::settingsApplyVignette(%this) +{ + $PostFXManager::Settings::Vignette::VMax = $VignettePostEffect::VMax; + $PostFXManager::Settings::Vignette::VMin = $VignettePostEffect::VMin; + + postVerbose("% - PostFX Manager - Settings Saved - Vignette"); + +} + +function PostFXManager::settingsApplyAll(%this, %sFrom) +{ + // Apply settings which control if effects are on/off altogether. + $PostFXManager::Settings::EnablePostFX = $PostFXManager::PostFX::Enabled; + $PostFXManager::Settings::EnableDOF = $PostFXManager::PostFX::EnableDOF; + $PostFXManager::Settings::EnableVignette = $PostFXManager::PostFX::EnableVignette; + $PostFXManager::Settings::EnableLightRays = $PostFXManager::PostFX::EnableLightRays; + $PostFXManager::Settings::EnableHDR = $PostFXManager::PostFX::EnableHDR; + $PostFXManager::Settings::EnableSSAO = $PostFXManager::PostFX::EnableSSAO; + + // Apply settings should save the values in the system to the + // the preset structure ($PostFXManager::Settings::*) + + // SSAO Settings + %this.settingsApplySSAO(); + // HDR settings + %this.settingsApplyHDR(); + // Light rays settings + %this.settingsApplyLightRays(); + // DOF + %this.settingsApplyDOF(); + // Vignette + %this.settingsApplyVignette(); + + postVerbose("% - PostFX Manager - All Settings applied to $PostFXManager::Settings"); +} + +function PostFXManager::settingsApplyDefaultPreset(%this) +{ + PostFXManager::loadPresetHandler($PostFXManager::defaultPreset); +} + diff --git a/Templates/BaseGame/game/core/postFX/scripts/postFxManager.persistance.cs b/Templates/BaseGame/game/core/postFX/scripts/postFxManager.persistance.cs new file mode 100644 index 000000000..31fec95f1 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/postFxManager.persistance.cs @@ -0,0 +1,79 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +// Used to name the saved files. +$PostFXManager::fileExtension = ".postfxpreset.cs"; + +// The filter string for file open/save dialogs. +$PostFXManager::fileFilter = "Post Effect Presets|*.postfxpreset.cs"; + +// Enable / disable PostFX when loading presets or just apply the settings? +$PostFXManager::forceEnableFromPresets = true; + +//Load a preset file from the disk, and apply the settings to the +//controls. If bApplySettings is true - the actual values in the engine +//will be changed to reflect the settings from the file. +function PostFXManager::loadPresetFile() +{ + //Show the dialog and set the flag + getLoadFilename($PostFXManager::fileFilter, "PostFXManager::loadPresetHandler"); +} + +function PostFXManager::loadPresetHandler( %filename ) +{ + //Check the validity of the file + if ( isScriptFile( %filename ) ) + { + %filename = expandFilename(%filename); + postVerbose("% - PostFX Manager - Executing " @ %filename); + exec(%filename); + + PostFXManager.settingsApplyFromPreset(); + } +} + +//Save a preset file to the specified file. The extension used +//is specified by $PostFXManager::fileExtension for on the fly +//name changes to the extension used. + +function PostFXManager::savePresetFile(%this) +{ + %defaultFile = filePath($Client::MissionFile) @ "/" @ fileBase($Client::MissionFile); + getSaveFilename($PostFXManager::fileFilter, "PostFXManager::savePresetHandler", %defaultFile); +} + +//Called from the PostFXManager::savePresetFile() function +function PostFXManager::savePresetHandler( %filename ) +{ + %filename = makeRelativePath( %filename, getMainDotCsDir() ); + if(strStr(%filename, ".") == -1) + %filename = %filename @ $PostFXManager::fileExtension; + + //Apply the current settings to the preset + PostFXManager.settingsApplyAll(); + + export("$PostFXManager::Settings::*", %filename, false); + + postVerbose("% - PostFX Manager - Save complete. Preset saved at : " @ %filename); +} + diff --git a/Templates/BaseGame/game/core/postFX/scripts/ssao.cs b/Templates/BaseGame/game/core/postFX/scripts/ssao.cs new file mode 100644 index 000000000..5fe405a82 --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/ssao.cs @@ -0,0 +1,302 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +/// +$SSAOPostFx::overallStrength = 2.0; + +// TODO: Add small/large param docs. + +// The small radius SSAO settings. +$SSAOPostFx::sRadius = 0.1; +$SSAOPostFx::sStrength = 6.0; +$SSAOPostFx::sDepthMin = 0.1; +$SSAOPostFx::sDepthMax = 1.0; +$SSAOPostFx::sDepthPow = 1.0; +$SSAOPostFx::sNormalTol = 0.0; +$SSAOPostFx::sNormalPow = 1.0; + +// The large radius SSAO settings. +$SSAOPostFx::lRadius = 1.0; +$SSAOPostFx::lStrength = 10.0; +$SSAOPostFx::lDepthMin = 0.2; +$SSAOPostFx::lDepthMax = 2.0; +$SSAOPostFx::lDepthPow = 0.2; +$SSAOPostFx::lNormalTol = -0.5; +$SSAOPostFx::lNormalPow = 2.0; + +/// Valid values: 0, 1, 2 +$SSAOPostFx::quality = 0; + +/// +$SSAOPostFx::blurDepthTol = 0.001; + +/// +$SSAOPostFx::blurNormalTol = 0.95; + +/// +$SSAOPostFx::targetScale = "0.5 0.5"; + + +function SSAOPostFx::onAdd( %this ) +{ + %this.wasVis = "Uninitialized"; + %this.quality = "Uninitialized"; +} + +function SSAOPostFx::preProcess( %this ) +{ + if ( $SSAOPostFx::quality !$= %this.quality ) + { + %this.quality = mClamp( mRound( $SSAOPostFx::quality ), 0, 2 ); + + %this.setShaderMacro( "QUALITY", %this.quality ); + } + + %this.targetScale = $SSAOPostFx::targetScale; +} + +function SSAOPostFx::setShaderConsts( %this ) +{ + %this.setShaderConst( "$overallStrength", $SSAOPostFx::overallStrength ); + + // Abbreviate is s-small l-large. + + %this.setShaderConst( "$sRadius", $SSAOPostFx::sRadius ); + %this.setShaderConst( "$sStrength", $SSAOPostFx::sStrength ); + %this.setShaderConst( "$sDepthMin", $SSAOPostFx::sDepthMin ); + %this.setShaderConst( "$sDepthMax", $SSAOPostFx::sDepthMax ); + %this.setShaderConst( "$sDepthPow", $SSAOPostFx::sDepthPow ); + %this.setShaderConst( "$sNormalTol", $SSAOPostFx::sNormalTol ); + %this.setShaderConst( "$sNormalPow", $SSAOPostFx::sNormalPow ); + + %this.setShaderConst( "$lRadius", $SSAOPostFx::lRadius ); + %this.setShaderConst( "$lStrength", $SSAOPostFx::lStrength ); + %this.setShaderConst( "$lDepthMin", $SSAOPostFx::lDepthMin ); + %this.setShaderConst( "$lDepthMax", $SSAOPostFx::lDepthMax ); + %this.setShaderConst( "$lDepthPow", $SSAOPostFx::lDepthPow ); + %this.setShaderConst( "$lNormalTol", $SSAOPostFx::lNormalTol ); + %this.setShaderConst( "$lNormalPow", $SSAOPostFx::lNormalPow ); + + %blur = %this->blurY; + %blur.setShaderConst( "$blurDepthTol", $SSAOPostFx::blurDepthTol ); + %blur.setShaderConst( "$blurNormalTol", $SSAOPostFx::blurNormalTol ); + + %blur = %this->blurX; + %blur.setShaderConst( "$blurDepthTol", $SSAOPostFx::blurDepthTol ); + %blur.setShaderConst( "$blurNormalTol", $SSAOPostFx::blurNormalTol ); + + %blur = %this->blurY2; + %blur.setShaderConst( "$blurDepthTol", $SSAOPostFx::blurDepthTol ); + %blur.setShaderConst( "$blurNormalTol", $SSAOPostFx::blurNormalTol ); + + %blur = %this->blurX2; + %blur.setShaderConst( "$blurDepthTol", $SSAOPostFx::blurDepthTol ); + %blur.setShaderConst( "$blurNormalTol", $SSAOPostFx::blurNormalTol ); +} + +function SSAOPostFx::onEnabled( %this ) +{ + // This tells the AL shaders to reload and sample + // from our #ssaoMask texture target. + $AL::UseSSAOMask = true; + + return true; +} + +function SSAOPostFx::onDisabled( %this ) +{ + $AL::UseSSAOMask = false; +} + + +//----------------------------------------------------------------------------- +// GFXStateBlockData / ShaderData +//----------------------------------------------------------------------------- + +singleton GFXStateBlockData( SSAOStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; + samplerStates[1] = SamplerWrapLinear; + samplerStates[2] = SamplerClampPoint; +}; + +singleton GFXStateBlockData( SSAOBlurStateBlock : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerClampPoint; +}; + +singleton ShaderData( SSAOShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/SSAO_P.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_P.glsl"; + + samplerNames[0] = "$deferredMap"; + samplerNames[1] = "$randNormalTex"; + samplerNames[2] = "$powTable"; + + pixVersion = 3.0; +}; + +singleton ShaderData( SSAOBlurYShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/SSAO_Blur_V.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/SSAO_Blur_P.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_Blur_V.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_Blur_P.glsl"; + + samplerNames[0] = "$occludeMap"; + samplerNames[1] = "$deferredMap"; + + pixVersion = 3.0; + + defines = "BLUR_DIR=float2(0.0,1.0)"; +}; + +singleton ShaderData( SSAOBlurXShader : SSAOBlurYShader ) +{ + defines = "BLUR_DIR=float2(1.0,0.0)"; +}; + +//----------------------------------------------------------------------------- +// PostEffects +//----------------------------------------------------------------------------- + +singleton PostEffect( SSAOPostFx ) +{ + allowReflectPass = false; + + renderTime = "PFXBeforeBin"; + renderBin = "AL_LightBinMgr"; + renderPriority = 10; + + shader = SSAOShader; + stateBlock = SSAOStateBlock; + + texture[0] = "#deferred"; + texture[1] = "core/postFX/images/noise.png"; + texture[2] = "#ssao_pow_table"; + + target = "$outTex"; + targetScale = "0.5 0.5"; + targetViewport = "PFXTargetViewport_NamedInTexture0"; + + singleton PostEffect() + { + internalName = "blurY"; + + shader = SSAOBlurYShader; + stateBlock = SSAOBlurStateBlock; + + texture[0] = "$inTex"; + texture[1] = "#deferred"; + + target = "$outTex"; + }; + + singleton PostEffect() + { + internalName = "blurX"; + + shader = SSAOBlurXShader; + stateBlock = SSAOBlurStateBlock; + + texture[0] = "$inTex"; + texture[1] = "#deferred"; + + target = "$outTex"; + }; + + singleton PostEffect() + { + internalName = "blurY2"; + + shader = SSAOBlurYShader; + stateBlock = SSAOBlurStateBlock; + + texture[0] = "$inTex"; + texture[1] = "#deferred"; + + target = "$outTex"; + }; + + singleton PostEffect() + { + internalName = "blurX2"; + + shader = SSAOBlurXShader; + stateBlock = SSAOBlurStateBlock; + + texture[0] = "$inTex"; + texture[1] = "#deferred"; + + // We write to a mask texture which is then + // read by the lighting shaders to mask ambient. + target = "#ssaoMask"; + }; +}; + + +/// Just here for debug visualization of the +/// SSAO mask texture used during lighting. +singleton PostEffect( SSAOVizPostFx ) +{ + allowReflectPass = false; + + shader = PFX_PassthruShader; + stateBlock = PFX_DefaultStateBlock; + + texture[0] = "#ssaoMask"; + + target = "$backbuffer"; +}; + +singleton ShaderData( SSAOPowTableShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/SSAO_PowerTable_V.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/SSAO_PowerTable_P.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_PowerTable_V.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/ssao/gl/SSAO_PowerTable_P.glsl"; + + pixVersion = 2.0; +}; + +singleton PostEffect( SSAOPowTablePostFx ) +{ + shader = SSAOPowTableShader; + stateBlock = PFX_DefaultStateBlock; + + renderTime = "PFXTexGenOnDemand"; + + target = "#ssao_pow_table"; + + targetFormat = "GFXFormatR16F"; + targetSize = "256 1"; +}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/postFX/scripts/turbulence.cs b/Templates/BaseGame/game/core/postFX/scripts/turbulence.cs new file mode 100644 index 000000000..967c3b2bf --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/turbulence.cs @@ -0,0 +1,57 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton GFXStateBlockData( PFX_TurbulenceStateBlock : PFX_DefaultStateBlock) +{ + zDefined = false; + zEnable = false; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; +}; + +singleton ShaderData( PFX_TurbulenceShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/turbulenceP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/gl/turbulenceP.glsl"; + + samplerNames[0] = "$inputTex"; + pixVersion = 3.0; +}; + +singleton PostEffect( TurbulenceFx ) +{ + isEnabled = false; + allowReflectPass = true; + + renderTime = "PFXAfterDiffuse"; + renderBin = "GlowBin"; + renderPriority = 0.5; // Render after the glows themselves + + shader = PFX_TurbulenceShader; + stateBlock=PFX_TurbulenceStateBlock; + texture[0] = "$backBuffer"; + }; diff --git a/Templates/BaseGame/game/core/postFX/scripts/vignette.cs b/Templates/BaseGame/game/core/postFX/scripts/vignette.cs new file mode 100644 index 000000000..d22f7d14a --- /dev/null +++ b/Templates/BaseGame/game/core/postFX/scripts/vignette.cs @@ -0,0 +1,55 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +$VignettePostEffect::VMax = 0.6; +$VignettePostEffect::VMin = 0.2; + +singleton ShaderData( VignetteShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/postFX/postFxV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/postFX/vignette/VignetteP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/postFX/gl/postFxV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/postFX/vignette/gl/VignetteP.glsl"; + + samplerNames[0] = "$backBuffer"; + + pixVersion = 2.0; +}; + +singleton PostEffect( VignettePostEffect ) +{ + isEnabled = false; + allowReflectPass = false; + renderTime = "PFXAfterBin"; + renderBin = "GlowBin"; + shader = VignetteShader; + stateBlock = PFX_DefaultStateBlock; + texture[0] = "$backBuffer"; + renderPriority = 10; +}; + +function VignettePostEffect::setShaderConsts(%this) +{ + %this.setShaderConst("$Vmax", $VignettePostEffect::VMax); + %this.setShaderConst("$Vmin", $VignettePostEffect::VMin); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/Core_Rendering.cs b/Templates/BaseGame/game/core/rendering/Core_Rendering.cs new file mode 100644 index 000000000..d09e0cbe3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/Core_Rendering.cs @@ -0,0 +1,20 @@ + +function Core_Rendering::onCreate(%this) +{ + $Core::MissingTexturePath = "core/rendering/images/missingTexture"; + $Core::UnAvailableTexturePath = "core/rendering/images/unavailable"; + $Core::WarningTexturePath = "core/rendering/images/warnMat"; + $Core::CommonShaderPath = "core/rendering/shaders"; + + exec("./scripts/renderManager.cs"); + exec("./scripts/gfxData/clouds.cs"); + exec("./scripts/gfxData/commonMaterialData.cs"); + exec("./scripts/gfxData/scatterSky.cs"); + exec("./scripts/gfxData/shaders.cs"); + exec("./scripts/gfxData/terrainBlock.cs"); + exec("./scripts/gfxData/water.cs"); +} + +function Core_Rendering::onDestroy(%this) +{ +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/Core_Rendering.module b/Templates/BaseGame/game/core/rendering/Core_Rendering.module new file mode 100644 index 000000000..9dbbfc33a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/Core_Rendering.module @@ -0,0 +1,9 @@ + + \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/images/materials.cs b/Templates/BaseGame/game/core/rendering/images/materials.cs new file mode 100644 index 000000000..a13c751b3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/images/materials.cs @@ -0,0 +1,32 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton Material( Empty ) +{ +}; + +singleton Material(WarningMaterial) { + detailMap[0] = "missingTexture"; + diffuseColor[0] = "25 16 0"; + emissive[0] = false; + translucent = false; +}; diff --git a/Templates/BaseGame/game/core/rendering/images/missingTexture.png b/Templates/BaseGame/game/core/rendering/images/missingTexture.png new file mode 100644 index 0000000000000000000000000000000000000000..80a7874da967ad523e1a3308f3f14c66d4eed503 GIT binary patch literal 10645 zcmeHt_g_=nv-S>MP*4G}5D zE)M{}2HO)>E&w0_UP=IR;uB`OWifby#JJe}1(bZ=$pUYrf{!^I1Ay{Og|)NN;Jrq` z2^R+dNYVlT{1pIL1%JX%0zljW0ATwAz>!A)pca`+I&~C$ur=1&Bla{ZC>DJ-IuLL^ z8xj$#?`VBSBi=~g$mHe34;TRG%-UKVJCoqY8R)nTt4Wj@8hvs%d{1KNr?xiU)_B0| z+7+EhAVlIH#XmZ9|CID_(Qv5yDZOXu@y5f{V}%$}%egGwEtKGbJP%!*l4r70&kBpO zHi%9chC(Eya@_q?(O0*?p4!+(o;xCRQ=&;Y;#LgNMEO9jm0 zw}{`q`1Ct2eq-c!zW6_Lr@r3Y%m6t>I4~;|)=&gvH`G!D?kNuhvyDpT%hMtec4+{e zt=~VykQXQAAhi<=?Dr{)s%IsBk-+%(|fnO4tz)x-~$ zcAw2-a%xb_wdH0DecftgWwrtG^PBTw#Zp22La(0q0bG(4;=ArRgjEyMae9QAwYC;) zG1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lZ{OQ^~Y-y^=d7O6UD_w_Y8VHU&a^>rYBNVm;5i_1f=$GQeO16s^Gud(#5) zq<{p|OpiXZ+7Sy=myMHyK(5^%z(IWdVRrqI^$#4Jufh}r7;tVh`hUNG;s~_bzySc0 z|2hW5$Kd$Cy=TJg`b+=%tN+vS|NgB0^X2{P-~adH{|{Hy`p@%mNe l814Vh^#9YDKE&YBKxnPL?nJ&?puN6t$_nc8<+5fW{|kT=cUJ%a literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/rendering/images/warnMat.dds b/Templates/BaseGame/game/core/rendering/images/warnMat.dds new file mode 100644 index 0000000000000000000000000000000000000000..ea99dcbd74a8b2ae49c5cff5a69743498a66e937 GIT binary patch literal 699192 zcmeFaPi$M+p67Q(#Rw%q$lVCxuCM)|w4M~V{T2fJ7L9l5=?1EHs%~9T&ZsR?vxyfI zsJbygxsX^C8(DbKi&_Xl?Ia2f*klZ%fGCLvqZVm(77oyhDio(NUSwqH4PbCKf$})> zK(x$!f9LR!6h(@c5=l|gmq67qMe^Qr&pE%(@6Y+2bN=K{{@nQ=Ez9~Z?NQ76FYpif z&kD-_tTFX}|NnFFRr&d!EYAO`*{_1Od*;t>$tlSnS+X5C4k!oY069PokOSlZIY17O z1LOcXKn{=tbP?mEh4x0G{HM%>a}6jFwRD81ID`aV8azt6j+Y!2Ta>0>S?>#-q__zuK?WeVjr#I665w zc~jc8`_Ccz-TFrP=kceWh4zA)_i}DHIFIpvT8|g^R&40;d^w{^DEb86pH#|nIj!D{ z{+GX(_fn&(Or@-j%Fn4+>igz8<&wJIGA_I#_cx_i{%m~+2gfRQf;E=cc8V3)>3%zr zuifA)`-S6ZkjGJY9o)l9`78O82bwo~6|QOCm8-n#-us*zQ+|)~w*o`s*IiDa|1GHh zsL>y)9Z$+>;d-$L?I+i5)-U2WLj6h6oWt{TUZF(&Gsybq zx^w@!*Wc)W;mKYmJuSRRk6Ma%aBr;bP)x-)ds7xtZYdF(oDe@o@p|a`wr9*<#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o8AW8oZag$`ZV7Dl5-V;lfi8_fxCnHUX*hb7-#2`xGP;>Yxy?qZt$=1VGPa- z<2?XV9yRIQTfmjVMf^(Qk`^!2m+>!gr-*9-el_?uI6;eWLJ&7_UjBpkyw8A>!8ii% z9u6YoNf3^RaUpTDi{#!~IV|Vj;9oG#Nyp)oiD!?vn^Kr@Sd-}>6+3qe}jMqp3N6++&s+J;~<6HKw*8kLF;`SRp7$?*90Q@WPpH8Rm;WaXD1l2dO zzs=?MsB&1&Kll!kf8f(403)Xu&*OQiH1R5rLSZ%kckeDA|Fjp$!Hnn!`=7WnT7ODB zAEt?2<9RfNOy*=c$hcyImreT{2xz>Vr!oH7kD7lY?>h0>vJ2zjj_Kd!{1ZQq@=`V8 zMHqe8?B!GIW3dy!Pr*1+FJT^N zb-$bPYwmV!r+RkN4$aqk_Q-v$C!wE*5#9;=r{<_q!s_4|E zbJf7%56~YGRo-)exIt>q$QQF$albbaS5=%({m#2vh-0Rro)Mb5+BCt z+S}pl&A@R+oTy*^KF$4MAn92=uWW+_Whs_Gc^>ga54_&J+q6(sq0( zVY^r6&!XSz&aprT^al1kMtv%;zYgGk=Gz6wGwjM%^POQ?{^JD~UovJw108=HRI0jp z;G1jzz+Q&>-@Gx7`_R_VS2vJ9z8~KyJ66{JNb-NE{}<7I$#?(pI(G@(;;L#rqAq+3 z`xfeVQdh2^9|rK5pE!#}H(MyEs=xP3H9bu}Q_gvmJ9nu~a2Sn!27e2BVQ7ck6R+_! raGdj4Z)`w+6{m>%2LJK#4dUl7PN}gm$ggc?divbC*=z9`o}2kEfiE*! literal 0 HcmV?d00001 diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxData/clouds.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxData/clouds.cs new file mode 100644 index 000000000..00d56d6d3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxData/clouds.cs @@ -0,0 +1,55 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//------------------------------------------------------------------------------ +// CloudLayer +//------------------------------------------------------------------------------ + +singleton ShaderData( CloudLayerShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/cloudLayerV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/cloudLayerP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/cloudLayerV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/cloudLayerP.glsl"; + + samplerNames[0] = "$normalHeightMap"; + + pixVersion = 2.0; +}; + +//------------------------------------------------------------------------------ +// BasicClouds +//------------------------------------------------------------------------------ + +singleton ShaderData( BasicCloudsShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/basicCloudsV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/basicCloudsP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/basicCloudsV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/basicCloudsP.glsl"; + + samplerNames[0] = "$diffuseMap"; + + pixVersion = 2.0; +}; diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxData/commonMaterialData.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxData/commonMaterialData.cs new file mode 100644 index 000000000..c5d8ef5bc --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxData/commonMaterialData.cs @@ -0,0 +1,79 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Anim flag settings - must match material.h +// These cannot be enumed through script becuase it cannot +// handle the "|" operation for combining them together +// ie. Scroll | Wave does not work. +//----------------------------------------------------------------------------- +$scroll = 1; +$rotate = 2; +$wave = 4; +$scale = 8; +$sequence = 16; + + +// Common stateblock definitions +new GFXSamplerStateData(SamplerClampLinear) +{ + textureColorOp = GFXTOPModulate; + addressModeU = GFXAddressClamp; + addressModeV = GFXAddressClamp; + addressModeW = GFXAddressClamp; + magFilter = GFXTextureFilterLinear; + minFilter = GFXTextureFilterLinear; + mipFilter = GFXTextureFilterLinear; +}; + +new GFXSamplerStateData(SamplerClampPoint) +{ + textureColorOp = GFXTOPModulate; + addressModeU = GFXAddressClamp; + addressModeV = GFXAddressClamp; + addressModeW = GFXAddressClamp; + magFilter = GFXTextureFilterPoint; + minFilter = GFXTextureFilterPoint; + mipFilter = GFXTextureFilterPoint; +}; + +new GFXSamplerStateData(SamplerWrapLinear) +{ + textureColorOp = GFXTOPModulate; + addressModeU = GFXTextureAddressWrap; + addressModeV = GFXTextureAddressWrap; + addressModeW = GFXTextureAddressWrap; + magFilter = GFXTextureFilterLinear; + minFilter = GFXTextureFilterLinear; + mipFilter = GFXTextureFilterLinear; +}; + +new GFXSamplerStateData(SamplerWrapPoint) +{ + textureColorOp = GFXTOPModulate; + addressModeU = GFXTextureAddressWrap; + addressModeV = GFXTextureAddressWrap; + addressModeW = GFXTextureAddressWrap; + magFilter = GFXTextureFilterPoint; + minFilter = GFXTextureFilterPoint; + mipFilter = GFXTextureFilterPoint; +}; diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxData/scatterSky.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxData/scatterSky.cs new file mode 100644 index 000000000..5add01d8b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxData/scatterSky.cs @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +new GFXStateBlockData( ScatterSkySBData ) +{ + cullMode = "GFXCullNone"; + + zDefined = true; + zEnable = true; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; + samplerStates[1] = SamplerClampLinear; + vertexColorEnable = true; +}; + +singleton ShaderData( ScatterSkyShaderData ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/scatterSkyV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/scatterSkyP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/scatterSkyV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/scatterSkyP.glsl"; + + samplerNames[0] = "$nightSky"; + + pixVersion = 2.0; +}; diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxData/shaders.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxData/shaders.cs new file mode 100644 index 000000000..da3b7c864 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxData/shaders.cs @@ -0,0 +1,152 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// This file contains shader data necessary for various engine utility functions +//----------------------------------------------------------------------------- + + +singleton ShaderData( ParticlesShaderData ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/particlesV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/particlesP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/particlesV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/particlesP.glsl"; + + samplerNames[0] = "$diffuseMap"; + samplerNames[1] = "$deferredTex"; + samplerNames[2] = "$paraboloidLightMap"; + + pixVersion = 2.0; +}; + +singleton ShaderData( OffscreenParticleCompositeShaderData ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/particleCompositeV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/particleCompositeP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/particleCompositeV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/particleCompositeP.glsl"; + + samplerNames[0] = "$colorSource"; + samplerNames[1] = "$edgeSource"; + + pixVersion = 2.0; +}; + +//----------------------------------------------------------------------------- +// Planar Reflection +//----------------------------------------------------------------------------- +new ShaderData( ReflectBump ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/planarReflectBumpV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/planarReflectBumpP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectBumpV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectBumpP.glsl"; + + samplerNames[0] = "$diffuseMap"; + samplerNames[1] = "$refractMap"; + samplerNames[2] = "$bumpMap"; + + pixVersion = 2.0; +}; + +new ShaderData( Reflect ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/planarReflectV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/planarReflectP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/planarReflectP.glsl"; + + samplerNames[0] = "$diffuseMap"; + samplerNames[1] = "$refractMap"; + + pixVersion = 1.4; +}; + +//----------------------------------------------------------------------------- +// fxFoliageReplicator +//----------------------------------------------------------------------------- +new ShaderData( fxFoliageReplicatorShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/fxFoliageReplicatorV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/fxFoliageReplicatorP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/gl/fxFoliageReplicatorV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/gl/fxFoliageReplicatorP.glsl"; + + samplerNames[0] = "$diffuseMap"; + samplerNames[1] = "$alphaMap"; + + pixVersion = 1.4; +}; + +singleton ShaderData( VolumetricFogDeferredShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogPreV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogPreP.glsl"; + + pixVersion = 3.0; +}; +singleton ShaderData( VolumetricFogShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogP.glsl"; + + samplerNames[0] = "$deferredTex"; + samplerNames[1] = "$depthBuffer"; + samplerNames[2] = "$frontBuffer"; + samplerNames[3] = "$density"; + + pixVersion = 3.0; +}; +singleton ShaderData( VolumetricFogReflectionShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogPreV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/VFogRefl.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogPreV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/VolumetricFog/gl/VFogRefl.glsl"; + + pixVersion = 3.0; +}; +singleton ShaderData( CubemapSaveShader ) +{ + DXVertexShaderFile = "shaders/common/cubemapSaveV.hlsl"; + DXPixelShaderFile = "shaders/common/cubemapSaveP.hlsl"; + + OGLVertexShaderFile = "shaders/common/gl/cubemapSaveV.glsl"; + OGLPixelShaderFile = "shaders/common/gl/cubemapSaveP.glsl"; + + samplerNames[0] = "$cubemapTex"; + + pixVersion = 3.0; +}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxData/terrainBlock.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxData/terrainBlock.cs new file mode 100644 index 000000000..69802b1da --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxData/terrainBlock.cs @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +/// Used when generating the blended base texture. +singleton ShaderData( TerrainBlendShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/terrain/blendV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/terrain/blendP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/terrain/gl/blendV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/terrain/gl/blendP.glsl"; + + samplerNames[0] = "layerTex"; + samplerNames[1] = "textureMap"; + + pixVersion = 2.0; +}; diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxData/water.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxData/water.cs new file mode 100644 index 000000000..ec5e4be71 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxData/water.cs @@ -0,0 +1,208 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + + +//----------------------------------------------------------------------------- +// Water +//----------------------------------------------------------------------------- + +singleton ShaderData( WaterShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/water/waterV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/water/waterP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/water/gl/waterV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/water/gl/waterP.glsl"; + + samplerNames[0] = "$bumpMap"; // noise + samplerNames[1] = "$deferredTex"; // #deferred + samplerNames[2] = "$reflectMap"; // $reflectbuff + samplerNames[3] = "$refractBuff"; // $backbuff + samplerNames[4] = "$skyMap"; // $cubemap + samplerNames[5] = "$foamMap"; // foam + samplerNames[6] = "$depthGradMap"; // depthMap ( color gradient ) + + pixVersion = 3.0; +}; + +new GFXSamplerStateData(WaterSampler) +{ + textureColorOp = GFXTOPModulate; + addressModeU = GFXAddressWrap; + addressModeV = GFXAddressWrap; + addressModeW = GFXAddressWrap; + magFilter = GFXTextureFilterLinear; + minFilter = GFXTextureFilterAnisotropic; + mipFilter = GFXTextureFilterLinear; + maxAnisotropy = 4; +}; + +singleton GFXStateBlockData( WaterStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = WaterSampler; // noise + samplerStates[1] = SamplerClampPoint; // #deferred + samplerStates[2] = SamplerClampLinear; // $reflectbuff + samplerStates[3] = SamplerClampPoint; // $backbuff + samplerStates[4] = SamplerWrapLinear; // $cubemap + samplerStates[5] = SamplerWrapLinear; // foam + samplerStates[6] = SamplerClampLinear; // depthMap ( color gradient ) + cullDefined = true; + cullMode = "GFXCullCCW"; +}; + +singleton GFXStateBlockData( UnderWaterStateBlock : WaterStateBlock ) +{ + cullMode = "GFXCullCW"; +}; + +singleton CustomMaterial( WaterMat ) +{ + sampler["deferredTex"] = "#deferred"; + sampler["reflectMap"] = "$reflectbuff"; + sampler["refractBuff"] = "$backbuff"; + // These samplers are set in code not here. + // This is to allow different WaterObject instances + // to use this same material but override these textures + // per instance. + //sampler["bumpMap"] = ""; + //sampler["skyMap"] = ""; + //sampler["foamMap"] = ""; + //sampler["depthGradMap"] = ""; + + shader = WaterShader; + stateBlock = WaterStateBlock; + version = 3.0; + + useAnisotropic[0] = true; +}; + +//----------------------------------------------------------------------------- +// Underwater +//----------------------------------------------------------------------------- + +singleton ShaderData( UnderWaterShader : WaterShader ) +{ + defines = "UNDERWATER"; +}; + +singleton CustomMaterial( UnderwaterMat ) +{ + // These samplers are set in code not here. + // This is to allow different WaterObject instances + // to use this same material but override these textures + // per instance. + //sampler["bumpMap"] = "core/art/water/noise02"; + //sampler["foamMap"] = "core/art/water/foam"; + + sampler["deferredTex"] = "#deferred"; + sampler["refractBuff"] = "$backbuff"; + + shader = UnderWaterShader; + stateBlock = UnderWaterStateBlock; + specular = "0.75 0.75 0.75 1.0"; + specularPower = 48.0; + version = 3.0; +}; + +//----------------------------------------------------------------------------- +// Basic Water +//----------------------------------------------------------------------------- + +singleton ShaderData( WaterBasicShader ) +{ + DXVertexShaderFile = $Core::CommonShaderPath @ "/water/waterBasicV.hlsl"; + DXPixelShaderFile = $Core::CommonShaderPath @ "/water/waterBasicP.hlsl"; + + OGLVertexShaderFile = $Core::CommonShaderPath @ "/water/gl/waterBasicV.glsl"; + OGLPixelShaderFile = $Core::CommonShaderPath @ "/water/gl/waterBasicP.glsl"; + + samplerNames[0] = "$bumpMap"; + samplerNames[2] = "$reflectMap"; + samplerNames[3] = "$refractBuff"; + samplerNames[4] = "$skyMap"; + samplerNames[5] = "$depthGradMap"; + + pixVersion = 2.0; +}; + +singleton GFXStateBlockData( WaterBasicStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = WaterSampler; // noise + samplerStates[2] = SamplerClampLinear; // $reflectbuff + samplerStates[3] = SamplerClampPoint; // $backbuff + samplerStates[4] = SamplerWrapLinear; // $cubemap + cullDefined = true; + cullMode = "GFXCullCCW"; +}; + +singleton GFXStateBlockData( UnderWaterBasicStateBlock : WaterBasicStateBlock ) +{ + cullMode = "GFXCullCW"; +}; + +singleton CustomMaterial( WaterBasicMat ) +{ + // These samplers are set in code not here. + // This is to allow different WaterObject instances + // to use this same material but override these textures + // per instance. + //sampler["bumpMap"] = "core/art/water/noise02"; + //sampler["skyMap"] = "$cubemap"; + + //sampler["deferredTex"] = "#deferred"; + sampler["reflectMap"] = "$reflectbuff"; + sampler["refractBuff"] = "$backbuff"; + + cubemap = NewLevelSkyCubemap; + shader = WaterBasicShader; + stateBlock = WaterBasicStateBlock; + version = 2.0; +}; + +//----------------------------------------------------------------------------- +// Basic UnderWater +//----------------------------------------------------------------------------- + +singleton ShaderData( UnderWaterBasicShader : WaterBasicShader) +{ + defines = "UNDERWATER"; +}; + +singleton CustomMaterial( UnderwaterBasicMat ) +{ + // These samplers are set in code not here. + // This is to allow different WaterObject instances + // to use this same material but override these textures + // per instance. + //sampler["bumpMap"] = "core/art/water/noise02"; + //samplers["skyMap"] = "$cubemap"; + + //sampler["deferredTex"] = "#deferred"; + sampler["refractBuff"] = "$backbuff"; + + shader = UnderWaterBasicShader; + stateBlock = UnderWaterBasicStateBlock; + version = 2.0; +}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.ATITechnologiesInc.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.ATITechnologiesInc.cs new file mode 100644 index 000000000..10c6bdf5b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.ATITechnologiesInc.cs @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// ATI Vendor Profile Script +// +// This script is responsible for setting global +// capability strings based on the nVidia vendor. + +if(GFXCardProfiler::getVersion() < 64.44) +{ + $GFX::OutdatedDrivers = true; + $GFX::OutdatedDriversLink = "You can get newer drivers here.."; +} +else +{ + $GFX::OutdatedDrivers = false; +} diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.NVIDIA.GeForce8600.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.NVIDIA.GeForce8600.cs new file mode 100644 index 000000000..328788dac --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.NVIDIA.GeForce8600.cs @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// nVidia Vendor Profile Script +// +// This script is responsible for setting global +// capability strings based on the nVidia vendor. + +if(GFXCardProfiler::getVersion() < 1.2) +{ + $GFX::OutdatedDrivers = true; + $GFX::OutdatedDriversLink = "You can get newer drivers here.."; +} +else +{ + $GFX::OutdatedDrivers = false; +} diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.NVIDIA.QuadroFXGo1000.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.NVIDIA.QuadroFXGo1000.cs new file mode 100644 index 000000000..5681b2f6d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.NVIDIA.QuadroFXGo1000.cs @@ -0,0 +1,39 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// nVidia Vendor Profile Script +// +// This script is responsible for setting global +// capability strings based on the nVidia vendor. + +if(GFXCardProfiler::getVersion() < 53.82) +{ + $GFX::OutdatedDrivers = true; + $GFX::OutdatedDriversLink = "You can get newer drivers here.."; +} +else +{ + $GFX::OutdatedDrivers = false; +} + +// Silly card has trouble with this! +GFXCardProfiler::setCapability("autoMipmapLevel", false); diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.NVIDIA.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.NVIDIA.cs new file mode 100644 index 000000000..b33b8d5d3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.NVIDIA.cs @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// nVidia Vendor Profile Script +// +// This script is responsible for setting global +// capability strings based on the nVidia vendor. + +if(GFXCardProfiler::getVersion() < 56.72) +{ + $GFX::OutdatedDrivers = true; + $GFX::OutdatedDriversLink = "You can get newer drivers here.."; +} +else +{ + $GFX::OutdatedDrivers = false; +} diff --git a/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.cs b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.cs new file mode 100644 index 000000000..e1e299341 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/gfxprofile/D3D9.cs @@ -0,0 +1,26 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Direct3D 9 Renderer Profile Script +// +// This script is responsible for setting global +// capability strings based on the D3D9 renderer type. \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/scripts/renderManager.cs b/Templates/BaseGame/game/core/rendering/scripts/renderManager.cs new file mode 100644 index 000000000..4a80a45b1 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/scripts/renderManager.cs @@ -0,0 +1,126 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +function initRenderManager() +{ + assert( !isObject( DiffuseRenderPassManager ), "initRenderManager() - DiffuseRenderPassManager already initialized!" ); + + new RenderPassManager( DiffuseRenderPassManager ); + + // This token, and the associated render managers, ensure that driver MSAA + // does not get used for Advanced Lighting renders. The 'AL_FormatResolve' + // PostEffect copies the result to the backbuffer. + new RenderFormatToken(AL_FormatToken) + { + enabled = "false"; + + //When hdr is enabled this will be changed to the appropriate format + format = "GFXFormatR8G8B8A8_SRGB"; + depthFormat = "GFXFormatD24S8"; + aaLevel = 0; // -1 = match backbuffer + + // The contents of the back buffer before this format token is executed + // is provided in $inTex + copyEffect = "AL_FormatCopy"; + + // The contents of the render target created by this format token is + // provided in $inTex + resolveEffect = "AL_FormatCopy"; + }; + DiffuseRenderPassManager.addManager( new RenderPassStateBin() { renderOrder = 0.001; stateToken = AL_FormatToken; } ); + + // We really need to fix the sky to render after all the + // meshes... but that causes issues in reflections. + DiffuseRenderPassManager.addManager( new RenderObjectMgr(SkyBin) { bintype = "Sky"; renderOrder = 0.1; processAddOrder = 0.1; } ); + + //DiffuseRenderPassManager.addManager( new RenderVistaMgr() { bintype = "Vista"; renderOrder = 0.15; processAddOrder = 0.15; } ); + + DiffuseRenderPassManager.addManager( new RenderObjectMgr(BeginBin) { bintype = "Begin"; renderOrder = 0.2; processAddOrder = 0.2; } ); + // Normal mesh rendering. + DiffuseRenderPassManager.addManager( new RenderTerrainMgr(TerrainBin) { renderOrder = 0.4; processAddOrder = 0.4; basicOnly = true; } ); + DiffuseRenderPassManager.addManager( new RenderMeshMgr(MeshBin) { bintype = "Mesh"; renderOrder = 0.5; processAddOrder = 0.5; basicOnly = true; } ); + DiffuseRenderPassManager.addManager( new RenderImposterMgr(ImposterBin) { renderOrder = 0.56; processAddOrder = 0.56; } ); + DiffuseRenderPassManager.addManager( new RenderObjectMgr(ObjectBin) { bintype = "Object"; renderOrder = 0.6; processAddOrder = 0.6; } ); + + DiffuseRenderPassManager.addManager( new RenderObjectMgr(ShadowBin) { bintype = "Shadow"; renderOrder = 0.7; processAddOrder = 0.7; } ); + DiffuseRenderPassManager.addManager( new RenderMeshMgr(DecalRoadBin) { bintype = "DecalRoad"; renderOrder = 0.8; processAddOrder = 0.8; } ); + DiffuseRenderPassManager.addManager( new RenderMeshMgr(DecalBin) { bintype = "Decal"; renderOrder = 0.81; processAddOrder = 0.81; } ); + DiffuseRenderPassManager.addManager( new RenderOcclusionMgr(OccluderBin){ bintype = "Occluder"; renderOrder = 0.9; processAddOrder = 0.9; } ); + + // We now render translucent objects that should handle + // their own fogging and lighting. + + // Note that the fog effect is triggered before this bin. + DiffuseRenderPassManager.addManager( new RenderObjectMgr(ObjTranslucentBin) { bintype = "ObjectTranslucent"; renderOrder = 1.0; processAddOrder = 1.0; } ); + + DiffuseRenderPassManager.addManager( new RenderObjectMgr(WaterBin) { bintype = "Water"; renderOrder = 1.2; processAddOrder = 1.2; } ); + DiffuseRenderPassManager.addManager( new RenderObjectMgr(FoliageBin) { bintype = "Foliage"; renderOrder = 1.3; processAddOrder = 1.3; } ); + DiffuseRenderPassManager.addManager( new RenderParticleMgr(ParticleBin) { renderOrder = 1.35; processAddOrder = 1.35; } ); + DiffuseRenderPassManager.addManager( new RenderTranslucentMgr(TranslucentBin){ renderOrder = 1.4; processAddOrder = 1.4; } ); + + DiffuseRenderPassManager.addManager(new RenderObjectMgr(FogBin){ bintype = "ObjectVolumetricFog"; renderOrder = 1.45; processAddOrder = 1.45; } ); + + // Note that the GlowPostFx is triggered after this bin. + DiffuseRenderPassManager.addManager( new RenderGlowMgr(GlowBin) { renderOrder = 1.5; processAddOrder = 1.5; } ); + + // We render any editor stuff from this bin. Note that the HDR is + // completed before this bin to keep editor elements from tone mapping. + DiffuseRenderPassManager.addManager( new RenderObjectMgr(EditorBin) { bintype = "Editor"; renderOrder = 1.6; processAddOrder = 1.6; } ); + + // Resolve format change token last. + DiffuseRenderPassManager.addManager( new RenderPassStateBin(FinalBin) { renderOrder = 1.7; stateToken = AL_FormatToken; } ); +} + +/// This is the Default PostFX state block. Put here to prevent any missing object +/// errors for below dependencies +singleton GFXStateBlockData( PFX_DefaultStateBlock ) +{ + zDefined = true; + zEnable = false; + zWriteEnable = false; + + samplersDefined = true; + samplerStates[0] = SamplerClampLinear; +}; + +/// This post effect is used to copy data from the non-MSAA back-buffer to the +/// device back buffer (which could be MSAA). It must be declared here so that +/// it is initialized when 'AL_FormatToken' is initialzed. +singleton GFXStateBlockData( AL_FormatTokenState : PFX_DefaultStateBlock ) +{ + samplersDefined = true; + samplerStates[0] = SamplerClampPoint; +}; + +singleton PostEffect( AL_FormatCopy ) +{ + // This PostEffect is used by 'AL_FormatToken' directly. It is never added to + // the PostEffectManager. Do not call enable() on it. + isEnabled = false; + allowReflectPass = true; + + shader = PFX_PassthruShader; + stateBlock = AL_FormatTokenState; + + texture[0] = "$inTex"; + target = "$backbuffer"; +}; diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogP.hlsl new file mode 100644 index 000000000..7de14a87d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogP.hlsl @@ -0,0 +1,87 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Volumetric Fog final pixel shader V2.00 +#include "../shaderModel.hlsl" +#include "../shaderModelAutoGen.hlsl" +#include "../torque.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0); +TORQUE_UNIFORM_SAMPLER2D(depthBuffer, 1); +TORQUE_UNIFORM_SAMPLER2D(frontBuffer, 2); +TORQUE_UNIFORM_SAMPLER2D(density, 3); + +uniform float3 ambientColor; +uniform float accumTime; +uniform float4 fogColor; +uniform float4 modspeed;//xy speed layer 1, zw speed layer 2 +uniform float2 viewpoint; +uniform float2 texscale; +uniform float fogDensity; +uniform float preBias; +uniform float textured; +uniform float modstrength; +uniform float numtiles; +uniform float fadesize; +uniform float2 PixelSize; + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float4 htpos : TEXCOORD0; + float2 uv0 : TEXCOORD1; +}; + +float4 main( ConnectData IN ) : TORQUE_TARGET0 +{ + float2 uvscreen=((IN.htpos.xy/IN.htpos.w) + 1.0 ) / 2.0; + uvscreen.y = 1.0 - uvscreen.y; + + float obj_test = TORQUE_DEFERRED_UNCONDITION(deferredTex, uvscreen).w * preBias; + float depth = TORQUE_TEX2D(depthBuffer, uvscreen).r; + float front = TORQUE_TEX2D(frontBuffer, uvscreen).r; + + if (depth <= front) + return float4(0,0,0,0); + else if ( obj_test < depth ) + depth = obj_test; + if ( front >= 0.0) + depth -= front; + + float diff = 1.0; + float3 col = fogColor.rgb; + if (textured != 0.0) + { + float2 offset = viewpoint + ((-0.5 + (texscale * uvscreen)) * numtiles); + + float2 mod1 = TORQUE_TEX2D(density, (offset + (modspeed.xy*accumTime))).rg; + float2 mod2 = TORQUE_TEX2D(density, (offset + (modspeed.zw*accumTime))).rg; + diff = (mod2.r + mod1.r) * modstrength; + col *= (2.0 - ((mod1.g + mod2.g) * fadesize))/2.0; + } + + col *= ambientColor; + + float4 resultColor = float4(col, 1.0 - saturate(exp(-fogDensity * depth * diff * fadesize))); + + return hdrEncode(resultColor); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogPreP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogPreP.hlsl new file mode 100644 index 000000000..9d5060935 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogPreP.hlsl @@ -0,0 +1,40 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Volumetric Fog deferred pixel shader V1.00 +#include "../shaderModel.hlsl" + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float4 pos : TEXCOORD0; +}; + +float4 main( ConnectData IN ) : TORQUE_TARGET0 +{ + float OUT; + + clip( IN.pos.w ); + OUT = IN.pos.w; + + return float4(OUT,0,0,1); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogPreV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogPreV.hlsl new file mode 100644 index 000000000..b736e0d0d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogPreV.hlsl @@ -0,0 +1,44 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Volumetric Fog deferred vertex shader V1.00 + +#include "../shaderModel.hlsl" +#include "../hlslStructs.hlsl" + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float4 pos : TEXCOORD0; +}; + +uniform float4x4 modelView; + +ConnectData main( VertexIn_P IN) +{ + ConnectData OUT; + + OUT.hpos = mul(modelView, float4(IN.pos, 1.0)); + OUT.pos = OUT.hpos; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogRefl.hlsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogRefl.hlsl new file mode 100644 index 000000000..380233b5f --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogRefl.hlsl @@ -0,0 +1,38 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Volumetric Fog Reflection pixel shader V1.00 +#include "../shaderModel.hlsl" +uniform float4 fogColor; +uniform float fogDensity; +uniform float reflStrength; + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float4 pos : TEXCOORD0; +}; + +float4 main( ConnectData IN ) : TORQUE_TARGET0 +{ + return float4(fogColor.rgb,saturate(fogDensity*reflStrength)); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogV.hlsl new file mode 100644 index 000000000..167f83946 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/VFogV.hlsl @@ -0,0 +1,46 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Volumetric Fog final vertex shader V1.00 + +#include "../shaderModel.hlsl" +#include "../hlslStructs.hlsl" + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float4 htpos : TEXCOORD0; + float2 uv0 : TEXCOORD1; +}; + +uniform float4x4 modelView; + +ConnectData main( VertexIn_PNTT IN) +{ + ConnectData OUT; + + OUT.hpos = mul(modelView, float4(IN.pos,1.0)); + OUT.htpos = OUT.hpos; + OUT.uv0 = IN.uv0; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogP.glsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogP.glsl new file mode 100644 index 000000000..fcfa31244 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogP.glsl @@ -0,0 +1,87 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/torque.glsl" + +uniform sampler2D deferredTex; +uniform sampler2D depthBuffer; +uniform sampler2D frontBuffer; +uniform sampler2D density; + +uniform float accumTime; +uniform vec4 fogColor; +uniform float fogDensity; +uniform float preBias; +uniform float textured; +uniform float modstrength; +uniform vec4 modspeed;//xy speed layer 1, zw speed layer 2 +uniform vec2 viewpoint; +uniform vec2 texscale; +uniform vec3 ambientColor; +uniform float numtiles; +uniform float fadesize; +uniform vec2 PixelSize; + +in vec4 _hpos; +#define IN_hpos _hpos +out vec4 OUT_col; + +void main() +{ + vec2 uvscreen=((IN_hpos.xy/IN_hpos.w) + 1.0 ) / 2.0; + uvscreen.y = 1.0 - uvscreen.y; + + float obj_test = deferredUncondition( deferredTex, uvscreen).w * preBias; + float depth = tex2D(depthBuffer,uvscreen).r; + float front = tex2D(frontBuffer,uvscreen).r; + + if (depth <= front) + { + OUT_col = vec4(0,0,0,0); + return; + } + + else if ( obj_test < depth ) + depth = obj_test; + if ( front >= 0.0) + depth -= front; + + float diff = 1.0; + vec3 col = fogColor.rgb; + if (textured != 0.0) + { + vec2 offset = viewpoint + ((-0.5 + (texscale * uvscreen)) * numtiles); + + vec2 mod1 = tex2D(density,(offset + (modspeed.xy*accumTime))).rg; + vec2 mod2= tex2D(density,(offset + (modspeed.zw*accumTime))).rg; + diff = (mod2.r + mod1.r) * modstrength; + col *= (2.0 - ((mod1.g + mod2.g) * fadesize))/2.0; + } + + col *= ambientColor; + + vec4 returnColor = vec4(col, 1.0 - saturate(exp(-fogDensity * depth * diff * fadesize))); + + OUT_col = hdrEncode(returnColor); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogPreP.glsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogPreP.glsl new file mode 100644 index 000000000..017ea6ef8 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogPreP.glsl @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" + +in vec4 _hpos; +#define IN_hpos _hpos + +out vec4 OUT_col; + +void main() +{ + float OUT; + clip( IN_hpos.w ); + OUT = IN_hpos.w; + + OUT_col = vec4(OUT,0,0,1); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogPreV.glsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogPreV.glsl new file mode 100644 index 000000000..2f2a1318a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogPreV.glsl @@ -0,0 +1,42 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" + +in vec4 vPosition; +#define IN_position vPosition + +out vec4 _hpos; +#define OUT_hpos _hpos + +uniform mat4 modelView; + +void main() +{ + vec4 inPos = IN_position; + inPos.w = 1.0; + + OUT_hpos = tMul( modelView, inPos ); + + gl_Position = OUT_hpos; + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogRefl.glsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogRefl.glsl new file mode 100644 index 000000000..78e149fbf --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogRefl.glsl @@ -0,0 +1,33 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" + +uniform vec4 fogColor; +uniform float fogDensity; +uniform float reflStrength; +out vec4 OUT_col; + +void main() +{ + OUT_col = vec4(fogColor.rgb,saturate(fogDensity*reflStrength)); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogV.glsl b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogV.glsl new file mode 100644 index 000000000..57b3ba87e --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/VolumetricFog/gl/VFogV.glsl @@ -0,0 +1,38 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" + +in vec4 vPosition; +#define IN_position vPosition + +out vec4 _hpos; +#define OUT_hpos _hpos + +uniform mat4 modelView; + +void main() +{ + OUT_hpos = tMul(modelView, IN_position); + gl_Position = OUT_hpos; + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/basicCloudsP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/basicCloudsP.hlsl new file mode 100644 index 000000000..4b40e5e8c --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/basicCloudsP.hlsl @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "torque.hlsl" + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 texCoord : TEXCOORD0; +}; + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); + +float4 main( ConnectData IN ) : TORQUE_TARGET0 +{ + float4 col = TORQUE_TEX2D(diffuseMap, IN.texCoord); + return hdrEncode( col ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/basicCloudsV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/basicCloudsV.hlsl new file mode 100644 index 000000000..a176fdbcd --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/basicCloudsV.hlsl @@ -0,0 +1,58 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct CloudVert +{ + float3 pos : POSITION; + float2 uv0 : TEXCOORD0; +}; + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 texCoord : TEXCOORD0; +}; + +uniform float4x4 modelview; +uniform float2 texDirection; +uniform float2 texOffset; +uniform float accumTime; +uniform float texScale; + + +ConnectData main( CloudVert IN ) +{ + ConnectData OUT; + + OUT.hpos = mul(modelview, float4(IN.pos,1.0)); + + float2 uv = IN.uv0; + uv += texOffset; + uv *= texScale; + uv += accumTime * texDirection; + + OUT.texCoord = uv; + + return OUT; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/cloudLayerP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/cloudLayerP.hlsl new file mode 100644 index 000000000..efa8fe0b4 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/cloudLayerP.hlsl @@ -0,0 +1,146 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" +#include "torque.hlsl" + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float4 texCoord12 : TEXCOORD0; + float4 texCoord34 : TEXCOORD1; + float3 vLightTS : TEXCOORD2; // light vector in tangent space, denormalized + float3 vViewTS : TEXCOORD3; // view vector in tangent space, denormalized + float worldDist : TEXCOORD4; +}; + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +TORQUE_UNIFORM_SAMPLER2D(normalHeightMap, 0); +uniform float3 ambientColor; +uniform float3 sunColor; +uniform float cloudCoverage; +uniform float3 cloudBaseColor; +uniform float cloudExposure; + +//----------------------------------------------------------------------------- +// Globals +//----------------------------------------------------------------------------- +// The per-color weighting to be used for luminance calculations in RGB order. +static const float3 LUMINANCE_VECTOR = float3(0.2125f, 0.7154f, 0.0721f); + + +//----------------------------------------------------------------------------- +// Functions +//----------------------------------------------------------------------------- + +// Calculates the Rayleigh phase function +float getRayleighPhase( float angle ) +{ + return 0.75 * ( 1.0 + pow( angle, 2 ) ); +} + +// Returns the output rgb color given a texCoord and parameters it uses +// for lighting calculation. +float3 ComputeIllumination( float2 texCoord, + float3 vLightTS, + float3 vViewTS, + float3 vNormalTS ) +{ + //return noiseNormal; + //return vNormalTS; + + float3 vLightTSAdj = float3( -vLightTS.x, -vLightTS.y, vLightTS.z ); + + float dp = dot( vNormalTS, vLightTSAdj ); + + // Calculate the amount of illumination (lightTerm)... + + // We do both a rim lighting effect and a halfLambertian lighting effect + // and combine the result. + float halfLambertTerm = saturate( pow( dp * 0.5 + 0.5, 1 ) ); + float rimLightTerm = pow( ( 1.0 - dp ), 1.0 ); + float lightTerm = saturate( halfLambertTerm * 1.0 + rimLightTerm * dp ); + lightTerm *= 0.5; + + // Use a simple RayleighPhase function to simulate single scattering towards + // the camera. + float angle = dot( vLightTS, vViewTS ); + lightTerm *= getRayleighPhase( angle ); + + // Combine terms and colors into the output color. + //float3 lightColor = ( lightTerm * sunColor * fOcclusionShadow ) + ambientColor; + float3 lightColor = lerp( ambientColor, sunColor, lightTerm ); + //lightColor = lerp( lightColor, ambientColor, cloudCoverage ); + float3 finalColor = cloudBaseColor * lightColor; + + return finalColor; +} + +float4 main( ConnectData IN ) : TORQUE_TARGET0 +{ + // Normalize the interpolated vectors: + float3 vViewTS = normalize( IN.vViewTS ); + float3 vLightTS = normalize( IN.vLightTS ); + + float4 cResultColor = float4( 0, 0, 0, 1 ); + + float2 texSample = IN.texCoord12.xy; + + float4 noise1 = TORQUE_TEX2D( normalHeightMap, IN.texCoord12.zw ); + noise1 = normalize( ( noise1 - 0.5 ) * 2.0 ); + //return noise1; + + float4 noise2 = TORQUE_TEX2D(normalHeightMap, IN.texCoord34.xy); + noise2 = normalize( ( noise2 - 0.5 ) * 2.0 ); + //return noise2; + + float3 noiseNormal = normalize( noise1 + noise2 ).xyz; + //return float4( noiseNormal, 1.0 ); + + float noiseHeight = noise1.a * noise2.a * ( cloudCoverage / 2.0 + 0.5 ); + + float3 vNormalTS = normalize( TORQUE_TEX2D(normalHeightMap, texSample).xyz * 2.0 - 1.0); + vNormalTS += noiseNormal; + vNormalTS = normalize( vNormalTS ); + + // Compute resulting color for the pixel: + cResultColor.rgb = ComputeIllumination( texSample, vLightTS, vViewTS, vNormalTS ); + + float coverage = ( cloudCoverage - 0.5 ) * 2.0; + cResultColor.a = TORQUE_TEX2D(normalHeightMap, texSample).a + coverage + noiseHeight; + + if ( cloudCoverage > -1.0 ) + cResultColor.a /= 1.0 + coverage; + + cResultColor.a = saturate( cResultColor.a * pow( saturate(cloudCoverage), 0.25 ) ); + + cResultColor.a = lerp( cResultColor.a, 0.0, 1.0 - pow(IN.worldDist,2.0) ); + + cResultColor.rgb *= cloudExposure; + + return hdrEncode( cResultColor ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/cloudLayerV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/cloudLayerV.hlsl new file mode 100644 index 000000000..d60dd251d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/cloudLayerV.hlsl @@ -0,0 +1,106 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- +#include "shaderModel.hlsl" + +struct CloudVert +{ + float3 pos : POSITION; + float3 normal : NORMAL; + float3 binormal : BINORMAL; + float3 tangent : TANGENT; + float2 uv0 : TEXCOORD0; +}; + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float4 texCoord12 : TEXCOORD0; + float4 texCoord34 : TEXCOORD1; + float3 vLightTS : TEXCOORD2; // light vector in tangent space, denormalized + float3 vViewTS : TEXCOORD3; // view vector in tangent space, denormalized + float worldDist : TEXCOORD4; +}; + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +uniform float4x4 modelview; +uniform float3 eyePosWorld; +uniform float3 sunVec; +uniform float2 texOffset0; +uniform float2 texOffset1; +uniform float2 texOffset2; +uniform float3 texScale; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +ConnectData main( CloudVert IN ) +{ + ConnectData OUT; + + OUT.hpos = mul(modelview, float4(IN.pos,1.0)); + // Offset the uv so we don't have a seam directly over our head. + float2 uv = IN.uv0 + float2( 0.5, 0.5 ); + + OUT.texCoord12.xy = uv * texScale.x; + OUT.texCoord12.xy += texOffset0; + + OUT.texCoord12.zw = uv * texScale.y; + OUT.texCoord12.zw += texOffset1; + + OUT.texCoord34.xy = uv * texScale.z; + OUT.texCoord34.xy += texOffset2; + + OUT.texCoord34.z = IN.pos.z; + OUT.texCoord34.w = 0.0; + + // Transform the normal, tangent and binormal vectors from object space to + // homogeneous projection space: + float3 vNormalWS = -IN.normal; + float3 vTangentWS = -IN.tangent; + float3 vBinormalWS = -IN.binormal; + + // Compute position in world space: + float4 vPositionWS = float4(IN.pos, 1.0) + float4(eyePosWorld, 1); //mul( IN.pos, objTrans ); + + // Compute and output the world view vector (unnormalized): + float3 vViewWS = eyePosWorld - vPositionWS.xyz; + + // Compute denormalized light vector in world space: + float3 vLightWS = -sunVec; + + // Normalize the light and view vectors and transform it to the tangent space: + float3x3 mWorldToTangent = float3x3( vTangentWS, vBinormalWS, vNormalWS ); + + // Propagate the view and the light vectors (in tangent space): + OUT.vLightTS = mul( vLightWS, mWorldToTangent ); + OUT.vViewTS = mul( mWorldToTangent, vViewWS ); + + OUT.worldDist = saturate( pow( max( IN.pos.z, 0 ), 2 ) ); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/addColorTextureP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/addColorTextureP.hlsl new file mode 100644 index 000000000..d0577428f --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/addColorTextureP.hlsl @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" + +struct Conn +{ + float4 HPOS : TORQUE_POSITION; + float4 color : COLOR; + float2 texCoord : TEXCOORD0; +}; + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); + +float4 main( Conn IN ) : TORQUE_TARGET0 +{ + return float4(IN.color.rgb, IN.color.a * TORQUE_TEX2D(diffuseMap, IN.texCoord).a); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/addColorTextureV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/addColorTextureV.hlsl new file mode 100644 index 000000000..8bf4e88d8 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/addColorTextureV.hlsl @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" + +struct Appdata +{ + float3 position : POSITION; + float4 color : COLOR; + float2 texCoord : TEXCOORD0; +}; + +struct Conn +{ + float4 HPOS : TORQUE_POSITION; + float4 color : COLOR; + float2 texCoord : TEXCOORD0; +}; + +uniform float4x4 modelview; + +Conn main( Appdata In ) +{ + Conn Out; + Out.HPOS = mul(modelview, float4(In.position,1.0)); + Out.color = In.color; + Out.texCoord = In.texCoord; + return Out; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/colorP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/colorP.hlsl new file mode 100644 index 000000000..dd9990e07 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/colorP.hlsl @@ -0,0 +1,34 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" + +struct Conn +{ + float4 HPOS : TORQUE_POSITION; + float4 color : COLOR; +}; + +float4 main(Conn IN) : TORQUE_TARGET0 +{ + return IN.color; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/colorV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/colorV.hlsl new file mode 100644 index 000000000..d16dfb863 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/colorV.hlsl @@ -0,0 +1,45 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" + +struct Appdata +{ + float3 position : POSITION; + float4 color : COLOR; +}; + +struct Conn +{ + float4 HPOS : TORQUE_POSITION; + float4 color : COLOR; +}; + +uniform float4x4 modelview; + +Conn main( Appdata In ) +{ + Conn Out; + Out.HPOS = mul(modelview, float4(In.position,1.0)); + Out.color = In.color; + return Out; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/addColorTextureP.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/addColorTextureP.glsl new file mode 100644 index 000000000..b9a10adf3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/addColorTextureP.glsl @@ -0,0 +1,32 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +uniform sampler2D diffuseMap; +in vec4 color; +in vec2 texCoord; + +out vec4 OUT_col; + +void main() +{ + OUT_col = vec4(color.rgb, color.a * texture(diffuseMap, texCoord).a); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/addColorTextureV.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/addColorTextureV.glsl new file mode 100644 index 000000000..5d7f10168 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/addColorTextureV.glsl @@ -0,0 +1,38 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "../../gl/hlslCompat.glsl" + +in vec4 vPosition; +in vec4 vColor; +in vec2 vTexCoord0; + +uniform mat4 modelview; +out vec4 color; +out vec2 texCoord; + +void main() +{ + gl_Position = tMul(modelview, vPosition); + correctSSP(gl_Position); + color = vColor; + texCoord = vTexCoord0.st; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/colorP.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/colorP.glsl new file mode 100644 index 000000000..f9dfc3d4f --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/colorP.glsl @@ -0,0 +1,30 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +in vec4 color; + +out vec4 OUT_col; + +void main() +{ + OUT_col = color; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/colorV.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/colorV.glsl new file mode 100644 index 000000000..895917b55 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/colorV.glsl @@ -0,0 +1,35 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "../../gl/hlslCompat.glsl" + +in vec4 vPosition; +in vec4 vColor; + +uniform mat4 modelview; +out vec4 color; + +void main() +{ + gl_Position = tMul(modelview, vPosition); + correctSSP(gl_Position); + color = vColor; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/modColorTextureP.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/modColorTextureP.glsl new file mode 100644 index 000000000..c24b9db12 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/modColorTextureP.glsl @@ -0,0 +1,32 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +uniform sampler2D diffuseMap; +in vec4 color; +in vec2 texCoord; + +out vec4 OUT_col; + +void main() +{ + OUT_col = texture(diffuseMap, texCoord) * color; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/modColorTextureV.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/modColorTextureV.glsl new file mode 100644 index 000000000..5d7f10168 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/modColorTextureV.glsl @@ -0,0 +1,38 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "../../gl/hlslCompat.glsl" + +in vec4 vPosition; +in vec4 vColor; +in vec2 vTexCoord0; + +uniform mat4 modelview; +out vec4 color; +out vec2 texCoord; + +void main() +{ + gl_Position = tMul(modelview, vPosition); + correctSSP(gl_Position); + color = vColor; + texCoord = vTexCoord0.st; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/targetRestoreP.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/targetRestoreP.glsl new file mode 100644 index 000000000..770f8904d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/targetRestoreP.glsl @@ -0,0 +1,31 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +uniform sampler2D colorTarget0Texture ; + +vec4 main( vec2 ScreenPos : VPOS ) : COLOR0 +{ + vec2 TexCoord = ScreenPos; + vec4 diffuse; + asm { tfetch2D diffuse, TexCoord, colorTarget0Texture, UnnormalizedTextureCoords = true }; + return diffuse; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/targetRestoreV.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/targetRestoreV.glsl new file mode 100644 index 000000000..e99d2e537 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/targetRestoreV.glsl @@ -0,0 +1,22 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/textureP.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/textureP.glsl new file mode 100644 index 000000000..50cef4bda --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/textureP.glsl @@ -0,0 +1,31 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +uniform sampler2D diffuseMap; +in vec2 texCoord; + +out vec4 OUT_col; + +void main() +{ + OUT_col = texture(diffuseMap, texCoord); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/textureV.glsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/textureV.glsl new file mode 100644 index 000000000..20dbb6f10 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/gl/textureV.glsl @@ -0,0 +1,35 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "../../gl/hlslCompat.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; + +uniform mat4 modelview; +out vec2 texCoord; + +void main() +{ + gl_Position = tMul(modelview, vPosition); + correctSSP(gl_Position); + texCoord = vTexCoord0.st; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/modColorTextureP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/modColorTextureP.hlsl new file mode 100644 index 000000000..63afec2a4 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/modColorTextureP.hlsl @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" + +struct Conn +{ + float4 HPOS : TORQUE_POSITION; + float4 color : COLOR; + float2 texCoord : TEXCOORD0; +}; + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); + +float4 main( Conn IN ) : TORQUE_TARGET0 +{ + return TORQUE_TEX2D(diffuseMap, IN.texCoord) * IN.color; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/modColorTextureV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/modColorTextureV.hlsl new file mode 100644 index 000000000..8bf4e88d8 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/modColorTextureV.hlsl @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" + +struct Appdata +{ + float3 position : POSITION; + float4 color : COLOR; + float2 texCoord : TEXCOORD0; +}; + +struct Conn +{ + float4 HPOS : TORQUE_POSITION; + float4 color : COLOR; + float2 texCoord : TEXCOORD0; +}; + +uniform float4x4 modelview; + +Conn main( Appdata In ) +{ + Conn Out; + Out.HPOS = mul(modelview, float4(In.position,1.0)); + Out.color = In.color; + Out.texCoord = In.texCoord; + return Out; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/targetRestoreP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/targetRestoreP.hlsl new file mode 100644 index 000000000..9ef44f426 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/targetRestoreP.hlsl @@ -0,0 +1,31 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +uniform sampler2D colorTarget0Texture : register(s0); + +float4 main( float2 ScreenPos : VPOS ) : COLOR0 +{ + float2 TexCoord = ScreenPos; + float4 diffuse; + asm { tfetch2D diffuse, TexCoord, colorTarget0Texture, UnnormalizedTextureCoords = true }; + return diffuse; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/targetRestoreV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/targetRestoreV.hlsl new file mode 100644 index 000000000..3c4aefaec --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/targetRestoreV.hlsl @@ -0,0 +1,26 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +float4 main( const float2 inPosition : POSITION ) : POSITION +{ + return float4( inPosition, 0, 1 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/textureP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/textureP.hlsl new file mode 100644 index 000000000..82dbd4ce9 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/textureP.hlsl @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); + +struct Conn +{ + float4 hpos : TORQUE_POSITION; + float2 texCoord : TEXCOORD0; +}; + +float4 main(Conn IN) : TORQUE_TARGET0 +{ + return TORQUE_TEX2D(diffuseMap, IN.texCoord); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/textureV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/textureV.hlsl new file mode 100644 index 000000000..204cf9514 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fixedFunction/textureV.hlsl @@ -0,0 +1,46 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" + +struct Appdata +{ + float3 position : POSITION; + float4 color : COLOR; + float2 texCoord : TEXCOORD0; +}; + +struct Conn +{ + float4 hpos : TORQUE_POSITION; + float2 texCoord : TEXCOORD0; +}; + +uniform float4x4 modelview; + +Conn main( Appdata In ) +{ + Conn Out; + Out.hpos = mul(modelview, float4(In.position, 1.0)); + Out.texCoord = In.texCoord; + return Out; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/foliage.hlsl b/Templates/BaseGame/game/core/rendering/shaders/foliage.hlsl new file mode 100644 index 000000000..9952c29d6 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/foliage.hlsl @@ -0,0 +1,186 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// CornerId corresponds to this arrangement +// from the perspective of the camera. +// +// 3 ---- 2 +// | | +// 0 ---- 1 +// + +#define MAX_COVERTYPES 8 + +uniform float2 gc_fadeParams; +uniform float2 gc_windDir; +uniform float3 gc_camRight; +uniform float3 gc_camUp; +uniform float4 gc_typeRects[MAX_COVERTYPES]; + +// .x = gust length +// .y = premultiplied simulation time and gust frequency +// .z = gust strength +uniform float3 gc_gustInfo; + +// .x = premultiplied simulation time and turbulance frequency +// .y = turbulance strength +uniform float2 gc_turbInfo; + + +static float sCornerRight[4] = { -0.5, 0.5, 0.5, -0.5 }; + +static float sCornerUp[4] = { 0, 0, 1, 1 }; + +static float sMovableCorner[4] = { 0, 0, 1, 1 }; + +static float2 sUVCornerExtent[4] = +{ + float2( 0, 1 ), + float2( 1, 1 ), + float2( 1, 0 ), + float2( 0, 0 ) +}; + + +/////////////////////////////////////////////////////////////////////////////// +// The following wind effect was derived from the GPU Gems 3 chapter... +// +// "Vegetation Procedural Animation and Shading in Crysis" +// by Tiago Sousa, Crytek +// + +float2 smoothCurve( float2 x ) +{ + return x * x * ( 3.0 - 2.0 * x ); +} + +float2 triangleWave( float2 x ) +{ + return abs( frac( x + 0.5 ) * 2.0 - 1.0 ); +} + +float2 smoothTriangleWave( float2 x ) +{ + return smoothCurve( triangleWave( x ) ); +} + +float windTurbulence( float bbPhase, float frequency, float strength ) +{ + // We create the input value for wave generation from the frequency and phase. + float2 waveIn = bbPhase.xx + frequency.xx; + + // We use two square waves to generate the effect which + // is then scaled by the overall strength. + float2 waves = ( frac( waveIn.xy * float2( 1.975, 0.793 ) ) * 2.0 - 1.0 ); + waves = smoothTriangleWave( waves ); + + // Sum up the two waves into a single wave. + return ( waves.x + waves.y ) * strength; +} + +float2 windEffect( float bbPhase, + float2 windDirection, + float gustLength, + float gustFrequency, + float gustStrength, + float turbFrequency, + float turbStrength ) +{ + // Calculate the ambient wind turbulence. + float turbulence = windTurbulence( bbPhase, turbFrequency, turbStrength ); + + // We simulate the overall gust via a sine wave. + float gustPhase = clamp( sin( ( bbPhase - gustFrequency ) / gustLength ) , 0, 1 ); + float gustOffset = ( gustPhase * gustStrength ) + ( ( 0.2 + gustPhase ) * turbulence ); + + // Return the final directional wind effect. + return gustOffset.xx * windDirection.xy; +} + +void foliageProcessVert( inout float3 position, + inout float4 diffuse, + inout float4 texCoord, + inout float3 normal, + inout float3 T, + in float3 eyePos ) +{ + // Assign the normal and tagent values. + //normal = float3( 0, 0, 1 );//cross( gc_camUp, gc_camRight ); + T = gc_camRight; + + // Pull out local vars we need for work. + int corner = ( diffuse.a * 255.0f ) + 0.5f; + float2 size = texCoord.xy; + int type = texCoord.z; + + // The billboarding is based on the camera direction. + float3 rightVec = gc_camRight * sCornerRight[corner]; + float3 upVec = gc_camUp * sCornerUp[corner]; + + // Figure out the corner position. + float3 outPos = ( upVec * size.y ) + ( rightVec * size.x ); + float len = length( outPos.xyz ); + + // We derive the billboard phase used for wind calculations from its position. + float bbPhase = dot( position.xyz, 1 ); + + // Get the overall wind gust and turbulence effects. + float3 wind; + wind.xy = windEffect( bbPhase, + gc_windDir, + gc_gustInfo.x, gc_gustInfo.y, gc_gustInfo.z, + gc_turbInfo.x, gc_turbInfo.y ); + wind.z = 0; + + // Add the summed wind effect into the point. + outPos.xyz += wind.xyz * texCoord.w; + + // Do a simple spherical clamp to keep the foliage + // from stretching too much by wind effect. + outPos.xyz = normalize( outPos.xyz ) * len; + + // Move the point into world space. + position += outPos; + + // Grab the uv set and setup the texture coord. + float4 uvSet = gc_typeRects[type]; + texCoord.x = uvSet.x + ( uvSet.z * sUVCornerExtent[corner].x ); + texCoord.y = uvSet.y + ( uvSet.w * sUVCornerExtent[corner].y ); + + // Animate the normal to get lighting changes + // across the the wind swept foliage. + // + // TODO: Expose the 10x as a factor to control + // how much the wind effects the lighting on the grass. + // + normal.xy += wind.xy * ( 10.0 * texCoord.w ); + normal = normalize( normal ); + + // Get the alpha fade value. + + float fadeStart = gc_fadeParams.x; + float fadeEnd = gc_fadeParams.y; + const float fadeRange = fadeEnd - fadeStart; + + float dist = distance( eyePos, position.xyz ) - fadeStart; + diffuse.a = 1 - clamp( dist / fadeRange, 0, 1 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/fxFoliageReplicatorP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fxFoliageReplicatorP.hlsl new file mode 100644 index 000000000..a8bb68e28 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fxFoliageReplicatorP.hlsl @@ -0,0 +1,60 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shdrConsts.h" +#include "shaderModel.hlsl" +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 outTexCoord : TEXCOORD0; + float4 color : COLOR0; + float4 groundAlphaCoeff : COLOR1; + float2 alphaLookup : TEXCOORD1; +}; + +struct Fragout +{ + float4 col : TORQUE_TARGET0; +}; + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); +TORQUE_UNIFORM_SAMPLER2D(alphaMap, 1); + +uniform float4 groundAlpha; +uniform float4 ambient; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Fragout main( ConnectData IN ) +{ + Fragout OUT; + + float4 alpha = TORQUE_TEX2D(alphaMap, IN.alphaLookup); + OUT.col = float4( ambient.rgb * IN.lum.rgb, 1.0 ) * TORQUE_TEX2D(diffuseMap, IN.texCoord); + OUT.col.a = OUT.col.a * min(alpha, groundAlpha + IN.groundAlphaCoeff.x).x; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/fxFoliageReplicatorV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/fxFoliageReplicatorV.hlsl new file mode 100644 index 000000000..70ec9ff4c --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/fxFoliageReplicatorV.hlsl @@ -0,0 +1,129 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct VertData +{ + float3 position : POSITION; + float3 normal : NORMAL; + float2 texCoord : TEXCOORD0; + float2 waveScale : TEXCOORD1; +}; + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 outTexCoord : TEXCOORD0; + float4 color : COLOR0; + float4 groundAlphaCoeff : COLOR1; + float2 alphaLookup : TEXCOORD1; +}; + +uniform float4x4 projection : register(C0); +uniform float4x4 world : register(C4); +uniform float GlobalSwayPhase : register(C8); +uniform float SwayMagnitudeSide : register(C9); +uniform float SwayMagnitudeFront : register(C10); +uniform float GlobalLightPhase : register(C11); +uniform float LuminanceMagnitude : register(C12); +uniform float LuminanceMidpoint : register(C13); +uniform float DistanceRange : register(C14); +uniform float3 CameraPos : register(C15); +uniform float TrueBillboard : register(C16); + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +ConnectData main( VertData IN ) +{ + ConnectData OUT; + + // Init a transform matrix to be used in the following steps + float4x4 trans = 0; + trans[0][0] = 1; + trans[1][1] = 1; + trans[2][2] = 1; + trans[3][3] = 1; + trans[0][3] = IN.position.x; + trans[1][3] = IN.position.y; + trans[2][3] = IN.position.z; + + // Billboard transform * world matrix + float4x4 o = world; + o = mul(o, trans); + + // Keep only the up axis result and position transform. + // This gives us "cheating" cylindrical billboarding. + o[0][0] = 1; + o[1][0] = 0; + o[2][0] = 0; + o[3][0] = 0; + o[0][1] = 0; + o[1][1] = 1; + o[2][1] = 0; + o[3][1] = 0; + + // Unless the user specified TrueBillboard, + // in which case we want the z axis to also be camera facing. + +#ifdef TRUE_BILLBOARD + + o[0][2] = 0; + o[1][2] = 0; + o[2][2] = 1; + o[3][2] = 0; + +#endif + + // Handle sway. Sway is stored in a texture coord. The x coordinate is the sway phase multiplier, + // the y coordinate determines if this vertex actually sways or not. + float xSway, ySway; + float wavePhase = GlobalSwayPhase * IN.waveScale.x; + sincos(wavePhase, ySway, xSway); + xSway = xSway * IN.waveScale.y * SwayMagnitudeSide; + ySway = ySway * IN.waveScale.y * SwayMagnitudeFront; + float4 p; + p = mul(o, float4(IN.normal.x + xSway, ySway, IN.normal.z, 1)); + + // Project the point + OUT.hpos = mul(projection, p); + + // Lighting + float Luminance = LuminanceMidpoint + LuminanceMagnitude * cos(GlobalLightPhase + IN.normal.y); + + // Alpha + float3 worldPos = IN.position; + float alpha = abs(distance(worldPos, CameraPos)) / DistanceRange; + alpha = clamp(alpha, 0.0f, 1.0f); //pass it through + + OUT.alphaLookup = float2(alpha, 0.0f); + OUT.groundAlphaCoeff = all(IN.normal.z); + OUT.outTexCoord = IN.texCoord; + OUT.color = float4(Luminance, Luminance, Luminance, 1.0f); + + return OUT; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/basicCloudsP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/basicCloudsP.glsl new file mode 100644 index 000000000..5b3f50519 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/basicCloudsP.glsl @@ -0,0 +1,39 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "torque.glsl" +#include "hlslCompat.glsl" + +//ConnectData +in vec2 texCoord; +#define IN_texCoord texCoord + + +uniform sampler2D diffuseMap ; + +out vec4 OUT_col; + +void main() +{ + vec4 col = texture( diffuseMap, IN_texCoord ); + OUT_col = hdrEncode( col ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/basicCloudsV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/basicCloudsV.glsl new file mode 100644 index 000000000..cccbafa8c --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/basicCloudsV.glsl @@ -0,0 +1,53 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "hlslCompat.glsl" + +//CloudVert +in vec4 vPosition; +in vec2 vTexCoord0; + +#define IN_pos vPosition +#define IN_uv0 vTexCoord0 + +uniform mat4 modelview; +uniform float accumTime; +uniform float texScale; +uniform vec2 texDirection; +uniform vec2 texOffset; + +out vec2 texCoord; +#define OUT_texCoord texCoord + +void main() +{ + gl_Position = tMul(modelview, IN_pos); + + vec2 uv = IN_uv0; + uv += texOffset; + uv *= texScale; + uv += accumTime * texDirection; + + OUT_texCoord = uv; + + correctSSP(gl_Position); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/blurP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/blurP.glsl new file mode 100644 index 000000000..a27538762 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/blurP.glsl @@ -0,0 +1,39 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//***************************************************************************** +// Glow Shader +//***************************************************************************** +uniform vec4 kernel; +uniform sampler2D diffuseMap; + +in vec2 texc0, texc1, texc2, texc3; + +out vec4 OUT_col; + +void main() +{ + OUT_col = texture(diffuseMap, texc0) * kernel.x; + OUT_col += texture(diffuseMap, texc1) * kernel.y; + OUT_col += texture(diffuseMap, texc2) * kernel.z; + OUT_col += texture(diffuseMap, texc3) * kernel.w; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/blurV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/blurV.glsl new file mode 100644 index 000000000..1bfb0cd1b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/blurV.glsl @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//***************************************************************************** +// Glow shader +//***************************************************************************** + +in vec4 vPosition; +in vec4 vColor; +in vec2 vTexCoord0; + +uniform mat4 modelview; +uniform vec2 offset0, offset1, offset2, offset3; + +out vec2 texc0, texc1, texc2, texc3; + +void main() +{ + gl_Position = modelview * vPosition; + + vec2 tc = vTexCoord0.st; + tc.y = 1.0 - tc.y; + + texc0 = tc + offset0; + texc1 = tc + offset1; + texc2 = tc + offset2; + texc3 = tc + offset3; + gl_Position.y *= -1; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/cloudLayerP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/cloudLayerP.glsl new file mode 100644 index 000000000..877a132da --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/cloudLayerP.glsl @@ -0,0 +1,147 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "hlslCompat.glsl" +#include "torque.glsl" +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- +//ConnectData +in vec4 texCoord12; +#define IN_texCoord12 texCoord12 +in vec4 texCoord34; +#define IN_texCoord34 texCoord34 +in vec3 vLightTS; // light vector in tangent space, denormalized +#define IN_vLightTS vLightTS +in vec3 vViewTS; // view vector in tangent space, denormalized +#define IN_vViewTS vViewTS +in float worldDist; +#define IN_worldDist worldDist + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +uniform sampler2D normalHeightMap; +uniform vec3 ambientColor; +uniform vec3 sunColor; +uniform float cloudCoverage; +uniform vec3 cloudBaseColor; +uniform float cloudExposure; + +out vec4 OUT_col; + +//----------------------------------------------------------------------------- +// Globals +//----------------------------------------------------------------------------- +// The per-color weighting to be used for luminance calculations in RGB order. +const vec3 LUMINANCE_VECTOR = vec3(0.2125f, 0.7154f, 0.0721f); + + +//----------------------------------------------------------------------------- +// Functions +//----------------------------------------------------------------------------- + +// Calculates the Rayleigh phase function +float getRayleighPhase( float angle ) +{ + return 0.75 * ( 1.0 + pow( angle, 2.0 ) ); +} + +// Returns the output rgb color given a texCoord and parameters it uses +// for lighting calculation. +vec3 ComputeIllumination( vec2 texCoord, + vec3 vLightTS, + vec3 vViewTS, + vec3 vNormalTS ) +{ + //return noiseNormal; + //return vNormalTS; + + vec3 vLightTSAdj = vec3( -vLightTS.x, -vLightTS.y, vLightTS.z ); + + float dp = dot( vNormalTS, vLightTSAdj ); + + // Calculate the amount of illumination (lightTerm)... + + // We do both a rim lighting effect and a halfLambertian lighting effect + // and combine the result. + float halfLambertTerm = clamp( pow( dp * 0.5 + 0.5, 1.0 ), 0.0, 1.0 ); + float rimLightTerm = pow( ( 1.0 - dp ), 1.0 ); + float lightTerm = clamp( halfLambertTerm * 1.0 + rimLightTerm * dp, 0.0, 1.0 ); + lightTerm *= 0.5; + + // Use a simple RayleighPhase function to simulate single scattering towards + // the camera. + float angle = dot( vLightTS, vViewTS ); + lightTerm *= getRayleighPhase( angle ); + + // Combine terms and colors into the output color. + //vec3 lightColor = ( lightTerm * sunColor * fOcclusionShadow ) + ambientColor; + vec3 lightColor = mix( ambientColor, sunColor, lightTerm ); + //lightColor = mix( lightColor, ambientColor, cloudCoverage ); + vec3 finalColor = cloudBaseColor * lightColor; + + return finalColor; +} + +void main() +{ + // Normalize the interpolated vectors: + vec3 vViewTS = normalize( vViewTS ); + vec3 vLightTS = normalize( vLightTS ); + + vec4 cResultColor = vec4( 0, 0, 0, 1 ); + + vec2 texSample = IN_texCoord12.xy; + + vec4 noise1 = texture( normalHeightMap, IN_texCoord12.zw ); + noise1 = normalize( ( noise1 - 0.5 ) * 2.0 ); + //return noise1; + + vec4 noise2 = texture( normalHeightMap, IN_texCoord34.xy ); + noise2 = normalize( ( noise2 - 0.5 ) * 2.0 ); + //return noise2; + + vec3 noiseNormal = normalize( noise1 + noise2 ).xyz; + //return vec4( noiseNormal, 1.0 ); + + float noiseHeight = noise1.a * noise2.a * ( cloudCoverage / 2.0 + 0.5 ); + + vec3 vNormalTS = normalize( texture( normalHeightMap, texSample ).xyz * 2.0 - 1.0 ); + vNormalTS += noiseNormal; + vNormalTS = normalize( vNormalTS ); + + // Compute resulting color for the pixel: + cResultColor.rgb = ComputeIllumination( texSample, vLightTS, vViewTS, vNormalTS ); + + float coverage = ( cloudCoverage - 0.5 ) * 2.0; + cResultColor.a = texture( normalHeightMap, texSample ).a + coverage + noiseHeight; + + if ( cloudCoverage > -1.0 ) + cResultColor.a /= 1.0 + coverage; + + cResultColor.a = clamp( cResultColor.a * pow( saturate(cloudCoverage), 0.25 ), 0.0, 1.0 ); + + cResultColor.a = mix( cResultColor.a, 0.0, 1.0 - pow(IN_worldDist,2.0) ); + + OUT_col = hdrEncode(cResultColor); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/cloudLayerV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/cloudLayerV.glsl new file mode 100644 index 000000000..395c6f286 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/cloudLayerV.glsl @@ -0,0 +1,106 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "hlslCompat.glsl" + +in vec4 vPosition; +in vec3 vNormal; +in vec3 vBinormal; +in vec3 vTangent; +in vec2 vTexCoord0; + +out vec4 texCoord12; +#define OUT_texCoord12 texCoord12 +out vec4 texCoord34; +#define OUT_texCoord34 texCoord34 +out vec3 vLightTS; // light vector in tangent space, denormalized +#define OUT_vLightTS vLightTS +out vec3 vViewTS; // view vector in tangent space, denormalized +#define OUT_vViewTS vViewTS +out float worldDist; +#define OUT_worldDist worldDist + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +uniform mat4 modelview; +uniform vec3 eyePosWorld; +uniform vec3 sunVec; +uniform vec2 texOffset0; +uniform vec2 texOffset1; +uniform vec2 texOffset2; +uniform vec3 texScale; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + vec4 IN_pos = vPosition; + vec3 IN_normal = vNormal; + vec3 IN_binormal = vBinormal; + vec3 IN_tangent = vTangent; + vec2 IN_uv0 = vTexCoord0.st; + + gl_Position = modelview * IN_pos; + + // Offset the uv so we don't have a seam directly over our head. + vec2 uv = IN_uv0 + vec2( 0.5, 0.5 ); + + OUT_texCoord12.xy = uv * texScale.x; + OUT_texCoord12.xy += texOffset0; + + OUT_texCoord12.zw = uv * texScale.y; + OUT_texCoord12.zw += texOffset1; + + OUT_texCoord34.xy = uv * texScale.z; + OUT_texCoord34.xy += texOffset2; + + OUT_texCoord34.z = IN_pos.z; + OUT_texCoord34.w = 0.0; + + // Transform the normal, tangent and binormal vectors from object space to + // homogeneous projection space: + vec3 vNormalWS = -IN_normal; + vec3 vTangentWS = -IN_tangent; + vec3 vBinormalWS = -IN_binormal; + + // Compute position in world space: + vec4 vPositionWS = IN_pos + vec4( eyePosWorld, 1 ); //tMul( IN_pos, objTrans ); + + // Compute and output the world view vector (unnormalized): + vec3 vViewWS = eyePosWorld - vPositionWS.xyz; + + // Compute denormalized light vector in world space: + vec3 vLightWS = -sunVec; + + // Normalize the light and view vectors and transform it to the IN_tangent space: + mat3 mWorldToTangent = mat3( vTangentWS, vBinormalWS, vNormalWS ); + + // Propagate the view and the light vectors (in tangent space): + OUT_vLightTS = vLightWS * mWorldToTangent; + OUT_vViewTS = mWorldToTangent * vViewWS; + + OUT_worldDist = clamp( pow( max( IN_pos.z, 0 ), 2 ), 0.0, 1.0 ); + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/foliage.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/foliage.glsl new file mode 100644 index 000000000..38b66e767 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/foliage.glsl @@ -0,0 +1,186 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// CornerId corresponds to this arrangement +// from the perspective of the camera. +// +// 3 ---- 2 +// | | +// 0 ---- 1 +// + +#define MAX_COVERTYPES 8 + +uniform vec3 gc_camRight; +uniform vec3 gc_camUp; +uniform vec4 gc_typeRects[MAX_COVERTYPES]; +uniform vec2 gc_fadeParams; +uniform vec2 gc_windDir; + +// .x = gust length +// .y = premultiplied simulation time and gust frequency +// .z = gust strength +uniform vec3 gc_gustInfo; + +// .x = premultiplied simulation time and turbulance frequency +// .y = turbulance strength +uniform vec2 gc_turbInfo; + + +const float sCornerRight[4] = float[]( -0.5, 0.5, 0.5, -0.5 ); + +const float sCornerUp[4] = float[]( 0, 0, 1, 1 ); + +const float sMovableCorner[4] = float[]( 0, 0, 1, 1 ); + +const vec2 sUVCornerExtent[4] = vec2[] +( + vec2( 0, 1 ), + vec2( 1, 1 ), + vec2( 1, 0 ), + vec2( 0, 0 ) +); + + +/////////////////////////////////////////////////////////////////////////////// +// The following wind effect was derived from the GPU Gems 3 chapter... +// +// "Vegetation Procedural Animation and Shading in Crysis" +// by Tiago Sousa, Crytek +// + +vec2 smoothCurve( vec2 x ) +{ + return x * x * ( 3.0 - 2.0 * x ); +} + +vec2 triangleWave( vec2 x ) +{ + return abs( fract( x + 0.5 ) * 2.0 - 1.0 ); +} + +vec2 smoothTriangleWave( vec2 x ) +{ + return smoothCurve( triangleWave( x ) ); +} + +float windTurbulence( float bbPhase, float frequency, float strength ) +{ + // We create the input value for wave generation from the frequency and phase. + vec2 waveIn = vec2( bbPhase + frequency ); + + // We use two square waves to generate the effect which + // is then scaled by the overall strength. + vec2 waves = ( fract( waveIn.xy * vec2( 1.975, 0.793 ) ) * 2.0 - 1.0 ); + waves = smoothTriangleWave( waves ); + + // Sum up the two waves into a single wave. + return ( waves.x + waves.y ) * strength; +} + +vec2 windEffect( float bbPhase, + vec2 windDirection, + float gustLength, + float gustFrequency, + float gustStrength, + float turbFrequency, + float turbStrength ) +{ + // Calculate the ambient wind turbulence. + float turbulence = windTurbulence( bbPhase, turbFrequency, turbStrength ); + + // We simulate the overall gust via a sine wave. + float gustPhase = clamp( sin( ( bbPhase - gustFrequency ) / gustLength ) , 0.0, 1.0 ); + float gustOffset = ( gustPhase * gustStrength ) + ( ( 0.2 + gustPhase ) * turbulence ); + + // Return the final directional wind effect. + return vec2(gustOffset) * windDirection.xy; +} + +void foliageProcessVert( inout vec3 position, + inout vec4 diffuse, + inout vec4 texCoord, + inout vec3 normal, + inout vec3 T, + in vec3 eyePos ) +{ + // Assign the normal and tagent values. + //normal = vec3( 0, 0, 1 );//cross( gc_camUp, gc_camRight ); + T = gc_camRight; + + // Pull out local vars we need for work. + int corner = int( ( diffuse.a * 255.0 ) + 0.5 ); + vec2 size = texCoord.xy; + int type = int( texCoord.z ); + + // The billboarding is based on the camera direction. + vec3 rightVec = gc_camRight * sCornerRight[corner]; + vec3 upVec = gc_camUp * sCornerUp[corner]; + + // Figure out the corner position. + vec3 outPos = ( upVec * size.y ) + ( rightVec * size.x ); + float len = length( outPos.xyz ); + + // We derive the billboard phase used for wind calculations from its position. + float bbPhase = dot( position.xyz, vec3( 1.0 ) ); + + // Get the overall wind gust and turbulence effects. + vec3 wind; + wind.xy = windEffect( bbPhase, + gc_windDir, + gc_gustInfo.x, gc_gustInfo.y, gc_gustInfo.z, + gc_turbInfo.x, gc_turbInfo.y ); + wind.z = 0.0; + + // Add the summed wind effect into the point. + outPos.xyz += wind.xyz * texCoord.w; + + // Do a simple spherical clamp to keep the foliage + // from stretching too much by wind effect. + outPos.xyz = normalize( outPos.xyz ) * len; + + // Move the point into world space. + position += outPos; + + // Grab the uv set and setup the texture coord. + vec4 uvSet = gc_typeRects[type]; + texCoord.x = uvSet.x + ( uvSet.z * sUVCornerExtent[corner].x ); + texCoord.y = uvSet.y + ( uvSet.w * sUVCornerExtent[corner].y ); + + // Animate the normal to get lighting changes + // across the the wind swept foliage. + // + // TODO: Expose the 10x as a factor to control + // how much the wind effects the lighting on the grass. + // + normal.xy += wind.xy * ( 10.0 * texCoord.w ); + normal = normalize( normal ); + + // Get the alpha fade value. + + float fadeStart = gc_fadeParams.x; + float fadeEnd = gc_fadeParams.y; + float fadeRange = fadeEnd - fadeStart; + + float dist = distance( eyePos, position.xyz ) - fadeStart; + diffuse.a = 1.0 - clamp( dist / fadeRange, 0.0, 1.0 ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/fxFoliageReplicatorP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/fxFoliageReplicatorP.glsl new file mode 100644 index 000000000..b4d591486 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/fxFoliageReplicatorP.glsl @@ -0,0 +1,42 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +uniform sampler2D diffuseMap, alphaMap; +uniform vec4 groundAlpha; + +in vec4 color, groundAlphaCoeff; +in vec2 outTexCoord, alphaLookup; + +out vec4 OUT_col; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + vec4 alpha = texture(alphaMap, alphaLookup); + OUT_col = color * texture(diffuseMap, outTexCoord); + OUT_col.a = OUT_col.a * min(alpha, groundAlpha + groundAlphaCoeff.x).x; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/fxFoliageReplicatorV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/fxFoliageReplicatorV.glsl new file mode 100644 index 000000000..c8dcf1ddb --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/fxFoliageReplicatorV.glsl @@ -0,0 +1,99 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +in vec4 vPosition; +in vec3 vNormal; +in vec4 vColor; +in vec2 vTexCoord0; +in vec2 vTexCoord1; +in vec2 vTexCoord2; + +uniform mat4 projection, world; +uniform vec3 CameraPos; +uniform float GlobalSwayPhase, SwayMagnitudeSide, SwayMagnitudeFront, + GlobalLightPhase, LuminanceMagnitude, LuminanceMidpoint, DistanceRange; + +out vec4 color, groundAlphaCoeff; +out vec2 outTexCoord, alphaLookup; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + // Init a transform matrix to be used in the following steps + mat4 trans = mat4(0.0); + trans[0][0] = 1.0; + trans[1][1] = 1.0; + trans[2][2] = 1.0; + trans[3][3] = 1.0; + trans[3][0] = vPosition.x; + trans[3][1] = vPosition.y; + trans[3][2] = vPosition.z; + + // Billboard transform * world matrix + mat4 o = world; + o = o * trans; + + // Keep only the up axis result and position transform. + // This gives us "cheating" cylindrical billboarding. + o[0][0] = 1.0; + o[0][1] = 0.0; + o[0][2] = 0.0; + o[0][3] = 0.0; + o[1][0] = 0.0; + o[1][1] = 1.0; + o[1][2] = 0.0; + o[1][3] = 0.0; + + // Handle sway. Sway is stored in a texture coord. The x coordinate is the sway phase multiplier, + // the y coordinate determines if this vertex actually sways or not. + float xSway, ySway; + float wavePhase = GlobalSwayPhase * vTexCoord1.x; + ySway = sin(wavePhase); + xSway = cos(wavePhase); + xSway = xSway * vTexCoord1.y * SwayMagnitudeSide; + ySway = ySway * vTexCoord1.y * SwayMagnitudeFront; + vec4 p; + p = o * vec4(vNormal.x + xSway, ySway, vNormal.z, 1.0); + + // Project the point + gl_Position = projection * p; + + // Lighting + float Luminance = LuminanceMidpoint + LuminanceMagnitude * cos(GlobalLightPhase + vNormal.y); + + // Alpha + vec3 worldPos = vec3(vPosition.x, vPosition.y, vPosition.z); + float alpha = abs(distance(worldPos, CameraPos)) / DistanceRange; + alpha = clamp(alpha, 0.0, 1.0); //pass it through + + alphaLookup = vec2(alpha, 0.0); + bool alphaCoeff = bool(vNormal.z); + groundAlphaCoeff = vec4(float(alphaCoeff)); + outTexCoord = vTexCoord0.st; + color = vec4(Luminance, Luminance, Luminance, 1.0); + gl_Position.y *= -1; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/guiMaterialV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/guiMaterialV.glsl new file mode 100644 index 000000000..de3845ee7 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/guiMaterialV.glsl @@ -0,0 +1,39 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +in vec4 vPosition; +in vec2 vTexCoord0; + +uniform mat4x4 modelview; + +out vec4 hpos; +out vec2 uv0; + + +void main() +{ + hpos = vec4( modelview * vPosition ); + gl_Position = hpos; + + uv0 = vTexCoord0.st; + gl_Position.y *= -1; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/hlslCompat.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/hlslCompat.glsl new file mode 100644 index 000000000..b9a6e76d7 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/hlslCompat.glsl @@ -0,0 +1,101 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// These are some simple wrappers for simple +// HLSL compatibility. + +#define float4 vec4 +#define float3 vec3 +#define float2 vec2 + +#define half float +#define half2 vec2 +#define half3 vec3 +#define half4 vec4 + +#define float4x4 mat4 +#define float3x3 mat3 +#define float2x2 mat2 + +#define texCUBE texture +#define tex2D texture +#define tex1D texture +#define tex2Dproj textureProj +#define tex2Dlod( sampler, texCoord ) textureLod(sampler, texCoord.xy, texCoord.w) + +#define samplerCUBE samplerCube + +#define frac fract + +#define lerp mix + +void tSetMatrixRow(inout float3x3 m, int row, float3 value) +{ + m[0][row] = value.x; + m[1][row] = value.y; + m[2][row] = value.z; +} + +void tSetMatrixRow(inout float4x4 m, int row, float4 value) +{ + m[0][row] = value.x; + m[1][row] = value.y; + m[2][row] = value.z; + m[3][row] = value.w; +} + +#define tGetMatrix3Row(matrix, row) float3(matrix[0][row], matrix[1][row], matrix[2][row]) +#define tGetMatrix4Row(matrix, row) float4(matrix[0][row], matrix[1][row], matrix[2][row], matrix[3][row]) + +float3x3 float4x4to3x3(float4x4 m) +{ + return float3x3( vec3(m[0]).xyz, m[1].xyz, m[2].xyz); +} + +float3x3 float4x4to3x3_(float4x4 m) +{ + return float3x3( vec3(m[0]), m[1].xyz, m[2].xyz); +} + +mat4 mat4FromRow( float r0c0, float r0c1, float r0c2, float r0c3, + float r1c0, float r1c1, float r1c2, float r1c3, + float r2c0, float r2c1, float r2c2, float r2c3, + float r3c0, float r3c1, float r3c2, float r3c3 ) +{ + return mat4( r0c0, r1c0, r2c0, r3c0, + r0c1, r1c1, r2c1, r3c1, + r0c2, r1c2, r2c2, r3c2, + r0c3, r1c3, r2c3, r3c3 ); +} + + +#define saturate( val ) clamp( val, 0.0, 1.0 ) + +#define round( n ) (sign( n ) * floor( abs( n ) + 0.5 )) + +#define tMul(a, b) (a*b) + +#define correctSSP(vec) vec.y *= -1 + +#ifdef TORQUE_PIXEL_SHADER + void clip(float a) { if(a < 0) discard;} +#endif diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/imposter.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/imposter.glsl new file mode 100644 index 000000000..20bc62688 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/imposter.glsl @@ -0,0 +1,161 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "torque.glsl" + + +#define IMPOSTER_MAX_UVS 64 + + +void imposter_v( + // These parameters usually come from the vertex. + vec3 center, + int corner, + float halfSize, + vec3 imposterUp, + vec3 imposterRight, + + // These are from the imposter shader constant. + int numEquatorSteps, + int numPolarSteps, + float polarAngle, + bool includePoles, + + // Other shader constants. + vec3 camPos, + vec4 uvs[IMPOSTER_MAX_UVS], + + // The outputs of this function. + out vec3 outWsPosition, + out vec2 outTexCoord, + out mat3 outWorldToTangent + ) +{ + + float M_HALFPI_F = 1.57079632679489661923; + float M_PI_F = 3.14159265358979323846; + float M_2PI_F = 6.28318530717958647692; + + + float sCornerRight[4];// = float[]( -1.0, 1.0, 1.0, -1.0 ); + sCornerRight[0] = -1.0; + sCornerRight[1] = 1.0; + sCornerRight[2] = 1.0; + sCornerRight[3] = -1.0; + float sCornerUp[4];// = float[]( -1.0, -1.0, 1.0, 1.0 ); + sCornerUp[0] = -1.0; + sCornerUp[1] = -1.0; + sCornerUp[2] = 1.0; + sCornerUp[3] = 1.0; + vec2 sUVCornerExtent[4];// = vec2[](vec2( 0.0, 1.0 ), vec2( 1.0, 1.0 ), vec2( 1.0, 0.0 ), vec2( 0.0, 0.0 )); + sUVCornerExtent[0] = vec2( 0.0, 1.0 ); + sUVCornerExtent[1] = vec2( 1.0, 1.0 ); + sUVCornerExtent[2] = vec2( 1.0, 0.0 ); + sUVCornerExtent[3] = vec2( 0.0, 0.0 ); + + // TODO: This could all be calculated on the CPU. + float equatorStepSize = M_2PI_F / float( numEquatorSteps ); + float equatorHalfStep = ( equatorStepSize / 2.0 ) - 0.0001; + float polarStepSize = M_PI_F / float( numPolarSteps ); + float polarHalfStep = ( polarStepSize / 2.0 ) - 0.0001; + + // The vector between the camera and the billboard. + vec3 lookVec = normalize( camPos - center ); + + // Generate the camera up and right vectors from + // the object transform and camera forward. + vec3 camUp = imposterUp; + vec3 camRight = cross( -lookVec, camUp ); + + // The billboarding is based on the camera directions. + vec3 rightVec = camRight * sCornerRight[corner]; + vec3 upVec = camUp * sCornerUp[corner]; + + float lookPitch = acos( dot( imposterUp, lookVec ) ); + + // First check to see if we need to render the top billboard. + int index; + /* + if ( includePoles && ( lookPitch < polarAngle || lookPitch > sPi - polarAngle ) ) + { + index = numEquatorSteps * 3; + + // When we render the top/bottom billboard we always use + // a fixed vector that matches the rotation of the object. + rightVec = vec3( 1, 0, 0 ) * sCornerRight[corner]; + upVec = vec3( 0, 1, 0 ) * sCornerUp[corner]; + + if ( lookPitch > sPi - polarAngle ) + { + upVec = -upVec; + index++; + } + } + else + */ + { + // Calculate the rotation around the z axis then add the + // equator half step. This gets the images to switch a + // half step before the captured angle is met. + float lookAzimuth = atan( lookVec.y, lookVec.x ); + float azimuth = atan( imposterRight.y, imposterRight.x ); + float rotZ = ( lookAzimuth - azimuth ) + equatorHalfStep; + + // The y rotation is calculated from the look vector and + // the object up vector. + float rotY = lookPitch - polarHalfStep; + + // TODO: How can we do this without conditionals? + // Normalize the result to 0 to 2PI. + if ( rotZ < 0.0 ) + rotZ += M_2PI_F; + if ( rotZ > M_2PI_F ) + rotZ -= M_2PI_F; + if ( rotY < 0.0 ) + rotY += M_2PI_F; + if ( rotY > M_PI_F ) // Not M_2PI_F? + rotY -= M_2PI_F; + + float polarIdx = round( abs( rotY ) / polarStepSize ); + + // Get the index to the start of the right polar + // images for this viewing angle. + int numPolarOffset = int( float( numEquatorSteps ) * polarIdx ); + + // Calculate the final image index for lookup + // of the texture coords. + index = int( rotZ / equatorStepSize ) + numPolarOffset; + } + + // Generate the final world space position. + outWsPosition = center + ( upVec * halfSize ) + ( rightVec * halfSize ); + + // Grab the uv set and setup the texture coord. + vec4 uvSet = uvs[index]; + outTexCoord.x = uvSet.x + ( uvSet.z * sUVCornerExtent[corner].x ); + outTexCoord.y = uvSet.y + ( uvSet.w * sUVCornerExtent[corner].y ); + + // Needed for normal mapping and lighting. + outWorldToTangent[0] = vec3( 1, 0, 0 ); + outWorldToTangent[1] = vec3( 0, 1, 0 ); + outWorldToTangent[2] = vec3( 0, 0, -1 ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl new file mode 100644 index 000000000..804ab1e3b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/lighting.glsl @@ -0,0 +1,249 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./torque.glsl" + +#ifndef TORQUE_SHADERGEN + +// These are the uniforms used by most lighting shaders. + +uniform vec4 inLightPos[3]; +uniform vec4 inLightInvRadiusSq; +uniform vec4 inLightColor[4]; + +#ifndef TORQUE_BL_NOSPOTLIGHT + uniform vec4 inLightSpotDir[3]; + uniform vec4 inLightSpotAngle; + uniform vec4 inLightSpotFalloff; +#endif + +uniform vec4 ambient; +#define ambientCameraFactor 0.3 +uniform float specularPower; +uniform vec4 specularColor; + +#endif // !TORQUE_SHADERGEN + + +void compute4Lights( vec3 wsView, + vec3 wsPosition, + vec3 wsNormal, + vec4 shadowMask, + + #ifdef TORQUE_SHADERGEN + + vec4 inLightPos[3], + vec4 inLightInvRadiusSq, + vec4 inLightColor[4], + vec4 inLightSpotDir[3], + vec4 inLightSpotAngle, + vec4 inLightSpotFalloff, + float specularPower, + vec4 specularColor, + + #endif // TORQUE_SHADERGEN + + out vec4 outDiffuse, + out vec4 outSpecular ) +{ + // NOTE: The light positions and spotlight directions + // are stored in SoA order, so inLightPos[0] is the + // x coord for all 4 lights... inLightPos[1] is y... etc. + // + // This is the key to fully utilizing the vector units and + // saving a huge amount of instructions. + // + // For example this change saved more than 10 instructions + // over a simple for loop for each light. + + int i; + + vec4 lightVectors[3]; + for ( i = 0; i < 3; i++ ) + lightVectors[i] = wsPosition[i] - inLightPos[i]; + + vec4 squareDists = vec4(0); + for ( i = 0; i < 3; i++ ) + squareDists += lightVectors[i] * lightVectors[i]; + + // Accumulate the dot product between the light + // vector and the normal. + // + // The normal is negated because it faces away from + // the surface and the light faces towards the + // surface... this keeps us from needing to flip + // the light vector direction which complicates + // the spot light calculations. + // + // We normalize the result a little later. + // + vec4 nDotL = vec4(0); + for ( i = 0; i < 3; i++ ) + nDotL += lightVectors[i] * -wsNormal[i]; + + vec4 rDotL = vec4(0); + #ifndef TORQUE_BL_NOSPECULAR + + // We're using the Phong specular reflection model + // here where traditionally Torque has used Blinn-Phong + // which has proven to be more accurate to real materials. + // + // We do so because its cheaper as do not need to + // calculate the half angle for all 4 lights. + // + // Advanced Lighting still uses Blinn-Phong, but the + // specular reconstruction it does looks fairly similar + // to this. + // + vec3 R = reflect( wsView, -wsNormal ); + + for ( i = 0; i < 3; i++ ) + rDotL += lightVectors[i] * R[i]; + + #endif + + // Normalize the dots. + // + // Notice we're using the half type here to get a + // much faster sqrt via the rsq_pp instruction at + // the loss of some precision. + // + // Unless we have some extremely large point lights + // i don't believe the precision loss will matter. + // + half4 correction = half4(inversesqrt( squareDists )); + nDotL = saturate( nDotL * correction ); + rDotL = clamp( rDotL * correction, 0.00001, 1.0 ); + + // First calculate a simple point light linear + // attenuation factor. + // + // If this is a directional light the inverse + // radius should be greater than the distance + // causing the attenuation to have no affect. + // + vec4 atten = saturate( 1.0 - ( squareDists * inLightInvRadiusSq ) ); + + #ifndef TORQUE_BL_NOSPOTLIGHT + + // The spotlight attenuation factor. This is really + // fast for what it does... 6 instructions for 4 spots. + + vec4 spotAtten = vec4(0); + for ( i = 0; i < 3; i++ ) + spotAtten += lightVectors[i] * inLightSpotDir[i]; + + vec4 cosAngle = ( spotAtten * correction ) - inLightSpotAngle; + atten *= saturate( cosAngle * inLightSpotFalloff ); + + #endif + + // Finally apply the shadow masking on the attenuation. + atten *= shadowMask; + + // Get the final light intensity. + vec4 intensity = nDotL * atten; + + // Combine the light colors for output. + outDiffuse = vec4(0); + for ( i = 0; i < 4; i++ ) + outDiffuse += intensity[i] * inLightColor[i]; + + // Output the specular power. + vec4 specularIntensity = pow( rDotL, vec4(specularPower) ) * atten; + + // Apply the per-light specular attenuation. + vec4 specular = vec4(0,0,0,1); + for ( i = 0; i < 4; i++ ) + specular += vec4( inLightColor[i].rgb * inLightColor[i].a * specularIntensity[i], 1 ); + + // Add the final specular intensity values together + // using a single dot product operation then get the + // final specular lighting color. + outSpecular = specularColor * specular; +} + + +// This value is used in AL as a constant power to raise specular values +// to, before storing them into the light info buffer. The per-material +// specular value is then computer by using the integer identity of +// exponentiation: +// +// (a^m)^n = a^(m*n) +// +// or +// +// (specular^constSpecular)^(matSpecular/constSpecular) = specular^(matSpecular*constSpecular) +// +#define AL_ConstantSpecularPower 12.0f + +/// The specular calculation used in Advanced Lighting. +/// +/// @param toLight Normalized vector representing direction from the pixel +/// being lit, to the light source, in world space. +/// +/// @param normal Normalized surface normal. +/// +/// @param toEye The normalized vector representing direction from the pixel +/// being lit to the camera. +/// +float AL_CalcSpecular( vec3 toLight, vec3 normal, vec3 toEye ) +{ + // (R.V)^c + float specVal = dot( normalize( -reflect( toLight, normal ) ), toEye ); + + // Return the specular factor. + return pow( max( specVal, 0.00001f ), AL_ConstantSpecularPower ); +} + +/// The output for Deferred Lighting +/// +/// @param toLight Normalized vector representing direction from the pixel +/// being lit, to the light source, in world space. +/// +/// @param normal Normalized surface normal. +/// +/// @param toEye The normalized vector representing direction from the pixel +/// being lit to the camera. +/// +vec4 AL_DeferredOutput( + vec3 lightColor, + vec3 diffuseColor, + vec4 matInfo, + vec4 ambient, + float specular, + float shadowAttenuation) +{ + vec3 specularColor = vec3(specular); + bool metalness = getFlag(matInfo.r, 3); + if ( metalness ) + { + specularColor = 0.04 * (1 - specular) + diffuseColor * specular; + } + + //specular = color * map * spec^gloss + float specularOut = (specularColor * matInfo.b * min(pow(max(specular,1.0f), max((matInfo.a / AL_ConstantSpecularPower),1.0f)),matInfo.a)).r; + + lightColor *= vec3(shadowAttenuation); + lightColor += ambient.rgb; + return vec4(lightColor.rgb, specularOut); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/particleCompositeP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/particleCompositeP.glsl new file mode 100644 index 000000000..e33c9bd97 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/particleCompositeP.glsl @@ -0,0 +1,62 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "torque.glsl" +#include "hlslCompat.glsl" + +in vec4 offscreenPos; +in vec4 backbufferPos; + +#define IN_offscreenPos offscreenPos +#define IN_backbufferPos backbufferPos + +uniform sampler2D colorSource; +uniform vec4 offscreenTargetParams; + +#ifdef TORQUE_LINEAR_DEPTH +#define REJECT_EDGES +uniform sampler2D edgeSource; +uniform vec4 edgeTargetParams; +#endif + +out vec4 OUT_col; + +void main() +{ + // Off-screen particle source screenspace position in XY + // Back-buffer screenspace position in ZW + vec4 ssPos = vec4(offscreenPos.xy / offscreenPos.w, backbufferPos.xy / backbufferPos.w); + + vec4 uvScene = ( ssPos + 1.0 ) / 2.0; + uvScene.yw = 1.0 - uvScene.yw; + uvScene.xy = viewportCoordToRenderTarget(uvScene.xy, offscreenTargetParams); + +#ifdef REJECT_EDGES + // Cut out particles along the edges, this will create the stencil mask + uvScene.zw = viewportCoordToRenderTarget(uvScene.zw, edgeTargetParams); + float edge = texture( edgeSource, uvScene.zw ).r; + clip( -edge ); +#endif + + // Sample offscreen target and return + OUT_col = texture( colorSource, uvScene.xy ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/particleCompositeV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/particleCompositeV.glsl new file mode 100644 index 000000000..8c8f840d1 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/particleCompositeV.glsl @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "hlslCompat.glsl" + +in vec2 vTexCoord0; +#define uvCoord vTexCoord0 + +out vec4 offscreenPos; +out vec4 backbufferPos; + +#define OUT_hpos gl_Position +#define OUT_offscreenPos offscreenPos +#define OUT_backbufferPos backbufferPos + +uniform vec4 screenRect; // point, extent + +void main() +{ + OUT_hpos = vec4(uvCoord.xy, 1.0, 1.0); + OUT_hpos.xy *= screenRect.zw; + OUT_hpos.xy += screenRect.xy; + + OUT_backbufferPos = OUT_hpos; + OUT_offscreenPos = OUT_hpos; + + correctSSP(gl_Position); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/particlesP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/particlesP.glsl new file mode 100644 index 000000000..cf35e5f1b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/particlesP.glsl @@ -0,0 +1,113 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "torque.glsl" +#include "hlslCompat.glsl" + +// With advanced lighting we get soft particles. +#ifdef TORQUE_LINEAR_DEPTH + #define SOFTPARTICLES +#endif + +#ifdef SOFTPARTICLES + + #include "shadergen:/autogenConditioners.h" + + uniform float oneOverSoftness; + uniform float oneOverFar; + uniform sampler2D deferredTex; + //uniform vec3 vEye; + uniform vec4 deferredTargetParams; +#endif + +#define CLIP_Z // TODO: Make this a proper macro + +in vec4 color; +in vec2 uv0; +in vec4 pos; + +#define IN_color color +#define IN_uv0 uv0 +#define IN_pos pos + +uniform sampler2D diffuseMap; + +uniform sampler2D paraboloidLightMap; + +vec4 lmSample( vec3 nrm ) +{ + bool calcBack = (nrm.z < 0.0); + if ( calcBack ) + nrm.z = nrm.z * -1.0; + + vec2 lmCoord; + lmCoord.x = (nrm.x / (2*(1 + nrm.z))) + 0.5; + lmCoord.y = 1-((nrm.y / (2*(1 + nrm.z))) + 0.5); + + + // If this is the back, offset in the atlas + if ( calcBack ) + lmCoord.x += 1.0; + + // Atlasing front and back maps, so scale + lmCoord.x *= 0.5; + + return texture(paraboloidLightMap, lmCoord); +} + + +uniform float alphaFactor; +uniform float alphaScale; + +out vec4 OUT_col; + +void main() +{ + float softBlend = 1; + + #ifdef SOFTPARTICLES + vec2 tc = IN_pos.xy * vec2(1.0, -1.0) / IN_pos.w; + tc = viewportCoordToRenderTarget(saturate( ( tc + 1.0 ) * 0.5 ), deferredTargetParams); + + float sceneDepth = deferredUncondition( deferredTex, tc ).w; + float depth = IN_pos.w * oneOverFar; + float diff = sceneDepth - depth; + #ifdef CLIP_Z + // If drawing offscreen, this acts as the depth test, since we don't line up with the z-buffer + // When drawing high-res, though, we want to be able to take advantage of hi-z + // so this is #ifdef'd out + //clip(diff); + #endif + softBlend = saturate( diff * oneOverSoftness ); + #endif + + vec4 diffuse = texture( diffuseMap, IN_uv0 ); + + //OUT_col = vec4( lmSample(vec3(0, 0, -1)).rgb, IN_color.a * diffuse.a * softBlend * alphaScale); + + // Scale output color by the alpha factor (turn LerpAlpha into pre-multiplied alpha) + vec3 colorScale = ( alphaFactor < 0.0 ? IN_color.rgb * diffuse.rgb : vec3( alphaFactor > 0.0 ? IN_color.a * diffuse.a * alphaFactor * softBlend : softBlend ) ); + + OUT_col = hdrEncode( vec4( IN_color.rgb * diffuse.rgb * colorScale, + IN_color.a * diffuse.a * softBlend * alphaScale ) ); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/particlesV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/particlesV.glsl new file mode 100644 index 000000000..3d75a6fb6 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/particlesV.glsl @@ -0,0 +1,54 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "hlslCompat.glsl" + +in vec4 vPosition; +in vec4 vColor; +in vec2 vTexCoord0; + +#define In_pos vPosition +#define In_color vColor +#define In_uv0 vTexCoord0 + +out vec4 color; +out vec2 uv0; +out vec4 pos; + +#define OUT_hpos gl_Position +#define OUT_color color +#define OUT_uv0 uv0 +#define OUT_pos pos + +uniform mat4 modelViewProj; +uniform mat4 fsModelViewProj; + +void main() +{ + OUT_hpos = tMul( modelViewProj, In_pos ); + OUT_pos = tMul( fsModelViewProj, In_pos ); + OUT_color = In_color; + OUT_uv0 = In_uv0; + + correctSSP(gl_Position); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectBumpP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectBumpP.glsl new file mode 100644 index 000000000..db4250487 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectBumpP.glsl @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +uniform sampler2D diffuseMap, refractMap, bumpMap; +uniform vec4 shadeColor; + +in vec2 TEX0; +in vec4 TEX1; + +out vec4 OUT_col; + +//----------------------------------------------------------------------------- +// Fade edges of axis for texcoord passed in +//----------------------------------------------------------------------------- +float fadeAxis( float val ) +{ + // Fades from 1.0 to 0.0 when less than 0.1 + float fadeLow = clamp( val * 10.0, 0.0, 1.0 ); + + // Fades from 1.0 to 0.0 when greater than 0.9 + float fadeHigh = 1.0 - clamp( (val - 0.9) * 10.0, 0.0, 1.0 ); + + return fadeLow * fadeHigh; +} + + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + vec3 bumpNorm = texture( bumpMap, TEX0 ).rgb * 2.0 - 1.0; + vec2 offset = vec2( bumpNorm.x, bumpNorm.y ); + vec4 texIndex = TEX1; + + // The fadeVal is used to "fade" the distortion at the edges of the screen. + // This is done so it won't sample the reflection texture out-of-bounds and create artifacts + // Note - this can be done more efficiently with a texture lookup + float fadeVal = fadeAxis( texIndex.x / texIndex.w ) * fadeAxis( texIndex.y / texIndex.w ); + + const float distortion = 0.2; + texIndex.xy += offset * distortion * fadeVal; + + vec4 diffuseColor = texture( diffuseMap, TEX0 ); + vec4 reflectColor = textureProj( refractMap, texIndex ); + + OUT_col = diffuseColor + reflectColor * diffuseColor.a; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectBumpV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectBumpV.glsl new file mode 100644 index 000000000..90bcd27d8 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectBumpV.glsl @@ -0,0 +1,51 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +in vec4 vPosition; +in vec2 vTexCoord0; + +uniform mat4 modelview; + +out vec2 TEX0; +out vec4 TEX1; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + mat4 texGenTest = mat4(0.5, 0.0, 0.0, 0.0, + 0.0, -0.5, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.5, 0.5, 0.0, 1.0); + + gl_Position = modelview * vPosition; + + TEX0 = vTexCoord0.st; + + TEX1 = texGenTest * gl_Position; + TEX1.y = -TEX1.y; + gl_Position.y *= -1; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectP.glsl new file mode 100644 index 000000000..384c16188 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectP.glsl @@ -0,0 +1,43 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +uniform sampler2D diffuseMap, refractMap; +uniform vec4 shadeColor; + +in vec2 TEX0; +in vec4 TEX1; + +out vec4 OUT_col; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + vec4 diffuseColor = texture( diffuseMap, TEX0 ); + vec4 reflectColor = textureProj( refractMap, TEX1 ); + + OUT_col = diffuseColor + reflectColor * diffuseColor.a; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectV.glsl new file mode 100644 index 000000000..ba2484f66 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/planarReflectV.glsl @@ -0,0 +1,51 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +in vec4 vPosition; +in vec2 vTexCoord0; + +uniform mat4 modelview; + +out vec2 TEX0; +out vec4 TEX1; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + mat4 texGenTest = mat4(0.5, 0.0, 0.0, 0.0, + 0.0, -0.5, 0.0, 0.0, + 0.0, 0.0, 1.0, 0.0, + 0.5, 0.5, 0.0, 1.0); + + gl_Position = modelview * vPosition; + + TEX0 = vTexCoord0; + + TEX1 = texGenTest * gl_Position; + TEX1.y = -TEX1.y; + +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/precipP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/precipP.glsl new file mode 100644 index 000000000..102d0b0aa --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/precipP.glsl @@ -0,0 +1,39 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +uniform sampler2D diffuseMap; + +in vec4 color; +in vec2 texCoord; + +out vec4 OUT_col; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + OUT_col = texture(diffuseMap, texCoord) * color; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/precipV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/precipV.glsl new file mode 100644 index 000000000..29f921630 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/precipV.glsl @@ -0,0 +1,54 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +in vec4 vPosition; +in vec2 vTexCoord0; + +uniform mat4 modelview; +uniform vec3 cameraPos, ambient; +uniform vec2 fadeStartEnd; + +out vec4 color; +out vec2 texCoord; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + gl_Position = modelview * vPosition; + texCoord = vTexCoord0.st; + color = vec4( ambient.r, ambient.g, ambient.b, 1.0 ); + + // Do we need to do a distance fade? + if ( fadeStartEnd.x < fadeStartEnd.y ) + { + + float distance = length( cameraPos - vPosition.xyz ); + color.a = abs( clamp( ( distance - fadeStartEnd.x ) / ( fadeStartEnd.y - fadeStartEnd.x ), 0.0, 1.0 ) - 1.0 ); + } + gl_Position.y *= -1; +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/projectedShadowP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/projectedShadowP.glsl new file mode 100644 index 000000000..9b0ff0d0b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/projectedShadowP.glsl @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +in vec2 texCoord; +in vec4 color; +in float fade; + +out vec4 OUT_col; + +uniform sampler2D inputTex; +uniform vec4 ambient; + + +void main() +{ + float shadow = texture( inputTex, texCoord ).a * color.a; + OUT_col = ( ambient * shadow ) + ( 1 - shadow ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/projectedShadowV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/projectedShadowV.glsl new file mode 100644 index 000000000..c8b6d2a92 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/projectedShadowV.glsl @@ -0,0 +1,49 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "hlslCompat.glsl" + +in vec4 vPosition; +in vec4 vColor; +in vec2 vTexCoord0; +in vec2 vTexCoord1; + +out vec2 texCoord; +out vec4 color; +out float fade; + +uniform mat4 modelview; +uniform float shadowLength; +uniform vec3 shadowCasterPosition; + +void main() +{ + gl_Position = modelview * vec4(vPosition.xyz, 1.0); + + color = vColor; + texCoord = vTexCoord0.st; + + float fromCasterDist = length(vPosition.xyz - shadowCasterPosition) - shadowLength; + fade = 1.0 - clamp( fromCasterDist / shadowLength , 0.0, 1.0 ); + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/scatterSkyP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/scatterSkyP.glsl new file mode 100644 index 000000000..6d4e3ea75 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/scatterSkyP.glsl @@ -0,0 +1,72 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "torque.glsl" +#include "hlslCompat.glsl" + + +// Conn +in vec4 rayleighColor; +#define IN_rayleighColor rayleighColor +in vec4 mieColor; +#define IN_mieColor mieColor +in vec3 v3Direction; +#define IN_v3Direction v3Direction +in vec3 pos; +#define IN_pos pos + +uniform samplerCube nightSky ; +uniform vec4 nightColor; +uniform vec2 nightInterpAndExposure; +uniform float useCubemap; +uniform vec3 lightDir; +uniform vec3 sunDir; + +out vec4 OUT_col; + +void main() +{ + + float fCos = dot( lightDir, IN_v3Direction ) / length(IN_v3Direction); + float fCos2 = fCos*fCos; + + float g = -0.991; + float g2 = -0.991 * -0.991; + + float fMiePhase = 1.5 * ((1.0 - g2) / (2.0 + g2)) * (1.0 + fCos2) / pow(abs(1.0 + g2 - 2.0*g*fCos), 1.5); + + vec4 color = IN_rayleighColor + fMiePhase * IN_mieColor; + color.a = color.b; + + vec4 nightSkyColor = texture(nightSky, -v3Direction); + nightSkyColor = mix(nightColor, nightSkyColor, useCubemap); + + float fac = dot( normalize( pos ), sunDir ); + fac = max( nightInterpAndExposure.y, pow( clamp( fac, 0.0, 1.0 ), 2 ) ); + OUT_col = mix( color, nightSkyColor, nightInterpAndExposure.y ); + + OUT_col.a = 1; + + OUT_col = clamp(OUT_col, 0.0, 1.0); + + OUT_col = hdrEncode( OUT_col ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/scatterSkyV.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/scatterSkyV.glsl new file mode 100644 index 000000000..5780d2df9 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/scatterSkyV.glsl @@ -0,0 +1,154 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "hlslCompat.glsl" + +// The scale equation calculated by Vernier's Graphical Analysis +float vernierScale(float fCos) +{ + float x = 1.0 - fCos; + float x5 = x * 5.25; + float x5p6 = (-6.80 + x5); + float xnew = (3.83 + x * x5p6); + float xfinal = (0.459 + x * xnew); + float xfinal2 = -0.00287 + x * xfinal; + float outx = exp( xfinal2 ); + return 0.25 * outx; +} + +in vec4 vPosition; + +// This is the shader input vertex structure. +#define IN_position vPosition + +// This is the shader output data. +out vec4 rayleighColor; +#define OUT_rayleighColor rayleighColor +out vec4 mieColor; +#define OUT_mieColor mieColor +out vec3 v3Direction; +#define OUT_v3Direction v3Direction +out vec3 pos; +#define OUT_pos pos + +uniform mat4 modelView; +uniform vec4 misc; +uniform vec4 sphereRadii; +uniform vec4 scatteringCoeffs; +uniform vec3 camPos; +uniform vec3 lightDir; +uniform vec4 invWaveLength; +uniform vec4 colorize; + +vec3 desaturate(const vec3 color, const float desaturation) +{ + const vec3 gray_conv = vec3 (0.30, 0.59, 0.11); + return mix(color, vec3(dot(gray_conv , color)), desaturation); +} + +void main() +{ + // Pull some variables out: + float camHeight = misc.x; + float camHeightSqr = misc.y; + + float scale = misc.z; + float scaleOverScaleDepth = misc.w; + + float outerRadius = sphereRadii.x; + float outerRadiusSqr = sphereRadii.y; + + float innerRadius = sphereRadii.z; + float innerRadiusSqr = sphereRadii.w; + + float rayleighBrightness = scatteringCoeffs.x; // Kr * ESun + float rayleigh4PI = scatteringCoeffs.y; // Kr * 4 * PI + + float mieBrightness = scatteringCoeffs.z; // Km * ESun + float mie4PI = scatteringCoeffs.w; // Km * 4 * PI + + // Get the ray from the camera to the vertex, + // and its length (which is the far point of the ray + // passing through the atmosphere). + vec3 v3Pos = vec3(IN_position / 6378000.0);// / outerRadius; + vec3 newCamPos = vec3( 0, 0, camHeight ); + v3Pos.z += innerRadius; + vec3 v3Ray = v3Pos.xyz - newCamPos; + float fFar = length(v3Ray); + v3Ray /= fFar; + + // Calculate the ray's starting position, + // then calculate its scattering offset. + vec3 v3Start = newCamPos; + float fHeight = length(v3Start); + float fDepth = exp(scaleOverScaleDepth * (innerRadius - camHeight)); + float fStartAngle = dot(v3Ray, v3Start) / fHeight; + + float fStartOffset = fDepth * vernierScale( fStartAngle ); + + // Initialize the scattering loop variables. + float fSampleLength = fFar / 2.0; + float fScaledLength = fSampleLength * scale; + vec3 v3SampleRay = v3Ray * fSampleLength; + vec3 v3SamplePoint = v3Start + v3SampleRay * 0.5; + + // Now loop through the sample rays + vec3 v3FrontColor = vec3(0.0, 0.0, 0.0); + for(int i=0; i<2; i++) + { + float fHeight = length(v3SamplePoint); + float fDepth = exp(scaleOverScaleDepth * (innerRadius - fHeight)); + float fLightAngle = dot(lightDir, v3SamplePoint) / fHeight; + float fCameraAngle = dot(v3Ray, v3SamplePoint) / fHeight; + + float vscale3 = vernierScale( fCameraAngle ); + float vscale2 = vernierScale( fLightAngle ); + + float fScatter = (fStartOffset + fDepth*(vscale2 - vscale3)); + vec3 v3Attenuate = exp(-fScatter * (invWaveLength.xyz * rayleigh4PI + mie4PI)); + v3FrontColor += v3Attenuate * (fDepth * fScaledLength); + v3SamplePoint += v3SampleRay; + } + + // Finally, scale the Mie and Rayleigh colors + // and set up the varying variables for the pixel shader. + gl_Position = modelView * IN_position; + OUT_mieColor.rgb = v3FrontColor * mieBrightness; + OUT_mieColor.a = 1.0; + OUT_rayleighColor.rgb = v3FrontColor * (invWaveLength.xyz * rayleighBrightness); + OUT_rayleighColor.a = 1.0; + OUT_v3Direction = newCamPos - v3Pos.xyz; + OUT_pos = IN_position.xyz; + +#ifdef USE_COLORIZE + + OUT_rayleighColor.rgb = desaturate(OUT_rayleighColor.rgb, 1) * colorize.a; + + OUT_rayleighColor.r *= colorize.r; + OUT_rayleighColor.g *= colorize.g; + OUT_rayleighColor.b *= colorize.b; + +#endif + + correctSSP(gl_Position); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/torque.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/torque.glsl new file mode 100644 index 000000000..6e369bd5e --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/torque.glsl @@ -0,0 +1,339 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef _TORQUE_GLSL_ +#define _TORQUE_GLSL_ + + +float M_HALFPI_F = 1.57079632679489661923; +float M_PI_F = 3.14159265358979323846; +float M_2PI_F = 6.28318530717958647692; + +/// Calculate fog based on a start and end positions in worldSpace. +float computeSceneFog( vec3 startPos, + vec3 endPos, + float fogDensity, + float fogDensityOffset, + float fogHeightFalloff ) +{ + float f = length( startPos - endPos ) - fogDensityOffset; + float h = 1.0 - ( endPos.z * fogHeightFalloff ); + return exp( -fogDensity * f * h ); +} + + +/// Calculate fog based on a start and end position and a height. +/// Positions do not need to be in worldSpace but height does. +float computeSceneFog( vec3 startPos, + vec3 endPos, + float height, + float fogDensity, + float fogDensityOffset, + float fogHeightFalloff ) +{ + float f = length( startPos - endPos ) - fogDensityOffset; + float h = 1.0 - ( height * fogHeightFalloff ); + return exp( -fogDensity * f * h ); +} + + +/// Calculate fog based on a distance, height is not used. +float computeSceneFog( float dist, float fogDensity, float fogDensityOffset ) +{ + float f = dist - fogDensityOffset; + return exp( -fogDensity * f ); +} + + +/// Convert a vec4 uv in viewport space to render target space. +vec2 viewportCoordToRenderTarget( vec4 inCoord, vec4 rtParams ) +{ + vec2 outCoord = inCoord.xy / inCoord.w; + outCoord = ( outCoord * rtParams.zw ) + rtParams.xy; + return outCoord; +} + + +/// Convert a vec2 uv in viewport space to render target space. +vec2 viewportCoordToRenderTarget( vec2 inCoord, vec4 rtParams ) +{ + vec2 outCoord = ( inCoord * rtParams.zw ) + rtParams.xy; + return outCoord; +} + + +/// Convert a vec4 quaternion into a 3x3 matrix. +mat3x3 quatToMat( vec4 quat ) +{ + float xs = quat.x * 2.0; + float ys = quat.y * 2.0; + float zs = quat.z * 2.0; + + float wx = quat.w * xs; + float wy = quat.w * ys; + float wz = quat.w * zs; + + float xx = quat.x * xs; + float xy = quat.x * ys; + float xz = quat.x * zs; + + float yy = quat.y * ys; + float yz = quat.y * zs; + float zz = quat.z * zs; + + mat3x3 mat; + + mat[0][0] = 1.0 - (yy + zz); + mat[1][0] = xy - wz; + mat[2][0] = xz + wy; + + mat[0][1] = xy + wz; + mat[1][1] = 1.0 - (xx + zz); + mat[2][1] = yz - wx; + + mat[0][2] = xz - wy; + mat[1][2] = yz + wx; + mat[2][2] = 1.0 - (xx + yy); + + return mat; +} + + +/// The number of additional substeps we take when refining +/// the results of the offset parallax mapping function below. +/// +/// You should turn down the number of steps if your needing +/// more performance out of your parallax surfaces. Increasing +/// the number doesn't yeild much better results and is rarely +/// worth the additional cost. +/// +#define PARALLAX_REFINE_STEPS 3 + +/// Performs fast parallax offset mapping using +/// multiple refinement steps. +/// +/// @param texMap The texture map whos alpha channel we sample the parallax depth. +/// @param texCoord The incoming texture coordinate for sampling the parallax depth. +/// @param negViewTS The negative view vector in tangent space. +/// @param depthScale The parallax factor used to scale the depth result. +/// +vec2 parallaxOffset( sampler2D texMap, vec2 texCoord, vec3 negViewTS, float depthScale ) +{ + float depth = texture( texMap, texCoord ).a/(PARALLAX_REFINE_STEPS*2); + vec2 offset = negViewTS.xy * vec2( depth * depthScale )/vec2(PARALLAX_REFINE_STEPS*2); + + for ( int i=0; i < PARALLAX_REFINE_STEPS; i++ ) + { + depth = ( depth + texture( texMap, texCoord + offset ).a )/(PARALLAX_REFINE_STEPS*2); + offset = negViewTS.xy * vec2( depth * depthScale )/vec2(PARALLAX_REFINE_STEPS*2); + } + + return offset; +} + +/// Same as parallaxOffset but for dxtnm where depth is stored in the red channel instead of the alpha +vec2 parallaxOffsetDxtnm(sampler2D texMap, vec2 texCoord, vec3 negViewTS, float depthScale) +{ + float depth = texture(texMap, texCoord).r/(PARALLAX_REFINE_STEPS*2); + vec2 offset = negViewTS.xy * vec2(depth * depthScale)/vec2(PARALLAX_REFINE_STEPS*2); + + for (int i = 0; i < PARALLAX_REFINE_STEPS; i++) + { + depth = (depth + texture(texMap, texCoord + offset).r)/(PARALLAX_REFINE_STEPS*2); + offset = negViewTS.xy * vec2(depth * depthScale)/vec2(PARALLAX_REFINE_STEPS*2); + } + + return offset; +} + + +/// The maximum value for 16bit per component integer HDR encoding. +const float HDR_RGB16_MAX = 100.0; +/// The maximum value for 10bit per component integer HDR encoding. +const float HDR_RGB10_MAX = 4.0; + +/// Encodes an HDR color for storage into a target. +vec3 hdrEncode( vec3 _sample ) +{ + #if defined( TORQUE_HDR_RGB16 ) + + return _sample / HDR_RGB16_MAX; + + #elif defined( TORQUE_HDR_RGB10 ) + + return _sample / HDR_RGB10_MAX; + + #else + + // No encoding. + return _sample; + + #endif +} + +/// Encodes an HDR color for storage into a target. +vec4 hdrEncode( vec4 _sample ) +{ + return vec4( hdrEncode( _sample.rgb ), _sample.a ); +} + +/// Decodes an HDR color from a target. +vec3 hdrDecode( vec3 _sample ) +{ + #if defined( TORQUE_HDR_RGB16 ) + + return _sample * HDR_RGB16_MAX; + + #elif defined( TORQUE_HDR_RGB10 ) + + return _sample * HDR_RGB10_MAX; + + #else + + // No encoding. + return _sample; + + #endif +} + +/// Decodes an HDR color from a target. +vec4 hdrDecode( vec4 _sample ) +{ + return vec4( hdrDecode( _sample.rgb ), _sample.a ); +} + +/// Returns the luminance for an HDR pixel. +float hdrLuminance( vec3 _sample ) +{ + // There are quite a few different ways to + // calculate luminance from an rgb value. + // + // If you want to use a different technique + // then plug it in here. + // + + //////////////////////////////////////////////////////////////////////////// + // + // Max component luminance. + // + //float lum = max( _sample.r, max( _sample.g, _sample.b ) ); + + //////////////////////////////////////////////////////////////////////////// + // The perceptual relative luminance. + // + // See http://en.wikipedia.org/wiki/Luminance_(relative) + // + const vec3 RELATIVE_LUMINANCE = vec3( 0.2126, 0.7152, 0.0722 ); + float lum = dot( _sample, RELATIVE_LUMINANCE ); + + //////////////////////////////////////////////////////////////////////////// + // + // The average component luminance. + // + //const vec3 AVERAGE_LUMINANCE = vec3( 0.3333, 0.3333, 0.3333 ); + //float lum = dot( _sample, AVERAGE_LUMINANCE ); + + return lum; +} + +#ifdef TORQUE_PIXEL_SHADER +/// Called from the visibility feature to do screen +/// door transparency for fading of objects. +void fizzle(vec2 vpos, float visibility) +{ + // NOTE: The magic values below are what give us + // the nice even pattern during the fizzle. + // + // These values can be changed to get different + // patterns... some better than others. + // + // Horizontal Blinds - { vpos.x, 0.916, vpos.y, 0 } + // Vertical Lines - { vpos.x, 12.9898, vpos.y, 78.233 } + // + // I'm sure there are many more patterns here to + // discover for different effects. + + mat2x2 m = mat2x2( vpos.x, vpos.y, 0.916, 0.350 ); + if( (visibility - fract( determinant( m ) )) < 0 ) //if(a < 0) discard; + discard; +} +#endif //TORQUE_PIXEL_SHADER + +/// Basic assert macro. If the condition fails, then the shader will output color. +/// @param condition This should be a bvec[2-4]. If any items is false, condition is considered to fail. +/// @param color The color that should be outputted if the condition fails. +/// @note This macro will only work in the void main() method of a pixel shader. +#define assert(condition, color) { if(!any(condition)) { OUT_col = color; return; } } + +// Deferred Shading: Material Info Flag Check +bool getFlag(float flags, float num) +{ + float process = round(flags * 255); + float squareNum = pow(2.0, num); + return (mod(process, pow(2.0, squareNum)) >= squareNum); +} + +// #define TORQUE_STOCK_GAMMA +#ifdef TORQUE_STOCK_GAMMA +// Sample in linear space. Decodes gamma. +vec4 toLinear(vec4 tex) +{ + return tex; +} +// Encodes gamma. +vec4 toGamma(vec4 tex) +{ + return tex; +} +vec3 toLinear(vec3 tex) +{ + return tex; +} +// Encodes gamma. +vec3 toGamma(vec3 tex) +{ + return tex; +} +#else +// Sample in linear space. Decodes gamma. +vec4 toLinear(vec4 tex) +{ + return vec4(pow(abs(tex.rgb), vec3(2.2)), tex.a); +} +// Encodes gamma. +vec4 toGamma(vec4 tex) +{ + return vec4(pow(abs(tex.rgb), vec3(1.0/2.2)), tex.a); +} +// Sample in linear space. Decodes gamma. +vec3 toLinear(vec3 tex) +{ + return pow(abs(tex), vec3(2.2)); +} +// Encodes gamma. +vec3 toGamma(vec3 tex) +{ + return pow(abs(tex), vec3(1.0/2.2)); +} +#endif // + +#endif // _TORQUE_GLSL_ diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/wavesP.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/wavesP.glsl new file mode 100644 index 000000000..06c8a1a28 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/wavesP.glsl @@ -0,0 +1,57 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +uniform sampler2D diffMap; +uniform sampler2D bumpMap; +uniform samplerCube cubeMap; +uniform vec4 specularColor; +uniform float specularPower; +uniform vec4 ambient; +uniform float accumTime; + +in vec2 TEX0; +in vec4 outLightVec; +in vec3 outPos; +in vec3 outEyePos; + +out vec4 OUT_col; + +void main() +{ + vec2 texOffset; + float sinOffset1 = sin( accumTime * 1.5 + TEX0.y * 6.28319 * 3.0 ) * 0.03; + float sinOffset2 = sin( accumTime * 3.0 + TEX0.y * 6.28319 ) * 0.04; + + texOffset.x = TEX0.x + sinOffset1 + sinOffset2; + texOffset.y = TEX0.y + cos( accumTime * 3.0 + TEX0.x * 6.28319 * 2.0 ) * 0.05; + + vec4 bumpNorm = texture(bumpMap, texOffset) * 2.0 - 1.0; + vec4 diffuse = texture(diffMap, texOffset); + + OUT_col = diffuse * (clamp(dot(outLightVec.xyz, bumpNorm.xyz), 0.0, 1.0) + ambient); + + vec3 eyeVec = normalize(outEyePos - outPos); + vec3 halfAng = normalize(eyeVec + outLightVec.xyz); + float specular = clamp(dot(bumpNorm.xyz, halfAng), 0.0, 1.0) * outLightVec.w; + specular = pow(specular, specularPower); + OUT_col += specularColor * specular; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/gl/wind.glsl b/Templates/BaseGame/game/core/rendering/shaders/gl/wind.glsl new file mode 100644 index 000000000..0ddb492b9 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/gl/wind.glsl @@ -0,0 +1,101 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// +// A tip of the hat.... +// +// The following wind effects were derived from the GPU Gems +// 3 chapter "Vegetation Procedural Animation and Shading in Crysis" +// by Tiago Sousa of Crytek. +// + +vec4 smoothCurve( vec4 x ) +{ + return x * x * ( 3.0 - 2.0 * x ); +} + +vec4 triangleWave( vec4 x ) +{ + return abs( fract( x + 0.5 ) * 2.0 - 1.0 ); +} + +vec4 smoothTriangleWave( vec4 x ) +{ + return smoothCurve( triangleWave( x ) ); +} + +vec3 windTrunkBending( vec3 vPos, vec2 vWind, float fBendFactor ) +{ + // Smooth the bending factor and increase + // the near by height limit. + fBendFactor += 1.0; + fBendFactor *= fBendFactor; + fBendFactor = fBendFactor * fBendFactor - fBendFactor; + + // Displace the vert. + vec3 vNewPos = vPos; + vNewPos.xy += vWind * fBendFactor; + + // Limit the length which makes the bend more + // spherical and prevents stretching. + float fLength = length( vPos ); + vPos = normalize( vNewPos ) * fLength; + + return vPos; +} + +vec3 windBranchBending( vec3 vPos, + vec3 vNormal, + + float fTime, + float fWindSpeed, + + float fBranchPhase, + float fBranchAmp, + float fBranchAtten, + + float fDetailPhase, + float fDetailAmp, + float fDetailFreq, + + float fEdgeAtten ) +{ + float fVertPhase = dot( vPos, vec3( fDetailPhase + fBranchPhase ) ); + + vec2 vWavesIn = fTime + vec2( fVertPhase, fBranchPhase ); + + vec4 vWaves = ( fract( vWavesIn.xxyy * + vec4( 1.975, 0.793, 0.375, 0.193 ) ) * + 2.0 - 1.0 ) * fWindSpeed * fDetailFreq; + + vWaves = smoothTriangleWave( vWaves ); + + vec2 vWavesSum = vWaves.xz + vWaves.yw; + + // We want the branches to bend both up and down. + vWavesSum.y = 1.0 - ( vWavesSum.y * 2.0 ); + + vPos += vWavesSum.xxy * vec3( fEdgeAtten * fDetailAmp * vNormal.xy, + fBranchAtten * fBranchAmp ); + + return vPos; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/guiMaterialV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/guiMaterialV.hlsl new file mode 100644 index 000000000..5d725338f --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/guiMaterialV.hlsl @@ -0,0 +1,45 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "hlslStructs.hlsl" +#include "shaderModel.hlsl" + +struct MaterialDecoratorConnectV +{ + float4 hpos : TORQUE_POSITION; + float2 uv0 : TEXCOORD0; +}; + +uniform float4x4 modelview : register(C0); + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +MaterialDecoratorConnectV main( VertexIn_PCT IN ) +{ + MaterialDecoratorConnectV OUT; + + OUT.hpos = mul(modelview, float4(IN.pos,1.0)); + OUT.uv0 = IN.uv0; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/hlslStructs.h b/Templates/BaseGame/game/core/rendering/shaders/hlslStructs.h new file mode 100644 index 000000000..6a57e4db7 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/hlslStructs.h @@ -0,0 +1,116 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// The purpose of this file is to get all of our HLSL structures into one place. +// Please use the structures here instead of redefining input and output structures +// in each shader file. If structures are added, please adhere to the naming convention. + +//------------------------------------------------------------------------------ +// Vertex Input Structures +// +// These structures map to FVFs/Vertex Declarations in Torque. See gfxStructs.h +//------------------------------------------------------------------------------ + +// Notes +// +// Position should be specified as a float4. Right now our vertex structures in +// the engine output float3s for position. This does NOT mean that the POSITION +// binding should be float3, because it will assign 0 to the w coordinate, which +// results in the vertex not getting translated when it is transformed. + +struct VertexIn_P +{ + float4 pos : POSITION; +}; + +struct VertexIn_PT +{ + float4 pos : POSITION; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PTTT +{ + float4 pos : POSITION; + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float2 uv2 : TEXCOORD2; +}; + +struct VertexIn_PC +{ + float4 pos : POSITION; + float4 color : DIFFUSE; +}; + +struct VertexIn_PNC +{ + float4 pos : POSITION; + float3 normal : NORMAL; + float4 color : DIFFUSE; +}; + +struct VertexIn_PCT +{ + float4 pos : POSITION; + float4 color : DIFFUSE; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PN +{ + float4 pos : POSITION; + float3 normal : NORMAL; +}; + +struct VertexIn_PNT +{ + float4 pos : POSITION; + float3 normal : NORMAL; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PNTT +{ + float4 pos : POSITION; + float3 normal : NORMAL; + float3 tangent : TANGENT; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PNCT +{ + float4 pos : POSITION; + float3 normal : NORMAL; + float4 color : DIFFUSE; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PNTTTB +{ + float4 pos : POSITION; + float3 normal : NORMAL; + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float3 T : TEXCOORD2; + float3 B : TEXCOORD3; +}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/hlslStructs.hlsl b/Templates/BaseGame/game/core/rendering/shaders/hlslStructs.hlsl new file mode 100644 index 000000000..ce0ca305c --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/hlslStructs.hlsl @@ -0,0 +1,114 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// The purpose of this file is to get all of our HLSL structures into one place. +// Please use the structures here instead of redefining input and output structures +// in each shader file. If structures are added, please adhere to the naming convention. + +//------------------------------------------------------------------------------ +// Vertex Input Structures +// +// These structures map to FVFs/Vertex Declarations in Torque. See gfxStructs.h +//------------------------------------------------------------------------------ + +// Notes +// +// Position should be specified as a float3 as our vertex structures in +// the engine output float3s for position. + +struct VertexIn_P +{ + float3 pos : POSITION; +}; + +struct VertexIn_PT +{ + float3 pos : POSITION; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PTTT +{ + float3 pos : POSITION; + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float2 uv2 : TEXCOORD2; +}; + +struct VertexIn_PC +{ + float3 pos : POSITION; + float4 color : DIFFUSE; +}; + +struct VertexIn_PNC +{ + float3 pos : POSITION; + float3 normal : NORMAL; + float4 color : DIFFUSE; +}; + +struct VertexIn_PCT +{ + float3 pos : POSITION; + float4 color : DIFFUSE; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PN +{ + float3 pos : POSITION; + float3 normal : NORMAL; +}; + +struct VertexIn_PNT +{ + float3 pos : POSITION; + float3 normal : NORMAL; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PNTT +{ + float3 pos : POSITION; + float3 normal : NORMAL; + float3 tangent : TANGENT; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PNCT +{ + float3 pos : POSITION; + float3 normal : NORMAL; + float4 color : DIFFUSE; + float2 uv0 : TEXCOORD0; +}; + +struct VertexIn_PNTTTB +{ + float3 pos : POSITION; + float3 normal : NORMAL; + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float3 T : TEXCOORD2; + float3 B : TEXCOORD3; +}; \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/imposter.hlsl b/Templates/BaseGame/game/core/rendering/shaders/imposter.hlsl new file mode 100644 index 000000000..bc700ba03 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/imposter.hlsl @@ -0,0 +1,149 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "torque.hlsl" + + +static float sCornerRight[4] = { -1, 1, 1, -1 }; +static float sCornerUp[4] = { -1, -1, 1, 1 }; +static float2 sUVCornerExtent[4] = +{ + float2( 0, 1 ), + float2( 1, 1 ), + float2( 1, 0 ), + float2( 0, 0 ) +}; + +#define IMPOSTER_MAX_UVS 64 + + +void imposter_v( + // These parameters usually come from the vertex. + float3 center, + int corner, + float halfSize, + float3 imposterUp, + float3 imposterRight, + + // These are from the imposter shader constant. + int numEquatorSteps, + int numPolarSteps, + float polarAngle, + bool includePoles, + + // Other shader constants. + float3 camPos, + float4 uvs[IMPOSTER_MAX_UVS], + + // The outputs of this function. + out float3 outWsPosition, + out float2 outTexCoord, + out float3x3 outWorldToTangent + ) +{ + // TODO: This could all be calculated on the CPU. + float equatorStepSize = M_2PI_F / numEquatorSteps; + float equatorHalfStep = ( equatorStepSize / 2.0 ) - 0.0001; + float polarStepSize = M_PI_F / numPolarSteps; + float polarHalfStep = ( polarStepSize / 2.0 ) - 0.0001; + + // The vector between the camera and the billboard. + float3 lookVec = normalize( camPos - center ); + + // Generate the camera up and right vectors from + // the object transform and camera forward. + float3 camUp = imposterUp; + float3 camRight = normalize( cross( -lookVec, camUp ) ); + + // The billboarding is based on the camera directions. + float3 rightVec = camRight * sCornerRight[corner]; + float3 upVec = camUp * sCornerUp[corner]; + + float lookPitch = acos( dot( imposterUp, lookVec ) ); + + // First check to see if we need to render the top billboard. + int index; + /* + if ( includePoles && ( lookPitch < polarAngle || lookPitch > sPi - polarAngle ) ) + { + index = numEquatorSteps * 3; + + // When we render the top/bottom billboard we always use + // a fixed vector that matches the rotation of the object. + rightVec = float3( 1, 0, 0 ) * sCornerRight[corner]; + upVec = float3( 0, 1, 0 ) * sCornerUp[corner]; + + if ( lookPitch > sPi - polarAngle ) + { + upVec = -upVec; + index++; + } + } + else + */ + { + // Calculate the rotation around the z axis then add the + // equator half step. This gets the images to switch a + // half step before the captured angle is met. + float lookAzimuth = atan2( lookVec.y, lookVec.x ); + float azimuth = atan2( imposterRight.y, imposterRight.x ); + float rotZ = ( lookAzimuth - azimuth ) + equatorHalfStep; + + // The y rotation is calculated from the look vector and + // the object up vector. + float rotY = lookPitch - polarHalfStep; + + // TODO: How can we do this without conditionals? + // Normalize the result to 0 to 2PI. + if ( rotZ < 0 ) + rotZ += M_2PI_F; + if ( rotZ > M_2PI_F ) + rotZ -= M_2PI_F; + if ( rotY < 0 ) + rotY += M_2PI_F; + if ( rotY > M_PI_F ) // Not M_2PI_F? + rotY -= M_2PI_F; + + float polarIdx = round( abs( rotY ) / polarStepSize ); + + // Get the index to the start of the right polar + // images for this viewing angle. + int numPolarOffset = numEquatorSteps * polarIdx; + + // Calculate the final image index for lookup + // of the texture coords. + index = ( rotZ / equatorStepSize ) + numPolarOffset; + } + + // Generate the final world space position. + outWsPosition = center + ( upVec * halfSize ) + ( rightVec * halfSize ); + + // Grab the uv set and setup the texture coord. + float4 uvSet = uvs[index]; + outTexCoord.x = uvSet.x + ( uvSet.z * sUVCornerExtent[corner].x ); + outTexCoord.y = uvSet.y + ( uvSet.w * sUVCornerExtent[corner].y ); + + // Needed for normal mapping and lighting. + outWorldToTangent[0] = float3( 1, 0, 0 ); + outWorldToTangent[1] = float3( 0, 1, 0 ); + outWorldToTangent[2] = float3( 0, 0, -1 ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl new file mode 100644 index 000000000..a41b8a873 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting.hlsl @@ -0,0 +1,249 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./torque.hlsl" + +#ifndef TORQUE_SHADERGEN + +// These are the uniforms used by most lighting shaders. + +uniform float4 inLightPos[3]; +uniform float4 inLightInvRadiusSq; +uniform float4 inLightColor[4]; + +#ifndef TORQUE_BL_NOSPOTLIGHT + uniform float4 inLightSpotDir[3]; + uniform float4 inLightSpotAngle; + uniform float4 inLightSpotFalloff; +#endif + +uniform float4 ambient; +#define ambientCameraFactor 0.3 +uniform float specularPower; +uniform float4 specularColor; + +#endif // !TORQUE_SHADERGEN + + +void compute4Lights( float3 wsView, + float3 wsPosition, + float3 wsNormal, + float4 shadowMask, + + #ifdef TORQUE_SHADERGEN + + float4 inLightPos[3], + float4 inLightInvRadiusSq, + float4 inLightColor[4], + float4 inLightSpotDir[3], + float4 inLightSpotAngle, + float4 inLightSpotFalloff, + float specularPower, + float4 specularColor, + + #endif // TORQUE_SHADERGEN + + out float4 outDiffuse, + out float4 outSpecular ) +{ + // NOTE: The light positions and spotlight directions + // are stored in SoA order, so inLightPos[0] is the + // x coord for all 4 lights... inLightPos[1] is y... etc. + // + // This is the key to fully utilizing the vector units and + // saving a huge amount of instructions. + // + // For example this change saved more than 10 instructions + // over a simple for loop for each light. + + int i; + + float4 lightVectors[3]; + for ( i = 0; i < 3; i++ ) + lightVectors[i] = wsPosition[i] - inLightPos[i]; + + float4 squareDists = 0; + for ( i = 0; i < 3; i++ ) + squareDists += lightVectors[i] * lightVectors[i]; + + // Accumulate the dot product between the light + // vector and the normal. + // + // The normal is negated because it faces away from + // the surface and the light faces towards the + // surface... this keeps us from needing to flip + // the light vector direction which complicates + // the spot light calculations. + // + // We normalize the result a little later. + // + float4 nDotL = 0; + for ( i = 0; i < 3; i++ ) + nDotL += lightVectors[i] * -wsNormal[i]; + + float4 rDotL = 0; + #ifndef TORQUE_BL_NOSPECULAR + + // We're using the Phong specular reflection model + // here where traditionally Torque has used Blinn-Phong + // which has proven to be more accurate to real materials. + // + // We do so because its cheaper as do not need to + // calculate the half angle for all 4 lights. + // + // Advanced Lighting still uses Blinn-Phong, but the + // specular reconstruction it does looks fairly similar + // to this. + // + float3 R = reflect( wsView, -wsNormal ); + + for ( i = 0; i < 3; i++ ) + rDotL += lightVectors[i] * R[i]; + + #endif + + // Normalize the dots. + // + // Notice we're using the half type here to get a + // much faster sqrt via the rsq_pp instruction at + // the loss of some precision. + // + // Unless we have some extremely large point lights + // i don't believe the precision loss will matter. + // + half4 correction = (half4)rsqrt( squareDists ); + nDotL = saturate( nDotL * correction ); + rDotL = clamp( rDotL * correction, 0.00001, 1.0 ); + + // First calculate a simple point light linear + // attenuation factor. + // + // If this is a directional light the inverse + // radius should be greater than the distance + // causing the attenuation to have no affect. + // + float4 atten = saturate( 1.0 - ( squareDists * inLightInvRadiusSq ) ); + + #ifndef TORQUE_BL_NOSPOTLIGHT + + // The spotlight attenuation factor. This is really + // fast for what it does... 6 instructions for 4 spots. + + float4 spotAtten = 0; + for ( i = 0; i < 3; i++ ) + spotAtten += lightVectors[i] * inLightSpotDir[i]; + + float4 cosAngle = ( spotAtten * correction ) - inLightSpotAngle; + atten *= saturate( cosAngle * inLightSpotFalloff ); + + #endif + + // Finally apply the shadow masking on the attenuation. + atten *= shadowMask; + + // Get the final light intensity. + float4 intensity = nDotL * atten; + + // Combine the light colors for output. + outDiffuse = 0; + for ( i = 0; i < 4; i++ ) + outDiffuse += intensity[i] * inLightColor[i]; + + // Output the specular power. + float4 specularIntensity = pow( rDotL, specularPower.xxxx ) * atten; + + // Apply the per-light specular attenuation. + float4 specular = float4(0,0,0,1); + for ( i = 0; i < 4; i++ ) + specular += float4( inLightColor[i].rgb * inLightColor[i].a * specularIntensity[i], 1 ); + + // Add the final specular intensity values together + // using a single dot product operation then get the + // final specular lighting color. + outSpecular = specularColor * specular; +} + + +// This value is used in AL as a constant power to raise specular values +// to, before storing them into the light info buffer. The per-material +// specular value is then computer by using the integer identity of +// exponentiation: +// +// (a^m)^n = a^(m*n) +// +// or +// +// (specular^constSpecular)^(matSpecular/constSpecular) = specular^(matSpecular*constSpecular) +// +#define AL_ConstantSpecularPower 12.0f + +/// The specular calculation used in Advanced Lighting. +/// +/// @param toLight Normalized vector representing direction from the pixel +/// being lit, to the light source, in world space. +/// +/// @param normal Normalized surface normal. +/// +/// @param toEye The normalized vector representing direction from the pixel +/// being lit to the camera. +/// +float AL_CalcSpecular( float3 toLight, float3 normal, float3 toEye ) +{ + // (R.V)^c + float specVal = dot( normalize( -reflect( toLight, normal ) ), toEye ); + + // Return the specular factor. + return pow( max( specVal, 0.00001f ), AL_ConstantSpecularPower ); +} + +/// The output for Deferred Lighting +/// +/// @param toLight Normalized vector representing direction from the pixel +/// being lit, to the light source, in world space. +/// +/// @param normal Normalized surface normal. +/// +/// @param toEye The normalized vector representing direction from the pixel +/// being lit to the camera. +/// +float4 AL_DeferredOutput( + float3 lightColor, + float3 diffuseColor, + float4 matInfo, + float4 ambient, + float specular, + float shadowAttenuation) +{ + float3 specularColor = float3(specular, specular, specular); + bool metalness = getFlag(matInfo.r, 3); + if ( metalness ) + { + specularColor = 0.04 * (1 - specular) + diffuseColor * specular; + } + + //specular = color * map * spec^gloss + float specularOut = (specularColor * matInfo.b * min(pow(abs(specular), max(( matInfo.a/ AL_ConstantSpecularPower),1.0f)),matInfo.a)).r; + + lightColor *= shadowAttenuation; + lightColor += ambient.rgb; + return float4(lightColor.rgb, specularOut); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/convexGeometryV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/convexGeometryV.hlsl new file mode 100644 index 000000000..064fcffa6 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/convexGeometryV.hlsl @@ -0,0 +1,54 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../hlslStructs.hlsl" +#include "../../shaderModel.hlsl" + +struct VertData +{ + float3 pos : POSITION; + float4 color : COLOR; +}; + +struct ConvexConnectV +{ + float4 hpos : TORQUE_POSITION; + float4 wsEyeDir : TEXCOORD0; + float4 ssPos : TEXCOORD1; + float4 vsEyeDir : TEXCOORD2; +}; + +ConvexConnectV main( VertData IN, + uniform float4x4 modelview, + uniform float4x4 objTrans, + uniform float4x4 worldViewOnly, + uniform float3 eyePosWorld ) +{ + ConvexConnectV OUT; + + OUT.hpos = mul( modelview, float4(IN.pos,1.0) ); + OUT.wsEyeDir = mul(objTrans, float4(IN.pos, 1.0)) - float4(eyePosWorld, 0.0); + OUT.vsEyeDir = mul(worldViewOnly, float4(IN.pos, 1.0)); + OUT.ssPos = OUT.hpos; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredClearGBufferP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredClearGBufferP.hlsl new file mode 100644 index 000000000..5ae05896e --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredClearGBufferP.hlsl @@ -0,0 +1,54 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModel.hlsl" + +struct Conn +{ + float4 hpos : TORQUE_POSITION; +}; + +struct Fragout +{ + float4 col : TORQUE_TARGET0; + float4 col1 : TORQUE_TARGET1; + float4 col2 : TORQUE_TARGET2; +}; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Fragout main( Conn IN ) +{ + Fragout OUT; + + // Clear Deferred Buffer ( Normals/Depth ); + OUT.col = float4(1.0, 1.0, 1.0, 1.0); + + // Clear Color Buffer. + OUT.col1 = float4(0.0, 0.0, 0.0, 1.0); + + // Clear Material Info Buffer. + OUT.col2 = float4(0.0, 0.0, 0.0, 1.0); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredClearGBufferV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredClearGBufferV.hlsl new file mode 100644 index 000000000..20ba4d509 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredClearGBufferV.hlsl @@ -0,0 +1,43 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModel.hlsl" + +struct Appdata +{ + float3 pos : POSITION; + float4 color : COLOR; +}; + +struct Conn +{ + float4 hpos : TORQUE_POSITION; +}; + +uniform float4x4 modelview; + +Conn main( Appdata In ) +{ + Conn Out; + Out.hpos = float4(In.pos,1.0); + return Out; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredColorShaderP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredColorShaderP.hlsl new file mode 100644 index 000000000..d91d2eb38 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredColorShaderP.hlsl @@ -0,0 +1,46 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModel.hlsl" + +struct Fragout +{ + float4 col : TORQUE_TARGET0; + float4 col1 : TORQUE_TARGET1; + float4 col2 : TORQUE_TARGET2; +}; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Fragout main( ) +{ + Fragout OUT; + + OUT.col = float4(0.0, 0.0, 0.0, 0.0); + OUT.col1 = float4(1.0, 1.0, 1.0, 1.0); + + // Draw on color buffer. + OUT.col2 = float4(1.0, 0.0, 0.0, 1.0); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredShadingP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredShadingP.hlsl new file mode 100644 index 000000000..ebd9ed72b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/deferredShadingP.hlsl @@ -0,0 +1,54 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModelAutoGen.hlsl" +#include "../../postfx/postFx.hlsl" +#include "../../torque.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(colorBufferTex,0); +TORQUE_UNIFORM_SAMPLER2D(lightDeferredTex,1); +TORQUE_UNIFORM_SAMPLER2D(matInfoTex,2); +TORQUE_UNIFORM_SAMPLER2D(deferredTex,3); + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float4 lightBuffer = TORQUE_TEX2D( lightDeferredTex, IN.uv0 ); + float4 colorBuffer = TORQUE_TEX2D( colorBufferTex, IN.uv0 ); + float4 matInfo = TORQUE_TEX2D( matInfoTex, IN.uv0 ); + float specular = saturate(lightBuffer.a); + float depth = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ).w; + + if (depth>0.9999) + return float4(0,0,0,0); + + // Diffuse Color Altered by Metalness + bool metalness = getFlag(matInfo.r, 3); + if ( metalness ) + { + colorBuffer *= (1.0 - colorBuffer.a); + } + + colorBuffer += float4(specular, specular, specular, 1.0); + colorBuffer *= float4(lightBuffer.rgb, 1.0); + + return hdrEncode( float4(colorBuffer.rgb, 1.0) ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/farFrustumQuad.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/farFrustumQuad.hlsl new file mode 100644 index 000000000..543e21677 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/farFrustumQuad.hlsl @@ -0,0 +1,47 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "../../shaderModel.hlsl" + +struct FarFrustumQuadConnectV +{ + float4 hpos : TORQUE_POSITION; + float2 uv0 : TEXCOORD0; + float3 wsEyeRay : TEXCOORD1; + float3 vsEyeRay : TEXCOORD2; +}; + +struct FarFrustumQuadConnectP +{ + float4 hpos : TORQUE_POSITION; + float2 uv0 : TEXCOORD0; + float3 wsEyeRay : TEXCOORD1; + float3 vsEyeRay : TEXCOORD2; +}; + + +float2 getUVFromSSPos( float3 ssPos, float4 rtParams ) +{ + float2 outPos = ( ssPos.xy + 1.0 ) / 2.0; + outPos.y = 1.0 - outPos.y; + outPos = ( outPos * rtParams.zw ) + rtParams.xy; + return outPos; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/farFrustumQuadV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/farFrustumQuadV.hlsl new file mode 100644 index 000000000..0167d901a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/farFrustumQuadV.hlsl @@ -0,0 +1,43 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../hlslStructs.hlsl" +#include "farFrustumQuad.hlsl" + + +FarFrustumQuadConnectV main( VertexIn_PNTT IN, + uniform float4 rtParams0 ) +{ + FarFrustumQuadConnectV OUT; + + OUT.hpos = float4( IN.uv0, 0, 1 ); + + // Get a RT-corrected UV from the SS coord + OUT.uv0 = getUVFromSSPos( OUT.hpos.xyz, rtParams0 ); + + // Interpolators will generate eye rays the + // from far-frustum corners. + OUT.wsEyeRay = IN.tangent; + OUT.vsEyeRay = IN.normal; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/convexGeometryV.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/convexGeometryV.glsl new file mode 100644 index 000000000..1807ac43f --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/convexGeometryV.glsl @@ -0,0 +1,52 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" + +in vec4 vPosition; + +#define IN_pos vPosition + +out vec4 wsEyeDir; +out vec4 ssPos; +out vec4 vsEyeDir; + +#define OUT_hpos gl_Position +#define OUT_wsEyeDir wsEyeDir +#define OUT_ssPos ssPos +#define OUT_vsEyeDir vsEyeDir + +uniform mat4 modelview; +uniform mat4 objTrans; +uniform mat4 worldViewOnly; +uniform vec3 eyePosWorld; + +void main() +{ + OUT_hpos = tMul( modelview, IN_pos ); + OUT_wsEyeDir = tMul( objTrans, IN_pos ) - vec4( eyePosWorld, 0.0 ); + OUT_vsEyeDir = tMul( worldViewOnly, IN_pos ); + OUT_ssPos = OUT_hpos; + + correctSSP(gl_Position); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/deferredClearGBufferP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/deferredClearGBufferP.glsl new file mode 100644 index 000000000..b58f347bb --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/deferredClearGBufferP.glsl @@ -0,0 +1,40 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +out vec4 OUT_col; +out vec4 OUT_col1; +out vec4 OUT_col2; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + // Clear Deferred Buffer ( Normals/Depth ); + OUT_col = vec4(1.0, 1.0, 1.0, 1.0); + + // Clear Color Buffer. + OUT_col1 = vec4(0.0, 0.0, 0.0, 1.0); + + // Clear Material Info Buffer. + OUT_col2 = vec4(0.0, 0.0, 0.0, 1.0); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/deferredColorShaderP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/deferredColorShaderP.glsl new file mode 100644 index 000000000..85c553089 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/deferredColorShaderP.glsl @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +layout (location = 0) out vec4 col; +layout (location = 1) out vec4 col1; +layout (location = 2) out vec4 col2; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + col = vec4(0.0, 0.0, 0.0, 0.0); + col1 = vec4(1.0, 1.0, 1.0, 1.0); + + // Draw on color buffer. + col2 = vec4(1.0, 0.0, 0.0, 1.0); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/deferredShadingP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/deferredShadingP.glsl new file mode 100644 index 000000000..0234d5fd1 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/deferredShadingP.glsl @@ -0,0 +1,59 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../../postFx/gl/postFX.glsl" +#include "../../../gl/torque.glsl" + +uniform sampler2D colorBufferTex; +uniform sampler2D lightDeferredTex; +uniform sampler2D matInfoTex; +uniform sampler2D deferredTex; + +out vec4 OUT_col; + +void main() +{ + float depth = deferredUncondition( deferredTex, uv0 ).w; + if (depth>0.9999) + { + OUT_col = vec4(0.0); + return; + } + vec4 lightBuffer = texture( lightDeferredTex, uv0 ); + vec4 colorBuffer = texture( colorBufferTex, uv0 ); + vec4 matInfo = texture( matInfoTex, uv0 ); + float specular = clamp(lightBuffer.a,0.0,1.0); + + // Diffuse Color Altered by Metalness + bool metalness = getFlag(matInfo.r, 3); + if ( metalness ) + { + colorBuffer *= (1.0 - colorBuffer.a); + } + + colorBuffer += vec4(specular, specular, specular, 1.0); + colorBuffer *= vec4(lightBuffer.rgb, 1.0); + + OUT_col = hdrEncode( vec4(colorBuffer.rgb, 1.0) ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/farFrustumQuad.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/farFrustumQuad.glsl new file mode 100644 index 000000000..76054eb09 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/farFrustumQuad.glsl @@ -0,0 +1,30 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +vec2 getUVFromSSPos( vec3 ssPos, vec4 rtParams ) +{ + vec2 outPos = ( ssPos.xy + 1.0 ) / 2.0; + outPos.y = 1.0 - outPos.y; + outPos = ( outPos * rtParams.zw ) + rtParams.xy; + return outPos; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/farFrustumQuadV.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/farFrustumQuadV.glsl new file mode 100644 index 000000000..a80e856ed --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/farFrustumQuadV.glsl @@ -0,0 +1,51 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "farFrustumQuad.glsl" + +in vec4 vPosition; +in vec3 vNormal; +in vec3 vTangent; +in vec2 vTexCoord0; + +uniform vec4 rtParams0; +out vec4 hpos; +out vec2 uv0; +out vec3 wsEyeRay; +out vec3 vsEyeRay; + +void main() +{ + hpos = vec4( vTexCoord0, 0, 1 ); + + // Get a RT-corrected UV from the SS coord + uv0 = getUVFromSSPos( hpos.xyz, rtParams0 ); + gl_Position = hpos; + + // Interpolators will generate eye rays the + // from far-frustum corners. + wsEyeRay = vTangent; + vsEyeRay = vNormal; + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/lightingUtils.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/lightingUtils.glsl new file mode 100644 index 000000000..08af9231b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/lightingUtils.glsl @@ -0,0 +1,79 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +float attenuate( vec4 lightColor, vec2 attParams, float dist ) +{ + // We're summing the results of a scaled constant, + // linear, and quadratic attenuation. + + #ifdef ACCUMULATE_LUV + return lightColor.w * ( 1.0 - dot( attParams, vec2( dist, dist * dist ) ) ); + #else + return 1.0 - dot( attParams, vec2( dist, dist * dist ) ); + #endif +} + +// Calculate the specular coefficent +// +// pxlToLight - Normalized vector representing direction from the pixel being lit, to the light source, in world space +// normal - Normalized surface normal +// pxlToEye - Normalized vector representing direction from pixel being lit, to the camera, in world space +// specPwr - Specular exponent +// specularScale - A scalar on the specular output used in RGB accumulation. +// +float calcSpecular( vec3 pxlToLight, vec3 normal, vec3 pxlToEye, float specPwr, float specularScale ) +{ +#ifdef PHONG_SPECULAR + // (R.V)^c + float specVal = dot( normalize( -reflect( pxlToLight, normal ) ), pxlToEye ); +#else + // (N.H)^c [Blinn-Phong, TGEA style, default] + float specVal = dot( normal, normalize( pxlToLight + pxlToEye ) ); +#endif + +#ifdef ACCUMULATE_LUV + return pow( max( specVal, 0.00001f ), specPwr ); +#else + // If this is RGB accumulation, than there is no facility for the luminance + // of the light to play in to the specular intensity. In LUV, the luminance + // of the light color gets rolled into N.L * Attenuation + return specularScale * pow( max( specVal, 0.00001f ), specPwr ); +#endif +} + +vec3 getDistanceVectorToPlane( vec3 origin, vec3 direction, vec4 plane ) +{ + float denum = dot( plane.xyz, direction.xyz ); + float num = dot( plane, vec4( origin, 1.0 ) ); + float t = -num / denum; + + return direction.xyz * t; +} + +vec3 getDistanceVectorToPlane( float negFarPlaneDotEye, vec3 direction, vec4 plane ) +{ + float denum = dot( plane.xyz, direction.xyz ); + float t = negFarPlaneDotEye / denum; + + return direction.xyz * t; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/pointLightP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/pointLightP.glsl new file mode 100644 index 000000000..80869de25 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/pointLightP.glsl @@ -0,0 +1,273 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +#include "farFrustumQuad.glsl" +#include "lightingUtils.glsl" +#include "../../../gl/lighting.glsl" +#include "../../shadowMap/shadowMapIO_GLSL.h" +#include "softShadow.glsl" +#include "../../../gl/torque.glsl" + +in vec4 wsEyeDir; +in vec4 ssPos; +in vec4 vsEyeDir; +in vec4 color; + +#ifdef USE_COOKIE_TEX + +/// The texture for cookie rendering. +uniform samplerCube cookieMap ; + +#endif + + +#ifdef SHADOW_CUBE + + vec3 decodeShadowCoord( vec3 shadowCoord ) + { + return shadowCoord; + } + + vec4 shadowSample( samplerCube shadowMap, vec3 shadowCoord ) + { + return texture( shadowMap, shadowCoord ); + } + +#else + + vec3 decodeShadowCoord( vec3 paraVec ) + { + // Flip y and z + paraVec = paraVec.xzy; + + #ifndef SHADOW_PARABOLOID + + bool calcBack = (paraVec.z < 0.0); + if ( calcBack ) + { + paraVec.z = paraVec.z * -1.0; + + #ifdef SHADOW_DUALPARABOLOID + paraVec.x = -paraVec.x; + #endif + } + + #endif + + vec3 shadowCoord; + shadowCoord.x = (paraVec.x / (2*(1 + paraVec.z))) + 0.5; + shadowCoord.y = 1-((paraVec.y / (2*(1 + paraVec.z))) + 0.5); + shadowCoord.z = 0; + + // adjust the co-ordinate slightly if it is near the extent of the paraboloid + // this value was found via experementation + // NOTE: this is wrong, it only biases in one direction, not towards the uv + // center ( 0.5 0.5 ). + //shadowCoord.xy *= 0.997; + + #ifndef SHADOW_PARABOLOID + + // If this is the back, offset in the atlas + if ( calcBack ) + shadowCoord.x += 1.0; + + // Atlasing front and back maps, so scale + shadowCoord.x *= 0.5; + + #endif + + return shadowCoord; + } + +#endif + +uniform sampler2D deferredBuffer; + +#ifdef SHADOW_CUBE + uniform samplerCube shadowMap; +#else + uniform sampler2D shadowMap; + uniform sampler2D dynamicShadowMap; +#endif + +uniform sampler2D lightBuffer; +uniform sampler2D colorBuffer; +uniform sampler2D matInfoBuffer; + +uniform vec4 rtParams0; + +uniform vec3 lightPosition; +uniform vec4 lightColor; +uniform float lightBrightness; +uniform float lightRange; +uniform vec2 lightAttenuation; +uniform vec4 lightMapParams; +uniform vec4 vsFarPlane; +uniform mat3 viewToLightProj; +uniform mat3 dynamicViewToLightProj; +uniform vec4 lightParams; +uniform float shadowSoftness; + +out vec4 OUT_col; + +void main() +{ + // Compute scene UV + vec3 ssPos = ssPos.xyz / ssPos.w; + vec2 uvScene = getUVFromSSPos( ssPos, rtParams0 ); + + // Emissive. + vec4 matInfo = texture( matInfoBuffer, uvScene ); + bool emissive = getFlag( matInfo.r, 0 ); + if ( emissive ) + { + OUT_col = vec4(0.0, 0.0, 0.0, 0.0); + return; + } + + vec4 colorSample = texture( colorBuffer, uvScene ); + vec3 subsurface = vec3(0.0,0.0,0.0); + if (getFlag( matInfo.r, 1 )) + { + subsurface = colorSample.rgb; + if (colorSample.r>colorSample.g) + subsurface = vec3(0.772549, 0.337255, 0.262745); + else + subsurface = vec3(0.337255, 0.772549, 0.262745); + } + + // Sample/unpack the normal/z data + vec4 deferredSample = deferredUncondition( deferredBuffer, uvScene ); + vec3 normal = deferredSample.rgb; + float depth = deferredSample.a; + + // Eye ray - Eye -> Pixel + vec3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, vsEyeDir.xyz, vsFarPlane ); + vec3 viewSpacePos = eyeRay * depth; + + // Build light vec, get length, clip pixel if needed + vec3 lightVec = lightPosition - viewSpacePos; + float lenLightV = length( lightVec ); + clip( lightRange - lenLightV ); + + // Get the attenuated falloff. + float atten = attenuate( lightColor, lightAttenuation, lenLightV ); + clip( atten - 1e-6 ); + + // Normalize lightVec + lightVec /= lenLightV; + + // If we can do dynamic branching then avoid wasting + // fillrate on pixels that are backfacing to the light. + float nDotL = dot( lightVec, normal ); + //DB_CLIP( nDotL < 0 ); + + #ifdef NO_SHADOW + + float shadowed = 1.0; + + #else + + // Get a linear depth from the light source. + float distToLight = lenLightV / lightRange; + + #ifdef SHADOW_CUBE + + // TODO: We need to fix shadow cube to handle soft shadows! + float occ = texture( shadowMap, tMul( viewToLightProj, -lightVec ) ).r; + float shadowed = saturate( exp( lightParams.y * ( occ - distToLight ) ) ); + + #else + + vec2 shadowCoord = decodeShadowCoord( tMul( viewToLightProj, -lightVec ) ).xy; + + float static_shadowed = softShadow_filter( shadowMap, + ssPos.xy, + shadowCoord, + shadowSoftness, + distToLight, + nDotL, + lightParams.y ); + + vec2 dynamicShadowCoord = decodeShadowCoord( tMul( dynamicViewToLightProj, -lightVec ) ).xy; + float dynamic_shadowed = softShadow_filter( dynamicShadowMap, + ssPos.xy, + dynamicShadowCoord, + shadowSoftness, + distToLight, + nDotL, + lightParams.y ); + + float shadowed = min(static_shadowed, dynamic_shadowed); + #endif + + #endif // !NO_SHADOW + + vec3 lightcol = lightColor.rgb; + #ifdef USE_COOKIE_TEX + + // Lookup the cookie sample. + vec4 cookie = texture( cookieMap, tMul( viewToLightProj, -lightVec ) ); + + // Multiply the light with the cookie tex. + lightcol *= cookie.rgb; + + // Use a maximum channel luminance to attenuate + // the lighting else we get specular in the dark + // regions of the cookie texture. + atten *= max( cookie.r, max( cookie.g, cookie.b ) ); + + #endif + + // NOTE: Do not clip on fully shadowed pixels as it would + // cause the hardware occlusion query to disable the shadow. + + // Specular term + float specular = AL_CalcSpecular( lightVec, + normal, + normalize( -eyeRay ) ) * lightBrightness * atten * shadowed; + + float Sat_NL_Att = saturate( nDotL * atten * shadowed ) * lightBrightness; + vec3 lightColorOut = lightMapParams.rgb * lightcol; + vec4 addToResult = vec4(0.0); + + // TODO: This needs to be removed when lightmapping is disabled + // as its extra work per-pixel on dynamic lit scenes. + // + // Special lightmapping pass. + if ( lightMapParams.a < 0.0 ) + { + // This disables shadows on the backsides of objects. + shadowed = nDotL < 0.0f ? 1.0f : shadowed; + + Sat_NL_Att = 1.0f; + shadowed = mix( 1.0f, shadowed, atten ); + lightColorOut = vec3(shadowed); + specular *= lightBrightness; + addToResult = ( 1.0 - shadowed ) * abs(lightMapParams); + } + + OUT_col = AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/softShadow.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/softShadow.glsl new file mode 100644 index 000000000..a14213946 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/softShadow.glsl @@ -0,0 +1,159 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +#if defined( SOFTSHADOW ) && defined( SOFTSHADOW_HIGH_QUALITY ) + +#define NUM_PRE_TAPS 4 +#define NUM_TAPS 12 + +/// The non-uniform poisson disk used in the +/// high quality shadow filtering. +vec2 sNonUniformTaps[NUM_TAPS] = vec2[] +( + // These first 4 taps are located around the edges + // of the disk and are used to predict fully shadowed + // or unshadowed areas. + vec2( 0.992833, 0.979309 ), + vec2( -0.998585, 0.985853 ), + vec2( 0.949299, -0.882562 ), + vec2( -0.941358, -0.893924 ), + + // The rest of the samples. + vec2( 0.545055, -0.589072 ), + vec2( 0.346526, 0.385821 ), + vec2( -0.260183, 0.334412 ), + vec2( 0.248676, -0.679605 ), + vec2( -0.569502, -0.390637 ), + vec2( -0.614096, 0.212577 ), + vec2( -0.259178, 0.876272 ), + vec2( 0.649526, 0.864333 ) +); + +#else + +#define NUM_PRE_TAPS 5 + +/// The non-uniform poisson disk used in the +/// high quality shadow filtering. +vec2 sNonUniformTaps[NUM_PRE_TAPS] = vec2[] +( + vec2( 0.892833, 0.959309 ), + vec2( -0.941358, -0.873924 ), + vec2( -0.260183, 0.334412 ), + vec2( 0.348676, -0.679605 ), + vec2( -0.569502, -0.390637 ) +); + +#endif + + +/// The texture used to do per-pixel pseudorandom +/// rotations of the filter taps. +uniform sampler2D gTapRotationTex ; + + +float softShadow_sampleTaps( sampler2D shadowMap, + vec2 sinCos, + vec2 shadowPos, + float filterRadius, + float distToLight, + float esmFactor, + int startTap, + int endTap ) +{ + float shadow = 0; + + vec2 tap = vec2(0); + for ( int t = startTap; t < endTap; t++ ) + { + tap.x = ( sNonUniformTaps[t].x * sinCos.y - sNonUniformTaps[t].y * sinCos.x ) * filterRadius; + tap.y = ( sNonUniformTaps[t].y * sinCos.y + sNonUniformTaps[t].x * sinCos.x ) * filterRadius; + float occluder = tex2Dlod( shadowMap, vec4( shadowPos + tap, 0, 0 ) ).r; + + float esm = saturate( exp( esmFactor * ( occluder - distToLight ) ) ); + shadow += esm / float( endTap - startTap ); + } + + return shadow; +} + + +float softShadow_filter( sampler2D shadowMap, + vec2 vpos, + vec2 shadowPos, + float filterRadius, + float distToLight, + float dotNL, + float esmFactor ) +{ + #ifndef SOFTSHADOW + + // If softshadow is undefined then we skip any complex + // filtering... just do a single sample ESM. + + float occluder = tex2Dlod( shadowMap, vec4( shadowPos, 0, 0 ) ).r; + float shadow = saturate( exp( esmFactor * ( occluder - distToLight ) ) ); + + #else + + // Lookup the random rotation for this screen pixel. + vec2 sinCos = ( tex2Dlod( gTapRotationTex, vec4( vpos * 16, 0, 0 ) ).rg - 0.5 ) * 2; + + // Do the prediction taps first. + float shadow = softShadow_sampleTaps( shadowMap, + sinCos, + shadowPos, + filterRadius, + distToLight, + esmFactor, + 0, + NUM_PRE_TAPS ); + + // We live with only the pretap results if we don't + // have high quality shadow filtering enabled. + #ifdef SOFTSHADOW_HIGH_QUALITY + + // Only do the expensive filtering if we're really + // in a partially shadowed area. + if ( shadow * ( 1.0 - shadow ) * max( dotNL, 0 ) > 0.06 ) + { + shadow += softShadow_sampleTaps( shadowMap, + sinCos, + shadowPos, + filterRadius, + distToLight, + esmFactor, + NUM_PRE_TAPS, + NUM_TAPS ); + + // This averages the taps above with the results + // of the prediction samples. + shadow *= 0.5; + } + + #endif // SOFTSHADOW_HIGH_QUALITY + + #endif // SOFTSHADOW + + return shadow; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/spotLightP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/spotLightP.glsl new file mode 100644 index 000000000..5fcf1b19c --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/spotLightP.glsl @@ -0,0 +1,210 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "farFrustumQuad.glsl" +#include "lightingUtils.glsl" +#include "../../shadowMap/shadowMapIO_GLSL.h" +#include "shadergen:/autogenConditioners.h" +#include "softShadow.glsl" +#include "../../../gl/lighting.glsl" +#include "../../../gl/torque.glsl" + +in vec4 wsEyeDir; +in vec4 ssPos; +in vec4 vsEyeDir; +in vec4 color; + +#define IN_wsEyeDir wsEyeDir +#define IN_ssPos ssPos +#define IN_vsEyeDir vsEyeDir +#define IN_color color + +#ifdef USE_COOKIE_TEX + +/// The texture for cookie rendering. +uniform sampler2D cookieMap; + +#endif + +uniform sampler2D deferredBuffer; +uniform sampler2D shadowMap; +uniform sampler2D dynamicShadowMap; + +uniform sampler2D lightBuffer; +uniform sampler2D colorBuffer; +uniform sampler2D matInfoBuffer; + +uniform vec4 rtParams0; + +uniform vec3 lightPosition; +uniform vec4 lightColor; +uniform float lightBrightness; +uniform float lightRange; +uniform vec2 lightAttenuation; +uniform vec3 lightDirection; +uniform vec4 lightSpotParams; +uniform vec4 lightMapParams; + +uniform vec4 vsFarPlane; +uniform mat4 viewToLightProj; +uniform mat4 dynamicViewToLightProj; + +uniform vec4 lightParams; +uniform float shadowSoftness; + +out vec4 OUT_col; + +void main() +{ + // Compute scene UV + vec3 ssPos = IN_ssPos.xyz / IN_ssPos.w; + vec2 uvScene = getUVFromSSPos( ssPos, rtParams0 ); + + // Emissive. + vec4 matInfo = texture( matInfoBuffer, uvScene ); + bool emissive = getFlag( matInfo.r, 0 ); + if ( emissive ) + { + OUT_col = vec4(0.0, 0.0, 0.0, 0.0); + return; + } + + vec4 colorSample = texture( colorBuffer, uvScene ); + vec3 subsurface = vec3(0.0,0.0,0.0); + if (getFlag( matInfo.r, 1 )) + { + subsurface = colorSample.rgb; + if (colorSample.r>colorSample.g) + subsurface = vec3(0.772549, 0.337255, 0.262745); + else + subsurface = vec3(0.337255, 0.772549, 0.262745); + } + + // Sample/unpack the normal/z data + vec4 deferredSample = deferredUncondition( deferredBuffer, uvScene ); + vec3 normal = deferredSample.rgb; + float depth = deferredSample.a; + + // Eye ray - Eye -> Pixel + vec3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN_vsEyeDir.xyz, vsFarPlane ); + vec3 viewSpacePos = eyeRay * depth; + + // Build light vec, get length, clip pixel if needed + vec3 lightToPxlVec = viewSpacePos - lightPosition; + float lenLightV = length( lightToPxlVec ); + lightToPxlVec /= lenLightV; + + //lightDirection = vec3( -lightDirection.xy, lightDirection.z ); //vec3( 0, 0, -1 ); + float cosAlpha = dot( lightDirection, lightToPxlVec ); + clip( cosAlpha - lightSpotParams.x ); + clip( lightRange - lenLightV ); + + float atten = attenuate( lightColor, lightAttenuation, lenLightV ); + atten *= ( cosAlpha - lightSpotParams.x ) / lightSpotParams.y; + clip( atten - 1e-6 ); + atten = saturate( atten ); + + float nDotL = dot( normal, -lightToPxlVec ); + + // Get the shadow texture coordinate + vec4 pxlPosLightProj = tMul( viewToLightProj, vec4( viewSpacePos, 1 ) ); + vec2 shadowCoord = ( ( pxlPosLightProj.xy / pxlPosLightProj.w ) * 0.5 ) + vec2( 0.5, 0.5 ); + shadowCoord.y = 1.0f - shadowCoord.y; + + // Get the dynamic shadow texture coordinate + vec4 dynpxlPosLightProj = tMul( dynamicViewToLightProj, vec4( viewSpacePos, 1 ) ); + vec2 dynshadowCoord = ( ( dynpxlPosLightProj.xy / dynpxlPosLightProj.w ) * 0.5 ) + vec2( 0.5, 0.5 ); + dynshadowCoord.y = 1.0f - dynshadowCoord.y; + #ifdef NO_SHADOW + + float shadowed = 1.0; + + #else + + // Get a linear depth from the light source. + float distToLight = pxlPosLightProj.z / lightRange; + + float static_shadowed = softShadow_filter( shadowMap, + ssPos.xy, + shadowCoord, + shadowSoftness, + distToLight, + nDotL, + lightParams.y ); + + float dynamic_shadowed = softShadow_filter( dynamicShadowMap, + ssPos.xy, + dynshadowCoord, + shadowSoftness, + distToLight, + nDotL, + lightParams.y ); + float shadowed = min(static_shadowed, dynamic_shadowed); + #endif // !NO_SHADOW + + vec3 lightcol = lightColor.rgb; + #ifdef USE_COOKIE_TEX + + // Lookup the cookie sample. + vec4 cookie = texture( cookieMap, shadowCoord ); + + // Multiply the light with the cookie tex. + lightcol *= cookie.rgb; + + // Use a maximum channel luminance to attenuate + // the lighting else we get specular in the dark + // regions of the cookie texture. + atten *= max( cookie.r, max( cookie.g, cookie.b ) ); + + #endif + + // NOTE: Do not clip on fully shadowed pixels as it would + // cause the hardware occlusion query to disable the shadow. + + // Specular term + float specular = AL_CalcSpecular( -lightToPxlVec, + normal, + normalize( -eyeRay ) ) * lightBrightness * atten * shadowed; + + float Sat_NL_Att = saturate( nDotL * atten * shadowed ) * lightBrightness; + vec3 lightColorOut = lightMapParams.rgb * lightcol; + vec4 addToResult = vec4(0.0); + + // TODO: This needs to be removed when lightmapping is disabled + // as its extra work per-pixel on dynamic lit scenes. + // + // Special lightmapping pass. + if ( lightMapParams.a < 0.0 ) + { + // This disables shadows on the backsides of objects. + shadowed = nDotL < 0.0f ? 1.0f : shadowed; + + Sat_NL_Att = 1.0f; + shadowed = mix( 1.0f, shadowed, atten ); + lightColorOut = vec3(shadowed); + specular *= lightBrightness; + addToResult = ( 1.0 - shadowed ) * abs(lightMapParams); + } + + OUT_col = AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/vectorLightP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/vectorLightP.glsl new file mode 100644 index 000000000..142e58b10 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/gl/vectorLightP.glsl @@ -0,0 +1,327 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "farFrustumQuad.glsl" +#include "../../../gl/torque.glsl" +#include "../../../gl/lighting.glsl" +#include "lightingUtils.glsl" +#include "../../shadowMap/shadowMapIO_GLSL.h" +#include "softShadow.glsl" + +in vec4 hpos; +in vec2 uv0; +in vec3 wsEyeRay; +in vec3 vsEyeRay; + +uniform sampler2D shadowMap; +uniform sampler2D dynamicShadowMap; + +#ifdef USE_SSAO_MASK +uniform sampler2D ssaoMask ; +uniform vec4 rtParams3; +#endif + +uniform sampler2D deferredBuffer; +uniform sampler2D lightBuffer; +uniform sampler2D colorBuffer; +uniform sampler2D matInfoBuffer; +uniform vec3 lightDirection; +uniform vec4 lightColor; +uniform float lightBrightness; +uniform vec4 lightAmbient; +uniform vec3 eyePosWorld; +uniform mat4x4 eyeMat; +uniform vec4 atlasXOffset; +uniform vec4 atlasYOffset; +uniform vec2 atlasScale; +uniform vec4 zNearFarInvNearFar; +uniform vec4 lightMapParams; +uniform vec2 fadeStartLength; +uniform vec4 overDarkPSSM; +uniform float shadowSoftness; + +//static shadowMap +uniform mat4x4 worldToLightProj; +uniform vec4 scaleX; +uniform vec4 scaleY; +uniform vec4 offsetX; +uniform vec4 offsetY; +uniform vec4 farPlaneScalePSSM; + +//dynamic shadowMap +uniform mat4x4 dynamicWorldToLightProj; +uniform vec4 dynamicScaleX; +uniform vec4 dynamicScaleY; +uniform vec4 dynamicOffsetX; +uniform vec4 dynamicOffsetY; +uniform vec4 dynamicFarPlaneScalePSSM; + +vec4 AL_VectorLightShadowCast( sampler2D _sourceshadowMap, + vec2 _texCoord, + mat4 _worldToLightProj, + vec4 _worldPos, + vec4 _scaleX, vec4 _scaleY, + vec4 _offsetX, vec4 _offsetY, + vec4 _farPlaneScalePSSM, + vec4 _atlasXOffset, vec4 _atlasYOffset, + vec2 _atlasScale, + float _shadowSoftness, + float _dotNL , + vec4 _overDarkPSSM +) +{ + + // Compute shadow map coordinate + vec4 pxlPosLightProj = tMul(_worldToLightProj, _worldPos); + vec2 baseShadowCoord = pxlPosLightProj.xy / pxlPosLightProj.w; + + // Distance to light, in shadowMap space + float distToLight = pxlPosLightProj.z / pxlPosLightProj.w; + + // Figure out which split to sample from. Basically, we compute the shadowMap sample coord + // for all of the splits and then check if its valid. + vec4 shadowCoordX = vec4( baseShadowCoord.x ); + vec4 shadowCoordY = vec4( baseShadowCoord.y ); + vec4 farPlaneDists = vec4( distToLight ); + shadowCoordX *= _scaleX; + shadowCoordY *= _scaleY; + shadowCoordX += _offsetX; + shadowCoordY += _offsetY; + farPlaneDists *= _farPlaneScalePSSM; + + // If the shadow sample is within -1..1 and the distance + // to the light for this pixel is less than the far plane + // of the split, use it. + vec4 finalMask; + if ( shadowCoordX.x > -0.99 && shadowCoordX.x < 0.99 && + shadowCoordY.x > -0.99 && shadowCoordY.x < 0.99 && + farPlaneDists.x < 1.0 ) + finalMask = vec4(1, 0, 0, 0); + + else if ( shadowCoordX.y > -0.99 && shadowCoordX.y < 0.99 && + shadowCoordY.y > -0.99 && shadowCoordY.y < 0.99 && + farPlaneDists.y < 1.0 ) + finalMask = vec4(0, 1, 0, 0); + + else if ( shadowCoordX.z > -0.99 && shadowCoordX.z < 0.99 && + shadowCoordY.z > -0.99 && shadowCoordY.z < 0.99 && + farPlaneDists.z < 1.0 ) + finalMask = vec4(0, 0, 1, 0); + + else + finalMask = vec4(0, 0, 0, 1); + + vec3 debugColor = vec3(0); + + #ifdef NO_SHADOW + debugColor = vec3(1.0); + #endif + + #ifdef PSSM_DEBUG_RENDER + if ( finalMask.x > 0 ) + debugColor += vec3( 1, 0, 0 ); + else if ( finalMask.y > 0 ) + debugColor += vec3( 0, 1, 0 ); + else if ( finalMask.z > 0 ) + debugColor += vec3( 0, 0, 1 ); + else if ( finalMask.w > 0 ) + debugColor += vec3( 1, 1, 0 ); + #endif + + // Here we know what split we're sampling from, so recompute the _texCoord location + // Yes, we could just use the result from above, but doing it this way actually saves + // shader instructions. + vec2 finalScale; + finalScale.x = dot(finalMask, _scaleX); + finalScale.y = dot(finalMask, _scaleY); + + vec2 finalOffset; + finalOffset.x = dot(finalMask, _offsetX); + finalOffset.y = dot(finalMask, _offsetY); + + vec2 shadowCoord; + shadowCoord = baseShadowCoord * finalScale; + shadowCoord += finalOffset; + + // Convert to _texCoord space + shadowCoord = 0.5 * shadowCoord + vec2(0.5, 0.5); + shadowCoord.y = 1.0f - shadowCoord.y; + + // Move around inside of atlas + vec2 aOffset; + aOffset.x = dot(finalMask, _atlasXOffset); + aOffset.y = dot(finalMask, _atlasYOffset); + + shadowCoord *= _atlasScale; + shadowCoord += aOffset; + + // Each split has a different far plane, take this into account. + float farPlaneScale = dot( _farPlaneScalePSSM, finalMask ); + distToLight *= farPlaneScale; + + return vec4(debugColor, + softShadow_filter( _sourceshadowMap, + _texCoord, + shadowCoord, + farPlaneScale * _shadowSoftness, + distToLight, + _dotNL, + dot( finalMask, _overDarkPSSM ) ) ); +} + +out vec4 OUT_col; +void main() +{ + // Emissive. + float4 matInfo = texture( matInfoBuffer, uv0 ); + bool emissive = getFlag( matInfo.r, 0 ); + if ( emissive ) + { + OUT_col = vec4(1.0, 1.0, 1.0, 0.0); + return; + } + + vec4 colorSample = texture( colorBuffer, uv0 ); + vec3 subsurface = vec3(0.0,0.0,0.0); + if (getFlag( matInfo.r, 1 )) + { + subsurface = colorSample.rgb; + if (colorSample.r>colorSample.g) + subsurface = vec3(0.772549, 0.337255, 0.262745); + else + subsurface = vec3(0.337255, 0.772549, 0.262745); + } + + // Sample/unpack the normal/z data + vec4 deferredSample = deferredUncondition( deferredBuffer, uv0 ); + vec3 normal = deferredSample.rgb; + float depth = deferredSample.a; + + // Use eye ray to get ws pos + vec4 worldPos = vec4(eyePosWorld + wsEyeRay * depth, 1.0f); + + // Get the light attenuation. + float dotNL = dot(-lightDirection, normal); + + #ifdef PSSM_DEBUG_RENDER + vec3 debugColor = vec3(0); + #endif + + #ifdef NO_SHADOW + + // Fully unshadowed. + float shadowed = 1.0; + + #ifdef PSSM_DEBUG_RENDER + debugColor = vec3(1.0); + #endif + + #else + + vec4 static_shadowed_colors = AL_VectorLightShadowCast( shadowMap, + uv0.xy, + worldToLightProj, + worldPos, + scaleX, scaleY, + offsetX, offsetY, + farPlaneScalePSSM, + atlasXOffset, atlasYOffset, + atlasScale, + shadowSoftness, + dotNL, + overDarkPSSM); + vec4 dynamic_shadowed_colors = AL_VectorLightShadowCast( dynamicShadowMap, + uv0.xy, + dynamicWorldToLightProj, + worldPos, + dynamicScaleX, dynamicScaleY, + dynamicOffsetX, dynamicOffsetY, + dynamicFarPlaneScalePSSM, + atlasXOffset, atlasYOffset, + atlasScale, + shadowSoftness, + dotNL, + overDarkPSSM); + float static_shadowed = static_shadowed_colors.a; + float dynamic_shadowed = dynamic_shadowed_colors.a; + + #ifdef PSSM_DEBUG_RENDER + debugColor = static_shadowed_colors.rgb*0.5+dynamic_shadowed_colors.rgb*0.5; + #endif + + // Fade out the shadow at the end of the range. + vec4 zDist = vec4(zNearFarInvNearFar.x + zNearFarInvNearFar.y * depth); + float fadeOutAmt = ( zDist.x - fadeStartLength.x ) * fadeStartLength.y; + + static_shadowed = mix( static_shadowed, 1.0, saturate( fadeOutAmt ) ); + dynamic_shadowed = mix( dynamic_shadowed, 1.0, saturate( fadeOutAmt ) ); + + // temp for debugging. uncomment one or the other. + //float shadowed = static_shadowed; + //float shadowed = dynamic_shadowed; + float shadowed = min(static_shadowed, dynamic_shadowed); + + #ifdef PSSM_DEBUG_RENDER + if ( fadeOutAmt > 1.0 ) + debugColor = vec3(1.0); + #endif + + #endif // !NO_SHADOW + + // Specular term + float specular = AL_CalcSpecular( -lightDirection, + normal, + normalize(-vsEyeRay) ) * lightBrightness * shadowed; + + float Sat_NL_Att = saturate( dotNL * shadowed ) * lightBrightness; + vec3 lightColorOut = lightMapParams.rgb * lightColor.rgb; + vec4 addToResult = (lightAmbient * (1 - ambientCameraFactor)) + ( lightAmbient * ambientCameraFactor * saturate(dot(normalize(-vsEyeRay), normal)) ); + + // TODO: This needs to be removed when lightmapping is disabled + // as its extra work per-pixel on dynamic lit scenes. + // + // Special lightmapping pass. + if ( lightMapParams.a < 0.0 ) + { + // This disables shadows on the backsides of objects. + shadowed = dotNL < 0.0f ? 1.0f : shadowed; + + Sat_NL_Att = 1.0f; + lightColorOut = vec3(shadowed); + specular *= lightBrightness; + addToResult = ( 1.0 - shadowed ) * abs(lightMapParams); + } + + // Sample the AO texture. + #ifdef USE_SSAO_MASK + float ao = 1.0 - texture( ssaoMask, viewportCoordToRenderTarget( uv0.xy, rtParams3 ) ).r; + addToResult *= ao; + #endif + + #ifdef PSSM_DEBUG_RENDER + lightColorOut = debugColor; + #endif + + OUT_col = AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/lightingUtils.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/lightingUtils.hlsl new file mode 100644 index 000000000..2bff18999 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/lightingUtils.hlsl @@ -0,0 +1,51 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +float attenuate( float4 lightColor, float2 attParams, float dist ) +{ + // We're summing the results of a scaled constant, + // linear, and quadratic attenuation. + + #ifdef ACCUMULATE_LUV + return lightColor.w * ( 1.0 - dot( attParams, float2( dist, dist * dist ) ) ); + #else + return 1.0 - dot( attParams, float2( dist, dist * dist ) ); + #endif +} + +float3 getDistanceVectorToPlane( float3 origin, float3 direction, float4 plane ) +{ + float denum = dot( plane.xyz, direction.xyz ); + float num = dot( plane, float4( origin, 1.0 ) ); + float t = -num / denum; + + return direction.xyz * t; +} + +float3 getDistanceVectorToPlane( float negFarPlaneDotEye, float3 direction, float4 plane ) +{ + float denum = dot( plane.xyz, direction.xyz ); + float t = negFarPlaneDotEye / denum; + + return direction.xyz * t; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/particlePointLightP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/particlePointLightP.hlsl new file mode 100644 index 000000000..a0156eb85 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/particlePointLightP.hlsl @@ -0,0 +1,76 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "farFrustumQuad.hlsl" +#include "lightingUtils.hlsl" +#include "../../lighting.hlsl" +#include "../../shaderModel.hlsl" +#include "../../shaderModelAutoGen.hlsl" + + +struct ConvexConnectP +{ + float4 pos : TORQUE_POSITION; + float4 ssPos : TEXCOORD0; + float3 vsEyeDir : TEXCOORD1; +}; + +TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0); + +uniform float4 lightPosition; +uniform float4 lightColor; +uniform float lightRange; +uniform float4 vsFarPlane; +uniform float4 rtParams0; + +float4 main( ConvexConnectP IN ) : TORQUE_TARGET0 +{ + // Compute scene UV + float3 ssPos = IN.ssPos.xyz / IN.ssPos.w; + float2 uvScene = getUVFromSSPos(ssPos, rtParams0); + + // Sample/unpack the normal/z data + float4 deferredSample = TORQUE_DEFERRED_UNCONDITION(deferredBuffer, uvScene); + float3 normal = deferredSample.rgb; + float depth = deferredSample.a; + + // Eye ray - Eye -> Pixel + float3 eyeRay = getDistanceVectorToPlane(-vsFarPlane.w, IN.vsEyeDir, vsFarPlane); + float3 viewSpacePos = eyeRay * depth; + + // Build light vec, get length, clip pixel if needed + float3 lightVec = lightPosition.xyz - viewSpacePos; + float lenLightV = length(lightVec); + clip(lightRange - lenLightV); + + // Do a very simple falloff instead of real attenuation + float atten = 1.0 - saturate(lenLightV / lightRange); + + // Normalize lightVec + lightVec /= lenLightV; + + // N.L * Attenuation + float Sat_NL_Att = saturate(dot(lightVec, normal)) * atten; + + // Output, no specular + return lightinfoCondition(lightColor.rgb, Sat_NL_Att, 0.0, 0.0); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/particlePointLightV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/particlePointLightV.hlsl new file mode 100644 index 000000000..faa2ec115 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/particlePointLightV.hlsl @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../hlslStructs.hlsl" +#include "../../shaderModel.hlsl" + +struct ConvexConnectV +{ + float4 hpos : TORQUE_POSITION; + float4 ssPos : TEXCOORD0; + float3 vsEyeDir : TEXCOORD1; +}; + +uniform float4x4 viewProj; +uniform float4x4 view; +uniform float3 particlePosWorld; +uniform float lightRange; + +ConvexConnectV main( VertexIn_P IN ) +{ + ConvexConnectV OUT; + float4 pos = float4(IN.pos, 0.0); + float4 vPosWorld = pos + float4(particlePosWorld, 0.0) + pos * lightRange; + OUT.hpos = mul(viewProj, vPosWorld); + OUT.vsEyeDir = mul(view, vPosWorld); + OUT.ssPos = OUT.hpos; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/pointLightP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/pointLightP.hlsl new file mode 100644 index 000000000..317feb0b3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/pointLightP.hlsl @@ -0,0 +1,277 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModelAutoGen.hlsl" + +#include "farFrustumQuad.hlsl" +#include "lightingUtils.hlsl" +#include "../../lighting.hlsl" +#include "../shadowMap/shadowMapIO_HLSL.h" +#include "softShadow.hlsl" +#include "../../torque.hlsl" + +struct ConvexConnectP +{ + float4 pos : TORQUE_POSITION; + float4 wsEyeDir : TEXCOORD0; + float4 ssPos : TEXCOORD1; + float4 vsEyeDir : TEXCOORD2; +}; + + +#ifdef USE_COOKIE_TEX + +/// The texture for cookie rendering. +TORQUE_UNIFORM_SAMPLERCUBE(cookieMap, 3); + +#endif + + +#ifdef SHADOW_CUBE + + float3 decodeShadowCoord( float3 shadowCoord ) + { + return shadowCoord; + } + + float4 shadowSample( TORQUE_SAMPLERCUBE(shadowMap), float3 shadowCoord ) + { + return TORQUE_TEXCUBE( shadowMap, shadowCoord ); + } + +#else + + float3 decodeShadowCoord( float3 paraVec ) + { + // Flip y and z + paraVec = paraVec.xzy; + + #ifndef SHADOW_PARABOLOID + + bool calcBack = (paraVec.z < 0.0); + if ( calcBack ) + { + paraVec.z = paraVec.z * -1.0; + + #ifdef SHADOW_DUALPARABOLOID + paraVec.x = -paraVec.x; + #endif + } + + #endif + + float3 shadowCoord; + shadowCoord.x = (paraVec.x / (2*(1 + paraVec.z))) + 0.5; + shadowCoord.y = 1-((paraVec.y / (2*(1 + paraVec.z))) + 0.5); + shadowCoord.z = 0; + + // adjust the co-ordinate slightly if it is near the extent of the paraboloid + // this value was found via experementation + // NOTE: this is wrong, it only biases in one direction, not towards the uv + // center ( 0.5 0.5 ). + //shadowCoord.xy *= 0.997; + + #ifndef SHADOW_PARABOLOID + + // If this is the back, offset in the atlas + if ( calcBack ) + shadowCoord.x += 1.0; + + // Atlasing front and back maps, so scale + shadowCoord.x *= 0.5; + + #endif + + return shadowCoord; + } + +#endif + +TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0); + +#ifdef SHADOW_CUBE +TORQUE_UNIFORM_SAMPLERCUBE(shadowMap, 1); +#else +TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1); +TORQUE_UNIFORM_SAMPLER2D(dynamicShadowMap, 2); +#endif + +TORQUE_UNIFORM_SAMPLER2D(lightBuffer, 5); +TORQUE_UNIFORM_SAMPLER2D(colorBuffer, 6); +TORQUE_UNIFORM_SAMPLER2D(matInfoBuffer, 7); + +uniform float4 rtParams0; +uniform float4 lightColor; + +uniform float lightBrightness; +uniform float3 lightPosition; + +uniform float4 lightMapParams; +uniform float4 vsFarPlane; +uniform float4 lightParams; + +uniform float lightRange; +uniform float shadowSoftness; +uniform float2 lightAttenuation; + +uniform float3x3 viewToLightProj; +uniform float3x3 dynamicViewToLightProj; + +float4 main( ConvexConnectP IN ) : TORQUE_TARGET0 +{ + // Compute scene UV + float3 ssPos = IN.ssPos.xyz / IN.ssPos.w; + float2 uvScene = getUVFromSSPos( ssPos, rtParams0 ); + + // Emissive. + float4 matInfo = TORQUE_TEX2D( matInfoBuffer, uvScene ); + bool emissive = getFlag( matInfo.r, 0 ); + if ( emissive ) + { + return float4(0.0, 0.0, 0.0, 0.0); + } + float4 colorSample = TORQUE_TEX2D( colorBuffer, uvScene ); + float3 subsurface = float3(0.0,0.0,0.0); + if (getFlag( matInfo.r, 1 )) + { + subsurface = colorSample.rgb; + if (colorSample.r>colorSample.g) + subsurface = float3(0.772549, 0.337255, 0.262745); + else + subsurface = float3(0.337255, 0.772549, 0.262745); + } + + // Sample/unpack the normal/z data + float4 deferredSample = TORQUE_DEFERRED_UNCONDITION( deferredBuffer, uvScene ); + float3 normal = deferredSample.rgb; + float depth = deferredSample.a; + + // Eye ray - Eye -> Pixel + float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane ); + float3 viewSpacePos = eyeRay * depth; + + // Build light vec, get length, clip pixel if needed + float3 lightVec = lightPosition - viewSpacePos; + float lenLightV = length( lightVec ); + clip( lightRange - lenLightV ); + + // Get the attenuated falloff. + float atten = attenuate( lightColor, lightAttenuation, lenLightV ); + clip( atten - 1e-6 ); + + // Normalize lightVec + lightVec /= lenLightV; + + // If we can do dynamic branching then avoid wasting + // fillrate on pixels that are backfacing to the light. + float nDotL = dot( lightVec, normal ); + //DB_CLIP( nDotL < 0 ); + + #ifdef NO_SHADOW + + float shadowed = 1.0; + + #else + + // Get a linear depth from the light source. + float distToLight = lenLightV / lightRange; + + #ifdef SHADOW_CUBE + + // TODO: We need to fix shadow cube to handle soft shadows! + float occ = TORQUE_TEXCUBE( shadowMap, mul( viewToLightProj, -lightVec ) ).r; + float shadowed = saturate( exp( lightParams.y * ( occ - distToLight ) ) ); + + #else + + // Static + float2 shadowCoord = decodeShadowCoord( mul( viewToLightProj, -lightVec ) ).xy; + float static_shadowed = softShadow_filter( TORQUE_SAMPLER2D_MAKEARG(shadowMap), + ssPos.xy, + shadowCoord, + shadowSoftness, + distToLight, + nDotL, + lightParams.y ); + + // Dynamic + float2 dynamicShadowCoord = decodeShadowCoord( mul( dynamicViewToLightProj, -lightVec ) ).xy; + float dynamic_shadowed = softShadow_filter( TORQUE_SAMPLER2D_MAKEARG(dynamicShadowMap), + ssPos.xy, + dynamicShadowCoord, + shadowSoftness, + distToLight, + nDotL, + lightParams.y ); + + float shadowed = min(static_shadowed, dynamic_shadowed); + + #endif + + #endif // !NO_SHADOW + + float3 lightcol = lightColor.rgb; + #ifdef USE_COOKIE_TEX + + // Lookup the cookie sample. + float4 cookie = TORQUE_TEXCUBE( cookieMap, mul( viewToLightProj, -lightVec ) ); + + // Multiply the light with the cookie tex. + lightcol *= cookie.rgb; + + // Use a maximum channel luminance to attenuate + // the lighting else we get specular in the dark + // regions of the cookie texture. + atten *= max( cookie.r, max( cookie.g, cookie.b ) ); + + #endif + + // NOTE: Do not clip on fully shadowed pixels as it would + // cause the hardware occlusion query to disable the shadow. + + // Specular term + float specular = AL_CalcSpecular( lightVec, + normal, + normalize( -eyeRay ) ) * lightBrightness * atten * shadowed; + + float Sat_NL_Att = saturate( nDotL * atten * shadowed ) * lightBrightness; + float3 lightColorOut = lightMapParams.rgb * lightcol; + float4 addToResult = 0.0; + + // TODO: This needs to be removed when lightmapping is disabled + // as its extra work per-pixel on dynamic lit scenes. + // + // Special lightmapping pass. + if ( lightMapParams.a < 0.0 ) + { + // This disables shadows on the backsides of objects. + shadowed = nDotL < 0.0f ? 1.0f : shadowed; + + Sat_NL_Att = 1.0f; + shadowed = lerp( 1.0f, shadowed, atten ); + lightColorOut = shadowed; + specular *= lightBrightness; + addToResult = ( 1.0 - shadowed ) * abs(lightMapParams); + } + + return AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/softShadow.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/softShadow.hlsl new file mode 100644 index 000000000..0faf3e1fb --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/softShadow.hlsl @@ -0,0 +1,158 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModel.hlsl" + +#if defined( SOFTSHADOW ) && defined( SOFTSHADOW_HIGH_QUALITY ) + +#define NUM_PRE_TAPS 4 +#define NUM_TAPS 12 + +/// The non-uniform poisson disk used in the +/// high quality shadow filtering. +static float2 sNonUniformTaps[NUM_TAPS] = +{ + // These first 4 taps are located around the edges + // of the disk and are used to predict fully shadowed + // or unshadowed areas. + { 0.992833, 0.979309 }, + { -0.998585, 0.985853 }, + { 0.949299, -0.882562 }, + { -0.941358, -0.893924 }, + + // The rest of the samples. + { 0.545055, -0.589072 }, + { 0.346526, 0.385821 }, + { -0.260183, 0.334412 }, + { 0.248676, -0.679605 }, + { -0.569502, -0.390637 }, + { -0.614096, 0.212577 }, + { -0.259178, 0.876272 }, + { 0.649526, 0.864333 }, +}; + +#else + +#define NUM_PRE_TAPS 5 + +/// The non-uniform poisson disk used in the +/// high quality shadow filtering. +static float2 sNonUniformTaps[NUM_PRE_TAPS] = +{ + { 0.892833, 0.959309 }, + { -0.941358, -0.873924 }, + { -0.260183, 0.334412 }, + { 0.348676, -0.679605 }, + { -0.569502, -0.390637 }, +}; + +#endif + + +/// The texture used to do per-pixel pseudorandom +/// rotations of the filter taps. +TORQUE_UNIFORM_SAMPLER2D(gTapRotationTex, 4); + +float softShadow_sampleTaps( TORQUE_SAMPLER2D(shadowMap1), + float2 sinCos, + float2 shadowPos, + float filterRadius, + float distToLight, + float esmFactor, + int startTap, + int endTap ) +{ + float shadow = 0; + + float2 tap = 0; + for ( int t = startTap; t < endTap; t++ ) + { + tap.x = ( sNonUniformTaps[t].x * sinCos.y - sNonUniformTaps[t].y * sinCos.x ) * filterRadius; + tap.y = ( sNonUniformTaps[t].y * sinCos.y + sNonUniformTaps[t].x * sinCos.x ) * filterRadius; + float occluder = TORQUE_TEX2DLOD( shadowMap1, float4( shadowPos + tap, 0, 0 ) ).r; + + float esm = saturate( exp( esmFactor * ( occluder - distToLight ) ) ); + shadow += esm / float( endTap - startTap ); + } + + return shadow; +} + + +float softShadow_filter( TORQUE_SAMPLER2D(shadowMap), + float2 vpos, + float2 shadowPos, + float filterRadius, + float distToLight, + float dotNL, + float esmFactor ) +{ + #ifndef SOFTSHADOW + + // If softshadow is undefined then we skip any complex + // filtering... just do a single sample ESM. + + float occluder = TORQUE_TEX2DLOD(shadowMap, float4(shadowPos, 0, 0)).r; + float shadow = saturate( exp( esmFactor * ( occluder - distToLight ) ) ); + + #else + // Lookup the random rotation for this screen pixel. + float2 sinCos = ( TORQUE_TEX2DLOD(gTapRotationTex, float4(vpos * 16, 0, 0)).rg - 0.5) * 2; + + // Do the prediction taps first. + float shadow = softShadow_sampleTaps( TORQUE_SAMPLER2D_MAKEARG(shadowMap), + sinCos, + shadowPos, + filterRadius, + distToLight, + esmFactor, + 0, + NUM_PRE_TAPS ); + + // We live with only the pretap results if we don't + // have high quality shadow filtering enabled. + #ifdef SOFTSHADOW_HIGH_QUALITY + + // Only do the expensive filtering if we're really + // in a partially shadowed area. + if ( shadow * ( 1.0 - shadow ) * max( dotNL, 0 ) > 0.06 ) + { + shadow += softShadow_sampleTaps( TORQUE_SAMPLER2D_MAKEARG(shadowMap), + sinCos, + shadowPos, + filterRadius, + distToLight, + esmFactor, + NUM_PRE_TAPS, + NUM_TAPS ); + + // This averages the taps above with the results + // of the prediction samples. + shadow *= 0.5; + } + + #endif // SOFTSHADOW_HIGH_QUALITY + + #endif // SOFTSHADOW + + return shadow; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/spotLightP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/spotLightP.hlsl new file mode 100644 index 000000000..196286dc2 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/spotLightP.hlsl @@ -0,0 +1,209 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModel.hlsl" +#include "../../shaderModelAutoGen.hlsl" + +#include "farFrustumQuad.hlsl" +#include "lightingUtils.hlsl" +#include "../../lighting.hlsl" +#include "../shadowMap/shadowMapIO_HLSL.h" +#include "softShadow.hlsl" +#include "../../torque.hlsl" + +struct ConvexConnectP +{ + float4 pos : TORQUE_POSITION; + float4 wsEyeDir : TEXCOORD0; + float4 ssPos : TEXCOORD1; + float4 vsEyeDir : TEXCOORD2; +}; + +TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0); +TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1); +TORQUE_UNIFORM_SAMPLER2D(dynamicShadowMap,2); + +#ifdef USE_COOKIE_TEX + +/// The texture for cookie rendering. +TORQUE_UNIFORM_SAMPLER2D(cookieMap, 3); + +#endif + +TORQUE_UNIFORM_SAMPLER2D(lightBuffer, 5); +TORQUE_UNIFORM_SAMPLER2D(colorBuffer, 6); +TORQUE_UNIFORM_SAMPLER2D(matInfoBuffer, 7); + +uniform float4 rtParams0; + +uniform float lightBrightness; +uniform float3 lightPosition; + +uniform float4 lightColor; + +uniform float lightRange; +uniform float3 lightDirection; + +uniform float4 lightSpotParams; +uniform float4 lightMapParams; +uniform float4 vsFarPlane; +uniform float4x4 viewToLightProj; +uniform float4 lightParams; +uniform float4x4 dynamicViewToLightProj; + +uniform float2 lightAttenuation; +uniform float shadowSoftness; + +float4 main( ConvexConnectP IN ) : TORQUE_TARGET0 +{ + // Compute scene UV + float3 ssPos = IN.ssPos.xyz / IN.ssPos.w; + float2 uvScene = getUVFromSSPos( ssPos, rtParams0 ); + + // Emissive. + float4 matInfo = TORQUE_TEX2D( matInfoBuffer, uvScene ); + bool emissive = getFlag( matInfo.r, 0 ); + if ( emissive ) + { + return float4(0.0, 0.0, 0.0, 0.0); + } + + float4 colorSample = TORQUE_TEX2D( colorBuffer, uvScene ); + float3 subsurface = float3(0.0,0.0,0.0); + if (getFlag( matInfo.r, 1 )) + { + subsurface = colorSample.rgb; + if (colorSample.r>colorSample.g) + subsurface = float3(0.772549, 0.337255, 0.262745); + else + subsurface = float3(0.337255, 0.772549, 0.262745); + } + + // Sample/unpack the normal/z data + float4 deferredSample = TORQUE_DEFERRED_UNCONDITION( deferredBuffer, uvScene ); + float3 normal = deferredSample.rgb; + float depth = deferredSample.a; + + // Eye ray - Eye -> Pixel + float3 eyeRay = getDistanceVectorToPlane( -vsFarPlane.w, IN.vsEyeDir.xyz, vsFarPlane ); + float3 viewSpacePos = eyeRay * depth; + + // Build light vec, get length, clip pixel if needed + float3 lightToPxlVec = viewSpacePos - lightPosition; + float lenLightV = length( lightToPxlVec ); + lightToPxlVec /= lenLightV; + + //lightDirection = float3( -lightDirection.xy, lightDirection.z ); //float3( 0, 0, -1 ); + float cosAlpha = dot( lightDirection, lightToPxlVec ); + clip( cosAlpha - lightSpotParams.x ); + clip( lightRange - lenLightV ); + + float atten = attenuate( lightColor, lightAttenuation, lenLightV ); + atten *= ( cosAlpha - lightSpotParams.x ) / lightSpotParams.y; + clip( atten - 1e-6 ); + atten = saturate( atten ); + + float nDotL = dot( normal, -lightToPxlVec ); + + // Get the shadow texture coordinate + float4 pxlPosLightProj = mul( viewToLightProj, float4( viewSpacePos, 1 ) ); + float2 shadowCoord = ( ( pxlPosLightProj.xy / pxlPosLightProj.w ) * 0.5 ) + float2( 0.5, 0.5 ); + shadowCoord.y = 1.0f - shadowCoord.y; + + // Get the dynamic shadow texture coordinate + float4 dynpxlPosLightProj = mul( dynamicViewToLightProj, float4( viewSpacePos, 1 ) ); + float2 dynshadowCoord = ( ( dynpxlPosLightProj.xy / dynpxlPosLightProj.w ) * 0.5 ) + float2( 0.5, 0.5 ); + dynshadowCoord.y = 1.0f - dynshadowCoord.y; + + #ifdef NO_SHADOW + + float shadowed = 1.0; + + #else + + // Get a linear depth from the light source. + float distToLight = pxlPosLightProj.z / lightRange; + + float static_shadowed = softShadow_filter( TORQUE_SAMPLER2D_MAKEARG(shadowMap), + ssPos.xy, + shadowCoord, + shadowSoftness, + distToLight, + nDotL, + lightParams.y ); + + float dynamic_shadowed = softShadow_filter( TORQUE_SAMPLER2D_MAKEARG(dynamicShadowMap), + ssPos.xy, + dynshadowCoord, + shadowSoftness, + distToLight, + nDotL, + lightParams.y ); + float shadowed = min(static_shadowed, dynamic_shadowed); + #endif // !NO_SHADOW + + float3 lightcol = lightColor.rgb; + #ifdef USE_COOKIE_TEX + + // Lookup the cookie sample. + float4 cookie = TORQUE_TEX2D( cookieMap, shadowCoord ); + + // Multiply the light with the cookie tex. + lightcol *= cookie.rgb; + + // Use a maximum channel luminance to attenuate + // the lighting else we get specular in the dark + // regions of the cookie texture. + atten *= max( cookie.r, max( cookie.g, cookie.b ) ); + + #endif + + // NOTE: Do not clip on fully shadowed pixels as it would + // cause the hardware occlusion query to disable the shadow. + + // Specular term + float specular = AL_CalcSpecular( -lightToPxlVec, + normal, + normalize( -eyeRay ) ) * lightBrightness * atten * shadowed; + + float Sat_NL_Att = saturate( nDotL * atten * shadowed ) * lightBrightness; + float3 lightColorOut = lightMapParams.rgb * lightcol; + float4 addToResult = 0.0; + + // TODO: This needs to be removed when lightmapping is disabled + // as its extra work per-pixel on dynamic lit scenes. + // + // Special lightmapping pass. + if ( lightMapParams.a < 0.0 ) + { + // This disables shadows on the backsides of objects. + shadowed = nDotL < 0.0f ? 1.0f : shadowed; + + Sat_NL_Att = 1.0f; + shadowed = lerp( 1.0f, shadowed, atten ); + lightColorOut = shadowed; + specular *= lightBrightness; + addToResult = ( 1.0 - shadowed ) * abs(lightMapParams); + } + + return AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/vectorLightP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/vectorLightP.hlsl new file mode 100644 index 000000000..c5efde242 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/advanced/vectorLightP.hlsl @@ -0,0 +1,328 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModel.hlsl" +#include "../../shaderModelAutoGen.hlsl" + +#include "farFrustumQuad.hlsl" +#include "../../torque.hlsl" +#include "../../lighting.hlsl" +#include "lightingUtils.hlsl" +#include "../shadowMap/shadowMapIO_HLSL.h" +#include "softShadow.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(deferredBuffer, 0); +TORQUE_UNIFORM_SAMPLER2D(shadowMap, 1); +TORQUE_UNIFORM_SAMPLER2D(dynamicShadowMap, 2); + +#ifdef USE_SSAO_MASK +TORQUE_UNIFORM_SAMPLER2D(ssaoMask, 3); +uniform float4 rtParams3; +#endif +//register 4? +TORQUE_UNIFORM_SAMPLER2D(lightBuffer, 5); +TORQUE_UNIFORM_SAMPLER2D(colorBuffer, 6); +TORQUE_UNIFORM_SAMPLER2D(matInfoBuffer, 7); + +uniform float lightBrightness; +uniform float3 lightDirection; + +uniform float4 lightColor; +uniform float4 lightAmbient; + +uniform float shadowSoftness; +uniform float3 eyePosWorld; + +uniform float4 atlasXOffset; +uniform float4 atlasYOffset; +uniform float4 zNearFarInvNearFar; +uniform float4 lightMapParams; +uniform float4 farPlaneScalePSSM; +uniform float4 overDarkPSSM; + +uniform float2 fadeStartLength; +uniform float2 atlasScale; + +uniform float4x4 eyeMat; + +// Static Shadows +uniform float4x4 worldToLightProj; +uniform float4 scaleX; +uniform float4 scaleY; +uniform float4 offsetX; +uniform float4 offsetY; +// Dynamic Shadows +uniform float4x4 dynamicWorldToLightProj; +uniform float4 dynamicScaleX; +uniform float4 dynamicScaleY; +uniform float4 dynamicOffsetX; +uniform float4 dynamicOffsetY; +uniform float4 dynamicFarPlaneScalePSSM; + +float4 AL_VectorLightShadowCast( TORQUE_SAMPLER2D(sourceShadowMap), + float2 texCoord, + float4x4 worldToLightProj, + float4 worldPos, + float4 scaleX, + float4 scaleY, + float4 offsetX, + float4 offsetY, + float4 farPlaneScalePSSM, + float4 atlasXOffset, + float4 atlasYOffset, + float2 atlasScale, + float shadowSoftness, + float dotNL , + float4 overDarkPSSM) +{ + // Compute shadow map coordinate + float4 pxlPosLightProj = mul(worldToLightProj, worldPos); + float2 baseShadowCoord = pxlPosLightProj.xy / pxlPosLightProj.w; + + // Distance to light, in shadowmap space + float distToLight = pxlPosLightProj.z / pxlPosLightProj.w; + + // Figure out which split to sample from. Basically, we compute the shadowmap sample coord + // for all of the splits and then check if its valid. + float4 shadowCoordX = baseShadowCoord.xxxx; + float4 shadowCoordY = baseShadowCoord.yyyy; + float4 farPlaneDists = distToLight.xxxx; + shadowCoordX *= scaleX; + shadowCoordY *= scaleY; + shadowCoordX += offsetX; + shadowCoordY += offsetY; + farPlaneDists *= farPlaneScalePSSM; + + // If the shadow sample is within -1..1 and the distance + // to the light for this pixel is less than the far plane + // of the split, use it. + float4 finalMask; + if ( shadowCoordX.x > -0.99 && shadowCoordX.x < 0.99 && + shadowCoordY.x > -0.99 && shadowCoordY.x < 0.99 && + farPlaneDists.x < 1.0 ) + finalMask = float4(1, 0, 0, 0); + + else if ( shadowCoordX.y > -0.99 && shadowCoordX.y < 0.99 && + shadowCoordY.y > -0.99 && shadowCoordY.y < 0.99 && + farPlaneDists.y < 1.0 ) + finalMask = float4(0, 1, 0, 0); + + else if ( shadowCoordX.z > -0.99 && shadowCoordX.z < 0.99 && + shadowCoordY.z > -0.99 && shadowCoordY.z < 0.99 && + farPlaneDists.z < 1.0 ) + finalMask = float4(0, 0, 1, 0); + + else + finalMask = float4(0, 0, 0, 1); + + float3 debugColor = float3(0,0,0); + + #ifdef NO_SHADOW + debugColor = float3(1.0,1.0,1.0); + #endif + + #ifdef PSSM_DEBUG_RENDER + if ( finalMask.x > 0 ) + debugColor += float3( 1, 0, 0 ); + else if ( finalMask.y > 0 ) + debugColor += float3( 0, 1, 0 ); + else if ( finalMask.z > 0 ) + debugColor += float3( 0, 0, 1 ); + else if ( finalMask.w > 0 ) + debugColor += float3( 1, 1, 0 ); + #endif + + // Here we know what split we're sampling from, so recompute the texcoord location + // Yes, we could just use the result from above, but doing it this way actually saves + // shader instructions. + float2 finalScale; + finalScale.x = dot(finalMask, scaleX); + finalScale.y = dot(finalMask, scaleY); + + float2 finalOffset; + finalOffset.x = dot(finalMask, offsetX); + finalOffset.y = dot(finalMask, offsetY); + + float2 shadowCoord; + shadowCoord = baseShadowCoord * finalScale; + shadowCoord += finalOffset; + + // Convert to texcoord space + shadowCoord = 0.5 * shadowCoord + float2(0.5, 0.5); + shadowCoord.y = 1.0f - shadowCoord.y; + + // Move around inside of atlas + float2 aOffset; + aOffset.x = dot(finalMask, atlasXOffset); + aOffset.y = dot(finalMask, atlasYOffset); + + shadowCoord *= atlasScale; + shadowCoord += aOffset; + + // Each split has a different far plane, take this into account. + float farPlaneScale = dot( farPlaneScalePSSM, finalMask ); + distToLight *= farPlaneScale; + + return float4(debugColor, + softShadow_filter( TORQUE_SAMPLER2D_MAKEARG(sourceShadowMap), + texCoord, + shadowCoord, + farPlaneScale * shadowSoftness, + distToLight, + dotNL, + dot( finalMask, overDarkPSSM ) ) ); +}; + +float4 main( FarFrustumQuadConnectP IN ) : TORQUE_TARGET0 +{ + // Emissive. + float4 matInfo = TORQUE_TEX2D( matInfoBuffer, IN.uv0 ); + bool emissive = getFlag( matInfo.r, 0 ); + if ( emissive ) + { + return float4(1.0, 1.0, 1.0, 0.0); + } + + float4 colorSample = TORQUE_TEX2D( colorBuffer, IN.uv0 ); + float3 subsurface = float3(0.0,0.0,0.0); + if (getFlag( matInfo.r, 1 )) + { + subsurface = colorSample.rgb; + if (colorSample.r>colorSample.g) + subsurface = float3(0.772549, 0.337255, 0.262745); + else + subsurface = float3(0.337255, 0.772549, 0.262745); + } + // Sample/unpack the normal/z data + float4 deferredSample = TORQUE_DEFERRED_UNCONDITION( deferredBuffer, IN.uv0 ); + float3 normal = deferredSample.rgb; + float depth = deferredSample.a; + + // Use eye ray to get ws pos + float4 worldPos = float4(eyePosWorld + IN.wsEyeRay * depth, 1.0f); + + // Get the light attenuation. + float dotNL = dot(-lightDirection, normal); + + #ifdef PSSM_DEBUG_RENDER + float3 debugColor = float3(0,0,0); + #endif + + #ifdef NO_SHADOW + + // Fully unshadowed. + float shadowed = 1.0; + + #ifdef PSSM_DEBUG_RENDER + debugColor = float3(1.0,1.0,1.0); + #endif + + #else + + float4 static_shadowed_colors = AL_VectorLightShadowCast( TORQUE_SAMPLER2D_MAKEARG(shadowMap), + IN.uv0.xy, + worldToLightProj, + worldPos, + scaleX, scaleY, + offsetX, offsetY, + farPlaneScalePSSM, + atlasXOffset, atlasYOffset, + atlasScale, + shadowSoftness, + dotNL, + overDarkPSSM); + float4 dynamic_shadowed_colors = AL_VectorLightShadowCast( TORQUE_SAMPLER2D_MAKEARG(dynamicShadowMap), + IN.uv0.xy, + dynamicWorldToLightProj, + worldPos, + dynamicScaleX, dynamicScaleY, + dynamicOffsetX, dynamicOffsetY, + dynamicFarPlaneScalePSSM, + atlasXOffset, atlasYOffset, + atlasScale, + shadowSoftness, + dotNL, + overDarkPSSM); + + float static_shadowed = static_shadowed_colors.a; + float dynamic_shadowed = dynamic_shadowed_colors.a; + + #ifdef PSSM_DEBUG_RENDER + debugColor = static_shadowed_colors.rgb*0.5+dynamic_shadowed_colors.rgb*0.5; + #endif + + // Fade out the shadow at the end of the range. + float4 zDist = (zNearFarInvNearFar.x + zNearFarInvNearFar.y * depth); + float fadeOutAmt = ( zDist.x - fadeStartLength.x ) * fadeStartLength.y; + + static_shadowed = lerp( static_shadowed, 1.0, saturate( fadeOutAmt ) ); + dynamic_shadowed = lerp( dynamic_shadowed, 1.0, saturate( fadeOutAmt ) ); + + // temp for debugging. uncomment one or the other. + //float shadowed = static_shadowed; + //float shadowed = dynamic_shadowed; + float shadowed = min(static_shadowed, dynamic_shadowed); + + #ifdef PSSM_DEBUG_RENDER + if ( fadeOutAmt > 1.0 ) + debugColor = 1.0; + #endif + + #endif // !NO_SHADOW + + // Specular term + float specular = AL_CalcSpecular( -lightDirection, + normal, + normalize(-IN.vsEyeRay) ) * lightBrightness * shadowed; + + float Sat_NL_Att = saturate( dotNL * shadowed ) * lightBrightness; + float3 lightColorOut = lightMapParams.rgb * lightColor.rgb; + + float4 addToResult = (lightAmbient * (1 - ambientCameraFactor)) + ( lightAmbient * ambientCameraFactor * saturate(dot(normalize(-IN.vsEyeRay), normal)) ); + + // TODO: This needs to be removed when lightmapping is disabled + // as its extra work per-pixel on dynamic lit scenes. + // + // Special lightmapping pass. + if ( lightMapParams.a < 0.0 ) + { + // This disables shadows on the backsides of objects. + shadowed = dotNL < 0.0f ? 1.0f : shadowed; + + Sat_NL_Att = 1.0f; + lightColorOut = shadowed; + specular *= lightBrightness; + addToResult = ( 1.0 - shadowed ) * abs(lightMapParams); + } + + // Sample the AO texture. + #ifdef USE_SSAO_MASK + float ao = 1.0 - TORQUE_TEX2D( ssaoMask, viewportCoordToRenderTarget( IN.uv0.xy, rtParams3 ) ).r; + addToResult *= ao; + #endif + + #ifdef PSSM_DEBUG_RENDER + lightColorOut = debugColor; + #endif + + return AL_DeferredOutput(lightColorOut+subsurface*(1.0-Sat_NL_Att), colorSample.rgb, matInfo, addToResult, specular, Sat_NL_Att); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/gl/shadowFilterP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/gl/shadowFilterP.glsl new file mode 100644 index 000000000..9b510e0cf --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/gl/shadowFilterP.glsl @@ -0,0 +1,46 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" + +uniform sampler2D diffuseMap; + +in vec2 uv; + +uniform vec2 oneOverTargetSize; + +const float offset[3] = float[]( 0.0, 1.3846153846, 3.2307692308 ); +const float weight[3] = float[]( 0.2270270270, 0.3162162162, 0.0702702703 ); + +out vec4 OUT_col; + +void main() +{ + OUT_col = texture( diffuseMap, uv ) * weight[0]; + + for ( int i=1; i < 3; i++ ) + { + vec2 _sample = (BLUR_DIR * offset[i]) * oneOverTargetSize; + OUT_col += texture( diffuseMap, uv + _sample ) * weight[i]; + OUT_col += texture( diffuseMap, uv - _sample ) * weight[i]; + } +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/gl/shadowFilterV.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/gl/shadowFilterV.glsl new file mode 100644 index 000000000..67b5f1378 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/gl/shadowFilterV.glsl @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/torque.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; + +uniform vec4 rtParams0; + +out vec2 uv; + +void main() +{ + gl_Position = vPosition; + uv = viewportCoordToRenderTarget( vTexCoord0.st, rtParams0 ); + gl_Position.y *= -1; //correct ssp +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/shadowFilterP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/shadowFilterP.hlsl new file mode 100644 index 000000000..cf819eed3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/shadowFilterP.hlsl @@ -0,0 +1,50 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../postFx/postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + float2 uv : TEXCOORD0; +}; + +static float offset[3] = { 0.0, 1.3846153846, 3.2307692308 }; +static float weight[3] = { 0.2270270270, 0.3162162162, 0.0702702703 }; + +uniform float2 oneOverTargetSize; + +float4 main( VertToPix IN ) : TORQUE_TARGET0 +{ + float4 OUT = TORQUE_TEX2D( diffuseMap, IN.uv ) * weight[0]; + + for ( int i=1; i < 3; i++ ) + { + float2 sample = (BLUR_DIR * offset[i]) * oneOverTargetSize; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv + sample ) * weight[i]; + OUT += TORQUE_TEX2D(diffuseMap, IN.uv - sample) * weight[i]; + } + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/shadowFilterV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/shadowFilterV.hlsl new file mode 100644 index 000000000..d0838016b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/basic/shadowFilterV.hlsl @@ -0,0 +1,42 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../postFx/postFx.hlsl" +#include "../../torque.hlsl" + +float4 rtParams0; + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + float2 uv : TEXCOORD0; +}; + +VertToPix main( PFXVert IN ) +{ + VertToPix OUT; + + OUT.hpos = float4(IN.pos,1.0); + OUT.uv = viewportCoordToRenderTarget( IN.uv, rtParams0 ); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/boxFilterP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/boxFilterP.hlsl new file mode 100644 index 000000000..a187c3c63 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/boxFilterP.hlsl @@ -0,0 +1,82 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//***************************************************************************** +// Box Filter +//***************************************************************************** +#include "../ShaderModel.hlsl" + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 tex0 : TEXCOORD0; +}; + +// If not defined from ShaderData then define +// the default blur kernel size here. +//#ifndef blurSamples +// #define blurSamples 4 +//#endif + +float log_conv ( float x0, float X, float y0, float Y ) +{ + return (X + log(x0 + (y0 * exp(Y - X)))); +} + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap0, 0); +uniform float texSize : register(C0); +uniform float2 blurDimension : register(C2); +uniform float2 blurBoundaries : register(C3); + +float4 main( ConnectData IN ) : TORQUE_TARGET0 +{ + // 5x5 + if (IN.tex0.x <= blurBoundaries.x) + { + float texelSize = 1.2f / texSize; + float2 sampleOffset = texelSize * blurDimension; + //float2 offset = 0.5 * float( blurSamples ) * sampleOffset; + + float2 texCoord = IN.tex0; + + float accum = log_conv(0.3125, TORQUE_TEX2D(diffuseMap0, texCoord - sampleOffset), 0.375, tex2D(diffuseMap0, texCoord)); + accum = log_conv(1, accum, 0.3125, TORQUE_TEX2D(diffuseMap0, texCoord + sampleOffset)); + + return accum; + } else { + // 3x3 + if (IN.tex0.x <= blurBoundaries.y) + { + float texelSize = 1.3f / texSize; + float2 sampleOffset = texelSize * blurDimension; + //float2 offset = 0.5 * float( blurSamples ) * sampleOffset; + + float2 texCoord = IN.tex0; + float accum = log_conv(0.5, tex2D(diffuseMap0, texCoord - sampleOffset), 0.5, tex2D(diffuseMap0, texCoord + sampleOffset)); + + return accum; + } else { + return TORQUE_TEX2D(diffuseMap0, IN.tex0); + } + } +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/boxFilterV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/boxFilterV.hlsl new file mode 100644 index 000000000..3679e41bb --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/boxFilterV.hlsl @@ -0,0 +1,57 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//***************************************************************************** +// Box Filter +//***************************************************************************** +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- + +#include "../ShaderModel.hlsl" + +struct VertData +{ + float3 position : POSITION; + float2 texCoord : TEXCOORD0; +}; + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 tex0 : TEXCOORD0; +}; + + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +ConnectData main( VertData IN, + uniform float4x4 modelview : register(C0)) +{ + ConnectData OUT; + + OUT.hpos = mul(modelview, float4(IN.position,1.0)); + OUT.tex0 = IN.texCoord; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/gl/boxFilterP.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/gl/boxFilterP.glsl new file mode 100644 index 000000000..d4e05132b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/gl/boxFilterP.glsl @@ -0,0 +1,49 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define blurSamples 4.0 + +uniform sampler2D diffuseMap0; +uniform float texSize; +uniform vec2 blurDimension; + +in vec2 tex0; + +out vec4 OUT_col; + +void main() +{ + // Preshader + float TexelSize = 1.0 / texSize; + vec2 SampleOffset = TexelSize * blurDimension; + vec2 Offset = 0.5 * float(blurSamples - 1.0) * SampleOffset; + + vec2 BaseTexCoord = tex0 - Offset; + + vec4 accum = vec4(0.0, 0.0, 0.0, 0.0); + for(int i = 0; i < int(blurSamples); i++) + { + accum += texture(diffuseMap0, BaseTexCoord + float(i) * SampleOffset); + } + accum /= blurSamples; + OUT_col = accum; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/gl/boxFilterV.glsl b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/gl/boxFilterV.glsl new file mode 100644 index 000000000..9fc436f6c --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/gl/boxFilterV.glsl @@ -0,0 +1,34 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +in vec4 vPosition; +in vec2 vTexCoord0; + +uniform mat4 modelview; + +out vec2 tex0; + +void main() +{ + gl_Position = modelview * vPosition; + tex0 = vTexCoord0.st; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/shadowMapIO.h b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/shadowMapIO.h new file mode 100644 index 000000000..84ef6b6a8 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/shadowMapIO.h @@ -0,0 +1,50 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//#define SM_Fmt_R8G8B8A8 + +#define pkDepthBitShft 65536.0 +#define pkDepthChanMax 256.0 +#define bias -0.5/255.0 +#define coeff 0.9999991 +//#define coeff 1.0 + +float4 encodeShadowMap( float depth ) +{ +#if defined(SM_Fmt_R8G8B8A8) + return frac( float4(1.0, 255.0, 65025.0, 160581375.0) * depth ) + bias; + + //float4 packedValue = frac((depth / coeff) * float4(16777216.0, 65536.0, 256.0, 1.0)); + //return (packedValue - packedValue.xxyz * float4(0, 1.0 / 256, 1.0 / 256, 1.0 / 256)); +#else + return depth; +#endif +} + +float decodeShadowMap( float4 smSample ) +{ +#if defined(SM_Fmt_R8G8B8A8) + return dot( smSample, float4(1.0, 1/255.0, 1/65025.0, 1/160581375.0) ); +#else + return smSample.x; +#endif +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/shadowMapIO_GLSL.h b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/shadowMapIO_GLSL.h new file mode 100644 index 000000000..10d69b834 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/shadowMapIO_GLSL.h @@ -0,0 +1,50 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//#define SM_Fmt_R8G8B8A8 + +#define pkDepthBitShft 65536.0 +#define pkDepthChanMax 256.0 +#define bias -0.5/255.0 +#define coeff 0.9999991 +//#define coeff 1.0 + +vec4 encodeShadowMap( float depth ) +{ +#if defined(SM_Fmt_R8G8B8A8) + return frac( vec4(1.0, 255.0, 65025.0, 160581375.0) * depth ) + vec4(bias); + + //float4 packedValue = frac((depth / coeff) * float4(16777216.0, 65536.0, 256.0, 1.0)); + //return (packedValue - packedValue.xxyz * float4(0, 1.0 / 256, 1.0 / 256, 1.0 / 256)); +#else + return vec4(depth); +#endif +} + +float decodeShadowMap( vec4 smSample ) +{ +#if defined(SM_Fmt_R8G8B8A8) + return dot( smSample, vec4(1.0, 1/255.0, 1/65025.0, 1/160581375.0) ); +#else + return smSample.x; +#endif +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/shadowMapIO_HLSL.h b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/shadowMapIO_HLSL.h new file mode 100644 index 000000000..84ef6b6a8 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/lighting/shadowMap/shadowMapIO_HLSL.h @@ -0,0 +1,50 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//#define SM_Fmt_R8G8B8A8 + +#define pkDepthBitShft 65536.0 +#define pkDepthChanMax 256.0 +#define bias -0.5/255.0 +#define coeff 0.9999991 +//#define coeff 1.0 + +float4 encodeShadowMap( float depth ) +{ +#if defined(SM_Fmt_R8G8B8A8) + return frac( float4(1.0, 255.0, 65025.0, 160581375.0) * depth ) + bias; + + //float4 packedValue = frac((depth / coeff) * float4(16777216.0, 65536.0, 256.0, 1.0)); + //return (packedValue - packedValue.xxyz * float4(0, 1.0 / 256, 1.0 / 256, 1.0 / 256)); +#else + return depth; +#endif +} + +float decodeShadowMap( float4 smSample ) +{ +#if defined(SM_Fmt_R8G8B8A8) + return dot( smSample, float4(1.0, 1/255.0, 1/65025.0, 1/160581375.0) ); +#else + return smSample.x; +#endif +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/particleCompositeP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/particleCompositeP.hlsl new file mode 100644 index 000000000..6e26ddbdb --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/particleCompositeP.hlsl @@ -0,0 +1,61 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "torque.hlsl" +#include "shaderModel.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(colorSource, 0); +uniform float4 offscreenTargetParams; + +#ifdef TORQUE_LINEAR_DEPTH +#define REJECT_EDGES +TORQUE_UNIFORM_SAMPLER2D(edgeSource, 1); +uniform float4 edgeTargetParams; +#endif + +struct Conn +{ + float4 hpos : TORQUE_POSITION; + float4 offscreenPos : TEXCOORD0; + float4 backbufferPos : TEXCOORD1; +}; + + +float4 main(Conn IN) : TORQUE_TARGET0 +{ + // Off-screen particle source screenspace position in XY + // Back-buffer screenspace position in ZW + float4 ssPos = float4(IN.offscreenPos.xy / IN.offscreenPos.w, IN.backbufferPos.xy / IN.backbufferPos.w); + + float4 uvScene = ( ssPos + 1.0 ) / 2.0; + uvScene.yw = 1.0 - uvScene.yw; + uvScene.xy = viewportCoordToRenderTarget(uvScene.xy, offscreenTargetParams); + +#ifdef REJECT_EDGES + // Cut out particles along the edges, this will create the stencil mask + uvScene.zw = viewportCoordToRenderTarget(uvScene.zw, edgeTargetParams); + float edge = TORQUE_TEX2D( edgeSource, uvScene.zw ).r; + clip( -edge ); +#endif + + // Sample offscreen target and return + return TORQUE_TEX2D( colorSource, uvScene.xy ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/particleCompositeV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/particleCompositeV.hlsl new file mode 100644 index 000000000..c4c51204a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/particleCompositeV.hlsl @@ -0,0 +1,53 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct Vertex +{ + float3 pos : POSITION; + float4 uvCoord : COLOR0; +}; + +struct Conn +{ + float4 hpos : TORQUE_POSITION; + float4 offscreenPos : TEXCOORD0; + float4 backbufferPos : TEXCOORD1; +}; + +uniform float4 screenRect; // point, extent + +Conn main(Vertex IN) +{ + Conn OUT; + + OUT.hpos = float4(IN.uvCoord.xy, 1.0, 1.0); + OUT.hpos.xy *= screenRect.zw; + OUT.hpos.xy += screenRect.xy; + + OUT.backbufferPos = OUT.hpos; + OUT.offscreenPos = OUT.hpos; + + return OUT; +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/particlesP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/particlesP.hlsl new file mode 100644 index 000000000..155107d8b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/particlesP.hlsl @@ -0,0 +1,109 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "torque.hlsl" +#include "shaderModel.hlsl" +// With advanced lighting we get soft particles. +#ifdef TORQUE_LINEAR_DEPTH + #define SOFTPARTICLES +#endif + +#ifdef SOFTPARTICLES + + #include "shaderModelAutoGen.hlsl" + + uniform float oneOverSoftness; + uniform float oneOverFar; + TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1); + //uniform float3 vEye; + uniform float4 deferredTargetParams; +#endif + +#define CLIP_Z // TODO: Make this a proper macro + +struct Conn +{ + float4 hpos : TORQUE_POSITION; + float4 color : TEXCOORD0; + float2 uv0 : TEXCOORD1; + float4 pos : TEXCOORD2; +}; + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); +TORQUE_UNIFORM_SAMPLER2D(paraboloidLightMap, 2); + +float4 lmSample( float3 nrm ) +{ + bool calcBack = (nrm.z < 0.0); + if ( calcBack ) + nrm.z = nrm.z * -1.0; + + float2 lmCoord; + lmCoord.x = (nrm.x / (2*(1 + nrm.z))) + 0.5; + lmCoord.y = 1-((nrm.y / (2*(1 + nrm.z))) + 0.5); + + + // If this is the back, offset in the atlas + if ( calcBack ) + lmCoord.x += 1.0; + + // Atlasing front and back maps, so scale + lmCoord.x *= 0.5; + + return TORQUE_TEX2D(paraboloidLightMap, lmCoord); +} + + +uniform float alphaFactor; +uniform float alphaScale; + +float4 main( Conn IN ) : TORQUE_TARGET0 +{ + float softBlend = 1; + + #ifdef SOFTPARTICLES + float2 tc = IN.pos.xy * float2(1.0, -1.0) / IN.pos.w; + tc = viewportCoordToRenderTarget(saturate( ( tc + 1.0 ) * 0.5 ), deferredTargetParams); + + float sceneDepth = TORQUE_DEFERRED_UNCONDITION(deferredTex, tc).w; + float depth = IN.pos.w * oneOverFar; + float diff = sceneDepth - depth; + #ifdef CLIP_Z + // If drawing offscreen, this acts as the depth test, since we don't line up with the z-buffer + // When drawing high-res, though, we want to be able to take advantage of hi-z + // so this is #ifdef'd out + //clip(diff); + #endif + softBlend = saturate( diff * oneOverSoftness ); + #endif + + float4 diffuse = TORQUE_TEX2D( diffuseMap, IN.uv0 ); + + //return float4( lmSample(float3(0, 0, -1)).rgb, IN.color.a * diffuse.a * softBlend * alphaScale); + + // Scale output color by the alpha factor (turn LerpAlpha into pre-multiplied alpha) + float3 colorScale = ( alphaFactor < 0.0 ? IN.color.rgb * diffuse.rgb : ( alphaFactor > 0.0 ? IN.color.a * diffuse.a * alphaFactor * softBlend : softBlend ) ); + + return hdrEncode( float4( IN.color.rgb * diffuse.rgb * colorScale, + IN.color.a * diffuse.a * softBlend * alphaScale ) ); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/particlesV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/particlesV.hlsl new file mode 100644 index 000000000..dbeff0cc2 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/particlesV.hlsl @@ -0,0 +1,55 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct Vertex +{ + float3 pos : POSITION; + float4 color : COLOR0; + float2 uv0 : TEXCOORD0; +}; + +struct Conn +{ + float4 hpos : TORQUE_POSITION; + float4 color : TEXCOORD0; + float2 uv0 : TEXCOORD1; + float4 pos : TEXCOORD2; +}; + + +uniform float4x4 modelViewProj; +uniform float4x4 fsModelViewProj; + +Conn main( Vertex In ) +{ + Conn Out; + + Out.hpos = mul( modelViewProj, float4(In.pos,1.0) ); + Out.pos = mul(fsModelViewProj, float4(In.pos, 1.0) ); + Out.color = In.color; + Out.uv0 = In.uv0; + + return Out; +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/planarReflectBumpP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/planarReflectBumpP.hlsl new file mode 100644 index 000000000..d18331fb6 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/planarReflectBumpP.hlsl @@ -0,0 +1,87 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 texCoord : TEXCOORD0; + float4 tex2 : TEXCOORD1; +}; + + +struct Fragout +{ + float4 col : TORQUE_TARGET0; +}; + +TORQUE_UNIFORM_SAMPLER2D(texMap, 0); +TORQUE_UNIFORM_SAMPLER2D(refractMap, 1); +TORQUE_UNIFORM_SAMPLER2D(bumpMap, 2); + + +//----------------------------------------------------------------------------- +// Fade edges of axis for texcoord passed in +//----------------------------------------------------------------------------- +float fadeAxis( float val ) +{ + // Fades from 1.0 to 0.0 when less than 0.1 + float fadeLow = saturate( val * 10.0 ); + + // Fades from 1.0 to 0.0 when greater than 0.9 + float fadeHigh = 1.0 - saturate( (val - 0.9) * 10.0 ); + + return fadeLow * fadeHigh; +} + + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Fragout main( ConnectData IN ) +{ + Fragout OUT; + + float3 bumpNorm = TORQUE_TEX2D( bumpMap, IN.tex2 ) * 2.0 - 1.0; + float2 offset = float2( bumpNorm.x, bumpNorm.y ); + float4 texIndex = IN.texCoord; + + // The fadeVal is used to "fade" the distortion at the edges of the screen. + // This is done so it won't sample the reflection texture out-of-bounds and create artifacts + // Note - this can be done more efficiently with a texture lookup + float fadeVal = fadeAxis( texIndex.x / texIndex.w ) * fadeAxis( texIndex.y / texIndex.w ); + + const float distortion = 0.2; + texIndex.xy += offset * distortion * fadeVal; + + float4 reflectColor = TORQUE_TEX2DPROJ( refractMap, texIndex ); + float4 diffuseColor = TORQUE_TEX2D( texMap, IN.tex2 ); + + OUT.col = diffuseColor + reflectColor * diffuseColor.a; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/planarReflectBumpV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/planarReflectBumpV.hlsl new file mode 100644 index 000000000..d45adb574 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/planarReflectBumpV.hlsl @@ -0,0 +1,67 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define IN_HLSL +#include "shdrConsts.h" +#include "shaderModel.hlsl" + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- +struct VertData +{ + float3 position : POSITION; + float3 normal : NORMAL; + float2 texCoord : TEXCOORD0; + float2 lmCoord : TEXCOORD1; + float3 T : TEXCOORD2; + float3 B : TEXCOORD3; +}; + + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float4 texCoord : TEXCOORD0; + float2 tex2 : TEXCOORD1; +}; + +uniform float4x4 modelview; +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +ConnectData main( VertData IN ) +{ + ConnectData OUT; + OUT.hpos = mul(modelview, float4(IN.position,1.0)); + + float4x4 texGenTest = { 0.5, 0.0, 0.0, 0.5, + 0.0, -0.5, 0.0, 0.5, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 }; + + OUT.texCoord = mul( texGenTest, OUT.hpos ); + + OUT.tex2 = IN.texCoord; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/planarReflectP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/planarReflectP.hlsl new file mode 100644 index 000000000..43b420544 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/planarReflectP.hlsl @@ -0,0 +1,58 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 texCoord : TEXCOORD0; + float4 tex2 : TEXCOORD1; +}; + + +struct Fragout +{ + float4 col : TORQUE_TARGET0; +}; + +TORQUE_UNIFORM_SAMPLER2D(texMap, 0); +TORQUE_UNIFORM_SAMPLER2D(refractMap, 1); + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Fragout main( ConnectData IN ) +{ + Fragout OUT; + + float4 diffuseColor = TORQUE_TEX2D( texMap, IN.texCoord ); + float4 reflectColor = TORQUE_TEX2DPROJ(refractMap, IN.tex2); + + OUT.col = diffuseColor + reflectColor * diffuseColor.a; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/planarReflectV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/planarReflectV.hlsl new file mode 100644 index 000000000..1f2ca9d4f --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/planarReflectV.hlsl @@ -0,0 +1,57 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define IN_HLSL +#include "hlslStructs.hlsl" +#include "shaderModel.hlsl" + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 texCoord : TEXCOORD0; + float4 tex2 : TEXCOORD1; +}; + +uniform float4x4 modelview; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +ConnectData main( VertexIn_PNTTTB IN ) +{ + ConnectData OUT; + OUT.hpos = mul(modelview, float4(IN.pos,1.0)); + + float4x4 texGenTest = { 0.5, 0.0, 0.0, 0.5, + 0.0, -0.5, 0.0, 0.5, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 }; + + OUT.texCoord = IN.uv0; + OUT.tex2 = mul( texGenTest, OUT.hpos ); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/VolFogGlowP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/VolFogGlowP.hlsl new file mode 100644 index 000000000..c3adb3b55 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/VolFogGlowP.hlsl @@ -0,0 +1,74 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2014 R.G.S. - Richards Game Studio, the Netherlands +// http://www.richardsgamestudio.com/ +// +// If you find this code useful or you are feeling particularly generous I +// would ask that you please go to http://www.richardsgamestudio.com/ then +// choose Donations from the menu on the left side and make a donation to +// Richards Game Studio. It will be highly appreciated. +// +// The MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Volumetric Fog Glow postFx pixel shader V1.00 + +#include "./postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); +uniform float strength; + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float2 uv2 : TEXCOORD2; + float2 uv3 : TEXCOORD3; + + float2 uv4 : TEXCOORD4; + float2 uv5 : TEXCOORD5; + float2 uv6 : TEXCOORD6; + float2 uv7 : TEXCOORD7; +}; + +float4 main( VertToPix IN ) : TORQUE_TARGET0 +{ + float4 kernel = float4( 0.175, 0.275, 0.375, 0.475 ) * strength; + + float4 OUT = 0; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv0 ) * kernel.x; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv1 ) * kernel.y; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv2 ) * kernel.z; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv3 ) * kernel.w; + + OUT += TORQUE_TEX2D( diffuseMap, IN.uv4 ) * kernel.x; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv5 ) * kernel.y; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv6 ) * kernel.z; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv7 ) * kernel.w; + + // Calculate a lumenance value in the alpha so we + // can use alpha test to save fillrate. + float3 rgb2lum = float3( 0.30, 0.59, 0.11 ); + OUT.a = dot( OUT.rgb, rgb2lum ); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/caustics/causticsP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/caustics/causticsP.hlsl new file mode 100644 index 000000000..8c8abd480 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/caustics/causticsP.hlsl @@ -0,0 +1,77 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" +#include "../../shaderModelAutoGen.hlsl" + +uniform float accumTime; +uniform float3 eyePosWorld; +uniform float4 rtParams0; +uniform float4 waterFogPlane; + +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0); +TORQUE_UNIFORM_SAMPLER2D(causticsTex0, 1); +TORQUE_UNIFORM_SAMPLER2D(causticsTex1, 2); + +float distanceToPlane(float4 plane, float3 pos) +{ + return (plane.x * pos.x + plane.y * pos.y + plane.z * pos.z) + plane.w; +} + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + //Sample the pre-pass + float4 deferred = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ); + + //Get depth + float depth = deferred.w; + if(depth > 0.9999) + return float4(0,0,0,0); + + //Get world position + float3 pos = eyePosWorld + IN.wsEyeRay * depth; + + // Check the water depth + float waterDepth = -distanceToPlane(waterFogPlane, pos); + if(waterDepth < 0) + return float4(0,0,0,0); + waterDepth = saturate(waterDepth); + + //Use world position X and Y to calculate caustics UV + float2 causticsUV0 = (abs(pos.xy * 0.25) % float2(1, 1)); + float2 causticsUV1 = (abs(pos.xy * 0.2) % float2(1, 1)); + + //Animate uvs + float timeSin = sin(accumTime); + causticsUV0.xy += float2(accumTime*0.1, timeSin*0.2); + causticsUV1.xy -= float2(accumTime*0.15, timeSin*0.15); + + //Sample caustics texture + float4 caustics = TORQUE_TEX2D(causticsTex0, causticsUV0); + caustics *= TORQUE_TEX2D(causticsTex1, causticsUV1); + + //Use normal Z to modulate caustics + //float waterDepth = 1 - saturate(pos.z + waterFogPlane.w + 1); + caustics *= saturate(deferred.z) * pow(abs(1-depth), 64) * waterDepth; + + return caustics; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/caustics/gl/causticsP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/caustics/gl/causticsP.glsl new file mode 100644 index 000000000..d002fd7e1 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/caustics/gl/causticsP.glsl @@ -0,0 +1,87 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../gl/postFX.glsl" +#include "shadergen:/autogenConditioners.h" + +uniform vec3 eyePosWorld; +uniform vec4 rtParams0; +uniform vec4 waterFogPlane; +uniform float accumTime; + +uniform sampler2D deferredTex; +uniform sampler2D causticsTex0; +uniform sampler2D causticsTex1; +uniform vec2 targetSize; + +out vec4 OUT_col; + +float distanceToPlane(vec4 plane, vec3 pos) +{ + return (plane.x * pos.x + plane.y * pos.y + plane.z * pos.z) + plane.w; +} + +void main() +{ + //Sample the pre-pass + vec4 deferred = deferredUncondition( deferredTex, IN_uv0 ); + + //Get depth + float depth = deferred.w; + if(depth > 0.9999) + { + OUT_col = vec4(0,0,0,0); + return; + } + + //Get world position + vec3 pos = eyePosWorld + IN_wsEyeRay * depth; + + // Check the water depth + float waterDepth = -distanceToPlane(waterFogPlane, pos); + if(waterDepth < 0) + { + OUT_col = vec4(0,0,0,0); + return; + } + waterDepth = saturate(waterDepth); + + //Use world position X and Y to calculate caustics UV + vec2 causticsUV0 = mod(abs(pos.xy * 0.25), vec2(1, 1)); + vec2 causticsUV1 = mod(abs(pos.xy * 0.2), vec2(1, 1)); + + //Animate uvs + float timeSin = sin(accumTime); + causticsUV0.xy += vec2(accumTime*0.1, timeSin*0.2); + causticsUV1.xy -= vec2(accumTime*0.15, timeSin*0.15); + + //Sample caustics texture + vec4 caustics = texture(causticsTex0, causticsUV0); + caustics *= texture(causticsTex1, causticsUV1); + + //Use normal Z to modulate caustics + //float waterDepth = 1 - saturate(pos.z + waterFogPlane.w + 1); + caustics *= saturate(deferred.z) * pow(1-depth, 64) * waterDepth; + + OUT_col = caustics; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/chromaticLens.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/chromaticLens.hlsl new file mode 100644 index 000000000..8fdca72b7 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/chromaticLens.hlsl @@ -0,0 +1,60 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Based on 'Cubic Lens Distortion HLSL Shader' by François Tarlier +// www.francois-tarlier.com/blog/index.php/2009/11/cubic-lens-distortion-shader + +#include "./postFx.hlsl" +#include "./../torque.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +uniform float distCoeff; +uniform float cubeDistort; +uniform float3 colorDistort; + + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float2 tex = IN.uv0; + + float f = 0; + float r2 = (tex.x - 0.5) * (tex.x - 0.5) + (tex.y - 0.5) * (tex.y - 0.5); + + // Only compute the cubic distortion if necessary. + if ( cubeDistort == 0.0 ) + f = 1 + r2 * distCoeff; + else + f = 1 + r2 * (distCoeff + cubeDistort * sqrt(r2)); + + // Distort each color channel seperately to get a chromatic distortion effect. + float3 outColor; + float3 distort = f.xxx + colorDistort; + + for ( int i=0; i < 3; i++ ) + { + float x = distort[i] * ( tex.x - 0.5 ) + 0.5; + float y = distort[i] * ( tex.y - 0.5 ) + 0.5; + outColor[i] = TORQUE_TEX2DLOD( backBuffer, float4(x,y,0,0) )[i]; + } + + return float4( outColor.rgb, 1 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_CalcCoC_P.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_CalcCoC_P.hlsl new file mode 100644 index 000000000..2f5835fc2 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_CalcCoC_P.hlsl @@ -0,0 +1,53 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" + +// These are set by the game engine. +TORQUE_UNIFORM_SAMPLER2D(shrunkSampler, 0); // Output of DofDownsample() +TORQUE_UNIFORM_SAMPLER2D(blurredSampler, 1); // Blurred version of the shrunk sampler + + +// This is the pixel shader function that calculates the actual +// value used for the near circle of confusion. +// "texCoords" are 0 at the bottom left pixel and 1 at the top right. +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float3 color; + float coc; + half4 blurred; + half4 shrunk; + + shrunk = half4(TORQUE_TEX2D( shrunkSampler, IN.uv0 )); + blurred = half4(TORQUE_TEX2D( blurredSampler, IN.uv1 )); + color = shrunk.rgb; + //coc = shrunk.a; + //coc = blurred.a; + //coc = max( blurred.a, shrunk.a ); + coc = 2 * max( blurred.a, shrunk.a ) - shrunk.a; + + + //return float4( coc.rrr, 1.0 ); + //return float4( color, 1.0 ); + return float4( color, coc ); + //return float4( 1.0, 0.0, 1.0, 1.0 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_CalcCoC_V.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_CalcCoC_V.hlsl new file mode 100644 index 000000000..8131e45cd --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_CalcCoC_V.hlsl @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" +#include "./../../torque.hlsl" + +uniform float4 rtParams0; +uniform float4 rtParams1; +uniform float4 rtParams2; +uniform float4 rtParams3; + +PFXVertToPix main( PFXVert IN ) +{ + PFXVertToPix OUT; + + /* + OUT.hpos = IN.pos; + OUT.uv0 = IN.uv; + OUT.uv1 = IN.uv; + OUT.uv2 = IN.uv; + OUT.uv3 = IN.uv; + */ + + /* + OUT.hpos = IN.pos; + OUT.uv0 = IN.uv + rtParams0.xy; + OUT.uv1 = IN.uv + rtParams1.xy; + OUT.uv2 = IN.uv + rtParams2.xy; + OUT.uv3 = IN.uv + rtParams3.xy; + */ + + /* + OUT.hpos = IN.pos; + OUT.uv0 = IN.uv * rtParams0.zw; + OUT.uv1 = IN.uv * rtParams1.zw; + OUT.uv2 = IN.uv * rtParams2.zw; + OUT.uv3 = IN.uv * rtParams3.zw; + */ + + + OUT.hpos = float4(IN.pos,1.0); + OUT.uv0 = viewportCoordToRenderTarget( IN.uv, rtParams0 ); + OUT.uv1 = viewportCoordToRenderTarget( IN.uv, rtParams1 ); + OUT.uv2 = viewportCoordToRenderTarget( IN.uv, rtParams2 ); + OUT.uv3 = viewportCoordToRenderTarget( IN.uv, rtParams3 ); + + + OUT.wsEyeRay = IN.wsEyeRay; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_DownSample_P.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_DownSample_P.hlsl new file mode 100644 index 000000000..907c3d122 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_DownSample_P.hlsl @@ -0,0 +1,143 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModel.hlsl" +#include "../../shaderModelAutoGen.hlsl" + +// These are set by the game engine. +// The render target size is one-quarter the scene rendering size. +TORQUE_UNIFORM_SAMPLER2D(colorSampler, 0); +TORQUE_UNIFORM_SAMPLER2D(depthSampler, 1); +uniform float2 dofEqWorld; +uniform float2 targetSize; +uniform float depthOffset; +uniform float maxWorldCoC; +//uniform float2 dofEqWeapon; +//uniform float2 dofRowDelta; // float2( 0, 0.25 / renderTargetHeight ) + +struct Pixel +{ + float4 position : TORQUE_POSITION; + float2 tcColor0 : TEXCOORD0; + float2 tcColor1 : TEXCOORD1; + float2 tcDepth0 : TEXCOORD2; + float2 tcDepth1 : TEXCOORD3; + float2 tcDepth2 : TEXCOORD4; + float2 tcDepth3 : TEXCOORD5; +}; + +half4 main( Pixel IN ) : TORQUE_TARGET0 +{ + //return float4( 1.0, 0.0, 1.0, 1.0 ); + + float2 dofRowDelta = float2( 0, 0.25 / targetSize.y ); + + //float2 dofEqWorld = float2( -60, 1.0 ); + + half3 color; + half maxCoc; + float4 depth; + half4 viewCoc; + half4 sceneCoc; + half4 curCoc; + half4 coc; + float2 rowOfs[4]; + + // "rowOfs" reduces how many moves PS2.0 uses to emulate swizzling. + rowOfs[0] = 0; + rowOfs[1] = dofRowDelta.xy; + rowOfs[2] = dofRowDelta.xy * 2; + rowOfs[3] = dofRowDelta.xy * 3; + + // Use bilinear filtering to average 4 color samples for free. + color = 0; + color += half3(TORQUE_TEX2D( colorSampler, IN.tcColor0.xy + rowOfs[0] ).rgb); + color += half3(TORQUE_TEX2D(colorSampler, IN.tcColor1.xy + rowOfs[0]).rgb); + color += half3(TORQUE_TEX2D(colorSampler, IN.tcColor0.xy + rowOfs[2]).rgb); + color += half3(TORQUE_TEX2D(colorSampler, IN.tcColor1.xy + rowOfs[2]).rgb); + color /= 4; + + //declare thse here to save doing it in each loop below + half4 zero4 = half4(0, 0, 0, 0); + coc = zero4; + half4 dofEqWorld4X = half4(dofEqWorld.xxxx); + half4 dofEqWorld4Y = half4(dofEqWorld.yyyy); + half4 maxWorldCoC4 = half4(maxWorldCoC, maxWorldCoC, maxWorldCoC, maxWorldCoC); + // Process 4 samples at a time to use vector hardware efficiently. + // The CoC will be 1 if the depth is negative, so use "min" to pick + // between "sceneCoc" and "viewCoc". + [unroll] // coc[i] causes this anyway + for (int i = 0; i < 4; i++) + { + depth[0] = TORQUE_DEFERRED_UNCONDITION(depthSampler, (IN.tcDepth0.xy + rowOfs[i])).w; + depth[1] = TORQUE_DEFERRED_UNCONDITION(depthSampler, (IN.tcDepth1.xy + rowOfs[i])).w; + depth[2] = TORQUE_DEFERRED_UNCONDITION(depthSampler, (IN.tcDepth2.xy + rowOfs[i])).w; + depth[3] = TORQUE_DEFERRED_UNCONDITION(depthSampler, (IN.tcDepth3.xy + rowOfs[i])).w; + + coc = max(coc, clamp(dofEqWorld4X * half4(depth)+dofEqWorld4Y, zero4, maxWorldCoC4)); + } + + /* + depth[0] = TORQUE_TEX2D( depthSampler, pixel.tcDepth0.xy + rowOfs[0] ).r; + depth[1] = TORQUE_TEX2D( depthSampler, pixel.tcDepth1.xy + rowOfs[0] ).r; + depth[2] = TORQUE_TEX2D( depthSampler, pixel.tcDepth2.xy + rowOfs[0] ).r; + depth[3] = TORQUE_TEX2D( depthSampler, pixel.tcDepth3.xy + rowOfs[0] ).r; + viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y ); + sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y ); + curCoc = min( viewCoc, sceneCoc ); + coc = curCoc; + + depth[0] = TORQUE_TEX2D( depthSampler, pixel.tcDepth0.xy + rowOfs[1] ).r; + depth[1] = TORQUE_TEX2D( depthSampler, pixel.tcDepth1.xy + rowOfs[1] ).r; + depth[2] = TORQUE_TEX2D( depthSampler, pixel.tcDepth2.xy + rowOfs[1] ).r; + depth[3] = TORQUE_TEX2D( depthSampler, pixel.tcDepth3.xy + rowOfs[1] ).r; + viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y ); + sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y ); + curCoc = min( viewCoc, sceneCoc ); + coc = max( coc, curCoc ); + + depth[0] = TORQUE_TEX2D( depthSampler, pixel.tcDepth0.xy + rowOfs[2] ).r; + depth[1] = TORQUE_TEX2D( depthSampler, pixel.tcDepth1.xy + rowOfs[2] ).r; + depth[2] = TORQUE_TEX2D( depthSampler, pixel.tcDepth2.xy + rowOfs[2] ).r; + depth[3] = TORQUE_TEX2D( depthSampler, pixel.tcDepth3.xy + rowOfs[2] ).r; + viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y ); + sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y ); + curCoc = min( viewCoc, sceneCoc ); + coc = max( coc, curCoc ); + + depth[0] = TORQUE_TEX2D( depthSampler, pixel.tcDepth0.xy + rowOfs[3] ).r; + depth[1] = TORQUE_TEX2D( depthSampler, pixel.tcDepth1.xy + rowOfs[3] ).r; + depth[2] = TORQUE_TEX2D( depthSampler, pixel.tcDepth2.xy + rowOfs[3] ).r; + depth[3] = TORQUE_TEX2D( depthSampler, pixel.tcDepth3.xy + rowOfs[3] ).r; + viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y ); + sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y ); + curCoc = min( viewCoc, sceneCoc ); + coc = max( coc, curCoc ); + */ + + maxCoc = max( max( coc[0], coc[1] ), max( coc[2], coc[3] ) ); + + //return half4( 1.0, 0.0, 1.0, 1.0 ); + return half4( color, maxCoc ); + //return half4( color, 1.0f ); + //return half4( maxCoc.rrr, 1.0 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_DownSample_V.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_DownSample_V.hlsl new file mode 100644 index 000000000..0b3ec01e2 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_DownSample_V.hlsl @@ -0,0 +1,61 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" +#include "./../../torque.hlsl" + +struct Vert +{ + float3 pos : POSITION; + float2 tc : TEXCOORD0; + float3 wsEyeRay : TEXCOORD1; +}; + +struct Pixel +{ + float4 position : TORQUE_POSITION; + float2 tcColor0 : TEXCOORD0; + float2 tcColor1 : TEXCOORD1; + float2 tcDepth0 : TEXCOORD2; + float2 tcDepth1 : TEXCOORD3; + float2 tcDepth2 : TEXCOORD4; + float2 tcDepth3 : TEXCOORD5; +}; + +uniform float4 rtParams0; +uniform float2 oneOverTargetSize; + +Pixel main( Vert IN ) +{ + Pixel OUT; + OUT.position = float4(IN.pos,1.0); + + float2 uv = viewportCoordToRenderTarget( IN.tc, rtParams0 ); + //OUT.position = mul( IN.pos, modelView ); + OUT.tcColor1 = uv + float2( +1.0, -0.0 ) * oneOverTargetSize; + OUT.tcColor0 = uv + float2( -1.0, -0.0 ) * oneOverTargetSize; + OUT.tcDepth0 = uv + float2( -0.5, -0.0 ) * oneOverTargetSize; + OUT.tcDepth1 = uv + float2( -1.5, -0.0 ) * oneOverTargetSize; + OUT.tcDepth2 = uv + float2( +1.5, -0.0 ) * oneOverTargetSize; + OUT.tcDepth3 = uv + float2( +2.5, -0.0 ) * oneOverTargetSize; + return OUT; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Final_P.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Final_P.hlsl new file mode 100644 index 000000000..9a7cb3d5e --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Final_P.hlsl @@ -0,0 +1,145 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModelAutoGen.hlsl" +#include "./../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(colorSampler,0); // Original source image +TORQUE_UNIFORM_SAMPLER2D(smallBlurSampler,1); // Output of SmallBlurPS() +TORQUE_UNIFORM_SAMPLER2D(largeBlurSampler,2); // Blurred output of DofDownsample() +TORQUE_UNIFORM_SAMPLER2D(depthSampler,3); + +uniform float2 oneOverTargetSize; +uniform float4 dofLerpScale; +uniform float4 dofLerpBias; +uniform float3 dofEqFar; +uniform float maxFarCoC; + +//static float d0 = 0.1; +//static float d1 = 0.1; +//static float d2 = 0.8; +//static float4 dofLerpScale = float4( -1.0 / d0, -1.0 / d1, -1.0 / d2, 1.0 / d2 ); +//static float4 dofLerpBias = float4( 1.0, (1.0 - d2) / d1, 1.0 / d2, (d2 - 1.0) / d2 ); +//static float3 dofEqFar = float3( 2.0, 0.0, 1.0 ); + +float4 tex2Doffset(TORQUE_SAMPLER2D(s), float2 tc, float2 offset) +{ + return TORQUE_TEX2D( s, tc + offset * oneOverTargetSize ); +} + +half3 GetSmallBlurSample( float2 tc ) +{ + half3 sum; + const half weight = 4.0 / 17; + sum = 0; // Unblurred sample done by alpha blending + //sum += weight * tex2Doffset( colorSampler, tc, float2( 0, 0 ) ).rgb; + sum += weight * half3(tex2Doffset(TORQUE_SAMPLER2D_MAKEARG(colorSampler), tc, float2(+0.5, -1.5)).rgb); + sum += weight * half3(tex2Doffset(TORQUE_SAMPLER2D_MAKEARG(colorSampler), tc, float2(-1.5, -0.5)).rgb); + sum += weight * half3(tex2Doffset(TORQUE_SAMPLER2D_MAKEARG(colorSampler), tc, float2(-0.5, +1.5)).rgb); + sum += weight * half3(tex2Doffset(TORQUE_SAMPLER2D_MAKEARG(colorSampler), tc, float2(+1.5, +0.5)).rgb); + return sum; +} + +half4 InterpolateDof( half3 small, half3 med, half3 large, half t ) +{ + //t = 2; + half4 weights; + half3 color; + half alpha; + + // Efficiently calculate the cross-blend weights for each sample. + // Let the unblurred sample to small blur fade happen over distance + // d0, the small to medium blur over distance d1, and the medium to + // large blur over distance d2, where d0 + d1 + d2 = 1. + //float4 dofLerpScale = float4( -1 / d0, -1 / d1, -1 / d2, 1 / d2 ); + //float4 dofLerpBias = float4( 1, (1 � d2) / d1, 1 / d2, (d2 � 1) / d2 ); + + weights = half4(saturate( t * dofLerpScale + dofLerpBias )); + weights.yz = min( weights.yz, 1 - weights.xy ); + + // Unblurred sample with weight "weights.x" done by alpha blending + color = weights.y * small + weights.z * med + weights.w * large; + //color = med; + alpha = dot( weights.yzw, half3( 16.0 / 17, 1.0, 1.0 ) ); + //alpha = 0.0; + + return half4( color, alpha ); +} + +half4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + //return half4( 1,0,1,1 ); + //return half4( TORQUE_TEX2D( colorSampler, IN.uv0 ).rgb, 1.0 ); + //return half4( TORQUE_TEX2D( colorSampler, texCoords ).rgb, 0 ); + half3 small; + half4 med; + half3 large; + half depth; + half nearCoc; + half farCoc; + half coc; + + small = GetSmallBlurSample( IN.uv0 ); + //small = half3( 1,0,0 ); + //return half4( small, 1.0 ); + med = half4(TORQUE_TEX2D( smallBlurSampler, IN.uv1 )); + //med.rgb = half3( 0,1,0 ); + //return half4(med.rgb, 0.0); + large = half3(TORQUE_TEX2D(largeBlurSampler, IN.uv2).rgb); + //large = half3( 0,0,1 ); + //return large; + //return half4(large.rgb,1.0); + nearCoc = med.a; + + // Since the med blur texture is screwed up currently + // replace it with the large, but this needs to be fixed. + //med.rgb = large; + + //nearCoc = 0; + depth = half(TORQUE_DEFERRED_UNCONDITION( depthSampler, IN.uv3 ).w); + //return half4(depth.rrr,1); + //return half4(nearCoc.rrr,1.0); + + if (depth > 0.999 ) + { + coc = nearCoc; // We don't want to blur the sky. + //coc = 0; + } + else + { + // dofEqFar.x and dofEqFar.y specify the linear ramp to convert + // to depth for the distant out-of-focus region. + // dofEqFar.z is the ratio of the far to the near blur radius. + farCoc = half(clamp( dofEqFar.x * depth + dofEqFar.y, 0.0, maxFarCoC )); + coc = half(max( nearCoc, farCoc * dofEqFar.z )); + //coc = nearCoc; + } + + //coc = nearCoc; + //coc = farCoc; + //return half4(coc.rrr,0.5); + //return half4(farCoc.rrr,1); + //return half4(nearCoc.rrr,1); + + //return half4( 1,0,1,0 ); + return InterpolateDof( small, med.rgb, large, coc ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Final_V.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Final_V.hlsl new file mode 100644 index 000000000..86c93701a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Final_V.hlsl @@ -0,0 +1,72 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" +#include "./../../torque.hlsl" + +uniform float4 rtParams0; +uniform float4 rtParams1; +uniform float4 rtParams2; +uniform float4 rtParams3; +uniform float2 oneOverTargetSize; + +PFXVertToPix main( PFXVert IN ) +{ + PFXVertToPix OUT; + + /* + OUT.hpos = IN.pos; + OUT.uv0 = IN.uv; + OUT.uv1 = IN.uv; + OUT.uv2 = IN.uv; + OUT.uv3 = IN.uv; + */ + + /* + OUT.hpos = IN.pos; + OUT.uv0 = IN.uv + rtParams0.xy; + OUT.uv1 = IN.uv + rtParams1.xy; + OUT.uv2 = IN.uv + rtParams2.xy; + OUT.uv3 = IN.uv + rtParams3.xy; + */ + + + /* + OUT.hpos = IN.pos; + OUT.uv0 = IN.uv * rtParams0.zw; + OUT.uv1 = IN.uv * rtParams1.zw; + OUT.uv2 = IN.uv * rtParams2.zw; + OUT.uv3 = IN.uv * rtParams3.zw; + */ + + + OUT.hpos = float4(IN.pos,1.0); + OUT.uv0 = viewportCoordToRenderTarget( IN.uv, rtParams0 ); + OUT.uv1 = viewportCoordToRenderTarget( IN.uv, rtParams1 ); // + float2( -5, 1 ) * oneOverTargetSize; + OUT.uv2 = viewportCoordToRenderTarget( IN.uv, rtParams2 ); + OUT.uv3 = viewportCoordToRenderTarget( IN.uv, rtParams3 ); + + + OUT.wsEyeRay = IN.wsEyeRay; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Gausian_P.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Gausian_P.hlsl new file mode 100644 index 000000000..f4d29f3e1 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Gausian_P.hlsl @@ -0,0 +1,63 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float2 uv2 : TEXCOORD2; + float2 uv3 : TEXCOORD3; + + float2 uv4 : TEXCOORD4; + float2 uv5 : TEXCOORD5; + float2 uv6 : TEXCOORD6; + float2 uv7 : TEXCOORD7; +}; + +float4 main( VertToPix IN ) : TORQUE_TARGET0 +{ + float4 kernel = float4( 0.175, 0.275, 0.375, 0.475 ) * 0.5 / 1.3; //25f; + + float4 OUT = 0; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv0 ) * kernel.x; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv1 ) * kernel.y; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv2 ) * kernel.z; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv3 ) * kernel.w; + + OUT += TORQUE_TEX2D( diffuseMap, IN.uv4 ) * kernel.x; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv5 ) * kernel.y; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv6 ) * kernel.z; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv7 ) * kernel.w; + + // Calculate a lumenance value in the alpha so we + // can use alpha test to save fillrate. + //float3 rgb2lum = float3( 0.30, 0.59, 0.11 ); + //OUT.a = dot( OUT.rgb, rgb2lum ); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Gausian_V.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Gausian_V.hlsl new file mode 100644 index 000000000..b2d4582e0 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Gausian_V.hlsl @@ -0,0 +1,80 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" +#include "./../../torque.hlsl" + + +uniform float4 rtParams0; +uniform float2 texSize0; +uniform float2 oneOverTargetSize; + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float2 uv2 : TEXCOORD2; + float2 uv3 : TEXCOORD3; + + float2 uv4 : TEXCOORD4; + float2 uv5 : TEXCOORD5; + float2 uv6 : TEXCOORD6; + float2 uv7 : TEXCOORD7; +}; + +VertToPix main( PFXVert IN ) +{ + VertToPix OUT; + + OUT.hpos = float4(IN.pos,1.0); + + IN.uv = viewportCoordToRenderTarget( IN.uv, rtParams0 ); + + // I don't know why this offset is necessary, but it is. + //IN.uv = IN.uv * oneOverTargetSize; + + OUT.uv0 = IN.uv + ( ( BLUR_DIR * 3.5f ) / texSize0 ); + OUT.uv1 = IN.uv + ( ( BLUR_DIR * 2.5f ) / texSize0 ); + OUT.uv2 = IN.uv + ( ( BLUR_DIR * 1.5f ) / texSize0 ); + OUT.uv3 = IN.uv + ( ( BLUR_DIR * 0.5f ) / texSize0 ); + + OUT.uv4 = IN.uv - ( ( BLUR_DIR * 3.5f ) / texSize0 ); + OUT.uv5 = IN.uv - ( ( BLUR_DIR * 2.5f ) / texSize0 ); + OUT.uv6 = IN.uv - ( ( BLUR_DIR * 1.5f ) / texSize0 ); + OUT.uv7 = IN.uv - ( ( BLUR_DIR * 0.5f ) / texSize0 ); + + /* + OUT.uv0 = viewportCoordToRenderTarget( OUT.uv0, rtParams0 ); + OUT.uv1 = viewportCoordToRenderTarget( OUT.uv1, rtParams0 ); + OUT.uv2 = viewportCoordToRenderTarget( OUT.uv2, rtParams0 ); + OUT.uv3 = viewportCoordToRenderTarget( OUT.uv3, rtParams0 ); + + OUT.uv4 = viewportCoordToRenderTarget( OUT.uv4, rtParams0 ); + OUT.uv5 = viewportCoordToRenderTarget( OUT.uv5, rtParams0 ); + OUT.uv6 = viewportCoordToRenderTarget( OUT.uv6, rtParams0 ); + OUT.uv7 = viewportCoordToRenderTarget( OUT.uv7, rtParams0 ); + */ + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Passthrough_V.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Passthrough_V.hlsl new file mode 100644 index 000000000..8131e45cd --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_Passthrough_V.hlsl @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" +#include "./../../torque.hlsl" + +uniform float4 rtParams0; +uniform float4 rtParams1; +uniform float4 rtParams2; +uniform float4 rtParams3; + +PFXVertToPix main( PFXVert IN ) +{ + PFXVertToPix OUT; + + /* + OUT.hpos = IN.pos; + OUT.uv0 = IN.uv; + OUT.uv1 = IN.uv; + OUT.uv2 = IN.uv; + OUT.uv3 = IN.uv; + */ + + /* + OUT.hpos = IN.pos; + OUT.uv0 = IN.uv + rtParams0.xy; + OUT.uv1 = IN.uv + rtParams1.xy; + OUT.uv2 = IN.uv + rtParams2.xy; + OUT.uv3 = IN.uv + rtParams3.xy; + */ + + /* + OUT.hpos = IN.pos; + OUT.uv0 = IN.uv * rtParams0.zw; + OUT.uv1 = IN.uv * rtParams1.zw; + OUT.uv2 = IN.uv * rtParams2.zw; + OUT.uv3 = IN.uv * rtParams3.zw; + */ + + + OUT.hpos = float4(IN.pos,1.0); + OUT.uv0 = viewportCoordToRenderTarget( IN.uv, rtParams0 ); + OUT.uv1 = viewportCoordToRenderTarget( IN.uv, rtParams1 ); + OUT.uv2 = viewportCoordToRenderTarget( IN.uv, rtParams2 ); + OUT.uv3 = viewportCoordToRenderTarget( IN.uv, rtParams3 ); + + + OUT.wsEyeRay = IN.wsEyeRay; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_SmallBlur_P.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_SmallBlur_P.hlsl new file mode 100644 index 000000000..175525a91 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_SmallBlur_P.hlsl @@ -0,0 +1,46 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// This vertex and pixel shader applies a 3 x 3 blur to the image in +// colorMapSampler, which is the same size as the render target. +// The sample weights are 1/16 in the corners, 2/16 on the edges, +// and 4/16 in the center. +#include "../../shaderModel.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(colorSampler, 0); // Output of DofNearCoc() + +struct Pixel +{ + float4 position : TORQUE_POSITION; + float4 texCoords : TEXCOORD0; +}; + +float4 main( Pixel IN ) : TORQUE_TARGET0 +{ + float4 color; + color = 0.0; + color += TORQUE_TEX2D( colorSampler, IN.texCoords.xz ); + color += TORQUE_TEX2D( colorSampler, IN.texCoords.yz ); + color += TORQUE_TEX2D( colorSampler, IN.texCoords.xw ); + color += TORQUE_TEX2D( colorSampler, IN.texCoords.yw ); + return color / 4.0; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_SmallBlur_V.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_SmallBlur_V.hlsl new file mode 100644 index 000000000..3edb1ec2a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/DOF_SmallBlur_V.hlsl @@ -0,0 +1,56 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// This vertex and pixel shader applies a 3 x 3 blur to the image in +// colorMapSampler, which is the same size as the render target. +// The sample weights are 1/16 in the corners, 2/16 on the edges, +// and 4/16 in the center. + +#include "./../postFx.hlsl" +#include "./../../torque.hlsl" + +struct Vert +{ + float3 position : POSITION; + float2 texCoords : TEXCOORD0; +}; + +struct Pixel +{ + float4 position : TORQUE_POSITION; + float4 texCoords : TEXCOORD0; +}; + +uniform float2 oneOverTargetSize; +uniform float4 rtParams0; + +Pixel main( Vert IN ) +{ + Pixel OUT; + const float4 halfPixel = { -0.5, 0.5, -0.5, 0.5 }; + OUT.position = float4(IN.position,1.0); //Transform_ObjectToClip( IN.position ); + + //float2 uv = IN.texCoords + rtParams0.xy; + float2 uv = viewportCoordToRenderTarget( IN.texCoords, rtParams0 ); + OUT.texCoords = uv.xxyy + halfPixel * oneOverTargetSize.xxyy; + return OUT; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_CalcCoC_P.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_CalcCoC_P.glsl new file mode 100644 index 000000000..38cb099c4 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_CalcCoC_P.glsl @@ -0,0 +1,55 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../gl/postFX.glsl" + +// These are set by the game engine. +uniform sampler2D shrunkSampler; // Output of DofDownsample() +uniform sampler2D blurredSampler; // Blurred version of the shrunk sampler + +out vec4 OUT_col; + +// This is the pixel shader function that calculates the actual +// value used for the near circle of confusion. +// "texCoords" are 0 at the bottom left pixel and 1 at the top right. +void main() +{ + vec3 color; + float coc; + half4 blurred; + half4 shrunk; + + shrunk = texture( shrunkSampler, IN_uv0 ); + blurred = texture( blurredSampler, IN_uv1 ); + color = shrunk.rgb; + //coc = shrunk.a; + //coc = blurred.a; + //coc = max( blurred.a, shrunk.a ); + coc = 2 * max( blurred.a, shrunk.a ) - shrunk.a; + + + //OUT_col = vec4( coc.rrr, 1.0 ); + //OUT_col = vec4( color, 1.0 ); + OUT_col = vec4( color, coc ); + //OUT_col = vec4( 1.0, 0.0, 1.0, 1.0 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_CalcCoC_V.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_CalcCoC_V.glsl new file mode 100644 index 000000000..d02ce6551 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_CalcCoC_V.glsl @@ -0,0 +1,69 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../../gl/torque.glsl" +#include "../../gl/postFX.glsl" + +uniform vec4 rtParams0; +uniform vec4 rtParams1; +uniform vec4 rtParams2; +uniform vec4 rtParams3; + +void main() +{ + /* + OUT_hpos = IN.pos; + OUT_uv0 = IN_uv; + OUT_uv1 = IN_uv; + OUT_uv2 = IN_uv; + OUT_uv3 = IN_uv; + */ + + /* + OUT_hpos = IN_pos; + OUT_uv0 = IN_uv + rtParams0.xy; + OUT_uv1 = IN_uv + rtParams1.xy; + OUT_uv2 = IN_uv + rtParams2.xy; + OUT_uv3 = IN_uv + rtParams3.xy; + */ + + /* + OUT_hpos = IN_pos; + OUT_uv0 = IN_uv * rtParams0.zw; + OUT_uv1 = IN_uv * rtParams1.zw; + OUT_uv2 = IN_uv * rtParams2.zw; + OUT_uv3 = IN_uv * rtParams3.zw; + */ + + + OUT_hpos = IN_pos; + OUT_uv0 = viewportCoordToRenderTarget( IN_uv, rtParams0 ); + OUT_uv1 = viewportCoordToRenderTarget( IN_uv, rtParams1 ); + OUT_uv2 = viewportCoordToRenderTarget( IN_uv, rtParams2 ); + OUT_uv3 = viewportCoordToRenderTarget( IN_uv, rtParams3 ); + + + OUT_wsEyeRay = IN_wsEyeRay; + + correctSSP(gl_Position);; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_DownSample_P.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_DownSample_P.glsl new file mode 100644 index 000000000..f3c093f31 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_DownSample_P.glsl @@ -0,0 +1,143 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +// These are set by the game engine. +// The render target size is one-quarter the scene rendering size. +uniform sampler2D colorSampler; +uniform sampler2D depthSampler; +uniform vec2 dofEqWorld; +uniform float depthOffset; +uniform vec2 targetSize; +uniform float maxWorldCoC; +//uniform vec2 dofEqWeapon; +//uniform vec2 dofRowDelta; // vec2( 0, 0.25 / renderTargetHeight ) + +in vec2 tcColor0; +#define IN_tcColor0 tcColor0 +in vec2 tcColor1; +#define IN_tcColor1 tcColor1 +in vec2 tcDepth0; +#define IN_tcDepth0 tcDepth0 +in vec2 tcDepth1; +#define IN_tcDepth1 tcDepth1 +in vec2 tcDepth2; +#define IN_tcDepth2 tcDepth2 +in vec2 tcDepth3; +#define IN_tcDepth3 tcDepth3 + +out vec4 OUT_col; + +void main() +{ + //return vec4( 1.0, 0.0, 1.0, 1.0 ); + + vec2 dofRowDelta = vec2( 0, 0.25 / targetSize.y ); + + //vec2 dofEqWorld = vec2( -60, 1.0 ); + + half3 color; + half maxCoc; + vec4 depth; + half4 viewCoc; + half4 sceneCoc; + half4 curCoc; + half4 coc; + vec2 rowOfs[4]; + + // "rowOfs" reduces how many moves PS2.0 uses to emulate swizzling. + rowOfs[0] = vec2(0); + rowOfs[1] = dofRowDelta.xy; + rowOfs[2] = dofRowDelta.xy * 2; + rowOfs[3] = dofRowDelta.xy * 3; + + // Use bilinear filtering to average 4 color samples for free. + color = half3(0); + color += texture( colorSampler, IN_tcColor0.xy + rowOfs[0] ).rgb; + color += texture( colorSampler, IN_tcColor1.xy + rowOfs[0] ).rgb; + color += texture( colorSampler, IN_tcColor0.xy + rowOfs[2] ).rgb; + color += texture( colorSampler, IN_tcColor1.xy + rowOfs[2] ).rgb; + color /= 4; + + // Process 4 samples at a time to use vector hardware efficiently. + // The CoC will be 1 if the depth is negative, so use "min" to pick + // between "sceneCoc" and "viewCoc". + + coc = half4(0); + for ( int i = 0; i < 4; i++ ) + { + depth[0] = deferredUncondition( depthSampler, ( IN_tcDepth0.xy + rowOfs[i] ) ).w; + depth[1] = deferredUncondition( depthSampler, ( IN_tcDepth1.xy + rowOfs[i] ) ).w; + depth[2] = deferredUncondition( depthSampler, ( IN_tcDepth2.xy + rowOfs[i] ) ).w; + depth[3] = deferredUncondition( depthSampler, ( IN_tcDepth3.xy + rowOfs[i] ) ).w; + + // @todo OPENGL INTEL need review + coc = max( coc, clamp( half4(dofEqWorld.x) * depth + half4(dofEqWorld.y), half4(0.0), half4(maxWorldCoC) ) ); + } + + /* + depth[0] = texture( depthSampler, pixel.tcDepth0.xy + rowOfs[0] ).r; + depth[1] = texture( depthSampler, pixel.tcDepth1.xy + rowOfs[0] ).r; + depth[2] = texture( depthSampler, pixel.tcDepth2.xy + rowOfs[0] ).r; + depth[3] = texture( depthSampler, pixel.tcDepth3.xy + rowOfs[0] ).r; + viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y ); + sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y ); + curCoc = min( viewCoc, sceneCoc ); + coc = curCoc; + + depth[0] = texture( depthSampler, pixel.tcDepth0.xy + rowOfs[1] ).r; + depth[1] = texture( depthSampler, pixel.tcDepth1.xy + rowOfs[1] ).r; + depth[2] = texture( depthSampler, pixel.tcDepth2.xy + rowOfs[1] ).r; + depth[3] = texture( depthSampler, pixel.tcDepth3.xy + rowOfs[1] ).r; + viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y ); + sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y ); + curCoc = min( viewCoc, sceneCoc ); + coc = max( coc, curCoc ); + + depth[0] = texture( depthSampler, pixel.tcDepth0.xy + rowOfs[2] ).r; + depth[1] = texture( depthSampler, pixel.tcDepth1.xy + rowOfs[2] ).r; + depth[2] = texture( depthSampler, pixel.tcDepth2.xy + rowOfs[2] ).r; + depth[3] = texture( depthSampler, pixel.tcDepth3.xy + rowOfs[2] ).r; + viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y ); + sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y ); + curCoc = min( viewCoc, sceneCoc ); + coc = max( coc, curCoc ); + + depth[0] = texture( depthSampler, pixel.tcDepth0.xy + rowOfs[3] ).r; + depth[1] = texture( depthSampler, pixel.tcDepth1.xy + rowOfs[3] ).r; + depth[2] = texture( depthSampler, pixel.tcDepth2.xy + rowOfs[3] ).r; + depth[3] = texture( depthSampler, pixel.tcDepth3.xy + rowOfs[3] ).r; + viewCoc = saturate( dofEqWeapon.x * -depth + dofEqWeapon.y ); + sceneCoc = saturate( dofEqWorld.x * depth + dofEqWorld.y ); + curCoc = min( viewCoc, sceneCoc ); + coc = max( coc, curCoc ); + */ + + maxCoc = max( max( coc[0], coc[1] ), max( coc[2], coc[3] ) ); + + //OUT_col = half4( 1.0, 0.0, 1.0, 1.0 ); + OUT_col = half4( color, maxCoc ); + //OUT_col = half4( color, 1.0f ); + //OUT_col = half4( maxCoc.rrr, 1.0 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_DownSample_V.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_DownSample_V.glsl new file mode 100644 index 000000000..b8e840c9e --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_DownSample_V.glsl @@ -0,0 +1,67 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../../gl/torque.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; +in vec3 vTexCoord1; + +#define IN_pos vPosition +#define IN_tc vTexCoord0 +#define IN_wsEyeRay vTexCoord1 + +#define OUT_position gl_Position + +out vec2 tcColor0; +#define OUT_tcColor0 tcColor0 +out vec2 tcColor1; +#define OUT_tcColor1 tcColor1 +out vec2 tcDepth0; +#define OUT_tcDepth0 tcDepth0 +out vec2 tcDepth1; +#define OUT_tcDepth1 tcDepth1 +out vec2 tcDepth2; +#define OUT_tcDepth2 tcDepth2 +out vec2 tcDepth3; +#define OUT_tcDepth3 tcDepth3 + + +uniform vec4 rtParams0; +uniform vec2 oneOverTargetSize; + +void main() +{ + OUT_position = IN_pos; + + vec2 uv = viewportCoordToRenderTarget( IN_tc, rtParams0 ); + //OUT_position = tMul( IN_pos, modelView ); + OUT_tcColor1 = uv + vec2( +1.0, -0.0 ) * oneOverTargetSize; + OUT_tcColor0 = uv + vec2( -1.0, -0.0 ) * oneOverTargetSize; + OUT_tcDepth0 = uv + vec2( -0.5, -0.0 ) * oneOverTargetSize; + OUT_tcDepth1 = uv + vec2( -1.5, -0.0 ) * oneOverTargetSize; + OUT_tcDepth2 = uv + vec2( +1.5, -0.0 ) * oneOverTargetSize; + OUT_tcDepth3 = uv + vec2( +2.5, -0.0 ) * oneOverTargetSize; + + correctSSP(gl_Position); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Final_P.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Final_P.glsl new file mode 100644 index 000000000..9b976ba1e --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Final_P.glsl @@ -0,0 +1,147 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/postFX.glsl" + +uniform sampler2D colorSampler; // Original source image +uniform sampler2D smallBlurSampler; // Output of SmallBlurPS() +uniform sampler2D largeBlurSampler; // Blurred output of DofDownsample() +uniform sampler2D depthSampler; // +uniform vec2 oneOverTargetSize; +uniform vec4 dofLerpScale; +uniform vec4 dofLerpBias; +uniform vec3 dofEqFar; +uniform float maxFarCoC; + +//static float d0 = 0.1; +//static float d1 = 0.1; +//static float d2 = 0.8; +//static vec4 dofLerpScale = vec4( -1.0 / d0, -1.0 / d1, -1.0 / d2, 1.0 / d2 ); +//static vec4 dofLerpBias = vec4( 1.0, (1.0 - d2) / d1, 1.0 / d2, (d2 - 1.0) / d2 ); +//static vec3 dofEqFar = vec3( 2.0, 0.0, 1.0 ); + +out vec4 OUT_col; + +vec4 tex2Doffset( sampler2D s, vec2 tc, vec2 offset ) +{ + return texture( s, tc + offset * oneOverTargetSize ); +} + +half3 GetSmallBlurSample( vec2 tc ) +{ + half3 sum; + const half weight = 4.0 / 17; + sum = half3(0); // Unblurred sample done by alpha blending + //sum += weight * tex2Doffset( colorSampler, tc, vec2( 0, 0 ) ).rgb; + sum += weight * tex2Doffset( colorSampler, tc, vec2( +0.5, -1.5 ) ).rgb; + sum += weight * tex2Doffset( colorSampler, tc, vec2( -1.5, -0.5 ) ).rgb; + sum += weight * tex2Doffset( colorSampler, tc, vec2( -0.5, +1.5 ) ).rgb; + sum += weight * tex2Doffset( colorSampler, tc, vec2( +1.5, +0.5 ) ).rgb; + return sum; +} + +half4 InterpolateDof( half3 small, half3 med, half3 large, half t ) +{ + //t = 2; + half4 weights; + half3 color; + half alpha; + + // Efficiently calculate the cross-blend weights for each sample. + // Let the unblurred sample to small blur fade happen over distance + // d0, the small to medium blur over distance d1, and the medium to + // large blur over distance d2, where d0 + d1 + d2 = 1. + //vec4 dofLerpScale = vec4( -1 / d0, -1 / d1, -1 / d2, 1 / d2 ); + //vec4 dofLerpBias = vec4( 1, (1 – d2) / d1, 1 / d2, (d2 – 1) / d2 ); + + weights = saturate( t * dofLerpScale + dofLerpBias ); + weights.yz = min( weights.yz, 1 - weights.xy ); + + // Unblurred sample with weight "weights.x" done by alpha blending + color = weights.y * small + weights.z * med + weights.w * large; + //color = med; + alpha = dot( weights.yzw, half3( 16.0 / 17, 1.0, 1.0 ) ); + //alpha = 0.0; + + return half4( color, alpha ); +} + +void main() +{ + //return half4( 1,0,1,1 ); + //return half4( texture( colorSampler, IN_uv0 ).rgb, 1.0 ); + //return half4( texture( colorSampler, texCoords ).rgb, 0 ); + half3 small; + half4 med; + half3 large; + half depth; + half nearCoc; + half farCoc; + half coc; + + small = GetSmallBlurSample( IN_uv0 ); + //small = half3( 1,0,0 ); + //return half4( small, 1.0 ); + med = texture( smallBlurSampler, IN_uv1 ); + //med.rgb = half3( 0,1,0 ); + //return half4(med.rgb, 0.0); + large = texture( largeBlurSampler, IN_uv2 ).rgb; + //large = half3( 0,0,1 ); + //return large; + //return half4(large.rgb,1.0); + nearCoc = med.a; + + // Since the med blur texture is screwed up currently + // replace it with the large, but this needs to be fixed. + //med.rgb = large; + + //nearCoc = 0; + depth = deferredUncondition( depthSampler, IN_uv3 ).w; + //return half4(depth.rrr,1); + //return half4(nearCoc.rrr,1.0); + + if (depth > 0.999 ) + { + coc = nearCoc; // We don't want to blur the sky. + //coc = 0; + } + else + { + // dofEqFar.x and dofEqFar.y specify the linear ramp to convert + // to depth for the distant out-of-focus region. + // dofEqFar.z is the ratio of the far to the near blur radius. + farCoc = clamp( dofEqFar.x * depth + dofEqFar.y, 0.0, maxFarCoC ); + coc = max( nearCoc, farCoc * dofEqFar.z ); + //coc = nearCoc; + } + + //coc = nearCoc; + //coc = farCoc; + //return half4(coc.rrr,0.5); + //return half4(farCoc.rrr,1); + //return half4(nearCoc.rrr,1); + + //return half4( 1,0,1,0 ); + OUT_col = InterpolateDof( small, med.rgb, large, coc ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Final_V.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Final_V.glsl new file mode 100644 index 000000000..abc91246e --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Final_V.glsl @@ -0,0 +1,71 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../../gl/torque.glsl" +#include "../../gl/postFX.glsl" + +uniform vec4 rtParams0; +uniform vec4 rtParams1; +uniform vec4 rtParams2; +uniform vec4 rtParams3; +uniform vec2 oneOverTargetSize; + +void main() +{ + /* + OUT.hpos = IN_pos; + OUT_uv0 = IN_uv; + OUT_uv1 = IN_uv; + OUT_uv2 = IN_uv; + OUT_uv3 = IN_uv; + */ + + /* + OUT_hpos = IN_pos; + OUT_uv0 = IN_uv + rtParams0.xy; + OUT_uv1 = IN_uv + rtParams1.xy; + OUT_uv2 = IN_uv + rtParams2.xy; + OUT_uv3 = IN_uv + rtParams3.xy; + */ + + + /* + OUT_hpos = IN_pos; + OUT_uv0 = IN_uv * rtParams0.zw; + OUT_uv1 = IN_uv * rtParams1.zw; + OUT_uv2 = IN_uv * rtParams2.zw; + OUT_uv3 = IN_uv * rtParams3.zw; + */ + + + OUT_hpos = IN_pos; + OUT_uv0 = viewportCoordToRenderTarget( IN_uv, rtParams0 ); + OUT_uv1 = viewportCoordToRenderTarget( IN_uv, rtParams1 ); // + vec2( -5, 1 ) * oneOverTargetSize; + OUT_uv2 = viewportCoordToRenderTarget( IN_uv, rtParams2 ); + OUT_uv3 = viewportCoordToRenderTarget( IN_uv, rtParams3 ); + + + OUT_wsEyeRay = IN_wsEyeRay; + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Gausian_P.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Gausian_P.glsl new file mode 100644 index 000000000..61e7697af --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Gausian_P.glsl @@ -0,0 +1,68 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +in vec3 wsEyeRay; +#define IN_wsEyeRay wsEyeRay +in vec2 uv0; +#define IN_uv0 uv0 +in vec2 uv1; +#define IN_uv1 uv1 +in vec2 uv2; +#define IN_uv2 uv2 +in vec2 uv3; +#define IN_uv3 uv3 +in vec2 uv4; +#define IN_uv4 uv4 +in vec2 uv5; +#define IN_uv5 uv5 +in vec2 uv6; +#define IN_uv6 uv6 +in vec2 uv7; +#define IN_uv7 uv7 + +out vec4 OUT_col; + +uniform sampler2D diffuseMap; + +void main() +{ + vec4 kernel = vec4( 0.175, 0.275, 0.375, 0.475 ) * 0.5 / 1.3; //25f; + + OUT_col = vec4(0); + OUT_col += texture( diffuseMap, IN_uv0 ) * kernel.x; + OUT_col += texture( diffuseMap, IN_uv1 ) * kernel.y; + OUT_col += texture( diffuseMap, IN_uv2 ) * kernel.z; + OUT_col += texture( diffuseMap, IN_uv3 ) * kernel.w; + + OUT_col += texture( diffuseMap, IN_uv4 ) * kernel.x; + OUT_col += texture( diffuseMap, IN_uv5 ) * kernel.y; + OUT_col += texture( diffuseMap, IN_uv6 ) * kernel.z; + OUT_col += texture( diffuseMap, IN_uv7 ) * kernel.w; + + // Calculate a lumenance value in the alpha so we + // can use alpha test to save fillrate. + //vec3 rgb2lum = vec3( 0.30, 0.59, 0.11 ); + //OUT_col.a = dot( OUT_col.rgb, rgb2lum ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Gausian_V.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Gausian_V.glsl new file mode 100644 index 000000000..c77e23c53 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Gausian_V.glsl @@ -0,0 +1,91 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../../gl/torque.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; +in vec3 vTexCoord1; + +#define IN_pos vPosition +#define _IN_uv vTexCoord0 +#define IN_wsEyeRay vTexCoord1 + +#define OUT_hpos gl_Position +out vec3 wsEyeRay; +#define OUT_wsEyeRay wsEyeRay +out vec2 uv0; +#define OUT_uv0 uv0 +out vec2 uv1; +#define OUT_uv1 uv1 +out vec2 uv2; +#define OUT_uv2 uv2 +out vec2 uv3; +#define OUT_uv3 uv3 +out vec2 uv4; +#define OUT_uv4 uv4 +out vec2 uv5; +#define OUT_uv5 uv5 +out vec2 uv6; +#define OUT_uv6 uv6 +out vec2 uv7; +#define OUT_uv7 uv7 + +uniform vec2 texSize0; +uniform vec4 rtParams0; +uniform vec2 oneOverTargetSize; + + +void main() +{ + OUT_hpos = IN_pos; + + vec2 IN_uv = viewportCoordToRenderTarget( _IN_uv, rtParams0 ); + + // I don't know why this offset is necessary, but it is. + //IN_uv = IN_uv * oneOverTargetSize; + + OUT_uv0 = IN_uv + ( ( BLUR_DIR * 3.5f ) / texSize0 ); + OUT_uv1 = IN_uv + ( ( BLUR_DIR * 2.5f ) / texSize0 ); + OUT_uv2 = IN_uv + ( ( BLUR_DIR * 1.5f ) / texSize0 ); + OUT_uv3 = IN_uv + ( ( BLUR_DIR * 0.5f ) / texSize0 ); + + OUT_uv4 = IN_uv - ( ( BLUR_DIR * 3.5f ) / texSize0 ); + OUT_uv5 = IN_uv - ( ( BLUR_DIR * 2.5f ) / texSize0 ); + OUT_uv6 = IN_uv - ( ( BLUR_DIR * 1.5f ) / texSize0 ); + OUT_uv7 = IN_uv - ( ( BLUR_DIR * 0.5f ) / texSize0 ); + + /* + OUT_uv0 = viewportCoordToRenderTarget( OUT_uv0, rtParams0 ); + OUT_uv1 = viewportCoordToRenderTarget( OUT_uv1, rtParams0 ); + OUT_uv2 = viewportCoordToRenderTarget( OUT_uv2, rtParams0 ); + OUT_uv3 = viewportCoordToRenderTarget( OUT_uv3, rtParams0 ); + + OUT_uv4 = viewportCoordToRenderTarget( OUT_uv4, rtParams0 ); + OUT_uv5 = viewportCoordToRenderTarget( OUT_uv5, rtParams0 ); + OUT_uv6 = viewportCoordToRenderTarget( OUT_uv6, rtParams0 ); + OUT_uv7 = viewportCoordToRenderTarget( OUT_uv7, rtParams0 ); + */ + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Passthrough_V.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Passthrough_V.glsl new file mode 100644 index 000000000..bd02fb7d4 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_Passthrough_V.glsl @@ -0,0 +1,69 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../../gl/torque.glsl" +#include "../../gl/postFX.glsl" + +uniform vec4 rtParams0; +uniform vec4 rtParams1; +uniform vec4 rtParams2; +uniform vec4 rtParams3; + +void main() +{ + /* + OUT.hpos = IN_pos; + OUT_uv0 = IN_uv; + OUT_uv1 = IN_uv; + OUT_uv2 = IN_uv; + OUT_uv3 = IN_uv; + */ + + /* + OUT_hpos = IN_pos; + OUT_uv0 = IN_uv + rtParams0.xy; + OUT_uv1 = IN_uv + rtParams1.xy; + OUT_uv2 = IN_uv + rtParams2.xy; + OUT_uv3 = IN_uv + rtParams3.xy; + */ + + /* + OUT_hpos = IN_pos; + OUT_uv0 = IN_uv * rtParams0.zw; + OUT_uv1 = IN_uv * rtParams1.zw; + OUT_uv2 = IN_uv * rtParams2.zw; + OUT_uv3 = IN_uv * rtParams3.zw; + */ + + + OUT_hpos = IN_pos; + OUT_uv0 = viewportCoordToRenderTarget( IN_uv, rtParams0 ); + OUT_uv1 = viewportCoordToRenderTarget( IN_uv, rtParams1 ); + OUT_uv2 = viewportCoordToRenderTarget( IN_uv, rtParams2 ); + OUT_uv3 = viewportCoordToRenderTarget( IN_uv, rtParams3 ); + + + OUT_wsEyeRay = IN_wsEyeRay; + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_SmallBlur_P.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_SmallBlur_P.glsl new file mode 100644 index 000000000..ae94edd78 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_SmallBlur_P.glsl @@ -0,0 +1,46 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// This vertex and pixel shader applies a 3 x 3 blur to the image in +// colorMapSampler, which is the same size as the render target. +// The sample weights are 1/16 in the corners, 2/16 on the edges, +// and 4/16 in the center. + +#include "../../../gl/hlslCompat.glsl" + +uniform sampler2D colorSampler; // Output of DofNearCoc() + +in vec4 texCoords; +#define IN_texCoords texCoords + +out vec4 OUT_col; + +void main() +{ + vec4 color; + color = vec4(0.0); + color += texture( colorSampler, IN_texCoords.xz ); + color += texture( colorSampler, IN_texCoords.yz ); + color += texture( colorSampler, IN_texCoords.xw ); + color += texture( colorSampler, IN_texCoords.yw ); + OUT_col = color / 4.0; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_SmallBlur_V.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_SmallBlur_V.glsl new file mode 100644 index 000000000..413abd352 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/dof/gl/DOF_SmallBlur_V.glsl @@ -0,0 +1,54 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// This vertex and pixel shader applies a 3 x 3 blur to the image in +// colorMapSampler, which is the same size as the render target. +// The sample weights are 1/16 in the corners, 2/16 on the edges, +// and 4/16 in the center. + +#include "../../../gl/hlslCompat.glsl" +#include "../../../gl/torque.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; + +#define IN_position vPosition +#define IN_texCoords vTexCoord0 + +#define OUT_position gl_Position +out vec4 texCoords; +#define OUT_texCoords texCoords + +uniform vec2 oneOverTargetSize; +uniform vec4 rtParams0; + +void main() +{ + const vec4 halfPixel = vec4( -0.5, 0.5, -0.5, 0.5 ); + OUT_position = IN_position; //Transform_ObjectToClip( IN_position ); + + //vec2 uv = IN_texCoords + rtParams0.xy; + vec2 uv = viewportCoordToRenderTarget( IN_texCoords, rtParams0 ); + OUT_texCoords = uv.xxyy + halfPixel * oneOverTargetSize.xxyy; + + correctSSP(gl_Position); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/dbgEdgeDisplayP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/dbgEdgeDisplayP.hlsl new file mode 100644 index 000000000..fbd529031 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/dbgEdgeDisplayP.hlsl @@ -0,0 +1,30 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(edgeBuffer); + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + return float4( TORQUE_TEX2D( edgeBuffer, IN.uv0 ).rrr, 1.0 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/edgeAAP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/edgeAAP.hlsl new file mode 100644 index 000000000..f5a71687d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/edgeAAP.hlsl @@ -0,0 +1,66 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(edgeBuffer,0); +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 1); +uniform float2 targetSize; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float2 pixelSize = 1.0 / targetSize; + + // Sample edge buffer, bail if not on an edge + float edgeSample = TORQUE_TEX2D(edgeBuffer, IN.uv0).r; + clip(edgeSample - 1e-6); + + // Ok we're on an edge, so multi-tap sample, average, and return + float2 offsets[9] = { + float2( 0.0, 0.0), + float2(-1.0, -1.0), + float2( 0.0, -1.0), + float2( 1.0, -1.0), + float2( 1.0, 0.0), + float2( 1.0, 1.0), + float2( 0.0, 1.0), + float2(-1.0, 1.0), + float2(-1.0, 0.0), + }; + + float4 accumColor = 0; + for(int i = 0; i < 9; i++) + { + // Multiply the intensity of the edge, by the UV, so that things which maybe + // aren't quite full edges get sub-pixel sampling to reduce artifacts + + // Scaling offsets by 0.5 to reduce the range bluriness from extending to + // far outward from the edge. + + float2 offsetUV = IN.uv1 + edgeSample * ( offsets[i] * 0.5 ) * pixelSize;//rtWidthHeightInvWidthNegHeight.zw; + //offsetUV *= 0.999; + accumColor += TORQUE_TEX2D(backBuffer, offsetUV); + } + accumColor /= 9.0; + + return accumColor; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/edgeAAV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/edgeAAV.hlsl new file mode 100644 index 000000000..4718b40f5 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/edgeAAV.hlsl @@ -0,0 +1,45 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" +#include "./../../torque.hlsl" + + +uniform float4 rtParams0; +uniform float4 rtParams1; +uniform float4 rtParams2; +uniform float4 rtParams3; + +PFXVertToPix main( PFXVert IN ) +{ + PFXVertToPix OUT; + + OUT.hpos = IN.pos; + OUT.uv0 = viewportCoordToRenderTarget( IN.uv, rtParams0 ); + OUT.uv1 = viewportCoordToRenderTarget( IN.uv, rtParams1 ); + OUT.uv2 = viewportCoordToRenderTarget( IN.uv, rtParams2 ); + OUT.uv3 = viewportCoordToRenderTarget( IN.uv, rtParams3 ); + + OUT.wsEyeRay = IN.wsEyeRay; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/edgeDetectP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/edgeDetectP.hlsl new file mode 100644 index 000000000..c8bfb2153 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/edgeDetectP.hlsl @@ -0,0 +1,93 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" +#include "../../shaderModelAutoGen.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(deferredBuffer,0); + +// GPU Gems 3, pg 443-444 +float GetEdgeWeight(float2 uv0, in float2 targetSize) +{ + float2 offsets[9] = { + float2( 0.0, 0.0), + float2(-1.0, -1.0), + float2( 0.0, -1.0), + float2( 1.0, -1.0), + float2( 1.0, 0.0), + float2( 1.0, 1.0), + float2( 0.0, 1.0), + float2(-1.0, 1.0), + float2(-1.0, 0.0), + }; + + + float2 PixelSize = 1.0 / targetSize; + + float Depth[9]; + float3 Normal[9]; + + [unroll] //no getting around this, may as well save the annoying warning message + for(int i = 0; i < 9; i++) + { + float2 uv = uv0 + offsets[i] * PixelSize; + float4 gbSample = TORQUE_DEFERRED_UNCONDITION( deferredBuffer, uv ); + Depth[i] = gbSample.a; + Normal[i] = gbSample.rgb; + } + + float4 Deltas1 = float4(Depth[1], Depth[2], Depth[3], Depth[4]); + float4 Deltas2 = float4(Depth[5], Depth[6], Depth[7], Depth[8]); + + Deltas1 = abs(Deltas1 - Depth[0]); + Deltas2 = abs(Depth[0] - Deltas2); + + float4 maxDeltas = max(Deltas1, Deltas2); + float4 minDeltas = max(min(Deltas1, Deltas2), 0.00001); + + float4 depthResults = step(minDeltas * 25.0, maxDeltas); + + Deltas1.x = dot(Normal[1], Normal[0]); + Deltas1.y = dot(Normal[2], Normal[0]); + Deltas1.z = dot(Normal[3], Normal[0]); + Deltas1.w = dot(Normal[4], Normal[0]); + + Deltas2.x = dot(Normal[5], Normal[0]); + Deltas2.y = dot(Normal[6], Normal[0]); + Deltas2.z = dot(Normal[7], Normal[0]); + Deltas2.w = dot(Normal[8], Normal[0]); + + Deltas1 = abs(Deltas1 - Deltas2); + + float4 normalResults = step(0.4, Deltas1); + + normalResults = max(normalResults, depthResults); + + return dot(normalResults, float4(1.0, 1.0, 1.0, 1.0)) * 0.25; +} + +uniform float2 targetSize; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + return GetEdgeWeight(IN.uv0, targetSize);//rtWidthHeightInvWidthNegHeight.zw); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/dbgEdgeDisplayP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/dbgEdgeDisplayP.glsl new file mode 100644 index 000000000..ccc3b8ba5 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/dbgEdgeDisplayP.glsl @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +in vec2 uv0; +#define IN_uv0 uv0 + +uniform sampler2D edgeBuffer; + +out vec4 OUT_col; + +void main() +{ + OUT_col = vec4( texture( edgeBuffer, IN_uv0 ).rrr, 1.0 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/edgeAAP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/edgeAAP.glsl new file mode 100644 index 000000000..216dc8725 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/edgeAAP.glsl @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/postFX.glsl" + +uniform sampler2D edgeBuffer; +uniform sampler2D backBuffer; +uniform vec2 targetSize; + +out vec4 OUT_col; + +void main() +{ + vec2 pixelSize = 1.0 / targetSize; + + // Sample edge buffer, bail if not on an edge + float edgeSample = texture(edgeBuffer, IN_uv0).r; + clip(edgeSample - 1e-6); + + // Ok we're on an edge, so multi-tap sample, average, and return + vec2 offsets[9] = vec2[]( + vec2( 0.0, 0.0), + vec2(-1.0, -1.0), + vec2( 0.0, -1.0), + vec2( 1.0, -1.0), + vec2( 1.0, 0.0), + vec2( 1.0, 1.0), + vec2( 0.0, 1.0), + vec2(-1.0, 1.0), + vec2(-1.0, 0.0) + ); + + vec4 accumColor = vec4(0.0); + for(int i = 0; i < 9; i++) + { + // Multiply the intensity of the edge, by the UV, so that things which maybe + // aren't quite full edges get sub-pixel sampling to reduce artifacts + + // Scaling offsets by 0.5 to reduce the range bluriness from extending to + // far outward from the edge. + + vec2 offsetUV = IN_uv1 + edgeSample * ( offsets[i] * 0.5 ) * pixelSize;//rtWidthHeightInvWidthNegHeight.zw; + //offsetUV *= 0.999; + accumColor+= texture(backBuffer, offsetUV); + } + accumColor /= 9.0; + + OUT_col = accumColor; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/edgeAAV.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/edgeAAV.glsl new file mode 100644 index 000000000..975532272 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/edgeAAV.glsl @@ -0,0 +1,43 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../../gl/torque.glsl" +#include "../../gl/postFX.glsl" + +uniform vec4 rtParams0; +uniform vec4 rtParams1; +uniform vec4 rtParams2; +uniform vec4 rtParams3; + +void main() +{ + OUT_hpos = IN_pos; + OUT_uv0 = viewportCoordToRenderTarget( IN_uv, rtParams0 ); + OUT_uv1 = viewportCoordToRenderTarget( IN_uv, rtParams1 ); + OUT_uv2 = viewportCoordToRenderTarget( IN_uv, rtParams2 ); + OUT_uv3 = viewportCoordToRenderTarget( IN_uv, rtParams3 ); + + OUT_wsEyeRay = IN_wsEyeRay; + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/edgeDetectP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/edgeDetectP.glsl new file mode 100644 index 000000000..02507eee8 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/edgeaa/gl/edgeDetectP.glsl @@ -0,0 +1,96 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +// GPU Gems 3, pg 443-444 +float GetEdgeWeight(vec2 uv0, in sampler2D deferredBuffer, in vec2 targetSize) +{ + vec2 offsets[9] = vec2[]( + vec2( 0.0, 0.0), + vec2(-1.0, -1.0), + vec2( 0.0, -1.0), + vec2( 1.0, -1.0), + vec2( 1.0, 0.0), + vec2( 1.0, 1.0), + vec2( 0.0, 1.0), + vec2(-1.0, 1.0), + vec2(-1.0, 0.0) + ); + + + vec2 PixelSize = 1.0 / targetSize; + + float Depth[9]; + vec3 Normal[9]; + + for(int i = 0; i < 9; i++) + { + vec2 uv = uv0 + offsets[i] * PixelSize; + vec4 gbSample = deferredUncondition( deferredBuffer, uv ); + Depth[i] = gbSample.a; + Normal[i] = gbSample.rgb; + } + + vec4 Deltas1 = vec4(Depth[1], Depth[2], Depth[3], Depth[4]); + vec4 Deltas2 = vec4(Depth[5], Depth[6], Depth[7], Depth[8]); + + Deltas1 = abs(Deltas1 - Depth[0]); + Deltas2 = abs(Depth[0] - Deltas2); + + vec4 maxDeltas = max(Deltas1, Deltas2); + vec4 minDeltas = max(min(Deltas1, Deltas2), 0.00001); + + vec4 depthResults = step(minDeltas * 25.0, maxDeltas); + + Deltas1.x = dot(Normal[1], Normal[0]); + Deltas1.y = dot(Normal[2], Normal[0]); + Deltas1.z = dot(Normal[3], Normal[0]); + Deltas1.w = dot(Normal[4], Normal[0]); + + Deltas2.x = dot(Normal[5], Normal[0]); + Deltas2.y = dot(Normal[6], Normal[0]); + Deltas2.z = dot(Normal[7], Normal[0]); + Deltas2.w = dot(Normal[8], Normal[0]); + + Deltas1 = abs(Deltas1 - Deltas2); + + vec4 normalResults = step(0.4, Deltas1); + + normalResults = max(normalResults, depthResults); + + return dot(normalResults, vec4(1.0, 1.0, 1.0, 1.0)) * 0.25; +} + +in vec2 uv0; +#define IN_uv0 uv0 + +uniform sampler2D deferredBuffer; +uniform vec2 targetSize; + +out vec4 OUT_col; + +void main() +{ + OUT_col = vec4( GetEdgeWeight(IN_uv0, deferredBuffer, targetSize ) );//rtWidthHeightInvWidthNegHeight.zw); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/flashP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/flashP.hlsl new file mode 100644 index 000000000..93daf3c26 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/flashP.hlsl @@ -0,0 +1,36 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./postFx.hlsl" +#include "../torque.hlsl" + +uniform float damageFlash; +uniform float whiteOut; +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float4 color1 = TORQUE_TEX2D(backBuffer, IN.uv0); + float4 color2 = color1 * MUL_COLOR; + float4 damage = lerp(color1,color2,damageFlash); + return lerp(damage,WHITE_COLOR,whiteOut); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/fogP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/fogP.hlsl new file mode 100644 index 000000000..9f3500f67 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/fogP.hlsl @@ -0,0 +1,47 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +#include "./postFx.hlsl" +#include "./../torque.hlsl" +#include "./../shaderModelAutoGen.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0); +uniform float3 eyePosWorld; +uniform float4 fogColor; +uniform float3 fogData; +uniform float4 rtParams0; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + //float2 deferredCoord = ( IN.uv0.xy * rtParams0.zw ) + rtParams0.xy; + float depth = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ).w; + //return float4( depth, 0, 0, 0.7 ); + + float factor = computeSceneFog( eyePosWorld, + eyePosWorld + ( IN.wsEyeRay * depth ), + fogData.x, + fogData.y, + fogData.z ); + + return hdrEncode( float4( fogColor.rgb, 1.0 - saturate( factor ) ) ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/Fxaa3_11.h b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/Fxaa3_11.h new file mode 100644 index 000000000..9ca7627d4 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/Fxaa3_11.h @@ -0,0 +1,2047 @@ +/*============================================================================ + + + NVIDIA FXAA 3.11 by TIMOTHY LOTTES + + +------------------------------------------------------------------------------ +COPYRIGHT (C) 2010, 2011 NVIDIA CORPORATION. ALL RIGHTS RESERVED. +------------------------------------------------------------------------------ +TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, THIS SOFTWARE IS PROVIDED +*AS IS* AND NVIDIA AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES, EITHER EXPRESS +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL NVIDIA +OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, INDIRECT, OR +CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR +LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, +OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE +THIS SOFTWARE, EVEN IF NVIDIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + +------------------------------------------------------------------------------ + INTEGRATION CHECKLIST +------------------------------------------------------------------------------ +(1.) +In the shader source, setup defines for the desired configuration. +When providing multiple shaders (for different presets), +simply setup the defines differently in multiple files. +Example, + + #define FXAA_PC 1 + #define FXAA_HLSL_5 1 + #define FXAA_QUALITY__PRESET 12 + +Or, + + #define FXAA_360 1 + +Or, + + #define FXAA_PS3 1 + +Etc. + +(2.) +Then include this file, + + include "Fxaa3_11.h" + +(3.) +Then call the FXAA pixel shader from within your desired shader. +Look at the FXAA Quality FxaaPixelShader() for docs on inputs. +As for FXAA 3.11 all inputs for all shaders are the same +to enable easy porting between platforms. + + return FxaaPixelShader(...); + +(4.) +Insure pass prior to FXAA outputs RGBL (see next section). +Or use, + + #define FXAA_GREEN_AS_LUMA 1 + +(5.) +Setup engine to provide the following constants +which are used in the FxaaPixelShader() inputs, + + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir + +Look at the FXAA Quality FxaaPixelShader() for docs on inputs. + +(6.) +Have FXAA vertex shader run as a full screen triangle, +and output "pos" and "fxaaConsolePosPos" +such that inputs in the pixel shader provide, + + // {xy} = center of pixel + FxaaFloat2 pos, + + // {xy__} = upper left of pixel + // {__zw} = lower right of pixel + FxaaFloat4 fxaaConsolePosPos, + +(7.) +Insure the texture sampler(s) used by FXAA are set to bilinear filtering. + + +------------------------------------------------------------------------------ + INTEGRATION - RGBL AND COLORSPACE +------------------------------------------------------------------------------ +FXAA3 requires RGBL as input unless the following is set, + + #define FXAA_GREEN_AS_LUMA 1 + +In which case the engine uses green in place of luma, +and requires RGB input is in a non-linear colorspace. + +RGB should be LDR (low dynamic range). +Specifically do FXAA after tonemapping. + +RGB data as returned by a texture fetch can be non-linear, +or linear when FXAA_GREEN_AS_LUMA is not set. +Note an "sRGB format" texture counts as linear, +because the result of a texture fetch is linear data. +Regular "RGBA8" textures in the sRGB colorspace are non-linear. + +If FXAA_GREEN_AS_LUMA is not set, +luma must be stored in the alpha channel prior to running FXAA. +This luma should be in a perceptual space (could be gamma 2.0). +Example pass before FXAA where output is gamma 2.0 encoded, + + color.rgb = ToneMap(color.rgb); // linear color output + color.rgb = sqrt(color.rgb); // gamma 2.0 color output + return color; + +To use FXAA, + + color.rgb = ToneMap(color.rgb); // linear color output + color.rgb = sqrt(color.rgb); // gamma 2.0 color output + color.a = dot(color.rgb, FxaaFloat3(0.299, 0.587, 0.114)); // compute luma + return color; + +Another example where output is linear encoded, +say for instance writing to an sRGB formated render target, +where the render target does the conversion back to sRGB after blending, + + color.rgb = ToneMap(color.rgb); // linear color output + return color; + +To use FXAA, + + color.rgb = ToneMap(color.rgb); // linear color output + color.a = sqrt(dot(color.rgb, FxaaFloat3(0.299, 0.587, 0.114))); // compute luma + return color; + +Getting luma correct is required for the algorithm to work correctly. + + +------------------------------------------------------------------------------ + BEING LINEARLY CORRECT? +------------------------------------------------------------------------------ +Applying FXAA to a framebuffer with linear RGB color will look worse. +This is very counter intuitive, but happends to be true in this case. +The reason is because dithering artifacts will be more visiable +in a linear colorspace. + + +------------------------------------------------------------------------------ + COMPLEX INTEGRATION +------------------------------------------------------------------------------ +Q. What if the engine is blending into RGB before wanting to run FXAA? + +A. In the last opaque pass prior to FXAA, + have the pass write out luma into alpha. + Then blend into RGB only. + FXAA should be able to run ok + assuming the blending pass did not any add aliasing. + This should be the common case for particles and common blending passes. + +A. Or use FXAA_GREEN_AS_LUMA. + +============================================================================*/ + +/*============================================================================ + + INTEGRATION KNOBS + +============================================================================*/ +// +// FXAA_PS3 and FXAA_360 choose the console algorithm (FXAA3 CONSOLE). +// FXAA_360_OPT is a prototype for the new optimized 360 version. +// +// 1 = Use API. +// 0 = Don't use API. +// +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_PS3 + #define FXAA_PS3 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_360 + #define FXAA_360 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_360_OPT + #define FXAA_360_OPT 0 +#endif +/*==========================================================================*/ +#ifndef FXAA_PC + // + // FXAA Quality + // The high quality PC algorithm. + // + #define FXAA_PC 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_PC_CONSOLE + // + // The console algorithm for PC is included + // for developers targeting really low spec machines. + // Likely better to just run FXAA_PC, and use a really low preset. + // + #define FXAA_PC_CONSOLE 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_GLSL_120 + #define FXAA_GLSL_120 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_GLSL_130 + #define FXAA_GLSL_130 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_HLSL_3 + #define FXAA_HLSL_3 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_HLSL_4 + #define FXAA_HLSL_4 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_HLSL_5 + #define FXAA_HLSL_5 0 +#endif +/*==========================================================================*/ +#ifndef FXAA_GREEN_AS_LUMA + // + // For those using non-linear color, + // and either not able to get luma in alpha, or not wanting to, + // this enables FXAA to run using green as a proxy for luma. + // So with this enabled, no need to pack luma in alpha. + // + // This will turn off AA on anything which lacks some amount of green. + // Pure red and blue or combination of only R and B, will get no AA. + // + // Might want to lower the settings for both, + // fxaaConsoleEdgeThresholdMin + // fxaaQualityEdgeThresholdMin + // In order to insure AA does not get turned off on colors + // which contain a minor amount of green. + // + // 1 = On. + // 0 = Off. + // + #define FXAA_GREEN_AS_LUMA 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_EARLY_EXIT + // + // Controls algorithm's early exit path. + // On PS3 turning this ON adds 2 cycles to the shader. + // On 360 turning this OFF adds 10ths of a millisecond to the shader. + // Turning this off on console will result in a more blurry image. + // So this defaults to on. + // + // 1 = On. + // 0 = Off. + // + #define FXAA_EARLY_EXIT 1 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_DISCARD + // + // Only valid for PC OpenGL currently. + // Probably will not work when FXAA_GREEN_AS_LUMA = 1. + // + // 1 = Use discard on pixels which don't need AA. + // For APIs which enable concurrent TEX+ROP from same surface. + // 0 = Return unchanged color on pixels which don't need AA. + // + #define FXAA_DISCARD 0 +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_FAST_PIXEL_OFFSET + // + // Used for GLSL 120 only. + // + // 1 = GL API supports fast pixel offsets + // 0 = do not use fast pixel offsets + // + #ifdef GL_EXT_gpu_shader4 + #define FXAA_FAST_PIXEL_OFFSET 1 + #endif + #ifdef GL_NV_gpu_shader5 + #define FXAA_FAST_PIXEL_OFFSET 1 + #endif + #ifdef GL_ARB_gpu_shader5 + #define FXAA_FAST_PIXEL_OFFSET 1 + #endif + #ifndef FXAA_FAST_PIXEL_OFFSET + #define FXAA_FAST_PIXEL_OFFSET 0 + #endif +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_GATHER4_ALPHA + // + // 1 = API supports gather4 on alpha channel. + // 0 = API does not support gather4 on alpha channel. + // + #if (FXAA_HLSL_5 == 1) + #define FXAA_GATHER4_ALPHA 1 + #endif + #ifdef GL_ARB_gpu_shader5 + #define FXAA_GATHER4_ALPHA 1 + #endif + #ifdef GL_NV_gpu_shader5 + #define FXAA_GATHER4_ALPHA 1 + #endif + #ifndef FXAA_GATHER4_ALPHA + #define FXAA_GATHER4_ALPHA 0 + #endif +#endif + +/*============================================================================ + FXAA CONSOLE PS3 - TUNING KNOBS +============================================================================*/ +#ifndef FXAA_CONSOLE__PS3_EDGE_SHARPNESS + // + // Consoles the sharpness of edges on PS3 only. + // Non-PS3 tuning is done with shader input. + // + // Due to the PS3 being ALU bound, + // there are only two safe values here: 4 and 8. + // These options use the shaders ability to a free *|/ by 2|4|8. + // + // 8.0 is sharper + // 4.0 is softer + // 2.0 is really soft (good for vector graphics inputs) + // + #if 1 + #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 8.0 + #endif + #if 0 + #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 4.0 + #endif + #if 0 + #define FXAA_CONSOLE__PS3_EDGE_SHARPNESS 2.0 + #endif +#endif +/*--------------------------------------------------------------------------*/ +#ifndef FXAA_CONSOLE__PS3_EDGE_THRESHOLD + // + // Only effects PS3. + // Non-PS3 tuning is done with shader input. + // + // The minimum amount of local contrast required to apply algorithm. + // The console setting has a different mapping than the quality setting. + // + // This only applies when FXAA_EARLY_EXIT is 1. + // + // Due to the PS3 being ALU bound, + // there are only two safe values here: 0.25 and 0.125. + // These options use the shaders ability to a free *|/ by 2|4|8. + // + // 0.125 leaves less aliasing, but is softer + // 0.25 leaves more aliasing, and is sharper + // + #if 1 + #define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.125 + #else + #define FXAA_CONSOLE__PS3_EDGE_THRESHOLD 0.25 + #endif +#endif + +/*============================================================================ + FXAA QUALITY - TUNING KNOBS +------------------------------------------------------------------------------ +NOTE the other tuning knobs are now in the shader function inputs! +============================================================================*/ +#ifndef FXAA_QUALITY__PRESET + // + // Choose the quality preset. + // This needs to be compiled into the shader as it effects code. + // Best option to include multiple presets is to + // in each shader define the preset, then include this file. + // + // OPTIONS + // ----------------------------------------------------------------------- + // 10 to 15 - default medium dither (10=fastest, 15=highest quality) + // 20 to 29 - less dither, more expensive (20=fastest, 29=highest quality) + // 39 - no dither, very expensive + // + // NOTES + // ----------------------------------------------------------------------- + // 12 = slightly faster then FXAA 3.9 and higher edge quality (default) + // 13 = about same speed as FXAA 3.9 and better than 12 + // 23 = closest to FXAA 3.9 visually and performance wise + // _ = the lowest digit is directly related to performance + // _ = the highest digit is directly related to style + // + #define FXAA_QUALITY__PRESET 12 +#endif + + +/*============================================================================ + + FXAA QUALITY - PRESETS + +============================================================================*/ + +/*============================================================================ + FXAA QUALITY - MEDIUM DITHER PRESETS +============================================================================*/ +#if (FXAA_QUALITY__PRESET == 10) + #define FXAA_QUALITY__PS 3 + #define FXAA_QUALITY__P0 1.5 + #define FXAA_QUALITY__P1 3.0 + #define FXAA_QUALITY__P2 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 11) + #define FXAA_QUALITY__PS 4 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 3.0 + #define FXAA_QUALITY__P3 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 12) + #define FXAA_QUALITY__PS 5 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 4.0 + #define FXAA_QUALITY__P4 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 13) + #define FXAA_QUALITY__PS 6 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 4.0 + #define FXAA_QUALITY__P5 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 14) + #define FXAA_QUALITY__PS 7 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 4.0 + #define FXAA_QUALITY__P6 12.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 15) + #define FXAA_QUALITY__PS 8 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 4.0 + #define FXAA_QUALITY__P7 12.0 +#endif + +/*============================================================================ + FXAA QUALITY - LOW DITHER PRESETS +============================================================================*/ +#if (FXAA_QUALITY__PRESET == 20) + #define FXAA_QUALITY__PS 3 + #define FXAA_QUALITY__P0 1.5 + #define FXAA_QUALITY__P1 2.0 + #define FXAA_QUALITY__P2 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 21) + #define FXAA_QUALITY__PS 4 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 22) + #define FXAA_QUALITY__PS 5 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 23) + #define FXAA_QUALITY__PS 6 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 24) + #define FXAA_QUALITY__PS 7 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 3.0 + #define FXAA_QUALITY__P6 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 25) + #define FXAA_QUALITY__PS 8 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 4.0 + #define FXAA_QUALITY__P7 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 26) + #define FXAA_QUALITY__PS 9 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 4.0 + #define FXAA_QUALITY__P8 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 27) + #define FXAA_QUALITY__PS 10 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 2.0 + #define FXAA_QUALITY__P8 4.0 + #define FXAA_QUALITY__P9 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 28) + #define FXAA_QUALITY__PS 11 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 2.0 + #define FXAA_QUALITY__P8 2.0 + #define FXAA_QUALITY__P9 4.0 + #define FXAA_QUALITY__P10 8.0 +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_QUALITY__PRESET == 29) + #define FXAA_QUALITY__PS 12 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.5 + #define FXAA_QUALITY__P2 2.0 + #define FXAA_QUALITY__P3 2.0 + #define FXAA_QUALITY__P4 2.0 + #define FXAA_QUALITY__P5 2.0 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 2.0 + #define FXAA_QUALITY__P8 2.0 + #define FXAA_QUALITY__P9 2.0 + #define FXAA_QUALITY__P10 4.0 + #define FXAA_QUALITY__P11 8.0 +#endif + +/*============================================================================ + FXAA QUALITY - EXTREME QUALITY +============================================================================*/ +#if (FXAA_QUALITY__PRESET == 39) + #define FXAA_QUALITY__PS 12 + #define FXAA_QUALITY__P0 1.0 + #define FXAA_QUALITY__P1 1.0 + #define FXAA_QUALITY__P2 1.0 + #define FXAA_QUALITY__P3 1.0 + #define FXAA_QUALITY__P4 1.0 + #define FXAA_QUALITY__P5 1.5 + #define FXAA_QUALITY__P6 2.0 + #define FXAA_QUALITY__P7 2.0 + #define FXAA_QUALITY__P8 2.0 + #define FXAA_QUALITY__P9 2.0 + #define FXAA_QUALITY__P10 4.0 + #define FXAA_QUALITY__P11 8.0 +#endif + + + +/*============================================================================ + + API PORTING + +============================================================================*/ +#if (FXAA_GLSL_120 == 1) || (FXAA_GLSL_130 == 1) + #define FxaaBool bool + #define FxaaDiscard discard + #define FxaaFloat float + #define FxaaFloat2 vec2 + #define FxaaFloat3 vec3 + #define FxaaFloat4 vec4 + #define FxaaHalf float + #define FxaaHalf2 vec2 + #define FxaaHalf3 vec3 + #define FxaaHalf4 vec4 + #define FxaaInt2 ivec2 + #define FxaaSat(x) clamp(x, 0.0, 1.0) + #define FxaaTex sampler2D +#else + #define FxaaBool bool + #define FxaaDiscard clip(-1) + #define FxaaFloat float + #define FxaaFloat2 float2 + #define FxaaFloat3 float3 + #define FxaaFloat4 float4 + #define FxaaHalf half + #define FxaaHalf2 half2 + #define FxaaHalf3 half3 + #define FxaaHalf4 half4 + #define FxaaSat(x) saturate(x) +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_GLSL_120 == 1) + // Requires, + // #version 120 + // And at least, + // #extension GL_EXT_gpu_shader4 : enable + // (or set FXAA_FAST_PIXEL_OFFSET 1 to work like DX9) + #define FxaaTexTop(t, p) texture2DLod(t, p, 0.0) + #if (FXAA_FAST_PIXEL_OFFSET == 1) + #define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o) + #else + #define FxaaTexOff(t, p, o, r) texture2DLod(t, p + (o * r), 0.0) + #endif + #if (FXAA_GATHER4_ALPHA == 1) + // use #extension GL_ARB_gpu_shader5 : enable + #define FxaaTexAlpha4(t, p) textureGather(t, p, 3) + #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3) + #define FxaaTexGreen4(t, p) textureGather(t, p, 1) + #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1) + #endif +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_GLSL_130 == 1) + // Requires "#version 130" or better + #define FxaaTexTop(t, p) textureLod(t, p, 0.0) + #define FxaaTexOff(t, p, o, r) textureLodOffset(t, p, 0.0, o) + #if (FXAA_GATHER4_ALPHA == 1) + // use #extension GL_ARB_gpu_shader5 : enable + #define FxaaTexAlpha4(t, p) textureGather(t, p, 3) + #define FxaaTexOffAlpha4(t, p, o) textureGatherOffset(t, p, o, 3) + #define FxaaTexGreen4(t, p) textureGather(t, p, 1) + #define FxaaTexOffGreen4(t, p, o) textureGatherOffset(t, p, o, 1) + #endif +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_HLSL_3 == 1) || (FXAA_360 == 1) || (FXAA_PS3 == 1) + #define FxaaInt2 float2 + #define FxaaTex sampler2D + #define FxaaTexTop(t, p) tex2Dlod(t, float4(p, 0.0, 0.0)) + #define FxaaTexOff(t, p, o, r) tex2Dlod(t, float4(p + (o * r), 0, 0)) +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_HLSL_4 == 1) + #define FxaaInt2 int2 + struct FxaaTex { SamplerState smpl; Texture2D tex; }; + #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0) + #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o) +#endif +/*--------------------------------------------------------------------------*/ +#if (FXAA_HLSL_5 == 1) + #define FxaaInt2 int2 + struct FxaaTex { SamplerState smpl; Texture2D tex; }; + #define FxaaTexTop(t, p) t.tex.SampleLevel(t.smpl, p, 0.0) + #define FxaaTexOff(t, p, o, r) t.tex.SampleLevel(t.smpl, p, 0.0, o) + #define FxaaTexAlpha4(t, p) t.tex.GatherAlpha(t.smpl, p) + #define FxaaTexOffAlpha4(t, p, o) t.tex.GatherAlpha(t.smpl, p, o) + #define FxaaTexGreen4(t, p) t.tex.GatherGreen(t.smpl, p) + #define FxaaTexOffGreen4(t, p, o) t.tex.GatherGreen(t.smpl, p, o) +#endif + + +/*============================================================================ + GREEN AS LUMA OPTION SUPPORT FUNCTION +============================================================================*/ +#if (FXAA_GREEN_AS_LUMA == 0) + FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.w; } +#else + FxaaFloat FxaaLuma(FxaaFloat4 rgba) { return rgba.y; } +#endif + + + + +/*============================================================================ + + FXAA3 QUALITY - PC + +============================================================================*/ +#if (FXAA_PC == 1) +/*--------------------------------------------------------------------------*/ +FxaaFloat4 FxaaPixelShader( + // + // Use noperspective interpolation here (turn off perspective interpolation). + // {xy} = center of pixel + FxaaFloat2 pos, + // + // Used only for FXAA Console, and not used on the 360 version. + // Use noperspective interpolation here (turn off perspective interpolation). + // {xy__} = upper left of pixel + // {__zw} = lower right of pixel + FxaaFloat4 fxaaConsolePosPos, + // + // Input color texture. + // {rgb_} = color in linear or perceptual color space + // if (FXAA_GREEN_AS_LUMA == 0) + // {___a} = luma in perceptual color space (not linear) + FxaaTex tex, + // + // Only used on the optimized 360 version of FXAA Console. + // For everything but 360, just use the same input here as for "tex". + // For 360, same texture, just alias with a 2nd sampler. + // This sampler needs to have an exponent bias of -1. + FxaaTex fxaaConsole360TexExpBiasNegOne, + // + // Only used on the optimized 360 version of FXAA Console. + // For everything but 360, just use the same input here as for "tex". + // For 360, same texture, just alias with a 3nd sampler. + // This sampler needs to have an exponent bias of -2. + FxaaTex fxaaConsole360TexExpBiasNegTwo, + // + // Only used on FXAA Quality. + // This must be from a constant/uniform. + // {x_} = 1.0/screenWidthInPixels + // {_y} = 1.0/screenHeightInPixels + FxaaFloat2 fxaaQualityRcpFrame, + // + // Only used on FXAA Console. + // This must be from a constant/uniform. + // This effects sub-pixel AA quality and inversely sharpness. + // Where N ranges between, + // N = 0.50 (default) + // N = 0.33 (sharper) + // {x___} = -N/screenWidthInPixels + // {_y__} = -N/screenHeightInPixels + // {__z_} = N/screenWidthInPixels + // {___w} = N/screenHeightInPixels + FxaaFloat4 fxaaConsoleRcpFrameOpt, + // + // Only used on FXAA Console. + // Not used on 360, but used on PS3 and PC. + // This must be from a constant/uniform. + // {x___} = -2.0/screenWidthInPixels + // {_y__} = -2.0/screenHeightInPixels + // {__z_} = 2.0/screenWidthInPixels + // {___w} = 2.0/screenHeightInPixels + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + // + // Only used on FXAA Console. + // Only used on 360 in place of fxaaConsoleRcpFrameOpt2. + // This must be from a constant/uniform. + // {x___} = 8.0/screenWidthInPixels + // {_y__} = 8.0/screenHeightInPixels + // {__z_} = -4.0/screenWidthInPixels + // {___w} = -4.0/screenHeightInPixels + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__SUBPIX define. + // It is here now to allow easier tuning. + // Choose the amount of sub-pixel aliasing removal. + // This can effect sharpness. + // 1.00 - upper limit (softer) + // 0.75 - default amount of filtering + // 0.50 - lower limit (sharper, less sub-pixel aliasing removal) + // 0.25 - almost off + // 0.00 - completely off + FxaaFloat fxaaQualitySubpix, + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__EDGE_THRESHOLD define. + // It is here now to allow easier tuning. + // The minimum amount of local contrast required to apply algorithm. + // 0.333 - too little (faster) + // 0.250 - low quality + // 0.166 - default + // 0.125 - high quality + // 0.063 - overkill (slower) + FxaaFloat fxaaQualityEdgeThreshold, + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__EDGE_THRESHOLD_MIN define. + // It is here now to allow easier tuning. + // Trims the algorithm from processing darks. + // 0.0833 - upper limit (default, the start of visible unfiltered edges) + // 0.0625 - high quality (faster) + // 0.0312 - visible limit (slower) + // Special notes when using FXAA_GREEN_AS_LUMA, + // Likely want to set this to zero. + // As colors that are mostly not-green + // will appear very dark in the green channel! + // Tune by looking at mostly non-green content, + // then start at zero and increase until aliasing is a problem. + FxaaFloat fxaaQualityEdgeThresholdMin, + // + // Only used on FXAA Console. + // This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define. + // It is here now to allow easier tuning. + // This does not effect PS3, as this needs to be compiled in. + // Use FXAA_CONSOLE__PS3_EDGE_SHARPNESS for PS3. + // Due to the PS3 being ALU bound, + // there are only three safe values here: 2 and 4 and 8. + // These options use the shaders ability to a free *|/ by 2|4|8. + // For all other platforms can be a non-power of two. + // 8.0 is sharper (default!!!) + // 4.0 is softer + // 2.0 is really soft (good only for vector graphics inputs) + FxaaFloat fxaaConsoleEdgeSharpness, + // + // Only used on FXAA Console. + // This used to be the FXAA_CONSOLE__EDGE_THRESHOLD define. + // It is here now to allow easier tuning. + // This does not effect PS3, as this needs to be compiled in. + // Use FXAA_CONSOLE__PS3_EDGE_THRESHOLD for PS3. + // Due to the PS3 being ALU bound, + // there are only two safe values here: 1/4 and 1/8. + // These options use the shaders ability to a free *|/ by 2|4|8. + // The console setting has a different mapping than the quality setting. + // Other platforms can use other values. + // 0.125 leaves less aliasing, but is softer (default!!!) + // 0.25 leaves more aliasing, and is sharper + FxaaFloat fxaaConsoleEdgeThreshold, + // + // Only used on FXAA Console. + // This used to be the FXAA_CONSOLE__EDGE_THRESHOLD_MIN define. + // It is here now to allow easier tuning. + // Trims the algorithm from processing darks. + // The console setting has a different mapping than the quality setting. + // This only applies when FXAA_EARLY_EXIT is 1. + // This does not apply to PS3, + // PS3 was simplified to avoid more shader instructions. + // 0.06 - faster but more aliasing in darks + // 0.05 - default + // 0.04 - slower and less aliasing in darks + // Special notes when using FXAA_GREEN_AS_LUMA, + // Likely want to set this to zero. + // As colors that are mostly not-green + // will appear very dark in the green channel! + // Tune by looking at mostly non-green content, + // then start at zero and increase until aliasing is a problem. + FxaaFloat fxaaConsoleEdgeThresholdMin, + // + // Extra constants for 360 FXAA Console only. + // Use zeros or anything else for other platforms. + // These must be in physical constant registers and NOT immedates. + // Immedates will result in compiler un-optimizing. + // {xyzw} = float4(1.0, -1.0, 0.25, -0.25) + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ + FxaaFloat2 posM; + posM.x = pos.x; + posM.y = pos.y; + #if (FXAA_GATHER4_ALPHA == 1) + #if (FXAA_DISCARD == 0) + FxaaFloat4 rgbyM = FxaaTexTop(tex, posM); + #if (FXAA_GREEN_AS_LUMA == 0) + #define lumaM rgbyM.w + #else + #define lumaM rgbyM.y + #endif + #endif + #if (FXAA_GREEN_AS_LUMA == 0) + FxaaFloat4 luma4A = FxaaTexAlpha4(tex, posM); + FxaaFloat4 luma4B = FxaaTexOffAlpha4(tex, posM, FxaaInt2(-1, -1)); + #else + FxaaFloat4 luma4A = FxaaTexGreen4(tex, posM); + FxaaFloat4 luma4B = FxaaTexOffGreen4(tex, posM, FxaaInt2(-1, -1)); + #endif + #if (FXAA_DISCARD == 1) + #define lumaM luma4A.w + #endif + #define lumaE luma4A.z + #define lumaS luma4A.x + #define lumaSE luma4A.y + #define lumaNW luma4B.w + #define lumaN luma4B.z + #define lumaW luma4B.x + #else + FxaaFloat4 rgbyM = FxaaTexTop(tex, posM); + #if (FXAA_GREEN_AS_LUMA == 0) + #define lumaM rgbyM.w + #else + #define lumaM rgbyM.y + #endif + FxaaFloat lumaS = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0, 1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 0), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaN = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 0,-1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 0), fxaaQualityRcpFrame.xy)); + #endif +/*--------------------------------------------------------------------------*/ + FxaaFloat maxSM = max(lumaS, lumaM); + FxaaFloat minSM = min(lumaS, lumaM); + FxaaFloat maxESM = max(lumaE, maxSM); + FxaaFloat minESM = min(lumaE, minSM); + FxaaFloat maxWN = max(lumaN, lumaW); + FxaaFloat minWN = min(lumaN, lumaW); + FxaaFloat rangeMax = max(maxWN, maxESM); + FxaaFloat rangeMin = min(minWN, minESM); + FxaaFloat rangeMaxScaled = rangeMax * fxaaQualityEdgeThreshold; + FxaaFloat range = rangeMax - rangeMin; + FxaaFloat rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled); + FxaaBool earlyExit = range < rangeMaxClamped; +/*--------------------------------------------------------------------------*/ + if(earlyExit) + #if (FXAA_DISCARD == 1) + FxaaDiscard; + #else + return rgbyM; + #endif +/*--------------------------------------------------------------------------*/ + #if (FXAA_GATHER4_ALPHA == 0) + FxaaFloat lumaNW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1,-1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaSE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1, 1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2( 1,-1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy)); + #else + FxaaFloat lumaNE = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(1, -1), fxaaQualityRcpFrame.xy)); + FxaaFloat lumaSW = FxaaLuma(FxaaTexOff(tex, posM, FxaaInt2(-1, 1), fxaaQualityRcpFrame.xy)); + #endif +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaNS = lumaN + lumaS; + FxaaFloat lumaWE = lumaW + lumaE; + FxaaFloat subpixRcpRange = 1.0/range; + FxaaFloat subpixNSWE = lumaNS + lumaWE; + FxaaFloat edgeHorz1 = (-2.0 * lumaM) + lumaNS; + FxaaFloat edgeVert1 = (-2.0 * lumaM) + lumaWE; +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaNESE = lumaNE + lumaSE; + FxaaFloat lumaNWNE = lumaNW + lumaNE; + FxaaFloat edgeHorz2 = (-2.0 * lumaE) + lumaNESE; + FxaaFloat edgeVert2 = (-2.0 * lumaN) + lumaNWNE; +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaNWSW = lumaNW + lumaSW; + FxaaFloat lumaSWSE = lumaSW + lumaSE; + FxaaFloat edgeHorz4 = (abs(edgeHorz1) * 2.0) + abs(edgeHorz2); + FxaaFloat edgeVert4 = (abs(edgeVert1) * 2.0) + abs(edgeVert2); + FxaaFloat edgeHorz3 = (-2.0 * lumaW) + lumaNWSW; + FxaaFloat edgeVert3 = (-2.0 * lumaS) + lumaSWSE; + FxaaFloat edgeHorz = abs(edgeHorz3) + edgeHorz4; + FxaaFloat edgeVert = abs(edgeVert3) + edgeVert4; +/*--------------------------------------------------------------------------*/ + FxaaFloat subpixNWSWNESE = lumaNWSW + lumaNESE; + FxaaFloat lengthSign = fxaaQualityRcpFrame.x; + FxaaBool horzSpan = edgeHorz >= edgeVert; + FxaaFloat subpixA = subpixNSWE * 2.0 + subpixNWSWNESE; +/*--------------------------------------------------------------------------*/ + if(!horzSpan) lumaN = lumaW; + if(!horzSpan) lumaS = lumaE; + if(horzSpan) lengthSign = fxaaQualityRcpFrame.y; + FxaaFloat subpixB = (subpixA * (1.0/12.0)) - lumaM; +/*--------------------------------------------------------------------------*/ + FxaaFloat gradientN = lumaN - lumaM; + FxaaFloat gradientS = lumaS - lumaM; + FxaaFloat lumaNN = lumaN + lumaM; + FxaaFloat lumaSS = lumaS + lumaM; + FxaaBool pairN = abs(gradientN) >= abs(gradientS); + FxaaFloat gradient = max(abs(gradientN), abs(gradientS)); + if(pairN) lengthSign = -lengthSign; + FxaaFloat subpixC = FxaaSat(abs(subpixB) * subpixRcpRange); +/*--------------------------------------------------------------------------*/ + FxaaFloat2 posB; + posB.x = posM.x; + posB.y = posM.y; + FxaaFloat2 offNP; + offNP.x = (!horzSpan) ? 0.0 : fxaaQualityRcpFrame.x; + offNP.y = ( horzSpan) ? 0.0 : fxaaQualityRcpFrame.y; + if(!horzSpan) posB.x += lengthSign * 0.5; + if( horzSpan) posB.y += lengthSign * 0.5; +/*--------------------------------------------------------------------------*/ + FxaaFloat2 posN; + posN.x = posB.x - offNP.x * FXAA_QUALITY__P0; + posN.y = posB.y - offNP.y * FXAA_QUALITY__P0; + FxaaFloat2 posP; + posP.x = posB.x + offNP.x * FXAA_QUALITY__P0; + posP.y = posB.y + offNP.y * FXAA_QUALITY__P0; + FxaaFloat subpixD = ((-2.0)*subpixC) + 3.0; + FxaaFloat lumaEndN = FxaaLuma(FxaaTexTop(tex, posN)); + FxaaFloat subpixE = subpixC * subpixC; + FxaaFloat lumaEndP = FxaaLuma(FxaaTexTop(tex, posP)); +/*--------------------------------------------------------------------------*/ + if(!pairN) lumaNN = lumaSS; + FxaaFloat gradientScaled = gradient * 1.0/4.0; + FxaaFloat lumaMM = lumaM - lumaNN * 0.5; + FxaaFloat subpixF = subpixD * subpixE; + FxaaBool lumaMLTZero = lumaMM < 0.0; +/*--------------------------------------------------------------------------*/ + lumaEndN -= lumaNN * 0.5; + lumaEndP -= lumaNN * 0.5; + FxaaBool doneN = abs(lumaEndN) >= gradientScaled; + FxaaBool doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P1; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P1; + FxaaBool doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P1; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P1; +/*--------------------------------------------------------------------------*/ + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P2; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P2; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P2; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P2; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 3) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P3; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P3; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P3; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P3; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 4) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P4; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P4; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P4; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P4; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 5) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P5; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P5; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P5; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P5; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 6) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P6; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P6; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P6; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P6; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 7) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P7; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P7; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P7; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P7; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 8) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P8; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P8; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P8; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P8; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 9) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P9; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P9; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P9; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P9; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 10) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P10; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P10; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P10; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P10; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 11) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P11; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P11; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P11; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P11; +/*--------------------------------------------------------------------------*/ + #if (FXAA_QUALITY__PS > 12) + if(doneNP) { + if(!doneN) lumaEndN = FxaaLuma(FxaaTexTop(tex, posN.xy)); + if(!doneP) lumaEndP = FxaaLuma(FxaaTexTop(tex, posP.xy)); + if(!doneN) lumaEndN = lumaEndN - lumaNN * 0.5; + if(!doneP) lumaEndP = lumaEndP - lumaNN * 0.5; + doneN = abs(lumaEndN) >= gradientScaled; + doneP = abs(lumaEndP) >= gradientScaled; + if(!doneN) posN.x -= offNP.x * FXAA_QUALITY__P12; + if(!doneN) posN.y -= offNP.y * FXAA_QUALITY__P12; + doneNP = (!doneN) || (!doneP); + if(!doneP) posP.x += offNP.x * FXAA_QUALITY__P12; + if(!doneP) posP.y += offNP.y * FXAA_QUALITY__P12; +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } + #endif +/*--------------------------------------------------------------------------*/ + } +/*--------------------------------------------------------------------------*/ + FxaaFloat dstN = posM.x - posN.x; + FxaaFloat dstP = posP.x - posM.x; + if(!horzSpan) dstN = posM.y - posN.y; + if(!horzSpan) dstP = posP.y - posM.y; +/*--------------------------------------------------------------------------*/ + FxaaBool goodSpanN = (lumaEndN < 0.0) != lumaMLTZero; + FxaaFloat spanLength = (dstP + dstN); + FxaaBool goodSpanP = (lumaEndP < 0.0) != lumaMLTZero; + FxaaFloat spanLengthRcp = 1.0/spanLength; +/*--------------------------------------------------------------------------*/ + FxaaBool directionN = dstN < dstP; + FxaaFloat dst = min(dstN, dstP); + FxaaBool goodSpan = directionN ? goodSpanN : goodSpanP; + FxaaFloat subpixG = subpixF * subpixF; + FxaaFloat pixelOffset = (dst * (-spanLengthRcp)) + 0.5; + FxaaFloat subpixH = subpixG * fxaaQualitySubpix; +/*--------------------------------------------------------------------------*/ + FxaaFloat pixelOffsetGood = goodSpan ? pixelOffset : 0.0; + FxaaFloat pixelOffsetSubpix = max(pixelOffsetGood, subpixH); + if(!horzSpan) posM.x += pixelOffsetSubpix * lengthSign; + if( horzSpan) posM.y += pixelOffsetSubpix * lengthSign; + #if (FXAA_DISCARD == 1) + return FxaaTexTop(tex, posM); + #else + return FxaaFloat4(FxaaTexTop(tex, posM).xyz, lumaM); + #endif +} +/*==========================================================================*/ +#endif + + + + +/*============================================================================ + + FXAA3 CONSOLE - PC VERSION + +------------------------------------------------------------------------------ +Instead of using this on PC, I'd suggest just using FXAA Quality with + #define FXAA_QUALITY__PRESET 10 +Or + #define FXAA_QUALITY__PRESET 20 +Either are higher qualilty and almost as fast as this on modern PC GPUs. +============================================================================*/ +#if (FXAA_PC_CONSOLE == 1) +/*--------------------------------------------------------------------------*/ +FxaaFloat4 FxaaPixelShader( + // See FXAA Quality FxaaPixelShader() source for docs on Inputs! + FxaaFloat2 pos, + FxaaFloat4 fxaaConsolePosPos, + FxaaTex tex, + FxaaTex fxaaConsole360TexExpBiasNegOne, + FxaaTex fxaaConsole360TexExpBiasNegTwo, + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaNw = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.xy)); + FxaaFloat lumaSw = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.xw)); + FxaaFloat lumaNe = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.zy)); + FxaaFloat lumaSe = FxaaLuma(FxaaTexTop(tex, fxaaConsolePosPos.zw)); +/*--------------------------------------------------------------------------*/ + FxaaFloat4 rgbyM = FxaaTexTop(tex, pos.xy); + #if (FXAA_GREEN_AS_LUMA == 0) + FxaaFloat lumaM = rgbyM.w; + #else + FxaaFloat lumaM = rgbyM.y; + #endif +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMaxNwSw = max(lumaNw, lumaSw); + lumaNe += 1.0/384.0; + FxaaFloat lumaMinNwSw = min(lumaNw, lumaSw); +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMaxNeSe = max(lumaNe, lumaSe); + FxaaFloat lumaMinNeSe = min(lumaNe, lumaSe); +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMax = max(lumaMaxNeSe, lumaMaxNwSw); + FxaaFloat lumaMin = min(lumaMinNeSe, lumaMinNwSw); +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMaxScaled = lumaMax * fxaaConsoleEdgeThreshold; +/*--------------------------------------------------------------------------*/ + FxaaFloat lumaMinM = min(lumaMin, lumaM); + FxaaFloat lumaMaxScaledClamped = max(fxaaConsoleEdgeThresholdMin, lumaMaxScaled); + FxaaFloat lumaMaxM = max(lumaMax, lumaM); + FxaaFloat dirSwMinusNe = lumaSw - lumaNe; + FxaaFloat lumaMaxSubMinM = lumaMaxM - lumaMinM; + FxaaFloat dirSeMinusNw = lumaSe - lumaNw; + if(lumaMaxSubMinM < lumaMaxScaledClamped) return rgbyM; +/*--------------------------------------------------------------------------*/ + FxaaFloat2 dir; + dir.x = dirSwMinusNe + dirSeMinusNw; + dir.y = dirSwMinusNe - dirSeMinusNw; +/*--------------------------------------------------------------------------*/ + FxaaFloat2 dir1 = normalize(dir.xy); + FxaaFloat4 rgbyN1 = FxaaTexTop(tex, pos.xy - dir1 * fxaaConsoleRcpFrameOpt.zw); + FxaaFloat4 rgbyP1 = FxaaTexTop(tex, pos.xy + dir1 * fxaaConsoleRcpFrameOpt.zw); +/*--------------------------------------------------------------------------*/ + FxaaFloat dirAbsMinTimesC = min(abs(dir1.x), abs(dir1.y)) * fxaaConsoleEdgeSharpness; + FxaaFloat2 dir2 = clamp(dir1.xy / dirAbsMinTimesC, -2.0, 2.0); +/*--------------------------------------------------------------------------*/ + FxaaFloat4 rgbyN2 = FxaaTexTop(tex, pos.xy - dir2 * fxaaConsoleRcpFrameOpt2.zw); + FxaaFloat4 rgbyP2 = FxaaTexTop(tex, pos.xy + dir2 * fxaaConsoleRcpFrameOpt2.zw); +/*--------------------------------------------------------------------------*/ + FxaaFloat4 rgbyA = rgbyN1 + rgbyP1; + FxaaFloat4 rgbyB = ((rgbyN2 + rgbyP2) * 0.25) + (rgbyA * 0.25); +/*--------------------------------------------------------------------------*/ + #if (FXAA_GREEN_AS_LUMA == 0) + FxaaBool twoTap = (rgbyB.w < lumaMin) || (rgbyB.w > lumaMax); + #else + FxaaBool twoTap = (rgbyB.y < lumaMin) || (rgbyB.y > lumaMax); + #endif + if(twoTap) rgbyB.xyz = rgbyA.xyz * 0.5; + return rgbyB; } +/*==========================================================================*/ +#endif + + + +/*============================================================================ + + FXAA3 CONSOLE - 360 PIXEL SHADER + +------------------------------------------------------------------------------ +This optimized version thanks to suggestions from Andy Luedke. +Should be fully tex bound in all cases. +As of the FXAA 3.11 release, I have still not tested this code, +however I fixed a bug which was in both FXAA 3.9 and FXAA 3.10. +And note this is replacing the old unoptimized version. +If it does not work, please let me know so I can fix it. +============================================================================*/ +#if (FXAA_360 == 1) +/*--------------------------------------------------------------------------*/ +[reduceTempRegUsage(4)] +float4 FxaaPixelShader( + // See FXAA Quality FxaaPixelShader() source for docs on Inputs! + FxaaFloat2 pos, + FxaaFloat4 fxaaConsolePosPos, + FxaaTex tex, + FxaaTex fxaaConsole360TexExpBiasNegOne, + FxaaTex fxaaConsole360TexExpBiasNegTwo, + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ + float4 lumaNwNeSwSe; + #if (FXAA_GREEN_AS_LUMA == 0) + asm { + tfetch2D lumaNwNeSwSe.w___, tex, pos.xy, OffsetX = -0.5, OffsetY = -0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe._w__, tex, pos.xy, OffsetX = 0.5, OffsetY = -0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe.__w_, tex, pos.xy, OffsetX = -0.5, OffsetY = 0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe.___w, tex, pos.xy, OffsetX = 0.5, OffsetY = 0.5, UseComputedLOD=false + }; + #else + asm { + tfetch2D lumaNwNeSwSe.y___, tex, pos.xy, OffsetX = -0.5, OffsetY = -0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe._y__, tex, pos.xy, OffsetX = 0.5, OffsetY = -0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe.__y_, tex, pos.xy, OffsetX = -0.5, OffsetY = 0.5, UseComputedLOD=false + tfetch2D lumaNwNeSwSe.___y, tex, pos.xy, OffsetX = 0.5, OffsetY = 0.5, UseComputedLOD=false + }; + #endif +/*--------------------------------------------------------------------------*/ + lumaNwNeSwSe.y += 1.0/384.0; + float2 lumaMinTemp = min(lumaNwNeSwSe.xy, lumaNwNeSwSe.zw); + float2 lumaMaxTemp = max(lumaNwNeSwSe.xy, lumaNwNeSwSe.zw); + float lumaMin = min(lumaMinTemp.x, lumaMinTemp.y); + float lumaMax = max(lumaMaxTemp.x, lumaMaxTemp.y); +/*--------------------------------------------------------------------------*/ + float4 rgbyM = tex2Dlod(tex, float4(pos.xy, 0.0, 0.0)); + #if (FXAA_GREEN_AS_LUMA == 0) + float lumaMinM = min(lumaMin, rgbyM.w); + float lumaMaxM = max(lumaMax, rgbyM.w); + #else + float lumaMinM = min(lumaMin, rgbyM.y); + float lumaMaxM = max(lumaMax, rgbyM.y); + #endif + if((lumaMaxM - lumaMinM) < max(fxaaConsoleEdgeThresholdMin, lumaMax * fxaaConsoleEdgeThreshold)) return rgbyM; +/*--------------------------------------------------------------------------*/ + float2 dir; + dir.x = dot(lumaNwNeSwSe, fxaaConsole360ConstDir.yyxx); + dir.y = dot(lumaNwNeSwSe, fxaaConsole360ConstDir.xyxy); + dir = normalize(dir); +/*--------------------------------------------------------------------------*/ + float4 dir1 = dir.xyxy * fxaaConsoleRcpFrameOpt.xyzw; +/*--------------------------------------------------------------------------*/ + float4 dir2; + float dirAbsMinTimesC = min(abs(dir.x), abs(dir.y)) * fxaaConsoleEdgeSharpness; + dir2 = saturate(fxaaConsole360ConstDir.zzww * dir.xyxy / dirAbsMinTimesC + 0.5); + dir2 = dir2 * fxaaConsole360RcpFrameOpt2.xyxy + fxaaConsole360RcpFrameOpt2.zwzw; +/*--------------------------------------------------------------------------*/ + float4 rgbyN1 = tex2Dlod(fxaaConsole360TexExpBiasNegOne, float4(pos.xy + dir1.xy, 0.0, 0.0)); + float4 rgbyP1 = tex2Dlod(fxaaConsole360TexExpBiasNegOne, float4(pos.xy + dir1.zw, 0.0, 0.0)); + float4 rgbyN2 = tex2Dlod(fxaaConsole360TexExpBiasNegTwo, float4(pos.xy + dir2.xy, 0.0, 0.0)); + float4 rgbyP2 = tex2Dlod(fxaaConsole360TexExpBiasNegTwo, float4(pos.xy + dir2.zw, 0.0, 0.0)); +/*--------------------------------------------------------------------------*/ + float4 rgbyA = rgbyN1 + rgbyP1; + float4 rgbyB = rgbyN2 + rgbyP2 + rgbyA * 0.5; +/*--------------------------------------------------------------------------*/ + float4 rgbyR = ((FxaaLuma(rgbyB) - lumaMax) > 0.0) ? rgbyA : rgbyB; + rgbyR = ((FxaaLuma(rgbyB) - lumaMin) > 0.0) ? rgbyR : rgbyA; + return rgbyR; } +/*==========================================================================*/ +#endif + + + +/*============================================================================ + + FXAA3 CONSOLE - OPTIMIZED PS3 PIXEL SHADER (NO EARLY EXIT) + +============================================================================== +The code below does not exactly match the assembly. +I have a feeling that 12 cycles is possible, but was not able to get there. +Might have to increase register count to get full performance. +Note this shader does not use perspective interpolation. + +Use the following cgc options, + + --fenable-bx2 --fastmath --fastprecision --nofloatbindings + +------------------------------------------------------------------------------ + NVSHADERPERF OUTPUT +------------------------------------------------------------------------------ +For reference and to aid in debug, output of NVShaderPerf should match this, + +Shader to schedule: + 0: texpkb h0.w(TRUE), v5.zyxx, #0 + 2: addh h2.z(TRUE), h0.w, constant(0.001953, 0.000000, 0.000000, 0.000000).x + 4: texpkb h0.w(TRUE), v5.xwxx, #0 + 6: addh h0.z(TRUE), -h2, h0.w + 7: texpkb h1.w(TRUE), v5, #0 + 9: addh h0.x(TRUE), h0.z, -h1.w + 10: addh h3.w(TRUE), h0.z, h1 + 11: texpkb h2.w(TRUE), v5.zwzz, #0 + 13: addh h0.z(TRUE), h3.w, -h2.w + 14: addh h0.x(TRUE), h2.w, h0 + 15: nrmh h1.xz(TRUE), h0_n + 16: minh_m8 h0.x(TRUE), |h1|, |h1.z| + 17: maxh h4.w(TRUE), h0, h1 + 18: divx h2.xy(TRUE), h1_n.xzzw, h0_n + 19: movr r1.zw(TRUE), v4.xxxy + 20: madr r2.xz(TRUE), -h1, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zzww, r1.zzww + 22: minh h5.w(TRUE), h0, h1 + 23: texpkb h0(TRUE), r2.xzxx, #0 + 25: madr r0.zw(TRUE), h1.xzxz, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w), r1 + 27: maxh h4.x(TRUE), h2.z, h2.w + 28: texpkb h1(TRUE), r0.zwzz, #0 + 30: addh_d2 h1(TRUE), h0, h1 + 31: madr r0.xy(TRUE), -h2, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz + 33: texpkb h0(TRUE), r0, #0 + 35: minh h4.z(TRUE), h2, h2.w + 36: fenct TRUE + 37: madr r1.xy(TRUE), h2, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz + 39: texpkb h2(TRUE), r1, #0 + 41: addh_d2 h0(TRUE), h0, h2 + 42: maxh h2.w(TRUE), h4, h4.x + 43: minh h2.x(TRUE), h5.w, h4.z + 44: addh_d2 h0(TRUE), h0, h1 + 45: slth h2.x(TRUE), h0.w, h2 + 46: sgth h2.w(TRUE), h0, h2 + 47: movh h0(TRUE), h0 + 48: addx.c0 rc(TRUE), h2, h2.w + 49: movh h0(c0.NE.x), h1 + +IPU0 ------ Simplified schedule: -------- +Pass | Unit | uOp | PC: Op +-----+--------+------+------------------------- + 1 | SCT0/1 | mov | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0; + | TEX | txl | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0; + | SCB1 | add | 2: ADDh h2.z, h0.--w-, const.--x-; + | | | + 2 | SCT0/1 | mov | 4: TXLr h0.w, g[TEX1].xwxx, const.xxxx, TEX0; + | TEX | txl | 4: TXLr h0.w, g[TEX1].xwxx, const.xxxx, TEX0; + | SCB1 | add | 6: ADDh h0.z,-h2, h0.--w-; + | | | + 3 | SCT0/1 | mov | 7: TXLr h1.w, g[TEX1], const.xxxx, TEX0; + | TEX | txl | 7: TXLr h1.w, g[TEX1], const.xxxx, TEX0; + | SCB0 | add | 9: ADDh h0.x, h0.z---,-h1.w---; + | SCB1 | add | 10: ADDh h3.w, h0.---z, h1; + | | | + 4 | SCT0/1 | mov | 11: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0; + | TEX | txl | 11: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0; + | SCB0 | add | 14: ADDh h0.x, h2.w---, h0; + | SCB1 | add | 13: ADDh h0.z, h3.--w-,-h2.--w-; + | | | + 5 | SCT1 | mov | 15: NRMh h1.xz, h0; + | SRB | nrm | 15: NRMh h1.xz, h0; + | SCB0 | min | 16: MINh*8 h0.x, |h1|, |h1.z---|; + | SCB1 | max | 17: MAXh h4.w, h0, h1; + | | | + 6 | SCT0 | div | 18: DIVx h2.xy, h1.xz--, h0; + | SCT1 | mov | 19: MOVr r1.zw, g[TEX0].--xy; + | SCB0 | mad | 20: MADr r2.xz,-h1, const.z-w-, r1.z-w-; + | SCB1 | min | 22: MINh h5.w, h0, h1; + | | | + 7 | SCT0/1 | mov | 23: TXLr h0, r2.xzxx, const.xxxx, TEX0; + | TEX | txl | 23: TXLr h0, r2.xzxx, const.xxxx, TEX0; + | SCB0 | max | 27: MAXh h4.x, h2.z---, h2.w---; + | SCB1 | mad | 25: MADr r0.zw, h1.--xz, const, r1; + | | | + 8 | SCT0/1 | mov | 28: TXLr h1, r0.zwzz, const.xxxx, TEX0; + | TEX | txl | 28: TXLr h1, r0.zwzz, const.xxxx, TEX0; + | SCB0/1 | add | 30: ADDh/2 h1, h0, h1; + | | | + 9 | SCT0 | mad | 31: MADr r0.xy,-h2, const.xy--, r1.zw--; + | SCT1 | mov | 33: TXLr h0, r0, const.zzzz, TEX0; + | TEX | txl | 33: TXLr h0, r0, const.zzzz, TEX0; + | SCB1 | min | 35: MINh h4.z, h2, h2.--w-; + | | | + 10 | SCT0 | mad | 37: MADr r1.xy, h2, const.xy--, r1.zw--; + | SCT1 | mov | 39: TXLr h2, r1, const.zzzz, TEX0; + | TEX | txl | 39: TXLr h2, r1, const.zzzz, TEX0; + | SCB0/1 | add | 41: ADDh/2 h0, h0, h2; + | | | + 11 | SCT0 | min | 43: MINh h2.x, h5.w---, h4.z---; + | SCT1 | max | 42: MAXh h2.w, h4, h4.---x; + | SCB0/1 | add | 44: ADDh/2 h0, h0, h1; + | | | + 12 | SCT0 | set | 45: SLTh h2.x, h0.w---, h2; + | SCT1 | set | 46: SGTh h2.w, h0, h2; + | SCB0/1 | mul | 47: MOVh h0, h0; + | | | + 13 | SCT0 | mad | 48: ADDxc0_s rc, h2, h2.w---; + | SCB0/1 | mul | 49: MOVh h0(NE0.xxxx), h1; + +Pass SCT TEX SCB + 1: 0% 100% 25% + 2: 0% 100% 25% + 3: 0% 100% 50% + 4: 0% 100% 50% + 5: 0% 0% 50% + 6: 100% 0% 75% + 7: 0% 100% 75% + 8: 0% 100% 100% + 9: 0% 100% 25% + 10: 0% 100% 100% + 11: 50% 0% 100% + 12: 50% 0% 100% + 13: 25% 0% 100% + +MEAN: 17% 61% 67% + +Pass SCT0 SCT1 TEX SCB0 SCB1 + 1: 0% 0% 100% 0% 100% + 2: 0% 0% 100% 0% 100% + 3: 0% 0% 100% 100% 100% + 4: 0% 0% 100% 100% 100% + 5: 0% 0% 0% 100% 100% + 6: 100% 100% 0% 100% 100% + 7: 0% 0% 100% 100% 100% + 8: 0% 0% 100% 100% 100% + 9: 0% 0% 100% 0% 100% + 10: 0% 0% 100% 100% 100% + 11: 100% 100% 0% 100% 100% + 12: 100% 100% 0% 100% 100% + 13: 100% 0% 0% 100% 100% + +MEAN: 30% 23% 61% 76% 100% +Fragment Performance Setup: Driver RSX Compiler, GPU RSX, Flags 0x5 +Results 13 cycles, 3 r regs, 923,076,923 pixels/s +============================================================================*/ +#if (FXAA_PS3 == 1) && (FXAA_EARLY_EXIT == 0) +/*--------------------------------------------------------------------------*/ +#pragma regcount 7 +#pragma disablepc all +#pragma option O3 +#pragma option OutColorPrec=fp16 +#pragma texformat default RGBA8 +/*==========================================================================*/ +half4 FxaaPixelShader( + // See FXAA Quality FxaaPixelShader() source for docs on Inputs! + FxaaFloat2 pos, + FxaaFloat4 fxaaConsolePosPos, + FxaaTex tex, + FxaaTex fxaaConsole360TexExpBiasNegOne, + FxaaTex fxaaConsole360TexExpBiasNegTwo, + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ +// (1) + half4 dir; + half4 lumaNe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zy, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + lumaNe.w += half(1.0/512.0); + dir.x = -lumaNe.w; + dir.z = -lumaNe.w; + #else + lumaNe.y += half(1.0/512.0); + dir.x = -lumaNe.y; + dir.z = -lumaNe.y; + #endif +/*--------------------------------------------------------------------------*/ +// (2) + half4 lumaSw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xw, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + dir.x += lumaSw.w; + dir.z += lumaSw.w; + #else + dir.x += lumaSw.y; + dir.z += lumaSw.y; + #endif +/*--------------------------------------------------------------------------*/ +// (3) + half4 lumaNw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xy, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + dir.x -= lumaNw.w; + dir.z += lumaNw.w; + #else + dir.x -= lumaNw.y; + dir.z += lumaNw.y; + #endif +/*--------------------------------------------------------------------------*/ +// (4) + half4 lumaSe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zw, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + dir.x += lumaSe.w; + dir.z -= lumaSe.w; + #else + dir.x += lumaSe.y; + dir.z -= lumaSe.y; + #endif +/*--------------------------------------------------------------------------*/ +// (5) + half4 dir1_pos; + dir1_pos.xy = normalize(dir.xyz).xz; + half dirAbsMinTimesC = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__PS3_EDGE_SHARPNESS); +/*--------------------------------------------------------------------------*/ +// (6) + half4 dir2_pos; + dir2_pos.xy = clamp(dir1_pos.xy / dirAbsMinTimesC, half(-2.0), half(2.0)); + dir1_pos.zw = pos.xy; + dir2_pos.zw = pos.xy; + half4 temp1N; + temp1N.xy = dir1_pos.zw - dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw; +/*--------------------------------------------------------------------------*/ +// (7) + temp1N = h4tex2Dlod(tex, half4(temp1N.xy, 0.0, 0.0)); + half4 rgby1; + rgby1.xy = dir1_pos.zw + dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw; +/*--------------------------------------------------------------------------*/ +// (8) + rgby1 = h4tex2Dlod(tex, half4(rgby1.xy, 0.0, 0.0)); + rgby1 = (temp1N + rgby1) * 0.5; +/*--------------------------------------------------------------------------*/ +// (9) + half4 temp2N; + temp2N.xy = dir2_pos.zw - dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw; + temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0)); +/*--------------------------------------------------------------------------*/ +// (10) + half4 rgby2; + rgby2.xy = dir2_pos.zw + dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw; + rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0)); + rgby2 = (temp2N + rgby2) * 0.5; +/*--------------------------------------------------------------------------*/ +// (11) + // compilier moves these scalar ops up to other cycles + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaMin = min(min(lumaNw.w, lumaSw.w), min(lumaNe.w, lumaSe.w)); + half lumaMax = max(max(lumaNw.w, lumaSw.w), max(lumaNe.w, lumaSe.w)); + #else + half lumaMin = min(min(lumaNw.y, lumaSw.y), min(lumaNe.y, lumaSe.y)); + half lumaMax = max(max(lumaNw.y, lumaSw.y), max(lumaNe.y, lumaSe.y)); + #endif + rgby2 = (rgby2 + rgby1) * 0.5; +/*--------------------------------------------------------------------------*/ +// (12) + #if (FXAA_GREEN_AS_LUMA == 0) + bool twoTapLt = rgby2.w < lumaMin; + bool twoTapGt = rgby2.w > lumaMax; + #else + bool twoTapLt = rgby2.y < lumaMin; + bool twoTapGt = rgby2.y > lumaMax; + #endif +/*--------------------------------------------------------------------------*/ +// (13) + if(twoTapLt || twoTapGt) rgby2 = rgby1; +/*--------------------------------------------------------------------------*/ + return rgby2; } +/*==========================================================================*/ +#endif + + + +/*============================================================================ + + FXAA3 CONSOLE - OPTIMIZED PS3 PIXEL SHADER (WITH EARLY EXIT) + +============================================================================== +The code mostly matches the assembly. +I have a feeling that 14 cycles is possible, but was not able to get there. +Might have to increase register count to get full performance. +Note this shader does not use perspective interpolation. + +Use the following cgc options, + + --fenable-bx2 --fastmath --fastprecision --nofloatbindings + +Use of FXAA_GREEN_AS_LUMA currently adds a cycle (16 clks). +Will look at fixing this for FXAA 3.12. +------------------------------------------------------------------------------ + NVSHADERPERF OUTPUT +------------------------------------------------------------------------------ +For reference and to aid in debug, output of NVShaderPerf should match this, + +Shader to schedule: + 0: texpkb h0.w(TRUE), v5.zyxx, #0 + 2: addh h2.y(TRUE), h0.w, constant(0.001953, 0.000000, 0.000000, 0.000000).x + 4: texpkb h1.w(TRUE), v5.xwxx, #0 + 6: addh h0.x(TRUE), h1.w, -h2.y + 7: texpkb h2.w(TRUE), v5.zwzz, #0 + 9: minh h4.w(TRUE), h2.y, h2 + 10: maxh h5.x(TRUE), h2.y, h2.w + 11: texpkb h0.w(TRUE), v5, #0 + 13: addh h3.w(TRUE), -h0, h0.x + 14: addh h0.x(TRUE), h0.w, h0 + 15: addh h0.z(TRUE), -h2.w, h0.x + 16: addh h0.x(TRUE), h2.w, h3.w + 17: minh h5.y(TRUE), h0.w, h1.w + 18: nrmh h2.xz(TRUE), h0_n + 19: minh_m8 h2.w(TRUE), |h2.x|, |h2.z| + 20: divx h4.xy(TRUE), h2_n.xzzw, h2_n.w + 21: movr r1.zw(TRUE), v4.xxxy + 22: maxh h2.w(TRUE), h0, h1 + 23: fenct TRUE + 24: madr r0.xy(TRUE), -h2.xzzw, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zwzz, r1.zwzz + 26: texpkb h0(TRUE), r0, #0 + 28: maxh h5.x(TRUE), h2.w, h5 + 29: minh h5.w(TRUE), h5.y, h4 + 30: madr r1.xy(TRUE), h2.xzzw, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).zwzz, r1.zwzz + 32: texpkb h2(TRUE), r1, #0 + 34: addh_d2 h2(TRUE), h0, h2 + 35: texpkb h1(TRUE), v4, #0 + 37: maxh h5.y(TRUE), h5.x, h1.w + 38: minh h4.w(TRUE), h1, h5 + 39: madr r0.xy(TRUE), -h4, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz + 41: texpkb h0(TRUE), r0, #0 + 43: addh_m8 h5.z(TRUE), h5.y, -h4.w + 44: madr r2.xy(TRUE), h4, constant(cConst5.x, cConst5.y, cConst5.z, cConst5.w).xyxx, r1.zwzz + 46: texpkb h3(TRUE), r2, #0 + 48: addh_d2 h0(TRUE), h0, h3 + 49: addh_d2 h3(TRUE), h0, h2 + 50: movh h0(TRUE), h3 + 51: slth h3.x(TRUE), h3.w, h5.w + 52: sgth h3.w(TRUE), h3, h5.x + 53: addx.c0 rc(TRUE), h3.x, h3 + 54: slth.c0 rc(TRUE), h5.z, h5 + 55: movh h0(c0.NE.w), h2 + 56: movh h0(c0.NE.x), h1 + +IPU0 ------ Simplified schedule: -------- +Pass | Unit | uOp | PC: Op +-----+--------+------+------------------------- + 1 | SCT0/1 | mov | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0; + | TEX | txl | 0: TXLr h0.w, g[TEX1].zyxx, const.xxxx, TEX0; + | SCB0 | add | 2: ADDh h2.y, h0.-w--, const.-x--; + | | | + 2 | SCT0/1 | mov | 4: TXLr h1.w, g[TEX1].xwxx, const.xxxx, TEX0; + | TEX | txl | 4: TXLr h1.w, g[TEX1].xwxx, const.xxxx, TEX0; + | SCB0 | add | 6: ADDh h0.x, h1.w---,-h2.y---; + | | | + 3 | SCT0/1 | mov | 7: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0; + | TEX | txl | 7: TXLr h2.w, g[TEX1].zwzz, const.xxxx, TEX0; + | SCB0 | max | 10: MAXh h5.x, h2.y---, h2.w---; + | SCB1 | min | 9: MINh h4.w, h2.---y, h2; + | | | + 4 | SCT0/1 | mov | 11: TXLr h0.w, g[TEX1], const.xxxx, TEX0; + | TEX | txl | 11: TXLr h0.w, g[TEX1], const.xxxx, TEX0; + | SCB0 | add | 14: ADDh h0.x, h0.w---, h0; + | SCB1 | add | 13: ADDh h3.w,-h0, h0.---x; + | | | + 5 | SCT0 | mad | 16: ADDh h0.x, h2.w---, h3.w---; + | SCT1 | mad | 15: ADDh h0.z,-h2.--w-, h0.--x-; + | SCB0 | min | 17: MINh h5.y, h0.-w--, h1.-w--; + | | | + 6 | SCT1 | mov | 18: NRMh h2.xz, h0; + | SRB | nrm | 18: NRMh h2.xz, h0; + | SCB1 | min | 19: MINh*8 h2.w, |h2.---x|, |h2.---z|; + | | | + 7 | SCT0 | div | 20: DIVx h4.xy, h2.xz--, h2.ww--; + | SCT1 | mov | 21: MOVr r1.zw, g[TEX0].--xy; + | SCB1 | max | 22: MAXh h2.w, h0, h1; + | | | + 8 | SCT0 | mad | 24: MADr r0.xy,-h2.xz--, const.zw--, r1.zw--; + | SCT1 | mov | 26: TXLr h0, r0, const.xxxx, TEX0; + | TEX | txl | 26: TXLr h0, r0, const.xxxx, TEX0; + | SCB0 | max | 28: MAXh h5.x, h2.w---, h5; + | SCB1 | min | 29: MINh h5.w, h5.---y, h4; + | | | + 9 | SCT0 | mad | 30: MADr r1.xy, h2.xz--, const.zw--, r1.zw--; + | SCT1 | mov | 32: TXLr h2, r1, const.xxxx, TEX0; + | TEX | txl | 32: TXLr h2, r1, const.xxxx, TEX0; + | SCB0/1 | add | 34: ADDh/2 h2, h0, h2; + | | | + 10 | SCT0/1 | mov | 35: TXLr h1, g[TEX0], const.xxxx, TEX0; + | TEX | txl | 35: TXLr h1, g[TEX0], const.xxxx, TEX0; + | SCB0 | max | 37: MAXh h5.y, h5.-x--, h1.-w--; + | SCB1 | min | 38: MINh h4.w, h1, h5; + | | | + 11 | SCT0 | mad | 39: MADr r0.xy,-h4, const.xy--, r1.zw--; + | SCT1 | mov | 41: TXLr h0, r0, const.zzzz, TEX0; + | TEX | txl | 41: TXLr h0, r0, const.zzzz, TEX0; + | SCB0 | mad | 44: MADr r2.xy, h4, const.xy--, r1.zw--; + | SCB1 | add | 43: ADDh*8 h5.z, h5.--y-,-h4.--w-; + | | | + 12 | SCT0/1 | mov | 46: TXLr h3, r2, const.xxxx, TEX0; + | TEX | txl | 46: TXLr h3, r2, const.xxxx, TEX0; + | SCB0/1 | add | 48: ADDh/2 h0, h0, h3; + | | | + 13 | SCT0/1 | mad | 49: ADDh/2 h3, h0, h2; + | SCB0/1 | mul | 50: MOVh h0, h3; + | | | + 14 | SCT0 | set | 51: SLTh h3.x, h3.w---, h5.w---; + | SCT1 | set | 52: SGTh h3.w, h3, h5.---x; + | SCB0 | set | 54: SLThc0 rc, h5.z---, h5; + | SCB1 | add | 53: ADDxc0_s rc, h3.---x, h3; + | | | + 15 | SCT0/1 | mul | 55: MOVh h0(NE0.wwww), h2; + | SCB0/1 | mul | 56: MOVh h0(NE0.xxxx), h1; + +Pass SCT TEX SCB + 1: 0% 100% 25% + 2: 0% 100% 25% + 3: 0% 100% 50% + 4: 0% 100% 50% + 5: 50% 0% 25% + 6: 0% 0% 25% + 7: 100% 0% 25% + 8: 0% 100% 50% + 9: 0% 100% 100% + 10: 0% 100% 50% + 11: 0% 100% 75% + 12: 0% 100% 100% + 13: 100% 0% 100% + 14: 50% 0% 50% + 15: 100% 0% 100% + +MEAN: 26% 60% 56% + +Pass SCT0 SCT1 TEX SCB0 SCB1 + 1: 0% 0% 100% 100% 0% + 2: 0% 0% 100% 100% 0% + 3: 0% 0% 100% 100% 100% + 4: 0% 0% 100% 100% 100% + 5: 100% 100% 0% 100% 0% + 6: 0% 0% 0% 0% 100% + 7: 100% 100% 0% 0% 100% + 8: 0% 0% 100% 100% 100% + 9: 0% 0% 100% 100% 100% + 10: 0% 0% 100% 100% 100% + 11: 0% 0% 100% 100% 100% + 12: 0% 0% 100% 100% 100% + 13: 100% 100% 0% 100% 100% + 14: 100% 100% 0% 100% 100% + 15: 100% 100% 0% 100% 100% + +MEAN: 33% 33% 60% 86% 80% +Fragment Performance Setup: Driver RSX Compiler, GPU RSX, Flags 0x5 +Results 15 cycles, 3 r regs, 800,000,000 pixels/s +============================================================================*/ +#if (FXAA_PS3 == 1) && (FXAA_EARLY_EXIT == 1) +/*--------------------------------------------------------------------------*/ +#pragma regcount 7 +#pragma disablepc all +#pragma option O2 +#pragma option OutColorPrec=fp16 +#pragma texformat default RGBA8 +/*==========================================================================*/ +half4 FxaaPixelShader( + // See FXAA Quality FxaaPixelShader() source for docs on Inputs! + FxaaFloat2 pos, + FxaaFloat4 fxaaConsolePosPos, + FxaaTex tex, + FxaaTex fxaaConsole360TexExpBiasNegOne, + FxaaTex fxaaConsole360TexExpBiasNegTwo, + FxaaFloat2 fxaaQualityRcpFrame, + FxaaFloat4 fxaaConsoleRcpFrameOpt, + FxaaFloat4 fxaaConsoleRcpFrameOpt2, + FxaaFloat4 fxaaConsole360RcpFrameOpt2, + FxaaFloat fxaaQualitySubpix, + FxaaFloat fxaaQualityEdgeThreshold, + FxaaFloat fxaaQualityEdgeThresholdMin, + FxaaFloat fxaaConsoleEdgeSharpness, + FxaaFloat fxaaConsoleEdgeThreshold, + FxaaFloat fxaaConsoleEdgeThresholdMin, + FxaaFloat4 fxaaConsole360ConstDir +) { +/*--------------------------------------------------------------------------*/ +// (1) + half4 rgbyNe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zy, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaNe = rgbyNe.w + half(1.0/512.0); + #else + half lumaNe = rgbyNe.y + half(1.0/512.0); + #endif +/*--------------------------------------------------------------------------*/ +// (2) + half4 lumaSw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xw, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaSwNegNe = lumaSw.w - lumaNe; + #else + half lumaSwNegNe = lumaSw.y - lumaNe; + #endif +/*--------------------------------------------------------------------------*/ +// (3) + half4 lumaNw = h4tex2Dlod(tex, half4(fxaaConsolePosPos.xy, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaMaxNwSw = max(lumaNw.w, lumaSw.w); + half lumaMinNwSw = min(lumaNw.w, lumaSw.w); + #else + half lumaMaxNwSw = max(lumaNw.y, lumaSw.y); + half lumaMinNwSw = min(lumaNw.y, lumaSw.y); + #endif +/*--------------------------------------------------------------------------*/ +// (4) + half4 lumaSe = h4tex2Dlod(tex, half4(fxaaConsolePosPos.zw, 0, 0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half dirZ = lumaNw.w + lumaSwNegNe; + half dirX = -lumaNw.w + lumaSwNegNe; + #else + half dirZ = lumaNw.y + lumaSwNegNe; + half dirX = -lumaNw.y + lumaSwNegNe; + #endif +/*--------------------------------------------------------------------------*/ +// (5) + half3 dir; + dir.y = 0.0; + #if (FXAA_GREEN_AS_LUMA == 0) + dir.x = lumaSe.w + dirX; + dir.z = -lumaSe.w + dirZ; + half lumaMinNeSe = min(lumaNe, lumaSe.w); + #else + dir.x = lumaSe.y + dirX; + dir.z = -lumaSe.y + dirZ; + half lumaMinNeSe = min(lumaNe, lumaSe.y); + #endif +/*--------------------------------------------------------------------------*/ +// (6) + half4 dir1_pos; + dir1_pos.xy = normalize(dir).xz; + half dirAbsMinTimes8 = min(abs(dir1_pos.x), abs(dir1_pos.y)) * half(FXAA_CONSOLE__PS3_EDGE_SHARPNESS); +/*--------------------------------------------------------------------------*/ +// (7) + half4 dir2_pos; + dir2_pos.xy = clamp(dir1_pos.xy / dirAbsMinTimes8, half(-2.0), half(2.0)); + dir1_pos.zw = pos.xy; + dir2_pos.zw = pos.xy; + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaMaxNeSe = max(lumaNe, lumaSe.w); + #else + half lumaMaxNeSe = max(lumaNe, lumaSe.y); + #endif +/*--------------------------------------------------------------------------*/ +// (8) + half4 temp1N; + temp1N.xy = dir1_pos.zw - dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw; + temp1N = h4tex2Dlod(tex, half4(temp1N.xy, 0.0, 0.0)); + half lumaMax = max(lumaMaxNwSw, lumaMaxNeSe); + half lumaMin = min(lumaMinNwSw, lumaMinNeSe); +/*--------------------------------------------------------------------------*/ +// (9) + half4 rgby1; + rgby1.xy = dir1_pos.zw + dir1_pos.xy * fxaaConsoleRcpFrameOpt.zw; + rgby1 = h4tex2Dlod(tex, half4(rgby1.xy, 0.0, 0.0)); + rgby1 = (temp1N + rgby1) * 0.5; +/*--------------------------------------------------------------------------*/ +// (10) + half4 rgbyM = h4tex2Dlod(tex, half4(pos.xy, 0.0, 0.0)); + #if (FXAA_GREEN_AS_LUMA == 0) + half lumaMaxM = max(lumaMax, rgbyM.w); + half lumaMinM = min(lumaMin, rgbyM.w); + #else + half lumaMaxM = max(lumaMax, rgbyM.y); + half lumaMinM = min(lumaMin, rgbyM.y); + #endif +/*--------------------------------------------------------------------------*/ +// (11) + half4 temp2N; + temp2N.xy = dir2_pos.zw - dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw; + temp2N = h4tex2Dlod(tex, half4(temp2N.xy, 0.0, 0.0)); + half4 rgby2; + rgby2.xy = dir2_pos.zw + dir2_pos.xy * fxaaConsoleRcpFrameOpt2.zw; + half lumaRangeM = (lumaMaxM - lumaMinM) / FXAA_CONSOLE__PS3_EDGE_THRESHOLD; +/*--------------------------------------------------------------------------*/ +// (12) + rgby2 = h4tex2Dlod(tex, half4(rgby2.xy, 0.0, 0.0)); + rgby2 = (temp2N + rgby2) * 0.5; +/*--------------------------------------------------------------------------*/ +// (13) + rgby2 = (rgby2 + rgby1) * 0.5; +/*--------------------------------------------------------------------------*/ +// (14) + #if (FXAA_GREEN_AS_LUMA == 0) + bool twoTapLt = rgby2.w < lumaMin; + bool twoTapGt = rgby2.w > lumaMax; + #else + bool twoTapLt = rgby2.y < lumaMin; + bool twoTapGt = rgby2.y > lumaMax; + #endif + bool earlyExit = lumaRangeM < lumaMax; + bool twoTap = twoTapLt || twoTapGt; +/*--------------------------------------------------------------------------*/ +// (15) + if(twoTap) rgby2 = rgby1; + if(earlyExit) rgby2 = rgbyM; +/*--------------------------------------------------------------------------*/ + return rgby2; } +/*==========================================================================*/ +#endif diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/fxaaP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/fxaaP.hlsl new file mode 100644 index 000000000..269bfea67 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/fxaaP.hlsl @@ -0,0 +1,143 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModel.hlsl" + +#define FXAA_PC 1 +#if (TORQUE_SM <= 30) +#define FXAA_HLSL_3 1 +#elif TORQUE_SM < 49 +#define FXAA_HLSL_4 1 +#elif TORQUE_SM >=50 +#define FXAA_HLSL_5 1 +#endif +#define FXAA_QUALITY__PRESET 12 +#define FXAA_GREEN_AS_LUMA 1 + +#include "Fxaa3_11.h" + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + float2 uv0 : TEXCOORD0; +}; + +TORQUE_UNIFORM_SAMPLER2D(colorTex, 0); + +uniform float2 oneOverTargetSize; + + +float4 main( VertToPix IN ) : TORQUE_TARGET0 +{ +#if (TORQUE_SM >= 10 && TORQUE_SM <=30) + FxaaTex tex = colorTex; +#elif TORQUE_SM >=40 + FxaaTex tex; + tex.smpl = colorTex; + tex.tex = texture_colorTex; +#endif + + return FxaaPixelShader( + + IN.uv0, // vertex position + + 0, // Unused... console stuff + + tex, // The color back buffer + + tex, // Used for 360 optimization + + tex, // Used for 360 optimization + + oneOverTargetSize, + + 0, // Unused... console stuff + + 0, // Unused... console stuff + + 0, // Unused... console stuff + + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__SUBPIX define. + // It is here now to allow easier tuning. + // Choose the amount of sub-pixel aliasing removal. + // This can effect sharpness. + // 1.00 - upper limit (softer) + // 0.75 - default amount of filtering + // 0.50 - lower limit (sharper, less sub-pixel aliasing removal) + // 0.25 - almost off + // 0.00 - completely off + 0.75, + + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__EDGE_THRESHOLD define. + // It is here now to allow easier tuning. + // The minimum amount of local contrast required to apply algorithm. + // 0.333 - too little (faster) + // 0.250 - low quality + // 0.166 - default + // 0.125 - high quality + // 0.063 - overkill (slower) + 0.166, + + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__EDGE_THRESHOLD_MIN define. + // It is here now to allow easier tuning. + // Trims the algorithm from processing darks. + // 0.0833 - upper limit (default, the start of visible unfiltered edges) + // 0.0625 - high quality (faster) + // 0.0312 - visible limit (slower) + // Special notes when using FXAA_GREEN_AS_LUMA, + // Likely want to set this to zero. + // As colors that are mostly not-green + // will appear very dark in the green channel! + // Tune by looking at mostly non-green content, + // then start at zero and increase until aliasing is a problem. + 0, + + // + // Only used on FXAA Console. + // This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define. + // It is here now to allow easier tuning. + // This does not effect PS3, as this needs to be compiled in. + // Use FXAA_CONSOLE__PS3_EDGE_SHARPNESS for PS3. + // Due to the PS3 being ALU bound, + // there are only three safe values here: 2 and 4 and 8. + // These options use the shaders ability to a free *|/ by 2|4|8. + // For all other platforms can be a non-power of two. + // 8.0 is sharper (default!!!) + // 4.0 is softer + // 2.0 is really soft (good only for vector graphics inputs) + 8, + + 0, // Unused... console stuff + + 0, // Unused... console stuff + + 0 // Unused... console stuff + + ); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/fxaaV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/fxaaV.hlsl new file mode 100644 index 000000000..f2974c587 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/fxaaV.hlsl @@ -0,0 +1,42 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../../torque.hlsl" +#include "./../postFx.hlsl" + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + float2 uv0 : TEXCOORD0; +}; + +uniform float4 rtParams0; + +VertToPix main( PFXVert IN ) +{ + VertToPix OUT; + + OUT.hpos = float4(IN.pos,1); + OUT.uv0 = viewportCoordToRenderTarget( IN.uv, rtParams0 ); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/gl/fxaaP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/gl/fxaaP.glsl new file mode 100644 index 000000000..19d76ef42 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/gl/fxaaP.glsl @@ -0,0 +1,125 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define FXAA_PC 1 +#define FXAA_GLSL_130 1 +#define FXAA_QUALITY__PRESET 12 +#define FXAA_GREEN_AS_LUMA 1 + +#include "../Fxaa3_11.h" +#include "../../../gl/hlslCompat.glsl" + +uniform sampler2D colorTex ; +uniform vec2 oneOverTargetSize; + +in vec4 hpos; +in vec2 uv0; + +out vec4 OUT_col; + +void main() +{ + OUT_col = FxaaPixelShader( + + uv0, // vertex position + + vec4(0), // Unused... console stuff + + colorTex, // The color back buffer + + colorTex, // Used for 360 optimization + + colorTex, // Used for 360 optimization + + oneOverTargetSize, + + vec4(0), // Unused... console stuff + + vec4(0), // Unused... console stuff + + vec4(0), // Unused... console stuff + + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__SUBPIX define. + // It is here now to allow easier tuning. + // Choose the amount of sub-pixel aliasing removal. + // This can effect sharpness. + // 1.00 - upper limit (softer) + // 0.75 - default amount of filtering + // 0.50 - lower limit (sharper, less sub-pixel aliasing removal) + // 0.25 - almost off + // 0.00 - completely off + 0.75, + + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__EDGE_THRESHOLD define. + // It is here now to allow easier tuning. + // The minimum amount of local contrast required to apply algorithm. + // 0.333 - too little (faster) + // 0.250 - low quality + // 0.166 - default + // 0.125 - high quality + // 0.063 - overkill (slower) + 0.166, + + // + // Only used on FXAA Quality. + // This used to be the FXAA_QUALITY__EDGE_THRESHOLD_MIN define. + // It is here now to allow easier tuning. + // Trims the algorithm from processing darks. + // 0.0833 - upper limit (default, the start of visible unfiltered edges) + // 0.0625 - high quality (faster) + // 0.0312 - visible limit (slower) + // Special notes when using FXAA_GREEN_AS_LUMA, + // Likely want to set this to zero. + // As colors that are mostly not-green + // will appear very dark in the green channel! + // Tune by looking at mostly non-green content, + // then start at zero and increase until aliasing is a problem. + 0, + + // + // Only used on FXAA Console. + // This used to be the FXAA_CONSOLE__EDGE_SHARPNESS define. + // It is here now to allow easier tuning. + // This does not effect PS3, as this needs to be compiled in. + // Use FXAA_CONSOLE__PS3_EDGE_SHARPNESS for PS3. + // Due to the PS3 being ALU bound, + // there are only three safe values here: 2 and 4 and 8. + // These options use the shaders ability to a free *|/ by 2|4|8. + // For all other platforms can be a non-power of two. + // 8.0 is sharper (default!!!) + // 4.0 is softer + // 2.0 is really soft (good only for vector graphics inputs) + 8, + + 0, // Unused... console stuff + + 0, // Unused... console stuff + + vec4(0) // Unused... console stuff + + ); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/gl/fxaaV.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/gl/fxaaV.glsl new file mode 100644 index 000000000..55d445d91 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/fxaa/gl/fxaaV.glsl @@ -0,0 +1,40 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- +#include "../../../gl/hlslCompat.glsl" +#include "../../../gl/torque.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; + +uniform vec4 rtParams0; + +out vec4 hpos; +out vec2 uv0; + +void main() +{ + gl_Position = vPosition; + hpos = gl_Position; + uv0 = viewportCoordToRenderTarget( vTexCoord0, rtParams0 ); + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/gammaP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/gammaP.hlsl new file mode 100644 index 000000000..1e13d068b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/gammaP.hlsl @@ -0,0 +1,50 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shadergen:/autogenConditioners.h" +#include "./postFx.hlsl" +#include "../torque.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +TORQUE_UNIFORM_SAMPLER1D(colorCorrectionTex, 1); + +uniform float OneOverGamma; +uniform float Brightness; +uniform float Contrast; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float4 color = TORQUE_TEX2D(backBuffer, IN.uv0.xy); + + // Apply the color correction. + color.r = TORQUE_TEX1D( colorCorrectionTex, color.r ).r; + color.g = TORQUE_TEX1D( colorCorrectionTex, color.g ).g; + color.b = TORQUE_TEX1D( colorCorrectionTex, color.b ).b; + + // Apply contrast + color.rgb = ((color.rgb - 0.5f) * Contrast) + 0.5f; + + // Apply brightness + color.rgb += Brightness; + + return color; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/VolFogGlowP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/VolFogGlowP.glsl new file mode 100644 index 000000000..01b072dd9 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/VolFogGlowP.glsl @@ -0,0 +1,67 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2014 R.G.S. - Richards Game Studio, the Netherlands +// http://www.richardsgamestudio.com/ +// +// If you find this code useful or you are feeling particularly generous I +// would ask that you please go to http://www.richardsgamestudio.com/ then +// choose Donations from the menu on the left side and make a donation to +// Richards Game Studio. It will be highly appreciated. +// +// The MIT License: +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Volumetric Fog Glow postFx pixel shader V1.00 + +uniform sampler2D diffuseMap; +uniform float strength; + +out vec4 OUT_col; + +in vec2 uv0; +in vec2 uv1; +in vec2 uv2; +in vec2 uv3; + +in vec2 uv4; +in vec2 uv5; +in vec2 uv6; +in vec2 uv7; + +void main() +{ + vec4 kernel = vec4( 0.175, 0.275, 0.375, 0.475 ) * strength; + + OUT_col = vec4(0); + OUT_col += texture( diffuseMap, uv0 ) * kernel.x; + OUT_col += texture( diffuseMap, uv1 ) * kernel.y; + OUT_col += texture( diffuseMap, uv2 ) * kernel.z; + OUT_col += texture( diffuseMap, uv3 ) * kernel.w; + + OUT_col += texture( diffuseMap, uv4 ) * kernel.x; + OUT_col += texture( diffuseMap, uv5 ) * kernel.y; + OUT_col += texture( diffuseMap, uv6 ) * kernel.z; + OUT_col += texture( diffuseMap, uv7 ) * kernel.w; + + // Calculate a lumenance value in the alpha so we + // can use alpha test to save fillrate. + vec3 rgb2lum = vec3( 0.30, 0.59, 0.11 ); + OUT_col.a = dot( OUT_col.rgb, rgb2lum ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/chromaticLens.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/chromaticLens.glsl new file mode 100644 index 000000000..fdb85ba00 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/chromaticLens.glsl @@ -0,0 +1,62 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Based on 'Cubic Lens Distortion HLSL Shader' by François Tarlier +// www.francois-tarlier.com/blog/index.php/2009/11/cubic-lens-distortion-shader + +#include "./postFX.glsl" +#include "../../gl/torque.glsl" +#include "../../gl/hlslCompat.glsl" + +uniform sampler2D backBuffer; +uniform float distCoeff; +uniform float cubeDistort; +uniform vec3 colorDistort; + +out vec4 OUT_col; + +void main() +{ + vec2 tex = IN_uv0; + + float f = 0; + float r2 = (tex.x - 0.5) * (tex.x - 0.5) + (tex.y - 0.5) * (tex.y - 0.5); + + // Only compute the cubic distortion if necessary. + if ( cubeDistort == 0.0 ) + f = 1 + r2 * distCoeff; + else + f = 1 + r2 * (distCoeff + cubeDistort * sqrt(r2)); + + // Distort each color channel seperately to get a chromatic distortion effect. + vec3 outColor; + vec3 distort = vec3(f) + colorDistort; + + for ( int i=0; i < 3; i++ ) + { + float x = distort[i] * ( tex.x - 0.5 ) + 0.5; + float y = distort[i] * ( tex.y - 0.5 ) + 0.5; + outColor[i] = tex2Dlod( backBuffer, vec4(x,y,0,0) )[i]; + } + + OUT_col = vec4( outColor.rgb, 1 ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/flashP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/flashP.glsl new file mode 100644 index 000000000..fc5072e6d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/flashP.glsl @@ -0,0 +1,39 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./postFX.glsl" +#include "../../gl/torque.glsl" +#include "../../gl/hlslCompat.glsl" + +uniform float damageFlash; +uniform float whiteOut; +uniform sampler2D backBuffer; + +out vec4 OUT_col; + +void main() +{ + vec4 color1 = texture(backBuffer, IN_uv0); + vec4 color2 = color1 * MUL_COLOR; + vec4 damage = mix(color1,color2,damageFlash); + OUT_col = mix(damage,WHITE_COLOR,whiteOut); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/fogP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/fogP.glsl new file mode 100644 index 000000000..c2fe32fe4 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/fogP.glsl @@ -0,0 +1,52 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" + +#include "shadergen:/autogenConditioners.h" +#include "../../gl/torque.glsl" + +uniform sampler2D deferredTex ; +uniform vec3 eyePosWorld; +uniform vec4 fogColor; +uniform vec3 fogData; +uniform vec4 rtParams0; + +in vec2 uv0; +in vec3 wsEyeRay; + +out vec4 OUT_col; + +void main() +{ + //vec2 deferredCoord = ( uv0.xy * rtParams0.zw ) + rtParams0.xy; + float depth = deferredUncondition( deferredTex, uv0 ).w; + //return vec4( depth, 0, 0, 0.7 ); + + float factor = computeSceneFog( eyePosWorld, + eyePosWorld + ( wsEyeRay * depth ), + fogData.x, + fogData.y, + fogData.z ); + + OUT_col = hdrEncode( vec4( fogColor.rgb, 1.0 - saturate( factor ) ) ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/gammaP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/gammaP.glsl new file mode 100644 index 000000000..04533e494 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/gammaP.glsl @@ -0,0 +1,54 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" +#include "../../gl/torque.glsl" +#include "shadergen:/autogenConditioners.h" + +uniform sampler2D backBuffer; +uniform sampler1D colorCorrectionTex; + +uniform float OneOverGamma; +uniform float Brightness; +uniform float Contrast; + +in vec2 uv0; + +out vec4 OUT_col; + +void main() +{ + vec4 color = texture(backBuffer, uv0.xy); + + // Apply the color correction. + color.r = texture( colorCorrectionTex, color.r ).r; + color.g = texture( colorCorrectionTex, color.g ).g; + color.b = texture( colorCorrectionTex, color.b ).b; + + // Apply contrast + color.rgb = ((color.rgb - 0.5f) * Contrast) + 0.5f; + + // Apply brightness + color.rgb += Brightness; + + OUT_col = color; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/glowBlurP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/glowBlurP.glsl new file mode 100644 index 000000000..9ebca32fa --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/glowBlurP.glsl @@ -0,0 +1,59 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" + +uniform sampler2D diffuseMap ; + +in vec4 hpos; //POSITION; +in vec2 uv0; //TEXCOORD0; +in vec2 uv1; //TEXCOORD1; +in vec2 uv2; //TEXCOORD2; +in vec2 uv3; //TEXCOORD3; +in vec2 uv4; //TEXCOORD4; +in vec2 uv5; //TEXCOORD5; +in vec2 uv6; //TEXCOORD6; +in vec2 uv7; //TEXCOORD7; + +out vec4 OUT_col; + +void main() +{ + vec4 kernel = vec4( 0.175, 0.275, 0.375, 0.475 ) * 0.5f; + + OUT_col = vec4(0); + OUT_col += texture( diffuseMap, uv0 ) * kernel.x; + OUT_col += texture( diffuseMap, uv1 ) * kernel.y; + OUT_col += texture( diffuseMap, uv2 ) * kernel.z; + OUT_col += texture( diffuseMap, uv3 ) * kernel.w; + + OUT_col += texture( diffuseMap, uv4 ) * kernel.x; + OUT_col += texture( diffuseMap, uv5 ) * kernel.y; + OUT_col += texture( diffuseMap, uv6 ) * kernel.z; + OUT_col += texture( diffuseMap, uv7 ) * kernel.w; + + // Calculate a lumenance value in the alpha so we + // can use alpha test to save fillrate. + vec3 rgb2lum = vec3( 0.30, 0.59, 0.11 ); + OUT_col.a = dot( OUT_col.rgb, rgb2lum ); + +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/glowBlurV.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/glowBlurV.glsl new file mode 100644 index 000000000..70445d7fe --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/glowBlurV.glsl @@ -0,0 +1,59 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" +#include "../../gl/torque.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; + +uniform vec2 texSize0; + +out vec4 hpos; //POSITION; +out vec2 uv0; //TEXCOORD0; +out vec2 uv1; //TEXCOORD1; +out vec2 uv2; //TEXCOORD2; +out vec2 uv3; //TEXCOORD3; +out vec2 uv4; //TEXCOORD4; +out vec2 uv5; //TEXCOORD5; +out vec2 uv6; //TEXCOORD6; +out vec2 uv7; //TEXCOORD7; + +void main() +{ + gl_Position = vPosition; + hpos = gl_Position; + + vec2 uv = vTexCoord0 + (0.5f / texSize0); + + uv0 = uv + ( ( BLUR_DIR * 3.5f ) / texSize0 ); + uv1 = uv + ( ( BLUR_DIR * 2.5f ) / texSize0 ); + uv2 = uv + ( ( BLUR_DIR * 1.5f ) / texSize0 ); + uv3 = uv + ( ( BLUR_DIR * 0.5f ) / texSize0 ); + + uv4 = uv - ( ( BLUR_DIR * 3.5f ) / texSize0 ); + uv5 = uv - ( ( BLUR_DIR * 2.5f ) / texSize0 ); + uv6 = uv - ( ( BLUR_DIR * 1.5f ) / texSize0 ); + uv7 = uv - ( ( BLUR_DIR * 0.5f ) / texSize0 ); + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/motionBlurP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/motionBlurP.glsl new file mode 100644 index 000000000..8077d4124 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/gl/motionBlurP.glsl @@ -0,0 +1,78 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" +#include "../../gl/torque.glsl" +#include "shadergen:/autogenConditioners.h" +#include "postFX.glsl" + +#undef IN_uv0 +#define _IN_uv0 uv0 + +uniform mat4 matPrevScreenToWorld; +uniform mat4 matWorldToScreen; + +// Passed in from setShaderConsts() +uniform float velocityMultiplier; + +uniform sampler2D backBuffer; +uniform sampler2D deferredTex; + +out vec4 OUT_col; + +void main() +{ + vec2 IN_uv0 = _IN_uv0; + float samples = 5; + + // First get the deferred texture for uv channel 0 + vec4 deferred = deferredUncondition( deferredTex, IN_uv0 ); + + // Next extract the depth + float depth = deferred.a; + + // Create the screen position + vec4 screenPos = vec4(IN_uv0.x*2-1, IN_uv0.y*2-1, depth*2-1, 1); + + // Calculate the world position + vec4 D = tMul(screenPos, matWorldToScreen); + vec4 worldPos = D / D.w; + + // Now calculate the previous screen position + vec4 previousPos = tMul( worldPos, matPrevScreenToWorld ); + previousPos /= previousPos.w; + + // Calculate the XY velocity + vec2 velocity = ((screenPos - previousPos) / velocityMultiplier).xy; + + // Generate the motion blur + vec4 color = texture(backBuffer, IN_uv0); + IN_uv0 += velocity; + + for(int i = 1; i 0 ) + { + rayStart.z -= ( startSide ); + //return vec4( 1, 0, 0, 1 ); + } + + vec3 hitPos; + vec3 ray = rayEnd - rayStart; + float rayLen = length( ray ); + vec3 rayDir = normalize( ray ); + + float endSide = dot( plane.xyz, rayEnd ) + plane.w; + float planeDist; + + if ( endSide < -0.005 ) + { + //return vec4( 0, 0, 1, 1 ); + hitPos = rayEnd; + planeDist = endSide; + } + else + { + //return vec4( 0, 0, 0, 0 ); + float den = dot( ray, plane.xyz ); + + // Parallal to the plane, return the endPnt. + //if ( den == 0.0f ) + // return endPnt; + + float dist = -( dot( plane.xyz, rayStart ) + plane.w ) / den; + if ( dist < 0.0 ) + dist = 0.0; + //return vec4( 1, 0, 0, 1 ); + //return vec4( ( dist ).rrr, 1 ); + + + hitPos = mix( rayStart, rayEnd, dist ); + + planeDist = dist; + } + + float delta = length( hitPos - rayStart ); + + float fogAmt = 1.0 - saturate( exp( -FOG_DENSITY * ( delta - FOG_DENSITY_OFFSET ) ) ); + //return vec4( fogAmt.rrr, 1 ); + + // Calculate the water "base" color based on depth. + vec4 fogColor = waterColor * texture( waterDepthGradMap, saturate( delta / waterDepthGradMax ) ); + // Modulate baseColor by the ambientColor. + fogColor *= vec4( ambientColor.rgb, 1 ); + + vec3 inColor = hdrDecode( texture( backbuffer, IN_uv0 ).rgb ); + inColor.rgb *= 1.0 - saturate( abs( planeDist ) / WET_DEPTH ) * WET_DARKENING; + //return vec4( inColor, 1 ); + + vec3 outColor = mix( inColor, fogColor.rgb, fogAmt ); + + OUT_col = vec4( hdrEncode( outColor ), 1 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/glowBlurP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/glowBlurP.hlsl new file mode 100644 index 000000000..80f8ed02d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/glowBlurP.hlsl @@ -0,0 +1,63 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float2 uv2 : TEXCOORD2; + float2 uv3 : TEXCOORD3; + + float2 uv4 : TEXCOORD4; + float2 uv5 : TEXCOORD5; + float2 uv6 : TEXCOORD6; + float2 uv7 : TEXCOORD7; +}; + +float4 main( VertToPix IN ) : TORQUE_TARGET0 +{ + float4 kernel = float4( 0.175, 0.275, 0.375, 0.475 ) * 0.5f; + + float4 OUT = 0; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv0 ) * kernel.x; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv1 ) * kernel.y; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv2 ) * kernel.z; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv3 ) * kernel.w; + + OUT += TORQUE_TEX2D( diffuseMap, IN.uv4 ) * kernel.x; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv5 ) * kernel.y; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv6 ) * kernel.z; + OUT += TORQUE_TEX2D( diffuseMap, IN.uv7 ) * kernel.w; + + // Calculate a lumenance value in the alpha so we + // can use alpha test to save fillrate. + float3 rgb2lum = float3( 0.30, 0.59, 0.11 ); + OUT.a = dot( OUT.rgb, rgb2lum ); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/glowBlurV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/glowBlurV.hlsl new file mode 100644 index 000000000..b8f5cf9c2 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/glowBlurV.hlsl @@ -0,0 +1,63 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./postFx.hlsl" +#include "./../torque.hlsl" + + +uniform float2 texSize0; + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + + float2 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float2 uv2 : TEXCOORD2; + float2 uv3 : TEXCOORD3; + + float2 uv4 : TEXCOORD4; + float2 uv5 : TEXCOORD5; + float2 uv6 : TEXCOORD6; + float2 uv7 : TEXCOORD7; +}; + +VertToPix main( PFXVert IN ) +{ + VertToPix OUT; + + OUT.hpos = float4(IN.pos,1.0); + + float2 uv = IN.uv + (0.5f / texSize0); + + OUT.uv0 = uv + ( ( BLUR_DIR * 3.5f ) / texSize0 ); + OUT.uv1 = uv + ( ( BLUR_DIR * 2.5f ) / texSize0 ); + OUT.uv2 = uv + ( ( BLUR_DIR * 1.5f ) / texSize0 ); + OUT.uv3 = uv + ( ( BLUR_DIR * 0.5f ) / texSize0 ); + + OUT.uv4 = uv - ( ( BLUR_DIR * 3.5f ) / texSize0 ); + OUT.uv5 = uv - ( ( BLUR_DIR * 2.5f ) / texSize0 ); + OUT.uv6 = uv - ( ( BLUR_DIR * 1.5f ) / texSize0 ); + OUT.uv7 = uv - ( ( BLUR_DIR * 0.5f ) / texSize0 ); + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/bloomGaussBlurHP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/bloomGaussBlurHP.hlsl new file mode 100644 index 000000000..77f4b9915 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/bloomGaussBlurHP.hlsl @@ -0,0 +1,68 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(inputTex, 0); +uniform float2 oneOverTargetSize; +uniform float gaussMultiplier; +uniform float gaussMean; +uniform float gaussStdDev; + +#define PI 3.141592654 + +float computeGaussianValue( float x, float mean, float std_deviation ) +{ + // The gaussian equation is defined as such: + /* + -(x - mean)^2 + ------------- + 1.0 2*std_dev^2 + f(x,mean,std_dev) = -------------------- * e^ + sqrt(2*pi*std_dev^2) + + */ + + float tmp = ( 1.0f / sqrt( 2.0f * PI * std_deviation * std_deviation ) ); + float tmp2 = exp( ( -( ( x - mean ) * ( x - mean ) ) ) / ( 2.0f * std_deviation * std_deviation ) ); + return tmp * tmp2; +} + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float4 color = { 0.0f, 0.0f, 0.0f, 0.0f }; + float offset = 0; + float weight = 0; + float x = 0; + float fI = 0; + + for( int i = 0; i < 9; i++ ) + { + fI = (float)i; + offset = (i - 4.0) * oneOverTargetSize.x; + x = (i - 4.0) / 4.0; + weight = gaussMultiplier * computeGaussianValue( x, gaussMean, gaussStdDev ); + color += (TORQUE_TEX2D( inputTex, IN.uv0 + float2( offset, 0.0f ) ) * weight ); + } + + return float4( color.rgb, 1.0f ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/bloomGaussBlurVP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/bloomGaussBlurVP.hlsl new file mode 100644 index 000000000..8381f6a5d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/bloomGaussBlurVP.hlsl @@ -0,0 +1,67 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(inputTex, 0); +uniform float2 oneOverTargetSize; +uniform float gaussMultiplier; +uniform float gaussMean; +uniform float gaussStdDev; + +#define D3DX_PI 3.141592654 + +float computeGaussianValue( float x, float mean, float std_deviation ) +{ + // The gaussian equation is defined as such: + /* + -(x - mean)^2 + ------------- + 1.0 2*std_dev^2 + f(x,mean,std_dev) = -------------------- * e^ + sqrt(2*pi*std_dev^2) + + */ + float tmp = ( 1.0f / sqrt( 2.0f * D3DX_PI * std_deviation * std_deviation ) ); + float tmp2 = exp( ( -( ( x - mean ) * ( x - mean ) ) ) / ( 2.0f * std_deviation * std_deviation ) ); + return tmp * tmp2; +} + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float4 color = { 0.0f, 0.0f, 0.0f, 0.0f }; + float offset = 0; + float weight = 0; + float x = 0; + float fI = 0; + + for( int i = 0; i < 9; i++ ) + { + fI = (float)i; + offset = (fI - 4.0) * oneOverTargetSize.y; + x = (fI - 4.0) / 4.0; + weight = gaussMultiplier * computeGaussianValue( x, gaussMean, gaussStdDev ); + color += (TORQUE_TEX2D( inputTex, IN.uv0 + float2( 0.0f, offset ) ) * weight ); + } + + return float4( color.rgb, 1.0f ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/brightPassFilterP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/brightPassFilterP.hlsl new file mode 100644 index 000000000..9a8a93e97 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/brightPassFilterP.hlsl @@ -0,0 +1,62 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" +#include "../../torque.hlsl" + + +TORQUE_UNIFORM_SAMPLER2D(inputTex, 0); +TORQUE_UNIFORM_SAMPLER2D(luminanceTex, 1); +uniform float2 oneOverTargetSize; +uniform float brightPassThreshold; +uniform float g_fMiddleGray; + +static const float3 LUMINANCE_VECTOR = float3(0.3125f, 0.6154f, 0.0721f); + + +static float2 gTapOffsets[4] = +{ + { -0.5, 0.5 }, { 0.5, -0.5 }, + { -0.5, -0.5 }, { 0.5, 0.5 } +}; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float4 average = { 0.0f, 0.0f, 0.0f, 0.0f }; + + // Combine and average 4 samples from the source HDR texture. + for( int i = 0; i < 4; i++ ) + average += hdrDecode( TORQUE_TEX2D( inputTex, IN.uv0 + ( gTapOffsets[i] * oneOverTargetSize ) ) ); + average *= 0.25f; + + // Determine the brightness of this particular pixel. + float adaptedLum = TORQUE_TEX2D( luminanceTex, float2( 0.5f, 0.5f ) ).r; + float lum = (g_fMiddleGray / (adaptedLum + 0.0001)) * hdrLuminance( average.rgb ); + //float lum = hdrLuminance( average.rgb ); + + // Determine whether this pixel passes the test... + if ( lum < brightPassThreshold ) + average = float4( 0.0f, 0.0f, 0.0f, 1.0f ); + + // Write the colour to the bright-pass render target + return hdrEncode( average ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/calculateAdaptedLumP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/calculateAdaptedLumP.hlsl new file mode 100644 index 000000000..0f895070a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/calculateAdaptedLumP.hlsl @@ -0,0 +1,44 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(currLum, 0); +TORQUE_UNIFORM_SAMPLER2D(lastAdaptedLum, 1); + +uniform float adaptRate; +uniform float deltaTime; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float fAdaptedLum = TORQUE_TEX2D( lastAdaptedLum, float2(0.5f, 0.5f) ).r; + float fCurrentLum = TORQUE_TEX2D( currLum, float2(0.5f, 0.5f) ).r; + + // The user's adapted luminance level is simulated by closing the gap between + // adapted luminance and current luminance by 2% every frame, based on a + // 30 fps rate. This is not an accurate model of human adaptation, which can + // take longer than half an hour. + float diff = fCurrentLum - fAdaptedLum; + float fNewAdaptation = fAdaptedLum + ( diff * ( 1.0 - exp( -deltaTime * adaptRate ) ) ); + + return float4( fNewAdaptation, 0.0, 0.0, 1.0f ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/downScale4x4P.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/downScale4x4P.hlsl new file mode 100644 index 000000000..01998af0b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/downScale4x4P.hlsl @@ -0,0 +1,53 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define IN_HLSL +#include "../../shdrConsts.h" +#include "../postFx.hlsl" + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +struct VertIn +{ + float4 hpos : TORQUE_POSITION; + float4 texCoords[8] : TEXCOORD0; +}; + +TORQUE_UNIFORM_SAMPLER2D(inputTex, 0); + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +float4 main( VertIn IN) : TORQUE_TARGET0 +{ + // We calculate the texture coords + // in the vertex shader as an optimization. + float4 sample = 0.0f; + for ( int i = 0; i < 8; i++ ) + { + sample += TORQUE_TEX2D( inputTex, IN.texCoords[i].xy ); + sample += TORQUE_TEX2D( inputTex, IN.texCoords[i].zw ); + } + + return sample / 16; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/downScale4x4V.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/downScale4x4V.hlsl new file mode 100644 index 000000000..c9a34b7f4 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/downScale4x4V.hlsl @@ -0,0 +1,138 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define IN_HLSL +#include "../../shdrConsts.h" +#include "../postFx.hlsl" +//----------------------------------------------------------------------------- +// Constants +//----------------------------------------------------------------------------- + +struct Conn +{ + float4 hpos : TORQUE_POSITION; + float4 texCoords[8] : TEXCOORD0; +}; + +uniform float2 targetSize; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Conn main( PFXVert In ) +{ + Conn Out; + + Out.hpos = float4(In.pos,1.0); + + // Sample from the 16 surrounding points. Since the center point will be in + // the exact center of 16 texels, a 0.5f offset is needed to specify a texel + // center. + float2 texSize = float2( 1.0 / (targetSize.x - 1.0), 1.0 / (targetSize.y - 1.0) ); + + float4 uv; + uv.xy = In.uv.xy; + uv.zw = In.uv.xy; + + Out.texCoords[0] = uv; + Out.texCoords[0].x += texSize.x; + Out.texCoords[0].y += texSize.y; + Out.texCoords[0].z += texSize.x; + Out.texCoords[0].w += texSize.y; + Out.texCoords[0].x += ( 0 - 1.5 ) * texSize.x; + Out.texCoords[0].y += ( 0 - 1.5 ) * texSize.y; + Out.texCoords[0].z += ( 1 - 1.5 ) * texSize.x; + Out.texCoords[0].w += ( 0 - 1.5 ) * texSize.y; + + Out.texCoords[1] = uv; + Out.texCoords[1].x += texSize.x; + Out.texCoords[1].y += texSize.y; + Out.texCoords[1].z += texSize.x; + Out.texCoords[1].w += texSize.y; + Out.texCoords[1].x += ( 2 - 1.5 ) * texSize.x; + Out.texCoords[1].y += ( 0 - 1.5 ) * texSize.y; + Out.texCoords[1].z += ( 3 - 1.5 ) * texSize.x; + Out.texCoords[1].w += ( 0 - 1.5 ) * texSize.y; + + Out.texCoords[2] = uv; + Out.texCoords[2].x += texSize.x; + Out.texCoords[2].y += texSize.y; + Out.texCoords[2].z += texSize.x; + Out.texCoords[2].w += texSize.y; + Out.texCoords[2].x += ( 0 - 1.5 ) * texSize.x; + Out.texCoords[2].y += ( 1 - 1.5 ) * texSize.y; + Out.texCoords[2].z += ( 1 - 1.5 ) * texSize.x; + Out.texCoords[2].w += ( 1 - 1.5 ) * texSize.y; + + Out.texCoords[3] = uv; + Out.texCoords[3].x += texSize.x; + Out.texCoords[3].y += texSize.y; + Out.texCoords[3].z += texSize.x; + Out.texCoords[3].w += texSize.y; + Out.texCoords[3].x += ( 2 - 1.5 ) * texSize.x; + Out.texCoords[3].y += ( 1 - 1.5 ) * texSize.y; + Out.texCoords[3].z += ( 3 - 1.5 ) * texSize.x; + Out.texCoords[3].w += ( 1 - 1.5 ) * texSize.y; + + Out.texCoords[4] = uv; + Out.texCoords[4].x += texSize.x; + Out.texCoords[4].y += texSize.y; + Out.texCoords[4].z += texSize.x; + Out.texCoords[4].w += texSize.y; + Out.texCoords[4].x += ( 0 - 1.5 ) * texSize.x; + Out.texCoords[4].y += ( 2 - 1.5 ) * texSize.y; + Out.texCoords[4].z += ( 1 - 1.5 ) * texSize.x; + Out.texCoords[4].w += ( 2 - 1.5 ) * texSize.y; + + Out.texCoords[5] = uv; + Out.texCoords[5].x += texSize.x; + Out.texCoords[5].y += texSize.y; + Out.texCoords[5].z += texSize.x; + Out.texCoords[5].w += texSize.y; + Out.texCoords[5].x += ( 2 - 1.5 ) * texSize.x; + Out.texCoords[5].y += ( 2 - 1.5 ) * texSize.y; + Out.texCoords[5].z += ( 3 - 1.5 ) * texSize.x; + Out.texCoords[5].w += ( 2 - 1.5 ) * texSize.y; + + Out.texCoords[6] = uv; + Out.texCoords[6].x += texSize.x; + Out.texCoords[6].y += texSize.y; + Out.texCoords[6].z += texSize.x; + Out.texCoords[6].w += texSize.y; + Out.texCoords[6].x += ( 0 - 1.5 ) * texSize.x; + Out.texCoords[6].y += ( 3 - 1.5 ) * texSize.y; + Out.texCoords[6].z += ( 1 - 1.5 ) * texSize.x; + Out.texCoords[6].w += ( 3 - 1.5 ) * texSize.y; + + Out.texCoords[7] = uv; + Out.texCoords[7].x += texSize.x; + Out.texCoords[7].y += texSize.y; + Out.texCoords[7].z += texSize.x; + Out.texCoords[7].w += texSize.y; + Out.texCoords[7].x += ( 2 - 1.5 ) * texSize.x; + Out.texCoords[7].y += ( 3 - 1.5 ) * texSize.y; + Out.texCoords[7].z += ( 3 - 1.5 ) * texSize.x; + Out.texCoords[7].w += ( 3 - 1.5 ) * texSize.y; + + return Out; +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/finalPassCombineP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/finalPassCombineP.hlsl new file mode 100644 index 000000000..07f7276c3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/finalPassCombineP.hlsl @@ -0,0 +1,92 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../torque.hlsl" +#include "../postFx.hlsl" +#include "../../shaderModelAutoGen.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(sceneTex, 0); +TORQUE_UNIFORM_SAMPLER2D(luminanceTex, 1); +TORQUE_UNIFORM_SAMPLER2D(bloomTex, 2); +TORQUE_UNIFORM_SAMPLER1D(colorCorrectionTex, 3); + +uniform float2 texSize0; +uniform float2 texSize2; + +uniform float g_fEnableToneMapping; +uniform float g_fMiddleGray; +uniform float g_fWhiteCutoff; +uniform float g_fEnableBlueShift; + +uniform float3 g_fBlueShiftColor; +uniform float g_fBloomScale; +uniform float g_fOneOverGamma; +uniform float Brightness; +uniform float Contrast; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float4 sample = hdrDecode( TORQUE_TEX2D( sceneTex, IN.uv0 ) ); + float adaptedLum = TORQUE_TEX2D( luminanceTex, float2( 0.5f, 0.5f ) ).r; + float4 bloom = TORQUE_TEX2D( bloomTex, IN.uv0 ); + + // For very low light conditions, the rods will dominate the perception + // of light, and therefore color will be desaturated and shifted + // towards blue. + if ( g_fEnableBlueShift > 0.0f ) + { + const float3 LUMINANCE_VECTOR = float3(0.2125f, 0.7154f, 0.0721f); + + // Define a linear blending from -1.5 to 2.6 (log scale) which + // determines the lerp amount for blue shift + float coef = 1.0f - ( adaptedLum + 1.5 ) / 4.1; + coef = saturate( coef * g_fEnableBlueShift ); + + // Lerp between current color and blue, desaturated copy + float3 rodColor = dot( sample.rgb, LUMINANCE_VECTOR ) * g_fBlueShiftColor; + sample.rgb = lerp( sample.rgb, rodColor, coef ); + + rodColor = dot( bloom.rgb, LUMINANCE_VECTOR ) * g_fBlueShiftColor; + bloom.rgb = lerp( bloom.rgb, rodColor, coef ); + } + + // Add the bloom effect. + sample += g_fBloomScale * bloom; + + // Map the high range of color values into a range appropriate for + // display, taking into account the user's adaptation level, + // white point, and selected value for for middle gray. + if ( g_fEnableToneMapping > 0.0f ) + { + float Lp = (g_fMiddleGray / (adaptedLum + 0.0001)) * hdrLuminance( sample.rgb ); + //float toneScalar = ( Lp * ( 1.0 + ( Lp / ( g_fWhiteCutoff ) ) ) ) / ( 1.0 + Lp ); + float toneScalar = Lp; + sample.rgb = lerp( sample.rgb, sample.rgb * toneScalar, g_fEnableToneMapping ); + } + + // Apply the color correction. + sample.r = TORQUE_TEX1D( colorCorrectionTex, sample.r ).r; + sample.g = TORQUE_TEX1D( colorCorrectionTex, sample.g ).g; + sample.b = TORQUE_TEX1D( colorCorrectionTex, sample.b ).b; + + return sample; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/bloomGaussBlurHP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/bloomGaussBlurHP.glsl new file mode 100644 index 000000000..1d9a2df3e --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/bloomGaussBlurHP.glsl @@ -0,0 +1,72 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/postFX.glsl" + +uniform sampler2D inputTex ; +uniform vec2 oneOverTargetSize; +uniform float gaussMultiplier; +uniform float gaussMean; +uniform float gaussStdDev; + +out vec4 OUT_col; + +#define PI 3.141592654 + +float computeGaussianValue( float x, float mean, float std_deviation ) +{ + // The gaussian equation is defined as such: + /* + -(x - mean)^2 + ------------- + 1.0 2*std_dev^2 + f(x,mean,std_dev) = -------------------- * e^ + sqrt(2*pi*std_dev^2) + + */ + + float tmp = ( 1.0f / sqrt( 2.0f * PI * std_deviation * std_deviation ) ); + float tmp2 = exp( ( -( ( x - mean ) * ( x - mean ) ) ) / ( 2.0f * std_deviation * std_deviation ) ); + return tmp * tmp2; +} + +void main() +{ + vec4 color = vec4( 0.0f, 0.0f, 0.0f, 0.0f ); + float offset = 0; + float weight = 0; + float x = 0; + float fI = 0; + + for( int i = 0; i < 9; i++ ) + { + fI = float(i); + offset = (i - 4.0) * oneOverTargetSize.x; + x = (i - 4.0) / 4.0; + weight = gaussMultiplier * computeGaussianValue( x, gaussMean, gaussStdDev ); + color += (texture( inputTex, IN_uv0 + vec2( offset, 0.0f ) ) * weight ); + } + + OUT_col = vec4( color.rgb, 1.0f ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/bloomGaussBlurVP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/bloomGaussBlurVP.glsl new file mode 100644 index 000000000..68f34b164 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/bloomGaussBlurVP.glsl @@ -0,0 +1,71 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/postFX.glsl" + +uniform sampler2D inputTex ; +uniform vec2 oneOverTargetSize; +uniform float gaussMultiplier; +uniform float gaussMean; +uniform float gaussStdDev; + +out vec4 OUT_col; + +#define D3DX_PI 3.141592654 + +float computeGaussianValue( float x, float mean, float std_deviation ) +{ + // The gaussian equation is defined as such: + /* + -(x - mean)^2 + ------------- + 1.0 2*std_dev^2 + f(x,mean,std_dev) = -------------------- * e^ + sqrt(2*pi*std_dev^2) + + */ + float tmp = ( 1.0f / sqrt( 2.0f * D3DX_PI * std_deviation * std_deviation ) ); + float tmp2 = exp( ( -( ( x - mean ) * ( x - mean ) ) ) / ( 2.0f * std_deviation * std_deviation ) ); + return tmp * tmp2; +} + +void main() +{ + vec4 color = vec4( 0.0f, 0.0f, 0.0f, 0.0f ); + float offset = 0; + float weight = 0; + float x = 0; + float fI = 0; + + for( int i = 0; i < 9; i++ ) + { + fI = float(i); + offset = (fI - 4.0) * oneOverTargetSize.y; + x = (fI - 4.0) / 4.0; + weight = gaussMultiplier * computeGaussianValue( x, gaussMean, gaussStdDev ); + color += (texture( inputTex, IN_uv0 + vec2( 0.0f, offset ) ) * weight ); + } + + OUT_col = vec4( color.rgb, 1.0f ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/brightPassFilterP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/brightPassFilterP.glsl new file mode 100644 index 000000000..f220ca1e7 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/brightPassFilterP.glsl @@ -0,0 +1,65 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/torque.glsl" +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/postFX.glsl" + +uniform sampler2D inputTex ; +uniform sampler2D luminanceTex ; +uniform vec2 oneOverTargetSize; +uniform float brightPassThreshold; +uniform float g_fMiddleGray; + +const vec3 LUMINANCE_VECTOR = vec3(0.3125f, 0.6154f, 0.0721f); + +out vec4 OUT_col; + + +const vec2 gTapOffsets[4] = vec2[] +( + vec2( -0.5, 0.5 ), vec2( 0.5, -0.5 ), + vec2( -0.5, -0.5 ), vec2( 0.5, 0.5 ) +); + +void main() +{ + vec4 average = vec4( 0.0f, 0.0f, 0.0f, 0.0f ); + + // Combine and average 4 samples from the source HDR texture. + for( int i = 0; i < 4; i++ ) + average += hdrDecode( texture( inputTex, IN_uv0 + ( gTapOffsets[i] * oneOverTargetSize ) ) ); + average *= 0.25f; + + // Determine the brightness of this particular pixel. + float adaptedLum = texture( luminanceTex, vec2( 0.5f, 0.5f ) ).r; + float lum = (g_fMiddleGray / (adaptedLum + 0.0001)) * hdrLuminance( average.rgb ); + //float lum = hdrLuminance( average.rgb ); + + // Determine whether this pixel passes the test... + if ( lum < brightPassThreshold ) + average = vec4( 0.0f, 0.0f, 0.0f, 1.0f ); + + // Write the colour to the bright-pass render target + OUT_col = hdrEncode( average ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/calculateAdaptedLumP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/calculateAdaptedLumP.glsl new file mode 100644 index 000000000..96ee9d6df --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/calculateAdaptedLumP.glsl @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/postFX.glsl" + +uniform sampler2D currLum; +uniform sampler2D lastAdaptedLum; + +uniform float adaptRate; +uniform float deltaTime; + +out vec4 OUT_col; + +void main() +{ + float fAdaptedLum = texture( lastAdaptedLum, vec2(0.5f, 0.5f) ).r; + float fCurrentLum = texture( currLum, vec2(0.5f, 0.5f) ).r; + + // The user's adapted luminance level is simulated by closing the gap between + // adapted luminance and current luminance by 2% every frame, based on a + // 30 fps rate. This is not an accurate model of human adaptation, which can + // take longer than half an hour. + float diff = fCurrentLum - fAdaptedLum; + float fNewAdaptation = fAdaptedLum + ( diff * ( 1.0 - exp( -deltaTime * adaptRate ) ) ); + + OUT_col = vec4( fNewAdaptation, 0.0, 0.0, 1.0f ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/downScale4x4P.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/downScale4x4P.glsl new file mode 100644 index 000000000..131671760 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/downScale4x4P.glsl @@ -0,0 +1,50 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define IN_GLSL +#include "../../../shdrConsts.h" +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +in vec4 texCoords[8]; +#define IN_texCoords texCoords + +uniform sampler2D inputTex; + +out vec4 OUT_col; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + // We calculate the texture coords + // in the vertex shader as an optimization. + vec4 _sample = vec4(0.0f); + for ( int i = 0; i < 8; i++ ) + { + _sample += texture( inputTex, IN_texCoords[i].xy ); + _sample += texture( inputTex, IN_texCoords[i].zw ); + } + + OUT_col = _sample / 16; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/downScale4x4V.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/downScale4x4V.glsl new file mode 100644 index 000000000..51f1da896 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/downScale4x4V.glsl @@ -0,0 +1,141 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define IN_GLSL +#include "../../../shdrConsts.h" +#include "../../../gl/hlslCompat.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; + +#define In_pos vPosition +#define In_uv vTexCoord0 + +//----------------------------------------------------------------------------- +// Constants +//----------------------------------------------------------------------------- +out vec4 texCoords[8]; +#define Out_texCoords texCoords + +#define Out_hpos gl_Position + +uniform vec2 targetSize; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + Out_hpos = In_pos; + + // Sample from the 16 surrounding points. Since the center point will be in + // the exact center of 16 texels, a 0.5f offset is needed to specify a texel + // center. + vec2 texSize = vec2( 1.0 / (targetSize.x - 1.0), 1.0 / (targetSize.y - 1.0) ); + + vec4 uv; + uv.xy = In_uv.xy; + uv.zw = In_uv.xy; + + Out_texCoords[0] = uv; + Out_texCoords[0].x += texSize.x; + Out_texCoords[0].y += texSize.y; + Out_texCoords[0].z += texSize.x; + Out_texCoords[0].w += texSize.y; + Out_texCoords[0].x += ( 0 - 1.5 ) * texSize.x; + Out_texCoords[0].y += ( 0 - 1.5 ) * texSize.y; + Out_texCoords[0].z += ( 1 - 1.5 ) * texSize.x; + Out_texCoords[0].w += ( 0 - 1.5 ) * texSize.y; + + Out_texCoords[1] = uv; + Out_texCoords[1].x += texSize.x; + Out_texCoords[1].y += texSize.y; + Out_texCoords[1].z += texSize.x; + Out_texCoords[1].w += texSize.y; + Out_texCoords[1].x += ( 2 - 1.5 ) * texSize.x; + Out_texCoords[1].y += ( 0 - 1.5 ) * texSize.y; + Out_texCoords[1].z += ( 3 - 1.5 ) * texSize.x; + Out_texCoords[1].w += ( 0 - 1.5 ) * texSize.y; + + Out_texCoords[2] = uv; + Out_texCoords[2].x += texSize.x; + Out_texCoords[2].y += texSize.y; + Out_texCoords[2].z += texSize.x; + Out_texCoords[2].w += texSize.y; + Out_texCoords[2].x += ( 0 - 1.5 ) * texSize.x; + Out_texCoords[2].y += ( 1 - 1.5 ) * texSize.y; + Out_texCoords[2].z += ( 1 - 1.5 ) * texSize.x; + Out_texCoords[2].w += ( 1 - 1.5 ) * texSize.y; + + Out_texCoords[3] = uv; + Out_texCoords[3].x += texSize.x; + Out_texCoords[3].y += texSize.y; + Out_texCoords[3].z += texSize.x; + Out_texCoords[3].w += texSize.y; + Out_texCoords[3].x += ( 2 - 1.5 ) * texSize.x; + Out_texCoords[3].y += ( 1 - 1.5 ) * texSize.y; + Out_texCoords[3].z += ( 3 - 1.5 ) * texSize.x; + Out_texCoords[3].w += ( 1 - 1.5 ) * texSize.y; + + Out_texCoords[4] = uv; + Out_texCoords[4].x += texSize.x; + Out_texCoords[4].y += texSize.y; + Out_texCoords[4].z += texSize.x; + Out_texCoords[4].w += texSize.y; + Out_texCoords[4].x += ( 0 - 1.5 ) * texSize.x; + Out_texCoords[4].y += ( 2 - 1.5 ) * texSize.y; + Out_texCoords[4].z += ( 1 - 1.5 ) * texSize.x; + Out_texCoords[4].w += ( 2 - 1.5 ) * texSize.y; + + Out_texCoords[5] = uv; + Out_texCoords[5].x += texSize.x; + Out_texCoords[5].y += texSize.y; + Out_texCoords[5].z += texSize.x; + Out_texCoords[5].w += texSize.y; + Out_texCoords[5].x += ( 2 - 1.5 ) * texSize.x; + Out_texCoords[5].y += ( 2 - 1.5 ) * texSize.y; + Out_texCoords[5].z += ( 3 - 1.5 ) * texSize.x; + Out_texCoords[5].w += ( 2 - 1.5 ) * texSize.y; + + Out_texCoords[6] = uv; + Out_texCoords[6].x += texSize.x; + Out_texCoords[6].y += texSize.y; + Out_texCoords[6].z += texSize.x; + Out_texCoords[6].w += texSize.y; + Out_texCoords[6].x += ( 0 - 1.5 ) * texSize.x; + Out_texCoords[6].y += ( 3 - 1.5 ) * texSize.y; + Out_texCoords[6].z += ( 1 - 1.5 ) * texSize.x; + Out_texCoords[6].w += ( 3 - 1.5 ) * texSize.y; + + Out_texCoords[7] = uv; + Out_texCoords[7].x += texSize.x; + Out_texCoords[7].y += texSize.y; + Out_texCoords[7].z += texSize.x; + Out_texCoords[7].w += texSize.y; + Out_texCoords[7].x += ( 2 - 1.5 ) * texSize.x; + Out_texCoords[7].y += ( 3 - 1.5 ) * texSize.y; + Out_texCoords[7].z += ( 3 - 1.5 ) * texSize.x; + Out_texCoords[7].w += ( 3 - 1.5 ) * texSize.y; + + correctSSP(gl_Position); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/finalPassCombineP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/finalPassCombineP.glsl new file mode 100644 index 000000000..4b173d4d3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/finalPassCombineP.glsl @@ -0,0 +1,97 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/torque.glsl" +#include "../../../gl/hlslCompat.glsl" +#include "../../gl/postFX.glsl" +#include "shadergen:/autogenConditioners.h" + +uniform sampler2D sceneTex; +uniform sampler2D luminanceTex; +uniform sampler2D bloomTex; +uniform sampler1D colorCorrectionTex; + +uniform vec2 texSize0; +uniform vec2 texSize2; + +uniform float g_fEnableToneMapping; +uniform float g_fMiddleGray; +uniform float g_fWhiteCutoff; + +uniform float g_fEnableBlueShift; +uniform vec3 g_fBlueShiftColor; + +uniform float g_fBloomScale; + +uniform float g_fOneOverGamma; +uniform float Brightness; +uniform float Contrast; + +out vec4 OUT_col; + +void main() +{ + vec4 _sample = hdrDecode( texture( sceneTex, IN_uv0 ) ); + float adaptedLum = texture( luminanceTex, vec2( 0.5f, 0.5f ) ).r; + vec4 bloom = texture( bloomTex, IN_uv0 ); + + // For very low light conditions, the rods will dominate the perception + // of light, and therefore color will be desaturated and shifted + // towards blue. + if ( g_fEnableBlueShift > 0.0f ) + { + const vec3 LUMINANCE_VECTOR = vec3(0.2125f, 0.7154f, 0.0721f); + + // Define a linear blending from -1.5 to 2.6 (log scale) which + // determines the mix amount for blue shift + float coef = 1.0f - ( adaptedLum + 1.5 ) / 4.1; + coef = saturate( coef * g_fEnableBlueShift ); + + // Lerp between current color and blue, desaturated copy + vec3 rodColor = dot( _sample.rgb, LUMINANCE_VECTOR ) * g_fBlueShiftColor; + _sample.rgb = mix( _sample.rgb, rodColor, coef ); + + rodColor = dot( bloom.rgb, LUMINANCE_VECTOR ) * g_fBlueShiftColor; + bloom.rgb = mix( bloom.rgb, rodColor, coef ); + } + + // Add the bloom effect. + _sample += g_fBloomScale * bloom; + + // Map the high range of color values into a range appropriate for + // display, taking into account the user's adaptation level, + // white point, and selected value for for middle gray. + if ( g_fEnableToneMapping > 0.0f ) + { + float Lp = (g_fMiddleGray / (adaptedLum + 0.0001)) * hdrLuminance( _sample.rgb ); + //float toneScalar = ( Lp * ( 1.0 + ( Lp / ( g_fWhiteCutoff ) ) ) ) / ( 1.0 + Lp ); + float toneScalar = Lp; + _sample.rgb = mix( _sample.rgb, _sample.rgb * toneScalar, g_fEnableToneMapping ); + } + + // Apply the color correction. + _sample.r = texture( colorCorrectionTex, _sample.r ).r; + _sample.g = texture( colorCorrectionTex, _sample.g ).g; + _sample.b = texture( colorCorrectionTex, _sample.b ).b; + + OUT_col = _sample; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/luminanceVisP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/luminanceVisP.glsl new file mode 100644 index 000000000..ee9c28c87 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/luminanceVisP.glsl @@ -0,0 +1,42 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/torque.glsl" +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/postFX.glsl" + +uniform sampler2D inputTex; +uniform float brightPassThreshold; + +out vec4 OUT_col; + +void main() +{ + vec4 _sample = hdrDecode( texture( inputTex, IN_uv0 ) ); + + // Determine the brightness of this particular pixel. + float lum = hdrLuminance( _sample.rgb ); + + // Write the colour to the bright-pass render target + OUT_col = ( vec4( lum.rrr, 1 ) ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/sampleLumInitialP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/sampleLumInitialP.glsl new file mode 100644 index 000000000..8a2b9b318 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/sampleLumInitialP.glsl @@ -0,0 +1,62 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/torque.glsl" +#include "../../../gl/hlslCompat.glsl" +#include "../../gl/postFX.glsl" + +uniform sampler2D inputTex; +uniform vec2 texSize0; + +uniform float g_fMinLuminace; + +out vec4 OUT_col; + +const vec2 gTapOffsets[9] = vec2[] +( + vec2( -1.0, -1.0 ), vec2( 0.0, -1.0 ), vec2( 1.0, -1.0 ), + vec2( -1.0, 0.0 ), vec2( 0.0, 0.0 ), vec2( 1.0, 0.0 ), + vec2( -1.0, 1.0 ), vec2( 0.0, 1.0 ), vec2( 1.0, 1.0 ) +); + + +void main() +{ + vec2 tsize = 1.0 / texSize0; + + vec3 _sample; + float average = 0.0; + + for ( int i = 0; i < 9; i++ ) + { + // Decode the hdr value. + _sample = hdrDecode( texture( inputTex, IN_uv0 + ( gTapOffsets[i] * tsize ) ).rgb ); + + // Get the luminance and add it to the average. + float lum = max( hdrLuminance( _sample ), g_fMinLuminace ); + average += log( lum ); + } + + average = exp( average / 9.0 ); + + OUT_col = vec4( average, 0.0, 0.0, 1.0 ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/sampleLumIterativeP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/sampleLumIterativeP.glsl new file mode 100644 index 000000000..2e800d612 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/gl/sampleLumIterativeP.glsl @@ -0,0 +1,52 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../gl/postFX.glsl" + +uniform sampler2D inputTex; +uniform vec2 oneOverTargetSize; + +out vec4 OUT_col; + +const vec2 gTapOffsets[16] = vec2[] +( + vec2( -1.5, -1.5 ), vec2( -0.5, -1.5 ), vec2( 0.5, -1.5 ), vec2( 1.5, -1.5 ), + vec2( -1.5, -0.5 ), vec2( -0.5, -0.5 ), vec2( 0.5, -0.5 ), vec2( 1.5, -0.5 ), + vec2( -1.5, 0.5 ), vec2( -0.5, 0.5 ), vec2( 0.5, 0.5 ), vec2( 1.5, 0.5 ), + vec2( -1.5, 1.5 ), vec2( -0.5, 1.5 ), vec2( 0.5, 1.5 ), vec2( 1.5, 1.5 ) +); + +void main() +{ + vec2 pixelSize = oneOverTargetSize; + + float average = 0.0; + + for ( int i = 0; i < 16; i++ ) + { + float lum = texture( inputTex, IN_uv0 + ( gTapOffsets[i] * pixelSize ) ).r; + average += lum; + } + + OUT_col = vec4( average / 16.0, 0.0, 0.0, 1.0 ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/luminanceVisP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/luminanceVisP.hlsl new file mode 100644 index 000000000..505d1b825 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/luminanceVisP.hlsl @@ -0,0 +1,39 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" +#include "../../torque.hlsl" + + +TORQUE_UNIFORM_SAMPLER2D(inputTex, 0); +uniform float brightPassThreshold; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float4 sample = hdrDecode( TORQUE_TEX2D( inputTex, IN.uv0 ) ); + + // Determine the brightness of this particular pixel. + float lum = hdrLuminance( sample.rgb ); + + // Write the colour to the bright-pass render target + return ( float4( lum.rrr, 1 ) ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/sampleLumInitialP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/sampleLumInitialP.hlsl new file mode 100644 index 000000000..2e23ece1f --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/sampleLumInitialP.hlsl @@ -0,0 +1,59 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../torque.hlsl" +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(inputTex, 0); +uniform float2 texSize0; + +uniform float g_fMinLuminace; + +static float2 gTapOffsets[9] = +{ + { -1.0, -1.0 }, { 0.0, -1.0 }, { 1.0, -1.0 }, + { -1.0, 0.0 }, { 0.0, 0.0 }, { 1.0, 0.0 }, + { -1.0, 1.0 }, { 0.0, 1.0 }, { 1.0, 1.0 } +}; + + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float2 tsize = 1.0 / texSize0; + + float3 sample; + float average = 0.0; + + for ( int i = 0; i < 9; i++ ) + { + // Decode the hdr value. + sample = hdrDecode( TORQUE_TEX2D( inputTex, IN.uv0 + ( gTapOffsets[i] * tsize ) ).rgb ); + + // Get the luminance and add it to the average. + float lum = max( hdrLuminance( sample ), g_fMinLuminace ); + average += log( lum ); + } + + average = exp( average / 9.0 ); + + return float4( average, 0.0, 0.0, 1.0 ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/sampleLumIterativeP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/sampleLumIterativeP.hlsl new file mode 100644 index 000000000..46ed6fc70 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/hdr/sampleLumIterativeP.hlsl @@ -0,0 +1,50 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(inputTex, 0); +uniform float2 oneOverTargetSize; + + +static float2 gTapOffsets[16] = +{ + { -1.5, -1.5 }, { -0.5, -1.5 }, { 0.5, -1.5 }, { 1.5, -1.5 }, + { -1.5, -0.5 }, { -0.5, -0.5 }, { 0.5, -0.5 }, { 1.5, -0.5 }, + { -1.5, 0.5 }, { -0.5, 0.5 }, { 0.5, 0.5 }, { 1.5, 0.5 }, + { -1.5, 1.5 }, { -0.5, 1.5 }, { 0.5, 1.5 }, { 1.5, 1.5 } +}; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float2 pixelSize = oneOverTargetSize; + + float average = 0.0; + + for ( int i = 0; i < 16; i++ ) + { + float lum = TORQUE_TEX2D( inputTex, IN.uv0 + ( gTapOffsets[i] * pixelSize ) ).r; + average += lum; + } + + return float4( average / 16.0, 0.0, 0.0, 1.0 ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/gl/lightRayOccludeP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/gl/lightRayOccludeP.glsl new file mode 100644 index 000000000..59f5f4bbf --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/gl/lightRayOccludeP.glsl @@ -0,0 +1,55 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/postFX.glsl" + +uniform sampler2D backBuffer; // The original backbuffer. +uniform sampler2D deferredTex; // The pre-pass depth and normals. + +uniform float brightScalar; + +const vec3 LUMINANCE_VECTOR = vec3(0.3125f, 0.6154f, 0.0721f); + +out vec4 OUT_col; + +void main() +{ + vec4 col = vec4( 0, 0, 0, 1 ); + + // Get the depth at this pixel. + float depth = deferredUncondition( deferredTex, IN_uv0 ).w; + + // If the depth is equal to 1.0, read from the backbuffer + // and perform the exposure calculation on the result. + if ( depth >= 0.999 ) + { + col = texture( backBuffer, IN_uv0 ); + + //col = 1 - exp(-120000 * col); + col += dot( vec3(col), LUMINANCE_VECTOR ) + 0.0001f; + col *= brightScalar; + } + + OUT_col = col; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/gl/lightRayP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/gl/lightRayP.glsl new file mode 100644 index 000000000..6d78f4eae --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/gl/lightRayP.glsl @@ -0,0 +1,94 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "../../gl/postFX.glsl" + +uniform sampler2D frameSampler; +uniform sampler2D backBuffer; + +uniform vec3 camForward; +uniform vec3 lightDirection; +uniform vec2 screenSunPos; +uniform vec2 oneOverTargetSize; +uniform int numSamples; +uniform float density; +uniform float weight; +uniform float decay; +uniform float exposure; + +out vec4 OUT_col; + +void main() +{ + vec4 texCoord = vec4( IN_uv0.xy, 0, 0 ); + + // Store initial sample. + half3 color = half3(texture( frameSampler, texCoord.xy ).rgb); + + // Store original bb color. + vec4 bbCol = texture( backBuffer, IN_uv1 ); + + // Set up illumination decay factor. + half illuminationDecay = 1.0; + + float amount = saturate( dot( -lightDirection, camForward ) ); + + int samples = int(numSamples * amount); + + if ( samples <= 0 ) + { + OUT_col = bbCol; + return; + } + + // Calculate vector from pixel to light source in screen space. + half2 deltaTexCoord = half2( texCoord.xy - screenSunPos ); + + // Divide by number of samples and scale by control factor. + deltaTexCoord *= 1.0 / half(samples * density); + + // Evaluate summation from Equation 3 NUM_SAMPLES iterations. + for ( int i = 0; i < samples; i++ ) + { + // Step sample location along ray. + texCoord.xy -= deltaTexCoord; + + // Retrieve sample at new location. + half3 sample_ = half3(tex2Dlod( frameSampler, texCoord )); + + // Apply sample attenuation scale/decay factors. + sample_ *= illuminationDecay * weight; + + // Accumulate combined color. + color += sample_; + + // Update exponential decay factor. + illuminationDecay *= decay; + } + + //return saturate( amount ) * color * Exposure; + //return bbCol * decay; + + // Output final color with a further scale control factor. + OUT_col = saturate( amount ) * vec4( color * exposure, 1 ) + bbCol; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/lightRayOccludeP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/lightRayOccludeP.hlsl new file mode 100644 index 000000000..5db6ecb5b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/lightRayOccludeP.hlsl @@ -0,0 +1,53 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModelAutoGen.hlsl" +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1); + +uniform float brightScalar; + +static const float3 LUMINANCE_VECTOR = float3(0.3125f, 0.6154f, 0.0721f); + + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float4 col = float4( 0, 0, 0, 1 ); + + // Get the depth at this pixel. + float depth = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ).w; + + // If the depth is equal to 1.0, read from the backbuffer + // and perform the exposure calculation on the result. + if ( depth >= 0.999 ) + { + col = TORQUE_TEX2D( backBuffer, IN.uv0 ); + + //col = 1 - exp(-120000 * col); + col += dot( col.rgb, LUMINANCE_VECTOR ) + 0.0001f; + col *= brightScalar; + } + + return col; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/lightRayP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/lightRayP.hlsl new file mode 100644 index 000000000..032894710 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/lightRay/lightRayP.hlsl @@ -0,0 +1,89 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(frameSampler, 0); +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 1); + + +uniform float3 camForward; +uniform int numSamples; +uniform float3 lightDirection; +uniform float density; +uniform float2 screenSunPos; +uniform float2 oneOverTargetSize; +uniform float weight; +uniform float decay; +uniform float exposure; + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float4 texCoord = float4( IN.uv0.xy, 0, 0 ); + + // Store initial sample. + half3 color = (half3)TORQUE_TEX2D( frameSampler, texCoord.xy ).rgb; + + // Store original bb color. + float4 bbCol = TORQUE_TEX2D( backBuffer, IN.uv1 ); + + // Set up illumination decay factor. + half illuminationDecay = 1.0; + + float amount = saturate( dot( -lightDirection, camForward ) ); + + int samples = numSamples * amount; + + if ( samples <= 0 ) + return bbCol; + + // Calculate vector from pixel to light source in screen space. + half2 deltaTexCoord = (half2)( texCoord.xy - screenSunPos ); + + // Divide by number of samples and scale by control factor. + deltaTexCoord *= (half)(1.0 / samples * density); + + // Evaluate summation from Equation 3 NUM_SAMPLES iterations. + for ( int i = 0; i < samples; i++ ) + { + // Step sample location along ray. + texCoord.xy -= deltaTexCoord; + + // Retrieve sample at new location. + half3 sample = (half3)TORQUE_TEX2DLOD( frameSampler, texCoord ); + + // Apply sample attenuation scale/decay factors. + sample *= half(illuminationDecay * weight); + + // Accumulate combined color. + color += sample; + + // Update exponential decay factor. + illuminationDecay *= half(decay); + } + + //return saturate( amount ) * color * Exposure; + //return bbCol * decay; + + // Output final color with a further scale control factor. + return saturate( amount ) * float4( color * exposure, 1 ) + bbCol; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/blendWeightCalculationP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/blendWeightCalculationP.hlsl new file mode 100644 index 000000000..2c4777c36 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/blendWeightCalculationP.hlsl @@ -0,0 +1,78 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + + +uniform sampler2D edgesMap : register(S0); +uniform sampler2D edgesMapL : register(S1); +uniform sampler2D areaMap : register(S2); + +#include "./functions.hlsl" + + +float4 main(float2 texcoord : TEXCOORD0) : COLOR0 +{ + float4 areas = 0.0; + + float2 e = tex2D(edgesMap, texcoord).rg; + + [branch] + if (e.g) // Edge at north + { + // Search distances to the left and to the right: + float2 d = float2(SearchXLeft(texcoord), SearchXRight(texcoord)); + + // Now fetch the crossing edges. Instead of sampling between edgels, we + // sample at -0.25, to be able to discern what value has each edgel: + float4 coords = mad(float4(d.x, -0.25, d.y + 1.0, -0.25), + PIXEL_SIZE.xyxy, texcoord.xyxy); + float e1 = tex2Dlevel0(edgesMapL, coords.xy).r; + float e2 = tex2Dlevel0(edgesMapL, coords.zw).r; + + // Ok, we know how this pattern looks like, now it is time for getting + // the actual area: + areas.rg = Area(abs(d), e1, e2); + } + + [branch] + if (e.r) // Edge at west + { + // Search distances to the top and to the bottom: + float2 d = float2(SearchYUp(texcoord), SearchYDown(texcoord)); + + // Now fetch the crossing edges (yet again): + float4 coords = mad(float4(-0.25, d.x, -0.25, d.y + 1.0), + PIXEL_SIZE.xyxy, texcoord.xyxy); + float e1 = tex2Dlevel0(edgesMapL, coords.xy).g; + float e2 = tex2Dlevel0(edgesMapL, coords.zw).g; + + // Get the area for this direction: + areas.ba = Area(abs(d), e1, e2); + } + + return areas; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/edgeDetectionP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/edgeDetectionP.hlsl new file mode 100644 index 000000000..7d5c7f057 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/edgeDetectionP.hlsl @@ -0,0 +1,72 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + +#include "shadergen:/autogenConditioners.h" + +uniform sampler2D colorMapG : register(S0); +uniform sampler2D deferredMap : register(S1); + +uniform float3 lumaCoefficients; +uniform float threshold; +uniform float depthThreshold; + + +float4 main( float2 texcoord : TEXCOORD0, + float4 offset[2]: TEXCOORD1) : COLOR0 +{ + // Luma calculation requires gamma-corrected colors (texture 'colorMapG'). + // + // Note that there is a lot of overlapped luma calculations; performance + // can be improved if this luma calculation is performed in the main pass, + // which may give you an edge if used in conjunction with a z deferred. + + float L = dot(tex2D(colorMapG, texcoord).rgb, lumaCoefficients); + + float Lleft = dot(tex2D(colorMapG, offset[0].xy).rgb, lumaCoefficients); + float Ltop = dot(tex2D(colorMapG, offset[0].zw).rgb, lumaCoefficients); + float Lright = dot(tex2D(colorMapG, offset[1].xy).rgb, lumaCoefficients); + float Lbottom = dot(tex2D(colorMapG, offset[1].zw).rgb, lumaCoefficients); + + float4 delta = abs(L.xxxx - float4(Lleft, Ltop, Lright, Lbottom)); + float4 edges = step(threshold, delta); + + // Add depth edges to color edges + float D = deferredUncondition(deferredMap, texcoord).w; + float Dleft = deferredUncondition(deferredMap, offset[0].xy).w; + float Dtop = deferredUncondition(deferredMap, offset[0].zw).w; + float Dright = deferredUncondition(deferredMap, offset[1].xy).w; + float Dbottom = deferredUncondition(deferredMap, offset[1].zw).w; + + delta = abs(D.xxxx - float4(Dleft, Dtop, Dright, Dbottom)); + edges += step(depthThreshold, delta); + + if (dot(edges, 1.0) == 0.0) + discard; + + return edges; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/functions.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/functions.hlsl new file mode 100644 index 000000000..9935a5e30 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/functions.hlsl @@ -0,0 +1,145 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + + +uniform float2 texSize0; + +#if !defined(PIXEL_SIZE) +#define PIXEL_SIZE (1.0 / texSize0) +#define MAX_SEARCH_STEPS 8 +#define MAX_DISTANCE 33 +#endif + +// Typical Multiply-Add operation to ease translation to assembly code. + +float4 mad(float4 m, float4 a, float4 b) +{ + #if defined(XBOX) + float4 result; + asm { + mad result, m, a, b + }; + return result; + #else + return m * a + b; + #endif +} + + +// This one just returns the first level of a mip map chain, which allow us to +// avoid the nasty ddx/ddy warnings, even improving the performance a little +// bit. +float4 tex2Dlevel0(sampler2D map, float2 texcoord) +{ + return tex2Dlod(map, float4(texcoord, 0.0, 0.0)); +} + + +// Same as above, this eases translation to assembly code; +float4 tex2Doffset(sampler2D map, float2 texcoord, float2 offset) +{ + #if defined(XBOX) && MAX_SEARCH_STEPS < 6 + float4 result; + float x = offset.x; + float y = offset.y; + asm { + tfetch2D result, texcoord, map, OffsetX = x, OffsetY = y + }; + return result; + #else + return tex2Dlevel0(map, texcoord + PIXEL_SIZE * offset); + #endif +} + + +// Ok, we have the distance and both crossing edges, can you please return +// the float2 blending weights? +float2 Area(float2 distance, float e1, float e2) +{ + // * By dividing by areaSize - 1.0 below we are implicitely offsetting to + // always fall inside of a pixel + // * Rounding prevents bilinear access precision problems + float areaSize = MAX_DISTANCE * 5.0; + float2 pixcoord = MAX_DISTANCE * round(4.0 * float2(e1, e2)) + distance; + float2 texcoord = pixcoord / (areaSize - 1.0); + return tex2Dlevel0(areaMap, texcoord).rg; +} + + +// Search functions for the 2nd pass. +float SearchXLeft(float2 texcoord) +{ + // We compare with 0.9 to prevent bilinear access precision problems. + float i; + float e = 0.0; + for (i = -1.5; i > -2.0 * MAX_SEARCH_STEPS; i -= 2.0) + { + e = tex2Doffset(edgesMapL, texcoord, float2(i, 0.0)).g; + [flatten] if (e < 0.9) break; + } + return max(i + 1.5 - 2.0 * e, -2.0 * MAX_SEARCH_STEPS); +} + +// Search functions for the 2nd pass. +float SearchXRight(float2 texcoord) +{ + float i; + float e = 0.0; + for (i = 1.5; i < 2.0 * MAX_SEARCH_STEPS; i += 2.0) + { + e = tex2Doffset(edgesMapL, texcoord, float2(i, 0.0)).g; + [flatten] if (e < 0.9) break; + } + return min(i - 1.5 + 2.0 * e, 2.0 * MAX_SEARCH_STEPS); +} + +// Search functions for the 2nd pass. +float SearchYUp(float2 texcoord) +{ + float i; + float e = 0.0; + for (i = -1.5; i > -2.0 * MAX_SEARCH_STEPS; i -= 2.0) + { + e = tex2Doffset(edgesMapL, texcoord, float2(i, 0.0).yx).r; + [flatten] if (e < 0.9) break; + } + return max(i + 1.5 - 2.0 * e, -2.0 * MAX_SEARCH_STEPS); +} + +// Search functions for the 2nd pass. +float SearchYDown(float2 texcoord) +{ + float i; + float e = 0.0; + for (i = 1.5; i < 2.0 * MAX_SEARCH_STEPS; i += 2.0) + { + e = tex2Doffset(edgesMapL, texcoord, float2(i, 0.0).yx).r; + [flatten] if (e < 0.9) break; + } + return min(i - 1.5 + 2.0 * e, 2.0 * MAX_SEARCH_STEPS); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/blendWeightCalculationP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/blendWeightCalculationP.glsl new file mode 100644 index 000000000..af01ce6f9 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/blendWeightCalculationP.glsl @@ -0,0 +1,83 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + +#include "../../../gl/hlslCompat.glsl" + +in vec2 texcoord; + +uniform sampler2D edgesMap; +uniform sampler2D edgesMapL; +uniform sampler2D areaMap; + +out vec4 OUT_col; + +#include "./functions.glsl" + + +void main() +{ + vec4 areas = vec4(0.0); + + vec2 e = texture(edgesMap, texcoord).rg; + + //[branch] + if (bool(e.g)) // Edge at north + { + // Search distances to the left and to the right: + vec2 d = vec2(SearchXLeft(texcoord), SearchXRight(texcoord)); + + // Now fetch the crossing edges. Instead of sampling between edgels, we + // sample at -0.25, to be able to discern what value has each edgel: + vec4 coords = mad(vec4(d.x, -0.25, d.y + 1.0, -0.25), + PIXEL_SIZE.xyxy, texcoord.xyxy); + float e1 = tex2Dlevel0(edgesMapL, coords.xy).r; + float e2 = tex2Dlevel0(edgesMapL, coords.zw).r; + + // Ok, we know how this pattern looks like, now it is time for getting + // the actual area: + areas.rg = Area(abs(d), e1, e2); + } + + //[branch] + if (bool(e.r)) // Edge at west + { + // Search distances to the top and to the bottom: + vec2 d = vec2(SearchYUp(texcoord), SearchYDown(texcoord)); + + // Now fetch the crossing edges (yet again): + vec4 coords = mad(vec4(-0.25, d.x, -0.25, d.y + 1.0), + PIXEL_SIZE.xyxy, texcoord.xyxy); + float e1 = tex2Dlevel0(edgesMapL, coords.xy).g; + float e2 = tex2Dlevel0(edgesMapL, coords.zw).g; + + // Get the area for this direction: + areas.ba = Area(abs(d), e1, e2); + } + + OUT_col = areas; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/edgeDetectionP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/edgeDetectionP.glsl new file mode 100644 index 000000000..d964a28a4 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/edgeDetectionP.glsl @@ -0,0 +1,76 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +uniform sampler2D colorMapG; +uniform sampler2D deferredMap; + +uniform vec3 lumaCoefficients; +uniform float threshold; +uniform float depthThreshold; + +in vec2 texcoord; +in vec4 offset[2]; + +out vec4 OUT_col; + +void main() +{ + // Luma calculation requires gamma-corrected colors (texture 'colorMapG'). + // + // Note that there is a lot of overlapped luma calculations; performance + // can be improved if this luma calculation is performed in the main pass, + // which may give you an edge if used in conjunction with a z deferred. + + float L = dot(texture(colorMapG, texcoord).rgb, lumaCoefficients); + + float Lleft = dot(texture(colorMapG, offset[0].xy).rgb, lumaCoefficients); + float Ltop = dot(texture(colorMapG, offset[0].zw).rgb, lumaCoefficients); + float Lright = dot(texture(colorMapG, offset[1].xy).rgb, lumaCoefficients); + float Lbottom = dot(texture(colorMapG, offset[1].zw).rgb, lumaCoefficients); + + vec4 delta = abs(vec4(L) - vec4(Lleft, Ltop, Lright, Lbottom)); + vec4 edges = step(threshold, delta); + + // Add depth edges to color edges + float D = deferredUncondition(deferredMap, texcoord).w; + float Dleft = deferredUncondition(deferredMap, offset[0].xy).w; + float Dtop = deferredUncondition(deferredMap, offset[0].zw).w; + float Dright = deferredUncondition(deferredMap, offset[1].xy).w; + float Dbottom = deferredUncondition(deferredMap, offset[1].zw).w; + + delta = abs(vec4(D) - vec4(Dleft, Dtop, Dright, Dbottom)); + edges += step(depthThreshold, delta); + + if (dot(edges, vec4(1.0)) == 0.0) + discard; + + OUT_col = edges; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/functions.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/functions.glsl new file mode 100644 index 000000000..3ff56fb1a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/functions.glsl @@ -0,0 +1,145 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + + +uniform vec2 texSize0; + +#if !defined(PIXEL_SIZE) +#define PIXEL_SIZE (1.0 / texSize0) +#define MAX_SEARCH_STEPS 8 +#define MAX_DISTANCE 33 +#endif + +// Typical Multiply-Add operation to ease translation to assembly code. + +vec4 mad(vec4 m, vec4 a, vec4 b) +{ + #if defined(XBOX) + vec4 result; + asm { + mad result, m, a, b + }; + return result; + #else + return m * a + b; + #endif +} + + +// This one just returns the first level of a mip map chain, which allow us to +// avoid the nasty ddx/ddy warnings, even improving the performance a little +// bit. +vec4 tex2Dlevel0(sampler2D map, vec2 texcoord) +{ + return tex2Dlod(map, vec4(texcoord, 0.0, 0.0)); +} + + +// Same as above, this eases translation to assembly code; +vec4 tex2Doffset(sampler2D map, vec2 texcoord, vec2 offset) +{ + #if defined(XBOX) && MAX_SEARCH_STEPS < 6 + vec4 result; + float x = offset.x; + float y = offset.y; + asm { + tfetch2D result, texcoord, map, OffsetX = x, OffsetY = y + }; + return result; + #else + return tex2Dlevel0(map, texcoord + PIXEL_SIZE * offset); + #endif +} + + +// Ok, we have the distance and both crossing edges, can you please return +// the vec2 blending weights? +vec2 Area(vec2 distance, float e1, float e2) +{ + // * By dividing by areaSize - 1.0 below we are implicitely offsetting to + // always fall inside of a pixel + // * Rounding prevents bilinear access precision problems + float areaSize = MAX_DISTANCE * 5.0; + vec2 pixcoord = MAX_DISTANCE * round(4.0 * vec2(e1, e2)) + distance; + vec2 texcoord = pixcoord / (areaSize - 1.0); + return tex2Dlevel0(areaMap, texcoord).rg; +} + + +// Search functions for the 2nd pass. +float SearchXLeft(vec2 texcoord) +{ + // We compare with 0.9 to prevent bilinear access precision problems. + float i; + float e = 0.0; + for (i = -1.5; i > -2.0 * MAX_SEARCH_STEPS; i -= 2.0) + { + e = tex2Doffset(edgesMapL, texcoord, vec2(i, 0.0)).g; + /*[flatten]*/ if (e < 0.9) break; + } + return max(i + 1.5 - 2.0 * e, -2.0 * MAX_SEARCH_STEPS); +} + +// Search functions for the 2nd pass. +float SearchXRight(vec2 texcoord) +{ + float i; + float e = 0.0; + for (i = 1.5; i < 2.0 * MAX_SEARCH_STEPS; i += 2.0) + { + e = tex2Doffset(edgesMapL, texcoord, vec2(i, 0.0)).g; + /*[flatten]*/ if (e < 0.9) break; + } + return min(i - 1.5 + 2.0 * e, 2.0 * MAX_SEARCH_STEPS); +} + +// Search functions for the 2nd pass. +float SearchYUp(vec2 texcoord) +{ + float i; + float e = 0.0; + for (i = -1.5; i > -2.0 * MAX_SEARCH_STEPS; i -= 2.0) + { + e = tex2Doffset(edgesMapL, texcoord, vec2(i, 0.0).yx).r; + /*[flatten]*/ if (e < 0.9) break; + } + return max(i + 1.5 - 2.0 * e, -2.0 * MAX_SEARCH_STEPS); +} + +// Search functions for the 2nd pass. +float SearchYDown(vec2 texcoord) +{ + float i; + float e = 0.0; + for (i = 1.5; i < 2.0 * MAX_SEARCH_STEPS; i += 2.0) + { + e = tex2Doffset(edgesMapL, texcoord, vec2(i, 0.0).yx).r; + /*[flatten]*/ if (e < 0.9) break; + } + return min(i - 1.5 + 2.0 * e, 2.0 * MAX_SEARCH_STEPS); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/neighborhoodBlendingP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/neighborhoodBlendingP.glsl new file mode 100644 index 000000000..eddbcc47c --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/neighborhoodBlendingP.glsl @@ -0,0 +1,88 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + +#include "../../../gl/hlslCompat.glsl" + +in vec2 texcoord; +in vec4 offset[2]; + +uniform sampler2D blendMap; +uniform sampler2D colorMapL; +uniform sampler2D colorMap; + +// Dummy sampers to please include. +uniform sampler2D areaMap; +uniform sampler2D edgesMapL; +#include "./functions.glsl" + +out vec4 OUT_col; + +void main() +{ + // Fetch the blending weights for current pixel: + vec4 topLeft = texture(blendMap, texcoord); + float bottom = texture(blendMap, offset[1].zw).g; + float right = texture(blendMap, offset[1].xy).a; + vec4 a = vec4(topLeft.r, bottom, topLeft.b, right); + + // Up to 4 lines can be crossing a pixel (one in each edge). So, we perform + // a weighted average, where the weight of each line is 'a' cubed, which + // favors blending and works well in practice. + vec4 w = a * a * a; + + // There is some blending weight with a value greater than 0.0? + float sum = dot(w, vec4(1.0)); + if (sum < 1e-5) + discard; + + vec4 color = vec4(0.0); + + // Add the contributions of the possible 4 lines that can cross this pixel: + #ifdef BILINEAR_FILTER_TRICK + vec4 coords = mad(vec4( 0.0, -a.r, 0.0, a.g), PIXEL_SIZE.yyyy, texcoord.xyxy); + color = mad(texture(colorMapL, coords.xy), vec4(w.r), color); + color = mad(texture(colorMapL, coords.zw), vec4(w.g), color); + + coords = mad(vec4(-a.b, 0.0, a.a, 0.0), PIXEL_SIZE.xxxx, texcoord.xyxy); + color = mad(texture(colorMapL, coords.xy), vec4(w.b), color); + color = mad(texture(colorMapL, coords.zw), vec4(w.a), color); + #else + vec4 C = texture(colorMap, texcoord); + vec4 Cleft = texture(colorMap, offset[0].xy); + vec4 Ctop = texture(colorMap, offset[0].zw); + vec4 Cright = texture(colorMap, offset[1].xy); + vec4 Cbottom = texture(colorMap, offset[1].zw); + color = mad(mix(C, Ctop, a.r), vec4(w.r), color); + color = mad(mix(C, Cbottom, a.g), vec4(w.g), color); + color = mad(mix(C, Cleft, a.b), vec4(w.b), color); + color = mad(mix(C, Cright, a.a), vec4(w.a), color); + #endif + + // Normalize the resulting color and we are finished! + OUT_col = color / sum; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/offsetV.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/offsetV.glsl new file mode 100644 index 000000000..53d927c29 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/offsetV.glsl @@ -0,0 +1,57 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + +#include "../../../gl/hlslCompat.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; + +#define IN_position vPosition +#define IN_texcoord vTexCoord0 + +#define OUT_position gl_Position +out vec2 texcoord; +#define OUT_texcoord texcoord +out vec4 offset[2]; +#define OUT_offset offset + +uniform vec2 texSize0; + +void main() +{ + OUT_position = IN_position; + vec2 PIXEL_SIZE = 1.0 / texSize0; + + OUT_texcoord = IN_texcoord; + OUT_texcoord.xy += PIXEL_SIZE * 0.5; + + OUT_offset[0] = OUT_texcoord.xyxy + PIXEL_SIZE.xyxy * vec4(-1.0, 0.0, 0.0, -1.0); + OUT_offset[1] = OUT_texcoord.xyxy + PIXEL_SIZE.xyxy * vec4( 1.0, 0.0, 0.0, 1.0); + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/passthruV.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/passthruV.glsl new file mode 100644 index 000000000..1aa64112c --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/gl/passthruV.glsl @@ -0,0 +1,52 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + +#include "../../../gl/hlslCompat.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; + +#define IN_position vPosition +#define IN_texcoord vTexCoord0 + +#define OUT_position gl_Position +out vec2 texcoord; +#define OUT_texcoord texcoord + +uniform vec2 texSize0; + +void main() +{ + OUT_position = IN_position; + vec2 PIXEL_SIZE = 1.0 / texSize0; + + OUT_texcoord = IN_texcoord; + texcoord.xy += PIXEL_SIZE * 0.5; + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/neighborhoodBlendingP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/neighborhoodBlendingP.hlsl new file mode 100644 index 000000000..aaaacafe2 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/neighborhoodBlendingP.hlsl @@ -0,0 +1,84 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + + +uniform sampler2D blendMap : register(S0); +uniform sampler2D colorMapL : register(S1); +uniform sampler2D colorMap : register(S2); + +// Dummy sampers to please include. +sampler2D areaMap; +sampler2D edgesMapL; +#include "./functions.hlsl" + + +float4 main( float2 texcoord : TEXCOORD0, + float4 offset[2]: TEXCOORD1 ) : COLOR0 +{ + // Fetch the blending weights for current pixel: + float4 topLeft = tex2D(blendMap, texcoord); + float bottom = tex2D(blendMap, offset[1].zw).g; + float right = tex2D(blendMap, offset[1].xy).a; + float4 a = float4(topLeft.r, bottom, topLeft.b, right); + + // Up to 4 lines can be crossing a pixel (one in each edge). So, we perform + // a weighted average, where the weight of each line is 'a' cubed, which + // favors blending and works well in practice. + float4 w = a * a * a; + + // There is some blending weight with a value greater than 0.0? + float sum = dot(w, 1.0); + if (sum < 1e-5) + discard; + + float4 color = 0.0; + + // Add the contributions of the possible 4 lines that can cross this pixel: + #ifdef BILINEAR_FILTER_TRICK + float4 coords = mad(float4( 0.0, -a.r, 0.0, a.g), PIXEL_SIZE.yyyy, texcoord.xyxy); + color = mad(tex2D(colorMapL, coords.xy), w.r, color); + color = mad(tex2D(colorMapL, coords.zw), w.g, color); + + coords = mad(float4(-a.b, 0.0, a.a, 0.0), PIXEL_SIZE.xxxx, texcoord.xyxy); + color = mad(tex2D(colorMapL, coords.xy), w.b, color); + color = mad(tex2D(colorMapL, coords.zw), w.a, color); + #else + float4 C = tex2D(colorMap, texcoord); + float4 Cleft = tex2D(colorMap, offset[0].xy); + float4 Ctop = tex2D(colorMap, offset[0].zw); + float4 Cright = tex2D(colorMap, offset[1].xy); + float4 Cbottom = tex2D(colorMap, offset[1].zw); + color = mad(lerp(C, Ctop, a.r), w.r, color); + color = mad(lerp(C, Cbottom, a.g), w.g, color); + color = mad(lerp(C, Cleft, a.b), w.b, color); + color = mad(lerp(C, Cright, a.a), w.a, color); + #endif + + // Normalize the resulting color and we are finished! + return color / sum; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/offsetV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/offsetV.hlsl new file mode 100644 index 000000000..d9c922afd --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/offsetV.hlsl @@ -0,0 +1,42 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + + +uniform float2 texSize0; + +void main( inout float4 position : POSITION0, + inout float2 texcoord : TEXCOORD0, + out float4 offset[2] : TEXCOORD1 ) +{ + float2 PIXEL_SIZE = 1.0 / texSize0; + + texcoord.xy += PIXEL_SIZE * 0.5; + + offset[0] = texcoord.xyxy + PIXEL_SIZE.xyxy * float4(-1.0, 0.0, 0.0, -1.0); + offset[1] = texcoord.xyxy + PIXEL_SIZE.xyxy * float4( 1.0, 0.0, 0.0, 1.0); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/passthruV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/passthruV.hlsl new file mode 100644 index 000000000..24ef534fd --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/mlaa/passthruV.hlsl @@ -0,0 +1,37 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// An implementation of "Practical Morphological Anti-Aliasing" from +// GPU Pro 2 by Jorge Jimenez, Belen Masia, Jose I. Echevarria, +// Fernando Navarro, and Diego Gutierrez. +// +// http://www.iryoku.com/mlaa/ + + +uniform float2 texSize0; + +void main( inout float4 position : POSITION0, + inout float2 texcoord : TEXCOORD0) +{ + float2 PIXEL_SIZE = 1.0 / texSize0; + texcoord.xy += PIXEL_SIZE * 0.5; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/motionBlurP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/motionBlurP.hlsl new file mode 100644 index 000000000..90b8f6f25 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/motionBlurP.hlsl @@ -0,0 +1,70 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./postFx.hlsl" +#include "../torque.hlsl" +#include "../shaderModelAutoGen.hlsl" + +uniform float4x4 matPrevScreenToWorld; +uniform float4x4 matWorldToScreen; + +// Passed in from setShaderConsts() +uniform float velocityMultiplier; +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1); + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float samples = 5; + + // First get the deferred texture for uv channel 0 + float4 deferred = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ); + + // Next extract the depth + float depth = deferred.a; + + // Create the screen position + float4 screenPos = float4(IN.uv0.x*2-1, IN.uv0.y*2-1, depth*2-1, 1); + + // Calculate the world position + float4 D = mul(screenPos, matWorldToScreen); + float4 worldPos = D / D.w; + + // Now calculate the previous screen position + float4 previousPos = mul( worldPos, matPrevScreenToWorld ); + previousPos /= previousPos.w; + + // Calculate the XY velocity + float2 velocity = ((screenPos - previousPos) / velocityMultiplier).xy; + + // Generate the motion blur + float4 color = TORQUE_TEX2D(backBuffer, IN.uv0); + IN.uv0 += velocity; + + for(int i = 1; i blurNormalTol ) + { + usedCount++; + total += weight; + occlusion += TORQUE_TEX2D( occludeMap, uv ).r * weight; + } + } +} + +float4 main( VertToPix IN ) : TORQUE_TARGET0 +{ + //float4 centerTap; + float4 centerTap = TORQUE_DEFERRED_UNCONDITION( deferredMap, IN.uv0.zw ); + + //return centerTap; + + //float centerOcclude = TORQUE_TEX2D( occludeMap, IN.uv0.zw ).r; + //return float4( centerOcclude.rrr, 1 ); + + float4 kernel = float4( 0.175, 0.275, 0.375, 0.475 ); //25f; + + float occlusion = 0; + int usedCount = 0; + float total = 0.0; + + sample( IN.uv0.xy, kernel.x, centerTap, usedCount, occlusion, total ); + sample( IN.uv1, kernel.y, centerTap, usedCount, occlusion, total ); + sample( IN.uv2, kernel.z, centerTap, usedCount, occlusion, total ); + sample( IN.uv3, kernel.w, centerTap, usedCount, occlusion, total ); + + sample( IN.uv4, kernel.x, centerTap, usedCount, occlusion, total ); + sample( IN.uv5, kernel.y, centerTap, usedCount, occlusion, total ); + sample( IN.uv6, kernel.z, centerTap, usedCount, occlusion, total ); + sample( IN.uv7, kernel.w, centerTap, usedCount, occlusion, total ); + + occlusion += TORQUE_TEX2D( occludeMap, IN.uv0.zw ).r * 0.5; + total += 0.5; + //occlusion /= 3.0; + + //occlusion /= (float)usedCount / 8.0; + occlusion /= total; + + return float4( occlusion.rrr, 1 ); + + + //return float4( 0,0,0,occlusion ); + + //float3 color = TORQUE_TEX2D( colorMap, IN.uv0.zw ); + + //return float4( color, occlusion ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_Blur_V.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_Blur_V.hlsl new file mode 100644 index 000000000..6ab278900 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_Blur_V.hlsl @@ -0,0 +1,86 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" +#include "./../../torque.hlsl" + + +uniform float2 texSize0; +uniform float2 oneOverTargetSize; +uniform float4 rtParams0; + +struct VertToPix +{ + float4 hpos : TORQUE_POSITION; + + float4 uv0 : TEXCOORD0; + float2 uv1 : TEXCOORD1; + float2 uv2 : TEXCOORD2; + float2 uv3 : TEXCOORD3; + + float2 uv4 : TEXCOORD4; + float2 uv5 : TEXCOORD5; + float2 uv6 : TEXCOORD6; + float2 uv7 : TEXCOORD7; +}; + +VertToPix main( PFXVert IN ) +{ + VertToPix OUT; + + OUT.hpos = float4(IN.pos,1.0); + + IN.uv = viewportCoordToRenderTarget( IN.uv, rtParams0 ); + + //float4 step = float4( 3.5, 2.5, 1.5, 0.5 ); + //float4 step = float4( 4.0, 3.0, 2.0, 1.0 ); + float4 step = float4( 9.0, 5.0, 2.5, 0.5 ); + + // I don't know why this offset is necessary, but it is. + //IN.uv = IN.uv * oneOverTargetSize; + + OUT.uv0.xy = IN.uv + ( ( BLUR_DIR * step.x ) / texSize0 ); + OUT.uv1 = IN.uv + ( ( BLUR_DIR * step.y ) / texSize0 ); + OUT.uv2 = IN.uv + ( ( BLUR_DIR * step.z ) / texSize0 ); + OUT.uv3 = IN.uv + ( ( BLUR_DIR * step.w ) / texSize0 ); + + OUT.uv4 = IN.uv - ( ( BLUR_DIR * step.x ) / texSize0 ); + OUT.uv5 = IN.uv - ( ( BLUR_DIR * step.y ) / texSize0 ); + OUT.uv6 = IN.uv - ( ( BLUR_DIR * step.z ) / texSize0 ); + OUT.uv7 = IN.uv - ( ( BLUR_DIR * step.w ) / texSize0 ); + + OUT.uv0.zw = IN.uv; + + /* + OUT.uv0 = viewportCoordToRenderTarget( OUT.uv0, rtParams0 ); + OUT.uv1 = viewportCoordToRenderTarget( OUT.uv1, rtParams0 ); + OUT.uv2 = viewportCoordToRenderTarget( OUT.uv2, rtParams0 ); + OUT.uv3 = viewportCoordToRenderTarget( OUT.uv3, rtParams0 ); + + OUT.uv4 = viewportCoordToRenderTarget( OUT.uv4, rtParams0 ); + OUT.uv5 = viewportCoordToRenderTarget( OUT.uv5, rtParams0 ); + OUT.uv6 = viewportCoordToRenderTarget( OUT.uv6, rtParams0 ); + OUT.uv7 = viewportCoordToRenderTarget( OUT.uv7, rtParams0 ); + */ + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_P.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_P.hlsl new file mode 100644 index 000000000..ff31a4b8b --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_P.hlsl @@ -0,0 +1,272 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../shaderModelAutoGen.hlsl" +#include "./../postFx.hlsl" + +#define DOSMALL +#define DOLARGE + +TORQUE_UNIFORM_SAMPLER2D(deferredMap,0); +TORQUE_UNIFORM_SAMPLER2D(randNormalTex,1); +TORQUE_UNIFORM_SAMPLER1D(powTable,2); + +uniform float2 nearFar; +uniform float2 worldToScreenScale; +uniform float2 texSize0; +uniform float2 texSize1; +uniform float2 targetSize; + +// Script-set constants. + +uniform float overallStrength; + +uniform float sRadius; +uniform float sStrength; +uniform float sDepthMin; +uniform float sDepthMax; +uniform float sDepthPow; +uniform float sNormalTol; +uniform float sNormalPow; + +uniform float lRadius; +uniform float lStrength; +uniform float lDepthMin; +uniform float lDepthMax; +uniform float lDepthPow; +uniform float lNormalTol; +uniform float lNormalPow; + + +#ifndef QUALITY + #define QUALITY 2 +#endif + + +#if QUALITY == 0 + #define sSampleCount 4 + #define totalSampleCount 12 +#elif QUALITY == 1 + #define sSampleCount 6 + #define totalSampleCount 24 +#elif QUALITY == 2 + #define sSampleCount 8 + #define totalSampleCount 32 +#endif + + +float getOcclusion( float depthDiff, float depthMin, float depthMax, float depthPow, + float normalDiff, float dt, float normalTol, float normalPow ) +{ + if ( depthDiff < 0.0 ) + return 0.0; + + float delta = abs( depthDiff ); + + if ( delta < depthMin || delta > depthMax ) + return 0.0; + + delta = saturate( delta / depthMax ); + + if ( dt > 0.0 ) + normalDiff *= dt; + else + normalDiff = 1.0; + + + normalDiff *= 1.0 - ( dt * 0.5 + 0.5 ); + + return ( 1.0 - TORQUE_TEX1D( powTable, delta ).r ) * normalDiff; +} + + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float3 ptSphere[32] = + { + float3( 0.295184, 0.077723, 0.068429 ), + float3( -0.271976, -0.365221, -0.838363 ), + float3( 0.547713, 0.467576, 0.488515 ), + float3( 0.662808, -0.031733, -0.584758 ), + float3( -0.025717, 0.218955, -0.657094 ), + float3( -0.310153, -0.365223, -0.370701 ), + float3( -0.101407, -0.006313, -0.747665 ), + float3( -0.769138, 0.360399, -0.086847 ), + float3( -0.271988, -0.275140, -0.905353 ), + float3( 0.096740, -0.566901, 0.700151 ), + float3( 0.562872, -0.735136, -0.094647 ), + float3( 0.379877, 0.359278, 0.190061 ), + float3( 0.519064, -0.023055, 0.405068 ), + float3( -0.301036, 0.114696, -0.088885 ), + float3( -0.282922, 0.598305, 0.487214 ), + float3( -0.181859, 0.251670, -0.679702 ), + float3( -0.191463, -0.635818, -0.512919 ), + float3( -0.293655, 0.427423, 0.078921 ), + float3( -0.267983, 0.680534, -0.132880 ), + float3( 0.139611, 0.319637, 0.477439 ), + float3( -0.352086, 0.311040, 0.653913 ), + float3( 0.321032, 0.805279, 0.487345 ), + float3( 0.073516, 0.820734, -0.414183 ), + float3( -0.155324, 0.589983, -0.411460 ), + float3( 0.335976, 0.170782, -0.527627 ), + float3( 0.463460, -0.355658, -0.167689 ), + float3( 0.222654, 0.596550, -0.769406 ), + float3( 0.922138, -0.042070, 0.147555 ), + float3( -0.727050, -0.329192, 0.369826 ), + float3( -0.090731, 0.533820, 0.463767 ), + float3( -0.323457, -0.876559, -0.238524 ), + float3( -0.663277, -0.372384, -0.342856 ) + }; + + // Sample a random normal for reflecting the + // sphere vector later in our loop. + float4 noiseMapUV = float4( ( IN.uv1 * ( targetSize / texSize1 ) ).xy, 0, 0 ); + float3 reflectNormal = normalize( TORQUE_TEX2DLOD( randNormalTex, noiseMapUV ).xyz * 2.0 - 1.0 ); + //return float4( reflectNormal, 1 ); + + float4 deferred = TORQUE_DEFERRED_UNCONDITION( deferredMap, IN.uv0 ); + float3 normal = deferred.xyz; + float depth = deferred.a; + //return float4( ( depth ).xxx, 1 ); + + // Early out if too far away. + if ( depth > 0.99999999 ) + return float4( 0,0,0,0 ); + + // current fragment coords in screen space + float3 ep = float3( IN.uv0, depth ); + + float bl; + float3 baseRay, ray, se, occNorm, projRadius; + float normalDiff = 0; + float depthMin, depthMax, dt, depthDiff; + float4 occluderFragment; + int i; + float sOcclusion = 0.0; + float lOcclusion = 0.0; + + //------------------------------------------------------------ + // Small radius + //------------------------------------------------------------ + +#ifdef DOSMALL + + bl = 0.0; + + projRadius.xy = ( float2( sRadius.rr ) / ( depth * nearFar.y ) ) * ( worldToScreenScale / texSize0 ); + projRadius.z = sRadius / nearFar.y; + + depthMin = projRadius.z * sDepthMin; + depthMax = projRadius.z * sDepthMax; + + //float maxr = 1; + //radiusDepth = clamp( radiusDepth, 0.0001, maxr.rrr ); + //if ( radiusDepth.x < 1.0 / targetSize.x ) + // return color; + //radiusDepth.xyz = 0.0009; + [unroll] + for ( i = 0; i < sSampleCount; i++ ) + { + baseRay = reflect( ptSphere[i], reflectNormal ); + + dt = dot( baseRay.xyz, normal ); + + baseRay *= sign( dt ); + + ray = ( projRadius * baseRay.xzy ); + ray.y = -ray.y; + + se = ep + ray; + + occluderFragment = TORQUE_DEFERRED_UNCONDITION( deferredMap, se.xy ); + + depthDiff = se.z - occluderFragment.a; + + dt = dot( occluderFragment.xyz, baseRay.xyz ); + normalDiff = dot( occluderFragment.xyz, normal ); + + bl += getOcclusion( depthDiff, depthMin, depthMax, sDepthPow, normalDiff, dt, sNormalTol, sNormalPow ); + } + + sOcclusion = sStrength * ( bl / (float)sSampleCount ); + +#endif // DOSMALL + + + //------------------------------------------------------------ + // Large radius + //------------------------------------------------------------ + +#ifdef DOLARGE + + bl = 0.0; + + projRadius.xy = ( float2( lRadius.rr ) / ( depth * nearFar.y ) ) * ( worldToScreenScale / texSize0 ); + projRadius.z = lRadius / nearFar.y; + + depthMin = projRadius.z * lDepthMin; + depthMax = projRadius.z * lDepthMax; + + //projRadius.xy = clamp( projRadius.xy, 0.0, 0.01 ); + //float maxr = 1; + //radiusDepth = clamp( radiusDepth, 0.0001, maxr.rrr ); + //if ( radiusDepth.x < 1.0 / targetSize.x ) + // return color; + //radiusDepth.xyz = 0.0009; + [unroll] + for ( i = sSampleCount; i < totalSampleCount; i++ ) + { + baseRay = reflect( ptSphere[i], reflectNormal ); + + dt = dot( baseRay.xyz, normal ); + + baseRay *= sign( dt ); + + ray = ( projRadius * baseRay.xzy ); + ray.y = -ray.y; + + se = ep + ray; + + occluderFragment = TORQUE_DEFERRED_UNCONDITION( deferredMap, se.xy ); + + depthDiff = se.z - occluderFragment.a; + + normalDiff = dot( occluderFragment.xyz, normal ); + dt = dot( occluderFragment.xyz, baseRay.xyz ); + + bl += getOcclusion( depthDiff, depthMin, depthMax, lDepthPow, normalDiff, dt, lNormalTol, lNormalPow ); + } + + lOcclusion = lStrength * ( bl / (float)( totalSampleCount - sSampleCount ) ); + +#endif // DOLARGE + + float occlusion = saturate( max( sOcclusion, lOcclusion ) * overallStrength ); + + // Note black is unoccluded and white is fully occluded. This + // seems backwards, but it makes it simple to deal with the SSAO + // being disabled in the lighting shaders. + + return occlusion; +} + + diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_PowerTable_P.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_PowerTable_P.hlsl new file mode 100644 index 000000000..696947d3e --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_PowerTable_P.hlsl @@ -0,0 +1,29 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float power = pow( max( IN.uv0.x, 0 ), 0.1 ); + return float4( power, 0, 0, 1 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_PowerTable_V.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_PowerTable_V.hlsl new file mode 100644 index 000000000..76f67e711 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/SSAO_PowerTable_V.hlsl @@ -0,0 +1,45 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./../postFx.hlsl" +#include "./../../torque.hlsl" + + +uniform float4 rtParams0; +uniform float4 rtParams1; +uniform float4 rtParams2; +uniform float4 rtParams3; + +PFXVertToPix main( PFXVert IN ) +{ + PFXVertToPix OUT; + + OUT.hpos = float4(IN.pos,1.0); + OUT.uv0 = IN.uv; //viewportCoordToRenderTarget( IN.uv, rtParams0 ); + OUT.uv1 = IN.uv; //viewportCoordToRenderTarget( IN.uv, rtParams1 ); + OUT.uv2 = IN.uv; //viewportCoordToRenderTarget( IN.uv, rtParams2 ); + OUT.uv3 = IN.uv; //viewportCoordToRenderTarget( IN.uv, rtParams3 ); + + OUT.wsEyeRay = IN.wsEyeRay; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_Blur_P.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_Blur_P.glsl new file mode 100644 index 000000000..cae920af8 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_Blur_P.glsl @@ -0,0 +1,108 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +in vec4 uv0; +#define IN_uv0 uv0 +in vec2 uv1; +#define IN_uv1 uv1 +in vec2 uv2; +#define IN_uv2 uv2 +in vec2 uv3; +#define IN_uv3 uv3 + +in vec2 uv4; +#define IN_uv4 uv4 +in vec2 uv5; +#define IN_uv5 uv5 +in vec2 uv6; +#define IN_uv6 uv6 +in vec2 uv7; +#define IN_uv7 uv7 + +uniform sampler2D occludeMap ; +uniform sampler2D deferredMap ; +uniform float blurDepthTol; +uniform float blurNormalTol; + +out vec4 OUT_col; + +void _sample( vec2 uv, float weight, vec4 centerTap, inout int usedCount, inout float occlusion, inout float total ) +{ + //return; + vec4 tap = deferredUncondition( deferredMap, uv ); + + if ( abs( tap.a - centerTap.a ) < blurDepthTol ) + { + if ( dot( tap.xyz, centerTap.xyz ) > blurNormalTol ) + { + usedCount++; + total += weight; + occlusion += texture( occludeMap, uv ).r * weight; + } + } +} + +void main() +{ + //vec4 centerTap; + vec4 centerTap = deferredUncondition( deferredMap, IN_uv0.zw ); + + //return centerTap; + + //float centerOcclude = texture( occludeMap, IN_uv0.zw ).r; + //return vec4( centerOcclude.rrr, 1 ); + + vec4 kernel = vec4( 0.175, 0.275, 0.375, 0.475 ); //25f; + + float occlusion = 0; + int usedCount = 0; + float total = 0.0; + + _sample( IN_uv0.xy, kernel.x, centerTap, usedCount, occlusion, total ); + _sample( IN_uv1, kernel.y, centerTap, usedCount, occlusion, total ); + _sample( IN_uv2, kernel.z, centerTap, usedCount, occlusion, total ); + _sample( IN_uv3, kernel.w, centerTap, usedCount, occlusion, total ); + + _sample( IN_uv4, kernel.x, centerTap, usedCount, occlusion, total ); + _sample( IN_uv5, kernel.y, centerTap, usedCount, occlusion, total ); + _sample( IN_uv6, kernel.z, centerTap, usedCount, occlusion, total ); + _sample( IN_uv7, kernel.w, centerTap, usedCount, occlusion, total ); + + occlusion += texture( occludeMap, IN_uv0.zw ).r * 0.5; + total += 0.5; + //occlusion /= 3.0; + + //occlusion /= (float)usedCount / 8.0; + occlusion /= total; + + OUT_col = vec4( vec3(occlusion), 1 ); + + + //return vec4( 0,0,0,occlusion ); + + //vec3 color = texture( colorMap, IN_uv0.zw ); + + //return vec4( color, occlusion ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_Blur_V.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_Blur_V.glsl new file mode 100644 index 000000000..45a52e890 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_Blur_V.glsl @@ -0,0 +1,96 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +#include "../../../gl/torque.glsl" +#include "../../../gl/hlslCompat.glsl" + +in vec4 vPosition; +in vec2 vTexCoord0; + +#define IN_pos vPosition +#define _IN_uv vTexCoord0 + +uniform vec2 texSize0; +uniform vec4 rtParams0; +uniform vec2 oneOverTargetSize; + +#define OUT_hpos gl_Position + +out vec4 uv0; +#define OUT_uv0 uv0 +out vec2 uv1; +#define OUT_uv1 uv1 +out vec2 uv2; +#define OUT_uv2 uv2 +out vec2 uv3; +#define OUT_uv3 uv3 + +out vec2 uv4; +#define OUT_uv4 uv4 +out vec2 uv5; +#define OUT_uv5 uv5 +out vec2 uv6; +#define OUT_uv6 uv6 +out vec2 uv7; +#define OUT_uv7 uv7 + + +void main() +{ + OUT_hpos = IN_pos; + + vec2 IN_uv = viewportCoordToRenderTarget( _IN_uv, rtParams0 ); + + //vec4 step = vec4( 3.5, 2.5, 1.5, 0.5 ); + //vec4 step = vec4( 4.0, 3.0, 2.0, 1.0 ); + vec4 step = vec4( 9.0, 5.0, 2.5, 0.5 ); + + // I don't know why this offset is necessary, but it is. + //IN_uv = IN_uv * oneOverTargetSize; + + OUT_uv0.xy = IN_uv + ( ( BLUR_DIR * step.x ) / texSize0 ); + OUT_uv1 = IN_uv + ( ( BLUR_DIR * step.y ) / texSize0 ); + OUT_uv2 = IN_uv + ( ( BLUR_DIR * step.z ) / texSize0 ); + OUT_uv3 = IN_uv + ( ( BLUR_DIR * step.w ) / texSize0 ); + + OUT_uv4 = IN_uv - ( ( BLUR_DIR * step.x ) / texSize0 ); + OUT_uv5 = IN_uv - ( ( BLUR_DIR * step.y ) / texSize0 ); + OUT_uv6 = IN_uv - ( ( BLUR_DIR * step.z ) / texSize0 ); + OUT_uv7 = IN_uv - ( ( BLUR_DIR * step.w ) / texSize0 ); + + OUT_uv0.zw = IN_uv; + + /* + OUT_uv0 = viewportCoordToRenderTarget( OUT_uv0, rtParams0 ); + OUT_uv1 = viewportCoordToRenderTarget( OUT_uv1, rtParams0 ); + OUT_uv2 = viewportCoordToRenderTarget( OUT_uv2, rtParams0 ); + OUT_uv3 = viewportCoordToRenderTarget( OUT_uv3, rtParams0 ); + + OUT_uv4 = viewportCoordToRenderTarget( OUT_uv4, rtParams0 ); + OUT_uv5 = viewportCoordToRenderTarget( OUT_uv5, rtParams0 ); + OUT_uv6 = viewportCoordToRenderTarget( OUT_uv6, rtParams0 ); + OUT_uv7 = viewportCoordToRenderTarget( OUT_uv7, rtParams0 ); + */ + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_P.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_P.glsl new file mode 100644 index 000000000..cfff88381 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_P.glsl @@ -0,0 +1,278 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/postFX.glsl" + +#define DOSMALL +#define DOLARGE + +uniform sampler2D deferredMap ; +uniform sampler2D randNormalTex ; +uniform sampler1D powTable ; + +uniform vec2 nearFar; +uniform vec2 worldToScreenScale; +uniform vec2 texSize0; +uniform vec2 texSize1; +uniform vec2 targetSize; + +// Script-set constants. + +uniform float overallStrength; + +uniform float sRadius; +uniform float sStrength; +uniform float sDepthMin; +uniform float sDepthMax; +uniform float sDepthPow; +uniform float sNormalTol; +uniform float sNormalPow; + +uniform float lRadius; +uniform float lStrength; +uniform float lDepthMin; +uniform float lDepthMax; +uniform float lDepthPow; +uniform float lNormalTol; +uniform float lNormalPow; + +out vec4 OUT_col; + + +#ifndef QUALITY + #define QUALITY 2 +#endif + + +#if QUALITY == 0 + #define sSampleCount 4 + #define totalSampleCount 12 +#elif QUALITY == 1 + #define sSampleCount 6 + #define totalSampleCount 24 +#elif QUALITY == 2 + #define sSampleCount 8 + #define totalSampleCount 32 +#endif + + +float getOcclusion( float depthDiff, float depthMin, float depthMax, float depthPow, + float normalDiff, float dt, float normalTol, float normalPow ) +{ + if ( depthDiff < 0.0 ) + return 0.0; + + float delta = abs( depthDiff ); + + if ( delta < depthMin || delta > depthMax ) + return 0.0; + + delta = saturate( delta / depthMax ); + + if ( dt > 0.0 ) + normalDiff *= dt; + else + normalDiff = 1.0; + + + normalDiff *= 1.0 - ( dt * 0.5 + 0.5 ); + + return ( 1.0 - texture( powTable, delta ).r ) * normalDiff; +} + + +void main() +{ + const vec3 ptSphere[32] = vec3[] + ( + vec3( 0.295184, 0.077723, 0.068429 ), + vec3( -0.271976, -0.365221, -0.838363 ), + vec3( 0.547713, 0.467576, 0.488515 ), + vec3( 0.662808, -0.031733, -0.584758 ), + vec3( -0.025717, 0.218955, -0.657094 ), + vec3( -0.310153, -0.365223, -0.370701 ), + vec3( -0.101407, -0.006313, -0.747665 ), + vec3( -0.769138, 0.360399, -0.086847 ), + vec3( -0.271988, -0.275140, -0.905353 ), + vec3( 0.096740, -0.566901, 0.700151 ), + vec3( 0.562872, -0.735136, -0.094647 ), + vec3( 0.379877, 0.359278, 0.190061 ), + vec3( 0.519064, -0.023055, 0.405068 ), + vec3( -0.301036, 0.114696, -0.088885 ), + vec3( -0.282922, 0.598305, 0.487214 ), + vec3( -0.181859, 0.251670, -0.679702 ), + vec3( -0.191463, -0.635818, -0.512919 ), + vec3( -0.293655, 0.427423, 0.078921 ), + vec3( -0.267983, 0.680534, -0.132880 ), + vec3( 0.139611, 0.319637, 0.477439 ), + vec3( -0.352086, 0.311040, 0.653913 ), + vec3( 0.321032, 0.805279, 0.487345 ), + vec3( 0.073516, 0.820734, -0.414183 ), + vec3( -0.155324, 0.589983, -0.411460 ), + vec3( 0.335976, 0.170782, -0.527627 ), + vec3( 0.463460, -0.355658, -0.167689 ), + vec3( 0.222654, 0.596550, -0.769406 ), + vec3( 0.922138, -0.042070, 0.147555 ), + vec3( -0.727050, -0.329192, 0.369826 ), + vec3( -0.090731, 0.533820, 0.463767 ), + vec3( -0.323457, -0.876559, -0.238524 ), + vec3( -0.663277, -0.372384, -0.342856 ) + ); + + // Sample a random normal for reflecting the + // sphere vector later in our loop. + vec4 noiseMapUV = vec4( ( IN_uv1 * ( targetSize / texSize1 ) ).xy, 0, 0 ); + vec3 reflectNormal = normalize( tex2Dlod( randNormalTex, noiseMapUV ).xyz * 2.0 - 1.0 ); + //return vec4( reflectNormal, 1 ); + + vec4 deferred = deferredUncondition( deferredMap, IN_uv0 ); + vec3 normal = deferred.xyz; + float depth = deferred.a; + //return vec4( ( depth ).xxx, 1 ); + + // Early out if too far away. + if ( depth > 0.99999999 ) + { + OUT_col = vec4( 0,0,0,0 ); + return; + } + + // current fragment coords in screen space + vec3 ep = vec3( IN_uv0, depth ); + + float bl; + vec3 baseRay, ray, se, occNorm, projRadius; + float normalDiff = 0; + float depthMin, depthMax, dt, depthDiff; + vec4 occluderFragment; + int i; + float sOcclusion = 0.0; + float lOcclusion = 0.0; + + //------------------------------------------------------------ + // Small radius + //------------------------------------------------------------ + +#ifdef DOSMALL + + bl = 0.0; + + projRadius.xy = ( vec2( sRadius ) / ( depth * nearFar.y ) ) * ( worldToScreenScale / texSize0 ); + projRadius.z = sRadius / nearFar.y; + + depthMin = projRadius.z * sDepthMin; + depthMax = projRadius.z * sDepthMax; + + //float maxr = 1; + //radiusDepth = clamp( radiusDepth, 0.0001, maxr.rrr ); + //if ( radiusDepth.x < 1.0 / targetSize.x ) + // return color; + //radiusDepth.xyz = 0.0009; + + for ( i = 0; i < sSampleCount; i++ ) + { + baseRay = reflect( ptSphere[i], reflectNormal ); + + dt = dot( baseRay.xyz, normal ); + + baseRay *= sign( dt ); + + ray = ( projRadius * baseRay.xzy ); + ray.y = -ray.y; + + se = ep + ray; + + occluderFragment = deferredUncondition( deferredMap, se.xy ); + + depthDiff = se.z - occluderFragment.a; + + dt = dot( occluderFragment.xyz, baseRay.xyz ); + normalDiff = dot( occluderFragment.xyz, normal ); + + bl += getOcclusion( depthDiff, depthMin, depthMax, sDepthPow, normalDiff, dt, sNormalTol, sNormalPow ); + } + + sOcclusion = sStrength * ( bl / float(sSampleCount) ); + +#endif // DOSMALL + + + //------------------------------------------------------------ + // Large radius + //------------------------------------------------------------ + +#ifdef DOLARGE + + bl = 0.0; + + projRadius.xy = ( vec2( lRadius ) / ( depth * nearFar.y ) ) * ( worldToScreenScale / texSize0 ); + projRadius.z = lRadius / nearFar.y; + + depthMin = projRadius.z * lDepthMin; + depthMax = projRadius.z * lDepthMax; + + //projRadius.xy = clamp( projRadius.xy, 0.0, 0.01 ); + //float maxr = 1; + //radiusDepth = clamp( radiusDepth, 0.0001, maxr.rrr ); + //if ( radiusDepth.x < 1.0 / targetSize.x ) + // return color; + //radiusDepth.xyz = 0.0009; + + for ( i = sSampleCount; i < totalSampleCount; i++ ) + { + baseRay = reflect( ptSphere[i], reflectNormal ); + + dt = dot( baseRay.xyz, normal ); + + baseRay *= sign( dt ); + + ray = ( projRadius * baseRay.xzy ); + ray.y = -ray.y; + + se = ep + ray; + + occluderFragment = deferredUncondition( deferredMap, se.xy ); + + depthDiff = se.z - occluderFragment.a; + + normalDiff = dot( occluderFragment.xyz, normal ); + dt = dot( occluderFragment.xyz, baseRay.xyz ); + + bl += getOcclusion( depthDiff, depthMin, depthMax, lDepthPow, normalDiff, dt, lNormalTol, lNormalPow ); + } + + lOcclusion = lStrength * ( bl / float( totalSampleCount - sSampleCount ) ); + +#endif // DOLARGE + + float occlusion = saturate( max( sOcclusion, lOcclusion ) * overallStrength ); + + // Note black is unoccluded and white is fully occluded. This + // seems backwards, but it makes it simple to deal with the SSAO + // being disabled in the lighting shaders. + + OUT_col = vec4(occlusion, vec3(0.0)); +} + + diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_PowerTable_P.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_PowerTable_P.glsl new file mode 100644 index 000000000..4f49479ba --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_PowerTable_P.glsl @@ -0,0 +1,34 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" + +in vec2 uv0; +#define IN_uv0 uv0 + +out vec4 OUT_col; + +void main() +{ + float power = pow( max( IN_uv0.x, 0 ), 0.1 ); + OUT_col = vec4( power, 0, 0, 1 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_PowerTable_V.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_PowerTable_V.glsl new file mode 100644 index 000000000..a193f63ce --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/ssao/gl/SSAO_PowerTable_V.glsl @@ -0,0 +1,38 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/torque.glsl" +#include "../../../gl/hlslCompat.glsl" +#include "../../gl/postFX.glsl" + +void main() +{ + OUT_hpos = IN_pos; + OUT_uv0 = IN_uv; //viewportCoordToRenderTarget( IN_uv, rtParams0 ); + OUT_uv1 = IN_uv; //viewportCoordToRenderTarget( IN_uv, rtParams1 ); + OUT_uv2 = IN_uv; //viewportCoordToRenderTarget( IN_uv, rtParams2 ); + OUT_uv3 = IN_uv; //viewportCoordToRenderTarget( IN_uv, rtParams3 ); + + OUT_wsEyeRay = IN_wsEyeRay; + + correctSSP(gl_Position); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/turbulenceP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/turbulenceP.hlsl new file mode 100644 index 000000000..c8c572ae7 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/turbulenceP.hlsl @@ -0,0 +1,44 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./postFx.hlsl" + +uniform float accumTime; +uniform float2 projectionOffset; +uniform float4 targetViewport; +TORQUE_UNIFORM_SAMPLER2D(inputTex, 0); + + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + float speed = 2.0; + float distortion = 6.0; + + float y = IN.uv0.y + (cos((IN.uv0.y+projectionOffset.y) * distortion + accumTime * speed) * 0.01); + float x = IN.uv0.x + (sin((IN.uv0.x+projectionOffset.x) * distortion + accumTime * speed) * 0.01); + + // Clamp the calculated uv values to be within the target's viewport + y = clamp(y, targetViewport.y, targetViewport.w); + x = clamp(x, targetViewport.x, targetViewport.z); + + return TORQUE_TEX2D(inputTex, float2(x, y)); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/underwaterFogP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/underwaterFogP.hlsl new file mode 100644 index 000000000..aab43c45c --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/underwaterFogP.hlsl @@ -0,0 +1,138 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "./postFx.hlsl" +#include "../torque.hlsl" +#include "../shaderModelAutoGen.hlsl" +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- + +// oceanFogData +#define FOG_DENSITY waterFogData[0] +#define FOG_DENSITY_OFFSET waterFogData[1] +#define WET_DEPTH waterFogData[2] +#define WET_DARKENING waterFogData[3] + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- + +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 0); +TORQUE_UNIFORM_SAMPLER2D(backbuffer, 1); +TORQUE_UNIFORM_SAMPLER1D(waterDepthGradMap, 2); + +uniform float3 eyePosWorld; +uniform float waterDepthGradMax; +uniform float3 ambientColor; +uniform float4 waterColor; +uniform float4 waterFogData; +uniform float4 waterFogPlane; +uniform float2 nearFar; +uniform float4 rtParams0; + + +float4 main( PFXVertToPix IN ) : TORQUE_TARGET0 +{ + //float2 deferredCoord = IN.uv0; + //IN.uv0 = ( IN.uv0.xy * rtParams0.zw ) + rtParams0.xy; + float depth = TORQUE_DEFERRED_UNCONDITION( deferredTex, IN.uv0 ).w; + //return float4( depth.rrr, 1 ); + + // Skip fogging the extreme far plane so that + // the canvas clear color always appears. + //clip( 0.9 - depth ); + + // We assume that the eye position is below water because + // otherwise this shader/posteffect should not be active. + + depth *= nearFar.y; + + float3 eyeRay = normalize( IN.wsEyeRay ); + + float3 rayStart = eyePosWorld; + float3 rayEnd = eyePosWorld + ( eyeRay * depth ); + //return float4( rayEnd, 1 ); + + float4 plane = waterFogPlane; //float4( 0, 0, 1, -waterHeight ); + //plane.w -= 0.15; + + float startSide = dot( plane.xyz, rayStart ) + plane.w; + if ( startSide > 0 ) + { + rayStart.z -= ( startSide ); + //return float4( 1, 0, 0, 1 ); + } + + float3 hitPos; + float3 ray = rayEnd - rayStart; + float rayLen = length( ray ); + float3 rayDir = normalize( ray ); + + float endSide = dot( plane.xyz, rayEnd ) + plane.w; + float planeDist; + + if ( endSide < -0.005 ) + { + //return float4( 0, 0, 1, 1 ); + hitPos = rayEnd; + planeDist = endSide; + } + else + { + //return float4( 0, 0, 0, 0 ); + float den = dot( ray, plane.xyz ); + + // Parallal to the plane, return the endPnt. + //if ( den == 0.0f ) + // return endPnt; + + float dist = -( dot( plane.xyz, rayStart ) + plane.w ) / den; + if ( dist < 0.0 ) + dist = 0.0; + //return float4( 1, 0, 0, 1 ); + //return float4( ( dist ).rrr, 1 ); + + + hitPos = lerp( rayStart, rayEnd, dist ); + + planeDist = dist; + } + + float delta = length( hitPos - rayStart ); + + float fogAmt = 1.0 - saturate( exp( -FOG_DENSITY * ( delta - FOG_DENSITY_OFFSET ) ) ); + //return float4( fogAmt.rrr, 1 ); + + // Calculate the water "base" color based on depth. + float4 fogColor = waterColor * TORQUE_TEX1D( waterDepthGradMap, saturate( delta / waterDepthGradMax ) ); + // Modulate baseColor by the ambientColor. + fogColor *= float4( ambientColor.rgb, 1 ); + + float3 inColor = hdrDecode( TORQUE_TEX2D( backbuffer, IN.uv0 ).rgb ); + inColor.rgb *= 1.0 - saturate( abs( planeDist ) / WET_DEPTH ) * WET_DARKENING; + //return float4( inColor, 1 ); + + float3 outColor = lerp( inColor, fogColor.rgb, fogAmt ); + + return float4( hdrEncode( outColor ), 1 ); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/vignette/VignetteP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/vignette/VignetteP.hlsl new file mode 100644 index 000000000..c518a2145 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/vignette/VignetteP.hlsl @@ -0,0 +1,35 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../postFx.hlsl" + +TORQUE_UNIFORM_SAMPLER2D(backBuffer, 0); +uniform float Vmax; +uniform float Vmin; + +float4 main(PFXVertToPix IN) : TORQUE_TARGET0 +{ + float4 base = TORQUE_TEX2D(backBuffer, IN.uv0); + float dist = distance(IN.uv0, float2(0.5,0.5)); + base.rgb *= smoothstep(Vmax, Vmin, dist); + return base; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/postFX/vignette/gl/VignetteP.glsl b/Templates/BaseGame/game/core/rendering/shaders/postFX/vignette/gl/VignetteP.glsl new file mode 100644 index 000000000..35de95c34 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/postFX/vignette/gl/VignetteP.glsl @@ -0,0 +1,41 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +uniform sampler2D backBuffer; +uniform float Vmax; +uniform float Vmin; + +in vec2 uv0; +#define IN_uv0 uv0 + +out vec4 OUT_col; + +void main() +{ + vec4 base = texture(backBuffer, IN_uv0); + float dist = distance(IN_uv0, vec2(0.5,0.5)); + base.rgb *= smoothstep(Vmax, Vmin, dist); + OUT_col = base; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/precipP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/precipP.hlsl new file mode 100644 index 000000000..069ba4992 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/precipP.hlsl @@ -0,0 +1,53 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct Conn +{ + float4 position : TORQUE_POSITION; + float2 texCoord : TEXCOORD0; + float4 color : COLOR0; +}; + +struct Frag +{ + float4 col : TORQUE_TARGET0; +}; + +TORQUE_UNIFORM_SAMPLER2D(diffuseMap, 0); + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Frag main( Conn In) +{ + Frag Out; + + Out.col = TORQUE_TEX2D(diffuseMap, In.texCoord) * In.color; + + return Out; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/precipV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/precipV.hlsl new file mode 100644 index 000000000..3c40942c7 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/precipV.hlsl @@ -0,0 +1,71 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//***************************************************************************** +// Precipitation vertex shader +//***************************************************************************** +//----------------------------------------------------------------------------- +// Constants +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct Vert +{ + float3 position : POSITION; + float2 texCoord : TEXCOORD0; + float4 color : COLOR0; +}; + +struct Conn +{ + float4 position : TORQUE_POSITION; + float2 texCoord : TEXCOORD0; + float4 color : COLOR0; +}; + +uniform float4x4 modelview : register(C0); +uniform float2 fadeStartEnd : register(C4); +uniform float3 cameraPos : register(C5); +uniform float3 ambient : register(C6); + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Conn main( Vert In ) +{ + Conn Out; + + Out.position = mul(modelview, float4(In.position,1.0)); + Out.texCoord = In.texCoord; + Out.color = float4( ambient.r, ambient.g, ambient.b, 1 ); + + // Do we need to do a distance fade? + if ( fadeStartEnd.x < fadeStartEnd.y ) { + + float distance = length( cameraPos - In.position ); + Out.color.a = abs( clamp( ( distance - fadeStartEnd.x ) / ( fadeStartEnd.y - fadeStartEnd.x ), 0, 1 ) - 1 ); + } + + return Out; +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/projectedShadowP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/projectedShadowP.hlsl new file mode 100644 index 000000000..88713bd52 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/projectedShadowP.hlsl @@ -0,0 +1,40 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct Conn +{ + float4 position : TORQUE_POSITION; + float4 color : COLOR0; + float2 texCoord : TEXCOORD0; + float fade : TEXCOORD1; +}; + +TORQUE_UNIFORM_SAMPLER2D(inputTex, 0); +uniform float4 ambient; + +float4 main( Conn IN ) : TORQUE_TARGET0 +{ + float shadow = TORQUE_TEX2D( inputTex, IN.texCoord ).a * IN.color.a; + return ( ambient * shadow ) + ( 1 - shadow ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/projectedShadowV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/projectedShadowV.hlsl new file mode 100644 index 000000000..38b1bd3e2 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/projectedShadowV.hlsl @@ -0,0 +1,60 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +struct Vert +{ + float3 position : POSITION; + float3 normal : NORMAL; + float3 T : TANGENT; + float4 color : COLOR0; + float2 texCoord : TEXCOORD0; +}; + +struct Conn +{ + float4 position : TORQUE_POSITION; + float4 color : COLOR0; + float2 texCoord : TEXCOORD0; + float fade : TEXCOORD1; +}; + +uniform float4x4 modelview; +uniform float shadowLength; +uniform float3 shadowCasterPosition; + +Conn main( Vert In ) +{ + Conn Out; + + // Decals are in world space. + Out.position = mul( modelview, float4( In.position, 1.0 ) ); + + Out.color = In.color; + Out.texCoord = In.texCoord; + + float fromCasterDist = length( In.position - shadowCasterPosition ) - shadowLength; + Out.fade = 1.0 - saturate( fromCasterDist / shadowLength ); + + return Out; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/ribbons/basicRibbonShaderP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/ribbons/basicRibbonShaderP.hlsl new file mode 100644 index 000000000..f4c6c7b04 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/ribbons/basicRibbonShaderP.hlsl @@ -0,0 +1,19 @@ +#define IN_HLSL +#include "../shdrConsts.h" +#include "../shaderModel.hlsl" + +struct v2f +{ + float4 hpos : TORQUE_POSITION; + float4 color : COLOR0; + float2 texCoord : TEXCOORD0; + float2 shiftdata : TEXCOORD1; +}; + +float4 main(v2f IN) : TORQUE_TARGET0 +{ + float fade = 1.0 - abs(IN.shiftdata.y - 0.5) * 2.0; + IN.color.xyz = IN.color.xyz + pow(fade, 4) / 10; + IN.color.a = IN.color.a * fade; + return IN.color; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/ribbons/basicRibbonShaderV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/ribbons/basicRibbonShaderV.hlsl new file mode 100644 index 000000000..1a6bc85e4 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/ribbons/basicRibbonShaderV.hlsl @@ -0,0 +1,35 @@ +#define IN_HLSL +#include "../shdrConsts.h" +#include "../shaderModel.hlsl" + +struct a2v +{ + float3 position : POSITION; + float3 normal : NORMAL; + float4 color : COLOR0; + float2 texCoord : TEXCOORD0; + float2 shiftdata : TEXCOORD1; +}; + +struct v2f +{ + float4 hpos : TORQUE_POSITION; + float4 color : COLOR0; + float2 texCoord : TEXCOORD0; + float2 shiftdata : TEXCOORD1; +}; + +uniform float4x4 modelview; +uniform float3 eyePos; + +v2f main(a2v IN) +{ + v2f OUT; + + OUT.hpos = mul(modelview, float4(IN.position, 1.0)); + OUT.color = IN.color; + OUT.texCoord = IN.texCoord; + OUT.shiftdata = IN.shiftdata; + + return OUT; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/basicRibbonShaderP.glsl b/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/basicRibbonShaderP.glsl new file mode 100644 index 000000000..f3f83ce30 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/basicRibbonShaderP.glsl @@ -0,0 +1,20 @@ +#include "../../gl/hlslCompat.glsl" + +in float4 _hpos; +in float2 _texCoord; +in float2 _shiftdata; +in float4 _color; + +#define IN_hpos _hpos +#define IN_texCoord _texCoord +#define IN_shiftdata _shiftdata +#define IN_color _color + +out float4 OUT_col; + +void main() +{ + float fade = 1.0 - abs(IN_shiftdata.y - 0.5) * 2.0; + OUT_col.xyz = IN_color.xyz + pow(fade, 4) / 10; + OUT_col.a = IN_color.a * fade; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/basicRibbonShaderV.glsl b/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/basicRibbonShaderV.glsl new file mode 100644 index 000000000..9f6826d55 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/basicRibbonShaderV.glsl @@ -0,0 +1,37 @@ +#include "../../gl/hlslCompat.glsl" + +in float2 vTexCoord0; +in float2 vTexCoord1; +in float3 vNormal; +in float4 vPosition; +in float4 vColor; + +#define IN_texCoord vTexCoord0 +#define IN_shiftdata vTexCoord1 +#define IN_normal vNormal +#define IN_position vPosition +#define IN_color vColor + +out float4 _hpos; +out float2 _texCoord; +out float2 _shiftdata; +out float4 _color; + +#define OUT_hpos _hpos +#define OUT_texCoord _texCoord +#define OUT_shiftdata _shiftdata +#define OUT_color _color + +uniform float4x4 modelview; +uniform float3 eyePos; + +void main() +{ + OUT_hpos = tMul(modelview, IN_position); + OUT_color = IN_color; + OUT_texCoord = IN_texCoord; + OUT_shiftdata = IN_shiftdata; + + gl_Position = OUT_hpos; + correctSSP(gl_Position); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/texRibbonShaderP.glsl b/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/texRibbonShaderP.glsl new file mode 100644 index 000000000..cd3e72d43 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/texRibbonShaderP.glsl @@ -0,0 +1,22 @@ +#include "../../gl/hlslCompat.glsl" +#include "../../gl/torque.glsl" + +in float4 _hpos; +in float2 _texCoord; +in float2 _shiftdata; +in float4 _color; + +#define IN_hpos _hpos +#define IN_texCoord _texCoord +#define IN_shiftdata _shiftdata +#define IN_color _color + +out float4 OUT_col; +uniform sampler2D ribTex; + +void main() +{ + float4 Tex = tex2D(ribTex,IN_texCoord); + Tex.a *= IN_color.a; + OUT_col = hdrEncode(Tex); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/texRibbonShaderV.glsl b/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/texRibbonShaderV.glsl new file mode 100644 index 000000000..9f6826d55 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/ribbons/gl/texRibbonShaderV.glsl @@ -0,0 +1,37 @@ +#include "../../gl/hlslCompat.glsl" + +in float2 vTexCoord0; +in float2 vTexCoord1; +in float3 vNormal; +in float4 vPosition; +in float4 vColor; + +#define IN_texCoord vTexCoord0 +#define IN_shiftdata vTexCoord1 +#define IN_normal vNormal +#define IN_position vPosition +#define IN_color vColor + +out float4 _hpos; +out float2 _texCoord; +out float2 _shiftdata; +out float4 _color; + +#define OUT_hpos _hpos +#define OUT_texCoord _texCoord +#define OUT_shiftdata _shiftdata +#define OUT_color _color + +uniform float4x4 modelview; +uniform float3 eyePos; + +void main() +{ + OUT_hpos = tMul(modelview, IN_position); + OUT_color = IN_color; + OUT_texCoord = IN_texCoord; + OUT_shiftdata = IN_shiftdata; + + gl_Position = OUT_hpos; + correctSSP(gl_Position); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/ribbons/texRibbonShaderP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/ribbons/texRibbonShaderP.hlsl new file mode 100644 index 000000000..55bae76fd --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/ribbons/texRibbonShaderP.hlsl @@ -0,0 +1,21 @@ +#define IN_HLSL +#include "../shdrConsts.h" +#include "../torque.hlsl" + + +TORQUE_UNIFORM_SAMPLER2D(ribTex, 0); + +struct v2f +{ + float4 hpos : TORQUE_POSITION; + float4 color : COLOR0; + float2 texCoord : TEXCOORD0; + float2 shiftdata : TEXCOORD1; +}; + +float4 main(v2f IN) : TORQUE_TARGET0 +{ + float4 Tex = TORQUE_TEX2D(ribTex,IN.texCoord); + Tex.a *= IN.color.a; + return hdrEncode(Tex); +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/ribbons/texRibbonShaderV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/ribbons/texRibbonShaderV.hlsl new file mode 100644 index 000000000..2ce4f62fd --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/ribbons/texRibbonShaderV.hlsl @@ -0,0 +1,35 @@ +#define IN_HLSL +#include "../shdrConsts.h" +#include "../shaderModel.hlsl" + +struct a2v +{ + float3 position : POSITION; + float4 color : COLOR0; + float3 normal : NORMAL; + float2 texCoord : TEXCOORD0; + float2 shiftdata : TEXCOORD1; +}; + +struct v2f +{ + float4 hpos : TORQUE_POSITION; + float4 color : COLOR0; + float2 texCoord : TEXCOORD0; + float2 shiftdata : TEXCOORD1; +}; + +uniform float4x4 modelview; +uniform float3 eyePos; + +v2f main(a2v IN) +{ + v2f OUT; + + OUT.hpos = mul(modelview, float4(IN.position,1.0)); + OUT.color = IN.color; + OUT.texCoord = IN.texCoord; + OUT.shiftdata = IN.shiftdata; + + return OUT; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/scatterSkyP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/scatterSkyP.hlsl new file mode 100644 index 000000000..84e0854e0 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/scatterSkyP.hlsl @@ -0,0 +1,69 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" +#include "torque.hlsl" + +struct Conn +{ + float4 hpos : TORQUE_POSITION; + float4 rayleighColor : TEXCOORD0; + float4 mieColor : TEXCOORD1; + float3 v3Direction : TEXCOORD2; + float3 pos : TEXCOORD3; +}; + +TORQUE_UNIFORM_SAMPLERCUBE(nightSky, 0); +uniform float4 nightColor; +uniform float2 nightInterpAndExposure; +uniform float useCubemap; +uniform float3 lightDir; +uniform float3 sunDir; + +float4 main( Conn In ) : TORQUE_TARGET0 +{ + + float fCos = dot( lightDir, In.v3Direction ) / length(In.v3Direction); + float fCos2 = fCos*fCos; + + float g = -0.991; + float g2 = -0.991 * -0.991; + + float fMiePhase = 1.5 * ((1.0 - g2) / (2.0 + g2)) * (1.0 + fCos2) / pow(abs(1.0 + g2 - 2.0*g*fCos), 1.5); + + float4 color = In.rayleighColor + fMiePhase * In.mieColor; + color.a = color.b; + + float4 Out; + + float4 nightSkyColor = TORQUE_TEXCUBE(nightSky, -In.v3Direction); + nightSkyColor = lerp( nightColor, nightSkyColor, useCubemap ); + + float fac = dot( normalize( In.pos ), sunDir ); + fac = max( nightInterpAndExposure.y, pow( saturate( fac ), 2 ) ); + Out = lerp( color, nightSkyColor, nightInterpAndExposure.y ); + + Out.a = 1; + Out = saturate(Out); + + return hdrEncode( Out ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/scatterSkyV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/scatterSkyV.hlsl new file mode 100644 index 000000000..2052448db --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/scatterSkyV.hlsl @@ -0,0 +1,157 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "shaderModel.hlsl" + +// The scale equation calculated by Vernier's Graphical Analysis +float vernierScale(float fCos) +{ + float x = 1.0 - fCos; + float x5 = x * 5.25; + float x5p6 = (-6.80 + x5); + float xnew = (3.83 + x * x5p6); + float xfinal = (0.459 + x * xnew); + float xfinal2 = -0.00287 + x * xfinal; + float outx = exp( xfinal2 ); + return 0.25 * outx; +} + +// This is the shader input vertex structure. +struct Vert +{ + // .xyz = point + float3 position : POSITION; +}; + +// This is the shader output data. +struct Conn +{ + float4 position : TORQUE_POSITION; + float4 rayleighColor : TEXCOORD0; + float4 mieColor : TEXCOORD1; + float3 v3Direction : TEXCOORD2; + float3 pos : TEXCOORD3; +}; + +float3 desaturate(const float3 color, const float desaturation) +{ + const float3 gray_conv = float3 (0.30, 0.59, 0.11); + return lerp(color, dot(gray_conv , color), desaturation); +} + +uniform float4x4 modelView; +uniform float4 misc; +uniform float4 sphereRadii; +uniform float4 scatteringCoeffs; +uniform float4 colorize; +uniform float3 camPos; +uniform float3 lightDir; +uniform float4 invWaveLength; + +Conn main( Vert In ) +{ + // Pull some variables out: + float camHeight = misc.x; + float camHeightSqr = misc.y; + + float scale = misc.z; + float scaleOverScaleDepth = misc.w; + + float outerRadius = sphereRadii.x; + float outerRadiusSqr = sphereRadii.y; + + float innerRadius = sphereRadii.z; + float innerRadiusSqr = sphereRadii.w; + + float rayleighBrightness = scatteringCoeffs.x; // Kr * ESun + float rayleigh4PI = scatteringCoeffs.y; // Kr * 4 * PI + + float mieBrightness = scatteringCoeffs.z; // Km * ESun + float mie4PI = scatteringCoeffs.w; // Km * 4 * PI + + // Get the ray from the camera to the vertex, + // and its length (which is the far point of the ray + // passing through the atmosphere). + float4 v3Pos = float4(In.position,1.0) / 6378000.0; // outerRadius; + float3 newCamPos = float3( 0, 0, camHeight ); + v3Pos.z += innerRadius; + float3 v3Ray = v3Pos.xyz - newCamPos; + float fFar = length(v3Ray); + v3Ray /= fFar; + + // Calculate the ray's starting position, + // then calculate its scattering offset. + float3 v3Start = newCamPos; + float fHeight = length(v3Start); + float fDepth = exp(scaleOverScaleDepth * (innerRadius - camHeight)); + float fStartAngle = dot(v3Ray, v3Start) / fHeight; + + float fStartOffset = fDepth * vernierScale( fStartAngle ); + + // Initialize the scattering loop variables. + float fSampleLength = fFar / 2; + float fScaledLength = fSampleLength * scale; + float3 v3SampleRay = v3Ray * fSampleLength; + float3 v3SamplePoint = v3Start + v3SampleRay * 0.5; + + // Now loop through the sample rays + float3 v3FrontColor = float3(0.0, 0.0, 0.0); + for(int i=0; i<2; i++) + { + float fHeight = length(v3SamplePoint); + float fDepth = exp(scaleOverScaleDepth * (innerRadius - fHeight)); + float fLightAngle = dot(lightDir, v3SamplePoint) / fHeight; + float fCameraAngle = dot(v3Ray, v3SamplePoint) / fHeight; + + float vscale3 = vernierScale( fCameraAngle ); + float vscale2 = vernierScale( fLightAngle ); + + float fScatter = (fStartOffset + fDepth*(vscale2 - vscale3)); + float3 v3Attenuate = exp(-fScatter * (invWaveLength.xyz * rayleigh4PI + mie4PI)); + v3FrontColor += v3Attenuate * (fDepth * fScaledLength); + v3SamplePoint += v3SampleRay; + } + + Conn Out; + + // Finally, scale the Mie and Rayleigh colors + // and set up the varying variables for the pixel shader. + Out.position = mul( modelView, float4(In.position,1.0) ); + Out.mieColor.rgb = v3FrontColor * mieBrightness; + Out.mieColor.a = 1.0f; + Out.rayleighColor.rgb = v3FrontColor * (invWaveLength.xyz * rayleighBrightness); + Out.rayleighColor.a = 1.0f; + Out.v3Direction = newCamPos - v3Pos.xyz; + Out.pos = In.position; + +#ifdef USE_COLORIZE + + Out.rayleighColor.rgb = desaturate(Out.rayleighColor.rgb, 1) * colorize.a; + + Out.rayleighColor.r *= colorize.r; + Out.rayleighColor.g *= colorize.g; + Out.rayleighColor.b *= colorize.b; + +#endif + + return Out; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/rendering/shaders/shaderModel.hlsl b/Templates/BaseGame/game/core/rendering/shaders/shaderModel.hlsl new file mode 100644 index 000000000..70ce3a02d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/shaderModel.hlsl @@ -0,0 +1,97 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2015 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef _TORQUE_SHADERMODEL_ +#define _TORQUE_SHADERMODEL_ + +// Portability helpers for different shader models +//Shader model 1.0 - 3.0 +#if (TORQUE_SM >= 10 && TORQUE_SM <=30) + // Semantics + #define TORQUE_POSITION POSITION + #define TORQUE_DEPTH DEPTH + #define TORQUE_TARGET0 COLOR0 + #define TORQUE_TARGET1 COLOR1 + #define TORQUE_TARGET2 COLOR2 + #define TORQUE_TARGET3 COLOR3 + + // Sampler uniforms + #define TORQUE_UNIFORM_SAMPLER1D(tex,regist) uniform sampler1D tex : register(S##regist) + #define TORQUE_UNIFORM_SAMPLER2D(tex,regist) uniform sampler2D tex : register(S##regist) + #define TORQUE_UNIFORM_SAMPLER3D(tex,regist) uniform sampler3D tex : register(S##regist) + #define TORQUE_UNIFORM_SAMPLERCUBE(tex,regist) uniform samplerCUBE tex : register(S##regist) + // Sampling functions + #define TORQUE_TEX1D(tex,coords) tex1D(tex,coords) + #define TORQUE_TEX2D(tex,coords) tex2D(tex,coords) + #define TORQUE_TEX2DPROJ(tex,coords) tex2Dproj(tex,coords) //this really is sm 2 or later + #define TORQUE_TEX3D(tex,coords) tex3D(tex,coords) + #define TORQUE_TEXCUBE(tex,coords) texCUBE(tex,coords) + + //Shader model 3.0 only + #if TORQUE_SM == 30 + #define TORQUE_VPOS VPOS // This is a float2 + // The mipmap LOD is specified in coord.w + #define TORQUE_TEX2DLOD(tex,coords) tex2Dlod(tex,coords) + #endif + + //helper if you want to pass sampler/texture in a function + //2D + #define TORQUE_SAMPLER2D(tex) sampler2D tex + #define TORQUE_SAMPLER2D_MAKEARG(tex) tex + //Cube + #define TORQUE_SAMPLERCUBE(tex) samplerCUBE tex + #define TORQUE_SAMPLERCUBE_MAKEARG(tex) tex +// Shader model 4.0+ +#elif TORQUE_SM >= 40 + #define TORQUE_POSITION SV_Position + #define TORQUE_DEPTH SV_Depth + #define TORQUE_VPOS SV_Position //note float4 compared to SM 3 where it is a float2 + #define TORQUE_TARGET0 SV_Target0 + #define TORQUE_TARGET1 SV_Target1 + #define TORQUE_TARGET2 SV_Target2 + #define TORQUE_TARGET3 SV_Target3 + // Sampler uniforms + //1D is emulated to a 2D for now + #define TORQUE_UNIFORM_SAMPLER1D(tex,regist) uniform Texture2D texture_##tex : register(T##regist); uniform SamplerState tex : register(S##regist) + #define TORQUE_UNIFORM_SAMPLER2D(tex,regist) uniform Texture2D texture_##tex : register(T##regist); uniform SamplerState tex : register(S##regist) + #define TORQUE_UNIFORM_SAMPLER3D(tex,regist) uniform Texture3D texture_##tex : register(T##regist); uniform SamplerState tex : register(S##regist) + #define TORQUE_UNIFORM_SAMPLERCUBE(tex,regist) uniform TextureCube texture_##tex : register(T##regist); uniform SamplerState tex : register(S##regist) + // Sampling functions + #define TORQUE_TEX1D(tex,coords) texture_##tex.Sample(tex,coords) + #define TORQUE_TEX2D(tex,coords) texture_##tex.Sample(tex,coords) + #define TORQUE_TEX2DPROJ(tex,coords) texture_##tex.Sample(tex,coords.xy / coords.w) + #define TORQUE_TEX3D(tex,coords) texture_##tex.Sample(tex,coords) + #define TORQUE_TEXCUBE(tex,coords) texture_##tex.Sample(tex,coords) + // The mipmap LOD is specified in coord.w + #define TORQUE_TEX2DLOD(tex,coords) texture_##tex.SampleLevel(tex,coords.xy,coords.w) + + //helper if you want to pass sampler/texture in a function + //2D + #define TORQUE_SAMPLER2D(tex) Texture2D texture_##tex, SamplerState tex + #define TORQUE_SAMPLER2D_MAKEARG(tex) texture_##tex, tex + //Cube + #define TORQUE_SAMPLERCUBE(tex) TextureCube texture_##tex, SamplerState tex + #define TORQUE_SAMPLERCUBE_MAKEARG(tex) texture_##tex, tex +#endif + +#endif // _TORQUE_SHADERMODEL_ + diff --git a/Templates/BaseGame/game/core/rendering/shaders/shaderModelAutoGen.hlsl b/Templates/BaseGame/game/core/rendering/shaders/shaderModelAutoGen.hlsl new file mode 100644 index 000000000..d70847e46 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/shaderModelAutoGen.hlsl @@ -0,0 +1,35 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2015 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef _TORQUE_SHADERMODEL_AUTOGEN_ +#define _TORQUE_SHADERMODEL_AUTOGEN_ + +#include "shadergen:/autogenConditioners.h" + +// Portability helpers for autogenConditioners +#if (TORQUE_SM >= 10 && TORQUE_SM <=30) + #define TORQUE_DEFERRED_UNCONDITION(tex, coords) deferredUncondition(tex, coords) +#elif TORQUE_SM >= 40 + #define TORQUE_DEFERRED_UNCONDITION(tex, coords) deferredUncondition(tex, texture_##tex, coords) +#endif + +#endif //_TORQUE_SHADERMODEL_AUTOGEN_ diff --git a/Templates/BaseGame/game/core/rendering/shaders/shdrConsts.h b/Templates/BaseGame/game/core/rendering/shaders/shdrConsts.h new file mode 100644 index 000000000..8c262b76a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/shdrConsts.h @@ -0,0 +1,117 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifdef IN_HLSL + +#define VC_WORLD_PROJ C0 + +#define VC_TEX_TRANS1 C4 +#define VC_LIGHT_TRANS C8 +#define VC_OBJ_TRANS C12 + +#define VC_CUBE_TRANS C16 +#define VC_CUBE_EYE_POS C19 // in cubemap space +#define VC_EYE_POS C20 // in object space +#define VC_MAT_SPECPOWER C21 + +#define VC_FOGDATA C22 + +#define VC_LIGHT_POS1 C23 +#define VC_LIGHT_DIR1 C24 +#define VC_LIGHT_DIFFUSE1 C25 +#define VC_LIGHT_SPEC1 C26 + +#define VC_LIGHT_POS2 C27 +//#define VC_LIGHT_DIR2 C28 +//#define VC_LIGHT_DIFFUSE2 C29 +//#define VC_LIGHT_SPEC2 C30 +#define VC_LIGHT_TRANS2 C31 + +//#define VC_LIGHT_POS4 C35 +//#define VC_LIGHT_DIR4 C36 +//#define VC_LIGHT_DIFFUSE4 C37 +//#define VC_LIGHT_SPEC4 C38 + +#define VC_DETAIL_SCALE C40 + + +#define PC_MAT_SPECCOLOR C0 +#define PC_MAT_SPECPOWER C1 +#define PC_DIFF_COLOR C2 +#define PC_AMBIENT_COLOR C3 +#define PC_ACCUM_TIME C4 +#define PC_DIFF_COLOR2 C5 +#define PC_VISIBILITY C6 +#define PC_COLORMULTIPLY C7 + +#define PC_USERDEF1 C8 + +// Mirror of above. Couldn't be cleaner because HLSL doesn't support function macros +#else + +#define VC_WORLD_PROJ 0 + +#define VC_TEX_TRANS1 4 +#define VC_LIGHT_TRANS 8 +#define VC_OBJ_TRANS 12 + +#define VC_CUBE_TRANS 16 +#define VC_CUBE_EYE_POS 19 // in cubemap space +#define VC_EYE_POS 20 // in object space +#define VC_MAT_SPECPOWER 21 + +#define VC_FOGDATA 22 + +#define VC_LIGHT_POS1 23 +#define VC_LIGHT_DIR1 24 +#define VC_LIGHT_DIFFUSE1 25 +#define VC_LIGHT_SPEC1 26 + +#define VC_LIGHT_POS2 27 +//#define VC_LIGHT_DIR2 28 +//#define VC_LIGHT_DIFFUSE2 29 +//#define VC_LIGHT_SPEC2 30 +#define VC_LIGHT_TRANS2 31 + +//#define VC_LIGHT_POS4 35 +//#define VC_LIGHT_DIR4 36 +//#define VC_LIGHT_DIFFUSE4 37 +//#define VC_LIGHT_SPEC4 38 + +#define VC_DETAIL_SCALE 40 + + + +#define PC_MAT_SPECCOLOR 0 +#define PC_MAT_SPECPOWER 1 +#define PC_DIFF_COLOR 2 +#define PC_AMBIENT_COLOR 3 +#define PC_ACCUM_TIME 4 +#define PC_DIFF_COLOR2 5 +#define PC_VISIBILITY 6 +#define PC_COLORMULTIPLY 7 + +#define PC_USERDEF1 8 + +#endif + + diff --git a/Templates/BaseGame/game/core/rendering/shaders/terrain/blendP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/terrain/blendP.hlsl new file mode 100644 index 000000000..aeef9d6e3 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/terrain/blendP.hlsl @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "terrain.hlsl" +#include "../shaderModel.hlsl" + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 layerCoord : TEXCOORD0; + float2 texCoord : TEXCOORD1; +}; + +TORQUE_UNIFORM_SAMPLER2D(layerTex, 0); +TORQUE_UNIFORM_SAMPLER2D(textureMap, 1); + +uniform float texId; +uniform float layerSize; + +float4 main( ConnectData IN ) : TORQUE_TARGET0 +{ + float4 layerSample = round( TORQUE_TEX2D( layerTex, IN.layerCoord ) * 255.0f ); + + float blend = calcBlend( texId, IN.layerCoord, layerSize, layerSample ); + + clip( blend - 0.0001 ); + + return float4( TORQUE_TEX2D(textureMap, IN.texCoord).rgb, blend); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/terrain/blendV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/terrain/blendV.hlsl new file mode 100644 index 000000000..9ccd33301 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/terrain/blendV.hlsl @@ -0,0 +1,52 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +/// The vertex shader used in the generation and caching of the +/// base terrain texture. + +#include "../shaderModel.hlsl" + +struct VertData +{ + float3 position : POSITION; + float2 texCoord : TEXCOORD0; +}; + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + float2 layerCoord : TEXCOORD0; + float2 texCoord : TEXCOORD1; +}; + +uniform float2 texScale; + +ConnectData main( VertData IN ) +{ + ConnectData OUT; + + OUT.hpos = float4( IN.position, 1 ); + OUT.layerCoord = IN.texCoord; + OUT.texCoord = IN.texCoord * texScale; + + return OUT; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/terrain/gl/blendP.glsl b/Templates/BaseGame/game/core/rendering/shaders/terrain/gl/blendP.glsl new file mode 100644 index 000000000..3189ea01d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/terrain/gl/blendP.glsl @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../terrain.glsl" +#include "../../gl/hlslCompat.glsl" + +in vec2 layerCoord; +#define IN_layerCoord layerCoord +in vec2 texCoord; +#define IN_texCoord texCoord + +uniform sampler2D layerTex; +uniform sampler2D textureMap; +uniform float texId; +uniform float layerSize; + +out vec4 OUT_col; + +void main() +{ + vec4 layerSample = round(texture( layerTex, IN_layerCoord ) * 255.0); + + float blend = calcBlend( texId, IN_layerCoord, layerSize, layerSample ); + + if(blend - 0.0001 < 0.0) + discard; + + OUT_col = vec4( texture( textureMap, IN_texCoord ).rgb, blend ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/terrain/gl/blendV.glsl b/Templates/BaseGame/game/core/rendering/shaders/terrain/gl/blendV.glsl new file mode 100644 index 000000000..dc7b7befa --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/terrain/gl/blendV.glsl @@ -0,0 +1,41 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +/// The vertex shader used in the generation and caching of the +/// base terrain texture. + +in vec4 vPosition; +in vec2 vTexCoord0; + +out vec2 layerCoord; +out vec2 texCoord; + +uniform vec2 texScale; + +void main() +{ + gl_Position = vec4(vPosition.xyz, 1.0); + layerCoord = vTexCoord0.st; + texCoord = vTexCoord0.st * texScale; + + gl_Position.y *= -1; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/terrain/terrain.glsl b/Templates/BaseGame/game/core/rendering/shaders/terrain/terrain.glsl new file mode 100644 index 000000000..756edd553 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/terrain/terrain.glsl @@ -0,0 +1,52 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +float calcBlend( float texId, vec2 layerCoord, float layerSize, vec4 layerSample ) +{ + // This is here to disable the blend if none of + // the neighbors equal the current id. + // + // We depend on the input layer samples being + // rounded to the correct integer ids. + // + vec4 diff = clamp( abs( layerSample - texId ), 0.0, 1.0 ); + float noBlend = float(any( bvec4(1 - diff) )); + + // Check if any of the layer samples + // match the current texture id. + vec4 factors = vec4(0); + for(int i = 0; i < 4; i++) + factors[i] = (layerSample[i] == texId) ? 1 : 0; // workaround for Intel + + // This is a custom bilinear filter. + + vec2 uv = layerCoord * layerSize; + vec2 xy = floor( uv ); + vec2 ratio = uv - xy; + vec2 opposite = 1 - ratio; + + float blend = ( factors.b * opposite.x + factors.g * ratio.x ) * opposite.y + + ( factors.r * opposite.x + factors.a * ratio.x ) * ratio.y; + + return noBlend * blend; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/terrain/terrain.hlsl b/Templates/BaseGame/game/core/rendering/shaders/terrain/terrain.hlsl new file mode 100644 index 000000000..b7c87e618 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/terrain/terrain.hlsl @@ -0,0 +1,55 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +float calcBlend( float texId, float2 layerCoord, float layerSize, float4 layerSample ) +{ + // This is here to disable the blend if none of + // the neighbors equal the current id. + // + // We depend on the input layer samples being + // rounded to the correct integer ids. + // + float4 diff = saturate( abs( layerSample - texId ) ); + float noBlend = any( 1 - diff ); + + // Check if any of the layer samples + // match the current texture id. + float4 factors = 0; + [unroll] + for(int i = 0; i < 4; i++) + if(layerSample[i] == texId) + factors[i] = 1; + + // This is a custom bilinear filter. + + float2 uv = layerCoord * layerSize; + float2 xy = floor( uv ); + float2 ratio = uv - xy; + float2 opposite = 1 - ratio; + + // NOTE: This will optimize down to two lerp operations. + float blend = ( factors.b * opposite.x + factors.g * ratio.x ) * opposite.y + + ( factors.r * opposite.x + factors.a * ratio.x ) * ratio.y; + + return noBlend * blend; +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/torque.hlsl b/Templates/BaseGame/game/core/rendering/shaders/torque.hlsl new file mode 100644 index 000000000..7081c7153 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/torque.hlsl @@ -0,0 +1,342 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#ifndef _TORQUE_HLSL_ +#define _TORQUE_HLSL_ + +#include "./shaderModel.hlsl" + +static float M_HALFPI_F = 1.57079632679489661923f; +static float M_PI_F = 3.14159265358979323846f; +static float M_2PI_F = 6.28318530717958647692f; + + +/// Calculate fog based on a start and end positions in worldSpace. +float computeSceneFog( float3 startPos, + float3 endPos, + float fogDensity, + float fogDensityOffset, + float fogHeightFalloff ) +{ + float f = length( startPos - endPos ) - fogDensityOffset; + float h = 1.0 - ( endPos.z * fogHeightFalloff ); + return exp( -fogDensity * f * h ); +} + + +/// Calculate fog based on a start and end position and a height. +/// Positions do not need to be in worldSpace but height does. +float computeSceneFog( float3 startPos, + float3 endPos, + float height, + float fogDensity, + float fogDensityOffset, + float fogHeightFalloff ) +{ + float f = length( startPos - endPos ) - fogDensityOffset; + float h = 1.0 - ( height * fogHeightFalloff ); + return exp( -fogDensity * f * h ); +} + + +/// Calculate fog based on a distance, height is not used. +float computeSceneFog( float dist, float fogDensity, float fogDensityOffset ) +{ + float f = dist - fogDensityOffset; + return exp( -fogDensity * f ); +} + + +/// Convert a float4 uv in viewport space to render target space. +float2 viewportCoordToRenderTarget( float4 inCoord, float4 rtParams ) +{ + float2 outCoord = inCoord.xy / inCoord.w; + outCoord = ( outCoord * rtParams.zw ) + rtParams.xy; + return outCoord; +} + + +/// Convert a float2 uv in viewport space to render target space. +float2 viewportCoordToRenderTarget( float2 inCoord, float4 rtParams ) +{ + float2 outCoord = ( inCoord * rtParams.zw ) + rtParams.xy; + return outCoord; +} + + +/// Convert a float4 quaternion into a 3x3 matrix. +float3x3 quatToMat( float4 quat ) +{ + float xs = quat.x * 2.0f; + float ys = quat.y * 2.0f; + float zs = quat.z * 2.0f; + + float wx = quat.w * xs; + float wy = quat.w * ys; + float wz = quat.w * zs; + + float xx = quat.x * xs; + float xy = quat.x * ys; + float xz = quat.x * zs; + + float yy = quat.y * ys; + float yz = quat.y * zs; + float zz = quat.z * zs; + + float3x3 mat; + + mat[0][0] = 1.0f - (yy + zz); + mat[0][1] = xy - wz; + mat[0][2] = xz + wy; + + mat[1][0] = xy + wz; + mat[1][1] = 1.0f - (xx + zz); + mat[1][2] = yz - wx; + + mat[2][0] = xz - wy; + mat[2][1] = yz + wx; + mat[2][2] = 1.0f - (xx + yy); + + return mat; +} + + +/// The number of additional substeps we take when refining +/// the results of the offset parallax mapping function below. +/// +/// You should turn down the number of steps if your needing +/// more performance out of your parallax surfaces. Increasing +/// the number doesn't yeild much better results and is rarely +/// worth the additional cost. +/// +#define PARALLAX_REFINE_STEPS 3 + +/// Performs fast parallax offset mapping using +/// multiple refinement steps. +/// +/// @param texMap The texture map whos alpha channel we sample the parallax depth. +/// @param texCoord The incoming texture coordinate for sampling the parallax depth. +/// @param negViewTS The negative view vector in tangent space. +/// @param depthScale The parallax factor used to scale the depth result. +/// +float2 parallaxOffset(TORQUE_SAMPLER2D(texMap), float2 texCoord, float3 negViewTS, float depthScale) +{ + float depth = TORQUE_TEX2D(texMap, texCoord).a/(PARALLAX_REFINE_STEPS*2); + float2 offset = negViewTS.xy * (depth * depthScale)/(PARALLAX_REFINE_STEPS); + + for (int i = 0; i < PARALLAX_REFINE_STEPS; i++) + { + depth = (depth + TORQUE_TEX2D(texMap, texCoord + offset).a)/(PARALLAX_REFINE_STEPS*2); + offset = negViewTS.xy * (depth * depthScale)/(PARALLAX_REFINE_STEPS); + } + + return offset; +} + +/// Same as parallaxOffset but for dxtnm where depth is stored in the red channel instead of the alpha +float2 parallaxOffsetDxtnm(TORQUE_SAMPLER2D(texMap), float2 texCoord, float3 negViewTS, float depthScale) +{ + float depth = TORQUE_TEX2D(texMap, texCoord).r/(PARALLAX_REFINE_STEPS*2); + float2 offset = negViewTS.xy * (depth * depthScale)/(PARALLAX_REFINE_STEPS*2); + + for (int i = 0; i < PARALLAX_REFINE_STEPS; i++) + { + depth = (depth + TORQUE_TEX2D(texMap, texCoord + offset).r)/(PARALLAX_REFINE_STEPS*2); + offset = negViewTS.xy * (depth * depthScale)/(PARALLAX_REFINE_STEPS*2); + } + + return offset; +} + + +/// The maximum value for 16bit per component integer HDR encoding. +static const float HDR_RGB16_MAX = 100.0; + +/// The maximum value for 10bit per component integer HDR encoding. +static const float HDR_RGB10_MAX = 4.0; + +/// Encodes an HDR color for storage into a target. +float3 hdrEncode( float3 sample ) +{ + #if defined( TORQUE_HDR_RGB16 ) + + return sample / HDR_RGB16_MAX; + + #elif defined( TORQUE_HDR_RGB10 ) + + return sample / HDR_RGB10_MAX; + + #else + + // No encoding. + return sample; + + #endif +} + +/// Encodes an HDR color for storage into a target. +float4 hdrEncode( float4 sample ) +{ + return float4( hdrEncode( sample.rgb ), sample.a ); +} + +/// Decodes an HDR color from a target. +float3 hdrDecode( float3 sample ) +{ + #if defined( TORQUE_HDR_RGB16 ) + + return sample * HDR_RGB16_MAX; + + #elif defined( TORQUE_HDR_RGB10 ) + + return sample * HDR_RGB10_MAX; + + #else + + // No encoding. + return sample; + + #endif +} + +/// Decodes an HDR color from a target. +float4 hdrDecode( float4 sample ) +{ + return float4( hdrDecode( sample.rgb ), sample.a ); +} + +/// Returns the luminance for an HDR pixel. +float hdrLuminance( float3 sample ) +{ + // There are quite a few different ways to + // calculate luminance from an rgb value. + // + // If you want to use a different technique + // then plug it in here. + // + + //////////////////////////////////////////////////////////////////////////// + // + // Max component luminance. + // + //float lum = max( sample.r, max( sample.g, sample.b ) ); + + //////////////////////////////////////////////////////////////////////////// + // The perceptual relative luminance. + // + // See http://en.wikipedia.org/wiki/Luminance_(relative) + // + const float3 RELATIVE_LUMINANCE = float3( 0.2126, 0.7152, 0.0722 ); + float lum = dot( sample, RELATIVE_LUMINANCE ); + + //////////////////////////////////////////////////////////////////////////// + // + // The average component luminance. + // + //const float3 AVERAGE_LUMINANCE = float3( 0.3333, 0.3333, 0.3333 ); + //float lum = dot( sample, AVERAGE_LUMINANCE ); + + return lum; +} + +/// Called from the visibility feature to do screen +/// door transparency for fading of objects. +void fizzle(float2 vpos, float visibility) +{ + // NOTE: The magic values below are what give us + // the nice even pattern during the fizzle. + // + // These values can be changed to get different + // patterns... some better than others. + // + // Horizontal Blinds - { vpos.x, 0.916, vpos.y, 0 } + // Vertical Lines - { vpos.x, 12.9898, vpos.y, 78.233 } + // + // I'm sure there are many more patterns here to + // discover for different effects. + + float2x2 m = { vpos.x, 0.916, vpos.y, 0.350 }; + clip( visibility - frac( determinant( m ) ) ); +} + +// Deferred Shading: Material Info Flag Check +bool getFlag(float flags, int num) +{ + int process = round(flags * 255); + int squareNum = pow(2, num); + return (fmod(process, pow(2, squareNum)) >= squareNum); +} + +// #define TORQUE_STOCK_GAMMA +#ifdef TORQUE_STOCK_GAMMA +// Sample in linear space. Decodes gamma. +float4 toLinear(float4 tex) +{ + return tex; +} +// Encodes gamma. +float4 toGamma(float4 tex) +{ + return tex; +} +float3 toLinear(float3 tex) +{ + return tex; +} +// Encodes gamma. +float3 toGamma(float3 tex) +{ + return tex; +} +float3 toLinear(float3 tex) +{ + return tex; +} +// Encodes gamma. +float3 toLinear(float3 tex) +{ + return tex; +} +#else +// Sample in linear space. Decodes gamma. +float4 toLinear(float4 tex) +{ + return float4(pow(abs(tex.rgb), 2.2), tex.a); +} +// Encodes gamma. +float4 toGamma(float4 tex) +{ + return float4(pow(abs(tex.rgb), 1.0/2.2), tex.a); +} +// Sample in linear space. Decodes gamma. +float3 toLinear(float3 tex) +{ + return pow(abs(tex.rgb), 2.2); +} +// Encodes gamma. +float3 toGamma(float3 tex) +{ + return pow(abs(tex.rgb), 1.0/2.2); +} +#endif // + +#endif // _TORQUE_HLSL_ diff --git a/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterBasicP.glsl b/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterBasicP.glsl new file mode 100644 index 000000000..91bdb4137 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterBasicP.glsl @@ -0,0 +1,216 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/torque.glsl" +#include "../../gl/hlslCompat.glsl" + +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- + +// miscParams +#define FRESNEL_BIAS miscParams[0] +#define FRESNEL_POWER miscParams[1] +#define CLARITY miscParams[2] +#define ISRIVER miscParams[3] + +// reflectParams +#define REFLECT_PLANE_Z reflectParams[0] +#define REFLECT_MIN_DIST reflectParams[1] +#define REFLECT_MAX_DIST reflectParams[2] +#define NO_REFLECT reflectParams[3] + +// distortionParams +#define DISTORT_START_DIST distortionParams[0] +#define DISTORT_END_DIST distortionParams[1] +#define DISTORT_FULL_DEPTH distortionParams[2] + +// ConnectData.misc +#define LIGHT_VEC IN_misc.xyz +#define WORLD_Z IN_objPos.w + +// specularParams +#define SPEC_POWER specularParams[3] +#define SPEC_COLOR specularParams.xyz + +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- + +// TexCoord 0 and 1 (xy,zw) for ripple texture lookup +in vec4 rippleTexCoord01; +#define IN_rippleTexCoord01 rippleTexCoord01 + +// TexCoord 2 for ripple texture lookup +in vec2 rippleTexCoord2; +#define IN_rippleTexCoord2 rippleTexCoord2 + +// Screenspace vert position BEFORE wave transformation +in vec4 posPreWave; +#define IN_posPreWave posPreWave + +// Screenspace vert position AFTER wave transformation +in vec4 posPostWave; +#define IN_posPostWave posPostWave + +// Worldspace unit distance/depth of this vertex/pixel +in float pixelDist; +#define IN_pixelDist pixelDist + +in vec4 objPos; +#define IN_objPos objPos + +in vec3 misc; +#define IN_misc misc + +//----------------------------------------------------------------------------- +// approximate Fresnel function +//----------------------------------------------------------------------------- +float fresnel(float NdotV, float bias, float power) +{ + return bias + (1.0-bias)*pow(abs(1.0 - max(NdotV, 0)), power); +} + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +uniform sampler2D bumpMap; +//uniform sampler2D deferredTex; +uniform sampler2D reflectMap; +uniform sampler2D refractBuff; +uniform samplerCube skyMap; +//uniform sampler2D foamMap; +uniform vec4 baseColor; +uniform vec4 miscParams; +uniform vec4 reflectParams; +uniform vec3 ambientColor; +uniform vec3 eyePos; +uniform vec3 distortionParams; +uniform vec3 fogData; +uniform vec4 fogColor; +uniform vec4 rippleMagnitude; +uniform vec4 specularParams; +uniform mat4 modelMat; + +out vec4 OUT_col; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + // Modulate baseColor by the ambientColor. + vec4 waterBaseColor = baseColor * vec4( ambientColor.rgb, 1 ); + + // Get the bumpNorm... + vec3 bumpNorm = ( texture( bumpMap, IN_rippleTexCoord01.xy ).rgb * 2.0 - 1.0 ) * rippleMagnitude.x; + bumpNorm += ( texture( bumpMap, IN_rippleTexCoord01.zw ).rgb * 2.0 - 1.0 ) * rippleMagnitude.y; + bumpNorm += ( texture( bumpMap, IN_rippleTexCoord2 ).rgb * 2.0 - 1.0 ) * rippleMagnitude.z; + + bumpNorm = normalize( bumpNorm ); + bumpNorm = mix( bumpNorm, vec3(0,0,1), 1.0 - rippleMagnitude.w ); + + // We subtract a little from it so that we don't + // distort where the water surface intersects the + // camera near plane. + float distortAmt = saturate( IN_pixelDist / 1.0 ) * 0.8; + + vec4 distortPos = IN_posPostWave; + distortPos.xy += bumpNorm.xy * distortAmt; + + #ifdef UNDERWATER + OUT_col = hdrEncode( textureProj( refractBuff, distortPos ) ); + #else + + vec3 eyeVec = IN_objPos.xyz - eyePos; + eyeVec = tMul( mat3(modelMat), eyeVec ); + vec3 reflectionVec = reflect( eyeVec, bumpNorm ); + + // Color that replaces the reflection color when we do not + // have one that is appropriate. + vec4 fakeColor = vec4(ambientColor,1); + + // Use fakeColor for ripple-normals that are angled towards the camera + eyeVec = -eyeVec; + eyeVec = normalize( eyeVec ); + float ang = saturate( dot( eyeVec, bumpNorm ) ); + float fakeColorAmt = ang; + + // Get reflection map color + vec4 refMapColor = hdrDecode( textureProj( reflectMap, distortPos ) ); + // If we do not have a reflection texture then we use the cubemap. + refMapColor = mix( refMapColor, texture( skyMap, reflectionVec ), NO_REFLECT ); + + // Combine reflection color and fakeColor. + vec4 reflectColor = mix( refMapColor, fakeColor, fakeColorAmt ); + //return refMapColor; + + // Get refract color + vec4 refractColor = hdrDecode( textureProj( refractBuff, distortPos ) ); + + // calc "diffuse" color by lerping from the water color + // to refraction image based on the water clarity. + vec4 diffuseColor = mix( refractColor, waterBaseColor, 1.0f - CLARITY ); + + // fresnel calculation + float fresnelTerm = fresnel( ang, FRESNEL_BIAS, FRESNEL_POWER ); + //return vec4( fresnelTerm.rrr, 1 ); + + // Also scale the frensel by our distance to the + // water surface. This removes the hard reflection + // when really close to the water surface. + fresnelTerm *= saturate( IN_pixelDist - 0.1 ); + + // Combine the diffuse color and reflection image via the + // fresnel term and set out output color. + vec4 OUT = mix( diffuseColor, reflectColor, fresnelTerm ); + + #ifdef WATER_SPEC + + // Get some specular reflection. + vec3 newbump = bumpNorm; + newbump.xy *= 3.5; + newbump = normalize( bumpNorm ); + half3 halfAng = normalize( eyeVec + -LIGHT_VEC ); + float specular = saturate( dot( newbump, halfAng ) ); + specular = pow( specular, SPEC_POWER ); + + OUT.rgb = OUT.rgb + ( SPEC_COLOR * specular.xxx ); + + #else // Disable fogging if spec is on because otherwise we run out of instructions. + + // Fog it. + float factor = computeSceneFog( eyePos, + IN_objPos.xyz, + WORLD_Z, + fogData.x, + fogData.y, + fogData.z ); + + //OUT.rgb = mix( OUT.rgb, fogColor.rgb, 1.0 - saturate( factor ) ); + + #endif + + OUT_col = hdrEncode( OUT ); + +#endif +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterBasicV.glsl b/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterBasicV.glsl new file mode 100644 index 000000000..e92c948e9 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterBasicV.glsl @@ -0,0 +1,243 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" + +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- + +// TexCoord 0 and 1 (xy,zw) for ripple texture lookup +out vec4 rippleTexCoord01; +#define OUT_rippleTexCoord01 rippleTexCoord01 + +// TexCoord 2 for ripple texture lookup +out vec2 rippleTexCoord2; +#define OUT_rippleTexCoord2 rippleTexCoord2 + +// Screenspace vert position BEFORE wave transformation +out vec4 posPreWave; +#define OUT_posPreWave posPreWave + +// Screenspace vert position AFTER wave transformation +out vec4 posPostWave; +#define OUT_posPostWave posPostWave + +// Worldspace unit distance/depth of this vertex/pixel +out float pixelDist; +#define OUT_pixelDist pixelDist + +out vec4 objPos; +#define OUT_objPos objPos + +out vec3 misc; +#define OUT_misc misc + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +uniform mat4 modelMat; +uniform mat4 modelview; +uniform vec4 rippleMat[3]; +uniform vec3 eyePos; +uniform vec2 waveDir[3]; +uniform vec2 waveData[3]; +uniform vec2 rippleDir[3]; +uniform vec2 rippleTexScale[3]; +uniform vec3 rippleSpeed; +uniform vec3 inLightVec; +uniform vec3 reflectNormal; +uniform float gridElementSize; +uniform float elapsedTime; +uniform float undulateMaxDist; + +in vec4 vPosition; +in vec3 vNormal; +in vec2 vTexCoord0; +in vec4 vTexCoord1; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + vec4 IN_position = vPosition; + vec3 IN_normal = vNormal; + vec2 IN_undulateData = vTexCoord0; + vec4 IN_horizonFactor = vTexCoord1; + vec4 OUT_hpos = vec4(0); + + // use projection matrix for reflection / refraction texture coords + mat4 texGen = mat4FromRow( 0.5, 0.0, 0.0, 0.5, + 0.0, -0.5, 0.0, 0.5, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 ); + + // Move the vertex based on the horizonFactor if specified to do so for this vert. + // if ( IN_horizonFactor.z > 0 ) + // { + // vec2 offsetXY = eyePos.xy - eyePos.xy % gridElementSize; + // IN_position.xy += offsetXY; + // IN_undulateData += offsetXY; + // } + + vec4 worldPos = tMul( modelMat, IN_position ); + + IN_position.z = mix( IN_position.z, eyePos.z, IN_horizonFactor.x ); + + //OUT_objPos = worldPos; + OUT_objPos.xyz = IN_position.xyz; + OUT_objPos.w = worldPos.z; + + // Send pre-undulation screenspace position + OUT_posPreWave = tMul( modelview, IN_position ); + OUT_posPreWave = tMul( texGen, OUT_posPreWave ); + + // Calculate the undulation amount for this vertex. + vec2 undulatePos = tMul( modelMat, vec4( IN_undulateData.xy, 0, 1 ) ).xy; + //if ( undulatePos.x < 0 ) + // undulatePos = IN_position.xy; + + float undulateAmt = 0.0; + + undulateAmt += waveData[0].y * sin( elapsedTime * waveData[0].x + + undulatePos.x * waveDir[0].x + + undulatePos.y * waveDir[0].y ); + undulateAmt += waveData[1].y * sin( elapsedTime * waveData[1].x + + undulatePos.x * waveDir[1].x + + undulatePos.y * waveDir[1].y ); + undulateAmt += waveData[2].y * sin( elapsedTime * waveData[2].x + + undulatePos.x * waveDir[2].x + + undulatePos.y * waveDir[2].y ); + + float undulateFade = 1; + + // Scale down wave magnitude amount based on distance from the camera. + float dist = distance( IN_position.xyz, eyePos ); + dist = clamp( dist, 1.0, undulateMaxDist ); + undulateFade *= ( 1 - dist / undulateMaxDist ); + + // Also scale down wave magnitude if the camera is very very close. + undulateFade *= saturate( ( distance( IN_position.xyz, eyePos ) - 0.5 ) / 10.0 ); + + undulateAmt *= undulateFade; + + //#endif + //undulateAmt = 0; + + // Apply wave undulation to the vertex. + OUT_posPostWave = IN_position; + OUT_posPostWave.xyz += IN_normal.xyz * undulateAmt; + + // Save worldSpace position of this pixel/vert + //OUT_worldPos = OUT_posPostWave.xyz; + //OUT_worldPos = tMul( modelMat, OUT_posPostWave.xyz ); + //OUT_worldPos.z += objTrans[2][2]; //91.16; + + // OUT_misc.w = tMul( modelMat, OUT_fogPos ).z; + // if ( IN_horizonFactor.x > 0 ) + // { + // vec3 awayVec = normalize( OUT_fogPos.xyz - eyePos ); + // OUT_fogPos.xy += awayVec.xy * 1000.0; + // } + + // Convert to screen + OUT_posPostWave = tMul( modelview, OUT_posPostWave ); // tMul( modelview, vec4( OUT_posPostWave.xyz, 1 ) ); + + // Setup the OUT position symantic variable + OUT_hpos = OUT_posPostWave; // tMul( modelview, vec4( IN_position.xyz, 1 ) ); //vec4( OUT_posPostWave.xyz, 1 ); + //OUT_hpos.z = mix( OUT_hpos.z, OUT_hpos.w, IN_horizonFactor.x ); + + // Save world space camera dist/depth of the outgoing pixel + OUT_pixelDist = OUT_hpos.z; + + // Convert to reflection texture space + OUT_posPostWave = tMul( texGen, OUT_posPostWave ); + + vec2 txPos = undulatePos; + if ( bool(IN_horizonFactor.x) ) + txPos = normalize( txPos ) * 50000.0; + + // set up tex coordinates for the 3 interacting normal maps + OUT_rippleTexCoord01.xy = txPos * rippleTexScale[0]; + OUT_rippleTexCoord01.xy += rippleDir[0] * elapsedTime * rippleSpeed.x; + + mat2 texMat; + texMat[0][0] = rippleMat[0].x; + texMat[1][0] = rippleMat[0].y; + texMat[0][1] = rippleMat[0].z; + texMat[1][1] = rippleMat[0].w; + OUT_rippleTexCoord01.xy = tMul( texMat, OUT_rippleTexCoord01.xy ); + + OUT_rippleTexCoord01.zw = txPos * rippleTexScale[1]; + OUT_rippleTexCoord01.zw += rippleDir[1] * elapsedTime * rippleSpeed.y; + + texMat[0][0] = rippleMat[1].x; + texMat[1][0] = rippleMat[1].y; + texMat[0][1] = rippleMat[1].z; + texMat[1][1] = rippleMat[1].w; + OUT_rippleTexCoord01.zw = tMul( texMat, OUT_rippleTexCoord01.zw ); + + OUT_rippleTexCoord2.xy = txPos * rippleTexScale[2]; + OUT_rippleTexCoord2.xy += rippleDir[2] * elapsedTime * rippleSpeed.z; + + texMat[0][0] = rippleMat[2].x; + texMat[1][0] = rippleMat[2].y; + texMat[0][1] = rippleMat[2].z; + texMat[1][1] = rippleMat[2].w; + OUT_rippleTexCoord2.xy = tMul( texMat, OUT_rippleTexCoord2.xy ); + +#ifdef WATER_SPEC + + vec3 binormal = vec3( 1, 0, 0 ); + vec3 tangent = vec3( 0, 1, 0 ); + vec3 normal; + for ( int i = 0; i < 3; i++ ) + { + binormal.z += undulateFade * waveDir[i].x * waveData[i].y * cos( waveDir[i].x * IN_undulateData.x + waveDir[i].y * IN_undulateData.y + elapsedTime * waveData[i].x ); + tangent.z += undulateFade * waveDir[i].y * waveData[i].y * cos( waveDir[i].x * IN_undulateData.x + waveDir[i].y * IN_undulateData.y + elapsedTime * waveData[i].x ); + } + + binormal = normalize( binormal ); + tangent = normalize( tangent ); + normal = cross( binormal, tangent ); + + mat3 worldToTangent; + worldToTangent[0] = binormal; + worldToTangent[1] = tangent; + worldToTangent[2] = normal; + + worldToTangent = transpose(worldToTangent); + + OUT_misc.xyz = tMul( inLightVec, modelMat ); + OUT_misc.xyz = tMul( worldToTangent, OUT_misc.xyz ); + +#else + + OUT_misc.xyz = inLightVec; + +#endif + + gl_Position = OUT_hpos; + correctSSP(gl_Position); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterP.glsl b/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterP.glsl new file mode 100644 index 000000000..d4804245a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterP.glsl @@ -0,0 +1,396 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" +#include "../../gl/torque.glsl" + +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- + +#define PIXEL_DIST IN_rippleTexCoord2.z +// miscParams +#define FRESNEL_BIAS miscParams[0] +#define FRESNEL_POWER miscParams[1] +// miscParams[2] is unused +#define ISRIVER miscParams[3] + +// reflectParams +#define REFLECT_PLANE_Z reflectParams[0] +#define REFLECT_MIN_DIST reflectParams[1] +#define REFLECT_MAX_DIST reflectParams[2] +#define NO_REFLECT reflectParams[3] + +// fogParams +#define FOG_DENSITY fogParams[0] +#define FOG_DENSITY_OFFSET fogParams[1] + +// wetnessParams +#define WET_DEPTH wetnessParams[0] +#define WET_COLOR_FACTOR wetnessParams[1] + +// distortionParams +#define DISTORT_START_DIST distortionParams[0] +#define DISTORT_END_DIST distortionParams[1] +#define DISTORT_FULL_DEPTH distortionParams[2] + +// foamParams +#define FOAM_OPACITY foamParams[0] +#define FOAM_MAX_DEPTH foamParams[1] +#define FOAM_AMBIENT_LERP foamParams[2] +#define FOAM_RIPPLE_INFLUENCE foamParams[3] + +// specularParams +#define SPEC_POWER specularParams[3] +#define SPEC_COLOR specularParams.xyz + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- + +//ConnectData IN + +in vec4 hpos; + +// TexCoord 0 and 1 (xy,zw) for ripple texture lookup +in vec4 rippleTexCoord01; + +// xy is TexCoord 2 for ripple texture lookup +// z is the Worldspace unit distance/depth of this vertex/pixel +// w is amount of the crestFoam ( more at crest of waves ). +in vec4 rippleTexCoord2; + +// Screenspace vert position BEFORE wave transformation +in vec4 posPreWave; + +// Screenspace vert position AFTER wave transformation +in vec4 posPostWave; + +// Objectspace vert position BEFORE wave transformation +// w coord is world space z position. +in vec4 objPos; + +in vec4 foamTexCoords; + +in mat3 tangentMat; + + +#define IN_hpos hpos +#define IN_rippleTexCoord01 rippleTexCoord01 +#define IN_rippleTexCoord2 rippleTexCoord2 +#define IN_posPreWave posPreWave +#define IN_posPostWave posPostWave +#define IN_objPos objPos +#define IN_foamTexCoords foamTexCoords +#define IN_tangentMat tangentMat + +//----------------------------------------------------------------------------- +// approximate Fresnel function +//----------------------------------------------------------------------------- +float fresnel(float NdotV, float bias, float power) +{ + return bias + (1.0-bias)*pow(abs(1.0 - max(NdotV, 0)), power); +} + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +uniform sampler2D bumpMap; +uniform sampler2D deferredTex; +uniform sampler2D reflectMap; +uniform sampler2D refractBuff; +uniform samplerCube skyMap; +uniform sampler2D foamMap; +uniform sampler1D depthGradMap; +uniform vec4 specularParams; +uniform vec4 baseColor; +uniform vec4 miscParams; +uniform vec2 fogParams; +uniform vec4 reflectParams; +uniform vec3 reflectNormal; +uniform vec2 wetnessParams; +uniform float farPlaneDist; +uniform vec3 distortionParams; +uniform vec4 foamParams; +uniform vec3 ambientColor; +uniform vec3 eyePos; // This is in object space! +uniform vec3 fogData; +uniform vec4 fogColor; +uniform vec4 rippleMagnitude; +uniform vec4 rtParams1; +uniform float depthGradMax; +uniform vec3 inLightVec; +uniform mat4 modelMat; +uniform vec4 sunColor; +uniform float sunBrightness; +uniform float reflectivity; + +out vec4 OUT_col; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + // Get the bumpNorm... + vec3 bumpNorm = ( texture( bumpMap, IN_rippleTexCoord01.xy ).rgb * 2.0 - 1.0 ) * rippleMagnitude.x; + bumpNorm += ( texture( bumpMap, IN_rippleTexCoord01.zw ).rgb * 2.0 - 1.0 ) * rippleMagnitude.y; + bumpNorm += ( texture( bumpMap, IN_rippleTexCoord2.xy ).rgb * 2.0 - 1.0 ) * rippleMagnitude.z; + + bumpNorm = normalize( bumpNorm ); + bumpNorm = mix( bumpNorm, vec3(0,0,1), 1.0 - rippleMagnitude.w ); + bumpNorm = tMul( bumpNorm, IN_tangentMat ); + + // Get depth of the water surface (this pixel). + // Convert from WorldSpace to EyeSpace. + float pixelDepth = PIXEL_DIST / farPlaneDist; + + vec2 deferredCoord = viewportCoordToRenderTarget( IN_posPostWave, rtParams1 ); + + float startDepth = deferredUncondition( deferredTex, deferredCoord ).w; + + // The water depth in world units of the undistorted pixel. + float startDelta = ( startDepth - pixelDepth ); + startDelta = max( startDelta, 0.0 ); + startDelta *= farPlaneDist; + + // Calculate the distortion amount for the water surface. + // + // We subtract a little from it so that we don't + // distort where the water surface intersects the + // camera near plane. + float distortAmt = saturate( ( PIXEL_DIST - DISTORT_START_DIST ) / DISTORT_END_DIST ); + + // Scale down distortion in shallow water. + distortAmt *= saturate( startDelta / DISTORT_FULL_DEPTH ); + + // Do the intial distortion... we might remove it below. + vec2 distortDelta = bumpNorm.xy * distortAmt; + vec4 distortPos = IN_posPostWave; + distortPos.xy += distortDelta; + + deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); + + // Get deferred depth at the position of this distorted pixel. + float deferredDepth = deferredUncondition( deferredTex, deferredCoord ).w; + if ( deferredDepth > 0.99 ) + deferredDepth = 5.0; + + float delta = ( deferredDepth - pixelDepth ) * farPlaneDist; + + if ( delta < 0.0 ) + { + // If we got a negative delta then the distorted + // sample is above the water surface. Mask it out + // by removing the distortion. + distortPos = IN_posPostWave; + delta = startDelta; + distortAmt = 0; + } + else + { + float diff = ( deferredDepth - startDepth ) * farPlaneDist; + + if ( diff < 0 ) + { + distortAmt = saturate( ( PIXEL_DIST - DISTORT_START_DIST ) / DISTORT_END_DIST ); + distortAmt *= saturate( delta / DISTORT_FULL_DEPTH ); + + distortDelta = bumpNorm.xy * distortAmt; + + distortPos = IN_posPostWave; + distortPos.xy += distortDelta; + + deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); + + // Get deferred depth at the position of this distorted pixel. + deferredDepth = deferredUncondition( deferredTex, deferredCoord ).w; + if ( deferredDepth > 0.99 ) + deferredDepth = 5.0; + delta = ( deferredDepth - pixelDepth ) * farPlaneDist; + } + + if ( delta < 0.1 ) + { + // If we got a negative delta then the distorted + // sample is above the water surface. Mask it out + // by removing the distortion. + distortPos = IN_posPostWave; + delta = startDelta; + distortAmt = 0; + } + } + + vec4 temp = IN_posPreWave; + temp.xy += bumpNorm.xy * distortAmt; + vec2 reflectCoord = viewportCoordToRenderTarget( temp, rtParams1 ); + + vec2 refractCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); + + vec4 fakeColor = vec4(ambientColor,1); + vec3 eyeVec = IN_objPos.xyz - eyePos; + eyeVec = tMul( mat3(modelMat), eyeVec ); + eyeVec = tMul( IN_tangentMat, eyeVec ); + vec3 reflectionVec = reflect( eyeVec, bumpNorm ); + + // Use fakeColor for ripple-normals that are angled towards the camera + eyeVec = -eyeVec; + eyeVec = normalize( eyeVec ); + float ang = saturate( dot( eyeVec, bumpNorm ) ); + float fakeColorAmt = ang; + + // for verts far from the reflect plane z position + float rplaneDist = abs( REFLECT_PLANE_Z - IN_objPos.w ); + rplaneDist = saturate( ( rplaneDist - 1.0 ) / 2.0 ); + rplaneDist *= ISRIVER; + fakeColorAmt = max( fakeColorAmt, rplaneDist ); + +#ifndef UNDERWATER + + // Get foam color and amount + vec2 foamRippleOffset = bumpNorm.xy * FOAM_RIPPLE_INFLUENCE; + vec4 IN_foamTexCoords = IN_foamTexCoords; + IN_foamTexCoords.xy += foamRippleOffset; + IN_foamTexCoords.zw += foamRippleOffset; + + vec4 foamColor = texture( foamMap, IN_foamTexCoords.xy ); + foamColor += texture( foamMap, IN_foamTexCoords.zw ); + foamColor = saturate( foamColor ); + + // Modulate foam color by ambient color + // so we don't have glowing white foam at night. + foamColor.rgb = mix( foamColor.rgb, ambientColor.rgb, FOAM_AMBIENT_LERP ); + + float foamDelta = saturate( delta / FOAM_MAX_DEPTH ); + float foamAmt = 1 - pow( foamDelta, 2 ); + + // Fade out the foam in very very low depth, + // this improves the shoreline a lot. + float diff = 0.8 - foamAmt; + if ( diff < 0.0 ) + foamAmt -= foamAmt * abs( diff ) / 0.2; + + foamAmt *= FOAM_OPACITY * foamColor.a; + + foamColor.rgb *= FOAM_OPACITY * foamAmt * foamColor.a; + + // Get reflection map color. + vec4 refMapColor = texture( reflectMap, reflectCoord ); + + // If we do not have a reflection texture then we use the cubemap. + refMapColor = mix( refMapColor, texture( skyMap, reflectionVec ), NO_REFLECT ); + + fakeColor = ( texture( skyMap, reflectionVec ) ); + fakeColor.a = 1; + // Combine reflection color and fakeColor. + vec4 reflectColor = mix( refMapColor, fakeColor, fakeColorAmt ); + + // Get refract color + vec4 refractColor = hdrDecode( texture( refractBuff, refractCoord ) ); + + // We darken the refraction color a bit to make underwater + // elements look wet. We fade out this darkening near the + // surface in order to not have hard water edges. + // @param WET_DEPTH The depth in world units at which full darkening will be recieved. + // @param WET_COLOR_FACTOR The refract color is scaled down by this amount when at WET_DEPTH + refractColor.rgb *= 1.0f - ( saturate( delta / WET_DEPTH ) * WET_COLOR_FACTOR ); + + // Add Water fog/haze. + float fogDelta = delta - FOG_DENSITY_OFFSET; + + if ( fogDelta < 0.0 ) + fogDelta = 0.0; + float fogAmt = 1.0 - saturate( exp( -FOG_DENSITY * fogDelta ) ); + + // Calculate the water "base" color based on depth. + vec4 waterBaseColor = baseColor * texture( depthGradMap, saturate( delta / depthGradMax ) ); + + // Modulate baseColor by the ambientColor. + waterBaseColor *= vec4( ambientColor.rgb, 1 ); + + // calc "diffuse" color by lerping from the water color + // to refraction image based on the water clarity. + vec4 diffuseColor = mix( refractColor, waterBaseColor, fogAmt ); + + // fresnel calculation + float fresnelTerm = fresnel( ang, FRESNEL_BIAS, FRESNEL_POWER ); + + // Scale the frensel strength by fog amount + // so that parts that are very clear get very little reflection. + fresnelTerm *= fogAmt; + + // Also scale the frensel by our distance to the + // water surface. This removes the hard reflection + // when really close to the water surface. + fresnelTerm *= saturate( PIXEL_DIST - 0.1 ); + + fresnelTerm *= reflectivity; + + // Combine the diffuse color and reflection image via the + // fresnel term and set out output color. + vec4 OUT = mix( diffuseColor, reflectColor, fresnelTerm ); + + vec3 lightVec = inLightVec; + + // Get some specular reflection. + vec3 newbump = bumpNorm; + newbump.xy *= 3.5; + newbump = normalize( newbump ); + vec3 halfAng = normalize( eyeVec + -lightVec ); + float specular = saturate( dot( newbump, halfAng ) ); + specular = pow( specular, SPEC_POWER ); + + // Scale down specularity in very shallow water to improve the transparency of the shoreline. + specular *= saturate( delta / 2 ); + OUT.rgb = OUT.rgb + ( SPEC_COLOR * vec3(specular) ); + +#else + + vec4 refractColor = hdrDecode( texture( refractBuff, refractCoord ) ); + vec4 OUT = refractColor; + +#endif + +#ifndef UNDERWATER + + OUT.rgb = OUT.rgb + foamColor.rgb; + + float factor = computeSceneFog( eyePos, + IN_objPos.xyz, + IN_objPos.w, + fogData.x, + fogData.y, + fogData.z ); + + OUT.rgb = mix( OUT.rgb, fogColor.rgb, 1.0 - saturate( factor ) ); + + //OUT.rgb = fogColor.rgb; + +#endif + + OUT.a = 1.0; + + //return OUT; + + OUT_col = hdrEncode( OUT ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterV.glsl b/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterV.glsl new file mode 100644 index 000000000..490af63a7 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/water/gl/waterV.glsl @@ -0,0 +1,241 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../../gl/hlslCompat.glsl" +#include "shadergen:/autogenConditioners.h" + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- +struct VertData +{ + vec4 position ;// POSITION; + vec3 normal ;// NORMAL; + vec2 undulateData ;// TEXCOORD0; + vec4 horizonFactor ;// TEXCOORD1; +}; + +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- +//VertData IN +in vec4 vPosition; +in vec3 vNormal; +in vec2 vTexCoord0; +in vec4 vTexCoord1; + +#define IN_position_ vPosition +#define IN_normal vNormal +#define IN_undulateData vTexCoord0 +#define IN_horizonFactor vTexCoord1 + +//ConnectData OUT +// + out vec4 hpos ; + +// TexCoord 0 and 1 (xy,zw) for ripple texture lookup +out vec4 rippleTexCoord01; + + // xy is TexCoord 2 for ripple texture lookup + // z is the Worldspace unit distance/depth of this vertex/pixel + // w is amount of the crestFoam ( more at crest of waves ). + out vec4 rippleTexCoord2 ; + +// Screenspace vert position BEFORE wave transformation +out vec4 posPreWave; + +// Screenspace vert position AFTER wave transformation +out vec4 posPostWave; + + // Objectspace vert position BEFORE wave transformation + // w coord is world space z position. + out vec4 objPos ; + + out vec4 foamTexCoords ; + + out mat3 tangentMat ; +// + +#define OUT_hpos hpos +#define OUT_rippleTexCoord01 rippleTexCoord01 +#define OUT_rippleTexCoord2 rippleTexCoord2 +#define OUT_posPreWave posPreWave +#define OUT_posPostWave posPostWave +#define OUT_objPos objPos +#define OUT_foamTexCoords foamTexCoords +#define OUT_tangentMat tangentMat + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +uniform mat4 modelMat; +uniform mat4 modelview; +uniform vec4 rippleMat[3]; +uniform vec3 eyePos; +uniform vec2 waveDir[3]; +uniform vec2 waveData[3]; +uniform vec2 rippleDir[3]; +uniform vec2 rippleTexScale[3]; +uniform vec3 rippleSpeed; +uniform vec4 foamDir; +uniform vec4 foamTexScale; +uniform vec2 foamSpeed; +uniform vec3 inLightVec; +uniform float gridElementSize; +uniform float elapsedTime; +uniform float undulateMaxDist; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +void main() +{ + vec4 IN_position = IN_position_; + + // use projection matrix for reflection / refraction texture coords + mat4 texGen = mat4FromRow( 0.5, 0.0, 0.0, 0.5, + 0.0, -0.5, 0.0, 0.5, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 ); + + IN_position.z = mix( IN_position.z, eyePos.z, IN_horizonFactor.x ); + + OUT_objPos = IN_position; + OUT_objPos.w = tMul( modelMat, IN_position ).z; + + // Send pre-undulation screenspace position + OUT_posPreWave = tMul( modelview, IN_position ); + OUT_posPreWave = tMul( texGen, OUT_posPreWave ); + + // Calculate the undulation amount for this vertex. + vec2 undulatePos = tMul( modelMat, vec4 ( IN_undulateData.xy, 0, 1 ) ).xy; + float undulateAmt = 0.0; + + undulateAmt += waveData[0].y * sin( elapsedTime * waveData[0].x + + undulatePos.x * waveDir[0].x + + undulatePos.y * waveDir[0].y ); + undulateAmt += waveData[1].y * sin( elapsedTime * waveData[1].x + + undulatePos.x * waveDir[1].x + + undulatePos.y * waveDir[1].y ); + undulateAmt += waveData[2].y * sin( elapsedTime * waveData[2].x + + undulatePos.x * waveDir[2].x + + undulatePos.y * waveDir[2].y ); + + float undulateFade = 1; + + // Scale down wave magnitude amount based on distance from the camera. + float dist = distance( IN_position.xyz, eyePos ); + dist = clamp( dist, 1.0, undulateMaxDist ); + undulateFade *= ( 1 - dist / undulateMaxDist ); + + // Also scale down wave magnitude if the camera is very very close. + undulateFade *= saturate( ( distance( IN_position.xyz, eyePos ) - 0.5 ) / 10.0 ); + + undulateAmt *= undulateFade; + + OUT_rippleTexCoord2.w = undulateAmt / ( waveData[0].y + waveData[1].y + waveData[2].y ); + OUT_rippleTexCoord2.w = saturate( OUT_rippleTexCoord2.w - 0.2 ) / 0.8; + + // Apply wave undulation to the vertex. + OUT_posPostWave = IN_position; + OUT_posPostWave.xyz += IN_normal.xyz * undulateAmt; + + // Convert to screen + OUT_posPostWave = tMul( modelview, OUT_posPostWave ); + + // Setup the OUT position symantic variable + OUT_hpos = OUT_posPostWave; + //OUT_hpos.z = mix( OUT_hpos.z, OUT_hpos.w, IN_horizonFactor.x ); + + // if ( IN_horizonFactor.x > 0 ) + // { + // vec3 awayVec = normalize( OUT_objPos.xyz - eyePos ); + // OUT_objPos.xy += awayVec.xy * 1000.0; + // } + + // Save world space camera dist/depth of the outgoing pixel + OUT_rippleTexCoord2.z = OUT_hpos.z; + + // Convert to reflection texture space + OUT_posPostWave = tMul( texGen, OUT_posPostWave ); + + vec2 txPos = undulatePos; + if ( bool(IN_horizonFactor.x) ) + txPos = normalize( txPos ) * 50000.0; + + // set up tex coordinates for the 3 interacting normal maps + OUT_rippleTexCoord01.xy = txPos * rippleTexScale[0]; + OUT_rippleTexCoord01.xy += rippleDir[0] * elapsedTime * rippleSpeed.x; + + mat2 texMat; + texMat[0][0] = rippleMat[0].x; + texMat[1][0] = rippleMat[0].y; + texMat[0][1] = rippleMat[0].z; + texMat[1][1] = rippleMat[0].w; + OUT_rippleTexCoord01.xy = tMul( texMat, OUT_rippleTexCoord01.xy ); + + OUT_rippleTexCoord01.zw = txPos * rippleTexScale[1]; + OUT_rippleTexCoord01.zw += rippleDir[1] * elapsedTime * rippleSpeed.y; + + texMat[0][0] = rippleMat[1].x; + texMat[1][0] = rippleMat[1].y; + texMat[0][1] = rippleMat[1].z; + texMat[1][1] = rippleMat[1].w; + OUT_rippleTexCoord01.zw = tMul( texMat, OUT_rippleTexCoord01.zw ); + + OUT_rippleTexCoord2.xy = txPos * rippleTexScale[2]; + OUT_rippleTexCoord2.xy += rippleDir[2] * elapsedTime * rippleSpeed.z; + + texMat[0][0] = rippleMat[2].x; + texMat[1][0] = rippleMat[2].y; + texMat[0][1] = rippleMat[2].z; + texMat[1][1] = rippleMat[2].w; + OUT_rippleTexCoord2.xy = tMul( texMat, OUT_rippleTexCoord2.xy ); + + OUT_foamTexCoords.xy = txPos * foamTexScale.xy + foamDir.xy * foamSpeed.x * elapsedTime; + OUT_foamTexCoords.zw = txPos * foamTexScale.zw + foamDir.zw * foamSpeed.y * elapsedTime; + + + vec3 binormal = vec3 ( 1, 0, 0 ); + vec3 tangent = vec3 ( 0, 1, 0 ); + vec3 normal; + for ( int i = 0; i < 3; i++ ) + { + binormal.z += undulateFade * waveDir[i].x * waveData[i].y * cos( waveDir[i].x * undulatePos.x + waveDir[i].y * undulatePos.y + elapsedTime * waveData[i].x ); + tangent.z += undulateFade * waveDir[i].y * waveData[i].y * cos( waveDir[i].x * undulatePos.x + waveDir[i].y * undulatePos.y + elapsedTime * waveData[i].x ); + } + + binormal = binormal; + tangent = tangent; + normal = cross( binormal, tangent ); + + mat3 worldToTangent; + worldToTangent[0] = binormal; + worldToTangent[1] = tangent; + worldToTangent[2] = normal; + + OUT_tangentMat = transpose(worldToTangent); + + gl_Position = OUT_hpos; + correctSSP(gl_Position); +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/water/waterBasicP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/water/waterBasicP.hlsl new file mode 100644 index 000000000..9cacfdf7a --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/water/waterBasicP.hlsl @@ -0,0 +1,213 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../torque.hlsl" + +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- + +// miscParams +#define FRESNEL_BIAS miscParams[0] +#define FRESNEL_POWER miscParams[1] +#define CLARITY miscParams[2] +#define ISRIVER miscParams[3] + +// reflectParams +#define REFLECT_PLANE_Z reflectParams[0] +#define REFLECT_MIN_DIST reflectParams[1] +#define REFLECT_MAX_DIST reflectParams[2] +#define NO_REFLECT reflectParams[3] + +// distortionParams +#define DISTORT_START_DIST distortionParams[0] +#define DISTORT_END_DIST distortionParams[1] +#define DISTORT_FULL_DEPTH distortionParams[2] + +// ConnectData.misc +#define LIGHT_VEC IN.misc.xyz +#define WORLD_Z IN.objPos.w + +// specularParams +#define SPEC_POWER specularParams[3] +#define SPEC_COLOR specularParams.xyz + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + + // TexCoord 0 and 1 (xy,zw) for ripple texture lookup + float4 rippleTexCoord01 : TEXCOORD0; + + // TexCoord 2 for ripple texture lookup + float2 rippleTexCoord2 : TEXCOORD1; + + // Screenspace vert position BEFORE wave transformation + float4 posPreWave : TEXCOORD2; + + // Screenspace vert position AFTER wave transformation + float4 posPostWave : TEXCOORD3; + + // Worldspace unit distance/depth of this vertex/pixel + float pixelDist : TEXCOORD4; + + // Objectspace vert position BEFORE wave transformation + // w coord is world space z position. + float4 objPos : TEXCOORD5; + + float3 misc : TEXCOORD6; +}; + +//----------------------------------------------------------------------------- +// approximate Fresnel function +//----------------------------------------------------------------------------- +float fresnel(float NdotV, float bias, float power) +{ + return bias + (1.0-bias)*pow(abs(1.0 - max(NdotV, 0)), power); +} + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +TORQUE_UNIFORM_SAMPLER2D(bumpMap,0); +//uniform sampler2D deferredTex : register( S1 ); +TORQUE_UNIFORM_SAMPLER2D(reflectMap,2); +TORQUE_UNIFORM_SAMPLER2D(refractBuff,3); +TORQUE_UNIFORM_SAMPLERCUBE(skyMap,4); +//uniform sampler foamMap : register( S5 ); +uniform float4 baseColor; +uniform float4 miscParams; +uniform float4 reflectParams; +uniform float3 ambientColor; +uniform float3 eyePos; +uniform float3 distortionParams; +uniform float3 fogData; +uniform float4 fogColor; +uniform float4 rippleMagnitude; +uniform float4 specularParams; +uniform float4x4 modelMat; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +float4 main( ConnectData IN ) : TORQUE_TARGET0 +{ + // Modulate baseColor by the ambientColor. + float4 waterBaseColor = baseColor * float4( ambientColor.rgb, 1 ); + + // Get the bumpNorm... + float3 bumpNorm = ( TORQUE_TEX2D( bumpMap, IN.rippleTexCoord01.xy ).rgb * 2.0 - 1.0 ) * rippleMagnitude.x; + bumpNorm += ( TORQUE_TEX2D( bumpMap, IN.rippleTexCoord01.zw ).rgb * 2.0 - 1.0 ) * rippleMagnitude.y; + bumpNorm += ( TORQUE_TEX2D( bumpMap, IN.rippleTexCoord2 ).rgb * 2.0 - 1.0 ) * rippleMagnitude.z; + + bumpNorm = normalize( bumpNorm ); + bumpNorm = lerp( bumpNorm, float3(0,0,1), 1.0 - rippleMagnitude.w ); + + // We subtract a little from it so that we don't + // distort where the water surface intersects the + // camera near plane. + float distortAmt = saturate( IN.pixelDist / 1.0 ) * 0.8; + + float4 distortPos = IN.posPostWave; + distortPos.xy += bumpNorm.xy * distortAmt; + + #ifdef UNDERWATER + return hdrEncode( TORQUE_TEX2DPROJ( refractBuff, distortPos ) ); + #else + + float3 eyeVec = IN.objPos.xyz - eyePos; + eyeVec = mul( (float3x3)modelMat, eyeVec ); + float3 reflectionVec = reflect( eyeVec, bumpNorm ); + + // Color that replaces the reflection color when we do not + // have one that is appropriate. + float4 fakeColor = float4(ambientColor,1); + + // Use fakeColor for ripple-normals that are angled towards the camera + eyeVec = -eyeVec; + eyeVec = normalize( eyeVec ); + float ang = saturate( dot( eyeVec, bumpNorm ) ); + float fakeColorAmt = ang; + + // Get reflection map color + float4 refMapColor = hdrDecode( TORQUE_TEX2DPROJ( reflectMap, distortPos ) ); + // If we do not have a reflection texture then we use the cubemap. + refMapColor = lerp( refMapColor, TORQUE_TEXCUBE( skyMap, reflectionVec ), NO_REFLECT ); + + // Combine reflection color and fakeColor. + float4 reflectColor = lerp( refMapColor, fakeColor, fakeColorAmt ); + //return refMapColor; + + // Get refract color + float4 refractColor = hdrDecode( TORQUE_TEX2DPROJ( refractBuff, distortPos ) ); + + // calc "diffuse" color by lerping from the water color + // to refraction image based on the water clarity. + float4 diffuseColor = lerp( refractColor, waterBaseColor, 1.0f - CLARITY ); + + // fresnel calculation + float fresnelTerm = fresnel( ang, FRESNEL_BIAS, FRESNEL_POWER ); + //return float4( fresnelTerm.rrr, 1 ); + + // Also scale the frensel by our distance to the + // water surface. This removes the hard reflection + // when really close to the water surface. + fresnelTerm *= saturate( IN.pixelDist - 0.1 ); + + // Combine the diffuse color and reflection image via the + // fresnel term and set out output color. + float4 OUT = lerp( diffuseColor, reflectColor, fresnelTerm ); + + #ifdef WATER_SPEC + + // Get some specular reflection. + float3 newbump = bumpNorm; + newbump.xy *= 3.5; + newbump = normalize( bumpNorm ); + half3 halfAng = normalize( eyeVec + -LIGHT_VEC ); + float specular = saturate( dot( newbump, halfAng ) ); + specular = pow( specular, SPEC_POWER ); + + OUT.rgb = OUT.rgb + ( SPEC_COLOR * specular.xxx ); + + #else // Disable fogging if spec is on because otherwise we run out of instructions. + + // Fog it. + float factor = computeSceneFog( eyePos, + IN.objPos.xyz, + WORLD_Z, + fogData.x, + fogData.y, + fogData.z ); + + //OUT.rgb = lerp( OUT.rgb, fogColor.rgb, 1.0 - saturate( factor ) ); + + #endif + + return hdrEncode( OUT ); + +#endif +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/water/waterBasicV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/water/waterBasicV.hlsl new file mode 100644 index 000000000..310647c90 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/water/waterBasicV.hlsl @@ -0,0 +1,237 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- +struct VertData +{ + float3 position : POSITION; + float3 normal : NORMAL; + float2 undulateData : TEXCOORD0; + float4 horizonFactor : TEXCOORD1; +}; + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + + // TexCoord 0 and 1 (xy,zw) for ripple texture lookup + float4 rippleTexCoord01 : TEXCOORD0; + + // TexCoord 2 for ripple texture lookup + float2 rippleTexCoord2 : TEXCOORD1; + + // Screenspace vert position BEFORE wave transformation + float4 posPreWave : TEXCOORD2; + + // Screenspace vert position AFTER wave transformation + float4 posPostWave : TEXCOORD3; + + // Worldspace unit distance/depth of this vertex/pixel + float pixelDist : TEXCOORD4; + + // Objectspace vert position BEFORE wave transformation + // w coord is world space z position. + float4 objPos : TEXCOORD5; + + float3 misc : TEXCOORD6; +}; + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +uniform float4x4 modelMat; +uniform float4x4 modelview; +uniform float4 rippleMat[3]; +uniform float3 eyePos; +uniform float2 waveDir[3]; +uniform float2 waveData[3]; +uniform float2 rippleDir[3]; +uniform float2 rippleTexScale[3]; +uniform float3 rippleSpeed; +uniform float3 inLightVec; +uniform float3 reflectNormal; +uniform float gridElementSize; +uniform float elapsedTime; +uniform float undulateMaxDist; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +ConnectData main( VertData IN ) +{ + ConnectData OUT; + + // use projection matrix for reflection / refraction texture coords + float4x4 texGen = { 0.5, 0.0, 0.0, 0.5, + 0.0, -0.5, 0.0, 0.5, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 }; + + // Move the vertex based on the horizonFactor if specified to do so for this vert. + // if ( IN.horizonFactor.z > 0 ) + // { + // float2 offsetXY = eyePos.xy - eyePos.xy % gridElementSize; + // IN.position.xy += offsetXY; + // IN.undulateData += offsetXY; + // } + float4 inPos = float4(IN.position, 1.0); + float4 worldPos = mul(modelMat, inPos); + + IN.position.z = lerp( IN.position.z, eyePos.z, IN.horizonFactor.x ); + + //OUT.objPos = worldPos; + OUT.objPos.xyz = IN.position; + OUT.objPos.w = worldPos.z; + + // Send pre-undulation screenspace position + OUT.posPreWave = mul( modelview, inPos ); + OUT.posPreWave = mul( texGen, OUT.posPreWave ); + + // Calculate the undulation amount for this vertex. + float2 undulatePos = mul( modelMat, float4( IN.undulateData.xy, 0, 1 )).xy; + //if ( undulatePos.x < 0 ) + // undulatePos = IN.position.xy; + + float undulateAmt = 0.0; + + undulateAmt += waveData[0].y * sin( elapsedTime * waveData[0].x + + undulatePos.x * waveDir[0].x + + undulatePos.y * waveDir[0].y ); + undulateAmt += waveData[1].y * sin( elapsedTime * waveData[1].x + + undulatePos.x * waveDir[1].x + + undulatePos.y * waveDir[1].y ); + undulateAmt += waveData[2].y * sin( elapsedTime * waveData[2].x + + undulatePos.x * waveDir[2].x + + undulatePos.y * waveDir[2].y ); + + float undulateFade = 1; + + // Scale down wave magnitude amount based on distance from the camera. + float dist = distance( IN.position, eyePos ); + dist = clamp( dist, 1.0, undulateMaxDist ); + undulateFade *= ( 1 - dist / undulateMaxDist ); + + // Also scale down wave magnitude if the camera is very very close. + undulateFade *= saturate( ( distance( IN.position, eyePos ) - 0.5 ) / 10.0 ); + + undulateAmt *= undulateFade; + + //#endif + //undulateAmt = 0; + + // Apply wave undulation to the vertex. + OUT.posPostWave = inPos; + OUT.posPostWave.xyz += IN.normal.xyz * undulateAmt; + + // Save worldSpace position of this pixel/vert + //OUT.worldPos = OUT.posPostWave.xyz; + //OUT.worldPos = mul( modelMat, OUT.posPostWave.xyz ); + //OUT.worldPos.z += objTrans[2][2]; //91.16; + + // OUT.misc.w = mul( modelMat, OUT.fogPos ).z; + // if ( IN.horizonFactor.x > 0 ) + // { + // float3 awayVec = normalize( OUT.fogPos.xyz - eyePos ); + // OUT.fogPos.xy += awayVec.xy * 1000.0; + // } + + // Convert to screen + OUT.posPostWave = mul( modelview, OUT.posPostWave ); // mul( modelview, float4( OUT.posPostWave.xyz, 1 ) ); + + // Setup the OUT position symantic variable + OUT.hpos = OUT.posPostWave; // mul( modelview, float4( IN.position.xyz, 1 ) ); //float4( OUT.posPostWave.xyz, 1 ); + //OUT.hpos.z = lerp( OUT.hpos.z, OUT.hpos.w, IN.horizonFactor.x ); + + // Save world space camera dist/depth of the outgoing pixel + OUT.pixelDist = OUT.hpos.z; + + // Convert to reflection texture space + OUT.posPostWave = mul( texGen, OUT.posPostWave ); + + float2 txPos = undulatePos; + if ( IN.horizonFactor.x ) + txPos = normalize( txPos ) * 50000.0; + + // set up tex coordinates for the 3 interacting normal maps + OUT.rippleTexCoord01.xy = txPos * rippleTexScale[0]; + OUT.rippleTexCoord01.xy += rippleDir[0] * elapsedTime * rippleSpeed.x; + + float2x2 texMat; + texMat[0][0] = rippleMat[0].x; + texMat[0][1] = rippleMat[0].y; + texMat[1][0] = rippleMat[0].z; + texMat[1][1] = rippleMat[0].w; + OUT.rippleTexCoord01.xy = mul( texMat, OUT.rippleTexCoord01.xy ); + + OUT.rippleTexCoord01.zw = txPos * rippleTexScale[1]; + OUT.rippleTexCoord01.zw += rippleDir[1] * elapsedTime * rippleSpeed.y; + + texMat[0][0] = rippleMat[1].x; + texMat[0][1] = rippleMat[1].y; + texMat[1][0] = rippleMat[1].z; + texMat[1][1] = rippleMat[1].w; + OUT.rippleTexCoord01.zw = mul( texMat, OUT.rippleTexCoord01.zw ); + + OUT.rippleTexCoord2.xy = txPos * rippleTexScale[2]; + OUT.rippleTexCoord2.xy += rippleDir[2] * elapsedTime * rippleSpeed.z; + + texMat[0][0] = rippleMat[2].x; + texMat[0][1] = rippleMat[2].y; + texMat[1][0] = rippleMat[2].z; + texMat[1][1] = rippleMat[2].w; + OUT.rippleTexCoord2.xy = mul( texMat, OUT.rippleTexCoord2.xy ); + +#ifdef WATER_SPEC + + float3 binormal = float3( 1, 0, 0 ); + float3 tangent = float3( 0, 1, 0 ); + float3 normal; + for ( int i = 0; i < 3; i++ ) + { + binormal.z += undulateFade * waveDir[i].x * waveData[i].y * cos( waveDir[i].x * IN.undulateData.x + waveDir[i].y * IN.undulateData.y + elapsedTime * waveData[i].x ); + tangent.z += undulateFade * waveDir[i].y * waveData[i].y * cos( waveDir[i].x * IN.undulateData.x + waveDir[i].y * IN.undulateData.y + elapsedTime * waveData[i].x ); + } + + binormal = normalize( binormal ); + tangent = normalize( tangent ); + normal = cross( binormal, tangent ); + + float3x3 worldToTangent; + worldToTangent[0] = binormal; + worldToTangent[1] = tangent; + worldToTangent[2] = normal; + + OUT.misc.xyz = mul( inLightVec, modelMat ); + OUT.misc.xyz = mul( worldToTangent, OUT.misc.xyz ); + +#else + + OUT.misc.xyz = inLightVec; + +#endif + + return OUT; +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/water/waterP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/water/waterP.hlsl new file mode 100644 index 000000000..59bdad05d --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/water/waterP.hlsl @@ -0,0 +1,383 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModelAutoGen.hlsl" +#include "../torque.hlsl" + +//----------------------------------------------------------------------------- +// Defines +//----------------------------------------------------------------------------- + +#define PIXEL_DIST IN.rippleTexCoord2.z +// miscParams +#define FRESNEL_BIAS miscParams[0] +#define FRESNEL_POWER miscParams[1] +// miscParams[2] is unused +#define ISRIVER miscParams[3] + +// reflectParams +#define REFLECT_PLANE_Z reflectParams[0] +#define REFLECT_MIN_DIST reflectParams[1] +#define REFLECT_MAX_DIST reflectParams[2] +#define NO_REFLECT reflectParams[3] + +// fogParams +#define FOG_DENSITY fogParams[0] +#define FOG_DENSITY_OFFSET fogParams[1] + +// wetnessParams +#define WET_DEPTH wetnessParams[0] +#define WET_COLOR_FACTOR wetnessParams[1] + +// distortionParams +#define DISTORT_START_DIST distortionParams[0] +#define DISTORT_END_DIST distortionParams[1] +#define DISTORT_FULL_DEPTH distortionParams[2] + +// foamParams +#define FOAM_OPACITY foamParams[0] +#define FOAM_MAX_DEPTH foamParams[1] +#define FOAM_AMBIENT_LERP foamParams[2] +#define FOAM_RIPPLE_INFLUENCE foamParams[3] + +// specularParams +#define SPEC_POWER specularParams[3] +#define SPEC_COLOR specularParams.xyz + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + + // TexCoord 0 and 1 (xy,zw) for ripple texture lookup + float4 rippleTexCoord01 : TEXCOORD0; + + // xy is TexCoord 2 for ripple texture lookup + // z is the Worldspace unit distance/depth of this vertex/pixel + // w is amount of the crestFoam ( more at crest of waves ). + float4 rippleTexCoord2 : TEXCOORD1; + + // Screenspace vert position BEFORE wave transformation + float4 posPreWave : TEXCOORD2; + + // Screenspace vert position AFTER wave transformation + float4 posPostWave : TEXCOORD3; + + // Objectspace vert position BEFORE wave transformation + // w coord is world space z position. + float4 objPos : TEXCOORD4; + + float4 foamTexCoords : TEXCOORD5; + + float3x3 tangentMat : TEXCOORD6; +}; + +//----------------------------------------------------------------------------- +// approximate Fresnel function +//----------------------------------------------------------------------------- +float fresnel(float NdotV, float bias, float power) +{ + return bias + (1.0-bias)*pow(abs(1.0 - max(NdotV, 0)), power); +} + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +TORQUE_UNIFORM_SAMPLER2D(bumpMap,0); +TORQUE_UNIFORM_SAMPLER2D(deferredTex, 1); +TORQUE_UNIFORM_SAMPLER2D(reflectMap, 2); +TORQUE_UNIFORM_SAMPLER2D(refractBuff, 3); +TORQUE_UNIFORM_SAMPLERCUBE(skyMap, 4); +TORQUE_UNIFORM_SAMPLER2D(foamMap, 5); +TORQUE_UNIFORM_SAMPLER1D(depthGradMap, 6); +uniform float4 specularParams; +uniform float4 baseColor; +uniform float4 miscParams; +uniform float2 fogParams; +uniform float4 reflectParams; +uniform float3 reflectNormal; +uniform float2 wetnessParams; +uniform float farPlaneDist; +uniform float3 distortionParams; +uniform float4 foamParams; +uniform float3 ambientColor; +uniform float3 eyePos; // This is in object space! +uniform float3 fogData; +uniform float4 fogColor; +uniform float4 rippleMagnitude; +uniform float4 rtParams1; +uniform float depthGradMax; +uniform float3 inLightVec; +uniform float4x4 modelMat; +uniform float4 sunColor; +uniform float sunBrightness; +uniform float reflectivity; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +float4 main( ConnectData IN ) : TORQUE_TARGET0 +{ + // Get the bumpNorm... + float3 bumpNorm = ( TORQUE_TEX2D( bumpMap, IN.rippleTexCoord01.xy ).rgb * 2.0 - 1.0 ) * rippleMagnitude.x; + bumpNorm += ( TORQUE_TEX2D( bumpMap, IN.rippleTexCoord01.zw ).rgb * 2.0 - 1.0 ) * rippleMagnitude.y; + bumpNorm += ( TORQUE_TEX2D( bumpMap, IN.rippleTexCoord2.xy ).rgb * 2.0 - 1.0 ) * rippleMagnitude.z; + + bumpNorm = normalize( bumpNorm ); + bumpNorm = lerp( bumpNorm, float3(0,0,1), 1.0 - rippleMagnitude.w ); + bumpNorm = mul( bumpNorm, IN.tangentMat ); + + // Get depth of the water surface (this pixel). + // Convert from WorldSpace to EyeSpace. + float pixelDepth = PIXEL_DIST / farPlaneDist; + + float2 deferredCoord = viewportCoordToRenderTarget( IN.posPostWave, rtParams1 ); + + float startDepth = TORQUE_DEFERRED_UNCONDITION( deferredTex, deferredCoord ).w; + + // The water depth in world units of the undistorted pixel. + float startDelta = ( startDepth - pixelDepth ); + startDelta = max( startDelta, 0.0 ); + startDelta *= farPlaneDist; + + // Calculate the distortion amount for the water surface. + // + // We subtract a little from it so that we don't + // distort where the water surface intersects the + // camera near plane. + float distortAmt = saturate( ( PIXEL_DIST - DISTORT_START_DIST ) / DISTORT_END_DIST ); + + // Scale down distortion in shallow water. + distortAmt *= saturate( startDelta / DISTORT_FULL_DEPTH ); + + // Do the intial distortion... we might remove it below. + float2 distortDelta = bumpNorm.xy * distortAmt; + float4 distortPos = IN.posPostWave; + distortPos.xy += distortDelta; + + deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); + + // Get deferred depth at the position of this distorted pixel. + float deferredDepth = TORQUE_DEFERRED_UNCONDITION( deferredTex, deferredCoord ).w; + if ( deferredDepth > 0.99 ) + deferredDepth = 5.0; + + float delta = ( deferredDepth - pixelDepth ) * farPlaneDist; + + if ( delta < 0.0 ) + { + // If we got a negative delta then the distorted + // sample is above the water surface. Mask it out + // by removing the distortion. + distortPos = IN.posPostWave; + delta = startDelta; + distortAmt = 0; + } + else + { + float diff = ( deferredDepth - startDepth ) * farPlaneDist; + + if ( diff < 0 ) + { + distortAmt = saturate( ( PIXEL_DIST - DISTORT_START_DIST ) / DISTORT_END_DIST ); + distortAmt *= saturate( delta / DISTORT_FULL_DEPTH ); + + distortDelta = bumpNorm.xy * distortAmt; + + distortPos = IN.posPostWave; + distortPos.xy += distortDelta; + + deferredCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); + + // Get deferred depth at the position of this distorted pixel. + deferredDepth = TORQUE_DEFERRED_UNCONDITION( deferredTex, deferredCoord ).w; + if ( deferredDepth > 0.99 ) + deferredDepth = 5.0; + delta = ( deferredDepth - pixelDepth ) * farPlaneDist; + } + + if ( delta < 0.1 ) + { + // If we got a negative delta then the distorted + // sample is above the water surface. Mask it out + // by removing the distortion. + distortPos = IN.posPostWave; + delta = startDelta; + distortAmt = 0; + } + } + + float4 temp = IN.posPreWave; + temp.xy += bumpNorm.xy * distortAmt; + float2 reflectCoord = viewportCoordToRenderTarget( temp, rtParams1 ); + + float2 refractCoord = viewportCoordToRenderTarget( distortPos, rtParams1 ); + + float4 fakeColor = float4(ambientColor,1); + float3 eyeVec = IN.objPos.xyz - eyePos; + eyeVec = mul( (float3x3)modelMat, eyeVec ); + eyeVec = mul( IN.tangentMat, eyeVec ); + float3 reflectionVec = reflect( eyeVec, bumpNorm ); + + // Use fakeColor for ripple-normals that are angled towards the camera + eyeVec = -eyeVec; + eyeVec = normalize( eyeVec ); + float ang = saturate( dot( eyeVec, bumpNorm ) ); + float fakeColorAmt = ang; + + // for verts far from the reflect plane z position + float rplaneDist = abs( REFLECT_PLANE_Z - IN.objPos.w ); + rplaneDist = saturate( ( rplaneDist - 1.0 ) / 2.0 ); + rplaneDist *= ISRIVER; + fakeColorAmt = max( fakeColorAmt, rplaneDist ); + +#ifndef UNDERWATER + + // Get foam color and amount + float2 foamRippleOffset = bumpNorm.xy * FOAM_RIPPLE_INFLUENCE; + IN.foamTexCoords.xy += foamRippleOffset; + IN.foamTexCoords.zw += foamRippleOffset; + + float4 foamColor = TORQUE_TEX2D( foamMap, IN.foamTexCoords.xy ); + foamColor += TORQUE_TEX2D( foamMap, IN.foamTexCoords.zw ); + foamColor = saturate( foamColor ); + + // Modulate foam color by ambient color + // so we don't have glowing white foam at night. + foamColor.rgb = lerp( foamColor.rgb, ambientColor.rgb, FOAM_AMBIENT_LERP ); + + float foamDelta = saturate( delta / FOAM_MAX_DEPTH ); + float foamAmt = 1 - pow( foamDelta, 2 ); + + // Fade out the foam in very very low depth, + // this improves the shoreline a lot. + float diff = 0.8 - foamAmt; + if ( diff < 0.0 ) + foamAmt -= foamAmt * abs( diff ) / 0.2; + + foamAmt *= FOAM_OPACITY * foamColor.a; + + foamColor.rgb *= FOAM_OPACITY * foamAmt * foamColor.a; + + // Get reflection map color. + float4 refMapColor = TORQUE_TEX2D( reflectMap, reflectCoord ); + + // If we do not have a reflection texture then we use the cubemap. + refMapColor = lerp( refMapColor, TORQUE_TEXCUBE( skyMap, reflectionVec ), NO_REFLECT ); + + fakeColor = ( TORQUE_TEXCUBE( skyMap, reflectionVec ) ); + fakeColor.a = 1; + // Combine reflection color and fakeColor. + float4 reflectColor = lerp( refMapColor, fakeColor, fakeColorAmt ); + + // Get refract color + float4 refractColor = hdrDecode( TORQUE_TEX2D( refractBuff, refractCoord ) ); + + // We darken the refraction color a bit to make underwater + // elements look wet. We fade out this darkening near the + // surface in order to not have hard water edges. + // @param WET_DEPTH The depth in world units at which full darkening will be recieved. + // @param WET_COLOR_FACTOR The refract color is scaled down by this amount when at WET_DEPTH + refractColor.rgb *= 1.0f - ( saturate( delta / WET_DEPTH ) * WET_COLOR_FACTOR ); + + // Add Water fog/haze. + float fogDelta = delta - FOG_DENSITY_OFFSET; + + if ( fogDelta < 0.0 ) + fogDelta = 0.0; + float fogAmt = 1.0 - saturate( exp( -FOG_DENSITY * fogDelta ) ); + + // Calculate the water "base" color based on depth. + float4 waterBaseColor = baseColor * TORQUE_TEX1D( depthGradMap, saturate( delta / depthGradMax ) ); + + // Modulate baseColor by the ambientColor. + waterBaseColor *= float4( ambientColor.rgb, 1 ); + + // calc "diffuse" color by lerping from the water color + // to refraction image based on the water clarity. + float4 diffuseColor = lerp( refractColor, waterBaseColor, fogAmt ); + + // fresnel calculation + float fresnelTerm = fresnel( ang, FRESNEL_BIAS, FRESNEL_POWER ); + + // Scale the frensel strength by fog amount + // so that parts that are very clear get very little reflection. + fresnelTerm *= fogAmt; + + // Also scale the frensel by our distance to the + // water surface. This removes the hard reflection + // when really close to the water surface. + fresnelTerm *= saturate( PIXEL_DIST - 0.1 ); + + fresnelTerm *= reflectivity; + + // Combine the diffuse color and reflection image via the + // fresnel term and set out output color. + float4 OUT = lerp( diffuseColor, reflectColor, fresnelTerm ); + + float3 lightVec = inLightVec; + + // Get some specular reflection. + float3 newbump = bumpNorm; + newbump.xy *= 3.5; + newbump = normalize( newbump ); + float3 halfAng = normalize( eyeVec + -lightVec ); + float specular = saturate( dot( newbump, halfAng ) ); + specular = pow( specular, SPEC_POWER ); + + // Scale down specularity in very shallow water to improve the transparency of the shoreline. + specular *= saturate( delta / 2 ); + OUT.rgb = OUT.rgb + ( SPEC_COLOR * specular.xxx ); + +#else + + float4 refractColor = hdrDecode( TORQUE_TEX2D( refractBuff, refractCoord ) ); + float4 OUT = refractColor; + +#endif + +#ifndef UNDERWATER + + OUT.rgb = OUT.rgb + foamColor.rgb; + + float factor = computeSceneFog( eyePos, + IN.objPos.xyz, + IN.objPos.w, + fogData.x, + fogData.y, + fogData.z ); + + OUT.rgb = lerp( OUT.rgb, fogColor.rgb, 1.0 - saturate( factor ) ); + + //OUT.rgb = fogColor.rgb; + +#endif + + OUT.a = 1.0; + + //return OUT; + + return hdrEncode( OUT ); +} diff --git a/Templates/BaseGame/game/core/rendering/shaders/water/waterV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/water/waterV.hlsl new file mode 100644 index 000000000..c869f0e9f --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/water/waterV.hlsl @@ -0,0 +1,216 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#include "../shaderModel.hlsl" + +//----------------------------------------------------------------------------- +// Structures +//----------------------------------------------------------------------------- +struct VertData +{ + float3 position : POSITION; + float3 normal : NORMAL; + float2 undulateData : TEXCOORD0; + float4 horizonFactor : TEXCOORD1; +}; + +struct ConnectData +{ + float4 hpos : TORQUE_POSITION; + + // TexCoord 0 and 1 (xy,zw) for ripple texture lookup + float4 rippleTexCoord01 : TEXCOORD0; + + // xy is TexCoord 2 for ripple texture lookup + // z is the Worldspace unit distance/depth of this vertex/pixel + // w is amount of the crestFoam ( more at crest of waves ). + float4 rippleTexCoord2 : TEXCOORD1; + + // Screenspace vert position BEFORE wave transformation + float4 posPreWave : TEXCOORD2; + + // Screenspace vert position AFTER wave transformation + float4 posPostWave : TEXCOORD3; + + // Objectspace vert position BEFORE wave transformation + // w coord is world space z position. + float4 objPos : TEXCOORD4; + + float4 foamTexCoords : TEXCOORD5; + + float3x3 tangentMat : TEXCOORD6; +}; + +//----------------------------------------------------------------------------- +// Uniforms +//----------------------------------------------------------------------------- +uniform float4x4 modelMat; +uniform float4x4 modelview; +uniform float4 rippleMat[3]; +uniform float3 eyePos; +uniform float2 waveDir[3]; +uniform float2 waveData[3]; +uniform float2 rippleDir[3]; +uniform float2 rippleTexScale[3]; +uniform float3 rippleSpeed; +uniform float4 foamDir; +uniform float4 foamTexScale; +uniform float2 foamSpeed; +uniform float3 inLightVec; +uniform float gridElementSize; +uniform float elapsedTime; +uniform float undulateMaxDist; + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +ConnectData main( VertData IN ) +{ + ConnectData OUT; + + // use projection matrix for reflection / refraction texture coords + float4x4 texGen = { 0.5, 0.0, 0.0, 0.5, + 0.0, -0.5, 0.0, 0.5, + 0.0, 0.0, 1.0, 0.0, + 0.0, 0.0, 0.0, 1.0 }; + + IN.position.z = lerp( IN.position.z, eyePos.z, IN.horizonFactor.x ); + float4 inPos = float4( IN.position, 1.0); + OUT.objPos = inPos; + OUT.objPos.w = mul( modelMat, inPos ).z; + + // Send pre-undulation screenspace position + OUT.posPreWave = mul( modelview, inPos ); + OUT.posPreWave = mul( texGen, OUT.posPreWave ); + + // Calculate the undulation amount for this vertex. + float2 undulatePos = mul( modelMat, float4( IN.undulateData.xy, 0, 1 ) ).xy; + float undulateAmt = 0.0; + + undulateAmt += waveData[0].y * sin( elapsedTime * waveData[0].x + + undulatePos.x * waveDir[0].x + + undulatePos.y * waveDir[0].y ); + undulateAmt += waveData[1].y * sin( elapsedTime * waveData[1].x + + undulatePos.x * waveDir[1].x + + undulatePos.y * waveDir[1].y ); + undulateAmt += waveData[2].y * sin( elapsedTime * waveData[2].x + + undulatePos.x * waveDir[2].x + + undulatePos.y * waveDir[2].y ); + + float undulateFade = 1; + + // Scale down wave magnitude amount based on distance from the camera. + float dist = distance( IN.position.xyz, eyePos ); + dist = clamp( dist, 1.0, undulateMaxDist ); + undulateFade *= ( 1 - dist / undulateMaxDist ); + + // Also scale down wave magnitude if the camera is very very close. + undulateFade *= saturate( ( distance( IN.position.xyz, eyePos ) - 0.5 ) / 10.0 ); + + undulateAmt *= undulateFade; + + OUT.rippleTexCoord2.w = undulateAmt / ( waveData[0].y + waveData[1].y + waveData[2].y ); + OUT.rippleTexCoord2.w = saturate( OUT.rippleTexCoord2.w - 0.2 ) / 0.8; + + // Apply wave undulation to the vertex. + OUT.posPostWave = inPos; + OUT.posPostWave.xyz += IN.normal.xyz * undulateAmt; + + // Convert to screen + OUT.posPostWave = mul( modelview, OUT.posPostWave ); + + // Setup the OUT position symantic variable + OUT.hpos = OUT.posPostWave; + //OUT.hpos.z = lerp( OUT.hpos.z, OUT.hpos.w, IN.horizonFactor.x ); + + // if ( IN.horizonFactor.x > 0 ) + // { + // float3 awayVec = normalize( OUT.objPos.xyz - eyePos ); + // OUT.objPos.xy += awayVec.xy * 1000.0; + // } + + // Save world space camera dist/depth of the outgoing pixel + OUT.rippleTexCoord2.z = OUT.hpos.z; + + // Convert to reflection texture space + OUT.posPostWave = mul( texGen, OUT.posPostWave ); + + float2 txPos = undulatePos; + if ( IN.horizonFactor.x ) + txPos = normalize( txPos ) * 50000.0; + + // set up tex coordinates for the 3 interacting normal maps + OUT.rippleTexCoord01.xy = txPos * rippleTexScale[0]; + OUT.rippleTexCoord01.xy += rippleDir[0] * elapsedTime * rippleSpeed.x; + + float2x2 texMat; + texMat[0][0] = rippleMat[0].x; + texMat[0][1] = rippleMat[0].y; + texMat[1][0] = rippleMat[0].z; + texMat[1][1] = rippleMat[0].w; + OUT.rippleTexCoord01.xy = mul( texMat, OUT.rippleTexCoord01.xy ); + + OUT.rippleTexCoord01.zw = txPos * rippleTexScale[1]; + OUT.rippleTexCoord01.zw += rippleDir[1] * elapsedTime * rippleSpeed.y; + + texMat[0][0] = rippleMat[1].x; + texMat[0][1] = rippleMat[1].y; + texMat[1][0] = rippleMat[1].z; + texMat[1][1] = rippleMat[1].w; + OUT.rippleTexCoord01.zw = mul( texMat, OUT.rippleTexCoord01.zw ); + + OUT.rippleTexCoord2.xy = txPos * rippleTexScale[2]; + OUT.rippleTexCoord2.xy += rippleDir[2] * elapsedTime * rippleSpeed.z; + + texMat[0][0] = rippleMat[2].x; + texMat[0][1] = rippleMat[2].y; + texMat[1][0] = rippleMat[2].z; + texMat[1][1] = rippleMat[2].w; + OUT.rippleTexCoord2.xy = mul( texMat, OUT.rippleTexCoord2.xy ); + + OUT.foamTexCoords.xy = txPos * foamTexScale.xy + foamDir.xy * foamSpeed.x * elapsedTime; + OUT.foamTexCoords.zw = txPos * foamTexScale.zw + foamDir.zw * foamSpeed.y * elapsedTime; + + + float3 binormal = float3( 1, 0, 0 ); + float3 tangent = float3( 0, 1, 0 ); + float3 normal; + for ( int i = 0; i < 3; i++ ) + { + binormal.z += undulateFade * waveDir[i].x * waveData[i].y * cos( waveDir[i].x * undulatePos.x + waveDir[i].y * undulatePos.y + elapsedTime * waveData[i].x ); + tangent.z += undulateFade * waveDir[i].y * waveData[i].y * cos( waveDir[i].x * undulatePos.x + waveDir[i].y * undulatePos.y + elapsedTime * waveData[i].x ); + } + + binormal = binormal; + tangent = tangent; + normal = cross( binormal, tangent ); + + float3x3 worldToTangent; + worldToTangent[0] = binormal; + worldToTangent[1] = tangent; + worldToTangent[2] = normal; + + OUT.tangentMat = worldToTangent; + + return OUT; +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/wavesP.hlsl b/Templates/BaseGame/game/core/rendering/shaders/wavesP.hlsl new file mode 100644 index 000000000..c51eb4b89 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/wavesP.hlsl @@ -0,0 +1,89 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define IN_HLSL +#include "shdrConsts.h" +#include "shaderModel.hlsl" + +//----------------------------------------------------------------------------- +// Data +//----------------------------------------------------------------------------- +struct v2f +{ + float4 HPOS : TORQUE_POSITION; + float2 TEX0 : TEXCOORD0; + float4 tangentToCube0 : TEXCOORD1; + float4 tangentToCube1 : TEXCOORD2; + float4 tangentToCube2 : TEXCOORD3; + float4 lightVec : TEXCOORD4; + float3 pixPos : TEXCOORD5; + float3 eyePos : TEXCOORD6; +}; + + + +struct Fragout +{ + float4 col : TORQUE_TARGET0; +}; + +// Uniforms +TORQUE_UNIFORM_SAMPLER2D(diffMap,0); +//TORQUE_UNIFORM_SAMPLERCUBE(cubeMap, 1); not used? +TORQUE_UNIFORM_SAMPLER2D(bumpMap,2); + +uniform float4 specularColor : register(PC_MAT_SPECCOLOR); +uniform float4 ambient : register(PC_AMBIENT_COLOR); +uniform float specularPower : register(PC_MAT_SPECPOWER); +uniform float accumTime : register(PC_ACCUM_TIME); + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Fragout main(v2f IN) +{ + Fragout OUT; + + float2 texOffset; + float sinOffset1 = sin( accumTime * 1.5 + IN.TEX0.y * 6.28319 * 3.0 ) * 0.03; + float sinOffset2 = sin( accumTime * 3.0 + IN.TEX0.y * 6.28319 ) * 0.04; + + texOffset.x = IN.TEX0.x + sinOffset1 + sinOffset2; + texOffset.y = IN.TEX0.y + cos( accumTime * 3.0 + IN.TEX0.x * 6.28319 * 2.0 ) * 0.05; + + + float4 bumpNorm = TORQUE_TEX2D( bumpMap, texOffset ) * 2.0 - 1.0; + float4 diffuse = TORQUE_TEX2D( diffMap, texOffset ); + + OUT.col = diffuse * (saturate( dot( IN.lightVec, bumpNorm.xyz ) ) + ambient); + + float3 eyeVec = normalize(IN.eyePos - IN.pixPos); + float3 halfAng = normalize(eyeVec + IN.lightVec.xyz); + float specular = saturate( dot(bumpNorm, halfAng) ) * IN.lightVec.w; + specular = pow(abs(specular), specularPower); + OUT.col += specularColor * specular; + + + + return OUT; +} + diff --git a/Templates/BaseGame/game/core/rendering/shaders/wavesV.hlsl b/Templates/BaseGame/game/core/rendering/shaders/wavesV.hlsl new file mode 100644 index 000000000..fccef9d25 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/wavesV.hlsl @@ -0,0 +1,90 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +#define IN_HLSL +#include "shdrConsts.h" +#include "hlslStructs.hlsl" + +//----------------------------------------------------------------------------- +// Constants +//----------------------------------------------------------------------------- + +struct Conn +{ + float4 HPOS : POSITION; + float2 TEX0 : TEXCOORD0; + float4 tangentToCube0 : TEXCOORD1; + float4 tangentToCube1 : TEXCOORD2; + float4 tangentToCube2 : TEXCOORD3; + float4 outLightVec : TEXCOORD4; + float3 pos : TEXCOORD5; + float3 outEyePos : TEXCOORD6; + +}; + + +uniform float4x4 modelview : register(VC_WORLD_PROJ); +uniform float3x3 cubeTrans : register(VC_CUBE_TRANS); +uniform float3 cubeEyePos : register(VC_CUBE_EYE_POS); +uniform float3 inLightVec : register(VC_LIGHT_DIR1); +uniform float3 eyePos : register(VC_EYE_POS); + +//----------------------------------------------------------------------------- +// Main +//----------------------------------------------------------------------------- +Conn main( VertexIn_PNTTTB In) +{ + Conn Out; + + Out.HPOS = mul(modelview, float4(In.pos,1.0)); + Out.TEX0 = In.uv0; + + + float3x3 objToTangentSpace; + objToTangentSpace[0] = In.T; + objToTangentSpace[1] = In.B; + objToTangentSpace[2] = In.normal; + + + Out.tangentToCube0.xyz = mul( objToTangentSpace, cubeTrans[0].xyz ); + Out.tangentToCube1.xyz = mul( objToTangentSpace, cubeTrans[1].xyz ); + Out.tangentToCube2.xyz = mul( objToTangentSpace, cubeTrans[2].xyz ); + + float3 pos = mul( cubeTrans, In.pos ).xyz; + float3 eye = cubeEyePos - pos; + normalize( eye ); + + Out.tangentToCube0.w = eye.x; + Out.tangentToCube1.w = eye.y; + Out.tangentToCube2.w = eye.z; + + Out.outLightVec.xyz = -inLightVec; + Out.outLightVec.xyz = mul(objToTangentSpace, Out.outLightVec); + Out.pos = mul(objToTangentSpace, In.pos.xyz / 100.0); + Out.outEyePos.xyz = mul(objToTangentSpace, eyePos.xyz / 100.0); + Out.outLightVec.w = step( 0.0, dot( -inLightVec, In.normal ) ); + + + return Out; +} + + diff --git a/Templates/BaseGame/game/core/rendering/shaders/wind.hlsl b/Templates/BaseGame/game/core/rendering/shaders/wind.hlsl new file mode 100644 index 000000000..b3fee7721 --- /dev/null +++ b/Templates/BaseGame/game/core/rendering/shaders/wind.hlsl @@ -0,0 +1,101 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// +// A tip of the hat.... +// +// The following wind effects were derived from the GPU Gems +// 3 chapter "Vegetation Procedural Animation and Shading in Crysis" +// by Tiago Sousa of Crytek. +// + +float4 smoothCurve( float4 x ) +{ + return x * x * ( 3.0 - 2.0 * x ); +} + +float4 triangleWave( float4 x ) +{ + return abs( frac( x + 0.5 ) * 2.0 - 1.0 ); +} + +float4 smoothTriangleWave( float4 x ) +{ + return smoothCurve( triangleWave( x ) ); +} + +float3 windTrunkBending( float3 vPos, float2 vWind, float fBendFactor ) +{ + // Smooth the bending factor and increase + // the near by height limit. + fBendFactor += 1.0; + fBendFactor *= fBendFactor; + fBendFactor = fBendFactor * fBendFactor - fBendFactor; + + // Displace the vert. + float3 vNewPos = vPos; + vNewPos.xy += vWind * fBendFactor; + + // Limit the length which makes the bend more + // spherical and prevents stretching. + float fLength = length( vPos ); + vPos = normalize( vNewPos ) * fLength; + + return vPos; +} + +float3 windBranchBending( float3 vPos, + float3 vNormal, + + float fTime, + float fWindSpeed, + + float fBranchPhase, + float fBranchAmp, + float fBranchAtten, + + float fDetailPhase, + float fDetailAmp, + float fDetailFreq, + + float fEdgeAtten ) +{ + float fVertPhase = dot( vPos, fDetailPhase + fBranchPhase ); + + float2 vWavesIn = fTime + float2( fVertPhase, fBranchPhase ); + + float4 vWaves = ( frac( vWavesIn.xxyy * + float4( 1.975, 0.793, 0.375, 0.193 ) ) * + 2.0 - 1.0 ) * fWindSpeed * fDetailFreq; + + vWaves = smoothTriangleWave( vWaves ); + + float2 vWavesSum = vWaves.xz + vWaves.yw; + + // We want the branches to bend both up and down. + vWavesSum.y = 1 - ( vWavesSum.y * 2 ); + + vPos += vWavesSum.xxy * float3( fEdgeAtten * fDetailAmp * vNormal.xy, + fBranchAtten * fBranchAmp ); + + return vPos; +} diff --git a/Templates/BaseGame/game/core/sfx/Core_SFX.cs b/Templates/BaseGame/game/core/sfx/Core_SFX.cs new file mode 100644 index 000000000..acd5c6e08 --- /dev/null +++ b/Templates/BaseGame/game/core/sfx/Core_SFX.cs @@ -0,0 +1,15 @@ + +function Core_SFX::onCreate(%this) +{ + exec("./scripts/audio.cs"); + exec("./scripts/audioData.cs"); + exec("./scripts/audioAmbience.cs"); + exec("./scripts/audioDescriptions.cs"); + exec("./scripts/audioEnvironments.cs"); + exec("./scripts/audioStates.cs"); + +} + +function Core_SFX::onDestroy(%this) +{ +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/sfx/Core_SFX.module b/Templates/BaseGame/game/core/sfx/Core_SFX.module new file mode 100644 index 000000000..855fe2a11 --- /dev/null +++ b/Templates/BaseGame/game/core/sfx/Core_SFX.module @@ -0,0 +1,9 @@ + + \ No newline at end of file diff --git a/Templates/BaseGame/game/core/sfx/scripts/audio.cs b/Templates/BaseGame/game/core/sfx/scripts/audio.cs new file mode 100644 index 000000000..a5932de8f --- /dev/null +++ b/Templates/BaseGame/game/core/sfx/scripts/audio.cs @@ -0,0 +1,436 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Source groups. +//----------------------------------------------------------------------------- + +singleton SFXDescription( AudioMaster ); +singleton SFXSource( AudioChannelMaster ) +{ + description = AudioMaster; +}; + +singleton SFXDescription( AudioChannel ) +{ + sourceGroup = AudioChannelMaster; +}; + +singleton SFXSource( AudioChannelDefault ) +{ + description = AudioChannel; +}; +singleton SFXSource( AudioChannelGui ) +{ + description = AudioChannel; +}; +singleton SFXSource( AudioChannelEffects ) +{ + description = AudioChannel; +}; +singleton SFXSource( AudioChannelMessages ) +{ + description = AudioChannel; +}; +singleton SFXSource( AudioChannelMusic ) +{ + description = AudioChannel; +}; + +// Set default playback states of the channels. + +AudioChannelMaster.play(); +AudioChannelDefault.play(); + +AudioChannelGui.play(); +AudioChannelMusic.play(); +AudioChannelMessages.play(); + +// Stop in-game effects channels. +AudioChannelEffects.stop(); + +//----------------------------------------------------------------------------- +// Master SFXDescriptions. +//----------------------------------------------------------------------------- + +// Master description for interface audio. +singleton SFXDescription( AudioGui ) +{ + volume = 1.0; + sourceGroup = AudioChannelGui; +}; + +// Master description for game effects audio. +singleton SFXDescription( AudioEffect ) +{ + volume = 1.0; + sourceGroup = AudioChannelEffects; +}; + +// Master description for audio in notifications. +singleton SFXDescription( AudioMessage ) +{ + volume = 1.0; + sourceGroup = AudioChannelMessages; +}; + +// Master description for music. +singleton SFXDescription( AudioMusic ) +{ + volume = 1.0; + sourceGroup = AudioChannelMusic; +}; + +//----------------------------------------------------------------------------- +// SFX Functions. +//----------------------------------------------------------------------------- + +/// This initializes the sound system device from +/// the defaults in the $pref::SFX:: globals. +function sfxStartup() +{ + echo( "\nsfxStartup..." ); + + // If we have a provider set, try initialize a device now. + + if( $pref::SFX::provider !$= "" ) + { + if( sfxInit() ) + return; + else + { + // Force auto-detection. + $pref::SFX::autoDetect = true; + } + } + + // If enabled autodetect a safe device. + + if( ( !isDefined( "$pref::SFX::autoDetect" ) || $pref::SFX::autoDetect ) && + sfxAutodetect() ) + return; + + // Failure. + + error( " Failed to initialize device!\n\n" ); + + $pref::SFX::provider = ""; + $pref::SFX::device = ""; + + return; +} + + +/// This initializes the sound system device from +/// the defaults in the $pref::SFX:: globals. +function sfxInit() +{ + // If already initialized, shut down the current device first. + + if( sfxGetDeviceInfo() !$= "" ) + sfxShutdown(); + + // Start it up! + %maxBuffers = $pref::SFX::useHardware ? -1 : $pref::SFX::maxSoftwareBuffers; + if ( !sfxCreateDevice( $pref::SFX::provider, $pref::SFX::device, $pref::SFX::useHardware, %maxBuffers ) ) + return false; + + // This returns a tab seperated string with + // the initialized system info. + %info = sfxGetDeviceInfo(); + $pref::SFX::provider = getField( %info, 0 ); + $pref::SFX::device = getField( %info, 1 ); + $pref::SFX::useHardware = getField( %info, 2 ); + %useHardware = $pref::SFX::useHardware ? "Yes" : "No"; + %maxBuffers = getField( %info, 3 ); + + echo( " Provider: " @ $pref::SFX::provider ); + echo( " Device: " @ $pref::SFX::device ); + echo( " Hardware: " @ %useHardware ); + echo( " Max Buffers: " @ %maxBuffers ); + echo( " " ); + + if( isDefined( "$pref::SFX::distanceModel" ) ) + sfxSetDistanceModel( $pref::SFX::distanceModel ); + if( isDefined( "$pref::SFX::dopplerFactor" ) ) + sfxSetDopplerFactor( $pref::SFX::dopplerFactor ); + if( isDefined( "$pref::SFX::rolloffFactor" ) ) + sfxSetRolloffFactor( $pref::SFX::rolloffFactor ); + + // Restore master volume. + + sfxSetMasterVolume( $pref::SFX::masterVolume ); + + // Restore channel volumes. + + for( %channel = 0; %channel <= 8; %channel ++ ) + sfxSetChannelVolume( %channel, $pref::SFX::channelVolume[ %channel ] ); + + return true; +} + + +/// Destroys the current sound system device. +function sfxShutdown() +{ + // Store volume prefs. + + $pref::SFX::masterVolume = sfxGetMasterVolume(); + + for( %channel = 0; %channel <= 8; %channel ++ ) + $pref::SFX::channelVolume[ %channel ] = sfxGetChannelVolume( %channel ); + + // We're assuming here that a null info + // string means that no device is loaded. + if( sfxGetDeviceInfo() $= "" ) + return; + + sfxDeleteDevice(); +} + + +/// Determines which of the two SFX providers is preferable. +function sfxCompareProvider( %providerA, %providerB ) +{ + if( %providerA $= %providerB ) + return 0; + + switch$( %providerA ) + { + // Always prefer FMOD over anything else. + case "FMOD": + return 1; + + // Prefer OpenAL over anything but FMOD. + case "OpenAL": + if( %providerB $= "FMOD" ) + return -1; + else + return 1; + + // choose XAudio over DirectSound + case "XAudio": + if( %providerB $= "FMOD" || %providerB $= "OpenAL" ) + return -1; + else + return 0; + + case "DirectSound": + if( %providerB !$= "FMOD" && %providerB !$= "OpenAL" && %providerB !$= "XAudio" ) + return 1; + else + return -1; + + default: + return -1; + } +} + + +/// Try to detect and initalize the best SFX device available. +function sfxAutodetect() +{ + // Get all the available devices. + + %devices = sfxGetAvailableDevices(); + + // Collect and sort the devices by preferentiality. + + %deviceTrySequence = new ArrayObject(); + %bestMatch = -1; + %count = getRecordCount( %devices ); + for( %i = 0; %i < %count; %i ++ ) + { + %info = getRecord( %devices, %i ); + %provider = getField( %info, 0 ); + + %deviceTrySequence.push_back( %provider, %info ); + } + + %deviceTrySequence.sortfkd( "sfxCompareProvider" ); + + // Try the devices in order. + + %count = %deviceTrySequence.count(); + for( %i = 0; %i < %count; %i ++ ) + { + %provider = %deviceTrySequence.getKey( %i ); + %info = %deviceTrySequence.getValue( %i ); + + $pref::SFX::provider = %provider; + $pref::SFX::device = getField( %info, 1 ); + $pref::SFX::useHardware = getField( %info, 2 ); + + // By default we've decided to avoid hardware devices as + // they are buggy and prone to problems. + $pref::SFX::useHardware = false; + + if( sfxInit() ) + { + $pref::SFX::autoDetect = false; + %deviceTrySequence.delete(); + return true; + } + } + + // Found no suitable device. + + error( "sfxAutodetect - Could not initialize a valid SFX device." ); + + $pref::SFX::provider = ""; + $pref::SFX::device = ""; + $pref::SFX::useHardware = ""; + + %deviceTrySequence.delete(); + + return false; +} + + +//----------------------------------------------------------------------------- +// Backwards-compatibility with old channel system. +//----------------------------------------------------------------------------- + +// Volume channel IDs for backwards-compatibility. + +$GuiAudioType = 1; // Interface. +$SimAudioType = 2; // Game. +$MessageAudioType = 3; // Notifications. +$MusicAudioType = 4; // Music. + +$AudioChannels[ 0 ] = AudioChannelDefault; +$AudioChannels[ $GuiAudioType ] = AudioChannelGui; +$AudioChannels[ $SimAudioType ] = AudioChannelEffects; +$AudioChannels[ $MessageAudioType ] = AudioChannelMessages; +$AudioChannels[ $MusicAudioType ] = AudioChannelMusic; + +function sfxOldChannelToGroup( %channel ) +{ + return $AudioChannels[ %channel ]; +} + +function sfxGroupToOldChannel( %group ) +{ + %id = %group.getId(); + for( %i = 0;; %i ++ ) + if( !isObject( $AudioChannels[ %i ] ) ) + return -1; + else if( $AudioChannels[ %i ].getId() == %id ) + return %i; + + return -1; +} + +function sfxSetMasterVolume( %volume ) +{ + AudioChannelMaster.setVolume( %volume ); +} + +function sfxGetMasterVolume( %volume ) +{ + return AudioChannelMaster.getVolume(); +} + +function sfxStopAll( %channel ) +{ + // Don't stop channel itself since that isn't quite what the function + // here intends. + + %channel = sfxOldChannelToGroup( %channel ); + if (isObject(%channel)) + { + foreach( %source in %channel ) + %source.stop(); + } +} + +function sfxGetChannelVolume( %channel ) +{ + %obj = sfxOldChannelToGroup( %channel ); + if( isObject( %obj ) ) + return %obj.getVolume(); +} + +function sfxSetChannelVolume( %channel, %volume ) +{ + %obj = sfxOldChannelToGroup( %channel ); + if( isObject( %obj ) ) + %obj.setVolume( %volume ); +} + +/*singleton SimSet( SFXPausedSet ); + + +/// Pauses the playback of active sound sources. +/// +/// @param %channels An optional word list of channel indices or an empty +/// string to pause sources on all channels. +/// @param %pauseSet An optional SimSet which is filled with the paused +/// sources. If not specified the global SfxSourceGroup +/// is used. +/// +/// @deprecated +/// +function sfxPause( %channels, %pauseSet ) +{ + // Did we get a set to populate? + if ( !isObject( %pauseSet ) ) + %pauseSet = SFXPausedSet; + + %count = SFXSourceSet.getCount(); + for ( %i = 0; %i < %count; %i++ ) + { + %source = SFXSourceSet.getObject( %i ); + + %channel = sfxGroupToOldChannel( %source.getGroup() ); + if( %channels $= "" || findWord( %channels, %channel ) != -1 ) + { + %source.pause(); + %pauseSet.add( %source ); + } + } +} + + +/// Resumes the playback of paused sound sources. +/// +/// @param %pauseSet An optional SimSet which contains the paused sound +/// sources to be resumed. If not specified the global +/// SfxSourceGroup is used. +/// @deprecated +/// +function sfxResume( %pauseSet ) +{ + if ( !isObject( %pauseSet ) ) + %pauseSet = SFXPausedSet; + + %count = %pauseSet.getCount(); + for ( %i = 0; %i < %count; %i++ ) + { + %source = %pauseSet.getObject( %i ); + %source.play(); + } + + // Clear our pause set... the caller is left + // to clear his own if he passed one. + %pauseSet.clear(); +}*/ diff --git a/Templates/BaseGame/game/core/sfx/scripts/audioAmbience.cs b/Templates/BaseGame/game/core/sfx/scripts/audioAmbience.cs new file mode 100644 index 000000000..8c2bf270c --- /dev/null +++ b/Templates/BaseGame/game/core/sfx/scripts/audioAmbience.cs @@ -0,0 +1,44 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +singleton SFXAmbience( AudioAmbienceDefault ) +{ + environment = AudioEnvOff; +}; + +singleton SFXAmbience( AudioAmbienceOutside ) +{ + environment = AudioEnvPlain; + states[ 0 ] = AudioLocationOutside; +}; + +singleton SFXAmbience( AudioAmbienceInside ) +{ + environment = AudioEnvRoom; + states[ 0 ] = AudioLocationInside; +}; + +singleton SFXAmbience( AudioAmbienceUnderwater ) +{ + environment = AudioEnvUnderwater; + states[ 0 ] = AudioLocationUnderwater; +}; diff --git a/Templates/BaseGame/game/core/sfx/scripts/audioData.cs b/Templates/BaseGame/game/core/sfx/scripts/audioData.cs new file mode 100644 index 000000000..8584ce50e --- /dev/null +++ b/Templates/BaseGame/game/core/sfx/scripts/audioData.cs @@ -0,0 +1,42 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Game specific audio descriptions. Always declare SFXDescription's (the type of sound) +// before SFXProfile's (the sound itself) when creating new ones + +singleton SFXDescription(BulletFireDesc : AudioEffect ) +{ + isLooping = false; + is3D = true; + ReferenceDistance = 10.0; + MaxDistance = 60.0; +}; + +singleton SFXDescription(BulletImpactDesc : AudioEffect ) +{ + isLooping = false; + is3D = true; + ReferenceDistance = 10.0; + MaxDistance = 30.0; + volume = 0.4; + pitch = 1.4; +}; diff --git a/Templates/BaseGame/game/core/sfx/scripts/audioDescriptions.cs b/Templates/BaseGame/game/core/sfx/scripts/audioDescriptions.cs new file mode 100644 index 000000000..d682461cf --- /dev/null +++ b/Templates/BaseGame/game/core/sfx/scripts/audioDescriptions.cs @@ -0,0 +1,143 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Always declare SFXDescription's (the type of sound) before SFXProfile's (the +// sound itself) when creating new ones + +//----------------------------------------------------------------------------- +// 3D Sounds +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Single shot sounds +//----------------------------------------------------------------------------- + +singleton SFXDescription( AudioDefault3D : AudioEffect ) +{ + is3D = true; + ReferenceDistance = 20.0; + MaxDistance = 100.0; +}; + +singleton SFXDescription( AudioSoft3D : AudioEffect ) +{ + is3D = true; + ReferenceDistance = 20.0; + MaxDistance = 100.0; + volume = 0.4; +}; + +singleton SFXDescription( AudioClose3D : AudioEffect ) +{ + is3D = true; + ReferenceDistance = 10.0; + MaxDistance = 60.0; +}; + +singleton SFXDescription( AudioClosest3D : AudioEffect ) +{ + is3D = true; + ReferenceDistance = 5.0; + MaxDistance = 10.0; +}; + +//----------------------------------------------------------------------------- +// Looping sounds +//----------------------------------------------------------------------------- + +singleton SFXDescription( AudioDefaultLoop3D : AudioEffect ) +{ + isLooping = true; + is3D = true; + ReferenceDistance = 20.0; + MaxDistance = 100.0; +}; + +singleton SFXDescription( AudioCloseLoop3D : AudioEffect ) +{ + isLooping = true; + is3D = true; + ReferenceDistance = 18.0; + MaxDistance = 25.0; +}; + +singleton SFXDescription( AudioClosestLoop3D : AudioEffect ) +{ + isLooping = true; + is3D = true; + ReferenceDistance = 5.0; + MaxDistance = 10.0; +}; + +//----------------------------------------------------------------------------- +// 2d sounds +//----------------------------------------------------------------------------- + +// Used for non-looping environmental sounds (like power on, power off) +singleton SFXDescription( Audio2D : AudioEffect ) +{ + isLooping = false; +}; + +// Used for Looping Environmental Sounds +singleton SFXDescription( AudioLoop2D : AudioEffect ) +{ + isLooping = true; +}; + +singleton SFXDescription( AudioStream2D : AudioEffect ) +{ + isStreaming = true; +}; +singleton SFXDescription( AudioStreamLoop2D : AudioEffect ) +{ + isLooping = true; + isStreaming = true; +}; + +//----------------------------------------------------------------------------- +// Music +//----------------------------------------------------------------------------- + +singleton SFXDescription( AudioMusic2D : AudioMusic ) +{ + isStreaming = true; +}; + +singleton SFXDescription( AudioMusicLoop2D : AudioMusic ) +{ + isLooping = true; + isStreaming = true; +}; + +singleton SFXDescription( AudioMusic3D : AudioMusic ) +{ + isStreaming = true; + is3D = true; +}; + +singleton SFXDescription( AudioMusicLoop3D : AudioMusic ) +{ + isStreaming = true; + is3D = true; + isLooping = true; +}; diff --git a/Templates/BaseGame/game/core/sfx/scripts/audioEnvironments.cs b/Templates/BaseGame/game/core/sfx/scripts/audioEnvironments.cs new file mode 100644 index 000000000..671825b6b --- /dev/null +++ b/Templates/BaseGame/game/core/sfx/scripts/audioEnvironments.cs @@ -0,0 +1,916 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Reverb environment presets. +// +// For customized presets, best derive from one of these presets. + +singleton SFXEnvironment( AudioEnvOff ) +{ + envSize = "7.5"; + envDiffusion = "1.0"; + room = "-10000"; + roomHF = "-10000"; + roomLF = "0"; + decayTime = "1.0"; + decayHFRatio = "1.0"; + decayLFRatio = "1.0"; + reflections = "-2602"; + reflectionsDelay = "0.007"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "200"; + reverbDelay = "0.011"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "0.0"; + density = "0.0"; + flags = 0x33; +}; + +singleton SFXEnvironment( AudioEnvGeneric ) +{ + envSize = "7.5"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-100"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.83"; + decayLFRatio = "1.0"; + reflections = "-2602"; + reflectionsDelay = "0.007"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "200"; + reverbDelay = "0.011"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvRoom ) +{ + envSize = "1.9"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-454"; + roomLF = "0"; + decayTime = "0.4"; + decayHFRatio = "0.83"; + decayLFRatio = "1.0"; + reflections = "-1646"; + reflectionsDelay = "0.002"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "53"; + reverbDelay = "0.003"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvPaddedCell ) +{ + envSize = "1.4"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-6000"; + roomLF = "0"; + decayTime = "0.17"; + decayHFRatio = "0.1"; + decayLFRatio = "1.0"; + reflections = "-1204"; + reflectionsDelay = "0.001"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "207"; + reverbDelay = "0.002"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvBathroom ) +{ + envSize = "1.4"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-1200"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.54"; + decayLFRatio = "1.0"; + reflections = "-370"; + reflectionsDelay = "0.007"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "1030"; + reverbDelay = "0.011"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "60.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvLivingRoom ) +{ + envSize = "2.5"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-6000"; + roomLF = "0"; + decayTime = "0.5"; + decayHFRatio = "0.1"; + decayLFRatio = "1.0"; + reflections = "-1376"; + reflectionsDelay = "0.003"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-1104"; + reverbDelay = "0.004"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvStoneRoom ) +{ + envSize = "11.6"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "300"; + roomLF = "0"; + decayTime = "2.31"; + decayHFRatio = "0.64"; + decayLFRatio = "1.0"; + reflections = "-711"; + reflectionsDelay = "0.012"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "83"; + reverbDelay = "0.017"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "-5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvAuditorium ) +{ + envSize = "21.6"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-476"; + roomLF = "0"; + decayTime = "4.32"; + decayHFRatio = "0.59"; + decayLFRatio = "1.0"; + reflections = "1"; + reflectionsDelay = "0.02"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-289"; + reverbDelay = "0.03"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvConcertHall ) +{ + envSize = "19.6"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-500"; + roomLF = "0"; + decayTime = "3.92"; + decayHFRatio = "0.7"; + decayLFRatio = "1.0"; + reflections = "-1230"; + reflectionsDelay = "0.02"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-2"; + reverbDelay = "0.029"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvCave ) +{ + envSize = "14.6"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "0"; + roomLF = "0"; + decayTime = "2.91"; + decayHFRatio = "1.3"; + decayLFRatio = "1.0"; + reflections = "-602"; + reflectionsDelay = "0.015"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-302"; + reverbDelay = "0.022"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x1f; +}; + +singleton SFXEnvironment( AudioEnvArena ) +{ + envSize = "36.2f"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-698"; + roomLF = "0"; + decayTime = "7.24"; + decayHFRatio = "0.33"; + decayLFRatio = "1.0"; + reflections = "-1166"; + reflectionsDelay = "0.02"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "16"; + reverbDelay = "0.03"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvHangar ) +{ + envSize = "50.3"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-1000"; + roomLF = "0"; + decayTime = "10.05"; + decayHFRatio = "0.23"; + decayLFRatio = "1.0"; + reflections = "-602"; + reflectionsDelay = "0.02"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "198"; + reverbDelay = "0.03"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvCarpettedHallway ) +{ + envSize = "1.9"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-4000"; + roomLF = "0"; + decayTime = "0.3"; + decayHFRatio = "0.1"; + decayLFRatio = "1.0"; + reflections = "-1831"; + reflectionsDelay = "0.002"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-1630"; + reverbDelay = "0.03"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvHallway ) +{ + envSize = "1.8"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-300"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.59"; + decayLFRatio = "1.0"; + reflections = "-1219"; + reflectionsDelay = "0.007"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "441"; + reverbDelay = "0.011"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvStoneCorridor ) +{ + envSize = "13.5"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-237"; + roomLF = "0"; + decayTime = "2.7"; + decayHFRatio = "0.79"; + decayLFRatio = "1.0"; + reflections = "-1214"; + reflectionsDelay = "0.013"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "395"; + reverbDelay = "0.02"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvAlley ) +{ + envSize = "7.5"; + envDiffusion = "0.3"; + room = "-1000"; + roomHF = "-270"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.86"; + decayLFRatio = "1.0"; + reflections = "-1204"; + reflectionsDelay = "0.007"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-4"; + reverbDelay = "0.011"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.125"; + echoDepth = "0.95"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvForest ) +{ + envSize = "38.0"; + envDiffusion = "0.3"; + room = "-1000"; + roomHF = "-3300"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.54"; + decayLFRatio = "1.0"; + reflections = "-2560"; + reflectionsDelay = "0.162"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-229"; + reverbDelay = "0.088"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.125"; + echoDepth = "1.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "79.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvCity ) +{ + envSize = "7.5"; + envDiffusion = "0.5"; + room = "-1000"; + roomHF = "-800"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.67"; + decayLFRatio = "1.0"; + reflections = "-2273"; + reflectionsDelay = "0.007"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-1691"; + reverbDelay = "0.011"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "50.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvMountains ) +{ + envSize = "100.0"; + envDiffusion = "0.27"; + room = "-1000"; + roomHF = "-2500"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.21"; + decayLFRatio = "1.0"; + reflections = "-2780"; + reflectionsDelay = "0.3"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-1434"; + reverbDelay = "0.1"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "1.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "27.0"; + density = "100.0"; + flags = 0x1f; +}; + +singleton SFXEnvironment( AudioEnvQuary ) +{ + envSize = "17.5"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-1000"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.83"; + decayLFRatio = "1.0"; + reflections = "-10000"; + reflectionsDelay = "0.061"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "500"; + reverbDelay = "0.025"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.125"; + echoDepth = "0.7"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvPlain ) +{ + envSize = "42.5"; + envDiffusion = "0.21"; + room = "-1000"; + roomHF = "-2000"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.5"; + decayLFRatio = "1.0"; + reflections = "-2466"; + reflectionsDelay = "0.179"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-1926"; + reverbDelay = "0.1"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "1.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "21.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvParkingLot ) +{ + envSize = "8.3"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "0"; + roomLF = "0"; + decayTime = "1.65"; + decayHFRatio = "1.5"; + decayLFRatio = "1.0"; + reflections = "-1363"; + reflectionsDelay = "0.008"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-1153"; + reverbDelay = "0.012"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x1f; +}; + +singleton SFXEnvironment( AudioEnvSewerPipe ) +{ + envSize = "1.7"; + envDiffusion = "0.8"; + room = "-1000"; + roomHF = "-1000"; + roomLF = "0"; + decayTime = "2.81"; + decayHFRatio = "0.14"; + decayLFRatio = "1.0"; + reflections = "429"; + reflectionsDelay = "0.014"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "1023"; + reverbDelay = "0.21"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "0.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "80.0"; + density = "60.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvUnderwater ) +{ + envSize = "1.8"; + envDiffusion = "1.0"; + room = "-1000"; + roomHF = "-4000"; + roomLF = "0"; + decayTime = "1.49"; + decayHFRatio = "0.1"; + decayLFRatio = "1.0"; + reflections = "-449"; + reflectionsDelay = "0.007"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "1700"; + reverbDelay = "0.011"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "1.18"; + modulationDepth = "0.348"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x3f; +}; + +singleton SFXEnvironment( AudioEnvDrugged ) +{ + envSize = "1.9"; + envDiffusion = "0.5"; + room = "-1000"; + roomHF = "0"; + roomLF = "0"; + decayTime = "8.39"; + decayHFRatio = "1.39"; + decayLFRatio = "1.0"; + reflections = "-115"; + reflectionsDelay = "0.002"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "985"; + reverbDelay = "0.03"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "0.25"; + modulationDepth = "1.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x1f; +}; + +singleton SFXEnvironment( AudioEnvDizzy ) +{ + envSize = "1.8"; + envDiffusion = "0.6"; + room = "-1000.0"; + roomHF = "-400"; + roomLF = "0"; + decayTime = "17.23"; + decayHFRatio = "0.56"; + decayLFRatio = "1.0"; + reflections = "-1713"; + reflectionsDelay = "0.02"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "-613"; + reverbDelay = "0.03"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "1.0"; + modulationTime = "0.81"; + modulationDepth = "0.31"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x1f; +}; + +singleton SFXEnvironment( AudioEnvPsychotic ) +{ + envSize = "1.0"; + envDiffusion = "0.5"; + room = "-1000"; + roomHF = "-151"; + roomLF = "0"; + decayTime = "7.56"; + decayHFRatio = "0.91"; + decayLFRatio = "1.0"; + reflections = "-626"; + reflectionsDelay = "0.02"; + reflectionsPan[ 0 ] = "0.0"; + reflectionsPan[ 1 ] = "0.0"; + reflectionsPan[ 2 ] = "0.0"; + reverb = "774"; + reverbDelay = "0.03"; + reverbPan[ 0 ] = "0.0"; + reverbPan[ 1 ] = "0.0"; + reverbPan[ 2 ] = "0.0"; + echoTime = "0.25"; + echoDepth = "0.0"; + modulationTime = "4.0"; + modulationDepth = "1.0"; + airAbsorptionHF = "-5.0"; + HFReference = "5000.0"; + LFReference = "250.0"; + roomRolloffFactor = "0.0"; + diffusion = "100.0"; + density = "100.0"; + flags = 0x1f; +}; diff --git a/Templates/BaseGame/game/core/sfx/scripts/audioStates.cs b/Templates/BaseGame/game/core/sfx/scripts/audioStates.cs new file mode 100644 index 000000000..3ab55cf78 --- /dev/null +++ b/Templates/BaseGame/game/core/sfx/scripts/audioStates.cs @@ -0,0 +1,158 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Some state presets. + + +/// Return the first active SFXState in the given SimSet/SimGroup. +function sfxGetActiveStateInGroup( %group ) +{ + %count = %group.getCount(); + for( %i = 0; %i < %count; %i ++ ) + { + %obj = %group.getObject( %i ); + if( !%obj.isMemberOfClass( "SFXState" ) ) + continue; + + if( %obj.isActive() ) + return %obj; + } + + return 0; +} + + +//----------------------------------------------------------------------------- +// Special audio state that will always and only be active when no other +// state is active. Useful for letting slots apply specifically when no +// other slot in a list applies. + +singleton SFXState( AudioStateNone ) {}; + +AudioStateNone.activate(); + +function SFXState::onActivate( %this ) +{ + if( %this.getId() != AudioStateNone.getId() ) + AudioStateNone.disable(); +} + +function SFXState::onDeactivate( %this ) +{ + if( %this.getId() != AudioStateNone.getId() ) + AudioStateNone.enable(); +} + +//----------------------------------------------------------------------------- +// AudioStateExclusive class. +// +// Automatically deactivates sibling SFXStates in its parent SimGroup +// when activated. + +function AudioStateExclusive::onActivate( %this ) +{ + Parent::onActivate( %this ); + + %group = %this.parentGroup; + %count = %group.getCount(); + + for( %i = 0; %i < %count; %i ++ ) + { + %obj = %group.getObject( %i ); + + if( %obj != %this && %obj.isMemberOfClass( "SFXState" ) && %obj.isActive() ) + %obj.deactivate(); + } +} + +//----------------------------------------------------------------------------- +// Location-dependent states. + +singleton SimGroup( AudioLocation ); + +/// State when the listener is outside. +singleton SFXState( AudioLocationOutside ) +{ + parentGroup = AudioLocation; + className = "AudioStateExclusive"; +}; + +/// State when the listener is submerged. +singleton SFXState( AudioLocationUnderwater ) +{ + parentGroup = AudioLocation; + className = "AudioStateExclusive"; +}; + +/// State when the listener is indoors. +singleton SFXState( AudioLocationInside ) +{ + parentGroup = AudioLocation; + className = "AudioStateExclusive"; +}; + +/// Return the currently active SFXState in AudioLocation. +function sfxGetLocation() +{ + return sfxGetActiveStateInGroup( AudioLocation ); +} + +//----------------------------------------------------------------------------- +// Mood-dependent states. + +singleton SimGroup( AudioMood ); + +singleton SFXState( AudioMoodNeutral ) +{ + parentGroup = AudioMood; + className = "AudioStateExclusive"; +}; + +singleton SFXState( AudioMoodAggressive ) +{ + parentGroup = AudioMood; + className = "AudioStateExclusive"; +}; + +singleton SFXState( AudioMoodTense ) +{ + parentGroup = AudioMood; + className = "AudioStateExclusive"; +}; + +singleton SFXState( AudioMoodVictory ) +{ + parentGroup = AudioMood; + className = "AudioStateExclusive"; +}; + +singleton SFXState( AudioMoodCalm ) +{ + parentGroup = AudioMood; + className = "AudioStateExclusive"; +}; + +/// Return the currently active SFXState in AudioMood. +function sfxGetMood() +{ + return sfxGetActiveStateInGroup( AudioMood ); +} diff --git a/Templates/BaseGame/game/core/utility/Core_Utility.cs b/Templates/BaseGame/game/core/utility/Core_Utility.cs new file mode 100644 index 000000000..d412f3544 --- /dev/null +++ b/Templates/BaseGame/game/core/utility/Core_Utility.cs @@ -0,0 +1,11 @@ + +function Core_Utility::onCreate(%this) +{ + exec("./scripts/parseArgs.cs"); + exec("./scripts/globals.cs"); + exec("./scripts/helperFunctions.cs"); +} + +function Core_Utility::onDestroy(%this) +{ +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/utility/Core_Utility.module b/Templates/BaseGame/game/core/utility/Core_Utility.module new file mode 100644 index 000000000..cb6539040 --- /dev/null +++ b/Templates/BaseGame/game/core/utility/Core_Utility.module @@ -0,0 +1,9 @@ + + \ No newline at end of file diff --git a/Templates/BaseGame/game/core/utility/scripts/globals.cs b/Templates/BaseGame/game/core/utility/scripts/globals.cs new file mode 100644 index 000000000..fcf52390a --- /dev/null +++ b/Templates/BaseGame/game/core/utility/scripts/globals.cs @@ -0,0 +1,102 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// ---------------------------------------------------------------------------- +// DInput keyboard, mouse, and joystick prefs +// ---------------------------------------------------------------------------- + +$pref::Input::MouseEnabled = 1; +$pref::Input::LinkMouseSensitivity = 1; +$pref::Input::KeyboardEnabled = 1; +$pref::Input::KeyboardTurnSpeed = 0.1; +$pref::Input::JoystickEnabled = 0; + +// ---------------------------------------------------------------------------- +// Video Preferences +// ---------------------------------------------------------------------------- + +// Set directory paths for various data or default images. +$pref::Video::ProfilePath = "core/rendering/scripts/gfxprofile"; +/*$pref::Video::missingTexturePath = "core/images/missingTexture.png"; +$pref::Video::unavailableTexturePath = "core/images/unavailable.png"; +$pref::Video::warningTexturePath = "core/images/warnMat.dds";*/ + +$pref::Video::disableVerticalSync = 1; +$pref::Video::mode = "800 600 false 32 60 4"; +$pref::Video::defaultFenceCount = 0; + +// This disables the hardware FSAA/MSAA so that we depend completely on the FXAA +// post effect which works on all cards and in deferred mode. Note that the new +// Intel Hybrid graphics on laptops will fail to initialize when hardware AA is +// enabled... so you've been warned. +$pref::Video::disableHardwareAA = true; + +$pref::Video::disableNormalmapping = false; +$pref::Video::disablePixSpecular = false; +$pref::Video::disableCubemapping = false; +$pref::Video::disableParallaxMapping = false; + +// The number of mipmap levels to drop on loaded textures to reduce video memory +// usage. It will skip any textures that have been defined as not allowing down +// scaling. +$pref::Video::textureReductionLevel = 0; + +$pref::Video::defaultAnisotropy = 1; +//$pref::Video::Gamma = 1.0; + +/// AutoDetect graphics quality levels the next startup. +$pref::Video::autoDetect = 1; + +// ---------------------------------------------------------------------------- +// Shader stuff +// ---------------------------------------------------------------------------- + +// This is the path used by ShaderGen to cache procedural shaders. If left +// blank ShaderGen will only cache shaders to memory and not to disk. +$shaderGen::cachePath = "data/shaderCache"; + +// Uncomment to disable ShaderGen, useful when debugging +//$ShaderGen::GenNewShaders = false; + +// Uncomment to dump disassembly for any shader that is compiled to disk. These +// will appear as shadername_dis.txt in the same path as the shader file. +//$gfx::disassembleAllShaders = true; + +// ---------------------------------------------------------------------------- +// Lighting and shadowing +// ---------------------------------------------------------------------------- + +// Uncomment to enable AdvancedLighting on the Mac (T3D 2009 Beta 3) +//$pref::machax::enableAdvancedLighting = true; + +$sceneLighting::cacheSize = 20000; +$sceneLighting::purgeMethod = "lastCreated"; +$sceneLighting::cacheLighting = 1; + +$pref::Shadows::textureScalar = 1.0; +$pref::Shadows::disable = false; + +// Sets the shadow filtering mode. +// None - Disables filtering. +// SoftShadow - Does a simple soft shadow +// SoftShadowHighQuality +$pref::Shadows::filterMode = "SoftShadow"; diff --git a/Templates/BaseGame/game/core/utility/scripts/helperFunctions.cs b/Templates/BaseGame/game/core/utility/scripts/helperFunctions.cs new file mode 100644 index 000000000..8abe3e6e6 --- /dev/null +++ b/Templates/BaseGame/game/core/utility/scripts/helperFunctions.cs @@ -0,0 +1,1158 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + + +//------------------------------------------------------------------------------ +// Check if a script file exists, compiled or not. +function isScriptFile(%path) +{ + if( isFile(%path @ ".dso") || isFile(%path) ) + return true; + + return false; +} + +function loadMaterials() +{ + // Load any materials files for which we only have DSOs. + + for( %file = findFirstFile( "*/materials.cs.dso" ); + %file !$= ""; + %file = findNextFile( "*/materials.cs.dso" )) + { + // Only execute, if we don't have the source file. + %csFileName = getSubStr( %file, 0, strlen( %file ) - 4 ); + if( !isFile( %csFileName ) ) + exec( %csFileName ); + } + + // Load all source material files. + + for( %file = findFirstFile( "*/materials.cs" ); + %file !$= ""; + %file = findNextFile( "*/materials.cs" )) + { + exec( %file ); + } + + // Load all materials created by the material editor if + // the folder exists + if( IsDirectory( "materialEditor" ) ) + { + for( %file = findFirstFile( "materialEditor/*.cs.dso" ); + %file !$= ""; + %file = findNextFile( "materialEditor/*.cs.dso" )) + { + // Only execute, if we don't have the source file. + %csFileName = getSubStr( %file, 0, strlen( %file ) - 4 ); + if( !isFile( %csFileName ) ) + exec( %csFileName ); + } + + for( %file = findFirstFile( "materialEditor/*.cs" ); + %file !$= ""; + %file = findNextFile( "materialEditor/*.cs" )) + { + exec( %file ); + } + } +} + +function reloadMaterials() +{ + reloadTextures(); + loadMaterials(); + reInitMaterials(); +} + +function loadDatablockFiles( %datablockFiles, %recurse ) +{ + if ( %recurse ) + { + recursiveLoadDatablockFiles( %datablockFiles, 9999 ); + return; + } + + %count = %datablockFiles.count(); + for ( %i=0; %i < %count; %i++ ) + { + %file = %datablockFiles.getKey( %i ); + if ( !isFile(%file @ ".dso") && !isFile(%file) ) + continue; + + exec( %file ); + } + + // Destroy the incoming list. + //%datablockFiles.delete(); +} + +function recursiveLoadDatablockFiles( %datablockFiles, %previousErrors ) +{ + %reloadDatablockFiles = new ArrayObject(); + + // Keep track of the number of datablocks that + // failed during this pass. + %failedDatablocks = 0; + + // Try re-executing the list of datablock files. + %count = %datablockFiles.count(); + for ( %i=0; %i < %count; %i++ ) + { + %file = %datablockFiles.getKey( %i ); + if ( !isFile(%file @ ".dso") && !isFile(%file) ) + continue; + + // Start counting copy constructor creation errors. + $Con::objectCopyFailures = 0; + + exec( %file ); + + // If errors occured then store this file for re-exec later. + if ( $Con::objectCopyFailures > 0 ) + { + %reloadDatablockFiles.add( %file ); + %failedDatablocks = %failedDatablocks + $Con::objectCopyFailures; + } + } + + // Clear the object copy failure counter so that + // we get console error messages again. + $Con::objectCopyFailures = -1; + + // Delete the old incoming list... we're done with it. + //%datablockFiles.delete(); + + // If we still have datablocks to retry. + %newCount = %reloadDatablockFiles.count(); + if ( %newCount > 0 ) + { + // If the datablock failures have not been reduced + // from the last pass then we must have a real syntax + // error and not just a bad dependancy. + if ( %previousErrors > %failedDatablocks ) + recursiveLoadDatablockFiles( %reloadDatablockFiles, %failedDatablocks ); + + else + { + // Since we must have real syntax errors do one + // last normal exec to output error messages. + loadDatablockFiles( %reloadDatablockFiles, false ); + } + + return; + } + + // Cleanup the empty reload list. + %reloadDatablockFiles.delete(); +} + +function getUserPath() +{ + %temp = getUserHomeDirectory(); + echo(%temp); + if(!isDirectory(%temp)) + { + %temp = getUserDataDirectory(); + echo(%temp); + if(!isDirectory(%temp)) + { + %userPath = "data"; + } + else + { + //put it in appdata/roaming + %userPath = %temp @ "/" @ $appName; + } + } + else + { + //put it in user/documents + %userPath = %temp @ "/" @ $appName; + } + return %userPath; +} + +function getPrefpath() +{ + $prefPath = getUserPath() @ "/preferences"; + return $prefPath; +} + +function updateTSShapeLoadProgress(%progress, %msg) +{ + // Check if the loading GUI is visible and use that instead of the + // separate import progress GUI if possible + /* if ( isObject(LoadingGui) && LoadingGui.isAwake() ) + { + // Save/Restore load progress at the start/end of the import process + if ( %progress == 0 ) + { + ColladaImportProgress.savedProgress = LoadingProgress.getValue(); + ColladaImportProgress.savedText = LoadingProgressTxt.getValue(); + + ColladaImportProgress.msgPrefix = "Importing " @ %msg; + %msg = "Reading file into memory..."; + } + else if ( %progress == 1.0 ) + { + LoadingProgress.setValue( ColladaImportProgress.savedProgress ); + LoadingProgressTxt.setValue( ColladaImportProgress.savedText ); + } + + %msg = ColladaImportProgress.msgPrefix @ ": " @ %msg; + + %progressCtrl = LoadingProgress; + %textCtrl = LoadingProgressTxt; + } + else + { + //it's probably the editors using it + if(isFunction("updateToolTSShapeLoadProgress")) + { + updateToolTSShapeLoadProgress(%progress, %msg); + } + } + + // Update progress indicators + if (%progress == 0) + { + %progressCtrl.setValue(0.001); + %textCtrl.setText(%msg); + } + else if (%progress != 1.0) + { + %progressCtrl.setValue(%progress); + %textCtrl.setText(%msg); + } + + Canvas.repaint(33);*/ +} + +/// A helper function which will return the ghosted client object +/// from a server object when connected to a local server. +function serverToClientObject( %serverObject ) +{ + assert( isObject( LocalClientConnection ), "serverToClientObject() - No local client connection found!" ); + assert( isObject( ServerConnection ), "serverToClientObject() - No server connection found!" ); + + %ghostId = LocalClientConnection.getGhostId( %serverObject ); + if ( %ghostId == -1 ) + return 0; + + return ServerConnection.resolveGhostID( %ghostId ); +} + +//---------------------------------------------------------------------------- +// Debug commands +//---------------------------------------------------------------------------- + +function netSimulateLag( %msDelay, %packetLossPercent ) +{ + if ( %packetLossPercent $= "" ) + %packetLossPercent = 0; + + commandToServer( 'NetSimulateLag', %msDelay, %packetLossPercent ); +} + +//Various client functions + +function validateDatablockName(%name) +{ + // remove whitespaces at beginning and end + %name = trim( %name ); + + // remove numbers at the beginning + %numbers = "0123456789"; + while( strlen(%name) > 0 ) + { + // the first character + %firstChar = getSubStr( %name, 0, 1 ); + // if the character is a number remove it + if( strpos( %numbers, %firstChar ) != -1 ) + { + %name = getSubStr( %name, 1, strlen(%name) -1 ); + %name = ltrim( %name ); + } + else + break; + } + + // replace whitespaces with underscores + %name = strreplace( %name, " ", "_" ); + + // remove any other invalid characters + %invalidCharacters = "-+*/%$&§=()[].?\"#,;!~<>|°^{}"; + %name = stripChars( %name, %invalidCharacters ); + + if( %name $= "" ) + %name = "Unnamed"; + + return %name; +} + +//-------------------------------------------------------------------------- +// Finds location of %word in %text, starting at %start. Works just like strPos +//-------------------------------------------------------------------------- + +function wordPos(%text, %word, %start) +{ + if (%start $= "") %start = 0; + + if (strpos(%text, %word, 0) == -1) return -1; + %count = getWordCount(%text); + if (%start >= %count) return -1; + for (%i = %start; %i < %count; %i++) + { + if (getWord( %text, %i) $= %word) return %i; + } + return -1; +} + +//-------------------------------------------------------------------------- +// Finds location of %field in %text, starting at %start. Works just like strPos +//-------------------------------------------------------------------------- + +function fieldPos(%text, %field, %start) +{ + if (%start $= "") %start = 0; + + if (strpos(%text, %field, 0) == -1) return -1; + %count = getFieldCount(%text); + if (%start >= %count) return -1; + for (%i = %start; %i < %count; %i++) + { + if (getField( %text, %i) $= %field) return %i; + } + return -1; +} + +//-------------------------------------------------------------------------- +// returns the text in a file with "\n" at the end of each line +//-------------------------------------------------------------------------- + +function loadFileText( %file) +{ + %fo = new FileObject(); + %fo.openForRead(%file); + %text = ""; + while(!%fo.isEOF()) + { + %text = %text @ %fo.readLine(); + if (!%fo.isEOF()) %text = %text @ "\n"; + } + + %fo.delete(); + return %text; +} + +function setValueSafe(%dest, %val) +{ + %cmd = %dest.command; + %alt = %dest.altCommand; + %dest.command = ""; + %dest.altCommand = ""; + + %dest.setValue(%val); + + %dest.command = %cmd; + %dest.altCommand = %alt; +} + +function shareValueSafe(%source, %dest) +{ + setValueSafe(%dest, %source.getValue()); +} + +function shareValueSafeDelay(%source, %dest, %delayMs) +{ + schedule(%delayMs, 0, shareValueSafe, %source, %dest); +} + + +//------------------------------------------------------------------------------ +// An Aggregate Control is a plain GuiControl that contains other controls, +// which all share a single job or represent a single value. +//------------------------------------------------------------------------------ + +// AggregateControl.setValue( ) propagates the value to any control that has an +// internal name. +function AggregateControl::setValue(%this, %val, %child) +{ + for(%i = 0; %i < %this.getCount(); %i++) + { + %obj = %this.getObject(%i); + if( %obj == %child ) + continue; + + if(%obj.internalName !$= "") + setValueSafe(%obj, %val); + } +} + +// AggregateControl.getValue() uses the value of the first control that has an +// internal name, if it has not cached a value via .setValue +function AggregateControl::getValue(%this) +{ + for(%i = 0; %i < %this.getCount(); %i++) + { + %obj = %this.getObject(%i); + if(%obj.internalName !$= "") + { + //error("obj = " @ %obj.getId() @ ", " @ %obj.getName() @ ", " @ %obj.internalName ); + //error(" value = " @ %obj.getValue()); + return %obj.getValue(); + } + } +} + +// AggregateControl.updateFromChild( ) is called by child controls to propagate +// a new value, and to trigger the onAction() callback. +function AggregateControl::updateFromChild(%this, %child) +{ + %val = %child.getValue(); + if(%val == mCeil(%val)){ + %val = mCeil(%val); + }else{ + if ( %val <= -100){ + %val = mCeil(%val); + }else if ( %val <= -10){ + %val = mFloatLength(%val, 1); + }else if ( %val < 0){ + %val = mFloatLength(%val, 2); + }else if ( %val >= 1000){ + %val = mCeil(%val); + }else if ( %val >= 100){ + %val = mFloatLength(%val, 1); + }else if ( %val >= 10){ + %val = mFloatLength(%val, 2); + }else if ( %val > 0){ + %val = mFloatLength(%val, 3); + } + } + %this.setValue(%val, %child); + %this.onAction(); +} + +// default onAction stub, here only to prevent console spam warnings. +function AggregateControl::onAction(%this) +{ +} + +// call a method on all children that have an internalName and that implement the method. +function AggregateControl::callMethod(%this, %method, %args) +{ + for(%i = 0; %i < %this.getCount(); %i++) + { + %obj = %this.getObject(%i); + if(%obj.internalName !$= "" && %obj.isMethod(%method)) + eval(%obj @ "." @ %method @ "( " @ %args @ " );"); + } + +} + +//------------------------------------------------------------------------------ +// Altered Version of TGB's QuickEditDropDownTextEditCtrl +//------------------------------------------------------------------------------ +function QuickEditDropDownTextEditCtrl::onRenameItem( %this ) +{ +} + +function QuickEditDropDownTextEditCtrl::updateFromChild( %this, %ctrl ) +{ + if( %ctrl.internalName $= "PopUpMenu" ) + { + %this->TextEdit.setText( %ctrl.getText() ); + } + else if ( %ctrl.internalName $= "TextEdit" ) + { + %popup = %this->PopupMenu; + %popup.changeTextById( %popup.getSelected(), %ctrl.getText() ); + %this.onRenameItem(); + } +} + +// Writes out all script functions to a file. +function writeOutFunctions() +{ + new ConsoleLogger(logger, "scriptFunctions.txt", false); + dumpConsoleFunctions(); + logger.delete(); +} + +// Writes out all script classes to a file. +function writeOutClasses() +{ + new ConsoleLogger(logger, "scriptClasses.txt", false); + dumpConsoleClasses(); + logger.delete(); +} + +// +function compileFiles(%pattern) +{ + %path = filePath(%pattern); + + %saveDSO = $Scripts::OverrideDSOPath; + %saveIgnore = $Scripts::ignoreDSOs; + + $Scripts::OverrideDSOPath = %path; + $Scripts::ignoreDSOs = false; + %mainCsFile = makeFullPath("main.cs"); + + for (%file = findFirstFileMultiExpr(%pattern); %file !$= ""; %file = findNextFileMultiExpr(%pattern)) + { + // we don't want to try and compile the primary main.cs + if(%mainCsFile !$= %file) + compile(%file, true); + } + + $Scripts::OverrideDSOPath = %saveDSO; + $Scripts::ignoreDSOs = %saveIgnore; + +} + +function displayHelp() +{ + // Notes on logmode: console logging is written to console.log. + // -log 0 disables console logging. + // -log 1 appends to existing logfile; it also closes the file + // (flushing the write buffer) after every write. + // -log 2 overwrites any existing logfile; it also only closes + // the logfile when the application shuts down. (default) + + error( + "Torque Demo command line options:\n"@ + " -log Logging behavior; see main.cs comments for details\n"@ + " -game Reset list of mods to only contain \n"@ + " Works like the -game argument\n"@ + " -dir Add to list of directories\n"@ + " -console Open a separate console\n"@ + " -jSave Record a journal\n"@ + " -jPlay Play back a journal\n"@ + " -help Display this help message\n" + ); +} + +// Execute startup scripts for each mod, starting at base and working up +function loadDir(%dir) +{ + pushback($userDirs, %dir, ";"); + + if (isScriptFile(%dir @ "/main.cs")) + exec(%dir @ "/main.cs"); +} + +function loadDirs(%dirPath) +{ + %dirPath = nextToken(%dirPath, token, ";"); + if (%dirPath !$= "") + loadDirs(%dirPath); + + if(exec(%token @ "/main.cs") != true) + { + error("Error: Unable to find specified directory: " @ %token ); + $dirCount--; + } +} + +//------------------------------------------------------------------------------ +// Utility remap functions: +//------------------------------------------------------------------------------ + +function ActionMap::copyBind( %this, %otherMap, %command ) +{ + if ( !isObject( %otherMap ) ) + { + error( "ActionMap::copyBind - \"" @ %otherMap @ "\" is not an object!" ); + return; + } + + %bind = %otherMap.getBinding( %command ); + if ( %bind !$= "" ) + { + %device = getField( %bind, 0 ); + %action = getField( %bind, 1 ); + %flags = %otherMap.isInverted( %device, %action ) ? "SDI" : "SD"; + %deadZone = %otherMap.getDeadZone( %device, %action ); + %scale = %otherMap.getScale( %device, %action ); + %this.bind( %device, %action, %flags, %deadZone, %scale, %command ); + } +} + +//------------------------------------------------------------------------------ +function ActionMap::blockBind( %this, %otherMap, %command ) +{ + if ( !isObject( %otherMap ) ) + { + error( "ActionMap::blockBind - \"" @ %otherMap @ "\" is not an object!" ); + return; + } + + %bind = %otherMap.getBinding( %command ); + if ( %bind !$= "" ) + %this.bind( getField( %bind, 0 ), getField( %bind, 1 ), "" ); +} + +//Dev helpers +/// Shortcut for typing dbgSetParameters with the default values torsion uses. +function dbgTorsion() +{ + dbgSetParameters( 6060, "password", false ); +} + +/// Reset the input state to a default of all-keys-up. +/// A helpful remedy for when Torque misses a button up event do to your breakpoints +/// and can't stop shooting / jumping / strafing. +function mvReset() +{ + for ( %i = 0; %i < 6; %i++ ) + setVariable( "mvTriggerCount" @ %i, 0 ); + + $mvUpAction = 0; + $mvDownAction = 0; + $mvLeftAction = 0; + $mvRightAction = 0; + + // There are others. +} + +//Persistance Manager tests + +new PersistenceManager(TestPManager); + +function runPManTest(%test) +{ + if (!isObject(TestPManager)) + return; + + if (%test $= "") + %test = 100; + + switch(%test) + { + case 0: + TestPManager.testFieldUpdates(); + case 1: + TestPManager.testObjectRename(); + case 2: + TestPManager.testNewObject(); + case 3: + TestPManager.testNewGroup(); + case 4: + TestPManager.testMoveObject(); + case 5: + TestPManager.testObjectRemove(); + case 100: + TestPManager.testFieldUpdates(); + TestPManager.testObjectRename(); + TestPManager.testNewObject(); + TestPManager.testNewGroup(); + TestPManager.testMoveObject(); + TestPManager.testObjectRemove(); + } +} + +function TestPManager::testFieldUpdates(%doNotSave) +{ + // Set some objects as dirty + TestPManager.setDirty(AudioGui); + TestPManager.setDirty(AudioSim); + TestPManager.setDirty(AudioMessage); + + // Alter some of the existing fields + AudioEffect.isLooping = true; + AudioMessage.isLooping = true; + AudioEffect.is3D = true; + + // Test removing a field + TestPManager.removeField(AudioGui, "isLooping"); + + // Alter some of the persistent fields + AudioGui.referenceDistance = 0.8; + AudioMessage.referenceDistance = 0.8; + + // Add some new dynamic fields + AudioGui.foo = "bar"; + AudioEffect.foo = "bar"; + + // Remove an object from the dirty list + // It shouldn't get updated in the file + TestPManager.removeDirty(AudioEffect); + + // Dirty an object in another file as well + TestPManager.setDirty(WarningMaterial); + + // Update a field that doesn't exist + WarningMaterial.glow[0] = true; + + // Drity another object to test for crashes + // when a dirty object is deleted + TestPManager.setDirty(SFXPausedSet); + + // Delete the object + SFXPausedSet.delete(); + + // Unless %doNotSave is set (by a batch/combo test) + // then go ahead and save now + if (!%doNotSave) + TestPManager.saveDirty(); +} + +function TestPManager::testObjectRename(%doNotSave) +{ + // Flag an object as dirty + if (isObject(AudioGui)) + TestPManager.setDirty(AudioGui); + else if (isObject(AudioGuiFoo)) + TestPManager.setDirty(AudioGuiFoo); + + // Rename it + if (isObject(AudioGui)) + AudioGui.setName(AudioGuiFoo); + else if (isObject(AudioGuiFoo)) + AudioGuiFoo.setName(AudioGui); + + // Unless %doNotSave is set (by a batch/combo test) + // then go ahead and save now + if (!%doNotSave) + TestPManager.saveDirty(); +} + +function TestPManager::testNewObject(%doNotSave) +{ + // Test adding a new named object + new SFXDescription(AudioNew) + { + volume = 0.5; + isLooping = true; + channel = $GuiAudioType; + foo = 2; + }; + + // Flag it as dirty + TestPManager.setDirty(AudioNew, "core/scripts/client/audio.cs"); + + // Test adding a new unnamed object + %obj = new SFXDescription() + { + volume = 0.75; + isLooping = true; + bar = 3; + }; + + // Flag it as dirty + TestPManager.setDirty(%obj, "core/scripts/client/audio.cs"); + + // Test adding an "empty" object + new SFXDescription(AudioEmpty); + + TestPManager.setDirty(AudioEmpty, "core/scripts/client/audio.cs"); + + // Unless %doNotSave is set (by a batch/combo test) + // then go ahead and save now + if (!%doNotSave) + TestPManager.saveDirty(); +} + +function TestPManager::testNewGroup(%doNotSave) +{ + // Test adding a new named SimGroup + new SimGroup(TestGroup) + { + foo = "bar"; + + new SFXDescription(TestObject) + { + volume = 0.5; + isLooping = true; + channel = $GuiAudioType; + foo = 1; + }; + new SimGroup(SubGroup) + { + foo = 2; + + new SFXDescription(SubObject) + { + volume = 0.5; + isLooping = true; + channel = $GuiAudioType; + foo = 3; + }; + }; + }; + + // Flag this as dirty + TestPManager.setDirty(TestGroup, "core/scripts/client/audio.cs"); + + // Test adding a new unnamed SimGroup + %group = new SimGroup() + { + foo = "bar"; + + new SFXDescription() + { + volume = 0.75; + channel = $GuiAudioType; + foo = 4; + }; + new SimGroup() + { + foo = 5; + + new SFXDescription() + { + volume = 0.75; + isLooping = true; + channel = $GuiAudioType; + foo = 6; + }; + }; + }; + + // Flag this as dirty + TestPManager.setDirty(%group, "core/scripts/client/audio.cs"); + + // Test adding a new unnamed SimSet + %set = new SimSet() + { + foo = "bar"; + + new SFXDescription() + { + volume = 0.75; + channel = $GuiAudioType; + foo = 7; + }; + new SimGroup() + { + foo = 8; + + new SFXDescription() + { + volume = 0.75; + isLooping = true; + channel = $GuiAudioType; + foo = 9; + }; + }; + }; + + // Flag this as dirty + TestPManager.setDirty(%set, "core/scripts/client/audio.cs"); + + // Unless %doNotSave is set (by a batch/combo test) + // then go ahead and save now + if (!%doNotSave) + TestPManager.saveDirty(); +} + +function TestPManager::testMoveObject(%doNotSave) +{ + // First add a couple of groups to the file + new SimGroup(MoveGroup1) + { + foo = "bar"; + + new SFXDescription(MoveObject1) + { + volume = 0.5; + isLooping = true; + channel = $GuiAudioType; + foo = 1; + }; + + new SimSet(SubGroup1) + { + new SFXDescription(SubObject1) + { + volume = 0.75; + isLooping = true; + channel = $GuiAudioType; + foo = 2; + }; + }; + }; + + // Flag this as dirty + TestPManager.setDirty(MoveGroup1, "core/scripts/client/audio.cs"); + + new SimGroup(MoveGroup2) + { + foo = "bar"; + + new SFXDescription(MoveObject2) + { + volume = 0.5; + isLooping = true; + channel = $GuiAudioType; + foo = 3; + }; + }; + + // Flag this as dirty + TestPManager.setDirty(MoveGroup2, "core/scripts/client/audio.cs"); + + // Unless %doNotSave is set (by a batch/combo test) + // then go ahead and save now + if (!%doNotSave) + TestPManager.saveDirty(); + + // Set them as dirty again + TestPManager.setDirty(MoveGroup1); + TestPManager.setDirty(MoveGroup2); + + // Give the subobject an new value + MoveObject1.foo = 4; + + // Move it into the other group + MoveGroup1.add(MoveObject2); + + // Switch the other subobject + MoveGroup2.add(MoveObject1); + + // Also add a new unnamed object to one of the groups + %obj = new SFXDescription() + { + volume = 0.75; + isLooping = true; + bar = 5; + }; + + MoveGroup1.add(%obj); + + // Unless %doNotSave is set (by a batch/combo test) + // then go ahead and save now + if (!%doNotSave) + TestPManager.saveDirty(); +} + +function TestPManager::testObjectRemove(%doNotSave) +{ + TestPManager.removeObjectFromFile(AudioSim); +} + +//Game Object management +function findGameObject(%name) +{ + //find all GameObjectAssets + %assetQuery = new AssetQuery(); + if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset")) + return 0; //if we didn't find ANY, just exit + + %count = %assetQuery.getCount(); + + for(%i=0; %i < %count; %i++) + { + %assetId = %assetQuery.getAsset(%i); + + //%assetName = AssetDatabase.getAssetName(%assetId); + + if(%assetId $= %name) + { + %gameObjectAsset = AssetDatabase.acquireAsset(%assetId); + + %assetQuery.delete(); + return %gameObjectAsset; + } + } + + %assetQuery.delete(); + return 0; +} + +function spawnGameObject(%name, %addToMissionGroup) +{ + if(%addToMissionGroup $= "") + %addToMissionGroup = true; + + //First, check if this already exists in our GameObjectPool + if(isObject(GameObjectPool)) + { + %goCount = GameObjectPool.countKey(%name); + + //if we have some already in the pool, pull it out and use that + if(%goCount != 0) + { + %goIdx = GameObjectPool.getIndexFromKey(%name); + %go = GameObjectPool.getValue(%goIdx); + + %go.setHidden(false); + %go.setScopeAlways(); + + if(%addToMissionGroup == true) //save instance when saving level + MissionGroup.add(%go); + else // clear instance on level exit + MissionCleanup.add(%go); + + //remove from the object pool's list + GameObjectPool.erase(%goIdx); + + return %go; + } + } + + //We have no existing pool, or no existing game objects of this type, so spawn a new one + + %gameObjectAsset = findGameObject(%name); + + if(isObject(%gameObjectAsset)) + { + %newSGOObject = TamlRead(%gameObjectAsset.TAMLFilePath); + + if(%addToMissionGroup == true) //save instance when saving level + MissionGroup.add(%newSGOObject); + else // clear instance on level exit + MissionCleanup.add(%newSGOObject); + + return %newSGOObject; + } + + return 0; +} + +function saveGameObject(%name, %tamlPath, %scriptPath) +{ + %gameObjectAsset = findGameObject(%name); + + //find if it already exists. If it does, we'll update it, if it does not, we'll make a new asset + if(isObject(%gameObjectAsset)) + { + %assetID = %gameObjectAsset.getAssetId(); + + %gameObjectAsset.TAMLFilePath = %tamlPath; + %gameObjectAsset.scriptFilePath = %scriptPath; + + TAMLWrite(%gameObjectAsset, AssetDatabase.getAssetFilePath(%assetID)); + AssetDatabase.refreshAsset(%assetID); + } + else + { + //Doesn't exist, so make a new one + %gameObjectAsset = new GameObjectAsset() + { + assetName = %name @ "Asset"; + gameObjectName = %name; + TAMLFilePath = %tamlPath; + scriptFilePath = %scriptPath; + }; + + //Save it alongside the taml file + %path = filePath(%tamlPath); + + TAMLWrite(%gameObjectAsset, %path @ "/" @ %name @ ".asset.taml"); + AssetDatabase.refreshAllAssets(true); + } +} + +//Allocates a number of a game object into a pool to be pulled from as needed +function allocateGameObjects(%name, %amount) +{ + //First, we need to make sure our pool exists + if(!isObject(GameObjectPool)) + { + new ArrayObject(GameObjectPool); + } + + //Next, we loop and generate our game objects, and add them to the pool + for(%i=0; %i < %amount; %i++) + { + %go = spawnGameObject(%name, false); + + //When our object is in the pool, it's not "real", so we need to make sure + //that we don't ghost it to clients untill we actually spawn it. + %go.clearScopeAlways(); + + //We also hide it, so that we don't 'exist' in the scene until we spawn + %go.hidden = true; + + //Lastly, add us to the pool, with the key being our game object type + GameObjectPool.add(%name, %go); + } +} + +function Entity::delete(%this) +{ + //we want to intercept the delete call, and add it to our GameObjectPool + //if it's a game object + if(%this.gameObjectAsset !$= "") + { + %this.setHidden(true); + %this.clearScopeAlways(); + + if(!isObject(GameObjectPool)) + { + new ArrayObject(GameObjectPool); + } + + GameObjectPool.add(%this.gameObjectAsset, %this); + + %missionSet = %this.getGroup(); + %missionSet.remove(%this); + } + else + { + %this.superClass.delete(); + } +} + +function clearGameObjectPool() +{ + if(isObject(GameObjectPool)) + { + %count = GameObjectPool.count(); + + for(%i=0; %i < %count; %i++) + { + %go = GameObjectPool.getValue(%i); + + %go.superClass.delete(); + } + + GameObjectPool.empty(); + } +} + +// +function switchCamera(%client, %newCamEntity) +{ + if(!isObject(%client) || !isObject(%newCamEntity)) + return error("SwitchCamera: No client or target camera!"); + + %cam = %newCamEntity.getComponent(CameraComponent); + + if(!isObject(%cam)) + return error("SwitchCamera: Target camera doesn't have a camera behavior!"); + + //TODO: Cleanup clientOwner for previous camera! + if(%cam.clientOwner == 0 || %cam.clientOwner $= "") + %cam.clientOwner = 0; + + %cam.scopeToClient(%client); + %cam.setDirty(); + + %client.setCameraObject(%newCamEntity); + %client.setControlCameraFov(%cam.FOV); + + %client.camera = %newCamEntity; +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/utility/scripts/parseArgs.cs b/Templates/BaseGame/game/core/utility/scripts/parseArgs.cs new file mode 100644 index 000000000..811cee00c --- /dev/null +++ b/Templates/BaseGame/game/core/utility/scripts/parseArgs.cs @@ -0,0 +1,392 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +//----------------------------------------------------------------------------- +// Support functions used to manage the directory list +function pushFront(%list, %token, %delim) +{ + if (%list !$= "") + return %token @ %delim @ %list; + return %token; +} + +function pushBack(%list, %token, %delim) +{ + if (%list !$= "") + return %list @ %delim @ %token; + return %token; +} + +function popFront(%list, %delim) +{ + return nextToken(%list, unused, %delim); +} + +function parseArgs() +{ + for ($i = 1; $i < $Game::argc ; $i++) + { + $arg = $Game::argv[$i]; + $nextArg = $Game::argv[$i+1]; + $hasNextArg = $Game::argc - $i > 1; + $logModeSpecified = false; + + // Check for dedicated run + /*if( stricmp($arg,"-dedicated") == 0 ) + { + $userDirs = $defaultGame; + $dirCount = 1; + $isDedicated = true; + }*/ + + switch$ ($arg) + { + //-------------------- + case "-dedicated": + $userDirs = $defaultGame; + $dirCount = 1; + $isDedicated = true; + $Server::Dedicated = true; + enableWinConsole(true); + $argUsed[%i]++; + + //-------------------- + case "-mission": + $argUsed[%i]++; + if ($hasNextArg) + { + $missionArg = $nextArg; + $argUsed[%i+1]++; + %i++; + } + else + error("Error: Missing Command Line argument. Usage: -mission "); + + //-------------------- + case "-connect": + $argUsed[%i]++; + if ($hasNextArg) + { + $JoinGameAddress = $nextArg; + $argUsed[%i+1]++; + %i++; + } + else + error("Error: Missing Command Line argument. Usage: -connect "); + + + //-------------------- + case "-log": + $argUsed[$i]++; + if ($hasNextArg) + { + // Turn on console logging + if ($nextArg != 0) + { + // Dump existing console to logfile first. + $nextArg += 4; + } + setLogMode($nextArg); + $logModeSpecified = true; + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -log "); + + //-------------------- + case "-dir": + $argUsed[$i]++; + if ($hasNextArg) + { + // Append the mod to the end of the current list + $userDirs = strreplace($userDirs, $nextArg, ""); + $userDirs = pushFront($userDirs, $nextArg, ";"); + $argUsed[$i+1]++; + $i++; + $dirCount++; + } + else + error("Error: Missing Command Line argument. Usage: -dir "); + + //-------------------- + // changed the default behavior of this command line arg. It now + // defaults to ONLY loading the game, not tools + // default auto-run already loads in tools --SRZ 11/29/07 + case "-game": + $argUsed[$i]++; + if ($hasNextArg) + { + // Set the selected dir --NOTE: we no longer allow tools with this argument + /* + if( $isDedicated ) + { + $userDirs = $nextArg; + $dirCount = 1; + } + else + { + $userDirs = "tools;" @ $nextArg; + $dirCount = 2; + } + */ + $userDirs = $nextArg; + $dirCount = 1; + $argUsed[$i+1]++; + $i++; + error($userDirs); + } + else + error("Error: Missing Command Line argument. Usage: -game "); + + //-------------------- + case "-console": + enableWinConsole(true); + $argUsed[$i]++; + + //-------------------- + case "-jSave": + $argUsed[$i]++; + if ($hasNextArg) + { + echo("Saving event log to journal: " @ $nextArg); + saveJournal($nextArg); + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -jSave "); + + //-------------------- + case "-jPlay": + $argUsed[$i]++; + if ($hasNextArg) + { + playJournal($nextArg); + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -jPlay "); + + //-------------------- + case "-jPlayToVideo": + $argUsed[$i]++; + if ($hasNextArg) + { + $VideoCapture::journalName = $nextArg; + $VideoCapture::captureFromJournal = true; + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -jPlayToVideo "); + + //-------------------- + case "-vidCapFile": + $argUsed[$i]++; + if ($hasNextArg) + { + $VideoCapture::fileName = $nextArg; + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -vidCapFile "); + + //-------------------- + case "-vidCapFPS": + $argUsed[$i]++; + if ($hasNextArg) + { + $VideoCapture::fps = $nextArg; + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -vidCapFPS "); + + //-------------------- + case "-vidCapEncoder": + $argUsed[$i]++; + if ($hasNextArg) + { + $VideoCapture::encoder = $nextArg; + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -vidCapEncoder "); + + //-------------------- + case "-vidCapWidth": + $argUsed[$i]++; + if ($hasNextArg) + { + $videoCapture::width = $nextArg; + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -vidCapWidth "); + + //-------------------- + case "-vidCapHeight": + $argUsed[$i]++; + if ($hasNextArg) + { + $videoCapture::height = $nextArg; + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -vidCapHeight "); + + //-------------------- + case "-level": + $argUsed[$i]++; + if ($hasNextArg) + { + %hasExt = strpos($nextArg, ".mis"); + if(%hasExt == -1) + { + $levelToLoad = $nextArg @ " "; + + for(%i = $i + 2; %i < $Game::argc; %i++) + { + $arg = $Game::argv[%i]; + %hasExt = strpos($arg, ".mis"); + + if(%hasExt == -1) + { + $levelToLoad = $levelToLoad @ $arg @ " "; + } else + { + $levelToLoad = $levelToLoad @ $arg; + break; + } + } + } + else + { + $levelToLoad = $nextArg; + } + + $argUsed[$i+1]++; + $i++; + } + else + error("Error: Missing Command Line argument. Usage: -level "); + + //------------------- + case "-worldeditor": + $startWorldEditor = true; + $argUsed[$i]++; + + //------------------- + case "-guieditor": + $startGUIEditor = true; + $argUsed[$i]++; + + //------------------- + case "-help": + $displayHelp = true; + $argUsed[$i]++; + + //------------------- + case "-compileAll": + $compileAll = true; + $argUsed[$i]++; + + //------------------- + case "-compileTools": + $compileTools = true; + $argUsed[$i]++; + + //------------------- + case "-genScript": + $genScript = true; + $argUsed[$i]++; + + case "-fullscreen": + $cliFullscreen = true; + $argUsed[%i]++; + + case "-windowed": + $cliFullscreen = false; + $argUsed[%i]++; + + case "-openGL": + $pref::Video::displayDevice = "OpenGL"; + $argUsed[%i]++; + + case "-directX": + $pref::Video::displayDevice = "D3D"; + $argUsed[%i]++; + + case "-autoVideo": + $pref::Video::displayDevice = ""; + $argUsed[%i]++; + + case "-prefs": + $argUsed[%i]++; + if ($hasNextArg) { + exec($nextArg, true, true); + $argUsed[%i+1]++; + %i++; + } + else + error("Error: Missing Command Line argument. Usage: -prefs "); + + + //------------------- + default: + $argUsed[$i]++; + if($userDirs $= "") + $userDirs = $arg; + } + } + + //----------------------------------------------- + // Play journal to video file? + if ($VideoCapture::captureFromJournal && $VideoCapture::journalName !$= "") + { + if ($VideoCapture::fileName $= "") + $VideoCapture::fileName = $VideoCapture::journalName; + + if ($VideoCapture::encoder $= "") + $VideoCapture::encoder = "THEORA"; + + if ($VideoCapture::fps $= "") + $VideoCapture::fps = 30; + + if ($videoCapture::width $= "") + $videoCapture::width = 0; + + if ($videoCapture::height $= "") + $videoCapture::height = 0; + + playJournalToVideo( $VideoCapture::journalName, $VideoCapture::fileName, + $VideoCapture::encoder, $VideoCapture::fps, + $videoCapture::width SPC $videoCapture::height ); + } +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/vr/Core_VR.cs b/Templates/BaseGame/game/core/vr/Core_VR.cs new file mode 100644 index 000000000..42b2df7e0 --- /dev/null +++ b/Templates/BaseGame/game/core/vr/Core_VR.cs @@ -0,0 +1,9 @@ + +function Core_VR::onCreate(%this) +{ + exec("./scripts/oculusVR.cs"); +} + +function Core_VR::onDestroy(%this) +{ +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/vr/Core_VR.module b/Templates/BaseGame/game/core/vr/Core_VR.module new file mode 100644 index 000000000..960a5a85a --- /dev/null +++ b/Templates/BaseGame/game/core/vr/Core_VR.module @@ -0,0 +1,9 @@ + + \ No newline at end of file diff --git a/Templates/BaseGame/game/core/vr/guis/oculusVROverlay.gui b/Templates/BaseGame/game/core/vr/guis/oculusVROverlay.gui new file mode 100644 index 000000000..62a9f719c --- /dev/null +++ b/Templates/BaseGame/game/core/vr/guis/oculusVROverlay.gui @@ -0,0 +1,19 @@ +//--- OBJECT WRITE BEGIN --- +%guiContent = singleton GuiControl(OculusVROverlay) { + canSaveDynamicFields = "0"; + Enabled = "1"; + isContainer = "1"; + Profile = "GuiContentProfile"; + HorizSizing = "width"; + VertSizing = "height"; + Position = "0 0"; + Extent = "512 512"; + MinExtent = "8 8"; + canSave = "1"; + Visible = "1"; + tooltipprofile = "GuiToolTipProfile"; + hovertime = "1000"; + useVariable = "0"; + tile = "0"; +}; +//--- OBJECT WRITE END --- diff --git a/Templates/BaseGame/game/core/vr/scripts/oculusVR.cs b/Templates/BaseGame/game/core/vr/scripts/oculusVR.cs new file mode 100644 index 000000000..fa9562c18 --- /dev/null +++ b/Templates/BaseGame/game/core/vr/scripts/oculusVR.cs @@ -0,0 +1,248 @@ +//----------------------------------------------------------------------------- +// Copyright (c) 2012 GarageGames, LLC +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to +// deal in the Software without restriction, including without limitation the +// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +// sell copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// 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 OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +// IN THE SOFTWARE. +//----------------------------------------------------------------------------- + +// Only load these functions if an Oculus VR device is present +if(!isFunction(isOculusVRDeviceActive)) + return; + +function setupOculusActionMaps() +{ + if (isObject(OculusWarningMap)) + return; + + new ActionMap(OculusWarningMap); + new ActionMap(OculusCanvasMap); + + OculusWarningMap.bind(keyboard, space, dismissOculusVRWarnings); + + OculusCanvasMap.bind( mouse, xaxis, oculusYaw ); + OculusCanvasMap.bind( mouse, yaxis, oculusPitch ); + OculusCanvasMap.bind( mouse, button0, oculusClick ); +} + +function oculusYaw(%val) +{ + OculusCanvas.cursorNudge(%val * 0.10, 0); +} + +function oculusPitch(%val) +{ + OculusCanvas.cursorNudge(0, %val * 0.10); +} + +function oculusClick(%active) +{ + OculusCanvas.cursorClick(0, %active); +} + +function GuiOffscreenCanvas::checkCursor(%this) +{ + %count = %this.getCount(); + for(%i = 0; %i < %count; %i++) + { + %control = %this.getObject(%i); + if ((%control.noCursor $= "") || !%control.noCursor) + { + %this.cursorOn(); + return true; + } + } + // If we get here, every control requested a hidden cursor, so we oblige. + + %this.cursorOff(); + return false; +} + +function GuiOffscreenCanvas::pushDialog(%this, %ctrl, %layer, %center) +{ + Parent::pushDialog(%this, %ctrl, %layer, %center); + %cursorVisible = %this.checkCursor(); + + if (%cursorVisible) + { + echo("OffscreenCanvas visible"); + OculusCanvasMap.pop(); + OculusCanvasMap.push(); + } + else + { + echo("OffscreenCanvas not visible"); + OculusCanvasMap.pop(); + } +} + +function GuiOffscreenCanvas::popDialog(%this, %ctrl) +{ + Parent::popDialog(%this, %ctrl); + %cursorVisible = %this.checkCursor(); + + if (%cursorVisible) + { + echo("OffscreenCanvas visible"); + OculusCanvasMap.pop(); + OculusCanvasMap.push(); + } + else + { + echo("OffscreenCanvas not visible"); + OculusCanvasMap.pop(); + } +} + + +//----------------------------------------------------------------------------- + +function oculusSensorMetricsCallback() +{ + return ovrDumpMetrics(0); +} + + +//----------------------------------------------------------------------------- +function onOculusStatusUpdate(%status) +{ + $LastOculusTrackingState = %status; +} + +//----------------------------------------------------------------------------- + +// Call this function from createCanvas() to have the Canvas attach itself +// to the Rift's display. The Canvas' window will still open on the primary +// display if that is different from the Rift, but it will move to the Rift +// when it goes full screen. If the Rift is not connected then nothing +// will happen. +function pointCanvasToOculusVRDisplay() +{ + $pref::Video::displayOutputDevice = getOVRHMDDisplayDeviceName(0); +} + +//----------------------------------------------------------------------------- + +// Call this function from GameConnection::initialControlSet() just before +// your "Canvas.setContent(PlayGui);" call, or at any time you wish to switch +// to a side-by-side rendering and the appropriate barrel distortion. This +// will turn on side-by-side rendering and tell the GameConnection to use the +// Rift as its display device. +// Parameters: +// %gameConnection - The client GameConnection instance +// %trueStereoRendering - If true will enable stereo rendering with an eye +// offset for each viewport. This will render each frame twice. If false +// then a pseudo stereo rendering is done with only a single render per frame. +function enableOculusVRDisplay(%gameConnection, %trueStereoRendering) +{ + setOVRHMDAsGameConnectionDisplayDevice(%gameConnection); + PlayGui.renderStyle = "stereo side by side"; + setOptimalOVRCanvasSize(Canvas); + + if (!isObject(OculusCanvas)) + { + new GuiOffscreenCanvas(OculusCanvas) { + targetSize = "512 512"; + targetName = "oculusCanvas"; + dynamicTarget = true; + }; + } + + if (!isObject(OculusVROverlay)) + { + exec("core/vr/guis/oculusVROverlay.gui"); + } + + OculusCanvas.setContent(OculusVROverlay); + OculusCanvas.setCursor(DefaultCursor); + PlayGui.setStereoGui(OculusCanvas); + OculusCanvas.setCursorPos("128 128"); + OculusCanvas.cursorOff(); + $GameCanvas = OculusCanvas; + + %ext = Canvas.getExtent(); + $OculusMouseScaleX = 512.0 / 1920.0; + $OculusMouseScaleY = 512.0 / 1060.0; + + //$gfx::wireframe = true; + // Reset all sensors + ovrResetAllSensors(); +} + +// Call this function when ever you wish to turn off the stereo rendering +// and barrel distortion for the Rift. +function disableOculusVRDisplay(%gameConnection) +{ + OculusCanvas.popDialog(); + OculusWarningMap.pop(); + $GameCanvas = Canvas; + + if (isObject(gameConnection)) + { + %gameConnection.clearDisplayDevice(); + } + PlayGui.renderStyle = "standard"; +} + +// Helper function to set the standard Rift control scheme. You could place +// this function in GameConnection::initialControlSet() at the same time +// you call enableOculusVRDisplay(). +function setStandardOculusVRControlScheme(%gameConnection) +{ + if($OculusVR::SimulateInput) + { + // We are simulating a HMD so allow the mouse and gamepad to control + // both yaw and pitch. + %gameConnection.setControlSchemeParameters(true, true, true); + } + else + { + // A HMD is connected so have the mouse and gamepad only add to yaw + %gameConnection.setControlSchemeParameters(true, true, false); + } +} + +//----------------------------------------------------------------------------- + +// Helper function to set the resolution for the Rift. +// Parameters: +// %fullscreen - If true then the display will be forced to full screen. If +// pointCanvasToOculusVRDisplay() was called before the Canvas was created, then +// the full screen display will appear on the Rift. +function setVideoModeForOculusVRDisplay(%fullscreen) +{ + %res = getOVRHMDResolution(0); + Canvas.setVideoMode(%res.x, %res.y, %fullscreen, 32, 4); +} + +//----------------------------------------------------------------------------- + +// Reset all Oculus Rift sensors. This will make the Rift's current heading +// be considered the origin. +function resetOculusVRSensors() +{ + ovrResetAllSensors(); +} + +function dismissOculusVRWarnings(%value) +{ + //if (%value) + //{ + ovrDismissWarnings(); + OculusWarningMap.pop(); + //} +} \ No newline at end of file diff --git a/Templates/BaseGame/game/tools/levels/BlankRoom.postfxpreset.cs b/Templates/BaseGame/game/tools/levels/BlankRoom.postfxpreset.cs index 8b616a84a..23a6c3ced 100644 --- a/Templates/BaseGame/game/tools/levels/BlankRoom.postfxpreset.cs +++ b/Templates/BaseGame/game/tools/levels/BlankRoom.postfxpreset.cs @@ -1,4 +1,4 @@ -$PostFXManager::Settings::ColorCorrectionRamp = "core/images/null_color_ramp.png"; +$PostFXManager::Settings::ColorCorrectionRamp = "core/postFX/images/null_color_ramp.png"; $PostFXManager::Settings::DOF::BlurCurveFar = ""; $PostFXManager::Settings::DOF::BlurCurveNear = ""; $PostFXManager::Settings::DOF::BlurMax = ""; From 5037d7e046a9dba9bcafe4f8e33eb809453d8fc4 Mon Sep 17 00:00:00 2001 From: Areloch Date: Sun, 2 Sep 2018 04:49:58 -0500 Subject: [PATCH 138/144] Updated the main.cs.in file to account for core module-ification. --- Templates/BaseGame/game/main.cs.in | 47 ++++-------------------------- 1 file changed, 5 insertions(+), 42 deletions(-) diff --git a/Templates/BaseGame/game/main.cs.in b/Templates/BaseGame/game/main.cs.in index 3eed267df..1e3e37c44 100644 --- a/Templates/BaseGame/game/main.cs.in +++ b/Templates/BaseGame/game/main.cs.in @@ -16,39 +16,12 @@ $appName = "@TORQUE_APP_NAME@"; //----------------------------------------------------------------------------- // Load up scripts to initialise subsystems. -exec("core/main.cs"); - -// Parse the command line arguments -echo("\n--------- Parsing Arguments ---------"); -parseArgs(); - -// The canvas needs to be initialized before any gui scripts are run since -// some of the controls assume that the canvas exists at load time. -createCanvas($appName); +ModuleDatabase.setModuleExtension("module"); +ModuleDatabase.scanModules( "core", false ); +ModuleDatabase.LoadExplicit( "CoreModule" ); //----------------------------------------------------------------------------- -// Load console. -exec("core/console/main.cs"); - -// Init the physics plugin. -physicsInit(); - -sfxStartup(); - -// Set up networking. -setNetPort(0); - -// Start processing file change events. -startFileChangeNotifications(); - -// If we have editors, initialize them here as well -if (isToolBuild()) -{ - if(isFile("tools/main.cs") && !$isDedicated) - exec("tools/main.cs"); -} - -ModuleDatabase.setModuleExtension("module"); +// Load any gameplay modules ModuleDatabase.scanModules( "data", false ); ModuleDatabase.LoadGroup( "Game" ); @@ -85,14 +58,4 @@ else closeSplashWindow(); } -echo("Engine initialized..."); - -//----------------------------------------------------------------------------- -// Called when the engine is shutting down. -function onExit() -{ - // Stop file change events. - stopFileChangeNotifications(); - - ModuleDatabase.UnloadExplicit( "Game" ); -} \ No newline at end of file +echo("Engine initialized..."); \ No newline at end of file From c17ae947456ecd0b6172ad56dbb3cafa5b6650ce Mon Sep 17 00:00:00 2001 From: Areloch Date: Wed, 19 Sep 2018 16:03:58 -0500 Subject: [PATCH 139/144] Moved VR module from core to a regular module, as not all games are necessarily going to use VR. Also corrected some of the default posteffect settings for the levels. --- Templates/BaseGame/game/core/Core.cs | 2 -- Templates/BaseGame/game/core/vr/Core_VR.cs | 9 --------- Templates/Modules/vr/VR.cs | 9 +++++++++ .../game/core/vr/Core_VR.module => Modules/vr/VR.module} | 6 +++--- .../game/core => Modules}/vr/guis/oculusVROverlay.gui | 0 .../game/core => Modules}/vr/scripts/oculusVR.cs | 0 6 files changed, 12 insertions(+), 14 deletions(-) delete mode 100644 Templates/BaseGame/game/core/vr/Core_VR.cs create mode 100644 Templates/Modules/vr/VR.cs rename Templates/{BaseGame/game/core/vr/Core_VR.module => Modules/vr/VR.module} (75%) rename Templates/{BaseGame/game/core => Modules}/vr/guis/oculusVROverlay.gui (100%) rename Templates/{BaseGame/game/core => Modules}/vr/scripts/oculusVR.cs (100%) diff --git a/Templates/BaseGame/game/core/Core.cs b/Templates/BaseGame/game/core/Core.cs index 480c0331c..5559760ae 100644 --- a/Templates/BaseGame/game/core/Core.cs +++ b/Templates/BaseGame/game/core/Core.cs @@ -24,8 +24,6 @@ function CoreModule::onCreate(%this) ModuleDatabase.LoadExplicit( "Core_Lighting" ); ModuleDatabase.LoadExplicit( "Core_SFX" ); ModuleDatabase.LoadExplicit( "Core_PostFX" ); - ModuleDatabase.LoadExplicit( "Core_VR" ); - ModuleDatabase.LoadExplicit( "Core_VR" ); ModuleDatabase.LoadExplicit( "Core_ClientServer" ); %prefPath = getPrefpath(); diff --git a/Templates/BaseGame/game/core/vr/Core_VR.cs b/Templates/BaseGame/game/core/vr/Core_VR.cs deleted file mode 100644 index 42b2df7e0..000000000 --- a/Templates/BaseGame/game/core/vr/Core_VR.cs +++ /dev/null @@ -1,9 +0,0 @@ - -function Core_VR::onCreate(%this) -{ - exec("./scripts/oculusVR.cs"); -} - -function Core_VR::onDestroy(%this) -{ -} \ No newline at end of file diff --git a/Templates/Modules/vr/VR.cs b/Templates/Modules/vr/VR.cs new file mode 100644 index 000000000..ea0ffd7a5 --- /dev/null +++ b/Templates/Modules/vr/VR.cs @@ -0,0 +1,9 @@ + +function VR::onCreate(%this) +{ + exec("./scripts/oculusVR.cs"); +} + +function VR::onDestroy(%this) +{ +} \ No newline at end of file diff --git a/Templates/BaseGame/game/core/vr/Core_VR.module b/Templates/Modules/vr/VR.module similarity index 75% rename from Templates/BaseGame/game/core/vr/Core_VR.module rename to Templates/Modules/vr/VR.module index 960a5a85a..14ccec0e0 100644 --- a/Templates/BaseGame/game/core/vr/Core_VR.module +++ b/Templates/Modules/vr/VR.module @@ -1,9 +1,9 @@ + Group="Game"> \ No newline at end of file diff --git a/Templates/BaseGame/game/core/vr/guis/oculusVROverlay.gui b/Templates/Modules/vr/guis/oculusVROverlay.gui similarity index 100% rename from Templates/BaseGame/game/core/vr/guis/oculusVROverlay.gui rename to Templates/Modules/vr/guis/oculusVROverlay.gui diff --git a/Templates/BaseGame/game/core/vr/scripts/oculusVR.cs b/Templates/Modules/vr/scripts/oculusVR.cs similarity index 100% rename from Templates/BaseGame/game/core/vr/scripts/oculusVR.cs rename to Templates/Modules/vr/scripts/oculusVR.cs From 2ed30ffeaecf3062c67ae352d4385351be942b4c Mon Sep 17 00:00:00 2001 From: OTHGMars Date: Mon, 24 Sep 2018 18:56:46 -0400 Subject: [PATCH 140/144] Adds Clamp to QuatF::dot() Clamps output of QuatF::dot() to [-1, 1]. --- Engine/source/math/mQuat.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Engine/source/math/mQuat.h b/Engine/source/math/mQuat.h index ca6ed5d82..261b66a88 100644 --- a/Engine/source/math/mQuat.h +++ b/Engine/source/math/mQuat.h @@ -222,7 +222,7 @@ inline QuatF& QuatF::neg() inline F32 QuatF::dot( const QuatF &q ) const { - return (w*q.w + x*q.x + y*q.y + z*q.z); + return mClampF(w*q.w + x*q.x + y*q.y + z*q.z, -1.0f, 1.0f); } inline F32 QuatF::angleBetween( const QuatF & q ) From 2c0a57449e05a4246cc1622aa576fba0970b9e09 Mon Sep 17 00:00:00 2001 From: Azaezel Date: Wed, 26 Sep 2018 06:49:36 -0500 Subject: [PATCH 141/144] filter out pixel shader normalmap calcs when not in deferred mode. --- Engine/source/terrain/glsl/terrFeatureGLSL.cpp | 3 +++ Engine/source/terrain/hlsl/terrFeatureHLSL.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp index 2acd40871..6eb0c8c1a 100644 --- a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp +++ b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp @@ -927,6 +927,9 @@ void TerrainNormalMapFeatGLSL::processVert( Vector &component void TerrainNormalMapFeatGLSL::processPix( Vector &componentList, const MaterialFeatureData &fd ) { + // We only need to process normals during the deferred. + if (!fd.features.hasFeature(MFT_DeferredConditioner)) + return; MultiLine *meta = new MultiLine; diff --git a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp index f4a0b7d5d..3b05a30f7 100644 --- a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp +++ b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp @@ -908,6 +908,9 @@ void TerrainNormalMapFeatHLSL::processVert( Vector &component void TerrainNormalMapFeatHLSL::processPix( Vector &componentList, const MaterialFeatureData &fd ) { + // We only need to process normals during the deferred. + if (!fd.features.hasFeature(MFT_DeferredConditioner)) + return; MultiLine *meta = new MultiLine; From e3793184b6bd9956f32486fffe566dba0c9e3985 Mon Sep 17 00:00:00 2001 From: OTHGMars Date: Sat, 6 Oct 2018 03:29:15 -0400 Subject: [PATCH 142/144] Improved BitStream writeQuat/readQuat methods. Replaces the writeQuat/readQuat implementations with one that utilizes smallest three compression. --- Engine/source/core/stream/bitStream.cpp | 53 +++++++++++++++++++------ Engine/source/core/stream/bitStream.h | 8 ++-- 2 files changed, 44 insertions(+), 17 deletions(-) diff --git a/Engine/source/core/stream/bitStream.cpp b/Engine/source/core/stream/bitStream.cpp index 1a5ab3202..704da2b11 100644 --- a/Engine/source/core/stream/bitStream.cpp +++ b/Engine/source/core/stream/bitStream.cpp @@ -488,24 +488,51 @@ void BitStream::readAffineTransform(MatrixF* matrix) void BitStream::writeQuat( const QuatF& quat, U32 bitCount ) { - writeSignedFloat( quat.x, bitCount ); - writeSignedFloat( quat.y, bitCount ); - writeSignedFloat( quat.z, bitCount ); - writeFlag( quat.w < 0.0f ); + F32 quatVals[4] = { quat.x, quat.y, quat.z, quat.w }; + bool flipQuat = (quatVals[0] < 0); + F32 maxVal = mFabs(quatVals[0]); + S32 idxMax = 0; + + for (S32 i = 1; i < 4; ++i) + { + if (mFabs(quatVals[i]) > maxVal) + { + idxMax = i; + maxVal = mFabs(quatVals[i]); + flipQuat = (quatVals[i] < 0); + } + } + writeInt(idxMax, 2); + + for (S32 i = 0; i < 4; ++i) + { + if (i == idxMax) + continue; + F32 curValue = (flipQuat ? -quatVals[i] : quatVals[i]) * (F32) M_SQRT2; + writeSignedFloat( curValue, bitCount ); + } } void BitStream::readQuat( QuatF *outQuat, U32 bitCount ) { - outQuat->x = readSignedFloat( bitCount ); - outQuat->y = readSignedFloat( bitCount ); - outQuat->z = readSignedFloat( bitCount ); + F32 quatVals[4]; + F32 sum = 0.0f; - outQuat->w = mSqrt( 1.0 - getMin( mSquared( outQuat->x ) + - mSquared( outQuat->y ) + - mSquared( outQuat->z ), - 1.0f ) ); - if ( readFlag() ) - outQuat->w = -outQuat->w; + S32 idxMax = readInt( 2 ); + for (S32 i = 0; i < 4; ++i) + { + if (i == idxMax) + continue; + quatVals[i] = readSignedFloat( bitCount ) * M_SQRTHALF_F; + sum += quatVals[i] * quatVals[i]; + } + + if (sum > 1.0f) + quatVals[idxMax] = 1.0f; + else + quatVals[idxMax] = mSqrt(1.0f - sum); + + outQuat->set(quatVals[0], quatVals[1], quatVals[2], quatVals[3]); } void BitStream::writeBits( const BitVector &bitvec ) diff --git a/Engine/source/core/stream/bitStream.h b/Engine/source/core/stream/bitStream.h index b0bb2f22a..bd81f3b1b 100644 --- a/Engine/source/core/stream/bitStream.h +++ b/Engine/source/core/stream/bitStream.h @@ -207,18 +207,18 @@ public: void readAffineTransform(MatrixF*); /// Writes a quaternion in a lossy compressed format that - /// is ( bitCount * 3 ) + 1 bits in size. + /// is ( bitCount * 3 ) + 2 bits in size. /// /// @param quat The normalized quaternion to write. - /// @param bitCount The the storage space for the xyz component of + /// @param bitCount The the storage space for the packed components of /// the quaternion. /// void writeQuat( const QuatF& quat, U32 bitCount = 9 ); /// Reads a quaternion written with writeQuat. /// - /// @param quat The normalized quaternion to write. - /// @param bitCount The the storage space for the xyz component of + /// @param quat The quaternion that was read. + /// @param bitCount The the storage space for the packed components of /// the quaternion. Must match the bitCount at write. /// @see writeQuat /// From 6ba442bf07372db555f9fd2073ec95d1d801925c Mon Sep 17 00:00:00 2001 From: Brian Roberts Date: Mon, 29 Oct 2018 13:21:42 -0500 Subject: [PATCH 143/144] Update terrFeatureGLSL.cpp --- Engine/source/terrain/glsl/terrFeatureGLSL.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp index 6eb0c8c1a..7a4755d03 100644 --- a/Engine/source/terrain/glsl/terrFeatureGLSL.cpp +++ b/Engine/source/terrain/glsl/terrFeatureGLSL.cpp @@ -927,9 +927,9 @@ void TerrainNormalMapFeatGLSL::processVert( Vector &component void TerrainNormalMapFeatGLSL::processPix( Vector &componentList, const MaterialFeatureData &fd ) { - // We only need to process normals during the deferred. - if (!fd.features.hasFeature(MFT_DeferredConditioner)) - return; + // We only need to process normals during the deferred. + if (!fd.features.hasFeature(MFT_DeferredConditioner)) + return; MultiLine *meta = new MultiLine; From 4453a4ad4b2117e726fe972a39a8562de5f2f38f Mon Sep 17 00:00:00 2001 From: Brian Roberts Date: Mon, 29 Oct 2018 13:22:16 -0500 Subject: [PATCH 144/144] Update terrFeatureHLSL.cpp --- Engine/source/terrain/hlsl/terrFeatureHLSL.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp index 3b05a30f7..e0039f8af 100644 --- a/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp +++ b/Engine/source/terrain/hlsl/terrFeatureHLSL.cpp @@ -908,9 +908,9 @@ void TerrainNormalMapFeatHLSL::processVert( Vector &component void TerrainNormalMapFeatHLSL::processPix( Vector &componentList, const MaterialFeatureData &fd ) { - // We only need to process normals during the deferred. - if (!fd.features.hasFeature(MFT_DeferredConditioner)) - return; + // We only need to process normals during the deferred. + if (!fd.features.hasFeature(MFT_DeferredConditioner)) + return; MultiLine *meta = new MultiLine;